import{r as x,f as he,j as l,u as AS,c as oe,a as Ae,b as Pe,w as os,d as fn,o as At,S as Qf,e as mo,g as Ye,h as Dr,k as Jo,i as yc,_ as Ql,l as zS,m as RS,R as ke,n as Av,p as NS,q as Kd,s as ei,t as k1,v as j1,x as FS,y as LS,z as te,A as E1,B as P1,C as bc,D as is,F as B,E as Z,T as Ce,G as BS,H as Hl,I as Zl,J as Qd,K as Zd,L as Jd,U as HS,M as I1,N as M1,O as WS,P as T1,Q as _1,V as VS,W as D1,X as O1,Y as Ho,Z as kn,$ as A1,a0 as as,a1 as US,a2 as $S,a3 as z1,a4 as on,a5 as GS,a6 as vl,a7 as Sc,a8 as qS,a9 as zv,aa as Lo,ab as YS,ac as XS,ad as Da,ae as gl,af as KS,ag as QS,ah as ZS,ai as JS,aj as eC,ak as R1,al as N1,am as ef,an as tf,ao as F1,ap as nf,aq as rf,ar as Rv,as as L1,at as B1,au as H1,av as Wl,aw as Vl,ax as tC,ay as of,az as W1,aA as nC,aB as dd,aC as Nv,aD as V1,aE as U1,aF as af,aG as Wo,aH as rC,aI as oC,aJ as Fv,aK as Lv,aL as iC,aM as aC,aN as sC,aO as $1,aP as G1,aQ as lC,aR as cC,aS as Bv,aT as uC,aU as Hv,aV as dC,aW as fC,aX as hC,aY as pC,aZ as mC,a_ as vC,a$ as gC,b0 as xC,b1 as Wv,b2 as Ul,b3 as yC,b4 as bC,b5 as qa,b6 as Jl,b7 as q1,b8 as ec,b9 as SC,ba as CC,bb as xr,bc as Y1,bd as Zf,be as ss,bf as wC,bg as kC,bh as jC,bi as Sr,bj as X1,bk as EC,bl as PC,bm as K1,bn as IC,bo as MC,bp as TC,bq as _C,br as DC,bs as OC,bt as AC,bu as zC,bv as RC,bw as Vv,bx as NC,by as FC,bz as LC,bA as BC,bB as HC,bC as WC,bD as fd,bE as Na,bF as xl,bG as Uv,bH as hd,bI as pd,bJ as yl,bK as $v,bL as sf,bM as VC,bN as UC,bO as $C,bP as GC,bQ as qC,bR as YC,bS as XC,bT as bl,bU as md,bV as Sl,bW as nr,bX as KC,bY as QC,bZ as Q1,b_ as tc,b$ as Jf,c0 as Z1,c1 as J1,c2 as e2,c3 as ZC,c4 as t2,c5 as n2,c6 as r2,c7 as o2,c8 as i2,c9 as Wi,ca as Vi,cb as a2,cc as s2,cd as l2,ce as c2,cf as u2,cg as JC,ch as e3,ci as Gv,cj as Cl,ck as t3,cl as qv,cm as Yv,cn as Xv,co as Kv,cp as vd,cq as d2,cr as n3,cs as ls,ct as Qv,cu as r3,cv as o3,cw as i3,cx as Vo,cy as f2,cz as Zv,cA as a3,cB as s3,cC as l3,cD as c3,cE as u3,cF as d3,cG as f3,cH as h3,cI as p3,cJ as m3,cK as v3,cL as g3}from"./index-bcc89564.js";import{I as Jt,u as x3,c as y3,a as Et,b as Ut,A as oa,m as Wr,d as Ui,e as ti,P as eh,f as b3,C as S3,g as O,h as Y,n as h2}from"./scrollbar-2bd1868c.js";function th(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 nc="NOT_FOUND";function C3(e){var t;return{get:function(r){return t&&e(t.key,r)?t.value:nc},put:function(r,o){t={key:r,value:o}},getEntries:function(){return t?[t]:[]},clear:function(){t=void 0}}}function w3(e,t){var n=[];function r(u){var f=n.findIndex(function(p){return t(u,p.key)});if(f>-1){var h=n[f];return f>0&&(n.splice(f,1),n.unshift(h)),h.value}return nc}function o(u,f){r(u)===nc&&(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 k3=function(t,n){return t===n};function j3(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(),m2=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(_3()),p2);function D3(e){let t=[],n=[],r=0,o=!1,s=!1;const c=new WeakSet,u={schedule:(f,h=!1,p=!1)=>{const g=p&&o,y=g?t:n;return h&&c.add(f),y.indexOf(f)===-1&&(y.push(f),g&&o&&(r=t.length)),f},cancel:f=>{const h=n.indexOf(f);h!==-1&&n.splice(h,1),c.delete(f)},process:f=>{if(o){s=!0;return}if(o=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let h=0;h(e[t]=D3(()=>Ya=!0),e),{}),A3=cs.reduce((e,t)=>{const n=Cc[t];return e[t]=(r,o=!1,s=!1)=>(Ya||N3(),n.schedule(r,o,s)),e},{}),z3=cs.reduce((e,t)=>(e[t]=Cc[t].cancel,e),{});cs.reduce((e,t)=>(e[t]=()=>Cc[t].process($i),e),{});const R3=e=>Cc[e].process($i),v2=e=>{Ya=!1,$i.delta=lf?p2:Math.max(Math.min(e-$i.timestamp,O3),1),$i.timestamp=e,cf=!0,cs.forEach(R3),cf=!1,Ya&&(lf=!1,m2(v2))},N3=()=>{Ya=!0,lf=!0,cf||m2(v2)},Jv=()=>$i;var vr=function(){return vr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r0&&s[s.length-1])&&(h[0]===6||h[0]===2)){n=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]0)&&!(o=r.next()).done;)s.push(o.value)}catch(u){c={error:u}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(c)throw c.error}}return s}function uf(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;rl.jsx(Jt,{ref:f,viewBox:t,...o,...u,children:s.length?s:l.jsx("path",{fill:"currentColor",d:n})}));return c.displayName=r,c}function us(e){const{theme:t}=AS(),n=x3();return x.useMemo(()=>y3(t.direction,{...n,...e}),[e,t.direction,n])}var F3=Object.defineProperty,L3=(e,t,n)=>t in e?F3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rt=(e,t,n)=>(L3(e,typeof t!="symbol"?t+"":t,n),n);function tg(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 B3=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function ng(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function rg(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var df=typeof window<"u"?x.useLayoutEffect:x.useEffect,rc=e=>e,H3=class{constructor(){Rt(this,"descendants",new Map),Rt(this,"register",e=>{if(e!=null)return B3(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),Rt(this,"unregister",e=>{this.descendants.delete(e);const t=tg(Array.from(this.descendants.keys()));this.assignIndex(t)}),Rt(this,"destroy",()=>{this.descendants.clear()}),Rt(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),Rt(this,"count",()=>this.descendants.size),Rt(this,"enabledCount",()=>this.enabledValues().length),Rt(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),Rt(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),Rt(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),Rt(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),Rt(this,"first",()=>this.item(0)),Rt(this,"firstEnabled",()=>this.enabledItem(0)),Rt(this,"last",()=>this.item(this.descendants.size-1)),Rt(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),Rt(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),Rt(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),Rt(this,"next",(e,t=!0)=>{const n=ng(e,this.count(),t);return this.item(n)}),Rt(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=ng(r,this.enabledCount(),t);return this.enabledItem(o)}),Rt(this,"prev",(e,t=!0)=>{const n=rg(e,this.count()-1,t);return this.item(n)}),Rt(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=rg(r,this.enabledCount()-1,t);return this.enabledItem(o)}),Rt(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=tg(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 W3(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=>{W3(n,t)})}}function V3(...e){return x.useMemo(()=>ct(...e),e)}function U3(){const e=x.useRef(new H3);return df(()=>()=>e.current.destroy()),e.current}var[$3,x2]=Et({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function G3(e){const t=x2(),[n,r]=x.useState(-1),o=x.useRef(null);df(()=>()=>{o.current&&t.unregister(o.current)},[]),df(()=>{if(!o.current)return;const c=Number(o.current.dataset.index);n!=c&&!Number.isNaN(c)&&r(c)});const s=rc(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:ct(s,o)}}function rh(){return[rc($3),()=>rc(x2()),()=>U3(),o=>G3(o)]}var[q3,wc]=Et({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[Y3,oh]=Et({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[X3,MF,K3,Q3]=rh(),zi=he(function(t,n){const{getButtonProps:r}=oh(),o=r(t,n),c={display:"flex",alignItems:"center",width:"100%",outline:0,...wc().button};return l.jsx(oe.button,{...o,className:Ae("chakra-accordion__button",t.className),__css:c})});zi.displayName="AccordionButton";function ih(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(y,S)=>y!==S}=e,s=Ut(r),c=Ut(o),[u,f]=x.useState(n),h=t!==void 0,p=h?t:u,g=Ut(y=>{const C=typeof y=="function"?y(p):y;c(p,C)&&(h||f(C),s(C))},[h,s,p,c]);return[p,g]}function Z3(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...c}=e;tw(e),nw(e);const u=K3(),[f,h]=x.useState(-1);x.useEffect(()=>()=>{h(-1)},[]);const[p,g]=ih({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:p,setIndex:g,htmlProps:c,getAccordionItemProps:S=>{let C=!1;return S!==null&&(C=Array.isArray(p)?p.includes(S):p===S),{isOpen:C,onChange:k=>{if(S!==null)if(o&&Array.isArray(p)){const j=k?p.concat(S):p.filter(M=>M!==S);g(j)}else k?g(S):s&&g(-1)}}},focusedIndex:f,setFocusedIndex:h,descendants:u}}var[J3,ah]=Et({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function ew(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:c}=ah(),u=x.useRef(null),f=x.useId(),h=r??f,p=`accordion-button-${h}`,g=`accordion-panel-${h}`;rw(e);const{register:y,index:S,descendants:C}=Q3({disabled:t&&!n}),{isOpen:w,onChange:k}=s(S===-1?null:S);ow({isOpen:w,isDisabled:t});const j=()=>{k==null||k(!0)},M=()=>{k==null||k(!1)},P=x.useCallback(()=>{k==null||k(!w),c(S)},[S,c,w,k]),I=x.useCallback(z=>{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()}}[z.key];F&&(z.preventDefault(),F(z))},[C,S]),T=x.useCallback(()=>{c(S)},[c,S]),D=x.useCallback(function(V={},F=null){return{...V,type:"button",ref:ct(y,u,F),id:p,disabled:!!t,"aria-expanded":!!w,"aria-controls":g,onClick:Pe(V.onClick,P),onFocus:Pe(V.onFocus,T),onKeyDown:Pe(V.onKeyDown,I)}},[p,t,w,P,T,I,g,y]),_=x.useCallback(function(V={},F=null){return{...V,ref:F,role:"region",id:g,"aria-labelledby":p,hidden:!w}},[p,w,g]);return{isOpen:w,isDisabled:t,isFocusable:n,onOpen:j,onClose:M,getButtonProps:D,getPanelProps:_,htmlProps:o}}function tw(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;os({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function nw(e){os({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 rw(e){os({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 ow(e){os({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Ri(e){const{isOpen:t,isDisabled:n}=oh(),{reduceMotion:r}=ah(),o=Ae("chakra-accordion__icon",e.className),s=wc(),c={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return l.jsx(Jt,{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"})})}Ri.displayName="AccordionIcon";var Ni=he(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...c}=ew(t),f={...wc().container,overflowAnchor:"none"},h=x.useMemo(()=>c,[c]);return l.jsx(Y3,{value:h,children:l.jsx(oe.div,{ref:n,...s,className:Ae("chakra-accordion__item",o),__css:f,children:typeof r=="function"?r({isExpanded:!!c.isOpen,isDisabled:!!c.isDisabled}):r})})});Ni.displayName="AccordionItem";var Fi={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Uo={enter:{duration:.2,ease:Fi.easeOut},exit:{duration:.1,ease:Fi.easeIn}},Or={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})},iw=e=>e!=null&&parseInt(e.toString(),10)>0,og={exit:{height:{duration:.2,ease:Fi.ease},opacity:{duration:.3,ease:Fi.ease}},enter:{height:{duration:.3,ease:Fi.ease},opacity:{duration:.4,ease:Fi.ease}}},aw={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:iw(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:Or.exit(og.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:Or.enter(og.enter,o)}}},y2=x.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:c="auto",style:u,className:f,transition:h,transitionEnd:p,...g}=e,[y,S]=x.useState(!1);x.useEffect(()=>{const M=setTimeout(()=>{S(!0)});return()=>clearTimeout(M)},[]),os({condition:Boolean(s>0&&r),message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const C=parseFloat(s.toString())>0,w={startingHeight:s,endingHeight:c,animateOpacity:o,transition:y?h:{enter:{duration:0}},transitionEnd:{enter:p==null?void 0:p.enter,exit:r?p==null?void 0:p.exit:{...p==null?void 0:p.exit,display:C?"block":"none"}}},k=r?n:!0,j=n||r?"enter":"exit";return l.jsx(oa,{initial:!1,custom:w,children:k&&l.jsx(Wr.div,{ref:t,...g,className:Ae("chakra-collapse",f),style:{overflow:"hidden",display:"block",...u},custom:w,variants:aw,initial:r?"exit":!1,animate:j,exit:"exit"})})});y2.displayName="Collapse";var sw={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:Or.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:Or.exit(Uo.exit,n),transitionEnd:t==null?void 0:t.exit}}},b2={initial:"exit",animate:"enter",exit:"exit",variants:sw},lw=x.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:c,transitionEnd:u,delay:f,...h}=t,p=o||r?"enter":"exit",g=r?o&&r:!0,y={transition:c,transitionEnd:u,delay:f};return l.jsx(oa,{custom:y,children:g&&l.jsx(Wr.div,{ref:n,className:Ae("chakra-fade",s),custom:y,...b2,animate:p,...h})})});lw.displayName="Fade";var cw={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:Or.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:Or.enter(Uo.enter,n),transitionEnd:e==null?void 0:e.enter}}},S2={initial:"exit",animate:"enter",exit:"exit",variants:cw},uw=x.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:c=.95,className:u,transition:f,transitionEnd:h,delay:p,...g}=t,y=r?o&&r:!0,S=o||r?"enter":"exit",C={initialScale:c,reverse:s,transition:f,transitionEnd:h,delay:p};return l.jsx(oa,{custom:C,children:y&&l.jsx(Wr.div,{ref:n,className:Ae("chakra-offset-slide",u),...S2,animate:S,custom:C,...g})})});uw.displayName="ScaleFade";var dw={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:Or.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:Or.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:Or.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:dw},fw=x.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:c,offsetX:u=0,offsetY:f=8,transition:h,transitionEnd:p,delay:g,...y}=t,S=r?o&&r:!0,C=o||r?"enter":"exit",w={offsetX:u,offsetY:f,reverse:s,transition:h,transitionEnd:p,delay:g};return l.jsx(oa,{custom:w,children:S&&l.jsx(Wr.div,{ref:n,className:Ae("chakra-offset-slide",c),custom:w,...ff,animate:C,...y})})});fw.displayName="SlideFade";var Li=he(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:c}=ah(),{getPanelProps:u,isOpen:f}=oh(),h=u(s,n),p=Ae("chakra-accordion__panel",r),g=wc();c||delete h.hidden;const y=l.jsx(oe.div,{...h,__css:g.panel,className:p});return c?y:l.jsx(y2,{in:f,...o,children:y})});Li.displayName="AccordionPanel";var sh=he(function({children:t,reduceMotion:n,...r},o){const s=fn("Accordion",r),c=At(r),{htmlProps:u,descendants:f,...h}=Z3(c),p=x.useMemo(()=>({...h,reduceMotion:!!n}),[h,n]);return l.jsx(X3,{value:f,children:l.jsx(J3,{value:p,children:l.jsx(q3,{value:s,children:l.jsx(oe.div,{ref:o,...u,className:Ae("chakra-accordion",r.className),__css:s.root,children:t})})})})});sh.displayName="Accordion";var hf=he(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 hw(e){const{loading:t,src:n,srcSet:r,onLoad:o,onError:s,crossOrigin:c,sizes:u,ignoreFallback:f}=e,[h,p]=x.useState("pending");x.useEffect(()=>{p(n?"loading":"pending")},[n]);const g=x.useRef(),y=x.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=w=>{S(),p("loaded"),o==null||o(w)},C.onerror=w=>{S(),p("failed"),s==null||s(w)},g.current=C},[n,c,r,u,o,s,t]),S=()=>{g.current&&(g.current.onload=null,g.current.onerror=null,g.current=null)};return Ui(()=>{if(!f)return h==="loading"&&y(),()=>{S()}},[h,y,f]),f?"loaded":h}var pw=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function mw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var ds=he(function(t,n){const{fallbackSrc:r,fallback:o,src:s,srcSet:c,align:u,fit:f,loading:h,ignoreFallback:p,crossOrigin:g,fallbackStrategy:y="beforeLoadOrError",referrerPolicy:S,...C}=t,w=r!==void 0||o!==void 0,k=h!=null||p||!w,j=hw({...t,ignoreFallback:k}),M=pw(j,y),P={ref:n,objectFit:f,objectPosition:u,...k?C:mw(C,["onError","onLoad"])};return M?o||l.jsx(oe.img,{as:hf,className:"chakra-image__placeholder",src:r,...P}):l.jsx(oe.img,{as:hf,src:s,srcSet:c,crossOrigin:g,loading:h,referrerPolicy:S,className:"chakra-image",...P})});ds.displayName="Image";function lh(e){return x.Children.toArray(e).filter(t=>x.isValidElement(t))}var[vw,gw]=Et({strict:!1,name:"ButtonGroupContext"}),xw={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}}},yw={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},en=he(function(t,n){const{size:r,colorScheme:o,variant:s,className:c,spacing:u="0.5rem",isAttached:f,isDisabled:h,orientation:p="horizontal",...g}=t,y=Ae("chakra-button__group",c),S=x.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:h}),[r,o,s,h]);let C={display:"inline-flex",...f?xw[p]:yw[p](u)};const w=p==="vertical";return l.jsx(vw,{value:S,children:l.jsx(oe.div,{ref:n,role:"group",__css:C,className:y,"data-attached":f?"":void 0,"data-orientation":p,flexDir:w?"column":void 0,...g})})});en.displayName="ButtonGroup";function bw(e){const[t,n]=x.useState(!e);return{ref:x.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function pf(e){const{children:t,className:n,...r}=e,o=x.isValidElement(t)?x.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=Ae("chakra-button__icon",n);return l.jsx(oe.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}pf.displayName="ButtonIcon";function oc(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=l.jsx(Qf,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:c,...u}=e,f=Ae("chakra-button__spinner",s),h=n==="start"?"marginEnd":"marginStart",p=x.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[h]:t?r:0,fontSize:"1em",lineHeight:"normal",...c}),[c,t,h,r]);return l.jsx(oe.div,{className:f,...u,__css:p,children:o})}oc.displayName="ButtonSpinner";var ni=he((e,t)=>{const n=gw(),r=mo("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:c,children:u,leftIcon:f,rightIcon:h,loadingText:p,iconSpacing:g="0.5rem",type:y,spinner:S,spinnerPlacement:C="start",className:w,as:k,...j}=At(e),M=x.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:I}=bw(k),T={rightIcon:h,leftIcon:f,iconSpacing:g,children:u};return l.jsxs(oe.button,{ref:V3(t,P),as:k,type:y??I,"data-active":Ye(c),"data-loading":Ye(s),__css:M,className:Ae("chakra-button",w),...j,disabled:o||s,children:[s&&C==="start"&&l.jsx(oc,{className:"chakra-button__spinner--start",label:p,placement:"start",spacing:g,children:S}),s?p||l.jsx(oe.span,{opacity:0,children:l.jsx(ig,{...T})}):l.jsx(ig,{...T}),s&&C==="end"&&l.jsx(oc,{className:"chakra-button__spinner--end",label:p,placement:"end",spacing:g,children:S})]})});ni.displayName="Button";function ig(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 co=he((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...c}=e,u=n||r,f=x.isValidElement(u)?x.cloneElement(u,{"aria-hidden":!0,focusable:!1}):null;return l.jsx(ni,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...c,children:f})});co.displayName="IconButton";var[TF,Sw]=Et({name:"CheckboxGroupContext",strict:!1});function Cw(e){return l.jsx(oe.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 ww(e){return l.jsx(oe.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 kw(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?ww:Cw;return n||t?l.jsx(oe.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:l.jsx(o,{...r})}):null}var[jw,C2]=Et({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Ew,ri]=Et({strict:!1,name:"FormControlContext"});function Pw(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...c}=e,u=x.useId(),f=t||`field-${u}`,h=`${f}-label`,p=`${f}-feedback`,g=`${f}-helptext`,[y,S]=x.useState(!1),[C,w]=x.useState(!1),[k,j]=x.useState(!1),M=x.useCallback((_={},z=null)=>({id:g,..._,ref:ct(z,V=>{V&&w(!0)})}),[g]),P=x.useCallback((_={},z=null)=>{var V,F;return{..._,ref:z,"data-focus":Ye(k),"data-disabled":Ye(o),"data-invalid":Ye(r),"data-readonly":Ye(s),id:(V=_.id)!=null?V:h,htmlFor:(F=_.htmlFor)!=null?F:f}},[f,o,k,r,s,h]),I=x.useCallback((_={},z=null)=>({id:p,..._,ref:ct(z,V=>{V&&S(!0)}),"aria-live":"polite"}),[p]),T=x.useCallback((_={},z=null)=>({..._,...c,ref:z,role:"group"}),[c]),D=x.useCallback((_={},z=null)=>({..._,ref:z,role:"presentation","aria-hidden":!0,children:_.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!k,onFocus:()=>j(!0),onBlur:()=>j(!1),hasFeedbackText:y,setHasFeedbackText:S,hasHelpText:C,setHasHelpText:w,id:f,labelId:h,feedbackId:p,helpTextId:g,htmlProps:c,getHelpTextProps:M,getErrorMessageProps:I,getRootProps:T,getLabelProps:P,getRequiredIndicatorProps:D}}var rt=he(function(t,n){const r=fn("Form",t),o=At(t),{getRootProps:s,htmlProps:c,...u}=Pw(o),f=Ae("chakra-form-control",t.className);return l.jsx(Ew,{value:u,children:l.jsx(jw,{value:r,children:l.jsx(oe.div,{...s({},n),className:f,__css:r.container})})})});rt.displayName="FormControl";var wt=he(function(t,n){const r=ri(),o=C2(),s=Ae("chakra-form__helper-text",t.className);return l.jsx(oe.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});wt.displayName="FormHelperText";var[Iw,Mw]=Et({name:"FormErrorStylesContext",errorMessage:`useFormErrorStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),kt=he((e,t)=>{const n=fn("FormError",e),r=At(e),o=ri();return o!=null&&o.isInvalid?l.jsx(Iw,{value:n,children:l.jsx(oe.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});kt.displayName="FormErrorMessage";var Tw=he((e,t)=>{const n=Mw(),r=ri();if(!(r!=null&&r.isInvalid))return null;const o=Ae("chakra-form__error-icon",e.className);return l.jsx(Jt,{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"})})});Tw.displayName="FormErrorIcon";var st=he(function(t,n){var r;const o=mo("FormLabel",t),s=At(t),{className:c,children:u,requiredIndicator:f=l.jsx(w2,{}),optionalIndicator:h=null,...p}=s,g=ri(),y=(r=g==null?void 0:g.getLabelProps(p,n))!=null?r:{ref:n,...p};return l.jsxs(oe.label,{...y,className:Ae("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[u,g!=null&&g.isRequired?f:h]})});st.displayName="FormLabel";var w2=he(function(t,n){const r=ri(),o=C2();if(!(r!=null&&r.isRequired))return null;const s=Ae("chakra-form__required-indicator",t.className);return l.jsx(oe.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});w2.displayName="RequiredIndicator";function ch(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=uh(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":Dr(n),"aria-required":Dr(o),"aria-readonly":Dr(r)}}function uh(e){var t,n,r;const o=ri(),{id:s,disabled:c,readOnly:u,required:f,isRequired:h,isInvalid:p,isReadOnly:g,isDisabled:y,onFocus:S,onBlur:C,...w}=e,k=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&k.push(o.feedbackId),o!=null&&o.hasHelpText&&k.push(o.helpTextId),{...w,"aria-describedby":k.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=c??y)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=u??g)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=f??h)!=null?r:o==null?void 0:o.isRequired,isInvalid:p??(o==null?void 0:o.isInvalid),onFocus:Pe(o==null?void 0:o.onFocus,S),onBlur:Pe(o==null?void 0:o.onBlur,C)}}var _w={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},ag=!1,fs=null,Xo=!1,mf=!1,vf=new Set;function dh(e,t){vf.forEach(n=>n(e,t))}var Dw=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function Ow(e){return!(e.metaKey||!Dw&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function sg(e){Xo=!0,Ow(e)&&(fs="keyboard",dh("keyboard",e))}function ji(e){if(fs="pointer",e.type==="mousedown"||e.type==="pointerdown"){Xo=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;dh("pointer",e)}}function Aw(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function zw(e){Aw(e)&&(Xo=!0,fs="virtual")}function Rw(e){e.target===window||e.target===document||(!Xo&&!mf&&(fs="virtual",dh("virtual",e)),Xo=!1,mf=!1)}function Nw(){Xo=!1,mf=!0}function lg(){return fs!=="pointer"}function Fw(){if(typeof window>"u"||ag)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Xo=!0,e.apply(this,n)},document.addEventListener("keydown",sg,!0),document.addEventListener("keyup",sg,!0),document.addEventListener("click",zw,!0),window.addEventListener("focus",Rw,!0),window.addEventListener("blur",Nw,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",ji,!0),document.addEventListener("pointermove",ji,!0),document.addEventListener("pointerup",ji,!0)):(document.addEventListener("mousedown",ji,!0),document.addEventListener("mousemove",ji,!0),document.addEventListener("mouseup",ji,!0)),ag=!0}function k2(e){Fw(),e(lg());const t=()=>e(lg());return vf.add(t),()=>{vf.delete(t)}}function Lw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function j2(e={}){const t=uh(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:c,onBlur:u,onFocus:f,"aria-describedby":h}=t,{defaultChecked:p,isChecked:g,isFocusable:y,onChange:S,isIndeterminate:C,name:w,value:k,tabIndex:j=void 0,"aria-label":M,"aria-labelledby":P,"aria-invalid":I,...T}=e,D=Lw(T,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),_=Ut(S),z=Ut(u),V=Ut(f),[F,L]=x.useState(!1),[X,$]=x.useState(!1),[Q,re]=x.useState(!1),[ie,U]=x.useState(!1);x.useEffect(()=>k2(L),[]);const K=x.useRef(null),[ne,ce]=x.useState(!0),[Re,ze]=x.useState(!!p),Me=g!==void 0,J=Me?g:Re,ue=x.useCallback(ge=>{if(r||n){ge.preventDefault();return}Me||ze(J?ge.target.checked:C?!0:ge.target.checked),_==null||_(ge)},[r,n,J,Me,C,_]);Ui(()=>{K.current&&(K.current.indeterminate=Boolean(C))},[C]),ti(()=>{n&&$(!1)},[n,$]),Ui(()=>{const ge=K.current;ge!=null&&ge.form&&(ge.form.onreset=()=>{ze(!!p)})},[]);const Ie=n&&!y,Be=x.useCallback(ge=>{ge.key===" "&&U(!0)},[U]),Ne=x.useCallback(ge=>{ge.key===" "&&U(!1)},[U]);Ui(()=>{if(!K.current)return;K.current.checked!==J&&ze(K.current.checked)},[K.current]);const Ge=x.useCallback((ge={},Te=null)=>{const et=Ve=>{X&&Ve.preventDefault(),U(!0)};return{...ge,ref:Te,"data-active":Ye(ie),"data-hover":Ye(Q),"data-checked":Ye(J),"data-focus":Ye(X),"data-focus-visible":Ye(X&&F),"data-indeterminate":Ye(C),"data-disabled":Ye(n),"data-invalid":Ye(s),"data-readonly":Ye(r),"aria-hidden":!0,onMouseDown:Pe(ge.onMouseDown,et),onMouseUp:Pe(ge.onMouseUp,()=>U(!1)),onMouseEnter:Pe(ge.onMouseEnter,()=>re(!0)),onMouseLeave:Pe(ge.onMouseLeave,()=>re(!1))}},[ie,J,n,X,F,Q,C,s,r]),Qe=x.useCallback((ge={},Te=null)=>({...D,...ge,ref:ct(Te,et=>{et&&ce(et.tagName==="LABEL")}),onClick:Pe(ge.onClick,()=>{var et;ne||((et=K.current)==null||et.click(),requestAnimationFrame(()=>{var Ve;(Ve=K.current)==null||Ve.focus()}))}),"data-disabled":Ye(n),"data-checked":Ye(J),"data-invalid":Ye(s)}),[D,n,J,s,ne]),ve=x.useCallback((ge={},Te=null)=>({...ge,ref:ct(K,Te),type:"checkbox",name:w,value:k,id:c,tabIndex:j,onChange:Pe(ge.onChange,ue),onBlur:Pe(ge.onBlur,z,()=>$(!1)),onFocus:Pe(ge.onFocus,V,()=>$(!0)),onKeyDown:Pe(ge.onKeyDown,Be),onKeyUp:Pe(ge.onKeyUp,Ne),required:o,checked:J,disabled:Ie,readOnly:r,"aria-label":M,"aria-labelledby":P,"aria-invalid":I?Boolean(I):s,"aria-describedby":h,"aria-disabled":n,style:_w}),[w,k,c,ue,z,V,Be,Ne,o,J,Ie,r,M,P,I,s,h,n,j]),_e=x.useCallback((ge={},Te=null)=>({...ge,ref:Te,onMouseDown:Pe(ge.onMouseDown,cg),onTouchStart:Pe(ge.onTouchStart,cg),"data-disabled":Ye(n),"data-checked":Ye(J),"data-invalid":Ye(s)}),[J,n,s]);return{state:{isInvalid:s,isFocused:X,isChecked:J,isActive:ie,isHovered:Q,isIndeterminate:C,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:Qe,getCheckboxProps:Ge,getInputProps:ve,getLabelProps:_e,htmlProps:D}}function cg(e){e.preventDefault(),e.stopPropagation()}var Bw={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},Hw={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},Ww=Jo({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),Vw=Jo({from:{opacity:0},to:{opacity:1}}),Uw=Jo({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),E2=he(function(t,n){const r=Sw(),o={...r,...t},s=fn("Checkbox",o),c=At(t),{spacing:u="0.5rem",className:f,children:h,iconColor:p,iconSize:g,icon:y=l.jsx(kw,{}),isChecked:S,isDisabled:C=r==null?void 0:r.isDisabled,onChange:w,inputProps:k,...j}=c;let M=S;r!=null&&r.value&&c.value&&(M=r.value.includes(c.value));let P=w;r!=null&&r.onChange&&c.value&&(P=yc(r.onChange,w));const{state:I,getInputProps:T,getCheckboxProps:D,getLabelProps:_,getRootProps:z}=j2({...j,isDisabled:C,isChecked:M,onChange:P}),V=x.useMemo(()=>({animation:I.isIndeterminate?`${Vw} 20ms linear, ${Uw} 200ms linear`:`${Ww} 200ms linear`,fontSize:g,color:p,...s.icon}),[p,g,,I.isIndeterminate,s.icon]),F=x.cloneElement(y,{__css:V,isIndeterminate:I.isIndeterminate,isChecked:I.isChecked});return l.jsxs(oe.label,{__css:{...Hw,...s.container},className:Ae("chakra-checkbox",f),...z(),children:[l.jsx("input",{className:"chakra-checkbox__input",...T(k,n)}),l.jsx(oe.span,{__css:{...Bw,...s.control},className:"chakra-checkbox__control",...D(),children:F}),h&&l.jsx(oe.span,{className:"chakra-checkbox__label",..._(),__css:{marginStart:u,...s.label},children:h})]})});E2.displayName="Checkbox";function $w(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function fh(e,t){let n=$w(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 ug(e,t,n){return(e-t)*100/(n-t)}function Gw(e,t,n){return(n-t)*e+t}function dg(e,t,n){const r=Math.round((e-t)/n)*n+t,o=gf(n);return fh(r,o)}function $l(e,t,n){return e==null?e:(n{var F;return r==null?"":(F=gd(r,s,n))!=null?F:""}),y=typeof o<"u",S=y?o:p,C=P2(no(S),s),w=n??C,k=x.useCallback(F=>{F!==S&&(y||g(F.toString()),h==null||h(F.toString(),no(F)))},[h,y,S]),j=x.useCallback(F=>{let L=F;return f&&(L=$l(L,c,u)),fh(L,w)},[w,f,u,c]),M=x.useCallback((F=s)=>{let L;S===""?L=no(F):L=no(S)+F,L=j(L),k(L)},[j,s,k,S]),P=x.useCallback((F=s)=>{let L;S===""?L=no(-F):L=no(S)-F,L=j(L),k(L)},[j,s,k,S]),I=x.useCallback(()=>{var F;let L;r==null?L="":L=(F=gd(r,s,n))!=null?F:c,k(L)},[r,n,s,k,c]),T=x.useCallback(F=>{var L;const X=(L=gd(F,s,w))!=null?L:c;k(X)},[w,s,k,c]),D=no(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 Yw(e){return"current"in e}var I2=()=>typeof window<"u";function Xw(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var Kw=e=>I2()&&e.test(navigator.vendor),Qw=e=>I2()&&e.test(Xw()),Zw=()=>Qw(/mac|iphone|ipad|ipod/i),Jw=()=>Zw()&&Kw(/apple/i);function e5(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(!Jw()||!r)return;const c=s.target,f=(n??[t]).some(h=>{const p=Yw(h)?h.current:h;return(p==null?void 0:p.contains(c))||p===c});o().activeElement!==c&&f&&(s.preventDefault(),c.focus())})}var lt={},t5={get exports(){return lt},set exports(e){lt=e}},n5="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",r5=n5,o5=r5;function M2(){}function T2(){}T2.resetWarningCache=M2;var i5=function(){function e(r,o,s,c,u,f){if(f!==o5){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:T2,resetWarningCache:M2};return n.PropTypes=n,n};t5.exports=i5();var xf="data-focus-lock",_2="data-focus-lock-disabled",a5="data-no-focus-lock",s5="data-autofocus-inside",l5="data-no-autofocus";function c5(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function u5(e,t){var n=x.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 D2(e,t){return u5(t||null,function(n){return e.forEach(function(r){return c5(r,n)})})}var xd={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"};function O2(e){return e}function A2(e,t){t===void 0&&(t=O2);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var c=t(s,r);return n.push(c),function(){n=n.filter(function(u){return u!==c})}},assignSyncMedium:function(s){for(r=!0;n.length;){var c=n;n=[],c.forEach(s)}n={push:function(u){return s(u)},filter:function(){return n}}},assignMedium:function(s){r=!0;var c=[];if(n.length){var u=n;n=[],u.forEach(s),c=n}var f=function(){var p=c;c=[],p.forEach(s)},h=function(){return Promise.resolve().then(f)};h(),n={push:function(p){c.push(p),h()},filter:function(p){return c=c.filter(p),n}}}};return o}function hh(e,t){return t===void 0&&(t=O2),A2(e,t)}function z2(e){e===void 0&&(e={});var t=A2(null);return t.options=vr({async:!0,ssr:!1},e),t}var R2=function(e){var t=e.sideCar,n=g2(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,vr({},n))};R2.isSideCarExport=!0;function d5(e,t){return e.useMedium(t),R2}var N2=hh({},function(e){var t=e.target,n=e.currentTarget;return{target:t,currentTarget:n}}),F2=hh(),f5=hh(),h5=z2({async:!0}),p5=[],ph=x.forwardRef(function(t,n){var r,o=x.useState(),s=o[0],c=o[1],u=x.useRef(),f=x.useRef(!1),h=x.useRef(null),p=t.children,g=t.disabled,y=t.noFocusGuards,S=t.persistentFocus,C=t.crossFrame,w=t.autoFocus;t.allowTextSelection;var k=t.group,j=t.className,M=t.whiteList,P=t.hasPositiveIndices,I=t.shards,T=I===void 0?p5:I,D=t.as,_=D===void 0?"div":D,z=t.lockProps,V=z===void 0?{}:z,F=t.sideCar,L=t.returnFocus,X=t.focusOptions,$=t.onActivation,Q=t.onDeactivation,re=x.useState({}),ie=re[0],U=x.useCallback(function(){h.current=h.current||document&&document.activeElement,u.current&&$&&$(u.current),f.current=!0},[$]),K=x.useCallback(function(){f.current=!1,Q&&Q(u.current)},[Q]);x.useEffect(function(){g||(h.current=null)},[]);var ne=x.useCallback(function(Be){var Ne=h.current;if(Ne&&Ne.focus){var Ge=typeof L=="function"?L(Ne):L;if(Ge){var Qe=typeof Ge=="object"?Ge:void 0;h.current=null,Be?Promise.resolve().then(function(){return Ne.focus(Qe)}):Ne.focus(Qe)}}},[L]),ce=x.useCallback(function(Be){f.current&&N2.useMedium(Be)},[]),Re=F2.useMedium,ze=x.useCallback(function(Be){u.current!==Be&&(u.current=Be,c(Be))},[]),Me=Ql((r={},r[_2]=g&&"disabled",r[xf]=k,r),V),J=y!==!0,ue=J&&y!=="tail",Ie=D2([n,ze]);return x.createElement(x.Fragment,null,J&&[x.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:g?-1:0,style:xd}),P?x.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:g?-1:1,style:xd}):null],!g&&x.createElement(F,{id:ie,sideCar:h5,observed:s,disabled:g,persistentFocus:S,crossFrame:C,autoFocus:w,whiteList:M,shards:T,onActivation:U,onDeactivation:K,returnFocus:ne,focusOptions:X}),x.createElement(_,Ql({ref:Ie},Me,{className:j,onBlur:Re,onFocus:ce}),p),ue&&x.createElement("div",{"data-focus-guard":!0,tabIndex:g?-1:0,style:xd}))});ph.propTypes={};ph.defaultProps={children:void 0,disabled:!1,returnFocus:!1,focusOptions:void 0,noFocusGuards:!1,autoFocus:!0,persistentFocus:!1,crossFrame:!0,hasPositiveIndices:void 0,allowTextSelection:void 0,group:void 0,className:void 0,whiteList:void 0,shards:void 0,as:"div",lockProps:{},onActivation:void 0,onDeactivation:void 0};const L2=ph;function mh(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,zS(e,t)}function m5(e,t){function n(r){return r.displayName||r.name||"Component"}return function(o){var s=[],c;function u(){c=e(s.map(function(h){return h.props})),t(c)}var f=function(h){mh(p,h);function p(){return h.apply(this,arguments)||this}p.peek=function(){return c};var g=p.prototype;return g.componentDidMount=function(){s.push(this),u()},g.componentDidUpdate=function(){u()},g.componentWillUnmount=function(){var S=s.indexOf(this);s.splice(S,1),u()},g.render=function(){return ke.createElement(o,this.props)},p}(x.PureComponent);return RS(f,"displayName","SideEffect("+n(o)+")"),f}}var wr=function(e){for(var t=Array(e.length),n=0;n=0}).sort(w5)},k5=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],gh=k5.join(","),j5="".concat(gh,", [data-focus-guard]"),X2=function(e,t){return wr((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?j5:gh)?[r]:[],X2(r))},[])},E5=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?kc([e.contentDocument.body],t):[e]},kc=function(e,t){return e.reduce(function(n,r){var o,s=X2(r,t),c=(o=[]).concat.apply(o,s.map(function(u){return E5(u,t)}));return n.concat(c,r.parentNode?wr(r.parentNode.querySelectorAll(gh)).filter(function(u){return u===r}):[])},[])},P5=function(e){var t=e.querySelectorAll("[".concat(s5,"]"));return wr(t).map(function(n){return kc([n])}).reduce(function(n,r){return n.concat(r)},[])},xh=function(e,t){return wr(e).filter(function(n){return V2(t,n)}).filter(function(n){return b5(n)})},fg=function(e,t){return t===void 0&&(t=new Map),wr(e).filter(function(n){return U2(t,n)})},yf=function(e,t,n){return Y2(xh(kc(e,n),t),!0,n)},hg=function(e,t){return Y2(xh(kc(e),t),!1)},I5=function(e,t){return xh(P5(e),t)},Gi=function(e,t){return e.shadowRoot?Gi(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:wr(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?Gi(o,t):!1}return Gi(n,t)})},M5=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},yh=function(e){var t=ic(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(xf);return n.push.apply(n,o?M5(wr(K2(r).querySelectorAll("[".concat(xf,'="').concat(o,'"]:not([').concat(_2,'="disabled"])')))):[r]),n},[])},T5=function(e){try{return e()}catch{return}},Xa=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Xa(t.shadowRoot):t instanceof HTMLIFrameElement&&T5(function(){return t.contentWindow.document})?Xa(t.contentWindow.document):t}},_5=function(e,t){return e===t},D5=function(e,t){return Boolean(wr(e.querySelectorAll("iframe")).some(function(n){return _5(n,t)}))},Q2=function(e,t){return t===void 0&&(t=Xa(B2(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:yh(e).some(function(n){return Gi(n,t)||D5(n,t)})},O5=function(e){e===void 0&&(e=document);var t=Xa(e);return t?wr(e.querySelectorAll("[".concat(a5,"]"))).some(function(n){return Gi(n,t)}):!1},A5=function(e,t){return t.filter(q2).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},bh=function(e,t){return q2(e)&&e.name?A5(e,t):e},z5=function(e){var t=new Set;return e.forEach(function(n){return t.add(bh(n,e))}),e.filter(function(n){return t.has(n)})},pg=function(e){return e[0]&&e.length>1?bh(e[0],e):e[0]},mg=function(e,t){return e.length>1?e.indexOf(bh(e[t],e)):t},Z2="NEW_FOCUS",R5=function(e,t,n,r){var o=e.length,s=e[0],c=e[o-1],u=vh(n);if(!(n&&e.indexOf(n)>=0)){var f=n!==void 0?t.indexOf(n):-1,h=r?t.indexOf(r):f,p=r?e.indexOf(r):-1,g=f-h,y=t.indexOf(s),S=t.indexOf(c),C=z5(t),w=n!==void 0?C.indexOf(n):-1,k=w-(r?C.indexOf(r):f),j=mg(e,0),M=mg(e,o-1);if(f===-1||p===-1)return Z2;if(!g&&p>=0)return p;if(f<=y&&u&&Math.abs(g)>1)return M;if(f>=S&&u&&Math.abs(g)>1)return j;if(g&&Math.abs(k)>1)return p;if(f<=y)return M;if(f>S)return j;if(g)return Math.abs(g)>1?p:(o+p+g)%o}},N5=function(e){return function(t){var n,r=(n=$2(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},F5=function(e,t,n){var r=e.map(function(s){var c=s.node;return c}),o=fg(r.filter(N5(n)));return o&&o.length?pg(o):pg(fg(t))},bf=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&bf(e.parentNode.host||e.parentNode,t),t},yd=function(e,t){for(var n=bf(e),r=bf(t),o=0;o=0)return s}return!1},J2=function(e,t,n){var r=ic(e),o=ic(t),s=r[0],c=!1;return o.filter(Boolean).forEach(function(u){c=yd(c||u,u)||c,n.filter(Boolean).forEach(function(f){var h=yd(s,f);h&&(!c||Gi(h,c)?c=h:c=yd(h,c))})}),c},L5=function(e,t){return e.reduce(function(n,r){return n.concat(I5(r,t))},[])},B5=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(C5)},H5=function(e,t){var n=Xa(ic(e).length>0?document:B2(e).ownerDocument),r=yh(e).filter(ac),o=J2(n||e,e,r),s=new Map,c=hg(r,s),u=yf(r,s).filter(function(S){var C=S.node;return ac(C)});if(!(!u[0]&&(u=c,!u[0]))){var f=hg([o],s).map(function(S){var C=S.node;return C}),h=B5(f,u),p=h.map(function(S){var C=S.node;return C}),g=R5(p,f,n,t);if(g===Z2){var y=F5(c,p,L5(r,s));if(y)return{node:y};console.warn("focus-lock: cannot find any node to move focus into");return}return g===void 0?g:h[g]}},W5=function(e){var t=yh(e).filter(ac),n=J2(e,e,t),r=new Map,o=yf([n],r,!0),s=yf(t,r).filter(function(c){var u=c.node;return ac(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:vh(u)}})},V5=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},bd=0,Sd=!1,ex=function(e,t,n){n===void 0&&(n={});var r=H5(e,t);if(!Sd&&r){if(bd>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Sd=!0,setTimeout(function(){Sd=!1},1);return}bd++,V5(r.node,n.focusOptions),bd--}};function tx(e){var t=window,n=t.setImmediate;typeof n<"u"?n(e):setTimeout(e,1)}var U5=function(){return document&&document.activeElement===document.body},$5=function(){return U5()||O5()},qi=null,Bi=null,Yi=null,Ka=!1,G5=function(){return!0},q5=function(t){return(qi.whiteList||G5)(t)},Y5=function(t,n){Yi={observerNode:t,portaledElement:n}},X5=function(t){return Yi&&Yi.portaledElement===t};function vg(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 K5=function(t){return t&&"current"in t?t.current:t},Q5=function(t){return t?Boolean(Ka):Ka==="meanwhile"},Z5=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},J5=function(t,n){return n.some(function(r){return Z5(t,r,r)})},sc=function(){var t=!1;if(qi){var n=qi,r=n.observed,o=n.persistentFocus,s=n.autoFocus,c=n.shards,u=n.crossFrame,f=n.focusOptions,h=r||Yi&&Yi.portaledElement,p=document&&document.activeElement;if(h){var g=[h].concat(c.map(K5).filter(Boolean));if((!p||q5(p))&&(o||Q5(u)||!$5()||!Bi&&s)&&(h&&!(Q2(g)||p&&J5(p,g)||X5(p))&&(document&&!Bi&&p&&!s?(p.blur&&p.blur(),document.body.focus()):(t=ex(g,Bi,{focusOptions:f}),Yi={})),Ka=!1,Bi=document&&document.activeElement),document){var y=document&&document.activeElement,S=W5(g),C=S.map(function(w){var k=w.node;return k}).indexOf(y);C>-1&&(S.filter(function(w){var k=w.guard,j=w.node;return k&&j.dataset.focusAutoGuard}).forEach(function(w){var k=w.node;return k.removeAttribute("tabIndex")}),vg(C,S.length,1,S),vg(C,-1,-1,S))}}}return t},nx=function(t){sc()&&t&&(t.stopPropagation(),t.preventDefault())},Sh=function(){return tx(sc)},e6=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||Y5(r,n)},t6=function(){return null},rx=function(){Ka="just",setTimeout(function(){Ka="meanwhile"},0)},n6=function(){document.addEventListener("focusin",nx),document.addEventListener("focusout",Sh),window.addEventListener("blur",rx)},r6=function(){document.removeEventListener("focusin",nx),document.removeEventListener("focusout",Sh),window.removeEventListener("blur",rx)};function o6(e){return e.filter(function(t){var n=t.disabled;return!n})}function i6(e){var t=e.slice(-1)[0];t&&!qi&&n6();var n=qi,r=n&&t&&t.id===n.id;qi=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(Bi=null,(!r||n.observed!==t.observed)&&t.onActivation(),sc(),tx(sc)):(r6(),Bi=null)}N2.assignSyncMedium(e6);F2.assignMedium(Sh);f5.assignMedium(function(e){return e({moveFocusInside:ex,focusInside:Q2})});const a6=m5(o6,i6)(t6);var ox=x.forwardRef(function(t,n){return x.createElement(L2,Ql({sideCar:a6,ref:n},t))}),ix=L2.propTypes||{};ix.sideCar;th(ix,["sideCar"]);ox.propTypes={};const gg=ox;function ax(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function sx(e){var t;if(!ax(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function s6(e){var t,n;return(n=(t=lx(e))==null?void 0:t.defaultView)!=null?n:window}function lx(e){return ax(e)?e.ownerDocument:document}function l6(e){return lx(e).activeElement}var cx=e=>e.hasAttribute("tabindex"),c6=e=>cx(e)&&e.tabIndex===-1;function u6(e){return Boolean(e.getAttribute("disabled"))===!0||Boolean(e.getAttribute("aria-disabled"))===!0}function ux(e){return e.parentElement&&ux(e.parentElement)?!0:e.hidden}function d6(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function dx(e){if(!sx(e)||ux(e)||u6(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]():d6(e)?!0:cx(e)}function f6(e){return e?sx(e)&&dx(e)&&!c6(e):!1}var h6=["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]"],p6=h6.join(),m6=e=>e.offsetWidth>0&&e.offsetHeight>0;function fx(e){const t=Array.from(e.querySelectorAll(p6));return t.unshift(e),t.filter(n=>dx(n)&&m6(n))}var xg,v6=(xg=gg.default)!=null?xg:gg,hx=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:c,autoFocus:u,persistentFocus:f,lockFocusAcrossFrames:h}=e,p=x.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&fx(r.current).length===0&&requestAnimationFrame(()=>{var C;(C=r.current)==null||C.focus()})},[t,r]),g=x.useCallback(()=>{var S;(S=n==null?void 0:n.current)==null||S.focus()},[n]),y=o&&!n;return l.jsx(v6,{crossFrame:h,persistentFocus:f,autoFocus:u,disabled:c,onActivation:p,onDeactivation:g,returnFocus:y,children:s})};hx.displayName="FocusLock";var g6=T3?x.useLayoutEffect:x.useEffect;function Sf(e,t=[]){const n=x.useRef(e);return g6(()=>{n.current=e}),x.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function x6(e,t,n,r){const o=Sf(t);return x.useEffect(()=>{var s;const c=(s=Av(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=Av(n))!=null?s:document).removeEventListener(e,o,r)}}function y6(e,t){const n=x.useId();return x.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function b6(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function uo(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=Sf(n),c=Sf(t),[u,f]=x.useState(e.defaultIsOpen||!1),[h,p]=b6(r,u),g=y6(o,"disclosure"),y=x.useCallback(()=>{h||f(!1),c==null||c()},[h,c]),S=x.useCallback(()=>{h||f(!0),s==null||s()},[h,s]),C=x.useCallback(()=>{(p?y:S)()},[p,S,y]);return{isOpen:!!p,onOpen:S,onClose:y,onToggle:C,isControlled:h,getButtonProps:(w={})=>({...w,"aria-expanded":p,"aria-controls":g,onClick:NS(w.onClick,C)}),getDisclosureProps:(w={})=>({...w,hidden:!p,id:g})}}var Ch=he(function(t,n){const{htmlSize:r,...o}=t,s=fn("Input",o),c=At(o),u=ch(c),f=Ae("chakra-input",t.className);return l.jsx(oe.input,{size:r,...u,__css:s.field,ref:n,className:f})});Ch.displayName="Input";Ch.id="Input";var[S6,px]=Et({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),wh=he(function(t,n){const r=fn("List",t),{children:o,styleType:s="none",stylePosition:c,spacing:u,...f}=At(t),h=lh(o),g=u?{["& > *:not(style) ~ *:not(style)"]:{mt:u}}:{};return l.jsx(S6,{value:r,children:l.jsx(oe.ul,{ref:n,listStyleType:s,listStylePosition:c,role:"list",__css:{...r.container,...g},...f,children:h})})});wh.displayName="List";var C6=he((e,t)=>{const{as:n,...r}=e;return l.jsx(wh,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});C6.displayName="OrderedList";var mx=he(function(t,n){const{as:r,...o}=t;return l.jsx(wh,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});mx.displayName="UnorderedList";var Fa=he(function(t,n){const r=px();return l.jsx(oe.li,{ref:n,...t,__css:r.item})});Fa.displayName="ListItem";var w6=he(function(t,n){const r=px();return l.jsx(Jt,{ref:n,role:"presentation",...t,__css:r.icon})});w6.displayName="ListIcon";var $n=he(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:c,column:u,row:f,autoFlow:h,autoRows:p,templateRows:g,autoColumns:y,templateColumns:S,...C}=t,w={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:c,gridAutoColumns:y,gridColumn:u,gridRow:f,gridAutoFlow:h,gridAutoRows:p,gridTemplateRows:g,gridTemplateColumns:S};return l.jsx(oe.div,{ref:n,__css:w,...C})});$n.displayName="Grid";function vx(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 jc=oe("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});jc.displayName="Spacer";var gx=e=>l.jsx(oe.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});gx.displayName="StackItem";var Cf="& > *:not(style) ~ *:not(style)";function k6(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]:vx(n,o=>r[o])}}function j6(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{"&":vx(n,o=>r[o])}}var kh=he((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:c="0.5rem",wrap:u,children:f,divider:h,className:p,shouldWrapChildren:g,...y}=e,S=n?"row":r??"column",C=x.useMemo(()=>k6({direction:S,spacing:c}),[S,c]),w=x.useMemo(()=>j6({spacing:c,direction:S}),[c,S]),k=!!h,j=!g&&!k,M=x.useMemo(()=>{const I=lh(f);return j?I:I.map((T,D)=>{const _=typeof T.key<"u"?T.key:D,z=D+1===I.length,F=g?l.jsx(gx,{children:T},_):T;if(!k)return F;const L=x.cloneElement(h,{__css:w}),X=z?null:L;return l.jsxs(x.Fragment,{children:[F,X]},_)})},[h,w,k,j,g,f]),P=Ae("chakra-stack",p);return l.jsx(oe.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:C.flexDirection,flexWrap:u,className:P,__css:k?{}:{[Cf]:C[Cf]},...y,children:M})});kh.displayName="Stack";var Le=he((e,t)=>l.jsx(kh,{align:"center",...e,direction:"column",ref:t}));Le.displayName="VStack";var sa=he((e,t)=>l.jsx(kh,{align:"center",...e,direction:"row",ref:t}));sa.displayName="HStack";var Vn=he(function(t,n){const r=mo("Heading",t),{className:o,...s}=At(t);return l.jsx(oe.h2,{ref:n,className:Ae("chakra-heading",t.className),...s,__css:r})});Vn.displayName="Heading";var We=oe("div");We.displayName="Box";var xx=he(function(t,n){const{size:r,centerContent:o=!0,...s}=t,c=o?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return l.jsx(We,{ref:n,boxSize:r,__css:{...c,flexShrink:0,flexGrow:0},...s})});xx.displayName="Square";var E6=he(function(t,n){const{size:r,...o}=t;return l.jsx(xx,{size:r,ref:n,borderRadius:"9999px",...o})});E6.displayName="Circle";var Go=he(function(t,n){const r=mo("Link",t),{className:o,isExternal:s,...c}=At(t);return l.jsx(oe.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 yx=he(function(t,n){const r=mo("Badge",t),{className:o,...s}=At(t);return l.jsx(oe.span,{ref:n,className:Ae("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});yx.displayName="Badge";var bx=oe("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center"}});bx.displayName="Center";var P6={horizontal:{insetStart:"50%",transform:"translateX(-50%)"},vertical:{top:"50%",transform:"translateY(-50%)"},both:{insetStart:"50%",top:"50%",transform:"translate(-50%, -50%)"}};he(function(t,n){const{axis:r="both",...o}=t;return l.jsx(oe.div,{ref:n,__css:P6[r],...o,position:"absolute"})});var Sx=he(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:c,borderWidth:u,borderStyle:f,borderColor:h,...p}=mo("Divider",t),{className:g,orientation:y="horizontal",__css:S,...C}=At(t),w={vertical:{borderLeftWidth:r||c||u||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||u||"1px",width:"100%"}};return l.jsx(oe.hr,{ref:n,"aria-orientation":y,...C,__css:{...p,border:"0",borderColor:h,borderStyle:f,...w[y],...S},className:Ae("chakra-divider",g)})});Sx.displayName="Divider";function I6(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function M6(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=x.useState([]),s=x.useRef(),c=()=>{s.current&&(clearTimeout(s.current),s.current=null)},u=()=>{c(),s.current=setTimeout(()=>{o([]),s.current=null},t)};x.useEffect(()=>c,[]);function f(h){return p=>{if(p.key==="Backspace"){const g=[...r];g.pop(),o(g);return}if(I6(p)){const g=r.concat(p.key);n(p)&&(p.preventDefault(),p.stopPropagation()),o(g),h(g.join("")),u()}}}return f}function T6(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 _6(){const e=x.useRef(new Map),t=e.current,n=x.useCallback((o,s,c,u)=>{e.current.set(c,{type:s,el:o,options:u}),o.addEventListener(s,c,u)},[]),r=x.useCallback((o,s,c,u)=>{o.removeEventListener(s,c,u),e.current.delete(c)},[]);return x.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function Cd(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function Cx(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:c,onMouseUp:u,onClick:f,onKeyDown:h,onKeyUp:p,tabIndex:g,onMouseOver:y,onMouseLeave:S,...C}=e,[w,k]=x.useState(!0),[j,M]=x.useState(!1),P=_6(),I=U=>{U&&U.tagName!=="BUTTON"&&k(!1)},T=w?g:g||0,D=n&&!r,_=x.useCallback(U=>{if(n){U.stopPropagation(),U.preventDefault();return}U.currentTarget.focus(),f==null||f(U)},[n,f]),z=x.useCallback(U=>{j&&Cd(U)&&(U.preventDefault(),U.stopPropagation(),M(!1),P.remove(document,"keyup",z,!1))},[j,P]),V=x.useCallback(U=>{if(h==null||h(U),n||U.defaultPrevented||U.metaKey||!Cd(U.nativeEvent)||w)return;const K=o&&U.key==="Enter";s&&U.key===" "&&(U.preventDefault(),M(!0)),K&&(U.preventDefault(),U.currentTarget.click()),P.add(document,"keyup",z,!1)},[n,w,h,o,s,P,z]),F=x.useCallback(U=>{if(p==null||p(U),n||U.defaultPrevented||U.metaKey||!Cd(U.nativeEvent)||w)return;s&&U.key===" "&&(U.preventDefault(),M(!1),U.currentTarget.click())},[s,w,n,p]),L=x.useCallback(U=>{U.button===0&&(M(!1),P.remove(document,"mouseup",L,!1))},[P]),X=x.useCallback(U=>{if(U.button!==0)return;if(n){U.stopPropagation(),U.preventDefault();return}w||M(!0),U.currentTarget.focus({preventScroll:!0}),P.add(document,"mouseup",L,!1),c==null||c(U)},[n,w,c,P,L]),$=x.useCallback(U=>{U.button===0&&(w||M(!1),u==null||u(U))},[u,w]),Q=x.useCallback(U=>{if(n){U.preventDefault();return}y==null||y(U)},[n,y]),re=x.useCallback(U=>{j&&(U.preventDefault(),M(!1)),S==null||S(U)},[j,S]),ie=ct(t,I);return w?{...C,ref:ie,type:"button","aria-disabled":D?void 0:n,disabled:D,onClick:_,onMouseDown:c,onMouseUp:u,onKeyUp:p,onKeyDown:h,onMouseOver:y,onMouseLeave:S}:{...C,ref:ie,role:"button","data-active":Ye(j),"aria-disabled":n?"true":void 0,tabIndex:D?void 0:T,onClick:_,onMouseDown:X,onMouseUp:$,onKeyUp:F,onKeyDown:V,onMouseOver:Q,onMouseLeave:re}}function D6(e){const t=e.current;if(!t)return!1;const n=l6(t);return!n||t.contains(n)?!1:!!f6(n)}function wx(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;ti(()=>{if(!s||D6(e))return;const c=(o==null?void 0:o.current)||e.current;c&&requestAnimationFrame(()=>{c.focus()})},[s,e,o])}var O6={preventScroll:!0,shouldFocus:!1};function A6(e,t=O6){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,c=z6(e)?e.current:e,u=o&&s,f=x.useRef(u),h=x.useRef(s);Ui(()=>{!h.current&&s&&(f.current=u),h.current=s},[s,u]);const p=x.useCallback(()=>{if(!(!s||!c||!f.current)&&(f.current=!1,!c.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var g;(g=n.current)==null||g.focus({preventScroll:r})});else{const g=fx(c);g.length>0&&requestAnimationFrame(()=>{g[0].focus({preventScroll:r})})}},[s,r,c,n]);ti(()=>{p()},[p]),$o(c,"transitionend",p)}function z6(e){return"current"in e}var Ei=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),Vt={arrowShadowColor:Ei("--popper-arrow-shadow-color"),arrowSize:Ei("--popper-arrow-size","8px"),arrowSizeHalf:Ei("--popper-arrow-size-half"),arrowBg:Ei("--popper-arrow-bg"),transformOrigin:Ei("--popper-transform-origin"),arrowOffset:Ei("--popper-arrow-offset")};function R6(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 N6={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"},F6=e=>N6[e],yg={scroll:!0,resize:!0};function L6(e){let t;return typeof e=="object"?t={enabled:!0,options:{...yg,...e}}:t={enabled:e,options:yg},t}var B6={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`}},H6={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{bg(e)},effect:({state:e})=>()=>{bg(e)}},bg=e=>{e.elements.popper.style.setProperty(Vt.transformOrigin.var,F6(e.placement))},W6={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{V6(e)}},V6=e=>{var t;if(!e.placement)return;const n=U6(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:Vt.arrowSize.varRef,height:Vt.arrowSize.varRef,zIndex:-1});const r={[Vt.arrowSizeHalf.var]:`calc(${Vt.arrowSize.varRef} / 2)`,[Vt.arrowOffset.var]:`calc(${Vt.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},U6=e=>{if(e.startsWith("top"))return{property:"bottom",value:Vt.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:Vt.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:Vt.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:Vt.arrowOffset.varRef}},$6={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{Sg(e)},effect:({state:e})=>()=>{Sg(e)}},Sg=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=R6(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:Vt.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},G6={"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"}},q6={"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 Y6(e,t="ltr"){var n,r;const o=((n=G6[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=q6[e])!=null?r:o}var Pn="top",Gn="bottom",qn="right",In="left",jh="auto",hs=[Pn,Gn,qn,In],Xi="start",Qa="end",X6="clippingParents",kx="viewport",Oa="popper",K6="reference",Cg=hs.reduce(function(e,t){return e.concat([t+"-"+Xi,t+"-"+Qa])},[]),jx=[].concat(hs,[jh]).reduce(function(e,t){return e.concat([t,t+"-"+Xi,t+"-"+Qa])},[]),Q6="beforeRead",Z6="read",J6="afterRead",ek="beforeMain",tk="main",nk="afterMain",rk="beforeWrite",ok="write",ik="afterWrite",ak=[Q6,Z6,J6,ek,tk,nk,rk,ok,ik];function Cr(e){return e?(e.nodeName||"").toLowerCase():null}function Yn(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Ko(e){var t=Yn(e).Element;return e instanceof t||e instanceof Element}function Un(e){var t=Yn(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Eh(e){if(typeof ShadowRoot>"u")return!1;var t=Yn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function sk(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];!Un(s)||!Cr(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 lk(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],s=t.attributes[r]||{},c=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),u=c.reduce(function(f,h){return f[h]="",f},{});!Un(o)||!Cr(o)||(Object.assign(o.style,u),Object.keys(s).forEach(function(f){o.removeAttribute(f)}))})}}const ck={name:"applyStyles",enabled:!0,phase:"write",fn:sk,effect:lk,requires:["computeStyles"]};function yr(e){return e.split("-")[0]}var qo=Math.max,lc=Math.min,Ki=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 Ex(){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&&Un(e)&&(o=e.offsetWidth>0&&Ki(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&Ki(r.height)/e.offsetHeight||1);var c=Ko(e)?Yn(e):window,u=c.visualViewport,f=!Ex()&&n,h=(r.left+(f&&u?u.offsetLeft:0))/o,p=(r.top+(f&&u?u.offsetTop:0))/s,g=r.width/o,y=r.height/s;return{width:g,height:y,top:p,right:h+g,bottom:p+y,left:h,x:h,y:p}}function Ph(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 Px(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Eh(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Ar(e){return Yn(e).getComputedStyle(e)}function uk(e){return["table","td","th"].indexOf(Cr(e))>=0}function vo(e){return((Ko(e)?e.ownerDocument:e.document)||window.document).documentElement}function Ec(e){return Cr(e)==="html"?e:e.assignedSlot||e.parentNode||(Eh(e)?e.host:null)||vo(e)}function wg(e){return!Un(e)||Ar(e).position==="fixed"?null:e.offsetParent}function dk(e){var t=/firefox/i.test(wf()),n=/Trident/i.test(wf());if(n&&Un(e)){var r=Ar(e);if(r.position==="fixed")return null}var o=Ec(e);for(Eh(o)&&(o=o.host);Un(o)&&["html","body"].indexOf(Cr(o))<0;){var s=Ar(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 ps(e){for(var t=Yn(e),n=wg(e);n&&uk(n)&&Ar(n).position==="static";)n=wg(n);return n&&(Cr(n)==="html"||Cr(n)==="body"&&Ar(n).position==="static")?t:n||dk(e)||t}function Ih(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Ha(e,t,n){return qo(e,lc(t,n))}function fk(e,t,n){var r=Ha(e,t,n);return r>n?n:r}function Ix(){return{top:0,right:0,bottom:0,left:0}}function Mx(e){return Object.assign({},Ix(),e)}function Tx(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var hk=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Mx(typeof t!="number"?t:Tx(t,hs))};function pk(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,c=n.modifiersData.popperOffsets,u=yr(n.placement),f=Ih(u),h=[In,qn].indexOf(u)>=0,p=h?"height":"width";if(!(!s||!c)){var g=hk(o.padding,n),y=Ph(s),S=f==="y"?Pn:In,C=f==="y"?Gn:qn,w=n.rects.reference[p]+n.rects.reference[f]-c[f]-n.rects.popper[p],k=c[f]-n.rects.reference[f],j=ps(s),M=j?f==="y"?j.clientHeight||0:j.clientWidth||0:0,P=w/2-k/2,I=g[S],T=M-y[p]-g[C],D=M/2-y[p]/2+P,_=Ha(I,D,T),z=f;n.modifiersData[r]=(t={},t[z]=_,t.centerOffset=_-D,t)}}function mk(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)||Px(t.elements.popper,o)&&(t.elements.arrow=o))}const vk={name:"arrow",enabled:!0,phase:"main",fn:pk,effect:mk,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Zi(e){return e.split("-")[1]}var gk={top:"auto",right:"auto",bottom:"auto",left:"auto"};function xk(e){var t=e.x,n=e.y,r=window,o=r.devicePixelRatio||1;return{x:Ki(t*o)/o||0,y:Ki(n*o)/o||0}}function kg(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,c=e.offsets,u=e.position,f=e.gpuAcceleration,h=e.adaptive,p=e.roundOffsets,g=e.isFixed,y=c.x,S=y===void 0?0:y,C=c.y,w=C===void 0?0:C,k=typeof p=="function"?p({x:S,y:w}):{x:S,y:w};S=k.x,w=k.y;var j=c.hasOwnProperty("x"),M=c.hasOwnProperty("y"),P=In,I=Pn,T=window;if(h){var D=ps(n),_="clientHeight",z="clientWidth";if(D===Yn(n)&&(D=vo(n),Ar(D).position!=="static"&&u==="absolute"&&(_="scrollHeight",z="scrollWidth")),D=D,o===Pn||(o===In||o===qn)&&s===Qa){I=Gn;var V=g&&D===T&&T.visualViewport?T.visualViewport.height:D[_];w-=V-r.height,w*=f?1:-1}if(o===In||(o===Pn||o===Gn)&&s===Qa){P=qn;var F=g&&D===T&&T.visualViewport?T.visualViewport.width:D[z];S-=F-r.width,S*=f?1:-1}}var L=Object.assign({position:u},h&&gk),X=p===!0?xk({x:S,y:w}):{x:S,y:w};if(S=X.x,w=X.y,f){var $;return Object.assign({},L,($={},$[I]=M?"0":"",$[P]=j?"0":"",$.transform=(T.devicePixelRatio||1)<=1?"translate("+S+"px, "+w+"px)":"translate3d("+S+"px, "+w+"px, 0)",$))}return Object.assign({},L,(t={},t[I]=M?w+"px":"",t[P]=j?S+"px":"",t.transform="",t))}function yk(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,c=s===void 0?!0:s,u=n.roundOffsets,f=u===void 0?!0:u,h={placement:yr(t.placement),variation:Zi(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,kg(Object.assign({},h,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:c,roundOffsets:f})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,kg(Object.assign({},h,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const bk={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:yk,data:{}};var wl={passive:!0};function Sk(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=Yn(t.elements.popper),h=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&h.forEach(function(p){p.addEventListener("scroll",n.update,wl)}),u&&f.addEventListener("resize",n.update,wl),function(){s&&h.forEach(function(p){p.removeEventListener("scroll",n.update,wl)}),u&&f.removeEventListener("resize",n.update,wl)}}const Ck={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Sk,data:{}};var wk={left:"right",right:"left",bottom:"top",top:"bottom"};function Gl(e){return e.replace(/left|right|bottom|top/g,function(t){return wk[t]})}var kk={start:"end",end:"start"};function jg(e){return e.replace(/start|end/g,function(t){return kk[t]})}function Mh(e){var t=Yn(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Th(e){return Qi(vo(e)).left+Mh(e).scrollLeft}function jk(e,t){var n=Yn(e),r=vo(e),o=n.visualViewport,s=r.clientWidth,c=r.clientHeight,u=0,f=0;if(o){s=o.width,c=o.height;var h=Ex();(h||!h&&t==="fixed")&&(u=o.offsetLeft,f=o.offsetTop)}return{width:s,height:c,x:u+Th(e),y:f}}function Ek(e){var t,n=vo(e),r=Mh(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+Th(e),f=-r.scrollTop;return Ar(o||n).direction==="rtl"&&(u+=qo(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:c,x:u,y:f}}function _h(e){var t=Ar(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function _x(e){return["html","body","#document"].indexOf(Cr(e))>=0?e.ownerDocument.body:Un(e)&&_h(e)?e:_x(Ec(e))}function Wa(e,t){var n;t===void 0&&(t=[]);var r=_x(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Yn(r),c=o?[s].concat(s.visualViewport||[],_h(r)?r:[]):r,u=t.concat(c);return o?u:u.concat(Wa(Ec(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 Pk(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 Eg(e,t,n){return t===kx?kf(jk(e,n)):Ko(t)?Pk(t,n):kf(Ek(vo(e)))}function Ik(e){var t=Wa(Ec(e)),n=["absolute","fixed"].indexOf(Ar(e).position)>=0,r=n&&Un(e)?ps(e):e;return Ko(r)?t.filter(function(o){return Ko(o)&&Px(o,r)&&Cr(o)!=="body"}):[]}function Mk(e,t,n,r){var o=t==="clippingParents"?Ik(e):[].concat(t),s=[].concat(o,[n]),c=s[0],u=s.reduce(function(f,h){var p=Eg(e,h,r);return f.top=qo(p.top,f.top),f.right=lc(p.right,f.right),f.bottom=lc(p.bottom,f.bottom),f.left=qo(p.left,f.left),f},Eg(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 Dx(e){var t=e.reference,n=e.element,r=e.placement,o=r?yr(r):null,s=r?Zi(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 Gn:f={x:c,y:t.y+t.height};break;case qn:f={x:t.x+t.width,y:u};break;case In:f={x:t.x-n.width,y:u};break;default:f={x:t.x,y:t.y}}var h=o?Ih(o):null;if(h!=null){var p=h==="y"?"height":"width";switch(s){case Xi:f[h]=f[h]-(t[p]/2-n[p]/2);break;case Qa:f[h]=f[h]+(t[p]/2-n[p]/2);break}}return f}function Za(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?X6:u,h=n.rootBoundary,p=h===void 0?kx:h,g=n.elementContext,y=g===void 0?Oa:g,S=n.altBoundary,C=S===void 0?!1:S,w=n.padding,k=w===void 0?0:w,j=Mx(typeof k!="number"?k:Tx(k,hs)),M=y===Oa?K6:Oa,P=e.rects.popper,I=e.elements[C?M:y],T=Mk(Ko(I)?I:I.contextElement||vo(e.elements.popper),f,p,c),D=Qi(e.elements.reference),_=Dx({reference:D,element:P,strategy:"absolute",placement:o}),z=kf(Object.assign({},P,_)),V=y===Oa?z: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(y===Oa&&L){var X=L[o];Object.keys(F).forEach(function($){var Q=[qn,Gn].indexOf($)>=0?1:-1,re=[Pn,Gn].indexOf($)>=0?"y":"x";F[$]+=X[re]*Q})}return F}function Tk(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,c=n.padding,u=n.flipVariations,f=n.allowedAutoPlacements,h=f===void 0?jx:f,p=Zi(r),g=p?u?Cg:Cg.filter(function(C){return Zi(C)===p}):hs,y=g.filter(function(C){return h.indexOf(C)>=0});y.length===0&&(y=g);var S=y.reduce(function(C,w){return C[w]=Za(e,{placement:w,boundary:o,rootBoundary:s,padding:c})[yr(w)],C},{});return Object.keys(S).sort(function(C,w){return S[C]-S[w]})}function _k(e){if(yr(e)===jh)return[];var t=Gl(e);return[jg(e),t,jg(t)]}function Dk(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,c=n.altAxis,u=c===void 0?!0:c,f=n.fallbackPlacements,h=n.padding,p=n.boundary,g=n.rootBoundary,y=n.altBoundary,S=n.flipVariations,C=S===void 0?!0:S,w=n.allowedAutoPlacements,k=t.options.placement,j=yr(k),M=j===k,P=f||(M||!C?[Gl(k)]:_k(k)),I=[k].concat(P).reduce(function(J,ue){return J.concat(yr(ue)===jh?Tk(t,{placement:ue,boundary:p,rootBoundary:g,padding:h,flipVariations:C,allowedAutoPlacements:w}):ue)},[]),T=t.rects.reference,D=t.rects.popper,_=new Map,z=!0,V=I[0],F=0;F=0,re=Q?"width":"height",ie=Za(t,{placement:L,boundary:p,rootBoundary:g,altBoundary:y,padding:h}),U=Q?$?qn:In:$?Gn:Pn;T[re]>D[re]&&(U=Gl(U));var K=Gl(U),ne=[];if(s&&ne.push(ie[X]<=0),u&&ne.push(ie[U]<=0,ie[K]<=0),ne.every(function(J){return J})){V=L,z=!1;break}_.set(L,ne)}if(z)for(var ce=C?3:1,Re=function(ue){var Ie=I.find(function(Be){var Ne=_.get(Be);if(Ne)return Ne.slice(0,ue).every(function(Ge){return Ge})});if(Ie)return V=Ie,"break"},ze=ce;ze>0;ze--){var Me=Re(ze);if(Me==="break")break}t.placement!==V&&(t.modifiersData[r]._skip=!0,t.placement=V,t.reset=!0)}}const Ok={name:"flip",enabled:!0,phase:"main",fn:Dk,requiresIfExists:["offset"],data:{_skip:!1}};function Pg(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 Ig(e){return[Pn,qn,Gn,In].some(function(t){return e[t]>=0})}function Ak(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,c=Za(t,{elementContext:"reference"}),u=Za(t,{altBoundary:!0}),f=Pg(c,r),h=Pg(u,o,s),p=Ig(f),g=Ig(h);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:h,isReferenceHidden:p,hasPopperEscaped:g},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":g})}const zk={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Ak};function Rk(e,t,n){var r=yr(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,qn].indexOf(r)>=0?{x:u,y:c}:{x:c,y:u}}function Nk(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,c=jx.reduce(function(p,g){return p[g]=Rk(g,t.rects,s),p},{}),u=c[t.placement],f=u.x,h=u.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=h),t.modifiersData[r]=c}const Fk={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Nk};function Lk(e){var t=e.state,n=e.name;t.modifiersData[n]=Dx({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Bk={name:"popperOffsets",enabled:!0,phase:"read",fn:Lk,data:{}};function Hk(e){return e==="x"?"y":"x"}function Wk(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,c=n.altAxis,u=c===void 0?!1:c,f=n.boundary,h=n.rootBoundary,p=n.altBoundary,g=n.padding,y=n.tether,S=y===void 0?!0:y,C=n.tetherOffset,w=C===void 0?0:C,k=Za(t,{boundary:f,rootBoundary:h,padding:g,altBoundary:p}),j=yr(t.placement),M=Zi(t.placement),P=!M,I=Ih(j),T=Hk(I),D=t.modifiersData.popperOffsets,_=t.rects.reference,z=t.rects.popper,V=typeof w=="function"?w(Object.assign({},t.rects,{placement:t.placement})):w,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,X={x:0,y:0};if(D){if(s){var $,Q=I==="y"?Pn:In,re=I==="y"?Gn:qn,ie=I==="y"?"height":"width",U=D[I],K=U+k[Q],ne=U-k[re],ce=S?-z[ie]/2:0,Re=M===Xi?_[ie]:z[ie],ze=M===Xi?-z[ie]:-_[ie],Me=t.elements.arrow,J=S&&Me?Ph(Me):{width:0,height:0},ue=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Ix(),Ie=ue[Q],Be=ue[re],Ne=Ha(0,_[ie],J[ie]),Ge=P?_[ie]/2-ce-Ne-Ie-F.mainAxis:Re-Ne-Ie-F.mainAxis,Qe=P?-_[ie]/2+ce+Ne+Be+F.mainAxis:ze+Ne+Be+F.mainAxis,ve=t.elements.arrow&&ps(t.elements.arrow),_e=ve?I==="y"?ve.clientTop||0:ve.clientLeft||0:0,qe=($=L==null?void 0:L[I])!=null?$:0,ge=U+Ge-qe-_e,Te=U+Qe-qe,et=Ha(S?lc(K,ge):K,U,S?qo(ne,Te):ne);D[I]=et,X[I]=et-U}if(u){var Ve,vt=I==="x"?Pn:In,Nt=I==="x"?Gn:qn,N=D[T],de=T==="y"?"height":"width",xe=N+k[vt],je=N-k[Nt],q=[Pn,In].indexOf(j)!==-1,se=(Ve=L==null?void 0:L[T])!=null?Ve:0,Fe=q?xe:N-_[de]-z[de]-se+F.altAxis,Ze=q?N+_[de]+z[de]-se-F.altAxis:je,ee=S&&q?fk(Fe,N,Ze):Ha(S?Fe:xe,N,S?Ze:je);D[T]=ee,X[T]=ee-N}t.modifiersData[r]=X}}const Vk={name:"preventOverflow",enabled:!0,phase:"main",fn:Wk,requiresIfExists:["offset"]};function Uk(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function $k(e){return e===Yn(e)||!Un(e)?Mh(e):Uk(e)}function Gk(e){var t=e.getBoundingClientRect(),n=Ki(t.width)/e.offsetWidth||1,r=Ki(t.height)/e.offsetHeight||1;return n!==1||r!==1}function qk(e,t,n){n===void 0&&(n=!1);var r=Un(t),o=Un(t)&&Gk(t),s=vo(t),c=Qi(e,o,n),u={scrollLeft:0,scrollTop:0},f={x:0,y:0};return(r||!r&&!n)&&((Cr(t)!=="body"||_h(s))&&(u=$k(t)),Un(t)?(f=Qi(t,!0),f.x+=t.clientLeft,f.y+=t.clientTop):s&&(f.x=Th(s))),{x:c.left+u.scrollLeft-f.x,y:c.top+u.scrollTop-f.y,width:c.width,height:c.height}}function Yk(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 Xk(e){var t=Yk(e);return ak.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function Kk(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function Qk(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 Mg={placement:"bottom",modifiers:[],strategy:"absolute"};function Tg(){for(var e=arguments.length,t=new Array(e),n=0;n{}),P=x.useCallback(()=>{var F;!t||!C.current||!w.current||((F=M.current)==null||F.call(M),k.current=ej(C.current,w.current,{placement:j,modifiers:[$6,W6,H6,{...B6,enabled:!!y},{name:"eventListeners",...L6(c)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:u??[0,f]}},{name:"flip",enabled:!!h,options:{padding:8}},{name:"preventOverflow",enabled:!!g,options:{boundary:p}},...n??[]],strategy:o}),k.current.forceUpdate(),M.current=k.current.destroy)},[j,t,n,y,c,s,u,f,h,g,p,o]);x.useEffect(()=>()=>{var F;!C.current&&!w.current&&((F=k.current)==null||F.destroy(),k.current=null)},[]);const I=x.useCallback(F=>{C.current=F,P()},[P]),T=x.useCallback((F={},L=null)=>({...F,ref:ct(I,L)}),[I]),D=x.useCallback(F=>{w.current=F,P()},[P]),_=x.useCallback((F={},L=null)=>({...F,ref:ct(D,L),style:{...F.style,position:o,minWidth:y?void 0:"max-content",inset:"0 auto auto 0"}}),[o,D,y]),z=x.useCallback((F={},L=null)=>{const{size:X,shadowColor:$,bg:Q,style:re,...ie}=F;return{...ie,ref:L,"data-popper-arrow":"",style:tj(F)}},[]),V=x.useCallback((F={},L=null)=>({...F,ref:L,"data-popper-arrow-inner":""}),[]);return{update(){var F;(F=k.current)==null||F.update()},forceUpdate(){var F;(F=k.current)==null||F.forceUpdate()},transformOrigin:Vt.transformOrigin.varRef,referenceRef:I,popperRef:D,getPopperProps:_,getArrowProps:z,getArrowInnerProps:V,getReferenceProps:T}}function tj(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 Oh(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=Ut(n),c=Ut(t),[u,f]=x.useState(e.defaultIsOpen||!1),h=r!==void 0?r:u,p=r!==void 0,g=x.useId(),y=o??`disclosure-${g}`,S=x.useCallback(()=>{p||f(!1),c==null||c()},[p,c]),C=x.useCallback(()=>{p||f(!0),s==null||s()},[p,s]),w=x.useCallback(()=>{h?S():C()},[h,C,S]);function k(M={}){return{...M,"aria-expanded":h,"aria-controls":y,onClick(P){var I;(I=M.onClick)==null||I.call(M,P),w()}}}function j(M={}){return{...M,hidden:!h,id:y}}return{isOpen:h,onOpen:C,onClose:S,onToggle:w,isControlled:p,getButtonProps:k,getDisclosureProps:j}}function nj(e){const{ref:t,handler:n,enabled:r=!0}=e,o=Ut(n),c=x.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;x.useEffect(()=>{if(!r)return;const u=g=>{wd(g,t)&&(c.isPointerDown=!0)},f=g=>{if(c.ignoreEmulatedMouseEvents){c.ignoreEmulatedMouseEvents=!1;return}c.isPointerDown&&n&&wd(g,t)&&(c.isPointerDown=!1,o(g))},h=g=>{c.ignoreEmulatedMouseEvents=!0,n&&c.isPointerDown&&wd(g,t)&&(c.isPointerDown=!1,o(g))},p=Ox(t.current);return p.addEventListener("mousedown",u,!0),p.addEventListener("mouseup",f,!0),p.addEventListener("touchstart",u,!0),p.addEventListener("touchend",h,!0),()=>{p.removeEventListener("mousedown",u,!0),p.removeEventListener("mouseup",f,!0),p.removeEventListener("touchstart",u,!0),p.removeEventListener("touchend",h,!0)}},[n,t,o,c,r])}function wd(e,t){var n;const r=e.target;return e.button>0||r&&!Ox(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function Ox(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Ax(e){const{isOpen:t,ref:n}=e,[r,o]=x.useState(t),[s,c]=x.useState(!1);return x.useEffect(()=>{s||(o(t),c(!0))},[t,s,r]),$o(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var f;const h=s6(n.current),p=new h.CustomEvent("animationend",{bubbles:!0});(f=n.current)==null||f.dispatchEvent(p)}}}function Ah(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[rj,oj,ij,aj]=rh(),[sj,ms]=Et({strict:!1,name:"MenuContext"});function lj(e,...t){const n=x.useId(),r=e||n;return x.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function zx(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function _g(e){return zx(e).activeElement===e}function cj(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:c,isOpen:u,defaultIsOpen:f,onClose:h,onOpen:p,placement:g="bottom-start",lazyBehavior:y="unmount",direction:S,computePositionOnMount:C=!1,...w}=e,k=x.useRef(null),j=x.useRef(null),M=ij(),P=x.useCallback(()=>{requestAnimationFrame(()=>{var Me;(Me=k.current)==null||Me.focus({preventScroll:!1})})},[]),I=x.useCallback(()=>{const Me=setTimeout(()=>{var J;if(o)(J=o.current)==null||J.focus();else{const ue=M.firstEnabled();ue&&$(ue.index)}});K.current.add(Me)},[M,o]),T=x.useCallback(()=>{const Me=setTimeout(()=>{const J=M.lastEnabled();J&&$(J.index)});K.current.add(Me)},[M]),D=x.useCallback(()=>{p==null||p(),s?I():P()},[s,I,P,p]),{isOpen:_,onOpen:z,onClose:V,onToggle:F}=Oh({isOpen:u,defaultIsOpen:f,onClose:h,onOpen:D});nj({enabled:_&&r,ref:k,handler:Me=>{var J;(J=j.current)!=null&&J.contains(Me.target)||V()}});const L=Dh({...w,enabled:_||C,placement:g,direction:S}),[X,$]=x.useState(-1);ti(()=>{_||$(-1)},[_]),wx(k,{focusRef:j,visible:_,shouldFocus:!0});const Q=Ax({isOpen:_,ref:k}),[re,ie]=lj(t,"menu-button","menu-list"),U=x.useCallback(()=>{z(),P()},[z,P]),K=x.useRef(new Set([]));vj(()=>{K.current.forEach(Me=>clearTimeout(Me)),K.current.clear()});const ne=x.useCallback(()=>{z(),I()},[I,z]),ce=x.useCallback(()=>{z(),T()},[z,T]),Re=x.useCallback(()=>{var Me,J;const ue=zx(k.current),Ie=(Me=k.current)==null?void 0:Me.contains(ue.activeElement);if(!(_&&!Ie))return;const Ne=(J=M.item(X))==null?void 0:J.node;Ne==null||Ne.focus()},[_,X,M]),ze=x.useRef(null);return{openAndFocusMenu:U,openAndFocusFirstItem:ne,openAndFocusLastItem:ce,onTransitionEnd:Re,unstable__animationState:Q,descendants:M,popper:L,buttonId:re,menuId:ie,forceUpdate:L.forceUpdate,orientation:"vertical",isOpen:_,onToggle:F,onOpen:z,onClose:V,menuRef:k,buttonRef:j,focusedIndex:X,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:$,isLazy:c,lazyBehavior:y,initialFocusRef:o,rafId:ze}}function uj(e={},t=null){const n=ms(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:c}=n,u=x.useCallback(f=>{const h=f.key,g={Enter:s,ArrowDown:s,ArrowUp:c}[h];g&&(f.preventDefault(),f.stopPropagation(),g(f))},[s,c]);return{...e,ref:ct(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":Ye(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:Pe(e.onClick,r),onKeyDown:Pe(e.onKeyDown,u)}}function jf(e){var t;return pj(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function dj(e={},t=null){const n=ms();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:c,onClose:u,menuId:f,isLazy:h,lazyBehavior:p,unstable__animationState:g}=n,y=oj(),S=M6({preventDefault:j=>j.key!==" "&&jf(j.target)}),C=x.useCallback(j=>{const M=j.key,I={Tab:D=>D.preventDefault(),Escape:u,ArrowDown:()=>{const D=y.nextEnabled(r);D&&o(D.index)},ArrowUp:()=>{const D=y.prevEnabled(r);D&&o(D.index)}}[M];if(I){j.preventDefault(),I(j);return}const T=S(D=>{const _=T6(y.values(),D,z=>{var V,F;return(F=(V=z==null?void 0:z.node)==null?void 0:V.textContent)!=null?F:""},y.item(r));if(_){const z=y.indexOf(_.node);o(z)}});jf(j.target)&&T(j)},[y,r,S,u,o]),w=x.useRef(!1);c&&(w.current=!0);const k=Ah({wasSelected:w.current,enabled:h,mode:p,isSelected:g.present});return{...e,ref:ct(s,t),children:k?e.children:null,tabIndex:-1,role:"menu",id:f,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:Pe(e.onKeyDown,C)}}function fj(e={}){const{popper:t,isOpen:n}=ms();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function hj(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:c,isDisabled:u,isFocusable:f,closeOnSelect:h,type:p,...g}=e,y=ms(),{setFocusedIndex:S,focusedIndex:C,closeOnSelect:w,onClose:k,menuRef:j,isOpen:M,menuId:P,rafId:I}=y,T=x.useRef(null),D=`${P}-menuitem-${x.useId()}`,{index:_,register:z}=aj({disabled:u&&!f}),V=x.useCallback(U=>{n==null||n(U),!u&&S(_)},[S,_,u,n]),F=x.useCallback(U=>{r==null||r(U),T.current&&!_g(T.current)&&V(U)},[V,r]),L=x.useCallback(U=>{o==null||o(U),!u&&S(-1)},[S,u,o]),X=x.useCallback(U=>{s==null||s(U),jf(U.currentTarget)&&(h??w)&&k()},[k,s,w,h]),$=x.useCallback(U=>{c==null||c(U),S(_)},[S,c,_]),Q=_===C,re=u&&!f;ti(()=>{M&&(Q&&!re&&T.current?(I.current&&cancelAnimationFrame(I.current),I.current=requestAnimationFrame(()=>{var U;(U=T.current)==null||U.focus(),I.current=null})):j.current&&!_g(j.current)&&j.current.focus())},[Q,re,j,M]);const ie=Cx({onClick:X,onFocus:$,onMouseEnter:V,onMouseMove:F,onMouseLeave:L,ref:ct(z,T,t),isDisabled:u,isFocusable:f});return{...g,...ie,type:p??ie.type,id:D,role:"menuitem",tabIndex:Q?0:-1}}function pj(e){var t;if(!mj(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function mj(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function vj(e,t=[]){return x.useEffect(()=>()=>e(),t)}var[gj,Pc]=Et({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),zh=e=>{const{children:t}=e,n=fn("Menu",e),r=At(e),{direction:o}=ei(),{descendants:s,...c}=cj({...r,direction:o}),u=x.useMemo(()=>c,[c]),{isOpen:f,onClose:h,forceUpdate:p}=u;return l.jsx(rj,{value:s,children:l.jsx(sj,{value:u,children:l.jsx(gj,{value:n,children:k1(t,{isOpen:f,onClose:h,forceUpdate:p})})})})};zh.displayName="Menu";var Rx=he((e,t)=>{const n=Pc();return l.jsx(oe.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});Rx.displayName="MenuCommand";var xj=he((e,t)=>{const{type:n,...r}=e,o=Pc(),s=r.as||n?n??void 0:"button",c=x.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(oe.button,{ref:t,type:s,...r,__css:c})}),Nx=e=>{const{className:t,children:n,...r}=e,o=x.Children.only(n),s=x.isValidElement(o)?x.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(oe.span,{className:c,...r,__css:{flexShrink:0},children:s})};Nx.displayName="MenuIcon";var pr=he((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:c,...u}=e,f=hj(u,t),p=n||o?l.jsx("span",{style:{pointerEvents:"none",flex:1},children:c}):c;return l.jsxs(xj,{...f,className:Ae("chakra-menu__menuitem",f.className),children:[n&&l.jsx(Nx,{fontSize:"0.8em",marginEnd:r,children:n}),p,o&&l.jsx(Rx,{marginStart:s,children:o})]})});pr.displayName="MenuItem";var yj={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"}}},bj=oe(Wr.div),Rh=he(function(t,n){var r,o;const{rootProps:s,motionProps:c,...u}=t,{isOpen:f,onTransitionEnd:h,unstable__animationState:p}=ms(),g=dj(u,n),y=fj(s),S=Pc();return l.jsx(oe.div,{...y,__css:{zIndex:(o=t.zIndex)!=null?o:(r=S.list)==null?void 0:r.zIndex},children:l.jsx(bj,{variants:yj,initial:!1,animate:f?"enter":"exit",__css:{outline:0,...S.list},...c,className:Ae("chakra-menu__menu-list",g.className),...g,onUpdate:h,onAnimationComplete:yc(p.onComplete,g.onAnimationComplete)})})});Rh.displayName="MenuList";var Sj=he((e,t)=>{const n=Pc();return l.jsx(oe.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),Nh=he((e,t)=>{const{children:n,as:r,...o}=e,s=uj(o,t),c=r||Sj;return l.jsx(c,{...s,className:Ae("chakra-menu__menu-button",e.className),children:l.jsx(oe.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});Nh.displayName="MenuButton";var Cj={slideInBottom:{...ff,custom:{offsetY:16,reverse:!0}},slideInRight:{...ff,custom:{offsetX:16,reverse:!0}},scale:{...S2,custom:{initialScale:.95,reverse:!0}},none:{}},wj=oe(Wr.section),kj=e=>Cj[e||"none"],Fx=x.forwardRef((e,t)=>{const{preset:n,motionProps:r=kj(n),...o}=e;return l.jsx(wj,{ref:t,...r,...o})});Fx.displayName="ModalTransition";var jj=Object.defineProperty,Ej=(e,t,n)=>t in e?jj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pj=(e,t,n)=>(Ej(e,typeof t!="symbol"?t+"":t,n),n),Ij=class{constructor(){Pj(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 Ij;function Lx(e,t){const[n,r]=x.useState(0);return x.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 Mj=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Pi=new WeakMap,kl=new WeakMap,jl={},kd=0,Bx=function(e){return e&&(e.host||Bx(e.parentNode))},Tj=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Bx(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)})},_j=function(e,t,n,r){var o=Tj(t,Array.isArray(e)?e:[e]);jl[n]||(jl[n]=new WeakMap);var s=jl[n],c=[],u=new Set,f=new Set(o),h=function(g){!g||u.has(g)||(u.add(g),h(g.parentNode))};o.forEach(h);var p=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(y){if(u.has(y))p(y);else{var S=y.getAttribute(r),C=S!==null&&S!=="false",w=(Pi.get(y)||0)+1,k=(s.get(y)||0)+1;Pi.set(y,w),s.set(y,k),c.push(y),w===1&&C&&kl.set(y,!0),k===1&&y.setAttribute(n,"true"),C||y.setAttribute(r,"true")}})};return p(t),u.clear(),kd++,function(){c.forEach(function(g){var y=Pi.get(g)-1,S=s.get(g)-1;Pi.set(g,y),s.set(g,S),y||(kl.has(g)||g.removeAttribute(r),kl.delete(g)),S||g.removeAttribute(n)}),kd--,kd||(Pi=new WeakMap,Pi=new WeakMap,kl=new WeakMap,jl={})}},Dj=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||Mj(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),_j(r,o,n,"aria-hidden")):function(){return null}};function Oj(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:c=!0,onOverlayClick:u,onEsc:f}=e,h=x.useRef(null),p=x.useRef(null),[g,y,S]=zj(r,"chakra-modal","chakra-modal--header","chakra-modal--body");Aj(h,t&&c),Lx(h,t);const C=x.useRef(null),w=x.useCallback(z=>{C.current=z.target},[]),k=x.useCallback(z=>{z.key==="Escape"&&(z.stopPropagation(),s&&(n==null||n()),f==null||f())},[s,n,f]),[j,M]=x.useState(!1),[P,I]=x.useState(!1),T=x.useCallback((z={},V=null)=>({role:"dialog",...z,ref:ct(V,h),id:g,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?y:void 0,"aria-describedby":P?S:void 0,onClick:Pe(z.onClick,F=>F.stopPropagation())}),[S,P,g,y,j]),D=x.useCallback(z=>{z.stopPropagation(),C.current===z.target&&Ef.isTopModal(h.current)&&(o&&(n==null||n()),u==null||u())},[n,o,u]),_=x.useCallback((z={},V=null)=>({...z,ref:ct(V,p),onClick:Pe(z.onClick,D),onKeyDown:Pe(z.onKeyDown,k),onMouseDown:Pe(z.onMouseDown,w)}),[k,w,D]);return{isOpen:t,onClose:n,headerId:y,bodyId:S,setBodyMounted:I,setHeaderMounted:M,dialogRef:h,overlayRef:p,getDialogProps:T,getDialogContainerProps:_}}function Aj(e,t){const n=e.current;x.useEffect(()=>{if(!(!e.current||!t))return Dj(e.current)},[t,e,n])}function zj(e,...t){const n=x.useId(),r=e||n;return x.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[Rj,la]=Et({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Nj,Qo]=Et({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),fo=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:n,children:r,autoFocus:o,trapFocus:s,initialFocusRef:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:h,allowPinchZoom:p,preserveScrollBarGap:g,motionPreset:y,lockFocusAcrossFrames:S,onCloseComplete:C}=t,w=fn("Modal",t),j={...Oj(t),autoFocus:o,trapFocus:s,initialFocusRef:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:h,allowPinchZoom:p,preserveScrollBarGap:g,motionPreset:y,lockFocusAcrossFrames:S};return l.jsx(Nj,{value:j,children:l.jsx(Rj,{value:w,children:l.jsx(oa,{onExitComplete:C,children:j.isOpen&&l.jsx(eh,{...n,children:r})})})})};fo.displayName="Modal";var ql="right-scroll-bar-position",Yl="width-before-scroll-bar",Fj="with-scroll-bars-hidden",Lj="--removed-body-scroll-bar-size",Hx=z2(),jd=function(){},Ic=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:jd,onWheelCapture:jd,onTouchMoveCapture:jd}),o=r[0],s=r[1],c=e.forwardProps,u=e.children,f=e.className,h=e.removeScrollBar,p=e.enabled,g=e.shards,y=e.sideCar,S=e.noIsolation,C=e.inert,w=e.allowPinchZoom,k=e.as,j=k===void 0?"div":k,M=g2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),P=y,I=D2([n,t]),T=vr(vr({},M),o);return x.createElement(x.Fragment,null,p&&x.createElement(P,{sideCar:Hx,removeScrollBar:h,shards:g,noIsolation:S,inert:C,setCallbacks:s,allowPinchZoom:!!w,lockRef:n}),c?x.cloneElement(x.Children.only(u),vr(vr({},T),{ref:I})):x.createElement(j,vr({},T,{className:f,ref:I}),u))});Ic.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ic.classNames={fullWidth:Yl,zeroRight:ql};var Dg,Bj=function(){if(Dg)return Dg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Hj(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Bj();return t&&e.setAttribute("nonce",t),e}function Wj(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Vj(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Uj=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Hj())&&(Wj(t,n),Vj(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},$j=function(){var e=Uj();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Wx=function(){var e=$j(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Gj={left:0,top:0,right:0,gap:0},Ed=function(e){return parseInt(e||"",10)||0},qj=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[Ed(n),Ed(r),Ed(o)]},Yj=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Gj;var t=qj(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])}},Xj=Wx(),Kj=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(Fj,` { 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(ql,` { right: `).concat(u,"px ").concat(r,`; } .`).concat(Yl,` { margin-right: `).concat(u,"px ").concat(r,`; } .`).concat(ql," .").concat(ql,` { right: 0 `).concat(r,`; } .`).concat(Yl," .").concat(Yl,` { margin-right: 0 `).concat(r,`; } body { `).concat(Lj,": ").concat(u,`px; } `)},Qj=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=x.useMemo(function(){return Yj(o)},[o]);return x.createElement(Xj,{styles:Kj(s,!t,o,n?"":"!important")})},Pf=!1;if(typeof window<"u")try{var El=Object.defineProperty({},"passive",{get:function(){return Pf=!0,!0}});window.addEventListener("test",El,El),window.removeEventListener("test",El,El)}catch{Pf=!1}var Ii=Pf?{passive:!1}:!1,Zj=function(e){return e.tagName==="TEXTAREA"},Vx=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Zj(e)&&n[t]==="visible")},Jj=function(e){return Vx(e,"overflowY")},eE=function(e){return Vx(e,"overflowX")},Og=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=Ux(e,n);if(r){var o=$x(e,n),s=o[1],c=o[2];if(s>c)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},tE=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},nE=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Ux=function(e,t){return e==="v"?Jj(t):eE(t)},$x=function(e,t){return e==="v"?tE(t):nE(t)},rE=function(e,t){return e==="h"&&t==="rtl"?-1:1},oE=function(e,t,n,r,o){var s=rE(e,window.getComputedStyle(t).direction),c=s*r,u=n.target,f=t.contains(u),h=!1,p=c>0,g=0,y=0;do{var S=$x(e,u),C=S[0],w=S[1],k=S[2],j=w-k-s*C;(C||j)&&Ux(e,u)&&(g+=j,y+=C),u=u.parentNode}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(p&&(o&&g===0||!o&&c>g)||!p&&(o&&y===0||!o&&-c>y))&&(h=!0),h},Pl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ag=function(e){return[e.deltaX,e.deltaY]},zg=function(e){return e&&"current"in e?e.current:e},iE=function(e,t){return e[0]===t[0]&&e[1]===t[1]},aE=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},sE=0,Mi=[];function lE(e){var t=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),o=x.useState(sE++)[0],s=x.useState(function(){return Wx()})[0],c=x.useRef(e);x.useEffect(function(){c.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var w=uf([e.lockRef.current],(e.shards||[]).map(zg),!0).filter(Boolean);return w.forEach(function(k){return k.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),w.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var u=x.useCallback(function(w,k){if("touches"in w&&w.touches.length===2)return!c.current.allowPinchZoom;var j=Pl(w),M=n.current,P="deltaX"in w?w.deltaX:M[0]-j[0],I="deltaY"in w?w.deltaY:M[1]-j[1],T,D=w.target,_=Math.abs(P)>Math.abs(I)?"h":"v";if("touches"in w&&_==="h"&&D.type==="range")return!1;var z=Og(_,D);if(!z)return!0;if(z?T=_:(T=_==="v"?"h":"v",z=Og(_,D)),!z)return!1;if(!r.current&&"changedTouches"in w&&(P||I)&&(r.current=T),!T)return!0;var V=r.current||T;return oE(V,k,w,V==="h"?P:I,!0)},[]),f=x.useCallback(function(w){var k=w;if(!(!Mi.length||Mi[Mi.length-1]!==s)){var j="deltaY"in k?Ag(k):Pl(k),M=t.current.filter(function(T){return T.name===k.type&&T.target===k.target&&iE(T.delta,j)})[0];if(M&&M.should){k.cancelable&&k.preventDefault();return}if(!M){var P=(c.current.shards||[]).map(zg).filter(Boolean).filter(function(T){return T.contains(k.target)}),I=P.length>0?u(k,P[0]):!c.current.noIsolation;I&&k.cancelable&&k.preventDefault()}}},[]),h=x.useCallback(function(w,k,j,M){var P={name:w,delta:k,target:j,should:M};t.current.push(P),setTimeout(function(){t.current=t.current.filter(function(I){return I!==P})},1)},[]),p=x.useCallback(function(w){n.current=Pl(w),r.current=void 0},[]),g=x.useCallback(function(w){h(w.type,Ag(w),w.target,u(w,e.lockRef.current))},[]),y=x.useCallback(function(w){h(w.type,Pl(w),w.target,u(w,e.lockRef.current))},[]);x.useEffect(function(){return Mi.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",f,Ii),document.addEventListener("touchmove",f,Ii),document.addEventListener("touchstart",p,Ii),function(){Mi=Mi.filter(function(w){return w!==s}),document.removeEventListener("wheel",f,Ii),document.removeEventListener("touchmove",f,Ii),document.removeEventListener("touchstart",p,Ii)}},[]);var S=e.removeScrollBar,C=e.inert;return x.createElement(x.Fragment,null,C?x.createElement(s,{styles:aE(o)}):null,S?x.createElement(Qj,{gapMode:"margin"}):null)}const cE=d5(Hx,lE);var Gx=x.forwardRef(function(e,t){return x.createElement(Ic,vr({},e,{ref:t,sideCar:cE}))});Gx.classNames=Ic.classNames;const uE=Gx;function dE(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:c,finalFocusRef:u,returnFocusOnClose:f,preserveScrollBarGap:h,lockFocusAcrossFrames:p,isOpen:g}=Qo(),[y,S]=b3();x.useEffect(()=>{!y&&S&&setTimeout(S)},[y,S]);const C=Lx(r,g);return l.jsx(hx,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:u,restoreFocus:f,contentRef:r,lockFocusAcrossFrames:p,children:l.jsx(uE,{removeScrollBar:!h,allowPinchZoom:c,enabled:C===1&&s,forwardProps:!0,children:e.children})})}var ho=he((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...c}=e,{getDialogProps:u,getDialogContainerProps:f}=Qo(),h=u(c,t),p=f(o),g=Ae("chakra-modal__content",n),y=la(),S={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...y.dialog},C={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...y.dialogContainer},{motionPreset:w}=Qo();return l.jsx(dE,{children:l.jsx(oe.div,{...p,className:"chakra-modal__content-container",tabIndex:-1,__css:C,children:l.jsx(Fx,{preset:w,motionProps:s,className:g,...h,__css:S,children:r})})})});ho.displayName="ModalContent";function qx(e){const{leastDestructiveRef:t,...n}=e;return l.jsx(fo,{...n,initialFocusRef:t})}var Yx=he((e,t)=>l.jsx(ho,{ref:t,role:"alertdialog",...e})),zr=he((e,t)=>{const{className:n,...r}=e,o=Ae("chakra-modal__footer",n),c={display:"flex",alignItems:"center",justifyContent:"flex-end",...la().footer};return l.jsx(oe.footer,{ref:t,...r,__css:c,className:o})});zr.displayName="ModalFooter";var Rr=he((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=Qo();x.useEffect(()=>(s(!0),()=>s(!1)),[s]);const c=Ae("chakra-modal__header",n),f={flex:0,...la().header};return l.jsx(oe.header,{ref:t,className:c,id:o,...r,__css:f})});Rr.displayName="ModalHeader";var fE=oe(Wr.div),Nr=he((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",...la().overlay},{motionPreset:h}=Qo(),g=o||(h==="none"?{}:b2);return l.jsx(fE,{...g,__css:f,ref:t,className:c,...s})});Nr.displayName="ModalOverlay";var Fr=he((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=Qo();x.useEffect(()=>(s(!0),()=>s(!1)),[s]);const c=Ae("chakra-modal__body",n),u=la();return l.jsx(oe.div,{ref:t,className:c,id:o,...r,__css:u.body})});Fr.displayName="ModalBody";var ca=he((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=Qo(),c=Ae("chakra-modal__close-btn",r),u=la();return l.jsx(S3,{ref:t,__css:u.closeButton,className:c,onClick:Pe(n,f=>{f.stopPropagation(),s()}),...o})});ca.displayName="ModalCloseButton";var hE=e=>l.jsx(Jt,{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"})}),pE=e=>l.jsx(Jt,{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 Rg(e,t,n,r){x.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,c=Array.isArray(t)?t:[t],u=new s.MutationObserver(f=>{for(const h of f)h.type==="attributes"&&h.attributeName&&c.includes(h.attributeName)&&n(h)});return u.observe(e.current,{attributes:!0,attributeFilter:c}),()=>u.disconnect()})}function mE(e,t){const n=Ut(e);x.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var vE=50,Ng=300;function gE(e,t){const[n,r]=x.useState(!1),[o,s]=x.useState(null),[c,u]=x.useState(!0),f=x.useRef(null),h=()=>clearTimeout(f.current);mE(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?vE:null);const p=x.useCallback(()=>{c&&e(),f.current=setTimeout(()=>{u(!1),r(!0),s("increment")},Ng)},[e,c]),g=x.useCallback(()=>{c&&t(),f.current=setTimeout(()=>{u(!1),r(!0),s("decrement")},Ng)},[t,c]),y=x.useCallback(()=>{u(!0),r(!1),h()},[]);return x.useEffect(()=>()=>h(),[]),{up:p,down:g,stop:y,isSpinning:n}}var xE=/^[Ee0-9+\-.]$/;function yE(e){return xE.test(e)}function bE(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 SE(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:o=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:c=1,isReadOnly:u,isDisabled:f,isRequired:h,isInvalid:p,pattern:g="[0-9]*(.[0-9]+)?",inputMode:y="decimal",allowMouseWheel:S,id:C,onChange:w,precision:k,name:j,"aria-describedby":M,"aria-label":P,"aria-labelledby":I,onFocus:T,onBlur:D,onInvalid:_,getAriaValueText:z,isValidCharacter:V,format:F,parse:L,...X}=e,$=Ut(T),Q=Ut(D),re=Ut(_),ie=Ut(V??yE),U=Ut(z),K=qw(e),{update:ne,increment:ce,decrement:Re}=K,[ze,Me]=x.useState(!1),J=!(u||f),ue=x.useRef(null),Ie=x.useRef(null),Be=x.useRef(null),Ne=x.useRef(null),Ge=x.useCallback(ee=>ee.split("").filter(ie).join(""),[ie]),Qe=x.useCallback(ee=>{var He;return(He=L==null?void 0:L(ee))!=null?He:ee},[L]),ve=x.useCallback(ee=>{var He;return((He=F==null?void 0:F(ee))!=null?He:ee).toString()},[F]);ti(()=>{(K.valueAsNumber>s||K.valueAsNumber{if(!ue.current)return;if(ue.current.value!=K.value){const He=Qe(ue.current.value);K.setValue(Ge(He))}},[Qe,Ge]);const _e=x.useCallback((ee=c)=>{J&&ce(ee)},[ce,J,c]),qe=x.useCallback((ee=c)=>{J&&Re(ee)},[Re,J,c]),ge=gE(_e,qe);Rg(Be,"disabled",ge.stop,ge.isSpinning),Rg(Ne,"disabled",ge.stop,ge.isSpinning);const Te=x.useCallback(ee=>{if(ee.nativeEvent.isComposing)return;const nt=Qe(ee.currentTarget.value);ne(Ge(nt)),Ie.current={start:ee.currentTarget.selectionStart,end:ee.currentTarget.selectionEnd}},[ne,Ge,Qe]),et=x.useCallback(ee=>{var He,nt,Ft;$==null||$(ee),Ie.current&&(ee.target.selectionStart=(nt=Ie.current.start)!=null?nt:(He=ee.currentTarget.value)==null?void 0:He.length,ee.currentTarget.selectionEnd=(Ft=Ie.current.end)!=null?Ft:ee.currentTarget.selectionStart)},[$]),Ve=x.useCallback(ee=>{if(ee.nativeEvent.isComposing)return;bE(ee,ie)||ee.preventDefault();const He=vt(ee)*c,nt=ee.key,pe={ArrowUp:()=>_e(He),ArrowDown:()=>qe(He),Home:()=>ne(o),End:()=>ne(s)}[nt];pe&&(ee.preventDefault(),pe(ee))},[ie,c,_e,qe,ne,o,s]),vt=ee=>{let He=1;return(ee.metaKey||ee.ctrlKey)&&(He=.1),ee.shiftKey&&(He=10),He},Nt=x.useMemo(()=>{const ee=U==null?void 0:U(K.value);if(ee!=null)return ee;const He=K.value.toString();return He||void 0},[K.value,U]),N=x.useCallback(()=>{let ee=K.value;if(K.value==="")return;/^[eE]/.test(K.value.toString())?K.setValue(""):(K.valueAsNumbers&&(ee=s),K.cast(ee))},[K,s,o]),de=x.useCallback(()=>{Me(!1),n&&N()},[n,Me,N]),xe=x.useCallback(()=>{t&&requestAnimationFrame(()=>{var ee;(ee=ue.current)==null||ee.focus()})},[t]),je=x.useCallback(ee=>{ee.preventDefault(),ge.up(),xe()},[xe,ge]),q=x.useCallback(ee=>{ee.preventDefault(),ge.down(),xe()},[xe,ge]);$o(()=>ue.current,"wheel",ee=>{var He,nt;const pe=((nt=(He=ue.current)==null?void 0:He.ownerDocument)!=null?nt:document).activeElement===ue.current;if(!S||!pe)return;ee.preventDefault();const De=vt(ee)*c,hn=Math.sign(ee.deltaY);hn===-1?_e(De):hn===1&&qe(De)},{passive:!1});const se=x.useCallback((ee={},He=null)=>{const nt=f||r&&K.isAtMax;return{...ee,ref:ct(He,Be),role:"button",tabIndex:-1,onPointerDown:Pe(ee.onPointerDown,Ft=>{Ft.button!==0||nt||je(Ft)}),onPointerLeave:Pe(ee.onPointerLeave,ge.stop),onPointerUp:Pe(ee.onPointerUp,ge.stop),disabled:nt,"aria-disabled":Dr(nt)}},[K.isAtMax,r,je,ge.stop,f]),Fe=x.useCallback((ee={},He=null)=>{const nt=f||r&&K.isAtMin;return{...ee,ref:ct(He,Ne),role:"button",tabIndex:-1,onPointerDown:Pe(ee.onPointerDown,Ft=>{Ft.button!==0||nt||q(Ft)}),onPointerLeave:Pe(ee.onPointerLeave,ge.stop),onPointerUp:Pe(ee.onPointerUp,ge.stop),disabled:nt,"aria-disabled":Dr(nt)}},[K.isAtMin,r,q,ge.stop,f]),Ze=x.useCallback((ee={},He=null)=>{var nt,Ft,pe,De;return{name:j,inputMode:y,type:"text",pattern:g,"aria-labelledby":I,"aria-label":P,"aria-describedby":M,id:C,disabled:f,...ee,readOnly:(nt=ee.readOnly)!=null?nt:u,"aria-readonly":(Ft=ee.readOnly)!=null?Ft:u,"aria-required":(pe=ee.required)!=null?pe:h,required:(De=ee.required)!=null?De:h,ref:ct(ue,He),value:ve(K.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(K.valueAsNumber)?void 0:K.valueAsNumber,"aria-invalid":Dr(p??K.isOutOfRange),"aria-valuetext":Nt,autoComplete:"off",autoCorrect:"off",onChange:Pe(ee.onChange,Te),onKeyDown:Pe(ee.onKeyDown,Ve),onFocus:Pe(ee.onFocus,et,()=>Me(!0)),onBlur:Pe(ee.onBlur,Q,de)}},[j,y,g,I,P,ve,M,C,f,h,u,p,K.value,K.valueAsNumber,K.isOutOfRange,o,s,Nt,Te,Ve,et,Q,de]);return{value:ve(K.value),valueAsNumber:K.valueAsNumber,isFocused:ze,isDisabled:f,isReadOnly:u,getIncrementButtonProps:se,getDecrementButtonProps:Fe,getInputProps:Ze,htmlProps:X}}var[CE,Mc]=Et({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[wE,Fh]=Et({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Lh=he(function(t,n){const r=fn("NumberInput",t),o=At(t),s=uh(o),{htmlProps:c,...u}=SE(s),f=x.useMemo(()=>u,[u]);return l.jsx(wE,{value:f,children:l.jsx(CE,{value:r,children:l.jsx(oe.div,{...c,ref:n,className:Ae("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Lh.displayName="NumberInput";var Bh=he(function(t,n){const r=Mc();return l.jsx(oe.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}})});Bh.displayName="NumberInputStepper";var Hh=he(function(t,n){const{getInputProps:r}=Fh(),o=r(t,n),s=Mc();return l.jsx(oe.input,{...o,className:Ae("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});Hh.displayName="NumberInputField";var Xx=oe("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Wh=he(function(t,n){var r;const o=Mc(),{getDecrementButtonProps:s}=Fh(),c=s(t,n);return l.jsx(Xx,{...c,__css:o.stepper,children:(r=t.children)!=null?r:l.jsx(hE,{})})});Wh.displayName="NumberDecrementStepper";var Vh=he(function(t,n){var r;const{getIncrementButtonProps:o}=Fh(),s=o(t,n),c=Mc();return l.jsx(Xx,{...s,__css:c.stepper,children:(r=t.children)!=null?r:l.jsx(pE,{})})});Vh.displayName="NumberIncrementStepper";var[kE,vs]=Et({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[jE,Uh]=Et({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function $h(e){const t=x.Children.only(e.children),{getTriggerProps:n}=vs();return x.cloneElement(t,n(t.props,t.ref))}$h.displayName="PopoverTrigger";var Ti={click:"click",hover:"hover"};function EE(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:c=!0,arrowSize:u,arrowShadowColor:f,trigger:h=Ti.click,openDelay:p=200,closeDelay:g=200,isLazy:y,lazyBehavior:S="unmount",computePositionOnMount:C,...w}=e,{isOpen:k,onClose:j,onOpen:M,onToggle:P}=Oh(e),I=x.useRef(null),T=x.useRef(null),D=x.useRef(null),_=x.useRef(!1),z=x.useRef(!1);k&&(z.current=!0);const[V,F]=x.useState(!1),[L,X]=x.useState(!1),$=x.useId(),Q=o??$,[re,ie,U,K]=["popover-trigger","popover-content","popover-header","popover-body"].map(Te=>`${Te}-${Q}`),{referenceRef:ne,getArrowProps:ce,getPopperProps:Re,getArrowInnerProps:ze,forceUpdate:Me}=Dh({...w,enabled:k||!!C}),J=Ax({isOpen:k,ref:D});e5({enabled:k,ref:T}),wx(D,{focusRef:T,visible:k,shouldFocus:s&&h===Ti.click}),A6(D,{focusRef:r,visible:k,shouldFocus:c&&h===Ti.click});const ue=Ah({wasSelected:z.current,enabled:y,mode:S,isSelected:J.present}),Ie=x.useCallback((Te={},et=null)=>{const Ve={...Te,style:{...Te.style,transformOrigin:Vt.transformOrigin.varRef,[Vt.arrowSize.var]:u?`${u}px`:void 0,[Vt.arrowShadowColor.var]:f},ref:ct(D,et),children:ue?Te.children:null,id:ie,tabIndex:-1,role:"dialog",onKeyDown:Pe(Te.onKeyDown,vt=>{n&&vt.key==="Escape"&&j()}),onBlur:Pe(Te.onBlur,vt=>{const Nt=Fg(vt),N=Pd(D.current,Nt),de=Pd(T.current,Nt);k&&t&&(!N&&!de)&&j()}),"aria-labelledby":V?U:void 0,"aria-describedby":L?K:void 0};return h===Ti.hover&&(Ve.role="tooltip",Ve.onMouseEnter=Pe(Te.onMouseEnter,()=>{_.current=!0}),Ve.onMouseLeave=Pe(Te.onMouseLeave,vt=>{vt.nativeEvent.relatedTarget!==null&&(_.current=!1,setTimeout(()=>j(),g))})),Ve},[ue,ie,V,U,L,K,h,n,j,k,t,g,f,u]),Be=x.useCallback((Te={},et=null)=>Re({...Te,style:{visibility:k?"visible":"hidden",...Te.style}},et),[k,Re]),Ne=x.useCallback((Te,et=null)=>({...Te,ref:ct(et,I,ne)}),[I,ne]),Ge=x.useRef(),Qe=x.useRef(),ve=x.useCallback(Te=>{I.current==null&&ne(Te)},[ne]),_e=x.useCallback((Te={},et=null)=>{const Ve={...Te,ref:ct(T,et,ve),id:re,"aria-haspopup":"dialog","aria-expanded":k,"aria-controls":ie};return h===Ti.click&&(Ve.onClick=Pe(Te.onClick,P)),h===Ti.hover&&(Ve.onFocus=Pe(Te.onFocus,()=>{Ge.current===void 0&&M()}),Ve.onBlur=Pe(Te.onBlur,vt=>{const Nt=Fg(vt),N=!Pd(D.current,Nt);k&&t&&N&&j()}),Ve.onKeyDown=Pe(Te.onKeyDown,vt=>{vt.key==="Escape"&&j()}),Ve.onMouseEnter=Pe(Te.onMouseEnter,()=>{_.current=!0,Ge.current=window.setTimeout(()=>M(),p)}),Ve.onMouseLeave=Pe(Te.onMouseLeave,()=>{_.current=!1,Ge.current&&(clearTimeout(Ge.current),Ge.current=void 0),Qe.current=window.setTimeout(()=>{_.current===!1&&j()},g)})),Ve},[re,k,ie,h,ve,P,M,t,j,p,g]);x.useEffect(()=>()=>{Ge.current&&clearTimeout(Ge.current),Qe.current&&clearTimeout(Qe.current)},[]);const qe=x.useCallback((Te={},et=null)=>({...Te,id:U,ref:ct(et,Ve=>{F(!!Ve)})}),[U]),ge=x.useCallback((Te={},et=null)=>({...Te,id:K,ref:ct(et,Ve=>{X(!!Ve)})}),[K]);return{forceUpdate:Me,isOpen:k,onAnimationComplete:J.onComplete,onClose:j,getAnchorProps:Ne,getArrowProps:ce,getArrowInnerProps:ze,getPopoverPositionerProps:Be,getPopoverProps:Ie,getTriggerProps:_e,getHeaderProps:qe,getBodyProps:ge}}function Pd(e,t){return e===t||(e==null?void 0:e.contains(t))}function Fg(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Gh(e){const t=fn("Popover",e),{children:n,...r}=At(e),o=ei(),s=EE({...r,direction:o.direction});return l.jsx(kE,{value:s,children:l.jsx(jE,{value:t,children:k1(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Gh.displayName="Popover";function qh(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:c}=e,{getArrowProps:u,getArrowInnerProps:f}=vs(),h=Uh(),p=(t=n??r)!=null?t:o,g=s??c;return l.jsx(oe.div,{...u(),className:"chakra-popover__arrow-positioner",children:l.jsx(oe.div,{className:Ae("chakra-popover__arrow",e.className),...f(e),__css:{"--popper-arrow-bg":p?`colors.${p}, ${p}`:void 0,"--popper-arrow-shadow":g?`shadows.${g}, ${g}`:void 0,...h.arrow}})})}qh.displayName="PopoverArrow";var Kx=he(function(t,n){const{getBodyProps:r}=vs(),o=Uh();return l.jsx(oe.div,{...r(t,n),className:Ae("chakra-popover__body",t.className),__css:o.body})});Kx.displayName="PopoverBody";function PE(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var IE={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]}}},ME=oe(Wr.section),Qx=he(function(t,n){const{variants:r=IE,...o}=t,{isOpen:s}=vs();return l.jsx(ME,{ref:n,variants:PE(r),initial:!1,animate:s?"enter":"exit",...o})});Qx.displayName="PopoverTransition";var Yh=he(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:c,getPopoverPositionerProps:u,onAnimationComplete:f}=vs(),h=Uh(),p={position:"relative",display:"flex",flexDirection:"column",...h.content};return l.jsx(oe.div,{...u(r),__css:h.popper,className:"chakra-popover__popper",children:l.jsx(Qx,{...o,...c(s,n),onAnimationComplete:yc(f,s.onAnimationComplete),className:Ae("chakra-popover__content",t.className),__css:p})})});Yh.displayName="PopoverContent";function TE(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 _E=Jo({"0%":{left:"-40%"},"100%":{left:"100%"}}),DE=Jo({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function OE(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:c,role:u="progressbar"}=e,f=TE(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[AE,zE]=Et({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),RE=he((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:c,...u}=e,f=OE({value:o,min:n,max:r,isIndeterminate:s,role:c}),p={height:"100%",...zE().filledTrack};return l.jsx(oe.div,{ref:t,style:{width:`${f.percent}%`,...u.style},...f.bind,...u,__css:p})}),Zx=he((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:c,isAnimated:u,children:f,borderRadius:h,isIndeterminate:p,"aria-label":g,"aria-labelledby":y,"aria-valuetext":S,title:C,role:w,...k}=At(e),j=fn("Progress",e),M=h??((n=j.track)==null?void 0:n.borderRadius),P={animation:`${DE} 1s linear infinite`},D={...!p&&c&&u&&P,...p&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${_E} 1s ease infinite normal none running`}},_={overflow:"hidden",position:"relative",...j.track};return l.jsx(oe.div,{ref:t,borderRadius:M,__css:_,...k,children:l.jsxs(AE,{value:j,children:[l.jsx(RE,{"aria-label":g,"aria-labelledby":y,"aria-valuetext":S,min:o,max:s,value:r,isIndeterminate:p,css:D,borderRadius:M,title:C,role:w}),f]})})});Zx.displayName="Progress";function NE(e){return e&&Kd(e)&&Kd(e.target)}function FE(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:c,isNative:u,...f}=e,[h,p]=x.useState(r||""),g=typeof n<"u",y=g?n:h,S=x.useRef(null),C=x.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 z=T.querySelector(D);z==null||z.focus()},[]),k=`radio-${x.useId()}`,j=o||k,M=x.useCallback(T=>{const D=NE(T)?T.target.value:T;g||p(D),t==null||t(String(D))},[t,g]),P=x.useCallback((T={},D=null)=>({...T,ref:ct(D,S),role:"radiogroup"}),[]),I=x.useCallback((T={},D=null)=>({...T,ref:D,name:j,[u?"checked":"isChecked"]:y!=null?T.value===y:void 0,onChange(z){M(z)},"data-radiogroup":!0}),[u,j,M,y]);return{getRootProps:P,getRadioProps:I,name:j,ref:S,focus:C,setValue:p,value:y,onChange:M,isDisabled:s,isFocusable:c,htmlProps:f}}var[LE,Jx]=Et({name:"RadioGroupContext",strict:!1}),Ja=he((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:c,isDisabled:u,isFocusable:f,...h}=e,{value:p,onChange:g,getRootProps:y,name:S,htmlProps:C}=FE(h),w=x.useMemo(()=>({name:S,size:r,onChange:g,colorScheme:n,value:p,variant:o,isDisabled:u,isFocusable:f}),[S,r,g,n,p,o,u,f]);return l.jsx(LE,{value:w,children:l.jsx(oe.div,{...y(C,t),className:Ae("chakra-radio-group",c),children:s})})});Ja.displayName="RadioGroup";var BE={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function HE(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:c,onChange:u,isInvalid:f,name:h,value:p,id:g,"data-radiogroup":y,"aria-describedby":S,...C}=e,w=`radio-${x.useId()}`,k=ri(),M=!!Jx()||!!y;let I=!!k&&!M?k.id:w;I=g??I;const T=o??(k==null?void 0:k.isDisabled),D=s??(k==null?void 0:k.isReadOnly),_=c??(k==null?void 0:k.isRequired),z=f??(k==null?void 0:k.isInvalid),[V,F]=x.useState(!1),[L,X]=x.useState(!1),[$,Q]=x.useState(!1),[re,ie]=x.useState(!1),[U,K]=x.useState(Boolean(t)),ne=typeof n<"u",ce=ne?n:U;x.useEffect(()=>k2(F),[]);const Re=x.useCallback(ve=>{if(D||T){ve.preventDefault();return}ne||K(ve.target.checked),u==null||u(ve)},[ne,T,D,u]),ze=x.useCallback(ve=>{ve.key===" "&&ie(!0)},[ie]),Me=x.useCallback(ve=>{ve.key===" "&&ie(!1)},[ie]),J=x.useCallback((ve={},_e=null)=>({...ve,ref:_e,"data-active":Ye(re),"data-hover":Ye($),"data-disabled":Ye(T),"data-invalid":Ye(z),"data-checked":Ye(ce),"data-focus":Ye(L),"data-focus-visible":Ye(L&&V),"data-readonly":Ye(D),"aria-hidden":!0,onMouseDown:Pe(ve.onMouseDown,()=>ie(!0)),onMouseUp:Pe(ve.onMouseUp,()=>ie(!1)),onMouseEnter:Pe(ve.onMouseEnter,()=>Q(!0)),onMouseLeave:Pe(ve.onMouseLeave,()=>Q(!1))}),[re,$,T,z,ce,L,D,V]),{onFocus:ue,onBlur:Ie}=k??{},Be=x.useCallback((ve={},_e=null)=>{const qe=T&&!r;return{...ve,id:I,ref:_e,type:"radio",name:h,value:p,onChange:Pe(ve.onChange,Re),onBlur:Pe(Ie,ve.onBlur,()=>X(!1)),onFocus:Pe(ue,ve.onFocus,()=>X(!0)),onKeyDown:Pe(ve.onKeyDown,ze),onKeyUp:Pe(ve.onKeyUp,Me),checked:ce,disabled:qe,readOnly:D,required:_,"aria-invalid":Dr(z),"aria-disabled":Dr(qe),"aria-required":Dr(_),"data-readonly":Ye(D),"aria-describedby":S,style:BE}},[T,r,I,h,p,Re,Ie,ue,ze,Me,ce,D,_,z,S]);return{state:{isInvalid:z,isFocused:L,isChecked:ce,isActive:re,isHovered:$,isDisabled:T,isReadOnly:D,isRequired:_},getCheckboxProps:J,getInputProps:Be,getLabelProps:(ve={},_e=null)=>({...ve,ref:_e,onMouseDown:Pe(ve.onMouseDown,Lg),onTouchStart:Pe(ve.onTouchStart,Lg),"data-disabled":Ye(T),"data-checked":Ye(ce),"data-invalid":Ye(z)}),getRootProps:(ve,_e=null)=>({...ve,ref:_e,"data-disabled":Ye(T),"data-checked":Ye(ce),"data-invalid":Ye(z)}),htmlProps:C}}function Lg(e){e.preventDefault(),e.stopPropagation()}function WE(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 jn=he((e,t)=>{var n;const r=Jx(),{onChange:o,value:s}=e,c=fn("Radio",{...r,...e}),u=At(e),{spacing:f="0.5rem",children:h,isDisabled:p=r==null?void 0:r.isDisabled,isFocusable:g=r==null?void 0:r.isFocusable,inputProps:y,...S}=u;let C=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(C=r.value===s);let w=o;r!=null&&r.onChange&&s!=null&&(w=yc(r.onChange,o));const k=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:j,getCheckboxProps:M,getLabelProps:P,getRootProps:I,htmlProps:T}=HE({...S,isChecked:C,isFocusable:g,isDisabled:p,onChange:w,name:k}),[D,_]=WE(T,j1),z=M(_),V=j(y,t),F=P(),L=Object.assign({},D,I()),X={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...c.container},$={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...c.control},Q={userSelect:"none",marginStart:f,...c.label};return l.jsxs(oe.label,{className:"chakra-radio",...L,__css:X,children:[l.jsx("input",{className:"chakra-radio__input",...V}),l.jsx(oe.span,{className:"chakra-radio__control",...z,__css:$}),h&&l.jsx(oe.span,{className:"chakra-radio__label",...F,__css:Q,children:h})]})});jn.displayName="Radio";var ey=he(function(t,n){const{children:r,placeholder:o,className:s,...c}=t;return l.jsxs(oe.select,{...c,ref:n,className:Ae("chakra-select",s),children:[o&&l.jsx("option",{value:"",children:o}),r]})});ey.displayName="SelectField";function VE(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 ty=he((e,t)=>{var n;const r=fn("Select",e),{rootProps:o,placeholder:s,icon:c,color:u,height:f,h,minH:p,minHeight:g,iconColor:y,iconSize:S,...C}=At(e),[w,k]=VE(C,j1),j=ch(k),M={width:"100%",height:"fit-content",position:"relative",color:u},P={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return l.jsxs(oe.div,{className:"chakra-select__wrapper",__css:M,...w,...o,children:[l.jsx(ey,{ref:t,height:h??f,minH:p??g,placeholder:s,...j,__css:P,children:e.children}),l.jsx(ny,{"data-disabled":Ye(j.disabled),...(y||u)&&{color:y||u},__css:r.icon,...S&&{fontSize:S},children:c})]})});ty.displayName="Select";var UE=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"})}),$E=oe("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),ny=e=>{const{children:t=l.jsx(UE,{}),...n}=e,r=x.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return l.jsx($E,{...n,className:"chakra-select__icon-wrapper",children:x.isValidElement(t)?r:null})};ny.displayName="SelectIcon";var _i=e=>e?"":void 0,Id=e=>e?!0:void 0,gs=(...e)=>e.filter(Boolean).join(" ");function Md(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function Il(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var Xl={width:0,height:0},Ml=e=>e||Xl;function GE(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=w=>{var k;const j=(k=r[w])!=null?k:Xl;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Il({orientation:t,vertical:{bottom:`calc(${n[w]}% - ${j.height/2}px)`},horizontal:{left:`calc(${n[w]}% - ${j.width/2}px)`}})}},c=t==="vertical"?r.reduce((w,k)=>Ml(w).height>Ml(k).height?w:k,Xl):r.reduce((w,k)=>Ml(w).width>Ml(k).width?w:k,Xl),u={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Il({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",...Il({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},h=n.length===1,p=[0,o?100-n[0]:n[0]],g=h?p:n;let y=g[0];!h&&o&&(y=100-y);const S=Math.abs(g[g.length-1]-g[0]),C={...f,...Il({orientation:t,vertical:o?{height:`${S}%`,top:`${y}%`}:{height:`${S}%`,bottom:`${y}%`},horizontal:o?{width:`${S}%`,right:`${y}%`}:{width:`${S}%`,left:`${y}%`}})};return{trackStyle:f,innerTrackStyle:C,rootStyle:u,getThumbStyle:s}}function qE(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function YE(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function XE(e){const t=QE(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function ry(e){return!!e.touches}function KE(e){return ry(e)&&e.touches.length>1}function QE(e){var t;return(t=e.view)!=null?t:window}function ZE(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function JE(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function oy(e,t="page"){return ry(e)?ZE(e,t):JE(e,t)}function e7(e){return t=>{const n=XE(t);(!n||n&&t.button===0)&&e(t)}}function t7(e,t=!1){function n(o){e(o,{point:oy(o)})}return t?e7(n):n}function Kl(e,t,n,r){return YE(e,t,t7(n,t==="pointerdown"),r)}var n7=Object.defineProperty,r7=(e,t,n)=>t in e?n7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tr=(e,t,n)=>(r7(e,typeof t!="symbol"?t+"":t,n),n),o7=class{constructor(e,t,n){tr(this,"history",[]),tr(this,"startEvent",null),tr(this,"lastEvent",null),tr(this,"lastEventInfo",null),tr(this,"handlers",{}),tr(this,"removeListeners",()=>{}),tr(this,"threshold",3),tr(this,"win"),tr(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const u=Td(this.lastEventInfo,this.history),f=this.startEvent!==null,h=l7(u.offset,{x:0,y:0})>=this.threshold;if(!f&&!h)return;const{timestamp:p}=Jv();this.history.push({...u.point,timestamp:p});const{onStart:g,onMove:y}=this.handlers;f||(g==null||g(this.lastEvent,u),this.startEvent=this.lastEvent),y==null||y(this.lastEvent,u)}),tr(this,"onPointerMove",(u,f)=>{this.lastEvent=u,this.lastEventInfo=f,A3.update(this.updatePoint,!0)}),tr(this,"onPointerUp",(u,f)=>{const h=Td(f,this.history),{onEnd:p,onSessionEnd:g}=this.handlers;g==null||g(u,h),this.end(),!(!p||!this.startEvent)&&(p==null||p(u,h))});var r;if(this.win=(r=e.view)!=null?r:window,KE(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:oy(e)},{timestamp:s}=Jv();this.history=[{...o.point,timestamp:s}];const{onSessionStart:c}=t;c==null||c(e,Td(o,this.history)),this.removeListeners=s7(Kl(this.win,"pointermove",this.onPointerMove),Kl(this.win,"pointerup",this.onPointerUp),Kl(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),z3.update(this.updatePoint)}};function Bg(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Td(e,t){return{point:e.point,delta:Bg(e.point,t[t.length-1]),offset:Bg(e.point,t[0]),velocity:a7(t,.1)}}var i7=e=>e*1e3;function a7(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>i7(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 s7(...e){return t=>e.reduce((n,r)=>r(n),t)}function _d(e,t){return Math.abs(e-t)}function Hg(e){return"x"in e&&"y"in e}function l7(e,t){if(typeof e=="number"&&typeof t=="number")return _d(e,t);if(Hg(e)&&Hg(t)){const n=_d(e.x,t.x),r=_d(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function iy(e){const t=x.useRef(null);return t.current=e,t}function c7(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:c,threshold:u}=t,f=Boolean(n||r||o||s||c),h=x.useRef(null),p=iy({onSessionStart:s,onSessionEnd:c,onStart:r,onMove:n,onEnd(g,y){h.current=null,o==null||o(g,y)}});x.useEffect(()=>{var g;(g=h.current)==null||g.updateHandlers(p.current)}),x.useEffect(()=>{const g=e.current;if(!g||!f)return;function y(S){h.current=new o7(S,p.current,u)}return Kl(g,"pointerdown",y)},[e,f,p,u]),x.useEffect(()=>()=>{var g;(g=h.current)==null||g.end(),h.current=null},[])}function u7(e,t){var n;if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const r=(n=e.ownerDocument.defaultView)!=null?n:window,o=new r.ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const[c]=s;let u,f;if("borderBoxSize"in c){const h=c.borderBoxSize,p=Array.isArray(h)?h[0]:h;u=p.inlineSize,f=p.blockSize}else u=e.offsetWidth,f=e.offsetHeight;t({width:u,height:f})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}var d7=Boolean(globalThis==null?void 0:globalThis.document)?x.useLayoutEffect:x.useEffect;function f7(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 h7({getNodes:e,observeMutation:t=!0}){const[n,r]=x.useState([]),[o,s]=x.useState(0);return d7(()=>{const c=e(),u=c.map((f,h)=>u7(f,p=>{r(g=>[...g.slice(0,h),p,...g.slice(h+1)])}));if(t){const f=c[0];u.push(f7(f,()=>{s(h=>h+1)}))}return()=>{u.forEach(f=>{f==null||f()})}},[o]),n}function p7(e){return typeof e=="object"&&e!==null&&"current"in e}function m7(e){const[t]=h7({observeMutation:!1,getNodes(){return[p7(e)?e.current:e]}});return t}function v7(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:c,isReversed:u,direction:f="ltr",orientation:h="horizontal",id:p,isDisabled:g,isReadOnly:y,onChangeStart:S,onChangeEnd:C,step:w=1,getAriaValueText:k,"aria-valuetext":j,"aria-label":M,"aria-labelledby":P,name:I,focusThumbOnChange:T=!0,...D}=e,_=Ut(S),z=Ut(C),V=Ut(k),F=qE({isReversed:u,direction:f,orientation:h}),[L,X]=ih({value:s,defaultValue:c??x7(n,r),onChange:o}),[$,Q]=x.useState(!1),[re,ie]=x.useState(!1),U=!(g||y),K=(r-n)/10,ne=w||(r-n)/100,ce=$l(L,n,r),Re=r-ce+n,Me=ug(F?Re:ce,n,r),J=h==="vertical",ue=iy({min:n,max:r,step:w,isDisabled:g,value:ce,isInteractive:U,isReversed:F,isVertical:J,eventSource:null,focusThumbOnChange:T,orientation:h}),Ie=x.useRef(null),Be=x.useRef(null),Ne=x.useRef(null),Ge=x.useId(),Qe=p??Ge,[ve,_e]=[`slider-thumb-${Qe}`,`slider-track-${Qe}`],qe=x.useCallback(pe=>{var De,hn;if(!Ie.current)return;const $t=ue.current;$t.eventSource="pointer";const pn=Ie.current.getBoundingClientRect(),{clientX:or,clientY:bo}=(hn=(De=pe.touches)==null?void 0:De[0])!=null?hn:pe,da=J?pn.bottom-bo:or-pn.left,Kc=J?pn.height:pn.width;let fa=da/Kc;F&&(fa=1-fa);let So=Gw(fa,$t.min,$t.max);return $t.step&&(So=parseFloat(dg(So,$t.min,$t.step))),So=$l(So,$t.min,$t.max),So},[J,F,ue]),ge=x.useCallback(pe=>{const De=ue.current;De.isInteractive&&(pe=parseFloat(dg(pe,De.min,ne)),pe=$l(pe,De.min,De.max),X(pe))},[ne,X,ue]),Te=x.useMemo(()=>({stepUp(pe=ne){const De=F?ce-pe:ce+pe;ge(De)},stepDown(pe=ne){const De=F?ce+pe:ce-pe;ge(De)},reset(){ge(c||0)},stepTo(pe){ge(pe)}}),[ge,F,ce,ne,c]),et=x.useCallback(pe=>{const De=ue.current,$t={ArrowRight:()=>Te.stepUp(),ArrowUp:()=>Te.stepUp(),ArrowLeft:()=>Te.stepDown(),ArrowDown:()=>Te.stepDown(),PageUp:()=>Te.stepUp(K),PageDown:()=>Te.stepDown(K),Home:()=>ge(De.min),End:()=>ge(De.max)}[pe.key];$t&&(pe.preventDefault(),pe.stopPropagation(),$t(pe),De.eventSource="keyboard")},[Te,ge,K,ue]),Ve=(t=V==null?void 0:V(ce))!=null?t:j,vt=m7(Be),{getThumbStyle:Nt,rootStyle:N,trackStyle:de,innerTrackStyle:xe}=x.useMemo(()=>{const pe=ue.current,De=vt??{width:0,height:0};return GE({isReversed:F,orientation:pe.orientation,thumbRects:[De],thumbPercents:[Me]})},[F,vt,Me,ue]),je=x.useCallback(()=>{ue.current.focusThumbOnChange&&setTimeout(()=>{var De;return(De=Be.current)==null?void 0:De.focus()})},[ue]);ti(()=>{const pe=ue.current;je(),pe.eventSource==="keyboard"&&(z==null||z(pe.value))},[ce,z]);function q(pe){const De=qe(pe);De!=null&&De!==ue.current.value&&X(De)}c7(Ne,{onPanSessionStart(pe){const De=ue.current;De.isInteractive&&(Q(!0),je(),q(pe),_==null||_(De.value))},onPanSessionEnd(){const pe=ue.current;pe.isInteractive&&(Q(!1),z==null||z(pe.value))},onPan(pe){ue.current.isInteractive&&q(pe)}});const se=x.useCallback((pe={},De=null)=>({...pe,...D,ref:ct(De,Ne),tabIndex:-1,"aria-disabled":Id(g),"data-focused":_i(re),style:{...pe.style,...N}}),[D,g,re,N]),Fe=x.useCallback((pe={},De=null)=>({...pe,ref:ct(De,Ie),id:_e,"data-disabled":_i(g),style:{...pe.style,...de}}),[g,_e,de]),Ze=x.useCallback((pe={},De=null)=>({...pe,ref:De,style:{...pe.style,...xe}}),[xe]),ee=x.useCallback((pe={},De=null)=>({...pe,ref:ct(De,Be),role:"slider",tabIndex:U?0:void 0,id:ve,"data-active":_i($),"aria-valuetext":Ve,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":ce,"aria-orientation":h,"aria-disabled":Id(g),"aria-readonly":Id(y),"aria-label":M,"aria-labelledby":M?void 0:P,style:{...pe.style,...Nt(0)},onKeyDown:Md(pe.onKeyDown,et),onFocus:Md(pe.onFocus,()=>ie(!0)),onBlur:Md(pe.onBlur,()=>ie(!1))}),[U,ve,$,Ve,n,r,ce,h,g,y,M,P,Nt,et]),He=x.useCallback((pe,De=null)=>{const hn=!(pe.valuer),$t=ce>=pe.value,pn=ug(pe.value,n,r),or={position:"absolute",pointerEvents:"none",...g7({orientation:h,vertical:{bottom:F?`${100-pn}%`:`${pn}%`},horizontal:{left:F?`${100-pn}%`:`${pn}%`}})};return{...pe,ref:De,role:"presentation","aria-hidden":!0,"data-disabled":_i(g),"data-invalid":_i(!hn),"data-highlighted":_i($t),style:{...pe.style,...or}}},[g,F,r,n,h,ce]),nt=x.useCallback((pe={},De=null)=>({...pe,ref:De,type:"hidden",value:ce,name:I}),[I,ce]);return{state:{value:ce,isFocused:re,isDragging:$},actions:Te,getRootProps:se,getTrackProps:Fe,getInnerTrackProps:Ze,getThumbProps:ee,getMarkerProps:He,getInputProps:nt}}function g7(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function x7(e,t){return t"}),[b7,_c]=Et({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),ay=he((e,t)=>{const n={orientation:"horizontal",...e},r=fn("Slider",n),o=At(n),{direction:s}=ei();o.direction=s;const{getInputProps:c,getRootProps:u,...f}=v7(o),h=u(),p=c({},t);return l.jsx(y7,{value:f,children:l.jsx(b7,{value:r,children:l.jsxs(oe.div,{...h,className:gs("chakra-slider",n.className),__css:r.container,children:[n.children,l.jsx("input",{...p})]})})})});ay.displayName="Slider";var sy=he((e,t)=>{const{getThumbProps:n}=Tc(),r=_c(),o=n(e,t);return l.jsx(oe.div,{...o,className:gs("chakra-slider__thumb",e.className),__css:r.thumb})});sy.displayName="SliderThumb";var ly=he((e,t)=>{const{getTrackProps:n}=Tc(),r=_c(),o=n(e,t);return l.jsx(oe.div,{...o,className:gs("chakra-slider__track",e.className),__css:r.track})});ly.displayName="SliderTrack";var cy=he((e,t)=>{const{getInnerTrackProps:n}=Tc(),r=_c(),o=n(e,t);return l.jsx(oe.div,{...o,className:gs("chakra-slider__filled-track",e.className),__css:r.filledTrack})});cy.displayName="SliderFilledTrack";var If=he((e,t)=>{const{getMarkerProps:n}=Tc(),r=_c(),o=n(e,t);return l.jsx(oe.div,{...o,className:gs("chakra-slider__marker",e.className),__css:r.mark})});If.displayName="SliderMark";var uy=he(function(t,n){const r=fn("Switch",t),{spacing:o="0.5rem",children:s,...c}=At(t),{state:u,getInputProps:f,getCheckboxProps:h,getRootProps:p,getLabelProps:g}=j2(c),y=x.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),S=x.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),C=x.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return l.jsxs(oe.label,{...p(),className:Ae("chakra-switch",t.className),__css:y,children:[l.jsx("input",{className:"chakra-switch__input",...f({},n)}),l.jsx(oe.span,{...h(),className:"chakra-switch__track",__css:S,children:l.jsx(oe.span,{__css:r.thumb,className:"chakra-switch__thumb","data-checked":Ye(u.isChecked),"data-hover":Ye(u.isHovered)})}),s&&l.jsx(oe.span,{className:"chakra-switch__label",...g(),__css:C,children:s})]})});uy.displayName="Switch";var[S7,C7,w7,k7]=rh();function j7(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:c,lazyBehavior:u="unmount",orientation:f="horizontal",direction:h="ltr",...p}=e,[g,y]=x.useState(n??0),[S,C]=ih({defaultValue:n??0,value:o,onChange:r});x.useEffect(()=>{o!=null&&y(o)},[o]);const w=w7(),k=x.useId();return{id:`tabs-${(t=e.id)!=null?t:k}`,selectedIndex:S,focusedIndex:g,setSelectedIndex:C,setFocusedIndex:y,isManual:s,isLazy:c,lazyBehavior:u,orientation:f,descendants:w,direction:h,htmlProps:p}}var[E7,Dc]=Et({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function P7(e){const{focusedIndex:t,orientation:n,direction:r}=Dc(),o=C7(),s=x.useCallback(c=>{const u=()=>{var M;const P=o.nextEnabled(t);P&&((M=P.node)==null||M.focus())},f=()=>{var M;const P=o.prevEnabled(t);P&&((M=P.node)==null||M.focus())},h=()=>{var M;const P=o.firstEnabled();P&&((M=P.node)==null||M.focus())},p=()=>{var M;const P=o.lastEnabled();P&&((M=P.node)==null||M.focus())},g=n==="horizontal",y=n==="vertical",S=c.key,C=r==="ltr"?"ArrowLeft":"ArrowRight",w=r==="ltr"?"ArrowRight":"ArrowLeft",j={[C]:()=>g&&f(),[w]:()=>g&&u(),ArrowDown:()=>y&&u(),ArrowUp:()=>y&&f(),Home:h,End:p}[S];j&&(c.preventDefault(),j(c))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:Pe(e.onKeyDown,s)}}function I7(e){const{isDisabled:t,isFocusable:n,...r}=e,{setSelectedIndex:o,isManual:s,id:c,setFocusedIndex:u,selectedIndex:f}=Dc(),{index:h,register:p}=k7({disabled:t&&!n}),g=h===f,y=()=>{o(h)},S=()=>{u(h),!s&&!(t&&n)&&o(h)},C=Cx({...r,ref:ct(p,e.ref),isDisabled:t,isFocusable:n,onClick:Pe(e.onClick,y)}),w="button";return{...C,id:dy(c,h),role:"tab",tabIndex:g?0:-1,type:w,"aria-selected":g,"aria-controls":fy(c,h),onFocus:t?void 0:Pe(e.onFocus,S)}}var[M7,T7]=Et({});function _7(e){const t=Dc(),{id:n,selectedIndex:r}=t,s=lh(e.children).map((c,u)=>x.createElement(M7,{key:u,value:{isSelected:u===r,id:fy(n,u),tabId:dy(n,u),selectedIndex:r}},c));return{...e,children:s}}function D7(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=Dc(),{isSelected:s,id:c,tabId:u}=T7(),f=x.useRef(!1);s&&(f.current=!0);const h=Ah({wasSelected:f.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:h?t:null,role:"tabpanel","aria-labelledby":u,hidden:!s,id:c}}function dy(e,t){return`${e}--tab-${t}`}function fy(e,t){return`${e}--tabpanel-${t}`}var[O7,Oc]=Et({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),hy=he(function(t,n){const r=fn("Tabs",t),{children:o,className:s,...c}=At(t),{htmlProps:u,descendants:f,...h}=j7(c),p=x.useMemo(()=>h,[h]),{isFitted:g,...y}=u;return l.jsx(S7,{value:f,children:l.jsx(E7,{value:p,children:l.jsx(O7,{value:r,children:l.jsx(oe.div,{className:Ae("chakra-tabs",s),ref:n,...y,__css:r.root,children:o})})})})});hy.displayName="Tabs";var py=he(function(t,n){const r=P7({...t,ref:n}),s={display:"flex",...Oc().tablist};return l.jsx(oe.div,{...r,className:Ae("chakra-tabs__tablist",t.className),__css:s})});py.displayName="TabList";var my=he(function(t,n){const r=D7({...t,ref:n}),o=Oc();return l.jsx(oe.div,{outline:"0",...r,className:Ae("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});my.displayName="TabPanel";var vy=he(function(t,n){const r=_7(t),o=Oc();return l.jsx(oe.div,{...r,width:"100%",ref:n,className:Ae("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});vy.displayName="TabPanels";var gy=he(function(t,n){const r=Oc(),o=I7({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return l.jsx(oe.button,{...o,className:Ae("chakra-tabs__tab",t.className),__css:s})});gy.displayName="Tab";function A7(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var z7=["h","minH","height","minHeight"],Xh=he((e,t)=>{const n=mo("Textarea",e),{className:r,rows:o,...s}=At(e),c=ch(s),u=o?A7(n,z7):n;return l.jsx(oe.textarea,{ref:t,rows:o,...c,className:Ae("chakra-textarea",r),__css:u})});Xh.displayName="Textarea";var R7={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]}}}},cc=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 N7(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:c=o,closeOnEsc:u=!0,onOpen:f,onClose:h,placement:p,id:g,isOpen:y,defaultIsOpen:S,arrowSize:C=10,arrowShadowColor:w,arrowPadding:k,modifiers:j,isDisabled:M,gutter:P,offset:I,direction:T,...D}=e,{isOpen:_,onOpen:z,onClose:V}=Oh({isOpen:y,defaultIsOpen:S,onOpen:f,onClose:h}),{referenceRef:F,getPopperProps:L,getArrowInnerProps:X,getArrowProps:$}=Dh({enabled:_,placement:p,arrowPadding:k,modifiers:j,gutter:P,offset:I,direction:T}),Q=x.useId(),ie=`tooltip-${g??Q}`,U=x.useRef(null),K=x.useRef(),ne=x.useCallback(()=>{K.current&&(clearTimeout(K.current),K.current=void 0)},[]),ce=x.useRef(),Re=x.useCallback(()=>{ce.current&&(clearTimeout(ce.current),ce.current=void 0)},[]),ze=x.useCallback(()=>{Re(),V()},[V,Re]),Me=F7(U,ze),J=x.useCallback(()=>{if(!M&&!K.current){Me();const _e=Mf(U);K.current=_e.setTimeout(z,t)}},[Me,M,z,t]),ue=x.useCallback(()=>{ne();const _e=Mf(U);ce.current=_e.setTimeout(ze,n)},[n,ze,ne]),Ie=x.useCallback(()=>{_&&r&&ue()},[r,ue,_]),Be=x.useCallback(()=>{_&&c&&ue()},[c,ue,_]),Ne=x.useCallback(_e=>{_&&_e.key==="Escape"&&ue()},[_,ue]);$o(()=>cc(U),"keydown",u?Ne:void 0),$o(()=>cc(U),"scroll",()=>{_&&s&&ze()}),x.useEffect(()=>{M&&(ne(),_&&V())},[M,_,V,ne]),x.useEffect(()=>()=>{ne(),Re()},[ne,Re]),$o(()=>U.current,"pointerleave",ue);const Ge=x.useCallback((_e={},qe=null)=>({..._e,ref:ct(U,qe,F),onPointerEnter:Pe(_e.onPointerEnter,Te=>{Te.pointerType!=="touch"&&J()}),onClick:Pe(_e.onClick,Ie),onPointerDown:Pe(_e.onPointerDown,Be),onFocus:Pe(_e.onFocus,J),onBlur:Pe(_e.onBlur,ue),"aria-describedby":_?ie:void 0}),[J,ue,Be,_,ie,Ie,F]),Qe=x.useCallback((_e={},qe=null)=>L({..._e,style:{..._e.style,[Vt.arrowSize.var]:C?`${C}px`:void 0,[Vt.arrowShadowColor.var]:w}},qe),[L,C,w]),ve=x.useCallback((_e={},qe=null)=>{const ge={..._e.style,position:"relative",transformOrigin:Vt.transformOrigin.varRef};return{ref:qe,...D,..._e,id:ie,role:"tooltip",style:ge}},[D,ie]);return{isOpen:_,show:J,hide:ue,getTriggerProps:Ge,getTooltipProps:ve,getTooltipPositionerProps:Qe,getArrowProps:$,getArrowInnerProps:X}}var Dd="chakra-ui:close-tooltip";function F7(e,t){return x.useEffect(()=>{const n=cc(e);return n.addEventListener(Dd,t),()=>n.removeEventListener(Dd,t)},[t,e]),()=>{const n=cc(e),r=Mf(e);n.dispatchEvent(new r.CustomEvent(Dd))}}function L7(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function B7(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var H7=oe(Wr.div),Yt=he((e,t)=>{var n,r;const o=mo("Tooltip",e),s=At(e),c=ei(),{children:u,label:f,shouldWrapChildren:h,"aria-label":p,hasArrow:g,bg:y,portalProps:S,background:C,backgroundColor:w,bgColor:k,motionProps:j,...M}=s,P=(r=(n=C??w)!=null?n:y)!=null?r:k;if(P){o.bg=P;const L=FS(c,"colors",P);o[Vt.arrowBg.var]=L}const I=N7({...M,direction:c.direction}),T=typeof u=="string"||h;let D;if(T)D=l.jsx(oe.span,{display:"inline-block",tabIndex:0,...I.getTriggerProps(),children:u});else{const L=x.Children.only(u);D=x.cloneElement(L,I.getTriggerProps(L.props,L.ref))}const _=!!p,z=I.getTooltipProps({},t),V=_?L7(z,["role","id"]):z,F=B7(z,["role","id"]);return f?l.jsxs(l.Fragment,{children:[D,l.jsx(oa,{children:I.isOpen&&l.jsx(eh,{...S,children:l.jsx(oe.div,{...I.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:l.jsxs(H7,{variants:R7,initial:"exit",animate:"enter",exit:"exit",...j,...V,__css:o,children:[f,_&&l.jsx(oe.span,{srOnly:!0,...F,children:p}),g&&l.jsx(oe.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:l.jsx(oe.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):l.jsx(l.Fragment,{children:u})});Yt.displayName="Tooltip";const Kh=x.createContext(null);let Wg;const Qh=()=>({setOpenUploader:e=>{e&&(Wg=e)},openUploader:Wg}),Bt=be(e=>e.ui,e=>LS[e.activeTab],{memoizeOptions:{equalityCheck:te.isEqual}}),W7=be(e=>e.ui,e=>e.activeTab,{memoizeOptions:{equalityCheck:te.isEqual}}),oi=be(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:te.isEqual}}),Vg=e=>async(t,n)=>{const{imageFile:r}=e,o=n(),s=Bt(o),c=new FormData;c.append("file",r,r.name),c.append("data",JSON.stringify({kind:"init"}));const f=await(await fetch(`${window.location.origin}/upload`,{method:"POST",body:c})).json(),h={uuid:E1(),category:"user",...f};t(P1({image:h,category:"user"})),s==="unifiedCanvas"?t(bc(h)):s==="img2img"&&t(is(h))},Zh=e=>{const{children:t}=e;return l.jsx(B,{sx:{width:"100%",height:"100%",bg:"base.850"},children:t})};function V7(){const{t:e}=Z();return l.jsx(Zh,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Vn,{children:e("common.nodes")}),l.jsx(Le,{maxW:"50rem",gap:4,children:l.jsx(Ce,{children:e("common.nodesDesc")})})]})})}const U7=()=>{const{t:e}=Z();return l.jsx(Zh,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Vn,{children:e("common.postProcessing")}),l.jsxs(Le,{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 $7(){const{t:e}=Z();return l.jsx(Zh,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Vn,{children:e("common.training")}),l.jsxs(Le,{maxW:"50rem",gap:4,children:[l.jsx(Ce,{children:e("common.trainingDesc1")}),l.jsx(Ce,{children:e("common.trainingDesc2")})]})]})})}function G7(e){const{i18n:t}=Z(),n=localStorage.getItem("i18nextLng");ke.useEffect(()=>{e()},[e]),ke.useEffect(()=>{t.on("languageChanged",()=>{e()})},[e,t,n])}const le=he((e,t)=>{const{tooltip:n="",tooltipProps:r,isChecked:o,...s}=e;return l.jsx(Yt,{label:n,hasArrow:!0,...r,...r!=null&&r.placement?{placement:r.placement}:{placement:"top"},children:l.jsx(co,{ref:t,"aria-checked":o!==void 0?o:void 0,...s})})}),Je=he((e,t)=>{const{children:n,tooltip:r="",tooltipProps:o,isChecked:s,...c}=e;return l.jsx(Yt,{label:r,...o,children:l.jsx(ni,{ref:t,"aria-checked":s,...c,children:n})})}),rr=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return l.jsxs(Gh,{isLazy:o,...s,children:[l.jsx($h,{children:t}),l.jsxs(Yh,{children:[r&&l.jsx(qh,{}),n]})]})},Ac=be(e=>e.lightbox,e=>e,{memoizeOptions:{equalityCheck:te.isEqual}}),Mn=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(Yt,{label:o,...s,children:l.jsx(ty,{...c,children:r.map(u=>typeof u=="string"||typeof u=="number"?l.jsx("option",{value:u,children:u},u):l.jsx("option",{value:u.value,children:u.key},u.value))})})]})};function q7(){const e=O(o=>o.postprocessing.facetoolType),t=Y(),{t:n}=Z(),r=o=>t(Hl(o.target.value));return l.jsx(Mn,{label:n("parameters.type"),validValues:BS.concat(),value:e,onChange:r})}var xy={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ug=ke.createContext&&ke.createContext(xy),so=globalThis&&globalThis.__assign||function(){return so=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{K(o)},[o]);const ne=x.useMemo(()=>L!=null&&L.max?L.max:c,[c,L==null?void 0:L.max]),ce=J=>{f(J)},Re=J=>{J.target.value===""&&(J.target.value=String(s));const ue=te.clamp(y?Math.floor(Number(J.target.value)):Number(U),s,ne);f(ue)},ze=J=>{K(J)},Me=()=>{M&&M()};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(sa,{w:"100%",gap:2,alignItems:"center",children:[l.jsxs(ay,{"aria-label":r,value:o,min:s,max:c,step:u,onChange:ce,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),focusThumbOnChange:!1,isDisabled:I,...ie,children:[p&&l.jsxs(l.Fragment,{children:[l.jsx(If,{value:s,insetInlineStart:0,sx:{insetInlineStart:"unset !important"},...z,children:s}),l.jsx(If,{value:c,insetInlineEnd:0,sx:{insetInlineStart:"unset !important"},...z,children:c})]}),l.jsx(ly,{...V,children:l.jsx(cy,{})}),l.jsx(Yt,{hasArrow:!0,placement:"top",isOpen:t,label:`${o}${h}`,hidden:k,...Q,children:l.jsx(sy,{...F})})]}),g&&l.jsxs(Lh,{min:s,max:ne,step:u,value:U,onChange:ze,onBlur:Re,isDisabled:T,...L,children:[l.jsx(Hh,{readOnly:C,minWidth:S,...X}),l.jsxs(Bh,{...$,children:[l.jsx(Vh,{onClick:()=>f(Number(U))}),l.jsx(Wh,{onClick:()=>f(Number(U))})]})]}),w&&l.jsx(le,{size:"sm","aria-label":"Reset",tooltip:"Reset",icon:l.jsx(Jh,{}),onClick:Me,isDisabled:P,...re})]})]})}function t8(){const e=O(o=>o.system.isGFPGANAvailable),t=O(o=>o.postprocessing.facetoolStrength),{t:n}=Z(),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(Zl(o)),handleReset:()=>r(Zl(.75)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}function n8(){const e=O(o=>o.system.isGFPGANAvailable),t=O(o=>o.postprocessing.codeformerFidelity),{t:n}=Z(),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(Qd(o)),handleReset:()=>r(Qd(1)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}const ep=()=>{const e=O(t=>t.postprocessing.facetoolType);return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(q7,{}),l.jsx(t8,{}),e==="codeformer"&&l.jsx(n8,{})]})};function r8(){const e=O(o=>o.system.isESRGANAvailable),t=O(o=>o.postprocessing.upscalingDenoising),{t:n}=Z(),r=Y();return l.jsx(ut,{label:n("parameters.denoisingStrength"),value:t,min:0,max:1,step:.01,onChange:o=>{r(Zd(o))},handleReset:()=>r(Zd(.75)),withSliderMarks:!0,withInput:!0,withReset:!0,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})}function o8(){const e=O(o=>o.system.isESRGANAvailable),t=O(o=>o.postprocessing.upscalingStrength),{t:n}=Z(),r=Y();return l.jsx(ut,{label:`${n("parameters.upscale")} ${n("parameters.strength")}`,value:t,min:0,max:1,step:.05,onChange:o=>r(Jd(o)),handleReset:()=>r(Jd(.75)),withSliderMarks:!0,withInput:!0,withReset:!0,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})}function i8(){const e=O(s=>s.system.isESRGANAvailable),t=O(s=>s.postprocessing.upscalingLevel),{t:n}=Z(),r=Y(),o=s=>r(I1(Number(s.target.value)));return l.jsx(Mn,{isDisabled:!e,label:n("parameters.scale"),value:t,onChange:o,validValues:HS})}const tp=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(i8,{}),l.jsx(r8,{}),l.jsx(o8,{})]}),np=e=>e.postprocessing,Pt=e=>e.system,a8=e=>e.system.toastQueue,Sy=be(Pt,e=>{const{model_list:t}=e,n=te.reduce(t,(r,o,s)=>(o.status==="active"&&(r=s),r),"");return{...t[n],name:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),s8=be(Pt,e=>{const{model_list:t}=e;return te.pickBy(t,(r,o)=>{if(r.format==="diffusers")return{name:o,...r}})},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function Tf(){return Tf=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 m8=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,c=n.mod,u=n.shift,f=n.ctrl,h=n.keys,p=t.key,g=t.code,y=t.ctrlKey,S=t.metaKey,C=t.shiftKey,w=t.altKey,k=oo(g),j=p.toLowerCase();if(!r){if(o===!w&&j!=="alt"||u===!C&&j!=="shift")return!1;if(c){if(!S&&!y)return!1}else if(s===!S&&j!=="meta"||f===!y&&j!=="ctrl")return!1}return h&&h.length===1&&(h.includes(j)||h.includes(k))?!0:h?u8(h):!h},v8=x.createContext(void 0),g8=function(){return x.useContext(v8)};function Ey(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&&Ey(e[r],t[r])},!0):e===t}var x8=x.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y8=function(){return x.useContext(x8)};function b8(e){var t=x.useRef(void 0);return Ey(t.current,e)||(t.current=e),t.current}var $g=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},S8=typeof window<"u"?x.useLayoutEffect:x.useEffect;function fe(e,t,n,r){var o=x.useRef(null),s=x.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=x.useCallback(t,u??[]),h=x.useRef(f);u?h.current=f:h.current=t;var p=b8(c),g=y8(),y=g.enabledScopes,S=g8();return S8(function(){if(!((p==null?void 0:p.enabled)===!1||!p8(y,p==null?void 0:p.scopes))){var C=function(M,P){var I;if(P===void 0&&(P=!1),!(h8(M)&&!jy(M,p==null?void 0:p.enableOnFormTags))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){$g(M);return}(I=M.target)!=null&&I.isContentEditable&&!(p!=null&&p.enableOnContentEditable)||Od(e,p==null?void 0:p.splitKey).forEach(function(T){var D,_=Ad(T,p==null?void 0:p.combinationKey);if(m8(M,_,p==null?void 0:p.ignoreModifiers)||(D=_.keys)!=null&&D.includes("*")){if(P&&s.current)return;if(d8(M,_,p==null?void 0:p.preventDefault),!f8(M,_,p==null?void 0:p.enabled)){$g(M);return}h.current(M,_),P||(s.current=!0)}})}},w=function(M){M.key!==void 0&&(wy(oo(M.code)),((p==null?void 0:p.keydown)===void 0&&(p==null?void 0:p.keyup)!==!0||p!=null&&p.keydown)&&C(M))},k=function(M){M.key!==void 0&&(ky(oo(M.code)),s.current=!1,p!=null&&p.keyup&&C(M,!0))};return(o.current||(c==null?void 0:c.document)||document).addEventListener("keyup",k),(o.current||(c==null?void 0:c.document)||document).addEventListener("keydown",w),S&&Od(e,p==null?void 0:p.splitKey).forEach(function(j){return S.addHotkey(Ad(j,p==null?void 0:p.combinationKey))}),function(){(o.current||(c==null?void 0:c.document)||document).removeEventListener("keyup",k),(o.current||(c==null?void 0:c.document)||document).removeEventListener("keydown",w),S&&Od(e,p==null?void 0:p.splitKey).forEach(function(j){return S.removeHotkey(Ad(j,p==null?void 0:p.combinationKey))})}}},[e,p,y]),o}function C8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M524.531,69.836a1.5,1.5,0,0,0-.764-.7A485.065,485.065,0,0,0,404.081,32.03a1.816,1.816,0,0,0-1.923.91,337.461,337.461,0,0,0-14.9,30.6,447.848,447.848,0,0,0-134.426,0,309.541,309.541,0,0,0-15.135-30.6,1.89,1.89,0,0,0-1.924-.91A483.689,483.689,0,0,0,116.085,69.137a1.712,1.712,0,0,0-.788.676C39.068,183.651,18.186,294.69,28.43,404.354a2.016,2.016,0,0,0,.765,1.375A487.666,487.666,0,0,0,176.02,479.918a1.9,1.9,0,0,0,2.063-.676A348.2,348.2,0,0,0,208.12,430.4a1.86,1.86,0,0,0-1.019-2.588,321.173,321.173,0,0,1-45.868-21.853,1.885,1.885,0,0,1-.185-3.126c3.082-2.309,6.166-4.711,9.109-7.137a1.819,1.819,0,0,1,1.9-.256c96.229,43.917,200.41,43.917,295.5,0a1.812,1.812,0,0,1,1.924.233c2.944,2.426,6.027,4.851,9.132,7.16a1.884,1.884,0,0,1-.162,3.126,301.407,301.407,0,0,1-45.89,21.83,1.875,1.875,0,0,0-1,2.611,391.055,391.055,0,0,0,30.014,48.815,1.864,1.864,0,0,0,2.063.7A486.048,486.048,0,0,0,610.7,405.729a1.882,1.882,0,0,0,.765-1.352C623.729,277.594,590.933,167.465,524.531,69.836ZM222.491,337.58c-28.972,0-52.844-26.587-52.844-59.239S193.056,219.1,222.491,219.1c29.665,0,53.306,26.82,52.843,59.239C275.334,310.993,251.924,337.58,222.491,337.58Zm195.38,0c-28.971,0-52.843-26.587-52.843-59.239S388.437,219.1,417.871,219.1c29.667,0,53.307,26.82,52.844,59.239C470.715,310.993,447.538,337.58,417.871,337.58Z"}}]})(e)}function w8(e){return me({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"}}]})(e)}function k8(e){return me({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M143 256.3L7 120.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0L313 86.3c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.4 9.5-24.6 9.5-34 .1zm34 192l136-136c9.4-9.4 9.4-24.6 0-33.9l-22.6-22.6c-9.4-9.4-24.6-9.4-33.9 0L160 352.1l-96.4-96.4c-9.4-9.4-24.6-9.4-33.9 0L7 278.3c-9.4 9.4-9.4 24.6 0 33.9l136 136c9.4 9.5 24.6 9.5 34 .1z"}}]})(e)}function j8(e){return me({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z"}}]})(e)}function E8(e){return me({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"}}]})(e)}function P8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"}}]})(e)}function I8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"}}]})(e)}function Py(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"}}]})(e)}function M8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M478.21 334.093L336 256l142.21-78.093c11.795-6.477 15.961-21.384 9.232-33.037l-19.48-33.741c-6.728-11.653-21.72-15.499-33.227-8.523L296 186.718l3.475-162.204C299.763 11.061 288.937 0 275.48 0h-38.96c-13.456 0-24.283 11.061-23.994 24.514L216 186.718 77.265 102.607c-11.506-6.976-26.499-3.13-33.227 8.523l-19.48 33.741c-6.728 11.653-2.562 26.56 9.233 33.037L176 256 33.79 334.093c-11.795 6.477-15.961 21.384-9.232 33.037l19.48 33.741c6.728 11.653 21.721 15.499 33.227 8.523L216 325.282l-3.475 162.204C212.237 500.939 223.064 512 236.52 512h38.961c13.456 0 24.283-11.061 23.995-24.514L296 325.282l138.735 84.111c11.506 6.976 26.499 3.13 33.227-8.523l19.48-33.741c6.728-11.653 2.563-26.559-9.232-33.036z"}}]})(e)}function T8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M511.988 288.9c-.478 17.43-15.217 31.1-32.653 31.1H424v16c0 21.864-4.882 42.584-13.6 61.145l60.228 60.228c12.496 12.497 12.496 32.758 0 45.255-12.498 12.497-32.759 12.496-45.256 0l-54.736-54.736C345.886 467.965 314.351 480 280 480V236c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v244c-34.351 0-65.886-12.035-90.636-32.108l-54.736 54.736c-12.498 12.497-32.759 12.496-45.256 0-12.496-12.497-12.496-32.758 0-45.255l60.228-60.228C92.882 378.584 88 357.864 88 336v-16H32.666C15.23 320 .491 306.33.013 288.9-.484 270.816 14.028 256 32 256h56v-58.745l-46.628-46.628c-12.496-12.497-12.496-32.758 0-45.255 12.498-12.497 32.758-12.497 45.256 0L141.255 160h229.489l54.627-54.627c12.498-12.497 32.758-12.497 45.256 0 12.496 12.497 12.496 32.758 0 45.255L424 197.255V256h56c17.972 0 32.484 14.816 31.988 32.9zM257 0c-61.856 0-112 50.144-112 112h224C369 50.144 318.856 0 257 0z"}}]})(e)}function zc(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"}}]})(e)}function Iy(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"}}]})(e)}function Ji(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z"}}]})(e)}function My(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500 224h-30.364C455.724 130.325 381.675 56.276 288 42.364V12c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v30.364C130.325 56.276 56.276 130.325 42.364 224H12c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h30.364C56.276 381.675 130.325 455.724 224 469.636V500c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12v-30.364C381.675 455.724 455.724 381.675 469.636 288H500c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12zM288 404.634V364c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40.634C165.826 392.232 119.783 346.243 107.366 288H148c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12h-40.634C119.768 165.826 165.757 119.783 224 107.366V148c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12v-40.634C346.174 119.768 392.217 165.757 404.634 224H364c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40.634C392.232 346.174 346.243 392.217 288 404.634zM288 256c0 17.673-14.327 32-32 32s-32-14.327-32-32c0-17.673 14.327-32 32-32s32 14.327 32 32z"}}]})(e)}function _8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z"}}]})(e)}function rp(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function Ty(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M497.941 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.745-18.745-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48.004 48.004 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12H355.883l142.058-142.059zm-302.627-62.627l137.373 137.373L265.373 416H150.628l-80-80 124.686-124.686z"}}]})(e)}function D8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 344v112a23.94 23.94 0 0 1-24 24H312c-21.39 0-32.09-25.9-17-41l36.2-36.2L224 295.6 116.77 402.9 153 439c15.09 15.1 4.39 41-17 41H24a23.94 23.94 0 0 1-24-24V344c0-21.4 25.89-32.1 41-17l36.19 36.2L184.46 256 77.18 148.7 41 185c-15.1 15.1-41 4.4-41-17V56a23.94 23.94 0 0 1 24-24h112c21.39 0 32.09 25.9 17 41l-36.2 36.2L224 216.4l107.23-107.3L295 73c-15.09-15.1-4.39-41 17-41h112a23.94 23.94 0 0 1 24 24v112c0 21.4-25.89 32.1-41 17l-36.19-36.2L263.54 256l107.28 107.3L407 327.1c15.1-15.2 41-4.5 41 16.9z"}}]})(e)}function O8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z"}}]})(e)}function _y(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M50.75 333.25c-12 12-18.75 28.28-18.75 45.26V424L0 480l32 32 56-32h45.49c16.97 0 33.25-6.74 45.25-18.74l126.64-126.62-128-128L50.75 333.25zM483.88 28.12c-37.47-37.5-98.28-37.5-135.75 0l-77.09 77.09-13.1-13.1c-9.44-9.44-24.65-9.31-33.94 0l-40.97 40.97c-9.37 9.37-9.37 24.57 0 33.94l161.94 161.94c9.44 9.44 24.65 9.31 33.94 0L419.88 288c9.37-9.37 9.37-24.57 0-33.94l-13.1-13.1 77.09-77.09c37.51-37.48 37.51-98.26.01-135.75z"}}]})(e)}function A8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"}}]})(e)}function z8(e){return me({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"}}]})(e)}function Dy(e){return me({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M512 320s-64 92.65-64 128c0 35.35 28.66 64 64 64s64-28.65 64-64-64-128-64-128zm-9.37-102.94L294.94 9.37C288.69 3.12 280.5 0 272.31 0s-16.38 3.12-22.62 9.37l-81.58 81.58L81.93 4.76c-6.25-6.25-16.38-6.25-22.62 0L36.69 27.38c-6.24 6.25-6.24 16.38 0 22.62l86.19 86.18-94.76 94.76c-37.49 37.48-37.49 98.26 0 135.75l117.19 117.19c18.74 18.74 43.31 28.12 67.87 28.12 24.57 0 49.13-9.37 67.87-28.12l221.57-221.57c12.5-12.5 12.5-32.75.01-45.25zm-116.22 70.97H65.93c1.36-3.84 3.57-7.98 7.43-11.83l13.15-13.15 81.61-81.61 58.6 58.6c12.49 12.49 32.75 12.49 45.24 0s12.49-32.75 0-45.24l-58.6-58.6 58.95-58.95 162.44 162.44-48.34 48.34z"}}]})(e)}function R8(e){return me({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zM94.6 168.9l34.9-5 15.5-31.6c2.9-5.8 11-5.8 13.9 0l15.5 31.6 34.9 5c6.2 1 8.9 8.6 4.3 13.2l-25.4 24.6 6 34.9c1 6.2-5.3 11-11 7.9L152 233.3l-31.3 16.3c-5.7 3.1-12-1.7-11-7.9l6-34.9-25.4-24.6c-4.6-4.7-1.9-12.3 4.3-13.3zM248 432c-60.6 0-134.5-38.3-143.8-93.3-2-11.8 9.3-21.5 20.7-17.9C155.1 330.5 200 336 248 336s92.9-5.5 123.1-15.2c11.5-3.7 22.6 6.1 20.7 17.9-9.3 55-83.2 93.3-143.8 93.3zm157.7-249.9l-25.4 24.6 6 34.9c1 6.2-5.3 11-11 7.9L344 233.3l-31.3 16.3c-5.7 3.1-12-1.7-11-7.9l6-34.9-25.4-24.6c-4.5-4.6-1.9-12.2 4.3-13.2l34.9-5 15.5-31.6c2.9-5.8 11-5.8 13.9 0l15.5 31.6 34.9 5c6.3.9 9 8.5 4.4 13.1z"}}]})(e)}function N8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"}}]})(e)}function F8(e){return me({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M528 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h480c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM128 180v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm288 0v-40c0-6.627-5.373-12-12-12H172c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h232c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12z"}}]})(e)}function L8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M152.1 236.2c-3.5-12.1-7.8-33.2-7.8-33.2h-.5s-4.3 21.1-7.8 33.2l-11.1 37.5H163zM616 96H336v320h280c13.3 0 24-10.7 24-24V120c0-13.3-10.7-24-24-24zm-24 120c0 6.6-5.4 12-12 12h-11.4c-6.9 23.6-21.7 47.4-42.7 69.9 8.4 6.4 17.1 12.5 26.1 18 5.5 3.4 7.3 10.5 4.1 16.2l-7.9 13.9c-3.4 5.9-10.9 7.8-16.7 4.3-12.6-7.8-24.5-16.1-35.4-24.9-10.9 8.7-22.7 17.1-35.4 24.9-5.8 3.5-13.3 1.6-16.7-4.3l-7.9-13.9c-3.2-5.6-1.4-12.8 4.2-16.2 9.3-5.7 18-11.7 26.1-18-7.9-8.4-14.9-17-21-25.7-4-5.7-2.2-13.6 3.7-17.1l6.5-3.9 7.3-4.3c5.4-3.2 12.4-1.7 16 3.4 5 7 10.8 14 17.4 20.9 13.5-14.2 23.8-28.9 30-43.2H412c-6.6 0-12-5.4-12-12v-16c0-6.6 5.4-12 12-12h64v-16c0-6.6 5.4-12 12-12h16c6.6 0 12 5.4 12 12v16h64c6.6 0 12 5.4 12 12zM0 120v272c0 13.3 10.7 24 24 24h280V96H24c-13.3 0-24 10.7-24 24zm58.9 216.1L116.4 167c1.7-4.9 6.2-8.1 11.4-8.1h32.5c5.1 0 9.7 3.3 11.4 8.1l57.5 169.1c2.6 7.8-3.1 15.9-11.4 15.9h-22.9a12 12 0 0 1-11.5-8.6l-9.4-31.9h-60.2l-9.1 31.8c-1.5 5.1-6.2 8.7-11.5 8.7H70.3c-8.2 0-14-8.1-11.4-15.9z"}}]})(e)}function Oy(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M12.41 148.02l232.94 105.67c6.8 3.09 14.49 3.09 21.29 0l232.94-105.67c16.55-7.51 16.55-32.52 0-40.03L266.65 2.31a25.607 25.607 0 0 0-21.29 0L12.41 107.98c-16.55 7.51-16.55 32.53 0 40.04zm487.18 88.28l-58.09-26.33-161.64 73.27c-7.56 3.43-15.59 5.17-23.86 5.17s-16.29-1.74-23.86-5.17L70.51 209.97l-58.1 26.33c-16.55 7.5-16.55 32.5 0 40l232.94 105.59c6.8 3.08 14.49 3.08 21.29 0L499.59 276.3c16.55-7.5 16.55-32.5 0-40zm0 127.8l-57.87-26.23-161.86 73.37c-7.56 3.43-15.59 5.17-23.86 5.17s-16.29-1.74-23.86-5.17L70.29 337.87 12.41 364.1c-16.55 7.5-16.55 32.5 0 40l232.94 105.59c6.8 3.08 14.49 3.08 21.29 0L499.59 404.1c16.55-7.5 16.55-32.5 0-40z"}}]})(e)}function B8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320.67 64c-442.6 0-357.57 384-158.46 384 39.9 0 77.47-20.69 101.42-55.86l25.73-37.79c15.66-22.99 46.97-22.99 62.63 0l25.73 37.79C401.66 427.31 439.23 448 479.13 448c189.86 0 290.63-384-158.46-384zM184 308.36c-41.06 0-67.76-25.66-80.08-41.05-5.23-6.53-5.23-16.09 0-22.63 12.32-15.4 39.01-41.05 80.08-41.05s67.76 25.66 80.08 41.05c5.23 6.53 5.23 16.09 0 22.63-12.32 15.4-39.02 41.05-80.08 41.05zm272 0c-41.06 0-67.76-25.66-80.08-41.05-5.23-6.53-5.23-16.09 0-22.63 12.32-15.4 39.01-41.05 80.08-41.05s67.76 25.66 80.08 41.05c5.23 6.53 5.23 16.09 0 22.63-12.32 15.4-39.02 41.05-80.08 41.05z"}}]})(e)}function H8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function Ay(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M167.02 309.34c-40.12 2.58-76.53 17.86-97.19 72.3-2.35 6.21-8 9.98-14.59 9.98-11.11 0-45.46-27.67-55.25-34.35C0 439.62 37.93 512 128 512c75.86 0 128-43.77 128-120.19 0-3.11-.65-6.08-.97-9.13l-88.01-73.34zM457.89 0c-15.16 0-29.37 6.71-40.21 16.45C213.27 199.05 192 203.34 192 257.09c0 13.7 3.25 26.76 8.73 38.7l63.82 53.18c7.21 1.8 14.64 3.03 22.39 3.03 62.11 0 98.11-45.47 211.16-256.46 7.38-14.35 13.9-29.85 13.9-45.99C512 20.64 486 0 457.89 0z"}}]})(e)}function W8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"}}]})(e)}function V8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"}}]})(e)}function xs(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function U8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 32H336c-26.5 0-48 21.5-48 48v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48zm-288 0H48C21.5 32 0 53.5 0 80v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48z"}}]})(e)}function $8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M184.561 261.903c3.232 13.997-12.123 24.635-24.068 17.168l-40.736-25.455-50.867 81.402C55.606 356.273 70.96 384 96.012 384H148c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12H96.115c-75.334 0-121.302-83.048-81.408-146.88l50.822-81.388-40.725-25.448c-12.081-7.547-8.966-25.961 4.879-29.158l110.237-25.45c8.611-1.988 17.201 3.381 19.189 11.99l25.452 110.237zm98.561-182.915l41.289 66.076-40.74 25.457c-12.051 7.528-9 25.953 4.879 29.158l110.237 25.45c8.672 1.999 17.215-3.438 19.189-11.99l25.45-110.237c3.197-13.844-11.99-24.719-24.068-17.168l-40.687 25.424-41.263-66.082c-37.521-60.033-125.209-60.171-162.816 0l-17.963 28.766c-3.51 5.62-1.8 13.021 3.82 16.533l33.919 21.195c5.62 3.512 13.024 1.803 16.536-3.817l17.961-28.743c12.712-20.341 41.973-19.676 54.257-.022zM497.288 301.12l-27.515-44.065c-3.511-5.623-10.916-7.334-16.538-3.821l-33.861 21.159c-5.62 3.512-7.33 10.915-3.818 16.536l27.564 44.112c13.257 21.211-2.057 48.96-27.136 48.96H320V336.02c0-14.213-17.242-21.383-27.313-11.313l-80 79.981c-6.249 6.248-6.249 16.379 0 22.627l80 79.989C302.689 517.308 320 510.3 320 495.989V448h95.88c75.274 0 121.335-82.997 81.408-146.88z"}}]})(e)}function G8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500.33 0h-47.41a12 12 0 0 0-12 12.57l4 82.76A247.42 247.42 0 0 0 256 8C119.34 8 7.9 119.53 8 256.19 8.1 393.07 119.1 504 256 504a247.1 247.1 0 0 0 166.18-63.91 12 12 0 0 0 .48-17.43l-34-34a12 12 0 0 0-16.38-.55A176 176 0 1 1 402.1 157.8l-101.53-4.87a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12h200.33a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12z"}}]})(e)}function op(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"}}]})(e)}function q8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"}}]})(e)}function Y8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M64 96H0c0 123.7 100.3 224 224 224v144c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V320C288 196.3 187.7 96 64 96zm384-64c-84.2 0-157.4 46.5-195.7 115.2 27.7 30.2 48.2 66.9 59 107.6C424 243.1 512 147.9 512 32h-64z"}}]})(e)}function X8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 320c-22.608 0-43.387 7.819-59.79 20.895l-102.486-64.054a96.551 96.551 0 0 0 0-41.683l102.486-64.054C308.613 184.181 329.392 192 352 192c53.019 0 96-42.981 96-96S405.019 0 352 0s-96 42.981-96 96c0 7.158.79 14.13 2.276 20.841L155.79 180.895C139.387 167.819 118.608 160 96 160c-53.019 0-96 42.981-96 96s42.981 96 96 96c22.608 0 43.387-7.819 59.79-20.895l102.486 64.054A96.301 96.301 0 0 0 256 416c0 53.019 42.981 96 96 96s96-42.981 96-96-42.981-96-96-96z"}}]})(e)}function Gg(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M503.691 189.836L327.687 37.851C312.281 24.546 288 35.347 288 56.015v80.053C127.371 137.907 0 170.1 0 322.326c0 61.441 39.581 122.309 83.333 154.132 13.653 9.931 33.111-2.533 28.077-18.631C66.066 312.814 132.917 274.316 288 272.085V360c0 20.7 24.3 31.453 39.687 18.164l176.004-152c11.071-9.562 11.086-26.753 0-36.328z"}}]})(e)}function ip(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 384H160v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h80v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h336c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160h-80v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h336v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h80c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160H288V48c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16C7.2 64 0 71.2 0 80v32c0 8.8 7.2 16 16 16h208v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h208c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16z"}}]})(e)}function K8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"}}]})(e)}function ii(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"}}]})(e)}function Q8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M212.333 224.333H12c-6.627 0-12-5.373-12-12V12C0 5.373 5.373 0 12 0h48c6.627 0 12 5.373 12 12v78.112C117.773 39.279 184.26 7.47 258.175 8.007c136.906.994 246.448 111.623 246.157 248.532C504.041 393.258 393.12 504 256.333 504c-64.089 0-122.496-24.313-166.51-64.215-5.099-4.622-5.334-12.554-.467-17.42l33.967-33.967c4.474-4.474 11.662-4.717 16.401-.525C170.76 415.336 211.58 432 256.333 432c97.268 0 176-78.716 176-176 0-97.267-78.716-176-176-176-58.496 0-110.28 28.476-142.274 72.333h98.274c6.627 0 12 5.373 12 12v48c0 6.627-5.373 12-12 12z"}}]})(e)}function Rc(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function Z8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"}}]})(e)}function ap(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M507.73 109.1c-2.24-9.03-13.54-12.09-20.12-5.51l-74.36 74.36-67.88-11.31-11.31-67.88 74.36-74.36c6.62-6.62 3.43-17.9-5.66-20.16-47.38-11.74-99.55.91-136.58 37.93-39.64 39.64-50.55 97.1-34.05 147.2L18.74 402.76c-24.99 24.99-24.99 65.51 0 90.5 24.99 24.99 65.51 24.99 90.5 0l213.21-213.21c50.12 16.71 107.47 5.68 147.37-34.22 37.07-37.07 49.7-89.32 37.91-136.73zM64 472c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"}}]})(e)}const tt=e=>e.canvas,zt=be([tt,Bt,Pt],(e,t,n)=>e.layerState.stagingArea.images.length>0||t==="unifiedCanvas"&&n.isProcessing),zy=e=>e.canvas.layerState.objects.find(M1),Vr=e=>e.gallery,J8=be([Vr,Ac,zt,Bt],(e,t,n,r)=>{const{categories:o,currentCategory:s,currentImageUuid:c,shouldPinGallery:u,shouldShowGallery:f,galleryImageMinimumWidth:h,galleryImageObjectFit:p,shouldHoldGalleryOpen:g,shouldAutoSwitchToNewImages:y,galleryWidth:S,shouldUseSingleGalleryColumn:C}=e,{isLightboxOpen:w}=t;return{currentImageUuid:c,shouldPinGallery:u,shouldShowGallery:f,galleryImageMinimumWidth:h,galleryImageObjectFit:p,galleryGridTemplateColumns:C?"auto":`repeat(auto-fill, minmax(${h}px, auto))`,activeTabName:r,shouldHoldGalleryOpen:g,shouldAutoSwitchToNewImages:y,images:o[s].images,areMoreImagesAvailable:o[s].areMoreImagesAvailable,currentCategory:s,galleryWidth:S,isLightboxOpen:w,isStaging:n,shouldEnableResize:!(w||r==="unifiedCanvas"&&u),shouldUseSingleGalleryColumn:C}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),e9=be([Vr,Pt,Ac,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:te.isEqual}}),En=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(uy,{...c})]})},t9=be(Pt,e=>{const{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}=e;return{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),uc=he(({image:e,children:t},n)=>{const{isOpen:r,onOpen:o,onClose:s}=uo(),c=Y(),{shouldConfirmOnDelete:u,isConnected:f,isProcessing:h}=O(t9),p=x.useRef(null),g=C=>{C.stopPropagation(),u?o():y()},y=()=>{f&&!h&&e&&c(WS(e)),s()};fe("delete",()=>{u?o():y()},[e,u,f,h]);const S=C=>c(T1(!C.target.checked));return l.jsxs(l.Fragment,{children:[x.cloneElement(t,{onClick:e?g:void 0,ref:n}),l.jsx(qx,{isOpen:r,leastDestructiveRef:p,onClose:s,children:l.jsx(Nr,{children:l.jsxs(Yx,{children:[l.jsx(Rr,{fontSize:"lg",fontWeight:"bold",children:"Delete image"}),l.jsx(Fr,{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(zr,{children:[l.jsx(Je,{ref:p,onClick:s,children:"Cancel"}),l.jsx(Je,{colorScheme:"error",onClick:y,ml:3,children:"Delete"})]})]})})})]})});uc.displayName="DeleteImageModal";const sp=()=>{const e=Y();return t=>{const n=typeof t=="string"?t:_1(t),[r,o]=VS(n);e(D1(r)),e(O1(o))}},n9=be([Pt,Vr,np,oi,Ac,Bt],(e,t,n,r,o,s)=>{const{isProcessing:c,isConnected:u,isGFPGANAvailable:f,isESRGANAvailable:h}=e,{upscalingLevel:p,facetoolStrength:g}=n,{isLightboxOpen:y}=o,{shouldShowImageDetails:S}=r,{intermediateImage:C,currentImage:w}=t;return{isProcessing:c,isConnected:u,isGFPGANAvailable:f,isESRGANAvailable:h,upscalingLevel:p,facetoolStrength:g,shouldDisableToolbarButtons:Boolean(C)||!w,currentImage:w,shouldShowImageDetails:S,activeTabName:s,isLightboxOpen:y}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Ry=e=>{var L,X,$,Q,re,ie,U,K;const t=Y(),{isProcessing:n,isConnected:r,isGFPGANAvailable:o,isESRGANAvailable:s,upscalingLevel:c,facetoolStrength:u,shouldDisableToolbarButtons:f,shouldShowImageDetails:h,currentImage:p,isLightboxOpen:g,activeTabName:y}=O(n9),S=us(),{t:C}=Z(),w=sp(),k=()=>{p&&(g&&t(Ho(!1)),t(is(p)),t(kn("img2img")))},j=async()=>{if(!p)return;const ne=await fetch(p.url).then(Re=>Re.blob()),ce=[new ClipboardItem({[ne.type]:ne})];await navigator.clipboard.write(ce),S({title:C("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})},M=()=>{navigator.clipboard.writeText(p?window.location.toString()+p.url:"").then(()=>{S({title:C("toast.imageLinkCopied"),status:"success",duration:2500,isClosable:!0})})};fe("shift+i",()=>{p?(k(),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})},[p]);const P=()=>{var ne,ce;p&&(p.metadata&&t(A1(p.metadata)),((ne=p.metadata)==null?void 0:ne.image.type)==="img2img"?t(kn("img2img")):((ce=p.metadata)==null?void 0:ce.image.type)==="txt2img"&&t(kn("txt2img")))};fe("a",()=>{var ne,ce;["txt2img","img2img"].includes((ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)==null?void 0:ce.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})},[p]);const I=()=>{p!=null&&p.metadata&&t(as(p.metadata.image.seed))};fe("s",()=>{var ne,ce;(ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)!=null&&ce.seed?(I(),S({title:C("toast.seedSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.seedNotSet"),description:C("toast.seedNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[p]);const T=x.useCallback(()=>{var ne,ce,Re,ze;(ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)!=null&&ce.prompt&&w((ze=(Re=p==null?void 0:p.metadata)==null?void 0:Re.image)==null?void 0:ze.prompt)},[(X=(L=p==null?void 0:p.metadata)==null?void 0:L.image)==null?void 0:X.prompt,w]);fe("p",()=>{var ne,ce;(ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)!=null&&ce.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})},[p]);const D=()=>{p&&t(US(p))};fe("Shift+U",()=>{s&&!f&&r&&!n&&c?D():S({title:C("toast.upscalingFailed"),status:"error",duration:2500,isClosable:!0})},[p,s,f,r,n,c]);const _=()=>{p&&t($S(p))};fe("Shift+R",()=>{o&&!f&&r&&!n&&u?_():S({title:C("toast.faceRestoreFailed"),status:"error",duration:2500,isClosable:!0})},[p,o,f,r,n,u]);const z=()=>t(z1(!h)),V=()=>{p&&(g&&t(Ho(!1)),t(bc(p)),t(on(!0)),y!=="unifiedCanvas"&&t(kn("unifiedCanvas")),S({title:C("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0}))};fe("i",()=>{p?z():S({title:C("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[p,h]);const F=()=>{t(Ho(!g))};return l.jsxs(B,{sx:{justifyContent:"center",alignItems:"center",columnGap:"0.5em"},...e,children:[l.jsxs(en,{isAttached:!0,children:[l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{"aria-label":`${C("parameters.sendTo")}...`,icon:l.jsx(X8,{})}),children:l.jsxs(B,{sx:{flexDirection:"column",rowGap:2,w:52},children:[l.jsx(Je,{size:"sm",onClick:k,leftIcon:l.jsx(Gg,{}),children:C("parameters.sendToImg2Img")}),l.jsx(Je,{size:"sm",onClick:V,leftIcon:l.jsx(Gg,{}),children:C("parameters.sendToUnifiedCanvas")}),l.jsx(Je,{size:"sm",onClick:j,leftIcon:l.jsx(Ji,{}),children:C("parameters.copyImage")}),l.jsx(Je,{size:"sm",onClick:M,leftIcon:l.jsx(Ji,{}),children:C("parameters.copyImageToLink")}),l.jsx(Go,{download:!0,href:p==null?void 0:p.url,children:l.jsx(Je,{leftIcon:l.jsx(rp,{}),size:"sm",w:"100%",children:C("parameters.downloadImage")})})]})}),l.jsx(le,{icon:l.jsx(O8,{}),tooltip:g?`${C("parameters.closeViewer")} (Z)`:`${C("parameters.openInViewer")} (Z)`,"aria-label":g?`${C("parameters.closeViewer")} (Z)`:`${C("parameters.openInViewer")} (Z)`,isChecked:g,onClick:F})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{icon:l.jsx(U8,{}),tooltip:`${C("parameters.usePrompt")} (P)`,"aria-label":`${C("parameters.usePrompt")} (P)`,isDisabled:!((Q=($=p==null?void 0:p.metadata)==null?void 0:$.image)!=null&&Q.prompt),onClick:T}),l.jsx(le,{icon:l.jsx(Y8,{}),tooltip:`${C("parameters.useSeed")} (S)`,"aria-label":`${C("parameters.useSeed")} (S)`,isDisabled:!((ie=(re=p==null?void 0:p.metadata)==null?void 0:re.image)!=null&&ie.seed),onClick:I}),l.jsx(le,{icon:l.jsx(M8,{}),tooltip:`${C("parameters.useAll")} (A)`,"aria-label":`${C("parameters.useAll")} (A)`,isDisabled:!["txt2img","img2img"].includes((K=(U=p==null?void 0:p.metadata)==null?void 0:U.image)==null?void 0:K.type),onClick:P})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{icon:l.jsx(R8,{}),"aria-label":C("parameters.restoreFaces")}),children:l.jsxs(B,{sx:{flexDirection:"column",rowGap:4},children:[l.jsx(ep,{}),l.jsx(Je,{isDisabled:!o||!p||!(r&&!n)||!u,onClick:_,children:C("parameters.restoreFaces")})]})}),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{icon:l.jsx(D8,{}),"aria-label":C("parameters.upscale")}),children:l.jsxs(B,{sx:{flexDirection:"column",gap:4},children:[l.jsx(tp,{}),l.jsx(Je,{isDisabled:!s||!p||!(r&&!n)||!c,onClick:D,children:C("parameters.upscaleImage")})]})})]}),l.jsx(en,{isAttached:!0,children:l.jsx(le,{icon:l.jsx(Iy,{}),tooltip:`${C("parameters.info")} (I)`,"aria-label":`${C("parameters.info")} (I)`,isChecked:h,onClick:z})}),l.jsx(uc,{image:p,children:l.jsx(le,{icon:l.jsx(ii,{}),tooltip:`${C("parameters.deleteImage")} (Del)`,"aria-label":`${C("parameters.deleteImage")} (Del)`,isDisabled:!p||!r||n,colorScheme:"error"})})]})};var r9=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)}}(),Wt=globalThis&&globalThis.__assign||function(){return Wt=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)}},u9=["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"],Qg="__resizable_base__",Ny=function(e){a9(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(Qg):s.className+=Qg,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||s9},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var o=this.resizable.offsetWidth,s=this.resizable.offsetHeight,c=this.resizable.style.position;c!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:o,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=c}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,o=function(u){if(typeof n.state[u]>"u"||n.state[u]==="auto")return"auto";if(n.propsSize&&n.propsSize[u]&&n.propsSize[u].toString().endsWith("%")){if(n.state[u].toString().endsWith("%"))return n.state[u].toString();var f=n.getParentSize(),h=Number(n.state[u].toString().replace("px","")),p=h/f[u]*100;return p+"%"}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&&Di("left",s),u=o&&Di("top",s),f,h;if(this.props.bounds==="parent"){var p=this.parentNode;p&&(f=c?this.resizableRight-this.parentLeft:p.offsetWidth+(this.parentLeft-this.resizableLeft),h=u?this.resizableBottom-this.parentTop:p.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(f=c?this.resizableRight:this.window.innerWidth-this.resizableLeft,h=u?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(f=c?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),h=u?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return f&&Number.isFinite(f)&&(n=n&&n"u"?10:s.width,g=typeof o.width>"u"||o.width<0?n:o.width,y=typeof s.height>"u"?10:s.height,S=typeof o.height>"u"||o.height<0?r:o.height,C=f||0,w=h||0;if(u){var k=(y-C)*this.ratio+w,j=(S-C)*this.ratio+w,M=(p-w)/this.ratio+C,P=(g-w)/this.ratio+C,I=Math.max(p,k),T=Math.min(g,j),D=Math.max(y,M),_=Math.min(S,P);n=_l(n,I,T),r=_l(r,D,_)}else n=_l(n,p,g),r=_l(r,y,S);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){if(this.props.bounds==="parent"){var n=this.parentNode;if(n){var r=n.getBoundingClientRect();this.parentLeft=r.left,this.parentTop=r.top}}if(this.props.bounds&&typeof this.props.bounds!="string"){var o=this.props.bounds.getBoundingClientRect();this.targetLeft=o.left,this.targetTop=o.top}if(this.resizable){var s=this.resizable.getBoundingClientRect(),c=s.left,u=s.top,f=s.right,h=s.bottom;this.resizableLeft=c,this.resizableRight=f,this.resizableTop=u,this.resizableBottom=h}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var o=0,s=0;if(n.nativeEvent&&l9(n.nativeEvent)?(o=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&Dl(n.nativeEvent)&&(o=n.nativeEvent.touches[0].clientX,s=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var c=this.props.onResizeStart(n,r,this.resizable);if(c===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var u,f=this.window.getComputedStyle(this.resizable);if(f.flexBasis!=="auto"){var h=this.parentNode;if(h){var p=this.window.getComputedStyle(h).flexDirection;this.flexDir=p.startsWith("row")?"row":"column",u=f.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var g={original:{x:o,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:mr(mr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:u};this.setState(g)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Dl(n))try{n.preventDefault(),n.stopPropagation()}catch{}var o=this.props,s=o.maxWidth,c=o.maxHeight,u=o.minWidth,f=o.minHeight,h=Dl(n)?n.touches[0].clientX:n.clientX,p=Dl(n)?n.touches[0].clientY:n.clientY,g=this.state,y=g.direction,S=g.original,C=g.width,w=g.height,k=this.getParentSize(),j=c9(k,this.window.innerWidth,this.window.innerHeight,s,c,u,f);s=j.maxWidth,c=j.maxHeight,u=j.minWidth,f=j.minHeight;var M=this.calculateNewSizeFromDirection(h,p),P=M.newHeight,I=M.newWidth,T=this.calculateNewMaxFromBoundary(s,c);this.props.snap&&this.props.snap.x&&(I=Kg(I,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(P=Kg(P,this.props.snap.y,this.props.snapGap));var D=this.calculateNewSizeFromAspectRatio(I,P,{width:T.maxWidth,height:T.maxHeight},{width:u,height:f});if(I=D.newWidth,P=D.newHeight,this.props.grid){var _=Xg(I,this.props.grid[0]),z=Xg(P,this.props.grid[1]),V=this.props.snapGap||0;I=V===0||Math.abs(_-I)<=V?_:I,P=V===0||Math.abs(z-P)<=V?z:P}var F={width:I-S.width,height:P-S.height};if(C&&typeof C=="string"){if(C.endsWith("%")){var L=I/k.width*100;I=L+"%"}else if(C.endsWith("vw")){var X=I/this.window.innerWidth*100;I=X+"vw"}else if(C.endsWith("vh")){var $=I/this.window.innerHeight*100;I=$+"vh"}}if(w&&typeof w=="string"){if(w.endsWith("%")){var L=P/k.height*100;P=L+"%"}else if(w.endsWith("vw")){var X=P/this.window.innerWidth*100;P=X+"vw"}else if(w.endsWith("vh")){var $=P/this.window.innerHeight*100;P=$+"vh"}}var Q={width:this.createSizeForCssProperty(I,"width"),height:this.createSizeForCssProperty(P,"height")};this.flexDir==="row"?Q.flexBasis=Q.width:this.flexDir==="column"&&(Q.flexBasis=Q.height),GS.flushSync(function(){r.setState(Q)}),this.props.onResize&&this.props.onResize(n,y,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:mr(mr({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){this.setState({width:n.width,height:n.height})},t.prototype.renderResizer=function(){var n=this,r=this.props,o=r.enable,s=r.handleStyles,c=r.handleClasses,u=r.handleWrapperStyle,f=r.handleWrapperClass,h=r.handleComponent;if(!o)return null;var p=Object.keys(o).map(function(g){return o[g]!==!1?x.createElement(i9,{key:g,direction:g,onResizeStart:n.onResizeStart,replaceStyles:s&&s[g],className:c&&c[g]},h&&h[g]?h[g]:null):null});return x.createElement("div",{className:f,style:u},p)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(c,u){return u9.indexOf(u)!==-1||(c[u]=n.props[u]),c},{}),o=mr(mr(mr({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 x.createElement(s,mr({ref:this.ref,style:o,className:this.props.className},r),this.state.isResizing&&x.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}(x.PureComponent);const pt=e=>{const{label:t,...n}=e;return l.jsx(E2,{colorScheme:"accent",...n,children:t})};function Fy(e){return me({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 Ly(e){return me({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)}function d9(e){return me({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 f9(e){return me({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 h9(e){return me({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 p9(e){return me({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 m9(e){return me({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 v9(e){return me({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 Zg(e){return me({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 g9(e){return me({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 x9(e){return me({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 lp(e){return me({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 y9(e){return me({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 b9(e){return me({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 S9(e){return me({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 C9(e){return me({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)}function w9(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function k9(e,t){e.classList?e.classList.add(t):w9(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function Jg(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function j9(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=Jg(e.className,t):e.setAttribute("class",Jg(e.className&&e.className.baseVal||"",t))}const e0={disabled:!1},By=ke.createContext(null);var Hy=function(t){return t.scrollTop},La="unmounted",zo="exited",Ro="entering",Ai="entered",_f="exiting",Ur=function(e){mh(t,e);function t(r,o){var s;s=e.call(this,r,o)||this;var c=o,u=c&&!c.isMounting?r.enter:r.appear,f;return s.appearStatus=null,r.in?u?(f=zo,s.appearStatus=Ro):f=Ai:r.unmountOnExit||r.mountOnEnter?f=La:f=zo,s.state={status:f},s.nextCallback=null,s}t.getDerivedStateFromProps=function(o,s){var c=o.in;return c&&s.status===La?{status:zo}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(o){var s=null;if(o!==this.props){var c=this.state.status;this.props.in?c!==Ro&&c!==Ai&&(s=Ro):(c===Ro||c===Ai)&&(s=_f)}this.updateStatus(!1,s)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,s,c,u;return s=c=u=o,o!=null&&typeof o!="number"&&(s=o.exit,c=o.enter,u=o.appear!==void 0?o.appear:c),{exit:s,enter:c,appear:u}},n.updateStatus=function(o,s){if(o===void 0&&(o=!1),s!==null)if(this.cancelNextCallback(),s===Ro){if(this.props.unmountOnExit||this.props.mountOnEnter){var c=this.props.nodeRef?this.props.nodeRef.current:vl.findDOMNode(this);c&&Hy(c)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===zo&&this.setState({status:La})},n.performEnter=function(o){var s=this,c=this.props.enter,u=this.context?this.context.isMounting:o,f=this.props.nodeRef?[u]:[vl.findDOMNode(this),u],h=f[0],p=f[1],g=this.getTimeouts(),y=u?g.appear:g.enter;if(!o&&!c||e0.disabled){this.safeSetState({status:Ai},function(){s.props.onEntered(h)});return}this.props.onEnter(h,p),this.safeSetState({status:Ro},function(){s.props.onEntering(h,p),s.onTransitionEnd(y,function(){s.safeSetState({status:Ai},function(){s.props.onEntered(h,p)})})})},n.performExit=function(){var o=this,s=this.props.exit,c=this.getTimeouts(),u=this.props.nodeRef?void 0:vl.findDOMNode(this);if(!s||e0.disabled){this.safeSetState({status:zo},function(){o.props.onExited(u)});return}this.props.onExit(u),this.safeSetState({status:_f},function(){o.props.onExiting(u),o.onTransitionEnd(c.exit,function(){o.safeSetState({status:zo},function(){o.props.onExited(u)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(o,s){s=this.setNextCallback(s),this.setState(o,s)},n.setNextCallback=function(o){var s=this,c=!0;return this.nextCallback=function(u){c&&(c=!1,s.nextCallback=null,o(u))},this.nextCallback.cancel=function(){c=!1},this.nextCallback},n.onTransitionEnd=function(o,s){this.setNextCallback(s);var c=this.props.nodeRef?this.props.nodeRef.current:vl.findDOMNode(this),u=o==null&&!this.props.addEndListener;if(!c||u){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var f=this.props.nodeRef?[this.nextCallback]:[c,this.nextCallback],h=f[0],p=f[1];this.props.addEndListener(h,p)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===La)return null;var s=this.props,c=s.children;s.in,s.mountOnEnter,s.unmountOnExit,s.appear,s.enter,s.exit,s.timeout,s.addEndListener,s.onEnter,s.onEntering,s.onEntered,s.onExit,s.onExiting,s.onExited,s.nodeRef;var u=th(s,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return ke.createElement(By.Provider,{value:null},typeof c=="function"?c(o,u):ke.cloneElement(ke.Children.only(c),u))},t}(ke.Component);Ur.contextType=By;Ur.propTypes={};function Oi(){}Ur.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Oi,onEntering:Oi,onEntered:Oi,onExit:Oi,onExiting:Oi,onExited:Oi};Ur.UNMOUNTED=La;Ur.EXITED=zo;Ur.ENTERING=Ro;Ur.ENTERED=Ai;Ur.EXITING=_f;const E9=Ur;var P9=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return k9(t,r)})},Rd=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return j9(t,r)})},cp=function(e){mh(t,e);function t(){for(var r,o=arguments.length,s=new Array(o),c=0;ce.image.uuid===t.image.uuid&&e.isSelected===t.isSelected,Vy=x.memo(e=>{const t=Y(),{activeTabName:n,galleryImageObjectFit:r,galleryImageMinimumWidth:o,mayDeleteImage:s,shouldUseSingleGalleryColumn:c}=O(e9),{image:u,isSelected:f}=e,{url:h,thumbnail:p,uuid:g,metadata:y}=u,[S,C]=x.useState(!1),w=us(),{direction:k}=ei(),{t:j}=Z(),M=sp(),P=()=>C(!0),I=()=>C(!1),T=()=>{var Q,re,ie,U;(re=(Q=u.metadata)==null?void 0:Q.image)!=null&&re.prompt&&M((U=(ie=u.metadata)==null?void 0:ie.image)==null?void 0:U.prompt),w({title:j("toast.promptSet"),status:"success",duration:2500,isClosable:!0})},D=()=>{u.metadata&&t(as(u.metadata.image.seed)),w({title:j("toast.seedSet"),status:"success",duration:2500,isClosable:!0})},_=()=>{t(is(u)),n!=="img2img"&&t(kn("img2img")),w({title:j("toast.sentToImageToImage"),status:"success",duration:2500,isClosable:!0})},z=()=>{t(bc(u)),t(Sc()),n!=="unifiedCanvas"&&t(kn("unifiedCanvas")),w({title:j("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},V=()=>{y&&t(A1(y)),w({title:j("toast.parametersSet"),status:"success",duration:2500,isClosable:!0})},F=async()=>{var Q;if((Q=y==null?void 0:y.image)!=null&&Q.init_image_path&&(await fetch(y.image.init_image_path)).ok){t(kn("img2img")),t(qS(y)),w({title:j("toast.initialImageSet"),status:"success",duration:2500,isClosable:!0});return}w({title:j("toast.initialImageNotSet"),description:j("toast.initialImageNotSetDesc"),status:"error",duration:2500,isClosable:!0})},L=()=>t(zv(u)),X=Q=>{Q.dataTransfer.setData("invokeai/imageUuid",g),Q.dataTransfer.effectAllowed="move"},$=()=>{t(zv(u)),t(Ho(!0))};return l.jsx(I9,{menuProps:{size:"sm",isLazy:!0},renderMenu:()=>{var Q,re,ie,U,K,ne,ce,Re;return l.jsxs(Rh,{children:[l.jsx(pr,{onClickCapture:$,children:j("parameters.openInViewer")}),l.jsx(pr,{onClickCapture:T,isDisabled:((re=(Q=u==null?void 0:u.metadata)==null?void 0:Q.image)==null?void 0:re.prompt)===void 0,children:j("parameters.usePrompt")}),l.jsx(pr,{onClickCapture:D,isDisabled:((U=(ie=u==null?void 0:u.metadata)==null?void 0:ie.image)==null?void 0:U.seed)===void 0,children:j("parameters.useSeed")}),l.jsx(pr,{onClickCapture:V,isDisabled:!["txt2img","img2img"].includes((ne=(K=u==null?void 0:u.metadata)==null?void 0:K.image)==null?void 0:ne.type),children:j("parameters.useAll")}),l.jsx(pr,{onClickCapture:F,isDisabled:((Re=(ce=u==null?void 0:u.metadata)==null?void 0:ce.image)==null?void 0:Re.type)!=="img2img",children:j("parameters.useInitImg")}),l.jsx(pr,{onClickCapture:_,children:j("parameters.sendToImg2Img")}),l.jsx(pr,{onClickCapture:z,children:j("parameters.sendToUnifiedCanvas")}),l.jsx(pr,{"data-warning":!0,children:l.jsx(uc,{image:u,children:l.jsx("p",{children:j("parameters.deleteImage")})})})]})},children:Q=>l.jsxs(We,{position:"relative",onMouseOver:P,onMouseOut:I,userSelect:"none",draggable:!0,onDragStart:X,ref:Q,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(ds,{objectFit:c?"contain":r,rounded:"md",src:p||h,loading:"lazy",sx:{position:"absolute",width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",top:"50%",transform:"translate(-50%,-50%)",...k==="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(Jt,{as:zc,sx:{width:"50%",height:"50%",fill:"ok.500"}})}),S&&o>=64&&l.jsx(We,{sx:{position:"absolute",top:1,insetInlineEnd:1},children:l.jsx(uc,{image:u,children:l.jsx(le,{"aria-label":j("parameters.deleteImage"),icon:l.jsx(K8,{}),size:"xs",fontSize:14,isDisabled:!s})})})]},g)})},M9);Vy.displayName="HoverableImage";const T9="0px",up="calc(70px + 1rem)",_9=4,dp=1.5,D9=`calc(100vw - ${T9})`,O9=`calc(100vh - ${dp*4}px)`,A9=`calc(100vh - ${up})`,t0=`calc(100vh - (${up} + 6rem))`,z9=`calc(100vh - (${up} + 4.4rem))`,Al="22.5rem";const R9=oe(Ny,{shouldForwardProp:e=>!["sx"].includes(e)}),zl=320,n0=40,N9={txt2img:{galleryMinWidth:200,galleryMaxWidth:500},img2img:{galleryMinWidth:200,galleryMaxWidth:500},unifiedCanvas:{galleryMinWidth:200,galleryMaxWidth:200},nodes:{galleryMinWidth:200,galleryMaxWidth:500},postprocess:{galleryMinWidth:200,galleryMaxWidth:500},training:{galleryMinWidth:200,galleryMaxWidth:500}},r0=400;function Uy(){const e=Y(),{direction:t}=ei(),{t:n}=Z(),{images:r,currentCategory:o,currentImageUuid:s,shouldPinGallery:c,shouldShowGallery:u,galleryImageMinimumWidth:f,galleryGridTemplateColumns:h,activeTabName:p,galleryImageObjectFit:g,shouldHoldGalleryOpen:y,shouldAutoSwitchToNewImages:S,areMoreImagesAvailable:C,galleryWidth:w,isLightboxOpen:k,isStaging:j,shouldEnableResize:M,shouldUseSingleGalleryColumn:P}=O(J8),{galleryMinWidth:I,galleryMaxWidth:T}=k?{galleryMinWidth:r0,galleryMaxWidth:r0}:N9[p],[D,_]=x.useState(w>=zl),[z,V]=x.useState(!1),[F,L]=x.useState(0),X=x.useRef(null),$=x.useRef(null),Q=x.useRef(null);x.useEffect(()=>{_(w>=zl)},[w]);const re=()=>{!c&&e(Lo(!0)),e(JS(!c)),e(on(!0))},ie=()=>{u?K():U()},U=()=>{e(Lo(!0)),c&&e(on(!0))},K=x.useCallback(()=>{e(Lo(!1)),e(YS(!1)),setTimeout(()=>c&&e(on(!0)),400)},[e,c]),ne=()=>{e(eC(o))},ce=J=>{e(Da(J))},Re=()=>{y||(Q.current=window.setTimeout(()=>K(),500))},ze=()=>{Q.current&&window.clearTimeout(Q.current)};fe("g",()=>{ie()},[u,c]),fe("left",()=>{e(R1())},{enabled:!j||p!=="unifiedCanvas"},[j]),fe("right",()=>{e(N1())},{enabled:!j||p!=="unifiedCanvas"},[j]),fe("shift+g",()=>{re()},[c]),fe("esc",()=>{e(Lo(!1))},{enabled:()=>!c,preventDefault:!0},[c]);const Me=32;return fe("shift+up",()=>{if(f<256){const J=te.clamp(f+Me,32,256);e(Da(J))}},[f]),fe("shift+down",()=>{if(f>32){const J=te.clamp(f-Me,32,256);e(Da(J))}},[f]),x.useEffect(()=>{function J(ue){!c&&X.current&&!X.current.contains(ue.target)&&K()}return document.addEventListener("mousedown",J),()=>{document.removeEventListener("mousedown",J)}},[K,c]),l.jsx(Wy,{nodeRef:X,in:u||y,unmountOnExit:!0,timeout:200,classNames:`${t}-image-gallery-css-transition`,children:l.jsxs(We,{className:`${t}-image-gallery-css-transition`,sx:c?{zIndex:1,insetInlineEnd:0}:{zIndex:100,position:"fixed",height:"100vh",top:0,insetInlineEnd:0},ref:X,onMouseLeave:c?void 0:Re,onMouseEnter:c?void 0:ze,onMouseOver:c?void 0:ze,children:[l.jsxs(R9,{sx:{padding:4,display:"flex",flexDirection:"column",rowGap:4,borderRadius:c?"base":0,borderInlineStartWidth:5,bg:"base.850",borderColor:"base.700"},minWidth:I,maxWidth:c?T:window.innerWidth,"data-pinned":c,handleStyles:t==="rtl"?{right:{width:"15px"}}:{left:{width:"15px"}},enable:t==="rtl"?{right:M}:{left:M},size:{width:w,height:c?"100%":"100vh"},onResizeStart:(J,ue,Ie)=>{L(Ie.clientHeight),Ie.style.height=`${Ie.clientHeight}px`,c&&(Ie.style.position="fixed",Ie.style.insetInlineEnd="1rem",V(!0))},onResizeStop:(J,ue,Ie,Be)=>{const Ne=c?te.clamp(Number(w)+Be.width,I,Number(T)):Number(w)+Be.width;e(XS(Ne)),Ie.removeAttribute("data-resize-alert"),c&&(console.log("unpin"),Ie.style.position="relative",Ie.style.removeProperty("inset-inline-end"),Ie.style.setProperty("height",c?"100%":"100vh"),V(!1),e(on(!0)))},onResize:(J,ue,Ie,Be)=>{const Ne=te.clamp(Number(w)+Be.width,I,Number(c?T:.95*window.innerWidth));Ne>=zl&&!D?_(!0):NeNe-n0&&e(Da(Ne-n0)),c&&(Ne>=T?Ie.setAttribute("data-resize-alert","true"):Ie.removeAttribute("data-resize-alert")),Ie.style.height=`${F}px`},children:[l.jsxs(B,{alignItems:"center",gap:2,justifyContent:"space-between",children:[l.jsx(en,{size:"sm",isAttached:!0,w:"max-content",justifyContent:"stretch",children:D?l.jsxs(l.Fragment,{children:[l.jsx(Je,{size:"sm",isChecked:o==="result",onClick:()=>e(gl("result")),flexGrow:1,children:n("gallery.generations")}),l.jsx(Je,{size:"sm",isChecked:o==="user",onClick:()=>e(gl("user")),flexGrow:1,children:n("gallery.uploads")})]}):l.jsxs(l.Fragment,{children:[l.jsx(le,{"aria-label":n("gallery.showGenerations"),tooltip:n("gallery.showGenerations"),isChecked:o==="result",icon:l.jsx(N8,{}),onClick:()=>e(gl("result"))}),l.jsx(le,{"aria-label":n("gallery.showUploads"),tooltip:n("gallery.showUploads"),isChecked:o==="user",icon:l.jsx(Z8,{}),onClick:()=>e(gl("user"))})]})}),l.jsxs(B,{gap:2,children:[l.jsx(rr,{triggerComponent:l.jsx(le,{size:"sm","aria-label":n("gallery.gallerySettings"),icon:l.jsx(ap,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(ut,{value:f,onChange:ce,min:32,max:256,hideTooltip:!0,label:n("gallery.galleryImageSize"),withReset:!0,handleReset:()=>e(Da(64))}),l.jsx(pt,{label:n("gallery.maintainAspectRatio"),isChecked:g==="contain",onChange:()=>e(KS(g==="contain"?"cover":"contain"))}),l.jsx(pt,{label:n("gallery.autoSwitchNewImages"),isChecked:S,onChange:J=>e(QS(J.target.checked))}),l.jsx(pt,{label:n("gallery.singleColumnLayout"),isChecked:P,onChange:J=>e(ZS(J.target.checked))})]})}),l.jsx(le,{size:"sm","aria-label":n("gallery.pinGallery"),tooltip:`${n("gallery.pinGallery")} (Shift+G)`,onClick:re,icon:c?l.jsx(Fy,{}):l.jsx(Ly,{})})]})]}),l.jsx(B,{direction:"column",gap:2,h:c?t0:"100vh",maxH:c?t0:"100vh",overflowY:"scroll",ref:$,sx:{...h2},children:r.length||C?l.jsxs(l.Fragment,{children:[l.jsx($n,{gap:2,style:{gridTemplateColumns:h},children:r.map(J=>{const{uuid:ue}=J,Ie=s===ue;return l.jsx(Vy,{image:J,isSelected:Ie},ue)})}),l.jsx(Je,{onClick:ne,isDisabled:!C,flexShrink:0,children:n(C?"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(Jt,{as:lp,sx:{w:16,h:16}}),l.jsx("p",{children:n("gallery.noImagesInGallery")})]})})]}),z&&l.jsx(We,{style:{width:`${w}px`,height:"100%"}})]})})}var F9=nh({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"})]})}),$y=nh({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"})]})}),L9=nh({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 B9(e){return me({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 xt=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>l.jsxs(B,{gap:2,children:[n&&l.jsx(Yt,{label:`Recall ${e}`,children:l.jsx(co,{"aria-label":"Use this parameter",icon:l.jsx(B9,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&l.jsx(Yt,{label:`Copy ${e}`,children:l.jsx(co,{"aria-label":`Copy ${e}`,icon:l.jsx(Ji,{}),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($y,{mx:"2px"})]}):l.jsx(Ce,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}),H9=(e,t)=>e.image.uuid===t.image.uuid,fp=x.memo(({image:e,styleClass:t})=>{var F,L;const n=Y(),r=sp();fe("esc",()=>{n(z1(!1))});const o=((F=e==null?void 0:e.metadata)==null?void 0:F.image)||{},s=e==null?void 0:e.dreamPrompt,{cfg_scale:c,fit:u,height:f,hires_fix:h,init_image_path:p,mask_image_path:g,orig_path:y,perlin:S,postprocessing:C,prompt:w,sampler:k,seamless:j,seed:M,steps:P,strength:I,threshold:T,type:D,variations:_,width:z}=o,V=JSON.stringify(e.metadata,null,2);return l.jsx(We,{className:t,sx:{position:"absolute",top:"0",width:"100%",borderRadius:"base",padding:4,overflow:"scroll",maxHeight:z9,height:"100%",zIndex:"10",backdropFilter:"blur(10px)",bg:"blackAlpha.600"},children:l.jsxs(B,{gap:1,direction:"column",width:"100%",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($y,{mx:"2px"})]})]}),Object.keys(o).length>0?l.jsxs(l.Fragment,{children:[D&&l.jsx(xt,{label:"Generation type",value:D}),((L=e.metadata)==null?void 0:L.model_weights)&&l.jsx(xt,{label:"Model",value:e.metadata.model_weights}),["esrgan","gfpgan"].includes(D)&&l.jsx(xt,{label:"Original image",value:y}),w&&l.jsx(xt,{label:"Prompt",labelPosition:"top",value:typeof w=="string"?w:_1(w),onClick:()=>r(w)}),M!==void 0&&l.jsx(xt,{label:"Seed",value:M,onClick:()=>n(as(M))}),T!==void 0&&l.jsx(xt,{label:"Noise Threshold",value:T,onClick:()=>n(ef(T))}),S!==void 0&&l.jsx(xt,{label:"Perlin Noise",value:S,onClick:()=>n(tf(S))}),k&&l.jsx(xt,{label:"Sampler",value:k,onClick:()=>n(F1(k))}),P&&l.jsx(xt,{label:"Steps",value:P,onClick:()=>n(nf(P))}),c!==void 0&&l.jsx(xt,{label:"CFG scale",value:c,onClick:()=>n(rf(c))}),_&&_.length>0&&l.jsx(xt,{label:"Seed-weight pairs",value:Rv(_),onClick:()=>n(L1(Rv(_)))}),j&&l.jsx(xt,{label:"Seamless",value:j,onClick:()=>n(B1(j))}),h&&l.jsx(xt,{label:"High Resolution Optimization",value:h,onClick:()=>n(H1(h))}),z&&l.jsx(xt,{label:"Width",value:z,onClick:()=>n(Wl(z))}),f&&l.jsx(xt,{label:"Height",value:f,onClick:()=>n(Vl(f))}),p&&l.jsx(xt,{label:"Initial image",value:p,isLink:!0,onClick:()=>n(is(p))}),g&&l.jsx(xt,{label:"Mask image",value:g,isLink:!0,onClick:()=>n(tC(g))}),D==="img2img"&&I&&l.jsx(xt,{label:"Image to image strength",value:I,onClick:()=>n(of(I))}),u&&l.jsx(xt,{label:"Image to image fit",value:u,onClick:()=>n(W1(u))}),C&&C.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Vn,{size:"sm",children:"Postprocessing"}),C.map((X,$)=>{if(X.type==="esrgan"){const{scale:Q,strength:re,denoise_str:ie}=X;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${$+1}: Upscale (ESRGAN)`}),l.jsx(xt,{label:"Scale",value:Q,onClick:()=>n(I1(Q))}),l.jsx(xt,{label:"Strength",value:re,onClick:()=>n(Jd(re))}),ie!==void 0&&l.jsx(xt,{label:"Denoising strength",value:ie,onClick:()=>n(Zd(ie))})]},$)}else if(X.type==="gfpgan"){const{strength:Q}=X;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${$+1}: Face restoration (GFPGAN)`}),l.jsx(xt,{label:"Strength",value:Q,onClick:()=>{n(Zl(Q)),n(Hl("gfpgan"))}})]},$)}else if(X.type==="codeformer"){const{strength:Q,fidelity:re}=X;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${$+1}: Face restoration (Codeformer)`}),l.jsx(xt,{label:"Strength",value:Q,onClick:()=>{n(Zl(Q)),n(Hl("codeformer"))}}),re&&l.jsx(xt,{label:"Fidelity",value:re,onClick:()=>{n(Qd(re)),n(Hl("codeformer"))}})]},$)}})]}),s&&l.jsx(xt,{withCopy:!0,label:"Dream Prompt",value:s}),l.jsxs(B,{gap:2,direction:"column",children:[l.jsxs(B,{gap:2,children:[l.jsx(Yt,{label:"Copy metadata JSON",children:l.jsx(co,{"aria-label":"Copy metadata JSON",icon:l.jsx(Ji,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(V)})}),l.jsx(Ce,{fontWeight:"semibold",children:"Metadata JSON:"})]}),l.jsx(We,{sx:{mt:0,mr:2,mb:4,ml:2,padding:4,borderRadius:"base",overflowX:"scroll",wordBreak:"break-all",bg:"whiteAlpha.100"},children:l.jsx("pre",{children:V})})]})]}):l.jsx(bx,{width:"100%",pt:10,children:l.jsx(Ce,{fontSize:"lg",fontWeight:"semibold",children:"No metadata available"})})]})})},H9);fp.displayName="ImageMetadataViewer";const o0={height:"100%",width:"15%",alignItems:"center",pointerEvents:"auto"},i0={color:"base.100"},W9=be(Vr,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:te.isEqual}}),Gy=()=>{const e=Y(),{isOnFirstImage:t,isOnLastImage:n}=O(W9),[r,o]=x.useState(!1),s=()=>{o(!0)},c=()=>{o(!1)},u=()=>{e(R1())},f=()=>{e(N1())};return l.jsxs(B,{sx:{justifyContent:"space-between",zIndex:1,height:"100%",width:"100%",pointerEvents:"none"},children:[l.jsx($n,{sx:{...o0,justifyContent:"flex-start"},onMouseOver:s,onMouseOut:c,children:r&&!t&&l.jsx(co,{"aria-label":"Previous image",icon:l.jsx(j8,{size:64}),variant:"unstyled",onClick:u,boxSize:16,sx:i0})}),l.jsx($n,{sx:{...o0,justifyContent:"flex-end"},onMouseOver:s,onMouseOut:c,children:r&&!n&&l.jsx(co,{"aria-label":"Next image",icon:l.jsx(E8,{size:64}),variant:"unstyled",onClick:f,boxSize:16,sx:i0})})]})};var Wn=function(e,t){return Number(e.toFixed(t))},V9=function(e,t){return typeof e=="number"?e:t},Tt=function(e,t,n){n&&typeof n=="function"&&n(e,t)},U9=function(e){return-Math.cos(e*Math.PI)/2+.5},$9=function(e){return e},G9=function(e){return e*e},q9=function(e){return e*(2-e)},Y9=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},X9=function(e){return e*e*e},K9=function(e){return--e*e*e+1},Q9=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},Z9=function(e){return e*e*e*e},J9=function(e){return 1- --e*e*e*e},eP=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},tP=function(e){return e*e*e*e*e},nP=function(e){return 1+--e*e*e*e*e},rP=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},qy={easeOut:U9,linear:$9,easeInQuad:G9,easeOutQuad:q9,easeInOutQuad:Y9,easeInCubic:X9,easeOutCubic:K9,easeInOutCubic:Q9,easeInQuart:Z9,easeOutQuart:J9,easeInOutQuart:eP,easeInQuint:tP,easeOutQuint:nP,easeInOutQuint:rP},Yy=function(e){typeof e=="number"&&cancelAnimationFrame(e)},gr=function(e){e.mounted&&(Yy(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function Xy(e,t,n,r){if(e.mounted){var o=new Date().getTime(),s=1;gr(e),e.animation=function(){if(!e.mounted)return Yy(e.animation);var c=new Date().getTime()-o,u=c/n,f=qy[t],h=f(u);c>=n?(r(s),e.animation=null):e.animation&&(r(h),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function oP(e){var t=e.scale,n=e.positionX,r=e.positionY;return!(Number.isNaN(t)||Number.isNaN(n)||Number.isNaN(r))}function go(e,t,n,r){var o=oP(t);if(!(!e.mounted||!o)){var s=e.setTransformState,c=e.transformState,u=c.scale,f=c.positionX,h=c.positionY,p=t.scale-u,g=t.positionX-f,y=t.positionY-h;n===0?s(t.scale,t.positionX,t.positionY):Xy(e,r,n,function(S){var C=u+p*S,w=f+g*S,k=h+y*S;s(C,w,k)})}}function iP(e,t,n){var r=e.offsetWidth,o=e.offsetHeight,s=t.offsetWidth,c=t.offsetHeight,u=s*n,f=c*n,h=r-u,p=o-f;return{wrapperWidth:r,wrapperHeight:o,newContentWidth:u,newDiffWidth:h,newContentHeight:f,newDiffHeight:p}}var aP=function(e,t,n,r,o,s,c){var u=e>t?n*(c?1:.5):0,f=r>o?s*(c?1:.5):0,h=e-t-u,p=u,g=r-o-f,y=f;return{minPositionX:h,maxPositionX:p,minPositionY:g,maxPositionY:y}},hp=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=iP(n,r,t),c=s.wrapperWidth,u=s.wrapperHeight,f=s.newContentWidth,h=s.newDiffWidth,p=s.newContentHeight,g=s.newDiffHeight,y=aP(c,f,h,u,p,g,Boolean(o));return y},Df=function(e,t,n,r){return r?en?Wn(n,2):Wn(e,2):Wn(e,2)},ea=function(e,t){var n=hp(e,t);return e.bounds=n,n};function Nc(e,t,n,r,o,s,c){var u=n.minPositionX,f=n.minPositionY,h=n.maxPositionX,p=n.maxPositionY,g=0,y=0;c&&(g=o,y=s);var S=Df(e,u-g,h+g,r),C=Df(t,f-y,p+y,r);return{x:S,y:C}}function Fc(e,t,n,r,o,s){var c=e.transformState,u=c.scale,f=c.positionX,h=c.positionY,p=r-u;if(typeof t!="number"||typeof n!="number")return console.error("Mouse X and Y position were not provided!"),{x:f,y:h};var g=f-t*p,y=h-n*p,S=Nc(g,y,o,s,0,0,null);return S}function ys(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 a0=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=Lc(s,n);return!f},s0=function(e){var t=e.isInitialized,n=e.isPanning,r=e.setup,o=r.panning.disabled,s=t&&n&&!o;return!!s},sP=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}},lP=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 cP(e){var t=e.transformState,n=t.positionX,r=t.positionY,o=t.scale,s=e.setup,c=s.disabled,u=s.limitToBounds,f=s.centerZoomedOut,h=e.wrapperComponent;if(!(c||!h||!e.bounds)){var p=e.bounds,g=p.maxPositionX,y=p.minPositionX,S=p.maxPositionY,C=p.minPositionY,w=n>g||nS||rg?h.offsetWidth:e.setup.minPositionX||0,M=r>S?h.offsetHeight:e.setup.minPositionY||0,P=Fc(e,j,M,o,e.bounds,u||f),I=P.x,T=P.y;return{scale:o,positionX:w?I:n,positionY:k?T:r}}}function uP(e,t,n,r,o){var s=e.setup.limitToBounds,c=e.wrapperComponent,u=e.bounds,f=e.transformState,h=f.scale,p=f.positionX,g=f.positionY;if(!(c===null||u===null||t===p&&n===g)){var y=Nc(t,n,u,s,r,o,c),S=y.x,C=y.y;e.setTransformState(h,S,C)}}var dP=function(e,t,n){var r=e.startCoords,o=e.transformState,s=e.setup.panning,c=s.lockAxisX,u=s.lockAxisY,f=o.positionX,h=o.positionY;if(!r)return{x:f,y:h};var p=t-r.x,g=n-r.y,y=c?f:p,S=u?h:g;return{x:y,y:S}},dc=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},fP=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},hP=function(e){var t=e.mounted,n=e.velocity,r=e.bounds,o=e.setup,s=o.disabled,c=o.velocityAnimation,u=e.transformState.scale,f=c.disabled,h=!f||u>1||!s||t;return!(!h||!n||!r)};function pP(e,t){var n=e.setup.velocityAnimation,r=n.equalToMove,o=n.animationTime,s=n.sensitivity;return r?o*t*s:o}function l0(e,t,n,r,o,s,c,u,f,h){if(o){if(t>c&&n>c){var p=c+(e-c)*h;return p>f?f:ps?s:p}}return r?t:Df(e,s,c,o)}function mP(e,t){var n=1;return t?Math.min(n,e.offsetWidth/window.innerWidth):n}function vP(e,t){var n=fP(e);if(n){var r=e.lastMousePosition,o=e.velocityTime,s=e.setup,c=e.wrapperComponent,u=s.velocityAnimation.equalToMove,f=Date.now();if(r&&o&&c){var h=mP(c,u),p=t.x-r.x,g=t.y-r.y,y=p/h,S=g/h,C=f-o,w=p*p+g*g,k=Math.sqrt(w)/C;e.velocity={velocityX:y,velocityY:S,total:k}}e.lastMousePosition=t,e.velocityTime=f}}function gP(e){var t=e.velocity,n=e.bounds,r=e.setup,o=e.wrapperComponent,s=hP(e);if(!(!s||!t||!n||!o)){var c=t.velocityX,u=t.velocityY,f=t.total,h=n.maxPositionX,p=n.minPositionX,g=n.maxPositionY,y=n.minPositionY,S=r.limitToBounds,C=r.alignmentAnimation,w=r.zoomAnimation,k=r.panning,j=k.lockAxisY,M=k.lockAxisX,P=w.animationType,I=C.sizeX,T=C.sizeY,D=C.velocityAlignmentTime,_=D,z=pP(e,f),V=Math.max(z,_),F=dc(e,I),L=dc(e,T),X=F*o.offsetWidth/100,$=L*o.offsetHeight/100,Q=h+X,re=p-X,ie=g+$,U=y-$,K=e.transformState,ne=new Date().getTime();Xy(e,P,V,function(ce){var Re=e.transformState,ze=Re.scale,Me=Re.positionX,J=Re.positionY,ue=new Date().getTime()-ne,Ie=ue/_,Be=qy[C.animationType],Ne=1-Be(Math.min(1,Ie)),Ge=1-ce,Qe=Me+c*Ge,ve=J+u*Ge,_e=l0(Qe,K.positionX,Me,M,S,p,h,re,Q,Ne),qe=l0(ve,K.positionY,J,j,S,y,g,U,ie,Ne);(Me!==Qe||J!==ve)&&e.setTransformState(ze,_e,qe)})}}function c0(e,t){var n=e.transformState.scale;gr(e),ea(e,n),window.TouchEvent!==void 0&&t instanceof TouchEvent?lP(e,t):sP(e,t)}function Ky(e){var t=e.transformState.scale,n=e.setup,r=n.minScale,o=n.alignmentAnimation,s=o.disabled,c=o.sizeX,u=o.sizeY,f=o.animationTime,h=o.animationType,p=s||t.1&&g;y?gP(e):Ky(e)}}function pp(e,t,n,r){var o=e.setup,s=o.minScale,c=o.maxScale,u=o.limitToBounds,f=ys(Wn(t,2),s,c,0,!1),h=ea(e,f),p=Fc(e,n,r,f,h,u),g=p.x,y=p.y;return{scale:f,positionX:g,positionY:y}}function Qy(e,t,n){var r=e.transformState.scale,o=e.wrapperComponent,s=e.setup,c=s.minScale,u=s.limitToBounds,f=s.zoomAnimation,h=f.disabled,p=f.animationTime,g=f.animationType,y=h||r>=c;if((r>=1||u)&&Ky(e),!(y||!o||!e.mounted)){var S=t||o.offsetWidth/2,C=n||o.offsetHeight/2,w=pp(e,c,S,C);w&&go(e,w,p,g)}}var lo=function(){return lo=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},AP=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=Lc(c,o);return!f},zP=function(e){var t=e.setup.pinch.disabled,n=e.isInitialized,r=e.pinchStartDistance,o=n&&!t&&r;return!!o},RP=function(e,t,n){var r=n.getBoundingClientRect(),o=e.touches,s=Wn(o[0].clientX-r.left,5),c=Wn(o[0].clientY-r.top,5),u=Wn(o[1].clientX-r.left,5),f=Wn(o[1].clientY-r.top,5);return{x:(s+u)/2/t,y:(c+f)/2/t}},o4=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))},NP=function(e,t){var n=e.pinchStartScale,r=e.pinchStartDistance,o=e.setup,s=o.maxScale,c=o.minScale,u=o.zoomAnimation,f=o.disablePadding,h=u.size,p=u.disabled;if(!n||r===null||!t)throw new Error("Pinch touches distance was not provided");if(t<0)return e.transformState.scale;var g=t/r,y=g*n;return ys(Wn(y,2),c,s,h,!p&&!f)},FP=160,LP=100,BP=function(e,t){var n=e.props,r=n.onWheelStart,o=n.onZoomStart;e.wheelStopEventTimer||(gr(e),Tt(dt(e),t,r),Tt(dt(e),t,o))},HP=function(e,t){var n=e.props,r=n.onWheel,o=n.onZoom,s=e.contentComponent,c=e.setup,u=e.transformState,f=u.scale,h=c.limitToBounds,p=c.centerZoomedOut,g=c.zoomAnimation,y=c.wheel,S=c.disablePadding,C=g.size,w=g.disabled,k=y.step;if(!s)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var j=_P(t,null),M=DP(e,j,k,!t.ctrlKey);if(f!==M){var P=ea(e,M),I=r4(t,s,f),T=w||C===0||p||S,D=h&&T,_=Fc(e,I.x,I.y,M,P,D),z=_.x,V=_.y;e.previousWheelEvent=t,e.setTransformState(M,z,V),Tt(dt(e),t,r),Tt(dt(e),t,o)}},WP=function(e,t){var n=e.props,r=n.onWheelStop,o=n.onZoomStop;Of(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(Qy(e,t.x,t.y),e.wheelAnimationTimer=null)},LP);var s=OP(e,t);s&&(Of(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,Tt(dt(e),t,r),Tt(dt(e),t,o))},FP))},VP=function(e,t){var n=o4(t);e.pinchStartDistance=n,e.lastDistance=n,e.pinchStartScale=e.transformState.scale,e.isPanning=!1,gr(e)},UP=function(e,t){var n=e.contentComponent,r=e.pinchStartDistance,o=e.transformState.scale,s=e.setup,c=s.limitToBounds,u=s.centerZoomedOut,f=s.zoomAnimation,h=f.disabled,p=f.size;if(!(r===null||!n)){var g=RP(t,o,n);if(!(!Number.isFinite(g.x)||!Number.isFinite(g.y))){var y=o4(t),S=NP(e,y);if(S!==o){var C=ea(e,S),w=h||p===0||u,k=c&&w,j=Fc(e,g.x,g.y,S,C,k),M=j.x,P=j.y;e.pinchMidpoint=g,e.lastDistance=y,e.setTransformState(S,M,P)}}}},$P=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,Qy(e,t==null?void 0:t.x,t==null?void 0:t.y)},i4=function(e,t){var n=e.props.onZoomStop,r=e.setup.doubleClick.animationTime;Of(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,Tt(dt(e),t,n)},r)},GP=function(e,t){var n=e.props,r=n.onZoomStart,o=n.onZoom,s=e.setup.doubleClick,c=s.animationTime,u=s.animationType;Tt(dt(e),t,r),t4(e,c,u,function(){return Tt(dt(e),t,o)}),i4(e,t)};function qP(e,t){var n=e.setup,r=e.doubleClickStopEventTimer,o=e.transformState,s=e.contentComponent,c=o.scale,u=e.props,f=u.onZoomStart,h=u.onZoom,p=n.doubleClick,g=p.disabled,y=p.mode,S=p.step,C=p.animationTime,w=p.animationType;if(!g&&!r){if(y==="reset")return GP(e,t);if(!s)return console.error("No ContentComponent found");var k=y==="zoomOut"?-1:1,j=Jy(e,k,S);if(c!==j){Tt(dt(e),t,f);var M=r4(t,s,c),P=pp(e,j,M.x,M.y);if(!P)return console.error("Error during zoom event. New transformation state was not calculated.");Tt(dt(e),t,h),go(e,P,C,w),i4(e,t)}}}var YP=function(e,t){var n=e.isInitialized,r=e.setup,o=e.wrapperComponent,s=r.doubleClick,c=s.disabled,u=s.excluded,f=t.target,h=o==null?void 0:o.contains(f),p=n&&f&&h&&!c;if(!p)return!1;var g=Lc(f,u);return!g},XP=function(){function e(t){var n=this;this.mounted=!0,this.onChangeCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.startCoords=null,this.lastTouch=null,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.animate=!1,this.animation=null,this.maxBounds=null,this.pressedKeys={},this.mount=function(){n.initializeWindowEvents()},this.unmount=function(){n.cleanupWindowEvents()},this.update=function(r){ea(n,n.transformState.scale),n.setup=f0(r)},this.initializeWindowEvents=function(){var r,o=Fd(),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=Fd(),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),gr(n),(o=n.observer)===null||o===void 0||o.disconnect()},this.handleInitializeWrapperEvents=function(r){var o=Fd();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=MP(n,r);if(s){var c=n.isPressingKeys(n.setup.wheel.activationKeys);c&&(BP(n,r),HP(n,r),WP(n,r))}}},this.onPanningStart=function(r){var o=n.setup.disabled,s=n.props.onPanningStart;if(!o){var c=a0(n,r);if(c){var u=n.isPressingKeys(n.setup.panning.activationKeys);u&&(r.preventDefault(),r.stopPropagation(),gr(n),c0(n,r),Tt(dt(n),r,s))}}},this.onPanning=function(r){var o=n.setup.disabled,s=n.props.onPanning;if(!o){var c=s0(n);if(c){var u=n.isPressingKeys(n.setup.panning.activationKeys);u&&(r.preventDefault(),r.stopPropagation(),u0(n,r.clientX,r.clientY),Tt(dt(n),r,s))}}},this.onPanningStop=function(r){var o=n.props.onPanningStop;n.isPanning&&(xP(n),Tt(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=AP(n,r);f&&(VP(n,r),gr(n),Tt(dt(n),r,c),Tt(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=zP(n);f&&(r.preventDefault(),r.stopPropagation(),UP(n,r),Tt(dt(n),r,c),Tt(dt(n),r,u))}},this.onPinchStop=function(r){var o=n.props,s=o.onPinchingStop,c=o.onZoomStop;n.pinchStartScale&&($P(n),Tt(dt(n),r,s),Tt(dt(n),r,c))},this.onTouchPanningStart=function(r){var o=n.setup.disabled,s=n.props.onPanningStart;if(!o){var c=a0(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,gr(n);var f=r.touches,h=f.length===1,p=f.length===2;h&&(gr(n),c0(n,r),Tt(dt(n),r,s)),p&&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=s0(n);if(!c)return;r.preventDefault(),r.stopPropagation();var u=r.touches[0];u0(n,u.clientX,u.clientY),Tt(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=YP(n,r);s&&qP(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)}),Tt(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=n4(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):PP(r,o,s)},this.applyTransformation=function(){if(!(!n.mounted||!n.contentComponent)){var r=n.transformState,o=r.scale,s=r.positionX,c=r.positionY,u=n.handleTransformStyles(s,c,o);n.contentComponent.style.transform=u}},this.getContext=function(){return dt(n)},this.onChange=function(r){return n.onChangeCallbacks.has(r)||n.onChangeCallbacks.add(r),function(){n.onChangeCallbacks.delete(r)}},this.init=function(r,o){n.cleanupWindowEvents(),n.wrapperComponent=r,n.contentComponent=o,ea(n,n.transformState.scale),n.handleInitializeWrapperEvents(r),n.handleInitialize(o),n.initializeWindowEvents(),n.isInitialized=!0,Tt(dt(n),void 0,n.props.onInit)},this.props=t,this.setup=f0(this.props),this.transformState=Zy(this.props)}return e}(),Bc=ke.createContext(null),KP=function(e,t){return typeof e=="function"?e(t):e},QP=ke.forwardRef(function(e,t){var n=x.useState(0),r=n[1],o=e.children,s=x.useRef(new XP(e)).current,c=KP(e.children,dt(s)),u=x.useCallback(function(){typeof o=="function"&&r(function(f){return f+1})},[o]);return x.useImperativeHandle(t,function(){return dt(s)},[s]),x.useEffect(function(){s.update(e)},[s,e]),x.useEffect(function(){return s.onChange(u)},[s,e,u]),ke.createElement(Bc.Provider,{value:s},c)});function ZP(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 JP=`.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; } `,h0={wrapper:"transform-component-module_wrapper__7HFJe",content:"transform-component-module_content__uCDPE"};ZP(JP);var eI=function(e){var t=e.children,n=e.wrapperClass,r=n===void 0?"":n,o=e.contentClass,s=o===void 0?"":o,c=e.wrapperStyle,u=e.contentStyle,f=e.wrapperProps,h=f===void 0?{}:f,p=e.contentProps,g=p===void 0?{}:p,y=x.useContext(Bc).init,S=x.useRef(null),C=x.useRef(null);return x.useEffect(function(){var w=S.current,k=C.current;w!==null&&k!==null&&y&&y(w,k)},[]),ke.createElement("div",lo({},h,{ref:S,className:"react-transform-wrapper ".concat(h0.wrapper," ").concat(r),style:c}),ke.createElement("div",lo({},g,{ref:C,className:"react-transform-component ".concat(h0.content," ").concat(s),style:u}),t))},a4=function(){var e=x.useContext(Bc),t=x.useState(dt(e||{})),n=t[0],r=t[1];if(!e)throw new Error("Transform context mus be placed inside TransformWrapper");return x.useEffect(function(){e.onChange(function(o){r(o)})},[e]),n};ke.forwardRef(function(e,t){var n=x.useRef(null),r=x.useContext(Bc);return x.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]),ke.createElement("div",lo({},e,{ref:IP([n,t])}))});const tI=()=>{const[e,t]=x.useState(0),[n,r]=x.useState(1),[o,s]=x.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)}}},nI=({flipHorizontally:e,flipVertically:t,rotateCounterClockwise:n,rotateClockwise:r,reset:o})=>{const{zoomIn:s,zoomOut:c,resetTransform:u}=a4();return l.jsxs(en,{isAttached:!0,orientation:"vertical",children:[l.jsx(le,{icon:l.jsx(J7,{}),"aria-label":"Zoom In",tooltip:"Zoom In",onClick:()=>s(),fontSize:20}),l.jsx(le,{icon:l.jsx(e8,{}),"aria-label":"Zoom Out",tooltip:"Zoom Out",onClick:()=>c(),fontSize:20}),l.jsx(le,{icon:l.jsx(Q7,{}),"aria-label":"Rotate Counter-Clockwise",tooltip:"Rotate Counter-Clockwise",onClick:n,fontSize:20}),l.jsx(le,{icon:l.jsx(Z7,{}),"aria-label":"Rotate Clockwise",tooltip:"Rotate Clockwise",onClick:r,fontSize:20}),l.jsx(le,{icon:l.jsx(Zg,{}),"aria-label":"Flip Horizontally",tooltip:"Flip Horizontally",onClick:e,fontSize:20}),l.jsx(le,{icon:l.jsx(Zg,{style:{transform:"rotate(90deg)"}}),"aria-label":"Flip Vertically",tooltip:"Flip Vertically",onClick:t,fontSize:20}),l.jsx(le,{icon:l.jsx(Jh,{}),"aria-label":"Reset",tooltip:"Reset",onClick:()=>{u(),o()},fontSize:20})]})};function rI({image:e,alt:t,ref:n,styleClass:r,rotation:o,scaleX:s,scaleY:c}){const{centerView:u}=a4();return l.jsx(eI,{wrapperStyle:{width:"100%",height:"100%"},children:l.jsx("img",{style:{transform:`rotate(${o}deg) scaleX(${s}) scaleY(${c})`,width:"100%"},src:e,alt:t,ref:n,className:r||"",onLoad:()=>u(1,0,"easeOut")})})}const oI=be([Vr,oi],(e,t)=>{const{currentImage:n}=e,{shouldShowImageDetails:r}=t;return{viewerImageToDisplay:n,shouldShowImageDetails:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function iI(){const e=Y(),t=O(y=>y.lightbox.isLightboxOpen),{rotation:n,scaleX:r,scaleY:o,flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:h}=tI(),{viewerImageToDisplay:p,shouldShowImageDetails:g}=O(oI);return fe("Esc",()=>{t&&e(Ho(!1))},[t]),l.jsx(QP,{centerOnInit:!0,minScale:.1,initialPositionX:50,initialPositionY:50,children:l.jsxs(We,{sx:{width:"100%",height:"100%",overflow:"hidden",position:"absolute",insetInlineStart:0,top:0,zIndex:30,animation:"popIn 0.3s ease-in",bg:"base.800"},children:[l.jsxs(B,{sx:{flexDir:"column",position:"absolute",top:4,insetInlineStart:4,gap:4,zIndex:3},children:[l.jsx(le,{icon:l.jsx(K7,{}),"aria-label":"Exit Viewer",onClick:()=>{e(Ho(!1))},fontSize:20}),l.jsx(nI,{flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:h})]}),l.jsxs(B,{children:[l.jsxs($n,{sx:{overflow:"hidden",gridTemplateColumns:"auto max-content",placeItems:"center",width:"100vw",height:"100vh",bg:"base.850"},children:[p&&l.jsxs(l.Fragment,{children:[l.jsx(rI,{rotation:n,scaleX:r,scaleY:o,image:p.url,styleClass:"lightbox-image"}),g&&l.jsx(fp,{image:p})]}),!g&&l.jsx(We,{sx:{position:"absolute",top:0,insetInlineStart:0,w:`calc(100vw - ${8*2*4}px)`,h:"100vh",mx:8,pointerEvents:"none"},children:l.jsx(Gy,{})}),l.jsx(We,{sx:{position:"absolute",top:4},children:l.jsx(Ry,{})})]}),l.jsx(Uy,{})]})]})})}function aI(e){const{menuType:t="icon",iconTooltip:n,buttonText:r,isLazy:o=!0,menuItems:s,menuProps:c,menuButtonProps:u,menuListProps:f,menuItemProps:h}=e,p=()=>{const g=[];return s.forEach((y,S)=>{g.push(l.jsx(pr,{onClick:y.onClick,fontSize:"sm",...h,children:y.item},S))}),g};return l.jsx(zh,{...c,isLazy:o,children:({isOpen:g})=>l.jsxs(l.Fragment,{children:[l.jsx(Nh,{as:t==="icon"?co:ni,tooltip:n,icon:g?l.jsx(S9,{}):l.jsx(b9,{}),paddingX:0,paddingY:t==="regular"?2:0,...u,children:t==="regular"&&r}),l.jsx(Rh,{zIndex:15,padding:0,...f,children:p()})]})})}const sI=be(Pt,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:te.isEqual}});function mp(e){const t=Y(),{btnGroupWidth:n="auto",...r}=e,{isProcessing:o,isConnected:s,isCancelable:c,currentIteration:u,totalIterations:f,cancelType:h,cancelAfter:p}=O(sI),g=x.useCallback(()=>{t(nC()),t(dd(null))},[t]),{t:y}=Z(),S=p!==null;fe("shift+x",()=>{(s||o)&&c&&g()},[s,o,c]),x.useEffect(()=>{p!==null&&pt(Nv("immediate"))},{item:y("parameters.cancel.schedule"),onClick:()=>t(Nv("scheduled"))}];return l.jsxs(en,{isAttached:!0,width:n,children:[h==="immediate"?l.jsx(le,{icon:l.jsx(C9,{}),tooltip:y("parameters.cancel.immediate"),"aria-label":y("parameters.cancel.immediate"),isDisabled:!s||!o||!c,onClick:g,colorScheme:"error",...r}):l.jsx(le,{icon:S?l.jsx(oc,{}):l.jsx(d9,{}),tooltip:y(S?"parameters.cancel.isScheduled":"parameters.cancel.schedule"),"aria-label":y(S?"parameters.cancel.isScheduled":"parameters.cancel.schedule"),isDisabled:!s||!o||!c||u===f,onClick:()=>{t(S?dd(null):dd(u))},colorScheme:"error",...r}),l.jsx(aI,{menuItems:C,iconTooltip:y("parameters.cancel.setType"),menuButtonProps:{colorScheme:"error",minWidth:5}})]})}const vp=e=>e.generation;be(vp,({shouldRandomizeSeed:e,shouldGenerateVariations:t})=>e||t,{memoizeOptions:{resultEqualityCheck:te.isEqual}});const s4=be([vp,Pt,zy,Bt],(e,t,n,r)=>{const{prompt:o,shouldGenerateVariations:s,seedWeights:c,initialImage:u,seed:f}=e,{isProcessing:h,isConnected:p}=t;let g=!0;const y=[];return(!o||Boolean(o.match(/^[\s\r\n]+$/)))&&(g=!1,y.push("Missing prompt")),r==="img2img"&&!u&&(g=!1,y.push("No initial image selected")),h&&(g=!1,y.push("System Busy")),p||(g=!1,y.push("System Disconnected")),s&&(!(V1(c)||c==="")||f===-1)&&(g=!1,y.push("Seed-Weights badly formatted.")),{isReady:g,reasonsWhyNotReady:y}},{memoizeOptions:{equalityCheck:te.isEqual,resultEqualityCheck:te.isEqual}});function gp(e){const{iconButton:t=!1,...n}=e,r=Y(),{isReady:o}=O(s4),s=O(Bt),c=()=>{r(af(s))},{t:u}=Z();return fe(["ctrl+enter","meta+enter"],()=>{r(U1()),r(af(s))},{enabled:()=>o,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,s]),l.jsx(We,{style:{flexGrow:4},children:t?l.jsx(le,{"aria-label":u("parameters.invoke"),type:"submit",icon:l.jsx(V8,{}),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 Ld={borderStartStartRadius:0,borderEndStartRadius:0},xp=be([Vr,oi,Bt],(e,t,n)=>{const{shouldPinParametersPanel:r,shouldShowParametersPanel:o,shouldHoldParametersPanelOpen:s,shouldUseCanvasBetaLayout:c}=t,{shouldShowGallery:u,shouldPinGallery:f,shouldHoldGalleryOpen:h}=e,p=c&&n==="unifiedCanvas",g=!p&&!(o||s&&!r)&&["txt2img","img2img","unifiedCanvas"].includes(n),y=!(u||h&&!f)&&["txt2img","img2img","unifiedCanvas"].includes(n);return{shouldPinParametersPanel:r,shouldShowProcessButtons:!p&&(!r||!o),shouldShowParametersPanelButton:g,shouldShowParametersPanel:o,shouldShowGallery:u,shouldPinGallery:f,shouldShowGalleryButton:y}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),lI=()=>{const e=Y(),{shouldShowParametersPanelButton:t,shouldShowProcessButtons:n,shouldPinParametersPanel:r}=O(xp),o=()=>{e(Wo(!0)),r&&setTimeout(()=>e(on(!0)),400)};return t?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(le,{tooltip:"Show Options Panel (O)",tooltipProps:{placement:"top"},"aria-label":"Show Options Panel",onClick:o,sx:Ld,children:l.jsx(ip,{})}),n&&l.jsxs(l.Fragment,{children:[l.jsx(gp,{iconButton:!0,sx:Ld}),l.jsx(mp,{sx:Ld})]})]}):null},cI=be(Vr,e=>({resultImages:e.categories.result.images,userImages:e.categories.user.images})),uI=()=>{const{resultImages:e,userImages:t}=O(cI);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}},dI=be([oi,Ac,Bt],(e,t,n)=>{const{shouldPinParametersPanel:r}=e,{isLightboxOpen:o}=t;return{shouldPinParametersPanel:r,isLightboxOpen:o,activeTabName:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),yp=e=>{const t=Y(),{optionsPanel:n,children:r,...o}=e,{activeTabName:s,isLightboxOpen:c}=O(dI),u=uI(),f=h=>{const p=h.dataTransfer.getData("invokeai/imageUuid"),g=u(p);g&&(s==="img2img"?t(is(g)):s==="unifiedCanvas"&&t(bc(g)))};return l.jsx(We,{...o,pos:"relative",w:"100%",h:"100%",children:l.jsxs(B,{gap:4,h:"100%",children:[n,l.jsx(We,{pos:"relative",w:"100%",h:"100%",onDrop:f,children:r}),!c&&l.jsx(Uy,{})]})})},fI=e=>{const{styleClass:t}=e,n=x.useContext(Kh),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(Jt,{as:Rc,boxSize:24}),l.jsx(Vn,{size:"md",children:"Click or Drag and Drop"})]})})},hI=be([Vr,oi],(e,t)=>{const{currentImage:n,intermediateImage:r}=e,{shouldShowImageDetails:o}=t;return{imageToDisplay:r||n,isIntermediate:Boolean(r),shouldShowImageDetails:o}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function pI(){const{shouldShowImageDetails:e,imageToDisplay:t,isIntermediate:n}=O(hI);return l.jsxs(B,{sx:{position:"relative",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:[t&&l.jsx(ds,{src:t.url,sx:{objectFit:"contain",maxWidth:"100%",maxHeight:"100%",height:"auto",position:"absolute",imageRendering:n?"pixelated":"initial",borderRadius:"base"},...n&&{width:t.width,height:t.height}}),!e&&l.jsx(Gy,{}),e&&t&&l.jsx(fp,{image:t,styleClass:"current-image-metadata"})]})}const mI=be([Vr],e=>{const{currentImage:t,intermediateImage:n}=e;return{hasAnImageToDisplay:t||n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),l4=()=>{const{hasAnImageToDisplay:e}=O(mI);return l.jsx(B,{sx:{flexDirection:"column",height:"100%",width:"100%",rowGap:4,borderRadius:"base"},children:e?l.jsxs(l.Fragment,{children:[l.jsx(Ry,{}),l.jsx(pI,{})]}):l.jsx(B,{sx:{alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:l.jsx(Jt,{as:y9,sx:{boxSize:24,color:"base.500"}})})})},vI=()=>{const e=x.useContext(Kh);return l.jsx(le,{"aria-label":"Upload Image",tooltip:"Upload Image",icon:l.jsx(Rc,{}),onClick:e||void 0})};function gI(){const e=O(s=>s.generation.initialImage),{t}=Z(),n=Y(),r=us(),o=()=>{r({title:t("toast.parametersFailed"),description:t("toast.parametersFailedDesc"),status:"error",isClosable:!0}),n(rC())};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(vI,{})]}),e&&l.jsx(B,{sx:{position:"relative",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:l.jsx(ds,{sx:{fit:"contain",maxWidth:"100%",maxHeight:"100%",borderRadius:"base",objectFit:"contain",position:"absolute"},src:typeof e=="string"?e:e.url,onError:o})})]})}const p0={flexDirection:"column",height:"100%",width:"100%",gap:4,padding:4},xI=()=>{const t=O(n=>n.generation.initialImage)?l.jsx(B,{flexDirection:"column",gap:4,w:"100%",h:"100%",children:l.jsx(gI,{})}):l.jsx(fI,{});return l.jsxs($n,{sx:{w:"100%",h:"100%",gridTemplateColumns:"1fr 1fr",borderRadius:"base",bg:"base.850"},children:[l.jsx(B,{sx:{...p0,paddingInlineEnd:2},children:t}),l.jsx(B,{sx:{...p0,paddingInlineStart:2},children:l.jsx(l4,{})})]})};var dn=(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))(dn||{});const yI=()=>{const{t:e}=Z();return x.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])},bI=e=>yI()[e];function c4(){const e=O(o=>o.system.isGFPGANAvailable),t=O(o=>o.postprocessing.shouldRunFacetool),n=Y(),r=o=>n(oC(o.target.checked));return l.jsx(En,{isDisabled:!e,isChecked:t,onChange:r})}const u4=()=>{const e=Y(),t=O(o=>o.generation.seamless),n=o=>e(B1(o.target.checked)),{t:r}=Z();return l.jsx(En,{label:r("parameters.seamlessTiling"),fontSize:"md",isChecked:t,onChange:n})},SI=()=>l.jsx(Le,{gap:2,alignItems:"stretch",children:l.jsx(u4,{})});function bp(){const e=O(s=>s.generation.horizontalSymmetrySteps),t=O(s=>s.generation.verticalSymmetrySteps),n=O(s=>s.generation.steps),r=Y(),{t:o}=Z();return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(ut,{label:o("parameters.hSymmetryStep"),value:e,onChange:s=>r(Fv(s)),min:0,max:n,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>r(Fv(0))}),l.jsx(ut,{label:o("parameters.vSymmetryStep"),value:t,onChange:s=>r(Lv(s)),min:0,max:n,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>r(Lv(0))})]})}function Sp(){const e=O(n=>n.generation.shouldUseSymmetry),t=Y();return l.jsx(En,{isChecked:e,onChange:n=>t(iC(n.target.checked))})}function CI(){const e=Y(),t=O(r=>r.generation.perlin),{t:n}=Z();return l.jsx(ut,{label:n("parameters.perlinNoise"),min:0,max:1,step:.05,onChange:r=>e(tf(r)),handleReset:()=>e(tf(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}function wI(){const e=Y(),{t}=Z(),n=O(o=>o.generation.shouldRandomizeSeed),r=o=>e(aC(o.target.checked));return l.jsx(En,{label:t("parameters.randomizeSeed"),isChecked:n,onChange:r})}const m0=/^-?(0\.)?\.?$/,Lr=e=>{const{label:t,isDisabled:n=!1,showStepper:r=!0,isInvalid:o,value:s,onChange:c,min:u,max:f,isInteger:h=!0,formControlProps:p,formLabelProps:g,numberInputFieldProps:y,numberInputStepperProps:S,tooltipProps:C,...w}=e,[k,j]=x.useState(String(s));x.useEffect(()=>{!k.match(m0)&&s!==Number(k)&&j(String(s))},[s,k]);const M=I=>{j(I),I.match(m0)||c(h?Math.floor(Number(I)):Number(I))},P=I=>{const T=te.clamp(h?Math.floor(Number(I.target.value)):Number(I.target.value),u,f);j(String(T)),c(T)};return l.jsx(Yt,{...C,children:l.jsxs(rt,{isDisabled:n,isInvalid:o,...p,children:[t&&l.jsx(st,{...g,children:t}),l.jsxs(Lh,{value:k,min:u,max:f,keepWithinRange:!0,clampValueOnBlur:!1,onChange:M,onBlur:P,...w,children:[l.jsx(Hh,{...y}),r&&l.jsxs(Bh,{children:[l.jsx(Vh,{...S}),l.jsx(Wh,{...S})]})]})]})})};function kI(){const e=Y(),t=O(o=>o.generation.shouldRandomizeSeed),{t:n}=Z(),r=()=>e(as(sC(G1,$1)));return l.jsx(ni,{size:"sm",isDisabled:t,onClick:r,padding:"0 1.5rem",children:l.jsx("p",{children:n("parameters.shuffle")})})}function jI(){const e=O(c=>c.generation.seed),t=O(c=>c.generation.shouldRandomizeSeed),n=O(c=>c.generation.shouldGenerateVariations),{t:r}=Z(),o=Y(),s=c=>o(as(c));return l.jsxs(sa,{gap:2,children:[l.jsx(Lr,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:G1,max:$1,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e,formControlProps:{display:"flex",alignItems:"center",gap:3}}),l.jsx(kI,{})]})}function EI(){const e=Y(),t=O(r=>r.generation.threshold),{t:n}=Z();return l.jsx(ut,{label:n("parameters.noiseThreshold"),min:0,max:20,step:.1,onChange:r=>e(ef(r)),handleReset:()=>e(ef(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}const Cp=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(wI,{}),l.jsx(jI,{}),l.jsx(EI,{}),l.jsx(CI,{})]});function d4(){const e=O(o=>o.system.isESRGANAvailable),t=O(o=>o.postprocessing.shouldRunESRGAN),n=Y(),r=o=>n(lC(o.target.checked));return l.jsx(En,{isDisabled:!e,isChecked:t,onChange:r})}function wp(){const e=O(r=>r.generation.shouldGenerateVariations),t=Y(),n=r=>t(cC(r.target.checked));return l.jsx(En,{isChecked:e,width:"auto",onChange:n})}function mt(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(Ch,{...s})]})}function PI(){const e=O(s=>s.generation.seedWeights),t=O(s=>s.generation.shouldGenerateVariations),{t:n}=Z(),r=Y(),o=s=>r(L1(s.target.value));return l.jsx(mt,{label:n("parameters.seedWeights"),value:e,isInvalid:t&&!(V1(e)||e===""),isDisabled:!t,onChange:o})}function II(){const e=O(o=>o.generation.variationAmount),t=O(o=>o.generation.shouldGenerateVariations),{t:n}=Z(),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(Bv(o)),handleReset:()=>r(Bv(.1)),withInput:!0,withReset:!0,withSliderMarks:!0})}const kp=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(II,{}),l.jsx(PI,{})]});function v0(){const e=Y(),t=O(s=>s.generation.cfgScale),n=O(s=>s.ui.shouldUseSliders),{t:r}=Z(),o=s=>e(rf(s));return n?l.jsx(ut,{label:r("parameters.cfgScale"),step:.5,min:1.01,max:30,onChange:o,handleReset:()=>e(rf(7.5)),value:t,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0}):l.jsx(Lr,{label:r("parameters.cfgScale"),step:.5,min:1.01,max:200,onChange:o,value:t,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})}function g0(){const e=O(s=>s.generation.height),t=O(s=>s.ui.shouldUseSliders),n=O(Bt),r=Y(),{t:o}=Z();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(Vl(s)),handleReset:()=>r(Vl(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(Vl(Number(s.target.value))),validValues:uC})}function x0(){const e=O(s=>s.generation.iterations),t=O(s=>s.ui.shouldUseSliders),n=Y(),{t:r}=Z(),o=s=>n(Hv(s));return t?l.jsx(ut,{label:r("parameters.images"),step:1,min:1,max:16,onChange:o,handleReset:()=>n(Hv(1)),value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:9999}}):l.jsx(Lr,{label:r("parameters.images"),step:1,min:1,max:9999,onChange:o,value:e,numberInputFieldProps:{textAlign:"center"}})}function y0(){const e=O(s=>s.generation.sampler),t=O(Sy),n=Y(),{t:r}=Z(),o=s=>n(F1(s.target.value));return l.jsx(Mn,{label:r("parameters.sampler"),value:e,onChange:o,validValues:t.format==="diffusers"?dC:fC,minWidth:36})}function b0(){const e=Y(),t=O(c=>c.generation.steps),n=O(c=>c.ui.shouldUseSliders),{t:r}=Z(),o=c=>{e(nf(c))},s=()=>{e(U1())};return n?l.jsx(ut,{label:r("parameters.steps"),min:1,step:1,onChange:o,handleReset:()=>e(nf(20)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:9999}}):l.jsx(Lr,{label:r("parameters.steps"),min:1,max:9999,step:1,onChange:o,value:t,numberInputFieldProps:{textAlign:"center"},onBlur:s})}function S0(){const e=O(s=>s.generation.width),t=O(s=>s.ui.shouldUseSliders),n=O(Bt),{t:r}=Z(),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(Wl(s)),handleReset:()=>o(Wl(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(Wl(Number(s.target.value))),validValues:hC})}function jp(){return O(t=>t.ui.shouldUseSliders)?l.jsxs(Le,{gap:2,children:[l.jsx(x0,{}),l.jsx(b0,{}),l.jsx(v0,{}),l.jsx(S0,{}),l.jsx(g0,{}),l.jsx(y0,{})]}):l.jsxs(B,{rowGap:2,flexDirection:"column",children:[l.jsxs(B,{columnGap:1,children:[l.jsx(x0,{}),l.jsx(b0,{}),l.jsx(v0,{})]}),l.jsxs(B,{columnGap:1,children:[l.jsx(S0,{}),l.jsx(g0,{}),l.jsx(y0,{})]})]})}const MI=be(Pt,e=>e.shouldDisplayGuides),TI=({children:e,feature:t})=>{const n=O(MI),{text:r}=bI(t);return n?l.jsxs(Gh,{trigger:"hover",children:[l.jsx($h,{children:l.jsx(We,{children:e})}),l.jsxs(Yh,{maxWidth:"400px",onClick:o=>o.preventDefault(),cursor:"initial",children:[l.jsx(qh,{}),l.jsx(Kx,{children:r})]})]}):null},_I=he(({feature:e,icon:t=f9},n)=>l.jsx(TI,{feature:e,children:l.jsx(We,{ref:n,children:l.jsx(Jt,{marginBottom:"-.15rem",as:t})})}));function DI(e){const{header:t,feature:n,content:r,additionalHeaderComponents:o}=e;return l.jsxs(Ni,{children:[l.jsx(zi,{children:l.jsxs(B,{width:"100%",gap:2,align:"center",children:[l.jsx(We,{flexGrow:1,textAlign:"start",children:t}),o,n&&l.jsx(_I,{feature:n}),l.jsx(Ri,{})]})}),l.jsx(Li,{children:r})]})}const Ep=e=>{const{accordionInfo:t}=e,n=O(c=>c.system.openAccordions),r=Y(),o=c=>r(pC(c)),s=()=>{const c=[];return t&&Object.keys(t).forEach(u=>{const{header:f,feature:h,content:p,additionalHeaderComponents:g}=t[u];c.push(l.jsx(DI,{header:f,feature:h,content:p,additionalHeaderComponents:g},u))}),c};return l.jsx(sh,{defaultIndex:n,allowMultiple:!0,reduceMotion:!0,onChange:o,children:s()})},OI=be(np,({shouldLoopback:e})=>e),AI=()=>{const e=Y(),t=O(OI),{t:n}=Z();return l.jsx(le,{"aria-label":n("parameters.toggleLoopback"),tooltip:n("parameters.toggleLoopback"),isChecked:t,icon:l.jsx($8,{}),onClick:()=>{e(mC(!t))}})},Pp=()=>{const e=O(Bt);return l.jsxs(B,{gap:2,children:[l.jsx(gp,{}),e==="img2img"&&l.jsx(AI,{}),l.jsx(mp,{})]})},Ip=()=>{const e=O(r=>r.generation.negativePrompt),t=Y(),{t:n}=Z();return l.jsx(rt,{children:l.jsx(Xh,{id:"negativePrompt",name:"negativePrompt",value:e,onChange:r=>t(O1(r.target.value)),placeholder:n("parameters.negativePrompts"),_focusVisible:{borderColor:"error.600"},fontSize:"sm"})})},zI=be([e=>e.generation,Bt],(e,t)=>({prompt:e.prompt,activeTabName:t}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Mp=()=>{const e=Y(),{prompt:t,activeTabName:n}=O(zI),{isReady:r}=O(s4),o=x.useRef(null),{t:s}=Z(),c=f=>{e(D1(f.target.value))};fe("alt+a",()=>{var f;(f=o.current)==null||f.focus()},[]);const u=f=>{f.key==="Enter"&&f.shiftKey===!1&&r&&(f.preventDefault(),e(af(n)))};return l.jsx(We,{children:l.jsx(rt,{isInvalid:t.length===0||Boolean(t.match(/^[\s\r\n]+$/)),children:l.jsx(Xh,{id:"prompt",name:"prompt",placeholder:s("parameters.promptPlaceholder"),value:t,onChange:c,onKeyDown:u,resize:"vertical",ref:o,minH:40})})})},RI=""+new URL("logo-13003d72.png",import.meta.url).href,f4=()=>{const e=O(t=>t.system.app_version);return l.jsxs(B,{alignItems:"center",gap:3,ps:1,children:[l.jsx(ds,{src:RI,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})]})};const NI=be(oi,e=>{const{shouldShowParametersPanel:t,shouldHoldParametersPanelOpen:n,shouldPinParametersPanel:r,parametersPanelScrollPosition:o}=e;return{shouldShowParametersPanel:t,shouldHoldParametersPanelOpen:n,shouldPinParametersPanel:r,parametersPanelScrollPosition:o}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Tp=e=>{const t=Y(),{direction:n}=ei(),{shouldShowParametersPanel:r,shouldHoldParametersPanelOpen:o,shouldPinParametersPanel:s}=O(NI),c=x.useRef(null),u=x.useRef(null),f=x.useRef(null),{children:h}=e,{t:p}=Z();fe("o",()=>{t(Wo(!r)),s&&setTimeout(()=>t(on(!0)),400)},[r,s]),fe("esc",()=>{t(Wo(!1))},{enabled:()=>!s,preventDefault:!0},[s]),fe("shift+o",()=>{C(),t(on(!0))},[s]);const g=x.useCallback(()=>{s||(t(vC(u.current?u.current.scrollTop:0)),t(Wo(!1)),t(gC(!1)))},[t,s]),y=()=>{f.current=window.setTimeout(()=>g(),500)},S=()=>{f.current&&window.clearTimeout(f.current)},C=()=>{t(xC(!s)),t(on(!0))};return x.useEffect(()=>{function w(k){c.current&&!c.current.contains(k.target)&&g()}return document.addEventListener("mousedown",w),()=>{document.removeEventListener("mousedown",w)}},[g]),l.jsx(Wy,{nodeRef:c,in:r||o&&!s,unmountOnExit:!0,timeout:200,classNames:`${n}-parameters-panel-transition`,children:l.jsx(We,{className:`${n}-parameters-panel-transition`,tabIndex:1,ref:c,onMouseEnter:s?void 0:S,onMouseOver:s?void 0:S,sx:{borderInlineEndWidth:s?0:5,borderInlineEndStyle:"solid",bg:"base.900",borderColor:"base.700",height:A9,width:Al,maxWidth:Al,flexShrink:0,position:"relative",overflowY:"scroll",overflowX:"hidden",...h2,...!s&&{zIndex:20,position:"fixed",top:0,insetInlineStart:0,width:`calc(${Al} + 2rem)`,maxWidth:`calc(${Al} + 2rem)`,height:"100%"}},children:l.jsx(We,{sx:{margin:!s&&4},children:l.jsxs(B,{ref:u,onMouseLeave:w=>{w.target!==u.current?S():!s&&y()},sx:{display:"flex",flexDirection:"column",rowGap:2,height:"100%"},children:[l.jsx(Yt,{label:p("common.pinOptionsPanel"),children:l.jsx(We,{onClick:C,sx:{position:"absolute",cursor:"pointer",padding:2,top:4,insetInlineEnd:4,zIndex:20,...s&&{top:0,insetInlineEnd:0}},children:l.jsx(Jt,{sx:{opacity:.2},as:s?Fy:Ly})})}),!s&&l.jsx(We,{sx:{pt:dp,pb:2},children:l.jsx(f4,{})}),h]})})})})};function FI(){const e=Y(),t=O(o=>o.generation.shouldFitToWidthHeight),n=o=>e(W1(o.target.checked)),{t:r}=Z();return l.jsx(En,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function h4(e){const{t}=Z(),{label:n=`${t("parameters.strength")}`}=e,r=O(u=>u.generation.img2imgStrength),o=Y(),s=u=>o(of(u)),c=()=>{o(of(.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 LI(){const{t:e}=Z();return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(h4,{label:e("parameters.img2imgStrength")}),l.jsx(FI,{})]})}function BI(){const{t:e}=Z(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(jp,{})},imageToImage:{header:`${e("parameters.imageToImage")}`,feature:void 0,content:l.jsx(LI,{})},seed:{header:`${e("parameters.seed")}`,feature:dn.SEED,content:l.jsx(Cp,{})},variations:{header:`${e("parameters.variations")}`,feature:dn.VARIATIONS,content:l.jsx(kp,{}),additionalHeaderComponents:l.jsx(wp,{})},face_restore:{header:`${e("parameters.faceRestoration")}`,feature:dn.FACE_CORRECTION,content:l.jsx(ep,{}),additionalHeaderComponents:l.jsx(c4,{})},upscale:{header:`${e("parameters.upscaling")}`,feature:dn.UPSCALE,content:l.jsx(tp,{}),additionalHeaderComponents:l.jsx(d4,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(bp,{}),additionalHeaderComponents:l.jsx(Sp,{})},other:{header:`${e("parameters.otherOptions")}`,feature:dn.OTHER,content:l.jsx(SI,{})}};return l.jsxs(Tp,{children:[l.jsxs(B,{flexDir:"column",rowGap:2,children:[l.jsx(Mp,{}),l.jsx(Ip,{})]}),l.jsx(Pp,{}),l.jsx(Ep,{accordionInfo:t})]})}function HI(){return l.jsx(yp,{optionsPanel:l.jsx(BI,{}),children:l.jsx(xI,{})})}const WI=()=>l.jsx(We,{sx:{width:"100%",height:"100%",borderRadius:"base",bg:"base.850"},children:l.jsx(B,{sx:{p:4,width:"100%",height:"100%"},children:l.jsx(l4,{})})}),VI=be([np],({hiresFix:e,hiresStrength:t})=>({hiresFix:e,hiresStrength:t}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),UI=()=>{const{hiresFix:e,hiresStrength:t}=O(VI),n=Y(),{t:r}=Z(),o=c=>{n(Wv(c))},s=()=>{n(Wv(.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})},$I=()=>{const e=Y(),t=O(o=>o.postprocessing.hiresFix),{t:n}=Z(),r=o=>e(H1(o.target.checked));return l.jsx(En,{label:n("parameters.hiresOptim"),fontSize:"md",isChecked:t,onChange:r})},GI=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(u4,{}),l.jsx($I,{}),l.jsx(UI,{})]});function qI(){const{t:e}=Z(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(jp,{})},seed:{header:`${e("parameters.seed")}`,feature:dn.SEED,content:l.jsx(Cp,{})},variations:{header:`${e("parameters.variations")}`,feature:dn.VARIATIONS,content:l.jsx(kp,{}),additionalHeaderComponents:l.jsx(wp,{})},face_restore:{header:`${e("parameters.faceRestoration")}`,feature:dn.FACE_CORRECTION,content:l.jsx(ep,{}),additionalHeaderComponents:l.jsx(c4,{})},upscale:{header:`${e("parameters.upscaling")}`,feature:dn.UPSCALE,content:l.jsx(tp,{}),additionalHeaderComponents:l.jsx(d4,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(bp,{}),additionalHeaderComponents:l.jsx(Sp,{})},other:{header:`${e("parameters.otherOptions")}`,feature:dn.OTHER,content:l.jsx(GI,{})}};return l.jsxs(Tp,{children:[l.jsxs(B,{flexDir:"column",rowGap:2,children:[l.jsx(Mp,{}),l.jsx(Ip,{})]}),l.jsx(Pp,{}),l.jsx(Ep,{accordionInfo:t})]})}function YI(){return l.jsx(yp,{optionsPanel:l.jsx(qI,{}),children:l.jsx(WI,{})})}var Af={},XI={get exports(){return Af},set exports(e){Af=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 KI=function(t){var n={},r=x,o=Ul,s=Object.assign;function c(i){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+i,d=1;dA||v[E]!==b[A]){var W=` `+v[E].replace(" at new "," at ");return i.displayName&&W.includes("")&&(W=W.replace("",i.displayName)),W}while(1<=E&&0<=A);break}}}finally{eu=!1,Error.prepareStackTrace=d}return(i=i?i.displayName||i.name:"")?ha(i):""}var Wb=Object.prototype.hasOwnProperty,nu=[],di=-1;function Gr(i){return{current:i}}function bt(i){0>di||(i.current=nu[di],nu[di]=null,di--)}function gt(i,a){di++,nu[di]=i.current,i.current=a}var qr={},an=Gr(qr),gn=Gr(!1),Co=qr;function fi(i,a){var d=i.type.contextTypes;if(!d)return qr;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 js(){bt(gn),bt(an)}function Zp(i,a,d){if(an.current!==qr)throw Error(c(168));gt(an,a),gt(gn,d)}function Jp(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,z(i)||"Unknown",v));return s({},d,m)}function Es(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||qr,Co=an.current,gt(an,i),gt(gn,gn.current),!0}function em(i,a,d){var m=i.stateNode;if(!m)throw Error(c(169));d?(i=Jp(i,a,Co),m.__reactInternalMemoizedMergedChildContext=i,bt(gn),bt(an),gt(an,i)):bt(gn),gt(gn,d)}var Xn=Math.clz32?Math.clz32:$b,Vb=Math.log,Ub=Math.LN2;function $b(i){return i>>>=0,i===0?32:31-(Vb(i)/Ub|0)|0}var Ps=64,Is=4194304;function pa(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 Ms(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 A=E&~v;A!==0?m=pa(A):(b&=E,b!==0&&(m=pa(b)))}else E=d&~v,E!==0?m=pa(E):b!==0&&(m=pa(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 ma(i,a,d){i.pendingLanes|=a,a!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,a=31-Xn(a),i[a]=d}function Yb(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,Er=1<<32-Xn(a)+v|d<it?(Zt=$e,$e=null):Zt=$e.sibling;var at=ye(H,$e,G[it],Se);if(at===null){$e===null&&($e=Zt);break}i&&$e&&at.alternate===null&&a(H,$e),R=b(at,R,it),Xe===null?Oe=at:Xe.sibling=at,Xe=at,$e=Zt}if(it===G.length)return d(H,$e),It&&ko(H,it),Oe;if($e===null){for(;itit?(Zt=$e,$e=null):Zt=$e.sibling;var to=ye(H,$e,at.value,Se);if(to===null){$e===null&&($e=Zt);break}i&&$e&&to.alternate===null&&a(H,$e),R=b(to,R,it),Xe===null?Oe=to:Xe.sibling=to,Xe=to,$e=Zt}if(at.done)return d(H,$e),It&&ko(H,it),Oe;if($e===null){for(;!at.done;it++,at=G.next())at=Ue(H,at.value,Se),at!==null&&(R=b(at,R,it),Xe===null?Oe=at:Xe.sibling=at,Xe=at);return It&&ko(H,it),Oe}for($e=m(H,$e);!at.done;it++,at=G.next())at=St($e,H,it,at.value,Se),at!==null&&(i&&at.alternate!==null&&$e.delete(at.key===null?it:at.key),R=b(at,R,it),Xe===null?Oe=at:Xe.sibling=at,Xe=at);return i&&$e.forEach(function(OS){return a(H,OS)}),It&&ko(H,it),Oe}function _r(H,R,G,Se){if(typeof G=="object"&&G!==null&&G.type===p&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case f:e:{for(var Oe=G.key,Xe=R;Xe!==null;){if(Xe.key===Oe){if(Oe=G.type,Oe===p){if(Xe.tag===7){d(H,Xe.sibling),R=v(Xe,G.props.children),R.return=H,H=R;break e}}else if(Xe.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===P&&ym(Oe)===Xe.type){d(H,Xe.sibling),R=v(Xe,G.props),R.ref=ga(H,Xe,G),R.return=H,H=R;break e}d(H,Xe);break}else a(H,Xe);Xe=Xe.sibling}G.type===p?(R=_o(G.props.children,H.mode,Se,G.key),R.return=H,H=R):(Se=hl(G.type,G.key,G.props,null,H.mode,Se),Se.ref=ga(H,R,G),Se.return=H,H=Se)}return E(H);case h:e:{for(Xe=G.key;R!==null;){if(R.key===Xe)if(R.tag===4&&R.stateNode.containerInfo===G.containerInfo&&R.stateNode.implementation===G.implementation){d(H,R.sibling),R=v(R,G.children||[]),R.return=H,H=R;break e}else{d(H,R);break}else a(H,R);R=R.sibling}R=ud(G,H.mode,Se),R.return=H,H=R}return E(H);case P:return Xe=G._init,_r(H,R,Xe(G._payload),Se)}if(re(G))return ft(H,R,G,Se);if(D(G))return Cn(H,R,G,Se);Hs(H,G)}return typeof G=="string"&&G!==""||typeof G=="number"?(G=""+G,R!==null&&R.tag===6?(d(H,R.sibling),R=v(R,G),R.return=H,H=R):(d(H,R),R=cd(G,H.mode,Se),R.return=H,H=R),E(H)):d(H,R)}return _r}var xi=bm(!0),Sm=bm(!1),xa={},Rn=Gr(xa),ya=Gr(xa),yi=Gr(xa);function lr(i){if(i===xa)throw Error(c(174));return i}function wu(i,a){gt(yi,a),gt(ya,i),gt(Rn,xa),i=U(a),bt(Rn),gt(Rn,i)}function bi(){bt(Rn),bt(ya),bt(yi)}function Cm(i){var a=lr(yi.current),d=lr(Rn.current);a=K(d,i.type,a),d!==a&&(gt(ya,i),gt(Rn,a))}function ku(i){ya.current===i&&(bt(Rn),bt(ya))}var _t=Gr(0);function Ws(i){for(var a=i;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Qp(d)||Zc(d)))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if(a.flags&128)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var ju=[];function Eu(){for(var i=0;id?d:4,i(!0);var m=Pu.transition;Pu.transition={};try{i(!1),a()}finally{ot=d,Pu.transition=m}}function Bm(){return Nn().memoizedState}function aS(i,a,d){var m=Zr(i);if(d={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null},Hm(i))Wm(a,d);else if(d=dm(i,a,d,m),d!==null){var v=un();Fn(d,i,m,v),Vm(d,a,m)}}function sS(i,a,d){var m=Zr(i),v={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null};if(Hm(i))Wm(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,A=b(E,d);if(v.hasEagerState=!0,v.eagerState=A,Kn(A,E)){var W=a.interleaved;W===null?(v.next=v,yu(a)):(v.next=W.next,W.next=v),a.interleaved=v;return}}catch{}finally{}d=dm(i,a,v,m),d!==null&&(v=un(),Fn(d,i,m,v),Vm(d,a,m))}}function Hm(i){var a=i.alternate;return i===Dt||a!==null&&a===Dt}function Wm(i,a){ba=Us=!0;var d=i.pending;d===null?a.next=a:(a.next=d.next,d.next=a),i.pending=a}function Vm(i,a,d){if(d&4194240){var m=a.lanes;m&=i.pendingLanes,d|=m,a.lanes=d,iu(i,d)}}var qs={readContext:zn,useCallback:sn,useContext:sn,useEffect:sn,useImperativeHandle:sn,useInsertionEffect:sn,useLayoutEffect:sn,useMemo:sn,useReducer:sn,useRef:sn,useState:sn,useDebugValue:sn,useDeferredValue:sn,useTransition:sn,useMutableSource:sn,useSyncExternalStore:sn,useId:sn,unstable_isNewReconciler:!1},lS={readContext:zn,useCallback:function(i,a){return cr().memoizedState=[i,a===void 0?null:a],i},useContext:zn,useEffect:Dm,useImperativeHandle:function(i,a,d){return d=d!=null?d.concat([i]):null,$s(4194308,4,zm.bind(null,a,i),d)},useLayoutEffect:function(i,a){return $s(4194308,4,i,a)},useInsertionEffect:function(i,a){return $s(4,2,i,a)},useMemo:function(i,a){var d=cr();return a=a===void 0?null:a,i=i(),d.memoizedState=[i,a],i},useReducer:function(i,a,d){var m=cr();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=aS.bind(null,Dt,i),[m.memoizedState,i]},useRef:function(i){var a=cr();return i={current:i},a.memoizedState=i},useState:Tm,useDebugValue:Au,useDeferredValue:function(i){return cr().memoizedState=i},useTransition:function(){var i=Tm(!1),a=i[0];return i=iS.bind(null,i[1]),cr().memoizedState=i,[a,i]},useMutableSource:function(){},useSyncExternalStore:function(i,a,d){var m=Dt,v=cr();if(It){if(d===void 0)throw Error(c(407));d=d()}else{if(d=a(),Qt===null)throw Error(c(349));Eo&30||jm(m,a,d)}v.memoizedState=d;var b={value:d,getSnapshot:a};return v.queue=b,Dm(Pm.bind(null,m,b,i),[i]),m.flags|=2048,wa(9,Em.bind(null,m,b,d,a),void 0,null),d},useId:function(){var i=cr(),a=Qt.identifierPrefix;if(It){var d=Pr,m=Er;d=(m&~(1<<32-Xn(m)-1)).toString(32)+d,a=":"+a+"R"+d,d=Sa++,0td&&(a.flags|=128,m=!0,Ea(v,!1),a.lanes=4194304)}else{if(!m)if(i=Ws(b),i!==null){if(a.flags|=128,m=!0,i=i.updateQueue,i!==null&&(a.updateQueue=i,a.flags|=4),Ea(v,!0),v.tail===null&&v.tailMode==="hidden"&&!b.alternate&&!It)return ln(a),null}else 2*Xt()-v.renderingStartTime>td&&d!==1073741824&&(a.flags|=128,m=!0,Ea(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=Xt(),a.sibling=null,i=_t.current,gt(_t,m?i&1|2:i&1),a):(ln(a),null);case 22:case 23:return ad(),d=a.memoizedState!==null,i!==null&&i.memoizedState!==null!==d&&(a.flags|=8192),d&&a.mode&1?_n&1073741824&&(ln(a),ve&&a.subtreeFlags&6&&(a.flags|=8192)):ln(a),null;case 24:return null;case 25:return null}throw Error(c(156,a.tag))}function vS(i,a){switch(du(a),a.tag){case 1:return xn(a.type)&&js(),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return bi(),bt(gn),bt(an),Eu(),i=a.flags,i&65536&&!(i&128)?(a.flags=i&-65537|128,a):null;case 5:return ku(a),null;case 13:if(bt(_t),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(c(340));mi()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return bt(_t),null;case 4:return bi(),null;case 10:return gu(a.type._context),null;case 22:case 23:return ad(),null;case 24:return null;default:return null}}var Zs=!1,cn=!1,gS=typeof WeakSet=="function"?WeakSet:Set,we=null;function Ci(i,a){var d=i.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(m){Mt(i,a,m)}else d.current=null}function Vu(i,a,d){try{d()}catch(m){Mt(i,a,m)}}var lv=!1;function xS(i,a){for(ne(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:Zn(i.type,m),v);b.__reactInternalSnapshotBeforeUpdate=E}break;case 3:ve&&So(i.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(c(163))}}catch(A){Mt(i,i.return,A)}if(a=i.sibling,a!==null){a.return=i.return,we=a;break}we=i.return}return d=lv,lv=!1,d}function Pa(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&&Vu(a,d,b)}v=v.next}while(v!==m)}}function Js(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 Uu(i){var a=i.ref;if(a!==null){var d=i.stateNode;switch(i.tag){case 5:i=ie(d);break;default:i=d}typeof a=="function"?a(i):a.current=i}}function cv(i){var a=i.alternate;a!==null&&(i.alternate=null,cv(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&Ve(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 uv(i){return i.tag===5||i.tag===3||i.tag===4}function dv(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||uv(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function $u(i,a,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,a?hn(d,i,a):He(d,i);else if(m!==4&&(i=i.child,i!==null))for($u(i,a,d),i=i.sibling;i!==null;)$u(i,a,d),i=i.sibling}function Gu(i,a,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,a?De(d,i,a):ee(d,i);else if(m!==4&&(i=i.child,i!==null))for(Gu(i,a,d),i=i.sibling;i!==null;)Gu(i,a,d),i=i.sibling}var tn=null,Jn=!1;function dr(i,a,d){for(d=d.child;d!==null;)qu(i,a,d),d=d.sibling}function qu(i,a,d){if(ir&&typeof ir.onCommitFiberUnmount=="function")try{ir.onCommitFiberUnmount(Ts,d)}catch{}switch(d.tag){case 5:cn||Ci(d,a);case 6:if(ve){var m=tn,v=Jn;tn=null,dr(i,a,d),tn=m,Jn=v,tn!==null&&(Jn?pn(tn,d.stateNode):$t(tn,d.stateNode))}else dr(i,a,d);break;case 18:ve&&tn!==null&&(Jn?Fb(tn,d.stateNode):Nb(tn,d.stateNode));break;case 4:ve?(m=tn,v=Jn,tn=d.stateNode.containerInfo,Jn=!0,dr(i,a,d),tn=m,Jn=v):(_e&&(m=d.stateNode.containerInfo,v=qp(m),Qc(m,v)),dr(i,a,d));break;case 0:case 11:case 14:case 15:if(!cn&&(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)&&Vu(d,a,E),v=v.next}while(v!==m)}dr(i,a,d);break;case 1:if(!cn&&(Ci(d,a),m=d.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=d.memoizedProps,m.state=d.memoizedState,m.componentWillUnmount()}catch(A){Mt(d,a,A)}dr(i,a,d);break;case 21:dr(i,a,d);break;case 22:d.mode&1?(cn=(m=cn)||d.memoizedState!==null,dr(i,a,d),cn=m):dr(i,a,d);break;default:dr(i,a,d)}}function fv(i){var a=i.updateQueue;if(a!==null){i.updateQueue=null;var d=i.stateNode;d===null&&(d=i.stateNode=new gS),a.forEach(function(m){var v=PS.bind(null,i,m);d.has(m)||(d.add(m),m.then(v,v))})}}function er(i,a){var d=a.deletions;if(d!==null)for(var m=0;m";case tl:return":has("+(Ku(i)||"")+")";case nl:return'[role="'+i.value+'"]';case ol:return'"'+i.value+'"';case rl:return'[data-testname="'+i.value+'"]';default:throw Error(c(365))}}function xv(i,a){var d=[];i=[i,0];for(var m=0;mv&&(v=E),m&=~b}if(m=v,m=Xt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*bS(m/1960))-m,10i?16:i,Qr===null)var m=!1;else{if(i=Qr,Qr=null,cl=0,Ke&6)throw Error(c(331));var v=Ke;for(Ke|=4,we=i.current;we!==null;){var b=we,E=b.child;if(we.flags&16){var A=b.deletions;if(A!==null){for(var W=0;WXt()-ed?Io(i,0):Ju|=d),Sn(i,a)}function Pv(i,a){a===0&&(i.mode&1?(a=Is,Is<<=1,!(Is&130023424)&&(Is=4194304)):a=1);var d=un();i=sr(i,a),i!==null&&(ma(i,a,d),Sn(i,d))}function ES(i){var a=i.memoizedState,d=0;a!==null&&(d=a.retryLane),Pv(i,d)}function PS(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),Pv(i,d)}var Iv;Iv=function(i,a,d){if(i!==null)if(i.memoizedProps!==a.pendingProps||gn.current)yn=!0;else{if(!(i.lanes&d)&&!(a.flags&128))return yn=!1,pS(i,a,d);yn=!!(i.flags&131072)}else yn=!1,It&&a.flags&1048576&&im(a,Os,a.index);switch(a.lanes=0,a.tag){case 2:var m=a.type;Xs(i,a),i=a.pendingProps;var v=fi(a,an.current);gi(a,d),v=Mu(null,a,m,i,v,d);var b=Tu();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,Es(a)):b=!1,a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,bu(a),v.updater=Bs,a.stateNode=v,v._reactInternals=a,Cu(a,m,i,d),a=Fu(null,a,m,!0,b,d)):(a.tag=0,It&&b&&uu(a),mn(null,a,v,d),a=a.child),a;case 16:m=a.elementType;e:{switch(Xs(i,a),i=a.pendingProps,v=m._init,m=v(m._payload),a.type=m,v=a.tag=MS(m),i=Zn(m,i),v){case 0:a=Nu(null,a,m,i,d);break e;case 1:a=ev(null,a,m,i,d);break e;case 11:a=Xm(null,a,m,i,d);break e;case 14:a=Km(null,a,m,Zn(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:Zn(m,v),Nu(i,a,m,v,d);case 1:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),ev(i,a,m,v,d);case 3:e:{if(tv(a),i===null)throw Error(c(387));m=a.pendingProps,b=a.memoizedState,v=b.element,fm(i,a),Ls(a,m,null,d);var E=a.memoizedState;if(m=E.element,qe&&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=Si(Error(c(423)),a),a=nv(i,a,m,d,v);break e}else if(m!==v){v=Si(Error(c(424)),a),a=nv(i,a,m,d,v);break e}else for(qe&&(An=Mb(a.stateNode.containerInfo),Tn=a,It=!0,Qn=null,va=!1),d=Sm(a,null,m,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(mi(),m===v){a=Mr(i,a,d);break e}mn(i,a,m,d)}a=a.child}return a;case 5:return Cm(a),i===null&&hu(a),m=a.type,v=a.pendingProps,b=i!==null?i.memoizedProps:null,E=v.children,ue(m,v)?E=null:b!==null&&ue(m,b)&&(a.flags|=32),Jm(i,a),mn(i,a,E,d),a.child;case 6:return i===null&&hu(a),null;case 13:return rv(i,a,d);case 4:return wu(a,a.stateNode.containerInfo),m=a.pendingProps,i===null?a.child=xi(a,null,m,d):mn(i,a,m,d),a.child;case 11:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),Xm(i,a,m,v,d);case 7:return mn(i,a,a.pendingProps,d),a.child;case 8:return mn(i,a,a.pendingProps.children,d),a.child;case 12:return mn(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,um(a,m,E),b!==null)if(Kn(b.value,E)){if(b.children===v.children&&!gn.current){a=Mr(i,a,d);break e}}else for(b=a.child,b!==null&&(b.return=a);b!==null;){var A=b.dependencies;if(A!==null){E=b.child;for(var W=A.firstContext;W!==null;){if(W.context===m){if(b.tag===1){W=Ir(-1,d&-d),W.tag=2;var ae=b.updateQueue;if(ae!==null){ae=ae.shared;var Ee=ae.pending;Ee===null?W.next=W:(W.next=Ee.next,Ee.next=W),ae.pending=W}}b.lanes|=d,W=b.alternate,W!==null&&(W.lanes|=d),xu(b.return,d,a),A.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,A=E.alternate,A!==null&&(A.lanes|=d),xu(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}mn(i,a,v.children,d),a=a.child}return a;case 9:return v=a.type,m=a.pendingProps.children,gi(a,d),v=zn(v),m=m(v),a.flags|=1,mn(i,a,m,d),a.child;case 14:return m=a.type,v=Zn(m,a.pendingProps),v=Zn(m.type,v),Km(i,a,m,v,d);case 15:return Qm(i,a,a.type,a.pendingProps,d);case 17:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),Xs(i,a),a.tag=1,xn(m)?(i=!0,Es(a)):i=!1,gi(a,d),gm(a,m,v),Cu(a,m,v,d),Fu(null,a,m,!0,i,d);case 19:return iv(i,a,d);case 22:return Zm(i,a,d)}throw Error(c(156,a.tag))};function Mv(i,a){return au(i,a)}function IS(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 IS(i,a,d,m)}function ld(i){return i=i.prototype,!(!i||!i.isReactComponent)}function MS(i){if(typeof i=="function")return ld(i)?1:0;if(i!=null){if(i=i.$$typeof,i===w)return 11;if(i===M)return 14}return 2}function eo(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 hl(i,a,d,m,v,b){var E=2;if(m=i,typeof i=="function")ld(i)&&(E=1);else if(typeof i=="string")E=5;else e:switch(i){case p:return _o(d.children,v,b,a);case g:E=8,v|=8;break;case y:return i=Ln(12,d,a,v|2),i.elementType=y,i.lanes=b,i;case k:return i=Ln(13,d,a,v),i.elementType=k,i.lanes=b,i;case j:return i=Ln(19,d,a,v),i.elementType=j,i.lanes=b,i;case I:return pl(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 w:E=11;break e;case M: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 _o(i,a,d,m){return i=Ln(7,i,m,a),i.lanes=d,i}function pl(i,a,d,m){return i=Ln(22,i,m,a),i.elementType=I,i.lanes=d,i.stateNode={isHidden:!1},i}function cd(i,a,d){return i=Ln(6,i,null,a),i.lanes=d,i}function ud(i,a,d){return a=Ln(4,i.children!==null?i.children:[],i.key,a),a.lanes=d,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}function TS(i,a,d,m,v){this.tag=a,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Ge,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ou(0),this.expirationTimes=ou(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ou(0),this.identifierPrefix=m,this.onRecoverableError=v,qe&&(this.mutableSourceEagerHydrationData=null)}function Tv(i,a,d,m,v,b,E,A,W){return i=new TS(i,a,d,A,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},bu(b),i}function _v(i){if(!i)return qr;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 Jp(i,d,a)}return a}function Dv(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=X(a),i===null?null:i.stateNode}function Ov(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var d=i.retryLane;i.retryLane=d!==0&&d=ae&&b>=Ue&&v<=Ee&&E<=ye){i.splice(a,1);break}else if(m!==ae||d.width!==W.width||yeE){if(!(b!==Ue||d.height!==W.height||Eev)){ae>m&&(W.width+=ae-m,W.x=m),Eeb&&(W.height+=Ue-b,W.y=b),yed&&(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 ie(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:_S,findFiberByHostInstance:i.findFiberByHostInstance||DS,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{Ts=a.inject(i),ir=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=Qu(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=un(),E=Zr(v);return d=_v(d),a.context===null?a.context=d:a.pendingContext=d,a=Ir(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),Fs(i,v,E)),E},n};(function(e){e.exports=KI})(XI);const QI=yC(Af);var fc={},ZI={get exports(){return fc},set exports(e){fc=e}},ai={};/** * @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. */ai.ConcurrentRoot=1;ai.ContinuousEventPriority=4;ai.DefaultEventPriority=16;ai.DiscreteEventPriority=1;ai.IdleEventPriority=536870912;ai.LegacyRoot=0;(function(e){e.exports=ai})(ZI);const C0={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let w0=!1,k0=!1;const _p=".react-konva-event",JI=`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 `,eM=`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 `,tM={};function Hc(e,t,n=tM){if(!w0&&"zIndex"in t&&(console.warn(eM),w0=!0),!k0&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(JI),k0=!0)}for(var s in n)if(!C0[s]){var c=s.slice(0,2)==="on",u=n[s]!==t[s];if(c&&u){var f=s.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),e.off(f,n[s])}var h=!t.hasOwnProperty(s);h&&e.setAttr(s,void 0)}var p=t._useStrictMode,g={},y=!1;const S={};for(var s in t)if(!C0[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]||p&&t[s]!==e.getAttr(s))&&(y=!0,g[s]=t[s])}y&&(e.setAttrs(g),xo(e));for(var f in S)e.on(f+_p,S[f])}function xo(e){if(!bC.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const p4={},nM={};qa.Node.prototype._applyProps=Hc;function rM(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),xo(e)}function oM(e,t,n){let r=qa[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=qa.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 iM(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function aM(e,t,n){return!1}function sM(e){return e}function lM(){return null}function cM(){return null}function uM(e,t,n,r){return nM}function dM(){}function fM(e){}function hM(e,t){return!1}function pM(){return p4}function mM(){return p4}const vM=setTimeout,gM=clearTimeout,xM=-1;function yM(e,t){return!1}const bM=!1,SM=!0,CM=!0;function wM(e,t){t.parent===e?t.moveToTop():e.add(t),xo(e)}function kM(e,t){t.parent===e?t.moveToTop():e.add(t),xo(e)}function m4(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),xo(e)}function jM(e,t,n){m4(e,t,n)}function EM(e,t){t.destroy(),t.off(_p),xo(e)}function PM(e,t){t.destroy(),t.off(_p),xo(e)}function IM(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function MM(e,t,n){}function TM(e,t,n,r,o){Hc(e,o,r)}function _M(e){e.hide(),xo(e)}function DM(e){}function OM(e,t){(t.visible==null||t.visible)&&e.show()}function AM(e,t){}function zM(e){}function RM(){}const NM=()=>fc.DefaultEventPriority,FM=Object.freeze(Object.defineProperty({__proto__:null,appendChild:wM,appendChildToContainer:kM,appendInitialChild:rM,cancelTimeout:gM,clearContainer:zM,commitMount:MM,commitTextUpdate:IM,commitUpdate:TM,createInstance:oM,createTextInstance:iM,detachDeletedInstance:RM,finalizeInitialChildren:aM,getChildHostContext:mM,getCurrentEventPriority:NM,getPublicInstance:sM,getRootHostContext:pM,hideInstance:_M,hideTextInstance:DM,idlePriority:Ul.unstable_IdlePriority,insertBefore:m4,insertInContainerBefore:jM,isPrimaryRenderer:bM,noTimeout:xM,now:Ul.unstable_now,prepareForCommit:lM,preparePortalMount:cM,prepareUpdate:uM,removeChild:EM,removeChildFromContainer:PM,resetAfterCommit:dM,resetTextContent:fM,run:Ul.unstable_runWithPriority,scheduleTimeout:vM,shouldDeprioritizeSubtree:hM,shouldSetTextContent:yM,supportsMutation:CM,unhideInstance:OM,unhideTextInstance:AM,warnsIfNotActing:SM},Symbol.toStringTag,{value:"Module"}));var LM=Object.defineProperty,BM=Object.defineProperties,HM=Object.getOwnPropertyDescriptors,j0=Object.getOwnPropertySymbols,WM=Object.prototype.hasOwnProperty,VM=Object.prototype.propertyIsEnumerable,E0=(e,t,n)=>t in e?LM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P0=(e,t)=>{for(var n in t||(t={}))WM.call(t,n)&&E0(e,n,t[n]);if(j0)for(var n of j0(t))VM.call(t,n)&&E0(e,n,t[n]);return e},UM=(e,t)=>BM(e,HM(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 g4(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const Dp=g4(x.createContext(null));class x4 extends x.Component{render(){return x.createElement(Dp.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:$M,ReactCurrentDispatcher:GM}=x.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function qM(){const e=x.useContext(Dp);if(!e)throw new Error("its-fine: useFiber must be called within a !");const t=x.useId();return x.useMemo(()=>{var r;return(r=$M.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 YM(){var e,t;const n=qM(),[r]=x.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==Dp&&!r.has(s)&&r.set(s,(t=GM.current)==null?void 0:t.readContext(g4(s))),o=o.return}return x.useMemo(()=>Array.from(r.keys()).reduce((s,c)=>u=>x.createElement(s,null,x.createElement(c.Provider,UM(P0({},u),{value:r.get(c)}))),s=>x.createElement(x4,P0({},s))),[r])}function XM(e){const t=ke.useRef();return ke.useLayoutEffect(()=>{t.current=e}),t.current}const KM=e=>{const t=ke.useRef(),n=ke.useRef(),r=ke.useRef(),o=XM(e),s=YM(),c=u=>{const{forwardedRef:f}=e;f&&(typeof f=="function"?f(u):f.current=u)};return ke.useLayoutEffect(()=>(n.current=new qa.Stage({width:e.width,height:e.height,container:t.current}),c(n.current),r.current=Ba.createContainer(n.current,fc.LegacyRoot,!1,null),Ba.updateContainer(ke.createElement(s,{},e.children),r.current),()=>{qa.isBrowser&&(c(null),Ba.updateContainer(null,r.current,null),n.current.destroy())}),[]),ke.useLayoutEffect(()=>{c(n.current),Hc(n.current,e,o),Ba.updateContainer(ke.createElement(s,{},e.children),r.current,null)}),ke.createElement("div",{ref:t,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},za="Layer",Br="Group",Hr="Rect",Do="Circle",hc="Line",y4="Image",QM="Transformer",Ba=QI(FM);Ba.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:ke.version,rendererPackageName:"react-konva"});const ZM=ke.forwardRef((e,t)=>ke.createElement(x4,{},ke.createElement(KM,{...e,forwardedRef:t}))),JM=be([tt,zt],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),eT=()=>{const e=Y(),{tool:t,isStaging:n,isMovingBoundingBox:r}=O(JM);return{handleDragStart:x.useCallback(()=>{(t==="move"||n)&&!r&&e(Jl(!0))},[e,r,n,t]),handleDragMove:x.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(q1(s))},[e,r,n,t]),handleDragEnd:x.useCallback(()=>{(t==="move"||n)&&!r&&e(Jl(!1))},[e,r,n,t])}},tT=be([tt,Bt,zt],(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:te.isEqual}}),nT=()=>{const e=Y(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:c}=O(tT),u=x.useRef(null),f=Y1(),h=()=>e(Zf());fe(["shift+c"],()=>{h()},{enabled:()=>!o,preventDefault:!0},[]);const p=()=>e(ss(!s));fe(["h"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[s]),fe(["n"],()=>{e(ec(!c))},{enabled:!0,preventDefault:!0},[c]),fe("esc",()=>{e(SC())},{enabled:()=>!0,preventDefault:!0}),fe("shift+h",()=>{e(CC(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),fe(["space"],g=>{g.repeat||(f==null||f.container().focus(),r!=="move"&&(u.current=r,e(xr("move"))),r==="move"&&u.current&&u.current!=="move"&&(e(xr(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}},b4=()=>{const e=Y(),t=Sr(),n=Y1();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=wC.pixelRatio,[s,c,u,f]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;e(kC({r:s,g:c,b:u,a:f}))},commitColorUnderCursor:()=>{e(jC())}}},rT=be([Bt,tt,zt],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),oT=e=>{const t=Y(),{tool:n,isStaging:r}=O(rT),{commitColorUnderCursor:o}=b4();return x.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Jl(!0));return}if(n==="colorPicker"){o();return}const c=Op(e.current);c&&(s.evt.preventDefault(),t(X1(!0)),t(EC([c.x,c.y])))},[e,n,r,t,o])},iT=be([Bt,tt,zt],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),aT=(e,t,n)=>{const r=Y(),{isDrawing:o,tool:s,isStaging:c}=O(iT),{updateColorUnderCursor:u}=b4();return x.useCallback(()=>{if(!e.current)return;const f=Op(e.current);if(f){if(r(PC(f)),n.current=f,s==="colorPicker"){u();return}!o||s==="move"||c||(t.current=!0,r(K1([f.x,f.y])))}},[t,r,o,c,n,e,s,u])},sT=()=>{const e=Y();return x.useCallback(()=>{e(IC())},[e])},lT=be([Bt,tt,zt],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),cT=(e,t)=>{const n=Y(),{tool:r,isDrawing:o,isStaging:s}=O(lT);return x.useCallback(()=>{if(r==="move"||s){n(Jl(!1));return}if(!t.current&&o&&e.current){const c=Op(e.current);if(!c)return;n(K1([c.x,c.y]))}else t.current=!1;n(X1(!1))},[t,n,o,s,e,r])},uT=be([tt],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),dT=e=>{const t=Y(),{isMoveStageKeyHeld:n,stageScale:r}=O(uT);return x.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=te.clamp(r*MC**u,TC,_C),h={x:s.x-c.x*f,y:s.y-c.y*f};t(DC(f)),t(q1(h))},[e,n,r,t])},fT=be(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:te.isEqual}}),hT=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=O(fT);return l.jsxs(Br,{children:[l.jsx(Hr,{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(Hr,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},pT=be([tt],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),mT={dark:"rgba(255, 255, 255, 0.2)",green:"rgba(255, 255, 255, 0.2)",light:"rgba(0, 0, 0, 0.2)",ocean:"rgba(136, 148, 184, 0.2)"},vT=()=>{const e=O(u=>u.ui.currentTheme),{stageScale:t,stageCoordinates:n,stageDimensions:r}=O(pT),[o,s]=x.useState([]),c=x.useCallback(u=>u/t,[t]);return x.useLayoutEffect(()=>{const u=mT[e],{width:f,height:h}=r,{x:p,y:g}=n,y={x1:0,y1:0,x2:f,y2:h,offset:{x:c(p),y:c(g)}},S={x:Math.ceil(c(p)/64)*64,y:Math.ceil(c(g)/64)*64},C={x1:-S.x,y1:-S.y,x2:c(f)-S.x+64,y2:c(h)-S.y+64},k={x1:Math.min(y.x1,C.x1),y1:Math.min(y.y1,C.y1),x2:Math.max(y.x2,C.x2),y2:Math.max(y.y2,C.y2)},j=k.x2-k.x1,M=k.y2-k.y1,P=Math.round(j/64)+1,I=Math.round(M/64)+1,T=te.range(0,P).map(_=>l.jsx(hc,{x:k.x1+_*64,y:k.y1,points:[0,0,0,M],stroke:u,strokeWidth:1},`x_${_}`)),D=te.range(0,I).map(_=>l.jsx(hc,{x:k.x1,y:k.y1+_*64,points:[0,0,j,0],stroke:u,strokeWidth:1},`y_${_}`));s(T.concat(D))},[t,n,r,e,c]),l.jsx(Br,{children:o})},gT=be([e=>e.gallery],e=>e.intermediateImage?e.intermediateImage:null,{memoizeOptions:{resultEqualityCheck:te.isEqual}}),xT=e=>{const{...t}=e,n=O(gT),[r,o]=x.useState(null);if(x.useEffect(()=>{if(!n)return;const h=new Image;h.onload=()=>{o(h)},h.src=n.url},[n]),!(n!=null&&n.boundingBox))return null;const{boundingBox:{x:s,y:c,width:u,height:f}}=n;return r?l.jsx(y4,{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})`},yT=be(tt,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:Yo(t)}}),I0=e=>`data:image/svg+xml;utf8, `.replaceAll("black",e),bT=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=O(yT),[c,u]=x.useState(null),[f,h]=x.useState(0),p=x.useRef(null),g=x.useCallback(()=>{h(f+1),setTimeout(g,500)},[f]);return x.useEffect(()=>{if(c)return;const y=new Image;y.onload=()=>{u(y)},y.src=I0(n)},[c,n]),x.useEffect(()=>{c&&(c.src=I0(n))},[c,n]),x.useEffect(()=>{const y=setInterval(()=>h(S=>(S+1)%5),50);return()=>clearInterval(y)},[]),!c||!te.isNumber(r.x)||!te.isNumber(r.y)||!te.isNumber(s)||!te.isNumber(o.width)||!te.isNumber(o.height)?null:l.jsx(Hr,{ref:p,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:c,fillPatternOffsetY:te.isNumber(f)?f:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},ST=be([tt],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),CT=e=>{const{...t}=e,{objects:n}=O(ST);return l.jsx(Br,{listening:!1,...t,children:n.filter(OC).map((r,o)=>l.jsx(hc,{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 Oo=x,wT=function(t,n,r){const o=Oo.useRef("loading"),s=Oo.useRef(),[c,u]=Oo.useState(0),f=Oo.useRef(),h=Oo.useRef(),p=Oo.useRef();return(f.current!==t||h.current!==n||p.current!==r)&&(o.current="loading",s.current=void 0,f.current=t,h.current=n,p.current=r),Oo.useLayoutEffect(function(){if(!t)return;var g=document.createElement("img");function y(){o.current="loaded",s.current=g,u(Math.random())}function S(){o.current="failed",s.current=void 0,u(Math.random())}return g.addEventListener("load",y),g.addEventListener("error",S),n&&(g.crossOrigin=n),r&&(g.referrerpolicy=r),g.src=t,function(){g.removeEventListener("load",y),g.removeEventListener("error",S)}},[t,n,r]),[s.current,o.current]};const S4=e=>{const{url:t,x:n,y:r}=e,[o]=wT(t);return l.jsx(y4,{x:n,y:r,image:o,listening:!1})},kT=be([tt],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),jT=()=>{const{objects:e}=O(kT);return e?l.jsx(Br,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(M1(t))return l.jsx(S4,{x:t.x,y:t.y,url:t.image.url},n);if(AC(t)){const r=l.jsx(hc,{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(Br,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(zC(t))return l.jsx(Hr,{x:t.x,y:t.y,width:t.width,height:t.height,fill:Yo(t.color)},n);if(RC(t))return l.jsx(Hr,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},ET=be([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:te.isEqual}}),PT=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:c,width:u,height:f}=O(ET);return l.jsxs(Br,{...t,children:[r&&n&&l.jsx(S4,{url:n.image.url,x:s,y:c}),o&&l.jsxs(Br,{children:[l.jsx(Hr,{x:s,y:c,width:u,height:f,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),l.jsx(Hr,{x:s,y:c,width:u,height:f,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},IT=be([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:te.isEqual}}),MT=()=>{const e=Y(),{isOnFirstImage:t,isOnLastImage:n,currentStagingAreaImage:r,shouldShowStagingImage:o}=O(IT),{t:s}=Z(),c=x.useCallback(()=>{e(Vv(!0))},[e]),u=x.useCallback(()=>{e(Vv(!1))},[e]);fe(["left"],()=>{f()},{enabled:()=>!0,preventDefault:!0}),fe(["right"],()=>{h()},{enabled:()=>!0,preventDefault:!0}),fe(["enter"],()=>{p()},{enabled:()=>!0,preventDefault:!0});const f=()=>e(NC()),h=()=>e(FC()),p=()=>e(LC());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(en,{isAttached:!0,children:[l.jsx(le,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:l.jsx(P8,{}),onClick:f,colorScheme:"accent",isDisabled:t}),l.jsx(le,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:l.jsx(I8,{}),onClick:h,colorScheme:"accent",isDisabled:n}),l.jsx(le,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:l.jsx(zc,{}),onClick:p,colorScheme:"accent"}),l.jsx(le,{tooltip:s("unifiedCanvas.showHide"),"aria-label":s("unifiedCanvas.showHide"),"data-alert":!o,icon:o?l.jsx(z8,{}):l.jsx(A8,{}),onClick:()=>e(BC(!o)),colorScheme:"accent"}),l.jsx(le,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),icon:l.jsx(op,{}),onClick:()=>e(HC(r.image.url)),colorScheme:"accent"}),l.jsx(le,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),onClick:()=>e(WC()),colorScheme:"error",fontSize:20})]})}):null},Hi=e=>Math.round(e*100)/100,TT=be([tt],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${Hi(n)}, ${Hi(r)})`}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function _T(){const{cursorCoordinatesString:e}=O(TT),{t}=Z();return l.jsx(We,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const zf="var(--invokeai-colors-warning-500)",DT=be([tt],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:c},scaledBoundingBoxDimensions:{width:u,height:f},boundingBoxCoordinates:{x:h,y:p},stageScale:g,shouldShowCanvasDebugInfo:y,layer:S,boundingBoxScaleMethod:C,shouldPreserveMaskedArea:w}=e;let k="inherit";return(C==="none"&&(s<512||c<512)||C==="manual"&&u*f<512*512)&&(k=zf),{activeLayerColor:S==="mask"?zf:"inherit",activeLayerString:S.charAt(0).toUpperCase()+S.slice(1),boundingBoxColor:k,boundingBoxCoordinatesString:`(${Hi(h)}, ${Hi(p)})`,boundingBoxDimensionsString:`${s}×${c}`,scaledBoundingBoxDimensionsString:`${u}×${f}`,canvasCoordinatesString:`${Hi(r)}×${Hi(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(g*100),shouldShowCanvasDebugInfo:y,shouldShowBoundingBox:C!=="auto",shouldShowScaledBoundingBox:C!=="none",shouldPreserveMaskedArea:w}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),OT=()=>{const{activeLayerColor:e,activeLayerString:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:c,canvasCoordinatesString:u,canvasDimensionsString:f,canvasScaleString:h,shouldShowCanvasDebugInfo:p,shouldShowBoundingBox:g,shouldPreserveMaskedArea:y}=O(DT),{t:S}=Z();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:"blackAlpha.500"},children:[l.jsx(We,{style:{color:e},children:`${S("unifiedCanvas.activeLayer")}: ${t}`}),l.jsx(We,{children:`${S("unifiedCanvas.canvasScale")}: ${h}%`}),y&&l.jsx(We,{style:{color:zf},children:"Preserve Masked Area: On"}),g&&l.jsx(We,{style:{color:n},children:`${S("unifiedCanvas.boundingBox")}: ${o}`}),c&&l.jsx(We,{style:{color:n},children:`${S("unifiedCanvas.scaledBoundingBox")}: ${s}`}),p&&l.jsxs(l.Fragment,{children:[l.jsx(We,{children:`${S("unifiedCanvas.boundingBoxPosition")}: ${r}`}),l.jsx(We,{children:`${S("unifiedCanvas.canvasDimensions")}: ${f}`}),l.jsx(We,{children:`${S("unifiedCanvas.canvasPosition")}: ${u}`}),l.jsx(_T,{})]})]})},AT=be(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:te.isEqual}}),zT=e=>{const{...t}=e,n=Y(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:c,isTransformingBoundingBox:u,stageScale:f,shouldSnapToGrid:h,tool:p,hitStrokeWidth:g}=O(AT),y=x.useRef(null),S=x.useRef(null),[C,w]=x.useState(!1);x.useEffect(()=>{var X;!y.current||!S.current||(y.current.nodes([S.current]),(X=y.current.getLayer())==null||X.batchDraw())},[]);const k=64*f,j=x.useCallback(X=>{if(!h){n(fd({x:Math.floor(X.target.x()),y:Math.floor(X.target.y())}));return}const $=X.target.x(),Q=X.target.y(),re=Uv($,64),ie=Uv(Q,64);X.target.x(re),X.target.y(ie),n(fd({x:re,y:ie}))},[n,h]),M=x.useCallback(()=>{if(!S.current)return;const X=S.current,$=X.scaleX(),Q=X.scaleY(),re=Math.round(X.width()*$),ie=Math.round(X.height()*Q),U=Math.round(X.x()),K=Math.round(X.y());n(Na({width:re,height:ie})),n(fd({x:h?xl(U,64):U,y:h?xl(K,64):K})),X.scaleX(1),X.scaleY(1)},[n,h]),P=x.useCallback((X,$,Q)=>{const re=X.x%k,ie=X.y%k;return{x:xl($.x,k)+re,y:xl($.y,k)+ie}},[k]),I=()=>{n(hd(!0))},T=()=>{n(hd(!1)),n(pd(!1)),n(yl(!1)),w(!1)},D=()=>{n(pd(!0))},_=()=>{n(hd(!1)),n(pd(!1)),n(yl(!1)),w(!1)},z=()=>{w(!0)},V=()=>{!u&&!c&&w(!1)},F=()=>{n(yl(!0))},L=()=>{n(yl(!1))};return l.jsxs(Br,{...t,children:[l.jsx(Hr,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:F,onMouseOver:F,onMouseLeave:L,onMouseOut:L}),l.jsx(Hr,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:g,listening:!s&&p==="move",onDragStart:D,onDragEnd:_,onDragMove:j,onMouseDown:D,onMouseOut:V,onMouseOver:z,onMouseEnter:z,onMouseUp:_,onTransform:M,onTransformEnd:T,ref:S,stroke:C?"rgba(255,255,255,0.7)":"white",strokeWidth:(C?8:1)/f,width:o.width,x:r.x,y:r.y}),l.jsx(QM,{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:p==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&p==="move",onDragStart:D,onDragEnd:_,onMouseDown:I,onMouseUp:T,onTransformEnd:T,ref:y,rotateEnabled:!1})]})},RT=be(tt,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:c,layer:u,shouldShowBrush:f,isMovingBoundingBox:h,isTransformingBoundingBox:p,stageScale:g,stageDimensions:y,boundingBoxCoordinates:S,boundingBoxDimensions:C,shouldRestrictStrokesToBox:w}=e,k=w?{clipX:S.x,clipY:S.y,clipWidth:C.width,clipHeight:C.height}:{};return{cursorPosition:t,brushX:t?t.x:y.width/2,brushY:t?t.y:y.height/2,radius:n/2,colorPickerOuterRadius:$v/g,colorPickerInnerRadius:($v-sf+1)/g,maskColorString:Yo({...o,a:.5}),brushColorString:Yo(s),colorPickerColorString:Yo(r),tool:c,layer:u,shouldShowBrush:f,shouldDrawBrushPreview:!(h||p||!t)&&f,strokeWidth:1.5/g,dotRadius:1.5/g,clip:k}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),NT=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:c,layer:u,shouldDrawBrushPreview:f,dotRadius:h,strokeWidth:p,brushColorString:g,colorPickerColorString:y,colorPickerInnerRadius:S,colorPickerOuterRadius:C,clip:w}=O(RT);return f?l.jsxs(Br,{listening:!1,...w,...t,children:[c==="colorPicker"?l.jsxs(l.Fragment,{children:[l.jsx(Do,{x:n,y:r,radius:C,stroke:g,strokeWidth:sf,strokeScaleEnabled:!1}),l.jsx(Do,{x:n,y:r,radius:S,stroke:y,strokeWidth:sf,strokeScaleEnabled:!1})]}):l.jsxs(l.Fragment,{children:[l.jsx(Do,{x:n,y:r,radius:o,fill:u==="mask"?s:g,globalCompositeOperation:c==="eraser"?"destination-out":"source-out"}),l.jsx(Do,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:p*2,strokeEnabled:!0,listening:!1}),l.jsx(Do,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:p,strokeEnabled:!0,listening:!1})]}),l.jsx(Do,{x:n,y:r,radius:h*2,fill:"rgba(255,255,255,0.4)",listening:!1}),l.jsx(Do,{x:n,y:r,radius:h,fill:"rgba(0,0,0,1)",listening:!1})]}):null},FT=be([tt,zt],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:c,isMovingBoundingBox:u,stageDimensions:f,stageCoordinates:h,tool:p,isMovingStage:g,shouldShowIntermediates:y,shouldShowGrid:S,shouldRestrictStrokesToBox:C}=e;let w="none";return p==="move"||t?g?w="grabbing":w="grab":s?w=void 0:C&&!c&&(w="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||u,shouldShowBoundingBox:o,shouldShowGrid:S,stageCoordinates:h,stageCursor:w,stageDimensions:f,stageScale:r,tool:p,isStaging:t,shouldShowIntermediates:y}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),LT=oe(ZM,{shouldForwardProp:e=>!["sx"].includes(e)}),C4=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:c,stageScale:u,tool:f,isStaging:h,shouldShowIntermediates:p}=O(FT);nT();const g=x.useRef(null),y=x.useRef(null),S=x.useCallback(V=>{UC(V),g.current=V},[]),C=x.useCallback(V=>{VC(V),y.current=V},[]),w=x.useRef({x:0,y:0}),k=x.useRef(!1),j=dT(g),M=oT(g),P=cT(g,k),I=aT(g,k,w),T=sT(),{handleDragStart:D,handleDragMove:_,handleDragEnd:z}=eT();return l.jsx(B,{sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:l.jsxs(We,{sx:{position:"relative"},children:[l.jsxs(LT,{tabIndex:-1,ref:S,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:o.x,y:o.y,width:c.width,height:c.height,scale:{x:u,y:u},onTouchStart:M,onTouchMove:I,onTouchEnd:P,onMouseDown:M,onMouseLeave:T,onMouseMove:I,onMouseUp:P,onDragStart:D,onDragMove:_,onDragEnd:z,onContextMenu:V=>V.evt.preventDefault(),onWheel:j,draggable:(f==="move"||h)&&!t,children:[l.jsx(za,{id:"grid",visible:r,children:l.jsx(vT,{})}),l.jsx(za,{id:"base",ref:C,listening:!1,imageSmoothingEnabled:!1,children:l.jsx(jT,{})}),l.jsxs(za,{id:"mask",visible:e,listening:!1,children:[l.jsx(CT,{visible:!0,listening:!1}),l.jsx(bT,{listening:!1})]}),l.jsx(za,{children:l.jsx(hT,{})}),l.jsxs(za,{id:"preview",imageSmoothingEnabled:!1,children:[!h&&l.jsx(NT,{visible:f!=="move",listening:!1}),l.jsx(PT,{visible:h}),p&&l.jsx(xT,{}),l.jsx(zT,{visible:n&&!h})]})]}),l.jsx(OT,{}),l.jsx(MT,{})]})})},BT=be(tt,zy,Bt,(e,t,n)=>{const{doesCanvasNeedScaling:r,isCanvasInitialized:o}=e;return{doesCanvasNeedScaling:r,activeTabName:n,initialCanvasImage:t,isCanvasInitialized:o}}),w4=()=>{const e=Y(),{doesCanvasNeedScaling:t,activeTabName:n,initialCanvasImage:r,isCanvasInitialized:o}=O(BT),s=x.useRef(null);return x.useLayoutEffect(()=>{window.setTimeout(()=>{if(!s.current)return;const{clientWidth:c,clientHeight:u}=s.current;e($C({width:c,height:u})),e(o?GC():Sc()),e(on(!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(Qf,{thickness:"2px",speed:"1s",size:"xl"})})},HT=be([tt,Bt,Pt],(e,t,n)=>{const{futureLayerStates:r}=e;return{canRedo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function k4(){const e=Y(),{canRedo:t,activeTabName:n}=O(HT),{t:r}=Z(),o=()=>{e(qC())};return fe(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),l.jsx(le,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:l.jsx(G8,{}),onClick:o,isDisabled:!t})}const WT=be([tt,Bt,Pt],(e,t,n)=>{const{pastLayerStates:r}=e;return{canUndo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function j4(){const e=Y(),{t}=Z(),{canUndo:n,activeTabName:r}=O(WT),o=()=>{e(YC())};return fe(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),l.jsx(le,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:l.jsx(Q8,{}),onClick:o,isDisabled:!n})}const VT=(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},UT=e=>{const t=document.createElement("a");t.href=e,t.download="",document.body.appendChild(t),t.click(),document.body.removeChild(t),t.remove()},$T=(e,t,n,r)=>{const o=e.scale(),s=e.getClientRect({relativeTo:e.getParent()});e.scale({x:1/t,y:1/t});const{x:c,y:u,width:f,height:h}=e.getClientRect(),p=r?{x:r.x+n.x,y:r.y+n.y,width:r.width,height:r.height}:{x:c,y:u,width:f,height:h},g=e.toDataURL(p);return e.scale(o),{dataURL:g,boundingBox:{x:s.x,y:s.y,width:f,height:h}}},GT={cropVisible:!1,cropToBoundingBox:!1,shouldSaveToGallery:!1,shouldDownload:!1,shouldCopy:!1,shouldSetAsInitialImage:!0},ao=(e=GT)=>async(t,n)=>{const{cropVisible:r,cropToBoundingBox:o,shouldSaveToGallery:s,shouldDownload:c,shouldCopy:u,shouldSetAsInitialImage:f}=e;t(XC("Exporting Image")),t(bl(!1));const h=n(),{stageScale:p,boundingBoxCoordinates:g,boundingBoxDimensions:y,stageCoordinates:S}=h.canvas,C=Sr();if(!C){t(md(!1)),t(bl(!0));return}const{dataURL:w,boundingBox:k}=$T(C,p,S,o?{...g,...y}:void 0);if(!w){t(md(!1)),t(bl(!0));return}const j=new FormData;j.append("data",JSON.stringify({dataURL:w,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:I,width:T,height:D}=P,_={uuid:E1(),category:s?"result":"user",...P};c&&(UT(I),t(Sl({title:nr.t("toast.downloadImageStarted"),status:"success",duration:2500,isClosable:!0}))),u&&(VT(I,T,D),t(Sl({title:nr.t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0}))),s&&(t(P1({image:_,category:"result"})),t(Sl({title:nr.t("toast.imageSavedToGallery"),status:"success",duration:2500,isClosable:!0}))),f&&(t(KC({kind:"image",layer:"base",...k,image:_})),t(Sl({title:nr.t("toast.canvasMerged"),status:"success",duration:2500,isClosable:!0}))),t(md(!1)),t(QC(nr.t("common.statusConnected"))),t(bl(!0))};function qT(){const e=O(zt),t=Sr(),n=O(u=>u.system.isProcessing),r=O(u=>u.canvas.shouldCropToBoundingBoxOnSave),o=Y(),{t:s}=Z();fe(["meta+c","ctrl+c"],()=>{c()},{enabled:()=>!e,preventDefault:!0},[t,n]);const c=()=>{o(ao({cropVisible:!r,cropToBoundingBox:r,shouldCopy:!0}))};return l.jsx(le,{"aria-label":`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:l.jsx(Ji,{}),onClick:c,isDisabled:e})}function YT(){const e=Y(),{t}=Z(),n=Sr(),r=O(zt),o=O(u=>u.system.isProcessing),s=O(u=>u.canvas.shouldCropToBoundingBoxOnSave);fe(["shift+d"],()=>{c()},{enabled:()=>!r,preventDefault:!0},[n,o]);const c=()=>{e(ao({cropVisible:!s,cropToBoundingBox:s,shouldDownload:!0}))};return l.jsx(le,{"aria-label":`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:l.jsx(rp,{}),onClick:c,isDisabled:r})}function XT(){const e=O(zt),{openUploader:t}=Qh(),{t:n}=Z();return l.jsx(le,{"aria-label":n("common.upload"),tooltip:n("common.upload"),icon:l.jsx(Rc,{}),onClick:t,isDisabled:e})}const KT=be([tt,zt],(e,t)=>{const{layer:n,isMaskEnabled:r}=e;return{layer:n,isMaskEnabled:r,isStaging:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function QT(){const e=Y(),{t}=Z(),{layer:n,isMaskEnabled:r,isStaging:o}=O(KT),s=()=>{e(tc(n==="mask"?"base":"mask"))};fe(["q"],()=>{s()},{enabled:()=>!o,preventDefault:!0},[n]);const c=u=>{const f=u.target.value;e(tc(f)),f==="mask"&&!r&&e(ss(!0))};return l.jsx(Mn,{tooltip:`${t("unifiedCanvas.layer")} (Q)`,tooltipProps:{hasArrow:!0,placement:"top"},value:n,validValues:Q1,onChange:c,isDisabled:o})}function ZT(){const e=Y(),{t}=Z(),n=Sr(),r=O(zt),o=O(c=>c.system.isProcessing);fe(["shift+m"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n,o]);const s=()=>{e(ao({cropVisible:!1,shouldSetAsInitialImage:!0}))};return l.jsx(le,{"aria-label":`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:l.jsx(Oy,{}),onClick:s,isDisabled:r})}function JT(){const e=O(s=>s.canvas.tool),t=O(zt),n=Y(),{t:r}=Z();fe(["v"],()=>{o()},{enabled:()=>!t,preventDefault:!0},[]);const o=()=>n(xr("move"));return l.jsx(le,{"aria-label":`${r("unifiedCanvas.move")} (V)`,tooltip:`${r("unifiedCanvas.move")} (V)`,icon:l.jsx(Py,{}),isChecked:e==="move"||t,onClick:o})}function e_(){const e=O(o=>o.ui.shouldPinParametersPanel),t=Y(),{t:n}=Z(),r=()=>{t(Wo(!0)),e&&setTimeout(()=>t(on(!0)),400)};return l.jsxs(B,{flexDirection:"column",gap:2,children:[l.jsx(le,{tooltip:`${n("parameters.showOptionsPanel")} (O)`,tooltipProps:{placement:"top"},"aria-label":n("parameters.showOptionsPanel"),onClick:r,children:l.jsx(ip,{})}),l.jsx(B,{children:l.jsx(gp,{iconButton:!0})}),l.jsx(B,{children:l.jsx(mp,{width:"100%",height:"40px",btnGroupWidth:"100%"})})]})}function t_(){const e=Y(),{t}=Z(),n=O(zt),r=()=>{e(Jf()),e(Sc())};return l.jsx(le,{"aria-label":t("unifiedCanvas.clearCanvas"),tooltip:t("unifiedCanvas.clearCanvas"),icon:l.jsx(ii,{}),onClick:r,isDisabled:n,colorScheme:"error"})}function E4(e,t,n=250){const[r,o]=x.useState(0);return x.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 n_(){const e=Sr(),t=Y(),{t:n}=Z();fe(["r"],()=>{o()},{enabled:()=>!0,preventDefault:!0},[e]);const r=E4(()=>o(!1),()=>o(!0)),o=(s=!1)=>{const c=Sr();if(!c)return;const u=c.getClientRect({skipTransform:!0});t(Z1({contentRect:u,shouldScaleTo1:s}))};return l.jsx(le,{"aria-label":`${n("unifiedCanvas.resetView")} (R)`,tooltip:`${n("unifiedCanvas.resetView")} (R)`,icon:l.jsx(My,{}),onClick:r})}function r_(){const e=O(zt),t=Sr(),n=O(u=>u.system.isProcessing),r=O(u=>u.canvas.shouldCropToBoundingBoxOnSave),o=Y(),{t:s}=Z();fe(["shift+s"],()=>{c()},{enabled:()=>!e,preventDefault:!0},[t,n]);const c=()=>{o(ao({cropVisible:!r,cropToBoundingBox:r,shouldSaveToGallery:!0}))};return l.jsx(le,{"aria-label":`${s("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${s("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:l.jsx(op,{}),onClick:c,isDisabled:e})}const o_=be([tt,zt,Pt],(e,t,n)=>{const{isProcessing:r}=n,{tool:o}=e;return{tool:o,isStaging:t,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),i_=()=>{const e=Y(),{t}=Z(),{tool:n,isStaging:r}=O(o_);fe(["b"],()=>{o()},{enabled:()=>!r,preventDefault:!0},[]),fe(["e"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n]),fe(["c"],()=>{c()},{enabled:()=>!r,preventDefault:!0},[n]),fe(["shift+f"],()=>{u()},{enabled:()=>!r,preventDefault:!0}),fe(["delete","backspace"],()=>{f()},{enabled:()=>!r,preventDefault:!0});const o=()=>e(xr("brush")),s=()=>e(xr("eraser")),c=()=>e(xr("colorPicker")),u=()=>e(J1()),f=()=>e(e2());return l.jsxs(B,{flexDirection:"column",gap:2,children:[l.jsxs(en,{children:[l.jsx(le,{"aria-label":`${t("unifiedCanvas.brush")} (B)`,tooltip:`${t("unifiedCanvas.brush")} (B)`,icon:l.jsx(Ay,{}),isChecked:n==="brush"&&!r,onClick:o,isDisabled:r}),l.jsx(le,{"aria-label":`${t("unifiedCanvas.eraser")} (E)`,tooltip:`${t("unifiedCanvas.eraser")} (B)`,icon:l.jsx(Ty,{}),isChecked:n==="eraser"&&!r,isDisabled:r,onClick:s})]}),l.jsxs(en,{children:[l.jsx(le,{"aria-label":`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:l.jsx(Dy,{}),isDisabled:r,onClick:u}),l.jsx(le,{"aria-label":`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),isDisabled:r,onClick:f})]}),l.jsx(le,{"aria-label":`${t("unifiedCanvas.colorPicker")} (C)`,tooltip:`${t("unifiedCanvas.colorPicker")} (C)`,icon:l.jsx(_y,{}),isChecked:n==="colorPicker"&&!r,isDisabled:r,onClick:c,width:"max-content"})]})},Wc=he((e,t)=>{const{acceptButtonText:n="Accept",acceptCallback:r,cancelButtonText:o="Cancel",cancelCallback:s,children:c,title:u,triggerComponent:f}=e,{isOpen:h,onOpen:p,onClose:g}=uo(),y=x.useRef(null),S=()=>{r(),g()},C=()=>{s&&s(),g()};return l.jsxs(l.Fragment,{children:[x.cloneElement(f,{onClick:p,ref:t}),l.jsx(qx,{isOpen:h,leastDestructiveRef:y,onClose:g,children:l.jsx(Nr,{children:l.jsxs(Yx,{children:[l.jsx(Rr,{fontSize:"lg",fontWeight:"bold",children:u}),l.jsx(Fr,{children:c}),l.jsxs(zr,{children:[l.jsx(Je,{ref:y,onClick:C,children:o}),l.jsx(Je,{colorScheme:"error",onClick:S,ml:3,children:n})]})]})})})]})}),P4=()=>{const e=O(zt),t=Y(),{t:n}=Z(),r=()=>{t(ZC()),t(Jf()),t(t2())};return l.jsxs(Wc,{title:n("unifiedCanvas.emptyTempImageFolder"),acceptCallback:r,acceptButtonText:n("unifiedCanvas.emptyFolder"),triggerComponent:l.jsx(Je,{leftIcon:l.jsx(ii,{}),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")})]})},I4=()=>{const e=O(zt),t=Y(),{t:n}=Z();return l.jsxs(Wc,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(t2()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:l.jsx(Je,{size:"sm",leftIcon:l.jsx(ii,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[l.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),l.jsx("br",{}),l.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},a_=be([tt],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:o}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:o}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),s_=()=>{const e=Y(),{t}=Z(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldShowCanvasDebugInfo:o,shouldShowIntermediates:s}=O(a_);return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{tooltip:t("unifiedCanvas.canvasSettings"),tooltipProps:{placement:"bottom"},"aria-label":t("unifiedCanvas.canvasSettings"),icon:l.jsx(ap,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:t("unifiedCanvas.showIntermediates"),isChecked:s,onChange:c=>e(n2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:c=>e(r2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:c=>e(o2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:o,onChange:c=>e(i2(c.target.checked))}),l.jsx(I4,{}),l.jsx(P4,{})]})})},l_=()=>{const e=O(t=>t.ui.shouldShowParametersPanel);return l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(QT,{}),l.jsx(i_,{}),l.jsxs(B,{gap:2,children:[l.jsx(JT,{}),l.jsx(n_,{})]}),l.jsxs(B,{columnGap:2,children:[l.jsx(ZT,{}),l.jsx(r_,{})]}),l.jsxs(B,{columnGap:2,children:[l.jsx(qT,{}),l.jsx(YT,{})]}),l.jsxs(B,{gap:2,children:[l.jsx(j4,{}),l.jsx(k4,{})]}),l.jsxs(B,{gap:2,children:[l.jsx(XT,{}),l.jsx(t_,{})]}),l.jsx(s_,{}),!e&&l.jsx(e_,{})]})};function c_(){const e=Y(),t=O(o=>o.canvas.brushSize),{t:n}=Z(),r=O(zt);return fe(["BracketLeft"],()=>{e(Wi(Math.max(t-5,5)))},{enabled:()=>!r,preventDefault:!0},[t]),fe(["BracketRight"],()=>{e(Wi(Math.min(t+5,500)))},{enabled:()=>!r,preventDefault:!0},[t]),l.jsx(ut,{label:n("unifiedCanvas.brushSize"),value:t,withInput:!0,onChange:o=>e(Wi(o)),sliderNumberInputProps:{max:500},inputReadOnly:!1,isCompact:!0})}function Vc(){return(Vc=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function Rf(e){var t=x.useRef(e),n=x.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var ta=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:k.buttons>0)&&o.current?s(M0(o.current,k,u.current)):w(!1)},C=function(){return w(!1)};function w(k){var j=f.current,M=Nf(o.current),P=k?M.addEventListener:M.removeEventListener;P(j?"touchmove":"mousemove",S),P(j?"touchend":"mouseup",C)}return[function(k){var j=k.nativeEvent,M=o.current;if(M&&(T0(j),!function(I,T){return T&&!Ua(I)}(j,f.current)&&M)){if(Ua(j)){f.current=!0;var P=j.changedTouches||[];P.length&&(u.current=P[0].identifier)}M.focus(),s(M0(M,j,u.current)),w(!0)}},function(k){var j=k.which||k.keyCode;j<37||j>40||(k.preventDefault(),c({left:j===39?.05:j===37?-.05:0,top:j===40?.05:j===38?-.05:0}))},w]},[c,s]),p=h[0],g=h[1],y=h[2];return x.useEffect(function(){return y},[y]),ke.createElement("div",Vc({},r,{onTouchStart:p,onMouseDown:p,className:"react-colorful__interactive",ref:o,onKeyDown:g,tabIndex:0,role:"slider"}))}),Uc=function(e){return e.filter(Boolean).join(" ")},zp=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=Uc(["react-colorful__pointer",e.className]);return ke.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},ke.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},vn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},T4=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:vn(e.h),s:vn(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:vn(o/2),a:vn(r,2)}},Ff=function(e){var t=T4(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Bd=function(e){var t=T4(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},u_=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),c=r*(1-n),u=r*(1-(t-s)*n),f=r*(1-(1-t+s)*n),h=s%6;return{r:vn(255*[r,u,c,c,f,r][h]),g:vn(255*[f,r,r,u,c,c][h]),b:vn(255*[c,c,f,r,r,u][h]),a:vn(o,2)}},d_=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:vn(60*(u<0?u+6:u)),s:vn(s?c/s*100:0),v:vn(s/255*100),a:o}},f_=ke.memo(function(e){var t=e.hue,n=e.onChange,r=Uc(["react-colorful__hue",e.className]);return ke.createElement("div",{className:r},ke.createElement(Ap,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:ta(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":vn(t),"aria-valuemax":"360","aria-valuemin":"0"},ke.createElement(zp,{className:"react-colorful__hue-pointer",left:t/360,color:Ff({h:t,s:100,v:100,a:1})})))}),h_=ke.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Ff({h:t.h,s:100,v:100,a:1})};return ke.createElement("div",{className:"react-colorful__saturation",style:r},ke.createElement(Ap,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:ta(t.s+100*o.left,0,100),v:ta(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+vn(t.s)+"%, Brightness "+vn(t.v)+"%"},ke.createElement(zp,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Ff(t)})))}),_4=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function p_(e,t,n){var r=Rf(n),o=x.useState(function(){return e.toHsva(t)}),s=o[0],c=o[1],u=x.useRef({color:t,hsva:s});x.useEffect(function(){if(!e.equal(t,u.current.color)){var h=e.toHsva(t);u.current={hsva:h,color:t},c(h)}},[t,e]),x.useEffect(function(){var h;_4(s,u.current.hsva)||e.equal(h=e.fromHsva(s),u.current.color)||(u.current={hsva:s,color:h},r(h))},[s,e,r]);var f=x.useCallback(function(h){c(function(p){return Object.assign({},p,h)})},[]);return[s,f]}var m_=typeof window<"u"?x.useLayoutEffect:x.useEffect,v_=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},_0=new Map,g_=function(e){m_(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!_0.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}`,_0.set(t,n);var r=v_();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},x_=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+Bd(Object.assign({},n,{a:0}))+", "+Bd(Object.assign({},n,{a:1}))+")"},s=Uc(["react-colorful__alpha",t]),c=vn(100*n.a);return ke.createElement("div",{className:s},ke.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),ke.createElement(Ap,{onMove:function(u){r({a:u.left})},onKey:function(u){r({a:ta(n.a+u.left)})},"aria-label":"Alpha","aria-valuetext":c+"%","aria-valuenow":c,"aria-valuemin":"0","aria-valuemax":"100"},ke.createElement(zp,{className:"react-colorful__alpha-pointer",left:n.a,color:Bd(n)})))},y_=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,c=M4(e,["className","colorModel","color","onChange"]),u=x.useRef(null);g_(u);var f=p_(n,o,s),h=f[0],p=f[1],g=Uc(["react-colorful",t]);return ke.createElement("div",Vc({},c,{ref:u,className:g}),ke.createElement(h_,{hsva:h,onChange:p}),ke.createElement(f_,{hue:h.h,onChange:p}),ke.createElement(x_,{hsva:h,onChange:p,className:"react-colorful__last-control"}))},b_={defaultColor:{r:0,g:0,b:0,a:1},toHsva:d_,fromHsva:u_,equal:_4},S_=function(e){return ke.createElement(y_,Vc({},e,{colorModel:b_}))};const C_=oe(S_,{baseStyle:{paddingInline:4},shouldForwardProp:e=>!["pickerColor"].includes(e)}),Hd={width:6,height:6,borderColor:"base.100"},pc=e=>{const{styleClass:t="",...n}=e;return l.jsx(C_,{sx:{".react-colorful__hue-pointer":Hd,".react-colorful__saturation-pointer":Hd,".react-colorful__alpha-pointer":Hd},className:t,...n})},w_=be([tt,zt],(e,t)=>{const{brushColor:n,maskColor:r,layer:o}=e;return{brushColor:n,maskColor:r,layer:o,isStaging:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function k_(){const e=Y(),{brushColor:t,maskColor:n,layer:r,isStaging:o}=O(w_),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 fe(["shift+BracketLeft"],()=>{e(Vi({...t,a:te.clamp(t.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[t]),fe(["shift+BracketRight"],()=>{e(Vi({...t,a:te.clamp(t.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[t]),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(We,{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(pc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:t,onChange:c=>e(Vi(c))}),r==="mask"&&l.jsx(pc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:c=>e(a2(c))})]})})}function D4(){return l.jsxs(B,{columnGap:4,alignItems:"center",children:[l.jsx(c_,{}),l.jsx(k_,{})]})}function j_(){const e=Y(),t=O(r=>r.canvas.shouldRestrictStrokesToBox),{t:n}=Z();return l.jsx(pt,{label:n("unifiedCanvas.betaLimitToBox"),isChecked:t,onChange:r=>e(s2(r.target.checked))})}function E_(){return l.jsxs(B,{gap:4,alignItems:"center",children:[l.jsx(D4,{}),l.jsx(j_,{})]})}function P_(){const e=Y(),{t}=Z(),n=()=>e(Zf());return l.jsx(Je,{size:"sm",leftIcon:l.jsx(ii,{}),onClick:n,tooltip:`${t("unifiedCanvas.clearMask")} (Shift+C)`,children:t("unifiedCanvas.betaClear")})}function I_(){const e=O(o=>o.canvas.isMaskEnabled),t=Y(),{t:n}=Z(),r=()=>t(ss(!e));return l.jsx(pt,{label:`${n("unifiedCanvas.enableMask")} (H)`,isChecked:e,onChange:r})}function M_(){const e=Y(),{t}=Z(),n=O(r=>r.canvas.shouldPreserveMaskedArea);return l.jsx(pt,{label:t("unifiedCanvas.betaPreserveMasked"),isChecked:n,onChange:r=>e(l2(r.target.checked))})}function T_(){return l.jsxs(B,{gap:4,alignItems:"center",children:[l.jsx(D4,{}),l.jsx(I_,{}),l.jsx(M_,{}),l.jsx(P_,{})]})}function __(){const e=O(r=>r.canvas.shouldDarkenOutsideBoundingBox),t=Y(),{t:n}=Z();return l.jsx(pt,{label:n("unifiedCanvas.betaDarkenOutside"),isChecked:e,onChange:r=>t(c2(r.target.checked))})}function D_(){const e=O(r=>r.canvas.shouldShowGrid),t=Y(),{t:n}=Z();return l.jsx(pt,{label:n("unifiedCanvas.showGrid"),isChecked:e,onChange:r=>t(u2(r.target.checked))})}function O_(){const e=O(o=>o.canvas.shouldSnapToGrid),t=Y(),{t:n}=Z(),r=o=>t(ec(o.target.checked));return l.jsx(pt,{label:`${n("unifiedCanvas.snapToGrid")} (N)`,isChecked:e,onChange:r})}function A_(){return l.jsxs(B,{alignItems:"center",gap:4,children:[l.jsx(D_,{}),l.jsx(O_,{}),l.jsx(__,{})]})}const z_=be([tt],e=>{const{tool:t,layer:n}=e;return{tool:t,layer:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function R_(){const{tool:e,layer:t}=O(z_);return l.jsxs(B,{height:8,minHeight:8,maxHeight:8,alignItems:"center",children:[t=="base"&&["brush","eraser","colorPicker"].includes(e)&&l.jsx(E_,{}),t=="mask"&&["brush","eraser","colorPicker"].includes(e)&&l.jsx(T_,{}),e=="move"&&l.jsx(A_,{})]})}const N_=be([tt],e=>{const{doesCanvasNeedScaling:t}=e;return{doesCanvasNeedScaling:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),F_=()=>{const e=Y(),{doesCanvasNeedScaling:t}=O(N_);return x.useLayoutEffect(()=>{e(on(!0));const n=te.debounce(()=>{e(on(!0))},250);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),l.jsx(We,{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(l_,{}),l.jsxs(B,{width:"100%",height:"100%",flexDirection:"column",rowGap:4,children:[l.jsx(R_,{}),t?l.jsx(w4,{}):l.jsx(C4,{})]})]})})},L_=be([tt,zt],(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:te.isEqual}}),B_=()=>{const e=Y(),{t}=Z(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:c}=O(L_);fe(["q"],()=>{u()},{enabled:()=>!c,preventDefault:!0},[n]),fe(["shift+c"],()=>{f()},{enabled:()=>!c,preventDefault:!0},[]),fe(["h"],()=>{h()},{enabled:()=>!c,preventDefault:!0},[o]);const u=()=>{e(tc(n==="mask"?"base":"mask"))},f=()=>e(Zf()),h=()=>e(ss(!o));return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(en,{children:l.jsx(le,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:l.jsx(B8,{}),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:h}),l.jsx(pt,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:p=>e(l2(p.target.checked))}),l.jsx(pc,{sx:{paddingTop:2,paddingBottom:2},pickerColor:r,onChange:p=>e(a2(p))}),l.jsxs(Je,{size:"sm",leftIcon:l.jsx(ii,{}),onClick:f,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},H_=be([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:te.isEqual}}),W_=()=>{const e=Y(),{t}=Z(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:c,shouldShowIntermediates:u,shouldSnapToGrid:f,shouldRestrictStrokesToBox:h}=O(H_);fe(["n"],()=>{e(ec(!f))},{enabled:!0,preventDefault:!0},[f]);const p=g=>e(ec(g.target.checked));return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:l.jsx(ap,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:t("unifiedCanvas.showIntermediates"),isChecked:u,onChange:g=>e(n2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showGrid"),isChecked:c,onChange:g=>e(u2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.snapToGrid"),isChecked:f,onChange:p}),l.jsx(pt,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:g=>e(c2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:g=>e(r2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:g=>e(o2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:h,onChange:g=>e(s2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:g=>e(i2(g.target.checked))}),l.jsx(I4,{}),l.jsx(P4,{})]})})},V_=be([tt,zt,Pt],(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:te.isEqual}}),U_=()=>{const e=Y(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=O(V_),{t:s}=Z();fe(["b"],()=>{c()},{enabled:()=>!o,preventDefault:!0},[]),fe(["e"],()=>{u()},{enabled:()=>!o,preventDefault:!0},[t]),fe(["c"],()=>{f()},{enabled:()=>!o,preventDefault:!0},[t]),fe(["shift+f"],()=>{h()},{enabled:()=>!o,preventDefault:!0}),fe(["delete","backspace"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),fe(["BracketLeft"],()=>{e(Wi(Math.max(r-5,5)))},{enabled:()=>!o,preventDefault:!0},[r]),fe(["BracketRight"],()=>{e(Wi(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),fe(["shift+BracketLeft"],()=>{e(Vi({...n,a:te.clamp(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),fe(["shift+BracketRight"],()=>{e(Vi({...n,a:te.clamp(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const c=()=>e(xr("brush")),u=()=>e(xr("eraser")),f=()=>e(xr("colorPicker")),h=()=>e(J1()),p=()=>e(e2());return l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:l.jsx(Ay,{}),isChecked:t==="brush"&&!o,onClick:c,isDisabled:o}),l.jsx(le,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:l.jsx(Ty,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:u}),l.jsx(le,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:l.jsx(Dy,{}),isDisabled:o,onClick:h}),l.jsx(le,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:p}),l.jsx(le,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:l.jsx(_y,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:f}),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:l.jsx(ip,{})}),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:g=>e(Wi(g)),sliderNumberInputProps:{max:500},inputReadOnly:!1})}),l.jsx(pc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:g=>e(Vi(g))})]})})]})},$_=be([Pt,tt,zt],(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:te.isEqual}}),G_=()=>{const e=Y(),{isProcessing:t,isStaging:n,isMaskEnabled:r,layer:o,tool:s,shouldCropToBoundingBoxOnSave:c}=O($_),u=Sr(),{t:f}=Z(),{openUploader:h}=Qh();fe(["v"],()=>{p()},{enabled:()=>!n,preventDefault:!0},[]),fe(["r"],()=>{y()},{enabled:()=>!0,preventDefault:!0},[u]),fe(["shift+m"],()=>{C()},{enabled:()=>!n,preventDefault:!0},[u,t]),fe(["shift+s"],()=>{w()},{enabled:()=>!n,preventDefault:!0},[u,t]),fe(["meta+c","ctrl+c"],()=>{k()},{enabled:()=>!n,preventDefault:!0},[u,t]),fe(["shift+d"],()=>{j()},{enabled:()=>!n,preventDefault:!0},[u,t]);const p=()=>e(xr("move")),g=E4(()=>y(!1),()=>y(!0)),y=(P=!1)=>{const I=Sr();if(!I)return;const T=I.getClientRect({skipTransform:!0});e(Z1({contentRect:T,shouldScaleTo1:P}))},S=()=>{e(Jf()),e(Sc())},C=()=>{e(ao({cropVisible:!1,shouldSetAsInitialImage:!0}))},w=()=>{e(ao({cropVisible:!c,cropToBoundingBox:c,shouldSaveToGallery:!0}))},k=()=>{e(ao({cropVisible:!c,cropToBoundingBox:c,shouldCopy:!0}))},j=()=>{e(ao({cropVisible:!c,cropToBoundingBox:c,shouldDownload:!0}))},M=P=>{const I=P.target.value;e(tc(I)),I==="mask"&&!r&&e(ss(!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:Q1,onChange:M,isDisabled:n}),l.jsx(B_,{}),l.jsx(U_,{}),l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{"aria-label":`${f("unifiedCanvas.move")} (V)`,tooltip:`${f("unifiedCanvas.move")} (V)`,icon:l.jsx(Py,{}),isChecked:s==="move"||n,onClick:p}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.resetView")} (R)`,tooltip:`${f("unifiedCanvas.resetView")} (R)`,icon:l.jsx(My,{}),onClick:g})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{"aria-label":`${f("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${f("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:l.jsx(Oy,{}),onClick:C,isDisabled:n}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${f("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:l.jsx(op,{}),onClick:w,isDisabled:n}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${f("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:l.jsx(Ji,{}),onClick:k,isDisabled:n}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${f("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:l.jsx(rp,{}),onClick:j,isDisabled:n})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(j4,{}),l.jsx(k4,{})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{"aria-label":`${f("common.upload")}`,tooltip:`${f("common.upload")}`,icon:l.jsx(Rc,{}),onClick:h,isDisabled:n}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.clearCanvas")}`,tooltip:`${f("unifiedCanvas.clearCanvas")}`,icon:l.jsx(ii,{}),onClick:S,colorScheme:"error",isDisabled:n})]}),l.jsx(en,{isAttached:!0,children:l.jsx(W_,{})})]})},q_=be([tt],e=>{const{doesCanvasNeedScaling:t}=e;return{doesCanvasNeedScaling:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Y_=()=>{const e=Y(),{doesCanvasNeedScaling:t}=O(q_);return x.useLayoutEffect(()=>{e(on(!0));const n=te.debounce(()=>{e(on(!0))},250);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),l.jsx(We,{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(G_,{}),l.jsx(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:t?l.jsx(w4,{}):l.jsx(C4,{})})]})})},X_=be(tt,e=>{const{boundingBoxDimensions:t,boundingBoxScaleMethod:n}=e;return{boundingBoxDimensions:t,boundingBoxScale:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),K_=()=>{const e=Y(),{boundingBoxDimensions:t}=O(X_),{t:n}=Z(),r=u=>{e(Na({...t,width:Math.floor(u)}))},o=u=>{e(Na({...t,height:Math.floor(u)}))},s=()=>{e(Na({...t,width:Math.floor(512)}))},c=()=>{e(Na({...t,height:Math.floor(512)}))};return l.jsxs(Le,{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})]})},Q_=be([vp,Pt,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:te.isEqual}}),Z_=()=>{const e=Y(),{tileSize:t,infillMethod:n,availableInfillMethods:r,boundingBoxScale:o,isManual:s,scaledBoundingBoxDimensions:c}=O(Q_),{t:u}=Z(),f=S=>{e(Cl({...c,width:Math.floor(S)}))},h=S=>{e(Cl({...c,height:Math.floor(S)}))},p=()=>{e(Cl({...c,width:Math.floor(512)}))},g=()=>{e(Cl({...c,height:Math.floor(512)}))},y=S=>{e(t3(S.target.value))};return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(Mn,{label:u("parameters.scaleBeforeProcessing"),validValues:JC,value:o,onChange:y}),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:p}),l.jsx(ut,{isInputDisabled:!s,isResetDisabled:!s,isSliderDisabled:!s,label:u("parameters.scaledHeight"),min:64,max:1024,step:64,value:c.height,onChange:h,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:g}),l.jsx(Mn,{label:u("parameters.infillMethod"),value:n,validValues:r,onChange:S=>e(e3(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(Gv(S))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Gv(32))}})]})};function J_(){const e=Y(),t=O(r=>r.generation.seamBlur),{t:n}=Z();return l.jsx(ut,{label:n("parameters.seamBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(qv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(qv(16))}})}function eD(){const e=Y(),{t}=Z(),n=O(r=>r.generation.seamSize);return l.jsx(ut,{label:t("parameters.seamSize"),min:1,max:256,sliderNumberInputProps:{max:512},value:n,onChange:r=>{e(Yv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>e(Yv(96))})}function tD(){const{t:e}=Z(),t=O(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(Xv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{n(Xv(30))}})}function nD(){const e=Y(),{t}=Z(),n=O(r=>r.generation.seamStrength);return l.jsx(ut,{label:t("parameters.seamStrength"),min:.01,max:.99,step:.01,value:n,onChange:r=>{e(Kv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Kv(.7))}})}const rD=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(eD,{}),l.jsx(J_,{}),l.jsx(nD,{}),l.jsx(tD,{})]});function oD(){const{t:e}=Z(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(jp,{})},unifiedCanvasImg2Img:{header:`${e("parameters.imageToImage")}`,feature:void 0,content:l.jsx(h4,{label:e("parameters.img2imgStrength")})},seed:{header:`${e("parameters.seed")}`,feature:dn.SEED,content:l.jsx(Cp,{})},boundingBox:{header:`${e("parameters.boundingBoxHeader")}`,feature:dn.BOUNDING_BOX,content:l.jsx(K_,{})},seamCorrection:{header:`${e("parameters.seamCorrectionHeader")}`,feature:dn.SEAM_CORRECTION,content:l.jsx(rD,{})},infillAndScaling:{header:`${e("parameters.infillScalingHeader")}`,feature:dn.INFILL_AND_SCALING,content:l.jsx(Z_,{})},variations:{header:`${e("parameters.variations")}`,feature:dn.VARIATIONS,content:l.jsx(kp,{}),additionalHeaderComponents:l.jsx(wp,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(bp,{}),additionalHeaderComponents:l.jsx(Sp,{})}};return l.jsxs(Tp,{children:[l.jsxs(B,{flexDir:"column",rowGap:2,children:[l.jsx(Mp,{}),l.jsx(Ip,{})]}),l.jsx(Pp,{}),l.jsx(Ep,{accordionInfo:t})]})}function iD(){const e=O(t=>t.ui.shouldUseCanvasBetaLayout);return l.jsx(yp,{optionsPanel:l.jsx(oD,{}),children:e?l.jsx(F_,{}):l.jsx(Y_,{})})}const Hn={txt2img:{title:l.jsx(Jt,{as:p9,boxSize:6}),workarea:l.jsx(YI,{}),tooltip:"Text To Image"},img2img:{title:l.jsx(Jt,{as:lp,boxSize:6}),workarea:l.jsx(HI,{}),tooltip:"Image To Image"},unifiedCanvas:{title:l.jsx(Jt,{as:g9,boxSize:6}),workarea:l.jsx(iD,{}),tooltip:"Unified Canvas"},nodes:{title:l.jsx(Jt,{as:m9,boxSize:6}),workarea:l.jsx(V7,{}),tooltip:"Nodes"},postprocess:{title:l.jsx(Jt,{as:x9,boxSize:6}),workarea:l.jsx(U7,{}),tooltip:"Post Processing"},training:{title:l.jsx(Jt,{as:v9,boxSize:6}),workarea:l.jsx($7,{}),tooltip:"Training"}};function aD(){Hn.txt2img.tooltip=nr.t("common.text2img"),Hn.img2img.tooltip=nr.t("common.img2img"),Hn.unifiedCanvas.tooltip=nr.t("common.unifiedCanvas"),Hn.nodes.tooltip=nr.t("common.nodes"),Hn.postprocess.tooltip=nr.t("common.postProcessing"),Hn.training.tooltip=nr.t("common.training")}function sD(){const e=O(W7),t=O(h=>h.lightbox.isLightboxOpen),{shouldShowGallery:n,shouldShowParametersPanel:r,shouldPinGallery:o,shouldPinParametersPanel:s}=O(xp);G7(aD);const c=Y();fe("1",()=>{c(kn(0))}),fe("2",()=>{c(kn(1))}),fe("3",()=>{c(kn(2))}),fe("4",()=>{c(kn(3))}),fe("5",()=>{c(kn(4))}),fe("6",()=>{c(kn(5))}),fe("z",()=>{c(Ho(!t))},[t]),fe("f",()=>{n||r?(c(Wo(!1)),c(Lo(!1))):(c(Wo(!0)),c(Lo(!0))),(o||s)&&setTimeout(()=>c(on(!0)),400)},[n,r]);const u=()=>{const h=[];return Object.keys(Hn).forEach(p=>{h.push(l.jsx(Yt,{hasArrow:!0,label:Hn[p].tooltip,placement:"end",children:l.jsx(gy,{children:Hn[p].title})},p))}),h},f=()=>{const h=[];return Object.keys(Hn).forEach(p=>{h.push(l.jsx(my,{children:Hn[p].workarea},p))}),h};return l.jsxs(hy,{isLazy:!0,defaultIndex:e,index:e,onChange:h=>{c(kn(h))},children:[l.jsx(py,{children:u()}),l.jsx(vy,{children:t?l.jsx(iI,{}):f()})]})}var lD=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 bs(e,t){var n=cD(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 cD(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=lD.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var uD=[".DS_Store","Thumbs.db"];function dD(e){return ia(this,void 0,void 0,function(){return aa(this,function(t){return mc(e)&&fD(e.dataTransfer)?[2,vD(e.dataTransfer,e.type)]:hD(e)?[2,pD(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,mD(e)]:[2,[]]})})}function fD(e){return mc(e)}function hD(e){return mc(e)&&mc(e.target)}function mc(e){return typeof e=="object"&&e!==null}function pD(e){return Lf(e.target.files).map(function(t){return bs(t)})}function mD(e){return ia(this,void 0,void 0,function(){var t;return aa(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 bs(r)})]}})})}function vD(e,t){return ia(this,void 0,void 0,function(){var n,r;return aa(this,function(o){switch(o.label){case 0:return e.items?(n=Lf(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(gD))]):[3,2];case 1:return r=o.sent(),[2,D0(O4(r))];case 2:return[2,D0(Lf(e.files).map(function(s){return bs(s)}))]}})})}function D0(e){return e.filter(function(t){return uD.indexOf(t.name)===-1})}function Lf(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,N0(n)];if(e.sizen)return[!1,N0(n)]}return[!0,null]}function Fo(e){return e!=null}function OD(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,c=e.maxFiles,u=e.validator;return!s&&t.length>1||s&&c>=1&&t.length>c?!1:t.every(function(f){var h=N4(f,n),p=es(h,1),g=p[0],y=F4(f,r,o),S=es(y,1),C=S[0],w=u?u(f):null;return g&&C&&!w})}function vc(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Nl(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 L0(e){e.preventDefault()}function AD(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function zD(e){return e.indexOf("Edge/")!==-1}function RD(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return AD(e)||zD(e)}function hr(){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 JD(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 Rp=x.forwardRef(function(e,t){var n=e.children,r=gc(e,WD),o=V4(r),s=o.open,c=gc(o,VD);return x.useImperativeHandle(t,function(){return{open:s}},[s]),ke.createElement(x.Fragment,null,n(Ot(Ot({},c),{},{open:s})))});Rp.displayName="Dropzone";var W4={disabled:!1,getFilesFromEvent:dD,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};Rp.defaultProps=W4;Rp.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 Vf={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function V4(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Ot(Ot({},W4),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,c=t.minSize,u=t.multiple,f=t.maxFiles,h=t.onDragEnter,p=t.onDragLeave,g=t.onDragOver,y=t.onDrop,S=t.onDropAccepted,C=t.onDropRejected,w=t.onFileDialogCancel,k=t.onFileDialogOpen,j=t.useFsAccessApi,M=t.autoFocus,P=t.preventDropOnDocument,I=t.noClick,T=t.noKeyboard,D=t.noDrag,_=t.noDragEventsBubbling,z=t.onError,V=t.validator,F=x.useMemo(function(){return LD(n)},[n]),L=x.useMemo(function(){return FD(n)},[n]),X=x.useMemo(function(){return typeof k=="function"?k:H0},[k]),$=x.useMemo(function(){return typeof w=="function"?w:H0},[w]),Q=x.useRef(null),re=x.useRef(null),ie=x.useReducer(eO,Vf),U=Wd(ie,2),K=U[0],ne=U[1],ce=K.isFocused,Re=K.isFileDialogActive,ze=x.useRef(typeof window<"u"&&window.isSecureContext&&j&&ND()),Me=function(){!ze.current&&Re&&setTimeout(function(){if(re.current){var se=re.current.files;se.length||(ne({type:"closeDialog"}),$())}},300)};x.useEffect(function(){return window.addEventListener("focus",Me,!1),function(){window.removeEventListener("focus",Me,!1)}},[re,Re,$,ze]);var J=x.useRef([]),ue=function(se){Q.current&&Q.current.contains(se.target)||(se.preventDefault(),J.current=[])};x.useEffect(function(){return P&&(document.addEventListener("dragover",L0,!1),document.addEventListener("drop",ue,!1)),function(){P&&(document.removeEventListener("dragover",L0),document.removeEventListener("drop",ue))}},[Q,P]),x.useEffect(function(){return!r&&M&&Q.current&&Q.current.focus(),function(){}},[Q,M,r]);var Ie=x.useCallback(function(q){z?z(q):console.error(q)},[z]),Be=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q),J.current=[].concat(GD(J.current),[q.target]),Nl(q)&&Promise.resolve(o(q)).then(function(se){if(!(vc(q)&&!_)){var Fe=se.length,Ze=Fe>0&&OD({files:se,accept:F,minSize:c,maxSize:s,multiple:u,maxFiles:f,validator:V}),ee=Fe>0&&!Ze;ne({isDragAccept:Ze,isDragReject:ee,isDragActive:!0,type:"setDraggedFiles"}),h&&h(q)}}).catch(function(se){return Ie(se)})},[o,h,Ie,_,F,c,s,u,f,V]),Ne=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q);var se=Nl(q);if(se&&q.dataTransfer)try{q.dataTransfer.dropEffect="copy"}catch{}return se&&g&&g(q),!1},[g,_]),Ge=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q);var se=J.current.filter(function(Ze){return Q.current&&Q.current.contains(Ze)}),Fe=se.indexOf(q.target);Fe!==-1&&se.splice(Fe,1),J.current=se,!(se.length>0)&&(ne({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Nl(q)&&p&&p(q))},[Q,p,_]),Qe=x.useCallback(function(q,se){var Fe=[],Ze=[];q.forEach(function(ee){var He=N4(ee,F),nt=Wd(He,2),Ft=nt[0],pe=nt[1],De=F4(ee,c,s),hn=Wd(De,2),$t=hn[0],pn=hn[1],or=V?V(ee):null;if(Ft&&$t&&!or)Fe.push(ee);else{var bo=[pe,pn];or&&(bo=bo.concat(or)),Ze.push({file:ee,errors:bo.filter(function(da){return da})})}}),(!u&&Fe.length>1||u&&f>=1&&Fe.length>f)&&(Fe.forEach(function(ee){Ze.push({file:ee,errors:[DD]})}),Fe.splice(0)),ne({acceptedFiles:Fe,fileRejections:Ze,type:"setFiles"}),y&&y(Fe,Ze,se),Ze.length>0&&C&&C(Ze,se),Fe.length>0&&S&&S(Fe,se)},[ne,u,F,c,s,f,y,S,C,V]),ve=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q),J.current=[],Nl(q)&&Promise.resolve(o(q)).then(function(se){vc(q)&&!_||Qe(se,q)}).catch(function(se){return Ie(se)}),ne({type:"reset"})},[o,Qe,Ie,_]),_e=x.useCallback(function(){if(ze.current){ne({type:"openDialog"}),X();var q={multiple:u,types:L};window.showOpenFilePicker(q).then(function(se){return o(se)}).then(function(se){Qe(se,null),ne({type:"closeDialog"})}).catch(function(se){BD(se)?($(se),ne({type:"closeDialog"})):HD(se)?(ze.current=!1,re.current?(re.current.value=null,re.current.click()):Ie(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."))):Ie(se)});return}re.current&&(ne({type:"openDialog"}),X(),re.current.value=null,re.current.click())},[ne,X,$,j,Qe,Ie,L,u]),qe=x.useCallback(function(q){!Q.current||!Q.current.isEqualNode(q.target)||(q.key===" "||q.key==="Enter"||q.keyCode===32||q.keyCode===13)&&(q.preventDefault(),_e())},[Q,_e]),ge=x.useCallback(function(){ne({type:"focus"})},[]),Te=x.useCallback(function(){ne({type:"blur"})},[]),et=x.useCallback(function(){I||(RD()?setTimeout(_e,0):_e())},[I,_e]),Ve=function(se){return r?null:se},vt=function(se){return T?null:Ve(se)},Nt=function(se){return D?null:Ve(se)},N=function(se){_&&se.stopPropagation()},de=x.useMemo(function(){return function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},se=q.refKey,Fe=se===void 0?"ref":se,Ze=q.role,ee=q.onKeyDown,He=q.onFocus,nt=q.onBlur,Ft=q.onClick,pe=q.onDragEnter,De=q.onDragOver,hn=q.onDragLeave,$t=q.onDrop,pn=gc(q,UD);return Ot(Ot(Wf({onKeyDown:vt(hr(ee,qe)),onFocus:vt(hr(He,ge)),onBlur:vt(hr(nt,Te)),onClick:Ve(hr(Ft,et)),onDragEnter:Nt(hr(pe,Be)),onDragOver:Nt(hr(De,Ne)),onDragLeave:Nt(hr(hn,Ge)),onDrop:Nt(hr($t,ve)),role:typeof Ze=="string"&&Ze!==""?Ze:"presentation"},Fe,Q),!r&&!T?{tabIndex:0}:{}),pn)}},[Q,qe,ge,Te,et,Be,Ne,Ge,ve,T,D,r]),xe=x.useCallback(function(q){q.stopPropagation()},[]),je=x.useMemo(function(){return function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},se=q.refKey,Fe=se===void 0?"ref":se,Ze=q.onChange,ee=q.onClick,He=gc(q,$D),nt=Wf({accept:F,multiple:u,type:"file",style:{display:"none"},onChange:Ve(hr(Ze,ve)),onClick:Ve(hr(ee,xe)),tabIndex:-1},Fe,re);return Ot(Ot({},nt),He)}},[re,n,u,ve,r]);return Ot(Ot({},K),{},{isFocused:ce&&!r,getRootProps:de,getInputProps:je,rootRef:Q,inputRef:re,open:Ve(_e)})}function eO(e,t){switch(t.type){case"focus":return Ot(Ot({},e),{},{isFocused:!0});case"blur":return Ot(Ot({},e),{},{isFocused:!1});case"openDialog":return Ot(Ot({},Vf),{},{isFileDialogActive:!0});case"closeDialog":return Ot(Ot({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return Ot(Ot({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Ot(Ot({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return Ot({},Vf);default:return e}}function H0(){}const tO=e=>{const{isDragAccept:t,isDragReject:n,overlaySecondaryText:r,setIsHandlingUpload:o}=e;return fe("esc",()=>{o(!1)}),l.jsx(We,{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(Vn,{size:"lg",children:["Upload Image",r]}):l.jsxs(l.Fragment,{children:[l.jsx(Vn,{size:"lg",children:"Invalid Upload"}),l.jsx(Vn,{size:"md",children:"Must be single JPEG or PNG image"})]})})})},nO=e=>{const{children:t}=e,n=Y(),r=O(Bt),o=us({}),{t:s}=Z(),[c,u]=x.useState(!1),{setOpenUploader:f}=Qh(),h=x.useCallback(P=>{u(!0);const I=P.errors.reduce((T,D)=>`${T} ${D.message}`,"");o({title:s("toast.uploadFailed"),description:I,status:"error",isClosable:!0})},[s,o]),p=x.useCallback(async P=>{n(Vg({imageFile:P}))},[n]),g=x.useCallback((P,I)=>{I.forEach(T=>{h(T)}),P.forEach(T=>{p(T)})},[p,h]),{getRootProps:y,getInputProps:S,isDragAccept:C,isDragReject:w,isDragActive:k,open:j}=V4({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:g,onDragOver:()=>u(!0),maxFiles:1});f(j),x.useEffect(()=>{const P=I=>{var z;const T=(z=I.clipboardData)==null?void 0:z.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(I.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(Vg({imageFile:_}))};return document.addEventListener("paste",P),()=>{document.removeEventListener("paste",P)}},[s,n,o,r]);const M=["img2img","unifiedCanvas"].includes(r)?` to ${Hn[r].tooltip}`:"";return l.jsx(Kh.Provider,{value:j,children:l.jsxs(We,{...y({style:{}}),onKeyDown:P=>{P.key},children:[l.jsx("input",{...S()}),t,k&&c&&l.jsx(tO,{isDragAccept:C,isDragReject:w,overlaySecondaryText:M,setIsHandlingUpload:u})]})})},rO=be(Pt,e=>e.log,{memoizeOptions:{resultEqualityCheck:(e,t)=>e.length===t.length}}),oO=be(Pt,e=>({shouldShowLogViewer:e.shouldShowLogViewer,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),iO=()=>{const e=Y(),t=O(rO),{shouldShowLogViewer:n,hasError:r,wasErrorSeen:o}=O(oO),[s,c]=x.useState(!0),u=x.useRef(null);x.useLayoutEffect(()=>{u.current!==null&&s&&(u.current.scrollTop=u.current.scrollHeight)},[s,t,n]);const f=()=>{e(d2()),e(vd(!n))};fe("`",()=>{e(vd(!n))},[n]),fe("esc",()=>{e(vd(!1))});const h=()=>{u.current&&s&&u.current.scrollTop{const{timestamp:y,message:S,level:C}=p,w=C==="info"?"base":C;return l.jsxs(B,{sx:{gap:2,color:`${w}.300`},children:[l.jsxs(Ce,{fontWeight:"600",children:[y,":"]}),l.jsx(Ce,{wordBreak:"break-all",children:S})]},g)})})}),n&&l.jsx(Yt,{hasArrow:!0,label:s?"Autoscroll On":"Autoscroll Off",children:l.jsx(le,{size:"sm","aria-label":"Toggle autoscroll",icon:l.jsx(k8,{}),onClick:()=>c(!s),isChecked:s,sx:{position:"fixed",insetInlineStart:2,bottom:12,zIndex:"10000"}})}),l.jsx(Yt,{hasArrow:!0,label:n?"Hide Console":"Show Console",children:l.jsx(le,{size:"sm","aria-label":"Toggle Log Viewer",icon:n?l.jsx(H8,{}):l.jsx(Iy,{}),onClick:f,sx:{position:"fixed",insetInlineStart:2,bottom:2,zIndex:"10000"},colorScheme:r||!o?"error":"base"})})]})},aO=be(Pt,e=>({isProcessing:e.isProcessing,currentStep:e.currentStep,totalSteps:e.totalSteps,currentStatusHasSteps:e.currentStatusHasSteps}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),sO=()=>{const{isProcessing:e,currentStep:t,totalSteps:n,currentStatusHasSteps:r}=O(aO),o=t?Math.round(t*100/n):0;return l.jsx(Zx,{value:o,isIndeterminate:e&&!r,height:dp,zIndex:99})};function lO(e){const{title:t,hotkey:n,description:r}=e;return l.jsxs($n,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[l.jsxs($n,{children:[l.jsx(Ce,{fontWeight:600,children:t}),r&&l.jsx(Ce,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),l.jsx(We,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function cO({children:e}){const{isOpen:t,onOpen:n,onClose:r}=uo(),{t:o}=Z(),s=[{title:o("hotkeys.invoke.title"),desc:o("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:o("hotkeys.cancel.title"),desc:o("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:o("hotkeys.focusPrompt.title"),desc:o("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:o("hotkeys.toggleOptions.title"),desc:o("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:o("hotkeys.pinOptions.title"),desc:o("hotkeys.pinOptions.desc"),hotkey:"Shift+O"},{title:o("hotkeys.toggleViewer.title"),desc:o("hotkeys.toggleViewer.desc"),hotkey:"Z"},{title:o("hotkeys.toggleGallery.title"),desc:o("hotkeys.toggleGallery.desc"),hotkey:"G"},{title:o("hotkeys.maximizeWorkSpace.title"),desc:o("hotkeys.maximizeWorkSpace.desc"),hotkey:"F"},{title:o("hotkeys.changeTabs.title"),desc:o("hotkeys.changeTabs.desc"),hotkey:"1-5"},{title:o("hotkeys.consoleToggle.title"),desc:o("hotkeys.consoleToggle.desc"),hotkey:"`"}],c=[{title:o("hotkeys.setPrompt.title"),desc:o("hotkeys.setPrompt.desc"),hotkey:"P"},{title:o("hotkeys.setSeed.title"),desc:o("hotkeys.setSeed.desc"),hotkey:"S"},{title:o("hotkeys.setParameters.title"),desc:o("hotkeys.setParameters.desc"),hotkey:"A"},{title:o("hotkeys.restoreFaces.title"),desc:o("hotkeys.restoreFaces.desc"),hotkey:"Shift+R"},{title:o("hotkeys.upscale.title"),desc:o("hotkeys.upscale.desc"),hotkey:"Shift+U"},{title:o("hotkeys.showInfo.title"),desc:o("hotkeys.showInfo.desc"),hotkey:"I"},{title:o("hotkeys.sendToImageToImage.title"),desc:o("hotkeys.sendToImageToImage.desc"),hotkey:"Shift+I"},{title:o("hotkeys.deleteImage.title"),desc:o("hotkeys.deleteImage.desc"),hotkey:"Del"},{title:o("hotkeys.closePanels.title"),desc:o("hotkeys.closePanels.desc"),hotkey:"Esc"}],u=[{title:o("hotkeys.previousImage.title"),desc:o("hotkeys.previousImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextImage.title"),desc:o("hotkeys.nextImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.toggleGalleryPin.title"),desc:o("hotkeys.toggleGalleryPin.desc"),hotkey:"Shift+G"},{title:o("hotkeys.increaseGalleryThumbSize.title"),desc:o("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys.decreaseGalleryThumbSize.title"),desc:o("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],f=[{title:o("hotkeys.selectBrush.title"),desc:o("hotkeys.selectBrush.desc"),hotkey:"B"},{title:o("hotkeys.selectEraser.title"),desc:o("hotkeys.selectEraser.desc"),hotkey:"E"},{title:o("hotkeys.decreaseBrushSize.title"),desc:o("hotkeys.decreaseBrushSize.desc"),hotkey:"["},{title:o("hotkeys.increaseBrushSize.title"),desc:o("hotkeys.increaseBrushSize.desc"),hotkey:"]"},{title:o("hotkeys.decreaseBrushOpacity.title"),desc:o("hotkeys.decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:o("hotkeys.increaseBrushOpacity.title"),desc:o("hotkeys.increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:o("hotkeys.moveTool.title"),desc:o("hotkeys.moveTool.desc"),hotkey:"V"},{title:o("hotkeys.fillBoundingBox.title"),desc:o("hotkeys.fillBoundingBox.desc"),hotkey:"Shift + F"},{title:o("hotkeys.eraseBoundingBox.title"),desc:o("hotkeys.eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:o("hotkeys.colorPicker.title"),desc:o("hotkeys.colorPicker.desc"),hotkey:"C"},{title:o("hotkeys.toggleSnap.title"),desc:o("hotkeys.toggleSnap.desc"),hotkey:"N"},{title:o("hotkeys.quickToggleMove.title"),desc:o("hotkeys.quickToggleMove.desc"),hotkey:"Hold Space"},{title:o("hotkeys.toggleLayer.title"),desc:o("hotkeys.toggleLayer.desc"),hotkey:"Q"},{title:o("hotkeys.clearMask.title"),desc:o("hotkeys.clearMask.desc"),hotkey:"Shift+C"},{title:o("hotkeys.hideMask.title"),desc:o("hotkeys.hideMask.desc"),hotkey:"H"},{title:o("hotkeys.showHideBoundingBox.title"),desc:o("hotkeys.showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:o("hotkeys.mergeVisible.title"),desc:o("hotkeys.mergeVisible.desc"),hotkey:"Shift+M"},{title:o("hotkeys.saveToGallery.title"),desc:o("hotkeys.saveToGallery.desc"),hotkey:"Shift+S"},{title:o("hotkeys.copyToClipboard.title"),desc:o("hotkeys.copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:o("hotkeys.downloadImage.title"),desc:o("hotkeys.downloadImage.desc"),hotkey:"Shift+D"},{title:o("hotkeys.undoStroke.title"),desc:o("hotkeys.undoStroke.desc"),hotkey:"Ctrl+Z"},{title:o("hotkeys.redoStroke.title"),desc:o("hotkeys.redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:o("hotkeys.resetView.title"),desc:o("hotkeys.resetView.desc"),hotkey:"R"},{title:o("hotkeys.previousStagingImage.title"),desc:o("hotkeys.previousStagingImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextStagingImage.title"),desc:o("hotkeys.nextStagingImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.acceptStagingImage.title"),desc:o("hotkeys.acceptStagingImage.desc"),hotkey:"Enter"}],h=p=>l.jsx(B,{flexDir:"column",gap:4,children:p.map((g,y)=>l.jsxs(B,{flexDir:"column",px:2,gap:4,children:[l.jsx(lO,{title:g.title,description:g.desc,hotkey:g.hotkey}),y-1}function $O(e,t){var n=this.__data__,r=$c(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<=ZA}var JA="[object Arguments]",ez="[object Array]",tz="[object Boolean]",nz="[object Date]",rz="[object Error]",oz="[object Function]",iz="[object Map]",az="[object Number]",sz="[object Object]",lz="[object RegExp]",cz="[object Set]",uz="[object String]",dz="[object WeakMap]",fz="[object ArrayBuffer]",hz="[object DataView]",pz="[object Float32Array]",mz="[object Float64Array]",vz="[object Int8Array]",gz="[object Int16Array]",xz="[object Int32Array]",yz="[object Uint8Array]",bz="[object Uint8ClampedArray]",Sz="[object Uint16Array]",Cz="[object Uint32Array]",Ct={};Ct[pz]=Ct[mz]=Ct[vz]=Ct[gz]=Ct[xz]=Ct[yz]=Ct[bz]=Ct[Sz]=Ct[Cz]=!0;Ct[JA]=Ct[ez]=Ct[fz]=Ct[tz]=Ct[hz]=Ct[nz]=Ct[rz]=Ct[oz]=Ct[iz]=Ct[az]=Ct[sz]=Ct[lz]=Ct[cz]=Ct[uz]=Ct[dz]=!1;function wz(e){return li(e)&&tb(e.length)&&!!Ct[si(e)]}function Fp(e){return function(t){return e(t)}}var nb=typeof exports=="object"&&exports&&!exports.nodeType&&exports,$a=nb&&typeof module=="object"&&module&&!module.nodeType&&module,kz=$a&&$a.exports===nb,Ud=kz&&U4.process,jz=function(){try{var e=$a&&$a.require&&$a.require("util").types;return e||Ud&&Ud.binding&&Ud.binding("util")}catch{}}();const na=jz;var Q0=na&&na.isTypedArray,Ez=Q0?Fp(Q0):wz;const Pz=Ez;var Iz=Object.prototype,Mz=Iz.hasOwnProperty;function rb(e,t){var n=Cs(e),r=!n&&VA(e),o=!n&&!r&&eb(e),s=!n&&!r&&!o&&Pz(e),c=n||r||o||s,u=c?FA(e.length,String):[],f=u.length;for(var h in e)(t||Mz.call(e,h))&&!(c&&(h=="length"||o&&(h=="offset"||h=="parent")||s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||QA(h,f)))&&u.push(h);return u}var Tz=Object.prototype;function Lp(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Tz;return e===n}var _z=G4(Object.keys,Object);const Dz=_z;var Oz=Object.prototype,Az=Oz.hasOwnProperty;function zz(e){if(!Lp(e))return Dz(e);var t=[];for(var n in Object(e))Az.call(e,n)&&n!="constructor"&&t.push(n);return t}function ob(e){return e!=null&&tb(e.length)&&!X4(e)}function Bp(e){return ob(e)?rb(e):zz(e)}function Rz(e,t){return e&&qc(t,Bp(t),e)}function Nz(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Fz=Object.prototype,Lz=Fz.hasOwnProperty;function Bz(e){if(!Ss(e))return Nz(e);var t=Lp(e),n=[];for(var r in e)r=="constructor"&&(t||!Lz.call(e,r))||n.push(r);return n}function Hp(e){return ob(e)?rb(e,!0):Bz(e)}function Hz(e,t){return e&&qc(t,Hp(t),e)}var ib=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Z0=ib&&typeof module=="object"&&module&&!module.nodeType&&module,Wz=Z0&&Z0.exports===ib,J0=Wz?kr.Buffer:void 0,e1=J0?J0.allocUnsafe:void 0;function Vz(e,t){if(t)return e.slice();var n=e.length,r=e1?e1(n):new e.constructor(n);return e.copy(r),r}function ab(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n=0)&&(n[o]=e[o]);return n}function v1(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var g1=function(t){return Array.isArray(t)&&t.length===0},wn=function(t){return typeof t=="function"},Yc=function(t){return t!==null&&typeof t=="object"},HN=function(t){return String(Math.floor(Number(t)))===t},$d=function(t){return Object.prototype.toString.call(t)==="[object String]"},gb=function(t){return x.Children.count(t)===0},Gd=function(t){return Yc(t)&&wn(t.then)};function rn(e,t,n,r){r===void 0&&(r=0);for(var o=vb(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 xb(e,t,n,r){n===void 0&&(n=new WeakMap),r===void 0&&(r={});for(var o=0,s=Object.keys(e);o0?de.map(function(je){return z(je,rn(N,je))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(xe).then(function(je){return je.reduce(function(q,se,Fe){return se==="DO_NOT_DELETE_YOU_WILL_BE_FIRED"||se&&(q=br(q,de[Fe],se)),q},{})})},[z]),F=x.useCallback(function(N){return Promise.all([V(N),y.validationSchema?_(N):{},y.validate?D(N):{}]).then(function(de){var xe=de[0],je=de[1],q=de[2],se=$f.all([xe,je,q],{arrayMerge:qN});return se})},[y.validate,y.validationSchema,V,D,_]),L=Bn(function(N){return N===void 0&&(N=I.values),T({type:"SET_ISVALIDATING",payload:!0}),F(N).then(function(de){return j.current&&(T({type:"SET_ISVALIDATING",payload:!1}),T({type:"SET_ERRORS",payload:de})),de})});x.useEffect(function(){c&&j.current===!0&&ro(S.current,y.initialValues)&&L(S.current)},[c,L]);var X=x.useCallback(function(N){var de=N&&N.values?N.values:S.current,xe=N&&N.errors?N.errors:C.current?C.current:y.initialErrors||{},je=N&&N.touched?N.touched:w.current?w.current:y.initialTouched||{},q=N&&N.status?N.status:k.current?k.current:y.initialStatus;S.current=de,C.current=xe,w.current=je,k.current=q;var se=function(){T({type:"RESET_FORM",payload:{isSubmitting:!!N&&!!N.isSubmitting,errors:xe,touched:je,status:q,values:de,isValidating:!!N&&!!N.isValidating,submitCount:N&&N.submitCount&&typeof N.submitCount=="number"?N.submitCount:0}})};if(y.onReset){var Fe=y.onReset(I.values,ve);Gd(Fe)?Fe.then(se):se()}else se()},[y.initialErrors,y.initialStatus,y.initialTouched]);x.useEffect(function(){j.current===!0&&!ro(S.current,y.initialValues)&&(h&&(S.current=y.initialValues,X()),c&&L(S.current))},[h,y.initialValues,X,c,L]),x.useEffect(function(){h&&j.current===!0&&!ro(C.current,y.initialErrors)&&(C.current=y.initialErrors||Ao,T({type:"SET_ERRORS",payload:y.initialErrors||Ao}))},[h,y.initialErrors]),x.useEffect(function(){h&&j.current===!0&&!ro(w.current,y.initialTouched)&&(w.current=y.initialTouched||Fl,T({type:"SET_TOUCHED",payload:y.initialTouched||Fl}))},[h,y.initialTouched]),x.useEffect(function(){h&&j.current===!0&&!ro(k.current,y.initialStatus)&&(k.current=y.initialStatus,T({type:"SET_STATUS",payload:y.initialStatus}))},[h,y.initialStatus,y.initialTouched]);var $=Bn(function(N){if(M.current[N]&&wn(M.current[N].validate)){var de=rn(I.values,N),xe=M.current[N].validate(de);return Gd(xe)?(T({type:"SET_ISVALIDATING",payload:!0}),xe.then(function(je){return je}).then(function(je){T({type:"SET_FIELD_ERROR",payload:{field:N,value:je}}),T({type:"SET_ISVALIDATING",payload:!1})})):(T({type:"SET_FIELD_ERROR",payload:{field:N,value:xe}}),Promise.resolve(xe))}else if(y.validationSchema)return T({type:"SET_ISVALIDATING",payload:!0}),_(I.values,N).then(function(je){return je}).then(function(je){T({type:"SET_FIELD_ERROR",payload:{field:N,value:je[N]}}),T({type:"SET_ISVALIDATING",payload:!1})});return Promise.resolve()}),Q=x.useCallback(function(N,de){var xe=de.validate;M.current[N]={validate:xe}},[]),re=x.useCallback(function(N){delete M.current[N]},[]),ie=Bn(function(N,de){T({type:"SET_TOUCHED",payload:N});var xe=de===void 0?o:de;return xe?L(I.values):Promise.resolve()}),U=x.useCallback(function(N){T({type:"SET_ERRORS",payload:N})},[]),K=Bn(function(N,de){var xe=wn(N)?N(I.values):N;T({type:"SET_VALUES",payload:xe});var je=de===void 0?n:de;return je?L(xe):Promise.resolve()}),ne=x.useCallback(function(N,de){T({type:"SET_FIELD_ERROR",payload:{field:N,value:de}})},[]),ce=Bn(function(N,de,xe){T({type:"SET_FIELD_VALUE",payload:{field:N,value:de}});var je=xe===void 0?n:xe;return je?L(br(I.values,N,de)):Promise.resolve()}),Re=x.useCallback(function(N,de){var xe=de,je=N,q;if(!$d(N)){N.persist&&N.persist();var se=N.target?N.target:N.currentTarget,Fe=se.type,Ze=se.name,ee=se.id,He=se.value,nt=se.checked,Ft=se.outerHTML,pe=se.options,De=se.multiple;xe=de||Ze||ee,je=/number|range/.test(Fe)?(q=parseFloat(He),isNaN(q)?"":q):/checkbox/.test(Fe)?XN(rn(I.values,xe),nt,He):pe&&De?YN(pe):He}xe&&ce(xe,je)},[ce,I.values]),ze=Bn(function(N){if($d(N))return function(de){return Re(de,N)};Re(N)}),Me=Bn(function(N,de,xe){de===void 0&&(de=!0),T({type:"SET_FIELD_TOUCHED",payload:{field:N,value:de}});var je=xe===void 0?o:xe;return je?L(I.values):Promise.resolve()}),J=x.useCallback(function(N,de){N.persist&&N.persist();var xe=N.target,je=xe.name,q=xe.id,se=xe.outerHTML,Fe=de||je||q;Me(Fe,!0)},[Me]),ue=Bn(function(N){if($d(N))return function(de){return J(de,N)};J(N)}),Ie=x.useCallback(function(N){wn(N)?T({type:"SET_FORMIK_STATE",payload:N}):T({type:"SET_FORMIK_STATE",payload:function(){return N}})},[]),Be=x.useCallback(function(N){T({type:"SET_STATUS",payload:N})},[]),Ne=x.useCallback(function(N){T({type:"SET_ISSUBMITTING",payload:N})},[]),Ge=Bn(function(){return T({type:"SUBMIT_ATTEMPT"}),L().then(function(N){var de=N instanceof Error,xe=!de&&Object.keys(N).length===0;if(xe){var je;try{if(je=_e(),je===void 0)return}catch(q){throw q}return Promise.resolve(je).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"}),de))throw N})}),Qe=Bn(function(N){N&&N.preventDefault&&wn(N.preventDefault)&&N.preventDefault(),N&&N.stopPropagation&&wn(N.stopPropagation)&&N.stopPropagation(),Ge().catch(function(de){console.warn("Warning: An unhandled error was caught from submitForm()",de)})}),ve={resetForm:X,validateForm:L,validateField:$,setErrors:U,setFieldError:ne,setFieldTouched:Me,setFieldValue:ce,setStatus:Be,setSubmitting:Ne,setTouched:ie,setValues:K,setFormikState:Ie,submitForm:Ge},_e=Bn(function(){return p(I.values,ve)}),qe=Bn(function(N){N&&N.preventDefault&&wn(N.preventDefault)&&N.preventDefault(),N&&N.stopPropagation&&wn(N.stopPropagation)&&N.stopPropagation(),X()}),ge=x.useCallback(function(N){return{value:rn(I.values,N),error:rn(I.errors,N),touched:!!rn(I.touched,N),initialValue:rn(S.current,N),initialTouched:!!rn(w.current,N),initialError:rn(C.current,N)}},[I.errors,I.touched,I.values]),Te=x.useCallback(function(N){return{setValue:function(xe,je){return ce(N,xe,je)},setTouched:function(xe,je){return Me(N,xe,je)},setError:function(xe){return ne(N,xe)}}},[ce,Me,ne]),et=x.useCallback(function(N){var de=Yc(N),xe=de?N.name:N,je=rn(I.values,xe),q={name:xe,value:je,onChange:ze,onBlur:ue};if(de){var se=N.type,Fe=N.value,Ze=N.as,ee=N.multiple;se==="checkbox"?Fe===void 0?q.checked=!!je:(q.checked=!!(Array.isArray(je)&&~je.indexOf(Fe)),q.value=Fe):se==="radio"?(q.checked=je===Fe,q.value=Fe):Ze==="select"&&ee&&(q.value=q.value||[],q.multiple=!0)}return q},[ue,ze,I.values]),Ve=x.useMemo(function(){return!ro(S.current,I.values)},[S.current,I.values]),vt=x.useMemo(function(){return typeof u<"u"?Ve?I.errors&&Object.keys(I.errors).length===0:u!==!1&&wn(u)?u(y):u:I.errors&&Object.keys(I.errors).length===0},[u,Ve,I.errors,y]),Nt=ht({},I,{initialValues:S.current,initialErrors:C.current,initialTouched:w.current,initialStatus:k.current,handleBlur:ue,handleChange:ze,handleReset:qe,handleSubmit:Qe,resetForm:X,setErrors:U,setFormikState:Ie,setFieldTouched:Me,setFieldValue:ce,setFieldError:ne,setStatus:Be,setSubmitting:Ne,setTouched:ie,setValues:K,submitForm:Ge,validateForm:L,validateField:$,isValid:vt,dirty:Ve,unregisterField:re,registerField:Q,getFieldProps:et,getFieldMeta:ge,getFieldHelpers:Te,validateOnBlur:o,validateOnChange:n,validateOnMount:c});return Nt}function ws(e){var t=UN(e),n=e.component,r=e.children,o=e.render,s=e.innerRef;return x.useImperativeHandle(s,function(){return t}),x.createElement(WN,{value:t},n?x.createElement(n,t):o?o(t):r?wn(r)?r(t):gb(r)?null:x.Children.only(r):null)}function $N(e){var t={};if(e.inner){if(e.inner.length===0)return br(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;rn(t,c.path)||(t=br(t,c.path,c.message))}}return t}function GN(e,t,n,r){n===void 0&&(n=!1),r===void 0&&(r={});var o=Kf(e);return t[n?"validateSync":"validate"](o,{abortEarly:!1,context:r})}function Kf(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||$0(o)?Kf(o):o!==""?o:void 0}):$0(e[r])?t[r]=Kf(e[r]):t[r]=e[r]!==""?e[r]:void 0}return t}function qN(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?$f(Array.isArray(s)?[]:{},s,n):s}else n.isMergeableObject(s)?r[c]=$f(e[c],s,n):e.indexOf(s)===-1&&r.push(s)}),r}function YN(e){return Array.from(e).filter(function(t){return t.selected}).map(function(t){return t.value})}function XN(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 KN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?x.useLayoutEffect:x.useEffect;function Bn(e){var t=x.useRef(e);return KN(function(){t.current=e}),x.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[]},tF=function(e){BN(t,e);function t(r){var o;return o=e.call(this,r)||this,o.updateArrayField=function(s,c,u){var f=o.props,h=f.name,p=f.formik.setFormikState;p(function(g){var y=typeof u=="function"?u:s,S=typeof c=="function"?c:s,C=br(g.values,h,s(rn(g.values,h))),w=u?y(rn(g.errors,h)):void 0,k=c?S(rn(g.touched,h)):void 0;return g1(w)&&(w=void 0),g1(k)&&(k=void 0),ht({},g,{values:C,errors:u?br(g.errors,h,w):g.errors,touched:c?br(g.touched,h,k):g.touched})})},o.push=function(s){return o.updateArrayField(function(c){return[].concat(ra(c),[LN(s)])},!1,!1)},o.handlePush=function(s){return function(){return o.push(s)}},o.swap=function(s,c){return o.updateArrayField(function(u){return JN(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 ZN(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 qd(u,s,c)},function(u){return qd(u,s,null)},function(u){return qd(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 eF(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(v1(o)),o.pop=o.pop.bind(v1(o)),o}var n=t.prototype;return n.componentDidUpdate=function(o){this.props.validateOnChange&&this.props.formik.validateOnChange&&!ro(rn(o.formik.values,o.name),rn(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?ra(c):[];return s||(s=u[o]),wn(u.splice)&&u.splice(o,1),u},!0,!0),s},n.pop=function(){var o;return this.updateArrayField(function(s){var c=s;return o||(o=c&&c.pop&&c.pop()),c},!0,!0),o},n.render=function(){var o={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},s=this.props,c=s.component,u=s.render,f=s.children,h=s.name,p=s.formik,g=Bo(p,["validate","validationSchema"]),y=ht({},o,{form:g,name:h});return c?x.createElement(c,y):u?u(y):f?typeof f=="function"?f(y):gb(f)?null:x.Children.only(f):null},t}(x.Component);tF.defaultProps={validateOnChange:!0};function nF(e){const{model:t}=e,r=O(C=>C.system.model_list)[t],o=Y(),{t:s}=Z(),c=O(C=>C.system.isProcessing),u=O(C=>C.system.isConnected),[f,h]=x.useState("same"),[p,g]=x.useState("");x.useEffect(()=>{h("same")},[t]);const y=()=>{h("same")},S=()=>{o(n3({model_name:t,save_location:f,custom_location:f==="custom"&&p!==""?p:null}))};return l.jsxs(Wc,{title:`${s("modelManager.convert")} ${t}`,acceptCallback:S,cancelCallback:y,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(mx,{children:[l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText2")}),l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText3")}),l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText4")}),l.jsx(Fa,{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(Ja,{value:f,onChange:C=>h(C),children:l.jsxs(B,{gap:4,children:[l.jsx(jn,{value:"same",children:l.jsx(Yt,{label:"Save converted model in the same folder",children:s("modelManager.sameFolder")})}),l.jsx(jn,{value:"root",children:l.jsx(Yt,{label:"Save converted model in the InvokeAI root folder",children:s("modelManager.invokeRoot")})}),l.jsx(jn,{value:"custom",children:l.jsx(Yt,{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:p,onChange:C=>{C.target.value!==""&&g(C.target.value)},width:"full"})]})]})]})}const rF=be([Pt],e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),x1=64,y1=2048;function oF(){const{openModel:e,model_list:t}=O(rF),n=O(f=>f.system.isProcessing),r=Y(),{t:o}=Z(),[s,c]=x.useState({name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,default:!1,format:"ckpt"});x.useEffect(()=>{var f,h,p,g,y,S,C;if(e){const w=te.pickBy(t,(k,j)=>te.isEqual(j,e));c({name:e,description:(f=w[e])==null?void 0:f.description,config:(h=w[e])==null?void 0:h.config,weights:(p=w[e])==null?void 0:p.weights,vae:(g=w[e])==null?void 0:g.vae,width:(y=w[e])==null?void 0:y.width,height:(S=w[e])==null?void 0:S.height,default:(C=w[e])==null?void 0:C.default,format:"ckpt"})}},[t,e]);const u=f=>{r(ls({...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(nF,{model:e})]}),l.jsx(B,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",paddingInlineEnd:8,children:l.jsx(ws,{enableReinitialize:!0,initialValues:s,onSubmit:u,children:({handleSubmit:f,errors:h,touched:p})=>l.jsx("form",{onSubmit:f,children:l.jsxs(Le,{rowGap:2,alignItems:"start",children:[l.jsxs(rt,{isInvalid:!!h.description&&p.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:o("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),h.description&&p.description?l.jsx(kt,{children:h.description}):l.jsx(wt,{margin:0,children:o("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.config&&p.config,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:o("modelManager.config")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"config",name:"config",type:"text",width:"full"}),h.config&&p.config?l.jsx(kt,{children:h.config}):l.jsx(wt,{margin:0,children:o("modelManager.configValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.weights&&p.weights,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:o("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"weights",name:"weights",type:"text",width:"full"}),h.weights&&p.weights?l.jsx(kt,{children:h.weights}):l.jsx(wt,{margin:0,children:o("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.vae&&p.vae,children:[l.jsx(st,{htmlFor:"vae",fontSize:"sm",children:o("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae",name:"vae",type:"text",width:"full"}),h.vae&&p.vae?l.jsx(kt,{children:h.vae}):l.jsx(wt,{margin:0,children:o("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(sa,{width:"100%",children:[l.jsxs(rt,{isInvalid:!!h.width&&p.width,children:[l.jsx(st,{htmlFor:"width",fontSize:"sm",children:o("modelManager.width")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"width",name:"width",children:({field:g,form:y})=>l.jsx(Lr,{id:"width",name:"width",min:x1,max:y1,step:64,value:y.values.width,onChange:S=>y.setFieldValue(g.name,Number(S))})}),h.width&&p.width?l.jsx(kt,{children:h.width}):l.jsx(wt,{margin:0,children:o("modelManager.widthValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.height&&p.height,children:[l.jsx(st,{htmlFor:"height",fontSize:"sm",children:o("modelManager.height")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"height",name:"height",children:({field:g,form:y})=>l.jsx(Lr,{id:"height",name:"height",min:x1,max:y1,step:64,value:y.values.height,onChange:S=>y.setFieldValue(g.name,Number(S))})}),h.height&&p.height?l.jsx(kt,{children:h.height}):l.jsx(wt,{margin:0,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 iF=be([Pt],e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function aF(){const{openModel:e,model_list:t}=O(iF),n=O(f=>f.system.isProcessing),r=Y(),{t:o}=Z(),[s,c]=x.useState({name:"",description:"",repo_id:"",path:"",vae:{repo_id:"",path:""},default:!1,format:"diffusers"});x.useEffect(()=>{var f,h,p,g,y,S,C,w,k,j,M,P,I,T,D,_;if(e){const z=te.pickBy(t,(V,F)=>te.isEqual(F,e));c({name:e,description:(f=z[e])==null?void 0:f.description,path:(h=z[e])!=null&&h.path&&((p=z[e])==null?void 0:p.path)!=="None"?(g=z[e])==null?void 0:g.path:"",repo_id:(y=z[e])!=null&&y.repo_id&&((S=z[e])==null?void 0:S.repo_id)!=="None"?(C=z[e])==null?void 0:C.repo_id:"",vae:{repo_id:(k=(w=z[e])==null?void 0:w.vae)!=null&&k.repo_id?(M=(j=z[e])==null?void 0:j.vae)==null?void 0:M.repo_id:"",path:(I=(P=z[e])==null?void 0:P.vae)!=null&&I.path?(D=(T=z[e])==null?void 0:T.vae)==null?void 0:D.path:""},default:(_=z[e])==null?void 0:_.default,format:"diffusers"})}},[t,e]);const u=f=>{const h=f;f.path===""&&delete h.path,f.repo_id===""&&delete h.repo_id,f.vae.path===""&&delete h.vae.path,f.vae.repo_id===""&&delete h.vae.repo_id,r(ls(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(ws,{enableReinitialize:!0,initialValues:s,onSubmit:u,children:({handleSubmit:f,errors:h,touched:p})=>{var g,y,S,C,w,k,j,M,P,I;return l.jsx("form",{onSubmit:f,children:l.jsxs(Le,{rowGap:2,alignItems:"start",children:[l.jsxs(rt,{isInvalid:!!h.description&&p.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:o("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),h.description&&p.description?l.jsx(kt,{children:h.description}):l.jsx(wt,{margin:0,children:o("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.path&&p.path,isRequired:!0,children:[l.jsx(st,{htmlFor:"path",fontSize:"sm",children:o("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"path",name:"path",type:"text",width:"full"}),h.path&&p.path?l.jsx(kt,{children:h.path}):l.jsx(wt,{margin:0,children:o("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.repo_id&&p.repo_id,children:[l.jsx(st,{htmlFor:"repo_id",fontSize:"sm",children:o("modelManager.repo_id")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"repo_id",name:"repo_id",type:"text",width:"full"}),h.repo_id&&p.repo_id?l.jsx(kt,{children:h.repo_id}):l.jsx(wt,{margin:0,children:o("modelManager.repoIDValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((g=h.vae)!=null&&g.path)&&((y=p.vae)==null?void 0:y.path),children:[l.jsx(st,{htmlFor:"vae.path",fontSize:"sm",children:o("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.path",name:"vae.path",type:"text",width:"full"}),(S=h.vae)!=null&&S.path&&((C=p.vae)!=null&&C.path)?l.jsx(kt,{children:(w=h.vae)==null?void 0:w.path}):l.jsx(wt,{margin:0,children:o("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((k=h.vae)!=null&&k.repo_id)&&((j=p.vae)==null?void 0:j.repo_id),children:[l.jsx(st,{htmlFor:"vae.repo_id",fontSize:"sm",children:o("modelManager.vaeRepoID")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"full"}),(M=h.vae)!=null&&M.repo_id&&((P=p.vae)!=null&&P.repo_id)?l.jsx(kt,{children:(I=h.vae)==null?void 0:I.repo_id}):l.jsx(wt,{margin:0,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 bb=be([Pt],e=>{const{model_list:t}=e,n=[];return te.forEach(t,r=>{n.push(r.weights)}),n});function b1({model:e,modelsToAdd:t,setModelsToAdd:n}){const{t:r}=Z(),o=O(bb),s=c=>{t.includes(c.target.value)?n(te.remove(t,u=>u!==c.target.value)):n([...t,c.target.value])};return l.jsx(Le,{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(yx,{colorScheme:"accent",children:r("modelManager.modelExists")})]}),l.jsx(Ce,{fontStyle:"italic",variant:"subtext",children:e.location})]})})}function sF(){const e=Y(),{t}=Z(),n=O(P=>P.system.searchFolder),r=O(P=>P.system.foundModels),o=O(bb),s=O(P=>P.ui.shouldShowExistingModelsInSearch),c=O(P=>P.system.isProcessing),[u,f]=ke.useState([]),[h,p]=ke.useState("v1"),[g,y]=ke.useState(""),S=()=>{e(o3(null)),e(i3(null)),f([])},C=P=>{e(Qv(P.checkpointFolder))},w=()=>{f([]),r&&r.forEach(P=>{o.includes(P.location)||f(I=>[...I,P.name])})},k=()=>{f([])},j=()=>{const P=r==null?void 0:r.filter(T=>u.includes(T.name)),I={v1:"configs/stable-diffusion/v1-inference.yaml",v2:"configs/stable-diffusion/v2-inference-v.yaml",inpainting:"configs/stable-diffusion/v1-inpainting-inference.yaml",custom:g};P==null||P.forEach(T=>{const D={name:T.name,description:"",config:I[h],weights:T.location,vae:"",width:512,height:512,default:!1,format:"ckpt"};e(ls(D))}),f([])},M=()=>{const P=[],I=[];return r&&r.forEach((T,D)=>{o.includes(T.location)?I.push(l.jsx(b1,{model:T,modelsToAdd:u,setModelsToAdd:f},D)):P.push(l.jsx(b1,{model:T,modelsToAdd:u,setModelsToAdd:f},D))}),l.jsxs(l.Fragment,{children:[P,s&&I]})};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(jc,{}),l.jsx(le,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:l.jsx(Jh,{}),fontSize:18,disabled:c,onClick:()=>e(Qv(n))}),l.jsx(le,{"aria-label":t("modelManager.clearCheckpointFolder"),icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),onClick:S})]}):l.jsx(ws,{initialValues:{checkpointFolder:""},onSubmit:P=>{C(P)},children:({handleSubmit:P})=>l.jsx("form",{onSubmit:P,children:l.jsxs(sa,{columnGap:2,alignItems:"flex-end",width:"100%",children:[l.jsx(rt,{isRequired:!0,width:"lg",children:l.jsx(jt,{as:mt,id:"checkpointFolder",name:"checkpointFolder",type:"text",size:"md",label:t("modelManager.checkpointFolder")})}),l.jsx(Je,{leftIcon:l.jsx(q8,{}),"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:w,children:t("modelManager.selectAll")}),l.jsx(Je,{isDisabled:u.length===0,onClick:k,children:t("modelManager.deselectAll")}),l.jsx(pt,{label:t("modelManager.showExisting"),isChecked:s,onChange:()=>e(r3(!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(Ja,{value:h,onChange:P=>p(P),defaultValue:"v1",name:"model_type",children:l.jsxs(B,{gap:4,children:[l.jsx(jn,{value:"v1",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v1")})}),l.jsx(jn,{value:"v2",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v2")})}),l.jsx(jn,{value:"inpainting",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.inpainting")})}),l.jsx(jn,{value:"custom",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.customConfig")})})]})})]}),h==="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:g,onChange:P=>{P.target.value!==""&&y(P.target.value)},width:"full"})]})]}),l.jsx(B,{flexDirection:"column",maxHeight:72,overflowY:"scroll",borderRadius:"sm",paddingInlineEnd:4,gap:2,children:r.length>0?M():l.jsx(Ce,{fontWeight:"500",padding:2,borderRadius:"sm",textAlign:"center",variant:"subtext",children:t("modelManager.noModelsFound")})})]})]})}const S1=64,C1=2048;function lF(){const e=Y(),{t}=Z(),n=O(h=>h.system.isProcessing);function r(h){return/\s/.test(h)}function o(h){let p;return r(h)&&(p=t("modelManager.cannotUseSpaces")),p}const s={name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,format:"ckpt",default:!1},c=h=>{e(ls(h)),e(Vo(null))},[u,f]=ke.useState(!1);return l.jsxs(Le,{gap:2,alignItems:"flex-start",children:[l.jsx(le,{"aria-label":t("common.back"),tooltip:t("common.back"),onClick:()=>e(Vo(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",insetInlineEnd:12,top:3,icon:l.jsx(by,{})}),l.jsx(sF,{}),l.jsx(pt,{label:t("modelManager.addManually"),isChecked:u,onChange:()=>f(!u)}),u&&l.jsx(ws,{initialValues:s,onSubmit:c,children:({handleSubmit:h,errors:p,touched:g})=>l.jsx("form",{onSubmit:h,children:l.jsxs(Le,{rowGap:2,children:[l.jsx(Ce,{fontSize:20,fontWeight:"bold",alignSelf:"start",children:t("modelManager.manual")}),l.jsxs(rt,{isInvalid:!!p.name&&g.name,isRequired:!0,children:[l.jsx(st,{htmlFor:"name",fontSize:"sm",children:t("modelManager.name")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"name",name:"name",type:"text",validate:o,width:"2xl"}),p.name&&g.name?l.jsx(kt,{children:p.name}):l.jsx(wt,{margin:0,children:t("modelManager.nameValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.description&&g.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:t("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"2xl"}),p.description&&g.description?l.jsx(kt,{children:p.description}):l.jsx(wt,{margin:0,children:t("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.config&&g.config,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:t("modelManager.config")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"config",name:"config",type:"text",width:"2xl"}),p.config&&g.config?l.jsx(kt,{children:p.config}):l.jsx(wt,{margin:0,children:t("modelManager.configValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.weights&&g.weights,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:t("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"weights",name:"weights",type:"text",width:"2xl"}),p.weights&&g.weights?l.jsx(kt,{children:p.weights}):l.jsx(wt,{margin:0,children:t("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.vae&&g.vae,children:[l.jsx(st,{htmlFor:"vae",fontSize:"sm",children:t("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae",name:"vae",type:"text",width:"2xl"}),p.vae&&g.vae?l.jsx(kt,{children:p.vae}):l.jsx(wt,{margin:0,children:t("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(sa,{width:"100%",children:[l.jsxs(rt,{isInvalid:!!p.width&&g.width,children:[l.jsx(st,{htmlFor:"width",fontSize:"sm",children:t("modelManager.width")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"width",name:"width",children:({field:y,form:S})=>l.jsx(Lr,{id:"width",name:"width",min:S1,max:C1,step:64,width:"90%",value:S.values.width,onChange:C=>S.setFieldValue(y.name,Number(C))})}),p.width&&g.width?l.jsx(kt,{children:p.width}):l.jsx(wt,{margin:0,children:t("modelManager.widthValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.height&&g.height,children:[l.jsx(st,{htmlFor:"height",fontSize:"sm",children:t("modelManager.height")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"height",name:"height",children:({field:y,form:S})=>l.jsx(Lr,{id:"height",name:"height",min:S1,max:C1,width:"90%",step:64,value:S.values.height,onChange:C=>S.setFieldValue(y.name,Number(C))})}),p.height&&g.height?l.jsx(kt,{children:p.height}):l.jsx(wt,{margin:0,children:t("modelManager.heightValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:t("modelManager.addModel")})]})})})]})}function Ll({children:e}){return l.jsx(B,{sx:{flexDirection:"column",padding:4,rowGap:4,borderRadius:"base",width:"full",bg:"base.900"},children:e})}function cF(){const e=Y(),{t}=Z(),n=O(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(ls(f)),e(Vo(null))};return l.jsxs(B,{children:[l.jsx(le,{"aria-label":t("common.back"),tooltip:t("common.back"),onClick:()=>e(Vo(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",insetInlineEnd:12,top:3,icon:l.jsx(by,{})}),l.jsx(ws,{initialValues:s,onSubmit:c,children:({handleSubmit:u,errors:f,touched:h})=>{var p,g,y,S,C,w,k,j,M,P;return l.jsx("form",{onSubmit:u,children:l.jsxs(Le,{rowGap:2,children:[l.jsx(Ll,{children:l.jsxs(rt,{isInvalid:!!f.name&&h.name,isRequired:!0,children:[l.jsx(st,{htmlFor:"name",fontSize:"sm",children:t("modelManager.name")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"name",name:"name",type:"text",validate:o,width:"2xl",isRequired:!0}),f.name&&h.name?l.jsx(kt,{children:f.name}):l.jsx(wt,{margin:0,children:t("modelManager.nameValidationMsg")})]})]})}),l.jsx(Ll,{children:l.jsxs(rt,{isInvalid:!!f.description&&h.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:t("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"2xl",isRequired:!0}),f.description&&h.description?l.jsx(kt,{children:f.description}):l.jsx(wt,{margin:0,children:t("modelManager.descriptionValidationMsg")})]})]})}),l.jsxs(Ll,{children:[l.jsx(Ce,{fontWeight:"bold",fontSize:"sm",children:t("modelManager.formMessageDiffusersModelLocation")}),l.jsx(Ce,{sx:{fontSize:"sm",fontStyle:"italic"},variant:"subtext",children:t("modelManager.formMessageDiffusersModelLocationDesc")}),l.jsxs(rt,{isInvalid:!!f.path&&h.path,children:[l.jsx(st,{htmlFor:"path",fontSize:"sm",children:t("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"path",name:"path",type:"text",width:"2xl"}),f.path&&h.path?l.jsx(kt,{children:f.path}):l.jsx(wt,{margin:0,children:t("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!f.repo_id&&h.repo_id,children:[l.jsx(st,{htmlFor:"repo_id",fontSize:"sm",children:t("modelManager.repo_id")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"repo_id",name:"repo_id",type:"text",width:"2xl"}),f.repo_id&&h.repo_id?l.jsx(kt,{children:f.repo_id}):l.jsx(wt,{margin:0,children:t("modelManager.repoIDValidationMsg")})]})]})]}),l.jsxs(Ll,{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:!!((p=f.vae)!=null&&p.path)&&((g=h.vae)==null?void 0:g.path),children:[l.jsx(st,{htmlFor:"vae.path",fontSize:"sm",children:t("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.path",name:"vae.path",type:"text",width:"2xl"}),(y=f.vae)!=null&&y.path&&((S=h.vae)!=null&&S.path)?l.jsx(kt,{children:(C=f.vae)==null?void 0:C.path}):l.jsx(wt,{margin:0,children:t("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((w=f.vae)!=null&&w.repo_id)&&((k=h.vae)==null?void 0:k.repo_id),children:[l.jsx(st,{htmlFor:"vae.repo_id",fontSize:"sm",children:t("modelManager.vaeRepoID")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"2xl"}),(j=f.vae)!=null&&j.repo_id&&((M=h.vae)!=null&&M.repo_id)?l.jsx(kt,{children:(P=f.vae)==null?void 0:P.repo_id}):l.jsx(wt,{margin:0,children:t("modelManager.vaeRepoIDValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",isLoading:n,children:t("modelManager.addModel")})]})})}})]})}function w1({text:e,onClick:t}){return l.jsx(B,{position:"relative",width:"50%",height:40,justifyContent:"center",alignItems:"center",onClick:t,as:ni,children:l.jsx(Ce,{fontWeight:"bold",children:e})})}function uF(){const{isOpen:e,onOpen:t,onClose:n}=uo(),r=O(u=>u.ui.addNewModelUIOption),o=Y(),{t:s}=Z(),c=()=>{n(),o(Vo(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(xs,{}),s("modelManager.addNew")]})}),l.jsxs(fo,{isOpen:e,onClose:c,size:"3xl",closeOnOverlayClick:!1,children:[l.jsx(Nr,{}),l.jsxs(ho,{margin:"auto",paddingInlineEnd:4,children:[l.jsx(Rr,{children:s("modelManager.addNewModel")}),l.jsx(ca,{}),l.jsxs(Fr,{children:[r==null&&l.jsxs(B,{columnGap:4,children:[l.jsx(w1,{text:s("modelManager.addCheckpointModel"),onClick:()=>o(Vo("ckpt"))}),l.jsx(w1,{text:s("modelManager.addDiffuserModel"),onClick:()=>o(Vo("diffusers"))})]}),r=="ckpt"&&l.jsx(lF,{}),r=="diffusers"&&l.jsx(cF,{})]}),l.jsx(zr,{})]})]})]})}function Bl(e){const{isProcessing:t,isConnected:n}=O(S=>S.system),r=O(S=>S.system.openModel),{t:o}=Z(),s=Y(),{name:c,status:u,description:f}=e,h=()=>{s(f2(c))},p=()=>{s(Zv(c))},g=()=>{s(a3(c)),s(Zv(null))},y=()=>{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(We,{onClick:p,cursor:"pointer",children:l.jsx(Yt,{label:f,hasArrow:!0,placement:"bottom",children:l.jsx(Ce,{fontWeight:"600",children:c})})}),l.jsx(jc,{onClick:p,cursor:"pointer"}),l.jsxs(B,{gap:2,alignItems:"center",children:[l.jsx(Ce,{color:y(),children:u}),l.jsx(ni,{size:"sm",onClick:h,isDisabled:u==="active"||t||!n,children:o("modelManager.load")}),l.jsx(le,{icon:l.jsx(F9,{}),size:"sm",onClick:p,"aria-label":"Modify Config",isDisabled:u==="active"||t||!n}),l.jsx(Wc,{title:o("modelManager.deleteModel"),acceptCallback:g,acceptButtonText:o("modelManager.delete"),triggerComponent:l.jsx(le,{icon:l.jsx(L9,{}),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 dF(){const e=Y(),{isOpen:t,onOpen:n,onClose:r}=uo(),o=O(s8),{t:s}=Z(),[c,u]=x.useState(Object.keys(o)[0]),[f,h]=x.useState(Object.keys(o)[1]),[p,g]=x.useState("none"),[y,S]=x.useState(""),[C,w]=x.useState(.5),[k,j]=x.useState("weighted_sum"),[M,P]=x.useState("root"),[I,T]=x.useState(""),[D,_]=x.useState(!1),z=Object.keys(o).filter($=>$!==f&&$!==p),V=Object.keys(o).filter($=>$!==c&&$!==p),F=[{key:s("modelManager.none"),value:"none"},...Object.keys(o).filter($=>$!==c&&$!==f).map($=>({key:$,value:$}))],L=O($=>$.system.isProcessing),X=()=>{let $=[c,f,p];$=$.filter(re=>re!=="none");const Q={models_to_merge:$,merged_model_name:y!==""?y:$.join("-"),alpha:C,interp:k,model_merge_save_path:M==="root"?null:I,force:D};e(s3(Q))};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(fo,{isOpen:t,onClose:r,size:"4xl",closeOnOverlayClick:!1,children:[l.jsx(Nr,{}),l.jsxs(ho,{fontFamily:"Inter",margin:"auto",paddingInlineEnd:4,children:[l.jsx(Rr,{children:s("modelManager.mergeModels")}),l.jsx(ca,{}),l.jsx(Fr,{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:z,onChange:$=>u($.target.value)}),l.jsx(Mn,{label:s("modelManager.modelTwo"),validValues:V,onChange:$=>h($.target.value)}),l.jsx(Mn,{label:s("modelManager.modelThree"),validValues:F,onChange:$=>{$.target.value!=="none"?(g($.target.value),j("add_difference")):(g("none"),j("weighted_sum"))}})]}),l.jsx(mt,{label:s("modelManager.mergedModelName"),value:y,onChange:$=>S($.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:$=>w($),withInput:!0,withReset:!0,handleReset:()=>w(.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(Ja,{value:k,onChange:$=>j($),children:l.jsx(B,{columnGap:4,children:p==="none"?l.jsxs(l.Fragment,{children:[l.jsx(jn,{value:"weighted_sum",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.weightedSum")})}),l.jsx(jn,{value:"sigmoid",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.sigmoid")})}),l.jsx(jn,{value:"inv_sigmoid",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.inverseSigmoid")})})]}):l.jsx(jn,{value:"add_difference",children:l.jsx(Yt,{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(Ja,{value:M,onChange:$=>P($),children:l.jsxs(B,{columnGap:4,children:[l.jsx(jn,{value:"root",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.invokeAIFolder")})}),l.jsx(jn,{value:"custom",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.custom")})})]})})]}),M==="custom"&&l.jsx(mt,{label:s("modelManager.mergedModelCustomSaveLocation"),value:I,onChange:$=>T($.target.value)})]}),l.jsx(pt,{label:s("modelManager.ignoreMismatch"),isChecked:D,onChange:$=>_($.target.checked),fontWeight:"500"}),l.jsx(Je,{onClick:X,isLoading:L,isDisabled:M==="custom"&&I==="",children:s("modelManager.merge")})]})}),l.jsx(zr,{})]})]})]})}const fF=be(Pt,e=>te.map(e.model_list,(n,r)=>({name:r,...n})),{memoizeOptions:{resultEqualityCheck:te.isEqual}});function Yd({label:e,isActive:t,onClick:n}){return l.jsx(Je,{onClick:n,isActive:t,sx:{_active:{bg:"accent.750"}},size:"sm",children:e})}const hF=()=>{const e=O(fF),[t,n]=ke.useState(!1);ke.useEffect(()=>{const y=setTimeout(()=>{n(!0)},200);return()=>clearTimeout(y)},[]);const[r,o]=x.useState(""),[s,c]=x.useState("all"),[u,f]=x.useTransition(),{t:h}=Z(),p=y=>{f(()=>{o(y.target.value)})},g=x.useMemo(()=>{const y=[],S=[],C=[],w=[];return e.forEach((k,j)=>{k.name.toLowerCase().includes(r.toLowerCase())&&(C.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j)),k.format===s&&w.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j))),k.format!=="diffusers"?y.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j)):S.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j))}),r!==""?s==="all"?l.jsx(We,{marginTop:4,children:C}):l.jsx(We,{marginTop:4,children:w}):l.jsxs(B,{flexDirection:"column",rowGap:6,children:[s==="all"&&l.jsxs(l.Fragment,{children:[l.jsxs(We,{children:[l.jsx(Ce,{sx:{fontWeight:"500",py:2,px:4,my:4,mx:0,borderRadius:"base",width:"max-content",fontSize:"sm",bg:"base.750"},children:h("modelManager.checkpointModels")}),y]}),l.jsxs(We,{children:[l.jsx(Ce,{sx:{fontWeight:"500",py:2,px:4,mb:4,borderRadius:"base",width:"max-content",fontSize:"sm",bg:"base.750"},children:h("modelManager.diffusersModels")}),S]})]}),s==="ckpt"&&l.jsx(B,{flexDirection:"column",marginTop:4,children:y}),s==="diffusers"&&l.jsx(B,{flexDirection:"column",marginTop:4,children:S})]})},[e,r,h,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(Vn,{size:"md",children:h("modelManager.availableModels")}),l.jsx(jc,{}),l.jsx(uF,{}),l.jsx(dF,{})]}),l.jsx(mt,{onChange:p,label:h("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(Yd,{label:h("modelManager.allModels"),onClick:()=>c("all"),isActive:s==="all"}),l.jsx(Yd,{label:h("modelManager.checkpointModels"),onClick:()=>c("ckpt"),isActive:s==="ckpt"}),l.jsx(Yd,{label:h("modelManager.diffusersModels"),onClick:()=>c("diffusers"),isActive:s==="diffusers"})]}),t?g:l.jsx(B,{width:"100%",minHeight:96,justifyContent:"center",alignItems:"center",children:l.jsx(Qf,{})})]})]})};function pF({children:e}){const{isOpen:t,onOpen:n,onClose:r}=uo(),o=O(u=>u.system.model_list),s=O(u=>u.system.openModel),{t:c}=Z();return l.jsxs(l.Fragment,{children:[x.cloneElement(e,{onClick:n}),l.jsxs(fo,{isOpen:t,onClose:r,size:"full",children:[l.jsx(Nr,{}),l.jsxs(ho,{children:[l.jsx(ca,{}),l.jsx(Rr,{children:c("modelManager.modelManager")}),l.jsx(Fr,{children:l.jsxs(B,{width:"100%",columnGap:8,children:[l.jsx(hF,{}),s&&o[s].format==="diffusers"?l.jsx(aF,{}):l.jsx(oF,{})]})}),l.jsx(zr,{})]})]})]})}const mF=be([Pt],e=>{const{isProcessing:t,model_list:n}=e;return{models:te.map(n,(o,s)=>s),isProcessing:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),vF=()=>{const e=Y(),{models:t,isProcessing:n}=O(mF),r=O(Sy),o=s=>{e(f2(s.target.value))};return l.jsx(B,{style:{paddingInlineStart:1.5},children:l.jsx(Mn,{style:{fontSize:"sm"},tooltip:r.description,isDisabled:n,value:r.name,validValues:t,onChange:o})})},gF=be([Pt,oi],(e,t)=>{const{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:o,model_list:s,saveIntermediatesInterval:c,enableImageDebugging:u}=e,{shouldUseCanvasBetaLayout:f,shouldUseSliders:h}=t;return{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:o,models:te.map(s,(p,g)=>g),saveIntermediatesInterval:c,enableImageDebugging:u,shouldUseCanvasBetaLayout:f,shouldUseSliders:h}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Xd={flexDirection:"column",gap:2,p:4,bg:"base.900"},xF=({children:e})=>{const t=Y(),{t:n}=Z(),r=O(P=>P.generation.steps),{isOpen:o,onOpen:s,onClose:c}=uo(),{isOpen:u,onOpen:f,onClose:h}=uo(),{shouldDisplayInProgressType:p,shouldConfirmOnDelete:g,shouldDisplayGuides:y,saveIntermediatesInterval:S,enableImageDebugging:C,shouldUseCanvasBetaLayout:w,shouldUseSliders:k}=O(gF),j=()=>{p3.purge().then(()=>{c(),f()})},M=P=>{P>r&&(P=r),P<1&&(P=1),t(m3(P))};return l.jsxs(l.Fragment,{children:[x.cloneElement(e,{onClick:s}),l.jsxs(fo,{isOpen:o,onClose:c,size:"xl",children:[l.jsx(Nr,{}),l.jsxs(ho,{paddingInlineEnd:4,children:[l.jsx(Rr,{children:n("common.settingsLabel")}),l.jsx(ca,{}),l.jsx(Fr,{children:l.jsxs($n,{gap:4,children:[l.jsxs(B,{sx:Xd,children:[l.jsx(Mn,{label:n("settings.displayInProgress"),validValues:l3,value:p,onChange:P=>t(c3(P.target.value))}),p==="full-res"&&l.jsx(Lr,{label:n("settings.saveSteps"),min:1,max:r,step:1,onChange:M,value:S,width:"auto",textAlign:"center"}),l.jsx(En,{label:n("settings.confirmOnDelete"),isChecked:g,onChange:P=>t(T1(P.target.checked))}),l.jsx(En,{label:n("settings.displayHelpIcons"),isChecked:y,onChange:P=>t(u3(P.target.checked))}),l.jsx(En,{label:n("settings.useCanvasBeta"),isChecked:w,onChange:P=>t(d3(P.target.checked))}),l.jsx(En,{label:n("settings.useSlidersForAll"),isChecked:k,onChange:P=>t(f3(P.target.checked))})]}),l.jsxs(B,{sx:Xd,children:[l.jsx(Vn,{size:"sm",style:{fontWeight:"bold"},children:"Developer"}),l.jsx(En,{label:n("settings.enableImageDebugging"),isChecked:C,onChange:P=>t(h3(P.target.checked))})]}),l.jsxs(B,{sx:Xd,children:[l.jsx(Vn,{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(zr,{children:l.jsx(Je,{onClick:c,children:n("common.close")})})]})]}),l.jsxs(fo,{closeOnOverlayClick:!1,isOpen:u,onClose:h,isCentered:!0,children:[l.jsx(Nr,{backdropFilter:"blur(40px)"}),l.jsxs(ho,{children:[l.jsx(Rr,{}),l.jsx(Fr,{children:l.jsx(B,{justifyContent:"center",children:l.jsx(Ce,{fontSize:"lg",children:l.jsx(Ce,{children:n("settings.resetComplete")})})})}),l.jsx(zr,{})]})]})]})},yF=be(Pt,e=>({isConnected:e.isConnected,isProcessing:e.isProcessing,currentIteration:e.currentIteration,totalIterations:e.totalIterations,currentStatus:e.currentStatus,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),bF=()=>{const{isConnected:e,isProcessing:t,currentIteration:n,totalIterations:r,currentStatus:o,hasError:s,wasErrorSeen:c}=O(yF),u=Y(),{t:f}=Z();let h;e&&!s?h="ok":h="error";let p=o;t&&(h="working"),p&&t&&r>1&&(p=`${f(p)} (${n}/${r})`);const g=s&&!c?"Click to clear, check logs for details":void 0,y=s&&!c?"pointer":"initial",S=()=>{(s||!c)&&u(d2())};return l.jsx(Yt,{label:g,children:l.jsx(Ce,{cursor:y,onClick:S,sx:{fontSize:"xs",fontWeight:"600",color:`${h}.400`},children:f(p)})})};function SF(){const{t:e}=Z(),t=Y(),n=O(c=>c.ui.currentTheme),r={dark:e("common.darkTheme"),light:e("common.lightTheme"),green:e("common.greenTheme"),ocean:e("common.oceanTheme")},o=c=>{t(v3(c))},s=()=>{const c=[];return Object.keys(r).forEach(u=>{c.push(l.jsx(Je,{sx:{width:24},isChecked:n===u,leftIcon:n===u?l.jsx(zc,{}):void 0,size:"sm",onClick:()=>o(u),children:r[u]},u))}),c};return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{"aria-label":e("common.themeLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(W8,{})}),children:l.jsx(Le,{align:"stretch",children:s()})})}function CF(){const{t:e,i18n:t}=Z(),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(zc,{}):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(le,{"aria-label":e("common.languagePickerLabel"),tooltip:e("common.languagePickerLabel"),icon:l.jsx(L8,{}),size:"sm",variant:"link","data-variant":"link",fontSize:26}),children:l.jsx(Le,{children:r()})})}const wF=()=>{const{t:e}=Z();return l.jsxs($n,{gridTemplateColumns:"auto max-content",children:[l.jsx(f4,{}),l.jsxs(B,{alignItems:"center",gap:2,children:[l.jsx(bF,{}),l.jsx(vF,{}),l.jsx(pF,{children:l.jsx(le,{"aria-label":e("modelManager.modelManager"),tooltip:e("modelManager.modelManager"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(_8,{})})}),l.jsx(cO,{children:l.jsx(le,{"aria-label":e("common.hotkeysLabel"),tooltip:e("common.hotkeysLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(F8,{})})}),l.jsx(SF,{}),l.jsx(CF,{}),l.jsx(le,{"aria-label":e("common.reportBugLabel"),tooltip:e("common.reportBugLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx(Go,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI/issues",children:l.jsx(T8,{})})}),l.jsx(le,{"aria-label":e("common.githubLabel"),tooltip:e("common.githubLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx(Go,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI",children:l.jsx(w8,{})})}),l.jsx(le,{"aria-label":e("common.discordLabel"),tooltip:e("common.discordLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx(Go,{isExternal:!0,href:"https://discord.gg/ZmtBAhwWhy",children:l.jsx(C8,{})})}),l.jsx(xF,{children:l.jsx(le,{"aria-label":e("common.settingsLabel"),tooltip:e("common.settingsLabel"),variant:"link","data-variant":"link",fontSize:22,size:"sm",icon:l.jsx(h9,{})})})]})]})};function kF(){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 jF=()=>{const e=Y(),t=O(a8),n=us();x.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(g3())},[e,n,t])},EF=()=>{const e=Y(),{shouldShowGalleryButton:t,shouldPinGallery:n}=O(xp),r=()=>{e(Lo(!0)),n&&e(on(!0))};return t?l.jsx(le,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":"Show Gallery",onClick:r,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(lp,{})}):null};kF();const _F=()=>(jF(),l.jsxs($n,{w:"100vw",h:"100vh",children:[l.jsxs(nO,{children:[l.jsx(sO,{}),l.jsxs($n,{gap:4,p:_9,gridAutoRows:"min-content auto",w:D9,h:O9,children:[l.jsx(wF,{}),l.jsx(sD,{})]}),l.jsx(We,{children:l.jsx(iO,{})})]}),l.jsx(lI,{}),l.jsx(EF,{})]}));export{_F as default};