import{r as y,f as fe,j as l,u as NS,c as ne,a as Ae,b as Ee,w as ns,d as un,o as At,S as yc,e as yo,g as qe,h as Nr,k as ei,i as xc,_ as Xd,l as FS,m as LS,R as Me,n as Ev,p as BS,q as Qd,s as ta,t as x1,v as b1,x as HS,y as WS,z as ee,A as S1,B as C1,C as bc,D as rs,F as L,E as K,G as VS,H as dd,T as Ce,I as w1,J as US,K as os,L as Pv,M as $S,N as GS,O as qS,P as Di,Q as j1,U as Iv,V as YS,W as k1,X as KS,Y as XS,Z as QS,$ as E1,a0 as ZS,a1 as JS,a2 as e3,a3 as t3,a4 as n3,a5 as r3,a6 as o3,a7 as P1,a8 as i3,a9 as a3,aa as ql,ab as s3,ac as l3,ad as Nl,ae as Yl,af as Zd,ag as Jd,ah as ef,ai as c3,aj as I1,ak as u3,al as M1,am as d3,an as T1,ao as _1,ap as Uo,aq as kn,ar as D1,as as is,at as f3,au as h3,av as A1,aw as tf,ax as nf,ay as O1,az as rf,aA as of,aB as Mv,aC as z1,aD as R1,aE as N1,aF as Fl,aG as Ll,aH as p3,aI as af,aJ as F1,aK as L1,aL as B1,aM as m3,aN as v3,aO as Tv,aP as _v,aQ as g3,aR as y3,aS as x3,aT as H1,aU as W1,aV as b3,aW as S3,aX as V1,aY as Dv,aZ as C3,a_ as Av,a$ as w3,b0 as j3,b1 as U1,b2 as k3,b3 as E3,b4 as P3,b5 as fd,b6 as Ov,b7 as $1,b8 as sf,b9 as I3,ba as zv,bb as Bl,bc as M3,bd as T3,be as Ua,bf as Kl,bg as G1,bh as Xl,bi as _3,bj as D3,bk as Sr,bl as q1,bm as Zf,bn as as,bo as A3,bp as O3,bq as z3,br as jr,bs as Y1,bt as R3,bu as N3,bv as K1,bw as F3,bx as L3,by as B3,bz as H3,bA as W3,bB as V3,bC as U3,bD as $3,bE as G3,bF as Rv,bG as q3,bH as Y3,bI as K3,bJ as X3,bK as Q3,bL as Z3,bM as hd,bN as za,bO as ml,bP as Nv,bQ as pd,bR as md,bS as vl,bT as Fv,bU as lf,bV as J3,bW as eC,bX as tC,bY as Sc,bZ as nC,b_ as rC,b$ as oC,c0 as iC,c1 as gl,c2 as vd,c3 as yl,c4 as Ma,c5 as aC,c6 as sC,c7 as X1,c8 as Ql,c9 as Jf,ca as Q1,cb as Z1,cc as J1,cd as lC,ce as e2,cf as t2,cg as n2,ch as r2,ci as o2,cj as Li,ck as Bi,cl as i2,cm as a2,cn as s2,co as l2,cp as c2,cq as cC,cr as uC,cs as Lv,ct as xl,cu as dC,cv as Bv,cw as Hv,cx as Wv,cy as Vv,cz as fC,cA as hC,cB as cf,cC as pC,cD as Uv,cE as bl,cF as Zl,cG as mC,cH as vC,cI as gC,cJ as yC,cK as u2,cL as xC,cM as bC}from"./index-f7f41e1f.js";import{I as tn,u as SC,c as CC,a as kt,b as Wt,A as xo,m as ar,d as Hi,e as ti,P as $a,f as wC,C as jC,g as Y,h as A}from"./storeHooks-eaf47ae3.js";function kC(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}var Jl="NOT_FOUND";function EC(e){var t;return{get:function(r){return t&&e(t.key,r)?t.value:Jl},put:function(r,o){t={key:r,value:o}},getEntries:function(){return t?[t]:[]},clear:function(){t=void 0}}}function PC(e,t){var n=[];function r(u){var f=n.findIndex(function(m){return t(u,m.key)});if(f>-1){var h=n[f];return f>0&&(n.splice(f,1),n.unshift(h)),h.value}return Jl}function o(u,f){r(u)===Jl&&(n.unshift({key:u,value:f}),n.length>e&&n.pop())}function s(){return n}function c(){n=[]}return{get:r,put:o,getEntries:s,clear:c}}var IC=function(t,n){return t===n};function MC(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var o=n.length,s=0;s1?t-1:0),r=1;rperformance.now():()=>Date.now(),h2=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(RC()),f2);function NC(e){let t=[],n=[],r=0,o=!1,s=!1;const c=new WeakSet,u={schedule:(f,h=!1,m=!1)=>{const v=m&&o,x=v?t:n;return h&&c.add(f),x.indexOf(f)===-1&&(x.push(f),v&&o&&(r=t.length)),f},cancel:f=>{const h=n.indexOf(f);h!==-1&&n.splice(h,1),c.delete(f)},process:f=>{if(o){s=!0;return}if(o=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let h=0;h(e[t]=NC(()=>Ga=!0),e),{}),LC=ss.reduce((e,t)=>{const n=Cc[t];return e[t]=(r,o=!1,s=!1)=>(Ga||WC(),n.schedule(r,o,s)),e},{}),BC=ss.reduce((e,t)=>(e[t]=Cc[t].cancel,e),{});ss.reduce((e,t)=>(e[t]=()=>Cc[t].process(Wi),e),{});const HC=e=>Cc[e].process(Wi),p2=e=>{Ga=!1,Wi.delta=uf?f2:Math.max(Math.min(e-Wi.timestamp,FC),1),Wi.timestamp=e,df=!0,ss.forEach(HC),df=!1,Ga&&(uf=!1,h2(p2))},WC=()=>{Ga=!0,uf=!0,df||h2(p2)},$v=()=>Wi;function eh(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=y.Children.toArray(e.path),c=fe((u,f)=>l.jsx(tn,{ref:f,viewBox:t,...o,...u,children:s.length?s:l.jsx("path",{fill:"currentColor",d:n})}));return c.displayName=r,c}function ls(e){const{theme:t}=NS(),n=SC();return y.useMemo(()=>CC(t.direction,{...n,...e}),[e,t.direction,n])}var VC=Object.defineProperty,UC=(e,t,n)=>t in e?VC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zt=(e,t,n)=>(UC(e,typeof t!="symbol"?t+"":t,n),n);function Gv(e){return e.sort((t,n)=>{const r=t.compareDocumentPosition(n);if(r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}var $C=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function qv(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function Yv(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var ff=typeof window<"u"?y.useLayoutEffect:y.useEffect,ec=e=>e,GC=class{constructor(){zt(this,"descendants",new Map),zt(this,"register",e=>{if(e!=null)return $C(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),zt(this,"unregister",e=>{this.descendants.delete(e);const t=Gv(Array.from(this.descendants.keys()));this.assignIndex(t)}),zt(this,"destroy",()=>{this.descendants.clear()}),zt(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),zt(this,"count",()=>this.descendants.size),zt(this,"enabledCount",()=>this.enabledValues().length),zt(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),zt(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),zt(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),zt(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),zt(this,"first",()=>this.item(0)),zt(this,"firstEnabled",()=>this.enabledItem(0)),zt(this,"last",()=>this.item(this.descendants.size-1)),zt(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),zt(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),zt(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),zt(this,"next",(e,t=!0)=>{const n=qv(e,this.count(),t);return this.item(n)}),zt(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=qv(r,this.enabledCount(),t);return this.enabledItem(o)}),zt(this,"prev",(e,t=!0)=>{const n=Yv(e,this.count()-1,t);return this.item(n)}),zt(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=Yv(r,this.enabledCount()-1,t);return this.enabledItem(o)}),zt(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=Gv(n);t!=null&&t.disabled&&(t.disabled=!!t.disabled);const o={node:e,index:-1,...t};this.descendants.set(e,o),this.assignIndex(r)})}};function qC(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function ct(...e){return t=>{e.forEach(n=>{qC(n,t)})}}function YC(...e){return y.useMemo(()=>ct(...e),e)}function KC(){const e=y.useRef(new GC);return ff(()=>()=>e.current.destroy()),e.current}var[XC,m2]=kt({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function QC(e){const t=m2(),[n,r]=y.useState(-1),o=y.useRef(null);ff(()=>()=>{o.current&&t.unregister(o.current)},[]),ff(()=>{if(!o.current)return;const c=Number(o.current.dataset.index);n!=c&&!Number.isNaN(c)&&r(c)});const s=ec(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:ct(s,o)}}function th(){return[ec(XC),()=>ec(m2()),()=>KC(),o=>QC(o)]}var[ZC,wc]=kt({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[JC,nh]=kt({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[ew,nL,tw,nw]=th(),Ai=fe(function(t,n){const{getButtonProps:r}=nh(),o=r(t,n),c={display:"flex",alignItems:"center",width:"100%",outline:0,...wc().button};return l.jsx(ne.button,{...o,className:Ae("chakra-accordion__button",t.className),__css:c})});Ai.displayName="AccordionButton";function rh(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(x,S)=>x!==S}=e,s=Wt(r),c=Wt(o),[u,f]=y.useState(n),h=t!==void 0,m=h?t:u,v=Wt(x=>{const C=typeof x=="function"?x(m):x;c(m,C)&&(h||f(C),s(C))},[h,s,m,c]);return[m,v]}function rw(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...c}=e;aw(e),sw(e);const u=tw(),[f,h]=y.useState(-1);y.useEffect(()=>()=>{h(-1)},[]);const[m,v]=rh({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:m,setIndex:v,htmlProps:c,getAccordionItemProps:S=>{let C=!1;return S!==null&&(C=Array.isArray(m)?m.includes(S):m===S),{isOpen:C,onChange:w=>{if(S!==null)if(o&&Array.isArray(m)){const k=w?m.concat(S):m.filter(M=>M!==S);v(k)}else w?v(S):s&&v(-1)}}},focusedIndex:f,setFocusedIndex:h,descendants:u}}var[ow,oh]=kt({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function iw(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:c}=oh(),u=y.useRef(null),f=y.useId(),h=r??f,m=`accordion-button-${h}`,v=`accordion-panel-${h}`;lw(e);const{register:x,index:S,descendants:C}=nw({disabled:t&&!n}),{isOpen:j,onChange:w}=s(S===-1?null:S);cw({isOpen:j,isDisabled:t});const k=()=>{w==null||w(!0)},M=()=>{w==null||w(!1)},P=y.useCallback(()=>{w==null||w(!j),c(S)},[S,c,j,w]),I=y.useCallback(z=>{const F={ArrowDown:()=>{const B=C.nextEnabled(S);B==null||B.node.focus()},ArrowUp:()=>{const B=C.prevEnabled(S);B==null||B.node.focus()},Home:()=>{const B=C.firstEnabled();B==null||B.node.focus()},End:()=>{const B=C.lastEnabled();B==null||B.node.focus()}}[z.key];F&&(z.preventDefault(),F(z))},[C,S]),T=y.useCallback(()=>{c(S)},[c,S]),_=y.useCallback(function(W={},F=null){return{...W,type:"button",ref:ct(x,u,F),id:m,disabled:!!t,"aria-expanded":!!j,"aria-controls":v,onClick:Ee(W.onClick,P),onFocus:Ee(W.onFocus,T),onKeyDown:Ee(W.onKeyDown,I)}},[m,t,j,P,T,I,v,x]),D=y.useCallback(function(W={},F=null){return{...W,ref:F,role:"region",id:v,"aria-labelledby":m,hidden:!j}},[m,j,v]);return{isOpen:j,isDisabled:t,isFocusable:n,onOpen:k,onClose:M,getButtonProps:_,getPanelProps:D,htmlProps:o}}function aw(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;ns({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function sw(e){ns({condition:!!(e.allowMultiple&&e.allowToggle),message:"If 'allowMultiple' is passed, 'allowToggle' will be ignored. Either remove 'allowToggle' or 'allowMultiple' depending on whether you want multiple accordions visible or not"})}function lw(e){ns({condition:!!(e.isFocusable&&!e.isDisabled),message:`Using only 'isFocusable', this prop is reserved for situations where you pass 'isDisabled' but you still want the element to receive focus (A11y). Either remove it or pass 'isDisabled' as well. `})}function cw(e){ns({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Oi(e){const{isOpen:t,isDisabled:n}=nh(),{reduceMotion:r}=oh(),o=Ae("chakra-accordion__icon",e.className),s=wc(),c={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return l.jsx(tn,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:c,...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Oi.displayName="AccordionIcon";var zi=fe(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...c}=iw(t),f={...wc().container,overflowAnchor:"none"},h=y.useMemo(()=>c,[c]);return l.jsx(JC,{value:h,children:l.jsx(ne.div,{ref:n,...s,className:Ae("chakra-accordion__item",o),__css:f,children:typeof r=="function"?r({isExpanded:!!c.isOpen,isDisabled:!!c.isDisabled}):r})})});zi.displayName="AccordionItem";var Wo={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Ta={scale:{enter:{scale:1},exit:{scale:.95}},fade:{enter:{opacity:1},exit:{opacity:0}},pushLeft:{enter:{x:"100%"},exit:{x:"-30%"}},pushRight:{enter:{x:"-100%"},exit:{x:"30%"}},pushUp:{enter:{y:"100%"},exit:{y:"-30%"}},pushDown:{enter:{y:"-100%"},exit:{y:"30%"}},slideLeft:{position:{left:0,top:0,bottom:0,width:"100%"},enter:{x:0,y:0},exit:{x:"-100%",y:0}},slideRight:{position:{right:0,top:0,bottom:0,width:"100%"},enter:{x:0,y:0},exit:{x:"100%",y:0}},slideUp:{position:{top:0,left:0,right:0,maxWidth:"100vw"},enter:{x:0,y:0},exit:{x:0,y:"-100%"}},slideDown:{position:{bottom:0,left:0,right:0,maxWidth:"100vw"},enter:{x:0,y:0},exit:{x:0,y:"100%"}}};function hf(e){var t;switch((t=e==null?void 0:e.direction)!=null?t:"right"){case"right":return Ta.slideRight;case"left":return Ta.slideLeft;case"bottom":return Ta.slideDown;case"top":return Ta.slideUp;default:return Ta.slideRight}}var $o={enter:{duration:.2,ease:Wo.easeOut},exit:{duration:.1,ease:Wo.easeIn}},rr={enter:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.enter}),exit:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.exit})},uw=e=>e!=null&&parseInt(e.toString(),10)>0,Kv={exit:{height:{duration:.2,ease:Wo.ease},opacity:{duration:.3,ease:Wo.ease}},enter:{height:{duration:.3,ease:Wo.ease},opacity:{duration:.4,ease:Wo.ease}}},dw={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:uw(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:rr.exit(Kv.exit,o)}},enter:({animateOpacity:e,endingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:1},height:t,transitionEnd:r==null?void 0:r.enter,transition:(s=n==null?void 0:n.enter)!=null?s:rr.enter(Kv.enter,o)}}},v2=y.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:c="auto",style:u,className:f,transition:h,transitionEnd:m,...v}=e,[x,S]=y.useState(!1);y.useEffect(()=>{const M=setTimeout(()=>{S(!0)});return()=>clearTimeout(M)},[]),ns({condition:Boolean(s>0&&r),message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const C=parseFloat(s.toString())>0,j={startingHeight:s,endingHeight:c,animateOpacity:o,transition:x?h:{enter:{duration:0}},transitionEnd:{enter:m==null?void 0:m.enter,exit:r?m==null?void 0:m.exit:{...m==null?void 0:m.exit,display:C?"block":"none"}}},w=r?n:!0,k=n||r?"enter":"exit";return l.jsx(xo,{initial:!1,custom:j,children:w&&l.jsx(ar.div,{ref:t,...v,className:Ae("chakra-collapse",f),style:{overflow:"hidden",display:"block",...u},custom:j,variants:dw,initial:r?"exit":!1,animate:k,exit:"exit"})})});v2.displayName="Collapse";var fw={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:rr.enter($o.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:0,transition:(r=e==null?void 0:e.exit)!=null?r:rr.exit($o.exit,n),transitionEnd:t==null?void 0:t.exit}}},g2={initial:"exit",animate:"enter",exit:"exit",variants:fw},hw=y.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:c,transitionEnd:u,delay:f,...h}=t,m=o||r?"enter":"exit",v=r?o&&r:!0,x={transition:c,transitionEnd:u,delay:f};return l.jsx(xo,{custom:x,children:v&&l.jsx(ar.div,{ref:n,className:Ae("chakra-fade",s),custom:x,...g2,animate:m,...h})})});hw.displayName="Fade";var pw={exit:({reverse:e,initialScale:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,...e?{scale:t,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{scale:t,...r==null?void 0:r.exit}},transition:(s=n==null?void 0:n.exit)!=null?s:rr.exit($o.exit,o)}},enter:({transitionEnd:e,transition:t,delay:n})=>{var r;return{opacity:1,scale:1,transition:(r=t==null?void 0:t.enter)!=null?r:rr.enter($o.enter,n),transitionEnd:e==null?void 0:e.enter}}},y2={initial:"exit",animate:"enter",exit:"exit",variants:pw},mw=y.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:c=.95,className:u,transition:f,transitionEnd:h,delay:m,...v}=t,x=r?o&&r:!0,S=o||r?"enter":"exit",C={initialScale:c,reverse:s,transition:f,transitionEnd:h,delay:m};return l.jsx(xo,{custom:C,children:x&&l.jsx(ar.div,{ref:n,className:Ae("chakra-offset-slide",u),...y2,animate:S,custom:C,...v})})});mw.displayName="ScaleFade";var vw={initial:({offsetX:e,offsetY:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,x:e,y:t,transition:(s=n==null?void 0:n.exit)!=null?s:rr.exit($o.exit,o),transitionEnd:r==null?void 0:r.exit}},enter:({transition:e,transitionEnd:t,delay:n})=>{var r;return{opacity:1,x:0,y:0,transition:(r=e==null?void 0:e.enter)!=null?r:rr.enter($o.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var c;const u={x:t,y:e};return{opacity:0,transition:(c=n==null?void 0:n.exit)!=null?c:rr.exit($o.exit,s),...o?{...u,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...u,...r==null?void 0:r.exit}}}}},pf={initial:"initial",animate:"enter",exit:"exit",variants:vw},gw=y.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:c,offsetX:u=0,offsetY:f=8,transition:h,transitionEnd:m,delay:v,...x}=t,S=r?o&&r:!0,C=o||r?"enter":"exit",j={offsetX:u,offsetY:f,reverse:s,transition:h,transitionEnd:m,delay:v};return l.jsx(xo,{custom:j,children:S&&l.jsx(ar.div,{ref:n,className:Ae("chakra-offset-slide",c),custom:j,...pf,animate:C,...x})})});gw.displayName="SlideFade";var Xv={exit:{duration:.15,ease:Wo.easeInOut},enter:{type:"spring",damping:25,stiffness:180}},yw={exit:({direction:e,transition:t,transitionEnd:n,delay:r})=>{var o;const{exit:s}=hf({direction:e});return{...s,transition:(o=t==null?void 0:t.exit)!=null?o:rr.exit(Xv.exit,r),transitionEnd:n==null?void 0:n.exit}},enter:({direction:e,transitionEnd:t,transition:n,delay:r})=>{var o;const{enter:s}=hf({direction:e});return{...s,transition:(o=n==null?void 0:n.enter)!=null?o:rr.enter(Xv.enter,r),transitionEnd:t==null?void 0:t.enter}}},x2=y.forwardRef(function(t,n){const{direction:r="right",style:o,unmountOnExit:s,in:c,className:u,transition:f,transitionEnd:h,delay:m,motionProps:v,...x}=t,S=hf({direction:r}),C=Object.assign({position:"fixed"},S.position,o),j=s?c&&s:!0,w=c||s?"enter":"exit",k={transitionEnd:h,transition:f,direction:r,delay:m};return l.jsx(xo,{custom:k,children:j&&l.jsx(ar.div,{...x,ref:n,initial:"exit",className:Ae("chakra-slide",u),animate:w,exit:"exit",custom:k,variants:yw,style:C,...v})})});x2.displayName="Slide";var Ri=fe(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:c}=oh(),{getPanelProps:u,isOpen:f}=nh(),h=u(s,n),m=Ae("chakra-accordion__panel",r),v=wc();c||delete h.hidden;const x=l.jsx(ne.div,{...h,__css:v.panel,className:m});return c?x:l.jsx(v2,{in:f,...o,children:x})});Ri.displayName="AccordionPanel";var ih=fe(function({children:t,reduceMotion:n,...r},o){const s=un("Accordion",r),c=At(r),{htmlProps:u,descendants:f,...h}=rw(c),m=y.useMemo(()=>({...h,reduceMotion:!!n}),[h,n]);return l.jsx(ew,{value:f,children:l.jsx(ow,{value:m,children:l.jsx(ZC,{value:s,children:l.jsx(ne.div,{ref:o,...u,className:Ae("chakra-accordion",r.className),__css:s.root,children:t})})})})});ih.displayName="Accordion";var mf=fe(function(t,n){const{htmlWidth:r,htmlHeight:o,alt:s,...c}=t;return l.jsx("img",{width:r,height:o,ref:n,alt:s,...c})});mf.displayName="NativeImage";function xw(e){const{loading:t,src:n,srcSet:r,onLoad:o,onError:s,crossOrigin:c,sizes:u,ignoreFallback:f}=e,[h,m]=y.useState("pending");y.useEffect(()=>{m(n?"loading":"pending")},[n]);const v=y.useRef(),x=y.useCallback(()=>{if(!n)return;S();const C=new Image;C.src=n,c&&(C.crossOrigin=c),r&&(C.srcset=r),u&&(C.sizes=u),t&&(C.loading=t),C.onload=j=>{S(),m("loaded"),o==null||o(j)},C.onerror=j=>{S(),m("failed"),s==null||s(j)},v.current=C},[n,c,r,u,o,s,t]),S=()=>{v.current&&(v.current.onload=null,v.current.onerror=null,v.current=null)};return Hi(()=>{if(!f)return h==="loading"&&x(),()=>{S()}},[h,x,f]),f?"loaded":h}var bw=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function Sw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var cs=fe(function(t,n){const{fallbackSrc:r,fallback:o,src:s,srcSet:c,align:u,fit:f,loading:h,ignoreFallback:m,crossOrigin:v,fallbackStrategy:x="beforeLoadOrError",referrerPolicy:S,...C}=t,j=r!==void 0||o!==void 0,w=h!=null||m||!j,k=xw({...t,ignoreFallback:w}),M=bw(k,x),P={ref:n,objectFit:f,objectPosition:u,...w?C:Sw(C,["onError","onLoad"])};return M?o||l.jsx(ne.img,{as:mf,className:"chakra-image__placeholder",src:r,...P}):l.jsx(ne.img,{as:mf,src:s,srcSet:c,crossOrigin:v,loading:h,referrerPolicy:S,className:"chakra-image",...P})});cs.displayName="Image";function ah(e){return y.Children.toArray(e).filter(t=>y.isValidElement(t))}var[Cw,ww]=kt({strict:!1,name:"ButtonGroupContext"}),jw={horizontal:{"> *:first-of-type:not(:last-of-type)":{borderEndRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderStartRadius:0}},vertical:{"> *:first-of-type:not(:last-of-type)":{borderBottomRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderTopRadius:0}}},kw={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},Qt=fe(function(t,n){const{size:r,colorScheme:o,variant:s,className:c,spacing:u="0.5rem",isAttached:f,isDisabled:h,orientation:m="horizontal",...v}=t,x=Ae("chakra-button__group",c),S=y.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:h}),[r,o,s,h]);let C={display:"inline-flex",...f?jw[m]:kw[m](u)};const j=m==="vertical";return l.jsx(Cw,{value:S,children:l.jsx(ne.div,{ref:n,role:"group",__css:C,className:x,"data-attached":f?"":void 0,"data-orientation":m,flexDir:j?"column":void 0,...v})})});Qt.displayName="ButtonGroup";function Ew(e){const[t,n]=y.useState(!e);return{ref:y.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function vf(e){const{children:t,className:n,...r}=e,o=y.isValidElement(t)?y.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=Ae("chakra-button__icon",n);return l.jsx(ne.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}vf.displayName="ButtonIcon";function tc(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=l.jsx(yc,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:c,...u}=e,f=Ae("chakra-button__spinner",s),h=n==="start"?"marginEnd":"marginStart",m=y.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[h]:t?r:0,fontSize:"1em",lineHeight:"normal",...c}),[c,t,h,r]);return l.jsx(ne.div,{className:f,...u,__css:m,children:o})}tc.displayName="ButtonSpinner";var ni=fe((e,t)=>{const n=ww(),r=yo("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:c,children:u,leftIcon:f,rightIcon:h,loadingText:m,iconSpacing:v="0.5rem",type:x,spinner:S,spinnerPlacement:C="start",className:j,as:w,...k}=At(e),M=y.useMemo(()=>{const _={...r==null?void 0:r._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...r,...!!n&&{_focus:_}}},[r,n]),{ref:P,type:I}=Ew(w),T={rightIcon:h,leftIcon:f,iconSpacing:v,children:u};return l.jsxs(ne.button,{ref:YC(t,P),as:w,type:x??I,"data-active":qe(c),"data-loading":qe(s),__css:M,className:Ae("chakra-button",j),...k,disabled:o||s,children:[s&&C==="start"&&l.jsx(tc,{className:"chakra-button__spinner--start",label:m,placement:"start",spacing:v,children:S}),s?m||l.jsx(ne.span,{opacity:0,children:l.jsx(Qv,{...T})}):l.jsx(Qv,{...T}),s&&C==="end"&&l.jsx(tc,{className:"chakra-button__spinner--end",label:m,placement:"end",spacing:v,children:S})]})});ni.displayName="Button";function Qv(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return l.jsxs(l.Fragment,{children:[t&&l.jsx(vf,{marginEnd:o,children:t}),r,n&&l.jsx(vf,{marginStart:o,children:n})]})}var ho=fe((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...c}=e,u=n||r,f=y.isValidElement(u)?y.cloneElement(u,{"aria-hidden":!0,focusable:!1}):null;return l.jsx(ni,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...c,children:f})});ho.displayName="IconButton";var[rL,Pw]=kt({name:"CheckboxGroupContext",strict:!1});function Iw(e){return l.jsx(ne.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:l.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function Mw(e){return l.jsx(ne.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:l.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function Tw(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?Mw:Iw;return n||t?l.jsx(ne.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:l.jsx(o,{...r})}):null}var[_w,b2]=kt({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Dw,ri]=kt({strict:!1,name:"FormControlContext"});function Aw(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...c}=e,u=y.useId(),f=t||`field-${u}`,h=`${f}-label`,m=`${f}-feedback`,v=`${f}-helptext`,[x,S]=y.useState(!1),[C,j]=y.useState(!1),[w,k]=y.useState(!1),M=y.useCallback((D={},z=null)=>({id:v,...D,ref:ct(z,W=>{W&&j(!0)})}),[v]),P=y.useCallback((D={},z=null)=>{var W,F;return{...D,ref:z,"data-focus":qe(w),"data-disabled":qe(o),"data-invalid":qe(r),"data-readonly":qe(s),id:(W=D.id)!=null?W:h,htmlFor:(F=D.htmlFor)!=null?F:f}},[f,o,w,r,s,h]),I=y.useCallback((D={},z=null)=>({id:m,...D,ref:ct(z,W=>{W&&S(!0)}),"aria-live":"polite"}),[m]),T=y.useCallback((D={},z=null)=>({...D,...c,ref:z,role:"group"}),[c]),_=y.useCallback((D={},z=null)=>({...D,ref:z,role:"presentation","aria-hidden":!0,children:D.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!w,onFocus:()=>k(!0),onBlur:()=>k(!1),hasFeedbackText:x,setHasFeedbackText:S,hasHelpText:C,setHasHelpText:j,id:f,labelId:h,feedbackId:m,helpTextId:v,htmlProps:c,getHelpTextProps:M,getErrorMessageProps:I,getRootProps:T,getLabelProps:P,getRequiredIndicatorProps:_}}var rt=fe(function(t,n){const r=un("Form",t),o=At(t),{getRootProps:s,htmlProps:c,...u}=Aw(o),f=Ae("chakra-form-control",t.className);return l.jsx(Dw,{value:u,children:l.jsx(_w,{value:r,children:l.jsx(ne.div,{...s({},n),className:f,__css:r.container})})})});rt.displayName="FormControl";var pn=fe(function(t,n){const r=ri(),o=b2(),s=Ae("chakra-form__helper-text",t.className);return l.jsx(ne.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});pn.displayName="FormHelperText";var[Ow,zw]=kt({name:"FormErrorStylesContext",errorMessage:`useFormErrorStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),mn=fe((e,t)=>{const n=un("FormError",e),r=At(e),o=ri();return o!=null&&o.isInvalid?l.jsx(Ow,{value:n,children:l.jsx(ne.div,{...o==null?void 0:o.getErrorMessageProps(r,t),className:Ae("chakra-form__error-message",e.className),__css:{display:"flex",alignItems:"center",...n.text}})}):null});mn.displayName="FormErrorMessage";var Rw=fe((e,t)=>{const n=zw(),r=ri();if(!(r!=null&&r.isInvalid))return null;const o=Ae("chakra-form__error-icon",e.className);return l.jsx(tn,{ref:t,"aria-hidden":!0,...e,__css:n.icon,className:o,children:l.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})});Rw.displayName="FormErrorIcon";var st=fe(function(t,n){var r;const o=yo("FormLabel",t),s=At(t),{className:c,children:u,requiredIndicator:f=l.jsx(S2,{}),optionalIndicator:h=null,...m}=s,v=ri(),x=(r=v==null?void 0:v.getLabelProps(m,n))!=null?r:{ref:n,...m};return l.jsxs(ne.label,{...x,className:Ae("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[u,v!=null&&v.isRequired?f:h]})});st.displayName="FormLabel";var S2=fe(function(t,n){const r=ri(),o=b2();if(!(r!=null&&r.isRequired))return null;const s=Ae("chakra-form__required-indicator",t.className);return l.jsx(ne.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});S2.displayName="RequiredIndicator";function sh(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=lh(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":Nr(n),"aria-required":Nr(o),"aria-readonly":Nr(r)}}function lh(e){var t,n,r;const o=ri(),{id:s,disabled:c,readOnly:u,required:f,isRequired:h,isInvalid:m,isReadOnly:v,isDisabled:x,onFocus:S,onBlur:C,...j}=e,w=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&w.push(o.feedbackId),o!=null&&o.hasHelpText&&w.push(o.helpTextId),{...j,"aria-describedby":w.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=c??x)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=u??v)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=f??h)!=null?r:o==null?void 0:o.isRequired,isInvalid:m??(o==null?void 0:o.isInvalid),onFocus:Ee(o==null?void 0:o.onFocus,S),onBlur:Ee(o==null?void 0:o.onBlur,C)}}var ch={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},C2=ne("span",{baseStyle:ch});C2.displayName="VisuallyHidden";var Nw=ne("input",{baseStyle:ch});Nw.displayName="VisuallyHiddenInput";var Zv=!1,us=null,Xo=!1,gf=!1,yf=new Set;function uh(e,t){yf.forEach(n=>n(e,t))}var Fw=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function Lw(e){return!(e.metaKey||!Fw&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Jv(e){Xo=!0,Lw(e)&&(us="keyboard",uh("keyboard",e))}function wi(e){if(us="pointer",e.type==="mousedown"||e.type==="pointerdown"){Xo=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;uh("pointer",e)}}function Bw(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function Hw(e){Bw(e)&&(Xo=!0,us="virtual")}function Ww(e){e.target===window||e.target===document||(!Xo&&!gf&&(us="virtual",uh("virtual",e)),Xo=!1,gf=!1)}function Vw(){Xo=!1,gf=!0}function eg(){return us!=="pointer"}function Uw(){if(typeof window>"u"||Zv)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Xo=!0,e.apply(this,n)},document.addEventListener("keydown",Jv,!0),document.addEventListener("keyup",Jv,!0),document.addEventListener("click",Hw,!0),window.addEventListener("focus",Ww,!0),window.addEventListener("blur",Vw,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",wi,!0),document.addEventListener("pointermove",wi,!0),document.addEventListener("pointerup",wi,!0)):(document.addEventListener("mousedown",wi,!0),document.addEventListener("mousemove",wi,!0),document.addEventListener("mouseup",wi,!0)),Zv=!0}function w2(e){Uw(),e(eg());const t=()=>e(eg());return yf.add(t),()=>{yf.delete(t)}}function $w(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function j2(e={}){const t=lh(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:c,onBlur:u,onFocus:f,"aria-describedby":h}=t,{defaultChecked:m,isChecked:v,isFocusable:x,onChange:S,isIndeterminate:C,name:j,value:w,tabIndex:k=void 0,"aria-label":M,"aria-labelledby":P,"aria-invalid":I,...T}=e,_=$w(T,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),D=Wt(S),z=Wt(u),W=Wt(f),[F,B]=y.useState(!1),[Q,U]=y.useState(!1),[X,te]=y.useState(!1),[re,$]=y.useState(!1);y.useEffect(()=>w2(B),[]);const Z=y.useRef(null),[oe,le]=y.useState(!0),[ze,Re]=y.useState(!!m),Ie=v!==void 0,pe=Ie?v:ze,ce=y.useCallback(ye=>{if(r||n){ye.preventDefault();return}Ie||Re(pe?ye.target.checked:C?!0:ye.target.checked),D==null||D(ye)},[r,n,pe,Ie,C,D]);Hi(()=>{Z.current&&(Z.current.indeterminate=Boolean(C))},[C]),ti(()=>{n&&U(!1)},[n,U]),Hi(()=>{const ye=Z.current;ye!=null&&ye.form&&(ye.form.onreset=()=>{Re(!!m)})},[]);const Ne=n&&!x,Ve=y.useCallback(ye=>{ye.key===" "&&$(!0)},[$]),Ue=y.useCallback(ye=>{ye.key===" "&&$(!1)},[$]);Hi(()=>{if(!Z.current)return;Z.current.checked!==pe&&Re(Z.current.checked)},[Z.current]);const $e=y.useCallback((ye={},Pe=null)=>{const et=Be=>{Q&&Be.preventDefault(),$(!0)};return{...ye,ref:Pe,"data-active":qe(re),"data-hover":qe(X),"data-checked":qe(pe),"data-focus":qe(Q),"data-focus-visible":qe(Q&&F),"data-indeterminate":qe(C),"data-disabled":qe(n),"data-invalid":qe(s),"data-readonly":qe(r),"aria-hidden":!0,onMouseDown:Ee(ye.onMouseDown,et),onMouseUp:Ee(ye.onMouseUp,()=>$(!1)),onMouseEnter:Ee(ye.onMouseEnter,()=>te(!0)),onMouseLeave:Ee(ye.onMouseLeave,()=>te(!1))}},[re,pe,n,Q,F,X,C,s,r]),Qe=y.useCallback((ye={},Pe=null)=>({..._,...ye,ref:ct(Pe,et=>{et&&le(et.tagName==="LABEL")}),onClick:Ee(ye.onClick,()=>{var et;oe||((et=Z.current)==null||et.click(),requestAnimationFrame(()=>{var Be;(Be=Z.current)==null||Be.focus()}))}),"data-disabled":qe(n),"data-checked":qe(pe),"data-invalid":qe(s)}),[_,n,pe,s,oe]),ve=y.useCallback((ye={},Pe=null)=>({...ye,ref:ct(Z,Pe),type:"checkbox",name:j,value:w,id:c,tabIndex:k,onChange:Ee(ye.onChange,ce),onBlur:Ee(ye.onBlur,z,()=>U(!1)),onFocus:Ee(ye.onFocus,W,()=>U(!0)),onKeyDown:Ee(ye.onKeyDown,Ve),onKeyUp:Ee(ye.onKeyUp,Ue),required:o,checked:pe,disabled:Ne,readOnly:r,"aria-label":M,"aria-labelledby":P,"aria-invalid":I?Boolean(I):s,"aria-describedby":h,"aria-disabled":n,style:ch}),[j,w,c,ce,z,W,Ve,Ue,o,pe,Ne,r,M,P,I,s,h,n,k]),Te=y.useCallback((ye={},Pe=null)=>({...ye,ref:Pe,onMouseDown:Ee(ye.onMouseDown,tg),onTouchStart:Ee(ye.onTouchStart,tg),"data-disabled":qe(n),"data-checked":qe(pe),"data-invalid":qe(s)}),[pe,n,s]);return{state:{isInvalid:s,isFocused:Q,isChecked:pe,isActive:re,isHovered:X,isIndeterminate:C,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:Qe,getCheckboxProps:$e,getInputProps:ve,getLabelProps:Te,htmlProps:_}}function tg(e){e.preventDefault(),e.stopPropagation()}var Gw={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},qw={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},Yw=ei({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),Kw=ei({from:{opacity:0},to:{opacity:1}}),Xw=ei({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),k2=fe(function(t,n){const r=Pw(),o={...r,...t},s=un("Checkbox",o),c=At(t),{spacing:u="0.5rem",className:f,children:h,iconColor:m,iconSize:v,icon:x=l.jsx(Tw,{}),isChecked:S,isDisabled:C=r==null?void 0:r.isDisabled,onChange:j,inputProps:w,...k}=c;let M=S;r!=null&&r.value&&c.value&&(M=r.value.includes(c.value));let P=j;r!=null&&r.onChange&&c.value&&(P=xc(r.onChange,j));const{state:I,getInputProps:T,getCheckboxProps:_,getLabelProps:D,getRootProps:z}=j2({...k,isDisabled:C,isChecked:M,onChange:P}),W=y.useMemo(()=>({animation:I.isIndeterminate?`${Kw} 20ms linear, ${Xw} 200ms linear`:`${Yw} 200ms linear`,fontSize:v,color:m,...s.icon}),[m,v,,I.isIndeterminate,s.icon]),F=y.cloneElement(x,{__css:W,isIndeterminate:I.isIndeterminate,isChecked:I.isChecked});return l.jsxs(ne.label,{__css:{...qw,...s.container},className:Ae("chakra-checkbox",f),...z(),children:[l.jsx("input",{className:"chakra-checkbox__input",...T(w,n)}),l.jsx(ne.span,{__css:{...Gw,...s.control},className:"chakra-checkbox__control",..._(),children:F}),h&&l.jsx(ne.span,{className:"chakra-checkbox__label",...D(),__css:{marginStart:u,...s.label},children:h})]})});k2.displayName="Checkbox";function Qw(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function dh(e,t){let n=Qw(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function xf(e){if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n}function ng(e,t,n){return(e-t)*100/(n-t)}function Zw(e,t,n){return(n-t)*e+t}function rg(e,t,n){const r=Math.round((e-t)/n)*n+t,o=xf(n);return dh(r,o)}function Hl(e,t,n){return e==null?e:(n{var F;return r==null?"":(F=gd(r,s,n))!=null?F:""}),x=typeof o<"u",S=x?o:m,C=E2(io(S),s),j=n??C,w=y.useCallback(F=>{F!==S&&(x||v(F.toString()),h==null||h(F.toString(),io(F)))},[h,x,S]),k=y.useCallback(F=>{let B=F;return f&&(B=Hl(B,c,u)),dh(B,j)},[j,f,u,c]),M=y.useCallback((F=s)=>{let B;S===""?B=io(F):B=io(S)+F,B=k(B),w(B)},[k,s,w,S]),P=y.useCallback((F=s)=>{let B;S===""?B=io(-F):B=io(S)-F,B=k(B),w(B)},[k,s,w,S]),I=y.useCallback(()=>{var F;let B;r==null?B="":B=(F=gd(r,s,n))!=null?F:c,w(B)},[r,n,s,w,c]),T=y.useCallback(F=>{var B;const Q=(B=gd(F,s,j))!=null?B:c;w(Q)},[j,s,w,c]),_=io(S);return{isOutOfRange:_>u||_{const s=typeof e=="function"?e():e??document;if(!(!n||!s))return s.addEventListener(t,o,r),()=>{s.removeEventListener(t,o,r)}},[t,e,r,o,n]),()=>{const s=typeof e=="function"?e():e??document;s==null||s.removeEventListener(t,o,r)}}function e5(e){return"current"in e}var P2=()=>typeof window<"u";function t5(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var n5=e=>P2()&&e.test(navigator.vendor),r5=e=>P2()&&e.test(t5()),o5=()=>r5(/mac|iphone|ipad|ipod/i),i5=()=>o5()&&n5(/apple/i);function a5(e){const{ref:t,elements:n,enabled:r}=e,o=()=>{var s,c;return(c=(s=t.current)==null?void 0:s.ownerDocument)!=null?c:document};Go(o,"pointerdown",s=>{if(!i5()||!r)return;const c=s.target,f=(n??[t]).some(h=>{const m=e5(h)?h.current:h;return(m==null?void 0:m.contains(c))||m===c});o().activeElement!==c&&f&&(s.preventDefault(),c.focus())})}var lt={},s5={get exports(){return lt},set exports(e){lt=e}},l5="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",c5=l5,u5=c5;function I2(){}function M2(){}M2.resetWarningCache=I2;var d5=function(){function e(r,o,s,c,u,f){if(f!==u5){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:M2,resetWarningCache:I2};return n.PropTypes=n,n};s5.exports=d5();var bf="data-focus-lock",T2="data-focus-lock-disabled",f5="data-no-focus-lock",h5="data-autofocus-inside",p5="data-no-autofocus";function m5(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function v5(e,t){var n=y.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}function _2(e,t){return v5(t||null,function(n){return e.forEach(function(r){return m5(r,n)})})}var yd={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},xr=function(){return xr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r0&&s[s.length-1])&&(h[0]===6||h[0]===2)){n=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]0)&&!(o=r.next()).done;)s.push(o.value)}catch(u){c={error:u}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(c)throw c.error}}return s}function Sf(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(T5)},_5=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],mh=_5.join(","),D5="".concat(mh,", [data-focus-guard]"),K2=function(e,t){return Er((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?D5:mh)?[r]:[],K2(r))},[])},A5=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?jc([e.contentDocument.body],t):[e]},jc=function(e,t){return e.reduce(function(n,r){var o,s=K2(r,t),c=(o=[]).concat.apply(o,s.map(function(u){return A5(u,t)}));return n.concat(c,r.parentNode?Er(r.parentNode.querySelectorAll(mh)).filter(function(u){return u===r}):[])},[])},O5=function(e){var t=e.querySelectorAll("[".concat(h5,"]"));return Er(t).map(function(n){return jc([n])}).reduce(function(n,r){return n.concat(r)},[])},vh=function(e,t){return Er(e).filter(function(n){return V2(t,n)}).filter(function(n){return P5(n)})},ig=function(e,t){return t===void 0&&(t=new Map),Er(e).filter(function(n){return U2(t,n)})},Cf=function(e,t,n){return Y2(vh(jc(e,n),t),!0,n)},ag=function(e,t){return Y2(vh(jc(e),t),!1)},z5=function(e,t){return vh(O5(e),t)},Vi=function(e,t){return e.shadowRoot?Vi(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:Er(e.children).some(function(n){var r;if(n instanceof HTMLIFrameElement){var o=(r=n.contentDocument)===null||r===void 0?void 0:r.body;return o?Vi(o,t):!1}return Vi(n,t)})},R5=function(e){for(var t=new Set,n=e.length,r=0;r0&&t.add(o),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(c,u){return!t.has(u)})},X2=function(e){return e.parentNode?X2(e.parentNode):e},gh=function(e){var t=nc(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(bf);return n.push.apply(n,o?R5(Er(X2(r).querySelectorAll("[".concat(bf,'="').concat(o,'"]:not([').concat(T2,'="disabled"])')))):[r]),n},[])},N5=function(e){try{return e()}catch{return}},qa=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?qa(t.shadowRoot):t instanceof HTMLIFrameElement&&N5(function(){return t.contentWindow.document})?qa(t.contentWindow.document):t}},F5=function(e,t){return e===t},L5=function(e,t){return Boolean(Er(e.querySelectorAll("iframe")).some(function(n){return F5(n,t)}))},Q2=function(e,t){return t===void 0&&(t=qa(B2(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:gh(e).some(function(n){return Vi(n,t)||L5(n,t)})},B5=function(e){e===void 0&&(e=document);var t=qa(e);return t?Er(e.querySelectorAll("[".concat(f5,"]"))).some(function(n){return Vi(n,t)}):!1},H5=function(e,t){return t.filter(q2).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},yh=function(e,t){return q2(e)&&e.name?H5(e,t):e},W5=function(e){var t=new Set;return e.forEach(function(n){return t.add(yh(n,e))}),e.filter(function(n){return t.has(n)})},sg=function(e){return e[0]&&e.length>1?yh(e[0],e):e[0]},lg=function(e,t){return e.length>1?e.indexOf(yh(e[t],e)):t},Z2="NEW_FOCUS",V5=function(e,t,n,r){var o=e.length,s=e[0],c=e[o-1],u=ph(n);if(!(n&&e.indexOf(n)>=0)){var f=n!==void 0?t.indexOf(n):-1,h=r?t.indexOf(r):f,m=r?e.indexOf(r):-1,v=f-h,x=t.indexOf(s),S=t.indexOf(c),C=W5(t),j=n!==void 0?C.indexOf(n):-1,w=j-(r?C.indexOf(r):f),k=lg(e,0),M=lg(e,o-1);if(f===-1||m===-1)return Z2;if(!v&&m>=0)return m;if(f<=x&&u&&Math.abs(v)>1)return M;if(f>=S&&u&&Math.abs(v)>1)return k;if(v&&Math.abs(w)>1)return m;if(f<=x)return M;if(f>S)return k;if(v)return Math.abs(v)>1?m:(o+m+v)%o}},U5=function(e){return function(t){var n,r=(n=$2(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},$5=function(e,t,n){var r=e.map(function(s){var c=s.node;return c}),o=ig(r.filter(U5(n)));return o&&o.length?sg(o):sg(ig(t))},wf=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&wf(e.parentNode.host||e.parentNode,t),t},xd=function(e,t){for(var n=wf(e),r=wf(t),o=0;o=0)return s}return!1},J2=function(e,t,n){var r=nc(e),o=nc(t),s=r[0],c=!1;return o.filter(Boolean).forEach(function(u){c=xd(c||u,u)||c,n.filter(Boolean).forEach(function(f){var h=xd(s,f);h&&(!c||Vi(h,c)?c=h:c=xd(h,c))})}),c},G5=function(e,t){return e.reduce(function(n,r){return n.concat(z5(r,t))},[])},q5=function(e,t){var n=new Map;return t.forEach(function(r){return n.set(r.node,r)}),e.map(function(r){return n.get(r)}).filter(M5)},Y5=function(e,t){var n=qa(nc(e).length>0?document:B2(e).ownerDocument),r=gh(e).filter(rc),o=J2(n||e,e,r),s=new Map,c=ag(r,s),u=Cf(r,s).filter(function(S){var C=S.node;return rc(C)});if(!(!u[0]&&(u=c,!u[0]))){var f=ag([o],s).map(function(S){var C=S.node;return C}),h=q5(f,u),m=h.map(function(S){var C=S.node;return C}),v=V5(m,f,n,t);if(v===Z2){var x=$5(c,m,G5(r,s));if(x)return{node:x};console.warn("focus-lock: cannot find any node to move focus into");return}return v===void 0?v:h[v]}},K5=function(e){var t=gh(e).filter(rc),n=J2(e,e,t),r=new Map,o=Cf([n],r,!0),s=Cf(t,r).filter(function(c){var u=c.node;return rc(u)}).map(function(c){var u=c.node;return u});return o.map(function(c){var u=c.node,f=c.index;return{node:u,index:f,lockItem:s.indexOf(u)>=0,guard:ph(u)}})},X5=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},bd=0,Sd=!1,ey=function(e,t,n){n===void 0&&(n={});var r=Y5(e,t);if(!Sd&&r){if(bd>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Sd=!0,setTimeout(function(){Sd=!1},1);return}bd++,X5(r.node,n.focusOptions),bd--}};function ty(e){var t=window,n=t.setImmediate;typeof n<"u"?n(e):setTimeout(e,1)}var Q5=function(){return document&&document.activeElement===document.body},Z5=function(){return Q5()||B5()},Ui=null,Ni=null,$i=null,Ya=!1,J5=function(){return!0},e6=function(t){return(Ui.whiteList||J5)(t)},t6=function(t,n){$i={observerNode:t,portaledElement:n}},n6=function(t){return $i&&$i.portaledElement===t};function cg(e,t,n,r){var o=null,s=e;do{var c=r[s];if(c.guard)c.node.dataset.focusAutoGuard&&(o=c);else if(c.lockItem){if(s!==e)return;o=null}else break}while((s+=n)!==t);o&&(o.node.tabIndex=0)}var r6=function(t){return t&&"current"in t?t.current:t},o6=function(t){return t?Boolean(Ya):Ya==="meanwhile"},i6=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},a6=function(t,n){return n.some(function(r){return i6(t,r,r)})},oc=function(){var t=!1;if(Ui){var n=Ui,r=n.observed,o=n.persistentFocus,s=n.autoFocus,c=n.shards,u=n.crossFrame,f=n.focusOptions,h=r||$i&&$i.portaledElement,m=document&&document.activeElement;if(h){var v=[h].concat(c.map(r6).filter(Boolean));if((!m||e6(m))&&(o||o6(u)||!Z5()||!Ni&&s)&&(h&&!(Q2(v)||m&&a6(m,v)||n6(m))&&(document&&!Ni&&m&&!s?(m.blur&&m.blur(),document.body.focus()):(t=ey(v,Ni,{focusOptions:f}),$i={})),Ya=!1,Ni=document&&document.activeElement),document){var x=document&&document.activeElement,S=K5(v),C=S.map(function(j){var w=j.node;return w}).indexOf(x);C>-1&&(S.filter(function(j){var w=j.guard,k=j.node;return w&&k.dataset.focusAutoGuard}).forEach(function(j){var w=j.node;return w.removeAttribute("tabIndex")}),cg(C,S.length,1,S),cg(C,-1,-1,S))}}}return t},ny=function(t){oc()&&t&&(t.stopPropagation(),t.preventDefault())},xh=function(){return ty(oc)},s6=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||t6(r,n)},l6=function(){return null},ry=function(){Ya="just",setTimeout(function(){Ya="meanwhile"},0)},c6=function(){document.addEventListener("focusin",ny),document.addEventListener("focusout",xh),window.addEventListener("blur",ry)},u6=function(){document.removeEventListener("focusin",ny),document.removeEventListener("focusout",xh),window.removeEventListener("blur",ry)};function d6(e){return e.filter(function(t){var n=t.disabled;return!n})}function f6(e){var t=e.slice(-1)[0];t&&!Ui&&c6();var n=Ui,r=n&&t&&t.id===n.id;Ui=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(Ni=null,(!r||n.observed!==t.observed)&&t.onActivation(),oc(),ty(oc)):(u6(),Ni=null)}N2.assignSyncMedium(s6);F2.assignMedium(xh);y5.assignMedium(function(e){return e({moveFocusInside:ey,focusInside:Q2})});const h6=C5(d6,f6)(l6);var oy=y.forwardRef(function(t,n){return y.createElement(L2,Xd({sideCar:h6,ref:n},t))}),iy=L2.propTypes||{};iy.sideCar;kC(iy,["sideCar"]);oy.propTypes={};const ug=oy;function ay(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function sy(e){var t;if(!ay(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function p6(e){var t,n;return(n=(t=ly(e))==null?void 0:t.defaultView)!=null?n:window}function ly(e){return ay(e)?e.ownerDocument:document}function m6(e){return ly(e).activeElement}var cy=e=>e.hasAttribute("tabindex"),v6=e=>cy(e)&&e.tabIndex===-1;function g6(e){return Boolean(e.getAttribute("disabled"))===!0||Boolean(e.getAttribute("aria-disabled"))===!0}function uy(e){return e.parentElement&&uy(e.parentElement)?!0:e.hidden}function y6(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function dy(e){if(!sy(e)||uy(e)||g6(e))return!1;const{localName:t}=e;if(["input","select","textarea","button"].indexOf(t)>=0)return!0;const r={a:()=>e.hasAttribute("href"),audio:()=>e.hasAttribute("controls"),video:()=>e.hasAttribute("controls")};return t in r?r[t]():y6(e)?!0:cy(e)}function x6(e){return e?sy(e)&&dy(e)&&!v6(e):!1}var b6=["input:not(:disabled):not([disabled])","select:not(:disabled):not([disabled])","textarea:not(:disabled):not([disabled])","embed","iframe","object","a[href]","area[href]","button:not(:disabled):not([disabled])","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","*[contenteditable]"],S6=b6.join(),C6=e=>e.offsetWidth>0&&e.offsetHeight>0;function fy(e){const t=Array.from(e.querySelectorAll(S6));return t.unshift(e),t.filter(n=>dy(n)&&C6(n))}var dg,w6=(dg=ug.default)!=null?dg:ug,hy=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:c,autoFocus:u,persistentFocus:f,lockFocusAcrossFrames:h}=e,m=y.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&fy(r.current).length===0&&requestAnimationFrame(()=>{var C;(C=r.current)==null||C.focus()})},[t,r]),v=y.useCallback(()=>{var S;(S=n==null?void 0:n.current)==null||S.focus()},[n]),x=o&&!n;return l.jsx(w6,{crossFrame:h,persistentFocus:f,autoFocus:u,disabled:c,onActivation:m,onDeactivation:v,returnFocus:x,children:s})};hy.displayName="FocusLock";var j6=zC?y.useLayoutEffect:y.useEffect;function ic(e,t=[]){const n=y.useRef(e);return j6(()=>{n.current=e}),y.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function k6(e,t,n,r){const o=ic(t);return y.useEffect(()=>{var s;const c=(s=Ev(n))!=null?s:document;if(t)return c.addEventListener(e,o,r),()=>{c.removeEventListener(e,o,r)}},[e,n,r,o,t]),()=>{var s;((s=Ev(n))!=null?s:document).removeEventListener(e,o,r)}}function E6(e){const{ref:t,handler:n,enabled:r=!0}=e,o=ic(n),c=y.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;y.useEffect(()=>{if(!r)return;const u=v=>{Cd(v,t)&&(c.isPointerDown=!0)},f=v=>{if(c.ignoreEmulatedMouseEvents){c.ignoreEmulatedMouseEvents=!1;return}c.isPointerDown&&n&&Cd(v,t)&&(c.isPointerDown=!1,o(v))},h=v=>{c.ignoreEmulatedMouseEvents=!0,n&&c.isPointerDown&&Cd(v,t)&&(c.isPointerDown=!1,o(v))},m=d2(t.current);return m.addEventListener("mousedown",u,!0),m.addEventListener("mouseup",f,!0),m.addEventListener("touchstart",u,!0),m.addEventListener("touchend",h,!0),()=>{m.removeEventListener("mousedown",u,!0),m.removeEventListener("mouseup",f,!0),m.removeEventListener("touchstart",u,!0),m.removeEventListener("touchend",h,!0)}},[n,t,o,c,r])}function Cd(e,t){var n;const r=e.target;return e.button>0||r&&!d2(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function P6(e,t){const n=y.useId();return y.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function I6(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function po(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=ic(n),c=ic(t),[u,f]=y.useState(e.defaultIsOpen||!1),[h,m]=I6(r,u),v=P6(o,"disclosure"),x=y.useCallback(()=>{h||f(!1),c==null||c()},[h,c]),S=y.useCallback(()=>{h||f(!0),s==null||s()},[h,s]),C=y.useCallback(()=>{(m?x:S)()},[m,S,x]);return{isOpen:!!m,onOpen:S,onClose:x,onToggle:C,isControlled:h,getButtonProps:(j={})=>({...j,"aria-expanded":m,"aria-controls":v,onClick:BS(j.onClick,C)}),getDisclosureProps:(j={})=>({...j,hidden:!m,id:v})}}var bh=fe(function(t,n){const{htmlSize:r,...o}=t,s=un("Input",o),c=At(o),u=sh(c),f=Ae("chakra-input",t.className);return l.jsx(ne.input,{size:r,...u,__css:s.field,ref:n,className:f})});bh.displayName="Input";bh.id="Input";var[M6,py]=kt({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Sh=fe(function(t,n){const r=un("List",t),{children:o,styleType:s="none",stylePosition:c,spacing:u,...f}=At(t),h=ah(o),v=u?{["& > *:not(style) ~ *:not(style)"]:{mt:u}}:{};return l.jsx(M6,{value:r,children:l.jsx(ne.ul,{ref:n,listStyleType:s,listStylePosition:c,role:"list",__css:{...r.container,...v},...f,children:h})})});Sh.displayName="List";var T6=fe((e,t)=>{const{as:n,...r}=e;return l.jsx(Sh,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});T6.displayName="OrderedList";var my=fe(function(t,n){const{as:r,...o}=t;return l.jsx(Sh,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});my.displayName="UnorderedList";var Ra=fe(function(t,n){const r=py();return l.jsx(ne.li,{ref:n,...t,__css:r.item})});Ra.displayName="ListItem";var _6=fe(function(t,n){const r=py();return l.jsx(tn,{ref:n,role:"presentation",...t,__css:r.icon})});_6.displayName="ListIcon";var ir=fe(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:c,column:u,row:f,autoFlow:h,autoRows:m,templateRows:v,autoColumns:x,templateColumns:S,...C}=t,j={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:c,gridAutoColumns:x,gridColumn:u,gridRow:f,gridAutoFlow:h,gridAutoRows:m,gridTemplateRows:v,gridTemplateColumns:S};return l.jsx(ne.div,{ref:n,__css:j,...C})});ir.displayName="Grid";function vy(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):Qd(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var kc=ne("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});kc.displayName="Spacer";var gy=e=>l.jsx(ne.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});gy.displayName="StackItem";var jf="& > *:not(style) ~ *:not(style)";function D6(e){const{spacing:t,direction:n}=e,r={column:{marginTop:t,marginEnd:0,marginBottom:0,marginStart:0},row:{marginTop:0,marginEnd:0,marginBottom:0,marginStart:t},"column-reverse":{marginTop:0,marginEnd:0,marginBottom:t,marginStart:0},"row-reverse":{marginTop:0,marginEnd:t,marginBottom:0,marginStart:0}};return{flexDirection:n,[jf]:vy(n,o=>r[o])}}function A6(e){const{spacing:t,direction:n}=e,r={column:{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":vy(n,o=>r[o])}}var Ch=fe((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:c="0.5rem",wrap:u,children:f,divider:h,className:m,shouldWrapChildren:v,...x}=e,S=n?"row":r??"column",C=y.useMemo(()=>D6({direction:S,spacing:c}),[S,c]),j=y.useMemo(()=>A6({spacing:c,direction:S}),[c,S]),w=!!h,k=!v&&!w,M=y.useMemo(()=>{const I=ah(f);return k?I:I.map((T,_)=>{const D=typeof T.key<"u"?T.key:_,z=_+1===I.length,F=v?l.jsx(gy,{children:T},D):T;if(!w)return F;const B=y.cloneElement(h,{__css:j}),Q=z?null:B;return l.jsxs(y.Fragment,{children:[F,Q]},D)})},[h,j,w,k,v,f]),P=Ae("chakra-stack",m);return l.jsx(ne.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:C.flexDirection,flexWrap:u,className:P,__css:w?{}:{[jf]:C[jf]},...x,children:M})});Ch.displayName="Stack";var Fe=fe((e,t)=>l.jsx(Ch,{align:"center",...e,direction:"column",ref:t}));Fe.displayName="VStack";var oa=fe((e,t)=>l.jsx(Ch,{align:"center",...e,direction:"row",ref:t}));oa.displayName="HStack";var Wn=fe(function(t,n){const r=yo("Heading",t),{className:o,...s}=At(t);return l.jsx(ne.h2,{ref:n,className:Ae("chakra-heading",t.className),...s,__css:r})});Wn.displayName="Heading";var Ye=ne("div");Ye.displayName="Box";var yy=fe(function(t,n){const{size:r,centerContent:o=!0,...s}=t,c=o?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return l.jsx(Ye,{ref:n,boxSize:r,__css:{...c,flexShrink:0,flexGrow:0},...s})});yy.displayName="Square";var O6=fe(function(t,n){const{size:r,...o}=t;return l.jsx(yy,{size:r,ref:n,borderRadius:"9999px",...o})});O6.displayName="Circle";var qo=fe(function(t,n){const r=yo("Link",t),{className:o,isExternal:s,...c}=At(t);return l.jsx(ne.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:Ae("chakra-link",o),...c,__css:r})});qo.displayName="Link";var xy=fe(function(t,n){const r=yo("Badge",t),{className:o,...s}=At(t);return l.jsx(ne.span,{ref:n,className:Ae("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});xy.displayName="Badge";var by=ne("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center"}});by.displayName="Center";var z6={horizontal:{insetStart:"50%",transform:"translateX(-50%)"},vertical:{top:"50%",transform:"translateY(-50%)"},both:{insetStart:"50%",top:"50%",transform:"translate(-50%, -50%)"}};fe(function(t,n){const{axis:r="both",...o}=t;return l.jsx(ne.div,{ref:n,__css:z6[r],...o,position:"absolute"})});var Sy=fe(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:c,borderWidth:u,borderStyle:f,borderColor:h,...m}=yo("Divider",t),{className:v,orientation:x="horizontal",__css:S,...C}=At(t),j={vertical:{borderLeftWidth:r||c||u||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||u||"1px",width:"100%"}};return l.jsx(ne.hr,{ref:n,"aria-orientation":x,...C,__css:{...m,border:"0",borderColor:h,borderStyle:f,...j[x],...S},className:Ae("chakra-divider",v)})});Sy.displayName="Divider";function R6(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function N6(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=y.useState([]),s=y.useRef(),c=()=>{s.current&&(clearTimeout(s.current),s.current=null)},u=()=>{c(),s.current=setTimeout(()=>{o([]),s.current=null},t)};y.useEffect(()=>c,[]);function f(h){return m=>{if(m.key==="Backspace"){const v=[...r];v.pop(),o(v);return}if(R6(m)){const v=r.concat(m.key);n(m)&&(m.preventDefault(),m.stopPropagation()),o(v),h(v.join("")),u()}}}return f}function F6(e,t,n,r){if(t==null)return r;if(!r)return e.find(c=>n(c).toLowerCase().startsWith(t.toLowerCase()));const o=e.filter(s=>n(s).toLowerCase().startsWith(t.toLowerCase()));if(o.length>0){let s;return o.includes(r)?(s=o.indexOf(r)+1,s===o.length&&(s=0),o[s]):(s=e.indexOf(o[0]),e[s])}return r}function L6(){const e=y.useRef(new Map),t=e.current,n=y.useCallback((o,s,c,u)=>{e.current.set(c,{type:s,el:o,options:u}),o.addEventListener(s,c,u)},[]),r=y.useCallback((o,s,c,u)=>{o.removeEventListener(s,c,u),e.current.delete(c)},[]);return y.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function wd(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function Cy(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:c,onMouseUp:u,onClick:f,onKeyDown:h,onKeyUp:m,tabIndex:v,onMouseOver:x,onMouseLeave:S,...C}=e,[j,w]=y.useState(!0),[k,M]=y.useState(!1),P=L6(),I=$=>{$&&$.tagName!=="BUTTON"&&w(!1)},T=j?v:v||0,_=n&&!r,D=y.useCallback($=>{if(n){$.stopPropagation(),$.preventDefault();return}$.currentTarget.focus(),f==null||f($)},[n,f]),z=y.useCallback($=>{k&&wd($)&&($.preventDefault(),$.stopPropagation(),M(!1),P.remove(document,"keyup",z,!1))},[k,P]),W=y.useCallback($=>{if(h==null||h($),n||$.defaultPrevented||$.metaKey||!wd($.nativeEvent)||j)return;const Z=o&&$.key==="Enter";s&&$.key===" "&&($.preventDefault(),M(!0)),Z&&($.preventDefault(),$.currentTarget.click()),P.add(document,"keyup",z,!1)},[n,j,h,o,s,P,z]),F=y.useCallback($=>{if(m==null||m($),n||$.defaultPrevented||$.metaKey||!wd($.nativeEvent)||j)return;s&&$.key===" "&&($.preventDefault(),M(!1),$.currentTarget.click())},[s,j,n,m]),B=y.useCallback($=>{$.button===0&&(M(!1),P.remove(document,"mouseup",B,!1))},[P]),Q=y.useCallback($=>{if($.button!==0)return;if(n){$.stopPropagation(),$.preventDefault();return}j||M(!0),$.currentTarget.focus({preventScroll:!0}),P.add(document,"mouseup",B,!1),c==null||c($)},[n,j,c,P,B]),U=y.useCallback($=>{$.button===0&&(j||M(!1),u==null||u($))},[u,j]),X=y.useCallback($=>{if(n){$.preventDefault();return}x==null||x($)},[n,x]),te=y.useCallback($=>{k&&($.preventDefault(),M(!1)),S==null||S($)},[k,S]),re=ct(t,I);return j?{...C,ref:re,type:"button","aria-disabled":_?void 0:n,disabled:_,onClick:D,onMouseDown:c,onMouseUp:u,onKeyUp:m,onKeyDown:h,onMouseOver:x,onMouseLeave:S}:{...C,ref:re,role:"button","data-active":qe(k),"aria-disabled":n?"true":void 0,tabIndex:_?void 0:T,onClick:D,onMouseDown:Q,onMouseUp:U,onKeyUp:F,onKeyDown:W,onMouseOver:X,onMouseLeave:te}}function B6(e){const t=e.current;if(!t)return!1;const n=m6(t);return!n||t.contains(n)?!1:!!x6(n)}function wy(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;ti(()=>{if(!s||B6(e))return;const c=(o==null?void 0:o.current)||e.current;c&&requestAnimationFrame(()=>{c.focus()})},[s,e,o])}var H6={preventScroll:!0,shouldFocus:!1};function W6(e,t=H6){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,c=V6(e)?e.current:e,u=o&&s,f=y.useRef(u),h=y.useRef(s);Hi(()=>{!h.current&&s&&(f.current=u),h.current=s},[s,u]);const m=y.useCallback(()=>{if(!(!s||!c||!f.current)&&(f.current=!1,!c.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var v;(v=n.current)==null||v.focus({preventScroll:r})});else{const v=fy(c);v.length>0&&requestAnimationFrame(()=>{v[0].focus({preventScroll:r})})}},[s,r,c,n]);ti(()=>{m()},[m]),Go(c,"transitionend",m)}function V6(e){return"current"in e}var ji=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),Ht={arrowShadowColor:ji("--popper-arrow-shadow-color"),arrowSize:ji("--popper-arrow-size","8px"),arrowSizeHalf:ji("--popper-arrow-size-half"),arrowBg:ji("--popper-arrow-bg"),transformOrigin:ji("--popper-transform-origin"),arrowOffset:ji("--popper-arrow-offset")};function U6(e){if(e.includes("top"))return"1px 1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("bottom"))return"-1px -1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("right"))return"-1px 1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("left"))return"1px -1px 1px 0 var(--popper-arrow-shadow-color)"}var $6={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},G6=e=>$6[e],fg={scroll:!0,resize:!0};function q6(e){let t;return typeof e=="object"?t={enabled:!0,options:{...fg,...e}}:t={enabled:e,options:fg},t}var Y6={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:e})=>{e.styles.popper.width=`${e.rects.reference.width}px`},effect:({state:e})=>()=>{const t=e.elements.reference;e.elements.popper.style.width=`${t.offsetWidth}px`}},K6={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{hg(e)},effect:({state:e})=>()=>{hg(e)}},hg=e=>{e.elements.popper.style.setProperty(Ht.transformOrigin.var,G6(e.placement))},X6={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{Q6(e)}},Q6=e=>{var t;if(!e.placement)return;const n=Z6(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:Ht.arrowSize.varRef,height:Ht.arrowSize.varRef,zIndex:-1});const r={[Ht.arrowSizeHalf.var]:`calc(${Ht.arrowSize.varRef} / 2)`,[Ht.arrowOffset.var]:`calc(${Ht.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},Z6=e=>{if(e.startsWith("top"))return{property:"bottom",value:Ht.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:Ht.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:Ht.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:Ht.arrowOffset.varRef}},J6={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{pg(e)},effect:({state:e})=>()=>{pg(e)}},pg=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=U6(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:Ht.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},ej={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}},tj={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function nj(e,t="ltr"){var n,r;const o=((n=ej[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=tj[e])!=null?r:o}var Pn="top",Un="bottom",$n="right",In="left",wh="auto",ds=[Pn,Un,$n,In],Gi="start",Ka="end",rj="clippingParents",jy="viewport",_a="popper",oj="reference",mg=ds.reduce(function(e,t){return e.concat([t+"-"+Gi,t+"-"+Ka])},[]),ky=[].concat(ds,[wh]).reduce(function(e,t){return e.concat([t,t+"-"+Gi,t+"-"+Ka])},[]),ij="beforeRead",aj="read",sj="afterRead",lj="beforeMain",cj="main",uj="afterMain",dj="beforeWrite",fj="write",hj="afterWrite",pj=[ij,aj,sj,lj,cj,uj,dj,fj,hj];function kr(e){return e?(e.nodeName||"").toLowerCase():null}function Gn(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Qo(e){var t=Gn(e).Element;return e instanceof t||e instanceof Element}function Vn(e){var t=Gn(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function jh(e){if(typeof ShadowRoot>"u")return!1;var t=Gn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function mj(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},s=t.elements[n];!Vn(s)||!kr(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(c){var u=o[c];u===!1?s.removeAttribute(c):s.setAttribute(c,u===!0?"":u)}))})}function vj(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],s=t.attributes[r]||{},c=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),u=c.reduce(function(f,h){return f[h]="",f},{});!Vn(o)||!kr(o)||(Object.assign(o.style,u),Object.keys(s).forEach(function(f){o.removeAttribute(f)}))})}}const gj={name:"applyStyles",enabled:!0,phase:"write",fn:mj,effect:vj,requires:["computeStyles"]};function Cr(e){return e.split("-")[0]}var Yo=Math.max,ac=Math.min,qi=Math.round;function kf(){var e=navigator.userAgentData;return e!=null&&e.brands?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Ey(){return!/^((?!chrome|android).)*safari/i.test(kf())}function Yi(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&Vn(e)&&(o=e.offsetWidth>0&&qi(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&qi(r.height)/e.offsetHeight||1);var c=Qo(e)?Gn(e):window,u=c.visualViewport,f=!Ey()&&n,h=(r.left+(f&&u?u.offsetLeft:0))/o,m=(r.top+(f&&u?u.offsetTop:0))/s,v=r.width/o,x=r.height/s;return{width:v,height:x,top:m,right:h+v,bottom:m+x,left:h,x:h,y:m}}function kh(e){var t=Yi(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function Py(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&jh(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Fr(e){return Gn(e).getComputedStyle(e)}function yj(e){return["table","td","th"].indexOf(kr(e))>=0}function bo(e){return((Qo(e)?e.ownerDocument:e.document)||window.document).documentElement}function Ec(e){return kr(e)==="html"?e:e.assignedSlot||e.parentNode||(jh(e)?e.host:null)||bo(e)}function vg(e){return!Vn(e)||Fr(e).position==="fixed"?null:e.offsetParent}function xj(e){var t=/firefox/i.test(kf()),n=/Trident/i.test(kf());if(n&&Vn(e)){var r=Fr(e);if(r.position==="fixed")return null}var o=Ec(e);for(jh(o)&&(o=o.host);Vn(o)&&["html","body"].indexOf(kr(o))<0;){var s=Fr(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function fs(e){for(var t=Gn(e),n=vg(e);n&&yj(n)&&Fr(n).position==="static";)n=vg(n);return n&&(kr(n)==="html"||kr(n)==="body"&&Fr(n).position==="static")?t:n||xj(e)||t}function Eh(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Fa(e,t,n){return Yo(e,ac(t,n))}function bj(e,t,n){var r=Fa(e,t,n);return r>n?n:r}function Iy(){return{top:0,right:0,bottom:0,left:0}}function My(e){return Object.assign({},Iy(),e)}function Ty(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var Sj=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,My(typeof t!="number"?t:Ty(t,ds))};function Cj(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,c=n.modifiersData.popperOffsets,u=Cr(n.placement),f=Eh(u),h=[In,$n].indexOf(u)>=0,m=h?"height":"width";if(!(!s||!c)){var v=Sj(o.padding,n),x=kh(s),S=f==="y"?Pn:In,C=f==="y"?Un:$n,j=n.rects.reference[m]+n.rects.reference[f]-c[f]-n.rects.popper[m],w=c[f]-n.rects.reference[f],k=fs(s),M=k?f==="y"?k.clientHeight||0:k.clientWidth||0:0,P=j/2-w/2,I=v[S],T=M-x[m]-v[C],_=M/2-x[m]/2+P,D=Fa(I,_,T),z=f;n.modifiersData[r]=(t={},t[z]=D,t.centerOffset=D-_,t)}}function wj(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||Py(t.elements.popper,o)&&(t.elements.arrow=o))}const jj={name:"arrow",enabled:!0,phase:"main",fn:Cj,effect:wj,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ki(e){return e.split("-")[1]}var kj={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Ej(e){var t=e.x,n=e.y,r=window,o=r.devicePixelRatio||1;return{x:qi(t*o)/o||0,y:qi(n*o)/o||0}}function gg(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,c=e.offsets,u=e.position,f=e.gpuAcceleration,h=e.adaptive,m=e.roundOffsets,v=e.isFixed,x=c.x,S=x===void 0?0:x,C=c.y,j=C===void 0?0:C,w=typeof m=="function"?m({x:S,y:j}):{x:S,y:j};S=w.x,j=w.y;var k=c.hasOwnProperty("x"),M=c.hasOwnProperty("y"),P=In,I=Pn,T=window;if(h){var _=fs(n),D="clientHeight",z="clientWidth";if(_===Gn(n)&&(_=bo(n),Fr(_).position!=="static"&&u==="absolute"&&(D="scrollHeight",z="scrollWidth")),_=_,o===Pn||(o===In||o===$n)&&s===Ka){I=Un;var W=v&&_===T&&T.visualViewport?T.visualViewport.height:_[D];j-=W-r.height,j*=f?1:-1}if(o===In||(o===Pn||o===Un)&&s===Ka){P=$n;var F=v&&_===T&&T.visualViewport?T.visualViewport.width:_[z];S-=F-r.width,S*=f?1:-1}}var B=Object.assign({position:u},h&&kj),Q=m===!0?Ej({x:S,y:j}):{x:S,y:j};if(S=Q.x,j=Q.y,f){var U;return Object.assign({},B,(U={},U[I]=M?"0":"",U[P]=k?"0":"",U.transform=(T.devicePixelRatio||1)<=1?"translate("+S+"px, "+j+"px)":"translate3d("+S+"px, "+j+"px, 0)",U))}return Object.assign({},B,(t={},t[I]=M?j+"px":"",t[P]=k?S+"px":"",t.transform="",t))}function Pj(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,c=s===void 0?!0:s,u=n.roundOffsets,f=u===void 0?!0:u,h={placement:Cr(t.placement),variation:Ki(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,gg(Object.assign({},h,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:c,roundOffsets:f})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,gg(Object.assign({},h,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const Ij={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Pj,data:{}};var Sl={passive:!0};function Mj(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,c=r.resize,u=c===void 0?!0:c,f=Gn(t.elements.popper),h=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&h.forEach(function(m){m.addEventListener("scroll",n.update,Sl)}),u&&f.addEventListener("resize",n.update,Sl),function(){s&&h.forEach(function(m){m.removeEventListener("scroll",n.update,Sl)}),u&&f.removeEventListener("resize",n.update,Sl)}}const Tj={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Mj,data:{}};var _j={left:"right",right:"left",bottom:"top",top:"bottom"};function Wl(e){return e.replace(/left|right|bottom|top/g,function(t){return _j[t]})}var Dj={start:"end",end:"start"};function yg(e){return e.replace(/start|end/g,function(t){return Dj[t]})}function Ph(e){var t=Gn(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Ih(e){return Yi(bo(e)).left+Ph(e).scrollLeft}function Aj(e,t){var n=Gn(e),r=bo(e),o=n.visualViewport,s=r.clientWidth,c=r.clientHeight,u=0,f=0;if(o){s=o.width,c=o.height;var h=Ey();(h||!h&&t==="fixed")&&(u=o.offsetLeft,f=o.offsetTop)}return{width:s,height:c,x:u+Ih(e),y:f}}function Oj(e){var t,n=bo(e),r=Ph(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=Yo(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),c=Yo(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),u=-r.scrollLeft+Ih(e),f=-r.scrollTop;return Fr(o||n).direction==="rtl"&&(u+=Yo(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:c,x:u,y:f}}function Mh(e){var t=Fr(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function _y(e){return["html","body","#document"].indexOf(kr(e))>=0?e.ownerDocument.body:Vn(e)&&Mh(e)?e:_y(Ec(e))}function La(e,t){var n;t===void 0&&(t=[]);var r=_y(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Gn(r),c=o?[s].concat(s.visualViewport||[],Mh(r)?r:[]):r,u=t.concat(c);return o?u:u.concat(La(Ec(c)))}function Ef(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function zj(e,t){var n=Yi(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function xg(e,t,n){return t===jy?Ef(Aj(e,n)):Qo(t)?zj(t,n):Ef(Oj(bo(e)))}function Rj(e){var t=La(Ec(e)),n=["absolute","fixed"].indexOf(Fr(e).position)>=0,r=n&&Vn(e)?fs(e):e;return Qo(r)?t.filter(function(o){return Qo(o)&&Py(o,r)&&kr(o)!=="body"}):[]}function Nj(e,t,n,r){var o=t==="clippingParents"?Rj(e):[].concat(t),s=[].concat(o,[n]),c=s[0],u=s.reduce(function(f,h){var m=xg(e,h,r);return f.top=Yo(m.top,f.top),f.right=ac(m.right,f.right),f.bottom=ac(m.bottom,f.bottom),f.left=Yo(m.left,f.left),f},xg(e,c,r));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function Dy(e){var t=e.reference,n=e.element,r=e.placement,o=r?Cr(r):null,s=r?Ki(r):null,c=t.x+t.width/2-n.width/2,u=t.y+t.height/2-n.height/2,f;switch(o){case Pn:f={x:c,y:t.y-n.height};break;case Un:f={x:c,y:t.y+t.height};break;case $n:f={x:t.x+t.width,y:u};break;case In:f={x:t.x-n.width,y:u};break;default:f={x:t.x,y:t.y}}var h=o?Eh(o):null;if(h!=null){var m=h==="y"?"height":"width";switch(s){case Gi:f[h]=f[h]-(t[m]/2-n[m]/2);break;case Ka:f[h]=f[h]+(t[m]/2-n[m]/2);break}}return f}function Xa(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,c=s===void 0?e.strategy:s,u=n.boundary,f=u===void 0?rj:u,h=n.rootBoundary,m=h===void 0?jy:h,v=n.elementContext,x=v===void 0?_a:v,S=n.altBoundary,C=S===void 0?!1:S,j=n.padding,w=j===void 0?0:j,k=My(typeof w!="number"?w:Ty(w,ds)),M=x===_a?oj:_a,P=e.rects.popper,I=e.elements[C?M:x],T=Nj(Qo(I)?I:I.contextElement||bo(e.elements.popper),f,m,c),_=Yi(e.elements.reference),D=Dy({reference:_,element:P,strategy:"absolute",placement:o}),z=Ef(Object.assign({},P,D)),W=x===_a?z:_,F={top:T.top-W.top+k.top,bottom:W.bottom-T.bottom+k.bottom,left:T.left-W.left+k.left,right:W.right-T.right+k.right},B=e.modifiersData.offset;if(x===_a&&B){var Q=B[o];Object.keys(F).forEach(function(U){var X=[$n,Un].indexOf(U)>=0?1:-1,te=[Pn,Un].indexOf(U)>=0?"y":"x";F[U]+=Q[te]*X})}return F}function Fj(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,c=n.padding,u=n.flipVariations,f=n.allowedAutoPlacements,h=f===void 0?ky:f,m=Ki(r),v=m?u?mg:mg.filter(function(C){return Ki(C)===m}):ds,x=v.filter(function(C){return h.indexOf(C)>=0});x.length===0&&(x=v);var S=x.reduce(function(C,j){return C[j]=Xa(e,{placement:j,boundary:o,rootBoundary:s,padding:c})[Cr(j)],C},{});return Object.keys(S).sort(function(C,j){return S[C]-S[j]})}function Lj(e){if(Cr(e)===wh)return[];var t=Wl(e);return[yg(e),t,yg(t)]}function Bj(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,c=n.altAxis,u=c===void 0?!0:c,f=n.fallbackPlacements,h=n.padding,m=n.boundary,v=n.rootBoundary,x=n.altBoundary,S=n.flipVariations,C=S===void 0?!0:S,j=n.allowedAutoPlacements,w=t.options.placement,k=Cr(w),M=k===w,P=f||(M||!C?[Wl(w)]:Lj(w)),I=[w].concat(P).reduce(function(pe,ce){return pe.concat(Cr(ce)===wh?Fj(t,{placement:ce,boundary:m,rootBoundary:v,padding:h,flipVariations:C,allowedAutoPlacements:j}):ce)},[]),T=t.rects.reference,_=t.rects.popper,D=new Map,z=!0,W=I[0],F=0;F=0,te=X?"width":"height",re=Xa(t,{placement:B,boundary:m,rootBoundary:v,altBoundary:x,padding:h}),$=X?U?$n:In:U?Un:Pn;T[te]>_[te]&&($=Wl($));var Z=Wl($),oe=[];if(s&&oe.push(re[Q]<=0),u&&oe.push(re[$]<=0,re[Z]<=0),oe.every(function(pe){return pe})){W=B,z=!1;break}D.set(B,oe)}if(z)for(var le=C?3:1,ze=function(ce){var Ne=I.find(function(Ve){var Ue=D.get(Ve);if(Ue)return Ue.slice(0,ce).every(function($e){return $e})});if(Ne)return W=Ne,"break"},Re=le;Re>0;Re--){var Ie=ze(Re);if(Ie==="break")break}t.placement!==W&&(t.modifiersData[r]._skip=!0,t.placement=W,t.reset=!0)}}const Hj={name:"flip",enabled:!0,phase:"main",fn:Bj,requiresIfExists:["offset"],data:{_skip:!1}};function bg(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Sg(e){return[Pn,$n,Un,In].some(function(t){return e[t]>=0})}function Wj(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,c=Xa(t,{elementContext:"reference"}),u=Xa(t,{altBoundary:!0}),f=bg(c,r),h=bg(u,o,s),m=Sg(f),v=Sg(h);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:h,isReferenceHidden:m,hasPopperEscaped:v},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":m,"data-popper-escaped":v})}const Vj={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Wj};function Uj(e,t,n){var r=Cr(e),o=[In,Pn].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,c=s[0],u=s[1];return c=c||0,u=(u||0)*o,[In,$n].indexOf(r)>=0?{x:u,y:c}:{x:c,y:u}}function $j(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,c=ky.reduce(function(m,v){return m[v]=Uj(v,t.rects,s),m},{}),u=c[t.placement],f=u.x,h=u.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=h),t.modifiersData[r]=c}const Gj={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:$j};function qj(e){var t=e.state,n=e.name;t.modifiersData[n]=Dy({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Yj={name:"popperOffsets",enabled:!0,phase:"read",fn:qj,data:{}};function Kj(e){return e==="x"?"y":"x"}function Xj(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,c=n.altAxis,u=c===void 0?!1:c,f=n.boundary,h=n.rootBoundary,m=n.altBoundary,v=n.padding,x=n.tether,S=x===void 0?!0:x,C=n.tetherOffset,j=C===void 0?0:C,w=Xa(t,{boundary:f,rootBoundary:h,padding:v,altBoundary:m}),k=Cr(t.placement),M=Ki(t.placement),P=!M,I=Eh(k),T=Kj(I),_=t.modifiersData.popperOffsets,D=t.rects.reference,z=t.rects.popper,W=typeof j=="function"?j(Object.assign({},t.rects,{placement:t.placement})):j,F=typeof W=="number"?{mainAxis:W,altAxis:W}:Object.assign({mainAxis:0,altAxis:0},W),B=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,Q={x:0,y:0};if(_){if(s){var U,X=I==="y"?Pn:In,te=I==="y"?Un:$n,re=I==="y"?"height":"width",$=_[I],Z=$+w[X],oe=$-w[te],le=S?-z[re]/2:0,ze=M===Gi?D[re]:z[re],Re=M===Gi?-z[re]:-D[re],Ie=t.elements.arrow,pe=S&&Ie?kh(Ie):{width:0,height:0},ce=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Iy(),Ne=ce[X],Ve=ce[te],Ue=Fa(0,D[re],pe[re]),$e=P?D[re]/2-le-Ue-Ne-F.mainAxis:ze-Ue-Ne-F.mainAxis,Qe=P?-D[re]/2+le+Ue+Ve+F.mainAxis:Re+Ue+Ve+F.mainAxis,ve=t.elements.arrow&&fs(t.elements.arrow),Te=ve?I==="y"?ve.clientTop||0:ve.clientLeft||0:0,Ge=(U=B==null?void 0:B[I])!=null?U:0,ye=$+$e-Ge-Te,Pe=$+Qe-Ge,et=Fa(S?ac(Z,ye):Z,$,S?Yo(oe,Pe):oe);_[I]=et,Q[I]=et-$}if(u){var Be,vt=I==="x"?Pn:In,Rt=I==="x"?Un:$n,N=_[T],ue=T==="y"?"height":"width",xe=N+w[vt],je=N-w[Rt],q=[Pn,In].indexOf(k)!==-1,ae=(Be=B==null?void 0:B[T])!=null?Be:0,Oe=q?xe:N-D[ue]-z[ue]-ae+F.altAxis,Ze=q?N+D[ue]+z[ue]-ae-F.altAxis:je,J=S&&q?bj(Oe,N,Ze):Fa(S?Oe:xe,N,S?Ze:je);_[T]=J,Q[T]=J-N}t.modifiersData[r]=Q}}const Qj={name:"preventOverflow",enabled:!0,phase:"main",fn:Xj,requiresIfExists:["offset"]};function Zj(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Jj(e){return e===Gn(e)||!Vn(e)?Ph(e):Zj(e)}function ek(e){var t=e.getBoundingClientRect(),n=qi(t.width)/e.offsetWidth||1,r=qi(t.height)/e.offsetHeight||1;return n!==1||r!==1}function tk(e,t,n){n===void 0&&(n=!1);var r=Vn(t),o=Vn(t)&&ek(t),s=bo(t),c=Yi(e,o,n),u={scrollLeft:0,scrollTop:0},f={x:0,y:0};return(r||!r&&!n)&&((kr(t)!=="body"||Mh(s))&&(u=Jj(t)),Vn(t)?(f=Yi(t,!0),f.x+=t.clientLeft,f.y+=t.clientTop):s&&(f.x=Ih(s))),{x:c.left+u.scrollLeft-f.x,y:c.top+u.scrollTop-f.y,width:c.width,height:c.height}}function nk(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var c=[].concat(s.requires||[],s.requiresIfExists||[]);c.forEach(function(u){if(!n.has(u)){var f=t.get(u);f&&o(f)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function rk(e){var t=nk(e);return pj.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function ok(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function ik(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var Cg={placement:"bottom",modifiers:[],strategy:"absolute"};function wg(){for(var e=arguments.length,t=new Array(e),n=0;n{}),P=y.useCallback(()=>{var F;!t||!C.current||!j.current||((F=M.current)==null||F.call(M),w.current=lk(C.current,j.current,{placement:k,modifiers:[J6,X6,K6,{...Y6,enabled:!!x},{name:"eventListeners",...q6(c)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:u??[0,f]}},{name:"flip",enabled:!!h,options:{padding:8}},{name:"preventOverflow",enabled:!!v,options:{boundary:m}},...n??[]],strategy:o}),w.current.forceUpdate(),M.current=w.current.destroy)},[k,t,n,x,c,s,u,f,h,v,m,o]);y.useEffect(()=>()=>{var F;!C.current&&!j.current&&((F=w.current)==null||F.destroy(),w.current=null)},[]);const I=y.useCallback(F=>{C.current=F,P()},[P]),T=y.useCallback((F={},B=null)=>({...F,ref:ct(I,B)}),[I]),_=y.useCallback(F=>{j.current=F,P()},[P]),D=y.useCallback((F={},B=null)=>({...F,ref:ct(_,B),style:{...F.style,position:o,minWidth:x?void 0:"max-content",inset:"0 auto auto 0"}}),[o,_,x]),z=y.useCallback((F={},B=null)=>{const{size:Q,shadowColor:U,bg:X,style:te,...re}=F;return{...re,ref:B,"data-popper-arrow":"",style:ck(F)}},[]),W=y.useCallback((F={},B=null)=>({...F,ref:B,"data-popper-arrow-inner":""}),[]);return{update(){var F;(F=w.current)==null||F.update()},forceUpdate(){var F;(F=w.current)==null||F.forceUpdate()},transformOrigin:Ht.transformOrigin.varRef,referenceRef:I,popperRef:_,getPopperProps:D,getArrowProps:z,getArrowInnerProps:W,getReferenceProps:T}}function ck(e){const{size:t,shadowColor:n,bg:r,style:o}=e,s={...o,position:"absolute"};return t&&(s["--popper-arrow-size"]=t),n&&(s["--popper-arrow-shadow-color"]=n),r&&(s["--popper-arrow-bg"]=r),s}function _h(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=Wt(n),c=Wt(t),[u,f]=y.useState(e.defaultIsOpen||!1),h=r!==void 0?r:u,m=r!==void 0,v=y.useId(),x=o??`disclosure-${v}`,S=y.useCallback(()=>{m||f(!1),c==null||c()},[m,c]),C=y.useCallback(()=>{m||f(!0),s==null||s()},[m,s]),j=y.useCallback(()=>{h?S():C()},[h,C,S]);function w(M={}){return{...M,"aria-expanded":h,"aria-controls":x,onClick(P){var I;(I=M.onClick)==null||I.call(M,P),j()}}}function k(M={}){return{...M,hidden:!h,id:x}}return{isOpen:h,onOpen:C,onClose:S,onToggle:j,isControlled:m,getButtonProps:w,getDisclosureProps:k}}function uk(e){const{ref:t,handler:n,enabled:r=!0}=e,o=Wt(n),c=y.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;y.useEffect(()=>{if(!r)return;const u=v=>{jd(v,t)&&(c.isPointerDown=!0)},f=v=>{if(c.ignoreEmulatedMouseEvents){c.ignoreEmulatedMouseEvents=!1;return}c.isPointerDown&&n&&jd(v,t)&&(c.isPointerDown=!1,o(v))},h=v=>{c.ignoreEmulatedMouseEvents=!0,n&&c.isPointerDown&&jd(v,t)&&(c.isPointerDown=!1,o(v))},m=Ay(t.current);return m.addEventListener("mousedown",u,!0),m.addEventListener("mouseup",f,!0),m.addEventListener("touchstart",u,!0),m.addEventListener("touchend",h,!0),()=>{m.removeEventListener("mousedown",u,!0),m.removeEventListener("mouseup",f,!0),m.removeEventListener("touchstart",u,!0),m.removeEventListener("touchend",h,!0)}},[n,t,o,c,r])}function jd(e,t){var n;const r=e.target;return e.button>0||r&&!Ay(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function Ay(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Oy(e){const{isOpen:t,ref:n}=e,[r,o]=y.useState(t),[s,c]=y.useState(!1);return y.useEffect(()=>{s||(o(t),c(!0))},[t,s,r]),Go(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var f;const h=p6(n.current),m=new h.CustomEvent("animationend",{bubbles:!0});(f=n.current)==null||f.dispatchEvent(m)}}}function Dh(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[dk,fk,hk,pk]=th(),[mk,hs]=kt({strict:!1,name:"MenuContext"});function vk(e,...t){const n=y.useId(),r=e||n;return y.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function zy(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function jg(e){return zy(e).activeElement===e}function gk(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:c,isOpen:u,defaultIsOpen:f,onClose:h,onOpen:m,placement:v="bottom-start",lazyBehavior:x="unmount",direction:S,computePositionOnMount:C=!1,...j}=e,w=y.useRef(null),k=y.useRef(null),M=hk(),P=y.useCallback(()=>{requestAnimationFrame(()=>{var Ie;(Ie=w.current)==null||Ie.focus({preventScroll:!1})})},[]),I=y.useCallback(()=>{const Ie=setTimeout(()=>{var pe;if(o)(pe=o.current)==null||pe.focus();else{const ce=M.firstEnabled();ce&&U(ce.index)}});Z.current.add(Ie)},[M,o]),T=y.useCallback(()=>{const Ie=setTimeout(()=>{const pe=M.lastEnabled();pe&&U(pe.index)});Z.current.add(Ie)},[M]),_=y.useCallback(()=>{m==null||m(),s?I():P()},[s,I,P,m]),{isOpen:D,onOpen:z,onClose:W,onToggle:F}=_h({isOpen:u,defaultIsOpen:f,onClose:h,onOpen:_});uk({enabled:D&&r,ref:w,handler:Ie=>{var pe;(pe=k.current)!=null&&pe.contains(Ie.target)||W()}});const B=Th({...j,enabled:D||C,placement:v,direction:S}),[Q,U]=y.useState(-1);ti(()=>{D||U(-1)},[D]),wy(w,{focusRef:k,visible:D,shouldFocus:!0});const X=Oy({isOpen:D,ref:w}),[te,re]=vk(t,"menu-button","menu-list"),$=y.useCallback(()=>{z(),P()},[z,P]),Z=y.useRef(new Set([]));jk(()=>{Z.current.forEach(Ie=>clearTimeout(Ie)),Z.current.clear()});const oe=y.useCallback(()=>{z(),I()},[I,z]),le=y.useCallback(()=>{z(),T()},[z,T]),ze=y.useCallback(()=>{var Ie,pe;const ce=zy(w.current),Ne=(Ie=w.current)==null?void 0:Ie.contains(ce.activeElement);if(!(D&&!Ne))return;const Ue=(pe=M.item(Q))==null?void 0:pe.node;Ue==null||Ue.focus()},[D,Q,M]),Re=y.useRef(null);return{openAndFocusMenu:$,openAndFocusFirstItem:oe,openAndFocusLastItem:le,onTransitionEnd:ze,unstable__animationState:X,descendants:M,popper:B,buttonId:te,menuId:re,forceUpdate:B.forceUpdate,orientation:"vertical",isOpen:D,onToggle:F,onOpen:z,onClose:W,menuRef:w,buttonRef:k,focusedIndex:Q,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:U,isLazy:c,lazyBehavior:x,initialFocusRef:o,rafId:Re}}function yk(e={},t=null){const n=hs(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:c}=n,u=y.useCallback(f=>{const h=f.key,v={Enter:s,ArrowDown:s,ArrowUp:c}[h];v&&(f.preventDefault(),f.stopPropagation(),v(f))},[s,c]);return{...e,ref:ct(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":qe(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:Ee(e.onClick,r),onKeyDown:Ee(e.onKeyDown,u)}}function Pf(e){var t;return Ck(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function xk(e={},t=null){const n=hs();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:c,onClose:u,menuId:f,isLazy:h,lazyBehavior:m,unstable__animationState:v}=n,x=fk(),S=N6({preventDefault:k=>k.key!==" "&&Pf(k.target)}),C=y.useCallback(k=>{const M=k.key,I={Tab:_=>_.preventDefault(),Escape:u,ArrowDown:()=>{const _=x.nextEnabled(r);_&&o(_.index)},ArrowUp:()=>{const _=x.prevEnabled(r);_&&o(_.index)}}[M];if(I){k.preventDefault(),I(k);return}const T=S(_=>{const D=F6(x.values(),_,z=>{var W,F;return(F=(W=z==null?void 0:z.node)==null?void 0:W.textContent)!=null?F:""},x.item(r));if(D){const z=x.indexOf(D.node);o(z)}});Pf(k.target)&&T(k)},[x,r,S,u,o]),j=y.useRef(!1);c&&(j.current=!0);const w=Dh({wasSelected:j.current,enabled:h,mode:m,isSelected:v.present});return{...e,ref:ct(s,t),children:w?e.children:null,tabIndex:-1,role:"menu",id:f,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:Ee(e.onKeyDown,C)}}function bk(e={}){const{popper:t,isOpen:n}=hs();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function Sk(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:c,isDisabled:u,isFocusable:f,closeOnSelect:h,type:m,...v}=e,x=hs(),{setFocusedIndex:S,focusedIndex:C,closeOnSelect:j,onClose:w,menuRef:k,isOpen:M,menuId:P,rafId:I}=x,T=y.useRef(null),_=`${P}-menuitem-${y.useId()}`,{index:D,register:z}=pk({disabled:u&&!f}),W=y.useCallback($=>{n==null||n($),!u&&S(D)},[S,D,u,n]),F=y.useCallback($=>{r==null||r($),T.current&&!jg(T.current)&&W($)},[W,r]),B=y.useCallback($=>{o==null||o($),!u&&S(-1)},[S,u,o]),Q=y.useCallback($=>{s==null||s($),Pf($.currentTarget)&&(h??j)&&w()},[w,s,j,h]),U=y.useCallback($=>{c==null||c($),S(D)},[S,c,D]),X=D===C,te=u&&!f;ti(()=>{M&&(X&&!te&&T.current?(I.current&&cancelAnimationFrame(I.current),I.current=requestAnimationFrame(()=>{var $;($=T.current)==null||$.focus(),I.current=null})):k.current&&!jg(k.current)&&k.current.focus())},[X,te,k,M]);const re=Cy({onClick:Q,onFocus:U,onMouseEnter:W,onMouseMove:F,onMouseLeave:B,ref:ct(z,T,t),isDisabled:u,isFocusable:f});return{...v,...re,type:m??re.type,id:_,role:"menuitem",tabIndex:X?0:-1}}function Ck(e){var t;if(!wk(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function wk(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function jk(e,t=[]){return y.useEffect(()=>()=>e(),t)}var[kk,Pc]=kt({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Ah=e=>{const{children:t}=e,n=un("Menu",e),r=At(e),{direction:o}=ta(),{descendants:s,...c}=gk({...r,direction:o}),u=y.useMemo(()=>c,[c]),{isOpen:f,onClose:h,forceUpdate:m}=u;return l.jsx(dk,{value:s,children:l.jsx(mk,{value:u,children:l.jsx(kk,{value:n,children:x1(t,{isOpen:f,onClose:h,forceUpdate:m})})})})};Ah.displayName="Menu";var Ry=fe((e,t)=>{const n=Pc();return l.jsx(ne.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});Ry.displayName="MenuCommand";var Ek=fe((e,t)=>{const{type:n,...r}=e,o=Pc(),s=r.as||n?n??void 0:"button",c=y.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...o.item}),[o.item]);return l.jsx(ne.button,{ref:t,type:s,...r,__css:c})}),Ny=e=>{const{className:t,children:n,...r}=e,o=y.Children.only(n),s=y.isValidElement(o)?y.cloneElement(o,{focusable:"false","aria-hidden":!0,className:Ae("chakra-menu__icon",o.props.className)}):null,c=Ae("chakra-menu__icon-wrapper",t);return l.jsx(ne.span,{className:c,...r,__css:{flexShrink:0},children:s})};Ny.displayName="MenuIcon";var gr=fe((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:c,...u}=e,f=Sk(u,t),m=n||o?l.jsx("span",{style:{pointerEvents:"none",flex:1},children:c}):c;return l.jsxs(Ek,{...f,className:Ae("chakra-menu__menuitem",f.className),children:[n&&l.jsx(Ny,{fontSize:"0.8em",marginEnd:r,children:n}),m,o&&l.jsx(Ry,{marginStart:s,children:o})]})});gr.displayName="MenuItem";var Pk={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},Ik=ne(ar.div),Oh=fe(function(t,n){var r,o;const{rootProps:s,motionProps:c,...u}=t,{isOpen:f,onTransitionEnd:h,unstable__animationState:m}=hs(),v=xk(u,n),x=bk(s),S=Pc();return l.jsx(ne.div,{...x,__css:{zIndex:(o=t.zIndex)!=null?o:(r=S.list)==null?void 0:r.zIndex},children:l.jsx(Ik,{variants:Pk,initial:!1,animate:f?"enter":"exit",__css:{outline:0,...S.list},...c,className:Ae("chakra-menu__menu-list",v.className),...v,onUpdate:h,onAnimationComplete:xc(m.onComplete,v.onAnimationComplete)})})});Oh.displayName="MenuList";var Mk=fe((e,t)=>{const n=Pc();return l.jsx(ne.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),zh=fe((e,t)=>{const{children:n,as:r,...o}=e,s=yk(o,t),c=r||Mk;return l.jsx(c,{...s,className:Ae("chakra-menu__menu-button",e.className),children:l.jsx(ne.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});zh.displayName="MenuButton";var Tk={slideInBottom:{...pf,custom:{offsetY:16,reverse:!0}},slideInRight:{...pf,custom:{offsetX:16,reverse:!0}},scale:{...y2,custom:{initialScale:.95,reverse:!0}},none:{}},_k=ne(ar.section),Dk=e=>Tk[e||"none"],Fy=y.forwardRef((e,t)=>{const{preset:n,motionProps:r=Dk(n),...o}=e;return l.jsx(_k,{ref:t,...r,...o})});Fy.displayName="ModalTransition";var Ak=Object.defineProperty,Ok=(e,t,n)=>t in e?Ak(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zk=(e,t,n)=>(Ok(e,typeof t!="symbol"?t+"":t,n),n),Rk=class{constructor(){zk(this,"modals"),this.modals=new Map}add(e){return this.modals.set(e,this.modals.size+1),this.modals.size}remove(e){this.modals.delete(e)}isTopModal(e){return e?this.modals.get(e)===this.modals.size:!1}},If=new Rk;function Ly(e,t){const[n,r]=y.useState(0);return y.useEffect(()=>{const o=e.current;if(o){if(t){const s=If.add(o);r(s)}return()=>{If.remove(o),r(0)}}},[t,e]),n}var Nk=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ki=new WeakMap,Cl=new WeakMap,wl={},kd=0,By=function(e){return e&&(e.host||By(e.parentNode))},Fk=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=By(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return Boolean(n)})},Lk=function(e,t,n,r){var o=Fk(t,Array.isArray(e)?e:[e]);wl[n]||(wl[n]=new WeakMap);var s=wl[n],c=[],u=new Set,f=new Set(o),h=function(v){!v||u.has(v)||(u.add(v),h(v.parentNode))};o.forEach(h);var m=function(v){!v||f.has(v)||Array.prototype.forEach.call(v.children,function(x){if(u.has(x))m(x);else{var S=x.getAttribute(r),C=S!==null&&S!=="false",j=(ki.get(x)||0)+1,w=(s.get(x)||0)+1;ki.set(x,j),s.set(x,w),c.push(x),j===1&&C&&Cl.set(x,!0),w===1&&x.setAttribute(n,"true"),C||x.setAttribute(r,"true")}})};return m(t),u.clear(),kd++,function(){c.forEach(function(v){var x=ki.get(v)-1,S=s.get(v)-1;ki.set(v,x),s.set(v,S),x||(Cl.has(v)||v.removeAttribute(r),Cl.delete(v)),S||v.removeAttribute(n)}),kd--,kd||(ki=new WeakMap,ki=new WeakMap,Cl=new WeakMap,wl={})}},Bk=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||Nk(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),Lk(r,o,n,"aria-hidden")):function(){return null}};function Hk(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:c=!0,onOverlayClick:u,onEsc:f}=e,h=y.useRef(null),m=y.useRef(null),[v,x,S]=Vk(r,"chakra-modal","chakra-modal--header","chakra-modal--body");Wk(h,t&&c),Ly(h,t);const C=y.useRef(null),j=y.useCallback(z=>{C.current=z.target},[]),w=y.useCallback(z=>{z.key==="Escape"&&(z.stopPropagation(),s&&(n==null||n()),f==null||f())},[s,n,f]),[k,M]=y.useState(!1),[P,I]=y.useState(!1),T=y.useCallback((z={},W=null)=>({role:"dialog",...z,ref:ct(W,h),id:v,tabIndex:-1,"aria-modal":!0,"aria-labelledby":k?x:void 0,"aria-describedby":P?S:void 0,onClick:Ee(z.onClick,F=>F.stopPropagation())}),[S,P,v,x,k]),_=y.useCallback(z=>{z.stopPropagation(),C.current===z.target&&If.isTopModal(h.current)&&(o&&(n==null||n()),u==null||u())},[n,o,u]),D=y.useCallback((z={},W=null)=>({...z,ref:ct(W,m),onClick:Ee(z.onClick,_),onKeyDown:Ee(z.onKeyDown,w),onMouseDown:Ee(z.onMouseDown,j)}),[w,j,_]);return{isOpen:t,onClose:n,headerId:x,bodyId:S,setBodyMounted:I,setHeaderMounted:M,dialogRef:h,overlayRef:m,getDialogProps:T,getDialogContainerProps:D}}function Wk(e,t){const n=e.current;y.useEffect(()=>{if(!(!e.current||!t))return Bk(e.current)},[t,e,n])}function Vk(e,...t){const n=y.useId(),r=e||n;return y.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[Uk,ia]=kt({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[$k,Zo]=kt({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),mo=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:n,children:r,autoFocus:o,trapFocus:s,initialFocusRef:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:h,allowPinchZoom:m,preserveScrollBarGap:v,motionPreset:x,lockFocusAcrossFrames:S,onCloseComplete:C}=t,j=un("Modal",t),k={...Hk(t),autoFocus:o,trapFocus:s,initialFocusRef:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:h,allowPinchZoom:m,preserveScrollBarGap:v,motionPreset:x,lockFocusAcrossFrames:S};return l.jsx($k,{value:k,children:l.jsx(Uk,{value:j,children:l.jsx(xo,{onExitComplete:C,children:k.isOpen&&l.jsx($a,{...n,children:r})})})})};mo.displayName="Modal";var Vl="right-scroll-bar-position",Ul="width-before-scroll-bar",Gk="with-scroll-bars-hidden",qk="--removed-body-scroll-bar-size",Hy=z2(),Ed=function(){},Ic=y.forwardRef(function(e,t){var n=y.useRef(null),r=y.useState({onScrollCapture:Ed,onWheelCapture:Ed,onTouchMoveCapture:Ed}),o=r[0],s=r[1],c=e.forwardProps,u=e.children,f=e.className,h=e.removeScrollBar,m=e.enabled,v=e.shards,x=e.sideCar,S=e.noIsolation,C=e.inert,j=e.allowPinchZoom,w=e.as,k=w===void 0?"div":w,M=D2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),P=x,I=_2([n,t]),T=xr(xr({},M),o);return y.createElement(y.Fragment,null,m&&y.createElement(P,{sideCar:Hy,removeScrollBar:h,shards:v,noIsolation:S,inert:C,setCallbacks:s,allowPinchZoom:!!j,lockRef:n}),c?y.cloneElement(y.Children.only(u),xr(xr({},T),{ref:I})):y.createElement(k,xr({},T,{className:f,ref:I}),u))});Ic.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ic.classNames={fullWidth:Ul,zeroRight:Vl};var kg,Yk=function(){if(kg)return kg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Kk(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Yk();return t&&e.setAttribute("nonce",t),e}function Xk(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Qk(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Zk=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Kk())&&(Xk(t,n),Qk(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Jk=function(){var e=Zk();return function(t,n){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Wy=function(){var e=Jk(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},e7={left:0,top:0,right:0,gap:0},Pd=function(e){return parseInt(e||"",10)||0},t7=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Pd(n),Pd(r),Pd(o)]},n7=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return e7;var t=t7(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},r7=Wy(),o7=function(e,t,n,r){var o=e.left,s=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),` .`.concat(Gk,` { overflow: hidden `).concat(r,`; padding-right: `).concat(u,"px ").concat(r,`; } body { overflow: hidden `).concat(r,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` padding-left: `.concat(o,`px; padding-top: `).concat(s,`px; padding-right: `).concat(c,`px; margin-left:0; margin-top:0; margin-right: `).concat(u,"px ").concat(r,`; `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),` } .`).concat(Vl,` { right: `).concat(u,"px ").concat(r,`; } .`).concat(Ul,` { margin-right: `).concat(u,"px ").concat(r,`; } .`).concat(Vl," .").concat(Vl,` { right: 0 `).concat(r,`; } .`).concat(Ul," .").concat(Ul,` { margin-right: 0 `).concat(r,`; } body { `).concat(qk,": ").concat(u,`px; } `)},i7=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=y.useMemo(function(){return n7(o)},[o]);return y.createElement(r7,{styles:o7(s,!t,o,n?"":"!important")})},Mf=!1;if(typeof window<"u")try{var jl=Object.defineProperty({},"passive",{get:function(){return Mf=!0,!0}});window.addEventListener("test",jl,jl),window.removeEventListener("test",jl,jl)}catch{Mf=!1}var Ei=Mf?{passive:!1}:!1,a7=function(e){return e.tagName==="TEXTAREA"},Vy=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!a7(e)&&n[t]==="visible")},s7=function(e){return Vy(e,"overflowY")},l7=function(e){return Vy(e,"overflowX")},Eg=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=Uy(e,n);if(r){var o=$y(e,n),s=o[1],c=o[2];if(s>c)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},c7=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},u7=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Uy=function(e,t){return e==="v"?s7(t):l7(t)},$y=function(e,t){return e==="v"?c7(t):u7(t)},d7=function(e,t){return e==="h"&&t==="rtl"?-1:1},f7=function(e,t,n,r,o){var s=d7(e,window.getComputedStyle(t).direction),c=s*r,u=n.target,f=t.contains(u),h=!1,m=c>0,v=0,x=0;do{var S=$y(e,u),C=S[0],j=S[1],w=S[2],k=j-w-s*C;(C||k)&&Uy(e,u)&&(v+=k,x+=C),u=u.parentNode}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(m&&(o&&v===0||!o&&c>v)||!m&&(o&&x===0||!o&&-c>x))&&(h=!0),h},kl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Pg=function(e){return[e.deltaX,e.deltaY]},Ig=function(e){return e&&"current"in e?e.current:e},h7=function(e,t){return e[0]===t[0]&&e[1]===t[1]},p7=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},m7=0,Pi=[];function v7(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),o=y.useState(m7++)[0],s=y.useState(function(){return Wy()})[0],c=y.useRef(e);y.useEffect(function(){c.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var j=Sf([e.lockRef.current],(e.shards||[]).map(Ig),!0).filter(Boolean);return j.forEach(function(w){return w.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),j.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var u=y.useCallback(function(j,w){if("touches"in j&&j.touches.length===2)return!c.current.allowPinchZoom;var k=kl(j),M=n.current,P="deltaX"in j?j.deltaX:M[0]-k[0],I="deltaY"in j?j.deltaY:M[1]-k[1],T,_=j.target,D=Math.abs(P)>Math.abs(I)?"h":"v";if("touches"in j&&D==="h"&&_.type==="range")return!1;var z=Eg(D,_);if(!z)return!0;if(z?T=D:(T=D==="v"?"h":"v",z=Eg(D,_)),!z)return!1;if(!r.current&&"changedTouches"in j&&(P||I)&&(r.current=T),!T)return!0;var W=r.current||T;return f7(W,w,j,W==="h"?P:I,!0)},[]),f=y.useCallback(function(j){var w=j;if(!(!Pi.length||Pi[Pi.length-1]!==s)){var k="deltaY"in w?Pg(w):kl(w),M=t.current.filter(function(T){return T.name===w.type&&T.target===w.target&&h7(T.delta,k)})[0];if(M&&M.should){w.cancelable&&w.preventDefault();return}if(!M){var P=(c.current.shards||[]).map(Ig).filter(Boolean).filter(function(T){return T.contains(w.target)}),I=P.length>0?u(w,P[0]):!c.current.noIsolation;I&&w.cancelable&&w.preventDefault()}}},[]),h=y.useCallback(function(j,w,k,M){var P={name:j,delta:w,target:k,should:M};t.current.push(P),setTimeout(function(){t.current=t.current.filter(function(I){return I!==P})},1)},[]),m=y.useCallback(function(j){n.current=kl(j),r.current=void 0},[]),v=y.useCallback(function(j){h(j.type,Pg(j),j.target,u(j,e.lockRef.current))},[]),x=y.useCallback(function(j){h(j.type,kl(j),j.target,u(j,e.lockRef.current))},[]);y.useEffect(function(){return Pi.push(s),e.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:x}),document.addEventListener("wheel",f,Ei),document.addEventListener("touchmove",f,Ei),document.addEventListener("touchstart",m,Ei),function(){Pi=Pi.filter(function(j){return j!==s}),document.removeEventListener("wheel",f,Ei),document.removeEventListener("touchmove",f,Ei),document.removeEventListener("touchstart",m,Ei)}},[]);var S=e.removeScrollBar,C=e.inert;return y.createElement(y.Fragment,null,C?y.createElement(s,{styles:p7(o)}):null,S?y.createElement(i7,{gapMode:"margin"}):null)}const g7=g5(Hy,v7);var Gy=y.forwardRef(function(e,t){return y.createElement(Ic,xr({},e,{ref:t,sideCar:g7}))});Gy.classNames=Ic.classNames;const y7=Gy;function x7(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:c,finalFocusRef:u,returnFocusOnClose:f,preserveScrollBarGap:h,lockFocusAcrossFrames:m,isOpen:v}=Zo(),[x,S]=wC();y.useEffect(()=>{!x&&S&&setTimeout(S)},[x,S]);const C=Ly(r,v);return l.jsx(hy,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:u,restoreFocus:f,contentRef:r,lockFocusAcrossFrames:m,children:l.jsx(y7,{removeScrollBar:!h,allowPinchZoom:c,enabled:C===1&&s,forwardProps:!0,children:e.children})})}var vo=fe((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...c}=e,{getDialogProps:u,getDialogContainerProps:f}=Zo(),h=u(c,t),m=f(o),v=Ae("chakra-modal__content",n),x=ia(),S={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...x.dialog},C={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...x.dialogContainer},{motionPreset:j}=Zo();return l.jsx(x7,{children:l.jsx(ne.div,{...m,className:"chakra-modal__content-container",tabIndex:-1,__css:C,children:l.jsx(Fy,{preset:j,motionProps:s,className:v,...h,__css:S,children:r})})})});vo.displayName="ModalContent";function qy(e){const{leastDestructiveRef:t,...n}=e;return l.jsx(mo,{...n,initialFocusRef:t})}var Yy=fe((e,t)=>l.jsx(vo,{ref:t,role:"alertdialog",...e})),Lr=fe((e,t)=>{const{className:n,...r}=e,o=Ae("chakra-modal__footer",n),c={display:"flex",alignItems:"center",justifyContent:"flex-end",...ia().footer};return l.jsx(ne.footer,{ref:t,...r,__css:c,className:o})});Lr.displayName="ModalFooter";var Br=fe((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=Zo();y.useEffect(()=>(s(!0),()=>s(!1)),[s]);const c=Ae("chakra-modal__header",n),f={flex:0,...ia().header};return l.jsx(ne.header,{ref:t,className:c,id:o,...r,__css:f})});Br.displayName="ModalHeader";var b7=ne(ar.div),Hr=fe((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,c=Ae("chakra-modal__overlay",n),f={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...ia().overlay},{motionPreset:h}=Zo(),v=o||(h==="none"?{}:g2);return l.jsx(b7,{...v,__css:f,ref:t,className:c,...s})});Hr.displayName="ModalOverlay";var Wr=fe((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=Zo();y.useEffect(()=>(s(!0),()=>s(!1)),[s]);const c=Ae("chakra-modal__body",n),u=ia();return l.jsx(ne.div,{ref:t,className:c,id:o,...r,__css:u.body})});Wr.displayName="ModalBody";var aa=fe((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=Zo(),c=Ae("chakra-modal__close-btn",r),u=ia();return l.jsx(jC,{ref:t,__css:u.closeButton,className:c,onClick:Ee(n,f=>{f.stopPropagation(),s()}),...o})});aa.displayName="ModalCloseButton";var S7=e=>l.jsx(tn,{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),C7=e=>l.jsx(tn,{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function Mg(e,t,n,r){y.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,c=Array.isArray(t)?t:[t],u=new s.MutationObserver(f=>{for(const h of f)h.type==="attributes"&&h.attributeName&&c.includes(h.attributeName)&&n(h)});return u.observe(e.current,{attributes:!0,attributeFilter:c}),()=>u.disconnect()})}function w7(e,t){const n=Wt(e);y.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var j7=50,Tg=300;function k7(e,t){const[n,r]=y.useState(!1),[o,s]=y.useState(null),[c,u]=y.useState(!0),f=y.useRef(null),h=()=>clearTimeout(f.current);w7(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?j7:null);const m=y.useCallback(()=>{c&&e(),f.current=setTimeout(()=>{u(!1),r(!0),s("increment")},Tg)},[e,c]),v=y.useCallback(()=>{c&&t(),f.current=setTimeout(()=>{u(!1),r(!0),s("decrement")},Tg)},[t,c]),x=y.useCallback(()=>{u(!0),r(!1),h()},[]);return y.useEffect(()=>()=>h(),[]),{up:m,down:v,stop:x,isSpinning:n}}var E7=/^[Ee0-9+\-.]$/;function P7(e){return E7.test(e)}function I7(e,t){if(e.key==null)return!0;const n=e.ctrlKey||e.altKey||e.metaKey;return!(e.key.length===1)||n?!0:t(e.key)}function M7(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:o=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:c=1,isReadOnly:u,isDisabled:f,isRequired:h,isInvalid:m,pattern:v="[0-9]*(.[0-9]+)?",inputMode:x="decimal",allowMouseWheel:S,id:C,onChange:j,precision:w,name:k,"aria-describedby":M,"aria-label":P,"aria-labelledby":I,onFocus:T,onBlur:_,onInvalid:D,getAriaValueText:z,isValidCharacter:W,format:F,parse:B,...Q}=e,U=Wt(T),X=Wt(_),te=Wt(D),re=Wt(W??P7),$=Wt(z),Z=Jw(e),{update:oe,increment:le,decrement:ze}=Z,[Re,Ie]=y.useState(!1),pe=!(u||f),ce=y.useRef(null),Ne=y.useRef(null),Ve=y.useRef(null),Ue=y.useRef(null),$e=y.useCallback(J=>J.split("").filter(re).join(""),[re]),Qe=y.useCallback(J=>{var Le;return(Le=B==null?void 0:B(J))!=null?Le:J},[B]),ve=y.useCallback(J=>{var Le;return((Le=F==null?void 0:F(J))!=null?Le:J).toString()},[F]);ti(()=>{(Z.valueAsNumber>s||Z.valueAsNumber{if(!ce.current)return;if(ce.current.value!=Z.value){const Le=Qe(ce.current.value);Z.setValue($e(Le))}},[Qe,$e]);const Te=y.useCallback((J=c)=>{pe&&le(J)},[le,pe,c]),Ge=y.useCallback((J=c)=>{pe&&ze(J)},[ze,pe,c]),ye=k7(Te,Ge);Mg(Ve,"disabled",ye.stop,ye.isSpinning),Mg(Ue,"disabled",ye.stop,ye.isSpinning);const Pe=y.useCallback(J=>{if(J.nativeEvent.isComposing)return;const nt=Qe(J.currentTarget.value);oe($e(nt)),Ne.current={start:J.currentTarget.selectionStart,end:J.currentTarget.selectionEnd}},[oe,$e,Qe]),et=y.useCallback(J=>{var Le,nt,Nt;U==null||U(J),Ne.current&&(J.target.selectionStart=(nt=Ne.current.start)!=null?nt:(Le=J.currentTarget.value)==null?void 0:Le.length,J.currentTarget.selectionEnd=(Nt=Ne.current.end)!=null?Nt:J.currentTarget.selectionStart)},[U]),Be=y.useCallback(J=>{if(J.nativeEvent.isComposing)return;I7(J,re)||J.preventDefault();const Le=vt(J)*c,nt=J.key,he={ArrowUp:()=>Te(Le),ArrowDown:()=>Ge(Le),Home:()=>oe(o),End:()=>oe(s)}[nt];he&&(J.preventDefault(),he(J))},[re,c,Te,Ge,oe,o,s]),vt=J=>{let Le=1;return(J.metaKey||J.ctrlKey)&&(Le=.1),J.shiftKey&&(Le=10),Le},Rt=y.useMemo(()=>{const J=$==null?void 0:$(Z.value);if(J!=null)return J;const Le=Z.value.toString();return Le||void 0},[Z.value,$]),N=y.useCallback(()=>{let J=Z.value;if(Z.value==="")return;/^[eE]/.test(Z.value.toString())?Z.setValue(""):(Z.valueAsNumbers&&(J=s),Z.cast(J))},[Z,s,o]),ue=y.useCallback(()=>{Ie(!1),n&&N()},[n,Ie,N]),xe=y.useCallback(()=>{t&&requestAnimationFrame(()=>{var J;(J=ce.current)==null||J.focus()})},[t]),je=y.useCallback(J=>{J.preventDefault(),ye.up(),xe()},[xe,ye]),q=y.useCallback(J=>{J.preventDefault(),ye.down(),xe()},[xe,ye]);Go(()=>ce.current,"wheel",J=>{var Le,nt;const he=((nt=(Le=ce.current)==null?void 0:Le.ownerDocument)!=null?nt:document).activeElement===ce.current;if(!S||!he)return;J.preventDefault();const _e=vt(J)*c,dn=Math.sign(J.deltaY);dn===-1?Te(_e):dn===1&&Ge(_e)},{passive:!1});const ae=y.useCallback((J={},Le=null)=>{const nt=f||r&&Z.isAtMax;return{...J,ref:ct(Le,Ve),role:"button",tabIndex:-1,onPointerDown:Ee(J.onPointerDown,Nt=>{Nt.button!==0||nt||je(Nt)}),onPointerLeave:Ee(J.onPointerLeave,ye.stop),onPointerUp:Ee(J.onPointerUp,ye.stop),disabled:nt,"aria-disabled":Nr(nt)}},[Z.isAtMax,r,je,ye.stop,f]),Oe=y.useCallback((J={},Le=null)=>{const nt=f||r&&Z.isAtMin;return{...J,ref:ct(Le,Ue),role:"button",tabIndex:-1,onPointerDown:Ee(J.onPointerDown,Nt=>{Nt.button!==0||nt||q(Nt)}),onPointerLeave:Ee(J.onPointerLeave,ye.stop),onPointerUp:Ee(J.onPointerUp,ye.stop),disabled:nt,"aria-disabled":Nr(nt)}},[Z.isAtMin,r,q,ye.stop,f]),Ze=y.useCallback((J={},Le=null)=>{var nt,Nt,he,_e;return{name:k,inputMode:x,type:"text",pattern:v,"aria-labelledby":I,"aria-label":P,"aria-describedby":M,id:C,disabled:f,...J,readOnly:(nt=J.readOnly)!=null?nt:u,"aria-readonly":(Nt=J.readOnly)!=null?Nt:u,"aria-required":(he=J.required)!=null?he:h,required:(_e=J.required)!=null?_e:h,ref:ct(ce,Le),value:ve(Z.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(Z.valueAsNumber)?void 0:Z.valueAsNumber,"aria-invalid":Nr(m??Z.isOutOfRange),"aria-valuetext":Rt,autoComplete:"off",autoCorrect:"off",onChange:Ee(J.onChange,Pe),onKeyDown:Ee(J.onKeyDown,Be),onFocus:Ee(J.onFocus,et,()=>Ie(!0)),onBlur:Ee(J.onBlur,X,ue)}},[k,x,v,I,P,ve,M,C,f,h,u,m,Z.value,Z.valueAsNumber,Z.isOutOfRange,o,s,Rt,Pe,Be,et,X,ue]);return{value:ve(Z.value),valueAsNumber:Z.valueAsNumber,isFocused:Re,isDisabled:f,isReadOnly:u,getIncrementButtonProps:ae,getDecrementButtonProps:Oe,getInputProps:Ze,htmlProps:Q}}var[T7,Mc]=kt({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[_7,Rh]=kt({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Nh=fe(function(t,n){const r=un("NumberInput",t),o=At(t),s=lh(o),{htmlProps:c,...u}=M7(s),f=y.useMemo(()=>u,[u]);return l.jsx(_7,{value:f,children:l.jsx(T7,{value:r,children:l.jsx(ne.div,{...c,ref:n,className:Ae("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Nh.displayName="NumberInput";var Fh=fe(function(t,n){const r=Mc();return l.jsx(ne.div,{"aria-hidden":!0,ref:n,...t,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...r.stepperGroup}})});Fh.displayName="NumberInputStepper";var Lh=fe(function(t,n){const{getInputProps:r}=Rh(),o=r(t,n),s=Mc();return l.jsx(ne.input,{...o,className:Ae("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});Lh.displayName="NumberInputField";var Ky=ne("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Bh=fe(function(t,n){var r;const o=Mc(),{getDecrementButtonProps:s}=Rh(),c=s(t,n);return l.jsx(Ky,{...c,__css:o.stepper,children:(r=t.children)!=null?r:l.jsx(S7,{})})});Bh.displayName="NumberDecrementStepper";var Hh=fe(function(t,n){var r;const{getIncrementButtonProps:o}=Rh(),s=o(t,n),c=Mc();return l.jsx(Ky,{...s,__css:c.stepper,children:(r=t.children)!=null?r:l.jsx(C7,{})})});Hh.displayName="NumberIncrementStepper";var[D7,ps]=kt({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[A7,Wh]=kt({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Vh(e){const t=y.Children.only(e.children),{getTriggerProps:n}=ps();return y.cloneElement(t,n(t.props,t.ref))}Vh.displayName="PopoverTrigger";var Ii={click:"click",hover:"hover"};function O7(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:c=!0,arrowSize:u,arrowShadowColor:f,trigger:h=Ii.click,openDelay:m=200,closeDelay:v=200,isLazy:x,lazyBehavior:S="unmount",computePositionOnMount:C,...j}=e,{isOpen:w,onClose:k,onOpen:M,onToggle:P}=_h(e),I=y.useRef(null),T=y.useRef(null),_=y.useRef(null),D=y.useRef(!1),z=y.useRef(!1);w&&(z.current=!0);const[W,F]=y.useState(!1),[B,Q]=y.useState(!1),U=y.useId(),X=o??U,[te,re,$,Z]=["popover-trigger","popover-content","popover-header","popover-body"].map(Pe=>`${Pe}-${X}`),{referenceRef:oe,getArrowProps:le,getPopperProps:ze,getArrowInnerProps:Re,forceUpdate:Ie}=Th({...j,enabled:w||!!C}),pe=Oy({isOpen:w,ref:_});a5({enabled:w,ref:T}),wy(_,{focusRef:T,visible:w,shouldFocus:s&&h===Ii.click}),W6(_,{focusRef:r,visible:w,shouldFocus:c&&h===Ii.click});const ce=Dh({wasSelected:z.current,enabled:x,mode:S,isSelected:pe.present}),Ne=y.useCallback((Pe={},et=null)=>{const Be={...Pe,style:{...Pe.style,transformOrigin:Ht.transformOrigin.varRef,[Ht.arrowSize.var]:u?`${u}px`:void 0,[Ht.arrowShadowColor.var]:f},ref:ct(_,et),children:ce?Pe.children:null,id:re,tabIndex:-1,role:"dialog",onKeyDown:Ee(Pe.onKeyDown,vt=>{n&&vt.key==="Escape"&&k()}),onBlur:Ee(Pe.onBlur,vt=>{const Rt=_g(vt),N=Id(_.current,Rt),ue=Id(T.current,Rt);w&&t&&(!N&&!ue)&&k()}),"aria-labelledby":W?$:void 0,"aria-describedby":B?Z:void 0};return h===Ii.hover&&(Be.role="tooltip",Be.onMouseEnter=Ee(Pe.onMouseEnter,()=>{D.current=!0}),Be.onMouseLeave=Ee(Pe.onMouseLeave,vt=>{vt.nativeEvent.relatedTarget!==null&&(D.current=!1,setTimeout(()=>k(),v))})),Be},[ce,re,W,$,B,Z,h,n,k,w,t,v,f,u]),Ve=y.useCallback((Pe={},et=null)=>ze({...Pe,style:{visibility:w?"visible":"hidden",...Pe.style}},et),[w,ze]),Ue=y.useCallback((Pe,et=null)=>({...Pe,ref:ct(et,I,oe)}),[I,oe]),$e=y.useRef(),Qe=y.useRef(),ve=y.useCallback(Pe=>{I.current==null&&oe(Pe)},[oe]),Te=y.useCallback((Pe={},et=null)=>{const Be={...Pe,ref:ct(T,et,ve),id:te,"aria-haspopup":"dialog","aria-expanded":w,"aria-controls":re};return h===Ii.click&&(Be.onClick=Ee(Pe.onClick,P)),h===Ii.hover&&(Be.onFocus=Ee(Pe.onFocus,()=>{$e.current===void 0&&M()}),Be.onBlur=Ee(Pe.onBlur,vt=>{const Rt=_g(vt),N=!Id(_.current,Rt);w&&t&&N&&k()}),Be.onKeyDown=Ee(Pe.onKeyDown,vt=>{vt.key==="Escape"&&k()}),Be.onMouseEnter=Ee(Pe.onMouseEnter,()=>{D.current=!0,$e.current=window.setTimeout(()=>M(),m)}),Be.onMouseLeave=Ee(Pe.onMouseLeave,()=>{D.current=!1,$e.current&&(clearTimeout($e.current),$e.current=void 0),Qe.current=window.setTimeout(()=>{D.current===!1&&k()},v)})),Be},[te,w,re,h,ve,P,M,t,k,m,v]);y.useEffect(()=>()=>{$e.current&&clearTimeout($e.current),Qe.current&&clearTimeout(Qe.current)},[]);const Ge=y.useCallback((Pe={},et=null)=>({...Pe,id:$,ref:ct(et,Be=>{F(!!Be)})}),[$]),ye=y.useCallback((Pe={},et=null)=>({...Pe,id:Z,ref:ct(et,Be=>{Q(!!Be)})}),[Z]);return{forceUpdate:Ie,isOpen:w,onAnimationComplete:pe.onComplete,onClose:k,getAnchorProps:Ue,getArrowProps:le,getArrowInnerProps:Re,getPopoverPositionerProps:Ve,getPopoverProps:Ne,getTriggerProps:Te,getHeaderProps:Ge,getBodyProps:ye}}function Id(e,t){return e===t||(e==null?void 0:e.contains(t))}function _g(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Uh(e){const t=un("Popover",e),{children:n,...r}=At(e),o=ta(),s=O7({...r,direction:o.direction});return l.jsx(D7,{value:s,children:l.jsx(A7,{value:t,children:x1(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Uh.displayName="Popover";function $h(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:c}=e,{getArrowProps:u,getArrowInnerProps:f}=ps(),h=Wh(),m=(t=n??r)!=null?t:o,v=s??c;return l.jsx(ne.div,{...u(),className:"chakra-popover__arrow-positioner",children:l.jsx(ne.div,{className:Ae("chakra-popover__arrow",e.className),...f(e),__css:{"--popper-arrow-bg":m?`colors.${m}, ${m}`:void 0,"--popper-arrow-shadow":v?`shadows.${v}, ${v}`:void 0,...h.arrow}})})}$h.displayName="PopoverArrow";var Xy=fe(function(t,n){const{getBodyProps:r}=ps(),o=Wh();return l.jsx(ne.div,{...r(t,n),className:Ae("chakra-popover__body",t.className),__css:o.body})});Xy.displayName="PopoverBody";function z7(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var R7={exit:{opacity:0,scale:.95,transition:{duration:.1,ease:[.4,0,1,1]}},enter:{scale:1,opacity:1,transition:{duration:.15,ease:[0,0,.2,1]}}},N7=ne(ar.section),Qy=fe(function(t,n){const{variants:r=R7,...o}=t,{isOpen:s}=ps();return l.jsx(N7,{ref:n,variants:z7(r),initial:!1,animate:s?"enter":"exit",...o})});Qy.displayName="PopoverTransition";var Gh=fe(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:c,getPopoverPositionerProps:u,onAnimationComplete:f}=ps(),h=Wh(),m={position:"relative",display:"flex",flexDirection:"column",...h.content};return l.jsx(ne.div,{...u(r),__css:h.popper,className:"chakra-popover__popper",children:l.jsx(Qy,{...o,...c(s,n),onAnimationComplete:xc(f,s.onAnimationComplete),className:Ae("chakra-popover__content",t.className),__css:m})})});Gh.displayName="PopoverContent";function F7(e,t,n){return(e-t)*100/(n-t)}ei({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});ei({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var L7=ei({"0%":{left:"-40%"},"100%":{left:"100%"}}),B7=ei({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function H7(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:c,role:u="progressbar"}=e,f=F7(t,n,r);return{bind:{"data-indeterminate":c?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":c?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,f):o})(),role:u},percent:f,value:t}}var[W7,V7]=kt({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),U7=fe((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:c,...u}=e,f=H7({value:o,min:n,max:r,isIndeterminate:s,role:c}),m={height:"100%",...V7().filledTrack};return l.jsx(ne.div,{ref:t,style:{width:`${f.percent}%`,...u.style},...f.bind,...u,__css:m})}),Zy=fe((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:c,isAnimated:u,children:f,borderRadius:h,isIndeterminate:m,"aria-label":v,"aria-labelledby":x,"aria-valuetext":S,title:C,role:j,...w}=At(e),k=un("Progress",e),M=h??((n=k.track)==null?void 0:n.borderRadius),P={animation:`${B7} 1s linear infinite`},_={...!m&&c&&u&&P,...m&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${L7} 1s ease infinite normal none running`}},D={overflow:"hidden",position:"relative",...k.track};return l.jsx(ne.div,{ref:t,borderRadius:M,__css:D,...w,children:l.jsxs(W7,{value:k,children:[l.jsx(U7,{"aria-label":v,"aria-labelledby":x,"aria-valuetext":S,min:o,max:s,value:r,isIndeterminate:m,css:_,borderRadius:M,title:C,role:j}),f]})})});Zy.displayName="Progress";function $7(e){return e&&Qd(e)&&Qd(e.target)}function G7(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:c,isNative:u,...f}=e,[h,m]=y.useState(r||""),v=typeof n<"u",x=v?n:h,S=y.useRef(null),C=y.useCallback(()=>{const T=S.current;if(!T)return;let _="input:not(:disabled):checked";const D=T.querySelector(_);if(D){D.focus();return}_="input:not(:disabled)";const z=T.querySelector(_);z==null||z.focus()},[]),w=`radio-${y.useId()}`,k=o||w,M=y.useCallback(T=>{const _=$7(T)?T.target.value:T;v||m(_),t==null||t(String(_))},[t,v]),P=y.useCallback((T={},_=null)=>({...T,ref:ct(_,S),role:"radiogroup"}),[]),I=y.useCallback((T={},_=null)=>({...T,ref:_,name:k,[u?"checked":"isChecked"]:x!=null?T.value===x:void 0,onChange(z){M(z)},"data-radiogroup":!0}),[u,k,M,x]);return{getRootProps:P,getRadioProps:I,name:k,ref:S,focus:C,setValue:m,value:x,onChange:M,isDisabled:s,isFocusable:c,htmlProps:f}}var[q7,Jy]=kt({name:"RadioGroupContext",strict:!1}),Qa=fe((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:c,isDisabled:u,isFocusable:f,...h}=e,{value:m,onChange:v,getRootProps:x,name:S,htmlProps:C}=G7(h),j=y.useMemo(()=>({name:S,size:r,onChange:v,colorScheme:n,value:m,variant:o,isDisabled:u,isFocusable:f}),[S,r,v,n,m,o,u,f]);return l.jsx(q7,{value:j,children:l.jsx(ne.div,{...x(C,t),className:Ae("chakra-radio-group",c),children:s})})});Qa.displayName="RadioGroup";var Y7={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function K7(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:c,onChange:u,isInvalid:f,name:h,value:m,id:v,"data-radiogroup":x,"aria-describedby":S,...C}=e,j=`radio-${y.useId()}`,w=ri(),M=!!Jy()||!!x;let I=!!w&&!M?w.id:j;I=v??I;const T=o??(w==null?void 0:w.isDisabled),_=s??(w==null?void 0:w.isReadOnly),D=c??(w==null?void 0:w.isRequired),z=f??(w==null?void 0:w.isInvalid),[W,F]=y.useState(!1),[B,Q]=y.useState(!1),[U,X]=y.useState(!1),[te,re]=y.useState(!1),[$,Z]=y.useState(Boolean(t)),oe=typeof n<"u",le=oe?n:$;y.useEffect(()=>w2(F),[]);const ze=y.useCallback(ve=>{if(_||T){ve.preventDefault();return}oe||Z(ve.target.checked),u==null||u(ve)},[oe,T,_,u]),Re=y.useCallback(ve=>{ve.key===" "&&re(!0)},[re]),Ie=y.useCallback(ve=>{ve.key===" "&&re(!1)},[re]),pe=y.useCallback((ve={},Te=null)=>({...ve,ref:Te,"data-active":qe(te),"data-hover":qe(U),"data-disabled":qe(T),"data-invalid":qe(z),"data-checked":qe(le),"data-focus":qe(B),"data-focus-visible":qe(B&&W),"data-readonly":qe(_),"aria-hidden":!0,onMouseDown:Ee(ve.onMouseDown,()=>re(!0)),onMouseUp:Ee(ve.onMouseUp,()=>re(!1)),onMouseEnter:Ee(ve.onMouseEnter,()=>X(!0)),onMouseLeave:Ee(ve.onMouseLeave,()=>X(!1))}),[te,U,T,z,le,B,_,W]),{onFocus:ce,onBlur:Ne}=w??{},Ve=y.useCallback((ve={},Te=null)=>{const Ge=T&&!r;return{...ve,id:I,ref:Te,type:"radio",name:h,value:m,onChange:Ee(ve.onChange,ze),onBlur:Ee(Ne,ve.onBlur,()=>Q(!1)),onFocus:Ee(ce,ve.onFocus,()=>Q(!0)),onKeyDown:Ee(ve.onKeyDown,Re),onKeyUp:Ee(ve.onKeyUp,Ie),checked:le,disabled:Ge,readOnly:_,required:D,"aria-invalid":Nr(z),"aria-disabled":Nr(Ge),"aria-required":Nr(D),"data-readonly":qe(_),"aria-describedby":S,style:Y7}},[T,r,I,h,m,ze,Ne,ce,Re,Ie,le,_,D,z,S]);return{state:{isInvalid:z,isFocused:B,isChecked:le,isActive:te,isHovered:U,isDisabled:T,isReadOnly:_,isRequired:D},getCheckboxProps:pe,getInputProps:Ve,getLabelProps:(ve={},Te=null)=>({...ve,ref:Te,onMouseDown:Ee(ve.onMouseDown,Dg),onTouchStart:Ee(ve.onTouchStart,Dg),"data-disabled":qe(T),"data-checked":qe(le),"data-invalid":qe(z)}),getRootProps:(ve,Te=null)=>({...ve,ref:Te,"data-disabled":qe(T),"data-checked":qe(le),"data-invalid":qe(z)}),htmlProps:C}}function Dg(e){e.preventDefault(),e.stopPropagation()}function X7(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var vn=fe((e,t)=>{var n;const r=Jy(),{onChange:o,value:s}=e,c=un("Radio",{...r,...e}),u=At(e),{spacing:f="0.5rem",children:h,isDisabled:m=r==null?void 0:r.isDisabled,isFocusable:v=r==null?void 0:r.isFocusable,inputProps:x,...S}=u;let C=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(C=r.value===s);let j=o;r!=null&&r.onChange&&s!=null&&(j=xc(r.onChange,o));const w=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:k,getCheckboxProps:M,getLabelProps:P,getRootProps:I,htmlProps:T}=K7({...S,isChecked:C,isFocusable:v,isDisabled:m,onChange:j,name:w}),[_,D]=X7(T,b1),z=M(D),W=k(x,t),F=P(),B=Object.assign({},_,I()),Q={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...c.container},U={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...c.control},X={userSelect:"none",marginStart:f,...c.label};return l.jsxs(ne.label,{className:"chakra-radio",...B,__css:Q,children:[l.jsx("input",{className:"chakra-radio__input",...W}),l.jsx(ne.span,{className:"chakra-radio__control",...z,__css:U}),h&&l.jsx(ne.span,{className:"chakra-radio__label",...F,__css:X,children:h})]})});vn.displayName="Radio";var ex=fe(function(t,n){const{children:r,placeholder:o,className:s,...c}=t;return l.jsxs(ne.select,{...c,ref:n,className:Ae("chakra-select",s),children:[o&&l.jsx("option",{value:"",children:o}),r]})});ex.displayName="SelectField";function Q7(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var tx=fe((e,t)=>{var n;const r=un("Select",e),{rootProps:o,placeholder:s,icon:c,color:u,height:f,h,minH:m,minHeight:v,iconColor:x,iconSize:S,...C}=At(e),[j,w]=Q7(C,b1),k=sh(w),M={width:"100%",height:"fit-content",position:"relative",color:u},P={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return l.jsxs(ne.div,{className:"chakra-select__wrapper",__css:M,...j,...o,children:[l.jsx(ex,{ref:t,height:h??f,minH:m??v,placeholder:s,...k,__css:P,children:e.children}),l.jsx(nx,{"data-disabled":qe(k.disabled),...(x||u)&&{color:x||u},__css:r.icon,...S&&{fontSize:S},children:c})]})});tx.displayName="Select";var Z7=e=>l.jsx("svg",{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),J7=ne("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),nx=e=>{const{children:t=l.jsx(Z7,{}),...n}=e,r=y.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return l.jsx(J7,{...n,className:"chakra-select__icon-wrapper",children:y.isValidElement(t)?r:null})};nx.displayName="SelectIcon";var Mi=e=>e?"":void 0,Md=e=>e?!0:void 0,ms=(...e)=>e.filter(Boolean).join(" ");function Td(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function El(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var $l={width:0,height:0},Pl=e=>e||$l;function e8(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=j=>{var w;const k=(w=r[j])!=null?w:$l;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...El({orientation:t,vertical:{bottom:`calc(${n[j]}% - ${k.height/2}px)`},horizontal:{left:`calc(${n[j]}% - ${k.width/2}px)`}})}},c=t==="vertical"?r.reduce((j,w)=>Pl(j).height>Pl(w).height?j:w,$l):r.reduce((j,w)=>Pl(j).width>Pl(w).width?j:w,$l),u={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...El({orientation:t,vertical:c?{paddingLeft:c.width/2,paddingRight:c.width/2}:{},horizontal:c?{paddingTop:c.height/2,paddingBottom:c.height/2}:{}})},f={position:"absolute",...El({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},h=n.length===1,m=[0,o?100-n[0]:n[0]],v=h?m:n;let x=v[0];!h&&o&&(x=100-x);const S=Math.abs(v[v.length-1]-v[0]),C={...f,...El({orientation:t,vertical:o?{height:`${S}%`,top:`${x}%`}:{height:`${S}%`,bottom:`${x}%`},horizontal:o?{width:`${S}%`,right:`${x}%`}:{width:`${S}%`,left:`${x}%`}})};return{trackStyle:f,innerTrackStyle:C,rootStyle:u,getThumbStyle:s}}function t8(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function n8(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function r8(e){const t=i8(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function rx(e){return!!e.touches}function o8(e){return rx(e)&&e.touches.length>1}function i8(e){var t;return(t=e.view)!=null?t:window}function a8(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function s8(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function ox(e,t="page"){return rx(e)?a8(e,t):s8(e,t)}function l8(e){return t=>{const n=r8(t);(!n||n&&t.button===0)&&e(t)}}function c8(e,t=!1){function n(o){e(o,{point:ox(o)})}return t?l8(n):n}function Gl(e,t,n,r){return n8(e,t,c8(n,t==="pointerdown"),r)}var u8=Object.defineProperty,d8=(e,t,n)=>t in e?u8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jn=(e,t,n)=>(d8(e,typeof t!="symbol"?t+"":t,n),n),f8=class{constructor(e,t,n){Jn(this,"history",[]),Jn(this,"startEvent",null),Jn(this,"lastEvent",null),Jn(this,"lastEventInfo",null),Jn(this,"handlers",{}),Jn(this,"removeListeners",()=>{}),Jn(this,"threshold",3),Jn(this,"win"),Jn(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const u=_d(this.lastEventInfo,this.history),f=this.startEvent!==null,h=v8(u.offset,{x:0,y:0})>=this.threshold;if(!f&&!h)return;const{timestamp:m}=$v();this.history.push({...u.point,timestamp:m});const{onStart:v,onMove:x}=this.handlers;f||(v==null||v(this.lastEvent,u),this.startEvent=this.lastEvent),x==null||x(this.lastEvent,u)}),Jn(this,"onPointerMove",(u,f)=>{this.lastEvent=u,this.lastEventInfo=f,LC.update(this.updatePoint,!0)}),Jn(this,"onPointerUp",(u,f)=>{const h=_d(f,this.history),{onEnd:m,onSessionEnd:v}=this.handlers;v==null||v(u,h),this.end(),!(!m||!this.startEvent)&&(m==null||m(u,h))});var r;if(this.win=(r=e.view)!=null?r:window,o8(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:ox(e)},{timestamp:s}=$v();this.history=[{...o.point,timestamp:s}];const{onSessionStart:c}=t;c==null||c(e,_d(o,this.history)),this.removeListeners=m8(Gl(this.win,"pointermove",this.onPointerMove),Gl(this.win,"pointerup",this.onPointerUp),Gl(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),BC.update(this.updatePoint)}};function Ag(e,t){return{x:e.x-t.x,y:e.y-t.y}}function _d(e,t){return{point:e.point,delta:Ag(e.point,t[t.length-1]),offset:Ag(e.point,t[0]),velocity:p8(t,.1)}}var h8=e=>e*1e3;function p8(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=e[e.length-1];for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>h8(t)));)n--;if(!r)return{x:0,y:0};const s=(o.timestamp-r.timestamp)/1e3;if(s===0)return{x:0,y:0};const c={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function m8(...e){return t=>e.reduce((n,r)=>r(n),t)}function Dd(e,t){return Math.abs(e-t)}function Og(e){return"x"in e&&"y"in e}function v8(e,t){if(typeof e=="number"&&typeof t=="number")return Dd(e,t);if(Og(e)&&Og(t)){const n=Dd(e.x,t.x),r=Dd(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function ix(e){const t=y.useRef(null);return t.current=e,t}function g8(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:c,threshold:u}=t,f=Boolean(n||r||o||s||c),h=y.useRef(null),m=ix({onSessionStart:s,onSessionEnd:c,onStart:r,onMove:n,onEnd(v,x){h.current=null,o==null||o(v,x)}});y.useEffect(()=>{var v;(v=h.current)==null||v.updateHandlers(m.current)}),y.useEffect(()=>{const v=e.current;if(!v||!f)return;function x(S){h.current=new f8(S,m.current,u)}return Gl(v,"pointerdown",x)},[e,f,m,u]),y.useEffect(()=>()=>{var v;(v=h.current)==null||v.end(),h.current=null},[])}function y8(e,t){var n;if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const r=(n=e.ownerDocument.defaultView)!=null?n:window,o=new r.ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const[c]=s;let u,f;if("borderBoxSize"in c){const h=c.borderBoxSize,m=Array.isArray(h)?h[0]:h;u=m.inlineSize,f=m.blockSize}else u=e.offsetWidth,f=e.offsetHeight;t({width:u,height:f})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}var x8=Boolean(globalThis==null?void 0:globalThis.document)?y.useLayoutEffect:y.useEffect;function b8(e,t){var n,r;if(!e||!e.parentElement)return;const o=(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window,s=new o.MutationObserver(()=>{t()});return s.observe(e.parentElement,{childList:!0}),()=>{s.disconnect()}}function S8({getNodes:e,observeMutation:t=!0}){const[n,r]=y.useState([]),[o,s]=y.useState(0);return x8(()=>{const c=e(),u=c.map((f,h)=>y8(f,m=>{r(v=>[...v.slice(0,h),m,...v.slice(h+1)])}));if(t){const f=c[0];u.push(b8(f,()=>{s(h=>h+1)}))}return()=>{u.forEach(f=>{f==null||f()})}},[o]),n}function C8(e){return typeof e=="object"&&e!==null&&"current"in e}function w8(e){const[t]=S8({observeMutation:!1,getNodes(){return[C8(e)?e.current:e]}});return t}function j8(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:c,isReversed:u,direction:f="ltr",orientation:h="horizontal",id:m,isDisabled:v,isReadOnly:x,onChangeStart:S,onChangeEnd:C,step:j=1,getAriaValueText:w,"aria-valuetext":k,"aria-label":M,"aria-labelledby":P,name:I,focusThumbOnChange:T=!0,..._}=e,D=Wt(S),z=Wt(C),W=Wt(w),F=t8({isReversed:u,direction:f,orientation:h}),[B,Q]=rh({value:s,defaultValue:c??E8(n,r),onChange:o}),[U,X]=y.useState(!1),[te,re]=y.useState(!1),$=!(v||x),Z=(r-n)/10,oe=j||(r-n)/100,le=Hl(B,n,r),ze=r-le+n,Ie=ng(F?ze:le,n,r),pe=h==="vertical",ce=ix({min:n,max:r,step:j,isDisabled:v,value:le,isInteractive:$,isReversed:F,isVertical:pe,eventSource:null,focusThumbOnChange:T,orientation:h}),Ne=y.useRef(null),Ve=y.useRef(null),Ue=y.useRef(null),$e=y.useId(),Qe=m??$e,[ve,Te]=[`slider-thumb-${Qe}`,`slider-track-${Qe}`],Ge=y.useCallback(he=>{var _e,dn;if(!Ne.current)return;const Vt=ce.current;Vt.eventSource="pointer";const fn=Ne.current.getBoundingClientRect(),{clientX:sr,clientY:ko}=(dn=(_e=he.touches)==null?void 0:_e[0])!=null?dn:he,la=pe?fn.bottom-ko:sr-fn.left,Xc=pe?fn.height:fn.width;let ca=la/Xc;F&&(ca=1-ca);let Eo=Zw(ca,Vt.min,Vt.max);return Vt.step&&(Eo=parseFloat(rg(Eo,Vt.min,Vt.step))),Eo=Hl(Eo,Vt.min,Vt.max),Eo},[pe,F,ce]),ye=y.useCallback(he=>{const _e=ce.current;_e.isInteractive&&(he=parseFloat(rg(he,_e.min,oe)),he=Hl(he,_e.min,_e.max),Q(he))},[oe,Q,ce]),Pe=y.useMemo(()=>({stepUp(he=oe){const _e=F?le-he:le+he;ye(_e)},stepDown(he=oe){const _e=F?le+he:le-he;ye(_e)},reset(){ye(c||0)},stepTo(he){ye(he)}}),[ye,F,le,oe,c]),et=y.useCallback(he=>{const _e=ce.current,Vt={ArrowRight:()=>Pe.stepUp(),ArrowUp:()=>Pe.stepUp(),ArrowLeft:()=>Pe.stepDown(),ArrowDown:()=>Pe.stepDown(),PageUp:()=>Pe.stepUp(Z),PageDown:()=>Pe.stepDown(Z),Home:()=>ye(_e.min),End:()=>ye(_e.max)}[he.key];Vt&&(he.preventDefault(),he.stopPropagation(),Vt(he),_e.eventSource="keyboard")},[Pe,ye,Z,ce]),Be=(t=W==null?void 0:W(le))!=null?t:k,vt=w8(Ve),{getThumbStyle:Rt,rootStyle:N,trackStyle:ue,innerTrackStyle:xe}=y.useMemo(()=>{const he=ce.current,_e=vt??{width:0,height:0};return e8({isReversed:F,orientation:he.orientation,thumbRects:[_e],thumbPercents:[Ie]})},[F,vt,Ie,ce]),je=y.useCallback(()=>{ce.current.focusThumbOnChange&&setTimeout(()=>{var _e;return(_e=Ve.current)==null?void 0:_e.focus()})},[ce]);ti(()=>{const he=ce.current;je(),he.eventSource==="keyboard"&&(z==null||z(he.value))},[le,z]);function q(he){const _e=Ge(he);_e!=null&&_e!==ce.current.value&&Q(_e)}g8(Ue,{onPanSessionStart(he){const _e=ce.current;_e.isInteractive&&(X(!0),je(),q(he),D==null||D(_e.value))},onPanSessionEnd(){const he=ce.current;he.isInteractive&&(X(!1),z==null||z(he.value))},onPan(he){ce.current.isInteractive&&q(he)}});const ae=y.useCallback((he={},_e=null)=>({...he,..._,ref:ct(_e,Ue),tabIndex:-1,"aria-disabled":Md(v),"data-focused":Mi(te),style:{...he.style,...N}}),[_,v,te,N]),Oe=y.useCallback((he={},_e=null)=>({...he,ref:ct(_e,Ne),id:Te,"data-disabled":Mi(v),style:{...he.style,...ue}}),[v,Te,ue]),Ze=y.useCallback((he={},_e=null)=>({...he,ref:_e,style:{...he.style,...xe}}),[xe]),J=y.useCallback((he={},_e=null)=>({...he,ref:ct(_e,Ve),role:"slider",tabIndex:$?0:void 0,id:ve,"data-active":Mi(U),"aria-valuetext":Be,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":le,"aria-orientation":h,"aria-disabled":Md(v),"aria-readonly":Md(x),"aria-label":M,"aria-labelledby":M?void 0:P,style:{...he.style,...Rt(0)},onKeyDown:Td(he.onKeyDown,et),onFocus:Td(he.onFocus,()=>re(!0)),onBlur:Td(he.onBlur,()=>re(!1))}),[$,ve,U,Be,n,r,le,h,v,x,M,P,Rt,et]),Le=y.useCallback((he,_e=null)=>{const dn=!(he.valuer),Vt=le>=he.value,fn=ng(he.value,n,r),sr={position:"absolute",pointerEvents:"none",...k8({orientation:h,vertical:{bottom:F?`${100-fn}%`:`${fn}%`},horizontal:{left:F?`${100-fn}%`:`${fn}%`}})};return{...he,ref:_e,role:"presentation","aria-hidden":!0,"data-disabled":Mi(v),"data-invalid":Mi(!dn),"data-highlighted":Mi(Vt),style:{...he.style,...sr}}},[v,F,r,n,h,le]),nt=y.useCallback((he={},_e=null)=>({...he,ref:_e,type:"hidden",value:le,name:I}),[I,le]);return{state:{value:le,isFocused:te,isDragging:U},actions:Pe,getRootProps:ae,getTrackProps:Oe,getInnerTrackProps:Ze,getThumbProps:J,getMarkerProps:Le,getInputProps:nt}}function k8(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function E8(e,t){return t"}),[I8,_c]=kt({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),ax=fe((e,t)=>{const n={orientation:"horizontal",...e},r=un("Slider",n),o=At(n),{direction:s}=ta();o.direction=s;const{getInputProps:c,getRootProps:u,...f}=j8(o),h=u(),m=c({},t);return l.jsx(P8,{value:f,children:l.jsx(I8,{value:r,children:l.jsxs(ne.div,{...h,className:ms("chakra-slider",n.className),__css:r.container,children:[n.children,l.jsx("input",{...m})]})})})});ax.displayName="Slider";var sx=fe((e,t)=>{const{getThumbProps:n}=Tc(),r=_c(),o=n(e,t);return l.jsx(ne.div,{...o,className:ms("chakra-slider__thumb",e.className),__css:r.thumb})});sx.displayName="SliderThumb";var lx=fe((e,t)=>{const{getTrackProps:n}=Tc(),r=_c(),o=n(e,t);return l.jsx(ne.div,{...o,className:ms("chakra-slider__track",e.className),__css:r.track})});lx.displayName="SliderTrack";var cx=fe((e,t)=>{const{getInnerTrackProps:n}=Tc(),r=_c(),o=n(e,t);return l.jsx(ne.div,{...o,className:ms("chakra-slider__filled-track",e.className),__css:r.filledTrack})});cx.displayName="SliderFilledTrack";var Tf=fe((e,t)=>{const{getMarkerProps:n}=Tc(),r=_c(),o=n(e,t);return l.jsx(ne.div,{...o,className:ms("chakra-slider__marker",e.className),__css:r.mark})});Tf.displayName="SliderMark";var ux=fe(function(t,n){const r=un("Switch",t),{spacing:o="0.5rem",children:s,...c}=At(t),{state:u,getInputProps:f,getCheckboxProps:h,getRootProps:m,getLabelProps:v}=j2(c),x=y.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),S=y.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),C=y.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return l.jsxs(ne.label,{...m(),className:Ae("chakra-switch",t.className),__css:x,children:[l.jsx("input",{className:"chakra-switch__input",...f({},n)}),l.jsx(ne.span,{...h(),className:"chakra-switch__track",__css:S,children:l.jsx(ne.span,{__css:r.thumb,className:"chakra-switch__thumb","data-checked":qe(u.isChecked),"data-hover":qe(u.isHovered)})}),s&&l.jsx(ne.span,{className:"chakra-switch__label",...v(),__css:C,children:s})]})});ux.displayName="Switch";var[M8,T8,_8,D8]=th();function A8(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:c,lazyBehavior:u="unmount",orientation:f="horizontal",direction:h="ltr",...m}=e,[v,x]=y.useState(n??0),[S,C]=rh({defaultValue:n??0,value:o,onChange:r});y.useEffect(()=>{o!=null&&x(o)},[o]);const j=_8(),w=y.useId();return{id:`tabs-${(t=e.id)!=null?t:w}`,selectedIndex:S,focusedIndex:v,setSelectedIndex:C,setFocusedIndex:x,isManual:s,isLazy:c,lazyBehavior:u,orientation:f,descendants:j,direction:h,htmlProps:m}}var[O8,Dc]=kt({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function z8(e){const{focusedIndex:t,orientation:n,direction:r}=Dc(),o=T8(),s=y.useCallback(c=>{const u=()=>{var M;const P=o.nextEnabled(t);P&&((M=P.node)==null||M.focus())},f=()=>{var M;const P=o.prevEnabled(t);P&&((M=P.node)==null||M.focus())},h=()=>{var M;const P=o.firstEnabled();P&&((M=P.node)==null||M.focus())},m=()=>{var M;const P=o.lastEnabled();P&&((M=P.node)==null||M.focus())},v=n==="horizontal",x=n==="vertical",S=c.key,C=r==="ltr"?"ArrowLeft":"ArrowRight",j=r==="ltr"?"ArrowRight":"ArrowLeft",k={[C]:()=>v&&f(),[j]:()=>v&&u(),ArrowDown:()=>x&&u(),ArrowUp:()=>x&&f(),Home:h,End:m}[S];k&&(c.preventDefault(),k(c))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:Ee(e.onKeyDown,s)}}function R8(e){const{isDisabled:t,isFocusable:n,...r}=e,{setSelectedIndex:o,isManual:s,id:c,setFocusedIndex:u,selectedIndex:f}=Dc(),{index:h,register:m}=D8({disabled:t&&!n}),v=h===f,x=()=>{o(h)},S=()=>{u(h),!s&&!(t&&n)&&o(h)},C=Cy({...r,ref:ct(m,e.ref),isDisabled:t,isFocusable:n,onClick:Ee(e.onClick,x)}),j="button";return{...C,id:dx(c,h),role:"tab",tabIndex:v?0:-1,type:j,"aria-selected":v,"aria-controls":fx(c,h),onFocus:t?void 0:Ee(e.onFocus,S)}}var[N8,F8]=kt({});function L8(e){const t=Dc(),{id:n,selectedIndex:r}=t,s=ah(e.children).map((c,u)=>y.createElement(N8,{key:u,value:{isSelected:u===r,id:fx(n,u),tabId:dx(n,u),selectedIndex:r}},c));return{...e,children:s}}function B8(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=Dc(),{isSelected:s,id:c,tabId:u}=F8(),f=y.useRef(!1);s&&(f.current=!0);const h=Dh({wasSelected:f.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:h?t:null,role:"tabpanel","aria-labelledby":u,hidden:!s,id:c}}function dx(e,t){return`${e}--tab-${t}`}function fx(e,t){return`${e}--tabpanel-${t}`}var[H8,Ac]=kt({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),hx=fe(function(t,n){const r=un("Tabs",t),{children:o,className:s,...c}=At(t),{htmlProps:u,descendants:f,...h}=A8(c),m=y.useMemo(()=>h,[h]),{isFitted:v,...x}=u;return l.jsx(M8,{value:f,children:l.jsx(O8,{value:m,children:l.jsx(H8,{value:r,children:l.jsx(ne.div,{className:Ae("chakra-tabs",s),ref:n,...x,__css:r.root,children:o})})})})});hx.displayName="Tabs";var px=fe(function(t,n){const r=z8({...t,ref:n}),s={display:"flex",...Ac().tablist};return l.jsx(ne.div,{...r,className:Ae("chakra-tabs__tablist",t.className),__css:s})});px.displayName="TabList";var mx=fe(function(t,n){const r=B8({...t,ref:n}),o=Ac();return l.jsx(ne.div,{outline:"0",...r,className:Ae("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});mx.displayName="TabPanel";var vx=fe(function(t,n){const r=L8(t),o=Ac();return l.jsx(ne.div,{...r,width:"100%",ref:n,className:Ae("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});vx.displayName="TabPanels";var gx=fe(function(t,n){const r=Ac(),o=R8({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return l.jsx(ne.button,{...o,className:Ae("chakra-tabs__tab",t.className),__css:s})});gx.displayName="Tab";function W8(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var V8=["h","minH","height","minHeight"],qh=fe((e,t)=>{const n=yo("Textarea",e),{className:r,rows:o,...s}=At(e),c=sh(s),u=o?W8(n,V8):n;return l.jsx(ne.textarea,{ref:t,rows:o,...c,className:Ae("chakra-textarea",r),__css:u})});qh.displayName="Textarea";var U8={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},sc=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},_f=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function $8(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:c=o,closeOnEsc:u=!0,onOpen:f,onClose:h,placement:m,id:v,isOpen:x,defaultIsOpen:S,arrowSize:C=10,arrowShadowColor:j,arrowPadding:w,modifiers:k,isDisabled:M,gutter:P,offset:I,direction:T,..._}=e,{isOpen:D,onOpen:z,onClose:W}=_h({isOpen:x,defaultIsOpen:S,onOpen:f,onClose:h}),{referenceRef:F,getPopperProps:B,getArrowInnerProps:Q,getArrowProps:U}=Th({enabled:D,placement:m,arrowPadding:w,modifiers:k,gutter:P,offset:I,direction:T}),X=y.useId(),re=`tooltip-${v??X}`,$=y.useRef(null),Z=y.useRef(),oe=y.useCallback(()=>{Z.current&&(clearTimeout(Z.current),Z.current=void 0)},[]),le=y.useRef(),ze=y.useCallback(()=>{le.current&&(clearTimeout(le.current),le.current=void 0)},[]),Re=y.useCallback(()=>{ze(),W()},[W,ze]),Ie=G8($,Re),pe=y.useCallback(()=>{if(!M&&!Z.current){Ie();const Te=_f($);Z.current=Te.setTimeout(z,t)}},[Ie,M,z,t]),ce=y.useCallback(()=>{oe();const Te=_f($);le.current=Te.setTimeout(Re,n)},[n,Re,oe]),Ne=y.useCallback(()=>{D&&r&&ce()},[r,ce,D]),Ve=y.useCallback(()=>{D&&c&&ce()},[c,ce,D]),Ue=y.useCallback(Te=>{D&&Te.key==="Escape"&&ce()},[D,ce]);Go(()=>sc($),"keydown",u?Ue:void 0),Go(()=>sc($),"scroll",()=>{D&&s&&Re()}),y.useEffect(()=>{M&&(oe(),D&&W())},[M,D,W,oe]),y.useEffect(()=>()=>{oe(),ze()},[oe,ze]),Go(()=>$.current,"pointerleave",ce);const $e=y.useCallback((Te={},Ge=null)=>({...Te,ref:ct($,Ge,F),onPointerEnter:Ee(Te.onPointerEnter,Pe=>{Pe.pointerType!=="touch"&&pe()}),onClick:Ee(Te.onClick,Ne),onPointerDown:Ee(Te.onPointerDown,Ve),onFocus:Ee(Te.onFocus,pe),onBlur:Ee(Te.onBlur,ce),"aria-describedby":D?re:void 0}),[pe,ce,Ve,D,re,Ne,F]),Qe=y.useCallback((Te={},Ge=null)=>B({...Te,style:{...Te.style,[Ht.arrowSize.var]:C?`${C}px`:void 0,[Ht.arrowShadowColor.var]:j}},Ge),[B,C,j]),ve=y.useCallback((Te={},Ge=null)=>{const ye={...Te.style,position:"relative",transformOrigin:Ht.transformOrigin.varRef};return{ref:Ge,..._,...Te,id:re,role:"tooltip",style:ye}},[_,re]);return{isOpen:D,show:pe,hide:ce,getTriggerProps:$e,getTooltipProps:ve,getTooltipPositionerProps:Qe,getArrowProps:U,getArrowInnerProps:Q}}var Ad="chakra-ui:close-tooltip";function G8(e,t){return y.useEffect(()=>{const n=sc(e);return n.addEventListener(Ad,t),()=>n.removeEventListener(Ad,t)},[t,e]),()=>{const n=sc(e),r=_f(e);n.dispatchEvent(new r.CustomEvent(Ad))}}function q8(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function Y8(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var K8=ne(ar.div),Gt=fe((e,t)=>{var n,r;const o=yo("Tooltip",e),s=At(e),c=ta(),{children:u,label:f,shouldWrapChildren:h,"aria-label":m,hasArrow:v,bg:x,portalProps:S,background:C,backgroundColor:j,bgColor:w,motionProps:k,...M}=s,P=(r=(n=C??j)!=null?n:x)!=null?r:w;if(P){o.bg=P;const B=HS(c,"colors",P);o[Ht.arrowBg.var]=B}const I=$8({...M,direction:c.direction}),T=typeof u=="string"||h;let _;if(T)_=l.jsx(ne.span,{display:"inline-block",tabIndex:0,...I.getTriggerProps(),children:u});else{const B=y.Children.only(u);_=y.cloneElement(B,I.getTriggerProps(B.props,B.ref))}const D=!!m,z=I.getTooltipProps({},t),W=D?q8(z,["role","id"]):z,F=Y8(z,["role","id"]);return f?l.jsxs(l.Fragment,{children:[_,l.jsx(xo,{children:I.isOpen&&l.jsx($a,{...S,children:l.jsx(ne.div,{...I.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:l.jsxs(K8,{variants:U8,initial:"exit",animate:"enter",exit:"exit",...k,...W,__css:o,children:[f,D&&l.jsx(ne.span,{srOnly:!0,...F,children:m}),v&&l.jsx(ne.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:l.jsx(ne.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):l.jsx(l.Fragment,{children:u})});Gt.displayName="Tooltip";const Yh=y.createContext(null);let zg;const Kh=()=>({setOpenUploader:e=>{e&&(zg=e)},openUploader:zg}),bt=me(e=>e.ui,e=>WS[e.activeTab],{memoizeOptions:{equalityCheck:ee.isEqual}}),X8=me(e=>e.ui,e=>e.activeTab,{memoizeOptions:{equalityCheck:ee.isEqual}}),Pr=me(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:ee.isEqual}}),Rg=e=>async(t,n)=>{const{imageFile:r}=e,o=n(),s=bt(o),c=new FormData;c.append("file",r,r.name),c.append("data",JSON.stringify({kind:"init"}));const f=await(await fetch(`${window.location.origin}/upload`,{method:"POST",body:c})).json(),h={uuid:S1(),category:"user",...f};t(C1({image:h,category:"user"})),s==="unifiedCanvas"?t(bc(h)):s==="img2img"&&t(rs(h))};var Q8=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 vs(e,t){var n=Z8(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 Z8(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=Q8.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var J8=[".DS_Store","Thumbs.db"];function eE(e){return na(this,void 0,void 0,function(){return ra(this,function(t){return lc(e)&&tE(e.dataTransfer)?[2,iE(e.dataTransfer,e.type)]:nE(e)?[2,rE(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,oE(e)]:[2,[]]})})}function tE(e){return lc(e)}function nE(e){return lc(e)&&lc(e.target)}function lc(e){return typeof e=="object"&&e!==null}function rE(e){return Df(e.target.files).map(function(t){return vs(t)})}function oE(e){return na(this,void 0,void 0,function(){var t;return ra(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 vs(r)})]}})})}function iE(e,t){return na(this,void 0,void 0,function(){var n,r;return ra(this,function(o){switch(o.label){case 0:return e.items?(n=Df(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(aE))]):[3,2];case 1:return r=o.sent(),[2,Ng(yx(r))];case 2:return[2,Ng(Df(e.files).map(function(s){return vs(s)}))]}})})}function Ng(e){return e.filter(function(t){return J8.indexOf(t.name)===-1})}function Df(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,Wg(n)];if(e.sizen)return[!1,Wg(n)]}return[!0,null]}function Ho(e){return e!=null}function CE(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,c=e.maxFiles,u=e.validator;return!s&&t.length>1||s&&c>=1&&t.length>c?!1:t.every(function(f){var h=Cx(f,n),m=Za(h,1),v=m[0],x=wx(f,r,o),S=Za(x,1),C=S[0],j=u?u(f):null;return v&&C&&!j})}function cc(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Il(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 Ug(e){e.preventDefault()}function wE(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function jE(e){return e.indexOf("Edge/")!==-1}function kE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return wE(e)||jE(e)}function vr(){for(var e=arguments.length,t=new Array(e),n=0;n1?o-1:0),c=1;ce.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function WE(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}var Xh=y.forwardRef(function(e,t){var n=e.children,r=uc(e,_E),o=Ix(r),s=o.open,c=uc(o,DE);return y.useImperativeHandle(t,function(){return{open:s}},[s]),Me.createElement(y.Fragment,null,n(Dt(Dt({},c),{},{open:s})))});Xh.displayName="Dropzone";var Px={disabled:!1,getFilesFromEvent:eE,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};Xh.defaultProps=Px;Xh.propTypes={children:lt.func,accept:lt.objectOf(lt.arrayOf(lt.string)),multiple:lt.bool,preventDropOnDocument:lt.bool,noClick:lt.bool,noKeyboard:lt.bool,noDrag:lt.bool,noDragEventsBubbling:lt.bool,minSize:lt.number,maxSize:lt.number,maxFiles:lt.number,disabled:lt.bool,getFilesFromEvent:lt.func,onFileDialogCancel:lt.func,onFileDialogOpen:lt.func,useFsAccessApi:lt.bool,autoFocus:lt.bool,onDragEnter:lt.func,onDragLeave:lt.func,onDragOver:lt.func,onDrop:lt.func,onDropAccepted:lt.func,onDropRejected:lt.func,onError:lt.func,validator:lt.func};var Rf={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Ix(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Dt(Dt({},Px),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,c=t.minSize,u=t.multiple,f=t.maxFiles,h=t.onDragEnter,m=t.onDragLeave,v=t.onDragOver,x=t.onDrop,S=t.onDropAccepted,C=t.onDropRejected,j=t.onFileDialogCancel,w=t.onFileDialogOpen,k=t.useFsAccessApi,M=t.autoFocus,P=t.preventDropOnDocument,I=t.noClick,T=t.noKeyboard,_=t.noDrag,D=t.noDragEventsBubbling,z=t.onError,W=t.validator,F=y.useMemo(function(){return IE(n)},[n]),B=y.useMemo(function(){return PE(n)},[n]),Q=y.useMemo(function(){return typeof w=="function"?w:Gg},[w]),U=y.useMemo(function(){return typeof j=="function"?j:Gg},[j]),X=y.useRef(null),te=y.useRef(null),re=y.useReducer(VE,Rf),$=Od(re,2),Z=$[0],oe=$[1],le=Z.isFocused,ze=Z.isFileDialogActive,Re=y.useRef(typeof window<"u"&&window.isSecureContext&&k&&EE()),Ie=function(){!Re.current&&ze&&setTimeout(function(){if(te.current){var ae=te.current.files;ae.length||(oe({type:"closeDialog"}),U())}},300)};y.useEffect(function(){return window.addEventListener("focus",Ie,!1),function(){window.removeEventListener("focus",Ie,!1)}},[te,ze,U,Re]);var pe=y.useRef([]),ce=function(ae){X.current&&X.current.contains(ae.target)||(ae.preventDefault(),pe.current=[])};y.useEffect(function(){return P&&(document.addEventListener("dragover",Ug,!1),document.addEventListener("drop",ce,!1)),function(){P&&(document.removeEventListener("dragover",Ug),document.removeEventListener("drop",ce))}},[X,P]),y.useEffect(function(){return!r&&M&&X.current&&X.current.focus(),function(){}},[X,M,r]);var Ne=y.useCallback(function(q){z?z(q):console.error(q)},[z]),Ve=y.useCallback(function(q){q.preventDefault(),q.persist(),N(q),pe.current=[].concat(zE(pe.current),[q.target]),Il(q)&&Promise.resolve(o(q)).then(function(ae){if(!(cc(q)&&!D)){var Oe=ae.length,Ze=Oe>0&&CE({files:ae,accept:F,minSize:c,maxSize:s,multiple:u,maxFiles:f,validator:W}),J=Oe>0&&!Ze;oe({isDragAccept:Ze,isDragReject:J,isDragActive:!0,type:"setDraggedFiles"}),h&&h(q)}}).catch(function(ae){return Ne(ae)})},[o,h,Ne,D,F,c,s,u,f,W]),Ue=y.useCallback(function(q){q.preventDefault(),q.persist(),N(q);var ae=Il(q);if(ae&&q.dataTransfer)try{q.dataTransfer.dropEffect="copy"}catch{}return ae&&v&&v(q),!1},[v,D]),$e=y.useCallback(function(q){q.preventDefault(),q.persist(),N(q);var ae=pe.current.filter(function(Ze){return X.current&&X.current.contains(Ze)}),Oe=ae.indexOf(q.target);Oe!==-1&&ae.splice(Oe,1),pe.current=ae,!(ae.length>0)&&(oe({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Il(q)&&m&&m(q))},[X,m,D]),Qe=y.useCallback(function(q,ae){var Oe=[],Ze=[];q.forEach(function(J){var Le=Cx(J,F),nt=Od(Le,2),Nt=nt[0],he=nt[1],_e=wx(J,c,s),dn=Od(_e,2),Vt=dn[0],fn=dn[1],sr=W?W(J):null;if(Nt&&Vt&&!sr)Oe.push(J);else{var ko=[he,fn];sr&&(ko=ko.concat(sr)),Ze.push({file:J,errors:ko.filter(function(la){return la})})}}),(!u&&Oe.length>1||u&&f>=1&&Oe.length>f)&&(Oe.forEach(function(J){Ze.push({file:J,errors:[SE]})}),Oe.splice(0)),oe({acceptedFiles:Oe,fileRejections:Ze,type:"setFiles"}),x&&x(Oe,Ze,ae),Ze.length>0&&C&&C(Ze,ae),Oe.length>0&&S&&S(Oe,ae)},[oe,u,F,c,s,f,x,S,C,W]),ve=y.useCallback(function(q){q.preventDefault(),q.persist(),N(q),pe.current=[],Il(q)&&Promise.resolve(o(q)).then(function(ae){cc(q)&&!D||Qe(ae,q)}).catch(function(ae){return Ne(ae)}),oe({type:"reset"})},[o,Qe,Ne,D]),Te=y.useCallback(function(){if(Re.current){oe({type:"openDialog"}),Q();var q={multiple:u,types:B};window.showOpenFilePicker(q).then(function(ae){return o(ae)}).then(function(ae){Qe(ae,null),oe({type:"closeDialog"})}).catch(function(ae){ME(ae)?(U(ae),oe({type:"closeDialog"})):TE(ae)?(Re.current=!1,te.current?(te.current.value=null,te.current.click()):Ne(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."))):Ne(ae)});return}te.current&&(oe({type:"openDialog"}),Q(),te.current.value=null,te.current.click())},[oe,Q,U,k,Qe,Ne,B,u]),Ge=y.useCallback(function(q){!X.current||!X.current.isEqualNode(q.target)||(q.key===" "||q.key==="Enter"||q.keyCode===32||q.keyCode===13)&&(q.preventDefault(),Te())},[X,Te]),ye=y.useCallback(function(){oe({type:"focus"})},[]),Pe=y.useCallback(function(){oe({type:"blur"})},[]),et=y.useCallback(function(){I||(kE()?setTimeout(Te,0):Te())},[I,Te]),Be=function(ae){return r?null:ae},vt=function(ae){return T?null:Be(ae)},Rt=function(ae){return _?null:Be(ae)},N=function(ae){D&&ae.stopPropagation()},ue=y.useMemo(function(){return function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ae=q.refKey,Oe=ae===void 0?"ref":ae,Ze=q.role,J=q.onKeyDown,Le=q.onFocus,nt=q.onBlur,Nt=q.onClick,he=q.onDragEnter,_e=q.onDragOver,dn=q.onDragLeave,Vt=q.onDrop,fn=uc(q,AE);return Dt(Dt(zf({onKeyDown:vt(vr(J,Ge)),onFocus:vt(vr(Le,ye)),onBlur:vt(vr(nt,Pe)),onClick:Be(vr(Nt,et)),onDragEnter:Rt(vr(he,Ve)),onDragOver:Rt(vr(_e,Ue)),onDragLeave:Rt(vr(dn,$e)),onDrop:Rt(vr(Vt,ve)),role:typeof Ze=="string"&&Ze!==""?Ze:"presentation"},Oe,X),!r&&!T?{tabIndex:0}:{}),fn)}},[X,Ge,ye,Pe,et,Ve,Ue,$e,ve,T,_,r]),xe=y.useCallback(function(q){q.stopPropagation()},[]),je=y.useMemo(function(){return function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ae=q.refKey,Oe=ae===void 0?"ref":ae,Ze=q.onChange,J=q.onClick,Le=uc(q,OE),nt=zf({accept:F,multiple:u,type:"file",style:{display:"none"},onChange:Be(vr(Ze,ve)),onClick:Be(vr(J,xe)),tabIndex:-1},Oe,te);return Dt(Dt({},nt),Le)}},[te,n,u,ve,r]);return Dt(Dt({},Z),{},{isFocused:le&&!r,getRootProps:ue,getInputProps:je,rootRef:X,inputRef:te,open:Be(Te)})}function VE(e,t){switch(t.type){case"focus":return Dt(Dt({},e),{},{isFocused:!0});case"blur":return Dt(Dt({},e),{},{isFocused:!1});case"openDialog":return Dt(Dt({},Rf),{},{isFileDialogActive:!0});case"closeDialog":return Dt(Dt({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return Dt(Dt({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Dt(Dt({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return Dt({},Rf);default:return e}}function Gg(){}function Nf(){return Nf=Object.assign?Object.assign.bind():function(e){for(var t=1;t'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var QE=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,c=n.mod,u=n.shift,f=n.ctrl,h=n.keys,m=t.key,v=t.code,x=t.ctrlKey,S=t.metaKey,C=t.shiftKey,j=t.altKey,w=so(v),k=m.toLowerCase();if(!r){if(o===!j&&k!=="alt"||u===!C&&k!=="shift")return!1;if(c){if(!S&&!x)return!1}else if(s===!S&&k!=="meta"&&k!=="os"||f===!x&&k!=="ctrl"&&k!=="control")return!1}return h&&h.length===1&&(h.includes(k)||h.includes(w))?!0:h?GE(h):!h},ZE=y.createContext(void 0),JE=function(){return y.useContext(ZE)};function Ax(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&Ax(e[r],t[r])},!0):e===t}var e9=y.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),t9=function(){return y.useContext(e9)};function n9(e){var t=y.useRef(void 0);return Ax(t.current,e)||(t.current=e),t.current}var qg=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},r9=typeof window<"u"?y.useLayoutEffect:y.useEffect;function de(e,t,n,r){var o=y.useRef(null),s=y.useRef(!1),c=n instanceof Array?r instanceof Array?void 0:r:n,u=e instanceof Array?e.join(c==null?void 0:c.splitKey):e,f=n instanceof Array?n:r instanceof Array?r:void 0,h=y.useCallback(t,f??[]),m=y.useRef(h);f?m.current=h:m.current=t;var v=n9(c),x=t9(),S=x.enabledScopes,C=JE();return r9(function(){if(!((v==null?void 0:v.enabled)===!1||!XE(S,v==null?void 0:v.scopes))){var j=function(I,T){var _;if(T===void 0&&(T=!1),!(KE(I)&&!Dx(I,v==null?void 0:v.enableOnFormTags))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){qg(I);return}(_=I.target)!=null&&_.isContentEditable&&!(v!=null&&v.enableOnContentEditable)||zd(u,v==null?void 0:v.splitKey).forEach(function(D){var z,W=Rd(D,v==null?void 0:v.combinationKey);if(QE(I,W,v==null?void 0:v.ignoreModifiers)||(z=W.keys)!=null&&z.includes("*")){if(T&&s.current)return;if(qE(I,W,v==null?void 0:v.preventDefault),!YE(I,W,v==null?void 0:v.enabled)){qg(I);return}m.current(I,W),T||(s.current=!0)}})}},w=function(I){I.key!==void 0&&(Tx(so(I.code)),((v==null?void 0:v.keydown)===void 0&&(v==null?void 0:v.keyup)!==!0||v!=null&&v.keydown)&&j(I))},k=function(I){I.key!==void 0&&(_x(so(I.code)),s.current=!1,v!=null&&v.keyup&&j(I,!0))},M=o.current||(c==null?void 0:c.document)||document;return M.addEventListener("keyup",k),M.addEventListener("keydown",w),C&&zd(u,v==null?void 0:v.splitKey).forEach(function(P){return C.addHotkey(Rd(P,v==null?void 0:v.combinationKey))}),function(){M.removeEventListener("keyup",k),M.removeEventListener("keydown",w),C&&zd(u,v==null?void 0:v.splitKey).forEach(function(P){return C.removeHotkey(Rd(P,v==null?void 0:v.combinationKey))})}}},[u,v,S]),o}const o9=e=>{const{isDragAccept:t,isDragReject:n,overlaySecondaryText:r,setIsHandlingUpload:o}=e;return de("esc",()=>{o(!1)}),l.jsx(Ye,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:l.jsx(L,{sx:{opacity:.4,width:"100%",height:"100%",flexDirection:"column",rowGap:4,alignItems:"center",justifyContent:"center",bg:"base.900",boxShadow:`inset 0 0 20rem 1rem var(--invokeai-colors-${t?"accent":"error"}-500)`},children:t?l.jsxs(Wn,{size:"lg",children:["Upload Image",r]}):l.jsxs(l.Fragment,{children:[l.jsx(Wn,{size:"lg",children:"Invalid Upload"}),l.jsx(Wn,{size:"md",children:"Must be single JPEG or PNG image"})]})})})},i9=e=>{const{children:t}=e,n=Y(),r=A(bt),o=ls({}),{t:s}=K(),[c,u]=y.useState(!1),{setOpenUploader:f}=Kh(),h=y.useCallback(P=>{u(!0);const I=P.errors.reduce((T,_)=>`${T} ${_.message}`,"");o({title:s("toast.uploadFailed"),description:I,status:"error",isClosable:!0})},[s,o]),m=y.useCallback(async P=>{n(Rg({imageFile:P}))},[n]),v=y.useCallback((P,I)=>{I.forEach(T=>{h(T)}),P.forEach(T=>{m(T)})},[m,h]),{getRootProps:x,getInputProps:S,isDragAccept:C,isDragReject:j,isDragActive:w,open:k}=Ix({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:v,onDragOver:()=>u(!0),maxFiles:1});f(k),y.useEffect(()=>{const P=I=>{var z;const T=(z=I.clipboardData)==null?void 0:z.items;if(!T)return;const _=[];for(const W of T)W.kind==="file"&&["image/png","image/jpg"].includes(W.type)&&_.push(W);if(!_.length)return;if(I.stopImmediatePropagation(),_.length>1){o({description:s("toast.uploadFailedMultipleImagesDesc"),status:"error",isClosable:!0});return}const D=_[0].getAsFile();if(!D){o({description:s("toast.uploadFailedUnableToLoadDesc"),status:"error",isClosable:!0});return}n(Rg({imageFile:D}))};return document.addEventListener("paste",P),()=>{document.removeEventListener("paste",P)}},[s,n,o,r]);const M=["img2img","unifiedCanvas"].includes(r)?` to ${String(s(`common.${r}`))}`:"";return l.jsx(Yh.Provider,{value:k,children:l.jsxs(Ye,{...x({style:{}}),onKeyDown:P=>{P.key},children:[l.jsx("input",{...S()}),t,w&&c&&l.jsx(o9,{isDragAccept:C,isDragReject:j,overlaySecondaryText:M,setIsHandlingUpload:u})]})})},a9=y.memo(i9),Ox=fe((e,t)=>{const{role:n,tooltip:r="",tooltipProps:o,isChecked:s,...c}=e;return l.jsx(Gt,{label:r,hasArrow:!0,...o,...o!=null&&o.placement?{placement:o.placement}:{placement:"top"},children:l.jsx(ho,{ref:t,role:n,"aria-checked":s!==void 0?s:void 0,...c})})});Ox.displayName="IAIIconButton";const se=y.memo(Ox);var s9=globalThis&&globalThis.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Bt=globalThis&&globalThis.__assign||function(){return Bt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"u"?void 0:Number(r),maxHeight:typeof o>"u"?void 0:Number(o),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof c>"u"?void 0:Number(c)}},p9=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],Zg="__resizable_base__",zx=function(e){u9(t,e);function t(n){var r=e.call(this,n)||this;return r.ratio=1,r.resizable=null,r.parentLeft=0,r.parentTop=0,r.resizableLeft=0,r.resizableRight=0,r.resizableTop=0,r.resizableBottom=0,r.targetLeft=0,r.targetTop=0,r.appendBase=function(){if(!r.resizable||!r.window)return null;var o=r.parentNode;if(!o)return null;var s=r.window.document.createElement("div");return s.style.width="100%",s.style.height="100%",s.style.position="absolute",s.style.transform="scale(0, 0)",s.style.left="0",s.style.flex="0 0 100%",s.classList?s.classList.add(Zg):s.className+=Zg,o.appendChild(s),s},r.removeBase=function(o){var s=r.parentNode;s&&s.removeChild(o)},r.ref=function(o){o&&(r.resizable=o)},r.state={isResizing:!1,width:typeof(r.propsSize&&r.propsSize.width)>"u"?"auto":r.propsSize&&r.propsSize.width,height:typeof(r.propsSize&&r.propsSize.height)>"u"?"auto":r.propsSize&&r.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},r.onResizeStart=r.onResizeStart.bind(r),r.onMouseMove=r.onMouseMove.bind(r),r.onMouseUp=r.onMouseUp.bind(r),r}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||d9},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var o=this.resizable.offsetWidth,s=this.resizable.offsetHeight,c=this.resizable.style.position;c!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:o,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=c}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,o=function(u){if(typeof n.state[u]>"u"||n.state[u]==="auto")return"auto";if(n.propsSize&&n.propsSize[u]&&n.propsSize[u].toString().endsWith("%")){if(n.state[u].toString().endsWith("%"))return n.state[u].toString();var f=n.getParentSize(),h=Number(n.state[u].toString().replace("px","")),m=h/f[u]*100;return m+"%"}return Nd(n.state[u])},s=r&&typeof r.width<"u"&&!this.state.isResizing?Nd(r.width):o("width"),c=r&&typeof r.height<"u"&&!this.state.isResizing?Nd(r.height):o("height");return{width:s,height:c}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var r=!1,o=this.parentNode.style.flexWrap;o!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var s={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=o),this.removeBase(n),s},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,r){var o=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof o>"u"||o==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var o=this.props.boundsByDirection,s=this.state.direction,c=o&&Ti("left",s),u=o&&Ti("top",s),f,h;if(this.props.bounds==="parent"){var m=this.parentNode;m&&(f=c?this.resizableRight-this.parentLeft:m.offsetWidth+(this.parentLeft-this.resizableLeft),h=u?this.resizableBottom-this.parentTop:m.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(f=c?this.resizableRight:this.window.innerWidth-this.resizableLeft,h=u?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(f=c?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),h=u?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return f&&Number.isFinite(f)&&(n=n&&n"u"?10:s.width,v=typeof o.width>"u"||o.width<0?n:o.width,x=typeof s.height>"u"?10:s.height,S=typeof o.height>"u"||o.height<0?r:o.height,C=f||0,j=h||0;if(u){var w=(x-C)*this.ratio+j,k=(S-C)*this.ratio+j,M=(m-j)/this.ratio+C,P=(v-j)/this.ratio+C,I=Math.max(m,w),T=Math.min(v,k),_=Math.max(x,M),D=Math.min(S,P);n=Tl(n,I,T),r=Tl(r,_,D)}else n=Tl(n,m,v),r=Tl(r,x,S);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){if(this.props.bounds==="parent"){var n=this.parentNode;if(n){var r=n.getBoundingClientRect();this.parentLeft=r.left,this.parentTop=r.top}}if(this.props.bounds&&typeof this.props.bounds!="string"){var o=this.props.bounds.getBoundingClientRect();this.targetLeft=o.left,this.targetTop=o.top}if(this.resizable){var s=this.resizable.getBoundingClientRect(),c=s.left,u=s.top,f=s.right,h=s.bottom;this.resizableLeft=c,this.resizableRight=f,this.resizableTop=u,this.resizableBottom=h}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var o=0,s=0;if(n.nativeEvent&&f9(n.nativeEvent)?(o=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&_l(n.nativeEvent)&&(o=n.nativeEvent.touches[0].clientX,s=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var c=this.props.onResizeStart(n,r,this.resizable);if(c===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var u,f=this.window.getComputedStyle(this.resizable);if(f.flexBasis!=="auto"){var h=this.parentNode;if(h){var m=this.window.getComputedStyle(h).flexDirection;this.flexDir=m.startsWith("row")?"row":"column",u=f.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var v={original:{x:o,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:yr(yr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:u};this.setState(v)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&_l(n))try{n.preventDefault(),n.stopPropagation()}catch{}var o=this.props,s=o.maxWidth,c=o.maxHeight,u=o.minWidth,f=o.minHeight,h=_l(n)?n.touches[0].clientX:n.clientX,m=_l(n)?n.touches[0].clientY:n.clientY,v=this.state,x=v.direction,S=v.original,C=v.width,j=v.height,w=this.getParentSize(),k=h9(w,this.window.innerWidth,this.window.innerHeight,s,c,u,f);s=k.maxWidth,c=k.maxHeight,u=k.minWidth,f=k.minHeight;var M=this.calculateNewSizeFromDirection(h,m),P=M.newHeight,I=M.newWidth,T=this.calculateNewMaxFromBoundary(s,c);this.props.snap&&this.props.snap.x&&(I=Qg(I,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(P=Qg(P,this.props.snap.y,this.props.snapGap));var _=this.calculateNewSizeFromAspectRatio(I,P,{width:T.maxWidth,height:T.maxHeight},{width:u,height:f});if(I=_.newWidth,P=_.newHeight,this.props.grid){var D=Xg(I,this.props.grid[0]),z=Xg(P,this.props.grid[1]),W=this.props.snapGap||0;I=W===0||Math.abs(D-I)<=W?D:I,P=W===0||Math.abs(z-P)<=W?z:P}var F={width:I-S.width,height:P-S.height};if(C&&typeof C=="string"){if(C.endsWith("%")){var B=I/w.width*100;I=B+"%"}else if(C.endsWith("vw")){var Q=I/this.window.innerWidth*100;I=Q+"vw"}else if(C.endsWith("vh")){var U=I/this.window.innerHeight*100;I=U+"vh"}}if(j&&typeof j=="string"){if(j.endsWith("%")){var B=P/w.height*100;P=B+"%"}else if(j.endsWith("vw")){var Q=P/this.window.innerWidth*100;P=Q+"vw"}else if(j.endsWith("vh")){var U=P/this.window.innerHeight*100;P=U+"vh"}}var X={width:this.createSizeForCssProperty(I,"width"),height:this.createSizeForCssProperty(P,"height")};this.flexDir==="row"?X.flexBasis=X.width:this.flexDir==="column"&&(X.flexBasis=X.height),VS.flushSync(function(){r.setState(X)}),this.props.onResize&&this.props.onResize(n,x,this.resizable,F)}},t.prototype.onMouseUp=function(n){var r=this.state,o=r.isResizing,s=r.direction,c=r.original;if(!(!o||!this.resizable)){var u={width:this.size.width-c.width,height:this.size.height-c.height};this.props.onResizeStop&&this.props.onResizeStop(n,s,this.resizable,u),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:yr(yr({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){this.setState({width:n.width,height:n.height})},t.prototype.renderResizer=function(){var n=this,r=this.props,o=r.enable,s=r.handleStyles,c=r.handleClasses,u=r.handleWrapperStyle,f=r.handleWrapperClass,h=r.handleComponent;if(!o)return null;var m=Object.keys(o).map(function(v){return o[v]!==!1?y.createElement(c9,{key:v,direction:v,onResizeStart:n.onResizeStart,replaceStyles:s&&s[v],className:c&&c[v]},h&&h[v]?h[v]:null):null});return y.createElement("div",{className:f,style:u},m)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(c,u){return p9.indexOf(u)!==-1||(c[u]=n.props[u]),c},{}),o=yr(yr(yr({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(o.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return y.createElement(s,yr({ref:this.ref,style:o,className:this.props.className},r),this.state.isResizing&&y.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(y.PureComponent),Rx={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Jg=Me.createContext&&Me.createContext(Rx),uo=globalThis&&globalThis.__assign||function(){return uo=Object.assign||function(e){for(var t,n=1,r=arguments.length;ne.system,G9=e=>e.system.toastQueue,qx=me(Et,e=>{const{model_list:t}=e,n=ee.reduce(t,(r,o,s)=>(o.status==="active"&&(r=s),r),"");return{...t[n],name:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),q9=me(Et,e=>{const{model_list:t}=e;return ee.pickBy(t,(r,o)=>{if(r.format==="diffusers")return{name:o,...r}})},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Y9=me(Et,e=>e.log,{memoizeOptions:{resultEqualityCheck:(e,t)=>e.length===t.length}}),K9=me(Et,e=>({shouldShowLogViewer:e.shouldShowLogViewer,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),X9=()=>{const e=Y(),{t}=K(),n=A(Y9),{shouldShowLogViewer:r,hasError:o,wasErrorSeen:s}=A(K9),[c,u]=y.useState(!0),f=y.useRef(null);y.useLayoutEffect(()=>{f.current!==null&&c&&(f.current.scrollTop=f.current.scrollHeight)},[c,n,r]);const h=()=>{e(w1()),e(dd(!r))};de("`",()=>{e(dd(!r))},[r]),de("esc",()=>{e(dd(!1))});const m=()=>{f.current&&c&&f.current.scrollTop{const{timestamp:S,message:C,level:j}=v,w=j==="info"?"base":j;return l.jsxs(L,{sx:{gap:2,color:`${w}.300`},children:[l.jsxs(Ce,{fontWeight:"600",children:[S,":"]}),l.jsx(Ce,{wordBreak:"break-all",children:C})]},x)})})}),r&&l.jsx(Gt,{hasArrow:!0,label:c?"Autoscroll On":"Autoscroll Off",children:l.jsx(se,{size:"sm","aria-label":t("accessibility.toggleAutoscroll"),icon:l.jsx(x9,{}),onClick:()=>u(!c),isChecked:c,sx:{position:"fixed",insetInlineStart:2,bottom:12,zIndex:"10000"}})}),l.jsx(Gt,{hasArrow:!0,label:r?"Hide Console":"Show Console",children:l.jsx(se,{size:"sm","aria-label":t("accessibility.toggleLogViewer"),icon:r?l.jsx(z9,{}):l.jsx(Bx,{}),onClick:h,sx:{position:"fixed",insetInlineStart:2,bottom:2,zIndex:"10000"},colorScheme:o||!s?"error":"base"})})]})},Q9="0px",Yx="calc(70px + 1rem)",dc=1.5,Z9=`calc(100vw - ${Q9})`,J9=`calc(100vh - ${dc*4}px)`,eP=`calc(100vh - ${Yx})`,tP=`calc(100vh - (${Yx} + 4.4rem))`,n0=384,nP=me(Et,e=>({isProcessing:e.isProcessing,currentStep:e.currentStep,totalSteps:e.totalSteps,currentStatusHasSteps:e.currentStatusHasSteps}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),rP=()=>{const{t:e}=K(),{isProcessing:t,currentStep:n,totalSteps:r,currentStatusHasSteps:o}=A(nP),s=n?Math.round(n*100/r):0;return l.jsx(Zy,{value:s,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:t&&!o,height:dc,zIndex:99})};function oP(e){const{title:t,hotkey:n,description:r}=e;return l.jsxs(ir,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[l.jsxs(ir,{children:[l.jsx(Ce,{fontWeight:600,children:t}),r&&l.jsx(Ce,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),l.jsx(Ye,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function iP({children:e}){const{isOpen:t,onOpen:n,onClose:r}=po(),{t:o}=K(),s=[{title:o("hotkeys.invoke.title"),desc:o("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:o("hotkeys.cancel.title"),desc:o("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:o("hotkeys.focusPrompt.title"),desc:o("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:o("hotkeys.toggleOptions.title"),desc:o("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:o("hotkeys.pinOptions.title"),desc:o("hotkeys.pinOptions.desc"),hotkey:"Shift+O"},{title:o("hotkeys.toggleViewer.title"),desc:o("hotkeys.toggleViewer.desc"),hotkey:"Z"},{title:o("hotkeys.toggleGallery.title"),desc:o("hotkeys.toggleGallery.desc"),hotkey:"G"},{title:o("hotkeys.maximizeWorkSpace.title"),desc:o("hotkeys.maximizeWorkSpace.desc"),hotkey:"F"},{title:o("hotkeys.changeTabs.title"),desc:o("hotkeys.changeTabs.desc"),hotkey:"1-5"},{title:o("hotkeys.consoleToggle.title"),desc:o("hotkeys.consoleToggle.desc"),hotkey:"`"}],c=[{title:o("hotkeys.setPrompt.title"),desc:o("hotkeys.setPrompt.desc"),hotkey:"P"},{title:o("hotkeys.setSeed.title"),desc:o("hotkeys.setSeed.desc"),hotkey:"S"},{title:o("hotkeys.setParameters.title"),desc:o("hotkeys.setParameters.desc"),hotkey:"A"},{title:o("hotkeys.restoreFaces.title"),desc:o("hotkeys.restoreFaces.desc"),hotkey:"Shift+R"},{title:o("hotkeys.upscale.title"),desc:o("hotkeys.upscale.desc"),hotkey:"Shift+U"},{title:o("hotkeys.showInfo.title"),desc:o("hotkeys.showInfo.desc"),hotkey:"I"},{title:o("hotkeys.sendToImageToImage.title"),desc:o("hotkeys.sendToImageToImage.desc"),hotkey:"Shift+I"},{title:o("hotkeys.deleteImage.title"),desc:o("hotkeys.deleteImage.desc"),hotkey:"Del"},{title:o("hotkeys.closePanels.title"),desc:o("hotkeys.closePanels.desc"),hotkey:"Esc"}],u=[{title:o("hotkeys.previousImage.title"),desc:o("hotkeys.previousImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextImage.title"),desc:o("hotkeys.nextImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.toggleGalleryPin.title"),desc:o("hotkeys.toggleGalleryPin.desc"),hotkey:"Shift+G"},{title:o("hotkeys.increaseGalleryThumbSize.title"),desc:o("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys.decreaseGalleryThumbSize.title"),desc:o("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],f=[{title:o("hotkeys.selectBrush.title"),desc:o("hotkeys.selectBrush.desc"),hotkey:"B"},{title:o("hotkeys.selectEraser.title"),desc:o("hotkeys.selectEraser.desc"),hotkey:"E"},{title:o("hotkeys.decreaseBrushSize.title"),desc:o("hotkeys.decreaseBrushSize.desc"),hotkey:"["},{title:o("hotkeys.increaseBrushSize.title"),desc:o("hotkeys.increaseBrushSize.desc"),hotkey:"]"},{title:o("hotkeys.decreaseBrushOpacity.title"),desc:o("hotkeys.decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:o("hotkeys.increaseBrushOpacity.title"),desc:o("hotkeys.increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:o("hotkeys.moveTool.title"),desc:o("hotkeys.moveTool.desc"),hotkey:"V"},{title:o("hotkeys.fillBoundingBox.title"),desc:o("hotkeys.fillBoundingBox.desc"),hotkey:"Shift + F"},{title:o("hotkeys.eraseBoundingBox.title"),desc:o("hotkeys.eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:o("hotkeys.colorPicker.title"),desc:o("hotkeys.colorPicker.desc"),hotkey:"C"},{title:o("hotkeys.toggleSnap.title"),desc:o("hotkeys.toggleSnap.desc"),hotkey:"N"},{title:o("hotkeys.quickToggleMove.title"),desc:o("hotkeys.quickToggleMove.desc"),hotkey:"Hold Space"},{title:o("hotkeys.toggleLayer.title"),desc:o("hotkeys.toggleLayer.desc"),hotkey:"Q"},{title:o("hotkeys.clearMask.title"),desc:o("hotkeys.clearMask.desc"),hotkey:"Shift+C"},{title:o("hotkeys.hideMask.title"),desc:o("hotkeys.hideMask.desc"),hotkey:"H"},{title:o("hotkeys.showHideBoundingBox.title"),desc:o("hotkeys.showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:o("hotkeys.mergeVisible.title"),desc:o("hotkeys.mergeVisible.desc"),hotkey:"Shift+M"},{title:o("hotkeys.saveToGallery.title"),desc:o("hotkeys.saveToGallery.desc"),hotkey:"Shift+S"},{title:o("hotkeys.copyToClipboard.title"),desc:o("hotkeys.copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:o("hotkeys.downloadImage.title"),desc:o("hotkeys.downloadImage.desc"),hotkey:"Shift+D"},{title:o("hotkeys.undoStroke.title"),desc:o("hotkeys.undoStroke.desc"),hotkey:"Ctrl+Z"},{title:o("hotkeys.redoStroke.title"),desc:o("hotkeys.redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:o("hotkeys.resetView.title"),desc:o("hotkeys.resetView.desc"),hotkey:"R"},{title:o("hotkeys.previousStagingImage.title"),desc:o("hotkeys.previousStagingImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextStagingImage.title"),desc:o("hotkeys.nextStagingImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.acceptStagingImage.title"),desc:o("hotkeys.acceptStagingImage.desc"),hotkey:"Enter"}],h=m=>l.jsx(L,{flexDir:"column",gap:4,children:m.map((v,x)=>l.jsxs(L,{flexDir:"column",px:2,gap:4,children:[l.jsx(oP,{title:v.title,description:v.desc,hotkey:v.hotkey}),x{const{children:n,tooltip:r="",tooltipProps:o,isChecked:s,...c}=e;return l.jsx(Gt,{label:r,...o,children:l.jsx(ni,{ref:t,"aria-checked":s,...c,children:n})})}),Je=y.memo(aP),sP=e=>{const{label:t="",isDisabled:n=!1,isInvalid:r,formControlProps:o,...s}=e;return l.jsxs(rt,{isInvalid:r,isDisabled:n,...o,children:[t!==""&&l.jsx(st,{children:t}),l.jsx(bh,{...s})]})},mt=y.memo(sP),r0=/^-?(0\.)?\.?$/,lP=e=>{const{label:t,isDisabled:n=!1,showStepper:r=!0,isInvalid:o,value:s,onChange:c,min:u,max:f,isInteger:h=!0,formControlProps:m,formLabelProps:v,numberInputFieldProps:x,numberInputStepperProps:S,tooltipProps:C,...j}=e,[w,k]=y.useState(String(s));y.useEffect(()=>{!w.match(r0)&&s!==Number(w)&&k(String(s))},[s,w]);const M=I=>{k(I),I.match(r0)||c(h?Math.floor(Number(I)):Number(I))},P=I=>{const T=ee.clamp(h?Math.floor(Number(I.target.value)):Number(I.target.value),u,f);k(String(T)),c(T)};return l.jsx(Gt,{...C,children:l.jsxs(rt,{isDisabled:n,isInvalid:o,...m,children:[t&&l.jsx(st,{...v,children:t}),l.jsxs(Nh,{value:w,min:u,max:f,keepWithinRange:!0,clampValueOnBlur:!1,onChange:M,onBlur:P,...j,children:[l.jsx(Lh,{...x}),r&&l.jsxs(Fh,{children:[l.jsx(Hh,{...S}),l.jsx(Bh,{...S})]})]})]})})},Vr=y.memo(lP);var o0=Array.isArray,i0=Object.keys,cP=Object.prototype.hasOwnProperty,uP=typeof Element<"u";function Ff(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var n=o0(e),r=o0(t),o,s,c;if(n&&r){if(s=e.length,s!=t.length)return!1;for(o=s;o--!==0;)if(!Ff(e[o],t[o]))return!1;return!0}if(n!=r)return!1;var u=e instanceof Date,f=t instanceof Date;if(u!=f)return!1;if(u&&f)return e.getTime()==t.getTime();var h=e instanceof RegExp,m=t instanceof RegExp;if(h!=m)return!1;if(h&&m)return e.toString()==t.toString();var v=i0(e);if(s=v.length,s!==i0(t).length)return!1;for(o=s;o--!==0;)if(!cP.call(t,v[o]))return!1;if(uP&&e instanceof Element&&t instanceof Element)return e===t;for(o=s;o--!==0;)if(c=v[o],!(c==="_owner"&&e.$$typeof)&&!Ff(e[c],t[c]))return!1;return!0}return e!==e&&t!==t}var ao=function(t,n){try{return Ff(t,n)}catch(r){if(r.message&&r.message.match(/stack|recursion/i)||r.number===-2146828260)return console.warn("Warning: react-fast-compare does not handle circular references.",r.name,r.message),!1;throw r}},dP=function(t){return fP(t)&&!hP(t)};function fP(e){return!!e&&typeof e=="object"}function hP(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||vP(e)}var pP=typeof Symbol=="function"&&Symbol.for,mP=pP?Symbol.for("react.element"):60103;function vP(e){return e.$$typeof===mP}function gP(e){return Array.isArray(e)?[]:{}}function fc(e,t){return t.clone!==!1&&t.isMergeableObject(e)?Ja(gP(e),e,t):e}function yP(e,t,n){return e.concat(t).map(function(r){return fc(r,n)})}function xP(e,t,n){var r={};return n.isMergeableObject(e)&&Object.keys(e).forEach(function(o){r[o]=fc(e[o],n)}),Object.keys(t).forEach(function(o){!n.isMergeableObject(t[o])||!e[o]?r[o]=fc(t[o],n):r[o]=Ja(e[o],t[o],n)}),r}function Ja(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||yP,n.isMergeableObject=n.isMergeableObject||dP;var r=Array.isArray(t),o=Array.isArray(e),s=r===o;return s?r?n.arrayMerge(e,t,n):xP(e,t,n):fc(t,n)}Ja.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return Ja(r,o,n)},{})};var Lf=Ja,bP=typeof global=="object"&&global&&global.Object===Object&&global;const Kx=bP;var SP=typeof self=="object"&&self&&self.Object===Object&&self,CP=Kx||SP||Function("return this")();const Ir=CP;var wP=Ir.Symbol;const go=wP;var Xx=Object.prototype,jP=Xx.hasOwnProperty,kP=Xx.toString,Da=go?go.toStringTag:void 0;function EP(e){var t=jP.call(e,Da),n=e[Da];try{e[Da]=void 0;var r=!0}catch{}var o=kP.call(e);return r&&(t?e[Da]=n:delete e[Da]),o}var PP=Object.prototype,IP=PP.toString;function MP(e){return IP.call(e)}var TP="[object Null]",_P="[object Undefined]",a0=go?go.toStringTag:void 0;function oi(e){return e==null?e===void 0?_P:TP:a0&&a0 in Object(e)?EP(e):MP(e)}function Qx(e,t){return function(n){return e(t(n))}}var DP=Qx(Object.getPrototypeOf,Object);const tp=DP;function ii(e){return e!=null&&typeof e=="object"}var AP="[object Object]",OP=Function.prototype,zP=Object.prototype,Zx=OP.toString,RP=zP.hasOwnProperty,NP=Zx.call(Object);function s0(e){if(!ii(e)||oi(e)!=AP)return!1;var t=tp(e);if(t===null)return!0;var n=RP.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Zx.call(n)==NP}function FP(){this.__data__=[],this.size=0}function Jx(e,t){return e===t||e!==e&&t!==t}function Nc(e,t){for(var n=e.length;n--;)if(Jx(e[n][0],t))return n;return-1}var LP=Array.prototype,BP=LP.splice;function HP(e){var t=this.__data__,n=Nc(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():BP.call(t,n,1),--this.size,!0}function WP(e){var t=this.__data__,n=Nc(t,e);return n<0?void 0:t[n][1]}function VP(e){return Nc(this.__data__,e)>-1}function UP(e,t){var n=this.__data__,r=Nc(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Gr(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=QI}var ZI="[object Arguments]",JI="[object Array]",eM="[object Boolean]",tM="[object Date]",nM="[object Error]",rM="[object Function]",oM="[object Map]",iM="[object Number]",aM="[object Object]",sM="[object RegExp]",lM="[object Set]",cM="[object String]",uM="[object WeakMap]",dM="[object ArrayBuffer]",fM="[object DataView]",hM="[object Float32Array]",pM="[object Float64Array]",mM="[object Int8Array]",vM="[object Int16Array]",gM="[object Int32Array]",yM="[object Uint8Array]",xM="[object Uint8ClampedArray]",bM="[object Uint16Array]",SM="[object Uint32Array]",wt={};wt[hM]=wt[pM]=wt[mM]=wt[vM]=wt[gM]=wt[yM]=wt[xM]=wt[bM]=wt[SM]=!0;wt[ZI]=wt[JI]=wt[dM]=wt[eM]=wt[fM]=wt[tM]=wt[nM]=wt[rM]=wt[oM]=wt[iM]=wt[aM]=wt[sM]=wt[lM]=wt[cM]=wt[uM]=!1;function CM(e){return ii(e)&&ab(e.length)&&!!wt[oi(e)]}function np(e){return function(t){return e(t)}}var sb=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ba=sb&&typeof module=="object"&&module&&!module.nodeType&&module,wM=Ba&&Ba.exports===sb,Ld=wM&&Kx.process,jM=function(){try{var e=Ba&&Ba.require&&Ba.require("util").types;return e||Ld&&Ld.binding&&Ld.binding("util")}catch{}}();const Qi=jM;var h0=Qi&&Qi.isTypedArray,kM=h0?np(h0):CM;const EM=kM;var PM=Object.prototype,IM=PM.hasOwnProperty;function lb(e,t){var n=ys(e),r=!n&&WI(e),o=!n&&!r&&ib(e),s=!n&&!r&&!o&&EM(e),c=n||r||o||s,u=c?NI(e.length,String):[],f=u.length;for(var h in e)(t||IM.call(e,h))&&!(c&&(h=="length"||o&&(h=="offset"||h=="parent")||s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||XI(h,f)))&&u.push(h);return u}var MM=Object.prototype;function rp(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||MM;return e===n}var TM=Qx(Object.keys,Object);const _M=TM;var DM=Object.prototype,AM=DM.hasOwnProperty;function OM(e){if(!rp(e))return _M(e);var t=[];for(var n in Object(e))AM.call(e,n)&&n!="constructor"&&t.push(n);return t}function cb(e){return e!=null&&ab(e.length)&&!eb(e)}function op(e){return cb(e)?lb(e):OM(e)}function zM(e,t){return e&&Lc(t,op(t),e)}function RM(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var NM=Object.prototype,FM=NM.hasOwnProperty;function LM(e){if(!gs(e))return RM(e);var t=rp(e),n=[];for(var r in e)r=="constructor"&&(t||!FM.call(e,r))||n.push(r);return n}function ip(e){return cb(e)?lb(e,!0):LM(e)}function BM(e,t){return e&&Lc(t,ip(t),e)}var ub=typeof exports=="object"&&exports&&!exports.nodeType&&exports,p0=ub&&typeof module=="object"&&module&&!module.nodeType&&module,HM=p0&&p0.exports===ub,m0=HM?Ir.Buffer:void 0,v0=m0?m0.allocUnsafe:void 0;function WM(e,t){if(t)return e.slice();var n=e.length,r=v0?v0(n):new e.constructor(n);return e.copy(r),r}function db(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n=0)&&(n[o]=e[o]);return n}function D0(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var A0=function(t){return Array.isArray(t)&&t.length===0},jn=function(t){return typeof t=="function"},Bc=function(t){return t!==null&&typeof t=="object"},B_=function(t){return String(Math.floor(Number(t)))===t},Bd=function(t){return Object.prototype.toString.call(t)==="[object String]"},Cb=function(t){return y.Children.count(t)===0},Hd=function(t){return Bc(t)&&jn(t.then)};function en(e,t,n,r){r===void 0&&(r=0);for(var o=Sb(t);e&&r=0?[]:{}}}return(s===0?e:o)[c[s]]===n?e:(n===void 0?delete o[c[s]]:o[c[s]]=n,s===0&&n===void 0&&delete r[c[s]],r)}function wb(e,t,n,r){n===void 0&&(n=new WeakMap),r===void 0&&(r={});for(var o=0,s=Object.keys(e);o0?ue.map(function(je){return z(je,en(N,je))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(xe).then(function(je){return je.reduce(function(q,ae,Oe){return ae==="DO_NOT_DELETE_YOU_WILL_BE_FIRED"||ae&&(q=wr(q,ue[Oe],ae)),q},{})})},[z]),F=y.useCallback(function(N){return Promise.all([W(N),x.validationSchema?D(N):{},x.validate?_(N):{}]).then(function(ue){var xe=ue[0],je=ue[1],q=ue[2],ae=Lf.all([xe,je,q],{arrayMerge:G_});return ae})},[x.validate,x.validationSchema,W,_,D]),B=Bn(function(N){return N===void 0&&(N=I.values),T({type:"SET_ISVALIDATING",payload:!0}),F(N).then(function(ue){return k.current&&(T({type:"SET_ISVALIDATING",payload:!1}),T({type:"SET_ERRORS",payload:ue})),ue})});y.useEffect(function(){c&&k.current===!0&&ao(S.current,x.initialValues)&&B(S.current)},[c,B]);var Q=y.useCallback(function(N){var ue=N&&N.values?N.values:S.current,xe=N&&N.errors?N.errors:C.current?C.current:x.initialErrors||{},je=N&&N.touched?N.touched:j.current?j.current:x.initialTouched||{},q=N&&N.status?N.status:w.current?w.current:x.initialStatus;S.current=ue,C.current=xe,j.current=je,w.current=q;var ae=function(){T({type:"RESET_FORM",payload:{isSubmitting:!!N&&!!N.isSubmitting,errors:xe,touched:je,status:q,values:ue,isValidating:!!N&&!!N.isValidating,submitCount:N&&N.submitCount&&typeof N.submitCount=="number"?N.submitCount:0}})};if(x.onReset){var Oe=x.onReset(I.values,ve);Hd(Oe)?Oe.then(ae):ae()}else ae()},[x.initialErrors,x.initialStatus,x.initialTouched]);y.useEffect(function(){k.current===!0&&!ao(S.current,x.initialValues)&&(h&&(S.current=x.initialValues,Q()),c&&B(S.current))},[h,x.initialValues,Q,c,B]),y.useEffect(function(){h&&k.current===!0&&!ao(C.current,x.initialErrors)&&(C.current=x.initialErrors||No,T({type:"SET_ERRORS",payload:x.initialErrors||No}))},[h,x.initialErrors]),y.useEffect(function(){h&&k.current===!0&&!ao(j.current,x.initialTouched)&&(j.current=x.initialTouched||Al,T({type:"SET_TOUCHED",payload:x.initialTouched||Al}))},[h,x.initialTouched]),y.useEffect(function(){h&&k.current===!0&&!ao(w.current,x.initialStatus)&&(w.current=x.initialStatus,T({type:"SET_STATUS",payload:x.initialStatus}))},[h,x.initialStatus,x.initialTouched]);var U=Bn(function(N){if(M.current[N]&&jn(M.current[N].validate)){var ue=en(I.values,N),xe=M.current[N].validate(ue);return Hd(xe)?(T({type:"SET_ISVALIDATING",payload:!0}),xe.then(function(je){return je}).then(function(je){T({type:"SET_FIELD_ERROR",payload:{field:N,value:je}}),T({type:"SET_ISVALIDATING",payload:!1})})):(T({type:"SET_FIELD_ERROR",payload:{field:N,value:xe}}),Promise.resolve(xe))}else if(x.validationSchema)return T({type:"SET_ISVALIDATING",payload:!0}),D(I.values,N).then(function(je){return je}).then(function(je){T({type:"SET_FIELD_ERROR",payload:{field:N,value:je[N]}}),T({type:"SET_ISVALIDATING",payload:!1})});return Promise.resolve()}),X=y.useCallback(function(N,ue){var xe=ue.validate;M.current[N]={validate:xe}},[]),te=y.useCallback(function(N){delete M.current[N]},[]),re=Bn(function(N,ue){T({type:"SET_TOUCHED",payload:N});var xe=ue===void 0?o:ue;return xe?B(I.values):Promise.resolve()}),$=y.useCallback(function(N){T({type:"SET_ERRORS",payload:N})},[]),Z=Bn(function(N,ue){var xe=jn(N)?N(I.values):N;T({type:"SET_VALUES",payload:xe});var je=ue===void 0?n:ue;return je?B(xe):Promise.resolve()}),oe=y.useCallback(function(N,ue){T({type:"SET_FIELD_ERROR",payload:{field:N,value:ue}})},[]),le=Bn(function(N,ue,xe){T({type:"SET_FIELD_VALUE",payload:{field:N,value:ue}});var je=xe===void 0?n:xe;return je?B(wr(I.values,N,ue)):Promise.resolve()}),ze=y.useCallback(function(N,ue){var xe=ue,je=N,q;if(!Bd(N)){N.persist&&N.persist();var ae=N.target?N.target:N.currentTarget,Oe=ae.type,Ze=ae.name,J=ae.id,Le=ae.value,nt=ae.checked,Nt=ae.outerHTML,he=ae.options,_e=ae.multiple;xe=ue||Ze||J,je=/number|range/.test(Oe)?(q=parseFloat(Le),isNaN(q)?"":q):/checkbox/.test(Oe)?Y_(en(I.values,xe),nt,Le):he&&_e?q_(he):Le}xe&&le(xe,je)},[le,I.values]),Re=Bn(function(N){if(Bd(N))return function(ue){return ze(ue,N)};ze(N)}),Ie=Bn(function(N,ue,xe){ue===void 0&&(ue=!0),T({type:"SET_FIELD_TOUCHED",payload:{field:N,value:ue}});var je=xe===void 0?o:xe;return je?B(I.values):Promise.resolve()}),pe=y.useCallback(function(N,ue){N.persist&&N.persist();var xe=N.target,je=xe.name,q=xe.id,ae=xe.outerHTML,Oe=ue||je||q;Ie(Oe,!0)},[Ie]),ce=Bn(function(N){if(Bd(N))return function(ue){return pe(ue,N)};pe(N)}),Ne=y.useCallback(function(N){jn(N)?T({type:"SET_FORMIK_STATE",payload:N}):T({type:"SET_FORMIK_STATE",payload:function(){return N}})},[]),Ve=y.useCallback(function(N){T({type:"SET_STATUS",payload:N})},[]),Ue=y.useCallback(function(N){T({type:"SET_ISSUBMITTING",payload:N})},[]),$e=Bn(function(){return T({type:"SUBMIT_ATTEMPT"}),B().then(function(N){var ue=N instanceof Error,xe=!ue&&Object.keys(N).length===0;if(xe){var je;try{if(je=Te(),je===void 0)return}catch(q){throw q}return Promise.resolve(je).then(function(q){return k.current&&T({type:"SUBMIT_SUCCESS"}),q}).catch(function(q){if(k.current)throw T({type:"SUBMIT_FAILURE"}),q})}else if(k.current&&(T({type:"SUBMIT_FAILURE"}),ue))throw N})}),Qe=Bn(function(N){N&&N.preventDefault&&jn(N.preventDefault)&&N.preventDefault(),N&&N.stopPropagation&&jn(N.stopPropagation)&&N.stopPropagation(),$e().catch(function(ue){console.warn("Warning: An unhandled error was caught from submitForm()",ue)})}),ve={resetForm:Q,validateForm:B,validateField:U,setErrors:$,setFieldError:oe,setFieldTouched:Ie,setFieldValue:le,setStatus:Ve,setSubmitting:Ue,setTouched:re,setValues:Z,setFormikState:Ne,submitForm:$e},Te=Bn(function(){return m(I.values,ve)}),Ge=Bn(function(N){N&&N.preventDefault&&jn(N.preventDefault)&&N.preventDefault(),N&&N.stopPropagation&&jn(N.stopPropagation)&&N.stopPropagation(),Q()}),ye=y.useCallback(function(N){return{value:en(I.values,N),error:en(I.errors,N),touched:!!en(I.touched,N),initialValue:en(S.current,N),initialTouched:!!en(j.current,N),initialError:en(C.current,N)}},[I.errors,I.touched,I.values]),Pe=y.useCallback(function(N){return{setValue:function(xe,je){return le(N,xe,je)},setTouched:function(xe,je){return Ie(N,xe,je)},setError:function(xe){return oe(N,xe)}}},[le,Ie,oe]),et=y.useCallback(function(N){var ue=Bc(N),xe=ue?N.name:N,je=en(I.values,xe),q={name:xe,value:je,onChange:Re,onBlur:ce};if(ue){var ae=N.type,Oe=N.value,Ze=N.as,J=N.multiple;ae==="checkbox"?Oe===void 0?q.checked=!!je:(q.checked=!!(Array.isArray(je)&&~je.indexOf(Oe)),q.value=Oe):ae==="radio"?(q.checked=je===Oe,q.value=Oe):Ze==="select"&&J&&(q.value=q.value||[],q.multiple=!0)}return q},[ce,Re,I.values]),Be=y.useMemo(function(){return!ao(S.current,I.values)},[S.current,I.values]),vt=y.useMemo(function(){return typeof u<"u"?Be?I.errors&&Object.keys(I.errors).length===0:u!==!1&&jn(u)?u(x):u:I.errors&&Object.keys(I.errors).length===0},[u,Be,I.errors,x]),Rt=pt({},I,{initialValues:S.current,initialErrors:C.current,initialTouched:j.current,initialStatus:w.current,handleBlur:ce,handleChange:Re,handleReset:Ge,handleSubmit:Qe,resetForm:Q,setErrors:$,setFormikState:Ne,setFieldTouched:Ie,setFieldValue:le,setFieldError:oe,setStatus:Ve,setSubmitting:Ue,setTouched:re,setValues:Z,submitForm:$e,validateForm:B,validateField:U,isValid:vt,dirty:Be,unregisterField:te,registerField:X,getFieldProps:et,getFieldMeta:ye,getFieldHelpers:Pe,validateOnBlur:o,validateOnChange:n,validateOnMount:c});return Rt}function xs(e){var t=V_(e),n=e.component,r=e.children,o=e.render,s=e.innerRef;return y.useImperativeHandle(s,function(){return t}),y.createElement(H_,{value:t},n?y.createElement(n,t):o?o(t):r?jn(r)?r(t):Cb(r)?null:y.Children.only(r):null)}function U_(e){var t={};if(e.inner){if(e.inner.length===0)return wr(t,e.path,e.message);for(var o=e.inner,n=Array.isArray(o),r=0,o=n?o:o[Symbol.iterator]();;){var s;if(n){if(r>=o.length)break;s=o[r++]}else{if(r=o.next(),r.done)break;s=r.value}var c=s;en(t,c.path)||(t=wr(t,c.path,c.message))}}return t}function $_(e,t,n,r){n===void 0&&(n=!1),r===void 0&&(r={});var o=Uf(e);return t[n?"validateSync":"validate"](o,{abortEarly:!1,context:r})}function Uf(e){var t=Array.isArray(e)?[]:{};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=String(n);Array.isArray(e[r])===!0?t[r]=e[r].map(function(o){return Array.isArray(o)===!0||s0(o)?Uf(o):o!==""?o:void 0}):s0(e[r])?t[r]=Uf(e[r]):t[r]=e[r]!==""?e[r]:void 0}return t}function G_(e,t,n){var r=e.slice();return t.forEach(function(s,c){if(typeof r[c]>"u"){var u=n.clone!==!1,f=u&&n.isMergeableObject(s);r[c]=f?Lf(Array.isArray(s)?[]:{},s,n):s}else n.isMergeableObject(s)?r[c]=Lf(e[c],s,n):e.indexOf(s)===-1&&r.push(s)}),r}function q_(e){return Array.from(e).filter(function(t){return t.selected}).map(function(t){return t.value})}function Y_(e,t,n){if(typeof e=="boolean")return Boolean(t);var r=[],o=!1,s=-1;if(Array.isArray(e))r=e,s=e.indexOf(n),o=s>=0;else if(!n||n=="true"||n=="false")return Boolean(t);return t&&n&&!o?r.concat(n):o?r.slice(0,s).concat(r.slice(s+1)):r}var K_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?y.useLayoutEffect:y.useEffect;function Bn(e){var t=y.useRef(e);return K_(function(){t.current=e}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;or?o:r},0);return Array.from(pt({},t,{length:n+1}))}else return[]},eD=function(e){L_(t,e);function t(r){var o;return o=e.call(this,r)||this,o.updateArrayField=function(s,c,u){var f=o.props,h=f.name,m=f.formik.setFormikState;m(function(v){var x=typeof u=="function"?u:s,S=typeof c=="function"?c:s,C=wr(v.values,h,s(en(v.values,h))),j=u?x(en(v.errors,h)):void 0,w=c?S(en(v.touched,h)):void 0;return A0(j)&&(j=void 0),A0(w)&&(w=void 0),pt({},v,{values:C,errors:u?wr(v.errors,h,j):v.errors,touched:c?wr(v.touched,h,w):v.touched})})},o.push=function(s){return o.updateArrayField(function(c){return[].concat(Zi(c),[F_(s)])},!1,!1)},o.handlePush=function(s){return function(){return o.push(s)}},o.swap=function(s,c){return o.updateArrayField(function(u){return Z_(u,s,c)},!0,!0)},o.handleSwap=function(s,c){return function(){return o.swap(s,c)}},o.move=function(s,c){return o.updateArrayField(function(u){return Q_(u,s,c)},!0,!0)},o.handleMove=function(s,c){return function(){return o.move(s,c)}},o.insert=function(s,c){return o.updateArrayField(function(u){return Wd(u,s,c)},function(u){return Wd(u,s,null)},function(u){return Wd(u,s,null)})},o.handleInsert=function(s,c){return function(){return o.insert(s,c)}},o.replace=function(s,c){return o.updateArrayField(function(u){return J_(u,s,c)},!1,!1)},o.handleReplace=function(s,c){return function(){return o.replace(s,c)}},o.unshift=function(s){var c=-1;return o.updateArrayField(function(u){var f=u?[s].concat(u):[s];return c<0&&(c=f.length),f},function(u){var f=u?[null].concat(u):[null];return c<0&&(c=f.length),f},function(u){var f=u?[null].concat(u):[null];return c<0&&(c=f.length),f}),c},o.handleUnshift=function(s){return function(){return o.unshift(s)}},o.handleRemove=function(s){return function(){return o.remove(s)}},o.handlePop=function(){return function(){return o.pop()}},o.remove=o.remove.bind(D0(o)),o.pop=o.pop.bind(D0(o)),o}var n=t.prototype;return n.componentDidUpdate=function(o){this.props.validateOnChange&&this.props.formik.validateOnChange&&!ao(en(o.formik.values,o.name),en(this.props.formik.values,this.props.name))&&this.props.formik.validateForm(this.props.formik.values)},n.remove=function(o){var s;return this.updateArrayField(function(c){var u=c?Zi(c):[];return s||(s=u[o]),jn(u.splice)&&u.splice(o,1),u},!0,!0),s},n.pop=function(){var o;return this.updateArrayField(function(s){var c=s;return o||(o=c&&c.pop&&c.pop()),c},!0,!0),o},n.render=function(){var o={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},s=this.props,c=s.component,u=s.render,f=s.children,h=s.name,m=s.formik,v=Vo(m,["validate","validationSchema"]),x=pt({},o,{form:v,name:h});return c?y.createElement(c,x):u?u(x):f?typeof f=="function"?f(x):Cb(f)?null:y.Children.only(f):null},t}(y.Component);eD.defaultProps={validateOnChange:!0};const tD=fe((e,t)=>{const{t:n}=K(),{acceptButtonText:r=n("common.accept"),acceptCallback:o,cancelButtonText:s=n("common.cancel"),cancelCallback:c,children:u,title:f,triggerComponent:h}=e,{isOpen:m,onOpen:v,onClose:x}=po(),S=y.useRef(null),C=()=>{o(),x()},j=()=>{c&&c(),x()};return l.jsxs(l.Fragment,{children:[y.cloneElement(h,{onClick:v,ref:t}),l.jsx(qy,{isOpen:m,leastDestructiveRef:S,onClose:x,isCentered:!0,children:l.jsx(Hr,{children:l.jsxs(Yy,{children:[l.jsx(Br,{fontSize:"lg",fontWeight:"bold",children:f}),l.jsx(Wr,{children:u}),l.jsxs(Lr,{children:[l.jsx(Je,{ref:S,onClick:j,children:s}),l.jsx(Je,{colorScheme:"error",onClick:C,ml:3,children:r})]})]})})})]})}),Wc=y.memo(tD);function nD(e){const{model:t}=e,r=A(C=>C.system.model_list)[t],o=Y(),{t:s}=K(),c=A(C=>C.system.isProcessing),u=A(C=>C.system.isConnected),[f,h]=y.useState("same"),[m,v]=y.useState("");y.useEffect(()=>{h("same")},[t]);const x=()=>{h("same")},S=()=>{o(US({model_name:t,save_location:f,custom_location:f==="custom"&&m!==""?m:null}))};return l.jsxs(Wc,{title:`${s("modelManager.convert")} ${t}`,acceptCallback:S,cancelCallback:x,acceptButtonText:`${s("modelManager.convert")}`,triggerComponent:l.jsxs(Je,{size:"sm","aria-label":s("modelManager.convertToDiffusers"),isDisabled:r.status==="active"||c||!u,className:" modal-close-btn",marginInlineEnd:8,children:["🧨 ",s("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[l.jsxs(L,{flexDirection:"column",rowGap:4,children:[l.jsx(Ce,{children:s("modelManager.convertToDiffusersHelpText1")}),l.jsxs(my,{children:[l.jsx(Ra,{children:s("modelManager.convertToDiffusersHelpText2")}),l.jsx(Ra,{children:s("modelManager.convertToDiffusersHelpText3")}),l.jsx(Ra,{children:s("modelManager.convertToDiffusersHelpText4")}),l.jsx(Ra,{children:s("modelManager.convertToDiffusersHelpText5")})]}),l.jsx(Ce,{children:s("modelManager.convertToDiffusersHelpText6")})]}),l.jsxs(L,{flexDir:"column",gap:4,children:[l.jsxs(L,{marginTop:4,flexDir:"column",gap:2,children:[l.jsx(Ce,{fontWeight:"600",children:s("modelManager.convertToDiffusersSaveLocation")}),l.jsx(Qa,{value:f,onChange:C=>h(C),children:l.jsxs(L,{gap:4,children:[l.jsx(vn,{value:"same",children:l.jsx(Gt,{label:"Save converted model in the same folder",children:s("modelManager.sameFolder")})}),l.jsx(vn,{value:"root",children:l.jsx(Gt,{label:"Save converted model in the InvokeAI root folder",children:s("modelManager.invokeRoot")})}),l.jsx(vn,{value:"custom",children:l.jsx(Gt,{label:"Save converted model in a custom folder",children:s("modelManager.custom")})})]})})]}),f==="custom"&&l.jsxs(L,{flexDirection:"column",rowGap:2,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:s("modelManager.customSaveLocation")}),l.jsx(mt,{value:m,onChange:C=>{C.target.value!==""&&v(C.target.value)},width:"full"})]})]})]})}function tr(e){const{children:t,...n}=e;return l.jsx(pn,{margin:0,color:"base.400",...n,children:t})}function nr(e){const{children:t,...n}=e;return l.jsx(mn,{color:"error.400",...n,children:t})}const bs=ne.form,rD=me([Et],e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),O0=64,z0=2048;function oD(){const{openModel:e,model_list:t}=A(rD),n=A(f=>f.system.isProcessing),r=Y(),{t:o}=K(),[s,c]=y.useState({name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,default:!1,format:"ckpt"});y.useEffect(()=>{var f,h,m,v,x,S,C;if(e){const j=ee.pickBy(t,(w,k)=>ee.isEqual(k,e));c({name:e,description:(f=j[e])==null?void 0:f.description,config:(h=j[e])==null?void 0:h.config,weights:(m=j[e])==null?void 0:m.weights,vae:(v=j[e])==null?void 0:v.vae,width:(x=j[e])==null?void 0:x.width,height:(S=j[e])==null?void 0:S.height,default:(C=j[e])==null?void 0:C.default,format:"ckpt"})}},[t,e]);const u=f=>{r(os({...f,width:Number(f.width),height:Number(f.height)}))};return e?l.jsxs(L,{flexDirection:"column",rowGap:4,width:"100%",children:[l.jsxs(L,{alignItems:"center",gap:4,justifyContent:"space-between",children:[l.jsx(Ce,{fontSize:"lg",fontWeight:"bold",children:e}),l.jsx(nD,{model:e})]}),l.jsx(L,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",paddingInlineEnd:8,children:l.jsx(xs,{enableReinitialize:!0,initialValues:s,onSubmit:u,children:({handleSubmit:f,errors:h,touched:m})=>l.jsx(bs,{onSubmit:f,children:l.jsxs(Fe,{rowGap:2,alignItems:"start",children:[l.jsxs(rt,{isInvalid:!!h.description&&m.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:o("modelManager.description")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),h.description&&m.description?l.jsx(nr,{children:h.description}):l.jsx(tr,{children:o("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.config&&m.config,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:o("modelManager.config")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"config",name:"config",type:"text",width:"full"}),h.config&&m.config?l.jsx(nr,{children:h.config}):l.jsx(tr,{children:o("modelManager.configValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.weights&&m.weights,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:o("modelManager.modelLocation")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"weights",name:"weights",type:"text",width:"full"}),h.weights&&m.weights?l.jsx(nr,{children:h.weights}):l.jsx(tr,{children:o("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.vae&&m.vae,children:[l.jsx(st,{htmlFor:"vae",fontSize:"sm",children:o("modelManager.vaeLocation")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae",name:"vae",type:"text",width:"full"}),h.vae&&m.vae?l.jsx(nr,{children:h.vae}):l.jsx(tr,{children:o("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(oa,{width:"100%",children:[l.jsxs(rt,{isInvalid:!!h.width&&m.width,children:[l.jsx(st,{htmlFor:"width",fontSize:"sm",children:o("modelManager.width")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{id:"width",name:"width",children:({field:v,form:x})=>l.jsx(Vr,{id:"width",name:"width",min:O0,max:z0,step:64,value:x.values.width,onChange:S=>x.setFieldValue(v.name,Number(S))})}),h.width&&m.width?l.jsx(nr,{children:h.width}):l.jsx(tr,{children:o("modelManager.widthValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.height&&m.height,children:[l.jsx(st,{htmlFor:"height",fontSize:"sm",children:o("modelManager.height")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{id:"height",name:"height",children:({field:v,form:x})=>l.jsx(Vr,{id:"height",name:"height",min:O0,max:z0,step:64,value:x.values.height,onChange:S=>x.setFieldValue(v.name,Number(S))})}),h.height&&m.height?l.jsx(nr,{children:h.height}):l.jsx(tr,{children:o("modelManager.heightValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:o("modelManager.updateModel")})]})})})})]}):l.jsx(L,{sx:{width:"100%",justifyContent:"center",alignItems:"center",borderRadius:"base",bg:"base.900"},children:l.jsx(Ce,{fontWeight:500,children:"Pick A Model To Edit"})})}const iD=me([Et],e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function aD(){const{openModel:e,model_list:t}=A(iD),n=A(f=>f.system.isProcessing),r=Y(),{t:o}=K(),[s,c]=y.useState({name:"",description:"",repo_id:"",path:"",vae:{repo_id:"",path:""},default:!1,format:"diffusers"});y.useEffect(()=>{var f,h,m,v,x,S,C,j,w,k,M,P,I,T,_,D;if(e){const z=ee.pickBy(t,(W,F)=>ee.isEqual(F,e));c({name:e,description:(f=z[e])==null?void 0:f.description,path:(h=z[e])!=null&&h.path&&((m=z[e])==null?void 0:m.path)!=="None"?(v=z[e])==null?void 0:v.path:"",repo_id:(x=z[e])!=null&&x.repo_id&&((S=z[e])==null?void 0:S.repo_id)!=="None"?(C=z[e])==null?void 0:C.repo_id:"",vae:{repo_id:(w=(j=z[e])==null?void 0:j.vae)!=null&&w.repo_id?(M=(k=z[e])==null?void 0:k.vae)==null?void 0:M.repo_id:"",path:(I=(P=z[e])==null?void 0:P.vae)!=null&&I.path?(_=(T=z[e])==null?void 0:T.vae)==null?void 0:_.path:""},default:(D=z[e])==null?void 0:D.default,format:"diffusers"})}},[t,e]);const u=f=>{const h=f;f.path===""&&delete h.path,f.repo_id===""&&delete h.repo_id,f.vae.path===""&&delete h.vae.path,f.vae.repo_id===""&&delete h.vae.repo_id,r(os(f))};return e?l.jsxs(L,{flexDirection:"column",rowGap:4,width:"100%",children:[l.jsx(L,{alignItems:"center",children:l.jsx(Ce,{fontSize:"lg",fontWeight:"bold",children:e})}),l.jsx(L,{flexDirection:"column",overflowY:"scroll",paddingInlineEnd:8,children:l.jsx(xs,{enableReinitialize:!0,initialValues:s,onSubmit:u,children:({handleSubmit:f,errors:h,touched:m})=>{var v,x,S,C,j,w,k,M,P,I;return l.jsx(bs,{onSubmit:f,children:l.jsxs(Fe,{rowGap:2,alignItems:"start",children:[l.jsxs(rt,{isInvalid:!!h.description&&m.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:o("modelManager.description")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),h.description&&m.description?l.jsx(nr,{children:h.description}):l.jsx(tr,{children:o("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.path&&m.path,isRequired:!0,children:[l.jsx(st,{htmlFor:"path",fontSize:"sm",children:o("modelManager.modelLocation")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"path",name:"path",type:"text",width:"full"}),h.path&&m.path?l.jsx(nr,{children:h.path}):l.jsx(tr,{children:o("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.repo_id&&m.repo_id,children:[l.jsx(st,{htmlFor:"repo_id",fontSize:"sm",children:o("modelManager.repo_id")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"repo_id",name:"repo_id",type:"text",width:"full"}),h.repo_id&&m.repo_id?l.jsx(nr,{children:h.repo_id}):l.jsx(tr,{children:o("modelManager.repoIDValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((v=h.vae)!=null&&v.path)&&((x=m.vae)==null?void 0:x.path),children:[l.jsx(st,{htmlFor:"vae.path",fontSize:"sm",children:o("modelManager.vaeLocation")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.path",name:"vae.path",type:"text",width:"full"}),(S=h.vae)!=null&&S.path&&((C=m.vae)!=null&&C.path)?l.jsx(nr,{children:(j=h.vae)==null?void 0:j.path}):l.jsx(tr,{children:o("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((w=h.vae)!=null&&w.repo_id)&&((k=m.vae)==null?void 0:k.repo_id),children:[l.jsx(st,{htmlFor:"vae.repo_id",fontSize:"sm",children:o("modelManager.vaeRepoID")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"full"}),(M=h.vae)!=null&&M.repo_id&&((P=m.vae)!=null&&P.repo_id)?l.jsx(nr,{children:(I=h.vae)==null?void 0:I.repo_id}):l.jsx(tr,{children:o("modelManager.vaeRepoIDValidationMsg")})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:o("modelManager.updateModel")})]})})}})})]}):l.jsx(L,{sx:{width:"100%",justifyContent:"center",alignItems:"center",borderRadius:"base",bg:"base.900"},children:l.jsx(Ce,{fontWeight:"500",children:"Pick A Model To Edit"})})}const sD=e=>{const{label:t,...n}=e;return l.jsx(k2,{colorScheme:"accent",...n,children:t})},ft=y.memo(sD),kb=me([Et],e=>{const{model_list:t}=e,n=[];return ee.forEach(t,r=>{n.push(r.weights)}),n});function R0({model:e,modelsToAdd:t,setModelsToAdd:n}){const{t:r}=K(),o=A(kb),s=c=>{t.includes(c.target.value)?n(ee.remove(t,u=>u!==c.target.value)):n([...t,c.target.value])};return l.jsxs(L,{flexDirection:"column",gap:2,backgroundColor:t.includes(e.name)?"accent.650":"base.800",paddingX:4,paddingY:2,borderRadius:4,children:[l.jsxs(L,{gap:4,alignItems:"center",justifyContent:"space-between",children:[l.jsx(ft,{value:e.name,label:l.jsx(Ce,{fontWeight:500,children:e.name}),isChecked:t.includes(e.name),isDisabled:o.includes(e.location),onChange:s}),o.includes(e.location)&&l.jsx(xy,{colorScheme:"accent",children:r("modelManager.modelExists")})]}),l.jsx(Ce,{fontStyle:"italic",variant:"subtext",children:e.location})]})}function lD(){const e=Y(),{t}=K(),n=A(P=>P.system.searchFolder),r=A(P=>P.system.foundModels),o=A(kb),s=A(P=>P.ui.shouldShowExistingModelsInSearch),c=A(P=>P.system.isProcessing),[u,f]=Me.useState([]),[h,m]=Me.useState("v1"),[v,x]=Me.useState(""),S=()=>{e(GS(null)),e(qS(null)),f([])},C=P=>{e(Pv(P.checkpointFolder))},j=()=>{f([]),r&&r.forEach(P=>{o.includes(P.location)||f(I=>[...I,P.name])})},w=()=>{f([])},k=()=>{const P=r==null?void 0:r.filter(T=>u.includes(T.name)),I={v1:"configs/stable-diffusion/v1-inference.yaml",v2_base:"configs/stable-diffusion/v2-inference-v.yaml",v2_768:"configs/stable-diffusion/v2-inference-v.yaml",inpainting:"configs/stable-diffusion/v1-inpainting-inference.yaml",custom:v};P==null||P.forEach(T=>{const _={name:T.name,description:"",config:I[h],weights:T.location,vae:"",width:512,height:512,default:!1,format:"ckpt"};e(os(_))}),f([])},M=()=>{const P=[],I=[];return r&&r.forEach((T,_)=>{o.includes(T.location)?I.push(l.jsx(R0,{model:T,modelsToAdd:u,setModelsToAdd:f},_)):P.push(l.jsx(R0,{model:T,modelsToAdd:u,setModelsToAdd:f},_))}),l.jsxs(L,{flexDirection:"column",rowGap:4,children:[P,s&&I]})};return l.jsxs(l.Fragment,{children:[n?l.jsxs(L,{sx:{padding:4,gap:2,position:"relative",borderRadius:"base",alignItems:"center",w:"full",bg:"base.900"},children:[l.jsxs(L,{sx:{flexDir:"column",gap:2},children:[l.jsx(Ce,{sx:{fontWeight:500},variant:"subtext",children:t("modelManager.checkpointFolder")}),l.jsx(Ce,{sx:{fontWeight:500},children:n})]}),l.jsx(kc,{}),l.jsx(se,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:l.jsx(e0,{}),fontSize:18,disabled:c,onClick:()=>e(Pv(n))}),l.jsx(se,{"aria-label":t("modelManager.clearCheckpointFolder"),tooltip:t("modelManager.clearCheckpointFolder"),icon:l.jsx(So,{}),onClick:S})]}):l.jsx(xs,{initialValues:{checkpointFolder:""},onSubmit:P=>{C(P)},children:({handleSubmit:P})=>l.jsx(bs,{onSubmit:P,width:"100%",children:l.jsxs(oa,{columnGap:2,alignItems:"flex-end",children:[l.jsx(rt,{flexGrow:1,children:l.jsx(jt,{as:mt,id:"checkpointFolder",name:"checkpointFolder",type:"text",size:"md",label:t("modelManager.checkpointFolder")})}),l.jsx(Je,{leftIcon:l.jsx(e0,{}),"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),type:"submit",disabled:c,px:8,children:t("modelManager.findModels")})]})})}),r&&l.jsxs(L,{flexDirection:"column",rowGap:4,width:"full",children:[l.jsxs(L,{justifyContent:"space-between",alignItems:"center",children:[l.jsxs("p",{children:[t("modelManager.modelsFound"),": ",r.length]}),l.jsxs("p",{children:[t("modelManager.selected"),": ",u.length]})]}),l.jsxs(L,{columnGap:2,justifyContent:"space-between",children:[l.jsxs(L,{columnGap:2,children:[l.jsx(Je,{isDisabled:u.length===r.length,onClick:j,children:t("modelManager.selectAll")}),l.jsx(Je,{isDisabled:u.length===0,onClick:w,children:t("modelManager.deselectAll")}),l.jsx(ft,{label:t("modelManager.showExisting"),isChecked:s,onChange:()=>e($S(!s))})]}),l.jsx(Je,{isDisabled:u.length===0,onClick:k,colorScheme:"accent",children:t("modelManager.addSelected")})]}),l.jsxs(L,{sx:{flexDirection:"column",padding:4,rowGap:4,borderRadius:"base",width:"full",bg:"base.900"},children:[l.jsxs(L,{gap:4,children:[l.jsx(Ce,{fontWeight:500,variant:"subtext",children:t("modelManager.pickModelType")}),l.jsx(Qa,{value:h,onChange:P=>m(P),defaultValue:"v1",name:"model_type",children:l.jsxs(L,{gap:4,children:[l.jsx(vn,{value:"v1",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v1")})}),l.jsx(vn,{value:"v2_base",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v2_base")})}),l.jsx(vn,{value:"v2_768",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v2_768")})}),l.jsx(vn,{value:"inpainting",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.inpainting")})}),l.jsx(vn,{value:"custom",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.customConfig")})})]})})]}),h==="custom"&&l.jsxs(L,{flexDirection:"column",rowGap:2,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:t("modelManager.pathToCustomConfig")}),l.jsx(mt,{value:v,onChange:P=>{P.target.value!==""&&x(P.target.value)},width:"full"})]})]}),l.jsx(L,{flexDirection:"column",maxHeight:72,overflowY:"scroll",borderRadius:"sm",gap:2,children:r.length>0?M():l.jsx(Ce,{fontWeight:"500",padding:2,borderRadius:"sm",textAlign:"center",variant:"subtext",children:t("modelManager.noModelsFound")})})]})]})}function er({children:e}){return l.jsx(L,{sx:{flexDirection:"column",padding:4,rowGap:4,borderRadius:"base",width:"full",bg:"base.900"},children:e})}const N0=64,F0=2048;function cD(){const e=Y(),{t}=K(),n=A(h=>h.system.isProcessing);function r(h){return/\s/.test(h)}function o(h){let m;return r(h)&&(m=t("modelManager.cannotUseSpaces")),m}const s={name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,format:"ckpt",default:!1},c=h=>{e(os(h)),e(Di(null))},[u,f]=Me.useState(!1);return l.jsxs(Fe,{gap:2,alignItems:"flex-start",children:[l.jsxs(L,{columnGap:4,children:[l.jsx(ft,{isChecked:!u,label:t("modelManager.scanForModels"),onChange:()=>f(!u)}),l.jsx(ft,{label:t("modelManager.addManually"),isChecked:u,onChange:()=>f(!u)})]}),u?l.jsx(xs,{initialValues:s,onSubmit:c,children:({handleSubmit:h,errors:m,touched:v})=>l.jsx(bs,{onSubmit:h,sx:{w:"full"},children:l.jsxs(Fe,{rowGap:2,children:[l.jsx(Ce,{fontSize:20,fontWeight:"bold",alignSelf:"start",children:t("modelManager.manual")}),l.jsx(er,{children:l.jsxs(rt,{isInvalid:!!m.name&&v.name,isRequired:!0,children:[l.jsx(st,{htmlFor:"name",fontSize:"sm",children:t("modelManager.name")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"name",name:"name",type:"text",validate:o,width:"full"}),m.name&&v.name?l.jsx(mn,{children:m.name}):l.jsx(pn,{margin:0,children:t("modelManager.nameValidationMsg")})]})]})}),l.jsx(er,{children:l.jsxs(rt,{isInvalid:!!m.description&&v.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:t("modelManager.description")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),m.description&&v.description?l.jsx(mn,{children:m.description}):l.jsx(pn,{margin:0,children:t("modelManager.descriptionValidationMsg")})]})]})}),l.jsx(er,{children:l.jsxs(rt,{isInvalid:!!m.config&&v.config,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:t("modelManager.config")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"config",name:"config",type:"text",width:"full"}),m.config&&v.config?l.jsx(mn,{children:m.config}):l.jsx(pn,{margin:0,children:t("modelManager.configValidationMsg")})]})]})}),l.jsx(er,{children:l.jsxs(rt,{isInvalid:!!m.weights&&v.weights,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:t("modelManager.modelLocation")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"weights",name:"weights",type:"text",width:"full"}),m.weights&&v.weights?l.jsx(mn,{children:m.weights}):l.jsx(pn,{margin:0,children:t("modelManager.modelLocationValidationMsg")})]})]})}),l.jsx(er,{children:l.jsxs(rt,{isInvalid:!!m.vae&&v.vae,children:[l.jsx(st,{htmlFor:"vae",fontSize:"sm",children:t("modelManager.vaeLocation")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae",name:"vae",type:"text",width:"full"}),m.vae&&v.vae?l.jsx(mn,{children:m.vae}):l.jsx(pn,{margin:0,children:t("modelManager.vaeLocationValidationMsg")})]})]})}),l.jsxs(oa,{width:"100%",children:[l.jsx(er,{children:l.jsxs(rt,{isInvalid:!!m.width&&v.width,children:[l.jsx(st,{htmlFor:"width",fontSize:"sm",children:t("modelManager.width")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{id:"width",name:"width",children:({field:x,form:S})=>l.jsx(Vr,{id:"width",name:"width",min:N0,max:F0,step:64,value:S.values.width,onChange:C=>S.setFieldValue(x.name,Number(C))})}),m.width&&v.width?l.jsx(mn,{children:m.width}):l.jsx(pn,{margin:0,children:t("modelManager.widthValidationMsg")})]})]})}),l.jsx(er,{children:l.jsxs(rt,{isInvalid:!!m.height&&v.height,children:[l.jsx(st,{htmlFor:"height",fontSize:"sm",children:t("modelManager.height")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{id:"height",name:"height",children:({field:x,form:S})=>l.jsx(Vr,{id:"height",name:"height",min:N0,max:F0,step:64,value:S.values.height,onChange:C=>S.setFieldValue(x.name,Number(C))})}),m.height&&v.height?l.jsx(mn,{children:m.height}):l.jsx(pn,{margin:0,children:t("modelManager.heightValidationMsg")})]})]})})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:t("modelManager.addModel")})]})})}):l.jsx(lD,{})]})}function uD(){const e=Y(),{t}=K(),n=A(u=>u.system.isProcessing);function r(u){return/\s/.test(u)}function o(u){let f;return r(u)&&(f=t("modelManager.cannotUseSpaces")),f}const s={name:"",description:"",repo_id:"",path:"",format:"diffusers",default:!1,vae:{repo_id:"",path:""}},c=u=>{const f=u;u.path===""&&delete f.path,u.repo_id===""&&delete f.repo_id,u.vae.path===""&&delete f.vae.path,u.vae.repo_id===""&&delete f.vae.repo_id,e(os(f)),e(Di(null))};return l.jsx(L,{children:l.jsx(xs,{initialValues:s,onSubmit:c,children:({handleSubmit:u,errors:f,touched:h})=>{var m,v,x,S,C,j,w,k,M,P;return l.jsx(bs,{onSubmit:u,children:l.jsxs(Fe,{rowGap:2,children:[l.jsx(er,{children:l.jsxs(rt,{isInvalid:!!f.name&&h.name,isRequired:!0,children:[l.jsx(st,{htmlFor:"name",fontSize:"sm",children:t("modelManager.name")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"name",name:"name",type:"text",validate:o,width:"2xl",isRequired:!0}),f.name&&h.name?l.jsx(mn,{children:f.name}):l.jsx(pn,{margin:0,children:t("modelManager.nameValidationMsg")})]})]})}),l.jsx(er,{children:l.jsxs(rt,{isInvalid:!!f.description&&h.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:t("modelManager.description")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"2xl",isRequired:!0}),f.description&&h.description?l.jsx(mn,{children:f.description}):l.jsx(pn,{margin:0,children:t("modelManager.descriptionValidationMsg")})]})]})}),l.jsxs(er,{children:[l.jsx(Ce,{fontWeight:"bold",fontSize:"sm",children:t("modelManager.formMessageDiffusersModelLocation")}),l.jsx(Ce,{sx:{fontSize:"sm",fontStyle:"italic"},variant:"subtext",children:t("modelManager.formMessageDiffusersModelLocationDesc")}),l.jsxs(rt,{isInvalid:!!f.path&&h.path,children:[l.jsx(st,{htmlFor:"path",fontSize:"sm",children:t("modelManager.modelLocation")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"path",name:"path",type:"text",width:"2xl"}),f.path&&h.path?l.jsx(mn,{children:f.path}):l.jsx(pn,{margin:0,children:t("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!f.repo_id&&h.repo_id,children:[l.jsx(st,{htmlFor:"repo_id",fontSize:"sm",children:t("modelManager.repo_id")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"repo_id",name:"repo_id",type:"text",width:"2xl"}),f.repo_id&&h.repo_id?l.jsx(mn,{children:f.repo_id}):l.jsx(pn,{margin:0,children:t("modelManager.repoIDValidationMsg")})]})]})]}),l.jsxs(er,{children:[l.jsx(Ce,{fontWeight:"bold",children:t("modelManager.formMessageDiffusersVAELocation")}),l.jsx(Ce,{sx:{fontSize:"sm",fontStyle:"italic"},variant:"subtext",children:t("modelManager.formMessageDiffusersVAELocationDesc")}),l.jsxs(rt,{isInvalid:!!((m=f.vae)!=null&&m.path)&&((v=h.vae)==null?void 0:v.path),children:[l.jsx(st,{htmlFor:"vae.path",fontSize:"sm",children:t("modelManager.vaeLocation")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.path",name:"vae.path",type:"text",width:"2xl"}),(x=f.vae)!=null&&x.path&&((S=h.vae)!=null&&S.path)?l.jsx(mn,{children:(C=f.vae)==null?void 0:C.path}):l.jsx(pn,{margin:0,children:t("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((j=f.vae)!=null&&j.repo_id)&&((w=h.vae)==null?void 0:w.repo_id),children:[l.jsx(st,{htmlFor:"vae.repo_id",fontSize:"sm",children:t("modelManager.vaeRepoID")}),l.jsxs(Fe,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"2xl"}),(k=f.vae)!=null&&k.repo_id&&((M=h.vae)!=null&&M.repo_id)?l.jsx(mn,{children:(P=f.vae)==null?void 0:P.repo_id}):l.jsx(pn,{margin:0,children:t("modelManager.vaeRepoIDValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",isLoading:n,children:t("modelManager.addModel")})]})})}})})}function L0({text:e,onClick:t}){return l.jsx(L,{position:"relative",width:"50%",height:40,justifyContent:"center",alignItems:"center",onClick:t,as:ni,children:l.jsx(Ce,{fontWeight:"bold",children:e})})}function dD(){const{isOpen:e,onOpen:t,onClose:n}=po(),r=A(u=>u.ui.addNewModelUIOption),o=Y(),{t:s}=K(),c=()=>{n(),o(Di(null))};return l.jsxs(l.Fragment,{children:[l.jsx(Je,{"aria-label":s("modelManager.addNewModel"),tooltip:s("modelManager.addNewModel"),onClick:t,size:"sm",children:l.jsxs(L,{columnGap:2,alignItems:"center",children:[l.jsx(zc,{}),s("modelManager.addNew")]})}),l.jsxs(mo,{isOpen:e,onClose:c,size:"3xl",closeOnOverlayClick:!1,children:[l.jsx(Hr,{}),l.jsxs(vo,{margin:"auto",children:[l.jsxs(Br,{children:[s("modelManager.addNewModel")," "]}),r!==null&&l.jsx(se,{"aria-label":s("common.back"),tooltip:s("common.back"),onClick:()=>o(Di(null)),position:"absolute",variant:"ghost",zIndex:1,size:"sm",insetInlineEnd:12,top:2,icon:l.jsx(Fx,{})}),l.jsx(aa,{}),l.jsxs(Wr,{children:[r==null&&l.jsxs(L,{columnGap:4,children:[l.jsx(L0,{text:s("modelManager.addCheckpointModel"),onClick:()=>o(Di("ckpt"))}),l.jsx(L0,{text:s("modelManager.addDiffuserModel"),onClick:()=>o(Di("diffusers"))})]}),r=="ckpt"&&l.jsx(cD,{}),r=="diffusers"&&l.jsx(uD,{})]}),l.jsx(Lr,{})]})]})]})}var fD=eh({displayName:"EditIcon",path:l.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})}),Eb=eh({displayName:"ExternalLinkIcon",path:l.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[l.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),l.jsx("path",{d:"M15 3h6v6"}),l.jsx("path",{d:"M10 14L21 3"})]})}),hD=eh({displayName:"DeleteIcon",path:l.jsx("g",{fill:"currentColor",children:l.jsx("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})});function Ol(e){const{isProcessing:t,isConnected:n}=A(S=>S.system),r=A(S=>S.system.openModel),{t:o}=K(),s=Y(),{name:c,status:u,description:f}=e,h=()=>{s(j1(c))},m=()=>{s(Iv(c))},v=()=>{s(YS(c)),s(Iv(null))},x=()=>{switch(u){case"active":return"ok.500";case"cached":return"warning.500";case"not loaded":return"inherit"}};return l.jsxs(L,{alignItems:"center",p:2,borderRadius:"base",sx:c===r?{bg:"accent.750",_hover:{bg:"accent.750"}}:{_hover:{bg:"base.750"}},children:[l.jsx(Ye,{onClick:m,cursor:"pointer",children:l.jsx(Gt,{label:f,hasArrow:!0,placement:"bottom",children:l.jsx(Ce,{fontWeight:"600",children:c})})}),l.jsx(kc,{onClick:m,cursor:"pointer"}),l.jsxs(L,{gap:2,alignItems:"center",children:[l.jsx(Ce,{color:x(),children:u}),l.jsx(ni,{size:"sm",onClick:h,isDisabled:u==="active"||t||!n,children:o("modelManager.load")}),l.jsx(se,{icon:l.jsx(fD,{}),size:"sm",onClick:m,"aria-label":o("accessibility.modifyConfig"),isDisabled:u==="active"||t||!n}),l.jsx(Wc,{title:o("modelManager.deleteModel"),acceptCallback:v,acceptButtonText:o("modelManager.delete"),triggerComponent:l.jsx(se,{icon:l.jsx(hD,{}),size:"sm","aria-label":o("modelManager.deleteConfig"),isDisabled:u==="active"||t||!n,colorScheme:"error"}),children:l.jsxs(L,{rowGap:4,flexDirection:"column",children:[l.jsx("p",{style:{fontWeight:"bold"},children:o("modelManager.deleteMsg1")}),l.jsx("p",{children:o("modelManager.deleteMsg2")})]})})]})]})}function B0(e){const{children:t,value:n}=e,[r,o]=k1("colors",["base.800","base.200"]);return l.jsx("option",{value:n,style:{background:r,color:o},children:t})}const pD=e=>{const{label:t,isDisabled:n,validValues:r,tooltip:o,tooltipProps:s,...c}=e;return l.jsxs(rt,{isDisabled:n,onClick:u=>{u.stopPropagation(),u.nativeEvent.stopImmediatePropagation(),u.nativeEvent.stopPropagation(),u.nativeEvent.cancelBubble=!0},children:[t&&l.jsx(st,{children:t}),l.jsx(Gt,{label:o,...s,children:l.jsx(tx,{...c,children:r.map(u=>typeof u=="string"||typeof u=="number"?l.jsx(B0,{value:u,children:u},u):l.jsx(B0,{value:u.value,children:u.key},u.value))})})]})},Mn=y.memo(pD);function mD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M19.002 3h-14c-1.103 0-2 .897-2 2v4h2V5h14v14h-14v-4h-2v4c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2V5c0-1.103-.898-2-2-2z"}},{tag:"path",attr:{d:"m11 16 5-4-5-4v3.001H3v2h8z"}}]})(e)}function Pb(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 16c1.671 0 3-1.331 3-3s-1.329-3-3-3-3 1.331-3 3 1.329 3 3 3z"}},{tag:"path",attr:{d:"M20.817 11.186a8.94 8.94 0 0 0-1.355-3.219 9.053 9.053 0 0 0-2.43-2.43 8.95 8.95 0 0 0-3.219-1.355 9.028 9.028 0 0 0-1.838-.18V2L8 5l3.975 3V6.002c.484-.002.968.044 1.435.14a6.961 6.961 0 0 1 2.502 1.053 7.005 7.005 0 0 1 1.892 1.892A6.967 6.967 0 0 1 19 13a7.032 7.032 0 0 1-.55 2.725 7.11 7.11 0 0 1-.644 1.188 7.2 7.2 0 0 1-.858 1.039 7.028 7.028 0 0 1-3.536 1.907 7.13 7.13 0 0 1-2.822 0 6.961 6.961 0 0 1-2.503-1.054 7.002 7.002 0 0 1-1.89-1.89A6.996 6.996 0 0 1 5 13H3a9.02 9.02 0 0 0 1.539 5.034 9.096 9.096 0 0 0 2.428 2.428A8.95 8.95 0 0 0 12 22a9.09 9.09 0 0 0 1.814-.183 9.014 9.014 0 0 0 3.218-1.355 8.886 8.886 0 0 0 1.331-1.099 9.228 9.228 0 0 0 1.1-1.332A8.952 8.952 0 0 0 21 13a9.09 9.09 0 0 0-.183-1.814z"}}]})(e)}function vD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M6.758 8.758 5.344 7.344a8.048 8.048 0 0 0-1.841 2.859l1.873.701a6.048 6.048 0 0 1 1.382-2.146zM19 12.999a7.935 7.935 0 0 0-2.344-5.655A7.917 7.917 0 0 0 12 5.069V2L7 6l5 4V7.089a5.944 5.944 0 0 1 3.242 1.669A5.956 5.956 0 0 1 17 13v.002c0 .33-.033.655-.086.977-.007.043-.011.088-.019.131a6.053 6.053 0 0 1-1.138 2.536c-.16.209-.331.412-.516.597a5.954 5.954 0 0 1-.728.613 5.906 5.906 0 0 1-2.277 1.015c-.142.03-.285.05-.43.069-.062.009-.122.021-.184.027a6.104 6.104 0 0 1-1.898-.103L9.3 20.819a8.087 8.087 0 0 0 2.534.136c.069-.007.138-.021.207-.03.205-.026.409-.056.61-.098l.053-.009-.001-.005a7.877 7.877 0 0 0 2.136-.795l.001.001.028-.019a7.906 7.906 0 0 0 1.01-.67c.27-.209.532-.43.777-.675.248-.247.47-.513.681-.785.021-.028.049-.053.07-.081l-.006-.004a7.899 7.899 0 0 0 1.093-1.997l.008.003c.029-.078.05-.158.076-.237.037-.11.075-.221.107-.333.04-.14.073-.281.105-.423.022-.099.048-.195.066-.295.032-.171.056-.344.076-.516.01-.076.023-.15.03-.227.023-.249.037-.5.037-.753.002-.002.002-.004.002-.008zM6.197 16.597l-1.6 1.201a8.045 8.045 0 0 0 2.569 2.225l.961-1.754a6.018 6.018 0 0 1-1.93-1.672zM5 13c0-.145.005-.287.015-.429l-1.994-.143a7.977 7.977 0 0 0 .483 3.372l1.873-.701A5.975 5.975 0 0 1 5 13z"}}]})(e)}function gD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M16.242 17.242a6.04 6.04 0 0 1-1.37 1.027l.961 1.754a8.068 8.068 0 0 0 2.569-2.225l-1.6-1.201a5.938 5.938 0 0 1-.56.645zm1.743-4.671a5.975 5.975 0 0 1-.362 2.528l1.873.701a7.977 7.977 0 0 0 .483-3.371l-1.994.142zm1.512-2.368a8.048 8.048 0 0 0-1.841-2.859l-1.414 1.414a6.071 6.071 0 0 1 1.382 2.146l1.873-.701zm-8.128 8.763c-.047-.005-.094-.015-.141-.021a6.701 6.701 0 0 1-.468-.075 5.923 5.923 0 0 1-2.421-1.122 5.954 5.954 0 0 1-.583-.506 6.138 6.138 0 0 1-.516-.597 5.91 5.91 0 0 1-.891-1.634 6.086 6.086 0 0 1-.247-.902c-.008-.043-.012-.088-.019-.131A6.332 6.332 0 0 1 6 13.002V13c0-1.603.624-3.109 1.758-4.242A5.944 5.944 0 0 1 11 7.089V10l5-4-5-4v3.069a7.917 7.917 0 0 0-4.656 2.275A7.936 7.936 0 0 0 4 12.999v.009c0 .253.014.504.037.753.007.076.021.15.03.227.021.172.044.345.076.516.019.1.044.196.066.295.032.142.065.283.105.423.032.112.07.223.107.333.026.079.047.159.076.237l.008-.003A7.948 7.948 0 0 0 5.6 17.785l-.007.005c.021.028.049.053.07.081.211.272.433.538.681.785a8.236 8.236 0 0 0 .966.816c.265.192.537.372.821.529l.028.019.001-.001a7.877 7.877 0 0 0 2.136.795l-.001.005.053.009c.201.042.405.071.61.098.069.009.138.023.207.03a8.038 8.038 0 0 0 2.532-.137l-.424-1.955a6.11 6.11 0 0 1-1.904.102z"}}]})(e)}function yD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M11 6H9v3H6v2h3v3h2v-3h3V9h-3z"}},{tag:"path",attr:{d:"M10 2c-4.411 0-8 3.589-8 8s3.589 8 8 8a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8zm0 14c-3.309 0-6-2.691-6-6s2.691-6 6-6 6 2.691 6 6-2.691 6-6 6z"}}]})(e)}function xD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M6 9h8v2H6z"}},{tag:"path",attr:{d:"M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z"}}]})(e)}const bD=e=>{const[t,n]=y.useState(!1),{label:r,value:o,min:s=1,max:c=100,step:u=1,onChange:f,tooltipSuffix:h="",withSliderMarks:m=!1,withInput:v=!1,isInteger:x=!1,inputWidth:S=16,inputReadOnly:C=!1,withReset:j=!1,hideTooltip:w=!1,isCompact:k=!1,handleReset:M,isResetDisabled:P,isSliderDisabled:I,isInputDisabled:T,sliderFormControlProps:_,sliderFormLabelProps:D,sliderMarkProps:z,sliderTrackProps:W,sliderThumbProps:F,sliderNumberInputProps:B,sliderNumberInputFieldProps:Q,sliderNumberInputStepperProps:U,sliderTooltipProps:X,sliderIAIIconButtonProps:te,...re}=e,{t:$}=K(),[Z,oe]=y.useState(String(o));y.useEffect(()=>{oe(o)},[o]);const le=y.useMemo(()=>B!=null&&B.max?B.max:c,[c,B==null?void 0:B.max]),ze=ce=>{f(ce)},Re=ce=>{ce.target.value===""&&(ce.target.value=String(s));const Ne=ee.clamp(x?Math.floor(Number(ce.target.value)):Number(Z),s,le);f(Ne)},Ie=ce=>{oe(ce)},pe=()=>{M&&M()};return l.jsxs(rt,{sx:k?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},..._,children:[l.jsx(st,{...D,mb:-1,children:r}),l.jsxs(oa,{w:"100%",gap:2,alignItems:"center",children:[l.jsxs(ax,{"aria-label":r,value:o,min:s,max:c,step:u,onChange:ze,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),focusThumbOnChange:!1,isDisabled:I,...re,children:[m&&l.jsxs(l.Fragment,{children:[l.jsx(Tf,{value:s,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...z,children:s}),l.jsx(Tf,{value:c,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...z,children:c})]}),l.jsx(lx,{...W,children:l.jsx(cx,{})}),l.jsx(Gt,{hasArrow:!0,placement:"top",isOpen:t,label:`${o}${h}`,hidden:w,...X,children:l.jsx(sx,{...F})})]}),v&&l.jsxs(Nh,{min:s,max:le,step:u,value:Z,onChange:Ie,onBlur:Re,isDisabled:T,...B,children:[l.jsx(Lh,{readOnly:C,minWidth:S,...Q}),l.jsxs(Fh,{...U,children:[l.jsx(Hh,{onClick:()=>f(Number(Z))}),l.jsx(Bh,{onClick:()=>f(Number(Z))})]})]}),j&&l.jsx(se,{size:"sm","aria-label":$("accessibility.reset"),tooltip:"Reset",icon:l.jsx(Pb,{}),onClick:pe,isDisabled:P,...te})]})]})},ut=y.memo(bD);function SD(){const e=Y(),{isOpen:t,onOpen:n,onClose:r}=po(),o=A(q9),{t:s}=K(),[c,u]=y.useState(Object.keys(o)[0]),[f,h]=y.useState(Object.keys(o)[1]),[m,v]=y.useState("none"),[x,S]=y.useState(""),[C,j]=y.useState(.5),[w,k]=y.useState("weighted_sum"),[M,P]=y.useState("root"),[I,T]=y.useState(""),[_,D]=y.useState(!1),z=Object.keys(o).filter(U=>U!==f&&U!==m),W=Object.keys(o).filter(U=>U!==c&&U!==m),F=[{key:s("modelManager.none"),value:"none"},...Object.keys(o).filter(U=>U!==c&&U!==f).map(U=>({key:U,value:U}))],B=A(U=>U.system.isProcessing),Q=()=>{let U=[c,f,m];U=U.filter(te=>te!=="none");const X={models_to_merge:U,merged_model_name:x!==""?x:U.join("-"),alpha:C,interp:w,model_merge_save_path:M==="root"?null:I,force:_};e(KS(X))};return l.jsxs(l.Fragment,{children:[l.jsx(Je,{onClick:n,size:"sm",children:l.jsx(L,{columnGap:2,alignItems:"center",children:s("modelManager.mergeModels")})}),l.jsxs(mo,{isOpen:t,onClose:r,size:"4xl",closeOnOverlayClick:!1,children:[l.jsx(Hr,{}),l.jsxs(vo,{fontFamily:"Inter",margin:"auto",paddingInlineEnd:4,children:[l.jsx(Br,{children:s("modelManager.mergeModels")}),l.jsx(aa,{}),l.jsx(Wr,{children:l.jsxs(L,{flexDirection:"column",rowGap:4,children:[l.jsxs(L,{sx:{flexDirection:"column",marginBottom:4,padding:4,borderRadius:"base",rowGap:1,bg:"base.900"},children:[l.jsx(Ce,{children:s("modelManager.modelMergeHeaderHelp1")}),l.jsx(Ce,{fontSize:"sm",variant:"subtext",children:s("modelManager.modelMergeHeaderHelp2")})]}),l.jsxs(L,{columnGap:4,children:[l.jsx(Mn,{label:s("modelManager.modelOne"),validValues:z,onChange:U=>u(U.target.value)}),l.jsx(Mn,{label:s("modelManager.modelTwo"),validValues:W,onChange:U=>h(U.target.value)}),l.jsx(Mn,{label:s("modelManager.modelThree"),validValues:F,onChange:U=>{U.target.value!=="none"?(v(U.target.value),k("add_difference")):(v("none"),k("weighted_sum"))}})]}),l.jsx(mt,{label:s("modelManager.mergedModelName"),value:x,onChange:U=>S(U.target.value)}),l.jsxs(L,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsx(ut,{label:s("modelManager.alpha"),min:.01,max:.99,step:.01,value:C,onChange:U=>j(U),withInput:!0,withReset:!0,handleReset:()=>j(.5),withSliderMarks:!0}),l.jsx(Ce,{variant:"subtext",fontSize:"sm",children:s("modelManager.modelMergeAlphaHelp")})]}),l.jsxs(L,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsx(Ce,{fontWeight:500,fontSize:"sm",variant:"subtext",children:s("modelManager.interpolationType")}),l.jsx(Qa,{value:w,onChange:U=>k(U),children:l.jsx(L,{columnGap:4,children:m==="none"?l.jsxs(l.Fragment,{children:[l.jsx(vn,{value:"weighted_sum",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.weightedSum")})}),l.jsx(vn,{value:"sigmoid",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.sigmoid")})}),l.jsx(vn,{value:"inv_sigmoid",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.inverseSigmoid")})})]}):l.jsx(vn,{value:"add_difference",children:l.jsx(Gt,{label:s("modelManager.modelMergeInterpAddDifferenceHelp"),children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.addDifference")})})})})})]}),l.jsxs(L,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsxs(L,{columnGap:4,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:s("modelManager.mergedModelSaveLocation")}),l.jsx(Qa,{value:M,onChange:U=>P(U),children:l.jsxs(L,{columnGap:4,children:[l.jsx(vn,{value:"root",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.invokeAIFolder")})}),l.jsx(vn,{value:"custom",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.custom")})})]})})]}),M==="custom"&&l.jsx(mt,{label:s("modelManager.mergedModelCustomSaveLocation"),value:I,onChange:U=>T(U.target.value)})]}),l.jsx(ft,{label:s("modelManager.ignoreMismatch"),isChecked:_,onChange:U=>D(U.target.checked),fontWeight:"500"}),l.jsx(Je,{onClick:Q,isLoading:B,isDisabled:M==="custom"&&I==="",children:s("modelManager.merge")})]})}),l.jsx(Lr,{})]})]})]})}const CD=me(Et,e=>ee.map(e.model_list,(n,r)=>({name:r,...n})),{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function Vd({label:e,isActive:t,onClick:n}){return l.jsx(Je,{onClick:n,isActive:t,sx:{_active:{bg:"accent.750"}},size:"sm",children:e})}const wD=()=>{const e=A(CD),[t,n]=Me.useState(!1);Me.useEffect(()=>{const x=setTimeout(()=>{n(!0)},200);return()=>clearTimeout(x)},[]);const[r,o]=y.useState(""),[s,c]=y.useState("all"),[u,f]=y.useTransition(),{t:h}=K(),m=x=>{f(()=>{o(x.target.value)})},v=y.useMemo(()=>{const x=[],S=[],C=[],j=[];return e.forEach((w,k)=>{w.name.toLowerCase().includes(r.toLowerCase())&&(C.push(l.jsx(Ol,{name:w.name,status:w.status,description:w.description},k)),w.format===s&&j.push(l.jsx(Ol,{name:w.name,status:w.status,description:w.description},k))),w.format!=="diffusers"?x.push(l.jsx(Ol,{name:w.name,status:w.status,description:w.description},k)):S.push(l.jsx(Ol,{name:w.name,status:w.status,description:w.description},k))}),r!==""?s==="all"?l.jsx(Ye,{marginTop:4,children:C}):l.jsx(Ye,{marginTop:4,children:j}):l.jsxs(L,{flexDirection:"column",rowGap:6,children:[s==="all"&&l.jsxs(l.Fragment,{children:[l.jsxs(Ye,{children:[l.jsx(Ce,{sx:{fontWeight:"500",py:2,px:4,my:4,mx:0,borderRadius:"base",width:"max-content",fontSize:"sm",bg:"base.750"},children:h("modelManager.checkpointModels")}),x]}),l.jsxs(Ye,{children:[l.jsx(Ce,{sx:{fontWeight:"500",py:2,px:4,mb:4,borderRadius:"base",width:"max-content",fontSize:"sm",bg:"base.750"},children:h("modelManager.diffusersModels")}),S]})]}),s==="ckpt"&&l.jsx(L,{flexDirection:"column",marginTop:4,children:x}),s==="diffusers"&&l.jsx(L,{flexDirection:"column",marginTop:4,children:S})]})},[e,r,h,s]);return l.jsxs(L,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:[l.jsxs(L,{justifyContent:"space-between",alignItems:"center",gap:2,children:[l.jsx(Wn,{size:"md",children:h("modelManager.availableModels")}),l.jsx(kc,{}),l.jsx(dD,{}),l.jsx(SD,{})]}),l.jsx(mt,{onChange:m,label:h("modelManager.search")}),l.jsxs(L,{flexDirection:"column",gap:1,maxHeight:window.innerHeight-240,overflow:"scroll",paddingInlineEnd:4,children:[l.jsxs(L,{columnGap:2,children:[l.jsx(Vd,{label:h("modelManager.allModels"),onClick:()=>c("all"),isActive:s==="all"}),l.jsx(Vd,{label:h("modelManager.checkpointModels"),onClick:()=>c("ckpt"),isActive:s==="ckpt"}),l.jsx(Vd,{label:h("modelManager.diffusersModels"),onClick:()=>c("diffusers"),isActive:s==="diffusers"})]}),t?v:l.jsx(L,{width:"100%",minHeight:96,justifyContent:"center",alignItems:"center",children:l.jsx(yc,{})})]})]})};function jD({children:e}){const{isOpen:t,onOpen:n,onClose:r}=po(),o=A(u=>u.system.model_list),s=A(u=>u.system.openModel),{t:c}=K();return l.jsxs(l.Fragment,{children:[y.cloneElement(e,{onClick:n}),l.jsxs(mo,{isOpen:t,onClose:r,size:"full",children:[l.jsx(Hr,{}),l.jsxs(vo,{children:[l.jsx(aa,{}),l.jsx(Br,{children:c("modelManager.modelManager")}),l.jsx(Wr,{children:l.jsxs(L,{width:"100%",columnGap:8,children:[l.jsx(wD,{}),s&&o[s].format==="diffusers"?l.jsx(aD,{}):l.jsx(oD,{})]})}),l.jsx(Lr,{})]})]})]})}const kD=me([Et],e=>{const{isProcessing:t,model_list:n}=e;return{models:ee.map(n,(o,s)=>s),isProcessing:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),ED=()=>{const e=Y(),{t}=K(),{models:n,isProcessing:r}=A(kD),o=A(qx),s=c=>{e(j1(c.target.value))};return l.jsx(L,{style:{paddingInlineStart:1.5},children:l.jsx(Mn,{style:{fontSize:"sm"},"aria-label":t("accessibility.modelSelect"),tooltip:o.description,isDisabled:r,value:o.name,validValues:n,onChange:s})})},PD=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,...c}=e;return l.jsxs(rt,{isDisabled:n,width:r,display:"flex",gap:4,alignItems:"center",justifyContent:"space-between",...o,children:[l.jsx(st,{my:1,...s,children:t}),l.jsx(ux,{...c})]})},En=y.memo(PD),ID=me([Et,Pr],(e,t)=>{const{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:o,model_list:s,saveIntermediatesInterval:c,enableImageDebugging:u}=e,{shouldUseCanvasBetaLayout:f,shouldUseSliders:h}=t;return{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:o,models:ee.map(s,(m,v)=>v),saveIntermediatesInterval:c,enableImageDebugging:u,shouldUseCanvasBetaLayout:f,shouldUseSliders:h}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Ud={flexDirection:"column",gap:2,p:4,bg:"base.900"},MD=({children:e})=>{const t=Y(),{t:n}=K(),r=A(P=>P.generation.steps),{isOpen:o,onOpen:s,onClose:c}=po(),{isOpen:u,onOpen:f,onClose:h}=po(),{shouldDisplayInProgressType:m,shouldConfirmOnDelete:v,shouldDisplayGuides:x,saveIntermediatesInterval:S,enableImageDebugging:C,shouldUseCanvasBetaLayout:j,shouldUseSliders:w}=A(ID),k=()=>{n3.purge().then(()=>{c(),f()})},M=P=>{P>r&&(P=r),P<1&&(P=1),t(r3(P))};return l.jsxs(l.Fragment,{children:[y.cloneElement(e,{onClick:s}),l.jsxs(mo,{isOpen:o,onClose:c,size:"xl",children:[l.jsx(Hr,{}),l.jsxs(vo,{paddingInlineEnd:4,children:[l.jsx(Br,{children:n("common.settingsLabel")}),l.jsx(aa,{}),l.jsx(Wr,{children:l.jsxs(ir,{gap:4,children:[l.jsxs(L,{sx:Ud,children:[l.jsx(Mn,{label:n("settings.displayInProgress"),validValues:XS,value:m,onChange:P=>t(QS(P.target.value))}),m==="full-res"&&l.jsx(Vr,{label:n("settings.saveSteps"),min:1,max:r,step:1,onChange:M,value:S,width:"auto",textAlign:"center"}),l.jsx(En,{label:n("settings.confirmOnDelete"),isChecked:v,onChange:P=>t(E1(P.target.checked))}),l.jsx(En,{label:n("settings.displayHelpIcons"),isChecked:x,onChange:P=>t(ZS(P.target.checked))}),l.jsx(En,{label:n("settings.useCanvasBeta"),isChecked:j,onChange:P=>t(JS(P.target.checked))}),l.jsx(En,{label:n("settings.useSlidersForAll"),isChecked:w,onChange:P=>t(e3(P.target.checked))})]}),l.jsxs(L,{sx:Ud,children:[l.jsx(Wn,{size:"sm",style:{fontWeight:"bold"},children:"Developer"}),l.jsx(En,{label:n("settings.enableImageDebugging"),isChecked:C,onChange:P=>t(t3(P.target.checked))})]}),l.jsxs(L,{sx:Ud,children:[l.jsx(Wn,{size:"sm",children:n("settings.resetWebUI")}),l.jsx(Je,{colorScheme:"error",onClick:k,children:n("settings.resetWebUI")}),l.jsx(Ce,{children:n("settings.resetWebUIDesc1")}),l.jsx(Ce,{children:n("settings.resetWebUIDesc2")})]})]})}),l.jsx(Lr,{children:l.jsx(Je,{onClick:c,children:n("common.close")})})]})]}),l.jsxs(mo,{closeOnOverlayClick:!1,isOpen:u,onClose:h,isCentered:!0,children:[l.jsx(Hr,{backdropFilter:"blur(40px)"}),l.jsxs(vo,{children:[l.jsx(Br,{}),l.jsx(Wr,{children:l.jsx(L,{justifyContent:"center",children:l.jsx(Ce,{fontSize:"lg",children:l.jsx(Ce,{children:n("settings.resetComplete")})})})}),l.jsx(Lr,{})]})]})]})},TD=me(Et,e=>({isConnected:e.isConnected,isProcessing:e.isProcessing,currentIteration:e.currentIteration,totalIterations:e.totalIterations,currentStatus:e.currentStatus,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),_D=()=>{const{isConnected:e,isProcessing:t,currentIteration:n,totalIterations:r,currentStatus:o,hasError:s,wasErrorSeen:c}=A(TD),u=Y(),{t:f}=K();let h;e&&!s?h="ok":h="error";let m=o;t&&(h="working"),m&&t&&r>1&&(m=`${f(m)} (${n}/${r})`);const v=s&&!c?"Click to clear, check logs for details":void 0,x=s&&!c?"pointer":"initial",S=()=>{(s||!c)&&u(w1())};return l.jsx(Gt,{label:v,children:l.jsx(Ce,{cursor:x,onClick:S,sx:{fontSize:"xs",fontWeight:"600",color:`${h}.400`},children:f(m)})})},DD=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return l.jsxs(Uh,{isLazy:o,...s,children:[l.jsx(Vh,{children:t}),l.jsxs(Gh,{children:[r&&l.jsx($h,{}),n]})]})},or=y.memo(DD);function AD(){const{t:e}=K(),t=Y(),n=A(c=>c.ui.currentTheme),r={dark:e("common.darkTheme"),light:e("common.lightTheme"),green:e("common.greenTheme"),ocean:e("common.oceanTheme")},o=c=>{t(o3(c))},s=()=>{const c=[];return Object.keys(r).forEach(u=>{c.push(l.jsx(Je,{isChecked:n===u,leftIcon:n===u?l.jsx(Oc,{}):void 0,size:"sm",onClick:()=>o(u),children:r[u]},u))}),c};return l.jsx(or,{triggerComponent:l.jsx(se,{"aria-label":e("common.themeLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(R9,{})}),children:l.jsx(Fe,{align:"stretch",children:s()})})}function OD(){const{t:e,i18n:t}=K(),n={ar:e("common.langArabic",{lng:"ar"}),nl:e("common.langDutch",{lng:"nl"}),en:e("common.langEnglish",{lng:"en"}),fr:e("common.langFrench",{lng:"fr"}),de:e("common.langGerman",{lng:"de"}),he:e("common.langHebrew",{lng:"he"}),it:e("common.langItalian",{lng:"it"}),ja:e("common.langJapanese",{lng:"ja"}),ko:e("common.langKorean",{lng:"ko"}),pl:e("common.langPolish",{lng:"pl"}),pt_BR:e("common.langBrPortuguese",{lng:"pt_BR"}),pt:e("common.langPortuguese",{lng:"pt"}),ru:e("common.langRussian",{lng:"ru"}),zh_CN:e("common.langSimplifiedChinese",{lng:"zh_CN"}),es:e("common.langSpanish",{lng:"es"}),uk:e("common.langUkranian",{lng:"ua"})},r=()=>{const o=[];return Object.keys(n).forEach(s=>{o.push(l.jsx(Je,{isChecked:localStorage.getItem("i18nextLng")===s,leftIcon:localStorage.getItem("i18nextLng")===s?l.jsx(Oc,{}):void 0,onClick:()=>t.changeLanguage(s),"aria-label":n[s],size:"sm",minWidth:"200px",children:n[s]},s))}),o};return l.jsx(or,{triggerComponent:l.jsx(se,{"aria-label":e("common.languagePickerLabel"),tooltip:e("common.languagePickerLabel"),icon:l.jsx(A9,{}),size:"sm",variant:"link","data-variant":"link",fontSize:26}),children:l.jsx(Fe,{children:r()})})}function zD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M16.5 9c-.42 0-.83.04-1.24.11L1.01 3 1 10l9 2-9 2 .01 7 8.07-3.46C9.59 21.19 12.71 24 16.5 24c4.14 0 7.5-3.36 7.5-7.5S20.64 9 16.5 9zm0 13c-3.03 0-5.5-2.47-5.5-5.5s2.47-5.5 5.5-5.5 5.5 2.47 5.5 5.5-2.47 5.5-5.5 5.5z"}},{tag:"path",attr:{d:"M18.27 14.03l-1.77 1.76-1.77-1.76-.7.7 1.76 1.77-1.76 1.77.7.7 1.77-1.76 1.77 1.76.7-.7-1.76-1.77 1.76-1.77z"}}]})(e)}function RD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}}]})(e)}function ND(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 00.12-.61l-1.92-3.32a.488.488 0 00-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 00-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 00-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}}]})(e)}function FD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z"}}]})(e)}function LD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M17 16l-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5h-4z"}}]})(e)}function BD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 2v11h3v9l7-12h-4l4-8z"}}]})(e)}function H0(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"}}]})(e)}function HD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"}}]})(e)}function WD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M19.02 10v9H5V5h9V3H5.02c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-9h-2zM17 10l.94-2.06L20 7l-2.06-.94L17 4l-.94 2.06L14 7l2.06.94zm-3.75.75L12 8l-1.25 2.75L8 12l2.75 1.25L12 16l1.25-2.75L16 12z"}}]})(e)}function dp(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}}]})(e)}function VD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"}}]})(e)}function UD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 10l5 5 5-5z"}}]})(e)}function $D(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 14l5-5 5 5z"}}]})(e)}function GD(e){return ge({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}}]})(e)}const qD=""+new URL("logo-13003d72.png",import.meta.url).href,Ib=()=>{const e=A(t=>t.system.app_version);return l.jsxs(L,{alignItems:"center",gap:3,ps:1,children:[l.jsx(cs,{src:qD,alt:"invoke-ai-logo",w:"32px",h:"32px"}),l.jsxs(Ce,{fontSize:"xl",children:["invoke ",l.jsx("strong",{children:"ai"})]}),l.jsx(Ce,{sx:{fontWeight:300,marginTop:1},variant:"subtext",children:e})]})},Mb=()=>{const{t:e}=K();return l.jsxs(ir,{gridTemplateColumns:"auto max-content",children:[l.jsx(Ib,{}),l.jsxs(L,{alignItems:"center",gap:2,children:[l.jsx(_D,{}),l.jsx(ED,{}),l.jsx(jD,{children:l.jsx(se,{"aria-label":e("modelManager.modelManager"),tooltip:e("modelManager.modelManager"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(k9,{})})}),l.jsx(iP,{children:l.jsx(se,{"aria-label":e("common.hotkeysLabel"),tooltip:e("common.hotkeysLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(D9,{})})}),l.jsx(AD,{}),l.jsx(OD,{}),l.jsx(qo,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI/issues",marginBottom:"-0.25rem",children:l.jsx(se,{"aria-label":e("common.reportBugLabel"),tooltip:e("common.reportBugLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx(j9,{})})}),l.jsx(qo,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI",marginBottom:"-0.25rem",children:l.jsx(se,{"aria-label":e("common.githubLabel"),tooltip:e("common.githubLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx(y9,{})})}),l.jsx(qo,{isExternal:!0,href:"https://discord.gg/ZmtBAhwWhy",marginBottom:"-0.25rem",children:l.jsx(se,{"aria-label":e("common.discordLabel"),tooltip:e("common.discordLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx(g9,{})})}),l.jsx(MD,{children:l.jsx(se,{"aria-label":e("common.settingsLabel"),tooltip:e("common.settingsLabel"),variant:"link","data-variant":"link",fontSize:22,size:"sm",icon:l.jsx(ND,{})})})]})]})};Mb.displayName="SiteHeader";const fp=e=>{const{children:t}=e;return l.jsx(L,{sx:{width:"100%",height:"100%",bg:"base.850"},children:t})};function YD(){const{t:e}=K();return l.jsx(fp,{children:l.jsxs(L,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Wn,{children:e("common.nodes")}),l.jsx(Fe,{maxW:"50rem",gap:4,children:l.jsx(Ce,{children:e("common.nodesDesc")})})]})})}const KD=()=>{const{t:e}=K();return l.jsx(fp,{children:l.jsxs(L,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Wn,{children:e("common.postProcessing")}),l.jsxs(Fe,{maxW:"50rem",gap:4,children:[l.jsx(Ce,{children:e("common.postProcessDesc1")}),l.jsx(Ce,{children:e("common.postProcessDesc2")}),l.jsx(Ce,{children:e("common.postProcessDesc3")})]})]})})};function XD(){const{t:e}=K();return l.jsx(fp,{children:l.jsxs(L,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Wn,{children:e("common.training")}),l.jsxs(Fe,{maxW:"50rem",gap:4,children:[l.jsx(Ce,{children:e("common.trainingDesc1")}),l.jsx(Ce,{children:e("common.trainingDesc2")})]})]})})}const Ss=me(e=>e.lightbox,e=>e,{memoizeOptions:{equalityCheck:ee.isEqual}}),qr=e=>e.gallery,QD=me([qr,Pr,Ss,bt],(e,t,n,r)=>{const{categories:o,currentCategory:s,currentImageUuid:c,galleryImageMinimumWidth:u,galleryImageObjectFit:f,shouldAutoSwitchToNewImages:h,galleryWidth:m,shouldUseSingleGalleryColumn:v}=e,{shouldPinGallery:x}=t,{isLightboxOpen:S}=n;return{currentImageUuid:c,shouldPinGallery:x,galleryImageMinimumWidth:u,galleryImageObjectFit:f,galleryGridTemplateColumns:v?"auto":`repeat(auto-fill, minmax(${u}px, auto))`,shouldAutoSwitchToNewImages:h,currentCategory:s,images:o[s].images,areMoreImagesAvailable:o[s].areMoreImagesAvailable,galleryWidth:m,shouldEnableResize:!(S||r==="unifiedCanvas"&&x),shouldUseSingleGalleryColumn:v}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),ZD=me([qr,Et,Ss,bt],(e,t,n,r)=>({mayDeleteImage:t.isConnected&&!t.isProcessing,galleryImageObjectFit:e.galleryImageObjectFit,galleryImageMinimumWidth:e.galleryImageMinimumWidth,shouldUseSingleGalleryColumn:e.shouldUseSingleGalleryColumn,activeTabName:r,isLightboxOpen:n.isLightboxOpen}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),JD=me(qr,e=>({resultImages:e.categories.result.images,userImages:e.categories.user.images})),eA=()=>{const{resultImages:e,userImages:t}=A(JD);return n=>{const r=e.find(s=>s.uuid===n);if(r)return r;const o=t.find(s=>s.uuid===n);if(o)return o}},tA=({direction:e,langDirection:t})=>({top:e==="bottom",right:t!=="rtl"&&e==="left"||t==="rtl"&&e==="right",bottom:e==="top",left:t!=="rtl"&&e==="right"||t==="rtl"&&e==="left"}),nA=({direction:e,minWidth:t,maxWidth:n,minHeight:r,maxHeight:o})=>{const s=t??(["left","right"].includes(e)?10:void 0),c=n??(["left","right"].includes(e)?"95vw":void 0),u=r??(["top","bottom"].includes(e)?10:void 0),f=o??(["top","bottom"].includes(e)?"95vh":void 0);return{...s?{minWidth:s}:{},...c?{maxWidth:c}:{},...u?{minHeight:u}:{},...f?{maxHeight:f}:{}}},Rr="0.75rem",zl="1rem",rA="2px",oA="5px",iA=({isPinned:e,isResizable:t,direction:n})=>{if(!t)return{containerStyles:{},handleStyles:{}};const r=e?rA:oA,o=`calc((2 * ${Rr} + ${r}) / -2)`;return n==="top"?{containerStyles:{borderBottomWidth:r,paddingBottom:zl},handleStyles:{top:{paddingTop:Rr,paddingBottom:Rr,bottom:o}}}:n==="left"?{containerStyles:{borderInlineEndWidth:r,paddingInlineEnd:zl},handleStyles:{right:{paddingInlineStart:Rr,paddingInlineEnd:Rr,insetInlineEnd:o}}}:n==="bottom"?{containerStyles:{borderTopWidth:r,paddingTop:zl},handleStyles:{bottom:{paddingTop:Rr,paddingBottom:Rr,top:o}}}:n==="right"?{containerStyles:{borderInlineStartWidth:r,paddingInlineStart:zl},handleStyles:{left:{paddingInlineStart:Rr,paddingInlineEnd:Rr,insetInlineStart:o}}}:{containerStyles:{},handleStyles:{}}},aA=(e,t)=>["top","bottom"].includes(e)?e:e==="left"?t==="rtl"?"right":"left":e==="right"?t==="rtl"?"left":"right":"left",oo=(e,t)=>{if(e)return t?e+t:e},sA=ne(zx,{shouldForwardProp:e=>!["sx"].includes(e)}),Tb=({direction:e="left",isResizable:t,isPinned:n,isOpen:r,onClose:o,children:s,initialWidth:c,minWidth:u,maxWidth:f,initialHeight:h,minHeight:m,maxHeight:v,onResizeStart:x,onResizeStop:S,onResize:C,sx:j={}})=>{const w=ta().direction,k=y.useRef(null),M=y.useMemo(()=>c??u??(["left","right"].includes(e)?500:"100%"),[c,u,e]),P=y.useMemo(()=>h??m??(["top","bottom"].includes(e)?500:"100%"),[h,m,e]),[I,T]=y.useState(M),[_,D]=y.useState(P);E6({ref:k,handler:()=>{o()},enabled:r&&!n});const z=y.useMemo(()=>t?tA({direction:e,langDirection:w}):{},[t,w,e]),W=y.useMemo(()=>nA({direction:e,minWidth:t?oo(u,18):oo(u),maxWidth:t?oo(f,18):oo(f),minHeight:t?oo(m,18):oo(m),maxHeight:t?oo(v,18):oo(v)}),[u,f,m,v,e,t]),{containerStyles:F,handleStyles:B}=y.useMemo(()=>iA({isPinned:n,isResizable:t,direction:e}),[n,t,e]),Q=y.useMemo(()=>aA(e,w),[e,w]);return y.useEffect(()=>{["left","right"].includes(e)&&D(n?"100%":"100vh"),["top","bottom"].includes(e)&&T(n?"100%":"100vw")},[n,e]),l.jsx(x2,{direction:Q,in:r,unmountOnExit:n,motionProps:{initial:n},...n?{style:{position:void 0,left:void 0,right:void 0,top:void 0,bottom:void 0,width:void 0}}:{style:{zIndex:99,width:"full"}},children:l.jsx(Ye,{ref:k,sx:{width:"full",height:"full"},children:l.jsx(sA,{size:{width:t?I:M,height:t?_:P},enable:z,handleStyles:B,...W,sx:{borderColor:"base.800",p:n?0:4,bg:"base.900",height:"full",boxShadow:n?"":"0 0 4rem 0 rgba(0, 0, 0, 0.8)",...F,...j},onResizeStart:(U,X,te)=>{x&&x(U,X,te)},onResize:(U,X,te,re)=>{C&&C(U,X,te,re)},onResizeStop:(U,X,te,re)=>{["left","right"].includes(X)&&T(Number(I)+re.width),["top","bottom"].includes(X)&&D(Number(_)+re.height),S&&S(U,X,te,re)},children:s})})})},W0={position:"absolute",width:"full",height:24,left:0,pointerEvents:"none",transition:"opacity 0.2s ease-in-out"},_b=({children:e})=>{const t=y.useRef(null),n=y.useRef(null),r=y.useRef(null),o=ee.throttle(()=>{if(!t.current||!n.current||!r.current)return;const{scrollTop:s,scrollHeight:c,offsetHeight:u}=t.current;s>0?n.current.style.opacity="1":n.current.style.opacity="0",s>=c-u?r.current.style.opacity="0":r.current.style.opacity="1"},33,{leading:!0});return y.useEffect(()=>{o()},[o]),l.jsxs(Ye,{position:"relative",w:"full",h:"full",children:[l.jsx(Ye,{ref:t,position:"absolute",w:"full",h:"full",overflowY:"scroll",onScroll:o,children:e}),l.jsx(Ye,{ref:r,sx:{...W0,bottom:0,boxShadow:"inset 0 -3.5rem 2rem -2rem var(--invokeai-colors-base-900)"}}),l.jsx(Ye,{ref:n,sx:{...W0,top:0,boxShadow:"inset 0 3.5rem 2rem -2rem var(--invokeai-colors-base-900)"}})]})},lA=ee.debounce(e=>{e(P1(!0))},300),cn=()=>(e,t)=>{bt(t())==="unifiedCanvas"&&lA(e)};function Db(e){return ge({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146z"}}]})(e)}function Ab(e){return ge({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146zm.122 2.112v-.002.002zm0-.002v.002a.5.5 0 0 1-.122.51L6.293 6.878a.5.5 0 0 1-.511.12H5.78l-.014-.004a4.507 4.507 0 0 0-.288-.076 4.922 4.922 0 0 0-.765-.116c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a4.924 4.924 0 0 0-.192-1.054l-.004-.013v-.001a.5.5 0 0 1 .12-.512l3.536-3.535a.5.5 0 0 1 .532-.115l.096.022c.087.017.208.034.344.034.114 0 .23-.011.343-.04L9.927 2.028c-.029.113-.04.23-.04.343a1.779 1.779 0 0 0 .062.46z"}}]})(e)}const V0=e=>{const{sx:t}=e,n=Y(),r=A(c=>c.ui.shouldPinParametersPanel),{t:o}=K(),s=()=>{n(i3(!r)),n(cn())};return l.jsx(Gt,{label:o("common.pinOptionsPanel"),children:l.jsx(se,{...e,"aria-label":o("common.pinOptionsPanel"),onClick:s,icon:r?l.jsx(Db,{}):l.jsx(Ab,{}),variant:"ghost",size:"sm",sx:{color:"base.700",_hover:{color:"base.550"},_active:{color:"base.500"},...t}})})},cA=me([Pr,bt,Ss],(e,t,n)=>{const{shouldPinParametersPanel:r,shouldShowParametersPanel:o}=e,{isLightboxOpen:s}=n;return{shouldPinParametersPanel:r,shouldShowParametersPanel:o,isResizable:t!=="unifiedCanvas",isLightboxOpen:s}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),uA=({children:e})=>{const t=Y(),{shouldPinParametersPanel:n,shouldShowParametersPanel:r,isResizable:o,isLightboxOpen:s}=A(cA),c=()=>{t(ql(!1))};return de("o",()=>{t(a3()),n&&t(cn())},{enabled:()=>!s},[n,s]),de("esc",()=>{t(ql(!1))},{enabled:()=>!n,preventDefault:!0},[n]),de("shift+o",()=>{t(s3()),t(cn())},[]),l.jsx(Tb,{direction:"left",isResizable:o||!n,isOpen:r,onClose:c,isPinned:n||s,sx:{borderColor:"base.700",p:n?0:4,bg:"base.900"},initialWidth:n0,minWidth:n0,children:l.jsxs(L,{flexDir:"column",position:"relative",h:"full",w:"full",children:[!n&&l.jsxs(L,{paddingTop:1.5,paddingBottom:4,justifyContent:"space-between",alignItems:"center",children:[l.jsx(Ib,{}),l.jsx(V0,{})]}),l.jsx(_b,{children:e}),n&&l.jsx(V0,{sx:{position:"absolute",top:0,insetInlineEnd:0}})]})})},dA=y.memo(uA),fA=me([Pr,bt],(e,t)=>{const{shouldPinParametersPanel:n}=e;return{shouldPinParametersPanel:n,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),hp=e=>{const{parametersPanelContent:t,children:n,...r}=e,o=Y(),{activeTabName:s}=A(fA),c=eA(),u=f=>{const h=f.dataTransfer.getData("invokeai/imageUuid"),m=c(h);m&&(s==="img2img"?o(rs(m)):s==="unifiedCanvas"&&o(bc(m)))};return l.jsxs(L,{...r,pos:"relative",w:"full",h:eP,gap:4,children:[l.jsx(dA,{children:t}),l.jsx(Ye,{pos:"relative",w:"100%",h:"100%",onDrop:u,children:n})]})},hA=e=>{const{styleClass:t}=e,n=y.useContext(Yh),r=()=>{n&&n()};return l.jsx(L,{sx:{width:"100%",height:"100%",alignItems:"center",justifyContent:"center"},className:t,children:l.jsxs(L,{onClick:r,sx:{display:"flex",flexDirection:"column",rowGap:8,p:8,borderRadius:"base",alignItems:"center",justifyContent:"center",textAlign:"center",cursor:"pointer",color:"base.600",bg:"base.800",_hover:{bg:"base.700"}},children:[l.jsx(tn,{as:Rc,boxSize:24}),l.jsx(Wn,{size:"md",children:"Click or Drag and Drop"})]})})};function pA(){const e=A(o=>o.postprocessing.facetoolType),t=Y(),{t:n}=K(),r=o=>t(Nl(o.target.value));return l.jsx(Mn,{label:n("parameters.type"),validValues:l3.concat(),value:e,onChange:r})}function mA(){const e=A(o=>o.system.isGFPGANAvailable),t=A(o=>o.postprocessing.facetoolStrength),{t:n}=K(),r=Y();return l.jsx(ut,{isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e,label:n("parameters.strength"),step:.05,min:0,max:1,onChange:o=>r(Yl(o)),handleReset:()=>r(Yl(.75)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}function vA(){const e=A(o=>o.system.isGFPGANAvailable),t=A(o=>o.postprocessing.codeformerFidelity),{t:n}=K(),r=Y();return l.jsx(ut,{isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e,label:n("parameters.codeformerFidelity"),step:.05,min:0,max:1,onChange:o=>r(Zd(o)),handleReset:()=>r(Zd(1)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}const pp=()=>{const e=A(t=>t.postprocessing.facetoolType);return l.jsxs(Fe,{gap:2,alignItems:"stretch",children:[l.jsx(pA,{}),l.jsx(mA,{}),e==="codeformer"&&l.jsx(vA,{})]})};function gA(){const e=A(o=>o.system.isESRGANAvailable),t=A(o=>o.postprocessing.upscalingDenoising),{t:n}=K(),r=Y();return l.jsx(ut,{label:n("parameters.denoisingStrength"),value:t,min:0,max:1,step:.01,onChange:o=>{r(Jd(o))},handleReset:()=>r(Jd(.75)),withSliderMarks:!0,withInput:!0,withReset:!0,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})}function yA(){const e=A(o=>o.system.isESRGANAvailable),t=A(o=>o.postprocessing.upscalingStrength),{t:n}=K(),r=Y();return l.jsx(ut,{label:`${n("parameters.upscale")} ${n("parameters.strength")}`,value:t,min:0,max:1,step:.05,onChange:o=>r(ef(o)),handleReset:()=>r(ef(.75)),withSliderMarks:!0,withInput:!0,withReset:!0,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})}function xA(){const e=A(s=>s.system.isESRGANAvailable),t=A(s=>s.postprocessing.upscalingLevel),{t:n}=K(),r=Y(),o=s=>r(I1(Number(s.target.value)));return l.jsx(Mn,{isDisabled:!e,label:n("parameters.scale"),value:t,onChange:o,validValues:c3})}const mp=()=>l.jsxs(Fe,{gap:2,alignItems:"stretch",children:[l.jsx(xA,{}),l.jsx(gA,{}),l.jsx(yA,{})]}),vp=e=>e.postprocessing,bA=me(Et,e=>{const{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}=e;return{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),hc=fe(({image:e,children:t},n)=>{const{isOpen:r,onOpen:o,onClose:s}=po(),c=Y(),{shouldConfirmOnDelete:u,isConnected:f,isProcessing:h}=A(bA),m=y.useRef(null),v=C=>{C.stopPropagation(),u?o():x()},x=()=>{f&&!h&&e&&c(u3(e)),s()};de("delete",()=>{u?o():x()},[e,u,f,h]);const S=C=>c(E1(!C.target.checked));return l.jsxs(l.Fragment,{children:[y.cloneElement(t,{onClick:e?v:void 0,ref:n}),l.jsx(qy,{isOpen:r,leastDestructiveRef:m,onClose:s,children:l.jsx(Hr,{children:l.jsxs(Yy,{children:[l.jsx(Br,{fontSize:"lg",fontWeight:"bold",children:"Delete image"}),l.jsx(Wr,{children:l.jsxs(L,{direction:"column",gap:5,children:[l.jsx(Ce,{children:"Are you sure? Deleted images will be sent to the Bin. You can restore from there if you wish to."}),l.jsx(En,{label:"Don't ask me again",isChecked:!u,onChange:S})]})}),l.jsxs(Lr,{children:[l.jsx(Je,{ref:m,onClick:s,children:"Cancel"}),l.jsx(Je,{colorScheme:"error",onClick:x,ml:3,children:"Delete"})]})]})})})]})});hc.displayName="DeleteImageModal";const gp=()=>{const e=Y();return t=>{const n=typeof t=="string"?t:M1(t),[r,o]=d3(n);e(T1(r)),e(_1(o))}},SA=me([Et,qr,vp,Pr,Ss,bt],(e,t,n,r,o,s)=>{const{isProcessing:c,isConnected:u,isGFPGANAvailable:f,isESRGANAvailable:h}=e,{upscalingLevel:m,facetoolStrength:v}=n,{isLightboxOpen:x}=o,{shouldShowImageDetails:S}=r,{intermediateImage:C,currentImage:j}=t;return{isProcessing:c,isConnected:u,isGFPGANAvailable:f,isESRGANAvailable:h,upscalingLevel:m,facetoolStrength:v,shouldDisableToolbarButtons:Boolean(C)||!j,currentImage:j,shouldShowImageDetails:S,activeTabName:s,isLightboxOpen:x}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Ob=e=>{var B,Q,U,X,te,re,$,Z;const t=Y(),{isProcessing:n,isConnected:r,isGFPGANAvailable:o,isESRGANAvailable:s,upscalingLevel:c,facetoolStrength:u,shouldDisableToolbarButtons:f,shouldShowImageDetails:h,currentImage:m,isLightboxOpen:v,activeTabName:x}=A(SA),S=ls(),{t:C}=K(),j=gp(),w=()=>{m&&(v&&t(Uo(!1)),t(rs(m)),t(kn("img2img")))},k=async()=>{if(!m)return;const oe=await fetch(m.url).then(ze=>ze.blob()),le=[new ClipboardItem({[oe.type]:oe})];await navigator.clipboard.write(le),S({title:C("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})},M=()=>{navigator.clipboard.writeText(m?window.location.toString()+m.url:"").then(()=>{S({title:C("toast.imageLinkCopied"),status:"success",duration:2500,isClosable:!0})})};de("shift+i",()=>{m?(w(),S({title:C("toast.sentToImageToImage"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.imageNotLoaded"),description:C("toast.imageNotLoadedDesc"),status:"error",duration:2500,isClosable:!0})},[m]);const P=()=>{var oe,le;m&&(m.metadata&&t(D1(m.metadata)),((oe=m.metadata)==null?void 0:oe.image.type)==="img2img"?t(kn("img2img")):((le=m.metadata)==null?void 0:le.image.type)==="txt2img"&&t(kn("txt2img")))};de("a",()=>{var oe,le;["txt2img","img2img"].includes((le=(oe=m==null?void 0:m.metadata)==null?void 0:oe.image)==null?void 0:le.type)?(P(),S({title:C("toast.parametersSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.parametersNotSet"),description:C("toast.parametersNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[m]);const I=()=>{m!=null&&m.metadata&&t(is(m.metadata.image.seed))};de("s",()=>{var oe,le;(le=(oe=m==null?void 0:m.metadata)==null?void 0:oe.image)!=null&&le.seed?(I(),S({title:C("toast.seedSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.seedNotSet"),description:C("toast.seedNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[m]);const T=y.useCallback(()=>{var oe,le,ze,Re;(le=(oe=m==null?void 0:m.metadata)==null?void 0:oe.image)!=null&&le.prompt&&j((Re=(ze=m==null?void 0:m.metadata)==null?void 0:ze.image)==null?void 0:Re.prompt)},[(Q=(B=m==null?void 0:m.metadata)==null?void 0:B.image)==null?void 0:Q.prompt,j]);de("p",()=>{var oe,le;(le=(oe=m==null?void 0:m.metadata)==null?void 0:oe.image)!=null&&le.prompt?(T(),S({title:C("toast.promptSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.promptNotSet"),description:C("toast.promptNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[m]);const _=()=>{m&&t(f3(m))};de("Shift+U",()=>{s&&!f&&r&&!n&&c?_():S({title:C("toast.upscalingFailed"),status:"error",duration:2500,isClosable:!0})},[m,s,f,r,n,c]);const D=()=>{m&&t(h3(m))};de("Shift+R",()=>{o&&!f&&r&&!n&&u?D():S({title:C("toast.faceRestoreFailed"),status:"error",duration:2500,isClosable:!0})},[m,o,f,r,n,u]);const z=()=>t(A1(!h)),W=()=>{m&&(v&&t(Uo(!1)),t(bc(m)),t(cn()),x!=="unifiedCanvas"&&t(kn("unifiedCanvas")),S({title:C("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0}))};de("i",()=>{m?z():S({title:C("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[m,h]);const F=()=>{t(Uo(!v))};return l.jsxs(L,{sx:{justifyContent:"center",alignItems:"center",columnGap:"0.5em"},...e,children:[l.jsxs(Qt,{isAttached:!0,children:[l.jsx(or,{triggerComponent:l.jsx(se,{"aria-label":`${C("parameters.sendTo")}...`,icon:l.jsx(W9,{})}),children:l.jsxs(L,{sx:{flexDirection:"column",rowGap:2},children:[l.jsx(Je,{size:"sm",onClick:w,leftIcon:l.jsx(t0,{}),children:C("parameters.sendToImg2Img")}),l.jsx(Je,{size:"sm",onClick:W,leftIcon:l.jsx(t0,{}),children:C("parameters.sendToUnifiedCanvas")}),l.jsx(Je,{size:"sm",onClick:k,leftIcon:l.jsx(Xi,{}),children:C("parameters.copyImage")}),l.jsx(Je,{size:"sm",onClick:M,leftIcon:l.jsx(Xi,{}),children:C("parameters.copyImageToLink")}),l.jsx(qo,{download:!0,href:m==null?void 0:m.url,children:l.jsx(Je,{leftIcon:l.jsx(Qh,{}),size:"sm",w:"100%",children:C("parameters.downloadImage")})})]})}),l.jsx(se,{icon:l.jsx(P9,{}),tooltip:v?`${C("parameters.closeViewer")} (Z)`:`${C("parameters.openInViewer")} (Z)`,"aria-label":v?`${C("parameters.closeViewer")} (Z)`:`${C("parameters.openInViewer")} (Z)`,isChecked:v,onClick:F})]}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{icon:l.jsx(F9,{}),tooltip:`${C("parameters.usePrompt")} (P)`,"aria-label":`${C("parameters.usePrompt")} (P)`,isDisabled:!((X=(U=m==null?void 0:m.metadata)==null?void 0:U.image)!=null&&X.prompt),onClick:T}),l.jsx(se,{icon:l.jsx(H9,{}),tooltip:`${C("parameters.useSeed")} (S)`,"aria-label":`${C("parameters.useSeed")} (S)`,isDisabled:!((re=(te=m==null?void 0:m.metadata)==null?void 0:te.image)!=null&&re.seed),onClick:I}),l.jsx(se,{icon:l.jsx(w9,{}),tooltip:`${C("parameters.useAll")} (A)`,"aria-label":`${C("parameters.useAll")} (A)`,isDisabled:!["txt2img","img2img"].includes((Z=($=m==null?void 0:m.metadata)==null?void 0:$.image)==null?void 0:Z.type),onClick:P})]}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(or,{triggerComponent:l.jsx(se,{icon:l.jsx(T9,{}),"aria-label":C("parameters.restoreFaces")}),children:l.jsxs(L,{sx:{flexDirection:"column",rowGap:4},children:[l.jsx(pp,{}),l.jsx(Je,{isDisabled:!o||!m||!(r&&!n)||!u,onClick:D,children:C("parameters.restoreFaces")})]})}),l.jsx(or,{triggerComponent:l.jsx(se,{icon:l.jsx(E9,{}),"aria-label":C("parameters.upscale")}),children:l.jsxs(L,{sx:{flexDirection:"column",gap:4},children:[l.jsx(mp,{}),l.jsx(Je,{isDisabled:!s||!m||!(r&&!n)||!c,onClick:_,children:C("parameters.upscaleImage")})]})})]}),l.jsx(Qt,{isAttached:!0,children:l.jsx(se,{icon:l.jsx(Bx,{}),tooltip:`${C("parameters.info")} (I)`,"aria-label":`${C("parameters.info")} (I)`,isChecked:h,onClick:z})}),l.jsx(hc,{image:m,children:l.jsx(se,{icon:l.jsx(So,{}),tooltip:`${C("parameters.deleteImage")} (Del)`,"aria-label":`${C("parameters.deleteImage")} (Del)`,isDisabled:!m||!r||n,colorScheme:"error"})})]})},CA=e=>{const{size:t="xl",...n}=e;return l.jsx(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",position:"absolute",color:"base.400"},children:l.jsx(yc,{size:t,...n})})};function wA(e){return ge({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M245.09 327.74v-37.32c57.07 0 84.51 13.47 108.58 38.68 5.4 5.65 15 1.32 14.29-6.43-5.45-61.45-34.14-117.09-122.87-117.09v-37.32a8.32 8.32 0 00-14.05-6L146.58 242a8.2 8.2 0 000 11.94L231 333.71a8.32 8.32 0 0014.09-5.97z"}},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M256 64C150 64 64 150 64 256s86 192 192 192 192-86 192-192S362 64 256 64z"}}]})(e)}const yt=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>{const{t:c}=K();return l.jsxs(L,{gap:2,children:[n&&l.jsx(Gt,{label:`Recall ${e}`,children:l.jsx(ho,{"aria-label":c("accessibility.useThisParameter"),icon:l.jsx(wA,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&l.jsx(Gt,{label:`Copy ${e}`,children:l.jsx(ho,{"aria-label":`Copy ${e}`,icon:l.jsx(Xi,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),l.jsxs(L,{direction:o?"column":"row",children:[l.jsxs(Ce,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?l.jsxs(qo,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",l.jsx(Eb,{mx:"2px"})]}):l.jsx(Ce,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]})},jA=(e,t)=>e.image.uuid===t.image.uuid,yp=y.memo(({image:e})=>{var F,B;const t=Y(),n=gp();de("esc",()=>{t(A1(!1))});const r=((F=e==null?void 0:e.metadata)==null?void 0:F.image)||{},o=e==null?void 0:e.dreamPrompt,{cfg_scale:s,fit:c,height:u,hires_fix:f,init_image_path:h,mask_image_path:m,orig_path:v,perlin:x,postprocessing:S,prompt:C,sampler:j,seamless:w,seed:k,steps:M,strength:P,threshold:I,type:T,variations:_,width:D}=r,{t:z}=K(),W=JSON.stringify(e.metadata,null,2);return l.jsxs(L,{sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",backdropFilter:"blur(20px)",bg:"whiteAlpha.600",_dark:{bg:"blackAlpha.600"}},children:[l.jsxs(L,{gap:2,children:[l.jsx(Ce,{fontWeight:"semibold",children:"File:"}),l.jsxs(qo,{href:e.url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.url.length>64?e.url.substring(0,64).concat("..."):e.url,l.jsx(Eb,{mx:"2px"})]})]}),Object.keys(r).length>0?l.jsxs(l.Fragment,{children:[T&&l.jsx(yt,{label:"Generation type",value:T}),((B=e.metadata)==null?void 0:B.model_weights)&&l.jsx(yt,{label:"Model",value:e.metadata.model_weights}),["esrgan","gfpgan"].includes(T)&&l.jsx(yt,{label:"Original image",value:v}),C&&l.jsx(yt,{label:"Prompt",labelPosition:"top",value:typeof C=="string"?C:M1(C),onClick:()=>n(C)}),k!==void 0&&l.jsx(yt,{label:"Seed",value:k,onClick:()=>t(is(k))}),I!==void 0&&l.jsx(yt,{label:"Noise Threshold",value:I,onClick:()=>t(tf(I))}),x!==void 0&&l.jsx(yt,{label:"Perlin Noise",value:x,onClick:()=>t(nf(x))}),j&&l.jsx(yt,{label:"Sampler",value:j,onClick:()=>t(O1(j))}),M&&l.jsx(yt,{label:"Steps",value:M,onClick:()=>t(rf(M))}),s!==void 0&&l.jsx(yt,{label:"CFG scale",value:s,onClick:()=>t(of(s))}),_&&_.length>0&&l.jsx(yt,{label:"Seed-weight pairs",value:Mv(_),onClick:()=>t(z1(Mv(_)))}),w&&l.jsx(yt,{label:"Seamless",value:w,onClick:()=>t(R1(w))}),f&&l.jsx(yt,{label:"High Resolution Optimization",value:f,onClick:()=>t(N1(f))}),D&&l.jsx(yt,{label:"Width",value:D,onClick:()=>t(Fl(D))}),u&&l.jsx(yt,{label:"Height",value:u,onClick:()=>t(Ll(u))}),h&&l.jsx(yt,{label:"Initial image",value:h,isLink:!0,onClick:()=>t(rs(h))}),m&&l.jsx(yt,{label:"Mask image",value:m,isLink:!0,onClick:()=>t(p3(m))}),T==="img2img"&&P&&l.jsx(yt,{label:"Image to image strength",value:P,onClick:()=>t(af(P))}),c&&l.jsx(yt,{label:"Image to image fit",value:c,onClick:()=>t(F1(c))}),S&&S.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Wn,{size:"sm",children:"Postprocessing"}),S.map((Q,U)=>{if(Q.type==="esrgan"){const{scale:X,strength:te,denoise_str:re}=Q;return l.jsxs(L,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${U+1}: Upscale (ESRGAN)`}),l.jsx(yt,{label:"Scale",value:X,onClick:()=>t(I1(X))}),l.jsx(yt,{label:"Strength",value:te,onClick:()=>t(ef(te))}),re!==void 0&&l.jsx(yt,{label:"Denoising strength",value:re,onClick:()=>t(Jd(re))})]},U)}else if(Q.type==="gfpgan"){const{strength:X}=Q;return l.jsxs(L,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${U+1}: Face restoration (GFPGAN)`}),l.jsx(yt,{label:"Strength",value:X,onClick:()=>{t(Yl(X)),t(Nl("gfpgan"))}})]},U)}else if(Q.type==="codeformer"){const{strength:X,fidelity:te}=Q;return l.jsxs(L,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${U+1}: Face restoration (Codeformer)`}),l.jsx(yt,{label:"Strength",value:X,onClick:()=>{t(Yl(X)),t(Nl("codeformer"))}}),te&&l.jsx(yt,{label:"Fidelity",value:te,onClick:()=>{t(Zd(te)),t(Nl("codeformer"))}})]},U)}})]}),o&&l.jsx(yt,{withCopy:!0,label:"Dream Prompt",value:o}),l.jsxs(L,{gap:2,direction:"column",children:[l.jsxs(L,{gap:2,children:[l.jsx(Gt,{label:"Copy metadata JSON",children:l.jsx(ho,{"aria-label":z("accessibility.copyMetadataJson"),icon:l.jsx(Xi,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(W)})}),l.jsx(Ce,{fontWeight:"semibold",children:"Metadata JSON:"})]}),l.jsx(Ye,{sx:{mt:0,mr:2,mb:4,ml:2,padding:4,borderRadius:"base",overflowX:"scroll",wordBreak:"break-all",bg:"whiteAlpha.500",_dark:{bg:"blackAlpha.500"}},children:l.jsx("pre",{children:W})})]})]}):l.jsx(by,{width:"100%",pt:10,children:l.jsx(Ce,{fontSize:"lg",fontWeight:"semibold",children:"No metadata available"})})]})},jA);yp.displayName="ImageMetadataViewer";const U0={height:"100%",width:"15%",alignItems:"center",pointerEvents:"auto"},$0={color:"base.100"},kA=me(qr,e=>{const{currentImage:t}=e,n=e.categories[t?t.category:"result"].images,r=n.findIndex(s=>{var c;return s.uuid===((c=e==null?void 0:e.currentImage)==null?void 0:c.uuid)}),o=n.length;return{isOnFirstImage:r===0,isOnLastImage:!isNaN(r)&&r===o-1}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),zb=()=>{const e=Y(),{t}=K(),{isOnFirstImage:n,isOnLastImage:r}=A(kA),[o,s]=y.useState(!1),c=()=>{s(!0)},u=()=>{s(!1)},f=()=>{e(L1())},h=()=>{e(B1())};return l.jsxs(L,{sx:{justifyContent:"space-between",zIndex:1,height:"100%",width:"100%",pointerEvents:"none"},children:[l.jsx(ir,{sx:{...U0,justifyContent:"flex-start"},onMouseOver:c,onMouseOut:u,children:o&&!n&&l.jsx(ho,{"aria-label":t("accessibility.previousImage"),icon:l.jsx(b9,{size:64}),variant:"unstyled",onClick:f,boxSize:16,sx:$0})}),l.jsx(ir,{sx:{...U0,justifyContent:"flex-end"},onMouseOver:c,onMouseOut:u,children:o&&!r&&l.jsx(ho,{"aria-label":t("accessibility.nextImage"),icon:l.jsx(S9,{size:64}),variant:"unstyled",onClick:h,boxSize:16,sx:$0})})]})},EA=me([qr,Pr],(e,t)=>{const{currentImage:n,intermediateImage:r}=e,{shouldShowImageDetails:o}=t;return{imageToDisplay:r||n,isIntermediate:Boolean(r),shouldShowImageDetails:o}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function PA(){const{shouldShowImageDetails:e,imageToDisplay:t,isIntermediate:n}=A(EA);return l.jsxs(L,{sx:{position:"relative",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:[t&&l.jsx(cs,{src:t.url,width:t.width,height:t.height,fallback:n?void 0:l.jsx(CA,{}),sx:{objectFit:"contain",maxWidth:"100%",maxHeight:"100%",height:"auto",position:"absolute",imageRendering:n?"pixelated":"initial",borderRadius:"base"}}),!e&&l.jsx(zb,{}),e&&t&&l.jsx(Ye,{sx:{position:"absolute",top:"0",width:"100%",height:"100%",borderRadius:"base",overflow:"scroll",maxHeight:tP},children:l.jsx(yp,{image:t})})]})}const IA=me([qr],e=>{const{currentImage:t,intermediateImage:n}=e;return{hasAnImageToDisplay:t||n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Rb=()=>{const{hasAnImageToDisplay:e}=A(IA);return l.jsx(L,{sx:{flexDirection:"column",height:"100%",width:"100%",rowGap:4,borderRadius:"base"},children:e?l.jsxs(l.Fragment,{children:[l.jsx(Ob,{}),l.jsx(PA,{})]}):l.jsx(L,{sx:{alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:l.jsx(tn,{as:VD,sx:{boxSize:24,color:"base.500"}})})})},MA=()=>{const{t:e}=K(),t=y.useContext(Yh);return l.jsx(se,{"aria-label":e("accessibility.uploadImage"),tooltip:"Upload Image",icon:l.jsx(Rc,{}),onClick:t||void 0})};function TA(){const e=A(s=>s.generation.initialImage),{t}=K(),n=Y(),r=ls(),o=()=>{r({title:t("toast.parametersFailed"),description:t("toast.parametersFailedDesc"),status:"error",isClosable:!0}),n(m3())};return l.jsxs(l.Fragment,{children:[l.jsxs(L,{sx:{alignItems:"center",justifyContent:"center",w:"100%",gap:4},children:[l.jsx(Ce,{sx:{fontSize:"lg"},variant:"subtext",children:t("parameters.initialImage")}),l.jsx(MA,{})]}),e&&l.jsx(L,{sx:{position:"relative",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:l.jsx(cs,{sx:{fit:"contain",maxWidth:"100%",maxHeight:"100%",borderRadius:"base",objectFit:"contain",position:"absolute"},src:typeof e=="string"?e:e.url,onError:o})})]})}const G0={flexDirection:"column",height:"100%",width:"100%",gap:4,padding:4},_A=()=>{const t=A(n=>n.generation.initialImage)?l.jsx(L,{flexDirection:"column",gap:4,w:"100%",h:"100%",children:l.jsx(TA,{})}):l.jsx(hA,{});return l.jsxs(ir,{sx:{w:"100%",h:"100%",gridTemplateColumns:"1fr 1fr",borderRadius:"base",bg:"base.850"},children:[l.jsx(L,{sx:{...G0,paddingInlineEnd:2},children:t}),l.jsx(L,{sx:{...G0,paddingInlineStart:2},children:l.jsx(Rb,{})})]})};var ln=(e=>(e[e.PROMPT=0]="PROMPT",e[e.GALLERY=1]="GALLERY",e[e.OTHER=2]="OTHER",e[e.SEED=3]="SEED",e[e.VARIATIONS=4]="VARIATIONS",e[e.UPSCALE=5]="UPSCALE",e[e.FACE_CORRECTION=6]="FACE_CORRECTION",e[e.IMAGE_TO_IMAGE=7]="IMAGE_TO_IMAGE",e[e.BOUNDING_BOX=8]="BOUNDING_BOX",e[e.SEAM_CORRECTION=9]="SEAM_CORRECTION",e[e.INFILL_AND_SCALING=10]="INFILL_AND_SCALING",e))(ln||{});const DA=()=>{const{t:e}=K();return y.useMemo(()=>({[0]:{text:e("tooltip.feature.prompt"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[1]:{text:e("tooltip.feature.gallery"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[2]:{text:e("tooltip.feature.other"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[3]:{text:e("tooltip.feature.seed"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[4]:{text:e("tooltip.feature.variations"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[5]:{text:e("tooltip.feature.upscale"),href:"link/to/docs/feature1.html",guideImage:"asset/path.gif"},[6]:{text:e("tooltip.feature.faceCorrection"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[7]:{text:e("tooltip.feature.imageToImage"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[8]:{text:e("tooltip.feature.boundingBox"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[9]:{text:e("tooltip.feature.seamCorrection"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[10]:{text:e("tooltip.feature.infillAndScaling"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"}}),[e])},AA=e=>DA()[e];function Nb(){const e=A(o=>o.system.isGFPGANAvailable),t=A(o=>o.postprocessing.shouldRunFacetool),n=Y(),r=o=>n(v3(o.target.checked));return l.jsx(En,{isDisabled:!e,isChecked:t,onChange:r})}const Fb=()=>{const e=Y(),t=A(o=>o.generation.seamless),n=o=>e(R1(o.target.checked)),{t:r}=K();return l.jsx(En,{label:r("parameters.seamlessTiling"),fontSize:"md",isChecked:t,onChange:n})},OA=()=>l.jsx(Fe,{gap:2,alignItems:"stretch",children:l.jsx(Fb,{})});function xp(){const e=A(s=>s.generation.horizontalSymmetrySteps),t=A(s=>s.generation.verticalSymmetrySteps),n=A(s=>s.generation.steps),r=Y(),{t:o}=K();return l.jsxs(Fe,{gap:2,alignItems:"stretch",children:[l.jsx(ut,{label:o("parameters.hSymmetryStep"),value:e,onChange:s=>r(Tv(s)),min:0,max:n,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>r(Tv(0))}),l.jsx(ut,{label:o("parameters.vSymmetryStep"),value:t,onChange:s=>r(_v(s)),min:0,max:n,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>r(_v(0))})]})}function bp(){const e=A(n=>n.generation.shouldUseSymmetry),t=Y();return l.jsx(En,{isChecked:e,onChange:n=>t(g3(n.target.checked))})}function zA(){const e=Y(),t=A(r=>r.generation.perlin),{t:n}=K();return l.jsx(ut,{label:n("parameters.perlinNoise"),min:0,max:1,step:.05,onChange:r=>e(nf(r)),handleReset:()=>e(nf(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}function RA(){const e=Y(),{t}=K(),n=A(o=>o.generation.shouldRandomizeSeed),r=o=>e(y3(o.target.checked));return l.jsx(En,{label:t("parameters.randomizeSeed"),isChecked:n,onChange:r})}function NA(){const e=Y(),t=A(o=>o.generation.shouldRandomizeSeed),{t:n}=K(),r=()=>e(is(x3(W1,H1)));return l.jsx(ni,{size:"sm",isDisabled:t,onClick:r,padding:"0 1.5rem",children:l.jsx("p",{children:n("parameters.shuffle")})})}function FA(){const e=A(c=>c.generation.seed),t=A(c=>c.generation.shouldRandomizeSeed),n=A(c=>c.generation.shouldGenerateVariations),{t:r}=K(),o=Y(),s=c=>o(is(c));return l.jsxs(oa,{gap:2,children:[l.jsx(Vr,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:W1,max:H1,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e,formControlProps:{display:"flex",alignItems:"center",gap:3}}),l.jsx(NA,{})]})}function LA(){const e=Y(),t=A(r=>r.generation.threshold),{t:n}=K();return l.jsx(ut,{label:n("parameters.noiseThreshold"),min:0,max:20,step:.1,onChange:r=>e(tf(r)),handleReset:()=>e(tf(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}const Sp=()=>l.jsxs(Fe,{gap:2,alignItems:"stretch",children:[l.jsx(RA,{}),l.jsx(FA,{}),l.jsx(LA,{}),l.jsx(zA,{})]});function Lb(){const e=A(o=>o.system.isESRGANAvailable),t=A(o=>o.postprocessing.shouldRunESRGAN),n=Y(),r=o=>n(b3(o.target.checked));return l.jsx(En,{isDisabled:!e,isChecked:t,onChange:r})}function Cp(){const e=A(r=>r.generation.shouldGenerateVariations),t=Y(),n=r=>t(S3(r.target.checked));return l.jsx(En,{isChecked:e,width:"auto",onChange:n})}function BA(){const e=A(s=>s.generation.seedWeights),t=A(s=>s.generation.shouldGenerateVariations),{t:n}=K(),r=Y(),o=s=>r(z1(s.target.value));return l.jsx(mt,{label:n("parameters.seedWeights"),value:e,isInvalid:t&&!(V1(e)||e===""),isDisabled:!t,onChange:o})}function HA(){const e=A(o=>o.generation.variationAmount),t=A(o=>o.generation.shouldGenerateVariations),{t:n}=K(),r=Y();return l.jsx(ut,{label:n("parameters.variationAmount"),value:e,step:.01,min:0,max:1,isSliderDisabled:!t,isInputDisabled:!t,isResetDisabled:!t,onChange:o=>r(Dv(o)),handleReset:()=>r(Dv(.1)),withInput:!0,withReset:!0,withSliderMarks:!0})}const wp=()=>l.jsxs(Fe,{gap:2,alignItems:"stretch",children:[l.jsx(HA,{}),l.jsx(BA,{})]});function q0(){const e=Y(),t=A(s=>s.generation.cfgScale),n=A(s=>s.ui.shouldUseSliders),{t:r}=K(),o=s=>e(of(s));return n?l.jsx(ut,{label:r("parameters.cfgScale"),step:.5,min:1.01,max:30,onChange:o,handleReset:()=>e(of(7.5)),value:t,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0}):l.jsx(Vr,{label:r("parameters.cfgScale"),step:.5,min:1.01,max:200,onChange:o,value:t,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})}function Y0(){const e=A(s=>s.generation.height),t=A(s=>s.ui.shouldUseSliders),n=A(bt),r=Y(),{t:o}=K();return t?l.jsx(ut,{isSliderDisabled:n==="unifiedCanvas",isInputDisabled:n==="unifiedCanvas",isResetDisabled:n==="unifiedCanvas",label:o("parameters.height"),value:e,min:64,step:64,max:2048,onChange:s=>r(Ll(s)),handleReset:()=>r(Ll(512)),withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:15360}}):l.jsx(Mn,{isDisabled:n==="unifiedCanvas",label:o("parameters.height"),value:e,flexGrow:1,onChange:s=>r(Ll(Number(s.target.value))),validValues:C3})}function K0(){const e=A(s=>s.generation.iterations),t=A(s=>s.ui.shouldUseSliders),n=Y(),{t:r}=K(),o=s=>n(Av(s));return t?l.jsx(ut,{label:r("parameters.images"),step:1,min:1,max:16,onChange:o,handleReset:()=>n(Av(1)),value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:9999}}):l.jsx(Vr,{label:r("parameters.images"),step:1,min:1,max:9999,onChange:o,value:e,numberInputFieldProps:{textAlign:"center"}})}function X0(){const e=A(s=>s.generation.sampler),t=A(qx),n=Y(),{t:r}=K(),o=s=>n(O1(s.target.value));return l.jsx(Mn,{label:r("parameters.sampler"),value:e,onChange:o,validValues:t.format==="diffusers"?w3:j3,minWidth:36})}function Q0(){const e=Y(),t=A(c=>c.generation.steps),n=A(c=>c.ui.shouldUseSliders),{t:r}=K(),o=c=>{e(rf(c))},s=()=>{e(U1())};return n?l.jsx(ut,{label:r("parameters.steps"),min:1,step:1,onChange:o,handleReset:()=>e(rf(20)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:9999}}):l.jsx(Vr,{label:r("parameters.steps"),min:1,max:9999,step:1,onChange:o,value:t,numberInputFieldProps:{textAlign:"center"},onBlur:s})}function Z0(){const e=A(s=>s.generation.width),t=A(s=>s.ui.shouldUseSliders),n=A(bt),{t:r}=K(),o=Y();return t?l.jsx(ut,{isSliderDisabled:n==="unifiedCanvas",isInputDisabled:n==="unifiedCanvas",isResetDisabled:n==="unifiedCanvas",label:r("parameters.width"),value:e,min:64,step:64,max:2048,onChange:s=>o(Fl(s)),handleReset:()=>o(Fl(512)),withInput:!0,withReset:!0,withSliderMarks:!0,inputReadOnly:!0,sliderNumberInputProps:{max:15360}}):l.jsx(Mn,{isDisabled:n==="unifiedCanvas",label:r("parameters.width"),value:e,flexGrow:1,onChange:s=>o(Fl(Number(s.target.value))),validValues:k3})}function jp(){return A(t=>t.ui.shouldUseSliders)?l.jsxs(Fe,{gap:2,children:[l.jsx(K0,{}),l.jsx(Q0,{}),l.jsx(q0,{}),l.jsx(Z0,{}),l.jsx(Y0,{}),l.jsx(X0,{})]}):l.jsxs(L,{rowGap:2,flexDirection:"column",children:[l.jsxs(L,{columnGap:1,children:[l.jsx(K0,{}),l.jsx(Q0,{}),l.jsx(q0,{})]}),l.jsxs(L,{columnGap:1,children:[l.jsx(Z0,{}),l.jsx(Y0,{}),l.jsx(X0,{})]})]})}const WA=me(Et,e=>e.shouldDisplayGuides),VA=({children:e,feature:t})=>{const n=A(WA),{text:r}=AA(t);return n?l.jsxs(Uh,{trigger:"hover",isLazy:!0,children:[l.jsx(Vh,{children:l.jsx(Ye,{children:e})}),l.jsxs(Gh,{maxWidth:"400px",onClick:o=>o.preventDefault(),cursor:"initial",children:[l.jsx($h,{}),l.jsx(Xy,{children:r})]})]}):null},UA=y.memo(VA),$A=fe(({feature:e,icon:t=RD},n)=>l.jsx(UA,{feature:e,children:l.jsx(Ye,{ref:n,children:l.jsx(tn,{marginBottom:"-.15rem",as:t})})})),GA=y.memo($A);function qA(e){const{header:t,feature:n,content:r,additionalHeaderComponents:o}=e;return l.jsxs(zi,{children:[l.jsx(Ai,{children:l.jsxs(L,{width:"100%",gap:2,align:"center",children:[l.jsx(Ye,{flexGrow:1,textAlign:"start",children:t}),o,n&&l.jsx(GA,{feature:n}),l.jsx(Oi,{})]})}),l.jsx(Ri,{children:r})]})}const kp=e=>{const{accordionInfo:t}=e,n=A(c=>c.system.openAccordions),r=Y(),o=c=>r(E3(c)),s=()=>{const c=[];return t&&Object.keys(t).forEach(u=>{const{header:f,feature:h,content:m,additionalHeaderComponents:v}=t[u];c.push(l.jsx(qA,{header:f,feature:h,content:m,additionalHeaderComponents:v},u))}),c};return l.jsx(ih,{defaultIndex:n,allowMultiple:!0,reduceMotion:!0,onChange:o,sx:{display:"flex",flexDirection:"column",gap:2},children:s()})},YA=e=>{const{menuType:t="icon",iconTooltip:n,buttonText:r,isLazy:o=!0,menuItems:s,menuProps:c,menuButtonProps:u,menuListProps:f,menuItemProps:h}=e,m=()=>{const v=[];return s.forEach((x,S)=>{v.push(l.jsx(gr,{onClick:x.onClick,fontSize:"sm",...h,children:x.item},S))}),v};return l.jsx(Ah,{...c,isLazy:o,children:({isOpen:v})=>l.jsxs(l.Fragment,{children:[l.jsx(zh,{as:t==="icon"?ho:ni,tooltip:n,"aria-label":n,icon:v?l.jsx($D,{}):l.jsx(UD,{}),paddingX:0,paddingY:t==="regular"?2:0,...u,children:t==="regular"&&r}),l.jsx(Oh,{zIndex:15,padding:0,...f,children:m()})]})})},KA=y.memo(YA),XA=me(Et,e=>({isProcessing:e.isProcessing,isConnected:e.isConnected,isCancelable:e.isCancelable,currentIteration:e.currentIteration,totalIterations:e.totalIterations,cancelType:e.cancelOptions.cancelType,cancelAfter:e.cancelOptions.cancelAfter}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),QA=e=>{const t=Y(),{btnGroupWidth:n="auto",...r}=e,{isProcessing:o,isConnected:s,isCancelable:c,currentIteration:u,totalIterations:f,cancelType:h,cancelAfter:m}=A(XA),v=y.useCallback(()=>{t(P3()),t(fd(null))},[t]),{t:x}=K(),S=m!==null;de("shift+x",()=>{(s||o)&&c&&v()},[s,o,c]),y.useEffect(()=>{m!==null&&mt(Ov("immediate"))},{item:x("parameters.cancel.schedule"),onClick:()=>t(Ov("scheduled"))}];return l.jsxs(Qt,{isAttached:!0,width:n,children:[h==="immediate"?l.jsx(se,{icon:l.jsx(GD,{}),tooltip:x("parameters.cancel.immediate"),"aria-label":x("parameters.cancel.immediate"),isDisabled:!s||!o||!c,onClick:v,colorScheme:"error",...r}):l.jsx(se,{icon:S?l.jsx(tc,{}):l.jsx(zD,{}),tooltip:x(S?"parameters.cancel.isScheduled":"parameters.cancel.schedule"),"aria-label":x(S?"parameters.cancel.isScheduled":"parameters.cancel.schedule"),isDisabled:!s||!o||!c||u===f,onClick:()=>{t(S?fd(null):fd(u))},colorScheme:"error",...r}),l.jsx(KA,{menuItems:C,iconTooltip:x("parameters.cancel.setType"),menuButtonProps:{colorScheme:"error",minWidth:5}})]})},Ep=y.memo(QA),tt=e=>e.canvas,Ot=me([tt,bt,Et],(e,t,n)=>e.layerState.stagingArea.images.length>0||t==="unifiedCanvas"&&n.isProcessing),Bb=e=>e.canvas.layerState.objects.find($1),Pp=e=>e.generation;me(Pp,({shouldRandomizeSeed:e,shouldGenerateVariations:t})=>e||t,{memoizeOptions:{resultEqualityCheck:ee.isEqual}});const Hb=me([Pp,Et,Bb,bt],(e,t,n,r)=>{const{prompt:o,shouldGenerateVariations:s,seedWeights:c,initialImage:u,seed:f}=e,{isProcessing:h,isConnected:m}=t;let v=!0;const x=[];return(!o||Boolean(o.match(/^[\s\r\n]+$/)))&&(v=!1,x.push("Missing prompt")),r==="img2img"&&!u&&(v=!1,x.push("No initial image selected")),h&&(v=!1,x.push("System Busy")),m||(v=!1,x.push("System Disconnected")),s&&(!(V1(c)||c==="")||f===-1)&&(v=!1,x.push("Seed-Weights badly formatted.")),{isReady:v,reasonsWhyNotReady:x}},{memoizeOptions:{equalityCheck:ee.isEqual,resultEqualityCheck:ee.isEqual}});function Ip(e){const{iconButton:t=!1,...n}=e,r=Y(),{isReady:o}=A(Hb),s=A(bt),c=()=>{r(sf(s))},{t:u}=K();return de(["ctrl+enter","meta+enter"],()=>{r(U1()),r(sf(s))},{enabled:()=>o,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,s]),l.jsx(Ye,{style:{flexGrow:4},children:t?l.jsx(se,{"aria-label":u("parameters.invoke"),type:"submit",icon:l.jsx(N9,{}),isDisabled:!o,onClick:c,flexGrow:1,w:"100%",tooltip:u("parameters.invoke"),tooltipProps:{placement:"bottom"},colorScheme:"accent",...n}):l.jsx(Je,{"aria-label":u("parameters.invoke"),type:"submit",isDisabled:!o,onClick:c,flexGrow:1,w:"100%",colorScheme:"accent",fontWeight:700,...n,children:"Invoke"})})}const ZA=me(vp,({shouldLoopback:e})=>e),JA=()=>{const e=Y(),t=A(ZA),{t:n}=K();return l.jsx(se,{"aria-label":n("parameters.toggleLoopback"),tooltip:n("parameters.toggleLoopback"),isChecked:t,icon:l.jsx(L9,{}),onClick:()=>{e(I3(!t))}})},Mp=()=>{const e=A(bt);return l.jsxs(L,{gap:2,children:[l.jsx(Ip,{}),e==="img2img"&&l.jsx(JA,{}),l.jsx(Ep,{})]})},Tp=()=>{const e=A(r=>r.generation.negativePrompt),t=Y(),{t:n}=K();return l.jsx(rt,{children:l.jsx(qh,{id:"negativePrompt",name:"negativePrompt",value:e,onChange:r=>t(_1(r.target.value)),placeholder:n("parameters.negativePrompts"),_focusVisible:{borderColor:"error.600"},fontSize:"sm"})})},eO=me([e=>e.generation,bt],(e,t)=>({prompt:e.prompt,activeTabName:t}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),_p=()=>{const e=Y(),{prompt:t,activeTabName:n}=A(eO),{isReady:r}=A(Hb),o=y.useRef(null),{t:s}=K(),c=f=>{e(T1(f.target.value))};de("alt+a",()=>{var f;(f=o.current)==null||f.focus()},[]);const u=f=>{f.key==="Enter"&&f.shiftKey===!1&&r&&(f.preventDefault(),e(sf(n)))};return l.jsx(Ye,{children:l.jsx(rt,{isInvalid:t.length===0||Boolean(t.match(/^[\s\r\n]+$/)),children:l.jsx(qh,{id:"prompt",name:"prompt",placeholder:s("parameters.promptPlaceholder"),value:t,onChange:c,onKeyDown:u,resize:"vertical",ref:o,minH:40})})})};function tO(){const e=Y(),t=A(o=>o.generation.shouldFitToWidthHeight),n=o=>e(F1(o.target.checked)),{t:r}=K();return l.jsx(En,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function Wb(e){const{t}=K(),{label:n=`${t("parameters.strength")}`}=e,r=A(u=>u.generation.img2imgStrength),o=Y(),s=u=>o(af(u)),c=()=>{o(af(.75))};return l.jsx(ut,{label:n,step:.01,min:.01,max:1,onChange:s,value:r,isInteger:!1,withInput:!0,withSliderMarks:!0,inputWidth:22,withReset:!0,handleReset:c})}function nO(){const{t:e}=K();return l.jsxs(Fe,{gap:2,alignItems:"stretch",children:[l.jsx(Wb,{label:e("parameters.img2imgStrength")}),l.jsx(tO,{})]})}const rO=()=>{const{t:e}=K(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(jp,{})},imageToImage:{header:`${e("parameters.imageToImage")}`,feature:void 0,content:l.jsx(nO,{})},seed:{header:`${e("parameters.seed")}`,feature:ln.SEED,content:l.jsx(Sp,{})},variations:{header:`${e("parameters.variations")}`,feature:ln.VARIATIONS,content:l.jsx(wp,{}),additionalHeaderComponents:l.jsx(Cp,{})},face_restore:{header:`${e("parameters.faceRestoration")}`,feature:ln.FACE_CORRECTION,content:l.jsx(pp,{}),additionalHeaderComponents:l.jsx(Nb,{})},upscale:{header:`${e("parameters.upscaling")}`,feature:ln.UPSCALE,content:l.jsx(mp,{}),additionalHeaderComponents:l.jsx(Lb,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(xp,{}),additionalHeaderComponents:l.jsx(bp,{})},other:{header:`${e("parameters.otherOptions")}`,feature:ln.OTHER,content:l.jsx(OA,{})}};return l.jsxs(L,{flexDir:"column",gap:2,position:"relative",children:[l.jsx(_p,{}),l.jsx(Tp,{}),l.jsx(Mp,{}),l.jsx(kp,{accordionInfo:t})]})},oO=y.memo(rO);function iO(){return l.jsx(hp,{parametersPanelContent:l.jsx(oO,{}),children:l.jsx(_A,{})})}const aO=()=>l.jsx(Ye,{sx:{width:"100%",height:"100%",borderRadius:"base",bg:"base.850"},children:l.jsx(L,{sx:{p:4,width:"100%",height:"100%"},children:l.jsx(Rb,{})})}),sO=me([vp],({hiresFix:e,hiresStrength:t})=>({hiresFix:e,hiresStrength:t}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),lO=()=>{const{hiresFix:e,hiresStrength:t}=A(sO),n=Y(),{t:r}=K(),o=c=>{n(zv(c))},s=()=>{n(zv(.75))};return l.jsx(ut,{label:r("parameters.hiresStrength"),step:.01,min:.01,max:.99,onChange:o,value:t,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})},cO=()=>{const e=Y(),t=A(o=>o.postprocessing.hiresFix),{t:n}=K(),r=o=>e(N1(o.target.checked));return l.jsx(En,{label:n("parameters.hiresOptim"),fontSize:"md",isChecked:t,onChange:r})},uO=()=>l.jsxs(Fe,{gap:2,alignItems:"stretch",children:[l.jsx(Fb,{}),l.jsx(cO,{}),l.jsx(lO,{})]}),dO=()=>{const{t:e}=K(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(jp,{})},seed:{header:`${e("parameters.seed")}`,feature:ln.SEED,content:l.jsx(Sp,{})},variations:{header:`${e("parameters.variations")}`,feature:ln.VARIATIONS,content:l.jsx(wp,{}),additionalHeaderComponents:l.jsx(Cp,{})},face_restore:{header:`${e("parameters.faceRestoration")}`,feature:ln.FACE_CORRECTION,content:l.jsx(pp,{}),additionalHeaderComponents:l.jsx(Nb,{})},upscale:{header:`${e("parameters.upscaling")}`,feature:ln.UPSCALE,content:l.jsx(mp,{}),additionalHeaderComponents:l.jsx(Lb,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(xp,{}),additionalHeaderComponents:l.jsx(bp,{})},other:{header:`${e("parameters.otherOptions")}`,feature:ln.OTHER,content:l.jsx(uO,{})}};return l.jsxs(L,{flexDir:"column",gap:2,children:[l.jsx(_p,{}),l.jsx(Tp,{}),l.jsx(Mp,{}),l.jsx(kp,{accordionInfo:t})]})},fO=y.memo(dO);function hO(){return l.jsx(hp,{parametersPanelContent:l.jsx(fO,{}),children:l.jsx(aO,{})})}var $f={},pO={get exports(){return $f},set exports(e){$f=e}};/** * @license React * react-reconciler.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var mO=function(t){var n={},r=y,o=Bl,s=Object.assign;function c(i){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+i,d=1;dO||g[E]!==b[O]){var V=` `+g[E].replace(" at new "," at ");return i.displayName&&V.includes("")&&(V=V.replace("",i.displayName)),V}while(1<=E&&0<=O);break}}}finally{eu=!1,Error.prepareStackTrace=d}return(i=i?i.displayName||i.name:"")?ua(i):""}var $4=Object.prototype.hasOwnProperty,nu=[],ci=-1;function Yr(i){return{current:i}}function St(i){0>ci||(i.current=nu[ci],nu[ci]=null,ci--)}function gt(i,a){ci++,nu[ci]=i.current,i.current=a}var Kr={},nn=Yr(Kr),yn=Yr(!1),Po=Kr;function ui(i,a){var d=i.type.contextTypes;if(!d)return Kr;var p=i.stateNode;if(p&&p.__reactInternalMemoizedUnmaskedChildContext===a)return p.__reactInternalMemoizedMaskedChildContext;var g={},b;for(b in d)g[b]=a[b];return p&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=a,i.__reactInternalMemoizedMaskedChildContext=g),g}function xn(i){return i=i.childContextTypes,i!=null}function js(){St(yn),St(nn)}function Up(i,a,d){if(nn.current!==Kr)throw Error(c(168));gt(nn,a),gt(yn,d)}function $p(i,a,d){var p=i.stateNode;if(a=a.childContextTypes,typeof p.getChildContext!="function")return d;p=p.getChildContext();for(var g in p)if(!(g in a))throw Error(c(108,z(i)||"Unknown",g));return s({},d,p)}function ks(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Kr,Po=nn.current,gt(nn,i),gt(yn,yn.current),!0}function Gp(i,a,d){var p=i.stateNode;if(!p)throw Error(c(169));d?(i=$p(i,a,Po),p.__reactInternalMemoizedMergedChildContext=i,St(yn),St(nn),gt(nn,i)):St(yn),gt(yn,d)}var qn=Math.clz32?Math.clz32:Y4,G4=Math.log,q4=Math.LN2;function Y4(i){return i>>>=0,i===0?32:31-(G4(i)/q4|0)|0}var Es=64,Ps=4194304;function da(i){switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function Is(i,a){var d=i.pendingLanes;if(d===0)return 0;var p=0,g=i.suspendedLanes,b=i.pingedLanes,E=d&268435455;if(E!==0){var O=E&~g;O!==0?p=da(O):(b&=E,b!==0&&(p=da(b)))}else E=d&~g,E!==0?p=da(E):b!==0&&(p=da(b));if(p===0)return 0;if(a!==0&&a!==p&&!(a&g)&&(g=p&-p,b=a&-a,g>=b||g===16&&(b&4194240)!==0))return a;if(p&4&&(p|=d&16),a=i.entangledLanes,a!==0)for(i=i.entanglements,a&=p;0d;d++)a.push(i);return a}function fa(i,a,d){i.pendingLanes|=a,a!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,a=31-qn(a),i[a]=d}function Q4(i,a){var d=i.pendingLanes&~a;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=a,i.mutableReadLanes&=a,i.entangledLanes&=a,a=i.entanglements;var p=i.eventTimes;for(i=i.expirationTimes;0>=E,g-=E,Tr=1<<32-qn(a)+g|d<it?(Xt=We,We=null):Xt=We.sibling;var at=be(H,We,G[it],Se);if(at===null){We===null&&(We=Xt);break}i&&We&&at.alternate===null&&a(H,We),R=b(at,R,it),Ke===null?De=at:Ke.sibling=at,Ke=at,We=Xt}if(it===G.length)return d(H,We),Pt&&Mo(H,it),De;if(We===null){for(;itit?(Xt=We,We=null):Xt=We.sibling;var ro=be(H,We,at.value,Se);if(ro===null){We===null&&(We=Xt);break}i&&We&&ro.alternate===null&&a(H,We),R=b(ro,R,it),Ke===null?De=ro:Ke.sibling=ro,Ke=ro,We=Xt}if(at.done)return d(H,We),Pt&&Mo(H,it),De;if(We===null){for(;!at.done;it++,at=G.next())at=He(H,at.value,Se),at!==null&&(R=b(at,R,it),Ke===null?De=at:Ke.sibling=at,Ke=at);return Pt&&Mo(H,it),De}for(We=p(H,We);!at.done;it++,at=G.next())at=Ct(We,H,it,at.value,Se),at!==null&&(i&&at.alternate!==null&&We.delete(at.key===null?it:at.key),R=b(at,R,it),Ke===null?De=at:Ke.sibling=at,Ke=at);return i&&We.forEach(function(RS){return a(H,RS)}),Pt&&Mo(H,it),De}function zr(H,R,G,Se){if(typeof G=="object"&&G!==null&&G.type===m&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case f:e:{for(var De=G.key,Ke=R;Ke!==null;){if(Ke.key===De){if(De=G.type,De===m){if(Ke.tag===7){d(H,Ke.sibling),R=g(Ke,G.props.children),R.return=H,H=R;break e}}else if(Ke.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===P&&dm(De)===Ke.type){d(H,Ke.sibling),R=g(Ke,G.props),R.ref=pa(H,Ke,G),R.return=H,H=R;break e}d(H,Ke);break}else a(H,Ke);Ke=Ke.sibling}G.type===m?(R=Ro(G.props.children,H.mode,Se,G.key),R.return=H,H=R):(Se=fl(G.type,G.key,G.props,null,H.mode,Se),Se.ref=pa(H,R,G),Se.return=H,H=Se)}return E(H);case h:e:{for(Ke=G.key;R!==null;){if(R.key===Ke)if(R.tag===4&&R.stateNode.containerInfo===G.containerInfo&&R.stateNode.implementation===G.implementation){d(H,R.sibling),R=g(R,G.children||[]),R.return=H,H=R;break e}else{d(H,R);break}else a(H,R);R=R.sibling}R=ud(G,H.mode,Se),R.return=H,H=R}return E(H);case P:return Ke=G._init,zr(H,R,Ke(G._payload),Se)}if(te(G))return ht(H,R,G,Se);if(_(G))return wn(H,R,G,Se);Bs(H,G)}return typeof G=="string"&&G!==""||typeof G=="number"?(G=""+G,R!==null&&R.tag===6?(d(H,R.sibling),R=g(R,G),R.return=H,H=R):(d(H,R),R=cd(G,H.mode,Se),R.return=H,H=R),E(H)):d(H,R)}return zr}var vi=fm(!0),hm=fm(!1),ma={},Rn=Yr(ma),va=Yr(ma),gi=Yr(ma);function dr(i){if(i===ma)throw Error(c(174));return i}function wu(i,a){gt(gi,a),gt(va,i),gt(Rn,ma),i=$(a),St(Rn),gt(Rn,i)}function yi(){St(Rn),St(va),St(gi)}function pm(i){var a=dr(gi.current),d=dr(Rn.current);a=Z(d,i.type,a),d!==a&&(gt(va,i),gt(Rn,a))}function ju(i){va.current===i&&(St(Rn),St(va))}var Tt=Yr(0);function Hs(i){for(var a=i;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Vp(d)||Zc(d)))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if(a.flags&128)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var ku=[];function Eu(){for(var i=0;id?d:4,i(!0);var p=Pu.transition;Pu.transition={};try{i(!1),a()}finally{ot=d,Pu.transition=p}}function Dm(){return Nn().memoizedState}function cS(i,a,d){var p=eo(i);if(d={lane:p,action:d,hasEagerState:!1,eagerState:null,next:null},Am(i))Om(a,d);else if(d=rm(i,a,d,p),d!==null){var g=sn();Fn(d,i,p,g),zm(d,a,p)}}function uS(i,a,d){var p=eo(i),g={lane:p,action:d,hasEagerState:!1,eagerState:null,next:null};if(Am(i))Om(a,g);else{var b=i.alternate;if(i.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var E=a.lastRenderedState,O=b(E,d);if(g.hasEagerState=!0,g.eagerState=O,Yn(O,E)){var V=a.interleaved;V===null?(g.next=g,xu(a)):(g.next=V.next,V.next=g),a.interleaved=g;return}}catch{}finally{}d=rm(i,a,g,p),d!==null&&(g=sn(),Fn(d,i,p,g),zm(d,a,p))}}function Am(i){var a=i.alternate;return i===_t||a!==null&&a===_t}function Om(i,a){ga=Vs=!0;var d=i.pending;d===null?a.next=a:(a.next=d.next,d.next=a),i.pending=a}function zm(i,a,d){if(d&4194240){var p=a.lanes;p&=i.pendingLanes,d|=p,a.lanes=d,iu(i,d)}}var Gs={readContext:zn,useCallback:rn,useContext:rn,useEffect:rn,useImperativeHandle:rn,useInsertionEffect:rn,useLayoutEffect:rn,useMemo:rn,useReducer:rn,useRef:rn,useState:rn,useDebugValue:rn,useDeferredValue:rn,useTransition:rn,useMutableSource:rn,useSyncExternalStore:rn,useId:rn,unstable_isNewReconciler:!1},dS={readContext:zn,useCallback:function(i,a){return fr().memoizedState=[i,a===void 0?null:a],i},useContext:zn,useEffect:jm,useImperativeHandle:function(i,a,d){return d=d!=null?d.concat([i]):null,Us(4194308,4,Pm.bind(null,a,i),d)},useLayoutEffect:function(i,a){return Us(4194308,4,i,a)},useInsertionEffect:function(i,a){return Us(4,2,i,a)},useMemo:function(i,a){var d=fr();return a=a===void 0?null:a,i=i(),d.memoizedState=[i,a],i},useReducer:function(i,a,d){var p=fr();return a=d!==void 0?d(a):a,p.memoizedState=p.baseState=a,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:a},p.queue=i,i=i.dispatch=cS.bind(null,_t,i),[p.memoizedState,i]},useRef:function(i){var a=fr();return i={current:i},a.memoizedState=i},useState:Cm,useDebugValue:Ou,useDeferredValue:function(i){return fr().memoizedState=i},useTransition:function(){var i=Cm(!1),a=i[0];return i=lS.bind(null,i[1]),fr().memoizedState=i,[a,i]},useMutableSource:function(){},useSyncExternalStore:function(i,a,d){var p=_t,g=fr();if(Pt){if(d===void 0)throw Error(c(407));d=d()}else{if(d=a(),Kt===null)throw Error(c(349));_o&30||gm(p,a,d)}g.memoizedState=d;var b={value:d,getSnapshot:a};return g.queue=b,jm(xm.bind(null,p,b,i),[i]),p.flags|=2048,ba(9,ym.bind(null,p,b,d,a),void 0,null),d},useId:function(){var i=fr(),a=Kt.identifierPrefix;if(Pt){var d=_r,p=Tr;d=(p&~(1<<32-qn(p)-1)).toString(32)+d,a=":"+a+"R"+d,d=ya++,0td&&(a.flags|=128,p=!0,wa(g,!1),a.lanes=4194304)}else{if(!p)if(i=Hs(b),i!==null){if(a.flags|=128,p=!0,i=i.updateQueue,i!==null&&(a.updateQueue=i,a.flags|=4),wa(g,!0),g.tail===null&&g.tailMode==="hidden"&&!b.alternate&&!Pt)return on(a),null}else 2*qt()-g.renderingStartTime>td&&d!==1073741824&&(a.flags|=128,p=!0,wa(g,!1),a.lanes=4194304);g.isBackwards?(b.sibling=a.child,a.child=b):(i=g.last,i!==null?i.sibling=b:a.child=b,g.last=b)}return g.tail!==null?(a=g.tail,g.rendering=a,g.tail=a.sibling,g.renderingStartTime=qt(),a.sibling=null,i=Tt.current,gt(Tt,p?i&1|2:i&1),a):(on(a),null);case 22:case 23:return ad(),d=a.memoizedState!==null,i!==null&&i.memoizedState!==null!==d&&(a.flags|=8192),d&&a.mode&1?_n&1073741824&&(on(a),ve&&a.subtreeFlags&6&&(a.flags|=8192)):on(a),null;case 24:return null;case 25:return null}throw Error(c(156,a.tag))}function xS(i,a){switch(du(a),a.tag){case 1:return xn(a.type)&&js(),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return yi(),St(yn),St(nn),Eu(),i=a.flags,i&65536&&!(i&128)?(a.flags=i&-65537|128,a):null;case 5:return ju(a),null;case 13:if(St(Tt),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(c(340));hi()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return St(Tt),null;case 4:return yi(),null;case 10:return gu(a.type._context),null;case 22:case 23:return ad(),null;case 24:return null;default:return null}}var Qs=!1,an=!1,bS=typeof WeakSet=="function"?WeakSet:Set,we=null;function bi(i,a){var d=i.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(p){It(i,a,p)}else d.current=null}function Vu(i,a,d){try{d()}catch(p){It(i,a,p)}}var ev=!1;function SS(i,a){for(oe(i.containerInfo),we=a;we!==null;)if(i=we,a=i.child,(i.subtreeFlags&1028)!==0&&a!==null)a.return=i,we=a;else for(;we!==null;){i=we;try{var d=i.alternate;if(i.flags&1024)switch(i.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var p=d.memoizedProps,g=d.memoizedState,b=i.stateNode,E=b.getSnapshotBeforeUpdate(i.elementType===i.type?p:Xn(i.type,p),g);b.__reactInternalSnapshotBeforeUpdate=E}break;case 3:ve&&Eo(i.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(c(163))}}catch(O){It(i,i.return,O)}if(a=i.sibling,a!==null){a.return=i.return,we=a;break}we=i.return}return d=ev,ev=!1,d}function ja(i,a,d){var p=a.updateQueue;if(p=p!==null?p.lastEffect:null,p!==null){var g=p=p.next;do{if((g.tag&i)===i){var b=g.destroy;g.destroy=void 0,b!==void 0&&Vu(a,d,b)}g=g.next}while(g!==p)}}function Zs(i,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&i)===i){var p=d.create;d.destroy=p()}d=d.next}while(d!==a)}}function Uu(i){var a=i.ref;if(a!==null){var d=i.stateNode;switch(i.tag){case 5:i=re(d);break;default:i=d}typeof a=="function"?a(i):a.current=i}}function tv(i){var a=i.alternate;a!==null&&(i.alternate=null,tv(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&Be(a)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function nv(i){return i.tag===5||i.tag===3||i.tag===4}function rv(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||nv(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function $u(i,a,d){var p=i.tag;if(p===5||p===6)i=i.stateNode,a?dn(d,i,a):Le(d,i);else if(p!==4&&(i=i.child,i!==null))for($u(i,a,d),i=i.sibling;i!==null;)$u(i,a,d),i=i.sibling}function Gu(i,a,d){var p=i.tag;if(p===5||p===6)i=i.stateNode,a?_e(d,i,a):J(d,i);else if(p!==4&&(i=i.child,i!==null))for(Gu(i,a,d),i=i.sibling;i!==null;)Gu(i,a,d),i=i.sibling}var Zt=null,Qn=!1;function pr(i,a,d){for(d=d.child;d!==null;)qu(i,a,d),d=d.sibling}function qu(i,a,d){if(lr&&typeof lr.onCommitFiberUnmount=="function")try{lr.onCommitFiberUnmount(Ms,d)}catch{}switch(d.tag){case 5:an||bi(d,a);case 6:if(ve){var p=Zt,g=Qn;Zt=null,pr(i,a,d),Zt=p,Qn=g,Zt!==null&&(Qn?fn(Zt,d.stateNode):Vt(Zt,d.stateNode))}else pr(i,a,d);break;case 18:ve&&Zt!==null&&(Qn?H4(Zt,d.stateNode):B4(Zt,d.stateNode));break;case 4:ve?(p=Zt,g=Qn,Zt=d.stateNode.containerInfo,Qn=!0,pr(i,a,d),Zt=p,Qn=g):(Te&&(p=d.stateNode.containerInfo,g=Lp(p),Qc(p,g)),pr(i,a,d));break;case 0:case 11:case 14:case 15:if(!an&&(p=d.updateQueue,p!==null&&(p=p.lastEffect,p!==null))){g=p=p.next;do{var b=g,E=b.destroy;b=b.tag,E!==void 0&&(b&2||b&4)&&Vu(d,a,E),g=g.next}while(g!==p)}pr(i,a,d);break;case 1:if(!an&&(bi(d,a),p=d.stateNode,typeof p.componentWillUnmount=="function"))try{p.props=d.memoizedProps,p.state=d.memoizedState,p.componentWillUnmount()}catch(O){It(d,a,O)}pr(i,a,d);break;case 21:pr(i,a,d);break;case 22:d.mode&1?(an=(p=an)||d.memoizedState!==null,pr(i,a,d),an=p):pr(i,a,d);break;default:pr(i,a,d)}}function ov(i){var a=i.updateQueue;if(a!==null){i.updateQueue=null;var d=i.stateNode;d===null&&(d=i.stateNode=new bS),a.forEach(function(p){var g=TS.bind(null,i,p);d.has(p)||(d.add(p),p.then(g,g))})}}function Zn(i,a){var d=a.deletions;if(d!==null)for(var p=0;p";case el:return":has("+(Xu(i)||"")+")";case tl:return'[role="'+i.value+'"]';case rl:return'"'+i.value+'"';case nl:return'[data-testname="'+i.value+'"]';default:throw Error(c(365))}}function uv(i,a){var d=[];i=[i,0];for(var p=0;pg&&(g=E),p&=~b}if(p=g,p=qt()-p,p=(120>p?120:480>p?480:1080>p?1080:1920>p?1920:3e3>p?3e3:4320>p?4320:1960*wS(p/1960))-p,10i?16:i,Jr===null)var p=!1;else{if(i=Jr,Jr=null,ll=0,Xe&6)throw Error(c(331));var g=Xe;for(Xe|=4,we=i.current;we!==null;){var b=we,E=b.child;if(we.flags&16){var O=b.deletions;if(O!==null){for(var V=0;Vqt()-ed?Ao(i,0):Ju|=d),Cn(i,a)}function xv(i,a){a===0&&(i.mode&1?(a=Ps,Ps<<=1,!(Ps&130023424)&&(Ps=4194304)):a=1);var d=sn();i=ur(i,a),i!==null&&(fa(i,a,d),Cn(i,d))}function MS(i){var a=i.memoizedState,d=0;a!==null&&(d=a.retryLane),xv(i,d)}function TS(i,a){var d=0;switch(i.tag){case 13:var p=i.stateNode,g=i.memoizedState;g!==null&&(d=g.retryLane);break;case 19:p=i.stateNode;break;default:throw Error(c(314))}p!==null&&p.delete(a),xv(i,d)}var bv;bv=function(i,a,d){if(i!==null)if(i.memoizedProps!==a.pendingProps||yn.current)bn=!0;else{if(!(i.lanes&d)&&!(a.flags&128))return bn=!1,gS(i,a,d);bn=!!(i.flags&131072)}else bn=!1,Pt&&a.flags&1048576&&Qp(a,Ds,a.index);switch(a.lanes=0,a.tag){case 2:var p=a.type;Ys(i,a),i=a.pendingProps;var g=ui(a,nn.current);mi(a,d),g=Mu(null,a,p,i,g,d);var b=Tu();return a.flags|=1,typeof g=="object"&&g!==null&&typeof g.render=="function"&&g.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,xn(p)?(b=!0,ks(a)):b=!1,a.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,bu(a),g.updater=Ls,a.stateNode=g,g._reactInternals=a,Cu(a,p,i,d),a=Fu(null,a,p,!0,b,d)):(a.tag=0,Pt&&b&&uu(a),hn(null,a,g,d),a=a.child),a;case 16:p=a.elementType;e:{switch(Ys(i,a),i=a.pendingProps,g=p._init,p=g(p._payload),a.type=p,g=a.tag=DS(p),i=Xn(p,i),g){case 0:a=Nu(null,a,p,i,d);break e;case 1:a=Gm(null,a,p,i,d);break e;case 11:a=Hm(null,a,p,i,d);break e;case 14:a=Wm(null,a,p,Xn(p.type,i),d);break e}throw Error(c(306,p,""))}return a;case 0:return p=a.type,g=a.pendingProps,g=a.elementType===p?g:Xn(p,g),Nu(i,a,p,g,d);case 1:return p=a.type,g=a.pendingProps,g=a.elementType===p?g:Xn(p,g),Gm(i,a,p,g,d);case 3:e:{if(qm(a),i===null)throw Error(c(387));p=a.pendingProps,b=a.memoizedState,g=b.element,om(i,a),Fs(a,p,null,d);var E=a.memoizedState;if(p=E.element,Ge&&b.isDehydrated)if(b={element:p,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){g=xi(Error(c(423)),a),a=Ym(i,a,p,d,g);break e}else if(p!==g){g=xi(Error(c(424)),a),a=Ym(i,a,p,d,g);break e}else for(Ge&&(On=D4(a.stateNode.containerInfo),Tn=a,Pt=!0,Kn=null,ha=!1),d=hm(a,null,p,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(hi(),p===g){a=Ar(i,a,d);break e}hn(i,a,p,d)}a=a.child}return a;case 5:return pm(a),i===null&&hu(a),p=a.type,g=a.pendingProps,b=i!==null?i.memoizedProps:null,E=g.children,ce(p,g)?E=null:b!==null&&ce(p,b)&&(a.flags|=32),$m(i,a),hn(i,a,E,d),a.child;case 6:return i===null&&hu(a),null;case 13:return Km(i,a,d);case 4:return wu(a,a.stateNode.containerInfo),p=a.pendingProps,i===null?a.child=vi(a,null,p,d):hn(i,a,p,d),a.child;case 11:return p=a.type,g=a.pendingProps,g=a.elementType===p?g:Xn(p,g),Hm(i,a,p,g,d);case 7:return hn(i,a,a.pendingProps,d),a.child;case 8:return hn(i,a,a.pendingProps.children,d),a.child;case 12:return hn(i,a,a.pendingProps.children,d),a.child;case 10:e:{if(p=a.type._context,g=a.pendingProps,b=a.memoizedProps,E=g.value,nm(a,p,E),b!==null)if(Yn(b.value,E)){if(b.children===g.children&&!yn.current){a=Ar(i,a,d);break e}}else for(b=a.child,b!==null&&(b.return=a);b!==null;){var O=b.dependencies;if(O!==null){E=b.child;for(var V=O.firstContext;V!==null;){if(V.context===p){if(b.tag===1){V=Dr(-1,d&-d),V.tag=2;var ie=b.updateQueue;if(ie!==null){ie=ie.shared;var ke=ie.pending;ke===null?V.next=V:(V.next=ke.next,ke.next=V),ie.pending=V}}b.lanes|=d,V=b.alternate,V!==null&&(V.lanes|=d),yu(b.return,d,a),O.lanes|=d;break}V=V.next}}else if(b.tag===10)E=b.type===a.type?null:b.child;else if(b.tag===18){if(E=b.return,E===null)throw Error(c(341));E.lanes|=d,O=E.alternate,O!==null&&(O.lanes|=d),yu(E,d,a),E=b.sibling}else E=b.child;if(E!==null)E.return=b;else for(E=b;E!==null;){if(E===a){E=null;break}if(b=E.sibling,b!==null){b.return=E.return,E=b;break}E=E.return}b=E}hn(i,a,g.children,d),a=a.child}return a;case 9:return g=a.type,p=a.pendingProps.children,mi(a,d),g=zn(g),p=p(g),a.flags|=1,hn(i,a,p,d),a.child;case 14:return p=a.type,g=Xn(p,a.pendingProps),g=Xn(p.type,g),Wm(i,a,p,g,d);case 15:return Vm(i,a,a.type,a.pendingProps,d);case 17:return p=a.type,g=a.pendingProps,g=a.elementType===p?g:Xn(p,g),Ys(i,a),a.tag=1,xn(p)?(i=!0,ks(a)):i=!1,mi(a,d),cm(a,p,g),Cu(a,p,g,d),Fu(null,a,p,!0,i,d);case 19:return Qm(i,a,d);case 22:return Um(i,a,d)}throw Error(c(156,a.tag))};function Sv(i,a){return au(i,a)}function _S(i,a,d,p){this.tag=i,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ln(i,a,d,p){return new _S(i,a,d,p)}function ld(i){return i=i.prototype,!(!i||!i.isReactComponent)}function DS(i){if(typeof i=="function")return ld(i)?1:0;if(i!=null){if(i=i.$$typeof,i===j)return 11;if(i===M)return 14}return 2}function no(i,a){var d=i.alternate;return d===null?(d=Ln(i.tag,a,i.key,i.mode),d.elementType=i.elementType,d.type=i.type,d.stateNode=i.stateNode,d.alternate=i,i.alternate=d):(d.pendingProps=a,d.type=i.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=i.flags&14680064,d.childLanes=i.childLanes,d.lanes=i.lanes,d.child=i.child,d.memoizedProps=i.memoizedProps,d.memoizedState=i.memoizedState,d.updateQueue=i.updateQueue,a=i.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=i.sibling,d.index=i.index,d.ref=i.ref,d}function fl(i,a,d,p,g,b){var E=2;if(p=i,typeof i=="function")ld(i)&&(E=1);else if(typeof i=="string")E=5;else e:switch(i){case m:return Ro(d.children,g,b,a);case v:E=8,g|=8;break;case x:return i=Ln(12,d,a,g|2),i.elementType=x,i.lanes=b,i;case w:return i=Ln(13,d,a,g),i.elementType=w,i.lanes=b,i;case k:return i=Ln(19,d,a,g),i.elementType=k,i.lanes=b,i;case I:return hl(d,g,b,a);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case S:E=10;break e;case C:E=9;break e;case j:E=11;break e;case M:E=14;break e;case P:E=16,p=null;break e}throw Error(c(130,i==null?i:typeof i,""))}return a=Ln(E,d,a,g),a.elementType=i,a.type=p,a.lanes=b,a}function Ro(i,a,d,p){return i=Ln(7,i,p,a),i.lanes=d,i}function hl(i,a,d,p){return i=Ln(22,i,p,a),i.elementType=I,i.lanes=d,i.stateNode={isHidden:!1},i}function cd(i,a,d){return i=Ln(6,i,null,a),i.lanes=d,i}function ud(i,a,d){return a=Ln(4,i.children!==null?i.children:[],i.key,a),a.lanes=d,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}function AS(i,a,d,p,g){this.tag=a,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=$e,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ou(0),this.expirationTimes=ou(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ou(0),this.identifierPrefix=p,this.onRecoverableError=g,Ge&&(this.mutableSourceEagerHydrationData=null)}function Cv(i,a,d,p,g,b,E,O,V){return i=new AS(i,a,d,O,V),a===1?(a=1,b===!0&&(a|=8)):a=0,b=Ln(3,null,null,a),i.current=b,b.stateNode=i,b.memoizedState={element:p,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},bu(b),i}function wv(i){if(!i)return Kr;i=i._reactInternals;e:{if(W(i)!==i||i.tag!==1)throw Error(c(170));var a=i;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(xn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(c(171))}if(i.tag===1){var d=i.type;if(xn(d))return $p(i,d,a)}return a}function jv(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(c(188)):(i=Object.keys(i).join(","),Error(c(268,i)));return i=Q(a),i===null?null:i.stateNode}function kv(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var d=i.retryLane;i.retryLane=d!==0&&d=ie&&b>=He&&g<=ke&&E<=be){i.splice(a,1);break}else if(p!==ie||d.width!==V.width||beE){if(!(b!==He||d.height!==V.height||keg)){ie>p&&(V.width+=ie-p,V.x=p),keb&&(V.height+=He-b,V.y=b),bed&&(d=E)),E ")+` No matching component was found for: `)+i.join(" > ")}return null},n.getPublicRootInstance=function(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return re(i.child.stateNode);default:return i.child.stateNode}},n.injectIntoDevTools=function(i){if(i={bundleType:i.bundleType,version:i.version,rendererPackageName:i.rendererPackageName,rendererConfig:i.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:u.ReactCurrentDispatcher,findHostInstanceByFiber:OS,findFiberByHostInstance:i.findFiberByHostInstance||zS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")i=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)i=!0;else{try{Ms=a.inject(i),lr=a}catch{}i=!!a.checkDCE}}return i},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(i,a,d,p){if(!N)throw Error(c(363));i=Qu(i,a);var g=Ze(i,d,p).disconnect;return{disconnect:function(){g()}}},n.registerMutableSourceForHydration=function(i,a){var d=a._getVersion;d=d(a._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[a,d]:i.mutableSourceEagerHydrationData.push(a,d)},n.runWithPriority=function(i,a){var d=ot;try{return ot=i,a()}finally{ot=d}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(i,a,d,p){var g=a.current,b=sn(),E=eo(g);return d=wv(d),a.context===null?a.context=d:a.pendingContext=d,a=Dr(b,E),a.payload={element:i},p=p===void 0?null:p,p!==null&&(a.callback=p),i=Qr(g,a,E),i!==null&&(Fn(i,g,E,b),Ns(i,g,E)),E},n};(function(e){e.exports=mO})(pO);const vO=M3($f);var pc={},gO={get exports(){return pc},set exports(e){pc=e}},li={};/** * @license React * react-reconciler-constants.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */li.ConcurrentRoot=1;li.ContinuousEventPriority=4;li.DefaultEventPriority=16;li.DiscreteEventPriority=1;li.IdleEventPriority=536870912;li.LegacyRoot=0;(function(e){e.exports=li})(gO);const J0={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let e1=!1,t1=!1;const Dp=".react-konva-event",yO=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. Position of a node will be changed during drag&drop, so you should update state of the react app as well. Consider to add onDragMove or onDragEnd events. For more info see: https://github.com/konvajs/react-konva/issues/256 `,xO=`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 `,bO={};function Vc(e,t,n=bO){if(!e1&&"zIndex"in t&&(console.warn(xO),e1=!0),!t1&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(yO),t1=!0)}for(var s in n)if(!J0[s]){var c=s.slice(0,2)==="on",u=n[s]!==t[s];if(c&&u){var f=s.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),e.off(f,n[s])}var h=!t.hasOwnProperty(s);h&&e.setAttr(s,void 0)}var m=t._useStrictMode,v={},x=!1;const S={};for(var s in t)if(!J0[s]){var c=s.slice(0,2)==="on",C=n[s]!==t[s];if(c&&C){var f=s.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),t[s]&&(S[f]=t[s])}!c&&(t[s]!==n[s]||m&&t[s]!==e.getAttr(s))&&(x=!0,v[s]=t[s])}x&&(e.setAttrs(v),wo(e));for(var f in S)e.on(f+Dp,S[f])}function wo(e){if(!T3.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const Vb={},SO={};Ua.Node.prototype._applyProps=Vc;function CO(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),wo(e)}function wO(e,t,n){let r=Ua[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=Ua.Group);const o={},s={};for(var c in t){var u=c.slice(0,2)==="on";u?s[c]=t[c]:o[c]=t[c]}const f=new r(o);return Vc(f,s),f}function jO(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function kO(e,t,n){return!1}function EO(e){return e}function PO(){return null}function IO(){return null}function MO(e,t,n,r){return SO}function TO(){}function _O(e){}function DO(e,t){return!1}function AO(){return Vb}function OO(){return Vb}const zO=setTimeout,RO=clearTimeout,NO=-1;function FO(e,t){return!1}const LO=!1,BO=!0,HO=!0;function WO(e,t){t.parent===e?t.moveToTop():e.add(t),wo(e)}function VO(e,t){t.parent===e?t.moveToTop():e.add(t),wo(e)}function Ub(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),wo(e)}function UO(e,t,n){Ub(e,t,n)}function $O(e,t){t.destroy(),t.off(Dp),wo(e)}function GO(e,t){t.destroy(),t.off(Dp),wo(e)}function qO(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function YO(e,t,n){}function KO(e,t,n,r,o){Vc(e,o,r)}function XO(e){e.hide(),wo(e)}function QO(e){}function ZO(e,t){(t.visible==null||t.visible)&&e.show()}function JO(e,t){}function ez(e){}function tz(){}const nz=()=>pc.DefaultEventPriority,rz=Object.freeze(Object.defineProperty({__proto__:null,appendChild:WO,appendChildToContainer:VO,appendInitialChild:CO,cancelTimeout:RO,clearContainer:ez,commitMount:YO,commitTextUpdate:qO,commitUpdate:KO,createInstance:wO,createTextInstance:jO,detachDeletedInstance:tz,finalizeInitialChildren:kO,getChildHostContext:OO,getCurrentEventPriority:nz,getPublicInstance:EO,getRootHostContext:AO,hideInstance:XO,hideTextInstance:QO,idlePriority:Bl.unstable_IdlePriority,insertBefore:Ub,insertInContainerBefore:UO,isPrimaryRenderer:LO,noTimeout:NO,now:Bl.unstable_now,prepareForCommit:PO,preparePortalMount:IO,prepareUpdate:MO,removeChild:$O,removeChildFromContainer:GO,resetAfterCommit:TO,resetTextContent:_O,run:Bl.unstable_runWithPriority,scheduleTimeout:zO,shouldDeprioritizeSubtree:DO,shouldSetTextContent:FO,supportsMutation:HO,unhideInstance:ZO,unhideTextInstance:JO,warnsIfNotActing:BO},Symbol.toStringTag,{value:"Module"}));var oz=Object.defineProperty,iz=Object.defineProperties,az=Object.getOwnPropertyDescriptors,n1=Object.getOwnPropertySymbols,sz=Object.prototype.hasOwnProperty,lz=Object.prototype.propertyIsEnumerable,r1=(e,t,n)=>t in e?oz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,o1=(e,t)=>{for(var n in t||(t={}))sz.call(t,n)&&r1(e,n,t[n]);if(n1)for(var n of n1(t))lz.call(t,n)&&r1(e,n,t[n]);return e},cz=(e,t)=>iz(e,az(t));function $b(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=$b(r,t,n);if(o)return o;r=t?null:r.sibling}}function Gb(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const Ap=Gb(y.createContext(null));class qb extends y.Component{render(){return y.createElement(Ap.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:uz,ReactCurrentDispatcher:dz}=y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function fz(){const e=y.useContext(Ap);if(!e)throw new Error("its-fine: useFiber must be called within a !");const t=y.useId();return y.useMemo(()=>{var r;return(r=uz.current)!=null?r:$b(e,!1,o=>{let s=o.memoizedState;for(;s;){if(s.memoizedState===t)return!0;s=s.next}})},[e,t])}function hz(){var e,t;const n=fz(),[r]=y.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==Ap&&!r.has(s)&&r.set(s,(t=dz.current)==null?void 0:t.readContext(Gb(s))),o=o.return}return y.useMemo(()=>Array.from(r.keys()).reduce((s,c)=>u=>y.createElement(s,null,y.createElement(c.Provider,cz(o1({},u),{value:r.get(c)}))),s=>y.createElement(qb,o1({},s))),[r])}function pz(e){const t=Me.useRef();return Me.useLayoutEffect(()=>{t.current=e}),t.current}const mz=e=>{const t=Me.useRef(),n=Me.useRef(),r=Me.useRef(),o=pz(e),s=hz(),c=u=>{const{forwardedRef:f}=e;f&&(typeof f=="function"?f(u):f.current=u)};return Me.useLayoutEffect(()=>(n.current=new Ua.Stage({width:e.width,height:e.height,container:t.current}),c(n.current),r.current=Na.createContainer(n.current,pc.LegacyRoot,!1,null),Na.updateContainer(Me.createElement(s,{},e.children),r.current),()=>{Ua.isBrowser&&(c(null),Na.updateContainer(null,r.current,null),n.current.destroy())}),[]),Me.useLayoutEffect(()=>{c(n.current),Vc(n.current,e,o),Na.updateContainer(Me.createElement(s,{},e.children),r.current,null)}),Me.createElement("div",{ref:t,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},Aa="Layer",Ur="Group",$r="Rect",Fo="Circle",mc="Line",Yb="Image",vz="Transformer",Na=vO(rz);Na.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:Me.version,rendererPackageName:"react-konva"});const gz=Me.forwardRef((e,t)=>Me.createElement(qb,{},Me.createElement(mz,{...e,forwardedRef:t}))),yz=me([tt,Ot],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),xz=()=>{const e=Y(),{tool:t,isStaging:n,isMovingBoundingBox:r}=A(yz);return{handleDragStart:y.useCallback(()=>{(t==="move"||n)&&!r&&e(Kl(!0))},[e,r,n,t]),handleDragMove:y.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(G1(s))},[e,r,n,t]),handleDragEnd:y.useCallback(()=>{(t==="move"||n)&&!r&&e(Kl(!1))},[e,r,n,t])}},bz=me([tt,bt,Ot],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:c,isMaskEnabled:u,shouldSnapToGrid:f}=e;return{activeTabName:t,isCursorOnCanvas:Boolean(r),shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:c,isStaging:n,isMaskEnabled:u,shouldSnapToGrid:f}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Sz=()=>{const e=Y(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:c}=A(bz),u=y.useRef(null),f=q1(),h=()=>e(Zf());de(["shift+c"],()=>{h()},{enabled:()=>!o,preventDefault:!0},[]);const m=()=>e(as(!s));de(["h"],()=>{m()},{enabled:()=>!o,preventDefault:!0},[s]),de(["n"],()=>{e(Xl(!c))},{enabled:!0,preventDefault:!0},[c]),de("esc",()=>{e(_3())},{enabled:()=>!0,preventDefault:!0}),de("shift+h",()=>{e(D3(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),de(["space"],v=>{v.repeat||(f==null||f.container().focus(),r!=="move"&&(u.current=r,e(Sr("move"))),r==="move"&&u.current&&u.current!=="move"&&(e(Sr(u.current)),u.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,u])},Op=e=>{const t=e.getPointerPosition(),n=e.getAbsoluteTransform().copy();if(!t||!n)return;const r=n.invert().point(t);return{x:r.x,y:r.y}},Kb=()=>{const e=Y(),t=jr(),n=q1();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=A3.pixelRatio,[s,c,u,f]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;e(O3({r:s,g:c,b:u,a:f}))},commitColorUnderCursor:()=>{e(z3())}}},Cz=me([bt,tt,Ot],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),wz=e=>{const t=Y(),{tool:n,isStaging:r}=A(Cz),{commitColorUnderCursor:o}=Kb();return y.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Kl(!0));return}if(n==="colorPicker"){o();return}const c=Op(e.current);c&&(s.evt.preventDefault(),t(Y1(!0)),t(R3([c.x,c.y])))},[e,n,r,t,o])},jz=me([bt,tt,Ot],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),kz=(e,t,n)=>{const r=Y(),{isDrawing:o,tool:s,isStaging:c}=A(jz),{updateColorUnderCursor:u}=Kb();return y.useCallback(()=>{if(!e.current)return;const f=Op(e.current);if(f){if(r(N3(f)),n.current=f,s==="colorPicker"){u();return}!o||s==="move"||c||(t.current=!0,r(K1([f.x,f.y])))}},[t,r,o,c,n,e,s,u])},Ez=()=>{const e=Y();return y.useCallback(()=>{e(F3())},[e])},Pz=me([bt,tt,Ot],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Iz=(e,t)=>{const n=Y(),{tool:r,isDrawing:o,isStaging:s}=A(Pz);return y.useCallback(()=>{if(r==="move"||s){n(Kl(!1));return}if(!t.current&&o&&e.current){const c=Op(e.current);if(!c)return;n(K1([c.x,c.y]))}else t.current=!1;n(Y1(!1))},[t,n,o,s,e,r])},Mz=me([tt],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Tz=e=>{const t=Y(),{isMoveStageKeyHeld:n,stageScale:r}=A(Mz);return y.useCallback(o=>{if(!e.current||n)return;o.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const c={x:(s.x-e.current.x())/r,y:(s.y-e.current.y())/r};let u=o.evt.deltaY;o.evt.ctrlKey&&(u=-u);const f=ee.clamp(r*L3**u,B3,H3),h={x:s.x-c.x*f,y:s.y-c.y*f};t(W3(f)),t(G1(h))},[e,n,r,t])},_z=me(tt,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:o,shouldDarkenOutsideBoundingBox:s,stageCoordinates:c}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:c,stageDimensions:r,stageScale:o}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Dz=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=A(_z);return l.jsxs(Ur,{children:[l.jsx($r,{offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fill:"rgba(0,0,0,0.4)",listening:!1,visible:n}),l.jsx($r,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},Az=me([tt],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Oz=()=>{const e=A(f=>f.ui.currentTheme),{stageScale:t,stageCoordinates:n,stageDimensions:r}=A(Az),[o,s]=y.useState([]),[c]=k1("colors",["gridLineColor"]),u=y.useCallback(f=>f/t,[t]);return y.useLayoutEffect(()=>{const{width:f,height:h}=r,{x:m,y:v}=n,x={x1:0,y1:0,x2:f,y2:h,offset:{x:u(m),y:u(v)}},S={x:Math.ceil(u(m)/64)*64,y:Math.ceil(u(v)/64)*64},C={x1:-S.x,y1:-S.y,x2:u(f)-S.x+64,y2:u(h)-S.y+64},w={x1:Math.min(x.x1,C.x1),y1:Math.min(x.y1,C.y1),x2:Math.max(x.x2,C.x2),y2:Math.max(x.y2,C.y2)},k=w.x2-w.x1,M=w.y2-w.y1,P=Math.round(k/64)+1,I=Math.round(M/64)+1,T=ee.range(0,P).map(D=>l.jsx(mc,{x:w.x1+D*64,y:w.y1,points:[0,0,0,M],stroke:c,strokeWidth:1},`x_${D}`)),_=ee.range(0,I).map(D=>l.jsx(mc,{x:w.x1,y:w.y1+D*64,points:[0,0,k,0],stroke:c,strokeWidth:1},`y_${D}`));s(T.concat(_))},[t,n,r,e,u,c]),l.jsx(Ur,{children:o})},zz=me([e=>e.gallery],e=>e.intermediateImage?e.intermediateImage:null,{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Rz=e=>{const{...t}=e,n=A(zz),[r,o]=y.useState(null);if(y.useEffect(()=>{if(!n)return;const h=new Image;h.onload=()=>{o(h)},h.src=n.url},[n]),!(n!=null&&n.boundingBox))return null;const{boundingBox:{x:s,y:c,width:u,height:f}}=n;return r?l.jsx(Yb,{x:s,y:c,width:u,height:f,image:r,listening:!1,...t}):null},Ko=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},Nz=me(tt,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:Ko(t)}}),i1=e=>`data:image/svg+xml;utf8, `.replaceAll("black",e),Fz=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=A(Nz),[c,u]=y.useState(null),[f,h]=y.useState(0),m=y.useRef(null),v=y.useCallback(()=>{h(f+1),setTimeout(v,500)},[f]);return y.useEffect(()=>{if(c)return;const x=new Image;x.onload=()=>{u(x)},x.src=i1(n)},[c,n]),y.useEffect(()=>{c&&(c.src=i1(n))},[c,n]),y.useEffect(()=>{const x=setInterval(()=>h(S=>(S+1)%5),50);return()=>clearInterval(x)},[]),!c||!ee.isNumber(r.x)||!ee.isNumber(r.y)||!ee.isNumber(s)||!ee.isNumber(o.width)||!ee.isNumber(o.height)?null:l.jsx($r,{ref:m,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:c,fillPatternOffsetY:ee.isNumber(f)?f:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},Lz=me([tt],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Bz=e=>{const{...t}=e,{objects:n}=A(Lz);return l.jsx(Ur,{listening:!1,...t,children:n.filter(V3).map((r,o)=>l.jsx(mc,{points:r.points,stroke:"rgb(0,0,0)",strokeWidth:r.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:r.tool==="brush"?"source-over":"destination-out"},o))})};var Lo=y,Hz=function(t,n,r){const o=Lo.useRef("loading"),s=Lo.useRef(),[c,u]=Lo.useState(0),f=Lo.useRef(),h=Lo.useRef(),m=Lo.useRef();return(f.current!==t||h.current!==n||m.current!==r)&&(o.current="loading",s.current=void 0,f.current=t,h.current=n,m.current=r),Lo.useLayoutEffect(function(){if(!t)return;var v=document.createElement("img");function x(){o.current="loaded",s.current=v,u(Math.random())}function S(){o.current="failed",s.current=void 0,u(Math.random())}return v.addEventListener("load",x),v.addEventListener("error",S),n&&(v.crossOrigin=n),r&&(v.referrerpolicy=r),v.src=t,function(){v.removeEventListener("load",x),v.removeEventListener("error",S)}},[t,n,r]),[s.current,o.current]};const Xb=e=>{const{url:t,x:n,y:r}=e,[o]=Hz(t);return l.jsx(Yb,{x:n,y:r,image:o,listening:!1})},Wz=me([tt],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Vz=()=>{const{objects:e}=A(Wz);return e?l.jsx(Ur,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if($1(t))return l.jsx(Xb,{x:t.x,y:t.y,url:t.image.url},n);if(U3(t)){const r=l.jsx(mc,{points:t.points,stroke:t.color?Ko(t.color):"rgb(0,0,0)",strokeWidth:t.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:t.tool==="brush"?"source-over":"destination-out"},n);return t.clip?l.jsx(Ur,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if($3(t))return l.jsx($r,{x:t.x,y:t.y,width:t.width,height:t.height,fill:Ko(t.color)},n);if(G3(t))return l.jsx($r,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},Uz=me([tt],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingImage:r,shouldShowStagingOutline:o,boundingBoxCoordinates:{x:s,y:c},boundingBoxDimensions:{width:u,height:f}}=e;return{currentStagingAreaImage:t.length>0?t[n]:void 0,isOnFirstImage:n===0,isOnLastImage:n===t.length-1,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:c,width:u,height:f}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),$z=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:c,width:u,height:f}=A(Uz);return l.jsxs(Ur,{...t,children:[r&&n&&l.jsx(Xb,{url:n.image.url,x:s,y:c}),o&&l.jsxs(Ur,{children:[l.jsx($r,{x:s,y:c,width:u,height:f,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),l.jsx($r,{x:s,y:c,width:u,height:f,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},Gz=me([tt],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingOutline:r,shouldShowStagingImage:o}=e;return{currentStagingAreaImage:t.length>0?t[n]:void 0,isOnFirstImage:n===0,isOnLastImage:n===t.length-1,shouldShowStagingImage:o,shouldShowStagingOutline:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),qz=()=>{const e=Y(),{isOnFirstImage:t,isOnLastImage:n,currentStagingAreaImage:r,shouldShowStagingImage:o}=A(Gz),{t:s}=K(),c=y.useCallback(()=>{e(Rv(!0))},[e]),u=y.useCallback(()=>{e(Rv(!1))},[e]);de(["left"],()=>{f()},{enabled:()=>!0,preventDefault:!0}),de(["right"],()=>{h()},{enabled:()=>!0,preventDefault:!0}),de(["enter"],()=>{m()},{enabled:()=>!0,preventDefault:!0});const f=()=>e(q3()),h=()=>e(Y3()),m=()=>e(K3());return r?l.jsx(L,{pos:"absolute",bottom:4,w:"100%",align:"center",justify:"center",filter:"drop-shadow(0 0.5rem 1rem rgba(0,0,0))",onMouseOver:c,onMouseOut:u,children:l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:l.jsx(Fx,{}),onClick:f,colorScheme:"accent",isDisabled:t}),l.jsx(se,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:l.jsx(C9,{}),onClick:h,colorScheme:"accent",isDisabled:n}),l.jsx(se,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:l.jsx(Oc,{}),onClick:m,colorScheme:"accent"}),l.jsx(se,{tooltip:s("unifiedCanvas.showHide"),"aria-label":s("unifiedCanvas.showHide"),"data-alert":!o,icon:o?l.jsx(M9,{}):l.jsx(I9,{}),onClick:()=>e(X3(!o)),colorScheme:"accent"}),l.jsx(se,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),icon:l.jsx(Zh,{}),onClick:()=>e(Q3(r.image.url)),colorScheme:"accent"}),l.jsx(se,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:l.jsx(zc,{style:{transform:"rotate(45deg)"}}),onClick:()=>e(Z3()),colorScheme:"error",fontSize:20})]})}):null},Fi=e=>Math.round(e*100)/100,Yz=me([tt],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${Fi(n)}, ${Fi(r)})`}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function Kz(){const{cursorCoordinatesString:e}=A(Yz),{t}=K();return l.jsx(Ye,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const Gf="var(--invokeai-colors-warning-500)",Xz=me([tt],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:c},scaledBoundingBoxDimensions:{width:u,height:f},boundingBoxCoordinates:{x:h,y:m},stageScale:v,shouldShowCanvasDebugInfo:x,layer:S,boundingBoxScaleMethod:C,shouldPreserveMaskedArea:j}=e;let w="inherit";return(C==="none"&&(s<512||c<512)||C==="manual"&&u*f<512*512)&&(w=Gf),{activeLayerColor:S==="mask"?Gf:"inherit",activeLayerString:S.charAt(0).toUpperCase()+S.slice(1),boundingBoxColor:w,boundingBoxCoordinatesString:`(${Fi(h)}, ${Fi(m)})`,boundingBoxDimensionsString:`${s}×${c}`,scaledBoundingBoxDimensionsString:`${u}×${f}`,canvasCoordinatesString:`${Fi(r)}×${Fi(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(v*100),shouldShowCanvasDebugInfo:x,shouldShowBoundingBox:C!=="auto",shouldShowScaledBoundingBox:C!=="none",shouldPreserveMaskedArea:j}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Qz=()=>{const{activeLayerColor:e,activeLayerString:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:c,canvasCoordinatesString:u,canvasDimensionsString:f,canvasScaleString:h,shouldShowCanvasDebugInfo:m,shouldShowBoundingBox:v,shouldPreserveMaskedArea:x}=A(Xz),{t:S}=K();return l.jsxs(L,{sx:{flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,opacity:.65,display:"flex",fontSize:"sm",padding:1,px:2,minWidth:48,margin:1,borderRadius:"base",pointerEvents:"none",bg:"base.800"},children:[l.jsx(Ye,{style:{color:e},children:`${S("unifiedCanvas.activeLayer")}: ${t}`}),l.jsx(Ye,{children:`${S("unifiedCanvas.canvasScale")}: ${h}%`}),x&&l.jsx(Ye,{style:{color:Gf},children:"Preserve Masked Area: On"}),v&&l.jsx(Ye,{style:{color:n},children:`${S("unifiedCanvas.boundingBox")}: ${o}`}),c&&l.jsx(Ye,{style:{color:n},children:`${S("unifiedCanvas.scaledBoundingBox")}: ${s}`}),m&&l.jsxs(l.Fragment,{children:[l.jsx(Ye,{children:`${S("unifiedCanvas.boundingBoxPosition")}: ${r}`}),l.jsx(Ye,{children:`${S("unifiedCanvas.canvasDimensions")}: ${f}`}),l.jsx(Ye,{children:`${S("unifiedCanvas.canvasPosition")}: ${u}`}),l.jsx(Kz,{})]})]})},Zz=me(tt,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageScale:r,isDrawing:o,isTransformingBoundingBox:s,isMovingBoundingBox:c,tool:u,shouldSnapToGrid:f}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,isDrawing:o,isMovingBoundingBox:c,isTransformingBoundingBox:s,stageScale:r,shouldSnapToGrid:f,tool:u,hitStrokeWidth:20/r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Jz=e=>{const{...t}=e,n=Y(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:c,isTransformingBoundingBox:u,stageScale:f,shouldSnapToGrid:h,tool:m,hitStrokeWidth:v}=A(Zz),x=y.useRef(null),S=y.useRef(null),[C,j]=y.useState(!1);y.useEffect(()=>{var Q;!x.current||!S.current||(x.current.nodes([S.current]),(Q=x.current.getLayer())==null||Q.batchDraw())},[]);const w=64*f,k=y.useCallback(Q=>{if(!h){n(hd({x:Math.floor(Q.target.x()),y:Math.floor(Q.target.y())}));return}const U=Q.target.x(),X=Q.target.y(),te=Nv(U,64),re=Nv(X,64);Q.target.x(te),Q.target.y(re),n(hd({x:te,y:re}))},[n,h]),M=y.useCallback(()=>{if(!S.current)return;const Q=S.current,U=Q.scaleX(),X=Q.scaleY(),te=Math.round(Q.width()*U),re=Math.round(Q.height()*X),$=Math.round(Q.x()),Z=Math.round(Q.y());n(za({width:te,height:re})),n(hd({x:h?ml($,64):$,y:h?ml(Z,64):Z})),Q.scaleX(1),Q.scaleY(1)},[n,h]),P=y.useCallback((Q,U,X)=>{const te=Q.x%w,re=Q.y%w;return{x:ml(U.x,w)+te,y:ml(U.y,w)+re}},[w]),I=()=>{n(pd(!0))},T=()=>{n(pd(!1)),n(md(!1)),n(vl(!1)),j(!1)},_=()=>{n(md(!0))},D=()=>{n(pd(!1)),n(md(!1)),n(vl(!1)),j(!1)},z=()=>{j(!0)},W=()=>{!u&&!c&&j(!1)},F=()=>{n(vl(!0))},B=()=>{n(vl(!1))};return l.jsxs(Ur,{...t,children:[l.jsx($r,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:F,onMouseOver:F,onMouseLeave:B,onMouseOut:B}),l.jsx($r,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:v,listening:!s&&m==="move",onDragStart:_,onDragEnd:D,onDragMove:k,onMouseDown:_,onMouseOut:W,onMouseOver:z,onMouseEnter:z,onMouseUp:D,onTransform:M,onTransformEnd:T,ref:S,stroke:C?"rgba(255,255,255,0.7)":"white",strokeWidth:(C?8:1)/f,width:o.width,x:r.x,y:r.y}),l.jsx(vz,{anchorCornerRadius:3,anchorDragBoundFunc:P,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:m==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&m==="move",onDragStart:_,onDragEnd:D,onMouseDown:I,onMouseUp:T,onTransformEnd:T,ref:x,rotateEnabled:!1})]})},eR=me(tt,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:c,layer:u,shouldShowBrush:f,isMovingBoundingBox:h,isTransformingBoundingBox:m,stageScale:v,stageDimensions:x,boundingBoxCoordinates:S,boundingBoxDimensions:C,shouldRestrictStrokesToBox:j}=e,w=j?{clipX:S.x,clipY:S.y,clipWidth:C.width,clipHeight:C.height}:{};return{cursorPosition:t,brushX:t?t.x:x.width/2,brushY:t?t.y:x.height/2,radius:n/2,colorPickerOuterRadius:Fv/v,colorPickerInnerRadius:(Fv-lf+1)/v,maskColorString:Ko({...o,a:.5}),brushColorString:Ko(s),colorPickerColorString:Ko(r),tool:c,layer:u,shouldShowBrush:f,shouldDrawBrushPreview:!(h||m||!t)&&f,strokeWidth:1.5/v,dotRadius:1.5/v,clip:w}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),tR=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:c,layer:u,shouldDrawBrushPreview:f,dotRadius:h,strokeWidth:m,brushColorString:v,colorPickerColorString:x,colorPickerInnerRadius:S,colorPickerOuterRadius:C,clip:j}=A(eR);return f?l.jsxs(Ur,{listening:!1,...j,...t,children:[c==="colorPicker"?l.jsxs(l.Fragment,{children:[l.jsx(Fo,{x:n,y:r,radius:C,stroke:v,strokeWidth:lf,strokeScaleEnabled:!1}),l.jsx(Fo,{x:n,y:r,radius:S,stroke:x,strokeWidth:lf,strokeScaleEnabled:!1})]}):l.jsxs(l.Fragment,{children:[l.jsx(Fo,{x:n,y:r,radius:o,fill:u==="mask"?s:v,globalCompositeOperation:c==="eraser"?"destination-out":"source-out"}),l.jsx(Fo,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:m*2,strokeEnabled:!0,listening:!1}),l.jsx(Fo,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:m,strokeEnabled:!0,listening:!1})]}),l.jsx(Fo,{x:n,y:r,radius:h*2,fill:"rgba(255,255,255,0.4)",listening:!1}),l.jsx(Fo,{x:n,y:r,radius:h,fill:"rgba(0,0,0,1)",listening:!1})]}):null},nR=me([tt,Ot],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:c,isMovingBoundingBox:u,stageDimensions:f,stageCoordinates:h,tool:m,isMovingStage:v,shouldShowIntermediates:x,shouldShowGrid:S,shouldRestrictStrokesToBox:C}=e;let j="none";return m==="move"||t?v?j="grabbing":j="grab":s?j=void 0:C&&!c&&(j="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||u,shouldShowBoundingBox:o,shouldShowGrid:S,stageCoordinates:h,stageCursor:j,stageDimensions:f,stageScale:r,tool:m,isStaging:t,shouldShowIntermediates:x}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),rR=ne(gz,{shouldForwardProp:e=>!["sx"].includes(e)}),Qb=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:c,stageScale:u,tool:f,isStaging:h,shouldShowIntermediates:m}=A(nR);Sz();const v=y.useRef(null),x=y.useRef(null),S=y.useCallback(W=>{eC(W),v.current=W},[]),C=y.useCallback(W=>{J3(W),x.current=W},[]),j=y.useRef({x:0,y:0}),w=y.useRef(!1),k=Tz(v),M=wz(v),P=Iz(v,w),I=kz(v,w,j),T=Ez(),{handleDragStart:_,handleDragMove:D,handleDragEnd:z}=xz();return l.jsx(L,{sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:l.jsxs(Ye,{sx:{position:"relative"},children:[l.jsxs(rR,{tabIndex:-1,ref:S,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:o.x,y:o.y,width:c.width,height:c.height,scale:{x:u,y:u},onTouchStart:M,onTouchMove:I,onTouchEnd:P,onMouseDown:M,onMouseLeave:T,onMouseMove:I,onMouseUp:P,onDragStart:_,onDragMove:D,onDragEnd:z,onContextMenu:W=>W.evt.preventDefault(),onWheel:k,draggable:(f==="move"||h)&&!t,children:[l.jsx(Aa,{id:"grid",visible:r,children:l.jsx(Oz,{})}),l.jsx(Aa,{id:"base",ref:C,listening:!1,imageSmoothingEnabled:!1,children:l.jsx(Vz,{})}),l.jsxs(Aa,{id:"mask",visible:e,listening:!1,children:[l.jsx(Bz,{visible:!0,listening:!1}),l.jsx(Fz,{listening:!1})]}),l.jsx(Aa,{children:l.jsx(Dz,{})}),l.jsxs(Aa,{id:"preview",imageSmoothingEnabled:!1,children:[!h&&l.jsx(tR,{visible:f!=="move",listening:!1}),l.jsx($z,{visible:h}),m&&l.jsx(Rz,{}),l.jsx(Jz,{visible:n&&!h})]})]}),l.jsx(Qz,{}),l.jsx(qz,{})]})})},oR=me(tt,Bb,bt,(e,t,n)=>{const{doesCanvasNeedScaling:r,isCanvasInitialized:o}=e;return{doesCanvasNeedScaling:r,activeTabName:n,initialCanvasImage:t,isCanvasInitialized:o}}),Zb=()=>{const e=Y(),{doesCanvasNeedScaling:t,activeTabName:n,initialCanvasImage:r,isCanvasInitialized:o}=A(oR),s=y.useRef(null);return y.useLayoutEffect(()=>{window.setTimeout(()=>{if(!s.current)return;const{clientWidth:c,clientHeight:u}=s.current;e(tC({width:c,height:u})),e(o?nC():Sc()),e(P1(!1))},0)},[e,r,t,n,o]),l.jsx(L,{ref:s,sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:l.jsx(yc,{thickness:"2px",speed:"1s",size:"xl"})})},iR=me([tt,bt,Et],(e,t,n)=>{const{futureLayerStates:r}=e;return{canRedo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function Jb(){const e=Y(),{canRedo:t,activeTabName:n}=A(iR),{t:r}=K(),o=()=>{e(rC())};return de(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),l.jsx(se,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:l.jsx(B9,{}),onClick:o,isDisabled:!t})}const aR=me([tt,bt,Et],(e,t,n)=>{const{pastLayerStates:r}=e;return{canUndo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function e4(){const e=Y(),{t}=K(),{canUndo:n,activeTabName:r}=A(aR),o=()=>{e(oC())};return de(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),l.jsx(se,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:l.jsx(U9,{}),onClick:o,isDisabled:!n})}const sR=(e,t,n)=>{const r=document.createElement("img");r.addEventListener("load",()=>{const o=document.createElement("canvas");o.width=t,o.height=n;const s=o.getContext("2d");s&&(s.drawImage(r,0,0),o.toBlob(c=>{c&&navigator.clipboard.write([new ClipboardItem({[c.type]:c})])}),o.remove(),r.remove())}),r.src=e},lR=e=>{const t=document.createElement("a");t.href=e,t.download="",document.body.appendChild(t),t.click(),document.body.removeChild(t),t.remove()},cR=(e,t,n,r)=>{const o=e.scale(),s=e.getClientRect({relativeTo:e.getParent()});e.scale({x:1/t,y:1/t});const{x:c,y:u,width:f,height:h}=e.getClientRect(),m=r?{x:r.x+n.x,y:r.y+n.y,width:r.width,height:r.height}:{x:c,y:u,width:f,height:h},v=e.toDataURL(m);return e.scale(o),{dataURL:v,boundingBox:{x:s.x,y:s.y,width:f,height:h}}},uR={cropVisible:!1,cropToBoundingBox:!1,shouldSaveToGallery:!1,shouldDownload:!1,shouldCopy:!1,shouldSetAsInitialImage:!0},co=(e=uR)=>async(t,n)=>{const{cropVisible:r,cropToBoundingBox:o,shouldSaveToGallery:s,shouldDownload:c,shouldCopy:u,shouldSetAsInitialImage:f}=e;t(iC("Exporting Image")),t(gl(!1));const h=n(),{stageScale:m,boundingBoxCoordinates:v,boundingBoxDimensions:x,stageCoordinates:S}=h.canvas,C=jr();if(!C){t(vd(!1)),t(gl(!0));return}const{dataURL:j,boundingBox:w}=cR(C,m,S,o?{...v,...x}:void 0);if(!j){t(vd(!1)),t(gl(!0));return}const k=new FormData;k.append("data",JSON.stringify({dataURL:j,filename:"merged_canvas.png",kind:s?"result":"temp",cropVisible:r}));const P=await(await fetch(`${window.location.origin}/upload`,{method:"POST",body:k})).json(),{url:I,width:T,height:_}=P,D={uuid:S1(),category:s?"result":"user",...P};c&&(lR(I),t(yl({title:Ma.t("toast.downloadImageStarted"),status:"success",duration:2500,isClosable:!0}))),u&&(sR(I,T,_),t(yl({title:Ma.t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0}))),s&&(t(C1({image:D,category:"result"})),t(yl({title:Ma.t("toast.imageSavedToGallery"),status:"success",duration:2500,isClosable:!0}))),f&&(t(aC({kind:"image",layer:"base",...w,image:D})),t(yl({title:Ma.t("toast.canvasMerged"),status:"success",duration:2500,isClosable:!0}))),t(vd(!1)),t(sC(Ma.t("common.statusConnected"))),t(gl(!0))};function dR(){const e=A(Ot),t=jr(),n=A(u=>u.system.isProcessing),r=A(u=>u.canvas.shouldCropToBoundingBoxOnSave),o=Y(),{t:s}=K();de(["meta+c","ctrl+c"],()=>{c()},{enabled:()=>!e,preventDefault:!0},[t,n]);const c=()=>{o(co({cropVisible:!r,cropToBoundingBox:r,shouldCopy:!0}))};return l.jsx(se,{"aria-label":`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:l.jsx(Xi,{}),onClick:c,isDisabled:e})}function fR(){const e=Y(),{t}=K(),n=jr(),r=A(Ot),o=A(u=>u.system.isProcessing),s=A(u=>u.canvas.shouldCropToBoundingBoxOnSave);de(["shift+d"],()=>{c()},{enabled:()=>!r,preventDefault:!0},[n,o]);const c=()=>{e(co({cropVisible:!s,cropToBoundingBox:s,shouldDownload:!0}))};return l.jsx(se,{"aria-label":`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:l.jsx(Qh,{}),onClick:c,isDisabled:r})}function hR(){const e=A(Ot),{openUploader:t}=Kh(),{t:n}=K();return l.jsx(se,{"aria-label":n("common.upload"),tooltip:n("common.upload"),icon:l.jsx(Rc,{}),onClick:t,isDisabled:e})}const pR=me([tt,Ot],(e,t)=>{const{layer:n,isMaskEnabled:r}=e;return{layer:n,isMaskEnabled:r,isStaging:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function mR(){const e=Y(),{t}=K(),{layer:n,isMaskEnabled:r,isStaging:o}=A(pR),s=()=>{e(Ql(n==="mask"?"base":"mask"))};de(["q"],()=>{s()},{enabled:()=>!o,preventDefault:!0},[n]);const c=u=>{const f=u.target.value;e(Ql(f)),f==="mask"&&!r&&e(as(!0))};return l.jsx(Mn,{tooltip:`${t("unifiedCanvas.layer")} (Q)`,"aria-label":`${t("unifiedCanvas.layer")} (Q)`,tooltipProps:{hasArrow:!0,placement:"top"},value:n,validValues:X1,onChange:c,isDisabled:o})}function vR(){const e=Y(),{t}=K(),n=jr(),r=A(Ot),o=A(c=>c.system.isProcessing);de(["shift+m"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n,o]);const s=()=>{e(co({cropVisible:!1,shouldSetAsInitialImage:!0}))};return l.jsx(se,{"aria-label":`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:l.jsx($x,{}),onClick:s,isDisabled:r})}function gR(){const e=A(s=>s.canvas.tool),t=A(Ot),n=Y(),{t:r}=K();de(["v"],()=>{o()},{enabled:()=>!t,preventDefault:!0},[]);const o=()=>n(Sr("move"));return l.jsx(se,{"aria-label":`${r("unifiedCanvas.move")} (V)`,tooltip:`${r("unifiedCanvas.move")} (V)`,icon:l.jsx(Lx,{}),isChecked:e==="move"||t,onClick:o})}function yR(){const e=A(s=>s.ui.shouldPinParametersPanel),t=A(s=>s.ui.shouldShowParametersPanel),n=Y(),{t:r}=K(),o=()=>{n(ql(!0)),e&&n(cn())};return!e||!t?l.jsxs(L,{flexDirection:"column",gap:2,children:[l.jsx(se,{tooltip:`${r("parameters.showOptionsPanel")} (O)`,tooltipProps:{placement:"top"},"aria-label":r("parameters.showOptionsPanel"),onClick:o,children:l.jsx(Jh,{})}),l.jsx(L,{children:l.jsx(Ip,{iconButton:!0})}),l.jsx(L,{children:l.jsx(Ep,{width:"100%",height:"40px",btnGroupWidth:"100%"})})]}):null}function xR(){const e=Y(),{t}=K(),n=A(Ot),r=()=>{e(Jf()),e(Sc())};return l.jsx(se,{"aria-label":t("unifiedCanvas.clearCanvas"),tooltip:t("unifiedCanvas.clearCanvas"),icon:l.jsx(So,{}),onClick:r,isDisabled:n,colorScheme:"error"})}function t4(e,t,n=250){const[r,o]=y.useState(0);return y.useEffect(()=>{const s=setTimeout(()=>{r===1&&e(),o(0)},n);return r===2&&t(),()=>clearTimeout(s)},[r,e,t,n]),()=>o(s=>s+1)}function bR(){const e=jr(),t=Y(),{t:n}=K();de(["r"],()=>{o()},{enabled:()=>!0,preventDefault:!0},[e]);const r=t4(()=>o(!1),()=>o(!0)),o=(s=!1)=>{const c=jr();if(!c)return;const u=c.getClientRect({skipTransform:!0});t(Q1({contentRect:u,shouldScaleTo1:s}))};return l.jsx(se,{"aria-label":`${n("unifiedCanvas.resetView")} (R)`,tooltip:`${n("unifiedCanvas.resetView")} (R)`,icon:l.jsx(Hx,{}),onClick:r})}function SR(){const e=A(Ot),t=jr(),n=A(u=>u.system.isProcessing),r=A(u=>u.canvas.shouldCropToBoundingBoxOnSave),o=Y(),{t:s}=K();de(["shift+s"],()=>{c()},{enabled:()=>!e,preventDefault:!0},[t,n]);const c=()=>{o(co({cropVisible:!r,cropToBoundingBox:r,shouldSaveToGallery:!0}))};return l.jsx(se,{"aria-label":`${s("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${s("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:l.jsx(Zh,{}),onClick:c,isDisabled:e})}const CR=me([tt,Ot,Et],(e,t,n)=>{const{isProcessing:r}=n,{tool:o}=e;return{tool:o,isStaging:t,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),wR=()=>{const e=Y(),{t}=K(),{tool:n,isStaging:r}=A(CR);de(["b"],()=>{o()},{enabled:()=>!r,preventDefault:!0},[]),de(["e"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n]),de(["c"],()=>{c()},{enabled:()=>!r,preventDefault:!0},[n]),de(["shift+f"],()=>{u()},{enabled:()=>!r,preventDefault:!0}),de(["delete","backspace"],()=>{f()},{enabled:()=>!r,preventDefault:!0});const o=()=>e(Sr("brush")),s=()=>e(Sr("eraser")),c=()=>e(Sr("colorPicker")),u=()=>e(Z1()),f=()=>e(J1());return l.jsxs(L,{flexDirection:"column",gap:2,children:[l.jsxs(Qt,{children:[l.jsx(se,{"aria-label":`${t("unifiedCanvas.brush")} (B)`,tooltip:`${t("unifiedCanvas.brush")} (B)`,icon:l.jsx(Gx,{}),isChecked:n==="brush"&&!r,onClick:o,isDisabled:r}),l.jsx(se,{"aria-label":`${t("unifiedCanvas.eraser")} (E)`,tooltip:`${t("unifiedCanvas.eraser")} (B)`,icon:l.jsx(Wx,{}),isChecked:n==="eraser"&&!r,isDisabled:r,onClick:s})]}),l.jsxs(Qt,{children:[l.jsx(se,{"aria-label":`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:l.jsx(Ux,{}),isDisabled:r,onClick:u}),l.jsx(se,{"aria-label":`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:l.jsx(zc,{style:{transform:"rotate(45deg)"}}),isDisabled:r,onClick:f})]}),l.jsx(se,{"aria-label":`${t("unifiedCanvas.colorPicker")} (C)`,tooltip:`${t("unifiedCanvas.colorPicker")} (C)`,icon:l.jsx(Vx,{}),isChecked:n==="colorPicker"&&!r,isDisabled:r,onClick:c,width:"max-content"})]})},n4=()=>{const e=A(Ot),t=Y(),{t:n}=K(),r=()=>{t(lC()),t(Jf()),t(e2())};return l.jsxs(Wc,{title:n("unifiedCanvas.emptyTempImageFolder"),acceptCallback:r,acceptButtonText:n("unifiedCanvas.emptyFolder"),triggerComponent:l.jsx(Je,{leftIcon:l.jsx(So,{}),size:"sm",isDisabled:e,children:n("unifiedCanvas.emptyTempImageFolder")}),children:[l.jsx("p",{children:n("unifiedCanvas.emptyTempImagesFolderMessage")}),l.jsx("br",{}),l.jsx("p",{children:n("unifiedCanvas.emptyTempImagesFolderConfirm")})]})},r4=()=>{const e=A(Ot),t=Y(),{t:n}=K();return l.jsxs(Wc,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(e2()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:l.jsx(Je,{size:"sm",leftIcon:l.jsx(So,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[l.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),l.jsx("br",{}),l.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},jR=me([tt],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:o}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:o}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),kR=()=>{const e=Y(),{t}=K(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldShowCanvasDebugInfo:o,shouldShowIntermediates:s}=A(jR);return l.jsx(or,{isLazy:!1,triggerComponent:l.jsx(se,{tooltip:t("unifiedCanvas.canvasSettings"),tooltipProps:{placement:"bottom"},"aria-label":t("unifiedCanvas.canvasSettings"),icon:l.jsx(ep,{})}),children:l.jsxs(L,{direction:"column",gap:2,children:[l.jsx(ft,{label:t("unifiedCanvas.showIntermediates"),isChecked:s,onChange:c=>e(t2(c.target.checked))}),l.jsx(ft,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:c=>e(n2(c.target.checked))}),l.jsx(ft,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:c=>e(r2(c.target.checked))}),l.jsx(ft,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:o,onChange:c=>e(o2(c.target.checked))}),l.jsx(r4,{}),l.jsx(n4,{})]})})},ER=()=>l.jsxs(L,{flexDirection:"column",rowGap:2,children:[l.jsx(mR,{}),l.jsx(wR,{}),l.jsxs(L,{gap:2,children:[l.jsx(gR,{}),l.jsx(bR,{})]}),l.jsxs(L,{columnGap:2,children:[l.jsx(vR,{}),l.jsx(SR,{})]}),l.jsxs(L,{columnGap:2,children:[l.jsx(dR,{}),l.jsx(fR,{})]}),l.jsxs(L,{gap:2,children:[l.jsx(e4,{}),l.jsx(Jb,{})]}),l.jsxs(L,{gap:2,children:[l.jsx(hR,{}),l.jsx(xR,{})]}),l.jsx(kR,{}),l.jsx(yR,{})]});function PR(){const e=Y(),t=A(o=>o.canvas.brushSize),{t:n}=K(),r=A(Ot);return de(["BracketLeft"],()=>{e(Li(Math.max(t-5,5)))},{enabled:()=>!r,preventDefault:!0},[t]),de(["BracketRight"],()=>{e(Li(Math.min(t+5,500)))},{enabled:()=>!r,preventDefault:!0},[t]),l.jsx(ut,{label:n("unifiedCanvas.brushSize"),value:t,withInput:!0,onChange:o=>e(Li(o)),sliderNumberInputProps:{max:500},inputReadOnly:!1,isCompact:!0})}function Uc(){return(Uc=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function qf(e){var t=y.useRef(e),n=y.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Ji=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:w.buttons>0)&&o.current?s(a1(o.current,w,u.current)):j(!1)},C=function(){return j(!1)};function j(w){var k=f.current,M=Yf(o.current),P=w?M.addEventListener:M.removeEventListener;P(k?"touchmove":"mousemove",S),P(k?"touchend":"mouseup",C)}return[function(w){var k=w.nativeEvent,M=o.current;if(M&&(s1(k),!function(I,T){return T&&!Wa(I)}(k,f.current)&&M)){if(Wa(k)){f.current=!0;var P=k.changedTouches||[];P.length&&(u.current=P[0].identifier)}M.focus(),s(a1(M,k,u.current)),j(!0)}},function(w){var k=w.which||w.keyCode;k<37||k>40||(w.preventDefault(),c({left:k===39?.05:k===37?-.05:0,top:k===40?.05:k===38?-.05:0}))},j]},[c,s]),m=h[0],v=h[1],x=h[2];return y.useEffect(function(){return x},[x]),Me.createElement("div",Uc({},r,{onTouchStart:m,onMouseDown:m,className:"react-colorful__interactive",ref:o,onKeyDown:v,tabIndex:0,role:"slider"}))}),$c=function(e){return e.filter(Boolean).join(" ")},Rp=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=$c(["react-colorful__pointer",e.className]);return Me.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},Me.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},gn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},i4=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:gn(e.h),s:gn(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:gn(o/2),a:gn(r,2)}},Kf=function(e){var t=i4(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},$d=function(e){var t=i4(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},IR=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),c=r*(1-n),u=r*(1-(t-s)*n),f=r*(1-(1-t+s)*n),h=s%6;return{r:gn(255*[r,u,c,c,f,r][h]),g:gn(255*[f,r,r,u,c,c][h]),b:gn(255*[c,c,f,r,r,u][h]),a:gn(o,2)}},MR=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),c=s-Math.min(t,n,r),u=c?s===t?(n-r)/c:s===n?2+(r-t)/c:4+(t-n)/c:0;return{h:gn(60*(u<0?u+6:u)),s:gn(s?c/s*100:0),v:gn(s/255*100),a:o}},TR=Me.memo(function(e){var t=e.hue,n=e.onChange,r=$c(["react-colorful__hue",e.className]);return Me.createElement("div",{className:r},Me.createElement(zp,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Ji(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":gn(t),"aria-valuemax":"360","aria-valuemin":"0"},Me.createElement(Rp,{className:"react-colorful__hue-pointer",left:t/360,color:Kf({h:t,s:100,v:100,a:1})})))}),_R=Me.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Kf({h:t.h,s:100,v:100,a:1})};return Me.createElement("div",{className:"react-colorful__saturation",style:r},Me.createElement(zp,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Ji(t.s+100*o.left,0,100),v:Ji(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+gn(t.s)+"%, Brightness "+gn(t.v)+"%"},Me.createElement(Rp,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Kf(t)})))}),a4=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function DR(e,t,n){var r=qf(n),o=y.useState(function(){return e.toHsva(t)}),s=o[0],c=o[1],u=y.useRef({color:t,hsva:s});y.useEffect(function(){if(!e.equal(t,u.current.color)){var h=e.toHsva(t);u.current={hsva:h,color:t},c(h)}},[t,e]),y.useEffect(function(){var h;a4(s,u.current.hsva)||e.equal(h=e.fromHsva(s),u.current.color)||(u.current={hsva:s,color:h},r(h))},[s,e,r]);var f=y.useCallback(function(h){c(function(m){return Object.assign({},m,h)})},[]);return[s,f]}var AR=typeof window<"u"?y.useLayoutEffect:y.useEffect,OR=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},l1=new Map,zR=function(e){AR(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!l1.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}`,l1.set(t,n);var r=OR();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},RR=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+$d(Object.assign({},n,{a:0}))+", "+$d(Object.assign({},n,{a:1}))+")"},s=$c(["react-colorful__alpha",t]),c=gn(100*n.a);return Me.createElement("div",{className:s},Me.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),Me.createElement(zp,{onMove:function(u){r({a:u.left})},onKey:function(u){r({a:Ji(n.a+u.left)})},"aria-label":"Alpha","aria-valuetext":c+"%","aria-valuenow":c,"aria-valuemin":"0","aria-valuemax":"100"},Me.createElement(Rp,{className:"react-colorful__alpha-pointer",left:n.a,color:$d(n)})))},NR=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,c=o4(e,["className","colorModel","color","onChange"]),u=y.useRef(null);zR(u);var f=DR(n,o,s),h=f[0],m=f[1],v=$c(["react-colorful",t]);return Me.createElement("div",Uc({},c,{ref:u,className:v}),Me.createElement(_R,{hsva:h,onChange:m}),Me.createElement(TR,{hue:h.h,onChange:m}),Me.createElement(RR,{hsva:h,onChange:m,className:"react-colorful__last-control"}))},FR={defaultColor:{r:0,g:0,b:0,a:1},toHsva:MR,fromHsva:IR,equal:a4},LR=function(e){return Me.createElement(NR,Uc({},e,{colorModel:FR}))};const BR=ne(LR,{baseStyle:{paddingInline:4},shouldForwardProp:e=>!["pickerColor"].includes(e)}),Gd={width:6,height:6,borderColor:"base.100"},HR=e=>{const{styleClass:t="",...n}=e;return l.jsx(BR,{sx:{".react-colorful__hue-pointer":Gd,".react-colorful__saturation-pointer":Gd,".react-colorful__alpha-pointer":Gd},className:t,...n})},vc=y.memo(HR),WR=me([tt,Ot],(e,t)=>{const{brushColor:n,maskColor:r,layer:o}=e;return{brushColor:n,maskColor:r,layer:o,isStaging:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function VR(){const e=Y(),{brushColor:t,maskColor:n,layer:r,isStaging:o}=A(WR),s=()=>{if(r==="base")return`rgba(${t.r},${t.g},${t.b},${t.a})`;if(r==="mask")return`rgba(${n.r},${n.g},${n.b},${n.a})`};return de(["shift+BracketLeft"],()=>{e(Bi({...t,a:ee.clamp(t.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[t]),de(["shift+BracketRight"],()=>{e(Bi({...t,a:ee.clamp(t.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[t]),l.jsx(or,{triggerComponent:l.jsx(Ye,{sx:{width:7,height:7,minWidth:7,minHeight:7,borderRadius:"full",bg:s(),cursor:"pointer"}}),children:l.jsxs(L,{minWidth:60,direction:"column",gap:4,width:"100%",children:[r==="base"&&l.jsx(vc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:t,onChange:c=>e(Bi(c))}),r==="mask"&&l.jsx(vc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:c=>e(i2(c))})]})})}function s4(){return l.jsxs(L,{columnGap:4,alignItems:"center",children:[l.jsx(PR,{}),l.jsx(VR,{})]})}function UR(){const e=Y(),t=A(r=>r.canvas.shouldRestrictStrokesToBox),{t:n}=K();return l.jsx(ft,{label:n("unifiedCanvas.betaLimitToBox"),isChecked:t,onChange:r=>e(a2(r.target.checked))})}function $R(){return l.jsxs(L,{gap:4,alignItems:"center",children:[l.jsx(s4,{}),l.jsx(UR,{})]})}function GR(){const e=Y(),{t}=K(),n=()=>e(Zf());return l.jsx(Je,{size:"sm",leftIcon:l.jsx(So,{}),onClick:n,tooltip:`${t("unifiedCanvas.clearMask")} (Shift+C)`,children:t("unifiedCanvas.betaClear")})}function qR(){const e=A(o=>o.canvas.isMaskEnabled),t=Y(),{t:n}=K(),r=()=>t(as(!e));return l.jsx(ft,{label:`${n("unifiedCanvas.enableMask")} (H)`,isChecked:e,onChange:r})}function YR(){const e=Y(),{t}=K(),n=A(r=>r.canvas.shouldPreserveMaskedArea);return l.jsx(ft,{label:t("unifiedCanvas.betaPreserveMasked"),isChecked:n,onChange:r=>e(s2(r.target.checked))})}function KR(){return l.jsxs(L,{gap:4,alignItems:"center",children:[l.jsx(s4,{}),l.jsx(qR,{}),l.jsx(YR,{}),l.jsx(GR,{})]})}function XR(){const e=A(r=>r.canvas.shouldDarkenOutsideBoundingBox),t=Y(),{t:n}=K();return l.jsx(ft,{label:n("unifiedCanvas.betaDarkenOutside"),isChecked:e,onChange:r=>t(l2(r.target.checked))})}function QR(){const e=A(r=>r.canvas.shouldShowGrid),t=Y(),{t:n}=K();return l.jsx(ft,{label:n("unifiedCanvas.showGrid"),isChecked:e,onChange:r=>t(c2(r.target.checked))})}function ZR(){const e=A(o=>o.canvas.shouldSnapToGrid),t=Y(),{t:n}=K(),r=o=>t(Xl(o.target.checked));return l.jsx(ft,{label:`${n("unifiedCanvas.snapToGrid")} (N)`,isChecked:e,onChange:r})}function JR(){return l.jsxs(L,{alignItems:"center",gap:4,children:[l.jsx(QR,{}),l.jsx(ZR,{}),l.jsx(XR,{})]})}const eN=me([tt],e=>{const{tool:t,layer:n}=e;return{tool:t,layer:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function tN(){const{tool:e,layer:t}=A(eN);return l.jsxs(L,{height:8,minHeight:8,maxHeight:8,alignItems:"center",children:[t=="base"&&["brush","eraser","colorPicker"].includes(e)&&l.jsx($R,{}),t=="mask"&&["brush","eraser","colorPicker"].includes(e)&&l.jsx(KR,{}),e=="move"&&l.jsx(JR,{})]})}const nN=me([tt],e=>{const{doesCanvasNeedScaling:t}=e;return{doesCanvasNeedScaling:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),rN=()=>{const e=Y(),{doesCanvasNeedScaling:t}=A(nN);return y.useLayoutEffect(()=>{e(cn());const n=()=>{e(cn())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),l.jsx(Ye,{sx:{width:"100%",height:"100%",borderRadius:"base",bg:"base.850"},children:l.jsxs(L,{flexDirection:"row",width:"100%",height:"100%",columnGap:4,padding:4,children:[l.jsx(ER,{}),l.jsxs(L,{width:"100%",height:"100%",flexDirection:"column",rowGap:4,children:[l.jsx(tN,{}),t?l.jsx(Zb,{}):l.jsx(Qb,{})]})]})})},oN=me([tt,Ot],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:Ko(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),iN=()=>{const e=Y(),{t}=K(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:c}=A(oN);de(["q"],()=>{u()},{enabled:()=>!c,preventDefault:!0},[n]),de(["shift+c"],()=>{f()},{enabled:()=>!c,preventDefault:!0},[]),de(["h"],()=>{h()},{enabled:()=>!c,preventDefault:!0},[o]);const u=()=>{e(Ql(n==="mask"?"base":"mask"))},f=()=>e(Zf()),h=()=>e(as(!o));return l.jsx(or,{triggerComponent:l.jsx(Qt,{children:l.jsx(se,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:l.jsx(O9,{}),isChecked:n==="mask",isDisabled:c})}),children:l.jsxs(L,{direction:"column",gap:2,children:[l.jsx(ft,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:h}),l.jsx(ft,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:m=>e(s2(m.target.checked))}),l.jsx(vc,{sx:{paddingTop:2,paddingBottom:2},pickerColor:r,onChange:m=>e(i2(m))}),l.jsxs(Je,{size:"sm",leftIcon:l.jsx(So,{}),onClick:f,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},aN=me([tt],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:c,shouldSnapToGrid:u,shouldRestrictStrokesToBox:f}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:c,shouldSnapToGrid:u,shouldRestrictStrokesToBox:f}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),sN=()=>{const e=Y(),{t}=K(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:c,shouldShowIntermediates:u,shouldSnapToGrid:f,shouldRestrictStrokesToBox:h}=A(aN);de(["n"],()=>{e(Xl(!f))},{enabled:!0,preventDefault:!0},[f]);const m=v=>e(Xl(v.target.checked));return l.jsx(or,{isLazy:!1,triggerComponent:l.jsx(se,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:l.jsx(ep,{})}),children:l.jsxs(L,{direction:"column",gap:2,children:[l.jsx(ft,{label:t("unifiedCanvas.showIntermediates"),isChecked:u,onChange:v=>e(t2(v.target.checked))}),l.jsx(ft,{label:t("unifiedCanvas.showGrid"),isChecked:c,onChange:v=>e(c2(v.target.checked))}),l.jsx(ft,{label:t("unifiedCanvas.snapToGrid"),isChecked:f,onChange:m}),l.jsx(ft,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:v=>e(l2(v.target.checked))}),l.jsx(ft,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:v=>e(n2(v.target.checked))}),l.jsx(ft,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:v=>e(r2(v.target.checked))}),l.jsx(ft,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:h,onChange:v=>e(a2(v.target.checked))}),l.jsx(ft,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:v=>e(o2(v.target.checked))}),l.jsx(r4,{}),l.jsx(n4,{})]})})},lN=me([tt,Ot,Et],(e,t,n)=>{const{isProcessing:r}=n,{tool:o,brushColor:s,brushSize:c}=e;return{tool:o,isStaging:t,isProcessing:r,brushColor:s,brushSize:c}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),cN=()=>{const e=Y(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=A(lN),{t:s}=K();de(["b"],()=>{c()},{enabled:()=>!o,preventDefault:!0},[]),de(["e"],()=>{u()},{enabled:()=>!o,preventDefault:!0},[t]),de(["c"],()=>{f()},{enabled:()=>!o,preventDefault:!0},[t]),de(["shift+f"],()=>{h()},{enabled:()=>!o,preventDefault:!0}),de(["delete","backspace"],()=>{m()},{enabled:()=>!o,preventDefault:!0}),de(["BracketLeft"],()=>{e(Li(Math.max(r-5,5)))},{enabled:()=>!o,preventDefault:!0},[r]),de(["BracketRight"],()=>{e(Li(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),de(["shift+BracketLeft"],()=>{e(Bi({...n,a:ee.clamp(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),de(["shift+BracketRight"],()=>{e(Bi({...n,a:ee.clamp(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const c=()=>e(Sr("brush")),u=()=>e(Sr("eraser")),f=()=>e(Sr("colorPicker")),h=()=>e(Z1()),m=()=>e(J1());return l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:l.jsx(Gx,{}),isChecked:t==="brush"&&!o,onClick:c,isDisabled:o}),l.jsx(se,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:l.jsx(Wx,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:u}),l.jsx(se,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:l.jsx(Ux,{}),isDisabled:o,onClick:h}),l.jsx(se,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:l.jsx(zc,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:m}),l.jsx(se,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:l.jsx(Vx,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:f}),l.jsx(or,{triggerComponent:l.jsx(se,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:l.jsx(Jh,{})}),children:l.jsxs(L,{minWidth:60,direction:"column",gap:4,width:"100%",children:[l.jsx(L,{gap:4,justifyContent:"space-between",children:l.jsx(ut,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:v=>e(Li(v)),sliderNumberInputProps:{max:500},inputReadOnly:!1})}),l.jsx(vc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:v=>e(Bi(v))})]})})]})},uN=me([Et,tt,Ot],(e,t,n)=>{const{isProcessing:r}=e,{tool:o,shouldCropToBoundingBoxOnSave:s,layer:c,isMaskEnabled:u}=t;return{isProcessing:r,isStaging:n,isMaskEnabled:u,tool:o,layer:c,shouldCropToBoundingBoxOnSave:s}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),dN=()=>{const e=Y(),{isProcessing:t,isStaging:n,isMaskEnabled:r,layer:o,tool:s,shouldCropToBoundingBoxOnSave:c}=A(uN),u=jr(),{t:f}=K(),{openUploader:h}=Kh();de(["v"],()=>{m()},{enabled:()=>!n,preventDefault:!0},[]),de(["r"],()=>{x()},{enabled:()=>!0,preventDefault:!0},[u]),de(["shift+m"],()=>{C()},{enabled:()=>!n,preventDefault:!0},[u,t]),de(["shift+s"],()=>{j()},{enabled:()=>!n,preventDefault:!0},[u,t]),de(["meta+c","ctrl+c"],()=>{w()},{enabled:()=>!n,preventDefault:!0},[u,t]),de(["shift+d"],()=>{k()},{enabled:()=>!n,preventDefault:!0},[u,t]);const m=()=>e(Sr("move")),v=t4(()=>x(!1),()=>x(!0)),x=(P=!1)=>{const I=jr();if(!I)return;const T=I.getClientRect({skipTransform:!0});e(Q1({contentRect:T,shouldScaleTo1:P}))},S=()=>{e(Jf()),e(Sc())},C=()=>{e(co({cropVisible:!1,shouldSetAsInitialImage:!0}))},j=()=>{e(co({cropVisible:!c,cropToBoundingBox:c,shouldSaveToGallery:!0}))},w=()=>{e(co({cropVisible:!c,cropToBoundingBox:c,shouldCopy:!0}))},k=()=>{e(co({cropVisible:!c,cropToBoundingBox:c,shouldDownload:!0}))},M=P=>{const I=P.target.value;e(Ql(I)),I==="mask"&&!r&&e(as(!0))};return l.jsxs(L,{sx:{alignItems:"center",gap:2},children:[l.jsx(Mn,{tooltip:`${f("unifiedCanvas.layer")} (Q)`,tooltipProps:{hasArrow:!0,placement:"top"},value:o,validValues:X1,onChange:M,isDisabled:n}),l.jsx(iN,{}),l.jsx(cN,{}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{"aria-label":`${f("unifiedCanvas.move")} (V)`,tooltip:`${f("unifiedCanvas.move")} (V)`,icon:l.jsx(Lx,{}),isChecked:s==="move"||n,onClick:m}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.resetView")} (R)`,tooltip:`${f("unifiedCanvas.resetView")} (R)`,icon:l.jsx(Hx,{}),onClick:v})]}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{"aria-label":`${f("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${f("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:l.jsx($x,{}),onClick:C,isDisabled:n}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${f("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:l.jsx(Zh,{}),onClick:j,isDisabled:n}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${f("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:l.jsx(Xi,{}),onClick:w,isDisabled:n}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${f("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:l.jsx(Qh,{}),onClick:k,isDisabled:n})]}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(e4,{}),l.jsx(Jb,{})]}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{"aria-label":`${f("common.upload")}`,tooltip:`${f("common.upload")}`,icon:l.jsx(Rc,{}),onClick:h,isDisabled:n}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.clearCanvas")}`,tooltip:`${f("unifiedCanvas.clearCanvas")}`,icon:l.jsx(So,{}),onClick:S,colorScheme:"error",isDisabled:n})]}),l.jsx(Qt,{isAttached:!0,children:l.jsx(sN,{})})]})},fN=me([tt],e=>{const{doesCanvasNeedScaling:t}=e;return{doesCanvasNeedScaling:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),hN=()=>{const e=Y(),{doesCanvasNeedScaling:t}=A(fN);return y.useLayoutEffect(()=>{e(cn());const n=()=>{e(cn())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),l.jsx(Ye,{sx:{width:"100%",height:"100%",padding:4,borderRadius:"base",bg:"base.850"},children:l.jsxs(L,{sx:{flexDirection:"column",alignItems:"center",gap:4,width:"100%",height:"100%"},children:[l.jsx(dN,{}),l.jsx(L,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:t?l.jsx(Zb,{}):l.jsx(Qb,{})})]})})},pN=me(tt,e=>{const{boundingBoxDimensions:t,boundingBoxScaleMethod:n}=e;return{boundingBoxDimensions:t,boundingBoxScale:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),mN=()=>{const e=Y(),{boundingBoxDimensions:t}=A(pN),{t:n}=K(),r=u=>{e(za({...t,width:Math.floor(u)}))},o=u=>{e(za({...t,height:Math.floor(u)}))},s=()=>{e(za({...t,width:Math.floor(512)}))},c=()=>{e(za({...t,height:Math.floor(512)}))};return l.jsxs(Fe,{gap:2,alignItems:"stretch",children:[l.jsx(ut,{label:n("parameters.width"),min:64,max:1024,step:64,value:t.width,onChange:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:s}),l.jsx(ut,{label:n("parameters.height"),min:64,max:1024,step:64,value:t.height,onChange:o,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:c})]})},vN=me([Pp,Et,tt],(e,t,n)=>{const{tileSize:r,infillMethod:o}=e,{infill_methods:s}=t,{boundingBoxScaleMethod:c,scaledBoundingBoxDimensions:u}=n;return{boundingBoxScale:c,scaledBoundingBoxDimensions:u,tileSize:r,infillMethod:o,availableInfillMethods:s,isManual:c==="manual"}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),gN=()=>{const e=Y(),{tileSize:t,infillMethod:n,availableInfillMethods:r,boundingBoxScale:o,isManual:s,scaledBoundingBoxDimensions:c}=A(vN),{t:u}=K(),f=S=>{e(xl({...c,width:Math.floor(S)}))},h=S=>{e(xl({...c,height:Math.floor(S)}))},m=()=>{e(xl({...c,width:Math.floor(512)}))},v=()=>{e(xl({...c,height:Math.floor(512)}))},x=S=>{e(dC(S.target.value))};return l.jsxs(Fe,{gap:2,alignItems:"stretch",children:[l.jsx(Mn,{label:u("parameters.scaleBeforeProcessing"),validValues:cC,value:o,onChange:x}),l.jsx(ut,{isInputDisabled:!s,isResetDisabled:!s,isSliderDisabled:!s,label:u("parameters.scaledWidth"),min:64,max:1024,step:64,value:c.width,onChange:f,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:m}),l.jsx(ut,{isInputDisabled:!s,isResetDisabled:!s,isSliderDisabled:!s,label:u("parameters.scaledHeight"),min:64,max:1024,step:64,value:c.height,onChange:h,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:v}),l.jsx(Mn,{label:u("parameters.infillMethod"),value:n,validValues:r,onChange:S=>e(uC(S.target.value))}),l.jsx(ut,{isInputDisabled:n!=="tile",isResetDisabled:n!=="tile",isSliderDisabled:n!=="tile",label:u("parameters.tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:S=>{e(Lv(S))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Lv(32))}})]})};function yN(){const e=Y(),t=A(r=>r.generation.seamBlur),{t:n}=K();return l.jsx(ut,{label:n("parameters.seamBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(Bv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Bv(16))}})}function xN(){const e=Y(),{t}=K(),n=A(r=>r.generation.seamSize);return l.jsx(ut,{label:t("parameters.seamSize"),min:1,max:256,sliderNumberInputProps:{max:512},value:n,onChange:r=>{e(Hv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>e(Hv(96))})}function bN(){const{t:e}=K(),t=A(r=>r.generation.seamSteps),n=Y();return l.jsx(ut,{label:e("parameters.seamSteps"),min:1,max:100,sliderNumberInputProps:{max:999},value:t,onChange:r=>{n(Wv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{n(Wv(30))}})}function SN(){const e=Y(),{t}=K(),n=A(r=>r.generation.seamStrength);return l.jsx(ut,{label:t("parameters.seamStrength"),min:.01,max:.99,step:.01,value:n,onChange:r=>{e(Vv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Vv(.7))}})}const CN=()=>l.jsxs(Fe,{gap:2,alignItems:"stretch",children:[l.jsx(xN,{}),l.jsx(yN,{}),l.jsx(SN,{}),l.jsx(bN,{})]});function wN(){const{t:e}=K(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(jp,{})},unifiedCanvasImg2Img:{header:`${e("parameters.imageToImage")}`,feature:void 0,content:l.jsx(Wb,{label:e("parameters.img2imgStrength")})},seed:{header:`${e("parameters.seed")}`,feature:ln.SEED,content:l.jsx(Sp,{})},boundingBox:{header:`${e("parameters.boundingBoxHeader")}`,feature:ln.BOUNDING_BOX,content:l.jsx(mN,{})},seamCorrection:{header:`${e("parameters.seamCorrectionHeader")}`,feature:ln.SEAM_CORRECTION,content:l.jsx(CN,{})},infillAndScaling:{header:`${e("parameters.infillScalingHeader")}`,feature:ln.INFILL_AND_SCALING,content:l.jsx(gN,{})},variations:{header:`${e("parameters.variations")}`,feature:ln.VARIATIONS,content:l.jsx(wp,{}),additionalHeaderComponents:l.jsx(Cp,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(xp,{}),additionalHeaderComponents:l.jsx(bp,{})}};return l.jsxs(L,{flexDir:"column",gap:2,position:"relative",children:[l.jsx(_p,{}),l.jsx(Tp,{}),l.jsx(Mp,{}),l.jsx(kp,{accordionInfo:t})]})}function jN(){const e=A(n=>n.ui.shouldUseCanvasBetaLayout),t=A(bt);return l.jsx(hp,{parametersPanelContent:l.jsx(wN,{}),children:t==="unifiedCanvas"&&(e?l.jsx(rN,{}):l.jsx(hN,{}))})}const _i={boxSize:6},c1=[{id:"txt2img",icon:l.jsx(tn,{as:FD,sx:_i}),workarea:l.jsx(hO,{})},{id:"img2img",icon:l.jsx(tn,{as:dp,sx:_i}),workarea:l.jsx(iO,{})},{id:"unifiedCanvas",icon:l.jsx(tn,{as:HD,sx:_i}),workarea:l.jsx(jN,{})},{id:"nodes",icon:l.jsx(tn,{as:LD,sx:_i}),workarea:l.jsx(YD,{})},{id:"postprocessing",icon:l.jsx(tn,{as:WD,sx:_i}),workarea:l.jsx(KD,{})},{id:"training",icon:l.jsx(tn,{as:BD,sx:_i}),workarea:l.jsx(XD,{})}];function kN(){const e=A(X8),t=A(f=>f.lightbox.isLightboxOpen),n=A(f=>f.ui.shouldPinGallery),r=A(f=>f.ui.shouldPinParametersPanel),{t:o}=K(),s=Y();de("1",()=>{s(kn(0))}),de("2",()=>{s(kn(1))}),de("3",()=>{s(kn(2))}),de("4",()=>{s(kn(3))}),de("5",()=>{s(kn(4))}),de("6",()=>{s(kn(5))}),de("z",()=>{s(Uo(!t))},[t]),de("f",()=>{s(fC()),(n||r)&&s(cn())},[n,r]);const c=y.useMemo(()=>c1.map(f=>l.jsx(Gt,{hasArrow:!0,label:String(o(`common.${f.id}`)),placement:"end",children:l.jsxs(gx,{children:[l.jsx(C2,{children:String(o(`common.${f.id}`))}),f.icon]})},f.id)),[o]),u=y.useMemo(()=>c1.map(f=>l.jsx(mx,{children:f.workarea},f.id)),[]);return l.jsxs(hx,{defaultIndex:e,index:e,onChange:f=>{s(kn(f))},flexGrow:1,children:[l.jsx(px,{children:c}),l.jsx(vx,{children:u})]})}function EN(){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(o=>o)};(!{}.NODE_ENV||{}.NODE_ENV==="production")&&document.addEventListener("DOMContentLoaded",()=>{t(),setInterval(t,3e3)})}const PN=()=>{const e=Y(),t=A(G9),n=ls();y.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(hC())},[e,n,t])},IN=me([bt,Pr],(e,t)=>{const{shouldPinGallery:n,shouldShowGallery:r}=t;return{shouldPinGallery:n,shouldShowGalleryButton:(!n||!r)&&["txt2img","img2img","unifiedCanvas"].includes(e)}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),MN=()=>{const{t:e}=K(),{shouldPinGallery:t,shouldShowGalleryButton:n}=A(IN),r=Y(),o=()=>{r(cf(!0)),t&&r(cn())};return n?l.jsx(se,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":e("accessibility.showGallery"),onClick:o,sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",zIndex:31,p:0,insetInlineEnd:0,px:3,h:48,w:8,borderStartEndRadius:0,borderEndEndRadius:0},children:l.jsx(dp,{})}):null},qd={borderStartStartRadius:0,borderEndStartRadius:0},TN=me([Pr,bt],(e,t)=>{const{shouldPinParametersPanel:n,shouldUseCanvasBetaLayout:r,shouldShowParametersPanel:o}=e,s=r&&t==="unifiedCanvas",c=!s&&(!n||!o),u=!s&&(!n||!o)&&["txt2img","img2img","unifiedCanvas"].includes(t);return{shouldPinParametersPanel:n,shouldShowParametersPanelButton:u,shouldShowProcessButtons:c}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),_N=()=>{const e=Y(),{t}=K(),{shouldShowProcessButtons:n,shouldShowParametersPanelButton:r,shouldPinParametersPanel:o}=A(TN),s=()=>{e(ql(!0)),o&&e(cn())};return r?l.jsxs(L,{pos:"absolute",transform:"translate(0, -50%)",zIndex:20,minW:8,top:"50%",insetInlineStart:"4.5rem",direction:"column",gap:2,children:[l.jsx(se,{tooltip:"Show Options Panel (O)",tooltipProps:{placement:"top"},"aria-label":t("accessibility.showOptionsPanel"),onClick:s,sx:qd,children:l.jsx(Jh,{})}),n&&l.jsxs(l.Fragment,{children:[l.jsx(Ip,{iconButton:!0,sx:qd}),l.jsx(Ep,{sx:qd})]})]}):null};var Va=globalThis&&globalThis.__assign||function(){return Va=Object.assign||function(e){for(var t,n=1,r=arguments.length;ne.image.uuid===t.image.uuid&&e.isSelected===t.isSelected,l4=y.memo(e=>{const t=Y(),{activeTabName:n,galleryImageObjectFit:r,galleryImageMinimumWidth:o,mayDeleteImage:s,shouldUseSingleGalleryColumn:c}=A(ZD),{image:u,isSelected:f}=e,{url:h,thumbnail:m,uuid:v,metadata:x}=u,[S,C]=y.useState(!1),j=ls(),{direction:w}=ta(),{t:k}=K(),M=gp(),P=()=>C(!0),I=()=>C(!1),T=()=>{var X,te,re,$;(te=(X=u.metadata)==null?void 0:X.image)!=null&&te.prompt&&M(($=(re=u.metadata)==null?void 0:re.image)==null?void 0:$.prompt),j({title:k("toast.promptSet"),status:"success",duration:2500,isClosable:!0})},_=()=>{u.metadata&&t(is(u.metadata.image.seed)),j({title:k("toast.seedSet"),status:"success",duration:2500,isClosable:!0})},D=()=>{t(rs(u)),n!=="img2img"&&t(kn("img2img")),j({title:k("toast.sentToImageToImage"),status:"success",duration:2500,isClosable:!0})},z=()=>{t(bc(u)),t(Sc()),n!=="unifiedCanvas"&&t(kn("unifiedCanvas")),j({title:k("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},W=()=>{x&&t(D1(x)),j({title:k("toast.parametersSet"),status:"success",duration:2500,isClosable:!0})},F=async()=>{var X;if((X=x==null?void 0:x.image)!=null&&X.init_image_path&&(await fetch(x.image.init_image_path)).ok){t(kn("img2img")),t(pC(x)),j({title:k("toast.initialImageSet"),status:"success",duration:2500,isClosable:!0});return}j({title:k("toast.initialImageNotSet"),description:k("toast.initialImageNotSetDesc"),status:"error",duration:2500,isClosable:!0})},B=()=>t(Uv(u)),Q=X=>{X.dataTransfer.setData("invokeai/imageUuid",v),X.dataTransfer.effectAllowed="move"},U=()=>{t(Uv(u)),t(Uo(!0))};return l.jsx(DN,{menuProps:{size:"sm",isLazy:!0},renderMenu:()=>{var X,te,re,$,Z,oe,le,ze;return l.jsxs(Oh,{children:[l.jsx(gr,{onClickCapture:U,children:k("parameters.openInViewer")}),l.jsx(gr,{onClickCapture:T,isDisabled:((te=(X=u==null?void 0:u.metadata)==null?void 0:X.image)==null?void 0:te.prompt)===void 0,children:k("parameters.usePrompt")}),l.jsx(gr,{onClickCapture:_,isDisabled:(($=(re=u==null?void 0:u.metadata)==null?void 0:re.image)==null?void 0:$.seed)===void 0,children:k("parameters.useSeed")}),l.jsx(gr,{onClickCapture:W,isDisabled:!["txt2img","img2img"].includes((oe=(Z=u==null?void 0:u.metadata)==null?void 0:Z.image)==null?void 0:oe.type),children:k("parameters.useAll")}),l.jsx(gr,{onClickCapture:F,isDisabled:((ze=(le=u==null?void 0:u.metadata)==null?void 0:le.image)==null?void 0:ze.type)!=="img2img",children:k("parameters.useInitImg")}),l.jsx(gr,{onClickCapture:D,children:k("parameters.sendToImg2Img")}),l.jsx(gr,{onClickCapture:z,children:k("parameters.sendToUnifiedCanvas")}),l.jsx(gr,{"data-warning":!0,children:l.jsx(hc,{image:u,children:l.jsx("p",{children:k("parameters.deleteImage")})})})]})},children:X=>l.jsxs(Ye,{position:"relative",onMouseOver:P,onMouseOut:I,userSelect:"none",draggable:!0,onDragStart:Q,ref:X,sx:{padding:2,display:"flex",justifyContent:"center",transition:"transform 0.2s ease-out",_hover:{cursor:"pointer",zIndex:2},_before:{content:'""',display:"block",paddingBottom:"100%"}},children:[l.jsx(cs,{objectFit:c?"contain":r,rounded:"md",src:m||h,loading:"lazy",sx:{position:"absolute",width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",top:"50%",transform:"translate(-50%,-50%)",...w==="rtl"?{insetInlineEnd:"50%"}:{insetInlineStart:"50%"}}}),l.jsx(L,{onClick:B,sx:{position:"absolute",top:"0",insetInlineStart:"0",width:"100%",height:"100%",alignItems:"center",justifyContent:"center"},children:f&&l.jsx(tn,{as:Oc,sx:{width:"50%",height:"50%",fill:"ok.500"}})}),S&&o>=64&&l.jsx(Ye,{sx:{position:"absolute",top:1,insetInlineEnd:1},children:l.jsx(hc,{image:u,children:l.jsx(se,{"aria-label":k("parameters.deleteImage"),icon:l.jsx(V9,{}),size:"xs",fontSize:14,isDisabled:!s})})})]},v)})},AN);l4.displayName="HoverableImage";const ON=290,c4=()=>{const e=Y(),{t}=K(),n=y.useRef(null),[r,o]=y.useState(!0),{images:s,currentCategory:c,currentImageUuid:u,shouldPinGallery:f,galleryImageMinimumWidth:h,galleryGridTemplateColumns:m,galleryImageObjectFit:v,shouldAutoSwitchToNewImages:x,areMoreImagesAvailable:S,shouldUseSingleGalleryColumn:C}=A(QD),j=()=>{e(yC(c))},w=M=>{e(Zl(M))},k=()=>{e(u2()),e(cn())};return y.useEffect(()=>{if(!n.current)return;const M=new ResizeObserver(()=>{if(n.current){if(n.current.clientWidthM.disconnect()},[]),l.jsxs(L,{flexDirection:"column",w:"full",h:"full",gap:4,children:[l.jsxs(L,{ref:n,alignItems:"center",justifyContent:"space-between",children:[l.jsx(Qt,{size:"sm",isAttached:!0,w:"max-content",justifyContent:"stretch",children:r?l.jsxs(l.Fragment,{children:[l.jsx(se,{"aria-label":t("gallery.showGenerations"),tooltip:t("gallery.showGenerations"),isChecked:c==="result",role:"radio",icon:l.jsx(_9,{}),onClick:()=>e(bl("result"))}),l.jsx(se,{"aria-label":t("gallery.showUploads"),tooltip:t("gallery.showUploads"),role:"radio",isChecked:c==="user",icon:l.jsx($9,{}),onClick:()=>e(bl("user"))})]}):l.jsxs(l.Fragment,{children:[l.jsx(Je,{size:"sm",isChecked:c==="result",onClick:()=>e(bl("result")),flexGrow:1,children:t("gallery.generations")}),l.jsx(Je,{size:"sm",isChecked:c==="user",onClick:()=>e(bl("user")),flexGrow:1,children:t("gallery.uploads")})]})}),l.jsxs(L,{gap:2,children:[l.jsx(or,{triggerComponent:l.jsx(se,{size:"sm","aria-label":t("gallery.gallerySettings"),icon:l.jsx(ep,{})}),children:l.jsxs(L,{direction:"column",gap:2,children:[l.jsx(ut,{value:h,onChange:w,min:32,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:()=>e(Zl(64))}),l.jsx(ft,{label:t("gallery.maintainAspectRatio"),isChecked:v==="contain",onChange:()=>e(mC(v==="contain"?"cover":"contain"))}),l.jsx(ft,{label:t("gallery.autoSwitchNewImages"),isChecked:x,onChange:M=>e(vC(M.target.checked))}),l.jsx(ft,{label:t("gallery.singleColumnLayout"),isChecked:C,onChange:M=>e(gC(M.target.checked))})]})}),l.jsx(se,{size:"sm","aria-label":t("gallery.pinGallery"),tooltip:`${t("gallery.pinGallery")} (Shift+G)`,onClick:k,icon:f?l.jsx(Db,{}):l.jsx(Ab,{})})]})]}),l.jsx(_b,{children:l.jsx(L,{direction:"column",gap:2,h:"full",children:s.length||S?l.jsxs(l.Fragment,{children:[l.jsx(ir,{gap:2,style:{gridTemplateColumns:m},children:s.map(M=>{const{uuid:P}=M,I=u===P;return l.jsx(l4,{image:M,isSelected:I},P)})}),l.jsx(Je,{onClick:j,isDisabled:!S,flexShrink:0,children:t(S?"gallery.loadMore":"gallery.allImagesLoaded")})]}):l.jsxs(L,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,padding:8,h:"100%",w:"100%",color:"base.500"},children:[l.jsx(tn,{as:dp,sx:{w:16,h:16}}),l.jsx(Ce,{textAlign:"center",children:t("gallery.noImagesInGallery")})]})})})]})};c4.displayName="ImageGalleryContent";const u1={txt2img:{galleryMinWidth:200,galleryMaxWidth:500},img2img:{galleryMinWidth:200,galleryMaxWidth:500},unifiedCanvas:{galleryMinWidth:200,galleryMaxWidth:200},nodes:{galleryMinWidth:200,galleryMaxWidth:500},postprocessing:{galleryMinWidth:200,galleryMaxWidth:500},training:{galleryMinWidth:200,galleryMaxWidth:500}},zN=me([bt,Pr,qr,Ot,Ss],(e,t,n,r,o)=>{const{shouldPinGallery:s,shouldShowGallery:c}=t,{galleryImageMinimumWidth:u}=n,{isLightboxOpen:f}=o;return{activeTabName:e,isStaging:r,shouldPinGallery:s,shouldShowGallery:c,galleryImageMinimumWidth:u,isResizable:e!=="unifiedCanvas",isLightboxOpen:f}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function RN(){const e=Y(),{shouldPinGallery:t,shouldShowGallery:n,galleryImageMinimumWidth:r,activeTabName:o,isStaging:s,isResizable:c,isLightboxOpen:u}=A(zN),f=()=>{e(u2()),e(cn())},h=()=>{e(xC()),t&&e(cn())},m=()=>{e(cf(!1)),t&&e(cn())};de("g",()=>{h()},[t]),de("left",()=>{e(L1())},{enabled:!s||o!=="unifiedCanvas"},[s,o]),de("right",()=>{e(B1())},{enabled:!s||o!=="unifiedCanvas"},[s,o]),de("shift+g",()=>{f()},[t]),de("esc",()=>{e(cf(!1))},{enabled:()=>!t,preventDefault:!0},[t]);const v=32;return de("shift+up",()=>{if(r<256){const x=ee.clamp(r+v,32,256);e(Zl(x))}},[r]),de("shift+down",()=>{if(r>32){const x=ee.clamp(r-v,32,256);e(Zl(x))}},[r]),l.jsx(Tb,{direction:"right",isResizable:c||!t,isOpen:n,onClose:m,isPinned:t&&!u,minWidth:t?u1[o].galleryMinWidth:200,maxWidth:t?u1[o].galleryMaxWidth:void 0,children:l.jsx(c4,{})})}var Hn=function(e,t){return Number(e.toFixed(t))},NN=function(e,t){return typeof e=="number"?e:t},Mt=function(e,t,n){n&&typeof n=="function"&&n(e,t)},FN=function(e){return-Math.cos(e*Math.PI)/2+.5},LN=function(e){return e},BN=function(e){return e*e},HN=function(e){return e*(2-e)},WN=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},VN=function(e){return e*e*e},UN=function(e){return--e*e*e+1},$N=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},GN=function(e){return e*e*e*e},qN=function(e){return 1- --e*e*e*e},YN=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},KN=function(e){return e*e*e*e*e},XN=function(e){return 1+--e*e*e*e*e},QN=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},u4={easeOut:FN,linear:LN,easeInQuad:BN,easeOutQuad:HN,easeInOutQuad:WN,easeInCubic:VN,easeOutCubic:UN,easeInOutCubic:$N,easeInQuart:GN,easeOutQuart:qN,easeInOutQuart:YN,easeInQuint:KN,easeOutQuint:XN,easeInOutQuint:QN},d4=function(e){typeof e=="number"&&cancelAnimationFrame(e)},br=function(e){e.mounted&&(d4(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function f4(e,t,n,r){if(e.mounted){var o=new Date().getTime(),s=1;br(e),e.animation=function(){if(!e.mounted)return d4(e.animation);var c=new Date().getTime()-o,u=c/n,f=u4[t],h=f(u);c>=n?(r(s),e.animation=null):e.animation&&(r(h),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function ZN(e){var t=e.scale,n=e.positionX,r=e.positionY;return!(Number.isNaN(t)||Number.isNaN(n)||Number.isNaN(r))}function jo(e,t,n,r){var o=ZN(t);if(!(!e.mounted||!o)){var s=e.setTransformState,c=e.transformState,u=c.scale,f=c.positionX,h=c.positionY,m=t.scale-u,v=t.positionX-f,x=t.positionY-h;n===0?s(t.scale,t.positionX,t.positionY):f4(e,r,n,function(S){var C=u+m*S,j=f+v*S,w=h+x*S;s(C,j,w)})}}function JN(e,t,n){var r=e.offsetWidth,o=e.offsetHeight,s=t.offsetWidth,c=t.offsetHeight,u=s*n,f=c*n,h=r-u,m=o-f;return{wrapperWidth:r,wrapperHeight:o,newContentWidth:u,newDiffWidth:h,newContentHeight:f,newDiffHeight:m}}var eF=function(e,t,n,r,o,s,c){var u=e>t?n*(c?1:.5):0,f=r>o?s*(c?1:.5):0,h=e-t-u,m=u,v=r-o-f,x=f;return{minPositionX:h,maxPositionX:m,minPositionY:v,maxPositionY:x}},Np=function(e,t){var n=e.wrapperComponent,r=e.contentComponent,o=e.setup.centerZoomedOut;if(!n||!r)throw new Error("Components are not mounted");var s=JN(n,r,t),c=s.wrapperWidth,u=s.wrapperHeight,f=s.newContentWidth,h=s.newDiffWidth,m=s.newContentHeight,v=s.newDiffHeight,x=eF(c,f,h,u,m,v,Boolean(o));return x},Xf=function(e,t,n,r){return r?en?Hn(n,2):Hn(e,2):Hn(e,2)},ea=function(e,t){var n=Np(e,t);return e.bounds=n,n};function Gc(e,t,n,r,o,s,c){var u=n.minPositionX,f=n.minPositionY,h=n.maxPositionX,m=n.maxPositionY,v=0,x=0;c&&(v=o,x=s);var S=Xf(e,u-v,h+v,r),C=Xf(t,f-x,m+x,r);return{x:S,y:C}}function qc(e,t,n,r,o,s){var c=e.transformState,u=c.scale,f=c.positionX,h=c.positionY,m=r-u;if(typeof t!="number"||typeof n!="number")return console.error("Mouse X and Y position were not provided!"),{x:f,y:h};var v=f-t*m,x=h-n*m,S=Gc(v,x,o,s,0,0,null);return S}function Cs(e,t,n,r,o){var s=o?r:0,c=t-s;return!Number.isNaN(n)&&e>=n?n:!Number.isNaN(t)&&e<=c?c:e}var d1=function(e,t){var n=e.setup.panning.excluded,r=e.isInitialized,o=e.wrapperComponent,s=t.target,c=o==null?void 0:o.contains(s),u=r&&s&&c;if(!u)return!1;var f=Yc(s,n);return!f},f1=function(e){var t=e.isInitialized,n=e.isPanning,r=e.setup,o=r.panning.disabled,s=t&&n&&!o;return!!s},tF=function(e,t){var n=e.transformState,r=n.positionX,o=n.positionY;e.isPanning=!0;var s=t.clientX,c=t.clientY;e.startCoords={x:s-r,y:c-o}},nF=function(e,t){var n=t.touches,r=e.transformState,o=r.positionX,s=r.positionY;e.isPanning=!0;var c=n.length===1;if(c){var u=n[0].clientX,f=n[0].clientY;e.startCoords={x:u-o,y:f-s}}};function rF(e){var t=e.transformState,n=t.positionX,r=t.positionY,o=t.scale,s=e.setup,c=s.disabled,u=s.limitToBounds,f=s.centerZoomedOut,h=e.wrapperComponent;if(!(c||!h||!e.bounds)){var m=e.bounds,v=m.maxPositionX,x=m.minPositionX,S=m.maxPositionY,C=m.minPositionY,j=n>v||nS||rv?h.offsetWidth:e.setup.minPositionX||0,M=r>S?h.offsetHeight:e.setup.minPositionY||0,P=qc(e,k,M,o,e.bounds,u||f),I=P.x,T=P.y;return{scale:o,positionX:j?I:n,positionY:w?T:r}}}function oF(e,t,n,r,o){var s=e.setup.limitToBounds,c=e.wrapperComponent,u=e.bounds,f=e.transformState,h=f.scale,m=f.positionX,v=f.positionY;if(!(c===null||u===null||t===m&&n===v)){var x=Gc(t,n,u,s,r,o,c),S=x.x,C=x.y;e.setTransformState(h,S,C)}}var iF=function(e,t,n){var r=e.startCoords,o=e.transformState,s=e.setup.panning,c=s.lockAxisX,u=s.lockAxisY,f=o.positionX,h=o.positionY;if(!r)return{x:f,y:h};var m=t-r.x,v=n-r.y,x=c?f:m,S=u?h:v;return{x,y:S}},gc=function(e,t){var n=e.setup,r=e.transformState,o=r.scale,s=n.minScale,c=n.disablePadding;return t>0&&o>=s&&!c?t:0},aF=function(e){var t=e.mounted,n=e.setup,r=n.disabled,o=n.velocityAnimation,s=e.transformState.scale,c=o.disabled,u=!c||s>1||!r||t;return!!u},sF=function(e){var t=e.mounted,n=e.velocity,r=e.bounds,o=e.setup,s=o.disabled,c=o.velocityAnimation,u=e.transformState.scale,f=c.disabled,h=!f||u>1||!s||t;return!(!h||!n||!r)};function lF(e,t){var n=e.setup.velocityAnimation,r=n.equalToMove,o=n.animationTime,s=n.sensitivity;return r?o*t*s:o}function h1(e,t,n,r,o,s,c,u,f,h){if(o){if(t>c&&n>c){var m=c+(e-c)*h;return m>f?f:ms?s:m}}return r?t:Xf(e,s,c,o)}function cF(e,t){var n=1;return t?Math.min(n,e.offsetWidth/window.innerWidth):n}function uF(e,t){var n=aF(e);if(n){var r=e.lastMousePosition,o=e.velocityTime,s=e.setup,c=e.wrapperComponent,u=s.velocityAnimation.equalToMove,f=Date.now();if(r&&o&&c){var h=cF(c,u),m=t.x-r.x,v=t.y-r.y,x=m/h,S=v/h,C=f-o,j=m*m+v*v,w=Math.sqrt(j)/C;e.velocity={velocityX:x,velocityY:S,total:w}}e.lastMousePosition=t,e.velocityTime=f}}function dF(e){var t=e.velocity,n=e.bounds,r=e.setup,o=e.wrapperComponent,s=sF(e);if(!(!s||!t||!n||!o)){var c=t.velocityX,u=t.velocityY,f=t.total,h=n.maxPositionX,m=n.minPositionX,v=n.maxPositionY,x=n.minPositionY,S=r.limitToBounds,C=r.alignmentAnimation,j=r.zoomAnimation,w=r.panning,k=w.lockAxisY,M=w.lockAxisX,P=j.animationType,I=C.sizeX,T=C.sizeY,_=C.velocityAlignmentTime,D=_,z=lF(e,f),W=Math.max(z,D),F=gc(e,I),B=gc(e,T),Q=F*o.offsetWidth/100,U=B*o.offsetHeight/100,X=h+Q,te=m-Q,re=v+U,$=x-U,Z=e.transformState,oe=new Date().getTime();f4(e,P,W,function(le){var ze=e.transformState,Re=ze.scale,Ie=ze.positionX,pe=ze.positionY,ce=new Date().getTime()-oe,Ne=ce/D,Ve=u4[C.animationType],Ue=1-Ve(Math.min(1,Ne)),$e=1-le,Qe=Ie+c*$e,ve=pe+u*$e,Te=h1(Qe,Z.positionX,Ie,M,S,m,h,te,X,Ue),Ge=h1(ve,Z.positionY,pe,k,S,x,v,$,re,Ue);(Ie!==Qe||pe!==ve)&&e.setTransformState(Re,Te,Ge)})}}function p1(e,t){var n=e.transformState.scale;br(e),ea(e,n),window.TouchEvent!==void 0&&t instanceof TouchEvent?nF(e,t):tF(e,t)}function h4(e){var t=e.transformState.scale,n=e.setup,r=n.minScale,o=n.alignmentAnimation,s=o.disabled,c=o.sizeX,u=o.sizeY,f=o.animationTime,h=o.animationType,m=s||t.1&&v;x?dF(e):h4(e)}}function Fp(e,t,n,r){var o=e.setup,s=o.minScale,c=o.maxScale,u=o.limitToBounds,f=Cs(Hn(t,2),s,c,0,!1),h=ea(e,f),m=qc(e,n,r,f,h,u),v=m.x,x=m.y;return{scale:f,positionX:v,positionY:x}}function p4(e,t,n){var r=e.transformState.scale,o=e.wrapperComponent,s=e.setup,c=s.minScale,u=s.limitToBounds,f=s.zoomAnimation,h=f.disabled,m=f.animationTime,v=f.animationType,x=h||r>=c;if((r>=1||u)&&h4(e),!(x||!o||!e.mounted)){var S=t||o.offsetWidth/2,C=n||o.offsetHeight/2,j=Fp(e,c,S,C);j&&jo(e,j,m,v)}}var fo=function(){return fo=Object.assign||function(t){for(var n,r=1,o=arguments.length;rc||Math.sign(n.deltaY)!==Math.sign(t.deltaY)||n.deltaY>0&&n.deltaYt.deltaY||Math.sign(n.deltaY)!==Math.sign(t.deltaY):!1},IF=function(e,t){var n=e.setup.pinch,r=n.disabled,o=n.excluded,s=e.isInitialized,c=t.target,u=s&&!r&&c;if(!u)return!1;var f=Yc(c,o);return!f},MF=function(e){var t=e.setup.pinch.disabled,n=e.isInitialized,r=e.pinchStartDistance,o=n&&!t&&r;return!!o},TF=function(e,t,n){var r=n.getBoundingClientRect(),o=e.touches,s=Hn(o[0].clientX-r.left,5),c=Hn(o[0].clientY-r.top,5),u=Hn(o[1].clientX-r.left,5),f=Hn(o[1].clientY-r.top,5);return{x:(s+u)/2/t,y:(c+f)/2/t}},S4=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},_F=function(e,t){var n=e.pinchStartScale,r=e.pinchStartDistance,o=e.setup,s=o.maxScale,c=o.minScale,u=o.zoomAnimation,f=o.disablePadding,h=u.size,m=u.disabled;if(!n||r===null||!t)throw new Error("Pinch touches distance was not provided");if(t<0)return e.transformState.scale;var v=t/r,x=v*n;return Cs(Hn(x,2),c,s,h,!m&&!f)},DF=160,AF=100,OF=function(e,t){var n=e.props,r=n.onWheelStart,o=n.onZoomStart;e.wheelStopEventTimer||(br(e),Mt(dt(e),t,r),Mt(dt(e),t,o))},zF=function(e,t){var n=e.props,r=n.onWheel,o=n.onZoom,s=e.contentComponent,c=e.setup,u=e.transformState,f=u.scale,h=c.limitToBounds,m=c.centerZoomedOut,v=c.zoomAnimation,x=c.wheel,S=c.disablePadding,C=v.size,j=v.disabled,w=x.step;if(!s)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var k=kF(t,null),M=EF(e,k,w,!t.ctrlKey);if(f!==M){var P=ea(e,M),I=b4(t,s,f),T=j||C===0||m||S,_=h&&T,D=qc(e,I.x,I.y,M,P,_),z=D.x,W=D.y;e.previousWheelEvent=t,e.setTransformState(M,z,W),Mt(dt(e),t,r),Mt(dt(e),t,o)}},RF=function(e,t){var n=e.props,r=n.onWheelStop,o=n.onZoomStop;Qf(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(p4(e,t.x,t.y),e.wheelAnimationTimer=null)},AF);var s=PF(e,t);s&&(Qf(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,Mt(dt(e),t,r),Mt(dt(e),t,o))},DF))},NF=function(e,t){var n=S4(t);e.pinchStartDistance=n,e.lastDistance=n,e.pinchStartScale=e.transformState.scale,e.isPanning=!1,br(e)},FF=function(e,t){var n=e.contentComponent,r=e.pinchStartDistance,o=e.transformState.scale,s=e.setup,c=s.limitToBounds,u=s.centerZoomedOut,f=s.zoomAnimation,h=f.disabled,m=f.size;if(!(r===null||!n)){var v=TF(t,o,n);if(!(!Number.isFinite(v.x)||!Number.isFinite(v.y))){var x=S4(t),S=_F(e,x);if(S!==o){var C=ea(e,S),j=h||m===0||u,w=c&&j,k=qc(e,v.x,v.y,S,C,w),M=k.x,P=k.y;e.pinchMidpoint=v,e.lastDistance=x,e.setTransformState(S,M,P)}}}},LF=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,p4(e,t==null?void 0:t.x,t==null?void 0:t.y)},C4=function(e,t){var n=e.props.onZoomStop,r=e.setup.doubleClick.animationTime;Qf(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,Mt(dt(e),t,n)},r)},BF=function(e,t){var n=e.props,r=n.onZoomStart,o=n.onZoom,s=e.setup.doubleClick,c=s.animationTime,u=s.animationType;Mt(dt(e),t,r),y4(e,c,u,function(){return Mt(dt(e),t,o)}),C4(e,t)};function HF(e,t){var n=e.setup,r=e.doubleClickStopEventTimer,o=e.transformState,s=e.contentComponent,c=o.scale,u=e.props,f=u.onZoomStart,h=u.onZoom,m=n.doubleClick,v=m.disabled,x=m.mode,S=m.step,C=m.animationTime,j=m.animationType;if(!v&&!r){if(x==="reset")return BF(e,t);if(!s)return console.error("No ContentComponent found");var w=x==="zoomOut"?-1:1,k=v4(e,w,S);if(c!==k){Mt(dt(e),t,f);var M=b4(t,s,c),P=Fp(e,k,M.x,M.y);if(!P)return console.error("Error during zoom event. New transformation state was not calculated.");Mt(dt(e),t,h),jo(e,P,C,j),C4(e,t)}}}var WF=function(e,t){var n=e.isInitialized,r=e.setup,o=e.wrapperComponent,s=r.doubleClick,c=s.disabled,u=s.excluded,f=t.target,h=o==null?void 0:o.contains(f),m=n&&f&&h&&!c;if(!m)return!1;var v=Yc(f,u);return!v},VF=function(){function e(t){var n=this;this.mounted=!0,this.onChangeCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.startCoords=null,this.lastTouch=null,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.animate=!1,this.animation=null,this.maxBounds=null,this.pressedKeys={},this.mount=function(){n.initializeWindowEvents()},this.unmount=function(){n.cleanupWindowEvents()},this.update=function(r){ea(n,n.transformState.scale),n.setup=g1(r)},this.initializeWindowEvents=function(){var r,o=Kd(),s=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,c=s==null?void 0:s.defaultView;c==null||c.addEventListener("mousedown",n.onPanningStart,o),c==null||c.addEventListener("mousemove",n.onPanning,o),c==null||c.addEventListener("mouseup",n.onPanningStop,o),s==null||s.addEventListener("mouseleave",n.clearPanning,o),c==null||c.addEventListener("keyup",n.setKeyUnPressed,o),c==null||c.addEventListener("keydown",n.setKeyPressed,o)},this.cleanupWindowEvents=function(){var r,o,s=Kd(),c=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,u=c==null?void 0:c.defaultView;u==null||u.removeEventListener("mousedown",n.onPanningStart,s),u==null||u.removeEventListener("mousemove",n.onPanning,s),u==null||u.removeEventListener("mouseup",n.onPanningStop,s),c==null||c.removeEventListener("mouseleave",n.clearPanning,s),u==null||u.removeEventListener("keyup",n.setKeyUnPressed,s),u==null||u.removeEventListener("keydown",n.setKeyPressed,s),document.removeEventListener("mouseleave",n.clearPanning,s),br(n),(o=n.observer)===null||o===void 0||o.disconnect()},this.handleInitializeWrapperEvents=function(r){var o=Kd();r.addEventListener("wheel",n.onWheelZoom,o),r.addEventListener("dblclick",n.onDoubleClick,o),r.addEventListener("touchstart",n.onTouchPanningStart,o),r.addEventListener("touchmove",n.onTouchPanning,o),r.addEventListener("touchend",n.onTouchPanningStop,o)},this.handleInitialize=function(r){var o=n.setup.centerOnInit;n.applyTransformation(),o&&(n.setCenter(),n.observer=new ResizeObserver(function(){var s;n.setCenter(),(s=n.observer)===null||s===void 0||s.disconnect()}),n.observer.observe(r))},this.onWheelZoom=function(r){var o=n.setup.disabled;if(!o){var s=wF(n,r);if(s){var c=n.isPressingKeys(n.setup.wheel.activationKeys);c&&(OF(n,r),zF(n,r),RF(n,r))}}},this.onPanningStart=function(r){var o=n.setup.disabled,s=n.props.onPanningStart;if(!o){var c=d1(n,r);if(c){var u=n.isPressingKeys(n.setup.panning.activationKeys);u&&(r.preventDefault(),r.stopPropagation(),br(n),p1(n,r),Mt(dt(n),r,s))}}},this.onPanning=function(r){var o=n.setup.disabled,s=n.props.onPanning;if(!o){var c=f1(n);if(c){var u=n.isPressingKeys(n.setup.panning.activationKeys);u&&(r.preventDefault(),r.stopPropagation(),m1(n,r.clientX,r.clientY),Mt(dt(n),r,s))}}},this.onPanningStop=function(r){var o=n.props.onPanningStop;n.isPanning&&(fF(n),Mt(dt(n),r,o))},this.onPinchStart=function(r){var o=n.setup.disabled,s=n.props,c=s.onPinchingStart,u=s.onZoomStart;if(!o){var f=IF(n,r);f&&(NF(n,r),br(n),Mt(dt(n),r,c),Mt(dt(n),r,u))}},this.onPinch=function(r){var o=n.setup.disabled,s=n.props,c=s.onPinching,u=s.onZoom;if(!o){var f=MF(n);f&&(r.preventDefault(),r.stopPropagation(),FF(n,r),Mt(dt(n),r,c),Mt(dt(n),r,u))}},this.onPinchStop=function(r){var o=n.props,s=o.onPinchingStop,c=o.onZoomStop;n.pinchStartScale&&(LF(n),Mt(dt(n),r,s),Mt(dt(n),r,c))},this.onTouchPanningStart=function(r){var o=n.setup.disabled,s=n.props.onPanningStart;if(!o){var c=d1(n,r);if(c){var u=n.lastTouch&&+new Date-n.lastTouch<200;if(u&&r.touches.length===1)n.onDoubleClick(r);else{n.lastTouch=+new Date,br(n);var f=r.touches,h=f.length===1,m=f.length===2;h&&(br(n),p1(n,r),Mt(dt(n),r,s)),m&&n.onPinchStart(r)}}}},this.onTouchPanning=function(r){var o=n.setup.disabled,s=n.props.onPanning;if(n.isPanning&&r.touches.length===1){if(o)return;var c=f1(n);if(!c)return;r.preventDefault(),r.stopPropagation();var u=r.touches[0];m1(n,u.clientX,u.clientY),Mt(dt(n),r,s)}else r.touches.length>1&&n.onPinch(r)},this.onTouchPanningStop=function(r){n.onPanningStop(r),n.onPinchStop(r)},this.onDoubleClick=function(r){var o=n.setup.disabled;if(!o){var s=WF(n,r);s&&HF(n,r)}},this.clearPanning=function(r){n.isPanning&&n.onPanningStop(r)},this.setKeyPressed=function(r){n.pressedKeys[r.key]=!0},this.setKeyUnPressed=function(r){n.pressedKeys[r.key]=!1},this.isPressingKeys=function(r){return r.length?Boolean(r.find(function(o){return n.pressedKeys[o]})):!0},this.setTransformState=function(r,o,s){var c=n.props.onTransformed;if(!Number.isNaN(r)&&!Number.isNaN(o)&&!Number.isNaN(s)){r!==n.transformState.scale&&(n.transformState.previousScale=n.transformState.scale,n.transformState.scale=r),n.transformState.positionX=o,n.transformState.positionY=s;var u=dt(n);n.onChangeCallbacks.forEach(function(f){return f(u)}),Mt(u,{scale:r,positionX:o,positionY:s},c),n.applyTransformation()}else console.error("Detected NaN set state values")},this.setCenter=function(){if(n.wrapperComponent&&n.contentComponent){var r=x4(n.transformState.scale,n.wrapperComponent,n.contentComponent);n.setTransformState(r.scale,r.positionX,r.positionY)}},this.handleTransformStyles=function(r,o,s){return n.props.customTransform?n.props.customTransform(r,o,s):SF(r,o,s)},this.applyTransformation=function(){if(!(!n.mounted||!n.contentComponent)){var r=n.transformState,o=r.scale,s=r.positionX,c=r.positionY,u=n.handleTransformStyles(s,c,o);n.contentComponent.style.transform=u}},this.getContext=function(){return dt(n)},this.onChange=function(r){return n.onChangeCallbacks.has(r)||n.onChangeCallbacks.add(r),function(){n.onChangeCallbacks.delete(r)}},this.init=function(r,o){n.cleanupWindowEvents(),n.wrapperComponent=r,n.contentComponent=o,ea(n,n.transformState.scale),n.handleInitializeWrapperEvents(r),n.handleInitialize(o),n.initializeWindowEvents(),n.isInitialized=!0,Mt(dt(n),void 0,n.props.onInit)},this.props=t,this.setup=g1(this.props),this.transformState=m4(this.props)}return e}(),Kc=Me.createContext(null),UF=function(e,t){return typeof e=="function"?e(t):e},$F=Me.forwardRef(function(e,t){var n=y.useState(0),r=n[1],o=e.children,s=y.useRef(new VF(e)).current,c=UF(e.children,dt(s)),u=y.useCallback(function(){typeof o=="function"&&r(function(f){return f+1})},[o]);return y.useImperativeHandle(t,function(){return dt(s)},[s]),y.useEffect(function(){s.update(e)},[s,e]),y.useEffect(function(){return s.onChange(u)},[s,e,u]),Me.createElement(Kc.Provider,{value:s},c)});function GF(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(!e||typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var qF=`.transform-component-module_wrapper__7HFJe { position: relative; width: -moz-fit-content; width: fit-content; height: -moz-fit-content; height: fit-content; overflow: hidden; -webkit-touch-callout: none; /* iOS Safari */ -webkit-user-select: none; /* Safari */ -khtml-user-select: none; /* Konqueror HTML */ -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* Internet Explorer/Edge */ user-select: none; margin: 0; padding: 0; } .transform-component-module_content__uCDPE { display: flex; flex-wrap: wrap; width: -moz-fit-content; width: fit-content; height: -moz-fit-content; height: fit-content; margin: 0; padding: 0; transform-origin: 0% 0%; } .transform-component-module_content__uCDPE img { pointer-events: none; } `,y1={wrapper:"transform-component-module_wrapper__7HFJe",content:"transform-component-module_content__uCDPE"};GF(qF);var YF=function(e){var t=e.children,n=e.wrapperClass,r=n===void 0?"":n,o=e.contentClass,s=o===void 0?"":o,c=e.wrapperStyle,u=e.contentStyle,f=e.wrapperProps,h=f===void 0?{}:f,m=e.contentProps,v=m===void 0?{}:m,x=y.useContext(Kc).init,S=y.useRef(null),C=y.useRef(null);return y.useEffect(function(){var j=S.current,w=C.current;j!==null&&w!==null&&x&&x(j,w)},[]),Me.createElement("div",fo({},h,{ref:S,className:"react-transform-wrapper ".concat(y1.wrapper," ").concat(r),style:c}),Me.createElement("div",fo({},v,{ref:C,className:"react-transform-component ".concat(y1.content," ").concat(s),style:u}),t))},w4=function(){var e=y.useContext(Kc),t=y.useState(dt(e||{})),n=t[0],r=t[1];if(!e)throw new Error("Transform context mus be placed inside TransformWrapper");return y.useEffect(function(){e.onChange(function(o){r(o)})},[e]),n};Me.forwardRef(function(e,t){var n=y.useRef(null),r=y.useContext(Kc);return y.useEffect(function(){return r.onChange(function(o){if(n.current){var s=0,c=0;n.current.style.transform=r.handleTransformStyles(s,c,1/o.state.scale)}})},[r]),Me.createElement("div",fo({},e,{ref:CF([n,t])}))});const KF=()=>{const[e,t]=y.useState(0),[n,r]=y.useState(1),[o,s]=y.useState(1);return{rotation:e,scaleX:n,scaleY:o,flipHorizontally:()=>{r(n*-1)},flipVertically:()=>{s(o*-1)},rotateCounterClockwise:()=>{t(e===-270?0:e-90)},rotateClockwise:()=>{t(e===270?0:e+90)},reset:()=>{t(0),r(1),s(1)}}},XF=({flipHorizontally:e,flipVertically:t,rotateCounterClockwise:n,rotateClockwise:r,reset:o})=>{const{zoomIn:s,zoomOut:c,resetTransform:u}=w4(),{t:f}=K();return l.jsxs(Qt,{isAttached:!0,orientation:"vertical",children:[l.jsx(se,{icon:l.jsx(yD,{}),"aria-label":f("accessibility.zoomIn"),tooltip:"Zoom In",onClick:()=>s(),fontSize:20}),l.jsx(se,{icon:l.jsx(xD,{}),"aria-label":f("accessibility.zoomOut"),tooltip:"Zoom Out",onClick:()=>c(),fontSize:20}),l.jsx(se,{icon:l.jsx(vD,{}),"aria-label":f("accessibility.rotateCounterClockwise"),tooltip:"Rotate Counter-Clockwise",onClick:n,fontSize:20}),l.jsx(se,{icon:l.jsx(gD,{}),"aria-label":f("accessibility.rotateClockwise"),tooltip:"Rotate Clockwise",onClick:r,fontSize:20}),l.jsx(se,{icon:l.jsx(H0,{}),"aria-label":f("accessibility.flipHorizontally"),tooltip:"Flip Horizontally",onClick:e,fontSize:20}),l.jsx(se,{icon:l.jsx(H0,{style:{transform:"rotate(90deg)"}}),"aria-label":f("accessibility.flipVertically"),tooltip:"Flip Vertically",onClick:t,fontSize:20}),l.jsx(se,{icon:l.jsx(Pb,{}),"aria-label":f("accessibility.reset"),tooltip:"Reset",onClick:()=>{u(),o()},fontSize:20})]})};function QF({image:e,alt:t,ref:n,styleClass:r,rotation:o,scaleX:s,scaleY:c}){const{centerView:u}=w4();return l.jsx(YF,{wrapperStyle:{width:"100%",height:"100%"},children:l.jsx("img",{style:{transform:`rotate(${o}deg) scaleX(${s}) scaleY(${c})`,width:"100%"},src:e.url,alt:t,ref:n,className:r||"",onLoad:()=>u(1,0,"easeOut")})})}const ZF=me([qr,Pr],(e,t)=>{const{currentImage:n}=e,{shouldShowImageDetails:r}=t;return{viewerImageToDisplay:n,shouldShowImageDetails:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function JF(){const e=Y(),t=A(x=>x.lightbox.isLightboxOpen),{rotation:n,scaleX:r,scaleY:o,flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:h}=KF(),{viewerImageToDisplay:m,shouldShowImageDetails:v}=A(ZF);return de("Esc",()=>{t&&e(Uo(!1))},[t]),l.jsx(xo,{children:t&&l.jsx(ar.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,ease:"easeInOut"},style:{display:"flex",width:"100vw",height:`calc(100vh - ${dc*4}px)`,position:"fixed",top:`${dc*4}px`,background:"var(--invokeai-colors-base-900)",zIndex:99},children:l.jsxs($F,{centerOnInit:!0,minScale:.1,initialPositionX:50,initialPositionY:50,children:[l.jsxs(L,{sx:{flexDir:"column",position:"absolute",insetInlineStart:4,gap:4,zIndex:3,top:4},children:[l.jsx(se,{icon:l.jsx(mD,{}),"aria-label":"Exit Viewer",className:"lightbox-close-btn",onClick:()=>{e(Uo(!1))},fontSize:20}),l.jsx(XF,{flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:h})]}),l.jsx(L,{sx:{position:"absolute",top:4,zIndex:3,insetInlineStart:"50%",transform:"translate(-50%, 0)"},children:l.jsx(Ob,{})}),m&&l.jsxs(l.Fragment,{children:[l.jsx(QF,{rotation:n,scaleX:r,scaleY:o,image:m,styleClass:"lightbox-image"}),v&&l.jsx(yp,{image:m}),!v&&l.jsx(Ye,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"100vw",h:"100vh",px:16,pointerEvents:"none"},children:l.jsx(zb,{})})]})]})},"lightbox")})}EN();const oL=e=>{PN();const t=A(r=>r.ui.currentTheme),{setColorMode:n}=bC();return y.useEffect(()=>{n(["light"].includes(t)?"light":"dark")},[n,t]),l.jsxs(ir,{w:"100vw",h:"100vh",children:[l.jsx(JF,{}),l.jsxs(a9,{children:[l.jsx(rP,{}),l.jsxs(ir,{gap:4,p:4,gridAutoRows:"min-content auto",w:Z9,h:J9,children:[e.children||l.jsx(Mb,{}),l.jsxs(L,{gap:4,w:"full",h:"full",children:[l.jsx(kN,{}),l.jsx(RN,{})]})]}),l.jsx(Ye,{children:l.jsx(X9,{})})]}),l.jsx($a,{children:l.jsx(_N,{})}),l.jsx($a,{children:l.jsx(MN,{})})]})};export{oL as default};