import{r as g,f as fe,j as l,u as zS,c as re,a as Ae,b as Ee,w as ts,d as un,o as At,S as Xf,e as go,g as qe,h as Rr,k as Jo,i as yc,_ as Yd,l as RS,m as NS,R as Me,n as Ev,p as FS,q as Kd,s as ea,t as y1,v as x1,x as LS,y as BS,z as ee,A as b1,B as S1,C as xc,D as ns,F as B,E as X,G as HS,H as cd,T as Ce,I as C1,J as WS,K as rs,L as Pv,M as VS,N as US,O as $S,P as Wo,Q as w1,U as Iv,V as GS,W as k1,X as qS,Y as YS,Z as KS,$ as j1,a0 as XS,a1 as QS,a2 as ZS,a3 as JS,a4 as e3,a5 as t3,a6 as n3,a7 as E1,a8 as r3,a9 as o3,aa as ql,ab as i3,ac as a3,ad as Nl,ae as Yl,af as Xd,ag as Qd,ah as Zd,ai as s3,aj as P1,ak as l3,al as I1,am as c3,an as M1,ao as T1,ap as Vo,aq as jn,ar as _1,as as os,at as u3,au as d3,av as D1,aw as Jd,ax as ef,ay as A1,az as tf,aA as nf,aB as Mv,aC as O1,aD as z1,aE as R1,aF as Fl,aG as Ll,aH as f3,aI as rf,aJ as N1,aK as F1,aL as L1,aM as h3,aN as p3,aO as Tv,aP as _v,aQ as m3,aR as v3,aS as g3,aT as B1,aU as H1,aV as y3,aW as x3,aX as W1,aY as Dv,aZ as b3,a_ as Av,a$ as S3,b0 as C3,b1 as V1,b2 as w3,b3 as k3,b4 as j3,b5 as ud,b6 as Ov,b7 as U1,b8 as of,b9 as E3,ba as zv,bb as Bl,bc as P3,bd as I3,be as Va,bf as Kl,bg as $1,bh as Xl,bi as M3,bj as T3,bk as br,bl as G1,bm as Qf,bn as is,bo as _3,bp as D3,bq as A3,br as wr,bs as q1,bt as O3,bu as z3,bv as Y1,bw as R3,bx as N3,by as F3,bz as L3,bA as B3,bB as H3,bC as W3,bD as V3,bE as U3,bF as Rv,bG as $3,bH as G3,bI as q3,bJ as Y3,bK as K3,bL as X3,bM as dd,bN as Oa,bO as pl,bP as Nv,bQ as fd,bR as hd,bS as ml,bT as Fv,bU as af,bV as Q3,bW as Z3,bX as J3,bY as bc,bZ as eC,b_ as tC,b$ as nC,c0 as rC,c1 as vl,c2 as pd,c3 as gl,c4 as Ia,c5 as oC,c6 as iC,c7 as K1,c8 as Ql,c9 as Zf,ca as X1,cb as Q1,cc as Z1,cd as aC,ce as J1,cf as e2,cg as t2,ch as n2,ci as r2,cj as Fi,ck as Li,cl as o2,cm as i2,cn as a2,co as s2,cp as l2,cq as sC,cr as lC,cs as Lv,ct as yl,cu as cC,cv as Bv,cw as Hv,cx as Wv,cy as Vv,cz as uC,cA as dC,cB as sf,cC as fC,cD as Uv,cE as xl,cF as Zl,cG as hC,cH as pC,cI as mC,cJ as vC,cK as c2,cL as gC,cM as yC}from"./index-d64f4654.js";import{I as tn,u as xC,c as bC,a as jt,b as Wt,A as yo,m as ir,d as Bi,e as ei,P as Ua,f as SC,C as CC,g as Y,h as A}from"./storeHooks-0eed8e9f.js";function wC(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 kC(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 jC(e,t){var n=[];function r(u){var f=n.findIndex(function(h){return t(u,h.key)});if(f>-1){var p=n[f];return f>0&&(n.splice(f,1),n.unshift(p)),p.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 EC=function(t,n){return t===n};function PC(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(),f2=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(OC()),d2);function zC(e){let t=[],n=[],r=0,o=!1,s=!1;const c=new WeakSet,u={schedule:(f,p=!1,h=!1)=>{const y=h&&o,x=y?t:n;return p&&c.add(f),x.indexOf(f)===-1&&(x.push(f),y&&o&&(r=t.length)),f},cancel:f=>{const p=n.indexOf(f);p!==-1&&n.splice(p,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 p=0;p(e[t]=zC(()=>$a=!0),e),{}),NC=as.reduce((e,t)=>{const n=Sc[t];return e[t]=(r,o=!1,s=!1)=>($a||BC(),n.schedule(r,o,s)),e},{}),FC=as.reduce((e,t)=>(e[t]=Sc[t].cancel,e),{});as.reduce((e,t)=>(e[t]=()=>Sc[t].process(Hi),e),{});const LC=e=>Sc[e].process(Hi),h2=e=>{$a=!1,Hi.delta=lf?d2:Math.max(Math.min(e-Hi.timestamp,RC),1),Hi.timestamp=e,cf=!0,as.forEach(LC),cf=!1,$a&&(lf=!1,f2(h2))},BC=()=>{$a=!0,lf=!0,cf||f2(h2)},$v=()=>Hi;function Jf(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=g.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 ss(e){const{theme:t}=zS(),n=xC();return g.useMemo(()=>bC(t.direction,{...n,...e}),[e,t.direction,n])}var HC=Object.defineProperty,WC=(e,t,n)=>t in e?HC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zt=(e,t,n)=>(WC(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 VC=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 uf=typeof window<"u"?g.useLayoutEffect:g.useEffect,ec=e=>e,UC=class{constructor(){zt(this,"descendants",new Map),zt(this,"register",e=>{if(e!=null)return VC(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 $C(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=>{$C(n,t)})}}function GC(...e){return g.useMemo(()=>ct(...e),e)}function qC(){const e=g.useRef(new UC);return uf(()=>()=>e.current.destroy()),e.current}var[YC,p2]=jt({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function KC(e){const t=p2(),[n,r]=g.useState(-1),o=g.useRef(null);uf(()=>()=>{o.current&&t.unregister(o.current)},[]),uf(()=>{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 eh(){return[ec(YC),()=>ec(p2()),()=>qC(),o=>KC(o)]}var[XC,Cc]=jt({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[QC,th]=jt({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[ZC,tL,JC,ew]=eh(),Di=fe(function(t,n){const{getButtonProps:r}=th(),o=r(t,n),c={display:"flex",alignItems:"center",width:"100%",outline:0,...Cc().button};return l.jsx(re.button,{...o,className:Ae("chakra-accordion__button",t.className),__css:c})});Di.displayName="AccordionButton";function nh(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(x,S)=>x!==S}=e,s=Wt(r),c=Wt(o),[u,f]=g.useState(n),p=t!==void 0,h=p?t:u,y=Wt(x=>{const C=typeof x=="function"?x(h):x;c(h,C)&&(p||f(C),s(C))},[p,s,h,c]);return[h,y]}function tw(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...c}=e;ow(e),iw(e);const u=JC(),[f,p]=g.useState(-1);g.useEffect(()=>()=>{p(-1)},[]);const[h,y]=nh({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:h,setIndex:y,htmlProps:c,getAccordionItemProps:S=>{let C=!1;return S!==null&&(C=Array.isArray(h)?h.includes(S):h===S),{isOpen:C,onChange:w=>{if(S!==null)if(o&&Array.isArray(h)){const j=w?h.concat(S):h.filter(I=>I!==S);y(j)}else w?y(S):s&&y(-1)}}},focusedIndex:f,setFocusedIndex:p,descendants:u}}var[nw,rh]=jt({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function rw(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:c}=rh(),u=g.useRef(null),f=g.useId(),p=r??f,h=`accordion-button-${p}`,y=`accordion-panel-${p}`;aw(e);const{register:x,index:S,descendants:C}=ew({disabled:t&&!n}),{isOpen:k,onChange:w}=s(S===-1?null:S);sw({isOpen:k,isDisabled:t});const j=()=>{w==null||w(!0)},I=()=>{w==null||w(!1)},P=g.useCallback(()=>{w==null||w(!k),c(S)},[S,c,k,w]),M=g.useCallback(R=>{const F={ArrowDown:()=>{const L=C.nextEnabled(S);L==null||L.node.focus()},ArrowUp:()=>{const L=C.prevEnabled(S);L==null||L.node.focus()},Home:()=>{const L=C.firstEnabled();L==null||L.node.focus()},End:()=>{const L=C.lastEnabled();L==null||L.node.focus()}}[R.key];F&&(R.preventDefault(),F(R))},[C,S]),T=g.useCallback(()=>{c(S)},[c,S]),D=g.useCallback(function(V={},F=null){return{...V,type:"button",ref:ct(x,u,F),id:h,disabled:!!t,"aria-expanded":!!k,"aria-controls":y,onClick:Ee(V.onClick,P),onFocus:Ee(V.onFocus,T),onKeyDown:Ee(V.onKeyDown,M)}},[h,t,k,P,T,M,y,x]),_=g.useCallback(function(V={},F=null){return{...V,ref:F,role:"region",id:y,"aria-labelledby":h,hidden:!k}},[h,k,y]);return{isOpen:k,isDisabled:t,isFocusable:n,onOpen:j,onClose:I,getButtonProps:D,getPanelProps:_,htmlProps:o}}function ow(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;ts({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function iw(e){ts({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 aw(e){ts({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 sw(e){ts({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Ai(e){const{isOpen:t,isDisabled:n}=th(),{reduceMotion:r}=rh(),o=Ae("chakra-accordion__icon",e.className),s=Cc(),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"})})}Ai.displayName="AccordionIcon";var Oi=fe(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...c}=rw(t),f={...Cc().container,overflowAnchor:"none"},p=g.useMemo(()=>c,[c]);return l.jsx(QC,{value:p,children:l.jsx(re.div,{ref:n,...s,className:Ae("chakra-accordion__item",o),__css:f,children:typeof r=="function"?r({isExpanded:!!c.isOpen,isDisabled:!!c.isDisabled}):r})})});Oi.displayName="AccordionItem";var Bo={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Ma={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 df(e){var t;switch((t=e==null?void 0:e.direction)!=null?t:"right"){case"right":return Ma.slideRight;case"left":return Ma.slideLeft;case"bottom":return Ma.slideDown;case"top":return Ma.slideUp;default:return Ma.slideRight}}var Uo={enter:{duration:.2,ease:Bo.easeOut},exit:{duration:.1,ease:Bo.easeIn}},nr={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})},lw=e=>e!=null&&parseInt(e.toString(),10)>0,Kv={exit:{height:{duration:.2,ease:Bo.ease},opacity:{duration:.3,ease:Bo.ease}},enter:{height:{duration:.3,ease:Bo.ease},opacity:{duration:.4,ease:Bo.ease}}},cw={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:lw(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:nr.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:nr.enter(Kv.enter,o)}}},m2=g.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:c="auto",style:u,className:f,transition:p,transitionEnd:h,...y}=e,[x,S]=g.useState(!1);g.useEffect(()=>{const I=setTimeout(()=>{S(!0)});return()=>clearTimeout(I)},[]),ts({condition:Boolean(s>0&&r),message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const C=parseFloat(s.toString())>0,k={startingHeight:s,endingHeight:c,animateOpacity:o,transition:x?p:{enter:{duration:0}},transitionEnd:{enter:h==null?void 0:h.enter,exit:r?h==null?void 0:h.exit:{...h==null?void 0:h.exit,display:C?"block":"none"}}},w=r?n:!0,j=n||r?"enter":"exit";return l.jsx(yo,{initial:!1,custom:k,children:w&&l.jsx(ir.div,{ref:t,...y,className:Ae("chakra-collapse",f),style:{overflow:"hidden",display:"block",...u},custom:k,variants:cw,initial:r?"exit":!1,animate:j,exit:"exit"})})});m2.displayName="Collapse";var uw={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:nr.enter(Uo.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:nr.exit(Uo.exit,n),transitionEnd:t==null?void 0:t.exit}}},v2={initial:"exit",animate:"enter",exit:"exit",variants:uw},dw=g.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:c,transitionEnd:u,delay:f,...p}=t,h=o||r?"enter":"exit",y=r?o&&r:!0,x={transition:c,transitionEnd:u,delay:f};return l.jsx(yo,{custom:x,children:y&&l.jsx(ir.div,{ref:n,className:Ae("chakra-fade",s),custom:x,...v2,animate:h,...p})})});dw.displayName="Fade";var fw={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:nr.exit(Uo.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:nr.enter(Uo.enter,n),transitionEnd:e==null?void 0:e.enter}}},g2={initial:"exit",animate:"enter",exit:"exit",variants:fw},hw=g.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:c=.95,className:u,transition:f,transitionEnd:p,delay:h,...y}=t,x=r?o&&r:!0,S=o||r?"enter":"exit",C={initialScale:c,reverse:s,transition:f,transitionEnd:p,delay:h};return l.jsx(yo,{custom:C,children:x&&l.jsx(ir.div,{ref:n,className:Ae("chakra-offset-slide",u),...g2,animate:S,custom:C,...y})})});hw.displayName="ScaleFade";var pw={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:nr.exit(Uo.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:nr.enter(Uo.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:nr.exit(Uo.exit,s),...o?{...u,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...u,...r==null?void 0:r.exit}}}}},ff={initial:"initial",animate:"enter",exit:"exit",variants:pw},mw=g.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:c,offsetX:u=0,offsetY:f=8,transition:p,transitionEnd:h,delay:y,...x}=t,S=r?o&&r:!0,C=o||r?"enter":"exit",k={offsetX:u,offsetY:f,reverse:s,transition:p,transitionEnd:h,delay:y};return l.jsx(yo,{custom:k,children:S&&l.jsx(ir.div,{ref:n,className:Ae("chakra-offset-slide",c),custom:k,...ff,animate:C,...x})})});mw.displayName="SlideFade";var Xv={exit:{duration:.15,ease:Bo.easeInOut},enter:{type:"spring",damping:25,stiffness:180}},vw={exit:({direction:e,transition:t,transitionEnd:n,delay:r})=>{var o;const{exit:s}=df({direction:e});return{...s,transition:(o=t==null?void 0:t.exit)!=null?o:nr.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}=df({direction:e});return{...s,transition:(o=n==null?void 0:n.enter)!=null?o:nr.enter(Xv.enter,r),transitionEnd:t==null?void 0:t.enter}}},y2=g.forwardRef(function(t,n){const{direction:r="right",style:o,unmountOnExit:s,in:c,className:u,transition:f,transitionEnd:p,delay:h,motionProps:y,...x}=t,S=df({direction:r}),C=Object.assign({position:"fixed"},S.position,o),k=s?c&&s:!0,w=c||s?"enter":"exit",j={transitionEnd:p,transition:f,direction:r,delay:h};return l.jsx(yo,{custom:j,children:k&&l.jsx(ir.div,{...x,ref:n,initial:"exit",className:Ae("chakra-slide",u),animate:w,exit:"exit",custom:j,variants:vw,style:C,...y})})});y2.displayName="Slide";var zi=fe(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:c}=rh(),{getPanelProps:u,isOpen:f}=th(),p=u(s,n),h=Ae("chakra-accordion__panel",r),y=Cc();c||delete p.hidden;const x=l.jsx(re.div,{...p,__css:y.panel,className:h});return c?x:l.jsx(m2,{in:f,...o,children:x})});zi.displayName="AccordionPanel";var oh=fe(function({children:t,reduceMotion:n,...r},o){const s=un("Accordion",r),c=At(r),{htmlProps:u,descendants:f,...p}=tw(c),h=g.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return l.jsx(ZC,{value:f,children:l.jsx(nw,{value:h,children:l.jsx(XC,{value:s,children:l.jsx(re.div,{ref:o,...u,className:Ae("chakra-accordion",r.className),__css:s.root,children:t})})})})});oh.displayName="Accordion";var hf=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})});hf.displayName="NativeImage";function gw(e){const{loading:t,src:n,srcSet:r,onLoad:o,onError:s,crossOrigin:c,sizes:u,ignoreFallback:f}=e,[p,h]=g.useState("pending");g.useEffect(()=>{h(n?"loading":"pending")},[n]);const y=g.useRef(),x=g.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=k=>{S(),h("loaded"),o==null||o(k)},C.onerror=k=>{S(),h("failed"),s==null||s(k)},y.current=C},[n,c,r,u,o,s,t]),S=()=>{y.current&&(y.current.onload=null,y.current.onerror=null,y.current=null)};return Bi(()=>{if(!f)return p==="loading"&&x(),()=>{S()}},[p,x,f]),f?"loaded":p}var yw=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function xw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var ls=fe(function(t,n){const{fallbackSrc:r,fallback:o,src:s,srcSet:c,align:u,fit:f,loading:p,ignoreFallback:h,crossOrigin:y,fallbackStrategy:x="beforeLoadOrError",referrerPolicy:S,...C}=t,k=r!==void 0||o!==void 0,w=p!=null||h||!k,j=gw({...t,ignoreFallback:w}),I=yw(j,x),P={ref:n,objectFit:f,objectPosition:u,...w?C:xw(C,["onError","onLoad"])};return I?o||l.jsx(re.img,{as:hf,className:"chakra-image__placeholder",src:r,...P}):l.jsx(re.img,{as:hf,src:s,srcSet:c,crossOrigin:y,loading:p,referrerPolicy:S,className:"chakra-image",...P})});ls.displayName="Image";function ih(e){return g.Children.toArray(e).filter(t=>g.isValidElement(t))}var[bw,Sw]=jt({strict:!1,name:"ButtonGroupContext"}),Cw={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}}},ww={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:p,orientation:h="horizontal",...y}=t,x=Ae("chakra-button__group",c),S=g.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let C={display:"inline-flex",...f?Cw[h]:ww[h](u)};const k=h==="vertical";return l.jsx(bw,{value:S,children:l.jsx(re.div,{ref:n,role:"group",__css:C,className:x,"data-attached":f?"":void 0,"data-orientation":h,flexDir:k?"column":void 0,...y})})});Qt.displayName="ButtonGroup";function kw(e){const[t,n]=g.useState(!e);return{ref:g.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function pf(e){const{children:t,className:n,...r}=e,o=g.isValidElement(t)?g.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=Ae("chakra-button__icon",n);return l.jsx(re.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}pf.displayName="ButtonIcon";function tc(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=l.jsx(Xf,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:c,...u}=e,f=Ae("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",h=g.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[p]:t?r:0,fontSize:"1em",lineHeight:"normal",...c}),[c,t,p,r]);return l.jsx(re.div,{className:f,...u,__css:h,children:o})}tc.displayName="ButtonSpinner";var ti=fe((e,t)=>{const n=Sw(),r=go("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:c,children:u,leftIcon:f,rightIcon:p,loadingText:h,iconSpacing:y="0.5rem",type:x,spinner:S,spinnerPlacement:C="start",className:k,as:w,...j}=At(e),I=g.useMemo(()=>{const D={...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:D}}},[r,n]),{ref:P,type:M}=kw(w),T={rightIcon:p,leftIcon:f,iconSpacing:y,children:u};return l.jsxs(re.button,{ref:GC(t,P),as:w,type:x??M,"data-active":qe(c),"data-loading":qe(s),__css:I,className:Ae("chakra-button",k),...j,disabled:o||s,children:[s&&C==="start"&&l.jsx(tc,{className:"chakra-button__spinner--start",label:h,placement:"start",spacing:y,children:S}),s?h||l.jsx(re.span,{opacity:0,children:l.jsx(Qv,{...T})}):l.jsx(Qv,{...T}),s&&C==="end"&&l.jsx(tc,{className:"chakra-button__spinner--end",label:h,placement:"end",spacing:y,children:S})]})});ti.displayName="Button";function Qv(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return l.jsxs(l.Fragment,{children:[t&&l.jsx(pf,{marginEnd:o,children:t}),r,n&&l.jsx(pf,{marginStart:o,children:n})]})}var fo=fe((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...c}=e,u=n||r,f=g.isValidElement(u)?g.cloneElement(u,{"aria-hidden":!0,focusable:!1}):null;return l.jsx(ti,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...c,children:f})});fo.displayName="IconButton";var[nL,jw]=jt({name:"CheckboxGroupContext",strict:!1});function Ew(e){return l.jsx(re.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 Pw(e){return l.jsx(re.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 Iw(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?Pw:Ew;return n||t?l.jsx(re.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:l.jsx(o,{...r})}):null}var[Mw,x2]=jt({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Tw,ni]=jt({strict:!1,name:"FormControlContext"});function _w(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...c}=e,u=g.useId(),f=t||`field-${u}`,p=`${f}-label`,h=`${f}-feedback`,y=`${f}-helptext`,[x,S]=g.useState(!1),[C,k]=g.useState(!1),[w,j]=g.useState(!1),I=g.useCallback((_={},R=null)=>({id:y,..._,ref:ct(R,V=>{V&&k(!0)})}),[y]),P=g.useCallback((_={},R=null)=>{var V,F;return{..._,ref:R,"data-focus":qe(w),"data-disabled":qe(o),"data-invalid":qe(r),"data-readonly":qe(s),id:(V=_.id)!=null?V:p,htmlFor:(F=_.htmlFor)!=null?F:f}},[f,o,w,r,s,p]),M=g.useCallback((_={},R=null)=>({id:h,..._,ref:ct(R,V=>{V&&S(!0)}),"aria-live":"polite"}),[h]),T=g.useCallback((_={},R=null)=>({..._,...c,ref:R,role:"group"}),[c]),D=g.useCallback((_={},R=null)=>({..._,ref:R,role:"presentation","aria-hidden":!0,children:_.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!w,onFocus:()=>j(!0),onBlur:()=>j(!1),hasFeedbackText:x,setHasFeedbackText:S,hasHelpText:C,setHasHelpText:k,id:f,labelId:p,feedbackId:h,helpTextId:y,htmlProps:c,getHelpTextProps:I,getErrorMessageProps:M,getRootProps:T,getLabelProps:P,getRequiredIndicatorProps:D}}var rt=fe(function(t,n){const r=un("Form",t),o=At(t),{getRootProps:s,htmlProps:c,...u}=_w(o),f=Ae("chakra-form-control",t.className);return l.jsx(Tw,{value:u,children:l.jsx(Mw,{value:r,children:l.jsx(re.div,{...s({},n),className:f,__css:r.container})})})});rt.displayName="FormControl";var pn=fe(function(t,n){const r=ni(),o=x2(),s=Ae("chakra-form__helper-text",t.className);return l.jsx(re.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});pn.displayName="FormHelperText";var[Dw,Aw]=jt({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=ni();return o!=null&&o.isInvalid?l.jsx(Dw,{value:n,children:l.jsx(re.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 Ow=fe((e,t)=>{const n=Aw(),r=ni();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"})})});Ow.displayName="FormErrorIcon";var st=fe(function(t,n){var r;const o=go("FormLabel",t),s=At(t),{className:c,children:u,requiredIndicator:f=l.jsx(b2,{}),optionalIndicator:p=null,...h}=s,y=ni(),x=(r=y==null?void 0:y.getLabelProps(h,n))!=null?r:{ref:n,...h};return l.jsxs(re.label,{...x,className:Ae("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[u,y!=null&&y.isRequired?f:p]})});st.displayName="FormLabel";var b2=fe(function(t,n){const r=ni(),o=x2();if(!(r!=null&&r.isRequired))return null;const s=Ae("chakra-form__required-indicator",t.className);return l.jsx(re.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});b2.displayName="RequiredIndicator";function ah(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=sh(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":Rr(n),"aria-required":Rr(o),"aria-readonly":Rr(r)}}function sh(e){var t,n,r;const o=ni(),{id:s,disabled:c,readOnly:u,required:f,isRequired:p,isInvalid:h,isReadOnly:y,isDisabled:x,onFocus:S,onBlur:C,...k}=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),{...k,"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??y)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=f??p)!=null?r:o==null?void 0:o.isRequired,isInvalid:h??(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 lh={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},S2=re("span",{baseStyle:lh});S2.displayName="VisuallyHidden";var zw=re("input",{baseStyle:lh});zw.displayName="VisuallyHiddenInput";var Zv=!1,cs=null,Ko=!1,mf=!1,vf=new Set;function ch(e,t){vf.forEach(n=>n(e,t))}var Rw=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function Nw(e){return!(e.metaKey||!Rw&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Jv(e){Ko=!0,Nw(e)&&(cs="keyboard",ch("keyboard",e))}function wi(e){if(cs="pointer",e.type==="mousedown"||e.type==="pointerdown"){Ko=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;ch("pointer",e)}}function Fw(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function Lw(e){Fw(e)&&(Ko=!0,cs="virtual")}function Bw(e){e.target===window||e.target===document||(!Ko&&!mf&&(cs="virtual",ch("virtual",e)),Ko=!1,mf=!1)}function Hw(){Ko=!1,mf=!0}function eg(){return cs!=="pointer"}function Ww(){if(typeof window>"u"||Zv)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Ko=!0,e.apply(this,n)},document.addEventListener("keydown",Jv,!0),document.addEventListener("keyup",Jv,!0),document.addEventListener("click",Lw,!0),window.addEventListener("focus",Bw,!0),window.addEventListener("blur",Hw,!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 C2(e){Ww(),e(eg());const t=()=>e(eg());return vf.add(t),()=>{vf.delete(t)}}function Vw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function w2(e={}){const t=sh(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:c,onBlur:u,onFocus:f,"aria-describedby":p}=t,{defaultChecked:h,isChecked:y,isFocusable:x,onChange:S,isIndeterminate:C,name:k,value:w,tabIndex:j=void 0,"aria-label":I,"aria-labelledby":P,"aria-invalid":M,...T}=e,D=Vw(T,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),_=Wt(S),R=Wt(u),V=Wt(f),[F,L]=g.useState(!1),[Q,U]=g.useState(!1),[K,te]=g.useState(!1),[ne,$]=g.useState(!1);g.useEffect(()=>C2(L),[]);const Z=g.useRef(null),[oe,le]=g.useState(!0),[Re,Ne]=g.useState(!!h),Ie=y!==void 0,pe=Ie?y:Re,ce=g.useCallback(ye=>{if(r||n){ye.preventDefault();return}Ie||Ne(pe?ye.target.checked:C?!0:ye.target.checked),_==null||_(ye)},[r,n,pe,Ie,C,_]);Bi(()=>{Z.current&&(Z.current.indeterminate=Boolean(C))},[C]),ei(()=>{n&&U(!1)},[n,U]),Bi(()=>{const ye=Z.current;ye!=null&&ye.form&&(ye.form.onreset=()=>{Ne(!!h)})},[]);const Fe=n&&!x,Ve=g.useCallback(ye=>{ye.key===" "&&$(!0)},[$]),Ue=g.useCallback(ye=>{ye.key===" "&&$(!1)},[$]);Bi(()=>{if(!Z.current)return;Z.current.checked!==pe&&Ne(Z.current.checked)},[Z.current]);const $e=g.useCallback((ye={},Pe=null)=>{const et=Be=>{Q&&Be.preventDefault(),$(!0)};return{...ye,ref:Pe,"data-active":qe(ne),"data-hover":qe(K),"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))}},[ne,pe,n,Q,F,K,C,s,r]),Qe=g.useCallback((ye={},Pe=null)=>({...D,...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)}),[D,n,pe,s,oe]),ge=g.useCallback((ye={},Pe=null)=>({...ye,ref:ct(Z,Pe),type:"checkbox",name:k,value:w,id:c,tabIndex:j,onChange:Ee(ye.onChange,ce),onBlur:Ee(ye.onBlur,R,()=>U(!1)),onFocus:Ee(ye.onFocus,V,()=>U(!0)),onKeyDown:Ee(ye.onKeyDown,Ve),onKeyUp:Ee(ye.onKeyUp,Ue),required:o,checked:pe,disabled:Fe,readOnly:r,"aria-label":I,"aria-labelledby":P,"aria-invalid":M?Boolean(M):s,"aria-describedby":p,"aria-disabled":n,style:lh}),[k,w,c,ce,R,V,Ve,Ue,o,pe,Fe,r,I,P,M,s,p,n,j]),Te=g.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:ne,isHovered:K,isIndeterminate:C,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:Qe,getCheckboxProps:$e,getInputProps:ge,getLabelProps:Te,htmlProps:D}}function tg(e){e.preventDefault(),e.stopPropagation()}var Uw={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},$w={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},Gw=Jo({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),qw=Jo({from:{opacity:0},to:{opacity:1}}),Yw=Jo({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),k2=fe(function(t,n){const r=jw(),o={...r,...t},s=un("Checkbox",o),c=At(t),{spacing:u="0.5rem",className:f,children:p,iconColor:h,iconSize:y,icon:x=l.jsx(Iw,{}),isChecked:S,isDisabled:C=r==null?void 0:r.isDisabled,onChange:k,inputProps:w,...j}=c;let I=S;r!=null&&r.value&&c.value&&(I=r.value.includes(c.value));let P=k;r!=null&&r.onChange&&c.value&&(P=yc(r.onChange,k));const{state:M,getInputProps:T,getCheckboxProps:D,getLabelProps:_,getRootProps:R}=w2({...j,isDisabled:C,isChecked:I,onChange:P}),V=g.useMemo(()=>({animation:M.isIndeterminate?`${qw} 20ms linear, ${Yw} 200ms linear`:`${Gw} 200ms linear`,fontSize:y,color:h,...s.icon}),[h,y,,M.isIndeterminate,s.icon]),F=g.cloneElement(x,{__css:V,isIndeterminate:M.isIndeterminate,isChecked:M.isChecked});return l.jsxs(re.label,{__css:{...$w,...s.container},className:Ae("chakra-checkbox",f),...R(),children:[l.jsx("input",{className:"chakra-checkbox__input",...T(w,n)}),l.jsx(re.span,{__css:{...Uw,...s.control},className:"chakra-checkbox__control",...D(),children:F}),p&&l.jsx(re.span,{className:"chakra-checkbox__label",..._(),__css:{marginStart:u,...s.label},children:p})]})});k2.displayName="Checkbox";function Kw(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function uh(e,t){let n=Kw(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function gf(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 Xw(e,t,n){return(n-t)*e+t}function rg(e,t,n){const r=Math.round((e-t)/n)*n+t,o=gf(n);return uh(r,o)}function Hl(e,t,n){return e==null?e:(n{var F;return r==null?"":(F=md(r,s,n))!=null?F:""}),x=typeof o<"u",S=x?o:h,C=j2(oo(S),s),k=n??C,w=g.useCallback(F=>{F!==S&&(x||y(F.toString()),p==null||p(F.toString(),oo(F)))},[p,x,S]),j=g.useCallback(F=>{let L=F;return f&&(L=Hl(L,c,u)),uh(L,k)},[k,f,u,c]),I=g.useCallback((F=s)=>{let L;S===""?L=oo(F):L=oo(S)+F,L=j(L),w(L)},[j,s,w,S]),P=g.useCallback((F=s)=>{let L;S===""?L=oo(-F):L=oo(S)-F,L=j(L),w(L)},[j,s,w,S]),M=g.useCallback(()=>{var F;let L;r==null?L="":L=(F=md(r,s,n))!=null?F:c,w(L)},[r,n,s,w,c]),T=g.useCallback(F=>{var L;const Q=(L=md(F,s,k))!=null?L:c;w(Q)},[k,s,w,c]),D=oo(S);return{isOutOfRange:D>u||D{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 Zw(e){return"current"in e}var E2=()=>typeof window<"u";function Jw(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var e5=e=>E2()&&e.test(navigator.vendor),t5=e=>E2()&&e.test(Jw()),n5=()=>t5(/mac|iphone|ipad|ipod/i),r5=()=>n5()&&e5(/apple/i);function o5(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};$o(o,"pointerdown",s=>{if(!r5()||!r)return;const c=s.target,f=(n??[t]).some(p=>{const h=Zw(p)?p.current:p;return(h==null?void 0:h.contains(c))||h===c});o().activeElement!==c&&f&&(s.preventDefault(),c.focus())})}var lt={},i5={get exports(){return lt},set exports(e){lt=e}},a5="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",s5=a5,l5=s5;function P2(){}function I2(){}I2.resetWarningCache=P2;var c5=function(){function e(r,o,s,c,u,f){if(f!==l5){var p=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 p.name="Invariant Violation",p}}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:I2,resetWarningCache:P2};return n.PropTypes=n,n};i5.exports=c5();var yf="data-focus-lock",M2="data-focus-lock-disabled",u5="data-no-focus-lock",d5="data-autofocus-inside",f5="data-no-autofocus";function h5(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function p5(e,t){var n=g.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 T2(e,t){return p5(t||null,function(n){return e.forEach(function(r){return h5(r,n)})})}var vd={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},yr=function(){return yr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[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 xf(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(I5)},M5=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],ph=M5.join(","),T5="".concat(ph,", [data-focus-guard]"),Y2=function(e,t){return jr((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?T5:ph)?[r]:[],Y2(r))},[])},_5=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?wc([e.contentDocument.body],t):[e]},wc=function(e,t){return e.reduce(function(n,r){var o,s=Y2(r,t),c=(o=[]).concat.apply(o,s.map(function(u){return _5(u,t)}));return n.concat(c,r.parentNode?jr(r.parentNode.querySelectorAll(ph)).filter(function(u){return u===r}):[])},[])},D5=function(e){var t=e.querySelectorAll("[".concat(d5,"]"));return jr(t).map(function(n){return wc([n])}).reduce(function(n,r){return n.concat(r)},[])},mh=function(e,t){return jr(e).filter(function(n){return W2(t,n)}).filter(function(n){return j5(n)})},ig=function(e,t){return t===void 0&&(t=new Map),jr(e).filter(function(n){return V2(t,n)})},bf=function(e,t,n){return q2(mh(wc(e,n),t),!0,n)},ag=function(e,t){return q2(mh(wc(e),t),!1)},A5=function(e,t){return mh(D5(e),t)},Wi=function(e,t){return e.shadowRoot?Wi(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:jr(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?Wi(o,t):!1}return Wi(n,t)})},O5=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)})},K2=function(e){return e.parentNode?K2(e.parentNode):e},vh=function(e){var t=nc(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(yf);return n.push.apply(n,o?O5(jr(K2(r).querySelectorAll("[".concat(yf,'="').concat(o,'"]:not([').concat(M2,'="disabled"])')))):[r]),n},[])},z5=function(e){try{return e()}catch{return}},Ga=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Ga(t.shadowRoot):t instanceof HTMLIFrameElement&&z5(function(){return t.contentWindow.document})?Ga(t.contentWindow.document):t}},R5=function(e,t){return e===t},N5=function(e,t){return Boolean(jr(e.querySelectorAll("iframe")).some(function(n){return R5(n,t)}))},X2=function(e,t){return t===void 0&&(t=Ga(L2(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:vh(e).some(function(n){return Wi(n,t)||N5(n,t)})},F5=function(e){e===void 0&&(e=document);var t=Ga(e);return t?jr(e.querySelectorAll("[".concat(u5,"]"))).some(function(n){return Wi(n,t)}):!1},L5=function(e,t){return t.filter(G2).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},gh=function(e,t){return G2(e)&&e.name?L5(e,t):e},B5=function(e){var t=new Set;return e.forEach(function(n){return t.add(gh(n,e))}),e.filter(function(n){return t.has(n)})},sg=function(e){return e[0]&&e.length>1?gh(e[0],e):e[0]},lg=function(e,t){return e.length>1?e.indexOf(gh(e[t],e)):t},Q2="NEW_FOCUS",H5=function(e,t,n,r){var o=e.length,s=e[0],c=e[o-1],u=hh(n);if(!(n&&e.indexOf(n)>=0)){var f=n!==void 0?t.indexOf(n):-1,p=r?t.indexOf(r):f,h=r?e.indexOf(r):-1,y=f-p,x=t.indexOf(s),S=t.indexOf(c),C=B5(t),k=n!==void 0?C.indexOf(n):-1,w=k-(r?C.indexOf(r):f),j=lg(e,0),I=lg(e,o-1);if(f===-1||h===-1)return Q2;if(!y&&h>=0)return h;if(f<=x&&u&&Math.abs(y)>1)return I;if(f>=S&&u&&Math.abs(y)>1)return j;if(y&&Math.abs(w)>1)return h;if(f<=x)return I;if(f>S)return j;if(y)return Math.abs(y)>1?h:(o+h+y)%o}},W5=function(e){return function(t){var n,r=(n=U2(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},V5=function(e,t,n){var r=e.map(function(s){var c=s.node;return c}),o=ig(r.filter(W5(n)));return o&&o.length?sg(o):sg(ig(t))},Sf=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&Sf(e.parentNode.host||e.parentNode,t),t},gd=function(e,t){for(var n=Sf(e),r=Sf(t),o=0;o=0)return s}return!1},Z2=function(e,t,n){var r=nc(e),o=nc(t),s=r[0],c=!1;return o.filter(Boolean).forEach(function(u){c=gd(c||u,u)||c,n.filter(Boolean).forEach(function(f){var p=gd(s,f);p&&(!c||Wi(p,c)?c=p:c=gd(p,c))})}),c},U5=function(e,t){return e.reduce(function(n,r){return n.concat(A5(r,t))},[])},$5=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(P5)},G5=function(e,t){var n=Ga(nc(e).length>0?document:L2(e).ownerDocument),r=vh(e).filter(rc),o=Z2(n||e,e,r),s=new Map,c=ag(r,s),u=bf(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}),p=$5(f,u),h=p.map(function(S){var C=S.node;return C}),y=H5(h,f,n,t);if(y===Q2){var x=V5(c,h,U5(r,s));if(x)return{node:x};console.warn("focus-lock: cannot find any node to move focus into");return}return y===void 0?y:p[y]}},q5=function(e){var t=vh(e).filter(rc),n=Z2(e,e,t),r=new Map,o=bf([n],r,!0),s=bf(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:hh(u)}})},Y5=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},yd=0,xd=!1,J2=function(e,t,n){n===void 0&&(n={});var r=G5(e,t);if(!xd&&r){if(yd>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),xd=!0,setTimeout(function(){xd=!1},1);return}yd++,Y5(r.node,n.focusOptions),yd--}};function ey(e){var t=window,n=t.setImmediate;typeof n<"u"?n(e):setTimeout(e,1)}var K5=function(){return document&&document.activeElement===document.body},X5=function(){return K5()||F5()},Vi=null,Ri=null,Ui=null,qa=!1,Q5=function(){return!0},Z5=function(t){return(Vi.whiteList||Q5)(t)},J5=function(t,n){Ui={observerNode:t,portaledElement:n}},e6=function(t){return Ui&&Ui.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 t6=function(t){return t&&"current"in t?t.current:t},n6=function(t){return t?Boolean(qa):qa==="meanwhile"},r6=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},o6=function(t,n){return n.some(function(r){return r6(t,r,r)})},oc=function(){var t=!1;if(Vi){var n=Vi,r=n.observed,o=n.persistentFocus,s=n.autoFocus,c=n.shards,u=n.crossFrame,f=n.focusOptions,p=r||Ui&&Ui.portaledElement,h=document&&document.activeElement;if(p){var y=[p].concat(c.map(t6).filter(Boolean));if((!h||Z5(h))&&(o||n6(u)||!X5()||!Ri&&s)&&(p&&!(X2(y)||h&&o6(h,y)||e6(h))&&(document&&!Ri&&h&&!s?(h.blur&&h.blur(),document.body.focus()):(t=J2(y,Ri,{focusOptions:f}),Ui={})),qa=!1,Ri=document&&document.activeElement),document){var x=document&&document.activeElement,S=q5(y),C=S.map(function(k){var w=k.node;return w}).indexOf(x);C>-1&&(S.filter(function(k){var w=k.guard,j=k.node;return w&&j.dataset.focusAutoGuard}).forEach(function(k){var w=k.node;return w.removeAttribute("tabIndex")}),cg(C,S.length,1,S),cg(C,-1,-1,S))}}}return t},ty=function(t){oc()&&t&&(t.stopPropagation(),t.preventDefault())},yh=function(){return ey(oc)},i6=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||J5(r,n)},a6=function(){return null},ny=function(){qa="just",setTimeout(function(){qa="meanwhile"},0)},s6=function(){document.addEventListener("focusin",ty),document.addEventListener("focusout",yh),window.addEventListener("blur",ny)},l6=function(){document.removeEventListener("focusin",ty),document.removeEventListener("focusout",yh),window.removeEventListener("blur",ny)};function c6(e){return e.filter(function(t){var n=t.disabled;return!n})}function u6(e){var t=e.slice(-1)[0];t&&!Vi&&s6();var n=Vi,r=n&&t&&t.id===n.id;Vi=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(Ri=null,(!r||n.observed!==t.observed)&&t.onActivation(),oc(),ey(oc)):(l6(),Ri=null)}R2.assignSyncMedium(i6);N2.assignMedium(yh);v5.assignMedium(function(e){return e({moveFocusInside:J2,focusInside:X2})});const d6=b5(c6,u6)(a6);var ry=g.forwardRef(function(t,n){return g.createElement(F2,Yd({sideCar:d6,ref:n},t))}),oy=F2.propTypes||{};oy.sideCar;wC(oy,["sideCar"]);ry.propTypes={};const ug=ry;function iy(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function ay(e){var t;if(!iy(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function f6(e){var t,n;return(n=(t=sy(e))==null?void 0:t.defaultView)!=null?n:window}function sy(e){return iy(e)?e.ownerDocument:document}function h6(e){return sy(e).activeElement}var ly=e=>e.hasAttribute("tabindex"),p6=e=>ly(e)&&e.tabIndex===-1;function m6(e){return Boolean(e.getAttribute("disabled"))===!0||Boolean(e.getAttribute("aria-disabled"))===!0}function cy(e){return e.parentElement&&cy(e.parentElement)?!0:e.hidden}function v6(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function uy(e){if(!ay(e)||cy(e)||m6(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]():v6(e)?!0:ly(e)}function g6(e){return e?ay(e)&&uy(e)&&!p6(e):!1}var y6=["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]"],x6=y6.join(),b6=e=>e.offsetWidth>0&&e.offsetHeight>0;function dy(e){const t=Array.from(e.querySelectorAll(x6));return t.unshift(e),t.filter(n=>uy(n)&&b6(n))}var dg,S6=(dg=ug.default)!=null?dg:ug,fy=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:c,autoFocus:u,persistentFocus:f,lockFocusAcrossFrames:p}=e,h=g.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&dy(r.current).length===0&&requestAnimationFrame(()=>{var C;(C=r.current)==null||C.focus()})},[t,r]),y=g.useCallback(()=>{var S;(S=n==null?void 0:n.current)==null||S.focus()},[n]),x=o&&!n;return l.jsx(S6,{crossFrame:p,persistentFocus:f,autoFocus:u,disabled:c,onActivation:h,onDeactivation:y,returnFocus:x,children:s})};fy.displayName="FocusLock";var C6=AC?g.useLayoutEffect:g.useEffect;function ic(e,t=[]){const n=g.useRef(e);return C6(()=>{n.current=e}),g.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function w6(e,t,n,r){const o=ic(t);return g.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 k6(e){const{ref:t,handler:n,enabled:r=!0}=e,o=ic(n),c=g.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;g.useEffect(()=>{if(!r)return;const u=y=>{bd(y,t)&&(c.isPointerDown=!0)},f=y=>{if(c.ignoreEmulatedMouseEvents){c.ignoreEmulatedMouseEvents=!1;return}c.isPointerDown&&n&&bd(y,t)&&(c.isPointerDown=!1,o(y))},p=y=>{c.ignoreEmulatedMouseEvents=!0,n&&c.isPointerDown&&bd(y,t)&&(c.isPointerDown=!1,o(y))},h=u2(t.current);return h.addEventListener("mousedown",u,!0),h.addEventListener("mouseup",f,!0),h.addEventListener("touchstart",u,!0),h.addEventListener("touchend",p,!0),()=>{h.removeEventListener("mousedown",u,!0),h.removeEventListener("mouseup",f,!0),h.removeEventListener("touchstart",u,!0),h.removeEventListener("touchend",p,!0)}},[n,t,o,c,r])}function bd(e,t){var n;const r=e.target;return e.button>0||r&&!u2(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function j6(e,t){const n=g.useId();return g.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function E6(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function ho(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=ic(n),c=ic(t),[u,f]=g.useState(e.defaultIsOpen||!1),[p,h]=E6(r,u),y=j6(o,"disclosure"),x=g.useCallback(()=>{p||f(!1),c==null||c()},[p,c]),S=g.useCallback(()=>{p||f(!0),s==null||s()},[p,s]),C=g.useCallback(()=>{(h?x:S)()},[h,S,x]);return{isOpen:!!h,onOpen:S,onClose:x,onToggle:C,isControlled:p,getButtonProps:(k={})=>({...k,"aria-expanded":h,"aria-controls":y,onClick:FS(k.onClick,C)}),getDisclosureProps:(k={})=>({...k,hidden:!h,id:y})}}var xh=fe(function(t,n){const{htmlSize:r,...o}=t,s=un("Input",o),c=At(o),u=ah(c),f=Ae("chakra-input",t.className);return l.jsx(re.input,{size:r,...u,__css:s.field,ref:n,className:f})});xh.displayName="Input";xh.id="Input";var[P6,hy]=jt({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),bh=fe(function(t,n){const r=un("List",t),{children:o,styleType:s="none",stylePosition:c,spacing:u,...f}=At(t),p=ih(o),y=u?{["& > *:not(style) ~ *:not(style)"]:{mt:u}}:{};return l.jsx(P6,{value:r,children:l.jsx(re.ul,{ref:n,listStyleType:s,listStylePosition:c,role:"list",__css:{...r.container,...y},...f,children:p})})});bh.displayName="List";var I6=fe((e,t)=>{const{as:n,...r}=e;return l.jsx(bh,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});I6.displayName="OrderedList";var py=fe(function(t,n){const{as:r,...o}=t;return l.jsx(bh,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});py.displayName="UnorderedList";var za=fe(function(t,n){const r=hy();return l.jsx(re.li,{ref:n,...t,__css:r.item})});za.displayName="ListItem";var M6=fe(function(t,n){const r=hy();return l.jsx(tn,{ref:n,role:"presentation",...t,__css:r.icon})});M6.displayName="ListIcon";var or=fe(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:c,column:u,row:f,autoFlow:p,autoRows:h,templateRows:y,autoColumns:x,templateColumns:S,...C}=t,k={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:c,gridAutoColumns:x,gridColumn:u,gridRow:f,gridAutoFlow:p,gridAutoRows:h,gridTemplateRows:y,gridTemplateColumns:S};return l.jsx(re.div,{ref:n,__css:k,...C})});or.displayName="Grid";function my(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):Kd(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var kc=re("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});kc.displayName="Spacer";var vy=e=>l.jsx(re.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});vy.displayName="StackItem";var Cf="& > *:not(style) ~ *:not(style)";function T6(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,[Cf]:my(n,o=>r[o])}}function _6(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{"&":my(n,o=>r[o])}}var Sh=fe((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:c="0.5rem",wrap:u,children:f,divider:p,className:h,shouldWrapChildren:y,...x}=e,S=n?"row":r??"column",C=g.useMemo(()=>T6({direction:S,spacing:c}),[S,c]),k=g.useMemo(()=>_6({spacing:c,direction:S}),[c,S]),w=!!p,j=!y&&!w,I=g.useMemo(()=>{const M=ih(f);return j?M:M.map((T,D)=>{const _=typeof T.key<"u"?T.key:D,R=D+1===M.length,F=y?l.jsx(vy,{children:T},_):T;if(!w)return F;const L=g.cloneElement(p,{__css:k}),Q=R?null:L;return l.jsxs(g.Fragment,{children:[F,Q]},_)})},[p,k,w,j,y,f]),P=Ae("chakra-stack",h);return l.jsx(re.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:C.flexDirection,flexWrap:u,className:P,__css:w?{}:{[Cf]:C[Cf]},...x,children:I})});Sh.displayName="Stack";var ze=fe((e,t)=>l.jsx(Sh,{align:"center",...e,direction:"column",ref:t}));ze.displayName="VStack";var ra=fe((e,t)=>l.jsx(Sh,{align:"center",...e,direction:"row",ref:t}));ra.displayName="HStack";var Wn=fe(function(t,n){const r=go("Heading",t),{className:o,...s}=At(t);return l.jsx(re.h2,{ref:n,className:Ae("chakra-heading",t.className),...s,__css:r})});Wn.displayName="Heading";var Ye=re("div");Ye.displayName="Box";var gy=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})});gy.displayName="Square";var D6=fe(function(t,n){const{size:r,...o}=t;return l.jsx(gy,{size:r,ref:n,borderRadius:"9999px",...o})});D6.displayName="Circle";var Go=fe(function(t,n){const r=go("Link",t),{className:o,isExternal:s,...c}=At(t);return l.jsx(re.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:Ae("chakra-link",o),...c,__css:r})});Go.displayName="Link";var yy=fe(function(t,n){const r=go("Badge",t),{className:o,...s}=At(t);return l.jsx(re.span,{ref:n,className:Ae("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});yy.displayName="Badge";var xy=re("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center"}});xy.displayName="Center";var A6={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(re.div,{ref:n,__css:A6[r],...o,position:"absolute"})});var by=fe(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:c,borderWidth:u,borderStyle:f,borderColor:p,...h}=go("Divider",t),{className:y,orientation:x="horizontal",__css:S,...C}=At(t),k={vertical:{borderLeftWidth:r||c||u||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||u||"1px",width:"100%"}};return l.jsx(re.hr,{ref:n,"aria-orientation":x,...C,__css:{...h,border:"0",borderColor:p,borderStyle:f,...k[x],...S},className:Ae("chakra-divider",y)})});by.displayName="Divider";function O6(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function z6(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=g.useState([]),s=g.useRef(),c=()=>{s.current&&(clearTimeout(s.current),s.current=null)},u=()=>{c(),s.current=setTimeout(()=>{o([]),s.current=null},t)};g.useEffect(()=>c,[]);function f(p){return h=>{if(h.key==="Backspace"){const y=[...r];y.pop(),o(y);return}if(O6(h)){const y=r.concat(h.key);n(h)&&(h.preventDefault(),h.stopPropagation()),o(y),p(y.join("")),u()}}}return f}function R6(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 N6(){const e=g.useRef(new Map),t=e.current,n=g.useCallback((o,s,c,u)=>{e.current.set(c,{type:s,el:o,options:u}),o.addEventListener(s,c,u)},[]),r=g.useCallback((o,s,c,u)=>{o.removeEventListener(s,c,u),e.current.delete(c)},[]);return g.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function Sd(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function Sy(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:c,onMouseUp:u,onClick:f,onKeyDown:p,onKeyUp:h,tabIndex:y,onMouseOver:x,onMouseLeave:S,...C}=e,[k,w]=g.useState(!0),[j,I]=g.useState(!1),P=N6(),M=$=>{$&&$.tagName!=="BUTTON"&&w(!1)},T=k?y:y||0,D=n&&!r,_=g.useCallback($=>{if(n){$.stopPropagation(),$.preventDefault();return}$.currentTarget.focus(),f==null||f($)},[n,f]),R=g.useCallback($=>{j&&Sd($)&&($.preventDefault(),$.stopPropagation(),I(!1),P.remove(document,"keyup",R,!1))},[j,P]),V=g.useCallback($=>{if(p==null||p($),n||$.defaultPrevented||$.metaKey||!Sd($.nativeEvent)||k)return;const Z=o&&$.key==="Enter";s&&$.key===" "&&($.preventDefault(),I(!0)),Z&&($.preventDefault(),$.currentTarget.click()),P.add(document,"keyup",R,!1)},[n,k,p,o,s,P,R]),F=g.useCallback($=>{if(h==null||h($),n||$.defaultPrevented||$.metaKey||!Sd($.nativeEvent)||k)return;s&&$.key===" "&&($.preventDefault(),I(!1),$.currentTarget.click())},[s,k,n,h]),L=g.useCallback($=>{$.button===0&&(I(!1),P.remove(document,"mouseup",L,!1))},[P]),Q=g.useCallback($=>{if($.button!==0)return;if(n){$.stopPropagation(),$.preventDefault();return}k||I(!0),$.currentTarget.focus({preventScroll:!0}),P.add(document,"mouseup",L,!1),c==null||c($)},[n,k,c,P,L]),U=g.useCallback($=>{$.button===0&&(k||I(!1),u==null||u($))},[u,k]),K=g.useCallback($=>{if(n){$.preventDefault();return}x==null||x($)},[n,x]),te=g.useCallback($=>{j&&($.preventDefault(),I(!1)),S==null||S($)},[j,S]),ne=ct(t,M);return k?{...C,ref:ne,type:"button","aria-disabled":D?void 0:n,disabled:D,onClick:_,onMouseDown:c,onMouseUp:u,onKeyUp:h,onKeyDown:p,onMouseOver:x,onMouseLeave:S}:{...C,ref:ne,role:"button","data-active":qe(j),"aria-disabled":n?"true":void 0,tabIndex:D?void 0:T,onClick:_,onMouseDown:Q,onMouseUp:U,onKeyUp:F,onKeyDown:V,onMouseOver:K,onMouseLeave:te}}function F6(e){const t=e.current;if(!t)return!1;const n=h6(t);return!n||t.contains(n)?!1:!!g6(n)}function Cy(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;ei(()=>{if(!s||F6(e))return;const c=(o==null?void 0:o.current)||e.current;c&&requestAnimationFrame(()=>{c.focus()})},[s,e,o])}var L6={preventScroll:!0,shouldFocus:!1};function B6(e,t=L6){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,c=H6(e)?e.current:e,u=o&&s,f=g.useRef(u),p=g.useRef(s);Bi(()=>{!p.current&&s&&(f.current=u),p.current=s},[s,u]);const h=g.useCallback(()=>{if(!(!s||!c||!f.current)&&(f.current=!1,!c.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var y;(y=n.current)==null||y.focus({preventScroll:r})});else{const y=dy(c);y.length>0&&requestAnimationFrame(()=>{y[0].focus({preventScroll:r})})}},[s,r,c,n]);ei(()=>{h()},[h]),$o(c,"transitionend",h)}function H6(e){return"current"in e}var ki=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),Ht={arrowShadowColor:ki("--popper-arrow-shadow-color"),arrowSize:ki("--popper-arrow-size","8px"),arrowSizeHalf:ki("--popper-arrow-size-half"),arrowBg:ki("--popper-arrow-bg"),transformOrigin:ki("--popper-transform-origin"),arrowOffset:ki("--popper-arrow-offset")};function W6(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 V6={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"},U6=e=>V6[e],fg={scroll:!0,resize:!0};function $6(e){let t;return typeof e=="object"?t={enabled:!0,options:{...fg,...e}}:t={enabled:e,options:fg},t}var G6={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`}},q6={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,U6(e.placement))},Y6={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{K6(e)}},K6=e=>{var t;if(!e.placement)return;const n=X6(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])}},X6=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}},Q6={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=W6(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))"})},Z6={"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"}},J6={"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 ek(e,t="ltr"){var n,r;const o=((n=Z6[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=J6[e])!=null?r:o}var Pn="top",Un="bottom",$n="right",In="left",Ch="auto",us=[Pn,Un,$n,In],$i="start",Ya="end",tk="clippingParents",wy="viewport",Ta="popper",nk="reference",mg=us.reduce(function(e,t){return e.concat([t+"-"+$i,t+"-"+Ya])},[]),ky=[].concat(us,[Ch]).reduce(function(e,t){return e.concat([t,t+"-"+$i,t+"-"+Ya])},[]),rk="beforeRead",ok="read",ik="afterRead",ak="beforeMain",sk="main",lk="afterMain",ck="beforeWrite",uk="write",dk="afterWrite",fk=[rk,ok,ik,ak,sk,lk,ck,uk,dk];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 Xo(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 wh(e){if(typeof ShadowRoot>"u")return!1;var t=Gn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function hk(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 pk(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,p){return f[p]="",f},{});!Vn(o)||!kr(o)||(Object.assign(o.style,u),Object.keys(s).forEach(function(f){o.removeAttribute(f)}))})}}const mk={name:"applyStyles",enabled:!0,phase:"write",fn:hk,effect:pk,requires:["computeStyles"]};function Sr(e){return e.split("-")[0]}var qo=Math.max,ac=Math.min,Gi=Math.round;function wf(){var e=navigator.userAgentData;return e!=null&&e.brands?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function jy(){return!/^((?!chrome|android).)*safari/i.test(wf())}function qi(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&&Gi(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&Gi(r.height)/e.offsetHeight||1);var c=Xo(e)?Gn(e):window,u=c.visualViewport,f=!jy()&&n,p=(r.left+(f&&u?u.offsetLeft:0))/o,h=(r.top+(f&&u?u.offsetTop:0))/s,y=r.width/o,x=r.height/s;return{width:y,height:x,top:h,right:p+y,bottom:h+x,left:p,x:p,y:h}}function kh(e){var t=qi(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 Ey(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&wh(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Nr(e){return Gn(e).getComputedStyle(e)}function vk(e){return["table","td","th"].indexOf(kr(e))>=0}function xo(e){return((Xo(e)?e.ownerDocument:e.document)||window.document).documentElement}function jc(e){return kr(e)==="html"?e:e.assignedSlot||e.parentNode||(wh(e)?e.host:null)||xo(e)}function vg(e){return!Vn(e)||Nr(e).position==="fixed"?null:e.offsetParent}function gk(e){var t=/firefox/i.test(wf()),n=/Trident/i.test(wf());if(n&&Vn(e)){var r=Nr(e);if(r.position==="fixed")return null}var o=jc(e);for(wh(o)&&(o=o.host);Vn(o)&&["html","body"].indexOf(kr(o))<0;){var s=Nr(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 ds(e){for(var t=Gn(e),n=vg(e);n&&vk(n)&&Nr(n).position==="static";)n=vg(n);return n&&(kr(n)==="html"||kr(n)==="body"&&Nr(n).position==="static")?t:n||gk(e)||t}function jh(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Na(e,t,n){return qo(e,ac(t,n))}function yk(e,t,n){var r=Na(e,t,n);return r>n?n:r}function Py(){return{top:0,right:0,bottom:0,left:0}}function Iy(e){return Object.assign({},Py(),e)}function My(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var xk=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Iy(typeof t!="number"?t:My(t,us))};function bk(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,c=n.modifiersData.popperOffsets,u=Sr(n.placement),f=jh(u),p=[In,$n].indexOf(u)>=0,h=p?"height":"width";if(!(!s||!c)){var y=xk(o.padding,n),x=kh(s),S=f==="y"?Pn:In,C=f==="y"?Un:$n,k=n.rects.reference[h]+n.rects.reference[f]-c[f]-n.rects.popper[h],w=c[f]-n.rects.reference[f],j=ds(s),I=j?f==="y"?j.clientHeight||0:j.clientWidth||0:0,P=k/2-w/2,M=y[S],T=I-x[h]-y[C],D=I/2-x[h]/2+P,_=Na(M,D,T),R=f;n.modifiersData[r]=(t={},t[R]=_,t.centerOffset=_-D,t)}}function Sk(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)||Ey(t.elements.popper,o)&&(t.elements.arrow=o))}const Ck={name:"arrow",enabled:!0,phase:"main",fn:bk,effect:Sk,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Yi(e){return e.split("-")[1]}var wk={top:"auto",right:"auto",bottom:"auto",left:"auto"};function kk(e){var t=e.x,n=e.y,r=window,o=r.devicePixelRatio||1;return{x:Gi(t*o)/o||0,y:Gi(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,p=e.adaptive,h=e.roundOffsets,y=e.isFixed,x=c.x,S=x===void 0?0:x,C=c.y,k=C===void 0?0:C,w=typeof h=="function"?h({x:S,y:k}):{x:S,y:k};S=w.x,k=w.y;var j=c.hasOwnProperty("x"),I=c.hasOwnProperty("y"),P=In,M=Pn,T=window;if(p){var D=ds(n),_="clientHeight",R="clientWidth";if(D===Gn(n)&&(D=xo(n),Nr(D).position!=="static"&&u==="absolute"&&(_="scrollHeight",R="scrollWidth")),D=D,o===Pn||(o===In||o===$n)&&s===Ya){M=Un;var V=y&&D===T&&T.visualViewport?T.visualViewport.height:D[_];k-=V-r.height,k*=f?1:-1}if(o===In||(o===Pn||o===Un)&&s===Ya){P=$n;var F=y&&D===T&&T.visualViewport?T.visualViewport.width:D[R];S-=F-r.width,S*=f?1:-1}}var L=Object.assign({position:u},p&&wk),Q=h===!0?kk({x:S,y:k}):{x:S,y:k};if(S=Q.x,k=Q.y,f){var U;return Object.assign({},L,(U={},U[M]=I?"0":"",U[P]=j?"0":"",U.transform=(T.devicePixelRatio||1)<=1?"translate("+S+"px, "+k+"px)":"translate3d("+S+"px, "+k+"px, 0)",U))}return Object.assign({},L,(t={},t[M]=I?k+"px":"",t[P]=j?S+"px":"",t.transform="",t))}function jk(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,p={placement:Sr(t.placement),variation:Yi(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({},p,{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({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const Ek={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:jk,data:{}};var bl={passive:!0};function Pk(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),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(h){h.addEventListener("scroll",n.update,bl)}),u&&f.addEventListener("resize",n.update,bl),function(){s&&p.forEach(function(h){h.removeEventListener("scroll",n.update,bl)}),u&&f.removeEventListener("resize",n.update,bl)}}const Ik={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Pk,data:{}};var Mk={left:"right",right:"left",bottom:"top",top:"bottom"};function Wl(e){return e.replace(/left|right|bottom|top/g,function(t){return Mk[t]})}var Tk={start:"end",end:"start"};function yg(e){return e.replace(/start|end/g,function(t){return Tk[t]})}function Eh(e){var t=Gn(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Ph(e){return qi(xo(e)).left+Eh(e).scrollLeft}function _k(e,t){var n=Gn(e),r=xo(e),o=n.visualViewport,s=r.clientWidth,c=r.clientHeight,u=0,f=0;if(o){s=o.width,c=o.height;var p=jy();(p||!p&&t==="fixed")&&(u=o.offsetLeft,f=o.offsetTop)}return{width:s,height:c,x:u+Ph(e),y:f}}function Dk(e){var t,n=xo(e),r=Eh(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=qo(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),c=qo(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),u=-r.scrollLeft+Ph(e),f=-r.scrollTop;return Nr(o||n).direction==="rtl"&&(u+=qo(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:c,x:u,y:f}}function Ih(e){var t=Nr(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function Ty(e){return["html","body","#document"].indexOf(kr(e))>=0?e.ownerDocument.body:Vn(e)&&Ih(e)?e:Ty(jc(e))}function Fa(e,t){var n;t===void 0&&(t=[]);var r=Ty(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Gn(r),c=o?[s].concat(s.visualViewport||[],Ih(r)?r:[]):r,u=t.concat(c);return o?u:u.concat(Fa(jc(c)))}function kf(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Ak(e,t){var n=qi(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===wy?kf(_k(e,n)):Xo(t)?Ak(t,n):kf(Dk(xo(e)))}function Ok(e){var t=Fa(jc(e)),n=["absolute","fixed"].indexOf(Nr(e).position)>=0,r=n&&Vn(e)?ds(e):e;return Xo(r)?t.filter(function(o){return Xo(o)&&Ey(o,r)&&kr(o)!=="body"}):[]}function zk(e,t,n,r){var o=t==="clippingParents"?Ok(e):[].concat(t),s=[].concat(o,[n]),c=s[0],u=s.reduce(function(f,p){var h=xg(e,p,r);return f.top=qo(h.top,f.top),f.right=ac(h.right,f.right),f.bottom=ac(h.bottom,f.bottom),f.left=qo(h.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 _y(e){var t=e.reference,n=e.element,r=e.placement,o=r?Sr(r):null,s=r?Yi(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 p=o?jh(o):null;if(p!=null){var h=p==="y"?"height":"width";switch(s){case $i:f[p]=f[p]-(t[h]/2-n[h]/2);break;case Ya:f[p]=f[p]+(t[h]/2-n[h]/2);break}}return f}function Ka(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?tk:u,p=n.rootBoundary,h=p===void 0?wy:p,y=n.elementContext,x=y===void 0?Ta:y,S=n.altBoundary,C=S===void 0?!1:S,k=n.padding,w=k===void 0?0:k,j=Iy(typeof w!="number"?w:My(w,us)),I=x===Ta?nk:Ta,P=e.rects.popper,M=e.elements[C?I:x],T=zk(Xo(M)?M:M.contextElement||xo(e.elements.popper),f,h,c),D=qi(e.elements.reference),_=_y({reference:D,element:P,strategy:"absolute",placement:o}),R=kf(Object.assign({},P,_)),V=x===Ta?R:D,F={top:T.top-V.top+j.top,bottom:V.bottom-T.bottom+j.bottom,left:T.left-V.left+j.left,right:V.right-T.right+j.right},L=e.modifiersData.offset;if(x===Ta&&L){var Q=L[o];Object.keys(F).forEach(function(U){var K=[$n,Un].indexOf(U)>=0?1:-1,te=[Pn,Un].indexOf(U)>=0?"y":"x";F[U]+=Q[te]*K})}return F}function Rk(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,p=f===void 0?ky:f,h=Yi(r),y=h?u?mg:mg.filter(function(C){return Yi(C)===h}):us,x=y.filter(function(C){return p.indexOf(C)>=0});x.length===0&&(x=y);var S=x.reduce(function(C,k){return C[k]=Ka(e,{placement:k,boundary:o,rootBoundary:s,padding:c})[Sr(k)],C},{});return Object.keys(S).sort(function(C,k){return S[C]-S[k]})}function Nk(e){if(Sr(e)===Ch)return[];var t=Wl(e);return[yg(e),t,yg(t)]}function Fk(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,p=n.padding,h=n.boundary,y=n.rootBoundary,x=n.altBoundary,S=n.flipVariations,C=S===void 0?!0:S,k=n.allowedAutoPlacements,w=t.options.placement,j=Sr(w),I=j===w,P=f||(I||!C?[Wl(w)]:Nk(w)),M=[w].concat(P).reduce(function(pe,ce){return pe.concat(Sr(ce)===Ch?Rk(t,{placement:ce,boundary:h,rootBoundary:y,padding:p,flipVariations:C,allowedAutoPlacements:k}):ce)},[]),T=t.rects.reference,D=t.rects.popper,_=new Map,R=!0,V=M[0],F=0;F=0,te=K?"width":"height",ne=Ka(t,{placement:L,boundary:h,rootBoundary:y,altBoundary:x,padding:p}),$=K?U?$n:In:U?Un:Pn;T[te]>D[te]&&($=Wl($));var Z=Wl($),oe=[];if(s&&oe.push(ne[Q]<=0),u&&oe.push(ne[$]<=0,ne[Z]<=0),oe.every(function(pe){return pe})){V=L,R=!1;break}_.set(L,oe)}if(R)for(var le=C?3:1,Re=function(ce){var Fe=M.find(function(Ve){var Ue=_.get(Ve);if(Ue)return Ue.slice(0,ce).every(function($e){return $e})});if(Fe)return V=Fe,"break"},Ne=le;Ne>0;Ne--){var Ie=Re(Ne);if(Ie==="break")break}t.placement!==V&&(t.modifiersData[r]._skip=!0,t.placement=V,t.reset=!0)}}const Lk={name:"flip",enabled:!0,phase:"main",fn:Fk,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 Bk(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,c=Ka(t,{elementContext:"reference"}),u=Ka(t,{altBoundary:!0}),f=bg(c,r),p=bg(u,o,s),h=Sg(f),y=Sg(p);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:p,isReferenceHidden:h,hasPopperEscaped:y},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":y})}const Hk={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Bk};function Wk(e,t,n){var r=Sr(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 Vk(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(h,y){return h[y]=Wk(y,t.rects,s),h},{}),u=c[t.placement],f=u.x,p=u.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=c}const Uk={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Vk};function $k(e){var t=e.state,n=e.name;t.modifiersData[n]=_y({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Gk={name:"popperOffsets",enabled:!0,phase:"read",fn:$k,data:{}};function qk(e){return e==="x"?"y":"x"}function Yk(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,p=n.rootBoundary,h=n.altBoundary,y=n.padding,x=n.tether,S=x===void 0?!0:x,C=n.tetherOffset,k=C===void 0?0:C,w=Ka(t,{boundary:f,rootBoundary:p,padding:y,altBoundary:h}),j=Sr(t.placement),I=Yi(t.placement),P=!I,M=jh(j),T=qk(M),D=t.modifiersData.popperOffsets,_=t.rects.reference,R=t.rects.popper,V=typeof k=="function"?k(Object.assign({},t.rects,{placement:t.placement})):k,F=typeof V=="number"?{mainAxis:V,altAxis:V}:Object.assign({mainAxis:0,altAxis:0},V),L=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,Q={x:0,y:0};if(D){if(s){var U,K=M==="y"?Pn:In,te=M==="y"?Un:$n,ne=M==="y"?"height":"width",$=D[M],Z=$+w[K],oe=$-w[te],le=S?-R[ne]/2:0,Re=I===$i?_[ne]:R[ne],Ne=I===$i?-R[ne]:-_[ne],Ie=t.elements.arrow,pe=S&&Ie?kh(Ie):{width:0,height:0},ce=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Py(),Fe=ce[K],Ve=ce[te],Ue=Na(0,_[ne],pe[ne]),$e=P?_[ne]/2-le-Ue-Fe-F.mainAxis:Re-Ue-Fe-F.mainAxis,Qe=P?-_[ne]/2+le+Ue+Ve+F.mainAxis:Ne+Ue+Ve+F.mainAxis,ge=t.elements.arrow&&ds(t.elements.arrow),Te=ge?M==="y"?ge.clientTop||0:ge.clientLeft||0:0,Ge=(U=L==null?void 0:L[M])!=null?U:0,ye=$+$e-Ge-Te,Pe=$+Qe-Ge,et=Na(S?ac(Z,ye):Z,$,S?qo(oe,Pe):oe);D[M]=et,Q[M]=et-$}if(u){var Be,vt=M==="x"?Pn:In,Rt=M==="x"?Un:$n,N=D[T],ue=T==="y"?"height":"width",xe=N+w[vt],ke=N-w[Rt],q=[Pn,In].indexOf(j)!==-1,ae=(Be=L==null?void 0:L[T])!=null?Be:0,Oe=q?xe:N-_[ue]-R[ue]-ae+F.altAxis,Ze=q?N+_[ue]+R[ue]-ae-F.altAxis:ke,J=S&&q?yk(Oe,N,Ze):Na(S?Oe:xe,N,S?Ze:ke);D[T]=J,Q[T]=J-N}t.modifiersData[r]=Q}}const Kk={name:"preventOverflow",enabled:!0,phase:"main",fn:Yk,requiresIfExists:["offset"]};function Xk(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Qk(e){return e===Gn(e)||!Vn(e)?Eh(e):Xk(e)}function Zk(e){var t=e.getBoundingClientRect(),n=Gi(t.width)/e.offsetWidth||1,r=Gi(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Jk(e,t,n){n===void 0&&(n=!1);var r=Vn(t),o=Vn(t)&&Zk(t),s=xo(t),c=qi(e,o,n),u={scrollLeft:0,scrollTop:0},f={x:0,y:0};return(r||!r&&!n)&&((kr(t)!=="body"||Ih(s))&&(u=Qk(t)),Vn(t)?(f=qi(t,!0),f.x+=t.clientLeft,f.y+=t.clientTop):s&&(f.x=Ph(s))),{x:c.left+u.scrollLeft-f.x,y:c.top+u.scrollTop-f.y,width:c.width,height:c.height}}function ej(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 tj(e){var t=ej(e);return fk.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function nj(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function rj(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=g.useCallback(()=>{var F;!t||!C.current||!k.current||((F=I.current)==null||F.call(I),w.current=aj(C.current,k.current,{placement:j,modifiers:[Q6,Y6,q6,{...G6,enabled:!!x},{name:"eventListeners",...$6(c)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:u??[0,f]}},{name:"flip",enabled:!!p,options:{padding:8}},{name:"preventOverflow",enabled:!!y,options:{boundary:h}},...n??[]],strategy:o}),w.current.forceUpdate(),I.current=w.current.destroy)},[j,t,n,x,c,s,u,f,p,y,h,o]);g.useEffect(()=>()=>{var F;!C.current&&!k.current&&((F=w.current)==null||F.destroy(),w.current=null)},[]);const M=g.useCallback(F=>{C.current=F,P()},[P]),T=g.useCallback((F={},L=null)=>({...F,ref:ct(M,L)}),[M]),D=g.useCallback(F=>{k.current=F,P()},[P]),_=g.useCallback((F={},L=null)=>({...F,ref:ct(D,L),style:{...F.style,position:o,minWidth:x?void 0:"max-content",inset:"0 auto auto 0"}}),[o,D,x]),R=g.useCallback((F={},L=null)=>{const{size:Q,shadowColor:U,bg:K,style:te,...ne}=F;return{...ne,ref:L,"data-popper-arrow":"",style:sj(F)}},[]),V=g.useCallback((F={},L=null)=>({...F,ref:L,"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:M,popperRef:D,getPopperProps:_,getArrowProps:R,getArrowInnerProps:V,getReferenceProps:T}}function sj(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 Th(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=Wt(n),c=Wt(t),[u,f]=g.useState(e.defaultIsOpen||!1),p=r!==void 0?r:u,h=r!==void 0,y=g.useId(),x=o??`disclosure-${y}`,S=g.useCallback(()=>{h||f(!1),c==null||c()},[h,c]),C=g.useCallback(()=>{h||f(!0),s==null||s()},[h,s]),k=g.useCallback(()=>{p?S():C()},[p,C,S]);function w(I={}){return{...I,"aria-expanded":p,"aria-controls":x,onClick(P){var M;(M=I.onClick)==null||M.call(I,P),k()}}}function j(I={}){return{...I,hidden:!p,id:x}}return{isOpen:p,onOpen:C,onClose:S,onToggle:k,isControlled:h,getButtonProps:w,getDisclosureProps:j}}function lj(e){const{ref:t,handler:n,enabled:r=!0}=e,o=Wt(n),c=g.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;g.useEffect(()=>{if(!r)return;const u=y=>{Cd(y,t)&&(c.isPointerDown=!0)},f=y=>{if(c.ignoreEmulatedMouseEvents){c.ignoreEmulatedMouseEvents=!1;return}c.isPointerDown&&n&&Cd(y,t)&&(c.isPointerDown=!1,o(y))},p=y=>{c.ignoreEmulatedMouseEvents=!0,n&&c.isPointerDown&&Cd(y,t)&&(c.isPointerDown=!1,o(y))},h=Dy(t.current);return h.addEventListener("mousedown",u,!0),h.addEventListener("mouseup",f,!0),h.addEventListener("touchstart",u,!0),h.addEventListener("touchend",p,!0),()=>{h.removeEventListener("mousedown",u,!0),h.removeEventListener("mouseup",f,!0),h.removeEventListener("touchstart",u,!0),h.removeEventListener("touchend",p,!0)}},[n,t,o,c,r])}function Cd(e,t){var n;const r=e.target;return e.button>0||r&&!Dy(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function Dy(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Ay(e){const{isOpen:t,ref:n}=e,[r,o]=g.useState(t),[s,c]=g.useState(!1);return g.useEffect(()=>{s||(o(t),c(!0))},[t,s,r]),$o(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var f;const p=f6(n.current),h=new p.CustomEvent("animationend",{bubbles:!0});(f=n.current)==null||f.dispatchEvent(h)}}}function _h(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[cj,uj,dj,fj]=eh(),[hj,fs]=jt({strict:!1,name:"MenuContext"});function pj(e,...t){const n=g.useId(),r=e||n;return g.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function Oy(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function kg(e){return Oy(e).activeElement===e}function mj(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:c,isOpen:u,defaultIsOpen:f,onClose:p,onOpen:h,placement:y="bottom-start",lazyBehavior:x="unmount",direction:S,computePositionOnMount:C=!1,...k}=e,w=g.useRef(null),j=g.useRef(null),I=dj(),P=g.useCallback(()=>{requestAnimationFrame(()=>{var Ie;(Ie=w.current)==null||Ie.focus({preventScroll:!1})})},[]),M=g.useCallback(()=>{const Ie=setTimeout(()=>{var pe;if(o)(pe=o.current)==null||pe.focus();else{const ce=I.firstEnabled();ce&&U(ce.index)}});Z.current.add(Ie)},[I,o]),T=g.useCallback(()=>{const Ie=setTimeout(()=>{const pe=I.lastEnabled();pe&&U(pe.index)});Z.current.add(Ie)},[I]),D=g.useCallback(()=>{h==null||h(),s?M():P()},[s,M,P,h]),{isOpen:_,onOpen:R,onClose:V,onToggle:F}=Th({isOpen:u,defaultIsOpen:f,onClose:p,onOpen:D});lj({enabled:_&&r,ref:w,handler:Ie=>{var pe;(pe=j.current)!=null&&pe.contains(Ie.target)||V()}});const L=Mh({...k,enabled:_||C,placement:y,direction:S}),[Q,U]=g.useState(-1);ei(()=>{_||U(-1)},[_]),Cy(w,{focusRef:j,visible:_,shouldFocus:!0});const K=Ay({isOpen:_,ref:w}),[te,ne]=pj(t,"menu-button","menu-list"),$=g.useCallback(()=>{R(),P()},[R,P]),Z=g.useRef(new Set([]));Cj(()=>{Z.current.forEach(Ie=>clearTimeout(Ie)),Z.current.clear()});const oe=g.useCallback(()=>{R(),M()},[M,R]),le=g.useCallback(()=>{R(),T()},[R,T]),Re=g.useCallback(()=>{var Ie,pe;const ce=Oy(w.current),Fe=(Ie=w.current)==null?void 0:Ie.contains(ce.activeElement);if(!(_&&!Fe))return;const Ue=(pe=I.item(Q))==null?void 0:pe.node;Ue==null||Ue.focus()},[_,Q,I]),Ne=g.useRef(null);return{openAndFocusMenu:$,openAndFocusFirstItem:oe,openAndFocusLastItem:le,onTransitionEnd:Re,unstable__animationState:K,descendants:I,popper:L,buttonId:te,menuId:ne,forceUpdate:L.forceUpdate,orientation:"vertical",isOpen:_,onToggle:F,onOpen:R,onClose:V,menuRef:w,buttonRef:j,focusedIndex:Q,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:U,isLazy:c,lazyBehavior:x,initialFocusRef:o,rafId:Ne}}function vj(e={},t=null){const n=fs(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:c}=n,u=g.useCallback(f=>{const p=f.key,y={Enter:s,ArrowDown:s,ArrowUp:c}[p];y&&(f.preventDefault(),f.stopPropagation(),y(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 jf(e){var t;return bj(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function gj(e={},t=null){const n=fs();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:p,lazyBehavior:h,unstable__animationState:y}=n,x=uj(),S=z6({preventDefault:j=>j.key!==" "&&jf(j.target)}),C=g.useCallback(j=>{const I=j.key,M={Tab:D=>D.preventDefault(),Escape:u,ArrowDown:()=>{const D=x.nextEnabled(r);D&&o(D.index)},ArrowUp:()=>{const D=x.prevEnabled(r);D&&o(D.index)}}[I];if(M){j.preventDefault(),M(j);return}const T=S(D=>{const _=R6(x.values(),D,R=>{var V,F;return(F=(V=R==null?void 0:R.node)==null?void 0:V.textContent)!=null?F:""},x.item(r));if(_){const R=x.indexOf(_.node);o(R)}});jf(j.target)&&T(j)},[x,r,S,u,o]),k=g.useRef(!1);c&&(k.current=!0);const w=_h({wasSelected:k.current,enabled:p,mode:h,isSelected:y.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 yj(e={}){const{popper:t,isOpen:n}=fs();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function xj(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:c,isDisabled:u,isFocusable:f,closeOnSelect:p,type:h,...y}=e,x=fs(),{setFocusedIndex:S,focusedIndex:C,closeOnSelect:k,onClose:w,menuRef:j,isOpen:I,menuId:P,rafId:M}=x,T=g.useRef(null),D=`${P}-menuitem-${g.useId()}`,{index:_,register:R}=fj({disabled:u&&!f}),V=g.useCallback($=>{n==null||n($),!u&&S(_)},[S,_,u,n]),F=g.useCallback($=>{r==null||r($),T.current&&!kg(T.current)&&V($)},[V,r]),L=g.useCallback($=>{o==null||o($),!u&&S(-1)},[S,u,o]),Q=g.useCallback($=>{s==null||s($),jf($.currentTarget)&&(p??k)&&w()},[w,s,k,p]),U=g.useCallback($=>{c==null||c($),S(_)},[S,c,_]),K=_===C,te=u&&!f;ei(()=>{I&&(K&&!te&&T.current?(M.current&&cancelAnimationFrame(M.current),M.current=requestAnimationFrame(()=>{var $;($=T.current)==null||$.focus(),M.current=null})):j.current&&!kg(j.current)&&j.current.focus())},[K,te,j,I]);const ne=Sy({onClick:Q,onFocus:U,onMouseEnter:V,onMouseMove:F,onMouseLeave:L,ref:ct(R,T,t),isDisabled:u,isFocusable:f});return{...y,...ne,type:h??ne.type,id:D,role:"menuitem",tabIndex:K?0:-1}}function bj(e){var t;if(!Sj(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function Sj(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Cj(e,t=[]){return g.useEffect(()=>()=>e(),t)}var[wj,Ec]=jt({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Dh=e=>{const{children:t}=e,n=un("Menu",e),r=At(e),{direction:o}=ea(),{descendants:s,...c}=mj({...r,direction:o}),u=g.useMemo(()=>c,[c]),{isOpen:f,onClose:p,forceUpdate:h}=u;return l.jsx(cj,{value:s,children:l.jsx(hj,{value:u,children:l.jsx(wj,{value:n,children:y1(t,{isOpen:f,onClose:p,forceUpdate:h})})})})};Dh.displayName="Menu";var zy=fe((e,t)=>{const n=Ec();return l.jsx(re.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});zy.displayName="MenuCommand";var kj=fe((e,t)=>{const{type:n,...r}=e,o=Ec(),s=r.as||n?n??void 0:"button",c=g.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(re.button,{ref:t,type:s,...r,__css:c})}),Ry=e=>{const{className:t,children:n,...r}=e,o=g.Children.only(n),s=g.isValidElement(o)?g.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(re.span,{className:c,...r,__css:{flexShrink:0},children:s})};Ry.displayName="MenuIcon";var vr=fe((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:c,...u}=e,f=xj(u,t),h=n||o?l.jsx("span",{style:{pointerEvents:"none",flex:1},children:c}):c;return l.jsxs(kj,{...f,className:Ae("chakra-menu__menuitem",f.className),children:[n&&l.jsx(Ry,{fontSize:"0.8em",marginEnd:r,children:n}),h,o&&l.jsx(zy,{marginStart:s,children:o})]})});vr.displayName="MenuItem";var jj={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"}}},Ej=re(ir.div),Ah=fe(function(t,n){var r,o;const{rootProps:s,motionProps:c,...u}=t,{isOpen:f,onTransitionEnd:p,unstable__animationState:h}=fs(),y=gj(u,n),x=yj(s),S=Ec();return l.jsx(re.div,{...x,__css:{zIndex:(o=t.zIndex)!=null?o:(r=S.list)==null?void 0:r.zIndex},children:l.jsx(Ej,{variants:jj,initial:!1,animate:f?"enter":"exit",__css:{outline:0,...S.list},...c,className:Ae("chakra-menu__menu-list",y.className),...y,onUpdate:p,onAnimationComplete:yc(h.onComplete,y.onAnimationComplete)})})});Ah.displayName="MenuList";var Pj=fe((e,t)=>{const n=Ec();return l.jsx(re.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),Oh=fe((e,t)=>{const{children:n,as:r,...o}=e,s=vj(o,t),c=r||Pj;return l.jsx(c,{...s,className:Ae("chakra-menu__menu-button",e.className),children:l.jsx(re.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});Oh.displayName="MenuButton";var Ij={slideInBottom:{...ff,custom:{offsetY:16,reverse:!0}},slideInRight:{...ff,custom:{offsetX:16,reverse:!0}},scale:{...g2,custom:{initialScale:.95,reverse:!0}},none:{}},Mj=re(ir.section),Tj=e=>Ij[e||"none"],Ny=g.forwardRef((e,t)=>{const{preset:n,motionProps:r=Tj(n),...o}=e;return l.jsx(Mj,{ref:t,...r,...o})});Ny.displayName="ModalTransition";var _j=Object.defineProperty,Dj=(e,t,n)=>t in e?_j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Aj=(e,t,n)=>(Dj(e,typeof t!="symbol"?t+"":t,n),n),Oj=class{constructor(){Aj(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}},Ef=new Oj;function Fy(e,t){const[n,r]=g.useState(0);return g.useEffect(()=>{const o=e.current;if(o){if(t){const s=Ef.add(o);r(s)}return()=>{Ef.remove(o),r(0)}}},[t,e]),n}var zj=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ji=new WeakMap,Sl=new WeakMap,Cl={},wd=0,Ly=function(e){return e&&(e.host||Ly(e.parentNode))},Rj=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Ly(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)})},Nj=function(e,t,n,r){var o=Rj(t,Array.isArray(e)?e:[e]);Cl[n]||(Cl[n]=new WeakMap);var s=Cl[n],c=[],u=new Set,f=new Set(o),p=function(y){!y||u.has(y)||(u.add(y),p(y.parentNode))};o.forEach(p);var h=function(y){!y||f.has(y)||Array.prototype.forEach.call(y.children,function(x){if(u.has(x))h(x);else{var S=x.getAttribute(r),C=S!==null&&S!=="false",k=(ji.get(x)||0)+1,w=(s.get(x)||0)+1;ji.set(x,k),s.set(x,w),c.push(x),k===1&&C&&Sl.set(x,!0),w===1&&x.setAttribute(n,"true"),C||x.setAttribute(r,"true")}})};return h(t),u.clear(),wd++,function(){c.forEach(function(y){var x=ji.get(y)-1,S=s.get(y)-1;ji.set(y,x),s.set(y,S),x||(Sl.has(y)||y.removeAttribute(r),Sl.delete(y)),S||y.removeAttribute(n)}),wd--,wd||(ji=new WeakMap,ji=new WeakMap,Sl=new WeakMap,Cl={})}},Fj=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||zj(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),Nj(r,o,n,"aria-hidden")):function(){return null}};function Lj(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:c=!0,onOverlayClick:u,onEsc:f}=e,p=g.useRef(null),h=g.useRef(null),[y,x,S]=Hj(r,"chakra-modal","chakra-modal--header","chakra-modal--body");Bj(p,t&&c),Fy(p,t);const C=g.useRef(null),k=g.useCallback(R=>{C.current=R.target},[]),w=g.useCallback(R=>{R.key==="Escape"&&(R.stopPropagation(),s&&(n==null||n()),f==null||f())},[s,n,f]),[j,I]=g.useState(!1),[P,M]=g.useState(!1),T=g.useCallback((R={},V=null)=>({role:"dialog",...R,ref:ct(V,p),id:y,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?x:void 0,"aria-describedby":P?S:void 0,onClick:Ee(R.onClick,F=>F.stopPropagation())}),[S,P,y,x,j]),D=g.useCallback(R=>{R.stopPropagation(),C.current===R.target&&Ef.isTopModal(p.current)&&(o&&(n==null||n()),u==null||u())},[n,o,u]),_=g.useCallback((R={},V=null)=>({...R,ref:ct(V,h),onClick:Ee(R.onClick,D),onKeyDown:Ee(R.onKeyDown,w),onMouseDown:Ee(R.onMouseDown,k)}),[w,k,D]);return{isOpen:t,onClose:n,headerId:x,bodyId:S,setBodyMounted:M,setHeaderMounted:I,dialogRef:p,overlayRef:h,getDialogProps:T,getDialogContainerProps:_}}function Bj(e,t){const n=e.current;g.useEffect(()=>{if(!(!e.current||!t))return Fj(e.current)},[t,e,n])}function Hj(e,...t){const n=g.useId(),r=e||n;return g.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[Wj,oa]=jt({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Vj,Qo]=jt({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),po=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:p,allowPinchZoom:h,preserveScrollBarGap:y,motionPreset:x,lockFocusAcrossFrames:S,onCloseComplete:C}=t,k=un("Modal",t),j={...Lj(t),autoFocus:o,trapFocus:s,initialFocusRef:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:y,motionPreset:x,lockFocusAcrossFrames:S};return l.jsx(Vj,{value:j,children:l.jsx(Wj,{value:k,children:l.jsx(yo,{onExitComplete:C,children:j.isOpen&&l.jsx(Ua,{...n,children:r})})})})};po.displayName="Modal";var Vl="right-scroll-bar-position",Ul="width-before-scroll-bar",Uj="with-scroll-bars-hidden",$j="--removed-body-scroll-bar-size",By=O2(),kd=function(){},Pc=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:kd,onWheelCapture:kd,onTouchMoveCapture:kd}),o=r[0],s=r[1],c=e.forwardProps,u=e.children,f=e.className,p=e.removeScrollBar,h=e.enabled,y=e.shards,x=e.sideCar,S=e.noIsolation,C=e.inert,k=e.allowPinchZoom,w=e.as,j=w===void 0?"div":w,I=_2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),P=x,M=T2([n,t]),T=yr(yr({},I),o);return g.createElement(g.Fragment,null,h&&g.createElement(P,{sideCar:By,removeScrollBar:p,shards:y,noIsolation:S,inert:C,setCallbacks:s,allowPinchZoom:!!k,lockRef:n}),c?g.cloneElement(g.Children.only(u),yr(yr({},T),{ref:M})):g.createElement(j,yr({},T,{className:f,ref:M}),u))});Pc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Pc.classNames={fullWidth:Ul,zeroRight:Vl};var jg,Gj=function(){if(jg)return jg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qj(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Gj();return t&&e.setAttribute("nonce",t),e}function Yj(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Kj(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Xj=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qj())&&(Yj(t,n),Kj(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Qj=function(){var e=Xj();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Hy=function(){var e=Qj(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Zj={left:0,top:0,right:0,gap:0},jd=function(e){return parseInt(e||"",10)||0},Jj=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[jd(n),jd(r),jd(o)]},e7=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Zj;var t=Jj(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])}},t7=Hy(),n7=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(Uj,` { 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($j,": ").concat(u,`px; } `)},r7=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=g.useMemo(function(){return e7(o)},[o]);return g.createElement(t7,{styles:n7(s,!t,o,n?"":"!important")})},Pf=!1;if(typeof window<"u")try{var wl=Object.defineProperty({},"passive",{get:function(){return Pf=!0,!0}});window.addEventListener("test",wl,wl),window.removeEventListener("test",wl,wl)}catch{Pf=!1}var Ei=Pf?{passive:!1}:!1,o7=function(e){return e.tagName==="TEXTAREA"},Wy=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!o7(e)&&n[t]==="visible")},i7=function(e){return Wy(e,"overflowY")},a7=function(e){return Wy(e,"overflowX")},Eg=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=Vy(e,n);if(r){var o=Uy(e,n),s=o[1],c=o[2];if(s>c)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},s7=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},l7=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Vy=function(e,t){return e==="v"?i7(t):a7(t)},Uy=function(e,t){return e==="v"?s7(t):l7(t)},c7=function(e,t){return e==="h"&&t==="rtl"?-1:1},u7=function(e,t,n,r,o){var s=c7(e,window.getComputedStyle(t).direction),c=s*r,u=n.target,f=t.contains(u),p=!1,h=c>0,y=0,x=0;do{var S=Uy(e,u),C=S[0],k=S[1],w=S[2],j=k-w-s*C;(C||j)&&Vy(e,u)&&(y+=j,x+=C),u=u.parentNode}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(h&&(o&&y===0||!o&&c>y)||!h&&(o&&x===0||!o&&-c>x))&&(p=!0),p},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},d7=function(e,t){return e[0]===t[0]&&e[1]===t[1]},f7=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},h7=0,Pi=[];function p7(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),o=g.useState(h7++)[0],s=g.useState(function(){return Hy()})[0],c=g.useRef(e);g.useEffect(function(){c.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var k=xf([e.lockRef.current],(e.shards||[]).map(Ig),!0).filter(Boolean);return k.forEach(function(w){return w.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),k.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var u=g.useCallback(function(k,w){if("touches"in k&&k.touches.length===2)return!c.current.allowPinchZoom;var j=kl(k),I=n.current,P="deltaX"in k?k.deltaX:I[0]-j[0],M="deltaY"in k?k.deltaY:I[1]-j[1],T,D=k.target,_=Math.abs(P)>Math.abs(M)?"h":"v";if("touches"in k&&_==="h"&&D.type==="range")return!1;var R=Eg(_,D);if(!R)return!0;if(R?T=_:(T=_==="v"?"h":"v",R=Eg(_,D)),!R)return!1;if(!r.current&&"changedTouches"in k&&(P||M)&&(r.current=T),!T)return!0;var V=r.current||T;return u7(V,w,k,V==="h"?P:M,!0)},[]),f=g.useCallback(function(k){var w=k;if(!(!Pi.length||Pi[Pi.length-1]!==s)){var j="deltaY"in w?Pg(w):kl(w),I=t.current.filter(function(T){return T.name===w.type&&T.target===w.target&&d7(T.delta,j)})[0];if(I&&I.should){w.cancelable&&w.preventDefault();return}if(!I){var P=(c.current.shards||[]).map(Ig).filter(Boolean).filter(function(T){return T.contains(w.target)}),M=P.length>0?u(w,P[0]):!c.current.noIsolation;M&&w.cancelable&&w.preventDefault()}}},[]),p=g.useCallback(function(k,w,j,I){var P={name:k,delta:w,target:j,should:I};t.current.push(P),setTimeout(function(){t.current=t.current.filter(function(M){return M!==P})},1)},[]),h=g.useCallback(function(k){n.current=kl(k),r.current=void 0},[]),y=g.useCallback(function(k){p(k.type,Pg(k),k.target,u(k,e.lockRef.current))},[]),x=g.useCallback(function(k){p(k.type,kl(k),k.target,u(k,e.lockRef.current))},[]);g.useEffect(function(){return Pi.push(s),e.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:x}),document.addEventListener("wheel",f,Ei),document.addEventListener("touchmove",f,Ei),document.addEventListener("touchstart",h,Ei),function(){Pi=Pi.filter(function(k){return k!==s}),document.removeEventListener("wheel",f,Ei),document.removeEventListener("touchmove",f,Ei),document.removeEventListener("touchstart",h,Ei)}},[]);var S=e.removeScrollBar,C=e.inert;return g.createElement(g.Fragment,null,C?g.createElement(s,{styles:f7(o)}):null,S?g.createElement(r7,{gapMode:"margin"}):null)}const m7=m5(By,p7);var $y=g.forwardRef(function(e,t){return g.createElement(Pc,yr({},e,{ref:t,sideCar:m7}))});$y.classNames=Pc.classNames;const v7=$y;function g7(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:c,finalFocusRef:u,returnFocusOnClose:f,preserveScrollBarGap:p,lockFocusAcrossFrames:h,isOpen:y}=Qo(),[x,S]=SC();g.useEffect(()=>{!x&&S&&setTimeout(S)},[x,S]);const C=Fy(r,y);return l.jsx(fy,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:u,restoreFocus:f,contentRef:r,lockFocusAcrossFrames:h,children:l.jsx(v7,{removeScrollBar:!p,allowPinchZoom:c,enabled:C===1&&s,forwardProps:!0,children:e.children})})}var mo=fe((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...c}=e,{getDialogProps:u,getDialogContainerProps:f}=Qo(),p=u(c,t),h=f(o),y=Ae("chakra-modal__content",n),x=oa(),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:k}=Qo();return l.jsx(g7,{children:l.jsx(re.div,{...h,className:"chakra-modal__content-container",tabIndex:-1,__css:C,children:l.jsx(Ny,{preset:k,motionProps:s,className:y,...p,__css:S,children:r})})})});mo.displayName="ModalContent";function Gy(e){const{leastDestructiveRef:t,...n}=e;return l.jsx(po,{...n,initialFocusRef:t})}var qy=fe((e,t)=>l.jsx(mo,{ref:t,role:"alertdialog",...e})),Fr=fe((e,t)=>{const{className:n,...r}=e,o=Ae("chakra-modal__footer",n),c={display:"flex",alignItems:"center",justifyContent:"flex-end",...oa().footer};return l.jsx(re.footer,{ref:t,...r,__css:c,className:o})});Fr.displayName="ModalFooter";var Lr=fe((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=Qo();g.useEffect(()=>(s(!0),()=>s(!1)),[s]);const c=Ae("chakra-modal__header",n),f={flex:0,...oa().header};return l.jsx(re.header,{ref:t,className:c,id:o,...r,__css:f})});Lr.displayName="ModalHeader";var y7=re(ir.div),Br=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",...oa().overlay},{motionPreset:p}=Qo(),y=o||(p==="none"?{}:v2);return l.jsx(y7,{...y,__css:f,ref:t,className:c,...s})});Br.displayName="ModalOverlay";var Hr=fe((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=Qo();g.useEffect(()=>(s(!0),()=>s(!1)),[s]);const c=Ae("chakra-modal__body",n),u=oa();return l.jsx(re.div,{ref:t,className:c,id:o,...r,__css:u.body})});Hr.displayName="ModalBody";var ia=fe((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=Qo(),c=Ae("chakra-modal__close-btn",r),u=oa();return l.jsx(CC,{ref:t,__css:u.closeButton,className:c,onClick:Ee(n,f=>{f.stopPropagation(),s()}),...o})});ia.displayName="ModalCloseButton";var x7=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"})}),b7=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){g.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 p of f)p.type==="attributes"&&p.attributeName&&c.includes(p.attributeName)&&n(p)});return u.observe(e.current,{attributes:!0,attributeFilter:c}),()=>u.disconnect()})}function S7(e,t){const n=Wt(e);g.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var C7=50,Tg=300;function w7(e,t){const[n,r]=g.useState(!1),[o,s]=g.useState(null),[c,u]=g.useState(!0),f=g.useRef(null),p=()=>clearTimeout(f.current);S7(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?C7:null);const h=g.useCallback(()=>{c&&e(),f.current=setTimeout(()=>{u(!1),r(!0),s("increment")},Tg)},[e,c]),y=g.useCallback(()=>{c&&t(),f.current=setTimeout(()=>{u(!1),r(!0),s("decrement")},Tg)},[t,c]),x=g.useCallback(()=>{u(!0),r(!1),p()},[]);return g.useEffect(()=>()=>p(),[]),{up:h,down:y,stop:x,isSpinning:n}}var k7=/^[Ee0-9+\-.]$/;function j7(e){return k7.test(e)}function E7(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 P7(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:p,isInvalid:h,pattern:y="[0-9]*(.[0-9]+)?",inputMode:x="decimal",allowMouseWheel:S,id:C,onChange:k,precision:w,name:j,"aria-describedby":I,"aria-label":P,"aria-labelledby":M,onFocus:T,onBlur:D,onInvalid:_,getAriaValueText:R,isValidCharacter:V,format:F,parse:L,...Q}=e,U=Wt(T),K=Wt(D),te=Wt(_),ne=Wt(V??j7),$=Wt(R),Z=Qw(e),{update:oe,increment:le,decrement:Re}=Z,[Ne,Ie]=g.useState(!1),pe=!(u||f),ce=g.useRef(null),Fe=g.useRef(null),Ve=g.useRef(null),Ue=g.useRef(null),$e=g.useCallback(J=>J.split("").filter(ne).join(""),[ne]),Qe=g.useCallback(J=>{var Le;return(Le=L==null?void 0:L(J))!=null?Le:J},[L]),ge=g.useCallback(J=>{var Le;return((Le=F==null?void 0:F(J))!=null?Le:J).toString()},[F]);ei(()=>{(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=g.useCallback((J=c)=>{pe&&le(J)},[le,pe,c]),Ge=g.useCallback((J=c)=>{pe&&Re(J)},[Re,pe,c]),ye=w7(Te,Ge);Mg(Ve,"disabled",ye.stop,ye.isSpinning),Mg(Ue,"disabled",ye.stop,ye.isSpinning);const Pe=g.useCallback(J=>{if(J.nativeEvent.isComposing)return;const nt=Qe(J.currentTarget.value);oe($e(nt)),Fe.current={start:J.currentTarget.selectionStart,end:J.currentTarget.selectionEnd}},[oe,$e,Qe]),et=g.useCallback(J=>{var Le,nt,Nt;U==null||U(J),Fe.current&&(J.target.selectionStart=(nt=Fe.current.start)!=null?nt:(Le=J.currentTarget.value)==null?void 0:Le.length,J.currentTarget.selectionEnd=(Nt=Fe.current.end)!=null?Nt:J.currentTarget.selectionStart)},[U]),Be=g.useCallback(J=>{if(J.nativeEvent.isComposing)return;E7(J,ne)||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))},[ne,c,Te,Ge,oe,o,s]),vt=J=>{let Le=1;return(J.metaKey||J.ctrlKey)&&(Le=.1),J.shiftKey&&(Le=10),Le},Rt=g.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=g.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=g.useCallback(()=>{Ie(!1),n&&N()},[n,Ie,N]),xe=g.useCallback(()=>{t&&requestAnimationFrame(()=>{var J;(J=ce.current)==null||J.focus()})},[t]),ke=g.useCallback(J=>{J.preventDefault(),ye.up(),xe()},[xe,ye]),q=g.useCallback(J=>{J.preventDefault(),ye.down(),xe()},[xe,ye]);$o(()=>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=g.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||ke(Nt)}),onPointerLeave:Ee(J.onPointerLeave,ye.stop),onPointerUp:Ee(J.onPointerUp,ye.stop),disabled:nt,"aria-disabled":Rr(nt)}},[Z.isAtMax,r,ke,ye.stop,f]),Oe=g.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":Rr(nt)}},[Z.isAtMin,r,q,ye.stop,f]),Ze=g.useCallback((J={},Le=null)=>{var nt,Nt,he,_e;return{name:j,inputMode:x,type:"text",pattern:y,"aria-labelledby":M,"aria-label":P,"aria-describedby":I,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:p,required:(_e=J.required)!=null?_e:p,ref:ct(ce,Le),value:ge(Z.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(Z.valueAsNumber)?void 0:Z.valueAsNumber,"aria-invalid":Rr(h??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,K,ue)}},[j,x,y,M,P,ge,I,C,f,p,u,h,Z.value,Z.valueAsNumber,Z.isOutOfRange,o,s,Rt,Pe,Be,et,K,ue]);return{value:ge(Z.value),valueAsNumber:Z.valueAsNumber,isFocused:Ne,isDisabled:f,isReadOnly:u,getIncrementButtonProps:ae,getDecrementButtonProps:Oe,getInputProps:Ze,htmlProps:Q}}var[I7,Ic]=jt({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[M7,zh]=jt({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Rh=fe(function(t,n){const r=un("NumberInput",t),o=At(t),s=sh(o),{htmlProps:c,...u}=P7(s),f=g.useMemo(()=>u,[u]);return l.jsx(M7,{value:f,children:l.jsx(I7,{value:r,children:l.jsx(re.div,{...c,ref:n,className:Ae("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Rh.displayName="NumberInput";var Nh=fe(function(t,n){const r=Ic();return l.jsx(re.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}})});Nh.displayName="NumberInputStepper";var Fh=fe(function(t,n){const{getInputProps:r}=zh(),o=r(t,n),s=Ic();return l.jsx(re.input,{...o,className:Ae("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});Fh.displayName="NumberInputField";var Yy=re("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Lh=fe(function(t,n){var r;const o=Ic(),{getDecrementButtonProps:s}=zh(),c=s(t,n);return l.jsx(Yy,{...c,__css:o.stepper,children:(r=t.children)!=null?r:l.jsx(x7,{})})});Lh.displayName="NumberDecrementStepper";var Bh=fe(function(t,n){var r;const{getIncrementButtonProps:o}=zh(),s=o(t,n),c=Ic();return l.jsx(Yy,{...s,__css:c.stepper,children:(r=t.children)!=null?r:l.jsx(b7,{})})});Bh.displayName="NumberIncrementStepper";var[T7,hs]=jt({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[_7,Hh]=jt({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Wh(e){const t=g.Children.only(e.children),{getTriggerProps:n}=hs();return g.cloneElement(t,n(t.props,t.ref))}Wh.displayName="PopoverTrigger";var Ii={click:"click",hover:"hover"};function D7(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:c=!0,arrowSize:u,arrowShadowColor:f,trigger:p=Ii.click,openDelay:h=200,closeDelay:y=200,isLazy:x,lazyBehavior:S="unmount",computePositionOnMount:C,...k}=e,{isOpen:w,onClose:j,onOpen:I,onToggle:P}=Th(e),M=g.useRef(null),T=g.useRef(null),D=g.useRef(null),_=g.useRef(!1),R=g.useRef(!1);w&&(R.current=!0);const[V,F]=g.useState(!1),[L,Q]=g.useState(!1),U=g.useId(),K=o??U,[te,ne,$,Z]=["popover-trigger","popover-content","popover-header","popover-body"].map(Pe=>`${Pe}-${K}`),{referenceRef:oe,getArrowProps:le,getPopperProps:Re,getArrowInnerProps:Ne,forceUpdate:Ie}=Mh({...k,enabled:w||!!C}),pe=Ay({isOpen:w,ref:D});o5({enabled:w,ref:T}),Cy(D,{focusRef:T,visible:w,shouldFocus:s&&p===Ii.click}),B6(D,{focusRef:r,visible:w,shouldFocus:c&&p===Ii.click});const ce=_h({wasSelected:R.current,enabled:x,mode:S,isSelected:pe.present}),Fe=g.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(D,et),children:ce?Pe.children:null,id:ne,tabIndex:-1,role:"dialog",onKeyDown:Ee(Pe.onKeyDown,vt=>{n&&vt.key==="Escape"&&j()}),onBlur:Ee(Pe.onBlur,vt=>{const Rt=_g(vt),N=Ed(D.current,Rt),ue=Ed(T.current,Rt);w&&t&&(!N&&!ue)&&j()}),"aria-labelledby":V?$:void 0,"aria-describedby":L?Z:void 0};return p===Ii.hover&&(Be.role="tooltip",Be.onMouseEnter=Ee(Pe.onMouseEnter,()=>{_.current=!0}),Be.onMouseLeave=Ee(Pe.onMouseLeave,vt=>{vt.nativeEvent.relatedTarget!==null&&(_.current=!1,setTimeout(()=>j(),y))})),Be},[ce,ne,V,$,L,Z,p,n,j,w,t,y,f,u]),Ve=g.useCallback((Pe={},et=null)=>Re({...Pe,style:{visibility:w?"visible":"hidden",...Pe.style}},et),[w,Re]),Ue=g.useCallback((Pe,et=null)=>({...Pe,ref:ct(et,M,oe)}),[M,oe]),$e=g.useRef(),Qe=g.useRef(),ge=g.useCallback(Pe=>{M.current==null&&oe(Pe)},[oe]),Te=g.useCallback((Pe={},et=null)=>{const Be={...Pe,ref:ct(T,et,ge),id:te,"aria-haspopup":"dialog","aria-expanded":w,"aria-controls":ne};return p===Ii.click&&(Be.onClick=Ee(Pe.onClick,P)),p===Ii.hover&&(Be.onFocus=Ee(Pe.onFocus,()=>{$e.current===void 0&&I()}),Be.onBlur=Ee(Pe.onBlur,vt=>{const Rt=_g(vt),N=!Ed(D.current,Rt);w&&t&&N&&j()}),Be.onKeyDown=Ee(Pe.onKeyDown,vt=>{vt.key==="Escape"&&j()}),Be.onMouseEnter=Ee(Pe.onMouseEnter,()=>{_.current=!0,$e.current=window.setTimeout(()=>I(),h)}),Be.onMouseLeave=Ee(Pe.onMouseLeave,()=>{_.current=!1,$e.current&&(clearTimeout($e.current),$e.current=void 0),Qe.current=window.setTimeout(()=>{_.current===!1&&j()},y)})),Be},[te,w,ne,p,ge,P,I,t,j,h,y]);g.useEffect(()=>()=>{$e.current&&clearTimeout($e.current),Qe.current&&clearTimeout(Qe.current)},[]);const Ge=g.useCallback((Pe={},et=null)=>({...Pe,id:$,ref:ct(et,Be=>{F(!!Be)})}),[$]),ye=g.useCallback((Pe={},et=null)=>({...Pe,id:Z,ref:ct(et,Be=>{Q(!!Be)})}),[Z]);return{forceUpdate:Ie,isOpen:w,onAnimationComplete:pe.onComplete,onClose:j,getAnchorProps:Ue,getArrowProps:le,getArrowInnerProps:Ne,getPopoverPositionerProps:Ve,getPopoverProps:Fe,getTriggerProps:Te,getHeaderProps:Ge,getBodyProps:ye}}function Ed(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 Vh(e){const t=un("Popover",e),{children:n,...r}=At(e),o=ea(),s=D7({...r,direction:o.direction});return l.jsx(T7,{value:s,children:l.jsx(_7,{value:t,children:y1(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Vh.displayName="Popover";function Uh(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:c}=e,{getArrowProps:u,getArrowInnerProps:f}=hs(),p=Hh(),h=(t=n??r)!=null?t:o,y=s??c;return l.jsx(re.div,{...u(),className:"chakra-popover__arrow-positioner",children:l.jsx(re.div,{className:Ae("chakra-popover__arrow",e.className),...f(e),__css:{"--popper-arrow-bg":h?`colors.${h}, ${h}`:void 0,"--popper-arrow-shadow":y?`shadows.${y}, ${y}`:void 0,...p.arrow}})})}Uh.displayName="PopoverArrow";var Ky=fe(function(t,n){const{getBodyProps:r}=hs(),o=Hh();return l.jsx(re.div,{...r(t,n),className:Ae("chakra-popover__body",t.className),__css:o.body})});Ky.displayName="PopoverBody";function A7(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var O7={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]}}},z7=re(ir.section),Xy=fe(function(t,n){const{variants:r=O7,...o}=t,{isOpen:s}=hs();return l.jsx(z7,{ref:n,variants:A7(r),initial:!1,animate:s?"enter":"exit",...o})});Xy.displayName="PopoverTransition";var $h=fe(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:c,getPopoverPositionerProps:u,onAnimationComplete:f}=hs(),p=Hh(),h={position:"relative",display:"flex",flexDirection:"column",...p.content};return l.jsx(re.div,{...u(r),__css:p.popper,className:"chakra-popover__popper",children:l.jsx(Xy,{...o,...c(s,n),onAnimationComplete:yc(f,s.onAnimationComplete),className:Ae("chakra-popover__content",t.className),__css:h})})});$h.displayName="PopoverContent";function R7(e,t,n){return(e-t)*100/(n-t)}Jo({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});Jo({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var N7=Jo({"0%":{left:"-40%"},"100%":{left:"100%"}}),F7=Jo({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function L7(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:c,role:u="progressbar"}=e,f=R7(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[B7,H7]=jt({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),W7=fe((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:c,...u}=e,f=L7({value:o,min:n,max:r,isIndeterminate:s,role:c}),h={height:"100%",...H7().filledTrack};return l.jsx(re.div,{ref:t,style:{width:`${f.percent}%`,...u.style},...f.bind,...u,__css:h})}),Qy=fe((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:c,isAnimated:u,children:f,borderRadius:p,isIndeterminate:h,"aria-label":y,"aria-labelledby":x,"aria-valuetext":S,title:C,role:k,...w}=At(e),j=un("Progress",e),I=p??((n=j.track)==null?void 0:n.borderRadius),P={animation:`${F7} 1s linear infinite`},D={...!h&&c&&u&&P,...h&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${N7} 1s ease infinite normal none running`}},_={overflow:"hidden",position:"relative",...j.track};return l.jsx(re.div,{ref:t,borderRadius:I,__css:_,...w,children:l.jsxs(B7,{value:j,children:[l.jsx(W7,{"aria-label":y,"aria-labelledby":x,"aria-valuetext":S,min:o,max:s,value:r,isIndeterminate:h,css:D,borderRadius:I,title:C,role:k}),f]})})});Qy.displayName="Progress";function V7(e){return e&&Kd(e)&&Kd(e.target)}function U7(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:c,isNative:u,...f}=e,[p,h]=g.useState(r||""),y=typeof n<"u",x=y?n:p,S=g.useRef(null),C=g.useCallback(()=>{const T=S.current;if(!T)return;let D="input:not(:disabled):checked";const _=T.querySelector(D);if(_){_.focus();return}D="input:not(:disabled)";const R=T.querySelector(D);R==null||R.focus()},[]),w=`radio-${g.useId()}`,j=o||w,I=g.useCallback(T=>{const D=V7(T)?T.target.value:T;y||h(D),t==null||t(String(D))},[t,y]),P=g.useCallback((T={},D=null)=>({...T,ref:ct(D,S),role:"radiogroup"}),[]),M=g.useCallback((T={},D=null)=>({...T,ref:D,name:j,[u?"checked":"isChecked"]:x!=null?T.value===x:void 0,onChange(R){I(R)},"data-radiogroup":!0}),[u,j,I,x]);return{getRootProps:P,getRadioProps:M,name:j,ref:S,focus:C,setValue:h,value:x,onChange:I,isDisabled:s,isFocusable:c,htmlProps:f}}var[$7,Zy]=jt({name:"RadioGroupContext",strict:!1}),Xa=fe((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:c,isDisabled:u,isFocusable:f,...p}=e,{value:h,onChange:y,getRootProps:x,name:S,htmlProps:C}=U7(p),k=g.useMemo(()=>({name:S,size:r,onChange:y,colorScheme:n,value:h,variant:o,isDisabled:u,isFocusable:f}),[S,r,y,n,h,o,u,f]);return l.jsx($7,{value:k,children:l.jsx(re.div,{...x(C,t),className:Ae("chakra-radio-group",c),children:s})})});Xa.displayName="RadioGroup";var G7={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function q7(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:c,onChange:u,isInvalid:f,name:p,value:h,id:y,"data-radiogroup":x,"aria-describedby":S,...C}=e,k=`radio-${g.useId()}`,w=ni(),I=!!Zy()||!!x;let M=!!w&&!I?w.id:k;M=y??M;const T=o??(w==null?void 0:w.isDisabled),D=s??(w==null?void 0:w.isReadOnly),_=c??(w==null?void 0:w.isRequired),R=f??(w==null?void 0:w.isInvalid),[V,F]=g.useState(!1),[L,Q]=g.useState(!1),[U,K]=g.useState(!1),[te,ne]=g.useState(!1),[$,Z]=g.useState(Boolean(t)),oe=typeof n<"u",le=oe?n:$;g.useEffect(()=>C2(F),[]);const Re=g.useCallback(ge=>{if(D||T){ge.preventDefault();return}oe||Z(ge.target.checked),u==null||u(ge)},[oe,T,D,u]),Ne=g.useCallback(ge=>{ge.key===" "&&ne(!0)},[ne]),Ie=g.useCallback(ge=>{ge.key===" "&&ne(!1)},[ne]),pe=g.useCallback((ge={},Te=null)=>({...ge,ref:Te,"data-active":qe(te),"data-hover":qe(U),"data-disabled":qe(T),"data-invalid":qe(R),"data-checked":qe(le),"data-focus":qe(L),"data-focus-visible":qe(L&&V),"data-readonly":qe(D),"aria-hidden":!0,onMouseDown:Ee(ge.onMouseDown,()=>ne(!0)),onMouseUp:Ee(ge.onMouseUp,()=>ne(!1)),onMouseEnter:Ee(ge.onMouseEnter,()=>K(!0)),onMouseLeave:Ee(ge.onMouseLeave,()=>K(!1))}),[te,U,T,R,le,L,D,V]),{onFocus:ce,onBlur:Fe}=w??{},Ve=g.useCallback((ge={},Te=null)=>{const Ge=T&&!r;return{...ge,id:M,ref:Te,type:"radio",name:p,value:h,onChange:Ee(ge.onChange,Re),onBlur:Ee(Fe,ge.onBlur,()=>Q(!1)),onFocus:Ee(ce,ge.onFocus,()=>Q(!0)),onKeyDown:Ee(ge.onKeyDown,Ne),onKeyUp:Ee(ge.onKeyUp,Ie),checked:le,disabled:Ge,readOnly:D,required:_,"aria-invalid":Rr(R),"aria-disabled":Rr(Ge),"aria-required":Rr(_),"data-readonly":qe(D),"aria-describedby":S,style:G7}},[T,r,M,p,h,Re,Fe,ce,Ne,Ie,le,D,_,R,S]);return{state:{isInvalid:R,isFocused:L,isChecked:le,isActive:te,isHovered:U,isDisabled:T,isReadOnly:D,isRequired:_},getCheckboxProps:pe,getInputProps:Ve,getLabelProps:(ge={},Te=null)=>({...ge,ref:Te,onMouseDown:Ee(ge.onMouseDown,Dg),onTouchStart:Ee(ge.onTouchStart,Dg),"data-disabled":qe(T),"data-checked":qe(le),"data-invalid":qe(R)}),getRootProps:(ge,Te=null)=>({...ge,ref:Te,"data-disabled":qe(T),"data-checked":qe(le),"data-invalid":qe(R)}),htmlProps:C}}function Dg(e){e.preventDefault(),e.stopPropagation()}function Y7(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=Zy(),{onChange:o,value:s}=e,c=un("Radio",{...r,...e}),u=At(e),{spacing:f="0.5rem",children:p,isDisabled:h=r==null?void 0:r.isDisabled,isFocusable:y=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 k=o;r!=null&&r.onChange&&s!=null&&(k=yc(r.onChange,o));const w=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:j,getCheckboxProps:I,getLabelProps:P,getRootProps:M,htmlProps:T}=q7({...S,isChecked:C,isFocusable:y,isDisabled:h,onChange:k,name:w}),[D,_]=Y7(T,x1),R=I(_),V=j(x,t),F=P(),L=Object.assign({},D,M()),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},K={userSelect:"none",marginStart:f,...c.label};return l.jsxs(re.label,{className:"chakra-radio",...L,__css:Q,children:[l.jsx("input",{className:"chakra-radio__input",...V}),l.jsx(re.span,{className:"chakra-radio__control",...R,__css:U}),p&&l.jsx(re.span,{className:"chakra-radio__label",...F,__css:K,children:p})]})});vn.displayName="Radio";var Jy=fe(function(t,n){const{children:r,placeholder:o,className:s,...c}=t;return l.jsxs(re.select,{...c,ref:n,className:Ae("chakra-select",s),children:[o&&l.jsx("option",{value:"",children:o}),r]})});Jy.displayName="SelectField";function K7(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 ex=fe((e,t)=>{var n;const r=un("Select",e),{rootProps:o,placeholder:s,icon:c,color:u,height:f,h:p,minH:h,minHeight:y,iconColor:x,iconSize:S,...C}=At(e),[k,w]=K7(C,x1),j=ah(w),I={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(re.div,{className:"chakra-select__wrapper",__css:I,...k,...o,children:[l.jsx(Jy,{ref:t,height:p??f,minH:h??y,placeholder:s,...j,__css:P,children:e.children}),l.jsx(tx,{"data-disabled":qe(j.disabled),...(x||u)&&{color:x||u},__css:r.icon,...S&&{fontSize:S},children:c})]})});ex.displayName="Select";var X7=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"})}),Q7=re("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),tx=e=>{const{children:t=l.jsx(X7,{}),...n}=e,r=g.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return l.jsx(Q7,{...n,className:"chakra-select__icon-wrapper",children:g.isValidElement(t)?r:null})};tx.displayName="SelectIcon";var Mi=e=>e?"":void 0,Pd=e=>e?!0:void 0,ps=(...e)=>e.filter(Boolean).join(" ");function Id(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function jl(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var $l={width:0,height:0},El=e=>e||$l;function Z7(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=k=>{var w;const j=(w=r[k])!=null?w:$l;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...jl({orientation:t,vertical:{bottom:`calc(${n[k]}% - ${j.height/2}px)`},horizontal:{left:`calc(${n[k]}% - ${j.width/2}px)`}})}},c=t==="vertical"?r.reduce((k,w)=>El(k).height>El(w).height?k:w,$l):r.reduce((k,w)=>El(k).width>El(w).width?k:w,$l),u={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...jl({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",...jl({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},p=n.length===1,h=[0,o?100-n[0]:n[0]],y=p?h:n;let x=y[0];!p&&o&&(x=100-x);const S=Math.abs(y[y.length-1]-y[0]),C={...f,...jl({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 J7(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function e8(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function t8(e){const t=r8(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function nx(e){return!!e.touches}function n8(e){return nx(e)&&e.touches.length>1}function r8(e){var t;return(t=e.view)!=null?t:window}function o8(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function i8(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function rx(e,t="page"){return nx(e)?o8(e,t):i8(e,t)}function a8(e){return t=>{const n=t8(t);(!n||n&&t.button===0)&&e(t)}}function s8(e,t=!1){function n(o){e(o,{point:rx(o)})}return t?a8(n):n}function Gl(e,t,n,r){return e8(e,t,s8(n,t==="pointerdown"),r)}var l8=Object.defineProperty,c8=(e,t,n)=>t in e?l8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jn=(e,t,n)=>(c8(e,typeof t!="symbol"?t+"":t,n),n),u8=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=Md(this.lastEventInfo,this.history),f=this.startEvent!==null,p=p8(u.offset,{x:0,y:0})>=this.threshold;if(!f&&!p)return;const{timestamp:h}=$v();this.history.push({...u.point,timestamp:h});const{onStart:y,onMove:x}=this.handlers;f||(y==null||y(this.lastEvent,u),this.startEvent=this.lastEvent),x==null||x(this.lastEvent,u)}),Jn(this,"onPointerMove",(u,f)=>{this.lastEvent=u,this.lastEventInfo=f,NC.update(this.updatePoint,!0)}),Jn(this,"onPointerUp",(u,f)=>{const p=Md(f,this.history),{onEnd:h,onSessionEnd:y}=this.handlers;y==null||y(u,p),this.end(),!(!h||!this.startEvent)&&(h==null||h(u,p))});var r;if(this.win=(r=e.view)!=null?r:window,n8(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:rx(e)},{timestamp:s}=$v();this.history=[{...o.point,timestamp:s}];const{onSessionStart:c}=t;c==null||c(e,Md(o,this.history)),this.removeListeners=h8(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),FC.update(this.updatePoint)}};function Ag(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Md(e,t){return{point:e.point,delta:Ag(e.point,t[t.length-1]),offset:Ag(e.point,t[0]),velocity:f8(t,.1)}}var d8=e=>e*1e3;function f8(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>d8(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 h8(...e){return t=>e.reduce((n,r)=>r(n),t)}function Td(e,t){return Math.abs(e-t)}function Og(e){return"x"in e&&"y"in e}function p8(e,t){if(typeof e=="number"&&typeof t=="number")return Td(e,t);if(Og(e)&&Og(t)){const n=Td(e.x,t.x),r=Td(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function ox(e){const t=g.useRef(null);return t.current=e,t}function m8(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:c,threshold:u}=t,f=Boolean(n||r||o||s||c),p=g.useRef(null),h=ox({onSessionStart:s,onSessionEnd:c,onStart:r,onMove:n,onEnd(y,x){p.current=null,o==null||o(y,x)}});g.useEffect(()=>{var y;(y=p.current)==null||y.updateHandlers(h.current)}),g.useEffect(()=>{const y=e.current;if(!y||!f)return;function x(S){p.current=new u8(S,h.current,u)}return Gl(y,"pointerdown",x)},[e,f,h,u]),g.useEffect(()=>()=>{var y;(y=p.current)==null||y.end(),p.current=null},[])}function v8(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 p=c.borderBoxSize,h=Array.isArray(p)?p[0]:p;u=h.inlineSize,f=h.blockSize}else u=e.offsetWidth,f=e.offsetHeight;t({width:u,height:f})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}var g8=Boolean(globalThis==null?void 0:globalThis.document)?g.useLayoutEffect:g.useEffect;function y8(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 x8({getNodes:e,observeMutation:t=!0}){const[n,r]=g.useState([]),[o,s]=g.useState(0);return g8(()=>{const c=e(),u=c.map((f,p)=>v8(f,h=>{r(y=>[...y.slice(0,p),h,...y.slice(p+1)])}));if(t){const f=c[0];u.push(y8(f,()=>{s(p=>p+1)}))}return()=>{u.forEach(f=>{f==null||f()})}},[o]),n}function b8(e){return typeof e=="object"&&e!==null&&"current"in e}function S8(e){const[t]=x8({observeMutation:!1,getNodes(){return[b8(e)?e.current:e]}});return t}function C8(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:c,isReversed:u,direction:f="ltr",orientation:p="horizontal",id:h,isDisabled:y,isReadOnly:x,onChangeStart:S,onChangeEnd:C,step:k=1,getAriaValueText:w,"aria-valuetext":j,"aria-label":I,"aria-labelledby":P,name:M,focusThumbOnChange:T=!0,...D}=e,_=Wt(S),R=Wt(C),V=Wt(w),F=J7({isReversed:u,direction:f,orientation:p}),[L,Q]=nh({value:s,defaultValue:c??k8(n,r),onChange:o}),[U,K]=g.useState(!1),[te,ne]=g.useState(!1),$=!(y||x),Z=(r-n)/10,oe=k||(r-n)/100,le=Hl(L,n,r),Re=r-le+n,Ie=ng(F?Re:le,n,r),pe=p==="vertical",ce=ox({min:n,max:r,step:k,isDisabled:y,value:le,isInteractive:$,isReversed:F,isVertical:pe,eventSource:null,focusThumbOnChange:T,orientation:p}),Fe=g.useRef(null),Ve=g.useRef(null),Ue=g.useRef(null),$e=g.useId(),Qe=h??$e,[ge,Te]=[`slider-thumb-${Qe}`,`slider-track-${Qe}`],Ge=g.useCallback(he=>{var _e,dn;if(!Fe.current)return;const Vt=ce.current;Vt.eventSource="pointer";const fn=Fe.current.getBoundingClientRect(),{clientX:ar,clientY:wo}=(dn=(_e=he.touches)==null?void 0:_e[0])!=null?dn:he,sa=pe?fn.bottom-wo:ar-fn.left,Yc=pe?fn.height:fn.width;let la=sa/Yc;F&&(la=1-la);let ko=Xw(la,Vt.min,Vt.max);return Vt.step&&(ko=parseFloat(rg(ko,Vt.min,Vt.step))),ko=Hl(ko,Vt.min,Vt.max),ko},[pe,F,ce]),ye=g.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=g.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=g.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=V==null?void 0:V(le))!=null?t:j,vt=S8(Ve),{getThumbStyle:Rt,rootStyle:N,trackStyle:ue,innerTrackStyle:xe}=g.useMemo(()=>{const he=ce.current,_e=vt??{width:0,height:0};return Z7({isReversed:F,orientation:he.orientation,thumbRects:[_e],thumbPercents:[Ie]})},[F,vt,Ie,ce]),ke=g.useCallback(()=>{ce.current.focusThumbOnChange&&setTimeout(()=>{var _e;return(_e=Ve.current)==null?void 0:_e.focus()})},[ce]);ei(()=>{const he=ce.current;ke(),he.eventSource==="keyboard"&&(R==null||R(he.value))},[le,R]);function q(he){const _e=Ge(he);_e!=null&&_e!==ce.current.value&&Q(_e)}m8(Ue,{onPanSessionStart(he){const _e=ce.current;_e.isInteractive&&(K(!0),ke(),q(he),_==null||_(_e.value))},onPanSessionEnd(){const he=ce.current;he.isInteractive&&(K(!1),R==null||R(he.value))},onPan(he){ce.current.isInteractive&&q(he)}});const ae=g.useCallback((he={},_e=null)=>({...he,...D,ref:ct(_e,Ue),tabIndex:-1,"aria-disabled":Pd(y),"data-focused":Mi(te),style:{...he.style,...N}}),[D,y,te,N]),Oe=g.useCallback((he={},_e=null)=>({...he,ref:ct(_e,Fe),id:Te,"data-disabled":Mi(y),style:{...he.style,...ue}}),[y,Te,ue]),Ze=g.useCallback((he={},_e=null)=>({...he,ref:_e,style:{...he.style,...xe}}),[xe]),J=g.useCallback((he={},_e=null)=>({...he,ref:ct(_e,Ve),role:"slider",tabIndex:$?0:void 0,id:ge,"data-active":Mi(U),"aria-valuetext":Be,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":le,"aria-orientation":p,"aria-disabled":Pd(y),"aria-readonly":Pd(x),"aria-label":I,"aria-labelledby":I?void 0:P,style:{...he.style,...Rt(0)},onKeyDown:Id(he.onKeyDown,et),onFocus:Id(he.onFocus,()=>ne(!0)),onBlur:Id(he.onBlur,()=>ne(!1))}),[$,ge,U,Be,n,r,le,p,y,x,I,P,Rt,et]),Le=g.useCallback((he,_e=null)=>{const dn=!(he.valuer),Vt=le>=he.value,fn=ng(he.value,n,r),ar={position:"absolute",pointerEvents:"none",...w8({orientation:p,vertical:{bottom:F?`${100-fn}%`:`${fn}%`},horizontal:{left:F?`${100-fn}%`:`${fn}%`}})};return{...he,ref:_e,role:"presentation","aria-hidden":!0,"data-disabled":Mi(y),"data-invalid":Mi(!dn),"data-highlighted":Mi(Vt),style:{...he.style,...ar}}},[y,F,r,n,p,le]),nt=g.useCallback((he={},_e=null)=>({...he,ref:_e,type:"hidden",value:le,name:M}),[M,le]);return{state:{value:le,isFocused:te,isDragging:U},actions:Pe,getRootProps:ae,getTrackProps:Oe,getInnerTrackProps:Ze,getThumbProps:J,getMarkerProps:Le,getInputProps:nt}}function w8(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function k8(e,t){return t"}),[E8,Tc]=jt({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),ix=fe((e,t)=>{const n={orientation:"horizontal",...e},r=un("Slider",n),o=At(n),{direction:s}=ea();o.direction=s;const{getInputProps:c,getRootProps:u,...f}=C8(o),p=u(),h=c({},t);return l.jsx(j8,{value:f,children:l.jsx(E8,{value:r,children:l.jsxs(re.div,{...p,className:ps("chakra-slider",n.className),__css:r.container,children:[n.children,l.jsx("input",{...h})]})})})});ix.displayName="Slider";var ax=fe((e,t)=>{const{getThumbProps:n}=Mc(),r=Tc(),o=n(e,t);return l.jsx(re.div,{...o,className:ps("chakra-slider__thumb",e.className),__css:r.thumb})});ax.displayName="SliderThumb";var sx=fe((e,t)=>{const{getTrackProps:n}=Mc(),r=Tc(),o=n(e,t);return l.jsx(re.div,{...o,className:ps("chakra-slider__track",e.className),__css:r.track})});sx.displayName="SliderTrack";var lx=fe((e,t)=>{const{getInnerTrackProps:n}=Mc(),r=Tc(),o=n(e,t);return l.jsx(re.div,{...o,className:ps("chakra-slider__filled-track",e.className),__css:r.filledTrack})});lx.displayName="SliderFilledTrack";var If=fe((e,t)=>{const{getMarkerProps:n}=Mc(),r=Tc(),o=n(e,t);return l.jsx(re.div,{...o,className:ps("chakra-slider__marker",e.className),__css:r.mark})});If.displayName="SliderMark";var cx=fe(function(t,n){const r=un("Switch",t),{spacing:o="0.5rem",children:s,...c}=At(t),{state:u,getInputProps:f,getCheckboxProps:p,getRootProps:h,getLabelProps:y}=w2(c),x=g.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),S=g.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),C=g.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return l.jsxs(re.label,{...h(),className:Ae("chakra-switch",t.className),__css:x,children:[l.jsx("input",{className:"chakra-switch__input",...f({},n)}),l.jsx(re.span,{...p(),className:"chakra-switch__track",__css:S,children:l.jsx(re.span,{__css:r.thumb,className:"chakra-switch__thumb","data-checked":qe(u.isChecked),"data-hover":qe(u.isHovered)})}),s&&l.jsx(re.span,{className:"chakra-switch__label",...y(),__css:C,children:s})]})});cx.displayName="Switch";var[P8,I8,M8,T8]=eh();function _8(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:c,lazyBehavior:u="unmount",orientation:f="horizontal",direction:p="ltr",...h}=e,[y,x]=g.useState(n??0),[S,C]=nh({defaultValue:n??0,value:o,onChange:r});g.useEffect(()=>{o!=null&&x(o)},[o]);const k=M8(),w=g.useId();return{id:`tabs-${(t=e.id)!=null?t:w}`,selectedIndex:S,focusedIndex:y,setSelectedIndex:C,setFocusedIndex:x,isManual:s,isLazy:c,lazyBehavior:u,orientation:f,descendants:k,direction:p,htmlProps:h}}var[D8,_c]=jt({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function A8(e){const{focusedIndex:t,orientation:n,direction:r}=_c(),o=I8(),s=g.useCallback(c=>{const u=()=>{var I;const P=o.nextEnabled(t);P&&((I=P.node)==null||I.focus())},f=()=>{var I;const P=o.prevEnabled(t);P&&((I=P.node)==null||I.focus())},p=()=>{var I;const P=o.firstEnabled();P&&((I=P.node)==null||I.focus())},h=()=>{var I;const P=o.lastEnabled();P&&((I=P.node)==null||I.focus())},y=n==="horizontal",x=n==="vertical",S=c.key,C=r==="ltr"?"ArrowLeft":"ArrowRight",k=r==="ltr"?"ArrowRight":"ArrowLeft",j={[C]:()=>y&&f(),[k]:()=>y&&u(),ArrowDown:()=>x&&u(),ArrowUp:()=>x&&f(),Home:p,End:h}[S];j&&(c.preventDefault(),j(c))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:Ee(e.onKeyDown,s)}}function O8(e){const{isDisabled:t,isFocusable:n,...r}=e,{setSelectedIndex:o,isManual:s,id:c,setFocusedIndex:u,selectedIndex:f}=_c(),{index:p,register:h}=T8({disabled:t&&!n}),y=p===f,x=()=>{o(p)},S=()=>{u(p),!s&&!(t&&n)&&o(p)},C=Sy({...r,ref:ct(h,e.ref),isDisabled:t,isFocusable:n,onClick:Ee(e.onClick,x)}),k="button";return{...C,id:ux(c,p),role:"tab",tabIndex:y?0:-1,type:k,"aria-selected":y,"aria-controls":dx(c,p),onFocus:t?void 0:Ee(e.onFocus,S)}}var[z8,R8]=jt({});function N8(e){const t=_c(),{id:n,selectedIndex:r}=t,s=ih(e.children).map((c,u)=>g.createElement(z8,{key:u,value:{isSelected:u===r,id:dx(n,u),tabId:ux(n,u),selectedIndex:r}},c));return{...e,children:s}}function F8(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=_c(),{isSelected:s,id:c,tabId:u}=R8(),f=g.useRef(!1);s&&(f.current=!0);const p=_h({wasSelected:f.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:p?t:null,role:"tabpanel","aria-labelledby":u,hidden:!s,id:c}}function ux(e,t){return`${e}--tab-${t}`}function dx(e,t){return`${e}--tabpanel-${t}`}var[L8,Dc]=jt({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),fx=fe(function(t,n){const r=un("Tabs",t),{children:o,className:s,...c}=At(t),{htmlProps:u,descendants:f,...p}=_8(c),h=g.useMemo(()=>p,[p]),{isFitted:y,...x}=u;return l.jsx(P8,{value:f,children:l.jsx(D8,{value:h,children:l.jsx(L8,{value:r,children:l.jsx(re.div,{className:Ae("chakra-tabs",s),ref:n,...x,__css:r.root,children:o})})})})});fx.displayName="Tabs";var hx=fe(function(t,n){const r=A8({...t,ref:n}),s={display:"flex",...Dc().tablist};return l.jsx(re.div,{...r,className:Ae("chakra-tabs__tablist",t.className),__css:s})});hx.displayName="TabList";var px=fe(function(t,n){const r=F8({...t,ref:n}),o=Dc();return l.jsx(re.div,{outline:"0",...r,className:Ae("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});px.displayName="TabPanel";var mx=fe(function(t,n){const r=N8(t),o=Dc();return l.jsx(re.div,{...r,width:"100%",ref:n,className:Ae("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});mx.displayName="TabPanels";var vx=fe(function(t,n){const r=Dc(),o=O8({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return l.jsx(re.button,{...o,className:Ae("chakra-tabs__tab",t.className),__css:s})});vx.displayName="Tab";function B8(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var H8=["h","minH","height","minHeight"],Gh=fe((e,t)=>{const n=go("Textarea",e),{className:r,rows:o,...s}=At(e),c=ah(s),u=o?B8(n,H8):n;return l.jsx(re.textarea,{ref:t,rows:o,...c,className:Ae("chakra-textarea",r),__css:u})});Gh.displayName="Textarea";var W8={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},Mf=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function V8(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:c=o,closeOnEsc:u=!0,onOpen:f,onClose:p,placement:h,id:y,isOpen:x,defaultIsOpen:S,arrowSize:C=10,arrowShadowColor:k,arrowPadding:w,modifiers:j,isDisabled:I,gutter:P,offset:M,direction:T,...D}=e,{isOpen:_,onOpen:R,onClose:V}=Th({isOpen:x,defaultIsOpen:S,onOpen:f,onClose:p}),{referenceRef:F,getPopperProps:L,getArrowInnerProps:Q,getArrowProps:U}=Mh({enabled:_,placement:h,arrowPadding:w,modifiers:j,gutter:P,offset:M,direction:T}),K=g.useId(),ne=`tooltip-${y??K}`,$=g.useRef(null),Z=g.useRef(),oe=g.useCallback(()=>{Z.current&&(clearTimeout(Z.current),Z.current=void 0)},[]),le=g.useRef(),Re=g.useCallback(()=>{le.current&&(clearTimeout(le.current),le.current=void 0)},[]),Ne=g.useCallback(()=>{Re(),V()},[V,Re]),Ie=U8($,Ne),pe=g.useCallback(()=>{if(!I&&!Z.current){Ie();const Te=Mf($);Z.current=Te.setTimeout(R,t)}},[Ie,I,R,t]),ce=g.useCallback(()=>{oe();const Te=Mf($);le.current=Te.setTimeout(Ne,n)},[n,Ne,oe]),Fe=g.useCallback(()=>{_&&r&&ce()},[r,ce,_]),Ve=g.useCallback(()=>{_&&c&&ce()},[c,ce,_]),Ue=g.useCallback(Te=>{_&&Te.key==="Escape"&&ce()},[_,ce]);$o(()=>sc($),"keydown",u?Ue:void 0),$o(()=>sc($),"scroll",()=>{_&&s&&Ne()}),g.useEffect(()=>{I&&(oe(),_&&V())},[I,_,V,oe]),g.useEffect(()=>()=>{oe(),Re()},[oe,Re]),$o(()=>$.current,"pointerleave",ce);const $e=g.useCallback((Te={},Ge=null)=>({...Te,ref:ct($,Ge,F),onPointerEnter:Ee(Te.onPointerEnter,Pe=>{Pe.pointerType!=="touch"&&pe()}),onClick:Ee(Te.onClick,Fe),onPointerDown:Ee(Te.onPointerDown,Ve),onFocus:Ee(Te.onFocus,pe),onBlur:Ee(Te.onBlur,ce),"aria-describedby":_?ne:void 0}),[pe,ce,Ve,_,ne,Fe,F]),Qe=g.useCallback((Te={},Ge=null)=>L({...Te,style:{...Te.style,[Ht.arrowSize.var]:C?`${C}px`:void 0,[Ht.arrowShadowColor.var]:k}},Ge),[L,C,k]),ge=g.useCallback((Te={},Ge=null)=>{const ye={...Te.style,position:"relative",transformOrigin:Ht.transformOrigin.varRef};return{ref:Ge,...D,...Te,id:ne,role:"tooltip",style:ye}},[D,ne]);return{isOpen:_,show:pe,hide:ce,getTriggerProps:$e,getTooltipProps:ge,getTooltipPositionerProps:Qe,getArrowProps:U,getArrowInnerProps:Q}}var _d="chakra-ui:close-tooltip";function U8(e,t){return g.useEffect(()=>{const n=sc(e);return n.addEventListener(_d,t),()=>n.removeEventListener(_d,t)},[t,e]),()=>{const n=sc(e),r=Mf(e);n.dispatchEvent(new r.CustomEvent(_d))}}function $8(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function G8(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var q8=re(ir.div),Gt=fe((e,t)=>{var n,r;const o=go("Tooltip",e),s=At(e),c=ea(),{children:u,label:f,shouldWrapChildren:p,"aria-label":h,hasArrow:y,bg:x,portalProps:S,background:C,backgroundColor:k,bgColor:w,motionProps:j,...I}=s,P=(r=(n=C??k)!=null?n:x)!=null?r:w;if(P){o.bg=P;const L=LS(c,"colors",P);o[Ht.arrowBg.var]=L}const M=V8({...I,direction:c.direction}),T=typeof u=="string"||p;let D;if(T)D=l.jsx(re.span,{display:"inline-block",tabIndex:0,...M.getTriggerProps(),children:u});else{const L=g.Children.only(u);D=g.cloneElement(L,M.getTriggerProps(L.props,L.ref))}const _=!!h,R=M.getTooltipProps({},t),V=_?$8(R,["role","id"]):R,F=G8(R,["role","id"]);return f?l.jsxs(l.Fragment,{children:[D,l.jsx(yo,{children:M.isOpen&&l.jsx(Ua,{...S,children:l.jsx(re.div,{...M.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:l.jsxs(q8,{variants:W8,initial:"exit",animate:"enter",exit:"exit",...j,...V,__css:o,children:[f,_&&l.jsx(re.span,{srOnly:!0,...F,children:h}),y&&l.jsx(re.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:l.jsx(re.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):l.jsx(l.Fragment,{children:u})});Gt.displayName="Tooltip";const qh=g.createContext(null);let zg;const Yh=()=>({setOpenUploader:e=>{e&&(zg=e)},openUploader:zg}),bt=me(e=>e.ui,e=>BS[e.activeTab],{memoizeOptions:{equalityCheck:ee.isEqual}}),Y8=me(e=>e.ui,e=>e.activeTab,{memoizeOptions:{equalityCheck:ee.isEqual}}),Er=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(),p={uuid:b1(),category:"user",...f};t(S1({image:p,category:"user"})),s==="unifiedCanvas"?t(xc(p)):s==="img2img"&&t(ns(p))};var K8=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 ms(e,t){var n=X8(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 X8(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=K8.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var Q8=[".DS_Store","Thumbs.db"];function Z8(e){return ta(this,void 0,void 0,function(){return na(this,function(t){return lc(e)&&J8(e.dataTransfer)?[2,rE(e.dataTransfer,e.type)]:eE(e)?[2,tE(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,nE(e)]:[2,[]]})})}function J8(e){return lc(e)}function eE(e){return lc(e)&&lc(e.target)}function lc(e){return typeof e=="object"&&e!==null}function tE(e){return Tf(e.target.files).map(function(t){return ms(t)})}function nE(e){return ta(this,void 0,void 0,function(){var t;return na(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 ms(r)})]}})})}function rE(e,t){return ta(this,void 0,void 0,function(){var n,r;return na(this,function(o){switch(o.label){case 0:return e.items?(n=Tf(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(oE))]):[3,2];case 1:return r=o.sent(),[2,Ng(gx(r))];case 2:return[2,Ng(Tf(e.files).map(function(s){return ms(s)}))]}})})}function Ng(e){return e.filter(function(t){return Q8.indexOf(t.name)===-1})}function Tf(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 Lo(e){return e!=null}function bE(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 p=Sx(f,n),h=Qa(p,1),y=h[0],x=Cx(f,r,o),S=Qa(x,1),C=S[0],k=u?u(f):null;return y&&C&&!k})}function cc(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Pl(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 SE(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function CE(e){return e.indexOf("Edge/")!==-1}function wE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return SE(e)||CE(e)}function mr(){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 BE(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 Kh=g.forwardRef(function(e,t){var n=e.children,r=uc(e,ME),o=Px(r),s=o.open,c=uc(o,TE);return g.useImperativeHandle(t,function(){return{open:s}},[s]),Me.createElement(g.Fragment,null,n(Dt(Dt({},c),{},{open:s})))});Kh.displayName="Dropzone";var Ex={disabled:!1,getFilesFromEvent:Z8,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};Kh.defaultProps=Ex;Kh.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 Of={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Px(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Dt(Dt({},Ex),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,c=t.minSize,u=t.multiple,f=t.maxFiles,p=t.onDragEnter,h=t.onDragLeave,y=t.onDragOver,x=t.onDrop,S=t.onDropAccepted,C=t.onDropRejected,k=t.onFileDialogCancel,w=t.onFileDialogOpen,j=t.useFsAccessApi,I=t.autoFocus,P=t.preventDropOnDocument,M=t.noClick,T=t.noKeyboard,D=t.noDrag,_=t.noDragEventsBubbling,R=t.onError,V=t.validator,F=g.useMemo(function(){return EE(n)},[n]),L=g.useMemo(function(){return jE(n)},[n]),Q=g.useMemo(function(){return typeof w=="function"?w:Gg},[w]),U=g.useMemo(function(){return typeof k=="function"?k:Gg},[k]),K=g.useRef(null),te=g.useRef(null),ne=g.useReducer(HE,Of),$=Dd(ne,2),Z=$[0],oe=$[1],le=Z.isFocused,Re=Z.isFileDialogActive,Ne=g.useRef(typeof window<"u"&&window.isSecureContext&&j&&kE()),Ie=function(){!Ne.current&&Re&&setTimeout(function(){if(te.current){var ae=te.current.files;ae.length||(oe({type:"closeDialog"}),U())}},300)};g.useEffect(function(){return window.addEventListener("focus",Ie,!1),function(){window.removeEventListener("focus",Ie,!1)}},[te,Re,U,Ne]);var pe=g.useRef([]),ce=function(ae){K.current&&K.current.contains(ae.target)||(ae.preventDefault(),pe.current=[])};g.useEffect(function(){return P&&(document.addEventListener("dragover",Ug,!1),document.addEventListener("drop",ce,!1)),function(){P&&(document.removeEventListener("dragover",Ug),document.removeEventListener("drop",ce))}},[K,P]),g.useEffect(function(){return!r&&I&&K.current&&K.current.focus(),function(){}},[K,I,r]);var Fe=g.useCallback(function(q){R?R(q):console.error(q)},[R]),Ve=g.useCallback(function(q){q.preventDefault(),q.persist(),N(q),pe.current=[].concat(AE(pe.current),[q.target]),Pl(q)&&Promise.resolve(o(q)).then(function(ae){if(!(cc(q)&&!_)){var Oe=ae.length,Ze=Oe>0&&bE({files:ae,accept:F,minSize:c,maxSize:s,multiple:u,maxFiles:f,validator:V}),J=Oe>0&&!Ze;oe({isDragAccept:Ze,isDragReject:J,isDragActive:!0,type:"setDraggedFiles"}),p&&p(q)}}).catch(function(ae){return Fe(ae)})},[o,p,Fe,_,F,c,s,u,f,V]),Ue=g.useCallback(function(q){q.preventDefault(),q.persist(),N(q);var ae=Pl(q);if(ae&&q.dataTransfer)try{q.dataTransfer.dropEffect="copy"}catch{}return ae&&y&&y(q),!1},[y,_]),$e=g.useCallback(function(q){q.preventDefault(),q.persist(),N(q);var ae=pe.current.filter(function(Ze){return K.current&&K.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}),Pl(q)&&h&&h(q))},[K,h,_]),Qe=g.useCallback(function(q,ae){var Oe=[],Ze=[];q.forEach(function(J){var Le=Sx(J,F),nt=Dd(Le,2),Nt=nt[0],he=nt[1],_e=Cx(J,c,s),dn=Dd(_e,2),Vt=dn[0],fn=dn[1],ar=V?V(J):null;if(Nt&&Vt&&!ar)Oe.push(J);else{var wo=[he,fn];ar&&(wo=wo.concat(ar)),Ze.push({file:J,errors:wo.filter(function(sa){return sa})})}}),(!u&&Oe.length>1||u&&f>=1&&Oe.length>f)&&(Oe.forEach(function(J){Ze.push({file:J,errors:[xE]})}),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,V]),ge=g.useCallback(function(q){q.preventDefault(),q.persist(),N(q),pe.current=[],Pl(q)&&Promise.resolve(o(q)).then(function(ae){cc(q)&&!_||Qe(ae,q)}).catch(function(ae){return Fe(ae)}),oe({type:"reset"})},[o,Qe,Fe,_]),Te=g.useCallback(function(){if(Ne.current){oe({type:"openDialog"}),Q();var q={multiple:u,types:L};window.showOpenFilePicker(q).then(function(ae){return o(ae)}).then(function(ae){Qe(ae,null),oe({type:"closeDialog"})}).catch(function(ae){PE(ae)?(U(ae),oe({type:"closeDialog"})):IE(ae)?(Ne.current=!1,te.current?(te.current.value=null,te.current.click()):Fe(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."))):Fe(ae)});return}te.current&&(oe({type:"openDialog"}),Q(),te.current.value=null,te.current.click())},[oe,Q,U,j,Qe,Fe,L,u]),Ge=g.useCallback(function(q){!K.current||!K.current.isEqualNode(q.target)||(q.key===" "||q.key==="Enter"||q.keyCode===32||q.keyCode===13)&&(q.preventDefault(),Te())},[K,Te]),ye=g.useCallback(function(){oe({type:"focus"})},[]),Pe=g.useCallback(function(){oe({type:"blur"})},[]),et=g.useCallback(function(){M||(wE()?setTimeout(Te,0):Te())},[M,Te]),Be=function(ae){return r?null:ae},vt=function(ae){return T?null:Be(ae)},Rt=function(ae){return D?null:Be(ae)},N=function(ae){_&&ae.stopPropagation()},ue=g.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,_E);return Dt(Dt(Af({onKeyDown:vt(mr(J,Ge)),onFocus:vt(mr(Le,ye)),onBlur:vt(mr(nt,Pe)),onClick:Be(mr(Nt,et)),onDragEnter:Rt(mr(he,Ve)),onDragOver:Rt(mr(_e,Ue)),onDragLeave:Rt(mr(dn,$e)),onDrop:Rt(mr(Vt,ge)),role:typeof Ze=="string"&&Ze!==""?Ze:"presentation"},Oe,K),!r&&!T?{tabIndex:0}:{}),fn)}},[K,Ge,ye,Pe,et,Ve,Ue,$e,ge,T,D,r]),xe=g.useCallback(function(q){q.stopPropagation()},[]),ke=g.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,DE),nt=Af({accept:F,multiple:u,type:"file",style:{display:"none"},onChange:Be(mr(Ze,ge)),onClick:Be(mr(J,xe)),tabIndex:-1},Oe,te);return Dt(Dt({},nt),Le)}},[te,n,u,ge,r]);return Dt(Dt({},Z),{},{isFocused:le&&!r,getRootProps:ue,getInputProps:ke,rootRef:K,inputRef:te,open:Be(Te)})}function HE(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({},Of),{},{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({},Of);default:return e}}function Gg(){}function zf(){return zf=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 KE=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,p=n.keys,h=t.key,y=t.code,x=t.ctrlKey,S=t.metaKey,C=t.shiftKey,k=t.altKey,w=ao(y),j=h.toLowerCase();if(!r){if(o===!k&&j!=="alt"||u===!C&&j!=="shift")return!1;if(c){if(!S&&!x)return!1}else if(s===!S&&j!=="meta"||f===!x&&j!=="ctrl")return!1}return p&&p.length===1&&(p.includes(j)||p.includes(w))?!0:p?UE(p):!p},XE=g.createContext(void 0),QE=function(){return g.useContext(XE)};function Dx(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&&Dx(e[r],t[r])},!0):e===t}var ZE=g.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),JE=function(){return g.useContext(ZE)};function e9(e){var t=g.useRef(void 0);return Dx(t.current,e)||(t.current=e),t.current}var qg=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},t9=typeof window<"u"?g.useLayoutEffect:g.useEffect;function de(e,t,n,r){var o=g.useRef(null),s=g.useRef(!1),c=n instanceof Array?r instanceof Array?void 0:r:n,u=n instanceof Array?n:r instanceof Array?r:void 0,f=g.useCallback(t,u??[]),p=g.useRef(f);u?p.current=f:p.current=t;var h=e9(c),y=JE(),x=y.enabledScopes,S=QE();return t9(function(){if(!((h==null?void 0:h.enabled)===!1||!YE(x,h==null?void 0:h.scopes))){var C=function(I,P){var M;if(P===void 0&&(P=!1),!(qE(I)&&!_x(I,h==null?void 0:h.enableOnFormTags))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){qg(I);return}(M=I.target)!=null&&M.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||Ad(e,h==null?void 0:h.splitKey).forEach(function(T){var D,_=Od(T,h==null?void 0:h.combinationKey);if(KE(I,_,h==null?void 0:h.ignoreModifiers)||(D=_.keys)!=null&&D.includes("*")){if(P&&s.current)return;if($E(I,_,h==null?void 0:h.preventDefault),!GE(I,_,h==null?void 0:h.enabled)){qg(I);return}p.current(I,_),P||(s.current=!0)}})}},k=function(I){I.key!==void 0&&(Mx(ao(I.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&C(I))},w=function(I){I.key!==void 0&&(Tx(ao(I.code)),s.current=!1,h!=null&&h.keyup&&C(I,!0))};return(o.current||(c==null?void 0:c.document)||document).addEventListener("keyup",w),(o.current||(c==null?void 0:c.document)||document).addEventListener("keydown",k),S&&Ad(e,h==null?void 0:h.splitKey).forEach(function(j){return S.addHotkey(Od(j,h==null?void 0:h.combinationKey))}),function(){(o.current||(c==null?void 0:c.document)||document).removeEventListener("keyup",w),(o.current||(c==null?void 0:c.document)||document).removeEventListener("keydown",k),S&&Ad(e,h==null?void 0:h.splitKey).forEach(function(j){return S.removeHotkey(Od(j,h==null?void 0:h.combinationKey))})}}},[e,h,x]),o}const n9=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(B,{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"})]})})})},r9=e=>{const{children:t}=e,n=Y(),r=A(bt),o=ss({}),{t:s}=X(),[c,u]=g.useState(!1),{setOpenUploader:f}=Yh(),p=g.useCallback(P=>{u(!0);const M=P.errors.reduce((T,D)=>`${T} ${D.message}`,"");o({title:s("toast.uploadFailed"),description:M,status:"error",isClosable:!0})},[s,o]),h=g.useCallback(async P=>{n(Rg({imageFile:P}))},[n]),y=g.useCallback((P,M)=>{M.forEach(T=>{p(T)}),P.forEach(T=>{h(T)})},[h,p]),{getRootProps:x,getInputProps:S,isDragAccept:C,isDragReject:k,isDragActive:w,open:j}=Px({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:y,onDragOver:()=>u(!0),maxFiles:1});f(j),g.useEffect(()=>{const P=M=>{var R;const T=(R=M.clipboardData)==null?void 0:R.items;if(!T)return;const D=[];for(const V of T)V.kind==="file"&&["image/png","image/jpg"].includes(V.type)&&D.push(V);if(!D.length)return;if(M.stopImmediatePropagation(),D.length>1){o({description:s("toast.uploadFailedMultipleImagesDesc"),status:"error",isClosable:!0});return}const _=D[0].getAsFile();if(!_){o({description:s("toast.uploadFailedUnableToLoadDesc"),status:"error",isClosable:!0});return}n(Rg({imageFile:_}))};return document.addEventListener("paste",P),()=>{document.removeEventListener("paste",P)}},[s,n,o,r]);const I=["img2img","unifiedCanvas"].includes(r)?` to ${String(s(`common.${r}`))}`:"";return l.jsx(qh.Provider,{value:j,children:l.jsxs(Ye,{...x({style:{}}),onKeyDown:P=>{P.key},children:[l.jsx("input",{...S()}),t,w&&c&&l.jsx(n9,{isDragAccept:C,isDragReject:k,overlaySecondaryText:I,setIsHandlingUpload:u})]})})},o9=g.memo(r9),Ax=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(fo,{ref:t,role:n,"aria-checked":s!==void 0?s:void 0,...c})})});Ax.displayName="IAIIconButton";const se=g.memo(Ax);var i9=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)}},f9=["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__",Ox=function(e){l9(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||c9},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(),p=Number(n.state[u].toString().replace("px","")),h=p/f[u]*100;return h+"%"}return zd(n.state[u])},s=r&&typeof r.width<"u"&&!this.state.isResizing?zd(r.width):o("width"),c=r&&typeof r.height<"u"&&!this.state.isResizing?zd(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,p;if(this.props.bounds==="parent"){var h=this.parentNode;h&&(f=c?this.resizableRight-this.parentLeft:h.offsetWidth+(this.parentLeft-this.resizableLeft),p=u?this.resizableBottom-this.parentTop:h.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(f=c?this.resizableRight:this.window.innerWidth-this.resizableLeft,p=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),p=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,y=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,k=p||0;if(u){var w=(x-C)*this.ratio+k,j=(S-C)*this.ratio+k,I=(h-k)/this.ratio+C,P=(y-k)/this.ratio+C,M=Math.max(h,w),T=Math.min(y,j),D=Math.max(x,I),_=Math.min(S,P);n=Ml(n,M,T),r=Ml(r,D,_)}else n=Ml(n,h,y),r=Ml(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,p=s.bottom;this.resizableLeft=c,this.resizableRight=f,this.resizableTop=u,this.resizableBottom=p}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var o=0,s=0;if(n.nativeEvent&&u9(n.nativeEvent)?(o=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&Tl(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 p=this.parentNode;if(p){var h=this.window.getComputedStyle(p).flexDirection;this.flexDir=h.startsWith("row")?"row":"column",u=f.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var y={original:{x:o,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:gr(gr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:u};this.setState(y)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Tl(n))try{n.preventDefault(),n.stopPropagation()}catch{}var o=this.props,s=o.maxWidth,c=o.maxHeight,u=o.minWidth,f=o.minHeight,p=Tl(n)?n.touches[0].clientX:n.clientX,h=Tl(n)?n.touches[0].clientY:n.clientY,y=this.state,x=y.direction,S=y.original,C=y.width,k=y.height,w=this.getParentSize(),j=d9(w,this.window.innerWidth,this.window.innerHeight,s,c,u,f);s=j.maxWidth,c=j.maxHeight,u=j.minWidth,f=j.minHeight;var I=this.calculateNewSizeFromDirection(p,h),P=I.newHeight,M=I.newWidth,T=this.calculateNewMaxFromBoundary(s,c);this.props.snap&&this.props.snap.x&&(M=Qg(M,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 D=this.calculateNewSizeFromAspectRatio(M,P,{width:T.maxWidth,height:T.maxHeight},{width:u,height:f});if(M=D.newWidth,P=D.newHeight,this.props.grid){var _=Xg(M,this.props.grid[0]),R=Xg(P,this.props.grid[1]),V=this.props.snapGap||0;M=V===0||Math.abs(_-M)<=V?_:M,P=V===0||Math.abs(R-P)<=V?R:P}var F={width:M-S.width,height:P-S.height};if(C&&typeof C=="string"){if(C.endsWith("%")){var L=M/w.width*100;M=L+"%"}else if(C.endsWith("vw")){var Q=M/this.window.innerWidth*100;M=Q+"vw"}else if(C.endsWith("vh")){var U=M/this.window.innerHeight*100;M=U+"vh"}}if(k&&typeof k=="string"){if(k.endsWith("%")){var L=P/w.height*100;P=L+"%"}else if(k.endsWith("vw")){var Q=P/this.window.innerWidth*100;P=Q+"vw"}else if(k.endsWith("vh")){var U=P/this.window.innerHeight*100;P=U+"vh"}}var K={width:this.createSizeForCssProperty(M,"width"),height:this.createSizeForCssProperty(P,"height")};this.flexDir==="row"?K.flexBasis=K.width:this.flexDir==="column"&&(K.flexBasis=K.height),HS.flushSync(function(){r.setState(K)}),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:gr(gr({},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,p=r.handleComponent;if(!o)return null;var h=Object.keys(o).map(function(y){return o[y]!==!1?g.createElement(s9,{key:y,direction:y,onResizeStart:n.onResizeStart,replaceStyles:s&&s[y],className:c&&c[y]},p&&p[y]?p[y]:null):null});return g.createElement("div",{className:f,style:u},h)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(c,u){return f9.indexOf(u)!==-1||(c[u]=n.props[u]),c},{}),o=gr(gr(gr({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 g.createElement(s,gr({ref:this.ref,style:o,className:this.props.className},r),this.state.isResizing&&g.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}(g.PureComponent),zx={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Jg=Me.createContext&&Me.createContext(zx),co=globalThis&&globalThis.__assign||function(){return co=Object.assign||function(e){for(var t,n=1,r=arguments.length;ne.system,G9=e=>e.system.toastQueue,$x=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}=X(),n=A(Y9),{shouldShowLogViewer:r,hasError:o,wasErrorSeen:s}=A(K9),[c,u]=g.useState(!0),f=g.useRef(null);g.useLayoutEffect(()=>{f.current!==null&&c&&(f.current.scrollTop=f.current.scrollHeight)},[c,n,r]);const p=()=>{e(C1()),e(cd(!r))};de("`",()=>{e(cd(!r))},[r]),de("esc",()=>{e(cd(!1))});const h=()=>{f.current&&c&&f.current.scrollTop{const{timestamp:S,message:C,level:k}=y,w=k==="info"?"base":k;return l.jsxs(B,{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(g9,{}),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(O9,{}):l.jsx(Fx,{}),onClick:p,sx:{position:"fixed",insetInlineStart:2,bottom:2,zIndex:"10000"},colorScheme:o||!s?"error":"base"})})]})},Q9="0px",Gx="calc(70px + 1rem)",dc=1.5,Z9=`calc(100vw - ${Q9})`,J9=`calc(100vh - ${dc*4}px)`,eP=`calc(100vh - ${Gx})`,tP=`calc(100vh - (${Gx} + 4.4rem))`,t0=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}=X(),{isProcessing:t,currentStep:n,totalSteps:r,currentStatusHasSteps:o}=A(nP),s=n?Math.round(n*100/r):0;return l.jsx(Qy,{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(or,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[l.jsxs(or,{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}=ho(),{t:o}=X(),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"}],p=h=>l.jsx(B,{flexDir:"column",gap:4,children:h.map((y,x)=>l.jsxs(B,{flexDir:"column",px:2,gap:4,children:[l.jsx(oP,{title:y.title,description:y.desc,hotkey:y.hotkey}),x{const{children:n,tooltip:r="",tooltipProps:o,isChecked:s,...c}=e;return l.jsx(Gt,{label:r,...o,children:l.jsx(ti,{ref:t,"aria-checked":s,...c,children:n})})}),Je=g.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(xh,{...s})]})},mt=g.memo(sP),n0=/^-?(0\.)?\.?$/,lP=e=>{const{label:t,isDisabled:n=!1,showStepper:r=!0,isInvalid:o,value:s,onChange:c,min:u,max:f,isInteger:p=!0,formControlProps:h,formLabelProps:y,numberInputFieldProps:x,numberInputStepperProps:S,tooltipProps:C,...k}=e,[w,j]=g.useState(String(s));g.useEffect(()=>{!w.match(n0)&&s!==Number(w)&&j(String(s))},[s,w]);const I=M=>{j(M),M.match(n0)||c(p?Math.floor(Number(M)):Number(M))},P=M=>{const T=ee.clamp(p?Math.floor(Number(M.target.value)):Number(M.target.value),u,f);j(String(T)),c(T)};return l.jsx(Gt,{...C,children:l.jsxs(rt,{isDisabled:n,isInvalid:o,...h,children:[t&&l.jsx(st,{...y,children:t}),l.jsxs(Rh,{value:w,min:u,max:f,keepWithinRange:!0,clampValueOnBlur:!1,onChange:I,onBlur:P,...k,children:[l.jsx(Fh,{...x}),r&&l.jsxs(Nh,{children:[l.jsx(Bh,{...S}),l.jsx(Lh,{...S})]})]})]})})},Wr=g.memo(lP);var r0=Array.isArray,o0=Object.keys,cP=Object.prototype.hasOwnProperty,uP=typeof Element<"u";function Rf(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var n=r0(e),r=r0(t),o,s,c;if(n&&r){if(s=e.length,s!=t.length)return!1;for(o=s;o--!==0;)if(!Rf(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 p=e instanceof RegExp,h=t instanceof RegExp;if(p!=h)return!1;if(p&&h)return e.toString()==t.toString();var y=o0(e);if(s=y.length,s!==o0(t).length)return!1;for(o=s;o--!==0;)if(!cP.call(t,y[o]))return!1;if(uP&&e instanceof Element&&t instanceof Element)return e===t;for(o=s;o--!==0;)if(c=y[o],!(c==="_owner"&&e.$$typeof)&&!Rf(e[c],t[c]))return!1;return!0}return e!==e&&t!==t}var io=function(t,n){try{return Rf(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)?Za(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]=Za(e[o],t[o],n)}),r}function Za(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)}Za.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return Za(r,o,n)},{})};var Nf=Za,bP=typeof global=="object"&&global&&global.Object===Object&&global;const qx=bP;var SP=typeof self=="object"&&self&&self.Object===Object&&self,CP=qx||SP||Function("return this")();const Pr=CP;var wP=Pr.Symbol;const vo=wP;var Yx=Object.prototype,kP=Yx.hasOwnProperty,jP=Yx.toString,_a=vo?vo.toStringTag:void 0;function EP(e){var t=kP.call(e,_a),n=e[_a];try{e[_a]=void 0;var r=!0}catch{}var o=jP.call(e);return r&&(t?e[_a]=n:delete e[_a]),o}var PP=Object.prototype,IP=PP.toString;function MP(e){return IP.call(e)}var TP="[object Null]",_P="[object Undefined]",i0=vo?vo.toStringTag:void 0;function oi(e){return e==null?e===void 0?_P:TP:i0&&i0 in Object(e)?EP(e):MP(e)}function Kx(e,t){return function(n){return e(t(n))}}var DP=Kx(Object.getPrototypeOf,Object);const ep=DP;function ii(e){return e!=null&&typeof e=="object"}var AP="[object Object]",OP=Function.prototype,zP=Object.prototype,Xx=OP.toString,RP=zP.hasOwnProperty,NP=Xx.call(Object);function a0(e){if(!ii(e)||oi(e)!=AP)return!1;var t=ep(e);if(t===null)return!0;var n=RP.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Xx.call(n)==NP}function FP(){this.__data__=[],this.size=0}function Qx(e,t){return e===t||e!==e&&t!==t}function zc(e,t){for(var n=e.length;n--;)if(Qx(e[n][0],t))return n;return-1}var LP=Array.prototype,BP=LP.splice;function HP(e){var t=this.__data__,n=zc(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=zc(t,e);return n<0?void 0:t[n][1]}function VP(e){return zc(this.__data__,e)>-1}function UP(e,t){var n=this.__data__,r=zc(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function $r(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)&&o4(e.length)&&!!wt[oi(e)]}function tp(e){return function(t){return e(t)}}var i4=typeof exports=="object"&&exports&&!exports.nodeType&&exports,La=i4&&typeof module=="object"&&module&&!module.nodeType&&module,wM=La&&La.exports===i4,Nd=wM&&qx.process,kM=function(){try{var e=La&&La.require&&La.require("util").types;return e||Nd&&Nd.binding&&Nd.binding("util")}catch{}}();const Xi=kM;var f0=Xi&&Xi.isTypedArray,jM=f0?tp(f0):CM;const EM=jM;var PM=Object.prototype,IM=PM.hasOwnProperty;function a4(e,t){var n=ys(e),r=!n&&WI(e),o=!n&&!r&&r4(e),s=!n&&!r&&!o&&EM(e),c=n||r||o||s,u=c?NI(e.length,String):[],f=u.length;for(var p in e)(t||IM.call(e,p))&&!(c&&(p=="length"||o&&(p=="offset"||p=="parent")||s&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||XI(p,f)))&&u.push(p);return u}var MM=Object.prototype;function np(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||MM;return e===n}var TM=Kx(Object.keys,Object);const _M=TM;var DM=Object.prototype,AM=DM.hasOwnProperty;function OM(e){if(!np(e))return _M(e);var t=[];for(var n in Object(e))AM.call(e,n)&&n!="constructor"&&t.push(n);return t}function s4(e){return e!=null&&o4(e.length)&&!Zx(e)}function rp(e){return s4(e)?a4(e):OM(e)}function zM(e,t){return e&&Nc(t,rp(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=np(e),n=[];for(var r in e)r=="constructor"&&(t||!FM.call(e,r))||n.push(r);return n}function op(e){return s4(e)?a4(e,!0):LM(e)}function BM(e,t){return e&&Nc(t,op(t),e)}var l4=typeof exports=="object"&&exports&&!exports.nodeType&&exports,h0=l4&&typeof module=="object"&&module&&!module.nodeType&&module,HM=h0&&h0.exports===l4,p0=HM?Pr.Buffer:void 0,m0=p0?p0.allocUnsafe:void 0;function WM(e,t){if(t)return e.slice();var n=e.length,r=m0?m0(n):new e.constructor(n);return e.copy(r),r}function c4(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n=0)&&(n[o]=e[o]);return n}function _0(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var D0=function(t){return Array.isArray(t)&&t.length===0},kn=function(t){return typeof t=="function"},Fc=function(t){return t!==null&&typeof t=="object"},B_=function(t){return String(Math.floor(Number(t)))===t},Fd=function(t){return Object.prototype.toString.call(t)==="[object String]"},b4=function(t){return g.Children.count(t)===0},Ld=function(t){return Fc(t)&&kn(t.then)};function en(e,t,n,r){r===void 0&&(r=0);for(var o=x4(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 S4(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(ke){return R(ke,en(N,ke))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(xe).then(function(ke){return ke.reduce(function(q,ae,Oe){return ae==="DO_NOT_DELETE_YOU_WILL_BE_FIRED"||ae&&(q=Cr(q,ue[Oe],ae)),q},{})})},[R]),F=g.useCallback(function(N){return Promise.all([V(N),x.validationSchema?_(N):{},x.validate?D(N):{}]).then(function(ue){var xe=ue[0],ke=ue[1],q=ue[2],ae=Nf.all([xe,ke,q],{arrayMerge:G_});return ae})},[x.validate,x.validationSchema,V,D,_]),L=Bn(function(N){return N===void 0&&(N=M.values),T({type:"SET_ISVALIDATING",payload:!0}),F(N).then(function(ue){return j.current&&(T({type:"SET_ISVALIDATING",payload:!1}),T({type:"SET_ERRORS",payload:ue})),ue})});g.useEffect(function(){c&&j.current===!0&&io(S.current,x.initialValues)&&L(S.current)},[c,L]);var Q=g.useCallback(function(N){var ue=N&&N.values?N.values:S.current,xe=N&&N.errors?N.errors:C.current?C.current:x.initialErrors||{},ke=N&&N.touched?N.touched:k.current?k.current:x.initialTouched||{},q=N&&N.status?N.status:w.current?w.current:x.initialStatus;S.current=ue,C.current=xe,k.current=ke,w.current=q;var ae=function(){T({type:"RESET_FORM",payload:{isSubmitting:!!N&&!!N.isSubmitting,errors:xe,touched:ke,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(M.values,ge);Ld(Oe)?Oe.then(ae):ae()}else ae()},[x.initialErrors,x.initialStatus,x.initialTouched]);g.useEffect(function(){j.current===!0&&!io(S.current,x.initialValues)&&(p&&(S.current=x.initialValues,Q()),c&&L(S.current))},[p,x.initialValues,Q,c,L]),g.useEffect(function(){p&&j.current===!0&&!io(C.current,x.initialErrors)&&(C.current=x.initialErrors||zo,T({type:"SET_ERRORS",payload:x.initialErrors||zo}))},[p,x.initialErrors]),g.useEffect(function(){p&&j.current===!0&&!io(k.current,x.initialTouched)&&(k.current=x.initialTouched||Dl,T({type:"SET_TOUCHED",payload:x.initialTouched||Dl}))},[p,x.initialTouched]),g.useEffect(function(){p&&j.current===!0&&!io(w.current,x.initialStatus)&&(w.current=x.initialStatus,T({type:"SET_STATUS",payload:x.initialStatus}))},[p,x.initialStatus,x.initialTouched]);var U=Bn(function(N){if(I.current[N]&&kn(I.current[N].validate)){var ue=en(M.values,N),xe=I.current[N].validate(ue);return Ld(xe)?(T({type:"SET_ISVALIDATING",payload:!0}),xe.then(function(ke){return ke}).then(function(ke){T({type:"SET_FIELD_ERROR",payload:{field:N,value:ke}}),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}),_(M.values,N).then(function(ke){return ke}).then(function(ke){T({type:"SET_FIELD_ERROR",payload:{field:N,value:ke[N]}}),T({type:"SET_ISVALIDATING",payload:!1})});return Promise.resolve()}),K=g.useCallback(function(N,ue){var xe=ue.validate;I.current[N]={validate:xe}},[]),te=g.useCallback(function(N){delete I.current[N]},[]),ne=Bn(function(N,ue){T({type:"SET_TOUCHED",payload:N});var xe=ue===void 0?o:ue;return xe?L(M.values):Promise.resolve()}),$=g.useCallback(function(N){T({type:"SET_ERRORS",payload:N})},[]),Z=Bn(function(N,ue){var xe=kn(N)?N(M.values):N;T({type:"SET_VALUES",payload:xe});var ke=ue===void 0?n:ue;return ke?L(xe):Promise.resolve()}),oe=g.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 ke=xe===void 0?n:xe;return ke?L(Cr(M.values,N,ue)):Promise.resolve()}),Re=g.useCallback(function(N,ue){var xe=ue,ke=N,q;if(!Fd(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,ke=/number|range/.test(Oe)?(q=parseFloat(Le),isNaN(q)?"":q):/checkbox/.test(Oe)?Y_(en(M.values,xe),nt,Le):he&&_e?q_(he):Le}xe&&le(xe,ke)},[le,M.values]),Ne=Bn(function(N){if(Fd(N))return function(ue){return Re(ue,N)};Re(N)}),Ie=Bn(function(N,ue,xe){ue===void 0&&(ue=!0),T({type:"SET_FIELD_TOUCHED",payload:{field:N,value:ue}});var ke=xe===void 0?o:xe;return ke?L(M.values):Promise.resolve()}),pe=g.useCallback(function(N,ue){N.persist&&N.persist();var xe=N.target,ke=xe.name,q=xe.id,ae=xe.outerHTML,Oe=ue||ke||q;Ie(Oe,!0)},[Ie]),ce=Bn(function(N){if(Fd(N))return function(ue){return pe(ue,N)};pe(N)}),Fe=g.useCallback(function(N){kn(N)?T({type:"SET_FORMIK_STATE",payload:N}):T({type:"SET_FORMIK_STATE",payload:function(){return N}})},[]),Ve=g.useCallback(function(N){T({type:"SET_STATUS",payload:N})},[]),Ue=g.useCallback(function(N){T({type:"SET_ISSUBMITTING",payload:N})},[]),$e=Bn(function(){return T({type:"SUBMIT_ATTEMPT"}),L().then(function(N){var ue=N instanceof Error,xe=!ue&&Object.keys(N).length===0;if(xe){var ke;try{if(ke=Te(),ke===void 0)return}catch(q){throw q}return Promise.resolve(ke).then(function(q){return j.current&&T({type:"SUBMIT_SUCCESS"}),q}).catch(function(q){if(j.current)throw T({type:"SUBMIT_FAILURE"}),q})}else if(j.current&&(T({type:"SUBMIT_FAILURE"}),ue))throw N})}),Qe=Bn(function(N){N&&N.preventDefault&&kn(N.preventDefault)&&N.preventDefault(),N&&N.stopPropagation&&kn(N.stopPropagation)&&N.stopPropagation(),$e().catch(function(ue){console.warn("Warning: An unhandled error was caught from submitForm()",ue)})}),ge={resetForm:Q,validateForm:L,validateField:U,setErrors:$,setFieldError:oe,setFieldTouched:Ie,setFieldValue:le,setStatus:Ve,setSubmitting:Ue,setTouched:ne,setValues:Z,setFormikState:Fe,submitForm:$e},Te=Bn(function(){return h(M.values,ge)}),Ge=Bn(function(N){N&&N.preventDefault&&kn(N.preventDefault)&&N.preventDefault(),N&&N.stopPropagation&&kn(N.stopPropagation)&&N.stopPropagation(),Q()}),ye=g.useCallback(function(N){return{value:en(M.values,N),error:en(M.errors,N),touched:!!en(M.touched,N),initialValue:en(S.current,N),initialTouched:!!en(k.current,N),initialError:en(C.current,N)}},[M.errors,M.touched,M.values]),Pe=g.useCallback(function(N){return{setValue:function(xe,ke){return le(N,xe,ke)},setTouched:function(xe,ke){return Ie(N,xe,ke)},setError:function(xe){return oe(N,xe)}}},[le,Ie,oe]),et=g.useCallback(function(N){var ue=Fc(N),xe=ue?N.name:N,ke=en(M.values,xe),q={name:xe,value:ke,onChange:Ne,onBlur:ce};if(ue){var ae=N.type,Oe=N.value,Ze=N.as,J=N.multiple;ae==="checkbox"?Oe===void 0?q.checked=!!ke:(q.checked=!!(Array.isArray(ke)&&~ke.indexOf(Oe)),q.value=Oe):ae==="radio"?(q.checked=ke===Oe,q.value=Oe):Ze==="select"&&J&&(q.value=q.value||[],q.multiple=!0)}return q},[ce,Ne,M.values]),Be=g.useMemo(function(){return!io(S.current,M.values)},[S.current,M.values]),vt=g.useMemo(function(){return typeof u<"u"?Be?M.errors&&Object.keys(M.errors).length===0:u!==!1&&kn(u)?u(x):u:M.errors&&Object.keys(M.errors).length===0},[u,Be,M.errors,x]),Rt=ht({},M,{initialValues:S.current,initialErrors:C.current,initialTouched:k.current,initialStatus:w.current,handleBlur:ce,handleChange:Ne,handleReset:Ge,handleSubmit:Qe,resetForm:Q,setErrors:$,setFormikState:Fe,setFieldTouched:Ie,setFieldValue:le,setFieldError:oe,setStatus:Ve,setSubmitting:Ue,setTouched:ne,setValues:Z,submitForm:$e,validateForm:L,validateField:U,isValid:vt,dirty:Be,unregisterField:te,registerField:K,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 g.useImperativeHandle(s,function(){return t}),g.createElement(H_,{value:t},n?g.createElement(n,t):o?o(t):r?kn(r)?r(t):b4(r)?null:g.Children.only(r):null)}function U_(e){var t={};if(e.inner){if(e.inner.length===0)return Cr(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=Cr(t,c.path,c.message))}}return t}function $_(e,t,n,r){n===void 0&&(n=!1),r===void 0&&(r={});var o=Wf(e);return t[n?"validateSync":"validate"](o,{abortEarly:!1,context:r})}function Wf(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||a0(o)?Wf(o):o!==""?o:void 0}):a0(e[r])?t[r]=Wf(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?Nf(Array.isArray(s)?[]:{},s,n):s}else n.isMergeableObject(s)?r[c]=Nf(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"?g.useLayoutEffect:g.useEffect;function Bn(e){var t=g.useRef(e);return K_(function(){t.current=e}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;or?o:r},0);return Array.from(ht({},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,p=f.name,h=f.formik.setFormikState;h(function(y){var x=typeof u=="function"?u:s,S=typeof c=="function"?c:s,C=Cr(y.values,p,s(en(y.values,p))),k=u?x(en(y.errors,p)):void 0,w=c?S(en(y.touched,p)):void 0;return D0(k)&&(k=void 0),D0(w)&&(w=void 0),ht({},y,{values:C,errors:u?Cr(y.errors,p,k):y.errors,touched:c?Cr(y.touched,p,w):y.touched})})},o.push=function(s){return o.updateArrayField(function(c){return[].concat(Qi(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 Bd(u,s,c)},function(u){return Bd(u,s,null)},function(u){return Bd(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(_0(o)),o.pop=o.pop.bind(_0(o)),o}var n=t.prototype;return n.componentDidUpdate=function(o){this.props.validateOnChange&&this.props.formik.validateOnChange&&!io(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?Qi(c):[];return s||(s=u[o]),kn(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,p=s.name,h=s.formik,y=Ho(h,["validate","validationSchema"]),x=ht({},o,{form:y,name:p});return c?g.createElement(c,x):u?u(x):f?typeof f=="function"?f(x):b4(f)?null:g.Children.only(f):null},t}(g.Component);eD.defaultProps={validateOnChange:!0};const tD=fe((e,t)=>{const{acceptButtonText:n="Accept",acceptCallback:r,cancelButtonText:o="Cancel",cancelCallback:s,children:c,title:u,triggerComponent:f}=e,{isOpen:p,onOpen:h,onClose:y}=ho(),x=g.useRef(null),S=()=>{r(),y()},C=()=>{s&&s(),y()};return l.jsxs(l.Fragment,{children:[g.cloneElement(f,{onClick:h,ref:t}),l.jsx(Gy,{isOpen:p,leastDestructiveRef:x,onClose:y,children:l.jsx(Br,{children:l.jsxs(qy,{children:[l.jsx(Lr,{fontSize:"lg",fontWeight:"bold",children:u}),l.jsx(Hr,{children:c}),l.jsxs(Fr,{children:[l.jsx(Je,{ref:x,onClick:C,children:o}),l.jsx(Je,{colorScheme:"error",onClick:S,ml:3,children:n})]})]})})})]})}),Bc=g.memo(tD);function nD(e){const{model:t}=e,r=A(C=>C.system.model_list)[t],o=Y(),{t:s}=X(),c=A(C=>C.system.isProcessing),u=A(C=>C.system.isConnected),[f,p]=g.useState("same"),[h,y]=g.useState("");g.useEffect(()=>{p("same")},[t]);const x=()=>{p("same")},S=()=>{o(WS({model_name:t,save_location:f,custom_location:f==="custom"&&h!==""?h:null}))};return l.jsxs(Bc,{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(B,{flexDirection:"column",rowGap:4,children:[l.jsx(Ce,{children:s("modelManager.convertToDiffusersHelpText1")}),l.jsxs(py,{children:[l.jsx(za,{children:s("modelManager.convertToDiffusersHelpText2")}),l.jsx(za,{children:s("modelManager.convertToDiffusersHelpText3")}),l.jsx(za,{children:s("modelManager.convertToDiffusersHelpText4")}),l.jsx(za,{children:s("modelManager.convertToDiffusersHelpText5")})]}),l.jsx(Ce,{children:s("modelManager.convertToDiffusersHelpText6")})]}),l.jsxs(B,{flexDir:"column",gap:4,children:[l.jsxs(B,{marginTop:4,flexDir:"column",gap:2,children:[l.jsx(Ce,{fontWeight:"600",children:s("modelManager.convertToDiffusersSaveLocation")}),l.jsx(Xa,{value:f,onChange:C=>p(C),children:l.jsxs(B,{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(B,{flexDirection:"column",rowGap:2,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:s("modelManager.customSaveLocation")}),l.jsx(mt,{value:h,onChange:C=>{C.target.value!==""&&y(C.target.value)},width:"full"})]})]})]})}function er(e){const{children:t,...n}=e;return l.jsx(pn,{margin:0,color:"base.400",...n,children:t})}function tr(e){const{children:t,...n}=e;return l.jsx(mn,{color:"error.400",...n,children:t})}const rD=me([Et],e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),A0=64,O0=2048;function oD(){const{openModel:e,model_list:t}=A(rD),n=A(f=>f.system.isProcessing),r=Y(),{t:o}=X(),[s,c]=g.useState({name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,default:!1,format:"ckpt"});g.useEffect(()=>{var f,p,h,y,x,S,C;if(e){const k=ee.pickBy(t,(w,j)=>ee.isEqual(j,e));c({name:e,description:(f=k[e])==null?void 0:f.description,config:(p=k[e])==null?void 0:p.config,weights:(h=k[e])==null?void 0:h.weights,vae:(y=k[e])==null?void 0:y.vae,width:(x=k[e])==null?void 0:x.width,height:(S=k[e])==null?void 0:S.height,default:(C=k[e])==null?void 0:C.default,format:"ckpt"})}},[t,e]);const u=f=>{r(rs({...f,width:Number(f.width),height:Number(f.height)}))};return e?l.jsxs(B,{flexDirection:"column",rowGap:4,width:"100%",children:[l.jsxs(B,{alignItems:"center",gap:4,justifyContent:"space-between",children:[l.jsx(Ce,{fontSize:"lg",fontWeight:"bold",children:e}),l.jsx(nD,{model:e})]}),l.jsx(B,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",paddingInlineEnd:8,children:l.jsx(xs,{enableReinitialize:!0,initialValues:s,onSubmit:u,children:({handleSubmit:f,errors:p,touched:h})=>l.jsx("form",{onSubmit:f,children:l.jsxs(ze,{rowGap:2,alignItems:"start",children:[l.jsxs(rt,{isInvalid:!!p.description&&h.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:o("modelManager.description")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),p.description&&h.description?l.jsx(tr,{children:p.description}):l.jsx(er,{children:o("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.config&&h.config,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:o("modelManager.config")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"config",name:"config",type:"text",width:"full"}),p.config&&h.config?l.jsx(tr,{children:p.config}):l.jsx(er,{children:o("modelManager.configValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.weights&&h.weights,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:o("modelManager.modelLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"weights",name:"weights",type:"text",width:"full"}),p.weights&&h.weights?l.jsx(tr,{children:p.weights}):l.jsx(er,{children:o("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.vae&&h.vae,children:[l.jsx(st,{htmlFor:"vae",fontSize:"sm",children:o("modelManager.vaeLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"vae",name:"vae",type:"text",width:"full"}),p.vae&&h.vae?l.jsx(tr,{children:p.vae}):l.jsx(er,{children:o("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(ra,{width:"100%",children:[l.jsxs(rt,{isInvalid:!!p.width&&h.width,children:[l.jsx(st,{htmlFor:"width",fontSize:"sm",children:o("modelManager.width")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{id:"width",name:"width",children:({field:y,form:x})=>l.jsx(Wr,{id:"width",name:"width",min:A0,max:O0,step:64,value:x.values.width,onChange:S=>x.setFieldValue(y.name,Number(S))})}),p.width&&h.width?l.jsx(tr,{children:p.width}):l.jsx(er,{children:o("modelManager.widthValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.height&&h.height,children:[l.jsx(st,{htmlFor:"height",fontSize:"sm",children:o("modelManager.height")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{id:"height",name:"height",children:({field:y,form:x})=>l.jsx(Wr,{id:"height",name:"height",min:A0,max:O0,step:64,value:x.values.height,onChange:S=>x.setFieldValue(y.name,Number(S))})}),p.height&&h.height?l.jsx(tr,{children:p.height}):l.jsx(er,{children:o("modelManager.heightValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:o("modelManager.updateModel")})]})})})})]}):l.jsx(B,{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}=X(),[s,c]=g.useState({name:"",description:"",repo_id:"",path:"",vae:{repo_id:"",path:""},default:!1,format:"diffusers"});g.useEffect(()=>{var f,p,h,y,x,S,C,k,w,j,I,P,M,T,D,_;if(e){const R=ee.pickBy(t,(V,F)=>ee.isEqual(F,e));c({name:e,description:(f=R[e])==null?void 0:f.description,path:(p=R[e])!=null&&p.path&&((h=R[e])==null?void 0:h.path)!=="None"?(y=R[e])==null?void 0:y.path:"",repo_id:(x=R[e])!=null&&x.repo_id&&((S=R[e])==null?void 0:S.repo_id)!=="None"?(C=R[e])==null?void 0:C.repo_id:"",vae:{repo_id:(w=(k=R[e])==null?void 0:k.vae)!=null&&w.repo_id?(I=(j=R[e])==null?void 0:j.vae)==null?void 0:I.repo_id:"",path:(M=(P=R[e])==null?void 0:P.vae)!=null&&M.path?(D=(T=R[e])==null?void 0:T.vae)==null?void 0:D.path:""},default:(_=R[e])==null?void 0:_.default,format:"diffusers"})}},[t,e]);const u=f=>{const p=f;f.path===""&&delete p.path,f.repo_id===""&&delete p.repo_id,f.vae.path===""&&delete p.vae.path,f.vae.repo_id===""&&delete p.vae.repo_id,r(rs(f))};return e?l.jsxs(B,{flexDirection:"column",rowGap:4,width:"100%",children:[l.jsx(B,{alignItems:"center",children:l.jsx(Ce,{fontSize:"lg",fontWeight:"bold",children:e})}),l.jsx(B,{flexDirection:"column",overflowY:"scroll",paddingInlineEnd:8,children:l.jsx(xs,{enableReinitialize:!0,initialValues:s,onSubmit:u,children:({handleSubmit:f,errors:p,touched:h})=>{var y,x,S,C,k,w,j,I,P,M;return l.jsx("form",{onSubmit:f,children:l.jsxs(ze,{rowGap:2,alignItems:"start",children:[l.jsxs(rt,{isInvalid:!!p.description&&h.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:o("modelManager.description")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),p.description&&h.description?l.jsx(tr,{children:p.description}):l.jsx(er,{children:o("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.path&&h.path,isRequired:!0,children:[l.jsx(st,{htmlFor:"path",fontSize:"sm",children:o("modelManager.modelLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"path",name:"path",type:"text",width:"full"}),p.path&&h.path?l.jsx(tr,{children:p.path}):l.jsx(er,{children:o("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.repo_id&&h.repo_id,children:[l.jsx(st,{htmlFor:"repo_id",fontSize:"sm",children:o("modelManager.repo_id")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"repo_id",name:"repo_id",type:"text",width:"full"}),p.repo_id&&h.repo_id?l.jsx(tr,{children:p.repo_id}):l.jsx(er,{children:o("modelManager.repoIDValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((y=p.vae)!=null&&y.path)&&((x=h.vae)==null?void 0:x.path),children:[l.jsx(st,{htmlFor:"vae.path",fontSize:"sm",children:o("modelManager.vaeLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"vae.path",name:"vae.path",type:"text",width:"full"}),(S=p.vae)!=null&&S.path&&((C=h.vae)!=null&&C.path)?l.jsx(tr,{children:(k=p.vae)==null?void 0:k.path}):l.jsx(er,{children:o("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((w=p.vae)!=null&&w.repo_id)&&((j=h.vae)==null?void 0:j.repo_id),children:[l.jsx(st,{htmlFor:"vae.repo_id",fontSize:"sm",children:o("modelManager.vaeRepoID")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"full"}),(I=p.vae)!=null&&I.repo_id&&((P=h.vae)!=null&&P.repo_id)?l.jsx(tr,{children:(M=p.vae)==null?void 0:M.repo_id}):l.jsx(er,{children:o("modelManager.vaeRepoIDValidationMsg")})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:o("modelManager.updateModel")})]})})}})})]}):l.jsx(B,{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})},pt=g.memo(sD);function w4(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M21 11H6.414l5.293-5.293-1.414-1.414L2.586 12l7.707 7.707 1.414-1.414L6.414 13H21z"}}]})(e)}function lD(e){return ve({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 up(e){return ve({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 cD(e){return ve({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 uD(e){return ve({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 dD(e){return ve({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 fD(e){return ve({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 k4=me([Et],e=>{const{model_list:t}=e,n=[];return ee.forEach(t,r=>{n.push(r.weights)}),n});function z0({model:e,modelsToAdd:t,setModelsToAdd:n}){const{t:r}=X(),o=A(k4),s=c=>{t.includes(c.target.value)?n(ee.remove(t,u=>u!==c.target.value)):n([...t,c.target.value])};return l.jsx(ze,{children:l.jsxs(B,{flexDirection:"column",gap:2,backgroundColor:t.includes(e.name)?"accent.650":"base.800",paddingX:4,paddingY:2,borderRadius:4,children:[l.jsxs(B,{gap:4,children:[l.jsx(pt,{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(yy,{colorScheme:"accent",children:r("modelManager.modelExists")})]}),l.jsx(Ce,{fontStyle:"italic",variant:"subtext",children:e.location})]})})}function hD(){const e=Y(),{t}=X(),n=A(P=>P.system.searchFolder),r=A(P=>P.system.foundModels),o=A(k4),s=A(P=>P.ui.shouldShowExistingModelsInSearch),c=A(P=>P.system.isProcessing),[u,f]=Me.useState([]),[p,h]=Me.useState("v1"),[y,x]=Me.useState(""),S=()=>{e(US(null)),e($S(null)),f([])},C=P=>{e(Pv(P.checkpointFolder))},k=()=>{f([]),r&&r.forEach(P=>{o.includes(P.location)||f(M=>[...M,P.name])})},w=()=>{f([])},j=()=>{const P=r==null?void 0:r.filter(T=>u.includes(T.name)),M={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:y};P==null||P.forEach(T=>{const D={name:T.name,description:"",config:M[p],weights:T.location,vae:"",width:512,height:512,default:!1,format:"ckpt"};e(rs(D))}),f([])},I=()=>{const P=[],M=[];return r&&r.forEach((T,D)=>{o.includes(T.location)?M.push(l.jsx(z0,{model:T,modelsToAdd:u,setModelsToAdd:f},D)):P.push(l.jsx(z0,{model:T,modelsToAdd:u,setModelsToAdd:f},D))}),l.jsxs(l.Fragment,{children:[P,s&&M]})};return l.jsxs(l.Fragment,{children:[n?l.jsxs(B,{sx:{padding:4,gap:2,position:"relative",borderRadius:"base",alignItems:"center",w:"full",bg:"base.900"},children:[l.jsxs(B,{sx:{flexDir:"column",gap:2},children:[l.jsx(Ce,{sx:{fontWeight:500,fontSize:"sm"},variant:"subtext",children:t("modelManager.checkpointFolder")}),l.jsx(Ce,{sx:{fontWeight:500,fontSize:"sm"},children:n})]}),l.jsx(kc,{}),l.jsx(se,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:l.jsx(up,{}),fontSize:18,disabled:c,onClick:()=>e(Pv(n))}),l.jsx(se,{"aria-label":t("modelManager.clearCheckpointFolder"),icon:l.jsx(vs,{style:{transform:"rotate(45deg)"}}),onClick:S})]}):l.jsx(xs,{initialValues:{checkpointFolder:""},onSubmit:P=>{C(P)},children:({handleSubmit:P})=>l.jsx("form",{onSubmit:P,children:l.jsxs(ra,{columnGap:2,alignItems:"flex-end",width:"100%",children:[l.jsx(rt,{isRequired:!0,width:"lg",children:l.jsx(kt,{as:mt,id:"checkpointFolder",name:"checkpointFolder",type:"text",size:"md",label:t("modelManager.checkpointFolder")})}),l.jsx(Je,{leftIcon:l.jsx(B9,{}),"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),type:"submit",disabled:c,paddingX:10,children:t("modelManager.findModels")})]})})}),r&&l.jsxs(B,{flexDirection:"column",rowGap:4,width:"full",children:[l.jsxs(B,{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(B,{columnGap:2,justifyContent:"space-between",children:[l.jsxs(B,{columnGap:2,children:[l.jsx(Je,{isDisabled:u.length===r.length,onClick:k,children:t("modelManager.selectAll")}),l.jsx(Je,{isDisabled:u.length===0,onClick:w,children:t("modelManager.deselectAll")}),l.jsx(pt,{label:t("modelManager.showExisting"),isChecked:s,onChange:()=>e(VS(!s))})]}),l.jsx(Je,{isDisabled:u.length===0,onClick:j,colorScheme:"accent",children:t("modelManager.addSelected")})]}),l.jsxs(B,{sx:{flexDirection:"column",padding:4,rowGap:4,borderRadius:"base",width:"full",bg:"base.900"},children:[l.jsxs(B,{gap:4,children:[l.jsx(Ce,{fontWeight:500,variant:"subtext",children:t("modelManager.pickModelType")}),l.jsx(Xa,{value:p,onChange:P=>h(P),defaultValue:"v1",name:"model_type",children:l.jsxs(B,{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")})})]})})]}),p==="custom"&&l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:t("modelManager.pathToCustomConfig")}),l.jsx(mt,{value:y,onChange:P=>{P.target.value!==""&&x(P.target.value)},width:"full"})]})]}),l.jsx(B,{flexDirection:"column",maxHeight:72,overflowY:"scroll",borderRadius:"sm",paddingInlineEnd:4,gap:2,children:r.length>0?I():l.jsx(Ce,{fontWeight:"500",padding:2,borderRadius:"sm",textAlign:"center",variant:"subtext",children:t("modelManager.noModelsFound")})})]})]})}const R0=64,N0=2048;function pD(){const e=Y(),{t}=X(),n=A(p=>p.system.isProcessing);function r(p){return/\s/.test(p)}function o(p){let h;return r(p)&&(h=t("modelManager.cannotUseSpaces")),h}const s={name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,format:"ckpt",default:!1},c=p=>{e(rs(p)),e(Wo(null))},[u,f]=Me.useState(!1);return l.jsxs(ze,{gap:2,alignItems:"flex-start",children:[l.jsx(se,{"aria-label":t("common.back"),tooltip:t("common.back"),onClick:()=>e(Wo(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",insetInlineEnd:12,top:3,icon:l.jsx(w4,{})}),l.jsx(hD,{}),l.jsx(pt,{label:t("modelManager.addManually"),isChecked:u,onChange:()=>f(!u)}),u&&l.jsx(xs,{initialValues:s,onSubmit:c,children:({handleSubmit:p,errors:h,touched:y})=>l.jsx("form",{onSubmit:p,children:l.jsxs(ze,{rowGap:2,children:[l.jsx(Ce,{fontSize:20,fontWeight:"bold",alignSelf:"start",children:t("modelManager.manual")}),l.jsxs(rt,{isInvalid:!!h.name&&y.name,isRequired:!0,children:[l.jsx(st,{htmlFor:"name",fontSize:"sm",children:t("modelManager.name")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"name",name:"name",type:"text",validate:o,width:"2xl"}),h.name&&y.name?l.jsx(mn,{children:h.name}):l.jsx(pn,{margin:0,children:t("modelManager.nameValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.description&&y.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:t("modelManager.description")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"description",name:"description",type:"text",width:"2xl"}),h.description&&y.description?l.jsx(mn,{children:h.description}):l.jsx(pn,{margin:0,children:t("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.config&&y.config,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:t("modelManager.config")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"config",name:"config",type:"text",width:"2xl"}),h.config&&y.config?l.jsx(mn,{children:h.config}):l.jsx(pn,{margin:0,children:t("modelManager.configValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.weights&&y.weights,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:t("modelManager.modelLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"weights",name:"weights",type:"text",width:"2xl"}),h.weights&&y.weights?l.jsx(mn,{children:h.weights}):l.jsx(pn,{margin:0,children:t("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.vae&&y.vae,children:[l.jsx(st,{htmlFor:"vae",fontSize:"sm",children:t("modelManager.vaeLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"vae",name:"vae",type:"text",width:"2xl"}),h.vae&&y.vae?l.jsx(mn,{children:h.vae}):l.jsx(pn,{margin:0,children:t("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(ra,{width:"100%",children:[l.jsxs(rt,{isInvalid:!!h.width&&y.width,children:[l.jsx(st,{htmlFor:"width",fontSize:"sm",children:t("modelManager.width")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{id:"width",name:"width",children:({field:x,form:S})=>l.jsx(Wr,{id:"width",name:"width",min:R0,max:N0,step:64,width:"90%",value:S.values.width,onChange:C=>S.setFieldValue(x.name,Number(C))})}),h.width&&y.width?l.jsx(mn,{children:h.width}):l.jsx(pn,{margin:0,children:t("modelManager.widthValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.height&&y.height,children:[l.jsx(st,{htmlFor:"height",fontSize:"sm",children:t("modelManager.height")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{id:"height",name:"height",children:({field:x,form:S})=>l.jsx(Wr,{id:"height",name:"height",min:R0,max:N0,width:"90%",step:64,value:S.values.height,onChange:C=>S.setFieldValue(x.name,Number(C))})}),h.height&&y.height?l.jsx(mn,{children:h.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")})]})})})]})}function Al({children:e}){return l.jsx(B,{sx:{flexDirection:"column",padding:4,rowGap:4,borderRadius:"base",width:"full",bg:"base.900"},children:e})}function mD(){const e=Y(),{t}=X(),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(rs(f)),e(Wo(null))};return l.jsxs(B,{children:[l.jsx(se,{"aria-label":t("common.back"),tooltip:t("common.back"),onClick:()=>e(Wo(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",insetInlineEnd:12,top:3,icon:l.jsx(w4,{})}),l.jsx(xs,{initialValues:s,onSubmit:c,children:({handleSubmit:u,errors:f,touched:p})=>{var h,y,x,S,C,k,w,j,I,P;return l.jsx("form",{onSubmit:u,children:l.jsxs(ze,{rowGap:2,children:[l.jsx(Al,{children:l.jsxs(rt,{isInvalid:!!f.name&&p.name,isRequired:!0,children:[l.jsx(st,{htmlFor:"name",fontSize:"sm",children:t("modelManager.name")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"name",name:"name",type:"text",validate:o,width:"2xl",isRequired:!0}),f.name&&p.name?l.jsx(mn,{children:f.name}):l.jsx(pn,{margin:0,children:t("modelManager.nameValidationMsg")})]})]})}),l.jsx(Al,{children:l.jsxs(rt,{isInvalid:!!f.description&&p.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:t("modelManager.description")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"description",name:"description",type:"text",width:"2xl",isRequired:!0}),f.description&&p.description?l.jsx(mn,{children:f.description}):l.jsx(pn,{margin:0,children:t("modelManager.descriptionValidationMsg")})]})]})}),l.jsxs(Al,{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&&p.path,children:[l.jsx(st,{htmlFor:"path",fontSize:"sm",children:t("modelManager.modelLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"path",name:"path",type:"text",width:"2xl"}),f.path&&p.path?l.jsx(mn,{children:f.path}):l.jsx(pn,{margin:0,children:t("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!f.repo_id&&p.repo_id,children:[l.jsx(st,{htmlFor:"repo_id",fontSize:"sm",children:t("modelManager.repo_id")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"repo_id",name:"repo_id",type:"text",width:"2xl"}),f.repo_id&&p.repo_id?l.jsx(mn,{children:f.repo_id}):l.jsx(pn,{margin:0,children:t("modelManager.repoIDValidationMsg")})]})]})]}),l.jsxs(Al,{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:!!((h=f.vae)!=null&&h.path)&&((y=p.vae)==null?void 0:y.path),children:[l.jsx(st,{htmlFor:"vae.path",fontSize:"sm",children:t("modelManager.vaeLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"vae.path",name:"vae.path",type:"text",width:"2xl"}),(x=f.vae)!=null&&x.path&&((S=p.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:!!((k=f.vae)!=null&&k.repo_id)&&((w=p.vae)==null?void 0:w.repo_id),children:[l.jsx(st,{htmlFor:"vae.repo_id",fontSize:"sm",children:t("modelManager.vaeRepoID")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"2xl"}),(j=f.vae)!=null&&j.repo_id&&((I=p.vae)!=null&&I.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 F0({text:e,onClick:t}){return l.jsx(B,{position:"relative",width:"50%",height:40,justifyContent:"center",alignItems:"center",onClick:t,as:ti,children:l.jsx(Ce,{fontWeight:"bold",children:e})})}function vD(){const{isOpen:e,onOpen:t,onClose:n}=ho(),r=A(u=>u.ui.addNewModelUIOption),o=Y(),{t:s}=X(),c=()=>{n(),o(Wo(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(B,{columnGap:2,alignItems:"center",children:[l.jsx(vs,{}),s("modelManager.addNew")]})}),l.jsxs(po,{isOpen:e,onClose:c,size:"3xl",closeOnOverlayClick:!1,children:[l.jsx(Br,{}),l.jsxs(mo,{margin:"auto",paddingInlineEnd:4,children:[l.jsx(Lr,{children:s("modelManager.addNewModel")}),l.jsx(ia,{}),l.jsxs(Hr,{children:[r==null&&l.jsxs(B,{columnGap:4,children:[l.jsx(F0,{text:s("modelManager.addCheckpointModel"),onClick:()=>o(Wo("ckpt"))}),l.jsx(F0,{text:s("modelManager.addDiffuserModel"),onClick:()=>o(Wo("diffusers"))})]}),r=="ckpt"&&l.jsx(pD,{}),r=="diffusers"&&l.jsx(mD,{})]}),l.jsx(Fr,{})]})]})]})}var gD=Jf({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"})]})}),j4=Jf({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"})]})}),yD=Jf({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}=X(),s=Y(),{name:c,status:u,description:f}=e,p=()=>{s(w1(c))},h=()=>{s(Iv(c))},y=()=>{s(GS(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(B,{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:h,cursor:"pointer",children:l.jsx(Gt,{label:f,hasArrow:!0,placement:"bottom",children:l.jsx(Ce,{fontWeight:"600",children:c})})}),l.jsx(kc,{onClick:h,cursor:"pointer"}),l.jsxs(B,{gap:2,alignItems:"center",children:[l.jsx(Ce,{color:x(),children:u}),l.jsx(ti,{size:"sm",onClick:p,isDisabled:u==="active"||t||!n,children:o("modelManager.load")}),l.jsx(se,{icon:l.jsx(gD,{}),size:"sm",onClick:h,"aria-label":o("accessibility.modifyConfig"),isDisabled:u==="active"||t||!n}),l.jsx(Bc,{title:o("modelManager.deleteModel"),acceptCallback:y,acceptButtonText:o("modelManager.delete"),triggerComponent:l.jsx(se,{icon:l.jsx(yD,{}),size:"sm","aria-label":o("modelManager.deleteConfig"),isDisabled:u==="active"||t||!n,colorScheme:"error"}),children:l.jsxs(B,{rowGap:4,flexDirection:"column",children:[l.jsx("p",{style:{fontWeight:"bold"},children:o("modelManager.deleteMsg1")}),l.jsx("p",{children:o("modelManager.deleteMsg2")})]})})]})]})}function L0(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 xD=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(ex,{...c,children:r.map(u=>typeof u=="string"||typeof u=="number"?l.jsx(L0,{value:u,children:u},u):l.jsx(L0,{value:u.value,children:u.key},u.value))})})]})},Mn=g.memo(xD),bD=e=>{const[t,n]=g.useState(!1),{label:r,value:o,min:s=1,max:c=100,step:u=1,onChange:f,tooltipSuffix:p="",withSliderMarks:h=!1,withInput:y=!1,isInteger:x=!1,inputWidth:S=16,inputReadOnly:C=!1,withReset:k=!1,hideTooltip:w=!1,isCompact:j=!1,handleReset:I,isResetDisabled:P,isSliderDisabled:M,isInputDisabled:T,sliderFormControlProps:D,sliderFormLabelProps:_,sliderMarkProps:R,sliderTrackProps:V,sliderThumbProps:F,sliderNumberInputProps:L,sliderNumberInputFieldProps:Q,sliderNumberInputStepperProps:U,sliderTooltipProps:K,sliderIAIIconButtonProps:te,...ne}=e,{t:$}=X(),[Z,oe]=g.useState(String(o));g.useEffect(()=>{oe(o)},[o]);const le=g.useMemo(()=>L!=null&&L.max?L.max:c,[c,L==null?void 0:L.max]),Re=ce=>{f(ce)},Ne=ce=>{ce.target.value===""&&(ce.target.value=String(s));const Fe=ee.clamp(x?Math.floor(Number(ce.target.value)):Number(Z),s,le);f(Fe)},Ie=ce=>{oe(ce)},pe=()=>{I&&I()};return l.jsxs(rt,{sx:j?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},...D,children:[l.jsx(st,{..._,mb:-1,children:r}),l.jsxs(ra,{w:"100%",gap:2,alignItems:"center",children:[l.jsxs(ix,{"aria-label":r,value:o,min:s,max:c,step:u,onChange:Re,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),focusThumbOnChange:!1,isDisabled:M,...ne,children:[h&&l.jsxs(l.Fragment,{children:[l.jsx(If,{value:s,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...R,children:s}),l.jsx(If,{value:c,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...R,children:c})]}),l.jsx(sx,{...V,children:l.jsx(lx,{})}),l.jsx(Gt,{hasArrow:!0,placement:"top",isOpen:t,label:`${o}${p}`,hidden:w,...K,children:l.jsx(ax,{...F})})]}),y&&l.jsxs(Rh,{min:s,max:le,step:u,value:Z,onChange:Ie,onBlur:Ne,isDisabled:T,...L,children:[l.jsx(Fh,{readOnly:C,minWidth:S,...Q}),l.jsxs(Nh,{...U,children:[l.jsx(Bh,{onClick:()=>f(Number(Z))}),l.jsx(Lh,{onClick:()=>f(Number(Z))})]})]}),k&&l.jsx(se,{size:"sm","aria-label":$("accessibility.reset"),tooltip:"Reset",icon:l.jsx(up,{}),onClick:pe,isDisabled:P,...te})]})]})},ut=g.memo(bD);function SD(){const e=Y(),{isOpen:t,onOpen:n,onClose:r}=ho(),o=A(q9),{t:s}=X(),[c,u]=g.useState(Object.keys(o)[0]),[f,p]=g.useState(Object.keys(o)[1]),[h,y]=g.useState("none"),[x,S]=g.useState(""),[C,k]=g.useState(.5),[w,j]=g.useState("weighted_sum"),[I,P]=g.useState("root"),[M,T]=g.useState(""),[D,_]=g.useState(!1),R=Object.keys(o).filter(U=>U!==f&&U!==h),V=Object.keys(o).filter(U=>U!==c&&U!==h),F=[{key:s("modelManager.none"),value:"none"},...Object.keys(o).filter(U=>U!==c&&U!==f).map(U=>({key:U,value:U}))],L=A(U=>U.system.isProcessing),Q=()=>{let U=[c,f,h];U=U.filter(te=>te!=="none");const K={models_to_merge:U,merged_model_name:x!==""?x:U.join("-"),alpha:C,interp:w,model_merge_save_path:I==="root"?null:M,force:D};e(qS(K))};return l.jsxs(l.Fragment,{children:[l.jsx(Je,{onClick:n,size:"sm",children:l.jsx(B,{columnGap:2,alignItems:"center",children:s("modelManager.mergeModels")})}),l.jsxs(po,{isOpen:t,onClose:r,size:"4xl",closeOnOverlayClick:!1,children:[l.jsx(Br,{}),l.jsxs(mo,{fontFamily:"Inter",margin:"auto",paddingInlineEnd:4,children:[l.jsx(Lr,{children:s("modelManager.mergeModels")}),l.jsx(ia,{}),l.jsx(Hr,{children:l.jsxs(B,{flexDirection:"column",rowGap:4,children:[l.jsxs(B,{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(B,{columnGap:4,children:[l.jsx(Mn,{label:s("modelManager.modelOne"),validValues:R,onChange:U=>u(U.target.value)}),l.jsx(Mn,{label:s("modelManager.modelTwo"),validValues:V,onChange:U=>p(U.target.value)}),l.jsx(Mn,{label:s("modelManager.modelThree"),validValues:F,onChange:U=>{U.target.value!=="none"?(y(U.target.value),j("add_difference")):(y("none"),j("weighted_sum"))}})]}),l.jsx(mt,{label:s("modelManager.mergedModelName"),value:x,onChange:U=>S(U.target.value)}),l.jsxs(B,{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=>k(U),withInput:!0,withReset:!0,handleReset:()=>k(.5),withSliderMarks:!0}),l.jsx(Ce,{variant:"subtext",fontSize:"sm",children:s("modelManager.modelMergeAlphaHelp")})]}),l.jsxs(B,{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(Xa,{value:w,onChange:U=>j(U),children:l.jsx(B,{columnGap:4,children:h==="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(B,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsxs(B,{columnGap:4,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:s("modelManager.mergedModelSaveLocation")}),l.jsx(Xa,{value:I,onChange:U=>P(U),children:l.jsxs(B,{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")})})]})})]}),I==="custom"&&l.jsx(mt,{label:s("modelManager.mergedModelCustomSaveLocation"),value:M,onChange:U=>T(U.target.value)})]}),l.jsx(pt,{label:s("modelManager.ignoreMismatch"),isChecked:D,onChange:U=>_(U.target.checked),fontWeight:"500"}),l.jsx(Je,{onClick:Q,isLoading:L,isDisabled:I==="custom"&&M==="",children:s("modelManager.merge")})]})}),l.jsx(Fr,{})]})]})]})}const CD=me(Et,e=>ee.map(e.model_list,(n,r)=>({name:r,...n})),{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function Hd({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]=g.useState(""),[s,c]=g.useState("all"),[u,f]=g.useTransition(),{t:p}=X(),h=x=>{f(()=>{o(x.target.value)})},y=g.useMemo(()=>{const x=[],S=[],C=[],k=[];return e.forEach((w,j)=>{w.name.toLowerCase().includes(r.toLowerCase())&&(C.push(l.jsx(Ol,{name:w.name,status:w.status,description:w.description},j)),w.format===s&&k.push(l.jsx(Ol,{name:w.name,status:w.status,description:w.description},j))),w.format!=="diffusers"?x.push(l.jsx(Ol,{name:w.name,status:w.status,description:w.description},j)):S.push(l.jsx(Ol,{name:w.name,status:w.status,description:w.description},j))}),r!==""?s==="all"?l.jsx(Ye,{marginTop:4,children:C}):l.jsx(Ye,{marginTop:4,children:k}):l.jsxs(B,{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:p("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:p("modelManager.diffusersModels")}),S]})]}),s==="ckpt"&&l.jsx(B,{flexDirection:"column",marginTop:4,children:x}),s==="diffusers"&&l.jsx(B,{flexDirection:"column",marginTop:4,children:S})]})},[e,r,p,s]);return l.jsxs(B,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:[l.jsxs(B,{justifyContent:"space-between",alignItems:"center",gap:2,children:[l.jsx(Wn,{size:"md",children:p("modelManager.availableModels")}),l.jsx(kc,{}),l.jsx(vD,{}),l.jsx(SD,{})]}),l.jsx(mt,{onChange:h,label:p("modelManager.search")}),l.jsxs(B,{flexDirection:"column",gap:1,maxHeight:window.innerHeight-240,overflow:"scroll",paddingInlineEnd:4,children:[l.jsxs(B,{columnGap:2,children:[l.jsx(Hd,{label:p("modelManager.allModels"),onClick:()=>c("all"),isActive:s==="all"}),l.jsx(Hd,{label:p("modelManager.checkpointModels"),onClick:()=>c("ckpt"),isActive:s==="ckpt"}),l.jsx(Hd,{label:p("modelManager.diffusersModels"),onClick:()=>c("diffusers"),isActive:s==="diffusers"})]}),t?y:l.jsx(B,{width:"100%",minHeight:96,justifyContent:"center",alignItems:"center",children:l.jsx(Xf,{})})]})]})};function kD({children:e}){const{isOpen:t,onOpen:n,onClose:r}=ho(),o=A(u=>u.system.model_list),s=A(u=>u.system.openModel),{t:c}=X();return l.jsxs(l.Fragment,{children:[g.cloneElement(e,{onClick:n}),l.jsxs(po,{isOpen:t,onClose:r,size:"full",children:[l.jsx(Br,{}),l.jsxs(mo,{children:[l.jsx(ia,{}),l.jsx(Lr,{children:c("modelManager.modelManager")}),l.jsx(Hr,{children:l.jsxs(B,{width:"100%",columnGap:8,children:[l.jsx(wD,{}),s&&o[s].format==="diffusers"?l.jsx(aD,{}):l.jsx(oD,{})]})}),l.jsx(Fr,{})]})]})]})}const jD=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}=X(),{models:n,isProcessing:r}=A(jD),o=A($x),s=c=>{e(w1(c.target.value))};return l.jsx(B,{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(cx,{...c})]})},En=g.memo(PD),ID=me([Et,Er],(e,t)=>{const{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:o,model_list:s,saveIntermediatesInterval:c,enableImageDebugging:u}=e,{shouldUseCanvasBetaLayout:f,shouldUseSliders:p}=t;return{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:o,models:ee.map(s,(h,y)=>y),saveIntermediatesInterval:c,enableImageDebugging:u,shouldUseCanvasBetaLayout:f,shouldUseSliders:p}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Wd={flexDirection:"column",gap:2,p:4,bg:"base.900"},MD=({children:e})=>{const t=Y(),{t:n}=X(),r=A(P=>P.generation.steps),{isOpen:o,onOpen:s,onClose:c}=ho(),{isOpen:u,onOpen:f,onClose:p}=ho(),{shouldDisplayInProgressType:h,shouldConfirmOnDelete:y,shouldDisplayGuides:x,saveIntermediatesInterval:S,enableImageDebugging:C,shouldUseCanvasBetaLayout:k,shouldUseSliders:w}=A(ID),j=()=>{e3.purge().then(()=>{c(),f()})},I=P=>{P>r&&(P=r),P<1&&(P=1),t(t3(P))};return l.jsxs(l.Fragment,{children:[g.cloneElement(e,{onClick:s}),l.jsxs(po,{isOpen:o,onClose:c,size:"xl",children:[l.jsx(Br,{}),l.jsxs(mo,{paddingInlineEnd:4,children:[l.jsx(Lr,{children:n("common.settingsLabel")}),l.jsx(ia,{}),l.jsx(Hr,{children:l.jsxs(or,{gap:4,children:[l.jsxs(B,{sx:Wd,children:[l.jsx(Mn,{label:n("settings.displayInProgress"),validValues:YS,value:h,onChange:P=>t(KS(P.target.value))}),h==="full-res"&&l.jsx(Wr,{label:n("settings.saveSteps"),min:1,max:r,step:1,onChange:I,value:S,width:"auto",textAlign:"center"}),l.jsx(En,{label:n("settings.confirmOnDelete"),isChecked:y,onChange:P=>t(j1(P.target.checked))}),l.jsx(En,{label:n("settings.displayHelpIcons"),isChecked:x,onChange:P=>t(XS(P.target.checked))}),l.jsx(En,{label:n("settings.useCanvasBeta"),isChecked:k,onChange:P=>t(QS(P.target.checked))}),l.jsx(En,{label:n("settings.useSlidersForAll"),isChecked:w,onChange:P=>t(ZS(P.target.checked))})]}),l.jsxs(B,{sx:Wd,children:[l.jsx(Wn,{size:"sm",style:{fontWeight:"bold"},children:"Developer"}),l.jsx(En,{label:n("settings.enableImageDebugging"),isChecked:C,onChange:P=>t(JS(P.target.checked))})]}),l.jsxs(B,{sx:Wd,children:[l.jsx(Wn,{size:"sm",children:n("settings.resetWebUI")}),l.jsx(Je,{colorScheme:"error",onClick:j,children:n("settings.resetWebUI")}),l.jsx(Ce,{children:n("settings.resetWebUIDesc1")}),l.jsx(Ce,{children:n("settings.resetWebUIDesc2")})]})]})}),l.jsx(Fr,{children:l.jsx(Je,{onClick:c,children:n("common.close")})})]})]}),l.jsxs(po,{closeOnOverlayClick:!1,isOpen:u,onClose:p,isCentered:!0,children:[l.jsx(Br,{backdropFilter:"blur(40px)"}),l.jsxs(mo,{children:[l.jsx(Lr,{}),l.jsx(Hr,{children:l.jsx(B,{justifyContent:"center",children:l.jsx(Ce,{fontSize:"lg",children:l.jsx(Ce,{children:n("settings.resetComplete")})})})}),l.jsx(Fr,{})]})]})]})},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}=X();let p;e&&!s?p="ok":p="error";let h=o;t&&(p="working"),h&&t&&r>1&&(h=`${f(h)} (${n}/${r})`);const y=s&&!c?"Click to clear, check logs for details":void 0,x=s&&!c?"pointer":"initial",S=()=>{(s||!c)&&u(C1())};return l.jsx(Gt,{label:y,children:l.jsx(Ce,{cursor:x,onClick:S,sx:{fontSize:"xs",fontWeight:"600",color:`${p}.400`},children:f(h)})})},DD=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return l.jsxs(Vh,{isLazy:o,...s,children:[l.jsx(Wh,{children:t}),l.jsxs($h,{children:[r&&l.jsx(Uh,{}),n]})]})},rr=g.memo(DD);function AD(){const{t:e}=X(),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(n3(c))},s=()=>{const c=[];return Object.keys(r).forEach(u=>{c.push(l.jsx(Je,{isChecked:n===u,leftIcon:n===u?l.jsx(Ac,{}):void 0,size:"sm",onClick:()=>o(u),children:r[u]},u))}),c};return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{"aria-label":e("common.themeLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(z9,{})}),children:l.jsx(ze,{align:"stretch",children:s()})})}function OD(){const{t:e,i18n:t}=X(),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(Ac,{}):void 0,onClick:()=>t.changeLanguage(s),"aria-label":n[s],size:"sm",minWidth:"200px",children:n[s]},s))}),o};return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{"aria-label":e("common.languagePickerLabel"),tooltip:e("common.languagePickerLabel"),icon:l.jsx(D9,{}),size:"sm",variant:"link","data-variant":"link",fontSize:26}),children:l.jsx(ze,{children:r()})})}function zD(e){return ve({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 ve({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 ve({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 ve({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 ve({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 ve({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 B0(e){return ve({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 ve({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 ve({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 ve({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 ve({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 ve({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 ve({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 ve({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,E4=()=>{const e=A(t=>t.system.app_version);return l.jsxs(B,{alignItems:"center",gap:3,ps:1,children:[l.jsx(ls,{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})]})},P4=()=>{const{t:e}=X();return l.jsxs(or,{gridTemplateColumns:"auto max-content",children:[l.jsx(E4,{}),l.jsxs(B,{alignItems:"center",gap:2,children:[l.jsx(_D,{}),l.jsx(ED,{}),l.jsx(kD,{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(_9,{})})}),l.jsx(AD,{}),l.jsx(OD,{}),l.jsx(Go,{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(w9,{})})}),l.jsx(Go,{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(v9,{})})}),l.jsx(Go,{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(m9,{})})}),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,{})})})]})]})};P4.displayName="SiteHeader";const fp=e=>{const{children:t}=e;return l.jsx(B,{sx:{width:"100%",height:"100%",bg:"base.850"},children:t})};function YD(){const{t:e}=X();return l.jsx(fp,{children:l.jsxs(B,{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(ze,{maxW:"50rem",gap:4,children:l.jsx(Ce,{children:e("common.nodesDesc")})})]})})}const KD=()=>{const{t:e}=X();return l.jsx(fp,{children:l.jsxs(B,{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(ze,{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}=X();return l.jsx(fp,{children:l.jsxs(B,{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(ze,{maxW:"50rem",gap:4,children:[l.jsx(Ce,{children:e("common.trainingDesc1")}),l.jsx(Ce,{children:e("common.trainingDesc2")})]})]})})}const bs=me(e=>e.lightbox,e=>e,{memoizeOptions:{equalityCheck:ee.isEqual}}),Gr=e=>e.gallery,QD=me([Gr,Er,bs,bt],(e,t,n,r)=>{const{categories:o,currentCategory:s,currentImageUuid:c,galleryImageMinimumWidth:u,galleryImageObjectFit:f,shouldAutoSwitchToNewImages:p,galleryWidth:h,shouldUseSingleGalleryColumn:y}=e,{shouldPinGallery:x}=t,{isLightboxOpen:S}=n;return{currentImageUuid:c,shouldPinGallery:x,galleryImageMinimumWidth:u,galleryImageObjectFit:f,galleryGridTemplateColumns:y?"auto":`repeat(auto-fill, minmax(${u}px, auto))`,shouldAutoSwitchToNewImages:p,currentCategory:s,images:o[s].images,areMoreImagesAvailable:o[s].areMoreImagesAvailable,galleryWidth:h,shouldEnableResize:!(S||r==="unifiedCanvas"&&x),shouldUseSingleGalleryColumn:y}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),ZD=me([Gr,Et,bs,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(Gr,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}:{}}},zr="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 * ${zr} + ${r}) / -2)`;return n==="top"?{containerStyles:{borderBottomWidth:r,paddingBottom:zl},handleStyles:{top:{paddingTop:zr,paddingBottom:zr,bottom:o}}}:n==="left"?{containerStyles:{borderInlineEndWidth:r,paddingInlineEnd:zl},handleStyles:{right:{paddingInlineStart:zr,paddingInlineEnd:zr,insetInlineEnd:o}}}:n==="bottom"?{containerStyles:{borderTopWidth:r,paddingTop:zl},handleStyles:{bottom:{paddingTop:zr,paddingBottom:zr,top:o}}}:n==="right"?{containerStyles:{borderInlineStartWidth:r,paddingInlineStart:zl},handleStyles:{left:{paddingInlineStart:zr,paddingInlineEnd:zr,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",ro=(e,t)=>{if(e)return t?e+t:e},sA=re(Ox,{shouldForwardProp:e=>!["sx"].includes(e)}),I4=({direction:e="left",isResizable:t,isPinned:n,isOpen:r,onClose:o,children:s,initialWidth:c,minWidth:u,maxWidth:f,initialHeight:p,minHeight:h,maxHeight:y,onResizeStart:x,onResizeStop:S,onResize:C,sx:k={}})=>{const w=ea().direction,j=g.useRef(null),I=g.useMemo(()=>c??u??(["left","right"].includes(e)?500:"100%"),[c,u,e]),P=g.useMemo(()=>p??h??(["top","bottom"].includes(e)?500:"100%"),[p,h,e]),[M,T]=g.useState(I),[D,_]=g.useState(P);k6({ref:j,handler:()=>{n||o()}});const R=g.useMemo(()=>t?tA({direction:e,langDirection:w}):{},[t,w,e]),V=g.useMemo(()=>nA({direction:e,minWidth:t?ro(u,18):ro(u),maxWidth:t?ro(f,18):ro(f),minHeight:t?ro(h,18):ro(h),maxHeight:t?ro(y,18):ro(y)}),[u,f,h,y,e,t]),{containerStyles:F,handleStyles:L}=g.useMemo(()=>iA({isPinned:n,isResizable:t,direction:e}),[n,t,e]),Q=g.useMemo(()=>aA(e,w),[e,w]);return g.useEffect(()=>{["left","right"].includes(e)&&_(n?"100%":"100vh"),["top","bottom"].includes(e)&&T(n?"100%":"100vw")},[n,e]),l.jsx(y2,{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:j,sx:{width:"full",height:"full"},children:l.jsx(sA,{size:{width:t?M:I,height:t?D:P},enable:R,handleStyles:L,...V,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,...k},onResizeStart:(U,K,te)=>{x&&x(U,K,te)},onResize:(U,K,te,ne)=>{C&&C(U,K,te,ne)},onResizeStop:(U,K,te,ne)=>{["left","right"].includes(K)&&T(Number(M)+ne.width),["top","bottom"].includes(K)&&_(Number(D)+ne.height),S&&S(U,K,te,ne)},children:s})})})},H0={position:"absolute",width:"full",height:24,left:0,pointerEvents:"none",transition:"opacity 0.2s ease-in-out"},M4=({children:e})=>{const t=g.useRef(null),n=g.useRef(null),r=g.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 g.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:{...H0,bottom:0,boxShadow:"inset 0 -3.5rem 2rem -2rem var(--invokeai-colors-base-900)"}}),l.jsx(Ye,{ref:n,sx:{...H0,top:0,boxShadow:"inset 0 3.5rem 2rem -2rem var(--invokeai-colors-base-900)"}})]})},lA=ee.debounce(e=>{e(E1(!0))},300),cn=()=>(e,t)=>{bt(t())==="unifiedCanvas"&&lA(e)};function T4(e){return ve({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 _4(e){return ve({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 W0=e=>{const{sx:t}=e,n=Y(),r=A(c=>c.ui.shouldPinParametersPanel),{t:o}=X(),s=()=>{n(r3(!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(T4,{}):l.jsx(_4,{}),variant:"ghost",size:"sm",sx:{color:"base.700",_hover:{color:"base.550"},_active:{color:"base.500"},...t}})})},cA=me([Er,bt,bs],(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(o3()),n&&t(cn())},{enabled:()=>!s},[n,s]),de("esc",()=>{t(ql(!1))},{enabled:()=>!n,preventDefault:!0},[n]),de("shift+o",()=>{t(i3()),t(cn())},[]),l.jsx(I4,{direction:"left",isResizable:o||!n,isOpen:r,onClose:c,isPinned:n||s,sx:{borderColor:"base.700",p:n?0:4,bg:"base.900"},initialWidth:t0,minWidth:t0,children:l.jsxs(B,{flexDir:"column",position:"relative",h:"full",w:"full",children:[!n&&l.jsxs(B,{paddingTop:1.5,paddingBottom:4,justifyContent:"space-between",alignItems:"center",children:[l.jsx(E4,{}),l.jsx(W0,{})]}),l.jsx(M4,{children:e}),n&&l.jsx(W0,{sx:{position:"absolute",top:0,insetInlineEnd:0}})]})})},dA=g.memo(uA),fA=me([Er,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 p=f.dataTransfer.getData("invokeai/imageUuid"),h=c(p);h&&(s==="img2img"?o(ns(h)):s==="unifiedCanvas"&&o(xc(h)))};return l.jsxs(B,{...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=g.useContext(qh),r=()=>{n&&n()};return l.jsx(B,{sx:{width:"100%",height:"100%",alignItems:"center",justifyContent:"center"},className:t,children:l.jsxs(B,{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:Oc,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}=X(),r=o=>t(Nl(o.target.value));return l.jsx(Mn,{label:n("parameters.type"),validValues:a3.concat(),value:e,onChange:r})}function mA(){const e=A(o=>o.system.isGFPGANAvailable),t=A(o=>o.postprocessing.facetoolStrength),{t:n}=X(),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}=X(),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(Xd(o)),handleReset:()=>r(Xd(1)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}const pp=()=>{const e=A(t=>t.postprocessing.facetoolType);return l.jsxs(ze,{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}=X(),r=Y();return l.jsx(ut,{label:n("parameters.denoisingStrength"),value:t,min:0,max:1,step:.01,onChange:o=>{r(Qd(o))},handleReset:()=>r(Qd(.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}=X(),r=Y();return l.jsx(ut,{label:`${n("parameters.upscale")} ${n("parameters.strength")}`,value:t,min:0,max:1,step:.05,onChange:o=>r(Zd(o)),handleReset:()=>r(Zd(.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}=X(),r=Y(),o=s=>r(P1(Number(s.target.value)));return l.jsx(Mn,{isDisabled:!e,label:n("parameters.scale"),value:t,onChange:o,validValues:s3})}const mp=()=>l.jsxs(ze,{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}=ho(),c=Y(),{shouldConfirmOnDelete:u,isConnected:f,isProcessing:p}=A(bA),h=g.useRef(null),y=C=>{C.stopPropagation(),u?o():x()},x=()=>{f&&!p&&e&&c(l3(e)),s()};de("delete",()=>{u?o():x()},[e,u,f,p]);const S=C=>c(j1(!C.target.checked));return l.jsxs(l.Fragment,{children:[g.cloneElement(t,{onClick:e?y:void 0,ref:n}),l.jsx(Gy,{isOpen:r,leastDestructiveRef:h,onClose:s,children:l.jsx(Br,{children:l.jsxs(qy,{children:[l.jsx(Lr,{fontSize:"lg",fontWeight:"bold",children:"Delete image"}),l.jsx(Hr,{children:l.jsxs(B,{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(Fr,{children:[l.jsx(Je,{ref:h,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:I1(t),[r,o]=c3(n);e(M1(r)),e(T1(o))}},SA=me([Et,Gr,vp,Er,bs,bt],(e,t,n,r,o,s)=>{const{isProcessing:c,isConnected:u,isGFPGANAvailable:f,isESRGANAvailable:p}=e,{upscalingLevel:h,facetoolStrength:y}=n,{isLightboxOpen:x}=o,{shouldShowImageDetails:S}=r,{intermediateImage:C,currentImage:k}=t;return{isProcessing:c,isConnected:u,isGFPGANAvailable:f,isESRGANAvailable:p,upscalingLevel:h,facetoolStrength:y,shouldDisableToolbarButtons:Boolean(C)||!k,currentImage:k,shouldShowImageDetails:S,activeTabName:s,isLightboxOpen:x}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),D4=e=>{var L,Q,U,K,te,ne,$,Z;const t=Y(),{isProcessing:n,isConnected:r,isGFPGANAvailable:o,isESRGANAvailable:s,upscalingLevel:c,facetoolStrength:u,shouldDisableToolbarButtons:f,shouldShowImageDetails:p,currentImage:h,isLightboxOpen:y,activeTabName:x}=A(SA),S=ss(),{t:C}=X(),k=gp(),w=()=>{h&&(y&&t(Vo(!1)),t(ns(h)),t(jn("img2img")))},j=async()=>{if(!h)return;const oe=await fetch(h.url).then(Re=>Re.blob()),le=[new ClipboardItem({[oe.type]:oe})];await navigator.clipboard.write(le),S({title:C("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})},I=()=>{navigator.clipboard.writeText(h?window.location.toString()+h.url:"").then(()=>{S({title:C("toast.imageLinkCopied"),status:"success",duration:2500,isClosable:!0})})};de("shift+i",()=>{h?(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})},[h]);const P=()=>{var oe,le;h&&(h.metadata&&t(_1(h.metadata)),((oe=h.metadata)==null?void 0:oe.image.type)==="img2img"?t(jn("img2img")):((le=h.metadata)==null?void 0:le.image.type)==="txt2img"&&t(jn("txt2img")))};de("a",()=>{var oe,le;["txt2img","img2img"].includes((le=(oe=h==null?void 0:h.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})},[h]);const M=()=>{h!=null&&h.metadata&&t(os(h.metadata.image.seed))};de("s",()=>{var oe,le;(le=(oe=h==null?void 0:h.metadata)==null?void 0:oe.image)!=null&&le.seed?(M(),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})},[h]);const T=g.useCallback(()=>{var oe,le,Re,Ne;(le=(oe=h==null?void 0:h.metadata)==null?void 0:oe.image)!=null&&le.prompt&&k((Ne=(Re=h==null?void 0:h.metadata)==null?void 0:Re.image)==null?void 0:Ne.prompt)},[(Q=(L=h==null?void 0:h.metadata)==null?void 0:L.image)==null?void 0:Q.prompt,k]);de("p",()=>{var oe,le;(le=(oe=h==null?void 0:h.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})},[h]);const D=()=>{h&&t(u3(h))};de("Shift+U",()=>{s&&!f&&r&&!n&&c?D():S({title:C("toast.upscalingFailed"),status:"error",duration:2500,isClosable:!0})},[h,s,f,r,n,c]);const _=()=>{h&&t(d3(h))};de("Shift+R",()=>{o&&!f&&r&&!n&&u?_():S({title:C("toast.faceRestoreFailed"),status:"error",duration:2500,isClosable:!0})},[h,o,f,r,n,u]);const R=()=>t(D1(!p)),V=()=>{h&&(y&&t(Vo(!1)),t(xc(h)),t(cn()),x!=="unifiedCanvas"&&t(jn("unifiedCanvas")),S({title:C("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0}))};de("i",()=>{h?R():S({title:C("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[h,p]);const F=()=>{t(Vo(!y))};return l.jsxs(B,{sx:{justifyContent:"center",alignItems:"center",columnGap:"0.5em"},...e,children:[l.jsxs(Qt,{isAttached:!0,children:[l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{"aria-label":`${C("parameters.sendTo")}...`,icon:l.jsx(W9,{})}),children:l.jsxs(B,{sx:{flexDirection:"column",rowGap:2},children:[l.jsx(Je,{size:"sm",onClick:w,leftIcon:l.jsx(e0,{}),children:C("parameters.sendToImg2Img")}),l.jsx(Je,{size:"sm",onClick:V,leftIcon:l.jsx(e0,{}),children:C("parameters.sendToUnifiedCanvas")}),l.jsx(Je,{size:"sm",onClick:j,leftIcon:l.jsx(Ki,{}),children:C("parameters.copyImage")}),l.jsx(Je,{size:"sm",onClick:I,leftIcon:l.jsx(Ki,{}),children:C("parameters.copyImageToLink")}),l.jsx(Go,{download:!0,href:h==null?void 0:h.url,children:l.jsx(Je,{leftIcon:l.jsx(Xh,{}),size:"sm",w:"100%",children:C("parameters.downloadImage")})})]})}),l.jsx(se,{icon:l.jsx(E9,{}),tooltip:y?`${C("parameters.closeViewer")} (Z)`:`${C("parameters.openInViewer")} (Z)`,"aria-label":y?`${C("parameters.closeViewer")} (Z)`:`${C("parameters.openInViewer")} (Z)`,isChecked:y,onClick:F})]}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{icon:l.jsx(N9,{}),tooltip:`${C("parameters.usePrompt")} (P)`,"aria-label":`${C("parameters.usePrompt")} (P)`,isDisabled:!((K=(U=h==null?void 0:h.metadata)==null?void 0:U.image)!=null&&K.prompt),onClick:T}),l.jsx(se,{icon:l.jsx(H9,{}),tooltip:`${C("parameters.useSeed")} (S)`,"aria-label":`${C("parameters.useSeed")} (S)`,isDisabled:!((ne=(te=h==null?void 0:h.metadata)==null?void 0:te.image)!=null&&ne.seed),onClick:M}),l.jsx(se,{icon:l.jsx(C9,{}),tooltip:`${C("parameters.useAll")} (A)`,"aria-label":`${C("parameters.useAll")} (A)`,isDisabled:!["txt2img","img2img"].includes((Z=($=h==null?void 0:h.metadata)==null?void 0:$.image)==null?void 0:Z.type),onClick:P})]}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{icon:l.jsx(M9,{}),"aria-label":C("parameters.restoreFaces")}),children:l.jsxs(B,{sx:{flexDirection:"column",rowGap:4},children:[l.jsx(pp,{}),l.jsx(Je,{isDisabled:!o||!h||!(r&&!n)||!u,onClick:_,children:C("parameters.restoreFaces")})]})}),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{icon:l.jsx(j9,{}),"aria-label":C("parameters.upscale")}),children:l.jsxs(B,{sx:{flexDirection:"column",gap:4},children:[l.jsx(mp,{}),l.jsx(Je,{isDisabled:!s||!h||!(r&&!n)||!c,onClick:D,children:C("parameters.upscaleImage")})]})})]}),l.jsx(Qt,{isAttached:!0,children:l.jsx(se,{icon:l.jsx(Fx,{}),tooltip:`${C("parameters.info")} (I)`,"aria-label":`${C("parameters.info")} (I)`,isChecked:p,onClick:R})}),l.jsx(hc,{image:h,children:l.jsx(se,{icon:l.jsx(ri,{}),tooltip:`${C("parameters.deleteImage")} (Del)`,"aria-label":`${C("parameters.deleteImage")} (Del)`,isDisabled:!h||!r||n,colorScheme:"error"})})]})};function CA(e){return ve({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}=X();return l.jsxs(B,{gap:2,children:[n&&l.jsx(Gt,{label:`Recall ${e}`,children:l.jsx(fo,{"aria-label":c("accessibility.useThisParameter"),icon:l.jsx(CA,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&l.jsx(Gt,{label:`Copy ${e}`,children:l.jsx(fo,{"aria-label":`Copy ${e}`,icon:l.jsx(Ki,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),l.jsxs(B,{direction:o?"column":"row",children:[l.jsxs(Ce,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?l.jsxs(Go,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",l.jsx(j4,{mx:"2px"})]}):l.jsx(Ce,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]})},wA=(e,t)=>e.image.uuid===t.image.uuid,yp=g.memo(({image:e})=>{var F,L;const t=Y(),n=gp();de("esc",()=>{t(D1(!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:p,mask_image_path:h,orig_path:y,perlin:x,postprocessing:S,prompt:C,sampler:k,seamless:w,seed:j,steps:I,strength:P,threshold:M,type:T,variations:D,width:_}=r,{t:R}=X(),V=JSON.stringify(e.metadata,null,2);return l.jsxs(B,{sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",backdropFilter:"blur(20px)",bg:"whiteAlpha.600",_dark:{bg:"blackAlpha.600"}},children:[l.jsxs(B,{gap:2,children:[l.jsx(Ce,{fontWeight:"semibold",children:"File:"}),l.jsxs(Go,{href:e.url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.url.length>64?e.url.substring(0,64).concat("..."):e.url,l.jsx(j4,{mx:"2px"})]})]}),Object.keys(r).length>0?l.jsxs(l.Fragment,{children:[T&&l.jsx(yt,{label:"Generation type",value:T}),((L=e.metadata)==null?void 0:L.model_weights)&&l.jsx(yt,{label:"Model",value:e.metadata.model_weights}),["esrgan","gfpgan"].includes(T)&&l.jsx(yt,{label:"Original image",value:y}),C&&l.jsx(yt,{label:"Prompt",labelPosition:"top",value:typeof C=="string"?C:I1(C),onClick:()=>n(C)}),j!==void 0&&l.jsx(yt,{label:"Seed",value:j,onClick:()=>t(os(j))}),M!==void 0&&l.jsx(yt,{label:"Noise Threshold",value:M,onClick:()=>t(Jd(M))}),x!==void 0&&l.jsx(yt,{label:"Perlin Noise",value:x,onClick:()=>t(ef(x))}),k&&l.jsx(yt,{label:"Sampler",value:k,onClick:()=>t(A1(k))}),I&&l.jsx(yt,{label:"Steps",value:I,onClick:()=>t(tf(I))}),s!==void 0&&l.jsx(yt,{label:"CFG scale",value:s,onClick:()=>t(nf(s))}),D&&D.length>0&&l.jsx(yt,{label:"Seed-weight pairs",value:Mv(D),onClick:()=>t(O1(Mv(D)))}),w&&l.jsx(yt,{label:"Seamless",value:w,onClick:()=>t(z1(w))}),f&&l.jsx(yt,{label:"High Resolution Optimization",value:f,onClick:()=>t(R1(f))}),_&&l.jsx(yt,{label:"Width",value:_,onClick:()=>t(Fl(_))}),u&&l.jsx(yt,{label:"Height",value:u,onClick:()=>t(Ll(u))}),p&&l.jsx(yt,{label:"Initial image",value:p,isLink:!0,onClick:()=>t(ns(p))}),h&&l.jsx(yt,{label:"Mask image",value:h,isLink:!0,onClick:()=>t(f3(h))}),T==="img2img"&&P&&l.jsx(yt,{label:"Image to image strength",value:P,onClick:()=>t(rf(P))}),c&&l.jsx(yt,{label:"Image to image fit",value:c,onClick:()=>t(N1(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:K,strength:te,denoise_str:ne}=Q;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${U+1}: Upscale (ESRGAN)`}),l.jsx(yt,{label:"Scale",value:K,onClick:()=>t(P1(K))}),l.jsx(yt,{label:"Strength",value:te,onClick:()=>t(Zd(te))}),ne!==void 0&&l.jsx(yt,{label:"Denoising strength",value:ne,onClick:()=>t(Qd(ne))})]},U)}else if(Q.type==="gfpgan"){const{strength:K}=Q;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${U+1}: Face restoration (GFPGAN)`}),l.jsx(yt,{label:"Strength",value:K,onClick:()=>{t(Yl(K)),t(Nl("gfpgan"))}})]},U)}else if(Q.type==="codeformer"){const{strength:K,fidelity:te}=Q;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${U+1}: Face restoration (Codeformer)`}),l.jsx(yt,{label:"Strength",value:K,onClick:()=>{t(Yl(K)),t(Nl("codeformer"))}}),te&&l.jsx(yt,{label:"Fidelity",value:te,onClick:()=>{t(Xd(te)),t(Nl("codeformer"))}})]},U)}})]}),o&&l.jsx(yt,{withCopy:!0,label:"Dream Prompt",value:o}),l.jsxs(B,{gap:2,direction:"column",children:[l.jsxs(B,{gap:2,children:[l.jsx(Gt,{label:"Copy metadata JSON",children:l.jsx(fo,{"aria-label":R("accessibility.copyMetadataJson"),icon:l.jsx(Ki,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(V)})}),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:V})})]})]}):l.jsx(xy,{width:"100%",pt:10,children:l.jsx(Ce,{fontSize:"lg",fontWeight:"semibold",children:"No metadata available"})})]})},wA);yp.displayName="ImageMetadataViewer";const V0={height:"100%",width:"15%",alignItems:"center",pointerEvents:"auto"},U0={color:"base.100"},kA=me(Gr,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}}),A4=()=>{const e=Y(),{t}=X(),{isOnFirstImage:n,isOnLastImage:r}=A(kA),[o,s]=g.useState(!1),c=()=>{s(!0)},u=()=>{s(!1)},f=()=>{e(F1())},p=()=>{e(L1())};return l.jsxs(B,{sx:{justifyContent:"space-between",zIndex:1,height:"100%",width:"100%",pointerEvents:"none"},children:[l.jsx(or,{sx:{...V0,justifyContent:"flex-start"},onMouseOver:c,onMouseOut:u,children:o&&!n&&l.jsx(fo,{"aria-label":t("accessibility.previousImage"),icon:l.jsx(y9,{size:64}),variant:"unstyled",onClick:f,boxSize:16,sx:U0})}),l.jsx(or,{sx:{...V0,justifyContent:"flex-end"},onMouseOver:c,onMouseOut:u,children:o&&!r&&l.jsx(fo,{"aria-label":t("accessibility.nextImage"),icon:l.jsx(x9,{size:64}),variant:"unstyled",onClick:p,boxSize:16,sx:U0})})]})},jA=me([Gr,Er],(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 EA(){const{shouldShowImageDetails:e,imageToDisplay:t,isIntermediate:n}=A(jA);return l.jsxs(B,{sx:{position:"relative",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:[t&&l.jsx(ls,{src:t.url,width:t.width,height:t.height,sx:{objectFit:"contain",maxWidth:"100%",maxHeight:"100%",height:"auto",position:"absolute",imageRendering:n?"pixelated":"initial",borderRadius:"base"}}),!e&&l.jsx(A4,{}),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 PA=me([Gr],e=>{const{currentImage:t,intermediateImage:n}=e;return{hasAnImageToDisplay:t||n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),O4=()=>{const{hasAnImageToDisplay:e}=A(PA);return l.jsx(B,{sx:{flexDirection:"column",height:"100%",width:"100%",rowGap:4,borderRadius:"base"},children:e?l.jsxs(l.Fragment,{children:[l.jsx(D4,{}),l.jsx(EA,{})]}):l.jsx(B,{sx:{alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:l.jsx(tn,{as:VD,sx:{boxSize:24,color:"base.500"}})})})},IA=()=>{const{t:e}=X(),t=g.useContext(qh);return l.jsx(se,{"aria-label":e("accessibility.uploadImage"),tooltip:"Upload Image",icon:l.jsx(Oc,{}),onClick:t||void 0})};function MA(){const e=A(s=>s.generation.initialImage),{t}=X(),n=Y(),r=ss(),o=()=>{r({title:t("toast.parametersFailed"),description:t("toast.parametersFailedDesc"),status:"error",isClosable:!0}),n(h3())};return l.jsxs(l.Fragment,{children:[l.jsxs(B,{sx:{alignItems:"center",justifyContent:"center",w:"100%",gap:4},children:[l.jsx(Ce,{sx:{fontSize:"lg"},variant:"subtext",children:t("parameters.initialImage")}),l.jsx(IA,{})]}),e&&l.jsx(B,{sx:{position:"relative",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:l.jsx(ls,{sx:{fit:"contain",maxWidth:"100%",maxHeight:"100%",borderRadius:"base",objectFit:"contain",position:"absolute"},src:typeof e=="string"?e:e.url,onError:o})})]})}const $0={flexDirection:"column",height:"100%",width:"100%",gap:4,padding:4},TA=()=>{const t=A(n=>n.generation.initialImage)?l.jsx(B,{flexDirection:"column",gap:4,w:"100%",h:"100%",children:l.jsx(MA,{})}):l.jsx(hA,{});return l.jsxs(or,{sx:{w:"100%",h:"100%",gridTemplateColumns:"1fr 1fr",borderRadius:"base",bg:"base.850"},children:[l.jsx(B,{sx:{...$0,paddingInlineEnd:2},children:t}),l.jsx(B,{sx:{...$0,paddingInlineStart:2},children:l.jsx(O4,{})})]})};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 _A=()=>{const{t:e}=X();return g.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])},DA=e=>_A()[e];function z4(){const e=A(o=>o.system.isGFPGANAvailable),t=A(o=>o.postprocessing.shouldRunFacetool),n=Y(),r=o=>n(p3(o.target.checked));return l.jsx(En,{isDisabled:!e,isChecked:t,onChange:r})}const R4=()=>{const e=Y(),t=A(o=>o.generation.seamless),n=o=>e(z1(o.target.checked)),{t:r}=X();return l.jsx(En,{label:r("parameters.seamlessTiling"),fontSize:"md",isChecked:t,onChange:n})},AA=()=>l.jsx(ze,{gap:2,alignItems:"stretch",children:l.jsx(R4,{})});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}=X();return l.jsxs(ze,{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(m3(n.target.checked))})}function OA(){const e=Y(),t=A(r=>r.generation.perlin),{t:n}=X();return l.jsx(ut,{label:n("parameters.perlinNoise"),min:0,max:1,step:.05,onChange:r=>e(ef(r)),handleReset:()=>e(ef(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}function zA(){const e=Y(),{t}=X(),n=A(o=>o.generation.shouldRandomizeSeed),r=o=>e(v3(o.target.checked));return l.jsx(En,{label:t("parameters.randomizeSeed"),isChecked:n,onChange:r})}function RA(){const e=Y(),t=A(o=>o.generation.shouldRandomizeSeed),{t:n}=X(),r=()=>e(os(g3(H1,B1)));return l.jsx(ti,{size:"sm",isDisabled:t,onClick:r,padding:"0 1.5rem",children:l.jsx("p",{children:n("parameters.shuffle")})})}function NA(){const e=A(c=>c.generation.seed),t=A(c=>c.generation.shouldRandomizeSeed),n=A(c=>c.generation.shouldGenerateVariations),{t:r}=X(),o=Y(),s=c=>o(os(c));return l.jsxs(ra,{gap:2,children:[l.jsx(Wr,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:H1,max:B1,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e,formControlProps:{display:"flex",alignItems:"center",gap:3}}),l.jsx(RA,{})]})}function FA(){const e=Y(),t=A(r=>r.generation.threshold),{t:n}=X();return l.jsx(ut,{label:n("parameters.noiseThreshold"),min:0,max:20,step:.1,onChange:r=>e(Jd(r)),handleReset:()=>e(Jd(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}const Sp=()=>l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(zA,{}),l.jsx(NA,{}),l.jsx(FA,{}),l.jsx(OA,{})]});function N4(){const e=A(o=>o.system.isESRGANAvailable),t=A(o=>o.postprocessing.shouldRunESRGAN),n=Y(),r=o=>n(y3(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(x3(r.target.checked));return l.jsx(En,{isChecked:e,width:"auto",onChange:n})}function LA(){const e=A(s=>s.generation.seedWeights),t=A(s=>s.generation.shouldGenerateVariations),{t:n}=X(),r=Y(),o=s=>r(O1(s.target.value));return l.jsx(mt,{label:n("parameters.seedWeights"),value:e,isInvalid:t&&!(W1(e)||e===""),isDisabled:!t,onChange:o})}function BA(){const e=A(o=>o.generation.variationAmount),t=A(o=>o.generation.shouldGenerateVariations),{t:n}=X(),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(ze,{gap:2,alignItems:"stretch",children:[l.jsx(BA,{}),l.jsx(LA,{})]});function G0(){const e=Y(),t=A(s=>s.generation.cfgScale),n=A(s=>s.ui.shouldUseSliders),{t:r}=X(),o=s=>e(nf(s));return n?l.jsx(ut,{label:r("parameters.cfgScale"),step:.5,min:1.01,max:30,onChange:o,handleReset:()=>e(nf(7.5)),value:t,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0}):l.jsx(Wr,{label:r("parameters.cfgScale"),step:.5,min:1.01,max:200,onChange:o,value:t,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})}function q0(){const e=A(s=>s.generation.height),t=A(s=>s.ui.shouldUseSliders),n=A(bt),r=Y(),{t:o}=X();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:b3})}function Y0(){const e=A(s=>s.generation.iterations),t=A(s=>s.ui.shouldUseSliders),n=Y(),{t:r}=X(),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(Wr,{label:r("parameters.images"),step:1,min:1,max:9999,onChange:o,value:e,numberInputFieldProps:{textAlign:"center"}})}function K0(){const e=A(s=>s.generation.sampler),t=A($x),n=Y(),{t:r}=X(),o=s=>n(A1(s.target.value));return l.jsx(Mn,{label:r("parameters.sampler"),value:e,onChange:o,validValues:t.format==="diffusers"?S3:C3,minWidth:36})}function X0(){const e=Y(),t=A(c=>c.generation.steps),n=A(c=>c.ui.shouldUseSliders),{t:r}=X(),o=c=>{e(tf(c))},s=()=>{e(V1())};return n?l.jsx(ut,{label:r("parameters.steps"),min:1,step:1,onChange:o,handleReset:()=>e(tf(20)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:9999}}):l.jsx(Wr,{label:r("parameters.steps"),min:1,max:9999,step:1,onChange:o,value:t,numberInputFieldProps:{textAlign:"center"},onBlur:s})}function Q0(){const e=A(s=>s.generation.width),t=A(s=>s.ui.shouldUseSliders),n=A(bt),{t:r}=X(),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:w3})}function kp(){return A(t=>t.ui.shouldUseSliders)?l.jsxs(ze,{gap:2,children:[l.jsx(Y0,{}),l.jsx(X0,{}),l.jsx(G0,{}),l.jsx(Q0,{}),l.jsx(q0,{}),l.jsx(K0,{})]}):l.jsxs(B,{rowGap:2,flexDirection:"column",children:[l.jsxs(B,{columnGap:1,children:[l.jsx(Y0,{}),l.jsx(X0,{}),l.jsx(G0,{})]}),l.jsxs(B,{columnGap:1,children:[l.jsx(Q0,{}),l.jsx(q0,{}),l.jsx(K0,{})]})]})}const HA=me(Et,e=>e.shouldDisplayGuides),WA=({children:e,feature:t})=>{const n=A(HA),{text:r}=DA(t);return n?l.jsxs(Vh,{trigger:"hover",isLazy:!0,children:[l.jsx(Wh,{children:l.jsx(Ye,{children:e})}),l.jsxs($h,{maxWidth:"400px",onClick:o=>o.preventDefault(),cursor:"initial",children:[l.jsx(Uh,{}),l.jsx(Ky,{children:r})]})]}):null},VA=g.memo(WA),UA=fe(({feature:e,icon:t=RD},n)=>l.jsx(VA,{feature:e,children:l.jsx(Ye,{ref:n,children:l.jsx(tn,{marginBottom:"-.15rem",as:t})})})),$A=g.memo(UA);function GA(e){const{header:t,feature:n,content:r,additionalHeaderComponents:o}=e;return l.jsxs(Oi,{children:[l.jsx(Di,{children:l.jsxs(B,{width:"100%",gap:2,align:"center",children:[l.jsx(Ye,{flexGrow:1,textAlign:"start",children:t}),o,n&&l.jsx($A,{feature:n}),l.jsx(Ai,{})]})}),l.jsx(zi,{children:r})]})}const jp=e=>{const{accordionInfo:t}=e,n=A(c=>c.system.openAccordions),r=Y(),o=c=>r(k3(c)),s=()=>{const c=[];return t&&Object.keys(t).forEach(u=>{const{header:f,feature:p,content:h,additionalHeaderComponents:y}=t[u];c.push(l.jsx(GA,{header:f,feature:p,content:h,additionalHeaderComponents:y},u))}),c};return l.jsx(oh,{defaultIndex:n,allowMultiple:!0,reduceMotion:!0,onChange:o,sx:{display:"flex",flexDirection:"column",gap:2},children:s()})},qA=e=>{const{menuType:t="icon",iconTooltip:n,buttonText:r,isLazy:o=!0,menuItems:s,menuProps:c,menuButtonProps:u,menuListProps:f,menuItemProps:p}=e,h=()=>{const y=[];return s.forEach((x,S)=>{y.push(l.jsx(vr,{onClick:x.onClick,fontSize:"sm",...p,children:x.item},S))}),y};return l.jsx(Dh,{...c,isLazy:o,children:({isOpen:y})=>l.jsxs(l.Fragment,{children:[l.jsx(Oh,{as:t==="icon"?fo:ti,tooltip:n,"aria-label":n,icon:y?l.jsx($D,{}):l.jsx(UD,{}),paddingX:0,paddingY:t==="regular"?2:0,...u,children:t==="regular"&&r}),l.jsx(Ah,{zIndex:15,padding:0,...f,children:h()})]})})},YA=g.memo(qA),KA=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}}),XA=e=>{const t=Y(),{btnGroupWidth:n="auto",...r}=e,{isProcessing:o,isConnected:s,isCancelable:c,currentIteration:u,totalIterations:f,cancelType:p,cancelAfter:h}=A(KA),y=g.useCallback(()=>{t(j3()),t(ud(null))},[t]),{t:x}=X(),S=h!==null;de("shift+x",()=>{(s||o)&&c&&y()},[s,o,c]),g.useEffect(()=>{h!==null&&ht(Ov("immediate"))},{item:x("parameters.cancel.schedule"),onClick:()=>t(Ov("scheduled"))}];return l.jsxs(Qt,{isAttached:!0,width:n,children:[p==="immediate"?l.jsx(se,{icon:l.jsx(GD,{}),tooltip:x("parameters.cancel.immediate"),"aria-label":x("parameters.cancel.immediate"),isDisabled:!s||!o||!c,onClick:y,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?ud(null):ud(u))},colorScheme:"error",...r}),l.jsx(YA,{menuItems:C,iconTooltip:x("parameters.cancel.setType"),menuButtonProps:{colorScheme:"error",minWidth:5}})]})},Ep=g.memo(XA),tt=e=>e.canvas,Ot=me([tt,bt,Et],(e,t,n)=>e.layerState.stagingArea.images.length>0||t==="unifiedCanvas"&&n.isProcessing),F4=e=>e.canvas.layerState.objects.find(U1),Pp=e=>e.generation;me(Pp,({shouldRandomizeSeed:e,shouldGenerateVariations:t})=>e||t,{memoizeOptions:{resultEqualityCheck:ee.isEqual}});const L4=me([Pp,Et,F4,bt],(e,t,n,r)=>{const{prompt:o,shouldGenerateVariations:s,seedWeights:c,initialImage:u,seed:f}=e,{isProcessing:p,isConnected:h}=t;let y=!0;const x=[];return(!o||Boolean(o.match(/^[\s\r\n]+$/)))&&(y=!1,x.push("Missing prompt")),r==="img2img"&&!u&&(y=!1,x.push("No initial image selected")),p&&(y=!1,x.push("System Busy")),h||(y=!1,x.push("System Disconnected")),s&&(!(W1(c)||c==="")||f===-1)&&(y=!1,x.push("Seed-Weights badly formatted.")),{isReady:y,reasonsWhyNotReady:x}},{memoizeOptions:{equalityCheck:ee.isEqual,resultEqualityCheck:ee.isEqual}});function Ip(e){const{iconButton:t=!1,...n}=e,r=Y(),{isReady:o}=A(L4),s=A(bt),c=()=>{r(of(s))},{t:u}=X();return de(["ctrl+enter","meta+enter"],()=>{r(V1()),r(of(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(R9,{}),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 QA=me(vp,({shouldLoopback:e})=>e),ZA=()=>{const e=Y(),t=A(QA),{t:n}=X();return l.jsx(se,{"aria-label":n("parameters.toggleLoopback"),tooltip:n("parameters.toggleLoopback"),isChecked:t,icon:l.jsx(F9,{}),onClick:()=>{e(E3(!t))}})},Mp=()=>{const e=A(bt);return l.jsxs(B,{gap:2,children:[l.jsx(Ip,{}),e==="img2img"&&l.jsx(ZA,{}),l.jsx(Ep,{})]})},Tp=()=>{const e=A(r=>r.generation.negativePrompt),t=Y(),{t:n}=X();return l.jsx(rt,{children:l.jsx(Gh,{id:"negativePrompt",name:"negativePrompt",value:e,onChange:r=>t(T1(r.target.value)),placeholder:n("parameters.negativePrompts"),_focusVisible:{borderColor:"error.600"},fontSize:"sm"})})},JA=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(JA),{isReady:r}=A(L4),o=g.useRef(null),{t:s}=X(),c=f=>{e(M1(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(of(n)))};return l.jsx(Ye,{children:l.jsx(rt,{isInvalid:t.length===0||Boolean(t.match(/^[\s\r\n]+$/)),children:l.jsx(Gh,{id:"prompt",name:"prompt",placeholder:s("parameters.promptPlaceholder"),value:t,onChange:c,onKeyDown:u,resize:"vertical",ref:o,minH:40})})})};function eO(){const e=Y(),t=A(o=>o.generation.shouldFitToWidthHeight),n=o=>e(N1(o.target.checked)),{t:r}=X();return l.jsx(En,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function B4(e){const{t}=X(),{label:n=`${t("parameters.strength")}`}=e,r=A(u=>u.generation.img2imgStrength),o=Y(),s=u=>o(rf(u)),c=()=>{o(rf(.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 tO(){const{t:e}=X();return l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(B4,{label:e("parameters.img2imgStrength")}),l.jsx(eO,{})]})}const nO=()=>{const{t:e}=X(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(kp,{})},imageToImage:{header:`${e("parameters.imageToImage")}`,feature:void 0,content:l.jsx(tO,{})},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(z4,{})},upscale:{header:`${e("parameters.upscaling")}`,feature:ln.UPSCALE,content:l.jsx(mp,{}),additionalHeaderComponents:l.jsx(N4,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(xp,{}),additionalHeaderComponents:l.jsx(bp,{})},other:{header:`${e("parameters.otherOptions")}`,feature:ln.OTHER,content:l.jsx(AA,{})}};return l.jsxs(B,{flexDir:"column",gap:2,position:"relative",children:[l.jsx(_p,{}),l.jsx(Tp,{}),l.jsx(Mp,{}),l.jsx(jp,{accordionInfo:t})]})},rO=g.memo(nO);function oO(){return l.jsx(hp,{parametersPanelContent:l.jsx(rO,{}),children:l.jsx(TA,{})})}const iO=()=>l.jsx(Ye,{sx:{width:"100%",height:"100%",borderRadius:"base",bg:"base.850"},children:l.jsx(B,{sx:{p:4,width:"100%",height:"100%"},children:l.jsx(O4,{})})}),aO=me([vp],({hiresFix:e,hiresStrength:t})=>({hiresFix:e,hiresStrength:t}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),sO=()=>{const{hiresFix:e,hiresStrength:t}=A(aO),n=Y(),{t:r}=X(),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})},lO=()=>{const e=Y(),t=A(o=>o.postprocessing.hiresFix),{t:n}=X(),r=o=>e(R1(o.target.checked));return l.jsx(En,{label:n("parameters.hiresOptim"),fontSize:"md",isChecked:t,onChange:r})},cO=()=>l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(R4,{}),l.jsx(lO,{}),l.jsx(sO,{})]}),uO=()=>{const{t:e}=X(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(kp,{})},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(z4,{})},upscale:{header:`${e("parameters.upscaling")}`,feature:ln.UPSCALE,content:l.jsx(mp,{}),additionalHeaderComponents:l.jsx(N4,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(xp,{}),additionalHeaderComponents:l.jsx(bp,{})},other:{header:`${e("parameters.otherOptions")}`,feature:ln.OTHER,content:l.jsx(cO,{})}};return l.jsxs(B,{flexDir:"column",gap:2,children:[l.jsx(_p,{}),l.jsx(Tp,{}),l.jsx(Mp,{}),l.jsx(jp,{accordionInfo:t})]})},dO=g.memo(uO);function fO(){return l.jsx(hp,{parametersPanelContent:l.jsx(dO,{}),children:l.jsx(iO,{})})}var Vf={},hO={get exports(){return Vf},set exports(e){Vf=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 pO=function(t){var n={},r=g,o=Bl,s=Object.assign;function c(i){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+i,d=1;dO||v[E]!==b[O]){var W=` `+v[E].replace(" at new "," at ");return i.displayName&&W.includes("")&&(W=W.replace("",i.displayName)),W}while(1<=E&&0<=O);break}}}finally{Zc=!1,Error.prepareStackTrace=d}return(i=i?i.displayName||i.name:"")?ca(i):""}var Vb=Object.prototype.hasOwnProperty,eu=[],ci=-1;function qr(i){return{current:i}}function St(i){0>ci||(i.current=eu[ci],eu[ci]=null,ci--)}function gt(i,a){ci++,eu[ci]=i.current,i.current=a}var Yr={},nn=qr(Yr),yn=qr(!1),jo=Yr;function ui(i,a){var d=i.type.contextTypes;if(!d)return Yr;var m=i.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===a)return m.__reactInternalMemoizedMaskedChildContext;var v={},b;for(b in d)v[b]=a[b];return m&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=a,i.__reactInternalMemoizedMaskedChildContext=v),v}function xn(i){return i=i.childContextTypes,i!=null}function ws(){St(yn),St(nn)}function Up(i,a,d){if(nn.current!==Yr)throw Error(c(168));gt(nn,a),gt(yn,d)}function $p(i,a,d){var m=i.stateNode;if(a=a.childContextTypes,typeof m.getChildContext!="function")return d;m=m.getChildContext();for(var v in m)if(!(v in a))throw Error(c(108,R(i)||"Unknown",v));return s({},d,m)}function ks(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Yr,jo=nn.current,gt(nn,i),gt(yn,yn.current),!0}function Gp(i,a,d){var m=i.stateNode;if(!m)throw Error(c(169));d?(i=$p(i,a,jo),m.__reactInternalMemoizedMergedChildContext=i,St(yn),St(nn),gt(nn,i)):St(yn),gt(yn,d)}var qn=Math.clz32?Math.clz32:Gb,Ub=Math.log,$b=Math.LN2;function Gb(i){return i>>>=0,i===0?32:31-(Ub(i)/$b|0)|0}var js=64,Es=4194304;function ua(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 Ps(i,a){var d=i.pendingLanes;if(d===0)return 0;var m=0,v=i.suspendedLanes,b=i.pingedLanes,E=d&268435455;if(E!==0){var O=E&~v;O!==0?m=ua(O):(b&=E,b!==0&&(m=ua(b)))}else E=d&~v,E!==0?m=ua(E):b!==0&&(m=ua(b));if(m===0)return 0;if(a!==0&&a!==m&&!(a&v)&&(v=m&-m,b=a&-a,v>=b||v===16&&(b&4194240)!==0))return a;if(m&4&&(m|=d&16),a=i.entangledLanes,a!==0)for(i=i.entanglements,a&=m;0d;d++)a.push(i);return a}function da(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 Kb(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 m=i.eventTimes;for(i=i.expirationTimes;0>=E,v-=E,Mr=1<<32-qn(a)+v|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),z=b(at,z,it),Ke===null?De=at:Ke.sibling=at,Ke=at,We=Xt}if(it===G.length)return d(H,We),Pt&&Po(H,it),De;if(We===null){for(;itit?(Xt=We,We=null):Xt=We.sibling;var no=be(H,We,at.value,Se);if(no===null){We===null&&(We=Xt);break}i&&We&&no.alternate===null&&a(H,We),z=b(no,z,it),Ke===null?De=no:Ke.sibling=no,Ke=no,We=Xt}if(at.done)return d(H,We),Pt&&Po(H,it),De;if(We===null){for(;!at.done;it++,at=G.next())at=He(H,at.value,Se),at!==null&&(z=b(at,z,it),Ke===null?De=at:Ke.sibling=at,Ke=at);return Pt&&Po(H,it),De}for(We=m(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),z=b(at,z,it),Ke===null?De=at:Ke.sibling=at,Ke=at);return i&&We.forEach(function(OS){return a(H,OS)}),Pt&&Po(H,it),De}function Or(H,z,G,Se){if(typeof G=="object"&&G!==null&&G.type===h&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case f:e:{for(var De=G.key,Ke=z;Ke!==null;){if(Ke.key===De){if(De=G.type,De===h){if(Ke.tag===7){d(H,Ke.sibling),z=v(Ke,G.props.children),z.return=H,H=z;break e}}else if(Ke.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===P&&dm(De)===Ke.type){d(H,Ke.sibling),z=v(Ke,G.props),z.ref=ha(H,Ke,G),z.return=H,H=z;break e}d(H,Ke);break}else a(H,Ke);Ke=Ke.sibling}G.type===h?(z=Oo(G.props.children,H.mode,Se,G.key),z.return=H,H=z):(Se=dl(G.type,G.key,G.props,null,H.mode,Se),Se.ref=ha(H,z,G),Se.return=H,H=Se)}return E(H);case p:e:{for(Ke=G.key;z!==null;){if(z.key===Ke)if(z.tag===4&&z.stateNode.containerInfo===G.containerInfo&&z.stateNode.implementation===G.implementation){d(H,z.sibling),z=v(z,G.children||[]),z.return=H,H=z;break e}else{d(H,z);break}else a(H,z);z=z.sibling}z=ld(G,H.mode,Se),z.return=H,H=z}return E(H);case P:return Ke=G._init,Or(H,z,Ke(G._payload),Se)}if(te(G))return ft(H,z,G,Se);if(D(G))return wn(H,z,G,Se);Ls(H,G)}return typeof G=="string"&&G!==""||typeof G=="number"?(G=""+G,z!==null&&z.tag===6?(d(H,z.sibling),z=v(z,G),z.return=H,H=z):(d(H,z),z=sd(G,H.mode,Se),z.return=H,H=z),E(H)):d(H,z)}return Or}var vi=fm(!0),hm=fm(!1),pa={},Rn=qr(pa),ma=qr(pa),gi=qr(pa);function ur(i){if(i===pa)throw Error(c(174));return i}function Su(i,a){gt(gi,a),gt(ma,i),gt(Rn,pa),i=$(a),St(Rn),gt(Rn,i)}function yi(){St(Rn),St(ma),St(gi)}function pm(i){var a=ur(gi.current),d=ur(Rn.current);a=Z(d,i.type,a),d!==a&&(gt(ma,i),gt(Rn,a))}function Cu(i){ma.current===i&&(St(Rn),St(ma))}var Tt=qr(0);function Bs(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)||Xc(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 wu=[];function ku(){for(var i=0;id?d:4,i(!0);var m=ju.transition;ju.transition={};try{i(!1),a()}finally{ot=d,ju.transition=m}}function Dm(){return Nn().memoizedState}function sS(i,a,d){var m=Jr(i);if(d={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null},Am(i))Om(a,d);else if(d=rm(i,a,d,m),d!==null){var v=sn();Fn(d,i,m,v),zm(d,a,m)}}function lS(i,a,d){var m=Jr(i),v={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null};if(Am(i))Om(a,v);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(v.hasEagerState=!0,v.eagerState=O,Yn(O,E)){var W=a.interleaved;W===null?(v.next=v,gu(a)):(v.next=W.next,W.next=v),a.interleaved=v;return}}catch{}finally{}d=rm(i,a,v,m),d!==null&&(v=sn(),Fn(d,i,m,v),zm(d,a,m))}}function Am(i){var a=i.alternate;return i===_t||a!==null&&a===_t}function Om(i,a){va=Ws=!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 m=a.lanes;m&=i.pendingLanes,d|=m,a.lanes=d,ru(i,d)}}var $s={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},cS={readContext:zn,useCallback:function(i,a){return dr().memoizedState=[i,a===void 0?null:a],i},useContext:zn,useEffect:km,useImperativeHandle:function(i,a,d){return d=d!=null?d.concat([i]):null,Vs(4194308,4,Pm.bind(null,a,i),d)},useLayoutEffect:function(i,a){return Vs(4194308,4,i,a)},useInsertionEffect:function(i,a){return Vs(4,2,i,a)},useMemo:function(i,a){var d=dr();return a=a===void 0?null:a,i=i(),d.memoizedState=[i,a],i},useReducer:function(i,a,d){var m=dr();return a=d!==void 0?d(a):a,m.memoizedState=m.baseState=a,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:a},m.queue=i,i=i.dispatch=sS.bind(null,_t,i),[m.memoizedState,i]},useRef:function(i){var a=dr();return i={current:i},a.memoizedState=i},useState:Cm,useDebugValue:Du,useDeferredValue:function(i){return dr().memoizedState=i},useTransition:function(){var i=Cm(!1),a=i[0];return i=aS.bind(null,i[1]),dr().memoizedState=i,[a,i]},useMutableSource:function(){},useSyncExternalStore:function(i,a,d){var m=_t,v=dr();if(Pt){if(d===void 0)throw Error(c(407));d=d()}else{if(d=a(),Kt===null)throw Error(c(349));Mo&30||gm(m,a,d)}v.memoizedState=d;var b={value:d,getSnapshot:a};return v.queue=b,km(xm.bind(null,m,b,i),[i]),m.flags|=2048,xa(9,ym.bind(null,m,b,d,a),void 0,null),d},useId:function(){var i=dr(),a=Kt.identifierPrefix;if(Pt){var d=Tr,m=Mr;d=(m&~(1<<32-qn(m)-1)).toString(32)+d,a=":"+a+"R"+d,d=ga++,0Ju&&(a.flags|=128,m=!0,Ca(v,!1),a.lanes=4194304)}else{if(!m)if(i=Bs(b),i!==null){if(a.flags|=128,m=!0,i=i.updateQueue,i!==null&&(a.updateQueue=i,a.flags|=4),Ca(v,!0),v.tail===null&&v.tailMode==="hidden"&&!b.alternate&&!Pt)return on(a),null}else 2*qt()-v.renderingStartTime>Ju&&d!==1073741824&&(a.flags|=128,m=!0,Ca(v,!1),a.lanes=4194304);v.isBackwards?(b.sibling=a.child,a.child=b):(i=v.last,i!==null?i.sibling=b:a.child=b,v.last=b)}return v.tail!==null?(a=v.tail,v.rendering=a,v.tail=a.sibling,v.renderingStartTime=qt(),a.sibling=null,i=Tt.current,gt(Tt,m?i&1|2:i&1),a):(on(a),null);case 22:case 23:return od(),d=a.memoizedState!==null,i!==null&&i.memoizedState!==null!==d&&(a.flags|=8192),d&&a.mode&1?_n&1073741824&&(on(a),ge&&a.subtreeFlags&6&&(a.flags|=8192)):on(a),null;case 24:return null;case 25:return null}throw Error(c(156,a.tag))}function gS(i,a){switch(cu(a),a.tag){case 1:return xn(a.type)&&ws(),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return yi(),St(yn),St(nn),ku(),i=a.flags,i&65536&&!(i&128)?(a.flags=i&-65537|128,a):null;case 5:return Cu(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 mu(a.type._context),null;case 22:case 23:return od(),null;case 24:return null;default:return null}}var Xs=!1,an=!1,yS=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(m){It(i,a,m)}else d.current=null}function Hu(i,a,d){try{d()}catch(m){It(i,a,m)}}var ev=!1;function xS(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 m=d.memoizedProps,v=d.memoizedState,b=i.stateNode,E=b.getSnapshotBeforeUpdate(i.elementType===i.type?m:Xn(i.type,m),v);b.__reactInternalSnapshotBeforeUpdate=E}break;case 3:ge&&ko(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 wa(i,a,d){var m=a.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var v=m=m.next;do{if((v.tag&i)===i){var b=v.destroy;v.destroy=void 0,b!==void 0&&Hu(a,d,b)}v=v.next}while(v!==m)}}function Qs(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 m=d.create;d.destroy=m()}d=d.next}while(d!==a)}}function Wu(i){var a=i.ref;if(a!==null){var d=i.stateNode;switch(i.tag){case 5:i=ne(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 Vu(i,a,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,a?dn(d,i,a):Le(d,i);else if(m!==4&&(i=i.child,i!==null))for(Vu(i,a,d),i=i.sibling;i!==null;)Vu(i,a,d),i=i.sibling}function Uu(i,a,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,a?_e(d,i,a):J(d,i);else if(m!==4&&(i=i.child,i!==null))for(Uu(i,a,d),i=i.sibling;i!==null;)Uu(i,a,d),i=i.sibling}var Zt=null,Qn=!1;function hr(i,a,d){for(d=d.child;d!==null;)$u(i,a,d),d=d.sibling}function $u(i,a,d){if(sr&&typeof sr.onCommitFiberUnmount=="function")try{sr.onCommitFiberUnmount(Is,d)}catch{}switch(d.tag){case 5:an||bi(d,a);case 6:if(ge){var m=Zt,v=Qn;Zt=null,hr(i,a,d),Zt=m,Qn=v,Zt!==null&&(Qn?fn(Zt,d.stateNode):Vt(Zt,d.stateNode))}else hr(i,a,d);break;case 18:ge&&Zt!==null&&(Qn?Lb(Zt,d.stateNode):Fb(Zt,d.stateNode));break;case 4:ge?(m=Zt,v=Qn,Zt=d.stateNode.containerInfo,Qn=!0,hr(i,a,d),Zt=m,Qn=v):(Te&&(m=d.stateNode.containerInfo,v=Lp(m),Kc(m,v)),hr(i,a,d));break;case 0:case 11:case 14:case 15:if(!an&&(m=d.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){v=m=m.next;do{var b=v,E=b.destroy;b=b.tag,E!==void 0&&(b&2||b&4)&&Hu(d,a,E),v=v.next}while(v!==m)}hr(i,a,d);break;case 1:if(!an&&(bi(d,a),m=d.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=d.memoizedProps,m.state=d.memoizedState,m.componentWillUnmount()}catch(O){It(d,a,O)}hr(i,a,d);break;case 21:hr(i,a,d);break;case 22:d.mode&1?(an=(m=an)||d.memoizedState!==null,hr(i,a,d),an=m):hr(i,a,d);break;default:hr(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 yS),a.forEach(function(m){var v=IS.bind(null,i,m);d.has(m)||(d.add(m),m.then(v,v))})}}function Zn(i,a){var d=a.deletions;if(d!==null)for(var m=0;m";case Js:return":has("+(Yu(i)||"")+")";case el:return'[role="'+i.value+'"]';case nl:return'"'+i.value+'"';case tl:return'[data-testname="'+i.value+'"]';default:throw Error(c(365))}}function uv(i,a){var d=[];i=[i,0];for(var m=0;mv&&(v=E),m&=~b}if(m=v,m=qt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*SS(m/1960))-m,10i?16:i,Zr===null)var m=!1;else{if(i=Zr,Zr=null,sl=0,Xe&6)throw Error(c(331));var v=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 W=0;Wqt()-Zu?_o(i,0):Qu|=d),Cn(i,a)}function xv(i,a){a===0&&(i.mode&1?(a=Es,Es<<=1,!(Es&130023424)&&(Es=4194304)):a=1);var d=sn();i=cr(i,a),i!==null&&(da(i,a,d),Cn(i,d))}function PS(i){var a=i.memoizedState,d=0;a!==null&&(d=a.retryLane),xv(i,d)}function IS(i,a){var d=0;switch(i.tag){case 13:var m=i.stateNode,v=i.memoizedState;v!==null&&(d=v.retryLane);break;case 19:m=i.stateNode;break;default:throw Error(c(314))}m!==null&&m.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,mS(i,a,d);bn=!!(i.flags&131072)}else bn=!1,Pt&&a.flags&1048576&&Qp(a,_s,a.index);switch(a.lanes=0,a.tag){case 2:var m=a.type;qs(i,a),i=a.pendingProps;var v=ui(a,nn.current);mi(a,d),v=Pu(null,a,m,i,v,d);var b=Iu();return a.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,xn(m)?(b=!0,ks(a)):b=!1,a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,yu(a),v.updater=Fs,a.stateNode=v,v._reactInternals=a,bu(a,m,i,d),a=Ru(null,a,m,!0,b,d)):(a.tag=0,Pt&&b&&lu(a),hn(null,a,v,d),a=a.child),a;case 16:m=a.elementType;e:{switch(qs(i,a),i=a.pendingProps,v=m._init,m=v(m._payload),a.type=m,v=a.tag=TS(m),i=Xn(m,i),v){case 0:a=zu(null,a,m,i,d);break e;case 1:a=Gm(null,a,m,i,d);break e;case 11:a=Hm(null,a,m,i,d);break e;case 14:a=Wm(null,a,m,Xn(m.type,i),d);break e}throw Error(c(306,m,""))}return a;case 0:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Xn(m,v),zu(i,a,m,v,d);case 1:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Xn(m,v),Gm(i,a,m,v,d);case 3:e:{if(qm(a),i===null)throw Error(c(387));m=a.pendingProps,b=a.memoizedState,v=b.element,om(i,a),Ns(a,m,null,d);var E=a.memoizedState;if(m=E.element,Ge&&b.isDehydrated)if(b={element:m,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){v=xi(Error(c(423)),a),a=Ym(i,a,m,d,v);break e}else if(m!==v){v=xi(Error(c(424)),a),a=Ym(i,a,m,d,v);break e}else for(Ge&&(On=Tb(a.stateNode.containerInfo),Tn=a,Pt=!0,Kn=null,fa=!1),d=hm(a,null,m,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(hi(),m===v){a=Dr(i,a,d);break e}hn(i,a,m,d)}a=a.child}return a;case 5:return pm(a),i===null&&du(a),m=a.type,v=a.pendingProps,b=i!==null?i.memoizedProps:null,E=v.children,ce(m,v)?E=null:b!==null&&ce(m,b)&&(a.flags|=32),$m(i,a),hn(i,a,E,d),a.child;case 6:return i===null&&du(a),null;case 13:return Km(i,a,d);case 4:return Su(a,a.stateNode.containerInfo),m=a.pendingProps,i===null?a.child=vi(a,null,m,d):hn(i,a,m,d),a.child;case 11:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Xn(m,v),Hm(i,a,m,v,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(m=a.type._context,v=a.pendingProps,b=a.memoizedProps,E=v.value,nm(a,m,E),b!==null)if(Yn(b.value,E)){if(b.children===v.children&&!yn.current){a=Dr(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 W=O.firstContext;W!==null;){if(W.context===m){if(b.tag===1){W=_r(-1,d&-d),W.tag=2;var ie=b.updateQueue;if(ie!==null){ie=ie.shared;var je=ie.pending;je===null?W.next=W:(W.next=je.next,je.next=W),ie.pending=W}}b.lanes|=d,W=b.alternate,W!==null&&(W.lanes|=d),vu(b.return,d,a),O.lanes|=d;break}W=W.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),vu(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,v.children,d),a=a.child}return a;case 9:return v=a.type,m=a.pendingProps.children,mi(a,d),v=zn(v),m=m(v),a.flags|=1,hn(i,a,m,d),a.child;case 14:return m=a.type,v=Xn(m,a.pendingProps),v=Xn(m.type,v),Wm(i,a,m,v,d);case 15:return Vm(i,a,a.type,a.pendingProps,d);case 17:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Xn(m,v),qs(i,a),a.tag=1,xn(m)?(i=!0,ks(a)):i=!1,mi(a,d),cm(a,m,v),bu(a,m,v,d),Ru(null,a,m,!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 ou(i,a)}function MS(i,a,d,m){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=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ln(i,a,d,m){return new MS(i,a,d,m)}function ad(i){return i=i.prototype,!(!i||!i.isReactComponent)}function TS(i){if(typeof i=="function")return ad(i)?1:0;if(i!=null){if(i=i.$$typeof,i===k)return 11;if(i===I)return 14}return 2}function to(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 dl(i,a,d,m,v,b){var E=2;if(m=i,typeof i=="function")ad(i)&&(E=1);else if(typeof i=="string")E=5;else e:switch(i){case h:return Oo(d.children,v,b,a);case y:E=8,v|=8;break;case x:return i=Ln(12,d,a,v|2),i.elementType=x,i.lanes=b,i;case w:return i=Ln(13,d,a,v),i.elementType=w,i.lanes=b,i;case j:return i=Ln(19,d,a,v),i.elementType=j,i.lanes=b,i;case M:return fl(d,v,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 k:E=11;break e;case I:E=14;break e;case P:E=16,m=null;break e}throw Error(c(130,i==null?i:typeof i,""))}return a=Ln(E,d,a,v),a.elementType=i,a.type=m,a.lanes=b,a}function Oo(i,a,d,m){return i=Ln(7,i,m,a),i.lanes=d,i}function fl(i,a,d,m){return i=Ln(22,i,m,a),i.elementType=M,i.lanes=d,i.stateNode={isHidden:!1},i}function sd(i,a,d){return i=Ln(6,i,null,a),i.lanes=d,i}function ld(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 _S(i,a,d,m,v){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=nu(0),this.expirationTimes=nu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nu(0),this.identifierPrefix=m,this.onRecoverableError=v,Ge&&(this.mutableSourceEagerHydrationData=null)}function Cv(i,a,d,m,v,b,E,O,W){return i=new _S(i,a,d,O,W),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:m,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},yu(b),i}function wv(i){if(!i)return Yr;i=i._reactInternals;e:{if(V(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 kv(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 jv(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var d=i.retryLane;i.retryLane=d!==0&&d=ie&&b>=He&&v<=je&&E<=be){i.splice(a,1);break}else if(m!==ie||d.width!==W.width||beE){if(!(b!==He||d.height!==W.height||jev)){ie>m&&(W.width+=ie-m,W.x=m),jeb&&(W.height+=He-b,W.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 ne(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:DS,findFiberByHostInstance:i.findFiberByHostInstance||AS,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{Is=a.inject(i),sr=a}catch{}i=!!a.checkDCE}}return i},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(i,a,d,m){if(!N)throw Error(c(363));i=Ku(i,a);var v=Ze(i,d,m).disconnect;return{disconnect:function(){v()}}},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,m){var v=a.current,b=sn(),E=Jr(v);return d=wv(d),a.context===null?a.context=d:a.pendingContext=d,a=_r(b,E),a.payload={element:i},m=m===void 0?null:m,m!==null&&(a.callback=m),i=Xr(v,a,E),i!==null&&(Fn(i,v,E,b),Rs(i,v,E)),E},n};(function(e){e.exports=pO})(hO);const mO=P3(Vf);var pc={},vO={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})(vO);const Z0={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let J0=!1,e1=!1;const Dp=".react-konva-event",gO=`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 `,yO=`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 `,xO={};function Hc(e,t,n=xO){if(!J0&&"zIndex"in t&&(console.warn(yO),J0=!0),!e1&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(gO),e1=!0)}for(var s in n)if(!Z0[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 p=!t.hasOwnProperty(s);p&&e.setAttr(s,void 0)}var h=t._useStrictMode,y={},x=!1;const S={};for(var s in t)if(!Z0[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]||h&&t[s]!==e.getAttr(s))&&(x=!0,y[s]=t[s])}x&&(e.setAttrs(y),So(e));for(var f in S)e.on(f+Dp,S[f])}function So(e){if(!I3.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const H4={},bO={};Va.Node.prototype._applyProps=Hc;function SO(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),So(e)}function CO(e,t,n){let r=Va[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=Va.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 Hc(f,s),f}function wO(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 jO(e){return e}function EO(){return null}function PO(){return null}function IO(e,t,n,r){return bO}function MO(){}function TO(e){}function _O(e,t){return!1}function DO(){return H4}function AO(){return H4}const OO=setTimeout,zO=clearTimeout,RO=-1;function NO(e,t){return!1}const FO=!1,LO=!0,BO=!0;function HO(e,t){t.parent===e?t.moveToTop():e.add(t),So(e)}function WO(e,t){t.parent===e?t.moveToTop():e.add(t),So(e)}function W4(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),So(e)}function VO(e,t,n){W4(e,t,n)}function UO(e,t){t.destroy(),t.off(Dp),So(e)}function $O(e,t){t.destroy(),t.off(Dp),So(e)}function GO(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function qO(e,t,n){}function YO(e,t,n,r,o){Hc(e,o,r)}function KO(e){e.hide(),So(e)}function XO(e){}function QO(e,t){(t.visible==null||t.visible)&&e.show()}function ZO(e,t){}function JO(e){}function ez(){}const tz=()=>pc.DefaultEventPriority,nz=Object.freeze(Object.defineProperty({__proto__:null,appendChild:HO,appendChildToContainer:WO,appendInitialChild:SO,cancelTimeout:zO,clearContainer:JO,commitMount:qO,commitTextUpdate:GO,commitUpdate:YO,createInstance:CO,createTextInstance:wO,detachDeletedInstance:ez,finalizeInitialChildren:kO,getChildHostContext:AO,getCurrentEventPriority:tz,getPublicInstance:jO,getRootHostContext:DO,hideInstance:KO,hideTextInstance:XO,idlePriority:Bl.unstable_IdlePriority,insertBefore:W4,insertInContainerBefore:VO,isPrimaryRenderer:FO,noTimeout:RO,now:Bl.unstable_now,prepareForCommit:EO,preparePortalMount:PO,prepareUpdate:IO,removeChild:UO,removeChildFromContainer:$O,resetAfterCommit:MO,resetTextContent:TO,run:Bl.unstable_runWithPriority,scheduleTimeout:OO,shouldDeprioritizeSubtree:_O,shouldSetTextContent:NO,supportsMutation:BO,unhideInstance:QO,unhideTextInstance:ZO,warnsIfNotActing:LO},Symbol.toStringTag,{value:"Module"}));var rz=Object.defineProperty,oz=Object.defineProperties,iz=Object.getOwnPropertyDescriptors,t1=Object.getOwnPropertySymbols,az=Object.prototype.hasOwnProperty,sz=Object.prototype.propertyIsEnumerable,n1=(e,t,n)=>t in e?rz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,r1=(e,t)=>{for(var n in t||(t={}))az.call(t,n)&&n1(e,n,t[n]);if(t1)for(var n of t1(t))sz.call(t,n)&&n1(e,n,t[n]);return e},lz=(e,t)=>oz(e,iz(t));function V4(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=V4(r,t,n);if(o)return o;r=t?null:r.sibling}}function U4(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const Ap=U4(g.createContext(null));class $4 extends g.Component{render(){return g.createElement(Ap.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:cz,ReactCurrentDispatcher:uz}=g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function dz(){const e=g.useContext(Ap);if(!e)throw new Error("its-fine: useFiber must be called within a !");const t=g.useId();return g.useMemo(()=>{var r;return(r=cz.current)!=null?r:V4(e,!1,o=>{let s=o.memoizedState;for(;s;){if(s.memoizedState===t)return!0;s=s.next}})},[e,t])}function fz(){var e,t;const n=dz(),[r]=g.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=uz.current)==null?void 0:t.readContext(U4(s))),o=o.return}return g.useMemo(()=>Array.from(r.keys()).reduce((s,c)=>u=>g.createElement(s,null,g.createElement(c.Provider,lz(r1({},u),{value:r.get(c)}))),s=>g.createElement($4,r1({},s))),[r])}function hz(e){const t=Me.useRef();return Me.useLayoutEffect(()=>{t.current=e}),t.current}const pz=e=>{const t=Me.useRef(),n=Me.useRef(),r=Me.useRef(),o=hz(e),s=fz(),c=u=>{const{forwardedRef:f}=e;f&&(typeof f=="function"?f(u):f.current=u)};return Me.useLayoutEffect(()=>(n.current=new Va.Stage({width:e.width,height:e.height,container:t.current}),c(n.current),r.current=Ra.createContainer(n.current,pc.LegacyRoot,!1,null),Ra.updateContainer(Me.createElement(s,{},e.children),r.current),()=>{Va.isBrowser&&(c(null),Ra.updateContainer(null,r.current,null),n.current.destroy())}),[]),Me.useLayoutEffect(()=>{c(n.current),Hc(n.current,e,o),Ra.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})},Da="Layer",Vr="Group",Ur="Rect",Ro="Circle",mc="Line",G4="Image",mz="Transformer",Ra=mO(nz);Ra.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:Me.version,rendererPackageName:"react-konva"});const vz=Me.forwardRef((e,t)=>Me.createElement($4,{},Me.createElement(pz,{...e,forwardedRef:t}))),gz=me([tt,Ot],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),yz=()=>{const e=Y(),{tool:t,isStaging:n,isMovingBoundingBox:r}=A(gz);return{handleDragStart:g.useCallback(()=>{(t==="move"||n)&&!r&&e(Kl(!0))},[e,r,n,t]),handleDragMove:g.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e($1(s))},[e,r,n,t]),handleDragEnd:g.useCallback(()=>{(t==="move"||n)&&!r&&e(Kl(!1))},[e,r,n,t])}},xz=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}}),bz=()=>{const e=Y(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:c}=A(xz),u=g.useRef(null),f=G1(),p=()=>e(Qf());de(["shift+c"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[]);const h=()=>e(is(!s));de(["h"],()=>{h()},{enabled:()=>!o,preventDefault:!0},[s]),de(["n"],()=>{e(Xl(!c))},{enabled:!0,preventDefault:!0},[c]),de("esc",()=>{e(M3())},{enabled:()=>!0,preventDefault:!0}),de("shift+h",()=>{e(T3(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),de(["space"],y=>{y.repeat||(f==null||f.container().focus(),r!=="move"&&(u.current=r,e(br("move"))),r==="move"&&u.current&&u.current!=="move"&&(e(br(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}},q4=()=>{const e=Y(),t=wr(),n=G1();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=_3.pixelRatio,[s,c,u,f]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;e(D3({r:s,g:c,b:u,a:f}))},commitColorUnderCursor:()=>{e(A3())}}},Sz=me([bt,tt,Ot],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Cz=e=>{const t=Y(),{tool:n,isStaging:r}=A(Sz),{commitColorUnderCursor:o}=q4();return g.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(q1(!0)),t(O3([c.x,c.y])))},[e,n,r,t,o])},wz=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(wz),{updateColorUnderCursor:u}=q4();return g.useCallback(()=>{if(!e.current)return;const f=Op(e.current);if(f){if(r(z3(f)),n.current=f,s==="colorPicker"){u();return}!o||s==="move"||c||(t.current=!0,r(Y1([f.x,f.y])))}},[t,r,o,c,n,e,s,u])},jz=()=>{const e=Y();return g.useCallback(()=>{e(R3())},[e])},Ez=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}}),Pz=(e,t)=>{const n=Y(),{tool:r,isDrawing:o,isStaging:s}=A(Ez);return g.useCallback(()=>{if(r==="move"||s){n(Kl(!1));return}if(!t.current&&o&&e.current){const c=Op(e.current);if(!c)return;n(Y1([c.x,c.y]))}else t.current=!1;n(q1(!1))},[t,n,o,s,e,r])},Iz=me([tt],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Mz=e=>{const t=Y(),{isMoveStageKeyHeld:n,stageScale:r}=A(Iz);return g.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*N3**u,F3,L3),p={x:s.x-c.x*f,y:s.y-c.y*f};t(B3(f)),t($1(p))},[e,n,r,t])},Tz=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}}),_z=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=A(Tz);return l.jsxs(Vr,{children:[l.jsx(Ur,{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(Ur,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},Dz=me([tt],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Az=()=>{const e=A(f=>f.ui.currentTheme),{stageScale:t,stageCoordinates:n,stageDimensions:r}=A(Dz),[o,s]=g.useState([]),[c]=k1("colors",["gridLineColor"]),u=g.useCallback(f=>f/t,[t]);return g.useLayoutEffect(()=>{const{width:f,height:p}=r,{x:h,y}=n,x={x1:0,y1:0,x2:f,y2:p,offset:{x:u(h),y:u(y)}},S={x:Math.ceil(u(h)/64)*64,y:Math.ceil(u(y)/64)*64},C={x1:-S.x,y1:-S.y,x2:u(f)-S.x+64,y2:u(p)-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)},j=w.x2-w.x1,I=w.y2-w.y1,P=Math.round(j/64)+1,M=Math.round(I/64)+1,T=ee.range(0,P).map(_=>l.jsx(mc,{x:w.x1+_*64,y:w.y1,points:[0,0,0,I],stroke:c,strokeWidth:1},`x_${_}`)),D=ee.range(0,M).map(_=>l.jsx(mc,{x:w.x1,y:w.y1+_*64,points:[0,0,j,0],stroke:c,strokeWidth:1},`y_${_}`));s(T.concat(D))},[t,n,r,e,u,c]),l.jsx(Vr,{children:o})},Oz=me([e=>e.gallery],e=>e.intermediateImage?e.intermediateImage:null,{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),zz=e=>{const{...t}=e,n=A(Oz),[r,o]=g.useState(null);if(g.useEffect(()=>{if(!n)return;const p=new Image;p.onload=()=>{o(p)},p.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(G4,{x:s,y:c,width:u,height:f,image:r,listening:!1,...t}):null},Yo=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},Rz=me(tt,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:Yo(t)}}),o1=e=>`data:image/svg+xml;utf8, `.replaceAll("black",e),Nz=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=A(Rz),[c,u]=g.useState(null),[f,p]=g.useState(0),h=g.useRef(null),y=g.useCallback(()=>{p(f+1),setTimeout(y,500)},[f]);return g.useEffect(()=>{if(c)return;const x=new Image;x.onload=()=>{u(x)},x.src=o1(n)},[c,n]),g.useEffect(()=>{c&&(c.src=o1(n))},[c,n]),g.useEffect(()=>{const x=setInterval(()=>p(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(Ur,{ref:h,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})},Fz=me([tt],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Lz=e=>{const{...t}=e,{objects:n}=A(Fz);return l.jsx(Vr,{listening:!1,...t,children:n.filter(H3).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 No=g,Bz=function(t,n,r){const o=No.useRef("loading"),s=No.useRef(),[c,u]=No.useState(0),f=No.useRef(),p=No.useRef(),h=No.useRef();return(f.current!==t||p.current!==n||h.current!==r)&&(o.current="loading",s.current=void 0,f.current=t,p.current=n,h.current=r),No.useLayoutEffect(function(){if(!t)return;var y=document.createElement("img");function x(){o.current="loaded",s.current=y,u(Math.random())}function S(){o.current="failed",s.current=void 0,u(Math.random())}return y.addEventListener("load",x),y.addEventListener("error",S),n&&(y.crossOrigin=n),r&&(y.referrerpolicy=r),y.src=t,function(){y.removeEventListener("load",x),y.removeEventListener("error",S)}},[t,n,r]),[s.current,o.current]};const Y4=e=>{const{url:t,x:n,y:r}=e,[o]=Bz(t);return l.jsx(G4,{x:n,y:r,image:o,listening:!1})},Hz=me([tt],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Wz=()=>{const{objects:e}=A(Hz);return e?l.jsx(Vr,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(U1(t))return l.jsx(Y4,{x:t.x,y:t.y,url:t.image.url},n);if(W3(t)){const r=l.jsx(mc,{points:t.points,stroke:t.color?Yo(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(Vr,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(V3(t))return l.jsx(Ur,{x:t.x,y:t.y,width:t.width,height:t.height,fill:Yo(t.color)},n);if(U3(t))return l.jsx(Ur,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},Vz=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}}),Uz=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:c,width:u,height:f}=A(Vz);return l.jsxs(Vr,{...t,children:[r&&n&&l.jsx(Y4,{url:n.image.url,x:s,y:c}),o&&l.jsxs(Vr,{children:[l.jsx(Ur,{x:s,y:c,width:u,height:f,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),l.jsx(Ur,{x:s,y:c,width:u,height:f,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},$z=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}}),Gz=()=>{const e=Y(),{isOnFirstImage:t,isOnLastImage:n,currentStagingAreaImage:r,shouldShowStagingImage:o}=A($z),{t:s}=X(),c=g.useCallback(()=>{e(Rv(!0))},[e]),u=g.useCallback(()=>{e(Rv(!1))},[e]);de(["left"],()=>{f()},{enabled:()=>!0,preventDefault:!0}),de(["right"],()=>{p()},{enabled:()=>!0,preventDefault:!0}),de(["enter"],()=>{h()},{enabled:()=>!0,preventDefault:!0});const f=()=>e($3()),p=()=>e(G3()),h=()=>e(q3());return r?l.jsx(B,{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(b9,{}),onClick:f,colorScheme:"accent",isDisabled:t}),l.jsx(se,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:l.jsx(S9,{}),onClick:p,colorScheme:"accent",isDisabled:n}),l.jsx(se,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:l.jsx(Ac,{}),onClick:h,colorScheme:"accent"}),l.jsx(se,{tooltip:s("unifiedCanvas.showHide"),"aria-label":s("unifiedCanvas.showHide"),"data-alert":!o,icon:o?l.jsx(I9,{}):l.jsx(P9,{}),onClick:()=>e(Y3(!o)),colorScheme:"accent"}),l.jsx(se,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),icon:l.jsx(Qh,{}),onClick:()=>e(K3(r.image.url)),colorScheme:"accent"}),l.jsx(se,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:l.jsx(vs,{style:{transform:"rotate(45deg)"}}),onClick:()=>e(X3()),colorScheme:"error",fontSize:20})]})}):null},Ni=e=>Math.round(e*100)/100,qz=me([tt],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${Ni(n)}, ${Ni(r)})`}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function Yz(){const{cursorCoordinatesString:e}=A(qz),{t}=X();return l.jsx(Ye,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const Uf="var(--invokeai-colors-warning-500)",Kz=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:p,y:h},stageScale:y,shouldShowCanvasDebugInfo:x,layer:S,boundingBoxScaleMethod:C,shouldPreserveMaskedArea:k}=e;let w="inherit";return(C==="none"&&(s<512||c<512)||C==="manual"&&u*f<512*512)&&(w=Uf),{activeLayerColor:S==="mask"?Uf:"inherit",activeLayerString:S.charAt(0).toUpperCase()+S.slice(1),boundingBoxColor:w,boundingBoxCoordinatesString:`(${Ni(p)}, ${Ni(h)})`,boundingBoxDimensionsString:`${s}×${c}`,scaledBoundingBoxDimensionsString:`${u}×${f}`,canvasCoordinatesString:`${Ni(r)}×${Ni(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(y*100),shouldShowCanvasDebugInfo:x,shouldShowBoundingBox:C!=="auto",shouldShowScaledBoundingBox:C!=="none",shouldPreserveMaskedArea:k}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Xz=()=>{const{activeLayerColor:e,activeLayerString:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:c,canvasCoordinatesString:u,canvasDimensionsString:f,canvasScaleString:p,shouldShowCanvasDebugInfo:h,shouldShowBoundingBox:y,shouldPreserveMaskedArea:x}=A(Kz),{t:S}=X();return l.jsxs(B,{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")}: ${p}%`}),x&&l.jsx(Ye,{style:{color:Uf},children:"Preserve Masked Area: On"}),y&&l.jsx(Ye,{style:{color:n},children:`${S("unifiedCanvas.boundingBox")}: ${o}`}),c&&l.jsx(Ye,{style:{color:n},children:`${S("unifiedCanvas.scaledBoundingBox")}: ${s}`}),h&&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(Yz,{})]})]})},Qz=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}}),Zz=e=>{const{...t}=e,n=Y(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:c,isTransformingBoundingBox:u,stageScale:f,shouldSnapToGrid:p,tool:h,hitStrokeWidth:y}=A(Qz),x=g.useRef(null),S=g.useRef(null),[C,k]=g.useState(!1);g.useEffect(()=>{var Q;!x.current||!S.current||(x.current.nodes([S.current]),(Q=x.current.getLayer())==null||Q.batchDraw())},[]);const w=64*f,j=g.useCallback(Q=>{if(!p){n(dd({x:Math.floor(Q.target.x()),y:Math.floor(Q.target.y())}));return}const U=Q.target.x(),K=Q.target.y(),te=Nv(U,64),ne=Nv(K,64);Q.target.x(te),Q.target.y(ne),n(dd({x:te,y:ne}))},[n,p]),I=g.useCallback(()=>{if(!S.current)return;const Q=S.current,U=Q.scaleX(),K=Q.scaleY(),te=Math.round(Q.width()*U),ne=Math.round(Q.height()*K),$=Math.round(Q.x()),Z=Math.round(Q.y());n(Oa({width:te,height:ne})),n(dd({x:p?pl($,64):$,y:p?pl(Z,64):Z})),Q.scaleX(1),Q.scaleY(1)},[n,p]),P=g.useCallback((Q,U,K)=>{const te=Q.x%w,ne=Q.y%w;return{x:pl(U.x,w)+te,y:pl(U.y,w)+ne}},[w]),M=()=>{n(fd(!0))},T=()=>{n(fd(!1)),n(hd(!1)),n(ml(!1)),k(!1)},D=()=>{n(hd(!0))},_=()=>{n(fd(!1)),n(hd(!1)),n(ml(!1)),k(!1)},R=()=>{k(!0)},V=()=>{!u&&!c&&k(!1)},F=()=>{n(ml(!0))},L=()=>{n(ml(!1))};return l.jsxs(Vr,{...t,children:[l.jsx(Ur,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:F,onMouseOver:F,onMouseLeave:L,onMouseOut:L}),l.jsx(Ur,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:y,listening:!s&&h==="move",onDragStart:D,onDragEnd:_,onDragMove:j,onMouseDown:D,onMouseOut:V,onMouseOver:R,onMouseEnter:R,onMouseUp:_,onTransform:I,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(mz,{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:h==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&h==="move",onDragStart:D,onDragEnd:_,onMouseDown:M,onMouseUp:T,onTransformEnd:T,ref:x,rotateEnabled:!1})]})},Jz=me(tt,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:c,layer:u,shouldShowBrush:f,isMovingBoundingBox:p,isTransformingBoundingBox:h,stageScale:y,stageDimensions:x,boundingBoxCoordinates:S,boundingBoxDimensions:C,shouldRestrictStrokesToBox:k}=e,w=k?{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/y,colorPickerInnerRadius:(Fv-af+1)/y,maskColorString:Yo({...o,a:.5}),brushColorString:Yo(s),colorPickerColorString:Yo(r),tool:c,layer:u,shouldShowBrush:f,shouldDrawBrushPreview:!(p||h||!t)&&f,strokeWidth:1.5/y,dotRadius:1.5/y,clip:w}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),eR=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:c,layer:u,shouldDrawBrushPreview:f,dotRadius:p,strokeWidth:h,brushColorString:y,colorPickerColorString:x,colorPickerInnerRadius:S,colorPickerOuterRadius:C,clip:k}=A(Jz);return f?l.jsxs(Vr,{listening:!1,...k,...t,children:[c==="colorPicker"?l.jsxs(l.Fragment,{children:[l.jsx(Ro,{x:n,y:r,radius:C,stroke:y,strokeWidth:af,strokeScaleEnabled:!1}),l.jsx(Ro,{x:n,y:r,radius:S,stroke:x,strokeWidth:af,strokeScaleEnabled:!1})]}):l.jsxs(l.Fragment,{children:[l.jsx(Ro,{x:n,y:r,radius:o,fill:u==="mask"?s:y,globalCompositeOperation:c==="eraser"?"destination-out":"source-out"}),l.jsx(Ro,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:h*2,strokeEnabled:!0,listening:!1}),l.jsx(Ro,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:h,strokeEnabled:!0,listening:!1})]}),l.jsx(Ro,{x:n,y:r,radius:p*2,fill:"rgba(255,255,255,0.4)",listening:!1}),l.jsx(Ro,{x:n,y:r,radius:p,fill:"rgba(0,0,0,1)",listening:!1})]}):null},tR=me([tt,Ot],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:c,isMovingBoundingBox:u,stageDimensions:f,stageCoordinates:p,tool:h,isMovingStage:y,shouldShowIntermediates:x,shouldShowGrid:S,shouldRestrictStrokesToBox:C}=e;let k="none";return h==="move"||t?y?k="grabbing":k="grab":s?k=void 0:C&&!c&&(k="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||u,shouldShowBoundingBox:o,shouldShowGrid:S,stageCoordinates:p,stageCursor:k,stageDimensions:f,stageScale:r,tool:h,isStaging:t,shouldShowIntermediates:x}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),nR=re(vz,{shouldForwardProp:e=>!["sx"].includes(e)}),K4=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:c,stageScale:u,tool:f,isStaging:p,shouldShowIntermediates:h}=A(tR);bz();const y=g.useRef(null),x=g.useRef(null),S=g.useCallback(V=>{Z3(V),y.current=V},[]),C=g.useCallback(V=>{Q3(V),x.current=V},[]),k=g.useRef({x:0,y:0}),w=g.useRef(!1),j=Mz(y),I=Cz(y),P=Pz(y,w),M=kz(y,w,k),T=jz(),{handleDragStart:D,handleDragMove:_,handleDragEnd:R}=yz();return l.jsx(B,{sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:l.jsxs(Ye,{sx:{position:"relative"},children:[l.jsxs(nR,{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:I,onTouchMove:M,onTouchEnd:P,onMouseDown:I,onMouseLeave:T,onMouseMove:M,onMouseUp:P,onDragStart:D,onDragMove:_,onDragEnd:R,onContextMenu:V=>V.evt.preventDefault(),onWheel:j,draggable:(f==="move"||p)&&!t,children:[l.jsx(Da,{id:"grid",visible:r,children:l.jsx(Az,{})}),l.jsx(Da,{id:"base",ref:C,listening:!1,imageSmoothingEnabled:!1,children:l.jsx(Wz,{})}),l.jsxs(Da,{id:"mask",visible:e,listening:!1,children:[l.jsx(Lz,{visible:!0,listening:!1}),l.jsx(Nz,{listening:!1})]}),l.jsx(Da,{children:l.jsx(_z,{})}),l.jsxs(Da,{id:"preview",imageSmoothingEnabled:!1,children:[!p&&l.jsx(eR,{visible:f!=="move",listening:!1}),l.jsx(Uz,{visible:p}),h&&l.jsx(zz,{}),l.jsx(Zz,{visible:n&&!p})]})]}),l.jsx(Xz,{}),l.jsx(Gz,{})]})})},rR=me(tt,F4,bt,(e,t,n)=>{const{doesCanvasNeedScaling:r,isCanvasInitialized:o}=e;return{doesCanvasNeedScaling:r,activeTabName:n,initialCanvasImage:t,isCanvasInitialized:o}}),X4=()=>{const e=Y(),{doesCanvasNeedScaling:t,activeTabName:n,initialCanvasImage:r,isCanvasInitialized:o}=A(rR),s=g.useRef(null);return g.useLayoutEffect(()=>{window.setTimeout(()=>{if(!s.current)return;const{clientWidth:c,clientHeight:u}=s.current;e(J3({width:c,height:u})),e(o?eC():bc()),e(E1(!1))},0)},[e,r,t,n,o]),l.jsx(B,{ref:s,sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:l.jsx(Xf,{thickness:"2px",speed:"1s",size:"xl"})})},oR=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 Q4(){const e=Y(),{canRedo:t,activeTabName:n}=A(oR),{t:r}=X(),o=()=>{e(tC())};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(L9,{}),onClick:o,isDisabled:!t})}const iR=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 Z4(){const e=Y(),{t}=X(),{canUndo:n,activeTabName:r}=A(iR),o=()=>{e(nC())};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 aR=(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},sR=e=>{const t=document.createElement("a");t.href=e,t.download="",document.body.appendChild(t),t.click(),document.body.removeChild(t),t.remove()},lR=(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:p}=e.getClientRect(),h=r?{x:r.x+n.x,y:r.y+n.y,width:r.width,height:r.height}:{x:c,y:u,width:f,height:p},y=e.toDataURL(h);return e.scale(o),{dataURL:y,boundingBox:{x:s.x,y:s.y,width:f,height:p}}},cR={cropVisible:!1,cropToBoundingBox:!1,shouldSaveToGallery:!1,shouldDownload:!1,shouldCopy:!1,shouldSetAsInitialImage:!0},lo=(e=cR)=>async(t,n)=>{const{cropVisible:r,cropToBoundingBox:o,shouldSaveToGallery:s,shouldDownload:c,shouldCopy:u,shouldSetAsInitialImage:f}=e;t(rC("Exporting Image")),t(vl(!1));const p=n(),{stageScale:h,boundingBoxCoordinates:y,boundingBoxDimensions:x,stageCoordinates:S}=p.canvas,C=wr();if(!C){t(pd(!1)),t(vl(!0));return}const{dataURL:k,boundingBox:w}=lR(C,h,S,o?{...y,...x}:void 0);if(!k){t(pd(!1)),t(vl(!0));return}const j=new FormData;j.append("data",JSON.stringify({dataURL:k,filename:"merged_canvas.png",kind:s?"result":"temp",cropVisible:r}));const P=await(await fetch(`${window.location.origin}/upload`,{method:"POST",body:j})).json(),{url:M,width:T,height:D}=P,_={uuid:b1(),category:s?"result":"user",...P};c&&(sR(M),t(gl({title:Ia.t("toast.downloadImageStarted"),status:"success",duration:2500,isClosable:!0}))),u&&(aR(M,T,D),t(gl({title:Ia.t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0}))),s&&(t(S1({image:_,category:"result"})),t(gl({title:Ia.t("toast.imageSavedToGallery"),status:"success",duration:2500,isClosable:!0}))),f&&(t(oC({kind:"image",layer:"base",...w,image:_})),t(gl({title:Ia.t("toast.canvasMerged"),status:"success",duration:2500,isClosable:!0}))),t(pd(!1)),t(iC(Ia.t("common.statusConnected"))),t(vl(!0))};function uR(){const e=A(Ot),t=wr(),n=A(u=>u.system.isProcessing),r=A(u=>u.canvas.shouldCropToBoundingBoxOnSave),o=Y(),{t:s}=X();de(["meta+c","ctrl+c"],()=>{c()},{enabled:()=>!e,preventDefault:!0},[t,n]);const c=()=>{o(lo({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(Ki,{}),onClick:c,isDisabled:e})}function dR(){const e=Y(),{t}=X(),n=wr(),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(lo({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(Xh,{}),onClick:c,isDisabled:r})}function fR(){const e=A(Ot),{openUploader:t}=Yh(),{t:n}=X();return l.jsx(se,{"aria-label":n("common.upload"),tooltip:n("common.upload"),icon:l.jsx(Oc,{}),onClick:t,isDisabled:e})}const hR=me([tt,Ot],(e,t)=>{const{layer:n,isMaskEnabled:r}=e;return{layer:n,isMaskEnabled:r,isStaging:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function pR(){const e=Y(),{t}=X(),{layer:n,isMaskEnabled:r,isStaging:o}=A(hR),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(is(!0))};return l.jsx(Mn,{tooltip:`${t("unifiedCanvas.layer")} (Q)`,"aria-label":`${t("unifiedCanvas.layer")} (Q)`,tooltipProps:{hasArrow:!0,placement:"top"},value:n,validValues:K1,onChange:c,isDisabled:o})}function mR(){const e=Y(),{t}=X(),n=wr(),r=A(Ot),o=A(c=>c.system.isProcessing);de(["shift+m"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n,o]);const s=()=>{e(lo({cropVisible:!1,shouldSetAsInitialImage:!0}))};return l.jsx(se,{"aria-label":`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:l.jsx(Vx,{}),onClick:s,isDisabled:r})}function vR(){const e=A(s=>s.canvas.tool),t=A(Ot),n=Y(),{t:r}=X();de(["v"],()=>{o()},{enabled:()=>!t,preventDefault:!0},[]);const o=()=>n(br("move"));return l.jsx(se,{"aria-label":`${r("unifiedCanvas.move")} (V)`,tooltip:`${r("unifiedCanvas.move")} (V)`,icon:l.jsx(Nx,{}),isChecked:e==="move"||t,onClick:o})}function gR(){const e=A(s=>s.ui.shouldPinParametersPanel),t=A(s=>s.ui.shouldShowParametersPanel),n=Y(),{t:r}=X(),o=()=>{n(ql(!0)),e&&n(cn())};return!e||!t?l.jsxs(B,{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(Zh,{})}),l.jsx(B,{children:l.jsx(Ip,{iconButton:!0})}),l.jsx(B,{children:l.jsx(Ep,{width:"100%",height:"40px",btnGroupWidth:"100%"})})]}):null}function yR(){const e=Y(),{t}=X(),n=A(Ot),r=()=>{e(Zf()),e(bc())};return l.jsx(se,{"aria-label":t("unifiedCanvas.clearCanvas"),tooltip:t("unifiedCanvas.clearCanvas"),icon:l.jsx(ri,{}),onClick:r,isDisabled:n,colorScheme:"error"})}function J4(e,t,n=250){const[r,o]=g.useState(0);return g.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 xR(){const e=wr(),t=Y(),{t:n}=X();de(["r"],()=>{o()},{enabled:()=>!0,preventDefault:!0},[e]);const r=J4(()=>o(!1),()=>o(!0)),o=(s=!1)=>{const c=wr();if(!c)return;const u=c.getClientRect({skipTransform:!0});t(X1({contentRect:u,shouldScaleTo1:s}))};return l.jsx(se,{"aria-label":`${n("unifiedCanvas.resetView")} (R)`,tooltip:`${n("unifiedCanvas.resetView")} (R)`,icon:l.jsx(Lx,{}),onClick:r})}function bR(){const e=A(Ot),t=wr(),n=A(u=>u.system.isProcessing),r=A(u=>u.canvas.shouldCropToBoundingBoxOnSave),o=Y(),{t:s}=X();de(["shift+s"],()=>{c()},{enabled:()=>!e,preventDefault:!0},[t,n]);const c=()=>{o(lo({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(Qh,{}),onClick:c,isDisabled:e})}const SR=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}}),CR=()=>{const e=Y(),{t}=X(),{tool:n,isStaging:r}=A(SR);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(br("brush")),s=()=>e(br("eraser")),c=()=>e(br("colorPicker")),u=()=>e(Q1()),f=()=>e(Z1());return l.jsxs(B,{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(Ux,{}),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(Bx,{}),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(Wx,{}),isDisabled:r,onClick:u}),l.jsx(se,{"aria-label":`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:l.jsx(vs,{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(Hx,{}),isChecked:n==="colorPicker"&&!r,isDisabled:r,onClick:c,width:"max-content"})]})},eb=()=>{const e=A(Ot),t=Y(),{t:n}=X(),r=()=>{t(aC()),t(Zf()),t(J1())};return l.jsxs(Bc,{title:n("unifiedCanvas.emptyTempImageFolder"),acceptCallback:r,acceptButtonText:n("unifiedCanvas.emptyFolder"),triggerComponent:l.jsx(Je,{leftIcon:l.jsx(ri,{}),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")})]})},tb=()=>{const e=A(Ot),t=Y(),{t:n}=X();return l.jsxs(Bc,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(J1()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:l.jsx(Je,{size:"sm",leftIcon:l.jsx(ri,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[l.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),l.jsx("br",{}),l.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},wR=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}=X(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldShowCanvasDebugInfo:o,shouldShowIntermediates:s}=A(wR);return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{tooltip:t("unifiedCanvas.canvasSettings"),tooltipProps:{placement:"bottom"},"aria-label":t("unifiedCanvas.canvasSettings"),icon:l.jsx(Jh,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:t("unifiedCanvas.showIntermediates"),isChecked:s,onChange:c=>e(e2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:c=>e(t2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:c=>e(n2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:o,onChange:c=>e(r2(c.target.checked))}),l.jsx(tb,{}),l.jsx(eb,{})]})})},jR=()=>l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(pR,{}),l.jsx(CR,{}),l.jsxs(B,{gap:2,children:[l.jsx(vR,{}),l.jsx(xR,{})]}),l.jsxs(B,{columnGap:2,children:[l.jsx(mR,{}),l.jsx(bR,{})]}),l.jsxs(B,{columnGap:2,children:[l.jsx(uR,{}),l.jsx(dR,{})]}),l.jsxs(B,{gap:2,children:[l.jsx(Z4,{}),l.jsx(Q4,{})]}),l.jsxs(B,{gap:2,children:[l.jsx(fR,{}),l.jsx(yR,{})]}),l.jsx(kR,{}),l.jsx(gR,{})]});function ER(){const e=Y(),t=A(o=>o.canvas.brushSize),{t:n}=X(),r=A(Ot);return de(["BracketLeft"],()=>{e(Fi(Math.max(t-5,5)))},{enabled:()=>!r,preventDefault:!0},[t]),de(["BracketRight"],()=>{e(Fi(Math.min(t+5,500)))},{enabled:()=>!r,preventDefault:!0},[t]),l.jsx(ut,{label:n("unifiedCanvas.brushSize"),value:t,withInput:!0,onChange:o=>e(Fi(o)),sliderNumberInputProps:{max:500},inputReadOnly:!1,isCompact:!0})}function Wc(){return(Wc=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function $f(e){var t=g.useRef(e),n=g.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Zi=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(i1(o.current,w,u.current)):k(!1)},C=function(){return k(!1)};function k(w){var j=f.current,I=Gf(o.current),P=w?I.addEventListener:I.removeEventListener;P(j?"touchmove":"mousemove",S),P(j?"touchend":"mouseup",C)}return[function(w){var j=w.nativeEvent,I=o.current;if(I&&(a1(j),!function(M,T){return T&&!Ha(M)}(j,f.current)&&I)){if(Ha(j)){f.current=!0;var P=j.changedTouches||[];P.length&&(u.current=P[0].identifier)}I.focus(),s(i1(I,j,u.current)),k(!0)}},function(w){var j=w.which||w.keyCode;j<37||j>40||(w.preventDefault(),c({left:j===39?.05:j===37?-.05:0,top:j===40?.05:j===38?-.05:0}))},k]},[c,s]),h=p[0],y=p[1],x=p[2];return g.useEffect(function(){return x},[x]),Me.createElement("div",Wc({},r,{onTouchStart:h,onMouseDown:h,className:"react-colorful__interactive",ref:o,onKeyDown:y,tabIndex:0,role:"slider"}))}),Vc=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=Vc(["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},rb=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)}},qf=function(e){var t=rb(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Vd=function(e){var t=rb(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},PR=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),p=s%6;return{r:gn(255*[r,u,c,c,f,r][p]),g:gn(255*[f,r,r,u,c,c][p]),b:gn(255*[c,c,f,r,r,u][p]),a:gn(o,2)}},IR=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}},MR=Me.memo(function(e){var t=e.hue,n=e.onChange,r=Vc(["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:Zi(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:qf({h:t,s:100,v:100,a:1})})))}),TR=Me.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:qf({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:Zi(t.s+100*o.left,0,100),v:Zi(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:qf(t)})))}),ob=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function _R(e,t,n){var r=$f(n),o=g.useState(function(){return e.toHsva(t)}),s=o[0],c=o[1],u=g.useRef({color:t,hsva:s});g.useEffect(function(){if(!e.equal(t,u.current.color)){var p=e.toHsva(t);u.current={hsva:p,color:t},c(p)}},[t,e]),g.useEffect(function(){var p;ob(s,u.current.hsva)||e.equal(p=e.fromHsva(s),u.current.color)||(u.current={hsva:s,color:p},r(p))},[s,e,r]);var f=g.useCallback(function(p){c(function(h){return Object.assign({},h,p)})},[]);return[s,f]}var DR=typeof window<"u"?g.useLayoutEffect:g.useEffect,AR=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},s1=new Map,OR=function(e){DR(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!s1.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}`,s1.set(t,n);var r=AR();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},zR=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+Vd(Object.assign({},n,{a:0}))+", "+Vd(Object.assign({},n,{a:1}))+")"},s=Vc(["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:Zi(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:Vd(n)})))},RR=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,c=nb(e,["className","colorModel","color","onChange"]),u=g.useRef(null);OR(u);var f=_R(n,o,s),p=f[0],h=f[1],y=Vc(["react-colorful",t]);return Me.createElement("div",Wc({},c,{ref:u,className:y}),Me.createElement(TR,{hsva:p,onChange:h}),Me.createElement(MR,{hue:p.h,onChange:h}),Me.createElement(zR,{hsva:p,onChange:h,className:"react-colorful__last-control"}))},NR={defaultColor:{r:0,g:0,b:0,a:1},toHsva:IR,fromHsva:PR,equal:ob},FR=function(e){return Me.createElement(RR,Wc({},e,{colorModel:NR}))};const LR=re(FR,{baseStyle:{paddingInline:4},shouldForwardProp:e=>!["pickerColor"].includes(e)}),Ud={width:6,height:6,borderColor:"base.100"},BR=e=>{const{styleClass:t="",...n}=e;return l.jsx(LR,{sx:{".react-colorful__hue-pointer":Ud,".react-colorful__saturation-pointer":Ud,".react-colorful__alpha-pointer":Ud},className:t,...n})},vc=g.memo(BR),HR=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 WR(){const e=Y(),{brushColor:t,maskColor:n,layer:r,isStaging:o}=A(HR),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(Li({...t,a:ee.clamp(t.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[t]),de(["shift+BracketRight"],()=>{e(Li({...t,a:ee.clamp(t.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[t]),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(Ye,{sx:{width:7,height:7,minWidth:7,minHeight:7,borderRadius:"full",bg:s(),cursor:"pointer"}}),children:l.jsxs(B,{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(Li(c))}),r==="mask"&&l.jsx(vc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:c=>e(o2(c))})]})})}function ib(){return l.jsxs(B,{columnGap:4,alignItems:"center",children:[l.jsx(ER,{}),l.jsx(WR,{})]})}function VR(){const e=Y(),t=A(r=>r.canvas.shouldRestrictStrokesToBox),{t:n}=X();return l.jsx(pt,{label:n("unifiedCanvas.betaLimitToBox"),isChecked:t,onChange:r=>e(i2(r.target.checked))})}function UR(){return l.jsxs(B,{gap:4,alignItems:"center",children:[l.jsx(ib,{}),l.jsx(VR,{})]})}function $R(){const e=Y(),{t}=X(),n=()=>e(Qf());return l.jsx(Je,{size:"sm",leftIcon:l.jsx(ri,{}),onClick:n,tooltip:`${t("unifiedCanvas.clearMask")} (Shift+C)`,children:t("unifiedCanvas.betaClear")})}function GR(){const e=A(o=>o.canvas.isMaskEnabled),t=Y(),{t:n}=X(),r=()=>t(is(!e));return l.jsx(pt,{label:`${n("unifiedCanvas.enableMask")} (H)`,isChecked:e,onChange:r})}function qR(){const e=Y(),{t}=X(),n=A(r=>r.canvas.shouldPreserveMaskedArea);return l.jsx(pt,{label:t("unifiedCanvas.betaPreserveMasked"),isChecked:n,onChange:r=>e(a2(r.target.checked))})}function YR(){return l.jsxs(B,{gap:4,alignItems:"center",children:[l.jsx(ib,{}),l.jsx(GR,{}),l.jsx(qR,{}),l.jsx($R,{})]})}function KR(){const e=A(r=>r.canvas.shouldDarkenOutsideBoundingBox),t=Y(),{t:n}=X();return l.jsx(pt,{label:n("unifiedCanvas.betaDarkenOutside"),isChecked:e,onChange:r=>t(s2(r.target.checked))})}function XR(){const e=A(r=>r.canvas.shouldShowGrid),t=Y(),{t:n}=X();return l.jsx(pt,{label:n("unifiedCanvas.showGrid"),isChecked:e,onChange:r=>t(l2(r.target.checked))})}function QR(){const e=A(o=>o.canvas.shouldSnapToGrid),t=Y(),{t:n}=X(),r=o=>t(Xl(o.target.checked));return l.jsx(pt,{label:`${n("unifiedCanvas.snapToGrid")} (N)`,isChecked:e,onChange:r})}function ZR(){return l.jsxs(B,{alignItems:"center",gap:4,children:[l.jsx(XR,{}),l.jsx(QR,{}),l.jsx(KR,{})]})}const JR=me([tt],e=>{const{tool:t,layer:n}=e;return{tool:t,layer:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function eN(){const{tool:e,layer:t}=A(JR);return l.jsxs(B,{height:8,minHeight:8,maxHeight:8,alignItems:"center",children:[t=="base"&&["brush","eraser","colorPicker"].includes(e)&&l.jsx(UR,{}),t=="mask"&&["brush","eraser","colorPicker"].includes(e)&&l.jsx(YR,{}),e=="move"&&l.jsx(ZR,{})]})}const tN=me([tt],e=>{const{doesCanvasNeedScaling:t}=e;return{doesCanvasNeedScaling:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),nN=()=>{const e=Y(),{doesCanvasNeedScaling:t}=A(tN);return g.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(B,{flexDirection:"row",width:"100%",height:"100%",columnGap:4,padding:4,children:[l.jsx(jR,{}),l.jsxs(B,{width:"100%",height:"100%",flexDirection:"column",rowGap:4,children:[l.jsx(eN,{}),t?l.jsx(X4,{}):l.jsx(K4,{})]})]})})},rN=me([tt,Ot],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:Yo(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),oN=()=>{const e=Y(),{t}=X(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:c}=A(rN);de(["q"],()=>{u()},{enabled:()=>!c,preventDefault:!0},[n]),de(["shift+c"],()=>{f()},{enabled:()=>!c,preventDefault:!0},[]),de(["h"],()=>{p()},{enabled:()=>!c,preventDefault:!0},[o]);const u=()=>{e(Ql(n==="mask"?"base":"mask"))},f=()=>e(Qf()),p=()=>e(is(!o));return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(Qt,{children:l.jsx(se,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:l.jsx(A9,{}),isChecked:n==="mask",isDisabled:c})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:p}),l.jsx(pt,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:h=>e(a2(h.target.checked))}),l.jsx(vc,{sx:{paddingTop:2,paddingBottom:2},pickerColor:r,onChange:h=>e(o2(h))}),l.jsxs(Je,{size:"sm",leftIcon:l.jsx(ri,{}),onClick:f,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},iN=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}}),aN=()=>{const e=Y(),{t}=X(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:c,shouldShowIntermediates:u,shouldSnapToGrid:f,shouldRestrictStrokesToBox:p}=A(iN);de(["n"],()=>{e(Xl(!f))},{enabled:!0,preventDefault:!0},[f]);const h=y=>e(Xl(y.target.checked));return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:l.jsx(Jh,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:t("unifiedCanvas.showIntermediates"),isChecked:u,onChange:y=>e(e2(y.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showGrid"),isChecked:c,onChange:y=>e(l2(y.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.snapToGrid"),isChecked:f,onChange:h}),l.jsx(pt,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:y=>e(s2(y.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:y=>e(t2(y.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:y=>e(n2(y.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:p,onChange:y=>e(i2(y.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:y=>e(r2(y.target.checked))}),l.jsx(tb,{}),l.jsx(eb,{})]})})},sN=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}}),lN=()=>{const e=Y(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=A(sN),{t:s}=X();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"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),de(["delete","backspace"],()=>{h()},{enabled:()=>!o,preventDefault:!0}),de(["BracketLeft"],()=>{e(Fi(Math.max(r-5,5)))},{enabled:()=>!o,preventDefault:!0},[r]),de(["BracketRight"],()=>{e(Fi(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),de(["shift+BracketLeft"],()=>{e(Li({...n,a:ee.clamp(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),de(["shift+BracketRight"],()=>{e(Li({...n,a:ee.clamp(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const c=()=>e(br("brush")),u=()=>e(br("eraser")),f=()=>e(br("colorPicker")),p=()=>e(Q1()),h=()=>e(Z1());return l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:l.jsx(Ux,{}),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(Bx,{}),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(Wx,{}),isDisabled:o,onClick:p}),l.jsx(se,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:l.jsx(vs,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:h}),l.jsx(se,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:l.jsx(Hx,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:f}),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:l.jsx(Zh,{})}),children:l.jsxs(B,{minWidth:60,direction:"column",gap:4,width:"100%",children:[l.jsx(B,{gap:4,justifyContent:"space-between",children:l.jsx(ut,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:y=>e(Fi(y)),sliderNumberInputProps:{max:500},inputReadOnly:!1})}),l.jsx(vc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:y=>e(Li(y))})]})})]})},cN=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}}),uN=()=>{const e=Y(),{isProcessing:t,isStaging:n,isMaskEnabled:r,layer:o,tool:s,shouldCropToBoundingBoxOnSave:c}=A(cN),u=wr(),{t:f}=X(),{openUploader:p}=Yh();de(["v"],()=>{h()},{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"],()=>{k()},{enabled:()=>!n,preventDefault:!0},[u,t]),de(["meta+c","ctrl+c"],()=>{w()},{enabled:()=>!n,preventDefault:!0},[u,t]),de(["shift+d"],()=>{j()},{enabled:()=>!n,preventDefault:!0},[u,t]);const h=()=>e(br("move")),y=J4(()=>x(!1),()=>x(!0)),x=(P=!1)=>{const M=wr();if(!M)return;const T=M.getClientRect({skipTransform:!0});e(X1({contentRect:T,shouldScaleTo1:P}))},S=()=>{e(Zf()),e(bc())},C=()=>{e(lo({cropVisible:!1,shouldSetAsInitialImage:!0}))},k=()=>{e(lo({cropVisible:!c,cropToBoundingBox:c,shouldSaveToGallery:!0}))},w=()=>{e(lo({cropVisible:!c,cropToBoundingBox:c,shouldCopy:!0}))},j=()=>{e(lo({cropVisible:!c,cropToBoundingBox:c,shouldDownload:!0}))},I=P=>{const M=P.target.value;e(Ql(M)),M==="mask"&&!r&&e(is(!0))};return l.jsxs(B,{sx:{alignItems:"center",gap:2},children:[l.jsx(Mn,{tooltip:`${f("unifiedCanvas.layer")} (Q)`,tooltipProps:{hasArrow:!0,placement:"top"},value:o,validValues:K1,onChange:I,isDisabled:n}),l.jsx(oN,{}),l.jsx(lN,{}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{"aria-label":`${f("unifiedCanvas.move")} (V)`,tooltip:`${f("unifiedCanvas.move")} (V)`,icon:l.jsx(Nx,{}),isChecked:s==="move"||n,onClick:h}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.resetView")} (R)`,tooltip:`${f("unifiedCanvas.resetView")} (R)`,icon:l.jsx(Lx,{}),onClick:y})]}),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(Vx,{}),onClick:C,isDisabled:n}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${f("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:l.jsx(Qh,{}),onClick:k,isDisabled:n}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${f("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:l.jsx(Ki,{}),onClick:w,isDisabled:n}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${f("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:l.jsx(Xh,{}),onClick:j,isDisabled:n})]}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(Z4,{}),l.jsx(Q4,{})]}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{"aria-label":`${f("common.upload")}`,tooltip:`${f("common.upload")}`,icon:l.jsx(Oc,{}),onClick:p,isDisabled:n}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.clearCanvas")}`,tooltip:`${f("unifiedCanvas.clearCanvas")}`,icon:l.jsx(ri,{}),onClick:S,colorScheme:"error",isDisabled:n})]}),l.jsx(Qt,{isAttached:!0,children:l.jsx(aN,{})})]})},dN=me([tt],e=>{const{doesCanvasNeedScaling:t}=e;return{doesCanvasNeedScaling:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),fN=()=>{const e=Y(),{doesCanvasNeedScaling:t}=A(dN);return g.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(B,{sx:{flexDirection:"column",alignItems:"center",gap:4,width:"100%",height:"100%"},children:[l.jsx(uN,{}),l.jsx(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:t?l.jsx(X4,{}):l.jsx(K4,{})})]})})},hN=me(tt,e=>{const{boundingBoxDimensions:t,boundingBoxScaleMethod:n}=e;return{boundingBoxDimensions:t,boundingBoxScale:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),pN=()=>{const e=Y(),{boundingBoxDimensions:t}=A(hN),{t:n}=X(),r=u=>{e(Oa({...t,width:Math.floor(u)}))},o=u=>{e(Oa({...t,height:Math.floor(u)}))},s=()=>{e(Oa({...t,width:Math.floor(512)}))},c=()=>{e(Oa({...t,height:Math.floor(512)}))};return l.jsxs(ze,{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})]})},mN=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}}),vN=()=>{const e=Y(),{tileSize:t,infillMethod:n,availableInfillMethods:r,boundingBoxScale:o,isManual:s,scaledBoundingBoxDimensions:c}=A(mN),{t:u}=X(),f=S=>{e(yl({...c,width:Math.floor(S)}))},p=S=>{e(yl({...c,height:Math.floor(S)}))},h=()=>{e(yl({...c,width:Math.floor(512)}))},y=()=>{e(yl({...c,height:Math.floor(512)}))},x=S=>{e(cC(S.target.value))};return l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(Mn,{label:u("parameters.scaleBeforeProcessing"),validValues:sC,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:h}),l.jsx(ut,{isInputDisabled:!s,isResetDisabled:!s,isSliderDisabled:!s,label:u("parameters.scaledHeight"),min:64,max:1024,step:64,value:c.height,onChange:p,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:y}),l.jsx(Mn,{label:u("parameters.infillMethod"),value:n,validValues:r,onChange:S=>e(lC(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 gN(){const e=Y(),t=A(r=>r.generation.seamBlur),{t:n}=X();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 yN(){const e=Y(),{t}=X(),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 xN(){const{t:e}=X(),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 bN(){const e=Y(),{t}=X(),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 SN=()=>l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(yN,{}),l.jsx(gN,{}),l.jsx(bN,{}),l.jsx(xN,{})]});function CN(){const{t:e}=X(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(kp,{})},unifiedCanvasImg2Img:{header:`${e("parameters.imageToImage")}`,feature:void 0,content:l.jsx(B4,{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(pN,{})},seamCorrection:{header:`${e("parameters.seamCorrectionHeader")}`,feature:ln.SEAM_CORRECTION,content:l.jsx(SN,{})},infillAndScaling:{header:`${e("parameters.infillScalingHeader")}`,feature:ln.INFILL_AND_SCALING,content:l.jsx(vN,{})},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(B,{flexDir:"column",gap:2,position:"relative",children:[l.jsx(_p,{}),l.jsx(Tp,{}),l.jsx(Mp,{}),l.jsx(jp,{accordionInfo:t})]})}function wN(){const e=A(n=>n.ui.shouldUseCanvasBetaLayout),t=A(bt);return l.jsx(hp,{parametersPanelContent:l.jsx(CN,{}),children:t==="unifiedCanvas"&&(e?l.jsx(nN,{}):l.jsx(fN,{}))})}const _i={boxSize:6},l1=[{id:"txt2img",icon:l.jsx(tn,{as:FD,sx:_i}),workarea:l.jsx(fO,{})},{id:"img2img",icon:l.jsx(tn,{as:dp,sx:_i}),workarea:l.jsx(oO,{})},{id:"unifiedCanvas",icon:l.jsx(tn,{as:HD,sx:_i}),workarea:l.jsx(wN,{})},{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(Y8),t=A(f=>f.lightbox.isLightboxOpen),n=A(f=>f.ui.shouldPinGallery),r=A(f=>f.ui.shouldPinParametersPanel),{t:o}=X(),s=Y();de("1",()=>{s(jn(0))}),de("2",()=>{s(jn(1))}),de("3",()=>{s(jn(2))}),de("4",()=>{s(jn(3))}),de("5",()=>{s(jn(4))}),de("6",()=>{s(jn(5))}),de("z",()=>{s(Vo(!t))},[t]),de("f",()=>{s(uC()),(n||r)&&s(cn())},[n,r]);const c=g.useMemo(()=>l1.map(f=>l.jsx(Gt,{hasArrow:!0,label:String(o(`common.${f.id}`)),placement:"end",children:l.jsxs(vx,{children:[l.jsx(S2,{children:String(o(`common.${f.id}`))}),f.icon]})},f.id)),[o]),u=g.useMemo(()=>l1.map(f=>l.jsx(px,{children:f.workarea},f.id)),[]);return l.jsxs(fx,{isLazy:!0,defaultIndex:e,index:e,onChange:f=>{s(jn(f))},flexGrow:1,children:[l.jsx(hx,{children:c}),l.jsx(mx,{children:u})]})}function jN(){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 EN=()=>{const e=Y(),t=A(G9),n=ss();g.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(dC())},[e,n,t])},PN=me([bt,Er],(e,t)=>{const{shouldPinGallery:n,shouldShowGallery:r}=t;return{shouldPinGallery:n,shouldShowGalleryButton:(!n||!r)&&["txt2img","img2img","unifiedCanvas"].includes(e)}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),IN=()=>{const{t:e}=X(),{shouldPinGallery:t,shouldShowGalleryButton:n}=A(PN),r=Y(),o=()=>{r(sf(!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},$d={borderStartStartRadius:0,borderEndStartRadius:0},MN=me([Er,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}}),TN=()=>{const e=Y(),{t}=X(),{shouldShowProcessButtons:n,shouldShowParametersPanelButton:r,shouldPinParametersPanel:o}=A(MN),s=()=>{e(ql(!0)),o&&e(cn())};return r?l.jsxs(B,{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:$d,children:l.jsx(Zh,{})}),n&&l.jsxs(l.Fragment,{children:[l.jsx(Ip,{iconButton:!0,sx:$d}),l.jsx(Ep,{sx:$d})]})]}):null};var Wa=globalThis&&globalThis.__assign||function(){return Wa=Object.assign||function(e){for(var t,n=1,r=arguments.length;ne.image.uuid===t.image.uuid&&e.isSelected===t.isSelected,ab=g.memo(e=>{const t=Y(),{activeTabName:n,galleryImageObjectFit:r,galleryImageMinimumWidth:o,mayDeleteImage:s,shouldUseSingleGalleryColumn:c}=A(ZD),{image:u,isSelected:f}=e,{url:p,thumbnail:h,uuid:y,metadata:x}=u,[S,C]=g.useState(!1),k=ss(),{direction:w}=ea(),{t:j}=X(),I=gp(),P=()=>C(!0),M=()=>C(!1),T=()=>{var K,te,ne,$;(te=(K=u.metadata)==null?void 0:K.image)!=null&&te.prompt&&I(($=(ne=u.metadata)==null?void 0:ne.image)==null?void 0:$.prompt),k({title:j("toast.promptSet"),status:"success",duration:2500,isClosable:!0})},D=()=>{u.metadata&&t(os(u.metadata.image.seed)),k({title:j("toast.seedSet"),status:"success",duration:2500,isClosable:!0})},_=()=>{t(ns(u)),n!=="img2img"&&t(jn("img2img")),k({title:j("toast.sentToImageToImage"),status:"success",duration:2500,isClosable:!0})},R=()=>{t(xc(u)),t(bc()),n!=="unifiedCanvas"&&t(jn("unifiedCanvas")),k({title:j("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},V=()=>{x&&t(_1(x)),k({title:j("toast.parametersSet"),status:"success",duration:2500,isClosable:!0})},F=async()=>{var K;if((K=x==null?void 0:x.image)!=null&&K.init_image_path&&(await fetch(x.image.init_image_path)).ok){t(jn("img2img")),t(fC(x)),k({title:j("toast.initialImageSet"),status:"success",duration:2500,isClosable:!0});return}k({title:j("toast.initialImageNotSet"),description:j("toast.initialImageNotSetDesc"),status:"error",duration:2500,isClosable:!0})},L=()=>t(Uv(u)),Q=K=>{K.dataTransfer.setData("invokeai/imageUuid",y),K.dataTransfer.effectAllowed="move"},U=()=>{t(Uv(u)),t(Vo(!0))};return l.jsx(_N,{menuProps:{size:"sm",isLazy:!0},renderMenu:()=>{var K,te,ne,$,Z,oe,le,Re;return l.jsxs(Ah,{children:[l.jsx(vr,{onClickCapture:U,children:j("parameters.openInViewer")}),l.jsx(vr,{onClickCapture:T,isDisabled:((te=(K=u==null?void 0:u.metadata)==null?void 0:K.image)==null?void 0:te.prompt)===void 0,children:j("parameters.usePrompt")}),l.jsx(vr,{onClickCapture:D,isDisabled:(($=(ne=u==null?void 0:u.metadata)==null?void 0:ne.image)==null?void 0:$.seed)===void 0,children:j("parameters.useSeed")}),l.jsx(vr,{onClickCapture:V,isDisabled:!["txt2img","img2img"].includes((oe=(Z=u==null?void 0:u.metadata)==null?void 0:Z.image)==null?void 0:oe.type),children:j("parameters.useAll")}),l.jsx(vr,{onClickCapture:F,isDisabled:((Re=(le=u==null?void 0:u.metadata)==null?void 0:le.image)==null?void 0:Re.type)!=="img2img",children:j("parameters.useInitImg")}),l.jsx(vr,{onClickCapture:_,children:j("parameters.sendToImg2Img")}),l.jsx(vr,{onClickCapture:R,children:j("parameters.sendToUnifiedCanvas")}),l.jsx(vr,{"data-warning":!0,children:l.jsx(hc,{image:u,children:l.jsx("p",{children:j("parameters.deleteImage")})})})]})},children:K=>l.jsxs(Ye,{position:"relative",onMouseOver:P,onMouseOut:M,userSelect:"none",draggable:!0,onDragStart:Q,ref:K,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(ls,{objectFit:c?"contain":r,rounded:"md",src:h||p,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(B,{onClick:L,sx:{position:"absolute",top:"0",insetInlineStart:"0",width:"100%",height:"100%",alignItems:"center",justifyContent:"center"},children:f&&l.jsx(tn,{as:Ac,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":j("parameters.deleteImage"),icon:l.jsx(V9,{}),size:"xs",fontSize:14,isDisabled:!s})})})]},y)})},DN);ab.displayName="HoverableImage";const AN=290,sb=()=>{const e=Y(),{t}=X(),n=g.useRef(null),[r,o]=g.useState(!0),{images:s,currentCategory:c,currentImageUuid:u,shouldPinGallery:f,galleryImageMinimumWidth:p,galleryGridTemplateColumns:h,galleryImageObjectFit:y,shouldAutoSwitchToNewImages:x,areMoreImagesAvailable:S,shouldUseSingleGalleryColumn:C}=A(QD),k=()=>{e(vC(c))},w=I=>{e(Zl(I))},j=()=>{e(c2()),e(cn())};return g.useEffect(()=>{if(!n.current)return;const I=new ResizeObserver(()=>{if(n.current){if(n.current.clientWidthI.disconnect()},[]),l.jsxs(B,{flexDirection:"column",w:"full",h:"full",gap:4,children:[l.jsxs(B,{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(T9,{}),onClick:()=>e(xl("result"))}),l.jsx(se,{"aria-label":t("gallery.showUploads"),tooltip:t("gallery.showUploads"),role:"radio",isChecked:c==="user",icon:l.jsx($9,{}),onClick:()=>e(xl("user"))})]}):l.jsxs(l.Fragment,{children:[l.jsx(Je,{size:"sm",isChecked:c==="result",onClick:()=>e(xl("result")),flexGrow:1,children:t("gallery.generations")}),l.jsx(Je,{size:"sm",isChecked:c==="user",onClick:()=>e(xl("user")),flexGrow:1,children:t("gallery.uploads")})]})}),l.jsxs(B,{gap:2,children:[l.jsx(rr,{triggerComponent:l.jsx(se,{size:"sm","aria-label":t("gallery.gallerySettings"),icon:l.jsx(Jh,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(ut,{value:p,onChange:w,min:32,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:()=>e(Zl(64))}),l.jsx(pt,{label:t("gallery.maintainAspectRatio"),isChecked:y==="contain",onChange:()=>e(hC(y==="contain"?"cover":"contain"))}),l.jsx(pt,{label:t("gallery.autoSwitchNewImages"),isChecked:x,onChange:I=>e(pC(I.target.checked))}),l.jsx(pt,{label:t("gallery.singleColumnLayout"),isChecked:C,onChange:I=>e(mC(I.target.checked))})]})}),l.jsx(se,{size:"sm","aria-label":t("gallery.pinGallery"),tooltip:`${t("gallery.pinGallery")} (Shift+G)`,onClick:j,icon:f?l.jsx(T4,{}):l.jsx(_4,{})})]})]}),l.jsx(M4,{children:l.jsx(B,{direction:"column",gap:2,h:"full",children:s.length||S?l.jsxs(l.Fragment,{children:[l.jsx(or,{gap:2,style:{gridTemplateColumns:h},children:s.map(I=>{const{uuid:P}=I,M=u===P;return l.jsx(ab,{image:I,isSelected:M},P)})}),l.jsx(Je,{onClick:k,isDisabled:!S,flexShrink:0,children:t(S?"gallery.loadMore":"gallery.allImagesLoaded")})]}):l.jsxs(B,{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")})]})})})]})};sb.displayName="ImageGalleryContent";const c1={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}},ON=me([bt,Er,Gr,Ot,bs],(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 zN(){const e=Y(),{shouldPinGallery:t,shouldShowGallery:n,galleryImageMinimumWidth:r,activeTabName:o,isStaging:s,isResizable:c,isLightboxOpen:u}=A(ON),f=()=>{e(c2()),e(cn())},p=()=>{e(gC()),t&&e(cn())},h=()=>{e(sf(!1)),t&&e(cn())};de("g",()=>{p()},[t]),de("left",()=>{e(F1())},{enabled:!s||o!=="unifiedCanvas"},[s,o]),de("right",()=>{e(L1())},{enabled:!s||o!=="unifiedCanvas"},[s,o]),de("shift+g",()=>{f()},[t]),de("esc",()=>{e(sf(!1))},{enabled:()=>!t,preventDefault:!0},[t]);const y=32;return de("shift+up",()=>{if(r<256){const x=ee.clamp(r+y,32,256);e(Zl(x))}},[r]),de("shift+down",()=>{if(r>32){const x=ee.clamp(r-y,32,256);e(Zl(x))}},[r]),l.jsx(I4,{direction:"right",isResizable:c||!t,isOpen:n,onClose:h,isPinned:t&&!u,minWidth:t?c1[o].galleryMinWidth:200,maxWidth:t?c1[o].galleryMaxWidth:void 0,children:l.jsx(sb,{})})}var Hn=function(e,t){return Number(e.toFixed(t))},RN=function(e,t){return typeof e=="number"?e:t},Mt=function(e,t,n){n&&typeof n=="function"&&n(e,t)},NN=function(e){return-Math.cos(e*Math.PI)/2+.5},FN=function(e){return e},LN=function(e){return e*e},BN=function(e){return e*(2-e)},HN=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},WN=function(e){return e*e*e},VN=function(e){return--e*e*e+1},UN=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},$N=function(e){return e*e*e*e},GN=function(e){return 1- --e*e*e*e},qN=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},YN=function(e){return e*e*e*e*e},KN=function(e){return 1+--e*e*e*e*e},XN=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},lb={easeOut:NN,linear:FN,easeInQuad:LN,easeOutQuad:BN,easeInOutQuad:HN,easeInCubic:WN,easeOutCubic:VN,easeInOutCubic:UN,easeInQuart:$N,easeOutQuart:GN,easeInOutQuart:qN,easeInQuint:YN,easeOutQuint:KN,easeInOutQuint:XN},cb=function(e){typeof e=="number"&&cancelAnimationFrame(e)},xr=function(e){e.mounted&&(cb(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function ub(e,t,n,r){if(e.mounted){var o=new Date().getTime(),s=1;xr(e),e.animation=function(){if(!e.mounted)return cb(e.animation);var c=new Date().getTime()-o,u=c/n,f=lb[t],p=f(u);c>=n?(r(s),e.animation=null):e.animation&&(r(p),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function QN(e){var t=e.scale,n=e.positionX,r=e.positionY;return!(Number.isNaN(t)||Number.isNaN(n)||Number.isNaN(r))}function Co(e,t,n,r){var o=QN(t);if(!(!e.mounted||!o)){var s=e.setTransformState,c=e.transformState,u=c.scale,f=c.positionX,p=c.positionY,h=t.scale-u,y=t.positionX-f,x=t.positionY-p;n===0?s(t.scale,t.positionX,t.positionY):ub(e,r,n,function(S){var C=u+h*S,k=f+y*S,w=p+x*S;s(C,k,w)})}}function ZN(e,t,n){var r=e.offsetWidth,o=e.offsetHeight,s=t.offsetWidth,c=t.offsetHeight,u=s*n,f=c*n,p=r-u,h=o-f;return{wrapperWidth:r,wrapperHeight:o,newContentWidth:u,newDiffWidth:p,newContentHeight:f,newDiffHeight:h}}var JN=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,p=e-t-u,h=u,y=r-o-f,x=f;return{minPositionX:p,maxPositionX:h,minPositionY:y,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=ZN(n,r,t),c=s.wrapperWidth,u=s.wrapperHeight,f=s.newContentWidth,p=s.newDiffWidth,h=s.newContentHeight,y=s.newDiffHeight,x=JN(c,f,p,u,h,y,Boolean(o));return x},Yf=function(e,t,n,r){return r?en?Hn(n,2):Hn(e,2):Hn(e,2)},Ji=function(e,t){var n=Np(e,t);return e.bounds=n,n};function Uc(e,t,n,r,o,s,c){var u=n.minPositionX,f=n.minPositionY,p=n.maxPositionX,h=n.maxPositionY,y=0,x=0;c&&(y=o,x=s);var S=Yf(e,u-y,p+y,r),C=Yf(t,f-x,h+x,r);return{x:S,y:C}}function $c(e,t,n,r,o,s){var c=e.transformState,u=c.scale,f=c.positionX,p=c.positionY,h=r-u;if(typeof t!="number"||typeof n!="number")return console.error("Mouse X and Y position were not provided!"),{x:f,y:p};var y=f-t*h,x=p-n*h,S=Uc(y,x,o,s,0,0,null);return S}function Ss(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 u1=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=Gc(s,n);return!f},d1=function(e){var t=e.isInitialized,n=e.isPanning,r=e.setup,o=r.panning.disabled,s=t&&n&&!o;return!!s},eF=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}},tF=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 nF(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,p=e.wrapperComponent;if(!(c||!p||!e.bounds)){var h=e.bounds,y=h.maxPositionX,x=h.minPositionX,S=h.maxPositionY,C=h.minPositionY,k=n>y||nS||ry?p.offsetWidth:e.setup.minPositionX||0,I=r>S?p.offsetHeight:e.setup.minPositionY||0,P=$c(e,j,I,o,e.bounds,u||f),M=P.x,T=P.y;return{scale:o,positionX:k?M:n,positionY:w?T:r}}}function rF(e,t,n,r,o){var s=e.setup.limitToBounds,c=e.wrapperComponent,u=e.bounds,f=e.transformState,p=f.scale,h=f.positionX,y=f.positionY;if(!(c===null||u===null||t===h&&n===y)){var x=Uc(t,n,u,s,r,o,c),S=x.x,C=x.y;e.setTransformState(p,S,C)}}var oF=function(e,t,n){var r=e.startCoords,o=e.transformState,s=e.setup.panning,c=s.lockAxisX,u=s.lockAxisY,f=o.positionX,p=o.positionY;if(!r)return{x:f,y:p};var h=t-r.x,y=n-r.y,x=c?f:h,S=u?p:y;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},iF=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},aF=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,p=!f||u>1||!s||t;return!(!p||!n||!r)};function sF(e,t){var n=e.setup.velocityAnimation,r=n.equalToMove,o=n.animationTime,s=n.sensitivity;return r?o*t*s:o}function f1(e,t,n,r,o,s,c,u,f,p){if(o){if(t>c&&n>c){var h=c+(e-c)*p;return h>f?f:hs?s:h}}return r?t:Yf(e,s,c,o)}function lF(e,t){var n=1;return t?Math.min(n,e.offsetWidth/window.innerWidth):n}function cF(e,t){var n=iF(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 p=lF(c,u),h=t.x-r.x,y=t.y-r.y,x=h/p,S=y/p,C=f-o,k=h*h+y*y,w=Math.sqrt(k)/C;e.velocity={velocityX:x,velocityY:S,total:w}}e.lastMousePosition=t,e.velocityTime=f}}function uF(e){var t=e.velocity,n=e.bounds,r=e.setup,o=e.wrapperComponent,s=aF(e);if(!(!s||!t||!n||!o)){var c=t.velocityX,u=t.velocityY,f=t.total,p=n.maxPositionX,h=n.minPositionX,y=n.maxPositionY,x=n.minPositionY,S=r.limitToBounds,C=r.alignmentAnimation,k=r.zoomAnimation,w=r.panning,j=w.lockAxisY,I=w.lockAxisX,P=k.animationType,M=C.sizeX,T=C.sizeY,D=C.velocityAlignmentTime,_=D,R=sF(e,f),V=Math.max(R,_),F=gc(e,M),L=gc(e,T),Q=F*o.offsetWidth/100,U=L*o.offsetHeight/100,K=p+Q,te=h-Q,ne=y+U,$=x-U,Z=e.transformState,oe=new Date().getTime();ub(e,P,V,function(le){var Re=e.transformState,Ne=Re.scale,Ie=Re.positionX,pe=Re.positionY,ce=new Date().getTime()-oe,Fe=ce/_,Ve=lb[C.animationType],Ue=1-Ve(Math.min(1,Fe)),$e=1-le,Qe=Ie+c*$e,ge=pe+u*$e,Te=f1(Qe,Z.positionX,Ie,I,S,h,p,te,K,Ue),Ge=f1(ge,Z.positionY,pe,j,S,x,y,$,ne,Ue);(Ie!==Qe||pe!==ge)&&e.setTransformState(Ne,Te,Ge)})}}function h1(e,t){var n=e.transformState.scale;xr(e),Ji(e,n),window.TouchEvent!==void 0&&t instanceof TouchEvent?tF(e,t):eF(e,t)}function db(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,p=o.animationType,h=s||t.1&&y;x?uF(e):db(e)}}function Fp(e,t,n,r){var o=e.setup,s=o.minScale,c=o.maxScale,u=o.limitToBounds,f=Ss(Hn(t,2),s,c,0,!1),p=Ji(e,f),h=$c(e,n,r,f,p,u),y=h.x,x=h.y;return{scale:f,positionX:y,positionY:x}}function fb(e,t,n){var r=e.transformState.scale,o=e.wrapperComponent,s=e.setup,c=s.minScale,u=s.limitToBounds,f=s.zoomAnimation,p=f.disabled,h=f.animationTime,y=f.animationType,x=p||r>=c;if((r>=1||u)&&db(e),!(x||!o||!e.mounted)){var S=t||o.offsetWidth/2,C=n||o.offsetHeight/2,k=Fp(e,c,S,C);k&&Co(e,k,h,y)}}var uo=function(){return uo=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},PF=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=Gc(c,o);return!f},IF=function(e){var t=e.setup.pinch.disabled,n=e.isInitialized,r=e.pinchStartDistance,o=n&&!t&&r;return!!o},MF=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}},xb=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))},TF=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,p=u.size,h=u.disabled;if(!n||r===null||!t)throw new Error("Pinch touches distance was not provided");if(t<0)return e.transformState.scale;var y=t/r,x=y*n;return Ss(Hn(x,2),c,s,p,!h&&!f)},_F=160,DF=100,AF=function(e,t){var n=e.props,r=n.onWheelStart,o=n.onZoomStart;e.wheelStopEventTimer||(xr(e),Mt(dt(e),t,r),Mt(dt(e),t,o))},OF=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,p=c.limitToBounds,h=c.centerZoomedOut,y=c.zoomAnimation,x=c.wheel,S=c.disablePadding,C=y.size,k=y.disabled,w=x.step;if(!s)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var j=kF(t,null),I=jF(e,j,w,!t.ctrlKey);if(f!==I){var P=Ji(e,I),M=yb(t,s,f),T=k||C===0||h||S,D=p&&T,_=$c(e,M.x,M.y,I,P,D),R=_.x,V=_.y;e.previousWheelEvent=t,e.setTransformState(I,R,V),Mt(dt(e),t,r),Mt(dt(e),t,o)}},zF=function(e,t){var n=e.props,r=n.onWheelStop,o=n.onZoomStop;Kf(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(fb(e,t.x,t.y),e.wheelAnimationTimer=null)},DF);var s=EF(e,t);s&&(Kf(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,Mt(dt(e),t,r),Mt(dt(e),t,o))},_F))},RF=function(e,t){var n=xb(t);e.pinchStartDistance=n,e.lastDistance=n,e.pinchStartScale=e.transformState.scale,e.isPanning=!1,xr(e)},NF=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,p=f.disabled,h=f.size;if(!(r===null||!n)){var y=MF(t,o,n);if(!(!Number.isFinite(y.x)||!Number.isFinite(y.y))){var x=xb(t),S=TF(e,x);if(S!==o){var C=Ji(e,S),k=p||h===0||u,w=c&&k,j=$c(e,y.x,y.y,S,C,w),I=j.x,P=j.y;e.pinchMidpoint=y,e.lastDistance=x,e.setTransformState(S,I,P)}}}},FF=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,fb(e,t==null?void 0:t.x,t==null?void 0:t.y)},bb=function(e,t){var n=e.props.onZoomStop,r=e.setup.doubleClick.animationTime;Kf(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,Mt(dt(e),t,n)},r)},LF=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),vb(e,c,u,function(){return Mt(dt(e),t,o)}),bb(e,t)};function BF(e,t){var n=e.setup,r=e.doubleClickStopEventTimer,o=e.transformState,s=e.contentComponent,c=o.scale,u=e.props,f=u.onZoomStart,p=u.onZoom,h=n.doubleClick,y=h.disabled,x=h.mode,S=h.step,C=h.animationTime,k=h.animationType;if(!y&&!r){if(x==="reset")return LF(e,t);if(!s)return console.error("No ContentComponent found");var w=x==="zoomOut"?-1:1,j=pb(e,w,S);if(c!==j){Mt(dt(e),t,f);var I=yb(t,s,c),P=Fp(e,j,I.x,I.y);if(!P)return console.error("Error during zoom event. New transformation state was not calculated.");Mt(dt(e),t,p),Co(e,P,C,k),bb(e,t)}}}var HF=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,p=o==null?void 0:o.contains(f),h=n&&f&&p&&!c;if(!h)return!1;var y=Gc(f,u);return!y},WF=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){Ji(n,n.transformState.scale),n.setup=v1(r)},this.initializeWindowEvents=function(){var r,o=qd(),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=qd(),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),xr(n),(o=n.observer)===null||o===void 0||o.disconnect()},this.handleInitializeWrapperEvents=function(r){var o=qd();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=CF(n,r);if(s){var c=n.isPressingKeys(n.setup.wheel.activationKeys);c&&(AF(n,r),OF(n,r),zF(n,r))}}},this.onPanningStart=function(r){var o=n.setup.disabled,s=n.props.onPanningStart;if(!o){var c=u1(n,r);if(c){var u=n.isPressingKeys(n.setup.panning.activationKeys);u&&(r.preventDefault(),r.stopPropagation(),xr(n),h1(n,r),Mt(dt(n),r,s))}}},this.onPanning=function(r){var o=n.setup.disabled,s=n.props.onPanning;if(!o){var c=d1(n);if(c){var u=n.isPressingKeys(n.setup.panning.activationKeys);u&&(r.preventDefault(),r.stopPropagation(),p1(n,r.clientX,r.clientY),Mt(dt(n),r,s))}}},this.onPanningStop=function(r){var o=n.props.onPanningStop;n.isPanning&&(dF(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=PF(n,r);f&&(RF(n,r),xr(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=IF(n);f&&(r.preventDefault(),r.stopPropagation(),NF(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&&(FF(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=u1(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,xr(n);var f=r.touches,p=f.length===1,h=f.length===2;p&&(xr(n),h1(n,r),Mt(dt(n),r,s)),h&&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=d1(n);if(!c)return;r.preventDefault(),r.stopPropagation();var u=r.touches[0];p1(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=HF(n,r);s&&BF(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=gb(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):bF(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,Ji(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=v1(this.props),this.transformState=hb(this.props)}return e}(),qc=Me.createContext(null),VF=function(e,t){return typeof e=="function"?e(t):e},UF=Me.forwardRef(function(e,t){var n=g.useState(0),r=n[1],o=e.children,s=g.useRef(new WF(e)).current,c=VF(e.children,dt(s)),u=g.useCallback(function(){typeof o=="function"&&r(function(f){return f+1})},[o]);return g.useImperativeHandle(t,function(){return dt(s)},[s]),g.useEffect(function(){s.update(e)},[s,e]),g.useEffect(function(){return s.onChange(u)},[s,e,u]),Me.createElement(qc.Provider,{value:s},c)});function $F(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 GF=`.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; } `,g1={wrapper:"transform-component-module_wrapper__7HFJe",content:"transform-component-module_content__uCDPE"};$F(GF);var qF=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,p=f===void 0?{}:f,h=e.contentProps,y=h===void 0?{}:h,x=g.useContext(qc).init,S=g.useRef(null),C=g.useRef(null);return g.useEffect(function(){var k=S.current,w=C.current;k!==null&&w!==null&&x&&x(k,w)},[]),Me.createElement("div",uo({},p,{ref:S,className:"react-transform-wrapper ".concat(g1.wrapper," ").concat(r),style:c}),Me.createElement("div",uo({},y,{ref:C,className:"react-transform-component ".concat(g1.content," ").concat(s),style:u}),t))},Sb=function(){var e=g.useContext(qc),t=g.useState(dt(e||{})),n=t[0],r=t[1];if(!e)throw new Error("Transform context mus be placed inside TransformWrapper");return g.useEffect(function(){e.onChange(function(o){r(o)})},[e]),n};Me.forwardRef(function(e,t){var n=g.useRef(null),r=g.useContext(qc);return g.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",uo({},e,{ref:SF([n,t])}))});const YF=()=>{const[e,t]=g.useState(0),[n,r]=g.useState(1),[o,s]=g.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)}}},KF=({flipHorizontally:e,flipVertically:t,rotateCounterClockwise:n,rotateClockwise:r,reset:o})=>{const{zoomIn:s,zoomOut:c,resetTransform:u}=Sb(),{t:f}=X();return l.jsxs(Qt,{isAttached:!0,orientation:"vertical",children:[l.jsx(se,{icon:l.jsx(dD,{}),"aria-label":f("accessibility.zoomIn"),tooltip:"Zoom In",onClick:()=>s(),fontSize:20}),l.jsx(se,{icon:l.jsx(fD,{}),"aria-label":f("accessibility.zoomOut"),tooltip:"Zoom Out",onClick:()=>c(),fontSize:20}),l.jsx(se,{icon:l.jsx(cD,{}),"aria-label":f("accessibility.rotateCounterClockwise"),tooltip:"Rotate Counter-Clockwise",onClick:n,fontSize:20}),l.jsx(se,{icon:l.jsx(uD,{}),"aria-label":f("accessibility.rotateClockwise"),tooltip:"Rotate Clockwise",onClick:r,fontSize:20}),l.jsx(se,{icon:l.jsx(B0,{}),"aria-label":f("accessibility.flipHorizontally"),tooltip:"Flip Horizontally",onClick:e,fontSize:20}),l.jsx(se,{icon:l.jsx(B0,{style:{transform:"rotate(90deg)"}}),"aria-label":f("accessibility.flipVertically"),tooltip:"Flip Vertically",onClick:t,fontSize:20}),l.jsx(se,{icon:l.jsx(up,{}),"aria-label":f("accessibility.reset"),tooltip:"Reset",onClick:()=>{u(),o()},fontSize:20})]})};function XF({image:e,alt:t,ref:n,styleClass:r,rotation:o,scaleX:s,scaleY:c}){const{centerView:u}=Sb();return l.jsx(qF,{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 QF=me([Gr,Er],(e,t)=>{const{currentImage:n}=e,{shouldShowImageDetails:r}=t;return{viewerImageToDisplay:n,shouldShowImageDetails:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function ZF(){const e=Y(),t=A(x=>x.lightbox.isLightboxOpen),{rotation:n,scaleX:r,scaleY:o,flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:p}=YF(),{viewerImageToDisplay:h,shouldShowImageDetails:y}=A(QF);return de("Esc",()=>{t&&e(Vo(!1))},[t]),l.jsx(yo,{children:t&&l.jsx(ir.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(UF,{centerOnInit:!0,minScale:.1,initialPositionX:50,initialPositionY:50,children:[l.jsxs(B,{sx:{flexDir:"column",position:"absolute",insetInlineStart:4,gap:4,zIndex:3,top:4},children:[l.jsx(se,{icon:l.jsx(lD,{}),"aria-label":"Exit Viewer",className:"lightbox-close-btn",onClick:()=>{e(Vo(!1))},fontSize:20}),l.jsx(KF,{flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:p})]}),l.jsx(B,{sx:{position:"absolute",top:4,zIndex:3,insetInlineStart:"50%",transform:"translate(-50%, 0)"},children:l.jsx(D4,{})}),h&&l.jsxs(l.Fragment,{children:[l.jsx(XF,{rotation:n,scaleX:r,scaleY:o,image:h,styleClass:"lightbox-image"}),y&&l.jsx(yp,{image:h}),!y&&l.jsx(Ye,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"100vw",h:"100vh",px:16,pointerEvents:"none"},children:l.jsx(A4,{})})]})]})},"lightbox")})}jN();const rL=e=>{EN();const t=A(r=>r.ui.currentTheme),{setColorMode:n}=yC();return g.useEffect(()=>{n(["light"].includes(t)?"light":"dark")},[n,t]),l.jsxs(or,{w:"100vw",h:"100vh",children:[l.jsx(ZF,{}),l.jsxs(o9,{children:[l.jsx(rP,{}),l.jsxs(or,{gap:4,p:4,gridAutoRows:"min-content auto",w:Z9,h:J9,children:[e.children||l.jsx(P4,{}),l.jsxs(B,{gap:4,w:"full",h:"full",children:[l.jsx(kN,{}),l.jsx(zN,{})]})]}),l.jsx(Ye,{children:l.jsx(X9,{})})]}),l.jsx(Ua,{children:l.jsx(TN,{})}),l.jsx(Ua,{children:l.jsx(IN,{})})]})};export{rL as default};