diff --git a/dist/workspace_web/App-6SVuhhTl.js b/dist/workspace_web/App-4M5AgwD2.js similarity index 99% rename from dist/workspace_web/App-6SVuhhTl.js rename to dist/workspace_web/App-4M5AgwD2.js index 06901b6..2b168e6 100644 --- a/dist/workspace_web/App-6SVuhhTl.js +++ b/dist/workspace_web/App-4M5AgwD2.js @@ -9,7 +9,7 @@ From previous: `);return this._state!==null&&(this._stack=t),t}finally{Wo=!1}}}, πŸ‘‰Please try "Save as" from "Files" dropdown menu `),new Error(p.error);return p}t.saveWorkflow=o;async function s(l){try{return await(await Ee("/workspace/delete_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:xo(l),deleteEmptyFolder:!1})})).text()}catch(u){alert("Error deleting workflow .json file: "+u),console.error("Error deleting file:",u)}}t.deleteWorkflow=s;async function i({parentFolderID:l,name:u,json:c,id:d}){var v;let p=JSON.parse(c);p.extra==null&&(p.extra={}),p.extra[We]==null&&(p.extra[We]={}),p.extra[We].id=d;const h={parentFolderPath:Ft(l??""),name:u,json:JSON.stringify(p)};try{const m=await(await Ee("/workspace/create_workflow_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)})).json();return m.name&&await((v=ie.workflows)==null?void 0:v.update(d,{name:m.name})),m}catch(f){return console.error(`Error creating file <${d}> at "${l}"`,f),alert(`Error creating file <${d}> at "${l}"`),{}}}t.createWorkflow=i;async function a({parentFolderID:l,name:u,id:c}){const d=Er(l??"",u+".json");try{const h=await(await Ee("/workspace/get_workflow_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:d,id:c})})).json();return h.error&&(console.error(`Error getting file <${c}> at "${d}"`,h.error),alert({message:`Error getting file <${c}> at "${d}"`,level:"error"})),h}catch(p){return console.error(`Erro finding file <${c}> at "${d}"`,p),{}}}t.getFile=a})(Qe||(Qe={}));async function Vs(t,e=!1,n=!1){try{return await(await Ee("/workspace/file/scan_my_workflows_folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:Ft(t),recursive:e,metaInfoOnly:n})})).json()}catch(r){return console.error("Error scan local new files:",r),[]}}async function gh(t,e){const n=Ft(t??""),o=(await Vs(n)).map(async a=>{var c;const l=a.name,u=[n,l].join("/");return wh(a)?{id:Ft(u),name:a.name,parentFolderID:n,type:"folder",createTime:Date.now(),updateTime:Date.now()}:{...await((c=ie.workflows)==null?void 0:c.get(a.id))??{createTime:Date.now(),updateTime:Date.now()},id:a.id,json:a.json??"{}",name:l.replace(/\.json$/,""),parentFolderID:n,createTime:a.createTime}}),s=await Promise.all(o);ie.workflows.bulkPut(s.filter(a=>!Oh(a)));const i=s.filter(a=>a!=null);return kr(i,e??ut.RECENTLY_MODIFIED)}function wh(t){return"type"in t&&t.type==="folder"}const Wr=class Wr extends Xt{constructor(){super("workflows");Oe(this,"_curWorkflow",null)}get curWorkflow(){return this._curWorkflow}static async load(){return new Wr}updateCurWorkflowID(n){if(n==null){this._curWorkflow=null;return}this.get(n).then(r=>{this._curWorkflow=r??null})}updateCurWorkflow(n){this._curWorkflow=n}async latestVersionCheck(){if(this._curWorkflow){const n=await ie.workflows.get(this._curWorkflow.id);return n?(n==null?void 0:n.updateTime)===this._curWorkflow.updateTime:!0}return!0}async listByIndex(n,r){const o=await super.listByIndex(n,r);return await(Y==null?void 0:Y.getSetting("twoWaySync"))?(await Promise.all(o.map(async a=>await this.get(a.id)))).filter(a=>a!=null):o}async generateUniqueName(n,r){if(await(Y==null?void 0:Y.getSetting("twoWaySync"))){const l=await Qe.genFileUniqueName((n??"Untitled Flow")+".json",r??"");return(l==null?void 0:l.replace(/\.json$/,""))??"Untitled Flow"}let s=n??"Untitled Flow";const a=(await this.listAll()??[]).filter(l=>l.parentFolderID==r).map(l=>l.name);if(a.includes(s)){let l=2,u=!0;for(;u;)a.includes(`${s} ${l}`)?l++:(s=`${s} ${l}`,u=!1)}return s}async createFlow(n){const{name:r}=n,o=await this.generateUniqueName(r,n.parentFolderID??void 0),s=Date.now(),i={...n,id:n.id??Mn(),json:n.json??JSON.stringify(ul),name:o,updateTime:n.updateTime??s,createTime:n.createTime??s};return await ie.workflows.add(i),this.saveDiskDB(),await(Y==null?void 0:Y.getSetting("twoWaySync"))?(await Qe.createWorkflow(i),await this.get(i.id)):(dr(i),i)}async update(n,r){throw new Error("Method not allowed.")}async updateTopFields(n,r){return this._update(n,r)}async updateMetaInfo(n,r){return this._update(n,r)}async _update(n,r){await ie.workflows.update(n,r);const o=await ie.workflows.get(n)??null;return this._curWorkflow&&this._curWorkflow.id===n&&(this._curWorkflow=o),this.saveDiskDB(),o}async updateFolder(n,r){var a;const o=await(Y==null?void 0:Y.getSetting("twoWaySync")),s=await this.get(n),i=await this.updateMetaInfo(n,r);!i||!s||(o?await Qe.moveWorkflow(s,r.parentFolderID):(await dr(i),await ko(s),(i==null?void 0:i.parentFolderID)!=null&&await((a=ie.folders)==null?void 0:a.update(i.parentFolderID,{updateTime:Date.now()}))))}async genLastManualSavedJson(n){const r=await(Ge==null?void 0:Ge.getLastestByWorkflowID(n));return r==null?void 0:r.json}async updateName(n,r){const o=await this.get(n);return await(Y==null?void 0:Y.getSetting("twoWaySync"))&&o&&await Qe.renameWorkflow(o,r.name+".json"),await this.updateMetaInfo(n,r)}async updateFlow(n,r){const o=await this.get(n,!1);if(o==null)return;const s=JSON.stringify(o.json),i=JSON.stringify(r.json);if(s===i)return;const a=await this._update(n,{updateTime:Date.now(),json:r.json});await(Y==null?void 0:Y.getSetting("twoWaySync"))?a&&await Qe.saveWorkflow(a):a&&await dr(a)}async batchCreateFlows(n=[],r=!1,o){var i,a;const s=[];for(const l of n){const u=l.name&&r?l.name:await this.generateUniqueName(l.name,o),c=Mn(),d=Date.now(),p={id:c,name:u,json:l.json,parentFolderID:o,updateTime:d,createTime:d,tags:[]};if(s.push(p),await(Y==null?void 0:Y.getSetting("twoWaySync")))try{const v=JSON.parse(l.json),f=(a=(i=v==null?void 0:v.extra)==null?void 0:i[We])==null?void 0:a.id;f&&(await this.get(f)||(p.id=f)),Qe.createWorkflow(p)}catch(v){console.error("batchCreateFlows error",v)}else await dr(p)}try{await ie.workflows.bulkAdd(s),this.saveDiskDB()}catch(l){console.error("batchCreateFlows error",l)}}async deleteFlow(n){const r=await this.get(n);r&&(await(Y==null?void 0:Y.getSetting("twoWaySync"))?await Qe.deleteWorkflow(r):ko({...r})),await ie.workflows.delete(n),this.saveDiskDB()}async batchDeleteFlow(n){const r=await ie.workflows.bulkGet(n);for(const o of r){if(!o)return;await(Y==null?void 0:Y.getSetting("twoWaySync"))?await Qe.deleteWorkflow(o):ko({...o})}await ie.workflows.bulkDelete(n),this.saveDiskDB()}async listFolderContent(n,r){if(await(Y==null?void 0:Y.getSetting("twoWaySync"))){const l=await gh(n??null);return kr(l,r??ut.RECENTLY_MODIFIED)}const s=await this.listAll().then(l=>l.filter(u=>u.parentFolderID==n))??[],i=await(Le==null?void 0:Le.listAll().then(l=>l.filter(u=>u.parentFolderID==n)))??[],a=[...s,...i];return kr(a,r??ut.RECENTLY_MODIFIED)}async get(n,r=!0){const o=await(Y==null?void 0:Y.getSetting("twoWaySync")),s=await ie.workflows.get(n);if(!o||!r)return s;if(s==null)return;const i=await Qe.getFile({parentFolderID:s.parentFolderID??null,name:s.name,id:s.id});if(i.json)return{...s,json:JSON.stringify(i.json)}}async listAll(n){const r=await(Y==null?void 0:Y.getSetting("twoWaySync"));let o;if(r){const i=(await Vs("",!0)).filter(a=>(a==null?void 0:a.type)==="workflow").map(async a=>{const l=await ie.workflows.get(a.id);return a.updateTime=(l==null?void 0:l.updateTime)??Date.now(),l!=null&&l.lastOpenedTime&&(a.lastOpenedTime=l==null?void 0:l.lastOpenedTime),a});o=await Promise.all(i)}else o=await ie.workflows.toArray();return n?kr(o,n):o}async updateLastOpenedTime(n){await ie.workflows.update(n,{lastOpenedTime:Date.now()})}};Oe(Wr,"TABLE_NAME","workflows");let is=Wr;const Ur=class Ur extends Xt{constructor(){super("folders")}static async load(){return new Ur}async create(e){const n=await this.generateUniqueName(e.name,e.parentFolderID),r=await(Y==null?void 0:Y.getSetting("twoWaySync")),o=await Dt.genFolderRelPath({name:n,parentFolderID:e.parentFolderID??""}),s={id:r?o:Mn(),name:n,parentFolderID:e.parentFolderID??null,updateTime:Date.now(),createTime:Date.now(),type:"folder"};return r?await Dt.createFolder(s):(await ie.folders.add(s),this.saveDiskDB()),s}async update(e,n){if(await(Y==null?void 0:Y.getSetting("twoWaySync")))return"parentFolderID"in n&&await Dt.moveFolder(e,n.parentFolderID??""),"name"in n&&await Dt.renameFolder(e,n.name??""),null;const o=await this.get(e);if(o==null)return null;"name"in n&&n.name!=o.name;const s="parentFolderID"in n&&n.parentFolderID!=o.parentFolderID,i={...o,...n};return n.name!=null&&(i.updateTime=Date.now()),s&&(n.name=await this.generateUniqueName(i.name,i.parentFolderID??void 0)),await ie.folders.update(e,n),this.saveDiskDB(),i}async deleteFolder(e,n=xr.DELETE){if(await(Y==null?void 0:Y.getSetting("twoWaySync"))){await Vs(e,!0,!0).then(a=>{a.forEach(l=>{l.type==="workflow"&&(H==null||H.deleteFlow(l.id))})}),await Dt.deleteFolder(e);return}const o=await(H==null?void 0:H.listAll())??[],s=await this.listAll(),i=[e];for(;i.length>0;){const a=i.shift();if(a){for(const u of o)if(u.parentFolderID===a)switch(n){case xr.DELETE:await(H==null?void 0:H.deleteFlow(u.id));break;case xr.MOVE_TO_ROOT_FOLDER:await(H==null?void 0:H.updateFolder(u.id,{parentFolderID:void 0}));break}await ie.folders.delete(a);const l=s.filter(u=>u.parentFolderID===a).map(u=>u.id);l.length&&i.push(...l)}}this.saveDiskDB()}async generateUniqueName(e,n){if(await(Y==null?void 0:Y.getSetting("twoWaySync")))return await Qe.genFileUniqueName(e??"New folder",n??"")??"New folder";let o=e??"New folder";const s=await this.listAll().then(i=>i.filter(a=>a.parentFolderID==n).map(a=>a.name));if(s.includes(o)){let i=2,a=!0;for(;a;)s.includes(`${o} ${i}`)?i++:(o=`${o} ${i}`,a=!1)}return o}};Oe(Ur,"TABLE_NAME","folders");let ls=Ur;function bh(t){return new Promise((e,n)=>{const r=new FileReader;r.onload=o=>{const s=new Uint8Array(o.target.result),i=new DataView(s.buffer);i.getUint32(0)!==2303741511&&(console.error("Not a valid PNG file"),n());let a=8;const l={};for(;aString.fromCharCode(f)).join("");l[p]=v}a+=12+u}e(l)},r.readAsArrayBuffer(t)})}function _h(t){const e=new Uint16Array(t.slice(0,2))[0]===18761;function n(i,a,l){const u=t.slice(i,i+l);if(l===2)return new DataView(u.buffer,u.byteOffset,u.byteLength).getUint16(0,a);if(l===4)return new DataView(u.buffer,u.byteOffset,u.byteLength).getUint32(0,a)}const r=n(4,e,4);function o(i){const a=n(i,e,2),l={};for(let u=0;u{const n=new FileReader;n.onload=r=>{var l;const o=new Uint8Array((l=r==null?void 0:r.target)==null?void 0:l.result),s=new DataView(o.buffer);if(s.getUint32(0)!==1380533830||s.getUint32(8)!==1464156752){console.error("Not a valid WEBP file"),e();return}let i=12;const a={};for(;i{const n=new FileReader;n.onload=r=>{const o=new Uint8Array(r.target.result),s=new DataView(o.buffer),i=new TextDecoder;if(s.getUint32(0)==440786851){let a=12;for(;a>8*(4-c)&~(1<<7*c),p=i.decode(o.slice(a+2+c,a+2+c+d)),h=JSON.parse(p);e(h);return}}a+=1}}else if(s.getUint32(4)==1718909296&&s.getUint32(8)==1769172845){let a=o.length-4;for(;a>16;){if(s.getUint32(a)==1684108385&&s.getUint32(a-8)==2841865588){s.getUint32(a+4),s.getUint32(a+8);const l=s.getUint32(a-4)-4*4,u=i.decode(o.slice(a+12,a+12+l)),c=JSON.parse(u);e(c);return}a-=1}}else{console.error("Unknown magic: "+s.getUint32(0)),e();return}},n.readAsArrayBuffer(t)})}function Ch(t){const e=t.split(".").pop();return fetch(t).then(n=>{if(!n.ok)throw new Error("Network response was not ok");return n.blob()}).then(async n=>{const r=t.split("/").pop()??"",o=new File([n],r);if(kh(t))return Eh(o);if(e==="webp")return xh(o);const s=await bh(o),i=JSON.parse(s==null?void 0:s.prompt),a=JSON.parse(s==null?void 0:s.workflow);return{prompt:i,workflow:a}})}class dl extends Xt{constructor(){super("media")}async listByWorkflowID(e){return await ie.media.where("workflowID").equals(e).reverse().sortBy("createTime")}async create(e){const n=e.localPath.split(".").pop();if(n==null)return null;const r=await Ch(`/workspace/view_media?filename=${e.localPath}`).catch(s=>(console.error("get meta error:",s),{prompt:""})),o={id:e.localPath,localPath:e.localPath,workflowID:e.workflowID,createTime:Date.now(),workflowJSON:JSON.stringify(r==null?void 0:r.prompt),format:n};return await(H==null?void 0:H.updateMetaInfo(e.workflowID,{latestImage:o.localPath})),ie.media.put(o),this.saveDiskDB(),o}async delete(e){var n,r;super.delete(e),((n=H==null?void 0:H.curWorkflow)==null?void 0:n.coverMediaPath)===e&&(H==null||H.updateMetaInfo(H.curWorkflow.id,{coverMediaPath:void 0})),((r=H==null?void 0:H.curWorkflow)==null?void 0:r.latestImage)===e&&(H==null||H.updateMetaInfo(H.curWorkflow.id,{latestImage:void 0}))}}Oe(dl,"TABLE_NAME","media");const em=["Checkpoint","TextualInversion","Hypernetwork","LORA","Controlnet","Upscaler","VAE"],Sh={Checkpoint:"checkpoints",TextualInversion:"embeddings",Hypernetwork:"hypernetworks",LORA:"loras",Controlnet:"controlnet",Upscaler:"upscale_models",VAE:"vae"};function tm(t){return t.modelVersions!==void 0}function Ih(t){var e;return((e=t.files)==null?void 0:e[0])!==void 0}function nm(t,e){var r,o,s,i,a,l;if(!t)return;let n;return Ih(t)?n={id:t.id,SHA256:(o=(r=t.files)==null?void 0:r[0].hashes)==null?void 0:o.SHA256,name:(s=t.files)==null?void 0:s[0].name,sizeKB:(a=(i=t.files)==null?void 0:i[0])==null?void 0:a.sizeKB}:n={id:t.id,SHA256:(l=t.hashes)==null?void 0:l[2],name:`${e} ${t.name}`},n}const Kr=class Kr extends Xt{constructor(){super("userSettings");Oe(this,"defaultSettings");Oe(this,"DEFAULT_USER","guest");Oe(this,"_autoSave",!1);Oe(this,"_settings");this.defaultSettings={id:this.DEFAULT_USER,topBarStyle:{top:0,left:0},myWorkflowsDir:"",shortcuts:{save:"Shift+S",saveAs:"Control+Alt+S",openSpotlightSearch:"Control+P"},defaultFolders:Sh,autoSave:!1,autoSaveDuration:3,twoWaySync:!1,foldersOnTop:!1,cloudHost:"https://www.nodecafe.org",overwriteCurWorkflowWhenDroppingFileToCanvas:!1,maximumChangelogNumber:80,hideCoverImage:!1,disableUnsavedWarning:!1}}get settings(){return this._settings}get autoSave(){return this._autoSave}async getSetting(n){const r=await this.get(this.DEFAULT_USER);return n==="shortcuts"&&(r!=null&&r.shortcuts)?{...this.defaultSettings.shortcuts,...r.shortcuts}:(r==null?void 0:r[n])??this.defaultSettings[n]}async upsert(n){const o={...await this.get(this.DEFAULT_USER)??this.defaultSettings,...n};await this.put(o),this._settings={...this.defaultSettings,...o}}static async load(){const n=new Kr,r=await cf();return n.defaultSettings.myWorkflowsDir=r.path,await n.get(n.DEFAULT_USER).then(o=>{n._autoSave=(o==null?void 0:o.autoSave)??!1,n._settings={...n.defaultSettings,...o}}),n.defaultSettings.cloudHost.includes("comfyspace.art")&&await n.upsert({cloudHost:n.defaultSettings.cloudHost}),n}};Oe(Kr,"TABLE_NAME","userSettings");let cs=Kr;const $r=class $r extends Xt{constructor(){super("tags")}static async load(){return new $r}};Oe($r,"TABLE_NAME","tags");let us=$r;const Hr=class Hr extends Xt{constructor(){super("workflowVersions")}static async load(){return new Hr}async listByWorkflowID(e){return await ie[this.tableName].where("workflowID").equals(e).reverse().sortBy("createTime")??[]}async getLatestByWorkflowID(e){const n=await this.listByWorkflowID(e);return n!=null&&n.length?n[0]:null}};Oe(Hr,"TABLE_NAME","workflowVersions");let ds=Hr;function Oh(t){return"type"in t&&t.type==="folder"}let H=null,Cr=null,Y=null,Le=null,Ge=null,qt=null,ge=null;async function Dh(){const t=async()=>{H=await is.load()},e=async()=>{Cr=await us.load()},n=async()=>{Y=await cs.load()},r=async()=>{Le=await ls.load()},o=async()=>{Ge=await as.load()},s=async()=>{qt=new dl},i=async()=>{ge=await ds.load()};await Promise.all([t(),e(),n(),r(),o(),s(),i()]),localStorage.getItem("WORKSPACE_INDEXDB_BACKFILL")!=="true"&&(await jh(),localStorage.setItem("WORKSPACE_INDEXDB_BACKFILL","true"))}async function jh(){const t=async()=>{try{const a=await(H==null?void 0:H.getRecords());a&&await ie.workflows.bulkPut(Object.values(a))}catch(a){console.error(a)}},e=async()=>{try{const a=await(Le==null?void 0:Le.getRecords());a&&await ie.folders.bulkPut(Object.values(a))}catch(a){console.error(a)}},n=async()=>{try{const a=await(qt==null?void 0:qt.getRecords());a&&await ie.media.bulkPut(Object.values(a))}catch(a){console.error(a)}},r=async()=>{try{const a=await(Ge==null?void 0:Ge.getRecords());a&&await ie.changelogs.bulkPut(Object.values(a))}catch(a){console.error(a)}},o=async()=>{try{const a=await(Cr==null?void 0:Cr.getRecords());a&&await ie.tags.bulkPut(Object.values(a))}catch(a){console.error(a)}},s=async()=>{try{const a=Y,l=await a.getRecords().then(u=>u[a.DEFAULT_USER]?u[a.DEFAULT_USER]:u);await ie.userSettings.put({...a.defaultSettings,...l})}catch(a){console.error(a)}},i=async()=>{try{const a=await(ge==null?void 0:ge.getRecords());a&&await ie.workflowVersions.bulkPut(Object.values(a))}catch(a){console.error(a)}};await Promise.all([t(),e(),n(),r(),o(),s(),i()])}const at=P.createContext({curFlowID:null,loadWorkflowID:()=>{},saveCurWorkflow:async()=>{},discardUnsavedChanges:async()=>{},isDirty:!1,loadNewWorkflow:()=>{},loadFilePath:()=>{},setRoute:()=>{},route:"root",curVersion:null,setIsDirty:()=>{},setCurVersion:()=>{},setCurFlowIDAndName:()=>{}}),rm=P.createContext({refreshFolderStamp:0,setRefreshFolderStamp:()=>{}}),Eo={x:0,y:0};function Ph({children:t,onDragEnd:e,dragIconId:n}){const r=P.useRef(Eo),o=P.useRef(!1),[s,i]=P.useState(Eo),a=d=>{var p,h,v;if(!(!(d.target instanceof Element)||!(d.target.parentNode instanceof Element))&&[(p=d.target)==null?void 0:p.id,(v=(h=d.target)==null?void 0:h.parentNode)==null?void 0:v.id].includes(n)){r.current={x:d.clientX,y:d.clientY},o.current=!0,window.addEventListener("mousemove",l),window.addEventListener("mouseup",u);const f=document.getElementsByTagName("body")[0];f.style.userSelect="none"}},l=P.useCallback(d=>{const p={x:d.clientX-r.current.x,y:d.clientY-r.current.y};i(p)},[]),u=P.useCallback(()=>{i(p=>(setTimeout(()=>{e(p)},0),Eo)),o.current=!1;const d=document.getElementsByTagName("body")[0];d.style.userSelect="auto",window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",u)},[e,l]),c={transform:`translate(${s.x}px, ${s.y}px)`,zIndex:o.current?1e3:1};return k.jsx("div",{style:c,onMouseDown:a,children:t})}var Ah={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},Nh=Object.defineProperty,Fh=Object.defineProperties,Rh=Object.getOwnPropertyDescriptors,Br=Object.getOwnPropertySymbols,fl=Object.prototype.hasOwnProperty,hl=Object.prototype.propertyIsEnumerable,Sa=(t,e,n)=>e in t?Nh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ia=(t,e)=>{for(var n in e||(e={}))fl.call(e,n)&&Sa(t,n,e[n]);if(Br)for(var n of Br(e))hl.call(e,n)&&Sa(t,n,e[n]);return t},Th=(t,e)=>Fh(t,Rh(e)),Mh=(t,e)=>{var n={};for(var r in t)fl.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Br)for(var r of Br(t))e.indexOf(r)<0&&hl.call(t,r)&&(n[r]=t[r]);return n},Ae=(t,e,n)=>{const r=P.forwardRef((o,s)=>{var i=o,{color:a="currentColor",size:l=24,stroke:u=2,children:c}=i,d=Mh(i,["color","size","stroke","children"]);return P.createElement("svg",Ia(Th(Ia({ref:s},Ah),{width:l,height:l,stroke:a,strokeWidth:u,className:`tabler-icon tabler-icon-${t}`}),d),[...n.map(([p,h])=>P.createElement(p,h)),...c||[]])});return r.propTypes={color:Bt.string,size:Bt.oneOfType([Bt.string,Bt.number]),stroke:Bt.oneOfType([Bt.string,Bt.number])},r.displayName=`${e}`,r},Bh=Ae("arrow-back-up-double","IconArrowBackUpDouble",[["path",{d:"M13 14l-4 -4l4 -4",key:"svg-0"}],["path",{d:"M8 14l-4 -4l4 -4",key:"svg-1"}],["path",{d:"M9 10h7a4 4 0 1 1 0 8h-1",key:"svg-2"}]]),zh=Ae("chevron-down","IconChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]),zr=Ae("device-floppy","IconDeviceFloppy",[["path",{d:"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2",key:"svg-0"}],["path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M14 4l0 4l-6 0l0 -4",key:"svg-2"}]]),Lh=Ae("download","IconDownload",[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 11l5 5l5 -5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]]),pl=Ae("external-link","IconExternalLink",[["path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6",key:"svg-0"}],["path",{d:"M11 13l9 -9",key:"svg-1"}],["path",{d:"M15 4h5v5",key:"svg-2"}]]),Wh=Ae("folder","IconFolder",[["path",{d:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2",key:"svg-0"}]]),Uh=Ae("grip-vertical","IconGripVertical",[["path",{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}],["path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-3"}],["path",{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-4"}],["path",{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-5"}]]),Kh=Ae("history","IconHistory",[["path",{d:"M12 8l0 4l2 2",key:"svg-0"}],["path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5",key:"svg-1"}]]),$h=Ae("info-circle","IconInfoCircle",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 9h.01",key:"svg-1"}],["path",{d:"M11 12h1v4h1",key:"svg-2"}]]),Hh=Ae("link","IconLink",[["path",{d:"M9 15l6 -6",key:"svg-0"}],["path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464",key:"svg-1"}],["path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463",key:"svg-2"}]]),ml=Ae("lock","IconLock",[["path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z",key:"svg-0"}],["path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-4a4 4 0 1 1 8 0v4",key:"svg-2"}]]),Vh=Ae("pencil","IconPencil",[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}]]),qh=Ae("photo","IconPhoto",[["path",{d:"M15 8h.01",key:"svg-0"}],["path",{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z",key:"svg-1"}],["path",{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5",key:"svg-2"}],["path",{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3",key:"svg-3"}]]),Gh=Ae("plus","IconPlus",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]]),Zh=Ae("refresh","IconRefresh",[["path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4",key:"svg-0"}],["path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4",key:"svg-1"}]]),Yh=Ae("share-2","IconShare2",[["path",{d:"M8 9h-1a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-1",key:"svg-0"}],["path",{d:"M12 14v-11",key:"svg-1"}],["path",{d:"M9 6l3 -3l3 3",key:"svg-2"}]]),Jh=Ae("trash","IconTrash",[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]]),yl=Ae("triangle-inverted-filled","IconTriangleInvertedFilled",[["path",{d:"M20.118 3h-16.225a2.914 2.914 0 0 0 -2.503 4.371l8.116 13.549a2.917 2.917 0 0 0 4.987 .005l8.11 -13.539a2.914 2.914 0 0 0 -2.486 -4.386z",fill:"currentColor",key:"svg-0",strokeWidth:"0"}]]),Xh=Ae("versions","IconVersions",[["path",{d:"M10 5m0 2a2 2 0 0 1 2 -2h6a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-6a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M7 7l0 10",key:"svg-1"}],["path",{d:"M4 8l0 8",key:"svg-2"}]]),Qh=Ae("world","IconWorld",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M3.6 9h16.8",key:"svg-1"}],["path",{d:"M3.6 15h16.8",key:"svg-2"}],["path",{d:"M11.5 3a17 17 0 0 0 0 18",key:"svg-3"}],["path",{d:"M12.5 3a17 17 0 0 1 0 18",key:"svg-4"}]]),ep=Ae("x","IconX",[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]]);function tp(t){const{promptMessage:e="Are you sure you want to delete this?",variant:n="ghost",onDelete:r,isDisabled:o=!1,tooltipText:s}=t;return k.jsx(gi,{isLazy:!0,placement:"auto",gutter:0,children:({onClose:i})=>k.jsxs(k.Fragment,{children:[k.jsx(vi,{children:k.jsx(jt,{children:k.jsx(kt,{hasArrow:!0,label:s,placement:"bottom",children:k.jsx(cn,{"aria-label":"Delete confirm",size:"sm",icon:k.jsx(Jh,{color:"#F56565",size:"20px"}),isDisabled:o,variant:n})})})}),k.jsxs(xi,{children:[k.jsx(bi,{onClick:i}),k.jsxs(wi,{children:[k.jsx(wt,{mb:4,pr:4,fontWeight:600,children:e}),k.jsx(Te,{colorScheme:"red",size:"sm",onClick:()=>{r(),i()},children:"Yes, delete"})]})]})]})})}function np({onClose:t}){Ma();const{curFlowID:e,isDirty:n,loadWorkflowID:r,curVersion:o}=P.useContext(at),[s,i]=P.useState(0),[a,l]=P.useState(null),[u,c]=P.useState([]),[d,p]=P.useState([]),h=async m=>{var E;const y=await(H==null?void 0:H.get(m)),g=await(Ge==null?void 0:Ge.listByWorkflowID(m));c(g??[]);const _=g==null?void 0:g.filter(I=>I.json===(y==null?void 0:y.json)),x=(E=_==null?void 0:_[0])==null?void 0:E.id;x&&l(x)},v=async()=>{const m=await(ge==null?void 0:ge.listByWorkflowID(e))??[];p(m)},f=m=>{ge==null||ge.delete(m).then(()=>{v()})};return P.useEffect(()=>{switch(s){case 0:v();break;case 1:h(e);break}},[s]),P.useEffect(()=>(we.canvasEl.addEventListener("click",t),()=>{we.canvasEl.removeEventListener("click",t)}),[s]),k.jsxs(sc,{width:430,height:"100vh",gap:0,position:"fixed",top:0,left:0,zIndex:1e3,children:[k.jsx(oc,{pb:1,mb:0,children:k.jsxs(Ut,{justifyContent:"space-between",alignItems:"center",children:[k.jsx(un,{size:"md",children:"Version History"}),k.jsx(cn,{size:"sm",icon:k.jsx(ep,{}),onClick:t,variant:"ghost","aria-label":"close version history"})]})}),k.jsx(rc,{overflowY:"auto",gap:0,children:k.jsxs(Ci,{isFitted:!0,variant:"enclosed",onChange:i,colorScheme:"teal",children:[k.jsxs(Si,{mb:"1em",children:[k.jsx(No,{children:"Versions"}),k.jsx(No,{children:"Change History"})]}),k.jsxs(Ii,{children:[k.jsx(Ao,{children:k.jsx($e,{divider:k.jsx(Oo,{}),spacing:2,children:d==null?void 0:d.map(m=>k.jsxs(Ut,{w:"100%",mb:1,justify:"space-between",backgroundColor:m.id===(o==null?void 0:o.id)?"teal.300":void 0,borderRadius:4,children:[k.jsxs($e,{textAlign:"left",gap:0,children:[k.jsx(wt,{fontWeight:"500",children:m.name??"untitled"}),k.jsxs(wt,{color:"GrayText",fontSize:"sm",children:["Created: ",ll(m.createTime)]})]}),k.jsxs(Ut,{alignItems:"center",gap:2,children:[k.jsx(Te,{size:"sm",onClick:()=>{if(n){alert("You have unsaved changes, please save or discard your changes to proceed switching version, in case losing your changes.");return}we.loadGraphData(JSON.parse(m.json)),r(e,m.id),t()},children:"Load"}),k.jsx(tp,{promptMessage:"Are you sure you want to delete this version?",onDelete:()=>{f(m.id)}})]})]},m.id))})}),k.jsxs(Ao,{children:[k.jsx(wt,{mb:4,children:"All the saved changes of this workflow"}),k.jsx($e,{divider:k.jsx(Oo,{}),spacing:2,children:u==null?void 0:u.map(m=>k.jsxs(ot,{justifyContent:"space-between",children:[k.jsxs(Te,{size:"sm",variant:"ghost",onClick:()=>{if(n){alert("You have unsaved changes, please save or discard your changes to proceed switching version, in case losing your changes.");return}we.loadGraphData(JSON.parse(m.json)),H==null||H.updateFlow(e,{json:m.json}),t()},isActive:m.id===a,children:["Saved at ",new Date(m.createTime).toLocaleString()]},m.id),m.isAutoSave?k.jsx(mn,{colorScheme:"teal",size:"sm",children:"Auto save"}):null]},m.id))})]})]})]})})]})}function rp({workflowId:t,onClose:e}){const[n,r]=P.useState(""),[o,s]=P.useState(""),i=l=>{r(l.target.value),o&&s("")},a=async()=>{const l=n.trim();if(r(l),(await(ge==null?void 0:ge.listByWorkflowID(t))??[]).some(c=>c.name===l))s("The name is duplicated, please modify it and submit again.");else{const c=JSON.stringify(we.graph.serialize());await(ge==null?void 0:ge.add({name:n,workflowID:t,createTime:Date.now(),json:c})),e()}};return k.jsxs(Gr,{isOpen:!0,onClose:e,children:[k.jsx(ps,{}),k.jsxs(Zr,{children:[k.jsx(ms,{children:"Create Version"}),k.jsx(ys,{}),k.jsx(Yr,{children:k.jsxs(Jr,{isInvalid:!!o,children:[k.jsx(Qr,{children:"Name"}),k.jsx(gn,{value:n,onChange:i,autoFocus:!0,onKeyUp:l=>{l.code==="Enter"&&!o&&n&&a()}}),o&&k.jsx(Xr,{children:o})]})}),k.jsxs(vs,{children:[k.jsx(Te,{colorScheme:"teal",mr:3,onClick:a,isDisabled:!n||!!o,children:"Create"}),k.jsx(Te,{onClick:e,children:"Cancel"})]})]})]})}function op({options:t,menuButton:e,isOpen:n,onClose:r}){const o=P.useRef(null);return jc({ref:o,handler:()=>r()}),k.jsxs(jt,{position:"relative",children:[k.jsx(jt,{children:e}),n&&k.jsx(jt,{ref:o,mt:"8px",shadow:"md",p:"2",position:"absolute",zIndex:"dropdown",children:t})]})}function sp({menuButton:t,menuContent:e,onClose:n}){const r=P.useRef(),[o,s]=P.useState(!1),i=()=>{r.current=setTimeout(()=>s(!1),400)},a=()=>{s(!0),clearTimeout(r.current),r.current=void 0};return k.jsx(op,{isOpen:o,onClose:i,menuButton:k.jsx(jt,{"aria-label":"menu",onClick:a,onMouseEnter:a,onMouseLeave:i,children:t}),options:k.jsx(Ds,{isOpen:!0,children:k.jsx(js,{minWidth:150,zIndex:1e3,onMouseEnter:a,onMouseLeave:i,children:e})})})}const vl="WORKSPACE_CIVIT_API_KEY_STORAGE_KEY";function om(){return localStorage.getItem(vl)}function sm(t){localStorage.setItem(vl,t)}function ap(t){return`https://civitai.com/api/download/models/${t}`}function ip(t,e){return e?`https://civitai.com/models/${t}?modelVersionId=${e}`:`https://civitai.com/models/${t}`}function gl(t){return t.includes("huggingface")?t.replace("/resolve/","/blob/"):void 0}async function am(t){var e,n;try{const r=`https://civitai.com/api/v1/model-versions/by-hash/${t}`,s=await(await fetch(r)).json();let i;if(await(Y==null?void 0:Y.getSetting("showNsfwModelThumbnail"))===!0)i=(n=(e=s==null?void 0:s.images)==null?void 0:e[0])==null?void 0:n.url;else if(!s.model.nsfw){const l=s.images.find(u=>u.nsfwLevel==1);i=l==null?void 0:l.url}return{modelName:s.model.name,civitModelID:String(s.modelId),civitModelVersionID:String(s.id),imageUrl:i??void 0}}catch{return{}}}async function lp(t,e,n){const r=await ie.models.where("fileName").equals(t).toArray()??[],o=r.at(0);return{filename:t,nodeType:e,fileHash:(o==null?void 0:o.fileHash)??null,fileFolder:(o==null?void 0:o.fileFolder)??null,downloadUrl:o!=null&&o.civitModelVersionID?ap(o.civitModelVersionID):(o==null?void 0:o.downloadUrl)??null,inputName:n,length:r.length,infoUrl:o!=null&&o.civitModelID?ip(o.civitModelID,o.civitModelVersionID):gl((o==null?void 0:o.downloadUrl)??"")??null}}async function cp(t){var p,h;let e=[],n={};const r=[".ckpt",".pt",".bin",".pth",".safetensors"],o=[".jpeg",".jpg",".png",".gif",".webp"],s=(h=(p=we.graph.extra)==null?void 0:p[We])==null?void 0:h.deps,i=await we.graphToPrompt();Object.values(i.output).forEach(v=>{v.inputs&&Object.keys(v.inputs).forEach(f=>{var y,g,_;const m=(y=v.inputs)==null?void 0:y[f];typeof m=="string"&&(r.some(x=>m.endsWith(x))&&((g=s==null?void 0:s.models)!=null&&g[m]?e.push(Promise.resolve(s.models[m])):e.push(lp(m,v.class_type,f))),o.some(x=>m.endsWith(x))&&(n[m]=((_=s==null?void 0:s.images)==null?void 0:_[m])??{filename:m,nodeType:v.class_type}))})});const l=await fetch("workspace/fetch_node_repos",{method:"POST",body:JSON.stringify({nodes:t.map(v=>v.type)})}).then(v=>v.ok?v.json():[]).catch(v=>(console.error("Error fetching node repos",v),[])),u=await Promise.all(e),c={};u.forEach(v=>{c[v.filename]=v});const d={};return Object.values(l).forEach(v=>{d[v.gitRepo]=v}),{models:c,images:n,nodeRepos:Object.values(d)}}const up=P.forwardRef(function(e,n){const{saveCurWorkflow:r,setRoute:o}=P.useContext(at),[s,i]=P.useState(),[a,l]=P.useState({}),[u,c]=P.useState(!1),d=P.useCallback(async()=>{const g=we.graph.serialize();cp(g.nodes??[]).then(_=>{i(_)})},[]),p=P.useCallback(async()=>{i(void 0),await uf(),window.addEventListener("model_list_updated",()=>{d(),window.removeEventListener("model_list_updated",()=>{})})},[]);P.useEffect(()=>{d()},[]);const h=g=>!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(g),v=async g=>{var R;g.preventDefault(),g.stopPropagation();const _=new FormData(g.target),x=Object.values((s==null?void 0:s.models)??{}).map(async W=>{var w,T;const D=(w=_.get(W.filename))==null?void 0:w.toString();if(D!=null&&D.length){const V=dp(W.filename);await ie.models.update(V+"@"+W.fileFolder,{downloadUrl:D})}const M=(T=W.infoUrl)!=null&&T.length?W.infoUrl:D?gl(D):null;return{filename:W.filename,nodeType:W.nodeType,fileHash:W.fileHash,fileFolder:W.fileFolder,downloadUrl:D??W.downloadUrl??null,infoUrl:M??null,inputName:W.inputName}})??[],E=await Promise.all(x);if(!f(E))return;l({}),c(!0);const I=Object.values((s==null?void 0:s.images)??{}).filter(W=>!W.url).map(W=>W.filename),C=(s==null?void 0:s.images)??{};if(I.length){const D=await(await Ee("/workspace/upload_image",{method:"POST",body:JSON.stringify({images:I})})).json();Object.keys(D).forEach(M=>{C!=null&&C[M]&&(C[M].url=D[M])})}c(!1);const N={};E.forEach(W=>{N[W.filename]=W});const j=we.graph.serialize();(R=j.extra||(j.extra={}))[We]||(R[We]={}),j.extra[We].deps={models:N,images:C??{},nodeRepos:(s==null?void 0:s.nodeRepos)??[]},await we.graphToPrompt(we.graph).then(W=>{j.extra[We].apiPrompt=W.output}),await r(),window.dispatchEvent(new CustomEvent("workspace_info_deps_updated",{detail:j})),console.log("graph",j)},f=P.useCallback(g=>{let _=!0;return g.forEach(x=>{const E=x.filename;if(!x.downloadUrl){l(I=>({...I,[E]:"Invalid URL"})),_=!1;return}if(!h(x.downloadUrl)){l(I=>({...I,[E]:"Invalid URL"})),_=!1;return}if(!x.fileFolder){l(I=>({...I,[E]:"Model file not found, please re-scan models folder"})),_=!1;return}}),_},[]),m=Object.values((s==null?void 0:s.images)??{}),y=Object.values((s==null?void 0:s.models)??[]);return s?k.jsx("form",{onSubmit:v,ref:n,children:k.jsxs($e,{gap:5,children:[k.jsxs($e,{children:[k.jsxs(un,{size:"sm",children:["Models (",y.length,")"]}),y.map((g,_)=>k.jsx(fp,{modelFile:g,errors:a,onClickRefetchModelList:p},_))]}),m.length>0&&k.jsxs($e,{children:[k.jsxs(ot,{children:[k.jsxs(un,{size:"sm",children:["Images (",m.length,")"]}),k.jsx("p",{style:{color:"GrayText"},children:"Will be uploaded as url"})]}),u&&k.jsxs("span",{children:[k.jsx(Zs,{size:"md",color:"teal.400"})," Uploading"]}),m.map(g=>k.jsxs($e,{children:[k.jsx("p",{children:g.filename}),k.jsx(Wa,{width:250,src:`/workspace/view_media?filename=${g.filename}&isPreview=true&isInput=true`})]},g.filename))]})]})}):k.jsx(Zs,{size:"md",color:"teal.400"})});function dp(t){const e=t.split(".");return e.length>1?(e.pop(),e.join(".")):t}function fp({modelFile:t,errors:e,onClickRefetchModelList:n}){const r=t.filename,[o,s]=P.useState(!t.downloadUrl);return t.fileFolder?k.jsxs($e,{ml:2,children:[k.jsxs(Ut,{gap:2,children:[k.jsx(mn,{height:"fit-content",colorScheme:"teal",children:t.fileFolder}),t.downloadUrl?k.jsxs(ot,{children:[k.jsx("a",{href:t.infoUrl??t.downloadUrl,target:"_blank",children:t.filename}),k.jsx(pl,{size:18}),k.jsx(cn,{ml:3,"aria-label":"edit",icon:k.jsx(Vh,{size:18}),size:"xs",onClick:()=>s(!o)})]}):k.jsx($e,{children:k.jsxs("span",{children:[t.filename," ",k.jsx("span",{children:"❓"})]})})]},t.filename+t.nodeType),k.jsx($e,{style:{display:o?"block":"none"},children:k.jsx(kt,{label:"Model download link, supports Huggingface and Civitai",children:k.jsx(gn,{name:r,defaultValue:t.downloadUrl??"",size:"sm",isInvalid:e[r]!=null,placeholder:"https://civitai.com/api/download/models/324524"})})}),k.jsx(wt,{color:"red.400",children:e[r]})]}):k.jsxs($e,{children:[k.jsxs(Ut,{gap:2,children:[k.jsx("p",{children:t.filename}),k.jsx(mn,{size:"sm",colorScheme:"red",children:"Model file not found"})]}),k.jsx(Te,{size:"sm",leftIcon:k.jsx(Zh,{}),width:"fit-content",borderColor:"red",borderWidth:e[r]!=null?2:0,onClick:n,children:"Fetch model file"})]})}function hp(){const{setRoute:t}=P.useContext(at),e=P.useRef(null);return k.jsx(Gr,{isOpen:!0,onClose:()=>t("root"),size:"xl",children:k.jsx(Zr,{children:k.jsxs(Yr,{p:5,gap:5,children:[k.jsxs(ot,{children:[k.jsx(un,{size:"md",children:"Add Resouce Dependencies"}),k.jsx(kt,{label:`runnable workflows include all resource dependecy download urls (models, cursom nodes, input images) and can be one-click - installed and run in any ComfyUI with workpace-manager installed.`,children:k.jsx(Qa,{borderRadius:10,children:k.jsx($h,{size:20})})})]}),k.jsx(wt,{color:"GrayText",children:"Export runnable workflow"}),k.jsx(up,{ref:e}),k.jsxs(ot,{justifyContent:"flex-end",children:[k.jsx(Te,{colorScheme:"teal",size:"sm",onClick:()=>{var n;return(n=e.current)==null?void 0:n.requestSubmit()},children:"Next"}),k.jsx(Te,{size:"sm",onClick:()=>t("share"),children:"Skip"})]})]})})})}function pp(t,e){const n=new Blob([t],{type:"application/json"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${e}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}function im(t){const e=new Uint8Array(t);return window.crypto.getRandomValues(e),Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}const lm=[{label:"Private",value:"PRIVATE",icon:k.jsx(ml,{})},{label:"Unlisted, anyone with the link can view",value:"UNLISTED",icon:k.jsx(Hh,{})},{label:"Public",value:"PUBLIC",icon:k.jsx(Qh,{})}],cm=()=>{const t=we.graph._nodes,e={};for(let n of t)if(n.type in LiteGraph.registered_node_types){const r=structuredClone(LiteGraph.registered_node_types[n.type].nodeData);if(r==null)continue;for(let o in r.input){const s=r.input[o];for(let i in s){const a=s[i];Array.isArray(a[0])&&(a[0]=["value_1","value_2"])}}e[n.type]=r}return e};async function mp(t){const e=t.cloudOrigin;if(!e)throw Error("cloudURL is required");return fetch(e+`/api/getWorkflow?id=${t.cloudID}`).then(n=>n.json()).then(n=>{var o;return((o=n.data)==null?void 0:o.privacy)??"PRIVATE"})}function um({privacy:t,showEmoji:e=!1}){let n;return t==="PRIVATE"?(n="Private",e&&(n="πŸ”’ Private")):t==="UNLISTED"?(n="Unlisted",e&&(n="πŸ”— Unlisted")):t==="PUBLIC"&&(n="Public",e&&(n="🌐 Public")),k.jsx("span",{children:n})}function yp({}){const[t,e]=P.useState(),[n,r]=P.useState(),{curFlowID:o}=P.useContext(at);return P.useEffect(()=>{o&&(H==null||H.get(o).then(s=>{s!=null&&s.cloudID?(e(s.cloudOrigin+"/workflow/"+s.cloudID),mp(s).then(i=>{r(i)})):e(void 0)}))},[o]),t?k.jsx("a",{href:t,style:{textDecoration:"none"},target:"_blank",children:k.jsx(Na,{children:k.jsx(mn,{children:n==="PUBLIC"?"🌐":n==="UNLISTED"?"πŸ”—":"πŸ”’"})})}):null}const vp=P.lazy(()=>Tt(()=>import("./ShareDialog-JZBcdRgg.js"),__vite__mapDeps([0,1,2,3,4])));function gp(){var x;const{curFlowID:t,loadWorkflowID:e,discardUnsavedChanges:n,saveCurWorkflow:r,setRoute:o,route:s}=P.useContext(at),[i,a]=P.useState(!1),[l,u]=P.useState(""),[c,d]=P.useState(""),[p,h]=P.useState(),[v,f]=P.useState({save:"",saveAs:""});P.useEffect(()=>{t&&(H==null||H.get(t).then(E=>{u((E==null?void 0:E.name)??""),h(E)})),Y==null||Y.getSetting("shortcuts").then(E=>{f(E)})},[t]);const m=E=>{u(E.target.value),c&&d("")},y=async()=>{if(!t){alert("Flow ID is required");return}const E=JSON.stringify(we.graph.serialize()),I=await(H==null?void 0:H.createFlow({json:E,name:l,parentFolderID:p==null?void 0:p.parentFolderID}));I&&await e(I.id,null,!0),g()},g=()=>{o("root")},_=P.useCallback(async()=>{const E=H==null?void 0:H.curWorkflow;if(!E){alert("No current workflow!");return}const I=we.graph.serialize(),C=JSON.stringify(I,null,2);pp(C,E.name)},[t]);return k.jsxs(k.Fragment,{children:[k.jsx(sp,{menuButton:k.jsx(Na,{children:k.jsxs(Te,{px:1,height:$s+"px","aria-label":"menu",size:"sm",backgroundColor:"#434554",children:["File",k.jsx(zh,{size:20})]})}),menuContent:k.jsx(Ds,{isOpen:!0,children:k.jsxs(js,{minWidth:150,zIndex:1e3,children:[k.jsx(Ct,{onClick:()=>r(),icon:k.jsx(zr,{size:20}),iconSpacing:1,command:v.save,children:"Save"}),!((x=Y==null?void 0:Y.settings)!=null&&x.autoSave)&&k.jsx(kt,{label:"Revert workflow to your last saved version. You will lose all changes made since your last save.",children:k.jsx(Ct,{onClick:n,icon:k.jsx(Bh,{size:20}),iconSpacing:1,children:"Discard unsaved changes"})}),k.jsx(Ct,{onClick:_,icon:k.jsx(Lh,{size:20}),iconSpacing:1,children:"Download"}),k.jsx(Ct,{onClick:()=>o("saveAsModal"),icon:k.jsx(zr,{size:20}),iconSpacing:1,command:v.saveAs,children:"Save As"}),k.jsx(Ct,{onClick:()=>a(!0),icon:k.jsx(Xh,{size:20}),iconSpacing:1,children:"Create Version"}),k.jsx(Ct,{onClick:()=>o("versionHistory"),icon:k.jsx(Kh,{size:20}),iconSpacing:1,children:"Versions History"}),k.jsx(Ct,{onClick:()=>o("share"),icon:k.jsx(Yh,{size:20}),iconSpacing:1,alignItems:"center",children:k.jsxs(ot,{children:[k.jsx("p",{children:"Share"})," ",k.jsx(mn,{size:"sm",children:"πŸ§ͺbeta"}),k.jsx(yp,{})]})})]})})}),s==="share"&&k.jsx(vp,{onClose:()=>o("root")}),s=="versionHistory"&&k.jsx(np,{onClose:()=>o("root")}),s=="downloadSpaceJson"&&k.jsx(hp,{}),s==="saveAsModal"&&k.jsxs(Gr,{isOpen:!0,onClose:g,children:[k.jsx(ps,{}),k.jsxs(Zr,{children:[k.jsx(ms,{children:"Save As"}),k.jsx(ys,{}),k.jsx(Yr,{children:k.jsxs(Jr,{isInvalid:!!c,children:[k.jsx(Qr,{children:"Workflow name"}),k.jsx(gn,{value:l,onChange:m,autoFocus:!0,onKeyUp:E=>{E.code==="Enter"&&!c&&l&&y()}}),c&&k.jsx(Xr,{children:c})]})}),k.jsxs(vs,{children:[k.jsx(Te,{colorScheme:"teal",mr:3,onClick:y,isDisabled:!l||!!c,children:"Save"}),k.jsx(Te,{onClick:g,children:"Cancel"})]})]})]}),i&&k.jsx(rp,{workflowId:t,onClose:()=>a(!1)})]})}function wp({displayName:t,updateFlowName:e,isDirty:n}){const{isOpen:r,onOpen:o,onClose:s}=Nc(),{curFlowID:i}=P.useContext(at),[a,l]=P.useState(t),[u,c]=P.useState(""),d=()=>{l(t),o()},p=f=>{l(f.target.value),u&&c("")},h=async()=>{var f;if(i){const m=a.trim();if(l(m),t===m)return v();await(H==null?void 0:H.generateUniqueName(m,((f=H.curWorkflow)==null?void 0:f.parentFolderID)??""))!==m?c("The name is duplicated, please modify it and submit again."):(await(H==null?void 0:H.updateName(i,{name:m})),e(m),v())}},v=()=>{c(""),s()};return i==null?null:k.jsxs(ot,{children:[k.jsx(kt,{label:t,placement:"bottom",children:k.jsxs(wt,{as:"div",color:"white",onClick:d,maxW:200,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[k.jsx("div",{style:{width:8,display:"inline-block"},children:k.jsx(wt,{as:"span",children:n&&"* "})}),t]})}),k.jsxs(Gr,{isOpen:r,onClose:v,children:[k.jsx(ps,{}),k.jsxs(Zr,{children:[k.jsx(ms,{children:"Edit workflow name"}),k.jsx(ys,{}),k.jsx(Yr,{children:k.jsxs(Jr,{isInvalid:!!u,children:[k.jsx(Qr,{children:"Workflow name"}),k.jsx(gn,{value:a,onChange:p,autoFocus:!0,onKeyUp:f=>{f.code==="Enter"&&!u&&a&&h()}}),u&&k.jsx(Xr,{children:u})]})}),k.jsxs(vs,{children:[k.jsx(Te,{colorScheme:"teal",mr:3,onClick:h,isDisabled:!a||!!u,children:"Save"}),k.jsx(Te,{onClick:v,children:"Cancel"})]})]})]})]})}function bp({}){const{setRoute:t,curVersion:e,isDirty:n,setCurVersion:r}=P.useContext(at);return P.useEffect(()=>{n&&e&&(e==null?void 0:e.name.endsWith("*"))===!1&&(r==null||r({...e,name:e.name+"*"}))},[n]),e?k.jsx(Ut,{alignItems:"center",children:k.jsx(Ua,{size:"sm",isAttached:!0,variant:"outline",children:k.jsx(Te,{rightIcon:k.jsx(yl,{size:10}),onClick:()=>t("versionHistory"),children:e.name})})}):null}function _p(){const{loadNewWorkflow:t,setCurFlowIDAndName:e,curFlowID:n}=P.useContext(at),r=async()=>{const o=JSON.stringify(we.graph.serialize()),s=prompt("Enter workflow name","Untitled");if(!s)return;const i=await(H==null?void 0:H.createFlow({json:o,name:s}));i&&e(i)};return k.jsx(kt,{label:n?"New workflow":"Save workflow",children:k.jsx(Te,{size:"sm",variant:"outline",colorScheme:"teal","aria-label":"new workflow",height:$s+"px",onClick:()=>n?t():r(),px:1,children:n?k.jsx(Gh,{size:16,color:"white"}):k.jsx(zr,{size:16,color:"white"})})})}const xp=P.lazy(()=>Tt(()=>import("./AppIsDirtyEventListener-BhFgpj_t.js"),__vite__mapDeps([5,1,6]))),kp=P.lazy(()=>Tt(()=>import("./ModelManagerTopbar-F18nYkv6.js").then(t=>t.M),__vite__mapDeps([7,1,8,3,9,10]))),Ep=P.lazy(()=>Tt(()=>import("./SpotlightSearch-S3ZkRF9c.js"),__vite__mapDeps([11,1,6,12,13])));function Cp({curFlowName:t,setCurFlowName:e}){var c;const{isDirty:n,saveCurWorkflow:r,setRoute:o,curFlowID:s,route:i}=P.useContext(at),[a,l]=P.useState(),u=P.useCallback((d,p=!1)=>{const{top:h=0,left:v=0}=a||{};let{top:f=0,left:m=0}=d??{};f+=h,m+=v;const y=document.documentElement.clientWidth,g=document.documentElement.clientHeight,_=document.getElementById("workspaceManagerPanel"),x=(_==null?void 0:_.offsetWidth)||392;f+36>g&&(f=g-36),m+x>=y&&(m=y-x),l({top:Math.max(0,f),left:Math.max(0,m)}),p&&(Y==null||Y.upsert({topBarStyle:{top:f,left:m}}))},[a]);return P.useEffect(()=>{Y==null||Y.getSetting("topBarStyle").then(d=>{u(d,!1)})},[]),a?k.jsx(Ph,{onDragEnd:d=>{u({top:d.y,left:d.x},!0)},dragIconId:"dragPanelIcon",children:k.jsxs(ot,{style:{padding:2,position:"fixed",...a},justifyContent:"space-between",alignItems:"center",gap:2,draggable:!1,id:"workspaceManagerPanel",className:"workspaceManagerPanel",children:[k.jsx(Te,{size:"sm","aria-label":"workspace folder",height:$s+"px",onClick:()=>o("recentFlows"),px:2,children:k.jsxs(ot,{gap:1,children:[k.jsx(Wh,{size:21}),k.jsx(yl,{size:8})]})}),k.jsx(P.Suspense,{fallback:k.jsx("div",{style:{width:"60px"}}),children:k.jsx(kp,{})}),k.jsx(_p,{}),k.jsx(wp,{isDirty:n,displayName:t??"",updateFlowName:d=>{e(d),requestAnimationFrame(()=>{u()})}}),((c=H==null?void 0:H.curWorkflow)==null?void 0:c.saveLock)&&k.jsx(ml,{color:"#FFF",size:20}),s&&k.jsxs(ot,{gap:"4px",children:[k.jsx(kt,{label:"Open gallery",children:k.jsx(cn,{onClick:()=>o("gallery"),icon:k.jsx(qh,{size:22,color:"white"}),size:"sm","aria-label":"open gallery",variant:"ghost"})}),k.jsx(gp,{})]}),s&&n?k.jsx(kt,{label:"Save workflow",children:k.jsx(cn,{onClick:()=>r(),icon:k.jsx(zr,{size:23,color:"white"}),size:"xs",paddingY:4,"aria-label":"save workspace",variant:"ghost"})}):k.jsx("div",{style:{width:1}}),k.jsx(bp,{}),k.jsx(xp,{}),k.jsx(Uh,{id:"dragPanelIcon",className:"dragPanelIcon",cursor:"move",size:15,color:"#FFF"}),i==="spotlightSearch"&&k.jsx(Ep,{})]})}):null}function Sp(){const{showDialog:t}=Fa(),{loadWorkflowID:e}=P.useContext(at),n=async(o,s)=>{var u,c;const{workflow:i,version:a}=o.detail;if(!i.id||!a.id)return;const l=(u=await(H==null?void 0:H.listByIndex("cloudID",i.id)))==null?void 0:u.at(0);if(l){const d=(c=await(ge==null?void 0:ge.listByIndex("cloudID",a.id)))==null?void 0:c.at(0);if(d)await e(l.id,d.id);else{const p=await(ge==null?void 0:ge.add({id:a.id,cloudID:a.id,workflowID:l.id,cloudOrigin:s,name:a.name,authorID:a.authorID,json:a.json}));p&&e(l.id,p.id)}}else{const d=await(H==null?void 0:H.createFlow({cloudID:i.id,cloudOrigin:s,name:i.name,json:a.json,updateTime:Date.now()}));if(!d){alert("Failed to add workflow to local db");return}const p=await(ge==null?void 0:ge.put({id:a.id,cloudID:a.id,workflowID:d.id,cloudOrigin:s,name:a.name,json:a.json,authorID:a.authorID,createTime:Date.now()}));await e(d.id,p==null?void 0:p.id)}},r=async o=>{const s=o.data;if(Ip(s)){const i=o.origin;t(`Open workflow "${s.detail.workflow.name}", version "${s.detail.version.name}" from ${i}`,[{label:"Open",colorScheme:"teal",onClick:()=>{n(s,i)}}])}};return P.useEffect(()=>{window.opener&&window.opener.postMessage("comfyui_workspace_manager_connected","*"),window.addEventListener("message",r)},[]),null}function Ip(t){return t.type==="workspace_open_workflow"}const Op=t=>typeof t=="function",Dp=t=>{const[e,n]=P.useState(t),r=P.useRef(e),o=P.useCallback(s=>{r.current=Op(s)?s(r.current):s,n(r.current)},[]);return[e,o,r]};function fr(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var wl={exports:{}};/*! + installed and run in any ComfyUI with workpace-manager installed.`,children:k.jsx(Qa,{borderRadius:10,children:k.jsx($h,{size:20})})})]}),k.jsx(wt,{color:"GrayText",children:"Export runnable workflow"}),k.jsx(up,{ref:e}),k.jsxs(ot,{justifyContent:"flex-end",children:[k.jsx(Te,{colorScheme:"teal",size:"sm",onClick:()=>{var n;return(n=e.current)==null?void 0:n.requestSubmit()},children:"Next"}),k.jsx(Te,{size:"sm",onClick:()=>t("share"),children:"Skip"})]})]})})})}function pp(t,e){const n=new Blob([t],{type:"application/json"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${e}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}function im(t){const e=new Uint8Array(t);return window.crypto.getRandomValues(e),Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}const lm=[{label:"Private",value:"PRIVATE",icon:k.jsx(ml,{})},{label:"Unlisted, anyone with the link can view",value:"UNLISTED",icon:k.jsx(Hh,{})},{label:"Public",value:"PUBLIC",icon:k.jsx(Qh,{})}],cm=()=>{const t=we.graph._nodes,e={};for(let n of t)if(n.type in LiteGraph.registered_node_types){const r=structuredClone(LiteGraph.registered_node_types[n.type].nodeData);if(r==null)continue;for(let o in r.input){const s=r.input[o];for(let i in s){const a=s[i];Array.isArray(a[0])&&(a[0]=["value_1","value_2"])}}e[n.type]=r}return e};async function mp(t){const e=t.cloudOrigin;if(!e)throw Error("cloudURL is required");return fetch(e+`/api/getWorkflow?id=${t.cloudID}`).then(n=>n.json()).then(n=>{var o;return((o=n.data)==null?void 0:o.privacy)??"PRIVATE"})}function um({privacy:t,showEmoji:e=!1}){let n;return t==="PRIVATE"?(n="Private",e&&(n="πŸ”’ Private")):t==="UNLISTED"?(n="Unlisted",e&&(n="πŸ”— Unlisted")):t==="PUBLIC"&&(n="Public",e&&(n="🌐 Public")),k.jsx("span",{children:n})}function yp({}){const[t,e]=P.useState(),[n,r]=P.useState(),{curFlowID:o}=P.useContext(at);return P.useEffect(()=>{o&&(H==null||H.get(o).then(s=>{s!=null&&s.cloudID?(e(s.cloudOrigin+"/workflow/"+s.cloudID),mp(s).then(i=>{r(i)})):e(void 0)}))},[o]),t?k.jsx("a",{href:t,style:{textDecoration:"none"},target:"_blank",children:k.jsx(Na,{children:k.jsx(mn,{children:n==="PUBLIC"?"🌐":n==="UNLISTED"?"πŸ”—":"πŸ”’"})})}):null}const vp=P.lazy(()=>Tt(()=>import("./ShareDialog-LtEf88VA.js"),__vite__mapDeps([0,1,2,3,4])));function gp(){var x;const{curFlowID:t,loadWorkflowID:e,discardUnsavedChanges:n,saveCurWorkflow:r,setRoute:o,route:s}=P.useContext(at),[i,a]=P.useState(!1),[l,u]=P.useState(""),[c,d]=P.useState(""),[p,h]=P.useState(),[v,f]=P.useState({save:"",saveAs:""});P.useEffect(()=>{t&&(H==null||H.get(t).then(E=>{u((E==null?void 0:E.name)??""),h(E)})),Y==null||Y.getSetting("shortcuts").then(E=>{f(E)})},[t]);const m=E=>{u(E.target.value),c&&d("")},y=async()=>{if(!t){alert("Flow ID is required");return}const E=JSON.stringify(we.graph.serialize()),I=await(H==null?void 0:H.createFlow({json:E,name:l,parentFolderID:p==null?void 0:p.parentFolderID}));I&&await e(I.id,null,!0),g()},g=()=>{o("root")},_=P.useCallback(async()=>{const E=H==null?void 0:H.curWorkflow;if(!E){alert("No current workflow!");return}const I=we.graph.serialize(),C=JSON.stringify(I,null,2);pp(C,E.name)},[t]);return k.jsxs(k.Fragment,{children:[k.jsx(sp,{menuButton:k.jsx(Na,{children:k.jsxs(Te,{px:1,height:$s+"px","aria-label":"menu",size:"sm",backgroundColor:"#434554",children:["File",k.jsx(zh,{size:20})]})}),menuContent:k.jsx(Ds,{isOpen:!0,children:k.jsxs(js,{minWidth:150,zIndex:1e3,children:[k.jsx(Ct,{onClick:()=>r(),icon:k.jsx(zr,{size:20}),iconSpacing:1,command:v.save,children:"Save"}),!((x=Y==null?void 0:Y.settings)!=null&&x.autoSave)&&k.jsx(kt,{label:"Revert workflow to your last saved version. You will lose all changes made since your last save.",children:k.jsx(Ct,{onClick:n,icon:k.jsx(Bh,{size:20}),iconSpacing:1,children:"Discard unsaved changes"})}),k.jsx(Ct,{onClick:_,icon:k.jsx(Lh,{size:20}),iconSpacing:1,children:"Download"}),k.jsx(Ct,{onClick:()=>o("saveAsModal"),icon:k.jsx(zr,{size:20}),iconSpacing:1,command:v.saveAs,children:"Save As"}),k.jsx(Ct,{onClick:()=>a(!0),icon:k.jsx(Xh,{size:20}),iconSpacing:1,children:"Create Version"}),k.jsx(Ct,{onClick:()=>o("versionHistory"),icon:k.jsx(Kh,{size:20}),iconSpacing:1,children:"Versions History"}),k.jsx(Ct,{onClick:()=>o("share"),icon:k.jsx(Yh,{size:20}),iconSpacing:1,alignItems:"center",children:k.jsxs(ot,{children:[k.jsx("p",{children:"Share"})," ",k.jsx(mn,{size:"sm",children:"πŸ§ͺbeta"}),k.jsx(yp,{})]})})]})})}),s==="share"&&k.jsx(vp,{onClose:()=>o("root")}),s=="versionHistory"&&k.jsx(np,{onClose:()=>o("root")}),s=="downloadSpaceJson"&&k.jsx(hp,{}),s==="saveAsModal"&&k.jsxs(Gr,{isOpen:!0,onClose:g,children:[k.jsx(ps,{}),k.jsxs(Zr,{children:[k.jsx(ms,{children:"Save As"}),k.jsx(ys,{}),k.jsx(Yr,{children:k.jsxs(Jr,{isInvalid:!!c,children:[k.jsx(Qr,{children:"Workflow name"}),k.jsx(gn,{value:l,onChange:m,autoFocus:!0,onKeyUp:E=>{E.code==="Enter"&&!c&&l&&y()}}),c&&k.jsx(Xr,{children:c})]})}),k.jsxs(vs,{children:[k.jsx(Te,{colorScheme:"teal",mr:3,onClick:y,isDisabled:!l||!!c,children:"Save"}),k.jsx(Te,{onClick:g,children:"Cancel"})]})]})]}),i&&k.jsx(rp,{workflowId:t,onClose:()=>a(!1)})]})}function wp({displayName:t,updateFlowName:e,isDirty:n}){const{isOpen:r,onOpen:o,onClose:s}=Nc(),{curFlowID:i}=P.useContext(at),[a,l]=P.useState(t),[u,c]=P.useState(""),d=()=>{l(t),o()},p=f=>{l(f.target.value),u&&c("")},h=async()=>{var f;if(i){const m=a.trim();if(l(m),t===m)return v();await(H==null?void 0:H.generateUniqueName(m,((f=H.curWorkflow)==null?void 0:f.parentFolderID)??""))!==m?c("The name is duplicated, please modify it and submit again."):(await(H==null?void 0:H.updateName(i,{name:m})),e(m),v())}},v=()=>{c(""),s()};return i==null?null:k.jsxs(ot,{children:[k.jsx(kt,{label:t,placement:"bottom",children:k.jsxs(wt,{as:"div",color:"white",onClick:d,maxW:200,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[k.jsx("div",{style:{width:8,display:"inline-block"},children:k.jsx(wt,{as:"span",children:n&&"* "})}),t]})}),k.jsxs(Gr,{isOpen:r,onClose:v,children:[k.jsx(ps,{}),k.jsxs(Zr,{children:[k.jsx(ms,{children:"Edit workflow name"}),k.jsx(ys,{}),k.jsx(Yr,{children:k.jsxs(Jr,{isInvalid:!!u,children:[k.jsx(Qr,{children:"Workflow name"}),k.jsx(gn,{value:a,onChange:p,autoFocus:!0,onKeyUp:f=>{f.code==="Enter"&&!u&&a&&h()}}),u&&k.jsx(Xr,{children:u})]})}),k.jsxs(vs,{children:[k.jsx(Te,{colorScheme:"teal",mr:3,onClick:h,isDisabled:!a||!!u,children:"Save"}),k.jsx(Te,{onClick:v,children:"Cancel"})]})]})]})]})}function bp({}){const{setRoute:t,curVersion:e,isDirty:n,setCurVersion:r}=P.useContext(at);return P.useEffect(()=>{n&&e&&(e==null?void 0:e.name.endsWith("*"))===!1&&(r==null||r({...e,name:e.name+"*"}))},[n]),e?k.jsx(Ut,{alignItems:"center",children:k.jsx(Ua,{size:"sm",isAttached:!0,variant:"outline",children:k.jsx(Te,{rightIcon:k.jsx(yl,{size:10}),onClick:()=>t("versionHistory"),children:e.name})})}):null}function _p(){const{loadNewWorkflow:t,setCurFlowIDAndName:e,curFlowID:n}=P.useContext(at),r=async()=>{const o=JSON.stringify(we.graph.serialize()),s=prompt("Enter workflow name","Untitled");if(!s)return;const i=await(H==null?void 0:H.createFlow({json:o,name:s}));i&&e(i)};return k.jsx(kt,{label:n?"New workflow":"Save workflow",children:k.jsx(Te,{size:"sm",variant:"outline",colorScheme:"teal","aria-label":"new workflow",height:$s+"px",onClick:()=>n?t():r(),px:1,children:n?k.jsx(Gh,{size:16,color:"white"}):k.jsx(zr,{size:16,color:"white"})})})}const xp=P.lazy(()=>Tt(()=>import("./AppIsDirtyEventListener-fMS1pxlr.js"),__vite__mapDeps([5,1,6]))),kp=P.lazy(()=>Tt(()=>import("./ModelManagerTopbar-xV84Rv4k.js").then(t=>t.M),__vite__mapDeps([7,1,8,3,9,10]))),Ep=P.lazy(()=>Tt(()=>import("./SpotlightSearch-CjlPIPLI.js"),__vite__mapDeps([11,1,6,12,13])));function Cp({curFlowName:t,setCurFlowName:e}){var c;const{isDirty:n,saveCurWorkflow:r,setRoute:o,curFlowID:s,route:i}=P.useContext(at),[a,l]=P.useState(),u=P.useCallback((d,p=!1)=>{const{top:h=0,left:v=0}=a||{};let{top:f=0,left:m=0}=d??{};f+=h,m+=v;const y=document.documentElement.clientWidth,g=document.documentElement.clientHeight,_=document.getElementById("workspaceManagerPanel"),x=(_==null?void 0:_.offsetWidth)||392;f+36>g&&(f=g-36),m+x>=y&&(m=y-x),l({top:Math.max(0,f),left:Math.max(0,m)}),p&&(Y==null||Y.upsert({topBarStyle:{top:f,left:m}}))},[a]);return P.useEffect(()=>{Y==null||Y.getSetting("topBarStyle").then(d=>{u(d,!1)})},[]),a?k.jsx(Ph,{onDragEnd:d=>{u({top:d.y,left:d.x},!0)},dragIconId:"dragPanelIcon",children:k.jsxs(ot,{style:{padding:2,position:"fixed",...a},justifyContent:"space-between",alignItems:"center",gap:2,draggable:!1,id:"workspaceManagerPanel",className:"workspaceManagerPanel",children:[k.jsx(Te,{size:"sm","aria-label":"workspace folder",height:$s+"px",onClick:()=>o("recentFlows"),px:2,children:k.jsxs(ot,{gap:1,children:[k.jsx(Wh,{size:21}),k.jsx(yl,{size:8})]})}),k.jsx(P.Suspense,{fallback:k.jsx("div",{style:{width:"60px"}}),children:k.jsx(kp,{})}),k.jsx(_p,{}),k.jsx(wp,{isDirty:n,displayName:t??"",updateFlowName:d=>{e(d),requestAnimationFrame(()=>{u()})}}),((c=H==null?void 0:H.curWorkflow)==null?void 0:c.saveLock)&&k.jsx(ml,{color:"#FFF",size:20}),s&&k.jsxs(ot,{gap:"4px",children:[k.jsx(kt,{label:"Open gallery",children:k.jsx(cn,{onClick:()=>o("gallery"),icon:k.jsx(qh,{size:22,color:"white"}),size:"sm","aria-label":"open gallery",variant:"ghost"})}),k.jsx(gp,{})]}),s&&n?k.jsx(kt,{label:"Save workflow",children:k.jsx(cn,{onClick:()=>r(),icon:k.jsx(zr,{size:23,color:"white"}),size:"xs",paddingY:4,"aria-label":"save workspace",variant:"ghost"})}):k.jsx("div",{style:{width:1}}),k.jsx(bp,{}),k.jsx(xp,{}),k.jsx(Uh,{id:"dragPanelIcon",className:"dragPanelIcon",cursor:"move",size:15,color:"#FFF"}),i==="spotlightSearch"&&k.jsx(Ep,{})]})}):null}function Sp(){const{showDialog:t}=Fa(),{loadWorkflowID:e}=P.useContext(at),n=async(o,s)=>{var u,c;const{workflow:i,version:a}=o.detail;if(!i.id||!a.id)return;const l=(u=await(H==null?void 0:H.listByIndex("cloudID",i.id)))==null?void 0:u.at(0);if(l){const d=(c=await(ge==null?void 0:ge.listByIndex("cloudID",a.id)))==null?void 0:c.at(0);if(d)await e(l.id,d.id);else{const p=await(ge==null?void 0:ge.add({id:a.id,cloudID:a.id,workflowID:l.id,cloudOrigin:s,name:a.name,authorID:a.authorID,json:a.json}));p&&e(l.id,p.id)}}else{const d=await(H==null?void 0:H.createFlow({cloudID:i.id,cloudOrigin:s,name:i.name,json:a.json,updateTime:Date.now()}));if(!d){alert("Failed to add workflow to local db");return}const p=await(ge==null?void 0:ge.put({id:a.id,cloudID:a.id,workflowID:d.id,cloudOrigin:s,name:a.name,json:a.json,authorID:a.authorID,createTime:Date.now()}));await e(d.id,p==null?void 0:p.id)}},r=async o=>{const s=o.data;if(Ip(s)){const i=o.origin;t(`Open workflow "${s.detail.workflow.name}", version "${s.detail.version.name}" from ${i}`,[{label:"Open",colorScheme:"teal",onClick:()=>{n(s,i)}}])}};return P.useEffect(()=>{window.opener&&window.opener.postMessage("comfyui_workspace_manager_connected","*"),window.addEventListener("message",r)},[]),null}function Ip(t){return t.type==="workspace_open_workflow"}const Op=t=>typeof t=="function",Dp=t=>{const[e,n]=P.useState(t),r=P.useRef(e),o=P.useCallback(s=>{r.current=Op(s)?s(r.current):s,n(r.current)},[]);return[e,o,r]};function fr(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var wl={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -20,10 +20,10 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(t,e){(function(n){t.exports=n()})(function(){return function n(r,o,s){function i(u,c){if(!o[u]){if(!r[u]){var d=typeof fr=="function"&&fr;if(!c&&d)return d(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var h=o[u]={exports:{}};r[u][0].call(h.exports,function(v){var f=r[u][1][v];return i(f||v)},h,h.exports,n,r,o,s)}return o[u].exports}for(var a=typeof fr=="function"&&fr,l=0;l>2,h=(3&u)<<4|c>>4,v=1<_?(15&c)<<2|d>>6:64,f=2<_?63&d:64,m.push(a.charAt(p)+a.charAt(h)+a.charAt(v)+a.charAt(f));return m.join("")},o.decode=function(l){var u,c,d,p,h,v,f=0,m=0,y="data:";if(l.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var g,_=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&_--,l.charAt(l.length-2)===a.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(g=i.uint8array?new Uint8Array(0|_):new Array(0|_);f>4,c=(15&p)<<4|(h=a.indexOf(l.charAt(f++)))>>2,d=(3&h)<<6|(v=a.indexOf(l.charAt(f++))),g[m++]=u,h!==64&&(g[m++]=c),v!==64&&(g[m++]=d);return g}},{"./support":30,"./utils":32}],2:[function(n,r,o){var s=n("./external"),i=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function u(c,d,p,h,v){this.compressedSize=c,this.uncompressedSize=d,this.crc32=p,this.compression=h,this.compressedContent=v}u.prototype={getContentWorker:function(){var c=new i(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return c.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new i(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(c,d,p){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var s=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var s=n("./utils"),i=function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(u,c,d,p){var h=i,v=p+d;u^=-1;for(var f=p;f>>8^h[255&(u^c[f])];return-1^u}(0|l,a,a.length,0):function(u,c,d,p){var h=i,v=p+d;u^=-1;for(var f=p;f>>8^h[255&(u^c.charCodeAt(f))];return-1^u}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),u=s?"uint8array":"array";function c(d,p){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,d.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(p){d.push({data:p,meta:d.meta})}},o.compressWorker=function(d){return new c("Deflate",d)},o.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function s(h,v){var f,m="";for(f=0;f>>=8;return m}function i(h,v,f,m,y,g){var _,x,E=h.file,I=h.compression,C=g!==u.utf8encode,N=a.transformTo("string",g(E.name)),j=a.transformTo("string",u.utf8encode(E.name)),R=E.comment,W=a.transformTo("string",g(R)),D=a.transformTo("string",u.utf8encode(R)),M=j.length!==E.name.length,w=D.length!==R.length,T="",V="",A="",X=E.dir,$=E.date,ne={crc32:0,compressedSize:0,uncompressedSize:0};v&&!f||(ne.crc32=h.crc32,ne.compressedSize=h.compressedSize,ne.uncompressedSize=h.uncompressedSize);var z=0;v&&(z|=8),C||!M&&!w||(z|=2048);var B=0,te=0;X&&(B|=16),y==="UNIX"?(te=798,B|=function(Z,me){var be=Z;return Z||(be=me?16893:33204),(65535&be)<<16}(E.unixPermissions,X)):(te=20,B|=function(Z){return 63&(Z||0)}(E.dosPermissions)),_=$.getUTCHours(),_<<=6,_|=$.getUTCMinutes(),_<<=5,_|=$.getUTCSeconds()/2,x=$.getUTCFullYear()-1980,x<<=4,x|=$.getUTCMonth()+1,x<<=5,x|=$.getUTCDate(),M&&(V=s(1,1)+s(c(N),4)+j,T+="up"+s(V.length,2)+V),w&&(A=s(1,1)+s(c(W),4)+D,T+="uc"+s(A.length,2)+A);var J="";return J+=` -\0`,J+=s(z,2),J+=I.magic,J+=s(_,2),J+=s(x,2),J+=s(ne.crc32,4),J+=s(ne.compressedSize,4),J+=s(ne.uncompressedSize,4),J+=s(N.length,2),J+=s(T.length,2),{fileRecord:d.LOCAL_FILE_HEADER+J+N+T,dirRecord:d.CENTRAL_FILE_HEADER+s(te,2)+J+s(W.length,2)+"\0\0\0\0"+s(B,4)+s(m,4)+N+T+W}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),c=n("../crc32"),d=n("../signature");function p(h,v,f,m){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=v,this.zipPlatform=f,this.encodeFileName=m,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(h){var v=h.meta.percent||0,f=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,l.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:f?(v+100*(f-m-1))/f:100}}))},p.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var v=this.streamFiles&&!h.file.dir;if(v){var f=i(h,v,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(h){this.accumulate=!1;var v=this.streamFiles&&!h.file.dir,f=i(h,v,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),v)this.push({data:function(m){return d.DATA_DESCRIPTOR+s(m.crc32,4)+s(m.compressedSize,4)+s(m.uncompressedSize,4)}(h),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var h=this.bytesWritten,v=0;v=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),i=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),c=n("./Uint8ArrayReader");r.exports=function(d){var p=s.getTypeOf(d);return s.checkSupport(p),p!=="string"||i.uint8array?p==="nodebuffer"?new u(d):i.uint8array?new c(s.transformTo("uint8array",d)):new a(s.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var s=n("./GenericWorker"),i=n("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}i.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:i.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),i=n("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=i(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(l){i.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,i),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}i.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(l){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){u.dataIsReady=!0,u.data=c,u.max=c&&c.length||0,u.type=s.getTypeOf(c),u.isPaused||u._tickAndRepeat()},function(c){u.error(c)})}s.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function s(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var l=0;l "+i:i}},r.exports=s},{}],29:[function(n,r,o){var s=n("../utils"),i=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),c=n("../external"),d=null;if(u.nodestream)try{d=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(v,f){return new c.Promise(function(m,y){var g=[],_=v._internalType,x=v._outputType,E=v._mimeType;v.on("data",function(I,C){g.push(I),f&&f(C)}).on("error",function(I){g=[],y(I)}).on("end",function(){try{var I=function(C,N,j){switch(C){case"blob":return s.newBlob(s.transformTo("arraybuffer",N),j);case"base64":return l.encode(N);default:return s.transformTo(C,N)}}(x,function(C,N){var j,R=0,W=null,D=0;for(j=0;j"u")o.blob=!1;else{var s=new ArrayBuffer(0);try{o.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(s),o.blob=i.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var s=n("./utils"),i=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),c=0;c<256;c++)u[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;u[254]=u[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(h){return i.nodebuffer?a.newBufferFrom(h,"utf-8"):function(v){var f,m,y,g,_,x=v.length,E=0;for(g=0;g>>6:(m<65536?f[_++]=224|m>>>12:(f[_++]=240|m>>>18,f[_++]=128|m>>>12&63),f[_++]=128|m>>>6&63),f[_++]=128|63&m);return f}(h)},o.utf8decode=function(h){return i.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):function(v){var f,m,y,g,_=v.length,x=new Array(2*_);for(f=m=0;f<_;)if((y=v[f++])<128)x[m++]=y;else if(4<(g=u[y]))x[m++]=65533,f+=g-1;else{for(y&=g===2?31:g===3?15:7;1>10&1023,x[m++]=56320|1023&y)}return x.length!==m&&(x.subarray?x=x.subarray(0,m):x.length=m),s.applyFromCharCode(x)}(h=s.transformTo(i.uint8array?"uint8array":"array",h))},s.inherits(d,l),d.prototype.processChunk=function(h){var v=s.transformTo(i.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var f=v;(v=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),v.set(f,this.leftOver.length)}else v=this.leftOver.concat(v);this.leftOver=null}var m=function(g,_){var x;for((_=_||g.length)>g.length&&(_=g.length),x=_-1;0<=x&&(192&g[x])==128;)x--;return x<0||x===0?_:x+u[g[x]]>_?x:_}(v),y=v;m!==v.length&&(i.uint8array?(y=v.subarray(0,m),this.leftOver=v.subarray(m,v.length)):(y=v.slice(0,m),this.leftOver=v.slice(m,v.length))),this.push({data:o.utf8decode(y),meta:h.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=d,s.inherits(p,l),p.prototype.processChunk=function(h){this.push({data:o.utf8encode(h.data),meta:h.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var s=n("./support"),i=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(f){return f}function c(f,m){for(var y=0;y>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=s(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var v,f,m,y=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?p[m++]=224|h>>>12:(p[m++]=240|h>>>18,p[m++]=128|h>>>12&63),p[m++]=128|h>>>6&63),p[m++]=128|63&h);return p},o.buf2binstring=function(d){return c(d,d.length)},o.binstring2buf=function(d){for(var p=new s.Buf8(d.length),h=0,v=p.length;h>10&1023,g[v++]=56320|1023&f)}return c(g,v)},o.utf8border=function(d,p){var h;for((p=p||d.length)>d.length&&(p=d.length),h=p-1;0<=h&&(192&d[h])==128;)h--;return h<0||h===0?p:h+l[d[h]]>p?h:p}},{"./common":41}],43:[function(n,r,o){r.exports=function(s,i,a,l){for(var u=65535&s|0,c=s>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3>>1:i>>>1;a[l]=i}return a}();r.exports=function(i,a,l,u){var c=s,d=u+l;i^=-1;for(var p=u;p>>8^c[255&(i^a[p])];return-1^i}},{}],46:[function(n,r,o){var s,i=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),c=n("./messages"),d=0,p=4,h=0,v=-2,f=-1,m=4,y=2,g=8,_=9,x=286,E=30,I=19,C=2*x+1,N=15,j=3,R=258,W=R+j+1,D=42,M=113,w=1,T=2,V=3,A=4;function X(b,K){return b.msg=c[K],K}function $(b){return(b<<1)-(4b.avail_out&&(U=b.avail_out),U!==0&&(i.arraySet(b.output,K.pending_buf,K.pending_out,U,b.next_out),b.next_out+=U,K.pending_out+=U,b.total_out+=U,b.avail_out-=U,K.pending-=U,K.pending===0&&(K.pending_out=0))}function B(b,K){a._tr_flush_block(b,0<=b.block_start?b.block_start:-1,b.strstart-b.block_start,K),b.block_start=b.strstart,z(b.strm)}function te(b,K){b.pending_buf[b.pending++]=K}function J(b,K){b.pending_buf[b.pending++]=K>>>8&255,b.pending_buf[b.pending++]=255&K}function Z(b,K){var U,O,S=b.max_chain_length,F=b.strstart,q=b.prev_length,G=b.nice_match,L=b.strstart>b.w_size-W?b.strstart-(b.w_size-W):0,Q=b.window,re=b.w_mask,ee=b.prev,se=b.strstart+R,ve=Q[F+q-1],he=Q[F+q];b.prev_length>=b.good_match&&(S>>=2),G>b.lookahead&&(G=b.lookahead);do if(Q[(U=K)+q]===he&&Q[U+q-1]===ve&&Q[U]===Q[F]&&Q[++U]===Q[F+1]){F+=2,U++;do;while(Q[++F]===Q[++U]&&Q[++F]===Q[++U]&&Q[++F]===Q[++U]&&Q[++F]===Q[++U]&&Q[++F]===Q[++U]&&Q[++F]===Q[++U]&&Q[++F]===Q[++U]&&Q[++F]===Q[++U]&&FL&&--S!=0);return q<=b.lookahead?q:b.lookahead}function me(b){var K,U,O,S,F,q,G,L,Q,re,ee=b.w_size;do{if(S=b.window_size-b.lookahead-b.strstart,b.strstart>=ee+(ee-W)){for(i.arraySet(b.window,b.window,ee,ee,0),b.match_start-=ee,b.strstart-=ee,b.block_start-=ee,K=U=b.hash_size;O=b.head[--K],b.head[K]=ee<=O?O-ee:0,--U;);for(K=U=ee;O=b.prev[--K],b.prev[K]=ee<=O?O-ee:0,--U;);S+=ee}if(b.strm.avail_in===0)break;if(q=b.strm,G=b.window,L=b.strstart+b.lookahead,Q=S,re=void 0,re=q.avail_in,Q=j)for(F=b.strstart-b.insert,b.ins_h=b.window[F],b.ins_h=(b.ins_h<=j&&(b.ins_h=(b.ins_h<=j)if(O=a._tr_tally(b,b.strstart-b.match_start,b.match_length-j),b.lookahead-=b.match_length,b.match_length<=b.max_lazy_match&&b.lookahead>=j){for(b.match_length--;b.strstart++,b.ins_h=(b.ins_h<=j&&(b.ins_h=(b.ins_h<=j&&b.match_length<=b.prev_length){for(S=b.strstart+b.lookahead-j,O=a._tr_tally(b,b.strstart-1-b.prev_match,b.prev_length-j),b.lookahead-=b.prev_length-1,b.prev_length-=2;++b.strstart<=S&&(b.ins_h=(b.ins_h<b.pending_buf_size-5&&(U=b.pending_buf_size-5);;){if(b.lookahead<=1){if(me(b),b.lookahead===0&&K===d)return w;if(b.lookahead===0)break}b.strstart+=b.lookahead,b.lookahead=0;var O=b.block_start+U;if((b.strstart===0||b.strstart>=O)&&(b.lookahead=b.strstart-O,b.strstart=O,B(b,!1),b.strm.avail_out===0)||b.strstart-b.block_start>=b.w_size-W&&(B(b,!1),b.strm.avail_out===0))return w}return b.insert=0,K===p?(B(b,!0),b.strm.avail_out===0?V:A):(b.strstart>b.block_start&&(B(b,!1),b.strm.avail_out),w)}),new ue(4,4,8,4,be),new ue(4,5,16,8,be),new ue(4,6,32,32,be),new ue(4,4,16,16,le),new ue(8,16,32,32,le),new ue(8,16,128,128,le),new ue(8,32,128,256,le),new ue(32,128,258,1024,le),new ue(32,258,258,4096,le)],o.deflateInit=function(b,K){return Ce(b,K,g,15,8,0)},o.deflateInit2=Ce,o.deflateReset=pe,o.deflateResetKeep=ye,o.deflateSetHeader=function(b,K){return b&&b.state?b.state.wrap!==2?v:(b.state.gzhead=K,h):v},o.deflate=function(b,K){var U,O,S,F;if(!b||!b.state||5>8&255),te(O,O.gzhead.time>>16&255),te(O,O.gzhead.time>>24&255),te(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),te(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(te(O,255&O.gzhead.extra.length),te(O,O.gzhead.extra.length>>8&255)),O.gzhead.hcrc&&(b.adler=u(b.adler,O.pending_buf,O.pending,0)),O.gzindex=0,O.status=69):(te(O,0),te(O,0),te(O,0),te(O,0),te(O,0),te(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),te(O,3),O.status=M);else{var q=g+(O.w_bits-8<<4)<<8;q|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(q|=32),q+=31-q%31,O.status=M,J(O,q),O.strstart!==0&&(J(O,b.adler>>>16),J(O,65535&b.adler)),b.adler=1}if(O.status===69)if(O.gzhead.extra){for(S=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>S&&(b.adler=u(b.adler,O.pending_buf,O.pending-S,S)),z(b),S=O.pending,O.pending!==O.pending_buf_size));)te(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>S&&(b.adler=u(b.adler,O.pending_buf,O.pending-S,S)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){S=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>S&&(b.adler=u(b.adler,O.pending_buf,O.pending-S,S)),z(b),S=O.pending,O.pending===O.pending_buf_size)){F=1;break}F=O.gzindexS&&(b.adler=u(b.adler,O.pending_buf,O.pending-S,S)),F===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){S=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>S&&(b.adler=u(b.adler,O.pending_buf,O.pending-S,S)),z(b),S=O.pending,O.pending===O.pending_buf_size)){F=1;break}F=O.gzindexS&&(b.adler=u(b.adler,O.pending_buf,O.pending-S,S)),F===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&z(b),O.pending+2<=O.pending_buf_size&&(te(O,255&b.adler),te(O,b.adler>>8&255),b.adler=0,O.status=M)):O.status=M),O.pending!==0){if(z(b),b.avail_out===0)return O.last_flush=-1,h}else if(b.avail_in===0&&$(K)<=$(U)&&K!==p)return X(b,-5);if(O.status===666&&b.avail_in!==0)return X(b,-5);if(b.avail_in!==0||O.lookahead!==0||K!==d&&O.status!==666){var G=O.strategy===2?function(L,Q){for(var re;;){if(L.lookahead===0&&(me(L),L.lookahead===0)){if(Q===d)return w;break}if(L.match_length=0,re=a._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++,re&&(B(L,!1),L.strm.avail_out===0))return w}return L.insert=0,Q===p?(B(L,!0),L.strm.avail_out===0?V:A):L.last_lit&&(B(L,!1),L.strm.avail_out===0)?w:T}(O,K):O.strategy===3?function(L,Q){for(var re,ee,se,ve,he=L.window;;){if(L.lookahead<=R){if(me(L),L.lookahead<=R&&Q===d)return w;if(L.lookahead===0)break}if(L.match_length=0,L.lookahead>=j&&0L.lookahead&&(L.match_length=L.lookahead)}if(L.match_length>=j?(re=a._tr_tally(L,1,L.match_length-j),L.lookahead-=L.match_length,L.strstart+=L.match_length,L.match_length=0):(re=a._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++),re&&(B(L,!1),L.strm.avail_out===0))return w}return L.insert=0,Q===p?(B(L,!0),L.strm.avail_out===0?V:A):L.last_lit&&(B(L,!1),L.strm.avail_out===0)?w:T}(O,K):s[O.level].func(O,K);if(G!==V&&G!==A||(O.status=666),G===w||G===V)return b.avail_out===0&&(O.last_flush=-1),h;if(G===T&&(K===1?a._tr_align(O):K!==5&&(a._tr_stored_block(O,0,0,!1),K===3&&(ne(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),z(b),b.avail_out===0))return O.last_flush=-1,h}return K!==p?h:O.wrap<=0?1:(O.wrap===2?(te(O,255&b.adler),te(O,b.adler>>8&255),te(O,b.adler>>16&255),te(O,b.adler>>24&255),te(O,255&b.total_in),te(O,b.total_in>>8&255),te(O,b.total_in>>16&255),te(O,b.total_in>>24&255)):(J(O,b.adler>>>16),J(O,65535&b.adler)),z(b),0=U.w_size&&(F===0&&(ne(U.head),U.strstart=0,U.block_start=0,U.insert=0),Q=new i.Buf8(U.w_size),i.arraySet(Q,K,re-U.w_size,U.w_size,0),K=Q,re=U.w_size),q=b.avail_in,G=b.next_in,L=b.input,b.avail_in=re,b.next_in=0,b.input=K,me(U);U.lookahead>=j;){for(O=U.strstart,S=U.lookahead-(j-1);U.ins_h=(U.ins_h<>>=j=N>>>24,_-=j,(j=N>>>16&255)===0)T[c++]=65535&N;else{if(!(16&j)){if(!(64&j)){N=x[(65535&N)+(g&(1<>>=j,_-=j),_<15&&(g+=w[l++]<<_,_+=8,g+=w[l++]<<_,_+=8),N=E[g&C];n:for(;;){if(g>>>=j=N>>>24,_-=j,!(16&(j=N>>>16&255))){if(!(64&j)){N=E[(65535&N)+(g&(1<>>=j,_-=j,(j=c-d)>3,g&=(1<<(_-=R<<3))-1,s.next_in=l,s.next_out=c,s.avail_in=l>>24&255)+(D>>>8&65280)+((65280&D)<<8)+((255&D)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(D){var M;return D&&D.state?(M=D.state,D.total_in=D.total_out=M.total=0,D.msg="",M.wrap&&(D.adler=1&M.wrap),M.mode=v,M.last=0,M.havedict=0,M.dmax=32768,M.head=null,M.hold=0,M.bits=0,M.lencode=M.lendyn=new s.Buf32(f),M.distcode=M.distdyn=new s.Buf32(m),M.sane=1,M.back=-1,p):h}function x(D){var M;return D&&D.state?((M=D.state).wsize=0,M.whave=0,M.wnext=0,_(D)):h}function E(D,M){var w,T;return D&&D.state?(T=D.state,M<0?(w=0,M=-M):(w=1+(M>>4),M<48&&(M&=15)),M&&(M<8||15=A.wsize?(s.arraySet(A.window,M,w-A.wsize,A.wsize,0),A.wnext=0,A.whave=A.wsize):(T<(V=A.wsize-A.wnext)&&(V=T),s.arraySet(A.window,M,w-T,V,A.wnext),(T-=V)?(s.arraySet(A.window,M,w-T,T,0),A.wnext=T,A.whave=A.wsize):(A.wnext+=V,A.wnext===A.wsize&&(A.wnext=0),A.whave>>8&255,w.check=a(w.check,F,2,0),B=z=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&z)<<8)+(z>>8))%31){D.msg="incorrect header check",w.mode=30;break}if((15&z)!=8){D.msg="unknown compression method",w.mode=30;break}if(B-=4,b=8+(15&(z>>>=4)),w.wbits===0)w.wbits=b;else if(b>w.wbits){D.msg="invalid window size",w.mode=30;break}w.dmax=1<>8&1),512&w.flags&&(F[0]=255&z,F[1]=z>>>8&255,w.check=a(w.check,F,2,0)),B=z=0,w.mode=3;case 3:for(;B<32;){if($===0)break e;$--,z+=T[A++]<>>8&255,F[2]=z>>>16&255,F[3]=z>>>24&255,w.check=a(w.check,F,4,0)),B=z=0,w.mode=4;case 4:for(;B<16;){if($===0)break e;$--,z+=T[A++]<>8),512&w.flags&&(F[0]=255&z,F[1]=z>>>8&255,w.check=a(w.check,F,2,0)),B=z=0,w.mode=5;case 5:if(1024&w.flags){for(;B<16;){if($===0)break e;$--,z+=T[A++]<>>8&255,w.check=a(w.check,F,2,0)),B=z=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&($<(Z=w.length)&&(Z=$),Z&&(w.head&&(b=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),s.arraySet(w.head.extra,T,A,Z,b)),512&w.flags&&(w.check=a(w.check,T,Z,A)),$-=Z,A+=Z,w.length-=Z),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if($===0)break e;for(Z=0;b=T[A+Z++],w.head&&b&&w.length<65536&&(w.head.name+=String.fromCharCode(b)),b&&Z<$;);if(512&w.flags&&(w.check=a(w.check,T,Z,A)),$-=Z,A+=Z,b)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if($===0)break e;for(Z=0;b=T[A+Z++],w.head&&b&&w.length<65536&&(w.head.comment+=String.fromCharCode(b)),b&&Z<$;);if(512&w.flags&&(w.check=a(w.check,T,Z,A)),$-=Z,A+=Z,b)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;B<16;){if($===0)break e;$--,z+=T[A++]<>9&1,w.head.done=!0),D.adler=w.check=0,w.mode=12;break;case 10:for(;B<32;){if($===0)break e;$--,z+=T[A++]<>>=7&B,B-=7&B,w.mode=27;break}for(;B<3;){if($===0)break e;$--,z+=T[A++]<>>=1)){case 0:w.mode=14;break;case 1:if(R(w),w.mode=20,M!==6)break;z>>>=2,B-=2;break e;case 2:w.mode=17;break;case 3:D.msg="invalid block type",w.mode=30}z>>>=2,B-=2;break;case 14:for(z>>>=7&B,B-=7&B;B<32;){if($===0)break e;$--,z+=T[A++]<>>16^65535)){D.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&z,B=z=0,w.mode=15,M===6)break e;case 15:w.mode=16;case 16:if(Z=w.length){if($>>=5,B-=5,w.ndist=1+(31&z),z>>>=5,B-=5,w.ncode=4+(15&z),z>>>=4,B-=4,286>>=3,B-=3}for(;w.have<19;)w.lens[q[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,U={bits:w.lenbits},K=u(0,w.lens,0,19,w.lencode,0,w.work,U),w.lenbits=U.bits,K){D.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have>>16&255,ke=65535&S,!((le=S>>>24)<=B);){if($===0)break e;$--,z+=T[A++]<>>=le,B-=le,w.lens[w.have++]=ke;else{if(ke===16){for(O=le+2;B>>=le,B-=le,w.have===0){D.msg="invalid bit length repeat",w.mode=30;break}b=w.lens[w.have-1],Z=3+(3&z),z>>>=2,B-=2}else if(ke===17){for(O=le+3;B>>=le)),z>>>=3,B-=3}else{for(O=le+7;B>>=le)),z>>>=7,B-=7}if(w.have+Z>w.nlen+w.ndist){D.msg="invalid bit length repeat",w.mode=30;break}for(;Z--;)w.lens[w.have++]=b}}if(w.mode===30)break;if(w.lens[256]===0){D.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,U={bits:w.lenbits},K=u(c,w.lens,0,w.nlen,w.lencode,0,w.work,U),w.lenbits=U.bits,K){D.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,U={bits:w.distbits},K=u(d,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,U),w.distbits=U.bits,K){D.msg="invalid distances set",w.mode=30;break}if(w.mode=20,M===6)break e;case 20:w.mode=21;case 21:if(6<=$&&258<=ne){D.next_out=X,D.avail_out=ne,D.next_in=A,D.avail_in=$,w.hold=z,w.bits=B,l(D,J),X=D.next_out,V=D.output,ne=D.avail_out,A=D.next_in,T=D.input,$=D.avail_in,z=w.hold,B=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;ue=(S=w.lencode[z&(1<>>16&255,ke=65535&S,!((le=S>>>24)<=B);){if($===0)break e;$--,z+=T[A++]<>ye)])>>>16&255,ke=65535&S,!(ye+(le=S>>>24)<=B);){if($===0)break e;$--,z+=T[A++]<>>=ye,B-=ye,w.back+=ye}if(z>>>=le,B-=le,w.back+=le,w.length=ke,ue===0){w.mode=26;break}if(32&ue){w.back=-1,w.mode=12;break}if(64&ue){D.msg="invalid literal/length code",w.mode=30;break}w.extra=15&ue,w.mode=22;case 22:if(w.extra){for(O=w.extra;B>>=w.extra,B-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;ue=(S=w.distcode[z&(1<>>16&255,ke=65535&S,!((le=S>>>24)<=B);){if($===0)break e;$--,z+=T[A++]<>ye)])>>>16&255,ke=65535&S,!(ye+(le=S>>>24)<=B);){if($===0)break e;$--,z+=T[A++]<>>=ye,B-=ye,w.back+=ye}if(z>>>=le,B-=le,w.back+=le,64&ue){D.msg="invalid distance code",w.mode=30;break}w.offset=ke,w.extra=15&ue,w.mode=24;case 24:if(w.extra){for(O=w.extra;B>>=w.extra,B-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){D.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(ne===0)break e;if(Z=J-ne,w.offset>Z){if((Z=w.offset-Z)>w.whave&&w.sane){D.msg="invalid distance too far back",w.mode=30;break}me=Z>w.wnext?(Z-=w.wnext,w.wsize-Z):w.wnext-Z,Z>w.length&&(Z=w.length),be=w.window}else be=V,me=X-w.offset,Z=w.length;for(neC?(j=me[be+m[M]],B[te+m[M]]):(j=96,0),g=1<>X)+(_-=g)]=N<<24|j<<16|R|0,_!==0;);for(g=1<>=1;if(g!==0?(z&=g-1,z+=g):z=0,M++,--J[D]==0){if(D===T)break;D=d[p+m[M]]}if(V>>7)]}function te(S,F){S.pending_buf[S.pending++]=255&F,S.pending_buf[S.pending++]=F>>>8&255}function J(S,F,q){S.bi_valid>y-q?(S.bi_buf|=F<>y-S.bi_valid,S.bi_valid+=q-y):(S.bi_buf|=F<>>=1,q<<=1,0<--F;);return q>>>1}function be(S,F,q){var G,L,Q=new Array(m+1),re=0;for(G=1;G<=m;G++)Q[G]=re=re+q[G-1]<<1;for(L=0;L<=F;L++){var ee=S[2*L+1];ee!==0&&(S[2*L]=me(Q[ee]++,ee))}}function le(S){var F;for(F=0;F>1;1<=q;q--)ye(S,Q,q);for(L=se;q=S.heap[1],S.heap[1]=S.heap[S.heap_len--],ye(S,Q,1),G=S.heap[1],S.heap[--S.heap_max]=q,S.heap[--S.heap_max]=G,Q[2*L]=Q[2*q]+Q[2*G],S.depth[L]=(S.depth[q]>=S.depth[G]?S.depth[q]:S.depth[G])+1,Q[2*q+1]=Q[2*G+1]=L,S.heap[1]=L++,ye(S,Q,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(he,Xe){var _n,it,xn,Pe,Qn,ao,pt=Xe.dyn_tree,qs=Xe.max_code,bl=Xe.stat_desc.static_tree,_l=Xe.stat_desc.has_stree,xl=Xe.stat_desc.extra_bits,Gs=Xe.stat_desc.extra_base,kn=Xe.stat_desc.max_length,er=0;for(Pe=0;Pe<=m;Pe++)he.bl_count[Pe]=0;for(pt[2*he.heap[he.heap_max]+1]=0,_n=he.heap_max+1;_n>=7;L>>=1)if(1&ve&&ee.dyn_ltree[2*se]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return a;for(se=32;se>>3,(Q=S.static_len+3+7>>>3)<=L&&(L=Q)):L=Q=q+5,q+4<=L&&F!==-1?O(S,F,q,G):S.strategy===4||Q===L?(J(S,2+(G?1:0),3),pe(S,W,D)):(J(S,4+(G?1:0),3),function(ee,se,ve,he){var Xe;for(J(ee,se-257,5),J(ee,ve-1,5),J(ee,he-4,4),Xe=0;Xe>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&F,S.pending_buf[S.l_buf+S.last_lit]=255&q,S.last_lit++,F===0?S.dyn_ltree[2*q]++:(S.matches++,F--,S.dyn_ltree[2*(w[q]+d+1)]++,S.dyn_dtree[2*B(F)]++),S.last_lit===S.lit_bufsize-1},o._tr_align=function(S){J(S,2,3),Z(S,_,W),function(F){F.bi_valid===16?(te(F,F.bi_buf),F.bi_buf=0,F.bi_valid=0):8<=F.bi_valid&&(F.pending_buf[F.pending++]=255&F.bi_buf,F.bi_buf>>=8,F.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(i,a){if(!i.setImmediate){var l,u,c,d,p=1,h={},v=!1,f=i.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(i);m=m&&m.setTimeout?m:i,l={}.toString.call(i.process)==="[object process]"?function(x){process.nextTick(function(){g(x)})}:function(){if(i.postMessage&&!i.importScripts){var x=!0,E=i.onmessage;return i.onmessage=function(){x=!1},i.postMessage("","*"),i.onmessage=E,x}}()?(d="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",_,!1):i.attachEvent("onmessage",_),function(x){i.postMessage(d+x,"*")}):i.MessageChannel?((c=new MessageChannel).port1.onmessage=function(x){g(x.data)},function(x){c.port2.postMessage(x)}):f&&"onreadystatechange"in f.createElement("script")?(u=f.documentElement,function(x){var E=f.createElement("script");E.onreadystatechange=function(){g(x),E.onreadystatechange=null,u.removeChild(E),E=null},u.appendChild(E)}):function(x){setTimeout(g,0,x)},m.setImmediate=function(x){typeof x!="function"&&(x=new Function(""+x));for(var E=new Array(arguments.length-1),I=0;I"u"?s===void 0?this:s:self)}).call(this,typeof tr<"u"?tr:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(wl);var jp=wl.exports;const Pp=Da(jp),Ap=async t=>{const e=`ComfyUI workspace workflows ${ll(Date.now())}`,n=new Pp,r=await(Y==null?void 0:Y.getSetting("twoWaySync"));for(const o of t){let s;r?s=o.parentFolderID??"":s=await yh(o.parentFolderID??null).then(async a=>Ft(a??""));const i=n.folder(s);i==null||i.file(`${o.name}.json`,o.json)}n.generateAsync({type:"blob"}).then(function(o){const s=document.createElement("a");s.href=window.URL.createObjectURL(o),s.download=`${e}.zip`,document.body.appendChild(s),s.click(),document.body.removeChild(s)})};function Np({myWorkflowsDir:t}){return k.jsxs($e,{gap:3,children:[k.jsx(un,{size:"md",children:"πŸ¦„ Upgrade to 2.0 - enable two way sync!"}),k.jsx("p",{children:"Your workflows will be synced to and from path:"}),k.jsx("p",{children:k.jsx("b",{children:t})}),k.jsxs("p",{children:["You can manually put workflow files into this folder using File Explorer to sync them with your workspace. You can change this path anytime in Settings ",">"," Workspace Save Directory"]}),k.jsxs("p",{children:[k.jsx("b",{children:"Please download all your workflows before enabling two way sync as a backup!"})," ","So you can manually import some workflows into your workspace in case something unexpected happens."]}),k.jsx(Te,{colorScheme:"teal",variant:"outline",width:"fit-content",onClick:async()=>{const e=await(H==null?void 0:H.listAll());Ap(e??[])},children:"πŸ‘‰ Download All My Workflows"})]})}const Fp=Ra.lazy(()=>Tt(()=>import("./RecentFilesDrawer-YqesR0Z_.js"),__vite__mapDeps([14,1,8,3,13,15,12,4]))),Rp=Ra.lazy(()=>Tt(()=>import("./GalleryModal-6F7A8gNl.js"),__vite__mapDeps([16,1,15,12,9,8,3,2])));function Tp(){const[t,e]=P.useState(null),[n,r]=P.useState("root"),[o,s]=P.useState(!0),[i,a]=P.useState(null),l=P.useRef(null),[u,c]=P.useState(!1),d=P.useRef(null),{showDialog:p}=Fa(),[h,v]=P.useState(!1);P.useRef(!1);const f=Ma(),[m,y]=Dp(null),g=P.useCallback(async(w=!1)=>{var V,A;const T=H==null?void 0:H.curWorkflow;if(T){if(!w&&((V=H==null?void 0:H.curWorkflow)!=null&&V.saveLock)){f({title:"The workflow is locked and cannot be saved",status:"warning",duration:3e3});return}const X=JSON.stringify(we.graph.serialize());await Promise.all([H==null?void 0:H.updateFlow(T.id,{json:X}),Ge==null?void 0:Ge.create({workflowID:T.id,json:X,isAutoSave:!1})]),(A=Y==null?void 0:Y.settings)!=null&&A.autoSave&&f({title:"Saved",status:"success",duration:1e3,isClosable:!0}),c(!1)}},[]),_=async()=>{var T,V,A;if((T=Y==null?void 0:Y.settings)!=null&&T.autoSave){alert("You cannot discard unsaved changes when auto save is enabled");return}if(confirm("Are you sure you want to discard unsaved changes? This will revert current workflow to your last saved version. You will lose all changes made since your last save.")){const X=(V=H==null?void 0:H.curWorkflow)==null?void 0:V.id;if(X==null)return;const $=(A=await(H==null?void 0:H.get(X)))==null?void 0:A.json;$?(H==null||H.updateCurWorkflow({...H.curWorkflow,json:$}),await we.loadGraphData(JSON.parse($)),c(!1)):alert("Error: No last saved version found")}},x=w=>{const T=(w==null?void 0:w.id)??null;if(H==null||H.updateCurWorkflow(w),l.current=T,a(T),e((w==null?void 0:w.name)??""),T==null){document.title="ComfyUI",window.location.hash="",localStorage.removeItem("curFlowID");return}if(Ca()){const V=cl(T);window.location.hash=V,document.title=w.name+" - ComfyUI"}else localStorage.setItem("curFlowID",T),document.title="ComfyUI - "+w.name;w&&(H==null||H.updateLastOpenedTime(w.id))},E=async()=>{var V,A;localStorage.removeItem("workspace"),localStorage.removeItem("comfyspace");try{await Dh()}catch(X){console.error("error loading db",X)}s(!1);const w=Ca();if(w==null){const X=localStorage.getItem("workflow");if(X){const ne=(A=(V=JSON.parse(X).extra)==null?void 0:V[We])==null?void 0:A.id;if(ne){const z=await(H==null?void 0:H.get(ne));z&&x(z),z&&z.json!=X&&c(!0)}}}else I(w);Ee("/workspace/deduplicate_workflow_ids"),!await(Y==null?void 0:Y.getSetting("twoWaySync"))&&ie.cache.get(_o).then(async X=>{if((X==null?void 0:X.value)!=="true"){if(await ie.workflows.count()==0){await(Y==null?void 0:Y.upsert({twoWaySync:!0})),await ie.cache.put({id:_o,value:"true"});return}const ne=await(Y==null?void 0:Y.getSetting("myWorkflowsDir"));p(k.jsx(Np,{myWorkflowsDir:ne??"undefined"}),[{label:"I have downloaded all my workflows and ready to enable",onClick:async()=>{await(Y==null?void 0:Y.upsert({twoWaySync:!0})),await(Y==null?void 0:Y.getSetting("twoWaySync"))&&(ie.cache.put({id:_o,value:"true"}),location.reload())},colorScheme:"red"}],{closeOnOverlayClick:!1})}})},I=async(w,T)=>{if(we.graph==null)return;const V=await(H==null?void 0:H.get(w));if(V==null){alert("Error: Workflow not found! id: "+w),x(null);return}const A=T?await(ge==null?void 0:ge.get(T)):null;we.ui.dialog.close(),A?(y(A),x({...V,json:A.json}),we.loadGraphData(JSON.parse(A.json))):(x(V),y(null),we.loadGraphData(JSON.parse(V.json))),r("root"),u&&c(!1)},C=async(w,T,V=!1)=>{var A;if(w===null){x(null),we.graph.clear();return}if(!u||V||(A=Y==null?void 0:Y.settings)!=null&&A.autoSave||(H==null?void 0:H.curWorkflow)==null){I(w,T);return}N(w)},N=async w=>{var V;const T=[w?{label:"Open in new tab",icon:k.jsx(pl,{}),onClick:()=>{hh(w)}}:null,{label:"Save",colorScheme:"teal",onClick:async()=>{await g(),w&&I(w)}}];T.push({label:"Discard",colorScheme:"red",onClick:async()=>{w&&I(w)}}),p(`Please save or discard your changes to "${(V=H==null?void 0:H.curWorkflow)==null?void 0:V.name}" before leaving, or your changes will be lost.`,T)},j=async w=>{const T=(w==null?void 0:w.json)??JSON.stringify(ul),V=await(H==null?void 0:H.createFlow({json:T,name:w==null?void 0:w.name}));V&&await C(V.id),r("root")},R=async(w,T=!1)=>{const V=w.split("/").pop()??w;T?g():j({name:V});const A=await fetch(fh(w)),X=await A.blob(),$=new File([X],V,{type:A.headers.get("Content-Type")||""});await we.handleFile($),r("root")},W=async(w,T)=>{const V=await(H==null?void 0:H.get(w));if(V==null)return;const A=await(H==null?void 0:H.createFlow({json:V.json,name:T||V.name,parentFolderID:V.parentFolderID,tags:V.tags}));A&&await C(A.id)},D=P.useCallback(w=>{if(l.current==null)return;let T=w.filename;w.subfolder!=null&&w.subfolder!==""&&(T=w.subfolder+"/"+T),qt==null||qt.create({workflowID:l.current,localPath:T})},[]),M=P.useCallback(()=>{r("root")},[]);return P.useEffect(()=>{E(),v(!0);const w=T=>{var V,A,X,$,ne,z;(X=(A=(V=T.detail)==null?void 0:V.output)==null?void 0:A.images)==null||X.forEach(B=>{B.type==="output"&&D(B)}),(z=(ne=($=T.detail)==null?void 0:$.output)==null?void 0:ne.gifs)==null||z.forEach(B=>{B.type==="output"&&D(B)})};return Or.addEventListener("executed",w),()=>{window.removeEventListener("executed",w)}},[]),o?null:k.jsx(at.Provider,{value:{curFlowID:i,onDuplicateWorkflow:W,loadWorkflowID:C,discardUnsavedChanges:_,saveCurWorkflow:g,isDirty:u,setIsDirty:c,loadNewWorkflow:j,loadFilePath:R,setRoute:r,route:n,curVersion:m,setCurVersion:y,setCurFlowIDAndName:x},children:k.jsx("div",{ref:d,className:"workspace_manager",children:k.jsxs(Aa,{containerRef:d,children:[k.jsxs(jt,{style:{position:"absolute",top:0,right:0,left:0},zIndex:mh,draggable:!1,children:[k.jsx(Cp,{curFlowName:t,setCurFlowName:e}),h&&n==="recentFlows"&&k.jsx(P.Suspense,{children:k.jsx(Fp,{onClose:M,onClickNewFlow:()=>{j(),r("root")}})}),n==="gallery"&&k.jsx(P.Suspense,{children:k.jsx(Rp,{onclose:()=>r("root")})})]}),k.jsx(Sp,{})]})})})}const dm=Object.freeze(Object.defineProperty({__proto__:null,default:Tp},Symbol.toStringTag,{value:"Module"}));export{hh as $,zh as A,jt as B,Gp as C,tp as D,ah as E,Ut as F,Wh as G,ot as H,cn as I,bh as J,Le as K,Jr as L,yi as M,Qr as N,Xr as O,Vh as P,Gh as Q,rm as R,Ed as S,mn as T,ul as U,Qp as V,xr as W,Oh as X,qp as Y,at as Z,pl as _,Wp as a,ml as a0,Ee as a1,qt as a2,ll as a3,ut as a4,we as a5,sc as a6,mh as a7,Kp as a8,kr as a9,vi as aA,xi as aB,bi as aC,sm as aD,Dp as aE,Sh as aF,em as aG,om as aH,$s as aI,gs as aJ,lm as aK,Qa as aL,up as aM,ge as aN,im as aO,cm as aP,mp as aQ,um as aR,oc as aS,dm as aT,Zp as aa,La as ab,hc as ac,Jp as ad,Wa as ae,Ch as af,un as ag,on as ah,pc as ai,We as aj,Xp as ak,Yp as al,Ge as am,Kl as an,Zn as ao,Ps as ap,ie as aq,am as ar,uf as as,tm as at,nm as au,$p as av,Or as aw,Hp as ax,Nc as ay,gi as az,zp as b,Lp as c,Ae as d,Jh as e,Ma as f,$e as g,wt as h,kt as i,gn as j,Y as k,Np as l,Fc as m,cf as n,Up as o,Vp as p,Oo as q,Ds as r,js as s,Cr as t,to as u,Ct as v,Lh as w,H as x,ep as y,Ap as z}; +\0`,J+=s(z,2),J+=I.magic,J+=s(_,2),J+=s(x,2),J+=s(ne.crc32,4),J+=s(ne.compressedSize,4),J+=s(ne.uncompressedSize,4),J+=s(N.length,2),J+=s(T.length,2),{fileRecord:d.LOCAL_FILE_HEADER+J+N+T,dirRecord:d.CENTRAL_FILE_HEADER+s(te,2)+J+s(W.length,2)+"\0\0\0\0"+s(B,4)+s(m,4)+N+T+W}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),c=n("../crc32"),d=n("../signature");function p(h,v,f,m){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=v,this.zipPlatform=f,this.encodeFileName=m,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(h){var v=h.meta.percent||0,f=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,l.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:f?(v+100*(f-m-1))/f:100}}))},p.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var v=this.streamFiles&&!h.file.dir;if(v){var f=i(h,v,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(h){this.accumulate=!1;var v=this.streamFiles&&!h.file.dir,f=i(h,v,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),v)this.push({data:function(m){return d.DATA_DESCRIPTOR+s(m.crc32,4)+s(m.compressedSize,4)+s(m.uncompressedSize,4)}(h),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var h=this.bytesWritten,v=0;v=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),i=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),c=n("./Uint8ArrayReader");r.exports=function(d){var p=s.getTypeOf(d);return s.checkSupport(p),p!=="string"||i.uint8array?p==="nodebuffer"?new u(d):i.uint8array?new c(s.transformTo("uint8array",d)):new a(s.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var s=n("./GenericWorker"),i=n("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}i.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:i.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),i=n("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=i(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(l){i.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,i),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}i.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(l){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){u.dataIsReady=!0,u.data=c,u.max=c&&c.length||0,u.type=s.getTypeOf(c),u.isPaused||u._tickAndRepeat()},function(c){u.error(c)})}s.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function s(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var l=0;l "+i:i}},r.exports=s},{}],29:[function(n,r,o){var s=n("../utils"),i=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),c=n("../external"),d=null;if(u.nodestream)try{d=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(v,f){return new c.Promise(function(m,y){var g=[],_=v._internalType,x=v._outputType,E=v._mimeType;v.on("data",function(I,C){g.push(I),f&&f(C)}).on("error",function(I){g=[],y(I)}).on("end",function(){try{var I=function(C,N,j){switch(C){case"blob":return s.newBlob(s.transformTo("arraybuffer",N),j);case"base64":return l.encode(N);default:return s.transformTo(C,N)}}(x,function(C,N){var j,R=0,W=null,D=0;for(j=0;j"u")o.blob=!1;else{var s=new ArrayBuffer(0);try{o.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(s),o.blob=i.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var s=n("./utils"),i=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),c=0;c<256;c++)u[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;u[254]=u[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(h){return i.nodebuffer?a.newBufferFrom(h,"utf-8"):function(v){var f,m,y,g,_,x=v.length,E=0;for(g=0;g>>6:(m<65536?f[_++]=224|m>>>12:(f[_++]=240|m>>>18,f[_++]=128|m>>>12&63),f[_++]=128|m>>>6&63),f[_++]=128|63&m);return f}(h)},o.utf8decode=function(h){return i.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):function(v){var f,m,y,g,_=v.length,x=new Array(2*_);for(f=m=0;f<_;)if((y=v[f++])<128)x[m++]=y;else if(4<(g=u[y]))x[m++]=65533,f+=g-1;else{for(y&=g===2?31:g===3?15:7;1>10&1023,x[m++]=56320|1023&y)}return x.length!==m&&(x.subarray?x=x.subarray(0,m):x.length=m),s.applyFromCharCode(x)}(h=s.transformTo(i.uint8array?"uint8array":"array",h))},s.inherits(d,l),d.prototype.processChunk=function(h){var v=s.transformTo(i.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var f=v;(v=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),v.set(f,this.leftOver.length)}else v=this.leftOver.concat(v);this.leftOver=null}var m=function(g,_){var x;for((_=_||g.length)>g.length&&(_=g.length),x=_-1;0<=x&&(192&g[x])==128;)x--;return x<0||x===0?_:x+u[g[x]]>_?x:_}(v),y=v;m!==v.length&&(i.uint8array?(y=v.subarray(0,m),this.leftOver=v.subarray(m,v.length)):(y=v.slice(0,m),this.leftOver=v.slice(m,v.length))),this.push({data:o.utf8decode(y),meta:h.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=d,s.inherits(p,l),p.prototype.processChunk=function(h){this.push({data:o.utf8encode(h.data),meta:h.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var s=n("./support"),i=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(f){return f}function c(f,m){for(var y=0;y>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=s(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var v,f,m,y=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?p[m++]=224|h>>>12:(p[m++]=240|h>>>18,p[m++]=128|h>>>12&63),p[m++]=128|h>>>6&63),p[m++]=128|63&h);return p},o.buf2binstring=function(d){return c(d,d.length)},o.binstring2buf=function(d){for(var p=new s.Buf8(d.length),h=0,v=p.length;h>10&1023,g[v++]=56320|1023&f)}return c(g,v)},o.utf8border=function(d,p){var h;for((p=p||d.length)>d.length&&(p=d.length),h=p-1;0<=h&&(192&d[h])==128;)h--;return h<0||h===0?p:h+l[d[h]]>p?h:p}},{"./common":41}],43:[function(n,r,o){r.exports=function(s,i,a,l){for(var u=65535&s|0,c=s>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3>>1:i>>>1;a[l]=i}return a}();r.exports=function(i,a,l,u){var c=s,d=u+l;i^=-1;for(var p=u;p>>8^c[255&(i^a[p])];return-1^i}},{}],46:[function(n,r,o){var s,i=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),c=n("./messages"),d=0,p=4,h=0,v=-2,f=-1,m=4,y=2,g=8,_=9,x=286,E=30,I=19,C=2*x+1,N=15,j=3,R=258,W=R+j+1,D=42,M=113,w=1,T=2,V=3,A=4;function X(b,K){return b.msg=c[K],K}function $(b){return(b<<1)-(4b.avail_out&&(U=b.avail_out),U!==0&&(i.arraySet(b.output,K.pending_buf,K.pending_out,U,b.next_out),b.next_out+=U,K.pending_out+=U,b.total_out+=U,b.avail_out-=U,K.pending-=U,K.pending===0&&(K.pending_out=0))}function B(b,K){a._tr_flush_block(b,0<=b.block_start?b.block_start:-1,b.strstart-b.block_start,K),b.block_start=b.strstart,z(b.strm)}function te(b,K){b.pending_buf[b.pending++]=K}function J(b,K){b.pending_buf[b.pending++]=K>>>8&255,b.pending_buf[b.pending++]=255&K}function Z(b,K){var U,O,S=b.max_chain_length,F=b.strstart,q=b.prev_length,G=b.nice_match,L=b.strstart>b.w_size-W?b.strstart-(b.w_size-W):0,Q=b.window,re=b.w_mask,ee=b.prev,se=b.strstart+R,ve=Q[F+q-1],he=Q[F+q];b.prev_length>=b.good_match&&(S>>=2),G>b.lookahead&&(G=b.lookahead);do if(Q[(U=K)+q]===he&&Q[U+q-1]===ve&&Q[U]===Q[F]&&Q[++U]===Q[F+1]){F+=2,U++;do;while(Q[++F]===Q[++U]&&Q[++F]===Q[++U]&&Q[++F]===Q[++U]&&Q[++F]===Q[++U]&&Q[++F]===Q[++U]&&Q[++F]===Q[++U]&&Q[++F]===Q[++U]&&Q[++F]===Q[++U]&&FL&&--S!=0);return q<=b.lookahead?q:b.lookahead}function me(b){var K,U,O,S,F,q,G,L,Q,re,ee=b.w_size;do{if(S=b.window_size-b.lookahead-b.strstart,b.strstart>=ee+(ee-W)){for(i.arraySet(b.window,b.window,ee,ee,0),b.match_start-=ee,b.strstart-=ee,b.block_start-=ee,K=U=b.hash_size;O=b.head[--K],b.head[K]=ee<=O?O-ee:0,--U;);for(K=U=ee;O=b.prev[--K],b.prev[K]=ee<=O?O-ee:0,--U;);S+=ee}if(b.strm.avail_in===0)break;if(q=b.strm,G=b.window,L=b.strstart+b.lookahead,Q=S,re=void 0,re=q.avail_in,Q=j)for(F=b.strstart-b.insert,b.ins_h=b.window[F],b.ins_h=(b.ins_h<=j&&(b.ins_h=(b.ins_h<=j)if(O=a._tr_tally(b,b.strstart-b.match_start,b.match_length-j),b.lookahead-=b.match_length,b.match_length<=b.max_lazy_match&&b.lookahead>=j){for(b.match_length--;b.strstart++,b.ins_h=(b.ins_h<=j&&(b.ins_h=(b.ins_h<=j&&b.match_length<=b.prev_length){for(S=b.strstart+b.lookahead-j,O=a._tr_tally(b,b.strstart-1-b.prev_match,b.prev_length-j),b.lookahead-=b.prev_length-1,b.prev_length-=2;++b.strstart<=S&&(b.ins_h=(b.ins_h<b.pending_buf_size-5&&(U=b.pending_buf_size-5);;){if(b.lookahead<=1){if(me(b),b.lookahead===0&&K===d)return w;if(b.lookahead===0)break}b.strstart+=b.lookahead,b.lookahead=0;var O=b.block_start+U;if((b.strstart===0||b.strstart>=O)&&(b.lookahead=b.strstart-O,b.strstart=O,B(b,!1),b.strm.avail_out===0)||b.strstart-b.block_start>=b.w_size-W&&(B(b,!1),b.strm.avail_out===0))return w}return b.insert=0,K===p?(B(b,!0),b.strm.avail_out===0?V:A):(b.strstart>b.block_start&&(B(b,!1),b.strm.avail_out),w)}),new ue(4,4,8,4,be),new ue(4,5,16,8,be),new ue(4,6,32,32,be),new ue(4,4,16,16,le),new ue(8,16,32,32,le),new ue(8,16,128,128,le),new ue(8,32,128,256,le),new ue(32,128,258,1024,le),new ue(32,258,258,4096,le)],o.deflateInit=function(b,K){return Ce(b,K,g,15,8,0)},o.deflateInit2=Ce,o.deflateReset=pe,o.deflateResetKeep=ye,o.deflateSetHeader=function(b,K){return b&&b.state?b.state.wrap!==2?v:(b.state.gzhead=K,h):v},o.deflate=function(b,K){var U,O,S,F;if(!b||!b.state||5>8&255),te(O,O.gzhead.time>>16&255),te(O,O.gzhead.time>>24&255),te(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),te(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(te(O,255&O.gzhead.extra.length),te(O,O.gzhead.extra.length>>8&255)),O.gzhead.hcrc&&(b.adler=u(b.adler,O.pending_buf,O.pending,0)),O.gzindex=0,O.status=69):(te(O,0),te(O,0),te(O,0),te(O,0),te(O,0),te(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),te(O,3),O.status=M);else{var q=g+(O.w_bits-8<<4)<<8;q|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(q|=32),q+=31-q%31,O.status=M,J(O,q),O.strstart!==0&&(J(O,b.adler>>>16),J(O,65535&b.adler)),b.adler=1}if(O.status===69)if(O.gzhead.extra){for(S=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>S&&(b.adler=u(b.adler,O.pending_buf,O.pending-S,S)),z(b),S=O.pending,O.pending!==O.pending_buf_size));)te(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>S&&(b.adler=u(b.adler,O.pending_buf,O.pending-S,S)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){S=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>S&&(b.adler=u(b.adler,O.pending_buf,O.pending-S,S)),z(b),S=O.pending,O.pending===O.pending_buf_size)){F=1;break}F=O.gzindexS&&(b.adler=u(b.adler,O.pending_buf,O.pending-S,S)),F===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){S=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>S&&(b.adler=u(b.adler,O.pending_buf,O.pending-S,S)),z(b),S=O.pending,O.pending===O.pending_buf_size)){F=1;break}F=O.gzindexS&&(b.adler=u(b.adler,O.pending_buf,O.pending-S,S)),F===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&z(b),O.pending+2<=O.pending_buf_size&&(te(O,255&b.adler),te(O,b.adler>>8&255),b.adler=0,O.status=M)):O.status=M),O.pending!==0){if(z(b),b.avail_out===0)return O.last_flush=-1,h}else if(b.avail_in===0&&$(K)<=$(U)&&K!==p)return X(b,-5);if(O.status===666&&b.avail_in!==0)return X(b,-5);if(b.avail_in!==0||O.lookahead!==0||K!==d&&O.status!==666){var G=O.strategy===2?function(L,Q){for(var re;;){if(L.lookahead===0&&(me(L),L.lookahead===0)){if(Q===d)return w;break}if(L.match_length=0,re=a._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++,re&&(B(L,!1),L.strm.avail_out===0))return w}return L.insert=0,Q===p?(B(L,!0),L.strm.avail_out===0?V:A):L.last_lit&&(B(L,!1),L.strm.avail_out===0)?w:T}(O,K):O.strategy===3?function(L,Q){for(var re,ee,se,ve,he=L.window;;){if(L.lookahead<=R){if(me(L),L.lookahead<=R&&Q===d)return w;if(L.lookahead===0)break}if(L.match_length=0,L.lookahead>=j&&0L.lookahead&&(L.match_length=L.lookahead)}if(L.match_length>=j?(re=a._tr_tally(L,1,L.match_length-j),L.lookahead-=L.match_length,L.strstart+=L.match_length,L.match_length=0):(re=a._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++),re&&(B(L,!1),L.strm.avail_out===0))return w}return L.insert=0,Q===p?(B(L,!0),L.strm.avail_out===0?V:A):L.last_lit&&(B(L,!1),L.strm.avail_out===0)?w:T}(O,K):s[O.level].func(O,K);if(G!==V&&G!==A||(O.status=666),G===w||G===V)return b.avail_out===0&&(O.last_flush=-1),h;if(G===T&&(K===1?a._tr_align(O):K!==5&&(a._tr_stored_block(O,0,0,!1),K===3&&(ne(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),z(b),b.avail_out===0))return O.last_flush=-1,h}return K!==p?h:O.wrap<=0?1:(O.wrap===2?(te(O,255&b.adler),te(O,b.adler>>8&255),te(O,b.adler>>16&255),te(O,b.adler>>24&255),te(O,255&b.total_in),te(O,b.total_in>>8&255),te(O,b.total_in>>16&255),te(O,b.total_in>>24&255)):(J(O,b.adler>>>16),J(O,65535&b.adler)),z(b),0=U.w_size&&(F===0&&(ne(U.head),U.strstart=0,U.block_start=0,U.insert=0),Q=new i.Buf8(U.w_size),i.arraySet(Q,K,re-U.w_size,U.w_size,0),K=Q,re=U.w_size),q=b.avail_in,G=b.next_in,L=b.input,b.avail_in=re,b.next_in=0,b.input=K,me(U);U.lookahead>=j;){for(O=U.strstart,S=U.lookahead-(j-1);U.ins_h=(U.ins_h<>>=j=N>>>24,_-=j,(j=N>>>16&255)===0)T[c++]=65535&N;else{if(!(16&j)){if(!(64&j)){N=x[(65535&N)+(g&(1<>>=j,_-=j),_<15&&(g+=w[l++]<<_,_+=8,g+=w[l++]<<_,_+=8),N=E[g&C];n:for(;;){if(g>>>=j=N>>>24,_-=j,!(16&(j=N>>>16&255))){if(!(64&j)){N=E[(65535&N)+(g&(1<>>=j,_-=j,(j=c-d)>3,g&=(1<<(_-=R<<3))-1,s.next_in=l,s.next_out=c,s.avail_in=l>>24&255)+(D>>>8&65280)+((65280&D)<<8)+((255&D)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(D){var M;return D&&D.state?(M=D.state,D.total_in=D.total_out=M.total=0,D.msg="",M.wrap&&(D.adler=1&M.wrap),M.mode=v,M.last=0,M.havedict=0,M.dmax=32768,M.head=null,M.hold=0,M.bits=0,M.lencode=M.lendyn=new s.Buf32(f),M.distcode=M.distdyn=new s.Buf32(m),M.sane=1,M.back=-1,p):h}function x(D){var M;return D&&D.state?((M=D.state).wsize=0,M.whave=0,M.wnext=0,_(D)):h}function E(D,M){var w,T;return D&&D.state?(T=D.state,M<0?(w=0,M=-M):(w=1+(M>>4),M<48&&(M&=15)),M&&(M<8||15=A.wsize?(s.arraySet(A.window,M,w-A.wsize,A.wsize,0),A.wnext=0,A.whave=A.wsize):(T<(V=A.wsize-A.wnext)&&(V=T),s.arraySet(A.window,M,w-T,V,A.wnext),(T-=V)?(s.arraySet(A.window,M,w-T,T,0),A.wnext=T,A.whave=A.wsize):(A.wnext+=V,A.wnext===A.wsize&&(A.wnext=0),A.whave>>8&255,w.check=a(w.check,F,2,0),B=z=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&z)<<8)+(z>>8))%31){D.msg="incorrect header check",w.mode=30;break}if((15&z)!=8){D.msg="unknown compression method",w.mode=30;break}if(B-=4,b=8+(15&(z>>>=4)),w.wbits===0)w.wbits=b;else if(b>w.wbits){D.msg="invalid window size",w.mode=30;break}w.dmax=1<>8&1),512&w.flags&&(F[0]=255&z,F[1]=z>>>8&255,w.check=a(w.check,F,2,0)),B=z=0,w.mode=3;case 3:for(;B<32;){if($===0)break e;$--,z+=T[A++]<>>8&255,F[2]=z>>>16&255,F[3]=z>>>24&255,w.check=a(w.check,F,4,0)),B=z=0,w.mode=4;case 4:for(;B<16;){if($===0)break e;$--,z+=T[A++]<>8),512&w.flags&&(F[0]=255&z,F[1]=z>>>8&255,w.check=a(w.check,F,2,0)),B=z=0,w.mode=5;case 5:if(1024&w.flags){for(;B<16;){if($===0)break e;$--,z+=T[A++]<>>8&255,w.check=a(w.check,F,2,0)),B=z=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&($<(Z=w.length)&&(Z=$),Z&&(w.head&&(b=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),s.arraySet(w.head.extra,T,A,Z,b)),512&w.flags&&(w.check=a(w.check,T,Z,A)),$-=Z,A+=Z,w.length-=Z),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if($===0)break e;for(Z=0;b=T[A+Z++],w.head&&b&&w.length<65536&&(w.head.name+=String.fromCharCode(b)),b&&Z<$;);if(512&w.flags&&(w.check=a(w.check,T,Z,A)),$-=Z,A+=Z,b)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if($===0)break e;for(Z=0;b=T[A+Z++],w.head&&b&&w.length<65536&&(w.head.comment+=String.fromCharCode(b)),b&&Z<$;);if(512&w.flags&&(w.check=a(w.check,T,Z,A)),$-=Z,A+=Z,b)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;B<16;){if($===0)break e;$--,z+=T[A++]<>9&1,w.head.done=!0),D.adler=w.check=0,w.mode=12;break;case 10:for(;B<32;){if($===0)break e;$--,z+=T[A++]<>>=7&B,B-=7&B,w.mode=27;break}for(;B<3;){if($===0)break e;$--,z+=T[A++]<>>=1)){case 0:w.mode=14;break;case 1:if(R(w),w.mode=20,M!==6)break;z>>>=2,B-=2;break e;case 2:w.mode=17;break;case 3:D.msg="invalid block type",w.mode=30}z>>>=2,B-=2;break;case 14:for(z>>>=7&B,B-=7&B;B<32;){if($===0)break e;$--,z+=T[A++]<>>16^65535)){D.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&z,B=z=0,w.mode=15,M===6)break e;case 15:w.mode=16;case 16:if(Z=w.length){if($>>=5,B-=5,w.ndist=1+(31&z),z>>>=5,B-=5,w.ncode=4+(15&z),z>>>=4,B-=4,286>>=3,B-=3}for(;w.have<19;)w.lens[q[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,U={bits:w.lenbits},K=u(0,w.lens,0,19,w.lencode,0,w.work,U),w.lenbits=U.bits,K){D.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have>>16&255,ke=65535&S,!((le=S>>>24)<=B);){if($===0)break e;$--,z+=T[A++]<>>=le,B-=le,w.lens[w.have++]=ke;else{if(ke===16){for(O=le+2;B>>=le,B-=le,w.have===0){D.msg="invalid bit length repeat",w.mode=30;break}b=w.lens[w.have-1],Z=3+(3&z),z>>>=2,B-=2}else if(ke===17){for(O=le+3;B>>=le)),z>>>=3,B-=3}else{for(O=le+7;B>>=le)),z>>>=7,B-=7}if(w.have+Z>w.nlen+w.ndist){D.msg="invalid bit length repeat",w.mode=30;break}for(;Z--;)w.lens[w.have++]=b}}if(w.mode===30)break;if(w.lens[256]===0){D.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,U={bits:w.lenbits},K=u(c,w.lens,0,w.nlen,w.lencode,0,w.work,U),w.lenbits=U.bits,K){D.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,U={bits:w.distbits},K=u(d,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,U),w.distbits=U.bits,K){D.msg="invalid distances set",w.mode=30;break}if(w.mode=20,M===6)break e;case 20:w.mode=21;case 21:if(6<=$&&258<=ne){D.next_out=X,D.avail_out=ne,D.next_in=A,D.avail_in=$,w.hold=z,w.bits=B,l(D,J),X=D.next_out,V=D.output,ne=D.avail_out,A=D.next_in,T=D.input,$=D.avail_in,z=w.hold,B=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;ue=(S=w.lencode[z&(1<>>16&255,ke=65535&S,!((le=S>>>24)<=B);){if($===0)break e;$--,z+=T[A++]<>ye)])>>>16&255,ke=65535&S,!(ye+(le=S>>>24)<=B);){if($===0)break e;$--,z+=T[A++]<>>=ye,B-=ye,w.back+=ye}if(z>>>=le,B-=le,w.back+=le,w.length=ke,ue===0){w.mode=26;break}if(32&ue){w.back=-1,w.mode=12;break}if(64&ue){D.msg="invalid literal/length code",w.mode=30;break}w.extra=15&ue,w.mode=22;case 22:if(w.extra){for(O=w.extra;B>>=w.extra,B-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;ue=(S=w.distcode[z&(1<>>16&255,ke=65535&S,!((le=S>>>24)<=B);){if($===0)break e;$--,z+=T[A++]<>ye)])>>>16&255,ke=65535&S,!(ye+(le=S>>>24)<=B);){if($===0)break e;$--,z+=T[A++]<>>=ye,B-=ye,w.back+=ye}if(z>>>=le,B-=le,w.back+=le,64&ue){D.msg="invalid distance code",w.mode=30;break}w.offset=ke,w.extra=15&ue,w.mode=24;case 24:if(w.extra){for(O=w.extra;B>>=w.extra,B-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){D.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(ne===0)break e;if(Z=J-ne,w.offset>Z){if((Z=w.offset-Z)>w.whave&&w.sane){D.msg="invalid distance too far back",w.mode=30;break}me=Z>w.wnext?(Z-=w.wnext,w.wsize-Z):w.wnext-Z,Z>w.length&&(Z=w.length),be=w.window}else be=V,me=X-w.offset,Z=w.length;for(neC?(j=me[be+m[M]],B[te+m[M]]):(j=96,0),g=1<>X)+(_-=g)]=N<<24|j<<16|R|0,_!==0;);for(g=1<>=1;if(g!==0?(z&=g-1,z+=g):z=0,M++,--J[D]==0){if(D===T)break;D=d[p+m[M]]}if(V>>7)]}function te(S,F){S.pending_buf[S.pending++]=255&F,S.pending_buf[S.pending++]=F>>>8&255}function J(S,F,q){S.bi_valid>y-q?(S.bi_buf|=F<>y-S.bi_valid,S.bi_valid+=q-y):(S.bi_buf|=F<>>=1,q<<=1,0<--F;);return q>>>1}function be(S,F,q){var G,L,Q=new Array(m+1),re=0;for(G=1;G<=m;G++)Q[G]=re=re+q[G-1]<<1;for(L=0;L<=F;L++){var ee=S[2*L+1];ee!==0&&(S[2*L]=me(Q[ee]++,ee))}}function le(S){var F;for(F=0;F>1;1<=q;q--)ye(S,Q,q);for(L=se;q=S.heap[1],S.heap[1]=S.heap[S.heap_len--],ye(S,Q,1),G=S.heap[1],S.heap[--S.heap_max]=q,S.heap[--S.heap_max]=G,Q[2*L]=Q[2*q]+Q[2*G],S.depth[L]=(S.depth[q]>=S.depth[G]?S.depth[q]:S.depth[G])+1,Q[2*q+1]=Q[2*G+1]=L,S.heap[1]=L++,ye(S,Q,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(he,Xe){var _n,it,xn,Pe,Qn,ao,pt=Xe.dyn_tree,qs=Xe.max_code,bl=Xe.stat_desc.static_tree,_l=Xe.stat_desc.has_stree,xl=Xe.stat_desc.extra_bits,Gs=Xe.stat_desc.extra_base,kn=Xe.stat_desc.max_length,er=0;for(Pe=0;Pe<=m;Pe++)he.bl_count[Pe]=0;for(pt[2*he.heap[he.heap_max]+1]=0,_n=he.heap_max+1;_n>=7;L>>=1)if(1&ve&&ee.dyn_ltree[2*se]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return a;for(se=32;se>>3,(Q=S.static_len+3+7>>>3)<=L&&(L=Q)):L=Q=q+5,q+4<=L&&F!==-1?O(S,F,q,G):S.strategy===4||Q===L?(J(S,2+(G?1:0),3),pe(S,W,D)):(J(S,4+(G?1:0),3),function(ee,se,ve,he){var Xe;for(J(ee,se-257,5),J(ee,ve-1,5),J(ee,he-4,4),Xe=0;Xe>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&F,S.pending_buf[S.l_buf+S.last_lit]=255&q,S.last_lit++,F===0?S.dyn_ltree[2*q]++:(S.matches++,F--,S.dyn_ltree[2*(w[q]+d+1)]++,S.dyn_dtree[2*B(F)]++),S.last_lit===S.lit_bufsize-1},o._tr_align=function(S){J(S,2,3),Z(S,_,W),function(F){F.bi_valid===16?(te(F,F.bi_buf),F.bi_buf=0,F.bi_valid=0):8<=F.bi_valid&&(F.pending_buf[F.pending++]=255&F.bi_buf,F.bi_buf>>=8,F.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(i,a){if(!i.setImmediate){var l,u,c,d,p=1,h={},v=!1,f=i.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(i);m=m&&m.setTimeout?m:i,l={}.toString.call(i.process)==="[object process]"?function(x){process.nextTick(function(){g(x)})}:function(){if(i.postMessage&&!i.importScripts){var x=!0,E=i.onmessage;return i.onmessage=function(){x=!1},i.postMessage("","*"),i.onmessage=E,x}}()?(d="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",_,!1):i.attachEvent("onmessage",_),function(x){i.postMessage(d+x,"*")}):i.MessageChannel?((c=new MessageChannel).port1.onmessage=function(x){g(x.data)},function(x){c.port2.postMessage(x)}):f&&"onreadystatechange"in f.createElement("script")?(u=f.documentElement,function(x){var E=f.createElement("script");E.onreadystatechange=function(){g(x),E.onreadystatechange=null,u.removeChild(E),E=null},u.appendChild(E)}):function(x){setTimeout(g,0,x)},m.setImmediate=function(x){typeof x!="function"&&(x=new Function(""+x));for(var E=new Array(arguments.length-1),I=0;I"u"?s===void 0?this:s:self)}).call(this,typeof tr<"u"?tr:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(wl);var jp=wl.exports;const Pp=Da(jp),Ap=async t=>{const e=`ComfyUI workspace workflows ${ll(Date.now())}`,n=new Pp,r=await(Y==null?void 0:Y.getSetting("twoWaySync"));for(const o of t){let s;r?s=o.parentFolderID??"":s=await yh(o.parentFolderID??null).then(async a=>Ft(a??""));const i=n.folder(s);i==null||i.file(`${o.name}.json`,o.json)}n.generateAsync({type:"blob"}).then(function(o){const s=document.createElement("a");s.href=window.URL.createObjectURL(o),s.download=`${e}.zip`,document.body.appendChild(s),s.click(),document.body.removeChild(s)})};function Np({myWorkflowsDir:t}){return k.jsxs($e,{gap:3,children:[k.jsx(un,{size:"md",children:"πŸ¦„ Upgrade to 2.0 - enable two way sync!"}),k.jsx("p",{children:"Your workflows will be synced to and from path:"}),k.jsx("p",{children:k.jsx("b",{children:t})}),k.jsxs("p",{children:["You can manually put workflow files into this folder using File Explorer to sync them with your workspace. You can change this path anytime in Settings ",">"," Workspace Save Directory"]}),k.jsxs("p",{children:[k.jsx("b",{children:"Please download all your workflows before enabling two way sync as a backup!"})," ","So you can manually import some workflows into your workspace in case something unexpected happens."]}),k.jsx(Te,{colorScheme:"teal",variant:"outline",width:"fit-content",onClick:async()=>{const e=await(H==null?void 0:H.listAll());Ap(e??[])},children:"πŸ‘‰ Download All My Workflows"})]})}const Fp=Ra.lazy(()=>Tt(()=>import("./RecentFilesDrawer-1UN8MLmu.js"),__vite__mapDeps([14,1,8,3,13,15,12,4]))),Rp=Ra.lazy(()=>Tt(()=>import("./GalleryModal-jtg03Tte.js"),__vite__mapDeps([16,1,15,12,9,8,3,2])));function Tp(){const[t,e]=P.useState(null),[n,r]=P.useState("root"),[o,s]=P.useState(!0),[i,a]=P.useState(null),l=P.useRef(null),[u,c]=P.useState(!1),d=P.useRef(null),{showDialog:p}=Fa(),[h,v]=P.useState(!1);P.useRef(!1);const f=Ma(),[m,y]=Dp(null),g=P.useCallback(async(w=!1)=>{var V,A;const T=H==null?void 0:H.curWorkflow;if(T){if(!w&&((V=H==null?void 0:H.curWorkflow)!=null&&V.saveLock)){f({title:"The workflow is locked and cannot be saved",status:"warning",duration:3e3});return}const X=JSON.stringify(we.graph.serialize());await Promise.all([H==null?void 0:H.updateFlow(T.id,{json:X}),Ge==null?void 0:Ge.create({workflowID:T.id,json:X,isAutoSave:!1})]),(A=Y==null?void 0:Y.settings)!=null&&A.autoSave&&f({title:"Saved",status:"success",duration:1e3,isClosable:!0}),c(!1)}},[]),_=async()=>{var T,V,A;if((T=Y==null?void 0:Y.settings)!=null&&T.autoSave){alert("You cannot discard unsaved changes when auto save is enabled");return}if(confirm("Are you sure you want to discard unsaved changes? This will revert current workflow to your last saved version. You will lose all changes made since your last save.")){const X=(V=H==null?void 0:H.curWorkflow)==null?void 0:V.id;if(X==null)return;const $=(A=await(H==null?void 0:H.get(X)))==null?void 0:A.json;$?(H==null||H.updateCurWorkflow({...H.curWorkflow,json:$}),await we.loadGraphData(JSON.parse($)),c(!1)):alert("Error: No last saved version found")}},x=w=>{const T=(w==null?void 0:w.id)??null;if(H==null||H.updateCurWorkflow(w),l.current=T,a(T),e((w==null?void 0:w.name)??""),T==null){document.title="ComfyUI",window.location.hash="",localStorage.removeItem("curFlowID");return}if(Ca()){const V=cl(T);window.location.hash=V,document.title=w.name+" - ComfyUI"}else localStorage.setItem("curFlowID",T),document.title="ComfyUI - "+w.name;w&&(H==null||H.updateLastOpenedTime(w.id))},E=async()=>{var V,A;localStorage.removeItem("workspace"),localStorage.removeItem("comfyspace");try{await Dh()}catch(X){console.error("error loading db",X)}s(!1);const w=Ca();if(w==null){const X=localStorage.getItem("workflow");if(X){const ne=(A=(V=JSON.parse(X).extra)==null?void 0:V[We])==null?void 0:A.id;if(ne){const z=await(H==null?void 0:H.get(ne));z&&x(z),z&&z.json!=X&&c(!0)}}}else I(w);Ee("/workspace/deduplicate_workflow_ids"),!await(Y==null?void 0:Y.getSetting("twoWaySync"))&&ie.cache.get(_o).then(async X=>{if((X==null?void 0:X.value)!=="true"){if(await ie.workflows.count()==0){await(Y==null?void 0:Y.upsert({twoWaySync:!0})),await ie.cache.put({id:_o,value:"true"});return}const ne=await(Y==null?void 0:Y.getSetting("myWorkflowsDir"));p(k.jsx(Np,{myWorkflowsDir:ne??"undefined"}),[{label:"I have downloaded all my workflows and ready to enable",onClick:async()=>{await(Y==null?void 0:Y.upsert({twoWaySync:!0})),await(Y==null?void 0:Y.getSetting("twoWaySync"))&&(ie.cache.put({id:_o,value:"true"}),location.reload())},colorScheme:"red"}],{closeOnOverlayClick:!1})}})},I=async(w,T)=>{if(we.graph==null)return;const V=await(H==null?void 0:H.get(w));if(V==null){alert("Error: Workflow not found! id: "+w),x(null);return}const A=T?await(ge==null?void 0:ge.get(T)):null;we.ui.dialog.close(),A?(y(A),x({...V,json:A.json}),we.loadGraphData(JSON.parse(A.json))):(x(V),y(null),we.loadGraphData(JSON.parse(V.json))),r("root"),u&&c(!1)},C=async(w,T,V=!1)=>{var A;if(w===null){x(null),we.graph.clear();return}if(!u||V||(A=Y==null?void 0:Y.settings)!=null&&A.autoSave||(H==null?void 0:H.curWorkflow)==null){I(w,T);return}N(w)},N=async w=>{var V;const T=[w?{label:"Open in new tab",icon:k.jsx(pl,{}),onClick:()=>{hh(w)}}:null,{label:"Save",colorScheme:"teal",onClick:async()=>{await g(),w&&I(w)}}];T.push({label:"Discard",colorScheme:"red",onClick:async()=>{w&&I(w)}}),p(`Please save or discard your changes to "${(V=H==null?void 0:H.curWorkflow)==null?void 0:V.name}" before leaving, or your changes will be lost.`,T)},j=async w=>{const T=(w==null?void 0:w.json)??JSON.stringify(ul),V=await(H==null?void 0:H.createFlow({json:T,name:w==null?void 0:w.name}));V&&await C(V.id),r("root")},R=async(w,T=!1)=>{const V=w.split("/").pop()??w;T?g():j({name:V});const A=await fetch(fh(w)),X=await A.blob(),$=new File([X],V,{type:A.headers.get("Content-Type")||""});await we.handleFile($),r("root")},W=async(w,T)=>{const V=await(H==null?void 0:H.get(w));if(V==null)return;const A=await(H==null?void 0:H.createFlow({json:V.json,name:T||V.name,parentFolderID:V.parentFolderID,tags:V.tags}));A&&await C(A.id)},D=P.useCallback(w=>{if(l.current==null)return;let T=w.filename;w.subfolder!=null&&w.subfolder!==""&&(T=w.subfolder+"/"+T),qt==null||qt.create({workflowID:l.current,localPath:T})},[]),M=P.useCallback(()=>{r("root")},[]);return P.useEffect(()=>{E(),v(!0);const w=T=>{var V,A,X,$,ne,z;(X=(A=(V=T.detail)==null?void 0:V.output)==null?void 0:A.images)==null||X.forEach(B=>{B.type==="output"&&D(B)}),(z=(ne=($=T.detail)==null?void 0:$.output)==null?void 0:ne.gifs)==null||z.forEach(B=>{B.type==="output"&&D(B)})};return Or.addEventListener("executed",w),()=>{window.removeEventListener("executed",w)}},[]),o?null:k.jsx(at.Provider,{value:{curFlowID:i,onDuplicateWorkflow:W,loadWorkflowID:C,discardUnsavedChanges:_,saveCurWorkflow:g,isDirty:u,setIsDirty:c,loadNewWorkflow:j,loadFilePath:R,setRoute:r,route:n,curVersion:m,setCurVersion:y,setCurFlowIDAndName:x},children:k.jsx("div",{ref:d,className:"workspace_manager",children:k.jsxs(Aa,{containerRef:d,children:[k.jsxs(jt,{style:{position:"absolute",top:0,right:0,left:0},zIndex:mh,draggable:!1,children:[k.jsx(Cp,{curFlowName:t,setCurFlowName:e}),h&&n==="recentFlows"&&k.jsx(P.Suspense,{children:k.jsx(Fp,{onClose:M,onClickNewFlow:()=>{j(),r("root")}})}),n==="gallery"&&k.jsx(P.Suspense,{children:k.jsx(Rp,{onclose:()=>r("root")})})]}),k.jsx(Sp,{})]})})})}const dm=Object.freeze(Object.defineProperty({__proto__:null,default:Tp},Symbol.toStringTag,{value:"Module"}));export{hh as $,zh as A,jt as B,Gp as C,tp as D,ah as E,Ut as F,Wh as G,ot as H,cn as I,bh as J,Le as K,Jr as L,yi as M,Qr as N,Xr as O,Vh as P,Gh as Q,rm as R,Ed as S,mn as T,ul as U,Qp as V,xr as W,Oh as X,qp as Y,at as Z,pl as _,Wp as a,ml as a0,Ee as a1,qt as a2,ll as a3,ut as a4,we as a5,sc as a6,mh as a7,Kp as a8,kr as a9,vi as aA,xi as aB,bi as aC,sm as aD,Dp as aE,Sh as aF,em as aG,om as aH,$s as aI,gs as aJ,lm as aK,Qa as aL,up as aM,ge as aN,im as aO,cm as aP,mp as aQ,um as aR,oc as aS,dm as aT,Zp as aa,La as ab,hc as ac,Jp as ad,Wa as ae,Ch as af,un as ag,on as ah,pc as ai,We as aj,Xp as ak,Yp as al,Ge as am,Kl as an,Zn as ao,Ps as ap,ie as aq,am as ar,uf as as,tm as at,nm as au,$p as av,Or as aw,Hp as ax,Nc as ay,gi as az,zp as b,Lp as c,Ae as d,Jh as e,Ma as f,$e as g,wt as h,kt as i,gn as j,Y as k,Np as l,Fc as m,cf as n,Up as o,Vp as p,Oo as q,Ds as r,js as s,Cr as t,to as u,Ct as v,Lh as w,H as x,ep as y,Ap as z}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["workspace_web/ShareDialog-JZBcdRgg.js","workspace_web/input.js","workspace_web/chunk-VTV6N5LE-CPEmZVmx.js","workspace_web/chunk-7D6N5TE5-NbopAz8o.js","workspace_web/IconCopy-NWmMWcgf.js","workspace_web/AppIsDirtyEventListener-BhFgpj_t.js","workspace_web/useDebounceFn-ld478fd0.js","workspace_web/ModelManagerTopbar-F18nYkv6.js","workspace_web/chunk-JARCRF6W-r8MNagok.js","workspace_web/chunk-3RSXBRAN-2SG_K1_B.js","workspace_web/assets/ModelManagerTopbar--iv3sdjQ.css","workspace_web/SpotlightSearch-S3ZkRF9c.js","workspace_web/IconSearch-fViKszW1.js","workspace_web/chunk-NTCQBYKE-Wk1_Xkg6.js","workspace_web/RecentFilesDrawer-YqesR0Z_.js","workspace_web/MediaPreview-j_Hhr-lH.js","workspace_web/GalleryModal-6F7A8gNl.js"] + __vite__mapDeps.viteFileDeps = ["workspace_web/ShareDialog-LtEf88VA.js","workspace_web/input.js","workspace_web/chunk-VTV6N5LE-x5KZOIPv.js","workspace_web/chunk-7D6N5TE5-zfYf6Y9A.js","workspace_web/IconCopy-HLdZF5TO.js","workspace_web/AppIsDirtyEventListener-fMS1pxlr.js","workspace_web/useDebounceFn-ld478fd0.js","workspace_web/ModelManagerTopbar-xV84Rv4k.js","workspace_web/chunk-JARCRF6W-ibNbyhHV.js","workspace_web/chunk-3RSXBRAN-D3gE_K4K.js","workspace_web/assets/ModelManagerTopbar--iv3sdjQ.css","workspace_web/SpotlightSearch-CjlPIPLI.js","workspace_web/IconSearch-E56kR4uG.js","workspace_web/chunk-NTCQBYKE-rUyqBIyd.js","workspace_web/RecentFilesDrawer-1UN8MLmu.js","workspace_web/MediaPreview-TJpk-on-.js","workspace_web/GalleryModal-jtg03Tte.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/workspace_web/AppIsDirtyEventListener-BhFgpj_t.js b/dist/workspace_web/AppIsDirtyEventListener-fMS1pxlr.js similarity index 97% rename from dist/workspace_web/AppIsDirtyEventListener-BhFgpj_t.js rename to dist/workspace_web/AppIsDirtyEventListener-fMS1pxlr.js index 93f161b..85e7f67 100644 --- a/dist/workspace_web/AppIsDirtyEventListener-BhFgpj_t.js +++ b/dist/workspace_web/AppIsDirtyEventListener-fMS1pxlr.js @@ -1 +1 @@ -import{r as u,j as E}from"./input.js";import{Z as x,a5 as r,aj as C,x as a,i as W,T as j,E as d,ak as A,al as L,k as h,am as R}from"./App-6SVuhhTl.js";import{u as O}from"./useDebounceFn-ld478fd0.js";function M(){const{isDirty:p,setIsDirty:g,setRoute:v,saveCurWorkflow:T,setCurFlowIDAndName:b}=u.useContext(x),w=u.useRef(p),[S,D]=u.useState(!1),k=u.useRef(null);u.useEffect(()=>{w.current=p},[p]),u.useEffect(()=>{var n,i;const c=e=>{var s;if(document.visibilityState==="hidden")return;const t=L(e);if(t)switch(t===d.openSpotlightSearch&&e.preventDefault(),window.dispatchEvent(new CustomEvent(A,{detail:{shortcutType:t}})),t){case d.SAVE:T();break;case d.SAVE_AS:v("saveAsModal");break;case d.openSpotlightSearch:v("spotlightSearch");break}else(s=e.target)!=null&&s.matches("input, textarea")&&Object.keys(r.canvas.selected_nodes??{}).length&&m()},o=r.graph.onConfigure;return r.graph.onConfigure=function(){o==null||o.apply(this,arguments),setTimeout(()=>{var t,s,l,f;const e=(s=(t=r.graph.extra)==null?void 0:t[C])==null?void 0:s.id;(e==null||e!=((f=(l=a)==null?void 0:l.curWorkflow)==null?void 0:f.id))&&b(null)},500)},document.addEventListener("click",e=>{Object.keys(r.canvas.selected_nodes??{}).length&&(r.canvas.node_over!=null||r.canvas.node_capturing_input!=null||r.canvas.node_widget!=null)&&m()}),document.addEventListener("keydown",c),(i=(n=h)==null?void 0:n.settings)!=null&&i.autoSave&&h.settings.autoSaveDuration&&(k.current=setInterval(()=>{_()},h.settings.autoSaveDuration*1e3)),()=>{document.removeEventListener("keydown",c),k.current&&clearInterval(k.current)}},[]);const _=async()=>{var o,n,i,e,t,s;if((n=(o=a)==null?void 0:o.curWorkflow)!=null&&n.saveLock||!((e=(i=a)==null?void 0:i.curWorkflow)!=null&&e.id)||!w.current)return;const c=JSON.stringify(r.graph.serialize());await((t=a)==null?void 0:t.updateFlow(a.curWorkflow.id,{json:c})),(s=R)==null||s.create({workflowID:a.curWorkflow.id,isAutoSave:!0,json:c}),g(!1)},I=async()=>{var o,n,i,e,t,s,l,f,y;if((n=(o=a)==null?void 0:o.curWorkflow)!=null&&n.saveLock||w.current)return;const c=r.graph.serialize();JSON.stringify(c)!==((e=(i=a)==null?void 0:i.curWorkflow)==null?void 0:e.json)&&(g(!0),(s=(t=h)==null?void 0:t.settings)!=null&&s.autoSave&&((f=(l=a)==null?void 0:l.curWorkflow)!=null&&f.id)&&!S&&(await((y=a)==null?void 0:y.latestVersionCheck())||D(!0)))},[m,N]=O(I,900);return S?E.jsx(W,{label:"This workflow was changed by another tab, so you are not working on the latest version. Please refresh page to see the latest version of this workflow.",children:E.jsx(j,{colorScheme:"yellow",children:"⚠️Outdated version"})}):null}export{M as default}; +import{r as u,j as E}from"./input.js";import{Z as x,a5 as r,aj as C,x as a,i as W,T as j,E as d,ak as A,al as L,k as h,am as R}from"./App-4M5AgwD2.js";import{u as O}from"./useDebounceFn-ld478fd0.js";function M(){const{isDirty:p,setIsDirty:g,setRoute:v,saveCurWorkflow:T,setCurFlowIDAndName:b}=u.useContext(x),w=u.useRef(p),[S,D]=u.useState(!1),k=u.useRef(null);u.useEffect(()=>{w.current=p},[p]),u.useEffect(()=>{var n,i;const c=e=>{var s;if(document.visibilityState==="hidden")return;const t=L(e);if(t)switch(t===d.openSpotlightSearch&&e.preventDefault(),window.dispatchEvent(new CustomEvent(A,{detail:{shortcutType:t}})),t){case d.SAVE:T();break;case d.SAVE_AS:v("saveAsModal");break;case d.openSpotlightSearch:v("spotlightSearch");break}else(s=e.target)!=null&&s.matches("input, textarea")&&Object.keys(r.canvas.selected_nodes??{}).length&&m()},o=r.graph.onConfigure;return r.graph.onConfigure=function(){o==null||o.apply(this,arguments),setTimeout(()=>{var t,s,l,f;const e=(s=(t=r.graph.extra)==null?void 0:t[C])==null?void 0:s.id;(e==null||e!=((f=(l=a)==null?void 0:l.curWorkflow)==null?void 0:f.id))&&b(null)},500)},document.addEventListener("click",e=>{Object.keys(r.canvas.selected_nodes??{}).length&&(r.canvas.node_over!=null||r.canvas.node_capturing_input!=null||r.canvas.node_widget!=null)&&m()}),document.addEventListener("keydown",c),(i=(n=h)==null?void 0:n.settings)!=null&&i.autoSave&&h.settings.autoSaveDuration&&(k.current=setInterval(()=>{_()},h.settings.autoSaveDuration*1e3)),()=>{document.removeEventListener("keydown",c),k.current&&clearInterval(k.current)}},[]);const _=async()=>{var o,n,i,e,t,s;if((n=(o=a)==null?void 0:o.curWorkflow)!=null&&n.saveLock||!((e=(i=a)==null?void 0:i.curWorkflow)!=null&&e.id)||!w.current)return;const c=JSON.stringify(r.graph.serialize());await((t=a)==null?void 0:t.updateFlow(a.curWorkflow.id,{json:c})),(s=R)==null||s.create({workflowID:a.curWorkflow.id,isAutoSave:!0,json:c}),g(!1)},I=async()=>{var o,n,i,e,t,s,l,f,y;if((n=(o=a)==null?void 0:o.curWorkflow)!=null&&n.saveLock||w.current)return;const c=r.graph.serialize();JSON.stringify(c)!==((e=(i=a)==null?void 0:i.curWorkflow)==null?void 0:e.json)&&(g(!0),(s=(t=h)==null?void 0:t.settings)!=null&&s.autoSave&&((f=(l=a)==null?void 0:l.curWorkflow)!=null&&f.id)&&!S&&(await((y=a)==null?void 0:y.latestVersionCheck())||D(!0)))},[m,N]=O(I,900);return S?E.jsx(W,{label:"This workflow was changed by another tab, so you are not working on the latest version. Please refresh page to see the latest version of this workflow.",children:E.jsx(j,{colorScheme:"yellow",children:"⚠️Outdated version"})}):null}export{M as default}; diff --git a/dist/workspace_web/GalleryModal-6F7A8gNl.js b/dist/workspace_web/GalleryModal-jtg03Tte.js similarity index 98% rename from dist/workspace_web/GalleryModal-6F7A8gNl.js rename to dist/workspace_web/GalleryModal-jtg03Tte.js index edb124c..7572c1a 100644 --- a/dist/workspace_web/GalleryModal-6F7A8gNl.js +++ b/dist/workspace_web/GalleryModal-jtg03Tte.js @@ -1 +1 @@ -import{r as d,d as Se,y as Ht,m as be,b as it,f as L,l as Kt,o as ct,E as Wt,j as r,g as O,p as Yt,h as Xt,W as ut,i as dt,M as Zt,N as qt,O as Jt,Q as Qt,R as en,S as tn}from"./input.js";import{ab as nn,ac as sn,d as Re,F as p,ad as rn,ae as on,I as M,j as an,g as Ee,B as ht,h as W,Z as oe,af as ln,a5 as tt,x as R,H as Y,i as A,w as ft,a3 as xt,e as gt,a2 as F,ag as cn,y as un}from"./App-6SVuhhTl.js";import{c as je,p as dn,r as nt,v as st,I as hn,N as fn,a as xn,b as gn,d as mn,e as pn,M as mt,u as vn,S as yn}from"./MediaPreview-j_Hhr-lH.js";import{S as wn}from"./chunk-3RSXBRAN-2SG_K1_B.js";import{C as Ae,G as Sn}from"./chunk-JARCRF6W-r8MNagok.js";import{S as rt,L as Ne}from"./chunk-VTV6N5LE-CPEmZVmx.js";import"./IconSearch-fViKszW1.js";import"./chunk-7D6N5TE5-NbopAz8o.js";const pt=1/60*1e3,bn=typeof performance<"u"?()=>performance.now():()=>Date.now(),vt=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(bn()),pt);function jn(e){let t=[],s=[],n=0,o=!1,a=!1;const l=new WeakSet,c={schedule:(i,u=!1,g=!1)=>{const f=g&&o,v=f?t:s;return u&&l.add(i),v.indexOf(i)===-1&&(v.push(i),f&&o&&(n=t.length)),i},cancel:i=>{const u=s.indexOf(i);u!==-1&&s.splice(u,1),l.delete(i)},process:i=>{if(o){a=!0;return}if(o=!0,[t,s]=[s,t],s.length=0,n=t.length,n)for(let u=0;u(e[t]=jn(()=>X=!0),e),{}),Pn=Z.reduce((e,t)=>{const s=ae[t];return e[t]=(n,o=!1,a=!1)=>(X||Tn(),s.schedule(n,o,a)),e},{}),Cn=Z.reduce((e,t)=>(e[t]=ae[t].cancel,e),{});Z.reduce((e,t)=>(e[t]=()=>ae[t].process(B),e),{});const In=e=>ae[e].process(B),yt=e=>{X=!1,B.delta=Me?pt:Math.max(Math.min(e-B.timestamp,kn),1),B.timestamp=e,De=!0,Z.forEach(In),De=!1,X&&(Me=!1,vt(yt))},Tn=()=>{X=!0,Me=!0,De||vt(yt)},ot=()=>B;var V=e=>e?"":void 0,ke=e=>e?!0:void 0,q=(...e)=>e.filter(Boolean).join(" ");function Pe(...e){return function(s){e.some(n=>(n==null||n(s),s==null?void 0:s.defaultPrevented))}}function Q(e){const{orientation:t,vertical:s,horizontal:n}=e;return t==="vertical"?s:n}var te={width:0,height:0},ee=e=>e||te;function En(e){const{orientation:t,thumbPercents:s,thumbRects:n,isReversed:o}=e,a=y=>{var w;const E=(w=n[y])!=null?w:te;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Q({orientation:t,vertical:{bottom:`calc(${s[y]}% - ${E.height/2}px)`},horizontal:{left:`calc(${s[y]}% - ${E.width/2}px)`}})}},l=t==="vertical"?n.reduce((y,w)=>ee(y).height>ee(w).height?y:w,te):n.reduce((y,w)=>ee(y).width>ee(w).width?y:w,te),c={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Q({orientation:t,vertical:l?{paddingLeft:l.width/2,paddingRight:l.width/2}:{},horizontal:l?{paddingTop:l.height/2,paddingBottom:l.height/2}:{}})},i={position:"absolute",...Q({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},u=s.length===1,g=[0,o?100-s[0]:s[0]],f=u?g:s;let v=f[0];!u&&o&&(v=100-v);const m=Math.abs(f[f.length-1]-f[0]),I={...i,...Q({orientation:t,vertical:o?{height:`${m}%`,top:`${v}%`}:{height:`${m}%`,bottom:`${v}%`},horizontal:o?{width:`${m}%`,right:`${v}%`}:{width:`${m}%`,left:`${v}%`}})};return{trackStyle:i,innerTrackStyle:I,rootStyle:c,getThumbStyle:a}}function Nn(e){const{isReversed:t,direction:s,orientation:n}=e;return s==="ltr"||n==="vertical"?t:!t}function Mn(e,t,s,n){return e.addEventListener(t,s,n),()=>{e.removeEventListener(t,s,n)}}function Dn(e){const t=zn(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function wt(e){return!!e.touches}function _n(e){return wt(e)&&e.touches.length>1}function zn(e){var t;return(t=e.view)!=null?t:window}function Rn(e,t="page"){const s=e.touches[0]||e.changedTouches[0];return{x:s[`${t}X`],y:s[`${t}Y`]}}function An(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function St(e,t="page"){return wt(e)?Rn(e,t):An(e,t)}function Fn(e){return t=>{const s=Dn(t);(!s||s&&t.button===0)&&e(t)}}function $n(e,t=!1){function s(o){e(o,{point:St(o)})}return t?Fn(s):s}function ne(e,t,s,n){return Mn(e,t,$n(s,t==="pointerdown"),n)}var Vn=Object.defineProperty,Bn=(e,t,s)=>t in e?Vn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,T=(e,t,s)=>(Bn(e,typeof t!="symbol"?t+"":t,s),s),Ln=class{constructor(e,t,s){T(this,"history",[]),T(this,"startEvent",null),T(this,"lastEvent",null),T(this,"lastEventInfo",null),T(this,"handlers",{}),T(this,"removeListeners",()=>{}),T(this,"threshold",3),T(this,"win"),T(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const c=Ce(this.lastEventInfo,this.history),i=this.startEvent!==null,u=Hn(c.offset,{x:0,y:0})>=this.threshold;if(!i&&!u)return;const{timestamp:g}=ot();this.history.push({...c.point,timestamp:g});const{onStart:f,onMove:v}=this.handlers;i||(f==null||f(this.lastEvent,c),this.startEvent=this.lastEvent),v==null||v(this.lastEvent,c)}),T(this,"onPointerMove",(c,i)=>{this.lastEvent=c,this.lastEventInfo=i,Pn.update(this.updatePoint,!0)}),T(this,"onPointerUp",(c,i)=>{const u=Ce(i,this.history),{onEnd:g,onSessionEnd:f}=this.handlers;f==null||f(c,u),this.end(),!(!g||!this.startEvent)&&(g==null||g(c,u))});var n;if(this.win=(n=e.view)!=null?n:window,_n(e))return;this.handlers=t,s&&(this.threshold=s),e.stopPropagation(),e.preventDefault();const o={point:St(e)},{timestamp:a}=ot();this.history=[{...o.point,timestamp:a}];const{onSessionStart:l}=t;l==null||l(e,Ce(o,this.history)),this.removeListeners=Un(ne(this.win,"pointermove",this.onPointerMove),ne(this.win,"pointerup",this.onPointerUp),ne(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),Cn.update(this.updatePoint)}};function at(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ce(e,t){return{point:e.point,delta:at(e.point,t[t.length-1]),offset:at(e.point,t[0]),velocity:Gn(t,.1)}}var On=e=>e*1e3;function Gn(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,n=null;const o=e[e.length-1];for(;s>=0&&(n=e[s],!(o.timestamp-n.timestamp>On(t)));)s--;if(!n)return{x:0,y:0};const a=(o.timestamp-n.timestamp)/1e3;if(a===0)return{x:0,y:0};const l={x:(o.x-n.x)/a,y:(o.y-n.y)/a};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function Un(...e){return t=>e.reduce((s,n)=>n(s),t)}function Ie(e,t){return Math.abs(e-t)}function lt(e){return"x"in e&&"y"in e}function Hn(e,t){if(typeof e=="number"&&typeof t=="number")return Ie(e,t);if(lt(e)&<(t)){const s=Ie(e.x,t.x),n=Ie(e.y,t.y);return Math.sqrt(s**2+n**2)}return 0}function bt(e){const t=d.useRef(null);return t.current=e,t}function Kn(e,t){const{onPan:s,onPanStart:n,onPanEnd:o,onPanSessionStart:a,onPanSessionEnd:l,threshold:c}=t,i=!!(s||n||o||a||l),u=d.useRef(null),g=bt({onSessionStart:a,onSessionEnd:l,onStart:n,onMove:s,onEnd(f,v){u.current=null,o==null||o(f,v)}});d.useEffect(()=>{var f;(f=u.current)==null||f.updateHandlers(g.current)}),d.useEffect(()=>{const f=e.current;if(!f||!i)return;function v(m){u.current=new Ln(m,g.current,c)}return ne(f,"pointerdown",v)},[e,i,g,c]),d.useEffect(()=>()=>{var f;(f=u.current)==null||f.end(),u.current=null},[])}function Wn(e,t){if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const s=e.ownerDocument.defaultView??window,n=new s.ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const[a]=o;let l,c;if("borderBoxSize"in a){const i=a.borderBoxSize,u=Array.isArray(i)?i[0]:i;l=u.inlineSize,c=u.blockSize}else l=e.offsetWidth,c=e.offsetHeight;t({width:l,height:c})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}var Yn=globalThis!=null&&globalThis.document?d.useLayoutEffect:d.useEffect;function Xn(e,t){var s,n;if(!e||!e.parentElement)return;const o=(n=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?n:window,a=new o.MutationObserver(()=>{t()});return a.observe(e.parentElement,{childList:!0}),()=>{a.disconnect()}}function Zn({getNodes:e,observeMutation:t=!0}){const[s,n]=d.useState([]),[o,a]=d.useState(0);return Yn(()=>{const l=e(),c=l.map((i,u)=>Wn(i,g=>{n(f=>[...f.slice(0,u),g,...f.slice(u+1)])}));if(t){const i=l[0];c.push(Xn(i,()=>{a(u=>u+1)}))}return()=>{c.forEach(i=>{i==null||i()})}},[o]),s}function qn(e){return typeof e=="object"&&e!==null&&"current"in e}function Jn(e){const[t]=Zn({observeMutation:!1,getNodes(){return[qn(e)?e.current:e]}});return t}function Qn(e){var t;const{min:s=0,max:n=100,onChange:o,value:a,defaultValue:l,isReversed:c,direction:i="ltr",orientation:u="horizontal",id:g,isDisabled:f,isReadOnly:v,onChangeStart:m,onChangeEnd:I,step:y=1,getAriaValueText:w,"aria-valuetext":E,"aria-label":$,"aria-labelledby":b,name:D,focusThumbOnChange:Mt=!0,...Fe}=e,$e=Se(m),G=Se(I),Ve=Se(w),C=Nn({isReversed:c,direction:i,orientation:u}),[Dt,de]=nn({value:a,defaultValue:l??ts(s,n),onChange:o}),[he,Be]=d.useState(!1),[fe,Le]=d.useState(!1),xe=!(f||v),ge=(n-s)/10,U=y||(n-s)/100,S=je(Dt,s,n),_t=n-S+s,Oe=st(C?_t:S,s,n),J=u==="vertical",j=bt({min:s,max:n,step:y,isDisabled:f,value:S,isInteractive:xe,isReversed:C,isVertical:J,eventSource:null,focusThumbOnChange:Mt,orientation:u}),me=d.useRef(null),pe=d.useRef(null),Ge=d.useRef(null),zt=d.useId(),Ue=g??zt,[He,Ke]=[`slider-thumb-${Ue}`,`slider-track-${Ue}`],Rt=d.useCallback(h=>{var x,H;if(!me.current)return;const k=j.current;k.eventSource="pointer";const N=me.current.getBoundingClientRect(),{clientX:ye,clientY:Ot}=(H=(x=h.touches)==null?void 0:x[0])!=null?H:h,Gt=J?N.bottom-Ot:ye-N.left,Ut=J?N.height:N.width;let we=Gt/Ut;C&&(we=1-we);let K=dn(we,k.min,k.max);return k.step&&(K=parseFloat(nt(K,k.min,k.step))),K=je(K,k.min,k.max),K},[J,C,j]),_=d.useCallback(h=>{const x=j.current;x.isInteractive&&(h=parseFloat(nt(h,x.min,U)),h=je(h,x.min,x.max),de(h))},[U,de,j]),z=d.useMemo(()=>({stepUp(h=U){const x=C?S-h:S+h;_(x)},stepDown(h=U){const x=C?S+h:S-h;_(x)},reset(){_(l||0)},stepTo(h){_(h)}}),[_,C,S,U,l]),We=d.useCallback(h=>{const x=j.current,k={ArrowRight:()=>z.stepUp(),ArrowUp:()=>z.stepUp(),ArrowLeft:()=>z.stepDown(),ArrowDown:()=>z.stepDown(),PageUp:()=>z.stepUp(ge),PageDown:()=>z.stepDown(ge),Home:()=>_(x.min),End:()=>_(x.max)}[h.key];k&&(h.preventDefault(),h.stopPropagation(),k(h),x.eventSource="keyboard")},[z,_,ge,j]),Ye=(t=Ve==null?void 0:Ve(S))!=null?t:E,ve=Jn(pe),{getThumbStyle:Xe,rootStyle:Ze,trackStyle:qe,innerTrackStyle:Je}=d.useMemo(()=>{const h=j.current,x=ve??{width:0,height:0};return En({isReversed:C,orientation:h.orientation,thumbRects:[x],thumbPercents:[Oe]})},[C,ve,Oe,j]),Qe=d.useCallback(()=>{j.current.focusThumbOnChange&&setTimeout(()=>{var x;return(x=pe.current)==null?void 0:x.focus()})},[j]);Ht(()=>{const h=j.current;Qe(),h.eventSource==="keyboard"&&(G==null||G(h.value))},[S,G]);function et(h){const x=Rt(h);x!=null&&x!==j.current.value&&de(x)}Kn(Ge,{onPanSessionStart(h){const x=j.current;x.isInteractive&&(Be(!0),Qe(),et(h),$e==null||$e(x.value))},onPanSessionEnd(){const h=j.current;h.isInteractive&&(Be(!1),G==null||G(h.value))},onPan(h){j.current.isInteractive&&et(h)}});const At=d.useCallback((h={},x=null)=>({...h,...Fe,ref:be(x,Ge),tabIndex:-1,"aria-disabled":ke(f),"data-focused":V(fe),style:{...h.style,...Ze}}),[Fe,f,fe,Ze]),Ft=d.useCallback((h={},x=null)=>({...h,ref:be(x,me),id:Ke,"data-disabled":V(f),style:{...h.style,...qe}}),[f,Ke,qe]),$t=d.useCallback((h={},x=null)=>({...h,ref:x,style:{...h.style,...Je}}),[Je]),Vt=d.useCallback((h={},x=null)=>({...h,ref:be(x,pe),role:"slider",tabIndex:xe?0:void 0,id:He,"data-active":V(he),"aria-valuetext":Ye,"aria-valuemin":s,"aria-valuemax":n,"aria-valuenow":S,"aria-orientation":u,"aria-disabled":ke(f),"aria-readonly":ke(v),"aria-label":$,"aria-labelledby":$?void 0:b,style:{...h.style,...Xe(0)},onKeyDown:Pe(h.onKeyDown,We),onFocus:Pe(h.onFocus,()=>Le(!0)),onBlur:Pe(h.onBlur,()=>Le(!1))}),[xe,He,he,Ye,s,n,S,u,f,v,$,b,Xe,We]),Bt=d.useCallback((h,x=null)=>{const H=!(h.valuen),k=S>=h.value,N=st(h.value,s,n),ye={position:"absolute",pointerEvents:"none",...es({orientation:u,vertical:{bottom:C?`${100-N}%`:`${N}%`},horizontal:{left:C?`${100-N}%`:`${N}%`}})};return{...h,ref:x,role:"presentation","aria-hidden":!0,"data-disabled":V(f),"data-invalid":V(!H),"data-highlighted":V(k),style:{...h.style,...ye}}},[f,C,n,s,u,S]),Lt=d.useCallback((h={},x=null)=>({...h,ref:x,type:"hidden",value:S,name:D}),[D,S]);return{state:{value:S,isFocused:fe,isDragging:he},actions:z,getRootProps:At,getTrackProps:Ft,getInnerTrackProps:$t,getThumbProps:Vt,getMarkerProps:Bt,getInputProps:Lt}}function es(e){const{orientation:t,vertical:s,horizontal:n}=e;return t==="vertical"?s:n}function ts(e,t){return t"}),[ss,ie]=it({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),jt=L((e,t)=>{var s;const n={...e,orientation:(s=e==null?void 0:e.orientation)!=null?s:"horizontal"},o=Kt("Slider",n),a=ct(n),{direction:l}=Wt();a.direction=l;const{getInputProps:c,getRootProps:i,...u}=Qn(a),g=i(),f=c({},t);return r.jsx(ns,{value:u,children:r.jsx(ss,{value:o,children:r.jsxs(O.div,{...g,className:q("chakra-slider",n.className),__css:o.container,children:[n.children,r.jsx("input",{...f})]})})})});jt.displayName="Slider";var kt=L((e,t)=>{const{getThumbProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(O.div,{...o,className:q("chakra-slider__thumb",e.className),__css:n.thumb})});kt.displayName="SliderThumb";var Pt=L((e,t)=>{const{getTrackProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(O.div,{...o,className:q("chakra-slider__track",e.className),__css:n.track})});Pt.displayName="SliderTrack";var Ct=L((e,t)=>{const{getInnerTrackProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(O.div,{...o,className:q("chakra-slider__filled-track",e.className),__css:n.filledTrack})});Ct.displayName="SliderFilledTrack";var rs=L((e,t)=>{const{getMarkerProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(O.div,{...o,className:q("chakra-slider__marker",e.className),__css:n.mark})});rs.displayName="SliderMark";function os(e,t=[]){const s=Object.assign({},e);for(const n of t)n in s&&delete s[n];return s}var as=["h","minH","height","minHeight"],It=L((e,t)=>{const s=Yt("Textarea",e),{className:n,rows:o,...a}=ct(e),l=sn(a),c=o?os(s,as):s;return r.jsx(O.textarea,{ref:t,rows:o,...l,className:Xt("chakra-textarea",n),__css:c})});It.displayName="Textarea";var ls=Re("chevron-left","IconChevronLeft",[["path",{d:"M15 6l-6 6l6 6",key:"svg-0"}]]),Tt=Re("pin-filled","IconPinFilled",[["path",{d:"M15.113 3.21l.094 .083l5.5 5.5a1 1 0 0 1 -1.175 1.59l-3.172 3.171l-1.424 3.797a1 1 0 0 1 -.158 .277l-.07 .08l-1.5 1.5a1 1 0 0 1 -1.32 .082l-.095 -.083l-2.793 -2.792l-3.793 3.792a1 1 0 0 1 -1.497 -1.32l.083 -.094l3.792 -3.793l-2.792 -2.793a1 1 0 0 1 -.083 -1.32l.083 -.094l1.5 -1.5a1 1 0 0 1 .258 -.187l.098 -.042l3.796 -1.425l3.171 -3.17a1 1 0 0 1 1.497 -1.26z",fill:"currentColor",key:"svg-0",strokeWidth:"0"}]]),Et=Re("pin","IconPin",[["path",{d:"M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4",key:"svg-0"}],["path",{d:"M9 15l-4.5 4.5",key:"svg-1"}],["path",{d:"M14.5 4l5.5 5.5",key:"svg-2"}]]);const is=({setMediaAct:e,media:t,currentNum:s})=>{const n=l=>{const c=(s+l+t.length)%t.length;e&&e(t[c])},o={width:"100%",height:"100%"};if(t.length===0)return r.jsx("p",{children:"No images found, let's start generating πŸͺ„"});const a=t.at(s);return a?r.jsxs(p,{justifyContent:"center",alignItems:"center",position:"relative",width:o.width,height:o.height,overflow:"hidden",children:[r.jsx("div",{style:{position:"absolute",cursor:"pointer",width:"100%",height:"100%"},onClick:()=>{window.open(a.imageUrl)},children:rn(a.imageUrl)?r.jsx(on,{src:a.imageUrl,alt:`image-${a.id}`,width:"100%",height:"100%",objectFit:"contain"}):r.jsx("video",{style:{objectFit:"contain"},width:"100%",height:"100%",src:a.imageUrl,loop:!0,autoPlay:!0,muted:!0,children:r.jsx("track",{kind:"captions"})})},a.id),r.jsx(M,{size:"sm",color:"white",bgColor:"whiteAlpha.400","aria-label":"Previous image",icon:r.jsx(ls,{}),onClick:()=>n(-1),position:"absolute",left:"0",zIndex:"2"}),r.jsx(M,{size:"sm",color:"white",bgColor:"whiteAlpha.400","aria-label":"Next image",icon:r.jsx(hn,{}),onClick:()=>n(1),position:"absolute",right:"0",zIndex:"2"})]}):null},cs=({inputItem:e})=>r.jsxs(p,{gap:2,children:[r.jsx(p,{gap:1,alignItems:"center",flexBasis:"200px",children:e.label??e.inputName}),r.jsx(an,{value:e.inputValue,onChange:t=>{}})]}),us=e=>{const t=e.inputItem;return r.jsxs(p,{gap:1,direction:"column",children:[r.jsxs(p,{gap:2,children:[r.jsx(p,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsxs(fn,{width:"100%",step:e==null?void 0:e.step,value:t.inputValue,min:e==null?void 0:e.min,max:e==null?void 0:e.max,onChange:s=>{},children:[r.jsx(xn,{}),r.jsxs(gn,{children:[r.jsx(mn,{}),r.jsx(pn,{})]})]})]}),r.jsx(p,{children:r.jsxs(jt,{maxWidth:"400px",step:e==null?void 0:e.step,value:Number(t.inputValue),min:(e==null?void 0:e.min)??0,max:(e==null?void 0:e.max)??100,onChange:s=>{},children:[r.jsx(Pt,{children:r.jsx(Ct,{})}),r.jsx(kt,{})]})})]})},ds=e=>{var s;const{inputItem:t}=e;return r.jsxs(p,{gap:2,children:[r.jsx(p,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsx(wn,{value:t.inputValue,onChange:n=>{},children:(s=e==null?void 0:e.options)==null?void 0:s.map((n,o)=>r.jsx("option",{value:n,children:n},`select${t.nodeID}${t.inputName}${o}`))})]})},hs=e=>{const t=e.inputItem;return r.jsxs(p,{gap:1,direction:"column",children:[r.jsx(p,{children:t.label??t.inputName}),r.jsx(It,{value:t.inputValue,onChange:s=>{},rows:5})]})};var P=(e=>(e.Input="Input",e.InputSlider="InputSlider",e.Select="Select",e.Textarea="Textarea",e.Checkbox="Checkbox",e.NoSupport="NoSupport",e))(P||{});const fs=e=>r.jsxs(p,{gap:2,children:[r.jsx(p,{gap:1,alignItems:"center",flexBasis:"200px",children:e.inputItem.label??e.inputItem.inputName}),r.jsx(p,{children:"No Support"})]}),xs=e=>{const t=e.inputItem;return r.jsxs(p,{gap:2,children:[r.jsx(p,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsx(Ae,{defaultChecked:!!t.inputValue,onChange:s=>{var n;(n=e==null?void 0:e.updateMetaData)==null||n.call(e,{promptKey:e.promptKey,name:e.name,value:s.target.checked})}})]})},ce=d.createContext({topFields:[],calcInputList:[],showNodeName:!1,updateTopField(){}}),gs={[P.Input]:cs,[P.InputSlider]:us,[P.Select]:ds,[P.Textarea]:hs,[P.Checkbox]:xs,NoSupport:fs},ms=LiteGraph.registered_node_types;function ps(e,t){var o,a,l,c,i;const s=(o=ms[e])==null?void 0:o.nodeData,n={...((a=s==null?void 0:s.input)==null?void 0:a.required)??{},...((l=s==null?void 0:s.input)==null?void 0:l.optional)??{}}[t];return(n==null?void 0:n[0])==="STRING"?(c=n==null?void 0:n[1])!=null&&c.multiline?{type:P.Textarea}:{type:P.Input}:(n==null?void 0:n[0])==="BOOLEAN"?{type:P.Checkbox}:(n==null?void 0:n[0])==="FLOAT"?{...(n==null?void 0:n[1])??{},type:P.InputSlider}:(n==null?void 0:n[0])==="INT"?{...(n==null?void 0:n[1])??{},type:P.InputSlider}:Array.isArray(n==null?void 0:n[0])&&((i=n==null?void 0:n[0])!=null&&i.every(u=>typeof u=="string"))?{options:n==null?void 0:n[0],type:P.Select}:{type:P.NoSupport}}const _e=({inputItem:e})=>{const t=ps(e.classType,e.inputName),[s,n]=d.useState(!1),o=gs[t.type??"Input"],{updateTopField:a,topFields:l}=d.useContext(ce),c=e.children[0]==="negative"||e.children[0]==="positive"?`-${e.children[0]}`:"",i={...e,label:e.label??e.inputName+c};return r.jsxs(p,{alignItems:"center",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[r.jsx(M,{size:"xs",onClick:()=>a==null?void 0:a({name:e.inputName,promptKey:e.nodeID,class_type:e.classType}),variant:"ghost",icon:re(l,{name:e.inputName,promptKey:e.nodeID,classType:e.classType})?r.jsx(Tt,{size:14}):r.jsx(Et,{size:14}),"aria-label":"pin"}),r.jsx("div",{style:{flex:1},children:r.jsx(o,{inputItem:i,...t})})]})};function vs(){const{topFields:e,updateTopField:t,calcInputList:s}=d.useContext(ce);return e.length===0?null:r.jsx(r.Fragment,{children:r.jsx(p,{px:2,gap:2,direction:"column",children:e==null?void 0:e.map(n=>{const o=s.find(a=>a.nodeID==n.promptKey&&a.inputName===n.name&&a.classType===n.class_type);return!n.class_type||!o?null:r.jsx(_e,{inputItem:o},`formTopField${n.promptKey}${n.name}`)})})})}function ys(){const{topFields:e,calcInputList:t,showNodeName:s}=d.useContext(ce),n=d.useCallback(a=>{const l=[];return a.forEach(c=>{const i=l[l.length-1];!i||i[0].nodeID!==c.nodeID||i[0].classType!==c.classType?l.push([c]):i.push(c)}),l},[]);if(d.useEffect(()=>{},[s]),!s)return r.jsx(Ee,{children:t.map(a=>re(e,{name:a.inputName,promptKey:a.nodeID,classType:a.classType})?null:r.jsx(_e,{inputItem:a},`form${a.nodeID}${a.inputName}`))});const o=n(t);return r.jsx(Ee,{children:o.map(a=>a[0]?r.jsx(ws,{title:a[0].classType+" #"+a[0].nodeID,children:r.jsx(p,{px:2,gap:1,direction:"column",children:a.map(l=>re(e,{name:l.inputName,promptKey:l.nodeID,classType:l.classType})?null:r.jsx(_e,{inputItem:l},`form${l.nodeID}${l.inputName}`))})},a[0].nodeID):null)})}function ws({title:e,children:t}){return r.jsxs(ht,{border:"1px",borderColor:"gray.500",borderRadius:"md",p:4,children:[r.jsx(W,{size:"sm",mb:1,color:"GrayText",children:e}),r.jsx("div",{children:t})]})}let se=[],ze=new Set;function Nt(e,t){if(!ze.has(e.nodeID))return ze.add(e.nodeID),Object.entries(e.inputs).forEach(([s,n])=>{if(Array.isArray(n)){const o=n[0];Nt(t[o],t)}}),Object.entries(e.inputs).forEach(([s,n])=>{Array.isArray(n)||se.push({classType:e.class_type,inputName:s,inputValue:n,nodeID:e.nodeID,children:e.children||[]})}),se}function Ss(e){se=[],ze=new Set;for(const t of Object.keys(e))e[t].nodeID=t,Object.entries(e[t].inputs).forEach(([s,n])=>{if(Array.isArray(n)){const o=n[0],a=e[o];a.children||(a.children=[]),a.children.push(s)}});for(const t of Object.keys(e))Nt(e[t],e);return se}const re=(e,t)=>e==null?void 0:e.some(s=>s.promptKey===(t==null?void 0:t.promptKey)&&s.name===(t==null?void 0:t.name)&&s.class_type===t.classType);function bs({media:e}){const[t,s]=d.useState([]),{curFlowID:n}=d.useContext(oe),[o,a]=d.useState(),[l,c]=d.useState(!0),[i,u]=d.useState(!0);d.useEffect(()=>{e?ln(`/workspace/view_media?filename=${e.localPath}`).then(m=>{a(m.prompt)}):tt.graphToPrompt(tt.graph).then(m=>{a(m.output)})},[e]),d.useEffect(()=>{if(!o)return;const m=Ss(o);s(m)},[o]);const[g,f]=d.useState([]);d.useEffect(()=>{(async()=>{var m,I;if(n){const y=(I=await((m=R)==null?void 0:m.get(n)))==null?void 0:I.topFieldsConfig;y&&(f(y),c(!1))}})()},[n]);const v=m=>{var I,y;if(re(g,{name:m.name,promptKey:m==null?void 0:m.promptKey,classType:(m==null?void 0:m.class_type)??""})){const w=g.filter(E=>E.name!==m.name||E.promptKey!==m.promptKey);f(w),n&&((I=R)==null||I.updateTopFields(n,{topFieldsConfig:w}))}else{const w=[...g,m];f(w),n&&((y=R)==null||y.updateTopFields(n,{topFieldsConfig:w}))}};return r.jsx(ce.Provider,{value:{topFields:g,showNodeName:i,calcInputList:t,updateTopField:v},children:r.jsxs(p,{direction:"column",align:"stretch",gap:5,children:[r.jsx(vs,{}),r.jsxs(Y,{children:[r.jsx("p",{children:"Show all inputs"}),r.jsx(rt,{isChecked:l,onChange:m=>c(!l)}),r.jsx("p",{children:"Show node names"}),r.jsx(rt,{isChecked:i,onChange:m=>u(!i)})]}),l&&r.jsx(ys,{})]})})}const ue=d.createContext({showAllImages:!1,curMedia:null,setCurMedia(){},setMediaList(){},setShowAllImages(){}}),js=({media:e})=>{var l,c;const[t,s]=d.useState(!1),{setMediaList:n}=d.useContext(ue),{loadFilePath:o}=d.useContext(oe),{showDialog:a}=ut();return d.useEffect(()=>{var i,u;s((e==null?void 0:e.localPath)!=null&&((u=(i=R)==null?void 0:i.curWorkflow)==null?void 0:u.coverMediaPath)===(e==null?void 0:e.localPath))},[e]),e?r.jsxs(p,{flexWrap:"wrap",gap:3,children:[r.jsx(p,{alignItems:"center",gap:2,children:e.localPath&&r.jsxs(r.Fragment,{children:[r.jsx(W,{children:e==null?void 0:e.localPath}),r.jsx(A,{label:"Donwload image from gallery",children:r.jsx(Ne,{href:`/workspace/view_media?filename=${e==null?void 0:e.localPath}`,download:e==null?void 0:e.localPath,children:r.jsx(M,{size:"sm",icon:r.jsx(ft,{size:19}),"aria-label":"donwload image from gallery"})})})]})}),r.jsx(p,{gap:1,alignItems:"center",color:"GrayText",children:!!(e!=null&&e.createTime)&&r.jsx(W,{children:xt((e==null?void 0:e.createTime)??0,!0)})}),r.jsx(A,{label:"Remove image from gallery",children:r.jsx(M,{size:"sm",variant:"ghost",icon:r.jsx(gt,{size:19}),"aria-label":"remove image from gallery",colorScheme:"red",onClick:async()=>{var u;confirm("Are you sure to remove this image from gallery? (won't delete image on your disk)")&&(await((u=F)==null?void 0:u.delete(e.id)),n(g=>g.filter(f=>f.id!==e.id)))}})}),((c=(l=R)==null?void 0:l.curWorkflow)==null?void 0:c.id)&&r.jsx(A,{label:"Set as cover",children:r.jsx(M,{size:"sm",variant:"ghost",icon:t?r.jsx(Tt,{size:19}):r.jsx(Et,{size:19}),"aria-label":"set as cover",onClick:async()=>{var i;await((i=R)==null?void 0:i.updateMetaInfo(R.curWorkflow.id,{coverMediaPath:t?void 0:e.localPath})),s(!t)}})}),r.jsx(dt,{onClick:()=>a("How do you want to load this workflow?",[{label:"Load in new workflow",onClick:()=>{o(e.localPath)},colorScheme:"teal"},{label:"Overwrite current workflow",onClick:()=>o(e.localPath,!0),colorScheme:"red"}]),size:"sm",children:"Load"})]}):null},ks=({media:e})=>r.jsxs(p,{overflowY:"auto",mb:4,direction:"column",gap:2,flex:1,children:[r.jsx(js,{media:e}),r.jsx(bs,{media:e??null})]}),Te=120;function Ps({mediaList:e}){const{curMedia:t,setCurMedia:s}=d.useContext(ue);return r.jsxs(p,{gap:3,h:"100%",children:[r.jsxs(Sn,{gridTemplateRows:e.length<=6?"1fr 20%":"1fr",flex:1,gap:2,children:[r.jsx("div",{style:{height:"56vh"},children:r.jsx(is,{media:e.map(n=>({id:n.id,imageUrl:`/workspace/view_media?filename=${n.localPath}`})),currentNum:(e==null?void 0:e.findIndex(n=>n.id===(t==null?void 0:t.id)))??0,setMediaAct:n=>s((e==null?void 0:e.find(o=>o.id===n.id))??null)})}),r.jsx(p,{wrap:"wrap",children:e==null?void 0:e.map(n=>r.jsx(ht,{display:"inline-block",p:1,borderRadius:"4px",width:`${Te+3}px`,height:`${Te+3}px`,cursor:"pointer",border:(t==null?void 0:t.id)===n.id?"1px solid gray":"",onClick:()=>s(n),children:r.jsx(mt,{mediaLocalPath:n.localPath,size:Te,objectFit:"contain",hideBrokenImage:!0,onBrokenLink:()=>{var o;(o=F)==null||o.delete(n.id)}})},`image-bottom-${n.id}`))})]}),r.jsx(ks,{media:t??void 0})]})}const Cs=({media:e,isSelecting:t,selectedID:s,onClickMedia:n})=>{const{curFlowID:a,loadFilePath:l}=d.useContext(oe),{showDialog:c}=ut();if(e.localPath==null||a==null)return null;const i=r.jsxs(Ne,{isExternal:!0,onClick:()=>n(e),position:"relative",children:[t&&r.jsx(Ae,{isChecked:s.includes(e.id),position:"absolute",top:2,left:2}),r.jsx(mt,{mediaLocalPath:e.localPath,size:180,onBrokenLink:()=>{var u;(u=F)==null||u.delete(e.id)},hideBrokenImage:!0,autoPlay:!0,isPreview:!0})]});return r.jsxs(Ee,{width:180,mb:2,children:[r.jsx(A,{label:xt(e.createTime,!0),children:i}),r.jsx(A,{label:e.localPath,children:r.jsx(W,{color:"GrayText",noOfLines:1,children:e.localPath})}),r.jsxs(Y,{hidden:t,gap:0,children:[r.jsx(dt,{flexGrow:1,onClick:()=>c("How do you want to load this workflow?",[{label:"Load in new workflow",onClick:()=>{l(e.localPath)},colorScheme:"teal"},{label:"Overwrite current workflow",onClick:()=>l(e.localPath,!0),colorScheme:"red"}]),size:"sm",children:"Load"}),r.jsx(A,{label:"Donwload image from gallery",children:r.jsx(Ne,{href:`/workspace/view_media?filename=${e.localPath}`,download:e.localPath,children:r.jsx(M,{size:"sm",variant:"ghost",icon:r.jsx(ft,{size:19}),"aria-label":"donwload image from gallery"})})}),r.jsx(A,{label:"Remove image from gallery",children:r.jsx(M,{size:"sm",variant:"ghost",icon:r.jsx(gt,{size:19}),"aria-label":"remove image from gallery",colorScheme:"red",onClick:async()=>{var g;confirm("Are you sure to remove this image from gallery? (won't delete image on your disk)")&&await((g=F)==null?void 0:g.delete(e.id))}})})]})]})},Is=Cs;function Ts({searchQuery:e}){const[t,s]=d.useState([]),{setCurMedia:n,setShowAllImages:o,setMediaList:a}=d.useContext(ue);d.useEffect(()=>{var c,i;e===""?(c=F)==null||c.listAll().then(u=>{s(u.slice(0,50)??[])}):(i=F)==null||i.filter(u=>{var g;return((g=u.workflowJSON)==null?void 0:g.includes(e))??!1}).then(u=>{s(u)})},[e]);const l=c=>{a([c].concat(t.filter(i=>i.id!==c.id))),n(c),o(!1)};return r.jsx(Y,{wrap:"wrap",children:t.map(c=>r.jsx(Is,{selectedID:[],media:c,isSelecting:!1,onClickMedia:l},c.id))})}function Vs({onclose:e}){const{curFlowID:t}=d.useContext(oe),[s,n]=d.useState(""),[o,a]=d.useState([]),[l,c]=d.useState(!1),[i,u]=d.useState([]),[g,f]=d.useState(),[v,m]=d.useState(""),I=vn(v,300),[y,w]=d.useState(!1),E=async()=>{var D;if(t==null)return;const b=await((D=F)==null?void 0:D.listByWorkflowID(t));u(b??[]),b!=null&&b.length&&f(b[0])};if(d.useEffect(()=>{var b;E(),t&&((b=R)==null||b.get(t).then(D=>{D&&n(D.name)}))},[]),t==null)return null;const $=i.length>0&&o.length===i.length;return r.jsx(ue.Provider,{value:{curMedia:g??null,setCurMedia:f,setMediaList:u,showAllImages:y,setShowAllImages:w},children:r.jsxs(Zt,{isOpen:!0,onClose:e,blockScrollOnMount:!0,children:[r.jsx(qt,{}),r.jsxs(Jt,{width:"90%",maxWidth:"90vw",height:"90vh",children:[r.jsxs(Qt,{children:[r.jsxs(Y,{gap:2,mb:2,children:[r.jsxs(cn,{size:"md",mr:2,children:["Gallery - ",s]}),r.jsx(yn,{searchValue:v,onUpdateSearchValue:b=>{m(b),y||w(!0)},placeholder:"Search prompt, model name, etc.",style:{width:"300px"}})]}),l&&r.jsxs(Y,{gap:3,children:[r.jsx(Ae,{isChecked:$,onChange:()=>{a($?[]:i.map(b=>b.id))},children:"All"}),r.jsxs(W,{fontSize:16,children:[o.length," Selected"]}),r.jsx(M,{size:"sm",icon:r.jsx(un,{size:19}),onClick:()=>c(!1),"aria-label":"cancel"})]})]}),r.jsx(en,{}),r.jsx(tn,{overflowY:"auto",children:y?r.jsx(Ts,{searchQuery:I}):r.jsx(Ps,{mediaList:i})})]})]})})}export{Vs as default}; +import{r as d,d as Se,y as Ht,m as be,b as it,f as L,l as Kt,o as ct,E as Wt,j as r,g as O,p as Yt,h as Xt,W as ut,i as dt,M as Zt,N as qt,O as Jt,Q as Qt,R as en,S as tn}from"./input.js";import{ab as nn,ac as sn,d as Re,F as p,ad as rn,ae as on,I as M,j as an,g as Ee,B as ht,h as W,Z as oe,af as ln,a5 as tt,x as R,H as Y,i as A,w as ft,a3 as xt,e as gt,a2 as F,ag as cn,y as un}from"./App-4M5AgwD2.js";import{c as je,p as dn,r as nt,v as st,I as hn,N as fn,a as xn,b as gn,d as mn,e as pn,M as mt,u as vn,S as yn}from"./MediaPreview-TJpk-on-.js";import{S as wn}from"./chunk-3RSXBRAN-D3gE_K4K.js";import{C as Ae,G as Sn}from"./chunk-JARCRF6W-ibNbyhHV.js";import{S as rt,L as Ne}from"./chunk-VTV6N5LE-x5KZOIPv.js";import"./IconSearch-E56kR4uG.js";import"./chunk-7D6N5TE5-zfYf6Y9A.js";const pt=1/60*1e3,bn=typeof performance<"u"?()=>performance.now():()=>Date.now(),vt=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(bn()),pt);function jn(e){let t=[],s=[],n=0,o=!1,a=!1;const l=new WeakSet,c={schedule:(i,u=!1,g=!1)=>{const f=g&&o,v=f?t:s;return u&&l.add(i),v.indexOf(i)===-1&&(v.push(i),f&&o&&(n=t.length)),i},cancel:i=>{const u=s.indexOf(i);u!==-1&&s.splice(u,1),l.delete(i)},process:i=>{if(o){a=!0;return}if(o=!0,[t,s]=[s,t],s.length=0,n=t.length,n)for(let u=0;u(e[t]=jn(()=>X=!0),e),{}),Pn=Z.reduce((e,t)=>{const s=ae[t];return e[t]=(n,o=!1,a=!1)=>(X||Tn(),s.schedule(n,o,a)),e},{}),Cn=Z.reduce((e,t)=>(e[t]=ae[t].cancel,e),{});Z.reduce((e,t)=>(e[t]=()=>ae[t].process(B),e),{});const In=e=>ae[e].process(B),yt=e=>{X=!1,B.delta=Me?pt:Math.max(Math.min(e-B.timestamp,kn),1),B.timestamp=e,De=!0,Z.forEach(In),De=!1,X&&(Me=!1,vt(yt))},Tn=()=>{X=!0,Me=!0,De||vt(yt)},ot=()=>B;var V=e=>e?"":void 0,ke=e=>e?!0:void 0,q=(...e)=>e.filter(Boolean).join(" ");function Pe(...e){return function(s){e.some(n=>(n==null||n(s),s==null?void 0:s.defaultPrevented))}}function Q(e){const{orientation:t,vertical:s,horizontal:n}=e;return t==="vertical"?s:n}var te={width:0,height:0},ee=e=>e||te;function En(e){const{orientation:t,thumbPercents:s,thumbRects:n,isReversed:o}=e,a=y=>{var w;const E=(w=n[y])!=null?w:te;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Q({orientation:t,vertical:{bottom:`calc(${s[y]}% - ${E.height/2}px)`},horizontal:{left:`calc(${s[y]}% - ${E.width/2}px)`}})}},l=t==="vertical"?n.reduce((y,w)=>ee(y).height>ee(w).height?y:w,te):n.reduce((y,w)=>ee(y).width>ee(w).width?y:w,te),c={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Q({orientation:t,vertical:l?{paddingLeft:l.width/2,paddingRight:l.width/2}:{},horizontal:l?{paddingTop:l.height/2,paddingBottom:l.height/2}:{}})},i={position:"absolute",...Q({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},u=s.length===1,g=[0,o?100-s[0]:s[0]],f=u?g:s;let v=f[0];!u&&o&&(v=100-v);const m=Math.abs(f[f.length-1]-f[0]),I={...i,...Q({orientation:t,vertical:o?{height:`${m}%`,top:`${v}%`}:{height:`${m}%`,bottom:`${v}%`},horizontal:o?{width:`${m}%`,right:`${v}%`}:{width:`${m}%`,left:`${v}%`}})};return{trackStyle:i,innerTrackStyle:I,rootStyle:c,getThumbStyle:a}}function Nn(e){const{isReversed:t,direction:s,orientation:n}=e;return s==="ltr"||n==="vertical"?t:!t}function Mn(e,t,s,n){return e.addEventListener(t,s,n),()=>{e.removeEventListener(t,s,n)}}function Dn(e){const t=zn(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function wt(e){return!!e.touches}function _n(e){return wt(e)&&e.touches.length>1}function zn(e){var t;return(t=e.view)!=null?t:window}function Rn(e,t="page"){const s=e.touches[0]||e.changedTouches[0];return{x:s[`${t}X`],y:s[`${t}Y`]}}function An(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function St(e,t="page"){return wt(e)?Rn(e,t):An(e,t)}function Fn(e){return t=>{const s=Dn(t);(!s||s&&t.button===0)&&e(t)}}function $n(e,t=!1){function s(o){e(o,{point:St(o)})}return t?Fn(s):s}function ne(e,t,s,n){return Mn(e,t,$n(s,t==="pointerdown"),n)}var Vn=Object.defineProperty,Bn=(e,t,s)=>t in e?Vn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,T=(e,t,s)=>(Bn(e,typeof t!="symbol"?t+"":t,s),s),Ln=class{constructor(e,t,s){T(this,"history",[]),T(this,"startEvent",null),T(this,"lastEvent",null),T(this,"lastEventInfo",null),T(this,"handlers",{}),T(this,"removeListeners",()=>{}),T(this,"threshold",3),T(this,"win"),T(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const c=Ce(this.lastEventInfo,this.history),i=this.startEvent!==null,u=Hn(c.offset,{x:0,y:0})>=this.threshold;if(!i&&!u)return;const{timestamp:g}=ot();this.history.push({...c.point,timestamp:g});const{onStart:f,onMove:v}=this.handlers;i||(f==null||f(this.lastEvent,c),this.startEvent=this.lastEvent),v==null||v(this.lastEvent,c)}),T(this,"onPointerMove",(c,i)=>{this.lastEvent=c,this.lastEventInfo=i,Pn.update(this.updatePoint,!0)}),T(this,"onPointerUp",(c,i)=>{const u=Ce(i,this.history),{onEnd:g,onSessionEnd:f}=this.handlers;f==null||f(c,u),this.end(),!(!g||!this.startEvent)&&(g==null||g(c,u))});var n;if(this.win=(n=e.view)!=null?n:window,_n(e))return;this.handlers=t,s&&(this.threshold=s),e.stopPropagation(),e.preventDefault();const o={point:St(e)},{timestamp:a}=ot();this.history=[{...o.point,timestamp:a}];const{onSessionStart:l}=t;l==null||l(e,Ce(o,this.history)),this.removeListeners=Un(ne(this.win,"pointermove",this.onPointerMove),ne(this.win,"pointerup",this.onPointerUp),ne(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),Cn.update(this.updatePoint)}};function at(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ce(e,t){return{point:e.point,delta:at(e.point,t[t.length-1]),offset:at(e.point,t[0]),velocity:Gn(t,.1)}}var On=e=>e*1e3;function Gn(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,n=null;const o=e[e.length-1];for(;s>=0&&(n=e[s],!(o.timestamp-n.timestamp>On(t)));)s--;if(!n)return{x:0,y:0};const a=(o.timestamp-n.timestamp)/1e3;if(a===0)return{x:0,y:0};const l={x:(o.x-n.x)/a,y:(o.y-n.y)/a};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function Un(...e){return t=>e.reduce((s,n)=>n(s),t)}function Ie(e,t){return Math.abs(e-t)}function lt(e){return"x"in e&&"y"in e}function Hn(e,t){if(typeof e=="number"&&typeof t=="number")return Ie(e,t);if(lt(e)&<(t)){const s=Ie(e.x,t.x),n=Ie(e.y,t.y);return Math.sqrt(s**2+n**2)}return 0}function bt(e){const t=d.useRef(null);return t.current=e,t}function Kn(e,t){const{onPan:s,onPanStart:n,onPanEnd:o,onPanSessionStart:a,onPanSessionEnd:l,threshold:c}=t,i=!!(s||n||o||a||l),u=d.useRef(null),g=bt({onSessionStart:a,onSessionEnd:l,onStart:n,onMove:s,onEnd(f,v){u.current=null,o==null||o(f,v)}});d.useEffect(()=>{var f;(f=u.current)==null||f.updateHandlers(g.current)}),d.useEffect(()=>{const f=e.current;if(!f||!i)return;function v(m){u.current=new Ln(m,g.current,c)}return ne(f,"pointerdown",v)},[e,i,g,c]),d.useEffect(()=>()=>{var f;(f=u.current)==null||f.end(),u.current=null},[])}function Wn(e,t){if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const s=e.ownerDocument.defaultView??window,n=new s.ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const[a]=o;let l,c;if("borderBoxSize"in a){const i=a.borderBoxSize,u=Array.isArray(i)?i[0]:i;l=u.inlineSize,c=u.blockSize}else l=e.offsetWidth,c=e.offsetHeight;t({width:l,height:c})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}var Yn=globalThis!=null&&globalThis.document?d.useLayoutEffect:d.useEffect;function Xn(e,t){var s,n;if(!e||!e.parentElement)return;const o=(n=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?n:window,a=new o.MutationObserver(()=>{t()});return a.observe(e.parentElement,{childList:!0}),()=>{a.disconnect()}}function Zn({getNodes:e,observeMutation:t=!0}){const[s,n]=d.useState([]),[o,a]=d.useState(0);return Yn(()=>{const l=e(),c=l.map((i,u)=>Wn(i,g=>{n(f=>[...f.slice(0,u),g,...f.slice(u+1)])}));if(t){const i=l[0];c.push(Xn(i,()=>{a(u=>u+1)}))}return()=>{c.forEach(i=>{i==null||i()})}},[o]),s}function qn(e){return typeof e=="object"&&e!==null&&"current"in e}function Jn(e){const[t]=Zn({observeMutation:!1,getNodes(){return[qn(e)?e.current:e]}});return t}function Qn(e){var t;const{min:s=0,max:n=100,onChange:o,value:a,defaultValue:l,isReversed:c,direction:i="ltr",orientation:u="horizontal",id:g,isDisabled:f,isReadOnly:v,onChangeStart:m,onChangeEnd:I,step:y=1,getAriaValueText:w,"aria-valuetext":E,"aria-label":$,"aria-labelledby":b,name:D,focusThumbOnChange:Mt=!0,...Fe}=e,$e=Se(m),G=Se(I),Ve=Se(w),C=Nn({isReversed:c,direction:i,orientation:u}),[Dt,de]=nn({value:a,defaultValue:l??ts(s,n),onChange:o}),[he,Be]=d.useState(!1),[fe,Le]=d.useState(!1),xe=!(f||v),ge=(n-s)/10,U=y||(n-s)/100,S=je(Dt,s,n),_t=n-S+s,Oe=st(C?_t:S,s,n),J=u==="vertical",j=bt({min:s,max:n,step:y,isDisabled:f,value:S,isInteractive:xe,isReversed:C,isVertical:J,eventSource:null,focusThumbOnChange:Mt,orientation:u}),me=d.useRef(null),pe=d.useRef(null),Ge=d.useRef(null),zt=d.useId(),Ue=g??zt,[He,Ke]=[`slider-thumb-${Ue}`,`slider-track-${Ue}`],Rt=d.useCallback(h=>{var x,H;if(!me.current)return;const k=j.current;k.eventSource="pointer";const N=me.current.getBoundingClientRect(),{clientX:ye,clientY:Ot}=(H=(x=h.touches)==null?void 0:x[0])!=null?H:h,Gt=J?N.bottom-Ot:ye-N.left,Ut=J?N.height:N.width;let we=Gt/Ut;C&&(we=1-we);let K=dn(we,k.min,k.max);return k.step&&(K=parseFloat(nt(K,k.min,k.step))),K=je(K,k.min,k.max),K},[J,C,j]),_=d.useCallback(h=>{const x=j.current;x.isInteractive&&(h=parseFloat(nt(h,x.min,U)),h=je(h,x.min,x.max),de(h))},[U,de,j]),z=d.useMemo(()=>({stepUp(h=U){const x=C?S-h:S+h;_(x)},stepDown(h=U){const x=C?S+h:S-h;_(x)},reset(){_(l||0)},stepTo(h){_(h)}}),[_,C,S,U,l]),We=d.useCallback(h=>{const x=j.current,k={ArrowRight:()=>z.stepUp(),ArrowUp:()=>z.stepUp(),ArrowLeft:()=>z.stepDown(),ArrowDown:()=>z.stepDown(),PageUp:()=>z.stepUp(ge),PageDown:()=>z.stepDown(ge),Home:()=>_(x.min),End:()=>_(x.max)}[h.key];k&&(h.preventDefault(),h.stopPropagation(),k(h),x.eventSource="keyboard")},[z,_,ge,j]),Ye=(t=Ve==null?void 0:Ve(S))!=null?t:E,ve=Jn(pe),{getThumbStyle:Xe,rootStyle:Ze,trackStyle:qe,innerTrackStyle:Je}=d.useMemo(()=>{const h=j.current,x=ve??{width:0,height:0};return En({isReversed:C,orientation:h.orientation,thumbRects:[x],thumbPercents:[Oe]})},[C,ve,Oe,j]),Qe=d.useCallback(()=>{j.current.focusThumbOnChange&&setTimeout(()=>{var x;return(x=pe.current)==null?void 0:x.focus()})},[j]);Ht(()=>{const h=j.current;Qe(),h.eventSource==="keyboard"&&(G==null||G(h.value))},[S,G]);function et(h){const x=Rt(h);x!=null&&x!==j.current.value&&de(x)}Kn(Ge,{onPanSessionStart(h){const x=j.current;x.isInteractive&&(Be(!0),Qe(),et(h),$e==null||$e(x.value))},onPanSessionEnd(){const h=j.current;h.isInteractive&&(Be(!1),G==null||G(h.value))},onPan(h){j.current.isInteractive&&et(h)}});const At=d.useCallback((h={},x=null)=>({...h,...Fe,ref:be(x,Ge),tabIndex:-1,"aria-disabled":ke(f),"data-focused":V(fe),style:{...h.style,...Ze}}),[Fe,f,fe,Ze]),Ft=d.useCallback((h={},x=null)=>({...h,ref:be(x,me),id:Ke,"data-disabled":V(f),style:{...h.style,...qe}}),[f,Ke,qe]),$t=d.useCallback((h={},x=null)=>({...h,ref:x,style:{...h.style,...Je}}),[Je]),Vt=d.useCallback((h={},x=null)=>({...h,ref:be(x,pe),role:"slider",tabIndex:xe?0:void 0,id:He,"data-active":V(he),"aria-valuetext":Ye,"aria-valuemin":s,"aria-valuemax":n,"aria-valuenow":S,"aria-orientation":u,"aria-disabled":ke(f),"aria-readonly":ke(v),"aria-label":$,"aria-labelledby":$?void 0:b,style:{...h.style,...Xe(0)},onKeyDown:Pe(h.onKeyDown,We),onFocus:Pe(h.onFocus,()=>Le(!0)),onBlur:Pe(h.onBlur,()=>Le(!1))}),[xe,He,he,Ye,s,n,S,u,f,v,$,b,Xe,We]),Bt=d.useCallback((h,x=null)=>{const H=!(h.valuen),k=S>=h.value,N=st(h.value,s,n),ye={position:"absolute",pointerEvents:"none",...es({orientation:u,vertical:{bottom:C?`${100-N}%`:`${N}%`},horizontal:{left:C?`${100-N}%`:`${N}%`}})};return{...h,ref:x,role:"presentation","aria-hidden":!0,"data-disabled":V(f),"data-invalid":V(!H),"data-highlighted":V(k),style:{...h.style,...ye}}},[f,C,n,s,u,S]),Lt=d.useCallback((h={},x=null)=>({...h,ref:x,type:"hidden",value:S,name:D}),[D,S]);return{state:{value:S,isFocused:fe,isDragging:he},actions:z,getRootProps:At,getTrackProps:Ft,getInnerTrackProps:$t,getThumbProps:Vt,getMarkerProps:Bt,getInputProps:Lt}}function es(e){const{orientation:t,vertical:s,horizontal:n}=e;return t==="vertical"?s:n}function ts(e,t){return t"}),[ss,ie]=it({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),jt=L((e,t)=>{var s;const n={...e,orientation:(s=e==null?void 0:e.orientation)!=null?s:"horizontal"},o=Kt("Slider",n),a=ct(n),{direction:l}=Wt();a.direction=l;const{getInputProps:c,getRootProps:i,...u}=Qn(a),g=i(),f=c({},t);return r.jsx(ns,{value:u,children:r.jsx(ss,{value:o,children:r.jsxs(O.div,{...g,className:q("chakra-slider",n.className),__css:o.container,children:[n.children,r.jsx("input",{...f})]})})})});jt.displayName="Slider";var kt=L((e,t)=>{const{getThumbProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(O.div,{...o,className:q("chakra-slider__thumb",e.className),__css:n.thumb})});kt.displayName="SliderThumb";var Pt=L((e,t)=>{const{getTrackProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(O.div,{...o,className:q("chakra-slider__track",e.className),__css:n.track})});Pt.displayName="SliderTrack";var Ct=L((e,t)=>{const{getInnerTrackProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(O.div,{...o,className:q("chakra-slider__filled-track",e.className),__css:n.filledTrack})});Ct.displayName="SliderFilledTrack";var rs=L((e,t)=>{const{getMarkerProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(O.div,{...o,className:q("chakra-slider__marker",e.className),__css:n.mark})});rs.displayName="SliderMark";function os(e,t=[]){const s=Object.assign({},e);for(const n of t)n in s&&delete s[n];return s}var as=["h","minH","height","minHeight"],It=L((e,t)=>{const s=Yt("Textarea",e),{className:n,rows:o,...a}=ct(e),l=sn(a),c=o?os(s,as):s;return r.jsx(O.textarea,{ref:t,rows:o,...l,className:Xt("chakra-textarea",n),__css:c})});It.displayName="Textarea";var ls=Re("chevron-left","IconChevronLeft",[["path",{d:"M15 6l-6 6l6 6",key:"svg-0"}]]),Tt=Re("pin-filled","IconPinFilled",[["path",{d:"M15.113 3.21l.094 .083l5.5 5.5a1 1 0 0 1 -1.175 1.59l-3.172 3.171l-1.424 3.797a1 1 0 0 1 -.158 .277l-.07 .08l-1.5 1.5a1 1 0 0 1 -1.32 .082l-.095 -.083l-2.793 -2.792l-3.793 3.792a1 1 0 0 1 -1.497 -1.32l.083 -.094l3.792 -3.793l-2.792 -2.793a1 1 0 0 1 -.083 -1.32l.083 -.094l1.5 -1.5a1 1 0 0 1 .258 -.187l.098 -.042l3.796 -1.425l3.171 -3.17a1 1 0 0 1 1.497 -1.26z",fill:"currentColor",key:"svg-0",strokeWidth:"0"}]]),Et=Re("pin","IconPin",[["path",{d:"M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4",key:"svg-0"}],["path",{d:"M9 15l-4.5 4.5",key:"svg-1"}],["path",{d:"M14.5 4l5.5 5.5",key:"svg-2"}]]);const is=({setMediaAct:e,media:t,currentNum:s})=>{const n=l=>{const c=(s+l+t.length)%t.length;e&&e(t[c])},o={width:"100%",height:"100%"};if(t.length===0)return r.jsx("p",{children:"No images found, let's start generating πŸͺ„"});const a=t.at(s);return a?r.jsxs(p,{justifyContent:"center",alignItems:"center",position:"relative",width:o.width,height:o.height,overflow:"hidden",children:[r.jsx("div",{style:{position:"absolute",cursor:"pointer",width:"100%",height:"100%"},onClick:()=>{window.open(a.imageUrl)},children:rn(a.imageUrl)?r.jsx(on,{src:a.imageUrl,alt:`image-${a.id}`,width:"100%",height:"100%",objectFit:"contain"}):r.jsx("video",{style:{objectFit:"contain"},width:"100%",height:"100%",src:a.imageUrl,loop:!0,autoPlay:!0,muted:!0,children:r.jsx("track",{kind:"captions"})})},a.id),r.jsx(M,{size:"sm",color:"white",bgColor:"whiteAlpha.400","aria-label":"Previous image",icon:r.jsx(ls,{}),onClick:()=>n(-1),position:"absolute",left:"0",zIndex:"2"}),r.jsx(M,{size:"sm",color:"white",bgColor:"whiteAlpha.400","aria-label":"Next image",icon:r.jsx(hn,{}),onClick:()=>n(1),position:"absolute",right:"0",zIndex:"2"})]}):null},cs=({inputItem:e})=>r.jsxs(p,{gap:2,children:[r.jsx(p,{gap:1,alignItems:"center",flexBasis:"200px",children:e.label??e.inputName}),r.jsx(an,{value:e.inputValue,onChange:t=>{}})]}),us=e=>{const t=e.inputItem;return r.jsxs(p,{gap:1,direction:"column",children:[r.jsxs(p,{gap:2,children:[r.jsx(p,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsxs(fn,{width:"100%",step:e==null?void 0:e.step,value:t.inputValue,min:e==null?void 0:e.min,max:e==null?void 0:e.max,onChange:s=>{},children:[r.jsx(xn,{}),r.jsxs(gn,{children:[r.jsx(mn,{}),r.jsx(pn,{})]})]})]}),r.jsx(p,{children:r.jsxs(jt,{maxWidth:"400px",step:e==null?void 0:e.step,value:Number(t.inputValue),min:(e==null?void 0:e.min)??0,max:(e==null?void 0:e.max)??100,onChange:s=>{},children:[r.jsx(Pt,{children:r.jsx(Ct,{})}),r.jsx(kt,{})]})})]})},ds=e=>{var s;const{inputItem:t}=e;return r.jsxs(p,{gap:2,children:[r.jsx(p,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsx(wn,{value:t.inputValue,onChange:n=>{},children:(s=e==null?void 0:e.options)==null?void 0:s.map((n,o)=>r.jsx("option",{value:n,children:n},`select${t.nodeID}${t.inputName}${o}`))})]})},hs=e=>{const t=e.inputItem;return r.jsxs(p,{gap:1,direction:"column",children:[r.jsx(p,{children:t.label??t.inputName}),r.jsx(It,{value:t.inputValue,onChange:s=>{},rows:5})]})};var P=(e=>(e.Input="Input",e.InputSlider="InputSlider",e.Select="Select",e.Textarea="Textarea",e.Checkbox="Checkbox",e.NoSupport="NoSupport",e))(P||{});const fs=e=>r.jsxs(p,{gap:2,children:[r.jsx(p,{gap:1,alignItems:"center",flexBasis:"200px",children:e.inputItem.label??e.inputItem.inputName}),r.jsx(p,{children:"No Support"})]}),xs=e=>{const t=e.inputItem;return r.jsxs(p,{gap:2,children:[r.jsx(p,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsx(Ae,{defaultChecked:!!t.inputValue,onChange:s=>{var n;(n=e==null?void 0:e.updateMetaData)==null||n.call(e,{promptKey:e.promptKey,name:e.name,value:s.target.checked})}})]})},ce=d.createContext({topFields:[],calcInputList:[],showNodeName:!1,updateTopField(){}}),gs={[P.Input]:cs,[P.InputSlider]:us,[P.Select]:ds,[P.Textarea]:hs,[P.Checkbox]:xs,NoSupport:fs},ms=LiteGraph.registered_node_types;function ps(e,t){var o,a,l,c,i;const s=(o=ms[e])==null?void 0:o.nodeData,n={...((a=s==null?void 0:s.input)==null?void 0:a.required)??{},...((l=s==null?void 0:s.input)==null?void 0:l.optional)??{}}[t];return(n==null?void 0:n[0])==="STRING"?(c=n==null?void 0:n[1])!=null&&c.multiline?{type:P.Textarea}:{type:P.Input}:(n==null?void 0:n[0])==="BOOLEAN"?{type:P.Checkbox}:(n==null?void 0:n[0])==="FLOAT"?{...(n==null?void 0:n[1])??{},type:P.InputSlider}:(n==null?void 0:n[0])==="INT"?{...(n==null?void 0:n[1])??{},type:P.InputSlider}:Array.isArray(n==null?void 0:n[0])&&((i=n==null?void 0:n[0])!=null&&i.every(u=>typeof u=="string"))?{options:n==null?void 0:n[0],type:P.Select}:{type:P.NoSupport}}const _e=({inputItem:e})=>{const t=ps(e.classType,e.inputName),[s,n]=d.useState(!1),o=gs[t.type??"Input"],{updateTopField:a,topFields:l}=d.useContext(ce),c=e.children[0]==="negative"||e.children[0]==="positive"?`-${e.children[0]}`:"",i={...e,label:e.label??e.inputName+c};return r.jsxs(p,{alignItems:"center",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[r.jsx(M,{size:"xs",onClick:()=>a==null?void 0:a({name:e.inputName,promptKey:e.nodeID,class_type:e.classType}),variant:"ghost",icon:re(l,{name:e.inputName,promptKey:e.nodeID,classType:e.classType})?r.jsx(Tt,{size:14}):r.jsx(Et,{size:14}),"aria-label":"pin"}),r.jsx("div",{style:{flex:1},children:r.jsx(o,{inputItem:i,...t})})]})};function vs(){const{topFields:e,updateTopField:t,calcInputList:s}=d.useContext(ce);return e.length===0?null:r.jsx(r.Fragment,{children:r.jsx(p,{px:2,gap:2,direction:"column",children:e==null?void 0:e.map(n=>{const o=s.find(a=>a.nodeID==n.promptKey&&a.inputName===n.name&&a.classType===n.class_type);return!n.class_type||!o?null:r.jsx(_e,{inputItem:o},`formTopField${n.promptKey}${n.name}`)})})})}function ys(){const{topFields:e,calcInputList:t,showNodeName:s}=d.useContext(ce),n=d.useCallback(a=>{const l=[];return a.forEach(c=>{const i=l[l.length-1];!i||i[0].nodeID!==c.nodeID||i[0].classType!==c.classType?l.push([c]):i.push(c)}),l},[]);if(d.useEffect(()=>{},[s]),!s)return r.jsx(Ee,{children:t.map(a=>re(e,{name:a.inputName,promptKey:a.nodeID,classType:a.classType})?null:r.jsx(_e,{inputItem:a},`form${a.nodeID}${a.inputName}`))});const o=n(t);return r.jsx(Ee,{children:o.map(a=>a[0]?r.jsx(ws,{title:a[0].classType+" #"+a[0].nodeID,children:r.jsx(p,{px:2,gap:1,direction:"column",children:a.map(l=>re(e,{name:l.inputName,promptKey:l.nodeID,classType:l.classType})?null:r.jsx(_e,{inputItem:l},`form${l.nodeID}${l.inputName}`))})},a[0].nodeID):null)})}function ws({title:e,children:t}){return r.jsxs(ht,{border:"1px",borderColor:"gray.500",borderRadius:"md",p:4,children:[r.jsx(W,{size:"sm",mb:1,color:"GrayText",children:e}),r.jsx("div",{children:t})]})}let se=[],ze=new Set;function Nt(e,t){if(!ze.has(e.nodeID))return ze.add(e.nodeID),Object.entries(e.inputs).forEach(([s,n])=>{if(Array.isArray(n)){const o=n[0];Nt(t[o],t)}}),Object.entries(e.inputs).forEach(([s,n])=>{Array.isArray(n)||se.push({classType:e.class_type,inputName:s,inputValue:n,nodeID:e.nodeID,children:e.children||[]})}),se}function Ss(e){se=[],ze=new Set;for(const t of Object.keys(e))e[t].nodeID=t,Object.entries(e[t].inputs).forEach(([s,n])=>{if(Array.isArray(n)){const o=n[0],a=e[o];a.children||(a.children=[]),a.children.push(s)}});for(const t of Object.keys(e))Nt(e[t],e);return se}const re=(e,t)=>e==null?void 0:e.some(s=>s.promptKey===(t==null?void 0:t.promptKey)&&s.name===(t==null?void 0:t.name)&&s.class_type===t.classType);function bs({media:e}){const[t,s]=d.useState([]),{curFlowID:n}=d.useContext(oe),[o,a]=d.useState(),[l,c]=d.useState(!0),[i,u]=d.useState(!0);d.useEffect(()=>{e?ln(`/workspace/view_media?filename=${e.localPath}`).then(m=>{a(m.prompt)}):tt.graphToPrompt(tt.graph).then(m=>{a(m.output)})},[e]),d.useEffect(()=>{if(!o)return;const m=Ss(o);s(m)},[o]);const[g,f]=d.useState([]);d.useEffect(()=>{(async()=>{var m,I;if(n){const y=(I=await((m=R)==null?void 0:m.get(n)))==null?void 0:I.topFieldsConfig;y&&(f(y),c(!1))}})()},[n]);const v=m=>{var I,y;if(re(g,{name:m.name,promptKey:m==null?void 0:m.promptKey,classType:(m==null?void 0:m.class_type)??""})){const w=g.filter(E=>E.name!==m.name||E.promptKey!==m.promptKey);f(w),n&&((I=R)==null||I.updateTopFields(n,{topFieldsConfig:w}))}else{const w=[...g,m];f(w),n&&((y=R)==null||y.updateTopFields(n,{topFieldsConfig:w}))}};return r.jsx(ce.Provider,{value:{topFields:g,showNodeName:i,calcInputList:t,updateTopField:v},children:r.jsxs(p,{direction:"column",align:"stretch",gap:5,children:[r.jsx(vs,{}),r.jsxs(Y,{children:[r.jsx("p",{children:"Show all inputs"}),r.jsx(rt,{isChecked:l,onChange:m=>c(!l)}),r.jsx("p",{children:"Show node names"}),r.jsx(rt,{isChecked:i,onChange:m=>u(!i)})]}),l&&r.jsx(ys,{})]})})}const ue=d.createContext({showAllImages:!1,curMedia:null,setCurMedia(){},setMediaList(){},setShowAllImages(){}}),js=({media:e})=>{var l,c;const[t,s]=d.useState(!1),{setMediaList:n}=d.useContext(ue),{loadFilePath:o}=d.useContext(oe),{showDialog:a}=ut();return d.useEffect(()=>{var i,u;s((e==null?void 0:e.localPath)!=null&&((u=(i=R)==null?void 0:i.curWorkflow)==null?void 0:u.coverMediaPath)===(e==null?void 0:e.localPath))},[e]),e?r.jsxs(p,{flexWrap:"wrap",gap:3,children:[r.jsx(p,{alignItems:"center",gap:2,children:e.localPath&&r.jsxs(r.Fragment,{children:[r.jsx(W,{children:e==null?void 0:e.localPath}),r.jsx(A,{label:"Donwload image from gallery",children:r.jsx(Ne,{href:`/workspace/view_media?filename=${e==null?void 0:e.localPath}`,download:e==null?void 0:e.localPath,children:r.jsx(M,{size:"sm",icon:r.jsx(ft,{size:19}),"aria-label":"donwload image from gallery"})})})]})}),r.jsx(p,{gap:1,alignItems:"center",color:"GrayText",children:!!(e!=null&&e.createTime)&&r.jsx(W,{children:xt((e==null?void 0:e.createTime)??0,!0)})}),r.jsx(A,{label:"Remove image from gallery",children:r.jsx(M,{size:"sm",variant:"ghost",icon:r.jsx(gt,{size:19}),"aria-label":"remove image from gallery",colorScheme:"red",onClick:async()=>{var u;confirm("Are you sure to remove this image from gallery? (won't delete image on your disk)")&&(await((u=F)==null?void 0:u.delete(e.id)),n(g=>g.filter(f=>f.id!==e.id)))}})}),((c=(l=R)==null?void 0:l.curWorkflow)==null?void 0:c.id)&&r.jsx(A,{label:"Set as cover",children:r.jsx(M,{size:"sm",variant:"ghost",icon:t?r.jsx(Tt,{size:19}):r.jsx(Et,{size:19}),"aria-label":"set as cover",onClick:async()=>{var i;await((i=R)==null?void 0:i.updateMetaInfo(R.curWorkflow.id,{coverMediaPath:t?void 0:e.localPath})),s(!t)}})}),r.jsx(dt,{onClick:()=>a("How do you want to load this workflow?",[{label:"Load in new workflow",onClick:()=>{o(e.localPath)},colorScheme:"teal"},{label:"Overwrite current workflow",onClick:()=>o(e.localPath,!0),colorScheme:"red"}]),size:"sm",children:"Load"})]}):null},ks=({media:e})=>r.jsxs(p,{overflowY:"auto",mb:4,direction:"column",gap:2,flex:1,children:[r.jsx(js,{media:e}),r.jsx(bs,{media:e??null})]}),Te=120;function Ps({mediaList:e}){const{curMedia:t,setCurMedia:s}=d.useContext(ue);return r.jsxs(p,{gap:3,h:"100%",children:[r.jsxs(Sn,{gridTemplateRows:e.length<=6?"1fr 20%":"1fr",flex:1,gap:2,children:[r.jsx("div",{style:{height:"56vh"},children:r.jsx(is,{media:e.map(n=>({id:n.id,imageUrl:`/workspace/view_media?filename=${n.localPath}`})),currentNum:(e==null?void 0:e.findIndex(n=>n.id===(t==null?void 0:t.id)))??0,setMediaAct:n=>s((e==null?void 0:e.find(o=>o.id===n.id))??null)})}),r.jsx(p,{wrap:"wrap",children:e==null?void 0:e.map(n=>r.jsx(ht,{display:"inline-block",p:1,borderRadius:"4px",width:`${Te+3}px`,height:`${Te+3}px`,cursor:"pointer",border:(t==null?void 0:t.id)===n.id?"1px solid gray":"",onClick:()=>s(n),children:r.jsx(mt,{mediaLocalPath:n.localPath,size:Te,objectFit:"contain",hideBrokenImage:!0,onBrokenLink:()=>{var o;(o=F)==null||o.delete(n.id)}})},`image-bottom-${n.id}`))})]}),r.jsx(ks,{media:t??void 0})]})}const Cs=({media:e,isSelecting:t,selectedID:s,onClickMedia:n})=>{const{curFlowID:a,loadFilePath:l}=d.useContext(oe),{showDialog:c}=ut();if(e.localPath==null||a==null)return null;const i=r.jsxs(Ne,{isExternal:!0,onClick:()=>n(e),position:"relative",children:[t&&r.jsx(Ae,{isChecked:s.includes(e.id),position:"absolute",top:2,left:2}),r.jsx(mt,{mediaLocalPath:e.localPath,size:180,onBrokenLink:()=>{var u;(u=F)==null||u.delete(e.id)},hideBrokenImage:!0,autoPlay:!0,isPreview:!0})]});return r.jsxs(Ee,{width:180,mb:2,children:[r.jsx(A,{label:xt(e.createTime,!0),children:i}),r.jsx(A,{label:e.localPath,children:r.jsx(W,{color:"GrayText",noOfLines:1,children:e.localPath})}),r.jsxs(Y,{hidden:t,gap:0,children:[r.jsx(dt,{flexGrow:1,onClick:()=>c("How do you want to load this workflow?",[{label:"Load in new workflow",onClick:()=>{l(e.localPath)},colorScheme:"teal"},{label:"Overwrite current workflow",onClick:()=>l(e.localPath,!0),colorScheme:"red"}]),size:"sm",children:"Load"}),r.jsx(A,{label:"Donwload image from gallery",children:r.jsx(Ne,{href:`/workspace/view_media?filename=${e.localPath}`,download:e.localPath,children:r.jsx(M,{size:"sm",variant:"ghost",icon:r.jsx(ft,{size:19}),"aria-label":"donwload image from gallery"})})}),r.jsx(A,{label:"Remove image from gallery",children:r.jsx(M,{size:"sm",variant:"ghost",icon:r.jsx(gt,{size:19}),"aria-label":"remove image from gallery",colorScheme:"red",onClick:async()=>{var g;confirm("Are you sure to remove this image from gallery? (won't delete image on your disk)")&&await((g=F)==null?void 0:g.delete(e.id))}})})]})]})},Is=Cs;function Ts({searchQuery:e}){const[t,s]=d.useState([]),{setCurMedia:n,setShowAllImages:o,setMediaList:a}=d.useContext(ue);d.useEffect(()=>{var c,i;e===""?(c=F)==null||c.listAll().then(u=>{s(u.slice(0,50)??[])}):(i=F)==null||i.filter(u=>{var g;return((g=u.workflowJSON)==null?void 0:g.includes(e))??!1}).then(u=>{s(u)})},[e]);const l=c=>{a([c].concat(t.filter(i=>i.id!==c.id))),n(c),o(!1)};return r.jsx(Y,{wrap:"wrap",children:t.map(c=>r.jsx(Is,{selectedID:[],media:c,isSelecting:!1,onClickMedia:l},c.id))})}function Vs({onclose:e}){const{curFlowID:t}=d.useContext(oe),[s,n]=d.useState(""),[o,a]=d.useState([]),[l,c]=d.useState(!1),[i,u]=d.useState([]),[g,f]=d.useState(),[v,m]=d.useState(""),I=vn(v,300),[y,w]=d.useState(!1),E=async()=>{var D;if(t==null)return;const b=await((D=F)==null?void 0:D.listByWorkflowID(t));u(b??[]),b!=null&&b.length&&f(b[0])};if(d.useEffect(()=>{var b;E(),t&&((b=R)==null||b.get(t).then(D=>{D&&n(D.name)}))},[]),t==null)return null;const $=i.length>0&&o.length===i.length;return r.jsx(ue.Provider,{value:{curMedia:g??null,setCurMedia:f,setMediaList:u,showAllImages:y,setShowAllImages:w},children:r.jsxs(Zt,{isOpen:!0,onClose:e,blockScrollOnMount:!0,children:[r.jsx(qt,{}),r.jsxs(Jt,{width:"90%",maxWidth:"90vw",height:"90vh",children:[r.jsxs(Qt,{children:[r.jsxs(Y,{gap:2,mb:2,children:[r.jsxs(cn,{size:"md",mr:2,children:["Gallery - ",s]}),r.jsx(yn,{searchValue:v,onUpdateSearchValue:b=>{m(b),y||w(!0)},placeholder:"Search prompt, model name, etc.",style:{width:"300px"}})]}),l&&r.jsxs(Y,{gap:3,children:[r.jsx(Ae,{isChecked:$,onChange:()=>{a($?[]:i.map(b=>b.id))},children:"All"}),r.jsxs(W,{fontSize:16,children:[o.length," Selected"]}),r.jsx(M,{size:"sm",icon:r.jsx(un,{size:19}),onClick:()=>c(!1),"aria-label":"cancel"})]})]}),r.jsx(en,{}),r.jsx(tn,{overflowY:"auto",children:y?r.jsx(Ts,{searchQuery:I}):r.jsx(Ps,{mediaList:i})})]})]})})}export{Vs as default}; diff --git a/dist/workspace_web/IconCopy-NWmMWcgf.js b/dist/workspace_web/IconCopy-HLdZF5TO.js similarity index 83% rename from dist/workspace_web/IconCopy-NWmMWcgf.js rename to dist/workspace_web/IconCopy-HLdZF5TO.js index 853597d..fc31fc4 100644 --- a/dist/workspace_web/IconCopy-NWmMWcgf.js +++ b/dist/workspace_web/IconCopy-HLdZF5TO.js @@ -1 +1 @@ -import{d as a}from"./App-6SVuhhTl.js";var p=a("copy","IconCopy",[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]]);export{p as I}; +import{d as a}from"./App-4M5AgwD2.js";var p=a("copy","IconCopy",[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]]);export{p as I}; diff --git a/dist/workspace_web/IconSearch-fViKszW1.js b/dist/workspace_web/IconSearch-E56kR4uG.js similarity index 67% rename from dist/workspace_web/IconSearch-fViKszW1.js rename to dist/workspace_web/IconSearch-E56kR4uG.js index 14e843a..2840a9d 100644 --- a/dist/workspace_web/IconSearch-fViKszW1.js +++ b/dist/workspace_web/IconSearch-E56kR4uG.js @@ -1 +1 @@ -import{d as a}from"./App-6SVuhhTl.js";var r=a("search","IconSearch",[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]]);export{r as I}; +import{d as a}from"./App-4M5AgwD2.js";var r=a("search","IconSearch",[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]]);export{r as I}; diff --git a/dist/workspace_web/InstallMissingModelsButton-1brz--TF.js b/dist/workspace_web/InstallMissingModelsButton-O1ft6LSd.js similarity index 94% rename from dist/workspace_web/InstallMissingModelsButton-1brz--TF.js rename to dist/workspace_web/InstallMissingModelsButton-O1ft6LSd.js index 7ba09f9..2f8952c 100644 --- a/dist/workspace_web/InstallMissingModelsButton-1brz--TF.js +++ b/dist/workspace_web/InstallMissingModelsButton-O1ft6LSd.js @@ -1 +1 @@ -import{r as o,j as e,i as C,P as b}from"./input.js";import{a5 as x,aj as S,g as I,h as v,H as y,i as k,ae as E,_ as F,aq as A,Z as D,av as z,f as H,B as L,a6 as P,a7 as R,aS as T,F as G,ag as O,aH as q}from"./App-6SVuhhTl.js";import{G as N,i as U}from"./ModelManagerTopbar-F18nYkv6.js";import{C as W,G as B}from"./chunk-JARCRF6W-r8MNagok.js";import{S as K}from"./chunk-3RSXBRAN-2SG_K1_B.js";import"/scripts/api.js";import"./chunk-7D6N5TE5-NbopAz8o.js";const Y="https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.png",Z="https://images.crunchbase.com/image/upload/c_pad,h_170,w_170,f_auto,b_white,q_auto:eco,dpr_1/gtxrcmtsvpjjevozblfa";function $({model:l,selectedModelDeps:c,setSelectedModelDeps:n,foldersList:d,setFoldersList:h}){var m,t,a,g,_;const[s,u]=o.useState(),p=(a=(t=(m=x.graph.extra)==null?void 0:m[S])==null?void 0:t.deps)==null?void 0:a.models;o.useEffect(()=>{(async()=>{var f;if(p){const M=p[l.received_value];if((f=p[l.received_value])!=null&&f.downloadUrl){const w=await A.models.where({fileHash:M.fileHash}).toArray();w[0]?u({existingModel:w[0].fileName}):u(M)}}})()},[]);const j=c.map(i=>i.filename);function r(i){return i.existingModel!=null}return e.jsx(N,{p:3,shadow:"md",borderWidth:"1px",children:e.jsxs(I,{align:"start",children:[e.jsx(v,{children:l.class_type}),e.jsx(y,{ml:3,children:e.jsx(v,{color:"red.400",children:l.received_value})}),s&&r(s)&&e.jsxs(v,{children:["This model is already installed as"," ",e.jsx(v,{as:"span",color:"blue.400",fontWeight:600,children:s.existingModel})]}),s&&!r(s)&&s.fileFolder&&e.jsxs(e.Fragment,{children:[e.jsxs(y,{children:[e.jsx(W,{size:"sm",isChecked:j.includes(s.filename),onChange:i=>{i.target.checked?n([...c,p[l.received_value]]):n(c.filter(f=>f.filename!==s.filename))}},s.filename),e.jsx(k,{label:s.infoUrl,children:e.jsx(C,{size:"sm",onClick:i=>{i.stopPropagation(),window.open(s.infoUrl??"","_blank")},leftIcon:e.jsx(E,{width:5,src:(g=s.downloadUrl)!=null&&g.includes("huggingface")?Y:Z}),rightIcon:e.jsx(F,{size:20}),children:s.filename})})]}),e.jsxs(I,{children:[e.jsx(v,{width:"fit-content",children:"Install path:"}),((_=d[s.fileFolder])==null?void 0:_.length)&&e.jsx(K,{value:d[s.fileFolder].at(0),onChange:i=>{const f={...d},M=f[s.fileFolder].filter(w=>w!==i.target.value);f[s.fileFolder]=[i.target.value,...M],h(f)},children:d[s.fileFolder].map(i=>e.jsx("option",{value:i,children:i},i))})]})]}),!s&&e.jsx(C,{colorScheme:"blue",mt:5,iconSpacing:1,leftIcon:e.jsx(F,{size:20}),size:"sm",onClick:()=>{window.open(`https://civitai.com/search/models?sortBy=models_v7&query=${l.received_value}`,"_blank")},children:"Search in CivitAI"})]})})}function V({onClose:l,missingModels:c}){o.useEffect(()=>(x.canvasEl.addEventListener("click",l),()=>{x.canvasEl.removeEventListener("click",l)}),[]);const[n,d]=o.useState([]),[h,s]=o.useState({}),{setRoute:u}=o.useContext(D),p=o.useCallback(async()=>{const t=await z();t&&s(t)},[]),j=H();o.useEffect(()=>{p()},[]);const r=480,m=()=>{n.forEach(t=>{let a=t.downloadUrl;if(!a||!t.fileFolder||!h[t.fileFolder][0]){j({title:"Error",description:a?"Model install folder path is missing":"Download URL is missing",status:"error",duration:4e3,isClosable:!0});return}if(a.includes("civitai")){const g=q();g&&(a+=`?token=${g}`)}U({file_hash:t.fileHash??void 0,filename:t.filename,save_path:h[t.fileFolder][0],url:a,force_filename:!0})}),j({title:"Installing...Please open Install Models modal or python terminal to view progress.",description:n.map(t=>t.filename).join(", "),status:"info",duration:4e3,isClosable:!0}),u("installModels")};return e.jsx(b,{children:e.jsx(L,{style:{width:r},children:e.jsxs(P,{width:r,height:"100vh",p:4,gap:2,position:"fixed",top:0,left:0,shadow:"xl",zIndex:R,overflowY:"auto",children:[e.jsx(T,{children:e.jsx(G,{justifyContent:"space-between",alignContent:"center",children:e.jsx(O,{size:"md",mr:2,children:"Missing Models"})})}),e.jsxs(C,{width:"fit-content",colorScheme:"teal",size:"sm",onClick:m,children:["Install Selected (",n.length,")"]}),e.jsx(B,{templateColumns:"1",gap:1,marginTop:2,width:"100%",children:c.map(t=>e.jsx($,{model:t,setSelectedModelDeps:d,selectedModelDeps:n,foldersList:h,setFoldersList:s},t.received_value))})]})})})}function ae({}){const[l,c]=o.useState(!1),[n,d]=o.useState([]);return o.useEffect(()=>{const h=x.queuePrompt;x.queuePrompt=async function(){var s,u;try{await h.apply(this,arguments)}finally{if(!((u=(s=x.graph.extra)==null?void 0:s[S])==null?void 0:u.deps))return;const j=x.lastNodeErrors??{};d(Object.values(j).flatMap(r=>{var m,t;return(t=(m=r==null?void 0:r.errors)==null?void 0:m.filter(a=>(a==null?void 0:a.type)==="value_not_in_list"))==null?void 0:t.map(a=>{const{input_name:g,received_value:_}=a.extra_info;return{class_type:r.class_type,input_name:g,received_value:_}})}))}}},[]),n.length===0?null:e.jsxs(e.Fragment,{children:[e.jsxs(C,{size:"sm","aria-label":"missing models",px:2,onClick:()=>c(!0),colorScheme:"teal",children:["Install Missing (",n.length,")"]}),l&&e.jsx(V,{onClose:()=>c(!1),missingModels:n})]})}export{ae as default}; +import{r as o,j as e,i as C,P as b}from"./input.js";import{a5 as x,aj as S,g as I,h as v,H as y,i as k,ae as E,_ as F,aq as A,Z as D,av as z,f as H,B as L,a6 as P,a7 as R,aS as T,F as G,ag as O,aH as q}from"./App-4M5AgwD2.js";import{G as N,i as U}from"./ModelManagerTopbar-xV84Rv4k.js";import{C as W,G as B}from"./chunk-JARCRF6W-ibNbyhHV.js";import{S as K}from"./chunk-3RSXBRAN-D3gE_K4K.js";import"/scripts/api.js";import"./chunk-7D6N5TE5-zfYf6Y9A.js";const Y="https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.png",Z="https://images.crunchbase.com/image/upload/c_pad,h_170,w_170,f_auto,b_white,q_auto:eco,dpr_1/gtxrcmtsvpjjevozblfa";function $({model:l,selectedModelDeps:c,setSelectedModelDeps:n,foldersList:d,setFoldersList:h}){var m,t,a,g,_;const[s,u]=o.useState(),p=(a=(t=(m=x.graph.extra)==null?void 0:m[S])==null?void 0:t.deps)==null?void 0:a.models;o.useEffect(()=>{(async()=>{var f;if(p){const M=p[l.received_value];if((f=p[l.received_value])!=null&&f.downloadUrl){const w=await A.models.where({fileHash:M.fileHash}).toArray();w[0]?u({existingModel:w[0].fileName}):u(M)}}})()},[]);const j=c.map(i=>i.filename);function r(i){return i.existingModel!=null}return e.jsx(N,{p:3,shadow:"md",borderWidth:"1px",children:e.jsxs(I,{align:"start",children:[e.jsx(v,{children:l.class_type}),e.jsx(y,{ml:3,children:e.jsx(v,{color:"red.400",children:l.received_value})}),s&&r(s)&&e.jsxs(v,{children:["This model is already installed as"," ",e.jsx(v,{as:"span",color:"blue.400",fontWeight:600,children:s.existingModel})]}),s&&!r(s)&&s.fileFolder&&e.jsxs(e.Fragment,{children:[e.jsxs(y,{children:[e.jsx(W,{size:"sm",isChecked:j.includes(s.filename),onChange:i=>{i.target.checked?n([...c,p[l.received_value]]):n(c.filter(f=>f.filename!==s.filename))}},s.filename),e.jsx(k,{label:s.infoUrl,children:e.jsx(C,{size:"sm",onClick:i=>{i.stopPropagation(),window.open(s.infoUrl??"","_blank")},leftIcon:e.jsx(E,{width:5,src:(g=s.downloadUrl)!=null&&g.includes("huggingface")?Y:Z}),rightIcon:e.jsx(F,{size:20}),children:s.filename})})]}),e.jsxs(I,{children:[e.jsx(v,{width:"fit-content",children:"Install path:"}),((_=d[s.fileFolder])==null?void 0:_.length)&&e.jsx(K,{value:d[s.fileFolder].at(0),onChange:i=>{const f={...d},M=f[s.fileFolder].filter(w=>w!==i.target.value);f[s.fileFolder]=[i.target.value,...M],h(f)},children:d[s.fileFolder].map(i=>e.jsx("option",{value:i,children:i},i))})]})]}),!s&&e.jsx(C,{colorScheme:"blue",mt:5,iconSpacing:1,leftIcon:e.jsx(F,{size:20}),size:"sm",onClick:()=>{window.open(`https://civitai.com/search/models?sortBy=models_v7&query=${l.received_value}`,"_blank")},children:"Search in CivitAI"})]})})}function V({onClose:l,missingModels:c}){o.useEffect(()=>(x.canvasEl.addEventListener("click",l),()=>{x.canvasEl.removeEventListener("click",l)}),[]);const[n,d]=o.useState([]),[h,s]=o.useState({}),{setRoute:u}=o.useContext(D),p=o.useCallback(async()=>{const t=await z();t&&s(t)},[]),j=H();o.useEffect(()=>{p()},[]);const r=480,m=()=>{n.forEach(t=>{let a=t.downloadUrl;if(!a||!t.fileFolder||!h[t.fileFolder][0]){j({title:"Error",description:a?"Model install folder path is missing":"Download URL is missing",status:"error",duration:4e3,isClosable:!0});return}if(a.includes("civitai")){const g=q();g&&(a+=`?token=${g}`)}U({file_hash:t.fileHash??void 0,filename:t.filename,save_path:h[t.fileFolder][0],url:a,force_filename:!0})}),j({title:"Installing...Please open Install Models modal or python terminal to view progress.",description:n.map(t=>t.filename).join(", "),status:"info",duration:4e3,isClosable:!0}),u("installModels")};return e.jsx(b,{children:e.jsx(L,{style:{width:r},children:e.jsxs(P,{width:r,height:"100vh",p:4,gap:2,position:"fixed",top:0,left:0,shadow:"xl",zIndex:R,overflowY:"auto",children:[e.jsx(T,{children:e.jsx(G,{justifyContent:"space-between",alignContent:"center",children:e.jsx(O,{size:"md",mr:2,children:"Missing Models"})})}),e.jsxs(C,{width:"fit-content",colorScheme:"teal",size:"sm",onClick:m,children:["Install Selected (",n.length,")"]}),e.jsx(B,{templateColumns:"1",gap:1,marginTop:2,width:"100%",children:c.map(t=>e.jsx($,{model:t,setSelectedModelDeps:d,selectedModelDeps:n,foldersList:h,setFoldersList:s},t.received_value))})]})})})}function ae({}){const[l,c]=o.useState(!1),[n,d]=o.useState([]);return o.useEffect(()=>{const h=x.queuePrompt;x.queuePrompt=async function(){var s,u;try{await h.apply(this,arguments)}finally{if(!((u=(s=x.graph.extra)==null?void 0:s[S])==null?void 0:u.deps))return;const j=x.lastNodeErrors??{};d(Object.values(j).flatMap(r=>{var m,t;return(t=(m=r==null?void 0:r.errors)==null?void 0:m.filter(a=>(a==null?void 0:a.type)==="value_not_in_list"))==null?void 0:t.map(a=>{const{input_name:g,received_value:_}=a.extra_info;return{class_type:r.class_type,input_name:g,received_value:_}})}))}}},[]),n.length===0?null:e.jsxs(e.Fragment,{children:[e.jsxs(C,{size:"sm","aria-label":"missing models",px:2,onClick:()=>c(!0),colorScheme:"teal",children:["Install Missing (",n.length,")"]}),l&&e.jsx(V,{onClose:()=>c(!1),missingModels:n})]})}export{ae as default}; diff --git a/dist/workspace_web/MediaPreview-j_Hhr-lH.js b/dist/workspace_web/MediaPreview-TJpk-on-.js similarity index 98% rename from dist/workspace_web/MediaPreview-j_Hhr-lH.js rename to dist/workspace_web/MediaPreview-TJpk-on-.js index f5f92d6..6535c63 100644 --- a/dist/workspace_web/MediaPreview-j_Hhr-lH.js +++ b/dist/workspace_web/MediaPreview-TJpk-on-.js @@ -1 +1 @@ -import{d as M,r as s,j as f,I as ke,y as Oe,e as Be,m as ae,s as C,q as se,b as Pe,f as j,g as Y,l as Ke,o as Ue,h as Me}from"./input.js";import{ah as Ge,ai as qe,d as He,B as Le,I as $e,y as ze,j as We,ad as Xe,ae as Ye}from"./App-6SVuhhTl.js";import{I as Je}from"./IconSearch-fViKszW1.js";function Qe(n){const e=parseFloat(n);return typeof e!="number"||Number.isNaN(e)?0:e}function le(n,e){let r=Qe(n);const a=10**(e??10);return r=Math.round(r*a)/a,e?r.toFixed(e):r.toString()}function oe(n){if(!Number.isFinite(n))return 0;let e=1,r=0;for(;Math.round(n*e)/e!==n;)e*=10,r+=1;return r}function It(n,e,r){return(n-e)*100/(r-e)}function yt(n,e,r){return(r-e)*n+e}function Ct(n,e,r){const a=Math.round((n-e)/r)*r+e,u=oe(r);return le(a,u)}function Ze(n,e,r){return n==null?n:(r{var p;return a==null?"":(p=ue(a,o,r))!=null?p:""}),S=typeof u<"u",x=S?u:I,O=Fe(A(x),o),F=r??O,y=s.useCallback(p=>{p!==x&&(S||E(p.toString()),h==null||h(p.toString(),A(p)))},[h,S,x]),w=s.useCallback(p=>{let d=p;return b&&(d=Ze(d,i,m)),le(d,F)},[F,b,m,i]),B=s.useCallback((p=o)=>{let d;x===""?d=A(p):d=A(x)+p,d=w(d),y(d)},[w,o,y,x]),K=s.useCallback((p=o)=>{let d;x===""?d=A(-p):d=A(x)-p,d=w(d),y(d)},[w,o,y,x]),U=s.useCallback(()=>{var p;let d;a==null?d="":d=(p=ue(a,o,r))!=null?p:i,y(d)},[a,r,o,y,i]),Q=s.useCallback(p=>{var d;const ee=(d=ue(p,o,F))!=null?d:i;y(ee)},[F,o,y,i]),k=A(x);return{isOutOfRange:k>m||kf.jsx(ke,{viewBox:"0 0 24 24",...n,children:f.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),nt=n=>f.jsx(ke,{viewBox:"0 0 24 24",...n,children:f.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function Ae(n,e,r,a){s.useEffect(()=>{var u;if(!n.current||!a)return;const o=(u=n.current.ownerDocument.defaultView)!=null?u:window,i=Array.isArray(e)?e:[e],m=new o.MutationObserver(b=>{for(const h of b)h.type==="attributes"&&h.attributeName&&i.includes(h.attributeName)&&r(h)});return m.observe(n.current,{attributes:!0,attributeFilter:i}),()=>m.disconnect()})}function rt(n,e){const r=M(n);s.useEffect(()=>{let a=null;const u=()=>r();return e!==null&&(a=window.setInterval(u,e)),()=>{a&&window.clearInterval(a)}},[e,r])}var at=50,Ee=300;function st(n,e){const[r,a]=s.useState(!1),[u,o]=s.useState(null),[i,m]=s.useState(!0),b=s.useRef(null),h=()=>clearTimeout(b.current);rt(()=>{u==="increment"&&n(),u==="decrement"&&e()},r?at:null);const I=s.useCallback(()=>{i&&n(),b.current=setTimeout(()=>{m(!1),a(!0),o("increment")},Ee)},[n,i]),E=s.useCallback(()=>{i&&e(),b.current=setTimeout(()=>{m(!1),a(!0),o("decrement")},Ee)},[e,i]),S=s.useCallback(()=>{m(!0),a(!1),h()},[]);return s.useEffect(()=>()=>h(),[]),{up:I,down:E,stop:S,isSpinning:r}}var ut=/^[Ee0-9+\-.]$/;function ot(n){return ut.test(n)}function lt(n,e){if(n.key==null)return!0;const r=n.ctrlKey||n.altKey||n.metaKey;return!(n.key.length===1)||r?!0:e(n.key)}function it(n={}){const{focusInputOnChange:e=!0,clampValueOnBlur:r=!0,keepWithinRange:a=!0,min:u=Number.MIN_SAFE_INTEGER,max:o=Number.MAX_SAFE_INTEGER,step:i=1,isReadOnly:m,isDisabled:b,isRequired:h,isInvalid:I,pattern:E="[0-9]*(.[0-9]+)?",inputMode:S="decimal",allowMouseWheel:x,id:O,onChange:F,precision:y,name:w,"aria-describedby":B,"aria-label":K,"aria-labelledby":U,onFocus:Q,onBlur:k,onInvalid:ce,getAriaValueText:de,isValidCharacter:Z,format:p,parse:d,...ee}=n,te=M(Q),pe=M(k),V=M(ce),G=M(Z??ot),ne=M(de),l=et(n),{update:T,increment:me,decrement:fe}=l,[Ve,re]=s.useState(!1),q=!(m||b),_=s.useRef(null),H=s.useRef(null),be=s.useRef(null),ve=s.useRef(null),L=s.useCallback(t=>t.split("").filter(G).join(""),[G]),$=s.useCallback(t=>{var c;return(c=d==null?void 0:d(t))!=null?c:t},[d]),R=s.useCallback(t=>{var c;return((c=p==null?void 0:p(t))!=null?c:t).toString()},[p]);Oe(()=>{(l.valueAsNumber>o||l.valueAsNumber{if(!_.current)return;if(_.current.value!=l.value){const c=$(_.current.value);l.setValue(L(c))}},[$,L]);const z=s.useCallback((t=i)=>{q&&me(t)},[me,q,i]),W=s.useCallback((t=i)=>{q&&fe(t)},[fe,q,i]),g=st(z,W);Ae(be,"disabled",g.stop,g.isSpinning),Ae(ve,"disabled",g.stop,g.isSpinning);const he=s.useCallback(t=>{if(t.nativeEvent.isComposing)return;const v=$(t.currentTarget.value);T(L(v)),H.current={start:t.currentTarget.selectionStart,end:t.currentTarget.selectionEnd}},[T,L,$]),ge=s.useCallback(t=>{var c,v,N;te==null||te(t),H.current&&(t.target.selectionStart=(v=H.current.start)!=null?v:(c=t.currentTarget.value)==null?void 0:c.length,t.currentTarget.selectionEnd=(N=H.current.end)!=null?N:t.currentTarget.selectionStart)},[te]),xe=s.useCallback(t=>{if(t.nativeEvent.isComposing)return;lt(t,G)||t.preventDefault();const c=Ne(t)*i,v=t.key,P={ArrowUp:()=>z(c),ArrowDown:()=>W(c),Home:()=>T(u),End:()=>T(o)}[v];P&&(t.preventDefault(),P(t))},[G,i,z,W,T,u,o]),Ne=t=>{let c=1;return(t.metaKey||t.ctrlKey)&&(c=.1),t.shiftKey&&(c=10),c},Ie=s.useMemo(()=>{const t=ne==null?void 0:ne(l.value);if(t!=null)return t;const c=l.value.toString();return c||void 0},[l.value,ne]),ye=s.useCallback(()=>{let t=l.value;if(l.value==="")return;/^[eE]/.test(l.value.toString())?l.setValue(""):(l.valueAsNumbero&&(t=o),l.cast(t))},[l,o,u]),Ce=s.useCallback(()=>{re(!1),r&&ye()},[r,re,ye]),X=s.useCallback(()=>{e&&requestAnimationFrame(()=>{var t;(t=_.current)==null||t.focus()})},[e]),Se=s.useCallback(t=>{t.preventDefault(),g.up(),X()},[X,g]),we=s.useCallback(t=>{t.preventDefault(),g.down(),X()},[X,g]);Ge(()=>_.current,"wheel",t=>{var c,v;const P=((v=(c=_.current)==null?void 0:c.ownerDocument)!=null?v:document).activeElement===_.current;if(!x||!P)return;t.preventDefault();const D=Ne(t)*i,_e=Math.sign(t.deltaY);_e===-1?z(D):_e===1&&W(D)},{passive:!1});const Te=s.useCallback((t={},c=null)=>{const v=b||a&&l.isAtMax;return{...t,ref:ae(c,be),role:"button",tabIndex:-1,onPointerDown:C(t.onPointerDown,N=>{N.button!==0||v||Se(N)}),onPointerLeave:C(t.onPointerLeave,g.stop),onPointerUp:C(t.onPointerUp,g.stop),disabled:v,"aria-disabled":se(v)}},[l.isAtMax,a,Se,g.stop,b]),De=s.useCallback((t={},c=null)=>{const v=b||a&&l.isAtMin;return{...t,ref:ae(c,ve),role:"button",tabIndex:-1,onPointerDown:C(t.onPointerDown,N=>{N.button!==0||v||we(N)}),onPointerLeave:C(t.onPointerLeave,g.stop),onPointerUp:C(t.onPointerUp,g.stop),disabled:v,"aria-disabled":se(v)}},[l.isAtMin,a,we,g.stop,b]),je=s.useCallback((t={},c=null)=>{var v,N,P,D;return{name:w,inputMode:S,type:"text",pattern:E,"aria-labelledby":U,"aria-label":K,"aria-describedby":B,id:O,disabled:b,...t,readOnly:(v=t.readOnly)!=null?v:m,"aria-readonly":(N=t.readOnly)!=null?N:m,"aria-required":(P=t.required)!=null?P:h,required:(D=t.required)!=null?D:h,ref:ae(_,c),value:R(l.value),role:"spinbutton","aria-valuemin":u,"aria-valuemax":o,"aria-valuenow":Number.isNaN(l.valueAsNumber)?void 0:l.valueAsNumber,"aria-invalid":se(I??l.isOutOfRange),"aria-valuetext":Ie,autoComplete:"off",autoCorrect:"off",onChange:C(t.onChange,he),onKeyDown:C(t.onKeyDown,xe),onFocus:C(t.onFocus,ge,()=>re(!0)),onBlur:C(t.onBlur,pe,Ce)}},[w,S,E,U,K,R,B,O,b,h,m,I,l.value,l.valueAsNumber,l.isOutOfRange,u,o,Ie,he,xe,ge,pe,Ce]);return{value:R(l.value),valueAsNumber:l.valueAsNumber,isFocused:Ve,isDisabled:b,isReadOnly:m,getIncrementButtonProps:Te,getDecrementButtonProps:De,getInputProps:je,htmlProps:ee}}var[ct,J]=Pe({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[dt,ie]=Pe({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),pt=j(function(e,r){const a=Ke("NumberInput",e),u=Ue(e),o=qe(u),{htmlProps:i,...m}=it(o),b=s.useMemo(()=>m,[m]);return f.jsx(dt,{value:b,children:f.jsx(ct,{value:a,children:f.jsx(Y.div,{...i,ref:r,className:Me("chakra-numberinput",e.className),__css:{position:"relative",zIndex:0,...a.root}})})})});pt.displayName="NumberInput";var mt=j(function(e,r){const a=J();return f.jsx(Y.div,{"aria-hidden":!0,ref:r,...e,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...a.stepperGroup}})});mt.displayName="NumberInputStepper";var ft=j(function(e,r){const{getInputProps:a}=ie(),u=a(e,r),o=J();return f.jsx(Y.input,{...u,className:Me("chakra-numberinput__field",e.className),__css:{width:"100%",...o.field}})});ft.displayName="NumberInputField";var Re=Y("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),bt=j(function(e,r){var a;const u=J(),{getDecrementButtonProps:o}=ie(),i=o(e,r);return f.jsx(Re,{...i,__css:u.stepper,children:(a=e.children)!=null?a:f.jsx(tt,{})})});bt.displayName="NumberDecrementStepper";var vt=j(function(e,r){var a;const{getIncrementButtonProps:u}=ie(),o=u(e,r),i=J();return f.jsx(Re,{...o,__css:i.stepper,children:(a=e.children)!=null?a:f.jsx(nt,{})})});vt.displayName="NumberIncrementStepper";var St=He("chevron-right","IconChevronRight",[["path",{d:"M9 6l6 6l-6 6",key:"svg-0"}]]);const wt=(n,e)=>{const[r,a]=s.useState(n);return s.useEffect(()=>{const u=setTimeout(()=>{a(n)},e);return()=>{clearTimeout(u)}},[n,e]),r},ht={position:"absolute",marginLeft:"10px",width:"20px",height:"20px",top:"50%",color:"#A0AEC0",transform:"translateY(-50%)"};function _t(n){const{searchValue:e,onUpdateSearchValue:r,style:a}=n,u=e!=="";return f.jsxs(Le,{style:{position:"relative",...a},mb:2,children:[f.jsx(Je,{style:ht}),u&&f.jsx($e,{size:"xs",position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",cursor:"pointer",background:"none",zIndex:"100",icon:f.jsx(ze,{width:15,height:15}),onClick:()=>r(""),"aria-label":"clear input button"}),f.jsx(We,{placeholder:n.placeholder??"Search",size:"sm",paddingLeft:"35px",paddingBlock:"5px",value:e,onChange:({target:o})=>r(o.value)})]})}function At({mediaLocalPath:n,size:e,isPreview:r,autoPlay:a,hideBrokenImage:u,objectFit:o,onBrokenLink:i}){const[m,b]=s.useState(!0);return s.useEffect(()=>{u&&(async()=>{try{if((await fetch(r?`/workspace/preview_media?filename=${n}`:`/workspace/view_media?filename=${n}`)).status==404){b(!1),i==null||i();return}}catch(I){console.error("Error checking media exists",I)}})()},[]),m?Xe(n)?f.jsx(Ye,{borderRadius:3,boxSize:`${e}px`,objectFit:o??"cover",src:`/workspace/view_media?filename=${n}`,alt:"workflow image renamed or moved from output folder"}):f.jsx("div",{style:{width:e+"px",height:e+"px",overflow:"hidden",position:"relative"},children:f.jsx("video",{width:e,height:e,src:`/workspace/view_media?filename=${n}`,loop:!0,autoPlay:a??!1,muted:!0,style:{objectFit:"cover",width:"100%",height:"100%"},children:f.jsx("track",{kind:"captions"})})}):null}export{St as I,At as M,pt as N,_t as S,ft as a,mt as b,Ze as c,vt as d,bt as e,yt as p,Ct as r,wt as u,It as v}; +import{d as M,r as s,j as f,I as ke,y as Oe,e as Be,m as ae,s as C,q as se,b as Pe,f as j,g as Y,l as Ke,o as Ue,h as Me}from"./input.js";import{ah as Ge,ai as qe,d as He,B as Le,I as $e,y as ze,j as We,ad as Xe,ae as Ye}from"./App-4M5AgwD2.js";import{I as Je}from"./IconSearch-E56kR4uG.js";function Qe(n){const e=parseFloat(n);return typeof e!="number"||Number.isNaN(e)?0:e}function le(n,e){let r=Qe(n);const a=10**(e??10);return r=Math.round(r*a)/a,e?r.toFixed(e):r.toString()}function oe(n){if(!Number.isFinite(n))return 0;let e=1,r=0;for(;Math.round(n*e)/e!==n;)e*=10,r+=1;return r}function It(n,e,r){return(n-e)*100/(r-e)}function yt(n,e,r){return(r-e)*n+e}function Ct(n,e,r){const a=Math.round((n-e)/r)*r+e,u=oe(r);return le(a,u)}function Ze(n,e,r){return n==null?n:(r{var p;return a==null?"":(p=ue(a,o,r))!=null?p:""}),S=typeof u<"u",x=S?u:I,O=Fe(A(x),o),F=r??O,y=s.useCallback(p=>{p!==x&&(S||E(p.toString()),h==null||h(p.toString(),A(p)))},[h,S,x]),w=s.useCallback(p=>{let d=p;return b&&(d=Ze(d,i,m)),le(d,F)},[F,b,m,i]),B=s.useCallback((p=o)=>{let d;x===""?d=A(p):d=A(x)+p,d=w(d),y(d)},[w,o,y,x]),K=s.useCallback((p=o)=>{let d;x===""?d=A(-p):d=A(x)-p,d=w(d),y(d)},[w,o,y,x]),U=s.useCallback(()=>{var p;let d;a==null?d="":d=(p=ue(a,o,r))!=null?p:i,y(d)},[a,r,o,y,i]),Q=s.useCallback(p=>{var d;const ee=(d=ue(p,o,F))!=null?d:i;y(ee)},[F,o,y,i]),k=A(x);return{isOutOfRange:k>m||kf.jsx(ke,{viewBox:"0 0 24 24",...n,children:f.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),nt=n=>f.jsx(ke,{viewBox:"0 0 24 24",...n,children:f.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function Ae(n,e,r,a){s.useEffect(()=>{var u;if(!n.current||!a)return;const o=(u=n.current.ownerDocument.defaultView)!=null?u:window,i=Array.isArray(e)?e:[e],m=new o.MutationObserver(b=>{for(const h of b)h.type==="attributes"&&h.attributeName&&i.includes(h.attributeName)&&r(h)});return m.observe(n.current,{attributes:!0,attributeFilter:i}),()=>m.disconnect()})}function rt(n,e){const r=M(n);s.useEffect(()=>{let a=null;const u=()=>r();return e!==null&&(a=window.setInterval(u,e)),()=>{a&&window.clearInterval(a)}},[e,r])}var at=50,Ee=300;function st(n,e){const[r,a]=s.useState(!1),[u,o]=s.useState(null),[i,m]=s.useState(!0),b=s.useRef(null),h=()=>clearTimeout(b.current);rt(()=>{u==="increment"&&n(),u==="decrement"&&e()},r?at:null);const I=s.useCallback(()=>{i&&n(),b.current=setTimeout(()=>{m(!1),a(!0),o("increment")},Ee)},[n,i]),E=s.useCallback(()=>{i&&e(),b.current=setTimeout(()=>{m(!1),a(!0),o("decrement")},Ee)},[e,i]),S=s.useCallback(()=>{m(!0),a(!1),h()},[]);return s.useEffect(()=>()=>h(),[]),{up:I,down:E,stop:S,isSpinning:r}}var ut=/^[Ee0-9+\-.]$/;function ot(n){return ut.test(n)}function lt(n,e){if(n.key==null)return!0;const r=n.ctrlKey||n.altKey||n.metaKey;return!(n.key.length===1)||r?!0:e(n.key)}function it(n={}){const{focusInputOnChange:e=!0,clampValueOnBlur:r=!0,keepWithinRange:a=!0,min:u=Number.MIN_SAFE_INTEGER,max:o=Number.MAX_SAFE_INTEGER,step:i=1,isReadOnly:m,isDisabled:b,isRequired:h,isInvalid:I,pattern:E="[0-9]*(.[0-9]+)?",inputMode:S="decimal",allowMouseWheel:x,id:O,onChange:F,precision:y,name:w,"aria-describedby":B,"aria-label":K,"aria-labelledby":U,onFocus:Q,onBlur:k,onInvalid:ce,getAriaValueText:de,isValidCharacter:Z,format:p,parse:d,...ee}=n,te=M(Q),pe=M(k),V=M(ce),G=M(Z??ot),ne=M(de),l=et(n),{update:T,increment:me,decrement:fe}=l,[Ve,re]=s.useState(!1),q=!(m||b),_=s.useRef(null),H=s.useRef(null),be=s.useRef(null),ve=s.useRef(null),L=s.useCallback(t=>t.split("").filter(G).join(""),[G]),$=s.useCallback(t=>{var c;return(c=d==null?void 0:d(t))!=null?c:t},[d]),R=s.useCallback(t=>{var c;return((c=p==null?void 0:p(t))!=null?c:t).toString()},[p]);Oe(()=>{(l.valueAsNumber>o||l.valueAsNumber{if(!_.current)return;if(_.current.value!=l.value){const c=$(_.current.value);l.setValue(L(c))}},[$,L]);const z=s.useCallback((t=i)=>{q&&me(t)},[me,q,i]),W=s.useCallback((t=i)=>{q&&fe(t)},[fe,q,i]),g=st(z,W);Ae(be,"disabled",g.stop,g.isSpinning),Ae(ve,"disabled",g.stop,g.isSpinning);const he=s.useCallback(t=>{if(t.nativeEvent.isComposing)return;const v=$(t.currentTarget.value);T(L(v)),H.current={start:t.currentTarget.selectionStart,end:t.currentTarget.selectionEnd}},[T,L,$]),ge=s.useCallback(t=>{var c,v,N;te==null||te(t),H.current&&(t.target.selectionStart=(v=H.current.start)!=null?v:(c=t.currentTarget.value)==null?void 0:c.length,t.currentTarget.selectionEnd=(N=H.current.end)!=null?N:t.currentTarget.selectionStart)},[te]),xe=s.useCallback(t=>{if(t.nativeEvent.isComposing)return;lt(t,G)||t.preventDefault();const c=Ne(t)*i,v=t.key,P={ArrowUp:()=>z(c),ArrowDown:()=>W(c),Home:()=>T(u),End:()=>T(o)}[v];P&&(t.preventDefault(),P(t))},[G,i,z,W,T,u,o]),Ne=t=>{let c=1;return(t.metaKey||t.ctrlKey)&&(c=.1),t.shiftKey&&(c=10),c},Ie=s.useMemo(()=>{const t=ne==null?void 0:ne(l.value);if(t!=null)return t;const c=l.value.toString();return c||void 0},[l.value,ne]),ye=s.useCallback(()=>{let t=l.value;if(l.value==="")return;/^[eE]/.test(l.value.toString())?l.setValue(""):(l.valueAsNumbero&&(t=o),l.cast(t))},[l,o,u]),Ce=s.useCallback(()=>{re(!1),r&&ye()},[r,re,ye]),X=s.useCallback(()=>{e&&requestAnimationFrame(()=>{var t;(t=_.current)==null||t.focus()})},[e]),Se=s.useCallback(t=>{t.preventDefault(),g.up(),X()},[X,g]),we=s.useCallback(t=>{t.preventDefault(),g.down(),X()},[X,g]);Ge(()=>_.current,"wheel",t=>{var c,v;const P=((v=(c=_.current)==null?void 0:c.ownerDocument)!=null?v:document).activeElement===_.current;if(!x||!P)return;t.preventDefault();const D=Ne(t)*i,_e=Math.sign(t.deltaY);_e===-1?z(D):_e===1&&W(D)},{passive:!1});const Te=s.useCallback((t={},c=null)=>{const v=b||a&&l.isAtMax;return{...t,ref:ae(c,be),role:"button",tabIndex:-1,onPointerDown:C(t.onPointerDown,N=>{N.button!==0||v||Se(N)}),onPointerLeave:C(t.onPointerLeave,g.stop),onPointerUp:C(t.onPointerUp,g.stop),disabled:v,"aria-disabled":se(v)}},[l.isAtMax,a,Se,g.stop,b]),De=s.useCallback((t={},c=null)=>{const v=b||a&&l.isAtMin;return{...t,ref:ae(c,ve),role:"button",tabIndex:-1,onPointerDown:C(t.onPointerDown,N=>{N.button!==0||v||we(N)}),onPointerLeave:C(t.onPointerLeave,g.stop),onPointerUp:C(t.onPointerUp,g.stop),disabled:v,"aria-disabled":se(v)}},[l.isAtMin,a,we,g.stop,b]),je=s.useCallback((t={},c=null)=>{var v,N,P,D;return{name:w,inputMode:S,type:"text",pattern:E,"aria-labelledby":U,"aria-label":K,"aria-describedby":B,id:O,disabled:b,...t,readOnly:(v=t.readOnly)!=null?v:m,"aria-readonly":(N=t.readOnly)!=null?N:m,"aria-required":(P=t.required)!=null?P:h,required:(D=t.required)!=null?D:h,ref:ae(_,c),value:R(l.value),role:"spinbutton","aria-valuemin":u,"aria-valuemax":o,"aria-valuenow":Number.isNaN(l.valueAsNumber)?void 0:l.valueAsNumber,"aria-invalid":se(I??l.isOutOfRange),"aria-valuetext":Ie,autoComplete:"off",autoCorrect:"off",onChange:C(t.onChange,he),onKeyDown:C(t.onKeyDown,xe),onFocus:C(t.onFocus,ge,()=>re(!0)),onBlur:C(t.onBlur,pe,Ce)}},[w,S,E,U,K,R,B,O,b,h,m,I,l.value,l.valueAsNumber,l.isOutOfRange,u,o,Ie,he,xe,ge,pe,Ce]);return{value:R(l.value),valueAsNumber:l.valueAsNumber,isFocused:Ve,isDisabled:b,isReadOnly:m,getIncrementButtonProps:Te,getDecrementButtonProps:De,getInputProps:je,htmlProps:ee}}var[ct,J]=Pe({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[dt,ie]=Pe({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),pt=j(function(e,r){const a=Ke("NumberInput",e),u=Ue(e),o=qe(u),{htmlProps:i,...m}=it(o),b=s.useMemo(()=>m,[m]);return f.jsx(dt,{value:b,children:f.jsx(ct,{value:a,children:f.jsx(Y.div,{...i,ref:r,className:Me("chakra-numberinput",e.className),__css:{position:"relative",zIndex:0,...a.root}})})})});pt.displayName="NumberInput";var mt=j(function(e,r){const a=J();return f.jsx(Y.div,{"aria-hidden":!0,ref:r,...e,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...a.stepperGroup}})});mt.displayName="NumberInputStepper";var ft=j(function(e,r){const{getInputProps:a}=ie(),u=a(e,r),o=J();return f.jsx(Y.input,{...u,className:Me("chakra-numberinput__field",e.className),__css:{width:"100%",...o.field}})});ft.displayName="NumberInputField";var Re=Y("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),bt=j(function(e,r){var a;const u=J(),{getDecrementButtonProps:o}=ie(),i=o(e,r);return f.jsx(Re,{...i,__css:u.stepper,children:(a=e.children)!=null?a:f.jsx(tt,{})})});bt.displayName="NumberDecrementStepper";var vt=j(function(e,r){var a;const{getIncrementButtonProps:u}=ie(),o=u(e,r),i=J();return f.jsx(Re,{...o,__css:i.stepper,children:(a=e.children)!=null?a:f.jsx(nt,{})})});vt.displayName="NumberIncrementStepper";var St=He("chevron-right","IconChevronRight",[["path",{d:"M9 6l6 6l-6 6",key:"svg-0"}]]);const wt=(n,e)=>{const[r,a]=s.useState(n);return s.useEffect(()=>{const u=setTimeout(()=>{a(n)},e);return()=>{clearTimeout(u)}},[n,e]),r},ht={position:"absolute",marginLeft:"10px",width:"20px",height:"20px",top:"50%",color:"#A0AEC0",transform:"translateY(-50%)"};function _t(n){const{searchValue:e,onUpdateSearchValue:r,style:a}=n,u=e!=="";return f.jsxs(Le,{style:{position:"relative",...a},mb:2,children:[f.jsx(Je,{style:ht}),u&&f.jsx($e,{size:"xs",position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",cursor:"pointer",background:"none",zIndex:"100",icon:f.jsx(ze,{width:15,height:15}),onClick:()=>r(""),"aria-label":"clear input button"}),f.jsx(We,{placeholder:n.placeholder??"Search",size:"sm",paddingLeft:"35px",paddingBlock:"5px",value:e,onChange:({target:o})=>r(o.value)})]})}function At({mediaLocalPath:n,size:e,isPreview:r,autoPlay:a,hideBrokenImage:u,objectFit:o,onBrokenLink:i}){const[m,b]=s.useState(!0);return s.useEffect(()=>{u&&(async()=>{try{if((await fetch(r?`/workspace/preview_media?filename=${n}`:`/workspace/view_media?filename=${n}`)).status==404){b(!1),i==null||i();return}}catch(I){console.error("Error checking media exists",I)}})()},[]),m?Xe(n)?f.jsx(Ye,{borderRadius:3,boxSize:`${e}px`,objectFit:o??"cover",src:`/workspace/view_media?filename=${n}`,alt:"workflow image renamed or moved from output folder"}):f.jsx("div",{style:{width:e+"px",height:e+"px",overflow:"hidden",position:"relative"},children:f.jsx("video",{width:e,height:e,src:`/workspace/view_media?filename=${n}`,loop:!0,autoPlay:a??!1,muted:!0,style:{objectFit:"cover",width:"100%",height:"100%"},children:f.jsx("track",{kind:"captions"})})}):null}export{St as I,At as M,pt as N,_t as S,ft as a,mt as b,Ze as c,vt as d,bt as e,yt as p,Ct as r,wt as u,It as v}; diff --git a/dist/workspace_web/ModelManagerTopbar-F18nYkv6.js b/dist/workspace_web/ModelManagerTopbar-xV84Rv4k.js similarity index 98% rename from dist/workspace_web/ModelManagerTopbar-F18nYkv6.js rename to dist/workspace_web/ModelManagerTopbar-xV84Rv4k.js index 5af94a9..8839d07 100644 --- a/dist/workspace_web/ModelManagerTopbar-F18nYkv6.js +++ b/dist/workspace_web/ModelManagerTopbar-xV84Rv4k.js @@ -1,7 +1,7 @@ -import{f as V,r as p,j as n,g as z,h as re,a0 as J,b as Ve,o as qe,l as Qe,i as A,U as ae,P as Ye,a1 as Je,N as ke,a2 as Xe,Q as Ie,S as Le,T as Ze,$ as et,M as tt,O as st,R as nt,_ as ot}from"./input.js";import{an as it,m as rt,ao as at,ap as lt,aq as $,ar as le,B as oe,F as R,ae as Ee,h as N,i as ie,Z as Ae,as as ct,k as H,a5 as U,a6 as Te,a7 as dt,ag as Ne,j as X,H as W,at as De,au as xe,g as q,w as ht,av as Fe,f as Pe,aw as ye,ax as ut,ay as Oe,az as ft,aA as pt,aB as mt,aC as gt,aD as xt,aE as yt,aF as ee,aG as wt,aH as vt,aI as jt}from"./App-6SVuhhTl.js";import{G as Mt,C as _t}from"./chunk-JARCRF6W-r8MNagok.js";import{api as ce}from"/scripts/api.js";import{S as Z}from"./chunk-3RSXBRAN-2SG_K1_B.js";var ze=V(function(e,s){const{spacing:o="0.5rem",spacingX:i,spacingY:r,children:a,justify:c,direction:l,align:d,className:h,shouldWrapChildren:f,...u}=e,g=p.useMemo(()=>f?p.Children.map(a,(m,x)=>n.jsx(de,{children:m},x)):a,[a,f]);return n.jsx(z.div,{ref:s,className:re("chakra-wrap",h),...u,children:n.jsx(z.ul,{className:"chakra-wrap__list",__css:{display:"flex",flexWrap:"wrap",justifyContent:c,alignItems:d,flexDirection:l,listStyleType:"none",gap:o,columnGap:i,rowGap:r,padding:"0"},children:g})})});ze.displayName="Wrap";var de=V(function(e,s){const{className:o,...i}=e;return n.jsx(z.li,{ref:s,__css:{display:"flex",alignItems:"flex-start"},className:re("chakra-wrap__listitem",o),...i})});de.displayName="WrapItem";function we(t){return rt(t,e=>e==="auto"?"auto":`span ${e}/span ${e}`)}var Be=V(function(e,s){const{area:o,colSpan:i,colStart:r,colEnd:a,rowEnd:c,rowSpan:l,rowStart:d,...h}=e,f=it({gridArea:o,gridColumn:we(i),gridRow:we(l),gridColumnStart:r,gridColumnEnd:a,gridRowStart:d,gridRowEnd:c});return n.jsx(z.div,{ref:s,__css:f,...h})});Be.displayName="GridItem";var te=(t,e)=>e?`${t}.${e}, ${e}`:void 0;function Re(t){var e;const{bg:s,bgColor:o,backgroundColor:i,shadow:r,boxShadow:a,shadowColor:c}=t,{getArrowProps:l,getArrowInnerProps:d}=at(),h=lt(),f=(e=s??o)!=null?e:i,u=r??a;return n.jsx(z.div,{...l(),className:"chakra-popover__arrow-positioner",children:n.jsx(z.div,{className:re("chakra-popover__arrow",t.className),...d(t),__css:{"--popper-arrow-shadow-color":te("colors",c),"--popper-arrow-bg":te("colors",f),"--popper-arrow-shadow":te("shadows",u),...h.arrow}})})}Re.displayName="PopoverArrow";function St(t,e,s){return(t-e)*100/(s-e)}J({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});J({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var bt=J({"0%":{left:"-40%"},"100%":{left:"100%"}}),Ct=J({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function kt(t){const{value:e=0,min:s,max:o,valueText:i,getValueText:r,isIndeterminate:a,role:c="progressbar"}=t,l=St(e,s,o);return{bind:{"data-indeterminate":a?"":void 0,"aria-valuemax":o,"aria-valuemin":s,"aria-valuenow":a?void 0:e,"aria-valuetext":(()=>{if(e!=null)return typeof r=="function"?r(e,l):i})(),role:c},percent:l,value:e}}var[It,Lt]=Ve({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Et=V((t,e)=>{const{min:s,max:o,value:i,isIndeterminate:r,role:a,...c}=t,l=kt({value:i,min:s,max:o,isIndeterminate:r,role:a}),h={height:"100%",...Lt().filledTrack};return n.jsx(z.div,{ref:e,style:{width:`${l.percent}%`,...c.style},...l.bind,...c,__css:h})}),We=V((t,e)=>{var s;const{value:o,min:i=0,max:r=100,hasStripe:a,isAnimated:c,children:l,borderRadius:d,isIndeterminate:h,"aria-label":f,"aria-labelledby":u,"aria-valuetext":g,title:m,role:x,...j}=qe(t),M=Qe("Progress",t),C=d??((s=M.track)==null?void 0:s.borderRadius),k={animation:`${Ct} 1s linear infinite`},D={...!h&&a&&c&&k,...h&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${bt} 1s ease infinite normal none running`}},b={overflow:"hidden",position:"relative",...M.track};return n.jsx(z.div,{ref:e,borderRadius:C,__css:b,...j,children:n.jsxs(It,{value:M,children:[n.jsx(Et,{"aria-label":f,"aria-labelledby":u,"aria-valuetext":g,min:i,max:r,value:o,isIndeterminate:h,css:D,borderRadius:C,title:m,role:x}),l]})})});We.displayName="Progress";function G(t){return Array.isArray?Array.isArray(t):Ge(t)==="[object Array]"}const At=1/0;function Tt(t){return t==null?"":function(e){if(typeof e=="string")return e;let s=e+"";return s=="0"&&1/e==-At?"-0":s}(t)}function F(t){return typeof t=="string"}function $e(t){return typeof t=="number"}function Nt(t){return t===!0||t===!1||function(e){return function(s){return typeof s=="object"}(e)&&e!==null}(t)&&Ge(t)=="[object Boolean]"}function T(t){return t!=null}function se(t){return!t.trim().length}function Ge(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Dt=t=>`Missing ${t} property in key`,Ft=t=>`Property 'weight' in key '${t}' must be a positive integer`,ve=Object.prototype.hasOwnProperty;class Pt{constructor(e){this._keys=[],this._keyMap={};let s=0;e.forEach(o=>{let i=Ke(o);this._keys.push(i),this._keyMap[i.id]=i,s+=i.weight}),this._keys.forEach(o=>{o.weight/=s})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Ke(t){let e=null,s=null,o=null,i=1,r=null;if(F(t)||G(t))o=t,e=je(t),s=Me(t);else{if(!ve.call(t,"name"))throw new Error(Dt("name"));const a=t.name;if(o=a,ve.call(t,"weight")&&(i=t.weight,i<=0))throw new Error(Ft(a));e=je(a),s=Me(a),r=t.getFn}return{path:e,id:s,weight:i,src:o,getFn:r}}function je(t){return G(t)?t:t.split(".")}function Me(t){return G(t)?t.join("."):t}var v={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx{if(T(r))if(a[c]){const l=r[a[c]];if(!T(l))return;if(c===a.length-1&&(F(l)||$e(l)||Nt(l)))s.push(Tt(l));else if(G(l)){o=!0;for(let d=0,h=l.length;d{this._keysMap[s.id]=o})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,F(this.docs[0])?this.docs.forEach((e,s)=>{this._addString(e,s)}):this.docs.forEach((e,s)=>{this._addObject(e,s)}),this.norm.clear())}add(e){const s=this.size();F(e)?this._addString(e,s):this._addObject(e,s)}removeAt(e){this.records.splice(e,1);for(let s=e,o=this.size();s{let a=i.getFn?i.getFn(e):this.getFn(e,i.path);if(T(a)){if(G(a)){let c=[];const l=[{nestedArrIndex:-1,value:a}];for(;l.length;){const{nestedArrIndex:d,value:h}=l.pop();if(T(h))if(F(h)&&!se(h)){let f={v:h,i:d,n:this.norm.get(h)};c.push(f)}else G(h)&&h.forEach((f,u)=>{l.push({nestedArrIndex:u,value:f})})}o.$[r]=c}else if(F(a)&&!se(a)){let c={v:a,n:this.norm.get(a)};o.$[r]=c}}}),this.records.push(o)}toJSON(){return{keys:this.keys,records:this.records}}}function Ue(t,e,{getFn:s=v.getFn,fieldNormWeight:o=v.fieldNormWeight}={}){const i=new he({getFn:s,fieldNormWeight:o});return i.setKeys(t.map(Ke)),i.setSources(e),i.create(),i}function Y(t,{errors:e=0,currentLocation:s=0,expectedLocation:o=0,distance:i=v.distance,ignoreLocation:r=v.ignoreLocation}={}){const a=e/t.length;if(r)return a;const c=Math.abs(o-s);return i?a+c/i:c?1:a}const B=32;function zt(t,e,s,{location:o=v.location,distance:i=v.distance,threshold:r=v.threshold,findAllMatches:a=v.findAllMatches,minMatchCharLength:c=v.minMatchCharLength,includeMatches:l=v.includeMatches,ignoreLocation:d=v.ignoreLocation}={}){if(e.length>B)throw new Error(`Pattern length exceeds max of ${B}.`);const h=e.length,f=t.length,u=Math.max(0,Math.min(o,f));let g=r,m=u;const x=c>1||l,j=x?Array(f):[];let M;for(;(M=t.indexOf(e,m))>-1;){let b=Y(e,{currentLocation:M,expectedLocation:u,distance:i,ignoreLocation:d});if(g=Math.min(b,g),m=M+h,x){let I=0;for(;I=O;w-=1){let _=w-1,S=s[t.charAt(_)];if(x&&(j[_]=+!!S),y[w]=(y[w+1]<<1|1)&S,b&&(y[w]|=(C[w+1]|C[w])<<1|1|C[w+1]),y[w]&Q&&(k=Y(e,{errors:b,currentLocation:_,expectedLocation:u,distance:i,ignoreLocation:d}),k<=g)){if(g=k,m=_,m<=u)break;O=Math.max(1,2*u-m)}}if(Y(e,{errors:b+1,currentLocation:u,expectedLocation:u,distance:i,ignoreLocation:d})>g)break;C=y}const D={isMatch:m>=0,score:Math.max(.001,k)};if(x){const b=function(I=[],L=v.minMatchCharLength){let O=[],E=-1,y=-1,w=0;for(let _=I.length;w<_;w+=1){let S=I[w];S&&E===-1?E=w:S||E===-1||(y=w-1,y-E+1>=L&&O.push([E,y]),E=-1)}return I[w-1]&&w-E>=L&&O.push([E,w-1]),O}(j,c);b.length?l&&(D.indices=b):D.isMatch=!1}return D}function Bt(t){let e={};for(let s=0,o=t.length;s{this.chunks.push({pattern:u,alphabet:Bt(u),startIndex:g})},f=this.pattern.length;if(f>B){let u=0;const g=f%B,m=f-g;for(;u{const{isMatch:M,score:C,indices:k}=zt(e,m,x,{location:i+j,distance:r,threshold:a,findAllMatches:c,minMatchCharLength:l,includeMatches:o,ignoreLocation:d});M&&(u=!0),f+=C,M&&k&&(h=[...h,...k])});let g={isMatch:u,score:u?f/this.chunks.length:1};return u&&o&&(g.indices=h),g}}const _e=[];function Se(t,e){for(let s=0,o=_e.length;s{if(!T(o.indices)||!o.indices.length)return;const{indices:i,value:r}=o;let a={indices:i,value:r};o.key&&(a.key=o.key.src),o.idx>-1&&(a.refIndex=o.idx),e.matches.push(a)})}function $t(t,e){e.score=t.score}class K{constructor(e,s={},o){if(this.options={...v,...s},this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new Pt(this.options.keys),this.setCollection(e,o)}setCollection(e,s){if(this._docs=e,s&&!(s instanceof he))throw new Error("Incorrect 'index' type");this._myIndex=s||Ue(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){T(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const s=[];for(let o=0,i=this._docs.length;o{let u=1;f.matches.forEach(({key:g,norm:m,score:x})=>{const j=g?g.weight:null;u*=Math.pow(x===0&&j?Number.EPSILON:x,(j||1)*(h?1:m))}),f.score=u})}(l,{ignoreFieldNorm:c}),r&&l.sort(a),$e(s)&&s>-1&&(l=l.slice(0,s)),function(d,h,{includeMatches:f=v.includeMatches,includeScore:u=v.includeScore}={}){const g=[];return f&&g.push(Wt),u&&g.push($t),d.map(m=>{const{idx:x}=m,j={item:h[x],refIndex:x};return g.length&&g.forEach(M=>{M(m,j)}),j})}(l,this._docs,{includeMatches:o,includeScore:i})}_searchStringList(e){const s=Se(e,this.options),{records:o}=this._myIndex,i=[];return o.forEach(({v:r,i:a,n:c})=>{if(!T(r))return;const{isMatch:l,score:d,indices:h}=s.searchIn(r);l&&i.push({item:r,idx:a,matches:[{score:d,value:r,norm:c,indices:h}]})}),i}_searchLogical(e){throw new Error("Logical search is not available")}_searchObjectList(e){const s=Se(e,this.options),{keys:o,records:i}=this._myIndex,r=[];return i.forEach(({$:a,i:c})=>{if(!T(a))return;let l=[];o.forEach((d,h)=>{l.push(...this._findMatches({key:d,value:a[h],searcher:s}))}),l.length&&r.push({idx:c,item:a,matches:l})}),r}_findMatches({key:e,value:s,searcher:o}){if(!T(s))return[];let i=[];if(G(s))s.forEach(({v:r,i:a,n:c})=>{if(!T(r))return;const{isMatch:l,score:d,indices:h}=o.searchIn(r);l&&i.push({score:d,key:e,value:r,idx:a,norm:c,indices:h})});else{const{v:r,n:a}=s,{isMatch:c,score:l,indices:d}=o.searchIn(r);c&&i.push({score:l,key:e,value:r,norm:a,indices:d})}return i}}K.version="7.0.0",K.createIndex=Ue,K.parseIndex=function(t,{getFn:e=v.getFn,fieldNormWeight:s=v.fieldNormWeight}={}){const{keys:o,records:i}=t,r=new he({getFn:e,fieldNormWeight:s});return r.setKeys(o),r.setIndexRecords(i),r},K.config=v;function Gt({selectedModel:t,setSelectedModel:e,modelTypeList:s}){const o=i=>{e(i)};return n.jsx(ze,{children:s.map(i=>n.jsx(de,{children:n.jsx(A,{colorScheme:"blue",variant:t===i?"solid":"outline",onClick:()=>o(i),size:"sm",children:i})},i))})}const Kt={checkpoints:"CheckpointLoaderSimple",vae:"VAELoader",loras:"LoraLoader",controlnet:"ControlNetLoader",upscale_models:"UpscaleModelLoader"};function Ut({data:t}){const[e,s]=p.useState("https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/27fd7433-cb0a-4a87-88c1-21ccb2b1a842/width=450/00060-881622046.jpeg"),[o,i]=p.useState(!t.file_hash),[r,a]=p.useState();p.useEffect(()=>{i(!t.file_hash),c()},[t.file_hash]);const c=async()=>{var h;const d=await $.models.get(t.model_name+"@"+t.model_type);if(d!=null&&(a(d),(h=d.imageUrl)!=null&&h.length&&s(d.imageUrl)),!(d!=null&&d.imageUrl)&&t.file_hash!=null)try{const f=await le(t.file_hash),u=f.imageUrl;u&&s(u);const g={id:t.model_name+"@"+t.model_type,fileHash:t.file_hash,fileFolder:t.model_type,fileName:t.model_name+t.model_extension,modelName:f.modelName??null,civitModelID:f.civitModelID,civitModelVersionID:f.civitModelVersionID,imageUrl:u??null};a(g)}catch{}t.preview&&s(t.preview)},l=d=>{const h=Kt[t.model_type];h&&(d.dataTransfer.setData("eventName","WorkspaceManagerAddNode"),d.dataTransfer.setData("modelRelativePath",t.model_name+t.model_extension),d.dataTransfer.setData("nodeType",h))};return n.jsxs(oe,{children:[n.jsxs(oe,{position:"relative",borderRadius:4,draggable:!0,onDragStart:l,children:[o?n.jsx(R,{bg:"rgba(0, 0, 0, 0.5)",height:178,justifyContent:"center",alignItems:"center",children:n.jsx(ae,{})}):n.jsx(Ee,{src:e,draggable:!1,boxSize:"100%",height:150,objectFit:"cover",borderRadius:4,cursor:(r==null?void 0:r.civitModelID)!=null?"pointer":"auto",onClick:()=>{(r==null?void 0:r.civitModelID)==null||(r==null?void 0:r.civitModelVersionID)==null||window.open(`https://civitai.com/models/${r==null?void 0:r.civitModelID}?modelVersionId=${r==null?void 0:r.civitModelVersionID}`)}}),n.jsx(N,{position:"absolute",bottom:"0",left:"0",right:"0",color:"white",fontSize:14})]}),n.jsx(ie,{label:n.jsxs("span",{children:[t.model_name+t.model_extension,n.jsx("br",{}),t.date.toLocaleDateString()]}),children:n.jsx(N,{textAlign:"center",p:"1",fontSize:14,noOfLines:2,children:t.model_name+t.model_extension})})]})}function Ht({list:t}){return n.jsx(Mt,{templateColumns:"repeat(3, minmax(0, 1fr))",gap:1,marginTop:2,children:t.map(e=>n.jsx(Be,{children:n.jsx(Ut,{data:e})},e.model_name+e.date.getTime()))})}function Vt(){const{setRoute:t}=p.useContext(Ae);return n.jsx(n.Fragment,{children:n.jsx(A,{size:"sm",colorScheme:"teal",onClick:()=>t("installModels"),children:"Install Models"})})}const qt=()=>{const[t,e]=p.useState(["checkpoints"]),[s,o]=p.useState([]),[i,r]=p.useState(!0);p.useEffect(()=>{a(),ce.addEventListener("model_list",async l=>{c(l.detail)})},[]);const a=async()=>{const l=await ct();c(l)},c=async l=>{if(!l)return;r(!1);const d=Array.from(new Set(l.map(f=>f.model_type))),h=d.indexOf("checkpoints");h>=0&&d.splice(h,1),d.unshift("checkpoints"),e(d),o(l.map(f=>({...f,date:new Date(f.date*1e3)})))};return{modelTypeList:t,modelsList:s,loading:i}};function Qt(){const[t,e]=p.useState(!1),s=()=>{var a;(a=H)==null||a.getSetting("showNsfwModelThumbnail").then(c=>{e(c??!1)})};p.useEffect(()=>{s()},[]);const o=a=>{var l;const c=a.target.checked;(l=H)==null||l.upsert({showNsfwModelThumbnail:c}).then(()=>{s(),i(),window.dispatchEvent(new Event("showNsfwModelThumbnail"))})},i=async()=>{const a=await $.models.toArray();for(let c=0;c{try{if(a.fileHash==null)return;const l=(await le(a.fileHash)).imageUrl;$.models.update(a.id,{imageUrl:l??null})}catch{}};return n.jsx(_t,{isChecked:t,onChange:o,children:"Show NSFW"})}function Yt(){const t=async e=>{if(e.dataTransfer.getData("eventName")!=="WorkspaceManagerAddNode")return;const o=e.dataTransfer.getData("modelRelativePath"),i=e.dataTransfer.getData("nodeType"),r=LiteGraph.createNode(i);r.pos=[e.canvasX,e.canvasY],r.configure({widgets_values:[o]}),U.graph.add(r)};return p.useEffect(()=>(U.canvasEl.addEventListener("drop",t),()=>{U.canvasEl.removeEventListener("drop",t)}),[]),null}function Jt({onClose:t}){const[e,s]=p.useState("checkpoints"),[o,i]=p.useState(""),[r,a]=p.useState("name"),{loading:c,modelTypeList:l,modelsList:d}=qt(),[h,f]=p.useState([]),[u,g]=p.useState([]);p.useEffect(()=>{x();async function x(){const j=await $.models.toArray();f(d.map(M=>({...M,db:j.find(C=>C.id===M.model_name+"@"+M.model_type)})))}},[d]),p.useEffect(()=>{let x=[];o.length?x=new K(h,{keys:["model_name","db.modelName"]}).search(o).map(C=>C.item):x=d.filter(j=>j.model_type===e).sort((j,M)=>r==="name"?j.model_name.localeCompare(M.model_name):M.date.getTime()-j.date.getTime()),g(x)},[e,d,o,r,h]),p.useEffect(()=>(U.canvasEl.addEventListener("click",t),()=>{U.canvasEl.removeEventListener("click",t)}),[t]);const m=440;return n.jsx(Ye,{children:n.jsxs(oe,{style:{width:m},children:[n.jsxs(Te,{width:m,height:"100vh",p:4,gap:2,position:"fixed",top:0,left:0,shadow:"xl",zIndex:dt,overflowY:"auto",children:[n.jsxs(R,{justifyContent:"space-between",alignContent:"center",py:3,children:[n.jsx(Ne,{size:"md",mr:2,children:"Models"}),n.jsx(Vt,{})]}),n.jsx(R,{gap:4,justifyContent:"center",alignItems:"center",mb:1,children:n.jsx(X,{size:"sm",placeholder:"Search",value:o,onChange:x=>i(x.target.value)})}),n.jsxs(R,{gap:4,justifyContent:"space-between",alignItems:"center",mb:1,children:[!o.length&&n.jsxs(W,{children:[n.jsx("span",{children:"Sort By"}),n.jsxs(Z,{value:r,size:"sm",width:"120px",onChange:x=>a(x.target.value),children:[n.jsx("option",{value:"name",children:"Name"}),n.jsx("option",{value:"date",children:"Date"})]})]}),n.jsx(Qt,{})]}),!o.length&&n.jsx(Gt,{modelTypeList:l,setSelectedModel:s,selectedModel:e}),n.jsx(Ht,{list:u}),c&&n.jsx(R,{justifyContent:"center",alignItems:"center",height:"100%",children:n.jsx(ae,{})})]}),n.jsx(Yt,{})]})})}const Xt=async t=>{try{const s=await(await ce.fetchApi("/model_manager/install_model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).text();window.dispatchEvent(new CustomEvent("model_install_message",{detail:s}))}catch(e){console.error("Failed to connect to the server:",e)}};function be(t,e=1){const i=t/1024;return i>=1024?(i/1024).toFixed(e)+" GB":i.toFixed(e)+" MB"}function Ce(t,e){if(!t||t.length===0)return;let s=t.find(o=>o.nsfw==="None"||o.nsfwLevel===1);return e&&(s=s??t[0]),s}function Zt(t,e=280,s){var o,i,r,a;if(t){if(t.images)return`https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/${(o=Ce(t.images,s))==null?void 0:o.url}/width=${e}/`;if(De(t))return(a=Ce((r=(i=t.modelVersions)==null?void 0:i.at(0))==null?void 0:r.images,s))==null?void 0:a.url}}const ne=280;function es({model:t,onClickInstallModel:e,installing:s}){var u,g;const[o,i]=p.useState();p.useEffect(()=>{m();async function m(){var j;const x=await((j=H)==null?void 0:j.getSetting("showNsfwModelThumbnail"));i(Zt(t,ne,x))}},[t]);const r=De(t)?t.modelVersions:t.versions,[a,c]=p.useState(((u=r==null?void 0:r[0])==null?void 0:u.name)??""),l=r==null?void 0:r.find(m=>(m==null?void 0:m.name)===a),d=()=>{window.open(`https://civitai.com/models/${t.id}`)},h=p.useCallback(()=>{if(l==null){console.error("no file is find by name",a);return}e(xe(l,t.name),t)},[a]),f=(g=xe(l))==null?void 0:g.sizeKB;return n.jsxs(Te,{width:ne,justifyContent:"space-between",mb:2,gap:1,children:[n.jsx(Ee,{borderRadius:3,boxSize:ne+"px",objectFit:"cover",src:o,alt:"model cover image",cursor:"pointer",onClick:()=>d()}),n.jsxs(q,{p:1,children:[n.jsx(ie,{label:t.name,children:n.jsx(N,{fontWeight:500,noOfLines:1,children:t.name})}),n.jsxs(R,{justifyContent:"space-between",alignItems:"center",children:[n.jsx(A,{borderRadius:14,noOfLines:1,size:"xs",colorScheme:"teal",maxWidth:"40%",flexShrink:1,variant:"outline",px:1,cursor:"text",children:n.jsx(N,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:t.type})}),n.jsx(A,{leftIcon:n.jsx(ht,{size:18}),iconSpacing:1,borderRadius:10,size:"sm",py:1,colorScheme:"teal",type:"submit",onClick:()=>h(),isDisabled:!!(a&&s.includes(a)),children:"Install"})]}),n.jsxs(W,{children:[n.jsx(Z,{size:"md",style:{paddingLeft:4},onChange:m=>{c(m.target.value)},children:r==null?void 0:r.map(m=>{const x=m==null?void 0:m.name;return x?n.jsx("option",{value:x,style:{padding:0},children:x},m.id):null})}),f&&n.jsx(ie,{label:be(f),children:n.jsx(N,{flexShrink:1,noOfLines:1,width:"40%",children:be(f)})})]})]})]})}function ts({searchQuery:t,setSearchQuery:e,onSearch:s}){return n.jsxs(R,{gap:1,alignItems:"center",grow:1,children:[n.jsx(X,{placeholder:"Search models in CivitAI",width:"60%",value:t,onChange:o=>e(o.target.value),onKeyUp:o=>{o.code==="Enter"&&s()}}),n.jsx(A,{size:"sm",onClick:()=>s(),colorScheme:"teal",children:"Search"})]})}function ss({isOpen:t,fileSelected:e,onClose:s,selectFolder:o}){const[i,r]=p.useState(""),[a,c]=p.useState([]),[l,d]=p.useState(""),h=p.useRef(null);p.useEffect(()=>{f()},[]);const f=async()=>{const u=await Fe();u&&(["custom_nodes","config","saved_prompts"].forEach(g=>{delete u[g]}),c(Object.values(u).flatMap(g=>g)))};return n.jsx(Je,{isOpen:t,leastDestructiveRef:h,onClose:s,children:n.jsx(ke,{children:n.jsxs(Xe,{children:[n.jsx(Ie,{fontSize:"lg",fontWeight:"bold",children:"Choose Folder"}),n.jsx(Le,{children:n.jsxs(q,{spacing:4,children:[!e&&n.jsxs(n.Fragment,{children:[n.jsx(N,{children:"Model download url"}),n.jsx(X,{placeholder:"https://civitai.com/api/download/models/311399",onChange:u=>d(u.target.value),value:l})]}),n.jsx(N,{children:"Choose model install folder"}),n.jsx(Z,{placeholder:"Select option",value:i,onChange:u=>r(u.target.value),children:a.map(u=>n.jsx("option",{value:u,children:u},u))})]})}),n.jsxs(Ze,{children:[n.jsx(A,{ref:h,onClick:s,children:"Cancel"}),n.jsx(A,{onClick:()=>o(i,l),ml:3,isDisabled:l.length===0,children:"Confirm"})]})]})})})}function ns(){const{colorMode:t}=et(),e=Pe(),[s,o]=p.useState([]);return p.useEffect(()=>{ye.addEventListener("download_progress",i=>{o(i.detail)}),ye.addEventListener("download_error",i=>{e({title:"Download Error",description:i.detail,status:"error",duration:4e3,isClosable:!0})})},[]),n.jsx(q,{spacing:5,pos:"absolute",bottom:"0",left:"0",width:"50%",zIndex:80,backgroundColor:t==="light"?"white":"#242424",paddingX:5,pt:2,children:s.map(({save_path:i,progress:r})=>n.jsxs(W,{children:[n.jsx(N,{fontSize:16,width:"40%",children:i.replace(/^.*[\\/]/,"")}),n.jsx(We,{isIndeterminate:!r,hasStripe:!0,width:"50%",value:r}),n.jsxs(N,{fontSize:16,width:"10%",children:[r.toFixed(1),"%"]}),n.jsx(A,{variant:"outline",size:"sm",colorScheme:"red",onClick:()=>ut(i),children:"Cancel"})]},i))})}function os(){const[t,e]=p.useState(""),{onOpen:s,onClose:o,isOpen:i}=Oe(),r=()=>{xt(t),o()};return n.jsxs(ft,{isOpen:i,onOpen:s,onClose:o,placement:"right",closeOnBlur:!1,children:[n.jsx(pt,{children:n.jsx(A,{size:"sm",py:1,mr:8,children:"Set Civitai API Key"})}),n.jsxs(mt,{p:5,children:[n.jsx(Re,{}),n.jsx(gt,{}),n.jsxs(q,{spacing:4,children:[n.jsx(N,{fontSize:14,children:"Some Civitai.com models require user login to download, you will nedd a Civitai API key to download in that case"}),n.jsx(X,{value:t,onChange:a=>e(a.target.value),placeholder:"API Key"}),n.jsx(A,{size:"sm",py:1,mr:8,onClick:r,children:"Save"})]})]})]})}async function is(t,e){var a,c;const s={queries:[{q:t,indexUid:"models_v8",facets:["category.name","checkpointType","fileFormats","lastVersionAtUnix","tags.name","type","user.username","version.baseModel"],attributesToHighlight:["*"],highlightPreTag:"__ais-highlight__",highlightPostTag:"__/ais-highlight__",limit:80,offset:0}]};return e&&(s.queries[0].filter=[[`"type"="${e}"`]]),((c=(a=await(await fetch("https://meilisearch-v1-6.civitai.com/multi-search",{headers:{"Content-Type":"application/json",Authorization:"Bearer 102312c2b83ea0ef9ac32e7858f742721bbfd7319a957272e746f84fd1e974af"},method:"POST",body:JSON.stringify(s)})).json())==null?void 0:a.results)==null?void 0:c.at(0)).hits??[]}function rs({onclose:t,searchQuery:e="",modelType:s}){const[o,i]=p.useState([]),[r,a]=p.useState(!1),[c,l]=p.useState(s),d=Pe(),[h,f]=p.useState([]),[u,g]=p.useState(e),{isOpen:m,onOpen:x,onClose:j}=Oe(),[M,C,k]=yt(),[P,Q]=p.useState({}),[D,b]=p.useState(ee),I=p.useCallback(async()=>{var S;a(!0);const y=await is(u,c);i(y);const w=await Fe();w&&Q(w);const _=await((S=H)==null?void 0:S.getSetting("defaultFolders"));_&&b(_),a(!1)},[u,c]),L=(y,w)=>{var fe,pe,me,ge;if(!((fe=k.current)!=null&&fe.id)&&!w){console.error("no url to download");return}let _=w??`https://civitai.com/api/download/models/${(pe=k.current)==null?void 0:pe.id}`,S=(me=k.current)==null?void 0:me.name;if(!S&&(S=_.split("/").pop(),!S)){console.error("downloadUrl is malformed");return}d({title:"Installing...",description:S,status:"info",duration:4e3,isClosable:!0}),S!=null&&f(He=>[...He,S??""]);const ue=vt();ue&&(_+=`?token=${ue}`),Xt({file_hash:(ge=k.current)==null?void 0:ge.SHA256,filename:S,save_path:y,url:_}),C(void 0),j()},O=async(y,w)=>{const _=D[w.type];C(y),_==null?x():L(_)},E=async(y,w)=>{var S;const _={...D,[y]:w};await((S=H)==null?void 0:S.upsert({defaultFolders:_})),b(_)};return p.useEffect(()=>{I()},[c]),n.jsxs(n.Fragment,{children:[n.jsxs(tt,{isOpen:!0,onClose:t,blockScrollOnMount:!0,children:[n.jsx(ke,{}),n.jsxs(st,{width:"90%",maxWidth:"90vw",height:"90vh",children:[n.jsxs(Ie,{pb:1,children:[n.jsxs(W,{gap:2,mb:2,alignItems:"center",children:[n.jsx(Ne,{size:"md",mr:2,children:"Models"}),n.jsx(ts,{searchQuery:u,setSearchQuery:g,onSearch:I}),n.jsx(A,{size:"sm",py:1,mr:8,onClick:x,children:"Custom URL Install"}),n.jsx(os,{})]}),n.jsxs(W,{gap:2,wrap:"wrap",children:[n.jsx(A,{size:"sm",py:1,onClick:()=>{l(void 0)},isActive:c==null,children:"All"}),wt.map(y=>n.jsx(A,{size:"sm",py:1,isActive:c===y,onClick:()=>{l(y)},children:y},y)),c&&P[ee[c]]&&n.jsxs(W,{ml:"auto",children:[n.jsx(N,{fontSize:17,whiteSpace:"nowrap",children:"Default Download Folder:"}),n.jsx(Z,{value:D[c],onChange:y=>E(c,y.target.value),children:P[ee[c]].map(y=>n.jsx("option",{value:y,children:y},y))})]})]}),r&&n.jsx(ae,{thickness:"4px",emptyColor:"gray.200",color:"pink.500",size:"lg"})]}),n.jsx(nt,{}),n.jsxs(Le,{overflowY:"auto",children:[n.jsx(W,{wrap:"wrap",children:o==null?void 0:o.map(y=>n.jsx(es,{model:y,onClickInstallModel:O,installing:h},y.id))}),n.jsx(ns,{})]})]})]}),n.jsx(ss,{fileSelected:!!M,isOpen:m,onClose:j,selectFolder:(y,w)=>{L(y,k.current?void 0:w)}})]})}const as=p.lazy(()=>ot(()=>import("./InstallMissingModelsButton-1brz--TF.js"),__vite__mapDeps([0,1,2,3,4,5,6])));function ls(){const{setRoute:t,route:e}=p.useContext(Ae);return p.useEffect(()=>{ce.addEventListener("model_list",async s=>{var r;const o=(r=s.detail)==null?void 0:r.map(async a=>{const c=await $.models.get(a.model_name+"@"+a.model_type);if(c!=null&&c.fileHash)return c;let l={id:a.model_name+"@"+a.model_type,modelName:null,fileHash:a.file_hash??null,fileFolder:a.model_type,fileName:a.model_name+a.model_extension};if(!a.file_hash)return l;const d=await le(a.file_hash);return l={...l,modelName:d.modelName??null,civitModelID:d.civitModelID,civitModelVersionID:d.civitModelVersionID,imageUrl:d.imageUrl??null},l}),i=(await Promise.all(o)).filter(a=>a!=null);await $.models.clear(),await $.models.bulkPut(i.filter(a=>a!=null)),window.dispatchEvent(new CustomEvent("model_list_updated"))})},[]),n.jsxs(q,{style:{position:"relative"},children:[n.jsx(A,{size:"sm",backgroundColor:"#434554",color:"white",colorScheme:"blue","aria-label":"My models",onClick:()=>t("modelList"),px:1,height:jt+"px",children:"Models"}),n.jsx("div",{style:{position:"absolute",top:"38px",left:"0px"},children:n.jsx(p.Suspense,{children:n.jsx(as,{})})}),e==="modelList"&&n.jsx(Jt,{onClose:()=>t("root")}),e==="installModels"&&n.jsx(rs,{modelType:"Checkpoint",onclose:()=>t("root")})]})}const ps=Object.freeze(Object.defineProperty({__proto__:null,default:ls},Symbol.toStringTag,{value:"Module"}));export{Be as G,ps as M,Xt as i}; +import{f as V,r as p,j as n,g as z,h as re,a0 as J,b as Ve,o as qe,l as Qe,i as A,U as ae,P as Ye,a1 as Je,N as ke,a2 as Xe,Q as Ie,S as Le,T as Ze,$ as et,M as tt,O as st,R as nt,_ as ot}from"./input.js";import{an as it,m as rt,ao as at,ap as lt,aq as $,ar as le,B as oe,F as R,ae as Ee,h as N,i as ie,Z as Ae,as as ct,k as H,a5 as U,a6 as Te,a7 as dt,ag as Ne,j as X,H as W,at as De,au as xe,g as q,w as ht,av as Fe,f as Pe,aw as ye,ax as ut,ay as Oe,az as ft,aA as pt,aB as mt,aC as gt,aD as xt,aE as yt,aF as ee,aG as wt,aH as vt,aI as jt}from"./App-4M5AgwD2.js";import{G as Mt,C as _t}from"./chunk-JARCRF6W-ibNbyhHV.js";import{api as ce}from"/scripts/api.js";import{S as Z}from"./chunk-3RSXBRAN-D3gE_K4K.js";var ze=V(function(e,s){const{spacing:o="0.5rem",spacingX:i,spacingY:r,children:a,justify:c,direction:l,align:d,className:h,shouldWrapChildren:f,...u}=e,g=p.useMemo(()=>f?p.Children.map(a,(m,x)=>n.jsx(de,{children:m},x)):a,[a,f]);return n.jsx(z.div,{ref:s,className:re("chakra-wrap",h),...u,children:n.jsx(z.ul,{className:"chakra-wrap__list",__css:{display:"flex",flexWrap:"wrap",justifyContent:c,alignItems:d,flexDirection:l,listStyleType:"none",gap:o,columnGap:i,rowGap:r,padding:"0"},children:g})})});ze.displayName="Wrap";var de=V(function(e,s){const{className:o,...i}=e;return n.jsx(z.li,{ref:s,__css:{display:"flex",alignItems:"flex-start"},className:re("chakra-wrap__listitem",o),...i})});de.displayName="WrapItem";function we(t){return rt(t,e=>e==="auto"?"auto":`span ${e}/span ${e}`)}var Be=V(function(e,s){const{area:o,colSpan:i,colStart:r,colEnd:a,rowEnd:c,rowSpan:l,rowStart:d,...h}=e,f=it({gridArea:o,gridColumn:we(i),gridRow:we(l),gridColumnStart:r,gridColumnEnd:a,gridRowStart:d,gridRowEnd:c});return n.jsx(z.div,{ref:s,__css:f,...h})});Be.displayName="GridItem";var te=(t,e)=>e?`${t}.${e}, ${e}`:void 0;function Re(t){var e;const{bg:s,bgColor:o,backgroundColor:i,shadow:r,boxShadow:a,shadowColor:c}=t,{getArrowProps:l,getArrowInnerProps:d}=at(),h=lt(),f=(e=s??o)!=null?e:i,u=r??a;return n.jsx(z.div,{...l(),className:"chakra-popover__arrow-positioner",children:n.jsx(z.div,{className:re("chakra-popover__arrow",t.className),...d(t),__css:{"--popper-arrow-shadow-color":te("colors",c),"--popper-arrow-bg":te("colors",f),"--popper-arrow-shadow":te("shadows",u),...h.arrow}})})}Re.displayName="PopoverArrow";function St(t,e,s){return(t-e)*100/(s-e)}J({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});J({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var bt=J({"0%":{left:"-40%"},"100%":{left:"100%"}}),Ct=J({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function kt(t){const{value:e=0,min:s,max:o,valueText:i,getValueText:r,isIndeterminate:a,role:c="progressbar"}=t,l=St(e,s,o);return{bind:{"data-indeterminate":a?"":void 0,"aria-valuemax":o,"aria-valuemin":s,"aria-valuenow":a?void 0:e,"aria-valuetext":(()=>{if(e!=null)return typeof r=="function"?r(e,l):i})(),role:c},percent:l,value:e}}var[It,Lt]=Ve({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Et=V((t,e)=>{const{min:s,max:o,value:i,isIndeterminate:r,role:a,...c}=t,l=kt({value:i,min:s,max:o,isIndeterminate:r,role:a}),h={height:"100%",...Lt().filledTrack};return n.jsx(z.div,{ref:e,style:{width:`${l.percent}%`,...c.style},...l.bind,...c,__css:h})}),We=V((t,e)=>{var s;const{value:o,min:i=0,max:r=100,hasStripe:a,isAnimated:c,children:l,borderRadius:d,isIndeterminate:h,"aria-label":f,"aria-labelledby":u,"aria-valuetext":g,title:m,role:x,...j}=qe(t),M=Qe("Progress",t),C=d??((s=M.track)==null?void 0:s.borderRadius),k={animation:`${Ct} 1s linear infinite`},D={...!h&&a&&c&&k,...h&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${bt} 1s ease infinite normal none running`}},b={overflow:"hidden",position:"relative",...M.track};return n.jsx(z.div,{ref:e,borderRadius:C,__css:b,...j,children:n.jsxs(It,{value:M,children:[n.jsx(Et,{"aria-label":f,"aria-labelledby":u,"aria-valuetext":g,min:i,max:r,value:o,isIndeterminate:h,css:D,borderRadius:C,title:m,role:x}),l]})})});We.displayName="Progress";function G(t){return Array.isArray?Array.isArray(t):Ge(t)==="[object Array]"}const At=1/0;function Tt(t){return t==null?"":function(e){if(typeof e=="string")return e;let s=e+"";return s=="0"&&1/e==-At?"-0":s}(t)}function F(t){return typeof t=="string"}function $e(t){return typeof t=="number"}function Nt(t){return t===!0||t===!1||function(e){return function(s){return typeof s=="object"}(e)&&e!==null}(t)&&Ge(t)=="[object Boolean]"}function T(t){return t!=null}function se(t){return!t.trim().length}function Ge(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Dt=t=>`Missing ${t} property in key`,Ft=t=>`Property 'weight' in key '${t}' must be a positive integer`,ve=Object.prototype.hasOwnProperty;class Pt{constructor(e){this._keys=[],this._keyMap={};let s=0;e.forEach(o=>{let i=Ke(o);this._keys.push(i),this._keyMap[i.id]=i,s+=i.weight}),this._keys.forEach(o=>{o.weight/=s})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Ke(t){let e=null,s=null,o=null,i=1,r=null;if(F(t)||G(t))o=t,e=je(t),s=Me(t);else{if(!ve.call(t,"name"))throw new Error(Dt("name"));const a=t.name;if(o=a,ve.call(t,"weight")&&(i=t.weight,i<=0))throw new Error(Ft(a));e=je(a),s=Me(a),r=t.getFn}return{path:e,id:s,weight:i,src:o,getFn:r}}function je(t){return G(t)?t:t.split(".")}function Me(t){return G(t)?t.join("."):t}var v={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx{if(T(r))if(a[c]){const l=r[a[c]];if(!T(l))return;if(c===a.length-1&&(F(l)||$e(l)||Nt(l)))s.push(Tt(l));else if(G(l)){o=!0;for(let d=0,h=l.length;d{this._keysMap[s.id]=o})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,F(this.docs[0])?this.docs.forEach((e,s)=>{this._addString(e,s)}):this.docs.forEach((e,s)=>{this._addObject(e,s)}),this.norm.clear())}add(e){const s=this.size();F(e)?this._addString(e,s):this._addObject(e,s)}removeAt(e){this.records.splice(e,1);for(let s=e,o=this.size();s{let a=i.getFn?i.getFn(e):this.getFn(e,i.path);if(T(a)){if(G(a)){let c=[];const l=[{nestedArrIndex:-1,value:a}];for(;l.length;){const{nestedArrIndex:d,value:h}=l.pop();if(T(h))if(F(h)&&!se(h)){let f={v:h,i:d,n:this.norm.get(h)};c.push(f)}else G(h)&&h.forEach((f,u)=>{l.push({nestedArrIndex:u,value:f})})}o.$[r]=c}else if(F(a)&&!se(a)){let c={v:a,n:this.norm.get(a)};o.$[r]=c}}}),this.records.push(o)}toJSON(){return{keys:this.keys,records:this.records}}}function Ue(t,e,{getFn:s=v.getFn,fieldNormWeight:o=v.fieldNormWeight}={}){const i=new he({getFn:s,fieldNormWeight:o});return i.setKeys(t.map(Ke)),i.setSources(e),i.create(),i}function Y(t,{errors:e=0,currentLocation:s=0,expectedLocation:o=0,distance:i=v.distance,ignoreLocation:r=v.ignoreLocation}={}){const a=e/t.length;if(r)return a;const c=Math.abs(o-s);return i?a+c/i:c?1:a}const B=32;function zt(t,e,s,{location:o=v.location,distance:i=v.distance,threshold:r=v.threshold,findAllMatches:a=v.findAllMatches,minMatchCharLength:c=v.minMatchCharLength,includeMatches:l=v.includeMatches,ignoreLocation:d=v.ignoreLocation}={}){if(e.length>B)throw new Error(`Pattern length exceeds max of ${B}.`);const h=e.length,f=t.length,u=Math.max(0,Math.min(o,f));let g=r,m=u;const x=c>1||l,j=x?Array(f):[];let M;for(;(M=t.indexOf(e,m))>-1;){let b=Y(e,{currentLocation:M,expectedLocation:u,distance:i,ignoreLocation:d});if(g=Math.min(b,g),m=M+h,x){let I=0;for(;I=O;w-=1){let _=w-1,S=s[t.charAt(_)];if(x&&(j[_]=+!!S),y[w]=(y[w+1]<<1|1)&S,b&&(y[w]|=(C[w+1]|C[w])<<1|1|C[w+1]),y[w]&Q&&(k=Y(e,{errors:b,currentLocation:_,expectedLocation:u,distance:i,ignoreLocation:d}),k<=g)){if(g=k,m=_,m<=u)break;O=Math.max(1,2*u-m)}}if(Y(e,{errors:b+1,currentLocation:u,expectedLocation:u,distance:i,ignoreLocation:d})>g)break;C=y}const D={isMatch:m>=0,score:Math.max(.001,k)};if(x){const b=function(I=[],L=v.minMatchCharLength){let O=[],E=-1,y=-1,w=0;for(let _=I.length;w<_;w+=1){let S=I[w];S&&E===-1?E=w:S||E===-1||(y=w-1,y-E+1>=L&&O.push([E,y]),E=-1)}return I[w-1]&&w-E>=L&&O.push([E,w-1]),O}(j,c);b.length?l&&(D.indices=b):D.isMatch=!1}return D}function Bt(t){let e={};for(let s=0,o=t.length;s{this.chunks.push({pattern:u,alphabet:Bt(u),startIndex:g})},f=this.pattern.length;if(f>B){let u=0;const g=f%B,m=f-g;for(;u{const{isMatch:M,score:C,indices:k}=zt(e,m,x,{location:i+j,distance:r,threshold:a,findAllMatches:c,minMatchCharLength:l,includeMatches:o,ignoreLocation:d});M&&(u=!0),f+=C,M&&k&&(h=[...h,...k])});let g={isMatch:u,score:u?f/this.chunks.length:1};return u&&o&&(g.indices=h),g}}const _e=[];function Se(t,e){for(let s=0,o=_e.length;s{if(!T(o.indices)||!o.indices.length)return;const{indices:i,value:r}=o;let a={indices:i,value:r};o.key&&(a.key=o.key.src),o.idx>-1&&(a.refIndex=o.idx),e.matches.push(a)})}function $t(t,e){e.score=t.score}class K{constructor(e,s={},o){if(this.options={...v,...s},this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new Pt(this.options.keys),this.setCollection(e,o)}setCollection(e,s){if(this._docs=e,s&&!(s instanceof he))throw new Error("Incorrect 'index' type");this._myIndex=s||Ue(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){T(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const s=[];for(let o=0,i=this._docs.length;o{let u=1;f.matches.forEach(({key:g,norm:m,score:x})=>{const j=g?g.weight:null;u*=Math.pow(x===0&&j?Number.EPSILON:x,(j||1)*(h?1:m))}),f.score=u})}(l,{ignoreFieldNorm:c}),r&&l.sort(a),$e(s)&&s>-1&&(l=l.slice(0,s)),function(d,h,{includeMatches:f=v.includeMatches,includeScore:u=v.includeScore}={}){const g=[];return f&&g.push(Wt),u&&g.push($t),d.map(m=>{const{idx:x}=m,j={item:h[x],refIndex:x};return g.length&&g.forEach(M=>{M(m,j)}),j})}(l,this._docs,{includeMatches:o,includeScore:i})}_searchStringList(e){const s=Se(e,this.options),{records:o}=this._myIndex,i=[];return o.forEach(({v:r,i:a,n:c})=>{if(!T(r))return;const{isMatch:l,score:d,indices:h}=s.searchIn(r);l&&i.push({item:r,idx:a,matches:[{score:d,value:r,norm:c,indices:h}]})}),i}_searchLogical(e){throw new Error("Logical search is not available")}_searchObjectList(e){const s=Se(e,this.options),{keys:o,records:i}=this._myIndex,r=[];return i.forEach(({$:a,i:c})=>{if(!T(a))return;let l=[];o.forEach((d,h)=>{l.push(...this._findMatches({key:d,value:a[h],searcher:s}))}),l.length&&r.push({idx:c,item:a,matches:l})}),r}_findMatches({key:e,value:s,searcher:o}){if(!T(s))return[];let i=[];if(G(s))s.forEach(({v:r,i:a,n:c})=>{if(!T(r))return;const{isMatch:l,score:d,indices:h}=o.searchIn(r);l&&i.push({score:d,key:e,value:r,idx:a,norm:c,indices:h})});else{const{v:r,n:a}=s,{isMatch:c,score:l,indices:d}=o.searchIn(r);c&&i.push({score:l,key:e,value:r,norm:a,indices:d})}return i}}K.version="7.0.0",K.createIndex=Ue,K.parseIndex=function(t,{getFn:e=v.getFn,fieldNormWeight:s=v.fieldNormWeight}={}){const{keys:o,records:i}=t,r=new he({getFn:e,fieldNormWeight:s});return r.setKeys(o),r.setIndexRecords(i),r},K.config=v;function Gt({selectedModel:t,setSelectedModel:e,modelTypeList:s}){const o=i=>{e(i)};return n.jsx(ze,{children:s.map(i=>n.jsx(de,{children:n.jsx(A,{colorScheme:"blue",variant:t===i?"solid":"outline",onClick:()=>o(i),size:"sm",children:i})},i))})}const Kt={checkpoints:"CheckpointLoaderSimple",vae:"VAELoader",loras:"LoraLoader",controlnet:"ControlNetLoader",upscale_models:"UpscaleModelLoader"};function Ut({data:t}){const[e,s]=p.useState("https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/27fd7433-cb0a-4a87-88c1-21ccb2b1a842/width=450/00060-881622046.jpeg"),[o,i]=p.useState(!t.file_hash),[r,a]=p.useState();p.useEffect(()=>{i(!t.file_hash),c()},[t.file_hash]);const c=async()=>{var h;const d=await $.models.get(t.model_name+"@"+t.model_type);if(d!=null&&(a(d),(h=d.imageUrl)!=null&&h.length&&s(d.imageUrl)),!(d!=null&&d.imageUrl)&&t.file_hash!=null)try{const f=await le(t.file_hash),u=f.imageUrl;u&&s(u);const g={id:t.model_name+"@"+t.model_type,fileHash:t.file_hash,fileFolder:t.model_type,fileName:t.model_name+t.model_extension,modelName:f.modelName??null,civitModelID:f.civitModelID,civitModelVersionID:f.civitModelVersionID,imageUrl:u??null};a(g)}catch{}t.preview&&s(t.preview)},l=d=>{const h=Kt[t.model_type];h&&(d.dataTransfer.setData("eventName","WorkspaceManagerAddNode"),d.dataTransfer.setData("modelRelativePath",t.model_name+t.model_extension),d.dataTransfer.setData("nodeType",h))};return n.jsxs(oe,{children:[n.jsxs(oe,{position:"relative",borderRadius:4,draggable:!0,onDragStart:l,children:[o?n.jsx(R,{bg:"rgba(0, 0, 0, 0.5)",height:178,justifyContent:"center",alignItems:"center",children:n.jsx(ae,{})}):n.jsx(Ee,{src:e,draggable:!1,boxSize:"100%",height:150,objectFit:"cover",borderRadius:4,cursor:(r==null?void 0:r.civitModelID)!=null?"pointer":"auto",onClick:()=>{(r==null?void 0:r.civitModelID)==null||(r==null?void 0:r.civitModelVersionID)==null||window.open(`https://civitai.com/models/${r==null?void 0:r.civitModelID}?modelVersionId=${r==null?void 0:r.civitModelVersionID}`)}}),n.jsx(N,{position:"absolute",bottom:"0",left:"0",right:"0",color:"white",fontSize:14})]}),n.jsx(ie,{label:n.jsxs("span",{children:[t.model_name+t.model_extension,n.jsx("br",{}),t.date.toLocaleDateString()]}),children:n.jsx(N,{textAlign:"center",p:"1",fontSize:14,noOfLines:2,children:t.model_name+t.model_extension})})]})}function Ht({list:t}){return n.jsx(Mt,{templateColumns:"repeat(3, minmax(0, 1fr))",gap:1,marginTop:2,children:t.map(e=>n.jsx(Be,{children:n.jsx(Ut,{data:e})},e.model_name+e.date.getTime()))})}function Vt(){const{setRoute:t}=p.useContext(Ae);return n.jsx(n.Fragment,{children:n.jsx(A,{size:"sm",colorScheme:"teal",onClick:()=>t("installModels"),children:"Install Models"})})}const qt=()=>{const[t,e]=p.useState(["checkpoints"]),[s,o]=p.useState([]),[i,r]=p.useState(!0);p.useEffect(()=>{a(),ce.addEventListener("model_list",async l=>{c(l.detail)})},[]);const a=async()=>{const l=await ct();c(l)},c=async l=>{if(!l)return;r(!1);const d=Array.from(new Set(l.map(f=>f.model_type))),h=d.indexOf("checkpoints");h>=0&&d.splice(h,1),d.unshift("checkpoints"),e(d),o(l.map(f=>({...f,date:new Date(f.date*1e3)})))};return{modelTypeList:t,modelsList:s,loading:i}};function Qt(){const[t,e]=p.useState(!1),s=()=>{var a;(a=H)==null||a.getSetting("showNsfwModelThumbnail").then(c=>{e(c??!1)})};p.useEffect(()=>{s()},[]);const o=a=>{var l;const c=a.target.checked;(l=H)==null||l.upsert({showNsfwModelThumbnail:c}).then(()=>{s(),i(),window.dispatchEvent(new Event("showNsfwModelThumbnail"))})},i=async()=>{const a=await $.models.toArray();for(let c=0;c{try{if(a.fileHash==null)return;const l=(await le(a.fileHash)).imageUrl;$.models.update(a.id,{imageUrl:l??null})}catch{}};return n.jsx(_t,{isChecked:t,onChange:o,children:"Show NSFW"})}function Yt(){const t=async e=>{if(e.dataTransfer.getData("eventName")!=="WorkspaceManagerAddNode")return;const o=e.dataTransfer.getData("modelRelativePath"),i=e.dataTransfer.getData("nodeType"),r=LiteGraph.createNode(i);r.pos=[e.canvasX,e.canvasY],r.configure({widgets_values:[o]}),U.graph.add(r)};return p.useEffect(()=>(U.canvasEl.addEventListener("drop",t),()=>{U.canvasEl.removeEventListener("drop",t)}),[]),null}function Jt({onClose:t}){const[e,s]=p.useState("checkpoints"),[o,i]=p.useState(""),[r,a]=p.useState("name"),{loading:c,modelTypeList:l,modelsList:d}=qt(),[h,f]=p.useState([]),[u,g]=p.useState([]);p.useEffect(()=>{x();async function x(){const j=await $.models.toArray();f(d.map(M=>({...M,db:j.find(C=>C.id===M.model_name+"@"+M.model_type)})))}},[d]),p.useEffect(()=>{let x=[];o.length?x=new K(h,{keys:["model_name","db.modelName"]}).search(o).map(C=>C.item):x=d.filter(j=>j.model_type===e).sort((j,M)=>r==="name"?j.model_name.localeCompare(M.model_name):M.date.getTime()-j.date.getTime()),g(x)},[e,d,o,r,h]),p.useEffect(()=>(U.canvasEl.addEventListener("click",t),()=>{U.canvasEl.removeEventListener("click",t)}),[t]);const m=440;return n.jsx(Ye,{children:n.jsxs(oe,{style:{width:m},children:[n.jsxs(Te,{width:m,height:"100vh",p:4,gap:2,position:"fixed",top:0,left:0,shadow:"xl",zIndex:dt,overflowY:"auto",children:[n.jsxs(R,{justifyContent:"space-between",alignContent:"center",py:3,children:[n.jsx(Ne,{size:"md",mr:2,children:"Models"}),n.jsx(Vt,{})]}),n.jsx(R,{gap:4,justifyContent:"center",alignItems:"center",mb:1,children:n.jsx(X,{size:"sm",placeholder:"Search",value:o,onChange:x=>i(x.target.value)})}),n.jsxs(R,{gap:4,justifyContent:"space-between",alignItems:"center",mb:1,children:[!o.length&&n.jsxs(W,{children:[n.jsx("span",{children:"Sort By"}),n.jsxs(Z,{value:r,size:"sm",width:"120px",onChange:x=>a(x.target.value),children:[n.jsx("option",{value:"name",children:"Name"}),n.jsx("option",{value:"date",children:"Date"})]})]}),n.jsx(Qt,{})]}),!o.length&&n.jsx(Gt,{modelTypeList:l,setSelectedModel:s,selectedModel:e}),n.jsx(Ht,{list:u}),c&&n.jsx(R,{justifyContent:"center",alignItems:"center",height:"100%",children:n.jsx(ae,{})})]}),n.jsx(Yt,{})]})})}const Xt=async t=>{try{const s=await(await ce.fetchApi("/model_manager/install_model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).text();window.dispatchEvent(new CustomEvent("model_install_message",{detail:s}))}catch(e){console.error("Failed to connect to the server:",e)}};function be(t,e=1){const i=t/1024;return i>=1024?(i/1024).toFixed(e)+" GB":i.toFixed(e)+" MB"}function Ce(t,e){if(!t||t.length===0)return;let s=t.find(o=>o.nsfw==="None"||o.nsfwLevel===1);return e&&(s=s??t[0]),s}function Zt(t,e=280,s){var o,i,r,a;if(t){if(t.images)return`https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/${(o=Ce(t.images,s))==null?void 0:o.url}/width=${e}/`;if(De(t))return(a=Ce((r=(i=t.modelVersions)==null?void 0:i.at(0))==null?void 0:r.images,s))==null?void 0:a.url}}const ne=280;function es({model:t,onClickInstallModel:e,installing:s}){var u,g;const[o,i]=p.useState();p.useEffect(()=>{m();async function m(){var j;const x=await((j=H)==null?void 0:j.getSetting("showNsfwModelThumbnail"));i(Zt(t,ne,x))}},[t]);const r=De(t)?t.modelVersions:t.versions,[a,c]=p.useState(((u=r==null?void 0:r[0])==null?void 0:u.name)??""),l=r==null?void 0:r.find(m=>(m==null?void 0:m.name)===a),d=()=>{window.open(`https://civitai.com/models/${t.id}`)},h=p.useCallback(()=>{if(l==null){console.error("no file is find by name",a);return}e(xe(l,t.name),t)},[a]),f=(g=xe(l))==null?void 0:g.sizeKB;return n.jsxs(Te,{width:ne,justifyContent:"space-between",mb:2,gap:1,children:[n.jsx(Ee,{borderRadius:3,boxSize:ne+"px",objectFit:"cover",src:o,alt:"model cover image",cursor:"pointer",onClick:()=>d()}),n.jsxs(q,{p:1,children:[n.jsx(ie,{label:t.name,children:n.jsx(N,{fontWeight:500,noOfLines:1,children:t.name})}),n.jsxs(R,{justifyContent:"space-between",alignItems:"center",children:[n.jsx(A,{borderRadius:14,noOfLines:1,size:"xs",colorScheme:"teal",maxWidth:"40%",flexShrink:1,variant:"outline",px:1,cursor:"text",children:n.jsx(N,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:t.type})}),n.jsx(A,{leftIcon:n.jsx(ht,{size:18}),iconSpacing:1,borderRadius:10,size:"sm",py:1,colorScheme:"teal",type:"submit",onClick:()=>h(),isDisabled:!!(a&&s.includes(a)),children:"Install"})]}),n.jsxs(W,{children:[n.jsx(Z,{size:"md",style:{paddingLeft:4},onChange:m=>{c(m.target.value)},children:r==null?void 0:r.map(m=>{const x=m==null?void 0:m.name;return x?n.jsx("option",{value:x,style:{padding:0},children:x},m.id):null})}),f&&n.jsx(ie,{label:be(f),children:n.jsx(N,{flexShrink:1,noOfLines:1,width:"40%",children:be(f)})})]})]})]})}function ts({searchQuery:t,setSearchQuery:e,onSearch:s}){return n.jsxs(R,{gap:1,alignItems:"center",grow:1,children:[n.jsx(X,{placeholder:"Search models in CivitAI",width:"60%",value:t,onChange:o=>e(o.target.value),onKeyUp:o=>{o.code==="Enter"&&s()}}),n.jsx(A,{size:"sm",onClick:()=>s(),colorScheme:"teal",children:"Search"})]})}function ss({isOpen:t,fileSelected:e,onClose:s,selectFolder:o}){const[i,r]=p.useState(""),[a,c]=p.useState([]),[l,d]=p.useState(""),h=p.useRef(null);p.useEffect(()=>{f()},[]);const f=async()=>{const u=await Fe();u&&(["custom_nodes","config","saved_prompts"].forEach(g=>{delete u[g]}),c(Object.values(u).flatMap(g=>g)))};return n.jsx(Je,{isOpen:t,leastDestructiveRef:h,onClose:s,children:n.jsx(ke,{children:n.jsxs(Xe,{children:[n.jsx(Ie,{fontSize:"lg",fontWeight:"bold",children:"Choose Folder"}),n.jsx(Le,{children:n.jsxs(q,{spacing:4,children:[!e&&n.jsxs(n.Fragment,{children:[n.jsx(N,{children:"Model download url"}),n.jsx(X,{placeholder:"https://civitai.com/api/download/models/311399",onChange:u=>d(u.target.value),value:l})]}),n.jsx(N,{children:"Choose model install folder"}),n.jsx(Z,{placeholder:"Select option",value:i,onChange:u=>r(u.target.value),children:a.map(u=>n.jsx("option",{value:u,children:u},u))})]})}),n.jsxs(Ze,{children:[n.jsx(A,{ref:h,onClick:s,children:"Cancel"}),n.jsx(A,{onClick:()=>o(i,l),ml:3,isDisabled:l.length===0,children:"Confirm"})]})]})})})}function ns(){const{colorMode:t}=et(),e=Pe(),[s,o]=p.useState([]);return p.useEffect(()=>{ye.addEventListener("download_progress",i=>{o(i.detail)}),ye.addEventListener("download_error",i=>{e({title:"Download Error",description:i.detail,status:"error",duration:4e3,isClosable:!0})})},[]),n.jsx(q,{spacing:5,pos:"absolute",bottom:"0",left:"0",width:"50%",zIndex:80,backgroundColor:t==="light"?"white":"#242424",paddingX:5,pt:2,children:s.map(({save_path:i,progress:r})=>n.jsxs(W,{children:[n.jsx(N,{fontSize:16,width:"40%",children:i.replace(/^.*[\\/]/,"")}),n.jsx(We,{isIndeterminate:!r,hasStripe:!0,width:"50%",value:r}),n.jsxs(N,{fontSize:16,width:"10%",children:[r.toFixed(1),"%"]}),n.jsx(A,{variant:"outline",size:"sm",colorScheme:"red",onClick:()=>ut(i),children:"Cancel"})]},i))})}function os(){const[t,e]=p.useState(""),{onOpen:s,onClose:o,isOpen:i}=Oe(),r=()=>{xt(t),o()};return n.jsxs(ft,{isOpen:i,onOpen:s,onClose:o,placement:"right",closeOnBlur:!1,children:[n.jsx(pt,{children:n.jsx(A,{size:"sm",py:1,mr:8,children:"Set Civitai API Key"})}),n.jsxs(mt,{p:5,children:[n.jsx(Re,{}),n.jsx(gt,{}),n.jsxs(q,{spacing:4,children:[n.jsx(N,{fontSize:14,children:"Some Civitai.com models require user login to download, you will nedd a Civitai API key to download in that case"}),n.jsx(X,{value:t,onChange:a=>e(a.target.value),placeholder:"API Key"}),n.jsx(A,{size:"sm",py:1,mr:8,onClick:r,children:"Save"})]})]})]})}async function is(t,e){var a,c;const s={queries:[{q:t,indexUid:"models_v8",facets:["category.name","checkpointType","fileFormats","lastVersionAtUnix","tags.name","type","user.username","version.baseModel"],attributesToHighlight:["*"],highlightPreTag:"__ais-highlight__",highlightPostTag:"__/ais-highlight__",limit:80,offset:0}]};return e&&(s.queries[0].filter=[[`"type"="${e}"`]]),((c=(a=await(await fetch("https://meilisearch-v1-6.civitai.com/multi-search",{headers:{"Content-Type":"application/json",Authorization:"Bearer 102312c2b83ea0ef9ac32e7858f742721bbfd7319a957272e746f84fd1e974af"},method:"POST",body:JSON.stringify(s)})).json())==null?void 0:a.results)==null?void 0:c.at(0)).hits??[]}function rs({onclose:t,searchQuery:e="",modelType:s}){const[o,i]=p.useState([]),[r,a]=p.useState(!1),[c,l]=p.useState(s),d=Pe(),[h,f]=p.useState([]),[u,g]=p.useState(e),{isOpen:m,onOpen:x,onClose:j}=Oe(),[M,C,k]=yt(),[P,Q]=p.useState({}),[D,b]=p.useState(ee),I=p.useCallback(async()=>{var S;a(!0);const y=await is(u,c);i(y);const w=await Fe();w&&Q(w);const _=await((S=H)==null?void 0:S.getSetting("defaultFolders"));_&&b(_),a(!1)},[u,c]),L=(y,w)=>{var fe,pe,me,ge;if(!((fe=k.current)!=null&&fe.id)&&!w){console.error("no url to download");return}let _=w??`https://civitai.com/api/download/models/${(pe=k.current)==null?void 0:pe.id}`,S=(me=k.current)==null?void 0:me.name;if(!S&&(S=_.split("/").pop(),!S)){console.error("downloadUrl is malformed");return}d({title:"Installing...",description:S,status:"info",duration:4e3,isClosable:!0}),S!=null&&f(He=>[...He,S??""]);const ue=vt();ue&&(_+=`?token=${ue}`),Xt({file_hash:(ge=k.current)==null?void 0:ge.SHA256,filename:S,save_path:y,url:_}),C(void 0),j()},O=async(y,w)=>{const _=D[w.type];C(y),_==null?x():L(_)},E=async(y,w)=>{var S;const _={...D,[y]:w};await((S=H)==null?void 0:S.upsert({defaultFolders:_})),b(_)};return p.useEffect(()=>{I()},[c]),n.jsxs(n.Fragment,{children:[n.jsxs(tt,{isOpen:!0,onClose:t,blockScrollOnMount:!0,children:[n.jsx(ke,{}),n.jsxs(st,{width:"90%",maxWidth:"90vw",height:"90vh",children:[n.jsxs(Ie,{pb:1,children:[n.jsxs(W,{gap:2,mb:2,alignItems:"center",children:[n.jsx(Ne,{size:"md",mr:2,children:"Models"}),n.jsx(ts,{searchQuery:u,setSearchQuery:g,onSearch:I}),n.jsx(A,{size:"sm",py:1,mr:8,onClick:x,children:"Custom URL Install"}),n.jsx(os,{})]}),n.jsxs(W,{gap:2,wrap:"wrap",children:[n.jsx(A,{size:"sm",py:1,onClick:()=>{l(void 0)},isActive:c==null,children:"All"}),wt.map(y=>n.jsx(A,{size:"sm",py:1,isActive:c===y,onClick:()=>{l(y)},children:y},y)),c&&P[ee[c]]&&n.jsxs(W,{ml:"auto",children:[n.jsx(N,{fontSize:17,whiteSpace:"nowrap",children:"Default Download Folder:"}),n.jsx(Z,{value:D[c],onChange:y=>E(c,y.target.value),children:P[ee[c]].map(y=>n.jsx("option",{value:y,children:y},y))})]})]}),r&&n.jsx(ae,{thickness:"4px",emptyColor:"gray.200",color:"pink.500",size:"lg"})]}),n.jsx(nt,{}),n.jsxs(Le,{overflowY:"auto",children:[n.jsx(W,{wrap:"wrap",children:o==null?void 0:o.map(y=>n.jsx(es,{model:y,onClickInstallModel:O,installing:h},y.id))}),n.jsx(ns,{})]})]})]}),n.jsx(ss,{fileSelected:!!M,isOpen:m,onClose:j,selectFolder:(y,w)=>{L(y,k.current?void 0:w)}})]})}const as=p.lazy(()=>ot(()=>import("./InstallMissingModelsButton-O1ft6LSd.js"),__vite__mapDeps([0,1,2,3,4,5,6])));function ls(){const{setRoute:t,route:e}=p.useContext(Ae);return p.useEffect(()=>{ce.addEventListener("model_list",async s=>{var r;const o=(r=s.detail)==null?void 0:r.map(async a=>{const c=await $.models.get(a.model_name+"@"+a.model_type);if(c!=null&&c.fileHash)return c;let l={id:a.model_name+"@"+a.model_type,modelName:null,fileHash:a.file_hash??null,fileFolder:a.model_type,fileName:a.model_name+a.model_extension};if(!a.file_hash)return l;const d=await le(a.file_hash);return l={...l,modelName:d.modelName??null,civitModelID:d.civitModelID,civitModelVersionID:d.civitModelVersionID,imageUrl:d.imageUrl??null},l}),i=(await Promise.all(o)).filter(a=>a!=null);await $.models.clear(),await $.models.bulkPut(i.filter(a=>a!=null)),window.dispatchEvent(new CustomEvent("model_list_updated"))})},[]),n.jsxs(q,{style:{position:"relative"},children:[n.jsx(A,{size:"sm",backgroundColor:"#434554",color:"white",colorScheme:"blue","aria-label":"My models",onClick:()=>t("modelList"),px:1,height:jt+"px",children:"Models"}),n.jsx("div",{style:{position:"absolute",top:"38px",left:"0px"},children:n.jsx(p.Suspense,{children:n.jsx(as,{})})}),e==="modelList"&&n.jsx(Jt,{onClose:()=>t("root")}),e==="installModels"&&n.jsx(rs,{modelType:"Checkpoint",onclose:()=>t("root")})]})}const ps=Object.freeze(Object.defineProperty({__proto__:null,default:ls},Symbol.toStringTag,{value:"Module"}));export{Be as G,ps as M,Xt as i}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["workspace_web/InstallMissingModelsButton-1brz--TF.js","workspace_web/input.js","workspace_web/App-6SVuhhTl.js","workspace_web/assets/App-JXePnJiV.css","workspace_web/chunk-JARCRF6W-r8MNagok.js","workspace_web/chunk-7D6N5TE5-NbopAz8o.js","workspace_web/chunk-3RSXBRAN-2SG_K1_B.js"] + __vite__mapDeps.viteFileDeps = ["workspace_web/InstallMissingModelsButton-O1ft6LSd.js","workspace_web/input.js","workspace_web/App-4M5AgwD2.js","workspace_web/assets/App-JXePnJiV.css","workspace_web/chunk-JARCRF6W-ibNbyhHV.js","workspace_web/chunk-7D6N5TE5-zfYf6Y9A.js","workspace_web/chunk-3RSXBRAN-D3gE_K4K.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/workspace_web/RecentFilesDrawer-YqesR0Z_.js b/dist/workspace_web/RecentFilesDrawer-1UN8MLmu.js similarity index 98% rename from dist/workspace_web/RecentFilesDrawer-YqesR0Z_.js rename to dist/workspace_web/RecentFilesDrawer-1UN8MLmu.js index 1daf1bd..92bd23b 100644 --- a/dist/workspace_web/RecentFilesDrawer-YqesR0Z_.js +++ b/dist/workspace_web/RecentFilesDrawer-1UN8MLmu.js @@ -1,4 +1,4 @@ -import{f as Q,E as qe,j as e,Z as Je,h as ie,g as we,r,M as re,N as le,O as ce,Q as de,R as ue,S as he,W as ve,i as W,$ as ke,T as Qe}from"./input.js";import{m as Le,u as Ae,a as et,b as tt,c as st,S as nt,M as at,d as A,H as z,T as We,I as P,t as je,e as Ne,f as Y,E as me,g as B,h as L,i as R,j as pe,k as C,R as H,l as ot,n as Me,B as _,F as Z,o as Fe,p as it,q as rt,r as ee,s as te,v as N,w as lt,D as Pe,x as T,y as Re,z as ct,A as Se,C as dt,G as _e,J as ut,K as G,L as ht,N as pt,O as gt,P as mt,Q as Be,U as ft,V as xt,W as jt,X as U,Y as ye,Z as Ce,_ as yt,$ as wt,a0 as $e,a1 as vt,a2 as kt,a3 as St,a4 as J,a5 as oe,a6 as Ct,a7 as bt,a8 as It,a9 as fe,aa as Mt}from"./App-6SVuhhTl.js";import{G as Ft,C as q}from"./chunk-JARCRF6W-r8MNagok.js";import{V as Ke}from"./chunk-NTCQBYKE-Wk1_Xkg6.js";import{N as Dt,a as Et,I as Tt,M as Ot,u as zt,S as Lt}from"./MediaPreview-j_Hhr-lH.js";import{I as At}from"./IconCopy-NWmMWcgf.js";import"./chunk-7D6N5TE5-NbopAz8o.js";import"./IconSearch-fViKszW1.js";var Ge=Q(function(t,l){const{columns:o,spacingX:n,spacingY:a,spacing:u,minChildWidth:p,...i}=t,h=qe(),d=p?Nt(p,h):Pt(o);return e.jsx(Ft,{ref:l,gap:u,columnGap:n,rowGap:a,templateColumns:d,...i})});Ge.displayName="SimpleGrid";function Wt(s){return typeof s=="number"?`${s}px`:s}function Nt(s,t){return Le(s,l=>{const o=Je("sizes",l,Wt(l))(t);return l===null?null:`repeat(auto-fit, minmax(${o}, 1fr))`})}function Pt(s){return Le(s,t=>t===null?null:`repeat(${t}, minmax(0, 1fr))`)}var He=Q((s,t)=>{const{title:l,children:o,className:n,...a}=s,u=ie("chakra-menu__group__title",n),p=Ae();return e.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[l&&e.jsx(we.p,{className:u,...a,__css:p.groupTitle,children:l}),o]})});He.displayName="MenuGroup";var Ve=s=>{const{className:t,title:l,...o}=s,n=et(o);return e.jsx(He,{title:l,className:ie("chakra-menu__option-group",t),...n})};Ve.displayName="MenuOptionGroup";var Rt=Q((s,t)=>{const l=Ae();return e.jsx(we.button,{ref:t,...s,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...l.button}})}),se=Q((s,t)=>{const{children:l,as:o,...n}=s,a=tt(n,t),u=o||Rt;return e.jsx(u,{...a,className:ie("chakra-menu__menu-button",s.className),children:e.jsx(we.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:s.children})})});se.displayName="MenuButton";var _t=s=>e.jsx("svg",{viewBox:"0 0 14 14",width:"1em",height:"1em",...s,children:e.jsx("polygon",{fill:"currentColor",points:"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039"})}),be=Q((s,t)=>{const{icon:l,iconSpacing:o="0.75rem",...n}=s,a=st(n,t);return e.jsxs(nt,{...a,className:ie("chakra-menu__menuitem-option",n.className),children:[l!==null&&e.jsx(at,{fontSize:"0.8em",marginEnd:o,opacity:s.isChecked?1:0,children:l||e.jsx(_t,{})}),e.jsx("span",{style:{flex:1},children:a.children})]})});be.id="MenuItemOption";be.displayName="MenuItemOption";var Bt=A("chevron-up","IconChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]]),$t=A("dots-vertical","IconDotsVertical",[["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]]),Kt=A("edit","IconEdit",[["path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",key:"svg-0"}],["path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z",key:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]]),De=A("file-import","IconFileImport",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M5 13v-8a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-5.5m-9.5 -2h7m-3 -3l3 3l-3 3",key:"svg-1"}]]),Gt=A("file","IconFile",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z",key:"svg-1"}]]),Ue=A("folder-plus","IconFolderPlus",[["path",{d:"M12 19h-7a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v3.5",key:"svg-0"}],["path",{d:"M16 19h6",key:"svg-1"}],["path",{d:"M19 16v6",key:"svg-2"}]]),Ht=A("list-check","IconListCheck",[["path",{d:"M3.5 5.5l1.5 1.5l2.5 -2.5",key:"svg-0"}],["path",{d:"M3.5 11.5l1.5 1.5l2.5 -2.5",key:"svg-1"}],["path",{d:"M3.5 17.5l1.5 1.5l2.5 -2.5",key:"svg-2"}],["path",{d:"M11 6l9 0",key:"svg-3"}],["path",{d:"M11 12l9 0",key:"svg-4"}],["path",{d:"M11 18l9 0",key:"svg-5"}]]),Vt=A("lock-open","IconLockOpen",[["path",{d:"M5 11m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M12 16m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-5a4 4 0 0 1 8 0",key:"svg-2"}]]),Ut=A("menu-2","IconMenu2",[["path",{d:"M4 6l16 0",key:"svg-0"}],["path",{d:"M4 12l16 0",key:"svg-1"}],["path",{d:"M4 18l16 0",key:"svg-2"}]]),Zt=A("moon","IconMoon",[["path",{d:"M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z",key:"svg-0"}]]),Yt=A("settings","IconSettings",[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]]),Xt=A("sun","IconSun",[["path",{d:"M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7",key:"svg-1"}]]),qt=A("tag","IconTag",[["path",{d:"M7.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3z",key:"svg-1"}]]),Jt=A("upload","IconUpload",[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 9l5 -5l5 5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]]);function Qt({onclose:s}){const[t,l]=r.useState([]),o=async()=>{var a;const n=await((a=je)==null?void 0:a.listAll());l(n??[])};return r.useEffect(()=>{o()},[]),e.jsxs(re,{isOpen:!0,onClose:s,children:[e.jsx(le,{}),e.jsxs(ce,{children:[e.jsx(de,{children:"My Tags"}),e.jsx(ue,{}),e.jsx(he,{children:t.map(n=>e.jsxs(z,{children:[e.jsx(We,{children:n.name}),e.jsx(P,{onClick:async()=>{var a;await((a=je)==null?void 0:a.delete(n.name)),o()},"aria-label":"delete-tag",colorScheme:"red",variant:"ghost",icon:e.jsx(Ne,{})})]}))})]})]})}function es(){const s=Y(),t=r.useRef([{title:"Save current workflow",key:me.SAVE},{title:"Save as current workflow",key:me.SAVE_AS},{title:"Open spotlight search",key:me.openSpotlightSearch}]),[l,o]=r.useState({save:"",saveAs:"",openSpotlightSearch:""}),[n,a]=r.useState(),u=async(i,h)=>{var g;i.preventDefault();let d="";if(i.ctrlKey&&(d+="Control+"),i.metaKey&&(d+="Command+"),i.shiftKey&&(d+="Shift+"),i.altKey&&(d+="Alt+"),d.length>0&&!["Control","Shift","Alt","Meta"].includes(i.key)){d+=i.key.toUpperCase();const m={...l};delete m[h],Object.values(m).includes(d)?s({title:"Shortcut key conflict",description:`The shortcut key γ€Œ${d}」 is already used, please +import{f as Q,E as qe,j as e,Z as Je,h as ie,g as we,r,M as re,N as le,O as ce,Q as de,R as ue,S as he,W as ve,i as W,$ as ke,T as Qe}from"./input.js";import{m as Le,u as Ae,a as et,b as tt,c as st,S as nt,M as at,d as A,H as z,T as We,I as P,t as je,e as Ne,f as Y,E as me,g as B,h as L,i as R,j as pe,k as C,R as H,l as ot,n as Me,B as _,F as Z,o as Fe,p as it,q as rt,r as ee,s as te,v as N,w as lt,D as Pe,x as T,y as Re,z as ct,A as Se,C as dt,G as _e,J as ut,K as G,L as ht,N as pt,O as gt,P as mt,Q as Be,U as ft,V as xt,W as jt,X as U,Y as ye,Z as Ce,_ as yt,$ as wt,a0 as $e,a1 as vt,a2 as kt,a3 as St,a4 as J,a5 as oe,a6 as Ct,a7 as bt,a8 as It,a9 as fe,aa as Mt}from"./App-4M5AgwD2.js";import{G as Ft,C as q}from"./chunk-JARCRF6W-ibNbyhHV.js";import{V as Ke}from"./chunk-NTCQBYKE-rUyqBIyd.js";import{N as Dt,a as Et,I as Tt,M as Ot,u as zt,S as Lt}from"./MediaPreview-TJpk-on-.js";import{I as At}from"./IconCopy-HLdZF5TO.js";import"./chunk-7D6N5TE5-zfYf6Y9A.js";import"./IconSearch-E56kR4uG.js";var Ge=Q(function(t,l){const{columns:o,spacingX:n,spacingY:a,spacing:u,minChildWidth:p,...i}=t,h=qe(),d=p?Nt(p,h):Pt(o);return e.jsx(Ft,{ref:l,gap:u,columnGap:n,rowGap:a,templateColumns:d,...i})});Ge.displayName="SimpleGrid";function Wt(s){return typeof s=="number"?`${s}px`:s}function Nt(s,t){return Le(s,l=>{const o=Je("sizes",l,Wt(l))(t);return l===null?null:`repeat(auto-fit, minmax(${o}, 1fr))`})}function Pt(s){return Le(s,t=>t===null?null:`repeat(${t}, minmax(0, 1fr))`)}var He=Q((s,t)=>{const{title:l,children:o,className:n,...a}=s,u=ie("chakra-menu__group__title",n),p=Ae();return e.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[l&&e.jsx(we.p,{className:u,...a,__css:p.groupTitle,children:l}),o]})});He.displayName="MenuGroup";var Ve=s=>{const{className:t,title:l,...o}=s,n=et(o);return e.jsx(He,{title:l,className:ie("chakra-menu__option-group",t),...n})};Ve.displayName="MenuOptionGroup";var Rt=Q((s,t)=>{const l=Ae();return e.jsx(we.button,{ref:t,...s,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...l.button}})}),se=Q((s,t)=>{const{children:l,as:o,...n}=s,a=tt(n,t),u=o||Rt;return e.jsx(u,{...a,className:ie("chakra-menu__menu-button",s.className),children:e.jsx(we.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:s.children})})});se.displayName="MenuButton";var _t=s=>e.jsx("svg",{viewBox:"0 0 14 14",width:"1em",height:"1em",...s,children:e.jsx("polygon",{fill:"currentColor",points:"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039"})}),be=Q((s,t)=>{const{icon:l,iconSpacing:o="0.75rem",...n}=s,a=st(n,t);return e.jsxs(nt,{...a,className:ie("chakra-menu__menuitem-option",n.className),children:[l!==null&&e.jsx(at,{fontSize:"0.8em",marginEnd:o,opacity:s.isChecked?1:0,children:l||e.jsx(_t,{})}),e.jsx("span",{style:{flex:1},children:a.children})]})});be.id="MenuItemOption";be.displayName="MenuItemOption";var Bt=A("chevron-up","IconChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]]),$t=A("dots-vertical","IconDotsVertical",[["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]]),Kt=A("edit","IconEdit",[["path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",key:"svg-0"}],["path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z",key:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]]),De=A("file-import","IconFileImport",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M5 13v-8a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-5.5m-9.5 -2h7m-3 -3l3 3l-3 3",key:"svg-1"}]]),Gt=A("file","IconFile",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z",key:"svg-1"}]]),Ue=A("folder-plus","IconFolderPlus",[["path",{d:"M12 19h-7a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v3.5",key:"svg-0"}],["path",{d:"M16 19h6",key:"svg-1"}],["path",{d:"M19 16v6",key:"svg-2"}]]),Ht=A("list-check","IconListCheck",[["path",{d:"M3.5 5.5l1.5 1.5l2.5 -2.5",key:"svg-0"}],["path",{d:"M3.5 11.5l1.5 1.5l2.5 -2.5",key:"svg-1"}],["path",{d:"M3.5 17.5l1.5 1.5l2.5 -2.5",key:"svg-2"}],["path",{d:"M11 6l9 0",key:"svg-3"}],["path",{d:"M11 12l9 0",key:"svg-4"}],["path",{d:"M11 18l9 0",key:"svg-5"}]]),Vt=A("lock-open","IconLockOpen",[["path",{d:"M5 11m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M12 16m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-5a4 4 0 0 1 8 0",key:"svg-2"}]]),Ut=A("menu-2","IconMenu2",[["path",{d:"M4 6l16 0",key:"svg-0"}],["path",{d:"M4 12l16 0",key:"svg-1"}],["path",{d:"M4 18l16 0",key:"svg-2"}]]),Zt=A("moon","IconMoon",[["path",{d:"M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z",key:"svg-0"}]]),Yt=A("settings","IconSettings",[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]]),Xt=A("sun","IconSun",[["path",{d:"M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7",key:"svg-1"}]]),qt=A("tag","IconTag",[["path",{d:"M7.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3z",key:"svg-1"}]]),Jt=A("upload","IconUpload",[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 9l5 -5l5 5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]]);function Qt({onclose:s}){const[t,l]=r.useState([]),o=async()=>{var a;const n=await((a=je)==null?void 0:a.listAll());l(n??[])};return r.useEffect(()=>{o()},[]),e.jsxs(re,{isOpen:!0,onClose:s,children:[e.jsx(le,{}),e.jsxs(ce,{children:[e.jsx(de,{children:"My Tags"}),e.jsx(ue,{}),e.jsx(he,{children:t.map(n=>e.jsxs(z,{children:[e.jsx(We,{children:n.name}),e.jsx(P,{onClick:async()=>{var a;await((a=je)==null?void 0:a.delete(n.name)),o()},"aria-label":"delete-tag",colorScheme:"red",variant:"ghost",icon:e.jsx(Ne,{})})]}))})]})]})}function es(){const s=Y(),t=r.useRef([{title:"Save current workflow",key:me.SAVE},{title:"Save as current workflow",key:me.SAVE_AS},{title:"Open spotlight search",key:me.openSpotlightSearch}]),[l,o]=r.useState({save:"",saveAs:"",openSpotlightSearch:""}),[n,a]=r.useState(),u=async(i,h)=>{var g;i.preventDefault();let d="";if(i.ctrlKey&&(d+="Control+"),i.metaKey&&(d+="Command+"),i.shiftKey&&(d+="Shift+"),i.altKey&&(d+="Alt+"),d.length>0&&!["Control","Shift","Alt","Meta"].includes(i.key)){d+=i.key.toUpperCase();const m={...l};delete m[h],Object.values(m).includes(d)?s({title:"Shortcut key conflict",description:`The shortcut key γ€Œ${d}」 is already used, please modify it.`,status:"info",duration:3e3,position:"top",isClosable:!1}):(await((g=C)==null?void 0:g.upsert({shortcuts:{...l,[h]:d}})),p())}},p=()=>{var i;(i=C)==null||i.getSetting("shortcuts").then(h=>{var g;const d=h??((g=C)==null?void 0:g.defaultSettings.shortcuts);o({...l,...d})})};return r.useEffect(()=>{p()},[]),e.jsxs(B,{children:[e.jsx(L,{children:"Keyboard Shortcut"}),t.current.map(i=>e.jsxs(z,{children:[e.jsx(L,{fontSize:"sm",w:170,children:i.title}),e.jsx(R,{label:"Press shortcut key combinations to setup",placement:"bottom",hasArrow:!0,isOpen:n===i.key,children:e.jsx(pe,{value:l[i.key],onKeyDown:h=>{u(h,i.key)},onFocus:()=>{a(i.key)},onBlur:()=>{a(void 0)},placeholder:"Press a key combination",readOnly:!0,width:"auto",flex:1})})]},i.key))]})}function ts(){const{setRefreshFolderStamp:s}=r.useContext(H),[t,l]=r.useState(!1),o=()=>{var a;(a=C)==null||a.getSetting("foldersOnTop").then(u=>{l(!!u)})},n=a=>{var p;const u=a.target.checked;(p=C)==null||p.upsert({foldersOnTop:u}).then(()=>{o(),s(Date.now())})};return r.useEffect(()=>{o()},[]),e.jsx(B,{children:e.jsx(q,{isChecked:t,onChange:n,children:"Folders always on top"})})}function ss(){const[s,t]=r.useState(!1),[l,o]=r.useState(""),{showDialog:n}=ve(),a=()=>{var p,i;(p=C)==null||p.getSetting("myWorkflowsDir").then(h=>{o(h??"undefined")}),(i=C)==null||i.getSetting("twoWaySync").then(h=>{t(h??!1)})};r.useEffect(()=>{a()},[]);const u=async p=>{var h,d;if(!p.target.checked){await((h=C)==null?void 0:h.upsert({twoWaySync:p.target.checked})),a();return}const i=await((d=C)==null?void 0:d.getSetting("myWorkflowsDir"));n(e.jsx(ot,{myWorkflowsDir:i??"undefined"}),[{label:"I have downloaded all my workflows and ready to enable",onClick:async()=>{var g;await((g=C)==null?void 0:g.upsert({twoWaySync:!0})),a()},colorScheme:"red"}])};return e.jsxs(B,{children:[e.jsx(L,{children:"Only for legacy two way sync users to get back their data. Do not disable two way sync if you have already enabled it. It may cause some unexpected issues."}),e.jsx(q,{isChecked:s,onChange:u,children:"Enable two way sync"})]})}function Ee({settingKey:s,text:t,defaultChecked:l=!1}){const[o,n]=r.useState(l),a=Y(),u=()=>{var p;(p=C)==null||p.getSetting(s).then(i=>{n(!!i)})};return r.useEffect(()=>{u()},[]),e.jsx(B,{children:e.jsx(q,{isChecked:o,onChange:async p=>{var i;await((i=C)==null?void 0:i.upsert({[s]:p.target.checked})),u(),a({title:"Setting saved. Please refresh to see the changes.",status:"success",duration:3e3,isClosable:!0})},children:t})})}function ns(){const[s,t]=r.useState(!1),[l,o]=r.useState(!1),[n,a]=r.useState([]),[u,p]=r.useState(""),[i,h]=r.useState([]),[d,g]=r.useState(!1),[m,c]=r.useState(!1),[f,v]=r.useState(!1),S=r.useRef(null),w=Y();ve();const b=f?"\\":"/";r.useEffect(()=>{var j;Me().then(k=>{p(k.path??""),v(k.os==="win32")}),(j=C)==null||j.getSetting("twoWaySync").then(k=>{g(k??!1)})},[]);const F=async j=>{const{dir_path:k="",dir_contents:E=[],error:V=""}=await Fe(j??"");return V.includes("Operation not permitted")?(c(!0),O(),{isError:!0}):{dirList:E,dirPath:k}},y=async()=>{const{isError:j=!1,dirList:k=[]}=await F(u);j||(a(k),o(!0),h(u&&u.split(b).filter(E=>!!E)||[]))},O=()=>{o(!1),t(!1),h([])},$=async(j,k=!1,E=!1)=>{var x,I;if(k){const{path:M}=await Me();M&&await it(M,j)}await((x=C)==null?void 0:x.upsert({myWorkflowsDir:j}));const V=await((I=C)==null?void 0:I.getSetting("myWorkflowsDir"))??"";p(V),E&&c(!1),O()},K=async j=>{if(j){const{error:E=""}=await Fe(j);if(E.includes("Not a directory")){w({title:"The directory address you entered is invalid, please re-enter it.",status:"warning",duration:5e3,position:"top",isClosable:!0});return}}const k=j??`${f?"":b}${i.join(b)}`;$(k,!1,!!j)},X=async()=>{const{dirPath:j,dirList:k}=await F("");h(j.split(b).filter(E=>!!E)),a(k)},ne=async(j,k)=>{var I;let E="";j===-1&&k?E=`${f?"":b}${i.concat([k]).join(b)}`:E=`${f?"":b}${i.slice(0,j+1).join(b)}`;const{isError:V=!1,dirList:x=[]}=await F(E);V||(a(x),h(f?E.split(b):(I=E.slice(1))==null?void 0:I.split(b)))},ae=e.jsxs(_,{textAlign:"end",mb:4,children:[e.jsx(pe,{placeholder:"Please enter the absolute path directory address",ref:S,mt:2,mb:2}),e.jsx(W,{colorScheme:"teal",mr:3,size:"sm",onClick:()=>{var j,k;(j=S==null?void 0:S.current)!=null&&j.value&&K((k=S==null?void 0:S.current)==null?void 0:k.value)},children:"Save"})]}),ge=()=>{o(!0),t(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs(_,{mb:4,children:[e.jsx(L,{mb:2,fontWeight:500,children:"My Workflows Save Directory"}),l?s?ae:e.jsxs(Ke,{spacing:2,alignItems:"start",children:[e.jsx(B,{spacing:"2px",direction:"row",wrap:"wrap",children:i.map((j,k)=>e.jsxs("span",{children:[k>0&&b,e.jsx(W,{colorScheme:"teal",variant:"link",minW:1,onClick:()=>{ne(k)},children:j},`${j}-${k}`)]},j))}),e.jsx(Ge,{columns:2,spacing:3,maxHeight:500,width:"100%",overflowY:"auto",children:n.map((j,k)=>e.jsx(W,{size:"sm",leftIcon:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#EFC54D",style:{width:"1.2rem",height:"1.2rem"},children:e.jsx("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"})}),justifyContent:"start",onClick:()=>{ne(-1,j)},children:j},`${j}-${k}`))}),e.jsxs(_,{w:"100%",textAlign:"end",children:[e.jsx(W,{colorScheme:"teal",size:"sm",onClick:()=>{K()},children:"Save"}),e.jsx(W,{size:"sm",onClick:X,mr:2,ml:2,children:"Reset"}),e.jsx(W,{size:"sm",onClick:O,children:"Cancel"})]})]}):e.jsxs(Z,{children:[e.jsx(We,{overflowWrap:"anywhere",children:u}),e.jsx(R,{label:d?"Choose folder":"Enable two way sync to link local folder",children:e.jsx(P,{"aria-label":"Select folder",size:"sm",ml:2,isDisabled:!d,icon:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#EFC54D",style:{width:"1.4rem",height:"1.4srem"},children:e.jsx("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"})}),onClick:y})}),e.jsx(R,{label:d?"Input absolute path":"Enable two way sync to link local folder",children:e.jsx(P,{isDisabled:!d,"aria-label":"Enter folder address",size:"sm",ml:2,icon:e.jsx(Kt,{size:19}),onClick:ge,variant:"ghost"})})]})]}),e.jsxs(re,{isOpen:m,onClose:()=>c(!1),size:"xl",children:[e.jsx(le,{}),e.jsxs(ce,{children:[e.jsx(de,{children:"Kind tips"}),e.jsx(ue,{}),e.jsx(he,{children:e.jsxs(_,{children:[navigator.userAgent.indexOf("Mac OS X")!==-1?e.jsxs(L,{fontWeight:500,children:["There is no permission to access the folder. You need to grant full disk access permission to the terminal that starts the ComfyUI program. For details, refer to the",e.jsx(W,{colorScheme:"teal",variant:"link",as:"a",ml:2,target:"_block",href:`https://stackoverflow.com/questions/58479686/permissionerror-errno-1-operation-not-permitted-after-macos -catalina-update`,children:"Document"}),", or you can manually enter the absolute path of the folder in the input box below to save."]}):e.jsx(L,{fontWeight:500,children:"You do not have permission to access the folder. It is recommended that you manually enter the absolute path address of the required folder."}),ae]})})]})]})]})}function Ze({label:s,settingKey:t}){const[l,o]=r.useState(200),n=Y(),a=i=>{if(!i.length){o(0);return}o(parseInt(i))},u=async()=>{var i;l<0&&o(0),await((i=C)==null?void 0:i.upsert({[t]:Number(l)})),n({title:"Setting saved",status:"success",duration:3e3,isClosable:!0})},p=()=>{var i;(i=C)==null||i.getSetting(t).then(h=>{o(h)})};return r.useEffect(()=>{p()},[]),e.jsxs(B,{children:[e.jsx(L,{children:s}),e.jsx(Dt,{defaultValue:200,min:0,keepWithinRange:!0,placeholder:"Enter a number",maxWidth:"300px",value:l,onChange:i=>a(i),onBlur:()=>{u()},onKeyUp:i=>{i.key==="Enter"&&u()},children:e.jsx(Et,{})})]})}function as(){const[s,t]=r.useState(!1),l=Y(),o=()=>{var n;(n=C)==null||n.getSetting("autoSave").then(a=>{t(!!a)})};return r.useEffect(()=>{o()},[]),e.jsxs(B,{children:[e.jsx(q,{isChecked:s,onChange:async n=>{var a;await((a=C)==null?void 0:a.upsert({autoSave:n.target.checked})),o(),l({title:"Setting saved",status:"success",duration:3e3,isClosable:!0})},children:"Enable auto save workflow"}),s&&e.jsx(Ze,{label:"Auto save duration (auto save workflow every X seconds)",settingKey:"autoSaveDuration"})]})}function os(){const s=r.useRef(null),t=Y(),l=()=>{var o;(o=C)==null||o.getSetting("cloudHost").then(n=>{var a;(a=s.current)==null||a.setAttribute("value",n??"")})};return r.useEffect(()=>{l()},[]),e.jsxs(B,{children:[e.jsx(L,{children:"For enterprise paid user only. Hosting site of the shared workflow."}),e.jsxs(Z,{gap:2,alignItems:"center",children:[e.jsx(pe,{ref:s,onBlur:()=>{var o,n,a;console.log("onBlur",(o=s.current)==null?void 0:o.value),(a=C)==null||a.upsert({cloudHost:(n=s.current)==null?void 0:n.value}),l(),t({title:"Setting saved. Please refresh to see the changes.",status:"success",duration:4e3})}}),e.jsx(W,{size:"sm",onClick:()=>{var o,n,a;(n=s.current)==null||n.setAttribute("value",(o=C)==null?void 0:o.defaultSettings.cloudHost),(a=s.current)==null||a.blur()},children:"Reset"})]})]})}function is({onClose:s}){return e.jsx(e.Fragment,{children:e.jsxs(re,{isOpen:!0,onClose:s,size:"xl",children:[e.jsx(le,{}),e.jsxs(ce,{children:[e.jsx(de,{children:"Settings"}),e.jsx(ue,{}),e.jsx(he,{pb:14,children:e.jsx(z,{children:e.jsxs(Ke,{divider:e.jsx(rt,{borderColor:"gray.500"}),spacing:4,align:"stretch",w:"100%",children:[e.jsx(ns,{}),e.jsx(as,{}),e.jsx(es,{}),e.jsx(ss,{}),e.jsx(ts,{}),e.jsx(Ee,{settingKey:"overwriteCurWorkflowWhenDroppingFileToCanvas",text:"Overwrite current workflow when drag and drop workflow file to canvas"}),e.jsx(Ze,{label:`Maximum number of save change history to store. This does not include versions that you created by "Create Version", which are always stored diff --git a/dist/workspace_web/ShareDialog-JZBcdRgg.js b/dist/workspace_web/ShareDialog-JZBcdRgg.js deleted file mode 100644 index b136e5b..0000000 --- a/dist/workspace_web/ShareDialog-JZBcdRgg.js +++ /dev/null @@ -1 +0,0 @@ -import{r as s,m as te,x as Q,b as ae,f as ne,j as e,g as re,h as ie,i as F,M as le,N as ce,O as de,Q as ue,S as he}from"./input.js";import{B as fe,A as pe,a6 as ge,f as we,k as z,F as Y,g as H,aK as me,H as X,j as xe,aL as ke,aM as ve,x as T,aN as V,aO as be,aP as je,a5 as Se,aQ as ye,h as Ce,T as De,aR as Ie,_ as Re}from"./App-6SVuhhTl.js";import{S as Ee,L as Le}from"./chunk-VTV6N5LE-CPEmZVmx.js";import{I as Te}from"./IconCopy-NWmMWcgf.js";import"./chunk-7D6N5TE5-NbopAz8o.js";function We(r){return r&&Q(r)&&Q(r.target)}function _e(r={}){const{onChange:d,value:h,defaultValue:p,name:g,isDisabled:f,isFocusable:i,isNative:c,...t}=r,[b,w]=s.useState(p||""),m=typeof h<"u",x=m?h:b,n=s.useRef(null),I=s.useCallback(()=>{const l=n.current;if(!l)return;let u="input:not(:disabled):checked";const j=l.querySelector(u);if(j){j.focus();return}u="input:not(:disabled)";const y=l.querySelector(u);y==null||y.focus()},[]),C=`radio-${s.useId()}`,E=g||C,D=s.useCallback(l=>{const u=We(l)?l.target.value:l;m||w(u),d==null||d(String(u))},[d,m]),W=s.useCallback((l={},u=null)=>({...l,ref:te(u,n),role:"radiogroup"}),[]),M=s.useCallback((l={},u=null)=>({...l,ref:u,name:E,[c?"checked":"isChecked"]:x!=null?l.value===x:void 0,onChange(y){D(y)},"data-radiogroup":!0}),[c,E,D,x]);return{getRootProps:W,getRadioProps:M,name:E,ref:n,focus:I,setValue:w,value:x,onChange:D,isDisabled:f,isFocusable:i,htmlProps:t}}var[Pe,$e]=ae({name:"RadioGroupContext",strict:!1}),Z=ne((r,d)=>{const{colorScheme:h,size:p,variant:g,children:f,className:i,isDisabled:c,isFocusable:t,...b}=r,{value:w,onChange:m,getRootProps:x,name:n,htmlProps:I}=_e(b),R=s.useMemo(()=>({name:n,size:p,onChange:m,colorScheme:h,value:w,variant:g,isDisabled:c,isFocusable:t}),[n,p,m,h,w,g,c,t]);return e.jsx(Pe,{value:R,children:e.jsx(re.div,{...x(I,d),className:ie("chakra-radio-group",i),children:f})})});Z.displayName="RadioGroup";function Ne({options:r,value:d,onChange:h}){const[p,g]=s.useState(!1),f=s.useRef(null),i=r.find(t=>t.value===d);s.useEffect(()=>{const t=b=>{f.current&&!f.current.contains(b.target)&&g(!1)};return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}},[f]);const c=()=>g(!p);return e.jsxs(fe,{position:"relative",children:[e.jsx(F,{onClick:c,rightIcon:e.jsx(pe,{}),leftIcon:i==null?void 0:i.icon,children:i==null?void 0:i.label}),p&&e.jsx(ge,{gap:4,ref:f,mt:"2",shadow:"md",borderWidth:"1px",p:"2",position:"absolute",zIndex:100,children:r.map(t=>e.jsx(F,{onClick:()=>{g(!1),h(t.value)},leftIcon:t.icon,justifyContent:"flex-start",variant:"ghost",width:"full",children:t.label},t.label))})]})}function Ge({onClose:r}){var y,O,$,G,B;const[d,h]=s.useState("v"+Ve()),[p,g]=s.useState([]),[f,i]=s.useState(!1),c=(O=(y=z)==null?void 0:y.settings)==null?void 0:O.cloudHost,[t,b]=s.useState("PRIVATE"),[w,m]=s.useState("new_version"),x=s.useRef(""),n=($=T)==null?void 0:$.curWorkflow,I=we(),R=s.useRef(null),[C,E]=s.useState(!0),D=async o=>{var _,P;const a=o.data;if(a.type!=="share_workflow_success")return;const k=a.localWorkflowID,v=a.localVersionID,S=a.version.id,L=a.version.workflowID;L&&k&&await((_=T)==null?void 0:_.updateMetaInfo(k,{cloudID:L,cloudOrigin:o.origin,privacy:t})),v&&S&&await((P=V)==null?void 0:P.update(v,{cloudID:S,cloudOrigin:o.origin})),W(),window.open(x.current+"/workflow/"+L+"/"+S,"_blank"),i(!1)};s.useEffect(()=>{W(),window.addEventListener("message",D);const o=a=>{a.detail&&l(a.detail?JSON.stringify(a.detail):void 0)};return window.addEventListener("workspace_info_deps_updated",o),()=>{window.removeEventListener("message",D),window.removeEventListener("workspace_info_deps_updated",o)}},[]);const W=async()=>{var a,k;const o=await((a=z)==null?void 0:a.getSetting("cloudHost"));o&&(x.current=o),n!=null&&n.cloudID&&n.cloudOrigin&&ye(n).then(v=>{b(v)}),(k=V)==null||k.listByWorkflowID(n.id).then(v=>{g(v)})},M=o=>{navigator.clipboard.writeText(o).then(()=>{I({title:"Copied to clipboard",status:"success",duration:2e3,isClosable:!0})}).catch(a=>{console.error("Failed to copy text: ",a)})},l=async o=>{var q,A,U;i(!0);const a=be(32),k=await((q=z)==null?void 0:q.getSetting("cloudHost"));let v,S;try{if(v=je(),w==="new_version"?S=await((A=V)==null?void 0:A.add({workflowID:n.id,name:d,createTime:Date.now(),json:o??JSON.stringify(Se.graph.serialize())})):S=await((U=V)==null?void 0:U.get(w)),!S){alert(`Failed to find version: ${w}, please try again.`),i(!1);return}}catch(N){console.error(N),i(!1),alert("Failed to share workflow, please try again.");return}const L=window.location.protocol,_=window.location.host,P=`${L}//${_}`,ee=k+`/share_workflow_confirm/${a}?redirectUrl=${P}`,oe=window.open(ee,"Share Workflow","width=800,height=800"),K=N=>{var J;if(N.origin===k&&N.data==="child_ready"){const se=(J=T)==null?void 0:J.curWorkflow;oe.postMessage({workflow:se,version:S,nodeDefs:v,privacy:t},k),window.removeEventListener("message",K)}};window.addEventListener("message",K)},u=async()=>{var o;C?(o=R.current)==null||o.requestSubmit():l()},j=(B=(G=T)==null?void 0:G.curWorkflow)==null?void 0:B.cloudID;return e.jsxs(le,{isOpen:!0,onClose:r,size:"lg",children:[e.jsx(ce,{}),e.jsxs(de,{width:["98%","90%","50%"],maxWidth:"600px",children:[e.jsxs(ue,{children:[e.jsxs(Y,{justifyContent:"space-between",children:[e.jsxs("p",{children:['Share "',n==null?void 0:n.name,'"']}),e.jsx(F,{colorScheme:"teal",onClick:u,size:"sm",isDisabled:f,children:f?"Sharing":"Share"})]}),c&&e.jsxs(Ce,{fontSize:16,color:"GrayText",fontWeight:400,children:["Share to ",new URL(c).host]})]}),e.jsx(he,{pb:10,children:e.jsxs(H,{gap:5,children:[j==null?e.jsx(Ne,{options:me,value:t,onChange:o=>{b(o)}}):e.jsx(De,{variant:"outline",borderRadius:"full",width:"fit-content",children:e.jsx(Ie,{privacy:t,showEmoji:!0})}),j&&e.jsxs(X,{spacing:2,color:"teal.400",children:[e.jsxs(Le,{wordBreak:"break-all",href:c+"/workflow/"+j,isExternal:!0,children:[c+"/workflow/"+j," ",e.jsx(Re,{size:20,style:{display:"inline-block",verticalAlign:"middle"}})]}),e.jsx(F,{size:"sm",leftIcon:e.jsx(Te,{size:18}),onClick:()=>{var o,a;M(c+"/workflow/"+((a=(o=T)==null?void 0:o.curWorkflow)==null?void 0:a.cloudID))},children:"Copy link"})]}),e.jsx(Z,{gap:4,onChange:o=>{m(o)},value:w,children:e.jsx(H,{children:e.jsxs(X,{mb:5,alignItems:"center",children:[e.jsx(xe,{value:d,width:"60%",onFocus:()=>{m("new_version")},onChange:o=>{h(o.target.value)}}),e.jsx(Y,{color:"green",children:e.jsx(ke,{colorScheme:"purple",children:"Version Name"})})]})})}),e.jsxs(H,{borderRadius:6,borderWidth:"1px",p:2,children:[e.jsx(Ee,{isChecked:C,onChange:()=>E(!C),fontWeight:"600",children:"Share Resource Links"}),C&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"GrayText"},children:"You can disable reource sharing if you don't want to resolve submit errors"}),e.jsx(ve,{ref:R})]})]})]})})]})]})}function Ve(){const r=new Date,d=r.getFullYear(),h=String(r.getMonth()+1).padStart(2,"0"),p=String(r.getDate()).padStart(2,"0");return`${d}-${h}-${p}`}export{Ge as default}; diff --git a/dist/workspace_web/ShareDialog-LtEf88VA.js b/dist/workspace_web/ShareDialog-LtEf88VA.js new file mode 100644 index 0000000..fce1f37 --- /dev/null +++ b/dist/workspace_web/ShareDialog-LtEf88VA.js @@ -0,0 +1 @@ +import{r as t,m as ae,x as Y,b as ne,f as re,j as e,g as ie,h as le,i as M,M as ce,N as de,O as ue,Q as fe,S as he}from"./input.js";import{B as pe,A as ge,a6 as we,aE as me,f as xe,k as z,F as X,g as H,aK as ve,H as Z,j as ke,aL as ye,aM as be,x as E,aN as F,aO as je,aP as Se,a5 as Ce,aQ as De,h as Ie,T as Re,aR as Ee,_ as Le}from"./App-4M5AgwD2.js";import{S as Te,L as We}from"./chunk-VTV6N5LE-x5KZOIPv.js";import{I as _e}from"./IconCopy-HLdZF5TO.js";import"./chunk-7D6N5TE5-zfYf6Y9A.js";function Pe(n){return n&&Y(n)&&Y(n.target)}function Ne(n={}){const{onChange:u,value:f,defaultValue:g,name:w,isDisabled:h,isFocusable:r,isNative:c,...a}=n,[b,j]=t.useState(g||""),p=typeof f<"u",m=p?f:b,x=t.useRef(null),i=t.useCallback(()=>{const l=x.current;if(!l)return;let d="input:not(:disabled):checked";const I=l.querySelector(d);if(I){I.focus();return}d="input:not(:disabled)";const v=l.querySelector(d);v==null||v.focus()},[]),T=`radio-${t.useId()}`,S=w||T,D=t.useCallback(l=>{const d=Pe(l)?l.target.value:l;p||j(d),u==null||u(String(d))},[u,p]),W=t.useCallback((l={},d=null)=>({...l,ref:ae(d,x),role:"radiogroup"}),[]),_=t.useCallback((l={},d=null)=>({...l,ref:d,name:S,[c?"checked":"isChecked"]:m!=null?l.value===m:void 0,onChange(v){D(v)},"data-radiogroup":!0}),[c,S,D,m]);return{getRootProps:W,getRadioProps:_,name:S,ref:x,focus:i,setValue:j,value:m,onChange:D,isDisabled:h,isFocusable:r,htmlProps:a}}var[Ve,Be]=ne({name:"RadioGroupContext",strict:!1}),ee=re((n,u)=>{const{colorScheme:f,size:g,variant:w,children:h,className:r,isDisabled:c,isFocusable:a,...b}=n,{value:j,onChange:p,getRootProps:m,name:x,htmlProps:i}=Ne(b),L=t.useMemo(()=>({name:x,size:g,onChange:p,colorScheme:f,value:j,variant:w,isDisabled:c,isFocusable:a}),[x,g,p,f,j,w,c,a]);return e.jsx(Ve,{value:L,children:e.jsx(ie.div,{...m(i,u),className:le("chakra-radio-group",r),children:h})})});ee.displayName="RadioGroup";function Fe({options:n,value:u,onChange:f}){const[g,w]=t.useState(!1),h=t.useRef(null),r=n.find(a=>a.value===u);t.useEffect(()=>{const a=b=>{h.current&&!h.current.contains(b.target)&&w(!1)};return document.addEventListener("mousedown",a),()=>{document.removeEventListener("mousedown",a)}},[h]);const c=()=>w(!g);return e.jsxs(pe,{position:"relative",children:[e.jsx(M,{onClick:c,rightIcon:e.jsx(ge,{}),leftIcon:r==null?void 0:r.icon,children:r==null?void 0:r.label}),g&&e.jsx(we,{gap:4,ref:h,mt:"2",shadow:"md",borderWidth:"1px",p:"2",position:"absolute",zIndex:100,children:n.map(a=>e.jsx(M,{onClick:()=>{w(!1),f(a.value)},leftIcon:a.icon,justifyContent:"flex-start",variant:"ghost",width:"full",children:a.label},a.label))})]})}function Ke({onClose:n}){var O,$,G,B,K;const[u,f]=t.useState("v"+Me()),[g,w]=t.useState([]),[h,r]=t.useState(!1),c=($=(O=z)==null?void 0:O.settings)==null?void 0:$.cloudHost,[a,b,j]=me("PRIVATE"),[p,m]=t.useState("new_version"),x=t.useRef(""),i=(G=E)==null?void 0:G.curWorkflow,L=xe(),T=t.useRef(null),[S,D]=t.useState(!0),W=async o=>{var P,N;const s=o.data;if(s.type!=="share_workflow_success")return;const k=s.localWorkflowID,y=s.localVersionID,C=s.version.id,R=s.version.workflowID;R&&k&&await((P=E)==null?void 0:P.updateMetaInfo(k,{cloudID:R,cloudOrigin:o.origin,privacy:j.current})),y&&C&&await((N=F)==null?void 0:N.update(y,{cloudID:C,cloudOrigin:o.origin})),_(),window.open(x.current+"/workflow/"+R+"/"+C,"_blank"),r(!1)};t.useEffect(()=>{_(),window.addEventListener("message",W);const o=s=>{s.detail&&d(s.detail?JSON.stringify(s.detail):void 0)};return window.addEventListener("workspace_info_deps_updated",o),()=>{window.removeEventListener("message",W),window.removeEventListener("workspace_info_deps_updated",o)}},[]);const _=async()=>{var s,k;const o=await((s=z)==null?void 0:s.getSetting("cloudHost"));o&&(x.current=o),i!=null&&i.cloudID&&i.cloudOrigin&&De(i).then(y=>{b(y)}),(k=F)==null||k.listByWorkflowID(i.id).then(y=>{w(y)})},l=o=>{navigator.clipboard.writeText(o).then(()=>{L({title:"Copied to clipboard",status:"success",duration:2e3,isClosable:!0})}).catch(s=>{console.error("Failed to copy text: ",s)})},d=async o=>{var A,U,J;r(!0);const s=je(32),k=await((A=z)==null?void 0:A.getSetting("cloudHost"));let y,C;try{if(y=Se(),p==="new_version"?C=await((U=F)==null?void 0:U.add({workflowID:i.id,name:u,createTime:Date.now(),json:o??JSON.stringify(Ce.graph.serialize())})):C=await((J=F)==null?void 0:J.get(p)),!C){alert(`Failed to find version: ${p}, please try again.`),r(!1);return}}catch(V){console.error(V),r(!1),alert("Failed to share workflow, please try again.");return}const R=window.location.protocol,P=window.location.host,N=`${R}//${P}`,oe=k+`/share_workflow_confirm/${s}?redirectUrl=${N}`,se=window.open(oe,"Share Workflow","width=800,height=800"),q=V=>{var Q;if(V.origin===k&&V.data==="child_ready"){const te=(Q=E)==null?void 0:Q.curWorkflow;se.postMessage({workflow:te,version:C,nodeDefs:y,privacy:j.current},k),window.removeEventListener("message",q)}};window.addEventListener("message",q)},I=async()=>{var o;S?(o=T.current)==null||o.requestSubmit():d()},v=(K=(B=E)==null?void 0:B.curWorkflow)==null?void 0:K.cloudID;return e.jsxs(ce,{isOpen:!0,onClose:n,size:"lg",children:[e.jsx(de,{}),e.jsxs(ue,{width:["98%","90%","50%"],maxWidth:"600px",children:[e.jsxs(fe,{children:[e.jsxs(X,{justifyContent:"space-between",children:[e.jsxs("p",{children:['Share "',i==null?void 0:i.name,'"']}),e.jsx(M,{colorScheme:"teal",onClick:I,size:"sm",isDisabled:h,children:h?"Sharing":"Share"})]}),c&&e.jsxs(Ie,{fontSize:16,color:"GrayText",fontWeight:400,children:["Share to ",new URL(c).host]})]}),e.jsx(he,{pb:10,children:e.jsxs(H,{gap:5,children:[v==null?e.jsx(Fe,{options:ve,value:a,onChange:o=>{b(o)}}):e.jsx(Re,{variant:"outline",borderRadius:"full",width:"fit-content",children:e.jsx(Ee,{privacy:a,showEmoji:!0})}),v&&e.jsxs(Z,{spacing:2,color:"teal.400",children:[e.jsxs(We,{wordBreak:"break-all",href:c+"/workflow/"+v,isExternal:!0,children:[c+"/workflow/"+v," ",e.jsx(Le,{size:20,style:{display:"inline-block",verticalAlign:"middle"}})]}),e.jsx(M,{size:"sm",leftIcon:e.jsx(_e,{size:18}),onClick:()=>{var o,s;l(c+"/workflow/"+((s=(o=E)==null?void 0:o.curWorkflow)==null?void 0:s.cloudID))},children:"Copy link"})]}),e.jsx(ee,{gap:4,onChange:o=>{m(o)},value:p,children:e.jsx(H,{children:e.jsxs(Z,{mb:5,alignItems:"center",children:[e.jsx(ke,{value:u,width:"60%",onFocus:()=>{m("new_version")},onChange:o=>{f(o.target.value)}}),e.jsx(X,{color:"green",children:e.jsx(ye,{colorScheme:"purple",children:"Version Name"})})]})})}),e.jsxs(H,{borderRadius:6,borderWidth:"1px",p:2,children:[e.jsx(Te,{isChecked:S,onChange:()=>D(!S),fontWeight:"600",children:"Share Resource Links"}),S&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"GrayText"},children:"You can disable reource sharing if you don't want to resolve submit errors"}),e.jsx(be,{ref:T})]})]})]})})]})]})}function Me(){const n=new Date,u=n.getFullYear(),f=String(n.getMonth()+1).padStart(2,"0"),g=String(n.getDate()).padStart(2,"0");return`${u}-${f}-${g}`}export{Ke as default}; diff --git a/dist/workspace_web/SpotlightSearch-S3ZkRF9c.js b/dist/workspace_web/SpotlightSearch-CjlPIPLI.js similarity index 96% rename from dist/workspace_web/SpotlightSearch-S3ZkRF9c.js rename to dist/workspace_web/SpotlightSearch-CjlPIPLI.js index 3a927c0..db784f7 100644 --- a/dist/workspace_web/SpotlightSearch-S3ZkRF9c.js +++ b/dist/workspace_web/SpotlightSearch-CjlPIPLI.js @@ -1 +1 @@ -import{b as $,f as j,l as J,o as Z,h as w,r as g,j as n,g as A,$ as q,M as Q,O as X,U as ee,i as te}from"./input.js";import{aJ as ne,an as se,Z as re,aE as T,ak as G,H as ae,j as oe,h as O,a3 as ie,x as ce,a4 as le,E as ue,k as D}from"./App-6SVuhhTl.js";import{u as pe}from"./useDebounceFn-ld478fd0.js";import{I as de}from"./IconSearch-fViKszW1.js";import{V as he}from"./chunk-NTCQBYKE-Wk1_Xkg6.js";var[me,ge]=$({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),M=j(function(a,u){const r=J("Input",a),{children:c,className:l,...I}=Z(a),x=w("chakra-input__group",l),t={},E=ne(c),o=r.field;E.forEach(s=>{var p,y;r&&(o&&s.type.id==="InputLeftElement"&&(t.paddingStart=(p=o.height)!=null?p:o.h),o&&s.type.id==="InputRightElement"&&(t.paddingEnd=(y=o.height)!=null?y:o.h),s.type.id==="InputRightAddon"&&(t.borderEndRadius=0),s.type.id==="InputLeftAddon"&&(t.borderStartRadius=0))});const f=E.map(s=>{var p,y;const R=se({size:((p=s.props)==null?void 0:p.size)||a.size,variant:((y=s.props)==null?void 0:y.variant)||a.variant});return s.type.id!=="Input"?g.cloneElement(s,R):g.cloneElement(s,Object.assign(R,t,s.props))});return n.jsx(A.div,{className:x,ref:u,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...I,children:n.jsx(me,{value:r,children:f})})});M.displayName="InputGroup";var Se=A("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),C=j(function(a,u){var r,c;const{placement:l="left",...I}=a,x=ge(),t=x.field,o={[l==="left"?"insetStart":"insetEnd"]:"0",width:(r=t==null?void 0:t.height)!=null?r:t==null?void 0:t.h,height:(c=t==null?void 0:t.height)!=null?c:t==null?void 0:t.h,fontSize:t==null?void 0:t.fontSize,...x.element};return n.jsx(Se,{ref:u,__css:o,...I})});C.id="InputElement";C.displayName="InputElement";var P=j(function(a,u){const{className:r,...c}=a,l=w("chakra-input__left-element",r);return n.jsx(C,{ref:u,placement:"left",className:l,...c})});P.id="InputLeftElement";P.displayName="InputLeftElement";var K=j(function(a,u){const{className:r,...c}=a,l=w("chakra-input__right-element",r);return n.jsx(C,{ref:u,placement:"right",className:l,...c})});K.id="InputRightElement";K.displayName="InputRightElement";function Ie(){const{colorMode:S}=q(),{loadWorkflowID:a,setRoute:u}=g.useContext(re),[r,c]=g.useState([]),[l,I,x]=T(""),t=g.useRef([]),[E,o,f]=T([]),[s,p]=g.useState(!1),[y,R,b]=T(0),v=g.useRef({lastPressedKey:"",spotlightSearchShortcutFirstKey:"",spotlightSearchShortcutLastKey:""}),z=()=>{u("root")},_=e=>{a(e.id),z()},U=()=>{const e=r.filter(i=>!!i.name.toLocaleLowerCase().includes(x.current.toLocaleLowerCase()));o(e),R(0),p(!1)},[H,W]=pe(U,300),V=e=>{I(e.target.value),e.target.value?(H(),!s&&p(!0)):(p(!1),W(),o(t.current))},B=()=>s?null:l&&E.length===0?n.jsx(O,{ml:2,children:"No matching results"}):n.jsx(n.Fragment,{children:E.map((e,i)=>n.jsxs(te,{colorScheme:"teal",variant:"ghost",size:"sm",justifyContent:"start",px:2,color:S==="light"?"#1A202C":"rgba(255, 255, 255, 0.92)",onClick:()=>{_(e)},minH:"26px",isActive:i===y,children:[e.name,e.updateTime&&n.jsxs(O,{color:S==="light"?"GrayText":"rgb(255, 255, 255, 0.6)",ml:2,fontSize:"sm",children:["Updated: ",ie(e.updateTime)]})]},e.id))}),Y=async()=>{var k;const e=h=>h.map(m=>({type:"workflow",updateTime:(m==null?void 0:m.updateTime)??Date.now(),id:m.id,name:m.name.replace(/\.json$/,"")}))??[],i=await((k=ce)==null?void 0:k.listAll(le.RECENTLY_OPENED))??[];c(e(i));const d=e(i.slice(0,20));t.current=d,o(d)},N=e=>{R(i=>{const d=i+e;return d<0?f.current.length-1:d>f.current.length-1?0:d})};return g.useEffect(()=>{var k;Y(),(k=D)==null||k.getSetting("shortcuts").then(h=>{var F;const L=(h.openSpotlightSearch??((F=D)==null?void 0:F.defaultSettings.shortcuts.openSpotlightSearch)).split("+");v.current.spotlightSearchShortcutFirstKey=L[0]==="Command"?"Meta":L[0],v.current.spotlightSearchShortcutLastKey=L[L.length-1]});const e=h=>{h.key===v.current.spotlightSearchShortcutFirstKey&&v.current.lastPressedKey===v.current.spotlightSearchShortcutLastKey&&b.current>0&&f.current[b.current]&&_(f.current[b.current])},i=h=>{const m=h.key.toUpperCase();switch(v.current.lastPressedKey=m,m){case"ARROWDOWN":N(1);break;case"ARROWUP":N(-1);break;case"ENTER":_(f.current[b.current]);break}},d=h=>{switch(h.detail.shortcutType){case ue.openSpotlightSearch:N(1);break}};return document.addEventListener("keyup",e),document.addEventListener("keydown",i),window.addEventListener(G,d),()=>{document.removeEventListener("keyup",e),document.removeEventListener("keydown",i),window.removeEventListener(G,d)}},[]),n.jsx(Q,{isOpen:!0,onClose:z,size:"xl",children:n.jsxs(X,{bg:S==="light"?"rgba(255, 255, 255, 0.8)":"rgb(45, 55, 72, 0.8)",backdropFilter:"auto",backdropBlur:"8px",children:[n.jsxs(ae,{spacing:1,px:4,py:2,borderBottom:"1px",borderColor:"gray.400",children:[n.jsx(de,{size:20}),n.jsxs(M,{children:[n.jsx(oe,{value:l,onChange:V,autoFocus:!0,variant:"unstyled",fontSize:18}),s&&n.jsx(K,{h:"27px",children:n.jsx(ee,{size:"sm"})})]})]}),n.jsx(he,{spacing:1,align:"stretch",px:2,py:2,maxHeight:"calc(100vh - 200px)",overflowY:"auto",children:B()})]})})}export{Ie as default}; +import{b as $,f as j,l as J,o as Z,h as w,r as g,j as n,g as A,$ as q,M as Q,O as X,U as ee,i as te}from"./input.js";import{aJ as ne,an as se,Z as re,aE as T,ak as G,H as ae,j as oe,h as O,a3 as ie,x as ce,a4 as le,E as ue,k as D}from"./App-4M5AgwD2.js";import{u as pe}from"./useDebounceFn-ld478fd0.js";import{I as de}from"./IconSearch-E56kR4uG.js";import{V as he}from"./chunk-NTCQBYKE-rUyqBIyd.js";var[me,ge]=$({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),M=j(function(a,u){const r=J("Input",a),{children:c,className:l,...I}=Z(a),x=w("chakra-input__group",l),t={},E=ne(c),o=r.field;E.forEach(s=>{var p,y;r&&(o&&s.type.id==="InputLeftElement"&&(t.paddingStart=(p=o.height)!=null?p:o.h),o&&s.type.id==="InputRightElement"&&(t.paddingEnd=(y=o.height)!=null?y:o.h),s.type.id==="InputRightAddon"&&(t.borderEndRadius=0),s.type.id==="InputLeftAddon"&&(t.borderStartRadius=0))});const f=E.map(s=>{var p,y;const R=se({size:((p=s.props)==null?void 0:p.size)||a.size,variant:((y=s.props)==null?void 0:y.variant)||a.variant});return s.type.id!=="Input"?g.cloneElement(s,R):g.cloneElement(s,Object.assign(R,t,s.props))});return n.jsx(A.div,{className:x,ref:u,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...I,children:n.jsx(me,{value:r,children:f})})});M.displayName="InputGroup";var Se=A("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),C=j(function(a,u){var r,c;const{placement:l="left",...I}=a,x=ge(),t=x.field,o={[l==="left"?"insetStart":"insetEnd"]:"0",width:(r=t==null?void 0:t.height)!=null?r:t==null?void 0:t.h,height:(c=t==null?void 0:t.height)!=null?c:t==null?void 0:t.h,fontSize:t==null?void 0:t.fontSize,...x.element};return n.jsx(Se,{ref:u,__css:o,...I})});C.id="InputElement";C.displayName="InputElement";var P=j(function(a,u){const{className:r,...c}=a,l=w("chakra-input__left-element",r);return n.jsx(C,{ref:u,placement:"left",className:l,...c})});P.id="InputLeftElement";P.displayName="InputLeftElement";var K=j(function(a,u){const{className:r,...c}=a,l=w("chakra-input__right-element",r);return n.jsx(C,{ref:u,placement:"right",className:l,...c})});K.id="InputRightElement";K.displayName="InputRightElement";function Ie(){const{colorMode:S}=q(),{loadWorkflowID:a,setRoute:u}=g.useContext(re),[r,c]=g.useState([]),[l,I,x]=T(""),t=g.useRef([]),[E,o,f]=T([]),[s,p]=g.useState(!1),[y,R,b]=T(0),v=g.useRef({lastPressedKey:"",spotlightSearchShortcutFirstKey:"",spotlightSearchShortcutLastKey:""}),z=()=>{u("root")},_=e=>{a(e.id),z()},U=()=>{const e=r.filter(i=>!!i.name.toLocaleLowerCase().includes(x.current.toLocaleLowerCase()));o(e),R(0),p(!1)},[H,W]=pe(U,300),V=e=>{I(e.target.value),e.target.value?(H(),!s&&p(!0)):(p(!1),W(),o(t.current))},B=()=>s?null:l&&E.length===0?n.jsx(O,{ml:2,children:"No matching results"}):n.jsx(n.Fragment,{children:E.map((e,i)=>n.jsxs(te,{colorScheme:"teal",variant:"ghost",size:"sm",justifyContent:"start",px:2,color:S==="light"?"#1A202C":"rgba(255, 255, 255, 0.92)",onClick:()=>{_(e)},minH:"26px",isActive:i===y,children:[e.name,e.updateTime&&n.jsxs(O,{color:S==="light"?"GrayText":"rgb(255, 255, 255, 0.6)",ml:2,fontSize:"sm",children:["Updated: ",ie(e.updateTime)]})]},e.id))}),Y=async()=>{var k;const e=h=>h.map(m=>({type:"workflow",updateTime:(m==null?void 0:m.updateTime)??Date.now(),id:m.id,name:m.name.replace(/\.json$/,"")}))??[],i=await((k=ce)==null?void 0:k.listAll(le.RECENTLY_OPENED))??[];c(e(i));const d=e(i.slice(0,20));t.current=d,o(d)},N=e=>{R(i=>{const d=i+e;return d<0?f.current.length-1:d>f.current.length-1?0:d})};return g.useEffect(()=>{var k;Y(),(k=D)==null||k.getSetting("shortcuts").then(h=>{var F;const L=(h.openSpotlightSearch??((F=D)==null?void 0:F.defaultSettings.shortcuts.openSpotlightSearch)).split("+");v.current.spotlightSearchShortcutFirstKey=L[0]==="Command"?"Meta":L[0],v.current.spotlightSearchShortcutLastKey=L[L.length-1]});const e=h=>{h.key===v.current.spotlightSearchShortcutFirstKey&&v.current.lastPressedKey===v.current.spotlightSearchShortcutLastKey&&b.current>0&&f.current[b.current]&&_(f.current[b.current])},i=h=>{const m=h.key.toUpperCase();switch(v.current.lastPressedKey=m,m){case"ARROWDOWN":N(1);break;case"ARROWUP":N(-1);break;case"ENTER":_(f.current[b.current]);break}},d=h=>{switch(h.detail.shortcutType){case ue.openSpotlightSearch:N(1);break}};return document.addEventListener("keyup",e),document.addEventListener("keydown",i),window.addEventListener(G,d),()=>{document.removeEventListener("keyup",e),document.removeEventListener("keydown",i),window.removeEventListener(G,d)}},[]),n.jsx(Q,{isOpen:!0,onClose:z,size:"xl",children:n.jsxs(X,{bg:S==="light"?"rgba(255, 255, 255, 0.8)":"rgb(45, 55, 72, 0.8)",backdropFilter:"auto",backdropBlur:"8px",children:[n.jsxs(ae,{spacing:1,px:4,py:2,borderBottom:"1px",borderColor:"gray.400",children:[n.jsx(de,{size:20}),n.jsxs(M,{children:[n.jsx(oe,{value:l,onChange:V,autoFocus:!0,variant:"unstyled",fontSize:18}),s&&n.jsx(K,{h:"27px",children:n.jsx(ee,{size:"sm"})})]})]}),n.jsx(he,{spacing:1,align:"stretch",px:2,py:2,maxHeight:"calc(100vh - 200px)",overflowY:"auto",children:B()})]})})}export{Ie as default}; diff --git a/dist/workspace_web/chunk-3RSXBRAN-2SG_K1_B.js b/dist/workspace_web/chunk-3RSXBRAN-D3gE_K4K.js similarity index 96% rename from dist/workspace_web/chunk-3RSXBRAN-2SG_K1_B.js rename to dist/workspace_web/chunk-3RSXBRAN-D3gE_K4K.js index ed0fd6b..4778005 100644 --- a/dist/workspace_web/chunk-3RSXBRAN-2SG_K1_B.js +++ b/dist/workspace_web/chunk-3RSXBRAN-D3gE_K4K.js @@ -1 +1 @@ -import{f as x,j as l,g as i,h as b,l as C,o as E,n as I,r as f,a3 as P}from"./input.js";import{ac as z}from"./App-6SVuhhTl.js";var v=x(function(o,s){const{children:t,placeholder:n,className:r,...a}=o;return l.jsxs(i.select,{...a,ref:s,className:b("chakra-select",r),children:[n&&l.jsx("option",{value:"",children:n}),t]})});v.displayName="SelectField";function F(e,o){const s={},t={};for(const[n,r]of Object.entries(e))o.includes(n)?s[n]=r:t[n]=r;return[s,t]}var H=x((e,o)=>{var s;const t=C("Select",e),{rootProps:n,placeholder:r,icon:a,color:c,height:_,h:d,minH:h,minHeight:y,iconColor:p,iconSize:u,...j}=E(e),[g,N]=F(j,P),m=z(N),k={width:"100%",height:"fit-content",position:"relative",color:c},w={paddingEnd:"2rem",...t.field,_focus:{zIndex:"unset",...(s=t.field)==null?void 0:s._focus}};return l.jsxs(i.div,{className:"chakra-select__wrapper",__css:k,...g,...n,children:[l.jsx(v,{ref:o,height:d??_,minH:h??y,placeholder:r,...m,__css:w,children:e.children}),l.jsx(S,{"data-disabled":I(m.disabled),...(p||c)&&{color:p||c},__css:t.icon,...u&&{fontSize:u},children:a})]})});H.displayName="Select";var M=e=>l.jsx("svg",{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),R=i("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),S=e=>{const{children:o=l.jsx(M,{}),...s}=e,t=f.cloneElement(o,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return l.jsx(R,{...s,className:"chakra-select__icon-wrapper",children:f.isValidElement(o)?t:null})};S.displayName="SelectIcon";export{H as S}; +import{f as x,j as l,g as i,h as b,l as C,o as E,n as I,r as f,a3 as P}from"./input.js";import{ac as z}from"./App-4M5AgwD2.js";var v=x(function(o,s){const{children:t,placeholder:n,className:r,...a}=o;return l.jsxs(i.select,{...a,ref:s,className:b("chakra-select",r),children:[n&&l.jsx("option",{value:"",children:n}),t]})});v.displayName="SelectField";function F(e,o){const s={},t={};for(const[n,r]of Object.entries(e))o.includes(n)?s[n]=r:t[n]=r;return[s,t]}var H=x((e,o)=>{var s;const t=C("Select",e),{rootProps:n,placeholder:r,icon:a,color:c,height:_,h:d,minH:h,minHeight:y,iconColor:p,iconSize:u,...j}=E(e),[g,N]=F(j,P),m=z(N),k={width:"100%",height:"fit-content",position:"relative",color:c},w={paddingEnd:"2rem",...t.field,_focus:{zIndex:"unset",...(s=t.field)==null?void 0:s._focus}};return l.jsxs(i.div,{className:"chakra-select__wrapper",__css:k,...g,...n,children:[l.jsx(v,{ref:o,height:d??_,minH:h??y,placeholder:r,...m,__css:w,children:e.children}),l.jsx(S,{"data-disabled":I(m.disabled),...(p||c)&&{color:p||c},__css:t.icon,...u&&{fontSize:u},children:a})]})});H.displayName="Select";var M=e=>l.jsx("svg",{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),R=i("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),S=e=>{const{children:o=l.jsx(M,{}),...s}=e,t=f.cloneElement(o,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return l.jsx(R,{...s,className:"chakra-select__icon-wrapper",children:f.isValidElement(o)?t:null})};S.displayName="SelectIcon";export{H as S}; diff --git a/dist/workspace_web/chunk-7D6N5TE5-NbopAz8o.js b/dist/workspace_web/chunk-7D6N5TE5-zfYf6Y9A.js similarity index 98% rename from dist/workspace_web/chunk-7D6N5TE5-NbopAz8o.js rename to dist/workspace_web/chunk-7D6N5TE5-zfYf6Y9A.js index 8ddd7ac..4658b4d 100644 --- a/dist/workspace_web/chunk-7D6N5TE5-NbopAz8o.js +++ b/dist/workspace_web/chunk-7D6N5TE5-zfYf6Y9A.js @@ -1 +1 @@ -import{ai as me}from"./App-6SVuhhTl.js";import{d as B,r as o,e as I,y as ye,n as a,s as l,m as Z}from"./input.js";var he={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},pe=()=>typeof document<"u",$=!1,w=null,m=!1,R=!1,K=new Set;function x(e,u){K.forEach(n=>n(e,u))}var ke=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function we(e){return!(e.metaKey||!ke&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ee(e){m=!0,we(e)&&(w="keyboard",x("keyboard",e))}function h(e){if(w="pointer",e.type==="mousedown"||e.type==="pointerdown"){m=!0;const u=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=u.matches(":focus-visible")}catch{}if(n)return;x("pointer",e)}}function Ee(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function Ce(e){Ee(e)&&(m=!0,w="virtual")}function ge(e){e.target===window||e.target===document||(!m&&!R&&(w="virtual",x("virtual",e)),m=!1,R=!1)}function Le(){m=!1,R=!0}function te(){return w!=="pointer"}function Pe(){if(!pe()||$)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){m=!0,e.apply(this,n)},document.addEventListener("keydown",ee,!0),document.addEventListener("keyup",ee,!0),document.addEventListener("click",Ce,!0),window.addEventListener("focus",ge,!0),window.addEventListener("blur",Le,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",h,!0),document.addEventListener("pointermove",h,!0),document.addEventListener("pointerup",h,!0)):(document.addEventListener("mousedown",h,!0),document.addEventListener("mousemove",h,!0),document.addEventListener("mouseup",h,!0)),$=!0}function Se(e){Pe(),e(te());const u=()=>e(te());return K.add(u),()=>{K.delete(u)}}function Fe(e,u=[]){const n=Object.assign({},e);for(const s of u)s in n&&delete n[s];return n}function Re(e={}){const u=me(e),{isDisabled:n,isReadOnly:s,isRequired:P,isInvalid:d,id:A,onBlur:ne,onFocus:ae,"aria-describedby":H}=u,{defaultChecked:U,isChecked:V,isFocusable:oe,onChange:re,isIndeterminate:v,name:q,value:O,tabIndex:T=void 0,"aria-label":W,"aria-labelledby":_,"aria-invalid":S,...se}=e,F=Fe(se,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),D=B(re),j=B(ne),z=B(ae),[E,ie]=o.useState(!1),[b,C]=o.useState(!1),[p,G]=o.useState(!1),[k,y]=o.useState(!1);o.useEffect(()=>Se(ie),[]);const c=o.useRef(null),[N,ue]=o.useState(!0),[de,g]=o.useState(!!U),M=V!==void 0,r=M?V:de,J=o.useCallback(t=>{if(s||n){t.preventDefault();return}M||g(r?t.target.checked:v?!0:t.target.checked),D==null||D(t)},[s,n,r,M,v,D]);I(()=>{c.current&&(c.current.indeterminate=!!v)},[v]),ye(()=>{n&&C(!1)},[n,C]),I(()=>{const t=c.current;if(!(t!=null&&t.form))return;const i=()=>{g(!!U)};return t.form.addEventListener("reset",i),()=>{var f;return(f=t.form)==null?void 0:f.removeEventListener("reset",i)}},[]);const Q=n&&!oe,X=o.useCallback(t=>{t.key===" "&&y(!0)},[y]),Y=o.useCallback(t=>{t.key===" "&&y(!1)},[y]);I(()=>{if(!c.current)return;c.current.checked!==r&&g(c.current.checked)},[c.current]);const le=o.useCallback((t={},i=null)=>{const f=L=>{b&&L.preventDefault(),y(!0)};return{...t,ref:i,"data-active":a(k),"data-hover":a(p),"data-checked":a(r),"data-focus":a(b),"data-focus-visible":a(b&&E),"data-indeterminate":a(v),"data-disabled":a(n),"data-invalid":a(d),"data-readonly":a(s),"aria-hidden":!0,onMouseDown:l(t.onMouseDown,f),onMouseUp:l(t.onMouseUp,()=>y(!1)),onMouseEnter:l(t.onMouseEnter,()=>G(!0)),onMouseLeave:l(t.onMouseLeave,()=>G(!1))}},[k,r,n,b,E,p,v,d,s]),ce=o.useCallback((t={},i=null)=>({...t,ref:i,"data-active":a(k),"data-hover":a(p),"data-checked":a(r),"data-focus":a(b),"data-focus-visible":a(b&&E),"data-indeterminate":a(v),"data-disabled":a(n),"data-invalid":a(d),"data-readonly":a(s)}),[k,r,n,b,E,p,v,d,s]),fe=o.useCallback((t={},i=null)=>({...F,...t,ref:Z(i,f=>{f&&ue(f.tagName==="LABEL")}),onClick:l(t.onClick,()=>{var f;N||((f=c.current)==null||f.click(),requestAnimationFrame(()=>{var L;(L=c.current)==null||L.focus({preventScroll:!0})}))}),"data-disabled":a(n),"data-checked":a(r),"data-invalid":a(d)}),[F,n,r,d,N]),ve=o.useCallback((t={},i=null)=>({...t,ref:Z(c,i),type:"checkbox",name:q,value:O,id:A,tabIndex:T,onChange:l(t.onChange,J),onBlur:l(t.onBlur,j,()=>C(!1)),onFocus:l(t.onFocus,z,()=>C(!0)),onKeyDown:l(t.onKeyDown,X),onKeyUp:l(t.onKeyUp,Y),required:P,checked:r,disabled:Q,readOnly:s,"aria-label":W,"aria-labelledby":_,"aria-invalid":S?!!S:d,"aria-describedby":H,"aria-disabled":n,style:he}),[q,O,A,J,j,z,X,Y,P,r,Q,s,W,_,S,d,H,n,T]),be=o.useCallback((t={},i=null)=>({...t,ref:i,onMouseDown:l(t.onMouseDown,De),"data-disabled":a(n),"data-checked":a(r),"data-invalid":a(d)}),[r,n,d]);return{state:{isInvalid:d,isFocused:b,isChecked:r,isActive:k,isHovered:p,isIndeterminate:v,isDisabled:n,isReadOnly:s,isRequired:P},getRootProps:fe,getCheckboxProps:le,getIndicatorProps:ce,getInputProps:ve,getLabelProps:be,htmlProps:F}}function De(e){e.preventDefault(),e.stopPropagation()}export{Re as u}; +import{ai as me}from"./App-4M5AgwD2.js";import{d as B,r as o,e as I,y as ye,n as a,s as l,m as Z}from"./input.js";var he={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},pe=()=>typeof document<"u",$=!1,w=null,m=!1,R=!1,K=new Set;function x(e,u){K.forEach(n=>n(e,u))}var ke=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function we(e){return!(e.metaKey||!ke&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ee(e){m=!0,we(e)&&(w="keyboard",x("keyboard",e))}function h(e){if(w="pointer",e.type==="mousedown"||e.type==="pointerdown"){m=!0;const u=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=u.matches(":focus-visible")}catch{}if(n)return;x("pointer",e)}}function Ee(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function Ce(e){Ee(e)&&(m=!0,w="virtual")}function ge(e){e.target===window||e.target===document||(!m&&!R&&(w="virtual",x("virtual",e)),m=!1,R=!1)}function Le(){m=!1,R=!0}function te(){return w!=="pointer"}function Pe(){if(!pe()||$)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){m=!0,e.apply(this,n)},document.addEventListener("keydown",ee,!0),document.addEventListener("keyup",ee,!0),document.addEventListener("click",Ce,!0),window.addEventListener("focus",ge,!0),window.addEventListener("blur",Le,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",h,!0),document.addEventListener("pointermove",h,!0),document.addEventListener("pointerup",h,!0)):(document.addEventListener("mousedown",h,!0),document.addEventListener("mousemove",h,!0),document.addEventListener("mouseup",h,!0)),$=!0}function Se(e){Pe(),e(te());const u=()=>e(te());return K.add(u),()=>{K.delete(u)}}function Fe(e,u=[]){const n=Object.assign({},e);for(const s of u)s in n&&delete n[s];return n}function Re(e={}){const u=me(e),{isDisabled:n,isReadOnly:s,isRequired:P,isInvalid:d,id:A,onBlur:ne,onFocus:ae,"aria-describedby":H}=u,{defaultChecked:U,isChecked:V,isFocusable:oe,onChange:re,isIndeterminate:v,name:q,value:O,tabIndex:T=void 0,"aria-label":W,"aria-labelledby":_,"aria-invalid":S,...se}=e,F=Fe(se,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),D=B(re),j=B(ne),z=B(ae),[E,ie]=o.useState(!1),[b,C]=o.useState(!1),[p,G]=o.useState(!1),[k,y]=o.useState(!1);o.useEffect(()=>Se(ie),[]);const c=o.useRef(null),[N,ue]=o.useState(!0),[de,g]=o.useState(!!U),M=V!==void 0,r=M?V:de,J=o.useCallback(t=>{if(s||n){t.preventDefault();return}M||g(r?t.target.checked:v?!0:t.target.checked),D==null||D(t)},[s,n,r,M,v,D]);I(()=>{c.current&&(c.current.indeterminate=!!v)},[v]),ye(()=>{n&&C(!1)},[n,C]),I(()=>{const t=c.current;if(!(t!=null&&t.form))return;const i=()=>{g(!!U)};return t.form.addEventListener("reset",i),()=>{var f;return(f=t.form)==null?void 0:f.removeEventListener("reset",i)}},[]);const Q=n&&!oe,X=o.useCallback(t=>{t.key===" "&&y(!0)},[y]),Y=o.useCallback(t=>{t.key===" "&&y(!1)},[y]);I(()=>{if(!c.current)return;c.current.checked!==r&&g(c.current.checked)},[c.current]);const le=o.useCallback((t={},i=null)=>{const f=L=>{b&&L.preventDefault(),y(!0)};return{...t,ref:i,"data-active":a(k),"data-hover":a(p),"data-checked":a(r),"data-focus":a(b),"data-focus-visible":a(b&&E),"data-indeterminate":a(v),"data-disabled":a(n),"data-invalid":a(d),"data-readonly":a(s),"aria-hidden":!0,onMouseDown:l(t.onMouseDown,f),onMouseUp:l(t.onMouseUp,()=>y(!1)),onMouseEnter:l(t.onMouseEnter,()=>G(!0)),onMouseLeave:l(t.onMouseLeave,()=>G(!1))}},[k,r,n,b,E,p,v,d,s]),ce=o.useCallback((t={},i=null)=>({...t,ref:i,"data-active":a(k),"data-hover":a(p),"data-checked":a(r),"data-focus":a(b),"data-focus-visible":a(b&&E),"data-indeterminate":a(v),"data-disabled":a(n),"data-invalid":a(d),"data-readonly":a(s)}),[k,r,n,b,E,p,v,d,s]),fe=o.useCallback((t={},i=null)=>({...F,...t,ref:Z(i,f=>{f&&ue(f.tagName==="LABEL")}),onClick:l(t.onClick,()=>{var f;N||((f=c.current)==null||f.click(),requestAnimationFrame(()=>{var L;(L=c.current)==null||L.focus({preventScroll:!0})}))}),"data-disabled":a(n),"data-checked":a(r),"data-invalid":a(d)}),[F,n,r,d,N]),ve=o.useCallback((t={},i=null)=>({...t,ref:Z(c,i),type:"checkbox",name:q,value:O,id:A,tabIndex:T,onChange:l(t.onChange,J),onBlur:l(t.onBlur,j,()=>C(!1)),onFocus:l(t.onFocus,z,()=>C(!0)),onKeyDown:l(t.onKeyDown,X),onKeyUp:l(t.onKeyUp,Y),required:P,checked:r,disabled:Q,readOnly:s,"aria-label":W,"aria-labelledby":_,"aria-invalid":S?!!S:d,"aria-describedby":H,"aria-disabled":n,style:he}),[q,O,A,J,j,z,X,Y,P,r,Q,s,W,_,S,d,H,n,T]),be=o.useCallback((t={},i=null)=>({...t,ref:i,onMouseDown:l(t.onMouseDown,De),"data-disabled":a(n),"data-checked":a(r),"data-invalid":a(d)}),[r,n,d]);return{state:{isInvalid:d,isFocused:b,isChecked:r,isActive:k,isHovered:p,isIndeterminate:v,isDisabled:n,isReadOnly:s,isRequired:P},getRootProps:fe,getCheckboxProps:le,getIndicatorProps:ce,getInputProps:ve,getLabelProps:be,htmlProps:F}}function De(e){e.preventDefault(),e.stopPropagation()}export{Re as u}; diff --git a/dist/workspace_web/chunk-JARCRF6W-r8MNagok.js b/dist/workspace_web/chunk-JARCRF6W-ibNbyhHV.js similarity index 97% rename from dist/workspace_web/chunk-JARCRF6W-r8MNagok.js rename to dist/workspace_web/chunk-JARCRF6W-ibNbyhHV.js index 574c99f..0c6e3e9 100644 --- a/dist/workspace_web/chunk-JARCRF6W-r8MNagok.js +++ b/dist/workspace_web/chunk-JARCRF6W-ibNbyhHV.js @@ -1 +1 @@ -import{b as D,r as p,j as t,g as i,a0 as v,f as j,l as T,o as B,H as E,h as $}from"./input.js";import{u as z}from"./chunk-7D6N5TE5-NbopAz8o.js";var[Z,F]=D({name:"CheckboxGroupContext",strict:!1});function M(o){const[s,n]=p.useState(o),[e,r]=p.useState(!1);return o!==s&&(r(!0),n(o)),e}function W(o){return t.jsx(i.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...o,children:t.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function X(o){return t.jsx(i.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...o,children:t.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function H(o){const{isIndeterminate:s,isChecked:n,...e}=o,r=s?X:W;return n||s?t.jsx(i.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:t.jsx(r,{...e})}):null}var L={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},O={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},q=v({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),J=v({from:{opacity:0},to:{opacity:1}}),K=v({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Q=j(function(s,n){const e=F(),r={...e,...s},a=T("Checkbox",r),c=B(s),{spacing:x="0.5rem",className:C,children:m,iconColor:u,iconSize:d,icon:f=t.jsx(H,{}),isChecked:g,isDisabled:k=e==null?void 0:e.isDisabled,onChange:h,inputProps:w,..._}=c;let y=g;e!=null&&e.value&&c.value&&(y=e.value.includes(c.value));let b=h;e!=null&&e.onChange&&c.value&&(b=E(e.onChange,h));const{state:l,getInputProps:A,getCheckboxProps:S,getLabelProps:G,getRootProps:P}=z({..._,isDisabled:k,isChecked:y,onChange:b}),I=M(l.isChecked),R=p.useMemo(()=>({animation:I?l.isIndeterminate?`${J} 20ms linear, ${K} 200ms linear`:`${q} 200ms linear`:void 0,fontSize:d,color:u,...a.icon}),[u,d,I,l.isIndeterminate,a.icon]),N=p.cloneElement(f,{__css:R,isIndeterminate:l.isIndeterminate,isChecked:l.isChecked});return t.jsxs(i.label,{__css:{...O,...a.container},className:$("chakra-checkbox",C),...P(),children:[t.jsx("input",{className:"chakra-checkbox__input",...A(w,n)}),t.jsx(i.span,{__css:{...L,...a.control},className:"chakra-checkbox__control",...S(),children:N}),m&&t.jsx(i.span,{className:"chakra-checkbox__label",...G(),__css:{marginStart:x,...a.label},children:m})]})});Q.displayName="Checkbox";var U=j(function(s,n){const{templateAreas:e,gap:r,rowGap:a,columnGap:c,column:x,row:C,autoFlow:m,autoRows:u,templateRows:d,autoColumns:f,templateColumns:g,...k}=s,h={display:"grid",gridTemplateAreas:e,gridGap:r,gridRowGap:a,gridColumnGap:c,gridAutoColumns:f,gridColumn:x,gridRow:C,gridAutoFlow:m,gridAutoRows:u,gridTemplateRows:d,gridTemplateColumns:g};return t.jsx(i.div,{ref:n,__css:h,...k})});U.displayName="Grid";export{Q as C,U as G}; +import{b as D,r as p,j as t,g as i,a0 as v,f as j,l as T,o as B,H as E,h as $}from"./input.js";import{u as z}from"./chunk-7D6N5TE5-zfYf6Y9A.js";var[Z,F]=D({name:"CheckboxGroupContext",strict:!1});function M(o){const[s,n]=p.useState(o),[e,r]=p.useState(!1);return o!==s&&(r(!0),n(o)),e}function W(o){return t.jsx(i.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...o,children:t.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function X(o){return t.jsx(i.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...o,children:t.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function H(o){const{isIndeterminate:s,isChecked:n,...e}=o,r=s?X:W;return n||s?t.jsx(i.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:t.jsx(r,{...e})}):null}var L={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},O={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},q=v({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),J=v({from:{opacity:0},to:{opacity:1}}),K=v({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Q=j(function(s,n){const e=F(),r={...e,...s},a=T("Checkbox",r),c=B(s),{spacing:x="0.5rem",className:C,children:m,iconColor:u,iconSize:d,icon:f=t.jsx(H,{}),isChecked:g,isDisabled:k=e==null?void 0:e.isDisabled,onChange:h,inputProps:w,..._}=c;let y=g;e!=null&&e.value&&c.value&&(y=e.value.includes(c.value));let b=h;e!=null&&e.onChange&&c.value&&(b=E(e.onChange,h));const{state:l,getInputProps:A,getCheckboxProps:S,getLabelProps:G,getRootProps:P}=z({..._,isDisabled:k,isChecked:y,onChange:b}),I=M(l.isChecked),R=p.useMemo(()=>({animation:I?l.isIndeterminate?`${J} 20ms linear, ${K} 200ms linear`:`${q} 200ms linear`:void 0,fontSize:d,color:u,...a.icon}),[u,d,I,l.isIndeterminate,a.icon]),N=p.cloneElement(f,{__css:R,isIndeterminate:l.isIndeterminate,isChecked:l.isChecked});return t.jsxs(i.label,{__css:{...O,...a.container},className:$("chakra-checkbox",C),...P(),children:[t.jsx("input",{className:"chakra-checkbox__input",...A(w,n)}),t.jsx(i.span,{__css:{...L,...a.control},className:"chakra-checkbox__control",...S(),children:N}),m&&t.jsx(i.span,{className:"chakra-checkbox__label",...G(),__css:{marginStart:x,...a.label},children:m})]})});Q.displayName="Checkbox";var U=j(function(s,n){const{templateAreas:e,gap:r,rowGap:a,columnGap:c,column:x,row:C,autoFlow:m,autoRows:u,templateRows:d,autoColumns:f,templateColumns:g,...k}=s,h={display:"grid",gridTemplateAreas:e,gridGap:r,gridRowGap:a,gridColumnGap:c,gridAutoColumns:f,gridColumn:x,gridRow:C,gridAutoFlow:m,gridAutoRows:u,gridTemplateRows:d,gridTemplateColumns:g};return t.jsx(i.div,{ref:n,__css:h,...k})});U.displayName="Grid";export{Q as C,U as G}; diff --git a/dist/workspace_web/chunk-NTCQBYKE-Wk1_Xkg6.js b/dist/workspace_web/chunk-NTCQBYKE-rUyqBIyd.js similarity index 65% rename from dist/workspace_web/chunk-NTCQBYKE-Wk1_Xkg6.js rename to dist/workspace_web/chunk-NTCQBYKE-rUyqBIyd.js index 4425c26..fcb877b 100644 --- a/dist/workspace_web/chunk-NTCQBYKE-Wk1_Xkg6.js +++ b/dist/workspace_web/chunk-NTCQBYKE-rUyqBIyd.js @@ -1 +1 @@ -import{g as t}from"./App-6SVuhhTl.js";import{f as o,j as s}from"./input.js";var e=o((a,r)=>s.jsx(t,{align:"center",...a,direction:"column",ref:r}));e.displayName="VStack";export{e as V}; +import{g as t}from"./App-4M5AgwD2.js";import{f as o,j as s}from"./input.js";var e=o((a,r)=>s.jsx(t,{align:"center",...a,direction:"column",ref:r}));e.displayName="VStack";export{e as V}; diff --git a/dist/workspace_web/chunk-VTV6N5LE-CPEmZVmx.js b/dist/workspace_web/chunk-VTV6N5LE-x5KZOIPv.js similarity index 95% rename from dist/workspace_web/chunk-VTV6N5LE-CPEmZVmx.js rename to dist/workspace_web/chunk-VTV6N5LE-x5KZOIPv.js index 5655624..9f4ffff 100644 --- a/dist/workspace_web/chunk-VTV6N5LE-CPEmZVmx.js +++ b/dist/workspace_web/chunk-VTV6N5LE-x5KZOIPv.js @@ -1 +1 @@ -import{f as l,p as f,o as h,j as e,g as n,h as m,l as y,r as o}from"./input.js";import{u as w}from"./chunk-7D6N5TE5-NbopAz8o.js";var N=l(function(a,i){const s=f("Link",a),{className:c,isExternal:t,...r}=h(a);return e.jsx(n.a,{target:t?"_blank":void 0,rel:t?"noopener":void 0,ref:i,className:m("chakra-link",c),...r,__css:s})});N.displayName="Link";var j=l(function(a,i){const s=y("Switch",a),{spacing:c="0.5rem",children:t,...r}=h(a),{getIndicatorProps:p,getInputProps:u,getCheckboxProps:x,getRootProps:_,getLabelProps:g}=w(r),b=o.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...s.container}),[s.container]),S=o.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...s.track}),[s.track]),d=o.useMemo(()=>({userSelect:"none",marginStart:c,...s.label}),[c,s.label]);return e.jsxs(n.label,{..._(),className:m("chakra-switch",a.className),__css:b,children:[e.jsx("input",{className:"chakra-switch__input",...u({},i)}),e.jsx(n.span,{...x(),className:"chakra-switch__track",__css:S,children:e.jsx(n.span,{__css:s.thumb,className:"chakra-switch__thumb",...p()})}),t&&e.jsx(n.span,{className:"chakra-switch__label",...g(),__css:d,children:t})]})});j.displayName="Switch";export{N as L,j as S}; +import{f as l,p as f,o as h,j as e,g as n,h as m,l as y,r as o}from"./input.js";import{u as w}from"./chunk-7D6N5TE5-zfYf6Y9A.js";var N=l(function(a,i){const s=f("Link",a),{className:c,isExternal:t,...r}=h(a);return e.jsx(n.a,{target:t?"_blank":void 0,rel:t?"noopener":void 0,ref:i,className:m("chakra-link",c),...r,__css:s})});N.displayName="Link";var j=l(function(a,i){const s=y("Switch",a),{spacing:c="0.5rem",children:t,...r}=h(a),{getIndicatorProps:p,getInputProps:u,getCheckboxProps:x,getRootProps:_,getLabelProps:g}=w(r),b=o.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...s.container}),[s.container]),S=o.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...s.track}),[s.track]),d=o.useMemo(()=>({userSelect:"none",marginStart:c,...s.label}),[c,s.label]);return e.jsxs(n.label,{..._(),className:m("chakra-switch",a.className),__css:b,children:[e.jsx("input",{className:"chakra-switch__input",...u({},i)}),e.jsx(n.span,{...x(),className:"chakra-switch__track",__css:S,children:e.jsx(n.span,{__css:s.thumb,className:"chakra-switch__thumb",...p()})}),t&&e.jsx(n.span,{className:"chakra-switch__label",...g(),__css:d,children:t})]})});j.displayName="Switch";export{N as L,j as S}; diff --git a/dist/workspace_web/input.js b/dist/workspace_web/input.js index b568727..7ce446e 100644 --- a/dist/workspace_web/input.js +++ b/dist/workspace_web/input.js @@ -679,10 +679,10 @@ Error generating stack: `+i.message+` } ${aB} - `}),zw=document.createElement("div");document.body.append(zw);const lB=Ar.lazy(()=>Xk(()=>import("./App-6SVuhhTl.js").then(e=>e.aT),__vite__mapDeps([0,1])).then(({default:e})=>({default:e}))),uB={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e7,sticky:11e6,banner:12e6,overlay:13e6,modal:14e6,popover:15e6,skipLink:16e6,toast:17e6,tooltip:18e6},cB=Pz({zIndices:uB,components:{Card:{baseStyle:e=>({container:{backgroundColor:e.colorMode==="dark"?"#171B21":"#F6F8FA"}})}}});gd.createRoot(zw).render(E.jsx(Ar.StrictMode,{children:E.jsxs(BI,{resetCSS:!1,disableGlobalStyle:!0,theme:cB,children:[E.jsx(sB,{scope:".workspace_manager"}),E.jsx(DP,{initialColorMode:"dark"}),E.jsx(iB,{children:E.jsx(S.Suspense,{children:E.jsx(lB,{})})})]})}));const Hf=document.body,dB={attributes:!0,attributeFilter:["class"]},fB=function(e,t){const r=document.documentElement;r.style.colorScheme==="dark"&&r.style.removeProperty("color-scheme");for(const n of e)if(n.type==="attributes"&&n.attributeName==="class")for(const o of Hf.classList)o.includes("chakra")&&Hf.classList.remove(o)},hB=new MutationObserver(fB);hB.observe(Hf,dB);export{Qh as $,PB as A,CB as B,TB as C,_B as D,TP as E,lr as F,oi as G,vB as H,Ya as I,Ap as J,yB as K,Ka as L,yw as M,Ew as N,_w as O,ja as P,Tw as Q,Aw as R,$w as S,Pw as T,Tp as U,xb as V,EB as W,os as X,Ar as Y,pB as Z,Xk as _,kB as a,vP as a0,rB as a1,nB as a2,gB as a3,mn as b,wB as c,i3 as d,Bl as e,pt as f,_e as g,Be as h,Mx as i,E as j,SB as k,Xb as l,If as m,_v as n,Iu as o,Bu as p,mB as q,S as r,Ei as s,Gf as t,IP as u,uw as v,bB as w,Kt as x,yg as y,uO as z}; + `}),zw=document.createElement("div");document.body.append(zw);const lB=Ar.lazy(()=>Xk(()=>import("./App-4M5AgwD2.js").then(e=>e.aT),__vite__mapDeps([0,1])).then(({default:e})=>({default:e}))),uB={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e7,sticky:11e6,banner:12e6,overlay:13e6,modal:14e6,popover:15e6,skipLink:16e6,toast:17e6,tooltip:18e6},cB=Pz({zIndices:uB,components:{Card:{baseStyle:e=>({container:{backgroundColor:e.colorMode==="dark"?"#171B21":"#F6F8FA"}})}}});gd.createRoot(zw).render(E.jsx(Ar.StrictMode,{children:E.jsxs(BI,{resetCSS:!1,disableGlobalStyle:!0,theme:cB,children:[E.jsx(sB,{scope:".workspace_manager"}),E.jsx(DP,{initialColorMode:"dark"}),E.jsx(iB,{children:E.jsx(S.Suspense,{children:E.jsx(lB,{})})})]})}));const Hf=document.body,dB={attributes:!0,attributeFilter:["class"]},fB=function(e,t){const r=document.documentElement;r.style.colorScheme==="dark"&&r.style.removeProperty("color-scheme");for(const n of e)if(n.type==="attributes"&&n.attributeName==="class")for(const o of Hf.classList)o.includes("chakra")&&Hf.classList.remove(o)},hB=new MutationObserver(fB);hB.observe(Hf,dB);export{Qh as $,PB as A,CB as B,TB as C,_B as D,TP as E,lr as F,oi as G,vB as H,Ya as I,Ap as J,yB as K,Ka as L,yw as M,Ew as N,_w as O,ja as P,Tw as Q,Aw as R,$w as S,Pw as T,Tp as U,xb as V,EB as W,os as X,Ar as Y,pB as Z,Xk as _,kB as a,vP as a0,rB as a1,nB as a2,gB as a3,mn as b,wB as c,i3 as d,Bl as e,pt as f,_e as g,Be as h,Mx as i,E as j,SB as k,Xb as l,If as m,_v as n,Iu as o,Bu as p,mB as q,S as r,Ei as s,Gf as t,IP as u,uw as v,bB as w,Kt as x,yg as y,uO as z}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["workspace_web/App-6SVuhhTl.js","workspace_web/assets/App-JXePnJiV.css"] + __vite__mapDeps.viteFileDeps = ["workspace_web/App-4M5AgwD2.js","workspace_web/assets/App-JXePnJiV.css"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file