diff --git a/web_version/v2/easyuse.js b/web_version/v2/easyuse.js index ddb9647..4ad07ba 100644 --- a/web_version/v2/easyuse.js +++ b/web_version/v2/easyuse.js @@ -27,4 +27,4 @@ let ze,Ve;class He{constructor(e=!1){this.detached=e,this._active=!0,this.effect * (c) 2024 Eduardo San Martin Morote * @license MIT */ -let os;const is=e=>os=e,rs=Symbol();function ss(e){return e&&"object"==typeof e&&"[object Object]"===Object.prototype.toString.call(e)&&"function"!=typeof e.toJSON}var as,ls;(ls=as||(as={})).direct="direct",ls.patchObject="patch object",ls.patchFunction="patch function";const cs=()=>{};function us(e,t,n,o=cs){e.push(t);const i=()=>{const n=e.indexOf(t);n>-1&&(e.splice(n,1),o())};var r;return!n&&Ye()&&(r=i,ze&&ze.cleanups.push(r)),i}function ds(e,...t){e.slice().forEach((e=>{e(...t)}))}const ps=e=>e(),fs=Symbol(),hs=Symbol();function ms(e,t){e instanceof Map&&t instanceof Map?t.forEach(((t,n)=>e.set(n,t))):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const o=t[n],i=e[n];ss(i)&&ss(o)&&e.hasOwnProperty(n)&&!dn(o)&&!qt(o)?e[n]=ms(i,o):e[n]=o}return e}const gs=Symbol();const{assign:vs}=Object;function ys(e,t,n,o){const{state:i,actions:r,getters:s}=t,a=n.state.value[e];let l;return l=bs(e,(function(){a||(n.state.value[e]=i?i():{});const t=function(e){const t=ie(e)?new Array(e.length):{};for(const n in e)t[n]=_n(e,n);return t}(n.state.value[e]);return vs(t,r,Object.keys(s||{}).reduce(((t,o)=>(t[o]=rn(_r((()=>{is(n);const t=n._s.get(e);return s[o].call(t,t)}))),t)),{}))}),t,n,o,!0),l}function bs(e,t,n={},o,i,r){let s;const a=vs({actions:{}},n),l={deep:!0};let c,u,d,p=[],f=[];const h=o.state.value[e];let m;function g(t){let n;c=u=!1,"function"==typeof t?(t(o.state.value[e]),n={type:as.patchFunction,storeId:e,events:d}):(ms(o.state.value[e],t),n={type:as.patchObject,payload:t,storeId:e,events:d});const i=m=Symbol();Pn().then((()=>{m===i&&(c=!0)})),u=!0,ds(p,n,o.state.value[e])}r||h||(o.state.value[e]={}),pn({});const v=r?function(){const{state:e}=n,t=e?e():{};this.$patch((e=>{vs(e,t)}))}:cs;const y=(t,n="")=>{if(fs in t)return t[hs]=n,t;const i=function(){is(o);const n=Array.from(arguments),r=[],s=[];let a;ds(f,{args:n,name:i[hs],store:b,after:function(e){r.push(e)},onError:function(e){s.push(e)}});try{a=t.apply(this&&this.$id===e?this:b,n)}catch(l){throw ds(s,l),l}return a instanceof Promise?a.then((e=>(ds(r,e),e))).catch((e=>(ds(s,e),Promise.reject(e)))):(ds(r,a),a)};return i[fs]=!0,i[hs]=n,i},b=Xt({_p:o,$id:e,$onAction:us.bind(null,f),$patch:g,$reset:v,$subscribe(t,n={}){const i=us(p,t,n.detached,(()=>r())),r=s.run((()=>bi((()=>o.state.value[e]),(o=>{("sync"===n.flush?u:c)&&t({storeId:e,type:as.direct,events:d},o)}),vs({},l,n))));return i},$dispose:function(){s.stop(),p=[],f=[],o._s.delete(e)}});o._s.set(e,b);const _=(o._a&&o._a.runWithContext||ps)((()=>o._e.run((()=>(s=We()).run((()=>t({action:y})))))));for(const x in _){const t=_[x];if(dn(t)&&(!dn(S=t)||!S.effect)||qt(t))r||(!h||ss(w=t)&&w.hasOwnProperty(gs)||(dn(t)?t.value=h[x]:ms(t,h[x])),o.state.value[e][x]=t);else if("function"==typeof t){const e=y(t,x);_[x]=e,a.actions[x]=t}}var w,S;return vs(b,_),vs(on(b),_),Object.defineProperty(b,"$state",{get:()=>o.state.value[e],set:e=>{g((t=>{vs(t,e)}))}}),o._p.forEach((e=>{vs(b,s.run((()=>e({store:b,app:o._a,pinia:o,options:a}))))})),h&&r&&n.hydrate&&n.hydrate(b.$state,h),c=!0,u=!0,b}function _s(e,t,n){let o,i;const r="function"==typeof t;function s(e,n){(e=e||(!!(sr||Fn||Uo)?zo(rs,null):null))&&is(e),(e=os)._s.has(o)||(r?bs(o,t,i,e):ys(o,i,e));return e._s.get(o)}return"string"==typeof e?(o=e,i=r?n:t):(i=e,o=e.id),s.$id=o,s}function ws(e){{e=on(e);const t={};for(const n in e){const o=e[n];(dn(o)||qt(o))&&(t[n]=bn(e,n))}return t}}var Ss="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function xs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ks=function(){this.__data__=[],this.size=0};var Cs=function(e,t){return e===t||e!=e&&t!=t},As=Cs;var Es=function(e,t){for(var n=e.length;n--;)if(As(e[n][0],t))return n;return-1},Os=Es,Ls=Array.prototype.splice;var Ts=Es;var Is=Es;var Ns=Es;var Ps=ks,Ds=function(e){var t=this.__data__,n=Os(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ls.call(t,n,1),--this.size,!0)},js=function(e){var t=this.__data__,n=Ts(t,e);return n<0?void 0:t[n][1]},Ms=function(e){return Is(this.__data__,e)>-1},Rs=function(e,t){var n=this.__data__,o=Ns(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};function $s(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},ec=sa,tc=ql,nc=Il,oc={};oc["[object Float32Array]"]=oc["[object Float64Array]"]=oc["[object Int8Array]"]=oc["[object Int16Array]"]=oc["[object Int32Array]"]=oc["[object Uint8Array]"]=oc["[object Uint8ClampedArray]"]=oc["[object Uint16Array]"]=oc["[object Uint32Array]"]=!0,oc["[object Arguments]"]=oc["[object Array]"]=oc["[object ArrayBuffer]"]=oc["[object Boolean]"]=oc["[object DataView]"]=oc["[object Date]"]=oc["[object Error]"]=oc["[object Function]"]=oc["[object Map]"]=oc["[object Number]"]=oc["[object Object]"]=oc["[object RegExp]"]=oc["[object Set]"]=oc["[object String]"]=oc["[object WeakMap]"]=!1;var ic=function(e){return nc(e)&&tc(e.length)&&!!oc[ec(e)]};var rc=function(e){return function(t){return e(t)}},sc={exports:{}};!function(e,t){var n=Hs,o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,r=i&&i.exports===o&&n.process,s=function(){try{var e=i&&i.require&&i.require("util").types;return e||r&&r.binding&&r.binding("util")}catch(t){}}();e.exports=s}(sc,sc.exports);var ac=sc.exports,lc=ic,cc=rc,uc=ac&&ac.isTypedArray,dc=uc?cc(uc):lc,pc=Tl,fc=Yl,hc=Zl,mc=Xl,gc=Jl,vc=dc,yc=Object.prototype.hasOwnProperty;var bc=function(e,t){var n=hc(e),o=!n&&fc(e),i=!n&&!o&&mc(e),r=!n&&!o&&!i&&vc(e),s=n||o||i||r,a=s?pc(e.length,String):[],l=a.length;for(var c in e)!t&&!yc.call(e,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||gc(c,l))||a.push(c);return a},_c=Object.prototype;var wc=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_c)};var Sc=function(e,t){return function(n){return e(t(n))}},xc=Sc(Object.keys,Object),kc=wc,Cc=xc,Ac=Object.prototype.hasOwnProperty;var Ec=da,Oc=ql;var Lc=function(e){return null!=e&&Oc(e.length)&&!Ec(e)},Tc=bc,Ic=function(e){if(!kc(e))return Cc(e);var t=[];for(var n in Object(e))Ac.call(e,n)&&"constructor"!=n&&t.push(n);return t},Nc=Lc;var Pc=function(e){return Nc(e)?Tc(e):Ic(e)},Dc=Ll,jc=Pc;var Mc=function(e,t){return e&&Dc(t,jc(t),e)};var Rc=aa,$c=wc,Gc=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},Bc=Object.prototype.hasOwnProperty;var Fc=bc,Uc=function(e){if(!Rc(e))return Gc(e);var t=$c(e),n=[];for(var o in e)("constructor"!=o||!t&&Bc.call(e,o))&&n.push(o);return n},zc=Lc;var Vc=function(e){return zc(e)?Fc(e,!0):Uc(e)},Hc=Ll,Wc=Vc;var Yc=function(e,t){return e&&Hc(t,Wc(t),e)},Zc={exports:{}};!function(e,t){var n=Zs,o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,r=i&&i.exports===o?n.Buffer:void 0,s=r?r.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,o=s?s(n):new e.constructor(n);return e.copy(o),o}}(Zc,Zc.exports);var Kc=Zc.exports;var Xc=function(e,t){var n=-1,o=e.length;for(t||(t=Array(o));++n({groups:[],nodes:[]}),getters:{groups_nodes(){var e;let t=[],n=[];if((null==(e=this.nodes)?void 0:e.length)>0){this.nodes.map((e=>{let o=e.pos,i=!1;for(let n=0;nr.pos[0]&&o[0]r.pos[1]&&o[1]e.pos[0]-t.pos[0])).sort(((e,t)=>e.pos[1]-t.pos[1])))},setNodes(e){this.nodes=tp(e)},update(){y.extensionManager.activeSidebarTab===M&&setTimeout((e=>{this.setGroups(y.canvas.graph._groups),this.setNodes(y.canvas.graph._nodes)}),1)},watchGraph(){let e=this;this.update();const t=y.graph.onNodeAdded;y.graph.onNodeAdded=function(n){e.update();const o=n.onRemoved;return n.onRemoved=function(){return e.update(),null==o?void 0:o.apply(this,arguments)},null==t?void 0:t.apply(this,arguments)},y.canvas.onNodeMoved=function(t){e.update()};const n=LGraphCanvas.onNodeAlign;LGraphCanvas.onNodeAlign=function(t){return e.update(),null==n?void 0:n.apply(this,arguments)};const o=LGraphCanvas.onGroupAdd;LGraphCanvas.onGroupAdd=function(){return e.update(),null==o?void 0:o.apply(this,arguments)};const i=LGraphCanvas.onGroupAlign;LGraphCanvas.onGroupAlign=function(t){return e.update(),null==i?void 0:i.apply(this,arguments)};const r=LGraphCanvas.onMenuNodeRemove;LGraphCanvas.onMenuNodeRemove=function(t){return e.update(),null==r?void 0:r.apply(this,arguments)}}}});let op=null;const ip=["custom_obsidian","custom_obsidian_dark","custom_milk_white"],rp={"easy positive":"green","easy negative":"red","easy promptList":"cyan","easy promptLine":"cyan","easy promptConcat":"cyan","easy promptReplace":"cyan","easy textSwitch":"pale_blue"};let sp=LGraphCanvas.node_colors,ap=null,lp=null,cp=null,up=null;for(let by in H)dp=H[by],y.ui.settings.addSetting(dp);var dp;function pp(e,t=!1){let n="after",o="before";t&&([o,n]=[n,o]),e.label=(e.label??e.name).replace(o,n),e.name=e.label}function fp(e,t,n,o,i,r,s){t.strokeStyle=o,t.fillStyle=i;let a=LiteGraph.NODE_TITLE_HEIGHT,l=this.ds.scale<.5,c=e._shape||e.constructor.shape||LiteGraph.ROUND_SHAPE,u=e.constructor.title_mode,d=!0;u==LiteGraph.TRANSPARENT_TITLE||u==LiteGraph.NO_TITLE?d=!1:u==LiteGraph.AUTOHIDE_TITLE&&mouse_over&&(d=!0);let p=new Float32Array(4);p=[0,d?-a:0,n[0]+1,d?n[1]+a:n[1]];let f=t.globalAlpha;if(t.lineWidth=1,t.beginPath(),c==LiteGraph.BOX_SHAPE||l?t.fillRect(p[0],p[1],p[2],p[3]):c==LiteGraph.ROUND_SHAPE||c==LiteGraph.CARD_SHAPE?t.roundRect(p[0],p[1],p[2],p[3],c==LiteGraph.CARD_SHAPE?[this.round_radius,this.round_radius,0,0]:[this.round_radius]):c==LiteGraph.CIRCLE_SHAPE&&t.arc(.5*n[0],.5*n[1],.5*n[0],0,2*Math.PI),t.strokeStyle=LiteGraph.WIDGET_OUTLINE_COLOR,t.stroke(),t.strokeStyle=o,t.fill(),!e.flags.collapsed&&d&&(t.shadowColor="transparent",t.fillStyle="rgba(0,0,0,0.2)",t.fillRect(0,-1,p[2],2)),t.shadowColor="transparent",e.onDrawBackground&&e.onDrawBackground(t,this,this.canvas,this.graph_mouse),d||u==LiteGraph.TRANSPARENT_TITLE){const i="dark"==function(e){let t=e.replace("#","");return n=parseInt(t.substring(0,2),16),o=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16),.299*n+.587*o+.114*i>127.5?"light":"dark";var n,o,i}((null==e?void 0:e.color)||"#ffffff");if(e.onDrawTitleBar)e.onDrawTitleBar(t,a,n,this.ds.scale,o);else if(u!=LiteGraph.TRANSPARENT_TITLE&&(e.constructor.title_color||this.render_title_colored)){let i=e.constructor.title_color||o;if(e.flags.collapsed&&(t.shadowColor=LiteGraph.DEFAULT_SHADOW_COLOR),this.use_gradients){let e=LGraphCanvas.gradients[i];e||(e=LGraphCanvas.gradients[i]=t.createLinearGradient(0,0,400,0),e.addColorStop(0,i),e.addColorStop(1,"#000")),t.fillStyle=e}else t.fillStyle=i;t.beginPath(),c==LiteGraph.BOX_SHAPE||l?t.rect(0,-a,n[0]+1,a):c!=LiteGraph.ROUND_SHAPE&&c!=LiteGraph.CARD_SHAPE||t.roundRect(0,-a,n[0]+1,a,e.flags.collapsed?[this.round_radius]:[this.round_radius,this.round_radius,0,0]),t.fill(),t.shadowColor="transparent"}let s=!1;LiteGraph.node_box_coloured_by_mode&&LiteGraph.NODE_MODES_COLORS[e.mode]&&(s=LiteGraph.NODE_MODES_COLORS[e.mode]),LiteGraph.node_box_coloured_when_on&&(s=e.action_triggered?"#FFF":e.execute_triggered?"#AAA":s);let d=10;if(e.onDrawTitleBox)e.onDrawTitleBox(t,a,n,this.ds.scale);else if(c==LiteGraph.ROUND_SHAPE||c==LiteGraph.CIRCLE_SHAPE||c==LiteGraph.CARD_SHAPE){const n=i?"#ffffff":LiteGraph.NODE_SELECTED_TITLE_COLOR,o=i?"#eeeeee":e.boxcolor||s||LiteGraph.NODE_DEFAULT_BOXCOLOR;t.fillStyle=r?n:o,t.beginPath(),t.fillRect(10,0-1.05*d-1,1.1*d,.125*d),t.fillRect(10,0-1.45*d-1,1.1*d,.125*d),t.fillRect(10,0-1.85*d-1,1.1*d,.125*d)}else t.fillStyle=e.boxcolor||s||LiteGraph.NODE_DEFAULT_BOXCOLOR,t.fillRect(.5*(a-d),-.5*(a+d),d,d);if(t.globalAlpha=f,e.onDrawTitleText&&e.onDrawTitleText(t,a,n,this.ds.scale,this.title_text_font,r),!l){t.font=this.title_text_font;let n=String(e.getTitle());n&&(t.fillStyle=r?i?"#ffffff":LiteGraph.NODE_SELECTED_TITLE_COLOR:i?"#ffffff":e.constructor.title_text_color||this.node_title_color,e.flags.collapsed?(t.textAlign="left",t.measureText(n),t.fillText(n.substr(0,20),a,LiteGraph.NODE_TITLE_TEXT_Y-a),t.textAlign="left"):(t.textAlign="left",t.fillText(n,a,LiteGraph.NODE_TITLE_TEXT_Y-a)))}if(!e.flags.collapsed&&e.subgraph&&!e.skip_subgraph_button){let n=LiteGraph.NODE_TITLE_HEIGHT,o=e.size[0]-n,i=LiteGraph.isInsideRectangle(this.graph_mouse[0]-e.pos[0],this.graph_mouse[1]-e.pos[1],o+2,2-n,n-4,n-4);t.fillStyle=i?"#888":"#555",c==LiteGraph.BOX_SHAPE||l?t.fillRect(o+2,2-n,n-4,n-4):(t.beginPath(),t.roundRect(o+2,2-n,n-4,n-4,[4]),t.fill()),t.fillStyle="#333",t.beginPath(),t.moveTo(o+.2*n,.6*-n),t.lineTo(o+.8*n,.6*-n),t.lineTo(o+.5*n,.3*-n),t.fill()}e.onDrawTitle&&e.onDrawTitle(t)}if(r){e.onBounding&&e.onBounding(p),u==LiteGraph.TRANSPARENT_TITLE&&(p[1]-=a,p[3]+=a),t.lineWidth=2,t.globalAlpha=.8,t.beginPath();let i=0,r=0,s=1;c==LiteGraph.BOX_SHAPE?t.rect(i+p[0],i+p[1],r+p[2],r+p[3]):c==LiteGraph.ROUND_SHAPE||c==LiteGraph.CARD_SHAPE&&e.flags.collapsed?t.roundRect(i+p[0],i+p[1],r+p[2],r+p[3],[this.round_radius*s]):c==LiteGraph.CARD_SHAPE?t.roundRect(i+p[0],i+p[1],r+p[2],r+p[3],[this.round_radius*s,s,this.round_radius*s,s]):c==LiteGraph.CIRCLE_SHAPE&&t.arc(.5*n[0],.5*n[1],.5*n[0]+6,0,2*Math.PI),t.strokeStyle=LiteGraph.NODE_BOX_OUTLINE_COLOR,t.stroke(),t.strokeStyle=o,t.globalAlpha=1}e.execute_triggered>0&&e.execute_triggered--,e.action_triggered>0&&e.action_triggered--}function hp(e,t,n,o){if(!e.widgets||!e.widgets.length)return 0;let i=e.size[0],r=e.widgets;t+=2;let s=LiteGraph.NODE_WIDGET_HEIGHT,a=this.ds.scale>.5;n.save(),n.globalAlpha=this.editor_alpha;let l=LiteGraph.WIDGET_OUTLINE_COLOR,c=LiteGraph.WIDGET_BGCOLOR,u=LiteGraph.WIDGET_TEXT_COLOR,d=LiteGraph.WIDGET_SECONDARY_TEXT_COLOR,p=12;for(let f=0;f1&&(i=1),n.fillStyle=h.options.hasOwnProperty("slider_color")?h.options.slider_color:o==h?l:I,n.beginPath(),n.roundRect(p,m,i*(g-24),s,[.25*s]),n.fill(),h.marker){let e=(h.marker-h.options.min)/t;e<0&&(e=0),e>1&&(e=1),n.fillStyle=h.options.hasOwnProperty("marker_color")?h.options.marker_color:"#AA9",n.roundRect(p+e*(g-24),m,2,s,[.25*s])}if(a){n.textAlign="center",n.fillStyle=u;let e=(h.label||h.name)+": "+Number(h.value).toFixed(null!=h.options.precision?h.options.precision:3).toString();n.fillText(e,.5*g,m+.7*s)}break;case"number":case"combo":if(n.textAlign="left",n.strokeStyle=l,n.fillStyle=c,n.beginPath(),a?n.roundRect(p,m,g-24,s,[.25*s]):n.rect(p,m,g-24,s),n.fill(),a){h.disabled||n.stroke(),n.fillStyle=u,h.disabled||(n.beginPath(),n.moveTo(24,m+6.5),n.lineTo(18,m+.5*s),n.lineTo(24,m+s-6.5),n.fill(),n.beginPath(),n.moveTo(g-p-12,m+6.5),n.lineTo(g-p-6,m+.5*s),n.lineTo(g-p-12,m+s-6.5),n.fill()),n.fillStyle=d,n.font="10px Inter",n.fillText(h.label||h.name,29,m+.7*s),n.fillStyle=u,n.textAlign="right";let e=6;if("number"==h.type)n.font="10px Inter",n.fillText(Number(h.value).toFixed(void 0!==h.options.precision?h.options.precision:3),g-24-e,m+.7*s);else{let t=h.value;if(h.options.values){let e=h.options.values;e.constructor===Function&&(e=e()),e&&e.constructor!==Array&&(t=e[h.value])}n.fillText(t,g-24-e,m+.7*s)}}break;case"string":case"text":if(n.textAlign="left",n.strokeStyle=l,n.fillStyle=c,n.beginPath(),a?n.roundRect(p,m,g-24,s,[.25*s]):n.rect(p,m,g-24,s),n.fill(),a){h.disabled||n.stroke(),n.save(),n.beginPath(),n.rect(p,m,g-24,s),n.clip(),n.fillStyle=d;const e=h.label||h.name;n.font="10px Inter",null!=e&&n.fillText(e,24,m+.7*s),n.fillStyle=u,n.textAlign="right",n.fillText(String(h.value).substr(0,30),g-24,m+.7*s),n.restore()}break;default:h.draw&&h.draw(n,e,g,m,s)}t+=(h.computeSize?h.computeSize(g)[1]:s)+4,n.globalAlpha=this.editor_alpha}n.restore(),n.textAlign="left"}function mp(e,t,n,o,i){return new LiteGraph.ContextMenu(LiteGraph.NODE_MODES,{event:n,callback:function(e){if(!i)return;var t=Object.values(LiteGraph.NODE_MODES).indexOf(e),n=function(e){t>=0&&LiteGraph.NODE_MODES[t]?e.changeMode(t):e.changeMode(LiteGraph.ALWAYS),op||(op=np()),op.update()},o=LGraphCanvas.active_canvas;if(!o.selected_nodes||Object.keys(o.selected_nodes).length<=1)n(i);else for(var r in o.selected_nodes)n(o.selected_nodes[r])},parentMenu:o,node:i}),!1}function gp(e,t,n,o,i){if(!i)throw"no node for color";var r=[];for(var s in r.push({value:null,content:"No color"}),LGraphCanvas.node_colors){var a=LGraphCanvas.node_colors[s];e={value:s,content:""+s+""};r.push(e)}return new LiteGraph.ContextMenu(r,{event:n,callback:function(e){if(!i)return;var t=e.value?LGraphCanvas.node_colors[e.value]:null,n=function(e){t?e.constructor===LiteGraph.LGraphGroup?e.color=t.groupcolor:(e.color=t.color,e.bgcolor=t.bgcolor):(delete e.color,delete e.bgcolor),op||(op=np()),op.update()},o=LGraphCanvas.active_canvas;if(!o.selected_nodes||Object.keys(o.selected_nodes).length<=1)n(i);else for(var r in o.selected_nodes)n(o.selected_nodes[r]);i.setDirtyCanvas(!0,!0)},parentMenu:o,node:i}),!1}function vp(e,t,n,o,i){var r=e.property||"title",s=i[r],a=document.createElement("div");a.is_modified=!1,a.className="graphdialog",a.innerHTML="",a.close=function(){a.parentNode&&a.parentNode.removeChild(a)},a.querySelector(".name").innerText=r;var l=a.querySelector(".value");l&&(l.value=s,l.addEventListener("blur",(function(e){this.focus()})),l.addEventListener("keydown",(function(e){if(a.is_modified=!0,27==e.keyCode)a.close();else if(13==e.keyCode)h();else if(13!=e.keyCode&&"textarea"!=e.target.localName)return;e.preventDefault(),e.stopPropagation()})));var c=LGraphCanvas.active_canvas.canvas,u=c.getBoundingClientRect(),d=-20,p=-20;u&&(d-=u.left,p-=u.top),event?(a.style.left=event.clientX+d+"px",a.style.top=event.clientY+p+"px"):(a.style.left=.5*c.width+d+"px",a.style.top=.5*c.height+p+"px"),a.querySelector("button").addEventListener("click",h),c.parentNode.appendChild(a),l&&l.focus();var f=null;function h(){l&&function(t){"Number"==e.type?t=Number(t):"Boolean"==e.type&&(t=Boolean(t));i[r]=t,a.parentNode&&a.parentNode.removeChild(a);i.setDirtyCanvas(!0,!0),op||(op=np());op.update()}(l.value)}a.addEventListener("mouseleave",(function(e){LiteGraph.dialog_close_on_mouse_leave&&!a.is_modified&&LiteGraph.dialog_close_on_mouse_leave&&(f=setTimeout(a.close,LiteGraph.dialog_close_on_mouse_leave_delay))})),a.addEventListener("mouseenter",(function(e){LiteGraph.dialog_close_on_mouse_leave&&f&&clearTimeout(f)}))}y.registerExtension({name:"Comfy.EasyUse.UI",init(){var e,t;const n="Comfy.CustomColorPalettes",o="Comfy.Settings.Comfy.CustomColorPalettes";if(lp||(lp=A(n,o)),cp||(cp=A("Comfy.ColorPalette","Comfy.Settings.Comfy.ColorPalette")||"dark"),(!(null==(e=null==lp?void 0:lp.obsidian)?void 0:e.version)||lp.obsidian.version<$.ColorPalette.version)&&(lp.obsidian=$.ColorPalette,lp.obsidian_dark=G.ColorPalette,E(n,lp,o)),(!(null==(t=null==lp?void 0:lp.milk_white)?void 0:t.version)||lp.milk_white.version{(null==e?void 0:e.value)&&(null==e?void 0:e.oldValue)&&(await W(1),Object.assign(y.canvas.default_connection_color_byType,N),Object.assign(LGraphCanvas.link_type_colors,N)),"custom_milk_white"==e.value&&document.body.classList.remove(T)})),setTimeout((e=>bp(A("Comfy.UseNewMenu")||"Disabled")),1)},async nodeCreated(e){var t;if(rp.hasOwnProperty(e.comfyClass)){const t=rp[e.comfyClass],n=sp[t];if(!n)return;n.color&&(e.color=n.color),n.bgcolor&&(e.bgcolor=n.bgcolor)}if(ap||(ap=A("Comfy.WidgetControlMode")),"before"==ap){const n="before"==ap;if((null==(t=e.widgets)?void 0:t.length)>0)for(const t of e.widgets)if(["control_before_generate","control_after_generate"].includes(t.name)&&(await pp(t,n),t.linkedWidgets))for(const e of t.linkedWidgets)await pp(e,n)}}});const yp=null==(h=y.ui.settings.settingsLookup)?void 0:h["Comfy.UseNewMenu"];yp&&(yp.onChange=e=>bp(e));const bp=e=>{var t;const n=(null==(t=document.getElementById("crystools-root"))?void 0:t.children)||null;if((null==n?void 0:n.length)>0){if(!up)for(let e=0;ee.widgets.find((e=>e.name===t)),Sp=(e,t,n=!1,o="")=>{var i;if(!t||((e,t)=>!!e.inputs&&e.inputs.some((e=>e.name===t)))(e,t.name))return;_p[t.name]||(_p[t.name]={origType:t.type,origComputeSize:t.computeSize});const r=e.size;t.type=n?_p[t.name].origType:"easyHidden"+o,t.computeSize=n?_p[t.name].origComputeSize:()=>[0,-4],null==(i=t.linkedWidgets)||i.forEach((o=>Sp(e,o,":"+t.name,n)));const s=n?Math.max(e.computeSize()[1],r[1]):e.size[1];e.setSize([e.size[0],s])},xp=(e,t=0)=>{var n,o;if(e)return(null==(n=e.widgets)?void 0:n[t])?e.widgets[t].value:e.widgets_values?null==(o=e.widgets_values)?void 0:o[t]:void 0},kp=e=>e.setSize([e.size[0],e.computeSize()[1]]),Cp=(e,t)=>graph.getNodeById(e),Ap=e=>{var t;try{return Object.values(null==(t=null==graph?void 0:graph.list_of_graphcanvas[0])?void 0:t.selected_nodes)}catch(n){return[]}};function Ep(e,t,n){return e+(o=n,(.5-.5*Math.cos(Math.PI*o))*(t-e));var o}const Op=(e,t=!0)=>{var n,o;const i=(null==(o=null==(n=e.graph)?void 0:n.list_of_graphcanvas)?void 0:o[0])||null;if(!i)return;const[r,s]=e.pos,[a,l]=e.size;(([e,t],n)=>{const o=n.ds,i=document.body.clientWidth,r=document.body.clientHeight,s=o.scale,a=.5*i/s-e,l=.5*r/s-t,c=Date.now()+250,u=o.offset[0],d=o.offset[1],p=()=>{const e=c-Date.now();if(!(Date.now(){const t=Cp(e);t&&Op(t)},Tp=(e,t=(()=>graph.links??[])())=>t[e],Ip=e=>e.toLowerCase().replace(/_./g,(e=>e.replace("_","").toUpperCase())),Np=e=>"easy getNode"===e.type,Pp=e=>"easy setNode"===e.type,Dp=e=>Np(e)||Pp(e),jp=(e=(()=>graph._nodes??[])())=>e.filter((e=>Dp(e))),Mp=(e,t,n=0)=>{e.widgets_values||(e.widgets_values=[]),e.widgets_values[n]=t,e.widgets[n].value=t},Rp=e=>graph.add(e),$p=e=>graph.remove(e),Gp=(e,t=0)=>{var n,o;if("Reroute"!==e.type)return[e,t];const i=e,r=null==(o=null==(n=i.inputs)?void 0:n[0])?void 0:o.link;if(!r)return[i,t];const s=Tp(r);if(!s)return[i,t];const a=Cp(s.origin_id);return a?(setTimeout((()=>{$p(i)})),Gp(a,s.origin_slot)):[i,t]},Bp=e=>{var t,n,o;if("Reroute"!==e.type)return e;const i=e,r=null==(n=null==(t=i.outputs)?void 0:t[0])?void 0:n.links;if(!r)return i;const s=r[0];if(!s)return i;const a=Tp(s);if(!a)return i;const l=Cp(a.target_id);return l?(1===(null==(o=i.outputs[0].links)?void 0:o.length)&&setTimeout((()=>{$p(i)})),Bp(l)):i};const Fp=new class{constructor(){v(this,"element",_(`div.${L}toast`)),v(this,"children",HTMLElement),v(this,"container",document.body),this.container.appendChild(this.element)}async show(e){let t=_(`div.${L}toast-container`,[_("div",[_("span",[...e.icon?[_("i",{className:e.icon})]:[],_("span",e.content)])])]);t.setAttribute("toast-id",e.id),this.element.replaceChildren(t),this.container.appendChild(this.element),await W(64),t.style.marginTop=`-${t.offsetHeight}px`,await W(64),t.classList.add("show"),e.duration&&(await W(e.duration),this.hide(e.id))}async hide(e){const t=document.querySelector(`.${L}toast > [toast-id="${e}"]`);(null==t?void 0:t.classList.contains("show"))&&(t.classList.remove("show"),await W(750)),t&&t.remove()}async clearAllMessages(){let e=document.querySelector(`.${L}container`);e&&(e.innerHTML="")}async info(e,t=3e3,n=[]){this.show({id:"toast-info",icon:`mdi mdi-information ${L}theme`,content:e,duration:t})}async success(e,t=3e3){this.show({id:"toast-success",icon:`mdi mdi-check-circle ${L}success`,content:e,duration:t})}async error(e,t=3e3){this.show({id:"toast-error",icon:`mdi mdi-close-circle ${L}error`,content:e,duration:t})}async warn(e,t=3e3){this.show({id:"toast-warn",icon:`mdi mdi-alert-circle ${L}warning`,content:e,duration:t})}async showLoading(e,t=0){this.show({id:"toast-loading",icon:"mdi mdi-rotate-right loading",content:e,duration:t})}async hideLoading(){this.hide("toast-loading")}},Up=["rescale_after_model","rescale","lora_name","upscale_method","image_output","add_noise","info","sampler_name","ckpt_B_name","ckpt_C_name","save_model","refiner_ckpt_name","num_loras","num_controlnet","mode","toggle","resolution","ratio","target_parameter","input_count","replace_count","downscale_mode","range_mode","text_combine_mode","input_mode","lora_count","ckpt_count","conditioning_mode","preset","use_tiled","use_batch","num_embeds","easing_mode","guider","scheduler","inpaint_mode","t5_type","rem_mode"],zp=["LIGHT - SD1.5 only (low strength)","STANDARD (medium strength)","VIT-G (medium strength)","PLUS (high strength)","PLUS FACE (portraits)","FULL FACE - SD1.5 only (portraits stronger)"],Vp=["FACEID","FACEID PLUS - SD1.5 only","FACEID PLUS V2","FACEID PLUS KOLORS","FACEID PORTRAIT (style transfer)","FACEID PORTRAIT UNNORM - SDXL only (strong)"],Hp=["easy seed","easy latentNoisy","easy wildcards","easy preSampling","easy preSamplingAdvanced","easy preSamplingNoiseIn","easy preSamplingSdTurbo","easy preSamplingCascade","easy preSamplingDynamicCFG","easy preSamplingLayerDiffusion","easy fullkSampler","easy fullCascadeKSampler"],Wp=["easy fullLoader","easy a1111Loader","easy comfyLoader","easy hyditLoader","easy pixArtLoader"],Yp=["easy imageSize","easy imageSizeBySide","easy imageSizeByLongerSide","easy imageSizeShow","easy imageRatio","easy imagePixelPerfect"];function Zp(e,t){const n=e.comfyClass,o=t.value;switch(t.name){case"range_mode":Sp(e,wp(e,"step"),"step"==o),Sp(e,wp(e,"num_steps"),"num_steps"==o),kp(e);break;case"text_combine_mode":Sp(e,wp(e,"replace_text"),"replace"==o);break;case"lora_name":["lora_model_strength","lora_clip_strength"].map((t=>Sp(e,wp(e,t),"None"!==o)));break;case"resolution":"自定义 x 自定义"===o&&(t.value="width x height (custom)"),["empty_latent_width","empty_latent_height"].map((t=>Sp(e,wp(e,t),"width x height (custom)"===o)));break;case"ratio":["empty_latent_width","empty_latent_height"].map((t=>Sp(e,wp(e,t),"custom"===o)));break;case"num_loras":var i=o+1,r=wp(e,"mode").value;for(let t=0;tSp(e,wp(e,t),"simple"!==r)));for(let t=i;t<21;t++)["lora_"+t+"_name","lora_"+t+"_strength","lora_"+t+"_model_strength","lora_"+t+"_clip_strength"].map((t=>Sp(e,wp(e,t),!1)));kp(e);break;case"num_controlnet":i=o+1,r=wp(e,"mode").value;for(let t=0;tSp(e,wp(e,t),!0))),["start_percent_"+t,"end_percent_"+t].map((t=>Sp(e,wp(e,t),"simple"!==r)));for(let t=i;t<21;t++)["controlnet_"+t,"controlnet_"+t+"_strength","scale_soft_weight_"+t,"start_percent_"+t,"end_percent_"+t].map((t=>Sp(e,wp(e,t),!1)));kp(e);break;case"mode":switch(null==e?void 0:e.comfyClass){case"easy loraStack":i=wp(e,"num_loras").value+1,r=o;for(let t=0;tSp(e,wp(e,t),"simple"!==r)));kp(e);break;case"easy controlnetStack":i=wp(e,"num_controlnet").value+1,r=o;for(let t=0;tSp(e,wp(e,t),"simple"!==r)));kp(e);break;case"easy icLightApply":r=o;["lighting","remove_bg"].map((t=>Sp(e,wp(e,t),"Foreground"===r))),Sp(e,wp(e,"source"),"Foreground"!==r),kp(e)}break;case"toggle":t.type="toggle",t.options={on:"Enabled",off:"Disabled"};break;case"t5_type":["clip_name","padding"].map((t=>Sp(e,wp(e,t),"sd3"==o))),["t5_name","device","dtype"].map((t=>Sp(e,wp(e,t),"t5v11"==o))),kp(e);break;case"preset":if(zp.includes(o)){let t=wp(e,"use_tiled");Sp(e,wp(e,"lora_strength")),Sp(e,wp(e,"provider")),Sp(e,wp(e,"weight_faceidv2")),Sp(e,wp(e,"weight_kolors")),Sp(e,wp(e,"use_tiled"),!0),Sp(e,wp(e,"sharpening"),t&&t.value)}else Vp.includes(o)&&(Sp(e,wp(e,"weight_faceidv2"),!!["FACEID PLUS V2","FACEID PLUS KOLORS"].includes(o)),Sp(e,wp(e,"weight_kolors"),!!["FACEID PLUS KOLORS"].includes(t.value)),["FACEID PLUS KOLORS","FACEID PORTRAIT (style transfer)","FACEID PORTRAIT UNNORM - SDXL only (strong)"].includes(o)?Sp(e,wp(e,"lora_strength"),!1):Sp(e,wp(e,"lora_strength"),!0),Sp(e,wp(e,"provider"),!0),Sp(e,wp(e,"use_tiled")),Sp(e,wp(e,"sharpening")));kp(e);break;case"use_tiled":Sp(e,wp(e,"sharpening"),!!o),kp(e);break;case"num_embeds":i=o+1;for(let t=0;tSp(e,wp(e,t),!1)));break;case"brushnet_random":case"brushnet_segmentation":["dtype","scale","start_at","end_at"].map((t=>Sp(e,wp(e,t),!0))),["fitting","function"].map((t=>Sp(e,wp(e,t),!1)));break;case"powerpaint":["dtype","fitting","function","scale","start_at","end_at"].map((t=>Sp(e,wp(e,t),!0)))}kp(e);break;case"image_output":Sp(e,wp(e,"link_id"),!!["Sender","Sender&Save"].includes(o)),Sp(e,wp(e,"decode_vae_name"),!!["Hide","Hide&Save"].includes(o)),["save_prefix","output_path","embed_workflow","number_padding","overwrite_existing"].map((t=>Sp(e,wp(e,t),!!["Save","Hide&Save","Sender&Save"].includes(o))));break;case"add_noise":var s=wp(e,"control_before_generate"),a=wp(e,"control_after_generate")||s;"disable"===o?(Sp(e,wp(e,"seed")),a&&(a.last_value=a.value,a.value="fixed",Sp(e,a))):(Sp(e,wp(e,"seed"),!0),a&&((null==a?void 0:a.last_value)&&(a.value=a.last_value),Sp(e,a,!0))),kp(e);break;case"guider":switch(o){case"Basic":["cfg","cfg_negative"].map((t=>Sp(e,wp(e,t))));break;case"CFG":Sp(e,wp(e,"cfg"),!0),Sp(e,wp(e,"cfg_negative"));break;case"IP2P+DualCFG":case"DualCFG":["cfg","cfg_negative"].map((t=>Sp(e,wp(e,t))),!0)}kp(e);break;case"scheduler":["karrasADV","exponentialADV","polyExponential"].includes(o)?(["sigma_max","sigma_min"].map((t=>Sp(e,wp(e,t),!0))),["denoise","beta_d","beta_min","eps_s","coeff"].map((t=>Sp(e,wp(e,t))),!1),Sp(e,wp(e,"rho"),"exponentialADV"!=o)):"vp"==o?(["sigma_max","sigma_min","denoise","rho","coeff"].map((t=>Sp(e,wp(e,t)))),["beta_d","beta_min","eps_s"].map((t=>Sp(e,wp(e,t),!0)))):(["sigma_max","sigma_min","beta_d","beta_min","eps_s","rho"].map((t=>Sp(e,wp(e,t)))),Sp(e,wp(e,"coeff"),"gits"==o),Sp(e,wp(e,"denoise"),!0)),kp(e);break;case"conditioning_mode":["replace","concat","combine"].includes(o)?["average_strength","old_cond_start","old_cond_end","new_cond_start","new_cond_end"].map((t=>Sp(e,wp(e,t)))):"average"==o?(Sp(e,wp(e,"average_strength"),!0),["old_cond_start","old_cond_end","new_cond_start","new_cond_end"].map((t=>Sp(e,wp(e,t),!1)))):"timestep"==o&&(["average_strength"].map((t=>Sp(e,wp(e,t),!1))),["old_cond_start","old_cond_end","new_cond_start","new_cond_end"].map((t=>Sp(e,wp(e,t)))));break;case"rescale":wp(e,"rescale_after_model").value,Sp(e,wp(e,"width"),"to Width/Height"===o),Sp(e,wp(e,"height"),"to Width/Height"===o),Sp(e,wp(e,"percent"),"by percentage"===o),Sp(e,wp(e,"longer_side"),"to longer side - maintain aspect"===o),kp(e);break;case"upscale_method":["factor","crop"].map((t=>Sp(e,wp(e,t),"None"!==o)));break;case"target_parameter":switch(n){case"easy XYInputs: Steps":["first_step","last_step"].map((t=>Sp(e,wp(e,t),"steps"==o))),["first_start_step","last_start_step"].map((t=>Sp(e,wp(e,t),"start_at_step"==o))),["first_end_step","last_end_step"].map((t=>Sp(e,wp(e,t),"end_at_step"==o)));break;case"easy XYInputs: Sampler/Scheduler":let t=wp(e,"input_count").value+1;for(let n=0;nSp(e,wp(e,t),"strength"==o))),["first_start_percent","last_start_percent"].map((t=>Sp(e,wp(e,t),"start_percent"==o))),["first_end_percent","last_end_percent"].map((t=>Sp(e,wp(e,t),"end_percent"==o))),["strength","start_percent","end_percent"].map((t=>Sp(e,wp(e,t),o!=t))),kp(e)}case"replace_count":i=o+1;for(let t=0;tSp(e,wp(e,t),!l)));for(let t=i;t<11;t++)["lora_name_"+t,"model_str_"+t,"clip_str_"+t].map((t=>Sp(e,wp(e,t),!1)));kp(e);break;case"ckpt_count":i=o+1;var c=-1!=wp(e,"input_mode").value.indexOf("ClipSkip"),u=-1!=wp(e,"input_mode").value.indexOf("VAE");for(let t=0;tSp(e,wp(e,t),!1)));kp(e);break;case"input_count":i=o+1;var d=wp(e,"target_parameter").value;for(let t=0;tSp(e,wp(e,n),!t)));["model_strength","clip_strength"].map((n=>Sp(e,wp(e,n),!t)));break;case"easy XYInputs: Checkpoint":i=wp(e,"ckpt_count").value+1,c=-1!=wp(e,"input_mode").value.indexOf("ClipSkip"),u=-1!=wp(e,"input_mode").value.indexOf("VAE");for(let n=0;ne.name===t));if(-1!==e){for(let t=e;t{var e;const t=this.computeSize();t[0]"info"===e.name));if(-1!==e&&this.widgets[e]){this.widgets[e].value=t}}requestAnimationFrame((()=>{var e;const t=this.computeSize();t[0]"prompt"==e.name));this.addWidget("button","get values from COMBO link","",(()=>{var t,o;const i=(null==(o=null==(t=this.outputs[1])?void 0:t.links)?void 0:o.length)>0?this.outputs[1].links[0]:null,r=n.graph._nodes.find((e=>{var t;return null==(t=e.inputs)?void 0:t.find((e=>e.link==i))}));if(i&&r){const t=r.inputs.find((e=>e.link==i)).widget.name,n=r.widgets.find((e=>e.name==t));let o=(null==n?void 0:n.options.values)||null;o&&(o=o.join("\n"),e.value=o)}else Fp.error(V("No COMBO link"),3e3)}),{serialize:!1})}),Wp.includes(t.name)){let t=function(e){var t="";for(let n=0;ne.name===t+"_prompt")),o="comfy-multiline-input wildcard_"+t+"_"+this.id.toString();if(-1==n&&e){const n=document.createElement("textarea");n.className=o,n.placeholder="Wildcard Prompt ("+t+")";const i=this.addDOMWidget(t+"_prompt","customtext",n,{getValue:e=>n.value,setValue(e){n.value=e},serialize:!1});i.inputEl=n,i.inputEl.readOnly=!0,n.addEventListener("input",(()=>{var e;null==(e=i.callback)||e.call(i,i.value)})),i.value=e}else if(this.widgets[n])if(e){this.widgets[n].value=e}else{this.widgets.splice(n,1);const e=document.getElementsByClassName(o);e&&e[0]&&e[0].remove()}}};e.prototype.onExecuted=function(e){null==a||a.apply(this,arguments);const o=t(e.positive),i=t(e.negative);n.call(this,o,"positive"),n.call(this,i,"negative")}}if(["easy sv3dLoader"].includes(t.name)){let t=function(e,t,n){switch(e){case"azimuth":return n.readOnly=!0,n.style.opacity=.6,"0:(0.0,0.0)"+(t>1?`\n${t-1}:(360.0,0.0)`:"");case"elevation":return n.readOnly=!0,n.style.opacity=.6,"0:(-90.0,0.0)"+(t>1?`\n${t-1}:(90.0,0.0)`:"");case"custom":return n.readOnly=!1,n.style.opacity=1,"0:(0.0,0.0)\n9:(180.0,0.0)\n20:(360.0,0.0)"}};e.prototype.onNodeCreated=async function(){r&&r.apply(this,[]);const e=this.widgets.find((e=>"easing_mode"==e.name)),n=this.widgets.find((e=>"batch_size"==e.name)),o=this.widgets.find((e=>"scheduler"==e.name));setTimeout((i=>{o.value||(o.value=t(e.value,n.value,o.inputEl))}),1),e.callback=e=>{o.value=t(e,n.value,o.inputEl)},n.callback=n=>{o.value=t(e.value,n,o.inputEl)}}}if(Hp.includes(o)&&(e.prototype.onNodeCreated=async function(){r&&r.apply(this,[]);const e=this.widgets.find((e=>["seed_num","seed"].includes(e.name))),o=this.widgets.find((e=>["control_before_generate","control_after_generate"].includes(e.name)));if("easy seed"==t.name){const t=this.addWidget("button","🎲 Manual Random Seed",null,(t=>{"fixed"!=o.value&&(o.value="fixed"),e.value=Math.floor(Math.random()*P),n.queuePrompt(0,1)}),{serialize:!1});e.linkedWidgets=[t,o]}},e.prototype.onAdded=async function(){i&&i.apply(this,[]);const e=this.widgets.find((e=>["seed_num","seed"].includes(e.name))),t=this.widgets.find((e=>["control_before_generate","control_after_generate"].includes(e.name)));setTimeout((n=>{"control_before_generate"==t.name&&0===e.value&&(e.value=Math.floor(Math.random()*P))}),1)}),"easy convertAnything"==o&&(e.prototype.onNodeCreated=async function(){r&&r.apply(this,[]);const e=this.widgets.find((e=>"output_type"==e.name)),t=t=>{this.outputs[0].type=e.value.toUpperCase(),this.outputs[0].name=e.value,this.outputs[0].label=e.value};setTimeout((e=>t()),10),e.callback=e=>t()}),"easy imageInsetCrop"==o){let t=function(e){const t=e.widgets[0];for(let n=1;n<=4;n++)"Pixels"===t.value?(e.widgets[n].options.step=80,e.widgets[n].options.max=8192):(e.widgets[n].options.step=10,e.widgets[n].options.max=99)};e.prototype.onAdded=async function(e){const n=this.widgets[0];let o=n.callback;n.callback=(...e)=>{t(this),o&&o.apply(n,[...e])},setTimeout((e=>{t(this)}),1)}}},nodeCreated(e){if(e.comfyClass.startsWith("easy ")){if(e.widgets)for(const n of e.widgets){if(!Up.includes(n.name))continue;let t=n.value;Zp(e,n),Object.defineProperty(n,"value",{get:e=>t,set(o){o!==t&&(t=o,Zp(e,n))}})}const t=e.comfyClass;if("easy preDetailerFix"==t){const t=e.widgets.find((e=>"customtext"===e.type));if(!t)return;t.dynamicPrompts=!1,t.inputEl.placeholder="wildcard spec: if kept empty, this option will be ignored",t.serializeValue=()=>t.value}if("easy wildcards"==t){const t=e.widgets.find((e=>"text"==e.name));let n=1;Object.defineProperty(e.widgets[n],"value",{set:e=>{if((new Error).stack.includes("inner_value_change")&&"Select the LoRA to add to the text"!=e){let n=e;n.endsWith(".safetensors")&&(n=n.slice(0,-12)),t.value+=``}},get:e=>"Select the LoRA to add to the text"}),Object.defineProperty(e.widgets[n+1],"value",{set:e=>{(new Error).stack.includes("inner_value_change")&&"Select the Wildcard to add to the text"!=e&&(""!=t.value&&(t.value+=", "),t.value+=e)},get:e=>"Select the Wildcard to add to the text"}),e.widgets[n].serializeValue=e=>"Select the LoRA to add to the text",e.widgets[n+1].serializeValue=e=>"Select the Wildcard to add to the text"}if(Yp.includes(t)){const t=document.createElement("textarea");t.className="comfy-multiline-input",t.readOnly=!0;const n=e.addDOMWidget("info","customtext",t,{getValue:e=>t.value,setValue:e=>t.value=e,serialize:!1});n.inputEl=t,t.addEventListener("input",(()=>{var e;null==(e=n.callback)||e.call(n,n.value)}))}}}}),y.registerExtension({name:"easy bookmark",registerCustomNodes(){class e{constructor(){v(this,"type","easy bookmark"),v(this,"title","🔖"),v(this,"slot_start_y",-20),v(this,"___collapsed_width",0),v(this,"isVirtualNode",!0),v(this,"serialize_widgets",!0),v(this,"keypressBound",null),this.addWidget("text","shortcut_key","1",(e=>{""!==(e=e.trim()[0]||"1")&&(this.title="🔖 "+e)}),{y:8}),this.addWidget("number","zoom",1,(e=>{}),{y:8+LiteGraph.NODE_WIDGET_HEIGHT+4,max:2,min:.5,precision:2}),this.keypressBound=this.onKeypress.bind(this)}get _collapsed_width(){return this.___collapsed_width}set _collapsed_width(e){const t=y.canvas,n=t.canvas.getContext("2d");if(n){const e=n.font;n.font=t.title_text_font,this.___collapsed_width=40+n.measureText(this.title).width,n.font=e}}onAdded(){setTimeout((e=>{const t=this.widgets[0].value;t&&(this.title="🔖 "+t)}),1),window.addEventListener("keydown",this.keypressBound)}onRemoved(){window.removeEventListener("keydown",this.keypressBound)}onKeypress(e){const t=e.target;["input","textarea"].includes(t.localName)||this.widgets[0]&&e.key.toLocaleLowerCase()===this.widgets[0].value.toLocaleLowerCase()&&this.canvasToBookmark()}canvasToBookmark(){var e,t;const n=y.canvas;(null==(e=null==n?void 0:n.ds)?void 0:e.offset)&&(n.ds.offset[0]=16-this.pos[0],n.ds.offset[1]=40-this.pos[1]),null!=(null==(t=null==n?void 0:n.ds)?void 0:t.scale)&&(n.ds.scale=Number(this.widgets[1].value||1)),n.setDirty(!0,!0)}}LiteGraph.registerNodeType("easy bookmark",Object.assign(e,{title:"Bookmark 🔖"})),e.category="EasyUse/Util"}}),y.registerExtension({name:"Comfy.EasyUse.ChainNode",init(){y.canvas._mousemove_callback=e=>{if(!A("EasyUse.Nodes.ChainGetSet",null,!0))return;((e,t=!1,n={})=>{var o,i,r,s,a;if(0===e.length)return;const l=n.inputX||160,c=n.ouputX||60;if(e.filter((e=>Dp(e))).length>1)return;for(const d of e){let s=0,a=0;const u=n.inputY||10,p=n.outputY||30,f=[];if(d.graph){for(const e of d.inputs??[]){const t=e.link;if(!t)continue;const{origin_id:n,target_slot:o}=Tp(t),i=Cp(n);if(!i)continue;if(!Dp(i))continue;const r=d.getConnectionPos(!0,o);i.pos=[r[0]-l,r[1]+15+s*u],s+=1,f.push(i),i.flags.collapsed=!0}for(const e of d.outputs??[])if(e.links&&d.graph)for(const t of e.links){const{target_id:e}=Tp(t),n=Cp(e);if(!n)continue;if(!Dp(n))continue;const i=null==(o=n.outputs)?void 0:o.links;if((null==i?void 0:i.length)>1)return;const r=d.getConnectionPos(!1,0);n.pos=[r[0]+c,r[1]+15+a*p],a+=1,f.push(n),n.flags.collapsed=!0}if(t&&1===e.length){const e=[d,...f];(null==(r=null==(i=d.graph)?void 0:i.list_of_graphcanvas)?void 0:r[0]).selectNodes(e)}}}const u=e[0];if(!u)return;(null==(a=null==(s=u.graph)?void 0:s.list_of_graphcanvas)?void 0:a[0]).setDirty(!0,!0)})(Ap())};const e=LGraphCanvas.prototype.showLinkMenu;LGraphCanvas.prototype.showLinkMenu=function(t,n){return n.shiftKey?(((e,t=!1)=>{var n,o,i,r,s,a,l,c,u,d;const{type:p}=e;if("*"===p)return;let{origin_id:f,target_id:h,origin_slot:m,target_slot:g}=e,v=Cp(f),y=Cp(h);if(!v||!y)return!1;if("Reroute"===v.type){let e=0;[v,e]=Gp(v),f=null==v?void 0:v.id,m=e,void 0!==m&&-1!==m||(m=0)}if("Reroute"===y.type&&(y=Bp(y),h=null==y?void 0:y.id,g=null==y?void 0:y.inputs.findIndex((e=>e.type===p)),void 0!==g&&-1!==g||(g=0)),void 0===f||void 0===h||!v||!y)return!1;if(t&&(Dp(v)||Dp(y)))return!1;let b=Ip((null==(n=y.getInputInfo(g))?void 0:n.name)??p.toLowerCase());b||(b=Ip((null==(i=null==(o=null==v?void 0:v.outputs)?void 0:o[m])?void 0:i.name)??(null==(s=null==(r=null==v?void 0:v.outputs)?void 0:r[m])?void 0:s.type.toString())??b+`_from_${f}_to_${h}`));let _,w=!1,S=!1;if(Dp(v))b=xp(v),S=!0;else{const e=null==(l=null==(a=v.outputs)?void 0:a[m])?void 0:l.links;if(e)for(const t of e){const e=Cp((null==(c=Tp(t))?void 0:c.target_id)??-1);e&&Dp(e)&&Pp(e)&&(b=xp(e),S=!0)}if(!S){for(const e of jp()){if(b!==xp(e)||!Pp(e))continue;const t=null==(u=e.inputs[0])?void 0:u.link;(null==(d=Tp(t))?void 0:d.origin_id)===v.id?S=!0:w=!0}w&&(b+=`_from_${f}_to_${h}`)}}if(!S){_=LiteGraph.createNode("easy setNode"),_.is_auto_link=!0;const e=v.getConnectionPos(!1,m);_.pos=[e[0]+20,e[1]],_.inputs[0].name=b,_.inputs[0].type=p,_.inputs[0].widget=y.inputs[g].widget,Mp(_,b),Rp(_),_.flags.collapsed=!0;let t=[];v.widgets?t=Object.values(v.widgets).map((e=>e.value)):v.widgets_values&&(t=JSON.parse(JSON.stringify(v.widgets_values))),v.connect(m,_,0),v.widgets_values=t,"PrimitiveNode"===v.type&&setTimeout((()=>{if(v){v.connect(m,_,0);for(const[e,n]of t.entries())Mp(v,n,e);null!==_&&_.setSize(_.computeSize())}}))}const x=LiteGraph.createNode("easy getNode"),k=y.getConnectionPos(!0,g);x.pos=[k[0]-150,k[1]],x.outputs[0].name=b,x.outputs[0].type=p,x.outputs[0].widget=y.inputs[g].widget,Rp(x),Mp(x,b),null===x||(x.flags.collapsed=!0,x.setSize(x.computeSize()),x.connect(0,y,g))})(t),!1):(e.apply(this,[t,n]),!1)}}});let Kp=[];function Xp(e,t,n,o,i){var r=LGraphCanvas.active_canvas,s=r.getCanvasWindow(),a=r.graph;if(a)return function e(t,o){var l=LiteGraph.getNodeTypesCategories(r.filter||a.filter).filter((function(e){return e.startsWith(t)})),c=[];l.map((function(n){if(n){var o=new RegExp("^("+t+")"),i=n.replace(o,"").split("/")[0],r=""===t?i+"/":t+i+"/",s=i;-1!=s.indexOf("::")&&(s=s.split("::")[1]),-1===c.findIndex((function(e){return e.value===r}))&&c.push({value:r,content:s,has_submenu:!0,callback:function(t,n,o,i){e(t.value,i)}})}})),LiteGraph.getNodeTypesInCategory(t.slice(0,-1),r.filter||a.filter).map((function(e){if(!e.skip_list){var t={value:e.type,content:e.title,has_submenu:!1,callback:function(e,t,n,o){var s=o.getFirstEvent();r.graph.beforeChange();var a=LiteGraph.createNode(e.value);a&&(a.pos=r.convertEventToCanvasOffset(s),r.graph.add(a)),i&&i(a),r.graph.afterChange()}};c.push(t)}}));const u=A("EasyUse.ContextMenu.NodesSort",null,!0);""===t&&u&&(c=function(e){let t=[],n=[];return e.forEach((e=>{(null==e?void 0:e.value)&&D.includes(e.value.split("/")[0])?t.push(e):n.push(e)})),[{title:V("ComfyUI Basic"),is_category_title:!0},...t,{title:V("Others A~Z"),is_category_title:!0},...n.sort(((e,t)=>e.content.localeCompare(t.content)))]}(c)),new LiteGraph.ContextMenu(c,{event:n,parentMenu:o},s)}("",o),!1}function Qp(e,t,n){var o=this;n=n||{};var i=document.createElement("div");i.className="litemenu-entry submenu";var r=!1;function s(e){var t=this.value,i=!0;(o.current_submenu&&o.current_submenu.close(e),n.callback)&&(!0===n.callback.call(this,t,n,e,o,n.node)&&(i=!1));if(t){if(t.callback&&!n.ignore_item_callbacks&&!0!==t.disabled)!0===t.callback.call(this,t,n,e,o,n.extra)&&(i=!1);if(t.submenu){if(!t.submenu.options)throw"ContextMenu submenu needs options";new o.constructor(t.submenu.options,{callback:t.submenu.callback,event:e,parentMenu:o,ignore_item_callbacks:t.submenu.ignore_item_callbacks,title:t.submenu.title,extra:t.submenu.extra,autoopen:n.autoopen}),i=!1}}i&&!o.lock&&o.close()}return null===t?i.classList.add("separator"):t.is_category_title?(i.classList.remove("litemenu-entry"),i.classList.remove("submenu"),i.classList.add("litemenu-title"),i.innerHTML=t.title):(i.innerHTML=t&&t.title?t.title:e,i.value=t,t&&(t.disabled&&(r=!0,i.classList.add("disabled")),(t.submenu||t.has_submenu)&&i.classList.add("has_submenu")),"function"==typeof t?(i.dataset.value=e,i.onclick_callback=t):i.dataset.value=t,t.className&&(i.className+=" "+t.className)),this.root.appendChild(i),r||i.addEventListener("click",s),!r&&n.autoopen&&LiteGraph.pointerListenerAdd(i,"enter",(function(e){var t=this.value;if(!t||!t.has_submenu)return;s.call(this,e)})),i}function Jp(e){return e.substring(0,e.lastIndexOf("."))}function qp(e){return e.substring(e.lastIndexOf(".")+1)}y.registerExtension({name:"Comfy.EasyUse.ContextMenu",async setup(){LGraphCanvas.onMenuAdd=Xp;const e=await b.fetchApi("/easyuse/models/thumbnail");if(200===e.status){let t=await e.json();Kp=t}else Fp.error(V("Too many thumbnails, have closed the display"));const t=LiteGraph.ContextMenu;LiteGraph.ContextMenu=function(e,n){var o,i;if(n.parentMenu);else if(n.extra)null==(o=n.extra.constructor)||o.name;else if(n.scale){if(A("EasyUse.ContextMenu.SubDirectories",null,!0)){const o=function(e,t){const n=e,o=[...n],i={},r=[],s=[],a=["ckpt","pt","bin","pth","safetensors"];if((null==e?void 0:e.length)>0){const t=qp(e[e.length-1]);if(!a.includes(t))return null}for(const l of n){const e=l.indexOf("/")>-1?"/":"\\",t=l.split(e);if(t.length>1){const n=t.shift();i[n]=i[n]||[],i[n].push(t.join(e))}else"CHOOSE"===l||l.startsWith("DISABLE ")?r.push(l):s.push(l)}if(Object.values(i).length>0){const e=t.callback;t.callback=null;const n=(t,n)=>{["None","无","無","なし"].includes(t.content)?e("None",n):e(o.find((e=>e.endsWith(t.content)),n))},l=(e,t="")=>{const o=t?t+"\\"+Jp(e):Jp(e),i=qp(e),r=(new Date).getTime();let s,l="";if(a.includes(i))for(let n=0;n{let n=[],o=[];const r=e.map((e=>{const r={},s=e.indexOf("/")>-1?"/":"\\",a=e.split(s);if(a.length>1){const e=a.shift();r[e]=r[e]||[],r[e].push(a.join(s))}if(Object.values(i).length>0){let t=Object.keys(r)[0];t&&r[t]?n.push({key:t,value:r[t][0]}):o.push(l(e,t))}return l(e,t)}));if(n.length>0){let e={};return n.forEach((t=>{e[t.key]=e[t.key]||[],e[t.key].push(t.value)})),[...Object.entries(e).map((e=>({content:e[0],has_submenu:!0,callback:()=>{},submenu:{options:u(e[1],e[0])}}))),...o]}return r};for(const[t,o]of Object.entries(i))c.push({content:t,has_submenu:!0,callback:()=>{},submenu:{options:u(o,t)}});return c.push(...s.map((e=>l(e,"")))),r.length>0&&c.push(...r.map((e=>l(e,"")))),c}return null}(e,n);if(o)return t.call(this,o,n)}}else n.hasOwnProperty("extra")&&(e.unshift(null),i=window.location.host,["192.168.","10.","127.",/^172\.((1[6-9]|2[0-9]|3[0-1])\.)/].some((e=>"string"==typeof e?i.startsWith(e):e.test(i)))&&e.unshift({content:`${V("Reboot ComfyUI")}`,callback:e=>async function(){if(confirm(V("Are you sure you'd like to reboot the server?")))try{b.fetchApi("/easyuse/reboot")}catch(e){}}()}),e.unshift({content:`${V("Cleanup Of GPU Usage")}`,callback:e=>async function(){try{const{Running:e,Pending:t}=await b.getQueue();if(e.length>0||t.length>0)return void Fp.error(V("Clean Failed")+":"+V("Please stop all running tasks before cleaning GPU"));200==(await b.fetchApi("/easyuse/cleangpu",{method:"POST"})).status?Fp.success(V("Clean SuccessFully")):Fp.error(V("Clean Failed"))}catch(e){}}()}));return t.apply(this,[...arguments])},LiteGraph.ContextMenu.prototype=t.prototype,LiteGraph.ContextMenu.prototype.addItem=Qp}});class ef extends w{constructor(){super(),this.element.classList.add("easyuse-model-metadata")}show(e){super.show(_("div",Object.keys(e).map((t=>_("div",[_("label",{textContent:t}),_("span",{textContent:e[t]})])))))}}class tf extends w{constructor(e){super(),this.name=e,this.element.classList.add("easyuse-model-info")}get customNotes(){return this.metadata["easyuse.notes"]}set customNotes(e){this.metadata["easyuse.notes"]=e}get hash(){return this.metadata["easyuse.sha256"]}async show(e,t){this.type=e;const n=b.fetchApi("/easyuse/metadata/"+encodeURIComponent(`${e}/${t}`));this.info=_("div",{style:{flex:"auto"}}),this.imgCurrent=0,this.imgList=_("div.easyuse-preview-list",{style:{display:"none"}}),this.imgWrapper=_("div.easyuse-preview",[_("div.easyuse-preview-group",[this.imgList])]),this.main=_("main",{style:{display:"flex"}},[this.imgWrapper,this.info]),this.content=_("div.easyuse-model-content",[_("div.easyuse-model-header",[_("h2",{textContent:this.name})]),this.main]);const o=_("div",{textContent:"ℹ️ Loading...",parent:this.content});super.show(this.content),this.metadata=await(await n).json(),this.viewMetadata.style.cursor=this.viewMetadata.style.opacity="",this.viewMetadata.removeAttribute("disabled"),o.remove(),this.addInfo()}createButtons(){const e=super.createButtons();return this.viewMetadata=_("button",{type:"button",textContent:"View raw metadata",disabled:"disabled",style:{opacity:.5,cursor:"not-allowed"},onclick:e=>{this.metadata&&(new ef).show(this.metadata)}}),e.unshift(this.viewMetadata),e}parseNote(){if(!this.customNotes)return[];let e=[];const t=new RegExp("(\\bhttps?:\\/\\/[^\\s]+)","g");let n,o=0;do{let i;n=t.exec(this.customNotes);let r=0;n?(i=n.index,r=n.index+n[0].length):i=this.customNotes.length;let s=this.customNotes.substring(o,i);s&&(s=s.replaceAll("\n","
"),e.push(_("span",{innerHTML:s}))),n&&e.push(_("a",{href:n[0],textContent:n[0],target:"_blank"})),o=r}while(n);return e}addInfoEntry(e,t){return _("p",{parent:this.info},["string"==typeof e?_("label",{textContent:e+": "}):e,"string"==typeof t?_("span",{textContent:t}):t])}async getCivitaiDetails(){const e=await fetch("https://civitai.com/api/v1/model-versions/by-hash/"+this.hash);if(200===e.status)return await e.json();throw 404===e.status?new Error("Model not found"):new Error(`Error loading info (${e.status}) ${e.statusText}`)}addCivitaiInfo(){const e=this.getCivitaiDetails(),t=_("span",{textContent:"ℹ️ Loading..."});return this.addInfoEntry(_("label",[_("img",{style:{width:"18px",position:"relative",top:"3px",margin:"0 5px 0 0"},src:"https://civitai.com/favicon.ico"}),_("span",{textContent:"Civitai: "})]),t),e.then((e=>{var t,n;this.imgWrapper.style.display="block";let o=this.element.querySelector(".easyuse-model-header");o&&o.replaceChildren(_("h2",{textContent:this.name}),_("div.easyuse-model-header-remark",[_("h5",{textContent:V("Updated At:")+O(new Date(e.updatedAt),"yyyy/MM/dd")}),_("h5",{textContent:V("Created At:")+O(new Date(e.updatedAt),"yyyy/MM/dd")})]));let i=null,r=this.parseNote.call(this),s=V("✏️ Edit"),a=_("div.easyuse-model-detail-textarea",[_("p",(null==r?void 0:r.length)>0?r:{textContent:V("No notes")})]);if(r&&0!=r.length?a.classList.remove("empty"):a.classList.add("empty"),this.info.replaceChildren(_("div.easyuse-model-detail",[_("div.easyuse-model-detail-head.flex-b",[_("span",V("Notes")),_("a",{textContent:s,href:"#",style:{fontSize:"12px",float:"right",color:"var(--warning-color)",textDecoration:"none"},onclick:async e=>{if(e.preventDefault(),i){if(i.value!=this.customNotes){toast.showLoading(V("Saving Notes...")),this.customNotes=i.value;const e=await b.fetchApi("/easyuse/metadata/notes/"+encodeURIComponent(`${this.type}/${this.name}`),{method:"POST",body:this.customNotes});if(toast.hideLoading(),200!==e.status)return toast.error(V("Saving Failed")),void alert(`Error saving notes (${e.status}) ${e.statusText}`);toast.success(V("Saving Succeed")),r=this.parseNote.call(this),a.replaceChildren(_("p",(null==r?void 0:r.length)>0?r:{textContent:V("No notes")})),i.value?a.classList.remove("empty"):a.classList.add("empty")}else a.replaceChildren(_("p",{textContent:V("No notes")})),a.classList.add("empty");e.target.textContent=s,i.remove(),i=null}else e.target.textContent="💾 Save",i=_("textarea",{placeholder:V("Type your notes here"),style:{width:"100%",minWidth:"200px",minHeight:"50px",height:"100px"},textContent:this.customNotes}),a.replaceChildren(i),i.focus()}})]),a]),_("div.easyuse-model-detail",[_("div.easyuse-model-detail-head",{textContent:V("Details")}),_("div.easyuse-model-detail-body",[_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("Type")}),_("div.easyuse-model-detail-item-value",{textContent:e.model.type})]),_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("BaseModel")}),_("div.easyuse-model-detail-item-value",{textContent:e.baseModel})]),_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("Download")}),_("div.easyuse-model-detail-item-value",{textContent:(null==(t=e.stats)?void 0:t.downloadCount)||0})]),_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("Trained Words")}),_("div.easyuse-model-detail-item-value",{textContent:(null==e?void 0:e.trainedWords.join(","))||"-"})]),_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("Source")}),_("div.easyuse-model-detail-item-value",[_("label",[_("img",{style:{width:"14px",position:"relative",top:"3px",margin:"0 5px 0 0"},src:"https://civitai.com/favicon.ico"}),_("a",{href:"https://civitai.com/models/"+e.modelId,textContent:"View "+e.model.name,target:"_blank"})])])])])])),null==(n=e.images)?void 0:n.length){this.imgCurrent=0,this.isSaving=!1,e.images.map((e=>e.url&&this.imgList.appendChild(_("div.easyuse-preview-slide",[_("div.easyuse-preview-slide-content",[_("img",{src:e.url}),_("div.save",{textContent:"Save as preview",onclick:async()=>{if(this.isSaving)return;this.isSaving=!0,toast.showLoading(V("Saving Preview..."));const t=await(await fetch(e.url)).blob(),n="temp_preview."+new URL(e.url).pathname.split(".")[1],o=new FormData;o.append("image",new File([t],n)),o.append("overwrite","true"),o.append("type","temp");if(200!==(await b.fetchApi("/upload/image",{method:"POST",body:o})).status)return this.isSaving=!1,toast.error(V("Saving Failed")),toast.hideLoading(),void alert(`Error saving preview (${req.status}) ${req.statusText}`);await b.fetchApi("/easyuse/save/"+encodeURIComponent(`${this.type}/${this.name}`),{method:"POST",body:JSON.stringify({filename:n,type:"temp"}),headers:{"content-type":"application/json"}}).then((e=>{toast.success(V("Saving Succeed")),toast.hideLoading()})),this.isSaving=!1,app.refreshComboInNodes()}})])]))));let t=this;this.imgDistance=(-660*this.imgCurrent).toString(),this.imgList.style.display="",this.imgList.style.transform="translate3d("+this.imgDistance+"px, 0px, 0px)",this.slides=this.imgList.querySelectorAll(".easyuse-preview-slide"),this.slideLeftButton=_("button.left",{parent:this.imgWrapper,style:{display:e.images.length<=2?"none":"block"},innerHTML:'',onclick:()=>{e.images.length<=2||(t.imgList.classList.remove("no-transition"),0==t.imgCurrent?(t.imgCurrent=e.images.length/2-1,this.slides[this.slides.length-1].style.transform="translate3d("+(-660*(this.imgCurrent+1)).toString()+"px, 0px, 0px)",this.slides[this.slides.length-2].style.transform="translate3d("+(-660*(this.imgCurrent+1)).toString()+"px, 0px, 0px)",t.imgList.style.transform="translate3d(660px, 0px, 0px)",setTimeout((e=>{this.slides[this.slides.length-1].style.transform="translate3d(0px, 0px, 0px)",this.slides[this.slides.length-2].style.transform="translate3d(0px, 0px, 0px)",t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)",t.imgList.classList.add("no-transition")}),500)):(t.imgCurrent=t.imgCurrent-1,t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)"))}}),this.slideRightButton=_("button.right",{parent:this.imgWrapper,style:{display:e.images.length<=2?"none":"block"},innerHTML:'',onclick:()=>{if(!(e.images.length<=2))if(t.imgList.classList.remove("no-transition"),t.imgCurrent>=e.images.length/2-1){t.imgCurrent=0;const n=e.images.length/2;this.slides[0].style.transform="translate3d("+(660*n).toString()+"px, 0px, 0px)",this.slides[1].style.transform="translate3d("+(660*n).toString()+"px, 0px, 0px)",t.imgList.style.transform="translate3d("+(-660*n).toString()+"px, 0px, 0px)",setTimeout((e=>{this.slides[0].style.transform="translate3d(0px, 0px, 0px)",this.slides[1].style.transform="translate3d(0px, 0px, 0px)",t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)",t.imgList.classList.add("no-transition")}),500)}else t.imgCurrent=t.imgCurrent+1,t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)"}})}return e.description&&_("div",{parent:this.content,innerHTML:e.description,style:{marginTop:"10px"}}),e})).catch((e=>{this.imgWrapper.style.display="none",t.textContent="⚠️ "+e.message})).finally((e=>{}))}}class nf extends tf{async addInfo(){await this.addCivitaiInfo()}}class of extends tf{getTagFrequency(){if(!this.metadata.ss_tag_frequency)return[];const e=JSON.parse(this.metadata.ss_tag_frequency),t={};for(const n in e){const o=e[n];for(const e in o)e in t?t[e]+=o[e]:t[e]=o[e]}return Object.entries(t).sort(((e,t)=>t[1]-e[1]))}getResolutions(){let e=[];if(this.metadata.ss_bucket_info){const t=JSON.parse(this.metadata.ss_bucket_info);if(null==t?void 0:t.buckets)for(const{resolution:n,count:o}of Object.values(t.buckets))e.push([o,`${n.join("x")} * ${o}`])}e=e.sort(((e,t)=>t[0]-e[0])).map((e=>e[1]));let t=this.metadata.ss_resolution;if(t){const n=t.split(","),o=n[0].replace("(",""),i=n[1].replace(")","");e.push(`${o.trim()}x${i.trim()} (Base res)`)}else(t=this.metadata["modelspec.resolution"])&&e.push(t+" (Base res");return e.length||e.push("⚠️ Unknown"),e}getTagList(e){return e.map((e=>_("li.easyuse-model-tag",{dataset:{tag:e[0]},$:e=>{e.onclick=()=>{e.classList.toggle("easyuse-model-tag--selected")}}},[_("p",{textContent:e[0]}),_("span",{textContent:e[1]})])))}addTags(){let e,t=this.getTagFrequency();if(null==t?void 0:t.length){const n=t.length;let o;n>500&&(t=t.slice(0,500),e=_("p",[_("span",{textContent:"⚠️ Only showing first 500 tags "}),_("a",{href:"#",textContent:`Show all ${n}`,onclick:()=>{o.replaceChildren(...this.getTagList(this.getTagFrequency())),e.remove()}})])),o=_("ol.easyuse-model-tags-list",this.getTagList(t)),this.tags=_("div",[o])}else this.tags=_("p",{textContent:"⚠️ No tag frequency metadata found"});this.content.append(this.tags),e&&this.content.append(e)}async addInfo(){const e=this.addCivitaiInfo();this.addTags();const t=await e;t&&_("div",{parent:this.content,innerHTML:t.description,style:{maxHeight:"250px",overflow:"auto"}})}createButtons(){const e=super.createButtons();function t(e,t){const n=_("textarea",{parent:document.body,style:{position:"fixed"},textContent:t.map((e=>e.dataset.tag)).join(", ")});n.select();try{document.execCommand("copy"),e.target.dataset.text||(e.target.dataset.text=e.target.textContent),e.target.textContent="Copied "+t.length+" tags",setTimeout((()=>{e.target.textContent=e.target.dataset.text}),1e3)}catch(o){prompt("Copy to clipboard: Ctrl+C, Enter",text)}finally{document.body.removeChild(n)}}return e.unshift(_("button",{type:"button",textContent:"Copy Selected",onclick:e=>{t(e,[...this.tags.querySelectorAll(".easyuse-model-tag--selected")])}}),_("button",{type:"button",textContent:"Copy All",onclick:e=>{t(e,[...this.tags.querySelectorAll(".easyuse-model-tag")])}})),e}}const rf=["easy fullLoader","easy a1111Loader","easy comfyLoader","easy kolorsLoader","easy hunyuanDiTLoader","easy pixArtLoader"],sf=["easy preSampling","easy preSamplingAdvanced","easy preSamplingDynamicCFG","easy preSamplingNoiseIn","easy preSamplingCustom","easy preSamplingLayerDiffusion","easy fullkSampler"],af=["KSamplerSelect","SamplerEulerAncestral","SamplerEulerAncestralCFG++","SamplerLMS","SamplerDPMPP_3M_SDE","SamplerDPMPP_2M_SDE","SamplerDPMPP_SDE","SamplerDPMAdaptative","SamplerLCMUpscale","SamplerTCD","SamplerTCD EulerA"],lf=["BasicScheduler","KarrasScheduler","ExponentialScheduler","PolyexponentialScheduler","VPScheduler","BetaSamplingScheduler","SDTurboScheduler","SplitSigmas","SplitSigmasDenoise","FlipSigmas","AlignYourStepsScheduler","GITSScheduler"],cf=["easy kSampler","easy kSamplerTiled","easy kSamplerInpainting","easy kSamplerDownscaleUnet","easy kSamplerLayerDiffusion"],uf=["easy controlnetLoader","easy controlnetLoaderADV","easy controlnetLoader++","easy instantIDApply","easy instantIDApplyADV"],df=["easy ipadapterApply","easy ipadapterApplyADV","easy ipadapterApplyFaceIDKolors","easy ipadapterStyleComposition","easy ipadapterApplyFromParams","easy pulIDApply","easy pulIDApplyADV"],pf=["easy positive","easy wildcards"],ff=["easy loadImageBase64","LoadImage","LoadImageMask"],hf=["easy applyBrushNet","easy applyPowerPaint","easy applyInpaint"],mf={positive_prompt:{text:"positive",positive:"text"},loaders:{ckpt_name:"ckpt_name",vae_name:"vae_name",clip_skip:"clip_skip",lora_name:"lora_name",resolution:"resolution",empty_latent_width:"empty_latent_width",empty_latent_height:"empty_latent_height",positive:"positive",negative:"negative",batch_size:"batch_size",a1111_prompt_style:"a1111_prompt_style"},preSampling:{steps:"steps",cfg:"cfg",cfg_scale_min:"cfg",sampler_name:"sampler_name",scheduler:"scheduler",denoise:"denoise",seed_num:"seed_num",seed:"seed"},kSampler:{image_output:"image_output",save_prefix:"save_prefix",link_id:"link_id"},controlnet:{control_net_name:"control_net_name",strength:["strength","cn_strength"],scale_soft_weights:["scale_soft_weights","cn_soft_weights"],cn_strength:["strength","cn_strength"],cn_soft_weights:["scale_soft_weights","cn_soft_weights"]},ipadapter:{preset:"preset",lora_strength:"lora_strength",provider:"provider",weight:"weight",weight_faceidv2:"weight_faceidv2",start_at:"start_at",end_at:"end_at",cache_mode:"cache_mode",use_tiled:"use_tiled",insightface:"insightface",pulid_file:"pulid_file"},load_image:{image:"image",base64_data:"base64_data",channel:"channel"},inpaint:{dtype:"dtype",fitting:"fitting",function:"function",scale:"scale",start_at:"start_at",end_at:"end_at"},sampler:{},sigmas:{}},gf={loaders:{optional_lora_stack:"optional_lora_stack",positive:"positive",negative:"negative"},preSampling:{pipe:"pipe",image_to_latent:"image_to_latent",latent:"latent"},kSampler:{pipe:"pipe",model:"model"},controlnet:{pipe:"pipe",image:"image",image_kps:"image_kps",control_net:"control_net",positive:"positive",negative:"negative",mask:"mask"},positive_prompt:{},ipadapter:{model:"model",image:"image",image_style:"image",attn_mask:"attn_mask",optional_ipadapter:"optional_ipadapter"},inpaint:{pipe:"pipe",image:"image",mask:"mask"},sampler:{},sigmas:{}},vf={loaders:{pipe:"pipe",model:"model",vae:"vae",clip:null,positive:null,negative:null,latent:null},preSampling:{pipe:"pipe"},kSampler:{pipe:"pipe",image:"image"},controlnet:{pipe:"pipe",positive:"positive",negative:"negative"},positive_prompt:{text:"positive",positive:"text"},load_image:{IMAGE:"IMAGE",MASK:"MASK"},ipadapter:{model:"model",tiles:"tiles",masks:"masks",ipadapter:"ipadapter"},inpaint:{pipe:"pipe"},sampler:{SAMPLER:"SAMPLER"},sigmas:{SIGMAS:"SIGMAS"}};function yf(e,t,n){return function(){!function(e,t,n){const o=LiteGraph.createNode(t);if(o){if(y.graph.add(o),o.pos=e.pos.slice(),o.size=e.size.slice(),e.widgets.forEach((e=>{if(mf[n][e.name]){const i=mf[n][e.name];if(i){const n=(t=i,o.widgets.find((e=>"object"==typeof t?t.includes(e.name):e.name===t)));n&&(n.value=e.value,"seed_num"==e.name&&(n.linkedWidgets[0].value=e.linkedWidgets[0].value),"converted-widget"==e.type&&Cf(o,n,e))}}var t})),e.inputs&&e.inputs.forEach(((t,i)=>{if(t&&t.link&&gf[n][t.name]){const i=gf[n][t.name];if(null===i)return;const r=o.findInputSlot(i);if(-1!==r){const n=e.graph.links[t.link];if(n){const t=e.graph.getNodeById(n.origin_id);t&&t.connect(n.origin_slot,o,r)}}}})),e.outputs&&e.outputs.forEach(((t,i)=>{if(t&&t.links&&vf[n]&&vf[n][t.name]){const i=vf[n][t.name];if(null===i)return;const r=o.findOutputSlot(i);-1!==r&&t.links.forEach((t=>{const n=e.graph.links[t];if(n){const t=e.graph.getNodeById(n.target_id);t&&o.connect(r,t,n.target_slot)}}))}})),y.graph.remove(e),"easy fullkSampler"==o.type){const e=o.outputs[0].links;if(e&&e[0]){const t=y.graph._nodes.find((t=>t.inputs&&t.inputs[0]&&t.inputs[0].link==e[0]));t&&y.graph.remove(t)}}else if(sf.includes(o.type)){const e=o.outputs[0].links;if(!e||!e[0]){const e=LiteGraph.createNode("easy kSampler");y.graph.add(e),e.pos=o.pos.slice(),e.pos[0]=e.pos[0]+o.size[0]+20;const t=o.findInputSlot("pipe");-1!==t&&o&&o.connect(0,e,t)}}o.setSize([o.size[0],o.computeSize()[1]])}}(e,t,n)}}const bf=(e,t)=>{const n=e.prototype.getExtraMenuOptions;e.prototype.getExtraMenuOptions=function(){const e=n.apply(this,arguments);return t.apply(this,arguments),e}},_f=(e,t,n,o,i=!0)=>{bf(o,(function(o,r){r.unshift({content:e,has_submenu:i,callback:(e,o,i,r,s)=>wf(e,o,i,r,s,t,n)}),"loaders"==t&&(r.unshift({content:V("💎 View Lora Info..."),callback:(e,t,n,o,i)=>{let r=i.widgets.find((e=>"lora_name"==e.name)).value;r&&"None"!=r&&new of(r).show("loras",r)}}),r.unshift({content:V("💎 View Checkpoint Info..."),callback:(e,t,n,o,i)=>{let r=i.widgets[0].value;r&&"None"!=r&&new nf(r).show("checkpoints",r)}}))}))},wf=(e,t,n,o,i,r,s)=>{const a=[];return s.map((e=>{i.type!==e&&a.push({content:`${e}`,callback:yf(i,e,r)})})),new LiteGraph.ContextMenu(a,{event:n,callback:null,parentMenu:o,node:i}),!1},Sf="converted-widget",xf=Symbol();function kf(e,t,n=""){if(t.origType=t.type,t.origComputeSize=t.computeSize,t.origSerializeValue=t.serializeValue,t.computeSize=()=>[0,-4],t.type=Sf+n,t.serializeValue=()=>{if(!e.inputs)return;let n=e.inputs.find((e=>{var n;return(null==(n=e.widget)?void 0:n.name)===t.name}));return n&&n.link?t.origSerializeValue?t.origSerializeValue():t.value:void 0},t.linkedWidgets)for(const o of t.linkedWidgets)kf(e,o,":"+t.name)}function Cf(e,t,n){kf(e,t);const{type:o}=function(e){let t=e[0];t instanceof Array&&(t="COMBO");return{type:t}}(n),i=e.size;t.options&&t.options.forceInput||e.addInput(t.name,o,{widget:{name:t.name,[xf]:()=>n}});for(const r of e.widgets)r.last_y+=LiteGraph.NODE_SLOT_HEIGHT;e.setSize([Math.max(i[0],e.size[0]),Math.max(i[1],e.size[1])])}const Af=function(e){var t,n,o,i;const r=e.constructor.type,s=e.properties.origVals||{},a=s.title||e.title,l=s.color||e.color,c=s.bgcolor||e.bgcolor,u=e,d={size:[...e.size],color:l,bgcolor:c,pos:[...e.pos]};let p=[],f=[];if(e.inputs)for(const y of e.inputs)if(y.link){const t=y.name,n=e.findInputSlot(t),o=e.getInputNode(n),i=e.getInputLink(n);p.push([i.origin_slot,o,t])}if(e.outputs)for(const y of e.outputs)if(y.links){const e=y.name;for(const t of y.links){const n=graph.links[t],o=graph._nodes_by_id[n.target_id];f.push([e,o,n.target_slot])}}y.graph.remove(e);const h=y.graph.add(LiteGraph.createNode(r,a,d));function m(){if(u.widgets)for(let e of u.widgets)if("converted-widget"===e.type){const t=h.widgets.find((t=>t.name===e.name));for(let n of u.inputs)n.name===e.name&&Cf(h,t,n.widget)}for(let e of p){const[t,n,o]=e;n.connect(t,h.id,o)}for(let e of f){const[t,n,o]=e;h.connect(t,n,o)}}let g=u.widgets_values;if(!g&&(null==(t=h.widgets)?void 0:t.length)>0)return h.widgets.forEach(((e,t)=>{const n=u.widgets[t];e.name===n.name&&e.type===n.type&&(e.value=n.value)})),void m();const v=(null==g?void 0:g.length)<=(null==(n=h.widgets)?void 0:n.length);let b=v?0:g.length-1;function _(e,t){var n,o,i,r,s,a;if(!0===e||!1===e){if((null==(n=t.options)?void 0:n.on)&&(null==(o=t.options)?void 0:o.off))return{value:e,pass:!0}}else if("number"==typeof e){if((null==(i=t.options)?void 0:i.min)<=e&&e<=(null==(r=t.options)?void 0:r.max))return{value:e,pass:!0}}else{if(null==(a=null==(s=t.options)?void 0:s.values)?void 0:a.includes(e))return{value:e,pass:!0};if(t.inputEl&&"string"==typeof e)return{value:e,pass:!0}}return{value:t.value,pass:!1}}const w=e=>{var t;const n=u.widgets[e];let o=h.widgets[e];if(o.name===n.name&&o.type===n.type){for(;v?b=0;){let{value:e,pass:t}=_(g[b],o);if(t&&null!==e){o.value=e;break}b+=v?1:-1}b++,v||(b=g.length-((null==(t=h.widgets)?void 0:t.length)-1-e))}};if(v&&(null==(o=h.widgets)?void 0:o.length)>0)for(let y=0;y0)for(let y=h.widgets.length-1;y>=0;y--)w(y);m()};y.registerExtension({name:"Comfy.EasyUse.ExtraMenu",async beforeRegisterNodeDef(e,t,n){bf(e,(function(e,n){n.unshift({content:V("🔃 Reload Node"),callback:(e,t,n,o,i)=>{let r=LGraphCanvas.active_canvas;if(!r.selected_nodes||Object.keys(r.selected_nodes).length<=1)Af(i);else for(let s in r.selected_nodes)Af(r.selected_nodes[s])}}),"easy ckptNames"==t.name&&n.unshift({content:V("💎 View Checkpoint Info..."),callback:(e,t,n,o,i)=>{i.widgets[0].value}})})),pf.includes(t.name)&&_f("↪️ Swap EasyPrompt","positive_prompt",pf,e),rf.includes(t.name)&&_f("↪️ Swap EasyLoader","loaders",rf,e),sf.includes(t.name)&&_f("↪️ Swap EasyPreSampling","preSampling",sf,e),cf.includes(t.name)&&_f("↪️ Swap EasyKSampler","preSampling",cf,e),af.includes(t.name)&&_f("↪️ Swap Custom Sampler","sampler",af,e),lf.includes(t.name)&&_f("↪️ Swap Custom Sigmas","sigmas",lf,e),uf.includes(t.name)&&_f("↪️ Swap EasyControlnet","controlnet",uf,e),df.includes(t.name)&&_f("↪️ Swap EasyAdapater","ipadapter",df,e),ff.includes(t.name)&&_f("↪️ Swap LoadImage","load_image",ff,e),hf.includes(t.name)&&_f("↪️ Swap InpaintNode","inpaint",hf,e)}});const Ef="➡️";y.registerExtension({name:"easy setNode",registerCustomNodes(){class e{constructor(){v(this,"defaultVisibility",!0),v(this,"serialize_widgets",!0),this.properties||(this.properties={previousName:""}),this.properties.showOutputText=e.defaultVisibility;const t=this;t.color=LGraphCanvas.node_colors.blue.color,this.addWidget("text","Constant","",((e,n,o,i,r)=>{t.validateName(t.graph),""!==this.widgets[0].value&&(this.title=Ef+this.widgets[0].value),this.update(),this.properties.previousName=this.widgets[0].value}),{}),this.addInput("*","*"),this.onConnectionsChange=function(e,n,o,i,r){if(1!=e||o||(this.inputs[n].type="*",this.inputs[n].name="*",this.title="Set"),i&&t.graph&&1==e&&o){const e=t.graph._nodes.find((e=>e.id==i.origin_id)).outputs[i.origin_slot],n=e.type,o=t.is_auto_link?this.widgets[0].value:e.name;"Set"===this.title&&(this.title=Ef+o,this.widgets[0].value=o),"*"===this.widgets[0].value&&(this.widgets[0].value=o),this.validateName(t.graph),this.inputs[0].type=n,this.inputs[0].name=o,setTimeout((e=>{this.title=Ef+this.widgets[0].value}),1)}this.update()},this.validateName=function(e){let n=t.widgets[0].value;if(""!=n){let o=0,i=[];do{i=e._nodes.filter((e=>e!=this&&("easy setNode"==e.type&&e.widgets[0].value===n))),i.length>0&&(n=t.widgets[0].value+o),o++}while(i.length>0);t.widgets[0].value=n,this.update()}},this.clone=function(){const t=e.prototype.clone.apply(this);return t.inputs[0].name="*",t.inputs[0].type="*",t.properties.previousName="",t.size=t.computeSize(),t},this.onAdded=function(e){this.validateName(e)},this.update=function(){if(t.graph){this.findGetters(t.graph).forEach((e=>{e.setType(this.inputs[0].type)})),this.widgets[0].value&&this.findGetters(t.graph,!0).forEach((e=>{e.setName(this.widgets[0].value)}));t.graph._nodes.filter((e=>"easy getNode"==e.type)).forEach((e=>{e.setComboValues&&e.setComboValues()}))}},this.findGetters=function(e,t){const n=t?this.properties.previousName:this.widgets[0].value;return e._nodes.filter((e=>"easy getNode"==e.type&&e.widgets[0].value===n&&""!=n))},this.isVirtualNode=!0}onRemoved(){this.graph._nodes.filter((e=>"easy getNode"==e.type)).forEach((e=>{e.setComboValues&&e.setComboValues([this])}))}}LiteGraph.registerNodeType("easy setNode",Object.assign(e,{title:"Set"})),e.category="EasyUse/Util"}}),y.registerExtension({name:"easy getNode",registerCustomNodes(){class e{constructor(){v(this,"defaultVisibility",!0),v(this,"serialize_widgets",!0),this.properties||(this.properties={}),this.properties.showOutputText=e.defaultVisibility;const t=this;t.color=LGraphCanvas.node_colors.blue.color,this.addWidget("combo","Constant","",(e=>{this.onRename()}),{values:()=>t.graph._nodes.filter((e=>"easy setNode"==e.type)).map((e=>e.widgets[0].value)).sort()}),this.addOutput("*","*"),this.onConnectionsChange=function(e,t,n,o,i){this.validateLinks(),2!=e||n?(this.onRename(),setTimeout((e=>{this.title="⬅️"+this.widgets[0].value}),1)):(this.outputs[t].type="*",this.outputs[t].name="*",this.title="Get")},this.setName=function(e){t.widgets[0].value=e,t.onRename(),t.serialize()},this.onRename=function(e=0){const n=this.findSetter(t.graph);if(n){const t=n.inputs[0].type,o=n.inputs[0].name;this.setType(t,o),this.outputs[e].type=t,this.outputs[e].name=o,this.title="⬅️"+n.widgets[0].value}else this.setType("*","*"),this.outputs[e].type="*",this.outputs[e].name="*"},this.clone=function(){const t=e.prototype.clone.apply(this);return t.size=t.computeSize(),t},this.validateLinks=function(){"*"!=this.outputs[0].type&&this.outputs[0].links&&this.outputs[0].links.forEach((e=>{const n=t.graph.links[e];n&&n.type!=this.outputs[0].type&&"*"!=n.type&&t.graph.removeLink(e)}))},this.setType=function(e,t){this.outputs[0].name=t,this.outputs[0].type=e,this.validateLinks()},this.findSetter=function(e){const t=this.widgets[0].value;return e._nodes.find((e=>"easy setNode"==e.type&&e.widgets[0].value===t&&""!=t))},this.isVirtualNode=!0}getInputLink(e){const t=this.findSetter(this.graph);if(t){const n=t.inputs[e];return this.graph.links[n.link]}throw new Error("No setter found for "+this.widgets[0].value+"("+this.type+")")}onAdded(e){}}LiteGraph.registerNodeType("easy getNode",Object.assign(e,{title:"Get"})),e.category="EasyUse/Util"}}),b.addEventListener("easyuse-global-seed",(function(e){let t=app.graph._nodes_by_id;for(let n in t){let o=t[n];if("easy globalSeed"==o.type){if(o.widgets){const t=o.widgets.find((e=>"value"==e.name));o.widgets.find((e=>"last_seed"==e.name)).value=t.value,t.value=e.detail.value}}else if(o.widgets){const t=o.widgets.find((e=>"seed_num"==e.name||"seed"==e.name||"noise_seed"==e.name));t&&null!=e.detail.seed_map[o.id]&&(t.value=e.detail.seed_map[o.id])}}}));const Of=b.queuePrompt;b.queuePrompt=async function(e,{output:t,workflow:n}){n.seed_widgets={};for(let o in app.graph._nodes_by_id){let e=app.graph._nodes_by_id[o].widgets;if(e)for(let t in e)"seed_num"!=e[t].name&&"seed"!=e[t].name&&"noise_seed"!=e[t].name||"converted-widget"==e[t].type||(n.seed_widgets[o]=parseInt(t))}return await Of.call(b,e,{output:t,workflow:n})};const Lf=["easy imageSave","easy fullkSampler","easy kSampler","easy kSamplerTiled","easy kSamplerInpainting","easy kSamplerDownscaleUnet","easy kSamplerSDTurbo","easy detailerFix"];y.registerExtension({name:"Comfy.EasyUse.SaveImageExtraOutput",async beforeRegisterNodeDef(e,t,n){if(Lf.includes(t.name)){const t=e.prototype.onNodeCreated;e.prototype.onNodeCreated=function(){const e=t?t.apply(this,arguments):void 0,o=this.widgets.find((e=>"filename_prefix"===e.name||"save_prefix"===e.name));return o.serializeValue=()=>x(n,o.value),e}}else{const t=e.prototype.onNodeCreated;e.prototype.onNodeCreated=function(){const e=t?t.apply(this,arguments):void 0;return this.properties&&"Node name for S&R"in this.properties||this.addProperty("Node name for S&R",this.constructor.type,"string"),e}}}});const Tf=["easy wildcards","easy positive","easy negative","easy stylesSelector","easy promptConcat","easy promptReplace"],If=["easy preSampling","easy preSamplingAdvanced","easy preSamplingNoiseIn","easy preSamplingCustom","easy preSamplingDynamicCFG","easy preSamplingSdTurbo","easy preSamplingLayerDiffusion"],Nf=["easy kSampler","easy kSamplerTiled","easy kSamplerInpainting","easy kSamplerDownscaleUnet","easy kSamplerSDTurbo"],Pf=["easy controlnetLoader","easy controlnetLoaderADV"],Df=["easy instantIDApply","easy instantIDApplyADV"],jf=["easy ipadapterApply","easy ipadapterApplyADV","easy ipadapterApplyFaceIDKolors","easy ipadapterStyleComposition"],Mf=["easy pipeIn","easy pipeOut","easy pipeEdit"],Rf=["easy XYPlot","easy XYPlotAdvanced"],$f=["easy setNode"],Gf=["Reroute","RescaleCFG","LoraLoaderModelOnly","LoraLoader","FreeU","FreeU_v2",...jf,...$f],Bf={"easy seed":{from:{INT:["Reroute",...If,"easy fullkSampler"]}},"easy positive":{from:{STRING:["Reroute",...Tf]}},"easy negative":{from:{STRING:["Reroute",...Tf]}},"easy wildcards":{from:{STRING:["Reroute","easy showAnything",...Tf]}},"easy stylesSelector":{from:{STRING:["Reroute","easy showAnything",...Tf]}},"easy promptConcat":{from:{STRING:["Reroute","easy showAnything",...Tf]}},"easy promptReplace":{from:{STRING:["Reroute","easy showAnything",...Tf]}},"easy fullLoader":{from:{PIPE_LINE:["Reroute",...If,"easy fullkSampler",...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy a1111Loader":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy comfyLoader":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy hunyuanDiTLoader":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy kolorsLoader":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy pixArtLoader":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy svdLoader":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced","easy preSamplingDynamicCFG",...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy zero123Loader":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced","easy preSamplingDynamicCFG",...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy sv3dLoader":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced","easy preSamplingDynamicCFG",...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy preSampling":{from:{PIPE_LINE:["Reroute",...Nf,...Mf,...Pf,...Rf,...$f]}},"easy preSamplingAdvanced":{from:{PIPE_LINE:["Reroute",...Nf,...Mf,...Pf,...Rf,...$f]}},"easy preSamplingDynamicCFG":{from:{PIPE_LINE:["Reroute",...Nf,...Mf,...Pf,...Rf,...$f]}},"easy preSamplingCustom":{from:{PIPE_LINE:["Reroute",...Nf,...Mf,...Pf,...Rf,...$f]}},"easy preSamplingLayerDiffusion":{from:{PIPE_LINE:["Reroute","easy kSamplerLayerDiffusion",...Nf,...Mf,...Pf,...Rf,...$f]}},"easy preSamplingNoiseIn":{from:{PIPE_LINE:["Reroute",...Nf,...Mf,...Pf,...Rf,...$f]}},"easy fullkSampler":{from:{PIPE_LINE:["Reroute",...Mf.reverse(),"easy preDetailerFix","easy preMaskDetailerFix",...If,...$f]}},"easy kSampler":{from:{PIPE_LINE:["Reroute",...Mf.reverse(),"easy preDetailerFix","easy preMaskDetailerFix","easy hiresFix",...If,...$f]}},"easy controlnetLoader":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f]}},"easy controlnetLoaderADV":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f]}},"easy instantIDApply":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f],MODEL:Gf},to:{COMBO:["Reroute","easy promptLine"]}},"easy instantIDApplyADV":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f],MODEL:Gf},to:{COMBO:["Reroute","easy promptLine"]}},"easy ipadapterApply":{to:{COMBO:["Reroute","easy promptLine"]}},"easy ipadapterApplyADV":{to:{STRING:["Reroute","easy sliderControl",...Tf],COMBO:["Reroute","easy promptLine"]}},"easy ipadapterStyleComposition":{to:{COMBO:["Reroute","easy promptLine"]}},"easy preDetailerFix":{from:{PIPE_LINE:["Reroute","easy detailerFix",...Mf,...$f]},to:{PIPE_LINE:["Reroute","easy ultralyticsDetectorPipe","easy samLoaderPipe","easy kSampler","easy fullkSampler"]}},"easy preMaskDetailerFix":{from:{PIPE_LINE:["Reroute","easy detailerFix",...Mf,...$f]}},"easy samLoaderPipe":{from:{PIPE_LINE:["Reroute","easy preDetailerFix",...Mf,...$f]}},"easy ultralyticsDetectorPipe":{from:{PIPE_LINE:["Reroute","easy preDetailerFix",...Mf,...$f]}},"easy cascadeLoader":{from:{PIPE_LINE:["Reroute","easy fullCascadeKSampler","easy preSamplingCascade",...Pf,...Mf,...$f],MODEL:Gf.filter((e=>!jf.includes(e)))}},"easy fullCascadeKSampler":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced",...Mf,...$f]}},"easy preSamplingCascade":{from:{PIPE_LINE:["Reroute","easy cascadeKSampler",...Mf,...$f]}},"easy cascadeKSampler":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced",...Mf,...$f]}}};y.registerExtension({name:"Comfy.EasyUse.Suggestions",async setup(e){LGraphCanvas.prototype.createDefaultNodeForSlot=function(e){e=e||{};var t,n=Object.assign({nodeFrom:null,slotFrom:null,nodeTo:null,slotTo:null,position:[],nodeType:null,posAdd:[0,0],posSizeFix:[0,0]},e),o=n.nodeFrom&&null!==n.slotFrom,i=!o&&n.nodeTo&&null!==n.slotTo;if(!o&&!i)return!1;if(!n.nodeType)return!1;var r=o?n.nodeFrom:n.nodeTo,s=o?n.slotFrom:n.slotTo,a=r.type,l=!1;switch(typeof s){case"string":l=o?r.findOutputSlot(s,!1):r.findInputSlot(s,!1),s=o?r.outputs[s]:r.inputs[s];break;case"object":l=o?r.findOutputSlot(s.name):r.findInputSlot(s.name);break;case"number":l=s,s=o?r.outputs[s]:r.inputs[s];break;default:return!1}var c=s.type==LiteGraph.EVENT?"_event_":s.type,u=o?LiteGraph.slot_types_default_out:LiteGraph.slot_types_default_in;if(u&&u[c]){s.link;let e=!1;const i=o?"from":"to";if(Bf[a]&&Bf[a][i]&&(null==(t=Bf[a][i][c])?void 0:t.length)>0){for(var d in Bf[a][i][c])if(n.nodeType==Bf[a][i][c][d]||"AUTO"==n.nodeType){e=Bf[a][i][c][d];break}}else if("object"==typeof u[c]||"array"==typeof u[c]){for(var d in u[c])if(n.nodeType==u[c][d]||"AUTO"==n.nodeType){e=u[c][d];break}}else n.nodeType!=u[c]&&"AUTO"!=n.nodeType||(e=u[c]);if(e){var p=!1;"object"==typeof e&&e.node&&(p=e,e=e.node);var f=LiteGraph.createNode(e);if(f){if(p){if(p.properties)for(var h in p.properties)f.addProperty(h,p.properties[h]);if(p.inputs)for(var h in f.inputs=[],p.inputs)f.addOutput(p.inputs[h][0],p.inputs[h][1]);if(p.outputs)for(var h in f.outputs=[],p.outputs)f.addOutput(p.outputs[h][0],p.outputs[h][1]);p.title&&(f.title=p.title),p.json&&f.configure(p.json)}return this.graph.add(f),f.pos=[n.position[0]+n.posAdd[0]+(n.posSizeFix[0]?n.posSizeFix[0]*f.size[0]:0),n.position[1]+n.posAdd[1]+(n.posSizeFix[1]?n.posSizeFix[1]*f.size[1]:0)],o?n.nodeFrom.connectByType(l,f,c):n.nodeTo.connectByTypeOutput(l,f,c),!0}}}return!1},LGraphCanvas.prototype.showConnectionMenu=function(e){e=e||{};var t,n=Object.assign({nodeFrom:null,slotFrom:null,nodeTo:null,slotTo:null,e:null},e),o=this,i=n.nodeFrom&&n.slotFrom,r=!i&&n.nodeTo&&n.slotTo;if(!i&&!r)return!1;var s=i?n.nodeFrom:n.nodeTo,a=i?n.slotFrom:n.slotTo,l=!1;switch(typeof a){case"string":l=i?s.findOutputSlot(a,!1):s.findInputSlot(a,!1),a=i?s.outputs[a]:s.inputs[a];break;case"object":l=i?s.findOutputSlot(a.name):s.findInputSlot(a.name);break;case"number":l=a,a=i?s.outputs[a]:s.inputs[a];break;default:return!1}var c=["Add Node",null];o.allow_searchbox&&(c.push("Search"),c.push(null));var u=a.type==LiteGraph.EVENT?"_event_":a.type,d=i?LiteGraph.slot_types_default_out:LiteGraph.slot_types_default_in,p=s.type;if(d&&d[u]){const e=i?"from":"to";if(Bf[p]&&Bf[p][e]&&(null==(t=Bf[p][e][u])?void 0:t.length)>0)for(var f in Bf[p][e][u])c.push(Bf[p][e][u][f]);else if("object"==typeof d[u]||"array"==typeof d[u])for(var f in d[u])c.push(d[u][f]);else c.push(d[u])}var h=new LiteGraph.ContextMenu(c,{event:n.e,title:(a&&""!=a.name?a.name+(u?" | ":""):"")+(a&&u?u:""),callback:function(e,t,r){switch(e){case"Add Node":LGraphCanvas.onMenuAdd(null,null,r,h,(function(e){i?n.nodeFrom.connectByType(l,e,u):n.nodeTo.connectByTypeOutput(l,e,u)}));break;case"Search":i?o.showSearchBox(r,{node_from:n.nodeFrom,slot_from:a,type_filter_in:u}):o.showSearchBox(r,{node_to:n.nodeTo,slot_from:a,type_filter_out:u});break;default:o.createDefaultNodeForSlot(Object.assign(n,{position:[n.e.canvasX,n.e.canvasY],nodeType:e}))}}});return!1}}}),y.registerExtension({name:"Comfy.EasyUse.TimeTaken",setup(){const e=new Map;let t=0;b.addEventListener("executing",(n=>{if(!A("EasyUse.Nodes.Runtime",null,!0))return;const o=(null==n?void 0:n.node)||(null==n?void 0:n.detail)||null,i=Cp(o);i&&(i.executionDuration="");const r=e.get(t);if(e.delete(t),t&&r){const e=Date.now()-r,n=Cp(t);n&&(n.executionDuration=`${(e/1e3).toFixed(2)}${V("s")}`)}t=o,e.set(o,Date.now())}))},beforeRegisterNodeDef(e,t){const n=e.prototype.onDrawForeground;e.prototype.onDrawForeground=function(...e){const[t]=e;return function(e,t){if(!t)return;e.save(),e.fillStyle=LiteGraph.NODE_DEFAULT_BGCOLOR,function(e,t,n,o,i,r){e.beginPath(),e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.arcTo(t+o,n,t+o,n+r,r),e.lineTo(t+o,n+i-r),e.arcTo(t+o,n+i,t+o-r,n+i,r),e.lineTo(t+r,n+i),e.arcTo(t,n+i,t,n+i-r,r),e.lineTo(t,n+r),e.arcTo(t,n,t+r,n,r),e.closePath()}(e,0,-LiteGraph.NODE_TITLE_HEIGHT-20,e.measureText(t).width+10,LiteGraph.NODE_TITLE_HEIGHT-10,4),e.fill(),function(e,t,n,o,i="#000",r=12,s="Inter"){e.font=`${r}px ${s}`,e.fillStyle=i,e.fillText(t,n,o)}(e,t,8,-LiteGraph.NODE_TITLE_HEIGHT-6,LiteGraph.NODE_TITLE_COLOR),e.restore()}(t,this.executionDuration||""),null==n?void 0:n.apply(this,e)}}});const Ff="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function Uf(e,t,n,o){e.addEventListener?e.addEventListener(t,n,o):e.attachEvent&&e.attachEvent("on".concat(t),n)}function zf(e,t,n,o){e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent&&e.detachEvent("on".concat(t),n)}function Vf(e,t){const n=t.slice(0,t.length-1);for(let o=0;o=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}const Wf={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":Ff?173:189,"=":Ff?61:187,";":Ff?59:186,"'":222,"[":219,"]":221,"\\":220},Yf={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},Zf={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Kf={16:!1,18:!1,17:!1,91:!1},Xf={};for(let by=1;by<20;by++)Wf["f".concat(by)]=111+by;let Qf=[],Jf=null,qf="all";const eh=new Map,th=e=>Wf[e.toLowerCase()]||Yf[e.toLowerCase()]||e.toUpperCase().charCodeAt(0);function nh(e){qf=e||"all"}function oh(){return qf||"all"}function ih(e){if(void 0===e)Object.keys(Xf).forEach((e=>{Array.isArray(Xf[e])&&Xf[e].forEach((e=>rh(e))),delete Xf[e]})),ch(null);else if(Array.isArray(e))e.forEach((e=>{e.key&&rh(e)}));else if("object"==typeof e)e.key&&rh(e);else if("string"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o{let{key:t,scope:n,method:o,splitKey:i="+"}=e;Hf(t).forEach((e=>{const t=e.split(i),r=t.length,s=t[r-1],a="*"===s?"*":th(s);if(!Xf[a])return;n||(n=oh());const l=r>1?Vf(Yf,t):[],c=[];Xf[a]=Xf[a].filter((e=>{const t=(!o||e.method===o)&&e.scope===n&&function(e,t){const n=e.length>=t.length?e:t,o=e.length>=t.length?t:e;let i=!0;for(let r=0;rch(e)))}))};function sh(e,t,n,o){if(t.element!==o)return;let i;if(t.scope===n||"all"===t.scope){i=t.mods.length>0;for(const e in Kf)Object.prototype.hasOwnProperty.call(Kf,e)&&(!Kf[e]&&t.mods.indexOf(+e)>-1||Kf[e]&&-1===t.mods.indexOf(+e))&&(i=!1);(0!==t.mods.length||Kf[16]||Kf[18]||Kf[17]||Kf[91])&&!i&&"*"!==t.shortcut||(t.keys=[],t.keys=t.keys.concat(Qf),!1===t.method(e,t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0)))}}function ah(e,t){const n=Xf["*"];let o=e.keyCode||e.which||e.charCode;if(!lh.filter.call(this,e))return;if(93!==o&&224!==o||(o=91),-1===Qf.indexOf(o)&&229!==o&&Qf.push(o),["ctrlKey","altKey","shiftKey","metaKey"].forEach((t=>{const n=Zf[t];e[t]&&-1===Qf.indexOf(n)?Qf.push(n):!e[t]&&Qf.indexOf(n)>-1?Qf.splice(Qf.indexOf(n),1):"metaKey"===t&&e[t]&&3===Qf.length&&(e.ctrlKey||e.shiftKey||e.altKey||(Qf=Qf.slice(Qf.indexOf(n))))})),o in Kf){Kf[o]=!0;for(const e in Yf)Yf[e]===o&&(lh[e]=!0);if(!n)return}for(const a in Kf)Object.prototype.hasOwnProperty.call(Kf,a)&&(Kf[a]=e[Zf[a]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(-1===Qf.indexOf(17)&&Qf.push(17),-1===Qf.indexOf(18)&&Qf.push(18),Kf[17]=!0,Kf[18]=!0);const i=oh();if(n)for(let a=0;a1&&(i=Vf(Yf,e)),(e="*"===(e=e[e.length-1])?"*":th(e))in Xf||(Xf[e]=[]),Xf[e].push({keyup:l,keydown:c,scope:r,mods:i,shortcut:o[a],method:n,key:o[a],splitKey:u,element:s});if(void 0!==s&&window){if(!eh.has(s)){const e=function(){return ah(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.event,s)},t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.event;ah(e,s),function(e){let t=e.keyCode||e.which||e.charCode;const n=Qf.indexOf(t);if(n>=0&&Qf.splice(n,1),e.key&&"meta"===e.key.toLowerCase()&&Qf.splice(0,Qf.length),93!==t&&224!==t||(t=91),t in Kf){Kf[t]=!1;for(const e in Yf)Yf[e]===t&&(lh[e]=!1)}}(e)};eh.set(s,{keydownListener:e,keyupListenr:t,capture:d}),Uf(s,"keydown",e,d),Uf(s,"keyup",t,d)}if(!Jf){const e=()=>{Qf=[]};Jf={listener:e,capture:d},Uf(window,"focus",e,d)}}}function ch(e){const t=Object.values(Xf).flat();if(t.findIndex((t=>{let{element:n}=t;return n===e}))<0){const{keydownListener:t,keyupListenr:n,capture:o}=eh.get(e)||{};t&&n&&(zf(e,"keyup",n,o),zf(e,"keydown",t,o),eh.delete(e))}if(t.length<=0||eh.size<=0){if(Object.keys(eh).forEach((e=>{const{keydownListener:t,keyupListenr:n,capture:o}=eh.get(e)||{};t&&n&&(zf(e,"keyup",n,o),zf(e,"keydown",t,o),eh.delete(e))})),eh.clear(),Object.keys(Xf).forEach((e=>delete Xf[e])),Jf){const{listener:e,capture:t}=Jf;zf(window,"focus",e,t),Jf=null}}}const uh={getPressedKeyString:function(){return Qf.map((e=>{return t=e,Object.keys(Wf).find((e=>Wf[e]===t))||(e=>Object.keys(Yf).find((t=>Yf[t]===e)))(e)||String.fromCharCode(e);var t}))},setScope:nh,getScope:oh,deleteScope:function(e,t){let n,o;e||(e=oh());for(const i in Xf)if(Object.prototype.hasOwnProperty.call(Xf,i))for(n=Xf[i],o=0;o{let{element:t}=e;return ch(t)}))}else o++;oh()===e&&nh(t||"all")},getPressedKeyCodes:function(){return Qf.slice(0)},getAllKeyCodes:function(){const e=[];return Object.keys(Xf).forEach((t=>{Xf[t].forEach((t=>{let{key:n,scope:o,mods:i,shortcut:r}=t;e.push({scope:o,shortcut:r,mods:i,keys:n.split("+").map((e=>th(e)))})}))})),e},isPressed:function(e){return"string"==typeof e&&(e=th(e)),-1!==Qf.indexOf(e)},filter:function(e){const t=e.target||e.srcElement,{tagName:n}=t;let o=!0;const i="INPUT"===n&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(i||"TEXTAREA"===n||"SELECT"===n)&&!t.readOnly)&&(o=!1),o},trigger:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all";Object.keys(Xf).forEach((n=>{Xf[n].filter((n=>n.scope===t&&n.shortcut===e)).forEach((e=>{e&&e.method&&e.method()}))}))},unbind:ih,keyMap:Wf,modifier:Yf,modifierMap:Zf};for(const by in uh)Object.prototype.hasOwnProperty.call(uh,by)&&(lh[by]=uh[by]);if("undefined"!=typeof window){const e=window.hotkeys;lh.noConflict=t=>(t&&window.hotkeys===lh&&(window.hotkeys=e),lh),window.hotkeys=lh}let dh=null;y.registerExtension({name:"Comfy.EasyUse.HotKeys",setup(){if(void 0!==lh){lh("up,down,left,right",(function(e,t){var n,o,i,r,s,a,l,c,u,d,p,f,h,m,g;e.preventDefault();if(!A("EasyUse.Hotkeys.JumpNearestNodes",null,!0))return;const v=Ap();if(0===v.length)return;const y=v[0];switch(t.key){case"up":case"left":let e=null;if(Np(y)){const e=null==(n=y.widgets_values)?void 0:n[0],t=null==(o=y.graph)?void 0:o._nodes,i=null==t?void 0:t.find((t=>{var n;if(Pp(t)){if((null==(n=t.widgets_values)?void 0:n[0])===e)return t}return null}));i&&Op(i)}else if((null==(i=y.inputs)?void 0:i.length)>0){for(let t=0;t{var n;if(Np(t)){if((null==(n=t.widgets_values)?void 0:n[0])===e)return t}return null}));n&&Op(n)}else if((null==(d=y.outputs)?void 0:d.length)>0){for(let e=0;e0&&y.outputs[e].links[0]){t=y.outputs[e].links[0];break}if(t){const e=null==(f=y.graph)?void 0:f.links;if(e[t]){const n=null==(h=e[t])?void 0:h.target_id,o=null==(g=null==(m=y.graph)?void 0:m._nodes_by_id)?void 0:g[n];o&&Op(o)}}}}})),lh("shift+up,shift+down,shift+left,shift+right",(function(e,t){e.preventDefault();if(!A("EasyUse.Hotkeys.AlignSelectedNodes",null,!0))return;const n=Ap();if(n.length<=1)return;const o=n;switch(t.key){case"shift+up":LGraphCanvas.alignNodes(o,"top",o[0]);break;case"shift+down":LGraphCanvas.alignNodes(o,"bottom",o[0]);break;case"shift+left":LGraphCanvas.alignNodes(o,"left",o[0]);break;case"shift+right":LGraphCanvas.alignNodes(o,"right",o[0])}dh||(dh=np()),dh&&dh.update()})),lh("shift+g",(function(e,t){e.preventDefault();A("EasyUse.Hotkeys.AddGroup",null,!0)&&(fh(),dh||(dh=np()),dh&&dh.update())}));const e=[];Array.from(Array(10).keys()).forEach((t=>e.push(`alt+${t}`))),lh(e.join(","),(async function(e,t){e.preventDefault();if(!A("EasyUse.Hotkeys.NodesTemplate",null,!0))return;const n=t.key;let o=parseInt(n.split("+")[1]);const i=await b.getUserData("comfy.templates.json");let r=null;if(200==i.status)try{r=await i.json()}catch(a){Fp.error(V("Get Node Templates File Failed"))}else localStorage["Comfy.NodeTemplates"]?r=JSON.parse(localStorage["Comfy.NodeTemplates"]):Fp.warn(V("No Node Templates Found"));if(!r)return void Fp.warn(V("No Node Templates Found"));o=0===o?9:o-1;const s=r[o];if(s)try{const e=(null==s?void 0:s.name)||"Group",t=(null==s?void 0:s.data)?JSON.parse(s.data):[];ph((async()=>{await k.registerFromWorkflow(t.groupNodes,{}),localStorage.litegrapheditor_clipboard=s.data,y.canvas.pasteFromClipboard(),t.groupNodes||fh(e)}))}catch(a){Fp.error(a)}else Fp.warn(V("Node template with {key} not set").replace("{key}",n))}));const t=async function(e){if(("b"===e.key||"m"==e.key)&&(e.metaKey||e.ctrlKey)){if(0===Ap().length)return;dh||(dh=np()),dh&&dh.update()}};window.addEventListener("keydown",t,!0)}}});const ph=async e=>{const t=localStorage.litegrapheditor_clipboard;await e(),localStorage.litegrapheditor_clipboard=t},fh=e=>{const t=Ap();if(0===t.length)return;const n=t;let o=new LiteGraph.LGraphGroup;o.title=e||"Group",((e,t=[],n=20)=>{var o,i,r,s,a,l,c,u,d,p;for(var f of(i=r=s=a=-1,l=c=u=d=-1,[e._nodes,t]))for(var h in f)l=(p=f[h]).pos[0],c=p.pos[1],u=p.pos[0]+p.size[0],d=p.pos[1]+p.size[1],"Reroute"!=p.type&&(c-=LiteGraph.NODE_TITLE_HEIGHT),(null==(o=p.flags)?void 0:o.collapsed)&&(d=c+LiteGraph.NODE_TITLE_HEIGHT,(null==p?void 0:p._collapsed_width)&&(u=l+Math.round(p._collapsed_width))),(-1==i||ls)&&(s=u),(-1==a||d>a)&&(a=d);r-=Math.round(1.4*e.font_size),e.pos=[i-n,r-n],e.size=[s-i+2*n,a-r+2*n]})(o,n),y.canvas.graph.add(o)};function hh(e,t,n,o){const i=[];return e.workflow.links.forEach((e=>{n&&e[1]===t&&!i.includes(e[3])&&i.push(e[3]),o&&e[3]===t&&!i.includes(e[1])&&i.push(e[1])})),i}async function mh(e,t=!1){const n=structuredClone(await y.graphToPrompt()),o=[];if(n.workflow.nodes.forEach((e=>{o.push(e.id)})),n.workflow.links=n.workflow.links.filter((e=>o.includes(e[1])&&o.includes(e[3]))),t)for(;!y.graph._nodes_by_id[e].isChooser;)e=hh(n,e,!0,!1)[0];const i=function(e,t){const n=[],o=[t];for(;o.length>0;){const t=o.pop();n.push(t),o.push(...hh(e,t,!0,!1).filter((e=>!(n.includes(e)||o.includes(e)))))}o.push(...n.filter((e=>e!=t)));const i=[t];for(;o.length>0;){const t=o.pop();i.push(t),o.push(...hh(e,t,!1,!0).filter((e=>!(i.includes(e)||o.includes(e)))))}const r=[];return r.push(...n),r.push(...i.filter((e=>!r.includes(e)))),r}(n,e);n.workflow.nodes=n.workflow.nodes.filter((t=>(t.id===e&&t.inputs.forEach((e=>{e.link=null})),i.includes(t.id)))),n.workflow.links=n.workflow.links.filter((e=>i.includes(e[1])&&i.includes(e[3])));const r={};for(const[l,c]of Object.entries(n.output))i.includes(parseInt(l))&&(r[l]=c);const s={};for(const[l,c]of Object.entries(r[e.toString()].inputs))Array.isArray(c)||(s[l]=c);r[e.toString()].inputs=s,n.output=r;const a=y.graphToPrompt;y.graphToPrompt=()=>(y.graphToPrompt=a,n),y.queuePrompt(0)}const gh=new class{constructor(){this.current_node_id=void 0,this.class_of_current_node=null,this.current_node_is_chooser=!1}update(){var e,t;return y.runningNodeId!=this.current_node_id&&(this.current_node_id=y.runningNodeId,this.current_node_id?(this.class_of_current_node=null==(t=null==(e=y.graph)?void 0:e._nodes_by_id[y.runningNodeId.toString()])?void 0:t.comfyClass,this.current_node_is_chooser="easy imageChooser"===this.class_of_current_node):(this.class_of_current_node=void 0,this.current_node_is_chooser=!1),!0)}},vh=class e{constructor(){}static idle(){return!y.runningNodeId}static paused(){return!0}static paused_here(t){return e.here(t)}static running(){return!e.idle()}static here(e){return y.runningNodeId==e}static state(){return"Paused"}};v(vh,"cancelling",!1);let yh=vh;function bh(e,t){const n=new FormData;n.append("message",t),n.append("id",e),b.fetchApi("/easyuse/image_chooser_message",{method:"POST",body:n})}function _h(){bh(-1,"__cancel__"),yh.cancelling=!0,b.interrupt(),yh.cancelling=!1}var wh=0;function Sh(){wh+=1}const xh=["easy kSampler","easy kSamplerTiled","easy fullkSampler"];function kh(e){const t=y.graph._nodes_by_id[e.detail.id];if(t){t.selected=new Set,t.anti_selected=new Set;const n=function(e,t){var n;return e.imgs=[],t.forEach((t=>{const n=new Image;e.imgs.push(n),n.onload=()=>{y.graph.setDirtyCanvas(!0)},n.src=`/view?filename=${encodeURIComponent(t.filename)}&type=temp&subfolder=${y.getPreviewFormatParam()}`})),null==(n=e.setSizeForImage)||n.call(e),e.imgs}(t,e.detail.urls);return{node:t,image:n,isKSampler:xh.includes(t.type)}}}function Ch(e,t,n){var o;if(e.imageRects)o=e.imageRects[t];else{const t=e.imagey;o=[1,t+1,e.size[0]-2,e.size[1]-t-2]}n.strokeRect(o[0]+1,o[1]+1,o[2]-2,o[3]-2)}class Ah extends w{constructor(){super(),this.node=null,this.select_index=[],this.dialog_div=null}show(e,t){this.select_index=[],this.node=t;const n=e.map(((e,n)=>{const o=_("img",{src:e.src,onclick:e=>{this.select_index.includes(n)?(this.select_index=this.select_index.filter((e=>e!==n)),o.classList.remove("selected")):(this.select_index.push(n),o.classList.add("selected")),t.selected.has(n)?t.selected.delete(n):t.selected.add(n)}});return o}));super.show(_("div.comfyui-easyuse-chooser-dialog",[_("h5.comfyui-easyuse-chooser-dialog-title",V("Choose images to continue")),_("div.comfyui-easyuse-chooser-dialog-images",n)]))}createButtons(){const e=super.createButtons();return e[0].onclick=e=>{yh.running()&&_h(),super.close()},e.unshift(_("button",{type:"button",textContent:V("Choose Selected Images"),onclick:e=>{bh(this.node.id,[...this.node.selected,-1,...this.node.anti_selected]),yh.idle()&&(Sh(),mh(this.node.id).then((()=>{bh(this.node.id,[...this.node.selected,-1,...this.node.anti_selected])}))),super.close()}})),e}}function Eh(){const e=y.graph._nodes_by_id[this.node_id];if(e){const t=[...e.selected];(null==t?void 0:t.length)>0&&e.setProperty("values",t),bh(e.id,[...e.selected,-1,...e.anti_selected]),yh.idle()&&(Sh(),mh(e.id).then((()=>{bh(e.id,[...e.selected,-1,...e.anti_selected])})))}}function Oh(){yh.running()&&_h()}function Lh(e){Object.defineProperty(e,"clicked",{get:function(){return this._clicked},set:function(e){this._clicked=e&&""!=this.name}})}function Th(e){e.options||(e.options={}),e.options.serialize=!1}y.registerExtension({name:"Comfy.EasyUse.imageChooser",init(){window.addEventListener("beforeunload",_h,!0)},setup(e){const t=LGraphCanvas.prototype.draw;LGraphCanvas.prototype.draw=function(){gh.update()&&e.graph._nodes.forEach((e=>{e.update&&e.update()})),t.apply(this,arguments)},b.addEventListener("easyuse-image-choose",(function(e){const{node:t,image:n,isKSampler:o}=kh(e);if(o){(new Ah).show(n,t)}}));const n=b.interrupt;b.interrupt=function(){yh.cancelling||_h(),n.apply(this,arguments)},b.addEventListener("execution_start",(function(){(wh>0?(wh-=1,0):(bh(-1,"__start__"),1))&&e.graph._nodes.forEach((e=>{(e.selected||e.anti_selected)&&(e.selected.clear(),e.anti_selected.clear(),e.update())}))}))},async nodeCreated(e,t){if("easy imageChooser"==e.comfyClass){e.setProperty("values",[]),void 0===(null==e?void 0:e.imageIndex)&&Object.defineProperty(e,"imageIndex",{get:function(){return null},set:function(t){e.overIndex=t}}),void 0===(null==e?void 0:e.imagey)&&Object.defineProperty(e,"imagey",{get:function(){return null},set:function(t){return e.widgets[e.widgets.length-1].last_y+LiteGraph.NODE_WIDGET_HEIGHT}});const t=e.onMouseDown;e.onMouseDown=function(n,o,i){if(n.isPrimary){const t=function(e,t){var n,o;if((null==(n=e.imgs)?void 0:n.length)>1)for(var i=0;i0&&n0&&oe.imagey)return 0;return-1}(e,o);t>=0&&this.imageClicked(t)}return t&&t.apply(this,arguments)},e.send_button_widget=e.addWidget("button","","",Eh),e.cancel_button_widget=e.addWidget("button","","",Oh),Lh(e.cancel_button_widget),Lh(e.send_button_widget),Th(e.cancel_button_widget),Th(e.send_button_widget)}},beforeRegisterNodeDef(e,t,n){if("easy imageChooser"==(null==t?void 0:t.name)){const t=e.prototype.onDrawBackground;e.prototype.onDrawBackground=function(e){t.apply(this,arguments),function(e,t){var n,o;if(e.imgs){if(e.imageRects)for(let n=0;n{Ch(e,n,t)})),t.strokeStyle="#F88",null==(o=null==e?void 0:e.anti_selected)||o.forEach((n=>{Ch(e,n,t)}))}}(this,e)},e.prototype.imageClicked=function(t){"easy imageChooser"===(null==e?void 0:e.comfyClass)&&(this.selected.has(t)?this.selected.delete(t):this.selected.add(t),this.update())};const n=e.prototype.update;e.prototype.update=function(){var e;if(n&&n.apply(this,arguments),this.send_button_widget){this.send_button_widget.node_id=this.id;const t=(this.selected?this.selected.size:0)+(this.anti_selected?this.anti_selected.size:0),n=(null==(e=this.imgs)?void 0:e.length)||0;yh.paused_here(this.id)&&t>0?this.send_button_widget.name=t>1?"Progress selected ("+t+"/"+n+")":"Progress selected image":this.send_button_widget.name=t>0?t>1?"Progress selected ("+t+"/"+n+")":"Progress selected image as restart":""}if(this.cancel_button_widget){const e=yh.running();this.cancel_button_widget.name=e?"Cancel current run":""}this.setDirtyCanvas(!0,!0)}}}}),Number.prototype.div=function(e){return function(e,t){let n,o,i=0,r=0,s="string"==typeof e?e:e.toString(),a="string"==typeof t?t:t.toString();try{i=s.toString().split(".")[1].length}catch(l){}try{r=a.toString().split(".")[1].length}catch(l){}return n=Number(s.toString().replace(".","")),o=Number(a.toString().replace(".","")),n/o*Math.pow(10,r-i)}(this,e)};let Ih=[],Nh=0;const Ph={sd3:6.5,"sd3-turbo":4};class Dh extends w{constructor(){super(),this.lists=[],this.dialog_div=null,this.user_div=null}addItem(e,t){return _("div.easyuse-account-dialog-item",[_("input",{type:"text",placeholder:"Enter name",oninput:e=>{const t=Array.prototype.indexOf.call(this.dialog_div.querySelectorAll(".easyuse-account-dialog-item"),e.target.parentNode);Ih[t].name=e.target.value},value:Ih[e].name}),_("input.key",{type:"text",oninput:e=>{const t=Array.prototype.indexOf.call(this.dialog_div.querySelectorAll(".easyuse-account-dialog-item"),e.target.parentNode);Ih[t].key=e.target.value},placeholder:"Enter APIKEY",value:Ih[e].key}),_("button.choose",{textContent:V("Choose"),onclick:async e=>{var n,o,i;const r=Array.prototype.indexOf.call(this.dialog_div.querySelectorAll(".easyuse-account-dialog-item"),e.target.parentNode);let s=Ih[r].name,a=Ih[r].key;if(!s)return void Fp.error(V("Please enter the account name"));if(!a)return void Fp.error(V("Please enter the APIKEY"));let l=!0;for(let t=0;t{(new Dh).show(t)}},[_("div.user",[_("div.avatar",r?[_("img",{src:r})]:"😀"),_("div.info",[_("h5.name",s),_("h6.remark","Credits: "+a)])]),_("div.edit",{textContent:V("Edit")})])),Fp.success(V("Save Succeed"))}else Fp.success(V("Save Succeed"));this.close()}else Fp.error(V("Save Failed"))}}),_("button.delete",{textContent:V("Delete"),onclick:e=>{const t=Array.prototype.indexOf.call(this.dialog_div.querySelectorAll(".easyuse-account-dialog-item"),e.target.parentNode);Ih.length<=1?Fp.error(V("At least one account is required")):(Ih.splice(t,1),this.dialog_div.removeChild(e.target.parentNode))}})])}show(e){Ih.forEach(((t,n)=>{this.lists.push(this.addItem(n,e))})),this.dialog_div=_("div.easyuse-account-dialog",this.lists),super.show(_("div.easyuse-account-dialog-main",[_("div",[_("a",{href:"https://platform.stability.ai/account/keys",target:"_blank",textContent:V("Getting Your APIKEY")})]),this.dialog_div]))}createButtons(){const e=super.createButtons();return e.unshift(_("button",{type:"button",textContent:V("Save Account Info"),onclick:e=>{let t=!0;for(let n=0;n{200==e.status?Fp.success(V("Save Succeed")):Fp.error(V("Save Failed"))}))}else Fp.error(V("APIKEY is not Empty"))}})),e.unshift(_("button",{type:"button",textContent:V("Add Account"),onclick:e=>{const t="Account "+Ih.length.toString();Ih.push({name:t,key:""});const n=this.addItem(Ih.length-1);this.lists.push(n),this.dialog_div.appendChild(n)}})),e}}y.registerExtension({name:"Comfy.EasyUse.API.SD3",async beforeRegisterNodeDef(e,t,n){if("easy stableDiffusion3API"==t.name){const t=e.prototype.onNodeCreated;e.prototype.onNodeCreated=async function(){var e,n,o;t&&(null==t||t.apply(this,arguments));const i=this.widgets.find((e=>["seed_num","seed"].includes(e.name))),r=this.widgets.find((e=>["control_before_generate","control_after_generate"].includes(e.name)));let s=this.widgets.find((e=>"model"==e.name));s.callback=e=>{a.value="-"+Ph[e]};const a=this.addWidget("text","cost_credit","0",(e=>{}),{serialize:!1});a.disabled=!0,setTimeout((e=>{"control_before_generate"==r.name&&0===i.value&&(i.value=Math.floor(4294967294*Math.random())),a.value="-"+Ph[s.value]}),100);let l=_("div.easyuse-account-user",[V("Loading UserInfo...")]);this.addDOMWidget("account","btn",_("div.easyuse-account",l)),b.addEventListener("stable-diffusion-api-generate-succeed",(async({detail:e})=>{var t;let n=l.querySelectorAll(".remark");if(n&&n[0]){const t=(null==e?void 0:e.model)?Ph[e.model]:0;if(t){let e=function(e,t){let n,o,i,r,s,a;s="string"==typeof e?e:e.toString(),a="string"==typeof t?t:t.toString();try{n=s.split(".")[1].length}catch(l){n=0}try{o=a.split(".")[1].length}catch(l){o=0}return i=Math.pow(10,Math.max(n,o)),r=n>=o?n:o,((e*i-t*i)/i).toFixed(r)}(parseFloat(n[0].innerText.replace(/Credits: /g,"")),t);e>0&&(n[0].innerText="Credits: "+e.toString())}}await W(1e4);const o=await b.fetchApi("/easyuse/stability/balance");if(200==o.status){const e=await o.json();if(null==e?void 0:e.balance){const o=(null==(t=e.balance)?void 0:t.credits)||0;n&&n[0]&&(n[0].innerText="Credits: "+o)}}}));const c=await b.fetchApi("/easyuse/stability/api_keys");if(200==c.status){let t=await c.json();if(Ih=t.keys,Nh=t.current,Ih.length>0&&void 0!==Nh){const t=Ih[Nh].key,i=Ih[Nh].name;if(t){const t=await b.fetchApi("/easyuse/stability/user_info");if(200==t.status){const i=await t.json();if((null==i?void 0:i.account)&&(null==i?void 0:i.balance)){const t=(null==(e=i.account)?void 0:e.profile_picture)||null,r=(null==(n=i.account)?void 0:n.email)||null,s=(null==(o=i.balance)?void 0:o.credits)||0;l.replaceChildren(_("div.easyuse-account-user-info",{onclick:e=>{(new Dh).show(l)}},[_("div.user",[_("div.avatar",t?[_("img",{src:t})]:"😀"),_("div.info",[_("h5.name",r),_("h6.remark","Credits: "+s)])]),_("div.edit",{textContent:V("Edit")})]))}}}else l.replaceChildren(_("div.easyuse-account-user-info",{onclick:e=>{(new Dh).show(l)}},[_("div.user",[_("div.avatar","😀"),_("div.info",[_("h5.name",i),_("h6.remark",V("Click to set the APIKEY first"))])]),_("div.edit",{textContent:V("Edit")})]))}}}}}});let jh=null;function Mh(){jh&&(jh.removeEventListeners(),jh.dropdown.remove(),jh=null)}function Rh(e,t,n,o=!1){Mh(),new $h(e,t,n,o)}class $h{constructor(e,t,n,o=!1){this.dropdown=document.createElement("ul"),this.dropdown.setAttribute("role","listbox"),this.dropdown.classList.add("easy-dropdown"),this.selectedIndex=-1,this.inputEl=e,this.suggestions=t,this.onSelect=n,this.isDict=o,this.focusedDropdown=this.dropdown,this.buildDropdown(),this.onKeyDownBound=this.onKeyDown.bind(this),this.onWheelBound=this.onWheel.bind(this),this.onClickBound=this.onClick.bind(this),this.addEventListeners()}buildDropdown(){this.isDict?this.buildNestedDropdown(this.suggestions,this.dropdown):this.suggestions.forEach(((e,t)=>{this.addListItem(e,t,this.dropdown)}));const e=this.inputEl.getBoundingClientRect();this.dropdown.style.top=e.top+e.height-10+"px",this.dropdown.style.left=e.left+"px",document.body.appendChild(this.dropdown),jh=this}buildNestedDropdown(e,t){let n=0;Object.keys(e).forEach((o=>{const i=e[o];if("object"==typeof i&&null!==i){const e=document.createElement("ul");e.setAttribute("role","listbox"),e.classList.add("easy-nested-dropdown");const r=document.createElement("li");r.classList.add("folder"),r.textContent=o,r.appendChild(e),r.addEventListener("mouseover",this.onMouseOver.bind(this,n,t)),t.appendChild(r),this.buildNestedDropdown(i,e),n+=1}else{const e=document.createElement("li");e.classList.add("item"),e.setAttribute("role","option"),e.textContent=o,e.addEventListener("mouseover",this.onMouseOver.bind(this,n,t)),e.addEventListener("mousedown",this.onMouseDown.bind(this,o)),t.appendChild(e),n+=1}}))}addListItem(e,t,n){const o=document.createElement("li");o.setAttribute("role","option"),o.textContent=e,o.addEventListener("mouseover",this.onMouseOver.bind(this,t)),o.addEventListener("mousedown",this.onMouseDown.bind(this,e)),n.appendChild(o)}addEventListeners(){document.addEventListener("keydown",this.onKeyDownBound),this.dropdown.addEventListener("wheel",this.onWheelBound),document.addEventListener("click",this.onClickBound)}removeEventListeners(){document.removeEventListener("keydown",this.onKeyDownBound),this.dropdown.removeEventListener("wheel",this.onWheelBound),document.removeEventListener("click",this.onClickBound)}onMouseOver(e,t){t&&(this.focusedDropdown=t),this.selectedIndex=e,this.updateSelection()}onMouseOut(){this.selectedIndex=-1,this.updateSelection()}onMouseDown(e,t){t.preventDefault(),this.onSelect(e),this.dropdown.remove(),this.removeEventListeners()}onKeyDown(e){const t=Array.from(this.focusedDropdown.children),n=t[this.selectedIndex];if(jh)if(38===e.keyCode)e.preventDefault(),this.selectedIndex=Math.max(0,this.selectedIndex-1),this.updateSelection();else if(40===e.keyCode)e.preventDefault(),this.selectedIndex=Math.min(t.length-1,this.selectedIndex+1),this.updateSelection();else if(39===e.keyCode){if(e.preventDefault(),n&&n.classList.contains("folder")){const e=n.querySelector(".easy-nested-dropdown");e&&(this.focusedDropdown=e,this.selectedIndex=0,this.updateSelection())}}else if(37===e.keyCode&&this.focusedDropdown!==this.dropdown){const e=this.focusedDropdown.closest(".easy-dropdown, .easy-nested-dropdown").parentNode.closest(".easy-dropdown, .easy-nested-dropdown");e&&(this.focusedDropdown=e,this.selectedIndex=Array.from(e.children).indexOf(this.focusedDropdown.parentNode),this.updateSelection())}else if((13===e.keyCode||9===e.keyCode)&&this.selectedIndex>=0){e.preventDefault(),n.classList.contains("item")&&(this.onSelect(t[this.selectedIndex].textContent),this.dropdown.remove(),this.removeEventListeners());const o=n.querySelector(".easy-nested-dropdown");o&&(this.focusedDropdown=o,this.selectedIndex=0,this.updateSelection())}else 27===e.keyCode&&(this.dropdown.remove(),this.removeEventListeners())}onWheel(e){const t=parseInt(this.dropdown.style.top);localStorage.getItem("Comfy.Settings.Comfy.InvertMenuScrolling")?this.dropdown.style.top=t+(e.deltaY<0?10:-10)+"px":this.dropdown.style.top=t+(e.deltaY<0?-10:10)+"px"}onClick(e){this.dropdown.contains(e.target)||e.target===this.inputEl||(this.dropdown.remove(),this.removeEventListeners())}updateSelection(){Array.from(this.focusedDropdown.children).forEach(((e,t)=>{t===this.selectedIndex?e.classList.add("selected"):e.classList.remove("selected")}))}}function Gh(e){const t=e.min||0,n=e.max||0,o=e.step||1;if(0===o)return[];const i=[];let r=t;for(;r<=n;){if(Number.isInteger(o))i.push(Math.round(r)+"; ");else{let e=r.toFixed(3);-0==e&&(e="0.000"),/\.\d{3}$/.test(e)||(e+="0"),i.push(e+"; ")}r+=o}return n>=0&&t>=0?i:i.reverse()}let Bh={},Fh={};function Uh(e,t){String(e.id);const n=t.name,o=t.value.replace(/^(loader|preSampling):\s/,"");Fh[n]?Fh[n]!=Bh[o]&&(Fh[n]=Bh[o]):Fh={...Fh,[n]:Bh[o]}}y.registerExtension({name:"Comfy.EasyUse.XYPlot",async beforeRegisterNodeDef(e,t,n){if("easy XYPlot"===t.name){Bh=t.input.hidden.plot_dict[0];for(const e in Bh){const t=Bh[e];if(Array.isArray(t)){let n=[];for(const e of t)n.push(e+"; ");Bh[e]=n}else Bh[e]="object"==typeof t?"seed"==e?t+"; ":Gh(t):t+"; "}Bh.None=[],Bh["---------------------"]=[]}},nodeCreated(e){"easy XYPlot"===e.comfyClass&&(function(e){if(e.widgets)for(const t of e.widgets)if("x_axis"===t.name||"y_axis"===t.name){let n=t.value;Object.defineProperty(t,"value",{get:()=>n,set(o){o!==n&&(n=o,Uh(e,t))}})}}(e),function(e){if(e.widgets){const t=e.widgets.filter((e=>"customtext"===e.type&&!1!==e.dynamicPrompts||e.dynamicPrompts));for(const e of t){let t=function(e,t,o,i){return e&&(t[o]=e),t.map((e=>n(e,i))).filter((e=>""!==e)).join("")},n=function(e,t){if(e=o(e),i(e,t))return e+"; ";let n=r(e,t);return 1===n.length||2===n.length?n[0]:i(s(e),t)?s(e)+"; ":""},o=function(e){return e.replace(/(\n|;| )/g,"")},i=function(e,t){return t.includes(e+"; ")},r=function(e,t){return t.filter((t=>t.toLowerCase().includes(e.toLowerCase())))},s=function(e){return Number(e)?Number(e).toFixed(3):["0","0.","0.0","0.00","00"].includes(e)?"0.000":e};const a=function(){const n=e.name[0]+"_axis";let o=(null==Fh?void 0:Fh[n])||[];if(0===o.length)return;const i=e.inputEl.value,r=e.inputEl.selectionStart;let s=i.split("; ");const a=i.substring(0,r).split("; ").length-1,l=s[a].replace(/\n/g,"").toLowerCase(),c=o.filter((e=>e.toLowerCase().includes(l))).map((e=>e.replace(/; /g,"")));if(c.length>0)Rh(e.inputEl,c,(n=>{const i=t(n,s,a,o);e.inputEl.value=i}));else{Mh();const n=t(null,s,a,o);e.inputEl.value=n}};e.inputEl.removeEventListener("input",a),e.inputEl.addEventListener("input",a),e.inputEl.removeEventListener("mouseup",a),e.inputEl.addEventListener("mouseup",a)}}}(e))}});const zh=_s("graphStore",{state:e=>({selectors:[],selectors_styles:{},seg_selectors:[],slider_controls:[]}),actions:{setSelectors(e){this.selectors=tp(e)},setStyles(e,t){this.selectors_styles[e]||(this.selectors_styles[e]=t)},setSegSelectors(e){this.seg_selectors=tp(e)},setSliderControls(e){this.slider_controls=tp(e)}}}),Vh=["data-id"],Hh=[Zi("i",{class:"mdi mdi-trash-can"},null,-1)],Wh=Zi("i",{class:"mdi mdi-magnify"},null,-1),Yh=["placeholder"],Zh=["onMouseenter","onMouseleave"],Kh=["onClick"],Xh=["name","checked"],Qh=["src"],Jh={key:0},qh=Zi("span",{class:"comfyui-easyuse-success"},"positive:",-1),em={key:1},tm=Zi("span",{class:"comfyui-easyuse-error"},"negative:",-1),nm="comfyui-easyuse-selector",om={__name:"stylesSelector",props:{id:{type:String|Number,default:""},type:{type:String,default:""},selectedStyles:{type:Array,default:[]},show:{type:Boolean,default:!1}},emits:["chooseStyle"],setup(e,{emit:t}){const n=e,o=zh(),{selectors_styles:i}=ws(o),r=pn([]);bi((e=>n.type),(async e=>{r.value=[],e&&await(async e=>{if(i.value[n.type])return!0;const t=await b.fetchApi(`/easyuse/prompt/styles?name=${e}`);if(200===t.status){let e=(await t.json()).map(((e,t)=>(e.index=t,e)));return await o.setStyles(n.type,e),!0}return Fp.error(V("Get styles list Failed")),!1})(e)&&a()}),{immediate:!0});const s=t,a=e=>{const t=n.selectedStyles,o=tp(i.value[n.type]);r.value=o.sort(((e,t)=>e.index-t.index)).sort(((e,n)=>t.includes(n.name)-t.includes(e.name)))},l=pn(""),c=e=>e.toLowerCase(),u=Xt({}),d=e=>{u.src="",u.name="",u.positive="",u.negative=""},p=async e=>{const t=await b.fetchApi(`/easyuse/prompt/styles/image?name=${e}&styles_name=${n.type}`);if(200===t.status){const o=await t.text();if(o.startsWith("http"))return o;return`/easyuse/prompt/styles/image?name=${e}&styles_name=${n.type}`}},f=e=>{e.target.src="data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAA8AAD/4QNLaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA5LjEtYzAwMSA3OS4xNDYyODk5Nzc3LCAyMDIzLzA2LzI1LTIzOjU3OjE0ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoMjAyMzA5MDUubS4yMzE2IDk3OWM4NmQpICAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RjA3NEU1QzNCNUJBMTFFRUExMUVDNkZDRjI0NzlBN0QiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RjA3NEU1QzRCNUJBMTFFRUExMUVDNkZDRjI0NzlBN0QiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpGMDc0RTVDMUI1QkExMUVFQTExRUM2RkNGMjQ3OUE3RCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpGMDc0RTVDMkI1QkExMUVFQTExRUM2RkNGMjQ3OUE3RCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/uAA5BZG9iZQBkwAAAAAH/2wCEAAYEBAQFBAYFBQYJBgUGCQsIBgYICwwKCgsKCgwQDAwMDAwMEAwODxAPDgwTExQUExMcGxsbHB8fHx8fHx8fHx8BBwcHDQwNGBAQGBoVERUaHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fH//AABEIAIAAgAMBEQACEQEDEQH/xACLAAEAAgMBAQEAAAAAAAAAAAAABAUCAwYBBwgBAQADAQEBAAAAAAAAAAAAAAABAgMEBQYQAAEEAgECAwUHAwUAAAAAAAEAAgMEEQUhEgYxEwdBYSIyFFFxgVJyIxWRoTOxwdFiJBEBAAICAQQBBAIDAAAAAAAAAAECEQMxIUESBBOB0SIyUXGCIwX/2gAMAwEAAhEDEQA/AP1SgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICDXJYgj+d4afsVopM8KWvEcy8it1pXdMcjXO/Lnn+im2u0cwV2VniW1UXEBAQEBAQEBAQEBAQRNlc+mgyDh7zhv+5WunX5Sw37fCHM2dh48r06ank7N6rn2Ja7qa4hw5BBwQV010uK+/DsO29v/J68SOI86Jxjl95HIP4gryPc0fHfHaXu+j7Py68zzHSVquV2iAgICAgICAgICDyTr6HdHz4PTnwypjnqic46OauNbY6mGX99p+L8w9xaeV6OufHt0eXtr59M9VFb194E9LmuH3kf6rv17avO2ets7YVcuuuk/uOa3PgBlxP4BdMbq9nLPqbJ5xDbSM9azFXpyujuSO+Bo5kcf0NPyj25We2YtEzaPxdfr6519Kz+UvqEIlELBKQZQ0eYRwC7HOPxXzVsZ6cPpK5x15ZKEiAgICAgICAgICCNc1tG40CzA2XHg4j4h9zhyFpr22p+s4Z7NNL/ALRlTX+1dVFBJOJrcTI2lxZHYcBx+sldWv3bzOMVn6fZy39OkRnNo+v3aoOx9JOxks8tqwHDPS+1IW8+IzGWZVrf9DZHSMR/j9yvo656zMz9V1rdLqdYwsoVIqwd87mNAc79Tvmd+JXJt332ftMy6temlP1jCasmggICAgICAgICAgwlmiib1SPDB7zhWrWZ4VtaI5QXb2l5ojYHvLjjIGB/dbR61sZlhPtVziFb3PYdd0luCvAZbXludVZ1huZQPgyTx4/atvWj4rxaZ6d/6Ye1/t1zSI6zx/bzti5YqaOpBeg8u41n/oa14cA4ccH7lPs1jZebVn8eyPUtOrXFbR+XdYx9xa90pjeXROaSCXDj+oysZ9S+Mx1bR7uvOJ6LGOWKVgfG8PafAtOQueazHLqraJjMMlCRAQEBAQEBAQRLNp4HTFx/2/4WtKR3Y32T2Udl8j3knk/aeSu6kREPPvaZlpY3DmyY8DyrzPZWv8tkvmFv7bg12RyR1DGeeMj2KnjE9JaeUx1hi1sgaet/U7JIOMcE8Dj7FMREcK2zPKMasr5XO6fmOVt5xEOadVplYU45IAOhxa72kLm2TFuXXqrNeF1WtlwDZeHfmHguO+vHDupszylLJsICAgICAg8cMjCQiYR5IVpFmc1Q5qLXHPgfbhbV2MLaYlqNQAYA4V/kV+PDA1fcp81fjYurtYMu4CmLZRNYhtZWBAI8CqzdaKN8df3LObtIokxwe5ZzZrFUloIGFnLWHqhIgICAgICAgxMbSpyjDAwAq3kr4MTWCnzR4MX02PGHDISNmETqieWba7QABwB4KJumKNgjaFXK0VZYChYQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEHzvuv1G7k1W9s6/Xamtaq15oaonmnsCR008HntaI4K8/s4HOeEGXZXqTud7uqtG7r6kNa5HdMU9aaw9zZde+FkrHsnr1+M2MZBPIKDRe9cO2K2mjs/V0m7X61lWzq32W+ZFEbfkSSO4B+GL9zw4QWm99TqFVmjsaSu7fUtxeNM2aTmSMBbHI9zWHqHVJlnDTxjPKCJL6sea502t1D7Ouhr0rNqxNM2CSNuwnkgjAi6ZOotdEc/Egibf1j/j+7JNL9DWdWg84TWn2ywtdFKyMZb5Tg0nLyG55x48IJ3bXqe/ea/a26dFtyTXtldDUqyOdNL5VqaDHS5gwXRxMe3xz1Y9iDKP1Sa7uefUnR7TyYqUVoEU5jY6pJZIz1RY4ZiMYd7TkexBA749Wr2gtCKlrIpGs17NjK29LLWmPmMsyiFkbIZsPEdKQu6y0eAQWdD1E2L93W1tzRyCDY3paev2NaxVlhIjidMfMb5vmse1kbi9pZ7MeKDt0BAQEBAQfEPU+lFY2++q2K1uSSezTnrReVsTTmiZVYHOd9LVuQyubIwANkbxz4FA7FsQ0NrrLNXX7N0eo1+3darGDYPjb5j6prxVRajjDetsRAjj4yM4CDre2uxO7q2hqtm7nua6w9rp5tfXgoSxwyTOMr42PlrPe4Nc8jJJQRDb3Oz1fYFrcV7As0mu3u7nbWkBZ9LSfG5nlxs/yySWRiNozwcBBx9EXadGTXz62+LG41+jZS6adhzS6vfnlkEjgzEZax7T8ePFBu3nbPdUXqJZsw6S5cqbCW1YdIY2lxhhfEGMjfHtoG9HxucwPEZy4/A7kMC87aq2Kmv7mdvxuqGmklFjUU4G2Yp21rdyW00t+kJkFl88pY9vDgwNDvEoK9np73FBcHdkrt2+rZd5FjQx7O0b8WvbzDKZhN1SSse573QdeAHkN+Ichj3p2rBvZq9vUnY2tcNQPqpZYZpJ44GxXqzHdVlzZZpib73mLHViI85c1BZ6OpsIe/6/XSuntevdsz6+8+pI0/yM1dtWVr2Z644P8rmyuj6S53jxkh9aQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBB/9k="};return(t,o)=>($i(),Ui("div",{class:Me(nm+` ${nm}-styles`),"data-id":e.id,onMouseleave:d},[r.value.length>0&&e.show?($i(),Ui(Ni,{key:0},[Zi("div",{class:Me(nm+"__header")},[Zi("div",{class:Me(nm+"__header_button"),onClick:o[0]||(o[0]=e=>(s("chooseStyle",[]),void(l.value="")))},Hh,2),Zi("div",{class:Me(nm+"__header_search")},[Wh,Hn(Zi("textarea",{class:"search","onUpdate:modelValue":o[1]||(o[1]=e=>l.value=e),dir:"ltr",rows:1,placeholder:hn(V)("Type here to search styles ...")},null,8,Yh),[[Zr,l.value]])],2)],2),Zi("div",{class:Me(nm+"__content"),onMouseleave:a},[($i(!0),Ui(Ni,null,bo(r.value,((t,o)=>($i(),Ui("div",{class:Me(nm+"-item"),key:o,onMouseenter:e=>(async e=>{if(!e.imageSrc){if(e.imageLoading)return;e.imageLoading=!0;const t=await p(e.imgName).finally((()=>e.imageLoading=!1));e.imageSrc=t}u.name="zh-CN"==z&&e.name_cn?e.name_cn:e.name,u.positive=e.prompt,u.negative=e.negative_prompt,u.src=e.imageSrc})(t),onMouseleave:Qr((e=>d()),["stop"])},[Zi("span",{class:Me([nm+"-item__tag",{hide:!(e.selectedStyles.includes(t.name)||-1!=c(t.name).indexOf(c(l.value))||t.name_cn&&-1!=c(t.name_cn).indexOf(c(l.value)))}]),onClick:e=>(e=>{let t=n.selectedStyles;t.includes(e.name)?t=t.filter((t=>t!==e.name)):t.push(e.name),s("chooseStyle",t)})(t)},[Zi("input",{type:"checkbox",name:t.name,checked:e.selectedStyles.includes(t.name)},null,8,Xh),Zi("span",null,Be("zh-CN"==hn(z)&&t.name_cn?t.name_cn:t.name),1)],10,Kh)],42,Zh)))),128))],34),(null==u?void 0:u.src)?($i(),Ui("div",{key:0,class:Me(nm+"-preview")},[Zi("img",{src:u.src,ref:"image",alt:"preview",onError:f},null,40,Qh),Zi("div",{class:Me(nm+"-preview__text")},[Zi("b",null,Be(u.name),1),Zi("div",{class:Me(nm+"-preview__prompt")},[u.positive?($i(),Ui("h6",Jh,[qh,Zi("span",null,Be(u.positive),1)])):Ji("",!0),u.negative?($i(),Ui("h6",em,[tm,Zi("span",null,Be(u.negative),1)])):Ji("",!0)],2)],2)],2)):Ji("",!0)],64)):Ji("",!0)],42,Vh))}},im=["data-id"],rm=["onClick"],sm=["name","checked"],am="comfyui-easyuse-selector",lm={__name:"segSelector",props:{id:{type:String|Number,default:""},type:{type:String,default:""},selected:{type:Array,default:[]},show:{type:Boolean,default:!1}},emits:["select"],setup(e,{emit:t}){const n=e,o=pn([]);bi((e=>n.type),(async e=>{switch(e){case"selfie_multiclass_256x256":o.value=["Background","Hair","Body","Face","Clothes","Others"];break;case"human_parsing_lip":o.value=["Background","Hat","Hair","Glove","Sunglasses","Upper-clothes","Dress","Coat","Socks","Pants","Jumpsuits","Scarf","Skirt","Face","Left-arm","Right-arm","Left-leg","Right-leg","Left-shoe","Right-shoe"]}}),{immediate:!0});const i=t;return(t,r)=>{var s;return $i(),Ui("div",{class:Me(am+` ${am}-seg`),"data-id":e.id},[(null==(s=o.value)?void 0:s.length)>0&&e.show?($i(!0),Ui(Ni,{key:0},bo(o.value,((t,o)=>($i(),Ui("div",{class:Me(am+"-item"),key:o},[Zi("span",{class:Me(am+"-item__tag"),onClick:e=>(e=>{let t=tp(n.selected);t.includes(e)?t=t.filter((t=>t!==e)):t.push(e),i("select",t)})(t)},[Zi("input",{type:"checkbox",name:t,checked:e.selected.includes(t)},null,8,sm),Zi("span",null,Be(hn(V)(t)),1)],10,rm)],2)))),128)):Ji("",!0)],10,im)}}},cm=["data-id"],um=["onMousedown","onDblclick"],dm="comfyui-easyuse-slider",pm="ipadapter layer weights",fm={__name:"sliderControl",props:{id:{type:String|Number,default:""},mode:{type:String,default:""},type:{type:String,default:""},values:{type:Array,default:[]},show:{type:Boolean,default:!1}},emits:["changeValues","showSlider"],setup(e,{emit:t}){const n=e,o=t,i=(e,t,n)=>(e-t)/(n-t)*100,r=(e,t,o=void 0)=>{if(n.mode===pm){let n={3:2.5,6:1}[t]||0;return{default:12==e?n:0,min:-1,max:3,step:.05,value:void 0!==o?o:12==e?n:0,top:void 0!==o?100-i(o,-1,3)+"%":null,height:void 0!==o?i(o,-1,3)+"%":null}}};bi((e=>n.mode),(async(e,t)=>{var i;if(e!==t&&e===pm)if(!t&&(null==(i=n.values)?void 0:i.length)>0){const e=n.values.map((e=>{const t=e.split(":");return r(n.values.length,t[0],parseFloat(t[1]))}));await o("changeValues",e)}else{let e="sd1"==n.type?16:12,t=Array.from({length:e},((t,n)=>r(e,n)));await o("changeValues",t)}o("showSlider")}),{immediate:!0}),bi((e=>n.type),((e,t)=>{if(e!=t&&n.mode==pm){let e="sd1"==n.type?16:12,t=Array.from({length:e},((t,n)=>r(e,n)));o("changeValues",t)}}));const s=pn(null),a=pn(null);return oo((()=>{document.onmouseup=e=>document.onmousemove=null})),(t,r)=>{var l;return $i(),Ui("div",{class:Me(dm),"data-id":e.id},[(null==(l=e.values)?void 0:l.length)>0&&e.show?($i(!0),Ui(Ni,{key:0},bo(e.values,((t,r)=>($i(),Ui("div",{class:Me([dm+"-item",{positive:3==r&&"sdxl"==e.type&&e.mode==pm},{negative:6==r&&"sdxl"==e.type&&e.mode==pm}]),key:r},[Zi("div",{class:Me(dm+"-item-input")},Be(t.value),3),Zi("div",{class:Me(dm+"-item-scroll"),ref_for:!0,ref_key:"scroll",ref:s},[Zi("div",{class:Me(dm+"-item-bar"),ref_for:!0,ref_key:"bar",ref:a,style:Ie({top:t.top||100-i(t.default,t.min,t.max)+"%"}),onMousedown:e=>((e,t,i)=>{let r=e||window.event,l=s.value[i],c=a.value[i],u=tp(n.values),d=r.clientY-c.offsetTop;document.onmousemove=e=>{let n=(e||window.event).clientY-d;n<0?n=0:n>l.offsetHeight-c.offsetHeight&&(n=l.offsetHeight-c.offsetHeight);let r=(t.max-t.min)/t.step,s=(l.offsetHeight-c.offsetHeight)/r;n=Math.round(n/s)*s;const a=Math.floor(n/(l.offsetHeight-c.offsetHeight)*100)+"%",p=Math.floor((l.offsetHeight-c.offsetHeight-n)/(l.offsetHeight-c.offsetHeight)*100)+"%",f=parseFloat(parseFloat(t.max-(t.max-t.min)*(n/(l.offsetHeight-c.offsetHeight))).toFixed(2));u[i]={...u[i],top:a,height:p,value:f},o("changeValues",u),window.getSelection?window.getSelection().removeAllRanges():document.selection.empty()}})(e,t,r),onDblclick:e=>((e,t,i)=>{let r=tp(n.values);r[i]={...r[i],top:null,height:null,value:t.default},o("changeValues",r)})(0,t,r)},null,46,um),Zi("div",{class:Me(dm+"-item-area"),style:Ie({height:t.height||i(t.default,t.min,t.max)+"%"})},null,6)],2),Zi("div",{class:Me(dm+"-item-label")},[Zi("span",null,Be(t.label),1)],2)],2)))),128)):Ji("",!0)],8,cm)}}},hm={__name:"index",setup(e){const t=zh(),{selectors:n,seg_selectors:o,slider_controls:i}=ws(t),r=pn({}),s=async e=>{var o,i,s,a,l,c;await W(1);const u=wp(e,"styles"),d=(null==(o=e.properties.values)?void 0:o.length)>0?e.properties.values:[];let p=tp(n.value);p.push({id:e.id,type:u.value,value:d,show:!1});const f=p.length-1;await t.setSelectors(p);let h=null==(a=null==(s=null==(i=r.value[e.id])?void 0:i._)?void 0:s.vnode)?void 0:a.el;if(!h)return;let m=e.addDOMWidget("select_styles","btn",h);e.properties.values||e.setProperty("values",[]),p[f].show=!0,await t.setSelectors(p);let g=u.value;Object.defineProperty(u,"value",{set:n=>{g=n,p[f].type=n,e.properties.values=[],p[f].value=[],t.setSelectors(p)},get:e=>g}),Object.defineProperty(m,"value",{set:e=>{setTimeout((n=>{p[f].value=e.split(","),t.setSelectors(p)}),150)},get:t=>{var o,i;return e.properties.values=(null==(i=null==(o=n.value)?void 0:o[f])?void 0:i.value)||[],e.properties.values.join(",")}}),((null==(l=e.size)?void 0:l[0])<150||(null==(c=e.size)?void 0:c[1])<150)&&e.setSize([425,500]);const v=e.onRemoved;e.onRemoved=function(){if(v&&(null==v||v.apply(this,arguments)),void 0!==n.value.findIndex((t=>t.id==e.id))){let e=tp(n.value);e.splice(f,1),t.setSelectors(e)}return v}},a=pn({}),l=async e=>{var n,i,r,s;await W(1);const l=wp(e,"method"),c=(null==(n=e.properties.values)?void 0:n.length)>0?e.properties.values:[];let u=tp(o.value);u.push({id:e.id,type:l.value,value:c,show:!1});const d=u.length-1;await t.setSegSelectors(u);let p=null==(s=null==(r=null==(i=a.value[e.id])?void 0:i._)?void 0:r.vnode)?void 0:s.el;if(!p)return;let f=e.addDOMWidget("mask_components","btn",p);e.properties.values||e.setProperty("values",[]),u[d].show=!0,await t.setSegSelectors(u);let h=l.value;Object.defineProperty(l,"value",{set:n=>{h=n,u[d].type=n,e.properties.values=[],u[d].value=[],Sp(e,wp(e,"confidence"),"selfie_multiclass_256x256"===h),e.setSize([300,"selfie_multiclass_256x256"===h?260:500]),t.setSegSelectors(u)},get:e=>h}),Object.defineProperty(f,"value",{set:e=>{setTimeout((n=>{u[d].value=e.split(","),t.setSegSelectors(u)}),150)},get:t=>{var n;return e.properties.values=(null==(n=o.value)?void 0:n[d].value)||[],e.properties.values.join(",")}}),Sp(e,wp(e,"confidence"),"selfie_multiclass_256x256"===h),e.setSize([300,"selfie_multiclass_256x256"===h?260:500]);const m=e.onRemoved;e.onRemoved=function(){if(m&&(null==m||m.apply(this,arguments)),void 0!==o.value.findIndex((t=>t.id==e.id))){let e=tp(o.value);e.splice(d,1),t.setSegSelectors(e)}return m}},c=pn({}),u=async e=>{var n,o,r,s;await W(1);const a=wp(e,"mode"),l=wp(e,"model_type"),u=(null==(n=e.properties.values)?void 0:n.length)>0?e.properties.values:[];let d=tp(i.value);d.push({id:e.id,type:l.value,mode:a.value,value:u,show:!1});const p=d.length-1;await t.setSliderControls(d);let f=null==(s=null==(r=null==(o=c.value[e.id])?void 0:o._)?void 0:r.vnode)?void 0:s.el;if(!f)return;let h=e.addDOMWidget("values","btn",f);e.properties.values||e.setProperty("values",[]),Object.defineProperty(h,"value",{set:function(){},get:t=>{var n;const o=(null==(n=i.value)?void 0:n[p].value)||[];return e.properties.values=o.map(((e,t)=>`${t}:${e.value}`)),e.properties.values.join(",")}}),e.setSize("sdxl"==l.value?[375,320]:[455,320]),l.callback=n=>{d=tp(i.value),d[p].type!=n&&(e.setSize("sdxl"==n?[375,320]:[455,320]),d[p].value=[],d[p].type=n,t.setSliderControls(d))};const m=e.onRemoved;e.onRemoved=function(){if(m&&(null==m||m.apply(this,arguments)),void 0!==i.value.findIndex((t=>t.id==e.id))){let e=tp(i.value);e.splice(p,1),t.setSliderControls(e)}return m}};return oo((e=>{y.registerExtension({name:"Comfy.EasyUse.Components",async beforeRegisterNodeDef(e,t){const n=e.prototype.onNodeCreated;"easy stylesSelector"==t.name&&(e.prototype.onNodeCreated=async function(){return n&&(null==n||n.apply(this,arguments)),await s(this),n}),"easy humanSegmentation"==t.name&&(e.prototype.onNodeCreated=async function(){return n&&(null==n||n.apply(this,arguments)),await l(this),n}),"easy sliderControl"==t.name&&(e.prototype.onNodeCreated=async function(){return n&&(null==n||n.apply(this,arguments)),await u(this),n})}})})),(e,s)=>($i(),Ui(Ni,null,[($i(!0),Ui(Ni,null,bo(hn(n),((e,o)=>($i(),zi(om,{ref_for:!0,ref:t=>{t&&(r.value[e.id]=t)},type:e.type,key:o,id:e.id,show:e.show,selectedStyles:e.value,onChooseStyle:e=>((e,o)=>{let i=tp(n.value);i[o].value=e,t.setSelectors(i)})(e,o)},null,8,["type","id","show","selectedStyles","onChooseStyle"])))),128)),($i(!0),Ui(Ni,null,bo(hn(o),((e,n)=>($i(),zi(lm,{ref_for:!0,ref:t=>{t&&(a.value[e.id]=t)},type:e.type,key:n,id:e.id,show:e.show,selected:e.value,onSelect:e=>((e,n)=>{let i=tp(o.value);i[n].value=e,t.setSegSelectors(i)})(e,n)},null,8,["type","id","show","selected","onSelect"])))),128)),($i(!0),Ui(Ni,null,bo(hn(i),((e,n)=>($i(),zi(fm,{ref_for:!0,ref:t=>{t&&(c.value[e.id]=t)},type:e.type,key:n,id:e.id,show:e.show,mode:e.mode,values:e.value,onChangeValues:e=>((e,n)=>{let o=tp(i.value);o[n].value=e,t.setSliderControls(o)})(e,n),onShowSlider:e=>(e=>{let n=tp(i.value);n[e].show=!0,t.setSliderControls(n)})(n)},null,8,["type","id","show","mode","values","onChangeValues","onShowSlider"])))),128))],64))}};var mm=Object.defineProperty,gm=Object.getOwnPropertySymbols,vm=Object.prototype.hasOwnProperty,ym=Object.prototype.propertyIsEnumerable,bm=(e,t,n)=>t in e?mm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function _m(e){return null==e||""===e||Array.isArray(e)&&0===e.length||!(e instanceof Date)&&"object"==typeof e&&0===Object.keys(e).length}function wm(e){return!!(e&&e.constructor&&e.call&&e.apply)}function Sm(e){return!_m(e)}function xm(e,t=!0){return e instanceof Object&&e.constructor===Object&&(t||0!==Object.keys(e).length)}function km(e,...t){return wm(e)?e(...t):e}function Cm(e,t=!0){return"string"==typeof e&&(t||""!==e)}function Am(e){return Cm(e)?e.replace(/(-|_)/g,"").toLowerCase():e}function Em(e,t="",n={}){const o=Am(t).split("."),i=o.shift();return i?xm(e)?Em(km(e[Object.keys(e).find((e=>Am(e)===i))||""],n),o.join("."),n):void 0:km(e,n)}function Om(e,t=!0){return Array.isArray(e)&&(t||0!==e.length)}function Lm(e){return Sm(e)&&!isNaN(e)}function Tm(e,t){if(t){const n=t.test(e);return t.lastIndex=0,n}return!1}function Im(...e){const t=(e={},n={})=>{const o=((e,t)=>{for(var n in t||(t={}))vm.call(t,n)&&bm(e,n,t[n]);if(gm)for(var n of gm(t))ym.call(t,n)&&bm(e,n,t[n]);return e})({},e);return Object.keys(n).forEach((i=>{xm(n[i])&&i in e&&xm(e[i])?o[i]=t(e[i],n[i]):o[i]=n[i]})),o};return e.reduce(((e,n,o)=>0===o?n:t(e,n)),{})}function Nm(e){return e?e.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g,"").replace(/ {2,}/g," ").replace(/ ([{:}]) /g,"$1").replace(/([;,]) /g,"$1").replace(/ !/g,"!").replace(/: /g,":"):e}function Pm(e){return Cm(e)?e.replace(/(_)/g,"-").replace(/[A-Z]/g,((e,t)=>0===t?e:"-"+e.toLowerCase())).toLowerCase():e}function Dm(e){return Cm(e)?e.replace(/[A-Z]/g,((e,t)=>0===t?e:"."+e.toLowerCase())).toLowerCase():e}function jm(){const e=new Map;return{on(t,n){let o=e.get(t);return o?o.push(n):o=[n],e.set(t,o),this},off(t,n){let o=e.get(t);return o&&o.splice(o.indexOf(n)>>>0,1),this},emit(t,n){let o=e.get(t);o&&o.slice().map((e=>{e(n)}))},clear(){e.clear()}}}var Mm=Object.defineProperty,Rm=Object.defineProperties,$m=Object.getOwnPropertyDescriptors,Gm=Object.getOwnPropertySymbols,Bm=Object.prototype.hasOwnProperty,Fm=Object.prototype.propertyIsEnumerable,Um=(e,t,n)=>t in e?Mm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zm=(e,t)=>{for(var n in t||(t={}))Bm.call(t,n)&&Um(e,n,t[n]);if(Gm)for(var n of Gm(t))Fm.call(t,n)&&Um(e,n,t[n]);return e},Vm=(e,t)=>Rm(e,$m(t)),Hm=(e,t)=>{var n={};for(var o in e)Bm.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&Gm)for(var o of Gm(e))t.indexOf(o)<0&&Fm.call(e,o)&&(n[o]=e[o]);return n},Wm=jm();function Ym(e,t){Om(e)?e.push(...t||[]):xm(e)&&Object.assign(e,t)}function Zm(e,t=""){if(!["opacity","z-index","line-height","font-weight","flex","flex-grow","flex-shrink","order"].some((e=>t.endsWith(e)))){return`${e}`.trim().split(" ").map((e=>Lm(e)?`${e}px`:e)).join(" ")}return e}function Km(e="",t=""){return function(e){return e.replaceAll(/ /g,"").replace(/[^\w]/g,"-")}(`${Cm(e,!1)&&Cm(t,!1)?`${e}-`:e}${t}`)}function Xm(e="",t=""){return`--${Km(e,t)}`}function Qm(e,t="",n="",o=[],i){if(Cm(e)){const r=/{([^}]*)}/g,s=e.trim();if(Tm(s,r)){const e=s.replaceAll(r,(e=>{const t=e.replace(/{|}/g,"").split(".").filter((e=>!o.some((t=>Tm(e,t)))));return`var(${Xm(n,Pm(t.join("-")))}${Sm(i)?`, ${i}`:""})`})),t=/(\d+\s+[\+\-\*\/]\s+\d+)/g,a=/var\([^)]+\)/g;return Tm(e.replace(a,"0"),t)?`calc(${e})`:e}return Zm(s,t)}if(Lm(e))return Zm(e,t)}function Jm(e,t){return e?`${e}{${t}}`:""}var qm=(...e)=>eg(og.getTheme(),...e),eg=(e={},t,n,o="variable")=>{if(t){const{variable:i,options:r}=og.defaults||{},{prefix:s,transform:a}=(null==e?void 0:e.options)||r||{},l=Tm(t,/{([^}]*)}/g)?t:`{${t}}`;return"value"===o||"strict"===a?og.getTokenValue(t):Qm(l,void 0,s,[i.excludedKeyRegex],n)}return""};function tg(e,t={}){const n=og.defaults.variable,{prefix:o=n.prefix,selector:i=n.selector,excludedKeyRegex:r=n.excludedKeyRegex}=t,s=(e,t="")=>Object.entries(e).reduce(((e,[n,i])=>{const a=Tm(n,r)?Km(t):Km(t,Pm(n)),l=function(e){return xm(e)&&e.hasOwnProperty("value")&&e.hasOwnProperty("type")?e.value:e}(i);if(xm(l)){const{variables:t,tokens:n}=s(l,a);Ym(e.tokens,n),Ym(e.variables,t)}else e.tokens.push((o?a.replace(`${o}-`,""):a).replaceAll("-",".")),function(e,t,n){Cm(t,!1)&&e.push(`${t}:${n};`)}(e.variables,Xm(a),Qm(l,a,o,[r]));return e}),{variables:[],tokens:[]}),{variables:a,tokens:l}=s(e,o);return{value:a,tokens:l,declarations:a.join(""),css:Jm(i,a.join(""))}}var ng={regex:{rules:{class:{pattern:/^\.([a-zA-Z][\w-]*)$/,resolve(e){return{type:"class",selector:e,matched:this.pattern.test(e.trim())}}},attr:{pattern:/^\[(.*)\]$/,resolve(e){return{type:"attr",selector:`:root${e}`,matched:this.pattern.test(e.trim())}}},media:{pattern:/^@media (.*)$/,resolve(e){return{type:"media",selector:`${e}{:root{[CSS]}}`,matched:this.pattern.test(e.trim())}}},system:{pattern:/^system$/,resolve(e){return{type:"system",selector:"@media (prefers-color-scheme: dark){:root{[CSS]}}",matched:this.pattern.test(e.trim())}}},custom:{resolve:e=>({type:"custom",selector:e,matched:!0})}},resolve(e){const t=Object.keys(this.rules).filter((e=>"custom"!==e)).map((e=>this.rules[e]));return[e].flat().map((e=>{var n;return null!=(n=t.map((t=>t.resolve(e))).find((e=>e.matched)))?n:this.rules.custom.resolve(e)}))}},_toVariables:(e,t)=>tg(e,{prefix:null==t?void 0:t.prefix}),getCommon({name:e="",theme:t={},params:n,set:o,defaults:i}){var r,s,a,l;const{preset:c,options:u}=t;let d,p,f,h;if(Sm(c)){const{primitive:t,semantic:n}=c,m=n||{},{colorScheme:g}=m,v=Hm(m,["colorScheme"]),y=g||{},{dark:b}=y,_=Hm(y,["dark"]),w=Sm(t)?this._toVariables({primitive:t},u):{},S=Sm(v)?this._toVariables({semantic:v},u):{},x=Sm(_)?this._toVariables({light:_},u):{},k=Sm(b)?this._toVariables({dark:b},u):{},[C,A]=[null!=(r=w.declarations)?r:"",w.tokens],[E,O]=[null!=(s=S.declarations)?s:"",S.tokens||[]],[L,T]=[null!=(a=x.declarations)?a:"",x.tokens||[]],[I,N]=[null!=(l=k.declarations)?l:"",k.tokens||[]];d=this.transformCSS(e,C,"light","variable",u,o,i),p=A;f=`${this.transformCSS(e,`${E}${L}color-scheme:light`,"light","variable",u,o,i)}${this.transformCSS(e,`${I}color-scheme:dark`,"dark","variable",u,o,i)}`,h=[...new Set([...O,...T,...N])]}return{primitive:{css:d,tokens:p},semantic:{css:f,tokens:h}}},getPreset({name:e="",preset:t={},options:n,params:o,set:i,defaults:r,selector:s}){var a,l,c;const u=e.replace("-directive",""),d=t,{colorScheme:p}=d,f=Hm(d,["colorScheme"]),h=p||{},{dark:m}=h,g=Hm(h,["dark"]),v=Sm(f)?this._toVariables({[u]:f},n):{},y=Sm(g)?this._toVariables({[u]:g},n):{},b=Sm(m)?this._toVariables({[u]:m},n):{},[_,w]=[null!=(a=v.declarations)?a:"",v.tokens||[]],[S,x]=[null!=(l=y.declarations)?l:"",y.tokens||[]],[k,C]=[null!=(c=b.declarations)?c:"",b.tokens||[]],A=[...new Set([...w,...x,...C])];return{css:`${this.transformCSS(u,`${_}${S}`,"light","variable",n,i,r,s)}${this.transformCSS(u,k,"dark","variable",n,i,r,s)}`,tokens:A}},getPresetC({name:e="",theme:t={},params:n,set:o,defaults:i}){var r;const{preset:s,options:a}=t,l=null==(r=null==s?void 0:s.components)?void 0:r[e];return this.getPreset({name:e,preset:l,options:a,params:n,set:o,defaults:i})},getPresetD({name:e="",theme:t={},params:n,set:o,defaults:i}){var r;const s=e.replace("-directive",""),{preset:a,options:l}=t,c=null==(r=null==a?void 0:a.directives)?void 0:r[s];return this.getPreset({name:s,preset:c,options:l,params:n,set:o,defaults:i})},getColorSchemeOption(e,t){var n;return this.regex.resolve(null!=(n=e.darkModeSelector)?n:t.options.darkModeSelector)},getLayerOrder(e,t={},n,o){const{cssLayer:i}=t;if(i){return`@layer ${km(i.order||"primeui",n)}`}return""},getCommonStyleSheet({name:e="",theme:t={},params:n,props:o={},set:i,defaults:r}){const s=this.getCommon({name:e,theme:t,params:n,set:i,defaults:r}),a=Object.entries(o).reduce(((e,[t,n])=>e.push(`${t}="${n}"`)&&e),[]).join(" ");return Object.entries(s||{}).reduce(((e,[t,n])=>{if(null==n?void 0:n.css){const o=Nm(null==n?void 0:n.css),i=`${t}-variables`;e.push(``)}return e}),[]).join("")},getStyleSheet({name:e="",theme:t={},params:n,props:o={},set:i,defaults:r}){var s;const a={name:e,theme:t,params:n,set:i,defaults:r},l=null==(s=e.includes("-directive")?this.getPresetD(a):this.getPresetC(a))?void 0:s.css,c=Object.entries(o).reduce(((e,[t,n])=>e.push(`${t}="${n}"`)&&e),[]).join(" ");return l?``:""},createTokens(e={},t,n="",o="",i={}){return Object.entries(e).forEach((([e,r])=>{const s=Tm(e,t.variable.excludedKeyRegex)?n:n?`${n}.${Dm(e)}`:Dm(e),a=o?`${o}.${e}`:e;xm(r)?this.createTokens(r,t,s,a,i):(i[s]||(i[s]={paths:[],computed(e,t={}){if(e){const n=this.paths.find((t=>t.scheme===e))||this.paths.find((e=>"none"===e.scheme));return null==n?void 0:n.computed(e,t.binding)}return this.paths.map((e=>e.computed(e.scheme,t[e.scheme])))}}),i[s].paths.push({path:a,value:r,scheme:a.includes("colorScheme.light")?"light":a.includes("colorScheme.dark")?"dark":"none",computed(e,t={}){const n=/{([^}]*)}/g;let o=r;if(t.name=this.path,t.binding||(t.binding={}),Tm(r,n)){const s=r.trim().replaceAll(n,(n=>{var o,r;const s=n.replace(/{|}/g,"");return null==(r=null==(o=i[s])?void 0:o.computed(e,t))?void 0:r.value})),a=/(\d+\w*\s+[\+\-\*\/]\s+\d+\w*)/g,l=/var\([^)]+\)/g;o=Tm(s.replace(l,"0"),a)?`calc(${s})`:s}return _m(t.binding)&&delete t.binding,{colorScheme:e,path:this.path,paths:t,value:o.includes("undefined")?void 0:o}}}))})),i},getTokenValue(e,t,n){var o;const i=t.split(".").filter((e=>!Tm(e.toLowerCase(),n.variable.excludedKeyRegex))).join(".");const r=t.includes("colorScheme.light")?"light":t.includes("colorScheme.dark")?"dark":void 0,s=[null==(o=e[i])?void 0:o.computed(r)].flat().filter((e=>e));return 1===s.length?s[0].value:s.reduce(((e={},t)=>{const n=t,{colorScheme:o}=n,i=Hm(n,["colorScheme"]);return e[o]=i,e}),void 0)},transformCSS(e,t,n,o,i={},r,s,a){if(Sm(t)){const{cssLayer:l}=i;if("style"!==o){const e=this.getColorSchemeOption(i,s),o=a?Jm(a,t):t;t="dark"===n?e.reduce(((e,{selector:t})=>(Sm(t)&&(e+=t.includes("[CSS]")?t.replace("[CSS]",o):Jm(t,o)),e)),""):Jm(null!=a?a:":root",t)}if(l){const n={name:"primeui",order:"primeui"};xm(l)&&(n.name=km(l.name,{name:e,type:o})),Sm(n.name)&&(t=Jm(`@layer ${n.name}`,t),null==r||r.layerNames(n.name))}return t}return""}},og={defaults:{variable:{prefix:"p",selector:":root",excludedKeyRegex:/^(primitive|semantic|components|directives|variables|colorscheme|light|dark|common|root|states)$/gi},options:{prefix:"p",darkModeSelector:"system",cssLayer:!1}},_theme:void 0,_layerNames:new Set,_loadedStyleNames:new Set,_loadingStyles:new Set,_tokens:{},update(e={}){const{theme:t}=e;t&&(this._theme=Vm(zm({},t),{options:zm(zm({},this.defaults.options),t.options)}),this._tokens=ng.createTokens(this.preset,this.defaults),this.clearLoadedStyleNames())},get theme(){return this._theme},get preset(){var e;return(null==(e=this.theme)?void 0:e.preset)||{}},get options(){var e;return(null==(e=this.theme)?void 0:e.options)||{}},get tokens(){return this._tokens},getTheme(){return this.theme},setTheme(e){this.update({theme:e}),Wm.emit("theme:change",e)},getPreset(){return this.preset},setPreset(e){this._theme=Vm(zm({},this.theme),{preset:e}),this._tokens=ng.createTokens(e,this.defaults),this.clearLoadedStyleNames(),Wm.emit("preset:change",e),Wm.emit("theme:change",this.theme)},getOptions(){return this.options},setOptions(e){this._theme=Vm(zm({},this.theme),{options:e}),this.clearLoadedStyleNames(),Wm.emit("options:change",e),Wm.emit("theme:change",this.theme)},getLayerNames(){return[...this._layerNames]},setLayerNames(e){this._layerNames.add(e)},getLoadedStyleNames(){return this._loadedStyleNames},isStyleNameLoaded(e){return this._loadedStyleNames.has(e)},setLoadedStyleName(e){this._loadedStyleNames.add(e)},deleteLoadedStyleName(e){this._loadedStyleNames.delete(e)},clearLoadedStyleNames(){this._loadedStyleNames.clear()},getTokenValue(e){return ng.getTokenValue(this.tokens,e,this.defaults)},getCommon(e="",t){return ng.getCommon({name:e,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},getComponent(e="",t){const n={name:e,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return ng.getPresetC(n)},getDirective(e="",t){const n={name:e,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return ng.getPresetD(n)},getCustomPreset(e="",t,n,o){const i={name:e,preset:t,options:this.options,selector:n,params:o,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return ng.getPreset(i)},getLayerOrderCSS(e=""){return ng.getLayerOrder(e,this.options,{names:this.getLayerNames()},this.defaults)},transformCSS(e="",t,n="style",o){return ng.transformCSS(e,t,o,n,this.options,{layerNames:this.setLayerNames.bind(this)},this.defaults)},getCommonStyleSheet(e="",t,n={}){return ng.getCommonStyleSheet({name:e,theme:this.theme,params:t,props:n,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},getStyleSheet(e,t,n={}){return ng.getStyleSheet({name:e,theme:this.theme,params:t,props:n,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},onStyleMounted(e){this._loadingStyles.add(e)},onStyleUpdated(e){this._loadingStyles.add(e)},onStyleLoaded(e,{name:t}){this._loadingStyles.size&&(this._loadingStyles.delete(t),Wm.emit(`theme:${t}:load`,e),!this._loadingStyles.size&&Wm.emit("theme:load"))}};function ig(e,t){return!!e&&(e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className))}function rg(e,t){if(e&&t){const n=t=>{ig(e,t)||(e.classList?e.classList.add(t):e.className+=" "+t)};[t].flat().filter(Boolean).forEach((e=>e.split(" ").forEach(n)))}}function sg(e,t){if(e&&t){const n=t=>{e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")};[t].flat().filter(Boolean).forEach((e=>e.split(" ").forEach(n)))}}function ag(e,t){if(e instanceof HTMLElement){return e.offsetWidth}return 0}function lg(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName}function cg(e,t={}){if(lg(e)){const n=(t,o)=>{var i,r;const s=(null==(i=null==e?void 0:e.$attrs)?void 0:i[t])?[null==(r=null==e?void 0:e.$attrs)?void 0:r[t]]:[];return[o].flat().reduce(((e,o)=>{if(null!=o){const i=typeof o;if("string"===i||"number"===i)e.push(o);else if("object"===i){const i=Array.isArray(o)?n(t,o):Object.entries(o).map((([e,n])=>"style"!==t||!n&&0!==n?n?e:void 0:`${e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${n}`));e=i.length?e.concat(i.filter((e=>!!e))):e}}return e}),s)};Object.entries(t).forEach((([t,o])=>{if(null!=o){const i=t.match(/^on(.+)/);i?e.addEventListener(i[1].toLowerCase(),o):"p-bind"===t?cg(e,o):(o="class"===t?[...new Set(n("class",o))].join(" ").trim():"style"===t?n("style",o).join(";").trim():o,(e.$attrs=e.$attrs||{})&&(e.$attrs[t]=o),e.setAttribute(t,o))}}))}}function ug(e,t={},...n){if(e){const o=document.createElement(e);return cg(o,t),o.append(...n),o}}function dg(e,t){return lg(e)?e.matches(t)?e:e.querySelector(t):null}function pg(e,t){if(lg(e)){const n=e.getAttribute(t);return isNaN(n)?"true"===n||"false"===n?"true"===n:n:+n}}function fg(e){if(e){let t=e.offsetHeight,n=getComputedStyle(e);return t-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)+parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),t}return 0}function hg(e){if(e){let t=e.parentNode;return t&&t instanceof ShadowRoot&&t.host&&(t=t.host),t}return null}function mg(e,t){if(e){return e.offsetHeight}return 0}function gg(e,t=[]){const n=hg(e);return null===n?t:gg(n,t.concat([n]))}function vg(e){let t=[];if(e){let n=gg(e);const o=/(auto|scroll)/,i=e=>{try{let t=window.getComputedStyle(e,null);return o.test(t.getPropertyValue("overflow"))||o.test(t.getPropertyValue("overflowX"))||o.test(t.getPropertyValue("overflowY"))}catch(t){return!1}};for(let e of n){let n=1===e.nodeType&&e.dataset.scrollselectors;if(n){let o=n.split(",");for(let n of o){let o=dg(e,n);o&&i(o)&&t.push(o)}}9!==e.nodeType&&i(e)&&t.push(e)}}return t}function yg(e){return!(null==e||!e.nodeName||!hg(e))}function bg(e){if(e){let t=e.offsetWidth,n=getComputedStyle(e);return t-=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight)+parseFloat(n.borderLeftWidth)+parseFloat(n.borderRightWidth),t}return 0}var _g={_loadedStyleNames:new Set,getLoadedStyleNames:function(){return this._loadedStyleNames},isStyleNameLoaded:function(e){return this._loadedStyleNames.has(e)},setLoadedStyleName:function(e){this._loadedStyleNames.add(e)},deleteLoadedStyleName:function(e){this._loadedStyleNames.delete(e)},clearLoadedStyleNames:function(){this._loadedStyleNames.clear()}};function wg(e){return(wg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Sg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function xg(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},n=pn(!1),o=pn(e),i=pn(null),r="undefined"!=typeof window&&window.document&&window.document.createElement?window.document:void 0,s=t.document,a=void 0===s?r:s,l=t.immediate,c=void 0===l||l,u=t.manual,d=void 0!==u&&u,p=t.name,f=void 0===p?"style_".concat(++Cg):p,h=t.id,m=void 0===h?void 0:h,g=t.media,v=void 0===g?void 0:g,y=t.nonce,b=void 0===y?void 0:y,_=t.first,w=void 0!==_&&_,S=t.onMounted,x=void 0===S?void 0:S,k=t.onUpdated,C=void 0===k?void 0:k,A=t.onLoad,E=void 0===A?void 0:A,O=t.props,L=void 0===O?{}:O,T=function(){},I=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(a){var s=xg(xg({},L),r),l=s.name||f,c=s.id||m,u=s.nonce||b;i.value=a.querySelector('style[data-primevue-style-id="'.concat(l,'"]'))||a.getElementById(c)||a.createElement("style"),i.value.isConnected||(o.value=t||e,cg(i.value,{type:"text/css",id:c,media:v,nonce:u}),w?a.head.prepend(i.value):a.head.appendChild(i.value),function(e,t="",n){lg(e)&&null!=n&&e.setAttribute(t,n)}(i.value,"data-primevue-style-id",l),cg(i.value,s),i.value.onload=function(e){return null==E?void 0:E(e,{name:l})},null==x||x(l)),n.value||(T=bi(o,(function(e){i.value.textContent=e,null==C||C(l)}),{immediate:!0}),n.value=!0)}};return c&&!d&&function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];ar()?oo(e):t?e():Pn(e)}(I),{id:m,name:f,el:i,css:o,unload:function(){a&&n.value&&(T(),yg(i.value)&&a.head.removeChild(i.value),n.value=!1)},load:I,isLoaded:Qt(n)}}function Eg(e){return(Eg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Og(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,i,r,s,a=[],l=!0,c=!1;try{if(r=(n=n.call(e)).next,0===t);else for(;!(l=(o=r.call(n)).done)&&(a.push(o.value),a.length!==t);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Lg(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lg(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n1&&void 0!==arguments[1]?arguments[1]:{},n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){return e})(km(e,{dt:qm}));return n?Ag(Nm(n),Ig({name:this.name},t)):{}},loadCSS:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.load(this.css,e)},loadTheme:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.load(this.theme,t,(function(n){return og.transformCSS(t.name||e.name,n)}))},getCommonTheme:function(e){return og.getCommon(this.name,e)},getComponentTheme:function(e){return og.getComponent(this.name,e)},getDirectiveTheme:function(e){return og.getDirective(this.name,e)},getPresetTheme:function(e,t,n){return og.getCustomPreset(this.name,e,t,n)},getLayerOrderThemeCSS:function(){return og.getLayerOrderCSS(this.name)},getStyleSheet:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.css){var n=km(this.css,{dt:qm}),o=Nm("".concat(n).concat(e)),i=Object.entries(t).reduce((function(e,t){var n=Og(t,2),o=n[0],i=n[1];return e.push("".concat(o,'="').concat(i,'"'))&&e}),[]).join(" ");return'")}return""},getCommonThemeStyleSheet:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return og.getCommonStyleSheet(this.name,e,t)},getThemeStyleSheet:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[og.getStyleSheet(this.name,e,t)];if(this.theme){var o="base"===this.name?"global-style":"".concat(this.name,"-style"),i=km(this.theme,{dt:qm}),r=Nm(og.transformCSS(o,i)),s=Object.entries(t).reduce((function(e,t){var n=Og(t,2),o=n[0],i=n[1];return e.push("".concat(o,'="').concat(i,'"'))&&e}),[]).join(" ");n.push('"))}return n.join("")},extend:function(e){return Ig(Ig({},this),{},{css:void 0,theme:void 0},e)}},Dg={};var jg=function(){let e=[];const t=(t,n,o=0)=>[...e].reverse().find((e=>!0))||{key:t,value:o},n=e=>e&&parseInt(e.style.zIndex,10)||0;return{get:n,set:(n,o,i)=>{o&&(o.style.zIndex=String(((n,o,i=999)=>{const r=t(n,o,i),s=r.value+(r.key===n?0:i)+1;return e.push({key:n,value:s}),s})(n,!0,i)))},clear:t=>{var o;t&&(o=n(t),e=e.filter((e=>e.value!==o)),t.style.zIndex="")},getCurrent:e=>(e=>t(e).value)(e)}}();function Mg(e){return(Mg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Rg(e,t,n){return t&&function(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:function(){};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.element=t,this.listener=n}),[{key:"bindScrollListener",value:function(){this.scrollableParents=vg(this.element);for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:"pv_id_")}var Fg=Pg.extend({name:"common"});function Ug(e){return(Ug="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function zg(e){return Zg(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Wg(e)||Hg()}function Vg(e,t){return Zg(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,i,r,s,a=[],l=!0,c=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(o=r.call(n)).done)&&(a.push(o.value),a.length!==t);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(e,t)||Wg(e,t)||Hg()}function Hg(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Wg(e,t){if(e){if("string"==typeof e)return Yg(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yg(e,t):void 0}}function Yg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n1?t-1:0),o=1;o0&&void 0!==arguments[0]?arguments[0]:function(){};_g.clearLoadedStyleNames(),Wm.on("theme:change",e)},_getHostInstance:function(e){return e?this.$options.hostName?e.$.type.name===this.$options.hostName?e:this._getHostInstance(e.$parentInstance):e.$parentInstance:void 0},_getPropValue:function(e){var t;return this[e]||(null===(t=this._getHostInstance(this))||void 0===t?void 0:t[e])},_getOptionValue:function(e){return Em(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})},_getPTValue:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=/./g.test(n)&&!!o[n.split(".")[0]],s=this._getPropValue("ptOptions")||(null===(e=this.$primevueConfig)||void 0===e?void 0:e.ptOptions)||{},a=s.mergeSections,l=void 0===a||a,c=s.mergeProps,u=void 0!==c&&c,d=i?r?this._useGlobalPT(this._getPTClassValue,n,o):this._useDefaultPT(this._getPTClassValue,n,o):void 0,p=r?void 0:this._getPTSelf(t,this._getPTClassValue,n,Xg(Xg({},o),{},{global:d||{}})),f=this._getPTDatasets(n);return l||!l&&p?u?this._mergeProps(u,d,p,f):Xg(Xg(Xg({},d),p),f):Xg(Xg({},p),f)},_getPTSelf:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length,n=new Array(t>1?t-1:0),o=1;o0&&void 0!==arguments[0]?arguments[0]:"",o="data-pc-",i="root"===n&&Sm(null===(e=this.pt)||void 0===e?void 0:e["data-pc-section"]);return"transition"!==n&&Xg(Xg({},"root"===n&&Xg(Qg({},"".concat(o,"name"),Am(i?null===(t=this.pt)||void 0===t?void 0:t["data-pc-section"]:this.$.type.name)),i&&Qg({},"".concat(o,"extend"),Am(this.$.type.name)))),{},Qg({},"".concat(o,"section"),Am(n)))},_getPTClassValue:function(){var e=this._getOptionValue.apply(this,arguments);return Cm(e)||Om(e)?{class:e}:e},_getPT:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=arguments.length>2?arguments[2]:void 0,i=function(e){var i,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=o?o(e):e,a=Am(n),l=Am(t.$name);return null!==(i=r?a!==l?null==s?void 0:s[a]:void 0:null==s?void 0:s[a])&&void 0!==i?i:s};return null!=e&&e.hasOwnProperty("_usept")?{_usept:e._usept,originalValue:i(e.originalValue),value:i(e.value)}:i(e,!0)},_usePT:function(e,t,n,o){var i=function(e){return t(e,n,o)};if(null!=e&&e.hasOwnProperty("_usept")){var r,s=e._usept||(null===(r=this.$primevueConfig)||void 0===r?void 0:r.ptOptions)||{},a=s.mergeSections,l=void 0===a||a,c=s.mergeProps,u=void 0!==c&&c,d=i(e.originalValue),p=i(e.value);if(void 0===d&&void 0===p)return;return Cm(p)?p:Cm(d)?d:l||!l&&p?u?this._mergeProps(u,d,p):Xg(Xg({},d),p):p}return i(e)},_useGlobalPT:function(e,t,n){return this._usePT(this.globalPT,e,t,n)},_useDefaultPT:function(e,t,n){return this._usePT(this.defaultPT,e,t,n)},ptm:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._getPTValue(this.pt,e,Xg(Xg({},this.$params),t))},ptmi:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return nr(this.$_attrsWithoutPT,this.ptm(e,t))},ptmo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._getPTValue(e,t,Xg({instance:this},n),!1)},cx:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.isUnstyled?void 0:this._getOptionValue(this.$style.classes,e,Xg(Xg({},this.$params),t))},sx:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!(arguments.length>1&&void 0!==arguments[1])||arguments[1]){var n=this._getOptionValue(this.$style.inlineStyles,e,Xg(Xg({},this.$params),t));return[this._getOptionValue(Fg.inlineStyles,e,Xg(Xg({},this.$params),t)),n]}}},computed:{globalPT:function(){var e,t=this;return this._getPT(null===(e=this.$primevueConfig)||void 0===e?void 0:e.pt,void 0,(function(e){return km(e,{instance:t})}))},defaultPT:function(){var e,t=this;return this._getPT(null===(e=this.$primevueConfig)||void 0===e?void 0:e.pt,void 0,(function(e){return t._getOptionValue(e,t.$name,Xg({},t.$params))||km(e,Xg({},t.$params))}))},isUnstyled:function(){var e;return void 0!==this.unstyled?this.unstyled:null===(e=this.$primevueConfig)||void 0===e?void 0:e.unstyled},$theme:function(){var e;return null===(e=this.$primevueConfig)||void 0===e?void 0:e.theme},$style:function(){return Xg(Xg({classes:void 0,inlineStyles:void 0,load:function(){},loadCSS:function(){},loadTheme:function(){}},(this._getHostInstance(this)||{}).$style),this.$options.style)},$styleOptions:function(){var e;return{nonce:null===(e=this.$primevueConfig)||void 0===e||null===(e=e.csp)||void 0===e?void 0:e.nonce}},$primevueConfig:function(){var e;return null===(e=this.$primevue)||void 0===e?void 0:e.config},$name:function(){return this.$options.hostName||this.$.type.name},$params:function(){var e=this._getHostInstance(this)||this.$parent;return{instance:this,props:this.$props,state:this.$data,attrs:this.$attrs,parent:{instance:e,props:null==e?void 0:e.$props,state:null==e?void 0:e.$data,attrs:null==e?void 0:e.$attrs}}},$_attrsPT:function(){return Object.entries(this.$attrs||{}).filter((function(e){var t=Vg(e,1)[0];return null==t?void 0:t.startsWith("pt:")})).reduce((function(e,t){var n=Vg(t,2),o=n[0],i=n[1],r=zg(o.split(":")).slice(1);return null==r||r.reduce((function(e,t,n,o){return!e[t]&&(e[t]=n===o.length-1?i:{}),e[t]}),e),e}),{})},$_attrsWithoutPT:function(){return Object.entries(this.$attrs||{}).filter((function(e){var t=Vg(e,1)[0];return!(null!=t&&t.startsWith("pt:"))})).reduce((function(e,t){var n=Vg(t,2),o=n[0],i=n[1];return e[o]=i,e}),{})},$attrSelector:function(){return Bg("pc")}}},qg=Pg.extend({name:"baseicon",css:"\n.p-icon {\n display: inline-block;\n vertical-align: baseline;\n}\n\n.p-icon-spin {\n -webkit-animation: p-icon-spin 2s infinite linear;\n animation: p-icon-spin 2s infinite linear;\n}\n\n@-webkit-keyframes p-icon-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}\n\n@keyframes p-icon-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}\n"});function ev(e){return(ev="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function nv(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,o=Array(t);n0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=function(){var e=gv._getOptionValue.apply(gv,arguments);return Cm(e)||Om(e)?{class:e}:e},l=(null===(e=n.binding)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.ptOptions)||(null===(t=n.$primevueConfig)||void 0===t?void 0:t.ptOptions)||{},c=l.mergeSections,u=void 0===c||c,d=l.mergeProps,p=void 0!==d&&d,f=s?gv._useDefaultPT(n,n.defaultPT(),a,i,r):void 0,h=gv._usePT(n,gv._getPT(o,n.$name),a,i,hv(hv({},r),{},{global:f||{}})),m=gv._getPTDatasets(n,i);return u||!u&&h?p?gv._mergeProps(n,p,f,h,m):hv(hv(hv({},f),h),m):hv(hv({},h),m)},_getPTDatasets:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n="data-pc-";return hv(hv({},"root"===t&&mv({},"".concat(n,"name"),Am(e.$name))),{},mv({},"".concat(n,"section"),Am(t)))},_getPT:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,o=function(e){var o,i=n?n(e):e,r=Am(t);return null!==(o=null==i?void 0:i[r])&&void 0!==o?o:i};return null!=e&&e.hasOwnProperty("_usept")?{_usept:e._usept,originalValue:o(e.originalValue),value:o(e.value)}:o(e)},_usePT:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,r=function(e){return n(e,o,i)};if(null!=t&&t.hasOwnProperty("_usept")){var s,a=t._usept||(null===(s=e.$primevueConfig)||void 0===s?void 0:s.ptOptions)||{},l=a.mergeSections,c=void 0===l||l,u=a.mergeProps,d=void 0!==u&&u,p=r(t.originalValue),f=r(t.value);if(void 0===p&&void 0===f)return;return Cm(f)?f:Cm(p)?p:c||!c&&f?d?gv._mergeProps(e,d,p,f):hv(hv({},p),f):f}return r(t)},_useDefaultPT:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;return gv._usePT(e,t,n,o,i)},_loadStyles:function(e,t,n){var o,i=gv._getConfig(t,n),r={nonce:null==i||null===(o=i.csp)||void 0===o?void 0:o.nonce};gv._loadCoreStyles(e.$instance,r),gv._loadThemeStyles(e.$instance,r),gv._loadScopedThemeStyles(e.$instance,r),gv._themeChangeListener((function(){return gv._loadThemeStyles(e.$instance,r)}))},_loadCoreStyles:function(){var e,t,n,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;!_g.isStyleNameLoaded(null===(e=o.$style)||void 0===e?void 0:e.name)&&null!==(t=o.$style)&&void 0!==t&&t.name&&(Pg.loadCSS(i),o.isUnstyled()&&(null===(n=o.$style)||void 0===n||n.loadCSS(i)),_g.setLoadedStyleName(o.$style.name))},_loadThemeStyles:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(null==n||!n.isUnstyled()){if(!og.isStyleNameLoaded("common")){var i,r,s=(null===(i=n.$style)||void 0===i||null===(r=i.getCommonTheme)||void 0===r?void 0:r.call(i))||{},a=s.primitive,l=s.semantic;Pg.load(null==a?void 0:a.css,hv({name:"primitive-variables"},o)),Pg.load(null==l?void 0:l.css,hv({name:"semantic-variables"},o)),Pg.loadTheme(hv({name:"global-style"},o)),og.setLoadedStyleName("common")}if(!og.isStyleNameLoaded(null===(e=n.$style)||void 0===e?void 0:e.name)&&null!==(t=n.$style)&&void 0!==t&&t.name){var c,u,d,p,f=((null===(c=n.$style)||void 0===c||null===(u=c.getDirectiveTheme)||void 0===u?void 0:u.call(c))||{}).css;null===(d=n.$style)||void 0===d||d.load(f,hv({name:"".concat(n.$style.name,"-variables")},o)),null===(p=n.$style)||void 0===p||p.loadTheme(hv({name:"".concat(n.$style.name,"-style")},o)),og.setLoadedStyleName(n.$style.name)}if(!og.isStyleNameLoaded("layer-order")){var h,m,g=null===(h=n.$style)||void 0===h||null===(m=h.getLayerOrderThemeCSS)||void 0===m?void 0:m.call(h);Pg.load(g,hv({name:"layer-order",first:!0},o)),og.setLoadedStyleName("layer-order")}}},_loadScopedThemeStyles:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=e.preset();if(n&&e.$attrSelector){var o,i,r,s=((null===(o=e.$style)||void 0===o||null===(i=o.getPresetTheme)||void 0===i?void 0:i.call(o,n,"[".concat(e.$attrSelector,"]")))||{}).css,a=null===(r=e.$style)||void 0===r?void 0:r.load(s,hv({name:"".concat(e.$attrSelector,"-").concat(e.$style.name)},t));e.scopedStyleEl=a.el}},_themeChangeListener:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};_g.clearLoadedStyleNames(),Wm.on("theme:change",e)},_hook:function(e,t,n,o,i,r){var s,a,l,c="on".concat(Cm(l=t,!1)?l[0].toUpperCase()+l.slice(1):l),u=gv._getConfig(o,i),d=null==n?void 0:n.$instance,p=gv._usePT(d,gv._getPT(null==o||null===(s=o.value)||void 0===s?void 0:s.pt,e),gv._getOptionValue,"hooks.".concat(c)),f=gv._useDefaultPT(d,null==u||null===(a=u.pt)||void 0===a||null===(a=a.directives)||void 0===a?void 0:a[e],gv._getOptionValue,"hooks.".concat(c)),h={el:n,binding:o,vnode:i,prevVnode:r};null==p||p(d,h),null==f||f(d,h)},_mergeProps:function(){for(var e=arguments.length>1?arguments[1]:void 0,t=arguments.length,n=new Array(t>2?t-2:0),o=2;o1&&void 0!==arguments[1]?arguments[1]:{},n=function(n,o,i,r,s){var a,l,c;o._$instances=o._$instances||{};var u=gv._getConfig(i,r),d=o._$instances[e]||{},p=_m(d)?hv(hv({},t),null==t?void 0:t.methods):{};o._$instances[e]=hv(hv({},d),{},{$name:e,$host:o,$binding:i,$modifiers:null==i?void 0:i.modifiers,$value:null==i?void 0:i.value,$el:d.$el||o||void 0,$style:hv({classes:void 0,inlineStyles:void 0,load:function(){},loadCSS:function(){},loadTheme:function(){}},null==t?void 0:t.style),$primevueConfig:u,$attrSelector:o.$attrSelector,defaultPT:function(){return gv._getPT(null==u?void 0:u.pt,void 0,(function(t){var n;return null==t||null===(n=t.directives)||void 0===n?void 0:n[e]}))},isUnstyled:function(){var e,t;return void 0!==(null===(e=o.$instance)||void 0===e||null===(e=e.$binding)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.unstyled)?null===(t=o.$instance)||void 0===t||null===(t=t.$binding)||void 0===t||null===(t=t.value)||void 0===t?void 0:t.unstyled:null==u?void 0:u.unstyled},theme:function(){var e;return null===(e=o.$instance)||void 0===e||null===(e=e.$primevueConfig)||void 0===e?void 0:e.theme},preset:function(){var e;return null===(e=o.$instance)||void 0===e||null===(e=e.$binding)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.dt},ptm:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return gv._getPTValue(o.$instance,null===(e=o.$instance)||void 0===e||null===(e=e.$binding)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.pt,t,hv({},n))},ptmo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return gv._getPTValue(o.$instance,e,t,n,!1)},cx:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return null!==(e=o.$instance)&&void 0!==e&&e.isUnstyled()?void 0:gv._getOptionValue(null===(t=o.$instance)||void 0===t||null===(t=t.$style)||void 0===t?void 0:t.classes,n,hv({},i))},sx:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?gv._getOptionValue(null===(e=o.$instance)||void 0===e||null===(e=e.$style)||void 0===e?void 0:e.inlineStyles,t,hv({},n)):void 0}},p),o.$instance=o._$instances[e],null===(a=(l=o.$instance)[n])||void 0===a||a.call(l,o,i,r,s),o["$".concat(e)]=o.$instance,gv._hook(e,n,o,i,r,s),o.$pd||(o.$pd={}),o.$pd[e]=hv(hv({},null===(c=o.$pd)||void 0===c?void 0:c[e]),{},{name:e,instance:o.$instance})};return{created:function(e,t,o,i){n("created",e,t,o,i)},beforeMount:function(e,t,o,i){e.$attrSelector=Bg("pd"),gv._loadStyles(e,t,o),n("beforeMount",e,t,o,i),function(e){var t,n,o,i,r,s=null===(t=e.$instance)||void 0===t?void 0:t.watch;null==s||null===(n=s.config)||void 0===n||n.call(e.$instance,null===(o=e.$instance)||void 0===o?void 0:o.$primevueConfig),cv.on("config:change",(function(t){var n,o=t.newValue,i=t.oldValue;return null==s||null===(n=s.config)||void 0===n?void 0:n.call(e.$instance,o,i)})),null==s||null===(i=s["config.ripple"])||void 0===i||i.call(e.$instance,null===(r=e.$instance)||void 0===r||null===(r=r.$primevueConfig)||void 0===r?void 0:r.ripple),cv.on("config:ripple:change",(function(t){var n,o=t.newValue,i=t.oldValue;return null==s||null===(n=s["config.ripple"])||void 0===n?void 0:n.call(e.$instance,o,i)}))}(e)},mounted:function(e,t,o,i){gv._loadStyles(e,t,o),n("mounted",e,t,o,i)},beforeUpdate:function(e,t,o,i){n("beforeUpdate",e,t,o,i)},updated:function(e,t,o,i){gv._loadStyles(e,t,o),n("updated",e,t,o,i)},beforeUnmount:function(e,t,o,i){n("beforeUnmount",e,t,o,i)},unmounted:function(e,t,o,i){var r;null===(r=e.$instance)||void 0===r||null===(r=r.scopedStyleEl)||void 0===r||null===(r=r.value)||void 0===r||r.remove(),n("unmounted",e,t,o,i)}}},extend:function(){var e=dv(gv._getMeta.apply(gv,arguments),2),t=e[0],n=e[1];return hv({extend:function(){var e=dv(gv._getMeta.apply(gv,arguments),2),t=e[0],o=e[1];return gv.extend(t,hv(hv(hv({},n),null==n?void 0:n.methods),o))}},gv._extend(t,n))}},vv=Pg.extend({name:"ripple-directive",theme:function(e){var t=e.dt;return"\n.p-ink {\n display: block;\n position: absolute;\n background: ".concat(t("ripple.background"),";\n border-radius: 100%;\n transform: scale(0);\n pointer-events: none;\n}\n\n.p-ink-active {\n animation: ripple 0.4s linear;\n}\n\n@keyframes ripple {\n 100% {\n opacity: 0;\n transform: scale(2.5);\n }\n}\n")},classes:{root:"p-ink"}});function yv(e){return(yv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function bv(e){return function(e){if(Array.isArray(e))return _v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return _v(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_v(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);ne.length)&&(t=e.length);for(var n=0,o=Array(t);n0||navigator.msMaxTouchPoints>0||o.hide(e),window.removeEventListener("resize",t)})),n.addEventListener("mouseleave",(function t(){o.hide(e),n.removeEventListener("mouseleave",t)})),this.bindScrollListener(e),jg.set("tooltip",n,e.$_ptooltipZIndex)}},show:function(e,t,n){var o=this;void 0!==n?this.timer=setTimeout((function(){return o.tooltipActions(e,t)}),n):this.tooltipActions(e,t)},tooltipRemoval:function(e){this.remove(e),this.unbindScrollListener(e)},hide:function(e,t){var n=this;clearTimeout(this.timer),void 0!==t?setTimeout((function(){return n.tooltipRemoval(e)}),t):this.tooltipRemoval(e)},getTooltipElement:function(e){return document.getElementById(e.$_ptooltipId)},create:function(e){var t=e.$_ptooltipModifiers,n=ug("div",{class:!this.isUnstyled()&&this.cx("arrow"),"p-bind":this.ptm("arrow",{context:t})}),o=ug("div",{class:!this.isUnstyled()&&this.cx("text"),"p-bind":this.ptm("text",{context:t})});e.$_ptooltipEscape?(o.innerHTML="",o.appendChild(document.createTextNode(e.$_ptooltipValue))):o.innerHTML=e.$_ptooltipValue;var i=ug("div",Iv(Iv({id:e.$_ptooltipIdAttr,role:"tooltip",style:{display:"inline-block",width:e.$_ptooltipFitContent?"fit-content":void 0,pointerEvents:!this.isUnstyled()&&e.$_ptooltipAutoHide&&"none"},class:[!this.isUnstyled()&&this.cx("root"),e.$_ptooltipClass]},this.$attrSelector,""),"p-bind",this.ptm("root",{context:t})),n,o);return document.body.appendChild(i),e.$_ptooltipId=i.id,this.$el=i,i},remove:function(e){if(e){var t=this.getTooltipElement(e);t&&t.parentElement&&(jg.clear(t),document.body.removeChild(t)),e.$_ptooltipId=null}},align:function(e){var t=e.$_ptooltipModifiers;t.top?(this.alignTop(e),this.isOutOfBounds(e)&&(this.alignBottom(e),this.isOutOfBounds(e)&&this.alignTop(e))):t.left?(this.alignLeft(e),this.isOutOfBounds(e)&&(this.alignRight(e),this.isOutOfBounds(e)&&(this.alignTop(e),this.isOutOfBounds(e)&&(this.alignBottom(e),this.isOutOfBounds(e)&&this.alignLeft(e))))):t.bottom?(this.alignBottom(e),this.isOutOfBounds(e)&&(this.alignTop(e),this.isOutOfBounds(e)&&this.alignBottom(e))):(this.alignRight(e),this.isOutOfBounds(e)&&(this.alignLeft(e),this.isOutOfBounds(e)&&(this.alignTop(e),this.isOutOfBounds(e)&&(this.alignBottom(e),this.isOutOfBounds(e)&&this.alignRight(e)))))},getHostOffset:function(e){var t=e.getBoundingClientRect();return{left:t.left+function(){let e=document.documentElement;return(window.pageXOffset||e.scrollLeft)-(e.clientLeft||0)}(),top:t.top+function(){let e=document.documentElement;return(window.pageYOffset||e.scrollTop)-(e.clientTop||0)}()}},alignRight:function(e){this.preAlign(e,"right");var t=this.getTooltipElement(e),n=this.getHostOffset(e),o=n.left+ag(e),i=n.top+(mg(e)-mg(t))/2;t.style.left=o+"px",t.style.top=i+"px"},alignLeft:function(e){this.preAlign(e,"left");var t=this.getTooltipElement(e),n=this.getHostOffset(e),o=n.left-ag(t),i=n.top+(mg(e)-mg(t))/2;t.style.left=o+"px",t.style.top=i+"px"},alignTop:function(e){this.preAlign(e,"top");var t=this.getTooltipElement(e),n=this.getHostOffset(e),o=n.left+(ag(e)-ag(t))/2,i=n.top-mg(t);t.style.left=o+"px",t.style.top=i+"px"},alignBottom:function(e){this.preAlign(e,"bottom");var t=this.getTooltipElement(e),n=this.getHostOffset(e),o=n.left+(ag(e)-ag(t))/2,i=n.top+mg(e);t.style.left=o+"px",t.style.top=i+"px"},preAlign:function(e,t){var n=this.getTooltipElement(e);n.style.left="-999px",n.style.top="-999px",sg(n,"p-tooltip-".concat(n.$_ptooltipPosition)),!this.isUnstyled()&&rg(n,"p-tooltip-".concat(t)),n.$_ptooltipPosition=t,n.setAttribute("data-p-position",t);var o=dg(n,'[data-pc-section="arrow"]');o.style.top="bottom"===t?"0":"right"===t||"left"===t||"right"!==t&&"left"!==t&&"top"!==t&&"bottom"!==t?"50%":null,o.style.bottom="top"===t?"0":null,o.style.left="right"===t||"right"!==t&&"left"!==t&&"top"!==t&&"bottom"!==t?"0":"top"===t||"bottom"===t?"50%":null,o.style.right="left"===t?"0":null},isOutOfBounds:function(e){var t=this.getTooltipElement(e),n=t.getBoundingClientRect(),o=n.top,i=n.left,r=ag(t),s=mg(t),a=function(){let e=window,t=document,n=t.documentElement,o=t.getElementsByTagName("body")[0];return{width:e.innerWidth||n.clientWidth||o.clientWidth,height:e.innerHeight||n.clientHeight||o.clientHeight}}();return i+r>a.width||i<0||o<0||o+s>a.height},getTarget:function(e){return ig(e,"p-inputwrapper")?dg(e,"input"):e},getModifiers:function(e){return e.modifiers&&Object.keys(e.modifiers).length?e.modifiers:e.arg&&"object"===Nv(e.arg)?Object.entries(e.arg).reduce((function(e,t){var n=Lv(t,2),o=n[0],i=n[1];return"event"!==o&&"position"!==o||(e[i]=!0),e}),{}):{}}}}),Dv={name:"Card",extends:{name:"BaseCard",extends:Jg,style:Pg.extend({name:"card",theme:function(e){var t=e.dt;return"\n.p-card {\n background: ".concat(t("card.background"),";\n color: ").concat(t("card.color"),";\n box-shadow: ").concat(t("card.shadow"),";\n border-radius: ").concat(t("card.border.radius"),";\n display: flex;\n flex-direction: column;\n}\n\n.p-card-caption {\n display: flex;\n flex-direction: column;\n gap: ").concat(t("card.caption.gap"),";\n}\n\n.p-card-body {\n padding: ").concat(t("card.body.padding"),";\n display: flex;\n flex-direction: column;\n gap: ").concat(t("card.body.gap"),";\n}\n\n.p-card-title {\n font-size: ").concat(t("card.title.font.size"),";\n font-weight: ").concat(t("card.title.font.weight"),";\n}\n\n.p-card-subtitle {\n color: ").concat(t("card.subtitle.color"),";\n}\n")},classes:{root:"p-card p-component",header:"p-card-header",body:"p-card-body",caption:"p-card-caption",title:"p-card-title",subtitle:"p-card-subtitle",content:"p-card-content",footer:"p-card-footer"}}),provide:function(){return{$pcCard:this,$parentInstance:this}}},inheritAttrs:!1};Dv.render=function(e,t,n,o,i,r){return $i(),Ui("div",nr({class:e.cx("root")},e.ptmi("root")),[e.$slots.header?($i(),Ui("div",nr({key:0,class:e.cx("header")},e.ptm("header")),[_o(e.$slots,"header")],16)):Ji("",!0),Zi("div",nr({class:e.cx("body")},e.ptm("body")),[e.$slots.title||e.$slots.subtitle?($i(),Ui("div",nr({key:0,class:e.cx("caption")},e.ptm("caption")),[e.$slots.title?($i(),Ui("div",nr({key:0,class:e.cx("title")},e.ptm("title")),[_o(e.$slots,"title")],16)):Ji("",!0),e.$slots.subtitle?($i(),Ui("div",nr({key:1,class:e.cx("subtitle")},e.ptm("subtitle")),[_o(e.$slots,"subtitle")],16)):Ji("",!0)],16)):Ji("",!0),Zi("div",nr({class:e.cx("content")},e.ptm("content")),[_o(e.$slots,"content")],16),e.$slots.footer?($i(),Ui("div",nr({key:1,class:e.cx("footer")},e.ptm("footer")),[_o(e.$slots,"footer")],16)):Ji("",!0)],16)],16)};const jv={class:"no-result-placeholder"},Mv={class:"no-result-placeholder-content"},Rv={key:0},$v={__name:"noResultsPlaceholder",props:{icon:{type:String,default:"",required:!1},iconSize:{type:String,default:"3rem",required:!1},title:{type:String,required:!0},message:{type:String,required:!1},buttonLabel:{type:String,default:"",required:!1}},emits:["action"],setup:e=>(t,n)=>($i(),Ui("div",jv,[Ki(hn(Dv),null,{content:Vn((()=>[Zi("div",Mv,[Zi("i",{class:Me(e.icon),style:Ie({"font-size":e.iconSize,"margin-bottom":".5rem"})},null,6),Zi("h3",null,Be(e.title),1),e.message?($i(),Ui("p",Rv,Be(e.message),1)):Ji("",!0),e.buttonLabel?($i(),zi(hn(Ev),{key:1,label:e.buttonLabel,onClick:n[0]||(n[0]=e=>t.$emit("action")),class:"p-button-text"},null,8,["label"])):Ji("",!0)])])),_:1})]))};var Gv=Pg.extend({name:"inputtext",theme:function(e){var t=e.dt;return"\n.p-inputtext {\n font-family: inherit;\n font-feature-settings: inherit;\n font-size: 1rem;\n color: ".concat(t("inputtext.color"),";\n background: ").concat(t("inputtext.background"),";\n padding: ").concat(t("inputtext.padding.y")," ").concat(t("inputtext.padding.x"),";\n border: 1px solid ").concat(t("inputtext.border.color"),";\n transition: background ").concat(t("inputtext.transition.duration"),", color ").concat(t("inputtext.transition.duration"),", border-color ").concat(t("inputtext.transition.duration"),", outline-color ").concat(t("inputtext.transition.duration"),", box-shadow ").concat(t("inputtext.transition.duration"),";\n appearance: none;\n border-radius: ").concat(t("inputtext.border.radius"),";\n outline-color: transparent;\n box-shadow: ").concat(t("inputtext.shadow"),";\n}\n\n.p-inputtext:enabled:hover {\n border-color: ").concat(t("inputtext.hover.border.color"),";\n}\n\n.p-inputtext:enabled:focus {\n border-color: ").concat(t("inputtext.focus.border.color"),";\n box-shadow: ").concat(t("inputtext.focus.ring.shadow"),";\n outline: ").concat(t("inputtext.focus.ring.width")," ").concat(t("inputtext.focus.ring.style")," ").concat(t("inputtext.focus.ring.color"),";\n outline-offset: ").concat(t("inputtext.focus.ring.offset"),";\n}\n\n.p-inputtext.p-invalid {\n border-color: ").concat(t("inputtext.invalid.border.color"),";\n}\n\n.p-inputtext.p-variant-filled {\n background: ").concat(t("inputtext.filled.background"),";\n}\n\n.p-inputtext.p-variant-filled:enabled:focus {\n background: ").concat(t("inputtext.filled.focus.background"),";\n}\n\n.p-inputtext:disabled {\n opacity: 1;\n background: ").concat(t("inputtext.disabled.background"),";\n color: ").concat(t("inputtext.disabled.color"),";\n}\n\n.p-inputtext::placeholder {\n color: ").concat(t("inputtext.placeholder.color"),";\n}\n\n.p-inputtext-sm {\n font-size: ").concat(t("inputtext.sm.font.size"),";\n padding: ").concat(t("inputtext.sm.padding.y")," ").concat(t("inputtext.sm.padding.x"),";\n}\n\n.p-inputtext-lg {\n font-size: ").concat(t("inputtext.lg.font.size"),";\n padding: ").concat(t("inputtext.lg.padding.y")," ").concat(t("inputtext.lg.padding.x"),";\n}\n\n.p-inputtext-fluid {\n width: 100%;\n}\n")},classes:{root:function(e){var t=e.instance,n=e.props;return["p-inputtext p-component",{"p-filled":t.filled,"p-inputtext-sm":"small"===n.size,"p-inputtext-lg":"large"===n.size,"p-invalid":n.invalid,"p-variant-filled":n.variant?"filled"===n.variant:"filled"===t.$primevue.config.inputStyle||"filled"===t.$primevue.config.inputVariant,"p-inputtext-fluid":t.hasFluid}]}}}),Bv={name:"InputText",extends:{name:"BaseInputText",extends:Jg,props:{modelValue:null,size:{type:String,default:null},invalid:{type:Boolean,default:!1},variant:{type:String,default:null},fluid:{type:Boolean,default:null}},style:Gv,provide:function(){return{$pcInputText:this,$parentInstance:this}}},inheritAttrs:!1,emits:["update:modelValue"],inject:{$pcFluid:{default:null}},methods:{getPTOptions:function(e){return("root"===e?this.ptmi:this.ptm)(e,{context:{filled:this.filled,disabled:this.$attrs.disabled||""===this.$attrs.disabled}})},onInput:function(e){this.$emit("update:modelValue",e.target.value)}},computed:{filled:function(){return null!=this.modelValue&&this.modelValue.toString().length>0},hasFluid:function(){return _m(this.fluid)?!!this.$pcFluid:this.fluid}}},Fv=["value","aria-invalid"];Bv.render=function(e,t,n,o,i,r){return $i(),Ui("input",nr({type:"text",class:e.cx("root"),value:e.modelValue,"aria-invalid":e.invalid||void 0,onInput:t[0]||(t[0]=function(){return r.onInput&&r.onInput.apply(r,arguments)})},r.getPTOptions("root")),null,16,Fv)};const Uv={class:"left flex-1"},zv={key:1,class:"edit"},Vv={key:2,class:"label"},Hv={class:"right toolbar"},Wv={key:0,class:"nodes"},Yv={__name:"group",props:{item:{type:Object,default:{}}},emits:["mousedown","mouseup","changeMode"],setup(e){const t=e,n=np(),o=pn(!1),i=pn(null),r=pn(""),s=e=>{var o,i;let r=t.item;if(!(null==(o=r.info)?void 0:o.is_edit)&&(null==(i=r.children)?void 0:i.length)>0){let e=y.canvas.graph._groups.find((e=>e.pos[0]==r.info.pos[0]&&e.pos[1]==r.info.pos[1]));e&&(e.show_nodes=!e.show_nodes,n.setGroups(y.canvas.graph._groups))}},a=async()=>{let e=t.item,i=y.canvas.graph._groups.find((t=>t.pos[0]==e.info.pos[0]&&t.pos[1]==e.info.pos[1]));i?(i.is_edit=!1,i.title=r.value,await n.setGroups(y.canvas.graph._groups),o.value=!1):o.value=!1};return(l,c)=>{var u,d,p;return $i(),Ui(Ni,null,[Zi("div",{class:Me("comfyui-easyuse-map-nodes-group"),onClick:s},[Zi("div",Uv,[e.item.children?($i(),Ui("i",{key:0,class:Me(["icon",e.item.info.show_nodes?"pi pi-folder-open":"pi pi-folder"]),style:Ie({color:e.item.info.color})},null,6)):Ji("",!0),(null==(u=e.item.info)?void 0:u.is_edit)?($i(),Ui("div",zv,[Ki(hn(Bv),{ref_key:"modifyRef",ref:i,modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=e=>r.value=e),variant:"outline",size:"small",type:"text",onBlur:a,onKeydown:[qr(a,["enter"]),qr(a,["esc"])],style:{width:"100%"}},null,8,["modelValue"])])):($i(),Ui("div",Vv,[Zi("span",{onDblclick:c[1]||(c[1]=Qr((s=>(async()=>{var e,s;if(o.value)return;let a=t.item,l=y.canvas.graph._groups.find((e=>e.pos[0]==a.info.pos[0]&&e.pos[1]==a.info.pos[1]));l&&(l.is_edit=!l.is_edit,r.value=l.is_edit?a.info.title:"",await n.setGroups(y.canvas.graph._groups),o.value=!0,null==(s=null==(e=i.value)?void 0:e[0])||s.$el.focus())})(e.item)),["stop"]))},Be(e.item.info.title),33)]))]),Zi("div",Hv,[(null==(d=e.item.children)?void 0:d.length)>0?($i(),zi(hn(Ev),{key:0,size:"small",icon:e.item.children.find((e=>e.mode==hn(j).ALWAYS))?"pi pi-eye":"pi pi-eye-slash",text:"",rounded:"",severity:"secondary",onClick:c[2]||(c[2]=Qr((e=>l.$emit("changeMode")),["stop"])),onMousedown:c[3]||(c[3]=Qr((e=>l.$emit("mousedown")),["stop"])),onMouseup:c[4]||(c[4]=Qr((e=>l.$emit("mouseup")),["stop"]))},null,8,["icon"])):Ji("",!0)])]),(null==(p=e.item.children)?void 0:p.length)>0&&e.item.info.show_nodes?($i(),Ui("div",Wv,[_o(l.$slots,"default")])):Ji("",!0)],64)}}},Zv={key:1,class:"label error"},Kv={class:"right toolbar"},Xv={__name:"node",props:{node:{type:Object,default:{}}},emits:["mousedown","mouseup","changeMode"],setup:e=>(t,n)=>($i(),Ui("div",{class:Me(["comfyui-easyuse-map-nodes-node",{never:void 0!==e.node.mode&&e.node.mode==hn(j).NEVER},{bypass:void 0!==e.node.mode&&e.node.mode==hn(j).BYPASS}])},[void 0!==e.node.title?($i(),Ui("span",{key:0,class:"label",onDblclick:n[0]||(n[0]=Qr((t=>hn(Lp)(e.node.id)),["stop"]))},Be(e.node.title),33)):($i(),Ui("span",Zv,Be(e.node.type),1)),Zi("div",Kv,[Ki(hn(Ev),{size:"small",icon:e.node.mode==hn(j).ALWAYS?"pi pi-eye":"pi pi-eye-slash",text:"",rounded:"",severity:"secondary",onClick:n[1]||(n[1]=Qr((e=>t.$emit("changeMode")),["stop"])),onMousedown:n[2]||(n[2]=Qr((e=>t.$emit("mousedown")),["stop"])),onMouseup:n[3]||(n[3]=Qr((e=>t.$emit("mouseup")),["stop"]))},null,8,["icon"])])],2))},Qv={class:"title"},Jv={class:"toolbar"},qv={key:0},ey={key:1,class:"no_result",style:{height:"100%"}},ty="comfyui-easyuse-map-nodes",ny={__name:"nodesMap",setup(e){const t=np(),{groups_nodes:n,groups:o}=ws(t),i=pn(!1),r=e=>{i.value=!i.value,y.canvas.graph._groups.forEach((e=>{e.show_nodes=i.value})),t.setGroups(y.canvas.graph._groups)};let s,a=0,l=0,c=!1;const u=(e,n=!1)=>{if(c)return void(c=!1);const o=e.children.find((e=>e.mode==j.ALWAYS)),i=e.children.map((e=>e.id));y.canvas.graph._nodes.forEach((e=>{i.includes(e.id)&&(e.mode=o?n?j.NEVER:j.BYPASS:j.ALWAYS,e.graph.change())})),t.setNodes(y.canvas.graph._nodes)},d=(e,n=!1)=>{if(c)return void(c=!1);const o=e.mode==j.ALWAYS,i=y.canvas.graph._nodes.find((t=>t.id==e.id));i&&(i.mode=o?n?j.NEVER:j.BYPASS:j.ALWAYS,i.graph.change(),t.setNodes(y.canvas.graph._nodes))},p=(e,t="group")=>{a=(new Date).getTime(),clearTimeout(s),s=setTimeout((n=>{"group"==t?u(e,!0):d(e,!0)}),500)},f=e=>{l=(new Date).getTime(),l-a>500&&(c=!0),clearTimeout(s)};return(e,t)=>{var s,a;return $i(),Ui("div",{class:Me(ty)},[Zi("div",{class:Me(ty+"__header")},[Zi("div",Qv,Be(hn(V)("Nodes Map",!0)),1),Zi("div",Jv,[(null==(s=hn(o))?void 0:s.length)>0?Hn(($i(),zi(hn(Ev),{key:0,icon:i.value?"pi pi-angle-double-down":"pi pi-angle-double-up",text:"",rounded:"",severity:"secondary",onClick:r,size:"small"},null,8,["icon"])),[[hn(Pv),i.value?hn(V)("Collapse All"):hn(V)("Expand All"),void 0,{right:!0}]]):Ji("",!0)])],2),Zi("div",{class:Me(ty+"__content")},[(null==(a=hn(n))?void 0:a.length)>0?($i(),Ui("ol",qv,[($i(!0),Ui(Ni,null,bo(hn(n),((e,t)=>($i(),Ui("li",{key:t},[void 0!==e.children?($i(),zi(Yv,{key:0,item:e,onChangeMode:t=>u(e),onMousedown:t=>p(e,"group"),onMouseup:f},{default:Vn((()=>[($i(!0),Ui(Ni,null,bo(e.children,((e,t)=>($i(),zi(Xv,{key:t,node:e,onChangeMode:t=>d(e),onMousedown:t=>p(e,"node"),onMouseup:f},null,8,["node","onChangeMode","onMousedown"])))),128))])),_:2},1032,["item","onChangeMode","onMousedown"])):($i(),zi(Xv,{key:1,node:e.info,onChangeMode:t=>d(e.info),onMousedown:t=>p(e.info,"node"),onMouseup:f},null,8,["node","onChangeMode","onMousedown"]))])))),128))])):($i(),Ui("div",ey,[Ki($v,{icon:"pi pi-sitemap",title:hn(V)("No Nodes",!0),message:hn(V)("No nodes found in the map",!0)},null,8,["title","message"])]))],2)])}}},oy={__name:"index",setup(e){const t=np();return oo((e=>{t.watchGraph()})),ao((e=>{})),(e,t)=>($i(),Ui("div",{class:Me("comfyui-easyuse-map")},[Ki(ny)]))}},iy={__name:"App",setup(e){const t=e=>{y.extensionManager.registerSidebarTab({id:M,icon:"pi pi-sitemap",title:V("Nodes Map",!0),tooltip:V("Nodes Map",!0),type:"custom",render:e=>{e.style.height="100%",((...e)=>{ns().render(...e)})(function(e,t,n){const o=arguments.length;return 2===o?ue(t)&&!ie(t)?Vi(t)?Ki(e,null,[t]):Ki(e,t):Ki(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):3===o&&Vi(n)&&(n=[n]),Ki(e,t,n))}(oy,{}),e)}})};return oo((e=>{try{t()}catch(n){}})),(e,t)=>($i(),zi(hm))}};var ry="equals",sy="notEquals";function ay(e){return(ay="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ly(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function cy(e){for(var t=1;t{const t=ns().createApp(...e),{mount:n}=t;return t.mount=e=>{const o=function(e){if(le(e)){return document.querySelector(e)}return e}(e);if(!o)return;const i=t._component;ae(i)||i.render||i.template||(i.template=o.innerHTML),o.innerHTML="";const r=n(o,!1,function(e){if(e instanceof SVGElement)return"svg";if("function"==typeof MathMLElement&&e instanceof MathMLElement)return"mathml"}(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),r},t})(iy);yy.use(my),yy.use(function(){const e=We(!0),t=e.run((()=>pn({})));let n=[],o=[];const i=rn({install(e){is(i),i._a=e,e.provide(rs,i),e.config.globalProperties.$pinia=i,o.forEach((e=>n.push(e))),o=[]},use(e){return this._a?n.push(e):o.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return i}()),yy.mount("#"+vy.id); +let os;const is=e=>os=e,rs=Symbol();function ss(e){return e&&"object"==typeof e&&"[object Object]"===Object.prototype.toString.call(e)&&"function"!=typeof e.toJSON}var as,ls;(ls=as||(as={})).direct="direct",ls.patchObject="patch object",ls.patchFunction="patch function";const cs=()=>{};function us(e,t,n,o=cs){e.push(t);const i=()=>{const n=e.indexOf(t);n>-1&&(e.splice(n,1),o())};var r;return!n&&Ye()&&(r=i,ze&&ze.cleanups.push(r)),i}function ds(e,...t){e.slice().forEach((e=>{e(...t)}))}const ps=e=>e(),fs=Symbol(),hs=Symbol();function ms(e,t){e instanceof Map&&t instanceof Map?t.forEach(((t,n)=>e.set(n,t))):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const o=t[n],i=e[n];ss(i)&&ss(o)&&e.hasOwnProperty(n)&&!dn(o)&&!qt(o)?e[n]=ms(i,o):e[n]=o}return e}const gs=Symbol();const{assign:vs}=Object;function ys(e,t,n,o){const{state:i,actions:r,getters:s}=t,a=n.state.value[e];let l;return l=bs(e,(function(){a||(n.state.value[e]=i?i():{});const t=function(e){const t=ie(e)?new Array(e.length):{};for(const n in e)t[n]=_n(e,n);return t}(n.state.value[e]);return vs(t,r,Object.keys(s||{}).reduce(((t,o)=>(t[o]=rn(_r((()=>{is(n);const t=n._s.get(e);return s[o].call(t,t)}))),t)),{}))}),t,n,o,!0),l}function bs(e,t,n={},o,i,r){let s;const a=vs({actions:{}},n),l={deep:!0};let c,u,d,p=[],f=[];const h=o.state.value[e];let m;function g(t){let n;c=u=!1,"function"==typeof t?(t(o.state.value[e]),n={type:as.patchFunction,storeId:e,events:d}):(ms(o.state.value[e],t),n={type:as.patchObject,payload:t,storeId:e,events:d});const i=m=Symbol();Pn().then((()=>{m===i&&(c=!0)})),u=!0,ds(p,n,o.state.value[e])}r||h||(o.state.value[e]={}),pn({});const v=r?function(){const{state:e}=n,t=e?e():{};this.$patch((e=>{vs(e,t)}))}:cs;const y=(t,n="")=>{if(fs in t)return t[hs]=n,t;const i=function(){is(o);const n=Array.from(arguments),r=[],s=[];let a;ds(f,{args:n,name:i[hs],store:b,after:function(e){r.push(e)},onError:function(e){s.push(e)}});try{a=t.apply(this&&this.$id===e?this:b,n)}catch(l){throw ds(s,l),l}return a instanceof Promise?a.then((e=>(ds(r,e),e))).catch((e=>(ds(s,e),Promise.reject(e)))):(ds(r,a),a)};return i[fs]=!0,i[hs]=n,i},b=Xt({_p:o,$id:e,$onAction:us.bind(null,f),$patch:g,$reset:v,$subscribe(t,n={}){const i=us(p,t,n.detached,(()=>r())),r=s.run((()=>bi((()=>o.state.value[e]),(o=>{("sync"===n.flush?u:c)&&t({storeId:e,type:as.direct,events:d},o)}),vs({},l,n))));return i},$dispose:function(){s.stop(),p=[],f=[],o._s.delete(e)}});o._s.set(e,b);const _=(o._a&&o._a.runWithContext||ps)((()=>o._e.run((()=>(s=We()).run((()=>t({action:y})))))));for(const x in _){const t=_[x];if(dn(t)&&(!dn(S=t)||!S.effect)||qt(t))r||(!h||ss(w=t)&&w.hasOwnProperty(gs)||(dn(t)?t.value=h[x]:ms(t,h[x])),o.state.value[e][x]=t);else if("function"==typeof t){const e=y(t,x);_[x]=e,a.actions[x]=t}}var w,S;return vs(b,_),vs(on(b),_),Object.defineProperty(b,"$state",{get:()=>o.state.value[e],set:e=>{g((t=>{vs(t,e)}))}}),o._p.forEach((e=>{vs(b,s.run((()=>e({store:b,app:o._a,pinia:o,options:a}))))})),h&&r&&n.hydrate&&n.hydrate(b.$state,h),c=!0,u=!0,b}function _s(e,t,n){let o,i;const r="function"==typeof t;function s(e,n){(e=e||(!!(sr||Fn||Uo)?zo(rs,null):null))&&is(e),(e=os)._s.has(o)||(r?bs(o,t,i,e):ys(o,i,e));return e._s.get(o)}return"string"==typeof e?(o=e,i=r?n:t):(i=e,o=e.id),s.$id=o,s}function ws(e){{e=on(e);const t={};for(const n in e){const o=e[n];(dn(o)||qt(o))&&(t[n]=bn(e,n))}return t}}var Ss="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function xs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ks=function(){this.__data__=[],this.size=0};var Cs=function(e,t){return e===t||e!=e&&t!=t},As=Cs;var Es=function(e,t){for(var n=e.length;n--;)if(As(e[n][0],t))return n;return-1},Os=Es,Ls=Array.prototype.splice;var Ts=Es;var Is=Es;var Ns=Es;var Ps=ks,Ds=function(e){var t=this.__data__,n=Os(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ls.call(t,n,1),--this.size,!0)},js=function(e){var t=this.__data__,n=Ts(t,e);return n<0?void 0:t[n][1]},Ms=function(e){return Is(this.__data__,e)>-1},Rs=function(e,t){var n=this.__data__,o=Ns(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};function $s(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},ec=sa,tc=ql,nc=Il,oc={};oc["[object Float32Array]"]=oc["[object Float64Array]"]=oc["[object Int8Array]"]=oc["[object Int16Array]"]=oc["[object Int32Array]"]=oc["[object Uint8Array]"]=oc["[object Uint8ClampedArray]"]=oc["[object Uint16Array]"]=oc["[object Uint32Array]"]=!0,oc["[object Arguments]"]=oc["[object Array]"]=oc["[object ArrayBuffer]"]=oc["[object Boolean]"]=oc["[object DataView]"]=oc["[object Date]"]=oc["[object Error]"]=oc["[object Function]"]=oc["[object Map]"]=oc["[object Number]"]=oc["[object Object]"]=oc["[object RegExp]"]=oc["[object Set]"]=oc["[object String]"]=oc["[object WeakMap]"]=!1;var ic=function(e){return nc(e)&&tc(e.length)&&!!oc[ec(e)]};var rc=function(e){return function(t){return e(t)}},sc={exports:{}};!function(e,t){var n=Hs,o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,r=i&&i.exports===o&&n.process,s=function(){try{var e=i&&i.require&&i.require("util").types;return e||r&&r.binding&&r.binding("util")}catch(t){}}();e.exports=s}(sc,sc.exports);var ac=sc.exports,lc=ic,cc=rc,uc=ac&&ac.isTypedArray,dc=uc?cc(uc):lc,pc=Tl,fc=Yl,hc=Zl,mc=Xl,gc=Jl,vc=dc,yc=Object.prototype.hasOwnProperty;var bc=function(e,t){var n=hc(e),o=!n&&fc(e),i=!n&&!o&&mc(e),r=!n&&!o&&!i&&vc(e),s=n||o||i||r,a=s?pc(e.length,String):[],l=a.length;for(var c in e)!t&&!yc.call(e,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||gc(c,l))||a.push(c);return a},_c=Object.prototype;var wc=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_c)};var Sc=function(e,t){return function(n){return e(t(n))}},xc=Sc(Object.keys,Object),kc=wc,Cc=xc,Ac=Object.prototype.hasOwnProperty;var Ec=da,Oc=ql;var Lc=function(e){return null!=e&&Oc(e.length)&&!Ec(e)},Tc=bc,Ic=function(e){if(!kc(e))return Cc(e);var t=[];for(var n in Object(e))Ac.call(e,n)&&"constructor"!=n&&t.push(n);return t},Nc=Lc;var Pc=function(e){return Nc(e)?Tc(e):Ic(e)},Dc=Ll,jc=Pc;var Mc=function(e,t){return e&&Dc(t,jc(t),e)};var Rc=aa,$c=wc,Gc=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},Bc=Object.prototype.hasOwnProperty;var Fc=bc,Uc=function(e){if(!Rc(e))return Gc(e);var t=$c(e),n=[];for(var o in e)("constructor"!=o||!t&&Bc.call(e,o))&&n.push(o);return n},zc=Lc;var Vc=function(e){return zc(e)?Fc(e,!0):Uc(e)},Hc=Ll,Wc=Vc;var Yc=function(e,t){return e&&Hc(t,Wc(t),e)},Zc={exports:{}};!function(e,t){var n=Zs,o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,r=i&&i.exports===o?n.Buffer:void 0,s=r?r.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,o=s?s(n):new e.constructor(n);return e.copy(o),o}}(Zc,Zc.exports);var Kc=Zc.exports;var Xc=function(e,t){var n=-1,o=e.length;for(t||(t=Array(o));++n({groups:[],nodes:[]}),getters:{groups_nodes(){var e;let t=[],n=[];if((null==(e=this.nodes)?void 0:e.length)>0){this.nodes.map((e=>{let o=e.pos,i=!1;for(let n=0;nr.pos[0]&&o[0]r.pos[1]&&o[1]e.pos[0]-t.pos[0])).sort(((e,t)=>e.pos[1]-t.pos[1])))},setNodes(e){this.nodes=tp(e)},update(){y.extensionManager.activeSidebarTab===M&&setTimeout((e=>{this.setGroups(y.canvas.graph._groups),this.setNodes(y.canvas.graph._nodes)}),1)},watchGraph(){let e=this;this.update();const t=y.graph.onNodeAdded;y.graph.onNodeAdded=function(n){e.update();const o=n.onRemoved;return n.onRemoved=function(){return e.update(),null==o?void 0:o.apply(this,arguments)},null==t?void 0:t.apply(this,arguments)},y.canvas.onNodeMoved=function(t){e.update()};const n=LGraphCanvas.onNodeAlign;LGraphCanvas.onNodeAlign=function(t){return e.update(),null==n?void 0:n.apply(this,arguments)};const o=LGraphCanvas.onGroupAdd;LGraphCanvas.onGroupAdd=function(){return e.update(),null==o?void 0:o.apply(this,arguments)};const i=LGraphCanvas.onGroupAlign;LGraphCanvas.onGroupAlign=function(t){return e.update(),null==i?void 0:i.apply(this,arguments)};const r=LGraphCanvas.onMenuNodeRemove;LGraphCanvas.onMenuNodeRemove=function(t){return e.update(),null==r?void 0:r.apply(this,arguments)}}}});let op=null;const ip=["custom_obsidian","custom_obsidian_dark","custom_milk_white"],rp={"easy positive":"green","easy negative":"red","easy promptList":"cyan","easy promptLine":"cyan","easy promptConcat":"cyan","easy promptReplace":"cyan","easy textSwitch":"pale_blue"};let sp=LGraphCanvas.node_colors,ap=null,lp=null,cp=null,up=null;for(let by in H)dp=H[by],y.ui.settings.addSetting(dp);var dp;function pp(e,t=!1){let n="after",o="before";t&&([o,n]=[n,o]),e.label=(e.label??e.name).replace(o,n),e.name=e.label}function fp(e,t,n,o,i,r,s){t.strokeStyle=o,t.fillStyle=i;let a=LiteGraph.NODE_TITLE_HEIGHT,l=this.ds.scale<.5,c=e._shape||e.constructor.shape||LiteGraph.ROUND_SHAPE,u=e.constructor.title_mode,d=!0;u==LiteGraph.TRANSPARENT_TITLE||u==LiteGraph.NO_TITLE?d=!1:u==LiteGraph.AUTOHIDE_TITLE&&mouse_over&&(d=!0);let p=new Float32Array(4);p=[0,d?-a:0,n[0]+1,d?n[1]+a:n[1]];let f=t.globalAlpha;if(t.lineWidth=1,t.beginPath(),c==LiteGraph.BOX_SHAPE||l?t.fillRect(p[0],p[1],p[2],p[3]):c==LiteGraph.ROUND_SHAPE||c==LiteGraph.CARD_SHAPE?t.roundRect(p[0],p[1],p[2],p[3],c==LiteGraph.CARD_SHAPE?[this.round_radius,this.round_radius,0,0]:[this.round_radius]):c==LiteGraph.CIRCLE_SHAPE&&t.arc(.5*n[0],.5*n[1],.5*n[0],0,2*Math.PI),t.strokeStyle=LiteGraph.WIDGET_OUTLINE_COLOR,t.stroke(),t.strokeStyle=o,t.fill(),!e.flags.collapsed&&d&&(t.shadowColor="transparent",t.fillStyle="rgba(0,0,0,0.2)",t.fillRect(0,-1,p[2],2)),t.shadowColor="transparent",e.onDrawBackground&&e.onDrawBackground(t,this,this.canvas,this.graph_mouse),d||u==LiteGraph.TRANSPARENT_TITLE){const i="dark"==function(e){let t=e.replace("#","");return n=parseInt(t.substring(0,2),16),o=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16),.299*n+.587*o+.114*i>127.5?"light":"dark";var n,o,i}((null==e?void 0:e.color)||"#ffffff");if(e.onDrawTitleBar)e.onDrawTitleBar(t,a,n,this.ds.scale,o);else if(u!=LiteGraph.TRANSPARENT_TITLE&&(e.constructor.title_color||this.render_title_colored)){let i=e.constructor.title_color||o;if(e.flags.collapsed&&(t.shadowColor=LiteGraph.DEFAULT_SHADOW_COLOR),this.use_gradients){let e=LGraphCanvas.gradients[i];e||(e=LGraphCanvas.gradients[i]=t.createLinearGradient(0,0,400,0),e.addColorStop(0,i),e.addColorStop(1,"#000")),t.fillStyle=e}else t.fillStyle=i;t.beginPath(),c==LiteGraph.BOX_SHAPE||l?t.rect(0,-a,n[0]+1,a):c!=LiteGraph.ROUND_SHAPE&&c!=LiteGraph.CARD_SHAPE||t.roundRect(0,-a,n[0]+1,a,e.flags.collapsed?[this.round_radius]:[this.round_radius,this.round_radius,0,0]),t.fill(),t.shadowColor="transparent"}let s=!1;LiteGraph.node_box_coloured_by_mode&&LiteGraph.NODE_MODES_COLORS[e.mode]&&(s=LiteGraph.NODE_MODES_COLORS[e.mode]),LiteGraph.node_box_coloured_when_on&&(s=e.action_triggered?"#FFF":e.execute_triggered?"#AAA":s);let d=10;if(e.onDrawTitleBox)e.onDrawTitleBox(t,a,n,this.ds.scale);else if(c==LiteGraph.ROUND_SHAPE||c==LiteGraph.CIRCLE_SHAPE||c==LiteGraph.CARD_SHAPE){const n=i?"#ffffff":LiteGraph.NODE_SELECTED_TITLE_COLOR,o=i?"#eeeeee":e.boxcolor||s||LiteGraph.NODE_DEFAULT_BOXCOLOR;t.fillStyle=r?n:o,t.beginPath(),t.fillRect(10,0-1.05*d-1,1.1*d,.125*d),t.fillRect(10,0-1.45*d-1,1.1*d,.125*d),t.fillRect(10,0-1.85*d-1,1.1*d,.125*d)}else t.fillStyle=e.boxcolor||s||LiteGraph.NODE_DEFAULT_BOXCOLOR,t.fillRect(.5*(a-d),-.5*(a+d),d,d);if(t.globalAlpha=f,e.onDrawTitleText&&e.onDrawTitleText(t,a,n,this.ds.scale,this.title_text_font,r),!l){t.font=this.title_text_font;let n=String(e.getTitle());n&&(t.fillStyle=r?i?"#ffffff":LiteGraph.NODE_SELECTED_TITLE_COLOR:i?"#ffffff":e.constructor.title_text_color||this.node_title_color,e.flags.collapsed?(t.textAlign="left",t.measureText(n),t.fillText(n.substr(0,20),a,LiteGraph.NODE_TITLE_TEXT_Y-a),t.textAlign="left"):(t.textAlign="left",t.fillText(n,a,LiteGraph.NODE_TITLE_TEXT_Y-a)))}if(!e.flags.collapsed&&e.subgraph&&!e.skip_subgraph_button){let n=LiteGraph.NODE_TITLE_HEIGHT,o=e.size[0]-n,i=LiteGraph.isInsideRectangle(this.graph_mouse[0]-e.pos[0],this.graph_mouse[1]-e.pos[1],o+2,2-n,n-4,n-4);t.fillStyle=i?"#888":"#555",c==LiteGraph.BOX_SHAPE||l?t.fillRect(o+2,2-n,n-4,n-4):(t.beginPath(),t.roundRect(o+2,2-n,n-4,n-4,[4]),t.fill()),t.fillStyle="#333",t.beginPath(),t.moveTo(o+.2*n,.6*-n),t.lineTo(o+.8*n,.6*-n),t.lineTo(o+.5*n,.3*-n),t.fill()}e.onDrawTitle&&e.onDrawTitle(t)}if(r){e.onBounding&&e.onBounding(p),u==LiteGraph.TRANSPARENT_TITLE&&(p[1]-=a,p[3]+=a),t.lineWidth=2,t.globalAlpha=.8,t.beginPath();let i=0,r=0,s=1;c==LiteGraph.BOX_SHAPE?t.rect(i+p[0],i+p[1],r+p[2],r+p[3]):c==LiteGraph.ROUND_SHAPE||c==LiteGraph.CARD_SHAPE&&e.flags.collapsed?t.roundRect(i+p[0],i+p[1],r+p[2],r+p[3],[this.round_radius*s]):c==LiteGraph.CARD_SHAPE?t.roundRect(i+p[0],i+p[1],r+p[2],r+p[3],[this.round_radius*s,s,this.round_radius*s,s]):c==LiteGraph.CIRCLE_SHAPE&&t.arc(.5*n[0],.5*n[1],.5*n[0]+6,0,2*Math.PI),t.strokeStyle=LiteGraph.NODE_BOX_OUTLINE_COLOR,t.stroke(),t.strokeStyle=o,t.globalAlpha=1}e.execute_triggered>0&&e.execute_triggered--,e.action_triggered>0&&e.action_triggered--}function hp(e,t,n,o){if(!e.widgets||!e.widgets.length)return 0;let i=e.size[0],r=e.widgets;t+=2;let s=LiteGraph.NODE_WIDGET_HEIGHT,a=this.ds.scale>.5;n.save(),n.globalAlpha=this.editor_alpha;let l=LiteGraph.WIDGET_OUTLINE_COLOR,c=LiteGraph.WIDGET_BGCOLOR,u=LiteGraph.WIDGET_TEXT_COLOR,d=LiteGraph.WIDGET_SECONDARY_TEXT_COLOR,p=12;for(let f=0;f1&&(i=1),n.fillStyle=h.options.hasOwnProperty("slider_color")?h.options.slider_color:o==h?l:I,n.beginPath(),n.roundRect(p,m,i*(g-24),s,[.25*s]),n.fill(),h.marker){let e=(h.marker-h.options.min)/t;e<0&&(e=0),e>1&&(e=1),n.fillStyle=h.options.hasOwnProperty("marker_color")?h.options.marker_color:"#AA9",n.roundRect(p+e*(g-24),m,2,s,[.25*s])}if(a){n.textAlign="center",n.fillStyle=u;let e=(h.label||h.name)+": "+Number(h.value).toFixed(null!=h.options.precision?h.options.precision:3).toString();n.fillText(e,.5*g,m+.7*s)}break;case"number":case"combo":if(n.textAlign="left",n.strokeStyle=l,n.fillStyle=c,n.beginPath(),a?n.roundRect(p,m,g-24,s,[.25*s]):n.rect(p,m,g-24,s),n.fill(),a){h.disabled||n.stroke(),n.fillStyle=u,h.disabled||(n.beginPath(),n.moveTo(24,m+6.5),n.lineTo(18,m+.5*s),n.lineTo(24,m+s-6.5),n.fill(),n.beginPath(),n.moveTo(g-p-12,m+6.5),n.lineTo(g-p-6,m+.5*s),n.lineTo(g-p-12,m+s-6.5),n.fill()),n.fillStyle=d,n.font="10px Inter",n.fillText(h.label||h.name,29,m+.7*s),n.fillStyle=u,n.textAlign="right";let e=6;if("number"==h.type)n.font="10px Inter",n.fillText(Number(h.value).toFixed(void 0!==h.options.precision?h.options.precision:3),g-24-e,m+.7*s);else{let t=h.value;if(h.options.values){let e=h.options.values;e.constructor===Function&&(e=e()),e&&e.constructor!==Array&&(t=e[h.value])}n.fillText(t,g-24-e,m+.7*s)}}break;case"string":case"text":if(n.textAlign="left",n.strokeStyle=l,n.fillStyle=c,n.beginPath(),a?n.roundRect(p,m,g-24,s,[.25*s]):n.rect(p,m,g-24,s),n.fill(),a){h.disabled||n.stroke(),n.save(),n.beginPath(),n.rect(p,m,g-24,s),n.clip(),n.fillStyle=d;const e=h.label||h.name;n.font="10px Inter",null!=e&&n.fillText(e,24,m+.7*s),n.fillStyle=u,n.textAlign="right",n.fillText(String(h.value).substr(0,30),g-24,m+.7*s),n.restore()}break;default:h.draw&&h.draw(n,e,g,m,s)}t+=(h.computeSize?h.computeSize(g)[1]:s)+4,n.globalAlpha=this.editor_alpha}n.restore(),n.textAlign="left"}function mp(e,t,n,o,i){return new LiteGraph.ContextMenu(LiteGraph.NODE_MODES,{event:n,callback:function(e){if(!i)return;var t=Object.values(LiteGraph.NODE_MODES).indexOf(e),n=function(e){t>=0&&LiteGraph.NODE_MODES[t]?e.changeMode(t):e.changeMode(LiteGraph.ALWAYS),op||(op=np()),op.update()},o=LGraphCanvas.active_canvas;if(!o.selected_nodes||Object.keys(o.selected_nodes).length<=1)n(i);else for(var r in o.selected_nodes)n(o.selected_nodes[r])},parentMenu:o,node:i}),!1}function gp(e,t,n,o,i){if(!i)throw"no node for color";var r=[];for(var s in r.push({value:null,content:"No color"}),LGraphCanvas.node_colors){var a=LGraphCanvas.node_colors[s];e={value:s,content:""+s+""};r.push(e)}return new LiteGraph.ContextMenu(r,{event:n,callback:function(e){if(!i)return;var t=e.value?LGraphCanvas.node_colors[e.value]:null,n=function(e){t?e.constructor===LiteGraph.LGraphGroup?e.color=t.groupcolor:(e.color=t.color,e.bgcolor=t.bgcolor):(delete e.color,delete e.bgcolor),op||(op=np()),op.update()},o=LGraphCanvas.active_canvas;if(!o.selected_nodes||Object.keys(o.selected_nodes).length<=1)n(i);else for(var r in o.selected_nodes)n(o.selected_nodes[r]);i.setDirtyCanvas(!0,!0)},parentMenu:o,node:i}),!1}function vp(e,t,n,o,i){var r=e.property||"title",s=i[r],a=document.createElement("div");a.is_modified=!1,a.className="graphdialog",a.innerHTML="",a.close=function(){a.parentNode&&a.parentNode.removeChild(a)},a.querySelector(".name").innerText=r;var l=a.querySelector(".value");l&&(l.value=s,l.addEventListener("blur",(function(e){this.focus()})),l.addEventListener("keydown",(function(e){if(a.is_modified=!0,27==e.keyCode)a.close();else if(13==e.keyCode)h();else if(13!=e.keyCode&&"textarea"!=e.target.localName)return;e.preventDefault(),e.stopPropagation()})));var c=LGraphCanvas.active_canvas.canvas,u=c.getBoundingClientRect(),d=-20,p=-20;u&&(d-=u.left,p-=u.top),event?(a.style.left=event.clientX+d+"px",a.style.top=event.clientY+p+"px"):(a.style.left=.5*c.width+d+"px",a.style.top=.5*c.height+p+"px"),a.querySelector("button").addEventListener("click",h),c.parentNode.appendChild(a),l&&l.focus();var f=null;function h(){l&&function(t){"Number"==e.type?t=Number(t):"Boolean"==e.type&&(t=Boolean(t));i[r]=t,a.parentNode&&a.parentNode.removeChild(a);i.setDirtyCanvas(!0,!0),op||(op=np());op.update()}(l.value)}a.addEventListener("mouseleave",(function(e){LiteGraph.dialog_close_on_mouse_leave&&!a.is_modified&&LiteGraph.dialog_close_on_mouse_leave&&(f=setTimeout(a.close,LiteGraph.dialog_close_on_mouse_leave_delay))})),a.addEventListener("mouseenter",(function(e){LiteGraph.dialog_close_on_mouse_leave&&f&&clearTimeout(f)}))}y.registerExtension({name:"Comfy.EasyUse.UI",init(){var e,t;const n="Comfy.CustomColorPalettes",o="Comfy.Settings.Comfy.CustomColorPalettes";if(lp||(lp=A(n,o)),cp||(cp=A("Comfy.ColorPalette","Comfy.Settings.Comfy.ColorPalette")||"dark"),(!(null==(e=null==lp?void 0:lp.obsidian)?void 0:e.version)||lp.obsidian.version<$.ColorPalette.version)&&(lp.obsidian=$.ColorPalette,lp.obsidian_dark=G.ColorPalette,E(n,lp,o)),(!(null==(t=null==lp?void 0:lp.milk_white)?void 0:t.version)||lp.milk_white.version{(null==e?void 0:e.value)&&(null==e?void 0:e.oldValue)&&(await W(1),Object.assign(y.canvas.default_connection_color_byType,N),Object.assign(LGraphCanvas.link_type_colors,N)),"custom_milk_white"==e.value&&document.body.classList.remove(T)})),setTimeout((e=>bp(A("Comfy.UseNewMenu")||"Disabled")),1)},async nodeCreated(e){var t;if(rp.hasOwnProperty(e.comfyClass)){const t=rp[e.comfyClass],n=sp[t];if(!n)return;n.color&&(e.color=n.color),n.bgcolor&&(e.bgcolor=n.bgcolor)}if(ap||(ap=A("Comfy.WidgetControlMode")),"before"==ap){const n="before"==ap;if((null==(t=e.widgets)?void 0:t.length)>0)for(const t of e.widgets)if(["control_before_generate","control_after_generate"].includes(t.name)&&(await pp(t,n),t.linkedWidgets))for(const e of t.linkedWidgets)await pp(e,n)}}});const yp=null==(h=y.ui.settings.settingsLookup)?void 0:h["Comfy.UseNewMenu"];yp&&(yp.onChange=e=>bp(e));const bp=e=>{var t;const n=(null==(t=document.getElementById("crystools-root"))?void 0:t.children)||null;if((null==n?void 0:n.length)>0){if(!up)for(let e=0;ee.widgets.find((e=>e.name===t)),Sp=(e,t,n=!1,o="")=>{var i;if(!t||((e,t)=>!!e.inputs&&e.inputs.some((e=>e.name===t)))(e,t.name))return;_p[t.name]||(_p[t.name]={origType:t.type,origComputeSize:t.computeSize});const r=e.size;t.type=n?_p[t.name].origType:"easyHidden"+o,t.computeSize=n?_p[t.name].origComputeSize:()=>[0,-4],null==(i=t.linkedWidgets)||i.forEach((o=>Sp(e,o,":"+t.name,n)));const s=n?Math.max(e.computeSize()[1],r[1]):e.size[1];e.setSize([e.size[0],s])},xp=(e,t=0)=>{var n,o;if(e)return(null==(n=e.widgets)?void 0:n[t])?e.widgets[t].value:e.widgets_values?null==(o=e.widgets_values)?void 0:o[t]:void 0},kp=e=>e.setSize([e.size[0],e.computeSize()[1]]),Cp=(e,t)=>graph.getNodeById(e),Ap=e=>{var t;try{return Object.values(null==(t=null==graph?void 0:graph.list_of_graphcanvas[0])?void 0:t.selected_nodes)}catch(n){return[]}};function Ep(e,t,n){return e+(o=n,(.5-.5*Math.cos(Math.PI*o))*(t-e));var o}const Op=(e,t=!0)=>{var n,o;const i=(null==(o=null==(n=e.graph)?void 0:n.list_of_graphcanvas)?void 0:o[0])||null;if(!i)return;const[r,s]=e.pos,[a,l]=e.size;(([e,t],n)=>{const o=n.ds,i=document.body.clientWidth,r=document.body.clientHeight,s=o.scale,a=.5*i/s-e,l=.5*r/s-t,c=Date.now()+250,u=o.offset[0],d=o.offset[1],p=()=>{const e=c-Date.now();if(!(Date.now(){const t=Cp(e);t&&Op(t)},Tp=(e,t=(()=>graph.links??[])())=>t[e],Ip=e=>e.toLowerCase().replace(/_./g,(e=>e.replace("_","").toUpperCase())),Np=e=>"easy getNode"===e.type,Pp=e=>"easy setNode"===e.type,Dp=e=>Np(e)||Pp(e),jp=(e=(()=>graph._nodes??[])())=>e.filter((e=>Dp(e))),Mp=(e,t,n=0)=>{e.widgets_values||(e.widgets_values=[]),e.widgets_values[n]=t,e.widgets[n].value=t},Rp=e=>graph.add(e),$p=e=>graph.remove(e),Gp=(e,t=0)=>{var n,o;if("Reroute"!==e.type)return[e,t];const i=e,r=null==(o=null==(n=i.inputs)?void 0:n[0])?void 0:o.link;if(!r)return[i,t];const s=Tp(r);if(!s)return[i,t];const a=Cp(s.origin_id);return a?(setTimeout((()=>{$p(i)})),Gp(a,s.origin_slot)):[i,t]},Bp=e=>{var t,n,o;if("Reroute"!==e.type)return e;const i=e,r=null==(n=null==(t=i.outputs)?void 0:t[0])?void 0:n.links;if(!r)return i;const s=r[0];if(!s)return i;const a=Tp(s);if(!a)return i;const l=Cp(a.target_id);return l?(1===(null==(o=i.outputs[0].links)?void 0:o.length)&&setTimeout((()=>{$p(i)})),Bp(l)):i};const Fp=new class{constructor(){v(this,"element",_(`div.${L}toast`)),v(this,"children",HTMLElement),v(this,"container",document.body),this.container.appendChild(this.element)}async show(e){let t=_(`div.${L}toast-container`,[_("div",[_("span",[...e.icon?[_("i",{className:e.icon})]:[],_("span",e.content)])])]);t.setAttribute("toast-id",e.id),this.element.replaceChildren(t),this.container.appendChild(this.element),await W(64),t.style.marginTop=`-${t.offsetHeight}px`,await W(64),t.classList.add("show"),e.duration&&(await W(e.duration),this.hide(e.id))}async hide(e){const t=document.querySelector(`.${L}toast > [toast-id="${e}"]`);(null==t?void 0:t.classList.contains("show"))&&(t.classList.remove("show"),await W(750)),t&&t.remove()}async clearAllMessages(){let e=document.querySelector(`.${L}container`);e&&(e.innerHTML="")}async info(e,t=3e3,n=[]){this.show({id:"toast-info",icon:`mdi mdi-information ${L}theme`,content:e,duration:t})}async success(e,t=3e3){this.show({id:"toast-success",icon:`mdi mdi-check-circle ${L}success`,content:e,duration:t})}async error(e,t=3e3){this.show({id:"toast-error",icon:`mdi mdi-close-circle ${L}error`,content:e,duration:t})}async warn(e,t=3e3){this.show({id:"toast-warn",icon:`mdi mdi-alert-circle ${L}warning`,content:e,duration:t})}async showLoading(e,t=0){this.show({id:"toast-loading",icon:"mdi mdi-rotate-right loading",content:e,duration:t})}async hideLoading(){this.hide("toast-loading")}},Up=["rescale_after_model","rescale","lora_name","upscale_method","image_output","add_noise","info","sampler_name","ckpt_B_name","ckpt_C_name","save_model","refiner_ckpt_name","num_loras","num_controlnet","mode","toggle","resolution","ratio","target_parameter","input_count","replace_count","downscale_mode","range_mode","text_combine_mode","input_mode","lora_count","ckpt_count","conditioning_mode","preset","use_tiled","use_batch","num_embeds","easing_mode","guider","scheduler","inpaint_mode","t5_type","rem_mode"],zp=["LIGHT - SD1.5 only (low strength)","STANDARD (medium strength)","VIT-G (medium strength)","PLUS (high strength)","PLUS FACE (portraits)","FULL FACE - SD1.5 only (portraits stronger)"],Vp=["FACEID","FACEID PLUS - SD1.5 only","FACEID PLUS V2","FACEID PLUS KOLORS","FACEID PORTRAIT (style transfer)","FACEID PORTRAIT UNNORM - SDXL only (strong)"],Hp=["easy seed","easy latentNoisy","easy wildcards","easy preSampling","easy preSamplingAdvanced","easy preSamplingNoiseIn","easy preSamplingSdTurbo","easy preSamplingCascade","easy preSamplingDynamicCFG","easy preSamplingLayerDiffusion","easy fullkSampler","easy fullCascadeKSampler"],Wp=["easy fullLoader","easy a1111Loader","easy comfyLoader","easy hyditLoader","easy pixArtLoader"],Yp=["easy imageSize","easy imageSizeBySide","easy imageSizeByLongerSide","easy imageSizeShow","easy imageRatio","easy imagePixelPerfect"];function Zp(e,t){const n=e.comfyClass,o=t.value;switch(t.name){case"range_mode":Sp(e,wp(e,"step"),"step"==o),Sp(e,wp(e,"num_steps"),"num_steps"==o),kp(e);break;case"text_combine_mode":Sp(e,wp(e,"replace_text"),"replace"==o);break;case"lora_name":["lora_model_strength","lora_clip_strength"].map((t=>Sp(e,wp(e,t),"None"!==o)));break;case"resolution":"自定义 x 自定义"===o&&(t.value="width x height (custom)"),["empty_latent_width","empty_latent_height"].map((t=>Sp(e,wp(e,t),"width x height (custom)"===o)));break;case"ratio":["empty_latent_width","empty_latent_height"].map((t=>Sp(e,wp(e,t),"custom"===o)));break;case"num_loras":var i=o+1,r=wp(e,"mode").value;for(let t=0;tSp(e,wp(e,t),"simple"!==r)));for(let t=i;t<21;t++)["lora_"+t+"_name","lora_"+t+"_strength","lora_"+t+"_model_strength","lora_"+t+"_clip_strength"].map((t=>Sp(e,wp(e,t),!1)));kp(e);break;case"num_controlnet":i=o+1,r=wp(e,"mode").value;for(let t=0;tSp(e,wp(e,t),!0))),["start_percent_"+t,"end_percent_"+t].map((t=>Sp(e,wp(e,t),"simple"!==r)));for(let t=i;t<21;t++)["controlnet_"+t,"controlnet_"+t+"_strength","scale_soft_weight_"+t,"start_percent_"+t,"end_percent_"+t].map((t=>Sp(e,wp(e,t),!1)));kp(e);break;case"mode":switch(null==e?void 0:e.comfyClass){case"easy loraStack":i=wp(e,"num_loras").value+1,r=o;for(let t=0;tSp(e,wp(e,t),"simple"!==r)));kp(e);break;case"easy controlnetStack":i=wp(e,"num_controlnet").value+1,r=o;for(let t=0;tSp(e,wp(e,t),"simple"!==r)));kp(e);break;case"easy icLightApply":r=o;["lighting","remove_bg"].map((t=>Sp(e,wp(e,t),"Foreground"===r))),Sp(e,wp(e,"source"),"Foreground"!==r),kp(e)}break;case"toggle":t.type="toggle",t.options={on:"Enabled",off:"Disabled"};break;case"t5_type":["clip_name","padding"].map((t=>Sp(e,wp(e,t),"sd3"==o))),["t5_name","device","dtype"].map((t=>Sp(e,wp(e,t),"t5v11"==o))),kp(e);break;case"preset":if(zp.includes(o)){let t=wp(e,"use_tiled");Sp(e,wp(e,"lora_strength")),Sp(e,wp(e,"provider")),Sp(e,wp(e,"weight_faceidv2")),Sp(e,wp(e,"weight_kolors")),Sp(e,wp(e,"use_tiled"),!0),Sp(e,wp(e,"sharpening"),t&&t.value)}else Vp.includes(o)&&(Sp(e,wp(e,"weight_faceidv2"),!!["FACEID PLUS V2","FACEID PLUS KOLORS"].includes(o)),Sp(e,wp(e,"weight_kolors"),!!["FACEID PLUS KOLORS"].includes(t.value)),["FACEID PLUS KOLORS","FACEID PORTRAIT (style transfer)","FACEID PORTRAIT UNNORM - SDXL only (strong)"].includes(o)?Sp(e,wp(e,"lora_strength"),!1):Sp(e,wp(e,"lora_strength"),!0),Sp(e,wp(e,"provider"),!0),Sp(e,wp(e,"use_tiled")),Sp(e,wp(e,"sharpening")));kp(e);break;case"use_tiled":Sp(e,wp(e,"sharpening"),!!o),kp(e);break;case"num_embeds":i=o+1;for(let t=0;tSp(e,wp(e,t),!1)));break;case"brushnet_random":case"brushnet_segmentation":["dtype","scale","start_at","end_at"].map((t=>Sp(e,wp(e,t),!0))),["fitting","function"].map((t=>Sp(e,wp(e,t),!1)));break;case"powerpaint":["dtype","fitting","function","scale","start_at","end_at"].map((t=>Sp(e,wp(e,t),!0)))}kp(e);break;case"image_output":Sp(e,wp(e,"link_id"),!!["Sender","Sender&Save"].includes(o)),Sp(e,wp(e,"decode_vae_name"),!!["Hide","Hide&Save"].includes(o)),["save_prefix","output_path","embed_workflow","number_padding","overwrite_existing"].map((t=>Sp(e,wp(e,t),!!["Save","Hide&Save","Sender&Save"].includes(o))));break;case"add_noise":var s=wp(e,"control_before_generate"),a=wp(e,"control_after_generate")||s;"disable"===o?(Sp(e,wp(e,"seed")),a&&(a.last_value=a.value,a.value="fixed",Sp(e,a))):(Sp(e,wp(e,"seed"),!0),a&&((null==a?void 0:a.last_value)&&(a.value=a.last_value),Sp(e,a,!0))),kp(e);break;case"guider":switch(o){case"Basic":["cfg","cfg_negative"].map((t=>Sp(e,wp(e,t))));break;case"CFG":Sp(e,wp(e,"cfg"),!0),Sp(e,wp(e,"cfg_negative"));break;case"IP2P+DualCFG":case"DualCFG":["cfg","cfg_negative"].map((t=>Sp(e,wp(e,t),!0)))}kp(e);break;case"scheduler":["karrasADV","exponentialADV","polyExponential"].includes(o)?(["sigma_max","sigma_min"].map((t=>Sp(e,wp(e,t),!0))),["denoise","beta_d","beta_min","eps_s","coeff"].map((t=>Sp(e,wp(e,t))),!1),Sp(e,wp(e,"rho"),"exponentialADV"!=o)):"vp"==o?(["sigma_max","sigma_min","denoise","rho","coeff"].map((t=>Sp(e,wp(e,t)))),["beta_d","beta_min","eps_s"].map((t=>Sp(e,wp(e,t),!0)))):(["sigma_max","sigma_min","beta_d","beta_min","eps_s","rho"].map((t=>Sp(e,wp(e,t)))),Sp(e,wp(e,"coeff"),"gits"==o),Sp(e,wp(e,"denoise"),!0)),kp(e);break;case"conditioning_mode":["replace","concat","combine"].includes(o)?["average_strength","old_cond_start","old_cond_end","new_cond_start","new_cond_end"].map((t=>Sp(e,wp(e,t)))):"average"==o?(Sp(e,wp(e,"average_strength"),!0),["old_cond_start","old_cond_end","new_cond_start","new_cond_end"].map((t=>Sp(e,wp(e,t),!1)))):"timestep"==o&&(["average_strength"].map((t=>Sp(e,wp(e,t),!1))),["old_cond_start","old_cond_end","new_cond_start","new_cond_end"].map((t=>Sp(e,wp(e,t)))));break;case"rescale":wp(e,"rescale_after_model").value,Sp(e,wp(e,"width"),"to Width/Height"===o),Sp(e,wp(e,"height"),"to Width/Height"===o),Sp(e,wp(e,"percent"),"by percentage"===o),Sp(e,wp(e,"longer_side"),"to longer side - maintain aspect"===o),kp(e);break;case"upscale_method":["factor","crop"].map((t=>Sp(e,wp(e,t),"None"!==o)));break;case"target_parameter":switch(n){case"easy XYInputs: Steps":["first_step","last_step"].map((t=>Sp(e,wp(e,t),"steps"==o))),["first_start_step","last_start_step"].map((t=>Sp(e,wp(e,t),"start_at_step"==o))),["first_end_step","last_end_step"].map((t=>Sp(e,wp(e,t),"end_at_step"==o)));break;case"easy XYInputs: Sampler/Scheduler":let t=wp(e,"input_count").value+1;for(let n=0;nSp(e,wp(e,t),"strength"==o))),["first_start_percent","last_start_percent"].map((t=>Sp(e,wp(e,t),"start_percent"==o))),["first_end_percent","last_end_percent"].map((t=>Sp(e,wp(e,t),"end_percent"==o))),["strength","start_percent","end_percent"].map((t=>Sp(e,wp(e,t),o!=t))),kp(e)}case"replace_count":i=o+1;for(let t=0;tSp(e,wp(e,t),!l)));for(let t=i;t<11;t++)["lora_name_"+t,"model_str_"+t,"clip_str_"+t].map((t=>Sp(e,wp(e,t),!1)));kp(e);break;case"ckpt_count":i=o+1;var c=-1!=wp(e,"input_mode").value.indexOf("ClipSkip"),u=-1!=wp(e,"input_mode").value.indexOf("VAE");for(let t=0;tSp(e,wp(e,t),!1)));kp(e);break;case"input_count":i=o+1;var d=wp(e,"target_parameter").value;for(let t=0;tSp(e,wp(e,n),!t)));["model_strength","clip_strength"].map((n=>Sp(e,wp(e,n),!t)));break;case"easy XYInputs: Checkpoint":i=wp(e,"ckpt_count").value+1,c=-1!=wp(e,"input_mode").value.indexOf("ClipSkip"),u=-1!=wp(e,"input_mode").value.indexOf("VAE");for(let n=0;ne.name===t));if(-1!==e){for(let t=e;t{var e;const t=this.computeSize();t[0]"info"===e.name));if(-1!==e&&this.widgets[e]){this.widgets[e].value=t}}requestAnimationFrame((()=>{var e;const t=this.computeSize();t[0]"prompt"==e.name));this.addWidget("button","get values from COMBO link","",(()=>{var t,o;const i=(null==(o=null==(t=this.outputs[1])?void 0:t.links)?void 0:o.length)>0?this.outputs[1].links[0]:null,r=n.graph._nodes.find((e=>{var t;return null==(t=e.inputs)?void 0:t.find((e=>e.link==i))}));if(i&&r){const t=r.inputs.find((e=>e.link==i)).widget.name,n=r.widgets.find((e=>e.name==t));let o=(null==n?void 0:n.options.values)||null;o&&(o=o.join("\n"),e.value=o)}else Fp.error(V("No COMBO link"),3e3)}),{serialize:!1})}),Wp.includes(t.name)){let t=function(e){var t="";for(let n=0;ne.name===t+"_prompt")),o="comfy-multiline-input wildcard_"+t+"_"+this.id.toString();if(-1==n&&e){const n=document.createElement("textarea");n.className=o,n.placeholder="Wildcard Prompt ("+t+")";const i=this.addDOMWidget(t+"_prompt","customtext",n,{getValue:e=>n.value,setValue(e){n.value=e},serialize:!1});i.inputEl=n,i.inputEl.readOnly=!0,n.addEventListener("input",(()=>{var e;null==(e=i.callback)||e.call(i,i.value)})),i.value=e}else if(this.widgets[n])if(e){this.widgets[n].value=e}else{this.widgets.splice(n,1);const e=document.getElementsByClassName(o);e&&e[0]&&e[0].remove()}}};e.prototype.onExecuted=function(e){null==a||a.apply(this,arguments);const o=t(e.positive),i=t(e.negative);n.call(this,o,"positive"),n.call(this,i,"negative")}}if(["easy sv3dLoader"].includes(t.name)){let t=function(e,t,n){switch(e){case"azimuth":return n.readOnly=!0,n.style.opacity=.6,"0:(0.0,0.0)"+(t>1?`\n${t-1}:(360.0,0.0)`:"");case"elevation":return n.readOnly=!0,n.style.opacity=.6,"0:(-90.0,0.0)"+(t>1?`\n${t-1}:(90.0,0.0)`:"");case"custom":return n.readOnly=!1,n.style.opacity=1,"0:(0.0,0.0)\n9:(180.0,0.0)\n20:(360.0,0.0)"}};e.prototype.onNodeCreated=async function(){r&&r.apply(this,[]);const e=this.widgets.find((e=>"easing_mode"==e.name)),n=this.widgets.find((e=>"batch_size"==e.name)),o=this.widgets.find((e=>"scheduler"==e.name));setTimeout((i=>{o.value||(o.value=t(e.value,n.value,o.inputEl))}),1),e.callback=e=>{o.value=t(e,n.value,o.inputEl)},n.callback=n=>{o.value=t(e.value,n,o.inputEl)}}}if(Hp.includes(o)&&(e.prototype.onNodeCreated=async function(){r&&r.apply(this,[]);const e=this.widgets.find((e=>["seed_num","seed"].includes(e.name))),o=this.widgets.find((e=>["control_before_generate","control_after_generate"].includes(e.name)));if("easy seed"==t.name){const t=this.addWidget("button","🎲 Manual Random Seed",null,(t=>{"fixed"!=o.value&&(o.value="fixed"),e.value=Math.floor(Math.random()*P),n.queuePrompt(0,1)}),{serialize:!1});e.linkedWidgets=[t,o]}},e.prototype.onAdded=async function(){i&&i.apply(this,[]);const e=this.widgets.find((e=>["seed_num","seed"].includes(e.name))),t=this.widgets.find((e=>["control_before_generate","control_after_generate"].includes(e.name)));setTimeout((n=>{"control_before_generate"==t.name&&0===e.value&&(e.value=Math.floor(Math.random()*P))}),1)}),"easy convertAnything"==o&&(e.prototype.onNodeCreated=async function(){r&&r.apply(this,[]);const e=this.widgets.find((e=>"output_type"==e.name)),t=t=>{this.outputs[0].type=e.value.toUpperCase(),this.outputs[0].name=e.value,this.outputs[0].label=e.value};setTimeout((e=>t()),10),e.callback=e=>t()}),"easy imageInsetCrop"==o){let t=function(e){const t=e.widgets[0];for(let n=1;n<=4;n++)"Pixels"===t.value?(e.widgets[n].options.step=80,e.widgets[n].options.max=8192):(e.widgets[n].options.step=10,e.widgets[n].options.max=99)};e.prototype.onAdded=async function(e){const n=this.widgets[0];let o=n.callback;n.callback=(...e)=>{t(this),o&&o.apply(n,[...e])},setTimeout((e=>{t(this)}),1)}}},nodeCreated(e){if(e.comfyClass.startsWith("easy ")){if(e.widgets)for(const n of e.widgets){if(!Up.includes(n.name))continue;let t=n.value;Zp(e,n),Object.defineProperty(n,"value",{get:e=>t,set(o){o!==t&&(t=o,Zp(e,n))}})}const t=e.comfyClass;if("easy preDetailerFix"==t){const t=e.widgets.find((e=>"customtext"===e.type));if(!t)return;t.dynamicPrompts=!1,t.inputEl.placeholder="wildcard spec: if kept empty, this option will be ignored",t.serializeValue=()=>t.value}if("easy wildcards"==t){const t=e.widgets.find((e=>"text"==e.name));let n=1;Object.defineProperty(e.widgets[n],"value",{set:e=>{if((new Error).stack.includes("inner_value_change")&&"Select the LoRA to add to the text"!=e){let n=e;n.endsWith(".safetensors")&&(n=n.slice(0,-12)),t.value+=``}},get:e=>"Select the LoRA to add to the text"}),Object.defineProperty(e.widgets[n+1],"value",{set:e=>{(new Error).stack.includes("inner_value_change")&&"Select the Wildcard to add to the text"!=e&&(""!=t.value&&(t.value+=", "),t.value+=e)},get:e=>"Select the Wildcard to add to the text"}),e.widgets[n].serializeValue=e=>"Select the LoRA to add to the text",e.widgets[n+1].serializeValue=e=>"Select the Wildcard to add to the text"}if(Yp.includes(t)){const t=document.createElement("textarea");t.className="comfy-multiline-input",t.readOnly=!0;const n=e.addDOMWidget("info","customtext",t,{getValue:e=>t.value,setValue:e=>t.value=e,serialize:!1});n.inputEl=t,t.addEventListener("input",(()=>{var e;null==(e=n.callback)||e.call(n,n.value)}))}}}}),y.registerExtension({name:"easy bookmark",registerCustomNodes(){class e{constructor(){v(this,"type","easy bookmark"),v(this,"title","🔖"),v(this,"slot_start_y",-20),v(this,"___collapsed_width",0),v(this,"isVirtualNode",!0),v(this,"serialize_widgets",!0),v(this,"keypressBound",null),this.addWidget("text","shortcut_key","1",(e=>{""!==(e=e.trim()[0]||"1")&&(this.title="🔖 "+e)}),{y:8}),this.addWidget("number","zoom",1,(e=>{}),{y:8+LiteGraph.NODE_WIDGET_HEIGHT+4,max:2,min:.5,precision:2}),this.keypressBound=this.onKeypress.bind(this)}get _collapsed_width(){return this.___collapsed_width}set _collapsed_width(e){const t=y.canvas,n=t.canvas.getContext("2d");if(n){const e=n.font;n.font=t.title_text_font,this.___collapsed_width=40+n.measureText(this.title).width,n.font=e}}onAdded(){setTimeout((e=>{const t=this.widgets[0].value;t&&(this.title="🔖 "+t)}),1),window.addEventListener("keydown",this.keypressBound)}onRemoved(){window.removeEventListener("keydown",this.keypressBound)}onKeypress(e){const t=e.target;["input","textarea"].includes(t.localName)||this.widgets[0]&&e.key.toLocaleLowerCase()===this.widgets[0].value.toLocaleLowerCase()&&this.canvasToBookmark()}canvasToBookmark(){var e,t;const n=y.canvas;(null==(e=null==n?void 0:n.ds)?void 0:e.offset)&&(n.ds.offset[0]=16-this.pos[0],n.ds.offset[1]=40-this.pos[1]),null!=(null==(t=null==n?void 0:n.ds)?void 0:t.scale)&&(n.ds.scale=Number(this.widgets[1].value||1)),n.setDirty(!0,!0)}}LiteGraph.registerNodeType("easy bookmark",Object.assign(e,{title:"Bookmark 🔖"})),e.category="EasyUse/Util"}}),y.registerExtension({name:"Comfy.EasyUse.ChainNode",init(){y.canvas._mousemove_callback=e=>{if(!A("EasyUse.Nodes.ChainGetSet",null,!0))return;((e,t=!1,n={})=>{var o,i,r,s,a;if(0===e.length)return;const l=n.inputX||160,c=n.ouputX||60;if(e.filter((e=>Dp(e))).length>1)return;for(const d of e){let s=0,a=0;const u=n.inputY||10,p=n.outputY||30,f=[];if(d.graph){for(const e of d.inputs??[]){const t=e.link;if(!t)continue;const{origin_id:n,target_slot:o}=Tp(t),i=Cp(n);if(!i)continue;if(!Dp(i))continue;const r=d.getConnectionPos(!0,o);i.pos=[r[0]-l,r[1]+15+s*u],s+=1,f.push(i),i.flags.collapsed=!0}for(const e of d.outputs??[])if(e.links&&d.graph)for(const t of e.links){const{target_id:e}=Tp(t),n=Cp(e);if(!n)continue;if(!Dp(n))continue;const i=null==(o=n.outputs)?void 0:o.links;if((null==i?void 0:i.length)>1)return;const r=d.getConnectionPos(!1,0);n.pos=[r[0]+c,r[1]+15+a*p],a+=1,f.push(n),n.flags.collapsed=!0}if(t&&1===e.length){const e=[d,...f];(null==(r=null==(i=d.graph)?void 0:i.list_of_graphcanvas)?void 0:r[0]).selectNodes(e)}}}const u=e[0];if(!u)return;(null==(a=null==(s=u.graph)?void 0:s.list_of_graphcanvas)?void 0:a[0]).setDirty(!0,!0)})(Ap())};const e=LGraphCanvas.prototype.showLinkMenu;LGraphCanvas.prototype.showLinkMenu=function(t,n){return n.shiftKey?(((e,t=!1)=>{var n,o,i,r,s,a,l,c,u,d;const{type:p}=e;if("*"===p)return;let{origin_id:f,target_id:h,origin_slot:m,target_slot:g}=e,v=Cp(f),y=Cp(h);if(!v||!y)return!1;if("Reroute"===v.type){let e=0;[v,e]=Gp(v),f=null==v?void 0:v.id,m=e,void 0!==m&&-1!==m||(m=0)}if("Reroute"===y.type&&(y=Bp(y),h=null==y?void 0:y.id,g=null==y?void 0:y.inputs.findIndex((e=>e.type===p)),void 0!==g&&-1!==g||(g=0)),void 0===f||void 0===h||!v||!y)return!1;if(t&&(Dp(v)||Dp(y)))return!1;let b=Ip((null==(n=y.getInputInfo(g))?void 0:n.name)??p.toLowerCase());b||(b=Ip((null==(i=null==(o=null==v?void 0:v.outputs)?void 0:o[m])?void 0:i.name)??(null==(s=null==(r=null==v?void 0:v.outputs)?void 0:r[m])?void 0:s.type.toString())??b+`_from_${f}_to_${h}`));let _,w=!1,S=!1;if(Dp(v))b=xp(v),S=!0;else{const e=null==(l=null==(a=v.outputs)?void 0:a[m])?void 0:l.links;if(e)for(const t of e){const e=Cp((null==(c=Tp(t))?void 0:c.target_id)??-1);e&&Dp(e)&&Pp(e)&&(b=xp(e),S=!0)}if(!S){for(const e of jp()){if(b!==xp(e)||!Pp(e))continue;const t=null==(u=e.inputs[0])?void 0:u.link;(null==(d=Tp(t))?void 0:d.origin_id)===v.id?S=!0:w=!0}w&&(b+=`_from_${f}_to_${h}`)}}if(!S){_=LiteGraph.createNode("easy setNode"),_.is_auto_link=!0;const e=v.getConnectionPos(!1,m);_.pos=[e[0]+20,e[1]],_.inputs[0].name=b,_.inputs[0].type=p,_.inputs[0].widget=y.inputs[g].widget,Mp(_,b),Rp(_),_.flags.collapsed=!0;let t=[];v.widgets?t=Object.values(v.widgets).map((e=>e.value)):v.widgets_values&&(t=JSON.parse(JSON.stringify(v.widgets_values))),v.connect(m,_,0),v.widgets_values=t,"PrimitiveNode"===v.type&&setTimeout((()=>{if(v){v.connect(m,_,0);for(const[e,n]of t.entries())Mp(v,n,e);null!==_&&_.setSize(_.computeSize())}}))}const x=LiteGraph.createNode("easy getNode"),k=y.getConnectionPos(!0,g);x.pos=[k[0]-150,k[1]],x.outputs[0].name=b,x.outputs[0].type=p,x.outputs[0].widget=y.inputs[g].widget,Rp(x),Mp(x,b),null===x||(x.flags.collapsed=!0,x.setSize(x.computeSize()),x.connect(0,y,g))})(t),!1):(e.apply(this,[t,n]),!1)}}});let Kp=[];function Xp(e,t,n,o,i){var r=LGraphCanvas.active_canvas,s=r.getCanvasWindow(),a=r.graph;if(a)return function e(t,o){var l=LiteGraph.getNodeTypesCategories(r.filter||a.filter).filter((function(e){return e.startsWith(t)})),c=[];l.map((function(n){if(n){var o=new RegExp("^("+t+")"),i=n.replace(o,"").split("/")[0],r=""===t?i+"/":t+i+"/",s=i;-1!=s.indexOf("::")&&(s=s.split("::")[1]),-1===c.findIndex((function(e){return e.value===r}))&&c.push({value:r,content:s,has_submenu:!0,callback:function(t,n,o,i){e(t.value,i)}})}})),LiteGraph.getNodeTypesInCategory(t.slice(0,-1),r.filter||a.filter).map((function(e){if(!e.skip_list){var t={value:e.type,content:e.title,has_submenu:!1,callback:function(e,t,n,o){var s=o.getFirstEvent();r.graph.beforeChange();var a=LiteGraph.createNode(e.value);a&&(a.pos=r.convertEventToCanvasOffset(s),r.graph.add(a)),i&&i(a),r.graph.afterChange()}};c.push(t)}}));const u=A("EasyUse.ContextMenu.NodesSort",null,!0);""===t&&u&&(c=function(e){let t=[],n=[];return e.forEach((e=>{(null==e?void 0:e.value)&&D.includes(e.value.split("/")[0])?t.push(e):n.push(e)})),[{title:V("ComfyUI Basic"),is_category_title:!0},...t,{title:V("Others A~Z"),is_category_title:!0},...n.sort(((e,t)=>e.content.localeCompare(t.content)))]}(c)),new LiteGraph.ContextMenu(c,{event:n,parentMenu:o},s)}("",o),!1}function Qp(e,t,n){var o=this;n=n||{};var i=document.createElement("div");i.className="litemenu-entry submenu";var r=!1;function s(e){var t=this.value,i=!0;(o.current_submenu&&o.current_submenu.close(e),n.callback)&&(!0===n.callback.call(this,t,n,e,o,n.node)&&(i=!1));if(t){if(t.callback&&!n.ignore_item_callbacks&&!0!==t.disabled)!0===t.callback.call(this,t,n,e,o,n.extra)&&(i=!1);if(t.submenu){if(!t.submenu.options)throw"ContextMenu submenu needs options";new o.constructor(t.submenu.options,{callback:t.submenu.callback,event:e,parentMenu:o,ignore_item_callbacks:t.submenu.ignore_item_callbacks,title:t.submenu.title,extra:t.submenu.extra,autoopen:n.autoopen}),i=!1}}i&&!o.lock&&o.close()}return null===t?i.classList.add("separator"):t.is_category_title?(i.classList.remove("litemenu-entry"),i.classList.remove("submenu"),i.classList.add("litemenu-title"),i.innerHTML=t.title):(i.innerHTML=t&&t.title?t.title:e,i.value=t,t&&(t.disabled&&(r=!0,i.classList.add("disabled")),(t.submenu||t.has_submenu)&&i.classList.add("has_submenu")),"function"==typeof t?(i.dataset.value=e,i.onclick_callback=t):i.dataset.value=t,t.className&&(i.className+=" "+t.className)),this.root.appendChild(i),r||i.addEventListener("click",s),!r&&n.autoopen&&LiteGraph.pointerListenerAdd(i,"enter",(function(e){var t=this.value;if(!t||!t.has_submenu)return;s.call(this,e)})),i}function Jp(e){return e.substring(0,e.lastIndexOf("."))}function qp(e){return e.substring(e.lastIndexOf(".")+1)}y.registerExtension({name:"Comfy.EasyUse.ContextMenu",async setup(){LGraphCanvas.onMenuAdd=Xp;const e=await b.fetchApi("/easyuse/models/thumbnail");if(200===e.status){let t=await e.json();Kp=t}else Fp.error(V("Too many thumbnails, have closed the display"));const t=LiteGraph.ContextMenu;LiteGraph.ContextMenu=function(e,n){var o,i;if(n.parentMenu);else if(n.extra)null==(o=n.extra.constructor)||o.name;else if(n.scale){if(A("EasyUse.ContextMenu.SubDirectories",null,!0)){const o=function(e,t){const n=e,o=[...n],i={},r=[],s=[],a=["ckpt","pt","bin","pth","safetensors"];if((null==e?void 0:e.length)>0){const t=qp(e[e.length-1]);if(!a.includes(t))return null}for(const l of n){const e=l.indexOf("/")>-1?"/":"\\",t=l.split(e);if(t.length>1){const n=t.shift();i[n]=i[n]||[],i[n].push(t.join(e))}else"CHOOSE"===l||l.startsWith("DISABLE ")?r.push(l):s.push(l)}if(Object.values(i).length>0){const e=t.callback;t.callback=null;const n=(t,n)=>{["None","无","無","なし"].includes(t.content)?e("None",n):e(o.find((e=>e.endsWith(t.content)),n))},l=(e,t="")=>{const o=t?t+"\\"+Jp(e):Jp(e),i=qp(e),r=(new Date).getTime();let s,l="";if(a.includes(i))for(let n=0;n{let n=[],o=[];const r=e.map((e=>{const r={},s=e.indexOf("/")>-1?"/":"\\",a=e.split(s);if(a.length>1){const e=a.shift();r[e]=r[e]||[],r[e].push(a.join(s))}if(Object.values(i).length>0){let t=Object.keys(r)[0];t&&r[t]?n.push({key:t,value:r[t][0]}):o.push(l(e,t))}return l(e,t)}));if(n.length>0){let e={};return n.forEach((t=>{e[t.key]=e[t.key]||[],e[t.key].push(t.value)})),[...Object.entries(e).map((e=>({content:e[0],has_submenu:!0,callback:()=>{},submenu:{options:u(e[1],e[0])}}))),...o]}return r};for(const[t,o]of Object.entries(i))c.push({content:t,has_submenu:!0,callback:()=>{},submenu:{options:u(o,t)}});return c.push(...s.map((e=>l(e,"")))),r.length>0&&c.push(...r.map((e=>l(e,"")))),c}return null}(e,n);if(o)return t.call(this,o,n)}}else n.hasOwnProperty("extra")&&(e.unshift(null),i=window.location.host,["192.168.","10.","127.",/^172\.((1[6-9]|2[0-9]|3[0-1])\.)/].some((e=>"string"==typeof e?i.startsWith(e):e.test(i)))&&e.unshift({content:`${V("Reboot ComfyUI")}`,callback:e=>async function(){if(confirm(V("Are you sure you'd like to reboot the server?")))try{b.fetchApi("/easyuse/reboot")}catch(e){}}()}),e.unshift({content:`${V("Cleanup Of GPU Usage")}`,callback:e=>async function(){try{const{Running:e,Pending:t}=await b.getQueue();if(e.length>0||t.length>0)return void Fp.error(V("Clean Failed")+":"+V("Please stop all running tasks before cleaning GPU"));200==(await b.fetchApi("/easyuse/cleangpu",{method:"POST"})).status?Fp.success(V("Clean SuccessFully")):Fp.error(V("Clean Failed"))}catch(e){}}()}));return t.apply(this,[...arguments])},LiteGraph.ContextMenu.prototype=t.prototype,LiteGraph.ContextMenu.prototype.addItem=Qp}});class ef extends w{constructor(){super(),this.element.classList.add("easyuse-model-metadata")}show(e){super.show(_("div",Object.keys(e).map((t=>_("div",[_("label",{textContent:t}),_("span",{textContent:e[t]})])))))}}class tf extends w{constructor(e){super(),this.name=e,this.element.classList.add("easyuse-model-info")}get customNotes(){return this.metadata["easyuse.notes"]}set customNotes(e){this.metadata["easyuse.notes"]=e}get hash(){return this.metadata["easyuse.sha256"]}async show(e,t){this.type=e;const n=b.fetchApi("/easyuse/metadata/"+encodeURIComponent(`${e}/${t}`));this.info=_("div",{style:{flex:"auto"}}),this.imgCurrent=0,this.imgList=_("div.easyuse-preview-list",{style:{display:"none"}}),this.imgWrapper=_("div.easyuse-preview",[_("div.easyuse-preview-group",[this.imgList])]),this.main=_("main",{style:{display:"flex"}},[this.imgWrapper,this.info]),this.content=_("div.easyuse-model-content",[_("div.easyuse-model-header",[_("h2",{textContent:this.name})]),this.main]);const o=_("div",{textContent:"ℹ️ Loading...",parent:this.content});super.show(this.content),this.metadata=await(await n).json(),this.viewMetadata.style.cursor=this.viewMetadata.style.opacity="",this.viewMetadata.removeAttribute("disabled"),o.remove(),this.addInfo()}createButtons(){const e=super.createButtons();return this.viewMetadata=_("button",{type:"button",textContent:"View raw metadata",disabled:"disabled",style:{opacity:.5,cursor:"not-allowed"},onclick:e=>{this.metadata&&(new ef).show(this.metadata)}}),e.unshift(this.viewMetadata),e}parseNote(){if(!this.customNotes)return[];let e=[];const t=new RegExp("(\\bhttps?:\\/\\/[^\\s]+)","g");let n,o=0;do{let i;n=t.exec(this.customNotes);let r=0;n?(i=n.index,r=n.index+n[0].length):i=this.customNotes.length;let s=this.customNotes.substring(o,i);s&&(s=s.replaceAll("\n","
"),e.push(_("span",{innerHTML:s}))),n&&e.push(_("a",{href:n[0],textContent:n[0],target:"_blank"})),o=r}while(n);return e}addInfoEntry(e,t){return _("p",{parent:this.info},["string"==typeof e?_("label",{textContent:e+": "}):e,"string"==typeof t?_("span",{textContent:t}):t])}async getCivitaiDetails(){const e=await fetch("https://civitai.com/api/v1/model-versions/by-hash/"+this.hash);if(200===e.status)return await e.json();throw 404===e.status?new Error("Model not found"):new Error(`Error loading info (${e.status}) ${e.statusText}`)}addCivitaiInfo(){const e=this.getCivitaiDetails(),t=_("span",{textContent:"ℹ️ Loading..."});return this.addInfoEntry(_("label",[_("img",{style:{width:"18px",position:"relative",top:"3px",margin:"0 5px 0 0"},src:"https://civitai.com/favicon.ico"}),_("span",{textContent:"Civitai: "})]),t),e.then((e=>{var t,n;this.imgWrapper.style.display="block";let o=this.element.querySelector(".easyuse-model-header");o&&o.replaceChildren(_("h2",{textContent:this.name}),_("div.easyuse-model-header-remark",[_("h5",{textContent:V("Updated At:")+O(new Date(e.updatedAt),"yyyy/MM/dd")}),_("h5",{textContent:V("Created At:")+O(new Date(e.updatedAt),"yyyy/MM/dd")})]));let i=null,r=this.parseNote.call(this),s=V("✏️ Edit"),a=_("div.easyuse-model-detail-textarea",[_("p",(null==r?void 0:r.length)>0?r:{textContent:V("No notes")})]);if(r&&0!=r.length?a.classList.remove("empty"):a.classList.add("empty"),this.info.replaceChildren(_("div.easyuse-model-detail",[_("div.easyuse-model-detail-head.flex-b",[_("span",V("Notes")),_("a",{textContent:s,href:"#",style:{fontSize:"12px",float:"right",color:"var(--warning-color)",textDecoration:"none"},onclick:async e=>{if(e.preventDefault(),i){if(i.value!=this.customNotes){toast.showLoading(V("Saving Notes...")),this.customNotes=i.value;const e=await b.fetchApi("/easyuse/metadata/notes/"+encodeURIComponent(`${this.type}/${this.name}`),{method:"POST",body:this.customNotes});if(toast.hideLoading(),200!==e.status)return toast.error(V("Saving Failed")),void alert(`Error saving notes (${e.status}) ${e.statusText}`);toast.success(V("Saving Succeed")),r=this.parseNote.call(this),a.replaceChildren(_("p",(null==r?void 0:r.length)>0?r:{textContent:V("No notes")})),i.value?a.classList.remove("empty"):a.classList.add("empty")}else a.replaceChildren(_("p",{textContent:V("No notes")})),a.classList.add("empty");e.target.textContent=s,i.remove(),i=null}else e.target.textContent="💾 Save",i=_("textarea",{placeholder:V("Type your notes here"),style:{width:"100%",minWidth:"200px",minHeight:"50px",height:"100px"},textContent:this.customNotes}),a.replaceChildren(i),i.focus()}})]),a]),_("div.easyuse-model-detail",[_("div.easyuse-model-detail-head",{textContent:V("Details")}),_("div.easyuse-model-detail-body",[_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("Type")}),_("div.easyuse-model-detail-item-value",{textContent:e.model.type})]),_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("BaseModel")}),_("div.easyuse-model-detail-item-value",{textContent:e.baseModel})]),_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("Download")}),_("div.easyuse-model-detail-item-value",{textContent:(null==(t=e.stats)?void 0:t.downloadCount)||0})]),_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("Trained Words")}),_("div.easyuse-model-detail-item-value",{textContent:(null==e?void 0:e.trainedWords.join(","))||"-"})]),_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("Source")}),_("div.easyuse-model-detail-item-value",[_("label",[_("img",{style:{width:"14px",position:"relative",top:"3px",margin:"0 5px 0 0"},src:"https://civitai.com/favicon.ico"}),_("a",{href:"https://civitai.com/models/"+e.modelId,textContent:"View "+e.model.name,target:"_blank"})])])])])])),null==(n=e.images)?void 0:n.length){this.imgCurrent=0,this.isSaving=!1,e.images.map((e=>e.url&&this.imgList.appendChild(_("div.easyuse-preview-slide",[_("div.easyuse-preview-slide-content",[_("img",{src:e.url}),_("div.save",{textContent:"Save as preview",onclick:async()=>{if(this.isSaving)return;this.isSaving=!0,toast.showLoading(V("Saving Preview..."));const t=await(await fetch(e.url)).blob(),n="temp_preview."+new URL(e.url).pathname.split(".")[1],o=new FormData;o.append("image",new File([t],n)),o.append("overwrite","true"),o.append("type","temp");if(200!==(await b.fetchApi("/upload/image",{method:"POST",body:o})).status)return this.isSaving=!1,toast.error(V("Saving Failed")),toast.hideLoading(),void alert(`Error saving preview (${req.status}) ${req.statusText}`);await b.fetchApi("/easyuse/save/"+encodeURIComponent(`${this.type}/${this.name}`),{method:"POST",body:JSON.stringify({filename:n,type:"temp"}),headers:{"content-type":"application/json"}}).then((e=>{toast.success(V("Saving Succeed")),toast.hideLoading()})),this.isSaving=!1,app.refreshComboInNodes()}})])]))));let t=this;this.imgDistance=(-660*this.imgCurrent).toString(),this.imgList.style.display="",this.imgList.style.transform="translate3d("+this.imgDistance+"px, 0px, 0px)",this.slides=this.imgList.querySelectorAll(".easyuse-preview-slide"),this.slideLeftButton=_("button.left",{parent:this.imgWrapper,style:{display:e.images.length<=2?"none":"block"},innerHTML:'',onclick:()=>{e.images.length<=2||(t.imgList.classList.remove("no-transition"),0==t.imgCurrent?(t.imgCurrent=e.images.length/2-1,this.slides[this.slides.length-1].style.transform="translate3d("+(-660*(this.imgCurrent+1)).toString()+"px, 0px, 0px)",this.slides[this.slides.length-2].style.transform="translate3d("+(-660*(this.imgCurrent+1)).toString()+"px, 0px, 0px)",t.imgList.style.transform="translate3d(660px, 0px, 0px)",setTimeout((e=>{this.slides[this.slides.length-1].style.transform="translate3d(0px, 0px, 0px)",this.slides[this.slides.length-2].style.transform="translate3d(0px, 0px, 0px)",t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)",t.imgList.classList.add("no-transition")}),500)):(t.imgCurrent=t.imgCurrent-1,t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)"))}}),this.slideRightButton=_("button.right",{parent:this.imgWrapper,style:{display:e.images.length<=2?"none":"block"},innerHTML:'',onclick:()=>{if(!(e.images.length<=2))if(t.imgList.classList.remove("no-transition"),t.imgCurrent>=e.images.length/2-1){t.imgCurrent=0;const n=e.images.length/2;this.slides[0].style.transform="translate3d("+(660*n).toString()+"px, 0px, 0px)",this.slides[1].style.transform="translate3d("+(660*n).toString()+"px, 0px, 0px)",t.imgList.style.transform="translate3d("+(-660*n).toString()+"px, 0px, 0px)",setTimeout((e=>{this.slides[0].style.transform="translate3d(0px, 0px, 0px)",this.slides[1].style.transform="translate3d(0px, 0px, 0px)",t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)",t.imgList.classList.add("no-transition")}),500)}else t.imgCurrent=t.imgCurrent+1,t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)"}})}return e.description&&_("div",{parent:this.content,innerHTML:e.description,style:{marginTop:"10px"}}),e})).catch((e=>{this.imgWrapper.style.display="none",t.textContent="⚠️ "+e.message})).finally((e=>{}))}}class nf extends tf{async addInfo(){await this.addCivitaiInfo()}}class of extends tf{getTagFrequency(){if(!this.metadata.ss_tag_frequency)return[];const e=JSON.parse(this.metadata.ss_tag_frequency),t={};for(const n in e){const o=e[n];for(const e in o)e in t?t[e]+=o[e]:t[e]=o[e]}return Object.entries(t).sort(((e,t)=>t[1]-e[1]))}getResolutions(){let e=[];if(this.metadata.ss_bucket_info){const t=JSON.parse(this.metadata.ss_bucket_info);if(null==t?void 0:t.buckets)for(const{resolution:n,count:o}of Object.values(t.buckets))e.push([o,`${n.join("x")} * ${o}`])}e=e.sort(((e,t)=>t[0]-e[0])).map((e=>e[1]));let t=this.metadata.ss_resolution;if(t){const n=t.split(","),o=n[0].replace("(",""),i=n[1].replace(")","");e.push(`${o.trim()}x${i.trim()} (Base res)`)}else(t=this.metadata["modelspec.resolution"])&&e.push(t+" (Base res");return e.length||e.push("⚠️ Unknown"),e}getTagList(e){return e.map((e=>_("li.easyuse-model-tag",{dataset:{tag:e[0]},$:e=>{e.onclick=()=>{e.classList.toggle("easyuse-model-tag--selected")}}},[_("p",{textContent:e[0]}),_("span",{textContent:e[1]})])))}addTags(){let e,t=this.getTagFrequency();if(null==t?void 0:t.length){const n=t.length;let o;n>500&&(t=t.slice(0,500),e=_("p",[_("span",{textContent:"⚠️ Only showing first 500 tags "}),_("a",{href:"#",textContent:`Show all ${n}`,onclick:()=>{o.replaceChildren(...this.getTagList(this.getTagFrequency())),e.remove()}})])),o=_("ol.easyuse-model-tags-list",this.getTagList(t)),this.tags=_("div",[o])}else this.tags=_("p",{textContent:"⚠️ No tag frequency metadata found"});this.content.append(this.tags),e&&this.content.append(e)}async addInfo(){const e=this.addCivitaiInfo();this.addTags();const t=await e;t&&_("div",{parent:this.content,innerHTML:t.description,style:{maxHeight:"250px",overflow:"auto"}})}createButtons(){const e=super.createButtons();function t(e,t){const n=_("textarea",{parent:document.body,style:{position:"fixed"},textContent:t.map((e=>e.dataset.tag)).join(", ")});n.select();try{document.execCommand("copy"),e.target.dataset.text||(e.target.dataset.text=e.target.textContent),e.target.textContent="Copied "+t.length+" tags",setTimeout((()=>{e.target.textContent=e.target.dataset.text}),1e3)}catch(o){prompt("Copy to clipboard: Ctrl+C, Enter",text)}finally{document.body.removeChild(n)}}return e.unshift(_("button",{type:"button",textContent:"Copy Selected",onclick:e=>{t(e,[...this.tags.querySelectorAll(".easyuse-model-tag--selected")])}}),_("button",{type:"button",textContent:"Copy All",onclick:e=>{t(e,[...this.tags.querySelectorAll(".easyuse-model-tag")])}})),e}}const rf=["easy fullLoader","easy a1111Loader","easy comfyLoader","easy kolorsLoader","easy hunyuanDiTLoader","easy pixArtLoader"],sf=["easy preSampling","easy preSamplingAdvanced","easy preSamplingDynamicCFG","easy preSamplingNoiseIn","easy preSamplingCustom","easy preSamplingLayerDiffusion","easy fullkSampler"],af=["KSamplerSelect","SamplerEulerAncestral","SamplerEulerAncestralCFG++","SamplerLMS","SamplerDPMPP_3M_SDE","SamplerDPMPP_2M_SDE","SamplerDPMPP_SDE","SamplerDPMAdaptative","SamplerLCMUpscale","SamplerTCD","SamplerTCD EulerA"],lf=["BasicScheduler","KarrasScheduler","ExponentialScheduler","PolyexponentialScheduler","VPScheduler","BetaSamplingScheduler","SDTurboScheduler","SplitSigmas","SplitSigmasDenoise","FlipSigmas","AlignYourStepsScheduler","GITSScheduler"],cf=["easy kSampler","easy kSamplerTiled","easy kSamplerInpainting","easy kSamplerDownscaleUnet","easy kSamplerLayerDiffusion"],uf=["easy controlnetLoader","easy controlnetLoaderADV","easy controlnetLoader++","easy instantIDApply","easy instantIDApplyADV"],df=["easy ipadapterApply","easy ipadapterApplyADV","easy ipadapterApplyFaceIDKolors","easy ipadapterStyleComposition","easy ipadapterApplyFromParams","easy pulIDApply","easy pulIDApplyADV"],pf=["easy positive","easy wildcards"],ff=["easy loadImageBase64","LoadImage","LoadImageMask"],hf=["easy applyBrushNet","easy applyPowerPaint","easy applyInpaint"],mf={positive_prompt:{text:"positive",positive:"text"},loaders:{ckpt_name:"ckpt_name",vae_name:"vae_name",clip_skip:"clip_skip",lora_name:"lora_name",resolution:"resolution",empty_latent_width:"empty_latent_width",empty_latent_height:"empty_latent_height",positive:"positive",negative:"negative",batch_size:"batch_size",a1111_prompt_style:"a1111_prompt_style"},preSampling:{steps:"steps",cfg:"cfg",cfg_scale_min:"cfg",sampler_name:"sampler_name",scheduler:"scheduler",denoise:"denoise",seed_num:"seed_num",seed:"seed"},kSampler:{image_output:"image_output",save_prefix:"save_prefix",link_id:"link_id"},controlnet:{control_net_name:"control_net_name",strength:["strength","cn_strength"],scale_soft_weights:["scale_soft_weights","cn_soft_weights"],cn_strength:["strength","cn_strength"],cn_soft_weights:["scale_soft_weights","cn_soft_weights"]},ipadapter:{preset:"preset",lora_strength:"lora_strength",provider:"provider",weight:"weight",weight_faceidv2:"weight_faceidv2",start_at:"start_at",end_at:"end_at",cache_mode:"cache_mode",use_tiled:"use_tiled",insightface:"insightface",pulid_file:"pulid_file"},load_image:{image:"image",base64_data:"base64_data",channel:"channel"},inpaint:{dtype:"dtype",fitting:"fitting",function:"function",scale:"scale",start_at:"start_at",end_at:"end_at"},sampler:{},sigmas:{}},gf={loaders:{optional_lora_stack:"optional_lora_stack",positive:"positive",negative:"negative"},preSampling:{pipe:"pipe",image_to_latent:"image_to_latent",latent:"latent"},kSampler:{pipe:"pipe",model:"model"},controlnet:{pipe:"pipe",image:"image",image_kps:"image_kps",control_net:"control_net",positive:"positive",negative:"negative",mask:"mask"},positive_prompt:{},ipadapter:{model:"model",image:"image",image_style:"image",attn_mask:"attn_mask",optional_ipadapter:"optional_ipadapter"},inpaint:{pipe:"pipe",image:"image",mask:"mask"},sampler:{},sigmas:{}},vf={loaders:{pipe:"pipe",model:"model",vae:"vae",clip:null,positive:null,negative:null,latent:null},preSampling:{pipe:"pipe"},kSampler:{pipe:"pipe",image:"image"},controlnet:{pipe:"pipe",positive:"positive",negative:"negative"},positive_prompt:{text:"positive",positive:"text"},load_image:{IMAGE:"IMAGE",MASK:"MASK"},ipadapter:{model:"model",tiles:"tiles",masks:"masks",ipadapter:"ipadapter"},inpaint:{pipe:"pipe"},sampler:{SAMPLER:"SAMPLER"},sigmas:{SIGMAS:"SIGMAS"}};function yf(e,t,n){return function(){!function(e,t,n){const o=LiteGraph.createNode(t);if(o){if(y.graph.add(o),o.pos=e.pos.slice(),o.size=e.size.slice(),e.widgets.forEach((e=>{if(mf[n][e.name]){const i=mf[n][e.name];if(i){const n=(t=i,o.widgets.find((e=>"object"==typeof t?t.includes(e.name):e.name===t)));n&&(n.value=e.value,"seed_num"==e.name&&(n.linkedWidgets[0].value=e.linkedWidgets[0].value),"converted-widget"==e.type&&Cf(o,n,e))}}var t})),e.inputs&&e.inputs.forEach(((t,i)=>{if(t&&t.link&&gf[n][t.name]){const i=gf[n][t.name];if(null===i)return;const r=o.findInputSlot(i);if(-1!==r){const n=e.graph.links[t.link];if(n){const t=e.graph.getNodeById(n.origin_id);t&&t.connect(n.origin_slot,o,r)}}}})),e.outputs&&e.outputs.forEach(((t,i)=>{if(t&&t.links&&vf[n]&&vf[n][t.name]){const i=vf[n][t.name];if(null===i)return;const r=o.findOutputSlot(i);-1!==r&&t.links.forEach((t=>{const n=e.graph.links[t];if(n){const t=e.graph.getNodeById(n.target_id);t&&o.connect(r,t,n.target_slot)}}))}})),y.graph.remove(e),"easy fullkSampler"==o.type){const e=o.outputs[0].links;if(e&&e[0]){const t=y.graph._nodes.find((t=>t.inputs&&t.inputs[0]&&t.inputs[0].link==e[0]));t&&y.graph.remove(t)}}else if(sf.includes(o.type)){const e=o.outputs[0].links;if(!e||!e[0]){const e=LiteGraph.createNode("easy kSampler");y.graph.add(e),e.pos=o.pos.slice(),e.pos[0]=e.pos[0]+o.size[0]+20;const t=o.findInputSlot("pipe");-1!==t&&o&&o.connect(0,e,t)}}o.setSize([o.size[0],o.computeSize()[1]])}}(e,t,n)}}const bf=(e,t)=>{const n=e.prototype.getExtraMenuOptions;e.prototype.getExtraMenuOptions=function(){const e=n.apply(this,arguments);return t.apply(this,arguments),e}},_f=(e,t,n,o,i=!0)=>{bf(o,(function(o,r){r.unshift({content:e,has_submenu:i,callback:(e,o,i,r,s)=>wf(e,o,i,r,s,t,n)}),"loaders"==t&&(r.unshift({content:V("💎 View Lora Info..."),callback:(e,t,n,o,i)=>{let r=i.widgets.find((e=>"lora_name"==e.name)).value;r&&"None"!=r&&new of(r).show("loras",r)}}),r.unshift({content:V("💎 View Checkpoint Info..."),callback:(e,t,n,o,i)=>{let r=i.widgets[0].value;r&&"None"!=r&&new nf(r).show("checkpoints",r)}}))}))},wf=(e,t,n,o,i,r,s)=>{const a=[];return s.map((e=>{i.type!==e&&a.push({content:`${e}`,callback:yf(i,e,r)})})),new LiteGraph.ContextMenu(a,{event:n,callback:null,parentMenu:o,node:i}),!1},Sf="converted-widget",xf=Symbol();function kf(e,t,n=""){if(t.origType=t.type,t.origComputeSize=t.computeSize,t.origSerializeValue=t.serializeValue,t.computeSize=()=>[0,-4],t.type=Sf+n,t.serializeValue=()=>{if(!e.inputs)return;let n=e.inputs.find((e=>{var n;return(null==(n=e.widget)?void 0:n.name)===t.name}));return n&&n.link?t.origSerializeValue?t.origSerializeValue():t.value:void 0},t.linkedWidgets)for(const o of t.linkedWidgets)kf(e,o,":"+t.name)}function Cf(e,t,n){kf(e,t);const{type:o}=function(e){let t=e[0];t instanceof Array&&(t="COMBO");return{type:t}}(n),i=e.size;t.options&&t.options.forceInput||e.addInput(t.name,o,{widget:{name:t.name,[xf]:()=>n}});for(const r of e.widgets)r.last_y+=LiteGraph.NODE_SLOT_HEIGHT;e.setSize([Math.max(i[0],e.size[0]),Math.max(i[1],e.size[1])])}const Af=function(e){var t,n,o,i;const r=e.constructor.type,s=e.properties.origVals||{},a=s.title||e.title,l=s.color||e.color,c=s.bgcolor||e.bgcolor,u=e,d={size:[...e.size],color:l,bgcolor:c,pos:[...e.pos]};let p=[],f=[];if(e.inputs)for(const y of e.inputs)if(y.link){const t=y.name,n=e.findInputSlot(t),o=e.getInputNode(n),i=e.getInputLink(n);p.push([i.origin_slot,o,t])}if(e.outputs)for(const y of e.outputs)if(y.links){const e=y.name;for(const t of y.links){const n=graph.links[t],o=graph._nodes_by_id[n.target_id];f.push([e,o,n.target_slot])}}y.graph.remove(e);const h=y.graph.add(LiteGraph.createNode(r,a,d));function m(){if(u.widgets)for(let e of u.widgets)if("converted-widget"===e.type){const t=h.widgets.find((t=>t.name===e.name));for(let n of u.inputs)n.name===e.name&&Cf(h,t,n.widget)}for(let e of p){const[t,n,o]=e;n.connect(t,h.id,o)}for(let e of f){const[t,n,o]=e;h.connect(t,n,o)}}let g=u.widgets_values;if(!g&&(null==(t=h.widgets)?void 0:t.length)>0)return h.widgets.forEach(((e,t)=>{const n=u.widgets[t];e.name===n.name&&e.type===n.type&&(e.value=n.value)})),void m();const v=(null==g?void 0:g.length)<=(null==(n=h.widgets)?void 0:n.length);let b=v?0:g.length-1;function _(e,t){var n,o,i,r,s,a;if(!0===e||!1===e){if((null==(n=t.options)?void 0:n.on)&&(null==(o=t.options)?void 0:o.off))return{value:e,pass:!0}}else if("number"==typeof e){if((null==(i=t.options)?void 0:i.min)<=e&&e<=(null==(r=t.options)?void 0:r.max))return{value:e,pass:!0}}else{if(null==(a=null==(s=t.options)?void 0:s.values)?void 0:a.includes(e))return{value:e,pass:!0};if(t.inputEl&&"string"==typeof e)return{value:e,pass:!0}}return{value:t.value,pass:!1}}const w=e=>{var t;const n=u.widgets[e];let o=h.widgets[e];if(o.name===n.name&&o.type===n.type){for(;v?b=0;){let{value:e,pass:t}=_(g[b],o);if(t&&null!==e){o.value=e;break}b+=v?1:-1}b++,v||(b=g.length-((null==(t=h.widgets)?void 0:t.length)-1-e))}};if(v&&(null==(o=h.widgets)?void 0:o.length)>0)for(let y=0;y0)for(let y=h.widgets.length-1;y>=0;y--)w(y);m()};y.registerExtension({name:"Comfy.EasyUse.ExtraMenu",async beforeRegisterNodeDef(e,t,n){bf(e,(function(e,n){n.unshift({content:V("🔃 Reload Node"),callback:(e,t,n,o,i)=>{let r=LGraphCanvas.active_canvas;if(!r.selected_nodes||Object.keys(r.selected_nodes).length<=1)Af(i);else for(let s in r.selected_nodes)Af(r.selected_nodes[s])}}),"easy ckptNames"==t.name&&n.unshift({content:V("💎 View Checkpoint Info..."),callback:(e,t,n,o,i)=>{i.widgets[0].value}})})),pf.includes(t.name)&&_f("↪️ Swap EasyPrompt","positive_prompt",pf,e),rf.includes(t.name)&&_f("↪️ Swap EasyLoader","loaders",rf,e),sf.includes(t.name)&&_f("↪️ Swap EasyPreSampling","preSampling",sf,e),cf.includes(t.name)&&_f("↪️ Swap EasyKSampler","preSampling",cf,e),af.includes(t.name)&&_f("↪️ Swap Custom Sampler","sampler",af,e),lf.includes(t.name)&&_f("↪️ Swap Custom Sigmas","sigmas",lf,e),uf.includes(t.name)&&_f("↪️ Swap EasyControlnet","controlnet",uf,e),df.includes(t.name)&&_f("↪️ Swap EasyAdapater","ipadapter",df,e),ff.includes(t.name)&&_f("↪️ Swap LoadImage","load_image",ff,e),hf.includes(t.name)&&_f("↪️ Swap InpaintNode","inpaint",hf,e)}});const Ef="➡️";y.registerExtension({name:"easy setNode",registerCustomNodes(){class e{constructor(){v(this,"defaultVisibility",!0),v(this,"serialize_widgets",!0),this.properties||(this.properties={previousName:""}),this.properties.showOutputText=e.defaultVisibility;const t=this;t.color=LGraphCanvas.node_colors.blue.color,this.addWidget("text","Constant","",((e,n,o,i,r)=>{t.validateName(t.graph),""!==this.widgets[0].value&&(this.title=Ef+this.widgets[0].value),this.update(),this.properties.previousName=this.widgets[0].value}),{}),this.addInput("*","*"),this.onConnectionsChange=function(e,n,o,i,r){if(1!=e||o||(this.inputs[n].type="*",this.inputs[n].name="*",this.title="Set"),i&&t.graph&&1==e&&o){const e=t.graph._nodes.find((e=>e.id==i.origin_id)).outputs[i.origin_slot],n=e.type,o=t.is_auto_link?this.widgets[0].value:e.name;"Set"===this.title&&(this.title=Ef+o,this.widgets[0].value=o),"*"===this.widgets[0].value&&(this.widgets[0].value=o),this.validateName(t.graph),this.inputs[0].type=n,this.inputs[0].name=o,setTimeout((e=>{this.title=Ef+this.widgets[0].value}),1)}this.update()},this.validateName=function(e){let n=t.widgets[0].value;if(""!=n){let o=0,i=[];do{i=e._nodes.filter((e=>e!=this&&("easy setNode"==e.type&&e.widgets[0].value===n))),i.length>0&&(n=t.widgets[0].value+o),o++}while(i.length>0);t.widgets[0].value=n,this.update()}},this.clone=function(){const t=e.prototype.clone.apply(this);return t.inputs[0].name="*",t.inputs[0].type="*",t.properties.previousName="",t.size=t.computeSize(),t},this.onAdded=function(e){this.validateName(e)},this.update=function(){if(t.graph){this.findGetters(t.graph).forEach((e=>{e.setType(this.inputs[0].type)})),this.widgets[0].value&&this.findGetters(t.graph,!0).forEach((e=>{e.setName(this.widgets[0].value)}));t.graph._nodes.filter((e=>"easy getNode"==e.type)).forEach((e=>{e.setComboValues&&e.setComboValues()}))}},this.findGetters=function(e,t){const n=t?this.properties.previousName:this.widgets[0].value;return e._nodes.filter((e=>"easy getNode"==e.type&&e.widgets[0].value===n&&""!=n))},this.isVirtualNode=!0}onRemoved(){this.graph._nodes.filter((e=>"easy getNode"==e.type)).forEach((e=>{e.setComboValues&&e.setComboValues([this])}))}}LiteGraph.registerNodeType("easy setNode",Object.assign(e,{title:"Set"})),e.category="EasyUse/Util"}}),y.registerExtension({name:"easy getNode",registerCustomNodes(){class e{constructor(){v(this,"defaultVisibility",!0),v(this,"serialize_widgets",!0),this.properties||(this.properties={}),this.properties.showOutputText=e.defaultVisibility;const t=this;t.color=LGraphCanvas.node_colors.blue.color,this.addWidget("combo","Constant","",(e=>{this.onRename()}),{values:()=>t.graph._nodes.filter((e=>"easy setNode"==e.type)).map((e=>e.widgets[0].value)).sort()}),this.addOutput("*","*"),this.onConnectionsChange=function(e,t,n,o,i){this.validateLinks(),2!=e||n?(this.onRename(),setTimeout((e=>{this.title="⬅️"+this.widgets[0].value}),1)):(this.outputs[t].type="*",this.outputs[t].name="*",this.title="Get")},this.setName=function(e){t.widgets[0].value=e,t.onRename(),t.serialize()},this.onRename=function(e=0){const n=this.findSetter(t.graph);if(n){const t=n.inputs[0].type,o=n.inputs[0].name;this.setType(t,o),this.outputs[e].type=t,this.outputs[e].name=o,this.title="⬅️"+n.widgets[0].value}else this.setType("*","*"),this.outputs[e].type="*",this.outputs[e].name="*"},this.clone=function(){const t=e.prototype.clone.apply(this);return t.size=t.computeSize(),t},this.validateLinks=function(){"*"!=this.outputs[0].type&&this.outputs[0].links&&this.outputs[0].links.forEach((e=>{const n=t.graph.links[e];n&&n.type!=this.outputs[0].type&&"*"!=n.type&&t.graph.removeLink(e)}))},this.setType=function(e,t){this.outputs[0].name=t,this.outputs[0].type=e,this.validateLinks()},this.findSetter=function(e){const t=this.widgets[0].value;return e._nodes.find((e=>"easy setNode"==e.type&&e.widgets[0].value===t&&""!=t))},this.isVirtualNode=!0}getInputLink(e){const t=this.findSetter(this.graph);if(t){const n=t.inputs[e];return this.graph.links[n.link]}throw new Error("No setter found for "+this.widgets[0].value+"("+this.type+")")}onAdded(e){}}LiteGraph.registerNodeType("easy getNode",Object.assign(e,{title:"Get"})),e.category="EasyUse/Util"}}),b.addEventListener("easyuse-global-seed",(function(e){let t=app.graph._nodes_by_id;for(let n in t){let o=t[n];if("easy globalSeed"==o.type){if(o.widgets){const t=o.widgets.find((e=>"value"==e.name));o.widgets.find((e=>"last_seed"==e.name)).value=t.value,t.value=e.detail.value}}else if(o.widgets){const t=o.widgets.find((e=>"seed_num"==e.name||"seed"==e.name||"noise_seed"==e.name));t&&null!=e.detail.seed_map[o.id]&&(t.value=e.detail.seed_map[o.id])}}}));const Of=b.queuePrompt;b.queuePrompt=async function(e,{output:t,workflow:n}){n.seed_widgets={};for(let o in app.graph._nodes_by_id){let e=app.graph._nodes_by_id[o].widgets;if(e)for(let t in e)"seed_num"!=e[t].name&&"seed"!=e[t].name&&"noise_seed"!=e[t].name||"converted-widget"==e[t].type||(n.seed_widgets[o]=parseInt(t))}return await Of.call(b,e,{output:t,workflow:n})};const Lf=["easy imageSave","easy fullkSampler","easy kSampler","easy kSamplerTiled","easy kSamplerInpainting","easy kSamplerDownscaleUnet","easy kSamplerSDTurbo","easy detailerFix"];y.registerExtension({name:"Comfy.EasyUse.SaveImageExtraOutput",async beforeRegisterNodeDef(e,t,n){if(Lf.includes(t.name)){const t=e.prototype.onNodeCreated;e.prototype.onNodeCreated=function(){const e=t?t.apply(this,arguments):void 0,o=this.widgets.find((e=>"filename_prefix"===e.name||"save_prefix"===e.name));return o.serializeValue=()=>x(n,o.value),e}}else{const t=e.prototype.onNodeCreated;e.prototype.onNodeCreated=function(){const e=t?t.apply(this,arguments):void 0;return this.properties&&"Node name for S&R"in this.properties||this.addProperty("Node name for S&R",this.constructor.type,"string"),e}}}});const Tf=["easy wildcards","easy positive","easy negative","easy stylesSelector","easy promptConcat","easy promptReplace"],If=["easy preSampling","easy preSamplingAdvanced","easy preSamplingNoiseIn","easy preSamplingCustom","easy preSamplingDynamicCFG","easy preSamplingSdTurbo","easy preSamplingLayerDiffusion"],Nf=["easy kSampler","easy kSamplerTiled","easy kSamplerInpainting","easy kSamplerDownscaleUnet","easy kSamplerSDTurbo"],Pf=["easy controlnetLoader","easy controlnetLoaderADV"],Df=["easy instantIDApply","easy instantIDApplyADV"],jf=["easy ipadapterApply","easy ipadapterApplyADV","easy ipadapterApplyFaceIDKolors","easy ipadapterStyleComposition"],Mf=["easy pipeIn","easy pipeOut","easy pipeEdit"],Rf=["easy XYPlot","easy XYPlotAdvanced"],$f=["easy setNode"],Gf=["Reroute","RescaleCFG","LoraLoaderModelOnly","LoraLoader","FreeU","FreeU_v2",...jf,...$f],Bf={"easy seed":{from:{INT:["Reroute",...If,"easy fullkSampler"]}},"easy positive":{from:{STRING:["Reroute",...Tf]}},"easy negative":{from:{STRING:["Reroute",...Tf]}},"easy wildcards":{from:{STRING:["Reroute","easy showAnything",...Tf]}},"easy stylesSelector":{from:{STRING:["Reroute","easy showAnything",...Tf]}},"easy promptConcat":{from:{STRING:["Reroute","easy showAnything",...Tf]}},"easy promptReplace":{from:{STRING:["Reroute","easy showAnything",...Tf]}},"easy fullLoader":{from:{PIPE_LINE:["Reroute",...If,"easy fullkSampler",...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy a1111Loader":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy comfyLoader":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy hunyuanDiTLoader":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy kolorsLoader":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy pixArtLoader":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy svdLoader":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced","easy preSamplingDynamicCFG",...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy zero123Loader":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced","easy preSamplingDynamicCFG",...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy sv3dLoader":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced","easy preSamplingDynamicCFG",...Mf,...$f],MODEL:Gf},to:{STRING:["Reroute",...Tf]}},"easy preSampling":{from:{PIPE_LINE:["Reroute",...Nf,...Mf,...Pf,...Rf,...$f]}},"easy preSamplingAdvanced":{from:{PIPE_LINE:["Reroute",...Nf,...Mf,...Pf,...Rf,...$f]}},"easy preSamplingDynamicCFG":{from:{PIPE_LINE:["Reroute",...Nf,...Mf,...Pf,...Rf,...$f]}},"easy preSamplingCustom":{from:{PIPE_LINE:["Reroute",...Nf,...Mf,...Pf,...Rf,...$f]}},"easy preSamplingLayerDiffusion":{from:{PIPE_LINE:["Reroute","easy kSamplerLayerDiffusion",...Nf,...Mf,...Pf,...Rf,...$f]}},"easy preSamplingNoiseIn":{from:{PIPE_LINE:["Reroute",...Nf,...Mf,...Pf,...Rf,...$f]}},"easy fullkSampler":{from:{PIPE_LINE:["Reroute",...Mf.reverse(),"easy preDetailerFix","easy preMaskDetailerFix",...If,...$f]}},"easy kSampler":{from:{PIPE_LINE:["Reroute",...Mf.reverse(),"easy preDetailerFix","easy preMaskDetailerFix","easy hiresFix",...If,...$f]}},"easy controlnetLoader":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f]}},"easy controlnetLoaderADV":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f]}},"easy instantIDApply":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f],MODEL:Gf},to:{COMBO:["Reroute","easy promptLine"]}},"easy instantIDApplyADV":{from:{PIPE_LINE:["Reroute",...If,...Pf,...Df,...Mf,...$f],MODEL:Gf},to:{COMBO:["Reroute","easy promptLine"]}},"easy ipadapterApply":{to:{COMBO:["Reroute","easy promptLine"]}},"easy ipadapterApplyADV":{to:{STRING:["Reroute","easy sliderControl",...Tf],COMBO:["Reroute","easy promptLine"]}},"easy ipadapterStyleComposition":{to:{COMBO:["Reroute","easy promptLine"]}},"easy preDetailerFix":{from:{PIPE_LINE:["Reroute","easy detailerFix",...Mf,...$f]},to:{PIPE_LINE:["Reroute","easy ultralyticsDetectorPipe","easy samLoaderPipe","easy kSampler","easy fullkSampler"]}},"easy preMaskDetailerFix":{from:{PIPE_LINE:["Reroute","easy detailerFix",...Mf,...$f]}},"easy samLoaderPipe":{from:{PIPE_LINE:["Reroute","easy preDetailerFix",...Mf,...$f]}},"easy ultralyticsDetectorPipe":{from:{PIPE_LINE:["Reroute","easy preDetailerFix",...Mf,...$f]}},"easy cascadeLoader":{from:{PIPE_LINE:["Reroute","easy fullCascadeKSampler","easy preSamplingCascade",...Pf,...Mf,...$f],MODEL:Gf.filter((e=>!jf.includes(e)))}},"easy fullCascadeKSampler":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced",...Mf,...$f]}},"easy preSamplingCascade":{from:{PIPE_LINE:["Reroute","easy cascadeKSampler",...Mf,...$f]}},"easy cascadeKSampler":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced",...Mf,...$f]}}};y.registerExtension({name:"Comfy.EasyUse.Suggestions",async setup(e){LGraphCanvas.prototype.createDefaultNodeForSlot=function(e){e=e||{};var t,n=Object.assign({nodeFrom:null,slotFrom:null,nodeTo:null,slotTo:null,position:[],nodeType:null,posAdd:[0,0],posSizeFix:[0,0]},e),o=n.nodeFrom&&null!==n.slotFrom,i=!o&&n.nodeTo&&null!==n.slotTo;if(!o&&!i)return!1;if(!n.nodeType)return!1;var r=o?n.nodeFrom:n.nodeTo,s=o?n.slotFrom:n.slotTo,a=r.type,l=!1;switch(typeof s){case"string":l=o?r.findOutputSlot(s,!1):r.findInputSlot(s,!1),s=o?r.outputs[s]:r.inputs[s];break;case"object":l=o?r.findOutputSlot(s.name):r.findInputSlot(s.name);break;case"number":l=s,s=o?r.outputs[s]:r.inputs[s];break;default:return!1}var c=s.type==LiteGraph.EVENT?"_event_":s.type,u=o?LiteGraph.slot_types_default_out:LiteGraph.slot_types_default_in;if(u&&u[c]){s.link;let e=!1;const i=o?"from":"to";if(Bf[a]&&Bf[a][i]&&(null==(t=Bf[a][i][c])?void 0:t.length)>0){for(var d in Bf[a][i][c])if(n.nodeType==Bf[a][i][c][d]||"AUTO"==n.nodeType){e=Bf[a][i][c][d];break}}else if("object"==typeof u[c]||"array"==typeof u[c]){for(var d in u[c])if(n.nodeType==u[c][d]||"AUTO"==n.nodeType){e=u[c][d];break}}else n.nodeType!=u[c]&&"AUTO"!=n.nodeType||(e=u[c]);if(e){var p=!1;"object"==typeof e&&e.node&&(p=e,e=e.node);var f=LiteGraph.createNode(e);if(f){if(p){if(p.properties)for(var h in p.properties)f.addProperty(h,p.properties[h]);if(p.inputs)for(var h in f.inputs=[],p.inputs)f.addOutput(p.inputs[h][0],p.inputs[h][1]);if(p.outputs)for(var h in f.outputs=[],p.outputs)f.addOutput(p.outputs[h][0],p.outputs[h][1]);p.title&&(f.title=p.title),p.json&&f.configure(p.json)}return this.graph.add(f),f.pos=[n.position[0]+n.posAdd[0]+(n.posSizeFix[0]?n.posSizeFix[0]*f.size[0]:0),n.position[1]+n.posAdd[1]+(n.posSizeFix[1]?n.posSizeFix[1]*f.size[1]:0)],o?n.nodeFrom.connectByType(l,f,c):n.nodeTo.connectByTypeOutput(l,f,c),!0}}}return!1},LGraphCanvas.prototype.showConnectionMenu=function(e){e=e||{};var t,n=Object.assign({nodeFrom:null,slotFrom:null,nodeTo:null,slotTo:null,e:null},e),o=this,i=n.nodeFrom&&n.slotFrom,r=!i&&n.nodeTo&&n.slotTo;if(!i&&!r)return!1;var s=i?n.nodeFrom:n.nodeTo,a=i?n.slotFrom:n.slotTo,l=!1;switch(typeof a){case"string":l=i?s.findOutputSlot(a,!1):s.findInputSlot(a,!1),a=i?s.outputs[a]:s.inputs[a];break;case"object":l=i?s.findOutputSlot(a.name):s.findInputSlot(a.name);break;case"number":l=a,a=i?s.outputs[a]:s.inputs[a];break;default:return!1}var c=["Add Node",null];o.allow_searchbox&&(c.push("Search"),c.push(null));var u=a.type==LiteGraph.EVENT?"_event_":a.type,d=i?LiteGraph.slot_types_default_out:LiteGraph.slot_types_default_in,p=s.type;if(d&&d[u]){const e=i?"from":"to";if(Bf[p]&&Bf[p][e]&&(null==(t=Bf[p][e][u])?void 0:t.length)>0)for(var f in Bf[p][e][u])c.push(Bf[p][e][u][f]);else if("object"==typeof d[u]||"array"==typeof d[u])for(var f in d[u])c.push(d[u][f]);else c.push(d[u])}var h=new LiteGraph.ContextMenu(c,{event:n.e,title:(a&&""!=a.name?a.name+(u?" | ":""):"")+(a&&u?u:""),callback:function(e,t,r){switch(e){case"Add Node":LGraphCanvas.onMenuAdd(null,null,r,h,(function(e){i?n.nodeFrom.connectByType(l,e,u):n.nodeTo.connectByTypeOutput(l,e,u)}));break;case"Search":i?o.showSearchBox(r,{node_from:n.nodeFrom,slot_from:a,type_filter_in:u}):o.showSearchBox(r,{node_to:n.nodeTo,slot_from:a,type_filter_out:u});break;default:o.createDefaultNodeForSlot(Object.assign(n,{position:[n.e.canvasX,n.e.canvasY],nodeType:e}))}}});return!1}}}),y.registerExtension({name:"Comfy.EasyUse.TimeTaken",setup(){const e=new Map;let t=0;b.addEventListener("executing",(n=>{if(!A("EasyUse.Nodes.Runtime",null,!0))return;const o=(null==n?void 0:n.node)||(null==n?void 0:n.detail)||null,i=Cp(o);i&&(i.executionDuration="");const r=e.get(t);if(e.delete(t),t&&r){const e=Date.now()-r,n=Cp(t);n&&(n.executionDuration=`${(e/1e3).toFixed(2)}${V("s")}`)}t=o,e.set(o,Date.now())}))},beforeRegisterNodeDef(e,t){const n=e.prototype.onDrawForeground;e.prototype.onDrawForeground=function(...e){const[t]=e;return function(e,t){if(!t)return;e.save(),e.fillStyle=LiteGraph.NODE_DEFAULT_BGCOLOR,function(e,t,n,o,i,r){e.beginPath(),e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.arcTo(t+o,n,t+o,n+r,r),e.lineTo(t+o,n+i-r),e.arcTo(t+o,n+i,t+o-r,n+i,r),e.lineTo(t+r,n+i),e.arcTo(t,n+i,t,n+i-r,r),e.lineTo(t,n+r),e.arcTo(t,n,t+r,n,r),e.closePath()}(e,0,-LiteGraph.NODE_TITLE_HEIGHT-20,e.measureText(t).width+10,LiteGraph.NODE_TITLE_HEIGHT-10,4),e.fill(),function(e,t,n,o,i="#000",r=12,s="Inter"){e.font=`${r}px ${s}`,e.fillStyle=i,e.fillText(t,n,o)}(e,t,8,-LiteGraph.NODE_TITLE_HEIGHT-6,LiteGraph.NODE_TITLE_COLOR),e.restore()}(t,this.executionDuration||""),null==n?void 0:n.apply(this,e)}}});const Ff="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function Uf(e,t,n,o){e.addEventListener?e.addEventListener(t,n,o):e.attachEvent&&e.attachEvent("on".concat(t),n)}function zf(e,t,n,o){e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent&&e.detachEvent("on".concat(t),n)}function Vf(e,t){const n=t.slice(0,t.length-1);for(let o=0;o=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}const Wf={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":Ff?173:189,"=":Ff?61:187,";":Ff?59:186,"'":222,"[":219,"]":221,"\\":220},Yf={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},Zf={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Kf={16:!1,18:!1,17:!1,91:!1},Xf={};for(let by=1;by<20;by++)Wf["f".concat(by)]=111+by;let Qf=[],Jf=null,qf="all";const eh=new Map,th=e=>Wf[e.toLowerCase()]||Yf[e.toLowerCase()]||e.toUpperCase().charCodeAt(0);function nh(e){qf=e||"all"}function oh(){return qf||"all"}function ih(e){if(void 0===e)Object.keys(Xf).forEach((e=>{Array.isArray(Xf[e])&&Xf[e].forEach((e=>rh(e))),delete Xf[e]})),ch(null);else if(Array.isArray(e))e.forEach((e=>{e.key&&rh(e)}));else if("object"==typeof e)e.key&&rh(e);else if("string"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o{let{key:t,scope:n,method:o,splitKey:i="+"}=e;Hf(t).forEach((e=>{const t=e.split(i),r=t.length,s=t[r-1],a="*"===s?"*":th(s);if(!Xf[a])return;n||(n=oh());const l=r>1?Vf(Yf,t):[],c=[];Xf[a]=Xf[a].filter((e=>{const t=(!o||e.method===o)&&e.scope===n&&function(e,t){const n=e.length>=t.length?e:t,o=e.length>=t.length?t:e;let i=!0;for(let r=0;rch(e)))}))};function sh(e,t,n,o){if(t.element!==o)return;let i;if(t.scope===n||"all"===t.scope){i=t.mods.length>0;for(const e in Kf)Object.prototype.hasOwnProperty.call(Kf,e)&&(!Kf[e]&&t.mods.indexOf(+e)>-1||Kf[e]&&-1===t.mods.indexOf(+e))&&(i=!1);(0!==t.mods.length||Kf[16]||Kf[18]||Kf[17]||Kf[91])&&!i&&"*"!==t.shortcut||(t.keys=[],t.keys=t.keys.concat(Qf),!1===t.method(e,t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0)))}}function ah(e,t){const n=Xf["*"];let o=e.keyCode||e.which||e.charCode;if(!lh.filter.call(this,e))return;if(93!==o&&224!==o||(o=91),-1===Qf.indexOf(o)&&229!==o&&Qf.push(o),["ctrlKey","altKey","shiftKey","metaKey"].forEach((t=>{const n=Zf[t];e[t]&&-1===Qf.indexOf(n)?Qf.push(n):!e[t]&&Qf.indexOf(n)>-1?Qf.splice(Qf.indexOf(n),1):"metaKey"===t&&e[t]&&3===Qf.length&&(e.ctrlKey||e.shiftKey||e.altKey||(Qf=Qf.slice(Qf.indexOf(n))))})),o in Kf){Kf[o]=!0;for(const e in Yf)Yf[e]===o&&(lh[e]=!0);if(!n)return}for(const a in Kf)Object.prototype.hasOwnProperty.call(Kf,a)&&(Kf[a]=e[Zf[a]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(-1===Qf.indexOf(17)&&Qf.push(17),-1===Qf.indexOf(18)&&Qf.push(18),Kf[17]=!0,Kf[18]=!0);const i=oh();if(n)for(let a=0;a1&&(i=Vf(Yf,e)),(e="*"===(e=e[e.length-1])?"*":th(e))in Xf||(Xf[e]=[]),Xf[e].push({keyup:l,keydown:c,scope:r,mods:i,shortcut:o[a],method:n,key:o[a],splitKey:u,element:s});if(void 0!==s&&window){if(!eh.has(s)){const e=function(){return ah(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.event,s)},t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.event;ah(e,s),function(e){let t=e.keyCode||e.which||e.charCode;const n=Qf.indexOf(t);if(n>=0&&Qf.splice(n,1),e.key&&"meta"===e.key.toLowerCase()&&Qf.splice(0,Qf.length),93!==t&&224!==t||(t=91),t in Kf){Kf[t]=!1;for(const e in Yf)Yf[e]===t&&(lh[e]=!1)}}(e)};eh.set(s,{keydownListener:e,keyupListenr:t,capture:d}),Uf(s,"keydown",e,d),Uf(s,"keyup",t,d)}if(!Jf){const e=()=>{Qf=[]};Jf={listener:e,capture:d},Uf(window,"focus",e,d)}}}function ch(e){const t=Object.values(Xf).flat();if(t.findIndex((t=>{let{element:n}=t;return n===e}))<0){const{keydownListener:t,keyupListenr:n,capture:o}=eh.get(e)||{};t&&n&&(zf(e,"keyup",n,o),zf(e,"keydown",t,o),eh.delete(e))}if(t.length<=0||eh.size<=0){if(Object.keys(eh).forEach((e=>{const{keydownListener:t,keyupListenr:n,capture:o}=eh.get(e)||{};t&&n&&(zf(e,"keyup",n,o),zf(e,"keydown",t,o),eh.delete(e))})),eh.clear(),Object.keys(Xf).forEach((e=>delete Xf[e])),Jf){const{listener:e,capture:t}=Jf;zf(window,"focus",e,t),Jf=null}}}const uh={getPressedKeyString:function(){return Qf.map((e=>{return t=e,Object.keys(Wf).find((e=>Wf[e]===t))||(e=>Object.keys(Yf).find((t=>Yf[t]===e)))(e)||String.fromCharCode(e);var t}))},setScope:nh,getScope:oh,deleteScope:function(e,t){let n,o;e||(e=oh());for(const i in Xf)if(Object.prototype.hasOwnProperty.call(Xf,i))for(n=Xf[i],o=0;o{let{element:t}=e;return ch(t)}))}else o++;oh()===e&&nh(t||"all")},getPressedKeyCodes:function(){return Qf.slice(0)},getAllKeyCodes:function(){const e=[];return Object.keys(Xf).forEach((t=>{Xf[t].forEach((t=>{let{key:n,scope:o,mods:i,shortcut:r}=t;e.push({scope:o,shortcut:r,mods:i,keys:n.split("+").map((e=>th(e)))})}))})),e},isPressed:function(e){return"string"==typeof e&&(e=th(e)),-1!==Qf.indexOf(e)},filter:function(e){const t=e.target||e.srcElement,{tagName:n}=t;let o=!0;const i="INPUT"===n&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(i||"TEXTAREA"===n||"SELECT"===n)&&!t.readOnly)&&(o=!1),o},trigger:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all";Object.keys(Xf).forEach((n=>{Xf[n].filter((n=>n.scope===t&&n.shortcut===e)).forEach((e=>{e&&e.method&&e.method()}))}))},unbind:ih,keyMap:Wf,modifier:Yf,modifierMap:Zf};for(const by in uh)Object.prototype.hasOwnProperty.call(uh,by)&&(lh[by]=uh[by]);if("undefined"!=typeof window){const e=window.hotkeys;lh.noConflict=t=>(t&&window.hotkeys===lh&&(window.hotkeys=e),lh),window.hotkeys=lh}let dh=null;y.registerExtension({name:"Comfy.EasyUse.HotKeys",setup(){if(void 0!==lh){lh("up,down,left,right",(function(e,t){var n,o,i,r,s,a,l,c,u,d,p,f,h,m,g;e.preventDefault();if(!A("EasyUse.Hotkeys.JumpNearestNodes",null,!0))return;const v=Ap();if(0===v.length)return;const y=v[0];switch(t.key){case"up":case"left":let e=null;if(Np(y)){const e=null==(n=y.widgets_values)?void 0:n[0],t=null==(o=y.graph)?void 0:o._nodes,i=null==t?void 0:t.find((t=>{var n;if(Pp(t)){if((null==(n=t.widgets_values)?void 0:n[0])===e)return t}return null}));i&&Op(i)}else if((null==(i=y.inputs)?void 0:i.length)>0){for(let t=0;t{var n;if(Np(t)){if((null==(n=t.widgets_values)?void 0:n[0])===e)return t}return null}));n&&Op(n)}else if((null==(d=y.outputs)?void 0:d.length)>0){for(let e=0;e0&&y.outputs[e].links[0]){t=y.outputs[e].links[0];break}if(t){const e=null==(f=y.graph)?void 0:f.links;if(e[t]){const n=null==(h=e[t])?void 0:h.target_id,o=null==(g=null==(m=y.graph)?void 0:m._nodes_by_id)?void 0:g[n];o&&Op(o)}}}}})),lh("shift+up,shift+down,shift+left,shift+right",(function(e,t){e.preventDefault();if(!A("EasyUse.Hotkeys.AlignSelectedNodes",null,!0))return;const n=Ap();if(n.length<=1)return;const o=n;switch(t.key){case"shift+up":LGraphCanvas.alignNodes(o,"top",o[0]);break;case"shift+down":LGraphCanvas.alignNodes(o,"bottom",o[0]);break;case"shift+left":LGraphCanvas.alignNodes(o,"left",o[0]);break;case"shift+right":LGraphCanvas.alignNodes(o,"right",o[0])}dh||(dh=np()),dh&&dh.update()})),lh("shift+g",(function(e,t){e.preventDefault();A("EasyUse.Hotkeys.AddGroup",null,!0)&&(fh(),dh||(dh=np()),dh&&dh.update())}));const e=[];Array.from(Array(10).keys()).forEach((t=>e.push(`alt+${t}`))),lh(e.join(","),(async function(e,t){e.preventDefault();if(!A("EasyUse.Hotkeys.NodesTemplate",null,!0))return;const n=t.key;let o=parseInt(n.split("+")[1]);const i=await b.getUserData("comfy.templates.json");let r=null;if(200==i.status)try{r=await i.json()}catch(a){Fp.error(V("Get Node Templates File Failed"))}else localStorage["Comfy.NodeTemplates"]?r=JSON.parse(localStorage["Comfy.NodeTemplates"]):Fp.warn(V("No Node Templates Found"));if(!r)return void Fp.warn(V("No Node Templates Found"));o=0===o?9:o-1;const s=r[o];if(s)try{const e=(null==s?void 0:s.name)||"Group",t=(null==s?void 0:s.data)?JSON.parse(s.data):[];ph((async()=>{await k.registerFromWorkflow(t.groupNodes,{}),localStorage.litegrapheditor_clipboard=s.data,y.canvas.pasteFromClipboard(),t.groupNodes||fh(e)}))}catch(a){Fp.error(a)}else Fp.warn(V("Node template with {key} not set").replace("{key}",n))}));const t=async function(e){if(("b"===e.key||"m"==e.key)&&(e.metaKey||e.ctrlKey)){if(0===Ap().length)return;dh||(dh=np()),dh&&dh.update()}};window.addEventListener("keydown",t,!0)}}});const ph=async e=>{const t=localStorage.litegrapheditor_clipboard;await e(),localStorage.litegrapheditor_clipboard=t},fh=e=>{const t=Ap();if(0===t.length)return;const n=t;let o=new LiteGraph.LGraphGroup;o.title=e||"Group",((e,t=[],n=20)=>{var o,i,r,s,a,l,c,u,d,p;for(var f of(i=r=s=a=-1,l=c=u=d=-1,[e._nodes,t]))for(var h in f)l=(p=f[h]).pos[0],c=p.pos[1],u=p.pos[0]+p.size[0],d=p.pos[1]+p.size[1],"Reroute"!=p.type&&(c-=LiteGraph.NODE_TITLE_HEIGHT),(null==(o=p.flags)?void 0:o.collapsed)&&(d=c+LiteGraph.NODE_TITLE_HEIGHT,(null==p?void 0:p._collapsed_width)&&(u=l+Math.round(p._collapsed_width))),(-1==i||ls)&&(s=u),(-1==a||d>a)&&(a=d);r-=Math.round(1.4*e.font_size),e.pos=[i-n,r-n],e.size=[s-i+2*n,a-r+2*n]})(o,n),y.canvas.graph.add(o)};function hh(e,t,n,o){const i=[];return e.workflow.links.forEach((e=>{n&&e[1]===t&&!i.includes(e[3])&&i.push(e[3]),o&&e[3]===t&&!i.includes(e[1])&&i.push(e[1])})),i}async function mh(e,t=!1){const n=structuredClone(await y.graphToPrompt()),o=[];if(n.workflow.nodes.forEach((e=>{o.push(e.id)})),n.workflow.links=n.workflow.links.filter((e=>o.includes(e[1])&&o.includes(e[3]))),t)for(;!y.graph._nodes_by_id[e].isChooser;)e=hh(n,e,!0,!1)[0];const i=function(e,t){const n=[],o=[t];for(;o.length>0;){const t=o.pop();n.push(t),o.push(...hh(e,t,!0,!1).filter((e=>!(n.includes(e)||o.includes(e)))))}o.push(...n.filter((e=>e!=t)));const i=[t];for(;o.length>0;){const t=o.pop();i.push(t),o.push(...hh(e,t,!1,!0).filter((e=>!(i.includes(e)||o.includes(e)))))}const r=[];return r.push(...n),r.push(...i.filter((e=>!r.includes(e)))),r}(n,e);n.workflow.nodes=n.workflow.nodes.filter((t=>(t.id===e&&t.inputs.forEach((e=>{e.link=null})),i.includes(t.id)))),n.workflow.links=n.workflow.links.filter((e=>i.includes(e[1])&&i.includes(e[3])));const r={};for(const[l,c]of Object.entries(n.output))i.includes(parseInt(l))&&(r[l]=c);const s={};for(const[l,c]of Object.entries(r[e.toString()].inputs))Array.isArray(c)||(s[l]=c);r[e.toString()].inputs=s,n.output=r;const a=y.graphToPrompt;y.graphToPrompt=()=>(y.graphToPrompt=a,n),y.queuePrompt(0)}const gh=new class{constructor(){this.current_node_id=void 0,this.class_of_current_node=null,this.current_node_is_chooser=!1}update(){var e,t;return y.runningNodeId!=this.current_node_id&&(this.current_node_id=y.runningNodeId,this.current_node_id?(this.class_of_current_node=null==(t=null==(e=y.graph)?void 0:e._nodes_by_id[y.runningNodeId.toString()])?void 0:t.comfyClass,this.current_node_is_chooser="easy imageChooser"===this.class_of_current_node):(this.class_of_current_node=void 0,this.current_node_is_chooser=!1),!0)}},vh=class e{constructor(){}static idle(){return!y.runningNodeId}static paused(){return!0}static paused_here(t){return e.here(t)}static running(){return!e.idle()}static here(e){return y.runningNodeId==e}static state(){return"Paused"}};v(vh,"cancelling",!1);let yh=vh;function bh(e,t){const n=new FormData;n.append("message",t),n.append("id",e),b.fetchApi("/easyuse/image_chooser_message",{method:"POST",body:n})}function _h(){bh(-1,"__cancel__"),yh.cancelling=!0,b.interrupt(),yh.cancelling=!1}var wh=0;function Sh(){wh+=1}const xh=["easy kSampler","easy kSamplerTiled","easy fullkSampler"];function kh(e){const t=y.graph._nodes_by_id[e.detail.id];if(t){t.selected=new Set,t.anti_selected=new Set;const n=function(e,t){var n;return e.imgs=[],t.forEach((t=>{const n=new Image;e.imgs.push(n),n.onload=()=>{y.graph.setDirtyCanvas(!0)},n.src=`/view?filename=${encodeURIComponent(t.filename)}&type=temp&subfolder=${y.getPreviewFormatParam()}`})),null==(n=e.setSizeForImage)||n.call(e),e.imgs}(t,e.detail.urls);return{node:t,image:n,isKSampler:xh.includes(t.type)}}}function Ch(e,t,n){var o;if(e.imageRects)o=e.imageRects[t];else{const t=e.imagey;o=[1,t+1,e.size[0]-2,e.size[1]-t-2]}n.strokeRect(o[0]+1,o[1]+1,o[2]-2,o[3]-2)}class Ah extends w{constructor(){super(),this.node=null,this.select_index=[],this.dialog_div=null}show(e,t){this.select_index=[],this.node=t;const n=e.map(((e,n)=>{const o=_("img",{src:e.src,onclick:e=>{this.select_index.includes(n)?(this.select_index=this.select_index.filter((e=>e!==n)),o.classList.remove("selected")):(this.select_index.push(n),o.classList.add("selected")),t.selected.has(n)?t.selected.delete(n):t.selected.add(n)}});return o}));super.show(_("div.comfyui-easyuse-chooser-dialog",[_("h5.comfyui-easyuse-chooser-dialog-title",V("Choose images to continue")),_("div.comfyui-easyuse-chooser-dialog-images",n)]))}createButtons(){const e=super.createButtons();return e[0].onclick=e=>{yh.running()&&_h(),super.close()},e.unshift(_("button",{type:"button",textContent:V("Choose Selected Images"),onclick:e=>{bh(this.node.id,[...this.node.selected,-1,...this.node.anti_selected]),yh.idle()&&(Sh(),mh(this.node.id).then((()=>{bh(this.node.id,[...this.node.selected,-1,...this.node.anti_selected])}))),super.close()}})),e}}function Eh(){const e=y.graph._nodes_by_id[this.node_id];if(e){const t=[...e.selected];(null==t?void 0:t.length)>0&&e.setProperty("values",t),bh(e.id,[...e.selected,-1,...e.anti_selected]),yh.idle()&&(Sh(),mh(e.id).then((()=>{bh(e.id,[...e.selected,-1,...e.anti_selected])})))}}function Oh(){yh.running()&&_h()}function Lh(e){Object.defineProperty(e,"clicked",{get:function(){return this._clicked},set:function(e){this._clicked=e&&""!=this.name}})}function Th(e){e.options||(e.options={}),e.options.serialize=!1}y.registerExtension({name:"Comfy.EasyUse.imageChooser",init(){window.addEventListener("beforeunload",_h,!0)},setup(e){const t=LGraphCanvas.prototype.draw;LGraphCanvas.prototype.draw=function(){gh.update()&&e.graph._nodes.forEach((e=>{e.update&&e.update()})),t.apply(this,arguments)},b.addEventListener("easyuse-image-choose",(function(e){const{node:t,image:n,isKSampler:o}=kh(e);if(o){(new Ah).show(n,t)}}));const n=b.interrupt;b.interrupt=function(){yh.cancelling||_h(),n.apply(this,arguments)},b.addEventListener("execution_start",(function(){(wh>0?(wh-=1,0):(bh(-1,"__start__"),1))&&e.graph._nodes.forEach((e=>{(e.selected||e.anti_selected)&&(e.selected.clear(),e.anti_selected.clear(),e.update())}))}))},async nodeCreated(e,t){if("easy imageChooser"==e.comfyClass){e.setProperty("values",[]),void 0===(null==e?void 0:e.imageIndex)&&Object.defineProperty(e,"imageIndex",{get:function(){return null},set:function(t){e.overIndex=t}}),void 0===(null==e?void 0:e.imagey)&&Object.defineProperty(e,"imagey",{get:function(){return null},set:function(t){return e.widgets[e.widgets.length-1].last_y+LiteGraph.NODE_WIDGET_HEIGHT}});const t=e.onMouseDown;e.onMouseDown=function(n,o,i){if(n.isPrimary){const t=function(e,t){var n,o;if((null==(n=e.imgs)?void 0:n.length)>1)for(var i=0;i0&&n0&&oe.imagey)return 0;return-1}(e,o);t>=0&&this.imageClicked(t)}return t&&t.apply(this,arguments)},e.send_button_widget=e.addWidget("button","","",Eh),e.cancel_button_widget=e.addWidget("button","","",Oh),Lh(e.cancel_button_widget),Lh(e.send_button_widget),Th(e.cancel_button_widget),Th(e.send_button_widget)}},beforeRegisterNodeDef(e,t,n){if("easy imageChooser"==(null==t?void 0:t.name)){const t=e.prototype.onDrawBackground;e.prototype.onDrawBackground=function(e){t.apply(this,arguments),function(e,t){var n,o;if(e.imgs){if(e.imageRects)for(let n=0;n{Ch(e,n,t)})),t.strokeStyle="#F88",null==(o=null==e?void 0:e.anti_selected)||o.forEach((n=>{Ch(e,n,t)}))}}(this,e)},e.prototype.imageClicked=function(t){"easy imageChooser"===(null==e?void 0:e.comfyClass)&&(this.selected.has(t)?this.selected.delete(t):this.selected.add(t),this.update())};const n=e.prototype.update;e.prototype.update=function(){var e;if(n&&n.apply(this,arguments),this.send_button_widget){this.send_button_widget.node_id=this.id;const t=(this.selected?this.selected.size:0)+(this.anti_selected?this.anti_selected.size:0),n=(null==(e=this.imgs)?void 0:e.length)||0;yh.paused_here(this.id)&&t>0?this.send_button_widget.name=t>1?"Progress selected ("+t+"/"+n+")":"Progress selected image":this.send_button_widget.name=t>0?t>1?"Progress selected ("+t+"/"+n+")":"Progress selected image as restart":""}if(this.cancel_button_widget){const e=yh.running();this.cancel_button_widget.name=e?"Cancel current run":""}this.setDirtyCanvas(!0,!0)}}}}),Number.prototype.div=function(e){return function(e,t){let n,o,i=0,r=0,s="string"==typeof e?e:e.toString(),a="string"==typeof t?t:t.toString();try{i=s.toString().split(".")[1].length}catch(l){}try{r=a.toString().split(".")[1].length}catch(l){}return n=Number(s.toString().replace(".","")),o=Number(a.toString().replace(".","")),n/o*Math.pow(10,r-i)}(this,e)};let Ih=[],Nh=0;const Ph={sd3:6.5,"sd3-turbo":4};class Dh extends w{constructor(){super(),this.lists=[],this.dialog_div=null,this.user_div=null}addItem(e,t){return _("div.easyuse-account-dialog-item",[_("input",{type:"text",placeholder:"Enter name",oninput:e=>{const t=Array.prototype.indexOf.call(this.dialog_div.querySelectorAll(".easyuse-account-dialog-item"),e.target.parentNode);Ih[t].name=e.target.value},value:Ih[e].name}),_("input.key",{type:"text",oninput:e=>{const t=Array.prototype.indexOf.call(this.dialog_div.querySelectorAll(".easyuse-account-dialog-item"),e.target.parentNode);Ih[t].key=e.target.value},placeholder:"Enter APIKEY",value:Ih[e].key}),_("button.choose",{textContent:V("Choose"),onclick:async e=>{var n,o,i;const r=Array.prototype.indexOf.call(this.dialog_div.querySelectorAll(".easyuse-account-dialog-item"),e.target.parentNode);let s=Ih[r].name,a=Ih[r].key;if(!s)return void Fp.error(V("Please enter the account name"));if(!a)return void Fp.error(V("Please enter the APIKEY"));let l=!0;for(let t=0;t{(new Dh).show(t)}},[_("div.user",[_("div.avatar",r?[_("img",{src:r})]:"😀"),_("div.info",[_("h5.name",s),_("h6.remark","Credits: "+a)])]),_("div.edit",{textContent:V("Edit")})])),Fp.success(V("Save Succeed"))}else Fp.success(V("Save Succeed"));this.close()}else Fp.error(V("Save Failed"))}}),_("button.delete",{textContent:V("Delete"),onclick:e=>{const t=Array.prototype.indexOf.call(this.dialog_div.querySelectorAll(".easyuse-account-dialog-item"),e.target.parentNode);Ih.length<=1?Fp.error(V("At least one account is required")):(Ih.splice(t,1),this.dialog_div.removeChild(e.target.parentNode))}})])}show(e){Ih.forEach(((t,n)=>{this.lists.push(this.addItem(n,e))})),this.dialog_div=_("div.easyuse-account-dialog",this.lists),super.show(_("div.easyuse-account-dialog-main",[_("div",[_("a",{href:"https://platform.stability.ai/account/keys",target:"_blank",textContent:V("Getting Your APIKEY")})]),this.dialog_div]))}createButtons(){const e=super.createButtons();return e.unshift(_("button",{type:"button",textContent:V("Save Account Info"),onclick:e=>{let t=!0;for(let n=0;n{200==e.status?Fp.success(V("Save Succeed")):Fp.error(V("Save Failed"))}))}else Fp.error(V("APIKEY is not Empty"))}})),e.unshift(_("button",{type:"button",textContent:V("Add Account"),onclick:e=>{const t="Account "+Ih.length.toString();Ih.push({name:t,key:""});const n=this.addItem(Ih.length-1);this.lists.push(n),this.dialog_div.appendChild(n)}})),e}}y.registerExtension({name:"Comfy.EasyUse.API.SD3",async beforeRegisterNodeDef(e,t,n){if("easy stableDiffusion3API"==t.name){const t=e.prototype.onNodeCreated;e.prototype.onNodeCreated=async function(){var e,n,o;t&&(null==t||t.apply(this,arguments));const i=this.widgets.find((e=>["seed_num","seed"].includes(e.name))),r=this.widgets.find((e=>["control_before_generate","control_after_generate"].includes(e.name)));let s=this.widgets.find((e=>"model"==e.name));s.callback=e=>{a.value="-"+Ph[e]};const a=this.addWidget("text","cost_credit","0",(e=>{}),{serialize:!1});a.disabled=!0,setTimeout((e=>{"control_before_generate"==r.name&&0===i.value&&(i.value=Math.floor(4294967294*Math.random())),a.value="-"+Ph[s.value]}),100);let l=_("div.easyuse-account-user",[V("Loading UserInfo...")]);this.addDOMWidget("account","btn",_("div.easyuse-account",l)),b.addEventListener("stable-diffusion-api-generate-succeed",(async({detail:e})=>{var t;let n=l.querySelectorAll(".remark");if(n&&n[0]){const t=(null==e?void 0:e.model)?Ph[e.model]:0;if(t){let e=function(e,t){let n,o,i,r,s,a;s="string"==typeof e?e:e.toString(),a="string"==typeof t?t:t.toString();try{n=s.split(".")[1].length}catch(l){n=0}try{o=a.split(".")[1].length}catch(l){o=0}return i=Math.pow(10,Math.max(n,o)),r=n>=o?n:o,((e*i-t*i)/i).toFixed(r)}(parseFloat(n[0].innerText.replace(/Credits: /g,"")),t);e>0&&(n[0].innerText="Credits: "+e.toString())}}await W(1e4);const o=await b.fetchApi("/easyuse/stability/balance");if(200==o.status){const e=await o.json();if(null==e?void 0:e.balance){const o=(null==(t=e.balance)?void 0:t.credits)||0;n&&n[0]&&(n[0].innerText="Credits: "+o)}}}));const c=await b.fetchApi("/easyuse/stability/api_keys");if(200==c.status){let t=await c.json();if(Ih=t.keys,Nh=t.current,Ih.length>0&&void 0!==Nh){const t=Ih[Nh].key,i=Ih[Nh].name;if(t){const t=await b.fetchApi("/easyuse/stability/user_info");if(200==t.status){const i=await t.json();if((null==i?void 0:i.account)&&(null==i?void 0:i.balance)){const t=(null==(e=i.account)?void 0:e.profile_picture)||null,r=(null==(n=i.account)?void 0:n.email)||null,s=(null==(o=i.balance)?void 0:o.credits)||0;l.replaceChildren(_("div.easyuse-account-user-info",{onclick:e=>{(new Dh).show(l)}},[_("div.user",[_("div.avatar",t?[_("img",{src:t})]:"😀"),_("div.info",[_("h5.name",r),_("h6.remark","Credits: "+s)])]),_("div.edit",{textContent:V("Edit")})]))}}}else l.replaceChildren(_("div.easyuse-account-user-info",{onclick:e=>{(new Dh).show(l)}},[_("div.user",[_("div.avatar","😀"),_("div.info",[_("h5.name",i),_("h6.remark",V("Click to set the APIKEY first"))])]),_("div.edit",{textContent:V("Edit")})]))}}}}}});let jh=null;function Mh(){jh&&(jh.removeEventListeners(),jh.dropdown.remove(),jh=null)}function Rh(e,t,n,o=!1){Mh(),new $h(e,t,n,o)}class $h{constructor(e,t,n,o=!1){this.dropdown=document.createElement("ul"),this.dropdown.setAttribute("role","listbox"),this.dropdown.classList.add("easy-dropdown"),this.selectedIndex=-1,this.inputEl=e,this.suggestions=t,this.onSelect=n,this.isDict=o,this.focusedDropdown=this.dropdown,this.buildDropdown(),this.onKeyDownBound=this.onKeyDown.bind(this),this.onWheelBound=this.onWheel.bind(this),this.onClickBound=this.onClick.bind(this),this.addEventListeners()}buildDropdown(){this.isDict?this.buildNestedDropdown(this.suggestions,this.dropdown):this.suggestions.forEach(((e,t)=>{this.addListItem(e,t,this.dropdown)}));const e=this.inputEl.getBoundingClientRect();this.dropdown.style.top=e.top+e.height-10+"px",this.dropdown.style.left=e.left+"px",document.body.appendChild(this.dropdown),jh=this}buildNestedDropdown(e,t){let n=0;Object.keys(e).forEach((o=>{const i=e[o];if("object"==typeof i&&null!==i){const e=document.createElement("ul");e.setAttribute("role","listbox"),e.classList.add("easy-nested-dropdown");const r=document.createElement("li");r.classList.add("folder"),r.textContent=o,r.appendChild(e),r.addEventListener("mouseover",this.onMouseOver.bind(this,n,t)),t.appendChild(r),this.buildNestedDropdown(i,e),n+=1}else{const e=document.createElement("li");e.classList.add("item"),e.setAttribute("role","option"),e.textContent=o,e.addEventListener("mouseover",this.onMouseOver.bind(this,n,t)),e.addEventListener("mousedown",this.onMouseDown.bind(this,o)),t.appendChild(e),n+=1}}))}addListItem(e,t,n){const o=document.createElement("li");o.setAttribute("role","option"),o.textContent=e,o.addEventListener("mouseover",this.onMouseOver.bind(this,t)),o.addEventListener("mousedown",this.onMouseDown.bind(this,e)),n.appendChild(o)}addEventListeners(){document.addEventListener("keydown",this.onKeyDownBound),this.dropdown.addEventListener("wheel",this.onWheelBound),document.addEventListener("click",this.onClickBound)}removeEventListeners(){document.removeEventListener("keydown",this.onKeyDownBound),this.dropdown.removeEventListener("wheel",this.onWheelBound),document.removeEventListener("click",this.onClickBound)}onMouseOver(e,t){t&&(this.focusedDropdown=t),this.selectedIndex=e,this.updateSelection()}onMouseOut(){this.selectedIndex=-1,this.updateSelection()}onMouseDown(e,t){t.preventDefault(),this.onSelect(e),this.dropdown.remove(),this.removeEventListeners()}onKeyDown(e){const t=Array.from(this.focusedDropdown.children),n=t[this.selectedIndex];if(jh)if(38===e.keyCode)e.preventDefault(),this.selectedIndex=Math.max(0,this.selectedIndex-1),this.updateSelection();else if(40===e.keyCode)e.preventDefault(),this.selectedIndex=Math.min(t.length-1,this.selectedIndex+1),this.updateSelection();else if(39===e.keyCode){if(e.preventDefault(),n&&n.classList.contains("folder")){const e=n.querySelector(".easy-nested-dropdown");e&&(this.focusedDropdown=e,this.selectedIndex=0,this.updateSelection())}}else if(37===e.keyCode&&this.focusedDropdown!==this.dropdown){const e=this.focusedDropdown.closest(".easy-dropdown, .easy-nested-dropdown").parentNode.closest(".easy-dropdown, .easy-nested-dropdown");e&&(this.focusedDropdown=e,this.selectedIndex=Array.from(e.children).indexOf(this.focusedDropdown.parentNode),this.updateSelection())}else if((13===e.keyCode||9===e.keyCode)&&this.selectedIndex>=0){e.preventDefault(),n.classList.contains("item")&&(this.onSelect(t[this.selectedIndex].textContent),this.dropdown.remove(),this.removeEventListeners());const o=n.querySelector(".easy-nested-dropdown");o&&(this.focusedDropdown=o,this.selectedIndex=0,this.updateSelection())}else 27===e.keyCode&&(this.dropdown.remove(),this.removeEventListeners())}onWheel(e){const t=parseInt(this.dropdown.style.top);localStorage.getItem("Comfy.Settings.Comfy.InvertMenuScrolling")?this.dropdown.style.top=t+(e.deltaY<0?10:-10)+"px":this.dropdown.style.top=t+(e.deltaY<0?-10:10)+"px"}onClick(e){this.dropdown.contains(e.target)||e.target===this.inputEl||(this.dropdown.remove(),this.removeEventListeners())}updateSelection(){Array.from(this.focusedDropdown.children).forEach(((e,t)=>{t===this.selectedIndex?e.classList.add("selected"):e.classList.remove("selected")}))}}function Gh(e){const t=e.min||0,n=e.max||0,o=e.step||1;if(0===o)return[];const i=[];let r=t;for(;r<=n;){if(Number.isInteger(o))i.push(Math.round(r)+"; ");else{let e=r.toFixed(3);-0==e&&(e="0.000"),/\.\d{3}$/.test(e)||(e+="0"),i.push(e+"; ")}r+=o}return n>=0&&t>=0?i:i.reverse()}let Bh={},Fh={};function Uh(e,t){String(e.id);const n=t.name,o=t.value.replace(/^(loader|preSampling):\s/,"");Fh[n]?Fh[n]!=Bh[o]&&(Fh[n]=Bh[o]):Fh={...Fh,[n]:Bh[o]}}y.registerExtension({name:"Comfy.EasyUse.XYPlot",async beforeRegisterNodeDef(e,t,n){if("easy XYPlot"===t.name){Bh=t.input.hidden.plot_dict[0];for(const e in Bh){const t=Bh[e];if(Array.isArray(t)){let n=[];for(const e of t)n.push(e+"; ");Bh[e]=n}else Bh[e]="object"==typeof t?"seed"==e?t+"; ":Gh(t):t+"; "}Bh.None=[],Bh["---------------------"]=[]}},nodeCreated(e){"easy XYPlot"===e.comfyClass&&(function(e){if(e.widgets)for(const t of e.widgets)if("x_axis"===t.name||"y_axis"===t.name){let n=t.value;Object.defineProperty(t,"value",{get:()=>n,set(o){o!==n&&(n=o,Uh(e,t))}})}}(e),function(e){if(e.widgets){const t=e.widgets.filter((e=>"customtext"===e.type&&!1!==e.dynamicPrompts||e.dynamicPrompts));for(const e of t){let t=function(e,t,o,i){return e&&(t[o]=e),t.map((e=>n(e,i))).filter((e=>""!==e)).join("")},n=function(e,t){if(e=o(e),i(e,t))return e+"; ";let n=r(e,t);return 1===n.length||2===n.length?n[0]:i(s(e),t)?s(e)+"; ":""},o=function(e){return e.replace(/(\n|;| )/g,"")},i=function(e,t){return t.includes(e+"; ")},r=function(e,t){return t.filter((t=>t.toLowerCase().includes(e.toLowerCase())))},s=function(e){return Number(e)?Number(e).toFixed(3):["0","0.","0.0","0.00","00"].includes(e)?"0.000":e};const a=function(){const n=e.name[0]+"_axis";let o=(null==Fh?void 0:Fh[n])||[];if(0===o.length)return;const i=e.inputEl.value,r=e.inputEl.selectionStart;let s=i.split("; ");const a=i.substring(0,r).split("; ").length-1,l=s[a].replace(/\n/g,"").toLowerCase(),c=o.filter((e=>e.toLowerCase().includes(l))).map((e=>e.replace(/; /g,"")));if(c.length>0)Rh(e.inputEl,c,(n=>{const i=t(n,s,a,o);e.inputEl.value=i}));else{Mh();const n=t(null,s,a,o);e.inputEl.value=n}};e.inputEl.removeEventListener("input",a),e.inputEl.addEventListener("input",a),e.inputEl.removeEventListener("mouseup",a),e.inputEl.addEventListener("mouseup",a)}}}(e))}});const zh=_s("graphStore",{state:e=>({selectors:[],selectors_styles:{},seg_selectors:[],slider_controls:[]}),actions:{setSelectors(e){this.selectors=tp(e)},setStyles(e,t){this.selectors_styles[e]||(this.selectors_styles[e]=t)},setSegSelectors(e){this.seg_selectors=tp(e)},setSliderControls(e){this.slider_controls=tp(e)}}}),Vh=["data-id"],Hh=[Zi("i",{class:"mdi mdi-trash-can"},null,-1)],Wh=Zi("i",{class:"mdi mdi-magnify"},null,-1),Yh=["placeholder"],Zh=["onMouseenter","onMouseleave"],Kh=["onClick"],Xh=["name","checked"],Qh=["src"],Jh={key:0},qh=Zi("span",{class:"comfyui-easyuse-success"},"positive:",-1),em={key:1},tm=Zi("span",{class:"comfyui-easyuse-error"},"negative:",-1),nm="comfyui-easyuse-selector",om={__name:"stylesSelector",props:{id:{type:String|Number,default:""},type:{type:String,default:""},selectedStyles:{type:Array,default:[]},show:{type:Boolean,default:!1}},emits:["chooseStyle"],setup(e,{emit:t}){const n=e,o=zh(),{selectors_styles:i}=ws(o),r=pn([]);bi((e=>n.type),(async e=>{r.value=[],e&&await(async e=>{if(i.value[n.type])return!0;const t=await b.fetchApi(`/easyuse/prompt/styles?name=${e}`);if(200===t.status){let e=(await t.json()).map(((e,t)=>(e.index=t,e)));return await o.setStyles(n.type,e),!0}return Fp.error(V("Get styles list Failed")),!1})(e)&&a()}),{immediate:!0});const s=t,a=e=>{const t=n.selectedStyles,o=tp(i.value[n.type]);r.value=o.sort(((e,t)=>e.index-t.index)).sort(((e,n)=>t.includes(n.name)-t.includes(e.name)))},l=pn(""),c=e=>e.toLowerCase(),u=Xt({}),d=e=>{u.src="",u.name="",u.positive="",u.negative=""},p=async e=>{const t=await b.fetchApi(`/easyuse/prompt/styles/image?name=${e}&styles_name=${n.type}`);if(200===t.status){const o=await t.text();if(o.startsWith("http"))return o;return`/easyuse/prompt/styles/image?name=${e}&styles_name=${n.type}`}},f=e=>{e.target.src="data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAA8AAD/4QNLaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA5LjEtYzAwMSA3OS4xNDYyODk5Nzc3LCAyMDIzLzA2LzI1LTIzOjU3OjE0ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoMjAyMzA5MDUubS4yMzE2IDk3OWM4NmQpICAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RjA3NEU1QzNCNUJBMTFFRUExMUVDNkZDRjI0NzlBN0QiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RjA3NEU1QzRCNUJBMTFFRUExMUVDNkZDRjI0NzlBN0QiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpGMDc0RTVDMUI1QkExMUVFQTExRUM2RkNGMjQ3OUE3RCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpGMDc0RTVDMkI1QkExMUVFQTExRUM2RkNGMjQ3OUE3RCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/uAA5BZG9iZQBkwAAAAAH/2wCEAAYEBAQFBAYFBQYJBgUGCQsIBgYICwwKCgsKCgwQDAwMDAwMEAwODxAPDgwTExQUExMcGxsbHB8fHx8fHx8fHx8BBwcHDQwNGBAQGBoVERUaHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fH//AABEIAIAAgAMBEQACEQEDEQH/xACLAAEAAgMBAQEAAAAAAAAAAAAABAUCAwYBBwgBAQADAQEBAAAAAAAAAAAAAAABAgMEBQYQAAEEAgECAwUHAwUAAAAAAAEAAgMEEQUhEgYxEwdBYSIyFFFxgVJyIxWRoTOxwdFiJBEBAAICAQQBBAIDAAAAAAAAAAECEQMxIUESBBOB0SIyUXGCIwX/2gAMAwEAAhEDEQA/AP1SgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICDXJYgj+d4afsVopM8KWvEcy8it1pXdMcjXO/Lnn+im2u0cwV2VniW1UXEBAQEBAQEBAQEBAQRNlc+mgyDh7zhv+5WunX5Sw37fCHM2dh48r06ank7N6rn2Ja7qa4hw5BBwQV010uK+/DsO29v/J68SOI86Jxjl95HIP4gryPc0fHfHaXu+j7Py68zzHSVquV2iAgICAgICAgICDyTr6HdHz4PTnwypjnqic46OauNbY6mGX99p+L8w9xaeV6OufHt0eXtr59M9VFb194E9LmuH3kf6rv17avO2ets7YVcuuuk/uOa3PgBlxP4BdMbq9nLPqbJ5xDbSM9azFXpyujuSO+Bo5kcf0NPyj25We2YtEzaPxdfr6519Kz+UvqEIlELBKQZQ0eYRwC7HOPxXzVsZ6cPpK5x15ZKEiAgICAgICAgICCNc1tG40CzA2XHg4j4h9zhyFpr22p+s4Z7NNL/ALRlTX+1dVFBJOJrcTI2lxZHYcBx+sldWv3bzOMVn6fZy39OkRnNo+v3aoOx9JOxks8tqwHDPS+1IW8+IzGWZVrf9DZHSMR/j9yvo656zMz9V1rdLqdYwsoVIqwd87mNAc79Tvmd+JXJt332ftMy6temlP1jCasmggICAgICAgICAgwlmiib1SPDB7zhWrWZ4VtaI5QXb2l5ojYHvLjjIGB/dbR61sZlhPtVziFb3PYdd0luCvAZbXludVZ1huZQPgyTx4/atvWj4rxaZ6d/6Ye1/t1zSI6zx/bzti5YqaOpBeg8u41n/oa14cA4ccH7lPs1jZebVn8eyPUtOrXFbR+XdYx9xa90pjeXROaSCXDj+oysZ9S+Mx1bR7uvOJ6LGOWKVgfG8PafAtOQueazHLqraJjMMlCRAQEBAQEBAQRLNp4HTFx/2/4WtKR3Y32T2Udl8j3knk/aeSu6kREPPvaZlpY3DmyY8DyrzPZWv8tkvmFv7bg12RyR1DGeeMj2KnjE9JaeUx1hi1sgaet/U7JIOMcE8Dj7FMREcK2zPKMasr5XO6fmOVt5xEOadVplYU45IAOhxa72kLm2TFuXXqrNeF1WtlwDZeHfmHguO+vHDupszylLJsICAgICAg8cMjCQiYR5IVpFmc1Q5qLXHPgfbhbV2MLaYlqNQAYA4V/kV+PDA1fcp81fjYurtYMu4CmLZRNYhtZWBAI8CqzdaKN8df3LObtIokxwe5ZzZrFUloIGFnLWHqhIgICAgICAgxMbSpyjDAwAq3kr4MTWCnzR4MX02PGHDISNmETqieWba7QABwB4KJumKNgjaFXK0VZYChYQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEHzvuv1G7k1W9s6/Xamtaq15oaonmnsCR008HntaI4K8/s4HOeEGXZXqTud7uqtG7r6kNa5HdMU9aaw9zZde+FkrHsnr1+M2MZBPIKDRe9cO2K2mjs/V0m7X61lWzq32W+ZFEbfkSSO4B+GL9zw4QWm99TqFVmjsaSu7fUtxeNM2aTmSMBbHI9zWHqHVJlnDTxjPKCJL6sea502t1D7Ouhr0rNqxNM2CSNuwnkgjAi6ZOotdEc/Egibf1j/j+7JNL9DWdWg84TWn2ywtdFKyMZb5Tg0nLyG55x48IJ3bXqe/ea/a26dFtyTXtldDUqyOdNL5VqaDHS5gwXRxMe3xz1Y9iDKP1Sa7uefUnR7TyYqUVoEU5jY6pJZIz1RY4ZiMYd7TkexBA749Wr2gtCKlrIpGs17NjK29LLWmPmMsyiFkbIZsPEdKQu6y0eAQWdD1E2L93W1tzRyCDY3paev2NaxVlhIjidMfMb5vmse1kbi9pZ7MeKDt0BAQEBAQfEPU+lFY2++q2K1uSSezTnrReVsTTmiZVYHOd9LVuQyubIwANkbxz4FA7FsQ0NrrLNXX7N0eo1+3darGDYPjb5j6prxVRajjDetsRAjj4yM4CDre2uxO7q2hqtm7nua6w9rp5tfXgoSxwyTOMr42PlrPe4Nc8jJJQRDb3Oz1fYFrcV7As0mu3u7nbWkBZ9LSfG5nlxs/yySWRiNozwcBBx9EXadGTXz62+LG41+jZS6adhzS6vfnlkEjgzEZax7T8ePFBu3nbPdUXqJZsw6S5cqbCW1YdIY2lxhhfEGMjfHtoG9HxucwPEZy4/A7kMC87aq2Kmv7mdvxuqGmklFjUU4G2Yp21rdyW00t+kJkFl88pY9vDgwNDvEoK9np73FBcHdkrt2+rZd5FjQx7O0b8WvbzDKZhN1SSse573QdeAHkN+Ichj3p2rBvZq9vUnY2tcNQPqpZYZpJ44GxXqzHdVlzZZpib73mLHViI85c1BZ6OpsIe/6/XSuntevdsz6+8+pI0/yM1dtWVr2Z644P8rmyuj6S53jxkh9aQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBB/9k="};return(t,o)=>($i(),Ui("div",{class:Me(nm+` ${nm}-styles`),"data-id":e.id,onMouseleave:d},[r.value.length>0&&e.show?($i(),Ui(Ni,{key:0},[Zi("div",{class:Me(nm+"__header")},[Zi("div",{class:Me(nm+"__header_button"),onClick:o[0]||(o[0]=e=>(s("chooseStyle",[]),void(l.value="")))},Hh,2),Zi("div",{class:Me(nm+"__header_search")},[Wh,Hn(Zi("textarea",{class:"search","onUpdate:modelValue":o[1]||(o[1]=e=>l.value=e),dir:"ltr",rows:1,placeholder:hn(V)("Type here to search styles ...")},null,8,Yh),[[Zr,l.value]])],2)],2),Zi("div",{class:Me(nm+"__content"),onMouseleave:a},[($i(!0),Ui(Ni,null,bo(r.value,((t,o)=>($i(),Ui("div",{class:Me(nm+"-item"),key:o,onMouseenter:e=>(async e=>{if(!e.imageSrc){if(e.imageLoading)return;e.imageLoading=!0;const t=await p(e.imgName).finally((()=>e.imageLoading=!1));e.imageSrc=t}u.name="zh-CN"==z&&e.name_cn?e.name_cn:e.name,u.positive=e.prompt,u.negative=e.negative_prompt,u.src=e.imageSrc})(t),onMouseleave:Qr((e=>d()),["stop"])},[Zi("span",{class:Me([nm+"-item__tag",{hide:!(e.selectedStyles.includes(t.name)||-1!=c(t.name).indexOf(c(l.value))||t.name_cn&&-1!=c(t.name_cn).indexOf(c(l.value)))}]),onClick:e=>(e=>{let t=n.selectedStyles;t.includes(e.name)?t=t.filter((t=>t!==e.name)):t.push(e.name),s("chooseStyle",t)})(t)},[Zi("input",{type:"checkbox",name:t.name,checked:e.selectedStyles.includes(t.name)},null,8,Xh),Zi("span",null,Be("zh-CN"==hn(z)&&t.name_cn?t.name_cn:t.name),1)],10,Kh)],42,Zh)))),128))],34),(null==u?void 0:u.src)?($i(),Ui("div",{key:0,class:Me(nm+"-preview")},[Zi("img",{src:u.src,ref:"image",alt:"preview",onError:f},null,40,Qh),Zi("div",{class:Me(nm+"-preview__text")},[Zi("b",null,Be(u.name),1),Zi("div",{class:Me(nm+"-preview__prompt")},[u.positive?($i(),Ui("h6",Jh,[qh,Zi("span",null,Be(u.positive),1)])):Ji("",!0),u.negative?($i(),Ui("h6",em,[tm,Zi("span",null,Be(u.negative),1)])):Ji("",!0)],2)],2)],2)):Ji("",!0)],64)):Ji("",!0)],42,Vh))}},im=["data-id"],rm=["onClick"],sm=["name","checked"],am="comfyui-easyuse-selector",lm={__name:"segSelector",props:{id:{type:String|Number,default:""},type:{type:String,default:""},selected:{type:Array,default:[]},show:{type:Boolean,default:!1}},emits:["select"],setup(e,{emit:t}){const n=e,o=pn([]);bi((e=>n.type),(async e=>{switch(e){case"selfie_multiclass_256x256":o.value=["Background","Hair","Body","Face","Clothes","Others"];break;case"human_parsing_lip":o.value=["Background","Hat","Hair","Glove","Sunglasses","Upper-clothes","Dress","Coat","Socks","Pants","Jumpsuits","Scarf","Skirt","Face","Left-arm","Right-arm","Left-leg","Right-leg","Left-shoe","Right-shoe"]}}),{immediate:!0});const i=t;return(t,r)=>{var s;return $i(),Ui("div",{class:Me(am+` ${am}-seg`),"data-id":e.id},[(null==(s=o.value)?void 0:s.length)>0&&e.show?($i(!0),Ui(Ni,{key:0},bo(o.value,((t,o)=>($i(),Ui("div",{class:Me(am+"-item"),key:o},[Zi("span",{class:Me(am+"-item__tag"),onClick:e=>(e=>{let t=tp(n.selected);t.includes(e)?t=t.filter((t=>t!==e)):t.push(e),i("select",t)})(t)},[Zi("input",{type:"checkbox",name:t,checked:e.selected.includes(t)},null,8,sm),Zi("span",null,Be(hn(V)(t)),1)],10,rm)],2)))),128)):Ji("",!0)],10,im)}}},cm=["data-id"],um=["onMousedown","onDblclick"],dm="comfyui-easyuse-slider",pm="ipadapter layer weights",fm={__name:"sliderControl",props:{id:{type:String|Number,default:""},mode:{type:String,default:""},type:{type:String,default:""},values:{type:Array,default:[]},show:{type:Boolean,default:!1}},emits:["changeValues","showSlider"],setup(e,{emit:t}){const n=e,o=t,i=(e,t,n)=>(e-t)/(n-t)*100,r=(e,t,o=void 0)=>{if(n.mode===pm){let n={3:2.5,6:1}[t]||0;return{default:12==e?n:0,min:-1,max:3,step:.05,value:void 0!==o?o:12==e?n:0,top:void 0!==o?100-i(o,-1,3)+"%":null,height:void 0!==o?i(o,-1,3)+"%":null}}};bi((e=>n.mode),(async(e,t)=>{var i;if(e!==t&&e===pm)if(!t&&(null==(i=n.values)?void 0:i.length)>0){const e=n.values.map((e=>{const t=e.split(":");return r(n.values.length,t[0],parseFloat(t[1]))}));await o("changeValues",e)}else{let e="sd1"==n.type?16:12,t=Array.from({length:e},((t,n)=>r(e,n)));await o("changeValues",t)}o("showSlider")}),{immediate:!0}),bi((e=>n.type),((e,t)=>{if(e!=t&&n.mode==pm){let e="sd1"==n.type?16:12,t=Array.from({length:e},((t,n)=>r(e,n)));o("changeValues",t)}}));const s=pn(null),a=pn(null);return oo((()=>{document.onmouseup=e=>document.onmousemove=null})),(t,r)=>{var l;return $i(),Ui("div",{class:Me(dm),"data-id":e.id},[(null==(l=e.values)?void 0:l.length)>0&&e.show?($i(!0),Ui(Ni,{key:0},bo(e.values,((t,r)=>($i(),Ui("div",{class:Me([dm+"-item",{positive:3==r&&"sdxl"==e.type&&e.mode==pm},{negative:6==r&&"sdxl"==e.type&&e.mode==pm}]),key:r},[Zi("div",{class:Me(dm+"-item-input")},Be(t.value),3),Zi("div",{class:Me(dm+"-item-scroll"),ref_for:!0,ref_key:"scroll",ref:s},[Zi("div",{class:Me(dm+"-item-bar"),ref_for:!0,ref_key:"bar",ref:a,style:Ie({top:t.top||100-i(t.default,t.min,t.max)+"%"}),onMousedown:e=>((e,t,i)=>{let r=e||window.event,l=s.value[i],c=a.value[i],u=tp(n.values),d=r.clientY-c.offsetTop;document.onmousemove=e=>{let n=(e||window.event).clientY-d;n<0?n=0:n>l.offsetHeight-c.offsetHeight&&(n=l.offsetHeight-c.offsetHeight);let r=(t.max-t.min)/t.step,s=(l.offsetHeight-c.offsetHeight)/r;n=Math.round(n/s)*s;const a=Math.floor(n/(l.offsetHeight-c.offsetHeight)*100)+"%",p=Math.floor((l.offsetHeight-c.offsetHeight-n)/(l.offsetHeight-c.offsetHeight)*100)+"%",f=parseFloat(parseFloat(t.max-(t.max-t.min)*(n/(l.offsetHeight-c.offsetHeight))).toFixed(2));u[i]={...u[i],top:a,height:p,value:f},o("changeValues",u),window.getSelection?window.getSelection().removeAllRanges():document.selection.empty()}})(e,t,r),onDblclick:e=>((e,t,i)=>{let r=tp(n.values);r[i]={...r[i],top:null,height:null,value:t.default},o("changeValues",r)})(0,t,r)},null,46,um),Zi("div",{class:Me(dm+"-item-area"),style:Ie({height:t.height||i(t.default,t.min,t.max)+"%"})},null,6)],2),Zi("div",{class:Me(dm+"-item-label")},[Zi("span",null,Be(t.label),1)],2)],2)))),128)):Ji("",!0)],8,cm)}}},hm={__name:"index",setup(e){const t=zh(),{selectors:n,seg_selectors:o,slider_controls:i}=ws(t),r=pn({}),s=async e=>{var o,i,s,a,l,c;await W(1);const u=wp(e,"styles"),d=(null==(o=e.properties.values)?void 0:o.length)>0?e.properties.values:[];let p=tp(n.value);p.push({id:e.id,type:u.value,value:d,show:!1});const f=p.length-1;await t.setSelectors(p);let h=null==(a=null==(s=null==(i=r.value[e.id])?void 0:i._)?void 0:s.vnode)?void 0:a.el;if(!h)return;let m=e.addDOMWidget("select_styles","btn",h);e.properties.values||e.setProperty("values",[]),p[f].show=!0,await t.setSelectors(p);let g=u.value;Object.defineProperty(u,"value",{set:n=>{g=n,p[f].type=n,e.properties.values=[],p[f].value=[],t.setSelectors(p)},get:e=>g}),Object.defineProperty(m,"value",{set:e=>{setTimeout((n=>{p[f].value=e.split(","),t.setSelectors(p)}),150)},get:t=>{var o,i;return e.properties.values=(null==(i=null==(o=n.value)?void 0:o[f])?void 0:i.value)||[],e.properties.values.join(",")}}),((null==(l=e.size)?void 0:l[0])<150||(null==(c=e.size)?void 0:c[1])<150)&&e.setSize([425,500]);const v=e.onRemoved;e.onRemoved=function(){if(v&&(null==v||v.apply(this,arguments)),void 0!==n.value.findIndex((t=>t.id==e.id))){let e=tp(n.value);e.splice(f,1),t.setSelectors(e)}return v}},a=pn({}),l=async e=>{var n,i,r,s;await W(1);const l=wp(e,"method"),c=(null==(n=e.properties.values)?void 0:n.length)>0?e.properties.values:[];let u=tp(o.value);u.push({id:e.id,type:l.value,value:c,show:!1});const d=u.length-1;await t.setSegSelectors(u);let p=null==(s=null==(r=null==(i=a.value[e.id])?void 0:i._)?void 0:r.vnode)?void 0:s.el;if(!p)return;let f=e.addDOMWidget("mask_components","btn",p);e.properties.values||e.setProperty("values",[]),u[d].show=!0,await t.setSegSelectors(u);let h=l.value;Object.defineProperty(l,"value",{set:n=>{h=n,u[d].type=n,e.properties.values=[],u[d].value=[],Sp(e,wp(e,"confidence"),"selfie_multiclass_256x256"===h),e.setSize([300,"selfie_multiclass_256x256"===h?260:500]),t.setSegSelectors(u)},get:e=>h}),Object.defineProperty(f,"value",{set:e=>{setTimeout((n=>{u[d].value=e.split(","),t.setSegSelectors(u)}),150)},get:t=>{var n;return e.properties.values=(null==(n=o.value)?void 0:n[d].value)||[],e.properties.values.join(",")}}),Sp(e,wp(e,"confidence"),"selfie_multiclass_256x256"===h),e.setSize([300,"selfie_multiclass_256x256"===h?260:500]);const m=e.onRemoved;e.onRemoved=function(){if(m&&(null==m||m.apply(this,arguments)),void 0!==o.value.findIndex((t=>t.id==e.id))){let e=tp(o.value);e.splice(d,1),t.setSegSelectors(e)}return m}},c=pn({}),u=async e=>{var n,o,r,s;await W(1);const a=wp(e,"mode"),l=wp(e,"model_type"),u=(null==(n=e.properties.values)?void 0:n.length)>0?e.properties.values:[];let d=tp(i.value);d.push({id:e.id,type:l.value,mode:a.value,value:u,show:!1});const p=d.length-1;await t.setSliderControls(d);let f=null==(s=null==(r=null==(o=c.value[e.id])?void 0:o._)?void 0:r.vnode)?void 0:s.el;if(!f)return;let h=e.addDOMWidget("values","btn",f);e.properties.values||e.setProperty("values",[]),Object.defineProperty(h,"value",{set:function(){},get:t=>{var n;const o=(null==(n=i.value)?void 0:n[p].value)||[];return e.properties.values=o.map(((e,t)=>`${t}:${e.value}`)),e.properties.values.join(",")}}),e.setSize("sdxl"==l.value?[375,320]:[455,320]),l.callback=n=>{d=tp(i.value),d[p].type!=n&&(e.setSize("sdxl"==n?[375,320]:[455,320]),d[p].value=[],d[p].type=n,t.setSliderControls(d))};const m=e.onRemoved;e.onRemoved=function(){if(m&&(null==m||m.apply(this,arguments)),void 0!==i.value.findIndex((t=>t.id==e.id))){let e=tp(i.value);e.splice(p,1),t.setSliderControls(e)}return m}};return oo((e=>{y.registerExtension({name:"Comfy.EasyUse.Components",async beforeRegisterNodeDef(e,t){const n=e.prototype.onNodeCreated;"easy stylesSelector"==t.name&&(e.prototype.onNodeCreated=async function(){return n&&(null==n||n.apply(this,arguments)),await s(this),n}),"easy humanSegmentation"==t.name&&(e.prototype.onNodeCreated=async function(){return n&&(null==n||n.apply(this,arguments)),await l(this),n}),"easy sliderControl"==t.name&&(e.prototype.onNodeCreated=async function(){return n&&(null==n||n.apply(this,arguments)),await u(this),n})}})})),(e,s)=>($i(),Ui(Ni,null,[($i(!0),Ui(Ni,null,bo(hn(n),((e,o)=>($i(),zi(om,{ref_for:!0,ref:t=>{t&&(r.value[e.id]=t)},type:e.type,key:o,id:e.id,show:e.show,selectedStyles:e.value,onChooseStyle:e=>((e,o)=>{let i=tp(n.value);i[o].value=e,t.setSelectors(i)})(e,o)},null,8,["type","id","show","selectedStyles","onChooseStyle"])))),128)),($i(!0),Ui(Ni,null,bo(hn(o),((e,n)=>($i(),zi(lm,{ref_for:!0,ref:t=>{t&&(a.value[e.id]=t)},type:e.type,key:n,id:e.id,show:e.show,selected:e.value,onSelect:e=>((e,n)=>{let i=tp(o.value);i[n].value=e,t.setSegSelectors(i)})(e,n)},null,8,["type","id","show","selected","onSelect"])))),128)),($i(!0),Ui(Ni,null,bo(hn(i),((e,n)=>($i(),zi(fm,{ref_for:!0,ref:t=>{t&&(c.value[e.id]=t)},type:e.type,key:n,id:e.id,show:e.show,mode:e.mode,values:e.value,onChangeValues:e=>((e,n)=>{let o=tp(i.value);o[n].value=e,t.setSliderControls(o)})(e,n),onShowSlider:e=>(e=>{let n=tp(i.value);n[e].show=!0,t.setSliderControls(n)})(n)},null,8,["type","id","show","mode","values","onChangeValues","onShowSlider"])))),128))],64))}};var mm=Object.defineProperty,gm=Object.getOwnPropertySymbols,vm=Object.prototype.hasOwnProperty,ym=Object.prototype.propertyIsEnumerable,bm=(e,t,n)=>t in e?mm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function _m(e){return null==e||""===e||Array.isArray(e)&&0===e.length||!(e instanceof Date)&&"object"==typeof e&&0===Object.keys(e).length}function wm(e){return!!(e&&e.constructor&&e.call&&e.apply)}function Sm(e){return!_m(e)}function xm(e,t=!0){return e instanceof Object&&e.constructor===Object&&(t||0!==Object.keys(e).length)}function km(e,...t){return wm(e)?e(...t):e}function Cm(e,t=!0){return"string"==typeof e&&(t||""!==e)}function Am(e){return Cm(e)?e.replace(/(-|_)/g,"").toLowerCase():e}function Em(e,t="",n={}){const o=Am(t).split("."),i=o.shift();return i?xm(e)?Em(km(e[Object.keys(e).find((e=>Am(e)===i))||""],n),o.join("."),n):void 0:km(e,n)}function Om(e,t=!0){return Array.isArray(e)&&(t||0!==e.length)}function Lm(e){return Sm(e)&&!isNaN(e)}function Tm(e,t){if(t){const n=t.test(e);return t.lastIndex=0,n}return!1}function Im(...e){const t=(e={},n={})=>{const o=((e,t)=>{for(var n in t||(t={}))vm.call(t,n)&&bm(e,n,t[n]);if(gm)for(var n of gm(t))ym.call(t,n)&&bm(e,n,t[n]);return e})({},e);return Object.keys(n).forEach((i=>{xm(n[i])&&i in e&&xm(e[i])?o[i]=t(e[i],n[i]):o[i]=n[i]})),o};return e.reduce(((e,n,o)=>0===o?n:t(e,n)),{})}function Nm(e){return e?e.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g,"").replace(/ {2,}/g," ").replace(/ ([{:}]) /g,"$1").replace(/([;,]) /g,"$1").replace(/ !/g,"!").replace(/: /g,":"):e}function Pm(e){return Cm(e)?e.replace(/(_)/g,"-").replace(/[A-Z]/g,((e,t)=>0===t?e:"-"+e.toLowerCase())).toLowerCase():e}function Dm(e){return Cm(e)?e.replace(/[A-Z]/g,((e,t)=>0===t?e:"."+e.toLowerCase())).toLowerCase():e}function jm(){const e=new Map;return{on(t,n){let o=e.get(t);return o?o.push(n):o=[n],e.set(t,o),this},off(t,n){let o=e.get(t);return o&&o.splice(o.indexOf(n)>>>0,1),this},emit(t,n){let o=e.get(t);o&&o.slice().map((e=>{e(n)}))},clear(){e.clear()}}}var Mm=Object.defineProperty,Rm=Object.defineProperties,$m=Object.getOwnPropertyDescriptors,Gm=Object.getOwnPropertySymbols,Bm=Object.prototype.hasOwnProperty,Fm=Object.prototype.propertyIsEnumerable,Um=(e,t,n)=>t in e?Mm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zm=(e,t)=>{for(var n in t||(t={}))Bm.call(t,n)&&Um(e,n,t[n]);if(Gm)for(var n of Gm(t))Fm.call(t,n)&&Um(e,n,t[n]);return e},Vm=(e,t)=>Rm(e,$m(t)),Hm=(e,t)=>{var n={};for(var o in e)Bm.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&Gm)for(var o of Gm(e))t.indexOf(o)<0&&Fm.call(e,o)&&(n[o]=e[o]);return n},Wm=jm();function Ym(e,t){Om(e)?e.push(...t||[]):xm(e)&&Object.assign(e,t)}function Zm(e,t=""){if(!["opacity","z-index","line-height","font-weight","flex","flex-grow","flex-shrink","order"].some((e=>t.endsWith(e)))){return`${e}`.trim().split(" ").map((e=>Lm(e)?`${e}px`:e)).join(" ")}return e}function Km(e="",t=""){return function(e){return e.replaceAll(/ /g,"").replace(/[^\w]/g,"-")}(`${Cm(e,!1)&&Cm(t,!1)?`${e}-`:e}${t}`)}function Xm(e="",t=""){return`--${Km(e,t)}`}function Qm(e,t="",n="",o=[],i){if(Cm(e)){const r=/{([^}]*)}/g,s=e.trim();if(Tm(s,r)){const e=s.replaceAll(r,(e=>{const t=e.replace(/{|}/g,"").split(".").filter((e=>!o.some((t=>Tm(e,t)))));return`var(${Xm(n,Pm(t.join("-")))}${Sm(i)?`, ${i}`:""})`})),t=/(\d+\s+[\+\-\*\/]\s+\d+)/g,a=/var\([^)]+\)/g;return Tm(e.replace(a,"0"),t)?`calc(${e})`:e}return Zm(s,t)}if(Lm(e))return Zm(e,t)}function Jm(e,t){return e?`${e}{${t}}`:""}var qm=(...e)=>eg(og.getTheme(),...e),eg=(e={},t,n,o="variable")=>{if(t){const{variable:i,options:r}=og.defaults||{},{prefix:s,transform:a}=(null==e?void 0:e.options)||r||{},l=Tm(t,/{([^}]*)}/g)?t:`{${t}}`;return"value"===o||"strict"===a?og.getTokenValue(t):Qm(l,void 0,s,[i.excludedKeyRegex],n)}return""};function tg(e,t={}){const n=og.defaults.variable,{prefix:o=n.prefix,selector:i=n.selector,excludedKeyRegex:r=n.excludedKeyRegex}=t,s=(e,t="")=>Object.entries(e).reduce(((e,[n,i])=>{const a=Tm(n,r)?Km(t):Km(t,Pm(n)),l=function(e){return xm(e)&&e.hasOwnProperty("value")&&e.hasOwnProperty("type")?e.value:e}(i);if(xm(l)){const{variables:t,tokens:n}=s(l,a);Ym(e.tokens,n),Ym(e.variables,t)}else e.tokens.push((o?a.replace(`${o}-`,""):a).replaceAll("-",".")),function(e,t,n){Cm(t,!1)&&e.push(`${t}:${n};`)}(e.variables,Xm(a),Qm(l,a,o,[r]));return e}),{variables:[],tokens:[]}),{variables:a,tokens:l}=s(e,o);return{value:a,tokens:l,declarations:a.join(""),css:Jm(i,a.join(""))}}var ng={regex:{rules:{class:{pattern:/^\.([a-zA-Z][\w-]*)$/,resolve(e){return{type:"class",selector:e,matched:this.pattern.test(e.trim())}}},attr:{pattern:/^\[(.*)\]$/,resolve(e){return{type:"attr",selector:`:root${e}`,matched:this.pattern.test(e.trim())}}},media:{pattern:/^@media (.*)$/,resolve(e){return{type:"media",selector:`${e}{:root{[CSS]}}`,matched:this.pattern.test(e.trim())}}},system:{pattern:/^system$/,resolve(e){return{type:"system",selector:"@media (prefers-color-scheme: dark){:root{[CSS]}}",matched:this.pattern.test(e.trim())}}},custom:{resolve:e=>({type:"custom",selector:e,matched:!0})}},resolve(e){const t=Object.keys(this.rules).filter((e=>"custom"!==e)).map((e=>this.rules[e]));return[e].flat().map((e=>{var n;return null!=(n=t.map((t=>t.resolve(e))).find((e=>e.matched)))?n:this.rules.custom.resolve(e)}))}},_toVariables:(e,t)=>tg(e,{prefix:null==t?void 0:t.prefix}),getCommon({name:e="",theme:t={},params:n,set:o,defaults:i}){var r,s,a,l;const{preset:c,options:u}=t;let d,p,f,h;if(Sm(c)){const{primitive:t,semantic:n}=c,m=n||{},{colorScheme:g}=m,v=Hm(m,["colorScheme"]),y=g||{},{dark:b}=y,_=Hm(y,["dark"]),w=Sm(t)?this._toVariables({primitive:t},u):{},S=Sm(v)?this._toVariables({semantic:v},u):{},x=Sm(_)?this._toVariables({light:_},u):{},k=Sm(b)?this._toVariables({dark:b},u):{},[C,A]=[null!=(r=w.declarations)?r:"",w.tokens],[E,O]=[null!=(s=S.declarations)?s:"",S.tokens||[]],[L,T]=[null!=(a=x.declarations)?a:"",x.tokens||[]],[I,N]=[null!=(l=k.declarations)?l:"",k.tokens||[]];d=this.transformCSS(e,C,"light","variable",u,o,i),p=A;f=`${this.transformCSS(e,`${E}${L}color-scheme:light`,"light","variable",u,o,i)}${this.transformCSS(e,`${I}color-scheme:dark`,"dark","variable",u,o,i)}`,h=[...new Set([...O,...T,...N])]}return{primitive:{css:d,tokens:p},semantic:{css:f,tokens:h}}},getPreset({name:e="",preset:t={},options:n,params:o,set:i,defaults:r,selector:s}){var a,l,c;const u=e.replace("-directive",""),d=t,{colorScheme:p}=d,f=Hm(d,["colorScheme"]),h=p||{},{dark:m}=h,g=Hm(h,["dark"]),v=Sm(f)?this._toVariables({[u]:f},n):{},y=Sm(g)?this._toVariables({[u]:g},n):{},b=Sm(m)?this._toVariables({[u]:m},n):{},[_,w]=[null!=(a=v.declarations)?a:"",v.tokens||[]],[S,x]=[null!=(l=y.declarations)?l:"",y.tokens||[]],[k,C]=[null!=(c=b.declarations)?c:"",b.tokens||[]],A=[...new Set([...w,...x,...C])];return{css:`${this.transformCSS(u,`${_}${S}`,"light","variable",n,i,r,s)}${this.transformCSS(u,k,"dark","variable",n,i,r,s)}`,tokens:A}},getPresetC({name:e="",theme:t={},params:n,set:o,defaults:i}){var r;const{preset:s,options:a}=t,l=null==(r=null==s?void 0:s.components)?void 0:r[e];return this.getPreset({name:e,preset:l,options:a,params:n,set:o,defaults:i})},getPresetD({name:e="",theme:t={},params:n,set:o,defaults:i}){var r;const s=e.replace("-directive",""),{preset:a,options:l}=t,c=null==(r=null==a?void 0:a.directives)?void 0:r[s];return this.getPreset({name:s,preset:c,options:l,params:n,set:o,defaults:i})},getColorSchemeOption(e,t){var n;return this.regex.resolve(null!=(n=e.darkModeSelector)?n:t.options.darkModeSelector)},getLayerOrder(e,t={},n,o){const{cssLayer:i}=t;if(i){return`@layer ${km(i.order||"primeui",n)}`}return""},getCommonStyleSheet({name:e="",theme:t={},params:n,props:o={},set:i,defaults:r}){const s=this.getCommon({name:e,theme:t,params:n,set:i,defaults:r}),a=Object.entries(o).reduce(((e,[t,n])=>e.push(`${t}="${n}"`)&&e),[]).join(" ");return Object.entries(s||{}).reduce(((e,[t,n])=>{if(null==n?void 0:n.css){const o=Nm(null==n?void 0:n.css),i=`${t}-variables`;e.push(``)}return e}),[]).join("")},getStyleSheet({name:e="",theme:t={},params:n,props:o={},set:i,defaults:r}){var s;const a={name:e,theme:t,params:n,set:i,defaults:r},l=null==(s=e.includes("-directive")?this.getPresetD(a):this.getPresetC(a))?void 0:s.css,c=Object.entries(o).reduce(((e,[t,n])=>e.push(`${t}="${n}"`)&&e),[]).join(" ");return l?``:""},createTokens(e={},t,n="",o="",i={}){return Object.entries(e).forEach((([e,r])=>{const s=Tm(e,t.variable.excludedKeyRegex)?n:n?`${n}.${Dm(e)}`:Dm(e),a=o?`${o}.${e}`:e;xm(r)?this.createTokens(r,t,s,a,i):(i[s]||(i[s]={paths:[],computed(e,t={}){if(e){const n=this.paths.find((t=>t.scheme===e))||this.paths.find((e=>"none"===e.scheme));return null==n?void 0:n.computed(e,t.binding)}return this.paths.map((e=>e.computed(e.scheme,t[e.scheme])))}}),i[s].paths.push({path:a,value:r,scheme:a.includes("colorScheme.light")?"light":a.includes("colorScheme.dark")?"dark":"none",computed(e,t={}){const n=/{([^}]*)}/g;let o=r;if(t.name=this.path,t.binding||(t.binding={}),Tm(r,n)){const s=r.trim().replaceAll(n,(n=>{var o,r;const s=n.replace(/{|}/g,"");return null==(r=null==(o=i[s])?void 0:o.computed(e,t))?void 0:r.value})),a=/(\d+\w*\s+[\+\-\*\/]\s+\d+\w*)/g,l=/var\([^)]+\)/g;o=Tm(s.replace(l,"0"),a)?`calc(${s})`:s}return _m(t.binding)&&delete t.binding,{colorScheme:e,path:this.path,paths:t,value:o.includes("undefined")?void 0:o}}}))})),i},getTokenValue(e,t,n){var o;const i=t.split(".").filter((e=>!Tm(e.toLowerCase(),n.variable.excludedKeyRegex))).join(".");const r=t.includes("colorScheme.light")?"light":t.includes("colorScheme.dark")?"dark":void 0,s=[null==(o=e[i])?void 0:o.computed(r)].flat().filter((e=>e));return 1===s.length?s[0].value:s.reduce(((e={},t)=>{const n=t,{colorScheme:o}=n,i=Hm(n,["colorScheme"]);return e[o]=i,e}),void 0)},transformCSS(e,t,n,o,i={},r,s,a){if(Sm(t)){const{cssLayer:l}=i;if("style"!==o){const e=this.getColorSchemeOption(i,s),o=a?Jm(a,t):t;t="dark"===n?e.reduce(((e,{selector:t})=>(Sm(t)&&(e+=t.includes("[CSS]")?t.replace("[CSS]",o):Jm(t,o)),e)),""):Jm(null!=a?a:":root",t)}if(l){const n={name:"primeui",order:"primeui"};xm(l)&&(n.name=km(l.name,{name:e,type:o})),Sm(n.name)&&(t=Jm(`@layer ${n.name}`,t),null==r||r.layerNames(n.name))}return t}return""}},og={defaults:{variable:{prefix:"p",selector:":root",excludedKeyRegex:/^(primitive|semantic|components|directives|variables|colorscheme|light|dark|common|root|states)$/gi},options:{prefix:"p",darkModeSelector:"system",cssLayer:!1}},_theme:void 0,_layerNames:new Set,_loadedStyleNames:new Set,_loadingStyles:new Set,_tokens:{},update(e={}){const{theme:t}=e;t&&(this._theme=Vm(zm({},t),{options:zm(zm({},this.defaults.options),t.options)}),this._tokens=ng.createTokens(this.preset,this.defaults),this.clearLoadedStyleNames())},get theme(){return this._theme},get preset(){var e;return(null==(e=this.theme)?void 0:e.preset)||{}},get options(){var e;return(null==(e=this.theme)?void 0:e.options)||{}},get tokens(){return this._tokens},getTheme(){return this.theme},setTheme(e){this.update({theme:e}),Wm.emit("theme:change",e)},getPreset(){return this.preset},setPreset(e){this._theme=Vm(zm({},this.theme),{preset:e}),this._tokens=ng.createTokens(e,this.defaults),this.clearLoadedStyleNames(),Wm.emit("preset:change",e),Wm.emit("theme:change",this.theme)},getOptions(){return this.options},setOptions(e){this._theme=Vm(zm({},this.theme),{options:e}),this.clearLoadedStyleNames(),Wm.emit("options:change",e),Wm.emit("theme:change",this.theme)},getLayerNames(){return[...this._layerNames]},setLayerNames(e){this._layerNames.add(e)},getLoadedStyleNames(){return this._loadedStyleNames},isStyleNameLoaded(e){return this._loadedStyleNames.has(e)},setLoadedStyleName(e){this._loadedStyleNames.add(e)},deleteLoadedStyleName(e){this._loadedStyleNames.delete(e)},clearLoadedStyleNames(){this._loadedStyleNames.clear()},getTokenValue(e){return ng.getTokenValue(this.tokens,e,this.defaults)},getCommon(e="",t){return ng.getCommon({name:e,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},getComponent(e="",t){const n={name:e,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return ng.getPresetC(n)},getDirective(e="",t){const n={name:e,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return ng.getPresetD(n)},getCustomPreset(e="",t,n,o){const i={name:e,preset:t,options:this.options,selector:n,params:o,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return ng.getPreset(i)},getLayerOrderCSS(e=""){return ng.getLayerOrder(e,this.options,{names:this.getLayerNames()},this.defaults)},transformCSS(e="",t,n="style",o){return ng.transformCSS(e,t,o,n,this.options,{layerNames:this.setLayerNames.bind(this)},this.defaults)},getCommonStyleSheet(e="",t,n={}){return ng.getCommonStyleSheet({name:e,theme:this.theme,params:t,props:n,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},getStyleSheet(e,t,n={}){return ng.getStyleSheet({name:e,theme:this.theme,params:t,props:n,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},onStyleMounted(e){this._loadingStyles.add(e)},onStyleUpdated(e){this._loadingStyles.add(e)},onStyleLoaded(e,{name:t}){this._loadingStyles.size&&(this._loadingStyles.delete(t),Wm.emit(`theme:${t}:load`,e),!this._loadingStyles.size&&Wm.emit("theme:load"))}};function ig(e,t){return!!e&&(e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className))}function rg(e,t){if(e&&t){const n=t=>{ig(e,t)||(e.classList?e.classList.add(t):e.className+=" "+t)};[t].flat().filter(Boolean).forEach((e=>e.split(" ").forEach(n)))}}function sg(e,t){if(e&&t){const n=t=>{e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")};[t].flat().filter(Boolean).forEach((e=>e.split(" ").forEach(n)))}}function ag(e,t){if(e instanceof HTMLElement){return e.offsetWidth}return 0}function lg(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName}function cg(e,t={}){if(lg(e)){const n=(t,o)=>{var i,r;const s=(null==(i=null==e?void 0:e.$attrs)?void 0:i[t])?[null==(r=null==e?void 0:e.$attrs)?void 0:r[t]]:[];return[o].flat().reduce(((e,o)=>{if(null!=o){const i=typeof o;if("string"===i||"number"===i)e.push(o);else if("object"===i){const i=Array.isArray(o)?n(t,o):Object.entries(o).map((([e,n])=>"style"!==t||!n&&0!==n?n?e:void 0:`${e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${n}`));e=i.length?e.concat(i.filter((e=>!!e))):e}}return e}),s)};Object.entries(t).forEach((([t,o])=>{if(null!=o){const i=t.match(/^on(.+)/);i?e.addEventListener(i[1].toLowerCase(),o):"p-bind"===t?cg(e,o):(o="class"===t?[...new Set(n("class",o))].join(" ").trim():"style"===t?n("style",o).join(";").trim():o,(e.$attrs=e.$attrs||{})&&(e.$attrs[t]=o),e.setAttribute(t,o))}}))}}function ug(e,t={},...n){if(e){const o=document.createElement(e);return cg(o,t),o.append(...n),o}}function dg(e,t){return lg(e)?e.matches(t)?e:e.querySelector(t):null}function pg(e,t){if(lg(e)){const n=e.getAttribute(t);return isNaN(n)?"true"===n||"false"===n?"true"===n:n:+n}}function fg(e){if(e){let t=e.offsetHeight,n=getComputedStyle(e);return t-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)+parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),t}return 0}function hg(e){if(e){let t=e.parentNode;return t&&t instanceof ShadowRoot&&t.host&&(t=t.host),t}return null}function mg(e,t){if(e){return e.offsetHeight}return 0}function gg(e,t=[]){const n=hg(e);return null===n?t:gg(n,t.concat([n]))}function vg(e){let t=[];if(e){let n=gg(e);const o=/(auto|scroll)/,i=e=>{try{let t=window.getComputedStyle(e,null);return o.test(t.getPropertyValue("overflow"))||o.test(t.getPropertyValue("overflowX"))||o.test(t.getPropertyValue("overflowY"))}catch(t){return!1}};for(let e of n){let n=1===e.nodeType&&e.dataset.scrollselectors;if(n){let o=n.split(",");for(let n of o){let o=dg(e,n);o&&i(o)&&t.push(o)}}9!==e.nodeType&&i(e)&&t.push(e)}}return t}function yg(e){return!(null==e||!e.nodeName||!hg(e))}function bg(e){if(e){let t=e.offsetWidth,n=getComputedStyle(e);return t-=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight)+parseFloat(n.borderLeftWidth)+parseFloat(n.borderRightWidth),t}return 0}var _g={_loadedStyleNames:new Set,getLoadedStyleNames:function(){return this._loadedStyleNames},isStyleNameLoaded:function(e){return this._loadedStyleNames.has(e)},setLoadedStyleName:function(e){this._loadedStyleNames.add(e)},deleteLoadedStyleName:function(e){this._loadedStyleNames.delete(e)},clearLoadedStyleNames:function(){this._loadedStyleNames.clear()}};function wg(e){return(wg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Sg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function xg(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},n=pn(!1),o=pn(e),i=pn(null),r="undefined"!=typeof window&&window.document&&window.document.createElement?window.document:void 0,s=t.document,a=void 0===s?r:s,l=t.immediate,c=void 0===l||l,u=t.manual,d=void 0!==u&&u,p=t.name,f=void 0===p?"style_".concat(++Cg):p,h=t.id,m=void 0===h?void 0:h,g=t.media,v=void 0===g?void 0:g,y=t.nonce,b=void 0===y?void 0:y,_=t.first,w=void 0!==_&&_,S=t.onMounted,x=void 0===S?void 0:S,k=t.onUpdated,C=void 0===k?void 0:k,A=t.onLoad,E=void 0===A?void 0:A,O=t.props,L=void 0===O?{}:O,T=function(){},I=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(a){var s=xg(xg({},L),r),l=s.name||f,c=s.id||m,u=s.nonce||b;i.value=a.querySelector('style[data-primevue-style-id="'.concat(l,'"]'))||a.getElementById(c)||a.createElement("style"),i.value.isConnected||(o.value=t||e,cg(i.value,{type:"text/css",id:c,media:v,nonce:u}),w?a.head.prepend(i.value):a.head.appendChild(i.value),function(e,t="",n){lg(e)&&null!=n&&e.setAttribute(t,n)}(i.value,"data-primevue-style-id",l),cg(i.value,s),i.value.onload=function(e){return null==E?void 0:E(e,{name:l})},null==x||x(l)),n.value||(T=bi(o,(function(e){i.value.textContent=e,null==C||C(l)}),{immediate:!0}),n.value=!0)}};return c&&!d&&function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];ar()?oo(e):t?e():Pn(e)}(I),{id:m,name:f,el:i,css:o,unload:function(){a&&n.value&&(T(),yg(i.value)&&a.head.removeChild(i.value),n.value=!1)},load:I,isLoaded:Qt(n)}}function Eg(e){return(Eg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Og(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,i,r,s,a=[],l=!0,c=!1;try{if(r=(n=n.call(e)).next,0===t);else for(;!(l=(o=r.call(n)).done)&&(a.push(o.value),a.length!==t);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Lg(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lg(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n1&&void 0!==arguments[1]?arguments[1]:{},n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){return e})(km(e,{dt:qm}));return n?Ag(Nm(n),Ig({name:this.name},t)):{}},loadCSS:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.load(this.css,e)},loadTheme:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.load(this.theme,t,(function(n){return og.transformCSS(t.name||e.name,n)}))},getCommonTheme:function(e){return og.getCommon(this.name,e)},getComponentTheme:function(e){return og.getComponent(this.name,e)},getDirectiveTheme:function(e){return og.getDirective(this.name,e)},getPresetTheme:function(e,t,n){return og.getCustomPreset(this.name,e,t,n)},getLayerOrderThemeCSS:function(){return og.getLayerOrderCSS(this.name)},getStyleSheet:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.css){var n=km(this.css,{dt:qm}),o=Nm("".concat(n).concat(e)),i=Object.entries(t).reduce((function(e,t){var n=Og(t,2),o=n[0],i=n[1];return e.push("".concat(o,'="').concat(i,'"'))&&e}),[]).join(" ");return'")}return""},getCommonThemeStyleSheet:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return og.getCommonStyleSheet(this.name,e,t)},getThemeStyleSheet:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[og.getStyleSheet(this.name,e,t)];if(this.theme){var o="base"===this.name?"global-style":"".concat(this.name,"-style"),i=km(this.theme,{dt:qm}),r=Nm(og.transformCSS(o,i)),s=Object.entries(t).reduce((function(e,t){var n=Og(t,2),o=n[0],i=n[1];return e.push("".concat(o,'="').concat(i,'"'))&&e}),[]).join(" ");n.push('"))}return n.join("")},extend:function(e){return Ig(Ig({},this),{},{css:void 0,theme:void 0},e)}},Dg={};var jg=function(){let e=[];const t=(t,n,o=0)=>[...e].reverse().find((e=>!0))||{key:t,value:o},n=e=>e&&parseInt(e.style.zIndex,10)||0;return{get:n,set:(n,o,i)=>{o&&(o.style.zIndex=String(((n,o,i=999)=>{const r=t(n,o,i),s=r.value+(r.key===n?0:i)+1;return e.push({key:n,value:s}),s})(n,!0,i)))},clear:t=>{var o;t&&(o=n(t),e=e.filter((e=>e.value!==o)),t.style.zIndex="")},getCurrent:e=>(e=>t(e).value)(e)}}();function Mg(e){return(Mg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Rg(e,t,n){return t&&function(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:function(){};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.element=t,this.listener=n}),[{key:"bindScrollListener",value:function(){this.scrollableParents=vg(this.element);for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:"pv_id_")}var Fg=Pg.extend({name:"common"});function Ug(e){return(Ug="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function zg(e){return Zg(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Wg(e)||Hg()}function Vg(e,t){return Zg(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,i,r,s,a=[],l=!0,c=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(o=r.call(n)).done)&&(a.push(o.value),a.length!==t);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(e,t)||Wg(e,t)||Hg()}function Hg(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Wg(e,t){if(e){if("string"==typeof e)return Yg(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yg(e,t):void 0}}function Yg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n1?t-1:0),o=1;o0&&void 0!==arguments[0]?arguments[0]:function(){};_g.clearLoadedStyleNames(),Wm.on("theme:change",e)},_getHostInstance:function(e){return e?this.$options.hostName?e.$.type.name===this.$options.hostName?e:this._getHostInstance(e.$parentInstance):e.$parentInstance:void 0},_getPropValue:function(e){var t;return this[e]||(null===(t=this._getHostInstance(this))||void 0===t?void 0:t[e])},_getOptionValue:function(e){return Em(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})},_getPTValue:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=/./g.test(n)&&!!o[n.split(".")[0]],s=this._getPropValue("ptOptions")||(null===(e=this.$primevueConfig)||void 0===e?void 0:e.ptOptions)||{},a=s.mergeSections,l=void 0===a||a,c=s.mergeProps,u=void 0!==c&&c,d=i?r?this._useGlobalPT(this._getPTClassValue,n,o):this._useDefaultPT(this._getPTClassValue,n,o):void 0,p=r?void 0:this._getPTSelf(t,this._getPTClassValue,n,Xg(Xg({},o),{},{global:d||{}})),f=this._getPTDatasets(n);return l||!l&&p?u?this._mergeProps(u,d,p,f):Xg(Xg(Xg({},d),p),f):Xg(Xg({},p),f)},_getPTSelf:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length,n=new Array(t>1?t-1:0),o=1;o0&&void 0!==arguments[0]?arguments[0]:"",o="data-pc-",i="root"===n&&Sm(null===(e=this.pt)||void 0===e?void 0:e["data-pc-section"]);return"transition"!==n&&Xg(Xg({},"root"===n&&Xg(Qg({},"".concat(o,"name"),Am(i?null===(t=this.pt)||void 0===t?void 0:t["data-pc-section"]:this.$.type.name)),i&&Qg({},"".concat(o,"extend"),Am(this.$.type.name)))),{},Qg({},"".concat(o,"section"),Am(n)))},_getPTClassValue:function(){var e=this._getOptionValue.apply(this,arguments);return Cm(e)||Om(e)?{class:e}:e},_getPT:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=arguments.length>2?arguments[2]:void 0,i=function(e){var i,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=o?o(e):e,a=Am(n),l=Am(t.$name);return null!==(i=r?a!==l?null==s?void 0:s[a]:void 0:null==s?void 0:s[a])&&void 0!==i?i:s};return null!=e&&e.hasOwnProperty("_usept")?{_usept:e._usept,originalValue:i(e.originalValue),value:i(e.value)}:i(e,!0)},_usePT:function(e,t,n,o){var i=function(e){return t(e,n,o)};if(null!=e&&e.hasOwnProperty("_usept")){var r,s=e._usept||(null===(r=this.$primevueConfig)||void 0===r?void 0:r.ptOptions)||{},a=s.mergeSections,l=void 0===a||a,c=s.mergeProps,u=void 0!==c&&c,d=i(e.originalValue),p=i(e.value);if(void 0===d&&void 0===p)return;return Cm(p)?p:Cm(d)?d:l||!l&&p?u?this._mergeProps(u,d,p):Xg(Xg({},d),p):p}return i(e)},_useGlobalPT:function(e,t,n){return this._usePT(this.globalPT,e,t,n)},_useDefaultPT:function(e,t,n){return this._usePT(this.defaultPT,e,t,n)},ptm:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._getPTValue(this.pt,e,Xg(Xg({},this.$params),t))},ptmi:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return nr(this.$_attrsWithoutPT,this.ptm(e,t))},ptmo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._getPTValue(e,t,Xg({instance:this},n),!1)},cx:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.isUnstyled?void 0:this._getOptionValue(this.$style.classes,e,Xg(Xg({},this.$params),t))},sx:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!(arguments.length>1&&void 0!==arguments[1])||arguments[1]){var n=this._getOptionValue(this.$style.inlineStyles,e,Xg(Xg({},this.$params),t));return[this._getOptionValue(Fg.inlineStyles,e,Xg(Xg({},this.$params),t)),n]}}},computed:{globalPT:function(){var e,t=this;return this._getPT(null===(e=this.$primevueConfig)||void 0===e?void 0:e.pt,void 0,(function(e){return km(e,{instance:t})}))},defaultPT:function(){var e,t=this;return this._getPT(null===(e=this.$primevueConfig)||void 0===e?void 0:e.pt,void 0,(function(e){return t._getOptionValue(e,t.$name,Xg({},t.$params))||km(e,Xg({},t.$params))}))},isUnstyled:function(){var e;return void 0!==this.unstyled?this.unstyled:null===(e=this.$primevueConfig)||void 0===e?void 0:e.unstyled},$theme:function(){var e;return null===(e=this.$primevueConfig)||void 0===e?void 0:e.theme},$style:function(){return Xg(Xg({classes:void 0,inlineStyles:void 0,load:function(){},loadCSS:function(){},loadTheme:function(){}},(this._getHostInstance(this)||{}).$style),this.$options.style)},$styleOptions:function(){var e;return{nonce:null===(e=this.$primevueConfig)||void 0===e||null===(e=e.csp)||void 0===e?void 0:e.nonce}},$primevueConfig:function(){var e;return null===(e=this.$primevue)||void 0===e?void 0:e.config},$name:function(){return this.$options.hostName||this.$.type.name},$params:function(){var e=this._getHostInstance(this)||this.$parent;return{instance:this,props:this.$props,state:this.$data,attrs:this.$attrs,parent:{instance:e,props:null==e?void 0:e.$props,state:null==e?void 0:e.$data,attrs:null==e?void 0:e.$attrs}}},$_attrsPT:function(){return Object.entries(this.$attrs||{}).filter((function(e){var t=Vg(e,1)[0];return null==t?void 0:t.startsWith("pt:")})).reduce((function(e,t){var n=Vg(t,2),o=n[0],i=n[1],r=zg(o.split(":")).slice(1);return null==r||r.reduce((function(e,t,n,o){return!e[t]&&(e[t]=n===o.length-1?i:{}),e[t]}),e),e}),{})},$_attrsWithoutPT:function(){return Object.entries(this.$attrs||{}).filter((function(e){var t=Vg(e,1)[0];return!(null!=t&&t.startsWith("pt:"))})).reduce((function(e,t){var n=Vg(t,2),o=n[0],i=n[1];return e[o]=i,e}),{})},$attrSelector:function(){return Bg("pc")}}},qg=Pg.extend({name:"baseicon",css:"\n.p-icon {\n display: inline-block;\n vertical-align: baseline;\n}\n\n.p-icon-spin {\n -webkit-animation: p-icon-spin 2s infinite linear;\n animation: p-icon-spin 2s infinite linear;\n}\n\n@-webkit-keyframes p-icon-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}\n\n@keyframes p-icon-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}\n"});function ev(e){return(ev="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function nv(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,o=Array(t);n0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=function(){var e=gv._getOptionValue.apply(gv,arguments);return Cm(e)||Om(e)?{class:e}:e},l=(null===(e=n.binding)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.ptOptions)||(null===(t=n.$primevueConfig)||void 0===t?void 0:t.ptOptions)||{},c=l.mergeSections,u=void 0===c||c,d=l.mergeProps,p=void 0!==d&&d,f=s?gv._useDefaultPT(n,n.defaultPT(),a,i,r):void 0,h=gv._usePT(n,gv._getPT(o,n.$name),a,i,hv(hv({},r),{},{global:f||{}})),m=gv._getPTDatasets(n,i);return u||!u&&h?p?gv._mergeProps(n,p,f,h,m):hv(hv(hv({},f),h),m):hv(hv({},h),m)},_getPTDatasets:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n="data-pc-";return hv(hv({},"root"===t&&mv({},"".concat(n,"name"),Am(e.$name))),{},mv({},"".concat(n,"section"),Am(t)))},_getPT:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,o=function(e){var o,i=n?n(e):e,r=Am(t);return null!==(o=null==i?void 0:i[r])&&void 0!==o?o:i};return null!=e&&e.hasOwnProperty("_usept")?{_usept:e._usept,originalValue:o(e.originalValue),value:o(e.value)}:o(e)},_usePT:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,r=function(e){return n(e,o,i)};if(null!=t&&t.hasOwnProperty("_usept")){var s,a=t._usept||(null===(s=e.$primevueConfig)||void 0===s?void 0:s.ptOptions)||{},l=a.mergeSections,c=void 0===l||l,u=a.mergeProps,d=void 0!==u&&u,p=r(t.originalValue),f=r(t.value);if(void 0===p&&void 0===f)return;return Cm(f)?f:Cm(p)?p:c||!c&&f?d?gv._mergeProps(e,d,p,f):hv(hv({},p),f):f}return r(t)},_useDefaultPT:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;return gv._usePT(e,t,n,o,i)},_loadStyles:function(e,t,n){var o,i=gv._getConfig(t,n),r={nonce:null==i||null===(o=i.csp)||void 0===o?void 0:o.nonce};gv._loadCoreStyles(e.$instance,r),gv._loadThemeStyles(e.$instance,r),gv._loadScopedThemeStyles(e.$instance,r),gv._themeChangeListener((function(){return gv._loadThemeStyles(e.$instance,r)}))},_loadCoreStyles:function(){var e,t,n,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;!_g.isStyleNameLoaded(null===(e=o.$style)||void 0===e?void 0:e.name)&&null!==(t=o.$style)&&void 0!==t&&t.name&&(Pg.loadCSS(i),o.isUnstyled()&&(null===(n=o.$style)||void 0===n||n.loadCSS(i)),_g.setLoadedStyleName(o.$style.name))},_loadThemeStyles:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(null==n||!n.isUnstyled()){if(!og.isStyleNameLoaded("common")){var i,r,s=(null===(i=n.$style)||void 0===i||null===(r=i.getCommonTheme)||void 0===r?void 0:r.call(i))||{},a=s.primitive,l=s.semantic;Pg.load(null==a?void 0:a.css,hv({name:"primitive-variables"},o)),Pg.load(null==l?void 0:l.css,hv({name:"semantic-variables"},o)),Pg.loadTheme(hv({name:"global-style"},o)),og.setLoadedStyleName("common")}if(!og.isStyleNameLoaded(null===(e=n.$style)||void 0===e?void 0:e.name)&&null!==(t=n.$style)&&void 0!==t&&t.name){var c,u,d,p,f=((null===(c=n.$style)||void 0===c||null===(u=c.getDirectiveTheme)||void 0===u?void 0:u.call(c))||{}).css;null===(d=n.$style)||void 0===d||d.load(f,hv({name:"".concat(n.$style.name,"-variables")},o)),null===(p=n.$style)||void 0===p||p.loadTheme(hv({name:"".concat(n.$style.name,"-style")},o)),og.setLoadedStyleName(n.$style.name)}if(!og.isStyleNameLoaded("layer-order")){var h,m,g=null===(h=n.$style)||void 0===h||null===(m=h.getLayerOrderThemeCSS)||void 0===m?void 0:m.call(h);Pg.load(g,hv({name:"layer-order",first:!0},o)),og.setLoadedStyleName("layer-order")}}},_loadScopedThemeStyles:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=e.preset();if(n&&e.$attrSelector){var o,i,r,s=((null===(o=e.$style)||void 0===o||null===(i=o.getPresetTheme)||void 0===i?void 0:i.call(o,n,"[".concat(e.$attrSelector,"]")))||{}).css,a=null===(r=e.$style)||void 0===r?void 0:r.load(s,hv({name:"".concat(e.$attrSelector,"-").concat(e.$style.name)},t));e.scopedStyleEl=a.el}},_themeChangeListener:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};_g.clearLoadedStyleNames(),Wm.on("theme:change",e)},_hook:function(e,t,n,o,i,r){var s,a,l,c="on".concat(Cm(l=t,!1)?l[0].toUpperCase()+l.slice(1):l),u=gv._getConfig(o,i),d=null==n?void 0:n.$instance,p=gv._usePT(d,gv._getPT(null==o||null===(s=o.value)||void 0===s?void 0:s.pt,e),gv._getOptionValue,"hooks.".concat(c)),f=gv._useDefaultPT(d,null==u||null===(a=u.pt)||void 0===a||null===(a=a.directives)||void 0===a?void 0:a[e],gv._getOptionValue,"hooks.".concat(c)),h={el:n,binding:o,vnode:i,prevVnode:r};null==p||p(d,h),null==f||f(d,h)},_mergeProps:function(){for(var e=arguments.length>1?arguments[1]:void 0,t=arguments.length,n=new Array(t>2?t-2:0),o=2;o1&&void 0!==arguments[1]?arguments[1]:{},n=function(n,o,i,r,s){var a,l,c;o._$instances=o._$instances||{};var u=gv._getConfig(i,r),d=o._$instances[e]||{},p=_m(d)?hv(hv({},t),null==t?void 0:t.methods):{};o._$instances[e]=hv(hv({},d),{},{$name:e,$host:o,$binding:i,$modifiers:null==i?void 0:i.modifiers,$value:null==i?void 0:i.value,$el:d.$el||o||void 0,$style:hv({classes:void 0,inlineStyles:void 0,load:function(){},loadCSS:function(){},loadTheme:function(){}},null==t?void 0:t.style),$primevueConfig:u,$attrSelector:o.$attrSelector,defaultPT:function(){return gv._getPT(null==u?void 0:u.pt,void 0,(function(t){var n;return null==t||null===(n=t.directives)||void 0===n?void 0:n[e]}))},isUnstyled:function(){var e,t;return void 0!==(null===(e=o.$instance)||void 0===e||null===(e=e.$binding)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.unstyled)?null===(t=o.$instance)||void 0===t||null===(t=t.$binding)||void 0===t||null===(t=t.value)||void 0===t?void 0:t.unstyled:null==u?void 0:u.unstyled},theme:function(){var e;return null===(e=o.$instance)||void 0===e||null===(e=e.$primevueConfig)||void 0===e?void 0:e.theme},preset:function(){var e;return null===(e=o.$instance)||void 0===e||null===(e=e.$binding)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.dt},ptm:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return gv._getPTValue(o.$instance,null===(e=o.$instance)||void 0===e||null===(e=e.$binding)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.pt,t,hv({},n))},ptmo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return gv._getPTValue(o.$instance,e,t,n,!1)},cx:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return null!==(e=o.$instance)&&void 0!==e&&e.isUnstyled()?void 0:gv._getOptionValue(null===(t=o.$instance)||void 0===t||null===(t=t.$style)||void 0===t?void 0:t.classes,n,hv({},i))},sx:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?gv._getOptionValue(null===(e=o.$instance)||void 0===e||null===(e=e.$style)||void 0===e?void 0:e.inlineStyles,t,hv({},n)):void 0}},p),o.$instance=o._$instances[e],null===(a=(l=o.$instance)[n])||void 0===a||a.call(l,o,i,r,s),o["$".concat(e)]=o.$instance,gv._hook(e,n,o,i,r,s),o.$pd||(o.$pd={}),o.$pd[e]=hv(hv({},null===(c=o.$pd)||void 0===c?void 0:c[e]),{},{name:e,instance:o.$instance})};return{created:function(e,t,o,i){n("created",e,t,o,i)},beforeMount:function(e,t,o,i){e.$attrSelector=Bg("pd"),gv._loadStyles(e,t,o),n("beforeMount",e,t,o,i),function(e){var t,n,o,i,r,s=null===(t=e.$instance)||void 0===t?void 0:t.watch;null==s||null===(n=s.config)||void 0===n||n.call(e.$instance,null===(o=e.$instance)||void 0===o?void 0:o.$primevueConfig),cv.on("config:change",(function(t){var n,o=t.newValue,i=t.oldValue;return null==s||null===(n=s.config)||void 0===n?void 0:n.call(e.$instance,o,i)})),null==s||null===(i=s["config.ripple"])||void 0===i||i.call(e.$instance,null===(r=e.$instance)||void 0===r||null===(r=r.$primevueConfig)||void 0===r?void 0:r.ripple),cv.on("config:ripple:change",(function(t){var n,o=t.newValue,i=t.oldValue;return null==s||null===(n=s["config.ripple"])||void 0===n?void 0:n.call(e.$instance,o,i)}))}(e)},mounted:function(e,t,o,i){gv._loadStyles(e,t,o),n("mounted",e,t,o,i)},beforeUpdate:function(e,t,o,i){n("beforeUpdate",e,t,o,i)},updated:function(e,t,o,i){gv._loadStyles(e,t,o),n("updated",e,t,o,i)},beforeUnmount:function(e,t,o,i){n("beforeUnmount",e,t,o,i)},unmounted:function(e,t,o,i){var r;null===(r=e.$instance)||void 0===r||null===(r=r.scopedStyleEl)||void 0===r||null===(r=r.value)||void 0===r||r.remove(),n("unmounted",e,t,o,i)}}},extend:function(){var e=dv(gv._getMeta.apply(gv,arguments),2),t=e[0],n=e[1];return hv({extend:function(){var e=dv(gv._getMeta.apply(gv,arguments),2),t=e[0],o=e[1];return gv.extend(t,hv(hv(hv({},n),null==n?void 0:n.methods),o))}},gv._extend(t,n))}},vv=Pg.extend({name:"ripple-directive",theme:function(e){var t=e.dt;return"\n.p-ink {\n display: block;\n position: absolute;\n background: ".concat(t("ripple.background"),";\n border-radius: 100%;\n transform: scale(0);\n pointer-events: none;\n}\n\n.p-ink-active {\n animation: ripple 0.4s linear;\n}\n\n@keyframes ripple {\n 100% {\n opacity: 0;\n transform: scale(2.5);\n }\n}\n")},classes:{root:"p-ink"}});function yv(e){return(yv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function bv(e){return function(e){if(Array.isArray(e))return _v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return _v(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_v(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);ne.length)&&(t=e.length);for(var n=0,o=Array(t);n0||navigator.msMaxTouchPoints>0||o.hide(e),window.removeEventListener("resize",t)})),n.addEventListener("mouseleave",(function t(){o.hide(e),n.removeEventListener("mouseleave",t)})),this.bindScrollListener(e),jg.set("tooltip",n,e.$_ptooltipZIndex)}},show:function(e,t,n){var o=this;void 0!==n?this.timer=setTimeout((function(){return o.tooltipActions(e,t)}),n):this.tooltipActions(e,t)},tooltipRemoval:function(e){this.remove(e),this.unbindScrollListener(e)},hide:function(e,t){var n=this;clearTimeout(this.timer),void 0!==t?setTimeout((function(){return n.tooltipRemoval(e)}),t):this.tooltipRemoval(e)},getTooltipElement:function(e){return document.getElementById(e.$_ptooltipId)},create:function(e){var t=e.$_ptooltipModifiers,n=ug("div",{class:!this.isUnstyled()&&this.cx("arrow"),"p-bind":this.ptm("arrow",{context:t})}),o=ug("div",{class:!this.isUnstyled()&&this.cx("text"),"p-bind":this.ptm("text",{context:t})});e.$_ptooltipEscape?(o.innerHTML="",o.appendChild(document.createTextNode(e.$_ptooltipValue))):o.innerHTML=e.$_ptooltipValue;var i=ug("div",Iv(Iv({id:e.$_ptooltipIdAttr,role:"tooltip",style:{display:"inline-block",width:e.$_ptooltipFitContent?"fit-content":void 0,pointerEvents:!this.isUnstyled()&&e.$_ptooltipAutoHide&&"none"},class:[!this.isUnstyled()&&this.cx("root"),e.$_ptooltipClass]},this.$attrSelector,""),"p-bind",this.ptm("root",{context:t})),n,o);return document.body.appendChild(i),e.$_ptooltipId=i.id,this.$el=i,i},remove:function(e){if(e){var t=this.getTooltipElement(e);t&&t.parentElement&&(jg.clear(t),document.body.removeChild(t)),e.$_ptooltipId=null}},align:function(e){var t=e.$_ptooltipModifiers;t.top?(this.alignTop(e),this.isOutOfBounds(e)&&(this.alignBottom(e),this.isOutOfBounds(e)&&this.alignTop(e))):t.left?(this.alignLeft(e),this.isOutOfBounds(e)&&(this.alignRight(e),this.isOutOfBounds(e)&&(this.alignTop(e),this.isOutOfBounds(e)&&(this.alignBottom(e),this.isOutOfBounds(e)&&this.alignLeft(e))))):t.bottom?(this.alignBottom(e),this.isOutOfBounds(e)&&(this.alignTop(e),this.isOutOfBounds(e)&&this.alignBottom(e))):(this.alignRight(e),this.isOutOfBounds(e)&&(this.alignLeft(e),this.isOutOfBounds(e)&&(this.alignTop(e),this.isOutOfBounds(e)&&(this.alignBottom(e),this.isOutOfBounds(e)&&this.alignRight(e)))))},getHostOffset:function(e){var t=e.getBoundingClientRect();return{left:t.left+function(){let e=document.documentElement;return(window.pageXOffset||e.scrollLeft)-(e.clientLeft||0)}(),top:t.top+function(){let e=document.documentElement;return(window.pageYOffset||e.scrollTop)-(e.clientTop||0)}()}},alignRight:function(e){this.preAlign(e,"right");var t=this.getTooltipElement(e),n=this.getHostOffset(e),o=n.left+ag(e),i=n.top+(mg(e)-mg(t))/2;t.style.left=o+"px",t.style.top=i+"px"},alignLeft:function(e){this.preAlign(e,"left");var t=this.getTooltipElement(e),n=this.getHostOffset(e),o=n.left-ag(t),i=n.top+(mg(e)-mg(t))/2;t.style.left=o+"px",t.style.top=i+"px"},alignTop:function(e){this.preAlign(e,"top");var t=this.getTooltipElement(e),n=this.getHostOffset(e),o=n.left+(ag(e)-ag(t))/2,i=n.top-mg(t);t.style.left=o+"px",t.style.top=i+"px"},alignBottom:function(e){this.preAlign(e,"bottom");var t=this.getTooltipElement(e),n=this.getHostOffset(e),o=n.left+(ag(e)-ag(t))/2,i=n.top+mg(e);t.style.left=o+"px",t.style.top=i+"px"},preAlign:function(e,t){var n=this.getTooltipElement(e);n.style.left="-999px",n.style.top="-999px",sg(n,"p-tooltip-".concat(n.$_ptooltipPosition)),!this.isUnstyled()&&rg(n,"p-tooltip-".concat(t)),n.$_ptooltipPosition=t,n.setAttribute("data-p-position",t);var o=dg(n,'[data-pc-section="arrow"]');o.style.top="bottom"===t?"0":"right"===t||"left"===t||"right"!==t&&"left"!==t&&"top"!==t&&"bottom"!==t?"50%":null,o.style.bottom="top"===t?"0":null,o.style.left="right"===t||"right"!==t&&"left"!==t&&"top"!==t&&"bottom"!==t?"0":"top"===t||"bottom"===t?"50%":null,o.style.right="left"===t?"0":null},isOutOfBounds:function(e){var t=this.getTooltipElement(e),n=t.getBoundingClientRect(),o=n.top,i=n.left,r=ag(t),s=mg(t),a=function(){let e=window,t=document,n=t.documentElement,o=t.getElementsByTagName("body")[0];return{width:e.innerWidth||n.clientWidth||o.clientWidth,height:e.innerHeight||n.clientHeight||o.clientHeight}}();return i+r>a.width||i<0||o<0||o+s>a.height},getTarget:function(e){return ig(e,"p-inputwrapper")?dg(e,"input"):e},getModifiers:function(e){return e.modifiers&&Object.keys(e.modifiers).length?e.modifiers:e.arg&&"object"===Nv(e.arg)?Object.entries(e.arg).reduce((function(e,t){var n=Lv(t,2),o=n[0],i=n[1];return"event"!==o&&"position"!==o||(e[i]=!0),e}),{}):{}}}}),Dv={name:"Card",extends:{name:"BaseCard",extends:Jg,style:Pg.extend({name:"card",theme:function(e){var t=e.dt;return"\n.p-card {\n background: ".concat(t("card.background"),";\n color: ").concat(t("card.color"),";\n box-shadow: ").concat(t("card.shadow"),";\n border-radius: ").concat(t("card.border.radius"),";\n display: flex;\n flex-direction: column;\n}\n\n.p-card-caption {\n display: flex;\n flex-direction: column;\n gap: ").concat(t("card.caption.gap"),";\n}\n\n.p-card-body {\n padding: ").concat(t("card.body.padding"),";\n display: flex;\n flex-direction: column;\n gap: ").concat(t("card.body.gap"),";\n}\n\n.p-card-title {\n font-size: ").concat(t("card.title.font.size"),";\n font-weight: ").concat(t("card.title.font.weight"),";\n}\n\n.p-card-subtitle {\n color: ").concat(t("card.subtitle.color"),";\n}\n")},classes:{root:"p-card p-component",header:"p-card-header",body:"p-card-body",caption:"p-card-caption",title:"p-card-title",subtitle:"p-card-subtitle",content:"p-card-content",footer:"p-card-footer"}}),provide:function(){return{$pcCard:this,$parentInstance:this}}},inheritAttrs:!1};Dv.render=function(e,t,n,o,i,r){return $i(),Ui("div",nr({class:e.cx("root")},e.ptmi("root")),[e.$slots.header?($i(),Ui("div",nr({key:0,class:e.cx("header")},e.ptm("header")),[_o(e.$slots,"header")],16)):Ji("",!0),Zi("div",nr({class:e.cx("body")},e.ptm("body")),[e.$slots.title||e.$slots.subtitle?($i(),Ui("div",nr({key:0,class:e.cx("caption")},e.ptm("caption")),[e.$slots.title?($i(),Ui("div",nr({key:0,class:e.cx("title")},e.ptm("title")),[_o(e.$slots,"title")],16)):Ji("",!0),e.$slots.subtitle?($i(),Ui("div",nr({key:1,class:e.cx("subtitle")},e.ptm("subtitle")),[_o(e.$slots,"subtitle")],16)):Ji("",!0)],16)):Ji("",!0),Zi("div",nr({class:e.cx("content")},e.ptm("content")),[_o(e.$slots,"content")],16),e.$slots.footer?($i(),Ui("div",nr({key:1,class:e.cx("footer")},e.ptm("footer")),[_o(e.$slots,"footer")],16)):Ji("",!0)],16)],16)};const jv={class:"no-result-placeholder"},Mv={class:"no-result-placeholder-content"},Rv={key:0},$v={__name:"noResultsPlaceholder",props:{icon:{type:String,default:"",required:!1},iconSize:{type:String,default:"3rem",required:!1},title:{type:String,required:!0},message:{type:String,required:!1},buttonLabel:{type:String,default:"",required:!1}},emits:["action"],setup:e=>(t,n)=>($i(),Ui("div",jv,[Ki(hn(Dv),null,{content:Vn((()=>[Zi("div",Mv,[Zi("i",{class:Me(e.icon),style:Ie({"font-size":e.iconSize,"margin-bottom":".5rem"})},null,6),Zi("h3",null,Be(e.title),1),e.message?($i(),Ui("p",Rv,Be(e.message),1)):Ji("",!0),e.buttonLabel?($i(),zi(hn(Ev),{key:1,label:e.buttonLabel,onClick:n[0]||(n[0]=e=>t.$emit("action")),class:"p-button-text"},null,8,["label"])):Ji("",!0)])])),_:1})]))};var Gv=Pg.extend({name:"inputtext",theme:function(e){var t=e.dt;return"\n.p-inputtext {\n font-family: inherit;\n font-feature-settings: inherit;\n font-size: 1rem;\n color: ".concat(t("inputtext.color"),";\n background: ").concat(t("inputtext.background"),";\n padding: ").concat(t("inputtext.padding.y")," ").concat(t("inputtext.padding.x"),";\n border: 1px solid ").concat(t("inputtext.border.color"),";\n transition: background ").concat(t("inputtext.transition.duration"),", color ").concat(t("inputtext.transition.duration"),", border-color ").concat(t("inputtext.transition.duration"),", outline-color ").concat(t("inputtext.transition.duration"),", box-shadow ").concat(t("inputtext.transition.duration"),";\n appearance: none;\n border-radius: ").concat(t("inputtext.border.radius"),";\n outline-color: transparent;\n box-shadow: ").concat(t("inputtext.shadow"),";\n}\n\n.p-inputtext:enabled:hover {\n border-color: ").concat(t("inputtext.hover.border.color"),";\n}\n\n.p-inputtext:enabled:focus {\n border-color: ").concat(t("inputtext.focus.border.color"),";\n box-shadow: ").concat(t("inputtext.focus.ring.shadow"),";\n outline: ").concat(t("inputtext.focus.ring.width")," ").concat(t("inputtext.focus.ring.style")," ").concat(t("inputtext.focus.ring.color"),";\n outline-offset: ").concat(t("inputtext.focus.ring.offset"),";\n}\n\n.p-inputtext.p-invalid {\n border-color: ").concat(t("inputtext.invalid.border.color"),";\n}\n\n.p-inputtext.p-variant-filled {\n background: ").concat(t("inputtext.filled.background"),";\n}\n\n.p-inputtext.p-variant-filled:enabled:focus {\n background: ").concat(t("inputtext.filled.focus.background"),";\n}\n\n.p-inputtext:disabled {\n opacity: 1;\n background: ").concat(t("inputtext.disabled.background"),";\n color: ").concat(t("inputtext.disabled.color"),";\n}\n\n.p-inputtext::placeholder {\n color: ").concat(t("inputtext.placeholder.color"),";\n}\n\n.p-inputtext-sm {\n font-size: ").concat(t("inputtext.sm.font.size"),";\n padding: ").concat(t("inputtext.sm.padding.y")," ").concat(t("inputtext.sm.padding.x"),";\n}\n\n.p-inputtext-lg {\n font-size: ").concat(t("inputtext.lg.font.size"),";\n padding: ").concat(t("inputtext.lg.padding.y")," ").concat(t("inputtext.lg.padding.x"),";\n}\n\n.p-inputtext-fluid {\n width: 100%;\n}\n")},classes:{root:function(e){var t=e.instance,n=e.props;return["p-inputtext p-component",{"p-filled":t.filled,"p-inputtext-sm":"small"===n.size,"p-inputtext-lg":"large"===n.size,"p-invalid":n.invalid,"p-variant-filled":n.variant?"filled"===n.variant:"filled"===t.$primevue.config.inputStyle||"filled"===t.$primevue.config.inputVariant,"p-inputtext-fluid":t.hasFluid}]}}}),Bv={name:"InputText",extends:{name:"BaseInputText",extends:Jg,props:{modelValue:null,size:{type:String,default:null},invalid:{type:Boolean,default:!1},variant:{type:String,default:null},fluid:{type:Boolean,default:null}},style:Gv,provide:function(){return{$pcInputText:this,$parentInstance:this}}},inheritAttrs:!1,emits:["update:modelValue"],inject:{$pcFluid:{default:null}},methods:{getPTOptions:function(e){return("root"===e?this.ptmi:this.ptm)(e,{context:{filled:this.filled,disabled:this.$attrs.disabled||""===this.$attrs.disabled}})},onInput:function(e){this.$emit("update:modelValue",e.target.value)}},computed:{filled:function(){return null!=this.modelValue&&this.modelValue.toString().length>0},hasFluid:function(){return _m(this.fluid)?!!this.$pcFluid:this.fluid}}},Fv=["value","aria-invalid"];Bv.render=function(e,t,n,o,i,r){return $i(),Ui("input",nr({type:"text",class:e.cx("root"),value:e.modelValue,"aria-invalid":e.invalid||void 0,onInput:t[0]||(t[0]=function(){return r.onInput&&r.onInput.apply(r,arguments)})},r.getPTOptions("root")),null,16,Fv)};const Uv={class:"left flex-1"},zv={key:1,class:"edit"},Vv={key:2,class:"label"},Hv={class:"right toolbar"},Wv={key:0,class:"nodes"},Yv={__name:"group",props:{item:{type:Object,default:{}}},emits:["mousedown","mouseup","changeMode"],setup(e){const t=e,n=np(),o=pn(!1),i=pn(null),r=pn(""),s=e=>{var o,i;let r=t.item;if(!(null==(o=r.info)?void 0:o.is_edit)&&(null==(i=r.children)?void 0:i.length)>0){let e=y.canvas.graph._groups.find((e=>e.pos[0]==r.info.pos[0]&&e.pos[1]==r.info.pos[1]));e&&(e.show_nodes=!e.show_nodes,n.setGroups(y.canvas.graph._groups))}},a=async()=>{let e=t.item,i=y.canvas.graph._groups.find((t=>t.pos[0]==e.info.pos[0]&&t.pos[1]==e.info.pos[1]));i?(i.is_edit=!1,i.title=r.value,await n.setGroups(y.canvas.graph._groups),o.value=!1):o.value=!1};return(l,c)=>{var u,d,p;return $i(),Ui(Ni,null,[Zi("div",{class:Me("comfyui-easyuse-map-nodes-group"),onClick:s},[Zi("div",Uv,[e.item.children?($i(),Ui("i",{key:0,class:Me(["icon",e.item.info.show_nodes?"pi pi-folder-open":"pi pi-folder"]),style:Ie({color:e.item.info.color})},null,6)):Ji("",!0),(null==(u=e.item.info)?void 0:u.is_edit)?($i(),Ui("div",zv,[Ki(hn(Bv),{ref_key:"modifyRef",ref:i,modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=e=>r.value=e),variant:"outline",size:"small",type:"text",onBlur:a,onKeydown:[qr(a,["enter"]),qr(a,["esc"])],style:{width:"100%"}},null,8,["modelValue"])])):($i(),Ui("div",Vv,[Zi("span",{onDblclick:c[1]||(c[1]=Qr((s=>(async()=>{var e,s;if(o.value)return;let a=t.item,l=y.canvas.graph._groups.find((e=>e.pos[0]==a.info.pos[0]&&e.pos[1]==a.info.pos[1]));l&&(l.is_edit=!l.is_edit,r.value=l.is_edit?a.info.title:"",await n.setGroups(y.canvas.graph._groups),o.value=!0,null==(s=null==(e=i.value)?void 0:e[0])||s.$el.focus())})(e.item)),["stop"]))},Be(e.item.info.title),33)]))]),Zi("div",Hv,[(null==(d=e.item.children)?void 0:d.length)>0?($i(),zi(hn(Ev),{key:0,size:"small",icon:e.item.children.find((e=>e.mode==hn(j).ALWAYS))?"pi pi-eye":"pi pi-eye-slash",text:"",rounded:"",severity:"secondary",onClick:c[2]||(c[2]=Qr((e=>l.$emit("changeMode")),["stop"])),onMousedown:c[3]||(c[3]=Qr((e=>l.$emit("mousedown")),["stop"])),onMouseup:c[4]||(c[4]=Qr((e=>l.$emit("mouseup")),["stop"]))},null,8,["icon"])):Ji("",!0)])]),(null==(p=e.item.children)?void 0:p.length)>0&&e.item.info.show_nodes?($i(),Ui("div",Wv,[_o(l.$slots,"default")])):Ji("",!0)],64)}}},Zv={key:1,class:"label error"},Kv={class:"right toolbar"},Xv={__name:"node",props:{node:{type:Object,default:{}}},emits:["mousedown","mouseup","changeMode"],setup:e=>(t,n)=>($i(),Ui("div",{class:Me(["comfyui-easyuse-map-nodes-node",{never:void 0!==e.node.mode&&e.node.mode==hn(j).NEVER},{bypass:void 0!==e.node.mode&&e.node.mode==hn(j).BYPASS}])},[void 0!==e.node.title?($i(),Ui("span",{key:0,class:"label",onDblclick:n[0]||(n[0]=Qr((t=>hn(Lp)(e.node.id)),["stop"]))},Be(e.node.title),33)):($i(),Ui("span",Zv,Be(e.node.type),1)),Zi("div",Kv,[Ki(hn(Ev),{size:"small",icon:e.node.mode==hn(j).ALWAYS?"pi pi-eye":"pi pi-eye-slash",text:"",rounded:"",severity:"secondary",onClick:n[1]||(n[1]=Qr((e=>t.$emit("changeMode")),["stop"])),onMousedown:n[2]||(n[2]=Qr((e=>t.$emit("mousedown")),["stop"])),onMouseup:n[3]||(n[3]=Qr((e=>t.$emit("mouseup")),["stop"]))},null,8,["icon"])])],2))},Qv={class:"title"},Jv={class:"toolbar"},qv={key:0},ey={key:1,class:"no_result",style:{height:"100%"}},ty="comfyui-easyuse-map-nodes",ny={__name:"nodesMap",setup(e){const t=np(),{groups_nodes:n,groups:o}=ws(t),i=pn(!1),r=e=>{i.value=!i.value,y.canvas.graph._groups.forEach((e=>{e.show_nodes=i.value})),t.setGroups(y.canvas.graph._groups)};let s,a=0,l=0,c=!1;const u=(e,n=!1)=>{if(c)return void(c=!1);const o=e.children.find((e=>e.mode==j.ALWAYS)),i=e.children.map((e=>e.id));y.canvas.graph._nodes.forEach((e=>{i.includes(e.id)&&(e.mode=o?n?j.NEVER:j.BYPASS:j.ALWAYS,e.graph.change())})),t.setNodes(y.canvas.graph._nodes)},d=(e,n=!1)=>{if(c)return void(c=!1);const o=e.mode==j.ALWAYS,i=y.canvas.graph._nodes.find((t=>t.id==e.id));i&&(i.mode=o?n?j.NEVER:j.BYPASS:j.ALWAYS,i.graph.change(),t.setNodes(y.canvas.graph._nodes))},p=(e,t="group")=>{a=(new Date).getTime(),clearTimeout(s),s=setTimeout((n=>{"group"==t?u(e,!0):d(e,!0)}),500)},f=e=>{l=(new Date).getTime(),l-a>500&&(c=!0),clearTimeout(s)};return(e,t)=>{var s,a;return $i(),Ui("div",{class:Me(ty)},[Zi("div",{class:Me(ty+"__header")},[Zi("div",Qv,Be(hn(V)("Nodes Map",!0)),1),Zi("div",Jv,[(null==(s=hn(o))?void 0:s.length)>0?Hn(($i(),zi(hn(Ev),{key:0,icon:i.value?"pi pi-angle-double-down":"pi pi-angle-double-up",text:"",rounded:"",severity:"secondary",onClick:r,size:"small"},null,8,["icon"])),[[hn(Pv),i.value?hn(V)("Collapse All"):hn(V)("Expand All"),void 0,{right:!0}]]):Ji("",!0)])],2),Zi("div",{class:Me(ty+"__content")},[(null==(a=hn(n))?void 0:a.length)>0?($i(),Ui("ol",qv,[($i(!0),Ui(Ni,null,bo(hn(n),((e,t)=>($i(),Ui("li",{key:t},[void 0!==e.children?($i(),zi(Yv,{key:0,item:e,onChangeMode:t=>u(e),onMousedown:t=>p(e,"group"),onMouseup:f},{default:Vn((()=>[($i(!0),Ui(Ni,null,bo(e.children,((e,t)=>($i(),zi(Xv,{key:t,node:e,onChangeMode:t=>d(e),onMousedown:t=>p(e,"node"),onMouseup:f},null,8,["node","onChangeMode","onMousedown"])))),128))])),_:2},1032,["item","onChangeMode","onMousedown"])):($i(),zi(Xv,{key:1,node:e.info,onChangeMode:t=>d(e.info),onMousedown:t=>p(e.info,"node"),onMouseup:f},null,8,["node","onChangeMode","onMousedown"]))])))),128))])):($i(),Ui("div",ey,[Ki($v,{icon:"pi pi-sitemap",title:hn(V)("No Nodes",!0),message:hn(V)("No nodes found in the map",!0)},null,8,["title","message"])]))],2)])}}},oy={__name:"index",setup(e){const t=np();return oo((e=>{t.watchGraph()})),ao((e=>{})),(e,t)=>($i(),Ui("div",{class:Me("comfyui-easyuse-map")},[Ki(ny)]))}},iy={__name:"App",setup(e){const t=e=>{y.extensionManager.registerSidebarTab({id:M,icon:"pi pi-sitemap",title:V("Nodes Map",!0),tooltip:V("Nodes Map",!0),type:"custom",render:e=>{e.style.height="100%",((...e)=>{ns().render(...e)})(function(e,t,n){const o=arguments.length;return 2===o?ue(t)&&!ie(t)?Vi(t)?Ki(e,null,[t]):Ki(e,t):Ki(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):3===o&&Vi(n)&&(n=[n]),Ki(e,t,n))}(oy,{}),e)}})};return oo((e=>{try{t()}catch(n){}})),(e,t)=>($i(),zi(hm))}};var ry="equals",sy="notEquals";function ay(e){return(ay="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ly(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function cy(e){for(var t=1;t{const t=ns().createApp(...e),{mount:n}=t;return t.mount=e=>{const o=function(e){if(le(e)){return document.querySelector(e)}return e}(e);if(!o)return;const i=t._component;ae(i)||i.render||i.template||(i.template=o.innerHTML),o.innerHTML="";const r=n(o,!1,function(e){if(e instanceof SVGElement)return"svg";if("function"==typeof MathMLElement&&e instanceof MathMLElement)return"mathml"}(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),r},t})(iy);yy.use(my),yy.use(function(){const e=We(!0),t=e.run((()=>pn({})));let n=[],o=[];const i=rn({install(e){is(i),i._a=e,e.provide(rs,i),e.config.globalProperties.$pinia=i,o.forEach((e=>n.push(e))),o=[]},use(e){return this._a?n.push(e):o.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return i}()),yy.mount("#"+vy.id);