From ac58fe7645fa461cc0aec6851a0631cbc0001d2d Mon Sep 17 00:00:00 2001 From: Weixuan Fu Date: Tue, 5 Mar 2024 21:36:12 +0800 Subject: [PATCH] build dist --- dist/workspace_web/{App-bwnmchpl.js => App-7ZVFJHq5.js} | 6 +++--- .../{GalleryModal-AC5mHOPW.js => GalleryModal-OOtkZCVW.js} | 2 +- .../{IconCopy-NTjy7XFG.js => IconCopy-D6uYPUbf.js} | 2 +- ...-tTqamchA.js => InstallMissingModelsButton-h7fGpVGR.js} | 2 +- .../{MediaPreview-hpFtmf6V.js => MediaPreview-1uswM5Au.js} | 2 +- dist/workspace_web/ModelManagerTopbar-aMEaROu7.js | 7 +++++++ dist/workspace_web/ModelManagerTopbar-yJwd9tK5.js | 7 ------- ...lesDrawer-FEgtq9Pl.js => RecentFilesDrawer-vciP1wo4.js} | 2 +- .../{ShareDialog-AtzuU051.js => ShareDialog-Q3AC6yal.js} | 2 +- ...unk-JARCRF6W-yJJssWqi.js => chunk-JARCRF6W-we4xocqW.js} | 2 +- ...unk-NTCQBYKE-X_7oODtg.js => chunk-NTCQBYKE-qydYN07M.js} | 2 +- dist/workspace_web/input.js | 4 ++-- 12 files changed, 20 insertions(+), 20 deletions(-) rename dist/workspace_web/{App-bwnmchpl.js => App-7ZVFJHq5.js} (99%) rename dist/workspace_web/{GalleryModal-AC5mHOPW.js => GalleryModal-OOtkZCVW.js} (96%) rename dist/workspace_web/{IconCopy-NTjy7XFG.js => IconCopy-D6uYPUbf.js} (90%) rename dist/workspace_web/{InstallMissingModelsButton-tTqamchA.js => InstallMissingModelsButton-h7fGpVGR.js} (92%) rename dist/workspace_web/{MediaPreview-hpFtmf6V.js => MediaPreview-1uswM5Au.js} (96%) create mode 100644 dist/workspace_web/ModelManagerTopbar-aMEaROu7.js delete mode 100644 dist/workspace_web/ModelManagerTopbar-yJwd9tK5.js rename dist/workspace_web/{RecentFilesDrawer-FEgtq9Pl.js => RecentFilesDrawer-vciP1wo4.js} (99%) rename dist/workspace_web/{ShareDialog-AtzuU051.js => ShareDialog-Q3AC6yal.js} (98%) rename dist/workspace_web/{chunk-JARCRF6W-yJJssWqi.js => chunk-JARCRF6W-we4xocqW.js} (99%) rename dist/workspace_web/{chunk-NTCQBYKE-X_7oODtg.js => chunk-NTCQBYKE-qydYN07M.js} (65%) diff --git a/dist/workspace_web/App-bwnmchpl.js b/dist/workspace_web/App-7ZVFJHq5.js similarity index 99% rename from dist/workspace_web/App-bwnmchpl.js rename to dist/workspace_web/App-7ZVFJHq5.js index 6844759..f620fa3 100644 --- a/dist/workspace_web/App-bwnmchpl.js +++ b/dist/workspace_web/App-7ZVFJHq5.js @@ -171,7 +171,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho .c-json-map { color: #f56847; }`,""]);const v=h},645:s=>{s.exports=function(l){var c=[];return c.toString=function(){return this.map(function(u){var d="",p=u[5]!==void 0;return u[4]&&(d+="@supports (".concat(u[4],") {")),u[2]&&(d+="@media ".concat(u[2]," {")),p&&(d+="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {")),d+=l(u),p&&(d+="}"),u[2]&&(d+="}"),u[4]&&(d+="}"),d}).join("")},c.i=function(u,d,p,h,v){typeof u=="string"&&(u=[[null,u,void 0]]);var f={};if(p)for(var y=0;y0?" ".concat(_[5]):""," {").concat(_[1],"}")),_[5]=v),d&&(_[2]&&(_[1]="@media ".concat(_[2]," {").concat(_[1],"}")),_[2]=d),h&&(_[4]?(_[1]="@supports (".concat(_[4],") {").concat(_[1],"}"),_[4]=h):_[4]="".concat(h)),c.push(_))}},c}},81:s=>{s.exports=function(l){return l[1]}},379:s=>{var l=[];function c(p){for(var h=-1,v=0;v{var l={};s.exports=function(c,u){var d=function(p){if(l[p]===void 0){var h=document.querySelector(p);if(window.HTMLIFrameElement&&h instanceof window.HTMLIFrameElement)try{h=h.contentDocument.head}catch{h=null}l[p]=h}return l[p]}(c);if(!d)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");d.appendChild(u)}},216:s=>{s.exports=function(l){var c=document.createElement("style");return l.setAttributes(c,l.attributes),l.insert(c,l.options),c}},565:(s,l,c)=>{s.exports=function(u){var d=c.nc;d&&u.setAttribute("nonce",d)}},795:s=>{s.exports=function(l){var c=l.insertStyleElement(l);return{update:function(u){(function(d,p,h){var v="";h.supports&&(v+="@supports (".concat(h.supports,") {")),h.media&&(v+="@media ".concat(h.media," {"));var f=h.layer!==void 0;f&&(v+="@layer".concat(h.layer.length>0?" ".concat(h.layer):""," {")),v+=h.css,f&&(v+="}"),h.media&&(v+="}"),h.supports&&(v+="}");var y=h.sourceMap;y&&typeof btoa<"u"&&(v+=` -/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(y))))," */")),p.styleTagTransform(v,d,p.options)})(c,l,u)},remove:function(){(function(u){if(u.parentNode===null)return!1;u.parentNode.removeChild(u)})(c)}}}},589:s=>{s.exports=function(l,c){if(c.styleSheet)c.styleSheet.cssText=l;else{for(;c.firstChild;)c.removeChild(c.firstChild);c.appendChild(document.createTextNode(l))}}},250:s=>{s.exports=n}},o={};function a(s){var l=o[s];if(l!==void 0)return l.exports;var c=o[s]={id:s,exports:{}};return r[s](c,c.exports,a),c.exports}a.n=s=>{var l=s&&s.__esModule?()=>s.default:()=>s;return a.d(l,{a:l}),l},a.d=(s,l)=>{for(var c in l)a.o(l,c)&&!a.o(s,c)&&Object.defineProperty(s,c,{enumerable:!0,get:l[c]})},a.o=(s,l)=>Object.prototype.hasOwnProperty.call(s,l),a.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var i=a(579);return i.default})()})})(wl);var Xh=wl.exports;const Qh=fa(Xh);function ep(){const{jsonDiff:t,compareJson:e}=P.useContext(_t);return t==null?null:O.jsx($r,{isOpen:!0,onClose:()=>{e(null)},children:O.jsx(qr,{children:O.jsx(yt,{height:"80vh",width:"90%",overflow:"scroll",children:O.jsx(Qh,{oldData:t==null?void 0:t.old,newData:t==null?void 0:t.new})})})})}const tp=P.lazy(()=>Hr(()=>import("./ShareDialog-AtzuU051.js"),__vite__mapDeps([0,1,2,3])));function np(){const{curFlowID:t,loadWorkflowID:e,discardUnsavedChanges:n,saveCurWorkflow:r,setRoute:o,route:a}=P.useContext(_t),[i,s]=P.useState(!1),[l,c]=P.useState(""),[u,d]=P.useState(""),[p,h]=P.useState(),[v,f]=P.useState({save:"",saveAs:""}),[y,m]=P.useState(!1);P.useEffect(()=>{t&&(G==null||G.get(t).then(I=>{c((I==null?void 0:I.name)??""),h(I)})),X==null||X.getSetting("shortcuts").then(I=>{f(I)})},[t]);const w=I=>{c(I.target.value),u&&d("")},_=async()=>{if(!t){alert("Flow ID is required");return}const I=JSON.stringify(Se.graph.serialize()),k=await(G==null?void 0:G.createFlow({json:I,lastSavedJson:I,name:l,parentFolderID:p==null?void 0:p.parentFolderID}));k&&await e(k.id,null,!0),x()},x=()=>{o("root")},E=P.useCallback(async()=>{const I=t?await(G==null?void 0:G.get(t)):null;if(!I){alert("Workspace does not exist");return}const k=new Blob([I.json],{type:"application/json"}),R=URL.createObjectURL(k),D=document.createElement("a");D.href=R,D.download=`${I.name}.json`,document.body.appendChild(D),D.click(),document.body.removeChild(D),URL.revokeObjectURL(R)},[t]);return O.jsxs(O.Fragment,{children:[O.jsx(Yh,{menuButton:O.jsx(Ts,{children:O.jsxs(qe,{px:1,height:"29px","aria-label":"menu",size:"sm",backgroundColor:"teal.600",children:["File",O.jsx(Ah,{size:20})]})}),menuContent:O.jsx(Na,{isOpen:!0,children:O.jsxs(Fa,{minWidth:150,zIndex:1e3,children:[O.jsx(xt,{onClick:r,icon:O.jsx(da,{size:20}),iconSpacing:1,command:v.save,children:"Save"}),O.jsx(Wt,{label:"Revert workflow to your last saved version. You will lose all changes made since your last save.",children:O.jsx(xt,{onClick:n,icon:O.jsx(Ph,{size:20}),iconSpacing:1,children:"Discard unsaved changes"})}),O.jsx(xt,{onClick:E,icon:O.jsx(Nh,{size:20}),iconSpacing:1,children:"Download"}),O.jsx(xt,{onClick:()=>o("saveAsModal"),icon:O.jsx(da,{size:20}),iconSpacing:1,command:v.saveAs,children:"Save As"}),O.jsx(xt,{onClick:()=>s(!0),icon:O.jsx($h,{size:20}),iconSpacing:1,children:"Create Version"}),O.jsx(xt,{onClick:()=>o("versionHistory"),icon:O.jsx(Bh,{size:20}),iconSpacing:1,children:"Versions History"}),O.jsx(xt,{onClick:()=>m(!0),icon:O.jsx(Uh,{size:20}),iconSpacing:1,alignItems:"center",children:O.jsxs(Tt,{children:[O.jsx("p",{children:"Share"})," ",O.jsx(Ra,{size:"sm",children:"πŸ§ͺπŸ§ͺbeta"})]})})]})})}),y&&O.jsx(tp,{onClose:()=>m(!1)}),a=="versionHistory"&&O.jsx(Zh,{onClose:()=>o("root")}),O.jsx(ep,{}),a==="saveAsModal"&&O.jsxs($r,{isOpen:!0,onClose:x,children:[O.jsx(ma,{}),O.jsxs(qr,{children:[O.jsx(ya,{children:"Save As"}),O.jsx(va,{}),O.jsx(ga,{children:O.jsxs(Vr,{isInvalid:!!u,children:[O.jsx(Gr,{children:"Workflow name"}),O.jsx(Kn,{value:l,onChange:w,autoFocus:!0,onKeyUp:I=>{I.code==="Enter"&&!u&&l&&_()}}),u&&O.jsx(Zr,{children:u})]})}),O.jsxs(wa,{children:[O.jsx(qe,{colorScheme:"teal",mr:3,onClick:_,isDisabled:!l||!!u,children:"Save"}),O.jsx(qe,{onClick:x,children:"Cancel"})]})]})]}),i&&O.jsx(Gh,{workflowId:t,onClose:()=>s(!1)})]})}function rp({displayName:t,updateFlowName:e,isDirty:n}){const{isOpen:r,onOpen:o,onClose:a}=Ac(),{curFlowID:i}=P.useContext(_t),[s,l]=P.useState(t),[c,u]=P.useState(""),d=()=>{l(t),o()},p=f=>{l(f.target.value),c&&u("")},h=async()=>{var f;if(i){const y=s.trim();if(l(y),t===y)return v();await(G==null?void 0:G.generateUniqueName(y,((f=G.curWorkflow)==null?void 0:f.parentFolderID)??""))!==y?u("The name is duplicated, please modify it and submit again."):(await(G==null?void 0:G.updateName(i,{name:y})),e(y),v())}},v=()=>{u(""),a()};return i==null?null:O.jsxs(Tt,{children:[O.jsx(Wt,{label:t,placement:"bottom",children:O.jsxs(zt,{as:"div",color:"white",onClick:d,maxW:200,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[O.jsx("div",{style:{width:8,display:"inline-block"},children:O.jsx(zt,{as:"span",children:n&&"* "})}),t]})}),O.jsxs($r,{isOpen:r,onClose:v,children:[O.jsx(ma,{}),O.jsxs(qr,{children:[O.jsx(ya,{children:"Edit workflow name"}),O.jsx(va,{}),O.jsx(ga,{children:O.jsxs(Vr,{isInvalid:!!c,children:[O.jsx(Gr,{children:"Workflow name"}),O.jsx(Kn,{value:s,onChange:p,autoFocus:!0,onKeyUp:f=>{f.code==="Enter"&&!c&&s&&h()}}),c&&O.jsx(Zr,{children:c})]})}),O.jsxs(wa,{children:[O.jsx(qe,{colorScheme:"teal",mr:3,onClick:h,isDisabled:!s||!!c,children:"Save"}),O.jsx(qe,{onClick:v,children:"Cancel"})]})]})]})]})}function Kp(t){const e=new Uint8Array(t);return window.crypto.getRandomValues(e),Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}const $p=[{label:"Private",value:"PRIVATE",icon:O.jsx(zh,{})},{label:"Unlisted, anyone with the link can view",value:"UNLISTED",icon:O.jsx(Mh,{})},{label:"Public",value:"PUBLIC",icon:O.jsx(qh,{})}],qp=()=>{const t=Se.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 a=r.input[o];for(let i in a){const s=a[i];Array.isArray(s[0])&&(s[0]=["value_1","value_2"])}}e[n.type]=r}return e};async function op(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 ap({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")),O.jsx("span",{children:n})}function sp({}){const[t,e]=P.useState(),[n,r]=P.useState(),{curFlowID:o}=P.useContext(_t);return P.useEffect(()=>{o&&(G==null||G.get(o).then(a=>{a!=null&&a.cloudID?(e(a.cloudOrigin+"/workflow/"+a.cloudID),op(a).then(i=>{r(i)})):e(void 0)}))},[o]),t?O.jsx("a",{href:t,style:{textDecoration:"none"},target:"_blank",children:O.jsx(Ts,{children:O.jsx(Ra,{children:n?O.jsx(ap,{privacy:n,showEmoji:!0}):"Shared"})})}):null}function ip({}){const{route:t,setRoute:e,curVersion:n}=P.useContext(_t);return n?O.jsx(kn,{alignItems:"center",children:O.jsx(Ks,{size:"sm",isAttached:!0,variant:"outline",children:O.jsx(qe,{rightIcon:O.jsx(gl,{size:10}),onClick:()=>e("versionHistory"),children:(n==null?void 0:n.name)??"latest*"})})}):null}function lp({curFlowName:t,setCurFlowName:e}){const{isDirty:n,loadNewWorkflow:r,saveCurWorkflow:o,setRoute:a,curFlowID:i}=P.useContext(_t),[s,l]=P.useState(),c=P.useCallback((u,d=!1)=>{const{top:p=0,left:h=0}=s||{};let{top:v=0,left:f=0}=u??{};v+=p,f+=h;const y=document.documentElement.clientWidth,m=document.documentElement.clientHeight,w=document.getElementById("workspaceManagerPanel"),_=(w==null?void 0:w.offsetWidth)||392;v+36>m&&(v=m-36),f+_>=y&&(f=y-_),l({top:Math.max(0,v),left:Math.max(0,f)}),d&&(X==null||X.upsert({topBarStyle:{top:v,left:f}}))},[s]);return P.useEffect(()=>{X==null||X.getSetting("topBarStyle").then(u=>{c(u,!1)})},[]),s?O.jsx(Eh,{onDragEnd:u=>{c({top:u.y,left:u.x},!0)},dragIconId:"dragPanelIcon",children:O.jsxs(Tt,{style:{padding:2,position:"fixed",...s},justifyContent:"space-between",alignItems:"center",gap:2,draggable:!1,id:"workspaceManagerPanel",className:"workspaceManagerPanel",children:[O.jsx(qe,{size:"sm","aria-label":"workspace folder",onClick:()=>a("recentFlows"),px:2,children:O.jsxs(Tt,{gap:1,children:[O.jsx(Rh,{size:21}),O.jsx(gl,{size:8})]})}),O.jsx(Wt,{label:"New workflow",children:O.jsx(qe,{size:"sm",variant:"outline",colorScheme:"teal","aria-label":"new workflow",onClick:()=>r(),px:2,py:2,children:O.jsx(Tt,{gap:0,children:O.jsx(Wh,{size:16,color:"white"})})})}),O.jsx(rp,{isDirty:n,displayName:t??"",updateFlowName:u=>{e(u),requestAnimationFrame(()=>{c()})}}),i&&O.jsxs(Tt,{gap:"4px",children:[O.jsx(Wt,{label:"Open gallery",children:O.jsx(Pn,{onClick:()=>a("gallery"),icon:O.jsx(Lh,{size:22,color:"white"}),size:"sm","aria-label":"open gallery",variant:"ghost"})}),O.jsx(np,{})]}),i&&n?O.jsx(Wt,{label:"Save workflow",children:O.jsx(Pn,{onClick:o,icon:O.jsx(da,{size:23,color:"white"}),size:"xs",paddingY:4,"aria-label":"save workspace",variant:"ghost"})}):O.jsx("div",{style:{width:1}}),O.jsx(sp,{}),O.jsx(ip,{}),O.jsx(Th,{id:"dragPanelIcon",className:"dragPanelIcon",cursor:"move",size:15,color:"#FFF"})]})}):null}function cp(){const{showDialog:t}=Bs(),{loadWorkflowID:e}=P.useContext(_t),n=async(o,a)=>{var c,u;const{workflow:i,version:s}=o.detail;if(!i.id||!s.id)return;const l=(c=await(G==null?void 0:G.listByIndex("cloudID",i.id)))==null?void 0:c.at(0);if(l){const d=(u=await(xe==null?void 0:xe.listByIndex("cloudID",s.id)))==null?void 0:u.at(0);if(d)await e(l.id,d.id);else{const p=await(xe==null?void 0:xe.add({id:s.id,cloudID:s.id,workflowID:l.id,cloudOrigin:a,name:s.name,authorID:s.authorID,json:s.json}));p&&e(l.id,p.id)}}else{const d=await(G==null?void 0:G.createFlow({cloudID:i.id,cloudOrigin:a,name:i.name,json:s.json,updateTime:Date.now()}));if(!d){alert("Failed to add workflow to local db");return}const p=await(xe==null?void 0:xe.put({id:s.id,cloudID:s.id,workflowID:d.id,cloudOrigin:a,name:s.name,json:s.json,authorID:s.authorID,createTime:Date.now()}));await e(d.id,p==null?void 0:p.id)}},r=async o=>{const a=o.data;if(up(a)){const i=o.origin;t(`Open workflow "${a.detail.workflow.name}", version "${a.detail.version.name}" from ${i}`,[{label:"Open",colorScheme:"teal",onClick:()=>{n(a,i)}}])}};return P.useEffect(()=>{window.opener&&window.opener.postMessage("comfyui_workspace_manager_connected","*"),window.addEventListener("message",r)},[]),null}function up(t){return t.type==="workspace_open_workflow"}const dp=t=>typeof t=="function",fp=t=>{const[e,n]=P.useState(t),r=P.useRef(e),o=P.useCallback(a=>{r.current=dp(a)?a(r.current):a,n(r.current)},[]);return[e,o,r]};function cr(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 bl={exports:{}};/*! +/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(y))))," */")),p.styleTagTransform(v,d,p.options)})(c,l,u)},remove:function(){(function(u){if(u.parentNode===null)return!1;u.parentNode.removeChild(u)})(c)}}}},589:s=>{s.exports=function(l,c){if(c.styleSheet)c.styleSheet.cssText=l;else{for(;c.firstChild;)c.removeChild(c.firstChild);c.appendChild(document.createTextNode(l))}}},250:s=>{s.exports=n}},o={};function a(s){var l=o[s];if(l!==void 0)return l.exports;var c=o[s]={id:s,exports:{}};return r[s](c,c.exports,a),c.exports}a.n=s=>{var l=s&&s.__esModule?()=>s.default:()=>s;return a.d(l,{a:l}),l},a.d=(s,l)=>{for(var c in l)a.o(l,c)&&!a.o(s,c)&&Object.defineProperty(s,c,{enumerable:!0,get:l[c]})},a.o=(s,l)=>Object.prototype.hasOwnProperty.call(s,l),a.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var i=a(579);return i.default})()})})(wl);var Xh=wl.exports;const Qh=fa(Xh);function ep(){const{jsonDiff:t,compareJson:e}=P.useContext(_t);return t==null?null:O.jsx($r,{isOpen:!0,onClose:()=>{e(null)},children:O.jsx(qr,{children:O.jsx(yt,{height:"80vh",width:"90%",overflow:"scroll",children:O.jsx(Qh,{oldData:t==null?void 0:t.old,newData:t==null?void 0:t.new})})})})}const tp=P.lazy(()=>Hr(()=>import("./ShareDialog-Q3AC6yal.js"),__vite__mapDeps([0,1,2,3])));function np(){const{curFlowID:t,loadWorkflowID:e,discardUnsavedChanges:n,saveCurWorkflow:r,setRoute:o,route:a}=P.useContext(_t),[i,s]=P.useState(!1),[l,c]=P.useState(""),[u,d]=P.useState(""),[p,h]=P.useState(),[v,f]=P.useState({save:"",saveAs:""}),[y,m]=P.useState(!1);P.useEffect(()=>{t&&(G==null||G.get(t).then(I=>{c((I==null?void 0:I.name)??""),h(I)})),X==null||X.getSetting("shortcuts").then(I=>{f(I)})},[t]);const w=I=>{c(I.target.value),u&&d("")},_=async()=>{if(!t){alert("Flow ID is required");return}const I=JSON.stringify(Se.graph.serialize()),k=await(G==null?void 0:G.createFlow({json:I,lastSavedJson:I,name:l,parentFolderID:p==null?void 0:p.parentFolderID}));k&&await e(k.id,null,!0),x()},x=()=>{o("root")},E=P.useCallback(async()=>{const I=t?await(G==null?void 0:G.get(t)):null;if(!I){alert("Workspace does not exist");return}const k=new Blob([I.json],{type:"application/json"}),R=URL.createObjectURL(k),D=document.createElement("a");D.href=R,D.download=`${I.name}.json`,document.body.appendChild(D),D.click(),document.body.removeChild(D),URL.revokeObjectURL(R)},[t]);return O.jsxs(O.Fragment,{children:[O.jsx(Yh,{menuButton:O.jsx(Ts,{children:O.jsxs(qe,{px:1,height:"29px","aria-label":"menu",size:"sm",backgroundColor:"teal.600",children:["File",O.jsx(Ah,{size:20})]})}),menuContent:O.jsx(Na,{isOpen:!0,children:O.jsxs(Fa,{minWidth:150,zIndex:1e3,children:[O.jsx(xt,{onClick:r,icon:O.jsx(da,{size:20}),iconSpacing:1,command:v.save,children:"Save"}),O.jsx(Wt,{label:"Revert workflow to your last saved version. You will lose all changes made since your last save.",children:O.jsx(xt,{onClick:n,icon:O.jsx(Ph,{size:20}),iconSpacing:1,children:"Discard unsaved changes"})}),O.jsx(xt,{onClick:E,icon:O.jsx(Nh,{size:20}),iconSpacing:1,children:"Download"}),O.jsx(xt,{onClick:()=>o("saveAsModal"),icon:O.jsx(da,{size:20}),iconSpacing:1,command:v.saveAs,children:"Save As"}),O.jsx(xt,{onClick:()=>s(!0),icon:O.jsx($h,{size:20}),iconSpacing:1,children:"Create Version"}),O.jsx(xt,{onClick:()=>o("versionHistory"),icon:O.jsx(Bh,{size:20}),iconSpacing:1,children:"Versions History"}),O.jsx(xt,{onClick:()=>m(!0),icon:O.jsx(Uh,{size:20}),iconSpacing:1,alignItems:"center",children:O.jsxs(Tt,{children:[O.jsx("p",{children:"Share"})," ",O.jsx(Ra,{size:"sm",children:"πŸ§ͺπŸ§ͺbeta"})]})})]})})}),y&&O.jsx(tp,{onClose:()=>m(!1)}),a=="versionHistory"&&O.jsx(Zh,{onClose:()=>o("root")}),O.jsx(ep,{}),a==="saveAsModal"&&O.jsxs($r,{isOpen:!0,onClose:x,children:[O.jsx(ma,{}),O.jsxs(qr,{children:[O.jsx(ya,{children:"Save As"}),O.jsx(va,{}),O.jsx(ga,{children:O.jsxs(Vr,{isInvalid:!!u,children:[O.jsx(Gr,{children:"Workflow name"}),O.jsx(Kn,{value:l,onChange:w,autoFocus:!0,onKeyUp:I=>{I.code==="Enter"&&!u&&l&&_()}}),u&&O.jsx(Zr,{children:u})]})}),O.jsxs(wa,{children:[O.jsx(qe,{colorScheme:"teal",mr:3,onClick:_,isDisabled:!l||!!u,children:"Save"}),O.jsx(qe,{onClick:x,children:"Cancel"})]})]})]}),i&&O.jsx(Gh,{workflowId:t,onClose:()=>s(!1)})]})}function rp({displayName:t,updateFlowName:e,isDirty:n}){const{isOpen:r,onOpen:o,onClose:a}=Ac(),{curFlowID:i}=P.useContext(_t),[s,l]=P.useState(t),[c,u]=P.useState(""),d=()=>{l(t),o()},p=f=>{l(f.target.value),c&&u("")},h=async()=>{var f;if(i){const y=s.trim();if(l(y),t===y)return v();await(G==null?void 0:G.generateUniqueName(y,((f=G.curWorkflow)==null?void 0:f.parentFolderID)??""))!==y?u("The name is duplicated, please modify it and submit again."):(await(G==null?void 0:G.updateName(i,{name:y})),e(y),v())}},v=()=>{u(""),a()};return i==null?null:O.jsxs(Tt,{children:[O.jsx(Wt,{label:t,placement:"bottom",children:O.jsxs(zt,{as:"div",color:"white",onClick:d,maxW:200,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[O.jsx("div",{style:{width:8,display:"inline-block"},children:O.jsx(zt,{as:"span",children:n&&"* "})}),t]})}),O.jsxs($r,{isOpen:r,onClose:v,children:[O.jsx(ma,{}),O.jsxs(qr,{children:[O.jsx(ya,{children:"Edit workflow name"}),O.jsx(va,{}),O.jsx(ga,{children:O.jsxs(Vr,{isInvalid:!!c,children:[O.jsx(Gr,{children:"Workflow name"}),O.jsx(Kn,{value:s,onChange:p,autoFocus:!0,onKeyUp:f=>{f.code==="Enter"&&!c&&s&&h()}}),c&&O.jsx(Zr,{children:c})]})}),O.jsxs(wa,{children:[O.jsx(qe,{colorScheme:"teal",mr:3,onClick:h,isDisabled:!s||!!c,children:"Save"}),O.jsx(qe,{onClick:v,children:"Cancel"})]})]})]})]})}function Kp(t){const e=new Uint8Array(t);return window.crypto.getRandomValues(e),Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}const $p=[{label:"Private",value:"PRIVATE",icon:O.jsx(zh,{})},{label:"Unlisted, anyone with the link can view",value:"UNLISTED",icon:O.jsx(Mh,{})},{label:"Public",value:"PUBLIC",icon:O.jsx(qh,{})}],qp=()=>{const t=Se.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 a=r.input[o];for(let i in a){const s=a[i];Array.isArray(s[0])&&(s[0]=["value_1","value_2"])}}e[n.type]=r}return e};async function op(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 ap({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")),O.jsx("span",{children:n})}function sp({}){const[t,e]=P.useState(),[n,r]=P.useState(),{curFlowID:o}=P.useContext(_t);return P.useEffect(()=>{o&&(G==null||G.get(o).then(a=>{a!=null&&a.cloudID?(e(a.cloudOrigin+"/workflow/"+a.cloudID),op(a).then(i=>{r(i)})):e(void 0)}))},[o]),t?O.jsx("a",{href:t,style:{textDecoration:"none"},target:"_blank",children:O.jsx(Ts,{children:O.jsx(Ra,{children:n?O.jsx(ap,{privacy:n,showEmoji:!0}):"Shared"})})}):null}function ip({}){const{route:t,setRoute:e,curVersion:n}=P.useContext(_t);return n?O.jsx(kn,{alignItems:"center",children:O.jsx(Ks,{size:"sm",isAttached:!0,variant:"outline",children:O.jsx(qe,{rightIcon:O.jsx(gl,{size:10}),onClick:()=>e("versionHistory"),children:(n==null?void 0:n.name)??"latest*"})})}):null}function lp({curFlowName:t,setCurFlowName:e}){const{isDirty:n,loadNewWorkflow:r,saveCurWorkflow:o,setRoute:a,curFlowID:i}=P.useContext(_t),[s,l]=P.useState(),c=P.useCallback((u,d=!1)=>{const{top:p=0,left:h=0}=s||{};let{top:v=0,left:f=0}=u??{};v+=p,f+=h;const y=document.documentElement.clientWidth,m=document.documentElement.clientHeight,w=document.getElementById("workspaceManagerPanel"),_=(w==null?void 0:w.offsetWidth)||392;v+36>m&&(v=m-36),f+_>=y&&(f=y-_),l({top:Math.max(0,v),left:Math.max(0,f)}),d&&(X==null||X.upsert({topBarStyle:{top:v,left:f}}))},[s]);return P.useEffect(()=>{X==null||X.getSetting("topBarStyle").then(u=>{c(u,!1)})},[]),s?O.jsx(Eh,{onDragEnd:u=>{c({top:u.y,left:u.x},!0)},dragIconId:"dragPanelIcon",children:O.jsxs(Tt,{style:{padding:2,position:"fixed",...s},justifyContent:"space-between",alignItems:"center",gap:2,draggable:!1,id:"workspaceManagerPanel",className:"workspaceManagerPanel",children:[O.jsx(qe,{size:"sm","aria-label":"workspace folder",onClick:()=>a("recentFlows"),px:2,children:O.jsxs(Tt,{gap:1,children:[O.jsx(Rh,{size:21}),O.jsx(gl,{size:8})]})}),O.jsx(Wt,{label:"New workflow",children:O.jsx(qe,{size:"sm",variant:"outline",colorScheme:"teal","aria-label":"new workflow",onClick:()=>r(),px:2,py:2,children:O.jsx(Tt,{gap:0,children:O.jsx(Wh,{size:16,color:"white"})})})}),O.jsx(rp,{isDirty:n,displayName:t??"",updateFlowName:u=>{e(u),requestAnimationFrame(()=>{c()})}}),i&&O.jsxs(Tt,{gap:"4px",children:[O.jsx(Wt,{label:"Open gallery",children:O.jsx(Pn,{onClick:()=>a("gallery"),icon:O.jsx(Lh,{size:22,color:"white"}),size:"sm","aria-label":"open gallery",variant:"ghost"})}),O.jsx(np,{})]}),i&&n?O.jsx(Wt,{label:"Save workflow",children:O.jsx(Pn,{onClick:o,icon:O.jsx(da,{size:23,color:"white"}),size:"xs",paddingY:4,"aria-label":"save workspace",variant:"ghost"})}):O.jsx("div",{style:{width:1}}),O.jsx(sp,{}),O.jsx(ip,{}),O.jsx(Th,{id:"dragPanelIcon",className:"dragPanelIcon",cursor:"move",size:15,color:"#FFF"})]})}):null}function cp(){const{showDialog:t}=Bs(),{loadWorkflowID:e}=P.useContext(_t),n=async(o,a)=>{var c,u;const{workflow:i,version:s}=o.detail;if(!i.id||!s.id)return;const l=(c=await(G==null?void 0:G.listByIndex("cloudID",i.id)))==null?void 0:c.at(0);if(l){const d=(u=await(xe==null?void 0:xe.listByIndex("cloudID",s.id)))==null?void 0:u.at(0);if(d)await e(l.id,d.id);else{const p=await(xe==null?void 0:xe.add({id:s.id,cloudID:s.id,workflowID:l.id,cloudOrigin:a,name:s.name,authorID:s.authorID,json:s.json}));p&&e(l.id,p.id)}}else{const d=await(G==null?void 0:G.createFlow({cloudID:i.id,cloudOrigin:a,name:i.name,json:s.json,updateTime:Date.now()}));if(!d){alert("Failed to add workflow to local db");return}const p=await(xe==null?void 0:xe.put({id:s.id,cloudID:s.id,workflowID:d.id,cloudOrigin:a,name:s.name,json:s.json,authorID:s.authorID,createTime:Date.now()}));await e(d.id,p==null?void 0:p.id)}},r=async o=>{const a=o.data;if(up(a)){const i=o.origin;t(`Open workflow "${a.detail.workflow.name}", version "${a.detail.version.name}" from ${i}`,[{label:"Open",colorScheme:"teal",onClick:()=>{n(a,i)}}])}};return P.useEffect(()=>{window.opener&&window.opener.postMessage("comfyui_workspace_manager_connected","*"),window.addEventListener("message",r)},[]),null}function up(t){return t.type==="workspace_open_workflow"}const dp=t=>typeof t=="function",fp=t=>{const[e,n]=P.useState(t),r=P.useRef(e),o=P.useCallback(a=>{r.current=dp(a)?a(r.current):a,n(r.current)},[]);return[e,o,r]};function cr(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 bl={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -182,12 +182,12 @@ 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,a){function i(c,u){if(!o[c]){if(!r[c]){var d=typeof cr=="function"&&cr;if(!u&&d)return d(c,!0);if(s)return s(c,!0);var p=new Error("Cannot find module '"+c+"'");throw p.code="MODULE_NOT_FOUND",p}var h=o[c]={exports:{}};r[c][0].call(h.exports,function(v){var f=r[c][1][v];return i(f||v)},h,h.exports,n,r,o,a)}return o[c].exports}for(var s=typeof cr=="function"&&cr,l=0;l>2,h=(3&c)<<4|u>>4,v=1<_?(15&u)<<2|d>>6:64,f=2<_?63&d:64,y.push(s.charAt(p)+s.charAt(h)+s.charAt(v)+s.charAt(f));return y.join("")},o.decode=function(l){var c,u,d,p,h,v,f=0,y=0,m="data:";if(l.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");var w,_=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===s.charAt(64)&&_--,l.charAt(l.length-2)===s.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(w=i.uint8array?new Uint8Array(0|_):new Array(0|_);f>4,u=(15&p)<<4|(h=s.indexOf(l.charAt(f++)))>>2,d=(3&h)<<6|(v=s.indexOf(l.charAt(f++))),w[y++]=c,h!==64&&(w[y++]=u),v!==64&&(w[y++]=d);return w}},{"./support":30,"./utils":32}],2:[function(n,r,o){var a=n("./external"),i=n("./stream/DataWorker"),s=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function c(u,d,p,h,v){this.compressedSize=u,this.uncompressedSize=d,this.crc32=p,this.compression=h,this.compressedContent=v}c.prototype={getContentWorker:function(){var u=new i(a.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return u.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new i(a.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(u,d,p){return u.pipe(new s).pipe(new l("uncompressedSize")).pipe(d.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},r.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var a=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new a("STORE compression")},uncompressWorker:function(){return new a("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var a=n("./utils"),i=function(){for(var s,l=[],c=0;c<256;c++){s=c;for(var u=0;u<8;u++)s=1&s?3988292384^s>>>1:s>>>1;l[c]=s}return l}();r.exports=function(s,l){return s!==void 0&&s.length?a.getTypeOf(s)!=="string"?function(c,u,d,p){var h=i,v=p+d;c^=-1;for(var f=p;f>>8^h[255&(c^u[f])];return-1^c}(0|l,s,s.length,0):function(c,u,d,p){var h=i,v=p+d;c^=-1;for(var f=p;f>>8^h[255&(c^u.charCodeAt(f))];return-1^c}(0|l,s,s.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 a=null;a=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:a}},{lie:37}],7:[function(n,r,o){var a=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=n("pako"),s=n("./utils"),l=n("./stream/GenericWorker"),c=a?"uint8array":"array";function u(d,p){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=p,this.meta={}}o.magic="\b\0",s.inherits(u,l),u.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(s.transformTo(c,d.data),!1)},u.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},u.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 u("Deflate",d)},o.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function a(h,v){var f,y="";for(f=0;f>>=8;return y}function i(h,v,f,y,m,w){var _,x,E=h.file,I=h.compression,k=w!==c.utf8encode,R=s.transformTo("string",w(E.name)),D=s.transformTo("string",c.utf8encode(E.name)),T=E.comment,H=s.transformTo("string",w(T)),j=s.transformTo("string",c.utf8encode(T)),L=D.length!==E.name.length,b=j.length!==T.length,q="",te="",N="",ae=E.dir,Z=E.date,le={crc32:0,compressedSize:0,uncompressedSize:0};v&&!f||(le.crc32=h.crc32,le.compressedSize=h.compressedSize,le.uncompressedSize=h.uncompressedSize);var K=0;v&&(K|=8),k||!L&&!b||(K|=2048);var U=0,re=0;ae&&(U|=16),m==="UNIX"?(re=798,U|=function(A,J){var oe=A;return A||(oe=J?16893:33204),(65535&oe)<<16}(E.unixPermissions,ae)):(re=20,U|=function(A){return 63&(A||0)}(E.dosPermissions)),_=Z.getUTCHours(),_<<=6,_|=Z.getUTCMinutes(),_<<=5,_|=Z.getUTCSeconds()/2,x=Z.getUTCFullYear()-1980,x<<=4,x|=Z.getUTCMonth()+1,x<<=5,x|=Z.getUTCDate(),L&&(te=a(1,1)+a(u(R),4)+D,q+="up"+a(te.length,2)+te),b&&(N=a(1,1)+a(u(H),4)+j,q+="uc"+a(N.length,2)+N);var M="";return M+=` -\0`,M+=a(K,2),M+=I.magic,M+=a(_,2),M+=a(x,2),M+=a(le.crc32,4),M+=a(le.compressedSize,4),M+=a(le.uncompressedSize,4),M+=a(R.length,2),M+=a(q.length,2),{fileRecord:d.LOCAL_FILE_HEADER+M+R+q,dirRecord:d.CENTRAL_FILE_HEADER+a(re,2)+M+a(H.length,2)+"\0\0\0\0"+a(U,4)+a(y,4)+R+q+H}}var s=n("../utils"),l=n("../stream/GenericWorker"),c=n("../utf8"),u=n("../crc32"),d=n("../signature");function p(h,v,f,y){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=v,this.zipPlatform=f,this.encodeFileName=y,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(p,l),p.prototype.push=function(h){var v=h.meta.percent||0,f=this.entriesCount,y=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-y-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(y){return d.DATA_DESCRIPTOR+a(y.crc32,4)+a(y.compressedSize,4)+a(y.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--)c=(c<<8)+this.byteAt(l);return this.index+=s,c},readString:function(s){return a.transformTo("string",this.readData(s))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var s=this.readInt(4);return new Date(Date.UTC(1980+(s>>25&127),(s>>21&15)-1,s>>16&31,s>>11&31,s>>5&63,(31&s)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var a=n("./Uint8ArrayReader");function i(s){a.call(this,s)}n("../utils").inherits(i,a),i.prototype.readData=function(s){this.checkOffset(s);var l=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var a=n("./DataReader");function i(s){a.call(this,s)}n("../utils").inherits(i,a),i.prototype.byteAt=function(s){return this.data.charCodeAt(this.zero+s)},i.prototype.lastIndexOfSignature=function(s){return this.data.lastIndexOf(s)-this.zero},i.prototype.readAndCheckSignature=function(s){return s===this.readData(4)},i.prototype.readData=function(s){this.checkOffset(s);var l=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var a=n("./ArrayReader");function i(s){a.call(this,s)}n("../utils").inherits(i,a),i.prototype.readData=function(s){if(this.checkOffset(s),s===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var a=n("../utils"),i=n("../support"),s=n("./ArrayReader"),l=n("./StringReader"),c=n("./NodeBufferReader"),u=n("./Uint8ArrayReader");r.exports=function(d){var p=a.getTypeOf(d);return a.checkSupport(p),p!=="string"||i.uint8array?p==="nodebuffer"?new c(d):i.uint8array?new u(a.transformTo("uint8array",d)):new s(a.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 a=n("./GenericWorker"),i=n("../utils");function s(l){a.call(this,"ConvertWorker to "+l),this.destType=l}i.inherits(s,a),s.prototype.processChunk=function(l){this.push({data:i.transformTo(this.destType,l.data),meta:l.meta})},r.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var a=n("./GenericWorker"),i=n("../crc32");function s(){a.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(s,a),s.prototype.processChunk=function(l){this.streamInfo.crc32=i(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var a=n("../utils"),i=n("./GenericWorker");function s(l){i.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}a.inherits(s,i),s.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}i.prototype.processChunk.call(this,l)},r.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var a=n("../utils"),i=n("./GenericWorker");function s(l){i.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(u){c.dataIsReady=!0,c.data=u,c.max=u&&u.length||0,c.type=a.getTypeOf(u),c.isPaused||c._tickAndRepeat()},function(u){c.error(u)})}a.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,a.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(a.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=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,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function a(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}a.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,s){return this._listeners[i].push(s),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,s){if(this._listeners[i])for(var l=0;l "+i:i}},r.exports=a},{}],29:[function(n,r,o){var a=n("../utils"),i=n("./ConvertWorker"),s=n("./GenericWorker"),l=n("../base64"),c=n("../support"),u=n("../external"),d=null;if(c.nodestream)try{d=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(v,f){return new u.Promise(function(y,m){var w=[],_=v._internalType,x=v._outputType,E=v._mimeType;v.on("data",function(I,k){w.push(I),f&&f(k)}).on("error",function(I){w=[],m(I)}).on("end",function(){try{var I=function(k,R,D){switch(k){case"blob":return a.newBlob(a.transformTo("arraybuffer",R),D);case"base64":return l.encode(R);default:return a.transformTo(k,R)}}(x,function(k,R){var D,T=0,H=null,j=0;for(D=0;D"u")o.blob=!1;else{var a=new ArrayBuffer(0);try{o.blob=new Blob([a],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(a),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 a=n("./utils"),i=n("./support"),s=n("./nodejsUtils"),l=n("./stream/GenericWorker"),c=new Array(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;c[254]=c[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?s.newBufferFrom(h,"utf-8"):function(v){var f,y,m,w,_,x=v.length,E=0;for(w=0;w>>6:(y<65536?f[_++]=224|y>>>12:(f[_++]=240|y>>>18,f[_++]=128|y>>>12&63),f[_++]=128|y>>>6&63),f[_++]=128|63&y);return f}(h)},o.utf8decode=function(h){return i.nodebuffer?a.transformTo("nodebuffer",h).toString("utf-8"):function(v){var f,y,m,w,_=v.length,x=new Array(2*_);for(f=y=0;f<_;)if((m=v[f++])<128)x[y++]=m;else if(4<(w=c[m]))x[y++]=65533,f+=w-1;else{for(m&=w===2?31:w===3?15:7;1>10&1023,x[y++]=56320|1023&m)}return x.length!==y&&(x.subarray?x=x.subarray(0,y):x.length=y),a.applyFromCharCode(x)}(h=a.transformTo(i.uint8array?"uint8array":"array",h))},a.inherits(d,l),d.prototype.processChunk=function(h){var v=a.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 y=function(w,_){var x;for((_=_||w.length)>w.length&&(_=w.length),x=_-1;0<=x&&(192&w[x])==128;)x--;return x<0||x===0?_:x+c[w[x]]>_?x:_}(v),m=v;y!==v.length&&(i.uint8array?(m=v.subarray(0,y),this.leftOver=v.subarray(y,v.length)):(m=v.slice(0,y),this.leftOver=v.slice(y,v.length))),this.push({data:o.utf8decode(m),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,a.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 a=n("./support"),i=n("./base64"),s=n("./nodejsUtils"),l=n("./external");function c(f){return f}function u(f,y){for(var m=0;m>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=a(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,y,m=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?p[y++]=224|h>>>12:(p[y++]=240|h>>>18,p[y++]=128|h>>>12&63),p[y++]=128|h>>>6&63),p[y++]=128|63&h);return p},o.buf2binstring=function(d){return u(d,d.length)},o.binstring2buf=function(d){for(var p=new a.Buf8(d.length),h=0,v=p.length;h>10&1023,w[v++]=56320|1023&f)}return u(w,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(a,i,s,l){for(var c=65535&a|0,u=a>>>16&65535|0,d=0;s!==0;){for(s-=d=2e3>>1:i>>>1;s[l]=i}return s}();r.exports=function(i,s,l,c){var u=a,d=c+l;i^=-1;for(var p=c;p>>8^u[255&(i^s[p])];return-1^i}},{}],46:[function(n,r,o){var a,i=n("../utils/common"),s=n("./trees"),l=n("./adler32"),c=n("./crc32"),u=n("./messages"),d=0,p=4,h=0,v=-2,f=-1,y=4,m=2,w=8,_=9,x=286,E=30,I=19,k=2*x+1,R=15,D=3,T=258,H=T+D+1,j=42,L=113,b=1,q=2,te=3,N=4;function ae(g,B){return g.msg=u[B],B}function Z(g){return(g<<1)-(4g.avail_out&&(W=g.avail_out),W!==0&&(i.arraySet(g.output,B.pending_buf,B.pending_out,W,g.next_out),g.next_out+=W,B.pending_out+=W,g.total_out+=W,g.avail_out-=W,B.pending-=W,B.pending===0&&(B.pending_out=0))}function U(g,B){s._tr_flush_block(g,0<=g.block_start?g.block_start:-1,g.strstart-g.block_start,B),g.block_start=g.strstart,K(g.strm)}function re(g,B){g.pending_buf[g.pending++]=B}function M(g,B){g.pending_buf[g.pending++]=B>>>8&255,g.pending_buf[g.pending++]=255&B}function A(g,B){var W,C,S=g.max_chain_length,F=g.strstart,$=g.prev_length,V=g.nice_match,z=g.strstart>g.w_size-H?g.strstart-(g.w_size-H):0,Q=g.window,ee=g.w_mask,Y=g.prev,se=g.strstart+T,be=Q[F+$-1],ye=Q[F+$];g.prev_length>=g.good_match&&(S>>=2),V>g.lookahead&&(V=g.lookahead);do if(Q[(W=B)+$]===ye&&Q[W+$-1]===be&&Q[W]===Q[F]&&Q[++W]===Q[F+1]){F+=2,W++;do;while(Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Fz&&--S!=0);return $<=g.lookahead?$:g.lookahead}function J(g){var B,W,C,S,F,$,V,z,Q,ee,Y=g.w_size;do{if(S=g.window_size-g.lookahead-g.strstart,g.strstart>=Y+(Y-H)){for(i.arraySet(g.window,g.window,Y,Y,0),g.match_start-=Y,g.strstart-=Y,g.block_start-=Y,B=W=g.hash_size;C=g.head[--B],g.head[B]=Y<=C?C-Y:0,--W;);for(B=W=Y;C=g.prev[--B],g.prev[B]=Y<=C?C-Y:0,--W;);S+=Y}if(g.strm.avail_in===0)break;if($=g.strm,V=g.window,z=g.strstart+g.lookahead,Q=S,ee=void 0,ee=$.avail_in,Q=D)for(F=g.strstart-g.insert,g.ins_h=g.window[F],g.ins_h=(g.ins_h<=D&&(g.ins_h=(g.ins_h<=D)if(C=s._tr_tally(g,g.strstart-g.match_start,g.match_length-D),g.lookahead-=g.match_length,g.match_length<=g.max_lazy_match&&g.lookahead>=D){for(g.match_length--;g.strstart++,g.ins_h=(g.ins_h<=D&&(g.ins_h=(g.ins_h<=D&&g.match_length<=g.prev_length){for(S=g.strstart+g.lookahead-D,C=s._tr_tally(g,g.strstart-1-g.prev_match,g.prev_length-D),g.lookahead-=g.prev_length-1,g.prev_length-=2;++g.strstart<=S&&(g.ins_h=(g.ins_h<g.pending_buf_size-5&&(W=g.pending_buf_size-5);;){if(g.lookahead<=1){if(J(g),g.lookahead===0&&B===d)return b;if(g.lookahead===0)break}g.strstart+=g.lookahead,g.lookahead=0;var C=g.block_start+W;if((g.strstart===0||g.strstart>=C)&&(g.lookahead=g.strstart-C,g.strstart=C,U(g,!1),g.strm.avail_out===0)||g.strstart-g.block_start>=g.w_size-H&&(U(g,!1),g.strm.avail_out===0))return b}return g.insert=0,B===p?(U(g,!0),g.strm.avail_out===0?te:N):(g.strstart>g.block_start&&(U(g,!1),g.strm.avail_out),b)}),new ie(4,4,8,4,oe),new ie(4,5,16,8,oe),new ie(4,6,32,32,oe),new ie(4,4,16,16,ne),new ie(8,16,32,32,ne),new ie(8,16,128,128,ne),new ie(8,32,128,256,ne),new ie(32,128,258,1024,ne),new ie(32,258,258,4096,ne)],o.deflateInit=function(g,B){return ue(g,B,w,15,8,0)},o.deflateInit2=ue,o.deflateReset=he,o.deflateResetKeep=fe,o.deflateSetHeader=function(g,B){return g&&g.state?g.state.wrap!==2?v:(g.state.gzhead=B,h):v},o.deflate=function(g,B){var W,C,S,F;if(!g||!g.state||5>8&255),re(C,C.gzhead.time>>16&255),re(C,C.gzhead.time>>24&255),re(C,C.level===9?2:2<=C.strategy||C.level<2?4:0),re(C,255&C.gzhead.os),C.gzhead.extra&&C.gzhead.extra.length&&(re(C,255&C.gzhead.extra.length),re(C,C.gzhead.extra.length>>8&255)),C.gzhead.hcrc&&(g.adler=c(g.adler,C.pending_buf,C.pending,0)),C.gzindex=0,C.status=69):(re(C,0),re(C,0),re(C,0),re(C,0),re(C,0),re(C,C.level===9?2:2<=C.strategy||C.level<2?4:0),re(C,3),C.status=L);else{var $=w+(C.w_bits-8<<4)<<8;$|=(2<=C.strategy||C.level<2?0:C.level<6?1:C.level===6?2:3)<<6,C.strstart!==0&&($|=32),$+=31-$%31,C.status=L,M(C,$),C.strstart!==0&&(M(C,g.adler>>>16),M(C,65535&g.adler)),g.adler=1}if(C.status===69)if(C.gzhead.extra){for(S=C.pending;C.gzindex<(65535&C.gzhead.extra.length)&&(C.pending!==C.pending_buf_size||(C.gzhead.hcrc&&C.pending>S&&(g.adler=c(g.adler,C.pending_buf,C.pending-S,S)),K(g),S=C.pending,C.pending!==C.pending_buf_size));)re(C,255&C.gzhead.extra[C.gzindex]),C.gzindex++;C.gzhead.hcrc&&C.pending>S&&(g.adler=c(g.adler,C.pending_buf,C.pending-S,S)),C.gzindex===C.gzhead.extra.length&&(C.gzindex=0,C.status=73)}else C.status=73;if(C.status===73)if(C.gzhead.name){S=C.pending;do{if(C.pending===C.pending_buf_size&&(C.gzhead.hcrc&&C.pending>S&&(g.adler=c(g.adler,C.pending_buf,C.pending-S,S)),K(g),S=C.pending,C.pending===C.pending_buf_size)){F=1;break}F=C.gzindexS&&(g.adler=c(g.adler,C.pending_buf,C.pending-S,S)),F===0&&(C.gzindex=0,C.status=91)}else C.status=91;if(C.status===91)if(C.gzhead.comment){S=C.pending;do{if(C.pending===C.pending_buf_size&&(C.gzhead.hcrc&&C.pending>S&&(g.adler=c(g.adler,C.pending_buf,C.pending-S,S)),K(g),S=C.pending,C.pending===C.pending_buf_size)){F=1;break}F=C.gzindexS&&(g.adler=c(g.adler,C.pending_buf,C.pending-S,S)),F===0&&(C.status=103)}else C.status=103;if(C.status===103&&(C.gzhead.hcrc?(C.pending+2>C.pending_buf_size&&K(g),C.pending+2<=C.pending_buf_size&&(re(C,255&g.adler),re(C,g.adler>>8&255),g.adler=0,C.status=L)):C.status=L),C.pending!==0){if(K(g),g.avail_out===0)return C.last_flush=-1,h}else if(g.avail_in===0&&Z(B)<=Z(W)&&B!==p)return ae(g,-5);if(C.status===666&&g.avail_in!==0)return ae(g,-5);if(g.avail_in!==0||C.lookahead!==0||B!==d&&C.status!==666){var V=C.strategy===2?function(z,Q){for(var ee;;){if(z.lookahead===0&&(J(z),z.lookahead===0)){if(Q===d)return b;break}if(z.match_length=0,ee=s._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++,ee&&(U(z,!1),z.strm.avail_out===0))return b}return z.insert=0,Q===p?(U(z,!0),z.strm.avail_out===0?te:N):z.last_lit&&(U(z,!1),z.strm.avail_out===0)?b:q}(C,B):C.strategy===3?function(z,Q){for(var ee,Y,se,be,ye=z.window;;){if(z.lookahead<=T){if(J(z),z.lookahead<=T&&Q===d)return b;if(z.lookahead===0)break}if(z.match_length=0,z.lookahead>=D&&0z.lookahead&&(z.match_length=z.lookahead)}if(z.match_length>=D?(ee=s._tr_tally(z,1,z.match_length-D),z.lookahead-=z.match_length,z.strstart+=z.match_length,z.match_length=0):(ee=s._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++),ee&&(U(z,!1),z.strm.avail_out===0))return b}return z.insert=0,Q===p?(U(z,!0),z.strm.avail_out===0?te:N):z.last_lit&&(U(z,!1),z.strm.avail_out===0)?b:q}(C,B):a[C.level].func(C,B);if(V!==te&&V!==N||(C.status=666),V===b||V===te)return g.avail_out===0&&(C.last_flush=-1),h;if(V===q&&(B===1?s._tr_align(C):B!==5&&(s._tr_stored_block(C,0,0,!1),B===3&&(le(C.head),C.lookahead===0&&(C.strstart=0,C.block_start=0,C.insert=0))),K(g),g.avail_out===0))return C.last_flush=-1,h}return B!==p?h:C.wrap<=0?1:(C.wrap===2?(re(C,255&g.adler),re(C,g.adler>>8&255),re(C,g.adler>>16&255),re(C,g.adler>>24&255),re(C,255&g.total_in),re(C,g.total_in>>8&255),re(C,g.total_in>>16&255),re(C,g.total_in>>24&255)):(M(C,g.adler>>>16),M(C,65535&g.adler)),K(g),0=W.w_size&&(F===0&&(le(W.head),W.strstart=0,W.block_start=0,W.insert=0),Q=new i.Buf8(W.w_size),i.arraySet(Q,B,ee-W.w_size,W.w_size,0),B=Q,ee=W.w_size),$=g.avail_in,V=g.next_in,z=g.input,g.avail_in=ee,g.next_in=0,g.input=B,J(W);W.lookahead>=D;){for(C=W.strstart,S=W.lookahead-(D-1);W.ins_h=(W.ins_h<>>=D=R>>>24,_-=D,(D=R>>>16&255)===0)q[u++]=65535&R;else{if(!(16&D)){if(!(64&D)){R=x[(65535&R)+(w&(1<>>=D,_-=D),_<15&&(w+=b[l++]<<_,_+=8,w+=b[l++]<<_,_+=8),R=E[w&k];n:for(;;){if(w>>>=D=R>>>24,_-=D,!(16&(D=R>>>16&255))){if(!(64&D)){R=E[(65535&R)+(w&(1<>>=D,_-=D,(D=u-d)>3,w&=(1<<(_-=T<<3))-1,a.next_in=l,a.next_out=u,a.avail_in=l>>24&255)+(j>>>8&65280)+((65280&j)<<8)+((255&j)<<24)}function w(){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 a.Buf16(320),this.work=new a.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(j){var L;return j&&j.state?(L=j.state,j.total_in=j.total_out=L.total=0,j.msg="",L.wrap&&(j.adler=1&L.wrap),L.mode=v,L.last=0,L.havedict=0,L.dmax=32768,L.head=null,L.hold=0,L.bits=0,L.lencode=L.lendyn=new a.Buf32(f),L.distcode=L.distdyn=new a.Buf32(y),L.sane=1,L.back=-1,p):h}function x(j){var L;return j&&j.state?((L=j.state).wsize=0,L.whave=0,L.wnext=0,_(j)):h}function E(j,L){var b,q;return j&&j.state?(q=j.state,L<0?(b=0,L=-L):(b=1+(L>>4),L<48&&(L&=15)),L&&(L<8||15=N.wsize?(a.arraySet(N.window,L,b-N.wsize,N.wsize,0),N.wnext=0,N.whave=N.wsize):(q<(te=N.wsize-N.wnext)&&(te=q),a.arraySet(N.window,L,b-q,te,N.wnext),(q-=te)?(a.arraySet(N.window,L,b-q,q,0),N.wnext=q,N.whave=N.wsize):(N.wnext+=te,N.wnext===N.wsize&&(N.wnext=0),N.whave>>8&255,b.check=s(b.check,F,2,0),U=K=0,b.mode=2;break}if(b.flags=0,b.head&&(b.head.done=!1),!(1&b.wrap)||(((255&K)<<8)+(K>>8))%31){j.msg="incorrect header check",b.mode=30;break}if((15&K)!=8){j.msg="unknown compression method",b.mode=30;break}if(U-=4,g=8+(15&(K>>>=4)),b.wbits===0)b.wbits=g;else if(g>b.wbits){j.msg="invalid window size",b.mode=30;break}b.dmax=1<>8&1),512&b.flags&&(F[0]=255&K,F[1]=K>>>8&255,b.check=s(b.check,F,2,0)),U=K=0,b.mode=3;case 3:for(;U<32;){if(Z===0)break e;Z--,K+=q[N++]<>>8&255,F[2]=K>>>16&255,F[3]=K>>>24&255,b.check=s(b.check,F,4,0)),U=K=0,b.mode=4;case 4:for(;U<16;){if(Z===0)break e;Z--,K+=q[N++]<>8),512&b.flags&&(F[0]=255&K,F[1]=K>>>8&255,b.check=s(b.check,F,2,0)),U=K=0,b.mode=5;case 5:if(1024&b.flags){for(;U<16;){if(Z===0)break e;Z--,K+=q[N++]<>>8&255,b.check=s(b.check,F,2,0)),U=K=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(1024&b.flags&&(Z<(A=b.length)&&(A=Z),A&&(b.head&&(g=b.head.extra_len-b.length,b.head.extra||(b.head.extra=new Array(b.head.extra_len)),a.arraySet(b.head.extra,q,N,A,g)),512&b.flags&&(b.check=s(b.check,q,A,N)),Z-=A,N+=A,b.length-=A),b.length))break e;b.length=0,b.mode=7;case 7:if(2048&b.flags){if(Z===0)break e;for(A=0;g=q[N+A++],b.head&&g&&b.length<65536&&(b.head.name+=String.fromCharCode(g)),g&&A>9&1,b.head.done=!0),j.adler=b.check=0,b.mode=12;break;case 10:for(;U<32;){if(Z===0)break e;Z--,K+=q[N++]<>>=7&U,U-=7&U,b.mode=27;break}for(;U<3;){if(Z===0)break e;Z--,K+=q[N++]<>>=1)){case 0:b.mode=14;break;case 1:if(T(b),b.mode=20,L!==6)break;K>>>=2,U-=2;break e;case 2:b.mode=17;break;case 3:j.msg="invalid block type",b.mode=30}K>>>=2,U-=2;break;case 14:for(K>>>=7&U,U-=7&U;U<32;){if(Z===0)break e;Z--,K+=q[N++]<>>16^65535)){j.msg="invalid stored block lengths",b.mode=30;break}if(b.length=65535&K,U=K=0,b.mode=15,L===6)break e;case 15:b.mode=16;case 16:if(A=b.length){if(Z>>=5,U-=5,b.ndist=1+(31&K),K>>>=5,U-=5,b.ncode=4+(15&K),K>>>=4,U-=4,286>>=3,U-=3}for(;b.have<19;)b.lens[$[b.have++]]=0;if(b.lencode=b.lendyn,b.lenbits=7,W={bits:b.lenbits},B=c(0,b.lens,0,19,b.lencode,0,b.work,W),b.lenbits=W.bits,B){j.msg="invalid code lengths set",b.mode=30;break}b.have=0,b.mode=19;case 19:for(;b.have>>16&255,ve=65535&S,!((ne=S>>>24)<=U);){if(Z===0)break e;Z--,K+=q[N++]<>>=ne,U-=ne,b.lens[b.have++]=ve;else{if(ve===16){for(C=ne+2;U>>=ne,U-=ne,b.have===0){j.msg="invalid bit length repeat",b.mode=30;break}g=b.lens[b.have-1],A=3+(3&K),K>>>=2,U-=2}else if(ve===17){for(C=ne+3;U>>=ne)),K>>>=3,U-=3}else{for(C=ne+7;U>>=ne)),K>>>=7,U-=7}if(b.have+A>b.nlen+b.ndist){j.msg="invalid bit length repeat",b.mode=30;break}for(;A--;)b.lens[b.have++]=g}}if(b.mode===30)break;if(b.lens[256]===0){j.msg="invalid code -- missing end-of-block",b.mode=30;break}if(b.lenbits=9,W={bits:b.lenbits},B=c(u,b.lens,0,b.nlen,b.lencode,0,b.work,W),b.lenbits=W.bits,B){j.msg="invalid literal/lengths set",b.mode=30;break}if(b.distbits=6,b.distcode=b.distdyn,W={bits:b.distbits},B=c(d,b.lens,b.nlen,b.ndist,b.distcode,0,b.work,W),b.distbits=W.bits,B){j.msg="invalid distances set",b.mode=30;break}if(b.mode=20,L===6)break e;case 20:b.mode=21;case 21:if(6<=Z&&258<=le){j.next_out=ae,j.avail_out=le,j.next_in=N,j.avail_in=Z,b.hold=K,b.bits=U,l(j,M),ae=j.next_out,te=j.output,le=j.avail_out,N=j.next_in,q=j.input,Z=j.avail_in,K=b.hold,U=b.bits,b.mode===12&&(b.back=-1);break}for(b.back=0;ie=(S=b.lencode[K&(1<>>16&255,ve=65535&S,!((ne=S>>>24)<=U);){if(Z===0)break e;Z--,K+=q[N++]<>fe)])>>>16&255,ve=65535&S,!(fe+(ne=S>>>24)<=U);){if(Z===0)break e;Z--,K+=q[N++]<>>=fe,U-=fe,b.back+=fe}if(K>>>=ne,U-=ne,b.back+=ne,b.length=ve,ie===0){b.mode=26;break}if(32&ie){b.back=-1,b.mode=12;break}if(64&ie){j.msg="invalid literal/length code",b.mode=30;break}b.extra=15&ie,b.mode=22;case 22:if(b.extra){for(C=b.extra;U>>=b.extra,U-=b.extra,b.back+=b.extra}b.was=b.length,b.mode=23;case 23:for(;ie=(S=b.distcode[K&(1<>>16&255,ve=65535&S,!((ne=S>>>24)<=U);){if(Z===0)break e;Z--,K+=q[N++]<>fe)])>>>16&255,ve=65535&S,!(fe+(ne=S>>>24)<=U);){if(Z===0)break e;Z--,K+=q[N++]<>>=fe,U-=fe,b.back+=fe}if(K>>>=ne,U-=ne,b.back+=ne,64&ie){j.msg="invalid distance code",b.mode=30;break}b.offset=ve,b.extra=15&ie,b.mode=24;case 24:if(b.extra){for(C=b.extra;U>>=b.extra,U-=b.extra,b.back+=b.extra}if(b.offset>b.dmax){j.msg="invalid distance too far back",b.mode=30;break}b.mode=25;case 25:if(le===0)break e;if(A=M-le,b.offset>A){if((A=b.offset-A)>b.whave&&b.sane){j.msg="invalid distance too far back",b.mode=30;break}J=A>b.wnext?(A-=b.wnext,b.wsize-A):b.wnext-A,A>b.length&&(A=b.length),oe=b.window}else oe=te,J=ae-b.offset,A=b.length;for(lek?(D=J[oe+y[L]],U[re+y[L]]):(D=96,0),w=1<>ae)+(_-=w)]=R<<24|D<<16|T|0,_!==0;);for(w=1<>=1;if(w!==0?(K&=w-1,K+=w):K=0,L++,--M[j]==0){if(j===q)break;j=d[p+y[L]]}if(te>>7)]}function re(S,F){S.pending_buf[S.pending++]=255&F,S.pending_buf[S.pending++]=F>>>8&255}function M(S,F,$){S.bi_valid>m-$?(S.bi_buf|=F<>m-S.bi_valid,S.bi_valid+=$-m):(S.bi_buf|=F<>>=1,$<<=1,0<--F;);return $>>>1}function oe(S,F,$){var V,z,Q=new Array(y+1),ee=0;for(V=1;V<=y;V++)Q[V]=ee=ee+$[V-1]<<1;for(z=0;z<=F;z++){var Y=S[2*z+1];Y!==0&&(S[2*z]=J(Q[Y]++,Y))}}function ne(S){var F;for(F=0;F>1;1<=$;$--)fe(S,Q,$);for(z=se;$=S.heap[1],S.heap[1]=S.heap[S.heap_len--],fe(S,Q,1),V=S.heap[1],S.heap[--S.heap_max]=$,S.heap[--S.heap_max]=V,Q[2*z]=Q[2*$]+Q[2*V],S.depth[z]=(S.depth[$]>=S.depth[V]?S.depth[$]:S.depth[V])+1,Q[2*$+1]=Q[2*V+1]=z,S.heap[1]=z++,fe(S,Q,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(ye,pe){var Ae,De,ot,Ne,Jn,ro,dt=pe.dyn_tree,Ja=pe.max_code,_l=pe.stat_desc.static_tree,xl=pe.stat_desc.has_stree,kl=pe.stat_desc.extra_bits,Ya=pe.stat_desc.extra_base,vn=pe.stat_desc.max_length,Yn=0;for(Ne=0;Ne<=y;Ne++)ye.bl_count[Ne]=0;for(dt[2*ye.heap[ye.heap_max]+1]=0,Ae=ye.heap_max+1;Ae>=7;z>>=1)if(1&be&&Y.dyn_ltree[2*se]!==0)return i;if(Y.dyn_ltree[18]!==0||Y.dyn_ltree[20]!==0||Y.dyn_ltree[26]!==0)return s;for(se=32;se>>3,(Q=S.static_len+3+7>>>3)<=z&&(z=Q)):z=Q=$+5,$+4<=z&&F!==-1?C(S,F,$,V):S.strategy===4||Q===z?(M(S,2+(V?1:0),3),he(S,H,j)):(M(S,4+(V?1:0),3),function(Y,se,be,ye){var pe;for(M(Y,se-257,5),M(Y,be-1,5),M(Y,ye-4,4),pe=0;pe>>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&$,S.last_lit++,F===0?S.dyn_ltree[2*$]++:(S.matches++,F--,S.dyn_ltree[2*(b[$]+d+1)]++,S.dyn_dtree[2*U(F)]++),S.last_lit===S.lit_bufsize-1},o._tr_align=function(S){M(S,2,3),A(S,_,H),function(F){F.bi_valid===16?(re(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(a){(function(i,s){if(!i.setImmediate){var l,c,u,d,p=1,h={},v=!1,f=i.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(i);y=y&&y.setTimeout?y:i,l={}.toString.call(i.process)==="[object process]"?function(x){process.nextTick(function(){w(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?((u=new MessageChannel).port1.onmessage=function(x){w(x.data)},function(x){u.port2.postMessage(x)}):f&&"onreadystatechange"in f.createElement("script")?(c=f.documentElement,function(x){var E=f.createElement("script");E.onreadystatechange=function(){w(x),E.onreadystatechange=null,c.removeChild(E),E=null},c.appendChild(E)}):function(x){setTimeout(w,0,x)},y.setImmediate=function(x){typeof x!="function"&&(x=new Function(""+x));for(var E=new Array(arguments.length-1),I=0;I"u"?a===void 0?this:a:self)}).call(this,typeof Xn<"u"?Xn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bl);var hp=bl.exports;const pp=fa(hp),mp=async t=>{const e=`ComfyUI workspace workflows ${aa(Date.now())}`,n=new pp,r=await(X==null?void 0:X.getSetting("twoWaySync"));for(const o of t){let a;r?a=o.parentFolderID??"":a=await dh(o.parentFolderID??null).then(async s=>Pt(s??""));const i=n.folder(a);i==null||i.file(`${o.name}.json`,o.json)}n.generateAsync({type:"blob"}).then(function(o){const a=document.createElement("a");a.href=window.URL.createObjectURL(o),a.download=`${e}.zip`,document.body.appendChild(a),a.click(),document.body.removeChild(a)})};function yp({myWorkflowsDir:t}){return O.jsxs(rn,{gap:3,children:[O.jsx(xa,{size:"md",children:"πŸ¦„ Upgrade to 2.0 - enable two way sync!"}),O.jsx("p",{children:"Your workflows will be synced to and from path:"}),O.jsx("p",{children:O.jsx("b",{children:t})}),O.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"]}),O.jsxs("p",{children:[O.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."]}),O.jsx(qe,{colorScheme:"teal",variant:"outline",width:"fit-content",onClick:async()=>{const e=await(G==null?void 0:G.listAll());mp(e??[])},children:"πŸ‘‰ Download All My Workflows"})]})}const vp=ba.lazy(()=>Hr(()=>import("./RecentFilesDrawer-FEgtq9Pl.js"),__vite__mapDeps([4,1,5,2,6,7]))),gp=ba.lazy(()=>Hr(()=>import("./GalleryModal-AC5mHOPW.js"),__vite__mapDeps([8,1,7,5,2,3,6]))),wp=ba.lazy(()=>Hr(()=>import("./ModelManagerTopbar-yJwd9tK5.js").then(t=>t.M),__vite__mapDeps([9,1,5,2,10]))),bp=["download_progress","download_error","model_list"];function _p(){const[t,e]=P.useState(null),[n,r]=P.useState("root"),[o,a]=P.useState(!0),[i,s]=P.useState(null),l=P.useRef(null),[c,u]=P.useState(!1),d=P.useRef(null),{showDialog:p}=Bs(),[h,v]=P.useState(!1);P.useRef(!1);const f=P.useRef(0),y=zs(),m=P.useRef("hide"),[w,_]=P.useState(null),[x,E,I]=fp(null),k=P.useCallback(async()=>{if(l.current){const M=JSON.stringify(Se.graph.serialize());await Promise.all([G==null?void 0:G.updateFlow(l.current,{json:M}),ze==null?void 0:ze.create({workflowID:l.current,json:M})]),X!=null&&X.autoSave&&y({title:"Saved",status:"success",duration:1e3,isClosable:!0})}},[]),R=async()=>{l.current&&confirm("Are you sure you want to delete this workflow?")&&(await(G==null?void 0:G.delete(l.current)),T(null))},D=async()=>{var A,J,oe;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 ne=(A=G==null?void 0:G.curWorkflow)==null?void 0:A.id;if(ne==null)return;let ie;X!=null&&X.autoSave?ie=(J=await(ze==null?void 0:ze.getLastestByWorkflowID(ne)))==null?void 0:J.json:ie=(oe=await(G==null?void 0:G.get(ne)))==null?void 0:oe.json,ie?(G==null||G.updateCurWorkflow({...G.curWorkflow,json:ie}),await Se.loadGraphData(JSON.parse(ie))):alert("Error: No last saved version found")}},T=M=>{const A=(M==null?void 0:M.id)??null;if(G==null||G.updateCurWorkflow(M),l.current=A,s(A),e((M==null?void 0:M.name)??""),A==null){document.title="ComfyUI",window.location.hash="",localStorage.removeItem("curFlowID");return}if(js()){const J=hl(A);window.location.hash=J,document.title=M.name+" - ComfyUI"}else localStorage.setItem("curFlowID",A),document.title="ComfyUI - "+M.name},H=async()=>{j(),localStorage.removeItem("workspace"),localStorage.removeItem("comfyspace");try{await xh()}catch(A){console.error("error loading db",A)}a(!1);let M=null;M=js(),M==null&&(M=localStorage.getItem("curFlowID")),M&&b(M),localStorage.getItem("REWRITTEN_ALL_LOCAL_DISK_FILE")==="true"?await dl():(await yh(),localStorage.setItem("REWRITTEN_ALL_LOCAL_DISK_FILE","true")),ge.cache.get(Ds).then(async A=>{if((A==null?void 0:A.value)!=="true"){const J=await(X==null?void 0:X.getSetting("myWorkflowsDir"));p(O.jsx(yp,{myWorkflowsDir:J??"undefined"}),[{label:"I have downloaded all my workflows and ready to enable",onClick:async()=>{await(X==null?void 0:X.upsert({twoWaySync:!0})),await(X==null?void 0:X.getSetting("twoWaySync"))&&(ge.cache.put({id:Ds,value:"true"}),location.reload())},colorScheme:"red"}])}})},j=()=>{bp.forEach(M=>{Xa.addEventListener(M,()=>null)})},L=()=>{if(l.current==null)return!1;const M=G==null?void 0:G.curWorkflow;if(M==null)return!1;if(M.json==null)return!0;const A=Se.graph.serialize()??{};let J={};try{J=M!=null&&M.json?JSON.parse(M==null?void 0:M.json):{}}catch(ne){console.error("error parsing json",ne)}return!(JSON.stringify(A)===JSON.stringify(J))},b=async(M,A)=>{if(Se.graph==null){console.error("app.graph is null cannot load workflow");return}const J=await(G==null?void 0:G.get(M));if(J==null){alert("Error: Workflow not found! id: "+M),T(null);return}const oe=A?await(xe==null?void 0:xe.get(A)):null;Se.ui.dialog.close(),oe?(E(oe),T({...J,json:oe.json}),Se.loadGraphData(JSON.parse(oe.json))):(T(J),E(null),Se.loadGraphData(JSON.parse(J.json))),r("root")},q=M=>{_(M)},te=async(M,A,J=!1)=>{if(M===null){T(null),Se.graph.clear();return}if(!c||J||await(X==null?void 0:X.getSetting("autoSave"))){b(M,A);return}N(M)},N=async M=>{var J,oe;const A=[M?{label:"Open in new tab",icon:O.jsx(Fh,{}),onClick:()=>{mh(M)}}:null,{label:"Save",colorScheme:"teal",onClick:async()=>{await k(),M&&b(M)}}];((J=G==null?void 0:G.curWorkflow)==null?void 0:J.lastSavedJson)!=null?A.push({label:"Discard",colorScheme:"red",onClick:async()=>{M&&b(M)}}):A.push({label:"Delete",colorScheme:"red",onClick:async()=>{await R(),M&&b(M)}}),p(`Please save or discard your changes to "${(oe=G==null?void 0:G.curWorkflow)==null?void 0:oe.name}" before leaving, or your changes will be lost.`,A)},ae=async M=>{const A=(M==null?void 0:M.json)??JSON.stringify(_r),J=await(G==null?void 0:G.createFlow({json:A,name:M==null?void 0:M.name}));J&&await te(J.id),r("root")},Z=async(M,A=!1)=>{const J=M.split("/").pop()??M;A?k():ae({name:J});const oe=await fetch(ph(M)),ne=await oe.blob(),ie=new File([ne],J,{type:oe.headers.get("Content-Type")||""});await Se.handleFile(ie),r("root")},le=async(M,A)=>{const J=await(G==null?void 0:G.get(M));if(J==null)return;const oe=await(G==null?void 0:G.createFlow({json:J.json,lastSavedJson:J.lastSavedJson,name:A||J.name,parentFolderID:J.parentFolderID,tags:J.tags}));oe&&await te(oe.id)},K=async M=>{if(document.visibilityState==="hidden")return;switch(await hh(M)){case na.SAVE:k();return;case na.SAVE_AS:r("saveAsModal");return}},U=P.useCallback(M=>{if(l.current==null)return;let A=M.filename;M.subfolder!=null&&M.subfolder!==""&&(A=M.subfolder+"/"+A),qt==null||qt.create({workflowID:l.current,localPath:A})},[]),re=P.useCallback(()=>{r("root")},[]);return P.useEffect(()=>{H(),v(!0),f.current=setInterval(async()=>{const ie=X==null?void 0:X.autoSave,ve=L();if(u(!!ve),!!ve&&(I.current!=null&&I.current.json!==JSON.stringify(Se.graph.serialize())&&E(null),l.current!=null&&ie)){const fe=await(G==null?void 0:G.latestVersionCheck());if(m.current!=="disabled"&&!fe)m.current="show",p(`This notification is to inform you that it appears you've opened the same workflow in multiple tabs. If all tabs are set to auto-save, this may lead to conflicts and potential data loss. +\0`,M+=a(K,2),M+=I.magic,M+=a(_,2),M+=a(x,2),M+=a(le.crc32,4),M+=a(le.compressedSize,4),M+=a(le.uncompressedSize,4),M+=a(R.length,2),M+=a(q.length,2),{fileRecord:d.LOCAL_FILE_HEADER+M+R+q,dirRecord:d.CENTRAL_FILE_HEADER+a(re,2)+M+a(H.length,2)+"\0\0\0\0"+a(U,4)+a(y,4)+R+q+H}}var s=n("../utils"),l=n("../stream/GenericWorker"),c=n("../utf8"),u=n("../crc32"),d=n("../signature");function p(h,v,f,y){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=v,this.zipPlatform=f,this.encodeFileName=y,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(p,l),p.prototype.push=function(h){var v=h.meta.percent||0,f=this.entriesCount,y=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-y-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(y){return d.DATA_DESCRIPTOR+a(y.crc32,4)+a(y.compressedSize,4)+a(y.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--)c=(c<<8)+this.byteAt(l);return this.index+=s,c},readString:function(s){return a.transformTo("string",this.readData(s))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var s=this.readInt(4);return new Date(Date.UTC(1980+(s>>25&127),(s>>21&15)-1,s>>16&31,s>>11&31,s>>5&63,(31&s)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var a=n("./Uint8ArrayReader");function i(s){a.call(this,s)}n("../utils").inherits(i,a),i.prototype.readData=function(s){this.checkOffset(s);var l=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var a=n("./DataReader");function i(s){a.call(this,s)}n("../utils").inherits(i,a),i.prototype.byteAt=function(s){return this.data.charCodeAt(this.zero+s)},i.prototype.lastIndexOfSignature=function(s){return this.data.lastIndexOf(s)-this.zero},i.prototype.readAndCheckSignature=function(s){return s===this.readData(4)},i.prototype.readData=function(s){this.checkOffset(s);var l=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var a=n("./ArrayReader");function i(s){a.call(this,s)}n("../utils").inherits(i,a),i.prototype.readData=function(s){if(this.checkOffset(s),s===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var a=n("../utils"),i=n("../support"),s=n("./ArrayReader"),l=n("./StringReader"),c=n("./NodeBufferReader"),u=n("./Uint8ArrayReader");r.exports=function(d){var p=a.getTypeOf(d);return a.checkSupport(p),p!=="string"||i.uint8array?p==="nodebuffer"?new c(d):i.uint8array?new u(a.transformTo("uint8array",d)):new s(a.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 a=n("./GenericWorker"),i=n("../utils");function s(l){a.call(this,"ConvertWorker to "+l),this.destType=l}i.inherits(s,a),s.prototype.processChunk=function(l){this.push({data:i.transformTo(this.destType,l.data),meta:l.meta})},r.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var a=n("./GenericWorker"),i=n("../crc32");function s(){a.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(s,a),s.prototype.processChunk=function(l){this.streamInfo.crc32=i(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var a=n("../utils"),i=n("./GenericWorker");function s(l){i.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}a.inherits(s,i),s.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}i.prototype.processChunk.call(this,l)},r.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var a=n("../utils"),i=n("./GenericWorker");function s(l){i.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(u){c.dataIsReady=!0,c.data=u,c.max=u&&u.length||0,c.type=a.getTypeOf(u),c.isPaused||c._tickAndRepeat()},function(u){c.error(u)})}a.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,a.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(a.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=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,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function a(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}a.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,s){return this._listeners[i].push(s),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,s){if(this._listeners[i])for(var l=0;l "+i:i}},r.exports=a},{}],29:[function(n,r,o){var a=n("../utils"),i=n("./ConvertWorker"),s=n("./GenericWorker"),l=n("../base64"),c=n("../support"),u=n("../external"),d=null;if(c.nodestream)try{d=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(v,f){return new u.Promise(function(y,m){var w=[],_=v._internalType,x=v._outputType,E=v._mimeType;v.on("data",function(I,k){w.push(I),f&&f(k)}).on("error",function(I){w=[],m(I)}).on("end",function(){try{var I=function(k,R,D){switch(k){case"blob":return a.newBlob(a.transformTo("arraybuffer",R),D);case"base64":return l.encode(R);default:return a.transformTo(k,R)}}(x,function(k,R){var D,T=0,H=null,j=0;for(D=0;D"u")o.blob=!1;else{var a=new ArrayBuffer(0);try{o.blob=new Blob([a],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(a),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 a=n("./utils"),i=n("./support"),s=n("./nodejsUtils"),l=n("./stream/GenericWorker"),c=new Array(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;c[254]=c[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?s.newBufferFrom(h,"utf-8"):function(v){var f,y,m,w,_,x=v.length,E=0;for(w=0;w>>6:(y<65536?f[_++]=224|y>>>12:(f[_++]=240|y>>>18,f[_++]=128|y>>>12&63),f[_++]=128|y>>>6&63),f[_++]=128|63&y);return f}(h)},o.utf8decode=function(h){return i.nodebuffer?a.transformTo("nodebuffer",h).toString("utf-8"):function(v){var f,y,m,w,_=v.length,x=new Array(2*_);for(f=y=0;f<_;)if((m=v[f++])<128)x[y++]=m;else if(4<(w=c[m]))x[y++]=65533,f+=w-1;else{for(m&=w===2?31:w===3?15:7;1>10&1023,x[y++]=56320|1023&m)}return x.length!==y&&(x.subarray?x=x.subarray(0,y):x.length=y),a.applyFromCharCode(x)}(h=a.transformTo(i.uint8array?"uint8array":"array",h))},a.inherits(d,l),d.prototype.processChunk=function(h){var v=a.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 y=function(w,_){var x;for((_=_||w.length)>w.length&&(_=w.length),x=_-1;0<=x&&(192&w[x])==128;)x--;return x<0||x===0?_:x+c[w[x]]>_?x:_}(v),m=v;y!==v.length&&(i.uint8array?(m=v.subarray(0,y),this.leftOver=v.subarray(y,v.length)):(m=v.slice(0,y),this.leftOver=v.slice(y,v.length))),this.push({data:o.utf8decode(m),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,a.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 a=n("./support"),i=n("./base64"),s=n("./nodejsUtils"),l=n("./external");function c(f){return f}function u(f,y){for(var m=0;m>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=a(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,y,m=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?p[y++]=224|h>>>12:(p[y++]=240|h>>>18,p[y++]=128|h>>>12&63),p[y++]=128|h>>>6&63),p[y++]=128|63&h);return p},o.buf2binstring=function(d){return u(d,d.length)},o.binstring2buf=function(d){for(var p=new a.Buf8(d.length),h=0,v=p.length;h>10&1023,w[v++]=56320|1023&f)}return u(w,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(a,i,s,l){for(var c=65535&a|0,u=a>>>16&65535|0,d=0;s!==0;){for(s-=d=2e3>>1:i>>>1;s[l]=i}return s}();r.exports=function(i,s,l,c){var u=a,d=c+l;i^=-1;for(var p=c;p>>8^u[255&(i^s[p])];return-1^i}},{}],46:[function(n,r,o){var a,i=n("../utils/common"),s=n("./trees"),l=n("./adler32"),c=n("./crc32"),u=n("./messages"),d=0,p=4,h=0,v=-2,f=-1,y=4,m=2,w=8,_=9,x=286,E=30,I=19,k=2*x+1,R=15,D=3,T=258,H=T+D+1,j=42,L=113,b=1,q=2,te=3,N=4;function ae(g,B){return g.msg=u[B],B}function Z(g){return(g<<1)-(4g.avail_out&&(W=g.avail_out),W!==0&&(i.arraySet(g.output,B.pending_buf,B.pending_out,W,g.next_out),g.next_out+=W,B.pending_out+=W,g.total_out+=W,g.avail_out-=W,B.pending-=W,B.pending===0&&(B.pending_out=0))}function U(g,B){s._tr_flush_block(g,0<=g.block_start?g.block_start:-1,g.strstart-g.block_start,B),g.block_start=g.strstart,K(g.strm)}function re(g,B){g.pending_buf[g.pending++]=B}function M(g,B){g.pending_buf[g.pending++]=B>>>8&255,g.pending_buf[g.pending++]=255&B}function A(g,B){var W,C,S=g.max_chain_length,F=g.strstart,$=g.prev_length,V=g.nice_match,z=g.strstart>g.w_size-H?g.strstart-(g.w_size-H):0,Q=g.window,ee=g.w_mask,Y=g.prev,se=g.strstart+T,be=Q[F+$-1],ye=Q[F+$];g.prev_length>=g.good_match&&(S>>=2),V>g.lookahead&&(V=g.lookahead);do if(Q[(W=B)+$]===ye&&Q[W+$-1]===be&&Q[W]===Q[F]&&Q[++W]===Q[F+1]){F+=2,W++;do;while(Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Fz&&--S!=0);return $<=g.lookahead?$:g.lookahead}function J(g){var B,W,C,S,F,$,V,z,Q,ee,Y=g.w_size;do{if(S=g.window_size-g.lookahead-g.strstart,g.strstart>=Y+(Y-H)){for(i.arraySet(g.window,g.window,Y,Y,0),g.match_start-=Y,g.strstart-=Y,g.block_start-=Y,B=W=g.hash_size;C=g.head[--B],g.head[B]=Y<=C?C-Y:0,--W;);for(B=W=Y;C=g.prev[--B],g.prev[B]=Y<=C?C-Y:0,--W;);S+=Y}if(g.strm.avail_in===0)break;if($=g.strm,V=g.window,z=g.strstart+g.lookahead,Q=S,ee=void 0,ee=$.avail_in,Q=D)for(F=g.strstart-g.insert,g.ins_h=g.window[F],g.ins_h=(g.ins_h<=D&&(g.ins_h=(g.ins_h<=D)if(C=s._tr_tally(g,g.strstart-g.match_start,g.match_length-D),g.lookahead-=g.match_length,g.match_length<=g.max_lazy_match&&g.lookahead>=D){for(g.match_length--;g.strstart++,g.ins_h=(g.ins_h<=D&&(g.ins_h=(g.ins_h<=D&&g.match_length<=g.prev_length){for(S=g.strstart+g.lookahead-D,C=s._tr_tally(g,g.strstart-1-g.prev_match,g.prev_length-D),g.lookahead-=g.prev_length-1,g.prev_length-=2;++g.strstart<=S&&(g.ins_h=(g.ins_h<g.pending_buf_size-5&&(W=g.pending_buf_size-5);;){if(g.lookahead<=1){if(J(g),g.lookahead===0&&B===d)return b;if(g.lookahead===0)break}g.strstart+=g.lookahead,g.lookahead=0;var C=g.block_start+W;if((g.strstart===0||g.strstart>=C)&&(g.lookahead=g.strstart-C,g.strstart=C,U(g,!1),g.strm.avail_out===0)||g.strstart-g.block_start>=g.w_size-H&&(U(g,!1),g.strm.avail_out===0))return b}return g.insert=0,B===p?(U(g,!0),g.strm.avail_out===0?te:N):(g.strstart>g.block_start&&(U(g,!1),g.strm.avail_out),b)}),new ie(4,4,8,4,oe),new ie(4,5,16,8,oe),new ie(4,6,32,32,oe),new ie(4,4,16,16,ne),new ie(8,16,32,32,ne),new ie(8,16,128,128,ne),new ie(8,32,128,256,ne),new ie(32,128,258,1024,ne),new ie(32,258,258,4096,ne)],o.deflateInit=function(g,B){return ue(g,B,w,15,8,0)},o.deflateInit2=ue,o.deflateReset=he,o.deflateResetKeep=fe,o.deflateSetHeader=function(g,B){return g&&g.state?g.state.wrap!==2?v:(g.state.gzhead=B,h):v},o.deflate=function(g,B){var W,C,S,F;if(!g||!g.state||5>8&255),re(C,C.gzhead.time>>16&255),re(C,C.gzhead.time>>24&255),re(C,C.level===9?2:2<=C.strategy||C.level<2?4:0),re(C,255&C.gzhead.os),C.gzhead.extra&&C.gzhead.extra.length&&(re(C,255&C.gzhead.extra.length),re(C,C.gzhead.extra.length>>8&255)),C.gzhead.hcrc&&(g.adler=c(g.adler,C.pending_buf,C.pending,0)),C.gzindex=0,C.status=69):(re(C,0),re(C,0),re(C,0),re(C,0),re(C,0),re(C,C.level===9?2:2<=C.strategy||C.level<2?4:0),re(C,3),C.status=L);else{var $=w+(C.w_bits-8<<4)<<8;$|=(2<=C.strategy||C.level<2?0:C.level<6?1:C.level===6?2:3)<<6,C.strstart!==0&&($|=32),$+=31-$%31,C.status=L,M(C,$),C.strstart!==0&&(M(C,g.adler>>>16),M(C,65535&g.adler)),g.adler=1}if(C.status===69)if(C.gzhead.extra){for(S=C.pending;C.gzindex<(65535&C.gzhead.extra.length)&&(C.pending!==C.pending_buf_size||(C.gzhead.hcrc&&C.pending>S&&(g.adler=c(g.adler,C.pending_buf,C.pending-S,S)),K(g),S=C.pending,C.pending!==C.pending_buf_size));)re(C,255&C.gzhead.extra[C.gzindex]),C.gzindex++;C.gzhead.hcrc&&C.pending>S&&(g.adler=c(g.adler,C.pending_buf,C.pending-S,S)),C.gzindex===C.gzhead.extra.length&&(C.gzindex=0,C.status=73)}else C.status=73;if(C.status===73)if(C.gzhead.name){S=C.pending;do{if(C.pending===C.pending_buf_size&&(C.gzhead.hcrc&&C.pending>S&&(g.adler=c(g.adler,C.pending_buf,C.pending-S,S)),K(g),S=C.pending,C.pending===C.pending_buf_size)){F=1;break}F=C.gzindexS&&(g.adler=c(g.adler,C.pending_buf,C.pending-S,S)),F===0&&(C.gzindex=0,C.status=91)}else C.status=91;if(C.status===91)if(C.gzhead.comment){S=C.pending;do{if(C.pending===C.pending_buf_size&&(C.gzhead.hcrc&&C.pending>S&&(g.adler=c(g.adler,C.pending_buf,C.pending-S,S)),K(g),S=C.pending,C.pending===C.pending_buf_size)){F=1;break}F=C.gzindexS&&(g.adler=c(g.adler,C.pending_buf,C.pending-S,S)),F===0&&(C.status=103)}else C.status=103;if(C.status===103&&(C.gzhead.hcrc?(C.pending+2>C.pending_buf_size&&K(g),C.pending+2<=C.pending_buf_size&&(re(C,255&g.adler),re(C,g.adler>>8&255),g.adler=0,C.status=L)):C.status=L),C.pending!==0){if(K(g),g.avail_out===0)return C.last_flush=-1,h}else if(g.avail_in===0&&Z(B)<=Z(W)&&B!==p)return ae(g,-5);if(C.status===666&&g.avail_in!==0)return ae(g,-5);if(g.avail_in!==0||C.lookahead!==0||B!==d&&C.status!==666){var V=C.strategy===2?function(z,Q){for(var ee;;){if(z.lookahead===0&&(J(z),z.lookahead===0)){if(Q===d)return b;break}if(z.match_length=0,ee=s._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++,ee&&(U(z,!1),z.strm.avail_out===0))return b}return z.insert=0,Q===p?(U(z,!0),z.strm.avail_out===0?te:N):z.last_lit&&(U(z,!1),z.strm.avail_out===0)?b:q}(C,B):C.strategy===3?function(z,Q){for(var ee,Y,se,be,ye=z.window;;){if(z.lookahead<=T){if(J(z),z.lookahead<=T&&Q===d)return b;if(z.lookahead===0)break}if(z.match_length=0,z.lookahead>=D&&0z.lookahead&&(z.match_length=z.lookahead)}if(z.match_length>=D?(ee=s._tr_tally(z,1,z.match_length-D),z.lookahead-=z.match_length,z.strstart+=z.match_length,z.match_length=0):(ee=s._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++),ee&&(U(z,!1),z.strm.avail_out===0))return b}return z.insert=0,Q===p?(U(z,!0),z.strm.avail_out===0?te:N):z.last_lit&&(U(z,!1),z.strm.avail_out===0)?b:q}(C,B):a[C.level].func(C,B);if(V!==te&&V!==N||(C.status=666),V===b||V===te)return g.avail_out===0&&(C.last_flush=-1),h;if(V===q&&(B===1?s._tr_align(C):B!==5&&(s._tr_stored_block(C,0,0,!1),B===3&&(le(C.head),C.lookahead===0&&(C.strstart=0,C.block_start=0,C.insert=0))),K(g),g.avail_out===0))return C.last_flush=-1,h}return B!==p?h:C.wrap<=0?1:(C.wrap===2?(re(C,255&g.adler),re(C,g.adler>>8&255),re(C,g.adler>>16&255),re(C,g.adler>>24&255),re(C,255&g.total_in),re(C,g.total_in>>8&255),re(C,g.total_in>>16&255),re(C,g.total_in>>24&255)):(M(C,g.adler>>>16),M(C,65535&g.adler)),K(g),0=W.w_size&&(F===0&&(le(W.head),W.strstart=0,W.block_start=0,W.insert=0),Q=new i.Buf8(W.w_size),i.arraySet(Q,B,ee-W.w_size,W.w_size,0),B=Q,ee=W.w_size),$=g.avail_in,V=g.next_in,z=g.input,g.avail_in=ee,g.next_in=0,g.input=B,J(W);W.lookahead>=D;){for(C=W.strstart,S=W.lookahead-(D-1);W.ins_h=(W.ins_h<>>=D=R>>>24,_-=D,(D=R>>>16&255)===0)q[u++]=65535&R;else{if(!(16&D)){if(!(64&D)){R=x[(65535&R)+(w&(1<>>=D,_-=D),_<15&&(w+=b[l++]<<_,_+=8,w+=b[l++]<<_,_+=8),R=E[w&k];n:for(;;){if(w>>>=D=R>>>24,_-=D,!(16&(D=R>>>16&255))){if(!(64&D)){R=E[(65535&R)+(w&(1<>>=D,_-=D,(D=u-d)>3,w&=(1<<(_-=T<<3))-1,a.next_in=l,a.next_out=u,a.avail_in=l>>24&255)+(j>>>8&65280)+((65280&j)<<8)+((255&j)<<24)}function w(){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 a.Buf16(320),this.work=new a.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(j){var L;return j&&j.state?(L=j.state,j.total_in=j.total_out=L.total=0,j.msg="",L.wrap&&(j.adler=1&L.wrap),L.mode=v,L.last=0,L.havedict=0,L.dmax=32768,L.head=null,L.hold=0,L.bits=0,L.lencode=L.lendyn=new a.Buf32(f),L.distcode=L.distdyn=new a.Buf32(y),L.sane=1,L.back=-1,p):h}function x(j){var L;return j&&j.state?((L=j.state).wsize=0,L.whave=0,L.wnext=0,_(j)):h}function E(j,L){var b,q;return j&&j.state?(q=j.state,L<0?(b=0,L=-L):(b=1+(L>>4),L<48&&(L&=15)),L&&(L<8||15=N.wsize?(a.arraySet(N.window,L,b-N.wsize,N.wsize,0),N.wnext=0,N.whave=N.wsize):(q<(te=N.wsize-N.wnext)&&(te=q),a.arraySet(N.window,L,b-q,te,N.wnext),(q-=te)?(a.arraySet(N.window,L,b-q,q,0),N.wnext=q,N.whave=N.wsize):(N.wnext+=te,N.wnext===N.wsize&&(N.wnext=0),N.whave>>8&255,b.check=s(b.check,F,2,0),U=K=0,b.mode=2;break}if(b.flags=0,b.head&&(b.head.done=!1),!(1&b.wrap)||(((255&K)<<8)+(K>>8))%31){j.msg="incorrect header check",b.mode=30;break}if((15&K)!=8){j.msg="unknown compression method",b.mode=30;break}if(U-=4,g=8+(15&(K>>>=4)),b.wbits===0)b.wbits=g;else if(g>b.wbits){j.msg="invalid window size",b.mode=30;break}b.dmax=1<>8&1),512&b.flags&&(F[0]=255&K,F[1]=K>>>8&255,b.check=s(b.check,F,2,0)),U=K=0,b.mode=3;case 3:for(;U<32;){if(Z===0)break e;Z--,K+=q[N++]<>>8&255,F[2]=K>>>16&255,F[3]=K>>>24&255,b.check=s(b.check,F,4,0)),U=K=0,b.mode=4;case 4:for(;U<16;){if(Z===0)break e;Z--,K+=q[N++]<>8),512&b.flags&&(F[0]=255&K,F[1]=K>>>8&255,b.check=s(b.check,F,2,0)),U=K=0,b.mode=5;case 5:if(1024&b.flags){for(;U<16;){if(Z===0)break e;Z--,K+=q[N++]<>>8&255,b.check=s(b.check,F,2,0)),U=K=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(1024&b.flags&&(Z<(A=b.length)&&(A=Z),A&&(b.head&&(g=b.head.extra_len-b.length,b.head.extra||(b.head.extra=new Array(b.head.extra_len)),a.arraySet(b.head.extra,q,N,A,g)),512&b.flags&&(b.check=s(b.check,q,A,N)),Z-=A,N+=A,b.length-=A),b.length))break e;b.length=0,b.mode=7;case 7:if(2048&b.flags){if(Z===0)break e;for(A=0;g=q[N+A++],b.head&&g&&b.length<65536&&(b.head.name+=String.fromCharCode(g)),g&&A>9&1,b.head.done=!0),j.adler=b.check=0,b.mode=12;break;case 10:for(;U<32;){if(Z===0)break e;Z--,K+=q[N++]<>>=7&U,U-=7&U,b.mode=27;break}for(;U<3;){if(Z===0)break e;Z--,K+=q[N++]<>>=1)){case 0:b.mode=14;break;case 1:if(T(b),b.mode=20,L!==6)break;K>>>=2,U-=2;break e;case 2:b.mode=17;break;case 3:j.msg="invalid block type",b.mode=30}K>>>=2,U-=2;break;case 14:for(K>>>=7&U,U-=7&U;U<32;){if(Z===0)break e;Z--,K+=q[N++]<>>16^65535)){j.msg="invalid stored block lengths",b.mode=30;break}if(b.length=65535&K,U=K=0,b.mode=15,L===6)break e;case 15:b.mode=16;case 16:if(A=b.length){if(Z>>=5,U-=5,b.ndist=1+(31&K),K>>>=5,U-=5,b.ncode=4+(15&K),K>>>=4,U-=4,286>>=3,U-=3}for(;b.have<19;)b.lens[$[b.have++]]=0;if(b.lencode=b.lendyn,b.lenbits=7,W={bits:b.lenbits},B=c(0,b.lens,0,19,b.lencode,0,b.work,W),b.lenbits=W.bits,B){j.msg="invalid code lengths set",b.mode=30;break}b.have=0,b.mode=19;case 19:for(;b.have>>16&255,ve=65535&S,!((ne=S>>>24)<=U);){if(Z===0)break e;Z--,K+=q[N++]<>>=ne,U-=ne,b.lens[b.have++]=ve;else{if(ve===16){for(C=ne+2;U>>=ne,U-=ne,b.have===0){j.msg="invalid bit length repeat",b.mode=30;break}g=b.lens[b.have-1],A=3+(3&K),K>>>=2,U-=2}else if(ve===17){for(C=ne+3;U>>=ne)),K>>>=3,U-=3}else{for(C=ne+7;U>>=ne)),K>>>=7,U-=7}if(b.have+A>b.nlen+b.ndist){j.msg="invalid bit length repeat",b.mode=30;break}for(;A--;)b.lens[b.have++]=g}}if(b.mode===30)break;if(b.lens[256]===0){j.msg="invalid code -- missing end-of-block",b.mode=30;break}if(b.lenbits=9,W={bits:b.lenbits},B=c(u,b.lens,0,b.nlen,b.lencode,0,b.work,W),b.lenbits=W.bits,B){j.msg="invalid literal/lengths set",b.mode=30;break}if(b.distbits=6,b.distcode=b.distdyn,W={bits:b.distbits},B=c(d,b.lens,b.nlen,b.ndist,b.distcode,0,b.work,W),b.distbits=W.bits,B){j.msg="invalid distances set",b.mode=30;break}if(b.mode=20,L===6)break e;case 20:b.mode=21;case 21:if(6<=Z&&258<=le){j.next_out=ae,j.avail_out=le,j.next_in=N,j.avail_in=Z,b.hold=K,b.bits=U,l(j,M),ae=j.next_out,te=j.output,le=j.avail_out,N=j.next_in,q=j.input,Z=j.avail_in,K=b.hold,U=b.bits,b.mode===12&&(b.back=-1);break}for(b.back=0;ie=(S=b.lencode[K&(1<>>16&255,ve=65535&S,!((ne=S>>>24)<=U);){if(Z===0)break e;Z--,K+=q[N++]<>fe)])>>>16&255,ve=65535&S,!(fe+(ne=S>>>24)<=U);){if(Z===0)break e;Z--,K+=q[N++]<>>=fe,U-=fe,b.back+=fe}if(K>>>=ne,U-=ne,b.back+=ne,b.length=ve,ie===0){b.mode=26;break}if(32&ie){b.back=-1,b.mode=12;break}if(64&ie){j.msg="invalid literal/length code",b.mode=30;break}b.extra=15&ie,b.mode=22;case 22:if(b.extra){for(C=b.extra;U>>=b.extra,U-=b.extra,b.back+=b.extra}b.was=b.length,b.mode=23;case 23:for(;ie=(S=b.distcode[K&(1<>>16&255,ve=65535&S,!((ne=S>>>24)<=U);){if(Z===0)break e;Z--,K+=q[N++]<>fe)])>>>16&255,ve=65535&S,!(fe+(ne=S>>>24)<=U);){if(Z===0)break e;Z--,K+=q[N++]<>>=fe,U-=fe,b.back+=fe}if(K>>>=ne,U-=ne,b.back+=ne,64&ie){j.msg="invalid distance code",b.mode=30;break}b.offset=ve,b.extra=15&ie,b.mode=24;case 24:if(b.extra){for(C=b.extra;U>>=b.extra,U-=b.extra,b.back+=b.extra}if(b.offset>b.dmax){j.msg="invalid distance too far back",b.mode=30;break}b.mode=25;case 25:if(le===0)break e;if(A=M-le,b.offset>A){if((A=b.offset-A)>b.whave&&b.sane){j.msg="invalid distance too far back",b.mode=30;break}J=A>b.wnext?(A-=b.wnext,b.wsize-A):b.wnext-A,A>b.length&&(A=b.length),oe=b.window}else oe=te,J=ae-b.offset,A=b.length;for(lek?(D=J[oe+y[L]],U[re+y[L]]):(D=96,0),w=1<>ae)+(_-=w)]=R<<24|D<<16|T|0,_!==0;);for(w=1<>=1;if(w!==0?(K&=w-1,K+=w):K=0,L++,--M[j]==0){if(j===q)break;j=d[p+y[L]]}if(te>>7)]}function re(S,F){S.pending_buf[S.pending++]=255&F,S.pending_buf[S.pending++]=F>>>8&255}function M(S,F,$){S.bi_valid>m-$?(S.bi_buf|=F<>m-S.bi_valid,S.bi_valid+=$-m):(S.bi_buf|=F<>>=1,$<<=1,0<--F;);return $>>>1}function oe(S,F,$){var V,z,Q=new Array(y+1),ee=0;for(V=1;V<=y;V++)Q[V]=ee=ee+$[V-1]<<1;for(z=0;z<=F;z++){var Y=S[2*z+1];Y!==0&&(S[2*z]=J(Q[Y]++,Y))}}function ne(S){var F;for(F=0;F>1;1<=$;$--)fe(S,Q,$);for(z=se;$=S.heap[1],S.heap[1]=S.heap[S.heap_len--],fe(S,Q,1),V=S.heap[1],S.heap[--S.heap_max]=$,S.heap[--S.heap_max]=V,Q[2*z]=Q[2*$]+Q[2*V],S.depth[z]=(S.depth[$]>=S.depth[V]?S.depth[$]:S.depth[V])+1,Q[2*$+1]=Q[2*V+1]=z,S.heap[1]=z++,fe(S,Q,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(ye,pe){var Ae,De,ot,Ne,Jn,ro,dt=pe.dyn_tree,Ja=pe.max_code,_l=pe.stat_desc.static_tree,xl=pe.stat_desc.has_stree,kl=pe.stat_desc.extra_bits,Ya=pe.stat_desc.extra_base,vn=pe.stat_desc.max_length,Yn=0;for(Ne=0;Ne<=y;Ne++)ye.bl_count[Ne]=0;for(dt[2*ye.heap[ye.heap_max]+1]=0,Ae=ye.heap_max+1;Ae>=7;z>>=1)if(1&be&&Y.dyn_ltree[2*se]!==0)return i;if(Y.dyn_ltree[18]!==0||Y.dyn_ltree[20]!==0||Y.dyn_ltree[26]!==0)return s;for(se=32;se>>3,(Q=S.static_len+3+7>>>3)<=z&&(z=Q)):z=Q=$+5,$+4<=z&&F!==-1?C(S,F,$,V):S.strategy===4||Q===z?(M(S,2+(V?1:0),3),he(S,H,j)):(M(S,4+(V?1:0),3),function(Y,se,be,ye){var pe;for(M(Y,se-257,5),M(Y,be-1,5),M(Y,ye-4,4),pe=0;pe>>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&$,S.last_lit++,F===0?S.dyn_ltree[2*$]++:(S.matches++,F--,S.dyn_ltree[2*(b[$]+d+1)]++,S.dyn_dtree[2*U(F)]++),S.last_lit===S.lit_bufsize-1},o._tr_align=function(S){M(S,2,3),A(S,_,H),function(F){F.bi_valid===16?(re(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(a){(function(i,s){if(!i.setImmediate){var l,c,u,d,p=1,h={},v=!1,f=i.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(i);y=y&&y.setTimeout?y:i,l={}.toString.call(i.process)==="[object process]"?function(x){process.nextTick(function(){w(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?((u=new MessageChannel).port1.onmessage=function(x){w(x.data)},function(x){u.port2.postMessage(x)}):f&&"onreadystatechange"in f.createElement("script")?(c=f.documentElement,function(x){var E=f.createElement("script");E.onreadystatechange=function(){w(x),E.onreadystatechange=null,c.removeChild(E),E=null},c.appendChild(E)}):function(x){setTimeout(w,0,x)},y.setImmediate=function(x){typeof x!="function"&&(x=new Function(""+x));for(var E=new Array(arguments.length-1),I=0;I"u"?a===void 0?this:a:self)}).call(this,typeof Xn<"u"?Xn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bl);var hp=bl.exports;const pp=fa(hp),mp=async t=>{const e=`ComfyUI workspace workflows ${aa(Date.now())}`,n=new pp,r=await(X==null?void 0:X.getSetting("twoWaySync"));for(const o of t){let a;r?a=o.parentFolderID??"":a=await dh(o.parentFolderID??null).then(async s=>Pt(s??""));const i=n.folder(a);i==null||i.file(`${o.name}.json`,o.json)}n.generateAsync({type:"blob"}).then(function(o){const a=document.createElement("a");a.href=window.URL.createObjectURL(o),a.download=`${e}.zip`,document.body.appendChild(a),a.click(),document.body.removeChild(a)})};function yp({myWorkflowsDir:t}){return O.jsxs(rn,{gap:3,children:[O.jsx(xa,{size:"md",children:"πŸ¦„ Upgrade to 2.0 - enable two way sync!"}),O.jsx("p",{children:"Your workflows will be synced to and from path:"}),O.jsx("p",{children:O.jsx("b",{children:t})}),O.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"]}),O.jsxs("p",{children:[O.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."]}),O.jsx(qe,{colorScheme:"teal",variant:"outline",width:"fit-content",onClick:async()=>{const e=await(G==null?void 0:G.listAll());mp(e??[])},children:"πŸ‘‰ Download All My Workflows"})]})}const vp=ba.lazy(()=>Hr(()=>import("./RecentFilesDrawer-vciP1wo4.js"),__vite__mapDeps([4,1,5,2,6,7]))),gp=ba.lazy(()=>Hr(()=>import("./GalleryModal-OOtkZCVW.js"),__vite__mapDeps([8,1,7,5,2,3,6]))),wp=ba.lazy(()=>Hr(()=>import("./ModelManagerTopbar-aMEaROu7.js").then(t=>t.M),__vite__mapDeps([9,1,5,2,10]))),bp=["download_progress","download_error","model_list"];function _p(){const[t,e]=P.useState(null),[n,r]=P.useState("root"),[o,a]=P.useState(!0),[i,s]=P.useState(null),l=P.useRef(null),[c,u]=P.useState(!1),d=P.useRef(null),{showDialog:p}=Bs(),[h,v]=P.useState(!1);P.useRef(!1);const f=P.useRef(0),y=zs(),m=P.useRef("hide"),[w,_]=P.useState(null),[x,E,I]=fp(null),k=P.useCallback(async()=>{if(l.current){const M=JSON.stringify(Se.graph.serialize());await Promise.all([G==null?void 0:G.updateFlow(l.current,{json:M}),ze==null?void 0:ze.create({workflowID:l.current,json:M})]),X!=null&&X.autoSave&&y({title:"Saved",status:"success",duration:1e3,isClosable:!0})}},[]),R=async()=>{l.current&&confirm("Are you sure you want to delete this workflow?")&&(await(G==null?void 0:G.delete(l.current)),T(null))},D=async()=>{var A,J,oe;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 ne=(A=G==null?void 0:G.curWorkflow)==null?void 0:A.id;if(ne==null)return;let ie;X!=null&&X.autoSave?ie=(J=await(ze==null?void 0:ze.getLastestByWorkflowID(ne)))==null?void 0:J.json:ie=(oe=await(G==null?void 0:G.get(ne)))==null?void 0:oe.json,ie?(G==null||G.updateCurWorkflow({...G.curWorkflow,json:ie}),await Se.loadGraphData(JSON.parse(ie))):alert("Error: No last saved version found")}},T=M=>{const A=(M==null?void 0:M.id)??null;if(G==null||G.updateCurWorkflow(M),l.current=A,s(A),e((M==null?void 0:M.name)??""),A==null){document.title="ComfyUI",window.location.hash="",localStorage.removeItem("curFlowID");return}if(js()){const J=hl(A);window.location.hash=J,document.title=M.name+" - ComfyUI"}else localStorage.setItem("curFlowID",A),document.title="ComfyUI - "+M.name},H=async()=>{j(),localStorage.removeItem("workspace"),localStorage.removeItem("comfyspace");try{await xh()}catch(A){console.error("error loading db",A)}a(!1);let M=null;M=js(),M==null&&(M=localStorage.getItem("curFlowID")),M&&b(M),localStorage.getItem("REWRITTEN_ALL_LOCAL_DISK_FILE")==="true"?await dl():(await yh(),localStorage.setItem("REWRITTEN_ALL_LOCAL_DISK_FILE","true")),ge.cache.get(Ds).then(async A=>{if((A==null?void 0:A.value)!=="true"){const J=await(X==null?void 0:X.getSetting("myWorkflowsDir"));p(O.jsx(yp,{myWorkflowsDir:J??"undefined"}),[{label:"I have downloaded all my workflows and ready to enable",onClick:async()=>{await(X==null?void 0:X.upsert({twoWaySync:!0})),await(X==null?void 0:X.getSetting("twoWaySync"))&&(ge.cache.put({id:Ds,value:"true"}),location.reload())},colorScheme:"red"}])}})},j=()=>{bp.forEach(M=>{Xa.addEventListener(M,()=>null)})},L=()=>{if(l.current==null)return!1;const M=G==null?void 0:G.curWorkflow;if(M==null)return!1;if(M.json==null)return!0;const A=Se.graph.serialize()??{};let J={};try{J=M!=null&&M.json?JSON.parse(M==null?void 0:M.json):{}}catch(ne){console.error("error parsing json",ne)}return!(JSON.stringify(A)===JSON.stringify(J))},b=async(M,A)=>{if(Se.graph==null){console.error("app.graph is null cannot load workflow");return}const J=await(G==null?void 0:G.get(M));if(J==null){alert("Error: Workflow not found! id: "+M),T(null);return}const oe=A?await(xe==null?void 0:xe.get(A)):null;Se.ui.dialog.close(),oe?(E(oe),T({...J,json:oe.json}),Se.loadGraphData(JSON.parse(oe.json))):(T(J),E(null),Se.loadGraphData(JSON.parse(J.json))),r("root")},q=M=>{_(M)},te=async(M,A,J=!1)=>{if(M===null){T(null),Se.graph.clear();return}if(!c||J||await(X==null?void 0:X.getSetting("autoSave"))){b(M,A);return}N(M)},N=async M=>{var J,oe;const A=[M?{label:"Open in new tab",icon:O.jsx(Fh,{}),onClick:()=>{mh(M)}}:null,{label:"Save",colorScheme:"teal",onClick:async()=>{await k(),M&&b(M)}}];((J=G==null?void 0:G.curWorkflow)==null?void 0:J.lastSavedJson)!=null?A.push({label:"Discard",colorScheme:"red",onClick:async()=>{M&&b(M)}}):A.push({label:"Delete",colorScheme:"red",onClick:async()=>{await R(),M&&b(M)}}),p(`Please save or discard your changes to "${(oe=G==null?void 0:G.curWorkflow)==null?void 0:oe.name}" before leaving, or your changes will be lost.`,A)},ae=async M=>{const A=(M==null?void 0:M.json)??JSON.stringify(_r),J=await(G==null?void 0:G.createFlow({json:A,name:M==null?void 0:M.name}));J&&await te(J.id),r("root")},Z=async(M,A=!1)=>{const J=M.split("/").pop()??M;A?k():ae({name:J});const oe=await fetch(ph(M)),ne=await oe.blob(),ie=new File([ne],J,{type:oe.headers.get("Content-Type")||""});await Se.handleFile(ie),r("root")},le=async(M,A)=>{const J=await(G==null?void 0:G.get(M));if(J==null)return;const oe=await(G==null?void 0:G.createFlow({json:J.json,lastSavedJson:J.lastSavedJson,name:A||J.name,parentFolderID:J.parentFolderID,tags:J.tags}));oe&&await te(oe.id)},K=async M=>{if(document.visibilityState==="hidden")return;switch(await hh(M)){case na.SAVE:k();return;case na.SAVE_AS:r("saveAsModal");return}},U=P.useCallback(M=>{if(l.current==null)return;let A=M.filename;M.subfolder!=null&&M.subfolder!==""&&(A=M.subfolder+"/"+A),qt==null||qt.create({workflowID:l.current,localPath:A})},[]),re=P.useCallback(()=>{r("root")},[]);return P.useEffect(()=>{H(),v(!0),f.current=setInterval(async()=>{const ie=X==null?void 0:X.autoSave,ve=L();if(u(!!ve),!!ve&&(I.current!=null&&I.current.json!==JSON.stringify(Se.graph.serialize())&&E(null),l.current!=null&&ie)){const fe=await(G==null?void 0:G.latestVersionCheck());if(m.current!=="disabled"&&!fe)m.current="show",p(`This notification is to inform you that it appears you've opened the same workflow in multiple tabs. If all tabs are set to auto-save, this may lead to conflicts and potential data loss. You might want to consider disabling auto-save to prevent this. We will remind you to save changes if you leave a page with unsaved work.`,[{label:"Do Not Remind Again",onClick:()=>{m.current="disabled"}},{label:"Disable Auto-Save",colorScheme:"teal",onClick:()=>{X==null||X.upsert({autoSave:!1})}}],!0);else{const he=JSON.stringify(Se.graph.serialize());he!=null&&await(G==null?void 0:G.updateFlow(l.current,{json:he}))}}},1e3),window.addEventListener("keydown",K);const M=document.getElementById("comfy-file-input"),A=async()=>{if(M&&M.files&&M.files.length>0){const ie={id:Fn(),name:M.files[0].name,json:JSON.stringify(_r),updateTime:Date.now(),createTime:Date.now()};T(ie),await(G==null?void 0:G.createFlow(ie))}};M==null||M.addEventListener("change",A);const J=ie=>{const ve=(X==null?void 0:X.autoSave)??!0,fe=L();!ve&&fe&&(ie.preventDefault(),ie.returnValue="You have unsaved changes!",N())};window.addEventListener("beforeunload",J);const oe=ie=>{var ve,fe,he,ue,g,B;(he=(fe=(ve=ie.detail)==null?void 0:ve.output)==null?void 0:fe.images)==null||he.forEach(W=>{W.type==="output"&&U(W)}),(B=(g=(ue=ie.detail)==null?void 0:ue.output)==null?void 0:g.gifs)==null||B.forEach(W=>{W.type==="output"&&U(W)})};Xa.addEventListener("executed",oe);const ne=async ie=>{var ue,g;const ve=(g=(ue=ie.dataTransfer)==null?void 0:ue.files[0])==null?void 0:g.name,fe=Se.dragOverNode;if(fe&&fe.onDragDrop)return;if(!(await(X==null?void 0:X.getSetting("overwriteCurWorkflowWhenDroppingFileToCanvas"))??!1)&&ve){const B={id:Fn(),name:ve,json:JSON.stringify(_r),updateTime:Date.now(),createTime:Date.now()};T(B),await(G==null?void 0:G.createFlow(B))}};return Se.canvasEl.addEventListener("drop",ne),()=>{window.removeEventListener("keydown",K),window.removeEventListener("change",A),window.removeEventListener("beforeunload",J),window.removeEventListener("executed",oe),Se.canvasEl.removeEventListener("drop",ne),clearInterval(f.current)}},[]),o?null:O.jsx(_t.Provider,{value:{curFlowID:i,onDuplicateWorkflow:le,loadWorkflowID:te,discardUnsavedChanges:D,saveCurWorkflow:k,isDirty:c,loadNewWorkflow:ae,loadFilePath:Z,setRoute:r,route:n,jsonDiff:w,compareJson:q,curVersion:x},children:O.jsx("div",{ref:d,className:"workspace_manager",children:O.jsxs(Rs,{containerRef:d,children:[O.jsxs(yt,{style:{position:"absolute",top:0,right:0,left:0},zIndex:uh,draggable:!1,children:[O.jsx(lp,{curFlowName:t,setCurFlowName:e}),h&&O.jsx(P.Suspense,{children:O.jsx(wp,{})}),h&&n==="recentFlows"&&O.jsx(P.Suspense,{children:O.jsx(vp,{onClose:re,onClickNewFlow:()=>{ae(),r("root")}})}),n==="gallery"&&O.jsx(gp,{onclose:()=>r("root")})]}),O.jsx(cp,{})]})})})}const Hp=Object.freeze(Object.defineProperty({__proto__:null,default:_p},Symbol.toStringTag,{value:"Module"}));export{gi as $,G as A,yt as B,Hh as C,Vh as D,na as E,kn as F,mp as G,Tt as H,Pn as I,Ah as J,Rp as K,Rh as L,yi as M,Ke as N,Vr as O,Gr as P,Zr as Q,Up as R,Ed as S,Ra as T,Wh as U,_r as V,Tp as W,wr as X,_h as Y,Fp as Z,fc as _,Cp as a,vi as a0,ki as a1,wi as a2,_i as a3,bi as a4,_t as a5,aa as a6,mh as a7,Fh as a8,Ct as a9,qp as aA,op as aB,ap as aC,rc as aD,Hp as aE,oc as aa,uh as ab,Pp as ac,fl as ad,Bp as ae,Mp as af,qt as ag,xa as ah,Fc as ai,ql as aj,ge as ak,Lp as al,Wp as am,Np as an,Ac as ao,fp as ap,wh as aq,zp as ar,Ap as as,Eh as at,Th as au,hc as av,hn as aw,$p as ax,xe as ay,Kp as az,Nc as b,Dp as c,Ip as d,Op as e,pn as f,Xr as g,Be as h,Kh as i,zs as j,rn as k,zt as l,Wt as m,Kn as n,X as o,yp as p,uf as q,jp as r,Eo as s,xr as t,Yr as u,dl as v,Na as w,Fa as x,xt as y,Nh as z}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["workspace_web/ShareDialog-AtzuU051.js","workspace_web/input.js","workspace_web/index-pz0vT7Or.js","workspace_web/IconCopy-NTjy7XFG.js","workspace_web/RecentFilesDrawer-FEgtq9Pl.js","workspace_web/chunk-JARCRF6W-yJJssWqi.js","workspace_web/chunk-NTCQBYKE-X_7oODtg.js","workspace_web/MediaPreview-hpFtmf6V.js","workspace_web/GalleryModal-AC5mHOPW.js","workspace_web/ModelManagerTopbar-yJwd9tK5.js","workspace_web/assets/ModelManagerTopbar--iv3sdjQ.css"] + __vite__mapDeps.viteFileDeps = ["workspace_web/ShareDialog-Q3AC6yal.js","workspace_web/input.js","workspace_web/index-pz0vT7Or.js","workspace_web/IconCopy-D6uYPUbf.js","workspace_web/RecentFilesDrawer-vciP1wo4.js","workspace_web/chunk-JARCRF6W-we4xocqW.js","workspace_web/chunk-NTCQBYKE-qydYN07M.js","workspace_web/MediaPreview-1uswM5Au.js","workspace_web/GalleryModal-OOtkZCVW.js","workspace_web/ModelManagerTopbar-aMEaROu7.js","workspace_web/assets/ModelManagerTopbar--iv3sdjQ.css"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/workspace_web/GalleryModal-AC5mHOPW.js b/dist/workspace_web/GalleryModal-OOtkZCVW.js similarity index 96% rename from dist/workspace_web/GalleryModal-AC5mHOPW.js rename to dist/workspace_web/GalleryModal-OOtkZCVW.js index f32b55f..cc63f91 100644 --- a/dist/workspace_web/GalleryModal-AC5mHOPW.js +++ b/dist/workspace_web/GalleryModal-OOtkZCVW.js @@ -1 +1 @@ -import{f as se,n as te,o as ne,j as t,g as oe,e as le,r as x,L as ie,G as re,h as N,V as ce,M as ae,N as he,O as ue,Q as xe,R as de,S as ge}from"./input.js";import{_ as fe,h as T,F as j,af as je,I as w,B as J,n as L,l as z,m as C,z as Z,a6 as Y,a5 as Q,k as we,H as S,i as ve,ag as V,A as E,ah as ye,C as pe}from"./App-bwnmchpl.js";import{I as be,i as Ie,a as Ce,b as ke,g as Pe,S as ze,M as Me}from"./MediaPreview-hpFtmf6V.js";import{I as Oe,C as X}from"./chunk-JARCRF6W-yJJssWqi.js";import{I as q,L as F}from"./IconCopy-NTjy7XFG.js";import{V as D}from"./chunk-NTCQBYKE-X_7oODtg.js";import"/scripts/app.js";import"/scripts/api.js";import"./index-pz0vT7Or.js";function Se(s,e=[]){const n=Object.assign({},s);for(const l of e)l in n&&delete n[l];return n}var _e=["h","minH","height","minHeight"],A=se((s,e)=>{const n=te("Textarea",s),{className:l,rows:o,...i}=ne(s),r=fe(i),d=o?Se(n,_e):n;return t.jsx(oe.textarea,{ref:e,rows:o,...r,className:le("chakra-textarea",l),__css:d})});A.displayName="Textarea";var Te=T("arrow-left","IconArrowLeft",[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M5 12l6 6",key:"svg-1"}],["path",{d:"M5 12l6 -6",key:"svg-2"}]]),Ee=T("chevron-left","IconChevronLeft",[["path",{d:"M15 6l-6 6l6 6",key:"svg-0"}]]),Fe=T("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"}]]),Ne=T("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 Ae=({setMediaAct:s,media:e,currentNum:n})=>{const[l,o]=x.useState(0);x.useEffect(()=>{n!==void 0&&o(n)},[n]);const i=c=>{const h=(l+c+e.length)%e.length;o(h),s&&s(e[h])},r={width:"100%",height:"100%"},d={enter:c=>({x:c>0?500:-500,opacity:1}),center:{x:0,opacity:1},exit:c=>({x:c<0?500:-500,opacity:1})};return t.jsxs(j,{justifyContent:"center",alignItems:"center",position:"relative",width:r.width,height:r.height,overflow:"hidden",children:[t.jsx(ie,{custom:l,children:e.map((c,h)=>t.jsx(re.div,{custom:h-l,variants:d,initial:"enter",animate:"center",exit:"exit",transition:{x:{type:"spring",stiffness:300,damping:30},opacity:{duration:.2}},style:{position:"absolute",cursor:"pointer",width:"100%",height:"100%",display:h===l?"block":"none"},onClick:()=>{window.open(c.imageUrl)},children:je(c.imageUrl)?t.jsx(Oe,{src:c.imageUrl,alt:`image-${c.id}`,width:"100%",height:"100%",objectFit:"contain"}):t.jsx("video",{style:{objectFit:"contain"},width:"100%",height:"100%",src:c.imageUrl,loop:!0,autoPlay:!0,muted:!0,children:t.jsx("track",{kind:"captions"})})},c.id))}),t.jsx(w,{size:"sm",color:"white",bgColor:"whiteAlpha.400","aria-label":"Previous image",icon:t.jsx(Ee,{}),onClick:()=>i(-1),position:"absolute",left:"0",zIndex:"2"}),t.jsx(w,{size:"sm",color:"white",bgColor:"whiteAlpha.400","aria-label":"Next image",icon:t.jsx(be,{}),onClick:()=>i(1),position:"absolute",right:"0",zIndex:"2"})]})};function Be(s){const e=s.split(".").pop();return fetch(s).then(n=>{if(!n.ok)throw new Error("Network response was not ok");return n.blob()}).then(async n=>{const l=s.split("/").pop()??"",o=new File([n],l);if(Ie(s))return Ce(o);if(e==="webp")return ke(o);const i=await Pe(o),r=JSON.parse(i==null?void 0:i.prompt),d=JSON.parse(i==null?void 0:i.workflow);return{prompt:r,workflow:d}})}const O=s=>{if(typeof s=="string")return s};function _(s){navigator.clipboard.writeText(s).then(function(){}).catch(function(e){console.error("Unable to copy to clipboard: ",e)})}function ee(s,e){var h,g,f,y,v,p,b,k,a,u,B,G,K,$,m,H,R,U;const n=O((y=(f=s==null?void 0:s[(g=(h=e==null?void 0:e.inputs)==null?void 0:h.model)==null?void 0:g[0]])==null?void 0:f.inputs)==null?void 0:y.ckpt_name)??O((b=(p=s==null?void 0:s[((v=Object.keys(s))==null?void 0:v.find(M=>{var I,P;return(P=(I=s[M])==null?void 0:I.inputs)==null?void 0:P.ckpt_name}))??""])==null?void 0:p.inputs)==null?void 0:b.ckpt_name)??"",l=O((B=(u=s==null?void 0:s[(a=(k=e==null?void 0:e.inputs)==null?void 0:k.positive)==null?void 0:a[0]])==null?void 0:u.inputs)==null?void 0:B.text),o=O((m=($=s==null?void 0:s[(K=(G=e==null?void 0:e.inputs)==null?void 0:G.negative)==null?void 0:K[0]])==null?void 0:$.inputs)==null?void 0:m.text),i=["seed","sampler_name","scheduler","steps","cfg"].reduce((M,I)=>{var P,W;return(P=e==null?void 0:e.inputs)!=null&&P[I]?{...M,[I]:(W=e==null?void 0:e.inputs)==null?void 0:W[I]}:M},{}),r=(U=s==null?void 0:s[(R=(H=e==null?void 0:e.inputs)==null?void 0:H.latent_image)==null?void 0:R[0]])==null?void 0:U.inputs,d=r==null?void 0:r.width,c=r==null?void 0:r.height;return{ckptName:n,positive:l,negative:o,...i,width:d,height:c}}const Ge=s=>{var o;const{prompt:e,workflow:n}=s,l=e==null?void 0:e[((o=Object.keys(e))==null?void 0:o.find(i=>e[i].class_type==="KSampler"))??""];return ee(e,l)},Ke=({metaData:s})=>{const e=Ge(s);return t.jsxs(D,{spacing:2,align:"stretch",children:[t.jsx(J,{children:t.jsx(N,{size:"sm",onClick:()=>_(JSON.stringify(e)),children:"Copy all"})}),Object.keys(e??{}).map(n=>{var l,o;return t.jsxs(j,{gap:2,children:[t.jsxs(j,{gap:1,alignItems:"center",flexBasis:"200px",children:[n,t.jsx(w,{size:"xm",onClick:()=>_((e==null?void 0:e[n])??""),"aria-label":"copy text",icon:t.jsx(q,{}),variant:"ghost"})]}),(l=e==null?void 0:e[n])!=null&&l.length&&((o=e==null?void 0:e[n])==null?void 0:o.length)>300?t.jsx(A,{readOnly:!0,value:e==null?void 0:e[n]}):t.jsx(L,{readOnly:!0,value:e==null?void 0:e[n]})]},`meta${n}`)})]})},$e=s=>{var e,n,l;return((l=(n=(e=Object.keys(s==null?void 0:s.prompt))==null?void 0:e.filter)==null?void 0:n.call(e,o=>{var i,r;return((r=(i=s==null?void 0:s.prompt)==null?void 0:i[o])==null?void 0:r.class_type)==="KSampler"}))==null?void 0:l.length)>1},me=s=>{const{prompt:e}=s,n=Object.keys(e);return(n==null?void 0:n.filter(o=>{var i;return((i=e==null?void 0:e[o])==null?void 0:i.class_type)==="KSampler"})).reduce((o,i,r)=>{const d=e==null?void 0:e[i],c=ee(e,d),h=Object.keys(c).reduce((g,f)=>({...g,[`${f}_${r+1}`]:c==null?void 0:c[f]}),{});return{...o,...h}},{})},He=({metaData:s})=>{var n;const e=me(s);return t.jsxs(D,{spacing:2,align:"stretch",children:[t.jsx(J,{children:t.jsx(N,{size:"sm",onClick:()=>_(JSON.stringify(e)),children:"Copy all"})}),(n=Object.keys(e??{}))==null?void 0:n.filter(l=>!!(e!=null&&e[l])).map(l=>{var o,i;return t.jsxs(j,{gap:2,children:[t.jsxs(j,{gap:1,alignItems:"center",flexBasis:"200px",children:[l,t.jsx(w,{size:"xm",onClick:()=>_((e==null?void 0:e[l])??""),"aria-label":"copy text",icon:t.jsx(q,{}),variant:"ghost"})]}),(o=e==null?void 0:e[l])!=null&&o.length&&((i=e==null?void 0:e[l])==null?void 0:i.length)>300?t.jsx(A,{readOnly:!0,value:e==null?void 0:e[l]}):t.jsx(L,{readOnly:!0,value:e==null?void 0:e[l]})]},`meta${l}`)})]})},Re=({media:s})=>{const[e,n]=x.useState(),l=async o=>{try{const i=await Be(`/workspace/view_media?filename=${o.localPath}`);n(i)}catch(i){console.error(i)}};return x.useEffect(()=>{s&&l(s)},[s]),t.jsxs(j,{overflowY:"auto",mb:4,direction:"column",gap:2,flex:1,children:[t.jsxs(ze,{alignItems:"center",columns:2,spacing:2,children:[t.jsxs(j,{alignItems:"center",gap:1,children:[t.jsx(z,{children:s==null?void 0:s.localPath}),t.jsx(C,{label:"Donwload image from gallery",children:t.jsx(F,{href:`/workspace/view_media?filename=${s==null?void 0:s.localPath}`,download:s==null?void 0:s.localPath,children:t.jsx(w,{size:"sm",icon:t.jsx(Z,{size:19}),"aria-label":"donwload image from gallery"})})})]}),t.jsxs(j,{gap:1,alignItems:"center",children:[t.jsx(z,{children:"Create Time:"}),t.jsx(z,{children:Y((s==null?void 0:s.createTime)??0,!0)})]})]}),(()=>{if(!s||!e)return null;const o={metaData:e,media:s};return $e(e)&&t.jsx(He,{...o})||t.jsx(Ke,{...o})})()]})},Ue=({mediaList:s,media:e})=>{const[n,l]=x.useState();return x.useEffect(()=>{e&&l(e)},[e]),t.jsxs(j,{gap:3,h:"100%",children:[t.jsx(j,{flex:1,children:t.jsx(Ae,{media:s.map(o=>({id:o.id,imageUrl:`/workspace/view_media?filename=${o.localPath}`})),currentNum:s==null?void 0:s.findIndex(o=>o.id===(n==null?void 0:n.id)),setMediaAct:o=>l(s==null?void 0:s.find(i=>i.id===o.id))})}),t.jsx(Re,{media:n})]})},We=({media:s,isSelecting:e,selectedID:n,onClickMedia:l,onRefreshImagesList:o,coverPath:i,setCoverPath:r})=>{const{curFlowID:c,loadFilePath:h}=x.useContext(Q),{showDialog:g}=ce();if(s.localPath==null)return null;const f=i!=null&&i===s.localPath;if(c==null)return null;const y=t.jsxs(F,{isExternal:!0,onClick:()=>l(s),position:"relative",children:[e&&t.jsx(X,{isChecked:n.includes(s.id),position:"absolute",top:2,left:2}),t.jsx(Me,{mediaLocalPath:s.localPath,size:180,onBrokenLink:()=>{},autoPlay:!0,isPreview:!0})]});return t.jsxs(we,{width:180,mb:2,children:[t.jsx(C,{label:Y(s.createTime,!0),children:y}),t.jsx(C,{label:s.localPath,children:t.jsx(z,{color:"GrayText",noOfLines:1,children:s.localPath})}),t.jsxs(S,{hidden:e,gap:0,children:[t.jsx(C,{label:"Set as cover",children:t.jsx(w,{size:"sm",variant:"ghost",icon:f?t.jsx(Fe,{size:19}):t.jsx(Ne,{size:19}),"aria-label":"set as cover",onClick:()=>{var v;(v=E)==null||v.updateMetaInfo(c,{coverMediaPath:s.localPath}),r(s.localPath)}})}),t.jsx(N,{flexGrow:1,onClick:()=>g("How do you want to load this workflow?",[{label:"Load in new workflow",onClick:()=>{h(s.localPath)},colorScheme:"teal"},{label:"Overwrite current workflow",onClick:()=>h(s.localPath,!0),colorScheme:"red"}]),size:"sm",children:"Load"}),t.jsx(C,{label:"Donwload image from gallery",children:t.jsx(F,{href:`/workspace/view_media?filename=${s.localPath}`,download:s.localPath,children:t.jsx(w,{size:"sm",variant:"ghost",icon:t.jsx(Z,{size:19}),"aria-label":"donwload image from gallery"})})}),t.jsx(C,{label:"Remove image from gallery",children:t.jsx(w,{size:"sm",variant:"ghost",icon:t.jsx(ve,{size:19}),"aria-label":"remove image from gallery",colorScheme:"red",onClick:async()=>{var p,b;confirm("Are you sure to remove this image from gallery? (won't delete image on your disk)")&&(await((p=V)==null?void 0:p.delete(s.id)),f&&(await((b=E)==null?void 0:b.updateMetaInfo(c,{coverMediaPath:void 0})),r("")),o())}})})]})]})},Je=We;function ss({onclose:s}){const{curFlowID:e}=x.useContext(Q),[n,l]=x.useState(""),[o,i]=x.useState([]),[r,d]=x.useState(!1),[c,h]=x.useState(""),[g,f]=x.useState([]),[y,v]=x.useState(),p=async()=>{var u;if(e==null)return;const a=await((u=V)==null?void 0:u.listByWorkflowID(e));f(a??[])};if(x.useEffect(()=>{var a;p(),e&&((a=E)==null||a.get(e).then(u=>{u&&(l(u.name),u!=null&&u.coverMediaPath&&h(u==null?void 0:u.coverMediaPath))}))},[]),e==null)return null;const b=a=>{if(r){o.includes(a.id)?i(o.filter(u=>u!==a.id)):i([...o,a.id]);return}v(a)},k=g.length>0&&o.length===g.length;return t.jsxs(ae,{isOpen:!0,onClose:s,blockScrollOnMount:!0,children:[t.jsx(he,{}),t.jsxs(ue,{width:"90%",maxWidth:"90vw",height:"90vh",children:[t.jsxs(xe,{children:[t.jsx(S,{gap:2,mb:2,children:t.jsxs(ye,{size:"md",mr:2,children:[!!y&&t.jsx(w,{onClick:()=>v(void 0),variant:"ghost",mr:1,"aria-label":"back",icon:t.jsx(Te,{})}),"Gallery - ",n]})}),r&&t.jsxs(S,{gap:3,children:[t.jsx(X,{isChecked:k,onChange:()=>{i(k?[]:g.map(a=>a.id))},children:"All"}),t.jsxs(z,{fontSize:16,children:[o.length," Selected"]}),t.jsx(w,{size:"sm",icon:t.jsx(pe,{size:19}),onClick:()=>d(!1),"aria-label":"cancel"})]})]}),t.jsx(de,{}),t.jsx(ge,{overflowY:"auto",children:y?t.jsx(Ue,{mediaList:g,media:y}):t.jsx(S,{wrap:"wrap",children:g.map(a=>t.jsx(Je,{selectedID:o,media:a,isSelecting:r,onClickMedia:b,onRefreshImagesList:p,coverPath:c,setCoverPath:h},a.id))})})]})]})}export{ss as default}; +import{f as se,n as te,o as ne,j as t,g as oe,e as le,r as x,L as ie,G as re,h as N,V as ce,M as ae,N as he,O as ue,Q as xe,R as de,S as ge}from"./input.js";import{_ as fe,h as T,F as j,af as je,I as w,B as J,n as L,l as z,m as C,z as Z,a6 as Y,a5 as Q,k as we,H as S,i as ve,ag as V,A as E,ah as ye,C as pe}from"./App-7ZVFJHq5.js";import{I as be,i as Ie,a as Ce,b as ke,g as Pe,S as ze,M as Me}from"./MediaPreview-1uswM5Au.js";import{I as Oe,C as X}from"./chunk-JARCRF6W-we4xocqW.js";import{I as q,L as F}from"./IconCopy-D6uYPUbf.js";import{V as D}from"./chunk-NTCQBYKE-qydYN07M.js";import"/scripts/app.js";import"/scripts/api.js";import"./index-pz0vT7Or.js";function Se(s,e=[]){const n=Object.assign({},s);for(const l of e)l in n&&delete n[l];return n}var _e=["h","minH","height","minHeight"],A=se((s,e)=>{const n=te("Textarea",s),{className:l,rows:o,...i}=ne(s),r=fe(i),d=o?Se(n,_e):n;return t.jsx(oe.textarea,{ref:e,rows:o,...r,className:le("chakra-textarea",l),__css:d})});A.displayName="Textarea";var Te=T("arrow-left","IconArrowLeft",[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M5 12l6 6",key:"svg-1"}],["path",{d:"M5 12l6 -6",key:"svg-2"}]]),Ee=T("chevron-left","IconChevronLeft",[["path",{d:"M15 6l-6 6l6 6",key:"svg-0"}]]),Fe=T("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"}]]),Ne=T("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 Ae=({setMediaAct:s,media:e,currentNum:n})=>{const[l,o]=x.useState(0);x.useEffect(()=>{n!==void 0&&o(n)},[n]);const i=c=>{const h=(l+c+e.length)%e.length;o(h),s&&s(e[h])},r={width:"100%",height:"100%"},d={enter:c=>({x:c>0?500:-500,opacity:1}),center:{x:0,opacity:1},exit:c=>({x:c<0?500:-500,opacity:1})};return t.jsxs(j,{justifyContent:"center",alignItems:"center",position:"relative",width:r.width,height:r.height,overflow:"hidden",children:[t.jsx(ie,{custom:l,children:e.map((c,h)=>t.jsx(re.div,{custom:h-l,variants:d,initial:"enter",animate:"center",exit:"exit",transition:{x:{type:"spring",stiffness:300,damping:30},opacity:{duration:.2}},style:{position:"absolute",cursor:"pointer",width:"100%",height:"100%",display:h===l?"block":"none"},onClick:()=>{window.open(c.imageUrl)},children:je(c.imageUrl)?t.jsx(Oe,{src:c.imageUrl,alt:`image-${c.id}`,width:"100%",height:"100%",objectFit:"contain"}):t.jsx("video",{style:{objectFit:"contain"},width:"100%",height:"100%",src:c.imageUrl,loop:!0,autoPlay:!0,muted:!0,children:t.jsx("track",{kind:"captions"})})},c.id))}),t.jsx(w,{size:"sm",color:"white",bgColor:"whiteAlpha.400","aria-label":"Previous image",icon:t.jsx(Ee,{}),onClick:()=>i(-1),position:"absolute",left:"0",zIndex:"2"}),t.jsx(w,{size:"sm",color:"white",bgColor:"whiteAlpha.400","aria-label":"Next image",icon:t.jsx(be,{}),onClick:()=>i(1),position:"absolute",right:"0",zIndex:"2"})]})};function Be(s){const e=s.split(".").pop();return fetch(s).then(n=>{if(!n.ok)throw new Error("Network response was not ok");return n.blob()}).then(async n=>{const l=s.split("/").pop()??"",o=new File([n],l);if(Ie(s))return Ce(o);if(e==="webp")return ke(o);const i=await Pe(o),r=JSON.parse(i==null?void 0:i.prompt),d=JSON.parse(i==null?void 0:i.workflow);return{prompt:r,workflow:d}})}const O=s=>{if(typeof s=="string")return s};function _(s){navigator.clipboard.writeText(s).then(function(){}).catch(function(e){console.error("Unable to copy to clipboard: ",e)})}function ee(s,e){var h,g,f,y,v,p,b,k,a,u,B,G,K,$,m,H,R,U;const n=O((y=(f=s==null?void 0:s[(g=(h=e==null?void 0:e.inputs)==null?void 0:h.model)==null?void 0:g[0]])==null?void 0:f.inputs)==null?void 0:y.ckpt_name)??O((b=(p=s==null?void 0:s[((v=Object.keys(s))==null?void 0:v.find(M=>{var I,P;return(P=(I=s[M])==null?void 0:I.inputs)==null?void 0:P.ckpt_name}))??""])==null?void 0:p.inputs)==null?void 0:b.ckpt_name)??"",l=O((B=(u=s==null?void 0:s[(a=(k=e==null?void 0:e.inputs)==null?void 0:k.positive)==null?void 0:a[0]])==null?void 0:u.inputs)==null?void 0:B.text),o=O((m=($=s==null?void 0:s[(K=(G=e==null?void 0:e.inputs)==null?void 0:G.negative)==null?void 0:K[0]])==null?void 0:$.inputs)==null?void 0:m.text),i=["seed","sampler_name","scheduler","steps","cfg"].reduce((M,I)=>{var P,W;return(P=e==null?void 0:e.inputs)!=null&&P[I]?{...M,[I]:(W=e==null?void 0:e.inputs)==null?void 0:W[I]}:M},{}),r=(U=s==null?void 0:s[(R=(H=e==null?void 0:e.inputs)==null?void 0:H.latent_image)==null?void 0:R[0]])==null?void 0:U.inputs,d=r==null?void 0:r.width,c=r==null?void 0:r.height;return{ckptName:n,positive:l,negative:o,...i,width:d,height:c}}const Ge=s=>{var o;const{prompt:e,workflow:n}=s,l=e==null?void 0:e[((o=Object.keys(e))==null?void 0:o.find(i=>e[i].class_type==="KSampler"))??""];return ee(e,l)},Ke=({metaData:s})=>{const e=Ge(s);return t.jsxs(D,{spacing:2,align:"stretch",children:[t.jsx(J,{children:t.jsx(N,{size:"sm",onClick:()=>_(JSON.stringify(e)),children:"Copy all"})}),Object.keys(e??{}).map(n=>{var l,o;return t.jsxs(j,{gap:2,children:[t.jsxs(j,{gap:1,alignItems:"center",flexBasis:"200px",children:[n,t.jsx(w,{size:"xm",onClick:()=>_((e==null?void 0:e[n])??""),"aria-label":"copy text",icon:t.jsx(q,{}),variant:"ghost"})]}),(l=e==null?void 0:e[n])!=null&&l.length&&((o=e==null?void 0:e[n])==null?void 0:o.length)>300?t.jsx(A,{readOnly:!0,value:e==null?void 0:e[n]}):t.jsx(L,{readOnly:!0,value:e==null?void 0:e[n]})]},`meta${n}`)})]})},$e=s=>{var e,n,l;return((l=(n=(e=Object.keys(s==null?void 0:s.prompt))==null?void 0:e.filter)==null?void 0:n.call(e,o=>{var i,r;return((r=(i=s==null?void 0:s.prompt)==null?void 0:i[o])==null?void 0:r.class_type)==="KSampler"}))==null?void 0:l.length)>1},me=s=>{const{prompt:e}=s,n=Object.keys(e);return(n==null?void 0:n.filter(o=>{var i;return((i=e==null?void 0:e[o])==null?void 0:i.class_type)==="KSampler"})).reduce((o,i,r)=>{const d=e==null?void 0:e[i],c=ee(e,d),h=Object.keys(c).reduce((g,f)=>({...g,[`${f}_${r+1}`]:c==null?void 0:c[f]}),{});return{...o,...h}},{})},He=({metaData:s})=>{var n;const e=me(s);return t.jsxs(D,{spacing:2,align:"stretch",children:[t.jsx(J,{children:t.jsx(N,{size:"sm",onClick:()=>_(JSON.stringify(e)),children:"Copy all"})}),(n=Object.keys(e??{}))==null?void 0:n.filter(l=>!!(e!=null&&e[l])).map(l=>{var o,i;return t.jsxs(j,{gap:2,children:[t.jsxs(j,{gap:1,alignItems:"center",flexBasis:"200px",children:[l,t.jsx(w,{size:"xm",onClick:()=>_((e==null?void 0:e[l])??""),"aria-label":"copy text",icon:t.jsx(q,{}),variant:"ghost"})]}),(o=e==null?void 0:e[l])!=null&&o.length&&((i=e==null?void 0:e[l])==null?void 0:i.length)>300?t.jsx(A,{readOnly:!0,value:e==null?void 0:e[l]}):t.jsx(L,{readOnly:!0,value:e==null?void 0:e[l]})]},`meta${l}`)})]})},Re=({media:s})=>{const[e,n]=x.useState(),l=async o=>{try{const i=await Be(`/workspace/view_media?filename=${o.localPath}`);n(i)}catch(i){console.error(i)}};return x.useEffect(()=>{s&&l(s)},[s]),t.jsxs(j,{overflowY:"auto",mb:4,direction:"column",gap:2,flex:1,children:[t.jsxs(ze,{alignItems:"center",columns:2,spacing:2,children:[t.jsxs(j,{alignItems:"center",gap:1,children:[t.jsx(z,{children:s==null?void 0:s.localPath}),t.jsx(C,{label:"Donwload image from gallery",children:t.jsx(F,{href:`/workspace/view_media?filename=${s==null?void 0:s.localPath}`,download:s==null?void 0:s.localPath,children:t.jsx(w,{size:"sm",icon:t.jsx(Z,{size:19}),"aria-label":"donwload image from gallery"})})})]}),t.jsxs(j,{gap:1,alignItems:"center",children:[t.jsx(z,{children:"Create Time:"}),t.jsx(z,{children:Y((s==null?void 0:s.createTime)??0,!0)})]})]}),(()=>{if(!s||!e)return null;const o={metaData:e,media:s};return $e(e)&&t.jsx(He,{...o})||t.jsx(Ke,{...o})})()]})},Ue=({mediaList:s,media:e})=>{const[n,l]=x.useState();return x.useEffect(()=>{e&&l(e)},[e]),t.jsxs(j,{gap:3,h:"100%",children:[t.jsx(j,{flex:1,children:t.jsx(Ae,{media:s.map(o=>({id:o.id,imageUrl:`/workspace/view_media?filename=${o.localPath}`})),currentNum:s==null?void 0:s.findIndex(o=>o.id===(n==null?void 0:n.id)),setMediaAct:o=>l(s==null?void 0:s.find(i=>i.id===o.id))})}),t.jsx(Re,{media:n})]})},We=({media:s,isSelecting:e,selectedID:n,onClickMedia:l,onRefreshImagesList:o,coverPath:i,setCoverPath:r})=>{const{curFlowID:c,loadFilePath:h}=x.useContext(Q),{showDialog:g}=ce();if(s.localPath==null)return null;const f=i!=null&&i===s.localPath;if(c==null)return null;const y=t.jsxs(F,{isExternal:!0,onClick:()=>l(s),position:"relative",children:[e&&t.jsx(X,{isChecked:n.includes(s.id),position:"absolute",top:2,left:2}),t.jsx(Me,{mediaLocalPath:s.localPath,size:180,onBrokenLink:()=>{},autoPlay:!0,isPreview:!0})]});return t.jsxs(we,{width:180,mb:2,children:[t.jsx(C,{label:Y(s.createTime,!0),children:y}),t.jsx(C,{label:s.localPath,children:t.jsx(z,{color:"GrayText",noOfLines:1,children:s.localPath})}),t.jsxs(S,{hidden:e,gap:0,children:[t.jsx(C,{label:"Set as cover",children:t.jsx(w,{size:"sm",variant:"ghost",icon:f?t.jsx(Fe,{size:19}):t.jsx(Ne,{size:19}),"aria-label":"set as cover",onClick:()=>{var v;(v=E)==null||v.updateMetaInfo(c,{coverMediaPath:s.localPath}),r(s.localPath)}})}),t.jsx(N,{flexGrow:1,onClick:()=>g("How do you want to load this workflow?",[{label:"Load in new workflow",onClick:()=>{h(s.localPath)},colorScheme:"teal"},{label:"Overwrite current workflow",onClick:()=>h(s.localPath,!0),colorScheme:"red"}]),size:"sm",children:"Load"}),t.jsx(C,{label:"Donwload image from gallery",children:t.jsx(F,{href:`/workspace/view_media?filename=${s.localPath}`,download:s.localPath,children:t.jsx(w,{size:"sm",variant:"ghost",icon:t.jsx(Z,{size:19}),"aria-label":"donwload image from gallery"})})}),t.jsx(C,{label:"Remove image from gallery",children:t.jsx(w,{size:"sm",variant:"ghost",icon:t.jsx(ve,{size:19}),"aria-label":"remove image from gallery",colorScheme:"red",onClick:async()=>{var p,b;confirm("Are you sure to remove this image from gallery? (won't delete image on your disk)")&&(await((p=V)==null?void 0:p.delete(s.id)),f&&(await((b=E)==null?void 0:b.updateMetaInfo(c,{coverMediaPath:void 0})),r("")),o())}})})]})]})},Je=We;function ss({onclose:s}){const{curFlowID:e}=x.useContext(Q),[n,l]=x.useState(""),[o,i]=x.useState([]),[r,d]=x.useState(!1),[c,h]=x.useState(""),[g,f]=x.useState([]),[y,v]=x.useState(),p=async()=>{var u;if(e==null)return;const a=await((u=V)==null?void 0:u.listByWorkflowID(e));f(a??[])};if(x.useEffect(()=>{var a;p(),e&&((a=E)==null||a.get(e).then(u=>{u&&(l(u.name),u!=null&&u.coverMediaPath&&h(u==null?void 0:u.coverMediaPath))}))},[]),e==null)return null;const b=a=>{if(r){o.includes(a.id)?i(o.filter(u=>u!==a.id)):i([...o,a.id]);return}v(a)},k=g.length>0&&o.length===g.length;return t.jsxs(ae,{isOpen:!0,onClose:s,blockScrollOnMount:!0,children:[t.jsx(he,{}),t.jsxs(ue,{width:"90%",maxWidth:"90vw",height:"90vh",children:[t.jsxs(xe,{children:[t.jsx(S,{gap:2,mb:2,children:t.jsxs(ye,{size:"md",mr:2,children:[!!y&&t.jsx(w,{onClick:()=>v(void 0),variant:"ghost",mr:1,"aria-label":"back",icon:t.jsx(Te,{})}),"Gallery - ",n]})}),r&&t.jsxs(S,{gap:3,children:[t.jsx(X,{isChecked:k,onChange:()=>{i(k?[]:g.map(a=>a.id))},children:"All"}),t.jsxs(z,{fontSize:16,children:[o.length," Selected"]}),t.jsx(w,{size:"sm",icon:t.jsx(pe,{size:19}),onClick:()=>d(!1),"aria-label":"cancel"})]})]}),t.jsx(de,{}),t.jsx(ge,{overflowY:"auto",children:y?t.jsx(Ue,{mediaList:g,media:y}):t.jsx(S,{wrap:"wrap",children:g.map(a=>t.jsx(Je,{selectedID:o,media:a,isSelecting:r,onClickMedia:b,onRefreshImagesList:p,coverPath:c,setCoverPath:h},a.id))})})]})]})}export{ss as default}; diff --git a/dist/workspace_web/IconCopy-NTjy7XFG.js b/dist/workspace_web/IconCopy-D6uYPUbf.js similarity index 90% rename from dist/workspace_web/IconCopy-NTjy7XFG.js rename to dist/workspace_web/IconCopy-D6uYPUbf.js index 1bde9f7..c613b0f 100644 --- a/dist/workspace_web/IconCopy-NTjy7XFG.js +++ b/dist/workspace_web/IconCopy-D6uYPUbf.js @@ -1 +1 @@ -import{f as r,n as c,o as i,j as m,g as p,e as k}from"./input.js";import{h}from"./App-bwnmchpl.js";var l=r(function(a,e){const o=c("Link",a),{className:n,isExternal:s,...t}=i(a);return m.jsx(p.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:e,className:k("chakra-link",n),...t,__css:o})});l.displayName="Link";var d=h("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{d as I,l as L}; +import{f as r,n as c,o as i,j as m,g as p,e as k}from"./input.js";import{h}from"./App-7ZVFJHq5.js";var l=r(function(a,e){const o=c("Link",a),{className:n,isExternal:s,...t}=i(a);return m.jsx(p.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:e,className:k("chakra-link",n),...t,__css:o})});l.displayName="Link";var d=h("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{d as I,l as L}; diff --git a/dist/workspace_web/InstallMissingModelsButton-tTqamchA.js b/dist/workspace_web/InstallMissingModelsButton-h7fGpVGR.js similarity index 92% rename from dist/workspace_web/InstallMissingModelsButton-tTqamchA.js rename to dist/workspace_web/InstallMissingModelsButton-h7fGpVGR.js index b8c2714..722daba 100644 --- a/dist/workspace_web/InstallMissingModelsButton-tTqamchA.js +++ b/dist/workspace_web/InstallMissingModelsButton-h7fGpVGR.js @@ -1 +1 @@ -import{r as h,j as e,h as m,P as f}from"./input.js";import{app as c}from"/scripts/app.js";import{G as x,g as j,I as _}from"./ModelManagerTopbar-yJwd9tK5.js";import{l as d,H as v,a8 as g,B as w,aa as M,ab as y,aD as E,F as I,ah as b}from"./App-bwnmchpl.js";import{V as S}from"./chunk-NTCQBYKE-X_7oODtg.js";import{I as k,G as C}from"./chunk-JARCRF6W-yJJssWqi.js";import"/scripts/api.js";import"./index-pz0vT7Or.js";function D({model:s}){const[l,t]=h.useState([]),o=z(s.received_value),u=async()=>{const n=await(await fetch(`https://huggingface.co/api/models?limit=3&search=${o}&full=true`)).json(),i=[];n.slice(0,1).forEach(({modelId:r,siblings:H})=>{i.push({name:r,downloadUrl:`https://huggingface.co/${r}/resolve/main/`,url:`https://huggingface.co/${r}/tree/main`,icon:"https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.png"})}),t(r=>[...r,...i])},p=async()=>{const a=await j(o);t(n=>[...n,...a==null?void 0:a.slice(0,1).map(i=>({name:i.name,url:"https://civitai.com/models/"+i.id,icon:"https://images.crunchbase.com/image/upload/c_pad,h_170,w_170,f_auto,b_white,q_auto:eco,dpr_1/gtxrcmtsvpjjevozblfa"}))])};return h.useEffect(()=>{u(),p()},[]),e.jsx(x,{p:3,shadow:"md",borderWidth:"1px",children:e.jsxs(S,{align:"start",children:[e.jsx(d,{children:s.class_type}),e.jsxs(v,{ml:3,children:[e.jsxs(d,{children:[s.input_name,": "]}),e.jsx(d,{color:"red.400",children:s.received_value})]}),l.map(({url:a,name:n,icon:i})=>e.jsx(m,{size:"sm",onClick:r=>{r.stopPropagation(),window.open(a,"_blank")},leftIcon:e.jsx(k,{width:5,src:i}),rightIcon:e.jsx(g,{size:20}),children:n})),e.jsx(m,{colorScheme:"blue",mt:5,iconSpacing:1,leftIcon:e.jsx(g,{size:20}),size:"sm",onClick:()=>{window.open(`https://civitai.com/search/models?sortBy=models_v5&query=${o}`,"_blank")},children:"Search in CivitAI"})]})})}function z(s){return s.replace(/^.*(\\|\/|\:)/,"").replace(/\.[^/.]+$/,"").replaceAll("_"," ").replace(/([A-Z])/g," $1").trim()}function B({onClose:s,missingModels:l}){h.useEffect(()=>(c.canvasEl.addEventListener("click",s),()=>{c.canvasEl.removeEventListener("click",s)}),[]);const t=440;return e.jsx(f,{children:e.jsx(w,{style:{width:t},children:e.jsxs(M,{width:t,height:"100vh",p:4,gap:2,position:"fixed",top:0,left:0,shadow:"xl",zIndex:y,overflowY:"auto",children:[e.jsx(E,{children:e.jsxs(I,{justifyContent:"space-between",alignContent:"center",children:[e.jsxs(b,{size:"md",mr:2,children:["Missing Models (",l.length,")"]}),e.jsx(_,{})]})}),e.jsx(C,{templateColumns:"1",gap:1,marginTop:2,children:l.map(o=>e.jsx(D,{model:o},o.received_value))})]})})})}function U({}){const[s,l]=h.useState(!1),[t,o]=h.useState([]);return h.useEffect(()=>{const u=c.queuePrompt;c.queuePrompt=async function(){try{await u.apply(c,[...arguments])}finally{const p=c.lastNodeErrors??{};o(Object.values(p).flatMap(a=>a.errors.filter(n=>n.type==="value_not_in_list").map(n=>{const{input_name:i,received_value:r}=n.extra_info;return{class_type:a.class_type,input_name:i,received_value:r}})))}}},[]),t.length===0?null:e.jsxs(e.Fragment,{children:[e.jsxs(m,{size:"sm","aria-label":"missing models",px:2,onClick:()=>l(!0),children:["Install Missing (",t.length,")"]}),s&&e.jsx(B,{onClose:()=>l(!1),missingModels:t})]})}export{U as default}; +import{r as h,j as e,h as m,P as f}from"./input.js";import{app as c}from"/scripts/app.js";import{G as x,g as j,I as _}from"./ModelManagerTopbar-aMEaROu7.js";import{l as d,H as v,a8 as g,B as w,aa as M,ab as y,aD as E,F as I,ah as b}from"./App-7ZVFJHq5.js";import{V as S}from"./chunk-NTCQBYKE-qydYN07M.js";import{I as k,G as C}from"./chunk-JARCRF6W-we4xocqW.js";import"/scripts/api.js";import"./index-pz0vT7Or.js";function D({model:s}){const[l,t]=h.useState([]),o=z(s.received_value),u=async()=>{const n=await(await fetch(`https://huggingface.co/api/models?limit=3&search=${o}&full=true`)).json(),i=[];n.slice(0,1).forEach(({modelId:r,siblings:H})=>{i.push({name:r,downloadUrl:`https://huggingface.co/${r}/resolve/main/`,url:`https://huggingface.co/${r}/tree/main`,icon:"https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.png"})}),t(r=>[...r,...i])},p=async()=>{const a=await j(o);t(n=>[...n,...a==null?void 0:a.slice(0,1).map(i=>({name:i.name,url:"https://civitai.com/models/"+i.id,icon:"https://images.crunchbase.com/image/upload/c_pad,h_170,w_170,f_auto,b_white,q_auto:eco,dpr_1/gtxrcmtsvpjjevozblfa"}))])};return h.useEffect(()=>{u(),p()},[]),e.jsx(x,{p:3,shadow:"md",borderWidth:"1px",children:e.jsxs(S,{align:"start",children:[e.jsx(d,{children:s.class_type}),e.jsxs(v,{ml:3,children:[e.jsxs(d,{children:[s.input_name,": "]}),e.jsx(d,{color:"red.400",children:s.received_value})]}),l.map(({url:a,name:n,icon:i})=>e.jsx(m,{size:"sm",onClick:r=>{r.stopPropagation(),window.open(a,"_blank")},leftIcon:e.jsx(k,{width:5,src:i}),rightIcon:e.jsx(g,{size:20}),children:n})),e.jsx(m,{colorScheme:"blue",mt:5,iconSpacing:1,leftIcon:e.jsx(g,{size:20}),size:"sm",onClick:()=>{window.open(`https://civitai.com/search/models?sortBy=models_v5&query=${o}`,"_blank")},children:"Search in CivitAI"})]})})}function z(s){return s.replace(/^.*(\\|\/|\:)/,"").replace(/\.[^/.]+$/,"").replaceAll("_"," ").replace(/([A-Z])/g," $1").trim()}function B({onClose:s,missingModels:l}){h.useEffect(()=>(c.canvasEl.addEventListener("click",s),()=>{c.canvasEl.removeEventListener("click",s)}),[]);const t=440;return e.jsx(f,{children:e.jsx(w,{style:{width:t},children:e.jsxs(M,{width:t,height:"100vh",p:4,gap:2,position:"fixed",top:0,left:0,shadow:"xl",zIndex:y,overflowY:"auto",children:[e.jsx(E,{children:e.jsxs(I,{justifyContent:"space-between",alignContent:"center",children:[e.jsxs(b,{size:"md",mr:2,children:["Missing Models (",l.length,")"]}),e.jsx(_,{})]})}),e.jsx(C,{templateColumns:"1",gap:1,marginTop:2,children:l.map(o=>e.jsx(D,{model:o},o.received_value))})]})})})}function U({}){const[s,l]=h.useState(!1),[t,o]=h.useState([]);return h.useEffect(()=>{const u=c.queuePrompt;c.queuePrompt=async function(){try{await u.apply(c,[...arguments])}finally{const p=c.lastNodeErrors??{};o(Object.values(p).flatMap(a=>a.errors.filter(n=>n.type==="value_not_in_list").map(n=>{const{input_name:i,received_value:r}=n.extra_info;return{class_type:a.class_type,input_name:i,received_value:r}})))}}},[]),t.length===0?null:e.jsxs(e.Fragment,{children:[e.jsxs(m,{size:"sm","aria-label":"missing models",px:2,onClick:()=>l(!0),children:["Install Missing (",t.length,")"]}),s&&e.jsx(B,{onClose:()=>l(!1),missingModels:t})]})}export{U as default}; diff --git a/dist/workspace_web/MediaPreview-hpFtmf6V.js b/dist/workspace_web/MediaPreview-1uswM5Au.js similarity index 96% rename from dist/workspace_web/MediaPreview-hpFtmf6V.js rename to dist/workspace_web/MediaPreview-1uswM5Au.js index cc53299..a4b5ec9 100644 --- a/dist/workspace_web/MediaPreview-hpFtmf6V.js +++ b/dist/workspace_web/MediaPreview-1uswM5Au.js @@ -1 +1 @@ -import{G as U,I as C}from"./chunk-JARCRF6W-yJJssWqi.js";import{f as x,E as b,j as p,ab as v,r as h}from"./input.js";import{ai as y,h as S,af as E}from"./App-bwnmchpl.js";var k=x(function(r,s){const{columns:l,spacingX:a,spacingY:n,spacing:i,minChildWidth:e,...c}=r,o=b(),f=e?A(e,o):M(l);return p.jsx(U,{ref:s,gap:i,columnGap:a,rowGap:n,templateColumns:f,...c})});k.displayName="SimpleGrid";function V(t){return typeof t=="number"?`${t}px`:t}function A(t,r){return y(t,s=>{const l=v("sizes",s,V(s))(r);return s===null?null:`repeat(auto-fit, minmax(${l}, 1fr))`})}function M(t){return y(t,r=>r===null?null:`repeat(${r}, minmax(0, 1fr))`)}var R=S("chevron-right","IconChevronRight",[["path",{d:"M9 6l6 6l-6 6",key:"svg-0"}]]);function O(t){return new Promise((r,s)=>{const l=new FileReader;l.onload=a=>{const n=new Uint8Array(a.target.result),i=new DataView(n.buffer);i.getUint32(0)!==2303741511&&(console.error("Not a valid PNG file"),s());let e=8;const c={};for(;eString.fromCharCode(w)).join("");c[g]=m}e+=12+o}r(c)},l.readAsArrayBuffer(t)})}function _(t){const r=new Uint16Array(t.slice(0,2))[0]===18761;function s(i,e,c){const o=t.slice(i,i+c);if(c===2)return new DataView(o.buffer,o.byteOffset,o.byteLength).getUint16(0,e);if(c===4)return new DataView(o.buffer,o.byteOffset,o.byteLength).getUint32(0,e)}const l=s(4,r,4);function a(i){const e=s(i,r,2),c={};for(let o=0;o{const s=new FileReader;s.onload=l=>{var c;const a=new Uint8Array((c=l==null?void 0:l.target)==null?void 0:c.result),n=new DataView(a.buffer);if(n.getUint32(0)!==1380533830||n.getUint32(8)!==1464156752){console.error("Not a valid WEBP file"),r();return}let i=12;const e={};for(;i{const s=new FileReader;s.onload=l=>{const a=new Uint8Array(l.target.result),n=new DataView(a.buffer),i=new TextDecoder;if(n.getUint32(0)==440786851){let e=12;for(;e>8*(4-f)&~(1<<7*f),g=i.decode(a.slice(e+2+f,e+2+f+u)),d=JSON.parse(g);r(d);return}}e+=1}}else if(n.getUint32(4)==1718909296&&n.getUint32(8)==1769172845){let e=a.length-4;for(;e>16;){if(n.getUint32(e)==1684108385&&n.getUint32(e-8)==2841865588){n.getUint32(e+4),n.getUint32(e+8);const c=n.getUint32(e-4)-4*4,o=i.decode(a.slice(e+12,e+12+c)),f=JSON.parse(o);r(f);return}e-=1}}else{console.error("Unknown magic: "+n.getUint32(0)),r();return}},s.readAsArrayBuffer(t)})}function F({mediaLocalPath:t,size:r,isPreview:s,autoPlay:l,hideBrokenImage:a,onBrokenLink:n}){const[i,e]=h.useState(!0);return h.useEffect(()=>{a&&(async()=>{try{if(!(await fetch(s?`/workspace/preview_media?filename=${t}`:`/workspace/view_media?filename=${t}`)).ok)throw new Error("Media not found");e(!0)}catch{e(!1),n==null||n()}})()},[]),i?E(t)?p.jsx(C,{borderRadius:3,boxSize:`${r}px`,objectFit:"cover",src:`/workspace/view_media?filename=${t}`,alt:"workflow image renamed or moved from output folder"}):p.jsx("video",{width:r,height:r,src:`/workspace/view_media?filename=${t}`,loop:!0,autoPlay:l??!1,muted:!0,children:p.jsx("track",{kind:"captions"})}):null}export{R as I,F as M,k as S,$ as a,G as b,O as g,N as i}; +import{G as U,I as C}from"./chunk-JARCRF6W-we4xocqW.js";import{f as x,E as b,j as p,ab as v,r as h}from"./input.js";import{ai as y,h as S,af as E}from"./App-7ZVFJHq5.js";var k=x(function(r,s){const{columns:l,spacingX:a,spacingY:n,spacing:i,minChildWidth:e,...c}=r,o=b(),f=e?A(e,o):M(l);return p.jsx(U,{ref:s,gap:i,columnGap:a,rowGap:n,templateColumns:f,...c})});k.displayName="SimpleGrid";function V(t){return typeof t=="number"?`${t}px`:t}function A(t,r){return y(t,s=>{const l=v("sizes",s,V(s))(r);return s===null?null:`repeat(auto-fit, minmax(${l}, 1fr))`})}function M(t){return y(t,r=>r===null?null:`repeat(${r}, minmax(0, 1fr))`)}var R=S("chevron-right","IconChevronRight",[["path",{d:"M9 6l6 6l-6 6",key:"svg-0"}]]);function O(t){return new Promise((r,s)=>{const l=new FileReader;l.onload=a=>{const n=new Uint8Array(a.target.result),i=new DataView(n.buffer);i.getUint32(0)!==2303741511&&(console.error("Not a valid PNG file"),s());let e=8;const c={};for(;eString.fromCharCode(w)).join("");c[g]=m}e+=12+o}r(c)},l.readAsArrayBuffer(t)})}function _(t){const r=new Uint16Array(t.slice(0,2))[0]===18761;function s(i,e,c){const o=t.slice(i,i+c);if(c===2)return new DataView(o.buffer,o.byteOffset,o.byteLength).getUint16(0,e);if(c===4)return new DataView(o.buffer,o.byteOffset,o.byteLength).getUint32(0,e)}const l=s(4,r,4);function a(i){const e=s(i,r,2),c={};for(let o=0;o{const s=new FileReader;s.onload=l=>{var c;const a=new Uint8Array((c=l==null?void 0:l.target)==null?void 0:c.result),n=new DataView(a.buffer);if(n.getUint32(0)!==1380533830||n.getUint32(8)!==1464156752){console.error("Not a valid WEBP file"),r();return}let i=12;const e={};for(;i{const s=new FileReader;s.onload=l=>{const a=new Uint8Array(l.target.result),n=new DataView(a.buffer),i=new TextDecoder;if(n.getUint32(0)==440786851){let e=12;for(;e>8*(4-f)&~(1<<7*f),g=i.decode(a.slice(e+2+f,e+2+f+u)),d=JSON.parse(g);r(d);return}}e+=1}}else if(n.getUint32(4)==1718909296&&n.getUint32(8)==1769172845){let e=a.length-4;for(;e>16;){if(n.getUint32(e)==1684108385&&n.getUint32(e-8)==2841865588){n.getUint32(e+4),n.getUint32(e+8);const c=n.getUint32(e-4)-4*4,o=i.decode(a.slice(e+12,e+12+c)),f=JSON.parse(o);r(f);return}e-=1}}else{console.error("Unknown magic: "+n.getUint32(0)),r();return}},s.readAsArrayBuffer(t)})}function F({mediaLocalPath:t,size:r,isPreview:s,autoPlay:l,hideBrokenImage:a,onBrokenLink:n}){const[i,e]=h.useState(!0);return h.useEffect(()=>{a&&(async()=>{try{if(!(await fetch(s?`/workspace/preview_media?filename=${t}`:`/workspace/view_media?filename=${t}`)).ok)throw new Error("Media not found");e(!0)}catch{e(!1),n==null||n()}})()},[]),i?E(t)?p.jsx(C,{borderRadius:3,boxSize:`${r}px`,objectFit:"cover",src:`/workspace/view_media?filename=${t}`,alt:"workflow image renamed or moved from output folder"}):p.jsx("video",{width:r,height:r,src:`/workspace/view_media?filename=${t}`,loop:!0,autoPlay:l??!1,muted:!0,children:p.jsx("track",{kind:"captions"})}):null}export{R as I,F as M,k as S,$ as a,G as b,O as g,N as i}; diff --git a/dist/workspace_web/ModelManagerTopbar-aMEaROu7.js b/dist/workspace_web/ModelManagerTopbar-aMEaROu7.js new file mode 100644 index 0000000..1ae3dba --- /dev/null +++ b/dist/workspace_web/ModelManagerTopbar-aMEaROu7.js @@ -0,0 +1,7 @@ +import{f as $,r as g,j as n,g as O,e as re,a4 as X,b as Ye,o as _e,k as be,l as qe,ac as Qe,h as T,a9 as ae,ad as Je,N as Ie,ae as Xe,Q as ke,S as Ce,T as Ze,Z as et,M as tt,O as st,R as nt,P as ot,_ as it}from"./input.js";import{aj as rt,ai as at,_ as lt,ak as Y,o as W,B as oe,F as K,l as F,m as ie,al as Le,am as me,aa as Ee,k as Z,z as ct,H as B,n as ee,an as Te,j as Ae,ao as Ne,$ as dt,a0 as ht,a1 as ut,a2 as ft,a3 as pt,ap as Fe,aq as te,ah as Pe,ar as mt,as as gt,ab as xt,at as yt,au as vt}from"./App-7ZVFJHq5.js";import{I as De,G as wt,C as Mt}from"./chunk-JARCRF6W-we4xocqW.js";import{app as U}from"/scripts/app.js";import{api as J}from"/scripts/api.js";var Oe=$(function(e,s){const{spacing:o="0.5rem",spacingX:i,spacingY:r,children:a,justify:c,direction:l,align:h,className:d,shouldWrapChildren:f,...u}=e,m=g.useMemo(()=>f?g.Children.map(a,(p,x)=>n.jsx(le,{children:p},x)):a,[a,f]);return n.jsx(O.div,{ref:s,className:re("chakra-wrap",d),...u,children:n.jsx(O.ul,{className:"chakra-wrap__list",__css:{display:"flex",flexWrap:"wrap",justifyContent:c,alignItems:h,flexDirection:l,listStyleType:"none",gap:o,columnGap:i,rowGap:r,padding:"0"},children:m})})});Oe.displayName="Wrap";var le=$(function(e,s){const{className:o,...i}=e;return n.jsx(O.li,{ref:s,__css:{display:"flex",alignItems:"flex-start"},className:re("chakra-wrap__listitem",o),...i})});le.displayName="WrapItem";function ge(t){return at(t,e=>e==="auto"?"auto":`span ${e}/span ${e}`)}var ze=$(function(e,s){const{area:o,colSpan:i,colStart:r,colEnd:a,rowEnd:c,rowSpan:l,rowStart:h,...d}=e,f=rt({gridArea:o,gridColumn:ge(i),gridRow:ge(l),gridColumnStart:r,gridColumnEnd:a,gridRowStart:h,gridRowEnd:c});return n.jsx(O.div,{ref:s,__css:f,...d})});ze.displayName="GridItem";function St(t,e,s){return(t-e)*100/(s-e)}X({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});X({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var jt=X({"0%":{left:"-40%"},"100%":{left:"100%"}}),_t=X({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function bt(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,kt]=Ye({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Ct=$((t,e)=>{const{min:s,max:o,value:i,isIndeterminate:r,role:a,...c}=t,l=bt({value:i,min:s,max:o,isIndeterminate:r,role:a}),d={height:"100%",...kt().filledTrack};return n.jsx(O.div,{ref:e,style:{width:`${l.percent}%`,...c.style},...l.bind,...c,__css:d})}),Be=$((t,e)=>{var s;const{value:o,min:i=0,max:r=100,hasStripe:a,isAnimated:c,children:l,borderRadius:h,isIndeterminate:d,"aria-label":f,"aria-labelledby":u,"aria-valuetext":m,title:p,role:x,...y}=_e(t),v=be("Progress",t),j=h??((s=v.track)==null?void 0:s.borderRadius),_={animation:`${_t} 1s linear infinite`},P={...!d&&a&&c&&_,...d&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${jt} 1s ease infinite normal none running`}},k={overflow:"hidden",position:"relative",...v.track};return n.jsx(O.div,{ref:e,borderRadius:j,__css:k,...y,children:n.jsxs(It,{value:v,children:[n.jsx(Ct,{"aria-label":f,"aria-labelledby":u,"aria-valuetext":m,min:i,max:r,value:o,isIndeterminate:d,css:P,borderRadius:j,title:p,role:x}),l]})})});Be.displayName="Progress";var We=$(function(e,s){const{children:o,placeholder:i,className:r,...a}=e;return n.jsxs(O.select,{...a,ref:s,className:re("chakra-select",r),children:[i&&n.jsx("option",{value:"",children:i}),o]})});We.displayName="SelectField";function Lt(t,e){const s={},o={};for(const[i,r]of Object.entries(t))e.includes(i)?s[i]=r:o[i]=r;return[s,o]}var q=$((t,e)=>{var s;const o=be("Select",t),{rootProps:i,placeholder:r,icon:a,color:c,height:l,h,minH:d,minHeight:f,iconColor:u,iconSize:m,...p}=_e(t),[x,y]=Lt(p,Qe),v=lt(y),j={width:"100%",height:"fit-content",position:"relative",color:c},_={paddingEnd:"2rem",...o.field,_focus:{zIndex:"unset",...(s=o.field)==null?void 0:s._focus}};return n.jsxs(O.div,{className:"chakra-select__wrapper",__css:j,...x,...i,children:[n.jsx(We,{ref:e,height:h??l,minH:d??f,placeholder:r,...v,__css:_,children:t.children}),n.jsx(Re,{"data-disabled":qe(v.disabled),...(u||c)&&{color:u||c},__css:o.icon,...m&&{fontSize:m},children:a})]})});q.displayName="Select";var Et=t=>n.jsx("svg",{viewBox:"0 0 24 24",...t,children:n.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),Tt=O("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),Re=t=>{const{children:e=n.jsx(Et,{}),...s}=t,o=g.cloneElement(e,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return n.jsx(Tt,{...s,className:"chakra-select__icon-wrapper",children:g.isValidElement(e)?o:null})};Re.displayName="SelectIcon";function G(t){return Array.isArray?Array.isArray(t):Ge(t)==="[object Array]"}const At=1/0;function Nt(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 D(t){return typeof t=="string"}function Ke(t){return typeof t=="number"}function Ft(t){return t===!0||t===!1||function(e){return function(s){return typeof s=="object"}(e)&&e!==null}(t)&&Ge(t)=="[object Boolean]"}function N(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 Pt=t=>`Missing ${t} property in key`,Dt=t=>`Property 'weight' in key '${t}' must be a positive integer`,xe=Object.prototype.hasOwnProperty;class Ot{constructor(e){this._keys=[],this._keyMap={};let s=0;e.forEach(o=>{let i=$e(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 $e(t){let e=null,s=null,o=null,i=1,r=null;if(D(t)||G(t))o=t,e=ye(t),s=ve(t);else{if(!xe.call(t,"name"))throw new Error(Pt("name"));const a=t.name;if(o=a,xe.call(t,"weight")&&(i=t.weight,i<=0))throw new Error(Dt(a));e=ye(a),s=ve(a),r=t.getFn}return{path:e,id:s,weight:i,src:o,getFn:r}}function ye(t){return G(t)?t:t.split(".")}function ve(t){return G(t)?t.join("."):t}var S={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx{if(N(r))if(a[c]){const l=r[a[c]];if(!N(l))return;if(c===a.length-1&&(D(l)||Ke(l)||Ft(l)))s.push(Nt(l));else if(G(l)){o=!0;for(let h=0,d=l.length;h{this._keysMap[s.id]=o})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,D(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();D(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(N(a)){if(G(a)){let c=[];const l=[{nestedArrIndex:-1,value:a}];for(;l.length;){const{nestedArrIndex:h,value:d}=l.pop();if(N(d))if(D(d)&&!se(d)){let f={v:d,i:h,n:this.norm.get(d)};c.push(f)}else G(d)&&d.forEach((f,u)=>{l.push({nestedArrIndex:u,value:f})})}o.$[r]=c}else if(D(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 Ve(t,e,{getFn:s=S.getFn,fieldNormWeight:o=S.fieldNormWeight}={}){const i=new ce({getFn:s,fieldNormWeight:o});return i.setKeys(t.map($e)),i.setSources(e),i.create(),i}function Q(t,{errors:e=0,currentLocation:s=0,expectedLocation:o=0,distance:i=S.distance,ignoreLocation:r=S.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 R=32;function Bt(t,e,s,{location:o=S.location,distance:i=S.distance,threshold:r=S.threshold,findAllMatches:a=S.findAllMatches,minMatchCharLength:c=S.minMatchCharLength,includeMatches:l=S.includeMatches,ignoreLocation:h=S.ignoreLocation}={}){if(e.length>R)throw new Error(`Pattern length exceeds max of ${R}.`);const d=e.length,f=t.length,u=Math.max(0,Math.min(o,f));let m=r,p=u;const x=c>1||l,y=x?Array(f):[];let v;for(;(v=t.indexOf(e,p))>-1;){let k=Q(e,{currentLocation:v,expectedLocation:u,distance:i,ignoreLocation:h});if(m=Math.min(k,m),p=v+d,x){let C=0;for(;C=z;M-=1){let b=M-1,I=s[t.charAt(b)];if(x&&(y[b]=+!!I),w[M]=(w[M+1]<<1|1)&I,k&&(w[M]|=(j[M+1]|j[M])<<1|1|j[M+1]),w[M]&V&&(_=Q(e,{errors:k,currentLocation:b,expectedLocation:u,distance:i,ignoreLocation:h}),_<=m)){if(m=_,p=b,p<=u)break;z=Math.max(1,2*u-p)}}if(Q(e,{errors:k+1,currentLocation:u,expectedLocation:u,distance:i,ignoreLocation:h})>m)break;j=w}const P={isMatch:p>=0,score:Math.max(.001,_)};if(x){const k=function(C=[],L=S.minMatchCharLength){let z=[],E=-1,w=-1,M=0;for(let b=C.length;M=L&&z.push([E,w]),E=-1)}return C[M-1]&&M-E>=L&&z.push([E,M-1]),z}(y,c);k.length?l&&(P.indices=k):P.isMatch=!1}return P}function Wt(t){let e={};for(let s=0,o=t.length;s{this.chunks.push({pattern:u,alphabet:Wt(u),startIndex:m})},f=this.pattern.length;if(f>R){let u=0;const m=f%R,p=f-m;for(;u{const{isMatch:v,score:j,indices:_}=Bt(e,p,x,{location:i+y,distance:r,threshold:a,findAllMatches:c,minMatchCharLength:l,includeMatches:o,ignoreLocation:h});v&&(u=!0),f+=j,v&&_&&(d=[...d,..._])});let m={isMatch:u,score:u?f/this.chunks.length:1};return u&&o&&(m.indices=d),m}}const we=[];function Me(t,e){for(let s=0,o=we.length;s{if(!N(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 Gt(t,e){e.score=t.score}class H{constructor(e,s={},o){if(this.options={...S,...s},this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new Ot(this.options.keys),this.setCollection(e,o)}setCollection(e,s){if(this._docs=e,s&&!(s instanceof ce))throw new Error("Incorrect 'index' type");this._myIndex=s||Ve(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){N(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:m,norm:p,score:x})=>{const y=m?m.weight:null;u*=Math.pow(x===0&&y?Number.EPSILON:x,(y||1)*(d?1:p))}),f.score=u})}(l,{ignoreFieldNorm:c}),r&&l.sort(a),Ke(s)&&s>-1&&(l=l.slice(0,s)),function(h,d,{includeMatches:f=S.includeMatches,includeScore:u=S.includeScore}={}){const m=[];return f&&m.push(Kt),u&&m.push(Gt),h.map(p=>{const{idx:x}=p,y={item:d[x],refIndex:x};return m.length&&m.forEach(v=>{v(p,y)}),y})}(l,this._docs,{includeMatches:o,includeScore:i})}_searchStringList(e){const s=Me(e,this.options),{records:o}=this._myIndex,i=[];return o.forEach(({v:r,i:a,n:c})=>{if(!N(r))return;const{isMatch:l,score:h,indices:d}=s.searchIn(r);l&&i.push({item:r,idx:a,matches:[{score:h,value:r,norm:c,indices:d}]})}),i}_searchLogical(e){throw new Error("Logical search is not available")}_searchObjectList(e){const s=Me(e,this.options),{keys:o,records:i}=this._myIndex,r=[];return i.forEach(({$:a,i:c})=>{if(!N(a))return;let l=[];o.forEach((h,d)=>{l.push(...this._findMatches({key:h,value:a[d],searcher:s}))}),l.length&&r.push({idx:c,item:a,matches:l})}),r}_findMatches({key:e,value:s,searcher:o}){if(!N(s))return[];let i=[];if(G(s))s.forEach(({v:r,i:a,n:c})=>{if(!N(r))return;const{isMatch:l,score:h,indices:d}=o.searchIn(r);l&&i.push({score:h,key:e,value:r,idx:a,norm:c,indices:d})});else{const{v:r,n:a}=s,{isMatch:c,score:l,indices:h}=o.searchIn(r);c&&i.push({score:l,key:e,value:r,norm:a,indices:h})}return i}}H.version="7.0.0",H.createIndex=Ve,H.parseIndex=function(t,{getFn:e=S.getFn,fieldNormWeight:s=S.fieldNormWeight}={}){const{keys:o,records:i}=t,r=new ce({getFn:e,fieldNormWeight:s});return r.setKeys(o),r.setIndexRecords(i),r},H.config=S;function $t({selectedModel:t,setSelectedModel:e,modelTypeList:s}){const o=i=>{e(i)};return n.jsx(Oe,{children:s.map(i=>n.jsx(le,{children:n.jsx(T,{colorScheme:"blue",variant:t===i?"solid":"outline",onClick:()=>o(i),size:"sm",children:i})},i))})}const Vt={checkpoints:"CheckpointLoaderSimple",vae:"VAELoader",loras:"LoraLoader",controlnet:"ControlNetLoader",upscale_models:"UpscaleModelLoader"};function Ht({data:t}){const[e,s]=g.useState("https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/27fd7433-cb0a-4a87-88c1-21ccb2b1a842/width=450/00060-881622046.jpeg"),[o,i]=g.useState(!t.file_hash),[r,a]=g.useState();g.useEffect(()=>{i(!t.file_hash),c()},[t.file_hash]);const c=async()=>{var d,f,u,m;const h=await Y.models.get(t.model_name+"@"+t.model_type);if(h!=null&&(a(h),(d=h.imageUrl)!=null&&d.length&&s(h.imageUrl)),t.file_hash!=null)try{const p=`https://civitai.com/api/v1/model-versions/by-hash/${t.file_hash}`,y=await(await fetch(p)).json();let v;if(await((f=W)==null?void 0:f.getSetting("showNsfwModelThumbnail"))===!0)v=(m=(u=y==null?void 0:y.images)==null?void 0:u[0])==null?void 0:m.url;else if(!y.model.nsfw){const A=y.images.find(V=>V.nsfw==="None");v=A==null?void 0:A.url}v&&s(v);const _={id:t.model_name+"@"+t.model_type,fileHash:t.file_hash,fileFolder:t.model_type,fileName:t.model_name+t.model_extension,modelName:y.model.name,civitModelID:String(y.modelId),civitModelVersionID:String(y.id),imageUrl:v??null};Y.models.put(_),a(_)}catch{}t.preview&&s(t.preview)},l=h=>{const d=Vt[t.model_type];d&&(h.dataTransfer.setData("eventName","WorkspaceManagerAddNode"),h.dataTransfer.setData("modelRelativePath",t.model_name+t.model_extension),h.dataTransfer.setData("nodeType",d))};return n.jsxs(oe,{children:[n.jsxs(oe,{position:"relative",borderRadius:4,draggable:!0,onDragStart:l,children:[o?n.jsx(K,{bg:"rgba(0, 0, 0, 0.5)",height:178,justifyContent:"center",alignItems:"center",children:n.jsx(ae,{})}):n.jsx(De,{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(F,{position:"absolute",bottom:"0",left:"0",right:"0",color:"white",fontSize:14})]}),n.jsx(ie,{label:t.date.toLocaleDateString(),children:n.jsx(F,{textAlign:"center",p:"1",fontSize:14,noOfLines:2,children:(r==null?void 0:r.modelName)??t.model_name})})]})}function Ut({list:t}){return n.jsx(wt,{templateColumns:"repeat(3, minmax(0, 1fr))",gap:1,marginTop:2,children:t.map(e=>n.jsx(ze,{children:n.jsx(Ht,{data:e})},e.model_name+e.date.getTime()))})}const Yt=async t=>{try{const s=await(await J.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 Se(t,e=1){const i=t/1024;return i>=1024?(i/1024).toFixed(e)+" GB":i.toFixed(e)+" MB"}function je(t,e){if(!t||t.length===0)return;let s=t.find(o=>o.nsfw==="None");return e&&(s=s??t[0]),s}function qt(t,e=280,s){var o,i,r,a;if(t)return Le(t)?(r=je((i=(o=t.modelVersions)==null?void 0:o.at(0))==null?void 0:i.images,s))==null?void 0:r.url:`https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/${(a=je(t.images,s))==null?void 0:a.url}/width=${e}/`}const ne=280;function Qt({model:t,onClickInstallModel:e,installing:s}){var u,m;const[o,i]=g.useState();g.useEffect(()=>{p();async function p(){var y;const x=await((y=W)==null?void 0:y.getSetting("showNsfwModelThumbnail"));i(qt(t,ne,x))}},[t]);const r=Le(t)?t.modelVersions:t.versions,[a,c]=g.useState(((u=r==null?void 0:r[0])==null?void 0:u.name)??""),l=r==null?void 0:r.find(p=>(p==null?void 0:p.name)===a),h=()=>{window.open(`https://civitai.com/models/${t.id}`)},d=g.useCallback(()=>{if(l==null){console.error("no file is find by name",a);return}e(me(l,t.name),t)},[a]),f=(m=me(l))==null?void 0:m.sizeKB;return n.jsxs(Ee,{width:ne,justifyContent:"space-between",mb:2,gap:1,children:[n.jsx(De,{borderRadius:3,boxSize:ne+"px",objectFit:"cover",src:o,alt:"model cover image",cursor:"pointer",onClick:()=>h()}),n.jsxs(Z,{p:1,children:[n.jsx(ie,{label:t.name,children:n.jsx(F,{fontWeight:500,noOfLines:1,children:t.name})}),n.jsxs(K,{justifyContent:"space-between",alignItems:"center",children:[n.jsx(T,{borderRadius:14,noOfLines:1,size:"xs",colorScheme:"teal",maxWidth:"40%",flexShrink:1,variant:"outline",px:1,cursor:"text",children:n.jsx(F,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:t.type})}),n.jsx(T,{leftIcon:n.jsx(ct,{size:18}),iconSpacing:1,borderRadius:10,size:"sm",py:1,colorScheme:"teal",type:"submit",onClick:()=>d(),isDisabled:!!(a&&s.includes(a)),children:"Install"})]}),n.jsxs(B,{children:[n.jsx(q,{size:"md",style:{paddingLeft:4},onChange:p=>{c(p.target.value)},children:r==null?void 0:r.map(p=>{const x=p==null?void 0:p.name;return x?n.jsx("option",{value:x,style:{padding:0},children:x},p.id):null})}),f&&n.jsx(ie,{label:Se(f),children:n.jsx(F,{flexShrink:1,noOfLines:1,width:"40%",children:Se(f)})})]})]})]})}function Jt({searchQuery:t,setSearchQuery:e,onSearch:s}){return n.jsxs(K,{gap:1,alignItems:"center",grow:1,children:[n.jsx(ee,{placeholder:"Search models in CivitAI",width:"60%",value:t,onChange:o=>e(o.target.value),onKeyUp:o=>{o.code==="Enter"&&s()}}),n.jsx(T,{size:"sm",onClick:()=>s(),colorScheme:"teal",children:"Search"})]})}function Xt({isOpen:t,fileSelected:e,onClose:s,selectFolder:o}){const[i,r]=g.useState(""),[a,c]=g.useState([]),[l,h]=g.useState(""),d=g.useRef(null);g.useEffect(()=>{f()},[]);const f=async()=>{const u=await Te();u&&(["custom_nodes","config","saved_prompts"].forEach(m=>{delete u[m]}),c(Object.values(u).flatMap(m=>m)))};return n.jsx(Je,{isOpen:t,leastDestructiveRef:d,onClose:s,children:n.jsx(Ie,{children:n.jsxs(Xe,{children:[n.jsx(ke,{fontSize:"lg",fontWeight:"bold",children:"Choose Folder"}),n.jsx(Ce,{children:n.jsxs(Z,{spacing:4,children:[!e&&n.jsxs(n.Fragment,{children:[n.jsx(F,{children:"Model download url"}),n.jsx(ee,{placeholder:"https://civitai.com/api/download/models/311399",onChange:u=>h(u.target.value),value:l})]}),n.jsx(F,{children:"Choose model install folder"}),n.jsx(q,{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(T,{ref:d,onClick:s,children:"Cancel"}),n.jsx(T,{onClick:()=>o(i,l),ml:3,isDisabled:l.length===0,children:"Confirm"})]})]})})})}function Zt(){const{colorMode:t}=et(),e=Ae(),[s,o]=g.useState([]);return g.useEffect(()=>{J.addEventListener("download_progress",i=>{o(i.detail)}),J.addEventListener("download_error",i=>{e({title:"Download Error",description:i.detail,status:"error",duration:4e3,isClosable:!0})})},[]),n.jsx(Z,{spacing:5,pos:"absolute",bottom:"0",left:"0",width:"50%",zIndex:80,backgroundColor:t==="light"?"white":"#242424",paddingX:5,children:s.map(({save_path:i,progress:r})=>n.jsxs(B,{children:[n.jsx(F,{fontSize:16,width:"40%",children:i.replace(/^.*[\\/]/,"")}),n.jsx(Be,{isIndeterminate:!r,hasStripe:!0,width:"50%",value:r}),n.jsxs(F,{fontSize:16,width:"10%",children:[r.toFixed(1),"%"]})]},i))})}const He="WORKSPACE_CIVIT_API_KEY_STORAGE_KEY";function es(){return localStorage.getItem(He)}function ts(t){localStorage.setItem(He,t)}function ss(){const[t,e]=g.useState(""),{onOpen:s,onClose:o,isOpen:i}=Ne(),r=()=>{ts(t),o()};return n.jsxs(dt,{isOpen:i,onOpen:s,onClose:o,placement:"right",closeOnBlur:!1,children:[n.jsx(ht,{children:n.jsx(T,{size:"sm",py:1,mr:8,children:"Set Civitai API Key"})}),n.jsxs(ut,{p:5,children:[n.jsx(ft,{}),n.jsx(pt,{}),n.jsxs(Z,{spacing:4,children:[n.jsx(F,{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(ee,{value:t,onChange:a=>e(a.target.value),placeholder:"API Key"}),n.jsx(T,{size:"sm",py:1,mr:8,onClick:r,children:"Save"})]})]})]})}async function ns(t,e){var a,c;const s={queries:[{q:t,indexUid:"models_v5",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 os({onclose:t,searchQuery:e="",modelType:s}){const[o,i]=g.useState([]),[r,a]=g.useState(!1),[c,l]=g.useState(s),h=Ae(),[d,f]=g.useState([]),[u,m]=g.useState(e),{isOpen:p,onOpen:x,onClose:y}=Ne(),[v,j,_]=Fe(),[A,V]=g.useState({}),[P,k]=g.useState(te),C=g.useCallback(async()=>{var I;a(!0);const w=await ns(u,c);i(w);const M=await Te();M&&V(M);const b=await((I=W)==null?void 0:I.getSetting("defaultFolders"));b&&k(b),a(!1)},[u,c]),L=(w,M)=>{var he,ue,fe,pe;if(!((he=_.current)!=null&&he.id)&&!M){console.error("no url to download");return}let b=M??`https://civitai.com/api/download/models/${(ue=_.current)==null?void 0:ue.id}`,I=(fe=_.current)==null?void 0:fe.name;if(!I&&(I=b.split("/").pop(),!I)){console.error("downloadUrl is malformed");return}h({title:"Installing...",description:I,status:"info",duration:4e3,isClosable:!0}),I!=null&&f(Ue=>[...Ue,I??""]);const de=es();de&&(b+=`?token=${de}`),Yt({file_hash:(pe=_.current)==null?void 0:pe.SHA256,filename:I,save_path:w,url:b}),j(void 0),y()},z=async(w,M)=>{const b=P[M.type];j(w),b==null?x():L(b)},E=async(w,M)=>{var I;const b={...P,[w]:M};await((I=W)==null?void 0:I.upsert({defaultFolders:b})),k(b)};return g.useEffect(()=>{C()},[c]),n.jsxs(n.Fragment,{children:[n.jsxs(tt,{isOpen:!0,onClose:t,blockScrollOnMount:!0,children:[n.jsx(Ie,{}),n.jsxs(st,{width:"90%",maxWidth:"90vw",height:"90vh",children:[n.jsxs(ke,{pb:1,children:[n.jsxs(B,{gap:2,mb:2,alignItems:"center",children:[n.jsx(Pe,{size:"md",mr:2,children:"Models"}),n.jsx(Jt,{searchQuery:u,setSearchQuery:m,onSearch:C}),n.jsx(T,{size:"sm",py:1,mr:8,onClick:x,children:"Custom URL Install"}),n.jsx(ss,{})]}),n.jsxs(B,{gap:2,wrap:"wrap",children:[n.jsx(T,{size:"sm",py:1,onClick:()=>{l(void 0)},isActive:c==null,children:"All"}),mt.map(w=>n.jsx(T,{size:"sm",py:1,isActive:c===w,onClick:()=>{l(w)},children:w},w)),c&&A[te[c]]&&n.jsxs(B,{ml:"auto",children:[n.jsx(F,{fontSize:17,whiteSpace:"nowrap",children:"Default Download Folder:"}),n.jsx(q,{value:P[c],onChange:w=>E(c,w.target.value),children:A[te[c]].map(w=>n.jsx("option",{value:w,children:w}))})]})]}),r&&n.jsx(ae,{thickness:"4px",emptyColor:"gray.200",color:"pink.500",size:"lg"})]}),n.jsx(nt,{}),n.jsxs(Ce,{overflowY:"auto",children:[n.jsx(B,{wrap:"wrap",children:o==null?void 0:o.map(w=>n.jsx(Qt,{model:w,onClickInstallModel:z,installing:d},w.id))}),n.jsx(Zt,{})]})]})]}),n.jsx(Xt,{fileSelected:!!v,isOpen:p,onClose:y,selectFolder:(w,M)=>{L(w,_.current?void 0:M)}})]})}function is(){const[t,e]=g.useState(!1);return n.jsxs(n.Fragment,{children:[n.jsx(T,{size:"sm",colorScheme:"teal",onClick:()=>e(!0),children:"Install Models"}),t&&n.jsx(os,{modelType:"Checkpoint",onclose:()=>e(!1)})]})}const rs=()=>{const[t,e]=g.useState(["checkpoints"]),[s,o]=g.useState([]),[i,r]=g.useState(!0);g.useEffect(()=>{a(),J.addEventListener("model_list",l=>{c(l.detail)})},[]);const a=async()=>{const l=await gt();c(l)},c=async l=>{if(!l)return;r(!1);const h=Array.from(new Set(l.map(f=>f.model_type))),d=h.indexOf("checkpoints");d>=0&&h.splice(d,1),h.unshift("checkpoints"),e(h),o(l.map(f=>({...f,date:new Date(f.date*1e3)})))};return{modelTypeList:t,modelsList:s,loading:i}};function as(){const[t,e,s]=Fe(!1),o=()=>{var c;(c=W)==null||c.getSetting("showNsfwModelThumbnail").then(l=>{e(l??!1)})};g.useEffect(()=>{o()},[]);const i=c=>{var h;const l=c.target.checked;(h=W)==null||h.upsert({showNsfwModelThumbnail:l}).then(()=>{o(),r(),window.dispatchEvent(new Event("showNsfwModelThumbnail"))})},r=async()=>{const c=await Y.models.toArray();for(let l=0;l{var l,h;try{const d=`https://civitai.com/api/v1/model-versions/by-hash/${c.fileHash}`,u=await(await fetch(d)).json();let m;if(s.current)m=(h=(l=u==null?void 0:u.images)==null?void 0:l[0])==null?void 0:h.url;else if(!u.model.nsfw){const p=u.images.find(x=>x.nsfw==="None");m=p==null?void 0:p.url}Y.models.update(c.id,{imageUrl:m??null})}catch{}};return n.jsx(Mt,{isChecked:t,onChange:i,children:"Show NSFW"})}function ls({onClose:t}){const[e,s]=g.useState("checkpoints"),[o,i]=g.useState(""),[r,a]=g.useState("name"),{loading:c,modelTypeList:l,modelsList:h}=rs(),[d,f]=g.useState([]),[u,m]=g.useState([]);g.useEffect(()=>{x();async function x(){const y=await Y.models.toArray();f(h.map(v=>({...v,db:y.find(j=>j.id===v.model_name+"@"+v.model_type)})))}},[h]),g.useEffect(()=>{let x=[];o.length?x=new H(d,{keys:["model_name","db.modelName"]}).search(o).map(j=>j.item):x=h.filter(y=>y.model_type===e).sort((y,v)=>r==="name"?y.model_name.localeCompare(v.model_name):v.date.getTime()-y.date.getTime()),m(x)},[e,h,o,r,d]),g.useEffect(()=>(U.canvasEl.addEventListener("click",t),()=>{U.canvasEl.removeEventListener("click",t)}),[t]);const p=440;return n.jsx(ot,{children:n.jsx(oe,{style:{width:p},children:n.jsxs(Ee,{width:p,height:"100vh",p:4,gap:2,position:"fixed",top:0,left:0,shadow:"xl",zIndex:xt,overflowY:"auto",children:[n.jsxs(K,{justifyContent:"space-between",alignContent:"center",py:3,children:[n.jsx(Pe,{size:"md",mr:2,children:"Models"}),n.jsx(is,{})]}),n.jsx(K,{gap:4,justifyContent:"center",alignItems:"center",mb:1,children:n.jsx(ee,{size:"sm",placeholder:"Search",value:o,onChange:x=>i(x.target.value)})}),n.jsxs(K,{gap:4,justifyContent:"space-between",alignItems:"center",mb:1,children:[!o.length&&n.jsxs(B,{children:[n.jsx("span",{children:"Sort By"}),n.jsxs(q,{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(as,{})]}),!o.length&&n.jsx($t,{modelTypeList:l,setSelectedModel:s,selectedModel:e}),n.jsx(Ut,{list:u}),c&&n.jsx(K,{justifyContent:"center",alignItems:"center",height:"100%",children:n.jsx(ae,{})})]})})})}const cs=g.lazy(()=>it(()=>import("./InstallMissingModelsButton-h7fGpVGR.js"),__vite__mapDeps([0,1,2,3,4,5,6])));function ds(){const[t,e]=g.useState(!1),[s,o]=g.useState(),i=async a=>{if(a.dataTransfer.getData("eventName")!=="WorkspaceManagerAddNode")return;const l=a.dataTransfer.getData("modelRelativePath"),h=a.dataTransfer.getData("nodeType"),d=LiteGraph.createNode(h);d.pos=[a.canvasX,a.canvasY],d.configure({widgets_values:[l]}),U.graph.add(d)};g.useEffect(()=>{var a;return(a=W)==null||a.getSetting("modelManagerTopBarStyle").then(c=>{r(c,!1)}),U.canvasEl.addEventListener("drop",i),()=>{U.canvasEl.removeEventListener("drop",i)}},[]);const r=(a,c=!1)=>{var j;const{top:l=0,right:h=0}=s||{},{top:d=0,right:f=0}=a??{};let u=l+d,m=s===void 0?f:h-f;const p=document.documentElement.clientWidth,x=document.documentElement.clientHeight,y=document.getElementById("modelManagerTopBar"),v=(y==null?void 0:y.offsetWidth)||224;u+32>x&&(u=x-38),m+v>p&&(m=p-v-4),o({top:Math.max(4,u),right:Math.max(4,m)}),c&&((j=W)==null||j.upsert({modelManagerTopBarStyle:{top:u,right:m}}))};return n.jsx(yt,{onDragEnd:a=>{r({top:a.y,right:a.x},!0)},dragIconId:"dragModelManagerTopBarIcon",children:s?n.jsxs(B,{style:{position:"fixed",...s},gap:2,draggable:!1,id:"modelManagerTopBar",className:"model-manager-top-bar",children:[n.jsx(vt,{id:"dragModelManagerTopBarIcon",className:"drag-model-manager-top-bar-icon",cursor:"move",size:15,color:"#FFF"}),n.jsx(cs,{}),n.jsx(T,{size:"sm",colorScheme:"blue","aria-label":"My models",onClick:()=>e(!0),px:1,children:"Models"}),t&&n.jsx(ls,{onClose:()=>e(!1)})]}):""})}const gs=Object.freeze(Object.defineProperty({__proto__:null,default:ds},Symbol.toStringTag,{value:"Module"}));export{ze as G,is as I,gs as M,ns as g}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["workspace_web/InstallMissingModelsButton-h7fGpVGR.js","workspace_web/input.js","workspace_web/App-7ZVFJHq5.js","workspace_web/assets/App-JXePnJiV.css","workspace_web/chunk-NTCQBYKE-qydYN07M.js","workspace_web/chunk-JARCRF6W-we4xocqW.js","workspace_web/index-pz0vT7Or.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/workspace_web/ModelManagerTopbar-yJwd9tK5.js b/dist/workspace_web/ModelManagerTopbar-yJwd9tK5.js deleted file mode 100644 index 791f5b7..0000000 --- a/dist/workspace_web/ModelManagerTopbar-yJwd9tK5.js +++ /dev/null @@ -1,7 +0,0 @@ -import{f as P,r as u,j as e,g as T,e as V,a4 as z,b as Ee,o as re,k as le,l as Pe,ac as Ae,h as _,a9 as $,ad as De,N as ce,ae as Le,Q as de,S as ue,T as Ne,Z as Be,M as Fe,O as Re,R as ze,P as Oe,_ as We}from"./input.js";import{aj as Ge,ai as Ke,_ as He,ak as F,o as k,F as A,l as I,B as he,al as pe,am as se,aa as me,k as O,m as ne,z as Ve,H as E,n as W,an as fe,j as ge,ao as xe,$ as $e,a0 as Ue,a1 as Ye,a2 as qe,a3 as Qe,ap as je,aq as K,ah as ve,ar as Xe,as as Ze,ab as Je,at as et,au as tt}from"./App-bwnmchpl.js";import{I as ye,G as st,C as nt}from"./chunk-JARCRF6W-yJJssWqi.js";import{app as N}from"/scripts/app.js";import{api as R}from"/scripts/api.js";var we=P(function(s,n){const{spacing:a="0.5rem",spacingX:i,spacingY:o,children:r,justify:l,direction:c,align:d,className:p,shouldWrapChildren:g,...h}=s,m=u.useMemo(()=>g?u.Children.map(r,(f,v)=>e.jsx(U,{children:f},v)):r,[r,g]);return e.jsx(T.div,{ref:n,className:V("chakra-wrap",p),...h,children:e.jsx(T.ul,{className:"chakra-wrap__list",__css:{display:"flex",flexWrap:"wrap",justifyContent:l,alignItems:d,flexDirection:c,listStyleType:"none",gap:a,columnGap:i,rowGap:o,padding:"0"},children:m})})});we.displayName="Wrap";var U=P(function(s,n){const{className:a,...i}=s;return e.jsx(T.li,{ref:n,__css:{display:"flex",alignItems:"flex-start"},className:V("chakra-wrap__listitem",a),...i})});U.displayName="WrapItem";function oe(t){return Ke(t,s=>s==="auto"?"auto":`span ${s}/span ${s}`)}var Se=P(function(s,n){const{area:a,colSpan:i,colStart:o,colEnd:r,rowEnd:l,rowSpan:c,rowStart:d,...p}=s,g=Ge({gridArea:a,gridColumn:oe(i),gridRow:oe(c),gridColumnStart:o,gridColumnEnd:r,gridRowStart:d,gridRowEnd:l});return e.jsx(T.div,{ref:n,__css:g,...p})});Se.displayName="GridItem";function ot(t,s,n){return(t-s)*100/(n-s)}z({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});z({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var at=z({"0%":{left:"-40%"},"100%":{left:"100%"}}),it=z({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function rt(t){const{value:s=0,min:n,max:a,valueText:i,getValueText:o,isIndeterminate:r,role:l="progressbar"}=t,c=ot(s,n,a);return{bind:{"data-indeterminate":r?"":void 0,"aria-valuemax":a,"aria-valuemin":n,"aria-valuenow":r?void 0:s,"aria-valuetext":(()=>{if(s!=null)return typeof o=="function"?o(s,c):i})(),role:l},percent:c,value:s}}var[lt,ct]=Ee({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),dt=P((t,s)=>{const{min:n,max:a,value:i,isIndeterminate:o,role:r,...l}=t,c=rt({value:i,min:n,max:a,isIndeterminate:o,role:r}),p={height:"100%",...ct().filledTrack};return e.jsx(T.div,{ref:s,style:{width:`${c.percent}%`,...l.style},...c.bind,...l,__css:p})}),_e=P((t,s)=>{var n;const{value:a,min:i=0,max:o=100,hasStripe:r,isAnimated:l,children:c,borderRadius:d,isIndeterminate:p,"aria-label":g,"aria-labelledby":h,"aria-valuetext":m,title:f,role:v,...j}=re(t),y=le("Progress",t),M=d??((n=y.track)==null?void 0:n.borderRadius),w={animation:`${it} 1s linear infinite`},L={...!p&&r&&l&&w,...p&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${at} 1s ease infinite normal none running`}},B={overflow:"hidden",position:"relative",...y.track};return e.jsx(T.div,{ref:s,borderRadius:M,__css:B,...j,children:e.jsxs(lt,{value:y,children:[e.jsx(dt,{"aria-label":g,"aria-labelledby":h,"aria-valuetext":m,min:i,max:o,value:a,isIndeterminate:p,css:L,borderRadius:M,title:f,role:v}),c]})})});_e.displayName="Progress";var be=P(function(s,n){const{children:a,placeholder:i,className:o,...r}=s;return e.jsxs(T.select,{...r,ref:n,className:V("chakra-select",o),children:[i&&e.jsx("option",{value:"",children:i}),a]})});be.displayName="SelectField";function ut(t,s){const n={},a={};for(const[i,o]of Object.entries(t))s.includes(i)?n[i]=o:a[i]=o;return[n,a]}var G=P((t,s)=>{var n;const a=le("Select",t),{rootProps:i,placeholder:o,icon:r,color:l,height:c,h:d,minH:p,minHeight:g,iconColor:h,iconSize:m,...f}=re(t),[v,j]=ut(f,Ae),y=He(j),M={width:"100%",height:"fit-content",position:"relative",color:l},w={paddingEnd:"2rem",...a.field,_focus:{zIndex:"unset",...(n=a.field)==null?void 0:n._focus}};return e.jsxs(T.div,{className:"chakra-select__wrapper",__css:M,...v,...i,children:[e.jsx(be,{ref:s,height:d??c,minH:p??g,placeholder:o,...y,__css:w,children:t.children}),e.jsx(Me,{"data-disabled":Pe(y.disabled),...(h||l)&&{color:h||l},__css:a.icon,...m&&{fontSize:m},children:r})]})});G.displayName="Select";var ht=t=>e.jsx("svg",{viewBox:"0 0 24 24",...t,children:e.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),pt=T("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),Me=t=>{const{children:s=e.jsx(ht,{}),...n}=t,a=u.cloneElement(s,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return e.jsx(pt,{...n,className:"chakra-select__icon-wrapper",children:u.isValidElement(s)?a:null})};Me.displayName="SelectIcon";function mt({selectedModel:t,setSelectedModel:s,modelTypeList:n}){const a=i=>{s(i)};return e.jsx(we,{children:n.map(i=>e.jsx(U,{children:e.jsx(_,{colorScheme:"blue",variant:t===i?"solid":"outline",onClick:()=>a(i),size:"sm",children:i})},i))})}const ft={checkpoints:"CheckpointLoaderSimple",vae:"VAELoader",loras:"LoraLoader",controlnet:"ControlNetLoader",upscale_models:"UpscaleModelLoader"};function gt({data:t}){const[s,n]=u.useState("https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/27fd7433-cb0a-4a87-88c1-21ccb2b1a842/width=450/00060-881622046.jpeg"),[a,i]=u.useState(!t.file_hash),[o,r]=u.useState();u.useEffect(()=>{i(!t.file_hash),l()},[t.file_hash]);const l=async()=>{var p,g,h,m;const d=await F.models.get(t.model_name+"@"+t.model_type);if(d!=null)r(d),(p=d.imageUrl)!=null&&p.length&&n(d.imageUrl);else if(t.file_hash!=null)try{const f=`https://civitai.com/api/v1/model-versions/by-hash/${t.file_hash}`,j=await(await fetch(f)).json();let y;if(await((g=k)==null?void 0:g.getSetting("showNsfwModelThumbnail"))===!0)y=(m=(h=j==null?void 0:j.images)==null?void 0:h[0])==null?void 0:m.url;else if(!j.model.nsfw){const w=j.images.find(D=>D.nsfw==="None");y=w==null?void 0:w.url}y&&n(y),F.models.add({id:t.model_name+"@"+t.model_type,fileHash:t.file_hash,fileFolder:t.model_type,fileName:t.model_name+t.model_extension,civitModelID:String(j.modelId),civitModelVersionID:String(j.id),imageUrl:y??null})}catch{}t.preview&&n(t.preview)},c=d=>{const p=ft[t.model_type];p&&(d.dataTransfer.setData("eventName","WorkspaceManagerAddNode"),d.dataTransfer.setData("modelRelativePath",t.model_name+t.model_extension),d.dataTransfer.setData("nodeType",p))};return a?e.jsxs(A,{position:"relative",borderRadius:4,bg:"rgba(0, 0, 0, 0.5)",height:178,justifyContent:"center",alignItems:"center",children:[a&&e.jsx($,{}),e.jsx(I,{position:"absolute",bottom:"0",left:"0",right:"0",bg:"rgba(0, 0, 0, 0.5)",color:"white",textAlign:"center",p:"0",fontSize:12,borderBottomRightRadius:4,borderBottomLeftRadius:4,children:t.model_name})]}):e.jsxs(he,{position:"relative",borderRadius:4,draggable:!0,onDragStart:c,children:[e.jsx(ye,{src:s,draggable:!1,boxSize:"100%",height:178,objectFit:"cover",borderRadius:4,cursor:(o==null?void 0:o.civitModelID)!=null?"pointer":"auto",onClick:()=>{(o==null?void 0:o.civitModelID)==null||(o==null?void 0:o.civitModelVersionID)==null||window.open(`https://civitai.com/models/${o==null?void 0:o.civitModelID}?modelVersionId=${o==null?void 0:o.civitModelVersionID}`)}}),e.jsx(I,{position:"absolute",bottom:"0",left:"0",right:"0",bg:"rgba(0, 0, 0, 0.5)",color:"white",textAlign:"center",p:"0",fontSize:14,borderBottomRightRadius:4,borderBottomLeftRadius:4,children:t.model_name})]})}function xt({list:t}){return e.jsx(st,{templateColumns:"repeat(3, 1fr)",gap:1,marginTop:2,children:t.map(s=>e.jsx(Se,{children:e.jsx(gt,{data:s})},s.model_name))})}const jt=async t=>{try{const n=await(await R.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:n}))}catch(s){console.error("Failed to connect to the server:",s)}};function ae(t,s=1){const i=t/1024;return i>=1024?(i/1024).toFixed(s)+" GB":i.toFixed(s)+" MB"}function ie(t,s){if(!t||t.length===0)return;let n=t.find(a=>a.nsfw==="None");return s&&(n=n??t[0]),n}function vt(t,s=280,n){var a,i,o,r;if(t)return pe(t)?(o=ie((i=(a=t.modelVersions)==null?void 0:a.at(0))==null?void 0:i.images,n))==null?void 0:o.url:`https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/${(r=ie(t.images,n))==null?void 0:r.url}/width=${s}/`}const H=280;function yt({model:t,onClickInstallModel:s,installing:n}){var h,m;const[a,i]=u.useState();u.useEffect(()=>{f();async function f(){var j;const v=await((j=k)==null?void 0:j.getSetting("showNsfwModelThumbnail"));i(vt(t,H,v))}},[t]);const o=pe(t)?t.modelVersions:t.versions,[r,l]=u.useState(((h=o==null?void 0:o[0])==null?void 0:h.name)??""),c=o==null?void 0:o.find(f=>(f==null?void 0:f.name)===r),d=()=>{window.open(`https://civitai.com/models/${t.id}`)},p=u.useCallback(()=>{if(c==null){console.error("no file is find by name",r);return}s(se(c,t.name),t)},[r]),g=(m=se(c))==null?void 0:m.sizeKB;return e.jsxs(me,{width:H,justifyContent:"space-between",mb:2,gap:1,children:[e.jsx(ye,{borderRadius:3,boxSize:H+"px",objectFit:"cover",src:a,alt:"model cover image",cursor:"pointer",onClick:()=>d()}),e.jsxs(O,{p:1,children:[e.jsx(ne,{label:t.name,children:e.jsx(I,{fontWeight:500,noOfLines:1,children:t.name})}),e.jsxs(A,{justifyContent:"space-between",alignItems:"center",children:[e.jsx(_,{borderRadius:14,noOfLines:1,size:"xs",colorScheme:"teal",maxWidth:"40%",flexShrink:1,variant:"outline",px:1,cursor:"text",children:e.jsx(I,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:t.type})}),e.jsx(_,{leftIcon:e.jsx(Ve,{size:18}),iconSpacing:1,borderRadius:10,size:"sm",py:1,colorScheme:"teal",type:"submit",onClick:()=>p(),isDisabled:!!(r&&n.includes(r)),children:"Install"})]}),e.jsxs(E,{children:[e.jsx(G,{size:"md",style:{paddingLeft:4},onChange:f=>{l(f.target.value)},children:o==null?void 0:o.map(f=>{const v=f==null?void 0:f.name;return v?e.jsx("option",{value:v,style:{padding:0},children:v},f.id):null})}),g&&e.jsx(ne,{label:ae(g),children:e.jsx(I,{flexShrink:1,noOfLines:1,width:"40%",children:ae(g)})})]})]})]})}function wt({searchQuery:t,setSearchQuery:s,onSearch:n}){return e.jsxs(A,{gap:1,alignItems:"center",grow:1,children:[e.jsx(W,{placeholder:"Search models in CivitAI",width:"60%",value:t,onChange:a=>s(a.target.value),onKeyUp:a=>{a.code==="Enter"&&n()}}),e.jsx(_,{size:"sm",onClick:()=>n(),colorScheme:"teal",children:"Search"})]})}function St({isOpen:t,fileSelected:s,onClose:n,selectFolder:a}){const[i,o]=u.useState(""),[r,l]=u.useState([]),[c,d]=u.useState(""),p=u.useRef(null);u.useEffect(()=>{g()},[]);const g=async()=>{const h=await fe();h&&(["custom_nodes","config","saved_prompts"].forEach(m=>{delete h[m]}),l(Object.values(h).flatMap(m=>m)))};return e.jsx(De,{isOpen:t,leastDestructiveRef:p,onClose:n,children:e.jsx(ce,{children:e.jsxs(Le,{children:[e.jsx(de,{fontSize:"lg",fontWeight:"bold",children:"Choose Folder"}),e.jsx(ue,{children:e.jsxs(O,{spacing:4,children:[!s&&e.jsxs(e.Fragment,{children:[e.jsx(I,{children:"Model download url"}),e.jsx(W,{placeholder:"https://civitai.com/api/download/models/311399",onChange:h=>d(h.target.value),value:c})]}),e.jsx(I,{children:"Choose model install folder"}),e.jsx(G,{placeholder:"Select option",value:i,onChange:h=>o(h.target.value),children:r.map(h=>e.jsx("option",{value:h,children:h},h))})]})}),e.jsxs(Ne,{children:[e.jsx(_,{ref:p,onClick:n,children:"Cancel"}),e.jsx(_,{onClick:()=>a(i,c),ml:3,isDisabled:c.length===0,children:"Confirm"})]})]})})})}function _t(){const{colorMode:t}=Be(),s=ge(),[n,a]=u.useState([]);return u.useEffect(()=>{R.addEventListener("download_progress",i=>{a(i.detail)}),R.addEventListener("download_error",i=>{s({title:"Download Error",description:i.detail,status:"error",duration:4e3,isClosable:!0})})},[]),e.jsx(O,{spacing:5,pos:"absolute",bottom:"0",left:"0",width:"50%",zIndex:80,backgroundColor:t==="light"?"white":"#242424",paddingX:5,children:n.map(({save_path:i,progress:o})=>e.jsxs(E,{children:[e.jsx(I,{fontSize:16,width:"40%",children:i.replace(/^.*[\\/]/,"")}),e.jsx(_e,{isIndeterminate:!o,hasStripe:!0,width:"50%",value:o}),e.jsxs(I,{fontSize:16,width:"10%",children:[o.toFixed(1),"%"]})]},i))})}const Ce="WORKSPACE_CIVIT_API_KEY_STORAGE_KEY";function bt(){return localStorage.getItem(Ce)}function Mt(t){localStorage.setItem(Ce,t)}function Ct(){const[t,s]=u.useState(""),{onOpen:n,onClose:a,isOpen:i}=xe(),o=()=>{Mt(t),a()};return e.jsxs($e,{isOpen:i,onOpen:n,onClose:a,placement:"right",closeOnBlur:!1,children:[e.jsx(Ue,{children:e.jsx(_,{size:"sm",py:1,mr:8,children:"Set Civitai API Key"})}),e.jsxs(Ye,{p:5,children:[e.jsx(qe,{}),e.jsx(Qe,{}),e.jsxs(O,{spacing:4,children:[e.jsx(I,{fontSize:14,children:"Some Civitai.com models require user login to download, you will nedd a Civitai API key to download in that case"}),e.jsx(W,{value:t,onChange:r=>s(r.target.value),placeholder:"API Key"}),e.jsx(_,{size:"sm",py:1,mr:8,onClick:o,children:"Save"})]})]})]})}async function It(t,s){var r,l;const n={queries:[{q:t,indexUid:"models_v5",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 s&&(n.queries[0].filter=[[`"type"="${s}"`]]),((l=(r=await(await fetch("https://meilisearch-v1-6.civitai.com/multi-search",{headers:{"Content-Type":"application/json",Authorization:"Bearer 102312c2b83ea0ef9ac32e7858f742721bbfd7319a957272e746f84fd1e974af"},method:"POST",body:JSON.stringify(n)})).json())==null?void 0:r.results)==null?void 0:l.at(0)).hits??[]}function Tt({onclose:t,searchQuery:s="",modelType:n}){const[a,i]=u.useState([]),[o,r]=u.useState(!1),[l,c]=u.useState(n),d=ge(),[p,g]=u.useState([]),[h,m]=u.useState(s),{isOpen:f,onOpen:v,onClose:j}=xe(),[y,M,w]=je(),[D,Y]=u.useState({}),[L,B]=u.useState(K),q=u.useCallback(async()=>{var S;r(!0);const x=await It(h,l);i(x);const C=await fe();C&&Y(C);const b=await((S=k)==null?void 0:S.getSetting("defaultFolders"));b&&B(b),r(!1)},[h,l]),Q=(x,C)=>{var Z,J,ee,te;if(!((Z=w.current)!=null&&Z.id)&&!C){console.error("no url to download");return}let b=C??`https://civitai.com/api/download/models/${(J=w.current)==null?void 0:J.id}`,S=(ee=w.current)==null?void 0:ee.name;if(!S&&(S=b.split("/").pop(),!S)){console.error("downloadUrl is malformed");return}d({title:"Installing...",description:S,status:"info",duration:4e3,isClosable:!0}),S!=null&&g(ke=>[...ke,S??""]);const X=bt();X&&(b+=`?token=${X}`),jt({file_hash:(te=w.current)==null?void 0:te.SHA256,filename:S,save_path:x,url:b}),M(void 0),j()},Ie=async(x,C)=>{const b=L[C.type];M(x),b==null?v():Q(b)},Te=async(x,C)=>{var S;const b={...L,[x]:C};await((S=k)==null?void 0:S.upsert({defaultFolders:b})),B(b)};return u.useEffect(()=>{q()},[l]),e.jsxs(e.Fragment,{children:[e.jsxs(Fe,{isOpen:!0,onClose:t,blockScrollOnMount:!0,children:[e.jsx(ce,{}),e.jsxs(Re,{width:"90%",maxWidth:"90vw",height:"90vh",children:[e.jsxs(de,{children:[e.jsxs(E,{gap:2,mb:2,alignItems:"center",children:[e.jsx(ve,{size:"md",mr:2,children:"Models"}),e.jsx(wt,{searchQuery:h,setSearchQuery:m,onSearch:q}),e.jsx(_,{size:"sm",py:1,mr:8,onClick:v,children:"Custom URL Install"}),e.jsx(Ct,{})]}),e.jsxs(E,{gap:2,mb:2,wrap:"wrap",children:[e.jsx(_,{size:"sm",py:1,onClick:()=>{c(void 0)},isActive:l==null,children:"All"}),Xe.map(x=>e.jsx(_,{size:"sm",py:1,isActive:l===x,onClick:()=>{c(x)},children:x},x)),l&&D[K[l]]&&e.jsxs(E,{ml:"auto",children:[e.jsx(I,{whiteSpace:"nowrap",children:"Default Download Folder:"}),e.jsx(G,{value:L[l],onChange:x=>Te(l,x.target.value),children:D[K[l]].map(x=>e.jsx("option",{value:x,children:x}))})]})]}),o&&e.jsx($,{thickness:"4px",emptyColor:"gray.200",color:"pink.500",size:"lg"})]}),e.jsx(ze,{}),e.jsxs(ue,{overflowY:"auto",children:[e.jsx(E,{wrap:"wrap",children:a==null?void 0:a.map(x=>e.jsx(yt,{model:x,onClickInstallModel:Ie,installing:p},x.id))}),e.jsx(_t,{})]})]})]}),e.jsx(St,{fileSelected:!!y,isOpen:f,onClose:j,selectFolder:(x,C)=>{Q(x,w.current?void 0:C)}})]})}function kt(){const[t,s]=u.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(_,{size:"sm",colorScheme:"teal",onClick:()=>s(!0),children:"Install Models"}),t&&e.jsx(Tt,{modelType:"Checkpoint",onclose:()=>s(!1)})]})}const Et=()=>{const[t,s]=u.useState(["checkpoints"]),[n,a]=u.useState([]),[i,o]=u.useState(!0);u.useEffect(()=>{r(),R.addEventListener("model_list",c=>{l(c.detail)})},[]);const r=async()=>{const c=await Ze();l(c)},l=async c=>{if(!c)return;o(!1);const d=Array.from(new Set(c.map(g=>g.model_type))),p=d.indexOf("checkpoints");p>=0&&d.splice(p,1),d.unshift("checkpoints"),s(d),a(c)};return{modelTypeList:t,modelsList:n,loading:i}};function Pt(){const[t,s,n]=je(!1),a=()=>{var l;(l=k)==null||l.getSetting("showNsfwModelThumbnail").then(c=>{s(c??!1)})};u.useEffect(()=>{a()},[]);const i=l=>{var d;const c=l.target.checked;(d=k)==null||d.upsert({showNsfwModelThumbnail:c}).then(()=>{a(),o(),window.dispatchEvent(new Event("showNsfwModelThumbnail"))})},o=async()=>{const l=await F.models.toArray();for(let c=0;c{var c,d;try{const p=`https://civitai.com/api/v1/model-versions/by-hash/${l.fileHash}`,h=await(await fetch(p)).json();let m;if(n.current)m=(d=(c=h==null?void 0:h.images)==null?void 0:c[0])==null?void 0:d.url;else if(!h.model.nsfw){const f=h.images.find(v=>v.nsfw==="None");m=f==null?void 0:f.url}F.models.update(l.id,{imageUrl:m??null})}catch{}};return e.jsx(nt,{isChecked:t,onChange:i,width:"100px",children:"Show NSFW"})}function At({onClose:t}){const[s,n]=u.useState("checkpoints"),[a,i]=u.useState(""),{loading:o,modelTypeList:r,modelsList:l}=Et(),[c,d]=u.useState([]);u.useEffect(()=>{const h=l.filter(m=>a.length?m.model_name.toLowerCase().includes(a.toLowerCase()):m.model_type===s);d(h)},[s,l,a]),u.useEffect(()=>(N.canvasEl.addEventListener("click",t),()=>{N.canvasEl.removeEventListener("click",t)}),[]);const p=440,g=()=>e.jsxs(e.Fragment,{children:[e.jsxs(A,{gap:4,justifyContent:"center",alignItems:"center",mb:1,children:[e.jsx(W,{size:"sm",placeholder:"Search",value:a,onChange:h=>i(h.target.value)}),e.jsx(Pt,{})]}),!a.length&&e.jsx(mt,{modelTypeList:r,setSelectedModel:n,selectedModel:s}),e.jsx(xt,{list:c}),o&&e.jsx(A,{justifyContent:"center",alignItems:"center",height:"100%",children:e.jsx($,{})})]});return e.jsx(Oe,{children:e.jsx(he,{style:{width:p},children:e.jsxs(me,{width:p,height:"100vh",p:4,gap:2,position:"fixed",top:0,left:0,shadow:"xl",zIndex:Je,overflowY:"auto",children:[e.jsxs(A,{justifyContent:"space-between",alignContent:"center",py:3,children:[e.jsx(ve,{size:"md",mr:2,children:"Models"}),e.jsx(kt,{})]}),g()]})})})}const Dt=u.lazy(()=>We(()=>import("./InstallMissingModelsButton-tTqamchA.js"),__vite__mapDeps([0,1,2,3,4,5,6])));function Lt(){const[t,s]=u.useState(!1),[n,a]=u.useState(),i=async r=>{if(r.dataTransfer.getData("eventName")!=="WorkspaceManagerAddNode")return;const c=r.dataTransfer.getData("modelRelativePath"),d=r.dataTransfer.getData("nodeType"),p=LiteGraph.createNode(d);p.pos=[r.canvasX,r.canvasY],p.configure({widgets_values:[c]}),N.graph.add(p)};u.useEffect(()=>{var r;return(r=k)==null||r.getSetting("modelManagerTopBarStyle").then(l=>{o(l,!1)}),N.canvasEl.addEventListener("drop",i),()=>{N.canvasEl.removeEventListener("drop",i)}},[]);const o=(r,l=!1)=>{var M;const{top:c=0,right:d=0}=n||{},{top:p=0,right:g=0}=r??{};let h=c+p,m=n===void 0?g:d-g;const f=document.documentElement.clientWidth,v=document.documentElement.clientHeight,j=document.getElementById("modelManagerTopBar"),y=(j==null?void 0:j.offsetWidth)||224;h+32>v&&(h=v-38),m+y>f&&(m=f-y-4),a({top:Math.max(4,h),right:Math.max(4,m)}),l&&((M=k)==null||M.upsert({modelManagerTopBarStyle:{top:h,right:m}}))};return e.jsx(et,{onDragEnd:r=>{o({top:r.y,right:r.x},!0)},dragIconId:"dragModelManagerTopBarIcon",children:n?e.jsxs(E,{style:{position:"fixed",...n},gap:2,draggable:!1,id:"modelManagerTopBar",className:"model-manager-top-bar",children:[e.jsx(tt,{id:"dragModelManagerTopBarIcon",className:"drag-model-manager-top-bar-icon",cursor:"move",size:15,color:"#FFF"}),e.jsx(Dt,{}),e.jsx(_,{size:"sm",colorScheme:"blue","aria-label":"My models",onClick:()=>s(!0),px:1,children:"Models"}),t&&e.jsx(At,{onClose:()=>s(!1)})]}):""})}const Ot=Object.freeze(Object.defineProperty({__proto__:null,default:Lt},Symbol.toStringTag,{value:"Module"}));export{Se as G,kt as I,Ot as M,It as g}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["workspace_web/InstallMissingModelsButton-tTqamchA.js","workspace_web/input.js","workspace_web/App-bwnmchpl.js","workspace_web/assets/App-JXePnJiV.css","workspace_web/chunk-NTCQBYKE-X_7oODtg.js","workspace_web/chunk-JARCRF6W-yJJssWqi.js","workspace_web/index-pz0vT7Or.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/workspace_web/RecentFilesDrawer-FEgtq9Pl.js b/dist/workspace_web/RecentFilesDrawer-vciP1wo4.js similarity index 99% rename from dist/workspace_web/RecentFilesDrawer-FEgtq9Pl.js rename to dist/workspace_web/RecentFilesDrawer-vciP1wo4.js index a15934b..5d93a4f 100644 --- a/dist/workspace_web/RecentFilesDrawer-FEgtq9Pl.js +++ b/dist/workspace_web/RecentFilesDrawer-vciP1wo4.js @@ -1,4 +1,4 @@ -import{f as we,n as un,o as dr,j as u,g as be,e as Oe,Y as fr,r as v,E as Ke,w as dn,M as qe,N as Xe,O as Ze,Q as Je,R as Qe,S as et,V as fn,h as J,Z as xt,T as pr,$ as ke,a0 as hr,a1 as mr,a2 as vr,a3 as pn,a4 as gr,a5 as k,a6 as D,a7 as br,a8 as hn,X as E,k as ve,a9 as Sr,I as yt,aa as Rt}from"./input.js";import{b as xr,a as yr,u as mn,c as Cr,d as wr,e as Or,S as Ir,M as vn,f as Mr,g as Pr,h as ee,H as G,T as gn,I as q,t as Se,i as bn,j as Sn,E as Lt,k as ge,l as Q,m as re,n as Ve,o as K,R as fe,p as kr,q as jr,B as T,F as je,r as Tt,v as Dr,s as Vr,w as Ie,x as Ee,y as ce,z as Er,D as xn,A as Y,C as Ct,G as Fr,J as wt,K as Rr,L as yn,N as de,O as Lr,P as Tr,Q as $r,U as Ot,V as Nr,W as zr,X as Ar,Y as xe,Z as dt,_ as Hr,$ as _r,a0 as Br,a1 as Wr,a2 as Ur,a3 as Gr,a4 as Yr,a5 as It,a6 as Kr,a7 as qr,a8 as Xr,a9 as $t,aa as Zr,ab as Jr,ac as Qr,ad as rt,ae as ea}from"./App-bwnmchpl.js";import{C as Fe}from"./chunk-JARCRF6W-yJJssWqi.js";import{V as Cn}from"./chunk-NTCQBYKE-X_7oODtg.js";import{S as ta,g as na,I as ra,M as aa}from"./MediaPreview-hpFtmf6V.js";import{app as Le}from"/scripts/app.js";import"/scripts/api.js";import"./index-pz0vT7Or.js";var wn=we(function(e,r){const{borderLeftWidth:a,borderBottomWidth:t,borderTopWidth:i,borderRightWidth:s,borderWidth:o,borderStyle:l,borderColor:c,...d}=un("Divider",e),{className:f,orientation:h="horizontal",__css:p,...m}=dr(e),g={vertical:{borderLeftWidth:a||s||o||"1px",height:"100%"},horizontal:{borderBottomWidth:t||i||o||"1px",width:"100%"}};return u.jsx(be.hr,{ref:r,"aria-orientation":h,...m,__css:{...d,border:"0",borderColor:c,borderStyle:l,...g[h],...p},className:Oe("chakra-divider",f)})});wn.displayName="Divider";function ia(n,e={}){const{ssr:r=!0,fallback:a}=e,{getWindow:t}=fr(),i=Array.isArray(n)?n:[n];let s=Array.isArray(a)?a:[a];s=s.filter(c=>c!=null);const[o,l]=v.useState(()=>i.map((c,d)=>({media:c,matches:r?!!s[d]:t().matchMedia(c).matches})));return v.useEffect(()=>{const c=t();l(i.map(h=>({media:h,matches:c.matchMedia(h).matches})));const d=i.map(h=>c.matchMedia(h)),f=h=>{l(p=>p.slice().map(m=>m.media===h.media?{...m,matches:h.matches}:m))};return d.forEach(h=>{typeof h.addListener=="function"?h.addListener(f):h.addEventListener("change",f)}),()=>{d.forEach(h=>{typeof h.removeListener=="function"?h.removeListener(f):h.removeEventListener("change",f)})}},[t]),o.map(c=>c.matches)}function oa(n,e,r=xr){let a=Object.keys(n).indexOf(e);if(a!==-1)return n[e];let t=r.indexOf(e);for(;t>=0;){const i=r[t];if(n.hasOwnProperty(i)){a=t;break}t-=1}if(a!==-1){const i=r[a];return n[i]}}function sa(n){var e,r;const a=dn(n)?n:{fallback:n??"base"},i=Ke().__breakpoints.details.map(({minMaxQuery:c,breakpoint:d})=>({breakpoint:d,query:c.replace("@media screen and ","")})),s=i.map(c=>c.breakpoint===a.fallback),l=ia(i.map(c=>c.query),{fallback:s,ssr:a.ssr}).findIndex(c=>c==!0);return(r=(e=i[l])==null?void 0:e.breakpoint)!=null?r:a.fallback}function la(n,e){var r;const a=dn(e)?e:{fallback:e??"base"},t=sa(a),i=Ke();if(!t)return;const s=Array.from(((r=i.__breakpoints)==null?void 0:r.keys)||[]),o=Array.isArray(n)?Object.fromEntries(Object.entries(yr(n,s)).map(([l,c])=>[l,c])):n;return oa(o,t,s)}var On=we((n,e)=>{const{title:r,children:a,className:t,...i}=n,s=Oe("chakra-menu__group__title",t),o=mn();return u.jsxs("div",{ref:e,className:"chakra-menu__group",role:"group",children:[r&&u.jsx(be.p,{className:s,...i,__css:o.groupTitle,children:r}),a]})});On.displayName="MenuGroup";var In=n=>{const{className:e,title:r,...a}=n,t=Cr(a);return u.jsx(On,{title:r,className:Oe("chakra-menu__option-group",e),...t})};In.displayName="MenuOptionGroup";var ca=we((n,e)=>{const r=mn();return u.jsx(be.button,{ref:e,...n,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...r.button}})}),tt=we((n,e)=>{const{children:r,as:a,...t}=n,i=wr(t,e),s=a||ca;return u.jsx(s,{...i,className:Oe("chakra-menu__menu-button",n.className),children:u.jsx(be.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:n.children})})});tt.displayName="MenuButton";var ua=n=>u.jsx("svg",{viewBox:"0 0 14 14",width:"1em",height:"1em",...n,children:u.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"})}),Mt=we((n,e)=>{const{icon:r,iconSpacing:a="0.75rem",...t}=n,i=Or(t,e);return u.jsxs(Ir,{...i,className:Oe("chakra-menu__menuitem-option",t.className),children:[r!==null&&u.jsx(vn,{fontSize:"0.8em",marginEnd:a,opacity:n.isChecked?1:0,children:r||u.jsx(ua,{})}),u.jsx("span",{style:{flex:1},children:i.children})]})});Mt.id="MenuItemOption";Mt.displayName="MenuItemOption";var Mn=we(function(e,r){const{getHeaderProps:a}=Mr(),t=Pr();return u.jsx(be.header,{...a(e,r),className:Oe("chakra-popover__header",e.className),__css:t.header})});Mn.displayName="PopoverHeader";var da=ee("chevron-up","IconChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]]),fa=ee("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"}]]),Nt=ee("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"}]]),pa=ee("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"}]]),Pn=ee("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"}]]),ha=ee("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"}]]),ma=ee("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"}]]),va=ee("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"}]]),ga=ee("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"}]]),ba=ee("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"}]]),Sa=ee("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"}]]),xa=ee("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"}]]),kn=ee("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"}]]);function ya({onclose:n}){const[e,r]=v.useState([]),a=async()=>{var i;const t=await((i=Se)==null?void 0:i.listAll());r(t??[])};return v.useEffect(()=>{a()},[]),u.jsxs(qe,{isOpen:!0,onClose:n,children:[u.jsx(Xe,{}),u.jsxs(Ze,{children:[u.jsx(Je,{children:"My Tags"}),u.jsx(Qe,{}),u.jsx(et,{children:e.map(t=>u.jsxs(G,{children:[u.jsx(gn,{children:t.name}),u.jsx(q,{onClick:async()=>{var i;await((i=Se)==null?void 0:i.delete(t.name)),a()},"aria-label":"delete-tag",colorScheme:"red",variant:"ghost",icon:u.jsx(bn,{})})]}))})]})]})}function Ca(){const n=Sn(),e=v.useRef([{title:"Save current workflow",key:Lt.SAVE},{title:"Save as current workflow",key:Lt.SAVE_AS}]),[r,a]=v.useState({save:"",saveAs:""}),[t,i]=v.useState(),s=async(l,c)=>{var f;l.preventDefault();let d="";if(l.ctrlKey&&(d+="Control+"),l.metaKey&&(d+="Command+"),l.shiftKey&&(d+="Shift+"),l.altKey&&(d+="Alt+"),d.length>0&&!["Control","Shift","Alt"].includes(l.key)){d+=l.key.toUpperCase();const h={...r};delete h[c],Object.values(h).includes(d)?n({title:"Shortcut key conflict",description:`The shortcut key γ€Œ${d}」 is already used, please +import{f as we,n as un,o as dr,j as u,g as be,e as Oe,Y as fr,r as v,E as Ke,w as dn,M as qe,N as Xe,O as Ze,Q as Je,R as Qe,S as et,V as fn,h as J,Z as xt,T as pr,$ as ke,a0 as hr,a1 as mr,a2 as vr,a3 as pn,a4 as gr,a5 as k,a6 as D,a7 as br,a8 as hn,X as E,k as ve,a9 as Sr,I as yt,aa as Rt}from"./input.js";import{b as xr,a as yr,u as mn,c as Cr,d as wr,e as Or,S as Ir,M as vn,f as Mr,g as Pr,h as ee,H as G,T as gn,I as q,t as Se,i as bn,j as Sn,E as Lt,k as ge,l as Q,m as re,n as Ve,o as K,R as fe,p as kr,q as jr,B as T,F as je,r as Tt,v as Dr,s as Vr,w as Ie,x as Ee,y as ce,z as Er,D as xn,A as Y,C as Ct,G as Fr,J as wt,K as Rr,L as yn,N as de,O as Lr,P as Tr,Q as $r,U as Ot,V as Nr,W as zr,X as Ar,Y as xe,Z as dt,_ as Hr,$ as _r,a0 as Br,a1 as Wr,a2 as Ur,a3 as Gr,a4 as Yr,a5 as It,a6 as Kr,a7 as qr,a8 as Xr,a9 as $t,aa as Zr,ab as Jr,ac as Qr,ad as rt,ae as ea}from"./App-7ZVFJHq5.js";import{C as Fe}from"./chunk-JARCRF6W-we4xocqW.js";import{V as Cn}from"./chunk-NTCQBYKE-qydYN07M.js";import{S as ta,g as na,I as ra,M as aa}from"./MediaPreview-1uswM5Au.js";import{app as Le}from"/scripts/app.js";import"/scripts/api.js";import"./index-pz0vT7Or.js";var wn=we(function(e,r){const{borderLeftWidth:a,borderBottomWidth:t,borderTopWidth:i,borderRightWidth:s,borderWidth:o,borderStyle:l,borderColor:c,...d}=un("Divider",e),{className:f,orientation:h="horizontal",__css:p,...m}=dr(e),g={vertical:{borderLeftWidth:a||s||o||"1px",height:"100%"},horizontal:{borderBottomWidth:t||i||o||"1px",width:"100%"}};return u.jsx(be.hr,{ref:r,"aria-orientation":h,...m,__css:{...d,border:"0",borderColor:c,borderStyle:l,...g[h],...p},className:Oe("chakra-divider",f)})});wn.displayName="Divider";function ia(n,e={}){const{ssr:r=!0,fallback:a}=e,{getWindow:t}=fr(),i=Array.isArray(n)?n:[n];let s=Array.isArray(a)?a:[a];s=s.filter(c=>c!=null);const[o,l]=v.useState(()=>i.map((c,d)=>({media:c,matches:r?!!s[d]:t().matchMedia(c).matches})));return v.useEffect(()=>{const c=t();l(i.map(h=>({media:h,matches:c.matchMedia(h).matches})));const d=i.map(h=>c.matchMedia(h)),f=h=>{l(p=>p.slice().map(m=>m.media===h.media?{...m,matches:h.matches}:m))};return d.forEach(h=>{typeof h.addListener=="function"?h.addListener(f):h.addEventListener("change",f)}),()=>{d.forEach(h=>{typeof h.removeListener=="function"?h.removeListener(f):h.removeEventListener("change",f)})}},[t]),o.map(c=>c.matches)}function oa(n,e,r=xr){let a=Object.keys(n).indexOf(e);if(a!==-1)return n[e];let t=r.indexOf(e);for(;t>=0;){const i=r[t];if(n.hasOwnProperty(i)){a=t;break}t-=1}if(a!==-1){const i=r[a];return n[i]}}function sa(n){var e,r;const a=dn(n)?n:{fallback:n??"base"},i=Ke().__breakpoints.details.map(({minMaxQuery:c,breakpoint:d})=>({breakpoint:d,query:c.replace("@media screen and ","")})),s=i.map(c=>c.breakpoint===a.fallback),l=ia(i.map(c=>c.query),{fallback:s,ssr:a.ssr}).findIndex(c=>c==!0);return(r=(e=i[l])==null?void 0:e.breakpoint)!=null?r:a.fallback}function la(n,e){var r;const a=dn(e)?e:{fallback:e??"base"},t=sa(a),i=Ke();if(!t)return;const s=Array.from(((r=i.__breakpoints)==null?void 0:r.keys)||[]),o=Array.isArray(n)?Object.fromEntries(Object.entries(yr(n,s)).map(([l,c])=>[l,c])):n;return oa(o,t,s)}var On=we((n,e)=>{const{title:r,children:a,className:t,...i}=n,s=Oe("chakra-menu__group__title",t),o=mn();return u.jsxs("div",{ref:e,className:"chakra-menu__group",role:"group",children:[r&&u.jsx(be.p,{className:s,...i,__css:o.groupTitle,children:r}),a]})});On.displayName="MenuGroup";var In=n=>{const{className:e,title:r,...a}=n,t=Cr(a);return u.jsx(On,{title:r,className:Oe("chakra-menu__option-group",e),...t})};In.displayName="MenuOptionGroup";var ca=we((n,e)=>{const r=mn();return u.jsx(be.button,{ref:e,...n,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...r.button}})}),tt=we((n,e)=>{const{children:r,as:a,...t}=n,i=wr(t,e),s=a||ca;return u.jsx(s,{...i,className:Oe("chakra-menu__menu-button",n.className),children:u.jsx(be.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:n.children})})});tt.displayName="MenuButton";var ua=n=>u.jsx("svg",{viewBox:"0 0 14 14",width:"1em",height:"1em",...n,children:u.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"})}),Mt=we((n,e)=>{const{icon:r,iconSpacing:a="0.75rem",...t}=n,i=Or(t,e);return u.jsxs(Ir,{...i,className:Oe("chakra-menu__menuitem-option",t.className),children:[r!==null&&u.jsx(vn,{fontSize:"0.8em",marginEnd:a,opacity:n.isChecked?1:0,children:r||u.jsx(ua,{})}),u.jsx("span",{style:{flex:1},children:i.children})]})});Mt.id="MenuItemOption";Mt.displayName="MenuItemOption";var Mn=we(function(e,r){const{getHeaderProps:a}=Mr(),t=Pr();return u.jsx(be.header,{...a(e,r),className:Oe("chakra-popover__header",e.className),__css:t.header})});Mn.displayName="PopoverHeader";var da=ee("chevron-up","IconChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]]),fa=ee("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"}]]),Nt=ee("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"}]]),pa=ee("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"}]]),Pn=ee("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"}]]),ha=ee("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"}]]),ma=ee("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"}]]),va=ee("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"}]]),ga=ee("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"}]]),ba=ee("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"}]]),Sa=ee("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"}]]),xa=ee("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"}]]),kn=ee("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"}]]);function ya({onclose:n}){const[e,r]=v.useState([]),a=async()=>{var i;const t=await((i=Se)==null?void 0:i.listAll());r(t??[])};return v.useEffect(()=>{a()},[]),u.jsxs(qe,{isOpen:!0,onClose:n,children:[u.jsx(Xe,{}),u.jsxs(Ze,{children:[u.jsx(Je,{children:"My Tags"}),u.jsx(Qe,{}),u.jsx(et,{children:e.map(t=>u.jsxs(G,{children:[u.jsx(gn,{children:t.name}),u.jsx(q,{onClick:async()=>{var i;await((i=Se)==null?void 0:i.delete(t.name)),a()},"aria-label":"delete-tag",colorScheme:"red",variant:"ghost",icon:u.jsx(bn,{})})]}))})]})]})}function Ca(){const n=Sn(),e=v.useRef([{title:"Save current workflow",key:Lt.SAVE},{title:"Save as current workflow",key:Lt.SAVE_AS}]),[r,a]=v.useState({save:"",saveAs:""}),[t,i]=v.useState(),s=async(l,c)=>{var f;l.preventDefault();let d="";if(l.ctrlKey&&(d+="Control+"),l.metaKey&&(d+="Command+"),l.shiftKey&&(d+="Shift+"),l.altKey&&(d+="Alt+"),d.length>0&&!["Control","Shift","Alt"].includes(l.key)){d+=l.key.toUpperCase();const h={...r};delete h[c],Object.values(h).includes(d)?n({title:"Shortcut key conflict",description:`The shortcut key γ€Œ${d}」 is already used, please modify it.`,status:"info",duration:3e3,position:"top",isClosable:!1}):(await((f=K)==null?void 0:f.upsert({shortcuts:{...r,[c]:d}})),o())}},o=()=>{var l;(l=K)==null||l.getSetting("shortcuts").then(c=>{var f;const d=c??((f=K)==null?void 0:f.defaultSettings.shortcuts);a({...r,...d})})};return v.useEffect(()=>{o()},[]),u.jsxs(ge,{children:[u.jsx(Q,{children:"Keyboard Shortcut"}),e.current.map(l=>u.jsxs(G,{children:[u.jsx(Q,{fontSize:"sm",w:170,children:l.title}),u.jsx(re,{label:"Press shortcut key combinations to setup",placement:"bottom",hasArrow:!0,isOpen:t===l.key,children:u.jsx(Ve,{value:r[l.key],onKeyDown:c=>{s(c,l.key)},onFocus:()=>{i(l.key)},onBlur:()=>{i(void 0)},placeholder:"Press a key combination",readOnly:!0,width:"auto",flex:1})})]},l.key))]})}function wa(){const{setRefreshFolderStamp:n}=v.useContext(fe),[e,r]=v.useState(!1),a=()=>{var i;(i=K)==null||i.getSetting("foldersOnTop").then(s=>{r(!!s)})},t=i=>{var o;const s=i.target.checked;(o=K)==null||o.upsert({foldersOnTop:s}).then(()=>{a(),n(Date.now())})};return v.useEffect(()=>{a()},[]),u.jsx(ge,{children:u.jsx(Fe,{isChecked:e,onChange:t,children:"Folders always on top"})})}function Oa(){const[n,e]=v.useState(!1),[r,a]=v.useState(""),{showDialog:t}=fn(),i=()=>{var o,l;(o=K)==null||o.getSetting("myWorkflowsDir").then(c=>{a(c??"undefined")}),(l=K)==null||l.getSetting("twoWaySync").then(c=>{e(c??!1)})};v.useEffect(()=>{i()},[]);const s=async o=>{var c,d;if(!o.target.checked){await((c=K)==null?void 0:c.upsert({twoWaySync:o.target.checked})),i();return}const l=await((d=K)==null?void 0:d.getSetting("myWorkflowsDir"));t(u.jsx(kr,{myWorkflowsDir:l??"undefined"}),[{label:"I have downloaded all my workflows and ready to enable",onClick:async()=>{var f;await((f=K)==null?void 0:f.upsert({twoWaySync:!0})),i()},colorScheme:"red"}])};return u.jsxs(ge,{children:[u.jsx(Q,{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."}),u.jsx(Fe,{isChecked:n,onChange:s,children:"Enable two way sync"})]})}function zt({settingKey:n,text:e,defaultChecked:r=!1}){const[a,t]=v.useState(r),i=()=>{var s;(s=K)==null||s.getSetting(n).then(o=>{t(!!o)})};return v.useEffect(()=>{i()},[]),u.jsx(ge,{children:u.jsx(Fe,{isChecked:a,onChange:async s=>{var o;await((o=K)==null?void 0:o.upsert({[n]:s.target.checked})),i()},children:e})})}function Ia(){const[n,e]=v.useState(!1),[r,a]=v.useState(!1),[t,i]=v.useState([]),[s,o]=v.useState(""),[l,c]=v.useState([]),[d,f]=v.useState(!1),[h,p]=v.useState(!1),m=v.useRef(null),g=Sn();v.useEffect(()=>{var C;jr().then(I=>o(I??"")),(C=K)==null||C.getSetting("twoWaySync").then(I=>{f(I??!1)})},[]);const b=async C=>{const{dir_path:I="",dir_contents:F=[],error:N=""}=await Tt(C??"");return N.includes("Operation not permitted")?(p(!0),O(),{isError:!0}):{dirList:F,dirPath:I}},S=async()=>{const{isError:C=!1,dirList:I=[]}=await b(s);C||(i(I),a(!0),c(s&&s.split(/[\\|\/]/).filter(F=>!!F)||[]))},O=()=>{a(!1),e(!1),c([])},y=async C=>{var N,z;if(C){const{error:H=""}=await Tt(C);if(H.includes("Not a directory")){g({title:"The directory address you entered is invalid, please re-enter it.",status:"warning",duration:5e3,position:"top",isClosable:!0});return}}const I=C??`/${l.join("/")}`;await((N=K)==null?void 0:N.upsert({myWorkflowsDir:I}));const F=await((z=K)==null?void 0:z.getSetting("myWorkflowsDir"))??"";o(F),C&&p(!1),O(),Dr()},x=async()=>{const{dirPath:C,dirList:I}=await b("");c(C.split("/").filter(F=>!!F)),i(I)},M=async(C,I)=>{var H;let F="";C===-1&&I?F=`/${l.concat([I]).join("/")}`:F=`/${l.slice(0,C+1).join("/")}`;const{isError:N=!1,dirList:z=[]}=await b(F);N||(i(z),c((H=F.slice(1))==null?void 0:H.split("/")))},w=u.jsxs(T,{textAlign:"end",mb:4,children:[u.jsx(Ve,{placeholder:"Please enter the absolute path directory address",ref:m,mt:2,mb:2}),u.jsx(J,{colorScheme:"teal",mr:3,size:"sm",onClick:()=>{var C,I;(C=m==null?void 0:m.current)!=null&&C.value&&y((I=m==null?void 0:m.current)==null?void 0:I.value)},children:"Save"})]}),V=()=>{a(!0),e(!0)};return u.jsxs(u.Fragment,{children:[u.jsxs(T,{mb:4,children:[u.jsx(Q,{mb:2,fontWeight:500,children:"My Workflows Save Directory"}),r?n?w:u.jsxs(Cn,{spacing:2,alignItems:"start",children:[u.jsx(ge,{spacing:"2px",direction:"row",wrap:"wrap",children:l.map((C,I)=>u.jsxs(u.Fragment,{children:["/",u.jsx(J,{colorScheme:"teal",variant:"link",minW:1,onClick:()=>{M(I)},children:C},`${C}-${I}`)]}))}),u.jsx(ta,{columns:2,spacing:3,maxHeight:500,width:"100%",overflowY:"auto",children:t.map((C,I)=>u.jsx(J,{size:"sm",leftIcon:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#EFC54D",style:{width:"1.2rem",height:"1.2rem"},children:u.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:()=>{M(-1,C)},children:C},`${C}-${I}`))}),u.jsxs(T,{w:"100%",textAlign:"end",children:[u.jsx(J,{colorScheme:"teal",size:"sm",onClick:()=>{y()},children:"Save"}),u.jsx(J,{size:"sm",onClick:x,mr:2,ml:2,children:"Reset"}),u.jsx(J,{size:"sm",onClick:O,children:"Cancel"})]})]}):u.jsxs(je,{children:[u.jsx(gn,{overflowWrap:"anywhere",children:s}),u.jsx(re,{label:d?"Choose folder":"Enable two way sync to link local folder",children:u.jsx(q,{"aria-label":"Select folder",size:"sm",ml:2,isDisabled:!d,icon:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#EFC54D",style:{width:"1.4rem",height:"1.4srem"},children:u.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:S})}),u.jsx(re,{label:d?"Input absolute path":"Enable two way sync to link local folder",children:u.jsx(q,{isDisabled:!d,"aria-label":"Enter folder address",size:"sm",ml:2,icon:u.jsx(fa,{size:19}),onClick:V,variant:"ghost"})})]})]}),u.jsxs(qe,{isOpen:h,onClose:()=>p(!1),size:"xl",children:[u.jsx(Xe,{}),u.jsxs(Ze,{children:[u.jsx(Je,{children:"Kind tips"}),u.jsx(Qe,{}),u.jsx(et,{children:u.jsxs(T,{children:[navigator.userAgent.indexOf("Mac OS X")!==-1?u.jsxs(Q,{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",u.jsx(J,{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."]}):u.jsx(Q,{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."}),w]})})]})]})]})}function Ma({onClose:n}){return u.jsx(u.Fragment,{children:u.jsxs(qe,{isOpen:!0,onClose:n,size:"xl",children:[u.jsx(Xe,{}),u.jsxs(Ze,{children:[u.jsx(Je,{children:"Settings"}),u.jsx(Qe,{}),u.jsx(et,{pb:14,children:u.jsx(G,{children:u.jsxs(Cn,{divider:u.jsx(Vr,{borderColor:"gray.500"}),spacing:4,align:"stretch",w:"100%",children:[u.jsx(Ia,{}),u.jsx(Ca,{}),u.jsx(zt,{settingKey:"autoSave",text:"Enable auto save workflow"}),u.jsx(Oa,{}),u.jsx(wa,{}),u.jsx(zt,{settingKey:"overwriteCurWorkflowWhenDroppingFileToCanvas",text:"Overwrite current workflow when drag and drop workflow file to canvas"})]})})})]})]})})}const at=16;function Pa({}){const[n,e]=v.useState(!1),[r,a]=v.useState(!1),{colorMode:t,toggleColorMode:i}=xt();return u.jsxs(u.Fragment,{children:[u.jsxs(Ie,{isLazy:!0,children:[u.jsx(tt,{as:q,"aria-label":"Options",icon:u.jsx(ma,{}),size:"sm",variant:"outline"}),u.jsxs(Ee,{children:[u.jsx(ce,{onClick:()=>a(!0),icon:u.jsx(Sa,{size:16}),fontSize:16,children:"Settings"}),u.jsx(ce,{onClick:()=>e(!0),icon:u.jsx(kn,{size:at}),fontSize:16,children:"Manage Tags"}),u.jsxs(ce,{onClick:i,icon:t==="light"?u.jsx(va,{size:at}):u.jsx(xa,{size:at}),fontSize:16,children:[t==="light"?"Dark":"Light"," Mode"]})]})]}),n&&u.jsx(ya,{onclose:()=>e(!1)}),r&&u.jsx(Ma,{onClose:()=>a(!1)})]})}function ka(n){const{multipleState:e,changeMultipleState:r,selectedKeys:a,isSelectedAll:t,batchOperationCallback:i}=n,s=async()=>{var c;const l=await((c=Y)==null?void 0:c.batchQuery(a))??[];Fr(l)},o=a.length===0;return u.jsx(G,{spacing:2,wrap:"wrap",mb:0,children:e?u.jsxs(u.Fragment,{children:[u.jsx(Fe,{isChecked:t,onChange:l=>{i("selectAll",l.target.checked)}}),u.jsx(re,{hasArrow:!0,label:"Download Zip",placement:"bottom",children:u.jsx(q,{isDisabled:o,"aria-label":"Batch export",size:"sm",icon:u.jsx(Er,{size:21}),onClick:s})}),u.jsx(re,{hasArrow:!0,label:"Batch deletion",children:u.jsx(xn,{isDisabled:o,variant:"solid",promptMessage:`Are you sure you want to delete these ${a.length} checked workflows?`,tooltipText:"Delete selected",onDelete:async()=>{var l;await((l=Y)==null?void 0:l.batchDeleteFlow(a)),i("batchDelete")}})}),a.length>0&&u.jsx(Q,{fontWeight:600,children:`Selected ${a.length}`}),u.jsx(re,{hasArrow:!0,label:"Exit multi-select",children:u.jsx(q,{"aria-label":"Close multi-select operation",size:"sm",icon:u.jsx(Ct,{}),onClick:()=>{r(!1)}})})]}):u.jsx(re,{hasArrow:!0,label:"Select multiple",placement:"bottom-start",children:u.jsx(q,{"aria-label":"Start multi-select operation",size:"sm",variant:"outline",icon:u.jsx(ha,{size:21}),onClick:()=>{r(!0)}})})})}const ja=(n,e)=>{const[r,a]=v.useState(n);return v.useEffect(()=>{const t=setTimeout(()=>{a(n)},e);return()=>{clearTimeout(t)}},[n,e]),r},Da={position:"absolute",marginLeft:"10px",width:"20px",height:"20px",top:"50%",color:"#A0AEC0",transform:"translateY(-50%)"};function Va(n){const{searchValue:e,onUpdateSearchValue:r}=n,a=e!=="";return u.jsxs(T,{style:{position:"relative"},mb:2,children:[u.jsx(ba,{style:Da}),a&&u.jsx(q,{size:"xs",position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",cursor:"pointer",background:"none",zIndex:"100",icon:u.jsx(Ct,{width:15,height:15}),onClick:()=>r(""),"aria-label":"clear input button"}),u.jsx(Ve,{placeholder:"Search",size:"sm",paddingLeft:"35px",paddingBlock:"5px",value:e,onChange:({target:t})=>r(t.value)})]})}const At=6;function Ea({setSelectedTag:n,selectedTag:e}){const[r,a]=v.useState(!1),[t,i]=v.useState([]);return v.useEffect(()=>{var s;(s=Se)==null||s.listAll().then(o=>{i(o)})},[]),u.jsxs(G,{spacing:2,wrap:"wrap",mb:0,children:[e!=null&&u.jsx(q,{"aria-label":"Close",size:"sm",icon:u.jsx(Ct,{}),onClick:()=>{n(void 0)}}),t.slice(0,r?void 0:At).map(s=>u.jsx(J,{variant:"solid",width:"auto",flexShrink:0,size:"sm",borderRadius:15,py:4,onClick:()=>{n(s.name)},isActive:e===s.name,children:s.name},s.name)),(t.length??0)>At&&u.jsx(q,{"aria-label":"Show-all-tags",size:"sm",icon:r?u.jsx(da,{}):u.jsx(wt,{}),onClick:()=>a(!r)})]})}function jn({parentFolderID:n,onlyImportFile:e=!1}){const{onRefreshFilesList:r}=v.useContext(fe),[a,t]=v.useState("file"),i=v.useRef(null),s=d=>{var f;t(d),d==="folder"?i.current.setAttribute("webkitdirectory",""):i.current.removeAttribute("webkitdirectory"),(f=i.current)==null||f.click()},o=async d=>{var f;if(d.type==="image/png"){const h=await na(d),p=h==null?void 0:h.workflow;if(p)return{json:p,name:d.name.replace(".png","")}}else if(d.type==="application/json"||(f=d.name)!=null&&f.endsWith(".json"))return await new Promise((h,p)=>{const m=new FileReader;m.onload=g=>{var b;try{const S=(b=g.target)==null?void 0:b.result;typeof S=="string"?h({json:S,name:d.name.replace(".json","")}):p(new Error("File content is not a string"))}catch(S){p(S)}},m.onerror=p,m.readAsText(d)});return null},l=async d=>{var h,p;const f=[d];for(;f.length>0;){const m=f.shift();if(m&&!m.isFile){const g=await((h=de)==null?void 0:h.create({name:m.name,parentFolderID:m.parentFolderID}));if(m.children&&m.children.length){const b=[];m.children.forEach(S=>{S.isFile&&S.file?b.push(S.file):(S.parentFolderID=g==null?void 0:g.id,f.push(S))}),b.length&&await((p=Y)==null?void 0:p.batchCreateFlows(b,void 0,g==null?void 0:g.id))}}}r==null||r()},c=async d=>{var h;const f=d.target.files;if(f)if(a==="folder"){const p={name:f[0].webkitRelativePath.split("/")[0],isFile:!1,children:[]};for(const m of f)if(m.name!==".DS_Store"){const g=m.webkitRelativePath.split("/");let b=p.children??[];for(let S=1;Sx.name===O);if(!y){if(y={name:O,isFile:S===g.length-1,children:S===g.length-1?void 0:[]},y.isFile){const x=await o(m);x&&(y.file=x)}b.push(y)}y&&!y.isFile&&(b=y.children)}}l(p)}else{const p=[];for(const m of f){const g=await o(m);g&&p.push(g)}p.length&&(await((h=Y)==null?void 0:h.batchCreateFlows(p,void 0,n)),r&&r())}};return u.jsxs(u.Fragment,{children:[e?u.jsx(ce,{onClick:d=>{d.stopPropagation(),s("file")},icon:u.jsx(Nt,{size:19}),children:"Import workflows"}):u.jsxs(Ie,{closeOnSelect:!0,children:[u.jsx(tt,{as:J,leftIcon:u.jsx(Nt,{size:18}),variant:"outline",iconSpacing:1,size:"sm",colorScheme:"teal",children:"Import"}),u.jsx(Ee,{children:Rr.map((d,f)=>u.jsx(ce,{onClick:()=>{s(d.type)},iconSpacing:2,icon:d.type==="folder"?u.jsx(yn,{size:18}):u.jsx(pa,{size:18}),children:d.title},f))})]}),u.jsx("input",{style:{display:"none"},ref:i,type:"file",accept:".json,image/png",multiple:!0,onChange:c,onClick:d=>{d.stopPropagation()}})]})}function Fa({folder:n,onclose:e}){const[r,a]=v.useState(n.name),[t,i]=v.useState(""),{onRefreshFilesList:s}=v.useContext(fe),o=c=>{a(c.target.value),t&&i("")},l=async()=>{var f,h;const c=r.trim();if(a(c),c===n.name)return e();await((f=de)==null?void 0:f.generateUniqueName(c,n.parentFolderID??""))!==c?i("The name is duplicated, please modify it and submit again."):(await((h=de)==null?void 0:h.update(n.id,{name:c})),s&&s(),e())};return u.jsxs(qe,{isOpen:!0,onClose:e,children:[u.jsx(Xe,{}),u.jsxs(Ze,{children:[u.jsx(Je,{children:"Edit folder name"}),u.jsx(Qe,{}),u.jsx(et,{children:u.jsxs(Lr,{isInvalid:!!t,children:[u.jsx(Tr,{children:"Folder name"}),u.jsx(Ve,{value:r,onChange:o,autoFocus:!0,onKeyUp:c=>{c.code==="Enter"&&!t&&r&&l()}}),t&&u.jsx($r,{children:t})]})}),u.jsxs(pr,{children:[u.jsx(J,{colorScheme:"teal",mr:3,onClick:l,isDisabled:!r||!!t,children:"Save"}),u.jsx(J,{onClick:e,children:"Cancel"})]})]})]})}function Ra({menuPosition:n,isopen:e,folder:r,onClose:a}){const[t,i]=v.useState(!1),{onRefreshFilesList:s}=v.useContext(fe),{showDialog:o}=fn(),l=async h=>{var p;h.stopPropagation(),await((p=de)==null?void 0:p.create({name:"New Folder",parentFolderID:r.id})),s&&s()},c=async h=>{var p;h.stopPropagation(),await((p=Y)==null?void 0:p.createFlow({json:JSON.stringify(Nr),parentFolderID:r.id})),s&&s()},d=async h=>{h.stopPropagation();const p=await zr(r.id);o(`Do you want to delete the ${p} files inside the folder too?`,[{label:"Delete all files",colorScheme:"red",onClick:()=>{f(Ar.DELETE)}}])},f=async h=>{var p;await((p=de)==null?void 0:p.deleteFolder(r.id,h)),a(),s&&s()};return u.jsxs(u.Fragment,{children:[u.jsx(T,{position:"absolute",top:n.y,left:n.x,children:u.jsx(Ie,{isOpen:e,onClose:a,isLazy:!0,lazyBehavior:"keepMounted",children:u.jsxs(Ee,{children:[u.jsx(ce,{icon:u.jsx(ga,{size:19}),onClick:h=>{h.preventDefault(),h.stopPropagation(),i(!0)},children:"Rename"}),u.jsx(ce,{icon:u.jsx(bn,{size:19}),onClick:d,children:"Delete"}),u.jsx(ce,{onClick:l,icon:u.jsx(Pn,{size:19}),children:"New folder"}),u.jsx(ce,{onClick:c,icon:u.jsx(Ot,{size:19}),children:"New file"}),u.jsx(jn,{parentFolderID:r.id,onlyImportFile:!0})]})})}),t&&u.jsx(Fa,{folder:r,onclose:()=>i(!1)})]})}const Ht=v.memo(function({folder:e}){const[r,a]=v.useState(!1),[t,i]=v.useState(e.isCollapse??!0),[s,o]=v.useState([]),[l,c]=v.useState({x:0,y:0}),[d,f]=v.useState(!1),{colorMode:h}=xt(),{draggingFile:p,setDraggingFile:m,refreshFolderStamp:g,onRefreshFilesList:b}=v.useContext(fe),S=h==="light"?{backgroundColor:"#E2E8F0"}:{backgroundColor:"#4A5568"};v.useEffect(()=>{var x;t||(x=Y)==null||x.listFolderContent(e.id,window.localStorage.getItem(dt)).then(M=>{o(M)})},[e.id,g,t]);const O=x=>{x.preventDefault(),c({x:x.clientX,y:x.clientY}),f(!0)},y=async x=>{var M,w;if(x.preventDefault(),x.stopPropagation(),!p)return a(!1);if(xe(p)){if(p.id===e.id)return a(!1);await((M=de)==null?void 0:M.update(p.id,{parentFolderID:e.id}))}else xe(p)||await((w=Y)==null?void 0:w.updateFolder(p.id,{parentFolderID:e.id}));await(b==null?void 0:b()),a(!1)};return v.useEffect(()=>{var x;!!e.isCollapse!==t&&((x=de)==null||x.update(e.id,{isCollapse:t}))},[t]),v.useEffect(()=>{var C;const x=(C=Y)==null?void 0:C.curWorkflow,M=(x==null?void 0:x.parentFolderID)+"/",w=e.id+"/";M.startsWith(w)&&i(!1)},[]),u.jsxs(ge,{children:[u.jsxs(G,{w:"100%",as:"button",py:1,onClick:()=>{i(!t)},onContextMenu:O,draggable:"true",onDragOver:x=>{x.preventDefault(),x.stopPropagation(),a(!0)},onDragLeave:x=>{x.preventDefault(),x.stopPropagation(),a(!1)},onDragStart:()=>m==null?void 0:m(e),onDrop:y,_hover:S,style:r||d?S:void 0,className:"droppable",children:[u.jsxs(G,{gap:1,children:[t?u.jsx(ra,{size:20}):u.jsx(wt,{size:20}),u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#EFC54D",style:{width:"1.2rem",height:"1.2rem"},children:u.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"})})]}),u.jsx(Q,{children:e.name})]}),u.jsx(Ra,{isopen:d,menuPosition:l,onClose:()=>f(!1),folder:e}),!t&&u.jsx(ge,{ml:4,gap:0,children:u.jsx(sr,{items:s})})]})});function _t(n,e){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})),r.push.apply(r,a)}return r}function P(n){for(var e=1;en.length)&&(e=n.length);for(var r=0,a=new Array(e);r=0)&&Object.prototype.propertyIsEnumerable.call(n,a)&&(r[a]=n[a])}return r}var Na=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function za(n){var e=n.defaultInputValue,r=e===void 0?"":e,a=n.defaultMenuIsOpen,t=a===void 0?!1:a,i=n.defaultValue,s=i===void 0?null:i,o=n.inputValue,l=n.menuIsOpen,c=n.onChange,d=n.onInputChange,f=n.onMenuClose,h=n.onMenuOpen,p=n.value,m=pe(n,Na),g=v.useState(o!==void 0?o:r),b=ue(g,2),S=b[0],O=b[1],y=v.useState(l!==void 0?l:t),x=ue(y,2),M=x[0],w=x[1],V=v.useState(p!==void 0?p:s),C=ue(V,2),I=C[0],F=C[1],N=v.useCallback(function(L,A){typeof c=="function"&&c(L,A),F(L)},[c]),z=v.useCallback(function(L,A){var $;typeof d=="function"&&($=d(L,A)),O($!==void 0?$:L)},[d]),H=v.useCallback(function(){typeof h=="function"&&h(),w(!0)},[h]),R=v.useCallback(function(){typeof f=="function"&&f(),w(!1)},[f]),_=o!==void 0?o:S,W=l!==void 0?l:M,j=p!==void 0?p:I;return P(P({},m),{},{inputValue:_,menuIsOpen:W,onChange:N,onInputChange:z,onMenuClose:R,onMenuOpen:H,value:j})}function Aa(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function Bt(n,e){for(var r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Wa(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function Ua(n,e){if(e&&(pn(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wa(n)}function Ga(n){var e=Ba();return function(){var a=Ae(n),t;if(e){var i=Ae(this).constructor;t=Reflect.construct(a,arguments,i)}else t=a.apply(this,arguments);return Ua(this,t)}}function Ya(n){if(Array.isArray(n))return ft(n)}function Ka(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function qa(){throw new TypeError(`Invalid attempt to spread non-iterable instance. diff --git a/dist/workspace_web/ShareDialog-AtzuU051.js b/dist/workspace_web/ShareDialog-Q3AC6yal.js similarity index 98% rename from dist/workspace_web/ShareDialog-AtzuU051.js rename to dist/workspace_web/ShareDialog-Q3AC6yal.js index 094b29d..2d30d48 100644 --- a/dist/workspace_web/ShareDialog-AtzuU051.js +++ b/dist/workspace_web/ShareDialog-Q3AC6yal.js @@ -1 +1 @@ -import{f as Z,n as ge,o as ie,j as e,g as K,e as ce,r as a,m as me,w as ne,b as ve,l as y,q as M,p as Y,k as we,H as ke,ac as be,h as $,M as xe,N as ye,O as Ce,Q as Se,S as je}from"./input.js";import{aw as Ie,h as De,B as Pe,J as Re,aa as _e,H as Q,l as X,a6 as Fe,a8 as de,j as Me,o as le,k as re,ax as Ne,n as Ee,F as We,A as q,ay as J,az as Le,aA as Te,aB as Be,T as Ve,aC as He}from"./App-bwnmchpl.js";import{app as Oe}from"/scripts/app.js";import{t as Ae}from"./index-pz0vT7Or.js";import{L as qe,I as Ke}from"./IconCopy-NTjy7XFG.js";import"/scripts/api.js";var ue=Z(function(c,r){const o=ge("Badge",c),{className:d,...h}=ie(c);return e.jsx(K.span,{ref:r,className:ce("chakra-badge",c.className),...h,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...o}})});ue.displayName="Badge";function $e(t){return t&&ne(t)&&ne(t.target)}function ze(t={}){const{onChange:c,value:r,defaultValue:o,name:d,isDisabled:h,isFocusable:f,isNative:g,...p}=t,[w,C]=a.useState(o||""),k=typeof r<"u",S=k?r:w,b=a.useRef(null),j=a.useCallback(()=>{const n=b.current;if(!n)return;let u="input:not(:disabled):checked";const I=n.querySelector(u);if(I){I.focus();return}u="input:not(:disabled)";const s=n.querySelector(u);s==null||s.focus()},[]),m=`radio-${a.useId()}`,E=d||m,R=a.useCallback(n=>{const u=$e(n)?n.target.value:n;k||C(u),c==null||c(String(u))},[c,k]),H=a.useCallback((n={},u=null)=>({...n,ref:me(u,b),role:"radiogroup"}),[]),_=a.useCallback((n={},u=null)=>({...n,ref:u,name:E,[g?"checked":"isChecked"]:S!=null?n.value===S:void 0,onChange(s){R(s)},"data-radiogroup":!0}),[g,E,R,S]);return{getRootProps:H,getRadioProps:_,name:E,ref:b,focus:j,setValue:C,value:S,onChange:R,isDisabled:h,isFocusable:f,htmlProps:p}}var[Ge,he]=ve({name:"RadioGroupContext",strict:!1}),fe=Z((t,c)=>{const{colorScheme:r,size:o,variant:d,children:h,className:f,isDisabled:g,isFocusable:p,...w}=t,{value:C,onChange:k,getRootProps:S,name:b,htmlProps:j}=ze(w),N=a.useMemo(()=>({name:b,size:o,onChange:k,colorScheme:r,value:C,variant:d,isDisabled:g,isFocusable:p}),[b,o,k,r,C,d,g,p]);return e.jsx(Ge,{value:N,children:e.jsx(K.div,{...S(j,c),className:ce("chakra-radio-group",f),children:h})})});fe.displayName="RadioGroup";var Ue={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function Je(t={}){const{defaultChecked:c,isChecked:r,isFocusable:o,isDisabled:d,isReadOnly:h,isRequired:f,onChange:g,isInvalid:p,name:w,value:C,id:k,"data-radiogroup":S,"aria-describedby":b,...j}=t,N=`radio-${a.useId()}`,m=Ie(),R=!!he()||!!S;let _=!!m&&!R?m.id:N;_=k??_;const n=d??(m==null?void 0:m.isDisabled),u=h??(m==null?void 0:m.isReadOnly),I=f??(m==null?void 0:m.isRequired),s=p??(m==null?void 0:m.isInvalid),[l,P]=a.useState(!1),[v,D]=a.useState(!1),[x,W]=a.useState(!1),[L,T]=a.useState(!1),[z,G]=a.useState(!!c),O=typeof r<"u",F=O?r:z;a.useEffect(()=>Ae(P),[]);const B=a.useCallback(i=>{if(u||n){i.preventDefault();return}O||G(i.target.checked),g==null||g(i)},[O,n,u,g]),A=a.useCallback(i=>{i.key===" "&&T(!0)},[T]),U=a.useCallback(i=>{i.key===" "&&T(!1)},[T]),oe=a.useCallback((i={},V=null)=>({...i,ref:V,"data-active":y(L),"data-hover":y(x),"data-disabled":y(n),"data-invalid":y(s),"data-checked":y(F),"data-focus":y(v),"data-focus-visible":y(v&&l),"data-readonly":y(u),"aria-hidden":!0,onMouseDown:M(i.onMouseDown,()=>T(!0)),onMouseUp:M(i.onMouseUp,()=>T(!1)),onMouseEnter:M(i.onMouseEnter,()=>W(!0)),onMouseLeave:M(i.onMouseLeave,()=>W(!1))}),[L,x,n,s,F,v,u,l]),{onFocus:se,onBlur:te}=m??{},pe=a.useCallback((i={},V=null)=>{const ae=n&&!o;return{...i,id:_,ref:V,type:"radio",name:w,value:C,onChange:M(i.onChange,B),onBlur:M(te,i.onBlur,()=>D(!1)),onFocus:M(se,i.onFocus,()=>D(!0)),onKeyDown:M(i.onKeyDown,A),onKeyUp:M(i.onKeyUp,U),checked:F,disabled:ae,readOnly:u,required:I,"aria-invalid":Y(s),"aria-disabled":Y(ae),"aria-required":Y(I),"data-readonly":y(u),"aria-describedby":b,style:Ue}},[n,o,_,w,C,B,te,se,A,U,F,u,I,s,b]);return{state:{isInvalid:s,isFocused:v,isChecked:F,isActive:L,isHovered:x,isDisabled:n,isReadOnly:u,isRequired:I},getCheckboxProps:oe,getRadioProps:oe,getInputProps:pe,getLabelProps:(i={},V=null)=>({...i,ref:V,onMouseDown:M(i.onMouseDown,Qe),"data-disabled":y(n),"data-checked":y(F),"data-invalid":y(s)}),getRootProps:(i,V=null)=>({...i,ref:V,"data-disabled":y(n),"data-checked":y(F),"data-invalid":y(s)}),htmlProps:j}}function Qe(t){t.preventDefault(),t.stopPropagation()}function Ye(t,c){const r={},o={};for(const[d,h]of Object.entries(t))c.includes(d)?r[d]=h:o[d]=h;return[r,o]}var ee=Z((t,c)=>{var r;const o=he(),{onChange:d,value:h}=t,f=we("Radio",{...o,...t}),g=ie(t),{spacing:p="0.5rem",children:w,isDisabled:C=o==null?void 0:o.isDisabled,isFocusable:k=o==null?void 0:o.isFocusable,inputProps:S,...b}=g;let j=t.isChecked;(o==null?void 0:o.value)!=null&&h!=null&&(j=o.value===h);let N=d;o!=null&&o.onChange&&h!=null&&(N=ke(o.onChange,d));const m=(r=t==null?void 0:t.name)!=null?r:o==null?void 0:o.name,{getInputProps:E,getCheckboxProps:R,getLabelProps:H,getRootProps:_,htmlProps:n}=Je({...b,isChecked:j,isFocusable:k,isDisabled:C,onChange:N,name:m}),[u,I]=Ye(n,be),s=R(I),l=E(S,c),P=H(),v=Object.assign({},u,_()),D={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...f.container},x={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...f.control},W={userSelect:"none",marginStart:p,...f.label};return e.jsxs(K.label,{className:"chakra-radio",...v,__css:D,children:[e.jsx("input",{className:"chakra-radio__input",...l}),e.jsx(K.span,{className:"chakra-radio__control",...s,__css:x}),w&&e.jsx(K.span,{className:"chakra-radio__label",...P,__css:W,children:w})]})});ee.displayName="Radio";var Xe=De("cloud","IconCloud",[["path",{d:"M6.657 18c-2.572 0 -4.657 -2.007 -4.657 -4.483c0 -2.475 2.085 -4.482 4.657 -4.482c.393 -1.762 1.794 -3.2 3.675 -3.773c1.88 -.572 3.956 -.193 5.444 1c1.488 1.19 2.162 3.007 1.77 4.769h.99c1.913 0 3.464 1.56 3.464 3.486c0 1.927 -1.551 3.487 -3.465 3.487h-11.878",key:"svg-0"}]]);function Ze({options:t,value:c,onChange:r}){const[o,d]=a.useState(!1),h=a.useRef(null),f=t.find(p=>p.value===c);a.useEffect(()=>{const p=w=>{h.current&&!h.current.contains(w.target)&&d(!1)};return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[h]);const g=()=>d(!o);return e.jsxs(Pe,{position:"relative",children:[e.jsx($,{onClick:g,rightIcon:e.jsx(Re,{}),leftIcon:f==null?void 0:f.icon,children:f==null?void 0:f.label}),o&&e.jsx(_e,{gap:4,ref:h,mt:"2",shadow:"md",borderWidth:"1px",p:"2",position:"absolute",zIndex:100,children:t.map(p=>e.jsx($,{onClick:()=>{d(!1),r(p.value)},leftIcon:p.icon,justifyContent:"flex-start",variant:"ghost",width:"full",children:p.label},p.label))})]})}function eo({version:t,cloudHost:c,cloudWorkflowID:r}){const o=t,d=e.jsxs(Q,{spacing:4,alignItems:"center",children:[e.jsx(X,{children:o.name}),e.jsx(X,{color:"GrayText",children:Fe(o.createTime,!1)}),o.cloudID&&r&&e.jsx("a",{href:c+"/workflow/"+r+"/"+o.cloudID,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none"},children:e.jsx($,{size:"xs",colorScheme:"teal",variant:"outline",leftIcon:e.jsx(Xe,{}),rightIcon:e.jsx(de,{size:18}),children:"Shared"})})]});return t.cloudID?e.jsx(e.Fragment,{children:d}):e.jsx(ee,{value:o.id,mb:5,children:d},o.id)}function ho({onClose:t}){var u,I;const[c,r]=a.useState("version "+oo()),[o,d]=a.useState([]),[h,f]=a.useState(!1),[g,p]=a.useState(""),[w,C]=a.useState("PRIVATE"),[k,S]=a.useState("new_version"),b=a.useRef(""),[j,N]=a.useState(),m=Me(),E=async s=>{var W,L;const l=s.data;if(s.origin!==b.current||l.type!=="share_workflow_success")return;const P=l.localWorkflowID,v=l.localVersionID,D=l.version.id,x=l.version.workflowID;x&&P&&await((W=q)==null?void 0:W.updateMetaInfo(P,{cloudID:x,cloudOrigin:s.origin,privacy:w})),v&&D&&await((L=J)==null?void 0:L.update(v,{cloudID:D,cloudOrigin:s.origin})),R(),window.open(b.current+"/workflow/"+x+"/"+D,"_blank"),f(!1)};a.useEffect(()=>(R(),window.addEventListener("message",E),()=>{window.removeEventListener("message",E)}),[]);const R=async()=>{var P,v,D;const s=await((P=le)==null?void 0:P.getSetting("cloudHost"));s&&(p(s),b.current=s);const l=((v=q)==null?void 0:v.curWorkflow)??void 0;N(l),l!=null&&l.cloudID&&l.cloudOrigin&&Be(l).then(x=>{C(x)}),(D=J)==null||D.listByWorkflowID(l.id).then(x=>{d(x)})},H=s=>{navigator.clipboard.writeText(s).then(()=>{m({title:"Copied to clipboard",status:"success",duration:2e3,isClosable:!0})}).catch(l=>{console.error("Failed to copy text: ",l)})},_=async()=>{var G,O,F;f(!0);const s=Le(32),l=await((G=le)==null?void 0:G.getSetting("cloudHost"));let P,v;try{if(P=Te(),k==="new_version"?v=await((O=J)==null?void 0:O.add({workflowID:j.id,name:c,createTime:Date.now(),json:JSON.stringify(Oe.graph.serialize())})):v=await((F=J)==null?void 0:F.get(k)),!v){alert(`Failed to find version: ${k}, please try again.`),f(!1);return}}catch(B){console.error(B),f(!1),alert("Failed to share workflow, please try again.");return}const D=window.location.protocol,x=window.location.host,W=`${D}//${x}`,L=l+`/share_workflow_confirm/${s}?redirectUrl=${W}`,T=window.open(L,"Share Workflow","width=800,height=800"),z=B=>{var A;if(B.origin===l&&B.data==="child_ready"){const U=(A=q)==null?void 0:A.curWorkflow;T.postMessage({workflow:U,version:v,nodeDefs:P,privacy:w},l),window.removeEventListener("message",z)}};window.addEventListener("message",z)},n=(I=(u=q)==null?void 0:u.curWorkflow)==null?void 0:I.cloudID;return e.jsxs(xe,{isOpen:!0,onClose:t,size:"lg",children:[e.jsx(ye,{}),e.jsxs(Ce,{width:["98%","90%","50%"],maxWidth:"600px",children:[e.jsxs(Se,{children:['Share "',j==null?void 0:j.name,'"']}),e.jsxs(je,{pb:10,children:[e.jsxs(re,{gap:5,children:[n==null?e.jsx(Ze,{options:Ne,value:w,onChange:s=>{C(s)}}):e.jsx(Ve,{variant:"outline",borderRadius:"full",width:"fit-content",children:e.jsx(He,{privacy:w,showEmoji:!0})}),n&&e.jsxs(Q,{spacing:2,color:"teal.400",children:[e.jsxs(qe,{href:g+"/workflow/"+n,isExternal:!0,children:[g+"/workflow/"+n," ",e.jsx(de,{size:20,style:{display:"inline-block",verticalAlign:"middle"}})]}),e.jsx($,{width:"180px",size:"sm",leftIcon:e.jsx(Ke,{}),onClick:()=>{var s,l;H(g+"/workflow/"+((l=(s=q)==null?void 0:s.curWorkflow)==null?void 0:l.cloudID))},children:"Copy link"})]}),e.jsx(X,{children:"Choose a version to share:"}),e.jsx(fe,{gap:4,onChange:s=>{S(s)},value:k,children:e.jsxs(re,{children:[e.jsxs(Q,{mb:5,alignItems:"center",children:[e.jsx(ee,{value:"new_version"},"new_version"),e.jsx(Ee,{value:c,width:"60%",onFocus:()=>{S("new_version")},onChange:s=>{r(s.target.value)}}),e.jsx(We,{color:"green",children:e.jsx(ue,{colorScheme:"purple",children:"New version"})})]}),o.slice(0,4).map(s=>e.jsx(eo,{version:s,cloudHost:g,cloudWorkflowID:n??null},s.id))]})})]}),e.jsx(Q,{justifyContent:"flex-end",mt:16,children:e.jsx($,{colorScheme:"teal",onClick:_,isDisabled:h,children:h?"Sharing":"Share"})})]})]})]})}function oo(){const t=new Date,c=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0");return`${c}-${r}-${o}`}export{ho as default}; +import{f as Z,n as ge,o as ie,j as e,g as K,e as ce,r as a,m as me,w as ne,b as ve,l as y,q as M,p as Y,k as we,H as ke,ac as be,h as $,M as xe,N as ye,O as Ce,Q as Se,S as je}from"./input.js";import{aw as Ie,h as De,B as Pe,J as Re,aa as _e,H as Q,l as X,a6 as Fe,a8 as de,j as Me,o as le,k as re,ax as Ne,n as Ee,F as We,A as q,ay as J,az as Le,aA as Te,aB as Be,T as Ve,aC as He}from"./App-7ZVFJHq5.js";import{app as Oe}from"/scripts/app.js";import{t as Ae}from"./index-pz0vT7Or.js";import{L as qe,I as Ke}from"./IconCopy-D6uYPUbf.js";import"/scripts/api.js";var ue=Z(function(c,r){const o=ge("Badge",c),{className:d,...h}=ie(c);return e.jsx(K.span,{ref:r,className:ce("chakra-badge",c.className),...h,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...o}})});ue.displayName="Badge";function $e(t){return t&&ne(t)&&ne(t.target)}function ze(t={}){const{onChange:c,value:r,defaultValue:o,name:d,isDisabled:h,isFocusable:f,isNative:g,...p}=t,[w,C]=a.useState(o||""),k=typeof r<"u",S=k?r:w,b=a.useRef(null),j=a.useCallback(()=>{const n=b.current;if(!n)return;let u="input:not(:disabled):checked";const I=n.querySelector(u);if(I){I.focus();return}u="input:not(:disabled)";const s=n.querySelector(u);s==null||s.focus()},[]),m=`radio-${a.useId()}`,E=d||m,R=a.useCallback(n=>{const u=$e(n)?n.target.value:n;k||C(u),c==null||c(String(u))},[c,k]),H=a.useCallback((n={},u=null)=>({...n,ref:me(u,b),role:"radiogroup"}),[]),_=a.useCallback((n={},u=null)=>({...n,ref:u,name:E,[g?"checked":"isChecked"]:S!=null?n.value===S:void 0,onChange(s){R(s)},"data-radiogroup":!0}),[g,E,R,S]);return{getRootProps:H,getRadioProps:_,name:E,ref:b,focus:j,setValue:C,value:S,onChange:R,isDisabled:h,isFocusable:f,htmlProps:p}}var[Ge,he]=ve({name:"RadioGroupContext",strict:!1}),fe=Z((t,c)=>{const{colorScheme:r,size:o,variant:d,children:h,className:f,isDisabled:g,isFocusable:p,...w}=t,{value:C,onChange:k,getRootProps:S,name:b,htmlProps:j}=ze(w),N=a.useMemo(()=>({name:b,size:o,onChange:k,colorScheme:r,value:C,variant:d,isDisabled:g,isFocusable:p}),[b,o,k,r,C,d,g,p]);return e.jsx(Ge,{value:N,children:e.jsx(K.div,{...S(j,c),className:ce("chakra-radio-group",f),children:h})})});fe.displayName="RadioGroup";var Ue={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function Je(t={}){const{defaultChecked:c,isChecked:r,isFocusable:o,isDisabled:d,isReadOnly:h,isRequired:f,onChange:g,isInvalid:p,name:w,value:C,id:k,"data-radiogroup":S,"aria-describedby":b,...j}=t,N=`radio-${a.useId()}`,m=Ie(),R=!!he()||!!S;let _=!!m&&!R?m.id:N;_=k??_;const n=d??(m==null?void 0:m.isDisabled),u=h??(m==null?void 0:m.isReadOnly),I=f??(m==null?void 0:m.isRequired),s=p??(m==null?void 0:m.isInvalid),[l,P]=a.useState(!1),[v,D]=a.useState(!1),[x,W]=a.useState(!1),[L,T]=a.useState(!1),[z,G]=a.useState(!!c),O=typeof r<"u",F=O?r:z;a.useEffect(()=>Ae(P),[]);const B=a.useCallback(i=>{if(u||n){i.preventDefault();return}O||G(i.target.checked),g==null||g(i)},[O,n,u,g]),A=a.useCallback(i=>{i.key===" "&&T(!0)},[T]),U=a.useCallback(i=>{i.key===" "&&T(!1)},[T]),oe=a.useCallback((i={},V=null)=>({...i,ref:V,"data-active":y(L),"data-hover":y(x),"data-disabled":y(n),"data-invalid":y(s),"data-checked":y(F),"data-focus":y(v),"data-focus-visible":y(v&&l),"data-readonly":y(u),"aria-hidden":!0,onMouseDown:M(i.onMouseDown,()=>T(!0)),onMouseUp:M(i.onMouseUp,()=>T(!1)),onMouseEnter:M(i.onMouseEnter,()=>W(!0)),onMouseLeave:M(i.onMouseLeave,()=>W(!1))}),[L,x,n,s,F,v,u,l]),{onFocus:se,onBlur:te}=m??{},pe=a.useCallback((i={},V=null)=>{const ae=n&&!o;return{...i,id:_,ref:V,type:"radio",name:w,value:C,onChange:M(i.onChange,B),onBlur:M(te,i.onBlur,()=>D(!1)),onFocus:M(se,i.onFocus,()=>D(!0)),onKeyDown:M(i.onKeyDown,A),onKeyUp:M(i.onKeyUp,U),checked:F,disabled:ae,readOnly:u,required:I,"aria-invalid":Y(s),"aria-disabled":Y(ae),"aria-required":Y(I),"data-readonly":y(u),"aria-describedby":b,style:Ue}},[n,o,_,w,C,B,te,se,A,U,F,u,I,s,b]);return{state:{isInvalid:s,isFocused:v,isChecked:F,isActive:L,isHovered:x,isDisabled:n,isReadOnly:u,isRequired:I},getCheckboxProps:oe,getRadioProps:oe,getInputProps:pe,getLabelProps:(i={},V=null)=>({...i,ref:V,onMouseDown:M(i.onMouseDown,Qe),"data-disabled":y(n),"data-checked":y(F),"data-invalid":y(s)}),getRootProps:(i,V=null)=>({...i,ref:V,"data-disabled":y(n),"data-checked":y(F),"data-invalid":y(s)}),htmlProps:j}}function Qe(t){t.preventDefault(),t.stopPropagation()}function Ye(t,c){const r={},o={};for(const[d,h]of Object.entries(t))c.includes(d)?r[d]=h:o[d]=h;return[r,o]}var ee=Z((t,c)=>{var r;const o=he(),{onChange:d,value:h}=t,f=we("Radio",{...o,...t}),g=ie(t),{spacing:p="0.5rem",children:w,isDisabled:C=o==null?void 0:o.isDisabled,isFocusable:k=o==null?void 0:o.isFocusable,inputProps:S,...b}=g;let j=t.isChecked;(o==null?void 0:o.value)!=null&&h!=null&&(j=o.value===h);let N=d;o!=null&&o.onChange&&h!=null&&(N=ke(o.onChange,d));const m=(r=t==null?void 0:t.name)!=null?r:o==null?void 0:o.name,{getInputProps:E,getCheckboxProps:R,getLabelProps:H,getRootProps:_,htmlProps:n}=Je({...b,isChecked:j,isFocusable:k,isDisabled:C,onChange:N,name:m}),[u,I]=Ye(n,be),s=R(I),l=E(S,c),P=H(),v=Object.assign({},u,_()),D={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...f.container},x={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...f.control},W={userSelect:"none",marginStart:p,...f.label};return e.jsxs(K.label,{className:"chakra-radio",...v,__css:D,children:[e.jsx("input",{className:"chakra-radio__input",...l}),e.jsx(K.span,{className:"chakra-radio__control",...s,__css:x}),w&&e.jsx(K.span,{className:"chakra-radio__label",...P,__css:W,children:w})]})});ee.displayName="Radio";var Xe=De("cloud","IconCloud",[["path",{d:"M6.657 18c-2.572 0 -4.657 -2.007 -4.657 -4.483c0 -2.475 2.085 -4.482 4.657 -4.482c.393 -1.762 1.794 -3.2 3.675 -3.773c1.88 -.572 3.956 -.193 5.444 1c1.488 1.19 2.162 3.007 1.77 4.769h.99c1.913 0 3.464 1.56 3.464 3.486c0 1.927 -1.551 3.487 -3.465 3.487h-11.878",key:"svg-0"}]]);function Ze({options:t,value:c,onChange:r}){const[o,d]=a.useState(!1),h=a.useRef(null),f=t.find(p=>p.value===c);a.useEffect(()=>{const p=w=>{h.current&&!h.current.contains(w.target)&&d(!1)};return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[h]);const g=()=>d(!o);return e.jsxs(Pe,{position:"relative",children:[e.jsx($,{onClick:g,rightIcon:e.jsx(Re,{}),leftIcon:f==null?void 0:f.icon,children:f==null?void 0:f.label}),o&&e.jsx(_e,{gap:4,ref:h,mt:"2",shadow:"md",borderWidth:"1px",p:"2",position:"absolute",zIndex:100,children:t.map(p=>e.jsx($,{onClick:()=>{d(!1),r(p.value)},leftIcon:p.icon,justifyContent:"flex-start",variant:"ghost",width:"full",children:p.label},p.label))})]})}function eo({version:t,cloudHost:c,cloudWorkflowID:r}){const o=t,d=e.jsxs(Q,{spacing:4,alignItems:"center",children:[e.jsx(X,{children:o.name}),e.jsx(X,{color:"GrayText",children:Fe(o.createTime,!1)}),o.cloudID&&r&&e.jsx("a",{href:c+"/workflow/"+r+"/"+o.cloudID,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none"},children:e.jsx($,{size:"xs",colorScheme:"teal",variant:"outline",leftIcon:e.jsx(Xe,{}),rightIcon:e.jsx(de,{size:18}),children:"Shared"})})]});return t.cloudID?e.jsx(e.Fragment,{children:d}):e.jsx(ee,{value:o.id,mb:5,children:d},o.id)}function ho({onClose:t}){var u,I;const[c,r]=a.useState("version "+oo()),[o,d]=a.useState([]),[h,f]=a.useState(!1),[g,p]=a.useState(""),[w,C]=a.useState("PRIVATE"),[k,S]=a.useState("new_version"),b=a.useRef(""),[j,N]=a.useState(),m=Me(),E=async s=>{var W,L;const l=s.data;if(s.origin!==b.current||l.type!=="share_workflow_success")return;const P=l.localWorkflowID,v=l.localVersionID,D=l.version.id,x=l.version.workflowID;x&&P&&await((W=q)==null?void 0:W.updateMetaInfo(P,{cloudID:x,cloudOrigin:s.origin,privacy:w})),v&&D&&await((L=J)==null?void 0:L.update(v,{cloudID:D,cloudOrigin:s.origin})),R(),window.open(b.current+"/workflow/"+x+"/"+D,"_blank"),f(!1)};a.useEffect(()=>(R(),window.addEventListener("message",E),()=>{window.removeEventListener("message",E)}),[]);const R=async()=>{var P,v,D;const s=await((P=le)==null?void 0:P.getSetting("cloudHost"));s&&(p(s),b.current=s);const l=((v=q)==null?void 0:v.curWorkflow)??void 0;N(l),l!=null&&l.cloudID&&l.cloudOrigin&&Be(l).then(x=>{C(x)}),(D=J)==null||D.listByWorkflowID(l.id).then(x=>{d(x)})},H=s=>{navigator.clipboard.writeText(s).then(()=>{m({title:"Copied to clipboard",status:"success",duration:2e3,isClosable:!0})}).catch(l=>{console.error("Failed to copy text: ",l)})},_=async()=>{var G,O,F;f(!0);const s=Le(32),l=await((G=le)==null?void 0:G.getSetting("cloudHost"));let P,v;try{if(P=Te(),k==="new_version"?v=await((O=J)==null?void 0:O.add({workflowID:j.id,name:c,createTime:Date.now(),json:JSON.stringify(Oe.graph.serialize())})):v=await((F=J)==null?void 0:F.get(k)),!v){alert(`Failed to find version: ${k}, please try again.`),f(!1);return}}catch(B){console.error(B),f(!1),alert("Failed to share workflow, please try again.");return}const D=window.location.protocol,x=window.location.host,W=`${D}//${x}`,L=l+`/share_workflow_confirm/${s}?redirectUrl=${W}`,T=window.open(L,"Share Workflow","width=800,height=800"),z=B=>{var A;if(B.origin===l&&B.data==="child_ready"){const U=(A=q)==null?void 0:A.curWorkflow;T.postMessage({workflow:U,version:v,nodeDefs:P,privacy:w},l),window.removeEventListener("message",z)}};window.addEventListener("message",z)},n=(I=(u=q)==null?void 0:u.curWorkflow)==null?void 0:I.cloudID;return e.jsxs(xe,{isOpen:!0,onClose:t,size:"lg",children:[e.jsx(ye,{}),e.jsxs(Ce,{width:["98%","90%","50%"],maxWidth:"600px",children:[e.jsxs(Se,{children:['Share "',j==null?void 0:j.name,'"']}),e.jsxs(je,{pb:10,children:[e.jsxs(re,{gap:5,children:[n==null?e.jsx(Ze,{options:Ne,value:w,onChange:s=>{C(s)}}):e.jsx(Ve,{variant:"outline",borderRadius:"full",width:"fit-content",children:e.jsx(He,{privacy:w,showEmoji:!0})}),n&&e.jsxs(Q,{spacing:2,color:"teal.400",children:[e.jsxs(qe,{href:g+"/workflow/"+n,isExternal:!0,children:[g+"/workflow/"+n," ",e.jsx(de,{size:20,style:{display:"inline-block",verticalAlign:"middle"}})]}),e.jsx($,{width:"180px",size:"sm",leftIcon:e.jsx(Ke,{}),onClick:()=>{var s,l;H(g+"/workflow/"+((l=(s=q)==null?void 0:s.curWorkflow)==null?void 0:l.cloudID))},children:"Copy link"})]}),e.jsx(X,{children:"Choose a version to share:"}),e.jsx(fe,{gap:4,onChange:s=>{S(s)},value:k,children:e.jsxs(re,{children:[e.jsxs(Q,{mb:5,alignItems:"center",children:[e.jsx(ee,{value:"new_version"},"new_version"),e.jsx(Ee,{value:c,width:"60%",onFocus:()=>{S("new_version")},onChange:s=>{r(s.target.value)}}),e.jsx(We,{color:"green",children:e.jsx(ue,{colorScheme:"purple",children:"New version"})})]}),o.slice(0,4).map(s=>e.jsx(eo,{version:s,cloudHost:g,cloudWorkflowID:n??null},s.id))]})})]}),e.jsx(Q,{justifyContent:"flex-end",mt:16,children:e.jsx($,{colorScheme:"teal",onClick:_,isDisabled:h,children:h?"Sharing":"Share"})})]})]})]})}function oo(){const t=new Date,c=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0");return`${c}-${r}-${o}`}export{ho as default}; diff --git a/dist/workspace_web/chunk-JARCRF6W-yJJssWqi.js b/dist/workspace_web/chunk-JARCRF6W-we4xocqW.js similarity index 99% rename from dist/workspace_web/chunk-JARCRF6W-yJJssWqi.js rename to dist/workspace_web/chunk-JARCRF6W-we4xocqW.js index 9c700f2..2a1a23e 100644 --- a/dist/workspace_web/chunk-JARCRF6W-yJJssWqi.js +++ b/dist/workspace_web/chunk-JARCRF6W-we4xocqW.js @@ -1 +1 @@ -import{f as $,j as f,r as l,y as q,g as P,b as ue,d as W,x as fe,l as i,q as y,m as oe,a4 as J,k as me,o as he,H as ge,e as be}from"./input.js";import{av as ke}from"./App-bwnmchpl.js";import{t as ve}from"./index-pz0vT7Or.js";var X=$(function(n,e){const{htmlWidth:a,htmlHeight:c,alt:s,...d}=n;return f.jsx("img",{width:a,height:c,ref:e,alt:s,...d})});X.displayName="NativeImage";function pe(o){const{loading:n,src:e,srcSet:a,onLoad:c,onError:s,crossOrigin:d,sizes:p,ignoreFallback:C}=o,[m,g]=l.useState("pending");l.useEffect(()=>{g(e?"loading":"pending")},[e]);const u=l.useRef(),x=l.useCallback(()=>{if(!e)return;k();const r=new Image;r.src=e,d&&(r.crossOrigin=d),a&&(r.srcset=a),p&&(r.sizes=p),n&&(r.loading=n),r.onload=b=>{k(),g("loaded"),c==null||c(b)},r.onerror=b=>{k(),g("failed"),s==null||s(b)},u.current=r},[e,d,a,p,c,s,n]),k=()=>{u.current&&(u.current.onload=null,u.current.onerror=null,u.current=null)};return q(()=>{if(!C)return m==="loading"&&x(),()=>{k()}},[m,x,C]),C?"loaded":m}var Ce=(o,n)=>o!=="loaded"&&n==="beforeLoadOrError"||o==="failed"&&n==="onError";function ye(o,n=[]){const e=Object.assign({},o);for(const a of n)a in e&&delete e[a];return e}var xe=$(function(n,e){const{fallbackSrc:a,fallback:c,src:s,srcSet:d,align:p,fit:C,loading:m,ignoreFallback:g,crossOrigin:u,fallbackStrategy:x="beforeLoadOrError",referrerPolicy:k,...r}=n,b=a!==void 0||c!==void 0,R=m!=null||g||!b,_=pe({...n,crossOrigin:u,ignoreFallback:R}),A=Ce(_,x),j={ref:e,objectFit:C,objectPosition:p,...R?r:ye(r,["onError","onLoad"])};return A?c||f.jsx(P.img,{as:X,className:"chakra-image__placeholder",src:a,...j}):f.jsx(P.img,{as:X,src:s,srcSet:d,crossOrigin:u,loading:m,referrerPolicy:k,className:"chakra-image",...j})});xe.displayName="Image";var[qe,Ie]=ue({name:"CheckboxGroupContext",strict:!1});function Se(o){const[n,e]=l.useState(o),[a,c]=l.useState(!1);return o!==n&&(c(!0),e(o)),a}function we(o){return f.jsx(P.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...o,children:f.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function Pe(o){return f.jsx(P.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...o,children:f.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function je(o){const{isIndeterminate:n,isChecked:e,...a}=o,c=n?Pe:we;return e||n?f.jsx(P.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:f.jsx(c,{...a})}):null}var Fe={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function Re(o,n=[]){const e=Object.assign({},o);for(const a of n)a in e&&delete e[a];return e}function Ae(o={}){const n=ke(o),{isDisabled:e,isReadOnly:a,isRequired:c,isInvalid:s,id:d,onBlur:p,onFocus:C,"aria-describedby":m}=n,{defaultChecked:g,isChecked:u,isFocusable:x,onChange:k,isIndeterminate:r,name:b,value:R,tabIndex:_=void 0,"aria-label":A,"aria-labelledby":j,"aria-invalid":w,...z}=o,L=Re(z,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),N=W(k),O=W(p),B=W(C),[D,T]=l.useState(!1),[F,H]=l.useState(!1),[G,Q]=l.useState(!1),[M,E]=l.useState(!1);l.useEffect(()=>ve(T),[]);const I=l.useRef(null),[Y,ne]=l.useState(!0),[se,K]=l.useState(!!g),V=u!==void 0,h=V?u:se,Z=l.useCallback(t=>{if(a||e){t.preventDefault();return}V||K(h?t.target.checked:r?!0:t.target.checked),N==null||N(t)},[a,e,h,V,r,N]);q(()=>{I.current&&(I.current.indeterminate=!!r)},[r]),fe(()=>{e&&H(!1)},[e,H]),q(()=>{const t=I.current;if(!(t!=null&&t.form))return;const v=()=>{K(!!g)};return t.form.addEventListener("reset",v),()=>{var S;return(S=t.form)==null?void 0:S.removeEventListener("reset",v)}},[]);const ee=e&&!x,ae=l.useCallback(t=>{t.key===" "&&E(!0)},[E]),te=l.useCallback(t=>{t.key===" "&&E(!1)},[E]);q(()=>{if(!I.current)return;I.current.checked!==h&&K(I.current.checked)},[I.current]);const re=l.useCallback((t={},v=null)=>{const S=U=>{F&&U.preventDefault(),E(!0)};return{...t,ref:v,"data-active":i(M),"data-hover":i(G),"data-checked":i(h),"data-focus":i(F),"data-focus-visible":i(F&&D),"data-indeterminate":i(r),"data-disabled":i(e),"data-invalid":i(s),"data-readonly":i(a),"aria-hidden":!0,onMouseDown:y(t.onMouseDown,S),onMouseUp:y(t.onMouseUp,()=>E(!1)),onMouseEnter:y(t.onMouseEnter,()=>Q(!0)),onMouseLeave:y(t.onMouseLeave,()=>Q(!1))}},[M,h,e,F,D,G,r,s,a]),ie=l.useCallback((t={},v=null)=>({...t,ref:v,"data-active":i(M),"data-hover":i(G),"data-checked":i(h),"data-focus":i(F),"data-focus-visible":i(F&&D),"data-indeterminate":i(r),"data-disabled":i(e),"data-invalid":i(s),"data-readonly":i(a)}),[M,h,e,F,D,G,r,s,a]),le=l.useCallback((t={},v=null)=>({...L,...t,ref:oe(v,S=>{S&&ne(S.tagName==="LABEL")}),onClick:y(t.onClick,()=>{var S;Y||((S=I.current)==null||S.click(),requestAnimationFrame(()=>{var U;(U=I.current)==null||U.focus({preventScroll:!0})}))}),"data-disabled":i(e),"data-checked":i(h),"data-invalid":i(s)}),[L,e,h,s,Y]),ce=l.useCallback((t={},v=null)=>({...t,ref:oe(I,v),type:"checkbox",name:b,value:R,id:d,tabIndex:_,onChange:y(t.onChange,Z),onBlur:y(t.onBlur,O,()=>H(!1)),onFocus:y(t.onFocus,B,()=>H(!0)),onKeyDown:y(t.onKeyDown,ae),onKeyUp:y(t.onKeyUp,te),required:c,checked:h,disabled:ee,readOnly:a,"aria-label":A,"aria-labelledby":j,"aria-invalid":w?!!w:s,"aria-describedby":m,"aria-disabled":e,style:Fe}),[b,R,d,Z,O,B,ae,te,c,h,ee,a,A,j,w,s,m,e,_]),de=l.useCallback((t={},v=null)=>({...t,ref:v,onMouseDown:y(t.onMouseDown,_e),"data-disabled":i(e),"data-checked":i(h),"data-invalid":i(s)}),[h,e,s]);return{state:{isInvalid:s,isFocused:F,isChecked:h,isActive:M,isHovered:G,isIndeterminate:r,isDisabled:e,isReadOnly:a,isRequired:c},getRootProps:le,getCheckboxProps:re,getIndicatorProps:ie,getInputProps:ce,getLabelProps:de,htmlProps:L}}function _e(o){o.preventDefault(),o.stopPropagation()}var De={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},Ee={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},Le=J({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),Ne=J({from:{opacity:0},to:{opacity:1}}),Be=J({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Ge=$(function(n,e){const a=Ie(),c={...a,...n},s=me("Checkbox",c),d=he(n),{spacing:p="0.5rem",className:C,children:m,iconColor:g,iconSize:u,icon:x=f.jsx(je,{}),isChecked:k,isDisabled:r=a==null?void 0:a.isDisabled,onChange:b,inputProps:R,..._}=d;let A=k;a!=null&&a.value&&d.value&&(A=a.value.includes(d.value));let j=b;a!=null&&a.onChange&&d.value&&(j=ge(a.onChange,b));const{state:w,getInputProps:z,getCheckboxProps:L,getLabelProps:N,getRootProps:O}=Ae({..._,isDisabled:r,isChecked:A,onChange:j}),B=Se(w.isChecked),D=l.useMemo(()=>({animation:B?w.isIndeterminate?`${Ne} 20ms linear, ${Be} 200ms linear`:`${Le} 200ms linear`:void 0,fontSize:u,color:g,...s.icon}),[g,u,B,w.isIndeterminate,s.icon]),T=l.cloneElement(x,{__css:D,isIndeterminate:w.isIndeterminate,isChecked:w.isChecked});return f.jsxs(P.label,{__css:{...Ee,...s.container},className:be("chakra-checkbox",C),...O(),children:[f.jsx("input",{className:"chakra-checkbox__input",...z(R,e)}),f.jsx(P.span,{__css:{...De,...s.control},className:"chakra-checkbox__control",...L(),children:T}),m&&f.jsx(P.span,{className:"chakra-checkbox__label",...N(),__css:{marginStart:p,...s.label},children:m})]})});Ge.displayName="Checkbox";var Me=$(function(n,e){const{templateAreas:a,gap:c,rowGap:s,columnGap:d,column:p,row:C,autoFlow:m,autoRows:g,templateRows:u,autoColumns:x,templateColumns:k,...r}=n,b={display:"grid",gridTemplateAreas:a,gridGap:c,gridRowGap:s,gridColumnGap:d,gridAutoColumns:x,gridColumn:p,gridRow:C,gridAutoFlow:m,gridAutoRows:g,gridTemplateRows:u,gridTemplateColumns:k};return f.jsx(P.div,{ref:e,__css:b,...r})});Me.displayName="Grid";export{Ge as C,Me as G,xe as I}; +import{f as $,j as f,r as l,y as q,g as P,b as ue,d as W,x as fe,l as i,q as y,m as oe,a4 as J,k as me,o as he,H as ge,e as be}from"./input.js";import{av as ke}from"./App-7ZVFJHq5.js";import{t as ve}from"./index-pz0vT7Or.js";var X=$(function(n,e){const{htmlWidth:a,htmlHeight:c,alt:s,...d}=n;return f.jsx("img",{width:a,height:c,ref:e,alt:s,...d})});X.displayName="NativeImage";function pe(o){const{loading:n,src:e,srcSet:a,onLoad:c,onError:s,crossOrigin:d,sizes:p,ignoreFallback:C}=o,[m,g]=l.useState("pending");l.useEffect(()=>{g(e?"loading":"pending")},[e]);const u=l.useRef(),x=l.useCallback(()=>{if(!e)return;k();const r=new Image;r.src=e,d&&(r.crossOrigin=d),a&&(r.srcset=a),p&&(r.sizes=p),n&&(r.loading=n),r.onload=b=>{k(),g("loaded"),c==null||c(b)},r.onerror=b=>{k(),g("failed"),s==null||s(b)},u.current=r},[e,d,a,p,c,s,n]),k=()=>{u.current&&(u.current.onload=null,u.current.onerror=null,u.current=null)};return q(()=>{if(!C)return m==="loading"&&x(),()=>{k()}},[m,x,C]),C?"loaded":m}var Ce=(o,n)=>o!=="loaded"&&n==="beforeLoadOrError"||o==="failed"&&n==="onError";function ye(o,n=[]){const e=Object.assign({},o);for(const a of n)a in e&&delete e[a];return e}var xe=$(function(n,e){const{fallbackSrc:a,fallback:c,src:s,srcSet:d,align:p,fit:C,loading:m,ignoreFallback:g,crossOrigin:u,fallbackStrategy:x="beforeLoadOrError",referrerPolicy:k,...r}=n,b=a!==void 0||c!==void 0,R=m!=null||g||!b,_=pe({...n,crossOrigin:u,ignoreFallback:R}),A=Ce(_,x),j={ref:e,objectFit:C,objectPosition:p,...R?r:ye(r,["onError","onLoad"])};return A?c||f.jsx(P.img,{as:X,className:"chakra-image__placeholder",src:a,...j}):f.jsx(P.img,{as:X,src:s,srcSet:d,crossOrigin:u,loading:m,referrerPolicy:k,className:"chakra-image",...j})});xe.displayName="Image";var[qe,Ie]=ue({name:"CheckboxGroupContext",strict:!1});function Se(o){const[n,e]=l.useState(o),[a,c]=l.useState(!1);return o!==n&&(c(!0),e(o)),a}function we(o){return f.jsx(P.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...o,children:f.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function Pe(o){return f.jsx(P.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...o,children:f.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function je(o){const{isIndeterminate:n,isChecked:e,...a}=o,c=n?Pe:we;return e||n?f.jsx(P.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:f.jsx(c,{...a})}):null}var Fe={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function Re(o,n=[]){const e=Object.assign({},o);for(const a of n)a in e&&delete e[a];return e}function Ae(o={}){const n=ke(o),{isDisabled:e,isReadOnly:a,isRequired:c,isInvalid:s,id:d,onBlur:p,onFocus:C,"aria-describedby":m}=n,{defaultChecked:g,isChecked:u,isFocusable:x,onChange:k,isIndeterminate:r,name:b,value:R,tabIndex:_=void 0,"aria-label":A,"aria-labelledby":j,"aria-invalid":w,...z}=o,L=Re(z,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),N=W(k),O=W(p),B=W(C),[D,T]=l.useState(!1),[F,H]=l.useState(!1),[G,Q]=l.useState(!1),[M,E]=l.useState(!1);l.useEffect(()=>ve(T),[]);const I=l.useRef(null),[Y,ne]=l.useState(!0),[se,K]=l.useState(!!g),V=u!==void 0,h=V?u:se,Z=l.useCallback(t=>{if(a||e){t.preventDefault();return}V||K(h?t.target.checked:r?!0:t.target.checked),N==null||N(t)},[a,e,h,V,r,N]);q(()=>{I.current&&(I.current.indeterminate=!!r)},[r]),fe(()=>{e&&H(!1)},[e,H]),q(()=>{const t=I.current;if(!(t!=null&&t.form))return;const v=()=>{K(!!g)};return t.form.addEventListener("reset",v),()=>{var S;return(S=t.form)==null?void 0:S.removeEventListener("reset",v)}},[]);const ee=e&&!x,ae=l.useCallback(t=>{t.key===" "&&E(!0)},[E]),te=l.useCallback(t=>{t.key===" "&&E(!1)},[E]);q(()=>{if(!I.current)return;I.current.checked!==h&&K(I.current.checked)},[I.current]);const re=l.useCallback((t={},v=null)=>{const S=U=>{F&&U.preventDefault(),E(!0)};return{...t,ref:v,"data-active":i(M),"data-hover":i(G),"data-checked":i(h),"data-focus":i(F),"data-focus-visible":i(F&&D),"data-indeterminate":i(r),"data-disabled":i(e),"data-invalid":i(s),"data-readonly":i(a),"aria-hidden":!0,onMouseDown:y(t.onMouseDown,S),onMouseUp:y(t.onMouseUp,()=>E(!1)),onMouseEnter:y(t.onMouseEnter,()=>Q(!0)),onMouseLeave:y(t.onMouseLeave,()=>Q(!1))}},[M,h,e,F,D,G,r,s,a]),ie=l.useCallback((t={},v=null)=>({...t,ref:v,"data-active":i(M),"data-hover":i(G),"data-checked":i(h),"data-focus":i(F),"data-focus-visible":i(F&&D),"data-indeterminate":i(r),"data-disabled":i(e),"data-invalid":i(s),"data-readonly":i(a)}),[M,h,e,F,D,G,r,s,a]),le=l.useCallback((t={},v=null)=>({...L,...t,ref:oe(v,S=>{S&&ne(S.tagName==="LABEL")}),onClick:y(t.onClick,()=>{var S;Y||((S=I.current)==null||S.click(),requestAnimationFrame(()=>{var U;(U=I.current)==null||U.focus({preventScroll:!0})}))}),"data-disabled":i(e),"data-checked":i(h),"data-invalid":i(s)}),[L,e,h,s,Y]),ce=l.useCallback((t={},v=null)=>({...t,ref:oe(I,v),type:"checkbox",name:b,value:R,id:d,tabIndex:_,onChange:y(t.onChange,Z),onBlur:y(t.onBlur,O,()=>H(!1)),onFocus:y(t.onFocus,B,()=>H(!0)),onKeyDown:y(t.onKeyDown,ae),onKeyUp:y(t.onKeyUp,te),required:c,checked:h,disabled:ee,readOnly:a,"aria-label":A,"aria-labelledby":j,"aria-invalid":w?!!w:s,"aria-describedby":m,"aria-disabled":e,style:Fe}),[b,R,d,Z,O,B,ae,te,c,h,ee,a,A,j,w,s,m,e,_]),de=l.useCallback((t={},v=null)=>({...t,ref:v,onMouseDown:y(t.onMouseDown,_e),"data-disabled":i(e),"data-checked":i(h),"data-invalid":i(s)}),[h,e,s]);return{state:{isInvalid:s,isFocused:F,isChecked:h,isActive:M,isHovered:G,isIndeterminate:r,isDisabled:e,isReadOnly:a,isRequired:c},getRootProps:le,getCheckboxProps:re,getIndicatorProps:ie,getInputProps:ce,getLabelProps:de,htmlProps:L}}function _e(o){o.preventDefault(),o.stopPropagation()}var De={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},Ee={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},Le=J({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),Ne=J({from:{opacity:0},to:{opacity:1}}),Be=J({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Ge=$(function(n,e){const a=Ie(),c={...a,...n},s=me("Checkbox",c),d=he(n),{spacing:p="0.5rem",className:C,children:m,iconColor:g,iconSize:u,icon:x=f.jsx(je,{}),isChecked:k,isDisabled:r=a==null?void 0:a.isDisabled,onChange:b,inputProps:R,..._}=d;let A=k;a!=null&&a.value&&d.value&&(A=a.value.includes(d.value));let j=b;a!=null&&a.onChange&&d.value&&(j=ge(a.onChange,b));const{state:w,getInputProps:z,getCheckboxProps:L,getLabelProps:N,getRootProps:O}=Ae({..._,isDisabled:r,isChecked:A,onChange:j}),B=Se(w.isChecked),D=l.useMemo(()=>({animation:B?w.isIndeterminate?`${Ne} 20ms linear, ${Be} 200ms linear`:`${Le} 200ms linear`:void 0,fontSize:u,color:g,...s.icon}),[g,u,B,w.isIndeterminate,s.icon]),T=l.cloneElement(x,{__css:D,isIndeterminate:w.isIndeterminate,isChecked:w.isChecked});return f.jsxs(P.label,{__css:{...Ee,...s.container},className:be("chakra-checkbox",C),...O(),children:[f.jsx("input",{className:"chakra-checkbox__input",...z(R,e)}),f.jsx(P.span,{__css:{...De,...s.control},className:"chakra-checkbox__control",...L(),children:T}),m&&f.jsx(P.span,{className:"chakra-checkbox__label",...N(),__css:{marginStart:p,...s.label},children:m})]})});Ge.displayName="Checkbox";var Me=$(function(n,e){const{templateAreas:a,gap:c,rowGap:s,columnGap:d,column:p,row:C,autoFlow:m,autoRows:g,templateRows:u,autoColumns:x,templateColumns:k,...r}=n,b={display:"grid",gridTemplateAreas:a,gridGap:c,gridRowGap:s,gridColumnGap:d,gridAutoColumns:x,gridColumn:p,gridRow:C,gridAutoFlow:m,gridAutoRows:g,gridTemplateRows:u,gridTemplateColumns:k};return f.jsx(P.div,{ref:e,__css:b,...r})});Me.displayName="Grid";export{Ge as C,Me as G,xe as I}; diff --git a/dist/workspace_web/chunk-NTCQBYKE-X_7oODtg.js b/dist/workspace_web/chunk-NTCQBYKE-qydYN07M.js similarity index 65% rename from dist/workspace_web/chunk-NTCQBYKE-X_7oODtg.js rename to dist/workspace_web/chunk-NTCQBYKE-qydYN07M.js index 6f1ef37..c0537a3 100644 --- a/dist/workspace_web/chunk-NTCQBYKE-X_7oODtg.js +++ b/dist/workspace_web/chunk-NTCQBYKE-qydYN07M.js @@ -1 +1 @@ -import{k as t}from"./App-bwnmchpl.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{k as t}from"./App-7ZVFJHq5.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/input.js b/dist/workspace_web/input.js index 4fd2407..d1946bd 100644 --- a/dist/workspace_web/input.js +++ b/dist/workspace_web/input.js @@ -679,10 +679,10 @@ Error generating stack: `+i.message+` } ${fB} - `}),Lw=document.createElement("div");document.body.append(Lw);const pB=Ar.lazy(()=>Jk(()=>import("./App-bwnmchpl.js").then(e=>e.aE),__vite__mapDeps([0,1])).then(({default:e})=>({default:e}))),mB={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},vB=Mz({zIndices:mB});bd.createRoot(Lw).render(E.jsx(Ar.StrictMode,{children:E.jsxs(HI,{resetCSS:!1,disableGlobalStyle:!0,theme:vB,children:[E.jsx(hB,{scope:".workspace_manager"}),E.jsx(NP,{initialColorMode:"dark"}),E.jsx(dB,{children:E.jsx(S.Suspense,{children:E.jsx(pB,{})})})]})}));const Yf=document.body,gB={attributes:!0,attributeFilter:["class"]},yB=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 Yf.classList)o.includes("chakra")&&Yf.classList.remove(o)},bB=new MutationObserver(yB);bB.observe(Yf,gB);export{vL as $,DB as A,zB as B,IB as C,FB as D,zP as E,lr as F,ii as G,CB as H,Xa as I,Ip as J,PB as K,Ya as L,ww as M,Mw as N,$w as O,Na as P,Rw as Q,Fw as R,zw as S,Aw as T,Pb as U,LB as V,is as W,Ar as X,$B as Y,Du as Z,Jk as _,MB as a,rL as a0,mL as a1,Wf as a2,Ra as a3,wP as a4,SB as a5,Hn as a6,Uh as a7,xP as a8,zp as a9,xB as aa,wB as ab,_B as ac,lB as ad,uB as ae,mn as b,RB as c,d3 as d,Be as e,pt as f,_e as g,Ix as h,EB as i,E as j,eS as k,Rv as l,Bf as m,Nu as n,Ou as o,kB as p,$i as q,S as r,Xf as s,hw as t,VP as u,TB as v,Kt as w,Cg as x,ka as y,mO as z}; + `}),Lw=document.createElement("div");document.body.append(Lw);const pB=Ar.lazy(()=>Jk(()=>import("./App-7ZVFJHq5.js").then(e=>e.aE),__vite__mapDeps([0,1])).then(({default:e})=>({default:e}))),mB={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},vB=Mz({zIndices:mB});bd.createRoot(Lw).render(E.jsx(Ar.StrictMode,{children:E.jsxs(HI,{resetCSS:!1,disableGlobalStyle:!0,theme:vB,children:[E.jsx(hB,{scope:".workspace_manager"}),E.jsx(NP,{initialColorMode:"dark"}),E.jsx(dB,{children:E.jsx(S.Suspense,{children:E.jsx(pB,{})})})]})}));const Yf=document.body,gB={attributes:!0,attributeFilter:["class"]},yB=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 Yf.classList)o.includes("chakra")&&Yf.classList.remove(o)},bB=new MutationObserver(yB);bB.observe(Yf,gB);export{vL as $,DB as A,zB as B,IB as C,FB as D,zP as E,lr as F,ii as G,CB as H,Xa as I,Ip as J,PB as K,Ya as L,ww as M,Mw as N,$w as O,Na as P,Rw as Q,Fw as R,zw as S,Aw as T,Pb as U,LB as V,is as W,Ar as X,$B as Y,Du as Z,Jk as _,MB as a,rL as a0,mL as a1,Wf as a2,Ra as a3,wP as a4,SB as a5,Hn as a6,Uh as a7,xP as a8,zp as a9,xB as aa,wB as ab,_B as ac,lB as ad,uB as ae,mn as b,RB as c,d3 as d,Be as e,pt as f,_e as g,Ix as h,EB as i,E as j,eS as k,Rv as l,Bf as m,Nu as n,Ou as o,kB as p,$i as q,S as r,Xf as s,hw as t,VP as u,TB as v,Kt as w,Cg as x,ka as y,mO as z}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["workspace_web/App-bwnmchpl.js","workspace_web/assets/App-JXePnJiV.css"] + __vite__mapDeps.viteFileDeps = ["workspace_web/App-7ZVFJHq5.js","workspace_web/assets/App-JXePnJiV.css"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file