From c19b02ab21ca60b7a489ac06216d7b49c699e1c7 Mon Sep 17 00:00:00 2001
From: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
Date: Mon, 31 Oct 2022 16:18:01 +1100
Subject: [PATCH] Fixes disappearing cursor edge case
---
.../{index.5735336f.js => index.fb948d0a.js} | 2 +-
frontend/dist/index.html | 2 +-
.../tabs/Inpainting/InpaintingCanvas.tsx | 20 ++++++++++---------
.../InpaintingBoundingBoxPreview.tsx | 2 +-
4 files changed, 14 insertions(+), 12 deletions(-)
rename frontend/dist/assets/{index.5735336f.js => index.fb948d0a.js} (92%)
diff --git a/frontend/dist/assets/index.5735336f.js b/frontend/dist/assets/index.fb948d0a.js
similarity index 92%
rename from frontend/dist/assets/index.5735336f.js
rename to frontend/dist/assets/index.fb948d0a.js
index 0fc21da637..e6c6a04653 100644
--- a/frontend/dist/assets/index.5735336f.js
+++ b/frontend/dist/assets/index.fb948d0a.js
@@ -509,7 +509,7 @@ For more info see: https://github.com/konvajs/react-konva/issues/256
`,WSe=`ReactKonva: You are using "zIndex" attribute for a Konva node.
react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
For more info see: https://github.com/konvajs/react-konva/issues/194
-`,VSe={};function Ex(e,t,n=VSe){if(!jA&&"zIndex"in t&&(console.warn(WSe),jA=!0),!KA&&t.draggable){var r=t.x!==void 0||t.y!==void 0,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn(HSe),KA=!0)}for(var o in n)if(!GA[o]){var a=o.slice(0,2)==="on",s=n[o]!==t[o];if(a&&s){var l=o.substr(2).toLowerCase();l.substr(0,7)==="content"&&(l="content"+l.substr(7,1).toUpperCase()+l.substr(8)),e.off(l,n[o])}var d=!t.hasOwnProperty(o);d&&e.setAttr(o,void 0)}var p=t._useStrictMode,g={},m=!1;const y={};for(var o in t)if(!GA[o]){var a=o.slice(0,2)==="on",b=n[o]!==t[o];if(a&&b){var l=o.substr(2).toLowerCase();l.substr(0,7)==="content"&&(l="content"+l.substr(7,1).toUpperCase()+l.substr(8)),t[o]&&(y[l]=t[o])}!a&&(t[o]!==n[o]||p&&t[o]!==e.getAttr(o))&&(m=!0,g[o]=t[o])}m&&(e.setAttrs(g),Td(e));for(var l in y)e.on(l+v7,y[l])}function Td(e){if(!st.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const nH={},USe={};uh.Node.prototype._applyProps=Ex;function GSe(e,t){if(typeof t=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),Td(e)}function jSe(e,t,n){let r=uh[e];r||(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=uh.Group);const i={},o={};for(var a in t){var s=a.slice(0,2)==="on";s?o[a]=t[a]:i[a]=t[a]}const l=new r(i);return Ex(l,o),l}function KSe(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function qSe(e,t,n){return!1}function ZSe(e){return e}function YSe(){return null}function XSe(){return null}function QSe(e,t,n,r){return USe}function JSe(){}function ewe(e){}function twe(e,t){return!1}function nwe(){return nH}function rwe(){return nH}const iwe=setTimeout,owe=clearTimeout,awe=-1;function swe(e,t){return!1}const lwe=!1,uwe=!0,cwe=!0;function dwe(e,t){t.parent===e?t.moveToTop():e.add(t),Td(e)}function fwe(e,t){t.parent===e?t.moveToTop():e.add(t),Td(e)}function rH(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),Td(e)}function hwe(e,t,n){rH(e,t,n)}function pwe(e,t){t.destroy(),t.off(v7),Td(e)}function gwe(e,t){t.destroy(),t.off(v7),Td(e)}function mwe(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function vwe(e,t,n){}function ywe(e,t,n,r,i){Ex(e,i,r)}function xwe(e){e.hide(),Td(e)}function bwe(e){}function Swe(e,t){(t.visible==null||t.visible)&&e.show()}function wwe(e,t){}function Cwe(e){}function _we(){}const kwe=()=>m7.exports.DefaultEventPriority,Ewe=Object.freeze(Object.defineProperty({__proto__:null,appendInitialChild:GSe,createInstance:jSe,createTextInstance:KSe,finalizeInitialChildren:qSe,getPublicInstance:ZSe,prepareForCommit:YSe,preparePortalMount:XSe,prepareUpdate:QSe,resetAfterCommit:JSe,resetTextContent:ewe,shouldDeprioritizeSubtree:twe,getRootHostContext:nwe,getChildHostContext:rwe,scheduleTimeout:iwe,cancelTimeout:owe,noTimeout:awe,shouldSetTextContent:swe,isPrimaryRenderer:lwe,warnsIfNotActing:uwe,supportsMutation:cwe,appendChild:dwe,appendChildToContainer:fwe,insertBefore:rH,insertInContainerBefore:hwe,removeChild:pwe,removeChildFromContainer:gwe,commitTextUpdate:mwe,commitMount:vwe,commitUpdate:ywe,hideInstance:xwe,hideTextInstance:bwe,unhideInstance:Swe,unhideTextInstance:wwe,clearContainer:Cwe,detachDeletedInstance:_we,getCurrentEventPriority:kwe,now:Gp.exports.unstable_now,idlePriority:Gp.exports.unstable_IdlePriority,run:Gp.exports.unstable_runWithPriority},Symbol.toStringTag,{value:"Module"}));var Pwe=Object.defineProperty,Twe=Object.defineProperties,Lwe=Object.getOwnPropertyDescriptors,qA=Object.getOwnPropertySymbols,Awe=Object.prototype.hasOwnProperty,Iwe=Object.prototype.propertyIsEnumerable,ZA=(e,t,n)=>t in e?Pwe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,YA=(e,t)=>{for(var n in t||(t={}))Awe.call(t,n)&&ZA(e,n,t[n]);if(qA)for(var n of qA(t))Iwe.call(t,n)&&ZA(e,n,t[n]);return e},Mwe=(e,t)=>Twe(e,Lwe(t));function y7(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const i=y7(r,t,n);if(i)return i;r=t?null:r.sibling}}function iH(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const x7=iH(C.exports.createContext(null));class oH extends C.exports.Component{render(){return w(x7.Provider,{value:this._reactInternals,children:this.props.children})}}const{ReactCurrentOwner:Rwe,ReactCurrentDispatcher:Owe}=C.exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Nwe(){const e=C.exports.useContext(x7);if(!e)throw new Error("its-fine: useFiber must be called within a !");const t=C.exports.useId();return C.exports.useMemo(()=>{var r;return(r=Rwe.current)!=null?r:y7(e,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===t)return!0;o=o.next}})},[e,t])}const ug=[],XA=new WeakMap;function Dwe(){var e;const t=Nwe();ug.splice(0,ug.length),y7(t,!0,n=>{var r;const i=(r=n.type)==null?void 0:r._context;i&&i!==x7&&ug.push(iH(i))});for(const n of ug){const r=(e=Owe.current)==null?void 0:e.readContext(n);XA.set(n,r)}return C.exports.useMemo(()=>ug.reduce((n,r)=>i=>C.exports.createElement(n,null,C.exports.createElement(r.Provider,Mwe(YA({},i),{value:XA.get(r)}))),n=>w(oH,{...YA({},n)})),[])}function zwe(e){const t=le.useRef();return le.useLayoutEffect(()=>{t.current=e}),t.current}const Fwe=e=>{const t=le.useRef(),n=le.useRef(),r=le.useRef(),i=zwe(e),o=Dwe(),a=s=>{const{forwardedRef:l}=e;!l||(typeof l=="function"?l(s):l.current=s)};return le.useLayoutEffect(()=>(n.current=new uh.Stage({width:e.width,height:e.height,container:t.current}),a(n.current),r.current=Tg.createContainer(n.current,m7.exports.LegacyRoot,!1,null),Tg.updateContainer(w(o,{children:e.children}),r.current),()=>{!uh.isBrowser||(a(null),Tg.updateContainer(null,r.current,null),n.current.destroy())}),[]),le.useLayoutEffect(()=>{a(n.current),Ex(n.current,e,i),Tg.updateContainer(w(o,{children:e.children}),r.current,null)}),w("div",{ref:t,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},HS="Layer",$we="Group",IC="Rect",MC="Circle",Bwe="Line",WS="Image",Hwe="Transformer",Tg=BSe(Ewe);Tg.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:le.version,rendererPackageName:"react-konva"});const Wwe=le.forwardRef((e,t)=>w(oH,{children:w(Fwe,{...e,forwardedRef:t})})),Vwe=e=>{const{r:t,g:n,b:r,a:i}=e;return`rgba(${t}, ${n}, ${r}, ${i})`},aH=e=>{const{r:t,g:n,b:r}=e;return`rgba(${t}, ${n}, ${r})`},Uwe=an(e=>e.inpainting,e=>{const{lines:t,maskColor:n}=e;return{lines:t,maskColorString:aH(n)}}),Gwe=an([e=>e.inpainting,e=>e.options,zs],(e,t,n)=>{const{tool:r,brushSize:i,maskColor:o,shouldInvertMask:a,shouldShowMask:s,shouldShowCheckboardTransparency:l,lines:d,pastLines:p,futureLines:g,shouldShowBoundingBoxFill:m}=e,{showDualDisplay:y}=t;return{tool:r,brushSize:i,maskColor:o,shouldInvertMask:a,shouldShowMask:s,shouldShowCheckboardTransparency:l,canUndo:p.length>0,canRedo:g.length>0,isMaskEmpty:d.length===0,activeTabName:n,showDualDisplay:y,shouldShowBoundingBoxFill:m}},{memoizeOptions:{resultEqualityCheck:gn.isEqual}}),jwe=an(e=>e.inpainting,e=>{const{tool:t,brushSize:n,maskColor:r,shouldInvertMask:i,shouldShowMask:o,shouldShowCheckboardTransparency:a,imageToInpaint:s,stageScale:l,shouldShowBoundingBox:d,shouldShowBoundingBoxFill:p,isDrawing:g,shouldLockBoundingBox:m,boundingBoxDimensions:y}=e;return{tool:t,brushSize:n,shouldInvertMask:i,shouldShowMask:o,shouldShowCheckboardTransparency:a,maskColor:r,imageToInpaint:s,stageScale:l,shouldShowBoundingBox:d,shouldShowBoundingBoxFill:p,isDrawing:g,shouldLockBoundingBox:m,boundingBoxDimensions:y}},{memoizeOptions:{resultEqualityCheck:(e,t)=>{const{imageToInpaint:n,...r}=e,{imageToInpaint:i,...o}=t;return gn.isEqual(r,o)&&n==i}}}),Kwe=()=>{const{lines:e,maskColorString:t}=Ge(Uwe);return w($n,{children:e.map((n,r)=>w(Bwe,{points:n.points,stroke:t,strokeWidth:n.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:n.tool==="brush"?"source-over":"destination-out"},r))})},qwe=an(e=>e.inpainting,e=>{const{cursorPosition:t,canvasDimensions:{width:n,height:r},shouldShowBrushPreview:i,brushSize:o,maskColor:a,tool:s,shouldShowBrush:l}=e;return{cursorPosition:t,width:n,height:r,shouldShowBrushPreview:i,brushSize:o,maskColorString:aH(a),tool:s,shouldShowBrush:l}},{memoizeOptions:{resultEqualityCheck:gn.isEqual}}),Zwe=()=>{const{cursorPosition:e,width:t,height:n,shouldShowBrushPreview:r,brushSize:i,maskColorString:o,tool:a,shouldShowBrush:s}=Ge(qwe);return!s||!(e||r)?null:w(MC,{x:e?e.x:t/2,y:e?e.y:n/2,radius:i/2,fill:o,listening:!1,globalCompositeOperation:a==="eraser"?"destination-out":"source-over"})},Ywe=an(e=>e.inpainting,e=>{const{cursorPosition:t,canvasDimensions:{width:n,height:r},shouldShowBrushPreview:i,brushSize:o,stageScale:a,shouldShowBrush:s}=e;return{cursorPosition:t,width:n,height:r,shouldShowBrushPreview:i,brushSize:o,strokeWidth:1/a,shouldShowBrush:s}},{memoizeOptions:{resultEqualityCheck:gn.isEqual}}),Xwe=()=>{const{cursorPosition:e,width:t,height:n,shouldShowBrushPreview:r,brushSize:i,strokeWidth:o,shouldShowBrush:a}=Ge(Ywe);return!a||!(e||r)?null:oe($n,{children:[w(MC,{x:e?e.x:t/2,y:e?e.y:n/2,radius:i/2,stroke:"rgba(0,0,0,1)",strokeWidth:o,strokeEnabled:!0,listening:!1}),w(MC,{x:e?e.x:t/2,y:e?e.y:n/2,radius:1,fill:"rgba(0,0,0,1)",listening:!1})]})},Qwe=()=>{const{tool:e,lines:t,cursorPosition:n,brushSize:r,canvasDimensions:{width:i,height:o},maskColor:a,shouldInvertMask:s,shouldShowMask:l,shouldShowBrushPreview:d,shouldShowCheckboardTransparency:p,imageToInpaint:g,shouldShowBrush:m,shouldShowBoundingBoxFill:y,shouldLockBoundingBox:b,stageScale:S,pastLines:E,futureLines:P,needsCache:k,isDrawing:T}=Ge(M=>M.inpainting);return C.exports.useLayoutEffect(()=>{!xl.current||xl.current.cache({x:0,y:0,width:i,height:o})},[t,n,i,o,e,r,a,s,l,d,p,g,m,y,b,S,E,P,k,T]),C.exports.useEffect(()=>{const M=window.setTimeout(()=>{!xl.current||xl.current.cache({x:0,y:0,width:i,height:o})},0);return()=>{window.clearTimeout(M)}}),null},ky=e=>{const t=e.getPointerPosition(),n=e.getAbsoluteTransform().copy();if(!t||!n)return;const r=n.invert().point(t);return{x:Math.floor(r.x),y:Math.floor(r.y)}},Jwe=4,sH=an(e=>e.inpainting,e=>{const{boundingBoxCoordinate:t,boundingBoxDimensions:n,boundingBoxPreviewFill:r,canvasDimensions:i,stageScale:o,imageToInpaint:a,shouldLockBoundingBox:s}=e;return{boundingBoxCoordinate:t,boundingBoxDimensions:n,boundingBoxPreviewFillString:Vwe(r),canvasDimensions:i,stageScale:o,imageToInpaint:a,dash:Jwe/o,strokeWidth:1/o,shouldLockBoundingBox:s}},{memoizeOptions:{resultEqualityCheck:gn.isEqual}}),e6e=()=>{const{boundingBoxCoordinate:e,boundingBoxDimensions:t,boundingBoxPreviewFillString:n,canvasDimensions:r}=Ge(sH);return oe($we,{children:[w(IC,{x:0,y:0,height:r.height,width:r.width,fill:n}),w(IC,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,globalCompositeOperation:"destination-out"})]})},t6e=()=>{const e=pt(),{boundingBoxCoordinate:t,boundingBoxDimensions:n,strokeWidth:r,stageScale:i,imageToInpaint:o,shouldLockBoundingBox:a}=Ge(sH),s=C.exports.useRef(null),l=C.exports.useRef(null);C.exports.useEffect(()=>{!s.current||!l.current||(s.current.nodes([l.current]),s.current.getLayer()?.batchDraw())},[a]),C.exports.useEffect(()=>()=>{const S=Es.current?.container();!S||(S.style.cursor="none")},[a]);const d=64*i,p=C.exports.useCallback(S=>{e(XL({x:Math.floor(S.target.x()),y:Math.floor(S.target.y())}))},[e]),g=C.exports.useCallback(S=>{if(!o)return t;const{x:E,y:P}=S,k=o.width-n.width,T=o.height-n.height,M=Math.floor(gn.clamp(E,0,k*i)),N=Math.floor(gn.clamp(P,0,T*i));return{x:M,y:N}},[t,n,o,i]),m=C.exports.useCallback(()=>{if(!l.current)return;const S=l.current,E=S.scaleX(),P=S.scaleY(),k=Math.round(S.width()*E),T=Math.round(S.height()*P),M=Math.round(S.x()),N=Math.round(S.y());e(wg({width:k,height:T})),e(XL({x:M,y:N})),S.scaleX(1),S.scaleY(1)},[e]),y=C.exports.useCallback((S,E,P)=>{const k=S.x%d,T=S.y%d,M=jL(E.x,d)+k,N=jL(E.y,d)+T,z=Math.abs(E.x-M),F=Math.abs(E.y-N),$=z!o||E.width+E.x>o.width*i||E.height+E.y>o.height*i||E.x<0||E.y<0?S:E,[o,i]);return oe($n,{children:[w(IC,{x:t.x,y:t.y,width:n.width,height:n.height,ref:l,stroke:"white",strokeWidth:r,listening:!a,onMouseEnter:S=>{const E=S?.target?.getStage()?.container();!E||(E.style.cursor=a?"none":"move")},onMouseLeave:S=>{const E=S?.target?.getStage()?.container();!E||(E.style.cursor=a?"none":"default")},draggable:!a,onDragMove:p,dragBoundFunc:g,onTransform:m}),w(Hwe,{ref:s,anchorCornerRadius:3,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderStroke:"black",rotateEnabled:!1,borderEnabled:!0,flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!a,enabledAnchors:a?[]:void 0,boundBoxFunc:b,anchorDragBoundFunc:y})]})},n6e=an([e=>e.options,e=>e.inpainting,zs],(e,t,n)=>{const{shouldShowMask:r,cursorPosition:i,shouldLockBoundingBox:o}=t;return{activeTabName:n,shouldShowMask:r,isCursorOnCanvas:Boolean(i),shouldLockBoundingBox:o}},{memoizeOptions:{resultEqualityCheck:gn.isEqual}}),r6e=()=>{const e=pt(),{shouldShowMask:t,activeTabName:n,isCursorOnCanvas:r,shouldLockBoundingBox:i}=Ge(n6e),o=C.exports.useRef(!1),a=C.exports.useRef(null);return C.exports.useEffect(()=>{const s=l=>{if(!(!["x"," "].includes(l.key)||n!=="inpainting"||!t)){if(!r){a.current||(a.current=l),o.current=!1;return}if(l.stopPropagation(),l.preventDefault(),!l.repeat){if(a.current||(o.current=!0,a.current=l),!o.current&&l.type==="keyup"){o.current=!0,a.current=l;return}switch(l.key){case"x":{e(u3e());break}case" ":{if(!t)break;l.type==="keydown"&&e(Cg(!1)),e(R$(!i));break}}a.current=l,o.current=!0}}};return document.addEventListener("keydown",s),document.addEventListener("keyup",s),()=>{document.removeEventListener("keydown",s),document.removeEventListener("keyup",s)}},[e,n,t,r,i]),null};let Es,xl,z5;const i6e=()=>{const e=pt(),{tool:t,brushSize:n,shouldInvertMask:r,shouldShowMask:i,shouldShowCheckboardTransparency:o,maskColor:a,imageToInpaint:s,stageScale:l,shouldShowBoundingBox:d,shouldShowBoundingBoxFill:p,isDrawing:g,shouldLockBoundingBox:m,boundingBoxDimensions:y}=Ge(jwe),b=Cd();Es=C.exports.useRef(null),xl=C.exports.useRef(null),z5=C.exports.useRef(null);const S=C.exports.useRef({x:0,y:0}),E=C.exports.useRef(!1),[P,k]=C.exports.useState(null);C.exports.useEffect(()=>{if(s){const $=new Image;$.onload=()=>{z5.current=$,k($)},$.onerror=()=>{b({title:"Unable to Load Image",description:`Image ${s.url} failed to load`,status:"error",isClosable:!0}),e(t7())},$.src=s.url}else k(null)},[s,e,l,b]);const T=C.exports.useCallback(()=>{if(!Es.current)return;const $=ky(Es.current);!$||!xl.current||!m||(e(Cg(!0)),e(qL({tool:t,strokeWidth:n/2,points:[$.x,$.y]})))},[e,n,t,m]),M=C.exports.useCallback(()=>{if(!Es.current)return;const $=ky(Es.current);!$||(e(YL($)),!(!xl.current||!m)&&(S.current=$,g&&(E.current=!0,e(ZL([$.x,$.y])))))},[e,g,m]),N=C.exports.useCallback(()=>{if(!E.current&&g&&Es.current){const $=ky(Es.current);if(!$||!xl.current||!m)return;e(ZL([$.x,$.y]))}else E.current=!1;e(Cg(!1))},[e,g,m]),z=C.exports.useCallback(()=>{e(YL(null)),e(Cg(!1))},[e]),F=C.exports.useCallback($=>{if($.evt.buttons===1){if(!Es.current)return;const K=ky(Es.current);if(!K||!xl.current||!m)return;e(Cg(!0)),e(qL({tool:t,strokeWidth:n/2,points:[K.x,K.y]}))}},[e,n,t,m]);return oe("div",{className:"inpainting-canvas-wrapper",tabIndex:1,children:[oe("div",{className:"inpainting-alerts",children:[!i&&w("div",{style:{pointerEvents:"none"},children:"Mask Hidden (H)"}),r&&w("div",{style:{pointerEvents:"none"},children:"Mask Inverted (Shift+M)"}),!m&&w("div",{style:{pointerEvents:"none"},children:`Transforming Bounding Box ${y.width}x${y.height} (M)`})]}),P&&oe(Wwe,{width:Math.floor(P.width*l),height:Math.floor(P.height*l),scale:{x:l,y:l},onMouseDown:T,onMouseMove:M,onMouseEnter:F,onMouseUp:N,onMouseOut:z,onMouseLeave:z,style:{cursor:i?"none":"default"},className:"inpainting-canvas-stage checkerboard",ref:Es,children:[!r&&!o&&w(HS,{name:"image-layer",listening:!1,children:w(WS,{listening:!1,image:P})}),i&&oe($n,{children:[oe(HS,{name:"mask-layer",listening:!1,opacity:o||r?1:a.a,ref:xl,children:[w(Kwe,{}),m&&w(Zwe,{}),r&&w(WS,{image:P,listening:!1,globalCompositeOperation:"source-in"}),!r&&o&&w(WS,{image:P,listening:!1,globalCompositeOperation:"source-out"})]}),oe(HS,{children:[p&&d&&w(e6e,{}),d&&w(t6e,{}),m&&w(Xwe,{})]})]})]}),w(Qwe,{}),w(r6e,{})]})},o6e=()=>{const e=pt(),{needsCache:t,imageToInpaint:n}=Ge(i=>i.inpainting),r=C.exports.useRef(null);return C.exports.useLayoutEffect(()=>{window.setTimeout(()=>{if(!r.current||!n)return;const i=r.current.clientWidth,o=r.current.clientHeight,a=Math.min(1,Math.min(i/n.width,o/n.height));e(l3e(a))},0)},[e,n,t]),w("div",{ref:r,className:"inpainting-canvas-area",children:w(V0,{thickness:"2px",speed:"1s",size:"xl"})})};function a6e(e){return wt({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M14 1H3L2 2v11l1 1h11l1-1V2l-1-1zM8 13H3V2h5v11zm6 0H9V2h5v11z"}}]})(e)}function Px(){return(Px=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}function RC(e){var t=C.exports.useRef(e),n=C.exports.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var R0=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:E.buttons>0)&&i.current?o(QA(i.current,E,s.current)):S(!1)},b=function(){return S(!1)};function S(E){var P=l.current,k=OC(i.current),T=E?k.addEventListener:k.removeEventListener;T(P?"touchmove":"mousemove",y),T(P?"touchend":"mouseup",b)}return[function(E){var P=E.nativeEvent,k=i.current;if(k&&(JA(P),!function(M,N){return N&&!im(M)}(P,l.current)&&k)){if(im(P)){l.current=!0;var T=P.changedTouches||[];T.length&&(s.current=T[0].identifier)}k.focus(),o(QA(k,P,s.current)),S(!0)}},function(E){var P=E.which||E.keyCode;P<37||P>40||(E.preventDefault(),a({left:P===39?.05:P===37?-.05:0,top:P===40?.05:P===38?-.05:0}))},S]},[a,o]),p=d[0],g=d[1],m=d[2];return C.exports.useEffect(function(){return m},[m]),w("div",{...Px({},r,{onTouchStart:p,onMouseDown:p,className:"react-colorful__interactive",ref:i,onKeyDown:g,tabIndex:0,role:"slider"})})}),Tx=function(e){return e.filter(Boolean).join(" ")},S7=function(e){var t=e.color,n=e.left,r=e.top,i=r===void 0?.5:r,o=Tx(["react-colorful__pointer",e.className]);return w("div",{className:o,style:{top:100*i+"%",left:100*n+"%"},children:w("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}})})},mo=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},uH=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:mo(e.h),s:mo(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:mo(i/2),a:mo(r,2)}},NC=function(e){var t=uH(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},VS=function(e){var t=uH(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},s6e=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var o=Math.floor(t),a=r*(1-n),s=r*(1-(t-o)*n),l=r*(1-(1-t+o)*n),d=o%6;return{r:mo(255*[r,s,a,a,l,r][d]),g:mo(255*[l,r,r,s,a,a][d]),b:mo(255*[a,a,l,r,r,s][d]),a:mo(i,2)}},l6e=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,o=Math.max(t,n,r),a=o-Math.min(t,n,r),s=a?o===t?(n-r)/a:o===n?2+(r-t)/a:4+(t-n)/a:0;return{h:mo(60*(s<0?s+6:s)),s:mo(o?a/o*100:0),v:mo(o/255*100),a:i}},u6e=le.memo(function(e){var t=e.hue,n=e.onChange,r=Tx(["react-colorful__hue",e.className]);return le.createElement("div",{className:r},le.createElement(b7,{onMove:function(i){n({h:360*i.left})},onKey:function(i){n({h:R0(t+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":mo(t),"aria-valuemax":"360","aria-valuemin":"0"},le.createElement(S7,{className:"react-colorful__hue-pointer",left:t/360,color:NC({h:t,s:100,v:100,a:1})})))}),c6e=le.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:NC({h:t.h,s:100,v:100,a:1})};return le.createElement("div",{className:"react-colorful__saturation",style:r},le.createElement(b7,{onMove:function(i){n({s:100*i.left,v:100-100*i.top})},onKey:function(i){n({s:R0(t.s+100*i.left,0,100),v:R0(t.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+mo(t.s)+"%, Brightness "+mo(t.v)+"%"},le.createElement(S7,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:NC(t)})))}),cH=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function d6e(e,t,n){var r=RC(n),i=C.exports.useState(function(){return e.toHsva(t)}),o=i[0],a=i[1],s=C.exports.useRef({color:t,hsva:o});C.exports.useEffect(function(){if(!e.equal(t,s.current.color)){var d=e.toHsva(t);s.current={hsva:d,color:t},a(d)}},[t,e]),C.exports.useEffect(function(){var d;cH(o,s.current.hsva)||e.equal(d=e.fromHsva(o),s.current.color)||(s.current={hsva:o,color:d},r(d))},[o,e,r]);var l=C.exports.useCallback(function(d){a(function(p){return Object.assign({},p,d)})},[]);return[o,l]}var f6e=typeof window<"u"?C.exports.useLayoutEffect:C.exports.useEffect,h6e=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},eI=new Map,p6e=function(e){f6e(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!eI.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,eI.set(t,n);var r=h6e();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},g6e=function(e){var t=e.className,n=e.hsva,r=e.onChange,i={backgroundImage:"linear-gradient(90deg, "+VS(Object.assign({},n,{a:0}))+", "+VS(Object.assign({},n,{a:1}))+")"},o=Tx(["react-colorful__alpha",t]),a=mo(100*n.a);return le.createElement("div",{className:o},w("div",{className:"react-colorful__alpha-gradient",style:i}),le.createElement(b7,{onMove:function(s){r({a:s.left})},onKey:function(s){r({a:R0(n.a+s.left)})},"aria-label":"Alpha","aria-valuetext":a+"%","aria-valuenow":a,"aria-valuemin":"0","aria-valuemax":"100"},le.createElement(S7,{className:"react-colorful__alpha-pointer",left:n.a,color:VS(n)})))},m6e=function(e){var t=e.className,n=e.colorModel,r=e.color,i=r===void 0?n.defaultColor:r,o=e.onChange,a=lH(e,["className","colorModel","color","onChange"]),s=C.exports.useRef(null);p6e(s);var l=d6e(n,i,o),d=l[0],p=l[1],g=Tx(["react-colorful",t]);return le.createElement("div",Px({},a,{ref:s,className:g}),w(c6e,{hsva:d,onChange:p}),w(u6e,{hue:d.h,onChange:p}),le.createElement(g6e,{hsva:d,onChange:p,className:"react-colorful__last-control"}))},v6e={defaultColor:{r:0,g:0,b:0,a:1},toHsva:l6e,fromHsva:s6e,equal:cH},y6e=function(e){return le.createElement(m6e,Px({},e,{colorModel:v6e}))};const x6e=e=>{const{styleClass:t,...n}=e;return w(y6e,{className:`invokeai__color-picker ${t}`,...n})},b6e=()=>{const{tool:e,brushSize:t,maskColor:n,shouldInvertMask:r,shouldShowMask:i,canUndo:o,canRedo:a,isMaskEmpty:s,activeTabName:l,showDualDisplay:d}=Ge(Gwe),p=pt(),g=Cd(),[m,y]=C.exports.useState(!1);Bt("[",Z=>{Z.preventDefault(),t-5>0?P(t-5):P(1)},{enabled:l==="inpainting"&&i},[l,i,t]),Bt("]",Z=>{Z.preventDefault(),P(t+5)},{enabled:l==="inpainting"&&i},[l,i,t]),Bt("shift+[",Z=>{Z.preventDefault(),z({...n,a:Math.max(n.a-.05,0)})},{enabled:l==="inpainting"&&i},[l,i,n.a]),Bt("shift+]",Z=>{Z.preventDefault(),z({...n,a:Math.min(n.a+.05,100)})},{enabled:l==="inpainting"&&i},[l,i,n.a]),Bt("e",Z=>{Z.preventDefault(),!(l!=="inpainting"||!i)&&S()},{enabled:l==="inpainting"&&i},[l,i]),Bt("b",Z=>{Z.preventDefault(),E()},{enabled:l==="inpainting"&&i},[l,i]),Bt("m",Z=>{Z.preventDefault(),p(g3e())},{enabled:l==="inpainting"&&i},[l,i]),Bt("cmd+z, control+z",Z=>{Z.preventDefault(),F()},{enabled:l==="inpainting"&&i&&o},[l,i,o]),Bt("cmd+shift+z, control+shift+z, control+y, cmd+y",Z=>{Z.preventDefault(),$()},{enabled:l==="inpainting"&&i&&a},[l,i,a]),Bt("h",Z=>{Z.preventDefault(),k()},{enabled:l==="inpainting"},[l,i]),Bt("shift+m",Z=>{Z.preventDefault(),T()},{enabled:l==="inpainting"&&i},[l,r,i]),Bt("shift+c",Z=>{Z.preventDefault(),b(),g({title:"Mask Cleared",status:"success",duration:2500,isClosable:!0})},{enabled:l==="inpainting"&&i&&!s},[l,s,i]),Bt("shift+j",()=>{K()},[d]);const b=()=>{p(o3e())},S=()=>p(KL("eraser")),E=()=>p(KL("brush")),P=Z=>{p(ES(!0)),p(t3e(Z))},k=()=>p(r3e(!i)),T=()=>p(n3e(!r)),M=()=>{p(ES(!0))},N=()=>{p(ES(!1))},z=Z=>{p(i3e(Z))},F=()=>p(a3e()),$=()=>p(s3e()),K=()=>{p(W6e(!d)),p(qf(!0))};return oe("div",{className:"inpainting-settings",children:[oe("div",{className:"inpainting-buttons-group",children:[w(u3,{trigger:"hover",onOpen:M,onClose:N,triggerComponent:w(pn,{"aria-label":"Brush (B)",tooltip:"Brush (B)",icon:w(x$,{}),onClick:E,"data-selected":e==="brush",isDisabled:!i}),children:oe("div",{className:"inpainting-slider-numberinput",children:[w(N5,{label:"Brush Size",value:t,onChange:P,min:1,max:200,width:"100px",focusThumbOnChange:!1,isDisabled:!i}),w(yo,{value:t,onChange:P,width:"80px",min:1,max:999,isDisabled:!i})]})}),w(pn,{"aria-label":"Eraser (E)",tooltip:"Eraser (E)",icon:w(Sye,{}),onClick:S,"data-selected":e==="eraser",isDisabled:!i})]}),oe("div",{className:"inpainting-buttons-group",children:[w(u3,{trigger:"click",onOpen:()=>y(!0),onClose:()=>y(!1),triggerComponent:w(pn,{"aria-label":"Mask Options",tooltip:"Mask Options",icon:w(Cye,{}),cursor:"pointer",isDisabled:s,"data-selected":m}),children:oe("div",{className:"inpainting-button-dropdown",children:[w(pn,{"aria-label":"Hide/Show Mask (H)",tooltip:"Hide/Show Mask (H)","data-selected":!i,icon:i?w(wB,{size:22}):w(SB,{size:22}),onClick:k}),w(pn,{tooltip:"Invert Mask Display (Shift+M)","aria-label":"Invert Mask Display (Shift+M)","data-selected":r,icon:r?w(tye,{size:22}):w(iye,{size:22}),onClick:T,isDisabled:!i}),w(u3,{trigger:"hover",placement:"right",styleClass:"inpainting-color-picker",triggerComponent:w(pn,{"aria-label":"Mask Color",tooltip:"Mask Color",icon:w(Eye,{}),isDisabled:!i,cursor:"pointer"}),children:w(x6e,{color:n,onChange:z})})]})}),w(pn,{"aria-label":"Clear Mask (Shift+C)",tooltip:"Clear Mask (Shift+C)",icon:w(Tye,{size:18,style:{transform:"rotate(45deg)"}}),onClick:b,isDisabled:s||!i})]}),oe("div",{className:"inpainting-buttons-group",children:[w(pn,{"aria-label":"Undo",tooltip:"Undo",icon:w(Nye,{}),onClick:F,isDisabled:!o||!i}),w(pn,{"aria-label":"Redo",tooltip:"Redo",icon:w(Aye,{}),onClick:$,isDisabled:!a||!i})]}),w("div",{className:"inpainting-buttons-group",children:w(pn,{"aria-label":"Clear Image",tooltip:"Clear Image",icon:w(Oye,{size:16}),onClick:()=>{p(t7())}})}),w(pn,{"aria-label":"Split Layout (Shift+J)",tooltip:"Split Layout (Shift+J)",icon:w(a6e,{}),"data-selected":d,onClick:K})]})},S6e=an([e=>e.inpainting,e=>e.options],(e,t)=>{const{needsCache:n,imageToInpaint:r}=e,{showDualDisplay:i}=t;return{needsCache:n,showDualDisplay:i,imageToInpaint:r}},{memoizeOptions:{resultEqualityCheck:gn.isEqual}}),w6e=()=>{const e=pt(),{showDualDisplay:t,needsCache:n,imageToInpaint:r}=Ge(S6e);return C.exports.useLayoutEffect(()=>{const o=gn.debounce(()=>e(qf(!0)),250);return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[e]),oe("div",{className:t?"workarea-split-view":"workarea-single-view",children:[oe("div",{className:"workarea-split-view-left",children:[r?oe("div",{className:"inpainting-main-area",children:[w(b6e,{}),w("div",{className:"inpainting-canvas-area",children:n?w(o6e,{}):w(i6e,{})})]}):w(N$,{})," "]}),t&&w("div",{className:"workarea-split-view-right",children:w(r7,{})})]})};function C6e(){return w(c7,{optionsPanel:w(Txe,{}),styleClass:"inpainting-workarea-overrides",children:w(w6e,{})})}function _6e(){const e=Ge(n=>n.options.showAdvancedOptions),t={seed:{header:w(V_,{}),feature:go.SEED,options:w(U_,{})},variations:{header:w(j_,{}),feature:go.VARIATIONS,options:w(K_,{})},face_restore:{header:w(B_,{}),feature:go.FACE_CORRECTION,options:w(gx,{})},upscale:{header:w(G_,{}),feature:go.UPSCALE,options:w(mx,{})},other:{header:w(l$,{}),feature:go.OTHER,options:w(u$,{})}};return oe(n7,{children:[w(J_,{}),w(Q_,{}),w(Y_,{}),w(q_,{}),e?w(X_,{accordionInfo:t}):null]})}const k6e=()=>w("div",{className:"workarea-single-view",children:w("div",{className:"text-to-image-area",children:w(r7,{})})});function E6e(){return w(c7,{optionsPanel:w(_6e,{}),children:w(k6e,{})})}const Ep={txt2img:{title:w(f2e,{fill:"black",boxSize:"2.5rem"}),workarea:w(E6e,{}),tooltip:"Text To Image"},img2img:{title:w(s2e,{fill:"black",boxSize:"2.5rem"}),workarea:w(Cxe,{}),tooltip:"Image To Image"},inpainting:{title:w(l2e,{fill:"black",boxSize:"2.5rem"}),workarea:w(C6e,{}),tooltip:"Inpainting"},outpainting:{title:w(c2e,{fill:"black",boxSize:"2.5rem"}),workarea:w(o2e,{}),tooltip:"Outpainting"},nodes:{title:w(u2e,{fill:"black",boxSize:"2.5rem"}),workarea:w(i2e,{}),tooltip:"Nodes"},postprocess:{title:w(d2e,{fill:"black",boxSize:"2.5rem"}),workarea:w(a2e,{}),tooltip:"Post Processing"}},Lv=gn.map(Ep,(e,t)=>t);[...Lv];function P6e(){const e=Ge(i=>i.options.activeTab),t=pt();Bt("1",()=>{t(Va(0))}),Bt("2",()=>{t(Va(1))}),Bt("3",()=>{t(Va(2))}),Bt("4",()=>{t(Va(3))}),Bt("5",()=>{t(Va(4))}),Bt("6",()=>{t(Va(5))});const n=()=>{const i=[];return Object.keys(Ep).forEach(o=>{i.push(w(ii,{hasArrow:!0,label:Ep[o].tooltip,placement:"right",children:w(uF,{children:Ep[o].title})},o))}),i},r=()=>{const i=[];return Object.keys(Ep).forEach(o=>{i.push(w(sF,{className:"app-tabs-panel",children:Ep[o].workarea},o))}),i};return oe(aF,{isLazy:!0,className:"app-tabs",variant:"unstyled",defaultIndex:e,index:e,onChange:i=>{t(Va(i))},children:[w("div",{className:"app-tabs-list",children:n()}),w(lF,{className:"app-tabs-panels",children:r()})]})}const dH={prompt:"",iterations:1,steps:50,cfgScale:7.5,height:512,width:512,sampler:"k_lms",threshold:0,perlin:0,seed:0,seamless:!1,hiresFix:!1,img2imgStrength:.75,maskPath:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,variationAmount:.1,seedWeights:"",shouldRunESRGAN:!1,upscalingLevel:4,upscalingStrength:.75,shouldRunFacetool:!1,facetoolStrength:.8,facetoolType:"gfpgan",codeformerFidelity:.75,shouldRandomizeSeed:!0,showAdvancedOptions:!0,activeTab:0,shouldShowImageDetails:!1,showDualDisplay:!0,shouldShowOptionsPanel:!0,shouldPinOptionsPanel:!0,optionsPanelScrollPosition:0,shouldHoldOptionsPanelOpen:!1,shouldLoopback:!0},T6e=dH,fH=nx({name:"options",initialState:T6e,reducers:{setPrompt:(e,t)=>{const n=t.payload;typeof n=="string"?e.prompt=n:e.prompt=s3(n)},setIterations:(e,t)=>{e.iterations=t.payload},setSteps:(e,t)=>{e.steps=t.payload},setCfgScale:(e,t)=>{e.cfgScale=t.payload},setThreshold:(e,t)=>{e.threshold=t.payload},setPerlin:(e,t)=>{e.perlin=t.payload},setHeight:(e,t)=>{e.height=t.payload},setWidth:(e,t)=>{e.width=t.payload},setSampler:(e,t)=>{e.sampler=t.payload},setSeed:(e,t)=>{e.seed=t.payload,e.shouldRandomizeSeed=!1},setImg2imgStrength:(e,t)=>{e.img2imgStrength=t.payload},setFacetoolStrength:(e,t)=>{e.facetoolStrength=t.payload},setCodeformerFidelity:(e,t)=>{e.codeformerFidelity=t.payload},setUpscalingLevel:(e,t)=>{e.upscalingLevel=t.payload},setUpscalingStrength:(e,t)=>{e.upscalingStrength=t.payload},setMaskPath:(e,t)=>{e.maskPath=t.payload},setSeamless:(e,t)=>{e.seamless=t.payload},setHiresFix:(e,t)=>{e.hiresFix=t.payload},setShouldFitToWidthHeight:(e,t)=>{e.shouldFitToWidthHeight=t.payload},resetSeed:e=>{e.seed=-1},setParameter:(e,t)=>{const{key:n,value:r}=t.payload,i={...e,[n]:r};return n==="seed"&&(i.shouldRandomizeSeed=!1),i},setShouldGenerateVariations:(e,t)=>{e.shouldGenerateVariations=t.payload},setVariationAmount:(e,t)=>{e.variationAmount=t.payload},setSeedWeights:(e,t)=>{e.seedWeights=t.payload},setAllTextToImageParameters:(e,t)=>{const{sampler:n,prompt:r,seed:i,variations:o,steps:a,cfg_scale:s,threshold:l,perlin:d,seamless:p,hires_fix:g,width:m,height:y}=t.payload.image;o&&o.length>0?(e.seedWeights=E5(o),e.shouldGenerateVariations=!0):e.shouldGenerateVariations=!1,i&&(e.seed=i,e.shouldRandomizeSeed=!1),r&&(e.prompt=s3(r)),n&&(e.sampler=n),a&&(e.steps=a),s&&(e.cfgScale=s),l&&(e.threshold=l),typeof l>"u"&&(e.threshold=0),d&&(e.perlin=d),typeof d>"u"&&(e.perlin=0),typeof p=="boolean"&&(e.seamless=p),typeof g=="boolean"&&(e.hiresFix=g),m&&(e.width=m),y&&(e.height=y)},setAllImageToImageParameters:(e,t)=>{const{type:n,strength:r,fit:i,init_image_path:o,mask_image_path:a}=t.payload.image;n==="img2img"&&(o&&(e.initialImage=o),a&&(e.maskPath=a),r&&(e.img2imgStrength=r),typeof i=="boolean"&&(e.shouldFitToWidthHeight=i))},setAllParameters:(e,t)=>{const{type:n,sampler:r,prompt:i,seed:o,variations:a,steps:s,cfg_scale:l,threshold:d,perlin:p,seamless:g,hires_fix:m,width:y,height:b,strength:S,fit:E,init_image_path:P,mask_image_path:k}=t.payload.image;n==="img2img"&&(P&&(e.initialImage=P),k&&(e.maskPath=k),S&&(e.img2imgStrength=S),typeof E=="boolean"&&(e.shouldFitToWidthHeight=E)),a&&a.length>0?(e.seedWeights=E5(a),e.shouldGenerateVariations=!0):e.shouldGenerateVariations=!1,o&&(e.seed=o,e.shouldRandomizeSeed=!1),i&&(e.prompt=s3(i)),r&&(e.sampler=r),s&&(e.steps=s),l&&(e.cfgScale=l),d&&(e.threshold=d),typeof d>"u"&&(e.threshold=0),p&&(e.perlin=p),typeof p>"u"&&(e.perlin=0),typeof g=="boolean"&&(e.seamless=g),typeof m=="boolean"&&(e.hiresFix=m),y&&(e.width=y),b&&(e.height=b)},resetOptionsState:e=>({...e,...dH}),setShouldRunFacetool:(e,t)=>{e.shouldRunFacetool=t.payload},setFacetoolType:(e,t)=>{e.facetoolType=t.payload},setShouldRunESRGAN:(e,t)=>{e.shouldRunESRGAN=t.payload},setShouldRandomizeSeed:(e,t)=>{e.shouldRandomizeSeed=t.payload},setShowAdvancedOptions:(e,t)=>{e.showAdvancedOptions=t.payload},setActiveTab:(e,t)=>{typeof t.payload=="number"?e.activeTab=t.payload:e.activeTab=Lv.indexOf(t.payload)},setShouldShowImageDetails:(e,t)=>{e.shouldShowImageDetails=t.payload},setShowDualDisplay:(e,t)=>{e.showDualDisplay=t.payload},setInitialImage:(e,t)=>{e.initialImage=t.payload},clearInitialImage:e=>{e.initialImage=void 0},setShouldPinOptionsPanel:(e,t)=>{e.shouldPinOptionsPanel=t.payload},setShouldShowOptionsPanel:(e,t)=>{e.shouldShowOptionsPanel=t.payload},setOptionsPanelScrollPosition:(e,t)=>{e.optionsPanelScrollPosition=t.payload},setShouldHoldOptionsPanelOpen:(e,t)=>{e.shouldHoldOptionsPanelOpen=t.payload},setShouldLoopback:(e,t)=>{e.shouldLoopback=t.payload}}}),{setPrompt:w7,setIterations:L6e,setSteps:hH,setCfgScale:pH,setThreshold:A6e,setPerlin:I6e,setHeight:gH,setWidth:mH,setSampler:vH,setSeed:Av,setSeamless:yH,setHiresFix:xH,setImg2imgStrength:bH,setFacetoolStrength:p3,setFacetoolType:g3,setCodeformerFidelity:SH,setUpscalingLevel:DC,setUpscalingStrength:zC,setMaskPath:FC,resetSeed:F8e,resetOptionsState:$8e,setShouldFitToWidthHeight:wH,setParameter:B8e,setShouldGenerateVariations:M6e,setSeedWeights:CH,setVariationAmount:R6e,setAllParameters:O6e,setShouldRunFacetool:N6e,setShouldRunESRGAN:D6e,setShouldRandomizeSeed:z6e,setShowAdvancedOptions:F6e,setActiveTab:Va,setShouldShowImageDetails:$6e,setAllTextToImageParameters:B6e,setAllImageToImageParameters:H6e,setShowDualDisplay:W6e,setInitialImage:Xm,clearInitialImage:$C,setShouldShowOptionsPanel:BC,setShouldPinOptionsPanel:V6e,setOptionsPanelScrollPosition:U6e,setShouldHoldOptionsPanelOpen:G6e,setShouldLoopback:j6e}=fH.actions,K6e=fH.reducer,Fl=Object.create(null);Fl.open="0";Fl.close="1";Fl.ping="2";Fl.pong="3";Fl.message="4";Fl.upgrade="5";Fl.noop="6";const m3=Object.create(null);Object.keys(Fl).forEach(e=>{m3[Fl[e]]=e});const q6e={type:"error",data:"parser error"},Z6e=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Y6e=typeof ArrayBuffer=="function",X6e=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,_H=({type:e,data:t},n,r)=>Z6e&&t instanceof Blob?n?r(t):tI(t,r):Y6e&&(t instanceof ArrayBuffer||X6e(t))?n?r(t):tI(new Blob([t]),r):r(Fl[e]+(t||"")),tI=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+r)},n.readAsDataURL(e)},nI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,o,a,s,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const d=new ArrayBuffer(t),p=new Uint8Array(d);for(r=0;r>4,p[i++]=(a&15)<<4|s>>2,p[i++]=(s&3)<<6|l&63;return d},J6e=typeof ArrayBuffer=="function",kH=(e,t)=>{if(typeof e!="string")return{type:"message",data:EH(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:eCe(e.substring(1),t)}:m3[n]?e.length>1?{type:m3[n],data:e.substring(1)}:{type:m3[n]}:q6e},eCe=(e,t)=>{if(J6e){const n=Q6e(e);return EH(n,t)}else return{base64:!0,data:e}},EH=(e,t)=>{switch(t){case"blob":return e instanceof ArrayBuffer?new Blob([e]):e;case"arraybuffer":default:return e}},PH=String.fromCharCode(30),tCe=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{_H(o,!1,s=>{r[a]=s,++i===n&&t(r.join(PH))})})},nCe=(e,t)=>{const n=e.split(PH),r=[];for(let i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function LH(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const iCe=setTimeout,oCe=clearTimeout;function Lx(e,t){t.useNativeTimers?(e.setTimeoutFn=iCe.bind(Yc),e.clearTimeoutFn=oCe.bind(Yc)):(e.setTimeoutFn=setTimeout.bind(Yc),e.clearTimeoutFn=clearTimeout.bind(Yc))}const aCe=1.33;function sCe(e){return typeof e=="string"?lCe(e):Math.ceil((e.byteLength||e.size)*aCe)}function lCe(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}class uCe extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class AH extends Yr{constructor(t){super(),this.writable=!1,Lx(this,t),this.opts=t,this.query=t.query,this.readyState="",this.socket=t.socket}onError(t,n,r){return super.emitReserved("error",new uCe(t,n,r)),this}open(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=kH(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}}const IH="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),HC=64,cCe={};let rI=0,Ey=0,iI;function oI(e){let t="";do t=IH[e%HC]+t,e=Math.floor(e/HC);while(e>0);return t}function MH(){const e=oI(+new Date);return e!==iI?(rI=0,iI=e):e+"."+oI(rI++)}for(;Ey{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};nCe(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,tCe(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.query||{};const n=this.opts.secure?"https":"http";let r="";this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=MH()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.opts.port&&(n==="https"&&Number(this.opts.port)!==443||n==="http"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port);const i=RH(t),o=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(o?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}request(t={}){return Object.assign(t,{xd:this.xd,xs:this.xs},this.opts),new Rl(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Rl extends Yr{constructor(t,n){super(),Lx(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.async=n.async!==!1,this.data=n.data!==void 0?n.data:null,this.create()}create(){const t=LH(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd,t.xscheme=!!this.opts.xs;const n=this.xhr=new NH(t);try{n.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{n.readyState===4&&(n.status===200||n.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof n.status=="number"?n.status:0)},0))},n.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=Rl.requestsCount++,Rl.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=hCe,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Rl.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}Rl.requestsCount=0;Rl.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",aI);else if(typeof addEventListener=="function"){const e="onpagehide"in Yc?"pagehide":"unload";addEventListener(e,aI,!1)}}function aI(){for(let e in Rl.requests)Rl.requests.hasOwnProperty(e)&&Rl.requests[e].abort()}const mCe=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),Py=Yc.WebSocket||Yc.MozWebSocket,sI=!0,vCe="arraybuffer",lI=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class yCe extends AH{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=lI?{}:LH(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=sI&&!lI?n?new Py(t,n):new Py(t):new Py(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType||vCe,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const a={};try{sI&&this.ws.send(o)}catch{}i&&mCe(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let t=this.query||{};const n=this.opts.secure?"wss":"ws";let r="";this.opts.port&&(n==="wss"&&Number(this.opts.port)!==443||n==="ws"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port),this.opts.timestampRequests&&(t[this.opts.timestampParam]=MH()),this.supportsBinary||(t.b64=1);const i=RH(t),o=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(o?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}check(){return!!Py}}const xCe={websocket:yCe,polling:gCe},bCe=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,SCe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function WC(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=bCe.exec(e||""),o={},a=14;for(;a--;)o[SCe[a]]=i[a]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=wCe(o,o.path),o.queryKey=CCe(o,o.query),o}function wCe(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.substr(0,1)=="/"||t.length===0)&&r.splice(0,1),t.substr(t.length-1,1)=="/"&&r.splice(r.length-1,1),r}function CCe(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}class Uc extends Yr{constructor(t,n={}){super(),t&&typeof t=="object"&&(n=t,t=null),t?(t=WC(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=WC(n.host).host),Lx(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},n),this.opts.path=this.opts.path.replace(/\/$/,"")+"/",typeof this.opts.query=="string"&&(this.opts.query=dCe(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&addEventListener("beforeunload",()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},!1),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=TH,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts.transportOptions[t],this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new xCe[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Uc.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;Uc.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",g=>{if(!r)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Uc.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=n.name,this.emitReserved("upgradeError",m)}}))};function o(){r||(r=!0,p(),n.close(),n=null)}const a=g=>{const m=new Error("probe error: "+g);m.transport=n.name,o(),this.emitReserved("upgradeError",m)};function s(){a("transport closed")}function l(){a("socket closed")}function d(g){n&&g.name!==n.name&&o()}const p=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",s),this.off("close",l),this.off("upgrading",d)};n.once("open",i),n.once("error",a),n.once("close",s),this.once("close",l),this.once("upgrading",d),n.open()}onOpen(){if(this.readyState="open",Uc.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade&&this.transport.pause){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){Uc.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&removeEventListener("offline",this.offlineEventListener,!1),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,DH=Object.prototype.toString,PCe=typeof Blob=="function"||typeof Blob<"u"&&DH.call(Blob)==="[object BlobConstructor]",TCe=typeof File=="function"||typeof File<"u"&&DH.call(File)==="[object FileConstructor]";function C7(e){return kCe&&(e instanceof ArrayBuffer||ECe(e))||PCe&&e instanceof Blob||TCe&&e instanceof File}function v3(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num0;case on.ACK:case on.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}class RCe{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=ACe(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const OCe=Object.freeze(Object.defineProperty({__proto__:null,protocol:ICe,get PacketType(){return on},Encoder:MCe,Decoder:_7},Symbol.toStringTag,{value:"Module"}));function Ls(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const NCe=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class zH extends Yr{constructor(t,n,r){super(),this.connected=!1,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Ls(t,"open",this.onopen.bind(this)),Ls(t,"packet",this.onpacket.bind(this)),Ls(t,"error",this.onerror.bind(this)),Ls(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){if(NCe.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');n.unshift(t);const r={type:on.EVENT,data:n};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const a=this.ids++,s=n.pop();this._registerAckCallback(a,s),r.id=a}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(t,n){const r=this.flags.timeout;if(r===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let o=0;o{this.io.clearTimeoutFn(i),n.apply(this,[null,...o])}}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this.packet({type:on.CONNECT,data:t})}):this.packet({type:on.CONNECT,data:this.auth})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case on.CONNECT:if(t.data&&t.data.sid){const i=t.data.sid;this.onconnect(i)}else this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case on.EVENT:case on.BINARY_EVENT:this.onevent(t);break;case on.ACK:case on.BINARY_ACK:this.onack(t);break;case on.DISCONNECT:this.ondisconnect();break;case on.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t)}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:on.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t){this.id=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:on.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}J0.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};J0.prototype.reset=function(){this.attempts=0};J0.prototype.setMin=function(e){this.ms=e};J0.prototype.setMax=function(e){this.max=e};J0.prototype.setJitter=function(e){this.jitter=e};class GC extends Yr{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Lx(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new J0({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||OCe;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Uc(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Ls(n,"open",function(){r.onopen(),t&&t()}),o=Ls(n,"error",a=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",a),t?t(a):r.maybeReconnectOnOpen()});if(this._timeout!==!1){const a=this._timeout;a===0&&i();const s=this.setTimeoutFn(()=>{i(),n.close(),n.emit("error",new Error("timeout"))},a);this.opts.autoUnref&&s.unref(),this.subs.push(function(){clearTimeout(s)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ls(t,"ping",this.onping.bind(this)),Ls(t,"data",this.ondata.bind(this)),Ls(t,"error",this.onerror.bind(this)),Ls(t,"close",this.onclose.bind(this)),Ls(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch{this.onclose("parse error")}}ondecoded(t){this.emitReserved("packet",t)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r||(r=new zH(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(function(){clearTimeout(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const cg={};function y3(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=_Ce(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=cg[i]&&o in cg[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let l;return s?l=new GC(r,t):(cg[i]||(cg[i]=new GC(r,t)),l=cg[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(y3,{Manager:GC,Socket:zH,io:y3,connect:y3});let Ty;const DCe=new Uint8Array(16);function zCe(){if(!Ty&&(Ty=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ty))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ty(DCe)}const Ai=[];for(let e=0;e<256;++e)Ai.push((e+256).toString(16).slice(1));function FCe(e,t=0){return(Ai[e[t+0]]+Ai[e[t+1]]+Ai[e[t+2]]+Ai[e[t+3]]+"-"+Ai[e[t+4]]+Ai[e[t+5]]+"-"+Ai[e[t+6]]+Ai[e[t+7]]+"-"+Ai[e[t+8]]+Ai[e[t+9]]+"-"+Ai[e[t+10]]+Ai[e[t+11]]+Ai[e[t+12]]+Ai[e[t+13]]+Ai[e[t+14]]+Ai[e[t+15]]).toLowerCase()}const $Ce=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),uI={randomUUID:$Ce};function dg(e,t,n){if(uI.randomUUID&&!t&&!e)return uI.randomUUID();e=e||{};const r=e.random||(e.rng||zCe)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return FCe(r)}var BCe=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,HCe=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,WCe=/[^-+\dA-Z]/g;function Ri(e,t,n,r){if(arguments.length===1&&typeof e=="string"&&!/\d/.test(e)&&(t=e,e=void 0),e=e||e===0?e:new Date,e instanceof Date||(e=new Date(e)),isNaN(e))throw TypeError("Invalid date");t=String(cI[t]||t||cI.default);var i=t.slice(0,4);(i==="UTC:"||i==="GMT:")&&(t=t.slice(4),n=!0,i==="GMT:"&&(r=!0));var o=function(){return n?"getUTC":"get"},a=function(){return e[o()+"Date"]()},s=function(){return e[o()+"Day"]()},l=function(){return e[o()+"Month"]()},d=function(){return e[o()+"FullYear"]()},p=function(){return e[o()+"Hours"]()},g=function(){return e[o()+"Minutes"]()},m=function(){return e[o()+"Seconds"]()},y=function(){return e[o()+"Milliseconds"]()},b=function(){return n?0:e.getTimezoneOffset()},S=function(){return VCe(e)},E=function(){return UCe(e)},P={d:function(){return a()},dd:function(){return la(a())},ddd:function(){return Oo.dayNames[s()]},DDD:function(){return dI({y:d(),m:l(),d:a(),_:o(),dayName:Oo.dayNames[s()],short:!0})},dddd:function(){return Oo.dayNames[s()+7]},DDDD:function(){return dI({y:d(),m:l(),d:a(),_:o(),dayName:Oo.dayNames[s()+7]})},m:function(){return l()+1},mm:function(){return la(l()+1)},mmm:function(){return Oo.monthNames[l()]},mmmm:function(){return Oo.monthNames[l()+12]},yy:function(){return String(d()).slice(2)},yyyy:function(){return la(d(),4)},h:function(){return p()%12||12},hh:function(){return la(p()%12||12)},H:function(){return p()},HH:function(){return la(p())},M:function(){return g()},MM:function(){return la(g())},s:function(){return m()},ss:function(){return la(m())},l:function(){return la(y(),3)},L:function(){return la(Math.floor(y()/10))},t:function(){return p()<12?Oo.timeNames[0]:Oo.timeNames[1]},tt:function(){return p()<12?Oo.timeNames[2]:Oo.timeNames[3]},T:function(){return p()<12?Oo.timeNames[4]:Oo.timeNames[5]},TT:function(){return p()<12?Oo.timeNames[6]:Oo.timeNames[7]},Z:function(){return r?"GMT":n?"UTC":GCe(e)},o:function(){return(b()>0?"-":"+")+la(Math.floor(Math.abs(b())/60)*100+Math.abs(b())%60,4)},p:function(){return(b()>0?"-":"+")+la(Math.floor(Math.abs(b())/60),2)+":"+la(Math.floor(Math.abs(b())%60),2)},S:function(){return["th","st","nd","rd"][a()%10>3?0:(a()%100-a()%10!=10)*a()%10]},W:function(){return S()},WW:function(){return la(S())},N:function(){return E()}};return t.replace(BCe,function(k){return k in P?P[k]():k.slice(1,k.length-1)})}var cI={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},Oo={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},la=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(t).padStart(n,"0")},dI=function(t){var n=t.y,r=t.m,i=t.d,o=t._,a=t.dayName,s=t.short,l=s===void 0?!1:s,d=new Date,p=new Date;p.setDate(p[o+"Date"]()-1);var g=new Date;g.setDate(g[o+"Date"]()+1);var m=function(){return d[o+"Date"]()},y=function(){return d[o+"Month"]()},b=function(){return d[o+"FullYear"]()},S=function(){return p[o+"Date"]()},E=function(){return p[o+"Month"]()},P=function(){return p[o+"FullYear"]()},k=function(){return g[o+"Date"]()},T=function(){return g[o+"Month"]()},M=function(){return g[o+"FullYear"]()};return b()===n&&y()===r&&m()===i?l?"Tdy":"Today":P()===n&&E()===r&&S()===i?l?"Ysd":"Yesterday":M()===n&&T()===r&&k()===i?l?"Tmw":"Tomorrow":a},VCe=function(t){var n=new Date(t.getFullYear(),t.getMonth(),t.getDate());n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=new Date(n.getFullYear(),0,4);r.setDate(r.getDate()-(r.getDay()+6)%7+3);var i=n.getTimezoneOffset()-r.getTimezoneOffset();n.setHours(n.getHours()-i);var o=(n-r)/(864e5*7);return 1+Math.floor(o)},UCe=function(t){var n=t.getDay();return n===0&&(n=7),n},GCe=function(t){return(String(t).match(HCe)||[""]).pop().replace(WCe,"").replace(/GMT\+0000/g,"UTC")};const jCe=e=>{const{dispatch:t,getState:n}=e;return{onConnect:()=>{try{t($L(!0)),t(l3("Connected"));const r=n().gallery;r.categories.user.latest_mtime?t(WL("user")):t(aC("user")),r.categories.result.latest_mtime?t(WL("result")):t(aC("result"))}catch(r){console.error(r)}},onDisconnect:()=>{try{t($L(!1)),t(l3("Disconnected")),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:"Disconnected from server",level:"warning"}))}catch(r){console.error(r)}},onGenerationResult:r=>{try{const{shouldLoopback:i,activeTab:o}=n().options,a={uuid:dg(),...r,category:"result"};if(t(oy({category:"result",image:a})),i)switch(Lv[o]){case"img2img":{t(Xm(a));break}case"inpainting":{t(T5(a));break}}t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Image generated: ${r.url}`}))}catch(i){console.error(i)}},onIntermediateResult:r=>{try{t(k3e({uuid:dg(),...r})),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Intermediate image generated: ${r.url}`}))}catch(i){console.error(i)}},onPostprocessingResult:r=>{try{t(oy({category:"result",image:{uuid:dg(),...r,category:"result"}})),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Postprocessed: ${r.url}`}))}catch(i){console.error(i)}},onProgressUpdate:r=>{try{t(Kf(!0)),t(G2e(r))}catch(i){console.error(i)}},onError:r=>{const{message:i,additionalData:o}=r;try{t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Server error: ${i}`,level:"error"})),t(rC()),t(JL())}catch(a){console.error(a)}},onGalleryImages:r=>{const{images:i,areMoreImagesAvailable:o,category:a}=r,s=i.map(l=>({uuid:dg(),...l}));t(_3e({images:s,areMoreImagesAvailable:o,category:a})),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Loaded ${i.length} images`}))},onProcessingCanceled:()=>{t(q2e());const{intermediateImage:r}=n().gallery;r&&(t(oy({category:"result",image:r})),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Intermediate image saved: ${r.url}`})),t(JL())),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:"Processing canceled",level:"warning"}))},onImageDeleted:r=>{const{url:i}=r;t(F$(r));const{initialImage:o,maskPath:a}=n().options,{imageToInpaint:s}=n().inpainting;(o?.url===i||o===i)&&t($C()),s?.url===i&&t(t7()),a===i&&t(FC("")),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Image deleted: ${i}`}))},onImageUploaded:r=>{const{destination:i,...o}=r,a={uuid:dg(),...o};try{switch(t(oy({image:a,category:"user"})),i){case"img2img":{t(Xm(a));break}case"inpainting":{t(T5(a));break}default:{t($$(a));break}}t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Image uploaded: ${r.url}`}))}catch(s){console.error(s)}},onMaskImageUploaded:r=>{const{url:i}=r;t(FC(i)),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Mask image uploaded: ${i}`}))},onSystemConfig:r=>{t(j2e(r))},onModelChanged:r=>{const{model_name:i,model_list:o}=r;t(BL(o)),t(l3("Model Changed")),t(Kf(!1)),t(iC(!0)),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Model changed: ${i}`,level:"info"}))},onModelChangeFailed:r=>{const{model_name:i,model_list:o}=r;t(BL(o)),t(Kf(!1)),t(iC(!0)),t(rC()),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Model change failed: ${i}`,level:"error"}))}}},KCe=(e,t)=>{const{width:n,height:r}=e,i=document.createElement("div"),o=new h3.Stage({container:i,width:n,height:r}),a=new h3.Layer;return o.add(a),t.forEach(s=>a.add(new h3.Line({points:s.points,stroke:"rgb(0,0,0)",strokeWidth:s.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:s.tool==="brush"?"source-over":"destination-out"}))),a.draw(),i.remove(),{stage:o,layer:a}},qCe=(e,t)=>{const n=e.toCanvas().getContext("2d")?.getImageData(t.x,t.y,t.width,t.height);if(!n)throw new Error("Unable to get image data from generated canvas");return!new Uint32Array(n.data.buffer).some(i=>i!==0)},ZCe=(e,t,n)=>{const{stage:r,layer:i}=KCe(e,t),o=qCe(r,n);return i.add(new h3.Image({image:e,globalCompositeOperation:"source-out"})),{maskDataURL:r.toDataURL(),isMaskEmpty:o}},YCe=e=>{const{generationMode:t,optionsState:n,inpaintingState:r,systemState:i,imageToProcessUrl:o,maskImageElement:a}=e,{prompt:s,iterations:l,steps:d,cfgScale:p,threshold:g,perlin:m,height:y,width:b,sampler:S,seed:E,seamless:P,hiresFix:k,img2imgStrength:T,initialImage:M,shouldFitToWidthHeight:N,shouldGenerateVariations:z,variationAmount:F,seedWeights:$,shouldRunESRGAN:K,upscalingLevel:j,upscalingStrength:Z,shouldRunFacetool:me,facetoolStrength:pe,codeformerFidelity:be,facetoolType:we,shouldRandomizeSeed:Se}=n,{shouldDisplayInProgress:J}=i,G={prompt:s,iterations:l,steps:d,cfg_scale:p,threshold:g,perlin:m,height:y,width:b,sampler_name:S,seed:E,progress_images:J};if(G.seed=Se?c$(H_,W_):E,["txt2img","img2img"].includes(t)&&(G.seamless=P,G.hires_fix=k),t==="img2img"&&M&&(G.init_img=typeof M=="string"?M:M.url,G.strength=T,G.fit=N),t==="inpainting"&&a){const{lines:W,boundingBoxCoordinate:ie,boundingBoxDimensions:ce,inpaintReplace:xe,shouldUseInpaintReplace:De}=r,Me={...ie,...ce};G.init_img=o,G.strength=T,G.fit=!1;const{maskDataURL:Ve,isMaskEmpty:ke}=ZCe(a,W,Me);G.is_mask_empty=ke,G.init_mask=Ve.split("data:image/png;base64,")[1],De&&(G.inpaint_replace=xe),G.bounding_box=Me,G.progress_images=!1}z?(G.variation_amount=F,$&&(G.with_variations=jve($))):G.variation_amount=0;let te=!1,Q=!1;return K&&(te={level:j,strength:Z}),me&&(Q={type:we,strength:pe},we==="codeformer"&&(Q.codeformer_fidelity=be)),{generationParameters:G,esrganParameters:te,facetoolParameters:Q}},XCe=(e,t)=>{const{dispatch:n,getState:r}=e;return{emitGenerateImage:i=>{n(Kf(!0));const o=r(),{options:a,system:s,inpainting:l,gallery:d}=o,p={generationMode:i,optionsState:a,inpaintingState:l,systemState:s};if(i==="inpainting"){if(!z5.current||!l.imageToInpaint?.url){n(Mi({timestamp:Ri(new Date,"isoDateTime"),message:"Inpainting image not loaded, cannot generate image.",level:"error"})),n(rC());return}p.imageToProcessUrl=l.imageToInpaint.url,p.maskImageElement=z5.current}else if(!["txt2img","img2img"].includes(i)){if(!d.currentImage?.url)return;p.imageToProcessUrl=d.currentImage.url}const{generationParameters:g,esrganParameters:m,facetoolParameters:y}=YCe(p);t.emit("generateImage",g,m,y),g.init_mask&&(g.init_mask=g.init_mask.substr(0,20).concat("...")),n(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Image generation requested: ${JSON.stringify({...g,...m,...y})}`}))},emitRunESRGAN:i=>{n(Kf(!0));const o=r().options,{upscalingLevel:a,upscalingStrength:s}=o,l={upscale:[a,s]};t.emit("runPostprocessing",i,{type:"esrgan",...l}),n(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`ESRGAN upscale requested: ${JSON.stringify({file:i.url,...l})}`}))},emitRunFacetool:i=>{n(Kf(!0));const o=r().options,{facetoolType:a,facetoolStrength:s,codeformerFidelity:l}=o,d={facetool_strength:s};a==="codeformer"&&(d.codeformer_fidelity=l),t.emit("runPostprocessing",i,{type:a,...d}),n(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Face restoration (${a}) requested: ${JSON.stringify({file:i.url,...d})}`}))},emitDeleteImage:i=>{const{url:o,uuid:a,category:s}=i;n(F$(i)),t.emit("deleteImage",o,a,s)},emitRequestImages:i=>{const o=r().gallery,{earliest_mtime:a}=o.categories[i];t.emit("requestImages",i,a)},emitRequestNewImages:i=>{const o=r().gallery,{latest_mtime:a}=o.categories[i];t.emit("requestLatestImages",i,a)},emitCancelProcessing:()=>{t.emit("cancel")},emitUploadImage:i=>{const{file:o,destination:a}=i;t.emit("uploadImage",o,o.name,a)},emitUploadMaskImage:i=>{t.emit("uploadMaskImage",i,i.name)},emitRequestSystemConfig:()=>{t.emit("requestSystemConfig")},emitRequestModelChange:i=>{n(l3("Changing Model")),n(Kf(!0)),n(iC(!1)),t.emit("requestModelChange",i)}}},QCe=()=>{const{origin:e}=new URL(window.location.href),t=y3(e,{timeout:6e4,path:window.location.pathname+"socket.io"});let n=!1;return i=>o=>a=>{const{onConnect:s,onDisconnect:l,onError:d,onPostprocessingResult:p,onGenerationResult:g,onIntermediateResult:m,onProgressUpdate:y,onGalleryImages:b,onProcessingCanceled:S,onImageDeleted:E,onImageUploaded:P,onMaskImageUploaded:k,onSystemConfig:T,onModelChanged:M,onModelChangeFailed:N}=jCe(i),{emitGenerateImage:z,emitRunESRGAN:F,emitRunFacetool:$,emitDeleteImage:K,emitRequestImages:j,emitRequestNewImages:Z,emitCancelProcessing:me,emitUploadImage:pe,emitUploadMaskImage:be,emitRequestSystemConfig:we,emitRequestModelChange:Se}=XCe(i,t);switch(n||(t.on("connect",()=>s()),t.on("disconnect",()=>l()),t.on("error",J=>d(J)),t.on("generationResult",J=>g(J)),t.on("postprocessingResult",J=>p(J)),t.on("intermediateResult",J=>m(J)),t.on("progressUpdate",J=>y(J)),t.on("galleryImages",J=>b(J)),t.on("processingCanceled",()=>{S()}),t.on("imageDeleted",J=>{E(J)}),t.on("imageUploaded",J=>{P(J)}),t.on("maskImageUploaded",J=>{k(J)}),t.on("systemConfig",J=>{T(J)}),t.on("modelChanged",J=>{M(J)}),t.on("modelChangeFailed",J=>{N(J)}),n=!0),a.type){case"socketio/generateImage":{z(a.payload);break}case"socketio/runESRGAN":{F(a.payload);break}case"socketio/runFacetool":{$(a.payload);break}case"socketio/deleteImage":{K(a.payload);break}case"socketio/requestImages":{j(a.payload);break}case"socketio/requestNewImages":{Z(a.payload);break}case"socketio/cancelProcessing":{me();break}case"socketio/uploadImage":{pe(a.payload);break}case"socketio/uploadMaskImage":{be(a.payload);break}case"socketio/requestSystemConfig":{we();break}case"socketio/requestModelChange":{Se(a.payload);break}}o(a)}},JCe={key:"root",storage:_v,blacklist:["gallery","system","inpainting"]},e9e={key:"system",storage:_v,blacklist:["isCancelable","isConnected","isProcessing","currentStep","socketId","isESRGANAvailable","isGFPGANAvailable","currentStep","totalSteps","currentIteration","totalIterations","currentStatus"]},t9e={key:"gallery",storage:_v,whitelist:["galleryWidth","shouldPinGallery","shouldShowGallery","galleryScrollPosition","galleryImageMinimumWidth","galleryImageObjectFit"]},n9e={key:"inpainting",storage:_v,blacklist:["pastLines","futuresLines","cursorPosition"]},r9e=DF({options:K6e,gallery:o3(t9e,I3e),system:o3(e9e,Z2e),inpainting:o3(n9e,m3e)}),i9e=o3(JCe,r9e),FH=Ame({reducer:i9e,middleware:e=>e({serializableCheck:!1}).concat(QCe())}),pt=gve,Ge=ive;function x3(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?x3=function(n){return typeof n}:x3=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},x3(e)}function o9e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fI(e,t){for(var n=0;n({textColor:e.colorMode==="dark"?"gray.800":"gray.100"})},Accordion:{baseStyle:e=>({button:{fontWeight:"bold",_hover:{bgColor:e.colorMode==="dark"?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"}},panel:{paddingBottom:2}})},FormLabel:{baseStyle:{fontWeight:"light"}},Button:{variants:{imageHoverIconButton:e=>({bg:e.colorMode==="dark"?"blackAlpha.700":"whiteAlpha.800",color:e.colorMode==="dark"?"whiteAlpha.700":"blackAlpha.700",_hover:{bg:e.colorMode==="dark"?"blackAlpha.800":"whiteAlpha.800",color:e.colorMode==="dark"?"whiteAlpha.900":"blackAlpha.900"}})}}}}),BH=()=>w(zn,{width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",children:w(V0,{thickness:"2px",speed:"1s",emptyColor:"gray.200",color:"gray.400",size:"xl"})}),u9e=an(e=>e.system,e=>({isProcessing:e.isProcessing,currentStep:e.currentStep,totalSteps:e.totalSteps,currentStatusHasSteps:e.currentStatusHasSteps}),{memoizeOptions:{resultEqualityCheck:ba.exports.isEqual}}),c9e=()=>{const{isProcessing:e,currentStep:t,totalSteps:n,currentStatusHasSteps:r}=Ge(u9e),i=t?Math.round(t*100/n):0;return w(Wz,{value:i,isIndeterminate:e&&!r,className:"progress-bar"})},d9e=""+new URL("logo.13003d72.png",import.meta.url).href;function f9e(e){const{title:t,hotkey:n,description:r}=e;return oe("div",{className:"hotkey-modal-item",children:[oe("div",{className:"hotkey-info",children:[w("p",{className:"hotkey-title",children:t}),r&&w("p",{className:"hotkey-description",children:r})]}),w("div",{className:"hotkey-key",children:n})]})}function h9e({children:e}){const{isOpen:t,onOpen:n,onClose:r}=d5(),i=[{title:"Invoke",desc:"Generate an image",hotkey:"Ctrl+Enter"},{title:"Cancel",desc:"Cancel image generation",hotkey:"Shift+X"},{title:"Focus Prompt",desc:"Focus the prompt input area",hotkey:"Alt+A"},{title:"Toggle Options",desc:"Open and close the options panel",hotkey:"O"},{title:"Pin Options",desc:"Pin the options panel",hotkey:"Shift+O"},{title:"Toggle Gallery",desc:"Open and close the gallery drawer",hotkey:"G"},{title:"Change Tabs",desc:"Switch to another workspace",hotkey:"1-6"},{title:"Theme Toggle",desc:"Switch between dark and light modes",hotkey:"Shift+D"},{title:"Console Toggle",desc:"Open and close console",hotkey:"`"}],o=[{title:"Set Parameters",desc:"Use all parameters of the current image",hotkey:"A"},{title:"Set Seed",desc:"Use the seed of the current image",hotkey:"S"},{title:"Restore Faces",desc:"Restore the current image",hotkey:"R"},{title:"Upscale",desc:"Upscale the current image",hotkey:"U"},{title:"Show Info",desc:"Show metadata info of the current image",hotkey:"I"},{title:"Send To Image To Image",desc:"Send current image to Image to Image",hotkey:"Shift+I"},{title:"Delete Image",desc:"Delete the current image",hotkey:"Del"}],a=[{title:"Previous Image",desc:"Display the previous image in gallery",hotkey:"Arrow left"},{title:"Next Image",desc:"Display the next image in gallery",hotkey:"Arrow right"},{title:"Toggle Gallery Pin",desc:"Pins and unpins the gallery to the UI",hotkey:"Shift+G"},{title:"Increase Gallery Image Size",desc:"Increases gallery thumbnails size",hotkey:"Shift+Up"},{title:"Decrease Gallery Image Size",desc:"Decreases gallery thumbnails size",hotkey:"Shift+Down"},{title:"Reset Gallery Image Size",desc:"Resets image gallery size",hotkey:"Shift+R"}],s=[{title:"Select Brush",desc:"Selects the inpainting brush",hotkey:"B"},{title:"Select Eraser",desc:"Selects the inpainting eraser",hotkey:"E"},{title:"Quick Toggle Brush/Eraser",desc:"Quick toggle between brush and eraser",hotkey:"X"},{title:"Decrease Brush Size",desc:"Decreases the size of the inpainting brush/eraser",hotkey:"["},{title:"Increase Brush Size",desc:"Increases the size of the inpainting brush/eraser",hotkey:"]"},{title:"Hide Mask",desc:"Hide and unhide mask",hotkey:"H"},{title:"Decrease Mask Opacity",desc:"Decreases the opacity of the mask",hotkey:"Shift+["},{title:"Increase Mask Opacity",desc:"Increases the opacity of the mask",hotkey:"Shift+]"},{title:"Invert Mask",desc:"Invert the mask preview",hotkey:"Shift+M"},{title:"Clear Mask",desc:"Clear the entire mask",hotkey:"Shift+C"},{title:"Undo Stroke",desc:"Undo a brush stroke",hotkey:"Ctrl+Z"},{title:"Redo Stroke",desc:"Redo a brush stroke",hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:"Lock Bounding Box",desc:"Locks the bounding box",hotkey:"M"},{title:"Quick Toggle Lock Bounding Box",desc:"Hold to toggle locking the bounding box",hotkey:"Space"},{title:"Expand Inpainting Area",desc:"Expand your inpainting work area",hotkey:"Shift+J"}],l=d=>{const p=[];return d.forEach((g,m)=>{p.push(w(f9e,{title:g.title,description:g.desc,hotkey:g.hotkey},m))}),w("div",{className:"hotkey-modal-category",children:p})};return oe($n,{children:[C.exports.cloneElement(e,{onClick:n}),oe(T0,{isOpen:t,onClose:r,children:[w(Hm,{}),oe(Bm,{className:"hotkeys-modal",children:[w(d_,{}),w("h1",{children:"Keyboard Shorcuts"}),w("div",{className:"hotkeys-modal-items",children:oe(D4,{allowMultiple:!0,children:[oe(Uf,{children:[oe(Wf,{className:"hotkeys-modal-button",children:[w("h2",{children:"App Hotkeys"}),w(Vf,{})]}),w(Gf,{children:l(i)})]}),oe(Uf,{children:[oe(Wf,{className:"hotkeys-modal-button",children:[w("h2",{children:"General Hotkeys"}),w(Vf,{})]}),w(Gf,{children:l(o)})]}),oe(Uf,{children:[oe(Wf,{className:"hotkeys-modal-button",children:[w("h2",{children:"Gallery Hotkeys"}),w(Vf,{})]}),w(Gf,{children:l(a)})]}),oe(Uf,{children:[oe(Wf,{className:"hotkeys-modal-button",children:[w("h2",{children:"Inpainting Hotkeys"}),w(Vf,{})]}),w(Gf,{children:l(s)})]})]})})]})]})]})}const p9e=e=>{const{isProcessing:t,isConnected:n}=Ge(l=>l.system),r=pt(),{name:i,status:o,description:a}=e,s=()=>{r(Uye(i))};return oe("div",{className:"model-list-item",children:[w(ii,{label:a,hasArrow:!0,placement:"bottom",children:w("div",{className:"model-list-item-name",children:i})}),w(kD,{}),w("div",{className:`model-list-item-status ${o.split(" ").join("-")}`,children:o}),w("div",{className:"model-list-item-load-btn",children:w(Ya,{size:"sm",onClick:s,isDisabled:o==="active"||t||!n,children:"Load"})})]})},g9e=an(e=>e.system,e=>{const t=gn.map(e.model_list,(r,i)=>({name:i,...r})),n=t.find(r=>r.status==="active");return{models:t,activeModel:n}}),m9e=()=>{const{models:e}=Ge(g9e);return w("div",{className:"model-list",children:w(D4,{allowToggle:!0,children:oe(Uf,{children:[w(Wf,{children:oe("div",{className:"model-list-button",children:[w("h2",{children:"Models"}),w(Vf,{})]})}),w(Gf,{children:w("div",{className:"model-list-list",children:e.map((t,n)=>w(p9e,{name:t.name,status:t.status,description:t.description},n))})})]})})})};function US({settingTitle:e,isChecked:t,dispatcher:n}){const r=pt();return w(Hu,{styleClass:"settings-modal-item",label:e,isChecked:t,onChange:i=>r(n(i.target.checked))})}const v9e=an(e=>e.system,e=>{const{shouldDisplayInProgress:t,shouldConfirmOnDelete:n,shouldDisplayGuides:r,model_list:i}=e;return{shouldDisplayInProgress:t,shouldConfirmOnDelete:n,shouldDisplayGuides:r,models:gn.map(i,(o,a)=>a)}},{memoizeOptions:{resultEqualityCheck:ba.exports.isEqual}}),y9e=({children:e})=>{const{isOpen:t,onOpen:n,onClose:r}=d5(),{isOpen:i,onOpen:o,onClose:a}=d5(),{shouldDisplayInProgress:s,shouldConfirmOnDelete:l,shouldDisplayGuides:d}=Ge(v9e),p=()=>{QH.purge().then(()=>{r(),o()})};return oe($n,{children:[C.exports.cloneElement(e,{onClick:n}),oe(T0,{isOpen:t,onClose:r,children:[w(Hm,{}),oe(Bm,{className:"settings-modal",children:[w(h_,{className:"settings-modal-header",children:"Settings"}),w(d_,{}),oe(g5,{className:"settings-modal-content",children:[w(m9e,{}),oe("div",{className:"settings-modal-items",children:[w(US,{settingTitle:"Display In-Progress Images (slower)",isChecked:s,dispatcher:V2e}),w(US,{settingTitle:"Confirm on Delete",isChecked:l,dispatcher:f$}),w(US,{settingTitle:"Display Help Icons",isChecked:d,dispatcher:K2e})]}),oe("div",{className:"settings-modal-reset",children:[w(Qf,{size:"md",children:"Reset Web UI"}),w(zo,{children:"Resetting the web UI only resets the browser's local cache of your images and remembered settings. It does not delete any images from disk."}),w(zo,{children:"If images aren't showing up in the gallery or something else isn't working, please try resetting before submitting an issue on GitHub."}),w(Ya,{colorScheme:"red",onClick:p,children:"Reset Web UI"})]})]}),w(f_,{children:w(Ya,{onClick:r,children:"Close"})})]})]}),oe(T0,{closeOnOverlayClick:!1,isOpen:i,onClose:a,isCentered:!0,children:[w(Hm,{bg:"blackAlpha.300",backdropFilter:"blur(40px)"}),w(Bm,{children:w(g5,{pb:6,pt:6,children:w(zn,{justifyContent:"center",children:w(zo,{fontSize:"lg",children:"Web UI has been reset. Refresh the page to reload."})})})})]})]})},x9e=an(e=>e.system,e=>({isConnected:e.isConnected,isProcessing:e.isProcessing,currentIteration:e.currentIteration,totalIterations:e.totalIterations,currentStatus:e.currentStatus,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:ba.exports.isEqual}}),b9e=()=>{const{isConnected:e,isProcessing:t,currentIteration:n,totalIterations:r,currentStatus:i,hasError:o,wasErrorSeen:a}=Ge(x9e),s=pt();let l;e&&!o?l="status-good":l="status-bad";let d=i;return["generating","preparing","saving image","restoring faces","upscaling"].includes(d.toLowerCase())&&(l="status-working"),d&&t&&r>1&&(d+=` (${n}/${r})`),w(ii,{label:o&&!a?"Click to clear, check logs for details":void 0,children:w(zo,{cursor:o&&!a?"pointer":"initial",onClick:()=>{(o||!a)&&s(h$())},className:`status ${l}`,children:d})})},S9e=()=>{const{colorMode:e,toggleColorMode:t}=Z9();Bt("shift+d",()=>{t()},[e,t]);const n=e=="light"?w(kye,{}):w(Mye,{}),r=e=="light"?18:20;return oe("div",{className:"site-header",children:[oe("div",{className:"site-header-left-side",children:[w("img",{src:d9e,alt:"invoke-ai-logo"}),oe("h1",{children:["invoke ",w("strong",{children:"ai"})]})]}),oe("div",{className:"site-header-right-side",children:[w(b9e,{}),w(h9e,{children:w(Xi,{"aria-label":"Hotkeys",variant:"link",fontSize:24,size:"sm",icon:w(aye,{})})}),w(ii,{hasArrow:!0,label:"Theme",placement:"bottom",children:w(Xi,{"aria-label":"Toggle Dark Mode",onClick:t,variant:"link",size:"sm",fontSize:r,icon:n})}),w(ii,{hasArrow:!0,label:"Report Bug",placement:"bottom",children:w(Xi,{"aria-label":"Link to Github Issues",variant:"link",fontSize:23,size:"sm",icon:w(r0,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI/issues",children:w(m$,{})})})}),w(ii,{hasArrow:!0,label:"Github",placement:"bottom",children:w(Xi,{"aria-label":"Link to Github Repo",variant:"link",fontSize:20,size:"sm",icon:w(r0,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI",children:w(gye,{})})})}),w(ii,{hasArrow:!0,label:"Discord",placement:"bottom",children:w(Xi,{"aria-label":"Link to Discord Server",variant:"link",fontSize:20,size:"sm",icon:w(r0,{isExternal:!0,href:"https://discord.gg/ZmtBAhwWhy",children:w(pye,{})})})}),w(y9e,{children:w(Xi,{"aria-label":"Settings",variant:"link",fontSize:24,size:"sm",icon:w(nye,{})})})]})]})},w9e=an(e=>e.system,e=>e.log,{memoizeOptions:{resultEqualityCheck:(e,t)=>e.length===t.length}}),C9e=an(e=>e.system,e=>({shouldShowLogViewer:e.shouldShowLogViewer,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:ba.exports.isEqual}}),_9e=()=>{const e=pt(),t=Ge(w9e),{shouldShowLogViewer:n,hasError:r,wasErrorSeen:i}=Ge(C9e),[o,a]=C.exports.useState(!0),s=C.exports.useRef(null);C.exports.useLayoutEffect(()=>{s.current!==null&&o&&(s.current.scrollTop=s.current.scrollHeight)},[o,t,n]);const l=()=>{e(h$()),e(FL(!n))};return Bt("`",()=>{e(FL(!n))},[n]),oe($n,{children:[n&&w(U$,{defaultSize:{width:"100%",height:200},style:{display:"flex",position:"fixed",left:0,bottom:0,zIndex:20},maxHeight:"90vh",children:w("div",{className:"console",ref:s,onScroll:()=>{!s.current||o&&s.current.scrollTop{const{timestamp:m,message:y,level:b}=p;return oe("div",{className:`console-entry console-${b}-color`,children:[oe("p",{className:"console-timestamp",children:[m,":"]}),w("p",{className:"console-message",children:y})]},g)})})}),n&&w(ii,{hasArrow:!0,label:o?"Autoscroll On":"Autoscroll Off",children:w(Xi,{className:"console-autoscroll-icon-button","data-autoscroll-enabled":o,size:"sm","aria-label":"Toggle autoscroll",variant:"solid",icon:w(mye,{}),onClick:()=>a(!o)})}),w(ii,{hasArrow:!0,label:n?"Hide Console":"Show Console",children:w(Xi,{className:"console-toggle-icon-button","data-error-seen":r||!i,size:"sm",position:"fixed",variant:"solid","aria-label":"Toggle Log Viewer",icon:n?w(_ye,{}):w(bye,{}),onClick:l})})]})};function k9e(){async function e(n=""){return await fetch(n,{method:"GET",cache:"no-cache"})}const t=()=>{const n=document.location;e(n+"/flaskwebgui-keep-server-alive").then(i=>i)};(!{BASE_URL:"./",MODE:"production",DEV:!1,PROD:!0}.NODE_ENV||{BASE_URL:"./",MODE:"production",DEV:!1,PROD:!0}.NODE_ENV==="production")&&document.addEventListener("DOMContentLoaded",()=>{t(),setInterval(t,3e3)})}var E9e=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function Iv(e,t){var n=P9e(e);if(typeof n.path!="string"){var r=e.webkitRelativePath;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function P9e(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),i=E9e.get(r);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}var T9e=[".DS_Store","Thumbs.db"];function L9e(e){return H0(this,void 0,void 0,function(){return W0(this,function(t){return F5(e)&&A9e(e.dataTransfer)?[2,O9e(e.dataTransfer,e.type)]:I9e(e)?[2,M9e(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,R9e(e)]:[2,[]]})})}function A9e(e){return F5(e)}function I9e(e){return F5(e)&&F5(e.target)}function F5(e){return typeof e=="object"&&e!==null}function M9e(e){return qC(e.target.files).map(function(t){return Iv(t)})}function R9e(e){return H0(this,void 0,void 0,function(){var t;return W0(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(r){return r.getFile()}))];case 1:return t=n.sent(),[2,t.map(function(r){return Iv(r)})]}})})}function O9e(e,t){return H0(this,void 0,void 0,function(){var n,r;return W0(this,function(i){switch(i.label){case 0:return e.items?(n=qC(e.items).filter(function(o){return o.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(N9e))]):[3,2];case 1:return r=i.sent(),[2,pI(HH(r))];case 2:return[2,pI(qC(e.files).map(function(o){return Iv(o)}))]}})})}function pI(e){return e.filter(function(t){return T9e.indexOf(t.name)===-1})}function qC(e){if(e===null)return[];for(var t=[],n=0;nm7.exports.DefaultEventPriority,Ewe=Object.freeze(Object.defineProperty({__proto__:null,appendInitialChild:GSe,createInstance:jSe,createTextInstance:KSe,finalizeInitialChildren:qSe,getPublicInstance:ZSe,prepareForCommit:YSe,preparePortalMount:XSe,prepareUpdate:QSe,resetAfterCommit:JSe,resetTextContent:ewe,shouldDeprioritizeSubtree:twe,getRootHostContext:nwe,getChildHostContext:rwe,scheduleTimeout:iwe,cancelTimeout:owe,noTimeout:awe,shouldSetTextContent:swe,isPrimaryRenderer:lwe,warnsIfNotActing:uwe,supportsMutation:cwe,appendChild:dwe,appendChildToContainer:fwe,insertBefore:rH,insertInContainerBefore:hwe,removeChild:pwe,removeChildFromContainer:gwe,commitTextUpdate:mwe,commitMount:vwe,commitUpdate:ywe,hideInstance:xwe,hideTextInstance:bwe,unhideInstance:Swe,unhideTextInstance:wwe,clearContainer:Cwe,detachDeletedInstance:_we,getCurrentEventPriority:kwe,now:Gp.exports.unstable_now,idlePriority:Gp.exports.unstable_IdlePriority,run:Gp.exports.unstable_runWithPriority},Symbol.toStringTag,{value:"Module"}));var Pwe=Object.defineProperty,Twe=Object.defineProperties,Lwe=Object.getOwnPropertyDescriptors,qA=Object.getOwnPropertySymbols,Awe=Object.prototype.hasOwnProperty,Iwe=Object.prototype.propertyIsEnumerable,ZA=(e,t,n)=>t in e?Pwe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,YA=(e,t)=>{for(var n in t||(t={}))Awe.call(t,n)&&ZA(e,n,t[n]);if(qA)for(var n of qA(t))Iwe.call(t,n)&&ZA(e,n,t[n]);return e},Mwe=(e,t)=>Twe(e,Lwe(t));function y7(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const i=y7(r,t,n);if(i)return i;r=t?null:r.sibling}}function iH(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const x7=iH(C.exports.createContext(null));class oH extends C.exports.Component{render(){return w(x7.Provider,{value:this._reactInternals,children:this.props.children})}}const{ReactCurrentOwner:Rwe,ReactCurrentDispatcher:Owe}=C.exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Nwe(){const e=C.exports.useContext(x7);if(!e)throw new Error("its-fine: useFiber must be called within a !");const t=C.exports.useId();return C.exports.useMemo(()=>{var r;return(r=Rwe.current)!=null?r:y7(e,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===t)return!0;o=o.next}})},[e,t])}const ug=[],XA=new WeakMap;function Dwe(){var e;const t=Nwe();ug.splice(0,ug.length),y7(t,!0,n=>{var r;const i=(r=n.type)==null?void 0:r._context;i&&i!==x7&&ug.push(iH(i))});for(const n of ug){const r=(e=Owe.current)==null?void 0:e.readContext(n);XA.set(n,r)}return C.exports.useMemo(()=>ug.reduce((n,r)=>i=>C.exports.createElement(n,null,C.exports.createElement(r.Provider,Mwe(YA({},i),{value:XA.get(r)}))),n=>w(oH,{...YA({},n)})),[])}function zwe(e){const t=le.useRef();return le.useLayoutEffect(()=>{t.current=e}),t.current}const Fwe=e=>{const t=le.useRef(),n=le.useRef(),r=le.useRef(),i=zwe(e),o=Dwe(),a=s=>{const{forwardedRef:l}=e;!l||(typeof l=="function"?l(s):l.current=s)};return le.useLayoutEffect(()=>(n.current=new uh.Stage({width:e.width,height:e.height,container:t.current}),a(n.current),r.current=Tg.createContainer(n.current,m7.exports.LegacyRoot,!1,null),Tg.updateContainer(w(o,{children:e.children}),r.current),()=>{!uh.isBrowser||(a(null),Tg.updateContainer(null,r.current,null),n.current.destroy())}),[]),le.useLayoutEffect(()=>{a(n.current),Ex(n.current,e,i),Tg.updateContainer(w(o,{children:e.children}),r.current,null)}),w("div",{ref:t,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},HS="Layer",$we="Group",IC="Rect",MC="Circle",Bwe="Line",WS="Image",Hwe="Transformer",Tg=BSe(Ewe);Tg.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:le.version,rendererPackageName:"react-konva"});const Wwe=le.forwardRef((e,t)=>w(oH,{children:w(Fwe,{...e,forwardedRef:t})})),Vwe=e=>{const{r:t,g:n,b:r,a:i}=e;return`rgba(${t}, ${n}, ${r}, ${i})`},aH=e=>{const{r:t,g:n,b:r}=e;return`rgba(${t}, ${n}, ${r})`},Uwe=an(e=>e.inpainting,e=>{const{lines:t,maskColor:n}=e;return{lines:t,maskColorString:aH(n)}}),Gwe=an([e=>e.inpainting,e=>e.options,zs],(e,t,n)=>{const{tool:r,brushSize:i,maskColor:o,shouldInvertMask:a,shouldShowMask:s,shouldShowCheckboardTransparency:l,lines:d,pastLines:p,futureLines:g,shouldShowBoundingBoxFill:m}=e,{showDualDisplay:y}=t;return{tool:r,brushSize:i,maskColor:o,shouldInvertMask:a,shouldShowMask:s,shouldShowCheckboardTransparency:l,canUndo:p.length>0,canRedo:g.length>0,isMaskEmpty:d.length===0,activeTabName:n,showDualDisplay:y,shouldShowBoundingBoxFill:m}},{memoizeOptions:{resultEqualityCheck:gn.isEqual}}),jwe=an(e=>e.inpainting,e=>{const{tool:t,brushSize:n,maskColor:r,shouldInvertMask:i,shouldShowMask:o,shouldShowCheckboardTransparency:a,imageToInpaint:s,stageScale:l,shouldShowBoundingBox:d,shouldShowBoundingBoxFill:p,isDrawing:g,shouldLockBoundingBox:m,boundingBoxDimensions:y}=e;return{tool:t,brushSize:n,shouldInvertMask:i,shouldShowMask:o,shouldShowCheckboardTransparency:a,maskColor:r,imageToInpaint:s,stageScale:l,shouldShowBoundingBox:d,shouldShowBoundingBoxFill:p,isDrawing:g,shouldLockBoundingBox:m,boundingBoxDimensions:y}},{memoizeOptions:{resultEqualityCheck:(e,t)=>{const{imageToInpaint:n,...r}=e,{imageToInpaint:i,...o}=t;return gn.isEqual(r,o)&&n==i}}}),Kwe=()=>{const{lines:e,maskColorString:t}=Ge(Uwe);return w($n,{children:e.map((n,r)=>w(Bwe,{points:n.points,stroke:t,strokeWidth:n.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:n.tool==="brush"?"source-over":"destination-out"},r))})},qwe=an(e=>e.inpainting,e=>{const{cursorPosition:t,canvasDimensions:{width:n,height:r},shouldShowBrushPreview:i,brushSize:o,maskColor:a,tool:s,shouldShowBrush:l}=e;return{cursorPosition:t,width:n,height:r,shouldShowBrushPreview:i,brushSize:o,maskColorString:aH(a),tool:s,shouldShowBrush:l}},{memoizeOptions:{resultEqualityCheck:gn.isEqual}}),Zwe=()=>{const{cursorPosition:e,width:t,height:n,shouldShowBrushPreview:r,brushSize:i,maskColorString:o,tool:a,shouldShowBrush:s}=Ge(qwe);return!s||!(e||r)?null:w(MC,{x:e?e.x:t/2,y:e?e.y:n/2,radius:i/2,fill:o,listening:!1,globalCompositeOperation:a==="eraser"?"destination-out":"source-over"})},Ywe=an(e=>e.inpainting,e=>{const{cursorPosition:t,canvasDimensions:{width:n,height:r},shouldShowBrushPreview:i,brushSize:o,stageScale:a,shouldShowBrush:s}=e;return{cursorPosition:t,width:n,height:r,shouldShowBrushPreview:i,brushSize:o,strokeWidth:1/a,shouldShowBrush:s}},{memoizeOptions:{resultEqualityCheck:gn.isEqual}}),Xwe=()=>{const{cursorPosition:e,width:t,height:n,shouldShowBrushPreview:r,brushSize:i,strokeWidth:o,shouldShowBrush:a}=Ge(Ywe);return!a||!(e||r)?null:oe($n,{children:[w(MC,{x:e?e.x:t/2,y:e?e.y:n/2,radius:i/2,stroke:"rgba(0,0,0,1)",strokeWidth:o,strokeEnabled:!0,listening:!1}),w(MC,{x:e?e.x:t/2,y:e?e.y:n/2,radius:1,fill:"rgba(0,0,0,1)",listening:!1})]})},Qwe=()=>{const{tool:e,lines:t,cursorPosition:n,brushSize:r,canvasDimensions:{width:i,height:o},maskColor:a,shouldInvertMask:s,shouldShowMask:l,shouldShowBrushPreview:d,shouldShowCheckboardTransparency:p,imageToInpaint:g,shouldShowBrush:m,shouldShowBoundingBoxFill:y,shouldLockBoundingBox:b,stageScale:S,pastLines:E,futureLines:P,needsCache:k,isDrawing:T}=Ge(M=>M.inpainting);return C.exports.useLayoutEffect(()=>{!xl.current||xl.current.cache({x:0,y:0,width:i,height:o})},[t,n,i,o,e,r,a,s,l,d,p,g,m,y,b,S,E,P,k,T]),C.exports.useEffect(()=>{const M=window.setTimeout(()=>{!xl.current||xl.current.cache({x:0,y:0,width:i,height:o})},0);return()=>{window.clearTimeout(M)}}),null},ky=e=>{const t=e.getPointerPosition(),n=e.getAbsoluteTransform().copy();if(!t||!n)return;const r=n.invert().point(t);return{x:Math.floor(r.x),y:Math.floor(r.y)}},Jwe=4,sH=an(e=>e.inpainting,e=>{const{boundingBoxCoordinate:t,boundingBoxDimensions:n,boundingBoxPreviewFill:r,canvasDimensions:i,stageScale:o,imageToInpaint:a,shouldLockBoundingBox:s}=e;return{boundingBoxCoordinate:t,boundingBoxDimensions:n,boundingBoxPreviewFillString:Vwe(r),canvasDimensions:i,stageScale:o,imageToInpaint:a,dash:Jwe/o,strokeWidth:1/o,shouldLockBoundingBox:s}},{memoizeOptions:{resultEqualityCheck:gn.isEqual}}),e6e=()=>{const{boundingBoxCoordinate:e,boundingBoxDimensions:t,boundingBoxPreviewFillString:n,canvasDimensions:r}=Ge(sH);return oe($we,{children:[w(IC,{x:0,y:0,height:r.height,width:r.width,fill:n}),w(IC,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,globalCompositeOperation:"destination-out"})]})},t6e=()=>{const e=pt(),{boundingBoxCoordinate:t,boundingBoxDimensions:n,strokeWidth:r,stageScale:i,imageToInpaint:o,shouldLockBoundingBox:a}=Ge(sH),s=C.exports.useRef(null),l=C.exports.useRef(null);C.exports.useEffect(()=>{!s.current||!l.current||(s.current.nodes([l.current]),s.current.getLayer()?.batchDraw())},[a]),C.exports.useEffect(()=>()=>{const S=Es.current?.container();!S||(S.style.cursor="unset")},[a]);const d=64*i,p=C.exports.useCallback(S=>{e(XL({x:Math.floor(S.target.x()),y:Math.floor(S.target.y())}))},[e]),g=C.exports.useCallback(S=>{if(!o)return t;const{x:E,y:P}=S,k=o.width-n.width,T=o.height-n.height,M=Math.floor(gn.clamp(E,0,k*i)),N=Math.floor(gn.clamp(P,0,T*i));return{x:M,y:N}},[t,n,o,i]),m=C.exports.useCallback(()=>{if(!l.current)return;const S=l.current,E=S.scaleX(),P=S.scaleY(),k=Math.round(S.width()*E),T=Math.round(S.height()*P),M=Math.round(S.x()),N=Math.round(S.y());e(wg({width:k,height:T})),e(XL({x:M,y:N})),S.scaleX(1),S.scaleY(1)},[e]),y=C.exports.useCallback((S,E,P)=>{const k=S.x%d,T=S.y%d,M=jL(E.x,d)+k,N=jL(E.y,d)+T,z=Math.abs(E.x-M),F=Math.abs(E.y-N),$=z!o||E.width+E.x>o.width*i||E.height+E.y>o.height*i||E.x<0||E.y<0?S:E,[o,i]);return oe($n,{children:[w(IC,{x:t.x,y:t.y,width:n.width,height:n.height,ref:l,stroke:"white",strokeWidth:r,listening:!a,onMouseEnter:S=>{const E=S?.target?.getStage()?.container();!E||(E.style.cursor=a?"none":"move")},onMouseLeave:S=>{const E=S?.target?.getStage()?.container();!E||(E.style.cursor=a?"none":"default")},draggable:!a,onDragMove:p,dragBoundFunc:g,onTransform:m}),w(Hwe,{ref:s,anchorCornerRadius:3,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderStroke:"black",rotateEnabled:!1,borderEnabled:!0,flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!a,enabledAnchors:a?[]:void 0,boundBoxFunc:b,anchorDragBoundFunc:y})]})},n6e=an([e=>e.options,e=>e.inpainting,zs],(e,t,n)=>{const{shouldShowMask:r,cursorPosition:i,shouldLockBoundingBox:o}=t;return{activeTabName:n,shouldShowMask:r,isCursorOnCanvas:Boolean(i),shouldLockBoundingBox:o}},{memoizeOptions:{resultEqualityCheck:gn.isEqual}}),r6e=()=>{const e=pt(),{shouldShowMask:t,activeTabName:n,isCursorOnCanvas:r,shouldLockBoundingBox:i}=Ge(n6e),o=C.exports.useRef(!1),a=C.exports.useRef(null);return C.exports.useEffect(()=>{const s=l=>{if(!(!["x"," "].includes(l.key)||n!=="inpainting"||!t)){if(!r){a.current||(a.current=l),o.current=!1;return}if(l.stopPropagation(),l.preventDefault(),!l.repeat){if(a.current||(o.current=!0,a.current=l),!o.current&&l.type==="keyup"){o.current=!0,a.current=l;return}switch(l.key){case"x":{e(u3e());break}case" ":{if(!t)break;l.type==="keydown"&&e(Cg(!1)),e(R$(!i));break}}a.current=l,o.current=!0}}};return document.addEventListener("keydown",s),document.addEventListener("keyup",s),()=>{document.removeEventListener("keydown",s),document.removeEventListener("keyup",s)}},[e,n,t,r,i]),null};let Es,xl,z5;const i6e=()=>{const e=pt(),{tool:t,brushSize:n,shouldInvertMask:r,shouldShowMask:i,shouldShowCheckboardTransparency:o,maskColor:a,imageToInpaint:s,stageScale:l,shouldShowBoundingBox:d,shouldShowBoundingBoxFill:p,isDrawing:g,shouldLockBoundingBox:m,boundingBoxDimensions:y}=Ge(jwe),b=Cd();Es=C.exports.useRef(null),xl=C.exports.useRef(null),z5=C.exports.useRef(null);const S=C.exports.useRef({x:0,y:0}),E=C.exports.useRef(!1),[P,k]=C.exports.useState(null);C.exports.useEffect(()=>{if(s){const $=new Image;$.onload=()=>{z5.current=$,k($)},$.onerror=()=>{b({title:"Unable to Load Image",description:`Image ${s.url} failed to load`,status:"error",isClosable:!0}),e(t7())},$.src=s.url}else k(null)},[s,e,l,b]);const T=C.exports.useCallback(()=>{if(!Es.current)return;const $=ky(Es.current);!$||!xl.current||!m||(e(Cg(!0)),e(qL({tool:t,strokeWidth:n/2,points:[$.x,$.y]})))},[e,n,t,m]),M=C.exports.useCallback(()=>{if(!Es.current)return;const $=ky(Es.current);!$||(e(YL($)),!(!xl.current||!m)&&(S.current=$,g&&(E.current=!0,e(ZL([$.x,$.y])))))},[e,g,m]),N=C.exports.useCallback(()=>{if(!E.current&&g&&Es.current){const $=ky(Es.current);if(!$||!xl.current||!m)return;e(ZL([$.x,$.y]))}else E.current=!1;e(Cg(!1))},[e,g,m]),z=C.exports.useCallback(()=>{e(YL(null)),e(Cg(!1))},[e]),F=C.exports.useCallback($=>{if($.evt.buttons===1){if(!Es.current)return;const K=ky(Es.current);if(!K||!xl.current||!m)return;e(Cg(!0)),e(qL({tool:t,strokeWidth:n/2,points:[K.x,K.y]}))}},[e,n,t,m]);return oe("div",{className:"inpainting-canvas-wrapper",tabIndex:1,children:[oe("div",{className:"inpainting-alerts",children:[!i&&w("div",{style:{pointerEvents:"none"},children:"Mask Hidden (H)"}),r&&w("div",{style:{pointerEvents:"none"},children:"Mask Inverted (Shift+M)"}),!m&&w("div",{style:{pointerEvents:"none"},children:`Transforming Bounding Box ${y.width}x${y.height} (M)`})]}),P&&oe(Wwe,{width:Math.floor(P.width*l),height:Math.floor(P.height*l),scale:{x:l,y:l},onMouseDown:T,onMouseMove:M,onMouseEnter:F,onMouseUp:N,onMouseOut:z,onMouseLeave:z,style:{cursor:i?"none":"default"},className:"inpainting-canvas-stage checkerboard",ref:Es,children:[!r&&!o&&w(HS,{name:"image-layer",listening:!1,children:w(WS,{listening:!1,image:P})}),i&&oe($n,{children:[oe(HS,{name:"mask-layer",listening:!1,opacity:o||r?1:a.a,ref:xl,children:[w(Kwe,{}),m&&w(Zwe,{}),r&&w(WS,{image:P,listening:!1,globalCompositeOperation:"source-in"}),!r&&o&&w(WS,{image:P,listening:!1,globalCompositeOperation:"source-out"})]}),i&&oe(HS,{children:[p&&d&&w(e6e,{}),d&&w(t6e,{}),m&&w(Xwe,{})]})]})]}),w(Qwe,{}),w(r6e,{})]})},o6e=()=>{const e=pt(),{needsCache:t,imageToInpaint:n}=Ge(i=>i.inpainting),r=C.exports.useRef(null);return C.exports.useLayoutEffect(()=>{window.setTimeout(()=>{if(!r.current||!n)return;const i=r.current.clientWidth,o=r.current.clientHeight,a=Math.min(1,Math.min(i/n.width,o/n.height));e(l3e(a))},0)},[e,n,t]),w("div",{ref:r,className:"inpainting-canvas-area",children:w(V0,{thickness:"2px",speed:"1s",size:"xl"})})};function a6e(e){return wt({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M14 1H3L2 2v11l1 1h11l1-1V2l-1-1zM8 13H3V2h5v11zm6 0H9V2h5v11z"}}]})(e)}function Px(){return(Px=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}function RC(e){var t=C.exports.useRef(e),n=C.exports.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var R0=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:E.buttons>0)&&i.current?o(QA(i.current,E,s.current)):S(!1)},b=function(){return S(!1)};function S(E){var P=l.current,k=OC(i.current),T=E?k.addEventListener:k.removeEventListener;T(P?"touchmove":"mousemove",y),T(P?"touchend":"mouseup",b)}return[function(E){var P=E.nativeEvent,k=i.current;if(k&&(JA(P),!function(M,N){return N&&!im(M)}(P,l.current)&&k)){if(im(P)){l.current=!0;var T=P.changedTouches||[];T.length&&(s.current=T[0].identifier)}k.focus(),o(QA(k,P,s.current)),S(!0)}},function(E){var P=E.which||E.keyCode;P<37||P>40||(E.preventDefault(),a({left:P===39?.05:P===37?-.05:0,top:P===40?.05:P===38?-.05:0}))},S]},[a,o]),p=d[0],g=d[1],m=d[2];return C.exports.useEffect(function(){return m},[m]),w("div",{...Px({},r,{onTouchStart:p,onMouseDown:p,className:"react-colorful__interactive",ref:i,onKeyDown:g,tabIndex:0,role:"slider"})})}),Tx=function(e){return e.filter(Boolean).join(" ")},S7=function(e){var t=e.color,n=e.left,r=e.top,i=r===void 0?.5:r,o=Tx(["react-colorful__pointer",e.className]);return w("div",{className:o,style:{top:100*i+"%",left:100*n+"%"},children:w("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}})})},mo=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},uH=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:mo(e.h),s:mo(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:mo(i/2),a:mo(r,2)}},NC=function(e){var t=uH(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},VS=function(e){var t=uH(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},s6e=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var o=Math.floor(t),a=r*(1-n),s=r*(1-(t-o)*n),l=r*(1-(1-t+o)*n),d=o%6;return{r:mo(255*[r,s,a,a,l,r][d]),g:mo(255*[l,r,r,s,a,a][d]),b:mo(255*[a,a,l,r,r,s][d]),a:mo(i,2)}},l6e=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,o=Math.max(t,n,r),a=o-Math.min(t,n,r),s=a?o===t?(n-r)/a:o===n?2+(r-t)/a:4+(t-n)/a:0;return{h:mo(60*(s<0?s+6:s)),s:mo(o?a/o*100:0),v:mo(o/255*100),a:i}},u6e=le.memo(function(e){var t=e.hue,n=e.onChange,r=Tx(["react-colorful__hue",e.className]);return le.createElement("div",{className:r},le.createElement(b7,{onMove:function(i){n({h:360*i.left})},onKey:function(i){n({h:R0(t+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":mo(t),"aria-valuemax":"360","aria-valuemin":"0"},le.createElement(S7,{className:"react-colorful__hue-pointer",left:t/360,color:NC({h:t,s:100,v:100,a:1})})))}),c6e=le.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:NC({h:t.h,s:100,v:100,a:1})};return le.createElement("div",{className:"react-colorful__saturation",style:r},le.createElement(b7,{onMove:function(i){n({s:100*i.left,v:100-100*i.top})},onKey:function(i){n({s:R0(t.s+100*i.left,0,100),v:R0(t.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+mo(t.s)+"%, Brightness "+mo(t.v)+"%"},le.createElement(S7,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:NC(t)})))}),cH=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function d6e(e,t,n){var r=RC(n),i=C.exports.useState(function(){return e.toHsva(t)}),o=i[0],a=i[1],s=C.exports.useRef({color:t,hsva:o});C.exports.useEffect(function(){if(!e.equal(t,s.current.color)){var d=e.toHsva(t);s.current={hsva:d,color:t},a(d)}},[t,e]),C.exports.useEffect(function(){var d;cH(o,s.current.hsva)||e.equal(d=e.fromHsva(o),s.current.color)||(s.current={hsva:o,color:d},r(d))},[o,e,r]);var l=C.exports.useCallback(function(d){a(function(p){return Object.assign({},p,d)})},[]);return[o,l]}var f6e=typeof window<"u"?C.exports.useLayoutEffect:C.exports.useEffect,h6e=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},eI=new Map,p6e=function(e){f6e(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!eI.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,eI.set(t,n);var r=h6e();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},g6e=function(e){var t=e.className,n=e.hsva,r=e.onChange,i={backgroundImage:"linear-gradient(90deg, "+VS(Object.assign({},n,{a:0}))+", "+VS(Object.assign({},n,{a:1}))+")"},o=Tx(["react-colorful__alpha",t]),a=mo(100*n.a);return le.createElement("div",{className:o},w("div",{className:"react-colorful__alpha-gradient",style:i}),le.createElement(b7,{onMove:function(s){r({a:s.left})},onKey:function(s){r({a:R0(n.a+s.left)})},"aria-label":"Alpha","aria-valuetext":a+"%","aria-valuenow":a,"aria-valuemin":"0","aria-valuemax":"100"},le.createElement(S7,{className:"react-colorful__alpha-pointer",left:n.a,color:VS(n)})))},m6e=function(e){var t=e.className,n=e.colorModel,r=e.color,i=r===void 0?n.defaultColor:r,o=e.onChange,a=lH(e,["className","colorModel","color","onChange"]),s=C.exports.useRef(null);p6e(s);var l=d6e(n,i,o),d=l[0],p=l[1],g=Tx(["react-colorful",t]);return le.createElement("div",Px({},a,{ref:s,className:g}),w(c6e,{hsva:d,onChange:p}),w(u6e,{hue:d.h,onChange:p}),le.createElement(g6e,{hsva:d,onChange:p,className:"react-colorful__last-control"}))},v6e={defaultColor:{r:0,g:0,b:0,a:1},toHsva:l6e,fromHsva:s6e,equal:cH},y6e=function(e){return le.createElement(m6e,Px({},e,{colorModel:v6e}))};const x6e=e=>{const{styleClass:t,...n}=e;return w(y6e,{className:`invokeai__color-picker ${t}`,...n})},b6e=()=>{const{tool:e,brushSize:t,maskColor:n,shouldInvertMask:r,shouldShowMask:i,canUndo:o,canRedo:a,isMaskEmpty:s,activeTabName:l,showDualDisplay:d}=Ge(Gwe),p=pt(),g=Cd(),[m,y]=C.exports.useState(!1);Bt("[",Z=>{Z.preventDefault(),t-5>0?P(t-5):P(1)},{enabled:l==="inpainting"&&i},[l,i,t]),Bt("]",Z=>{Z.preventDefault(),P(t+5)},{enabled:l==="inpainting"&&i},[l,i,t]),Bt("shift+[",Z=>{Z.preventDefault(),z({...n,a:Math.max(n.a-.05,0)})},{enabled:l==="inpainting"&&i},[l,i,n.a]),Bt("shift+]",Z=>{Z.preventDefault(),z({...n,a:Math.min(n.a+.05,100)})},{enabled:l==="inpainting"&&i},[l,i,n.a]),Bt("e",Z=>{Z.preventDefault(),!(l!=="inpainting"||!i)&&S()},{enabled:l==="inpainting"&&i},[l,i]),Bt("b",Z=>{Z.preventDefault(),E()},{enabled:l==="inpainting"&&i},[l,i]),Bt("m",Z=>{Z.preventDefault(),p(g3e())},{enabled:l==="inpainting"&&i},[l,i]),Bt("cmd+z, control+z",Z=>{Z.preventDefault(),F()},{enabled:l==="inpainting"&&i&&o},[l,i,o]),Bt("cmd+shift+z, control+shift+z, control+y, cmd+y",Z=>{Z.preventDefault(),$()},{enabled:l==="inpainting"&&i&&a},[l,i,a]),Bt("h",Z=>{Z.preventDefault(),k()},{enabled:l==="inpainting"},[l,i]),Bt("shift+m",Z=>{Z.preventDefault(),T()},{enabled:l==="inpainting"&&i},[l,r,i]),Bt("shift+c",Z=>{Z.preventDefault(),b(),g({title:"Mask Cleared",status:"success",duration:2500,isClosable:!0})},{enabled:l==="inpainting"&&i&&!s},[l,s,i]),Bt("shift+j",()=>{K()},[d]);const b=()=>{p(o3e())},S=()=>p(KL("eraser")),E=()=>p(KL("brush")),P=Z=>{p(ES(!0)),p(t3e(Z))},k=()=>p(r3e(!i)),T=()=>p(n3e(!r)),M=()=>{p(ES(!0))},N=()=>{p(ES(!1))},z=Z=>{p(i3e(Z))},F=()=>p(a3e()),$=()=>p(s3e()),K=()=>{p(W6e(!d)),p(qf(!0))};return oe("div",{className:"inpainting-settings",children:[oe("div",{className:"inpainting-buttons-group",children:[w(u3,{trigger:"hover",onOpen:M,onClose:N,triggerComponent:w(pn,{"aria-label":"Brush (B)",tooltip:"Brush (B)",icon:w(x$,{}),onClick:E,"data-selected":e==="brush",isDisabled:!i}),children:oe("div",{className:"inpainting-slider-numberinput",children:[w(N5,{label:"Brush Size",value:t,onChange:P,min:1,max:200,width:"100px",focusThumbOnChange:!1,isDisabled:!i}),w(yo,{value:t,onChange:P,width:"80px",min:1,max:999,isDisabled:!i})]})}),w(pn,{"aria-label":"Eraser (E)",tooltip:"Eraser (E)",icon:w(Sye,{}),onClick:S,"data-selected":e==="eraser",isDisabled:!i})]}),oe("div",{className:"inpainting-buttons-group",children:[w(u3,{trigger:"click",onOpen:()=>y(!0),onClose:()=>y(!1),triggerComponent:w(pn,{"aria-label":"Mask Options",tooltip:"Mask Options",icon:w(Cye,{}),cursor:"pointer",isDisabled:s,"data-selected":m}),children:oe("div",{className:"inpainting-button-dropdown",children:[w(pn,{"aria-label":"Hide/Show Mask (H)",tooltip:"Hide/Show Mask (H)","data-selected":!i,icon:i?w(wB,{size:22}):w(SB,{size:22}),onClick:k}),w(pn,{tooltip:"Invert Mask Display (Shift+M)","aria-label":"Invert Mask Display (Shift+M)","data-selected":r,icon:r?w(tye,{size:22}):w(iye,{size:22}),onClick:T,isDisabled:!i}),w(u3,{trigger:"hover",placement:"right",styleClass:"inpainting-color-picker",triggerComponent:w(pn,{"aria-label":"Mask Color",tooltip:"Mask Color",icon:w(Eye,{}),isDisabled:!i,cursor:"pointer"}),children:w(x6e,{color:n,onChange:z})})]})}),w(pn,{"aria-label":"Clear Mask (Shift+C)",tooltip:"Clear Mask (Shift+C)",icon:w(Tye,{size:18,style:{transform:"rotate(45deg)"}}),onClick:b,isDisabled:s||!i})]}),oe("div",{className:"inpainting-buttons-group",children:[w(pn,{"aria-label":"Undo",tooltip:"Undo",icon:w(Nye,{}),onClick:F,isDisabled:!o||!i}),w(pn,{"aria-label":"Redo",tooltip:"Redo",icon:w(Aye,{}),onClick:$,isDisabled:!a||!i})]}),w("div",{className:"inpainting-buttons-group",children:w(pn,{"aria-label":"Clear Image",tooltip:"Clear Image",icon:w(Oye,{size:16}),onClick:()=>{p(t7())}})}),w(pn,{"aria-label":"Split Layout (Shift+J)",tooltip:"Split Layout (Shift+J)",icon:w(a6e,{}),"data-selected":d,onClick:K})]})},S6e=an([e=>e.inpainting,e=>e.options],(e,t)=>{const{needsCache:n,imageToInpaint:r}=e,{showDualDisplay:i}=t;return{needsCache:n,showDualDisplay:i,imageToInpaint:r}},{memoizeOptions:{resultEqualityCheck:gn.isEqual}}),w6e=()=>{const e=pt(),{showDualDisplay:t,needsCache:n,imageToInpaint:r}=Ge(S6e);return C.exports.useLayoutEffect(()=>{const o=gn.debounce(()=>e(qf(!0)),250);return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[e]),oe("div",{className:t?"workarea-split-view":"workarea-single-view",children:[oe("div",{className:"workarea-split-view-left",children:[r?oe("div",{className:"inpainting-main-area",children:[w(b6e,{}),w("div",{className:"inpainting-canvas-area",children:n?w(o6e,{}):w(i6e,{})})]}):w(N$,{})," "]}),t&&w("div",{className:"workarea-split-view-right",children:w(r7,{})})]})};function C6e(){return w(c7,{optionsPanel:w(Txe,{}),styleClass:"inpainting-workarea-overrides",children:w(w6e,{})})}function _6e(){const e=Ge(n=>n.options.showAdvancedOptions),t={seed:{header:w(V_,{}),feature:go.SEED,options:w(U_,{})},variations:{header:w(j_,{}),feature:go.VARIATIONS,options:w(K_,{})},face_restore:{header:w(B_,{}),feature:go.FACE_CORRECTION,options:w(gx,{})},upscale:{header:w(G_,{}),feature:go.UPSCALE,options:w(mx,{})},other:{header:w(l$,{}),feature:go.OTHER,options:w(u$,{})}};return oe(n7,{children:[w(J_,{}),w(Q_,{}),w(Y_,{}),w(q_,{}),e?w(X_,{accordionInfo:t}):null]})}const k6e=()=>w("div",{className:"workarea-single-view",children:w("div",{className:"text-to-image-area",children:w(r7,{})})});function E6e(){return w(c7,{optionsPanel:w(_6e,{}),children:w(k6e,{})})}const Ep={txt2img:{title:w(f2e,{fill:"black",boxSize:"2.5rem"}),workarea:w(E6e,{}),tooltip:"Text To Image"},img2img:{title:w(s2e,{fill:"black",boxSize:"2.5rem"}),workarea:w(Cxe,{}),tooltip:"Image To Image"},inpainting:{title:w(l2e,{fill:"black",boxSize:"2.5rem"}),workarea:w(C6e,{}),tooltip:"Inpainting"},outpainting:{title:w(c2e,{fill:"black",boxSize:"2.5rem"}),workarea:w(o2e,{}),tooltip:"Outpainting"},nodes:{title:w(u2e,{fill:"black",boxSize:"2.5rem"}),workarea:w(i2e,{}),tooltip:"Nodes"},postprocess:{title:w(d2e,{fill:"black",boxSize:"2.5rem"}),workarea:w(a2e,{}),tooltip:"Post Processing"}},Lv=gn.map(Ep,(e,t)=>t);[...Lv];function P6e(){const e=Ge(i=>i.options.activeTab),t=pt();Bt("1",()=>{t(Va(0))}),Bt("2",()=>{t(Va(1))}),Bt("3",()=>{t(Va(2))}),Bt("4",()=>{t(Va(3))}),Bt("5",()=>{t(Va(4))}),Bt("6",()=>{t(Va(5))});const n=()=>{const i=[];return Object.keys(Ep).forEach(o=>{i.push(w(ii,{hasArrow:!0,label:Ep[o].tooltip,placement:"right",children:w(uF,{children:Ep[o].title})},o))}),i},r=()=>{const i=[];return Object.keys(Ep).forEach(o=>{i.push(w(sF,{className:"app-tabs-panel",children:Ep[o].workarea},o))}),i};return oe(aF,{isLazy:!0,className:"app-tabs",variant:"unstyled",defaultIndex:e,index:e,onChange:i=>{t(Va(i))},children:[w("div",{className:"app-tabs-list",children:n()}),w(lF,{className:"app-tabs-panels",children:r()})]})}const dH={prompt:"",iterations:1,steps:50,cfgScale:7.5,height:512,width:512,sampler:"k_lms",threshold:0,perlin:0,seed:0,seamless:!1,hiresFix:!1,img2imgStrength:.75,maskPath:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,variationAmount:.1,seedWeights:"",shouldRunESRGAN:!1,upscalingLevel:4,upscalingStrength:.75,shouldRunFacetool:!1,facetoolStrength:.8,facetoolType:"gfpgan",codeformerFidelity:.75,shouldRandomizeSeed:!0,showAdvancedOptions:!0,activeTab:0,shouldShowImageDetails:!1,showDualDisplay:!0,shouldShowOptionsPanel:!0,shouldPinOptionsPanel:!0,optionsPanelScrollPosition:0,shouldHoldOptionsPanelOpen:!1,shouldLoopback:!0},T6e=dH,fH=nx({name:"options",initialState:T6e,reducers:{setPrompt:(e,t)=>{const n=t.payload;typeof n=="string"?e.prompt=n:e.prompt=s3(n)},setIterations:(e,t)=>{e.iterations=t.payload},setSteps:(e,t)=>{e.steps=t.payload},setCfgScale:(e,t)=>{e.cfgScale=t.payload},setThreshold:(e,t)=>{e.threshold=t.payload},setPerlin:(e,t)=>{e.perlin=t.payload},setHeight:(e,t)=>{e.height=t.payload},setWidth:(e,t)=>{e.width=t.payload},setSampler:(e,t)=>{e.sampler=t.payload},setSeed:(e,t)=>{e.seed=t.payload,e.shouldRandomizeSeed=!1},setImg2imgStrength:(e,t)=>{e.img2imgStrength=t.payload},setFacetoolStrength:(e,t)=>{e.facetoolStrength=t.payload},setCodeformerFidelity:(e,t)=>{e.codeformerFidelity=t.payload},setUpscalingLevel:(e,t)=>{e.upscalingLevel=t.payload},setUpscalingStrength:(e,t)=>{e.upscalingStrength=t.payload},setMaskPath:(e,t)=>{e.maskPath=t.payload},setSeamless:(e,t)=>{e.seamless=t.payload},setHiresFix:(e,t)=>{e.hiresFix=t.payload},setShouldFitToWidthHeight:(e,t)=>{e.shouldFitToWidthHeight=t.payload},resetSeed:e=>{e.seed=-1},setParameter:(e,t)=>{const{key:n,value:r}=t.payload,i={...e,[n]:r};return n==="seed"&&(i.shouldRandomizeSeed=!1),i},setShouldGenerateVariations:(e,t)=>{e.shouldGenerateVariations=t.payload},setVariationAmount:(e,t)=>{e.variationAmount=t.payload},setSeedWeights:(e,t)=>{e.seedWeights=t.payload},setAllTextToImageParameters:(e,t)=>{const{sampler:n,prompt:r,seed:i,variations:o,steps:a,cfg_scale:s,threshold:l,perlin:d,seamless:p,hires_fix:g,width:m,height:y}=t.payload.image;o&&o.length>0?(e.seedWeights=E5(o),e.shouldGenerateVariations=!0):e.shouldGenerateVariations=!1,i&&(e.seed=i,e.shouldRandomizeSeed=!1),r&&(e.prompt=s3(r)),n&&(e.sampler=n),a&&(e.steps=a),s&&(e.cfgScale=s),l&&(e.threshold=l),typeof l>"u"&&(e.threshold=0),d&&(e.perlin=d),typeof d>"u"&&(e.perlin=0),typeof p=="boolean"&&(e.seamless=p),typeof g=="boolean"&&(e.hiresFix=g),m&&(e.width=m),y&&(e.height=y)},setAllImageToImageParameters:(e,t)=>{const{type:n,strength:r,fit:i,init_image_path:o,mask_image_path:a}=t.payload.image;n==="img2img"&&(o&&(e.initialImage=o),a&&(e.maskPath=a),r&&(e.img2imgStrength=r),typeof i=="boolean"&&(e.shouldFitToWidthHeight=i))},setAllParameters:(e,t)=>{const{type:n,sampler:r,prompt:i,seed:o,variations:a,steps:s,cfg_scale:l,threshold:d,perlin:p,seamless:g,hires_fix:m,width:y,height:b,strength:S,fit:E,init_image_path:P,mask_image_path:k}=t.payload.image;n==="img2img"&&(P&&(e.initialImage=P),k&&(e.maskPath=k),S&&(e.img2imgStrength=S),typeof E=="boolean"&&(e.shouldFitToWidthHeight=E)),a&&a.length>0?(e.seedWeights=E5(a),e.shouldGenerateVariations=!0):e.shouldGenerateVariations=!1,o&&(e.seed=o,e.shouldRandomizeSeed=!1),i&&(e.prompt=s3(i)),r&&(e.sampler=r),s&&(e.steps=s),l&&(e.cfgScale=l),d&&(e.threshold=d),typeof d>"u"&&(e.threshold=0),p&&(e.perlin=p),typeof p>"u"&&(e.perlin=0),typeof g=="boolean"&&(e.seamless=g),typeof m=="boolean"&&(e.hiresFix=m),y&&(e.width=y),b&&(e.height=b)},resetOptionsState:e=>({...e,...dH}),setShouldRunFacetool:(e,t)=>{e.shouldRunFacetool=t.payload},setFacetoolType:(e,t)=>{e.facetoolType=t.payload},setShouldRunESRGAN:(e,t)=>{e.shouldRunESRGAN=t.payload},setShouldRandomizeSeed:(e,t)=>{e.shouldRandomizeSeed=t.payload},setShowAdvancedOptions:(e,t)=>{e.showAdvancedOptions=t.payload},setActiveTab:(e,t)=>{typeof t.payload=="number"?e.activeTab=t.payload:e.activeTab=Lv.indexOf(t.payload)},setShouldShowImageDetails:(e,t)=>{e.shouldShowImageDetails=t.payload},setShowDualDisplay:(e,t)=>{e.showDualDisplay=t.payload},setInitialImage:(e,t)=>{e.initialImage=t.payload},clearInitialImage:e=>{e.initialImage=void 0},setShouldPinOptionsPanel:(e,t)=>{e.shouldPinOptionsPanel=t.payload},setShouldShowOptionsPanel:(e,t)=>{e.shouldShowOptionsPanel=t.payload},setOptionsPanelScrollPosition:(e,t)=>{e.optionsPanelScrollPosition=t.payload},setShouldHoldOptionsPanelOpen:(e,t)=>{e.shouldHoldOptionsPanelOpen=t.payload},setShouldLoopback:(e,t)=>{e.shouldLoopback=t.payload}}}),{setPrompt:w7,setIterations:L6e,setSteps:hH,setCfgScale:pH,setThreshold:A6e,setPerlin:I6e,setHeight:gH,setWidth:mH,setSampler:vH,setSeed:Av,setSeamless:yH,setHiresFix:xH,setImg2imgStrength:bH,setFacetoolStrength:p3,setFacetoolType:g3,setCodeformerFidelity:SH,setUpscalingLevel:DC,setUpscalingStrength:zC,setMaskPath:FC,resetSeed:F8e,resetOptionsState:$8e,setShouldFitToWidthHeight:wH,setParameter:B8e,setShouldGenerateVariations:M6e,setSeedWeights:CH,setVariationAmount:R6e,setAllParameters:O6e,setShouldRunFacetool:N6e,setShouldRunESRGAN:D6e,setShouldRandomizeSeed:z6e,setShowAdvancedOptions:F6e,setActiveTab:Va,setShouldShowImageDetails:$6e,setAllTextToImageParameters:B6e,setAllImageToImageParameters:H6e,setShowDualDisplay:W6e,setInitialImage:Xm,clearInitialImage:$C,setShouldShowOptionsPanel:BC,setShouldPinOptionsPanel:V6e,setOptionsPanelScrollPosition:U6e,setShouldHoldOptionsPanelOpen:G6e,setShouldLoopback:j6e}=fH.actions,K6e=fH.reducer,Fl=Object.create(null);Fl.open="0";Fl.close="1";Fl.ping="2";Fl.pong="3";Fl.message="4";Fl.upgrade="5";Fl.noop="6";const m3=Object.create(null);Object.keys(Fl).forEach(e=>{m3[Fl[e]]=e});const q6e={type:"error",data:"parser error"},Z6e=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Y6e=typeof ArrayBuffer=="function",X6e=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,_H=({type:e,data:t},n,r)=>Z6e&&t instanceof Blob?n?r(t):tI(t,r):Y6e&&(t instanceof ArrayBuffer||X6e(t))?n?r(t):tI(new Blob([t]),r):r(Fl[e]+(t||"")),tI=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+r)},n.readAsDataURL(e)},nI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,o,a,s,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const d=new ArrayBuffer(t),p=new Uint8Array(d);for(r=0;r>4,p[i++]=(a&15)<<4|s>>2,p[i++]=(s&3)<<6|l&63;return d},J6e=typeof ArrayBuffer=="function",kH=(e,t)=>{if(typeof e!="string")return{type:"message",data:EH(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:eCe(e.substring(1),t)}:m3[n]?e.length>1?{type:m3[n],data:e.substring(1)}:{type:m3[n]}:q6e},eCe=(e,t)=>{if(J6e){const n=Q6e(e);return EH(n,t)}else return{base64:!0,data:e}},EH=(e,t)=>{switch(t){case"blob":return e instanceof ArrayBuffer?new Blob([e]):e;case"arraybuffer":default:return e}},PH=String.fromCharCode(30),tCe=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{_H(o,!1,s=>{r[a]=s,++i===n&&t(r.join(PH))})})},nCe=(e,t)=>{const n=e.split(PH),r=[];for(let i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function LH(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const iCe=setTimeout,oCe=clearTimeout;function Lx(e,t){t.useNativeTimers?(e.setTimeoutFn=iCe.bind(Yc),e.clearTimeoutFn=oCe.bind(Yc)):(e.setTimeoutFn=setTimeout.bind(Yc),e.clearTimeoutFn=clearTimeout.bind(Yc))}const aCe=1.33;function sCe(e){return typeof e=="string"?lCe(e):Math.ceil((e.byteLength||e.size)*aCe)}function lCe(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}class uCe extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class AH extends Yr{constructor(t){super(),this.writable=!1,Lx(this,t),this.opts=t,this.query=t.query,this.readyState="",this.socket=t.socket}onError(t,n,r){return super.emitReserved("error",new uCe(t,n,r)),this}open(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=kH(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}}const IH="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),HC=64,cCe={};let rI=0,Ey=0,iI;function oI(e){let t="";do t=IH[e%HC]+t,e=Math.floor(e/HC);while(e>0);return t}function MH(){const e=oI(+new Date);return e!==iI?(rI=0,iI=e):e+"."+oI(rI++)}for(;Ey{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};nCe(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,tCe(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.query||{};const n=this.opts.secure?"https":"http";let r="";this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=MH()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.opts.port&&(n==="https"&&Number(this.opts.port)!==443||n==="http"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port);const i=RH(t),o=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(o?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}request(t={}){return Object.assign(t,{xd:this.xd,xs:this.xs},this.opts),new Rl(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Rl extends Yr{constructor(t,n){super(),Lx(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.async=n.async!==!1,this.data=n.data!==void 0?n.data:null,this.create()}create(){const t=LH(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd,t.xscheme=!!this.opts.xs;const n=this.xhr=new NH(t);try{n.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{n.readyState===4&&(n.status===200||n.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof n.status=="number"?n.status:0)},0))},n.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=Rl.requestsCount++,Rl.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=hCe,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Rl.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}Rl.requestsCount=0;Rl.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",aI);else if(typeof addEventListener=="function"){const e="onpagehide"in Yc?"pagehide":"unload";addEventListener(e,aI,!1)}}function aI(){for(let e in Rl.requests)Rl.requests.hasOwnProperty(e)&&Rl.requests[e].abort()}const mCe=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),Py=Yc.WebSocket||Yc.MozWebSocket,sI=!0,vCe="arraybuffer",lI=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class yCe extends AH{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=lI?{}:LH(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=sI&&!lI?n?new Py(t,n):new Py(t):new Py(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType||vCe,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const a={};try{sI&&this.ws.send(o)}catch{}i&&mCe(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let t=this.query||{};const n=this.opts.secure?"wss":"ws";let r="";this.opts.port&&(n==="wss"&&Number(this.opts.port)!==443||n==="ws"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port),this.opts.timestampRequests&&(t[this.opts.timestampParam]=MH()),this.supportsBinary||(t.b64=1);const i=RH(t),o=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(o?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}check(){return!!Py}}const xCe={websocket:yCe,polling:gCe},bCe=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,SCe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function WC(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=bCe.exec(e||""),o={},a=14;for(;a--;)o[SCe[a]]=i[a]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=wCe(o,o.path),o.queryKey=CCe(o,o.query),o}function wCe(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.substr(0,1)=="/"||t.length===0)&&r.splice(0,1),t.substr(t.length-1,1)=="/"&&r.splice(r.length-1,1),r}function CCe(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}class Uc extends Yr{constructor(t,n={}){super(),t&&typeof t=="object"&&(n=t,t=null),t?(t=WC(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=WC(n.host).host),Lx(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},n),this.opts.path=this.opts.path.replace(/\/$/,"")+"/",typeof this.opts.query=="string"&&(this.opts.query=dCe(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&addEventListener("beforeunload",()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},!1),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=TH,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts.transportOptions[t],this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new xCe[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Uc.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;Uc.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",g=>{if(!r)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Uc.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=n.name,this.emitReserved("upgradeError",m)}}))};function o(){r||(r=!0,p(),n.close(),n=null)}const a=g=>{const m=new Error("probe error: "+g);m.transport=n.name,o(),this.emitReserved("upgradeError",m)};function s(){a("transport closed")}function l(){a("socket closed")}function d(g){n&&g.name!==n.name&&o()}const p=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",s),this.off("close",l),this.off("upgrading",d)};n.once("open",i),n.once("error",a),n.once("close",s),this.once("close",l),this.once("upgrading",d),n.open()}onOpen(){if(this.readyState="open",Uc.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade&&this.transport.pause){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){Uc.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&removeEventListener("offline",this.offlineEventListener,!1),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,DH=Object.prototype.toString,PCe=typeof Blob=="function"||typeof Blob<"u"&&DH.call(Blob)==="[object BlobConstructor]",TCe=typeof File=="function"||typeof File<"u"&&DH.call(File)==="[object FileConstructor]";function C7(e){return kCe&&(e instanceof ArrayBuffer||ECe(e))||PCe&&e instanceof Blob||TCe&&e instanceof File}function v3(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num0;case on.ACK:case on.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}class RCe{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=ACe(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const OCe=Object.freeze(Object.defineProperty({__proto__:null,protocol:ICe,get PacketType(){return on},Encoder:MCe,Decoder:_7},Symbol.toStringTag,{value:"Module"}));function Ls(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const NCe=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class zH extends Yr{constructor(t,n,r){super(),this.connected=!1,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Ls(t,"open",this.onopen.bind(this)),Ls(t,"packet",this.onpacket.bind(this)),Ls(t,"error",this.onerror.bind(this)),Ls(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){if(NCe.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');n.unshift(t);const r={type:on.EVENT,data:n};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const a=this.ids++,s=n.pop();this._registerAckCallback(a,s),r.id=a}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(t,n){const r=this.flags.timeout;if(r===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let o=0;o{this.io.clearTimeoutFn(i),n.apply(this,[null,...o])}}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this.packet({type:on.CONNECT,data:t})}):this.packet({type:on.CONNECT,data:this.auth})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case on.CONNECT:if(t.data&&t.data.sid){const i=t.data.sid;this.onconnect(i)}else this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case on.EVENT:case on.BINARY_EVENT:this.onevent(t);break;case on.ACK:case on.BINARY_ACK:this.onack(t);break;case on.DISCONNECT:this.ondisconnect();break;case on.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t)}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:on.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t){this.id=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:on.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}J0.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};J0.prototype.reset=function(){this.attempts=0};J0.prototype.setMin=function(e){this.ms=e};J0.prototype.setMax=function(e){this.max=e};J0.prototype.setJitter=function(e){this.jitter=e};class GC extends Yr{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Lx(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new J0({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||OCe;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Uc(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Ls(n,"open",function(){r.onopen(),t&&t()}),o=Ls(n,"error",a=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",a),t?t(a):r.maybeReconnectOnOpen()});if(this._timeout!==!1){const a=this._timeout;a===0&&i();const s=this.setTimeoutFn(()=>{i(),n.close(),n.emit("error",new Error("timeout"))},a);this.opts.autoUnref&&s.unref(),this.subs.push(function(){clearTimeout(s)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ls(t,"ping",this.onping.bind(this)),Ls(t,"data",this.ondata.bind(this)),Ls(t,"error",this.onerror.bind(this)),Ls(t,"close",this.onclose.bind(this)),Ls(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch{this.onclose("parse error")}}ondecoded(t){this.emitReserved("packet",t)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r||(r=new zH(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(function(){clearTimeout(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const cg={};function y3(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=_Ce(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=cg[i]&&o in cg[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let l;return s?l=new GC(r,t):(cg[i]||(cg[i]=new GC(r,t)),l=cg[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(y3,{Manager:GC,Socket:zH,io:y3,connect:y3});let Ty;const DCe=new Uint8Array(16);function zCe(){if(!Ty&&(Ty=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ty))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ty(DCe)}const Ai=[];for(let e=0;e<256;++e)Ai.push((e+256).toString(16).slice(1));function FCe(e,t=0){return(Ai[e[t+0]]+Ai[e[t+1]]+Ai[e[t+2]]+Ai[e[t+3]]+"-"+Ai[e[t+4]]+Ai[e[t+5]]+"-"+Ai[e[t+6]]+Ai[e[t+7]]+"-"+Ai[e[t+8]]+Ai[e[t+9]]+"-"+Ai[e[t+10]]+Ai[e[t+11]]+Ai[e[t+12]]+Ai[e[t+13]]+Ai[e[t+14]]+Ai[e[t+15]]).toLowerCase()}const $Ce=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),uI={randomUUID:$Ce};function dg(e,t,n){if(uI.randomUUID&&!t&&!e)return uI.randomUUID();e=e||{};const r=e.random||(e.rng||zCe)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return FCe(r)}var BCe=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,HCe=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,WCe=/[^-+\dA-Z]/g;function Ri(e,t,n,r){if(arguments.length===1&&typeof e=="string"&&!/\d/.test(e)&&(t=e,e=void 0),e=e||e===0?e:new Date,e instanceof Date||(e=new Date(e)),isNaN(e))throw TypeError("Invalid date");t=String(cI[t]||t||cI.default);var i=t.slice(0,4);(i==="UTC:"||i==="GMT:")&&(t=t.slice(4),n=!0,i==="GMT:"&&(r=!0));var o=function(){return n?"getUTC":"get"},a=function(){return e[o()+"Date"]()},s=function(){return e[o()+"Day"]()},l=function(){return e[o()+"Month"]()},d=function(){return e[o()+"FullYear"]()},p=function(){return e[o()+"Hours"]()},g=function(){return e[o()+"Minutes"]()},m=function(){return e[o()+"Seconds"]()},y=function(){return e[o()+"Milliseconds"]()},b=function(){return n?0:e.getTimezoneOffset()},S=function(){return VCe(e)},E=function(){return UCe(e)},P={d:function(){return a()},dd:function(){return la(a())},ddd:function(){return Oo.dayNames[s()]},DDD:function(){return dI({y:d(),m:l(),d:a(),_:o(),dayName:Oo.dayNames[s()],short:!0})},dddd:function(){return Oo.dayNames[s()+7]},DDDD:function(){return dI({y:d(),m:l(),d:a(),_:o(),dayName:Oo.dayNames[s()+7]})},m:function(){return l()+1},mm:function(){return la(l()+1)},mmm:function(){return Oo.monthNames[l()]},mmmm:function(){return Oo.monthNames[l()+12]},yy:function(){return String(d()).slice(2)},yyyy:function(){return la(d(),4)},h:function(){return p()%12||12},hh:function(){return la(p()%12||12)},H:function(){return p()},HH:function(){return la(p())},M:function(){return g()},MM:function(){return la(g())},s:function(){return m()},ss:function(){return la(m())},l:function(){return la(y(),3)},L:function(){return la(Math.floor(y()/10))},t:function(){return p()<12?Oo.timeNames[0]:Oo.timeNames[1]},tt:function(){return p()<12?Oo.timeNames[2]:Oo.timeNames[3]},T:function(){return p()<12?Oo.timeNames[4]:Oo.timeNames[5]},TT:function(){return p()<12?Oo.timeNames[6]:Oo.timeNames[7]},Z:function(){return r?"GMT":n?"UTC":GCe(e)},o:function(){return(b()>0?"-":"+")+la(Math.floor(Math.abs(b())/60)*100+Math.abs(b())%60,4)},p:function(){return(b()>0?"-":"+")+la(Math.floor(Math.abs(b())/60),2)+":"+la(Math.floor(Math.abs(b())%60),2)},S:function(){return["th","st","nd","rd"][a()%10>3?0:(a()%100-a()%10!=10)*a()%10]},W:function(){return S()},WW:function(){return la(S())},N:function(){return E()}};return t.replace(BCe,function(k){return k in P?P[k]():k.slice(1,k.length-1)})}var cI={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},Oo={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},la=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(t).padStart(n,"0")},dI=function(t){var n=t.y,r=t.m,i=t.d,o=t._,a=t.dayName,s=t.short,l=s===void 0?!1:s,d=new Date,p=new Date;p.setDate(p[o+"Date"]()-1);var g=new Date;g.setDate(g[o+"Date"]()+1);var m=function(){return d[o+"Date"]()},y=function(){return d[o+"Month"]()},b=function(){return d[o+"FullYear"]()},S=function(){return p[o+"Date"]()},E=function(){return p[o+"Month"]()},P=function(){return p[o+"FullYear"]()},k=function(){return g[o+"Date"]()},T=function(){return g[o+"Month"]()},M=function(){return g[o+"FullYear"]()};return b()===n&&y()===r&&m()===i?l?"Tdy":"Today":P()===n&&E()===r&&S()===i?l?"Ysd":"Yesterday":M()===n&&T()===r&&k()===i?l?"Tmw":"Tomorrow":a},VCe=function(t){var n=new Date(t.getFullYear(),t.getMonth(),t.getDate());n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=new Date(n.getFullYear(),0,4);r.setDate(r.getDate()-(r.getDay()+6)%7+3);var i=n.getTimezoneOffset()-r.getTimezoneOffset();n.setHours(n.getHours()-i);var o=(n-r)/(864e5*7);return 1+Math.floor(o)},UCe=function(t){var n=t.getDay();return n===0&&(n=7),n},GCe=function(t){return(String(t).match(HCe)||[""]).pop().replace(WCe,"").replace(/GMT\+0000/g,"UTC")};const jCe=e=>{const{dispatch:t,getState:n}=e;return{onConnect:()=>{try{t($L(!0)),t(l3("Connected"));const r=n().gallery;r.categories.user.latest_mtime?t(WL("user")):t(aC("user")),r.categories.result.latest_mtime?t(WL("result")):t(aC("result"))}catch(r){console.error(r)}},onDisconnect:()=>{try{t($L(!1)),t(l3("Disconnected")),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:"Disconnected from server",level:"warning"}))}catch(r){console.error(r)}},onGenerationResult:r=>{try{const{shouldLoopback:i,activeTab:o}=n().options,a={uuid:dg(),...r,category:"result"};if(t(oy({category:"result",image:a})),i)switch(Lv[o]){case"img2img":{t(Xm(a));break}case"inpainting":{t(T5(a));break}}t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Image generated: ${r.url}`}))}catch(i){console.error(i)}},onIntermediateResult:r=>{try{t(k3e({uuid:dg(),...r})),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Intermediate image generated: ${r.url}`}))}catch(i){console.error(i)}},onPostprocessingResult:r=>{try{t(oy({category:"result",image:{uuid:dg(),...r,category:"result"}})),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Postprocessed: ${r.url}`}))}catch(i){console.error(i)}},onProgressUpdate:r=>{try{t(Kf(!0)),t(G2e(r))}catch(i){console.error(i)}},onError:r=>{const{message:i,additionalData:o}=r;try{t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Server error: ${i}`,level:"error"})),t(rC()),t(JL())}catch(a){console.error(a)}},onGalleryImages:r=>{const{images:i,areMoreImagesAvailable:o,category:a}=r,s=i.map(l=>({uuid:dg(),...l}));t(_3e({images:s,areMoreImagesAvailable:o,category:a})),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Loaded ${i.length} images`}))},onProcessingCanceled:()=>{t(q2e());const{intermediateImage:r}=n().gallery;r&&(t(oy({category:"result",image:r})),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Intermediate image saved: ${r.url}`})),t(JL())),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:"Processing canceled",level:"warning"}))},onImageDeleted:r=>{const{url:i}=r;t(F$(r));const{initialImage:o,maskPath:a}=n().options,{imageToInpaint:s}=n().inpainting;(o?.url===i||o===i)&&t($C()),s?.url===i&&t(t7()),a===i&&t(FC("")),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Image deleted: ${i}`}))},onImageUploaded:r=>{const{destination:i,...o}=r,a={uuid:dg(),...o};try{switch(t(oy({image:a,category:"user"})),i){case"img2img":{t(Xm(a));break}case"inpainting":{t(T5(a));break}default:{t($$(a));break}}t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Image uploaded: ${r.url}`}))}catch(s){console.error(s)}},onMaskImageUploaded:r=>{const{url:i}=r;t(FC(i)),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Mask image uploaded: ${i}`}))},onSystemConfig:r=>{t(j2e(r))},onModelChanged:r=>{const{model_name:i,model_list:o}=r;t(BL(o)),t(l3("Model Changed")),t(Kf(!1)),t(iC(!0)),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Model changed: ${i}`,level:"info"}))},onModelChangeFailed:r=>{const{model_name:i,model_list:o}=r;t(BL(o)),t(Kf(!1)),t(iC(!0)),t(rC()),t(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Model change failed: ${i}`,level:"error"}))}}},KCe=(e,t)=>{const{width:n,height:r}=e,i=document.createElement("div"),o=new h3.Stage({container:i,width:n,height:r}),a=new h3.Layer;return o.add(a),t.forEach(s=>a.add(new h3.Line({points:s.points,stroke:"rgb(0,0,0)",strokeWidth:s.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:s.tool==="brush"?"source-over":"destination-out"}))),a.draw(),i.remove(),{stage:o,layer:a}},qCe=(e,t)=>{const n=e.toCanvas().getContext("2d")?.getImageData(t.x,t.y,t.width,t.height);if(!n)throw new Error("Unable to get image data from generated canvas");return!new Uint32Array(n.data.buffer).some(i=>i!==0)},ZCe=(e,t,n)=>{const{stage:r,layer:i}=KCe(e,t),o=qCe(r,n);return i.add(new h3.Image({image:e,globalCompositeOperation:"source-out"})),{maskDataURL:r.toDataURL(),isMaskEmpty:o}},YCe=e=>{const{generationMode:t,optionsState:n,inpaintingState:r,systemState:i,imageToProcessUrl:o,maskImageElement:a}=e,{prompt:s,iterations:l,steps:d,cfgScale:p,threshold:g,perlin:m,height:y,width:b,sampler:S,seed:E,seamless:P,hiresFix:k,img2imgStrength:T,initialImage:M,shouldFitToWidthHeight:N,shouldGenerateVariations:z,variationAmount:F,seedWeights:$,shouldRunESRGAN:K,upscalingLevel:j,upscalingStrength:Z,shouldRunFacetool:me,facetoolStrength:pe,codeformerFidelity:be,facetoolType:we,shouldRandomizeSeed:Se}=n,{shouldDisplayInProgress:J}=i,G={prompt:s,iterations:l,steps:d,cfg_scale:p,threshold:g,perlin:m,height:y,width:b,sampler_name:S,seed:E,progress_images:J};if(G.seed=Se?c$(H_,W_):E,["txt2img","img2img"].includes(t)&&(G.seamless=P,G.hires_fix=k),t==="img2img"&&M&&(G.init_img=typeof M=="string"?M:M.url,G.strength=T,G.fit=N),t==="inpainting"&&a){const{lines:W,boundingBoxCoordinate:ie,boundingBoxDimensions:ce,inpaintReplace:xe,shouldUseInpaintReplace:De}=r,Me={...ie,...ce};G.init_img=o,G.strength=T,G.fit=!1;const{maskDataURL:Ve,isMaskEmpty:ke}=ZCe(a,W,Me);G.is_mask_empty=ke,G.init_mask=Ve.split("data:image/png;base64,")[1],De&&(G.inpaint_replace=xe),G.bounding_box=Me,G.progress_images=!1}z?(G.variation_amount=F,$&&(G.with_variations=jve($))):G.variation_amount=0;let te=!1,Q=!1;return K&&(te={level:j,strength:Z}),me&&(Q={type:we,strength:pe},we==="codeformer"&&(Q.codeformer_fidelity=be)),{generationParameters:G,esrganParameters:te,facetoolParameters:Q}},XCe=(e,t)=>{const{dispatch:n,getState:r}=e;return{emitGenerateImage:i=>{n(Kf(!0));const o=r(),{options:a,system:s,inpainting:l,gallery:d}=o,p={generationMode:i,optionsState:a,inpaintingState:l,systemState:s};if(i==="inpainting"){if(!z5.current||!l.imageToInpaint?.url){n(Mi({timestamp:Ri(new Date,"isoDateTime"),message:"Inpainting image not loaded, cannot generate image.",level:"error"})),n(rC());return}p.imageToProcessUrl=l.imageToInpaint.url,p.maskImageElement=z5.current}else if(!["txt2img","img2img"].includes(i)){if(!d.currentImage?.url)return;p.imageToProcessUrl=d.currentImage.url}const{generationParameters:g,esrganParameters:m,facetoolParameters:y}=YCe(p);t.emit("generateImage",g,m,y),g.init_mask&&(g.init_mask=g.init_mask.substr(0,20).concat("...")),n(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Image generation requested: ${JSON.stringify({...g,...m,...y})}`}))},emitRunESRGAN:i=>{n(Kf(!0));const o=r().options,{upscalingLevel:a,upscalingStrength:s}=o,l={upscale:[a,s]};t.emit("runPostprocessing",i,{type:"esrgan",...l}),n(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`ESRGAN upscale requested: ${JSON.stringify({file:i.url,...l})}`}))},emitRunFacetool:i=>{n(Kf(!0));const o=r().options,{facetoolType:a,facetoolStrength:s,codeformerFidelity:l}=o,d={facetool_strength:s};a==="codeformer"&&(d.codeformer_fidelity=l),t.emit("runPostprocessing",i,{type:a,...d}),n(Mi({timestamp:Ri(new Date,"isoDateTime"),message:`Face restoration (${a}) requested: ${JSON.stringify({file:i.url,...d})}`}))},emitDeleteImage:i=>{const{url:o,uuid:a,category:s}=i;n(F$(i)),t.emit("deleteImage",o,a,s)},emitRequestImages:i=>{const o=r().gallery,{earliest_mtime:a}=o.categories[i];t.emit("requestImages",i,a)},emitRequestNewImages:i=>{const o=r().gallery,{latest_mtime:a}=o.categories[i];t.emit("requestLatestImages",i,a)},emitCancelProcessing:()=>{t.emit("cancel")},emitUploadImage:i=>{const{file:o,destination:a}=i;t.emit("uploadImage",o,o.name,a)},emitUploadMaskImage:i=>{t.emit("uploadMaskImage",i,i.name)},emitRequestSystemConfig:()=>{t.emit("requestSystemConfig")},emitRequestModelChange:i=>{n(l3("Changing Model")),n(Kf(!0)),n(iC(!1)),t.emit("requestModelChange",i)}}},QCe=()=>{const{origin:e}=new URL(window.location.href),t=y3(e,{timeout:6e4,path:window.location.pathname+"socket.io"});let n=!1;return i=>o=>a=>{const{onConnect:s,onDisconnect:l,onError:d,onPostprocessingResult:p,onGenerationResult:g,onIntermediateResult:m,onProgressUpdate:y,onGalleryImages:b,onProcessingCanceled:S,onImageDeleted:E,onImageUploaded:P,onMaskImageUploaded:k,onSystemConfig:T,onModelChanged:M,onModelChangeFailed:N}=jCe(i),{emitGenerateImage:z,emitRunESRGAN:F,emitRunFacetool:$,emitDeleteImage:K,emitRequestImages:j,emitRequestNewImages:Z,emitCancelProcessing:me,emitUploadImage:pe,emitUploadMaskImage:be,emitRequestSystemConfig:we,emitRequestModelChange:Se}=XCe(i,t);switch(n||(t.on("connect",()=>s()),t.on("disconnect",()=>l()),t.on("error",J=>d(J)),t.on("generationResult",J=>g(J)),t.on("postprocessingResult",J=>p(J)),t.on("intermediateResult",J=>m(J)),t.on("progressUpdate",J=>y(J)),t.on("galleryImages",J=>b(J)),t.on("processingCanceled",()=>{S()}),t.on("imageDeleted",J=>{E(J)}),t.on("imageUploaded",J=>{P(J)}),t.on("maskImageUploaded",J=>{k(J)}),t.on("systemConfig",J=>{T(J)}),t.on("modelChanged",J=>{M(J)}),t.on("modelChangeFailed",J=>{N(J)}),n=!0),a.type){case"socketio/generateImage":{z(a.payload);break}case"socketio/runESRGAN":{F(a.payload);break}case"socketio/runFacetool":{$(a.payload);break}case"socketio/deleteImage":{K(a.payload);break}case"socketio/requestImages":{j(a.payload);break}case"socketio/requestNewImages":{Z(a.payload);break}case"socketio/cancelProcessing":{me();break}case"socketio/uploadImage":{pe(a.payload);break}case"socketio/uploadMaskImage":{be(a.payload);break}case"socketio/requestSystemConfig":{we();break}case"socketio/requestModelChange":{Se(a.payload);break}}o(a)}},JCe={key:"root",storage:_v,blacklist:["gallery","system","inpainting"]},e9e={key:"system",storage:_v,blacklist:["isCancelable","isConnected","isProcessing","currentStep","socketId","isESRGANAvailable","isGFPGANAvailable","currentStep","totalSteps","currentIteration","totalIterations","currentStatus"]},t9e={key:"gallery",storage:_v,whitelist:["galleryWidth","shouldPinGallery","shouldShowGallery","galleryScrollPosition","galleryImageMinimumWidth","galleryImageObjectFit"]},n9e={key:"inpainting",storage:_v,blacklist:["pastLines","futuresLines","cursorPosition"]},r9e=DF({options:K6e,gallery:o3(t9e,I3e),system:o3(e9e,Z2e),inpainting:o3(n9e,m3e)}),i9e=o3(JCe,r9e),FH=Ame({reducer:i9e,middleware:e=>e({serializableCheck:!1}).concat(QCe())}),pt=gve,Ge=ive;function x3(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?x3=function(n){return typeof n}:x3=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},x3(e)}function o9e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fI(e,t){for(var n=0;n({textColor:e.colorMode==="dark"?"gray.800":"gray.100"})},Accordion:{baseStyle:e=>({button:{fontWeight:"bold",_hover:{bgColor:e.colorMode==="dark"?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"}},panel:{paddingBottom:2}})},FormLabel:{baseStyle:{fontWeight:"light"}},Button:{variants:{imageHoverIconButton:e=>({bg:e.colorMode==="dark"?"blackAlpha.700":"whiteAlpha.800",color:e.colorMode==="dark"?"whiteAlpha.700":"blackAlpha.700",_hover:{bg:e.colorMode==="dark"?"blackAlpha.800":"whiteAlpha.800",color:e.colorMode==="dark"?"whiteAlpha.900":"blackAlpha.900"}})}}}}),BH=()=>w(zn,{width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",children:w(V0,{thickness:"2px",speed:"1s",emptyColor:"gray.200",color:"gray.400",size:"xl"})}),u9e=an(e=>e.system,e=>({isProcessing:e.isProcessing,currentStep:e.currentStep,totalSteps:e.totalSteps,currentStatusHasSteps:e.currentStatusHasSteps}),{memoizeOptions:{resultEqualityCheck:ba.exports.isEqual}}),c9e=()=>{const{isProcessing:e,currentStep:t,totalSteps:n,currentStatusHasSteps:r}=Ge(u9e),i=t?Math.round(t*100/n):0;return w(Wz,{value:i,isIndeterminate:e&&!r,className:"progress-bar"})},d9e=""+new URL("logo.13003d72.png",import.meta.url).href;function f9e(e){const{title:t,hotkey:n,description:r}=e;return oe("div",{className:"hotkey-modal-item",children:[oe("div",{className:"hotkey-info",children:[w("p",{className:"hotkey-title",children:t}),r&&w("p",{className:"hotkey-description",children:r})]}),w("div",{className:"hotkey-key",children:n})]})}function h9e({children:e}){const{isOpen:t,onOpen:n,onClose:r}=d5(),i=[{title:"Invoke",desc:"Generate an image",hotkey:"Ctrl+Enter"},{title:"Cancel",desc:"Cancel image generation",hotkey:"Shift+X"},{title:"Focus Prompt",desc:"Focus the prompt input area",hotkey:"Alt+A"},{title:"Toggle Options",desc:"Open and close the options panel",hotkey:"O"},{title:"Pin Options",desc:"Pin the options panel",hotkey:"Shift+O"},{title:"Toggle Gallery",desc:"Open and close the gallery drawer",hotkey:"G"},{title:"Change Tabs",desc:"Switch to another workspace",hotkey:"1-6"},{title:"Theme Toggle",desc:"Switch between dark and light modes",hotkey:"Shift+D"},{title:"Console Toggle",desc:"Open and close console",hotkey:"`"}],o=[{title:"Set Parameters",desc:"Use all parameters of the current image",hotkey:"A"},{title:"Set Seed",desc:"Use the seed of the current image",hotkey:"S"},{title:"Restore Faces",desc:"Restore the current image",hotkey:"R"},{title:"Upscale",desc:"Upscale the current image",hotkey:"U"},{title:"Show Info",desc:"Show metadata info of the current image",hotkey:"I"},{title:"Send To Image To Image",desc:"Send current image to Image to Image",hotkey:"Shift+I"},{title:"Delete Image",desc:"Delete the current image",hotkey:"Del"}],a=[{title:"Previous Image",desc:"Display the previous image in gallery",hotkey:"Arrow left"},{title:"Next Image",desc:"Display the next image in gallery",hotkey:"Arrow right"},{title:"Toggle Gallery Pin",desc:"Pins and unpins the gallery to the UI",hotkey:"Shift+G"},{title:"Increase Gallery Image Size",desc:"Increases gallery thumbnails size",hotkey:"Shift+Up"},{title:"Decrease Gallery Image Size",desc:"Decreases gallery thumbnails size",hotkey:"Shift+Down"},{title:"Reset Gallery Image Size",desc:"Resets image gallery size",hotkey:"Shift+R"}],s=[{title:"Select Brush",desc:"Selects the inpainting brush",hotkey:"B"},{title:"Select Eraser",desc:"Selects the inpainting eraser",hotkey:"E"},{title:"Quick Toggle Brush/Eraser",desc:"Quick toggle between brush and eraser",hotkey:"X"},{title:"Decrease Brush Size",desc:"Decreases the size of the inpainting brush/eraser",hotkey:"["},{title:"Increase Brush Size",desc:"Increases the size of the inpainting brush/eraser",hotkey:"]"},{title:"Hide Mask",desc:"Hide and unhide mask",hotkey:"H"},{title:"Decrease Mask Opacity",desc:"Decreases the opacity of the mask",hotkey:"Shift+["},{title:"Increase Mask Opacity",desc:"Increases the opacity of the mask",hotkey:"Shift+]"},{title:"Invert Mask",desc:"Invert the mask preview",hotkey:"Shift+M"},{title:"Clear Mask",desc:"Clear the entire mask",hotkey:"Shift+C"},{title:"Undo Stroke",desc:"Undo a brush stroke",hotkey:"Ctrl+Z"},{title:"Redo Stroke",desc:"Redo a brush stroke",hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:"Lock Bounding Box",desc:"Locks the bounding box",hotkey:"M"},{title:"Quick Toggle Lock Bounding Box",desc:"Hold to toggle locking the bounding box",hotkey:"Space"},{title:"Expand Inpainting Area",desc:"Expand your inpainting work area",hotkey:"Shift+J"}],l=d=>{const p=[];return d.forEach((g,m)=>{p.push(w(f9e,{title:g.title,description:g.desc,hotkey:g.hotkey},m))}),w("div",{className:"hotkey-modal-category",children:p})};return oe($n,{children:[C.exports.cloneElement(e,{onClick:n}),oe(T0,{isOpen:t,onClose:r,children:[w(Hm,{}),oe(Bm,{className:"hotkeys-modal",children:[w(d_,{}),w("h1",{children:"Keyboard Shorcuts"}),w("div",{className:"hotkeys-modal-items",children:oe(D4,{allowMultiple:!0,children:[oe(Uf,{children:[oe(Wf,{className:"hotkeys-modal-button",children:[w("h2",{children:"App Hotkeys"}),w(Vf,{})]}),w(Gf,{children:l(i)})]}),oe(Uf,{children:[oe(Wf,{className:"hotkeys-modal-button",children:[w("h2",{children:"General Hotkeys"}),w(Vf,{})]}),w(Gf,{children:l(o)})]}),oe(Uf,{children:[oe(Wf,{className:"hotkeys-modal-button",children:[w("h2",{children:"Gallery Hotkeys"}),w(Vf,{})]}),w(Gf,{children:l(a)})]}),oe(Uf,{children:[oe(Wf,{className:"hotkeys-modal-button",children:[w("h2",{children:"Inpainting Hotkeys"}),w(Vf,{})]}),w(Gf,{children:l(s)})]})]})})]})]})]})}const p9e=e=>{const{isProcessing:t,isConnected:n}=Ge(l=>l.system),r=pt(),{name:i,status:o,description:a}=e,s=()=>{r(Uye(i))};return oe("div",{className:"model-list-item",children:[w(ii,{label:a,hasArrow:!0,placement:"bottom",children:w("div",{className:"model-list-item-name",children:i})}),w(kD,{}),w("div",{className:`model-list-item-status ${o.split(" ").join("-")}`,children:o}),w("div",{className:"model-list-item-load-btn",children:w(Ya,{size:"sm",onClick:s,isDisabled:o==="active"||t||!n,children:"Load"})})]})},g9e=an(e=>e.system,e=>{const t=gn.map(e.model_list,(r,i)=>({name:i,...r})),n=t.find(r=>r.status==="active");return{models:t,activeModel:n}}),m9e=()=>{const{models:e}=Ge(g9e);return w("div",{className:"model-list",children:w(D4,{allowToggle:!0,children:oe(Uf,{children:[w(Wf,{children:oe("div",{className:"model-list-button",children:[w("h2",{children:"Models"}),w(Vf,{})]})}),w(Gf,{children:w("div",{className:"model-list-list",children:e.map((t,n)=>w(p9e,{name:t.name,status:t.status,description:t.description},n))})})]})})})};function US({settingTitle:e,isChecked:t,dispatcher:n}){const r=pt();return w(Hu,{styleClass:"settings-modal-item",label:e,isChecked:t,onChange:i=>r(n(i.target.checked))})}const v9e=an(e=>e.system,e=>{const{shouldDisplayInProgress:t,shouldConfirmOnDelete:n,shouldDisplayGuides:r,model_list:i}=e;return{shouldDisplayInProgress:t,shouldConfirmOnDelete:n,shouldDisplayGuides:r,models:gn.map(i,(o,a)=>a)}},{memoizeOptions:{resultEqualityCheck:ba.exports.isEqual}}),y9e=({children:e})=>{const{isOpen:t,onOpen:n,onClose:r}=d5(),{isOpen:i,onOpen:o,onClose:a}=d5(),{shouldDisplayInProgress:s,shouldConfirmOnDelete:l,shouldDisplayGuides:d}=Ge(v9e),p=()=>{QH.purge().then(()=>{r(),o()})};return oe($n,{children:[C.exports.cloneElement(e,{onClick:n}),oe(T0,{isOpen:t,onClose:r,children:[w(Hm,{}),oe(Bm,{className:"settings-modal",children:[w(h_,{className:"settings-modal-header",children:"Settings"}),w(d_,{}),oe(g5,{className:"settings-modal-content",children:[w(m9e,{}),oe("div",{className:"settings-modal-items",children:[w(US,{settingTitle:"Display In-Progress Images (slower)",isChecked:s,dispatcher:V2e}),w(US,{settingTitle:"Confirm on Delete",isChecked:l,dispatcher:f$}),w(US,{settingTitle:"Display Help Icons",isChecked:d,dispatcher:K2e})]}),oe("div",{className:"settings-modal-reset",children:[w(Qf,{size:"md",children:"Reset Web UI"}),w(zo,{children:"Resetting the web UI only resets the browser's local cache of your images and remembered settings. It does not delete any images from disk."}),w(zo,{children:"If images aren't showing up in the gallery or something else isn't working, please try resetting before submitting an issue on GitHub."}),w(Ya,{colorScheme:"red",onClick:p,children:"Reset Web UI"})]})]}),w(f_,{children:w(Ya,{onClick:r,children:"Close"})})]})]}),oe(T0,{closeOnOverlayClick:!1,isOpen:i,onClose:a,isCentered:!0,children:[w(Hm,{bg:"blackAlpha.300",backdropFilter:"blur(40px)"}),w(Bm,{children:w(g5,{pb:6,pt:6,children:w(zn,{justifyContent:"center",children:w(zo,{fontSize:"lg",children:"Web UI has been reset. Refresh the page to reload."})})})})]})]})},x9e=an(e=>e.system,e=>({isConnected:e.isConnected,isProcessing:e.isProcessing,currentIteration:e.currentIteration,totalIterations:e.totalIterations,currentStatus:e.currentStatus,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:ba.exports.isEqual}}),b9e=()=>{const{isConnected:e,isProcessing:t,currentIteration:n,totalIterations:r,currentStatus:i,hasError:o,wasErrorSeen:a}=Ge(x9e),s=pt();let l;e&&!o?l="status-good":l="status-bad";let d=i;return["generating","preparing","saving image","restoring faces","upscaling"].includes(d.toLowerCase())&&(l="status-working"),d&&t&&r>1&&(d+=` (${n}/${r})`),w(ii,{label:o&&!a?"Click to clear, check logs for details":void 0,children:w(zo,{cursor:o&&!a?"pointer":"initial",onClick:()=>{(o||!a)&&s(h$())},className:`status ${l}`,children:d})})},S9e=()=>{const{colorMode:e,toggleColorMode:t}=Z9();Bt("shift+d",()=>{t()},[e,t]);const n=e=="light"?w(kye,{}):w(Mye,{}),r=e=="light"?18:20;return oe("div",{className:"site-header",children:[oe("div",{className:"site-header-left-side",children:[w("img",{src:d9e,alt:"invoke-ai-logo"}),oe("h1",{children:["invoke ",w("strong",{children:"ai"})]})]}),oe("div",{className:"site-header-right-side",children:[w(b9e,{}),w(h9e,{children:w(Xi,{"aria-label":"Hotkeys",variant:"link",fontSize:24,size:"sm",icon:w(aye,{})})}),w(ii,{hasArrow:!0,label:"Theme",placement:"bottom",children:w(Xi,{"aria-label":"Toggle Dark Mode",onClick:t,variant:"link",size:"sm",fontSize:r,icon:n})}),w(ii,{hasArrow:!0,label:"Report Bug",placement:"bottom",children:w(Xi,{"aria-label":"Link to Github Issues",variant:"link",fontSize:23,size:"sm",icon:w(r0,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI/issues",children:w(m$,{})})})}),w(ii,{hasArrow:!0,label:"Github",placement:"bottom",children:w(Xi,{"aria-label":"Link to Github Repo",variant:"link",fontSize:20,size:"sm",icon:w(r0,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI",children:w(gye,{})})})}),w(ii,{hasArrow:!0,label:"Discord",placement:"bottom",children:w(Xi,{"aria-label":"Link to Discord Server",variant:"link",fontSize:20,size:"sm",icon:w(r0,{isExternal:!0,href:"https://discord.gg/ZmtBAhwWhy",children:w(pye,{})})})}),w(y9e,{children:w(Xi,{"aria-label":"Settings",variant:"link",fontSize:24,size:"sm",icon:w(nye,{})})})]})]})},w9e=an(e=>e.system,e=>e.log,{memoizeOptions:{resultEqualityCheck:(e,t)=>e.length===t.length}}),C9e=an(e=>e.system,e=>({shouldShowLogViewer:e.shouldShowLogViewer,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:ba.exports.isEqual}}),_9e=()=>{const e=pt(),t=Ge(w9e),{shouldShowLogViewer:n,hasError:r,wasErrorSeen:i}=Ge(C9e),[o,a]=C.exports.useState(!0),s=C.exports.useRef(null);C.exports.useLayoutEffect(()=>{s.current!==null&&o&&(s.current.scrollTop=s.current.scrollHeight)},[o,t,n]);const l=()=>{e(h$()),e(FL(!n))};return Bt("`",()=>{e(FL(!n))},[n]),oe($n,{children:[n&&w(U$,{defaultSize:{width:"100%",height:200},style:{display:"flex",position:"fixed",left:0,bottom:0,zIndex:20},maxHeight:"90vh",children:w("div",{className:"console",ref:s,onScroll:()=>{!s.current||o&&s.current.scrollTop{const{timestamp:m,message:y,level:b}=p;return oe("div",{className:`console-entry console-${b}-color`,children:[oe("p",{className:"console-timestamp",children:[m,":"]}),w("p",{className:"console-message",children:y})]},g)})})}),n&&w(ii,{hasArrow:!0,label:o?"Autoscroll On":"Autoscroll Off",children:w(Xi,{className:"console-autoscroll-icon-button","data-autoscroll-enabled":o,size:"sm","aria-label":"Toggle autoscroll",variant:"solid",icon:w(mye,{}),onClick:()=>a(!o)})}),w(ii,{hasArrow:!0,label:n?"Hide Console":"Show Console",children:w(Xi,{className:"console-toggle-icon-button","data-error-seen":r||!i,size:"sm",position:"fixed",variant:"solid","aria-label":"Toggle Log Viewer",icon:n?w(_ye,{}):w(bye,{}),onClick:l})})]})};function k9e(){async function e(n=""){return await fetch(n,{method:"GET",cache:"no-cache"})}const t=()=>{const n=document.location;e(n+"/flaskwebgui-keep-server-alive").then(i=>i)};(!{BASE_URL:"./",MODE:"production",DEV:!1,PROD:!0}.NODE_ENV||{BASE_URL:"./",MODE:"production",DEV:!1,PROD:!0}.NODE_ENV==="production")&&document.addEventListener("DOMContentLoaded",()=>{t(),setInterval(t,3e3)})}var E9e=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function Iv(e,t){var n=P9e(e);if(typeof n.path!="string"){var r=e.webkitRelativePath;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function P9e(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),i=E9e.get(r);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}var T9e=[".DS_Store","Thumbs.db"];function L9e(e){return H0(this,void 0,void 0,function(){return W0(this,function(t){return F5(e)&&A9e(e.dataTransfer)?[2,O9e(e.dataTransfer,e.type)]:I9e(e)?[2,M9e(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,R9e(e)]:[2,[]]})})}function A9e(e){return F5(e)}function I9e(e){return F5(e)&&F5(e.target)}function F5(e){return typeof e=="object"&&e!==null}function M9e(e){return qC(e.target.files).map(function(t){return Iv(t)})}function R9e(e){return H0(this,void 0,void 0,function(){var t;return W0(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(r){return r.getFile()}))];case 1:return t=n.sent(),[2,t.map(function(r){return Iv(r)})]}})})}function O9e(e,t){return H0(this,void 0,void 0,function(){var n,r;return W0(this,function(i){switch(i.label){case 0:return e.items?(n=qC(e.items).filter(function(o){return o.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(N9e))]):[3,2];case 1:return r=i.sent(),[2,pI(HH(r))];case 2:return[2,pI(qC(e.files).map(function(o){return Iv(o)}))]}})})}function pI(e){return e.filter(function(t){return T9e.indexOf(t.name)===-1})}function qC(e){if(e===null)return[];for(var t=[],n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nn)return[!1,xI(n)];if(e.sizen)return[!1,xI(n)]}return[!0,null]}function Df(e){return e!=null}function X9e(e){var t=e.files,n=e.accept,r=e.minSize,i=e.maxSize,o=e.multiple,a=e.maxFiles,s=e.validator;return!o&&t.length>1||o&&a>=1&&t.length>a?!1:t.every(function(l){var d=GH(l,n),p=Qm(d,1),g=p[0],m=jH(l,r,i),y=Qm(m,1),b=y[0],S=s?s(l):null;return g&&b&&!S})}function $5(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Ly(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function SI(e){e.preventDefault()}function Q9e(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function J9e(e){return e.indexOf("Edge/")!==-1}function e8e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Q9e(e)||J9e(e)}function hl(){for(var e=arguments.length,t=new Array(e),n=0;n1?i-1:0),a=1;a
InvokeAI - A Stable Diffusion Toolkit
-
+
diff --git a/frontend/src/features/tabs/Inpainting/InpaintingCanvas.tsx b/frontend/src/features/tabs/Inpainting/InpaintingCanvas.tsx
index 11de6e4d7a..9e69eec57d 100644
--- a/frontend/src/features/tabs/Inpainting/InpaintingCanvas.tsx
+++ b/frontend/src/features/tabs/Inpainting/InpaintingCanvas.tsx
@@ -300,15 +300,17 @@ const InpaintingCanvas = () => {
/>
)}
-
- {shouldShowBoundingBoxFill && shouldShowBoundingBox && (
-
- )}
- {shouldShowBoundingBox && }
- {shouldLockBoundingBox && (
-
- )}
-
+ {shouldShowMask && (
+
+ {shouldShowBoundingBoxFill && shouldShowBoundingBox && (
+
+ )}
+ {shouldShowBoundingBox && }
+ {shouldLockBoundingBox && (
+
+ )}
+
+ )}
>
)}
diff --git a/frontend/src/features/tabs/Inpainting/components/InpaintingBoundingBoxPreview.tsx b/frontend/src/features/tabs/Inpainting/components/InpaintingBoundingBoxPreview.tsx
index 610dddb42a..f30d4f8366 100644
--- a/frontend/src/features/tabs/Inpainting/components/InpaintingBoundingBoxPreview.tsx
+++ b/frontend/src/features/tabs/Inpainting/components/InpaintingBoundingBoxPreview.tsx
@@ -112,7 +112,7 @@ const InpaintingBoundingBoxPreview = () => {
() => () => {
const container = stageRef.current?.container();
if (!container) return;
- container.style.cursor = 'none';
+ container.style.cursor = 'unset';
},
[shouldLockBoundingBox]
);