import{a as Ou,b as mI,S as gI,c as vI,d as bI,e as N1,f as xI,i as $1,g as BA,h as yI,j as CI,k as HA,l as gx,m as WA,n as VA,o as Ew,p as wI,t as UA,q as GA,r as qA,s as KA,u as QA,v as l,w as a,x as vx,y as $h,z as XA,A as YA,B as JA,C as ZA,P as eD,D as bx,E as tD,F as nD,G as rD,H as oD,I as Oe,J as zr,K as Hn,L as Ee,M as jt,N as pr,O as rt,Q as pf,R as yo,T as Or,U as Qr,V as ar,W as bi,X as ll,Y as qt,Z as _s,_ as Yc,$ as xi,a0 as yi,a1 as og,a2 as xx,a3 as hf,a4 as mr,a5 as sD,a6 as B,a7 as Mw,a8 as aD,a9 as SI,aa as L1,ab as mf,ac as Ru,ad as iD,ae as kI,af as jI,ag as _I,ah as Ks,ai as lD,aj as de,ak as Ce,al as Tn,am as H,an as cD,ao as Ow,ap as uD,aq as dD,ar as fD,as as Ci,at as Te,au as N,av as vo,aw as ro,ax as _e,ay as Zl,az as J,aA as II,aB as pD,aC as hD,aD as mD,aE as gD,aF as rs,aG as yx,aH as wi,aI as oe,aJ as Uo,aK as gf,aL as vD,aM as bD,aN as Rw,aO as Cx,aP as Se,aQ as Qs,aR as xD,aS as PI,aT as EI,aU as Aw,aV as yD,aW as CD,aX as wD,aY as Si,aZ as wx,a_ as on,a$ as SD,b0 as kD,b1 as Fa,b2 as MI,b3 as OI,b4 as Bt,b5 as sg,b6 as jD,b7 as Dw,b8 as RI,b9 as _D,ba as ID,bb as PD,bc as ED,bd as MD,be as OD,bf as RD,bg as AI,bh as AD,bi as DD,bj as TD,bk as ND,bl as $D,bm as pu,bn as Sx,bo as LD,bp as zD,bq as FD,br as Cc,bs as BD,bt as HD,bu as WD,bv as VD,bw as Tw,bx as UD,by as GD,bz as Jc,bA as DI,bB as TI,bC as ag,bD as kx,bE as jx,bF as Ps,bG as NI,bH as qD,bI as Bl,bJ as _d,bK as Nw,bL as KD,bM as QD,bN as XD,bO as Ap,bP as Dp,bQ as pd,bR as Pv,bS as Rd,bT as Ad,bU as Dd,bV as Td,bW as $w,bX as Lh,bY as Ev,bZ as zh,b_ as Lw,b$ as z1,c0 as Mv,c1 as F1,c2 as zw,c3 as Wc,c4 as Ov,c5 as Fh,c6 as Fw,c7 as Hl,c8 as Bw,c9 as Wl,ca as Tp,cb as Bh,cc as Hw,cd as B1,ce as Hh,cf as Ww,cg as H1,ch as vf,ci as $I,cj as YD,ck as Vw,cl as _x,cm as Wh,cn as LI,co as Oo,cp as hd,cq as wc,cr as Ix,cs as zI,ct as Np,cu as Px,cv as JD,cw as FI,cx as Rv,cy as ig,cz as ZD,cA as BI,cB as W1,cC as V1,cD as HI,cE as e7,cF as U1,cG as t7,cH as G1,cI as n7,cJ as q1,cK as r7,cL as WI,cM as o7,cN as VI,cO as UI,cP as s7,cQ as GI,cR as Ex,cS as Mx,cT as Ox,cU as Rx,cV as lg,cW as Ax,cX as ti,cY as qI,cZ as KI,c_ as Dx,c$ as QI,d0 as a7,d1 as md,d2 as di,d3 as XI,d4 as YI,d5 as Uw,d6 as Tx,d7 as JI,d8 as Nx,d9 as $x,da as ZI,db as Rr,dc as i7,dd as Kr,de as l7,df as Au,dg as cg,dh as Lx,di as eP,dj as tP,dk as c7,dl as u7,dm as d7,dn as Vh,dp as nP,dq as rP,dr as f7,ds as p7,dt as h7,du as m7,dv as g7,dw as v7,dx as b7,dy as x7,dz as Gw,dA as zx,dB as y7,dC as C7,dD as bf,dE as w7,dF as S7,dG as ug,dH as k7,dI as j7,dJ as _7,dK as I7,dL as gr,dM as P7,dN as E7,dO as M7,dP as O7,dQ as R7,dR as A7,dS as Zn,dT as Wd,dU as qw,dV as na,dW as oP,dX as D7,dY as Fx,dZ as T7,d_ as Kw,d$ as N7,e0 as $7,e1 as L7,e2 as sP,e3 as z7,e4 as F7,e5 as B7,e6 as H7,e7 as W7,e8 as V7,e9 as aP,ea as U7,eb as G7,ec as Qw,ed as q7,ee as K7,ef as Q7,eg as X7,eh as Y7,ei as J7,ej as Z7,ek as iP,el as eT,em as tT,en as nT,eo as Xw,ep as $p,eq as Rs,er as rT,es as oT,et as sT,eu as aT,ev as iT,ew as lT,ex as Xs,ey as cT,ez as uT,eA as dT,eB as fT,eC as pT,eD as hT,eE as mT,eF as gT,eG as vT,eH as bT,eI as xT,eJ as yT,eK as CT,eL as wT,eM as ST,eN as kT,eO as jT,eP as _T,eQ as IT,eR as PT,eS as ET,eT as MT,eU as OT,eV as RT,eW as AT,eX as Yw,eY as lP,eZ as DT,e_ as Us,e$ as Vd,f0 as Mo,f1 as TT,f2 as NT,f3 as cP,f4 as uP,f5 as $T,f6 as Jw,f7 as LT,f8 as Zw,f9 as eS,fa as tS,fb as zT,fc as FT,fd as nS,fe as rS,ff as BT,fg as HT,fh as Uh,fi as WT,fj as oS,fk as sS,fl as VT,fm as UT,fn as dP,fo as GT,fp as qT,fq as fP,fr as KT,fs as QT,ft as aS,fu as XT,fv as iS,fw as YT,fx as JT,fy as pP,fz as hP,fA as xf,fB as mP,fC as Ol,fD as gP,fE as lS,fF as ZT,fG as eN,fH as vP,fI as tN,fJ as nN,fK as rN,fL as oN,fM as sN,fN as Bx,fO as K1,fP as aN,fQ as iN,fR as lN,fS as bP,fT as Hx,fU as xP,fV as Wx,fW as yP,fX as cN,fY as ri,fZ as uN,f_ as CP,f$ as Du,g0 as dN,g1 as Vx,g2 as wP,g3 as fN,g4 as pN,g5 as hN,g6 as mN,g7 as gN,g8 as vN,g9 as Id,ga as Vc,gb as cS,gc as bN,gd as xN,ge as yN,gf as CN,gg as wN,gh as SN,gi as kN,gj as uS,gk as jN,gl as _N,gm as IN,gn as PN,go as EN,gp as MN,gq as dS,gr as ON,gs as RN,gt as AN,gu as DN,gv as TN,gw as NN,gx as $N,gy as LN,gz as zN,gA as fS,gB as FN,gC as BN,gD as HN,gE as WN,gF as VN,gG as UN,gH as GN,gI as qN,gJ as KN,gK as QN,gL as XN,gM as YN,gN as JN,gO as yf,gP as ZN,gQ as e9,gR as t9,gS as n9,gT as r9,gU as o9,gV as s9,gW as a9,gX as pS,gY as Sh,gZ as i9,g_ as Gh,g$ as SP,h0 as qh,h1 as l9,h2 as c9,h3 as Zc,h4 as kP,h5 as jP,h6 as Ux,h7 as u9,h8 as d9,h9 as f9,ha as Q1,hb as _P,hc as p9,hd as h9,he as IP,hf as m9,hg as g9,hh as v9,hi as b9,hj as x9,hk as hS,hl as Sc,hm as y9,hn as C9,ho as w9,hp as S9,hq as k9,hr as mS,hs as j9,ht as _9,hu as I9,hv as P9,hw as E9,hx as M9,hy as O9,hz as R9,hA as Av,hB as Dv,hC as Tv,hD as Lp,hE as gS,hF as X1,hG as vS,hH as A9,hI as D9,hJ as PP,hK as T9,hL as N9,hM as $9,hN as L9,hO as z9,hP as F9,hQ as B9,hR as H9,hS as W9,hT as V9,hU as U9,hV as G9,hW as q9,hX as K9,hY as Q9,hZ as zp,h_ as Nv,h$ as X9,i0 as Y9,i1 as J9,i2 as Z9,i3 as e$,i4 as t$,i5 as n$,i6 as r$,i7 as o$,i8 as bS,i9 as xS,ia as s$,ib as a$,ic as i$,id as l$}from"./index-c553e366.js";import{u as EP,a as ki,b as c$,r as Ge,f as u$,g as yS,c as Xt,d as Nr}from"./MantineProvider-094ba0de.js";var d$=200;function f$(e,t,n,r){var o=-1,s=vI,i=!0,c=e.length,d=[],p=t.length;if(!c)return d;n&&(t=Ou(t,mI(n))),r?(s=bI,i=!1):t.length>=d$&&(s=N1,i=!1,t=new gI(t));e:for(;++o=120&&h.length>=120)?new gI(i&&h):void 0}h=e[0];var m=-1,g=c[0];e:for(;++m{r.has(s)&&n(o,s)})}function P$(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}const MP=({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:c,strokeWidth:d,className:p,borderRadius:h,shapeRendering:m,onClick:g,selected:b})=>{const{background:y,backgroundColor:x}=s||{},C=i||y||x;return a.jsx("rect",{className:vx(["react-flow__minimap-node",{selected:b},p]),x:t,y:n,rx:h,ry:h,width:r,height:o,fill:C,stroke:c,strokeWidth:d,shapeRendering:m,onClick:g?S=>g(S,e):void 0})};MP.displayName="MiniMapNode";var E$=l.memo(MP);const M$=e=>e.nodeOrigin,O$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),$v=e=>e instanceof Function?e:()=>e;function R$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=E$,onClick:i}){const c=$h(O$,bx),d=$h(M$),p=$v(t),h=$v(e),m=$v(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:c.map(b=>{const{x:y,y:x}=XA(b,d).positionAbsolute;return a.jsx(s,{x:y,y:x,width:b.width,height:b.height,style:b.style,selected:b.selected,className:m(b),color:p(b),borderRadius:r,strokeColor:h(b),strokeWidth:o,shapeRendering:g,onClick:i,id:b.id},b.id)})})}var A$=l.memo(R$);const D$=200,T$=150,N$=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?rD(oD(t,e.nodeOrigin),n):n,rfId:e.rfId}},$$="react-flow__minimap-desc";function OP({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:c,maskColor:d="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:g,onNodeClick:b,pannable:y=!1,zoomable:x=!1,ariaLabel:C="React Flow mini map",inversePan:S=!1,zoomStep:j=10,offsetScale:_=5}){const I=YA(),P=l.useRef(null),{boundingRect:M,viewBB:R,rfId:A}=$h(N$,bx),D=(e==null?void 0:e.width)??D$,O=(e==null?void 0:e.height)??T$,T=M.width/D,Y=M.height/O,z=Math.max(T,Y),W=z*D,Q=z*O,U=_*z,L=M.x-(W-M.width)/2-U,ee=M.y-(Q-M.height)/2-U,K=W+U*2,Z=Q+U*2,se=`${$$}-${A}`,fe=l.useRef(0);fe.current=z,l.useEffect(()=>{if(P.current){const V=JA(P.current),F=q=>{const{transform:ne,d3Selection:pe,d3Zoom:le}=I.getState();if(q.sourceEvent.type!=="wheel"||!pe||!le)return;const we=-q.sourceEvent.deltaY*(q.sourceEvent.deltaMode===1?.05:q.sourceEvent.deltaMode?1:.002)*j,ve=ne[2]*Math.pow(2,we);le.scaleTo(pe,ve)},X=q=>{const{transform:ne,d3Selection:pe,d3Zoom:le,translateExtent:we,width:ve,height:he}=I.getState();if(q.sourceEvent.type!=="mousemove"||!pe||!le)return;const Ne=fe.current*Math.max(1,ne[2])*(S?-1:1),De={x:ne[0]-q.sourceEvent.movementX*Ne,y:ne[1]-q.sourceEvent.movementY*Ne},qe=[[0,0],[ve,he]],Mt=tD.translate(De.x,De.y).scale(ne[2]),ot=le.constrain()(Mt,qe,we);le.transform(pe,ot)},ue=ZA().on("zoom",y?X:null).on("zoom.wheel",x?F:null);return V.call(ue),()=>{V.on("zoom",null)}}},[y,x,S,j]);const G=g?V=>{const F=nD(V);g(V,{x:F[0],y:F[1]})}:void 0,te=b?(V,F)=>{const X=I.getState().nodeInternals.get(F);b(V,X)}:void 0;return a.jsx(eD,{position:m,style:e,className:vx(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:D,height:O,viewBox:`${L} ${ee} ${K} ${Z}`,role:"img","aria-labelledby":se,ref:P,onClick:G,children:[C&&a.jsx("title",{id:se,children:C}),a.jsx(A$,{onClick:te,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:c}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${L-U},${ee-U}h${K+U*2}v${Z+U*2}h${-K-U*2}z M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fill:d,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})]})})}OP.displayName="MiniMap";var L$=l.memo(OP),Ys;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ys||(Ys={}));function z$({color:e,dimensions:t,lineWidth:n}){return a.jsx("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function F$({color:e,radius:t}){return a.jsx("circle",{cx:t,cy:t,r:t,fill:e})}const B$={[Ys.Dots]:"#91919a",[Ys.Lines]:"#eee",[Ys.Cross]:"#e2e2e2"},H$={[Ys.Dots]:1,[Ys.Lines]:1,[Ys.Cross]:6},W$=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function RP({id:e,variant:t=Ys.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=2,color:i,style:c,className:d}){const p=l.useRef(null),{transform:h,patternId:m}=$h(W$,bx),g=i||B$[t],b=r||H$[t],y=t===Ys.Dots,x=t===Ys.Cross,C=Array.isArray(n)?n:[n,n],S=[C[0]*h[2]||1,C[1]*h[2]||1],j=b*h[2],_=x?[j,j]:S,I=y?[j/s,j/s]:[_[0]/s,_[1]/s];return a.jsxs("svg",{className:vx(["react-flow__background",d]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background",children:[a.jsx("pattern",{id:m+e,x:h[0]%S[0],y:h[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${I[0]},-${I[1]})`,children:y?a.jsx(F$,{color:g,radius:j/s}):a.jsx(z$,{dimensions:_,color:g,lineWidth:o})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`})]})}RP.displayName="Background";var V$=l.memo(RP);function U$(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var G$=U$();const AP=1/60*1e3,q$=typeof performance<"u"?()=>performance.now():()=>Date.now(),DP=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(q$()),AP);function K$(e){let t=[],n=[],r=0,o=!1,s=!1;const i=new WeakSet,c={schedule:(d,p=!1,h=!1)=>{const m=h&&o,g=m?t:n;return p&&i.add(d),g.indexOf(d)===-1&&(g.push(d),m&&o&&(r=t.length)),d},cancel:d=>{const p=n.indexOf(d);p!==-1&&n.splice(p,1),i.delete(d)},process:d=>{if(o){s=!0;return}if(o=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let p=0;p(e[t]=K$(()=>Ud=!0),e),{}),X$=Cf.reduce((e,t)=>{const n=dg[t];return e[t]=(r,o=!1,s=!1)=>(Ud||Z$(),n.schedule(r,o,s)),e},{}),Y$=Cf.reduce((e,t)=>(e[t]=dg[t].cancel,e),{});Cf.reduce((e,t)=>(e[t]=()=>dg[t].process(eu),e),{});const J$=e=>dg[e].process(eu),TP=e=>{Ud=!1,eu.delta=Y1?AP:Math.max(Math.min(e-eu.timestamp,Q$),1),eu.timestamp=e,J1=!0,Cf.forEach(J$),J1=!1,Ud&&(Y1=!1,DP(TP))},Z$=()=>{Ud=!0,Y1=!0,J1||DP(TP)},wS=()=>eu;function fg(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=l.Children.toArray(e.path),i=Oe((c,d)=>a.jsx(zr,{ref:d,viewBox:t,...o,...c,children:s.length?s:a.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}var eL=Object.defineProperty,tL=(e,t,n)=>t in e?eL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Er=(e,t,n)=>(tL(e,typeof t!="symbol"?t+"":t,n),n);function SS(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 nL=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function kS(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function jS(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var Z1=typeof window<"u"?l.useLayoutEffect:l.useEffect,Kh=e=>e,rL=class{constructor(){Er(this,"descendants",new Map),Er(this,"register",e=>{if(e!=null)return nL(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),Er(this,"unregister",e=>{this.descendants.delete(e);const t=SS(Array.from(this.descendants.keys()));this.assignIndex(t)}),Er(this,"destroy",()=>{this.descendants.clear()}),Er(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),Er(this,"count",()=>this.descendants.size),Er(this,"enabledCount",()=>this.enabledValues().length),Er(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),Er(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),Er(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),Er(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),Er(this,"first",()=>this.item(0)),Er(this,"firstEnabled",()=>this.enabledItem(0)),Er(this,"last",()=>this.item(this.descendants.size-1)),Er(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),Er(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),Er(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),Er(this,"next",(e,t=!0)=>{const n=kS(e,this.count(),t);return this.item(n)}),Er(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=kS(r,this.enabledCount(),t);return this.enabledItem(o)}),Er(this,"prev",(e,t=!0)=>{const n=jS(e,this.count()-1,t);return this.item(n)}),Er(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=jS(r,this.enabledCount()-1,t);return this.enabledItem(o)}),Er(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=SS(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 oL(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 gn(...e){return t=>{e.forEach(n=>{oL(n,t)})}}function sL(...e){return l.useMemo(()=>gn(...e),e)}function aL(){const e=l.useRef(new rL);return Z1(()=>()=>e.current.destroy()),e.current}var[iL,NP]=Hn({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function lL(e){const t=NP(),[n,r]=l.useState(-1),o=l.useRef(null);Z1(()=>()=>{o.current&&t.unregister(o.current)},[]),Z1(()=>{if(!o.current)return;const i=Number(o.current.dataset.index);n!=i&&!Number.isNaN(i)&&r(i)});const s=Kh(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:gn(s,o)}}function Gx(){return[Kh(iL),()=>Kh(NP()),()=>aL(),o=>lL(o)]}var[cL,pg]=Hn({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[uL,qx]=Hn({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[dL,dbe,fL,pL]=Gx(),Dc=Oe(function(t,n){const{getButtonProps:r}=qx(),o=r(t,n),i={display:"flex",alignItems:"center",width:"100%",outline:0,...pg().button};return a.jsx(Ee.button,{...o,className:jt("chakra-accordion__button",t.className),__css:i})});Dc.displayName="AccordionButton";function wf(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(g,b)=>g!==b}=e,s=pr(r),i=pr(o),[c,d]=l.useState(n),p=t!==void 0,h=p?t:c,m=pr(g=>{const y=typeof g=="function"?g(h):g;i(h,y)&&(p||d(y),s(y))},[p,s,h,i]);return[h,m]}function hL(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...i}=e;vL(e),bL(e);const c=fL(),[d,p]=l.useState(-1);l.useEffect(()=>()=>{p(-1)},[]);const[h,m]=wf({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:h,setIndex:m,htmlProps:i,getAccordionItemProps:b=>{let y=!1;return b!==null&&(y=Array.isArray(h)?h.includes(b):h===b),{isOpen:y,onChange:C=>{if(b!==null)if(o&&Array.isArray(h)){const S=C?h.concat(b):h.filter(j=>j!==b);m(S)}else C?m(b):s&&m(-1)}}},focusedIndex:d,setFocusedIndex:p,descendants:c}}var[mL,Kx]=Hn({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function gL(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:i}=Kx(),c=l.useRef(null),d=l.useId(),p=r??d,h=`accordion-button-${p}`,m=`accordion-panel-${p}`;xL(e);const{register:g,index:b,descendants:y}=pL({disabled:t&&!n}),{isOpen:x,onChange:C}=s(b===-1?null:b);yL({isOpen:x,isDisabled:t});const S=()=>{C==null||C(!0)},j=()=>{C==null||C(!1)},_=l.useCallback(()=>{C==null||C(!x),i(b)},[b,i,x,C]),I=l.useCallback(A=>{const O={ArrowDown:()=>{const T=y.nextEnabled(b);T==null||T.node.focus()},ArrowUp:()=>{const T=y.prevEnabled(b);T==null||T.node.focus()},Home:()=>{const T=y.firstEnabled();T==null||T.node.focus()},End:()=>{const T=y.lastEnabled();T==null||T.node.focus()}}[A.key];O&&(A.preventDefault(),O(A))},[y,b]),P=l.useCallback(()=>{i(b)},[i,b]),M=l.useCallback(function(D={},O=null){return{...D,type:"button",ref:gn(g,c,O),id:h,disabled:!!t,"aria-expanded":!!x,"aria-controls":m,onClick:rt(D.onClick,_),onFocus:rt(D.onFocus,P),onKeyDown:rt(D.onKeyDown,I)}},[h,t,x,_,P,I,m,g]),R=l.useCallback(function(D={},O=null){return{...D,ref:O,role:"region",id:m,"aria-labelledby":h,hidden:!x}},[h,x,m]);return{isOpen:x,isDisabled:t,isFocusable:n,onOpen:S,onClose:j,getButtonProps:M,getPanelProps:R,htmlProps:o}}function vL(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;pf({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function bL(e){pf({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 xL(e){pf({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 yL(e){pf({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Tc(e){const{isOpen:t,isDisabled:n}=qx(),{reduceMotion:r}=Kx(),o=jt("chakra-accordion__icon",e.className),s=pg(),i={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return a.jsx(zr,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:i,...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Tc.displayName="AccordionIcon";var Nc=Oe(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...i}=gL(t),d={...pg().container,overflowAnchor:"none"},p=l.useMemo(()=>i,[i]);return a.jsx(uL,{value:p,children:a.jsx(Ee.div,{ref:n,...s,className:jt("chakra-accordion__item",o),__css:d,children:typeof r=="function"?r({isExpanded:!!i.isOpen,isDisabled:!!i.isDisabled}):r})})});Nc.displayName="AccordionItem";var Uc={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Dl={enter:{duration:.2,ease:Uc.easeOut},exit:{duration:.1,ease:Uc.easeIn}},si={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})},CL=e=>e!=null&&parseInt(e.toString(),10)>0,_S={exit:{height:{duration:.2,ease:Uc.ease},opacity:{duration:.3,ease:Uc.ease}},enter:{height:{duration:.3,ease:Uc.ease},opacity:{duration:.4,ease:Uc.ease}}},wL={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:CL(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:si.exit(_S.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:si.enter(_S.enter,o)}}},Sf=l.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:i="auto",style:c,className:d,transition:p,transitionEnd:h,...m}=e,[g,b]=l.useState(!1);l.useEffect(()=>{const j=setTimeout(()=>{b(!0)});return()=>clearTimeout(j)},[]),pf({condition:Number(s)>0&&!!r,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const y=parseFloat(s.toString())>0,x={startingHeight:s,endingHeight:i,animateOpacity:o,transition:g?p:{enter:{duration:0}},transitionEnd:{enter:h==null?void 0:h.enter,exit:r?h==null?void 0:h.exit:{...h==null?void 0:h.exit,display:y?"block":"none"}}},C=r?n:!0,S=n||r?"enter":"exit";return a.jsx(yo,{initial:!1,custom:x,children:C&&a.jsx(Or.div,{ref:t,...m,className:jt("chakra-collapse",d),style:{overflow:"hidden",display:"block",...c},custom:x,variants:wL,initial:r?"exit":!1,animate:S,exit:"exit"})})});Sf.displayName="Collapse";var SL={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:si.enter(Dl.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:si.exit(Dl.exit,n),transitionEnd:t==null?void 0:t.exit}}},$P={initial:"exit",animate:"enter",exit:"exit",variants:SL},kL=l.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:i,transitionEnd:c,delay:d,...p}=t,h=o||r?"enter":"exit",m=r?o&&r:!0,g={transition:i,transitionEnd:c,delay:d};return a.jsx(yo,{custom:g,children:m&&a.jsx(Or.div,{ref:n,className:jt("chakra-fade",s),custom:g,...$P,animate:h,...p})})});kL.displayName="Fade";var jL={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:si.exit(Dl.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:si.enter(Dl.enter,n),transitionEnd:e==null?void 0:e.enter}}},LP={initial:"exit",animate:"enter",exit:"exit",variants:jL},_L=l.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:i=.95,className:c,transition:d,transitionEnd:p,delay:h,...m}=t,g=r?o&&r:!0,b=o||r?"enter":"exit",y={initialScale:i,reverse:s,transition:d,transitionEnd:p,delay:h};return a.jsx(yo,{custom:y,children:g&&a.jsx(Or.div,{ref:n,className:jt("chakra-offset-slide",c),...LP,animate:b,custom:y,...m})})});_L.displayName="ScaleFade";var IL={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:si.exit(Dl.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:si.enter(Dl.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var i;const c={x:t,y:e};return{opacity:0,transition:(i=n==null?void 0:n.exit)!=null?i:si.exit(Dl.exit,s),...o?{...c,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...c,...r==null?void 0:r.exit}}}}},eb={initial:"initial",animate:"enter",exit:"exit",variants:IL},PL=l.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:i,offsetX:c=0,offsetY:d=8,transition:p,transitionEnd:h,delay:m,...g}=t,b=r?o&&r:!0,y=o||r?"enter":"exit",x={offsetX:c,offsetY:d,reverse:s,transition:p,transitionEnd:h,delay:m};return a.jsx(yo,{custom:x,children:b&&a.jsx(Or.div,{ref:n,className:jt("chakra-offset-slide",i),custom:x,...eb,animate:y,...g})})});PL.displayName="SlideFade";var $c=Oe(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:i}=Kx(),{getPanelProps:c,isOpen:d}=qx(),p=c(s,n),h=jt("chakra-accordion__panel",r),m=pg();i||delete p.hidden;const g=a.jsx(Ee.div,{...p,__css:m.panel,className:h});return i?g:a.jsx(Sf,{in:d,...o,children:g})});$c.displayName="AccordionPanel";var zP=Oe(function({children:t,reduceMotion:n,...r},o){const s=Qr("Accordion",r),i=ar(r),{htmlProps:c,descendants:d,...p}=hL(i),h=l.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return a.jsx(dL,{value:d,children:a.jsx(mL,{value:h,children:a.jsx(cL,{value:s,children:a.jsx(Ee.div,{ref:o,...c,className:jt("chakra-accordion",r.className),__css:s.root,children:t})})})})});zP.displayName="Accordion";function hg(e){return l.Children.toArray(e).filter(t=>l.isValidElement(t))}var[EL,ML]=Hn({strict:!1,name:"ButtonGroupContext"}),OL={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}}},RL={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},zn=Oe(function(t,n){const{size:r,colorScheme:o,variant:s,className:i,spacing:c="0.5rem",isAttached:d,isDisabled:p,orientation:h="horizontal",...m}=t,g=jt("chakra-button__group",i),b=l.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let y={display:"inline-flex",...d?OL[h]:RL[h](c)};const x=h==="vertical";return a.jsx(EL,{value:b,children:a.jsx(Ee.div,{ref:n,role:"group",__css:y,className:g,"data-attached":d?"":void 0,"data-orientation":h,flexDir:x?"column":void 0,...m})})});zn.displayName="ButtonGroup";function AL(e){const[t,n]=l.useState(!e);return{ref:l.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function tb(e){const{children:t,className:n,...r}=e,o=l.isValidElement(t)?l.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=jt("chakra-button__icon",n);return a.jsx(Ee.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}tb.displayName="ButtonIcon";function nb(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=a.jsx(bi,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:i,...c}=e,d=jt("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",h=l.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[p]:t?r:0,fontSize:"1em",lineHeight:"normal",...i}),[i,t,p,r]);return a.jsx(Ee.div,{className:d,...c,__css:h,children:o})}nb.displayName="ButtonSpinner";var tl=Oe((e,t)=>{const n=ML(),r=ll("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:i,children:c,leftIcon:d,rightIcon:p,loadingText:h,iconSpacing:m="0.5rem",type:g,spinner:b,spinnerPlacement:y="start",className:x,as:C,...S}=ar(e),j=l.useMemo(()=>{const M={...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:M}}},[r,n]),{ref:_,type:I}=AL(C),P={rightIcon:p,leftIcon:d,iconSpacing:m,children:c};return a.jsxs(Ee.button,{ref:sL(t,_),as:C,type:g??I,"data-active":qt(i),"data-loading":qt(s),__css:j,className:jt("chakra-button",x),...S,disabled:o||s,children:[s&&y==="start"&&a.jsx(nb,{className:"chakra-button__spinner--start",label:h,placement:"start",spacing:m,children:b}),s?h||a.jsx(Ee.span,{opacity:0,children:a.jsx(IS,{...P})}):a.jsx(IS,{...P}),s&&y==="end"&&a.jsx(nb,{className:"chakra-button__spinner--end",label:h,placement:"end",spacing:m,children:b})]})});tl.displayName="Button";function IS(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return a.jsxs(a.Fragment,{children:[t&&a.jsx(tb,{marginEnd:o,children:t}),r,n&&a.jsx(tb,{marginStart:o,children:n})]})}var _a=Oe((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...i}=e,c=n||r,d=l.isValidElement(c)?l.cloneElement(c,{"aria-hidden":!0,focusable:!1}):null;return a.jsx(tl,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...i,children:d})});_a.displayName="IconButton";var[fbe,DL]=Hn({name:"CheckboxGroupContext",strict:!1});function TL(e){const[t,n]=l.useState(e),[r,o]=l.useState(!1);return e!==t&&(o(!0),n(e)),r}function NL(e){return a.jsx(Ee.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:a.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function $L(e){return a.jsx(Ee.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:a.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function LL(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?$L:NL;return n||t?a.jsx(Ee.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:a.jsx(o,{...r})}):null}var[zL,FP]=Hn({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[FL,kf]=Hn({strict:!1,name:"FormControlContext"});function BL(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...i}=e,c=l.useId(),d=t||`field-${c}`,p=`${d}-label`,h=`${d}-feedback`,m=`${d}-helptext`,[g,b]=l.useState(!1),[y,x]=l.useState(!1),[C,S]=l.useState(!1),j=l.useCallback((R={},A=null)=>({id:m,...R,ref:gn(A,D=>{D&&x(!0)})}),[m]),_=l.useCallback((R={},A=null)=>({...R,ref:A,"data-focus":qt(C),"data-disabled":qt(o),"data-invalid":qt(r),"data-readonly":qt(s),id:R.id!==void 0?R.id:p,htmlFor:R.htmlFor!==void 0?R.htmlFor:d}),[d,o,C,r,s,p]),I=l.useCallback((R={},A=null)=>({id:h,...R,ref:gn(A,D=>{D&&b(!0)}),"aria-live":"polite"}),[h]),P=l.useCallback((R={},A=null)=>({...R,...i,ref:A,role:"group"}),[i]),M=l.useCallback((R={},A=null)=>({...R,ref:A,role:"presentation","aria-hidden":!0,children:R.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!C,onFocus:()=>S(!0),onBlur:()=>S(!1),hasFeedbackText:g,setHasFeedbackText:b,hasHelpText:y,setHasHelpText:x,id:d,labelId:p,feedbackId:h,helpTextId:m,htmlProps:i,getHelpTextProps:j,getErrorMessageProps:I,getRootProps:P,getLabelProps:_,getRequiredIndicatorProps:M}}var Bn=Oe(function(t,n){const r=Qr("Form",t),o=ar(t),{getRootProps:s,htmlProps:i,...c}=BL(o),d=jt("chakra-form-control",t.className);return a.jsx(FL,{value:c,children:a.jsx(zL,{value:r,children:a.jsx(Ee.div,{...s({},n),className:d,__css:r.container})})})});Bn.displayName="FormControl";var BP=Oe(function(t,n){const r=kf(),o=FP(),s=jt("chakra-form__helper-text",t.className);return a.jsx(Ee.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});BP.displayName="FormHelperText";var vr=Oe(function(t,n){var r;const o=ll("FormLabel",t),s=ar(t),{className:i,children:c,requiredIndicator:d=a.jsx(HP,{}),optionalIndicator:p=null,...h}=s,m=kf(),g=(r=m==null?void 0:m.getLabelProps(h,n))!=null?r:{ref:n,...h};return a.jsxs(Ee.label,{...g,className:jt("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[c,m!=null&&m.isRequired?d:p]})});vr.displayName="FormLabel";var HP=Oe(function(t,n){const r=kf(),o=FP();if(!(r!=null&&r.isRequired))return null;const s=jt("chakra-form__required-indicator",t.className);return a.jsx(Ee.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});HP.displayName="RequiredIndicator";function Qx(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=Xx(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":_s(n),"aria-required":_s(o),"aria-readonly":_s(r)}}function Xx(e){var t,n,r;const o=kf(),{id:s,disabled:i,readOnly:c,required:d,isRequired:p,isInvalid:h,isReadOnly:m,isDisabled:g,onFocus:b,onBlur:y,...x}=e,C=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&C.push(o.feedbackId),o!=null&&o.hasHelpText&&C.push(o.helpTextId),{...x,"aria-describedby":C.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=i??g)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=c??m)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=d??p)!=null?r:o==null?void 0:o.isRequired,isInvalid:h??(o==null?void 0:o.isInvalid),onFocus:rt(o==null?void 0:o.onFocus,b),onBlur:rt(o==null?void 0:o.onBlur,y)}}var Yx={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},WP=Ee("span",{baseStyle:Yx});WP.displayName="VisuallyHidden";var HL=Ee("input",{baseStyle:Yx});HL.displayName="VisuallyHiddenInput";const WL=()=>typeof document<"u";let PS=!1,jf=null,Vl=!1,rb=!1;const ob=new Set;function Jx(e,t){ob.forEach(n=>n(e,t))}const VL=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function UL(e){return!(e.metaKey||!VL&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ES(e){Vl=!0,UL(e)&&(jf="keyboard",Jx("keyboard",e))}function kc(e){if(jf="pointer",e.type==="mousedown"||e.type==="pointerdown"){Vl=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;Jx("pointer",e)}}function GL(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function qL(e){GL(e)&&(Vl=!0,jf="virtual")}function KL(e){e.target===window||e.target===document||(!Vl&&!rb&&(jf="virtual",Jx("virtual",e)),Vl=!1,rb=!1)}function QL(){Vl=!1,rb=!0}function MS(){return jf!=="pointer"}function XL(){if(!WL()||PS)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Vl=!0,e.apply(this,n)},document.addEventListener("keydown",ES,!0),document.addEventListener("keyup",ES,!0),document.addEventListener("click",qL,!0),window.addEventListener("focus",KL,!0),window.addEventListener("blur",QL,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",kc,!0),document.addEventListener("pointermove",kc,!0),document.addEventListener("pointerup",kc,!0)):(document.addEventListener("mousedown",kc,!0),document.addEventListener("mousemove",kc,!0),document.addEventListener("mouseup",kc,!0)),PS=!0}function VP(e){XL(),e(MS());const t=()=>e(MS());return ob.add(t),()=>{ob.delete(t)}}function YL(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function UP(e={}){const t=Xx(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:i,onBlur:c,onFocus:d,"aria-describedby":p}=t,{defaultChecked:h,isChecked:m,isFocusable:g,onChange:b,isIndeterminate:y,name:x,value:C,tabIndex:S=void 0,"aria-label":j,"aria-labelledby":_,"aria-invalid":I,...P}=e,M=YL(P,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),R=pr(b),A=pr(c),D=pr(d),[O,T]=l.useState(!1),[Y,z]=l.useState(!1),[W,Q]=l.useState(!1),[U,L]=l.useState(!1);l.useEffect(()=>VP(T),[]);const ee=l.useRef(null),[K,Z]=l.useState(!0),[se,fe]=l.useState(!!h),G=m!==void 0,te=G?m:se,V=l.useCallback(he=>{if(r||n){he.preventDefault();return}G||fe(te?he.target.checked:y?!0:he.target.checked),R==null||R(he)},[r,n,te,G,y,R]);Yc(()=>{ee.current&&(ee.current.indeterminate=!!y)},[y]),xi(()=>{n&&z(!1)},[n,z]),Yc(()=>{const he=ee.current;if(!(he!=null&&he.form))return;const Ne=()=>{fe(!!h)};return he.form.addEventListener("reset",Ne),()=>{var De;return(De=he.form)==null?void 0:De.removeEventListener("reset",Ne)}},[]);const F=n&&!g,X=l.useCallback(he=>{he.key===" "&&L(!0)},[L]),ue=l.useCallback(he=>{he.key===" "&&L(!1)},[L]);Yc(()=>{if(!ee.current)return;ee.current.checked!==te&&fe(ee.current.checked)},[ee.current]);const q=l.useCallback((he={},Ne=null)=>{const De=qe=>{Y&&qe.preventDefault(),L(!0)};return{...he,ref:Ne,"data-active":qt(U),"data-hover":qt(W),"data-checked":qt(te),"data-focus":qt(Y),"data-focus-visible":qt(Y&&O),"data-indeterminate":qt(y),"data-disabled":qt(n),"data-invalid":qt(s),"data-readonly":qt(r),"aria-hidden":!0,onMouseDown:rt(he.onMouseDown,De),onMouseUp:rt(he.onMouseUp,()=>L(!1)),onMouseEnter:rt(he.onMouseEnter,()=>Q(!0)),onMouseLeave:rt(he.onMouseLeave,()=>Q(!1))}},[U,te,n,Y,O,W,y,s,r]),ne=l.useCallback((he={},Ne=null)=>({...he,ref:Ne,"data-active":qt(U),"data-hover":qt(W),"data-checked":qt(te),"data-focus":qt(Y),"data-focus-visible":qt(Y&&O),"data-indeterminate":qt(y),"data-disabled":qt(n),"data-invalid":qt(s),"data-readonly":qt(r)}),[U,te,n,Y,O,W,y,s,r]),pe=l.useCallback((he={},Ne=null)=>({...M,...he,ref:gn(Ne,De=>{De&&Z(De.tagName==="LABEL")}),onClick:rt(he.onClick,()=>{var De;K||((De=ee.current)==null||De.click(),requestAnimationFrame(()=>{var qe;(qe=ee.current)==null||qe.focus({preventScroll:!0})}))}),"data-disabled":qt(n),"data-checked":qt(te),"data-invalid":qt(s)}),[M,n,te,s,K]),le=l.useCallback((he={},Ne=null)=>({...he,ref:gn(ee,Ne),type:"checkbox",name:x,value:C,id:i,tabIndex:S,onChange:rt(he.onChange,V),onBlur:rt(he.onBlur,A,()=>z(!1)),onFocus:rt(he.onFocus,D,()=>z(!0)),onKeyDown:rt(he.onKeyDown,X),onKeyUp:rt(he.onKeyUp,ue),required:o,checked:te,disabled:F,readOnly:r,"aria-label":j,"aria-labelledby":_,"aria-invalid":I?!!I:s,"aria-describedby":p,"aria-disabled":n,style:Yx}),[x,C,i,V,A,D,X,ue,o,te,F,r,j,_,I,s,p,n,S]),we=l.useCallback((he={},Ne=null)=>({...he,ref:Ne,onMouseDown:rt(he.onMouseDown,JL),"data-disabled":qt(n),"data-checked":qt(te),"data-invalid":qt(s)}),[te,n,s]);return{state:{isInvalid:s,isFocused:Y,isChecked:te,isActive:U,isHovered:W,isIndeterminate:y,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:pe,getCheckboxProps:q,getIndicatorProps:ne,getInputProps:le,getLabelProps:we,htmlProps:M}}function JL(e){e.preventDefault(),e.stopPropagation()}var ZL={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},ez={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},tz=yi({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),nz=yi({from:{opacity:0},to:{opacity:1}}),rz=yi({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),_f=Oe(function(t,n){const r=DL(),o={...r,...t},s=Qr("Checkbox",o),i=ar(t),{spacing:c="0.5rem",className:d,children:p,iconColor:h,iconSize:m,icon:g=a.jsx(LL,{}),isChecked:b,isDisabled:y=r==null?void 0:r.isDisabled,onChange:x,inputProps:C,...S}=i;let j=b;r!=null&&r.value&&i.value&&(j=r.value.includes(i.value));let _=x;r!=null&&r.onChange&&i.value&&(_=og(r.onChange,x));const{state:I,getInputProps:P,getCheckboxProps:M,getLabelProps:R,getRootProps:A}=UP({...S,isDisabled:y,isChecked:j,onChange:_}),D=TL(I.isChecked),O=l.useMemo(()=>({animation:D?I.isIndeterminate?`${nz} 20ms linear, ${rz} 200ms linear`:`${tz} 200ms linear`:void 0,fontSize:m,color:h,...s.icon}),[h,m,D,I.isIndeterminate,s.icon]),T=l.cloneElement(g,{__css:O,isIndeterminate:I.isIndeterminate,isChecked:I.isChecked});return a.jsxs(Ee.label,{__css:{...ez,...s.container},className:jt("chakra-checkbox",d),...A(),children:[a.jsx("input",{className:"chakra-checkbox__input",...P(C,n)}),a.jsx(Ee.span,{__css:{...ZL,...s.control},className:"chakra-checkbox__control",...M(),children:T}),p&&a.jsx(Ee.span,{className:"chakra-checkbox__label",...R(),__css:{marginStart:c,...s.label},children:p})]})});_f.displayName="Checkbox";function oz(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function Zx(e,t){let n=oz(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function sb(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 Qh(e,t,n){return(e-t)*100/(n-t)}function GP(e,t,n){return(n-t)*e+t}function ab(e,t,n){const r=Math.round((e-t)/n)*n+t,o=sb(n);return Zx(r,o)}function tu(e,t,n){return e==null?e:(n{var O;return r==null?"":(O=Lv(r,s,n))!=null?O:""}),g=typeof o<"u",b=g?o:h,y=qP(Bi(b),s),x=n??y,C=l.useCallback(O=>{O!==b&&(g||m(O.toString()),p==null||p(O.toString(),Bi(O)))},[p,g,b]),S=l.useCallback(O=>{let T=O;return d&&(T=tu(T,i,c)),Zx(T,x)},[x,d,c,i]),j=l.useCallback((O=s)=>{let T;b===""?T=Bi(O):T=Bi(b)+O,T=S(T),C(T)},[S,s,C,b]),_=l.useCallback((O=s)=>{let T;b===""?T=Bi(-O):T=Bi(b)-O,T=S(T),C(T)},[S,s,C,b]),I=l.useCallback(()=>{var O;let T;r==null?T="":T=(O=Lv(r,s,n))!=null?O:i,C(T)},[r,n,s,C,i]),P=l.useCallback(O=>{var T;const Y=(T=Lv(O,s,x))!=null?T:i;C(Y)},[x,s,C,i]),M=Bi(b);return{isOutOfRange:M>c||M" `}),[iz,ey]=Hn({name:"EditableContext",errorMessage:"useEditableContext: context is undefined. Seems you forgot to wrap the editable components in ``"}),QP={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent"},If=Oe(function(t,n){const{getInputProps:r}=ey(),o=KP(),s=r(t,n),i=jt("chakra-editable__input",t.className);return a.jsx(Ee.input,{...s,__css:{outline:0,...QP,...o.input},className:i})});If.displayName="EditableInput";var Pf=Oe(function(t,n){const{getPreviewProps:r}=ey(),o=KP(),s=r(t,n),i=jt("chakra-editable__preview",t.className);return a.jsx(Ee.span,{...s,__css:{cursor:"text",display:"inline-block",...QP,...o.preview},className:i})});Pf.displayName="EditablePreview";function Tl(e,t,n,r){const o=pr(n);return l.useEffect(()=>{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 lz(e){return"current"in e}var XP=()=>typeof window<"u";function cz(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var uz=e=>XP()&&e.test(navigator.vendor),dz=e=>XP()&&e.test(cz()),fz=()=>dz(/mac|iphone|ipad|ipod/i),pz=()=>fz()&&uz(/apple/i);function YP(e){const{ref:t,elements:n,enabled:r}=e,o=()=>{var s,i;return(i=(s=t.current)==null?void 0:s.ownerDocument)!=null?i:document};Tl(o,"pointerdown",s=>{if(!pz()||!r)return;const i=s.target,d=(n??[t]).some(p=>{const h=lz(p)?p.current:p;return(h==null?void 0:h.contains(i))||h===i});o().activeElement!==i&&d&&(s.preventDefault(),i.focus())})}function OS(e,t){return e?e===t||e.contains(t):!1}function hz(e={}){const{onChange:t,onCancel:n,onSubmit:r,onBlur:o,value:s,isDisabled:i,defaultValue:c,startWithEditView:d,isPreviewFocusable:p=!0,submitOnBlur:h=!0,selectAllOnFocus:m=!0,placeholder:g,onEdit:b,finalFocusRef:y,...x}=e,C=pr(b),S=!!(d&&!i),[j,_]=l.useState(S),[I,P]=wf({defaultValue:c||"",value:s,onChange:t}),[M,R]=l.useState(I),A=l.useRef(null),D=l.useRef(null),O=l.useRef(null),T=l.useRef(null),Y=l.useRef(null);YP({ref:A,enabled:j,elements:[T,Y]});const z=!j&&!i;Yc(()=>{var q,ne;j&&((q=A.current)==null||q.focus(),m&&((ne=A.current)==null||ne.select()))},[]),xi(()=>{var q,ne,pe,le;if(!j){y?(q=y.current)==null||q.focus():(ne=O.current)==null||ne.focus();return}(pe=A.current)==null||pe.focus(),m&&((le=A.current)==null||le.select()),C==null||C()},[j,C,m]);const W=l.useCallback(()=>{z&&_(!0)},[z]),Q=l.useCallback(()=>{R(I)},[I]),U=l.useCallback(()=>{_(!1),P(M),n==null||n(M),o==null||o(M)},[n,o,P,M]),L=l.useCallback(()=>{_(!1),R(I),r==null||r(I),o==null||o(M)},[I,r,o,M]);l.useEffect(()=>{if(j)return;const q=A.current;(q==null?void 0:q.ownerDocument.activeElement)===q&&(q==null||q.blur())},[j]);const ee=l.useCallback(q=>{P(q.currentTarget.value)},[P]),K=l.useCallback(q=>{const ne=q.key,le={Escape:U,Enter:we=>{!we.shiftKey&&!we.metaKey&&L()}}[ne];le&&(q.preventDefault(),le(q))},[U,L]),Z=l.useCallback(q=>{const ne=q.key,le={Escape:U}[ne];le&&(q.preventDefault(),le(q))},[U]),se=I.length===0,fe=l.useCallback(q=>{var ne;if(!j)return;const pe=q.currentTarget.ownerDocument,le=(ne=q.relatedTarget)!=null?ne:pe.activeElement,we=OS(T.current,le),ve=OS(Y.current,le);!we&&!ve&&(h?L():U())},[h,L,U,j]),G=l.useCallback((q={},ne=null)=>{const pe=z&&p?0:void 0;return{...q,ref:gn(ne,D),children:se?g:I,hidden:j,"aria-disabled":_s(i),tabIndex:pe,onFocus:rt(q.onFocus,W,Q)}},[i,j,z,p,se,W,Q,g,I]),te=l.useCallback((q={},ne=null)=>({...q,hidden:!j,placeholder:g,ref:gn(ne,A),disabled:i,"aria-disabled":_s(i),value:I,onBlur:rt(q.onBlur,fe),onChange:rt(q.onChange,ee),onKeyDown:rt(q.onKeyDown,K),onFocus:rt(q.onFocus,Q)}),[i,j,fe,ee,K,Q,g,I]),V=l.useCallback((q={},ne=null)=>({...q,hidden:!j,placeholder:g,ref:gn(ne,A),disabled:i,"aria-disabled":_s(i),value:I,onBlur:rt(q.onBlur,fe),onChange:rt(q.onChange,ee),onKeyDown:rt(q.onKeyDown,Z),onFocus:rt(q.onFocus,Q)}),[i,j,fe,ee,Z,Q,g,I]),F=l.useCallback((q={},ne=null)=>({"aria-label":"Edit",...q,type:"button",onClick:rt(q.onClick,W),ref:gn(ne,O),disabled:i}),[W,i]),X=l.useCallback((q={},ne=null)=>({...q,"aria-label":"Submit",ref:gn(Y,ne),type:"button",onClick:rt(q.onClick,L),disabled:i}),[L,i]),ue=l.useCallback((q={},ne=null)=>({"aria-label":"Cancel",id:"cancel",...q,ref:gn(T,ne),type:"button",onClick:rt(q.onClick,U),disabled:i}),[U,i]);return{isEditing:j,isDisabled:i,isValueEmpty:se,value:I,onEdit:W,onCancel:U,onSubmit:L,getPreviewProps:G,getInputProps:te,getTextareaProps:V,getEditButtonProps:F,getSubmitButtonProps:X,getCancelButtonProps:ue,htmlProps:x}}var Ef=Oe(function(t,n){const r=Qr("Editable",t),o=ar(t),{htmlProps:s,...i}=hz(o),{isEditing:c,onSubmit:d,onCancel:p,onEdit:h}=i,m=jt("chakra-editable",t.className),g=xx(t.children,{isEditing:c,onSubmit:d,onCancel:p,onEdit:h});return a.jsx(iz,{value:i,children:a.jsx(az,{value:r,children:a.jsx(Ee.div,{ref:n,...s,className:m,children:g})})})});Ef.displayName="Editable";function JP(){const{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}=ey();return{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}}var ZP={exports:{}},mz="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",gz=mz,vz=gz;function e5(){}function t5(){}t5.resetWarningCache=e5;var bz=function(){function e(r,o,s,i,c,d){if(d!==vz){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:t5,resetWarningCache:e5};return n.PropTypes=n,n};ZP.exports=bz();var xz=ZP.exports;const Jn=hf(xz);var ib="data-focus-lock",n5="data-focus-lock-disabled",yz="data-no-focus-lock",Cz="data-autofocus-inside",wz="data-no-autofocus";function Sz(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function kz(e,t){var n=l.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 r5(e,t){return kz(t||null,function(n){return e.forEach(function(r){return Sz(r,n)})})}var zv={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},Ca=function(){return Ca=Object.assign||function(t){for(var n,r=1,o=arguments.length;r0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]0)&&!(o=r.next()).done;)s.push(o.value)}catch(c){i={error:c}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function lb(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(Lz)},zz=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],oy=zz.join(","),Fz="".concat(oy,", [data-focus-guard]"),C5=function(e,t){return Ba((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?Fz:oy)?[r]:[],C5(r))},[])},Bz=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?mg([e.contentDocument.body],t):[e]},mg=function(e,t){return e.reduce(function(n,r){var o,s=C5(r,t),i=(o=[]).concat.apply(o,s.map(function(c){return Bz(c,t)}));return n.concat(i,r.parentNode?Ba(r.parentNode.querySelectorAll(oy)).filter(function(c){return c===r}):[])},[])},Hz=function(e){var t=e.querySelectorAll("[".concat(Cz,"]"));return Ba(t).map(function(n){return mg([n])}).reduce(function(n,r){return n.concat(r)},[])},sy=function(e,t){return Ba(e).filter(function(n){return m5(t,n)}).filter(function(n){return Tz(n)})},AS=function(e,t){return t===void 0&&(t=new Map),Ba(e).filter(function(n){return g5(t,n)})},ub=function(e,t,n){return y5(sy(mg(e,n),t),!0,n)},DS=function(e,t){return y5(sy(mg(e),t),!1)},Wz=function(e,t){return sy(Hz(e),t)},nu=function(e,t){return e.shadowRoot?nu(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:Ba(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?nu(o,t):!1}return nu(n,t)})},Vz=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(i,c){return!t.has(c)})},w5=function(e){return e.parentNode?w5(e.parentNode):e},ay=function(e){var t=Xh(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(ib);return n.push.apply(n,o?Vz(Ba(w5(r).querySelectorAll("[".concat(ib,'="').concat(o,'"]:not([').concat(n5,'="disabled"])')))):[r]),n},[])},Uz=function(e){try{return e()}catch{return}},Gd=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Gd(t.shadowRoot):t instanceof HTMLIFrameElement&&Uz(function(){return t.contentWindow.document})?Gd(t.contentWindow.document):t}},Gz=function(e,t){return e===t},qz=function(e,t){return!!Ba(e.querySelectorAll("iframe")).some(function(n){return Gz(n,t)})},S5=function(e,t){return t===void 0&&(t=Gd(f5(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:ay(e).some(function(n){return nu(n,t)||qz(n,t)})},Kz=function(e){e===void 0&&(e=document);var t=Gd(e);return t?Ba(e.querySelectorAll("[".concat(yz,"]"))).some(function(n){return nu(n,t)}):!1},Qz=function(e,t){return t.filter(x5).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},iy=function(e,t){return x5(e)&&e.name?Qz(e,t):e},Xz=function(e){var t=new Set;return e.forEach(function(n){return t.add(iy(n,e))}),e.filter(function(n){return t.has(n)})},TS=function(e){return e[0]&&e.length>1?iy(e[0],e):e[0]},NS=function(e,t){return e.length>1?e.indexOf(iy(e[t],e)):t},k5="NEW_FOCUS",Yz=function(e,t,n,r){var o=e.length,s=e[0],i=e[o-1],c=ry(n);if(!(n&&e.indexOf(n)>=0)){var d=n!==void 0?t.indexOf(n):-1,p=r?t.indexOf(r):d,h=r?e.indexOf(r):-1,m=d-p,g=t.indexOf(s),b=t.indexOf(i),y=Xz(t),x=n!==void 0?y.indexOf(n):-1,C=x-(r?y.indexOf(r):d),S=NS(e,0),j=NS(e,o-1);if(d===-1||h===-1)return k5;if(!m&&h>=0)return h;if(d<=g&&c&&Math.abs(m)>1)return j;if(d>=b&&c&&Math.abs(m)>1)return S;if(m&&Math.abs(C)>1)return h;if(d<=g)return j;if(d>b)return S;if(m)return Math.abs(m)>1?h:(o+h+m)%o}},Jz=function(e){return function(t){var n,r=(n=v5(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},Zz=function(e,t,n){var r=e.map(function(s){var i=s.node;return i}),o=AS(r.filter(Jz(n)));return o&&o.length?TS(o):TS(AS(t))},db=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&db(e.parentNode.host||e.parentNode,t),t},Fv=function(e,t){for(var n=db(e),r=db(t),o=0;o=0)return s}return!1},j5=function(e,t,n){var r=Xh(e),o=Xh(t),s=r[0],i=!1;return o.filter(Boolean).forEach(function(c){i=Fv(i||c,c)||i,n.filter(Boolean).forEach(function(d){var p=Fv(s,d);p&&(!i||nu(p,i)?i=p:i=Fv(p,i))})}),i},eF=function(e,t){return e.reduce(function(n,r){return n.concat(Wz(r,t))},[])},tF=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($z)},nF=function(e,t){var n=Gd(Xh(e).length>0?document:f5(e).ownerDocument),r=ay(e).filter(Yh),o=j5(n||e,e,r),s=new Map,i=DS(r,s),c=ub(r,s).filter(function(b){var y=b.node;return Yh(y)});if(!(!c[0]&&(c=i,!c[0]))){var d=DS([o],s).map(function(b){var y=b.node;return y}),p=tF(d,c),h=p.map(function(b){var y=b.node;return y}),m=Yz(h,d,n,t);if(m===k5){var g=Zz(i,h,eF(r,s));if(g)return{node:g};console.warn("focus-lock: cannot find any node to move focus into");return}return m===void 0?m:p[m]}},rF=function(e){var t=ay(e).filter(Yh),n=j5(e,e,t),r=new Map,o=ub([n],r,!0),s=ub(t,r).filter(function(i){var c=i.node;return Yh(c)}).map(function(i){var c=i.node;return c});return o.map(function(i){var c=i.node,d=i.index;return{node:c,index:d,lockItem:s.indexOf(c)>=0,guard:ry(c)}})},oF=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},Bv=0,Hv=!1,_5=function(e,t,n){n===void 0&&(n={});var r=nF(e,t);if(!Hv&&r){if(Bv>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Hv=!0,setTimeout(function(){Hv=!1},1);return}Bv++,oF(r.node,n.focusOptions),Bv--}};function ly(e){setTimeout(e,1)}var sF=function(){return document&&document.activeElement===document.body},aF=function(){return sF()||Kz()},ru=null,Gc=null,ou=null,qd=!1,iF=function(){return!0},lF=function(t){return(ru.whiteList||iF)(t)},cF=function(t,n){ou={observerNode:t,portaledElement:n}},uF=function(t){return ou&&ou.portaledElement===t};function $S(e,t,n,r){var o=null,s=e;do{var i=r[s];if(i.guard)i.node.dataset.focusAutoGuard&&(o=i);else if(i.lockItem){if(s!==e)return;o=null}else break}while((s+=n)!==t);o&&(o.node.tabIndex=0)}var dF=function(t){return t&&"current"in t?t.current:t},fF=function(t){return t?!!qd:qd==="meanwhile"},pF=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},hF=function(t,n){return n.some(function(r){return pF(t,r,r)})},Jh=function(){var t=!1;if(ru){var n=ru,r=n.observed,o=n.persistentFocus,s=n.autoFocus,i=n.shards,c=n.crossFrame,d=n.focusOptions,p=r||ou&&ou.portaledElement,h=document&&document.activeElement;if(p){var m=[p].concat(i.map(dF).filter(Boolean));if((!h||lF(h))&&(o||fF(c)||!aF()||!Gc&&s)&&(p&&!(S5(m)||h&&hF(h,m)||uF(h))&&(document&&!Gc&&h&&!s?(h.blur&&h.blur(),document.body.focus()):(t=_5(m,Gc,{focusOptions:d}),ou={})),qd=!1,Gc=document&&document.activeElement),document){var g=document&&document.activeElement,b=rF(m),y=b.map(function(x){var C=x.node;return C}).indexOf(g);y>-1&&(b.filter(function(x){var C=x.guard,S=x.node;return C&&S.dataset.focusAutoGuard}).forEach(function(x){var C=x.node;return C.removeAttribute("tabIndex")}),$S(y,b.length,1,b),$S(y,-1,-1,b))}}}return t},I5=function(t){Jh()&&t&&(t.stopPropagation(),t.preventDefault())},cy=function(){return ly(Jh)},mF=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||cF(r,n)},gF=function(){return null},P5=function(){qd="just",ly(function(){qd="meanwhile"})},vF=function(){document.addEventListener("focusin",I5),document.addEventListener("focusout",cy),window.addEventListener("blur",P5)},bF=function(){document.removeEventListener("focusin",I5),document.removeEventListener("focusout",cy),window.removeEventListener("blur",P5)};function xF(e){return e.filter(function(t){var n=t.disabled;return!n})}function yF(e){var t=e.slice(-1)[0];t&&!ru&&vF();var n=ru,r=n&&t&&t.id===n.id;ru=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(Gc=null,(!r||n.observed!==t.observed)&&t.onActivation(),Jh(),ly(Jh)):(bF(),Gc=null)}c5.assignSyncMedium(mF);u5.assignMedium(cy);_z.assignMedium(function(e){return e({moveFocusInside:_5,focusInside:S5})});const CF=Mz(xF,yF)(gF);var E5=l.forwardRef(function(t,n){return l.createElement(d5,mr({sideCar:CF,ref:n},t))}),M5=d5.propTypes||{};M5.sideCar;P$(M5,["sideCar"]);E5.propTypes={};const LS=E5;function O5(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function uy(e){var t;if(!O5(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function wF(e){var t,n;return(n=(t=R5(e))==null?void 0:t.defaultView)!=null?n:window}function R5(e){return O5(e)?e.ownerDocument:document}function SF(e){return R5(e).activeElement}function kF(e){const t=e.ownerDocument.defaultView||window,{overflow:n,overflowX:r,overflowY:o}=t.getComputedStyle(e);return/auto|scroll|overlay|hidden/.test(n+o+r)}function jF(e){return e.localName==="html"?e:e.assignedSlot||e.parentElement||e.ownerDocument.documentElement}function A5(e){return["html","body","#document"].includes(e.localName)?e.ownerDocument.body:uy(e)&&kF(e)?e:A5(jF(e))}var D5=e=>e.hasAttribute("tabindex"),_F=e=>D5(e)&&e.tabIndex===-1;function IF(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function T5(e){return e.parentElement&&T5(e.parentElement)?!0:e.hidden}function PF(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function N5(e){if(!uy(e)||T5(e)||IF(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]():PF(e)?!0:D5(e)}function EF(e){return e?uy(e)&&N5(e)&&!_F(e):!1}var MF=["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]"],OF=MF.join(),RF=e=>e.offsetWidth>0&&e.offsetHeight>0;function $5(e){const t=Array.from(e.querySelectorAll(OF));return t.unshift(e),t.filter(n=>N5(n)&&RF(n))}var zS,AF=(zS=LS.default)!=null?zS:LS,L5=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:i,autoFocus:c,persistentFocus:d,lockFocusAcrossFrames:p}=e,h=l.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&$5(r.current).length===0&&requestAnimationFrame(()=>{var y;(y=r.current)==null||y.focus()})},[t,r]),m=l.useCallback(()=>{var b;(b=n==null?void 0:n.current)==null||b.focus()},[n]),g=o&&!n;return a.jsx(AF,{crossFrame:p,persistentFocus:d,autoFocus:c,disabled:i,onActivation:h,onDeactivation:m,returnFocus:g,children:s})};L5.displayName="FocusLock";var DF=G$?l.useLayoutEffect:l.useEffect;function fb(e,t=[]){const n=l.useRef(e);return DF(()=>{n.current=e}),l.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function TF(e,t,n,r){const o=fb(t);return l.useEffect(()=>{var s;const i=(s=Mw(n))!=null?s:document;if(t)return i.addEventListener(e,o,r),()=>{i.removeEventListener(e,o,r)}},[e,n,r,o,t]),()=>{var s;((s=Mw(n))!=null?s:document).removeEventListener(e,o,r)}}function NF(e,t){const n=l.useId();return l.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function $F(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function ls(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=fb(n),i=fb(t),[c,d]=l.useState(e.defaultIsOpen||!1),[p,h]=$F(r,c),m=NF(o,"disclosure"),g=l.useCallback(()=>{p||d(!1),i==null||i()},[p,i]),b=l.useCallback(()=>{p||d(!0),s==null||s()},[p,s]),y=l.useCallback(()=>{(h?g:b)()},[h,b,g]);return{isOpen:!!h,onOpen:b,onClose:g,onToggle:y,isControlled:p,getButtonProps:(x={})=>({...x,"aria-expanded":h,"aria-controls":m,onClick:aD(x.onClick,y)}),getDisclosureProps:(x={})=>({...x,hidden:!h,id:m})}}var[LF,zF]=Hn({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),z5=Oe(function(t,n){const r=Qr("Input",t),{children:o,className:s,...i}=ar(t),c=jt("chakra-input__group",s),d={},p=hg(o),h=r.field;p.forEach(g=>{var b,y;r&&(h&&g.type.id==="InputLeftElement"&&(d.paddingStart=(b=h.height)!=null?b:h.h),h&&g.type.id==="InputRightElement"&&(d.paddingEnd=(y=h.height)!=null?y:h.h),g.type.id==="InputRightAddon"&&(d.borderEndRadius=0),g.type.id==="InputLeftAddon"&&(d.borderStartRadius=0))});const m=p.map(g=>{var b,y;const x=SI({size:((b=g.props)==null?void 0:b.size)||t.size,variant:((y=g.props)==null?void 0:y.variant)||t.variant});return g.type.id!=="Input"?l.cloneElement(g,x):l.cloneElement(g,Object.assign(x,d,g.props))});return a.jsx(Ee.div,{className:c,ref:n,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...i,children:a.jsx(LF,{value:r,children:m})})});z5.displayName="InputGroup";var FF=Ee("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),gg=Oe(function(t,n){var r,o;const{placement:s="left",...i}=t,c=zF(),d=c.field,h={[s==="left"?"insetStart":"insetEnd"]:"0",width:(r=d==null?void 0:d.height)!=null?r:d==null?void 0:d.h,height:(o=d==null?void 0:d.height)!=null?o:d==null?void 0:d.h,fontSize:d==null?void 0:d.fontSize,...c.element};return a.jsx(FF,{ref:n,__css:h,...i})});gg.id="InputElement";gg.displayName="InputElement";var F5=Oe(function(t,n){const{className:r,...o}=t,s=jt("chakra-input__left-element",r);return a.jsx(gg,{ref:n,placement:"left",className:s,...o})});F5.id="InputLeftElement";F5.displayName="InputLeftElement";var dy=Oe(function(t,n){const{className:r,...o}=t,s=jt("chakra-input__right-element",r);return a.jsx(gg,{ref:n,placement:"right",className:s,...o})});dy.id="InputRightElement";dy.displayName="InputRightElement";var vg=Oe(function(t,n){const{htmlSize:r,...o}=t,s=Qr("Input",o),i=ar(o),c=Qx(i),d=jt("chakra-input",t.className);return a.jsx(Ee.input,{size:r,...c,__css:s.field,ref:n,className:d})});vg.displayName="Input";vg.id="Input";var bg=Oe(function(t,n){const r=ll("Link",t),{className:o,isExternal:s,...i}=ar(t);return a.jsx(Ee.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:jt("chakra-link",o),...i,__css:r})});bg.displayName="Link";var[BF,B5]=Hn({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),fy=Oe(function(t,n){const r=Qr("List",t),{children:o,styleType:s="none",stylePosition:i,spacing:c,...d}=ar(t),p=hg(o),m=c?{["& > *:not(style) ~ *:not(style)"]:{mt:c}}:{};return a.jsx(BF,{value:r,children:a.jsx(Ee.ul,{ref:n,listStyleType:s,listStylePosition:i,role:"list",__css:{...r.container,...m},...d,children:p})})});fy.displayName="List";var H5=Oe((e,t)=>{const{as:n,...r}=e;return a.jsx(fy,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});H5.displayName="OrderedList";var Mf=Oe(function(t,n){const{as:r,...o}=t;return a.jsx(fy,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});Mf.displayName="UnorderedList";var ws=Oe(function(t,n){const r=B5();return a.jsx(Ee.li,{ref:n,...t,__css:r.item})});ws.displayName="ListItem";var HF=Oe(function(t,n){const r=B5();return a.jsx(zr,{ref:n,role:"presentation",...t,__css:r.icon})});HF.displayName="ListIcon";var nl=Oe(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:i,column:c,row:d,autoFlow:p,autoRows:h,templateRows:m,autoColumns:g,templateColumns:b,...y}=t,x={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:i,gridAutoColumns:g,gridColumn:c,gridRow:d,gridAutoFlow:p,gridAutoRows:h,gridTemplateRows:m,gridTemplateColumns:b};return a.jsx(Ee.div,{ref:n,__css:x,...y})});nl.displayName="Grid";function W5(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):L1(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var ji=Ee("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});ji.displayName="Spacer";var V5=e=>a.jsx(Ee.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});V5.displayName="StackItem";function WF(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{"&":W5(n,o=>r[o])}}var py=Oe((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:i="0.5rem",wrap:c,children:d,divider:p,className:h,shouldWrapChildren:m,...g}=e,b=n?"row":r??"column",y=l.useMemo(()=>WF({spacing:i,direction:b}),[i,b]),x=!!p,C=!m&&!x,S=l.useMemo(()=>{const _=hg(d);return C?_:_.map((I,P)=>{const M=typeof I.key<"u"?I.key:P,R=P+1===_.length,D=m?a.jsx(V5,{children:I},M):I;if(!x)return D;const O=l.cloneElement(p,{__css:y}),T=R?null:O;return a.jsxs(l.Fragment,{children:[D,T]},M)})},[p,y,x,C,m,d]),j=jt("chakra-stack",h);return a.jsx(Ee.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:b,flexWrap:c,gap:x?void 0:i,className:j,...g,children:S})});py.displayName="Stack";var U5=Oe((e,t)=>a.jsx(py,{align:"center",...e,direction:"column",ref:t}));U5.displayName="VStack";var xg=Oe((e,t)=>a.jsx(py,{align:"center",...e,direction:"row",ref:t}));xg.displayName="HStack";function FS(e){return W5(e,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}var Kd=Oe(function(t,n){const{area:r,colSpan:o,colStart:s,colEnd:i,rowEnd:c,rowSpan:d,rowStart:p,...h}=t,m=SI({gridArea:r,gridColumn:FS(o),gridRow:FS(d),gridColumnStart:s,gridColumnEnd:i,gridRowStart:p,gridRowEnd:c});return a.jsx(Ee.div,{ref:n,__css:m,...h})});Kd.displayName="GridItem";var Ha=Oe(function(t,n){const r=ll("Badge",t),{className:o,...s}=ar(t);return a.jsx(Ee.span,{ref:n,className:jt("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});Ha.displayName="Badge";var no=Oe(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:i,borderWidth:c,borderStyle:d,borderColor:p,...h}=ll("Divider",t),{className:m,orientation:g="horizontal",__css:b,...y}=ar(t),x={vertical:{borderLeftWidth:r||i||c||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||c||"1px",width:"100%"}};return a.jsx(Ee.hr,{ref:n,"aria-orientation":g,...y,__css:{...h,border:"0",borderColor:p,borderStyle:d,...x[g],...b},className:jt("chakra-divider",m)})});no.displayName="Divider";function VF(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function UF(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=l.useState([]),s=l.useRef(),i=()=>{s.current&&(clearTimeout(s.current),s.current=null)},c=()=>{i(),s.current=setTimeout(()=>{o([]),s.current=null},t)};l.useEffect(()=>i,[]);function d(p){return h=>{if(h.key==="Backspace"){const m=[...r];m.pop(),o(m);return}if(VF(h)){const m=r.concat(h.key);n(h)&&(h.preventDefault(),h.stopPropagation()),o(m),p(m.join("")),c()}}}return d}function GF(e,t,n,r){if(t==null)return r;if(!r)return e.find(i=>n(i).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 qF(){const e=l.useRef(new Map),t=e.current,n=l.useCallback((o,s,i,c)=>{e.current.set(i,{type:s,el:o,options:c}),o.addEventListener(s,i,c)},[]),r=l.useCallback((o,s,i,c)=>{o.removeEventListener(s,i,c),e.current.delete(i)},[]);return l.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function Wv(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function G5(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:i,onMouseUp:c,onClick:d,onKeyDown:p,onKeyUp:h,tabIndex:m,onMouseOver:g,onMouseLeave:b,...y}=e,[x,C]=l.useState(!0),[S,j]=l.useState(!1),_=qF(),I=L=>{L&&L.tagName!=="BUTTON"&&C(!1)},P=x?m:m||0,M=n&&!r,R=l.useCallback(L=>{if(n){L.stopPropagation(),L.preventDefault();return}L.currentTarget.focus(),d==null||d(L)},[n,d]),A=l.useCallback(L=>{S&&Wv(L)&&(L.preventDefault(),L.stopPropagation(),j(!1),_.remove(document,"keyup",A,!1))},[S,_]),D=l.useCallback(L=>{if(p==null||p(L),n||L.defaultPrevented||L.metaKey||!Wv(L.nativeEvent)||x)return;const ee=o&&L.key==="Enter";s&&L.key===" "&&(L.preventDefault(),j(!0)),ee&&(L.preventDefault(),L.currentTarget.click()),_.add(document,"keyup",A,!1)},[n,x,p,o,s,_,A]),O=l.useCallback(L=>{if(h==null||h(L),n||L.defaultPrevented||L.metaKey||!Wv(L.nativeEvent)||x)return;s&&L.key===" "&&(L.preventDefault(),j(!1),L.currentTarget.click())},[s,x,n,h]),T=l.useCallback(L=>{L.button===0&&(j(!1),_.remove(document,"mouseup",T,!1))},[_]),Y=l.useCallback(L=>{if(L.button!==0)return;if(n){L.stopPropagation(),L.preventDefault();return}x||j(!0),L.currentTarget.focus({preventScroll:!0}),_.add(document,"mouseup",T,!1),i==null||i(L)},[n,x,i,_,T]),z=l.useCallback(L=>{L.button===0&&(x||j(!1),c==null||c(L))},[c,x]),W=l.useCallback(L=>{if(n){L.preventDefault();return}g==null||g(L)},[n,g]),Q=l.useCallback(L=>{S&&(L.preventDefault(),j(!1)),b==null||b(L)},[S,b]),U=gn(t,I);return x?{...y,ref:U,type:"button","aria-disabled":M?void 0:n,disabled:M,onClick:R,onMouseDown:i,onMouseUp:c,onKeyUp:h,onKeyDown:p,onMouseOver:g,onMouseLeave:b}:{...y,ref:U,role:"button","data-active":qt(S),"aria-disabled":n?"true":void 0,tabIndex:M?void 0:P,onClick:R,onMouseDown:Y,onMouseUp:z,onKeyUp:O,onKeyDown:D,onMouseOver:W,onMouseLeave:Q}}function KF(e){const t=e.current;if(!t)return!1;const n=SF(t);return!n||t.contains(n)?!1:!!EF(n)}function q5(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;xi(()=>{if(!s||KF(e))return;const i=(o==null?void 0:o.current)||e.current;let c;if(i)return c=requestAnimationFrame(()=>{i.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(c)}},[s,e,o])}var QF={preventScroll:!0,shouldFocus:!1};function XF(e,t=QF){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,i=YF(e)?e.current:e,c=o&&s,d=l.useRef(c),p=l.useRef(s);Yc(()=>{!p.current&&s&&(d.current=c),p.current=s},[s,c]);const h=l.useCallback(()=>{if(!(!s||!i||!d.current)&&(d.current=!1,!i.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var m;(m=n.current)==null||m.focus({preventScroll:r})});else{const m=$5(i);m.length>0&&requestAnimationFrame(()=>{m[0].focus({preventScroll:r})})}},[s,r,i,n]);xi(()=>{h()},[h]),Tl(i,"transitionend",h)}function YF(e){return"current"in e}var jc=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),Fr={arrowShadowColor:jc("--popper-arrow-shadow-color"),arrowSize:jc("--popper-arrow-size","8px"),arrowSizeHalf:jc("--popper-arrow-size-half"),arrowBg:jc("--popper-arrow-bg"),transformOrigin:jc("--popper-transform-origin"),arrowOffset:jc("--popper-arrow-offset")};function JF(e){if(e.includes("top"))return"1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("bottom"))return"-1px -1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("right"))return"-1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("left"))return"1px -1px 0px 0 var(--popper-arrow-shadow-color)"}var ZF={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"},eB=e=>ZF[e],BS={scroll:!0,resize:!0};function tB(e){let t;return typeof e=="object"?t={enabled:!0,options:{...BS,...e}}:t={enabled:e,options:BS},t}var nB={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`}},rB={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{HS(e)},effect:({state:e})=>()=>{HS(e)}},HS=e=>{e.elements.popper.style.setProperty(Fr.transformOrigin.var,eB(e.placement))},oB={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{sB(e)}},sB=e=>{var t;if(!e.placement)return;const n=aB(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:Fr.arrowSize.varRef,height:Fr.arrowSize.varRef,zIndex:-1});const r={[Fr.arrowSizeHalf.var]:`calc(${Fr.arrowSize.varRef} / 2 - 1px)`,[Fr.arrowOffset.var]:`calc(${Fr.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},aB=e=>{if(e.startsWith("top"))return{property:"bottom",value:Fr.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:Fr.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:Fr.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:Fr.arrowOffset.varRef}},iB={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{WS(e)},effect:({state:e})=>()=>{WS(e)}},WS=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=JF(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:Fr.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},lB={"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"}},cB={"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 uB(e,t="ltr"){var n,r;const o=((n=lB[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=cB[e])!=null?r:o}var Wo="top",Es="bottom",Ms="right",Vo="left",hy="auto",Of=[Wo,Es,Ms,Vo],hu="start",Qd="end",dB="clippingParents",K5="viewport",gd="popper",fB="reference",VS=Of.reduce(function(e,t){return e.concat([t+"-"+hu,t+"-"+Qd])},[]),Q5=[].concat(Of,[hy]).reduce(function(e,t){return e.concat([t,t+"-"+hu,t+"-"+Qd])},[]),pB="beforeRead",hB="read",mB="afterRead",gB="beforeMain",vB="main",bB="afterMain",xB="beforeWrite",yB="write",CB="afterWrite",wB=[pB,hB,mB,gB,vB,bB,xB,yB,CB];function Pa(e){return e?(e.nodeName||"").toLowerCase():null}function cs(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Ul(e){var t=cs(e).Element;return e instanceof t||e instanceof Element}function Is(e){var t=cs(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function my(e){if(typeof ShadowRoot>"u")return!1;var t=cs(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function SB(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];!Is(s)||!Pa(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var c=o[i];c===!1?s.removeAttribute(i):s.setAttribute(i,c===!0?"":c)}))})}function kB(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]||{},i=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),c=i.reduce(function(d,p){return d[p]="",d},{});!Is(o)||!Pa(o)||(Object.assign(o.style,c),Object.keys(s).forEach(function(d){o.removeAttribute(d)}))})}}const jB={name:"applyStyles",enabled:!0,phase:"write",fn:SB,effect:kB,requires:["computeStyles"]};function Ia(e){return e.split("-")[0]}var Nl=Math.max,Zh=Math.min,mu=Math.round;function pb(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function X5(){return!/^((?!chrome|android).)*safari/i.test(pb())}function gu(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&Is(e)&&(o=e.offsetWidth>0&&mu(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&mu(r.height)/e.offsetHeight||1);var i=Ul(e)?cs(e):window,c=i.visualViewport,d=!X5()&&n,p=(r.left+(d&&c?c.offsetLeft:0))/o,h=(r.top+(d&&c?c.offsetTop:0))/s,m=r.width/o,g=r.height/s;return{width:m,height:g,top:h,right:p+m,bottom:h+g,left:p,x:p,y:h}}function gy(e){var t=gu(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 Y5(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&my(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function fi(e){return cs(e).getComputedStyle(e)}function _B(e){return["table","td","th"].indexOf(Pa(e))>=0}function cl(e){return((Ul(e)?e.ownerDocument:e.document)||window.document).documentElement}function yg(e){return Pa(e)==="html"?e:e.assignedSlot||e.parentNode||(my(e)?e.host:null)||cl(e)}function US(e){return!Is(e)||fi(e).position==="fixed"?null:e.offsetParent}function IB(e){var t=/firefox/i.test(pb()),n=/Trident/i.test(pb());if(n&&Is(e)){var r=fi(e);if(r.position==="fixed")return null}var o=yg(e);for(my(o)&&(o=o.host);Is(o)&&["html","body"].indexOf(Pa(o))<0;){var s=fi(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 Rf(e){for(var t=cs(e),n=US(e);n&&_B(n)&&fi(n).position==="static";)n=US(n);return n&&(Pa(n)==="html"||Pa(n)==="body"&&fi(n).position==="static")?t:n||IB(e)||t}function vy(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Nd(e,t,n){return Nl(e,Zh(t,n))}function PB(e,t,n){var r=Nd(e,t,n);return r>n?n:r}function J5(){return{top:0,right:0,bottom:0,left:0}}function Z5(e){return Object.assign({},J5(),e)}function e3(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var EB=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Z5(typeof t!="number"?t:e3(t,Of))};function MB(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,c=Ia(n.placement),d=vy(c),p=[Vo,Ms].indexOf(c)>=0,h=p?"height":"width";if(!(!s||!i)){var m=EB(o.padding,n),g=gy(s),b=d==="y"?Wo:Vo,y=d==="y"?Es:Ms,x=n.rects.reference[h]+n.rects.reference[d]-i[d]-n.rects.popper[h],C=i[d]-n.rects.reference[d],S=Rf(s),j=S?d==="y"?S.clientHeight||0:S.clientWidth||0:0,_=x/2-C/2,I=m[b],P=j-g[h]-m[y],M=j/2-g[h]/2+_,R=Nd(I,M,P),A=d;n.modifiersData[r]=(t={},t[A]=R,t.centerOffset=R-M,t)}}function OB(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)||Y5(t.elements.popper,o)&&(t.elements.arrow=o))}const RB={name:"arrow",enabled:!0,phase:"main",fn:MB,effect:OB,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function vu(e){return e.split("-")[1]}var AB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function DB(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:mu(n*o)/o||0,y:mu(r*o)/o||0}}function GS(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,i=e.offsets,c=e.position,d=e.gpuAcceleration,p=e.adaptive,h=e.roundOffsets,m=e.isFixed,g=i.x,b=g===void 0?0:g,y=i.y,x=y===void 0?0:y,C=typeof h=="function"?h({x:b,y:x}):{x:b,y:x};b=C.x,x=C.y;var S=i.hasOwnProperty("x"),j=i.hasOwnProperty("y"),_=Vo,I=Wo,P=window;if(p){var M=Rf(n),R="clientHeight",A="clientWidth";if(M===cs(n)&&(M=cl(n),fi(M).position!=="static"&&c==="absolute"&&(R="scrollHeight",A="scrollWidth")),M=M,o===Wo||(o===Vo||o===Ms)&&s===Qd){I=Es;var D=m&&M===P&&P.visualViewport?P.visualViewport.height:M[R];x-=D-r.height,x*=d?1:-1}if(o===Vo||(o===Wo||o===Es)&&s===Qd){_=Ms;var O=m&&M===P&&P.visualViewport?P.visualViewport.width:M[A];b-=O-r.width,b*=d?1:-1}}var T=Object.assign({position:c},p&&AB),Y=h===!0?DB({x:b,y:x},cs(n)):{x:b,y:x};if(b=Y.x,x=Y.y,d){var z;return Object.assign({},T,(z={},z[I]=j?"0":"",z[_]=S?"0":"",z.transform=(P.devicePixelRatio||1)<=1?"translate("+b+"px, "+x+"px)":"translate3d("+b+"px, "+x+"px, 0)",z))}return Object.assign({},T,(t={},t[I]=j?x+"px":"",t[_]=S?b+"px":"",t.transform="",t))}function TB(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,i=s===void 0?!0:s,c=n.roundOffsets,d=c===void 0?!0:c,p={placement:Ia(t.placement),variation:vu(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,GS(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:d})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,GS(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:d})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const NB={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:TB,data:{}};var Fp={passive:!0};function $B(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,c=i===void 0?!0:i,d=cs(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(h){h.addEventListener("scroll",n.update,Fp)}),c&&d.addEventListener("resize",n.update,Fp),function(){s&&p.forEach(function(h){h.removeEventListener("scroll",n.update,Fp)}),c&&d.removeEventListener("resize",n.update,Fp)}}const LB={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:$B,data:{}};var zB={left:"right",right:"left",bottom:"top",top:"bottom"};function kh(e){return e.replace(/left|right|bottom|top/g,function(t){return zB[t]})}var FB={start:"end",end:"start"};function qS(e){return e.replace(/start|end/g,function(t){return FB[t]})}function by(e){var t=cs(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function xy(e){return gu(cl(e)).left+by(e).scrollLeft}function BB(e,t){var n=cs(e),r=cl(e),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,c=0,d=0;if(o){s=o.width,i=o.height;var p=X5();(p||!p&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}return{width:s,height:i,x:c+xy(e),y:d}}function HB(e){var t,n=cl(e),r=by(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=Nl(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=Nl(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),c=-r.scrollLeft+xy(e),d=-r.scrollTop;return fi(o||n).direction==="rtl"&&(c+=Nl(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:c,y:d}}function yy(e){var t=fi(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function t3(e){return["html","body","#document"].indexOf(Pa(e))>=0?e.ownerDocument.body:Is(e)&&yy(e)?e:t3(yg(e))}function $d(e,t){var n;t===void 0&&(t=[]);var r=t3(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=cs(r),i=o?[s].concat(s.visualViewport||[],yy(r)?r:[]):r,c=t.concat(i);return o?c:c.concat($d(yg(i)))}function hb(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function WB(e,t){var n=gu(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 KS(e,t,n){return t===K5?hb(BB(e,n)):Ul(t)?WB(t,n):hb(HB(cl(e)))}function VB(e){var t=$d(yg(e)),n=["absolute","fixed"].indexOf(fi(e).position)>=0,r=n&&Is(e)?Rf(e):e;return Ul(r)?t.filter(function(o){return Ul(o)&&Y5(o,r)&&Pa(o)!=="body"}):[]}function UB(e,t,n,r){var o=t==="clippingParents"?VB(e):[].concat(t),s=[].concat(o,[n]),i=s[0],c=s.reduce(function(d,p){var h=KS(e,p,r);return d.top=Nl(h.top,d.top),d.right=Zh(h.right,d.right),d.bottom=Zh(h.bottom,d.bottom),d.left=Nl(h.left,d.left),d},KS(e,i,r));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}function n3(e){var t=e.reference,n=e.element,r=e.placement,o=r?Ia(r):null,s=r?vu(r):null,i=t.x+t.width/2-n.width/2,c=t.y+t.height/2-n.height/2,d;switch(o){case Wo:d={x:i,y:t.y-n.height};break;case Es:d={x:i,y:t.y+t.height};break;case Ms:d={x:t.x+t.width,y:c};break;case Vo:d={x:t.x-n.width,y:c};break;default:d={x:t.x,y:t.y}}var p=o?vy(o):null;if(p!=null){var h=p==="y"?"height":"width";switch(s){case hu:d[p]=d[p]-(t[h]/2-n[h]/2);break;case Qd:d[p]=d[p]+(t[h]/2-n[h]/2);break}}return d}function Xd(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,i=s===void 0?e.strategy:s,c=n.boundary,d=c===void 0?dB:c,p=n.rootBoundary,h=p===void 0?K5:p,m=n.elementContext,g=m===void 0?gd:m,b=n.altBoundary,y=b===void 0?!1:b,x=n.padding,C=x===void 0?0:x,S=Z5(typeof C!="number"?C:e3(C,Of)),j=g===gd?fB:gd,_=e.rects.popper,I=e.elements[y?j:g],P=UB(Ul(I)?I:I.contextElement||cl(e.elements.popper),d,h,i),M=gu(e.elements.reference),R=n3({reference:M,element:_,strategy:"absolute",placement:o}),A=hb(Object.assign({},_,R)),D=g===gd?A:M,O={top:P.top-D.top+S.top,bottom:D.bottom-P.bottom+S.bottom,left:P.left-D.left+S.left,right:D.right-P.right+S.right},T=e.modifiersData.offset;if(g===gd&&T){var Y=T[o];Object.keys(O).forEach(function(z){var W=[Ms,Es].indexOf(z)>=0?1:-1,Q=[Wo,Es].indexOf(z)>=0?"y":"x";O[z]+=Y[Q]*W})}return O}function GB(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,c=n.flipVariations,d=n.allowedAutoPlacements,p=d===void 0?Q5:d,h=vu(r),m=h?c?VS:VS.filter(function(y){return vu(y)===h}):Of,g=m.filter(function(y){return p.indexOf(y)>=0});g.length===0&&(g=m);var b=g.reduce(function(y,x){return y[x]=Xd(e,{placement:x,boundary:o,rootBoundary:s,padding:i})[Ia(x)],y},{});return Object.keys(b).sort(function(y,x){return b[y]-b[x]})}function qB(e){if(Ia(e)===hy)return[];var t=kh(e);return[qS(e),t,qS(t)]}function KB(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,i=n.altAxis,c=i===void 0?!0:i,d=n.fallbackPlacements,p=n.padding,h=n.boundary,m=n.rootBoundary,g=n.altBoundary,b=n.flipVariations,y=b===void 0?!0:b,x=n.allowedAutoPlacements,C=t.options.placement,S=Ia(C),j=S===C,_=d||(j||!y?[kh(C)]:qB(C)),I=[C].concat(_).reduce(function(te,V){return te.concat(Ia(V)===hy?GB(t,{placement:V,boundary:h,rootBoundary:m,padding:p,flipVariations:y,allowedAutoPlacements:x}):V)},[]),P=t.rects.reference,M=t.rects.popper,R=new Map,A=!0,D=I[0],O=0;O=0,Q=W?"width":"height",U=Xd(t,{placement:T,boundary:h,rootBoundary:m,altBoundary:g,padding:p}),L=W?z?Ms:Vo:z?Es:Wo;P[Q]>M[Q]&&(L=kh(L));var ee=kh(L),K=[];if(s&&K.push(U[Y]<=0),c&&K.push(U[L]<=0,U[ee]<=0),K.every(function(te){return te})){D=T,A=!1;break}R.set(T,K)}if(A)for(var Z=y?3:1,se=function(V){var F=I.find(function(X){var ue=R.get(X);if(ue)return ue.slice(0,V).every(function(q){return q})});if(F)return D=F,"break"},fe=Z;fe>0;fe--){var G=se(fe);if(G==="break")break}t.placement!==D&&(t.modifiersData[r]._skip=!0,t.placement=D,t.reset=!0)}}const QB={name:"flip",enabled:!0,phase:"main",fn:KB,requiresIfExists:["offset"],data:{_skip:!1}};function QS(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 XS(e){return[Wo,Ms,Es,Vo].some(function(t){return e[t]>=0})}function XB(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,i=Xd(t,{elementContext:"reference"}),c=Xd(t,{altBoundary:!0}),d=QS(i,r),p=QS(c,o,s),h=XS(d),m=XS(p);t.modifiersData[n]={referenceClippingOffsets:d,popperEscapeOffsets:p,isReferenceHidden:h,hasPopperEscaped:m},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":m})}const YB={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:XB};function JB(e,t,n){var r=Ia(e),o=[Vo,Wo].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=s[0],c=s[1];return i=i||0,c=(c||0)*o,[Vo,Ms].indexOf(r)>=0?{x:c,y:i}:{x:i,y:c}}function ZB(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,i=Q5.reduce(function(h,m){return h[m]=JB(m,t.rects,s),h},{}),c=i[t.placement],d=c.x,p=c.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=d,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=i}const eH={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:ZB};function tH(e){var t=e.state,n=e.name;t.modifiersData[n]=n3({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const nH={name:"popperOffsets",enabled:!0,phase:"read",fn:tH,data:{}};function rH(e){return e==="x"?"y":"x"}function oH(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,c=i===void 0?!1:i,d=n.boundary,p=n.rootBoundary,h=n.altBoundary,m=n.padding,g=n.tether,b=g===void 0?!0:g,y=n.tetherOffset,x=y===void 0?0:y,C=Xd(t,{boundary:d,rootBoundary:p,padding:m,altBoundary:h}),S=Ia(t.placement),j=vu(t.placement),_=!j,I=vy(S),P=rH(I),M=t.modifiersData.popperOffsets,R=t.rects.reference,A=t.rects.popper,D=typeof x=="function"?x(Object.assign({},t.rects,{placement:t.placement})):x,O=typeof D=="number"?{mainAxis:D,altAxis:D}:Object.assign({mainAxis:0,altAxis:0},D),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,Y={x:0,y:0};if(M){if(s){var z,W=I==="y"?Wo:Vo,Q=I==="y"?Es:Ms,U=I==="y"?"height":"width",L=M[I],ee=L+C[W],K=L-C[Q],Z=b?-A[U]/2:0,se=j===hu?R[U]:A[U],fe=j===hu?-A[U]:-R[U],G=t.elements.arrow,te=b&&G?gy(G):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:J5(),F=V[W],X=V[Q],ue=Nd(0,R[U],te[U]),q=_?R[U]/2-Z-ue-F-O.mainAxis:se-ue-F-O.mainAxis,ne=_?-R[U]/2+Z+ue+X+O.mainAxis:fe+ue+X+O.mainAxis,pe=t.elements.arrow&&Rf(t.elements.arrow),le=pe?I==="y"?pe.clientTop||0:pe.clientLeft||0:0,we=(z=T==null?void 0:T[I])!=null?z:0,ve=L+q-we-le,he=L+ne-we,Ne=Nd(b?Zh(ee,ve):ee,L,b?Nl(K,he):K);M[I]=Ne,Y[I]=Ne-L}if(c){var De,qe=I==="x"?Wo:Vo,Mt=I==="x"?Es:Ms,ot=M[P],an=P==="y"?"height":"width",pt=ot+C[qe],vt=ot-C[Mt],ke=[Wo,Vo].indexOf(S)!==-1,Be=(De=T==null?void 0:T[P])!=null?De:0,Ot=ke?pt:ot-R[an]-A[an]-Be+O.altAxis,Ht=ke?ot+R[an]+A[an]-Be-O.altAxis:vt,je=b&&ke?PB(Ot,ot,Ht):Nd(b?Ot:pt,ot,b?Ht:vt);M[P]=je,Y[P]=je-ot}t.modifiersData[r]=Y}}const sH={name:"preventOverflow",enabled:!0,phase:"main",fn:oH,requiresIfExists:["offset"]};function aH(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function iH(e){return e===cs(e)||!Is(e)?by(e):aH(e)}function lH(e){var t=e.getBoundingClientRect(),n=mu(t.width)/e.offsetWidth||1,r=mu(t.height)/e.offsetHeight||1;return n!==1||r!==1}function cH(e,t,n){n===void 0&&(n=!1);var r=Is(t),o=Is(t)&&lH(t),s=cl(t),i=gu(e,o,n),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(r||!r&&!n)&&((Pa(t)!=="body"||yy(s))&&(c=iH(t)),Is(t)?(d=gu(t,!0),d.x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=xy(s))),{x:i.left+c.scrollLeft-d.x,y:i.top+c.scrollTop-d.y,width:i.width,height:i.height}}function uH(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 i=[].concat(s.requires||[],s.requiresIfExists||[]);i.forEach(function(c){if(!n.has(c)){var d=t.get(c);d&&o(d)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function dH(e){var t=uH(e);return wB.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function fH(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function pH(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 YS={placement:"bottom",modifiers:[],strategy:"absolute"};function JS(){for(var e=arguments.length,t=new Array(e),n=0;n{}),_=l.useCallback(()=>{var O;!t||!y.current||!x.current||((O=j.current)==null||O.call(j),C.current=gH(y.current,x.current,{placement:S,modifiers:[iB,oB,rB,{...nB,enabled:!!g},{name:"eventListeners",...tB(i)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:c??[0,d]}},{name:"flip",enabled:!!p,options:{padding:8}},{name:"preventOverflow",enabled:!!m,options:{boundary:h}},...n??[]],strategy:o}),C.current.forceUpdate(),j.current=C.current.destroy)},[S,t,n,g,i,s,c,d,p,m,h,o]);l.useEffect(()=>()=>{var O;!y.current&&!x.current&&((O=C.current)==null||O.destroy(),C.current=null)},[]);const I=l.useCallback(O=>{y.current=O,_()},[_]),P=l.useCallback((O={},T=null)=>({...O,ref:gn(I,T)}),[I]),M=l.useCallback(O=>{x.current=O,_()},[_]),R=l.useCallback((O={},T=null)=>({...O,ref:gn(M,T),style:{...O.style,position:o,minWidth:g?void 0:"max-content",inset:"0 auto auto 0"}}),[o,M,g]),A=l.useCallback((O={},T=null)=>{const{size:Y,shadowColor:z,bg:W,style:Q,...U}=O;return{...U,ref:T,"data-popper-arrow":"",style:vH(O)}},[]),D=l.useCallback((O={},T=null)=>({...O,ref:T,"data-popper-arrow-inner":""}),[]);return{update(){var O;(O=C.current)==null||O.update()},forceUpdate(){var O;(O=C.current)==null||O.forceUpdate()},transformOrigin:Fr.transformOrigin.varRef,referenceRef:I,popperRef:M,getPopperProps:R,getArrowProps:A,getArrowInnerProps:D,getReferenceProps:P}}function vH(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 wy(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=pr(n),i=pr(t),[c,d]=l.useState(e.defaultIsOpen||!1),p=r!==void 0?r:c,h=r!==void 0,m=l.useId(),g=o??`disclosure-${m}`,b=l.useCallback(()=>{h||d(!1),i==null||i()},[h,i]),y=l.useCallback(()=>{h||d(!0),s==null||s()},[h,s]),x=l.useCallback(()=>{p?b():y()},[p,y,b]);function C(j={}){return{...j,"aria-expanded":p,"aria-controls":g,onClick(_){var I;(I=j.onClick)==null||I.call(j,_),x()}}}function S(j={}){return{...j,hidden:!p,id:g}}return{isOpen:p,onOpen:y,onClose:b,onToggle:x,isControlled:h,getButtonProps:C,getDisclosureProps:S}}function bH(e){const{ref:t,handler:n,enabled:r=!0}=e,o=pr(n),i=l.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;l.useEffect(()=>{if(!r)return;const c=m=>{Vv(m,t)&&(i.isPointerDown=!0)},d=m=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&Vv(m,t)&&(i.isPointerDown=!1,o(m))},p=m=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&Vv(m,t)&&(i.isPointerDown=!1,o(m))},h=r3(t.current);return h.addEventListener("mousedown",c,!0),h.addEventListener("mouseup",d,!0),h.addEventListener("touchstart",c,!0),h.addEventListener("touchend",p,!0),()=>{h.removeEventListener("mousedown",c,!0),h.removeEventListener("mouseup",d,!0),h.removeEventListener("touchstart",c,!0),h.removeEventListener("touchend",p,!0)}},[n,t,o,i,r])}function Vv(e,t){var n;const r=e.target;return r&&!r3(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function r3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function o3(e){const{isOpen:t,ref:n}=e,[r,o]=l.useState(t),[s,i]=l.useState(!1);return l.useEffect(()=>{s||(o(t),i(!0))},[t,s,r]),Tl(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var d;const p=wF(n.current),h=new p.CustomEvent("animationend",{bubbles:!0});(d=n.current)==null||d.dispatchEvent(h)}}}function Sy(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[xH,yH,CH,wH]=Gx(),[SH,Af]=Hn({strict:!1,name:"MenuContext"});function kH(e,...t){const n=l.useId(),r=e||n;return l.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function s3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function ZS(e){return s3(e).activeElement===e}function jH(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:i,isOpen:c,defaultIsOpen:d,onClose:p,onOpen:h,placement:m="bottom-start",lazyBehavior:g="unmount",direction:b,computePositionOnMount:y=!1,...x}=e,C=l.useRef(null),S=l.useRef(null),j=CH(),_=l.useCallback(()=>{requestAnimationFrame(()=>{var G;(G=C.current)==null||G.focus({preventScroll:!1})})},[]),I=l.useCallback(()=>{const G=setTimeout(()=>{var te;if(o)(te=o.current)==null||te.focus();else{const V=j.firstEnabled();V&&z(V.index)}});ee.current.add(G)},[j,o]),P=l.useCallback(()=>{const G=setTimeout(()=>{const te=j.lastEnabled();te&&z(te.index)});ee.current.add(G)},[j]),M=l.useCallback(()=>{h==null||h(),s?I():_()},[s,I,_,h]),{isOpen:R,onOpen:A,onClose:D,onToggle:O}=wy({isOpen:c,defaultIsOpen:d,onClose:p,onOpen:M});bH({enabled:R&&r,ref:C,handler:G=>{var te;(te=S.current)!=null&&te.contains(G.target)||D()}});const T=Cy({...x,enabled:R||y,placement:m,direction:b}),[Y,z]=l.useState(-1);xi(()=>{R||z(-1)},[R]),q5(C,{focusRef:S,visible:R,shouldFocus:!0});const W=o3({isOpen:R,ref:C}),[Q,U]=kH(t,"menu-button","menu-list"),L=l.useCallback(()=>{A(),_()},[A,_]),ee=l.useRef(new Set([]));RH(()=>{ee.current.forEach(G=>clearTimeout(G)),ee.current.clear()});const K=l.useCallback(()=>{A(),I()},[I,A]),Z=l.useCallback(()=>{A(),P()},[A,P]),se=l.useCallback(()=>{var G,te;const V=s3(C.current),F=(G=C.current)==null?void 0:G.contains(V.activeElement);if(!(R&&!F))return;const ue=(te=j.item(Y))==null?void 0:te.node;ue==null||ue.focus()},[R,Y,j]),fe=l.useRef(null);return{openAndFocusMenu:L,openAndFocusFirstItem:K,openAndFocusLastItem:Z,onTransitionEnd:se,unstable__animationState:W,descendants:j,popper:T,buttonId:Q,menuId:U,forceUpdate:T.forceUpdate,orientation:"vertical",isOpen:R,onToggle:O,onOpen:A,onClose:D,menuRef:C,buttonRef:S,focusedIndex:Y,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:z,isLazy:i,lazyBehavior:g,initialFocusRef:o,rafId:fe}}function _H(e={},t=null){const n=Af(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:i}=n,c=l.useCallback(d=>{const p=d.key,m={Enter:s,ArrowDown:s,ArrowUp:i}[p];m&&(d.preventDefault(),d.stopPropagation(),m(d))},[s,i]);return{...e,ref:gn(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":qt(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:rt(e.onClick,r),onKeyDown:rt(e.onKeyDown,c)}}function mb(e){var t;return MH(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function IH(e={},t=null){const n=Af();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:i,onClose:c,menuId:d,isLazy:p,lazyBehavior:h,unstable__animationState:m}=n,g=yH(),b=UF({preventDefault:S=>S.key!==" "&&mb(S.target)}),y=l.useCallback(S=>{if(!S.currentTarget.contains(S.target))return;const j=S.key,I={Tab:M=>M.preventDefault(),Escape:c,ArrowDown:()=>{const M=g.nextEnabled(r);M&&o(M.index)},ArrowUp:()=>{const M=g.prevEnabled(r);M&&o(M.index)}}[j];if(I){S.preventDefault(),I(S);return}const P=b(M=>{const R=GF(g.values(),M,A=>{var D,O;return(O=(D=A==null?void 0:A.node)==null?void 0:D.textContent)!=null?O:""},g.item(r));if(R){const A=g.indexOf(R.node);o(A)}});mb(S.target)&&P(S)},[g,r,b,c,o]),x=l.useRef(!1);i&&(x.current=!0);const C=Sy({wasSelected:x.current,enabled:p,mode:h,isSelected:m.present});return{...e,ref:gn(s,t),children:C?e.children:null,tabIndex:-1,role:"menu",id:d,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:rt(e.onKeyDown,y)}}function PH(e={}){const{popper:t,isOpen:n}=Af();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function EH(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:i,isDisabled:c,isFocusable:d,closeOnSelect:p,type:h,...m}=e,g=Af(),{setFocusedIndex:b,focusedIndex:y,closeOnSelect:x,onClose:C,menuRef:S,isOpen:j,menuId:_,rafId:I}=g,P=l.useRef(null),M=`${_}-menuitem-${l.useId()}`,{index:R,register:A}=wH({disabled:c&&!d}),D=l.useCallback(L=>{n==null||n(L),!c&&b(R)},[b,R,c,n]),O=l.useCallback(L=>{r==null||r(L),P.current&&!ZS(P.current)&&D(L)},[D,r]),T=l.useCallback(L=>{o==null||o(L),!c&&b(-1)},[b,c,o]),Y=l.useCallback(L=>{s==null||s(L),mb(L.currentTarget)&&(p??x)&&C()},[C,s,x,p]),z=l.useCallback(L=>{i==null||i(L),b(R)},[b,i,R]),W=R===y,Q=c&&!d;xi(()=>{j&&(W&&!Q&&P.current?(I.current&&cancelAnimationFrame(I.current),I.current=requestAnimationFrame(()=>{var L;(L=P.current)==null||L.focus(),I.current=null})):S.current&&!ZS(S.current)&&S.current.focus({preventScroll:!0}))},[W,Q,S,j]);const U=G5({onClick:Y,onFocus:z,onMouseEnter:D,onMouseMove:O,onMouseLeave:T,ref:gn(A,P,t),isDisabled:c,isFocusable:d});return{...m,...U,type:h??U.type,id:M,role:"menuitem",tabIndex:W?0:-1}}function MH(e){var t;if(!OH(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function OH(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function RH(e,t=[]){return l.useEffect(()=>()=>e(),t)}var[AH,$u]=Hn({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Cg=e=>{const{children:t}=e,n=Qr("Menu",e),r=ar(e),{direction:o}=mf(),{descendants:s,...i}=jH({...r,direction:o}),c=l.useMemo(()=>i,[i]),{isOpen:d,onClose:p,forceUpdate:h}=c;return a.jsx(xH,{value:s,children:a.jsx(SH,{value:c,children:a.jsx(AH,{value:n,children:xx(t,{isOpen:d,onClose:p,forceUpdate:h})})})})};Cg.displayName="Menu";var a3=Oe((e,t)=>{const n=$u();return a.jsx(Ee.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});a3.displayName="MenuCommand";var DH=Oe((e,t)=>{const{type:n,...r}=e,o=$u(),s=r.as||n?n??void 0:"button",i=l.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 a.jsx(Ee.button,{ref:t,type:s,...r,__css:i})}),i3=e=>{const{className:t,children:n,...r}=e,o=$u(),s=l.Children.only(n),i=l.isValidElement(s)?l.cloneElement(s,{focusable:"false","aria-hidden":!0,className:jt("chakra-menu__icon",s.props.className)}):null,c=jt("chakra-menu__icon-wrapper",t);return a.jsx(Ee.span,{className:c,...r,__css:o.icon,children:i})};i3.displayName="MenuIcon";var Vn=Oe((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:i,...c}=e,d=EH(c,t),h=n||o?a.jsx("span",{style:{pointerEvents:"none",flex:1},children:i}):i;return a.jsxs(DH,{...d,className:jt("chakra-menu__menuitem",d.className),children:[n&&a.jsx(i3,{fontSize:"0.8em",marginEnd:r,children:n}),h,o&&a.jsx(a3,{marginStart:s,children:o})]})});Vn.displayName="MenuItem";var TH={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"}}},NH=Ee(Or.div),Gl=Oe(function(t,n){var r,o;const{rootProps:s,motionProps:i,...c}=t,{isOpen:d,onTransitionEnd:p,unstable__animationState:h}=Af(),m=IH(c,n),g=PH(s),b=$u();return a.jsx(Ee.div,{...g,__css:{zIndex:(o=t.zIndex)!=null?o:(r=b.list)==null?void 0:r.zIndex},children:a.jsx(NH,{variants:TH,initial:!1,animate:d?"enter":"exit",__css:{outline:0,...b.list},...i,className:jt("chakra-menu__menu-list",m.className),...m,onUpdate:p,onAnimationComplete:og(h.onComplete,m.onAnimationComplete)})})});Gl.displayName="MenuList";var Yd=Oe((e,t)=>{const{title:n,children:r,className:o,...s}=e,i=jt("chakra-menu__group__title",o),c=$u();return a.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[n&&a.jsx(Ee.p,{className:i,...s,__css:c.groupTitle,children:n}),r]})});Yd.displayName="MenuGroup";var $H=Oe((e,t)=>{const n=$u();return a.jsx(Ee.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),wg=Oe((e,t)=>{const{children:n,as:r,...o}=e,s=_H(o,t),i=r||$H;return a.jsx(i,{...s,className:jt("chakra-menu__menu-button",e.className),children:a.jsx(Ee.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});wg.displayName="MenuButton";var LH={slideInBottom:{...eb,custom:{offsetY:16,reverse:!0}},slideInRight:{...eb,custom:{offsetX:16,reverse:!0}},scale:{...LP,custom:{initialScale:.95,reverse:!0}},none:{}},zH=Ee(Or.section),FH=e=>LH[e||"none"],l3=l.forwardRef((e,t)=>{const{preset:n,motionProps:r=FH(n),...o}=e;return a.jsx(zH,{ref:t,...r,...o})});l3.displayName="ModalTransition";var BH=Object.defineProperty,HH=(e,t,n)=>t in e?BH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,WH=(e,t,n)=>(HH(e,typeof t!="symbol"?t+"":t,n),n),VH=class{constructor(){WH(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}},gb=new VH;function c3(e,t){const[n,r]=l.useState(0);return l.useEffect(()=>{const o=e.current;if(o){if(t){const s=gb.add(o);r(s)}return()=>{gb.remove(o),r(0)}}},[t,e]),n}var UH=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},_c=new WeakMap,Bp=new WeakMap,Hp={},Uv=0,u3=function(e){return e&&(e.host||u3(e.parentNode))},GH=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=u3(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},qH=function(e,t,n,r){var o=GH(t,Array.isArray(e)?e:[e]);Hp[n]||(Hp[n]=new WeakMap);var s=Hp[n],i=[],c=new Set,d=new Set(o),p=function(m){!m||c.has(m)||(c.add(m),p(m.parentNode))};o.forEach(p);var h=function(m){!m||d.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))h(g);else{var b=g.getAttribute(r),y=b!==null&&b!=="false",x=(_c.get(g)||0)+1,C=(s.get(g)||0)+1;_c.set(g,x),s.set(g,C),i.push(g),x===1&&y&&Bp.set(g,!0),C===1&&g.setAttribute(n,"true"),y||g.setAttribute(r,"true")}})};return h(t),c.clear(),Uv++,function(){i.forEach(function(m){var g=_c.get(m)-1,b=s.get(m)-1;_c.set(m,g),s.set(m,b),g||(Bp.has(m)||m.removeAttribute(r),Bp.delete(m)),b||m.removeAttribute(n)}),Uv--,Uv||(_c=new WeakMap,_c=new WeakMap,Bp=new WeakMap,Hp={})}},KH=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||UH(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),qH(r,o,n,"aria-hidden")):function(){return null}};function QH(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:i=!0,onOverlayClick:c,onEsc:d}=e,p=l.useRef(null),h=l.useRef(null),[m,g,b]=YH(r,"chakra-modal","chakra-modal--header","chakra-modal--body");XH(p,t&&i);const y=c3(p,t),x=l.useRef(null),C=l.useCallback(D=>{x.current=D.target},[]),S=l.useCallback(D=>{D.key==="Escape"&&(D.stopPropagation(),s&&(n==null||n()),d==null||d())},[s,n,d]),[j,_]=l.useState(!1),[I,P]=l.useState(!1),M=l.useCallback((D={},O=null)=>({role:"dialog",...D,ref:gn(O,p),id:m,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?g:void 0,"aria-describedby":I?b:void 0,onClick:rt(D.onClick,T=>T.stopPropagation())}),[b,I,m,g,j]),R=l.useCallback(D=>{D.stopPropagation(),x.current===D.target&&gb.isTopModal(p.current)&&(o&&(n==null||n()),c==null||c())},[n,o,c]),A=l.useCallback((D={},O=null)=>({...D,ref:gn(O,h),onClick:rt(D.onClick,R),onKeyDown:rt(D.onKeyDown,S),onMouseDown:rt(D.onMouseDown,C)}),[S,C,R]);return{isOpen:t,onClose:n,headerId:g,bodyId:b,setBodyMounted:P,setHeaderMounted:_,dialogRef:p,overlayRef:h,getDialogProps:M,getDialogContainerProps:A,index:y}}function XH(e,t){const n=e.current;l.useEffect(()=>{if(!(!e.current||!t))return KH(e.current)},[t,e,n])}function YH(e,...t){const n=l.useId(),r=e||n;return l.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[JH,Lu]=Hn({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[ZH,ql]=Hn({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),bu=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:i,finalFocusRef:c,returnFocusOnClose:d,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:m,motionPreset:g,lockFocusAcrossFrames:b,onCloseComplete:y}=t,x=Qr("Modal",t),S={...QH(t),autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:c,returnFocusOnClose:d,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:m,motionPreset:g,lockFocusAcrossFrames:b};return a.jsx(ZH,{value:S,children:a.jsx(JH,{value:x,children:a.jsx(yo,{onExitComplete:y,children:S.isOpen&&a.jsx(Ru,{...n,children:r})})})})};bu.displayName="Modal";var jh="right-scroll-bar-position",_h="width-before-scroll-bar",eW="with-scroll-bars-hidden",tW="--removed-body-scroll-bar-size",d3=i5(),Gv=function(){},Sg=l.forwardRef(function(e,t){var n=l.useRef(null),r=l.useState({onScrollCapture:Gv,onWheelCapture:Gv,onTouchMoveCapture:Gv}),o=r[0],s=r[1],i=e.forwardProps,c=e.children,d=e.className,p=e.removeScrollBar,h=e.enabled,m=e.shards,g=e.sideCar,b=e.noIsolation,y=e.inert,x=e.allowPinchZoom,C=e.as,S=C===void 0?"div":C,j=e.gapMode,_=o5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=g,P=r5([n,t]),M=Ca(Ca({},_),o);return l.createElement(l.Fragment,null,h&&l.createElement(I,{sideCar:d3,removeScrollBar:p,shards:m,noIsolation:b,inert:y,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:j}),i?l.cloneElement(l.Children.only(c),Ca(Ca({},M),{ref:P})):l.createElement(S,Ca({},M,{className:d,ref:P}),c))});Sg.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Sg.classNames={fullWidth:_h,zeroRight:jh};var ek,nW=function(){if(ek)return ek;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function rW(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=nW();return t&&e.setAttribute("nonce",t),e}function oW(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function sW(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var aW=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rW())&&(oW(t,n),sW(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},iW=function(){var e=aW();return function(t,n){l.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},f3=function(){var e=iW(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},lW={left:0,top:0,right:0,gap:0},qv=function(e){return parseInt(e||"",10)||0},cW=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[qv(n),qv(r),qv(o)]},uW=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return lW;var t=cW(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])}},dW=f3(),fW=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),` .`.concat(eW,` { overflow: hidden `).concat(r,`; padding-right: `).concat(c,"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(i,`px; margin-left:0; margin-top:0; margin-right: `).concat(c,"px ").concat(r,`; `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` } .`).concat(jh,` { right: `).concat(c,"px ").concat(r,`; } .`).concat(_h,` { margin-right: `).concat(c,"px ").concat(r,`; } .`).concat(jh," .").concat(jh,` { right: 0 `).concat(r,`; } .`).concat(_h," .").concat(_h,` { margin-right: 0 `).concat(r,`; } body { `).concat(tW,": ").concat(c,`px; } `)},pW=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=l.useMemo(function(){return uW(o)},[o]);return l.createElement(dW,{styles:fW(s,!t,o,n?"":"!important")})},vb=!1;if(typeof window<"u")try{var Wp=Object.defineProperty({},"passive",{get:function(){return vb=!0,!0}});window.addEventListener("test",Wp,Wp),window.removeEventListener("test",Wp,Wp)}catch{vb=!1}var Ic=vb?{passive:!1}:!1,hW=function(e){return e.tagName==="TEXTAREA"},p3=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!hW(e)&&n[t]==="visible")},mW=function(e){return p3(e,"overflowY")},gW=function(e){return p3(e,"overflowX")},tk=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=h3(e,r);if(o){var s=m3(e,r),i=s[1],c=s[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},vW=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},bW=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},h3=function(e,t){return e==="v"?mW(t):gW(t)},m3=function(e,t){return e==="v"?vW(t):bW(t)},xW=function(e,t){return e==="h"&&t==="rtl"?-1:1},yW=function(e,t,n,r,o){var s=xW(e,window.getComputedStyle(t).direction),i=s*r,c=n.target,d=t.contains(c),p=!1,h=i>0,m=0,g=0;do{var b=m3(e,c),y=b[0],x=b[1],C=b[2],S=x-C-s*y;(y||S)&&h3(e,c)&&(m+=S,g+=y),c=c.parentNode}while(!d&&c!==document.body||d&&(t.contains(c)||t===c));return(h&&(o&&m===0||!o&&i>m)||!h&&(o&&g===0||!o&&-i>g))&&(p=!0),p},Vp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},nk=function(e){return[e.deltaX,e.deltaY]},rk=function(e){return e&&"current"in e?e.current:e},CW=function(e,t){return e[0]===t[0]&&e[1]===t[1]},wW=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},SW=0,Pc=[];function kW(e){var t=l.useRef([]),n=l.useRef([0,0]),r=l.useRef(),o=l.useState(SW++)[0],s=l.useState(f3)[0],i=l.useRef(e);l.useEffect(function(){i.current=e},[e]),l.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var x=lb([e.lockRef.current],(e.shards||[]).map(rk),!0).filter(Boolean);return x.forEach(function(C){return C.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),x.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=l.useCallback(function(x,C){if("touches"in x&&x.touches.length===2)return!i.current.allowPinchZoom;var S=Vp(x),j=n.current,_="deltaX"in x?x.deltaX:j[0]-S[0],I="deltaY"in x?x.deltaY:j[1]-S[1],P,M=x.target,R=Math.abs(_)>Math.abs(I)?"h":"v";if("touches"in x&&R==="h"&&M.type==="range")return!1;var A=tk(R,M);if(!A)return!0;if(A?P=R:(P=R==="v"?"h":"v",A=tk(R,M)),!A)return!1;if(!r.current&&"changedTouches"in x&&(_||I)&&(r.current=P),!P)return!0;var D=r.current||P;return yW(D,C,x,D==="h"?_:I,!0)},[]),d=l.useCallback(function(x){var C=x;if(!(!Pc.length||Pc[Pc.length-1]!==s)){var S="deltaY"in C?nk(C):Vp(C),j=t.current.filter(function(P){return P.name===C.type&&P.target===C.target&&CW(P.delta,S)})[0];if(j&&j.should){C.cancelable&&C.preventDefault();return}if(!j){var _=(i.current.shards||[]).map(rk).filter(Boolean).filter(function(P){return P.contains(C.target)}),I=_.length>0?c(C,_[0]):!i.current.noIsolation;I&&C.cancelable&&C.preventDefault()}}},[]),p=l.useCallback(function(x,C,S,j){var _={name:x,delta:C,target:S,should:j};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(I){return I!==_})},1)},[]),h=l.useCallback(function(x){n.current=Vp(x),r.current=void 0},[]),m=l.useCallback(function(x){p(x.type,nk(x),x.target,c(x,e.lockRef.current))},[]),g=l.useCallback(function(x){p(x.type,Vp(x),x.target,c(x,e.lockRef.current))},[]);l.useEffect(function(){return Pc.push(s),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",d,Ic),document.addEventListener("touchmove",d,Ic),document.addEventListener("touchstart",h,Ic),function(){Pc=Pc.filter(function(x){return x!==s}),document.removeEventListener("wheel",d,Ic),document.removeEventListener("touchmove",d,Ic),document.removeEventListener("touchstart",h,Ic)}},[]);var b=e.removeScrollBar,y=e.inert;return l.createElement(l.Fragment,null,y?l.createElement(s,{styles:wW(o)}):null,b?l.createElement(pW,{gapMode:e.gapMode}):null)}const jW=jz(d3,kW);var g3=l.forwardRef(function(e,t){return l.createElement(Sg,Ca({},e,{ref:t,sideCar:jW}))});g3.classNames=Sg.classNames;const _W=g3;function IW(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:i,finalFocusRef:c,returnFocusOnClose:d,preserveScrollBarGap:p,lockFocusAcrossFrames:h,isOpen:m}=ql(),[g,b]=iD();l.useEffect(()=>{!g&&b&&setTimeout(b)},[g,b]);const y=c3(r,m);return a.jsx(L5,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:c,restoreFocus:d,contentRef:r,lockFocusAcrossFrames:h,children:a.jsx(_W,{removeScrollBar:!p,allowPinchZoom:i,enabled:y===1&&s,forwardProps:!0,children:e.children})})}var xu=Oe((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...i}=e,{getDialogProps:c,getDialogContainerProps:d}=ql(),p=c(i,t),h=d(o),m=jt("chakra-modal__content",n),g=Lu(),b={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...g.dialog},y={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...g.dialogContainer},{motionPreset:x}=ql();return a.jsx(IW,{children:a.jsx(Ee.div,{...h,className:"chakra-modal__content-container",tabIndex:-1,__css:y,children:a.jsx(l3,{preset:x,motionProps:s,className:m,...p,__css:b,children:r})})})});xu.displayName="ModalContent";function Df(e){const{leastDestructiveRef:t,...n}=e;return a.jsx(bu,{...n,initialFocusRef:t})}var Tf=Oe((e,t)=>a.jsx(xu,{ref:t,role:"alertdialog",...e})),pi=Oe((e,t)=>{const{className:n,...r}=e,o=jt("chakra-modal__footer",n),i={display:"flex",alignItems:"center",justifyContent:"flex-end",...Lu().footer};return a.jsx(Ee.footer,{ref:t,...r,__css:i,className:o})});pi.displayName="ModalFooter";var Ea=Oe((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=ql();l.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=jt("chakra-modal__header",n),d={flex:0,...Lu().header};return a.jsx(Ee.header,{ref:t,className:i,id:o,...r,__css:d})});Ea.displayName="ModalHeader";var PW=Ee(Or.div),Ma=Oe((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,i=jt("chakra-modal__overlay",n),d={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...Lu().overlay},{motionPreset:p}=ql(),m=o||(p==="none"?{}:$P);return a.jsx(PW,{...m,__css:d,ref:t,className:i,...s})});Ma.displayName="ModalOverlay";var Oa=Oe((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=ql();l.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=jt("chakra-modal__body",n),c=Lu();return a.jsx(Ee.div,{ref:t,className:i,id:o,...r,__css:c.body})});Oa.displayName="ModalBody";var kg=Oe((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=ql(),i=jt("chakra-modal__close-btn",r),c=Lu();return a.jsx(kI,{ref:t,__css:c.closeButton,className:i,onClick:rt(n,d=>{d.stopPropagation(),s()}),...o})});kg.displayName="ModalCloseButton";var EW=e=>a.jsx(zr,{viewBox:"0 0 24 24",...e,children:a.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"})}),MW=e=>a.jsx(zr,{viewBox:"0 0 24 24",...e,children:a.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 ok(e,t,n,r){l.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,i=Array.isArray(t)?t:[t],c=new s.MutationObserver(d=>{for(const p of d)p.type==="attributes"&&p.attributeName&&i.includes(p.attributeName)&&n(p)});return c.observe(e.current,{attributes:!0,attributeFilter:i}),()=>c.disconnect()})}function OW(e,t){const n=pr(e);l.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var RW=50,sk=300;function AW(e,t){const[n,r]=l.useState(!1),[o,s]=l.useState(null),[i,c]=l.useState(!0),d=l.useRef(null),p=()=>clearTimeout(d.current);OW(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?RW:null);const h=l.useCallback(()=>{i&&e(),d.current=setTimeout(()=>{c(!1),r(!0),s("increment")},sk)},[e,i]),m=l.useCallback(()=>{i&&t(),d.current=setTimeout(()=>{c(!1),r(!0),s("decrement")},sk)},[t,i]),g=l.useCallback(()=>{c(!0),r(!1),p()},[]);return l.useEffect(()=>()=>p(),[]),{up:h,down:m,stop:g,isSpinning:n}}var DW=/^[Ee0-9+\-.]$/;function TW(e){return DW.test(e)}function NW(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 $W(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:o=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:i=1,isReadOnly:c,isDisabled:d,isRequired:p,isInvalid:h,pattern:m="[0-9]*(.[0-9]+)?",inputMode:g="decimal",allowMouseWheel:b,id:y,onChange:x,precision:C,name:S,"aria-describedby":j,"aria-label":_,"aria-labelledby":I,onFocus:P,onBlur:M,onInvalid:R,getAriaValueText:A,isValidCharacter:D,format:O,parse:T,...Y}=e,z=pr(P),W=pr(M),Q=pr(R),U=pr(D??TW),L=pr(A),ee=sz(e),{update:K,increment:Z,decrement:se}=ee,[fe,G]=l.useState(!1),te=!(c||d),V=l.useRef(null),F=l.useRef(null),X=l.useRef(null),ue=l.useRef(null),q=l.useCallback(je=>je.split("").filter(U).join(""),[U]),ne=l.useCallback(je=>{var ht;return(ht=T==null?void 0:T(je))!=null?ht:je},[T]),pe=l.useCallback(je=>{var ht;return((ht=O==null?void 0:O(je))!=null?ht:je).toString()},[O]);xi(()=>{(ee.valueAsNumber>s||ee.valueAsNumber{if(!V.current)return;if(V.current.value!=ee.value){const ht=ne(V.current.value);ee.setValue(q(ht))}},[ne,q]);const le=l.useCallback((je=i)=>{te&&Z(je)},[Z,te,i]),we=l.useCallback((je=i)=>{te&&se(je)},[se,te,i]),ve=AW(le,we);ok(X,"disabled",ve.stop,ve.isSpinning),ok(ue,"disabled",ve.stop,ve.isSpinning);const he=l.useCallback(je=>{if(je.nativeEvent.isComposing)return;const At=ne(je.currentTarget.value);K(q(At)),F.current={start:je.currentTarget.selectionStart,end:je.currentTarget.selectionEnd}},[K,q,ne]),Ne=l.useCallback(je=>{var ht,At,_t;z==null||z(je),F.current&&(je.target.selectionStart=(At=F.current.start)!=null?At:(ht=je.currentTarget.value)==null?void 0:ht.length,je.currentTarget.selectionEnd=(_t=F.current.end)!=null?_t:je.currentTarget.selectionStart)},[z]),De=l.useCallback(je=>{if(je.nativeEvent.isComposing)return;NW(je,U)||je.preventDefault();const ht=qe(je)*i,At=je.key,Re={ArrowUp:()=>le(ht),ArrowDown:()=>we(ht),Home:()=>K(o),End:()=>K(s)}[At];Re&&(je.preventDefault(),Re(je))},[U,i,le,we,K,o,s]),qe=je=>{let ht=1;return(je.metaKey||je.ctrlKey)&&(ht=.1),je.shiftKey&&(ht=10),ht},Mt=l.useMemo(()=>{const je=L==null?void 0:L(ee.value);if(je!=null)return je;const ht=ee.value.toString();return ht||void 0},[ee.value,L]),ot=l.useCallback(()=>{let je=ee.value;if(ee.value==="")return;/^[eE]/.test(ee.value.toString())?ee.setValue(""):(ee.valueAsNumbers&&(je=s),ee.cast(je))},[ee,s,o]),an=l.useCallback(()=>{G(!1),n&&ot()},[n,G,ot]),pt=l.useCallback(()=>{t&&requestAnimationFrame(()=>{var je;(je=V.current)==null||je.focus()})},[t]),vt=l.useCallback(je=>{je.preventDefault(),ve.up(),pt()},[pt,ve]),ke=l.useCallback(je=>{je.preventDefault(),ve.down(),pt()},[pt,ve]);Tl(()=>V.current,"wheel",je=>{var ht,At;const Re=((At=(ht=V.current)==null?void 0:ht.ownerDocument)!=null?At:document).activeElement===V.current;if(!b||!Re)return;je.preventDefault();const Xe=qe(je)*i,_n=Math.sign(je.deltaY);_n===-1?le(Xe):_n===1&&we(Xe)},{passive:!1});const Be=l.useCallback((je={},ht=null)=>{const At=d||r&&ee.isAtMax;return{...je,ref:gn(ht,X),role:"button",tabIndex:-1,onPointerDown:rt(je.onPointerDown,_t=>{_t.button!==0||At||vt(_t)}),onPointerLeave:rt(je.onPointerLeave,ve.stop),onPointerUp:rt(je.onPointerUp,ve.stop),disabled:At,"aria-disabled":_s(At)}},[ee.isAtMax,r,vt,ve.stop,d]),Ot=l.useCallback((je={},ht=null)=>{const At=d||r&&ee.isAtMin;return{...je,ref:gn(ht,ue),role:"button",tabIndex:-1,onPointerDown:rt(je.onPointerDown,_t=>{_t.button!==0||At||ke(_t)}),onPointerLeave:rt(je.onPointerLeave,ve.stop),onPointerUp:rt(je.onPointerUp,ve.stop),disabled:At,"aria-disabled":_s(At)}},[ee.isAtMin,r,ke,ve.stop,d]),Ht=l.useCallback((je={},ht=null)=>{var At,_t,Re,Xe;return{name:S,inputMode:g,type:"text",pattern:m,"aria-labelledby":I,"aria-label":_,"aria-describedby":j,id:y,disabled:d,...je,readOnly:(At=je.readOnly)!=null?At:c,"aria-readonly":(_t=je.readOnly)!=null?_t:c,"aria-required":(Re=je.required)!=null?Re:p,required:(Xe=je.required)!=null?Xe:p,ref:gn(V,ht),value:pe(ee.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(ee.valueAsNumber)?void 0:ee.valueAsNumber,"aria-invalid":_s(h??ee.isOutOfRange),"aria-valuetext":Mt,autoComplete:"off",autoCorrect:"off",onChange:rt(je.onChange,he),onKeyDown:rt(je.onKeyDown,De),onFocus:rt(je.onFocus,Ne,()=>G(!0)),onBlur:rt(je.onBlur,W,an)}},[S,g,m,I,_,pe,j,y,d,p,c,h,ee.value,ee.valueAsNumber,ee.isOutOfRange,o,s,Mt,he,De,Ne,W,an]);return{value:pe(ee.value),valueAsNumber:ee.valueAsNumber,isFocused:fe,isDisabled:d,isReadOnly:c,getIncrementButtonProps:Be,getDecrementButtonProps:Ot,getInputProps:Ht,htmlProps:Y}}var[LW,jg]=Hn({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[zW,ky]=Hn({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),_g=Oe(function(t,n){const r=Qr("NumberInput",t),o=ar(t),s=Xx(o),{htmlProps:i,...c}=$W(s),d=l.useMemo(()=>c,[c]);return a.jsx(zW,{value:d,children:a.jsx(LW,{value:r,children:a.jsx(Ee.div,{...i,ref:n,className:jt("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});_g.displayName="NumberInput";var Ig=Oe(function(t,n){const r=jg();return a.jsx(Ee.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}})});Ig.displayName="NumberInputStepper";var Pg=Oe(function(t,n){const{getInputProps:r}=ky(),o=r(t,n),s=jg();return a.jsx(Ee.input,{...o,className:jt("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});Pg.displayName="NumberInputField";var v3=Ee("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Eg=Oe(function(t,n){var r;const o=jg(),{getDecrementButtonProps:s}=ky(),i=s(t,n);return a.jsx(v3,{...i,__css:o.stepper,children:(r=t.children)!=null?r:a.jsx(EW,{})})});Eg.displayName="NumberDecrementStepper";var Mg=Oe(function(t,n){var r;const{getIncrementButtonProps:o}=ky(),s=o(t,n),i=jg();return a.jsx(v3,{...s,__css:i.stepper,children:(r=t.children)!=null?r:a.jsx(MW,{})})});Mg.displayName="NumberIncrementStepper";var[FW,ec]=Hn({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[BW,Og]=Hn({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Rg(e){const t=l.Children.only(e.children),{getTriggerProps:n}=ec();return l.cloneElement(t,n(t.props,t.ref))}Rg.displayName="PopoverTrigger";var Ec={click:"click",hover:"hover"};function HW(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:i=!0,arrowSize:c,arrowShadowColor:d,trigger:p=Ec.click,openDelay:h=200,closeDelay:m=200,isLazy:g,lazyBehavior:b="unmount",computePositionOnMount:y,...x}=e,{isOpen:C,onClose:S,onOpen:j,onToggle:_}=wy(e),I=l.useRef(null),P=l.useRef(null),M=l.useRef(null),R=l.useRef(!1),A=l.useRef(!1);C&&(A.current=!0);const[D,O]=l.useState(!1),[T,Y]=l.useState(!1),z=l.useId(),W=o??z,[Q,U,L,ee]=["popover-trigger","popover-content","popover-header","popover-body"].map(he=>`${he}-${W}`),{referenceRef:K,getArrowProps:Z,getPopperProps:se,getArrowInnerProps:fe,forceUpdate:G}=Cy({...x,enabled:C||!!y}),te=o3({isOpen:C,ref:M});YP({enabled:C,ref:P}),q5(M,{focusRef:P,visible:C,shouldFocus:s&&p===Ec.click}),XF(M,{focusRef:r,visible:C,shouldFocus:i&&p===Ec.click});const V=Sy({wasSelected:A.current,enabled:g,mode:b,isSelected:te.present}),F=l.useCallback((he={},Ne=null)=>{const De={...he,style:{...he.style,transformOrigin:Fr.transformOrigin.varRef,[Fr.arrowSize.var]:c?`${c}px`:void 0,[Fr.arrowShadowColor.var]:d},ref:gn(M,Ne),children:V?he.children:null,id:U,tabIndex:-1,role:"dialog",onKeyDown:rt(he.onKeyDown,qe=>{n&&qe.key==="Escape"&&S()}),onBlur:rt(he.onBlur,qe=>{const Mt=ak(qe),ot=Kv(M.current,Mt),an=Kv(P.current,Mt);C&&t&&(!ot&&!an)&&S()}),"aria-labelledby":D?L:void 0,"aria-describedby":T?ee:void 0};return p===Ec.hover&&(De.role="tooltip",De.onMouseEnter=rt(he.onMouseEnter,()=>{R.current=!0}),De.onMouseLeave=rt(he.onMouseLeave,qe=>{qe.nativeEvent.relatedTarget!==null&&(R.current=!1,setTimeout(()=>S(),m))})),De},[V,U,D,L,T,ee,p,n,S,C,t,m,d,c]),X=l.useCallback((he={},Ne=null)=>se({...he,style:{visibility:C?"visible":"hidden",...he.style}},Ne),[C,se]),ue=l.useCallback((he,Ne=null)=>({...he,ref:gn(Ne,I,K)}),[I,K]),q=l.useRef(),ne=l.useRef(),pe=l.useCallback(he=>{I.current==null&&K(he)},[K]),le=l.useCallback((he={},Ne=null)=>{const De={...he,ref:gn(P,Ne,pe),id:Q,"aria-haspopup":"dialog","aria-expanded":C,"aria-controls":U};return p===Ec.click&&(De.onClick=rt(he.onClick,_)),p===Ec.hover&&(De.onFocus=rt(he.onFocus,()=>{q.current===void 0&&j()}),De.onBlur=rt(he.onBlur,qe=>{const Mt=ak(qe),ot=!Kv(M.current,Mt);C&&t&&ot&&S()}),De.onKeyDown=rt(he.onKeyDown,qe=>{qe.key==="Escape"&&S()}),De.onMouseEnter=rt(he.onMouseEnter,()=>{R.current=!0,q.current=window.setTimeout(()=>j(),h)}),De.onMouseLeave=rt(he.onMouseLeave,()=>{R.current=!1,q.current&&(clearTimeout(q.current),q.current=void 0),ne.current=window.setTimeout(()=>{R.current===!1&&S()},m)})),De},[Q,C,U,p,pe,_,j,t,S,h,m]);l.useEffect(()=>()=>{q.current&&clearTimeout(q.current),ne.current&&clearTimeout(ne.current)},[]);const we=l.useCallback((he={},Ne=null)=>({...he,id:L,ref:gn(Ne,De=>{O(!!De)})}),[L]),ve=l.useCallback((he={},Ne=null)=>({...he,id:ee,ref:gn(Ne,De=>{Y(!!De)})}),[ee]);return{forceUpdate:G,isOpen:C,onAnimationComplete:te.onComplete,onClose:S,getAnchorProps:ue,getArrowProps:Z,getArrowInnerProps:fe,getPopoverPositionerProps:X,getPopoverProps:F,getTriggerProps:le,getHeaderProps:we,getBodyProps:ve}}function Kv(e,t){return e===t||(e==null?void 0:e.contains(t))}function ak(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Nf(e){const t=Qr("Popover",e),{children:n,...r}=ar(e),o=mf(),s=HW({...r,direction:o.direction});return a.jsx(FW,{value:s,children:a.jsx(BW,{value:t,children:xx(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Nf.displayName="Popover";function b3(e){const t=l.Children.only(e.children),{getAnchorProps:n}=ec();return l.cloneElement(t,n(t.props,t.ref))}b3.displayName="PopoverAnchor";var Qv=(e,t)=>t?`${e}.${t}, ${t}`:void 0;function x3(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:i,shadowColor:c}=e,{getArrowProps:d,getArrowInnerProps:p}=ec(),h=Og(),m=(t=n??r)!=null?t:o,g=s??i;return a.jsx(Ee.div,{...d(),className:"chakra-popover__arrow-positioner",children:a.jsx(Ee.div,{className:jt("chakra-popover__arrow",e.className),...p(e),__css:{"--popper-arrow-shadow-color":Qv("colors",c),"--popper-arrow-bg":Qv("colors",m),"--popper-arrow-shadow":Qv("shadows",g),...h.arrow}})})}x3.displayName="PopoverArrow";var Ag=Oe(function(t,n){const{getBodyProps:r}=ec(),o=Og();return a.jsx(Ee.div,{...r(t,n),className:jt("chakra-popover__body",t.className),__css:o.body})});Ag.displayName="PopoverBody";var y3=Oe(function(t,n){const{onClose:r}=ec(),o=Og();return a.jsx(kI,{size:"sm",onClick:r,className:jt("chakra-popover__close-btn",t.className),__css:o.closeButton,ref:n,...t})});y3.displayName="PopoverCloseButton";function WW(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var VW={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]}}},UW=Ee(Or.section),C3=Oe(function(t,n){const{variants:r=VW,...o}=t,{isOpen:s}=ec();return a.jsx(UW,{ref:n,variants:WW(r),initial:!1,animate:s?"enter":"exit",...o})});C3.displayName="PopoverTransition";var $f=Oe(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:i,getPopoverPositionerProps:c,onAnimationComplete:d}=ec(),p=Og(),h={position:"relative",display:"flex",flexDirection:"column",...p.content};return a.jsx(Ee.div,{...c(r),__css:p.popper,className:"chakra-popover__popper",children:a.jsx(C3,{...o,...i(s,n),onAnimationComplete:og(d,s.onAnimationComplete),className:jt("chakra-popover__content",t.className),__css:h})})});$f.displayName="PopoverContent";var bb=e=>a.jsx(Ee.circle,{cx:50,cy:50,r:42,fill:"transparent",...e});bb.displayName="Circle";function GW(e,t,n){return(e-t)*100/(n-t)}var qW=yi({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}}),KW=yi({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),QW=yi({"0%":{left:"-40%"},"100%":{left:"100%"}}),XW=yi({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function w3(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:i,role:c="progressbar"}=e,d=GW(t,n,r);return{bind:{"data-indeterminate":i?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":i?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,d):o})(),role:c},percent:d,value:t}}var S3=e=>{const{size:t,isIndeterminate:n,...r}=e;return a.jsx(Ee.svg,{viewBox:"0 0 100 100",__css:{width:t,height:t,animation:n?`${KW} 2s linear infinite`:void 0},...r})};S3.displayName="Shape";var xb=Oe((e,t)=>{var n;const{size:r="48px",max:o=100,min:s=0,valueText:i,getValueText:c,value:d,capIsRound:p,children:h,thickness:m="10px",color:g="#0078d4",trackColor:b="#edebe9",isIndeterminate:y,...x}=e,C=w3({min:s,max:o,value:d,valueText:i,getValueText:c,isIndeterminate:y}),S=y?void 0:((n=C.percent)!=null?n:0)*2.64,j=S==null?void 0:`${S} ${264-S}`,_=y?{css:{animation:`${qW} 1.5s linear infinite`}}:{strokeDashoffset:66,strokeDasharray:j,transitionProperty:"stroke-dasharray, stroke",transitionDuration:"0.6s",transitionTimingFunction:"ease"},I={display:"inline-block",position:"relative",verticalAlign:"middle",fontSize:r};return a.jsxs(Ee.div,{ref:t,className:"chakra-progress",...C.bind,...x,__css:I,children:[a.jsxs(S3,{size:r,isIndeterminate:y,children:[a.jsx(bb,{stroke:b,strokeWidth:m,className:"chakra-progress__track"}),a.jsx(bb,{stroke:g,strokeWidth:m,className:"chakra-progress__indicator",strokeLinecap:p?"round":void 0,opacity:C.value===0&&!y?0:void 0,..._})]}),h]})});xb.displayName="CircularProgress";var[YW,JW]=Hn({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),ZW=Oe((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:i,...c}=e,d=w3({value:o,min:n,max:r,isIndeterminate:s,role:i}),h={height:"100%",...JW().filledTrack};return a.jsx(Ee.div,{ref:t,style:{width:`${d.percent}%`,...c.style},...d.bind,...c,__css:h})}),k3=Oe((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:i,isAnimated:c,children:d,borderRadius:p,isIndeterminate:h,"aria-label":m,"aria-labelledby":g,"aria-valuetext":b,title:y,role:x,...C}=ar(e),S=Qr("Progress",e),j=p??((n=S.track)==null?void 0:n.borderRadius),_={animation:`${XW} 1s linear infinite`},M={...!h&&i&&c&&_,...h&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${QW} 1s ease infinite normal none running`}},R={overflow:"hidden",position:"relative",...S.track};return a.jsx(Ee.div,{ref:t,borderRadius:j,__css:R,...C,children:a.jsxs(YW,{value:S,children:[a.jsx(ZW,{"aria-label":m,"aria-labelledby":g,"aria-valuetext":b,min:o,max:s,value:r,isIndeterminate:h,css:M,borderRadius:j,title:y,role:x}),d]})})});k3.displayName="Progress";function eV(e){return e&&L1(e)&&L1(e.target)}function tV(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:i,isNative:c,...d}=e,[p,h]=l.useState(r||""),m=typeof n<"u",g=m?n:p,b=l.useRef(null),y=l.useCallback(()=>{const P=b.current;if(!P)return;let M="input:not(:disabled):checked";const R=P.querySelector(M);if(R){R.focus();return}M="input:not(:disabled)";const A=P.querySelector(M);A==null||A.focus()},[]),C=`radio-${l.useId()}`,S=o||C,j=l.useCallback(P=>{const M=eV(P)?P.target.value:P;m||h(M),t==null||t(String(M))},[t,m]),_=l.useCallback((P={},M=null)=>({...P,ref:gn(M,b),role:"radiogroup"}),[]),I=l.useCallback((P={},M=null)=>({...P,ref:M,name:S,[c?"checked":"isChecked"]:g!=null?P.value===g:void 0,onChange(A){j(A)},"data-radiogroup":!0}),[c,S,j,g]);return{getRootProps:_,getRadioProps:I,name:S,ref:b,focus:y,setValue:h,value:g,onChange:j,isDisabled:s,isFocusable:i,htmlProps:d}}var[nV,j3]=Hn({name:"RadioGroupContext",strict:!1}),em=Oe((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:i,isDisabled:c,isFocusable:d,...p}=e,{value:h,onChange:m,getRootProps:g,name:b,htmlProps:y}=tV(p),x=l.useMemo(()=>({name:b,size:r,onChange:m,colorScheme:n,value:h,variant:o,isDisabled:c,isFocusable:d}),[b,r,m,n,h,o,c,d]);return a.jsx(nV,{value:x,children:a.jsx(Ee.div,{...g(y,t),className:jt("chakra-radio-group",i),children:s})})});em.displayName="RadioGroup";var rV={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function oV(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:i,onChange:c,isInvalid:d,name:p,value:h,id:m,"data-radiogroup":g,"aria-describedby":b,...y}=e,x=`radio-${l.useId()}`,C=kf(),j=!!j3()||!!g;let I=!!C&&!j?C.id:x;I=m??I;const P=o??(C==null?void 0:C.isDisabled),M=s??(C==null?void 0:C.isReadOnly),R=i??(C==null?void 0:C.isRequired),A=d??(C==null?void 0:C.isInvalid),[D,O]=l.useState(!1),[T,Y]=l.useState(!1),[z,W]=l.useState(!1),[Q,U]=l.useState(!1),[L,ee]=l.useState(!!t),K=typeof n<"u",Z=K?n:L;l.useEffect(()=>VP(O),[]);const se=l.useCallback(pe=>{if(M||P){pe.preventDefault();return}K||ee(pe.target.checked),c==null||c(pe)},[K,P,M,c]),fe=l.useCallback(pe=>{pe.key===" "&&U(!0)},[U]),G=l.useCallback(pe=>{pe.key===" "&&U(!1)},[U]),te=l.useCallback((pe={},le=null)=>({...pe,ref:le,"data-active":qt(Q),"data-hover":qt(z),"data-disabled":qt(P),"data-invalid":qt(A),"data-checked":qt(Z),"data-focus":qt(T),"data-focus-visible":qt(T&&D),"data-readonly":qt(M),"aria-hidden":!0,onMouseDown:rt(pe.onMouseDown,()=>U(!0)),onMouseUp:rt(pe.onMouseUp,()=>U(!1)),onMouseEnter:rt(pe.onMouseEnter,()=>W(!0)),onMouseLeave:rt(pe.onMouseLeave,()=>W(!1))}),[Q,z,P,A,Z,T,M,D]),{onFocus:V,onBlur:F}=C??{},X=l.useCallback((pe={},le=null)=>{const we=P&&!r;return{...pe,id:I,ref:le,type:"radio",name:p,value:h,onChange:rt(pe.onChange,se),onBlur:rt(F,pe.onBlur,()=>Y(!1)),onFocus:rt(V,pe.onFocus,()=>Y(!0)),onKeyDown:rt(pe.onKeyDown,fe),onKeyUp:rt(pe.onKeyUp,G),checked:Z,disabled:we,readOnly:M,required:R,"aria-invalid":_s(A),"aria-disabled":_s(we),"aria-required":_s(R),"data-readonly":qt(M),"aria-describedby":b,style:rV}},[P,r,I,p,h,se,F,V,fe,G,Z,M,R,A,b]);return{state:{isInvalid:A,isFocused:T,isChecked:Z,isActive:Q,isHovered:z,isDisabled:P,isReadOnly:M,isRequired:R},getCheckboxProps:te,getRadioProps:te,getInputProps:X,getLabelProps:(pe={},le=null)=>({...pe,ref:le,onMouseDown:rt(pe.onMouseDown,sV),"data-disabled":qt(P),"data-checked":qt(Z),"data-invalid":qt(A)}),getRootProps:(pe,le=null)=>({...pe,ref:le,"data-disabled":qt(P),"data-checked":qt(Z),"data-invalid":qt(A)}),htmlProps:y}}function sV(e){e.preventDefault(),e.stopPropagation()}function aV(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 Za=Oe((e,t)=>{var n;const r=j3(),{onChange:o,value:s}=e,i=Qr("Radio",{...r,...e}),c=ar(e),{spacing:d="0.5rem",children:p,isDisabled:h=r==null?void 0:r.isDisabled,isFocusable:m=r==null?void 0:r.isFocusable,inputProps:g,...b}=c;let y=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(y=r.value===s);let x=o;r!=null&&r.onChange&&s!=null&&(x=og(r.onChange,o));const C=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:S,getCheckboxProps:j,getLabelProps:_,getRootProps:I,htmlProps:P}=oV({...b,isChecked:y,isFocusable:m,isDisabled:h,onChange:x,name:C}),[M,R]=aV(P,jI),A=j(R),D=S(g,t),O=_(),T=Object.assign({},M,I()),Y={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...i.container},z={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...i.control},W={userSelect:"none",marginStart:d,...i.label};return a.jsxs(Ee.label,{className:"chakra-radio",...T,__css:Y,children:[a.jsx("input",{className:"chakra-radio__input",...D}),a.jsx(Ee.span,{className:"chakra-radio__control",...A,__css:z}),p&&a.jsx(Ee.span,{className:"chakra-radio__label",...O,__css:W,children:p})]})});Za.displayName="Radio";var _3=Oe(function(t,n){const{children:r,placeholder:o,className:s,...i}=t;return a.jsxs(Ee.select,{...i,ref:n,className:jt("chakra-select",s),children:[o&&a.jsx("option",{value:"",children:o}),r]})});_3.displayName="SelectField";function iV(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 I3=Oe((e,t)=>{var n;const r=Qr("Select",e),{rootProps:o,placeholder:s,icon:i,color:c,height:d,h:p,minH:h,minHeight:m,iconColor:g,iconSize:b,...y}=ar(e),[x,C]=iV(y,jI),S=Qx(C),j={width:"100%",height:"fit-content",position:"relative",color:c},_={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return a.jsxs(Ee.div,{className:"chakra-select__wrapper",__css:j,...x,...o,children:[a.jsx(_3,{ref:t,height:p??d,minH:h??m,placeholder:s,...S,__css:_,children:e.children}),a.jsx(P3,{"data-disabled":qt(S.disabled),...(g||c)&&{color:g||c},__css:r.icon,...b&&{fontSize:b},children:i})]})});I3.displayName="Select";var lV=e=>a.jsx("svg",{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),cV=Ee("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),P3=e=>{const{children:t=a.jsx(lV,{}),...n}=e,r=l.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return a.jsx(cV,{...n,className:"chakra-select__icon-wrapper",children:l.isValidElement(t)?r:null})};P3.displayName="SelectIcon";function uV(){const e=l.useRef(!0);return l.useEffect(()=>{e.current=!1},[]),e.current}function dV(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}var fV=Ee("div",{baseStyle:{boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none","&::before, &::after, *":{visibility:"hidden"}}}),yb=_I("skeleton-start-color"),Cb=_I("skeleton-end-color"),pV=yi({from:{opacity:0},to:{opacity:1}}),hV=yi({from:{borderColor:yb.reference,background:yb.reference},to:{borderColor:Cb.reference,background:Cb.reference}}),Dg=Oe((e,t)=>{const n={...e,fadeDuration:typeof e.fadeDuration=="number"?e.fadeDuration:.4,speed:typeof e.speed=="number"?e.speed:.8},r=ll("Skeleton",n),o=uV(),{startColor:s="",endColor:i="",isLoaded:c,fadeDuration:d,speed:p,className:h,fitContent:m,...g}=ar(n),[b,y]=Ks("colors",[s,i]),x=dV(c),C=jt("chakra-skeleton",h),S={...b&&{[yb.variable]:b},...y&&{[Cb.variable]:y}};if(c){const j=o||x?"none":`${pV} ${d}s`;return a.jsx(Ee.div,{ref:t,className:C,__css:{animation:j},...g})}return a.jsx(fV,{ref:t,className:C,...g,__css:{width:m?"fit-content":void 0,...r,...S,_dark:{...r._dark,...S},animation:`${p}s linear infinite alternate ${hV}`}})});Dg.displayName="Skeleton";var xs=e=>e?"":void 0,su=e=>e?!0:void 0,ul=(...e)=>e.filter(Boolean).join(" ");function au(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function mV(e){return{root:`slider-root-${e}`,getThumb:t=>`slider-thumb-${e}-${t}`,getInput:t=>`slider-input-${e}-${t}`,track:`slider-track-${e}`,innerTrack:`slider-filled-track-${e}`,getMarker:t=>`slider-marker-${e}-${t}`,output:`slider-output-${e}`}}function Pd(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var Ih={width:0,height:0},Up=e=>e||Ih;function E3(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=x=>{var C;const S=(C=r[x])!=null?C:Ih;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Pd({orientation:t,vertical:{bottom:`calc(${n[x]}% - ${S.height/2}px)`},horizontal:{left:`calc(${n[x]}% - ${S.width/2}px)`}})}},i=t==="vertical"?r.reduce((x,C)=>Up(x).height>Up(C).height?x:C,Ih):r.reduce((x,C)=>Up(x).width>Up(C).width?x:C,Ih),c={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Pd({orientation:t,vertical:i?{paddingLeft:i.width/2,paddingRight:i.width/2}:{},horizontal:i?{paddingTop:i.height/2,paddingBottom:i.height/2}:{}})},d={position:"absolute",...Pd({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},p=n.length===1,h=[0,o?100-n[0]:n[0]],m=p?h:n;let g=m[0];!p&&o&&(g=100-g);const b=Math.abs(m[m.length-1]-m[0]),y={...d,...Pd({orientation:t,vertical:o?{height:`${b}%`,top:`${g}%`}:{height:`${b}%`,bottom:`${g}%`},horizontal:o?{width:`${b}%`,right:`${g}%`}:{width:`${b}%`,left:`${g}%`}})};return{trackStyle:d,innerTrackStyle:y,rootStyle:c,getThumbStyle:s}}function M3(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function gV(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function vV(e){const t=xV(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function O3(e){return!!e.touches}function bV(e){return O3(e)&&e.touches.length>1}function xV(e){var t;return(t=e.view)!=null?t:window}function yV(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function CV(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function R3(e,t="page"){return O3(e)?yV(e,t):CV(e,t)}function wV(e){return t=>{const n=vV(t);(!n||n&&t.button===0)&&e(t)}}function SV(e,t=!1){function n(o){e(o,{point:R3(o)})}return t?wV(n):n}function Ph(e,t,n,r){return gV(e,t,SV(n,t==="pointerdown"),r)}var kV=Object.defineProperty,jV=(e,t,n)=>t in e?kV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ws=(e,t,n)=>(jV(e,typeof t!="symbol"?t+"":t,n),n),_V=class{constructor(e,t,n){Ws(this,"history",[]),Ws(this,"startEvent",null),Ws(this,"lastEvent",null),Ws(this,"lastEventInfo",null),Ws(this,"handlers",{}),Ws(this,"removeListeners",()=>{}),Ws(this,"threshold",3),Ws(this,"win"),Ws(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const c=Xv(this.lastEventInfo,this.history),d=this.startEvent!==null,p=MV(c.offset,{x:0,y:0})>=this.threshold;if(!d&&!p)return;const{timestamp:h}=wS();this.history.push({...c.point,timestamp:h});const{onStart:m,onMove:g}=this.handlers;d||(m==null||m(this.lastEvent,c),this.startEvent=this.lastEvent),g==null||g(this.lastEvent,c)}),Ws(this,"onPointerMove",(c,d)=>{this.lastEvent=c,this.lastEventInfo=d,X$.update(this.updatePoint,!0)}),Ws(this,"onPointerUp",(c,d)=>{const p=Xv(d,this.history),{onEnd:h,onSessionEnd:m}=this.handlers;m==null||m(c,p),this.end(),!(!h||!this.startEvent)&&(h==null||h(c,p))});var r;if(this.win=(r=e.view)!=null?r:window,bV(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:R3(e)},{timestamp:s}=wS();this.history=[{...o.point,timestamp:s}];const{onSessionStart:i}=t;i==null||i(e,Xv(o,this.history)),this.removeListeners=EV(Ph(this.win,"pointermove",this.onPointerMove),Ph(this.win,"pointerup",this.onPointerUp),Ph(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),Y$.update(this.updatePoint)}};function ik(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Xv(e,t){return{point:e.point,delta:ik(e.point,t[t.length-1]),offset:ik(e.point,t[0]),velocity:PV(t,.1)}}var IV=e=>e*1e3;function PV(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>IV(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 i={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function EV(...e){return t=>e.reduce((n,r)=>r(n),t)}function Yv(e,t){return Math.abs(e-t)}function lk(e){return"x"in e&&"y"in e}function MV(e,t){if(typeof e=="number"&&typeof t=="number")return Yv(e,t);if(lk(e)&&lk(t)){const n=Yv(e.x,t.x),r=Yv(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function A3(e){const t=l.useRef(null);return t.current=e,t}function D3(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:i,threshold:c}=t,d=!!(n||r||o||s||i),p=l.useRef(null),h=A3({onSessionStart:s,onSessionEnd:i,onStart:r,onMove:n,onEnd(m,g){p.current=null,o==null||o(m,g)}});l.useEffect(()=>{var m;(m=p.current)==null||m.updateHandlers(h.current)}),l.useEffect(()=>{const m=e.current;if(!m||!d)return;function g(b){p.current=new _V(b,h.current,c)}return Ph(m,"pointerdown",g)},[e,d,h,c]),l.useEffect(()=>()=>{var m;(m=p.current)==null||m.end(),p.current=null},[])}function OV(e,t){if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const n=e.ownerDocument.defaultView??window,r=new n.ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const[s]=o;let i,c;if("borderBoxSize"in s){const d=s.borderBoxSize,p=Array.isArray(d)?d[0]:d;i=p.inlineSize,c=p.blockSize}else i=e.offsetWidth,c=e.offsetHeight;t({width:i,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}var RV=globalThis!=null&&globalThis.document?l.useLayoutEffect:l.useEffect;function AV(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 T3({getNodes:e,observeMutation:t=!0}){const[n,r]=l.useState([]),[o,s]=l.useState(0);return RV(()=>{const i=e(),c=i.map((d,p)=>OV(d,h=>{r(m=>[...m.slice(0,p),h,...m.slice(p+1)])}));if(t){const d=i[0];c.push(AV(d,()=>{s(p=>p+1)}))}return()=>{c.forEach(d=>{d==null||d()})}},[o]),n}function DV(e){return typeof e=="object"&&e!==null&&"current"in e}function TV(e){const[t]=T3({observeMutation:!1,getNodes(){return[DV(e)?e.current:e]}});return t}function NV(e){const{min:t=0,max:n=100,onChange:r,value:o,defaultValue:s,isReversed:i,direction:c="ltr",orientation:d="horizontal",id:p,isDisabled:h,isReadOnly:m,onChangeStart:g,onChangeEnd:b,step:y=1,getAriaValueText:x,"aria-valuetext":C,"aria-label":S,"aria-labelledby":j,name:_,focusThumbOnChange:I=!0,minStepsBetweenThumbs:P=0,...M}=e,R=pr(g),A=pr(b),D=pr(x),O=M3({isReversed:i,direction:c,orientation:d}),[T,Y]=wf({value:o,defaultValue:s??[25,75],onChange:r});if(!Array.isArray(T))throw new TypeError(`[range-slider] You passed an invalid value for \`value\` or \`defaultValue\`, expected \`Array\` but got \`${typeof T}\``);const[z,W]=l.useState(!1),[Q,U]=l.useState(!1),[L,ee]=l.useState(-1),K=!(h||m),Z=l.useRef(T),se=T.map(Me=>tu(Me,t,n)),fe=P*y,G=$V(se,t,n,fe),te=l.useRef({eventSource:null,value:[],valueBounds:[]});te.current.value=se,te.current.valueBounds=G;const V=se.map(Me=>n-Me+t),X=(O?V:se).map(Me=>Qh(Me,t,n)),ue=d==="vertical",q=l.useRef(null),ne=l.useRef(null),pe=T3({getNodes(){const Me=ne.current,Ze=Me==null?void 0:Me.querySelectorAll("[role=slider]");return Ze?Array.from(Ze):[]}}),le=l.useId(),ve=mV(p??le),he=l.useCallback(Me=>{var Ze,Ye;if(!q.current)return;te.current.eventSource="pointer";const ut=q.current.getBoundingClientRect(),{clientX:Ut,clientY:xr}=(Ye=(Ze=Me.touches)==null?void 0:Ze[0])!=null?Ye:Me,yn=ue?ut.bottom-xr:Ut-ut.left,hn=ue?ut.height:ut.width;let oo=yn/hn;return O&&(oo=1-oo),GP(oo,t,n)},[ue,O,n,t]),Ne=(n-t)/10,De=y||(n-t)/100,qe=l.useMemo(()=>({setValueAtIndex(Me,Ze){if(!K)return;const Ye=te.current.valueBounds[Me];Ze=parseFloat(ab(Ze,Ye.min,De)),Ze=tu(Ze,Ye.min,Ye.max);const ut=[...te.current.value];ut[Me]=Ze,Y(ut)},setActiveIndex:ee,stepUp(Me,Ze=De){const Ye=te.current.value[Me],ut=O?Ye-Ze:Ye+Ze;qe.setValueAtIndex(Me,ut)},stepDown(Me,Ze=De){const Ye=te.current.value[Me],ut=O?Ye+Ze:Ye-Ze;qe.setValueAtIndex(Me,ut)},reset(){Y(Z.current)}}),[De,O,Y,K]),Mt=l.useCallback(Me=>{const Ze=Me.key,ut={ArrowRight:()=>qe.stepUp(L),ArrowUp:()=>qe.stepUp(L),ArrowLeft:()=>qe.stepDown(L),ArrowDown:()=>qe.stepDown(L),PageUp:()=>qe.stepUp(L,Ne),PageDown:()=>qe.stepDown(L,Ne),Home:()=>{const{min:Ut}=G[L];qe.setValueAtIndex(L,Ut)},End:()=>{const{max:Ut}=G[L];qe.setValueAtIndex(L,Ut)}}[Ze];ut&&(Me.preventDefault(),Me.stopPropagation(),ut(Me),te.current.eventSource="keyboard")},[qe,L,Ne,G]),{getThumbStyle:ot,rootStyle:an,trackStyle:pt,innerTrackStyle:vt}=l.useMemo(()=>E3({isReversed:O,orientation:d,thumbRects:pe,thumbPercents:X}),[O,d,X,pe]),ke=l.useCallback(Me=>{var Ze;const Ye=Me??L;if(Ye!==-1&&I){const ut=ve.getThumb(Ye),Ut=(Ze=ne.current)==null?void 0:Ze.ownerDocument.getElementById(ut);Ut&&setTimeout(()=>Ut.focus())}},[I,L,ve]);xi(()=>{te.current.eventSource==="keyboard"&&(A==null||A(te.current.value))},[se,A]);const Be=Me=>{const Ze=he(Me)||0,Ye=te.current.value.map(hn=>Math.abs(hn-Ze)),ut=Math.min(...Ye);let Ut=Ye.indexOf(ut);const xr=Ye.filter(hn=>hn===ut);xr.length>1&&Ze>te.current.value[Ut]&&(Ut=Ut+xr.length-1),ee(Ut),qe.setValueAtIndex(Ut,Ze),ke(Ut)},Ot=Me=>{if(L==-1)return;const Ze=he(Me)||0;ee(L),qe.setValueAtIndex(L,Ze),ke(L)};D3(ne,{onPanSessionStart(Me){K&&(W(!0),Be(Me),R==null||R(te.current.value))},onPanSessionEnd(){K&&(W(!1),A==null||A(te.current.value))},onPan(Me){K&&Ot(Me)}});const Ht=l.useCallback((Me={},Ze=null)=>({...Me,...M,id:ve.root,ref:gn(Ze,ne),tabIndex:-1,"aria-disabled":su(h),"data-focused":xs(Q),style:{...Me.style,...an}}),[M,h,Q,an,ve]),je=l.useCallback((Me={},Ze=null)=>({...Me,ref:gn(Ze,q),id:ve.track,"data-disabled":xs(h),style:{...Me.style,...pt}}),[h,pt,ve]),ht=l.useCallback((Me={},Ze=null)=>({...Me,ref:Ze,id:ve.innerTrack,style:{...Me.style,...vt}}),[vt,ve]),At=l.useCallback((Me,Ze=null)=>{var Ye;const{index:ut,...Ut}=Me,xr=se[ut];if(xr==null)throw new TypeError(`[range-slider > thumb] Cannot find value at index \`${ut}\`. The \`value\` or \`defaultValue\` length is : ${se.length}`);const yn=G[ut];return{...Ut,ref:Ze,role:"slider",tabIndex:K?0:void 0,id:ve.getThumb(ut),"data-active":xs(z&&L===ut),"aria-valuetext":(Ye=D==null?void 0:D(xr))!=null?Ye:C==null?void 0:C[ut],"aria-valuemin":yn.min,"aria-valuemax":yn.max,"aria-valuenow":xr,"aria-orientation":d,"aria-disabled":su(h),"aria-readonly":su(m),"aria-label":S==null?void 0:S[ut],"aria-labelledby":S!=null&&S[ut]||j==null?void 0:j[ut],style:{...Me.style,...ot(ut)},onKeyDown:au(Me.onKeyDown,Mt),onFocus:au(Me.onFocus,()=>{U(!0),ee(ut)}),onBlur:au(Me.onBlur,()=>{U(!1),ee(-1)})}},[ve,se,G,K,z,L,D,C,d,h,m,S,j,ot,Mt,U]),_t=l.useCallback((Me={},Ze=null)=>({...Me,ref:Ze,id:ve.output,htmlFor:se.map((Ye,ut)=>ve.getThumb(ut)).join(" "),"aria-live":"off"}),[ve,se]),Re=l.useCallback((Me,Ze=null)=>{const{value:Ye,...ut}=Me,Ut=!(Yen),xr=Ye>=se[0]&&Ye<=se[se.length-1];let yn=Qh(Ye,t,n);yn=O?100-yn:yn;const hn={position:"absolute",pointerEvents:"none",...Pd({orientation:d,vertical:{bottom:`${yn}%`},horizontal:{left:`${yn}%`}})};return{...ut,ref:Ze,id:ve.getMarker(Me.value),role:"presentation","aria-hidden":!0,"data-disabled":xs(h),"data-invalid":xs(!Ut),"data-highlighted":xs(xr),style:{...Me.style,...hn}}},[h,O,n,t,d,se,ve]),Xe=l.useCallback((Me,Ze=null)=>{const{index:Ye,...ut}=Me;return{...ut,ref:Ze,id:ve.getInput(Ye),type:"hidden",value:se[Ye],name:Array.isArray(_)?_[Ye]:`${_}-${Ye}`}},[_,se,ve]);return{state:{value:se,isFocused:Q,isDragging:z,getThumbPercent:Me=>X[Me],getThumbMinValue:Me=>G[Me].min,getThumbMaxValue:Me=>G[Me].max},actions:qe,getRootProps:Ht,getTrackProps:je,getInnerTrackProps:ht,getThumbProps:At,getMarkerProps:Re,getInputProps:Xe,getOutputProps:_t}}function $V(e,t,n,r){return e.map((o,s)=>{const i=s===0?t:e[s-1]+r,c=s===e.length-1?n:e[s+1]-r;return{min:i,max:c}})}var[LV,Tg]=Hn({name:"SliderContext",errorMessage:"useSliderContext: `context` is undefined. Seems you forgot to wrap all slider components within "}),[zV,Ng]=Hn({name:"RangeSliderStylesContext",errorMessage:`useRangeSliderStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),N3=Oe(function(t,n){const r={orientation:"horizontal",...t},o=Qr("Slider",r),s=ar(r),{direction:i}=mf();s.direction=i;const{getRootProps:c,...d}=NV(s),p=l.useMemo(()=>({...d,name:r.name}),[d,r.name]);return a.jsx(LV,{value:p,children:a.jsx(zV,{value:o,children:a.jsx(Ee.div,{...c({},n),className:"chakra-slider",__css:o.container,children:r.children})})})});N3.displayName="RangeSlider";var wb=Oe(function(t,n){const{getThumbProps:r,getInputProps:o,name:s}=Tg(),i=Ng(),c=r(t,n);return a.jsxs(Ee.div,{...c,className:ul("chakra-slider__thumb",t.className),__css:i.thumb,children:[c.children,s&&a.jsx("input",{...o({index:t.index})})]})});wb.displayName="RangeSliderThumb";var $3=Oe(function(t,n){const{getTrackProps:r}=Tg(),o=Ng(),s=r(t,n);return a.jsx(Ee.div,{...s,className:ul("chakra-slider__track",t.className),__css:o.track,"data-testid":"chakra-range-slider-track"})});$3.displayName="RangeSliderTrack";var L3=Oe(function(t,n){const{getInnerTrackProps:r}=Tg(),o=Ng(),s=r(t,n);return a.jsx(Ee.div,{...s,className:"chakra-slider__filled-track",__css:o.filledTrack})});L3.displayName="RangeSliderFilledTrack";var Eh=Oe(function(t,n){const{getMarkerProps:r}=Tg(),o=Ng(),s=r(t,n);return a.jsx(Ee.div,{...s,className:ul("chakra-slider__marker",t.className),__css:o.mark})});Eh.displayName="RangeSliderMark";function FV(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:i,isReversed:c,direction:d="ltr",orientation:p="horizontal",id:h,isDisabled:m,isReadOnly:g,onChangeStart:b,onChangeEnd:y,step:x=1,getAriaValueText:C,"aria-valuetext":S,"aria-label":j,"aria-labelledby":_,name:I,focusThumbOnChange:P=!0,...M}=e,R=pr(b),A=pr(y),D=pr(C),O=M3({isReversed:c,direction:d,orientation:p}),[T,Y]=wf({value:s,defaultValue:i??HV(n,r),onChange:o}),[z,W]=l.useState(!1),[Q,U]=l.useState(!1),L=!(m||g),ee=(r-n)/10,K=x||(r-n)/100,Z=tu(T,n,r),se=r-Z+n,G=Qh(O?se:Z,n,r),te=p==="vertical",V=A3({min:n,max:r,step:x,isDisabled:m,value:Z,isInteractive:L,isReversed:O,isVertical:te,eventSource:null,focusThumbOnChange:P,orientation:p}),F=l.useRef(null),X=l.useRef(null),ue=l.useRef(null),q=l.useId(),ne=h??q,[pe,le]=[`slider-thumb-${ne}`,`slider-track-${ne}`],we=l.useCallback(Re=>{var Xe,_n;if(!F.current)return;const Me=V.current;Me.eventSource="pointer";const Ze=F.current.getBoundingClientRect(),{clientX:Ye,clientY:ut}=(_n=(Xe=Re.touches)==null?void 0:Xe[0])!=null?_n:Re,Ut=te?Ze.bottom-ut:Ye-Ze.left,xr=te?Ze.height:Ze.width;let yn=Ut/xr;O&&(yn=1-yn);let hn=GP(yn,Me.min,Me.max);return Me.step&&(hn=parseFloat(ab(hn,Me.min,Me.step))),hn=tu(hn,Me.min,Me.max),hn},[te,O,V]),ve=l.useCallback(Re=>{const Xe=V.current;Xe.isInteractive&&(Re=parseFloat(ab(Re,Xe.min,K)),Re=tu(Re,Xe.min,Xe.max),Y(Re))},[K,Y,V]),he=l.useMemo(()=>({stepUp(Re=K){const Xe=O?Z-Re:Z+Re;ve(Xe)},stepDown(Re=K){const Xe=O?Z+Re:Z-Re;ve(Xe)},reset(){ve(i||0)},stepTo(Re){ve(Re)}}),[ve,O,Z,K,i]),Ne=l.useCallback(Re=>{const Xe=V.current,Me={ArrowRight:()=>he.stepUp(),ArrowUp:()=>he.stepUp(),ArrowLeft:()=>he.stepDown(),ArrowDown:()=>he.stepDown(),PageUp:()=>he.stepUp(ee),PageDown:()=>he.stepDown(ee),Home:()=>ve(Xe.min),End:()=>ve(Xe.max)}[Re.key];Me&&(Re.preventDefault(),Re.stopPropagation(),Me(Re),Xe.eventSource="keyboard")},[he,ve,ee,V]),De=(t=D==null?void 0:D(Z))!=null?t:S,qe=TV(X),{getThumbStyle:Mt,rootStyle:ot,trackStyle:an,innerTrackStyle:pt}=l.useMemo(()=>{const Re=V.current,Xe=qe??{width:0,height:0};return E3({isReversed:O,orientation:Re.orientation,thumbRects:[Xe],thumbPercents:[G]})},[O,qe,G,V]),vt=l.useCallback(()=>{V.current.focusThumbOnChange&&setTimeout(()=>{var Xe;return(Xe=X.current)==null?void 0:Xe.focus()})},[V]);xi(()=>{const Re=V.current;vt(),Re.eventSource==="keyboard"&&(A==null||A(Re.value))},[Z,A]);function ke(Re){const Xe=we(Re);Xe!=null&&Xe!==V.current.value&&Y(Xe)}D3(ue,{onPanSessionStart(Re){const Xe=V.current;Xe.isInteractive&&(W(!0),vt(),ke(Re),R==null||R(Xe.value))},onPanSessionEnd(){const Re=V.current;Re.isInteractive&&(W(!1),A==null||A(Re.value))},onPan(Re){V.current.isInteractive&&ke(Re)}});const Be=l.useCallback((Re={},Xe=null)=>({...Re,...M,ref:gn(Xe,ue),tabIndex:-1,"aria-disabled":su(m),"data-focused":xs(Q),style:{...Re.style,...ot}}),[M,m,Q,ot]),Ot=l.useCallback((Re={},Xe=null)=>({...Re,ref:gn(Xe,F),id:le,"data-disabled":xs(m),style:{...Re.style,...an}}),[m,le,an]),Ht=l.useCallback((Re={},Xe=null)=>({...Re,ref:Xe,style:{...Re.style,...pt}}),[pt]),je=l.useCallback((Re={},Xe=null)=>({...Re,ref:gn(Xe,X),role:"slider",tabIndex:L?0:void 0,id:pe,"data-active":xs(z),"aria-valuetext":De,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":Z,"aria-orientation":p,"aria-disabled":su(m),"aria-readonly":su(g),"aria-label":j,"aria-labelledby":j?void 0:_,style:{...Re.style,...Mt(0)},onKeyDown:au(Re.onKeyDown,Ne),onFocus:au(Re.onFocus,()=>U(!0)),onBlur:au(Re.onBlur,()=>U(!1))}),[L,pe,z,De,n,r,Z,p,m,g,j,_,Mt,Ne]),ht=l.useCallback((Re,Xe=null)=>{const _n=!(Re.valuer),Me=Z>=Re.value,Ze=Qh(Re.value,n,r),Ye={position:"absolute",pointerEvents:"none",...BV({orientation:p,vertical:{bottom:O?`${100-Ze}%`:`${Ze}%`},horizontal:{left:O?`${100-Ze}%`:`${Ze}%`}})};return{...Re,ref:Xe,role:"presentation","aria-hidden":!0,"data-disabled":xs(m),"data-invalid":xs(!_n),"data-highlighted":xs(Me),style:{...Re.style,...Ye}}},[m,O,r,n,p,Z]),At=l.useCallback((Re={},Xe=null)=>({...Re,ref:Xe,type:"hidden",value:Z,name:I}),[I,Z]);return{state:{value:Z,isFocused:Q,isDragging:z},actions:he,getRootProps:Be,getTrackProps:Ot,getInnerTrackProps:Ht,getThumbProps:je,getMarkerProps:ht,getInputProps:At}}function BV(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function HV(e,t){return t"}),[VV,Lg]=Hn({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),jy=Oe((e,t)=>{var n;const r={...e,orientation:(n=e==null?void 0:e.orientation)!=null?n:"horizontal"},o=Qr("Slider",r),s=ar(r),{direction:i}=mf();s.direction=i;const{getInputProps:c,getRootProps:d,...p}=FV(s),h=d(),m=c({},t);return a.jsx(WV,{value:p,children:a.jsx(VV,{value:o,children:a.jsxs(Ee.div,{...h,className:ul("chakra-slider",r.className),__css:o.container,children:[r.children,a.jsx("input",{...m})]})})})});jy.displayName="Slider";var _y=Oe((e,t)=>{const{getThumbProps:n}=$g(),r=Lg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:ul("chakra-slider__thumb",e.className),__css:r.thumb})});_y.displayName="SliderThumb";var Iy=Oe((e,t)=>{const{getTrackProps:n}=$g(),r=Lg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:ul("chakra-slider__track",e.className),__css:r.track})});Iy.displayName="SliderTrack";var Py=Oe((e,t)=>{const{getInnerTrackProps:n}=$g(),r=Lg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:ul("chakra-slider__filled-track",e.className),__css:r.filledTrack})});Py.displayName="SliderFilledTrack";var Lc=Oe((e,t)=>{const{getMarkerProps:n}=$g(),r=Lg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:ul("chakra-slider__marker",e.className),__css:r.mark})});Lc.displayName="SliderMark";var[UV,z3]=Hn({name:"StatStylesContext",errorMessage:`useStatStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),F3=Oe(function(t,n){const r=Qr("Stat",t),o={position:"relative",flex:"1 1 0%",...r.container},{className:s,children:i,...c}=ar(t);return a.jsx(UV,{value:r,children:a.jsx(Ee.div,{ref:n,...c,className:jt("chakra-stat",s),__css:o,children:a.jsx("dl",{children:i})})})});F3.displayName="Stat";var B3=Oe(function(t,n){return a.jsx(Ee.div,{...t,ref:n,role:"group",className:jt("chakra-stat__group",t.className),__css:{display:"flex",flexWrap:"wrap",justifyContent:"space-around",alignItems:"flex-start"}})});B3.displayName="StatGroup";var H3=Oe(function(t,n){const r=z3();return a.jsx(Ee.dt,{ref:n,...t,className:jt("chakra-stat__label",t.className),__css:r.label})});H3.displayName="StatLabel";var W3=Oe(function(t,n){const r=z3();return a.jsx(Ee.dd,{ref:n,...t,className:jt("chakra-stat__number",t.className),__css:{...r.number,fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums"}})});W3.displayName="StatNumber";var Ey=Oe(function(t,n){const r=Qr("Switch",t),{spacing:o="0.5rem",children:s,...i}=ar(t),{getIndicatorProps:c,getInputProps:d,getCheckboxProps:p,getRootProps:h,getLabelProps:m}=UP(i),g=l.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),b=l.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),y=l.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return a.jsxs(Ee.label,{...h(),className:jt("chakra-switch",t.className),__css:g,children:[a.jsx("input",{className:"chakra-switch__input",...d({},n)}),a.jsx(Ee.span,{...p(),className:"chakra-switch__track",__css:b,children:a.jsx(Ee.span,{__css:r.thumb,className:"chakra-switch__thumb",...c()})}),s&&a.jsx(Ee.span,{className:"chakra-switch__label",...m(),__css:y,children:s})]})});Ey.displayName="Switch";var[GV,qV,KV,QV]=Gx();function XV(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:i,lazyBehavior:c="unmount",orientation:d="horizontal",direction:p="ltr",...h}=e,[m,g]=l.useState(n??0),[b,y]=wf({defaultValue:n??0,value:o,onChange:r});l.useEffect(()=>{o!=null&&g(o)},[o]);const x=KV(),C=l.useId();return{id:`tabs-${(t=e.id)!=null?t:C}`,selectedIndex:b,focusedIndex:m,setSelectedIndex:y,setFocusedIndex:g,isManual:s,isLazy:i,lazyBehavior:c,orientation:d,descendants:x,direction:p,htmlProps:h}}var[YV,zg]=Hn({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function JV(e){const{focusedIndex:t,orientation:n,direction:r}=zg(),o=qV(),s=l.useCallback(i=>{const c=()=>{var j;const _=o.nextEnabled(t);_&&((j=_.node)==null||j.focus())},d=()=>{var j;const _=o.prevEnabled(t);_&&((j=_.node)==null||j.focus())},p=()=>{var j;const _=o.firstEnabled();_&&((j=_.node)==null||j.focus())},h=()=>{var j;const _=o.lastEnabled();_&&((j=_.node)==null||j.focus())},m=n==="horizontal",g=n==="vertical",b=i.key,y=r==="ltr"?"ArrowLeft":"ArrowRight",x=r==="ltr"?"ArrowRight":"ArrowLeft",S={[y]:()=>m&&d(),[x]:()=>m&&c(),ArrowDown:()=>g&&c(),ArrowUp:()=>g&&d(),Home:p,End:h}[b];S&&(i.preventDefault(),S(i))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:rt(e.onKeyDown,s)}}function ZV(e){const{isDisabled:t=!1,isFocusable:n=!1,...r}=e,{setSelectedIndex:o,isManual:s,id:i,setFocusedIndex:c,selectedIndex:d}=zg(),{index:p,register:h}=QV({disabled:t&&!n}),m=p===d,g=()=>{o(p)},b=()=>{c(p),!s&&!(t&&n)&&o(p)},y=G5({...r,ref:gn(h,e.ref),isDisabled:t,isFocusable:n,onClick:rt(e.onClick,g)}),x="button";return{...y,id:V3(i,p),role:"tab",tabIndex:m?0:-1,type:x,"aria-selected":m,"aria-controls":U3(i,p),onFocus:t?void 0:rt(e.onFocus,b)}}var[eU,tU]=Hn({});function nU(e){const t=zg(),{id:n,selectedIndex:r}=t,s=hg(e.children).map((i,c)=>l.createElement(eU,{key:c,value:{isSelected:c===r,id:U3(n,c),tabId:V3(n,c),selectedIndex:r}},i));return{...e,children:s}}function rU(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=zg(),{isSelected:s,id:i,tabId:c}=tU(),d=l.useRef(!1);s&&(d.current=!0);const p=Sy({wasSelected:d.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:p?t:null,role:"tabpanel","aria-labelledby":c,hidden:!s,id:i}}function V3(e,t){return`${e}--tab-${t}`}function U3(e,t){return`${e}--tabpanel-${t}`}var[oU,Fg]=Hn({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),tc=Oe(function(t,n){const r=Qr("Tabs",t),{children:o,className:s,...i}=ar(t),{htmlProps:c,descendants:d,...p}=XV(i),h=l.useMemo(()=>p,[p]),{isFitted:m,...g}=c;return a.jsx(GV,{value:d,children:a.jsx(YV,{value:h,children:a.jsx(oU,{value:r,children:a.jsx(Ee.div,{className:jt("chakra-tabs",s),ref:n,...g,__css:r.root,children:o})})})})});tc.displayName="Tabs";var nc=Oe(function(t,n){const r=JV({...t,ref:n}),s={display:"flex",...Fg().tablist};return a.jsx(Ee.div,{...r,className:jt("chakra-tabs__tablist",t.className),__css:s})});nc.displayName="TabList";var Ho=Oe(function(t,n){const r=rU({...t,ref:n}),o=Fg();return a.jsx(Ee.div,{outline:"0",...r,className:jt("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});Ho.displayName="TabPanel";var zu=Oe(function(t,n){const r=nU(t),o=Fg();return a.jsx(Ee.div,{...r,width:"100%",ref:n,className:jt("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});zu.displayName="TabPanels";var xo=Oe(function(t,n){const r=Fg(),o=ZV({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return a.jsx(Ee.button,{...o,className:jt("chakra-tabs__tab",t.className),__css:s})});xo.displayName="Tab";function sU(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var aU=["h","minH","height","minHeight"],G3=Oe((e,t)=>{const n=ll("Textarea",e),{className:r,rows:o,...s}=ar(e),i=Qx(s),c=o?sU(n,aU):n;return a.jsx(Ee.textarea,{ref:t,rows:o,...i,className:jt("chakra-textarea",r),__css:c})});G3.displayName="Textarea";var iU={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]}}}},Sb=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},Mh=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function lU(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:i=o,closeOnEsc:c=!0,onOpen:d,onClose:p,placement:h,id:m,isOpen:g,defaultIsOpen:b,arrowSize:y=10,arrowShadowColor:x,arrowPadding:C,modifiers:S,isDisabled:j,gutter:_,offset:I,direction:P,...M}=e,{isOpen:R,onOpen:A,onClose:D}=wy({isOpen:g,defaultIsOpen:b,onOpen:d,onClose:p}),{referenceRef:O,getPopperProps:T,getArrowInnerProps:Y,getArrowProps:z}=Cy({enabled:R,placement:h,arrowPadding:C,modifiers:S,gutter:_,offset:I,direction:P}),W=l.useId(),U=`tooltip-${m??W}`,L=l.useRef(null),ee=l.useRef(),K=l.useCallback(()=>{ee.current&&(clearTimeout(ee.current),ee.current=void 0)},[]),Z=l.useRef(),se=l.useCallback(()=>{Z.current&&(clearTimeout(Z.current),Z.current=void 0)},[]),fe=l.useCallback(()=>{se(),D()},[D,se]),G=cU(L,fe),te=l.useCallback(()=>{if(!j&&!ee.current){R&&G();const le=Mh(L);ee.current=le.setTimeout(A,t)}},[G,j,R,A,t]),V=l.useCallback(()=>{K();const le=Mh(L);Z.current=le.setTimeout(fe,n)},[n,fe,K]),F=l.useCallback(()=>{R&&r&&V()},[r,V,R]),X=l.useCallback(()=>{R&&i&&V()},[i,V,R]),ue=l.useCallback(le=>{R&&le.key==="Escape"&&V()},[R,V]);Tl(()=>Sb(L),"keydown",c?ue:void 0),Tl(()=>{const le=L.current;if(!le)return null;const we=A5(le);return we.localName==="body"?Mh(L):we},"scroll",()=>{R&&s&&fe()},{passive:!0,capture:!0}),l.useEffect(()=>{j&&(K(),R&&D())},[j,R,D,K]),l.useEffect(()=>()=>{K(),se()},[K,se]),Tl(()=>L.current,"pointerleave",V);const q=l.useCallback((le={},we=null)=>({...le,ref:gn(L,we,O),onPointerEnter:rt(le.onPointerEnter,he=>{he.pointerType!=="touch"&&te()}),onClick:rt(le.onClick,F),onPointerDown:rt(le.onPointerDown,X),onFocus:rt(le.onFocus,te),onBlur:rt(le.onBlur,V),"aria-describedby":R?U:void 0}),[te,V,X,R,U,F,O]),ne=l.useCallback((le={},we=null)=>T({...le,style:{...le.style,[Fr.arrowSize.var]:y?`${y}px`:void 0,[Fr.arrowShadowColor.var]:x}},we),[T,y,x]),pe=l.useCallback((le={},we=null)=>{const ve={...le.style,position:"relative",transformOrigin:Fr.transformOrigin.varRef};return{ref:we,...M,...le,id:U,role:"tooltip",style:ve}},[M,U]);return{isOpen:R,show:te,hide:V,getTriggerProps:q,getTooltipProps:pe,getTooltipPositionerProps:ne,getArrowProps:z,getArrowInnerProps:Y}}var Jv="chakra-ui:close-tooltip";function cU(e,t){return l.useEffect(()=>{const n=Sb(e);return n.addEventListener(Jv,t),()=>n.removeEventListener(Jv,t)},[t,e]),()=>{const n=Sb(e),r=Mh(e);n.dispatchEvent(new r.CustomEvent(Jv))}}function uU(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function dU(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var fU=Ee(Or.div),Fn=Oe((e,t)=>{var n,r;const o=ll("Tooltip",e),s=ar(e),i=mf(),{children:c,label:d,shouldWrapChildren:p,"aria-label":h,hasArrow:m,bg:g,portalProps:b,background:y,backgroundColor:x,bgColor:C,motionProps:S,...j}=s,_=(r=(n=y??x)!=null?n:g)!=null?r:C;if(_){o.bg=_;const T=lD(i,"colors",_);o[Fr.arrowBg.var]=T}const I=lU({...j,direction:i.direction}),P=typeof c=="string"||p;let M;if(P)M=a.jsx(Ee.span,{display:"inline-block",tabIndex:0,...I.getTriggerProps(),children:c});else{const T=l.Children.only(c);M=l.cloneElement(T,I.getTriggerProps(T.props,T.ref))}const R=!!h,A=I.getTooltipProps({},t),D=R?uU(A,["role","id"]):A,O=dU(A,["role","id"]);return d?a.jsxs(a.Fragment,{children:[M,a.jsx(yo,{children:I.isOpen&&a.jsx(Ru,{...b,children:a.jsx(Ee.div,{...I.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:a.jsxs(fU,{variants:iU,initial:"exit",animate:"enter",exit:"exit",...S,...D,__css:o,children:[d,R&&a.jsx(Ee.span,{srOnly:!0,...O,children:h}),m&&a.jsx(Ee.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:a.jsx(Ee.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):a.jsx(a.Fragment,{children:c})});Fn.displayName="Tooltip";function Bg(e,t={}){let n=l.useCallback(o=>t.keys?I$(e,t.keys,o):e.listen(o),[t.keys,e]),r=e.get.bind(e);return l.useSyncExternalStore(n,r,r)}const pU=de(Ce,({system:e})=>{const{consoleLogLevel:t,shouldLogToConsole:n}=e;return{consoleLogLevel:t,shouldLogToConsole:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),q3=e=>{const{consoleLogLevel:t,shouldLogToConsole:n}=H(pU);return l.useEffect(()=>{n?(localStorage.setItem("ROARR_LOG","true"),localStorage.setItem("ROARR_FILTER",`context.logLevel:>=${cD[t]}`)):localStorage.setItem("ROARR_LOG","false"),Ow.ROARR.write=uD.createLogWriter()},[t,n]),l.useEffect(()=>{const o={...dD};fD.set(Ow.Roarr.child(o))},[]),l.useMemo(()=>Ci(e),[e])};var hU=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 Lf(e,t){var n=mU(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 mU(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=hU.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var gU=[".DS_Store","Thumbs.db"];function vU(e){return Tu(this,void 0,void 0,function(){return Nu(this,function(t){return tm(e)&&bU(e.dataTransfer)?[2,wU(e.dataTransfer,e.type)]:xU(e)?[2,yU(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,CU(e)]:[2,[]]})})}function bU(e){return tm(e)}function xU(e){return tm(e)&&tm(e.target)}function tm(e){return typeof e=="object"&&e!==null}function yU(e){return kb(e.target.files).map(function(t){return Lf(t)})}function CU(e){return Tu(this,void 0,void 0,function(){var t;return Nu(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 Lf(r)})]}})})}function wU(e,t){return Tu(this,void 0,void 0,function(){var n,r;return Nu(this,function(o){switch(o.label){case 0:return e.items?(n=kb(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(SU))]):[3,2];case 1:return r=o.sent(),[2,ck(K3(r))];case 2:return[2,ck(kb(e.files).map(function(s){return Lf(s)}))]}})})}function ck(e){return e.filter(function(t){return gU.indexOf(t.name)===-1})}function kb(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,hk(n)];if(e.sizen)return[!1,hk(n)]}return[!0,null]}function El(e){return e!=null}function zU(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,i=e.maxFiles,c=e.validator;return!s&&t.length>1||s&&i>=1&&t.length>i?!1:t.every(function(d){var p=J3(d,n),h=Jd(p,1),m=h[0],g=Z3(d,r,o),b=Jd(g,1),y=b[0],x=c?c(d):null;return m&&y&&!x})}function nm(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Gp(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 gk(e){e.preventDefault()}function FU(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function BU(e){return e.indexOf("Edge/")!==-1}function HU(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return FU(e)||BU(e)}function ba(){for(var e=arguments.length,t=new Array(e),n=0;n1?o-1:0),i=1;ie.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 sG(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 My=l.forwardRef(function(e,t){var n=e.children,r=rm(e,KU),o=Oy(r),s=o.open,i=rm(o,QU);return l.useImperativeHandle(t,function(){return{open:s}},[s]),B.createElement(l.Fragment,null,n(wr(wr({},i),{},{open:s})))});My.displayName="Dropzone";var r6={disabled:!1,getFilesFromEvent:vU,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};My.defaultProps=r6;My.propTypes={children:Jn.func,accept:Jn.objectOf(Jn.arrayOf(Jn.string)),multiple:Jn.bool,preventDropOnDocument:Jn.bool,noClick:Jn.bool,noKeyboard:Jn.bool,noDrag:Jn.bool,noDragEventsBubbling:Jn.bool,minSize:Jn.number,maxSize:Jn.number,maxFiles:Jn.number,disabled:Jn.bool,getFilesFromEvent:Jn.func,onFileDialogCancel:Jn.func,onFileDialogOpen:Jn.func,useFsAccessApi:Jn.bool,autoFocus:Jn.bool,onDragEnter:Jn.func,onDragLeave:Jn.func,onDragOver:Jn.func,onDrop:Jn.func,onDropAccepted:Jn.func,onDropRejected:Jn.func,onError:Jn.func,validator:Jn.func};var Pb={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Oy(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=wr(wr({},r6),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,i=t.minSize,c=t.multiple,d=t.maxFiles,p=t.onDragEnter,h=t.onDragLeave,m=t.onDragOver,g=t.onDrop,b=t.onDropAccepted,y=t.onDropRejected,x=t.onFileDialogCancel,C=t.onFileDialogOpen,S=t.useFsAccessApi,j=t.autoFocus,_=t.preventDropOnDocument,I=t.noClick,P=t.noKeyboard,M=t.noDrag,R=t.noDragEventsBubbling,A=t.onError,D=t.validator,O=l.useMemo(function(){return UU(n)},[n]),T=l.useMemo(function(){return VU(n)},[n]),Y=l.useMemo(function(){return typeof C=="function"?C:bk},[C]),z=l.useMemo(function(){return typeof x=="function"?x:bk},[x]),W=l.useRef(null),Q=l.useRef(null),U=l.useReducer(aG,Pb),L=Zv(U,2),ee=L[0],K=L[1],Z=ee.isFocused,se=ee.isFileDialogActive,fe=l.useRef(typeof window<"u"&&window.isSecureContext&&S&&WU()),G=function(){!fe.current&&se&&setTimeout(function(){if(Q.current){var Be=Q.current.files;Be.length||(K({type:"closeDialog"}),z())}},300)};l.useEffect(function(){return window.addEventListener("focus",G,!1),function(){window.removeEventListener("focus",G,!1)}},[Q,se,z,fe]);var te=l.useRef([]),V=function(Be){W.current&&W.current.contains(Be.target)||(Be.preventDefault(),te.current=[])};l.useEffect(function(){return _&&(document.addEventListener("dragover",gk,!1),document.addEventListener("drop",V,!1)),function(){_&&(document.removeEventListener("dragover",gk),document.removeEventListener("drop",V))}},[W,_]),l.useEffect(function(){return!r&&j&&W.current&&W.current.focus(),function(){}},[W,j,r]);var F=l.useCallback(function(ke){A?A(ke):console.error(ke)},[A]),X=l.useCallback(function(ke){ke.preventDefault(),ke.persist(),ot(ke),te.current=[].concat(JU(te.current),[ke.target]),Gp(ke)&&Promise.resolve(o(ke)).then(function(Be){if(!(nm(ke)&&!R)){var Ot=Be.length,Ht=Ot>0&&zU({files:Be,accept:O,minSize:i,maxSize:s,multiple:c,maxFiles:d,validator:D}),je=Ot>0&&!Ht;K({isDragAccept:Ht,isDragReject:je,isDragActive:!0,type:"setDraggedFiles"}),p&&p(ke)}}).catch(function(Be){return F(Be)})},[o,p,F,R,O,i,s,c,d,D]),ue=l.useCallback(function(ke){ke.preventDefault(),ke.persist(),ot(ke);var Be=Gp(ke);if(Be&&ke.dataTransfer)try{ke.dataTransfer.dropEffect="copy"}catch{}return Be&&m&&m(ke),!1},[m,R]),q=l.useCallback(function(ke){ke.preventDefault(),ke.persist(),ot(ke);var Be=te.current.filter(function(Ht){return W.current&&W.current.contains(Ht)}),Ot=Be.indexOf(ke.target);Ot!==-1&&Be.splice(Ot,1),te.current=Be,!(Be.length>0)&&(K({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Gp(ke)&&h&&h(ke))},[W,h,R]),ne=l.useCallback(function(ke,Be){var Ot=[],Ht=[];ke.forEach(function(je){var ht=J3(je,O),At=Zv(ht,2),_t=At[0],Re=At[1],Xe=Z3(je,i,s),_n=Zv(Xe,2),Me=_n[0],Ze=_n[1],Ye=D?D(je):null;if(_t&&Me&&!Ye)Ot.push(je);else{var ut=[Re,Ze];Ye&&(ut=ut.concat(Ye)),Ht.push({file:je,errors:ut.filter(function(Ut){return Ut})})}}),(!c&&Ot.length>1||c&&d>=1&&Ot.length>d)&&(Ot.forEach(function(je){Ht.push({file:je,errors:[LU]})}),Ot.splice(0)),K({acceptedFiles:Ot,fileRejections:Ht,type:"setFiles"}),g&&g(Ot,Ht,Be),Ht.length>0&&y&&y(Ht,Be),Ot.length>0&&b&&b(Ot,Be)},[K,c,O,i,s,d,g,b,y,D]),pe=l.useCallback(function(ke){ke.preventDefault(),ke.persist(),ot(ke),te.current=[],Gp(ke)&&Promise.resolve(o(ke)).then(function(Be){nm(ke)&&!R||ne(Be,ke)}).catch(function(Be){return F(Be)}),K({type:"reset"})},[o,ne,F,R]),le=l.useCallback(function(){if(fe.current){K({type:"openDialog"}),Y();var ke={multiple:c,types:T};window.showOpenFilePicker(ke).then(function(Be){return o(Be)}).then(function(Be){ne(Be,null),K({type:"closeDialog"})}).catch(function(Be){GU(Be)?(z(Be),K({type:"closeDialog"})):qU(Be)?(fe.current=!1,Q.current?(Q.current.value=null,Q.current.click()):F(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."))):F(Be)});return}Q.current&&(K({type:"openDialog"}),Y(),Q.current.value=null,Q.current.click())},[K,Y,z,S,ne,F,T,c]),we=l.useCallback(function(ke){!W.current||!W.current.isEqualNode(ke.target)||(ke.key===" "||ke.key==="Enter"||ke.keyCode===32||ke.keyCode===13)&&(ke.preventDefault(),le())},[W,le]),ve=l.useCallback(function(){K({type:"focus"})},[]),he=l.useCallback(function(){K({type:"blur"})},[]),Ne=l.useCallback(function(){I||(HU()?setTimeout(le,0):le())},[I,le]),De=function(Be){return r?null:Be},qe=function(Be){return P?null:De(Be)},Mt=function(Be){return M?null:De(Be)},ot=function(Be){R&&Be.stopPropagation()},an=l.useMemo(function(){return function(){var ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Be=ke.refKey,Ot=Be===void 0?"ref":Be,Ht=ke.role,je=ke.onKeyDown,ht=ke.onFocus,At=ke.onBlur,_t=ke.onClick,Re=ke.onDragEnter,Xe=ke.onDragOver,_n=ke.onDragLeave,Me=ke.onDrop,Ze=rm(ke,XU);return wr(wr(Ib({onKeyDown:qe(ba(je,we)),onFocus:qe(ba(ht,ve)),onBlur:qe(ba(At,he)),onClick:De(ba(_t,Ne)),onDragEnter:Mt(ba(Re,X)),onDragOver:Mt(ba(Xe,ue)),onDragLeave:Mt(ba(_n,q)),onDrop:Mt(ba(Me,pe)),role:typeof Ht=="string"&&Ht!==""?Ht:"presentation"},Ot,W),!r&&!P?{tabIndex:0}:{}),Ze)}},[W,we,ve,he,Ne,X,ue,q,pe,P,M,r]),pt=l.useCallback(function(ke){ke.stopPropagation()},[]),vt=l.useMemo(function(){return function(){var ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Be=ke.refKey,Ot=Be===void 0?"ref":Be,Ht=ke.onChange,je=ke.onClick,ht=rm(ke,YU),At=Ib({accept:O,multiple:c,type:"file",style:{display:"none"},onChange:De(ba(Ht,pe)),onClick:De(ba(je,pt)),tabIndex:-1},Ot,Q);return wr(wr({},At),ht)}},[Q,n,c,pe,r]);return wr(wr({},ee),{},{isFocused:Z&&!r,getRootProps:an,getInputProps:vt,rootRef:W,inputRef:Q,open:De(le)})}function aG(e,t){switch(t.type){case"focus":return wr(wr({},e),{},{isFocused:!0});case"blur":return wr(wr({},e),{},{isFocused:!1});case"openDialog":return wr(wr({},Pb),{},{isFileDialogActive:!0});case"closeDialog":return wr(wr({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return wr(wr({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return wr(wr({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return wr({},Pb);default:return e}}function bk(){}function Eb(){return Eb=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 pG=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,i=n.mod,c=n.shift,d=n.ctrl,p=n.keys,h=t.key,m=t.code,g=t.ctrlKey,b=t.metaKey,y=t.shiftKey,x=t.altKey,C=Ui(m),S=h.toLowerCase();if(!r){if(o===!x&&S!=="alt"||c===!y&&S!=="shift")return!1;if(i){if(!b&&!g)return!1}else if(s===!b&&S!=="meta"&&S!=="os"||d===!g&&S!=="ctrl"&&S!=="control")return!1}return p&&p.length===1&&(p.includes(S)||p.includes(C))?!0:p?Oh(p):!p},hG=l.createContext(void 0),mG=function(){return l.useContext(hG)};function l6(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&&l6(e[r],t[r])},!0):e===t}var gG=l.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),vG=function(){return l.useContext(gG)};function bG(e){var t=l.useRef(void 0);return l6(t.current,e)||(t.current=e),t.current}var xk=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},xG=typeof window<"u"?l.useLayoutEffect:l.useEffect;function It(e,t,n,r){var o=l.useRef(null),s=l.useRef(!1),i=n instanceof Array?r instanceof Array?void 0:r:n,c=Ry(e)?e.join(i==null?void 0:i.splitKey):e,d=n instanceof Array?n:r instanceof Array?r:void 0,p=l.useCallback(t,d??[]),h=l.useRef(p);d?h.current=p:h.current=t;var m=bG(i),g=vG(),b=g.enabledScopes,y=mG();return xG(function(){if(!((m==null?void 0:m.enabled)===!1||!fG(b,m==null?void 0:m.scopes))){var x=function(I,P){var M;if(P===void 0&&(P=!1),!(dG(I)&&!i6(I,m==null?void 0:m.enableOnFormTags))&&!(m!=null&&m.ignoreEventWhen!=null&&m.ignoreEventWhen(I))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){xk(I);return}(M=I.target)!=null&&M.isContentEditable&&!(m!=null&&m.enableOnContentEditable)||e1(c,m==null?void 0:m.splitKey).forEach(function(R){var A,D=t1(R,m==null?void 0:m.combinationKey);if(pG(I,D,m==null?void 0:m.ignoreModifiers)||(A=D.keys)!=null&&A.includes("*")){if(P&&s.current)return;if(cG(I,D,m==null?void 0:m.preventDefault),!uG(I,D,m==null?void 0:m.enabled)){xk(I);return}h.current(I,D),P||(s.current=!0)}})}},C=function(I){I.key!==void 0&&(s6(Ui(I.code)),((m==null?void 0:m.keydown)===void 0&&(m==null?void 0:m.keyup)!==!0||m!=null&&m.keydown)&&x(I))},S=function(I){I.key!==void 0&&(a6(Ui(I.code)),s.current=!1,m!=null&&m.keyup&&x(I,!0))},j=o.current||(i==null?void 0:i.document)||document;return j.addEventListener("keyup",S),j.addEventListener("keydown",C),y&&e1(c,m==null?void 0:m.splitKey).forEach(function(_){return y.addHotkey(t1(_,m==null?void 0:m.combinationKey,m==null?void 0:m.description))}),function(){j.removeEventListener("keyup",S),j.removeEventListener("keydown",C),y&&e1(c,m==null?void 0:m.splitKey).forEach(function(_){return y.removeHotkey(t1(_,m==null?void 0:m.combinationKey,m==null?void 0:m.description))})}}},[c,m,b]),o}const yG=e=>{const{isDragAccept:t,isDragReject:n,setIsHandlingUpload:r}=e;return It("esc",()=>{r(!1)}),a.jsxs(Te,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:[a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:"base.700",_dark:{bg:"base.900"},opacity:.7,alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"full",height:"full",alignItems:"center",justifyContent:"center",p:4},children:a.jsx(N,{sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",flexDir:"column",gap:4,borderWidth:3,borderRadius:"xl",borderStyle:"dashed",color:"base.100",borderColor:"base.100",_dark:{borderColor:"base.200"}},children:t?a.jsx(vo,{size:"lg",children:"Drop to Upload"}):a.jsxs(a.Fragment,{children:[a.jsx(vo,{size:"lg",children:"Invalid Upload"}),a.jsx(vo,{size:"md",children:"Must be single JPEG or PNG image"})]})})})]})},CG=l.memo(yG),wG=de([Ce,ro],({gallery:e},t)=>{let n={type:"TOAST"};t==="unifiedCanvas"&&(n={type:"SET_CANVAS_INITIAL_IMAGE"}),t==="img2img"&&(n={type:"SET_INITIAL_IMAGE"});const{autoAddBoardId:r}=e;return{autoAddBoardId:r,postUploadAction:n}},_e),SG=e=>{const{children:t}=e,{autoAddBoardId:n,postUploadAction:r}=H(wG),o=Zl(),{t:s}=J(),[i,c]=l.useState(!1),[d]=II(),p=l.useCallback(I=>{c(!0),o({title:s("toast.uploadFailed"),description:I.errors.map(P=>P.message).join(` `),status:"error"})},[s,o]),h=l.useCallback(async I=>{d({file:I,image_category:"user",is_intermediate:!1,postUploadAction:r,board_id:n==="none"?void 0:n})},[n,r,d]),m=l.useCallback((I,P)=>{if(P.length>1){o({title:s("toast.uploadFailed"),description:s("toast.uploadFailedInvalidUploadDesc"),status:"error"});return}P.forEach(M=>{p(M)}),I.forEach(M=>{h(M)})},[s,o,h,p]),g=l.useCallback(()=>{c(!0)},[]),{getRootProps:b,getInputProps:y,isDragAccept:x,isDragReject:C,isDragActive:S,inputRef:j}=Oy({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:m,onDragOver:g,multiple:!1});l.useEffect(()=>{const I=async P=>{var M,R;j.current&&(M=P.clipboardData)!=null&&M.files&&(j.current.files=P.clipboardData.files,(R=j.current)==null||R.dispatchEvent(new Event("change",{bubbles:!0})))};return document.addEventListener("paste",I),()=>{document.removeEventListener("paste",I)}},[j]);const _=l.useCallback(I=>{I.key},[]);return a.jsxs(Te,{...b({style:{}}),onKeyDown:_,children:[a.jsx("input",{...y()}),t,a.jsx(yo,{children:S&&i&&a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(CG,{isDragAccept:x,isDragReject:C,setIsHandlingUpload:c})},"image-upload-overlay")})]})},kG=l.memo(SG),jG=Oe((e,t)=>{const{children:n,tooltip:r="",tooltipProps:{placement:o="top",hasArrow:s=!0,...i}={},isChecked:c,...d}=e;return a.jsx(Fn,{label:r,placement:o,hasArrow:s,...i,children:a.jsx(tl,{ref:t,colorScheme:c?"accent":"base",...d,children:n})})}),Rt=l.memo(jG);function _G(e){const t=l.createContext(null);return[({children:o,value:s})=>B.createElement(t.Provider,{value:s},o),()=>{const o=l.useContext(t);if(o===null)throw new Error(e);return o}]}function c6(e){return Array.isArray(e)?e:[e]}const IG=()=>{};function PG(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||IG:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function u6({data:e}){const t=[],n=[],r=e.reduce((o,s,i)=>(s.group?o[s.group]?o[s.group].push(i):o[s.group]=[i]:n.push(i),o),{});return Object.keys(r).forEach(o=>{t.push(...r[o].map(s=>e[s]))}),t.push(...n.map(o=>e[o])),t}function d6(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==B.Fragment:!1}function f6(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;tr===t[o]).indexOf(!1)>=0)&&(n.current={v:e(),prevDeps:[...t]}),n.current.v}const OG=pD({key:"mantine",prepend:!0});function RG(){return EP()||OG}var AG=Object.defineProperty,yk=Object.getOwnPropertySymbols,DG=Object.prototype.hasOwnProperty,TG=Object.prototype.propertyIsEnumerable,Ck=(e,t,n)=>t in e?AG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,NG=(e,t)=>{for(var n in t||(t={}))DG.call(t,n)&&Ck(e,n,t[n]);if(yk)for(var n of yk(t))TG.call(t,n)&&Ck(e,n,t[n]);return e};const n1="ref";function $G(e){let t;if(e.length!==1)return{args:e,ref:t};const[n]=e;if(!(n instanceof Object))return{args:e,ref:t};if(!(n1 in n))return{args:e,ref:t};t=n[n1];const r=NG({},n);return delete r[n1],{args:[r],ref:t}}const{cssFactory:LG}=(()=>{function e(n,r,o){const s=[],i=gD(n,s,o);return s.length<2?o:i+r(s)}function t(n){const{cache:r}=n,o=(...i)=>{const{ref:c,args:d}=$G(i),p=hD(d,r.registered);return mD(r,p,!1),`${r.key}-${p.name}${c===void 0?"":` ${c}`}`};return{css:o,cx:(...i)=>e(r.registered,o,p6(i))}}return{cssFactory:t}})();function h6(){const e=RG();return MG(()=>LG({cache:e}),[e])}function zG({cx:e,classes:t,context:n,classNames:r,name:o,cache:s}){const i=n.reduce((c,d)=>(Object.keys(d.classNames).forEach(p=>{typeof c[p]!="string"?c[p]=`${d.classNames[p]}`:c[p]=`${c[p]} ${d.classNames[p]}`}),c),{});return Object.keys(t).reduce((c,d)=>(c[d]=e(t[d],i[d],r!=null&&r[d],Array.isArray(o)?o.filter(Boolean).map(p=>`${(s==null?void 0:s.key)||"mantine"}-${p}-${d}`).join(" "):o?`${(s==null?void 0:s.key)||"mantine"}-${o}-${d}`:null),c),{})}var FG=Object.defineProperty,wk=Object.getOwnPropertySymbols,BG=Object.prototype.hasOwnProperty,HG=Object.prototype.propertyIsEnumerable,Sk=(e,t,n)=>t in e?FG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,r1=(e,t)=>{for(var n in t||(t={}))BG.call(t,n)&&Sk(e,n,t[n]);if(wk)for(var n of wk(t))HG.call(t,n)&&Sk(e,n,t[n]);return e};function Mb(e,t){return t&&Object.keys(t).forEach(n=>{e[n]?e[n]=r1(r1({},e[n]),t[n]):e[n]=r1({},t[n])}),e}function kk(e,t,n,r){const o=s=>typeof s=="function"?s(t,n||{},r):s||{};return Array.isArray(e)?e.map(s=>o(s.styles)).reduce((s,i)=>Mb(s,i),{}):o(e)}function WG({ctx:e,theme:t,params:n,variant:r,size:o}){return e.reduce((s,i)=>(i.variants&&r in i.variants&&Mb(s,i.variants[r](t,n,{variant:r,size:o})),i.sizes&&o in i.sizes&&Mb(s,i.sizes[o](t,n,{variant:r,size:o})),s),{})}function Co(e){const t=typeof e=="function"?e:()=>e;function n(r,o){const s=ki(),i=c$(o==null?void 0:o.name),c=EP(),d={variant:o==null?void 0:o.variant,size:o==null?void 0:o.size},{css:p,cx:h}=h6(),m=t(s,r,d),g=kk(o==null?void 0:o.styles,s,r,d),b=kk(i,s,r,d),y=WG({ctx:i,theme:s,params:r,variant:o==null?void 0:o.variant,size:o==null?void 0:o.size}),x=Object.fromEntries(Object.keys(m).map(C=>{const S=h({[p(m[C])]:!(o!=null&&o.unstyled)},p(y[C]),p(b[C]),p(g[C]));return[C,S]}));return{classes:zG({cx:h,classes:x,context:i,classNames:o==null?void 0:o.classNames,name:o==null?void 0:o.name,cache:c}),cx:h,theme:s}}return n}function jk(e){return`___ref-${e||""}`}var VG=Object.defineProperty,UG=Object.defineProperties,GG=Object.getOwnPropertyDescriptors,_k=Object.getOwnPropertySymbols,qG=Object.prototype.hasOwnProperty,KG=Object.prototype.propertyIsEnumerable,Ik=(e,t,n)=>t in e?VG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vd=(e,t)=>{for(var n in t||(t={}))qG.call(t,n)&&Ik(e,n,t[n]);if(_k)for(var n of _k(t))KG.call(t,n)&&Ik(e,n,t[n]);return e},bd=(e,t)=>UG(e,GG(t));const xd={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${Ge(10)})`},transitionProperty:"transform, opacity"},qp={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(-${Ge(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(${Ge(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Ge(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Ge(20)}) rotate(5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:bd(vd({},xd),{common:{transformOrigin:"center center"}}),"pop-bottom-left":bd(vd({},xd),{common:{transformOrigin:"bottom left"}}),"pop-bottom-right":bd(vd({},xd),{common:{transformOrigin:"bottom right"}}),"pop-top-left":bd(vd({},xd),{common:{transformOrigin:"top left"}}),"pop-top-right":bd(vd({},xd),{common:{transformOrigin:"top right"}})},Pk=["mousedown","touchstart"];function QG(e,t,n){const r=l.useRef();return l.useEffect(()=>{const o=s=>{const{target:i}=s??{};if(Array.isArray(n)){const c=(i==null?void 0:i.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(i)&&i.tagName!=="HTML";n.every(p=>!!p&&!s.composedPath().includes(p))&&!c&&e()}else r.current&&!r.current.contains(i)&&e()};return(t||Pk).forEach(s=>document.addEventListener(s,o)),()=>{(t||Pk).forEach(s=>document.removeEventListener(s,o))}},[r,e,n]),r}function XG(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function YG(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function JG(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=l.useState(n?t:YG(e,t)),s=l.useRef();return l.useEffect(()=>{if("matchMedia"in window)return s.current=window.matchMedia(e),o(s.current.matches),XG(s.current,i=>o(i.matches))},[e]),r}const m6=typeof document<"u"?l.useLayoutEffect:l.useEffect;function Js(e,t){const n=l.useRef(!1);l.useEffect(()=>()=>{n.current=!1},[]),l.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function ZG({opened:e,shouldReturnFocus:t=!0}){const n=l.useRef(),r=()=>{var o;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((o=n.current)==null||o.focus({preventScroll:!0}))};return Js(()=>{let o=-1;const s=i=>{i.key==="Tab"&&window.clearTimeout(o)};return document.addEventListener("keydown",s),e?n.current=document.activeElement:t&&(o=window.setTimeout(r,10)),()=>{window.clearTimeout(o),document.removeEventListener("keydown",s)}},[e,t]),r}const eq=/input|select|textarea|button|object/,g6="a, input, select, textarea, button, object, [tabindex]";function tq(e){return e.style.display==="none"}function nq(e){if(e.getAttribute("aria-hidden")||e.getAttribute("hidden")||e.getAttribute("type")==="hidden")return!1;let n=e;for(;n&&!(n===document.body||n.nodeType===11);){if(tq(n))return!1;n=n.parentNode}return!0}function v6(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function Ob(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(v6(e));return(eq.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&nq(e)}function b6(e){const t=v6(e);return(Number.isNaN(t)||t>=0)&&Ob(e)}function rq(e){return Array.from(e.querySelectorAll(g6)).filter(b6)}function oq(e,t){const n=rq(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],o=e.getRootNode();if(!(r===o.activeElement||e===o.activeElement))return;t.preventDefault();const i=n[t.shiftKey?n.length-1:0];i&&i.focus()}function Dy(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function sq(e,t="body > :not(script)"){const n=Dy(),r=Array.from(document.querySelectorAll(t)).map(o=>{var s;if((s=o==null?void 0:o.shadowRoot)!=null&&s.contains(e)||o.contains(e))return;const i=o.getAttribute("aria-hidden"),c=o.getAttribute("data-hidden"),d=o.getAttribute("data-focus-id");return o.setAttribute("data-focus-id",n),i===null||i==="false"?o.setAttribute("aria-hidden","true"):!c&&!d&&o.setAttribute("data-hidden",i),{node:o,ariaHidden:c||null}});return()=>{r.forEach(o=>{!o||n!==o.node.getAttribute("data-focus-id")||(o.ariaHidden===null?o.node.removeAttribute("aria-hidden"):o.node.setAttribute("aria-hidden",o.ariaHidden),o.node.removeAttribute("data-focus-id"),o.node.removeAttribute("data-hidden"))})}}function aq(e=!0){const t=l.useRef(),n=l.useRef(null),r=s=>{let i=s.querySelector("[data-autofocus]");if(!i){const c=Array.from(s.querySelectorAll(g6));i=c.find(b6)||c.find(Ob)||null,!i&&Ob(s)&&(i=s)}i&&i.focus({preventScroll:!0})},o=l.useCallback(s=>{if(e){if(s===null){n.current&&(n.current(),n.current=null);return}n.current=sq(s),t.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&r(s)}),t.current=s):t.current=null)}},[e]);return l.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const s=i=>{i.key==="Tab"&&t.current&&oq(t.current,i)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),n.current&&n.current()}},[e]),o}const iq=B["useId".toString()]||(()=>{});function lq(){const e=iq();return e?`mantine-${e.replace(/:/g,"")}`:""}function Ty(e){const t=lq(),[n,r]=l.useState(t);return m6(()=>{r(Dy())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function Ek(e,t,n){l.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function x6(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function cq(...e){return t=>{e.forEach(n=>x6(n,t))}}function zf(...e){return l.useCallback(cq(...e),e)}function Zd({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=l.useState(t!==void 0?t:n),i=c=>{s(c),r==null||r(c)};return e!==void 0?[e,r,!0]:[o,i,!1]}function y6(e,t){return JG("(prefers-reduced-motion: reduce)",e,t)}const uq=e=>e<.5?2*e*e:-1+(4-2*e)*e,dq=({axis:e,target:t,parent:n,alignment:r,offset:o,isList:s})=>{if(!t||!n&&typeof document>"u")return 0;const i=!!n,d=(n||document.body).getBoundingClientRect(),p=t.getBoundingClientRect(),h=m=>p[m]-d[m];if(e==="y"){const m=h("top");if(m===0)return 0;if(r==="start"){const b=m-o;return b<=p.height*(s?0:1)||!s?b:0}const g=i?d.height:window.innerHeight;if(r==="end"){const b=m+o-g+p.height;return b>=-p.height*(s?0:1)||!s?b:0}return r==="center"?m-g/2+p.height/2:0}if(e==="x"){const m=h("left");if(m===0)return 0;if(r==="start"){const b=m-o;return b<=p.width||!s?b:0}const g=i?d.width:window.innerWidth;if(r==="end"){const b=m+o-g+p.width;return b>=-p.width||!s?b:0}return r==="center"?m-g/2+p.width/2:0}return 0},fq=({axis:e,parent:t})=>{if(!t&&typeof document>"u")return 0;const n=e==="y"?"scrollTop":"scrollLeft";if(t)return t[n];const{body:r,documentElement:o}=document;return r[n]+o[n]},pq=({axis:e,parent:t,distance:n})=>{if(!t&&typeof document>"u")return;const r=e==="y"?"scrollTop":"scrollLeft";if(t)t[r]=n;else{const{body:o,documentElement:s}=document;o[r]=n,s[r]=n}};function C6({duration:e=1250,axis:t="y",onScrollFinish:n,easing:r=uq,offset:o=0,cancelable:s=!0,isList:i=!1}={}){const c=l.useRef(0),d=l.useRef(0),p=l.useRef(!1),h=l.useRef(null),m=l.useRef(null),g=y6(),b=()=>{c.current&&cancelAnimationFrame(c.current)},y=l.useCallback(({alignment:C="start"}={})=>{var S;p.current=!1,c.current&&b();const j=(S=fq({parent:h.current,axis:t}))!=null?S:0,_=dq({parent:h.current,target:m.current,axis:t,alignment:C,offset:o,isList:i})-(h.current?0:j);function I(){d.current===0&&(d.current=performance.now());const M=performance.now()-d.current,R=g||e===0?1:M/e,A=j+_*r(R);pq({parent:h.current,axis:t,distance:A}),!p.current&&R<1?c.current=requestAnimationFrame(I):(typeof n=="function"&&n(),d.current=0,c.current=0,b())}I()},[t,e,r,i,o,n,g]),x=()=>{s&&(p.current=!0)};return Ek("wheel",x,{passive:!0}),Ek("touchmove",x,{passive:!0}),l.useEffect(()=>b,[]),{scrollableRef:h,targetRef:m,scrollIntoView:y,cancel:b}}var Mk=Object.getOwnPropertySymbols,hq=Object.prototype.hasOwnProperty,mq=Object.prototype.propertyIsEnumerable,gq=(e,t)=>{var n={};for(var r in e)hq.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mk)for(var r of Mk(e))t.indexOf(r)<0&&mq.call(e,r)&&(n[r]=e[r]);return n};function Hg(e){const t=e,{m:n,mx:r,my:o,mt:s,mb:i,ml:c,mr:d,p,px:h,py:m,pt:g,pb:b,pl:y,pr:x,bg:C,c:S,opacity:j,ff:_,fz:I,fw:P,lts:M,ta:R,lh:A,fs:D,tt:O,td:T,w:Y,miw:z,maw:W,h:Q,mih:U,mah:L,bgsz:ee,bgp:K,bgr:Z,bga:se,pos:fe,top:G,left:te,bottom:V,right:F,inset:X,display:ue}=t,q=gq(t,["m","mx","my","mt","mb","ml","mr","p","px","py","pt","pb","pl","pr","bg","c","opacity","ff","fz","fw","lts","ta","lh","fs","tt","td","w","miw","maw","h","mih","mah","bgsz","bgp","bgr","bga","pos","top","left","bottom","right","inset","display"]);return{systemStyles:u$({m:n,mx:r,my:o,mt:s,mb:i,ml:c,mr:d,p,px:h,py:m,pt:g,pb:b,pl:y,pr:x,bg:C,c:S,opacity:j,ff:_,fz:I,fw:P,lts:M,ta:R,lh:A,fs:D,tt:O,td:T,w:Y,miw:z,maw:W,h:Q,mih:U,mah:L,bgsz:ee,bgp:K,bgr:Z,bga:se,pos:fe,top:G,left:te,bottom:V,right:F,inset:X,display:ue}),rest:q}}function vq(e,t){const n=Object.keys(e).filter(r=>r!=="base").sort((r,o)=>yS(Xt({size:r,sizes:t.breakpoints}))-yS(Xt({size:o,sizes:t.breakpoints})));return"base"in e?["base",...n]:n}function bq({value:e,theme:t,getValue:n,property:r}){if(e==null)return;if(typeof e=="object")return vq(e,t).reduce((i,c)=>{if(c==="base"&&e.base!==void 0){const p=n(e.base,t);return Array.isArray(r)?(r.forEach(h=>{i[h]=p}),i):(i[r]=p,i)}const d=n(e[c],t);return Array.isArray(r)?(i[t.fn.largerThan(c)]={},r.forEach(p=>{i[t.fn.largerThan(c)][p]=d}),i):(i[t.fn.largerThan(c)]={[r]:d},i)},{});const o=n(e,t);return Array.isArray(r)?r.reduce((s,i)=>(s[i]=o,s),{}):{[r]:o}}function xq(e,t){return e==="dimmed"?t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]:t.fn.variant({variant:"filled",color:e,primaryFallback:!1}).background}function yq(e){return Ge(e)}function Cq(e){return e}function wq(e,t){return Xt({size:e,sizes:t.fontSizes})}const Sq=["-xs","-sm","-md","-lg","-xl"];function kq(e,t){return Sq.includes(e)?`calc(${Xt({size:e.replace("-",""),sizes:t.spacing})} * -1)`:Xt({size:e,sizes:t.spacing})}const jq={identity:Cq,color:xq,size:yq,fontSize:wq,spacing:kq},_q={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},mx:{type:"spacing",property:["marginRight","marginLeft"]},my:{type:"spacing",property:["marginTop","marginBottom"]},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},px:{type:"spacing",property:["paddingRight","paddingLeft"]},py:{type:"spacing",property:["paddingTop","paddingBottom"]},bg:{type:"color",property:"background"},c:{type:"color",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"identity",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"identity",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"identity",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"}};var Iq=Object.defineProperty,Ok=Object.getOwnPropertySymbols,Pq=Object.prototype.hasOwnProperty,Eq=Object.prototype.propertyIsEnumerable,Rk=(e,t,n)=>t in e?Iq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ak=(e,t)=>{for(var n in t||(t={}))Pq.call(t,n)&&Rk(e,n,t[n]);if(Ok)for(var n of Ok(t))Eq.call(t,n)&&Rk(e,n,t[n]);return e};function Dk(e,t,n=_q){return Object.keys(n).reduce((o,s)=>(s in e&&e[s]!==void 0&&o.push(bq({value:e[s],getValue:jq[n[s].type],property:n[s].property,theme:t})),o),[]).reduce((o,s)=>(Object.keys(s).forEach(i=>{typeof s[i]=="object"&&s[i]!==null&&i in o?o[i]=Ak(Ak({},o[i]),s[i]):o[i]=s[i]}),o),{})}function Tk(e,t){return typeof e=="function"?e(t):e}function Mq(e,t,n){const r=ki(),{css:o,cx:s}=h6();return Array.isArray(e)?s(n,o(Dk(t,r)),e.map(i=>o(Tk(i,r)))):s(n,o(Tk(e,r)),o(Dk(t,r)))}var Oq=Object.defineProperty,om=Object.getOwnPropertySymbols,w6=Object.prototype.hasOwnProperty,S6=Object.prototype.propertyIsEnumerable,Nk=(e,t,n)=>t in e?Oq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rq=(e,t)=>{for(var n in t||(t={}))w6.call(t,n)&&Nk(e,n,t[n]);if(om)for(var n of om(t))S6.call(t,n)&&Nk(e,n,t[n]);return e},Aq=(e,t)=>{var n={};for(var r in e)w6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&om)for(var r of om(e))t.indexOf(r)<0&&S6.call(e,r)&&(n[r]=e[r]);return n};const k6=l.forwardRef((e,t)=>{var n=e,{className:r,component:o,style:s,sx:i}=n,c=Aq(n,["className","component","style","sx"]);const{systemStyles:d,rest:p}=Hg(c),h=o||"div";return B.createElement(h,Rq({ref:t,className:Mq(i,d,r),style:s},p))});k6.displayName="@mantine/core/Box";const Go=k6;var Dq=Object.defineProperty,Tq=Object.defineProperties,Nq=Object.getOwnPropertyDescriptors,$k=Object.getOwnPropertySymbols,$q=Object.prototype.hasOwnProperty,Lq=Object.prototype.propertyIsEnumerable,Lk=(e,t,n)=>t in e?Dq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zk=(e,t)=>{for(var n in t||(t={}))$q.call(t,n)&&Lk(e,n,t[n]);if($k)for(var n of $k(t))Lq.call(t,n)&&Lk(e,n,t[n]);return e},zq=(e,t)=>Tq(e,Nq(t)),Fq=Co(e=>({root:zq(zk(zk({},e.fn.focusStyles()),e.fn.fontStyles()),{cursor:"pointer",border:0,padding:0,appearance:"none",fontSize:e.fontSizes.md,backgroundColor:"transparent",textAlign:"left",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,textDecoration:"none",boxSizing:"border-box"})}));const Bq=Fq;var Hq=Object.defineProperty,sm=Object.getOwnPropertySymbols,j6=Object.prototype.hasOwnProperty,_6=Object.prototype.propertyIsEnumerable,Fk=(e,t,n)=>t in e?Hq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wq=(e,t)=>{for(var n in t||(t={}))j6.call(t,n)&&Fk(e,n,t[n]);if(sm)for(var n of sm(t))_6.call(t,n)&&Fk(e,n,t[n]);return e},Vq=(e,t)=>{var n={};for(var r in e)j6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&sm)for(var r of sm(e))t.indexOf(r)<0&&_6.call(e,r)&&(n[r]=e[r]);return n};const I6=l.forwardRef((e,t)=>{const n=Nr("UnstyledButton",{},e),{className:r,component:o="button",unstyled:s,variant:i}=n,c=Vq(n,["className","component","unstyled","variant"]),{classes:d,cx:p}=Bq(null,{name:"UnstyledButton",unstyled:s,variant:i});return B.createElement(Go,Wq({component:o,ref:t,className:p(d.root,r),type:o==="button"?"button":void 0},c))});I6.displayName="@mantine/core/UnstyledButton";const Uq=I6;var Gq=Object.defineProperty,qq=Object.defineProperties,Kq=Object.getOwnPropertyDescriptors,Bk=Object.getOwnPropertySymbols,Qq=Object.prototype.hasOwnProperty,Xq=Object.prototype.propertyIsEnumerable,Hk=(e,t,n)=>t in e?Gq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rb=(e,t)=>{for(var n in t||(t={}))Qq.call(t,n)&&Hk(e,n,t[n]);if(Bk)for(var n of Bk(t))Xq.call(t,n)&&Hk(e,n,t[n]);return e},Wk=(e,t)=>qq(e,Kq(t));const Yq=["subtle","filled","outline","light","default","transparent","gradient"],Kp={xs:Ge(18),sm:Ge(22),md:Ge(28),lg:Ge(34),xl:Ge(44)};function Jq({variant:e,theme:t,color:n,gradient:r}){const o=t.fn.variant({color:n,variant:e,gradient:r});return e==="gradient"?{border:0,backgroundImage:o.background,color:o.color,"&:hover":t.fn.hover({backgroundSize:"200%"})}:Yq.includes(e)?Rb({border:`${Ge(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover})):null}var Zq=Co((e,{radius:t,color:n,gradient:r},{variant:o,size:s})=>({root:Wk(Rb({position:"relative",borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",height:Xt({size:s,sizes:Kp}),minHeight:Xt({size:s,sizes:Kp}),width:Xt({size:s,sizes:Kp}),minWidth:Xt({size:s,sizes:Kp})},Jq({variant:o,theme:e,color:n,gradient:r})),{"&:active":e.activeStyles,"& [data-action-icon-loader]":{maxWidth:"70%"},"&:disabled, &[data-disabled]":{color:e.colors.gray[e.colorScheme==="dark"?6:4],cursor:"not-allowed",backgroundColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),borderColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),backgroundImage:"none",pointerEvents:"none","&:active":{transform:"none"}},"&[data-loading]":{pointerEvents:"none","&::before":Wk(Rb({content:'""'},e.fn.cover(Ge(-1))),{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[7],.5):"rgba(255, 255, 255, .5)",borderRadius:e.fn.radius(t),cursor:"not-allowed"})}})}));const eK=Zq;var tK=Object.defineProperty,am=Object.getOwnPropertySymbols,P6=Object.prototype.hasOwnProperty,E6=Object.prototype.propertyIsEnumerable,Vk=(e,t,n)=>t in e?tK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Uk=(e,t)=>{for(var n in t||(t={}))P6.call(t,n)&&Vk(e,n,t[n]);if(am)for(var n of am(t))E6.call(t,n)&&Vk(e,n,t[n]);return e},Gk=(e,t)=>{var n={};for(var r in e)P6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&am)for(var r of am(e))t.indexOf(r)<0&&E6.call(e,r)&&(n[r]=e[r]);return n};function nK(e){var t=e,{size:n,color:r}=t,o=Gk(t,["size","color"]);const s=o,{style:i}=s,c=Gk(s,["style"]);return B.createElement("svg",Uk({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:r,style:Uk({width:n},i)},c),B.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},B.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),B.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},B.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),B.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},B.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),B.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},B.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),B.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},B.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})))}var rK=Object.defineProperty,im=Object.getOwnPropertySymbols,M6=Object.prototype.hasOwnProperty,O6=Object.prototype.propertyIsEnumerable,qk=(e,t,n)=>t in e?rK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kk=(e,t)=>{for(var n in t||(t={}))M6.call(t,n)&&qk(e,n,t[n]);if(im)for(var n of im(t))O6.call(t,n)&&qk(e,n,t[n]);return e},Qk=(e,t)=>{var n={};for(var r in e)M6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&im)for(var r of im(e))t.indexOf(r)<0&&O6.call(e,r)&&(n[r]=e[r]);return n};function oK(e){var t=e,{size:n,color:r}=t,o=Qk(t,["size","color"]);const s=o,{style:i}=s,c=Qk(s,["style"]);return B.createElement("svg",Kk({viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:r,style:Kk({width:n,height:n},i)},c),B.createElement("g",{fill:"none",fillRule:"evenodd"},B.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},B.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),B.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},B.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}var sK=Object.defineProperty,lm=Object.getOwnPropertySymbols,R6=Object.prototype.hasOwnProperty,A6=Object.prototype.propertyIsEnumerable,Xk=(e,t,n)=>t in e?sK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yk=(e,t)=>{for(var n in t||(t={}))R6.call(t,n)&&Xk(e,n,t[n]);if(lm)for(var n of lm(t))A6.call(t,n)&&Xk(e,n,t[n]);return e},Jk=(e,t)=>{var n={};for(var r in e)R6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&lm)for(var r of lm(e))t.indexOf(r)<0&&A6.call(e,r)&&(n[r]=e[r]);return n};function aK(e){var t=e,{size:n,color:r}=t,o=Jk(t,["size","color"]);const s=o,{style:i}=s,c=Jk(s,["style"]);return B.createElement("svg",Yk({viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:r,style:Yk({width:n},i)},c),B.createElement("circle",{cx:"15",cy:"15",r:"15"},B.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),B.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},B.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),B.createElement("circle",{cx:"105",cy:"15",r:"15"},B.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var iK=Object.defineProperty,cm=Object.getOwnPropertySymbols,D6=Object.prototype.hasOwnProperty,T6=Object.prototype.propertyIsEnumerable,Zk=(e,t,n)=>t in e?iK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lK=(e,t)=>{for(var n in t||(t={}))D6.call(t,n)&&Zk(e,n,t[n]);if(cm)for(var n of cm(t))T6.call(t,n)&&Zk(e,n,t[n]);return e},cK=(e,t)=>{var n={};for(var r in e)D6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&cm)for(var r of cm(e))t.indexOf(r)<0&&T6.call(e,r)&&(n[r]=e[r]);return n};const o1={bars:nK,oval:oK,dots:aK},uK={xs:Ge(18),sm:Ge(22),md:Ge(36),lg:Ge(44),xl:Ge(58)},dK={size:"md"};function N6(e){const t=Nr("Loader",dK,e),{size:n,color:r,variant:o}=t,s=cK(t,["size","color","variant"]),i=ki(),c=o in o1?o:i.loader;return B.createElement(Go,lK({role:"presentation",component:o1[c]||o1.bars,size:Xt({size:n,sizes:uK}),color:i.fn.variant({variant:"filled",primaryFallback:!1,color:r||i.primaryColor}).background},s))}N6.displayName="@mantine/core/Loader";var fK=Object.defineProperty,um=Object.getOwnPropertySymbols,$6=Object.prototype.hasOwnProperty,L6=Object.prototype.propertyIsEnumerable,e4=(e,t,n)=>t in e?fK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,t4=(e,t)=>{for(var n in t||(t={}))$6.call(t,n)&&e4(e,n,t[n]);if(um)for(var n of um(t))L6.call(t,n)&&e4(e,n,t[n]);return e},pK=(e,t)=>{var n={};for(var r in e)$6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&um)for(var r of um(e))t.indexOf(r)<0&&L6.call(e,r)&&(n[r]=e[r]);return n};const hK={color:"gray",size:"md",variant:"subtle"},z6=l.forwardRef((e,t)=>{const n=Nr("ActionIcon",hK,e),{className:r,color:o,children:s,radius:i,size:c,variant:d,gradient:p,disabled:h,loaderProps:m,loading:g,unstyled:b,__staticSelector:y}=n,x=pK(n,["className","color","children","radius","size","variant","gradient","disabled","loaderProps","loading","unstyled","__staticSelector"]),{classes:C,cx:S,theme:j}=eK({radius:i,color:o,gradient:p},{name:["ActionIcon",y],unstyled:b,size:c,variant:d}),_=B.createElement(N6,t4({color:j.fn.variant({color:o,variant:d}).color,size:"100%","data-action-icon-loader":!0},m));return B.createElement(Uq,t4({className:S(C.root,r),ref:t,disabled:h,"data-disabled":h||void 0,"data-loading":g||void 0,unstyled:b},x),g?_:s)});z6.displayName="@mantine/core/ActionIcon";const mK=z6;var gK=Object.defineProperty,vK=Object.defineProperties,bK=Object.getOwnPropertyDescriptors,dm=Object.getOwnPropertySymbols,F6=Object.prototype.hasOwnProperty,B6=Object.prototype.propertyIsEnumerable,n4=(e,t,n)=>t in e?gK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xK=(e,t)=>{for(var n in t||(t={}))F6.call(t,n)&&n4(e,n,t[n]);if(dm)for(var n of dm(t))B6.call(t,n)&&n4(e,n,t[n]);return e},yK=(e,t)=>vK(e,bK(t)),CK=(e,t)=>{var n={};for(var r in e)F6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&dm)for(var r of dm(e))t.indexOf(r)<0&&B6.call(e,r)&&(n[r]=e[r]);return n};function H6(e){const t=Nr("Portal",{},e),{children:n,target:r,className:o,innerRef:s}=t,i=CK(t,["children","target","className","innerRef"]),c=ki(),[d,p]=l.useState(!1),h=l.useRef();return m6(()=>(p(!0),h.current=r?typeof r=="string"?document.querySelector(r):r:document.createElement("div"),r||document.body.appendChild(h.current),()=>{!r&&document.body.removeChild(h.current)}),[r]),d?rs.createPortal(B.createElement("div",yK(xK({className:o,dir:c.dir},i),{ref:s}),n),h.current):null}H6.displayName="@mantine/core/Portal";var wK=Object.defineProperty,fm=Object.getOwnPropertySymbols,W6=Object.prototype.hasOwnProperty,V6=Object.prototype.propertyIsEnumerable,r4=(e,t,n)=>t in e?wK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SK=(e,t)=>{for(var n in t||(t={}))W6.call(t,n)&&r4(e,n,t[n]);if(fm)for(var n of fm(t))V6.call(t,n)&&r4(e,n,t[n]);return e},kK=(e,t)=>{var n={};for(var r in e)W6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&fm)for(var r of fm(e))t.indexOf(r)<0&&V6.call(e,r)&&(n[r]=e[r]);return n};function U6(e){var t=e,{withinPortal:n=!0,children:r}=t,o=kK(t,["withinPortal","children"]);return n?B.createElement(H6,SK({},o),r):B.createElement(B.Fragment,null,r)}U6.displayName="@mantine/core/OptionalPortal";var jK=Object.defineProperty,pm=Object.getOwnPropertySymbols,G6=Object.prototype.hasOwnProperty,q6=Object.prototype.propertyIsEnumerable,o4=(e,t,n)=>t in e?jK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,s4=(e,t)=>{for(var n in t||(t={}))G6.call(t,n)&&o4(e,n,t[n]);if(pm)for(var n of pm(t))q6.call(t,n)&&o4(e,n,t[n]);return e},_K=(e,t)=>{var n={};for(var r in e)G6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pm)for(var r of pm(e))t.indexOf(r)<0&&q6.call(e,r)&&(n[r]=e[r]);return n};function K6(e){const t=e,{width:n,height:r,style:o}=t,s=_K(t,["width","height","style"]);return B.createElement("svg",s4({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:s4({width:n,height:r},o)},s),B.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}K6.displayName="@mantine/core/CloseIcon";var IK=Object.defineProperty,hm=Object.getOwnPropertySymbols,Q6=Object.prototype.hasOwnProperty,X6=Object.prototype.propertyIsEnumerable,a4=(e,t,n)=>t in e?IK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,PK=(e,t)=>{for(var n in t||(t={}))Q6.call(t,n)&&a4(e,n,t[n]);if(hm)for(var n of hm(t))X6.call(t,n)&&a4(e,n,t[n]);return e},EK=(e,t)=>{var n={};for(var r in e)Q6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&hm)for(var r of hm(e))t.indexOf(r)<0&&X6.call(e,r)&&(n[r]=e[r]);return n};const MK={xs:Ge(12),sm:Ge(16),md:Ge(20),lg:Ge(28),xl:Ge(34)},OK={size:"sm"},Y6=l.forwardRef((e,t)=>{const n=Nr("CloseButton",OK,e),{iconSize:r,size:o,children:s}=n,i=EK(n,["iconSize","size","children"]),c=Ge(r||MK[o]);return B.createElement(mK,PK({ref:t,__staticSelector:"CloseButton",size:o},i),s||B.createElement(K6,{width:c,height:c}))});Y6.displayName="@mantine/core/CloseButton";const J6=Y6;var RK=Object.defineProperty,AK=Object.defineProperties,DK=Object.getOwnPropertyDescriptors,i4=Object.getOwnPropertySymbols,TK=Object.prototype.hasOwnProperty,NK=Object.prototype.propertyIsEnumerable,l4=(e,t,n)=>t in e?RK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qp=(e,t)=>{for(var n in t||(t={}))TK.call(t,n)&&l4(e,n,t[n]);if(i4)for(var n of i4(t))NK.call(t,n)&&l4(e,n,t[n]);return e},$K=(e,t)=>AK(e,DK(t));function LK({underline:e,strikethrough:t}){const n=[];return e&&n.push("underline"),t&&n.push("line-through"),n.length>0?n.join(" "):"none"}function zK({theme:e,color:t}){return t==="dimmed"?e.fn.dimmed():typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?e.fn.variant({variant:"filled",color:t}).background:t||"inherit"}function FK(e){return typeof e=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}function BK({theme:e,truncate:t}){return t==="start"?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:e.dir==="ltr"?"rtl":"ltr",textAlign:e.dir==="ltr"?"right":"left"}:t?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:null}var HK=Co((e,{color:t,lineClamp:n,truncate:r,inline:o,inherit:s,underline:i,gradient:c,weight:d,transform:p,align:h,strikethrough:m,italic:g},{size:b})=>{const y=e.fn.variant({variant:"gradient",gradient:c});return{root:$K(Qp(Qp(Qp(Qp({},e.fn.fontStyles()),e.fn.focusStyles()),FK(n)),BK({theme:e,truncate:r})),{color:zK({color:t,theme:e}),fontFamily:s?"inherit":e.fontFamily,fontSize:s||b===void 0?"inherit":Xt({size:b,sizes:e.fontSizes}),lineHeight:s?"inherit":o?1:e.lineHeight,textDecoration:LK({underline:i,strikethrough:m}),WebkitTapHighlightColor:"transparent",fontWeight:s?"inherit":d,textTransform:p,textAlign:h,fontStyle:g?"italic":void 0}),gradient:{backgroundImage:y.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}});const WK=HK;var VK=Object.defineProperty,mm=Object.getOwnPropertySymbols,Z6=Object.prototype.hasOwnProperty,eE=Object.prototype.propertyIsEnumerable,c4=(e,t,n)=>t in e?VK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,UK=(e,t)=>{for(var n in t||(t={}))Z6.call(t,n)&&c4(e,n,t[n]);if(mm)for(var n of mm(t))eE.call(t,n)&&c4(e,n,t[n]);return e},GK=(e,t)=>{var n={};for(var r in e)Z6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mm)for(var r of mm(e))t.indexOf(r)<0&&eE.call(e,r)&&(n[r]=e[r]);return n};const qK={variant:"text"},tE=l.forwardRef((e,t)=>{const n=Nr("Text",qK,e),{className:r,size:o,weight:s,transform:i,color:c,align:d,variant:p,lineClamp:h,truncate:m,gradient:g,inline:b,inherit:y,underline:x,strikethrough:C,italic:S,classNames:j,styles:_,unstyled:I,span:P,__staticSelector:M}=n,R=GK(n,["className","size","weight","transform","color","align","variant","lineClamp","truncate","gradient","inline","inherit","underline","strikethrough","italic","classNames","styles","unstyled","span","__staticSelector"]),{classes:A,cx:D}=WK({color:c,lineClamp:h,truncate:m,inline:b,inherit:y,underline:x,strikethrough:C,italic:S,weight:s,transform:i,align:d,gradient:g},{unstyled:I,name:M||"Text",variant:p,size:o});return B.createElement(Go,UK({ref:t,className:D(A.root,{[A.gradient]:p==="gradient"},r),component:P?"span":"div"},R))});tE.displayName="@mantine/core/Text";const yu=tE,Xp={xs:Ge(1),sm:Ge(2),md:Ge(3),lg:Ge(4),xl:Ge(5)};function Yp(e,t){const n=e.fn.variant({variant:"outline",color:t}).border;return typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?n:t===void 0?e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]:t}var KK=Co((e,{color:t},{size:n,variant:r})=>({root:{},withLabel:{borderTop:"0 !important"},left:{"&::before":{display:"none"}},right:{"&::after":{display:"none"}},label:{display:"flex",alignItems:"center","&::before":{content:'""',flex:1,height:Ge(1),borderTop:`${Xt({size:n,sizes:Xp})} ${r} ${Yp(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${Xt({size:n,sizes:Xp})} ${r} ${Yp(e,t)}`,marginLeft:e.spacing.xs}},labelDefaultStyles:{color:t==="dark"?e.colors.dark[1]:e.fn.themeColor(t,e.colorScheme==="dark"?5:e.fn.primaryShade(),!1)},horizontal:{border:0,borderTopWidth:Ge(Xt({size:n,sizes:Xp})),borderTopColor:Yp(e,t),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"auto",borderLeftWidth:Ge(Xt({size:n,sizes:Xp})),borderLeftColor:Yp(e,t),borderLeftStyle:r}}));const QK=KK;var XK=Object.defineProperty,YK=Object.defineProperties,JK=Object.getOwnPropertyDescriptors,gm=Object.getOwnPropertySymbols,nE=Object.prototype.hasOwnProperty,rE=Object.prototype.propertyIsEnumerable,u4=(e,t,n)=>t in e?XK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d4=(e,t)=>{for(var n in t||(t={}))nE.call(t,n)&&u4(e,n,t[n]);if(gm)for(var n of gm(t))rE.call(t,n)&&u4(e,n,t[n]);return e},ZK=(e,t)=>YK(e,JK(t)),eQ=(e,t)=>{var n={};for(var r in e)nE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gm)for(var r of gm(e))t.indexOf(r)<0&&rE.call(e,r)&&(n[r]=e[r]);return n};const tQ={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},Ab=l.forwardRef((e,t)=>{const n=Nr("Divider",tQ,e),{className:r,color:o,orientation:s,size:i,label:c,labelPosition:d,labelProps:p,variant:h,styles:m,classNames:g,unstyled:b}=n,y=eQ(n,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames","unstyled"]),{classes:x,cx:C}=QK({color:o},{classNames:g,styles:m,unstyled:b,name:"Divider",variant:h,size:i}),S=s==="vertical",j=s==="horizontal",_=!!c&&j,I=!(p!=null&&p.color);return B.createElement(Go,d4({ref:t,className:C(x.root,{[x.vertical]:S,[x.horizontal]:j,[x.withLabel]:_},r),role:"separator"},y),_&&B.createElement(yu,ZK(d4({},p),{size:(p==null?void 0:p.size)||"xs",mt:Ge(2),className:C(x.label,x[d],{[x.labelDefaultStyles]:I})}),c))});Ab.displayName="@mantine/core/Divider";var nQ=Object.defineProperty,rQ=Object.defineProperties,oQ=Object.getOwnPropertyDescriptors,f4=Object.getOwnPropertySymbols,sQ=Object.prototype.hasOwnProperty,aQ=Object.prototype.propertyIsEnumerable,p4=(e,t,n)=>t in e?nQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h4=(e,t)=>{for(var n in t||(t={}))sQ.call(t,n)&&p4(e,n,t[n]);if(f4)for(var n of f4(t))aQ.call(t,n)&&p4(e,n,t[n]);return e},iQ=(e,t)=>rQ(e,oQ(t)),lQ=Co((e,t,{size:n})=>({item:iQ(h4({},e.fn.fontStyles()),{boxSizing:"border-box",wordBreak:"break-all",textAlign:"left",width:"100%",padding:`calc(${Xt({size:n,sizes:e.spacing})} / 1.5) ${Xt({size:n,sizes:e.spacing})}`,cursor:"pointer",fontSize:Xt({size:n,sizes:e.fontSizes}),color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,borderRadius:e.fn.radius(),"&[data-hovered]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[1]},"&[data-selected]":h4({backgroundColor:e.fn.variant({variant:"filled"}).background,color:e.fn.variant({variant:"filled"}).color},e.fn.hover({backgroundColor:e.fn.variant({variant:"filled"}).hover})),"&[data-disabled]":{cursor:"default",color:e.colors.dark[2]}}),nothingFound:{boxSizing:"border-box",color:e.colors.gray[6],paddingTop:`calc(${Xt({size:n,sizes:e.spacing})} / 2)`,paddingBottom:`calc(${Xt({size:n,sizes:e.spacing})} / 2)`,textAlign:"center"},separator:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`calc(${Xt({size:n,sizes:e.spacing})} / 1.5) ${Xt({size:n,sizes:e.spacing})}`},separatorLabel:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}));const cQ=lQ;var uQ=Object.defineProperty,m4=Object.getOwnPropertySymbols,dQ=Object.prototype.hasOwnProperty,fQ=Object.prototype.propertyIsEnumerable,g4=(e,t,n)=>t in e?uQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pQ=(e,t)=>{for(var n in t||(t={}))dQ.call(t,n)&&g4(e,n,t[n]);if(m4)for(var n of m4(t))fQ.call(t,n)&&g4(e,n,t[n]);return e};function Ny({data:e,hovered:t,classNames:n,styles:r,isItemSelected:o,uuid:s,__staticSelector:i,onItemHover:c,onItemSelect:d,itemsRefs:p,itemComponent:h,size:m,nothingFound:g,creatable:b,createLabel:y,unstyled:x,variant:C}){const{classes:S}=cQ(null,{classNames:n,styles:r,unstyled:x,name:i,variant:C,size:m}),j=[],_=[];let I=null;const P=(R,A)=>{const D=typeof o=="function"?o(R.value):!1;return B.createElement(h,pQ({key:R.value,className:S.item,"data-disabled":R.disabled||void 0,"data-hovered":!R.disabled&&t===A||void 0,"data-selected":!R.disabled&&D||void 0,selected:D,onMouseEnter:()=>c(A),id:`${s}-${A}`,role:"option",tabIndex:-1,"aria-selected":t===A,ref:O=>{p&&p.current&&(p.current[R.value]=O)},onMouseDown:R.disabled?null:O=>{O.preventDefault(),d(R)},disabled:R.disabled,variant:C},R))};let M=null;if(e.forEach((R,A)=>{R.creatable?I=A:R.group?(M!==R.group&&(M=R.group,_.push(B.createElement("div",{className:S.separator,key:`__mantine-divider-${A}`},B.createElement(Ab,{classNames:{label:S.separatorLabel},label:R.group})))),_.push(P(R,A))):j.push(P(R,A))}),b){const R=e[I];j.push(B.createElement("div",{key:Dy(),className:S.item,"data-hovered":t===I||void 0,onMouseEnter:()=>c(I),onMouseDown:A=>{A.preventDefault(),d(R)},tabIndex:-1,ref:A=>{p&&p.current&&(p.current[R.value]=A)}},y))}return _.length>0&&j.length>0&&j.unshift(B.createElement("div",{className:S.separator,key:"empty-group-separator"},B.createElement(Ab,null))),_.length>0||j.length>0?B.createElement(B.Fragment,null,_,j):B.createElement(yu,{size:m,unstyled:x,className:S.nothingFound},g)}Ny.displayName="@mantine/core/SelectItems";var hQ=Object.defineProperty,vm=Object.getOwnPropertySymbols,oE=Object.prototype.hasOwnProperty,sE=Object.prototype.propertyIsEnumerable,v4=(e,t,n)=>t in e?hQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mQ=(e,t)=>{for(var n in t||(t={}))oE.call(t,n)&&v4(e,n,t[n]);if(vm)for(var n of vm(t))sE.call(t,n)&&v4(e,n,t[n]);return e},gQ=(e,t)=>{var n={};for(var r in e)oE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&vm)for(var r of vm(e))t.indexOf(r)<0&&sE.call(e,r)&&(n[r]=e[r]);return n};const $y=l.forwardRef((e,t)=>{var n=e,{label:r,value:o}=n,s=gQ(n,["label","value"]);return B.createElement("div",mQ({ref:t},s),r||o)});$y.displayName="@mantine/core/DefaultItem";function vQ(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function aE(...e){return t=>e.forEach(n=>vQ(n,t))}function rc(...e){return l.useCallback(aE(...e),e)}const iE=l.forwardRef((e,t)=>{const{children:n,...r}=e,o=l.Children.toArray(n),s=o.find(xQ);if(s){const i=s.props.children,c=o.map(d=>d===s?l.Children.count(i)>1?l.Children.only(null):l.isValidElement(i)?i.props.children:null:d);return l.createElement(Db,mr({},r,{ref:t}),l.isValidElement(i)?l.cloneElement(i,void 0,c):null)}return l.createElement(Db,mr({},r,{ref:t}),n)});iE.displayName="Slot";const Db=l.forwardRef((e,t)=>{const{children:n,...r}=e;return l.isValidElement(n)?l.cloneElement(n,{...yQ(r,n.props),ref:aE(t,n.ref)}):l.Children.count(n)>1?l.Children.only(null):null});Db.displayName="SlotClone";const bQ=({children:e})=>l.createElement(l.Fragment,null,e);function xQ(e){return l.isValidElement(e)&&e.type===bQ}function yQ(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...c)=>{s(...c),o(...c)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}const CQ=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],Ff=CQ.reduce((e,t)=>{const n=l.forwardRef((r,o)=>{const{asChild:s,...i}=r,c=s?iE:t;return l.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),l.createElement(c,mr({},i,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Tb=globalThis!=null&&globalThis.document?l.useLayoutEffect:()=>{};function wQ(e,t){return l.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Bf=e=>{const{present:t,children:n}=e,r=SQ(t),o=typeof n=="function"?n({present:r.isPresent}):l.Children.only(n),s=rc(r.ref,o.ref);return typeof n=="function"||r.isPresent?l.cloneElement(o,{ref:s}):null};Bf.displayName="Presence";function SQ(e){const[t,n]=l.useState(),r=l.useRef({}),o=l.useRef(e),s=l.useRef("none"),i=e?"mounted":"unmounted",[c,d]=wQ(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return l.useEffect(()=>{const p=Jp(r.current);s.current=c==="mounted"?p:"none"},[c]),Tb(()=>{const p=r.current,h=o.current;if(h!==e){const g=s.current,b=Jp(p);e?d("MOUNT"):b==="none"||(p==null?void 0:p.display)==="none"?d("UNMOUNT"):d(h&&g!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),Tb(()=>{if(t){const p=m=>{const b=Jp(r.current).includes(m.animationName);m.target===t&&b&&rs.flushSync(()=>d("ANIMATION_END"))},h=m=>{m.target===t&&(s.current=Jp(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:l.useCallback(p=>{p&&(r.current=getComputedStyle(p)),n(p)},[])}}function Jp(e){return(e==null?void 0:e.animationName)||"none"}function kQ(e,t=[]){let n=[];function r(s,i){const c=l.createContext(i),d=n.length;n=[...n,i];function p(m){const{scope:g,children:b,...y}=m,x=(g==null?void 0:g[e][d])||c,C=l.useMemo(()=>y,Object.values(y));return l.createElement(x.Provider,{value:C},b)}function h(m,g){const b=(g==null?void 0:g[e][d])||c,y=l.useContext(b);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${s}\``)}return p.displayName=s+"Provider",[p,h]}const o=()=>{const s=n.map(i=>l.createContext(i));return function(c){const d=(c==null?void 0:c[e])||s;return l.useMemo(()=>({[`__scope${e}`]:{...c,[e]:d}}),[c,d])}};return o.scopeName=e,[r,jQ(o,...t)]}function jQ(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((c,{useScope:d,scopeName:p})=>{const m=d(s)[`__scope${p}`];return{...c,...m}},{});return l.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Ml(e){const t=l.useRef(e);return l.useEffect(()=>{t.current=e}),l.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const _Q=l.createContext(void 0);function IQ(e){const t=l.useContext(_Q);return e||t||"ltr"}function PQ(e,[t,n]){return Math.min(n,Math.max(t,e))}function $l(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function EQ(e,t){return l.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const lE="ScrollArea",[cE,pbe]=kQ(lE),[MQ,As]=cE(lE),OQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[c,d]=l.useState(null),[p,h]=l.useState(null),[m,g]=l.useState(null),[b,y]=l.useState(null),[x,C]=l.useState(null),[S,j]=l.useState(0),[_,I]=l.useState(0),[P,M]=l.useState(!1),[R,A]=l.useState(!1),D=rc(t,T=>d(T)),O=IQ(o);return l.createElement(MQ,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:c,viewport:p,onViewportChange:h,content:m,onContentChange:g,scrollbarX:b,onScrollbarXChange:y,scrollbarXEnabled:P,onScrollbarXEnabledChange:M,scrollbarY:x,onScrollbarYChange:C,scrollbarYEnabled:R,onScrollbarYEnabledChange:A,onCornerWidthChange:j,onCornerHeightChange:I},l.createElement(Ff.div,mr({dir:O},i,{ref:D,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})))}),RQ="ScrollAreaViewport",AQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,s=As(RQ,n),i=l.useRef(null),c=rc(t,i,s.onViewportChange);return l.createElement(l.Fragment,null,l.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),l.createElement(Ff.div,mr({"data-radix-scroll-area-viewport":""},o,{ref:c,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style}}),l.createElement("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),_i="ScrollAreaScrollbar",DQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=As(_i,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,c=e.orientation==="horizontal";return l.useEffect(()=>(c?s(!0):i(!0),()=>{c?s(!1):i(!1)}),[c,s,i]),o.type==="hover"?l.createElement(TQ,mr({},r,{ref:t,forceMount:n})):o.type==="scroll"?l.createElement(NQ,mr({},r,{ref:t,forceMount:n})):o.type==="auto"?l.createElement(uE,mr({},r,{ref:t,forceMount:n})):o.type==="always"?l.createElement(Ly,mr({},r,{ref:t})):null}),TQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=As(_i,e.__scopeScrollArea),[s,i]=l.useState(!1);return l.useEffect(()=>{const c=o.scrollArea;let d=0;if(c){const p=()=>{window.clearTimeout(d),i(!0)},h=()=>{d=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return c.addEventListener("pointerenter",p),c.addEventListener("pointerleave",h),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",p),c.removeEventListener("pointerleave",h)}}},[o.scrollArea,o.scrollHideDelay]),l.createElement(Bf,{present:n||s},l.createElement(uE,mr({"data-state":s?"visible":"hidden"},r,{ref:t})))}),NQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=As(_i,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Vg(()=>d("SCROLL_END"),100),[c,d]=EQ("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return l.useEffect(()=>{if(c==="idle"){const p=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[c,o.scrollHideDelay,d]),l.useEffect(()=>{const p=o.viewport,h=s?"scrollLeft":"scrollTop";if(p){let m=p[h];const g=()=>{const b=p[h];m!==b&&(d("SCROLL"),i()),m=b};return p.addEventListener("scroll",g),()=>p.removeEventListener("scroll",g)}},[o.viewport,s,d,i]),l.createElement(Bf,{present:n||c!=="hidden"},l.createElement(Ly,mr({"data-state":c==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:$l(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:$l(e.onPointerLeave,()=>d("POINTER_LEAVE"))})))}),uE=l.forwardRef((e,t)=>{const n=As(_i,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=l.useState(!1),c=e.orientation==="horizontal",d=Vg(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=As(_i,e.__scopeScrollArea),s=l.useRef(null),i=l.useRef(0),[c,d]=l.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=hE(c.viewport,c.content),h={...r,sizes:c,onSizesChange:d,hasThumb:p>0&&p<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:g=>i.current=g};function m(g,b){return VQ(g,i.current,c,b)}return n==="horizontal"?l.createElement($Q,mr({},h,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollLeft,b=b4(g,c,o.dir);s.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollLeft=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollLeft=m(g,o.dir))}})):n==="vertical"?l.createElement(LQ,mr({},h,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollTop,b=b4(g,c);s.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollTop=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollTop=m(g))}})):null}),$Q=l.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=As(_i,e.__scopeScrollArea),[i,c]=l.useState(),d=l.useRef(null),p=rc(t,d,s.onScrollbarXChange);return l.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),l.createElement(fE,mr({"data-orientation":"horizontal"},o,{ref:p,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Wg(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,m)=>{if(s.viewport){const g=s.viewport.scrollLeft+h.deltaX;e.onWheelScroll(g),gE(g,m)&&h.preventDefault()}},onResize:()=>{d.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:bm(i.paddingLeft),paddingEnd:bm(i.paddingRight)}})}}))}),LQ=l.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=As(_i,e.__scopeScrollArea),[i,c]=l.useState(),d=l.useRef(null),p=rc(t,d,s.onScrollbarYChange);return l.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),l.createElement(fE,mr({"data-orientation":"vertical"},o,{ref:p,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Wg(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,m)=>{if(s.viewport){const g=s.viewport.scrollTop+h.deltaY;e.onWheelScroll(g),gE(g,m)&&h.preventDefault()}},onResize:()=>{d.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:bm(i.paddingTop),paddingEnd:bm(i.paddingBottom)}})}}))}),[zQ,dE]=cE(_i),fE=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:p,onWheelScroll:h,onResize:m,...g}=e,b=As(_i,n),[y,x]=l.useState(null),C=rc(t,D=>x(D)),S=l.useRef(null),j=l.useRef(""),_=b.viewport,I=r.content-r.viewport,P=Ml(h),M=Ml(d),R=Vg(m,10);function A(D){if(S.current){const O=D.clientX-S.current.left,T=D.clientY-S.current.top;p({x:O,y:T})}}return l.useEffect(()=>{const D=O=>{const T=O.target;(y==null?void 0:y.contains(T))&&P(O,I)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[_,y,I,P]),l.useEffect(M,[r,M]),Cu(y,R),Cu(b.content,R),l.createElement(zQ,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:Ml(s),onThumbPointerUp:Ml(i),onThumbPositionChange:M,onThumbPointerDown:Ml(c)},l.createElement(Ff.div,mr({},g,{ref:C,style:{position:"absolute",...g.style},onPointerDown:$l(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),S.current=y.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",A(D))}),onPointerMove:$l(e.onPointerMove,A),onPointerUp:$l(e.onPointerUp,D=>{const O=D.target;O.hasPointerCapture(D.pointerId)&&O.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=j.current,S.current=null})})))}),Nb="ScrollAreaThumb",FQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=dE(Nb,e.__scopeScrollArea);return l.createElement(Bf,{present:n||o.hasThumb},l.createElement(BQ,mr({ref:t},r)))}),BQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=As(Nb,n),i=dE(Nb,n),{onThumbPositionChange:c}=i,d=rc(t,m=>i.onThumbChange(m)),p=l.useRef(),h=Vg(()=>{p.current&&(p.current(),p.current=void 0)},100);return l.useEffect(()=>{const m=s.viewport;if(m){const g=()=>{if(h(),!p.current){const b=UQ(m,c);p.current=b,c()}};return c(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[s.viewport,h,c]),l.createElement(Ff.div,mr({"data-state":i.hasThumb?"visible":"hidden"},o,{ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:$l(e.onPointerDownCapture,m=>{const b=m.target.getBoundingClientRect(),y=m.clientX-b.left,x=m.clientY-b.top;i.onThumbPointerDown({x:y,y:x})}),onPointerUp:$l(e.onPointerUp,i.onThumbPointerUp)}))}),pE="ScrollAreaCorner",HQ=l.forwardRef((e,t)=>{const n=As(pE,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.createElement(WQ,mr({},e,{ref:t})):null}),WQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=As(pE,n),[s,i]=l.useState(0),[c,d]=l.useState(0),p=!!(s&&c);return Cu(o.scrollbarX,()=>{var h;const m=((h=o.scrollbarX)===null||h===void 0?void 0:h.offsetHeight)||0;o.onCornerHeightChange(m),d(m)}),Cu(o.scrollbarY,()=>{var h;const m=((h=o.scrollbarY)===null||h===void 0?void 0:h.offsetWidth)||0;o.onCornerWidthChange(m),i(m)}),p?l.createElement(Ff.div,mr({},r,{ref:t,style:{width:s,height:c,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function bm(e){return e?parseInt(e,10):0}function hE(e,t){const n=e/t;return isNaN(n)?0:n}function Wg(e){const t=hE(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function VQ(e,t,n,r="ltr"){const o=Wg(n),s=o/2,i=t||s,c=o-i,d=n.scrollbar.paddingStart+i,p=n.scrollbar.size-n.scrollbar.paddingEnd-c,h=n.content-n.viewport,m=r==="ltr"?[0,h]:[h*-1,0];return mE([d,p],m)(e)}function b4(e,t,n="ltr"){const r=Wg(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,c=s-r,d=n==="ltr"?[0,i]:[i*-1,0],p=PQ(e,d);return mE([0,i],[0,c])(p)}function mE(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function gE(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,c=n.top!==s.top;(i||c)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function Vg(e,t){const n=Ml(e),r=l.useRef(0);return l.useEffect(()=>()=>window.clearTimeout(r.current),[]),l.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Cu(e,t){const n=Ml(t);Tb(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const GQ=OQ,qQ=AQ,x4=DQ,y4=FQ,KQ=HQ;var QQ=Co((e,{scrollbarSize:t,offsetScrollbars:n,scrollbarHovered:r,hidden:o})=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:n?Ge(t):void 0,paddingBottom:n?Ge(t):void 0},scrollbar:{display:o?"none":"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:`calc(${Ge(t)} / 5)`,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.colors.gray[0],[`& .${jk("thumb")}`]:{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.5):e.fn.rgba(e.black,.5)}},'&[data-orientation="vertical"]':{width:Ge(t)},'&[data-orientation="horizontal"]':{flexDirection:"column",height:Ge(t)},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:jk("thumb"),flex:1,backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.4):e.fn.rgba(e.black,.4),borderRadius:Ge(t),position:"relative",transition:"background-color 150ms ease",display:o?"none":void 0,overflow:"hidden","&::before":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",minWidth:Ge(44),minHeight:Ge(44)}},corner:{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0],transition:"opacity 150ms ease",opacity:r?1:0,display:o?"none":void 0}}));const XQ=QQ;var YQ=Object.defineProperty,JQ=Object.defineProperties,ZQ=Object.getOwnPropertyDescriptors,xm=Object.getOwnPropertySymbols,vE=Object.prototype.hasOwnProperty,bE=Object.prototype.propertyIsEnumerable,C4=(e,t,n)=>t in e?YQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$b=(e,t)=>{for(var n in t||(t={}))vE.call(t,n)&&C4(e,n,t[n]);if(xm)for(var n of xm(t))bE.call(t,n)&&C4(e,n,t[n]);return e},xE=(e,t)=>JQ(e,ZQ(t)),yE=(e,t)=>{var n={};for(var r in e)vE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&xm)for(var r of xm(e))t.indexOf(r)<0&&bE.call(e,r)&&(n[r]=e[r]);return n};const CE={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},Ug=l.forwardRef((e,t)=>{const n=Nr("ScrollArea",CE,e),{children:r,className:o,classNames:s,styles:i,scrollbarSize:c,scrollHideDelay:d,type:p,dir:h,offsetScrollbars:m,viewportRef:g,onScrollPositionChange:b,unstyled:y,variant:x,viewportProps:C}=n,S=yE(n,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","variant","viewportProps"]),[j,_]=l.useState(!1),I=ki(),{classes:P,cx:M}=XQ({scrollbarSize:c,offsetScrollbars:m,scrollbarHovered:j,hidden:p==="never"},{name:"ScrollArea",classNames:s,styles:i,unstyled:y,variant:x});return B.createElement(GQ,{type:p==="never"?"always":p,scrollHideDelay:d,dir:h||I.dir,ref:t,asChild:!0},B.createElement(Go,$b({className:M(P.root,o)},S),B.createElement(qQ,xE($b({},C),{className:P.viewport,ref:g,onScroll:typeof b=="function"?({currentTarget:R})=>b({x:R.scrollLeft,y:R.scrollTop}):void 0}),r),B.createElement(x4,{orientation:"horizontal",className:P.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},B.createElement(y4,{className:P.thumb})),B.createElement(x4,{orientation:"vertical",className:P.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},B.createElement(y4,{className:P.thumb})),B.createElement(KQ,{className:P.corner})))}),wE=l.forwardRef((e,t)=>{const n=Nr("ScrollAreaAutosize",CE,e),{children:r,classNames:o,styles:s,scrollbarSize:i,scrollHideDelay:c,type:d,dir:p,offsetScrollbars:h,viewportRef:m,onScrollPositionChange:g,unstyled:b,sx:y,variant:x,viewportProps:C}=n,S=yE(n,["children","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","sx","variant","viewportProps"]);return B.createElement(Go,xE($b({},S),{ref:t,sx:[{display:"flex"},...c6(y)]}),B.createElement(Go,{sx:{display:"flex",flexDirection:"column",flex:1}},B.createElement(Ug,{classNames:o,styles:s,scrollHideDelay:c,scrollbarSize:i,type:d,dir:p,offsetScrollbars:h,viewportRef:m,onScrollPositionChange:g,unstyled:b,variant:x,viewportProps:C},r)))});wE.displayName="@mantine/core/ScrollAreaAutosize";Ug.displayName="@mantine/core/ScrollArea";Ug.Autosize=wE;const SE=Ug;var eX=Object.defineProperty,tX=Object.defineProperties,nX=Object.getOwnPropertyDescriptors,ym=Object.getOwnPropertySymbols,kE=Object.prototype.hasOwnProperty,jE=Object.prototype.propertyIsEnumerable,w4=(e,t,n)=>t in e?eX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,S4=(e,t)=>{for(var n in t||(t={}))kE.call(t,n)&&w4(e,n,t[n]);if(ym)for(var n of ym(t))jE.call(t,n)&&w4(e,n,t[n]);return e},rX=(e,t)=>tX(e,nX(t)),oX=(e,t)=>{var n={};for(var r in e)kE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ym)for(var r of ym(e))t.indexOf(r)<0&&jE.call(e,r)&&(n[r]=e[r]);return n};const Gg=l.forwardRef((e,t)=>{var n=e,{style:r}=n,o=oX(n,["style"]);return B.createElement(SE,rX(S4({},o),{style:S4({width:"100%"},r),viewportProps:{tabIndex:-1},viewportRef:t}),o.children)});Gg.displayName="@mantine/core/SelectScrollArea";var sX=Co(()=>({dropdown:{},itemsWrapper:{padding:Ge(4),display:"flex",width:"100%",boxSizing:"border-box"}}));const aX=sX;function Fu(e){return e.split("-")[1]}function zy(e){return e==="y"?"height":"width"}function Zs(e){return e.split("-")[0]}function dl(e){return["top","bottom"].includes(Zs(e))?"x":"y"}function k4(e,t,n){let{reference:r,floating:o}=e;const s=r.x+r.width/2-o.width/2,i=r.y+r.height/2-o.height/2,c=dl(t),d=zy(c),p=r[d]/2-o[d]/2,h=c==="x";let m;switch(Zs(t)){case"top":m={x:s,y:r.y-o.height};break;case"bottom":m={x:s,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:i};break;case"left":m={x:r.x-o.width,y:i};break;default:m={x:r.x,y:r.y}}switch(Fu(t)){case"start":m[c]-=p*(n&&h?-1:1);break;case"end":m[c]+=p*(n&&h?-1:1)}return m}const iX=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),d=await(i.isRTL==null?void 0:i.isRTL(t));let p=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:m}=k4(p,r,d),g=r,b={},y=0;for(let x=0;x({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c}=t,{element:d,padding:p=0}=hi(e,t)||{};if(d==null)return{};const h=Fy(p),m={x:n,y:r},g=dl(o),b=zy(g),y=await i.getDimensions(d),x=g==="y",C=x?"top":"left",S=x?"bottom":"right",j=x?"clientHeight":"clientWidth",_=s.reference[b]+s.reference[g]-m[g]-s.floating[b],I=m[g]-s.reference[g],P=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let M=P?P[j]:0;M&&await(i.isElement==null?void 0:i.isElement(P))||(M=c.floating[j]||s.floating[b]);const R=_/2-I/2,A=M/2-y[b]/2-1,D=rl(h[C],A),O=rl(h[S],A),T=D,Y=M-y[b]-O,z=M/2-y[b]/2+R,W=Lb(T,z,Y),Q=Fu(o)!=null&&z!=W&&s.reference[b]/2-(ze.concat(t,t+"-start",t+"-end"),[]);const cX={left:"right",right:"left",bottom:"top",top:"bottom"};function Cm(e){return e.replace(/left|right|bottom|top/g,t=>cX[t])}function uX(e,t,n){n===void 0&&(n=!1);const r=Fu(e),o=dl(e),s=zy(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Cm(i)),{main:i,cross:Cm(i)}}const dX={start:"end",end:"start"};function s1(e){return e.replace(/start|end/g,t=>dX[t])}const fX=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:s,initialPlacement:i,platform:c,elements:d}=t,{mainAxis:p=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:y=!0,...x}=hi(e,t),C=Zs(r),S=Zs(i)===i,j=await(c.isRTL==null?void 0:c.isRTL(d.floating)),_=m||(S||!y?[Cm(i)]:function(T){const Y=Cm(T);return[s1(T),Y,s1(Y)]}(i));m||b==="none"||_.push(...function(T,Y,z,W){const Q=Fu(T);let U=function(L,ee,K){const Z=["left","right"],se=["right","left"],fe=["top","bottom"],G=["bottom","top"];switch(L){case"top":case"bottom":return K?ee?se:Z:ee?Z:se;case"left":case"right":return ee?fe:G;default:return[]}}(Zs(T),z==="start",W);return Q&&(U=U.map(L=>L+"-"+Q),Y&&(U=U.concat(U.map(s1)))),U}(i,y,b,j));const I=[i,..._],P=await By(t,x),M=[];let R=((n=o.flip)==null?void 0:n.overflows)||[];if(p&&M.push(P[C]),h){const{main:T,cross:Y}=uX(r,s,j);M.push(P[T],P[Y])}if(R=[...R,{placement:r,overflows:M}],!M.every(T=>T<=0)){var A,D;const T=(((A=o.flip)==null?void 0:A.index)||0)+1,Y=I[T];if(Y)return{data:{index:T,overflows:R},reset:{placement:Y}};let z=(D=R.filter(W=>W.overflows[0]<=0).sort((W,Q)=>W.overflows[1]-Q.overflows[1])[0])==null?void 0:D.placement;if(!z)switch(g){case"bestFit":{var O;const W=(O=R.map(Q=>[Q.placement,Q.overflows.filter(U=>U>0).reduce((U,L)=>U+L,0)]).sort((Q,U)=>Q[1]-U[1])[0])==null?void 0:O[0];W&&(z=W);break}case"initialPlacement":z=i}if(r!==z)return{reset:{placement:z}}}return{}}}};function _4(e){const t=rl(...e.map(r=>r.left)),n=rl(...e.map(r=>r.top));return{x:t,y:n,width:xa(...e.map(r=>r.right))-t,height:xa(...e.map(r=>r.bottom))-n}}const pX=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:s,strategy:i}=t,{padding:c=2,x:d,y:p}=hi(e,t),h=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),m=function(x){const C=x.slice().sort((_,I)=>_.y-I.y),S=[];let j=null;for(let _=0;_j.height/2?S.push([I]):S[S.length-1].push(I),j=I}return S.map(_=>wu(_4(_)))}(h),g=wu(_4(h)),b=Fy(c),y=await s.getElementRects({reference:{getBoundingClientRect:function(){if(m.length===2&&m[0].left>m[1].right&&d!=null&&p!=null)return m.find(x=>d>x.left-b.left&&dx.top-b.top&&p=2){if(dl(n)==="x"){const P=m[0],M=m[m.length-1],R=Zs(n)==="top",A=P.top,D=M.bottom,O=R?P.left:M.left,T=R?P.right:M.right;return{top:A,bottom:D,left:O,right:T,width:T-O,height:D-A,x:O,y:A}}const x=Zs(n)==="left",C=xa(...m.map(P=>P.right)),S=rl(...m.map(P=>P.left)),j=m.filter(P=>x?P.left===S:P.right===C),_=j[0].top,I=j[j.length-1].bottom;return{top:_,bottom:I,left:S,right:C,width:C-S,height:I-_,x:S,y:_}}return g}},floating:r.floating,strategy:i});return o.reference.x!==y.reference.x||o.reference.y!==y.reference.y||o.reference.width!==y.reference.width||o.reference.height!==y.reference.height?{reset:{rects:y}}:{}}}},hX=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(s,i){const{placement:c,platform:d,elements:p}=s,h=await(d.isRTL==null?void 0:d.isRTL(p.floating)),m=Zs(c),g=Fu(c),b=dl(c)==="x",y=["left","top"].includes(m)?-1:1,x=h&&b?-1:1,C=hi(i,s);let{mainAxis:S,crossAxis:j,alignmentAxis:_}=typeof C=="number"?{mainAxis:C,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...C};return g&&typeof _=="number"&&(j=g==="end"?-1*_:_),b?{x:j*x,y:S*y}:{x:S*y,y:j*x}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function _E(e){return e==="x"?"y":"x"}const mX=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:C=>{let{x:S,y:j}=C;return{x:S,y:j}}},...d}=hi(e,t),p={x:n,y:r},h=await By(t,d),m=dl(Zs(o)),g=_E(m);let b=p[m],y=p[g];if(s){const C=m==="y"?"bottom":"right";b=Lb(b+h[m==="y"?"top":"left"],b,b-h[C])}if(i){const C=g==="y"?"bottom":"right";y=Lb(y+h[g==="y"?"top":"left"],y,y-h[C])}const x=c.fn({...t,[m]:b,[g]:y});return{...x,data:{x:x.x-n,y:x.y-r}}}}},gX=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:d=!0,crossAxis:p=!0}=hi(e,t),h={x:n,y:r},m=dl(o),g=_E(m);let b=h[m],y=h[g];const x=hi(c,t),C=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(d){const _=m==="y"?"height":"width",I=s.reference[m]-s.floating[_]+C.mainAxis,P=s.reference[m]+s.reference[_]-C.mainAxis;bP&&(b=P)}if(p){var S,j;const _=m==="y"?"width":"height",I=["top","left"].includes(Zs(o)),P=s.reference[g]-s.floating[_]+(I&&((S=i.offset)==null?void 0:S[g])||0)+(I?0:C.crossAxis),M=s.reference[g]+s.reference[_]+(I?0:((j=i.offset)==null?void 0:j[g])||0)-(I?C.crossAxis:0);yM&&(y=M)}return{[m]:b,[g]:y}}}},vX=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...c}=hi(e,t),d=await By(t,c),p=Zs(n),h=Fu(n),m=dl(n)==="x",{width:g,height:b}=r.floating;let y,x;p==="top"||p==="bottom"?(y=p,x=h===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(x=p,y=h==="end"?"top":"bottom");const C=b-d[y],S=g-d[x],j=!t.middlewareData.shift;let _=C,I=S;if(m){const M=g-d.left-d.right;I=h||j?rl(S,M):M}else{const M=b-d.top-d.bottom;_=h||j?rl(C,M):M}if(j&&!h){const M=xa(d.left,0),R=xa(d.right,0),A=xa(d.top,0),D=xa(d.bottom,0);m?I=g-2*(M!==0||R!==0?M+R:xa(d.left,d.right)):_=b-2*(A!==0||D!==0?A+D:xa(d.top,d.bottom))}await i({...t,availableWidth:I,availableHeight:_});const P=await o.getDimensions(s.floating);return g!==P.width||b!==P.height?{reset:{rects:!0}}:{}}}};function ss(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ra(e){return ss(e).getComputedStyle(e)}function IE(e){return e instanceof ss(e).Node}function ol(e){return IE(e)?(e.nodeName||"").toLowerCase():"#document"}function ra(e){return e instanceof HTMLElement||e instanceof ss(e).HTMLElement}function I4(e){return typeof ShadowRoot<"u"&&(e instanceof ss(e).ShadowRoot||e instanceof ShadowRoot)}function ef(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ra(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function bX(e){return["table","td","th"].includes(ol(e))}function zb(e){const t=Hy(),n=Ra(e);return n.transform!=="none"||n.perspective!=="none"||!!n.containerType&&n.containerType!=="normal"||!t&&!!n.backdropFilter&&n.backdropFilter!=="none"||!t&&!!n.filter&&n.filter!=="none"||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Hy(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function qg(e){return["html","body","#document"].includes(ol(e))}const Fb=Math.min,iu=Math.max,wm=Math.round,Zp=Math.floor,sl=e=>({x:e,y:e});function PE(e){const t=Ra(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ra(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=wm(n)!==s||wm(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function ai(e){return e instanceof Element||e instanceof ss(e).Element}function Wy(e){return ai(e)?e:e.contextElement}function lu(e){const t=Wy(e);if(!ra(t))return sl(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=PE(t);let i=(s?wm(n.width):n.width)/r,c=(s?wm(n.height):n.height)/o;return i&&Number.isFinite(i)||(i=1),c&&Number.isFinite(c)||(c=1),{x:i,y:c}}const xX=sl(0);function EE(e){const t=ss(e);return Hy()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:xX}function Kl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Wy(e);let i=sl(1);t&&(r?ai(r)&&(i=lu(r)):i=lu(e));const c=function(g,b,y){return b===void 0&&(b=!1),!(!y||b&&y!==ss(g))&&b}(s,n,r)?EE(s):sl(0);let d=(o.left+c.x)/i.x,p=(o.top+c.y)/i.y,h=o.width/i.x,m=o.height/i.y;if(s){const g=ss(s),b=r&&ai(r)?ss(r):r;let y=g.frameElement;for(;y&&r&&b!==g;){const x=lu(y),C=y.getBoundingClientRect(),S=getComputedStyle(y),j=C.left+(y.clientLeft+parseFloat(S.paddingLeft))*x.x,_=C.top+(y.clientTop+parseFloat(S.paddingTop))*x.y;d*=x.x,p*=x.y,h*=x.x,m*=x.y,d+=j,p+=_,y=ss(y).frameElement}}return wu({width:h,height:m,x:d,y:p})}function Kg(e){return ai(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ii(e){var t;return(t=(IE(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ME(e){return Kl(ii(e)).left+Kg(e).scrollLeft}function Su(e){if(ol(e)==="html")return e;const t=e.assignedSlot||e.parentNode||I4(e)&&e.host||ii(e);return I4(t)?t.host:t}function OE(e){const t=Su(e);return qg(t)?e.ownerDocument?e.ownerDocument.body:e.body:ra(t)&&ef(t)?t:OE(t)}function Sm(e,t){var n;t===void 0&&(t=[]);const r=OE(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=ss(r);return o?t.concat(s,s.visualViewport||[],ef(r)?r:[]):t.concat(r,Sm(r))}function P4(e,t,n){let r;if(t==="viewport")r=function(o,s){const i=ss(o),c=ii(o),d=i.visualViewport;let p=c.clientWidth,h=c.clientHeight,m=0,g=0;if(d){p=d.width,h=d.height;const b=Hy();(!b||b&&s==="fixed")&&(m=d.offsetLeft,g=d.offsetTop)}return{width:p,height:h,x:m,y:g}}(e,n);else if(t==="document")r=function(o){const s=ii(o),i=Kg(o),c=o.ownerDocument.body,d=iu(s.scrollWidth,s.clientWidth,c.scrollWidth,c.clientWidth),p=iu(s.scrollHeight,s.clientHeight,c.scrollHeight,c.clientHeight);let h=-i.scrollLeft+ME(o);const m=-i.scrollTop;return Ra(c).direction==="rtl"&&(h+=iu(s.clientWidth,c.clientWidth)-d),{width:d,height:p,x:h,y:m}}(ii(e));else if(ai(t))r=function(o,s){const i=Kl(o,!0,s==="fixed"),c=i.top+o.clientTop,d=i.left+o.clientLeft,p=ra(o)?lu(o):sl(1);return{width:o.clientWidth*p.x,height:o.clientHeight*p.y,x:d*p.x,y:c*p.y}}(t,n);else{const o=EE(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return wu(r)}function RE(e,t){const n=Su(e);return!(n===t||!ai(n)||qg(n))&&(Ra(n).position==="fixed"||RE(n,t))}function yX(e,t,n){const r=ra(t),o=ii(t),s=n==="fixed",i=Kl(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const d=sl(0);if(r||!r&&!s)if((ol(t)!=="body"||ef(o))&&(c=Kg(t)),ra(t)){const p=Kl(t,!0,s,t);d.x=p.x+t.clientLeft,d.y=p.y+t.clientTop}else o&&(d.x=ME(o));return{x:i.left+c.scrollLeft-d.x,y:i.top+c.scrollTop-d.y,width:i.width,height:i.height}}function E4(e,t){return ra(e)&&Ra(e).position!=="fixed"?t?t(e):e.offsetParent:null}function M4(e,t){const n=ss(e);if(!ra(e))return n;let r=E4(e,t);for(;r&&bX(r)&&Ra(r).position==="static";)r=E4(r,t);return r&&(ol(r)==="html"||ol(r)==="body"&&Ra(r).position==="static"&&!zb(r))?n:r||function(o){let s=Su(o);for(;ra(s)&&!qg(s);){if(zb(s))return s;s=Su(s)}return null}(e)||n}const CX={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=ra(n),s=ii(n);if(n===s)return t;let i={scrollLeft:0,scrollTop:0},c=sl(1);const d=sl(0);if((o||!o&&r!=="fixed")&&((ol(n)!=="body"||ef(s))&&(i=Kg(n)),ra(n))){const p=Kl(n);c=lu(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-i.scrollLeft*c.x+d.x,y:t.y*c.y-i.scrollTop*c.y+d.y}},getDocumentElement:ii,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?function(d,p){const h=p.get(d);if(h)return h;let m=Sm(d).filter(x=>ai(x)&&ol(x)!=="body"),g=null;const b=Ra(d).position==="fixed";let y=b?Su(d):d;for(;ai(y)&&!qg(y);){const x=Ra(y),C=zb(y);C||x.position!=="fixed"||(g=null),(b?!C&&!g:!C&&x.position==="static"&&g&&["absolute","fixed"].includes(g.position)||ef(y)&&!C&&RE(d,y))?m=m.filter(S=>S!==y):g=x,y=Su(y)}return p.set(d,m),m}(t,this._c):[].concat(n),r],i=s[0],c=s.reduce((d,p)=>{const h=P4(t,p,o);return d.top=iu(h.top,d.top),d.right=Fb(h.right,d.right),d.bottom=Fb(h.bottom,d.bottom),d.left=iu(h.left,d.left),d},P4(t,i,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:M4,getElementRects:async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||M4,s=this.getDimensions;return{reference:yX(t,await o(n),r),floating:{x:0,y:0,...await s(n)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){return PE(e)},getScale:lu,isElement:ai,isRTL:function(e){return getComputedStyle(e).direction==="rtl"}};function wX(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,p=Wy(e),h=o||s?[...p?Sm(p):[],...Sm(t)]:[];h.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const m=p&&c?function(C,S){let j,_=null;const I=ii(C);function P(){clearTimeout(j),_&&_.disconnect(),_=null}return function M(R,A){R===void 0&&(R=!1),A===void 0&&(A=1),P();const{left:D,top:O,width:T,height:Y}=C.getBoundingClientRect();if(R||S(),!T||!Y)return;const z={rootMargin:-Zp(O)+"px "+-Zp(I.clientWidth-(D+T))+"px "+-Zp(I.clientHeight-(O+Y))+"px "+-Zp(D)+"px",threshold:iu(0,Fb(1,A))||1};let W=!0;function Q(U){const L=U[0].intersectionRatio;if(L!==A){if(!W)return M();L?M(!1,L):j=setTimeout(()=>{M(!1,1e-7)},100)}W=!1}try{_=new IntersectionObserver(Q,{...z,root:I.ownerDocument})}catch{_=new IntersectionObserver(Q,z)}_.observe(C)}(!0),P}(p,n):null;let g,b=-1,y=null;i&&(y=new ResizeObserver(C=>{let[S]=C;S&&S.target===p&&y&&(y.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{y&&y.observe(t)})),n()}),p&&!d&&y.observe(p),y.observe(t));let x=d?Kl(e):null;return d&&function C(){const S=Kl(e);!x||S.x===x.x&&S.y===x.y&&S.width===x.width&&S.height===x.height||n(),x=S,g=requestAnimationFrame(C)}(),n(),()=>{h.forEach(C=>{o&&C.removeEventListener("scroll",n),s&&C.removeEventListener("resize",n)}),m&&m(),y&&y.disconnect(),y=null,d&&cancelAnimationFrame(g)}}const SX=(e,t,n)=>{const r=new Map,o={platform:CX,...n},s={...o.platform,_c:r};return iX(e,t,{...o,platform:s})},kX=e=>{const{element:t,padding:n}=e;function r(o){return Object.prototype.hasOwnProperty.call(o,"current")}return{name:"arrow",options:e,fn(o){return r(t)?t.current!=null?j4({element:t.current,padding:n}).fn(o):{}:t?j4({element:t,padding:n}).fn(o):{}}}};var Rh=typeof document<"u"?l.useLayoutEffect:l.useEffect;function km(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!km(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!km(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function O4(e){const t=l.useRef(e);return Rh(()=>{t.current=e}),t}function jX(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:s,open:i}=e,[c,d]=l.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=l.useState(r);km(p,r)||h(r);const m=l.useRef(null),g=l.useRef(null),b=l.useRef(c),y=O4(s),x=O4(o),[C,S]=l.useState(null),[j,_]=l.useState(null),I=l.useCallback(O=>{m.current!==O&&(m.current=O,S(O))},[]),P=l.useCallback(O=>{g.current!==O&&(g.current=O,_(O))},[]),M=l.useCallback(()=>{if(!m.current||!g.current)return;const O={placement:t,strategy:n,middleware:p};x.current&&(O.platform=x.current),SX(m.current,g.current,O).then(T=>{const Y={...T,isPositioned:!0};R.current&&!km(b.current,Y)&&(b.current=Y,rs.flushSync(()=>{d(Y)}))})},[p,t,n,x]);Rh(()=>{i===!1&&b.current.isPositioned&&(b.current.isPositioned=!1,d(O=>({...O,isPositioned:!1})))},[i]);const R=l.useRef(!1);Rh(()=>(R.current=!0,()=>{R.current=!1}),[]),Rh(()=>{if(C&&j){if(y.current)return y.current(C,j,M);M()}},[C,j,M,y]);const A=l.useMemo(()=>({reference:m,floating:g,setReference:I,setFloating:P}),[I,P]),D=l.useMemo(()=>({reference:C,floating:j}),[C,j]);return l.useMemo(()=>({...c,update:M,refs:A,elements:D,reference:I,floating:P}),[c,M,A,D,I,P])}var _X=typeof document<"u"?l.useLayoutEffect:l.useEffect;function IX(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(r=>r!==n))}}}const PX=l.createContext(null),EX=()=>l.useContext(PX);function MX(e){return(e==null?void 0:e.ownerDocument)||document}function OX(e){return MX(e).defaultView||window}function eh(e){return e?e instanceof OX(e).Element:!1}const RX=yx["useInsertionEffect".toString()],AX=RX||(e=>e());function DX(e){const t=l.useRef(()=>{});return AX(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;oIX())[0],[p,h]=l.useState(null),m=l.useCallback(S=>{const j=eh(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;o.refs.setReference(j)},[o.refs]),g=l.useCallback(S=>{(eh(S)||S===null)&&(i.current=S,h(S)),(eh(o.refs.reference.current)||o.refs.reference.current===null||S!==null&&!eh(S))&&o.refs.setReference(S)},[o.refs]),b=l.useMemo(()=>({...o.refs,setReference:g,setPositionReference:m,domReference:i}),[o.refs,g,m]),y=l.useMemo(()=>({...o.elements,domReference:p}),[o.elements,p]),x=DX(n),C=l.useMemo(()=>({...o,refs:b,elements:y,dataRef:c,nodeId:r,events:d,open:t,onOpenChange:x}),[o,r,d,t,x,b,y]);return _X(()=>{const S=s==null?void 0:s.nodesRef.current.find(j=>j.id===r);S&&(S.context=C)}),l.useMemo(()=>({...o,context:C,refs:b,reference:g,positionReference:m}),[o,b,C,g,m])}function NX({opened:e,floating:t,position:n,positionDependencies:r}){const[o,s]=l.useState(0);l.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return wX(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),Js(()=>{t.update()},r),Js(()=>{s(i=>i+1)},[e])}function $X(e){const t=[hX(e.offset)];return e.middlewares.shift&&t.push(mX({limiter:gX()})),e.middlewares.flip&&t.push(fX()),e.middlewares.inline&&t.push(pX()),t.push(kX({element:e.arrowRef,padding:e.arrowOffset})),t}function LX(e){const[t,n]=Zd({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=()=>{var i;(i=e.onClose)==null||i.call(e),n(!1)},o=()=>{var i,c;t?((i=e.onClose)==null||i.call(e),n(!1)):((c=e.onOpen)==null||c.call(e),n(!0))},s=TX({placement:e.position,middleware:[...$X(e),...e.width==="target"?[vX({apply({rects:i}){var c,d;Object.assign((d=(c=s.refs.floating.current)==null?void 0:c.style)!=null?d:{},{width:`${i.reference.width}px`})}})]:[]]});return NX({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies,floating:s}),Js(()=>{var i;(i=e.onPositionChange)==null||i.call(e,s.placement)},[s.placement]),Js(()=>{var i,c;e.opened?(c=e.onOpen)==null||c.call(e):(i=e.onClose)==null||i.call(e)},[e.opened]),{floating:s,controlled:typeof e.opened=="boolean",opened:t,onClose:r,onToggle:o}}const AE={context:"Popover component was not found in the tree",children:"Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"},[zX,DE]=_G(AE.context);var FX=Object.defineProperty,BX=Object.defineProperties,HX=Object.getOwnPropertyDescriptors,jm=Object.getOwnPropertySymbols,TE=Object.prototype.hasOwnProperty,NE=Object.prototype.propertyIsEnumerable,R4=(e,t,n)=>t in e?FX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,th=(e,t)=>{for(var n in t||(t={}))TE.call(t,n)&&R4(e,n,t[n]);if(jm)for(var n of jm(t))NE.call(t,n)&&R4(e,n,t[n]);return e},WX=(e,t)=>BX(e,HX(t)),VX=(e,t)=>{var n={};for(var r in e)TE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&jm)for(var r of jm(e))t.indexOf(r)<0&&NE.call(e,r)&&(n[r]=e[r]);return n};const UX={refProp:"ref",popupType:"dialog"},$E=l.forwardRef((e,t)=>{const n=Nr("PopoverTarget",UX,e),{children:r,refProp:o,popupType:s}=n,i=VX(n,["children","refProp","popupType"]);if(!d6(r))throw new Error(AE.children);const c=i,d=DE(),p=zf(d.reference,r.ref,t),h=d.withRoles?{"aria-haspopup":s,"aria-expanded":d.opened,"aria-controls":d.getDropdownId(),id:d.getTargetId()}:{};return l.cloneElement(r,th(WX(th(th(th({},c),h),d.targetProps),{className:p6(d.targetProps.className,c.className,r.props.className),[o]:p}),d.controlled?null:{onClick:d.onToggle}))});$E.displayName="@mantine/core/PopoverTarget";var GX=Co((e,{radius:t,shadow:n})=>({dropdown:{position:"absolute",backgroundColor:e.white,background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${Ge(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,padding:`${e.spacing.sm} ${e.spacing.md}`,boxShadow:e.shadows[n]||n||"none",borderRadius:e.fn.radius(t),"&:focus":{outline:0}},arrow:{backgroundColor:"inherit",border:`${Ge(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,zIndex:1}}));const qX=GX;var KX=Object.defineProperty,A4=Object.getOwnPropertySymbols,QX=Object.prototype.hasOwnProperty,XX=Object.prototype.propertyIsEnumerable,D4=(e,t,n)=>t in e?KX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mc=(e,t)=>{for(var n in t||(t={}))QX.call(t,n)&&D4(e,n,t[n]);if(A4)for(var n of A4(t))XX.call(t,n)&&D4(e,n,t[n]);return e};const T4={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function YX({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in qp?Mc(Mc(Mc({transitionProperty:qp[e].transitionProperty},o),qp[e].common),qp[e][T4[t]]):null:Mc(Mc(Mc({transitionProperty:e.transitionProperty},o),e.common),e[T4[t]])}function JX({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:i,onExited:c}){const d=ki(),p=y6(),h=d.respectReducedMotion?p:!1,[m,g]=l.useState(h?0:e),[b,y]=l.useState(r?"entered":"exited"),x=l.useRef(-1),C=S=>{const j=S?o:s,_=S?i:c;y(S?"pre-entering":"pre-exiting"),window.clearTimeout(x.current);const I=h?0:S?e:t;if(g(I),I===0)typeof j=="function"&&j(),typeof _=="function"&&_(),y(S?"entered":"exited");else{const P=window.setTimeout(()=>{typeof j=="function"&&j(),y(S?"entering":"exiting")},10);x.current=window.setTimeout(()=>{window.clearTimeout(P),typeof _=="function"&&_(),y(S?"entered":"exited")},I)}};return Js(()=>{C(r)},[r]),l.useEffect(()=>()=>window.clearTimeout(x.current),[]),{transitionDuration:m,transitionStatus:b,transitionTimingFunction:n||d.transitionTimingFunction}}function LE({keepMounted:e,transition:t,duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:i,onExit:c,onEntered:d,onEnter:p,onExited:h}){const{transitionDuration:m,transitionStatus:g,transitionTimingFunction:b}=JX({mounted:o,exitDuration:r,duration:n,timingFunction:i,onExit:c,onEntered:d,onEnter:p,onExited:h});return m===0?o?B.createElement(B.Fragment,null,s({})):e?s({display:"none"}):null:g==="exited"?e?s({display:"none"}):null:B.createElement(B.Fragment,null,s(YX({transition:t,duration:m,state:g,timingFunction:b})))}LE.displayName="@mantine/core/Transition";function zE({children:e,active:t=!0,refProp:n="ref"}){const r=aq(t),o=zf(r,e==null?void 0:e.ref);return d6(e)?l.cloneElement(e,{[n]:o}):e}zE.displayName="@mantine/core/FocusTrap";var ZX=Object.defineProperty,eY=Object.defineProperties,tY=Object.getOwnPropertyDescriptors,N4=Object.getOwnPropertySymbols,nY=Object.prototype.hasOwnProperty,rY=Object.prototype.propertyIsEnumerable,$4=(e,t,n)=>t in e?ZX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Li=(e,t)=>{for(var n in t||(t={}))nY.call(t,n)&&$4(e,n,t[n]);if(N4)for(var n of N4(t))rY.call(t,n)&&$4(e,n,t[n]);return e},nh=(e,t)=>eY(e,tY(t));function L4(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function z4(e,t,n,r,o){return e==="center"||r==="center"?{left:t}:e==="end"?{[o==="ltr"?"right":"left"]:n}:e==="start"?{[o==="ltr"?"left":"right"]:n}:{}}const oY={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function sY({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:i,dir:c}){const[d,p="center"]=e.split("-"),h={width:Ge(t),height:Ge(t),transform:"rotate(45deg)",position:"absolute",[oY[d]]:Ge(r)},m=Ge(-t/2);return d==="left"?nh(Li(Li({},h),L4(p,i,n,o)),{right:m,borderLeftColor:"transparent",borderBottomColor:"transparent"}):d==="right"?nh(Li(Li({},h),L4(p,i,n,o)),{left:m,borderRightColor:"transparent",borderTopColor:"transparent"}):d==="top"?nh(Li(Li({},h),z4(p,s,n,o,c)),{bottom:m,borderTopColor:"transparent",borderLeftColor:"transparent"}):d==="bottom"?nh(Li(Li({},h),z4(p,s,n,o,c)),{top:m,borderBottomColor:"transparent",borderRightColor:"transparent"}):{}}var aY=Object.defineProperty,iY=Object.defineProperties,lY=Object.getOwnPropertyDescriptors,_m=Object.getOwnPropertySymbols,FE=Object.prototype.hasOwnProperty,BE=Object.prototype.propertyIsEnumerable,F4=(e,t,n)=>t in e?aY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cY=(e,t)=>{for(var n in t||(t={}))FE.call(t,n)&&F4(e,n,t[n]);if(_m)for(var n of _m(t))BE.call(t,n)&&F4(e,n,t[n]);return e},uY=(e,t)=>iY(e,lY(t)),dY=(e,t)=>{var n={};for(var r in e)FE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_m)for(var r of _m(e))t.indexOf(r)<0&&BE.call(e,r)&&(n[r]=e[r]);return n};const HE=l.forwardRef((e,t)=>{var n=e,{position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:c,visible:d,arrowX:p,arrowY:h}=n,m=dY(n,["position","arrowSize","arrowOffset","arrowRadius","arrowPosition","visible","arrowX","arrowY"]);const g=ki();return d?B.createElement("div",uY(cY({},m),{ref:t,style:sY({position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:c,dir:g.dir,arrowX:p,arrowY:h})})):null});HE.displayName="@mantine/core/FloatingArrow";var fY=Object.defineProperty,pY=Object.defineProperties,hY=Object.getOwnPropertyDescriptors,Im=Object.getOwnPropertySymbols,WE=Object.prototype.hasOwnProperty,VE=Object.prototype.propertyIsEnumerable,B4=(e,t,n)=>t in e?fY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oc=(e,t)=>{for(var n in t||(t={}))WE.call(t,n)&&B4(e,n,t[n]);if(Im)for(var n of Im(t))VE.call(t,n)&&B4(e,n,t[n]);return e},rh=(e,t)=>pY(e,hY(t)),mY=(e,t)=>{var n={};for(var r in e)WE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Im)for(var r of Im(e))t.indexOf(r)<0&&VE.call(e,r)&&(n[r]=e[r]);return n};const gY={};function UE(e){var t;const n=Nr("PopoverDropdown",gY,e),{style:r,className:o,children:s,onKeyDownCapture:i}=n,c=mY(n,["style","className","children","onKeyDownCapture"]),d=DE(),{classes:p,cx:h}=qX({radius:d.radius,shadow:d.shadow},{name:d.__staticSelector,classNames:d.classNames,styles:d.styles,unstyled:d.unstyled,variant:d.variant}),m=ZG({opened:d.opened,shouldReturnFocus:d.returnFocus}),g=d.withRoles?{"aria-labelledby":d.getTargetId(),id:d.getDropdownId(),role:"dialog"}:{};return d.disabled?null:B.createElement(U6,rh(Oc({},d.portalProps),{withinPortal:d.withinPortal}),B.createElement(LE,rh(Oc({mounted:d.opened},d.transitionProps),{transition:d.transitionProps.transition||"fade",duration:(t=d.transitionProps.duration)!=null?t:150,keepMounted:d.keepMounted,exitDuration:typeof d.transitionProps.exitDuration=="number"?d.transitionProps.exitDuration:d.transitionProps.duration}),b=>{var y,x;return B.createElement(zE,{active:d.trapFocus},B.createElement(Go,Oc(rh(Oc({},g),{tabIndex:-1,ref:d.floating,style:rh(Oc(Oc({},r),b),{zIndex:d.zIndex,top:(y=d.y)!=null?y:0,left:(x=d.x)!=null?x:0,width:d.width==="target"?void 0:Ge(d.width)}),className:h(p.dropdown,o),onKeyDownCapture:PG(d.onClose,{active:d.closeOnEscape,onTrigger:m,onKeyDown:i}),"data-position":d.placement}),c),s,B.createElement(HE,{ref:d.arrowRef,arrowX:d.arrowX,arrowY:d.arrowY,visible:d.withArrow,position:d.placement,arrowSize:d.arrowSize,arrowRadius:d.arrowRadius,arrowOffset:d.arrowOffset,arrowPosition:d.arrowPosition,className:p.arrow})))}))}UE.displayName="@mantine/core/PopoverDropdown";function vY(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[n,r]=t.split("-"),o=n==="right"?"left":"right";return r===void 0?o:`${o}-${r}`}return t}var H4=Object.getOwnPropertySymbols,bY=Object.prototype.hasOwnProperty,xY=Object.prototype.propertyIsEnumerable,yY=(e,t)=>{var n={};for(var r in e)bY.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&H4)for(var r of H4(e))t.indexOf(r)<0&&xY.call(e,r)&&(n[r]=e[r]);return n};const CY={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!1,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,clickOutsideEvents:["mousedown","touchstart"],zIndex:Ay("popover"),__staticSelector:"Popover",width:"max-content"};function Bu(e){var t,n,r,o,s,i;const c=l.useRef(null),d=Nr("Popover",CY,e),{children:p,position:h,offset:m,onPositionChange:g,positionDependencies:b,opened:y,transitionProps:x,width:C,middlewares:S,withArrow:j,arrowSize:_,arrowOffset:I,arrowRadius:P,arrowPosition:M,unstyled:R,classNames:A,styles:D,closeOnClickOutside:O,withinPortal:T,portalProps:Y,closeOnEscape:z,clickOutsideEvents:W,trapFocus:Q,onClose:U,onOpen:L,onChange:ee,zIndex:K,radius:Z,shadow:se,id:fe,defaultOpened:G,__staticSelector:te,withRoles:V,disabled:F,returnFocus:X,variant:ue,keepMounted:q}=d,ne=yY(d,["children","position","offset","onPositionChange","positionDependencies","opened","transitionProps","width","middlewares","withArrow","arrowSize","arrowOffset","arrowRadius","arrowPosition","unstyled","classNames","styles","closeOnClickOutside","withinPortal","portalProps","closeOnEscape","clickOutsideEvents","trapFocus","onClose","onOpen","onChange","zIndex","radius","shadow","id","defaultOpened","__staticSelector","withRoles","disabled","returnFocus","variant","keepMounted"]),[pe,le]=l.useState(null),[we,ve]=l.useState(null),he=Ty(fe),Ne=ki(),De=LX({middlewares:S,width:C,position:vY(Ne.dir,h),offset:typeof m=="number"?m+(j?_/2:0):m,arrowRef:c,arrowOffset:I,onPositionChange:g,positionDependencies:b,opened:y,defaultOpened:G,onChange:ee,onOpen:L,onClose:U});QG(()=>De.opened&&O&&De.onClose(),W,[pe,we]);const qe=l.useCallback(ot=>{le(ot),De.floating.reference(ot)},[De.floating.reference]),Mt=l.useCallback(ot=>{ve(ot),De.floating.floating(ot)},[De.floating.floating]);return B.createElement(zX,{value:{returnFocus:X,disabled:F,controlled:De.controlled,reference:qe,floating:Mt,x:De.floating.x,y:De.floating.y,arrowX:(r=(n=(t=De.floating)==null?void 0:t.middlewareData)==null?void 0:n.arrow)==null?void 0:r.x,arrowY:(i=(s=(o=De.floating)==null?void 0:o.middlewareData)==null?void 0:s.arrow)==null?void 0:i.y,opened:De.opened,arrowRef:c,transitionProps:x,width:C,withArrow:j,arrowSize:_,arrowOffset:I,arrowRadius:P,arrowPosition:M,placement:De.floating.placement,trapFocus:Q,withinPortal:T,portalProps:Y,zIndex:K,radius:Z,shadow:se,closeOnEscape:z,onClose:De.onClose,onToggle:De.onToggle,getTargetId:()=>`${he}-target`,getDropdownId:()=>`${he}-dropdown`,withRoles:V,targetProps:ne,__staticSelector:te,classNames:A,styles:D,unstyled:R,variant:ue,keepMounted:q}},p)}Bu.Target=$E;Bu.Dropdown=UE;Bu.displayName="@mantine/core/Popover";var wY=Object.defineProperty,Pm=Object.getOwnPropertySymbols,GE=Object.prototype.hasOwnProperty,qE=Object.prototype.propertyIsEnumerable,W4=(e,t,n)=>t in e?wY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SY=(e,t)=>{for(var n in t||(t={}))GE.call(t,n)&&W4(e,n,t[n]);if(Pm)for(var n of Pm(t))qE.call(t,n)&&W4(e,n,t[n]);return e},kY=(e,t)=>{var n={};for(var r in e)GE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Pm)for(var r of Pm(e))t.indexOf(r)<0&&qE.call(e,r)&&(n[r]=e[r]);return n};function jY(e){var t=e,{children:n,component:r="div",maxHeight:o=220,direction:s="column",id:i,innerRef:c,__staticSelector:d,styles:p,classNames:h,unstyled:m}=t,g=kY(t,["children","component","maxHeight","direction","id","innerRef","__staticSelector","styles","classNames","unstyled"]);const{classes:b}=aX(null,{name:d,styles:p,classNames:h,unstyled:m});return B.createElement(Bu.Dropdown,SY({p:0,onMouseDown:y=>y.preventDefault()},g),B.createElement("div",{style:{maxHeight:Ge(o),display:"flex"}},B.createElement(Go,{component:r||"div",id:`${i}-items`,"aria-labelledby":`${i}-label`,role:"listbox",onMouseDown:y=>y.preventDefault(),style:{flex:1,overflowY:r!==Gg?"auto":void 0},"data-combobox-popover":!0,tabIndex:-1,ref:c},B.createElement("div",{className:b.itemsWrapper,style:{flexDirection:s}},n))))}function Qi({opened:e,transitionProps:t={transition:"fade",duration:0},shadow:n,withinPortal:r,portalProps:o,children:s,__staticSelector:i,onDirectionChange:c,switchDirectionOnFlip:d,zIndex:p,dropdownPosition:h,positionDependencies:m=[],classNames:g,styles:b,unstyled:y,readOnly:x,variant:C}){return B.createElement(Bu,{unstyled:y,classNames:g,styles:b,width:"target",withRoles:!1,opened:e,middlewares:{flip:h==="flip",shift:!1},position:h==="flip"?"bottom":h,positionDependencies:m,zIndex:p,__staticSelector:i,withinPortal:r,portalProps:o,transitionProps:t,shadow:n,disabled:x,onPositionChange:S=>d&&(c==null?void 0:c(S==="top"?"column-reverse":"column")),variant:C},s)}Qi.Target=Bu.Target;Qi.Dropdown=jY;var _Y=Object.defineProperty,IY=Object.defineProperties,PY=Object.getOwnPropertyDescriptors,Em=Object.getOwnPropertySymbols,KE=Object.prototype.hasOwnProperty,QE=Object.prototype.propertyIsEnumerable,V4=(e,t,n)=>t in e?_Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oh=(e,t)=>{for(var n in t||(t={}))KE.call(t,n)&&V4(e,n,t[n]);if(Em)for(var n of Em(t))QE.call(t,n)&&V4(e,n,t[n]);return e},EY=(e,t)=>IY(e,PY(t)),MY=(e,t)=>{var n={};for(var r in e)KE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Em)for(var r of Em(e))t.indexOf(r)<0&&QE.call(e,r)&&(n[r]=e[r]);return n};function XE(e,t,n){const r=Nr(e,t,n),{label:o,description:s,error:i,required:c,classNames:d,styles:p,className:h,unstyled:m,__staticSelector:g,sx:b,errorProps:y,labelProps:x,descriptionProps:C,wrapperProps:S,id:j,size:_,style:I,inputContainer:P,inputWrapperOrder:M,withAsterisk:R,variant:A}=r,D=MY(r,["label","description","error","required","classNames","styles","className","unstyled","__staticSelector","sx","errorProps","labelProps","descriptionProps","wrapperProps","id","size","style","inputContainer","inputWrapperOrder","withAsterisk","variant"]),O=Ty(j),{systemStyles:T,rest:Y}=Hg(D),z=oh({label:o,description:s,error:i,required:c,classNames:d,className:h,__staticSelector:g,sx:b,errorProps:y,labelProps:x,descriptionProps:C,unstyled:m,styles:p,id:O,size:_,style:I,inputContainer:P,inputWrapperOrder:M,withAsterisk:R,variant:A},S);return EY(oh({},Y),{classNames:d,styles:p,unstyled:m,wrapperProps:oh(oh({},z),T),inputProps:{required:c,classNames:d,styles:p,unstyled:m,id:O,size:_,__staticSelector:g,error:i,variant:A}})}var OY=Co((e,t,{size:n})=>({label:{display:"inline-block",fontSize:Xt({size:n,sizes:e.fontSizes}),fontWeight:500,color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[9],wordBreak:"break-word",cursor:"default",WebkitTapHighlightColor:"transparent"},required:{color:e.fn.variant({variant:"filled",color:"red"}).background}}));const RY=OY;var AY=Object.defineProperty,Mm=Object.getOwnPropertySymbols,YE=Object.prototype.hasOwnProperty,JE=Object.prototype.propertyIsEnumerable,U4=(e,t,n)=>t in e?AY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,DY=(e,t)=>{for(var n in t||(t={}))YE.call(t,n)&&U4(e,n,t[n]);if(Mm)for(var n of Mm(t))JE.call(t,n)&&U4(e,n,t[n]);return e},TY=(e,t)=>{var n={};for(var r in e)YE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mm)for(var r of Mm(e))t.indexOf(r)<0&&JE.call(e,r)&&(n[r]=e[r]);return n};const NY={labelElement:"label",size:"sm"},Vy=l.forwardRef((e,t)=>{const n=Nr("InputLabel",NY,e),{labelElement:r,children:o,required:s,size:i,classNames:c,styles:d,unstyled:p,className:h,htmlFor:m,__staticSelector:g,variant:b,onMouseDown:y}=n,x=TY(n,["labelElement","children","required","size","classNames","styles","unstyled","className","htmlFor","__staticSelector","variant","onMouseDown"]),{classes:C,cx:S}=RY(null,{name:["InputWrapper",g],classNames:c,styles:d,unstyled:p,variant:b,size:i});return B.createElement(Go,DY({component:r,ref:t,className:S(C.label,h),htmlFor:r==="label"?m:void 0,onMouseDown:j=>{y==null||y(j),!j.defaultPrevented&&j.detail>1&&j.preventDefault()}},x),o,s&&B.createElement("span",{className:C.required,"aria-hidden":!0}," *"))});Vy.displayName="@mantine/core/InputLabel";var $Y=Co((e,t,{size:n})=>({error:{wordBreak:"break-word",color:e.fn.variant({variant:"filled",color:"red"}).background,fontSize:`calc(${Xt({size:n,sizes:e.fontSizes})} - ${Ge(2)})`,lineHeight:1.2,display:"block"}}));const LY=$Y;var zY=Object.defineProperty,Om=Object.getOwnPropertySymbols,ZE=Object.prototype.hasOwnProperty,eM=Object.prototype.propertyIsEnumerable,G4=(e,t,n)=>t in e?zY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FY=(e,t)=>{for(var n in t||(t={}))ZE.call(t,n)&&G4(e,n,t[n]);if(Om)for(var n of Om(t))eM.call(t,n)&&G4(e,n,t[n]);return e},BY=(e,t)=>{var n={};for(var r in e)ZE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Om)for(var r of Om(e))t.indexOf(r)<0&&eM.call(e,r)&&(n[r]=e[r]);return n};const HY={size:"sm"},Uy=l.forwardRef((e,t)=>{const n=Nr("InputError",HY,e),{children:r,className:o,classNames:s,styles:i,unstyled:c,size:d,__staticSelector:p,variant:h}=n,m=BY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:b}=LY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:c,variant:h,size:d});return B.createElement(yu,FY({className:b(g.error,o),ref:t},m),r)});Uy.displayName="@mantine/core/InputError";var WY=Co((e,t,{size:n})=>({description:{wordBreak:"break-word",color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontSize:`calc(${Xt({size:n,sizes:e.fontSizes})} - ${Ge(2)})`,lineHeight:1.2,display:"block"}}));const VY=WY;var UY=Object.defineProperty,Rm=Object.getOwnPropertySymbols,tM=Object.prototype.hasOwnProperty,nM=Object.prototype.propertyIsEnumerable,q4=(e,t,n)=>t in e?UY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,GY=(e,t)=>{for(var n in t||(t={}))tM.call(t,n)&&q4(e,n,t[n]);if(Rm)for(var n of Rm(t))nM.call(t,n)&&q4(e,n,t[n]);return e},qY=(e,t)=>{var n={};for(var r in e)tM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Rm)for(var r of Rm(e))t.indexOf(r)<0&&nM.call(e,r)&&(n[r]=e[r]);return n};const KY={size:"sm"},Gy=l.forwardRef((e,t)=>{const n=Nr("InputDescription",KY,e),{children:r,className:o,classNames:s,styles:i,unstyled:c,size:d,__staticSelector:p,variant:h}=n,m=qY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:b}=VY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:c,variant:h,size:d});return B.createElement(yu,GY({color:"dimmed",className:b(g.description,o),ref:t,unstyled:c},m),r)});Gy.displayName="@mantine/core/InputDescription";const rM=l.createContext({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),QY=rM.Provider,XY=()=>l.useContext(rM);function YY(e,{hasDescription:t,hasError:n}){const r=e.findIndex(d=>d==="input"),o=e[r-1],s=e[r+1];return{offsetBottom:t&&s==="description"||n&&s==="error",offsetTop:t&&o==="description"||n&&o==="error"}}var JY=Object.defineProperty,ZY=Object.defineProperties,eJ=Object.getOwnPropertyDescriptors,K4=Object.getOwnPropertySymbols,tJ=Object.prototype.hasOwnProperty,nJ=Object.prototype.propertyIsEnumerable,Q4=(e,t,n)=>t in e?JY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rJ=(e,t)=>{for(var n in t||(t={}))tJ.call(t,n)&&Q4(e,n,t[n]);if(K4)for(var n of K4(t))nJ.call(t,n)&&Q4(e,n,t[n]);return e},oJ=(e,t)=>ZY(e,eJ(t)),sJ=Co(e=>({root:oJ(rJ({},e.fn.fontStyles()),{lineHeight:e.lineHeight})}));const aJ=sJ;var iJ=Object.defineProperty,lJ=Object.defineProperties,cJ=Object.getOwnPropertyDescriptors,Am=Object.getOwnPropertySymbols,oM=Object.prototype.hasOwnProperty,sM=Object.prototype.propertyIsEnumerable,X4=(e,t,n)=>t in e?iJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zi=(e,t)=>{for(var n in t||(t={}))oM.call(t,n)&&X4(e,n,t[n]);if(Am)for(var n of Am(t))sM.call(t,n)&&X4(e,n,t[n]);return e},Y4=(e,t)=>lJ(e,cJ(t)),uJ=(e,t)=>{var n={};for(var r in e)oM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Am)for(var r of Am(e))t.indexOf(r)<0&&sM.call(e,r)&&(n[r]=e[r]);return n};const dJ={labelElement:"label",size:"sm",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},aM=l.forwardRef((e,t)=>{const n=Nr("InputWrapper",dJ,e),{className:r,label:o,children:s,required:i,id:c,error:d,description:p,labelElement:h,labelProps:m,descriptionProps:g,errorProps:b,classNames:y,styles:x,size:C,inputContainer:S,__staticSelector:j,unstyled:_,inputWrapperOrder:I,withAsterisk:P,variant:M}=n,R=uJ(n,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","inputContainer","__staticSelector","unstyled","inputWrapperOrder","withAsterisk","variant"]),{classes:A,cx:D}=aJ(null,{classNames:y,styles:x,name:["InputWrapper",j],unstyled:_,variant:M,size:C}),O={classNames:y,styles:x,unstyled:_,size:C,variant:M,__staticSelector:j},T=typeof P=="boolean"?P:i,Y=c?`${c}-error`:b==null?void 0:b.id,z=c?`${c}-description`:g==null?void 0:g.id,Q=`${!!d&&typeof d!="boolean"?Y:""} ${p?z:""}`,U=Q.trim().length>0?Q.trim():void 0,L=o&&B.createElement(Vy,zi(zi({key:"label",labelElement:h,id:c?`${c}-label`:void 0,htmlFor:c,required:T},O),m),o),ee=p&&B.createElement(Gy,Y4(zi(zi({key:"description"},g),O),{size:(g==null?void 0:g.size)||O.size,id:(g==null?void 0:g.id)||z}),p),K=B.createElement(l.Fragment,{key:"input"},S(s)),Z=typeof d!="boolean"&&d&&B.createElement(Uy,Y4(zi(zi({},b),O),{size:(b==null?void 0:b.size)||O.size,key:"error",id:(b==null?void 0:b.id)||Y}),d),se=I.map(fe=>{switch(fe){case"label":return L;case"input":return K;case"description":return ee;case"error":return Z;default:return null}});return B.createElement(QY,{value:zi({describedBy:U},YY(I,{hasDescription:!!ee,hasError:!!Z}))},B.createElement(Go,zi({className:D(A.root,r),ref:t},R),se))});aM.displayName="@mantine/core/InputWrapper";var fJ=Object.defineProperty,Dm=Object.getOwnPropertySymbols,iM=Object.prototype.hasOwnProperty,lM=Object.prototype.propertyIsEnumerable,J4=(e,t,n)=>t in e?fJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pJ=(e,t)=>{for(var n in t||(t={}))iM.call(t,n)&&J4(e,n,t[n]);if(Dm)for(var n of Dm(t))lM.call(t,n)&&J4(e,n,t[n]);return e},hJ=(e,t)=>{var n={};for(var r in e)iM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Dm)for(var r of Dm(e))t.indexOf(r)<0&&lM.call(e,r)&&(n[r]=e[r]);return n};const mJ={},cM=l.forwardRef((e,t)=>{const n=Nr("InputPlaceholder",mJ,e),{sx:r}=n,o=hJ(n,["sx"]);return B.createElement(Go,pJ({component:"span",sx:[s=>s.fn.placeholderStyles(),...c6(r)],ref:t},o))});cM.displayName="@mantine/core/InputPlaceholder";var gJ=Object.defineProperty,vJ=Object.defineProperties,bJ=Object.getOwnPropertyDescriptors,Z4=Object.getOwnPropertySymbols,xJ=Object.prototype.hasOwnProperty,yJ=Object.prototype.propertyIsEnumerable,ej=(e,t,n)=>t in e?gJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sh=(e,t)=>{for(var n in t||(t={}))xJ.call(t,n)&&ej(e,n,t[n]);if(Z4)for(var n of Z4(t))yJ.call(t,n)&&ej(e,n,t[n]);return e},a1=(e,t)=>vJ(e,bJ(t));const bs={xs:Ge(30),sm:Ge(36),md:Ge(42),lg:Ge(50),xl:Ge(60)},CJ=["default","filled","unstyled"];function wJ({theme:e,variant:t}){return CJ.includes(t)?t==="default"?{border:`${Ge(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]}`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,transition:"border-color 100ms ease","&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:t==="filled"?{border:`${Ge(1)} solid transparent`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],"&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:{borderWidth:0,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,backgroundColor:"transparent",minHeight:Ge(28),outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}}:null}var SJ=Co((e,{multiline:t,radius:n,invalid:r,rightSectionWidth:o,withRightSection:s,iconWidth:i,offsetBottom:c,offsetTop:d,pointer:p},{variant:h,size:m})=>{const g=e.fn.variant({variant:"filled",color:"red"}).background,b=h==="default"||h==="filled"?{minHeight:Xt({size:m,sizes:bs}),paddingLeft:`calc(${Xt({size:m,sizes:bs})} / 3)`,paddingRight:s?o||Xt({size:m,sizes:bs}):`calc(${Xt({size:m,sizes:bs})} / 3)`,borderRadius:e.fn.radius(n)}:h==="unstyled"&&s?{paddingRight:o||Xt({size:m,sizes:bs})}:null;return{wrapper:{position:"relative",marginTop:d?`calc(${e.spacing.xs} / 2)`:void 0,marginBottom:c?`calc(${e.spacing.xs} / 2)`:void 0,"&:has(input:disabled)":{"& .mantine-Input-rightSection":{display:"none"}}},input:a1(sh(sh(a1(sh({},e.fn.fontStyles()),{height:t?h==="unstyled"?void 0:"auto":Xt({size:m,sizes:bs}),WebkitTapHighlightColor:"transparent",lineHeight:t?e.lineHeight:`calc(${Xt({size:m,sizes:bs})} - ${Ge(2)})`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:Xt({size:m,sizes:e.fontSizes}),width:"100%",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"block",textAlign:"left",cursor:p?"pointer":void 0}),wJ({theme:e,variant:h})),b),{"&:disabled, &[data-disabled]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,cursor:"not-allowed",pointerEvents:"none","&::placeholder":{color:e.colors.dark[2]}},"&[data-invalid]":{color:g,borderColor:g,"&::placeholder":{opacity:1,color:g}},"&[data-with-icon]":{paddingLeft:typeof i=="number"?Ge(i):Xt({size:m,sizes:bs})},"&::placeholder":a1(sh({},e.fn.placeholderStyles()),{opacity:1}),"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{appearance:"none"},"&[type=number]":{MozAppearance:"textfield"}}),icon:{pointerEvents:"none",position:"absolute",zIndex:1,left:0,top:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",width:i?Ge(i):Xt({size:m,sizes:bs}),color:r?e.colors.red[e.colorScheme==="dark"?6:7]:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[5]},rightSection:{position:"absolute",top:0,bottom:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:o||Xt({size:m,sizes:bs})}}});const kJ=SJ;var jJ=Object.defineProperty,_J=Object.defineProperties,IJ=Object.getOwnPropertyDescriptors,Tm=Object.getOwnPropertySymbols,uM=Object.prototype.hasOwnProperty,dM=Object.prototype.propertyIsEnumerable,tj=(e,t,n)=>t in e?jJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ah=(e,t)=>{for(var n in t||(t={}))uM.call(t,n)&&tj(e,n,t[n]);if(Tm)for(var n of Tm(t))dM.call(t,n)&&tj(e,n,t[n]);return e},nj=(e,t)=>_J(e,IJ(t)),PJ=(e,t)=>{var n={};for(var r in e)uM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Tm)for(var r of Tm(e))t.indexOf(r)<0&&dM.call(e,r)&&(n[r]=e[r]);return n};const EJ={size:"sm",variant:"default"},oc=l.forwardRef((e,t)=>{const n=Nr("Input",EJ,e),{className:r,error:o,required:s,disabled:i,variant:c,icon:d,style:p,rightSectionWidth:h,iconWidth:m,rightSection:g,rightSectionProps:b,radius:y,size:x,wrapperProps:C,classNames:S,styles:j,__staticSelector:_,multiline:I,sx:P,unstyled:M,pointer:R}=n,A=PJ(n,["className","error","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx","unstyled","pointer"]),{offsetBottom:D,offsetTop:O,describedBy:T}=XY(),{classes:Y,cx:z}=kJ({radius:y,multiline:I,invalid:!!o,rightSectionWidth:h?Ge(h):void 0,iconWidth:m,withRightSection:!!g,offsetBottom:D,offsetTop:O,pointer:R},{classNames:S,styles:j,name:["Input",_],unstyled:M,variant:c,size:x}),{systemStyles:W,rest:Q}=Hg(A);return B.createElement(Go,ah(ah({className:z(Y.wrapper,r),sx:P,style:p},W),C),d&&B.createElement("div",{className:Y.icon},d),B.createElement(Go,nj(ah({component:"input"},Q),{ref:t,required:s,"aria-invalid":!!o,"aria-describedby":T,disabled:i,"data-disabled":i||void 0,"data-with-icon":!!d||void 0,"data-invalid":!!o||void 0,className:Y.input})),g&&B.createElement("div",nj(ah({},b),{className:Y.rightSection}),g))});oc.displayName="@mantine/core/Input";oc.Wrapper=aM;oc.Label=Vy;oc.Description=Gy;oc.Error=Uy;oc.Placeholder=cM;const ku=oc;var MJ=Object.defineProperty,Nm=Object.getOwnPropertySymbols,fM=Object.prototype.hasOwnProperty,pM=Object.prototype.propertyIsEnumerable,rj=(e,t,n)=>t in e?MJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oj=(e,t)=>{for(var n in t||(t={}))fM.call(t,n)&&rj(e,n,t[n]);if(Nm)for(var n of Nm(t))pM.call(t,n)&&rj(e,n,t[n]);return e},OJ=(e,t)=>{var n={};for(var r in e)fM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Nm)for(var r of Nm(e))t.indexOf(r)<0&&pM.call(e,r)&&(n[r]=e[r]);return n};const RJ={multiple:!1},hM=l.forwardRef((e,t)=>{const n=Nr("FileButton",RJ,e),{onChange:r,children:o,multiple:s,accept:i,name:c,form:d,resetRef:p,disabled:h,capture:m,inputProps:g}=n,b=OJ(n,["onChange","children","multiple","accept","name","form","resetRef","disabled","capture","inputProps"]),y=l.useRef(),x=()=>{!h&&y.current.click()},C=j=>{r(s?Array.from(j.currentTarget.files):j.currentTarget.files[0]||null)};return x6(p,()=>{y.current.value=""}),B.createElement(B.Fragment,null,o(oj({onClick:x},b)),B.createElement("input",oj({style:{display:"none"},type:"file",accept:i,multiple:s,onChange:C,ref:zf(t,y),name:c,form:d,capture:m},g)))});hM.displayName="@mantine/core/FileButton";const mM={xs:Ge(16),sm:Ge(22),md:Ge(26),lg:Ge(30),xl:Ge(36)},AJ={xs:Ge(10),sm:Ge(12),md:Ge(14),lg:Ge(16),xl:Ge(18)};var DJ=Co((e,{disabled:t,radius:n,readOnly:r},{size:o,variant:s})=>({defaultValue:{display:"flex",alignItems:"center",backgroundColor:t?e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3]:e.colorScheme==="dark"?e.colors.dark[7]:s==="filled"?e.white:e.colors.gray[1],color:t?e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],height:Xt({size:o,sizes:mM}),paddingLeft:`calc(${Xt({size:o,sizes:e.spacing})} / 1.5)`,paddingRight:t||r?Xt({size:o,sizes:e.spacing}):0,fontWeight:500,fontSize:Xt({size:o,sizes:AJ}),borderRadius:Xt({size:n,sizes:e.radius}),cursor:t?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${Ge(10)})`},defaultValueRemove:{color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],marginLeft:`calc(${Xt({size:o,sizes:e.spacing})} / 6)`},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}));const TJ=DJ;var NJ=Object.defineProperty,$m=Object.getOwnPropertySymbols,gM=Object.prototype.hasOwnProperty,vM=Object.prototype.propertyIsEnumerable,sj=(e,t,n)=>t in e?NJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$J=(e,t)=>{for(var n in t||(t={}))gM.call(t,n)&&sj(e,n,t[n]);if($m)for(var n of $m(t))vM.call(t,n)&&sj(e,n,t[n]);return e},LJ=(e,t)=>{var n={};for(var r in e)gM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&$m)for(var r of $m(e))t.indexOf(r)<0&&vM.call(e,r)&&(n[r]=e[r]);return n};const zJ={xs:16,sm:22,md:24,lg:26,xl:30};function bM(e){var t=e,{label:n,classNames:r,styles:o,className:s,onRemove:i,disabled:c,readOnly:d,size:p,radius:h="sm",variant:m,unstyled:g}=t,b=LJ(t,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:y,cx:x}=TJ({disabled:c,readOnly:d,radius:h},{name:"MultiSelect",classNames:r,styles:o,unstyled:g,size:p,variant:m});return B.createElement("div",$J({className:x(y.defaultValue,s)},b),B.createElement("span",{className:y.defaultValueLabel},n),!c&&!d&&B.createElement(J6,{"aria-hidden":!0,onMouseDown:i,size:zJ[p],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:y.defaultValueRemove,tabIndex:-1,unstyled:g}))}bM.displayName="@mantine/core/MultiSelect/DefaultValue";function FJ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,disableSelectedItemFiltering:i}){if(!t&&s.length===0)return e;if(!t){const d=[];for(let p=0;ph===e[p].value&&!e[p].disabled))&&d.push(e[p]);return d}const c=[];for(let d=0;dp===e[d].value&&!e[d].disabled),e[d])&&c.push(e[d]),!(c.length>=n));d+=1);return c}var BJ=Object.defineProperty,Lm=Object.getOwnPropertySymbols,xM=Object.prototype.hasOwnProperty,yM=Object.prototype.propertyIsEnumerable,aj=(e,t,n)=>t in e?BJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ij=(e,t)=>{for(var n in t||(t={}))xM.call(t,n)&&aj(e,n,t[n]);if(Lm)for(var n of Lm(t))yM.call(t,n)&&aj(e,n,t[n]);return e},HJ=(e,t)=>{var n={};for(var r in e)xM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Lm)for(var r of Lm(e))t.indexOf(r)<0&&yM.call(e,r)&&(n[r]=e[r]);return n};const WJ={xs:Ge(14),sm:Ge(18),md:Ge(20),lg:Ge(24),xl:Ge(28)};function VJ(e){var t=e,{size:n,error:r,style:o}=t,s=HJ(t,["size","error","style"]);const i=ki(),c=Xt({size:n,sizes:WJ});return B.createElement("svg",ij({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:ij({color:r?i.colors.red[6]:i.colors.gray[6],width:c,height:c},o),"data-chevron":!0},s),B.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var UJ=Object.defineProperty,GJ=Object.defineProperties,qJ=Object.getOwnPropertyDescriptors,lj=Object.getOwnPropertySymbols,KJ=Object.prototype.hasOwnProperty,QJ=Object.prototype.propertyIsEnumerable,cj=(e,t,n)=>t in e?UJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,XJ=(e,t)=>{for(var n in t||(t={}))KJ.call(t,n)&&cj(e,n,t[n]);if(lj)for(var n of lj(t))QJ.call(t,n)&&cj(e,n,t[n]);return e},YJ=(e,t)=>GJ(e,qJ(t));function CM({shouldClear:e,clearButtonProps:t,onClear:n,size:r,error:o}){return e?B.createElement(J6,YJ(XJ({},t),{variant:"transparent",onClick:n,size:r,onMouseDown:s=>s.preventDefault()})):B.createElement(VJ,{error:o,size:r})}CM.displayName="@mantine/core/SelectRightSection";var JJ=Object.defineProperty,ZJ=Object.defineProperties,eZ=Object.getOwnPropertyDescriptors,zm=Object.getOwnPropertySymbols,wM=Object.prototype.hasOwnProperty,SM=Object.prototype.propertyIsEnumerable,uj=(e,t,n)=>t in e?JJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,i1=(e,t)=>{for(var n in t||(t={}))wM.call(t,n)&&uj(e,n,t[n]);if(zm)for(var n of zm(t))SM.call(t,n)&&uj(e,n,t[n]);return e},dj=(e,t)=>ZJ(e,eZ(t)),tZ=(e,t)=>{var n={};for(var r in e)wM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&zm)for(var r of zm(e))t.indexOf(r)<0&&SM.call(e,r)&&(n[r]=e[r]);return n};function kM(e){var t=e,{styles:n,rightSection:r,rightSectionWidth:o,theme:s}=t,i=tZ(t,["styles","rightSection","rightSectionWidth","theme"]);if(r)return{rightSection:r,rightSectionWidth:o,styles:n};const c=typeof n=="function"?n(s):n;return{rightSection:!i.readOnly&&!(i.disabled&&i.shouldClear)&&B.createElement(CM,i1({},i)),styles:dj(i1({},c),{rightSection:dj(i1({},c==null?void 0:c.rightSection),{pointerEvents:i.shouldClear?void 0:"none"})})}}var nZ=Object.defineProperty,rZ=Object.defineProperties,oZ=Object.getOwnPropertyDescriptors,fj=Object.getOwnPropertySymbols,sZ=Object.prototype.hasOwnProperty,aZ=Object.prototype.propertyIsEnumerable,pj=(e,t,n)=>t in e?nZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,iZ=(e,t)=>{for(var n in t||(t={}))sZ.call(t,n)&&pj(e,n,t[n]);if(fj)for(var n of fj(t))aZ.call(t,n)&&pj(e,n,t[n]);return e},lZ=(e,t)=>rZ(e,oZ(t)),cZ=Co((e,{invalid:t},{size:n})=>({wrapper:{position:"relative","&:has(input:disabled)":{cursor:"not-allowed",pointerEvents:"none","& .mantine-MultiSelect-input":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,"&::placeholder":{color:e.colors.dark[2]}},"& .mantine-MultiSelect-defaultValue":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3],color:e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]}}},values:{minHeight:`calc(${Xt({size:n,sizes:bs})} - ${Ge(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:Xt({size:n,sizes:bs})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${Ge(2)}) calc(${e.spacing.xs} / 2)`},searchInput:lZ(iZ({},e.fn.fontStyles()),{flex:1,minWidth:Ge(60),backgroundColor:"transparent",border:0,outline:0,fontSize:Xt({size:n,sizes:e.fontSizes}),padding:0,marginLeft:`calc(${e.spacing.xs} / 2)`,appearance:"none",color:"inherit",maxHeight:Xt({size:n,sizes:mM}),"&::placeholder":{opacity:1,color:t?e.colors.red[e.fn.primaryShade()]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}),searchInputEmpty:{width:"100%"},searchInputInputHidden:{flex:0,width:0,minWidth:0,margin:0,overflow:"hidden"},searchInputPointer:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}},input:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}}));const uZ=cZ;var dZ=Object.defineProperty,fZ=Object.defineProperties,pZ=Object.getOwnPropertyDescriptors,Fm=Object.getOwnPropertySymbols,jM=Object.prototype.hasOwnProperty,_M=Object.prototype.propertyIsEnumerable,hj=(e,t,n)=>t in e?dZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rc=(e,t)=>{for(var n in t||(t={}))jM.call(t,n)&&hj(e,n,t[n]);if(Fm)for(var n of Fm(t))_M.call(t,n)&&hj(e,n,t[n]);return e},mj=(e,t)=>fZ(e,pZ(t)),hZ=(e,t)=>{var n={};for(var r in e)jM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Fm)for(var r of Fm(e))t.indexOf(r)<0&&_M.call(e,r)&&(n[r]=e[r]);return n};function mZ(e,t,n){return t?!1:n.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function gZ(e,t){return!!e&&!t.some(n=>n.value.toLowerCase()===e.toLowerCase())}function gj(e,t){if(!Array.isArray(e))return;if(t.length===0)return[];const n=t.map(r=>typeof r=="object"?r.value:r);return e.filter(r=>n.includes(r))}const vZ={size:"sm",valueComponent:bM,itemComponent:$y,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:mZ,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:gZ,switchDirectionOnFlip:!1,zIndex:Ay("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},IM=l.forwardRef((e,t)=>{const n=Nr("MultiSelect",vZ,e),{className:r,style:o,required:s,label:i,description:c,size:d,error:p,classNames:h,styles:m,wrapperProps:g,value:b,defaultValue:y,data:x,onChange:C,valueComponent:S,itemComponent:j,id:_,transitionProps:I,maxDropdownHeight:P,shadow:M,nothingFound:R,onFocus:A,onBlur:D,searchable:O,placeholder:T,filter:Y,limit:z,clearSearchOnChange:W,clearable:Q,clearSearchOnBlur:U,variant:L,onSearchChange:ee,searchValue:K,disabled:Z,initiallyOpened:se,radius:fe,icon:G,rightSection:te,rightSectionWidth:V,creatable:F,getCreateLabel:X,shouldCreate:ue,onCreate:q,sx:ne,dropdownComponent:pe,onDropdownClose:le,onDropdownOpen:we,maxSelectedValues:ve,withinPortal:he,portalProps:Ne,switchDirectionOnFlip:De,zIndex:qe,selectOnBlur:Mt,name:ot,dropdownPosition:an,errorProps:pt,labelProps:vt,descriptionProps:ke,form:Be,positionDependencies:Ot,onKeyDown:Ht,unstyled:je,inputContainer:ht,inputWrapperOrder:At,readOnly:_t,withAsterisk:Re,clearButtonProps:Xe,hoverOnSearchChange:_n,disableSelectedItemFiltering:Me}=n,Ze=hZ(n,["className","style","required","label","description","size","error","classNames","styles","wrapperProps","value","defaultValue","data","onChange","valueComponent","itemComponent","id","transitionProps","maxDropdownHeight","shadow","nothingFound","onFocus","onBlur","searchable","placeholder","filter","limit","clearSearchOnChange","clearable","clearSearchOnBlur","variant","onSearchChange","searchValue","disabled","initiallyOpened","radius","icon","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","maxSelectedValues","withinPortal","portalProps","switchDirectionOnFlip","zIndex","selectOnBlur","name","dropdownPosition","errorProps","labelProps","descriptionProps","form","positionDependencies","onKeyDown","unstyled","inputContainer","inputWrapperOrder","readOnly","withAsterisk","clearButtonProps","hoverOnSearchChange","disableSelectedItemFiltering"]),{classes:Ye,cx:ut,theme:Ut}=uZ({invalid:!!p},{name:"MultiSelect",classNames:h,styles:m,unstyled:je,size:d,variant:L}),{systemStyles:xr,rest:yn}=Hg(Ze),hn=l.useRef(),oo=l.useRef({}),Dr=Ty(_),[nr,rr]=l.useState(se),[or,Xr]=l.useState(-1),[Xo,so]=l.useState("column"),[ao,$s]=Zd({value:K,defaultValue:"",finalValue:void 0,onChange:ee}),[Yr,ca]=l.useState(!1),{scrollIntoView:Ls,targetRef:Ua,scrollableRef:ua}=C6({duration:0,offset:5,cancelable:!1,isList:!0}),re=F&&typeof X=="function";let ie=null;const be=x.map(He=>typeof He=="string"?{label:He,value:He}:He),Pe=u6({data:be}),[xe,ft]=Zd({value:gj(b,x),defaultValue:gj(y,x),finalValue:[],onChange:C}),it=l.useRef(!!ve&&ve{if(!_t){const Ct=xe.filter(zt=>zt!==He);ft(Ct),ve&&Ct.length{$s(He.currentTarget.value),!Z&&!it.current&&O&&rr(!0)},wt=He=>{typeof A=="function"&&A(He),!Z&&!it.current&&O&&rr(!0)},We=FJ({data:Pe,searchable:O,searchValue:ao,limit:z,filter:Y,value:xe,disableSelectedItemFiltering:Me});re&&ue(ao,Pe)&&(ie=X(ao),We.push({label:ao,value:ao,creatable:!0}));const Ie=Math.min(or,We.length-1),et=(He,Ct,zt)=>{let Qt=He;for(;zt(Qt);)if(Qt=Ct(Qt),!We[Qt].disabled)return Qt;return He};Js(()=>{Xr(_n&&ao?0:-1)},[ao,_n]),Js(()=>{!Z&&xe.length>x.length&&rr(!1),ve&&xe.length=ve&&(it.current=!0,rr(!1))},[xe]);const Et=He=>{if(!_t)if(W&&$s(""),xe.includes(He.value))Kt(He.value);else{if(He.creatable&&typeof q=="function"){const Ct=q(He.value);typeof Ct<"u"&&Ct!==null&&ft(typeof Ct=="string"?[...xe,Ct]:[...xe,Ct.value])}else ft([...xe,He.value]);xe.length===ve-1&&(it.current=!0,rr(!1)),We.length===1&&rr(!1)}},Tt=He=>{typeof D=="function"&&D(He),Mt&&We[Ie]&&nr&&Et(We[Ie]),U&&$s(""),rr(!1)},Vt=He=>{if(Yr||(Ht==null||Ht(He),_t)||He.key!=="Backspace"&&ve&&it.current)return;const Ct=Xo==="column",zt=()=>{Xr(Nn=>{var Jt;const vn=et(Nn,fn=>fn+1,fn=>fn{Xr(Nn=>{var Jt;const vn=et(Nn,fn=>fn-1,fn=>fn>0);return nr&&(Ua.current=oo.current[(Jt=We[vn])==null?void 0:Jt.value],Ls({alignment:Ct?"start":"end"})),vn})};switch(He.key){case"ArrowUp":{He.preventDefault(),rr(!0),Ct?Qt():zt();break}case"ArrowDown":{He.preventDefault(),rr(!0),Ct?zt():Qt();break}case"Enter":{He.preventDefault(),We[Ie]&&nr?Et(We[Ie]):rr(!0);break}case" ":{O||(He.preventDefault(),We[Ie]&&nr?Et(We[Ie]):rr(!0));break}case"Backspace":{xe.length>0&&ao.length===0&&(ft(xe.slice(0,-1)),rr(!0),ve&&(it.current=!1));break}case"Home":{if(!O){He.preventDefault(),nr||rr(!0);const Nn=We.findIndex(Jt=>!Jt.disabled);Xr(Nn),Ls({alignment:Ct?"end":"start"})}break}case"End":{if(!O){He.preventDefault(),nr||rr(!0);const Nn=We.map(Jt=>!!Jt.disabled).lastIndexOf(!1);Xr(Nn),Ls({alignment:Ct?"end":"start"})}break}case"Escape":rr(!1)}},Zt=xe.map(He=>{let Ct=Pe.find(zt=>zt.value===He&&!zt.disabled);return!Ct&&re&&(Ct={value:He,label:He}),Ct}).filter(He=>!!He).map((He,Ct)=>B.createElement(S,mj(Rc({},He),{variant:L,disabled:Z,className:Ye.value,readOnly:_t,onRemove:zt=>{zt.preventDefault(),zt.stopPropagation(),Kt(He.value)},key:He.value,size:d,styles:m,classNames:h,radius:fe,index:Ct}))),ln=He=>xe.includes(He),sn=()=>{var He;$s(""),ft([]),(He=hn.current)==null||He.focus(),ve&&(it.current=!1)},Yt=!_t&&(We.length>0?nr:nr&&!!R);return Js(()=>{const He=Yt?we:le;typeof He=="function"&&He()},[Yt]),B.createElement(ku.Wrapper,Rc(Rc({required:s,id:Dr,label:i,error:p,description:c,size:d,className:r,style:o,classNames:h,styles:m,__staticSelector:"MultiSelect",sx:ne,errorProps:pt,descriptionProps:ke,labelProps:vt,inputContainer:ht,inputWrapperOrder:At,unstyled:je,withAsterisk:Re,variant:L},xr),g),B.createElement(Qi,{opened:Yt,transitionProps:I,shadow:"sm",withinPortal:he,portalProps:Ne,__staticSelector:"MultiSelect",onDirectionChange:so,switchDirectionOnFlip:De,zIndex:qe,dropdownPosition:an,positionDependencies:[...Ot,ao],classNames:h,styles:m,unstyled:je,variant:L},B.createElement(Qi.Target,null,B.createElement("div",{className:Ye.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":nr&&Yt?`${Dr}-items`:null,"aria-controls":Dr,"aria-expanded":nr,onMouseLeave:()=>Xr(-1),tabIndex:-1},B.createElement("input",{type:"hidden",name:ot,value:xe.join(","),form:Be,disabled:Z}),B.createElement(ku,Rc({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:d,variant:L,disabled:Z,error:p,required:s,radius:fe,icon:G,unstyled:je,onMouseDown:He=>{var Ct;He.preventDefault(),!Z&&!it.current&&rr(!nr),(Ct=hn.current)==null||Ct.focus()},classNames:mj(Rc({},h),{input:ut({[Ye.input]:!O},h==null?void 0:h.input)})},kM({theme:Ut,rightSection:te,rightSectionWidth:V,styles:m,size:d,shouldClear:Q&&xe.length>0,onClear:sn,error:p,disabled:Z,clearButtonProps:Xe,readOnly:_t})),B.createElement("div",{className:Ye.values,"data-clearable":Q||void 0},Zt,B.createElement("input",Rc({ref:zf(t,hn),type:"search",id:Dr,className:ut(Ye.searchInput,{[Ye.searchInputPointer]:!O,[Ye.searchInputInputHidden]:!nr&&xe.length>0||!O&&xe.length>0,[Ye.searchInputEmpty]:xe.length===0}),onKeyDown:Vt,value:ao,onChange:mt,onFocus:wt,onBlur:Tt,readOnly:!O||it.current||_t,placeholder:xe.length===0?T:void 0,disabled:Z,"data-mantine-stop-propagation":nr,autoComplete:"off",onCompositionStart:()=>ca(!0),onCompositionEnd:()=>ca(!1)},yn)))))),B.createElement(Qi.Dropdown,{component:pe||Gg,maxHeight:P,direction:Xo,id:Dr,innerRef:ua,__staticSelector:"MultiSelect",classNames:h,styles:m},B.createElement(Ny,{data:We,hovered:Ie,classNames:h,styles:m,uuid:Dr,__staticSelector:"MultiSelect",onItemHover:Xr,onItemSelect:Et,itemsRefs:oo,itemComponent:j,size:d,nothingFound:R,isItemSelected:ln,creatable:F&&!!ie,createLabel:ie,unstyled:je,variant:L}))))});IM.displayName="@mantine/core/MultiSelect";var bZ=Object.defineProperty,xZ=Object.defineProperties,yZ=Object.getOwnPropertyDescriptors,Bm=Object.getOwnPropertySymbols,PM=Object.prototype.hasOwnProperty,EM=Object.prototype.propertyIsEnumerable,vj=(e,t,n)=>t in e?bZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l1=(e,t)=>{for(var n in t||(t={}))PM.call(t,n)&&vj(e,n,t[n]);if(Bm)for(var n of Bm(t))EM.call(t,n)&&vj(e,n,t[n]);return e},CZ=(e,t)=>xZ(e,yZ(t)),wZ=(e,t)=>{var n={};for(var r in e)PM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Bm)for(var r of Bm(e))t.indexOf(r)<0&&EM.call(e,r)&&(n[r]=e[r]);return n};const SZ={type:"text",size:"sm",__staticSelector:"TextInput"},MM=l.forwardRef((e,t)=>{const n=XE("TextInput",SZ,e),{inputProps:r,wrapperProps:o}=n,s=wZ(n,["inputProps","wrapperProps"]);return B.createElement(ku.Wrapper,l1({},o),B.createElement(ku,CZ(l1(l1({},r),s),{ref:t})))});MM.displayName="@mantine/core/TextInput";function kZ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,filterDataOnExactSearchMatch:i}){if(!t)return e;const c=s!=null&&e.find(p=>p.value===s)||null;if(c&&!i&&(c==null?void 0:c.label)===r){if(n){if(n>=e.length)return e;const p=e.indexOf(c),h=p+n,m=h-e.length;return m>0?e.slice(p-m):e.slice(p,h)}return e}const d=[];for(let p=0;p=n));p+=1);return d}var jZ=Co(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}}));const _Z=jZ;var IZ=Object.defineProperty,PZ=Object.defineProperties,EZ=Object.getOwnPropertyDescriptors,Hm=Object.getOwnPropertySymbols,OM=Object.prototype.hasOwnProperty,RM=Object.prototype.propertyIsEnumerable,bj=(e,t,n)=>t in e?IZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yd=(e,t)=>{for(var n in t||(t={}))OM.call(t,n)&&bj(e,n,t[n]);if(Hm)for(var n of Hm(t))RM.call(t,n)&&bj(e,n,t[n]);return e},c1=(e,t)=>PZ(e,EZ(t)),MZ=(e,t)=>{var n={};for(var r in e)OM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Hm)for(var r of Hm(e))t.indexOf(r)<0&&RM.call(e,r)&&(n[r]=e[r]);return n};function OZ(e,t){return t.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function RZ(e,t){return!!e&&!t.some(n=>n.label.toLowerCase()===e.toLowerCase())}const AZ={required:!1,size:"sm",shadow:"sm",itemComponent:$y,transitionProps:{transition:"fade",duration:0},initiallyOpened:!1,filter:OZ,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:RZ,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:Ay("popover"),positionDependencies:[],dropdownPosition:"flip"},qy=l.forwardRef((e,t)=>{const n=XE("Select",AZ,e),{inputProps:r,wrapperProps:o,shadow:s,data:i,value:c,defaultValue:d,onChange:p,itemComponent:h,onKeyDown:m,onBlur:g,onFocus:b,transitionProps:y,initiallyOpened:x,unstyled:C,classNames:S,styles:j,filter:_,maxDropdownHeight:I,searchable:P,clearable:M,nothingFound:R,limit:A,disabled:D,onSearchChange:O,searchValue:T,rightSection:Y,rightSectionWidth:z,creatable:W,getCreateLabel:Q,shouldCreate:U,selectOnBlur:L,onCreate:ee,dropdownComponent:K,onDropdownClose:Z,onDropdownOpen:se,withinPortal:fe,portalProps:G,switchDirectionOnFlip:te,zIndex:V,name:F,dropdownPosition:X,allowDeselect:ue,placeholder:q,filterDataOnExactSearchMatch:ne,form:pe,positionDependencies:le,readOnly:we,clearButtonProps:ve,hoverOnSearchChange:he}=n,Ne=MZ(n,["inputProps","wrapperProps","shadow","data","value","defaultValue","onChange","itemComponent","onKeyDown","onBlur","onFocus","transitionProps","initiallyOpened","unstyled","classNames","styles","filter","maxDropdownHeight","searchable","clearable","nothingFound","limit","disabled","onSearchChange","searchValue","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","selectOnBlur","onCreate","dropdownComponent","onDropdownClose","onDropdownOpen","withinPortal","portalProps","switchDirectionOnFlip","zIndex","name","dropdownPosition","allowDeselect","placeholder","filterDataOnExactSearchMatch","form","positionDependencies","readOnly","clearButtonProps","hoverOnSearchChange"]),{classes:De,cx:qe,theme:Mt}=_Z(),[ot,an]=l.useState(x),[pt,vt]=l.useState(-1),ke=l.useRef(),Be=l.useRef({}),[Ot,Ht]=l.useState("column"),je=Ot==="column",{scrollIntoView:ht,targetRef:At,scrollableRef:_t}=C6({duration:0,offset:5,cancelable:!1,isList:!0}),Re=ue===void 0?M:ue,Xe=ie=>{if(ot!==ie){an(ie);const be=ie?se:Z;typeof be=="function"&&be()}},_n=W&&typeof Q=="function";let Me=null;const Ze=i.map(ie=>typeof ie=="string"?{label:ie,value:ie}:ie),Ye=u6({data:Ze}),[ut,Ut,xr]=Zd({value:c,defaultValue:d,finalValue:null,onChange:p}),yn=Ye.find(ie=>ie.value===ut),[hn,oo]=Zd({value:T,defaultValue:(yn==null?void 0:yn.label)||"",finalValue:void 0,onChange:O}),Dr=ie=>{oo(ie),P&&typeof O=="function"&&O(ie)},nr=()=>{var ie;we||(Ut(null),xr||Dr(""),(ie=ke.current)==null||ie.focus())};l.useEffect(()=>{const ie=Ye.find(be=>be.value===ut);ie?Dr(ie.label):(!_n||!ut)&&Dr("")},[ut]),l.useEffect(()=>{yn&&(!P||!ot)&&Dr(yn.label)},[yn==null?void 0:yn.label]);const rr=ie=>{if(!we)if(Re&&(yn==null?void 0:yn.value)===ie.value)Ut(null),Xe(!1);else{if(ie.creatable&&typeof ee=="function"){const be=ee(ie.value);typeof be<"u"&&be!==null&&Ut(typeof be=="string"?be:be.value)}else Ut(ie.value);xr||Dr(ie.label),vt(-1),Xe(!1),ke.current.focus()}},or=kZ({data:Ye,searchable:P,limit:A,searchValue:hn,filter:_,filterDataOnExactSearchMatch:ne,value:ut});_n&&U(hn,or)&&(Me=Q(hn),or.push({label:hn,value:hn,creatable:!0}));const Xr=(ie,be,Pe)=>{let xe=ie;for(;Pe(xe);)if(xe=be(xe),!or[xe].disabled)return xe;return ie};Js(()=>{vt(he&&hn?0:-1)},[hn,he]);const Xo=ut?or.findIndex(ie=>ie.value===ut):0,so=!we&&(or.length>0?ot:ot&&!!R),ao=()=>{vt(ie=>{var be;const Pe=Xr(ie,xe=>xe-1,xe=>xe>0);return At.current=Be.current[(be=or[Pe])==null?void 0:be.value],so&&ht({alignment:je?"start":"end"}),Pe})},$s=()=>{vt(ie=>{var be;const Pe=Xr(ie,xe=>xe+1,xe=>xewindow.setTimeout(()=>{var ie;At.current=Be.current[(ie=or[Xo])==null?void 0:ie.value],ht({alignment:je?"end":"start"})},50);Js(()=>{so&&Yr()},[so]);const ca=ie=>{switch(typeof m=="function"&&m(ie),ie.key){case"ArrowUp":{ie.preventDefault(),ot?je?ao():$s():(vt(Xo),Xe(!0),Yr());break}case"ArrowDown":{ie.preventDefault(),ot?je?$s():ao():(vt(Xo),Xe(!0),Yr());break}case"Home":{if(!P){ie.preventDefault(),ot||Xe(!0);const be=or.findIndex(Pe=>!Pe.disabled);vt(be),so&&ht({alignment:je?"end":"start"})}break}case"End":{if(!P){ie.preventDefault(),ot||Xe(!0);const be=or.map(Pe=>!!Pe.disabled).lastIndexOf(!1);vt(be),so&&ht({alignment:je?"end":"start"})}break}case"Escape":{ie.preventDefault(),Xe(!1),vt(-1);break}case" ":{P||(ie.preventDefault(),or[pt]&&ot?rr(or[pt]):(Xe(!0),vt(Xo),Yr()));break}case"Enter":P||ie.preventDefault(),or[pt]&&ot&&(ie.preventDefault(),rr(or[pt]))}},Ls=ie=>{typeof g=="function"&&g(ie);const be=Ye.find(Pe=>Pe.value===ut);L&&or[pt]&&ot&&rr(or[pt]),Dr((be==null?void 0:be.label)||""),Xe(!1)},Ua=ie=>{typeof b=="function"&&b(ie),P&&Xe(!0)},ua=ie=>{we||(Dr(ie.currentTarget.value),M&&ie.currentTarget.value===""&&Ut(null),vt(-1),Xe(!0))},re=()=>{we||(Xe(!ot),ut&&!ot&&vt(Xo))};return B.createElement(ku.Wrapper,c1(yd({},o),{__staticSelector:"Select"}),B.createElement(Qi,{opened:so,transitionProps:y,shadow:s,withinPortal:fe,portalProps:G,__staticSelector:"Select",onDirectionChange:Ht,switchDirectionOnFlip:te,zIndex:V,dropdownPosition:X,positionDependencies:[...le,hn],classNames:S,styles:j,unstyled:C,variant:r.variant},B.createElement(Qi.Target,null,B.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":so?`${r.id}-items`:null,"aria-controls":r.id,"aria-expanded":so,onMouseLeave:()=>vt(-1),tabIndex:-1},B.createElement("input",{type:"hidden",name:F,value:ut||"",form:pe,disabled:D}),B.createElement(ku,yd(c1(yd(yd({autoComplete:"off",type:"search"},r),Ne),{ref:zf(t,ke),onKeyDown:ca,__staticSelector:"Select",value:hn,placeholder:q,onChange:ua,"aria-autocomplete":"list","aria-controls":so?`${r.id}-items`:null,"aria-activedescendant":pt>=0?`${r.id}-${pt}`:null,onMouseDown:re,onBlur:Ls,onFocus:Ua,readOnly:!P||we,disabled:D,"data-mantine-stop-propagation":so,name:null,classNames:c1(yd({},S),{input:qe({[De.input]:!P},S==null?void 0:S.input)})}),kM({theme:Mt,rightSection:Y,rightSectionWidth:z,styles:j,size:r.size,shouldClear:M&&!!yn,onClear:nr,error:o.error,clearButtonProps:ve,disabled:D,readOnly:we}))))),B.createElement(Qi.Dropdown,{component:K||Gg,maxHeight:I,direction:Ot,id:r.id,innerRef:_t,__staticSelector:"Select",classNames:S,styles:j},B.createElement(Ny,{data:or,hovered:pt,classNames:S,styles:j,isItemSelected:ie=>ie===ut,uuid:r.id,__staticSelector:"Select",onItemHover:vt,onItemSelect:rr,itemsRefs:Be,itemComponent:h,size:r.size,nothingFound:R,creatable:_n&&!!Me,createLabel:Me,"aria-label":o.label,unstyled:C,variant:r.variant}))))});qy.displayName="@mantine/core/Select";const Hf=()=>{const[e,t,n,r,o,s,i,c,d,p,h,m,g,b,y,x,C,S,j,_,I,P,M,R,A,D,O,T,Y,z,W,Q,U,L,ee,K,Z,se,fe,G,te,V,F,X,ue,q,ne,pe,le,we,ve,he,Ne,De,qe,Mt,ot,an,pt,vt,ke,Be,Ot,Ht,je,ht,At,_t,Re,Xe,_n,Me,Ze,Ye,ut,Ut]=Ks("colors",["base.50","base.100","base.150","base.200","base.250","base.300","base.350","base.400","base.450","base.500","base.550","base.600","base.650","base.700","base.750","base.800","base.850","base.900","base.950","accent.50","accent.100","accent.150","accent.200","accent.250","accent.300","accent.350","accent.400","accent.450","accent.500","accent.550","accent.600","accent.650","accent.700","accent.750","accent.800","accent.850","accent.900","accent.950","baseAlpha.50","baseAlpha.100","baseAlpha.150","baseAlpha.200","baseAlpha.250","baseAlpha.300","baseAlpha.350","baseAlpha.400","baseAlpha.450","baseAlpha.500","baseAlpha.550","baseAlpha.600","baseAlpha.650","baseAlpha.700","baseAlpha.750","baseAlpha.800","baseAlpha.850","baseAlpha.900","baseAlpha.950","accentAlpha.50","accentAlpha.100","accentAlpha.150","accentAlpha.200","accentAlpha.250","accentAlpha.300","accentAlpha.350","accentAlpha.400","accentAlpha.450","accentAlpha.500","accentAlpha.550","accentAlpha.600","accentAlpha.650","accentAlpha.700","accentAlpha.750","accentAlpha.800","accentAlpha.850","accentAlpha.900","accentAlpha.950"]);return{base50:e,base100:t,base150:n,base200:r,base250:o,base300:s,base350:i,base400:c,base450:d,base500:p,base550:h,base600:m,base650:g,base700:b,base750:y,base800:x,base850:C,base900:S,base950:j,accent50:_,accent100:I,accent150:P,accent200:M,accent250:R,accent300:A,accent350:D,accent400:O,accent450:T,accent500:Y,accent550:z,accent600:W,accent650:Q,accent700:U,accent750:L,accent800:ee,accent850:K,accent900:Z,accent950:se,baseAlpha50:fe,baseAlpha100:G,baseAlpha150:te,baseAlpha200:V,baseAlpha250:F,baseAlpha300:X,baseAlpha350:ue,baseAlpha400:q,baseAlpha450:ne,baseAlpha500:pe,baseAlpha550:le,baseAlpha600:we,baseAlpha650:ve,baseAlpha700:he,baseAlpha750:Ne,baseAlpha800:De,baseAlpha850:qe,baseAlpha900:Mt,baseAlpha950:ot,accentAlpha50:an,accentAlpha100:pt,accentAlpha150:vt,accentAlpha200:ke,accentAlpha250:Be,accentAlpha300:Ot,accentAlpha350:Ht,accentAlpha400:je,accentAlpha450:ht,accentAlpha500:At,accentAlpha550:_t,accentAlpha600:Re,accentAlpha650:Xe,accentAlpha700:_n,accentAlpha750:Me,accentAlpha800:Ze,accentAlpha850:Ye,accentAlpha900:ut,accentAlpha950:Ut}},Ke=(e,t)=>n=>n==="light"?e:t,AM=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:c,base800:d,base900:p,accent200:h,accent300:m,accent400:g,accent500:b,accent600:y}=Hf(),{colorMode:x}=wi(),[C]=Ks("shadows",["dark-lg"]),[S,j,_]=Ks("space",[1,2,6]),[I]=Ks("radii",["base"]),[P]=Ks("lineHeights",["base"]);return l.useCallback(()=>({label:{color:Ke(c,r)(x)},separatorLabel:{color:Ke(s,s)(x),"::after":{borderTopColor:Ke(r,c)(x)}},input:{border:"unset",backgroundColor:Ke(e,p)(x),borderRadius:I,borderStyle:"solid",borderWidth:"2px",borderColor:Ke(n,d)(x),color:Ke(p,t)(x),minHeight:"unset",lineHeight:P,height:"auto",paddingRight:0,paddingLeft:0,paddingInlineStart:j,paddingInlineEnd:_,paddingTop:S,paddingBottom:S,fontWeight:600,"&:hover":{borderColor:Ke(r,i)(x)},"&:focus":{borderColor:Ke(m,y)(x)},"&:is(:focus, :hover)":{borderColor:Ke(o,s)(x)},"&:focus-within":{borderColor:Ke(h,y)(x)},"&[data-disabled]":{backgroundColor:Ke(r,c)(x),color:Ke(i,o)(x),cursor:"not-allowed"}},value:{backgroundColor:Ke(t,p)(x),color:Ke(p,t)(x),button:{color:Ke(p,t)(x)},"&:hover":{backgroundColor:Ke(r,c)(x),cursor:"pointer"}},dropdown:{backgroundColor:Ke(n,d)(x),borderColor:Ke(n,d)(x),boxShadow:C},item:{backgroundColor:Ke(n,d)(x),color:Ke(d,n)(x),padding:6,"&[data-hovered]":{color:Ke(p,t)(x),backgroundColor:Ke(r,c)(x)},"&[data-active]":{backgroundColor:Ke(r,c)(x),"&:hover":{color:Ke(p,t)(x),backgroundColor:Ke(r,c)(x)}},"&[data-selected]":{backgroundColor:Ke(g,y)(x),color:Ke(e,t)(x),fontWeight:600,"&:hover":{backgroundColor:Ke(b,b)(x),color:Ke("white",e)(x)}},"&[data-disabled]":{color:Ke(s,i)(x),cursor:"not-allowed"}},rightSection:{width:32,button:{color:Ke(p,t)(x)}}}),[h,m,g,b,y,t,n,r,o,e,s,i,c,d,p,C,x,P,I,S,j,_])},DM=Oe((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,onChange:s,label:i,disabled:c,...d}=e,p=oe(),[h,m]=l.useState(""),g=l.useCallback(C=>{C.shiftKey&&p(Uo(!0))},[p]),b=l.useCallback(C=>{C.shiftKey||p(Uo(!1))},[p]),y=l.useCallback(C=>{s&&s(C)},[s]),x=AM();return a.jsx(Fn,{label:r,placement:"top",hasArrow:!0,children:a.jsxs(Bn,{ref:t,isDisabled:c,position:"static","data-testid":`select-${i||e.placeholder}`,children:[i&&a.jsx(vr,{children:i}),a.jsx(qy,{ref:o,disabled:c,searchValue:h,onSearchChange:m,onChange:y,onKeyDown:g,onKeyUp:b,searchable:n,maxDropdownHeight:300,styles:x,...d})]})})});DM.displayName="IAIMantineSearchableSelect";const tr=l.memo(DM),DZ=de([Ce],({changeBoardModal:e})=>{const{isModalOpen:t,imagesToChange:n}=e;return{isModalOpen:t,imagesToChange:n}},_e),TZ=()=>{const e=oe(),[t,n]=l.useState(),{data:r,isFetching:o}=gf(),{imagesToChange:s,isModalOpen:i}=H(DZ),[c]=vD(),[d]=bD(),{t:p}=J(),h=l.useMemo(()=>{const x=[{label:p("boards.uncategorized"),value:"none"}];return(r??[]).forEach(C=>x.push({label:C.board_name,value:C.board_id})),x},[r,p]),m=l.useCallback(()=>{e(Rw()),e(Cx(!1))},[e]),g=l.useCallback(()=>{!s.length||!t||(t==="none"?d({imageDTOs:s}):c({imageDTOs:s,board_id:t}),n(null),e(Rw()))},[c,e,s,d,t]),b=l.useCallback(x=>n(x),[]),y=l.useRef(null);return a.jsx(Df,{isOpen:i,onClose:m,leastDestructiveRef:y,isCentered:!0,children:a.jsx(Ma,{children:a.jsxs(Tf,{children:[a.jsx(Ea,{fontSize:"lg",fontWeight:"bold",children:p("boards.changeBoard")}),a.jsx(Oa,{children:a.jsxs(N,{sx:{flexDir:"column",gap:4},children:[a.jsxs(Se,{children:["Moving ",`${s.length}`," image",`${s.length>1?"s":""}`," to board:"]}),a.jsx(tr,{placeholder:p(o?"boards.loading":"boards.selectBoard"),disabled:o,onChange:b,value:t,data:h})]})}),a.jsxs(pi,{children:[a.jsx(Rt,{ref:y,onClick:m,children:p("boards.cancel")}),a.jsx(Rt,{colorScheme:"accent",onClick:g,ml:3,children:p("boards.move")})]})]})})})},NZ=l.memo(TZ),TM=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,tooltip:i,helperText:c,...d}=e;return a.jsx(Fn,{label:i,hasArrow:!0,placement:"top",isDisabled:!i,children:a.jsx(Bn,{isDisabled:n,width:r,alignItems:"center",...o,children:a.jsxs(N,{sx:{flexDir:"column",w:"full"},children:[a.jsxs(N,{sx:{alignItems:"center",w:"full"},children:[t&&a.jsx(vr,{my:1,flexGrow:1,sx:{cursor:n?"not-allowed":"pointer",...s==null?void 0:s.sx,pe:4},...s,children:t}),a.jsx(Ey,{...d})]}),c&&a.jsx(BP,{children:a.jsx(Se,{variant:"subtext",children:c})})]})})})};TM.displayName="IAISwitch";const jr=l.memo(TM),$Z=e=>{const{t}=J(),{imageUsage:n,topMessage:r=t("gallery.currentlyInUse"),bottomMessage:o=t("gallery.featuresWillReset")}=e;return!n||!Qs(n)?null:a.jsxs(a.Fragment,{children:[a.jsx(Se,{children:r}),a.jsxs(Mf,{sx:{paddingInlineStart:6},children:[n.isInitialImage&&a.jsx(ws,{children:t("common.img2img")}),n.isCanvasImage&&a.jsx(ws,{children:t("common.unifiedCanvas")}),n.isControlImage&&a.jsx(ws,{children:t("common.controlNet")}),n.isNodesImage&&a.jsx(ws,{children:t("common.nodeEditor")})]}),a.jsx(Se,{children:o})]})},NM=l.memo($Z),LZ=de([Ce,xD],(e,t)=>{const{system:n,config:r,deleteImageModal:o}=e,{shouldConfirmOnDelete:s}=n,{canRestoreDeletedImagesFromBin:i}=r,{imagesToDelete:c,isModalOpen:d}=o,p=(c??[]).map(({image_name:m})=>PI(e,m)),h={isInitialImage:Qs(p,m=>m.isInitialImage),isCanvasImage:Qs(p,m=>m.isCanvasImage),isNodesImage:Qs(p,m=>m.isNodesImage),isControlImage:Qs(p,m=>m.isControlImage)};return{shouldConfirmOnDelete:s,canRestoreDeletedImagesFromBin:i,imagesToDelete:c,imagesUsage:t,isModalOpen:d,imageUsageSummary:h}},_e),zZ=()=>{const e=oe(),{t}=J(),{shouldConfirmOnDelete:n,canRestoreDeletedImagesFromBin:r,imagesToDelete:o,imagesUsage:s,isModalOpen:i,imageUsageSummary:c}=H(LZ),d=l.useCallback(g=>e(EI(!g.target.checked)),[e]),p=l.useCallback(()=>{e(Aw()),e(yD(!1))},[e]),h=l.useCallback(()=>{!o.length||!s.length||(e(Aw()),e(CD({imageDTOs:o,imagesUsage:s})))},[e,o,s]),m=l.useRef(null);return a.jsx(Df,{isOpen:i,onClose:p,leastDestructiveRef:m,isCentered:!0,children:a.jsx(Ma,{children:a.jsxs(Tf,{children:[a.jsx(Ea,{fontSize:"lg",fontWeight:"bold",children:t("gallery.deleteImage")}),a.jsx(Oa,{children:a.jsxs(N,{direction:"column",gap:3,children:[a.jsx(NM,{imageUsage:c}),a.jsx(no,{}),a.jsx(Se,{children:t(r?"gallery.deleteImageBin":"gallery.deleteImagePermanent")}),a.jsx(Se,{children:t("common.areYouSure")}),a.jsx(jr,{label:t("common.dontAskMeAgain"),isChecked:!n,onChange:d})]})}),a.jsxs(pi,{children:[a.jsx(Rt,{ref:m,onClick:p,children:"Cancel"}),a.jsx(Rt,{colorScheme:"error",onClick:h,ml:3,children:"Delete"})]})]})})})},FZ=l.memo(zZ),$M=Oe((e,t)=>{const{role:n,tooltip:r="",tooltipProps:o,isChecked:s,...i}=e;return a.jsx(Fn,{label:r,hasArrow:!0,...o,...o!=null&&o.placement?{placement:o.placement}:{placement:"top"},children:a.jsx(_a,{ref:t,role:n,colorScheme:s?"accent":"base","data-testid":r,...i})})});$M.displayName="IAIIconButton";const tt=l.memo($M);var LM={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},xj=B.createContext&&B.createContext(LM),Xi=globalThis&&globalThis.__assign||function(){return Xi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const t=H(i=>i.config.disabledTabs),n=H(i=>i.config.disabledFeatures),r=H(i=>i.config.disabledSDFeatures),o=l.useMemo(()=>n.includes(e)||r.includes(e)||t.includes(e),[n,r,t,e]),s=l.useMemo(()=>!(n.includes(e)||r.includes(e)||t.includes(e)),[n,r,t,e]);return{isFeatureDisabled:o,isFeatureEnabled:s}};function Pee(e){const{title:t,hotkey:n,description:r}=e;return a.jsxs(nl,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs(nl,{children:[a.jsx(Se,{fontWeight:600,children:t}),r&&a.jsx(Se,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),a.jsx(Te,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function Eee({children:e}){const{isOpen:t,onOpen:n,onClose:r}=ls(),{t:o}=J(),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.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"}],i=[{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.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"}],c=[{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.increaseGalleryThumbSize.title"),desc:o("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys.decreaseGalleryThumbSize.title"),desc:o("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],d=[{title:o("hotkeys.selectBrush.title"),desc:o("hotkeys.selectBrush.desc"),hotkey:"B"},{title:o("hotkeys.selectEraser.title"),desc:o("hotkeys.selectEraser.desc"),hotkey:"E"},{title:o("hotkeys.decreaseBrushSize.title"),desc:o("hotkeys.decreaseBrushSize.desc"),hotkey:"["},{title:o("hotkeys.increaseBrushSize.title"),desc:o("hotkeys.increaseBrushSize.desc"),hotkey:"]"},{title:o("hotkeys.decreaseBrushOpacity.title"),desc:o("hotkeys.decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:o("hotkeys.increaseBrushOpacity.title"),desc:o("hotkeys.increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:o("hotkeys.moveTool.title"),desc:o("hotkeys.moveTool.desc"),hotkey:"V"},{title:o("hotkeys.fillBoundingBox.title"),desc:o("hotkeys.fillBoundingBox.desc"),hotkey:"Shift + F"},{title:o("hotkeys.eraseBoundingBox.title"),desc:o("hotkeys.eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:o("hotkeys.colorPicker.title"),desc:o("hotkeys.colorPicker.desc"),hotkey:"C"},{title:o("hotkeys.toggleSnap.title"),desc:o("hotkeys.toggleSnap.desc"),hotkey:"N"},{title:o("hotkeys.quickToggleMove.title"),desc:o("hotkeys.quickToggleMove.desc"),hotkey:"Hold Space"},{title:o("hotkeys.toggleLayer.title"),desc:o("hotkeys.toggleLayer.desc"),hotkey:"Q"},{title:o("hotkeys.clearMask.title"),desc:o("hotkeys.clearMask.desc"),hotkey:"Shift+C"},{title:o("hotkeys.hideMask.title"),desc:o("hotkeys.hideMask.desc"),hotkey:"H"},{title:o("hotkeys.showHideBoundingBox.title"),desc:o("hotkeys.showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:o("hotkeys.mergeVisible.title"),desc:o("hotkeys.mergeVisible.desc"),hotkey:"Shift+M"},{title:o("hotkeys.saveToGallery.title"),desc:o("hotkeys.saveToGallery.desc"),hotkey:"Shift+S"},{title:o("hotkeys.copyToClipboard.title"),desc:o("hotkeys.copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:o("hotkeys.downloadImage.title"),desc:o("hotkeys.downloadImage.desc"),hotkey:"Shift+D"},{title:o("hotkeys.undoStroke.title"),desc:o("hotkeys.undoStroke.desc"),hotkey:"Ctrl+Z"},{title:o("hotkeys.redoStroke.title"),desc:o("hotkeys.redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:o("hotkeys.resetView.title"),desc:o("hotkeys.resetView.desc"),hotkey:"R"},{title:o("hotkeys.previousStagingImage.title"),desc:o("hotkeys.previousStagingImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextStagingImage.title"),desc:o("hotkeys.nextStagingImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.acceptStagingImage.title"),desc:o("hotkeys.acceptStagingImage.desc"),hotkey:"Enter"}],p=[{title:o("hotkeys.addNodes.title"),desc:o("hotkeys.addNodes.desc"),hotkey:"Shift + A / Space"}],h=m=>a.jsx(N,{flexDir:"column",gap:4,children:m.map((g,b)=>a.jsxs(N,{flexDir:"column",px:2,gap:4,children:[a.jsx(Pee,{title:g.title,description:g.desc,hotkey:g.hotkey}),b{const{data:t}=wD(),n=l.useRef(null),r=eO(n);return a.jsxs(N,{alignItems:"center",gap:5,ps:1,ref:n,children:[a.jsx(Si,{src:wx,alt:"invoke-ai-logo",sx:{w:"32px",h:"32px",minW:"32px",minH:"32px",userSelect:"none"}}),a.jsxs(N,{sx:{gap:3,alignItems:"center"},children:[a.jsxs(Se,{sx:{fontSize:"xl",userSelect:"none"},children:["invoke ",a.jsx("strong",{children:"ai"})]}),a.jsx(yo,{children:e&&r&&t&&a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(Se,{sx:{fontWeight:600,marginTop:1,color:"base.300",fontSize:14},variant:"subtext",children:t.version})},"statusText")})]})]})},$ee=l.memo(Nee),tO=Oe((e,t)=>{const{tooltip:n,inputRef:r,label:o,disabled:s,required:i,...c}=e,d=AM();return a.jsx(Fn,{label:n,placement:"top",hasArrow:!0,children:a.jsxs(Bn,{ref:t,isRequired:i,isDisabled:s,position:"static","data-testid":`select-${o||e.placeholder}`,children:[a.jsx(vr,{children:o}),a.jsx(qy,{disabled:s,ref:r,styles:d,...c})]})})});tO.displayName="IAIMantineSelect";const Ar=l.memo(tO),Lee={ar:on.t("common.langArabic",{lng:"ar"}),nl:on.t("common.langDutch",{lng:"nl"}),en:on.t("common.langEnglish",{lng:"en"}),fr:on.t("common.langFrench",{lng:"fr"}),de:on.t("common.langGerman",{lng:"de"}),he:on.t("common.langHebrew",{lng:"he"}),it:on.t("common.langItalian",{lng:"it"}),ja:on.t("common.langJapanese",{lng:"ja"}),ko:on.t("common.langKorean",{lng:"ko"}),pl:on.t("common.langPolish",{lng:"pl"}),pt_BR:on.t("common.langBrPortuguese",{lng:"pt_BR"}),pt:on.t("common.langPortuguese",{lng:"pt"}),ru:on.t("common.langRussian",{lng:"ru"}),zh_CN:on.t("common.langSimplifiedChinese",{lng:"zh_CN"}),es:on.t("common.langSpanish",{lng:"es"}),uk:on.t("common.langUkranian",{lng:"ua"})},zee={CONNECTED:"common.statusConnected",DISCONNECTED:"common.statusDisconnected",PROCESSING:"common.statusProcessing",ERROR:"common.statusError",LOADING_MODEL:"common.statusLoadingModel"},nO=de(Ce,({system:e})=>e.language,_e);function Vs(e){const{t}=J(),{label:n,textProps:r,useBadge:o=!1,badgeLabel:s=t("settings.experimental"),badgeProps:i,...c}=e;return a.jsxs(N,{justifyContent:"space-between",py:1,children:[a.jsxs(N,{gap:2,alignItems:"center",children:[a.jsx(Se,{sx:{fontSize:14,_dark:{color:"base.300"}},...r,children:n}),o&&a.jsx(Ha,{size:"xs",sx:{px:2,color:"base.700",bg:"accent.200",_dark:{bg:"accent.500",color:"base.200"}},...i,children:s})]}),a.jsx(jr,{...c})]})}const Fee=e=>a.jsx(N,{sx:{flexDirection:"column",gap:2,p:4,borderRadius:"base",bg:"base.100",_dark:{bg:"base.900"}},children:e.children}),zc=l.memo(Fee);function Bee(){const{t:e}=J(),t=oe(),{data:n}=SD(void 0,{refetchOnMountOrArgChange:!0}),[r,{isLoading:o}]=kD(),{data:s}=Fa(),i=s&&(s.queue.in_progress>0||s.queue.pending>0),c=l.useCallback(()=>{i||r().unwrap().then(d=>{t(MI()),t(OI()),t(Bt({title:e("settings.intermediatesCleared",{count:d}),status:"info"}))}).catch(()=>{t(Bt({title:e("settings.intermediatesClearedFailed"),status:"error"}))})},[e,r,t,i]);return a.jsxs(zc,{children:[a.jsx(vo,{size:"sm",children:e("settings.clearIntermediates")}),a.jsx(Rt,{tooltip:i?e("settings.clearIntermediatesDisabled"):void 0,colorScheme:"warning",onClick:c,isLoading:o,isDisabled:!n||i,children:e("settings.clearIntermediatesWithCount",{count:n??0})}),a.jsx(Se,{fontWeight:"bold",children:e("settings.clearIntermediatesDesc1")}),a.jsx(Se,{variant:"subtext",children:e("settings.clearIntermediatesDesc2")}),a.jsx(Se,{variant:"subtext",children:e("settings.clearIntermediatesDesc3")})]})}const Hee=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:c,base800:d,base900:p,accent200:h,accent300:m,accent400:g,accent500:b,accent600:y}=Hf(),{colorMode:x}=wi(),[C]=Ks("shadows",["dark-lg"]);return l.useCallback(()=>({label:{color:Ke(c,r)(x)},separatorLabel:{color:Ke(s,s)(x),"::after":{borderTopColor:Ke(r,c)(x)}},searchInput:{":placeholder":{color:Ke(r,c)(x)}},input:{backgroundColor:Ke(e,p)(x),borderWidth:"2px",borderColor:Ke(n,d)(x),color:Ke(p,t)(x),paddingRight:24,fontWeight:600,"&:hover":{borderColor:Ke(r,i)(x)},"&:focus":{borderColor:Ke(m,y)(x)},"&:is(:focus, :hover)":{borderColor:Ke(o,s)(x)},"&:focus-within":{borderColor:Ke(h,y)(x)},"&[data-disabled]":{backgroundColor:Ke(r,c)(x),color:Ke(i,o)(x),cursor:"not-allowed"}},value:{backgroundColor:Ke(n,d)(x),color:Ke(p,t)(x),button:{color:Ke(p,t)(x)},"&:hover":{backgroundColor:Ke(r,c)(x),cursor:"pointer"}},dropdown:{backgroundColor:Ke(n,d)(x),borderColor:Ke(n,d)(x),boxShadow:C},item:{backgroundColor:Ke(n,d)(x),color:Ke(d,n)(x),padding:6,"&[data-hovered]":{color:Ke(p,t)(x),backgroundColor:Ke(r,c)(x)},"&[data-active]":{backgroundColor:Ke(r,c)(x),"&:hover":{color:Ke(p,t)(x),backgroundColor:Ke(r,c)(x)}},"&[data-selected]":{backgroundColor:Ke(g,y)(x),color:Ke(e,t)(x),fontWeight:600,"&:hover":{backgroundColor:Ke(b,b)(x),color:Ke("white",e)(x)}},"&[data-disabled]":{color:Ke(s,i)(x),cursor:"not-allowed"}},rightSection:{width:24,padding:20,button:{color:Ke(p,t)(x)}}}),[h,m,g,b,y,t,n,r,o,e,s,i,c,d,p,C,x])},rO=Oe((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,label:s,disabled:i,...c}=e,d=oe(),p=l.useCallback(g=>{g.shiftKey&&d(Uo(!0))},[d]),h=l.useCallback(g=>{g.shiftKey||d(Uo(!1))},[d]),m=Hee();return a.jsx(Fn,{label:r,placement:"top",hasArrow:!0,isOpen:!0,children:a.jsxs(Bn,{ref:t,isDisabled:i,position:"static",children:[s&&a.jsx(vr,{children:s}),a.jsx(IM,{ref:o,disabled:i,onKeyDown:p,onKeyUp:h,searchable:n,maxDropdownHeight:300,styles:m,...c})]})})});rO.displayName="IAIMantineMultiSelect";const Wee=l.memo(rO),Vee=Ro(sg,(e,t)=>({value:t,label:e})).sort((e,t)=>e.label.localeCompare(t.label));function Uee(){const e=oe(),{t}=J(),n=H(o=>o.ui.favoriteSchedulers),r=l.useCallback(o=>{e(jD(o))},[e]);return a.jsx(Wee,{label:t("settings.favoriteSchedulers"),value:n,data:Vee,onChange:r,clearable:!0,searchable:!0,maxSelectedValues:99,placeholder:t("settings.favoriteSchedulersPlaceholder")})}const Gee=de([Ce],({system:e,ui:t})=>{const{shouldConfirmOnDelete:n,enableImageDebugging:r,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:c,shouldUseWatermarker:d,shouldEnableInformationalPopovers:p}=e,{shouldUseSliders:h,shouldShowProgressInViewer:m,shouldAutoChangeDimensions:g}=t;return{shouldConfirmOnDelete:n,enableImageDebugging:r,shouldUseSliders:h,shouldShowProgressInViewer:m,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:c,shouldUseWatermarker:d,shouldAutoChangeDimensions:g,shouldEnableInformationalPopovers:p}},{memoizeOptions:{resultEqualityCheck:Tn}}),qee=({children:e,config:t})=>{const n=oe(),{t:r}=J(),[o,s]=l.useState(3),i=(t==null?void 0:t.shouldShowDeveloperSettings)??!0,c=(t==null?void 0:t.shouldShowResetWebUiText)??!0,d=(t==null?void 0:t.shouldShowClearIntermediates)??!0,p=(t==null?void 0:t.shouldShowLocalizationToggle)??!0;l.useEffect(()=>{i||n(Dw(!1))},[i,n]);const{isNSFWCheckerAvailable:h,isWatermarkerAvailable:m}=RI(void 0,{selectFromResult:({data:ne})=>({isNSFWCheckerAvailable:(ne==null?void 0:ne.nsfw_methods.includes("nsfw_checker"))??!1,isWatermarkerAvailable:(ne==null?void 0:ne.watermarking_methods.includes("invisible_watermark"))??!1})}),{isOpen:g,onOpen:b,onClose:y}=ls(),{isOpen:x,onOpen:C,onClose:S}=ls(),{shouldConfirmOnDelete:j,enableImageDebugging:_,shouldUseSliders:I,shouldShowProgressInViewer:P,consoleLogLevel:M,shouldLogToConsole:R,shouldAntialiasProgressImage:A,shouldUseNSFWChecker:D,shouldUseWatermarker:O,shouldAutoChangeDimensions:T,shouldEnableInformationalPopovers:Y}=H(Gee),z=l.useCallback(()=>{Object.keys(window.localStorage).forEach(ne=>{(_D.includes(ne)||ne.startsWith(ID))&&localStorage.removeItem(ne)}),y(),C(),setInterval(()=>s(ne=>ne-1),1e3)},[y,C]);l.useEffect(()=>{o<=0&&window.location.reload()},[o]);const W=l.useCallback(ne=>{n(PD(ne))},[n]),Q=l.useCallback(ne=>{n(ED(ne))},[n]),U=l.useCallback(ne=>{n(Dw(ne.target.checked))},[n]),{colorMode:L,toggleColorMode:ee}=wi(),K=jn("localization").isFeatureEnabled,Z=H(nO),se=l.useCallback(ne=>{n(EI(ne.target.checked))},[n]),fe=l.useCallback(ne=>{n(MD(ne.target.checked))},[n]),G=l.useCallback(ne=>{n(OD(ne.target.checked))},[n]),te=l.useCallback(ne=>{n(RD(ne.target.checked))},[n]),V=l.useCallback(ne=>{n(AI(ne.target.checked))},[n]),F=l.useCallback(ne=>{n(AD(ne.target.checked))},[n]),X=l.useCallback(ne=>{n(DD(ne.target.checked))},[n]),ue=l.useCallback(ne=>{n(TD(ne.target.checked))},[n]),q=l.useCallback(ne=>{n(ND(ne.target.checked))},[n]);return a.jsxs(a.Fragment,{children:[l.cloneElement(e,{onClick:b}),a.jsxs(bu,{isOpen:g,onClose:y,size:"2xl",isCentered:!0,children:[a.jsx(Ma,{}),a.jsxs(xu,{children:[a.jsx(Ea,{bg:"none",children:r("common.settingsLabel")}),a.jsx(kg,{}),a.jsx(Oa,{children:a.jsxs(N,{sx:{gap:4,flexDirection:"column"},children:[a.jsxs(zc,{children:[a.jsx(vo,{size:"sm",children:r("settings.general")}),a.jsx(Vs,{label:r("settings.confirmOnDelete"),isChecked:j,onChange:se})]}),a.jsxs(zc,{children:[a.jsx(vo,{size:"sm",children:r("settings.generation")}),a.jsx(Uee,{}),a.jsx(Vs,{label:"Enable NSFW Checker",isDisabled:!h,isChecked:D,onChange:fe}),a.jsx(Vs,{label:"Enable Invisible Watermark",isDisabled:!m,isChecked:O,onChange:G})]}),a.jsxs(zc,{children:[a.jsx(vo,{size:"sm",children:r("settings.ui")}),a.jsx(Vs,{label:r("common.darkMode"),isChecked:L==="dark",onChange:ee}),a.jsx(Vs,{label:r("settings.useSlidersForAll"),isChecked:I,onChange:te}),a.jsx(Vs,{label:r("settings.showProgressInViewer"),isChecked:P,onChange:V}),a.jsx(Vs,{label:r("settings.antialiasProgressImages"),isChecked:A,onChange:F}),a.jsx(Vs,{label:r("settings.autoChangeDimensions"),isChecked:T,onChange:X}),p&&a.jsx(Ar,{disabled:!K,label:r("common.languagePickerLabel"),value:Z,data:Object.entries(Lee).map(([ne,pe])=>({value:ne,label:pe})),onChange:Q}),a.jsx(Vs,{label:"Enable informational popovers",isChecked:Y,onChange:ue})]}),i&&a.jsxs(zc,{children:[a.jsx(vo,{size:"sm",children:r("settings.developer")}),a.jsx(Vs,{label:r("settings.shouldLogToConsole"),isChecked:R,onChange:U}),a.jsx(Ar,{disabled:!R,label:r("settings.consoleLogLevel"),onChange:W,value:M,data:$D.concat()}),a.jsx(Vs,{label:r("settings.enableImageDebugging"),isChecked:_,onChange:q})]}),d&&a.jsx(Bee,{}),a.jsxs(zc,{children:[a.jsx(vo,{size:"sm",children:r("settings.resetWebUI")}),a.jsx(Rt,{colorScheme:"error",onClick:z,children:r("settings.resetWebUI")}),c&&a.jsxs(a.Fragment,{children:[a.jsx(Se,{variant:"subtext",children:r("settings.resetWebUIDesc1")}),a.jsx(Se,{variant:"subtext",children:r("settings.resetWebUIDesc2")})]})]})]})}),a.jsx(pi,{children:a.jsx(Rt,{onClick:y,children:r("common.close")})})]})]}),a.jsxs(bu,{closeOnOverlayClick:!1,isOpen:x,onClose:S,isCentered:!0,closeOnEsc:!1,children:[a.jsx(Ma,{backdropFilter:"blur(40px)"}),a.jsxs(xu,{children:[a.jsx(Ea,{}),a.jsx(Oa,{children:a.jsx(N,{justifyContent:"center",children:a.jsx(Se,{fontSize:"lg",children:a.jsxs(Se,{children:[r("settings.resetComplete")," Reloading in ",o,"..."]})})})}),a.jsx(pi,{})]})]})]})},Kee=l.memo(qee),Qee=de(Ce,({system:e})=>{const{isConnected:t,status:n}=e;return{isConnected:t,statusTranslationKey:zee[n]}},_e),Sj={ok:"green.400",working:"yellow.400",error:"red.400"},kj={ok:"green.600",working:"yellow.500",error:"red.500"},Xee=()=>{const{isConnected:e,statusTranslationKey:t}=H(Qee),{t:n}=J(),r=l.useRef(null),{data:o}=Fa(),s=l.useMemo(()=>e?o!=null&&o.queue.in_progress?"working":"ok":"error",[o==null?void 0:o.queue.in_progress,e]),i=eO(r);return a.jsxs(N,{ref:r,h:"full",px:2,alignItems:"center",gap:5,children:[a.jsx(yo,{children:i&&a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(Se,{sx:{fontSize:"sm",fontWeight:"600",pb:"1px",userSelect:"none",color:kj[s],_dark:{color:Sj[s]}},children:n(t)})},"statusText")}),a.jsx(zr,{as:ZZ,sx:{boxSize:"0.5rem",color:kj[s],_dark:{color:Sj[s]}}})]})},Yee=l.memo(Xee),Jee=()=>{const{t:e}=J(),t=jn("bugLink").isFeatureEnabled,n=jn("discordLink").isFeatureEnabled,r=jn("githubLink").isFeatureEnabled,o="http://github.com/invoke-ai/InvokeAI",s="https://discord.gg/ZmtBAhwWhy";return a.jsxs(N,{sx:{gap:2,alignItems:"center"},children:[a.jsx($ee,{}),a.jsx(ji,{}),a.jsx(Yee,{}),a.jsxs(Cg,{children:[a.jsx(wg,{as:tt,variant:"link","aria-label":e("accessibility.menu"),icon:a.jsx(YZ,{}),sx:{boxSize:8}}),a.jsxs(Gl,{motionProps:pu,children:[a.jsxs(Yd,{title:e("common.communityLabel"),children:[r&&a.jsx(Vn,{as:"a",href:o,target:"_blank",icon:a.jsx(VZ,{}),children:e("common.githubLabel")}),t&&a.jsx(Vn,{as:"a",href:`${o}/issues`,target:"_blank",icon:a.jsx(JZ,{}),children:e("common.reportBugLabel")}),n&&a.jsx(Vn,{as:"a",href:s,target:"_blank",icon:a.jsx(WZ,{}),children:e("common.discordLabel")})]}),a.jsxs(Yd,{title:e("common.settingsLabel"),children:[a.jsx(Eee,{children:a.jsx(Vn,{as:"button",icon:a.jsx(pee,{}),children:e("common.hotkeysLabel")})}),a.jsx(Kee,{children:a.jsx(Vn,{as:"button",icon:a.jsx(WM,{}),children:e("common.settingsLabel")})})]})]})]})]})},Zee=l.memo(Jee);/*! * OverlayScrollbars * Version: 2.2.1 * * Copyright (c) Rene Haas | KingSora. * https://github.com/KingSora * * Released under the MIT license. */function Dn(e,t){if(e0(e))for(let n=0;nt(e[n],n,e));return e}function bo(e,t){const n=fl(t);if(sa(t)||n){let o=n?"":{};if(e){const s=window.getComputedStyle(e,null);o=n?Pj(e,s,t):t.reduce((i,c)=>(i[c]=Pj(e,s,c),i),o)}return o}e&&Dn(us(t),o=>mte(e,o,t[o]))}const Gs=(e,t)=>{const{o:n,u:r,_:o}=e;let s=n,i;const c=(h,m)=>{const g=s,b=h,y=m||(r?!r(g,b):g!==b);return(y||o)&&(s=b,i=g),[s,y,i]};return[t?h=>c(t(s,i),h):c,h=>[s,!!h,i]]},Wf=()=>typeof window<"u",oO=Wf()&&Node.ELEMENT_NODE,{toString:ete,hasOwnProperty:u1}=Object.prototype,Ii=e=>e===void 0,Zg=e=>e===null,tte=e=>Ii(e)||Zg(e)?`${e}`:ete.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase(),Ji=e=>typeof e=="number",fl=e=>typeof e=="string",Qy=e=>typeof e=="boolean",oa=e=>typeof e=="function",sa=e=>Array.isArray(e),tf=e=>typeof e=="object"&&!sa(e)&&!Zg(e),e0=e=>{const t=!!e&&e.length,n=Ji(t)&&t>-1&&t%1==0;return sa(e)||!oa(e)&&n?t>0&&tf(e)?t-1 in e:!0:!1},Bb=e=>{if(!e||!tf(e)||tte(e)!=="object")return!1;let t;const n="constructor",r=e[n],o=r&&r.prototype,s=u1.call(e,n),i=o&&u1.call(o,"isPrototypeOf");if(r&&!s&&!i)return!1;for(t in e);return Ii(t)||u1.call(e,t)},Wm=e=>{const t=HTMLElement;return e?t?e instanceof t:e.nodeType===oO:!1},t0=e=>{const t=Element;return e?t?e instanceof t:e.nodeType===oO:!1},Xy=(e,t,n)=>e.indexOf(t,n),Gn=(e,t,n)=>(!n&&!fl(t)&&e0(t)?Array.prototype.push.apply(e,t):e.push(t),e),Xl=e=>{const t=Array.from,n=[];return t&&e?t(e):(e instanceof Set?e.forEach(r=>{Gn(n,r)}):Dn(e,r=>{Gn(n,r)}),n)},Yy=e=>!!e&&e.length===0,Wa=(e,t,n)=>{Dn(e,o=>o&&o.apply(void 0,t||[])),!n&&(e.length=0)},n0=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),us=e=>e?Object.keys(e):[],kr=(e,t,n,r,o,s,i)=>{const c=[t,n,r,o,s,i];return(typeof e!="object"||Zg(e))&&!oa(e)&&(e={}),Dn(c,d=>{Dn(us(d),p=>{const h=d[p];if(e===h)return!0;const m=sa(h);if(h&&(Bb(h)||m)){const g=e[p];let b=g;m&&!sa(g)?b=[]:!m&&!Bb(g)&&(b={}),e[p]=kr(b,h)}else e[p]=h})}),e},Jy=e=>{for(const t in e)return!1;return!0},sO=(e,t,n,r)=>{if(Ii(r))return n?n[e]:t;n&&(fl(r)||Ji(r))&&(n[e]=r)},go=(e,t,n)=>{if(Ii(n))return e?e.getAttribute(t):null;e&&e.setAttribute(t,n)},zo=(e,t)=>{e&&e.removeAttribute(t)},Ll=(e,t,n,r)=>{if(n){const o=go(e,t)||"",s=new Set(o.split(" "));s[r?"add":"delete"](n);const i=Xl(s).join(" ").trim();go(e,t,i)}},nte=(e,t,n)=>{const r=go(e,t)||"";return new Set(r.split(" ")).has(n)},ea=(e,t)=>sO("scrollLeft",0,e,t),li=(e,t)=>sO("scrollTop",0,e,t),Hb=Wf()&&Element.prototype,aO=(e,t)=>{const n=[],r=t?t0(t)?t:null:document;return r?Gn(n,r.querySelectorAll(e)):n},rte=(e,t)=>{const n=t?t0(t)?t:null:document;return n?n.querySelector(e):null},Vm=(e,t)=>t0(e)?(Hb.matches||Hb.msMatchesSelector).call(e,t):!1,Zy=e=>e?Xl(e.childNodes):[],mi=e=>e?e.parentElement:null,qc=(e,t)=>{if(t0(e)){const n=Hb.closest;if(n)return n.call(e,t);do{if(Vm(e,t))return e;e=mi(e)}while(e)}return null},ote=(e,t,n)=>{const r=e&&qc(e,t),o=e&&rte(n,r),s=qc(o,t)===r;return r&&o?r===e||o===e||s&&qc(qc(e,n),t)!==r:!1},e2=(e,t,n)=>{if(n&&e){let r=t,o;e0(n)?(o=document.createDocumentFragment(),Dn(n,s=>{s===r&&(r=s.previousSibling),o.appendChild(s)})):o=n,t&&(r?r!==t&&(r=r.nextSibling):r=e.firstChild),e.insertBefore(o,r||null)}},Ss=(e,t)=>{e2(e,null,t)},ste=(e,t)=>{e2(mi(e),e,t)},jj=(e,t)=>{e2(mi(e),e&&e.nextSibling,t)},Aa=e=>{if(e0(e))Dn(Xl(e),t=>Aa(t));else if(e){const t=mi(e);t&&t.removeChild(e)}},zl=e=>{const t=document.createElement("div");return e&&go(t,"class",e),t},iO=e=>{const t=zl();return t.innerHTML=e.trim(),Dn(Zy(t),n=>Aa(n))},Wb=e=>e.charAt(0).toUpperCase()+e.slice(1),ate=()=>zl().style,ite=["-webkit-","-moz-","-o-","-ms-"],lte=["WebKit","Moz","O","MS","webkit","moz","o","ms"],d1={},f1={},cte=e=>{let t=f1[e];if(n0(f1,e))return t;const n=Wb(e),r=ate();return Dn(ite,o=>{const s=o.replace(/-/g,"");return!(t=[e,o+e,s+n,Wb(s)+n].find(c=>r[c]!==void 0))}),f1[e]=t||""},Vf=e=>{if(Wf()){let t=d1[e]||window[e];return n0(d1,e)||(Dn(lte,n=>(t=t||window[n+Wb(e)],!t)),d1[e]=t),t}},ute=Vf("MutationObserver"),_j=Vf("IntersectionObserver"),Kc=Vf("ResizeObserver"),lO=Vf("cancelAnimationFrame"),cO=Vf("requestAnimationFrame"),Um=Wf()&&window.setTimeout,Vb=Wf()&&window.clearTimeout,dte=/[^\x20\t\r\n\f]+/g,uO=(e,t,n)=>{const r=e&&e.classList;let o,s=0,i=!1;if(r&&t&&fl(t)){const c=t.match(dte)||[];for(i=c.length>0;o=c[s++];)i=!!n(r,o)&&i}return i},t2=(e,t)=>{uO(e,t,(n,r)=>n.remove(r))},ci=(e,t)=>(uO(e,t,(n,r)=>n.add(r)),t2.bind(0,e,t)),r0=(e,t,n,r)=>{if(e&&t){let o=!0;return Dn(n,s=>{const i=r?r(e[s]):e[s],c=r?r(t[s]):t[s];i!==c&&(o=!1)}),o}return!1},dO=(e,t)=>r0(e,t,["w","h"]),fO=(e,t)=>r0(e,t,["x","y"]),fte=(e,t)=>r0(e,t,["t","r","b","l"]),Ij=(e,t,n)=>r0(e,t,["width","height"],n&&(r=>Math.round(r))),ys=()=>{},Fc=e=>{let t;const n=e?Um:cO,r=e?Vb:lO;return[o=>{r(t),t=n(o,oa(e)?e():e)},()=>r(t)]},n2=(e,t)=>{let n,r,o,s=ys;const{v:i,g:c,p:d}=t||{},p=function(y){s(),Vb(n),n=r=void 0,s=ys,e.apply(this,y)},h=b=>d&&r?d(r,b):b,m=()=>{s!==ys&&p(h(o)||o)},g=function(){const y=Xl(arguments),x=oa(i)?i():i;if(Ji(x)&&x>=0){const S=oa(c)?c():c,j=Ji(S)&&S>=0,_=x>0?Um:cO,I=x>0?Vb:lO,M=h(y)||y,R=p.bind(0,M);s();const A=_(R,x);s=()=>I(A),j&&!n&&(n=Um(m,S)),r=o=M}else p(y)};return g.m=m,g},pte={opacity:1,zindex:1},ih=(e,t)=>{const n=t?parseFloat(e):parseInt(e,10);return n===n?n:0},hte=(e,t)=>!pte[e.toLowerCase()]&&Ji(t)?`${t}px`:t,Pj=(e,t,n)=>t!=null?t[n]||t.getPropertyValue(n):e.style[n],mte=(e,t,n)=>{try{const{style:r}=e;Ii(r[t])?r.setProperty(t,n):r[t]=hte(t,n)}catch{}},nf=e=>bo(e,"direction")==="rtl",Ej=(e,t,n)=>{const r=t?`${t}-`:"",o=n?`-${n}`:"",s=`${r}top${o}`,i=`${r}right${o}`,c=`${r}bottom${o}`,d=`${r}left${o}`,p=bo(e,[s,i,c,d]);return{t:ih(p[s],!0),r:ih(p[i],!0),b:ih(p[c],!0),l:ih(p[d],!0)}},{round:Mj}=Math,r2={w:0,h:0},rf=e=>e?{w:e.offsetWidth,h:e.offsetHeight}:r2,Ah=e=>e?{w:e.clientWidth,h:e.clientHeight}:r2,Gm=e=>e?{w:e.scrollWidth,h:e.scrollHeight}:r2,qm=e=>{const t=parseFloat(bo(e,"height"))||0,n=parseFloat(bo(e,"width"))||0;return{w:n-Mj(n),h:t-Mj(t)}},Sa=e=>e.getBoundingClientRect();let lh;const gte=()=>{if(Ii(lh)){lh=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get(){lh=!0}}))}catch{}}return lh},pO=e=>e.split(" "),vte=(e,t,n,r)=>{Dn(pO(t),o=>{e.removeEventListener(o,n,r)})},Gr=(e,t,n,r)=>{var o;const s=gte(),i=(o=s&&r&&r.S)!=null?o:s,c=r&&r.$||!1,d=r&&r.C||!1,p=[],h=s?{passive:i,capture:c}:c;return Dn(pO(t),m=>{const g=d?b=>{e.removeEventListener(m,g,c),n&&n(b)}:n;Gn(p,vte.bind(null,e,m,g,c)),e.addEventListener(m,g,h)}),Wa.bind(0,p)},hO=e=>e.stopPropagation(),mO=e=>e.preventDefault(),bte={x:0,y:0},p1=e=>{const t=e?Sa(e):0;return t?{x:t.left+window.pageYOffset,y:t.top+window.pageXOffset}:bte},Oj=(e,t)=>{Dn(sa(t)?t:[t],e)},o2=e=>{const t=new Map,n=(s,i)=>{if(s){const c=t.get(s);Oj(d=>{c&&c[d?"delete":"clear"](d)},i)}else t.forEach(c=>{c.clear()}),t.clear()},r=(s,i)=>{if(fl(s)){const p=t.get(s)||new Set;return t.set(s,p),Oj(h=>{oa(h)&&p.add(h)},i),n.bind(0,s,i)}Qy(i)&&i&&n();const c=us(s),d=[];return Dn(c,p=>{const h=s[p];h&&Gn(d,r(p,h))}),Wa.bind(0,d)},o=(s,i)=>{const c=t.get(s);Dn(Xl(c),d=>{i&&!Yy(i)?d.apply(0,i):d()})};return r(e||{}),[r,n,o]},Rj=e=>JSON.stringify(e,(t,n)=>{if(oa(n))throw new Error;return n}),xte={paddingAbsolute:!1,showNativeOverlaidScrollbars:!1,update:{elementEvents:[["img","load"]],debounce:[0,33],attributes:null,ignoreMutation:null},overflow:{x:"scroll",y:"scroll"},scrollbars:{theme:"os-theme-dark",visibility:"auto",autoHide:"never",autoHideDelay:1300,dragScroll:!0,clickScroll:!1,pointers:["mouse","touch","pen"]}},gO=(e,t)=>{const n={},r=us(t).concat(us(e));return Dn(r,o=>{const s=e[o],i=t[o];if(tf(s)&&tf(i))kr(n[o]={},gO(s,i)),Jy(n[o])&&delete n[o];else if(n0(t,o)&&i!==s){let c=!0;if(sa(s)||sa(i))try{Rj(s)===Rj(i)&&(c=!1)}catch{}c&&(n[o]=i)}}),n},vO="os-environment",bO=`${vO}-flexbox-glue`,yte=`${bO}-max`,xO="os-scrollbar-hidden",h1="data-overlayscrollbars-initialize",qs="data-overlayscrollbars",yO=`${qs}-overflow-x`,CO=`${qs}-overflow-y`,cu="overflowVisible",Cte="scrollbarHidden",Aj="scrollbarPressed",Km="updating",Hi="data-overlayscrollbars-viewport",m1="arrange",wO="scrollbarHidden",uu=cu,Ub="data-overlayscrollbars-padding",wte=uu,Dj="data-overlayscrollbars-content",s2="os-size-observer",Ste=`${s2}-appear`,kte=`${s2}-listener`,jte="os-trinsic-observer",_te="os-no-css-vars",Ite="os-theme-none",Ko="os-scrollbar",Pte=`${Ko}-rtl`,Ete=`${Ko}-horizontal`,Mte=`${Ko}-vertical`,SO=`${Ko}-track`,a2=`${Ko}-handle`,Ote=`${Ko}-visible`,Rte=`${Ko}-cornerless`,Tj=`${Ko}-transitionless`,Nj=`${Ko}-interaction`,$j=`${Ko}-unusable`,Lj=`${Ko}-auto-hidden`,zj=`${Ko}-wheel`,Ate=`${SO}-interactive`,Dte=`${a2}-interactive`,kO={},Yl=()=>kO,Tte=e=>{const t=[];return Dn(sa(e)?e:[e],n=>{const r=us(n);Dn(r,o=>{Gn(t,kO[o]=n[o])})}),t},Nte="__osOptionsValidationPlugin",$te="__osSizeObserverPlugin",i2="__osScrollbarsHidingPlugin",Lte="__osClickScrollPlugin";let g1;const Fj=(e,t,n,r)=>{Ss(e,t);const o=Ah(t),s=rf(t),i=qm(n);return r&&Aa(t),{x:s.h-o.h+i.h,y:s.w-o.w+i.w}},zte=e=>{let t=!1;const n=ci(e,xO);try{t=bo(e,cte("scrollbar-width"))==="none"||window.getComputedStyle(e,"::-webkit-scrollbar").getPropertyValue("display")==="none"}catch{}return n(),t},Fte=(e,t)=>{const n="hidden";bo(e,{overflowX:n,overflowY:n,direction:"rtl"}),ea(e,0);const r=p1(e),o=p1(t);ea(e,-999);const s=p1(t);return{i:r.x===o.x,n:o.x!==s.x}},Bte=(e,t)=>{const n=ci(e,bO),r=Sa(e),o=Sa(t),s=Ij(o,r,!0),i=ci(e,yte),c=Sa(e),d=Sa(t),p=Ij(d,c,!0);return n(),i(),s&&p},Hte=()=>{const{body:e}=document,n=iO(`
`)[0],r=n.firstChild,[o,,s]=o2(),[i,c]=Gs({o:Fj(e,n,r),u:fO},Fj.bind(0,e,n,r,!0)),[d]=c(),p=zte(n),h={x:d.x===0,y:d.y===0},m={elements:{host:null,padding:!p,viewport:j=>p&&j===j.ownerDocument.body&&j,content:!1},scrollbars:{slot:!0},cancel:{nativeScrollbarsOverlaid:!1,body:null}},g=kr({},xte),b=kr.bind(0,{},g),y=kr.bind(0,{},m),x={k:d,A:h,I:p,L:bo(n,"zIndex")==="-1",B:Fte(n,r),V:Bte(n,r),Y:o.bind(0,"z"),j:o.bind(0,"r"),N:y,q:j=>kr(m,j)&&y(),F:b,G:j=>kr(g,j)&&b(),X:kr({},m),U:kr({},g)},C=window.addEventListener,S=n2(j=>s(j?"z":"r"),{v:33,g:99});if(zo(n,"style"),Aa(n),C("resize",S.bind(0,!1)),!p&&(!h.x||!h.y)){let j;C("resize",()=>{const _=Yl()[i2];j=j||_&&_.R(),j&&j(x,i,S.bind(0,!0))})}return x},Qo=()=>(g1||(g1=Hte()),g1),l2=(e,t)=>oa(t)?t.apply(0,e):t,Wte=(e,t,n,r)=>{const o=Ii(r)?n:r;return l2(e,o)||t.apply(0,e)},jO=(e,t,n,r)=>{const o=Ii(r)?n:r,s=l2(e,o);return!!s&&(Wm(s)?s:t.apply(0,e))},Vte=(e,t,n)=>{const{nativeScrollbarsOverlaid:r,body:o}=n||{},{A:s,I:i}=Qo(),{nativeScrollbarsOverlaid:c,body:d}=t,p=r??c,h=Ii(o)?d:o,m=(s.x||s.y)&&p,g=e&&(Zg(h)?!i:h);return!!m||!!g},c2=new WeakMap,Ute=(e,t)=>{c2.set(e,t)},Gte=e=>{c2.delete(e)},_O=e=>c2.get(e),Bj=(e,t)=>e?t.split(".").reduce((n,r)=>n&&n0(n,r)?n[r]:void 0,e):void 0,Gb=(e,t,n)=>r=>[Bj(e,r),n||Bj(t,r)!==void 0],IO=e=>{let t=e;return[()=>t,n=>{t=kr({},t,n)}]},ch="tabindex",uh=zl.bind(0,""),v1=e=>{Ss(mi(e),Zy(e)),Aa(e)},qte=e=>{const t=Qo(),{N:n,I:r}=t,o=Yl()[i2],s=o&&o.T,{elements:i}=n(),{host:c,padding:d,viewport:p,content:h}=i,m=Wm(e),g=m?{}:e,{elements:b}=g,{host:y,padding:x,viewport:C,content:S}=b||{},j=m?e:g.target,_=Vm(j,"textarea"),I=j.ownerDocument,P=I.documentElement,M=j===I.body,R=I.defaultView,A=Wte.bind(0,[j]),D=jO.bind(0,[j]),O=l2.bind(0,[j]),T=A.bind(0,uh,p),Y=D.bind(0,uh,h),z=T(C),W=z===j,Q=W&&M,U=!W&&Y(S),L=!W&&Wm(z)&&z===U,ee=L&&!!O(h),K=ee?T():z,Z=ee?U:Y(),fe=Q?P:L?K:z,G=_?A(uh,c,y):j,te=Q?fe:G,V=L?Z:U,F=I.activeElement,X=!W&&R.top===R&&F===j,ue={W:j,Z:te,J:fe,K:!W&&D(uh,d,x),tt:V,nt:!W&&!r&&s&&s(t),ot:Q?P:fe,st:Q?I:fe,et:R,ct:I,rt:_,it:M,lt:m,ut:W,dt:L,ft:(pt,vt)=>nte(fe,W?qs:Hi,W?vt:pt),_t:(pt,vt,ke)=>Ll(fe,W?qs:Hi,W?vt:pt,ke)},q=us(ue).reduce((pt,vt)=>{const ke=ue[vt];return Gn(pt,ke&&!mi(ke)?ke:!1)},[]),ne=pt=>pt?Xy(q,pt)>-1:null,{W:pe,Z:le,K:we,J:ve,tt:he,nt:Ne}=ue,De=[()=>{zo(le,qs),zo(le,h1),zo(pe,h1),M&&(zo(P,qs),zo(P,h1))}],qe=_&&ne(le);let Mt=_?pe:Zy([he,ve,we,le,pe].find(pt=>ne(pt)===!1));const ot=Q?pe:he||ve;return[ue,()=>{go(le,qs,W?"viewport":"host"),go(we,Ub,""),go(he,Dj,""),W||go(ve,Hi,"");const pt=M&&!W?ci(mi(j),xO):ys;if(qe&&(jj(pe,le),Gn(De,()=>{jj(le,pe),Aa(le)})),Ss(ot,Mt),Ss(le,we),Ss(we||le,!W&&ve),Ss(ve,he),Gn(De,()=>{pt(),zo(we,Ub),zo(he,Dj),zo(ve,yO),zo(ve,CO),zo(ve,Hi),ne(he)&&v1(he),ne(ve)&&v1(ve),ne(we)&&v1(we)}),r&&!W&&(Ll(ve,Hi,wO,!0),Gn(De,zo.bind(0,ve,Hi))),Ne&&(ste(ve,Ne),Gn(De,Aa.bind(0,Ne))),X){const vt=go(ve,ch);go(ve,ch,"-1"),ve.focus();const ke=()=>vt?go(ve,ch,vt):zo(ve,ch),Be=Gr(I,"pointerdown keydown",()=>{ke(),Be()});Gn(De,[ke,Be])}else F&&F.focus&&F.focus();Mt=0},Wa.bind(0,De)]},Kte=(e,t)=>{const{tt:n}=e,[r]=t;return o=>{const{V:s}=Qo(),{ht:i}=r(),{vt:c}=o,d=(n||!s)&&c;return d&&bo(n,{height:i?"":"100%"}),{gt:d,wt:d}}},Qte=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,ut:c}=e,[d,p]=Gs({u:fte,o:Ej()},Ej.bind(0,o,"padding",""));return(h,m,g)=>{let[b,y]=p(g);const{I:x,V:C}=Qo(),{bt:S}=n(),{gt:j,wt:_,yt:I}=h,[P,M]=m("paddingAbsolute");(j||y||!C&&_)&&([b,y]=d(g));const A=!c&&(M||I||y);if(A){const D=!P||!s&&!x,O=b.r+b.l,T=b.t+b.b,Y={marginRight:D&&!S?-O:0,marginBottom:D?-T:0,marginLeft:D&&S?-O:0,top:D?-b.t:0,right:D?S?-b.r:"auto":0,left:D?S?"auto":-b.l:0,width:D?`calc(100% + ${O}px)`:""},z={paddingTop:D?b.t:0,paddingRight:D?b.r:0,paddingBottom:D?b.b:0,paddingLeft:D?b.l:0};bo(s||i,Y),bo(i,z),r({K:b,St:!D,P:s?z:kr({},Y,z)})}return{xt:A}}},{max:qb}=Math,Wi=qb.bind(0,0),PO="visible",Hj="hidden",Xte=42,dh={u:dO,o:{w:0,h:0}},Yte={u:fO,o:{x:Hj,y:Hj}},Jte=(e,t)=>{const n=window.devicePixelRatio%1!==0?1:0,r={w:Wi(e.w-t.w),h:Wi(e.h-t.h)};return{w:r.w>n?r.w:0,h:r.h>n?r.h:0}},fh=e=>e.indexOf(PO)===0,Zte=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,nt:c,ut:d,_t:p,it:h,et:m}=e,{k:g,V:b,I:y,A:x}=Qo(),C=Yl()[i2],S=!d&&!y&&(x.x||x.y),j=h&&d,[_,I]=Gs(dh,qm.bind(0,i)),[P,M]=Gs(dh,Gm.bind(0,i)),[R,A]=Gs(dh),[D,O]=Gs(dh),[T]=Gs(Yte),Y=(ee,K)=>{if(bo(i,{height:""}),K){const{St:Z,K:se}=n(),{$t:fe,D:G}=ee,te=qm(o),V=Ah(o),F=bo(i,"boxSizing")==="content-box",X=Z||F?se.b+se.t:0,ue=!(x.x&&F);bo(i,{height:V.h+te.h+(fe.x&&ue?G.x:0)-X})}},z=(ee,K)=>{const Z=!y&&!ee?Xte:0,se=(ne,pe,le)=>{const we=bo(i,ne),he=(K?K[ne]:we)==="scroll";return[we,he,he&&!y?pe?Z:le:0,pe&&!!Z]},[fe,G,te,V]=se("overflowX",x.x,g.x),[F,X,ue,q]=se("overflowY",x.y,g.y);return{Ct:{x:fe,y:F},$t:{x:G,y:X},D:{x:te,y:ue},M:{x:V,y:q}}},W=(ee,K,Z,se)=>{const fe=(X,ue)=>{const q=fh(X),ne=ue&&q&&X.replace(`${PO}-`,"")||"";return[ue&&!q?X:"",fh(ne)?"hidden":ne]},[G,te]=fe(Z.x,K.x),[V,F]=fe(Z.y,K.y);return se.overflowX=te&&V?te:G,se.overflowY=F&&G?F:V,z(ee,se)},Q=(ee,K,Z,se)=>{const{D:fe,M:G}=ee,{x:te,y:V}=G,{x:F,y:X}=fe,{P:ue}=n(),q=K?"marginLeft":"marginRight",ne=K?"paddingLeft":"paddingRight",pe=ue[q],le=ue.marginBottom,we=ue[ne],ve=ue.paddingBottom;se.width=`calc(100% + ${X+-1*pe}px)`,se[q]=-X+pe,se.marginBottom=-F+le,Z&&(se[ne]=we+(V?X:0),se.paddingBottom=ve+(te?F:0))},[U,L]=C?C.H(S,b,i,c,n,z,Q):[()=>S,()=>[ys]];return(ee,K,Z)=>{const{gt:se,Ot:fe,wt:G,xt:te,vt:V,yt:F}=ee,{ht:X,bt:ue}=n(),[q,ne]=K("showNativeOverlaidScrollbars"),[pe,le]=K("overflow"),we=q&&x.x&&x.y,ve=!d&&!b&&(se||G||fe||ne||V),he=fh(pe.x),Ne=fh(pe.y),De=he||Ne;let qe=I(Z),Mt=M(Z),ot=A(Z),an=O(Z),pt;if(ne&&y&&p(wO,Cte,!we),ve&&(pt=z(we),Y(pt,X)),se||te||G||F||ne){De&&p(uu,cu,!1);const[Me,Ze]=L(we,ue,pt),[Ye,ut]=qe=_(Z),[Ut,xr]=Mt=P(Z),yn=Ah(i);let hn=Ut,oo=yn;Me(),(xr||ut||ne)&&Ze&&!we&&U(Ze,Ut,Ye,ue)&&(oo=Ah(i),hn=Gm(i));const Dr={w:Wi(qb(Ut.w,hn.w)+Ye.w),h:Wi(qb(Ut.h,hn.h)+Ye.h)},nr={w:Wi((j?m.innerWidth:oo.w+Wi(yn.w-Ut.w))+Ye.w),h:Wi((j?m.innerHeight+Ye.h:oo.h+Wi(yn.h-Ut.h))+Ye.h)};an=D(nr),ot=R(Jte(Dr,nr),Z)}const[vt,ke]=an,[Be,Ot]=ot,[Ht,je]=Mt,[ht,At]=qe,_t={x:Be.w>0,y:Be.h>0},Re=he&&Ne&&(_t.x||_t.y)||he&&_t.x&&!_t.y||Ne&&_t.y&&!_t.x;if(te||F||At||je||ke||Ot||le||ne||ve){const Me={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},Ze=W(we,_t,pe,Me),Ye=U(Ze,Ht,ht,ue);d||Q(Ze,ue,Ye,Me),ve&&Y(Ze,X),d?(go(o,yO,Me.overflowX),go(o,CO,Me.overflowY)):bo(i,Me)}Ll(o,qs,cu,Re),Ll(s,Ub,wte,Re),d||Ll(i,Hi,uu,De);const[Xe,_n]=T(z(we).Ct);return r({Ct:Xe,zt:{x:vt.w,y:vt.h},Tt:{x:Be.w,y:Be.h},Et:_t}),{It:_n,At:ke,Lt:Ot}}},Wj=(e,t,n)=>{const r={},o=t||{},s=us(e).concat(us(o));return Dn(s,i=>{const c=e[i],d=o[i];r[i]=!!(n||c||d)}),r},ene=(e,t)=>{const{W:n,J:r,_t:o,ut:s}=e,{I:i,A:c,V:d}=Qo(),p=!i&&(c.x||c.y),h=[Kte(e,t),Qte(e,t),Zte(e,t)];return(m,g,b)=>{const y=Wj(kr({gt:!1,xt:!1,yt:!1,vt:!1,At:!1,Lt:!1,It:!1,Ot:!1,wt:!1},g),{},b),x=p||!d,C=x&&ea(r),S=x&&li(r);o("",Km,!0);let j=y;return Dn(h,_=>{j=Wj(j,_(j,m,!!b)||{},b)}),ea(r,C),li(r,S),o("",Km),s||(ea(n,0),li(n,0)),j}},tne=(e,t,n)=>{let r,o=!1;const s=()=>{o=!0},i=c=>{if(n){const d=n.reduce((p,h)=>{if(h){const[m,g]=h,b=g&&m&&(c?c(m):aO(m,e));b&&b.length&&g&&fl(g)&&Gn(p,[b,g.trim()],!0)}return p},[]);Dn(d,p=>Dn(p[0],h=>{const m=p[1],g=r.get(h)||[];if(e.contains(h)){const y=Gr(h,m,x=>{o?(y(),r.delete(h)):t(x)});r.set(h,Gn(g,y))}else Wa(g),r.delete(h)}))}};return n&&(r=new WeakMap,i()),[s,i]},Vj=(e,t,n,r)=>{let o=!1;const{Ht:s,Pt:i,Dt:c,Mt:d,Rt:p,kt:h}=r||{},m=n2(()=>{o&&n(!0)},{v:33,g:99}),[g,b]=tne(e,m,c),y=s||[],x=i||[],C=y.concat(x),S=(_,I)=>{const P=p||ys,M=h||ys,R=new Set,A=new Set;let D=!1,O=!1;if(Dn(_,T=>{const{attributeName:Y,target:z,type:W,oldValue:Q,addedNodes:U,removedNodes:L}=T,ee=W==="attributes",K=W==="childList",Z=e===z,se=ee&&fl(Y)?go(z,Y):0,fe=se!==0&&Q!==se,G=Xy(x,Y)>-1&&fe;if(t&&(K||!Z)){const te=!ee,V=ee&&fe,F=V&&d&&Vm(z,d),ue=(F?!P(z,Y,Q,se):te||V)&&!M(T,!!F,e,r);Dn(U,q=>R.add(q)),Dn(L,q=>R.add(q)),O=O||ue}!t&&Z&&fe&&!P(z,Y,Q,se)&&(A.add(Y),D=D||G)}),R.size>0&&b(T=>Xl(R).reduce((Y,z)=>(Gn(Y,aO(T,z)),Vm(z,T)?Gn(Y,z):Y),[])),t)return!I&&O&&n(!1),[!1];if(A.size>0||D){const T=[Xl(A),D];return!I&&n.apply(0,T),T}},j=new ute(_=>S(_));return j.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:C,subtree:t,childList:t,characterData:t}),o=!0,[()=>{o&&(g(),j.disconnect(),o=!1)},()=>{if(o){m.m();const _=j.takeRecords();return!Yy(_)&&S(_,!0)}}]},ph=3333333,hh=e=>e&&(e.height||e.width),EO=(e,t,n)=>{const{Bt:r=!1,Vt:o=!1}=n||{},s=Yl()[$te],{B:i}=Qo(),d=iO(`
`)[0],p=d.firstChild,h=nf.bind(0,e),[m]=Gs({o:void 0,_:!0,u:(x,C)=>!(!x||!hh(x)&&hh(C))}),g=x=>{const C=sa(x)&&x.length>0&&tf(x[0]),S=!C&&Qy(x[0]);let j=!1,_=!1,I=!0;if(C){const[P,,M]=m(x.pop().contentRect),R=hh(P),A=hh(M);j=!M||!R,_=!A&&R,I=!j}else S?[,I]=x:_=x===!0;if(r&&I){const P=S?x[0]:nf(d);ea(d,P?i.n?-ph:i.i?0:ph:ph),li(d,ph)}j||t({gt:!S,Yt:S?x:void 0,Vt:!!_})},b=[];let y=o?g:!1;return[()=>{Wa(b),Aa(d)},()=>{if(Kc){const x=new Kc(g);x.observe(p),Gn(b,()=>{x.disconnect()})}else if(s){const[x,C]=s.O(p,g,o);y=x,Gn(b,C)}if(r){const[x]=Gs({o:void 0},h);Gn(b,Gr(d,"scroll",C=>{const S=x(),[j,_,I]=S;_&&(t2(p,"ltr rtl"),j?ci(p,"rtl"):ci(p,"ltr"),g([!!j,_,I])),hO(C)}))}y&&(ci(d,Ste),Gn(b,Gr(d,"animationstart",y,{C:!!Kc}))),(Kc||s)&&Ss(e,d)}]},nne=e=>e.h===0||e.isIntersecting||e.intersectionRatio>0,rne=(e,t)=>{let n;const r=zl(jte),o=[],[s]=Gs({o:!1}),i=(d,p)=>{if(d){const h=s(nne(d)),[,m]=h;if(m)return!p&&t(h),[h]}},c=(d,p)=>{if(d&&d.length>0)return i(d.pop(),p)};return[()=>{Wa(o),Aa(r)},()=>{if(_j)n=new _j(d=>c(d),{root:e}),n.observe(r),Gn(o,()=>{n.disconnect()});else{const d=()=>{const m=rf(r);i(m)},[p,h]=EO(r,d);Gn(o,p),h(),d()}Ss(e,r)},()=>{if(n)return c(n.takeRecords(),!0)}]},Uj=`[${qs}]`,one=`[${Hi}]`,b1=["tabindex"],Gj=["wrap","cols","rows"],x1=["id","class","style","open"],sne=(e,t,n)=>{let r,o,s;const{Z:i,J:c,tt:d,rt:p,ut:h,ft:m,_t:g}=e,{V:b}=Qo(),[y]=Gs({u:dO,o:{w:0,h:0}},()=>{const W=m(uu,cu),Q=m(m1,""),U=Q&&ea(c),L=Q&&li(c);g(uu,cu),g(m1,""),g("",Km,!0);const ee=Gm(d),K=Gm(c),Z=qm(c);return g(uu,cu,W),g(m1,"",Q),g("",Km),ea(c,U),li(c,L),{w:K.w+ee.w+Z.w,h:K.h+ee.h+Z.h}}),x=p?Gj:x1.concat(Gj),C=n2(n,{v:()=>r,g:()=>o,p(W,Q){const[U]=W,[L]=Q;return[us(U).concat(us(L)).reduce((ee,K)=>(ee[K]=U[K]||L[K],ee),{})]}}),S=W=>{Dn(W||b1,Q=>{if(Xy(b1,Q)>-1){const U=go(i,Q);fl(U)?go(c,Q,U):zo(c,Q)}})},j=(W,Q)=>{const[U,L]=W,ee={vt:L};return t({ht:U}),!Q&&n(ee),ee},_=({gt:W,Yt:Q,Vt:U})=>{const L=!W||U?n:C;let ee=!1;if(Q){const[K,Z]=Q;ee=Z,t({bt:K})}L({gt:W,yt:ee})},I=(W,Q)=>{const[,U]=y(),L={wt:U};return U&&!Q&&(W?n:C)(L),L},P=(W,Q,U)=>{const L={Ot:Q};return Q?!U&&C(L):h||S(W),L},[M,R,A]=d||!b?rne(i,j):[ys,ys,ys],[D,O]=h?[ys,ys]:EO(i,_,{Vt:!0,Bt:!0}),[T,Y]=Vj(i,!1,P,{Pt:x1,Ht:x1.concat(b1)}),z=h&&Kc&&new Kc(_.bind(0,{gt:!0}));return z&&z.observe(i),S(),[()=>{M(),D(),s&&s[0](),z&&z.disconnect(),T()},()=>{O(),R()},()=>{const W={},Q=Y(),U=A(),L=s&&s[1]();return Q&&kr(W,P.apply(0,Gn(Q,!0))),U&&kr(W,j.apply(0,Gn(U,!0))),L&&kr(W,I.apply(0,Gn(L,!0))),W},W=>{const[Q]=W("update.ignoreMutation"),[U,L]=W("update.attributes"),[ee,K]=W("update.elementEvents"),[Z,se]=W("update.debounce"),fe=K||L,G=te=>oa(Q)&&Q(te);if(fe&&(s&&(s[1](),s[0]()),s=Vj(d||c,!0,I,{Ht:x.concat(U||[]),Dt:ee,Mt:Uj,kt:(te,V)=>{const{target:F,attributeName:X}=te;return(!V&&X&&!h?ote(F,Uj,one):!1)||!!qc(F,`.${Ko}`)||!!G(te)}})),se)if(C.m(),sa(Z)){const te=Z[0],V=Z[1];r=Ji(te)&&te,o=Ji(V)&&V}else Ji(Z)?(r=Z,o=!1):(r=!1,o=!1)}]},qj={x:0,y:0},ane=e=>({K:{t:0,r:0,b:0,l:0},St:!1,P:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0},zt:qj,Tt:qj,Ct:{x:"hidden",y:"hidden"},Et:{x:!1,y:!1},ht:!1,bt:nf(e.Z)}),ine=(e,t)=>{const n=Gb(t,{}),[r,o,s]=o2(),[i,c,d]=qte(e),p=IO(ane(i)),[h,m]=p,g=ene(i,p),b=(_,I,P)=>{const R=us(_).some(A=>_[A])||!Jy(I)||P;return R&&s("u",[_,I,P]),R},[y,x,C,S]=sne(i,m,_=>b(g(n,_),{},!1)),j=h.bind(0);return j.jt=_=>r("u",_),j.Nt=()=>{const{W:_,J:I}=i,P=ea(_),M=li(_);x(),c(),ea(I,P),li(I,M)},j.qt=i,[(_,I)=>{const P=Gb(t,_,I);return S(P),b(g(P,C(),I),_,!!I)},j,()=>{o(),y(),d()}]},{round:Kj}=Math,lne=e=>{const{width:t,height:n}=Sa(e),{w:r,h:o}=rf(e);return{x:Kj(t)/r||1,y:Kj(n)/o||1}},cne=(e,t,n)=>{const r=t.scrollbars,{button:o,isPrimary:s,pointerType:i}=e,{pointers:c}=r;return o===0&&s&&r[n?"dragScroll":"clickScroll"]&&(c||[]).includes(i)},une=(e,t)=>Gr(e,"mousedown",Gr.bind(0,t,"click",hO,{C:!0,$:!0}),{$:!0}),Qj="pointerup pointerleave pointercancel lostpointercapture",dne=(e,t,n,r,o,s,i)=>{const{B:c}=Qo(),{Ft:d,Gt:p,Xt:h}=r,m=`scroll${i?"Left":"Top"}`,g=`client${i?"X":"Y"}`,b=i?"width":"height",y=i?"left":"top",x=i?"w":"h",C=i?"x":"y",S=(j,_)=>I=>{const{Tt:P}=s(),M=rf(p)[x]-rf(d)[x],A=_*I/M*P[C],O=nf(h)&&i?c.n||c.i?1:-1:1;o[m]=j+A*O};return Gr(p,"pointerdown",j=>{const _=qc(j.target,`.${a2}`)===d,I=_?d:p;if(Ll(t,qs,Aj,!0),cne(j,e,_)){const P=!_&&j.shiftKey,M=()=>Sa(d),R=()=>Sa(p),A=(K,Z)=>(K||M())[y]-(Z||R())[y],D=S(o[m]||0,1/lne(o)[C]),O=j[g],T=M(),Y=R(),z=T[b],W=A(T,Y)+z/2,Q=O-Y[y],U=_?0:Q-W,L=K=>{Wa(ee),I.releasePointerCapture(K.pointerId)},ee=[Ll.bind(0,t,qs,Aj),Gr(n,Qj,L),Gr(n,"selectstart",K=>mO(K),{S:!1}),Gr(p,Qj,L),Gr(p,"pointermove",K=>{const Z=K[g]-O;(_||P)&&D(U+Z)})];if(P)D(U);else if(!_){const K=Yl()[Lte];K&&Gn(ee,K.O(D,A,U,z,Q))}I.setPointerCapture(j.pointerId)}})},fne=(e,t)=>(n,r,o,s,i,c)=>{const{Xt:d}=n,[p,h]=Fc(333),m=!!i.scrollBy;let g=!0;return Wa.bind(0,[Gr(d,"pointerenter",()=>{r(Nj,!0)}),Gr(d,"pointerleave pointercancel",()=>{r(Nj)}),Gr(d,"wheel",b=>{const{deltaX:y,deltaY:x,deltaMode:C}=b;m&&g&&C===0&&mi(d)===s&&i.scrollBy({left:y,top:x,behavior:"smooth"}),g=!1,r(zj,!0),p(()=>{g=!0,r(zj)}),mO(b)},{S:!1,$:!0}),une(d,o),dne(e,s,o,n,i,t,c),h])},{min:Kb,max:Xj,abs:pne,round:hne}=Math,MO=(e,t,n,r)=>{if(r){const c=n?"x":"y",{Tt:d,zt:p}=r,h=p[c],m=d[c];return Xj(0,Kb(1,h/(h+m)))}const o=n?"width":"height",s=Sa(e)[o],i=Sa(t)[o];return Xj(0,Kb(1,s/i))},mne=(e,t,n,r,o,s)=>{const{B:i}=Qo(),c=s?"x":"y",d=s?"Left":"Top",{Tt:p}=r,h=hne(p[c]),m=pne(n[`scroll${d}`]),g=s&&o,b=i.i?m:h-m,x=Kb(1,(g?b:m)/h),C=MO(e,t,s);return 1/C*(1-C)*x},gne=(e,t,n)=>{const{N:r,L:o}=Qo(),{scrollbars:s}=r(),{slot:i}=s,{ct:c,W:d,Z:p,J:h,lt:m,ot:g,it:b,ut:y}=t,{scrollbars:x}=m?{}:e,{slot:C}=x||{},S=jO([d,p,h],()=>y&&b?d:p,i,C),j=(U,L,ee)=>{const K=ee?ci:t2;Dn(U,Z=>{K(Z.Xt,L)})},_=(U,L)=>{Dn(U,ee=>{const[K,Z]=L(ee);bo(K,Z)})},I=(U,L,ee)=>{_(U,K=>{const{Ft:Z,Gt:se}=K;return[Z,{[ee?"width":"height"]:`${(100*MO(Z,se,ee,L)).toFixed(3)}%`}]})},P=(U,L,ee)=>{const K=ee?"X":"Y";_(U,Z=>{const{Ft:se,Gt:fe,Xt:G}=Z,te=mne(se,fe,g,L,nf(G),ee);return[se,{transform:te===te?`translate${K}(${(100*te).toFixed(3)}%)`:""}]})},M=[],R=[],A=[],D=(U,L,ee)=>{const K=Qy(ee),Z=K?ee:!0,se=K?!ee:!0;Z&&j(R,U,L),se&&j(A,U,L)},O=U=>{I(R,U,!0),I(A,U)},T=U=>{P(R,U,!0),P(A,U)},Y=U=>{const L=U?Ete:Mte,ee=U?R:A,K=Yy(ee)?Tj:"",Z=zl(`${Ko} ${L} ${K}`),se=zl(SO),fe=zl(a2),G={Xt:Z,Gt:se,Ft:fe};return o||ci(Z,_te),Ss(Z,se),Ss(se,fe),Gn(ee,G),Gn(M,[Aa.bind(0,Z),n(G,D,c,p,g,U)]),G},z=Y.bind(0,!0),W=Y.bind(0,!1),Q=()=>{Ss(S,R[0].Xt),Ss(S,A[0].Xt),Um(()=>{D(Tj)},300)};return z(),W(),[{Ut:O,Wt:T,Zt:D,Jt:{Kt:R,Qt:z,tn:_.bind(0,R)},nn:{Kt:A,Qt:W,tn:_.bind(0,A)}},Q,Wa.bind(0,M)]},vne=(e,t,n,r)=>{let o,s,i,c,d,p=0;const h=IO({}),[m]=h,[g,b]=Fc(),[y,x]=Fc(),[C,S]=Fc(100),[j,_]=Fc(100),[I,P]=Fc(()=>p),[M,R,A]=gne(e,n.qt,fne(t,n)),{Z:D,J:O,ot:T,st:Y,ut:z,it:W}=n.qt,{Jt:Q,nn:U,Zt:L,Ut:ee,Wt:K}=M,{tn:Z}=Q,{tn:se}=U,fe=X=>{const{Xt:ue}=X,q=z&&!W&&mi(ue)===O&&ue;return[q,{transform:q?`translate(${ea(T)}px, ${li(T)}px)`:""}]},G=(X,ue)=>{if(P(),X)L(Lj);else{const q=()=>L(Lj,!0);p>0&&!ue?I(q):q()}},te=()=>{c=s,c&&G(!0)},V=[S,P,_,x,b,A,Gr(D,"pointerover",te,{C:!0}),Gr(D,"pointerenter",te),Gr(D,"pointerleave",()=>{c=!1,s&&G(!1)}),Gr(D,"pointermove",()=>{o&&g(()=>{S(),G(!0),j(()=>{o&&G(!1)})})}),Gr(Y,"scroll",X=>{y(()=>{K(n()),i&&G(!0),C(()=>{i&&!c&&G(!1)})}),r(X),z&&Z(fe),z&&se(fe)})],F=m.bind(0);return F.qt=M,F.Nt=R,[(X,ue,q)=>{const{At:ne,Lt:pe,It:le,yt:we}=q,{A:ve}=Qo(),he=Gb(t,X,ue),Ne=n(),{Tt:De,Ct:qe,bt:Mt}=Ne,[ot,an]=he("showNativeOverlaidScrollbars"),[pt,vt]=he("scrollbars.theme"),[ke,Be]=he("scrollbars.visibility"),[Ot,Ht]=he("scrollbars.autoHide"),[je]=he("scrollbars.autoHideDelay"),[ht,At]=he("scrollbars.dragScroll"),[_t,Re]=he("scrollbars.clickScroll"),Xe=ne||pe||we,_n=le||Be,Me=ot&&ve.x&&ve.y,Ze=(Ye,ut)=>{const Ut=ke==="visible"||ke==="auto"&&Ye==="scroll";return L(Ote,Ut,ut),Ut};if(p=je,an&&L(Ite,Me),vt&&(L(d),L(pt,!0),d=pt),Ht&&(o=Ot==="move",s=Ot==="leave",i=Ot!=="never",G(!i,!0)),At&&L(Dte,ht),Re&&L(Ate,_t),_n){const Ye=Ze(qe.x,!0),ut=Ze(qe.y,!1);L(Rte,!(Ye&&ut))}Xe&&(ee(Ne),K(Ne),L($j,!De.x,!0),L($j,!De.y,!1),L(Pte,Mt&&!W))},F,Wa.bind(0,V)]},OO=(e,t,n)=>{oa(e)&&e(t||void 0,n||void 0)},qi=(e,t,n)=>{const{F:r,N:o,Y:s,j:i}=Qo(),c=Yl(),d=Wm(e),p=d?e:e.target,h=_O(p);if(t&&!h){let m=!1;const g=z=>{const W=Yl()[Nte],Q=W&&W.O;return Q?Q(z,!0):z},b=kr({},r(),g(t)),[y,x,C]=o2(n),[S,j,_]=ine(e,b),[I,P,M]=vne(e,b,j,z=>C("scroll",[Y,z])),R=(z,W)=>S(z,!!W),A=R.bind(0,{},!0),D=s(A),O=i(A),T=z=>{Gte(p),D(),O(),M(),_(),m=!0,C("destroyed",[Y,!!z]),x()},Y={options(z,W){if(z){const Q=W?r():{},U=gO(b,kr(Q,g(z)));Jy(U)||(kr(b,U),R(U))}return kr({},b)},on:y,off:(z,W)=>{z&&W&&x(z,W)},state(){const{zt:z,Tt:W,Ct:Q,Et:U,K:L,St:ee,bt:K}=j();return kr({},{overflowEdge:z,overflowAmount:W,overflowStyle:Q,hasOverflow:U,padding:L,paddingAbsolute:ee,directionRTL:K,destroyed:m})},elements(){const{W:z,Z:W,K:Q,J:U,tt:L,ot:ee,st:K}=j.qt,{Jt:Z,nn:se}=P.qt,fe=te=>{const{Ft:V,Gt:F,Xt:X}=te;return{scrollbar:X,track:F,handle:V}},G=te=>{const{Kt:V,Qt:F}=te,X=fe(V[0]);return kr({},X,{clone:()=>{const ue=fe(F());return I({},!0,{}),ue}})};return kr({},{target:z,host:W,padding:Q||U,viewport:U,content:L||U,scrollOffsetElement:ee,scrollEventElement:K,scrollbarHorizontal:G(Z),scrollbarVertical:G(se)})},update:z=>R({},z),destroy:T.bind(0)};return j.jt((z,W,Q)=>{I(W,Q,z)}),Ute(p,Y),Dn(us(c),z=>OO(c[z],0,Y)),Vte(j.qt.it,o().cancel,!d&&e.cancel)?(T(!0),Y):(j.Nt(),P.Nt(),C("initialized",[Y]),j.jt((z,W,Q)=>{const{gt:U,yt:L,vt:ee,At:K,Lt:Z,It:se,wt:fe,Ot:G}=z;C("updated",[Y,{updateHints:{sizeChanged:U,directionChanged:L,heightIntrinsicChanged:ee,overflowEdgeChanged:K,overflowAmountChanged:Z,overflowStyleChanged:se,contentMutation:fe,hostMutation:G},changedOptions:W,force:Q}])}),Y.update(!0),Y)}return h};qi.plugin=e=>{Dn(Tte(e),t=>OO(t,qi))};qi.valid=e=>{const t=e&&e.elements,n=oa(t)&&t();return Bb(n)&&!!_O(n.target)};qi.env=()=>{const{k:e,A:t,I:n,B:r,V:o,L:s,X:i,U:c,N:d,q:p,F:h,G:m}=Qo();return kr({},{scrollbarsSize:e,scrollbarsOverlaid:t,scrollbarsHiding:n,rtlScrollBehavior:r,flexboxGlue:o,cssCustomProperties:s,staticDefaultInitialization:i,staticDefaultOptions:c,getDefaultInitialization:d,setDefaultInitialization:p,getDefaultOptions:h,setDefaultOptions:m})};const bne=()=>{if(typeof window>"u"){const p=()=>{};return[p,p]}let e,t;const n=window,r=typeof n.requestIdleCallback=="function",o=n.requestAnimationFrame,s=n.cancelAnimationFrame,i=r?n.requestIdleCallback:o,c=r?n.cancelIdleCallback:s,d=()=>{c(e),s(t)};return[(p,h)=>{d(),e=i(r?()=>{d(),t=o(p)}:p,typeof h=="object"?h:{timeout:2233})},d]},u2=e=>{const{options:t,events:n,defer:r}=e||{},[o,s]=l.useMemo(bne,[]),i=l.useRef(null),c=l.useRef(r),d=l.useRef(t),p=l.useRef(n);return l.useEffect(()=>{c.current=r},[r]),l.useEffect(()=>{const{current:h}=i;d.current=t,qi.valid(h)&&h.options(t||{},!0)},[t]),l.useEffect(()=>{const{current:h}=i;p.current=n,qi.valid(h)&&h.on(n||{},!0)},[n]),l.useEffect(()=>()=>{var h;s(),(h=i.current)==null||h.destroy()},[]),l.useMemo(()=>[h=>{const m=i.current;if(qi.valid(m))return;const g=c.current,b=d.current||{},y=p.current||{},x=()=>i.current=qi(h,b,y);g?o(x,g):x()},()=>i.current],[])},xne=(e,t)=>{const{element:n="div",options:r,events:o,defer:s,children:i,...c}=e,d=n,p=l.useRef(null),h=l.useRef(null),[m,g]=u2({options:r,events:o,defer:s});return l.useEffect(()=>{const{current:b}=p,{current:y}=h;return b&&y&&m({target:b,elements:{viewport:y,content:y}}),()=>{var x;return(x=g())==null?void 0:x.destroy()}},[m,n]),l.useImperativeHandle(t,()=>({osInstance:g,getElement:()=>p.current}),[]),B.createElement(d,{"data-overlayscrollbars-initialize":"",ref:p,...c},B.createElement("div",{ref:h},i))},o0=l.forwardRef(xne);var RO={exports:{}},AO={};const ts=Sx(LD),Cd=Sx(zD),yne=Sx(FD);(function(e){var t,n,r=Cc&&Cc.__generator||function(re,ie){var be,Pe,xe,ft,it={label:0,sent:function(){if(1&xe[0])throw xe[1];return xe[1]},trys:[],ops:[]};return ft={next:Kt(0),throw:Kt(1),return:Kt(2)},typeof Symbol=="function"&&(ft[Symbol.iterator]=function(){return this}),ft;function Kt(mt){return function(wt){return function(We){if(be)throw new TypeError("Generator is already executing.");for(;it;)try{if(be=1,Pe&&(xe=2&We[0]?Pe.return:We[0]?Pe.throw||((xe=Pe.return)&&xe.call(Pe),0):Pe.next)&&!(xe=xe.call(Pe,We[1])).done)return xe;switch(Pe=0,xe&&(We=[2&We[0],xe.value]),We[0]){case 0:case 1:xe=We;break;case 4:return it.label++,{value:We[1],done:!1};case 5:it.label++,Pe=We[1],We=[0];continue;case 7:We=it.ops.pop(),it.trys.pop();continue;default:if(!((xe=(xe=it.trys).length>0&&xe[xe.length-1])||We[0]!==6&&We[0]!==2)){it=0;continue}if(We[0]===3&&(!xe||We[1]>xe[0]&&We[1]=200&&re.status<=299},Y=function(re){return/ion\/(vnd\.api\+)?json/.test(re.get("content-type")||"")};function z(re){if(!(0,D.isPlainObject)(re))return re;for(var ie=C({},re),be=0,Pe=Object.entries(ie);be"u"&&it===O&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(sn,Yt){return P(ie,null,function(){var He,Ct,zt,Qt,Nn,Jt,vn,fn,Br,cr,Dt,$n,Wn,ur,Ir,Kn,Qn,bn,On,Ln,In,Pn,Je,Nt,kt,lt,St,Gt,bt,st,Le,Ae,ze,Ve,nt,Ft;return r(this,function($t){switch($t.label){case 0:return He=Yt.signal,Ct=Yt.getState,zt=Yt.extra,Qt=Yt.endpoint,Nn=Yt.forced,Jt=Yt.type,Br=(fn=typeof sn=="string"?{url:sn}:sn).url,Dt=(cr=fn.headers)===void 0?new Headers(Zt.headers):cr,Wn=($n=fn.params)===void 0?void 0:$n,Ir=(ur=fn.responseHandler)===void 0?Tt??"json":ur,Qn=(Kn=fn.validateStatus)===void 0?Vt??T:Kn,On=(bn=fn.timeout)===void 0?Et:bn,Ln=_(fn,["url","headers","params","responseHandler","validateStatus","timeout"]),In=C(S(C({},Zt),{signal:He}),Ln),Dt=new Headers(z(Dt)),Pn=In,[4,xe(Dt,{getState:Ct,extra:zt,endpoint:Qt,forced:Nn,type:Jt})];case 1:Pn.headers=$t.sent()||Dt,Je=function(Ue){return typeof Ue=="object"&&((0,D.isPlainObject)(Ue)||Array.isArray(Ue)||typeof Ue.toJSON=="function")},!In.headers.has("content-type")&&Je(In.body)&&In.headers.set("content-type",Ie),Je(In.body)&&wt(In.headers)&&(In.body=JSON.stringify(In.body,et)),Wn&&(Nt=~Br.indexOf("?")?"&":"?",kt=Kt?Kt(Wn):new URLSearchParams(z(Wn)),Br+=Nt+kt),Br=function(Ue,cn){if(!Ue)return cn;if(!cn)return Ue;if(function(Cn){return new RegExp("(^|:)//").test(Cn)}(cn))return cn;var En=Ue.endsWith("/")||!cn.startsWith("?")?"/":"";return Ue=function(Cn){return Cn.replace(/\/$/,"")}(Ue),""+Ue+En+function(Cn){return Cn.replace(/^\//,"")}(cn)}(be,Br),lt=new Request(Br,In),St=lt.clone(),vn={request:St},bt=!1,st=On&&setTimeout(function(){bt=!0,Yt.abort()},On),$t.label=2;case 2:return $t.trys.push([2,4,5,6]),[4,it(lt)];case 3:return Gt=$t.sent(),[3,6];case 4:return Le=$t.sent(),[2,{error:{status:bt?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Le)},meta:vn}];case 5:return st&&clearTimeout(st),[7];case 6:Ae=Gt.clone(),vn.response=Ae,Ve="",$t.label=7;case 7:return $t.trys.push([7,9,,10]),[4,Promise.all([ln(Gt,Ir).then(function(Ue){return ze=Ue},function(Ue){return nt=Ue}),Ae.text().then(function(Ue){return Ve=Ue},function(){})])];case 8:if($t.sent(),nt)throw nt;return[3,10];case 9:return Ft=$t.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:Gt.status,data:Ve,error:String(Ft)},meta:vn}];case 10:return[2,Qn(Gt,ze)?{data:ze,meta:vn}:{error:{status:Gt.status,data:ze},meta:vn}]}})})};function ln(sn,Yt){return P(this,null,function(){var He;return r(this,function(Ct){switch(Ct.label){case 0:return typeof Yt=="function"?[2,Yt(sn)]:(Yt==="content-type"&&(Yt=wt(sn.headers)?"json":"text"),Yt!=="json"?[3,2]:[4,sn.text()]);case 1:return[2,(He=Ct.sent()).length?JSON.parse(He):null];case 2:return[2,sn.text()]}})})}}var Q=function(re,ie){ie===void 0&&(ie=void 0),this.value=re,this.meta=ie};function U(re,ie){return re===void 0&&(re=0),ie===void 0&&(ie=5),P(this,null,function(){var be,Pe;return r(this,function(xe){switch(xe.label){case 0:return be=Math.min(re,ie),Pe=~~((Math.random()+.4)*(300<=Ae)}var Ln=(0,qe.createAsyncThunk)(Wn+"/executeQuery",bn,{getPendingMeta:function(){var Je;return(Je={startedTimeStamp:Date.now()})[qe.SHOULD_AUTOBATCH]=!0,Je},condition:function(Je,Nt){var kt,lt,St,Gt=(0,Nt.getState)(),bt=(lt=(kt=Gt[Wn])==null?void 0:kt.queries)==null?void 0:lt[Je.queryCacheKey],st=bt==null?void 0:bt.fulfilledTimeStamp,Le=Je.originalArgs,Ae=bt==null?void 0:bt.originalArgs,ze=Ir[Je.endpointName];return!(!he(Je)&&((bt==null?void 0:bt.status)==="pending"||!On(Je,Gt)&&(!q(ze)||!((St=ze==null?void 0:ze.forceRefetch)!=null&&St.call(ze,{currentArg:Le,previousArg:Ae,endpointState:bt,state:Gt})))&&st))},dispatchConditionRejection:!0}),In=(0,qe.createAsyncThunk)(Wn+"/executeMutation",bn,{getPendingMeta:function(){var Je;return(Je={startedTimeStamp:Date.now()})[qe.SHOULD_AUTOBATCH]=!0,Je}});function Pn(Je){return function(Nt){var kt,lt;return((lt=(kt=Nt==null?void 0:Nt.meta)==null?void 0:kt.arg)==null?void 0:lt.endpointName)===Je}}return{queryThunk:Ln,mutationThunk:In,prefetch:function(Je,Nt,kt){return function(lt,St){var Gt=function(ze){return"force"in ze}(kt)&&kt.force,bt=function(ze){return"ifOlderThan"in ze}(kt)&&kt.ifOlderThan,st=function(ze){return ze===void 0&&(ze=!0),Qn.endpoints[Je].initiate(Nt,{forceRefetch:ze})},Le=Qn.endpoints[Je].select(Nt)(St());if(Gt)lt(st());else if(bt){var Ae=Le==null?void 0:Le.fulfilledTimeStamp;if(!Ae)return void lt(st());(Number(new Date)-Number(new Date(Ae)))/1e3>=bt&<(st())}else lt(st(!1))}},updateQueryData:function(Je,Nt,kt){return function(lt,St){var Gt,bt,st=Qn.endpoints[Je].select(Nt)(St()),Le={patches:[],inversePatches:[],undo:function(){return lt(Qn.util.patchQueryData(Je,Nt,Le.inversePatches))}};if(st.status===t.uninitialized)return Le;if("data"in st)if((0,De.isDraftable)(st.data)){var Ae=(0,De.produceWithPatches)(st.data,kt),ze=Ae[2];(Gt=Le.patches).push.apply(Gt,Ae[1]),(bt=Le.inversePatches).push.apply(bt,ze)}else{var Ve=kt(st.data);Le.patches.push({op:"replace",path:[],value:Ve}),Le.inversePatches.push({op:"replace",path:[],value:st.data})}return lt(Qn.util.patchQueryData(Je,Nt,Le.patches)),Le}},upsertQueryData:function(Je,Nt,kt){return function(lt){var St;return lt(Qn.endpoints[Je].initiate(Nt,((St={subscribe:!1,forceRefetch:!0})[ve]=function(){return{data:kt}},St)))}},patchQueryData:function(Je,Nt,kt){return function(lt){lt(Qn.internalActions.queryResultPatched({queryCacheKey:Kn({queryArgs:Nt,endpointDefinition:Ir[Je],endpointName:Je}),patches:kt}))}},buildMatchThunkActions:function(Je,Nt){return{matchPending:(0,Ne.isAllOf)((0,Ne.isPending)(Je),Pn(Nt)),matchFulfilled:(0,Ne.isAllOf)((0,Ne.isFulfilled)(Je),Pn(Nt)),matchRejected:(0,Ne.isAllOf)((0,Ne.isRejected)(Je),Pn(Nt))}}}}({baseQuery:Pe,reducerPath:xe,context:be,api:re,serializeQueryArgs:ft}),et=Ie.queryThunk,Et=Ie.mutationThunk,Tt=Ie.patchQueryData,Vt=Ie.updateQueryData,Zt=Ie.upsertQueryData,ln=Ie.prefetch,sn=Ie.buildMatchThunkActions,Yt=function(Dt){var $n=Dt.reducerPath,Wn=Dt.queryThunk,ur=Dt.mutationThunk,Ir=Dt.context,Kn=Ir.endpointDefinitions,Qn=Ir.apiUid,bn=Ir.extractRehydrationInfo,On=Ir.hasRehydrationInfo,Ln=Dt.assertTagType,In=Dt.config,Pn=(0,le.createAction)($n+"/resetApiState"),Je=(0,le.createSlice)({name:$n+"/queries",initialState:Ot,reducers:{removeQueryResult:{reducer:function(st,Le){delete st[Le.payload.queryCacheKey]},prepare:(0,le.prepareAutoBatched)()},queryResultPatched:function(st,Le){var Ae=Le.payload,ze=Ae.patches;vt(st,Ae.queryCacheKey,function(Ve){Ve.data=(0,pt.applyPatches)(Ve.data,ze.concat())})}},extraReducers:function(st){st.addCase(Wn.pending,function(Le,Ae){var ze,Ve=Ae.meta,nt=Ae.meta.arg,Ft=he(nt);(nt.subscribe||Ft)&&(Le[ze=nt.queryCacheKey]!=null||(Le[ze]={status:t.uninitialized,endpointName:nt.endpointName})),vt(Le,nt.queryCacheKey,function($t){$t.status=t.pending,$t.requestId=Ft&&$t.requestId?$t.requestId:Ve.requestId,nt.originalArgs!==void 0&&($t.originalArgs=nt.originalArgs),$t.startedTimeStamp=Ve.startedTimeStamp})}).addCase(Wn.fulfilled,function(Le,Ae){var ze=Ae.meta,Ve=Ae.payload;vt(Le,ze.arg.queryCacheKey,function(nt){var Ft;if(nt.requestId===ze.requestId||he(ze.arg)){var $t=Kn[ze.arg.endpointName].merge;if(nt.status=t.fulfilled,$t)if(nt.data!==void 0){var Ue=ze.fulfilledTimeStamp,cn=ze.arg,En=ze.baseQueryMeta,Cn=ze.requestId,Pr=(0,le.createNextState)(nt.data,function(ir){return $t(ir,Ve,{arg:cn.originalArgs,baseQueryMeta:En,fulfilledTimeStamp:Ue,requestId:Cn})});nt.data=Pr}else nt.data=Ve;else nt.data=(Ft=Kn[ze.arg.endpointName].structuralSharing)==null||Ft?A((0,an.isDraft)(nt.data)?(0,pt.original)(nt.data):nt.data,Ve):Ve;delete nt.error,nt.fulfilledTimeStamp=ze.fulfilledTimeStamp}})}).addCase(Wn.rejected,function(Le,Ae){var ze=Ae.meta,Ve=ze.condition,nt=ze.requestId,Ft=Ae.error,$t=Ae.payload;vt(Le,ze.arg.queryCacheKey,function(Ue){if(!Ve){if(Ue.requestId!==nt)return;Ue.status=t.rejected,Ue.error=$t??Ft}})}).addMatcher(On,function(Le,Ae){for(var ze=bn(Ae).queries,Ve=0,nt=Object.entries(ze);Ve"u"||navigator.onLine===void 0||navigator.onLine,focused:typeof document>"u"||document.visibilityState!=="hidden",middlewareRegistered:!1},In),reducers:{middlewareRegistered:function(st,Le){st.middlewareRegistered=st.middlewareRegistered!=="conflict"&&Qn===Le.payload||"conflict"}},extraReducers:function(st){st.addCase(fe,function(Le){Le.online=!0}).addCase(G,function(Le){Le.online=!1}).addCase(Z,function(Le){Le.focused=!0}).addCase(se,function(Le){Le.focused=!1}).addMatcher(On,function(Le){return C({},Le)})}}),bt=(0,le.combineReducers)({queries:Je.reducer,mutations:Nt.reducer,provided:kt.reducer,subscriptions:St.reducer,config:Gt.reducer});return{reducer:function(st,Le){return bt(Pn.match(Le)?void 0:st,Le)},actions:S(C(C(C(C(C({},Gt.actions),Je.actions),lt.actions),St.actions),Nt.actions),{unsubscribeMutationResult:Nt.actions.removeMutationResult,resetApiState:Pn})}}({context:be,queryThunk:et,mutationThunk:Et,reducerPath:xe,assertTagType:We,config:{refetchOnFocus:mt,refetchOnReconnect:wt,refetchOnMountOrArgChange:Kt,keepUnusedDataFor:it,reducerPath:xe}}),He=Yt.reducer,Ct=Yt.actions;Yr(re.util,{patchQueryData:Tt,updateQueryData:Vt,upsertQueryData:Zt,prefetch:ln,resetApiState:Ct.resetApiState}),Yr(re.internalActions,Ct);var zt=function(Dt){var $n=Dt.reducerPath,Wn=Dt.queryThunk,ur=Dt.api,Ir=Dt.context,Kn=Ir.apiUid,Qn={invalidateTags:(0,xr.createAction)($n+"/invalidateTags")},bn=[so,yn,oo,Dr,or,Xo];return{middleware:function(Ln){var In=!1,Pn=S(C({},Dt),{internalState:{currentSubscriptions:{}},refetchQuery:On}),Je=bn.map(function(lt){return lt(Pn)}),Nt=function(lt){var St=lt.api,Gt=lt.queryThunk,bt=lt.internalState,st=St.reducerPath+"/subscriptions",Le=null,Ae=!1,ze=St.internalActions,Ve=ze.updateSubscriptionOptions,nt=ze.unsubscribeQueryResult;return function(Ft,$t){var Ue,cn;if(Le||(Le=JSON.parse(JSON.stringify(bt.currentSubscriptions))),St.util.resetApiState.match(Ft))return Le=bt.currentSubscriptions={},[!0,!1];if(St.internalActions.internal_probeSubscription.match(Ft)){var En=Ft.payload;return[!1,!!((Ue=bt.currentSubscriptions[En.queryCacheKey])!=null&&Ue[En.requestId])]}var Cn=function(Sn,sr){var wo,xn,Xn,io,Hr,Ei,Xf,Yo,Ga;if(Ve.match(sr)){var da=sr.payload,qa=da.queryCacheKey,So=da.requestId;return(wo=Sn==null?void 0:Sn[qa])!=null&&wo[So]&&(Sn[qa][So]=da.options),!0}if(nt.match(sr)){var ko=sr.payload;return So=ko.requestId,Sn[qa=ko.queryCacheKey]&&delete Sn[qa][So],!0}if(St.internalActions.removeQueryResult.match(sr))return delete Sn[sr.payload.queryCacheKey],!0;if(Gt.pending.match(sr)){var jo=sr.meta;if(So=jo.requestId,(uo=jo.arg).subscribe)return(ds=(Xn=Sn[xn=uo.queryCacheKey])!=null?Xn:Sn[xn]={})[So]=(Hr=(io=uo.subscriptionOptions)!=null?io:ds[So])!=null?Hr:{},!0}if(Gt.rejected.match(sr)){var ds,Jo=sr.meta,uo=Jo.arg;if(So=Jo.requestId,Jo.condition&&uo.subscribe)return(ds=(Xf=Sn[Ei=uo.queryCacheKey])!=null?Xf:Sn[Ei]={})[So]=(Ga=(Yo=uo.subscriptionOptions)!=null?Yo:ds[So])!=null?Ga:{},!0}return!1}(bt.currentSubscriptions,Ft);if(Cn){Ae||($s(function(){var Sn=JSON.parse(JSON.stringify(bt.currentSubscriptions)),sr=(0,ao.produceWithPatches)(Le,function(){return Sn});$t.next(St.internalActions.subscriptionsUpdated(sr[1])),Le=Sn,Ae=!1}),Ae=!0);var Pr=!!((cn=Ft.type)!=null&&cn.startsWith(st)),ir=Gt.rejected.match(Ft)&&Ft.meta.condition&&!!Ft.meta.arg.subscribe;return[!Pr&&!ir,!1]}return[!0,!1]}}(Pn),kt=function(lt){var St=lt.reducerPath,Gt=lt.context,bt=lt.refetchQuery,st=lt.internalState,Le=lt.api.internalActions.removeQueryResult;function Ae(ze,Ve){var nt=ze.getState()[St],Ft=nt.queries,$t=st.currentSubscriptions;Gt.batch(function(){for(var Ue=0,cn=Object.keys($t);Ue{const{boardToDelete:t,setBoardToDelete:n}=e,{t:r}=J(),o=H(j=>j.config.canRestoreDeletedImagesFromBin),{currentData:s,isFetching:i}=BD((t==null?void 0:t.board_id)??Os.skipToken),c=l.useMemo(()=>de([Ce],j=>{const _=(s??[]).map(P=>PI(j,P));return{imageUsageSummary:{isInitialImage:Qs(_,P=>P.isInitialImage),isCanvasImage:Qs(_,P=>P.isCanvasImage),isNodesImage:Qs(_,P=>P.isNodesImage),isControlImage:Qs(_,P=>P.isControlImage)}}}),[s]),[d,{isLoading:p}]=HD(),[h,{isLoading:m}]=WD(),{imageUsageSummary:g}=H(c),b=l.useCallback(()=>{t&&(d(t.board_id),n(void 0))},[t,d,n]),y=l.useCallback(()=>{t&&(h(t.board_id),n(void 0))},[t,h,n]),x=l.useCallback(()=>{n(void 0)},[n]),C=l.useRef(null),S=l.useMemo(()=>m||p||i,[m,p,i]);return t?a.jsx(Df,{isOpen:!!t,onClose:x,leastDestructiveRef:C,isCentered:!0,children:a.jsx(Ma,{children:a.jsxs(Tf,{children:[a.jsxs(Ea,{fontSize:"lg",fontWeight:"bold",children:["Delete ",t.board_name]}),a.jsx(Oa,{children:a.jsxs(N,{direction:"column",gap:3,children:[i?a.jsx(Dg,{children:a.jsx(N,{sx:{w:"full",h:32}})}):a.jsx(NM,{imageUsage:g,topMessage:r("boards.topMessage"),bottomMessage:r("boards.bottomMessage")}),a.jsx(Se,{children:"Deleted boards cannot be restored."}),a.jsx(Se,{children:r(o?"gallery.deleteImageBin":"gallery.deleteImagePermanent")})]})}),a.jsx(pi,{children:a.jsxs(N,{sx:{justifyContent:"space-between",width:"full",gap:2},children:[a.jsx(Rt,{ref:C,onClick:x,children:"Cancel"}),a.jsx(Rt,{colorScheme:"warning",isLoading:S,onClick:b,children:"Delete Board Only"}),a.jsx(Rt,{colorScheme:"error",isLoading:S,onClick:y,children:"Delete Board and Images"})]})})]})})}):null},wne=l.memo(Cne),Sne=()=>{const{t:e}=J(),[t,{isLoading:n}]=VD(),r=e("boards.myBoard"),o=l.useCallback(()=>{t(r)},[t,r]);return a.jsx(tt,{icon:a.jsx(Yi,{}),isLoading:n,tooltip:e("boards.addBoard"),"aria-label":e("boards.addBoard"),onClick:o,size:"sm","data-testid":"add-board-button"})},kne=l.memo(Sne);var DO=fg({displayName:"ExternalLinkIcon",path:a.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[a.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),a.jsx("path",{d:"M15 3h6v6"}),a.jsx("path",{d:"M10 14L21 3"})]})}),s0=fg({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),jne=fg({displayName:"CloseIcon",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"}),_ne=fg({displayName:"DeleteIcon",path:a.jsx("g",{fill:"currentColor",children:a.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"})})});const Ine=de([Ce],({gallery:e})=>{const{boardSearchText:t}=e;return{boardSearchText:t}},_e),Pne=()=>{const e=oe(),{boardSearchText:t}=H(Ine),n=l.useRef(null),{t:r}=J(),o=l.useCallback(d=>{e(Tw(d))},[e]),s=l.useCallback(()=>{e(Tw(""))},[e]),i=l.useCallback(d=>{d.key==="Escape"&&s()},[s]),c=l.useCallback(d=>{o(d.target.value)},[o]);return l.useEffect(()=>{n.current&&n.current.focus()},[]),a.jsxs(z5,{children:[a.jsx(vg,{ref:n,placeholder:r("boards.searchBoard"),value:t,onKeyDown:i,onChange:c,"data-testid":"board-search-input"}),t&&t.length&&a.jsx(dy,{children:a.jsx(_a,{onClick:s,size:"xs",variant:"ghost","aria-label":r("boards.clearSearch"),opacity:.5,icon:a.jsx(jne,{boxSize:2})})})]})},Ene=l.memo(Pne);function TO(e){return UD(e)}function Mne(e){return GD(e)}const NO=(e,t)=>{var o,s;if(!e||!(t!=null&&t.data.current))return!1;const{actionType:n}=e,{payloadType:r}=t.data.current;if(e.id===t.data.current.id)return!1;switch(n){case"ADD_FIELD_TO_LINEAR":return r==="NODE_FIELD";case"SET_CURRENT_IMAGE":return r==="IMAGE_DTO";case"SET_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_CONTROL_ADAPTER_IMAGE":return r==="IMAGE_DTO";case"SET_CANVAS_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_NODES_IMAGE":return r==="IMAGE_DTO";case"SET_MULTI_NODES_IMAGE":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BATCH":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:c}=t.data.current.payload,d=c.board_id??"none",p=e.context.boardId;return d!==p}if(r==="IMAGE_DTOS"){const{imageDTOs:c}=t.data.current.payload,d=((o=c[0])==null?void 0:o.board_id)??"none",p=e.context.boardId;return d!==p}return!1}case"REMOVE_FROM_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:c}=t.data.current.payload;return(c.board_id??"none")!=="none"}if(r==="IMAGE_DTOS"){const{imageDTOs:c}=t.data.current.payload;return(((s=c[0])==null?void 0:s.board_id)??"none")!=="none"}return!1}default:return!1}},One=e=>{const{isOver:t,label:n="Drop"}=e,r=l.useRef(Jc()),{colorMode:o}=wi();return a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsxs(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full"},children:[a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:Ke("base.700","base.900")(o),opacity:.7,borderRadius:"base",alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(N,{sx:{position:"absolute",top:.5,insetInlineStart:.5,insetInlineEnd:.5,bottom:.5,opacity:1,borderWidth:2,borderColor:t?Ke("base.50","base.50")(o):Ke("base.200","base.300")(o),borderRadius:"lg",borderStyle:"dashed",transitionProperty:"common",transitionDuration:"0.1s",alignItems:"center",justifyContent:"center"},children:a.jsx(Te,{sx:{fontSize:"2xl",fontWeight:600,transform:t?"scale(1.1)":"scale(1)",color:t?Ke("base.50","base.50")(o):Ke("base.200","base.300")(o),transitionProperty:"common",transitionDuration:"0.1s"},children:n})})]})},r.current)},$O=l.memo(One),Rne=e=>{const{dropLabel:t,data:n,disabled:r}=e,o=l.useRef(Jc()),{isOver:s,setNodeRef:i,active:c}=TO({id:o.current,disabled:r,data:n});return a.jsx(Te,{ref:i,position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",pointerEvents:c?"auto":"none",children:a.jsx(yo,{children:NO(n,c)&&a.jsx($O,{isOver:s,label:t})})})},d2=l.memo(Rne),Ane=({isSelected:e,isHovered:t})=>a.jsx(Te,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e?1:.7,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:e?t?"hoverSelected.light":"selected.light":t?"hoverUnselected.light":void 0,_dark:{shadow:e?t?"hoverSelected.dark":"selected.dark":t?"hoverUnselected.dark":void 0}}}),f2=l.memo(Ane),Dne=()=>{const{t:e}=J();return a.jsx(N,{sx:{position:"absolute",insetInlineEnd:0,top:0,p:1},children:a.jsx(Ha,{variant:"solid",sx:{bg:"accent.400",_dark:{bg:"accent.500"}},children:e("common.auto")})})},LO=l.memo(Dne);function p2(e){const[t,n]=l.useState(!1),[r,o]=l.useState(!1),[s,i]=l.useState(!1),[c,d]=l.useState([0,0]),p=l.useRef(null),h=H(g=>g.ui.globalContextMenuCloseTrigger);l.useEffect(()=>{if(t)setTimeout(()=>{o(!0),setTimeout(()=>{i(!0)})});else{i(!1);const g=setTimeout(()=>{o(t)},1e3);return()=>clearTimeout(g)}},[t]),l.useEffect(()=>{n(!1),i(!1),o(!1)},[h]),TF("contextmenu",g=>{var b;(b=p.current)!=null&&b.contains(g.target)||g.target===p.current?(g.preventDefault(),n(!0),d([g.pageX,g.pageY])):n(!1)});const m=l.useCallback(()=>{var g,b;(b=(g=e.menuProps)==null?void 0:g.onClose)==null||b.call(g),n(!1)},[e.menuProps]);return a.jsxs(a.Fragment,{children:[e.children(p),r&&a.jsx(Ru,{...e.portalProps,children:a.jsxs(Cg,{isOpen:s,gutter:0,...e.menuProps,onClose:m,children:[a.jsx(wg,{"aria-hidden":!0,w:1,h:1,style:{position:"absolute",left:c[0],top:c[1],cursor:"default"},...e.menuButtonProps}),e.renderMenu()]})})]})}const a0=e=>{const{boardName:t}=gf(void 0,{selectFromResult:({data:n})=>{const r=n==null?void 0:n.find(s=>s.board_id===e);return{boardName:(r==null?void 0:r.board_name)||DI("boards.uncategorized")}}});return t},Tne=({board:e,setBoardToDelete:t})=>{const n=l.useCallback(()=>{t&&t(e)},[e,t]);return a.jsxs(a.Fragment,{children:[e.image_count>0&&a.jsx(a.Fragment,{}),a.jsx(Vn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(qo,{}),onClick:n,children:"Delete Board"})]})},Nne=l.memo(Tne),$ne=()=>a.jsx(a.Fragment,{}),Lne=l.memo($ne),zne=({board:e,board_id:t,setBoardToDelete:n,children:r})=>{const{t:o}=J(),s=oe(),i=l.useMemo(()=>de(Ce,({gallery:C})=>{const S=C.autoAddBoardId===t,j=C.autoAssignBoardOnClick;return{isAutoAdd:S,autoAssignBoardOnClick:j}},_e),[t]),{isAutoAdd:c,autoAssignBoardOnClick:d}=H(i),p=a0(t),h=jn("bulkDownload").isFeatureEnabled,[m]=TI(),g=l.useCallback(()=>{s(ag(t))},[t,s]),b=l.useCallback(async()=>{try{const C=await m({image_names:[],board_id:t}).unwrap();s(Bt({title:o("gallery.preparingDownload"),status:"success",...C.response?{description:C.response}:{}}))}catch{s(Bt({title:o("gallery.preparingDownloadFailed"),status:"error"}))}},[o,t,m,s]),y=l.useCallback(C=>{C.preventDefault()},[]),x=l.useCallback(()=>a.jsx(Gl,{sx:{visibility:"visible !important"},motionProps:pu,onContextMenu:y,children:a.jsxs(Yd,{title:p,children:[a.jsx(Vn,{icon:a.jsx(Yi,{}),isDisabled:c||d,onClick:g,children:o("boards.menuItemAutoAdd")}),h&&a.jsx(Vn,{icon:a.jsx(Wu,{}),onClickCapture:b,children:o("boards.downloadBoard")}),!e&&a.jsx(Lne,{}),e&&a.jsx(Nne,{board:e,setBoardToDelete:n})]})}),[d,e,p,b,g,c,h,n,y,o]);return a.jsx(p2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:x,children:r})},zO=l.memo(zne),Fne=({board:e,isSelected:t,setBoardToDelete:n})=>{const r=oe(),o=l.useMemo(()=>de(Ce,({gallery:D})=>{const O=e.board_id===D.autoAddBoardId,T=D.autoAssignBoardOnClick;return{isSelectedForAutoAdd:O,autoAssignBoardOnClick:T}},_e),[e.board_id]),{isSelectedForAutoAdd:s,autoAssignBoardOnClick:i}=H(o),[c,d]=l.useState(!1),p=l.useCallback(()=>{d(!0)},[]),h=l.useCallback(()=>{d(!1)},[]),{data:m}=kx(e.board_id),{data:g}=jx(e.board_id),b=l.useMemo(()=>{if(!((m==null?void 0:m.total)===void 0||(g==null?void 0:g.total)===void 0))return`${m.total} image${m.total===1?"":"s"}, ${g.total} asset${g.total===1?"":"s"}`},[g,m]),{currentData:y}=Ps(e.cover_image_name??Os.skipToken),{board_name:x,board_id:C}=e,[S,j]=l.useState(x),_=l.useCallback(()=>{r(NI({boardId:C})),i&&r(ag(C))},[C,i,r]),[I,{isLoading:P}]=qD(),M=l.useMemo(()=>({id:C,actionType:"ADD_TO_BOARD",context:{boardId:C}}),[C]),R=l.useCallback(async D=>{if(!D.trim()){j(x);return}if(D!==x)try{const{board_name:O}=await I({board_id:C,changes:{board_name:D}}).unwrap();j(O)}catch{j(x)}},[C,x,I]),A=l.useCallback(D=>{j(D)},[]);return a.jsx(Te,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(N,{onMouseOver:p,onMouseOut:h,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",w:"full",h:"full"},children:a.jsx(zO,{board:e,board_id:C,setBoardToDelete:n,children:D=>a.jsx(Fn,{label:b,openDelay:1e3,hasArrow:!0,children:a.jsxs(N,{ref:D,onClick:_,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[y!=null&&y.thumbnail_url?a.jsx(Si,{src:y==null?void 0:y.thumbnail_url,draggable:!1,sx:{objectFit:"cover",w:"full",h:"full",maxH:"full",borderRadius:"base",borderBottomRadius:"lg"}}):a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(zr,{boxSize:12,as:Iee,sx:{mt:-6,opacity:.7,color:"base.500",_dark:{color:"base.500"}}})}),s&&a.jsx(LO,{}),a.jsx(f2,{isSelected:t,isHovered:c}),a.jsx(N,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:t?"accent.400":"base.500",color:t?"base.50":"base.100",_dark:{bg:t?"accent.500":"base.600",color:t?"base.50":"base.100"},lineHeight:"short",fontSize:"xs"},children:a.jsxs(Ef,{value:S,isDisabled:P,submitOnBlur:!0,onChange:A,onSubmit:R,sx:{w:"full"},children:[a.jsx(Pf,{sx:{p:0,fontWeight:t?700:500,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},noOfLines:1}),a.jsx(If,{sx:{p:0,_focusVisible:{p:0,textAlign:"center",boxShadow:"none"}}})]})}),a.jsx(d2,{data:M,dropLabel:a.jsx(Se,{fontSize:"md",children:"Move"})})]})})})})})},Bne=l.memo(Fne),Hne=de(Ce,({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},_e),FO=l.memo(({isSelected:e})=>{const t=oe(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=H(Hne),o=a0("none"),s=l.useCallback(()=>{t(NI({boardId:"none"})),r&&t(ag("none"))},[t,r]),[i,c]=l.useState(!1),{data:d}=kx("none"),{data:p}=jx("none"),h=l.useMemo(()=>{if(!((d==null?void 0:d.total)===void 0||(p==null?void 0:p.total)===void 0))return`${d.total} image${d.total===1?"":"s"}, ${p.total} asset${p.total===1?"":"s"}`},[p,d]),m=l.useCallback(()=>{c(!0)},[]),g=l.useCallback(()=>{c(!1)},[]),b=l.useMemo(()=>({id:"no_board",actionType:"REMOVE_FROM_BOARD"}),[]);return a.jsx(Te,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(N,{onMouseOver:m,onMouseOut:g,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",borderRadius:"base",w:"full",h:"full"},children:a.jsx(zO,{board_id:"none",children:y=>a.jsx(Fn,{label:h,openDelay:1e3,hasArrow:!0,children:a.jsxs(N,{ref:y,onClick:s,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(Si,{src:wx,alt:"invoke-ai-logo",sx:{opacity:.4,filter:"grayscale(1)",mt:-6,w:16,h:16,minW:16,minH:16,userSelect:"none"}})}),n==="none"&&a.jsx(LO,{}),a.jsx(N,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:e?"accent.400":"base.500",color:e?"base.50":"base.100",_dark:{bg:e?"accent.500":"base.600",color:e?"base.50":"base.100"},lineHeight:"short",fontSize:"xs",fontWeight:e?700:500},children:o}),a.jsx(f2,{isSelected:e,isHovered:i}),a.jsx(d2,{data:b,dropLabel:a.jsx(Se,{fontSize:"md",children:"Move"})})]})})})})})});FO.displayName="HoverableBoard";const Wne=l.memo(FO),Vne=de([Ce],({gallery:e})=>{const{selectedBoardId:t,boardSearchText:n}=e;return{selectedBoardId:t,boardSearchText:n}},_e),Une=e=>{const{isOpen:t}=e,{selectedBoardId:n,boardSearchText:r}=H(Vne),{data:o}=gf(),s=r?o==null?void 0:o.filter(d=>d.board_name.toLowerCase().includes(r.toLowerCase())):o,[i,c]=l.useState();return a.jsxs(a.Fragment,{children:[a.jsx(Sf,{in:t,animateOpacity:!0,children:a.jsxs(N,{layerStyle:"first",sx:{flexDir:"column",gap:2,p:2,mt:2,borderRadius:"base"},children:[a.jsxs(N,{sx:{gap:2,alignItems:"center"},children:[a.jsx(Ene,{}),a.jsx(kne,{})]}),a.jsx(o0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsxs(nl,{className:"list-container","data-testid":"boards-list",sx:{gridTemplateColumns:"repeat(auto-fill, minmax(108px, 1fr));",maxH:346},children:[a.jsx(Kd,{sx:{p:1.5},"data-testid":"no-board",children:a.jsx(Wne,{isSelected:n==="none"})}),s&&s.map((d,p)=>a.jsx(Kd,{sx:{p:1.5},"data-testid":`board-${p}`,children:a.jsx(Bne,{board:d,isSelected:n===d.board_id,setBoardToDelete:c})},d.board_id))]})})]})}),a.jsx(wne,{boardToDelete:i,setBoardToDelete:c})]})},Gne=l.memo(Une),qne=de([Ce],e=>{const{selectedBoardId:t}=e.gallery;return{selectedBoardId:t}},_e),Kne=e=>{const{isOpen:t,onToggle:n}=e,{selectedBoardId:r}=H(qne),o=a0(r),s=l.useMemo(()=>o.length>20?`${o.substring(0,20)}...`:o,[o]);return a.jsxs(N,{as:tl,onClick:n,size:"sm",sx:{position:"relative",gap:2,w:"full",justifyContent:"space-between",alignItems:"center",px:2},children:[a.jsx(Se,{noOfLines:1,sx:{fontWeight:600,w:"100%",textAlign:"center",color:"base.800",_dark:{color:"base.200"}},children:s}),a.jsx(s0,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]})},Qne=l.memo(Kne),Xne=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return a.jsxs(Nf,{isLazy:o,...s,children:[a.jsx(Rg,{children:t}),a.jsxs($f,{shadow:"dark-lg",children:[r&&a.jsx(x3,{}),n]})]})},Uf=l.memo(Xne);function Yne(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 16c1.671 0 3-1.331 3-3s-1.329-3-3-3-3 1.331-3 3 1.329 3 3 3z"}},{tag:"path",attr:{d:"M20.817 11.186a8.94 8.94 0 0 0-1.355-3.219 9.053 9.053 0 0 0-2.43-2.43 8.95 8.95 0 0 0-3.219-1.355 9.028 9.028 0 0 0-1.838-.18V2L8 5l3.975 3V6.002c.484-.002.968.044 1.435.14a6.961 6.961 0 0 1 2.502 1.053 7.005 7.005 0 0 1 1.892 1.892A6.967 6.967 0 0 1 19 13a7.032 7.032 0 0 1-.55 2.725 7.11 7.11 0 0 1-.644 1.188 7.2 7.2 0 0 1-.858 1.039 7.028 7.028 0 0 1-3.536 1.907 7.13 7.13 0 0 1-2.822 0 6.961 6.961 0 0 1-2.503-1.054 7.002 7.002 0 0 1-1.89-1.89A6.996 6.996 0 0 1 5 13H3a9.02 9.02 0 0 0 1.539 5.034 9.096 9.096 0 0 0 2.428 2.428A8.95 8.95 0 0 0 12 22a9.09 9.09 0 0 0 1.814-.183 9.014 9.014 0 0 0 3.218-1.355 8.886 8.886 0 0 0 1.331-1.099 9.228 9.228 0 0 0 1.1-1.332A8.952 8.952 0 0 0 21 13a9.09 9.09 0 0 0-.183-1.814z"}}]})(e)}const BO=Oe((e,t)=>{const[n,r]=l.useState(!1),{label:o,value:s,min:i=1,max:c=100,step:d=1,onChange:p,tooltipSuffix:h="",withSliderMarks:m=!1,withInput:g=!1,isInteger:b=!1,inputWidth:y=16,withReset:x=!1,hideTooltip:C=!1,isCompact:S=!1,isDisabled:j=!1,sliderMarks:_,handleReset:I,sliderFormControlProps:P,sliderFormLabelProps:M,sliderMarkProps:R,sliderTrackProps:A,sliderThumbProps:D,sliderNumberInputProps:O,sliderNumberInputFieldProps:T,sliderNumberInputStepperProps:Y,sliderTooltipProps:z,sliderIAIIconButtonProps:W,...Q}=e,U=oe(),{t:L}=J(),[ee,K]=l.useState(String(s));l.useEffect(()=>{K(s)},[s]);const Z=l.useMemo(()=>O!=null&&O.min?O.min:i,[i,O==null?void 0:O.min]),se=l.useMemo(()=>O!=null&&O.max?O.max:c,[c,O==null?void 0:O.max]),fe=l.useCallback(le=>{p(le)},[p]),G=l.useCallback(le=>{le.target.value===""&&(le.target.value=String(Z));const we=Bl(b?Math.floor(Number(le.target.value)):Number(ee),Z,se),ve=_d(we,d);p(ve),K(ve)},[b,ee,Z,se,p,d]),te=l.useCallback(le=>{K(le)},[]),V=l.useCallback(()=>{I&&I()},[I]),F=l.useCallback(le=>{le.target instanceof HTMLDivElement&&le.target.focus()},[]),X=l.useCallback(le=>{le.shiftKey&&U(Uo(!0))},[U]),ue=l.useCallback(le=>{le.shiftKey||U(Uo(!1))},[U]),q=l.useCallback(()=>r(!0),[]),ne=l.useCallback(()=>r(!1),[]),pe=l.useCallback(()=>p(Number(ee)),[ee,p]);return a.jsxs(Bn,{ref:t,onClick:F,sx:S?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},isDisabled:j,...P,children:[o&&a.jsx(vr,{sx:g?{mb:-1.5}:{},...M,children:o}),a.jsxs(xg,{w:"100%",gap:2,alignItems:"center",children:[a.jsxs(jy,{"aria-label":o,value:s,min:i,max:c,step:d,onChange:fe,onMouseEnter:q,onMouseLeave:ne,focusThumbOnChange:!1,isDisabled:j,...Q,children:[m&&!_&&a.jsxs(a.Fragment,{children:[a.jsx(Lc,{value:i,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...R,children:i}),a.jsx(Lc,{value:c,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...R,children:c})]}),m&&_&&a.jsx(a.Fragment,{children:_.map((le,we)=>we===0?a.jsx(Lc,{value:le,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...R,children:le},le):we===_.length-1?a.jsx(Lc,{value:le,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...R,children:le},le):a.jsx(Lc,{value:le,sx:{transform:"translateX(-50%)"},...R,children:le},le))}),a.jsx(Iy,{...A,children:a.jsx(Py,{})}),a.jsx(Fn,{hasArrow:!0,placement:"top",isOpen:n,label:`${s}${h}`,hidden:C,...z,children:a.jsx(_y,{...D,zIndex:0})})]}),g&&a.jsxs(_g,{min:Z,max:se,step:d,value:ee,onChange:te,onBlur:G,focusInputOnChange:!1,...O,children:[a.jsx(Pg,{onKeyDown:X,onKeyUp:ue,minWidth:y,...T}),a.jsxs(Ig,{...Y,children:[a.jsx(Mg,{onClick:pe}),a.jsx(Eg,{onClick:pe})]})]}),x&&a.jsx(tt,{size:"sm","aria-label":L("accessibility.reset"),tooltip:L("accessibility.reset"),icon:a.jsx(Yne,{}),isDisabled:j,onClick:V,...W})]})]})});BO.displayName="IAISlider";const Pt=l.memo(BO),HO=l.forwardRef(({label:e,tooltip:t,description:n,disabled:r,...o},s)=>a.jsx(Fn,{label:t,placement:"top",hasArrow:!0,openDelay:500,children:a.jsx(Te,{ref:s,...o,children:a.jsxs(Te,{children:[a.jsx(yu,{children:e}),n&&a.jsx(yu,{size:"xs",color:"base.600",children:n})]})})}));HO.displayName="IAIMantineSelectItemWithTooltip";const pl=l.memo(HO),Jne=de([Ce],({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},_e),Zne=()=>{const e=oe(),{t}=J(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=H(Jne),o=l.useRef(null),{boards:s,hasBoards:i}=gf(void 0,{selectFromResult:({data:p})=>{const h=[{label:"None",value:"none"}];return p==null||p.forEach(({board_id:m,board_name:g})=>{h.push({label:g,value:m})}),{boards:h,hasBoards:h.length>1}}}),c=l.useCallback(p=>{p&&e(ag(p))},[e]),d=l.useCallback((p,h)=>{var m;return((m=h.label)==null?void 0:m.toLowerCase().includes(p.toLowerCase().trim()))||h.value.toLowerCase().includes(p.toLowerCase().trim())},[]);return a.jsx(tr,{label:t("boards.autoAddBoard"),inputRef:o,autoFocus:!0,placeholder:t("boards.selectBoard"),value:n,data:s,nothingFound:t("boards.noMatching"),itemComponent:pl,disabled:!i||r,filter:d,onChange:c})},ere=l.memo(Zne),tre=e=>{const{label:t,...n}=e,{colorMode:r}=wi();return a.jsx(_f,{colorScheme:"accent",...n,children:a.jsx(Se,{sx:{fontSize:"sm",color:Ke("base.800","base.200")(r)},children:t})})},Io=l.memo(tre),nre=de([Ce],e=>{const{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}=e.gallery;return{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}},_e),rre=()=>{const e=oe(),{t}=J(),{galleryImageMinimumWidth:n,shouldAutoSwitch:r,autoAssignBoardOnClick:o}=H(nre),s=l.useCallback(p=>{e(Nw(p))},[e]),i=l.useCallback(()=>{e(Nw(64))},[e]),c=l.useCallback(p=>{e(KD(p.target.checked))},[e]),d=l.useCallback(p=>e(QD(p.target.checked)),[e]);return a.jsx(Uf,{triggerComponent:a.jsx(tt,{tooltip:t("gallery.gallerySettings"),"aria-label":t("gallery.gallerySettings"),size:"sm",icon:a.jsx(ZM,{})}),children:a.jsxs(N,{direction:"column",gap:2,children:[a.jsx(Pt,{value:n,onChange:s,min:45,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:i}),a.jsx(jr,{label:t("gallery.autoSwitchNewImages"),isChecked:r,onChange:c}),a.jsx(Io,{label:t("gallery.autoAssignBoardOnClick"),isChecked:o,onChange:d}),a.jsx(ere,{})]})})},ore=l.memo(rre),sre=e=>e.image?a.jsx(Dg,{sx:{w:`${e.image.width}px`,h:"auto",objectFit:"contain",aspectRatio:`${e.image.width}/${e.image.height}`}}):a.jsx(N,{sx:{opacity:.7,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(bi,{size:"xl"})}),qr=e=>{const{icon:t=Ql,boxSize:n=16,sx:r,...o}=e;return a.jsxs(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...r},...o,children:[t&&a.jsx(zr,{as:t,boxSize:n,opacity:.7}),e.label&&a.jsx(Se,{textAlign:"center",children:e.label})]})},are=e=>{const{sx:t,...n}=e;return a.jsxs(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...t},...n,children:[a.jsx(bi,{size:"xl"}),e.label&&a.jsx(Se,{textAlign:"center",children:e.label})]})},i0=0,hl=1,Vu=2,WO=4;function VO(e,t){return n=>e(t(n))}function ire(e,t){return t(e)}function UO(e,t){return n=>e(t,n)}function Yj(e,t){return()=>e(t)}function l0(e,t){return t(e),e}function br(...e){return e}function lre(e){e()}function Jj(e){return()=>e}function cre(...e){return()=>{e.map(lre)}}function h2(e){return e!==void 0}function Uu(){}function qn(e,t){return e(hl,t)}function dn(e,t){e(i0,t)}function m2(e){e(Vu)}function ks(e){return e(WO)}function Lt(e,t){return qn(e,UO(t,i0))}function gi(e,t){const n=e(hl,r=>{n(),t(r)});return n}function Mn(){const e=[];return(t,n)=>{switch(t){case Vu:e.splice(0,e.length);return;case hl:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case i0:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function at(e){let t=e;const n=Mn();return(r,o)=>{switch(r){case hl:o(t);break;case i0:t=o;break;case WO:return t}return n(r,o)}}function ure(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case hl:return s?n===s?void 0:(r(),n=s,t=qn(e,s),t):(r(),Uu);case Vu:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function as(e){return l0(Mn(),t=>Lt(e,t))}function Po(e,t){return l0(at(t),n=>Lt(e,n))}function dre(...e){return t=>e.reduceRight(ire,t)}function $e(e,...t){const n=dre(...t);return(r,o)=>{switch(r){case hl:return qn(e,n(o));case Vu:m2(e);return}}}function GO(e,t){return e===t}function hr(e=GO){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function tn(e){return t=>n=>{e(n)&&t(n)}}function yt(e){return t=>VO(t,e)}function ei(e){return t=>()=>t(e)}function ka(e,t){return n=>r=>n(t=e(t,r))}function _u(e){return t=>n=>{e>0?e--:t(n)}}function Ki(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Zj(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function mn(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const c=Math.pow(2,i);qn(s,d=>{const p=n;n=n|c,t[i]=d,p!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const c=()=>s([i].concat(t));n===o?c():r=c}}function e_(...e){return function(t,n){switch(t){case hl:return cre(...e.map(r=>qn(r,n)));case Vu:return;default:throw new Error(`unrecognized action ${t}`)}}}function en(e,t=GO){return $e(e,hr(t))}function to(...e){const t=Mn(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const c=Math.pow(2,i);qn(s,d=>{n[i]=d,r=r|c,r===o&&dn(t,n)})}),function(s,i){switch(s){case hl:return r===o&&i(n),qn(t,i);case Vu:return m2(t);default:throw new Error(`unrecognized action ${s}`)}}}function Un(e,t=[],{singleton:n}={singleton:!0}){return{id:fre(),constructor:e,dependencies:t,singleton:n}}const fre=()=>Symbol();function pre(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:i})=>{if(i&&t.has(r))return t.get(r);const c=o(s.map(d=>n(d)));return i&&t.set(r,c),c};return n(e)}function hre(e,t){const n={},r={};let o=0;const s=e.length;for(;o(C[S]=j=>{const _=x[t.methods[S]];dn(_,j)},C),{})}function h(x){return i.reduce((C,S)=>(C[S]=ure(x[t.events[S]]),C),{})}return{Component:B.forwardRef((x,C)=>{const{children:S,...j}=x,[_]=B.useState(()=>l0(pre(e),P=>d(P,j))),[I]=B.useState(Yj(h,_));return mh(()=>{for(const P of i)P in j&&qn(I[P],j[P]);return()=>{Object.values(I).map(m2)}},[j,I,_]),mh(()=>{d(_,j)}),B.useImperativeHandle(C,Jj(p(_))),B.createElement(c.Provider,{value:_},n?B.createElement(n,hre([...r,...o,...i],j),S):S)}),usePublisher:x=>B.useCallback(UO(dn,B.useContext(c)[x]),[x]),useEmitterValue:x=>{const S=B.useContext(c)[x],[j,_]=B.useState(Yj(ks,S));return mh(()=>qn(S,I=>{I!==j&&_(Jj(I))}),[S,j]),j},useEmitter:(x,C)=>{const j=B.useContext(c)[x];mh(()=>qn(j,C),[C,j])}}}const mre=typeof document<"u"?B.useLayoutEffect:B.useEffect,gre=mre;var is=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(is||{});const vre={0:"debug",1:"log",2:"warn",3:"error"},bre=()=>typeof globalThis>"u"?window:globalThis,ml=Un(()=>{const e=at(3);return{log:at((n,r,o=1)=>{var s;const i=(s=bre().VIRTUOSO_LOG_LEVEL)!=null?s:ks(e);o>=i&&console[vre[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function g2(e,t=!0){const n=B.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=B.useMemo(()=>new ResizeObserver(s=>{const i=s[0].target;i.offsetParent!==null&&e(i)}),[e]);r=s=>{s&&t?(o.observe(s),n.current=s):(n.current&&o.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function sc(e,t=!0){return g2(e,t).callbackRef}function xre(e,t,n,r,o,s,i){const c=B.useCallback(d=>{const p=yre(d.children,t,"offsetHeight",o);let h=d.parentElement;for(;!h.dataset.virtuosoScroller;)h=h.parentElement;const m=h.lastElementChild.dataset.viewportType==="window",g=i?i.scrollTop:m?window.pageYOffset||document.documentElement.scrollTop:h.scrollTop,b=i?i.scrollHeight:m?document.documentElement.scrollHeight:h.scrollHeight,y=i?i.offsetHeight:m?window.innerHeight:h.offsetHeight;r({scrollTop:Math.max(g,0),scrollHeight:b,viewportHeight:y}),s==null||s(Cre("row-gap",getComputedStyle(d).rowGap,o)),p!==null&&e(p)},[e,t,o,s,i,r]);return g2(c,n)}function yre(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i{const g=m.target,b=g===window||g===document,y=b?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,x=b?document.documentElement.scrollHeight:g.scrollHeight,C=b?window.innerHeight:g.offsetHeight,S=()=>{e({scrollTop:Math.max(y,0),scrollHeight:x,viewportHeight:C})};m.suppressFlushSync?S():XD.flushSync(S),i.current!==null&&(y===i.current||y<=0||y===x-C)&&(i.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t]);B.useEffect(()=>{const m=o||s.current;return r(o||s.current),d({target:m,suppressFlushSync:!0}),m.addEventListener("scroll",d,{passive:!0}),()=>{r(null),m.removeEventListener("scroll",d)}},[s,d,n,r,o]);function p(m){const g=s.current;if(!g||"offsetHeight"in g&&g.offsetHeight===0)return;const b=m.behavior==="smooth";let y,x,C;g===window?(x=Math.max(al(document.documentElement,"height"),document.documentElement.scrollHeight),y=window.innerHeight,C=document.documentElement.scrollTop):(x=g.scrollHeight,y=al(g,"height"),C=g.scrollTop);const S=x-y;if(m.top=Math.ceil(Math.max(Math.min(S,m.top),0)),KO(y,x)||m.top===C){e({scrollTop:C,scrollHeight:x,viewportHeight:y}),b&&t(!0);return}b?(i.current=m.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,i.current=null,t(!0)},1e3)):i.current=null,g.scrollTo(m)}function h(m){s.current.scrollBy(m)}return{scrollerRef:s,scrollByCallback:h,scrollToCallback:p}}const Do=Un(()=>{const e=Mn(),t=Mn(),n=at(0),r=Mn(),o=at(0),s=Mn(),i=Mn(),c=at(0),d=at(0),p=at(0),h=at(0),m=Mn(),g=Mn(),b=at(!1);return Lt($e(e,yt(({scrollTop:y})=>y)),t),Lt($e(e,yt(({scrollHeight:y})=>y)),i),Lt(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:c,fixedHeaderHeight:d,fixedFooterHeight:p,footerHeight:h,scrollHeight:i,smoothScrollTargetReached:r,scrollTo:m,scrollBy:g,statefulScrollTop:o,deviation:n,scrollingInProgress:b}},[],{singleton:!0}),of={lvl:0};function XO(e,t,n,r=of,o=of){return{k:e,v:t,lvl:n,l:r,r:o}}function er(e){return e===of}function du(){return of}function Qb(e,t){if(er(e))return of;const{k:n,l:r,r:o}=e;if(t===n){if(er(r))return o;if(er(o))return r;{const[s,i]=YO(r);return Dh(Ur(e,{k:s,v:i,l:JO(r)}))}}else return tt&&(c=c.concat(Xb(s,t,n))),r>=t&&r<=n&&c.push({k:r,v:o}),r<=n&&(c=c.concat(Xb(i,t,n))),c}function Rl(e){return er(e)?[]:[...Rl(e.l),{k:e.k,v:e.v},...Rl(e.r)]}function YO(e){return er(e.r)?[e.k,e.v]:YO(e.r)}function JO(e){return er(e.r)?e.l:Dh(Ur(e,{r:JO(e.r)}))}function Ur(e,t){return XO(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function y1(e){return er(e)||e.lvl>e.r.lvl}function t_(e){return Yb(e8(e))}function Dh(e){const{l:t,r:n,lvl:r}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(y1(t))return e8(Ur(e,{lvl:r-1}));if(!er(t)&&!er(t.r))return Ur(t.r,{l:Ur(t,{r:t.r.l}),r:Ur(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(y1(e))return Yb(Ur(e,{lvl:r-1}));if(!er(n)&&!er(n.l)){const o=n.l,s=y1(o)?n.lvl-1:n.lvl;return Ur(o,{l:Ur(e,{r:o.l,lvl:r-1}),r:Yb(Ur(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function c0(e,t,n){if(er(e))return[];const r=aa(e,t)[0];return wre(Xb(e,r,n))}function ZO(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i({index:t,value:n}))}function Yb(e){const{r:t,lvl:n}=e;return!er(t)&&!er(t.r)&&t.lvl===n&&t.r.lvl===n?Ur(t,{l:Ur(e,{r:t.l}),lvl:n+1}):e}function e8(e){const{l:t}=e;return!er(t)&&t.lvl===e.lvl?Ur(t,{r:Ur(e,{l:t.r})}):e}function Qm(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],c=n(i,t);if(c===0)return s;if(c===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function t8(e,t,n){return e[Qm(e,t,n)]}function Sre(e,t,n,r){const o=Qm(e,t,r),s=Qm(e,n,r,o);return e.slice(o,s+1)}const v2=Un(()=>({recalcInProgress:at(!1)}),[],{singleton:!0});function kre(e){const{size:t,startIndex:n,endIndex:r}=e;return o=>o.start===n&&(o.end===r||o.end===1/0)&&o.value===t}function n_(e,t){let n=0,r=0;for(;n=h||o===g)&&(e=Qb(e,h)):(p=g!==o,d=!0),m>i&&i>=h&&g!==o&&(e=os(e,i+1,g));p&&(e=os(e,s,o))}return[e,n]}function _re(){return{offsetTree:[],sizeTree:du(),groupOffsetTree:du(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function b2({index:e},t){return t===e?0:t0&&(t=Math.max(t,t8(e,r,b2).offset)),ZO(Sre(e,t,n,Ire),Pre)}function Jb(e,t,n,r){let o=e,s=0,i=0,c=0,d=0;if(t!==0){d=Qm(o,t-1,b2),c=o[d].offset;const h=aa(n,t-1);s=h[0],i=h[1],o.length&&o[d].size===aa(n,t)[1]&&(d-=1),o=o.slice(0,d+1)}else o=[];for(const{start:p,value:h}of c0(n,t,1/0)){const m=p-s,g=m*i+c+m*r;o.push({offset:g,size:h,index:p}),s=p,c=g,i=h}return{offsetTree:o,lastIndex:s,lastOffset:c,lastSize:i}}function Mre(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,is.DEBUG);const s=e.sizeTree;let i=s,c=0;if(n.length>0&&er(s)&&t.length===2){const g=t[0].size,b=t[1].size;i=n.reduce((y,x)=>os(os(y,x,g),x+1,b),i)}else[i,c]=jre(i,t);if(i===s)return e;const{offsetTree:d,lastIndex:p,lastSize:h,lastOffset:m}=Jb(e.offsetTree,c,i,o);return{sizeTree:i,offsetTree:d,lastIndex:p,lastOffset:m,lastSize:h,groupOffsetTree:n.reduce((g,b)=>os(g,b,af(b,d,o)),du()),groupIndices:n}}function af(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=t8(t,e,b2),i=e-o,c=s*i+(i-1)*n+r;return c>0?c+n:c}function Ore(e){return typeof e.groupIndex<"u"}function n8(e,t,n){if(Ore(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=r8(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function r8(e,t){if(!u0(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function u0(e){return!er(e.groupOffsetTree)}function Rre(e){return Rl(e).map(({k:t,v:n},r,o)=>{const s=o[r+1],i=s?s.k-1:1/0;return{startIndex:t,endIndex:i,size:n}})}const Are={offsetHeight:"height",offsetWidth:"width"},Va=Un(([{log:e},{recalcInProgress:t}])=>{const n=Mn(),r=Mn(),o=Po(r,0),s=Mn(),i=Mn(),c=at(0),d=at([]),p=at(void 0),h=at(void 0),m=at((P,M)=>al(P,Are[M])),g=at(void 0),b=at(0),y=_re(),x=Po($e(n,mn(d,e,b),ka(Mre,y),hr()),y),C=Po($e(d,hr(),ka((P,M)=>({prev:P.current,current:M}),{prev:[],current:[]}),yt(({prev:P})=>P)),[]);Lt($e(d,tn(P=>P.length>0),mn(x,b),yt(([P,M,R])=>{const A=P.reduce((D,O,T)=>os(D,O,af(O,M.offsetTree,R)||T),du());return{...M,groupIndices:P,groupOffsetTree:A}})),x),Lt($e(r,mn(x),tn(([P,{lastIndex:M}])=>P[{startIndex:P,endIndex:M,size:R}])),n),Lt(p,h);const S=Po($e(p,yt(P=>P===void 0)),!0);Lt($e(h,tn(P=>P!==void 0&&er(ks(x).sizeTree)),yt(P=>[{startIndex:0,endIndex:0,size:P}])),n);const j=as($e(n,mn(x),ka(({sizes:P},[M,R])=>({changed:R!==P,sizes:R}),{changed:!1,sizes:y}),yt(P=>P.changed)));qn($e(c,ka((P,M)=>({diff:P.prev-M,prev:M}),{diff:0,prev:0}),yt(P=>P.diff)),P=>{const{groupIndices:M}=ks(x);if(P>0)dn(t,!0),dn(s,P+n_(P,M));else if(P<0){const R=ks(C);R.length>0&&(P-=n_(-P,R)),dn(i,P)}}),qn($e(c,mn(e)),([P,M])=>{P<0&&M("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},is.ERROR)});const _=as(s);Lt($e(s,mn(x),yt(([P,M])=>{const R=M.groupIndices.length>0,A=[],D=M.lastSize;if(R){const O=sf(M.sizeTree,0);let T=0,Y=0;for(;T{let ee=Q.ranges;return Q.prevSize!==0&&(ee=[...Q.ranges,{startIndex:Q.prevIndex,endIndex:U+P-1,size:Q.prevSize}]),{ranges:ee,prevIndex:U+P,prevSize:L}},{ranges:A,prevIndex:P,prevSize:0}).ranges}return Rl(M.sizeTree).reduce((O,{k:T,v:Y})=>({ranges:[...O.ranges,{startIndex:O.prevIndex,endIndex:T+P-1,size:O.prevSize}],prevIndex:T+P,prevSize:Y}),{ranges:[],prevIndex:0,prevSize:D}).ranges})),n);const I=as($e(i,mn(x,b),yt(([P,{offsetTree:M},R])=>{const A=-P;return af(A,M,R)})));return Lt($e(i,mn(x,b),yt(([P,M,R])=>{if(M.groupIndices.length>0){if(er(M.sizeTree))return M;let D=du();const O=ks(C);let T=0,Y=0,z=0;for(;T<-P;){z=O[Y];const Q=O[Y+1]-z-1;Y++,T+=Q+1}if(D=Rl(M.sizeTree).reduce((Q,{k:U,v:L})=>os(Q,Math.max(0,U+P),L),D),T!==-P){const Q=sf(M.sizeTree,z);D=os(D,0,Q);const U=aa(M.sizeTree,-P+1)[1];D=os(D,1,U)}return{...M,sizeTree:D,...Jb(M.offsetTree,0,D,R)}}else{const D=Rl(M.sizeTree).reduce((O,{k:T,v:Y})=>os(O,Math.max(0,T+P),Y),du());return{...M,sizeTree:D,...Jb(M.offsetTree,0,D,R)}}})),x),{data:g,totalCount:r,sizeRanges:n,groupIndices:d,defaultItemSize:h,fixedItemSize:p,unshiftWith:s,shiftWith:i,shiftWithOffset:I,beforeUnshiftWith:_,firstItemIndex:c,gap:b,sizes:x,listRefresh:j,statefulTotalCount:o,trackItemSizes:S,itemSize:m}},br(ml,v2),{singleton:!0}),Dre=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function o8(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Dre)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Gf=Un(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:i,smoothScrollTargetReached:c,headerHeight:d,footerHeight:p,fixedHeaderHeight:h,fixedFooterHeight:m},{log:g}])=>{const b=Mn(),y=at(0);let x=null,C=null,S=null;function j(){x&&(x(),x=null),S&&(S(),S=null),C&&(clearTimeout(C),C=null),dn(o,!1)}return Lt($e(b,mn(e,s,t,y,d,p,g),mn(r,h,m),yt(([[_,I,P,M,R,A,D,O],T,Y,z])=>{const W=o8(_),{align:Q,behavior:U,offset:L}=W,ee=M-1,K=n8(W,I,ee);let Z=af(K,I.offsetTree,T)+A;Q==="end"?(Z+=Y+aa(I.sizeTree,K)[1]-P+z,K===ee&&(Z+=D)):Q==="center"?Z+=(Y+aa(I.sizeTree,K)[1]-P+z)/2:Z-=R,L&&(Z+=L);const se=fe=>{j(),fe?(O("retrying to scroll to",{location:_},is.DEBUG),dn(b,_)):O("list did not change, scroll successful",{},is.DEBUG)};if(j(),U==="smooth"){let fe=!1;S=qn(n,G=>{fe=fe||G}),x=gi(c,()=>{se(fe)})}else x=gi($e(n,Tre(150)),se);return C=setTimeout(()=>{j()},1200),dn(o,!0),O("scrolling from index to",{index:K,top:Z,behavior:U},is.DEBUG),{top:Z,behavior:U}})),i),{scrollToIndex:b,topListHeight:y}},br(Va,Do,ml),{singleton:!0});function Tre(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const lf="up",Ld="down",Nre="none",$re={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},Lre=0,qf=Un(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const i=at(!1),c=at(!0),d=Mn(),p=Mn(),h=at(4),m=at(Lre),g=Po($e(e_($e(en(t),_u(1),ei(!0)),$e(en(t),_u(1),ei(!1),Zj(100))),hr()),!1),b=Po($e(e_($e(s,ei(!0)),$e(s,ei(!1),Zj(200))),hr()),!1);Lt($e(to(en(t),en(m)),yt(([j,_])=>j<=_),hr()),c),Lt($e(c,Ki(50)),p);const y=as($e(to(e,en(n),en(r),en(o),en(h)),ka((j,[{scrollTop:_,scrollHeight:I},P,M,R,A])=>{const D=_+P-I>-A,O={viewportHeight:P,scrollTop:_,scrollHeight:I};if(D){let Y,z;return _>j.state.scrollTop?(Y="SCROLLED_DOWN",z=j.state.scrollTop-_):(Y="SIZE_DECREASED",z=j.state.scrollTop-_||j.scrollTopDelta),{atBottom:!0,state:O,atBottomBecause:Y,scrollTopDelta:z}}let T;return O.scrollHeight>j.state.scrollHeight?T="SIZE_INCREASED":Pj&&j.atBottom===_.atBottom))),x=Po($e(e,ka((j,{scrollTop:_,scrollHeight:I,viewportHeight:P})=>{if(KO(j.scrollHeight,I))return{scrollTop:_,scrollHeight:I,jump:0,changed:!1};{const M=I-(_+P)<1;return j.scrollTop!==_&&M?{scrollHeight:I,scrollTop:_,jump:j.scrollTop-_,changed:!0}:{scrollHeight:I,scrollTop:_,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),tn(j=>j.changed),yt(j=>j.jump)),0);Lt($e(y,yt(j=>j.atBottom)),i),Lt($e(i,Ki(50)),d);const C=at(Ld);Lt($e(e,yt(({scrollTop:j})=>j),hr(),ka((j,_)=>ks(b)?{direction:j.direction,prevScrollTop:_}:{direction:_j.direction)),C),Lt($e(e,Ki(50),ei(Nre)),C);const S=at(0);return Lt($e(g,tn(j=>!j),ei(0)),S),Lt($e(t,Ki(100),mn(g),tn(([j,_])=>!!_),ka(([j,_],[I])=>[_,I],[0,0]),yt(([j,_])=>_-j)),S),{isScrolling:g,isAtTop:c,isAtBottom:i,atBottomState:y,atTopStateChange:p,atBottomStateChange:d,scrollDirection:C,atBottomThreshold:h,atTopThreshold:m,scrollVelocity:S,lastJumpDueToItemResize:x}},br(Do)),gl=Un(([{log:e}])=>{const t=at(!1),n=as($e(t,tn(r=>r),hr()));return qn(t,r=>{r&&ks(e)("props updated",{},is.DEBUG)}),{propsReady:t,didMount:n}},br(ml),{singleton:!0});function x2(e,t){e==0?t():requestAnimationFrame(()=>x2(e-1,t))}function y2(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Kf=Un(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o},{didMount:s}])=>{const i=at(!0),c=at(0),d=at(!1);return Lt($e(s,mn(c),tn(([p,h])=>!!h),ei(!1)),i),qn($e(to(t,s),mn(i,e,n,d),tn(([[,p],h,{sizeTree:m},g,b])=>p&&(!er(m)||h2(g))&&!h&&!b),mn(c)),([,p])=>{dn(d,!0),x2(3,()=>{gi(r,()=>dn(i,!0)),dn(o,p)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:c}},br(Va,Do,Gf,gl),{singleton:!0});function r_(e){return e?e==="smooth"?"smooth":"auto":!1}const zre=(e,t)=>typeof e=="function"?r_(e(t)):t&&r_(e),Fre=Un(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:i,didMount:c},{log:d},{scrollingInProgress:p}])=>{const h=at(!1),m=Mn();let g=null;function b(x){dn(o,{index:"LAST",align:"end",behavior:x})}qn($e(to($e(en(e),_u(1)),c),mn(en(h),n,s,p),yt(([[x,C],S,j,_,I])=>{let P=C&&_,M="auto";return P&&(M=zre(S,j||I),P=P&&!!M),{totalCount:x,shouldFollow:P,followOutputBehavior:M}}),tn(({shouldFollow:x})=>x)),({totalCount:x,followOutputBehavior:C})=>{g&&(g(),g=null),g=gi(t,()=>{ks(d)("following output to ",{totalCount:x},is.DEBUG),b(C),g=null})});function y(x){const C=gi(r,S=>{x&&!S.atBottom&&S.notAtBottomBecause==="SIZE_INCREASED"&&!g&&(ks(d)("scrolling to bottom due to increased size",{},is.DEBUG),b("auto"))});setTimeout(C,100)}return qn($e(to(en(h),e,i),tn(([x,,C])=>x&&C),ka(({value:x},[,C])=>({refreshed:x===C,value:C}),{refreshed:!1,value:0}),tn(({refreshed:x})=>x),mn(h,e)),([,x])=>{y(x!==!1)}),qn(m,()=>{y(ks(h)!==!1)}),qn(to(en(h),r),([x,C])=>{x&&!C.atBottom&&C.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&b("auto")}),{followOutput:h,autoscrollToBottom:m}},br(Va,qf,Gf,Kf,gl,ml,Do));function Bre(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const s8=Un(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=Mn(),i=Mn(),c=as($e(s,yt(Bre)));return Lt($e(c,yt(d=>d.totalCount)),e),Lt($e(c,yt(d=>d.groupIndices)),t),Lt($e(to(r,n,o),tn(([d,p])=>u0(p)),yt(([d,p,h])=>aa(p.groupOffsetTree,Math.max(d-h,0),"v")[0]),hr(),yt(d=>[d])),i),{groupCounts:s,topItemsIndexes:i}},br(Va,Do));function cf(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function a8(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const Xm="top",Ym="bottom",o_="none";function s_(e,t,n){return typeof e=="number"?n===lf&&t===Xm||n===Ld&&t===Ym?e:0:n===lf?t===Xm?e.main:e.reverse:t===Ym?e.main:e.reverse}function a_(e,t){return typeof e=="number"?e:e[t]||0}const C2=Un(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=Mn(),i=at(0),c=at(0),d=at(0),p=Po($e(to(en(e),en(t),en(r),en(s,cf),en(d),en(i),en(o),en(n),en(c)),yt(([h,m,g,[b,y],x,C,S,j,_])=>{const I=h-j,P=C+S,M=Math.max(g-I,0);let R=o_;const A=a_(_,Xm),D=a_(_,Ym);return b-=j,b+=g+S,y+=g+S,y-=j,b>h+P-A&&(R=lf),yh!=null),hr(cf)),[0,0]);return{listBoundary:s,overscan:d,topListHeight:i,increaseViewportBy:c,visibleRange:p}},br(Do),{singleton:!0});function Hre(e,t,n){if(u0(t)){const r=r8(e,t);return[{index:aa(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const i_={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function l_(e,t,n){if(e.length===0)return[];if(!u0(t))return e.map(p=>({...p,index:p.index+n,originalIndex:p.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=c0(t.groupOffsetTree,r,o);let c,d=0;for(const p of e){(!c||c.end0){p=e[0].offset;const x=e[e.length-1];h=x.offset+x.size}const m=n-d,g=c+m*i+(m-1)*r,b=p,y=g-h;return{items:l_(e,o,s),topItems:l_(t,o,s),topListHeight:t.reduce((x,C)=>C.size+x,0),offsetTop:p,offsetBottom:y,top:b,bottom:h,totalCount:n,firstItemIndex:s}}const ac=Un(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:i,listBoundary:c,topListHeight:d},{scrolledToInitialItem:p,initialTopMostItemIndex:h},{topListHeight:m},g,{didMount:b},{recalcInProgress:y}])=>{const x=at([]),C=Mn();Lt(s.topItemsIndexes,x);const S=Po($e(to(b,y,en(i,cf),en(t),en(e),en(h),p,en(x),en(r),en(o),n),tn(([P,M,,R,,,,,,,A])=>{const D=A&&A.length!==R;return P&&!M&&!D}),yt(([,,[P,M],R,A,D,O,T,Y,z,W])=>{const Q=A,{sizeTree:U,offsetTree:L}=Q;if(R===0||P===0&&M===0)return{...i_,totalCount:R};if(er(U))return Th(Hre(y2(D,R),Q,W),[],R,z,Q,Y);const ee=[];if(T.length>0){const G=T[0],te=T[T.length-1];let V=0;for(const F of c0(U,G,te)){const X=F.value,ue=Math.max(F.start,G),q=Math.min(F.end,te);for(let ne=ue;ne<=q;ne++)ee.push({index:ne,size:X,offset:V,data:W&&W[ne]}),V+=X}}if(!O)return Th([],ee,R,z,Q,Y);const K=T.length>0?T[T.length-1]+1:0,Z=Ere(L,P,M,K);if(Z.length===0)return null;const se=R-1,fe=l0([],G=>{for(const te of Z){const V=te.value;let F=V.offset,X=te.start;const ue=V.size;if(V.offset=M);ne++)G.push({index:ne,size:ue,offset:F,data:W&&W[ne]}),F+=ue+z}});return Th(fe,ee,R,z,Q,Y)}),tn(P=>P!==null),hr()),i_);Lt($e(n,tn(h2),yt(P=>P==null?void 0:P.length)),t),Lt($e(S,yt(P=>P.topListHeight)),m),Lt(m,d),Lt($e(S,yt(P=>[P.top,P.bottom])),c),Lt($e(S,yt(P=>P.items)),C);const j=as($e(S,tn(({items:P})=>P.length>0),mn(t,n),tn(([{items:P},M])=>P[P.length-1].originalIndex===M-1),yt(([,P,M])=>[P-1,M]),hr(cf),yt(([P])=>P))),_=as($e(S,Ki(200),tn(({items:P,topItems:M})=>P.length>0&&P[0].originalIndex===M.length),yt(({items:P})=>P[0].index),hr())),I=as($e(S,tn(({items:P})=>P.length>0),yt(({items:P})=>{let M=0,R=P.length-1;for(;P[M].type==="group"&&MM;)R--;return{startIndex:P[M].index,endIndex:P[R].index}}),hr(a8)));return{listState:S,topItemsIndexes:x,endReached:j,startReached:_,rangeChanged:I,itemsRendered:C,...g}},br(Va,s8,C2,Kf,Gf,qf,gl,v2),{singleton:!0}),Wre=Un(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{listState:s},{didMount:i}])=>{const c=at(0);return Lt($e(i,mn(c),tn(([,d])=>d!==0),mn(o,e,t,r,n),yt(([[,d],p,h,m,g,b=[]])=>{let y=0;if(h.groupIndices.length>0)for(const j of h.groupIndices){if(j-y>=d)break;y++}const x=d+y,C=y2(p,x),S=Array.from({length:x}).map((j,_)=>({index:_+C,size:0,offset:0,data:b[_+C]}));return Th(S,[],x,g,h,m)})),s),{initialItemCount:c}},br(Va,Kf,ac,gl),{singleton:!0}),i8=Un(([{scrollVelocity:e}])=>{const t=at(!1),n=Mn(),r=at(!1);return Lt($e(e,mn(r,t,n),tn(([o,s])=>!!s),yt(([o,s,i,c])=>{const{exit:d,enter:p}=s;if(i){if(d(o,c))return!1}else if(p(o,c))return!0;return i}),hr()),t),qn($e(to(t,e,n),mn(r)),([[o,s,i],c])=>o&&c&&c.change&&c.change(s,i)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},br(qf),{singleton:!0}),Vre=Un(([{topItemsIndexes:e}])=>{const t=at(0);return Lt($e(t,tn(n=>n>0),yt(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},br(ac)),l8=Un(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=Mn(),i=Po($e(to(e,r,t,n,o),yt(([c,d,p,h,m])=>c+d+p+h+m.offsetBottom+m.bottom)),0);return Lt(en(i),s),{totalListHeight:i,totalListHeightChanged:s}},br(Do,ac),{singleton:!0});function c8(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const Ure=c8(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Gre=Un(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:i,lastJumpDueToItemResize:c},{listState:d},{beforeUnshiftWith:p,shiftWithOffset:h,sizes:m,gap:g},{log:b},{recalcInProgress:y}])=>{const x=as($e(d,mn(c),ka(([,S,j,_],[{items:I,totalCount:P,bottom:M,offsetBottom:R},A])=>{const D=M+R;let O=0;return j===P&&S.length>0&&I.length>0&&(I[0].originalIndex===0&&S[0].originalIndex===0||(O=D-_,O!==0&&(O+=A))),[O,I,P,D]},[0,[],0,0]),tn(([S])=>S!==0),mn(t,i,r,s,b,y),tn(([,S,j,_,,,I])=>!I&&!_&&S!==0&&j===lf),yt(([[S],,,,,j])=>(j("Upward scrolling compensation",{amount:S},is.DEBUG),S))));function C(S){S>0?(dn(e,{top:-S,behavior:"auto"}),dn(n,0)):(dn(n,0),dn(e,{top:-S,behavior:"auto"}))}return qn($e(x,mn(n,o)),([S,j,_])=>{_&&Ure()?dn(n,j-S):C(-S)}),qn($e(to(Po(o,!1),n,y),tn(([S,j,_])=>!S&&!_&&j!==0),yt(([S,j])=>j),Ki(1)),C),Lt($e(h,yt(S=>({top:-S}))),e),qn($e(p,mn(m,g),yt(([S,{lastSize:j,groupIndices:_,sizeTree:I},P])=>{function M(R){return R*(j+P)}if(_.length===0)return M(S);{let R=0;const A=sf(I,0);let D=0,O=0;for(;DS&&(R-=A,T=S-D+1),D+=T,R+=M(T),O++}return R}})),S=>{dn(n,S),requestAnimationFrame(()=>{dn(e,{top:S}),requestAnimationFrame(()=>{dn(n,0),dn(y,!1)})})}),{deviation:n}},br(Do,qf,ac,Va,ml,v2)),qre=Un(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=at(0);return qn($e(e,mn(r),tn(([,o])=>o!==0),yt(([,o])=>({top:o}))),o=>{gi($e(n,_u(1),tn(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{dn(t,o)})})}),{initialScrollTop:r}},br(gl,Do,ac),{singleton:!0}),Kre=Un(([{viewportHeight:e},{totalListHeight:t}])=>{const n=at(!1),r=Po($e(to(n,e,t),tn(([o])=>o),yt(([,o,s])=>Math.max(0,o-s)),Ki(0),hr()),0);return{alignToBottom:n,paddingTopAddition:r}},br(Do,l8),{singleton:!0}),w2=Un(([{scrollTo:e,scrollContainerState:t}])=>{const n=Mn(),r=Mn(),o=Mn(),s=at(!1),i=at(void 0);return Lt($e(to(n,r),yt(([{viewportHeight:c,scrollTop:d,scrollHeight:p},{offsetTop:h}])=>({scrollTop:Math.max(0,d-h),scrollHeight:p,viewportHeight:c}))),t),Lt($e(e,mn(r),yt(([c,{offsetTop:d}])=>({...c,top:c.top+d}))),o),{useWindowScroll:s,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},br(Do)),Qre=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...i}})=>er?{...i,behavior:o,align:s??"end"}:null,Xre=Un(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:i,fixedFooterHeight:c,scrollingInProgress:d},{scrollToIndex:p}])=>{const h=Mn();return Lt($e(h,mn(e,o,t,s,i,c,r),mn(n),yt(([[m,g,b,y,x,C,S,j],_])=>{const{done:I,behavior:P,align:M,calculateViewLocation:R=Qre,...A}=m,D=n8(m,g,y-1),O=af(D,g.offsetTree,_)+x+C,T=O+aa(g.sizeTree,D)[1],Y=j+C,z=j+b-S,W=R({itemTop:O,itemBottom:T,viewportTop:Y,viewportBottom:z,locationParams:{behavior:P,align:M,...A}});return W?I&&gi($e(d,tn(Q=>Q===!1),_u(ks(d)?1:2)),I):I&&I(),W}),tn(m=>m!==null)),p),{scrollIntoView:h}},br(Va,Do,Gf,ac,ml),{singleton:!0}),Yre=Un(([{sizes:e,sizeRanges:t},{scrollTop:n},{initialTopMostItemIndex:r},{didMount:o},{useWindowScroll:s,windowScrollContainerState:i,windowViewportRect:c}])=>{const d=Mn(),p=at(void 0),h=at(null),m=at(null);return Lt(i,h),Lt(c,m),qn($e(d,mn(e,n,s,h,m)),([g,b,y,x,C,S])=>{const j=Rre(b.sizeTree);x&&C!==null&&S!==null&&(y=C.scrollTop-S.offsetTop),g({ranges:j,scrollTop:y})}),Lt($e(p,tn(h2),yt(Jre)),r),Lt($e(o,mn(p),tn(([,g])=>g!==void 0),hr(),yt(([,g])=>g.ranges)),t),{getState:d,restoreStateFrom:p}},br(Va,Do,Kf,gl,w2));function Jre(e){return{offset:e.scrollTop,index:0,align:"start"}}const Zre=Un(([e,t,n,r,o,s,i,c,d,p])=>({...e,...t,...n,...r,...o,...s,...i,...c,...d,...p}),br(C2,Wre,gl,i8,l8,qre,Kre,w2,Xre,ml)),eoe=Un(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:i,firstItemIndex:c,groupIndices:d,statefulTotalCount:p,gap:h,sizes:m},{initialTopMostItemIndex:g,scrolledToInitialItem:b},y,x,C,{listState:S,topItemsIndexes:j,..._},{scrollToIndex:I},P,{topItemCount:M},{groupCounts:R},A])=>(Lt(_.rangeChanged,A.scrollSeekRangeChanged),Lt($e(A.windowViewportRect,yt(D=>D.visibleHeight)),y.viewportHeight),{totalCount:e,data:i,firstItemIndex:c,sizeRanges:t,initialTopMostItemIndex:g,scrolledToInitialItem:b,topItemsIndexes:j,topItemCount:M,groupCounts:R,fixedItemHeight:n,defaultItemHeight:r,gap:h,...C,statefulTotalCount:p,listState:S,scrollToIndex:I,trackItemSizes:o,itemSize:s,groupIndices:d,..._,...A,...y,sizes:m,...x}),br(Va,Kf,Do,Yre,Fre,ac,Gf,Gre,Vre,s8,Zre)),C1="-webkit-sticky",c_="sticky",u8=c8(()=>{if(typeof document>"u")return c_;const e=document.createElement("div");return e.style.position=C1,e.style.position===C1?C1:c_});function d8(e,t){const n=B.useRef(null),r=B.useCallback(c=>{if(c===null||!c.offsetParent)return;const d=c.getBoundingClientRect(),p=d.width;let h,m;if(t){const g=t.getBoundingClientRect(),b=d.top-g.top;h=g.height-Math.max(0,b),m=b+t.scrollTop}else h=window.innerHeight-Math.max(0,d.top),m=d.top+window.pageYOffset;n.current={offsetTop:m,visibleHeight:h,visibleWidth:p},e(n.current)},[e,t]),{callbackRef:o,ref:s}=g2(r),i=B.useCallback(()=>{r(s.current)},[r,s]);return B.useEffect(()=>{if(t){t.addEventListener("scroll",i);const c=new ResizeObserver(i);return c.observe(t),()=>{t.removeEventListener("scroll",i),c.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),o}const f8=B.createContext(void 0),p8=B.createContext(void 0);function h8(e){return e}const toe=Un(()=>{const e=at(d=>`Item ${d}`),t=at(null),n=at(d=>`Group ${d}`),r=at({}),o=at(h8),s=at("div"),i=at(Uu),c=(d,p=null)=>Po($e(r,yt(h=>h[d]),hr()),p);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:s,scrollerRef:i,FooterComponent:c("Footer"),HeaderComponent:c("Header"),TopItemListComponent:c("TopItemList"),ListComponent:c("List","div"),ItemComponent:c("Item","div"),GroupComponent:c("Group","div"),ScrollerComponent:c("Scroller","div"),EmptyPlaceholder:c("EmptyPlaceholder"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder")}}),noe=Un(([e,t])=>({...e,...t}),br(eoe,toe)),roe=({height:e})=>B.createElement("div",{style:{height:e}}),ooe={position:u8(),zIndex:1,overflowAnchor:"none"},soe={overflowAnchor:"none"},u_=B.memo(function({showTopList:t=!1}){const n=kn("listState"),r=js("sizeRanges"),o=kn("useWindowScroll"),s=kn("customScrollParent"),i=js("windowScrollContainerState"),c=js("scrollContainerState"),d=s||o?i:c,p=kn("itemContent"),h=kn("context"),m=kn("groupContent"),g=kn("trackItemSizes"),b=kn("itemSize"),y=kn("log"),x=js("gap"),{callbackRef:C}=xre(r,b,g,t?Uu:d,y,x,s),[S,j]=B.useState(0);S2("deviation",W=>{S!==W&&j(W)});const _=kn("EmptyPlaceholder"),I=kn("ScrollSeekPlaceholder")||roe,P=kn("ListComponent"),M=kn("ItemComponent"),R=kn("GroupComponent"),A=kn("computeItemKey"),D=kn("isSeeking"),O=kn("groupIndices").length>0,T=kn("paddingTopAddition"),Y=kn("scrolledToInitialItem"),z=t?{}:{boxSizing:"border-box",paddingTop:n.offsetTop+T,paddingBottom:n.offsetBottom,marginTop:S,...Y?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&_?B.createElement(_,Bo(_,h)):B.createElement(P,{...Bo(P,h),ref:C,style:z,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?n.topItems:n.items).map(W=>{const Q=W.originalIndex,U=A(Q+n.firstItemIndex,W.data,h);return D?B.createElement(I,{...Bo(I,h),key:U,index:W.index,height:W.size,type:W.type||"item",...W.type==="group"?{}:{groupIndex:W.groupIndex}}):W.type==="group"?B.createElement(R,{...Bo(R,h),key:U,"data-index":Q,"data-known-size":W.size,"data-item-index":W.index,style:ooe},m(W.index,h)):B.createElement(M,{...Bo(M,h),key:U,"data-index":Q,"data-known-size":W.size,"data-item-index":W.index,"data-item-group-index":W.groupIndex,item:W.data,style:soe},O?p(W.index,W.groupIndex,W.data,h):p(W.index,W.data,h))}))}),aoe={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},d0={width:"100%",height:"100%",position:"absolute",top:0},ioe={width:"100%",position:u8(),top:0,zIndex:1};function Bo(e,t){if(typeof e!="string")return{context:t}}const loe=B.memo(function(){const t=kn("HeaderComponent"),n=js("headerHeight"),r=kn("headerFooterTag"),o=sc(i=>n(al(i,"height"))),s=kn("context");return t?B.createElement(r,{ref:o},B.createElement(t,Bo(t,s))):null}),coe=B.memo(function(){const t=kn("FooterComponent"),n=js("footerHeight"),r=kn("headerFooterTag"),o=sc(i=>n(al(i,"height"))),s=kn("context");return t?B.createElement(r,{ref:o},B.createElement(t,Bo(t,s))):null});function m8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return B.memo(function({style:s,children:i,...c}){const d=e("scrollContainerState"),p=n("ScrollerComponent"),h=e("smoothScrollTargetReached"),m=n("scrollerRef"),g=n("context"),{scrollerRef:b,scrollByCallback:y,scrollToCallback:x}=QO(d,h,p,m);return t("scrollTo",x),t("scrollBy",y),B.createElement(p,{ref:b,style:{...aoe,...s},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...c,...Bo(p,g)},i)})}function g8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return B.memo(function({style:s,children:i,...c}){const d=e("windowScrollContainerState"),p=n("ScrollerComponent"),h=e("smoothScrollTargetReached"),m=n("totalListHeight"),g=n("deviation"),b=n("customScrollParent"),y=n("context"),{scrollerRef:x,scrollByCallback:C,scrollToCallback:S}=QO(d,h,p,Uu,b);return gre(()=>(x.current=b||window,()=>{x.current=null}),[x,b]),t("windowScrollTo",S),t("scrollBy",C),B.createElement(p,{style:{position:"relative",...s,...m!==0?{height:m+g}:{}},"data-virtuoso-scroller":!0,...c,...Bo(p,y)},i)})}const uoe=({children:e})=>{const t=B.useContext(f8),n=js("viewportHeight"),r=js("fixedItemHeight"),o=sc(VO(n,s=>al(s,"height")));return B.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),B.createElement("div",{style:d0,ref:o,"data-viewport-type":"element"},e)},doe=({children:e})=>{const t=B.useContext(f8),n=js("windowViewportRect"),r=js("fixedItemHeight"),o=kn("customScrollParent"),s=d8(n,o);return B.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),B.createElement("div",{ref:s,style:d0,"data-viewport-type":"window"},e)},foe=({children:e})=>{const t=kn("TopItemListComponent"),n=kn("headerHeight"),r={...ioe,marginTop:`${n}px`},o=kn("context");return B.createElement(t||"div",{style:r,context:o},e)},poe=B.memo(function(t){const n=kn("useWindowScroll"),r=kn("topItemsIndexes").length>0,o=kn("customScrollParent"),s=o||n?goe:moe,i=o||n?doe:uoe;return B.createElement(s,{...t},r&&B.createElement(foe,null,B.createElement(u_,{showTopList:!0})),B.createElement(i,null,B.createElement(loe,null),B.createElement(u_,null),B.createElement(coe,null)))}),{Component:hoe,usePublisher:js,useEmitterValue:kn,useEmitter:S2}=qO(noe,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},poe),moe=m8({usePublisher:js,useEmitterValue:kn,useEmitter:S2}),goe=g8({usePublisher:js,useEmitterValue:kn,useEmitter:S2}),voe=hoe,d_={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},boe={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:f_,ceil:p_,floor:Jm,min:w1,max:zd}=Math;function xoe(e){return{...boe,items:e}}function h_(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>{const s=n===null?null:n[o+e];return{index:o+e,data:s}})}function yoe(e,t){return e&&e.column===t.column&&e.row===t.row}function gh(e,t){return e&&e.width===t.width&&e.height===t.height}const Coe=Un(([{overscan:e,visibleRange:t,listBoundary:n},{scrollTop:r,viewportHeight:o,scrollBy:s,scrollTo:i,smoothScrollTargetReached:c,scrollContainerState:d,footerHeight:p,headerHeight:h},m,g,{propsReady:b,didMount:y},{windowViewportRect:x,useWindowScroll:C,customScrollParent:S,windowScrollContainerState:j,windowScrollTo:_},I])=>{const P=at(0),M=at(0),R=at(d_),A=at({height:0,width:0}),D=at({height:0,width:0}),O=Mn(),T=Mn(),Y=at(0),z=at(null),W=at({row:0,column:0}),Q=Mn(),U=Mn(),L=at(!1),ee=at(0),K=at(!0),Z=at(!1);qn($e(y,mn(ee),tn(([F,X])=>!!X)),()=>{dn(K,!1),dn(M,0)}),qn($e(to(y,K,D,A,ee,Z),tn(([F,X,ue,q,,ne])=>F&&!X&&ue.height!==0&&q.height!==0&&!ne)),([,,,,F])=>{dn(Z,!0),x2(1,()=>{dn(O,F)}),gi($e(r),()=>{dn(n,[0,0]),dn(K,!0)})}),Lt($e(U,tn(F=>F!=null&&F.scrollTop>0),ei(0)),M),qn($e(y,mn(U),tn(([,F])=>F!=null)),([,F])=>{F&&(dn(A,F.viewport),dn(D,F==null?void 0:F.item),dn(W,F.gap),F.scrollTop>0&&(dn(L,!0),gi($e(r,_u(1)),X=>{dn(L,!1)}),dn(i,{top:F.scrollTop})))}),Lt($e(A,yt(({height:F})=>F)),o),Lt($e(to(en(A,gh),en(D,gh),en(W,(F,X)=>F&&F.column===X.column&&F.row===X.row),en(r)),yt(([F,X,ue,q])=>({viewport:F,item:X,gap:ue,scrollTop:q}))),Q),Lt($e(to(en(P),t,en(W,yoe),en(D,gh),en(A,gh),en(z),en(M),en(L),en(K),en(ee)),tn(([,,,,,,,F])=>!F),yt(([F,[X,ue],q,ne,pe,le,we,,ve,he])=>{const{row:Ne,column:De}=q,{height:qe,width:Mt}=ne,{width:ot}=pe;if(we===0&&(F===0||ot===0))return d_;if(Mt===0){const At=y2(he,F),_t=At===0?Math.max(we-1,0):At;return xoe(h_(At,_t,le))}const an=v8(ot,Mt,De);let pt,vt;ve?X===0&&ue===0&&we>0?(pt=0,vt=we-1):(pt=an*Jm((X+Ne)/(qe+Ne)),vt=an*p_((ue+Ne)/(qe+Ne))-1,vt=w1(F-1,zd(vt,an-1)),pt=w1(vt,zd(0,pt))):(pt=0,vt=-1);const ke=h_(pt,vt,le),{top:Be,bottom:Ot}=m_(pe,q,ne,ke),Ht=p_(F/an),ht=Ht*qe+(Ht-1)*Ne-Ot;return{items:ke,offsetTop:Be,offsetBottom:ht,top:Be,bottom:Ot,itemHeight:qe,itemWidth:Mt}})),R),Lt($e(z,tn(F=>F!==null),yt(F=>F.length)),P),Lt($e(to(A,D,R,W),tn(([F,X,{items:ue}])=>ue.length>0&&X.height!==0&&F.height!==0),yt(([F,X,{items:ue},q])=>{const{top:ne,bottom:pe}=m_(F,q,X,ue);return[ne,pe]}),hr(cf)),n);const se=at(!1);Lt($e(r,mn(se),yt(([F,X])=>X||F!==0)),se);const fe=as($e(en(R),tn(({items:F})=>F.length>0),mn(P,se),tn(([{items:F},X,ue])=>ue&&F[F.length-1].index===X-1),yt(([,F])=>F-1),hr())),G=as($e(en(R),tn(({items:F})=>F.length>0&&F[0].index===0),ei(0),hr())),te=as($e(en(R),mn(L),tn(([{items:F},X])=>F.length>0&&!X),yt(([{items:F}])=>({startIndex:F[0].index,endIndex:F[F.length-1].index})),hr(a8),Ki(0)));Lt(te,g.scrollSeekRangeChanged),Lt($e(O,mn(A,D,P,W),yt(([F,X,ue,q,ne])=>{const pe=o8(F),{align:le,behavior:we,offset:ve}=pe;let he=pe.index;he==="LAST"&&(he=q-1),he=zd(0,he,w1(q-1,he));let Ne=Zb(X,ne,ue,he);return le==="end"?Ne=f_(Ne-X.height+ue.height):le==="center"&&(Ne=f_(Ne-X.height/2+ue.height/2)),ve&&(Ne+=ve),{top:Ne,behavior:we}})),i);const V=Po($e(R,yt(F=>F.offsetBottom+F.bottom)),0);return Lt($e(x,yt(F=>({width:F.visibleWidth,height:F.visibleHeight}))),A),{data:z,totalCount:P,viewportDimensions:A,itemDimensions:D,scrollTop:r,scrollHeight:T,overscan:e,scrollBy:s,scrollTo:i,scrollToIndex:O,smoothScrollTargetReached:c,windowViewportRect:x,windowScrollTo:_,useWindowScroll:C,customScrollParent:S,windowScrollContainerState:j,deviation:Y,scrollContainerState:d,footerHeight:p,headerHeight:h,initialItemCount:M,gap:W,restoreStateFrom:U,...g,initialTopMostItemIndex:ee,gridState:R,totalListHeight:V,...m,startReached:G,endReached:fe,rangeChanged:te,stateChanged:Q,propsReady:b,stateRestoreInProgress:L,...I}},br(C2,Do,qf,i8,gl,w2,ml));function m_(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=Zb(e,t,n,r[0].index),i=Zb(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:i}}function Zb(e,t,n,r){const o=v8(e.width,n.width,t.column),s=Jm(r/o),i=s*n.height+zd(0,s-1)*t.row;return i>0?i+t.row:i}function v8(e,t,n){return zd(1,Jm((e+n)/(Jm(t)+n)))}const woe=Un(()=>{const e=at(p=>`Item ${p}`),t=at({}),n=at(null),r=at("virtuoso-grid-item"),o=at("virtuoso-grid-list"),s=at(h8),i=at("div"),c=at(Uu),d=(p,h=null)=>Po($e(t,yt(m=>m[p]),hr()),h);return{context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:i,scrollerRef:c,FooterComponent:d("Footer"),HeaderComponent:d("Header"),ListComponent:d("List","div"),ItemComponent:d("Item","div"),ScrollerComponent:d("Scroller","div"),ScrollSeekPlaceholder:d("ScrollSeekPlaceholder","div")}}),Soe=Un(([e,t])=>({...e,...t}),br(Coe,woe)),koe=B.memo(function(){const t=Sr("gridState"),n=Sr("listClassName"),r=Sr("itemClassName"),o=Sr("itemContent"),s=Sr("computeItemKey"),i=Sr("isSeeking"),c=ta("scrollHeight"),d=Sr("ItemComponent"),p=Sr("ListComponent"),h=Sr("ScrollSeekPlaceholder"),m=Sr("context"),g=ta("itemDimensions"),b=ta("gap"),y=Sr("log"),x=Sr("stateRestoreInProgress"),C=sc(S=>{const j=S.parentElement.parentElement.scrollHeight;c(j);const _=S.firstChild;if(_){const{width:I,height:P}=_.getBoundingClientRect();g({width:I,height:P})}b({row:g_("row-gap",getComputedStyle(S).rowGap,y),column:g_("column-gap",getComputedStyle(S).columnGap,y)})});return x?null:B.createElement(p,{ref:C,className:n,...Bo(p,m),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map(S=>{const j=s(S.index,S.data,m);return i?B.createElement(h,{key:j,...Bo(h,m),index:S.index,height:t.itemHeight,width:t.itemWidth}):B.createElement(d,{...Bo(d,m),className:r,"data-index":S.index,key:j},o(S.index,S.data,m))}))}),joe=B.memo(function(){const t=Sr("HeaderComponent"),n=ta("headerHeight"),r=Sr("headerFooterTag"),o=sc(i=>n(al(i,"height"))),s=Sr("context");return t?B.createElement(r,{ref:o},B.createElement(t,Bo(t,s))):null}),_oe=B.memo(function(){const t=Sr("FooterComponent"),n=ta("footerHeight"),r=Sr("headerFooterTag"),o=sc(i=>n(al(i,"height"))),s=Sr("context");return t?B.createElement(r,{ref:o},B.createElement(t,Bo(t,s))):null}),Ioe=({children:e})=>{const t=B.useContext(p8),n=ta("itemDimensions"),r=ta("viewportDimensions"),o=sc(s=>{r(s.getBoundingClientRect())});return B.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),B.createElement("div",{style:d0,ref:o},e)},Poe=({children:e})=>{const t=B.useContext(p8),n=ta("windowViewportRect"),r=ta("itemDimensions"),o=Sr("customScrollParent"),s=d8(n,o);return B.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),B.createElement("div",{ref:s,style:d0},e)},Eoe=B.memo(function({...t}){const n=Sr("useWindowScroll"),r=Sr("customScrollParent"),o=r||n?Roe:Ooe,s=r||n?Poe:Ioe;return B.createElement(o,{...t},B.createElement(s,null,B.createElement(joe,null),B.createElement(koe,null),B.createElement(_oe,null)))}),{Component:Moe,usePublisher:ta,useEmitterValue:Sr,useEmitter:b8}=qO(Soe,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged"}},Eoe),Ooe=m8({usePublisher:ta,useEmitterValue:Sr,useEmitter:b8}),Roe=g8({usePublisher:ta,useEmitterValue:Sr,useEmitter:b8});function g_(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,is.WARN),t==="normal"?0:parseInt(t??"0",10)}const Aoe=Moe,Doe=e=>{const t=H(s=>s.gallery.galleryView),{data:n}=kx(e),{data:r}=jx(e),o=l.useMemo(()=>t==="images"?n==null?void 0:n.total:r==null?void 0:r.total,[t,r,n]);return{totalImages:n,totalAssets:r,currentViewTotal:o}},Toe=({imageDTO:e})=>a.jsx(N,{sx:{pointerEvents:"none",flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,p:2,alignItems:"flex-start",gap:2},children:a.jsxs(Ha,{variant:"solid",colorScheme:"base",children:[e.width," × ",e.height]})}),Noe=l.memo(Toe),k2=({postUploadAction:e,isDisabled:t})=>{const n=H(d=>d.gallery.autoAddBoardId),[r]=II(),o=l.useCallback(d=>{const p=d[0];p&&r({file:p,image_category:"user",is_intermediate:!1,postUploadAction:e??{type:"TOAST"},board_id:n==="none"?void 0:n})},[n,e,r]),{getRootProps:s,getInputProps:i,open:c}=Oy({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},onDropAccepted:o,disabled:t,noDrag:!0,multiple:!1});return{getUploadButtonProps:s,getUploadInputProps:i,openUploader:c}},$oe=de(Ce,({generation:e})=>e.model,_e),f0=()=>{const e=oe(),t=Zl(),{t:n}=J(),r=H($oe),o=l.useCallback(()=>{t({title:n("toast.parameterSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),s=l.useCallback(G=>{t({title:n("toast.parameterNotSet"),description:G,status:"warning",duration:2500,isClosable:!0})},[n,t]),i=l.useCallback(()=>{t({title:n("toast.parametersSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),c=l.useCallback(G=>{t({title:n("toast.parametersNotSet"),status:"warning",description:G,duration:2500,isClosable:!0})},[n,t]),d=l.useCallback((G,te,V,F)=>{if(Ap(G)||Dp(te)||pd(V)||Pv(F)){Ap(G)&&e(Rd(G)),Dp(te)&&e(Ad(te)),pd(V)&&e(Dd(V)),pd(F)&&e(Td(F)),o();return}s()},[e,o,s]),p=l.useCallback(G=>{if(!Ap(G)){s();return}e(Rd(G)),o()},[e,o,s]),h=l.useCallback(G=>{if(!Dp(G)){s();return}e(Ad(G)),o()},[e,o,s]),m=l.useCallback(G=>{if(!pd(G)){s();return}e(Dd(G)),o()},[e,o,s]),g=l.useCallback(G=>{if(!Pv(G)){s();return}e(Td(G)),o()},[e,o,s]),b=l.useCallback(G=>{if(!$w(G)){s();return}e(Lh(G)),o()},[e,o,s]),y=l.useCallback(G=>{if(!Ev(G)){s();return}e(zh(G)),o()},[e,o,s]),x=l.useCallback(G=>{if(!Lw(G)){s();return}e(z1(G)),o()},[e,o,s]),C=l.useCallback(G=>{if(!Mv(G)){s();return}e(F1(G)),o()},[e,o,s]),S=l.useCallback(G=>{if(!zw(G)&&!oi(G)){s();return}oi(G)?e(Wc(null)):e(Wc(G)),o()},[e,o,s]),j=l.useCallback(G=>{if(!Ov(G)){s();return}e(Fh(G)),o()},[e,o,s]),_=l.useCallback(G=>{if(!Fw(G)){s();return}e(Hl(G)),o()},[e,o,s]),I=l.useCallback(G=>{if(!Bw(G)){s();return}e(Wl(G)),o()},[e,o,s]),P=l.useCallback(G=>{if(!Tp(G)){s();return}e(Bh(G)),o()},[e,o,s]),M=l.useCallback(G=>{if(!Hw(G)){s();return}e(B1(G)),o()},[e,o,s]),R=l.useCallback(G=>{if(!Tp(G)){s();return}e(Hh(G)),o()},[e,o,s]),A=l.useCallback(G=>{if(!Ww(G)){s();return}e(H1(G)),o()},[e,o,s]),{data:D}=vf(void 0),O=l.useCallback(G=>{if(!$I(G.lora))return{lora:null,error:"Invalid LoRA model"};const{base_model:te,model_name:V}=G.lora,F=D?YD.getSelectors().selectById(D,`${te}/lora/${V}`):void 0;return F?(F==null?void 0:F.base_model)===(r==null?void 0:r.base_model)?{lora:F,error:null}:{lora:null,error:"LoRA incompatible with currently-selected model"}:{lora:null,error:"LoRA model is not installed"}},[D,r==null?void 0:r.base_model]),T=l.useCallback(G=>{const te=O(G);if(!te.lora){s(te.error);return}e(Vw({...te.lora,weight:G.weight})),o()},[O,e,o,s]),{data:Y}=_x(void 0),z=l.useCallback(G=>{if(!Wh(G.control_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:te,control_model:V,control_weight:F,begin_step_percent:X,end_step_percent:ue,control_mode:q,resize_mode:ne}=G,pe=Y?LI.getSelectors().selectById(Y,`${V.base_model}/controlnet/${V.model_name}`):void 0;if(!pe)return{controlnet:null,error:"ControlNet model is not installed"};if(!((pe==null?void 0:pe.base_model)===(r==null?void 0:r.base_model)))return{controlnet:null,error:"ControlNet incompatible with currently-selected model"};const we="none",ve=Oo.none.default;return{controlnet:{type:"controlnet",isEnabled:!0,model:pe,weight:typeof F=="number"?F:hd.weight,beginStepPct:X||hd.beginStepPct,endStepPct:ue||hd.endStepPct,controlMode:q||hd.controlMode,resizeMode:ne||hd.resizeMode,controlImage:(te==null?void 0:te.image_name)||null,processedControlImage:(te==null?void 0:te.image_name)||null,processorType:we,processorNode:ve,shouldAutoConfig:!0,id:Jc()},error:null}},[Y,r==null?void 0:r.base_model]),W=l.useCallback(G=>{const te=z(G);if(!te.controlnet){s(te.error);return}e(wc(te.controlnet)),o()},[z,e,o,s]),{data:Q}=Ix(void 0),U=l.useCallback(G=>{if(!Wh(G.t2i_adapter_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:te,t2i_adapter_model:V,weight:F,begin_step_percent:X,end_step_percent:ue,resize_mode:q}=G,ne=Q?zI.getSelectors().selectById(Q,`${V.base_model}/t2i_adapter/${V.model_name}`):void 0;if(!ne)return{controlnet:null,error:"ControlNet model is not installed"};if(!((ne==null?void 0:ne.base_model)===(r==null?void 0:r.base_model)))return{t2iAdapter:null,error:"ControlNet incompatible with currently-selected model"};const le="none",we=Oo.none.default;return{t2iAdapter:{type:"t2i_adapter",isEnabled:!0,model:ne,weight:typeof F=="number"?F:Np.weight,beginStepPct:X||Np.beginStepPct,endStepPct:ue||Np.endStepPct,resizeMode:q||Np.resizeMode,controlImage:(te==null?void 0:te.image_name)||null,processedControlImage:(te==null?void 0:te.image_name)||null,processorType:le,processorNode:we,shouldAutoConfig:!0,id:Jc()},error:null}},[r==null?void 0:r.base_model,Q]),L=l.useCallback(G=>{const te=U(G);if(!te.t2iAdapter){s(te.error);return}e(wc(te.t2iAdapter)),o()},[U,e,o,s]),{data:ee}=Px(void 0),K=l.useCallback(G=>{if(!JD(G==null?void 0:G.ip_adapter_model))return{ipAdapter:null,error:"Invalid IP Adapter model"};const{image:te,ip_adapter_model:V,weight:F,begin_step_percent:X,end_step_percent:ue}=G,q=ee?FI.getSelectors().selectById(ee,`${V.base_model}/ip_adapter/${V.model_name}`):void 0;return q?(q==null?void 0:q.base_model)===(r==null?void 0:r.base_model)?{ipAdapter:{id:Jc(),type:"ip_adapter",isEnabled:!0,controlImage:(te==null?void 0:te.image_name)??null,model:q,weight:F??Rv.weight,beginStepPct:X??Rv.beginStepPct,endStepPct:ue??Rv.endStepPct},error:null}:{ipAdapter:null,error:"IP Adapter incompatible with currently-selected model"}:{ipAdapter:null,error:"IP Adapter model is not installed"}},[ee,r==null?void 0:r.base_model]),Z=l.useCallback(G=>{const te=K(G);if(!te.ipAdapter){s(te.error);return}e(wc(te.ipAdapter)),o()},[K,e,o,s]),se=l.useCallback(G=>{e(ig(G))},[e]),fe=l.useCallback(G=>{if(!G){c();return}const{cfg_scale:te,height:V,model:F,positive_prompt:X,negative_prompt:ue,scheduler:q,vae:ne,seed:pe,steps:le,width:we,strength:ve,hrf_enabled:he,hrf_strength:Ne,hrf_method:De,positive_style_prompt:qe,negative_style_prompt:Mt,refiner_model:ot,refiner_cfg_scale:an,refiner_steps:pt,refiner_scheduler:vt,refiner_positive_aesthetic_score:ke,refiner_negative_aesthetic_score:Be,refiner_start:Ot,loras:Ht,controlnets:je,ipAdapters:ht,t2iAdapters:At}=G;Ev(te)&&e(zh(te)),Lw(F)&&e(z1(F)),Ap(X)&&e(Rd(X)),Dp(ue)&&e(Ad(ue)),Mv(q)&&e(F1(q)),(zw(ne)||oi(ne))&&(oi(ne)?e(Wc(null)):e(Wc(ne))),$w(pe)&&e(Lh(pe)),Ov(le)&&e(Fh(le)),Fw(we)&&e(Hl(we)),Bw(V)&&e(Wl(V)),Tp(ve)&&e(Bh(ve)),Hw(he)&&e(B1(he)),Tp(Ne)&&e(Hh(Ne)),Ww(De)&&e(H1(De)),pd(qe)&&e(Dd(qe)),Pv(Mt)&&e(Td(Mt)),ZD(ot)&&e(BI(ot)),Ov(pt)&&e(W1(pt)),Ev(an)&&e(V1(an)),Mv(vt)&&e(HI(vt)),e7(ke)&&e(U1(ke)),t7(Be)&&e(G1(Be)),n7(Ot)&&e(q1(Ot)),e(r7()),Ht==null||Ht.forEach(_t=>{const Re=O(_t);Re.lora&&e(Vw({...Re.lora,weight:_t.weight}))}),e(MI()),je==null||je.forEach(_t=>{const Re=z(_t);Re.controlnet&&e(wc(Re.controlnet))}),ht==null||ht.forEach(_t=>{const Re=K(_t);Re.ipAdapter&&e(wc(Re.ipAdapter))}),At==null||At.forEach(_t=>{const Re=U(_t);Re.t2iAdapter&&e(wc(Re.t2iAdapter))}),i()},[e,i,c,O,z,K,U]);return{recallBothPrompts:d,recallPositivePrompt:p,recallNegativePrompt:h,recallSDXLPositiveStylePrompt:m,recallSDXLNegativeStylePrompt:g,recallSeed:b,recallCfgScale:y,recallModel:x,recallScheduler:C,recallVaeModel:S,recallSteps:j,recallWidth:_,recallHeight:I,recallStrength:P,recallHrfEnabled:M,recallHrfStrength:R,recallHrfMethod:A,recallLoRA:T,recallControlNet:W,recallIPAdapter:Z,recallT2IAdapter:L,recallAllParameters:fe,sendToImageToImage:se}},Loe=()=>l.useCallback(async t=>new Promise(n=>{const r=new Image;r.onload=()=>{const o=document.createElement("canvas");o.width=r.width,o.height=r.height;const s=o.getContext("2d");s&&(s.drawImage(r,0,0),n(new Promise(i=>{o.toBlob(function(c){i(c)},"image/png")})))},r.crossOrigin=WI.get()?"use-credentials":"anonymous",r.src=t}),[]),x8=()=>{const e=Zl(),{t}=J(),n=Loe(),r=l.useMemo(()=>!!navigator.clipboard&&!!window.ClipboardItem,[]),o=l.useCallback(async s=>{r||e({title:t("toast.problemCopyingImage"),description:"Your browser doesn't support the Clipboard API.",status:"error",duration:2500,isClosable:!0});try{const i=await n(s);if(!i)throw new Error("Unable to create Blob");o7(i),e({title:t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})}catch(i){e({title:t("toast.problemCopyingImage"),description:String(i),status:"error",duration:2500,isClosable:!0})}},[n,r,t,e]);return{isClipboardAPIAvailable:r,copyImageToClipboard:o}};function zoe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M125.7 160H176c17.7 0 32 14.3 32 32s-14.3 32-32 32H48c-17.7 0-32-14.3-32-32V64c0-17.7 14.3-32 32-32s32 14.3 32 32v51.2L97.6 97.6c87.5-87.5 229.3-87.5 316.8 0s87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3s-163.8-62.5-226.3 0L125.7 160z"}}]})(e)}function Foe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M0 256L28.5 28c2-16 15.6-28 31.8-28H228.9c15 0 27.1 12.1 27.1 27.1c0 3.2-.6 6.5-1.7 9.5L208 160H347.3c20.2 0 36.7 16.4 36.7 36.7c0 7.4-2.2 14.6-6.4 20.7l-192.2 281c-5.9 8.6-15.6 13.7-25.9 13.7h-2.9c-15.7 0-28.5-12.8-28.5-28.5c0-2.3 .3-4.6 .9-6.9L176 288H32c-17.7 0-32-14.3-32-32z"}}]})(e)}function Boe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"}}]})(e)}function j2(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M418.4 157.9c35.3-8.3 61.6-40 61.6-77.9c0-44.2-35.8-80-80-80c-43.4 0-78.7 34.5-80 77.5L136.2 151.1C121.7 136.8 101.9 128 80 128c-44.2 0-80 35.8-80 80s35.8 80 80 80c12.2 0 23.8-2.7 34.1-7.6L259.7 407.8c-2.4 7.6-3.7 15.8-3.7 24.2c0 44.2 35.8 80 80 80s80-35.8 80-80c0-27.7-14-52.1-35.4-66.4l37.8-207.7zM156.3 232.2c2.2-6.9 3.5-14.2 3.7-21.7l183.8-73.5c3.6 3.5 7.4 6.7 11.6 9.5L317.6 354.1c-5.5 1.3-10.8 3.1-15.8 5.5L156.3 232.2z"}}]})(e)}function Hoe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"}}]})(e)}function Woe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM136 184c-13.3 0-24 10.7-24 24s10.7 24 24 24H280c13.3 0 24-10.7 24-24s-10.7-24-24-24H136z"}}]})(e)}function Voe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM184 296c0 13.3 10.7 24 24 24s24-10.7 24-24V232h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H232V120c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H120c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"}}]})(e)}function Uoe(e){return Qe({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 Goe(e){return Qe({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 qoe(e){return Qe({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 _2(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}}]})(e)}function I2(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}}]})(e)}function y8(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3zm7 14.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z"}}]})(e)}function Koe(e,t,n){var r=this,o=l.useRef(null),s=l.useRef(0),i=l.useRef(null),c=l.useRef([]),d=l.useRef(),p=l.useRef(),h=l.useRef(e),m=l.useRef(!0);l.useEffect(function(){h.current=e},[e]);var g=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var b=!!(n=n||{}).leading,y=!("trailing"in n)||!!n.trailing,x="maxWait"in n,C=x?Math.max(+n.maxWait||0,t):null;l.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var S=l.useMemo(function(){var j=function(A){var D=c.current,O=d.current;return c.current=d.current=null,s.current=A,p.current=h.current.apply(O,D)},_=function(A,D){g&&cancelAnimationFrame(i.current),i.current=g?requestAnimationFrame(A):setTimeout(A,D)},I=function(A){if(!m.current)return!1;var D=A-o.current;return!o.current||D>=t||D<0||x&&A-s.current>=C},P=function(A){return i.current=null,y&&c.current?j(A):(c.current=d.current=null,p.current)},M=function A(){var D=Date.now();if(I(D))return P(D);if(m.current){var O=t-(D-o.current),T=x?Math.min(O,C-(D-s.current)):O;_(A,T)}},R=function(){var A=Date.now(),D=I(A);if(c.current=[].slice.call(arguments),d.current=r,o.current=A,D){if(!i.current&&m.current)return s.current=o.current,_(M,t),b?j(o.current):p.current;if(x)return _(M,t),j(o.current)}return i.current||_(M,t),p.current};return R.cancel=function(){i.current&&(g?cancelAnimationFrame(i.current):clearTimeout(i.current)),s.current=0,c.current=o.current=d.current=i.current=null},R.isPending=function(){return!!i.current},R.flush=function(){return i.current?P(Date.now()):p.current},R},[b,x,t,C,y,g]);return S}function Qoe(e,t){return e===t}function v_(e){return typeof e=="function"?function(){return e}:e}function P2(e,t,n){var r,o,s=n&&n.equalityFn||Qoe,i=(r=l.useState(v_(e)),o=r[1],[r[0],l.useCallback(function(m){return o(v_(m))},[])]),c=i[0],d=i[1],p=Koe(l.useCallback(function(m){return d(m)},[d]),t,n),h=l.useRef(e);return s(h.current,e)||(p(e),h.current=e),[c,p]}const E2=e=>{const t=H(s=>s.config.metadataFetchDebounce),[n]=P2(e,t??0),{data:r,isLoading:o}=VI(n??UI);return{metadata:r,isLoading:o}},Xoe=s7.injectEndpoints({endpoints:e=>({getWorkflow:e.query({query:t=>`workflows/i/${t}`,providesTags:(t,n,r)=>[{type:"Workflow",id:r}],transformResponse:t=>{if(t){const n=GI.safeParse(t);if(n.success)return n.data;Ci("images").warn("Problem parsing workflow")}}})})}),{useGetWorkflowQuery:Yoe}=Xoe,M2=e=>{const t=H(s=>s.config.workflowFetchDebounce),[n]=P2(e,t??0),{data:r,isLoading:o}=Yoe(n??UI);return{workflow:r,isLoading:o}};Ex("gallery/requestedBoardImagesDeletion");const Joe=Ex("gallery/sentImageToCanvas"),C8=Ex("gallery/sentImageToImg2Img"),Zoe=e=>{const{imageDTO:t}=e,n=oe(),{t:r}=J(),o=Zl(),s=jn("unifiedCanvas").isFeatureEnabled,i=Bg(Mx),{metadata:c,isLoading:d}=E2(t==null?void 0:t.image_name),{workflow:p,isLoading:h}=M2(t==null?void 0:t.workflow_id),[m]=Ox(),[g]=Rx(),{isClipboardAPIAvailable:b,copyImageToClipboard:y}=x8(),x=l.useCallback(()=>{t&&n(lg([t]))},[n,t]),{recallBothPrompts:C,recallSeed:S,recallAllParameters:j}=f0(),_=l.useCallback(()=>{C(c==null?void 0:c.positive_prompt,c==null?void 0:c.negative_prompt,c==null?void 0:c.positive_style_prompt,c==null?void 0:c.negative_style_prompt)},[c==null?void 0:c.negative_prompt,c==null?void 0:c.positive_prompt,c==null?void 0:c.positive_style_prompt,c==null?void 0:c.negative_style_prompt,C]),I=l.useCallback(()=>{S(c==null?void 0:c.seed)},[c==null?void 0:c.seed,S]),P=l.useCallback(()=>{p&&n(Ax(p))},[n,p]),M=l.useCallback(()=>{n(C8()),n(ig(t))},[n,t]),R=l.useCallback(()=>{n(Joe()),rs.flushSync(()=>{n(ti("unifiedCanvas"))}),n(qI(t)),o({title:r("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},[n,t,r,o]),A=l.useCallback(()=>{j(c)},[c,j]),D=l.useCallback(()=>{n(KI([t])),n(Cx(!0))},[n,t]),O=l.useCallback(()=>{y(t.image_url)},[y,t.image_url]),T=l.useCallback(()=>{t&&m({imageDTOs:[t]})},[m,t]),Y=l.useCallback(()=>{t&&g({imageDTOs:[t]})},[g,t]);return a.jsxs(a.Fragment,{children:[a.jsx(Vn,{as:"a",href:t.image_url,target:"_blank",icon:a.jsx(Ky,{}),children:r("common.openInNewTab")}),b&&a.jsx(Vn,{icon:a.jsx(Hu,{}),onClickCapture:O,children:r("parameters.copyImage")}),a.jsx(Vn,{as:"a",download:!0,href:t.image_url,target:"_blank",icon:a.jsx(Wu,{}),w:"100%",children:r("parameters.downloadImage")}),a.jsx(Vn,{icon:h?a.jsx(vh,{}):a.jsx(j2,{}),onClickCapture:P,isDisabled:h||!p,children:r("nodes.loadWorkflow")}),a.jsx(Vn,{icon:d?a.jsx(vh,{}):a.jsx(XM,{}),onClickCapture:_,isDisabled:d||(c==null?void 0:c.positive_prompt)===void 0&&(c==null?void 0:c.negative_prompt)===void 0,children:r("parameters.usePrompt")}),a.jsx(Vn,{icon:d?a.jsx(vh,{}):a.jsx(YM,{}),onClickCapture:I,isDisabled:d||(c==null?void 0:c.seed)===void 0,children:r("parameters.useSeed")}),a.jsx(Vn,{icon:d?a.jsx(vh,{}):a.jsx(FM,{}),onClickCapture:A,isDisabled:d||!c,children:r("parameters.useAll")}),a.jsx(Vn,{icon:a.jsx(yj,{}),onClickCapture:M,id:"send-to-img2img",children:r("parameters.sendToImg2Img")}),s&&a.jsx(Vn,{icon:a.jsx(yj,{}),onClickCapture:R,id:"send-to-canvas",children:r("parameters.sendToUnifiedCanvas")}),a.jsx(Vn,{icon:a.jsx(UM,{}),onClickCapture:D,children:"Change Board"}),t.starred?a.jsx(Vn,{icon:i?i.off.icon:a.jsx(I2,{}),onClickCapture:Y,children:i?i.off.text:"Unstar Image"}):a.jsx(Vn,{icon:i?i.on.icon:a.jsx(_2,{}),onClickCapture:T,children:i?i.on.text:"Star Image"}),a.jsx(Vn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(qo,{}),onClickCapture:x,children:r("gallery.deleteImage")})]})},w8=l.memo(Zoe),vh=()=>a.jsx(N,{w:"14px",alignItems:"center",justifyContent:"center",children:a.jsx(bi,{size:"xs"})}),ese=()=>{const{t:e}=J(),t=oe(),n=H(x=>x.gallery.selection),r=Bg(Mx),o=jn("bulkDownload").isFeatureEnabled,[s]=Ox(),[i]=Rx(),[c]=TI(),d=l.useCallback(()=>{t(KI(n)),t(Cx(!0))},[t,n]),p=l.useCallback(()=>{t(lg(n))},[t,n]),h=l.useCallback(()=>{s({imageDTOs:n})},[s,n]),m=l.useCallback(()=>{i({imageDTOs:n})},[i,n]),g=l.useCallback(async()=>{try{const x=await c({image_names:n.map(C=>C.image_name)}).unwrap();t(Bt({title:e("gallery.preparingDownload"),status:"success",...x.response?{description:x.response}:{}}))}catch{t(Bt({title:e("gallery.preparingDownloadFailed"),status:"error"}))}},[e,n,c,t]),b=l.useMemo(()=>n.every(x=>x.starred),[n]),y=l.useMemo(()=>n.every(x=>!x.starred),[n]);return a.jsxs(a.Fragment,{children:[b&&a.jsx(Vn,{icon:r?r.on.icon:a.jsx(_2,{}),onClickCapture:m,children:r?r.off.text:"Unstar All"}),(y||!b&&!y)&&a.jsx(Vn,{icon:r?r.on.icon:a.jsx(I2,{}),onClickCapture:h,children:r?r.on.text:"Star All"}),o&&a.jsx(Vn,{icon:a.jsx(Wu,{}),onClickCapture:g,children:e("gallery.downloadSelection")}),a.jsx(Vn,{icon:a.jsx(UM,{}),onClickCapture:d,children:"Change Board"}),a.jsx(Vn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(qo,{}),onClickCapture:p,children:"Delete Selection"})]})},tse=l.memo(ese),nse=de([Ce],({gallery:e})=>({selectionCount:e.selection.length}),_e),rse=({imageDTO:e,children:t})=>{const{selectionCount:n}=H(nse),r=l.useCallback(s=>{s.preventDefault()},[]),o=l.useCallback(()=>e?n>1?a.jsx(Gl,{sx:{visibility:"visible !important"},motionProps:pu,onContextMenu:r,children:a.jsx(tse,{})}):a.jsx(Gl,{sx:{visibility:"visible !important"},motionProps:pu,onContextMenu:r,children:a.jsx(w8,{imageDTO:e})}):null,[e,n,r]);return a.jsx(p2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:o,children:t})},ose=l.memo(rse),sse=e=>{const{data:t,disabled:n,...r}=e,o=l.useRef(Jc()),{attributes:s,listeners:i,setNodeRef:c}=Mne({id:o.current,disabled:n,data:t});return a.jsx(Te,{ref:c,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,...s,...i,...r})},ase=l.memo(sse),ise=a.jsx(zr,{as:Jg,sx:{boxSize:16}}),lse=a.jsx(qr,{icon:Ql}),cse=e=>{const{imageDTO:t,onError:n,onClick:r,withMetadataOverlay:o=!1,isDropDisabled:s=!1,isDragDisabled:i=!1,isUploadDisabled:c=!1,minSize:d=24,postUploadAction:p,imageSx:h,fitContainer:m=!1,droppableData:g,draggableData:b,dropLabel:y,isSelected:x=!1,thumbnail:C=!1,noContentFallback:S=lse,uploadElement:j=ise,useThumbailFallback:_,withHoverOverlay:I=!1,children:P,onMouseOver:M,onMouseOut:R,dataTestId:A}=e,{colorMode:D}=wi(),[O,T]=l.useState(!1),Y=l.useCallback(L=>{M&&M(L),T(!0)},[M]),z=l.useCallback(L=>{R&&R(L),T(!1)},[R]),{getUploadButtonProps:W,getUploadInputProps:Q}=k2({postUploadAction:p,isDisabled:c}),U=c?{}:{cursor:"pointer",bg:Ke("base.200","base.700")(D),_hover:{bg:Ke("base.300","base.650")(D),color:Ke("base.500","base.300")(D)}};return a.jsx(ose,{imageDTO:t,children:L=>a.jsxs(N,{ref:L,onMouseOver:Y,onMouseOut:z,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative",minW:d||void 0,minH:d||void 0,userSelect:"none",cursor:i||!t?"default":"pointer"},children:[t&&a.jsxs(N,{sx:{w:"full",h:"full",position:m?"absolute":"relative",alignItems:"center",justifyContent:"center"},children:[a.jsx(Si,{src:C?t.thumbnail_url:t.image_url,fallbackStrategy:"beforeLoadOrError",fallbackSrc:_?t.thumbnail_url:void 0,fallback:_?void 0:a.jsx(sre,{image:t}),onError:n,draggable:!1,sx:{w:t.width,objectFit:"contain",maxW:"full",maxH:"full",borderRadius:"base",...h},"data-testid":A}),o&&a.jsx(Noe,{imageDTO:t}),a.jsx(f2,{isSelected:x,isHovered:I?O:!1})]}),!t&&!c&&a.jsx(a.Fragment,{children:a.jsxs(N,{sx:{minH:d,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",transitionProperty:"common",transitionDuration:"0.1s",color:Ke("base.500","base.500")(D),...U},...W(),children:[a.jsx("input",{...Q()}),j]})}),!t&&c&&S,t&&!i&&a.jsx(ase,{data:b,disabled:i||!t,onClick:r}),P,!s&&a.jsx(d2,{data:g,disabled:s,dropLabel:y})]})})},il=l.memo(cse),use=()=>a.jsx(Dg,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full"}})}),dse=l.memo(use),fse=de([Ce,Dx],({gallery:e},t)=>{const n=e.selection;return{queryArgs:t,selection:n}},_e),pse=e=>{const t=oe(),{queryArgs:n,selection:r}=H(fse),{imageDTOs:o}=QI(n,{selectFromResult:p=>({imageDTOs:p.data?a7.selectAll(p.data):[]})}),s=jn("multiselect").isFeatureEnabled,i=l.useCallback(p=>{var h;if(e){if(!s){t(md([e]));return}if(p.shiftKey){const m=e.image_name,g=(h=r[r.length-1])==null?void 0:h.image_name,b=o.findIndex(x=>x.image_name===g),y=o.findIndex(x=>x.image_name===m);if(b>-1&&y>-1){const x=Math.min(b,y),C=Math.max(b,y),S=o.slice(x,C+1);t(md(r.concat(S)))}}else p.ctrlKey||p.metaKey?r.some(m=>m.image_name===e.image_name)&&r.length>1?t(md(r.filter(m=>m.image_name!==e.image_name))):t(md(r.concat(e))):t(md([e]))}},[t,e,o,r,s]),c=l.useMemo(()=>e?r.some(p=>p.image_name===e.image_name):!1,[e,r]),d=l.useMemo(()=>r.length,[r.length]);return{selection:r,selectionCount:d,isSelected:c,handleClick:i}},hse=e=>{const{onClick:t,tooltip:n,icon:r,styleOverrides:o}=e,s=di("drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-600))","drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-800))");return a.jsx(tt,{onClick:t,"aria-label":n,tooltip:n,icon:r,size:"sm",variant:"link",sx:{position:"absolute",top:1,insetInlineEnd:1,p:0,minW:0,svg:{transitionProperty:"common",transitionDuration:"normal",fill:"base.100",_hover:{fill:"base.50"},filter:s},...o},"data-testid":n})},fu=l.memo(hse),mse=e=>{const t=oe(),{imageName:n}=e,{currentData:r}=Ps(n),o=H(M=>M.hotkeys.shift),{t:s}=J(),{handleClick:i,isSelected:c,selection:d,selectionCount:p}=pse(r),h=Bg(Mx),m=l.useCallback(M=>{M.stopPropagation(),r&&t(lg([r]))},[t,r]),g=l.useMemo(()=>{if(p>1)return{id:"gallery-image",payloadType:"IMAGE_DTOS",payload:{imageDTOs:d}};if(r)return{id:"gallery-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r,d,p]),[b]=Ox(),[y]=Rx(),x=l.useCallback(()=>{r&&(r.starred&&y({imageDTOs:[r]}),r.starred||b({imageDTOs:[r]}))},[b,y,r]),[C,S]=l.useState(!1),j=l.useCallback(()=>{S(!0)},[]),_=l.useCallback(()=>{S(!1)},[]),I=l.useMemo(()=>{if(r!=null&&r.starred)return h?h.on.icon:a.jsx(I2,{size:"20"});if(!(r!=null&&r.starred)&&C)return h?h.off.icon:a.jsx(_2,{size:"20"})},[r==null?void 0:r.starred,C,h]),P=l.useMemo(()=>r!=null&&r.starred?h?h.off.text:"Unstar":r!=null&&r.starred?"":h?h.on.text:"Star",[r==null?void 0:r.starred,h]);return r?a.jsx(Te,{sx:{w:"full",h:"full",touchAction:"none"},"data-testid":`image-${r.image_name}`,children:a.jsx(N,{userSelect:"none",sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:a.jsx(il,{onClick:i,imageDTO:r,draggableData:g,isSelected:c,minSize:0,imageSx:{w:"full",h:"full"},isDropDisabled:!0,isUploadDisabled:!0,thumbnail:!0,withHoverOverlay:!0,onMouseOver:j,onMouseOut:_,children:a.jsxs(a.Fragment,{children:[a.jsx(fu,{onClick:x,icon:I,tooltip:P}),C&&o&&a.jsx(fu,{onClick:m,icon:a.jsx(qo,{}),tooltip:s("gallery.deleteImage"),styleOverrides:{bottom:2,top:"auto"}})]})})})}):a.jsx(dse,{})},gse=l.memo(mse),vse=Oe((e,t)=>a.jsx(Te,{className:"item-container",ref:t,p:1.5,"data-testid":"image-item-container",children:e.children})),bse=l.memo(vse),xse=Oe((e,t)=>{const n=H(r=>r.gallery.galleryImageMinimumWidth);return a.jsx(nl,{...e,className:"list-container",ref:t,sx:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr));`},"data-testid":"image-list-container",children:e.children})}),yse=l.memo(xse),Cse={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},wse=()=>{const{t:e}=J(),t=l.useRef(null),[n,r]=l.useState(null),[o,s]=u2(Cse),i=H(S=>S.gallery.selectedBoardId),{currentViewTotal:c}=Doe(i),d=H(Dx),{currentData:p,isFetching:h,isSuccess:m,isError:g}=QI(d),[b]=XI(),y=l.useMemo(()=>!p||!c?!1:p.ids.length{y&&b({...d,offset:(p==null?void 0:p.ids.length)??0,limit:YI})},[y,b,d,p==null?void 0:p.ids.length]),C=l.useCallback((S,j)=>a.jsx(gse,{imageName:j},j),[]);return l.useEffect(()=>{const{current:S}=t;return n&&S&&o({target:S,elements:{viewport:n}}),()=>{var j;return(j=s())==null?void 0:j.destroy()}},[n,o,s]),p?m&&(p==null?void 0:p.ids.length)===0?a.jsx(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(qr,{label:e("gallery.noImagesInGallery"),icon:Ql})}):m&&p?a.jsxs(a.Fragment,{children:[a.jsx(Te,{ref:t,"data-overlayscrollbars":"",h:"100%",children:a.jsx(Aoe,{style:{height:"100%"},data:p.ids,endReached:x,components:{Item:bse,List:yse},scrollerRef:r,itemContent:C})}),a.jsx(Rt,{onClick:x,isDisabled:!y,isLoading:h,loadingText:e("gallery.loading"),flexShrink:0,children:`Load More (${p.ids.length} of ${c})`})]}):g?a.jsx(Te,{sx:{w:"full",h:"full"},children:a.jsx(qr,{label:e("gallery.unableToLoad"),icon:oee})}):null:a.jsx(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(qr,{label:e("gallery.loading"),icon:Ql})})},Sse=l.memo(wse),kse=de([Ce],e=>{const{galleryView:t}=e.gallery;return{galleryView:t}},_e),jse=()=>{const{t:e}=J(),t=l.useRef(null),n=l.useRef(null),{galleryView:r}=H(kse),o=oe(),{isOpen:s,onToggle:i}=ls({defaultIsOpen:!0}),c=l.useCallback(()=>{o(Uw("images"))},[o]),d=l.useCallback(()=>{o(Uw("assets"))},[o]);return a.jsxs(U5,{layerStyle:"first",sx:{flexDirection:"column",h:"full",w:"full",borderRadius:"base",p:2},children:[a.jsxs(Te,{sx:{w:"full"},children:[a.jsxs(N,{ref:t,sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[a.jsx(Qne,{isOpen:s,onToggle:i}),a.jsx(ore,{})]}),a.jsx(Te,{children:a.jsx(Gne,{isOpen:s})})]}),a.jsxs(N,{ref:n,direction:"column",gap:2,h:"full",w:"full",children:[a.jsx(N,{sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:a.jsx(tc,{index:r==="images"?0:1,variant:"unstyled",size:"sm",sx:{w:"full"},children:a.jsx(nc,{children:a.jsxs(zn,{isAttached:!0,sx:{w:"full"},children:[a.jsx(xo,{as:Rt,size:"sm",isChecked:r==="images",onClick:c,sx:{w:"full"},leftIcon:a.jsx(fee,{}),"data-testid":"images-tab",children:e("gallery.images")}),a.jsx(xo,{as:Rt,size:"sm",isChecked:r==="assets",onClick:d,sx:{w:"full"},leftIcon:a.jsx(kee,{}),"data-testid":"assets-tab",children:e("gallery.assets")})]})})})}),a.jsx(Sse,{})]})]})},_se=l.memo(jse),Ise=()=>{const e=H(p=>p.system.isConnected),{data:t}=Fa(),[n,{isLoading:r}]=Tx(),o=oe(),{t:s}=J(),i=l.useMemo(()=>t==null?void 0:t.queue.item_id,[t==null?void 0:t.queue.item_id]),c=l.useCallback(async()=>{if(i)try{await n(i).unwrap(),o(Bt({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(Bt({title:s("queue.cancelFailed"),status:"error"}))}},[i,o,s,n]),d=l.useMemo(()=>!e||oi(i),[e,i]);return{cancelQueueItem:c,isLoading:r,currentQueueItemId:i,isDisabled:d}},Pse=({label:e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,asIconButton:i,isLoading:c,loadingText:d,sx:p})=>i?a.jsx(tt,{"aria-label":e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:c,sx:p,"data-testid":e}):a.jsx(Rt,{"aria-label":e,tooltip:t,leftIcon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:c,loadingText:d??e,flexGrow:1,sx:p,"data-testid":e,children:e}),ic=l.memo(Pse),Ese=({asIconButton:e,sx:t})=>{const{t:n}=J(),{cancelQueueItem:r,isLoading:o,isDisabled:s}=Ise();return a.jsx(ic,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.cancel"),tooltip:n("queue.cancelTooltip"),icon:a.jsx(ju,{}),onClick:r,colorScheme:"error",sx:t})},S8=l.memo(Ese),Mse=()=>{const{t:e}=J(),t=oe(),{data:n}=Fa(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=JI({fixedCacheKey:"clearQueue"}),i=l.useCallback(async()=>{if(n!=null&&n.queue.total)try{await o().unwrap(),t(Bt({title:e("queue.clearSucceeded"),status:"success"})),t(Nx(void 0)),t($x(void 0))}catch{t(Bt({title:e("queue.clearFailed"),status:"error"}))}},[n==null?void 0:n.queue.total,o,t,e]),c=l.useMemo(()=>!r||!(n!=null&&n.queue.total),[r,n==null?void 0:n.queue.total]);return{clearQueue:i,isLoading:s,queueStatus:n,isDisabled:c}},Ose=Oe((e,t)=>{const{t:n}=J(),{acceptButtonText:r=n("common.accept"),acceptCallback:o,cancelButtonText:s=n("common.cancel"),cancelCallback:i,children:c,title:d,triggerComponent:p}=e,{isOpen:h,onOpen:m,onClose:g}=ls(),b=l.useRef(null),y=l.useCallback(()=>{o(),g()},[o,g]),x=l.useCallback(()=>{i&&i(),g()},[i,g]);return a.jsxs(a.Fragment,{children:[l.cloneElement(p,{onClick:m,ref:t}),a.jsx(Df,{isOpen:h,leastDestructiveRef:b,onClose:g,isCentered:!0,children:a.jsx(Ma,{children:a.jsxs(Tf,{children:[a.jsx(Ea,{fontSize:"lg",fontWeight:"bold",children:d}),a.jsx(Oa,{children:c}),a.jsxs(pi,{children:[a.jsx(Rt,{ref:b,onClick:x,children:s}),a.jsx(Rt,{colorScheme:"error",onClick:y,ml:3,children:r})]})]})})})]})}),p0=l.memo(Ose),Rse=({asIconButton:e,sx:t})=>{const{t:n}=J(),{clearQueue:r,isLoading:o,isDisabled:s}=Mse();return a.jsxs(p0,{title:n("queue.clearTooltip"),acceptCallback:r,acceptButtonText:n("queue.clear"),triggerComponent:a.jsx(ic,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.clear"),tooltip:n("queue.clearTooltip"),icon:a.jsx(qo,{}),colorScheme:"error",sx:t}),children:[a.jsx(Se,{children:n("queue.clearQueueAlertDialog")}),a.jsx("br",{}),a.jsx(Se,{children:n("queue.clearQueueAlertDialog2")})]})},O2=l.memo(Rse),Ase=()=>{const e=oe(),{t}=J(),n=H(p=>p.system.isConnected),{data:r}=Fa(),[o,{isLoading:s}]=ZI({fixedCacheKey:"pauseProcessor"}),i=l.useMemo(()=>!!(r!=null&&r.processor.is_started),[r==null?void 0:r.processor.is_started]),c=l.useCallback(async()=>{if(i)try{await o().unwrap(),e(Bt({title:t("queue.pauseSucceeded"),status:"success"}))}catch{e(Bt({title:t("queue.pauseFailed"),status:"error"}))}},[i,o,e,t]),d=l.useMemo(()=>!n||!i,[n,i]);return{pauseProcessor:c,isLoading:s,isStarted:i,isDisabled:d}},Dse=({asIconButton:e})=>{const{t}=J(),{pauseProcessor:n,isLoading:r,isDisabled:o}=Ase();return a.jsx(ic,{asIconButton:e,label:t("queue.pause"),tooltip:t("queue.pauseTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(bee,{}),onClick:n,colorScheme:"gold"})},k8=l.memo(Dse),Tse=de([Ce,ro],({controlAdapters:e,generation:t,system:n,nodes:r,dynamicPrompts:o},s)=>{const{initialImage:i,model:c}=t,{isConnected:d}=n,p=[];return d||p.push(on.t("parameters.invoke.systemDisconnected")),s==="img2img"&&!i&&p.push(on.t("parameters.invoke.noInitialImageSelected")),s==="nodes"?r.shouldValidateGraph&&(r.nodes.length||p.push(on.t("parameters.invoke.noNodesInGraph")),r.nodes.forEach(h=>{if(!Rr(h))return;const m=r.nodeTemplates[h.data.type];if(!m){p.push(on.t("parameters.invoke.missingNodeTemplate"));return}const g=i7([h],r.edges);Kr(h.data.inputs,b=>{const y=m.inputs[b.name],x=g.some(C=>C.target===h.id&&C.targetHandle===b.name);if(!y){p.push(on.t("parameters.invoke.missingFieldTemplate"));return}if(y.required&&b.value===void 0&&!x){p.push(on.t("parameters.invoke.missingInputForField",{nodeLabel:h.data.label||m.title,fieldLabel:b.label||y.title}));return}})})):(o.prompts.length===0&&p.push(on.t("parameters.invoke.noPrompts")),c||p.push(on.t("parameters.invoke.noModelSelected")),l7(e).forEach((h,m)=>{h.isEnabled&&(h.model?h.model.base_model!==(c==null?void 0:c.base_model)&&p.push(on.t("parameters.invoke.incompatibleBaseModelForControlAdapter",{number:m+1})):p.push(on.t("parameters.invoke.noModelForControlAdapter",{number:m+1})),(!h.controlImage||Au(h)&&!h.processedControlImage&&h.processorType!=="none")&&p.push(on.t("parameters.invoke.noControlImageForControlAdapter",{number:m+1})))})),{isReady:!p.length,reasons:p}},_e),R2=()=>{const{isReady:e,reasons:t}=H(Tse);return{isReady:e,reasons:t}},j8=()=>{const e=oe(),t=H(ro),{isReady:n}=R2(),[r,{isLoading:o}]=cg({fixedCacheKey:"enqueueBatch"}),s=l.useMemo(()=>!n,[n]);return{queueBack:l.useCallback(()=>{s||(e(Lx()),e(eP({tabName:t,prepend:!1})))},[e,s,t]),isLoading:o,isDisabled:s}},Nse=de([Ce],({gallery:e})=>{const{autoAddBoardId:t}=e;return{autoAddBoardId:t}},_e),$se=({prepend:e=!1})=>{const{t}=J(),{isReady:n,reasons:r}=R2(),{autoAddBoardId:o}=H(Nse),s=a0(o),[i,{isLoading:c}]=cg({fixedCacheKey:"enqueueBatch"}),d=l.useMemo(()=>t(c?"queue.enqueueing":n?e?"queue.queueFront":"queue.queueBack":"queue.notReady"),[c,n,e,t]);return a.jsxs(N,{flexDir:"column",gap:1,children:[a.jsx(Se,{fontWeight:600,children:d}),r.length>0&&a.jsx(Mf,{children:r.map((p,h)=>a.jsx(ws,{children:a.jsx(Se,{fontWeight:400,children:p})},`${p}.${h}`))}),a.jsx(I8,{}),a.jsxs(Se,{fontWeight:400,fontStyle:"oblique 10deg",children:[t("parameters.invoke.addingImagesTo")," ",a.jsx(Se,{as:"span",fontWeight:600,children:s||t("boards.uncategorized")})]})]})},_8=l.memo($se),I8=l.memo(()=>a.jsx(no,{opacity:.2,borderColor:"base.50",_dark:{borderColor:"base.900"}}));I8.displayName="StyledDivider";const Lse=()=>a.jsx(Te,{pos:"relative",w:4,h:4,children:a.jsx(Si,{src:wx,alt:"invoke-ai-logo",pos:"absolute",top:-.5,insetInlineStart:-.5,w:5,h:5,minW:5,minH:5,filter:"saturate(0)"})}),zse=l.memo(Lse),Fse=({asIconButton:e,sx:t})=>{const{t:n}=J(),{queueBack:r,isLoading:o,isDisabled:s}=j8();return a.jsx(ic,{asIconButton:e,colorScheme:"accent",label:n("parameters.invoke.invoke"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(_8,{}),sx:t,icon:e?a.jsx(zse,{}):void 0})},P8=l.memo(Fse),E8=()=>{const e=oe(),t=H(ro),{isReady:n}=R2(),[r,{isLoading:o}]=cg({fixedCacheKey:"enqueueBatch"}),s=jn("prependQueue").isFeatureEnabled,i=l.useMemo(()=>!n||!s,[n,s]);return{queueFront:l.useCallback(()=>{i||(e(Lx()),e(eP({tabName:t,prepend:!0})))},[e,i,t]),isLoading:o,isDisabled:i}},Bse=({asIconButton:e,sx:t})=>{const{t:n}=J(),{queueFront:r,isLoading:o,isDisabled:s}=E8();return a.jsx(ic,{asIconButton:e,colorScheme:"base",label:n("queue.queueFront"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(_8,{prepend:!0}),icon:a.jsx(Foe,{}),sx:t})},Hse=l.memo(Bse),Wse=()=>{const e=oe(),t=H(p=>p.system.isConnected),{data:n}=Fa(),{t:r}=J(),[o,{isLoading:s}]=tP({fixedCacheKey:"resumeProcessor"}),i=l.useMemo(()=>!!(n!=null&&n.processor.is_started),[n==null?void 0:n.processor.is_started]),c=l.useCallback(async()=>{if(!i)try{await o().unwrap(),e(Bt({title:r("queue.resumeSucceeded"),status:"success"}))}catch{e(Bt({title:r("queue.resumeFailed"),status:"error"}))}},[i,o,e,r]),d=l.useMemo(()=>!t||i,[t,i]);return{resumeProcessor:c,isLoading:s,isStarted:i,isDisabled:d}},Vse=({asIconButton:e})=>{const{t}=J(),{resumeProcessor:n,isLoading:r,isDisabled:o}=Wse();return a.jsx(ic,{asIconButton:e,label:t("queue.resume"),tooltip:t("queue.resumeTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(xee,{}),onClick:n,colorScheme:"green"})},M8=l.memo(Vse),Use=de(Ce,({system:e})=>{var t;return{isConnected:e.isConnected,hasSteps:!!e.denoiseProgress,value:(((t=e.denoiseProgress)==null?void 0:t.percentage)??0)*100}},_e),Gse=()=>{const{t:e}=J(),{data:t}=Fa(),{hasSteps:n,value:r,isConnected:o}=H(Use);return a.jsx(k3,{value:r,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:o&&!!(t!=null&&t.queue.in_progress)&&!n,h:"full",w:"full",borderRadius:2,colorScheme:"accent"})},qse=l.memo(Gse),Kse=()=>{const e=jn("pauseQueue").isFeatureEnabled,t=jn("resumeQueue").isFeatureEnabled,n=jn("prependQueue").isFeatureEnabled;return a.jsxs(N,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,gap:2,flexDir:"column"},children:[a.jsxs(N,{gap:2,w:"full",children:[a.jsxs(zn,{isAttached:!0,flexGrow:2,children:[a.jsx(P8,{}),n?a.jsx(Hse,{asIconButton:!0}):a.jsx(a.Fragment,{}),a.jsx(S8,{asIconButton:!0})]}),a.jsxs(zn,{isAttached:!0,children:[t?a.jsx(M8,{asIconButton:!0}):a.jsx(a.Fragment,{}),e?a.jsx(k8,{asIconButton:!0}):a.jsx(a.Fragment,{})]}),a.jsx(O2,{asIconButton:!0})]}),a.jsx(N,{h:3,w:"full",children:a.jsx(qse,{})}),a.jsx(R8,{})]})},O8=l.memo(Kse),R8=l.memo(()=>{const{t:e}=J(),t=oe(),{hasItems:n,pending:r}=Fa(void 0,{selectFromResult:({data:s})=>{if(!s)return{hasItems:!1,pending:0};const{pending:i,in_progress:c}=s.queue;return{hasItems:i+c>0,pending:i}}}),o=l.useCallback(()=>{t(ti("queue"))},[t]);return a.jsxs(N,{justifyContent:"space-between",alignItems:"center",pe:1,"data-testid":"queue-count",children:[a.jsx(ji,{}),a.jsx(tl,{onClick:o,size:"sm",variant:"link",fontWeight:400,opacity:.7,fontStyle:"oblique 10deg",children:n?e("queue.queuedCount",{pending:r}):e("queue.queueEmpty")})]})});R8.displayName="QueueCounts";const{createElement:Iu,createContext:Qse,forwardRef:A8,useCallback:Ja,useContext:D8,useEffect:ui,useImperativeHandle:T8,useLayoutEffect:Xse,useMemo:Yse,useRef:ns,useState:Fd}=yx,b_=yx["useId".toString()],Bd=Xse,Jse=typeof b_=="function"?b_:()=>null;let Zse=0;function A2(e=null){const t=Jse(),n=ns(e||t||null);return n.current===null&&(n.current=""+Zse++),n.current}const h0=Qse(null);h0.displayName="PanelGroupContext";function N8({children:e=null,className:t="",collapsedSize:n=0,collapsible:r=!1,defaultSize:o=null,forwardedRef:s,id:i=null,maxSize:c=null,minSize:d,onCollapse:p=null,onResize:h=null,order:m=null,style:g={},tagName:b="div"}){const y=D8(h0);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const x=A2(i),{collapsePanel:C,expandPanel:S,getPanelSize:j,getPanelStyle:_,registerPanel:I,resizePanel:P,units:M,unregisterPanel:R}=y;d==null&&(M==="percentages"?d=10:d=0);const A=ns({onCollapse:p,onResize:h});ui(()=>{A.current.onCollapse=p,A.current.onResize=h});const D=_(x,o),O=ns({size:x_(D)}),T=ns({callbacksRef:A,collapsedSize:n,collapsible:r,defaultSize:o,id:x,idWasAutoGenerated:i==null,maxSize:c,minSize:d,order:m});return Bd(()=>{O.current.size=x_(D),T.current.callbacksRef=A,T.current.collapsedSize=n,T.current.collapsible=r,T.current.defaultSize=o,T.current.id=x,T.current.idWasAutoGenerated=i==null,T.current.maxSize=c,T.current.minSize=d,T.current.order=m}),Bd(()=>(I(x,T),()=>{R(x)}),[m,x,I,R]),T8(s,()=>({collapse:()=>C(x),expand:()=>S(x),getCollapsed(){return O.current.size===0},getId(){return x},getSize(Y){return j(x,Y)},resize:(Y,z)=>P(x,Y,z)}),[C,S,j,x,P]),Iu(b,{children:e,className:t,"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-id":x,"data-panel-size":parseFloat(""+D.flexGrow).toFixed(1),id:`data-panel-id-${x}`,style:{...D,...g}})}const Zi=A8((e,t)=>Iu(N8,{...e,forwardedRef:t}));N8.displayName="Panel";Zi.displayName="forwardRef(Panel)";function x_(e){const{flexGrow:t}=e;return typeof t=="string"?parseFloat(t):t}const Jl=10;function Ed(e,t,n,r,o,s,i,c){const{id:d,panels:p,units:h}=t,m=h==="pixels"?Vi(d):NaN,{sizes:g}=c||{},b=g||s,y=Fo(p),x=b.concat();let C=0;{const _=o<0?r:n,I=y.findIndex(A=>A.current.id===_),P=y[I],M=b[I],R=ex(h,m,P,M,M+Math.abs(o),e);if(M===R)return b;R===0&&M>0&&i.set(_,M),o=o<0?M-R:R-M}let S=o<0?n:r,j=y.findIndex(_=>_.current.id===S);for(;;){const _=y[j],I=b[j],P=Math.abs(o)-Math.abs(C),M=ex(h,m,_,I,I-P,e);if(I!==M&&(M===0&&I>0&&i.set(_.current.id,I),C+=I-M,x[j]=M,C.toPrecision(Jl).localeCompare(Math.abs(o).toPrecision(Jl),void 0,{numeric:!0})>=0))break;if(o<0){if(--j<0)break}else if(++j>=y.length)break}return C===0?b:(S=o<0?r:n,j=y.findIndex(_=>_.current.id===S),x[j]=b[j]+C,x)}function Ac(e,t,n){t.forEach((r,o)=>{const s=e[o];if(!s)return;const{callbacksRef:i,collapsedSize:c,collapsible:d,id:p}=s.current,h=n[p];if(h!==r){n[p]=r;const{onCollapse:m,onResize:g}=i.current;g&&g(r,h),d&&m&&((h==null||h===c)&&r!==c?m(!1):h!==c&&r===c&&m(!0))}})}function eae({groupId:e,panels:t,units:n}){const r=n==="pixels"?Vi(e):NaN,o=Fo(t),s=Array(o.length);let i=0,c=100;for(let d=0;di.current.id===e);if(n<0)return[null,null];const r=n===t.length-1,o=r?t[n-1].current.id:e,s=r?e:t[n+1].current.id;return[o,s]}function Vi(e){const t=uf(e);if(t==null)return NaN;const n=t.getAttribute("data-panel-group-direction"),r=D2(e);return n==="horizontal"?t.offsetWidth-r.reduce((o,s)=>o+s.offsetWidth,0):t.offsetHeight-r.reduce((o,s)=>o+s.offsetHeight,0)}function $8(e,t,n){if(e.size===1)return"100";const o=Fo(e).findIndex(i=>i.current.id===t),s=n[o];return s==null?"0":s.toPrecision(Jl)}function tae(e){const t=document.querySelector(`[data-panel-id="${e}"]`);return t||null}function uf(e){const t=document.querySelector(`[data-panel-group-id="${e}"]`);return t||null}function m0(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function nae(e){return L8().findIndex(r=>r.getAttribute("data-panel-resize-handle-id")===e)??null}function L8(){return Array.from(document.querySelectorAll("[data-panel-resize-handle-id]"))}function D2(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function T2(e,t,n){var d,p,h,m;const r=m0(t),o=D2(e),s=r?o.indexOf(r):-1,i=((p=(d=n[s])==null?void 0:d.current)==null?void 0:p.id)??null,c=((m=(h=n[s+1])==null?void 0:h.current)==null?void 0:m.id)??null;return[i,c]}function Fo(e){return Array.from(e.values()).sort((t,n)=>{const r=t.current.order,o=n.current.order;return r==null&&o==null?0:r==null?-1:o==null?1:r-o})}function ex(e,t,n,r,o,s=null){var h;let{collapsedSize:i,collapsible:c,maxSize:d,minSize:p}=n.current;if(e==="pixels"&&(i=i/t*100,d!=null&&(d=d/t*100),p=p/t*100),c){if(r>i){if(o<=p/2+i)return i}else if(!((h=s==null?void 0:s.type)==null?void 0:h.startsWith("key"))&&o100)&&(t.current.minSize=0),o!=null&&(o<0||e==="percentages"&&o>100)&&(t.current.maxSize=null),r!==null&&(r<0||e==="percentages"&&r>100?t.current.defaultSize=null:ro&&(t.current.defaultSize=o))}function k1({groupId:e,panels:t,nextSizes:n,prevSizes:r,units:o}){n=[...n];const s=Fo(t),i=o==="pixels"?Vi(e):NaN;let c=0;for(let d=0;d{const{direction:i,panels:c}=e.current,d=uf(t);z8(d!=null,`No group found for id "${t}"`);const{height:p,width:h}=d.getBoundingClientRect(),g=D2(t).map(b=>{const y=b.getAttribute("data-panel-resize-handle-id"),x=Fo(c),[C,S]=T2(t,y,x);if(C==null||S==null)return()=>{};let j=0,_=100,I=0,P=0;x.forEach(T=>{const{id:Y,maxSize:z,minSize:W}=T.current;Y===C?(j=W,_=z??100):(I+=W,P+=z??100)});const M=Math.min(_,100-I),R=Math.max(j,(x.length-1)*100-P),A=$8(c,C,o);b.setAttribute("aria-valuemax",""+Math.round(M)),b.setAttribute("aria-valuemin",""+Math.round(R)),b.setAttribute("aria-valuenow",""+Math.round(parseInt(A)));const D=T=>{if(!T.defaultPrevented)switch(T.key){case"Enter":{T.preventDefault();const Y=x.findIndex(z=>z.current.id===C);if(Y>=0){const z=x[Y],W=o[Y];if(W!=null){let Q=0;W.toPrecision(Jl)<=z.current.minSize.toPrecision(Jl)?Q=i==="horizontal"?h:p:Q=-(i==="horizontal"?h:p);const U=Ed(T,e.current,C,S,Q,o,s.current,null);o!==U&&r(U)}}break}}};b.addEventListener("keydown",D);const O=tae(C);return O!=null&&b.setAttribute("aria-controls",O.id),()=>{b.removeAttribute("aria-valuemax"),b.removeAttribute("aria-valuemin"),b.removeAttribute("aria-valuenow"),b.removeEventListener("keydown",D),O!=null&&b.removeAttribute("aria-controls")}});return()=>{g.forEach(b=>b())}},[e,t,n,s,r,o])}function sae({disabled:e,handleId:t,resizeHandler:n}){ui(()=>{if(e||n==null)return;const r=m0(t);if(r==null)return;const o=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const i=L8(),c=nae(t);z8(c!==null);const d=s.shiftKey?c>0?c-1:i.length-1:c+1{r.removeEventListener("keydown",o)}},[e,t,n])}function j1(e,t){if(e.length!==t.length)return!1;for(let n=0;nR.current.id===I),M=r[P];if(M.current.collapsible){const R=h[P];(R===0||R.toPrecision(Jl)===M.current.minSize.toPrecision(Jl))&&(S=S<0?-M.current.minSize*y:M.current.minSize*y)}return S}else return F8(e,n,o,c,d)}function iae(e){return e.type==="keydown"}function tx(e){return e.type.startsWith("mouse")}function nx(e){return e.type.startsWith("touch")}let rx=null,Al=null;function B8(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function lae(){Al!==null&&(document.head.removeChild(Al),rx=null,Al=null)}function _1(e){if(rx===e)return;rx=e;const t=B8(e);Al===null&&(Al=document.createElement("style"),document.head.appendChild(Al)),Al.innerHTML=`*{cursor: ${t}!important;}`}function cae(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function H8(e){return e.map(t=>{const{minSize:n,order:r}=t.current;return r?`${r}:${n}`:`${n}`}).sort((t,n)=>t.localeCompare(n)).join(",")}function W8(e,t){try{const n=t.getItem(`PanelGroup:sizes:${e}`);if(n){const r=JSON.parse(n);if(typeof r=="object"&&r!=null)return r}}catch{}return null}function uae(e,t,n){const r=W8(e,n);if(r){const o=H8(t);return r[o]??null}return null}function dae(e,t,n,r){const o=H8(t),s=W8(e,r)||{};s[o]=n;try{r.setItem(`PanelGroup:sizes:${e}`,JSON.stringify(s))}catch(i){console.error(i)}}const I1={};function y_(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}const Md={getItem:e=>(y_(Md),Md.getItem(e)),setItem:(e,t)=>{y_(Md),Md.setItem(e,t)}};function V8({autoSaveId:e,children:t=null,className:n="",direction:r,disablePointerEventsDuringResize:o=!1,forwardedRef:s,id:i=null,onLayout:c,storage:d=Md,style:p={},tagName:h="div",units:m="percentages"}){const g=A2(i),[b,y]=Fd(null),[x,C]=Fd(new Map),S=ns(null);ns({didLogDefaultSizeWarning:!1,didLogIdAndOrderWarning:!1,didLogInvalidLayoutWarning:!1,prevPanelIds:[]});const j=ns({onLayout:c});ui(()=>{j.current.onLayout=c});const _=ns({}),[I,P]=Fd([]),M=ns(new Map),R=ns(0),A=ns({direction:r,id:g,panels:x,sizes:I,units:m});T8(s,()=>({getId:()=>g,getLayout:K=>{const{sizes:Z,units:se}=A.current;if((K??se)==="pixels"){const G=Vi(g);return Z.map(te=>te/100*G)}else return Z},setLayout:(K,Z)=>{const{id:se,panels:fe,sizes:G,units:te}=A.current;if((Z||te)==="pixels"){const ue=Vi(se);K=K.map(q=>q/ue*100)}const V=_.current,F=Fo(fe),X=k1({groupId:se,panels:fe,nextSizes:K,prevSizes:G,units:te});j1(G,X)||(P(X),Ac(F,X,V))}}),[g]),Bd(()=>{A.current.direction=r,A.current.id=g,A.current.panels=x,A.current.sizes=I,A.current.units=m}),oae({committedValuesRef:A,groupId:g,panels:x,setSizes:P,sizes:I,panelSizeBeforeCollapse:M}),ui(()=>{const{onLayout:K}=j.current,{panels:Z,sizes:se}=A.current;if(se.length>0){K&&K(se);const fe=_.current,G=Fo(Z);Ac(G,se,fe)}},[I]),Bd(()=>{const{id:K,sizes:Z,units:se}=A.current;if(Z.length===x.size)return;let fe=null;if(e){const G=Fo(x);fe=uae(e,G,d)}if(fe!=null){const G=k1({groupId:K,panels:x,nextSizes:fe,prevSizes:fe,units:se});P(G)}else{const G=eae({groupId:K,panels:x,units:se});P(G)}},[e,x,d]),ui(()=>{if(e){if(I.length===0||I.length!==x.size)return;const K=Fo(x);I1[e]||(I1[e]=cae(dae,100)),I1[e](e,K,I,d)}},[e,x,I,d]),Bd(()=>{if(m==="pixels"){const K=new ResizeObserver(()=>{const{panels:Z,sizes:se}=A.current,fe=k1({groupId:g,panels:Z,nextSizes:se,prevSizes:se,units:m});j1(se,fe)||P(fe)});return K.observe(uf(g)),()=>{K.disconnect()}}},[g,m]);const D=Ja((K,Z)=>{const{panels:se,units:fe}=A.current,te=Fo(se).findIndex(X=>X.current.id===K),V=I[te];if((Z??fe)==="pixels"){const X=Vi(g);return V/100*X}else return V},[g,I]),O=Ja((K,Z)=>{const{panels:se}=A.current;return se.size===0?{flexBasis:0,flexGrow:Z??void 0,flexShrink:1,overflow:"hidden"}:{flexBasis:0,flexGrow:$8(se,K,I),flexShrink:1,overflow:"hidden",pointerEvents:o&&b!==null?"none":void 0}},[b,o,I]),T=Ja((K,Z)=>{const{units:se}=A.current;rae(se,Z),C(fe=>{if(fe.has(K))return fe;const G=new Map(fe);return G.set(K,Z),G})},[]),Y=Ja(K=>se=>{se.preventDefault();const{direction:fe,panels:G,sizes:te}=A.current,V=Fo(G),[F,X]=T2(g,K,V);if(F==null||X==null)return;let ue=aae(se,g,K,V,fe,te,S.current);if(ue===0)return;const ne=uf(g).getBoundingClientRect(),pe=fe==="horizontal";document.dir==="rtl"&&pe&&(ue=-ue);const le=pe?ne.width:ne.height,we=ue/le*100,ve=Ed(se,A.current,F,X,we,te,M.current,S.current),he=!j1(te,ve);if((tx(se)||nx(se))&&R.current!=we&&_1(he?pe?"horizontal":"vertical":pe?ue<0?"horizontal-min":"horizontal-max":ue<0?"vertical-min":"vertical-max"),he){const Ne=_.current;P(ve),Ac(V,ve,Ne)}R.current=we},[g]),z=Ja(K=>{C(Z=>{if(!Z.has(K))return Z;const se=new Map(Z);return se.delete(K),se})},[]),W=Ja(K=>{const{panels:Z,sizes:se}=A.current,fe=Z.get(K);if(fe==null)return;const{collapsedSize:G,collapsible:te}=fe.current;if(!te)return;const V=Fo(Z),F=V.indexOf(fe);if(F<0)return;const X=se[F];if(X===G)return;M.current.set(K,X);const[ue,q]=S1(K,V);if(ue==null||q==null)return;const pe=F===V.length-1?X:G-X,le=Ed(null,A.current,ue,q,pe,se,M.current,null);if(se!==le){const we=_.current;P(le),Ac(V,le,we)}},[]),Q=Ja(K=>{const{panels:Z,sizes:se}=A.current,fe=Z.get(K);if(fe==null)return;const{collapsedSize:G,minSize:te}=fe.current,V=M.current.get(K)||te;if(!V)return;const F=Fo(Z),X=F.indexOf(fe);if(X<0||se[X]!==G)return;const[q,ne]=S1(K,F);if(q==null||ne==null)return;const le=X===F.length-1?G-V:V,we=Ed(null,A.current,q,ne,le,se,M.current,null);if(se!==we){const ve=_.current;P(we),Ac(F,we,ve)}},[]),U=Ja((K,Z,se)=>{const{id:fe,panels:G,sizes:te,units:V}=A.current;if((se||V)==="pixels"){const Mt=Vi(fe);Z=Z/Mt*100}const F=G.get(K);if(F==null)return;let{collapsedSize:X,collapsible:ue,maxSize:q,minSize:ne}=F.current;if(V==="pixels"){const Mt=Vi(fe);ne=ne/Mt*100,q!=null&&(q=q/Mt*100)}const pe=Fo(G),le=pe.indexOf(F);if(le<0)return;const we=te[le];if(we===Z)return;ue&&Z===X||(Z=Math.min(q??100,Math.max(ne,Z)));const[ve,he]=S1(K,pe);if(ve==null||he==null)return;const De=le===pe.length-1?we-Z:Z-we,qe=Ed(null,A.current,ve,he,De,te,M.current,null);if(te!==qe){const Mt=_.current;P(qe),Ac(pe,qe,Mt)}},[]),L=Yse(()=>({activeHandleId:b,collapsePanel:W,direction:r,expandPanel:Q,getPanelSize:D,getPanelStyle:O,groupId:g,registerPanel:T,registerResizeHandle:Y,resizePanel:U,startDragging:(K,Z)=>{if(y(K),tx(Z)||nx(Z)){const se=m0(K);S.current={dragHandleRect:se.getBoundingClientRect(),dragOffset:F8(Z,K,r),sizes:A.current.sizes}}},stopDragging:()=>{lae(),y(null),S.current=null},units:m,unregisterPanel:z}),[b,W,r,Q,D,O,g,T,Y,U,m,z]),ee={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Iu(h0.Provider,{children:Iu(h,{children:t,className:n,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":g,"data-panel-group-units":m,style:{...ee,...p}}),value:L})}const g0=A8((e,t)=>Iu(V8,{...e,forwardedRef:t}));V8.displayName="PanelGroup";g0.displayName="forwardRef(PanelGroup)";function ox({children:e=null,className:t="",disabled:n=!1,id:r=null,onDragging:o,style:s={},tagName:i="div"}){const c=ns(null),d=ns({onDragging:o});ui(()=>{d.current.onDragging=o});const p=D8(h0);if(p===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{activeHandleId:h,direction:m,groupId:g,registerResizeHandle:b,startDragging:y,stopDragging:x}=p,C=A2(r),S=h===C,[j,_]=Fd(!1),[I,P]=Fd(null),M=Ja(()=>{c.current.blur(),x();const{onDragging:D}=d.current;D&&D(!1)},[x]);ui(()=>{if(n)P(null);else{const A=b(C);P(()=>A)}},[n,C,b]),ui(()=>{if(n||I==null||!S)return;const A=Y=>{I(Y)},D=Y=>{I(Y)},T=c.current.ownerDocument;return T.body.addEventListener("contextmenu",M),T.body.addEventListener("mousemove",A),T.body.addEventListener("touchmove",A),T.body.addEventListener("mouseleave",D),window.addEventListener("mouseup",M),window.addEventListener("touchend",M),()=>{T.body.removeEventListener("contextmenu",M),T.body.removeEventListener("mousemove",A),T.body.removeEventListener("touchmove",A),T.body.removeEventListener("mouseleave",D),window.removeEventListener("mouseup",M),window.removeEventListener("touchend",M)}},[m,n,S,I,M]),sae({disabled:n,handleId:C,resizeHandler:I});const R={cursor:B8(m),touchAction:"none",userSelect:"none"};return Iu(i,{children:e,className:t,"data-resize-handle-active":S?"pointer":j?"keyboard":void 0,"data-panel-group-direction":m,"data-panel-group-id":g,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":C,onBlur:()=>_(!1),onFocus:()=>_(!0),onMouseDown:A=>{y(C,A.nativeEvent);const{onDragging:D}=d.current;D&&D(!0)},onMouseUp:M,onTouchCancel:M,onTouchEnd:M,onTouchStart:A=>{y(C,A.nativeEvent);const{onDragging:D}=d.current;D&&D(!0)},ref:c,role:"separator",style:{...R,...s},tabIndex:0})}ox.displayName="PanelResizeHandle";const fae=e=>{const{direction:t="horizontal",collapsedDirection:n,isCollapsed:r=!1,...o}=e,s=di("base.100","base.850"),i=di("base.300","base.700");return t==="horizontal"?a.jsx(ox,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(N,{className:"resize-handle-horizontal",sx:{w:n?2.5:4,h:"full",justifyContent:n?n==="left"?"flex-start":"flex-end":"center",alignItems:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Te,{sx:{w:1,h:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})}):a.jsx(ox,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(N,{className:"resize-handle-vertical",sx:{w:"full",h:n?2.5:4,alignItems:n?n==="top"?"flex-start":"flex-end":"center",justifyContent:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Te,{sx:{h:1,w:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})})},Zm=l.memo(fae),N2=()=>{const e=oe(),t=H(o=>o.ui.panels),n=l.useCallback(o=>t[o]??"",[t]),r=l.useCallback((o,s)=>{e(c7({name:o,value:s}))},[e]);return{getItem:n,setItem:r}};const pae=e=>{const{label:t,data:n,fileName:r,withDownload:o=!0,withCopy:s=!0}=e,i=l.useMemo(()=>u7(n)?n:JSON.stringify(n,null,2),[n]),c=l.useCallback(()=>{navigator.clipboard.writeText(i)},[i]),d=l.useCallback(()=>{const h=new Blob([i]),m=document.createElement("a");m.href=URL.createObjectURL(h),m.download=`${r||t}.json`,document.body.appendChild(m),m.click(),m.remove()},[i,t,r]),{t:p}=J();return a.jsxs(N,{layerStyle:"second",sx:{borderRadius:"base",flexGrow:1,w:"full",h:"full",position:"relative"},children:[a.jsx(Te,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"auto",p:4,fontSize:"sm"},children:a.jsx(o0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsx("pre",{children:i})})}),a.jsxs(N,{sx:{position:"absolute",top:0,insetInlineEnd:0,p:2},children:[o&&a.jsx(Fn,{label:`${p("gallery.download")} ${t} JSON`,children:a.jsx(_a,{"aria-label":`${p("gallery.download")} ${t} JSON`,icon:a.jsx(Wu,{}),variant:"ghost",opacity:.7,onClick:d})}),s&&a.jsx(Fn,{label:`${p("gallery.copy")} ${t} JSON`,children:a.jsx(_a,{"aria-label":`${p("gallery.copy")} ${t} JSON`,icon:a.jsx(Hu,{}),variant:"ghost",opacity:.7,onClick:c})})]})]})},el=l.memo(pae),hae=de(Ce,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(r=>r.id===t);return{data:n==null?void 0:n.data}},_e),mae=()=>{const{data:e}=H(hae);return e?a.jsx(el,{data:e,label:"Node Data"}):a.jsx(qr,{label:"No node selected",icon:null})},gae=l.memo(mae),vae=({children:e,maxHeight:t})=>a.jsx(N,{sx:{w:"full",h:"full",maxHeight:t,position:"relative"},children:a.jsx(Te,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(o0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:e})})}),lc=l.memo(vae),bae=({output:e})=>{const{image:t}=e,{data:n}=Ps(t.image_name);return a.jsx(il,{imageDTO:n})},xae=l.memo(bae),yae=de(Ce,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(s=>s.id===t),r=n?e.nodeTemplates[n.data.type]:void 0,o=e.nodeExecutionStates[t??"__UNKNOWN_NODE__"];return{node:n,template:r,nes:o}},_e),Cae=()=>{const{node:e,template:t,nes:n}=H(yae),{t:r}=J();return!e||!n||!Rr(e)?a.jsx(qr,{label:r("nodes.noNodeSelected"),icon:null}):n.outputs.length===0?a.jsx(qr,{label:r("nodes.noOutputRecorded"),icon:null}):a.jsx(Te,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(lc,{children:a.jsx(N,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:(t==null?void 0:t.outputType)==="image_output"?n.outputs.map((o,s)=>a.jsx(xae,{output:o},Sae(o,s))):a.jsx(el,{data:n.outputs,label:r("nodes.nodeOutputs")})})})})},wae=l.memo(Cae),Sae=(e,t)=>`${e.type}-${t}`,kae=de(Ce,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(o=>o.id===t);return{template:n?e.nodeTemplates[n.data.type]:void 0}},_e),jae=()=>{const{template:e}=H(kae),{t}=J();return e?a.jsx(el,{data:e,label:t("nodes.nodeTemplate")}):a.jsx(qr,{label:t("nodes.noNodeSelected"),icon:null})},_ae=l.memo(jae),$2=e=>{e.stopPropagation()},Iae=Oe((e,t)=>{const n=oe(),r=l.useCallback(s=>{s.shiftKey&&n(Uo(!0))},[n]),o=l.useCallback(s=>{s.shiftKey||n(Uo(!1))},[n]);return a.jsx(G3,{ref:t,onPaste:$2,onKeyDown:r,onKeyUp:o,...e})}),vi=l.memo(Iae),L2=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return o==null?void 0:o.data},_e),[e]);return H(t)},Pae=({nodeId:e})=>{const t=oe(),n=L2(e),{t:r}=J(),o=l.useCallback(s=>{t(d7({nodeId:e,notes:s.target.value}))},[t,e]);return Vh(n)?a.jsxs(Bn,{children:[a.jsx(vr,{children:r("nodes.notes")}),a.jsx(vi,{value:n==null?void 0:n.notes,onChange:o,rows:10})]}):null},Eae=l.memo(Pae),U8=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.label:!1},_e),[e]);return H(t)},G8=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Rr(o))return!1;const s=o?r.nodeTemplates[o.data.type]:void 0;return s==null?void 0:s.title},_e),[e]);return H(t)},Mae=({nodeId:e,title:t})=>{const n=oe(),r=U8(e),o=G8(e),{t:s}=J(),[i,c]=l.useState(""),d=l.useCallback(async h=>{n(nP({nodeId:e,label:h})),c(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),p=l.useCallback(h=>{c(h)},[]);return l.useEffect(()=>{c(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsxs(Ef,{as:N,value:i,onChange:p,onSubmit:d,w:"full",fontWeight:600,children:[a.jsx(Pf,{noOfLines:1}),a.jsx(If,{className:"nodrag",_focusVisible:{boxShadow:"none"}})]})})},Oae=l.memo(Mae),Rae=de(Ce,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(o=>o.id===t),r=n?e.nodeTemplates[n.data.type]:void 0;return{node:n,template:r}},_e),Aae=()=>{const{node:e,template:t}=H(Rae),{t:n}=J();return!t||!Rr(e)?a.jsx(qr,{label:n("nodes.noNodeSelected"),icon:null}):a.jsx(Tae,{node:e,template:t})},Dae=l.memo(Aae),Tae=e=>{const{t}=J(),{needsUpdate:n,updateNode:r}=rP(e.node.id);return a.jsx(Te,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(lc,{children:a.jsxs(N,{sx:{flexDir:"column",position:"relative",p:1,gap:2,w:"full"},children:[a.jsx(Oae,{nodeId:e.node.data.id}),a.jsxs(xg,{children:[a.jsxs(Bn,{children:[a.jsx(vr,{children:"Node Type"}),a.jsx(Se,{fontSize:"sm",fontWeight:600,children:e.template.title})]}),a.jsxs(N,{flexDir:"row",alignItems:"center",justifyContent:"space-between",w:"full",children:[a.jsxs(Bn,{isInvalid:n,children:[a.jsx(vr,{children:"Node Version"}),a.jsx(Se,{fontSize:"sm",fontWeight:600,children:e.node.data.version})]}),n&&a.jsx(tt,{"aria-label":t("nodes.updateNode"),tooltip:t("nodes.updateNode"),icon:a.jsx(Xg,{}),onClick:r})]})]}),a.jsx(Eae,{nodeId:e.node.data.id})]})})})},Nae=()=>a.jsx(N,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(tc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(nc,{children:[a.jsx(xo,{children:"Details"}),a.jsx(xo,{children:"Outputs"}),a.jsx(xo,{children:"Data"}),a.jsx(xo,{children:"Template"})]}),a.jsxs(zu,{children:[a.jsx(Ho,{children:a.jsx(Dae,{})}),a.jsx(Ho,{children:a.jsx(wae,{})}),a.jsx(Ho,{children:a.jsx(gae,{})}),a.jsx(Ho,{children:a.jsx(_ae,{})})]})]})}),$ae=l.memo(Nae),Lae={display:"flex",flexDirection:"row",alignItems:"center",gap:10},zae=e=>{const{label:t="",labelPos:n="top",isDisabled:r=!1,isInvalid:o,formControlProps:s,...i}=e,c=oe(),d=l.useCallback(h=>{h.shiftKey&&c(Uo(!0))},[c]),p=l.useCallback(h=>{h.shiftKey||c(Uo(!1))},[c]);return a.jsxs(Bn,{isInvalid:o,isDisabled:r,...s,style:n==="side"?Lae:void 0,children:[t!==""&&a.jsx(vr,{children:t}),a.jsx(vg,{...i,onPaste:$2,onKeyDown:d,onKeyUp:p})]})},Cs=l.memo(zae),Fae=de(Ce,({nodes:e})=>{const{author:t,name:n,description:r,tags:o,version:s,contact:i,notes:c}=e.workflow;return{name:n,author:t,description:r,tags:o,version:s,contact:i,notes:c}},_e),Bae=()=>{const{author:e,name:t,description:n,tags:r,version:o,contact:s,notes:i}=H(Fae),c=oe(),d=l.useCallback(C=>{c(f7(C.target.value))},[c]),p=l.useCallback(C=>{c(p7(C.target.value))},[c]),h=l.useCallback(C=>{c(h7(C.target.value))},[c]),m=l.useCallback(C=>{c(m7(C.target.value))},[c]),g=l.useCallback(C=>{c(g7(C.target.value))},[c]),b=l.useCallback(C=>{c(v7(C.target.value))},[c]),y=l.useCallback(C=>{c(b7(C.target.value))},[c]),{t:x}=J();return a.jsx(lc,{children:a.jsxs(N,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:[a.jsxs(N,{sx:{gap:2,w:"full"},children:[a.jsx(Cs,{label:x("nodes.workflowName"),value:t,onChange:d}),a.jsx(Cs,{label:x("nodes.workflowVersion"),value:o,onChange:m})]}),a.jsxs(N,{sx:{gap:2,w:"full"},children:[a.jsx(Cs,{label:x("nodes.workflowAuthor"),value:e,onChange:p}),a.jsx(Cs,{label:x("nodes.workflowContact"),value:s,onChange:h})]}),a.jsx(Cs,{label:x("nodes.workflowTags"),value:r,onChange:b}),a.jsxs(Bn,{as:N,sx:{flexDir:"column"},children:[a.jsx(vr,{children:x("nodes.workflowDescription")}),a.jsx(vi,{onChange:g,value:n,fontSize:"sm",sx:{resize:"none"}})]}),a.jsxs(Bn,{as:N,sx:{flexDir:"column",h:"full"},children:[a.jsx(vr,{children:x("nodes.workflowNotes")}),a.jsx(vi,{onChange:y,value:i,fontSize:"sm",sx:{h:"full",resize:"none"}})]})]})})},Hae=l.memo(Bae),q8=()=>{const e=H(r=>r.nodes),[t]=P2(e,300);return l.useMemo(()=>x7(t),[t])},Wae=()=>{const e=q8(),{t}=J();return a.jsx(N,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:a.jsx(el,{data:e,label:t("nodes.workflow")})})},Vae=l.memo(Wae),Uae=({isSelected:e,isHovered:t})=>{const n=l.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.light";if(e)return"nodeSelected.light";if(t)return"nodeHovered.light"},[t,e]),r=l.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.dark";if(e)return"nodeSelected.dark";if(t)return"nodeHovered.dark"},[t,e]);return a.jsx(Te,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e||t?1:.5,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:n,_dark:{shadow:r}}})},K8=l.memo(Uae),Q8=e=>{const t=oe(),n=l.useMemo(()=>de(Ce,({nodes:i})=>i.mouseOverNode===e,_e),[e]),r=H(n),o=l.useCallback(()=>{!r&&t(Gw(e))},[t,e,r]),s=l.useCallback(()=>{r&&t(Gw(null))},[t,r]);return{isMouseOverNode:r,handleMouseOver:o,handleMouseOut:s}},X8=(e,t)=>{const n=l.useMemo(()=>de(Ce,({nodes:o})=>{var i;const s=o.nodes.find(c=>c.id===e);if(Rr(s))return(i=s==null?void 0:s.data.inputs[t])==null?void 0:i.label},_e),[t,e]);return H(n)},Y8=(e,t,n)=>{const r=l.useMemo(()=>de(Ce,({nodes:s})=>{var d;const i=s.nodes.find(p=>p.id===e);if(!Rr(i))return;const c=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return(d=c==null?void 0:c[zx[n]][t])==null?void 0:d.title},_e),[t,n,e]);return H(r)},J8=(e,t)=>{const n=l.useMemo(()=>de(Ce,({nodes:o})=>{const s=o.nodes.find(i=>i.id===e);if(Rr(s))return s==null?void 0:s.data.inputs[t]},_e),[t,e]);return H(n)},v0=(e,t,n)=>{const r=l.useMemo(()=>de(Ce,({nodes:s})=>{const i=s.nodes.find(d=>d.id===e);if(!Rr(i))return;const c=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return c==null?void 0:c[zx[n]][t]},_e),[t,n,e]);return H(r)},Gae=({nodeId:e,fieldName:t,kind:n})=>{const r=J8(e,t),o=v0(e,t,n),s=y7(o),{t:i}=J(),c=l.useMemo(()=>C7(r)?r.label&&(o!=null&&o.title)?`${r.label} (${o.title})`:r.label&&!o?r.label:!r.label&&o?o.title:i("nodes.unknownField"):(o==null?void 0:o.title)||i("nodes.unknownField"),[r,o,i]);return a.jsxs(N,{sx:{flexDir:"column"},children:[a.jsx(Se,{sx:{fontWeight:600},children:c}),o&&a.jsx(Se,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:o.description}),o&&a.jsxs(Se,{children:["Type: ",bf[o.type].title]}),s&&a.jsxs(Se,{children:["Input: ",w7(o.input)]})]})},z2=l.memo(Gae),qae=Oe((e,t)=>{const{nodeId:n,fieldName:r,kind:o,isMissingInput:s=!1,withTooltip:i=!1}=e,c=X8(n,r),d=Y8(n,r,o),{t:p}=J(),h=oe(),[m,g]=l.useState(c||d||p("nodes.unknownField")),b=l.useCallback(async x=>{x&&(x===c||x===d)||(g(x||d||p("nodes.unknownField")),h(S7({nodeId:n,fieldName:r,label:x})))},[c,d,h,n,r,p]),y=l.useCallback(x=>{g(x)},[]);return l.useEffect(()=>{g(c||d||p("nodes.unknownField"))},[c,d,p]),a.jsx(Fn,{label:i?a.jsx(z2,{nodeId:n,fieldName:r,kind:"input"}):void 0,openDelay:ug,placement:"top",hasArrow:!0,children:a.jsx(N,{ref:t,sx:{position:"relative",overflow:"hidden",alignItems:"center",justifyContent:"flex-start",gap:1,h:"full"},children:a.jsxs(Ef,{value:m,onChange:y,onSubmit:b,as:N,sx:{position:"relative",alignItems:"center",h:"full"},children:[a.jsx(Pf,{sx:{p:0,fontWeight:s?600:400,textAlign:"left",_hover:{fontWeight:"600 !important"}},noOfLines:1}),a.jsx(If,{className:"nodrag",sx:{p:0,w:"full",fontWeight:600,color:"base.900",_dark:{color:"base.100"},_focusVisible:{p:0,textAlign:"left",boxShadow:"none"}}}),a.jsx(eR,{})]})})})}),Z8=l.memo(qae),eR=l.memo(()=>{const{isEditing:e,getEditButtonProps:t}=JP(),n=l.useCallback(r=>{const{onClick:o}=t();o&&(o(r),r.preventDefault())},[t]);return e?null:a.jsx(N,{onClick:n,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,cursor:"text"})});eR.displayName="EditableControls";const Kae=e=>{const{nodeId:t,field:n}=e,r=oe(),o=l.useCallback(s=>{r(k7({nodeId:t,fieldName:n.name,value:s.target.checked}))},[r,n.name,t]);return a.jsx(Ey,{className:"nodrag",onChange:o,isChecked:n.value})},Qae=l.memo(Kae);function b0(){return(b0=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function sx(e){var t=l.useRef(e),n=l.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Pu=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:C.buttons>0)&&o.current?s(C_(o.current,C,c.current)):x(!1)},y=function(){return x(!1)};function x(C){var S=d.current,j=ax(o.current),_=C?j.addEventListener:j.removeEventListener;_(S?"touchmove":"mousemove",b),_(S?"touchend":"mouseup",y)}return[function(C){var S=C.nativeEvent,j=o.current;if(j&&(w_(S),!function(I,P){return P&&!Hd(I)}(S,d.current)&&j)){if(Hd(S)){d.current=!0;var _=S.changedTouches||[];_.length&&(c.current=_[0].identifier)}j.focus(),s(C_(j,S,c.current)),x(!0)}},function(C){var S=C.which||C.keyCode;S<37||S>40||(C.preventDefault(),i({left:S===39?.05:S===37?-.05:0,top:S===40?.05:S===38?-.05:0}))},x]},[i,s]),h=p[0],m=p[1],g=p[2];return l.useEffect(function(){return g},[g]),B.createElement("div",b0({},r,{onTouchStart:h,onMouseDown:h,className:"react-colorful__interactive",ref:o,onKeyDown:m,tabIndex:0,role:"slider"}))}),x0=function(e){return e.filter(Boolean).join(" ")},B2=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=x0(["react-colorful__pointer",e.className]);return B.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},B.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Eo=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},nR=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:Eo(e.h),s:Eo(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:Eo(o/2),a:Eo(r,2)}},ix=function(e){var t=nR(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},P1=function(e){var t=nR(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},Xae=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),i=r*(1-n),c=r*(1-(t-s)*n),d=r*(1-(1-t+s)*n),p=s%6;return{r:Eo(255*[r,c,i,i,d,r][p]),g:Eo(255*[d,r,r,c,i,i][p]),b:Eo(255*[i,i,d,r,r,c][p]),a:Eo(o,2)}},Yae=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),i=s-Math.min(t,n,r),c=i?s===t?(n-r)/i:s===n?2+(r-t)/i:4+(t-n)/i:0;return{h:Eo(60*(c<0?c+6:c)),s:Eo(s?i/s*100:0),v:Eo(s/255*100),a:o}},Jae=B.memo(function(e){var t=e.hue,n=e.onChange,r=x0(["react-colorful__hue",e.className]);return B.createElement("div",{className:r},B.createElement(F2,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Pu(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":Eo(t),"aria-valuemax":"360","aria-valuemin":"0"},B.createElement(B2,{className:"react-colorful__hue-pointer",left:t/360,color:ix({h:t,s:100,v:100,a:1})})))}),Zae=B.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:ix({h:t.h,s:100,v:100,a:1})};return B.createElement("div",{className:"react-colorful__saturation",style:r},B.createElement(F2,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Pu(t.s+100*o.left,0,100),v:Pu(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Eo(t.s)+"%, Brightness "+Eo(t.v)+"%"},B.createElement(B2,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:ix(t)})))}),rR=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function eie(e,t,n){var r=sx(n),o=l.useState(function(){return e.toHsva(t)}),s=o[0],i=o[1],c=l.useRef({color:t,hsva:s});l.useEffect(function(){if(!e.equal(t,c.current.color)){var p=e.toHsva(t);c.current={hsva:p,color:t},i(p)}},[t,e]),l.useEffect(function(){var p;rR(s,c.current.hsva)||e.equal(p=e.fromHsva(s),c.current.color)||(c.current={hsva:s,color:p},r(p))},[s,e,r]);var d=l.useCallback(function(p){i(function(h){return Object.assign({},h,p)})},[]);return[s,d]}var tie=typeof window<"u"?l.useLayoutEffect:l.useEffect,nie=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},S_=new Map,rie=function(e){tie(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!S_.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}`,S_.set(t,n);var r=nie();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},oie=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+P1(Object.assign({},n,{a:0}))+", "+P1(Object.assign({},n,{a:1}))+")"},s=x0(["react-colorful__alpha",t]),i=Eo(100*n.a);return B.createElement("div",{className:s},B.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),B.createElement(F2,{onMove:function(c){r({a:c.left})},onKey:function(c){r({a:Pu(n.a+c.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},B.createElement(B2,{className:"react-colorful__alpha-pointer",left:n.a,color:P1(n)})))},sie=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,i=tR(e,["className","colorModel","color","onChange"]),c=l.useRef(null);rie(c);var d=eie(n,o,s),p=d[0],h=d[1],m=x0(["react-colorful",t]);return B.createElement("div",b0({},i,{ref:c,className:m}),B.createElement(Zae,{hsva:p,onChange:h}),B.createElement(Jae,{hue:p.h,onChange:h}),B.createElement(oie,{hsva:p,onChange:h,className:"react-colorful__last-control"}))},aie={defaultColor:{r:0,g:0,b:0,a:1},toHsva:Yae,fromHsva:Xae,equal:rR},oR=function(e){return B.createElement(sie,b0({},e,{colorModel:aie}))};const iie=e=>{const{nodeId:t,field:n}=e,r=oe(),o=l.useCallback(s=>{r(j7({nodeId:t,fieldName:n.name,value:s}))},[r,n.name,t]);return a.jsx(oR,{className:"nodrag",color:n.value,onChange:o})},lie=l.memo(iie),sR=e=>{const t=Ci("models"),[n,r,o]=e.split("/"),s=_7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({controlNetModelId:e,errors:s.error.format()},"Failed to parse ControlNet model id");return}return s.data},cie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=oe(),{data:s}=_x(),i=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/controlnet/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),c=l.useMemo(()=>{if(!s)return[];const p=[];return Kr(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:gr[h.base_model]})}),p},[s]),d=l.useCallback(p=>{if(!p)return;const h=sR(p);h&&o(I7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(Ar,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:c,onChange:d,sx:{width:"100%"}})},uie=l.memo(cie),die=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=oe(),s=l.useCallback(i=>{o(P7({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return a.jsx(I3,{className:"nowheel nodrag",onChange:s,value:n.value,children:r.options.map(i=>a.jsx("option",{value:i,children:r.ui_choice_labels?r.ui_choice_labels[i]:i},i))})},fie=l.memo(die),pie=e=>{var p;const{nodeId:t,field:n}=e,r=oe(),{currentData:o}=Ps(((p=n.value)==null?void 0:p.image_name)??Os.skipToken),s=l.useCallback(()=>{r(E7({nodeId:t,fieldName:n.name,value:void 0}))},[r,n.name,t]),i=l.useMemo(()=>{if(o)return{id:`node-${t}-${n.name}`,payloadType:"IMAGE_DTO",payload:{imageDTO:o}}},[n.name,o,t]),c=l.useMemo(()=>({id:`node-${t}-${n.name}`,actionType:"SET_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}}),[n.name,t]),d=l.useMemo(()=>({type:"SET_NODES_IMAGE",nodeId:t,fieldName:n.name}),[t,n.name]);return a.jsx(N,{className:"nodrag",sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(il,{imageDTO:o,droppableData:c,draggableData:i,postUploadAction:d,useThumbailFallback:!0,uploadElement:a.jsx(aR,{}),dropLabel:a.jsx(iR,{}),minSize:8,children:a.jsx(fu,{onClick:s,icon:o?a.jsx(Yg,{}):void 0,tooltip:"Reset Image"})})})},hie=l.memo(pie),aR=l.memo(()=>a.jsx(Se,{fontSize:16,fontWeight:600,children:"Drop or Upload"}));aR.displayName="UploadElement";const iR=l.memo(()=>a.jsx(Se,{fontSize:16,fontWeight:600,children:"Drop"}));iR.displayName="DropLabel";const mie=e=>{const t=Ci("models"),[n,r,o]=e.split("/"),s=M7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({loraModelId:e,errors:s.error.format()},"Failed to parse LoRA model id");return}return s.data},gie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=oe(),{data:s}=vf(),{t:i}=J(),c=l.useMemo(()=>{if(!s)return[];const m=[];return Kr(s.entities,(g,b)=>{g&&m.push({value:b,label:g.model_name,group:gr[g.base_model]})}),m.sort((g,b)=>g.disabled&&!b.disabled?1:-1)},[s]),d=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/lora/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r==null?void 0:r.base_model,r==null?void 0:r.model_name]),p=l.useCallback(m=>{if(!m)return;const g=mie(m);g&&o(O7({nodeId:t,fieldName:n.name,value:g}))},[o,n.name,t]),h=l.useCallback((m,g)=>{var b;return((b=g.label)==null?void 0:b.toLowerCase().includes(m.toLowerCase().trim()))||g.value.toLowerCase().includes(m.toLowerCase().trim())},[]);return(s==null?void 0:s.ids.length)===0?a.jsx(N,{sx:{justifyContent:"center",p:2},children:a.jsx(Se,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(tr,{className:"nowheel nodrag",value:(d==null?void 0:d.id)??null,placeholder:c.length>0?i("models.selectLoRA"):i("models.noLoRAsAvailable"),data:c,nothingFound:i("models.noMatchingLoRAs"),itemComponent:pl,disabled:c.length===0,filter:h,error:!d,onChange:p,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},vie=l.memo(gie),y0=e=>{const t=Ci("models"),[n,r,o]=e.split("/"),s=R7.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data};function Gu(e){const{iconMode:t=!1,...n}=e,r=oe(),{t:o}=J(),[s,{isLoading:i}]=A7(),c=l.useCallback(()=>{s().unwrap().then(d=>{r(Bt(Zn({title:`${o("modelManager.modelsSynced")}`,status:"success"})))}).catch(d=>{d&&r(Bt(Zn({title:`${o("modelManager.modelSyncFailed")}`,status:"error"})))})},[r,s,o]);return t?a.jsx(tt,{icon:a.jsx(Xg,{}),tooltip:o("modelManager.syncModels"),"aria-label":o("modelManager.syncModels"),isLoading:i,onClick:c,size:"sm",...n}):a.jsx(Rt,{isLoading:i,onClick:c,minW:"max-content",...n,children:"Sync Models"})}const bie=e=>{var y,x;const{nodeId:t,field:n}=e,r=oe(),o=jn("syncModels").isFeatureEnabled,{t:s}=J(),{data:i,isLoading:c}=Wd(qw),{data:d,isLoading:p}=na(qw),h=l.useMemo(()=>c||p,[c,p]),m=l.useMemo(()=>{if(!d)return[];const C=[];return Kr(d.entities,(S,j)=>{S&&C.push({value:j,label:S.model_name,group:gr[S.base_model]})}),i&&Kr(i.entities,(S,j)=>{S&&C.push({value:j,label:S.model_name,group:gr[S.base_model]})}),C},[d,i]),g=l.useMemo(()=>{var C,S,j,_;return((d==null?void 0:d.entities[`${(C=n.value)==null?void 0:C.base_model}/main/${(S=n.value)==null?void 0:S.model_name}`])||(i==null?void 0:i.entities[`${(j=n.value)==null?void 0:j.base_model}/onnx/${(_=n.value)==null?void 0:_.model_name}`]))??null},[(y=n.value)==null?void 0:y.base_model,(x=n.value)==null?void 0:x.model_name,d==null?void 0:d.entities,i==null?void 0:i.entities]),b=l.useCallback(C=>{if(!C)return;const S=y0(C);S&&r(oP({nodeId:t,fieldName:n.name,value:S}))},[r,n.name,t]);return a.jsxs(N,{sx:{w:"full",alignItems:"center",gap:2},children:[h?a.jsx(Se,{variant:"subtext",children:"Loading..."}):a.jsx(tr,{className:"nowheel nodrag",tooltip:g==null?void 0:g.description,value:g==null?void 0:g.id,placeholder:m.length>0?s("models.selectModel"):s("models.noModelsAvailable"),data:m,error:!g,disabled:m.length===0,onChange:b,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),o&&a.jsx(Gu,{className:"nodrag",iconMode:!0})]})},xie=l.memo(bie),eg=/^-?(0\.)?\.?$/,lR=Oe((e,t)=>{const{label:n,isDisabled:r=!1,showStepper:o=!0,isInvalid:s,value:i,onChange:c,min:d,max:p,isInteger:h=!0,formControlProps:m,formLabelProps:g,numberInputFieldProps:b,numberInputStepperProps:y,tooltipProps:x,...C}=e,S=oe(),[j,_]=l.useState(String(i));l.useEffect(()=>{!j.match(eg)&&i!==Number(j)&&_(String(i))},[i,j]);const I=l.useCallback(A=>{_(A),A.match(eg)||c(h?Math.floor(Number(A)):Number(A))},[h,c]),P=l.useCallback(A=>{const D=Bl(h?Math.floor(Number(A.target.value)):Number(A.target.value),d,p);_(String(D)),c(D)},[h,p,d,c]),M=l.useCallback(A=>{A.shiftKey&&S(Uo(!0))},[S]),R=l.useCallback(A=>{A.shiftKey||S(Uo(!1))},[S]);return a.jsx(Fn,{...x,children:a.jsxs(Bn,{ref:t,isDisabled:r,isInvalid:s,...m,children:[n&&a.jsx(vr,{...g,children:n}),a.jsxs(_g,{value:j,min:d,max:p,keepWithinRange:!0,clampValueOnBlur:!1,onChange:I,onBlur:P,...C,onPaste:$2,children:[a.jsx(Pg,{...b,onKeyDown:M,onKeyUp:R}),o&&a.jsxs(Ig,{children:[a.jsx(Mg,{...y}),a.jsx(Eg,{...y})]})]})]})})});lR.displayName="IAINumberInput";const ja=l.memo(lR),yie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=oe(),[s,i]=l.useState(String(n.value)),c=l.useMemo(()=>r.type==="integer",[r.type]),d=l.useCallback(p=>{i(p),p.match(eg)||o(D7({nodeId:t,fieldName:n.name,value:c?Math.floor(Number(p)):Number(p)}))},[o,n.name,c,t]);return l.useEffect(()=>{!s.match(eg)&&n.value!==Number(s)&&i(String(n.value))},[n.value,s]),a.jsxs(_g,{onChange:d,value:s,step:c?1:.1,precision:c?0:3,children:[a.jsx(Pg,{className:"nodrag"}),a.jsxs(Ig,{children:[a.jsx(Mg,{}),a.jsx(Eg,{})]})]})},Cie=l.memo(yie),wie=e=>{var m,g;const{nodeId:t,field:n}=e,r=oe(),{t:o}=J(),s=jn("syncModels").isFeatureEnabled,{data:i,isLoading:c}=na(Fx),d=l.useMemo(()=>{if(!i)return[];const b=[];return Kr(i.entities,(y,x)=>{y&&b.push({value:x,label:y.model_name,group:gr[y.base_model]})}),b},[i]),p=l.useMemo(()=>{var b,y;return(i==null?void 0:i.entities[`${(b=n.value)==null?void 0:b.base_model}/main/${(y=n.value)==null?void 0:y.model_name}`])??null},[(m=n.value)==null?void 0:m.base_model,(g=n.value)==null?void 0:g.model_name,i==null?void 0:i.entities]),h=l.useCallback(b=>{if(!b)return;const y=y0(b);y&&r(T7({nodeId:t,fieldName:n.name,value:y}))},[r,n.name,t]);return c?a.jsx(tr,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(tr,{className:"nowheel nodrag",tooltip:p==null?void 0:p.description,value:p==null?void 0:p.id,placeholder:d.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:d,error:!p,disabled:d.length===0,onChange:h,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Gu,{className:"nodrag",iconMode:!0})]})},Sie=l.memo(wie),kie=e=>{var g,b;const{nodeId:t,field:n}=e,r=oe(),{t:o}=J(),s=jn("syncModels").isFeatureEnabled,{data:i}=Wd(Kw),{data:c,isLoading:d}=na(Kw),p=l.useMemo(()=>{if(!c)return[];const y=[];return Kr(c.entities,(x,C)=>{!x||x.base_model!=="sdxl"||y.push({value:C,label:x.model_name,group:gr[x.base_model]})}),i&&Kr(i.entities,(x,C)=>{!x||x.base_model!=="sdxl"||y.push({value:C,label:x.model_name,group:gr[x.base_model]})}),y},[c,i]),h=l.useMemo(()=>{var y,x,C,S;return((c==null?void 0:c.entities[`${(y=n.value)==null?void 0:y.base_model}/main/${(x=n.value)==null?void 0:x.model_name}`])||(i==null?void 0:i.entities[`${(C=n.value)==null?void 0:C.base_model}/onnx/${(S=n.value)==null?void 0:S.model_name}`]))??null},[(g=n.value)==null?void 0:g.base_model,(b=n.value)==null?void 0:b.model_name,c==null?void 0:c.entities,i==null?void 0:i.entities]),m=l.useCallback(y=>{if(!y)return;const x=y0(y);x&&r(oP({nodeId:t,fieldName:n.name,value:x}))},[r,n.name,t]);return d?a.jsx(tr,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(tr,{className:"nowheel nodrag",tooltip:h==null?void 0:h.description,value:h==null?void 0:h.id,placeholder:p.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:p,error:!h,disabled:p.length===0,onChange:m,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Gu,{className:"nodrag",iconMode:!0})]})},jie=l.memo(kie),_ie=de([Ce],({ui:e})=>{const{favoriteSchedulers:t}=e;return{data:Ro(sg,(r,o)=>({value:o,label:r,group:t.includes(o)?"Favorites":void 0})).sort((r,o)=>r.label.localeCompare(o.label))}},_e),Iie=e=>{const{nodeId:t,field:n}=e,r=oe(),{data:o}=H(_ie),s=l.useCallback(i=>{i&&r(N7({nodeId:t,fieldName:n.name,value:i}))},[r,n.name,t]);return a.jsx(tr,{className:"nowheel nodrag",value:n.value,data:o,onChange:s})},Pie=l.memo(Iie),Eie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=oe(),s=l.useCallback(i=>{o($7({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return r.ui_component==="textarea"?a.jsx(vi,{className:"nodrag",onChange:s,value:n.value,rows:5,resize:"none"}):a.jsx(Cs,{onChange:s,value:n.value})},Mie=l.memo(Eie),cR=e=>{const t=Ci("models"),[n,r,o]=e.split("/"),s=L7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({vaeModelId:e,errors:s.error.format()},"Failed to parse VAE model id");return}return s.data},Oie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=oe(),{data:s}=sP(),i=l.useMemo(()=>{if(!s)return[];const p=[{value:"default",label:"Default",group:"Default"}];return Kr(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:gr[h.base_model]})}),p.sort((h,m)=>h.disabled&&!m.disabled?1:-1)},[s]),c=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r]),d=l.useCallback(p=>{if(!p)return;const h=cR(p);h&&o(z7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(tr,{className:"nowheel nodrag",itemComponent:pl,tooltip:c==null?void 0:c.description,value:(c==null?void 0:c.id)??"default",placeholder:"Default",data:i,onChange:d,disabled:i.length===0,error:!c,clearable:!0,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Rie=l.memo(Oie),Aie=e=>{const t=Ci("models"),[n,r,o]=e.split("/"),s=F7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({ipAdapterModelId:e,errors:s.error.format()},"Failed to parse IP-Adapter model id");return}return s.data},Die=e=>{const{nodeId:t,field:n}=e,r=n.value,o=oe(),{data:s}=Px(),i=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/ip_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),c=l.useMemo(()=>{if(!s)return[];const p=[];return Kr(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:gr[h.base_model]})}),p},[s]),d=l.useCallback(p=>{if(!p)return;const h=Aie(p);h&&o(B7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(Ar,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:c,onChange:d,sx:{width:"100%"}})},Tie=l.memo(Die),Nie=e=>{const t=Ci("models"),[n,r,o]=e.split("/"),s=H7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({t2iAdapterModelId:e,errors:s.error.format()},"Failed to parse T2I-Adapter model id");return}return s.data},$ie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=oe(),{data:s}=Ix(),i=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/t2i_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),c=l.useMemo(()=>{if(!s)return[];const p=[];return Kr(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:gr[h.base_model]})}),p},[s]),d=l.useCallback(p=>{if(!p)return;const h=Nie(p);h&&o(W7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(Ar,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:c,onChange:d,sx:{width:"100%"}})},Lie=l.memo($ie),zie=e=>{var c;const{nodeId:t,field:n}=e,r=oe(),{data:o,hasBoards:s}=gf(void 0,{selectFromResult:({data:d})=>{const p=[{label:"None",value:"none"}];return d==null||d.forEach(({board_id:h,board_name:m})=>{p.push({label:m,value:h})}),{data:p,hasBoards:p.length>1}}}),i=l.useCallback(d=>{r(V7({nodeId:t,fieldName:n.name,value:d&&d!=="none"?{board_id:d}:void 0}))},[r,n.name,t]);return a.jsx(tr,{className:"nowheel nodrag",value:((c=n.value)==null?void 0:c.board_id)??"none",data:o,onChange:i,disabled:!s})},Fie=l.memo(zie),Bie=({nodeId:e,fieldName:t})=>{const n=J8(e,t),r=v0(e,t,"input");return(r==null?void 0:r.fieldKind)==="output"?a.jsxs(Te,{p:2,children:["Output field in input: ",n==null?void 0:n.type]}):(n==null?void 0:n.type)==="string"&&(r==null?void 0:r.type)==="string"||(n==null?void 0:n.type)==="StringPolymorphic"&&(r==null?void 0:r.type)==="StringPolymorphic"?a.jsx(Mie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="boolean"&&(r==null?void 0:r.type)==="boolean"||(n==null?void 0:n.type)==="BooleanPolymorphic"&&(r==null?void 0:r.type)==="BooleanPolymorphic"?a.jsx(Qae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="integer"&&(r==null?void 0:r.type)==="integer"||(n==null?void 0:n.type)==="float"&&(r==null?void 0:r.type)==="float"||(n==null?void 0:n.type)==="FloatPolymorphic"&&(r==null?void 0:r.type)==="FloatPolymorphic"||(n==null?void 0:n.type)==="IntegerPolymorphic"&&(r==null?void 0:r.type)==="IntegerPolymorphic"?a.jsx(Cie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="enum"&&(r==null?void 0:r.type)==="enum"?a.jsx(fie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ImageField"&&(r==null?void 0:r.type)==="ImageField"||(n==null?void 0:n.type)==="ImagePolymorphic"&&(r==null?void 0:r.type)==="ImagePolymorphic"?a.jsx(hie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="BoardField"&&(r==null?void 0:r.type)==="BoardField"?a.jsx(Fie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="MainModelField"&&(r==null?void 0:r.type)==="MainModelField"?a.jsx(xie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLRefinerModelField"&&(r==null?void 0:r.type)==="SDXLRefinerModelField"?a.jsx(Sie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="VaeModelField"&&(r==null?void 0:r.type)==="VaeModelField"?a.jsx(Rie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="LoRAModelField"&&(r==null?void 0:r.type)==="LoRAModelField"?a.jsx(vie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ControlNetModelField"&&(r==null?void 0:r.type)==="ControlNetModelField"?a.jsx(uie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="IPAdapterModelField"&&(r==null?void 0:r.type)==="IPAdapterModelField"?a.jsx(Tie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="T2IAdapterModelField"&&(r==null?void 0:r.type)==="T2IAdapterModelField"?a.jsx(Lie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ColorField"&&(r==null?void 0:r.type)==="ColorField"?a.jsx(lie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLMainModelField"&&(r==null?void 0:r.type)==="SDXLMainModelField"?a.jsx(jie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="Scheduler"&&(r==null?void 0:r.type)==="Scheduler"?a.jsx(Pie,{nodeId:e,field:n,fieldTemplate:r}):n&&r?null:a.jsx(Te,{p:1,children:a.jsxs(Se,{sx:{fontSize:"sm",fontWeight:600,color:"error.400",_dark:{color:"error.300"}},children:["Unknown field type: ",n==null?void 0:n.type]})})},uR=l.memo(Bie),Hie=({nodeId:e,fieldName:t})=>{const n=oe(),{isMouseOverNode:r,handleMouseOut:o,handleMouseOver:s}=Q8(e),{t:i}=J(),c=l.useCallback(()=>{n(aP({nodeId:e,fieldName:t}))},[n,t,e]);return a.jsxs(N,{onMouseEnter:s,onMouseLeave:o,layerStyle:"second",sx:{position:"relative",borderRadius:"base",w:"full",p:2},children:[a.jsxs(Bn,{as:N,sx:{flexDir:"column",gap:1,flexShrink:1},children:[a.jsxs(vr,{sx:{display:"flex",alignItems:"center",mb:0},children:[a.jsx(Z8,{nodeId:e,fieldName:t,kind:"input"}),a.jsx(ji,{}),a.jsx(Fn,{label:a.jsx(z2,{nodeId:e,fieldName:t,kind:"input"}),openDelay:ug,placement:"top",hasArrow:!0,children:a.jsx(N,{h:"full",alignItems:"center",children:a.jsx(zr,{as:GM})})}),a.jsx(tt,{"aria-label":i("nodes.removeLinearView"),tooltip:i("nodes.removeLinearView"),variant:"ghost",size:"sm",onClick:c,icon:a.jsx(qo,{})})]}),a.jsx(uR,{nodeId:e,fieldName:t})]}),a.jsx(K8,{isSelected:!1,isHovered:r})]})},Wie=l.memo(Hie),Vie=de(Ce,({nodes:e})=>({fields:e.workflow.exposedFields}),_e),Uie=()=>{const{fields:e}=H(Vie),{t}=J();return a.jsx(Te,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(lc,{children:a.jsx(N,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:e.length?e.map(({nodeId:n,fieldName:r})=>a.jsx(Wie,{nodeId:n,fieldName:r},`${n}.${r}`)):a.jsx(qr,{label:t("nodes.noFieldsLinearview"),icon:null})})})})},Gie=l.memo(Uie),qie=()=>a.jsx(N,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(tc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(nc,{children:[a.jsx(xo,{children:"Linear"}),a.jsx(xo,{children:"Details"}),a.jsx(xo,{children:"JSON"})]}),a.jsxs(zu,{children:[a.jsx(Ho,{children:a.jsx(Gie,{})}),a.jsx(Ho,{children:a.jsx(Hae,{})}),a.jsx(Ho,{children:a.jsx(Vae,{})})]})]})}),Kie=l.memo(qie),Qie={paramNegativeConditioning:{placement:"right"},controlNet:{href:"https://support.invoke.ai/support/solutions/articles/151000105880"},lora:{href:"https://support.invoke.ai/support/solutions/articles/151000159072"},compositingCoherenceMode:{href:"https://support.invoke.ai/support/solutions/articles/151000158838"},infillMethod:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},scaleBeforeProcessing:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},paramIterations:{href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramPositiveConditioning:{href:"https://support.invoke.ai/support/solutions/articles/151000096606-tips-on-crafting-prompts",placement:"right"},paramScheduler:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramModel:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000096601-what-is-a-model-which-should-i-use-"},paramRatio:{gutter:16},controlNetControlMode:{placement:"right"},controlNetResizeMode:{placement:"right"},paramVAE:{placement:"right"},paramVAEPrecision:{placement:"right"}},Xie=1e3,Yie=[{name:"preventOverflow",options:{padding:10}}],dR=Oe(({feature:e,children:t,wrapperProps:n,...r},o)=>{const{t:s}=J(),i=H(g=>g.system.shouldEnableInformationalPopovers),c=l.useMemo(()=>Qie[e],[e]),d=l.useMemo(()=>U7(G7(c,["image","href","buttonLabel"]),r),[c,r]),p=l.useMemo(()=>s(`popovers.${e}.heading`),[e,s]),h=l.useMemo(()=>s(`popovers.${e}.paragraphs`,{returnObjects:!0})??[],[e,s]),m=l.useCallback(()=>{c!=null&&c.href&&window.open(c.href)},[c==null?void 0:c.href]);return i?a.jsxs(Nf,{isLazy:!0,closeOnBlur:!1,trigger:"hover",variant:"informational",openDelay:Xie,modifiers:Yie,placement:"top",...d,children:[a.jsx(Rg,{children:a.jsx(Te,{ref:o,w:"full",...n,children:t})}),a.jsx(Ru,{children:a.jsxs($f,{w:96,children:[a.jsx(y3,{}),a.jsx(Ag,{children:a.jsxs(N,{sx:{gap:2,flexDirection:"column",alignItems:"flex-start"},children:[p&&a.jsxs(a.Fragment,{children:[a.jsx(vo,{size:"sm",children:p}),a.jsx(no,{})]}),(c==null?void 0:c.image)&&a.jsxs(a.Fragment,{children:[a.jsx(Si,{sx:{objectFit:"contain",maxW:"60%",maxH:"60%",backgroundColor:"white"},src:c.image,alt:"Optional Image"}),a.jsx(no,{})]}),h.map(g=>a.jsx(Se,{children:g},g)),(c==null?void 0:c.href)&&a.jsxs(a.Fragment,{children:[a.jsx(no,{}),a.jsx(tl,{pt:1,onClick:m,leftIcon:a.jsx(Ky,{}),alignSelf:"flex-end",variant:"link",children:s("common.learnMore")??p})]})]})})]})})]}):a.jsx(Te,{ref:o,w:"full",...n,children:t})});dR.displayName="IAIInformationalPopover";const wn=l.memo(dR),Jie=de([Ce],e=>{const{initial:t,min:n,sliderMax:r,inputMax:o,fineStep:s,coarseStep:i}=e.config.sd.iterations,{iterations:c}=e.generation,{shouldUseSliders:d}=e.ui,p=e.hotkeys.shift?s:i;return{iterations:c,initial:t,min:n,sliderMax:r,inputMax:o,step:p,shouldUseSliders:d}},_e),Zie=({asSlider:e})=>{const{iterations:t,initial:n,min:r,sliderMax:o,inputMax:s,step:i,shouldUseSliders:c}=H(Jie),d=oe(),{t:p}=J(),h=l.useCallback(g=>{d(Qw(g))},[d]),m=l.useCallback(()=>{d(Qw(n))},[d,n]);return e||c?a.jsx(wn,{feature:"paramIterations",children:a.jsx(Pt,{label:p("parameters.iterations"),step:i,min:r,max:o,onChange:h,handleReset:m,value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s}})}):a.jsx(wn,{feature:"paramIterations",children:a.jsx(ja,{label:p("parameters.iterations"),step:i,min:r,max:s,onChange:h,value:t,numberInputFieldProps:{textAlign:"center"}})})},ia=l.memo(Zie),ele=()=>{const[e,t]=l.useState(!1),[n,r]=l.useState(!1),o=l.useRef(null),s=N2(),i=l.useCallback(()=>{o.current&&o.current.setLayout([50,50])},[]);return a.jsxs(N,{sx:{flexDir:"column",gap:2,height:"100%",width:"100%"},children:[a.jsx(O8,{}),a.jsx(N,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,pb:3,gap:2,flexDir:"column"},children:a.jsx(ia,{asSlider:!0})}),a.jsxs(g0,{ref:o,id:"workflow-panel-group",autoSaveId:"workflow-panel-group",direction:"vertical",style:{height:"100%",width:"100%"},storage:s,children:[a.jsx(Zi,{id:"workflow",collapsible:!0,onCollapse:t,minSize:25,children:a.jsx(Kie,{})}),a.jsx(Zm,{direction:"vertical",onDoubleClick:i,collapsedDirection:e?"top":n?"bottom":void 0}),a.jsx(Zi,{id:"inspector",collapsible:!0,onCollapse:r,minSize:25,children:a.jsx($ae,{})})]})]})},tle=l.memo(ele),k_=(e,t)=>{const n=l.useRef(null),[r,o]=l.useState(()=>{var p;return!!((p=n.current)!=null&&p.getCollapsed())}),s=l.useCallback(()=>{var p;(p=n.current)!=null&&p.getCollapsed()?rs.flushSync(()=>{var h;(h=n.current)==null||h.expand()}):rs.flushSync(()=>{var h;(h=n.current)==null||h.collapse()})},[]),i=l.useCallback(()=>{rs.flushSync(()=>{var p;(p=n.current)==null||p.expand()})},[]),c=l.useCallback(()=>{rs.flushSync(()=>{var p;(p=n.current)==null||p.collapse()})},[]),d=l.useCallback(()=>{rs.flushSync(()=>{var p;(p=n.current)==null||p.resize(e,t)})},[e,t]);return{ref:n,minSize:e,isCollapsed:r,setIsCollapsed:o,reset:d,toggle:s,expand:i,collapse:c}},nle=({isGalleryCollapsed:e,galleryPanelRef:t})=>{const{t:n}=J(),r=l.useCallback(()=>{var o;(o=t.current)==null||o.expand()},[t]);return e?a.jsx(Ru,{children:a.jsx(N,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineEnd:"1.63rem",children:a.jsx(tt,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":n("accessibility.showGalleryPanel"),onClick:r,icon:a.jsx(qoe,{}),sx:{p:0,px:3,h:48,borderEndRadius:0}})})}):null},rle=l.memo(nle),bh={borderStartRadius:0,flexGrow:1},ole=({isSidePanelCollapsed:e,sidePanelRef:t})=>{const{t:n}=J(),r=l.useCallback(()=>{var o;(o=t.current)==null||o.expand()},[t]);return e?a.jsx(Ru,{children:a.jsxs(N,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineStart:"5.13rem",direction:"column",gap:2,h:48,children:[a.jsxs(zn,{isAttached:!0,orientation:"vertical",flexGrow:3,children:[a.jsx(tt,{tooltip:n("parameters.showOptionsPanel"),"aria-label":n("parameters.showOptionsPanel"),onClick:r,sx:bh,icon:a.jsx(JM,{})}),a.jsx(P8,{asIconButton:!0,sx:bh}),a.jsx(S8,{asIconButton:!0,sx:bh})]}),a.jsx(O2,{asIconButton:!0,sx:bh})]})}):null},sle=l.memo(ole),ale=e=>{const{label:t,activeLabel:n,children:r,defaultIsOpen:o=!1}=e,{isOpen:s,onToggle:i}=ls({defaultIsOpen:o}),{colorMode:c}=wi();return a.jsxs(Te,{children:[a.jsxs(N,{onClick:i,sx:{alignItems:"center",p:2,px:4,gap:2,borderTopRadius:"base",borderBottomRadius:s?0:"base",bg:Ke("base.250","base.750")(c),color:Ke("base.900","base.100")(c),_hover:{bg:Ke("base.300","base.700")(c)},fontSize:"sm",fontWeight:600,cursor:"pointer",transitionProperty:"common",transitionDuration:"normal",userSelect:"none"},"data-testid":`${t} collapsible`,children:[t,a.jsx(yo,{children:n&&a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(Se,{sx:{color:"accent.500",_dark:{color:"accent.300"}},children:n})},"statusText")}),a.jsx(ji,{}),a.jsx(s0,{sx:{w:"1rem",h:"1rem",transform:s?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]}),a.jsx(Sf,{in:s,animateOpacity:!0,style:{overflow:"unset"},children:a.jsx(Te,{sx:{p:4,pb:4,borderBottomRadius:"base",bg:"base.150",_dark:{bg:"base.800"}},children:r})})]})},Ao=l.memo(ale),ile=de(Ce,e=>{const{maxPrompts:t,combinatorial:n}=e.dynamicPrompts,{min:r,sliderMax:o,inputMax:s}=e.config.sd.dynamicPrompts.maxPrompts;return{maxPrompts:t,min:r,sliderMax:o,inputMax:s,isDisabled:!n}},_e),lle=()=>{const{maxPrompts:e,min:t,sliderMax:n,inputMax:r,isDisabled:o}=H(ile),s=oe(),{t:i}=J(),c=l.useCallback(p=>{s(q7(p))},[s]),d=l.useCallback(()=>{s(K7())},[s]);return a.jsx(wn,{feature:"dynamicPromptsMaxPrompts",children:a.jsx(Pt,{label:i("dynamicPrompts.maxPrompts"),isDisabled:o,min:t,max:n,value:e,onChange:c,sliderNumberInputProps:{max:r},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})})},cle=l.memo(lle),ule=de(Ce,e=>{const{isLoading:t,isError:n,prompts:r,parsingError:o}=e.dynamicPrompts;return{prompts:r,parsingError:o,isError:n,isLoading:t}},_e),dle={"&::marker":{color:"base.500",_dark:{color:"base.500"}}},fle=()=>{const{prompts:e,parsingError:t,isLoading:n,isError:r}=H(ule);return r?a.jsx(wn,{feature:"dynamicPrompts",children:a.jsx(N,{w:"full",h:"full",layerStyle:"second",alignItems:"center",justifyContent:"center",p:8,children:a.jsx(qr,{icon:Boe,label:"Problem generating prompts"})})}):a.jsx(wn,{feature:"dynamicPrompts",children:a.jsxs(Bn,{isInvalid:!!t,children:[a.jsxs(vr,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:["Prompts Preview (",e.length,")",t&&` - ${t}`]}),a.jsxs(N,{h:64,pos:"relative",layerStyle:"third",borderRadius:"base",p:2,children:[a.jsx(lc,{children:a.jsx(H5,{stylePosition:"inside",ms:0,children:e.map((o,s)=>a.jsx(ws,{fontSize:"sm",sx:dle,children:a.jsx(Se,{as:"span",children:o})},`${o}.${s}`))})}),n&&a.jsx(N,{pos:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,layerStyle:"second",opacity:.7,alignItems:"center",justifyContent:"center",children:a.jsx(bi,{})})]})]})})},ple=l.memo(fle),fR=l.forwardRef(({label:e,description:t,...n},r)=>a.jsx(Te,{ref:r,...n,children:a.jsxs(Te,{children:[a.jsx(Se,{fontWeight:600,children:e}),t&&a.jsx(Se,{size:"xs",variant:"subtext",children:t})]})}));fR.displayName="IAIMantineSelectItemWithDescription";const hle=l.memo(fR),mle=()=>{const e=oe(),{t}=J(),n=H(s=>s.dynamicPrompts.seedBehaviour),r=l.useMemo(()=>[{value:"PER_ITERATION",label:t("dynamicPrompts.seedBehaviour.perIterationLabel"),description:t("dynamicPrompts.seedBehaviour.perIterationDesc")},{value:"PER_PROMPT",label:t("dynamicPrompts.seedBehaviour.perPromptLabel"),description:t("dynamicPrompts.seedBehaviour.perPromptDesc")}],[t]),o=l.useCallback(s=>{s&&e(Q7(s))},[e]);return a.jsx(wn,{feature:"dynamicPromptsSeedBehaviour",children:a.jsx(Ar,{label:t("dynamicPrompts.seedBehaviour.label"),value:n,data:r,itemComponent:hle,onChange:o})})},gle=l.memo(mle),vle=()=>{const{t:e}=J(),t=l.useMemo(()=>de(Ce,({dynamicPrompts:o})=>{const s=o.prompts.length;if(s>1)return e("dynamicPrompts.promptsWithCount_other",{count:s})}),[e]),n=H(t);return jn("dynamicPrompting").isFeatureEnabled?a.jsx(Ao,{label:e("dynamicPrompts.dynamicPrompts"),activeLabel:n,children:a.jsxs(N,{sx:{gap:2,flexDir:"column"},children:[a.jsx(ple,{}),a.jsx(gle,{}),a.jsx(cle,{})]})}):null},qu=l.memo(vle),ble=e=>{const t=oe(),{lora:n}=e,r=l.useCallback(i=>{t(X7({id:n.id,weight:i}))},[t,n.id]),o=l.useCallback(()=>{t(Y7(n.id))},[t,n.id]),s=l.useCallback(()=>{t(J7(n.id))},[t,n.id]);return a.jsx(wn,{feature:"lora",children:a.jsxs(N,{sx:{gap:2.5,alignItems:"flex-end"},children:[a.jsx(Pt,{label:n.model_name,value:n.weight,onChange:r,min:-1,max:2,step:.01,withInput:!0,withReset:!0,handleReset:o,withSliderMarks:!0,sliderMarks:[-1,0,1,2],sliderNumberInputProps:{min:-50,max:50}}),a.jsx(tt,{size:"sm",onClick:s,tooltip:"Remove LoRA","aria-label":"Remove LoRA",icon:a.jsx(qo,{}),colorScheme:"error"})]})})},xle=l.memo(ble),yle=de(Ce,({lora:e})=>({lorasArray:Ro(e.loras)}),_e),Cle=()=>{const{lorasArray:e}=H(yle);return a.jsx(a.Fragment,{children:e.map((t,n)=>a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[n>0&&a.jsx(no,{pt:1}),a.jsx(xle,{lora:t})]},t.model_name))})},wle=l.memo(Cle),Sle=de(Ce,({lora:e})=>({loras:e.loras}),_e),kle=()=>{const e=oe(),{loras:t}=H(Sle),{data:n}=vf(),{t:r}=J(),o=H(d=>d.generation.model),s=l.useMemo(()=>{if(!n)return[];const d=[];return Kr(n.entities,(p,h)=>{if(!p||h in t)return;const m=(o==null?void 0:o.base_model)!==p.base_model;d.push({value:h,label:p.model_name,disabled:m,group:gr[p.base_model],tooltip:m?`Incompatible base model: ${p.base_model}`:void 0})}),d.sort((p,h)=>p.label&&!h.label?1:-1),d.sort((p,h)=>p.disabled&&!h.disabled?1:-1)},[t,n,o==null?void 0:o.base_model]),i=l.useCallback(d=>{if(!d)return;const p=n==null?void 0:n.entities[d];p&&e(Z7(p))},[e,n==null?void 0:n.entities]),c=l.useCallback((d,p)=>{var h;return((h=p.label)==null?void 0:h.toLowerCase().includes(d.toLowerCase().trim()))||p.value.toLowerCase().includes(d.toLowerCase().trim())},[]);return(n==null?void 0:n.ids.length)===0?a.jsx(N,{sx:{justifyContent:"center",p:2},children:a.jsx(Se,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:r("models.noLoRAsInstalled")})}):a.jsx(tr,{placeholder:s.length===0?"All LoRAs added":"Add LoRA",value:null,data:s,nothingFound:"No matching LoRAs",itemComponent:pl,disabled:s.length===0,filter:c,onChange:i,"data-testid":"add-lora"})},jle=l.memo(kle),_le=de(Ce,e=>{const t=iP(e.lora.loras);return{activeLabel:t>0?`${t} Active`:void 0}},_e),Ile=()=>{const{t:e}=J(),{activeLabel:t}=H(_le);return jn("lora").isFeatureEnabled?a.jsx(Ao,{label:e("modelManager.loraModels"),activeLabel:t,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsx(jle,{}),a.jsx(wle,{})]})}):null},Ku=l.memo(Ile),Ple=()=>{const e=oe(),t=H(o=>o.generation.shouldUseCpuNoise),{t:n}=J(),r=l.useCallback(o=>{e(eT(o.target.checked))},[e]);return a.jsx(wn,{feature:"noiseUseCPU",children:a.jsx(jr,{label:n("parameters.useCpuNoise"),isChecked:t,onChange:r})})},la=e=>e.generation,Ele=de(la,e=>{const{seamlessXAxis:t}=e;return{seamlessXAxis:t}},_e),Mle=()=>{const{t:e}=J(),{seamlessXAxis:t}=H(Ele),n=oe(),r=l.useCallback(o=>{n(tT(o.target.checked))},[n]);return a.jsx(jr,{label:e("parameters.seamlessXAxis"),"aria-label":e("parameters.seamlessXAxis"),isChecked:t,onChange:r})},Ole=l.memo(Mle),Rle=de(la,e=>{const{seamlessYAxis:t}=e;return{seamlessYAxis:t}},_e),Ale=()=>{const{t:e}=J(),{seamlessYAxis:t}=H(Rle),n=oe(),r=l.useCallback(o=>{n(nT(o.target.checked))},[n]);return a.jsx(jr,{label:e("parameters.seamlessYAxis"),"aria-label":e("parameters.seamlessYAxis"),isChecked:t,onChange:r})},Dle=l.memo(Ale),Tle=()=>{const{t:e}=J();return jn("seamless").isFeatureEnabled?a.jsxs(Bn,{children:[a.jsx(vr,{children:e("parameters.seamlessTiling")})," ",a.jsxs(N,{sx:{gap:5},children:[a.jsx(Te,{flexGrow:1,children:a.jsx(Ole,{})}),a.jsx(Te,{flexGrow:1,children:a.jsx(Dle,{})})]})]}):null},Nle=l.memo(Tle);function $le(){const e=H(d=>d.generation.clipSkip),{model:t}=H(d=>d.generation),n=oe(),{t:r}=J(),o=l.useCallback(d=>{n(Xw(d))},[n]),s=l.useCallback(()=>{n(Xw(0))},[n]),i=l.useMemo(()=>t?$p[t.base_model].maxClip:$p["sd-1"].maxClip,[t]),c=l.useMemo(()=>t?$p[t.base_model].markers:$p["sd-1"].markers,[t]);return(t==null?void 0:t.base_model)==="sdxl"?null:a.jsx(wn,{feature:"clipSkip",placement:"top",children:a.jsx(Pt,{label:r("parameters.clipSkip"),"aria-label":r("parameters.clipSkip"),min:0,max:i,step:1,value:e,onChange:o,withSliderMarks:!0,sliderMarks:c,withInput:!0,withReset:!0,handleReset:s})})}const Lle=de(Ce,e=>{const{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}=e.generation;return{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}},_e);function Qu(){const{clipSkip:e,model:t,seamlessXAxis:n,seamlessYAxis:r,shouldUseCpuNoise:o}=H(Lle),{t:s}=J(),i=l.useMemo(()=>{const c=[];return o||c.push(s("parameters.gpuNoise")),e>0&&t&&t.base_model!=="sdxl"&&c.push(s("parameters.clipSkipWithLayerCount",{layerCount:e})),n&&r?c.push(s("parameters.seamlessX&Y")):n?c.push(s("parameters.seamlessX")):r&&c.push(s("parameters.seamlessY")),c.join(", ")},[e,t,n,r,o,s]);return a.jsx(Ao,{label:s("common.advanced"),activeLabel:i,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsx(Nle,{}),a.jsx(no,{}),t&&(t==null?void 0:t.base_model)!=="sdxl"&&a.jsxs(a.Fragment,{children:[a.jsx($le,{}),a.jsx(no,{pt:2})]}),a.jsx(Ple,{})]})})}const Pi=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{var o;return((o=Rs(r,e))==null?void 0:o.isEnabled)??!1},_e),[e]);return H(t)},zle=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.model},_e),[e]);return H(t)},pR=e=>{const{data:t}=_x(),n=l.useMemo(()=>t?LI.getSelectors().selectAll(t):[],[t]),{data:r}=Ix(),o=l.useMemo(()=>r?zI.getSelectors().selectAll(r):[],[r]),{data:s}=Px(),i=l.useMemo(()=>s?FI.getSelectors().selectAll(s):[],[s]);return e==="controlnet"?n:e==="t2i_adapter"?o:e==="ip_adapter"?i:[]},hR=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.type},_e),[e]);return H(t)},Fle=de(Ce,({generation:e})=>{const{model:t}=e;return{mainModel:t}},_e),Ble=({id:e})=>{const t=Pi(e),n=hR(e),r=zle(e),o=oe(),{mainModel:s}=H(Fle),{t:i}=J(),c=pR(n),d=l.useMemo(()=>{if(!c)return[];const m=[];return c.forEach(g=>{if(!g)return;const b=(g==null?void 0:g.base_model)!==(s==null?void 0:s.base_model);m.push({value:g.id,label:g.model_name,group:gr[g.base_model],disabled:b,tooltip:b?`${i("controlnet.incompatibleBaseModel")} ${g.base_model}`:void 0})}),m.sort((g,b)=>g.disabled?1:b.disabled?-1:g.label.localeCompare(b.label)),m},[s==null?void 0:s.base_model,c,i]),p=l.useMemo(()=>c.find(m=>(m==null?void 0:m.id)===`${r==null?void 0:r.base_model}/${n}/${r==null?void 0:r.model_name}`),[n,r==null?void 0:r.base_model,r==null?void 0:r.model_name,c]),h=l.useCallback(m=>{if(!m)return;const g=sR(m);g&&o(rT({id:e,model:g}))},[o,e]);return a.jsx(tr,{itemComponent:pl,data:d,error:!p||(s==null?void 0:s.base_model)!==p.base_model,placeholder:i("controlnet.selectModel"),value:(p==null?void 0:p.id)??null,onChange:h,disabled:!t,tooltip:p==null?void 0:p.description})},Hle=l.memo(Ble),Wle=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.weight},_e),[e]);return H(t)},Vle=({id:e})=>{const t=Pi(e),n=Wle(e),r=oe(),{t:o}=J(),s=l.useCallback(i=>{r(oT({id:e,weight:i}))},[r,e]);return oi(n)?null:a.jsx(wn,{feature:"controlNetWeight",children:a.jsx(Pt,{isDisabled:!t,label:o("controlnet.weight"),value:n,onChange:s,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2]})})},Ule=l.memo(Vle),Gle=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.controlImage},_e),[e]);return H(t)},qle=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{const o=Rs(r,e);return o&&Au(o)?o.processedControlImage:void 0},_e),[e]);return H(t)},Kle=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{const o=Rs(r,e);return o&&Au(o)?o.processorType:void 0},_e),[e]);return H(t)},Qle=de(Ce,({controlAdapters:e,gallery:t})=>{const{pendingControlImages:n}=e,{autoAddBoardId:r}=t;return{pendingControlImages:n,autoAddBoardId:r}},_e),Xle=({isSmall:e,id:t})=>{const n=Gle(t),r=qle(t),o=Kle(t),s=oe(),{t:i}=J(),{pendingControlImages:c,autoAddBoardId:d}=H(Qle),p=H(ro),[h,m]=l.useState(!1),{currentData:g}=Ps(n??Os.skipToken),{currentData:b}=Ps(r??Os.skipToken),[y]=sT(),[x]=aT(),[C]=iT(),S=l.useCallback(()=>{s(lT({id:t,controlImage:null}))},[t,s]),j=l.useCallback(async()=>{b&&(await y({imageDTO:b,is_intermediate:!1}).unwrap(),d!=="none"?x({imageDTO:b,board_id:d}):C({imageDTO:b}))},[b,y,d,x,C]),_=l.useCallback(()=>{g&&(p==="unifiedCanvas"?s(Xs({width:g.width,height:g.height})):(s(Hl(g.width)),s(Wl(g.height))))},[g,p,s]),I=l.useCallback(()=>{m(!0)},[]),P=l.useCallback(()=>{m(!1)},[]),M=l.useMemo(()=>{if(g)return{id:t,payloadType:"IMAGE_DTO",payload:{imageDTO:g}}},[g,t]),R=l.useMemo(()=>({id:t,actionType:"SET_CONTROL_ADAPTER_IMAGE",context:{id:t}}),[t]),A=l.useMemo(()=>({type:"SET_CONTROL_ADAPTER_IMAGE",id:t}),[t]),D=g&&b&&!h&&!c.includes(t)&&o!=="none";return a.jsxs(N,{onMouseEnter:I,onMouseLeave:P,sx:{position:"relative",w:"full",h:e?28:366,alignItems:"center",justifyContent:"center"},children:[a.jsx(il,{draggableData:M,droppableData:R,imageDTO:g,isDropDisabled:D,postUploadAction:A}),a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",opacity:D?1:0,transitionProperty:"common",transitionDuration:"normal",pointerEvents:"none"},children:a.jsx(il,{draggableData:M,droppableData:R,imageDTO:b,isUploadDisabled:!0})}),a.jsxs(a.Fragment,{children:[a.jsx(fu,{onClick:S,icon:g?a.jsx(Yg,{}):void 0,tooltip:i("controlnet.resetControlImage")}),a.jsx(fu,{onClick:j,icon:g?a.jsx(Qg,{size:16}):void 0,tooltip:i("controlnet.saveControlImage"),styleOverrides:{marginTop:6}}),a.jsx(fu,{onClick:_,icon:g?a.jsx(wee,{size:16}):void 0,tooltip:i("controlnet.setControlImageDimensions"),styleOverrides:{marginTop:12}})]}),c.includes(t)&&a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",alignItems:"center",justifyContent:"center",opacity:.8,borderRadius:"base",bg:"base.400",_dark:{bg:"base.900"}},children:a.jsx(bi,{size:"xl",sx:{color:"base.100",_dark:{color:"base.400"}}})})]})},j_=l.memo(Xle),Ds=()=>{const e=oe();return l.useCallback((n,r)=>{e(cT({id:n,params:r}))},[e])};function Ts(e){return a.jsx(N,{sx:{flexDirection:"column",gap:2,pb:2},children:e.children})}const __=Oo.canny_image_processor.default,Yle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{low_threshold:o,high_threshold:s}=n,i=Ds(),{t:c}=J(),d=l.useCallback(g=>{i(t,{low_threshold:g})},[t,i]),p=l.useCallback(()=>{i(t,{low_threshold:__.low_threshold})},[t,i]),h=l.useCallback(g=>{i(t,{high_threshold:g})},[t,i]),m=l.useCallback(()=>{i(t,{high_threshold:__.high_threshold})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(Pt,{isDisabled:!r,label:c("controlnet.lowThreshold"),value:o,onChange:d,handleReset:p,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0}),a.jsx(Pt,{isDisabled:!r,label:c("controlnet.highThreshold"),value:s,onChange:h,handleReset:m,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0})]})},Jle=l.memo(Yle),Zle=Oo.color_map_image_processor.default,ece=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{color_map_tile_size:o}=n,s=Ds(),{t:i}=J(),c=l.useCallback(p=>{s(t,{color_map_tile_size:p})},[t,s]),d=l.useCallback(()=>{s(t,{color_map_tile_size:Zle.color_map_tile_size})},[t,s]);return a.jsx(Ts,{children:a.jsx(Pt,{isDisabled:!r,label:i("controlnet.colorMapTileSize"),value:o,onChange:c,handleReset:d,withReset:!0,min:1,max:256,step:1,withInput:!0,withSliderMarks:!0,sliderNumberInputProps:{max:4096}})})},tce=l.memo(ece),wd=Oo.content_shuffle_image_processor.default,nce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,w:i,h:c,f:d}=n,p=Ds(),{t:h}=J(),m=l.useCallback(P=>{p(t,{detect_resolution:P})},[t,p]),g=l.useCallback(()=>{p(t,{detect_resolution:wd.detect_resolution})},[t,p]),b=l.useCallback(P=>{p(t,{image_resolution:P})},[t,p]),y=l.useCallback(()=>{p(t,{image_resolution:wd.image_resolution})},[t,p]),x=l.useCallback(P=>{p(t,{w:P})},[t,p]),C=l.useCallback(()=>{p(t,{w:wd.w})},[t,p]),S=l.useCallback(P=>{p(t,{h:P})},[t,p]),j=l.useCallback(()=>{p(t,{h:wd.h})},[t,p]),_=l.useCallback(P=>{p(t,{f:P})},[t,p]),I=l.useCallback(()=>{p(t,{f:wd.f})},[t,p]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:h("controlnet.detectResolution"),value:s,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:h("controlnet.imageResolution"),value:o,onChange:b,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:h("controlnet.w"),value:i,onChange:x,handleReset:C,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:h("controlnet.h"),value:c,onChange:S,handleReset:j,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:h("controlnet.f"),value:d,onChange:_,handleReset:I,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},rce=l.memo(nce),I_=Oo.hed_image_processor.default,oce=e=>{const{controlNetId:t,processorNode:{detect_resolution:n,image_resolution:r,scribble:o},isEnabled:s}=e,i=Ds(),{t:c}=J(),d=l.useCallback(b=>{i(t,{detect_resolution:b})},[t,i]),p=l.useCallback(b=>{i(t,{image_resolution:b})},[t,i]),h=l.useCallback(b=>{i(t,{scribble:b.target.checked})},[t,i]),m=l.useCallback(()=>{i(t,{detect_resolution:I_.detect_resolution})},[t,i]),g=l.useCallback(()=>{i(t,{image_resolution:I_.image_resolution})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:c("controlnet.detectResolution"),value:n,onChange:d,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(Pt,{label:c("controlnet.imageResolution"),value:r,onChange:p,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(jr,{label:c("controlnet.scribble"),isChecked:o,onChange:h,isDisabled:!s})]})},sce=l.memo(oce),P_=Oo.lineart_anime_image_processor.default,ace=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Ds(),{t:c}=J(),d=l.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=l.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),h=l.useCallback(()=>{i(t,{detect_resolution:P_.detect_resolution})},[t,i]),m=l.useCallback(()=>{i(t,{image_resolution:P_.image_resolution})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:c("controlnet.detectResolution"),value:s,onChange:d,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:c("controlnet.imageResolution"),value:o,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},ice=l.memo(ace),E_=Oo.lineart_image_processor.default,lce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,coarse:i}=n,c=Ds(),{t:d}=J(),p=l.useCallback(y=>{c(t,{detect_resolution:y})},[t,c]),h=l.useCallback(y=>{c(t,{image_resolution:y})},[t,c]),m=l.useCallback(()=>{c(t,{detect_resolution:E_.detect_resolution})},[t,c]),g=l.useCallback(()=>{c(t,{image_resolution:E_.image_resolution})},[t,c]),b=l.useCallback(y=>{c(t,{coarse:y.target.checked})},[t,c]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:d("controlnet.detectResolution"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:d("controlnet.imageResolution"),value:o,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jr,{label:d("controlnet.coarse"),isChecked:i,onChange:b,isDisabled:!r})]})},cce=l.memo(lce),M_=Oo.mediapipe_face_processor.default,uce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{max_faces:o,min_confidence:s}=n,i=Ds(),{t:c}=J(),d=l.useCallback(g=>{i(t,{max_faces:g})},[t,i]),p=l.useCallback(g=>{i(t,{min_confidence:g})},[t,i]),h=l.useCallback(()=>{i(t,{max_faces:M_.max_faces})},[t,i]),m=l.useCallback(()=>{i(t,{min_confidence:M_.min_confidence})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:c("controlnet.maxFaces"),value:o,onChange:d,handleReset:h,withReset:!0,min:1,max:20,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:c("controlnet.minConfidence"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},dce=l.memo(uce),O_=Oo.midas_depth_image_processor.default,fce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{a_mult:o,bg_th:s}=n,i=Ds(),{t:c}=J(),d=l.useCallback(g=>{i(t,{a_mult:g})},[t,i]),p=l.useCallback(g=>{i(t,{bg_th:g})},[t,i]),h=l.useCallback(()=>{i(t,{a_mult:O_.a_mult})},[t,i]),m=l.useCallback(()=>{i(t,{bg_th:O_.bg_th})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:c("controlnet.amult"),value:o,onChange:d,handleReset:h,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:c("controlnet.bgth"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},pce=l.memo(fce),xh=Oo.mlsd_image_processor.default,hce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,thr_d:i,thr_v:c}=n,d=Ds(),{t:p}=J(),h=l.useCallback(j=>{d(t,{detect_resolution:j})},[t,d]),m=l.useCallback(j=>{d(t,{image_resolution:j})},[t,d]),g=l.useCallback(j=>{d(t,{thr_d:j})},[t,d]),b=l.useCallback(j=>{d(t,{thr_v:j})},[t,d]),y=l.useCallback(()=>{d(t,{detect_resolution:xh.detect_resolution})},[t,d]),x=l.useCallback(()=>{d(t,{image_resolution:xh.image_resolution})},[t,d]),C=l.useCallback(()=>{d(t,{thr_d:xh.thr_d})},[t,d]),S=l.useCallback(()=>{d(t,{thr_v:xh.thr_v})},[t,d]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:p("controlnet.detectResolution"),value:s,onChange:h,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:p("controlnet.imageResolution"),value:o,onChange:m,handleReset:x,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:p("controlnet.w"),value:i,onChange:g,handleReset:C,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:p("controlnet.h"),value:c,onChange:b,handleReset:S,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},mce=l.memo(hce),R_=Oo.normalbae_image_processor.default,gce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Ds(),{t:c}=J(),d=l.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=l.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),h=l.useCallback(()=>{i(t,{detect_resolution:R_.detect_resolution})},[t,i]),m=l.useCallback(()=>{i(t,{image_resolution:R_.image_resolution})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:c("controlnet.detectResolution"),value:s,onChange:d,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:c("controlnet.imageResolution"),value:o,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},vce=l.memo(gce),A_=Oo.openpose_image_processor.default,bce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,hand_and_face:i}=n,c=Ds(),{t:d}=J(),p=l.useCallback(y=>{c(t,{detect_resolution:y})},[t,c]),h=l.useCallback(y=>{c(t,{image_resolution:y})},[t,c]),m=l.useCallback(()=>{c(t,{detect_resolution:A_.detect_resolution})},[t,c]),g=l.useCallback(()=>{c(t,{image_resolution:A_.image_resolution})},[t,c]),b=l.useCallback(y=>{c(t,{hand_and_face:y.target.checked})},[t,c]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:d("controlnet.detectResolution"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:d("controlnet.imageResolution"),value:o,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jr,{label:d("controlnet.handAndFace"),isChecked:i,onChange:b,isDisabled:!r})]})},xce=l.memo(bce),D_=Oo.pidi_image_processor.default,yce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,scribble:i,safe:c}=n,d=Ds(),{t:p}=J(),h=l.useCallback(C=>{d(t,{detect_resolution:C})},[t,d]),m=l.useCallback(C=>{d(t,{image_resolution:C})},[t,d]),g=l.useCallback(()=>{d(t,{detect_resolution:D_.detect_resolution})},[t,d]),b=l.useCallback(()=>{d(t,{image_resolution:D_.image_resolution})},[t,d]),y=l.useCallback(C=>{d(t,{scribble:C.target.checked})},[t,d]),x=l.useCallback(C=>{d(t,{safe:C.target.checked})},[t,d]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:p("controlnet.detectResolution"),value:s,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:p("controlnet.imageResolution"),value:o,onChange:m,handleReset:b,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jr,{label:p("controlnet.scribble"),isChecked:i,onChange:y}),a.jsx(jr,{label:p("controlnet.safe"),isChecked:c,onChange:x,isDisabled:!r})]})},Cce=l.memo(yce),wce=e=>null,Sce=l.memo(wce),mR=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{const o=Rs(r,e);return o&&Au(o)?o.processorNode:void 0},_e),[e]);return H(t)},kce=({id:e})=>{const t=Pi(e),n=mR(e);return n?n.type==="canny_image_processor"?a.jsx(Jle,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="color_map_image_processor"?a.jsx(tce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="hed_image_processor"?a.jsx(sce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="lineart_image_processor"?a.jsx(cce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="content_shuffle_image_processor"?a.jsx(rce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="lineart_anime_image_processor"?a.jsx(ice,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="mediapipe_face_processor"?a.jsx(dce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="midas_depth_image_processor"?a.jsx(pce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="mlsd_image_processor"?a.jsx(mce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="normalbae_image_processor"?a.jsx(vce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="openpose_image_processor"?a.jsx(xce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="pidi_image_processor"?a.jsx(Cce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="zoe_depth_image_processor"?a.jsx(Sce,{controlNetId:e,processorNode:n,isEnabled:t}):null:null},jce=l.memo(kce),_ce=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{const o=Rs(r,e);if(o&&Au(o))return o.shouldAutoConfig},_e),[e]);return H(t)},Ice=({id:e})=>{const t=Pi(e),n=_ce(e),r=oe(),{t:o}=J(),s=l.useCallback(()=>{r(uT({id:e}))},[e,r]);return oi(n)?null:a.jsx(jr,{label:o("controlnet.autoConfigure"),"aria-label":o("controlnet.autoConfigure"),isChecked:n,onChange:s,isDisabled:!t})},Pce=l.memo(Ice),Ece=e=>{const{id:t}=e,n=oe(),{t:r}=J(),o=l.useCallback(()=>{n(dT({id:t}))},[t,n]),s=l.useCallback(()=>{n(fT({id:t}))},[t,n]);return a.jsxs(N,{sx:{gap:2},children:[a.jsx(tt,{size:"sm",icon:a.jsx(Ql,{}),tooltip:r("controlnet.importImageFromCanvas"),"aria-label":r("controlnet.importImageFromCanvas"),onClick:o}),a.jsx(tt,{size:"sm",icon:a.jsx(QM,{}),tooltip:r("controlnet.importMaskFromCanvas"),"aria-label":r("controlnet.importMaskFromCanvas"),onClick:s})]})},Mce=l.memo(Ece),Oce=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{const o=Rs(r,e);return o?{beginStepPct:o.beginStepPct,endStepPct:o.endStepPct}:void 0},_e),[e]);return H(t)},T_=e=>`${Math.round(e*100)}%`,Rce=({id:e})=>{const t=Pi(e),n=Oce(e),r=oe(),{t:o}=J(),s=l.useCallback(i=>{r(pT({id:e,beginStepPct:i[0]})),r(hT({id:e,endStepPct:i[1]}))},[r,e]);return n?a.jsx(wn,{feature:"controlNetBeginEnd",children:a.jsxs(Bn,{isDisabled:!t,children:[a.jsx(vr,{children:o("controlnet.beginEndStepPercent")}),a.jsx(xg,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(N3,{"aria-label":["Begin Step %","End Step %!"],value:[n.beginStepPct,n.endStepPct],onChange:s,min:0,max:1,step:.01,minStepsBetweenThumbs:5,isDisabled:!t,children:[a.jsx($3,{children:a.jsx(L3,{})}),a.jsx(Fn,{label:T_(n.beginStepPct),placement:"top",hasArrow:!0,children:a.jsx(wb,{index:0})}),a.jsx(Fn,{label:T_(n.endStepPct),placement:"top",hasArrow:!0,children:a.jsx(wb,{index:1})}),a.jsx(Eh,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(Eh,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(Eh,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})}):null},Ace=l.memo(Rce),Dce=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{const o=Rs(r,e);if(o&&mT(o))return o.controlMode},_e),[e]);return H(t)};function Tce({id:e}){const t=Pi(e),n=Dce(e),r=oe(),{t:o}=J(),s=[{label:o("controlnet.balanced"),value:"balanced"},{label:o("controlnet.prompt"),value:"more_prompt"},{label:o("controlnet.control"),value:"more_control"},{label:o("controlnet.megaControl"),value:"unbalanced"}],i=l.useCallback(c=>{r(gT({id:e,controlMode:c}))},[e,r]);return n?a.jsx(wn,{feature:"controlNetControlMode",children:a.jsx(Ar,{disabled:!t,label:o("controlnet.controlMode"),data:s,value:n,onChange:i})}):null}const Nce=e=>e.config,$ce=de(Nce,e=>Ro(Oo,n=>({value:n.type,label:n.label})).sort((n,r)=>n.value==="none"?-1:r.value==="none"?1:n.label.localeCompare(r.label)).filter(n=>!e.sd.disabledControlNetProcessors.includes(n.value)),_e),Lce=({id:e})=>{const t=Pi(e),n=mR(e),r=oe(),o=H($ce),{t:s}=J(),i=l.useCallback(c=>{r(vT({id:e,processorType:c}))},[e,r]);return n?a.jsx(tr,{label:s("controlnet.processor"),value:n.type??"canny_image_processor",data:o,onChange:i,disabled:!t}):null},zce=l.memo(Lce),Fce=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{const o=Rs(r,e);if(o&&Au(o))return o.resizeMode},_e),[e]);return H(t)};function Bce({id:e}){const t=Pi(e),n=Fce(e),r=oe(),{t:o}=J(),s=[{label:o("controlnet.resize"),value:"just_resize"},{label:o("controlnet.crop"),value:"crop_resize"},{label:o("controlnet.fill"),value:"fill_resize"}],i=l.useCallback(c=>{r(bT({id:e,resizeMode:c}))},[e,r]);return n?a.jsx(wn,{feature:"controlNetResizeMode",children:a.jsx(Ar,{disabled:!t,label:o("controlnet.resizeMode"),data:s,value:n,onChange:i})}):null}const Hce=e=>{const{id:t,number:n}=e,r=hR(t),o=oe(),{t:s}=J(),i=H(ro),c=Pi(t),[d,p]=Ree(!1),h=l.useCallback(()=>{o(xT({id:t}))},[t,o]),m=l.useCallback(()=>{o(yT(t))},[t,o]),g=l.useCallback(b=>{o(CT({id:t,isEnabled:b.target.checked}))},[t,o]);return r?a.jsxs(N,{sx:{flexDir:"column",gap:3,p:2,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx(N,{sx:{gap:2,alignItems:"center",justifyContent:"space-between"},children:a.jsx(jr,{label:s(`controlnet.${r}`,{number:n}),"aria-label":s("controlnet.toggleControlNet"),isChecked:c,onChange:g,formControlProps:{w:"full"},formLabelProps:{fontWeight:600}})}),a.jsxs(N,{sx:{gap:2,alignItems:"center"},children:[a.jsx(Te,{sx:{w:"full",minW:0,transitionProperty:"common",transitionDuration:"0.1s"},children:a.jsx(Hle,{id:t})}),i==="unifiedCanvas"&&a.jsx(Mce,{id:t}),a.jsx(tt,{size:"sm",tooltip:s("controlnet.duplicate"),"aria-label":s("controlnet.duplicate"),onClick:m,icon:a.jsx(Hu,{})}),a.jsx(tt,{size:"sm",tooltip:s("controlnet.delete"),"aria-label":s("controlnet.delete"),colorScheme:"error",onClick:h,icon:a.jsx(qo,{})}),a.jsx(tt,{size:"sm",tooltip:s(d?"controlnet.hideAdvanced":"controlnet.showAdvanced"),"aria-label":s(d?"controlnet.hideAdvanced":"controlnet.showAdvanced"),onClick:p,variant:"ghost",sx:{_hover:{bg:"none"}},icon:a.jsx(s0,{sx:{boxSize:4,color:"base.700",transform:d?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal",_dark:{color:"base.300"}}})})]}),a.jsxs(N,{sx:{w:"full",flexDirection:"column",gap:3},children:[a.jsxs(N,{sx:{gap:4,w:"full",alignItems:"center"},children:[a.jsxs(N,{sx:{flexDir:"column",gap:3,h:28,w:"full",paddingInlineStart:1,paddingInlineEnd:d?1:0,pb:2,justifyContent:"space-between"},children:[a.jsx(Ule,{id:t}),a.jsx(Ace,{id:t})]}),!d&&a.jsx(N,{sx:{alignItems:"center",justifyContent:"center",h:28,w:28,aspectRatio:"1/1"},children:a.jsx(j_,{id:t,isSmall:!0})})]}),a.jsxs(N,{sx:{gap:2},children:[a.jsx(Tce,{id:t}),a.jsx(Bce,{id:t})]}),a.jsx(zce,{id:t})]}),d&&a.jsxs(a.Fragment,{children:[a.jsx(j_,{id:t}),a.jsx(Pce,{id:t}),a.jsx(jce,{id:t})]})]}):null},Wce=l.memo(Hce),E1=e=>{const t=H(c=>{var d;return(d=c.generation.model)==null?void 0:d.base_model}),n=oe(),r=pR(e),o=l.useMemo(()=>{const c=r.filter(d=>t?d.base_model===t:!0)[0];return c||r[0]},[t,r]),s=l.useMemo(()=>!o,[o]);return[l.useCallback(()=>{s||n(wT({type:e,overrides:{model:o}}))},[n,o,s,e]),s]},Vce=de([Ce],({controlAdapters:e})=>{const t=[];let n=!1;const r=ST(e).filter(h=>h.isEnabled).length,o=kT(e).length;r>0&&t.push(`${r} IP`),r>o&&(n=!0);const s=jT(e).filter(h=>h.isEnabled).length,i=_T(e).length;s>0&&t.push(`${s} ControlNet`),s>i&&(n=!0);const c=IT(e).filter(h=>h.isEnabled).length,d=PT(e).length;return c>0&&t.push(`${c} T2I`),c>d&&(n=!0),{controlAdapterIds:ET(e).map(String),activeLabel:t.join(", "),isError:n}},_e),Uce=()=>{const{t:e}=J(),{controlAdapterIds:t,activeLabel:n}=H(Vce),r=jn("controlNet").isFeatureDisabled,[o,s]=E1("controlnet"),[i,c]=E1("ip_adapter"),[d,p]=E1("t2i_adapter");return r?null:a.jsx(Ao,{label:e("controlnet.controlAdapter_other"),activeLabel:n,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsxs(zn,{size:"sm",w:"full",justifyContent:"space-between",children:[a.jsx(Rt,{tooltip:e("controlnet.addControlNet"),leftIcon:a.jsx(Yi,{}),onClick:o,"data-testid":"add controlnet",flexGrow:1,isDisabled:s,children:e("common.controlNet")}),a.jsx(Rt,{tooltip:e("controlnet.addIPAdapter"),leftIcon:a.jsx(Yi,{}),onClick:i,"data-testid":"add ip adapter",flexGrow:1,isDisabled:c,children:e("common.ipAdapter")}),a.jsx(Rt,{tooltip:e("controlnet.addT2IAdapter"),leftIcon:a.jsx(Yi,{}),onClick:d,"data-testid":"add t2i adapter",flexGrow:1,isDisabled:p,children:e("common.t2iAdapter")})]}),t.map((h,m)=>a.jsxs(l.Fragment,{children:[a.jsx(no,{}),a.jsx(Wce,{id:h,number:m+1})]},h))]})})},Xu=l.memo(Uce),Gce=e=>{const{onClick:t}=e,{t:n}=J();return a.jsx(tt,{size:"sm","aria-label":n("embedding.addEmbedding"),tooltip:n("embedding.addEmbedding"),icon:a.jsx(HM,{}),sx:{p:2,color:"base.500",_hover:{color:"base.600"},_active:{color:"base.700"},_dark:{color:"base.500",_hover:{color:"base.400"},_active:{color:"base.300"}}},variant:"link",onClick:t})},C0=l.memo(Gce),qce="28rem",Kce=e=>{const{onSelect:t,isOpen:n,onClose:r,children:o}=e,{data:s}=MT(),i=l.useRef(null),{t:c}=J(),d=H(g=>g.generation.model),p=l.useMemo(()=>{if(!s)return[];const g=[];return Kr(s.entities,(b,y)=>{if(!b)return;const x=(d==null?void 0:d.base_model)!==b.base_model;g.push({value:b.model_name,label:b.model_name,group:gr[b.base_model],disabled:x,tooltip:x?`${c("embedding.incompatibleModel")} ${b.base_model}`:void 0})}),g.sort((b,y)=>{var x;return b.label&&y.label?(x=b.label)!=null&&x.localeCompare(y.label)?-1:1:-1}),g.sort((b,y)=>b.disabled&&!y.disabled?1:-1)},[s,d==null?void 0:d.base_model,c]),h=l.useCallback(g=>{g&&t(g)},[t]),m=l.useCallback((g,b)=>{var y;return((y=b.label)==null?void 0:y.toLowerCase().includes(g.toLowerCase().trim()))||b.value.toLowerCase().includes(g.toLowerCase().trim())},[]);return a.jsxs(Nf,{initialFocusRef:i,isOpen:n,onClose:r,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(Rg,{children:o}),a.jsx($f,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Ag,{sx:{p:0,w:`calc(${qce} - 2rem )`},children:p.length===0?a.jsx(N,{sx:{justifyContent:"center",p:2,fontSize:"sm",color:"base.500",_dark:{color:"base.700"}},children:a.jsx(Se,{children:"No Embeddings Loaded"})}):a.jsx(tr,{inputRef:i,autoFocus:!0,placeholder:c("embedding.addEmbedding"),value:null,data:p,nothingFound:c("embedding.noMatchingEmbedding"),itemComponent:pl,disabled:p.length===0,onDropdownClose:r,filter:m,onChange:h})})})]})},w0=l.memo(Kce),Qce=()=>{const e=H(m=>m.generation.negativePrompt),t=l.useRef(null),{isOpen:n,onClose:r,onOpen:o}=ls(),s=oe(),{t:i}=J(),c=l.useCallback(m=>{s(Ad(m.target.value))},[s]),d=l.useCallback(m=>{m.key==="<"&&o()},[o]),p=l.useCallback(m=>{if(!t.current)return;const g=t.current.selectionStart;if(g===void 0)return;let b=e.slice(0,g);b[b.length-1]!=="<"&&(b+="<"),b+=`${m}>`;const y=b.length;b+=e.slice(g),rs.flushSync(()=>{s(Ad(b))}),t.current.selectionEnd=y,r()},[s,r,e]),h=jn("embedding").isFeatureEnabled;return a.jsxs(Bn,{children:[a.jsx(w0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(wn,{feature:"paramNegativeConditioning",placement:"right",children:a.jsx(vi,{id:"negativePrompt",name:"negativePrompt",ref:t,value:e,placeholder:i("parameters.negativePromptPlaceholder"),onChange:c,resize:"vertical",fontSize:"sm",minH:16,...h&&{onKeyDown:d}})})}),!n&&h&&a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(C0,{onClick:o})})]})},gR=l.memo(Qce),Xce=de([Ce],({generation:e})=>({prompt:e.positivePrompt}),{memoizeOptions:{resultEqualityCheck:Tn}}),Yce=()=>{const e=oe(),{prompt:t}=H(Xce),n=l.useRef(null),{isOpen:r,onClose:o,onOpen:s}=ls(),{t:i}=J(),c=l.useCallback(m=>{e(Rd(m.target.value))},[e]);It("alt+a",()=>{var m;(m=n.current)==null||m.focus()},[]);const d=l.useCallback(m=>{if(!n.current)return;const g=n.current.selectionStart;if(g===void 0)return;let b=t.slice(0,g);b[b.length-1]!=="<"&&(b+="<"),b+=`${m}>`;const y=b.length;b+=t.slice(g),rs.flushSync(()=>{e(Rd(b))}),n.current.selectionStart=y,n.current.selectionEnd=y,o()},[e,o,t]),p=jn("embedding").isFeatureEnabled,h=l.useCallback(m=>{p&&m.key==="<"&&s()},[s,p]);return a.jsxs(Te,{position:"relative",children:[a.jsx(Bn,{children:a.jsx(w0,{isOpen:r,onClose:o,onSelect:d,children:a.jsx(wn,{feature:"paramPositiveConditioning",placement:"right",children:a.jsx(vi,{id:"prompt",name:"prompt",ref:n,value:t,placeholder:i("parameters.positivePromptPlaceholder"),onChange:c,onKeyDown:h,resize:"vertical",minH:32})})})}),!r&&p&&a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(C0,{onClick:s})})]})},vR=l.memo(Yce);function Jce(){const e=H(o=>o.sdxl.shouldConcatSDXLStylePrompt),t=oe(),{t:n}=J(),r=l.useCallback(()=>{t(OT(!e))},[t,e]);return a.jsx(tt,{"aria-label":n("sdxl.concatPromptStyle"),tooltip:n("sdxl.concatPromptStyle"),variant:"outline",isChecked:e,onClick:r,icon:a.jsx(qM,{}),size:"xs",sx:{position:"absolute",insetInlineEnd:1,top:6,border:"none",color:e?"accent.500":"base.500",_hover:{bg:"none"}}})}const N_={position:"absolute",bg:"none",w:"full",minH:2,borderRadius:0,borderLeft:"none",borderRight:"none",zIndex:2,maskImage:"radial-gradient(circle at center, black, black 65%, black 30%, black 15%, transparent)"};function bR(){return a.jsxs(N,{children:[a.jsx(Te,{as:Or.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"1px",borderTop:"none",borderColor:"base.400",...N_,_dark:{borderColor:"accent.500"}}}),a.jsx(Te,{as:Or.div,initial:{opacity:0,scale:0},animate:{opacity:[0,1,1,1],scale:[0,.75,1.5,1],transition:{duration:.42,times:[0,.25,.5,1]}},exit:{opacity:0,scale:0},sx:{zIndex:3,position:"absolute",left:"48%",top:"3px",p:1,borderRadius:4,bg:"accent.400",color:"base.50",_dark:{bg:"accent.500"}},children:a.jsx(qM,{size:12})}),a.jsx(Te,{as:Or.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"17px",borderBottom:"none",borderColor:"base.400",...N_,_dark:{borderColor:"accent.500"}}})]})}const Zce=de([Ce],({sdxl:e})=>{const{negativeStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),eue=()=>{const e=oe(),t=l.useRef(null),{isOpen:n,onClose:r,onOpen:o}=ls(),{t:s}=J(),{prompt:i,shouldConcatSDXLStylePrompt:c}=H(Zce),d=l.useCallback(g=>{e(Td(g.target.value))},[e]),p=l.useCallback(g=>{if(!t.current)return;const b=t.current.selectionStart;if(b===void 0)return;let y=i.slice(0,b);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const x=y.length;y+=i.slice(b),rs.flushSync(()=>{e(Td(y))}),t.current.selectionStart=x,t.current.selectionEnd=x,r()},[e,r,i]),h=jn("embedding").isFeatureEnabled,m=l.useCallback(g=>{h&&g.key==="<"&&o()},[o,h]);return a.jsxs(Te,{position:"relative",children:[a.jsx(yo,{children:c&&a.jsx(Te,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(bR,{})})}),a.jsx(Bn,{children:a.jsx(w0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(vi,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.negStylePrompt"),onChange:d,onKeyDown:m,resize:"vertical",fontSize:"sm",minH:16})})}),!n&&h&&a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(C0,{onClick:o})})]})},tue=l.memo(eue),nue=de([Ce],({sdxl:e})=>{const{positiveStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),rue=()=>{const e=oe(),t=l.useRef(null),{isOpen:n,onClose:r,onOpen:o}=ls(),{t:s}=J(),{prompt:i,shouldConcatSDXLStylePrompt:c}=H(nue),d=l.useCallback(g=>{e(Dd(g.target.value))},[e]),p=l.useCallback(g=>{if(!t.current)return;const b=t.current.selectionStart;if(b===void 0)return;let y=i.slice(0,b);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const x=y.length;y+=i.slice(b),rs.flushSync(()=>{e(Dd(y))}),t.current.selectionStart=x,t.current.selectionEnd=x,r()},[e,r,i]),h=jn("embedding").isFeatureEnabled,m=l.useCallback(g=>{h&&g.key==="<"&&o()},[o,h]);return a.jsxs(Te,{position:"relative",children:[a.jsx(yo,{children:c&&a.jsx(Te,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(bR,{})})}),a.jsx(Bn,{children:a.jsx(w0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(vi,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.posStylePrompt"),onChange:d,onKeyDown:m,resize:"vertical",minH:16})})}),!n&&h&&a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(C0,{onClick:o})})]})},oue=l.memo(rue);function H2(){return a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsx(vR,{}),a.jsx(Jce,{}),a.jsx(oue,{}),a.jsx(gR,{}),a.jsx(tue,{})]})}const vl=()=>{const{isRefinerAvailable:e}=na(Fx,{selectFromResult:({data:t})=>({isRefinerAvailable:t?t.ids.length>0:!1})});return e},sue=de([Ce],({sdxl:e,ui:t,hotkeys:n})=>{const{refinerCFGScale:r}=e,{shouldUseSliders:o}=t,{shift:s}=n;return{refinerCFGScale:r,shouldUseSliders:o,shift:s}},_e),aue=()=>{const{refinerCFGScale:e,shouldUseSliders:t,shift:n}=H(sue),r=vl(),o=oe(),{t:s}=J(),i=l.useCallback(d=>o(V1(d)),[o]),c=l.useCallback(()=>o(V1(7)),[o]);return t?a.jsx(Pt,{label:s("sdxl.cfgScale"),step:n?.1:.5,min:1,max:20,onChange:i,handleReset:c,value:e,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!r}):a.jsx(ja,{label:s("sdxl.cfgScale"),step:.5,min:1,max:200,onChange:i,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"},isDisabled:!r})},iue=l.memo(aue),lue=e=>{const t=Ci("models"),[n,r,o]=e.split("/"),s=RT.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data},cue=de(Ce,e=>({model:e.sdxl.refinerModel}),_e),uue=()=>{const e=oe(),t=jn("syncModels").isFeatureEnabled,{model:n}=H(cue),{t:r}=J(),{data:o,isLoading:s}=na(Fx),i=l.useMemo(()=>{if(!o)return[];const p=[];return Kr(o.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:gr[h.base_model]})}),p},[o]),c=l.useMemo(()=>(o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])??null,[o==null?void 0:o.entities,n]),d=l.useCallback(p=>{if(!p)return;const h=lue(p);h&&e(BI(h))},[e]);return s?a.jsx(tr,{label:r("sdxl.refinermodel"),placeholder:r("sdxl.loading"),disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(tr,{tooltip:c==null?void 0:c.description,label:r("sdxl.refinermodel"),value:c==null?void 0:c.id,placeholder:i.length>0?r("sdxl.selectAModel"):r("sdxl.noModelsAvailable"),data:i,error:i.length===0,disabled:i.length===0,onChange:d,w:"100%"}),t&&a.jsx(Te,{mt:7,children:a.jsx(Gu,{iconMode:!0})})]})},due=l.memo(uue),fue=de([Ce],({sdxl:e,hotkeys:t})=>{const{refinerNegativeAestheticScore:n}=e,{shift:r}=t;return{refinerNegativeAestheticScore:n,shift:r}},_e),pue=()=>{const{refinerNegativeAestheticScore:e,shift:t}=H(fue),n=vl(),r=oe(),{t:o}=J(),s=l.useCallback(c=>r(G1(c)),[r]),i=l.useCallback(()=>r(G1(2.5)),[r]);return a.jsx(Pt,{label:o("sdxl.negAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},hue=l.memo(pue),mue=de([Ce],({sdxl:e,hotkeys:t})=>{const{refinerPositiveAestheticScore:n}=e,{shift:r}=t;return{refinerPositiveAestheticScore:n,shift:r}},_e),gue=()=>{const{refinerPositiveAestheticScore:e,shift:t}=H(mue),n=vl(),r=oe(),{t:o}=J(),s=l.useCallback(c=>r(U1(c)),[r]),i=l.useCallback(()=>r(U1(6)),[r]);return a.jsx(Pt,{label:o("sdxl.posAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},vue=l.memo(gue),bue=de(Ce,({ui:e,sdxl:t})=>{const{refinerScheduler:n}=t,{favoriteSchedulers:r}=e,o=Ro(sg,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{refinerScheduler:n,data:o}},_e),xue=()=>{const e=oe(),{t}=J(),{refinerScheduler:n,data:r}=H(bue),o=vl(),s=l.useCallback(i=>{i&&e(HI(i))},[e]);return a.jsx(tr,{w:"100%",label:t("sdxl.scheduler"),value:n,data:r,onChange:s,disabled:!o})},yue=l.memo(xue),Cue=de([Ce],({sdxl:e})=>{const{refinerStart:t}=e;return{refinerStart:t}},_e),wue=()=>{const{refinerStart:e}=H(Cue),t=oe(),n=vl(),r=l.useCallback(i=>t(q1(i)),[t]),{t:o}=J(),s=l.useCallback(()=>t(q1(.8)),[t]);return a.jsx(Pt,{label:o("sdxl.refinerStart"),step:.01,min:0,max:1,onChange:r,handleReset:s,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Sue=l.memo(wue),kue=de([Ce],({sdxl:e,ui:t})=>{const{refinerSteps:n}=e,{shouldUseSliders:r}=t;return{refinerSteps:n,shouldUseSliders:r}},_e),jue=()=>{const{refinerSteps:e,shouldUseSliders:t}=H(kue),n=vl(),r=oe(),{t:o}=J(),s=l.useCallback(c=>{r(W1(c))},[r]),i=l.useCallback(()=>{r(W1(20))},[r]);return t?a.jsx(Pt,{label:o("sdxl.steps"),min:1,max:100,step:1,onChange:s,handleReset:i,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:500},isDisabled:!n}):a.jsx(ja,{label:o("sdxl.steps"),min:1,max:500,step:1,onChange:s,value:e,numberInputFieldProps:{textAlign:"center"},isDisabled:!n})},_ue=l.memo(jue);function Iue(){const e=H(s=>s.sdxl.shouldUseSDXLRefiner),t=vl(),n=oe(),{t:r}=J(),o=l.useCallback(s=>{n(AT(s.target.checked))},[n]);return a.jsx(jr,{label:r("sdxl.useRefiner"),isChecked:e,onChange:o,isDisabled:!t})}const Pue=de(Ce,e=>{const{shouldUseSDXLRefiner:t}=e.sdxl,{shouldUseSliders:n}=e.ui;return{activeLabel:t?"Enabled":void 0,shouldUseSliders:n}},_e),Eue=()=>{const{activeLabel:e,shouldUseSliders:t}=H(Pue),{t:n}=J();return vl()?a.jsx(Ao,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsxs(N,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Iue,{}),a.jsx(due,{}),a.jsxs(N,{gap:2,flexDirection:t?"column":"row",children:[a.jsx(_ue,{}),a.jsx(iue,{})]}),a.jsx(yue,{}),a.jsx(vue,{}),a.jsx(hue,{}),a.jsx(Sue,{})]})}):a.jsx(Ao,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsx(N,{sx:{justifyContent:"center",p:2},children:a.jsx(Se,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:n("models.noRefinerModelsInstalled")})})})},W2=l.memo(Eue),Mue=de([Ce],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:c}=t.sd.guidance,{cfgScale:d}=e,{shouldUseSliders:p}=n,{shift:h}=r;return{cfgScale:d,initial:o,min:s,sliderMax:i,inputMax:c,shouldUseSliders:p,shift:h}},_e),Oue=()=>{const{cfgScale:e,initial:t,min:n,sliderMax:r,inputMax:o,shouldUseSliders:s,shift:i}=H(Mue),c=oe(),{t:d}=J(),p=l.useCallback(m=>c(zh(m)),[c]),h=l.useCallback(()=>c(zh(t)),[c,t]);return s?a.jsx(wn,{feature:"paramCFGScale",children:a.jsx(Pt,{label:d("parameters.cfgScale"),step:i?.1:.5,min:n,max:r,onChange:p,handleReset:h,value:e,sliderNumberInputProps:{max:o},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1})}):a.jsx(wn,{feature:"paramCFGScale",children:a.jsx(ja,{label:d("parameters.cfgScale"),step:.5,min:n,max:o,onChange:p,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})})},Da=l.memo(Oue),Rue=de(Ce,e=>({model:e.generation.model}),_e),Aue=()=>{const e=oe(),{t}=J(),{model:n}=H(Rue),r=jn("syncModels").isFeatureEnabled,{data:o,isLoading:s}=na(Yw),{data:i,isLoading:c}=Wd(Yw),d=H(ro),p=l.useMemo(()=>{if(!o)return[];const g=[];return Kr(o.entities,(b,y)=>{b&&g.push({value:y,label:b.model_name,group:gr[b.base_model]})}),Kr(i==null?void 0:i.entities,(b,y)=>{!b||d==="unifiedCanvas"||d==="img2img"||g.push({value:y,label:b.model_name,group:gr[b.base_model]})}),g},[o,i,d]),h=l.useMemo(()=>((o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])||(i==null?void 0:i.entities[`${n==null?void 0:n.base_model}/onnx/${n==null?void 0:n.model_name}`]))??null,[o==null?void 0:o.entities,n,i==null?void 0:i.entities]),m=l.useCallback(g=>{if(!g)return;const b=y0(g);b&&e(z1(b))},[e]);return s||c?a.jsx(tr,{label:t("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:3,children:[a.jsx(wn,{feature:"paramModel",children:a.jsx(tr,{tooltip:h==null?void 0:h.description,label:t("modelManager.model"),value:h==null?void 0:h.id,placeholder:p.length>0?"Select a model":"No models available",data:p,error:p.length===0,disabled:p.length===0,onChange:m,w:"100%"})}),r&&a.jsx(Te,{mt:6,children:a.jsx(Gu,{iconMode:!0})})]})},Due=l.memo(Aue),Tue=de(Ce,({generation:e})=>{const{model:t,vae:n}=e;return{model:t,vae:n}},_e),Nue=()=>{const e=oe(),{t}=J(),{model:n,vae:r}=H(Tue),{data:o}=sP(),s=l.useMemo(()=>{if(!o)return[];const d=[{value:"default",label:"Default",group:"Default"}];return Kr(o.entities,(p,h)=>{if(!p)return;const m=(n==null?void 0:n.base_model)!==p.base_model;d.push({value:h,label:p.model_name,group:gr[p.base_model],disabled:m,tooltip:m?`Incompatible base model: ${p.base_model}`:void 0})}),d.sort((p,h)=>p.disabled&&!h.disabled?1:-1)},[o,n==null?void 0:n.base_model]),i=l.useMemo(()=>(o==null?void 0:o.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[o==null?void 0:o.entities,r]),c=l.useCallback(d=>{if(!d||d==="default"){e(Wc(null));return}const p=cR(d);p&&e(Wc(p))},[e]);return a.jsx(wn,{feature:"paramVAE",children:a.jsx(tr,{itemComponent:pl,tooltip:i==null?void 0:i.description,label:t("modelManager.vae"),value:(i==null?void 0:i.id)??"default",placeholder:"Default",data:s,onChange:c,disabled:s.length===0,clearable:!0})})},$ue=l.memo(Nue),Lue=de([lP,la],(e,t)=>{const{scheduler:n}=t,{favoriteSchedulers:r}=e,o=Ro(sg,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{scheduler:n,data:o}},_e),zue=()=>{const e=oe(),{t}=J(),{scheduler:n,data:r}=H(Lue),o=l.useCallback(s=>{s&&e(F1(s))},[e]);return a.jsx(wn,{feature:"paramScheduler",children:a.jsx(tr,{label:t("parameters.scheduler"),value:n,data:r,onChange:o})})},Fue=l.memo(zue),Bue=de(Ce,({generation:e})=>{const{vaePrecision:t}=e;return{vaePrecision:t}},_e),Hue=["fp16","fp32"],Wue=()=>{const{t:e}=J(),t=oe(),{vaePrecision:n}=H(Bue),r=l.useCallback(o=>{o&&t(DT(o))},[t]);return a.jsx(wn,{feature:"paramVAEPrecision",children:a.jsx(Ar,{label:e("modelManager.vaePrecision"),value:n,data:Hue,onChange:r})})},Vue=l.memo(Wue),Uue=()=>{const e=jn("vae").isFeatureEnabled;return a.jsxs(N,{gap:3,w:"full",flexWrap:e?"wrap":"nowrap",children:[a.jsx(Te,{w:"full",children:a.jsx(Due,{})}),a.jsx(Te,{w:"full",children:a.jsx(Fue,{})}),e&&a.jsxs(N,{w:"full",gap:3,children:[a.jsx($ue,{}),a.jsx(Vue,{})]})]})},Ta=l.memo(Uue),xR=[{name:on.t("parameters.aspectRatioFree"),value:null},{name:"2:3",value:2/3},{name:"16:9",value:16/9},{name:"1:1",value:1/1}],yR=xR.map(e=>e.value);function CR(){const e=H(s=>s.generation.aspectRatio),t=oe(),n=H(s=>s.generation.shouldFitToWidthHeight),r=H(ro),o=l.useCallback(s=>{t(Us(s.value)),t(Vd(!1))},[t]);return a.jsx(zn,{isAttached:!0,children:xR.map(s=>a.jsx(Rt,{size:"sm",isChecked:e===s.value,isDisabled:r==="img2img"?!n:!1,onClick:o.bind(null,s),children:s.name},s.name))})}const Gue=de([Ce],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:c}=n.sd.height,{model:d,height:p}=e,{aspectRatio:h}=e,m=t.shift?i:c;return{model:d,height:p,min:r,sliderMax:o,inputMax:s,step:m,aspectRatio:h}},_e),que=e=>{const{model:t,height:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:c}=H(Gue),d=oe(),{t:p}=J(),h=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,m=l.useCallback(b=>{if(d(Wl(b)),c){const y=Mo(b*c,8);d(Hl(y))}},[d,c]),g=l.useCallback(()=>{if(d(Wl(h)),c){const b=Mo(h*c,8);d(Hl(b))}},[d,h,c]);return a.jsx(Pt,{label:p("parameters.height"),value:n,min:r,step:i,max:o,onChange:m,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},Kue=l.memo(que),Que=de([Ce],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:c}=n.sd.width,{model:d,width:p,aspectRatio:h}=e,m=t.shift?i:c;return{model:d,width:p,min:r,sliderMax:o,inputMax:s,step:m,aspectRatio:h}},_e),Xue=e=>{const{model:t,width:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:c}=H(Que),d=oe(),{t:p}=J(),h=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,m=l.useCallback(b=>{if(d(Hl(b)),c){const y=Mo(b/c,8);d(Wl(y))}},[d,c]),g=l.useCallback(()=>{if(d(Hl(h)),c){const b=Mo(h/c,8);d(Wl(b))}},[d,h,c]);return a.jsx(Pt,{label:p("parameters.width"),value:n,min:r,step:i,max:o,onChange:m,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},Yue=l.memo(Xue),Jue=de([la,ro],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}=e;return{activeTabName:t,shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}},_e);function Eu(){const{t:e}=J(),t=oe(),{activeTabName:n,shouldFitToWidthHeight:r,shouldLockAspectRatio:o,width:s,height:i}=H(Jue),c=l.useCallback(()=>{o?(t(Vd(!1)),yR.includes(s/i)?t(Us(s/i)):t(Us(null))):(t(Vd(!0)),t(Us(s/i)))},[o,s,i,t]),d=l.useCallback(()=>{t(TT()),t(Us(null)),o&&t(Us(i/s))},[t,o,s,i]);return a.jsxs(N,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.150",_dark:{bg:"base.750"}},children:[a.jsx(wn,{feature:"paramRatio",children:a.jsxs(Bn,{as:N,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(vr,{children:e("parameters.aspectRatio")}),a.jsx(ji,{}),a.jsx(CR,{}),a.jsx(tt,{tooltip:e("ui.swapSizes"),"aria-label":e("ui.swapSizes"),size:"sm",icon:a.jsx(y8,{}),fontSize:20,isDisabled:n==="img2img"?!r:!1,onClick:d}),a.jsx(tt,{tooltip:e("ui.lockRatio"),"aria-label":e("ui.lockRatio"),size:"sm",icon:a.jsx(KM,{}),isChecked:o,isDisabled:n==="img2img"?!r:!1,onClick:c})]})}),a.jsx(N,{gap:2,alignItems:"center",children:a.jsxs(N,{gap:2,flexDirection:"column",width:"full",children:[a.jsx(Yue,{isDisabled:n==="img2img"?!r:!1}),a.jsx(Kue,{isDisabled:n==="img2img"?!r:!1})]})})]})}const Zue=de([Ce],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:c,fineStep:d,coarseStep:p}=t.sd.steps,{steps:h}=e,{shouldUseSliders:m}=n,g=r.shift?d:p;return{steps:h,initial:o,min:s,sliderMax:i,inputMax:c,step:g,shouldUseSliders:m}},_e),ede=()=>{const{steps:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:i}=H(Zue),c=oe(),{t:d}=J(),p=l.useCallback(g=>{c(Fh(g))},[c]),h=l.useCallback(()=>{c(Fh(t))},[c,t]),m=l.useCallback(()=>{c(Lx())},[c]);return i?a.jsx(wn,{feature:"paramSteps",children:a.jsx(Pt,{label:d("parameters.steps"),min:n,max:r,step:s,onChange:p,handleReset:h,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:o}})}):a.jsx(wn,{feature:"paramSteps",children:a.jsx(ja,{label:d("parameters.steps"),min:n,max:o,step:s,onChange:p,value:e,numberInputFieldProps:{textAlign:"center"},onBlur:m})})},Na=l.memo(ede);function wR(){const e=oe(),t=H(o=>o.generation.shouldFitToWidthHeight),n=l.useCallback(o=>{e(NT(o.target.checked))},[e]),{t:r}=J();return a.jsx(jr,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function tde(){const e=H(i=>i.generation.seed),t=H(i=>i.generation.shouldRandomizeSeed),n=H(i=>i.generation.shouldGenerateVariations),{t:r}=J(),o=oe(),s=l.useCallback(i=>o(Lh(i)),[o]);return a.jsx(ja,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:cP,max:uP,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e})}const nde=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);function rde(){const e=oe(),t=H(o=>o.generation.shouldRandomizeSeed),{t:n}=J(),r=l.useCallback(()=>e(Lh(nde(cP,uP))),[e]);return a.jsx(tt,{size:"sm",isDisabled:t,"aria-label":n("parameters.shuffle"),tooltip:n("parameters.shuffle"),onClick:r,icon:a.jsx(yee,{})})}const ode=()=>{const e=oe(),{t}=J(),n=H(o=>o.generation.shouldRandomizeSeed),r=l.useCallback(o=>e($T(o.target.checked)),[e]);return a.jsx(jr,{label:t("common.random"),isChecked:n,onChange:r})},sde=l.memo(ode),ade=()=>a.jsx(wn,{feature:"paramSeed",children:a.jsxs(N,{sx:{gap:3,alignItems:"flex-end"},children:[a.jsx(tde,{}),a.jsx(rde,{}),a.jsx(sde,{})]})}),$a=l.memo(ade),SR=Oe((e,t)=>a.jsxs(N,{ref:t,sx:{flexDir:"column",gap:2,bg:"base.100",px:4,pt:2,pb:4,borderRadius:"base",_dark:{bg:"base.750"}},children:[a.jsx(Se,{fontSize:"sm",fontWeight:"bold",sx:{color:"base.600",_dark:{color:"base.300"}},children:e.label}),e.children]}));SR.displayName="SubSettingsWrapper";const Mu=l.memo(SR),ide=de([Ce],({sdxl:e})=>{const{sdxlImg2ImgDenoisingStrength:t}=e;return{sdxlImg2ImgDenoisingStrength:t}},_e),lde=()=>{const{sdxlImg2ImgDenoisingStrength:e}=H(ide),t=oe(),{t:n}=J(),r=l.useCallback(s=>t(Jw(s)),[t]),o=l.useCallback(()=>{t(Jw(.7))},[t]);return a.jsx(wn,{feature:"paramDenoisingStrength",children:a.jsx(Mu,{children:a.jsx(Pt,{label:n("sdxl.denoisingStrength"),step:.01,min:0,max:1,onChange:r,handleReset:o,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0})})})},kR=l.memo(lde),cde=de([lP,la],(e,t)=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},_e),ude=()=>{const{t:e}=J(),{shouldUseSliders:t,activeLabel:n}=H(cde);return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(Eu,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(Eu,{})]}),a.jsx(kR,{}),a.jsx(wR,{})]})})},dde=l.memo(ude),fde=()=>a.jsxs(a.Fragment,{children:[a.jsx(H2,{}),a.jsx(dde,{}),a.jsx(W2,{}),a.jsx(Xu,{}),a.jsx(Ku,{}),a.jsx(qu,{}),a.jsx(Qu,{})]}),pde=l.memo(fde),V2=()=>{const{t:e}=J(),t=H(i=>i.generation.shouldRandomizeSeed),n=H(i=>i.generation.iterations),r=l.useMemo(()=>n===1?e("parameters.iterationsWithCount_one",{count:1}):e("parameters.iterationsWithCount_other",{count:n}),[n,e]),o=l.useMemo(()=>e(t?"parameters.randomSeed":"parameters.manualSeed"),[t,e]);return{iterationsAndSeedLabel:l.useMemo(()=>[r,o].join(", "),[r,o]),iterationsLabel:r,seedLabel:o}},hde=()=>{const{t:e}=J(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=V2();return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsx(N,{sx:{flexDirection:"column",gap:3},children:t?a.jsxs(a.Fragment,{children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(Eu,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(Eu,{})]})})})},jR=l.memo(hde),mde=()=>a.jsxs(a.Fragment,{children:[a.jsx(H2,{}),a.jsx(jR,{}),a.jsx(W2,{}),a.jsx(Xu,{}),a.jsx(Ku,{}),a.jsx(qu,{}),a.jsx(Qu,{})]}),gde=l.memo(mde),vde=[{label:"Unmasked",value:"unmasked"},{label:"Mask",value:"mask"},{label:"Mask Edge",value:"edge"}],bde=()=>{const e=oe(),t=H(o=>o.generation.canvasCoherenceMode),{t:n}=J(),r=l.useCallback(o=>{o&&e(LT(o))},[e]);return a.jsx(wn,{feature:"compositingCoherenceMode",children:a.jsx(Ar,{label:n("parameters.coherenceMode"),data:vde,value:t,onChange:r})})},xde=l.memo(bde),yde=()=>{const e=oe(),t=H(s=>s.generation.canvasCoherenceSteps),{t:n}=J(),r=l.useCallback(s=>{e(Zw(s))},[e]),o=l.useCallback(()=>{e(Zw(20))},[e]);return a.jsx(wn,{feature:"compositingCoherenceSteps",children:a.jsx(Pt,{label:n("parameters.coherenceSteps"),min:1,max:100,step:1,sliderNumberInputProps:{max:999},value:t,onChange:r,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:o})})},Cde=l.memo(yde),wde=()=>{const e=oe(),t=H(s=>s.generation.canvasCoherenceStrength),{t:n}=J(),r=l.useCallback(s=>{e(eS(s))},[e]),o=l.useCallback(()=>{e(eS(.3))},[e]);return a.jsx(wn,{feature:"compositingStrength",children:a.jsx(Pt,{label:n("parameters.coherenceStrength"),min:0,max:1,step:.01,sliderNumberInputProps:{max:999},value:t,onChange:r,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:o})})},Sde=l.memo(wde);function kde(){const e=oe(),t=H(s=>s.generation.maskBlur),{t:n}=J(),r=l.useCallback(s=>{e(tS(s))},[e]),o=l.useCallback(()=>{e(tS(16))},[e]);return a.jsx(wn,{feature:"compositingBlur",children:a.jsx(Pt,{label:n("parameters.maskBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:o})})}const jde=[{label:"Box Blur",value:"box"},{label:"Gaussian Blur",value:"gaussian"}];function _de(){const e=H(o=>o.generation.maskBlurMethod),t=oe(),{t:n}=J(),r=l.useCallback(o=>{o&&t(zT(o))},[t]);return a.jsx(wn,{feature:"compositingBlurMethod",children:a.jsx(Ar,{value:e,onChange:r,label:n("parameters.maskBlurMethod"),data:jde})})}const Ide=()=>{const{t:e}=J();return a.jsx(Ao,{label:e("parameters.compositingSettingsHeader"),children:a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsxs(Mu,{label:e("parameters.coherencePassHeader"),children:[a.jsx(xde,{}),a.jsx(Cde,{}),a.jsx(Sde,{})]}),a.jsx(no,{}),a.jsxs(Mu,{label:e("parameters.maskAdjustmentsHeader"),children:[a.jsx(kde,{}),a.jsx(_de,{})]})]})})},_R=l.memo(Ide),Pde=de([Ce],({generation:e})=>{const{infillMethod:t}=e;return{infillMethod:t}},_e),Ede=()=>{const e=oe(),{infillMethod:t}=H(Pde),{data:n,isLoading:r}=RI(),o=n==null?void 0:n.infill_methods,{t:s}=J(),i=l.useCallback(c=>{e(FT(c))},[e]);return a.jsx(wn,{feature:"infillMethod",children:a.jsx(Ar,{disabled:(o==null?void 0:o.length)===0,placeholder:r?"Loading...":void 0,label:s("parameters.infillMethod"),value:t,data:o??[],onChange:i})})},Mde=l.memo(Ede),Ode=de([la],e=>{const{infillPatchmatchDownscaleSize:t,infillMethod:n}=e;return{infillPatchmatchDownscaleSize:t,infillMethod:n}},_e),Rde=()=>{const e=oe(),{infillPatchmatchDownscaleSize:t,infillMethod:n}=H(Ode),{t:r}=J(),o=l.useCallback(i=>{e(nS(i))},[e]),s=l.useCallback(()=>{e(nS(2))},[e]);return a.jsx(Pt,{isDisabled:n!=="patchmatch",label:r("parameters.patchmatchDownScaleSize"),min:1,max:10,value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},Ade=l.memo(Rde),Dde=de([la],e=>{const{infillTileSize:t,infillMethod:n}=e;return{infillTileSize:t,infillMethod:n}},_e),Tde=()=>{const e=oe(),{infillTileSize:t,infillMethod:n}=H(Dde),{t:r}=J(),o=l.useCallback(i=>{e(rS(i))},[e]),s=l.useCallback(()=>{e(rS(32))},[e]);return a.jsx(Pt,{isDisabled:n!=="tile",label:r("parameters.tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},Nde=l.memo(Tde),$de=de([la],e=>{const{infillMethod:t}=e;return{infillMethod:t}},_e);function Lde(){const{infillMethod:e}=H($de);return a.jsxs(N,{children:[e==="tile"&&a.jsx(Nde,{}),e==="patchmatch"&&a.jsx(Ade,{})]})}const _r=e=>e.canvas,Ns=de([Ce],({canvas:e})=>e.batchIds.length>0||e.layerState.stagingArea.images.length>0),zde=de([_r],e=>{const{boundingBoxScaleMethod:t}=e;return{boundingBoxScale:t}},_e),Fde=()=>{const e=oe(),{boundingBoxScale:t}=H(zde),{t:n}=J(),r=l.useCallback(o=>{e(BT(o))},[e]);return a.jsx(wn,{feature:"scaleBeforeProcessing",children:a.jsx(tr,{label:n("parameters.scaleBeforeProcessing"),data:HT,value:t,onChange:r})})},Bde=l.memo(Fde),Hde=de([la,_r],(e,t)=>{const{scaledBoundingBoxDimensions:n,boundingBoxScaleMethod:r}=t,{model:o,aspectRatio:s}=e;return{model:o,scaledBoundingBoxDimensions:n,isManual:r==="manual",aspectRatio:s}},_e),Wde=()=>{const e=oe(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=H(Hde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=J(),c=l.useCallback(p=>{let h=r.width;const m=Math.floor(p);o&&(h=Mo(m*o,64)),e(Uh({width:h,height:m}))},[o,e,r.width]),d=l.useCallback(()=>{let p=r.width;const h=Math.floor(s);o&&(p=Mo(h*o,64)),e(Uh({width:p,height:h}))},[o,e,s,r.width]);return a.jsx(Pt,{isDisabled:!n,label:i("parameters.scaledHeight"),min:64,max:1536,step:64,value:r.height,onChange:c,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},Vde=l.memo(Wde),Ude=de([_r,la],(e,t)=>{const{boundingBoxScaleMethod:n,scaledBoundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,scaledBoundingBoxDimensions:r,aspectRatio:s,isManual:n==="manual"}},_e),Gde=()=>{const e=oe(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=H(Ude),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=J(),c=l.useCallback(p=>{const h=Math.floor(p);let m=r.height;o&&(m=Mo(h/o,64)),e(Uh({width:h,height:m}))},[o,e,r.height]),d=l.useCallback(()=>{const p=Math.floor(s);let h=r.height;o&&(h=Mo(p/o,64)),e(Uh({width:p,height:h}))},[o,e,s,r.height]);return a.jsx(Pt,{isDisabled:!n,label:i("parameters.scaledWidth"),min:64,max:1536,step:64,value:r.width,onChange:c,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},qde=l.memo(Gde),Kde=()=>{const{t:e}=J();return a.jsx(Ao,{label:e("parameters.infillScalingHeader"),children:a.jsxs(N,{sx:{gap:2,flexDirection:"column"},children:[a.jsxs(Mu,{children:[a.jsx(Mde,{}),a.jsx(Lde,{})]}),a.jsx(no,{}),a.jsxs(Mu,{children:[a.jsx(Bde,{}),a.jsx(qde,{}),a.jsx(Vde,{})]})]})})},IR=l.memo(Kde),Qde=de([Ce,Ns],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},_e),Xde=()=>{const e=oe(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=H(Qde),{t:s}=J(),i=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,c=l.useCallback(p=>{if(e(Xs({...n,height:Math.floor(p)})),o){const h=Mo(p*o,64);e(Xs({width:h,height:Math.floor(p)}))}},[o,n,e]),d=l.useCallback(()=>{if(e(Xs({...n,height:Math.floor(i)})),o){const p=Mo(i*o,64);e(Xs({width:p,height:Math.floor(i)}))}},[o,n,e,i]);return a.jsx(Pt,{label:s("parameters.boundingBoxHeight"),min:64,max:1536,step:64,value:n.height,onChange:c,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},Yde=l.memo(Xde),Jde=de([Ce,Ns],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},_e),Zde=()=>{const e=oe(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=H(Jde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=J(),c=l.useCallback(p=>{if(e(Xs({...n,width:Math.floor(p)})),o){const h=Mo(p/o,64);e(Xs({width:Math.floor(p),height:h}))}},[o,n,e]),d=l.useCallback(()=>{if(e(Xs({...n,width:Math.floor(s)})),o){const p=Mo(s/o,64);e(Xs({width:Math.floor(s),height:p}))}},[o,n,e,s]);return a.jsx(Pt,{label:i("parameters.boundingBoxWidth"),min:64,max:1536,step:64,value:n.width,onChange:c,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},efe=l.memo(Zde),tfe=de([la,_r],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r}=e,{boundingBoxDimensions:o}=t;return{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,boundingBoxDimensions:o}});function tg(){const e=oe(),{t}=J(),{shouldLockAspectRatio:n,boundingBoxDimensions:r}=H(tfe),o=l.useCallback(()=>{n?(e(Vd(!1)),yR.includes(r.width/r.height)?e(Us(r.width/r.height)):e(Us(null))):(e(Vd(!0)),e(Us(r.width/r.height)))},[n,r,e]),s=l.useCallback(()=>{e(WT()),e(Us(null)),n&&e(Us(r.height/r.width))},[e,n,r]);return a.jsxs(N,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.100",_dark:{bg:"base.750"}},children:[a.jsx(wn,{feature:"paramRatio",children:a.jsxs(Bn,{as:N,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(vr,{children:t("parameters.aspectRatio")}),a.jsx(ji,{}),a.jsx(CR,{}),a.jsx(tt,{tooltip:t("ui.swapSizes"),"aria-label":t("ui.swapSizes"),size:"sm",icon:a.jsx(y8,{}),fontSize:20,onClick:s}),a.jsx(tt,{tooltip:t("ui.lockRatio"),"aria-label":t("ui.lockRatio"),size:"sm",icon:a.jsx(KM,{}),isChecked:n,onClick:o})]})}),a.jsx(efe,{}),a.jsx(Yde,{})]})}const nfe=de(Ce,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},_e),rfe=()=>{const{t:e}=J(),{shouldUseSliders:t,activeLabel:n}=H(nfe);return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(tg,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(tg,{})]}),a.jsx(kR,{})]})})},ofe=l.memo(rfe);function sfe(){return a.jsxs(a.Fragment,{children:[a.jsx(H2,{}),a.jsx(ofe,{}),a.jsx(W2,{}),a.jsx(Xu,{}),a.jsx(Ku,{}),a.jsx(qu,{}),a.jsx(IR,{}),a.jsx(_R,{}),a.jsx(Qu,{})]})}function U2(){return a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsx(vR,{}),a.jsx(gR,{})]})}function afe(){const e=H(i=>i.generation.horizontalSymmetrySteps),t=H(i=>i.generation.steps),n=oe(),{t:r}=J(),o=l.useCallback(i=>{n(oS(i))},[n]),s=l.useCallback(()=>{n(oS(0))},[n]);return a.jsx(Pt,{label:r("parameters.hSymmetryStep"),value:e,onChange:o,min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})}function ife(){const e=H(i=>i.generation.verticalSymmetrySteps),t=H(i=>i.generation.steps),n=oe(),{t:r}=J(),o=l.useCallback(i=>{n(sS(i))},[n]),s=l.useCallback(()=>{n(sS(0))},[n]);return a.jsx(Pt,{label:r("parameters.vSymmetryStep"),value:e,onChange:o,min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})}function lfe(){const e=H(r=>r.generation.shouldUseSymmetry),t=oe(),n=l.useCallback(r=>{t(VT(r.target.checked))},[t]);return a.jsx(jr,{label:"Enable Symmetry",isChecked:e,onChange:n})}const cfe=de(Ce,e=>({activeLabel:e.generation.shouldUseSymmetry?"Enabled":void 0}),_e),ufe=()=>{const{t:e}=J(),{activeLabel:t}=H(cfe);return jn("symmetry").isFeatureEnabled?a.jsx(Ao,{label:e("parameters.symmetry"),activeLabel:t,children:a.jsxs(N,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(lfe,{}),a.jsx(afe,{}),a.jsx(ife,{})]})}):null},G2=l.memo(ufe),dfe=de([Ce],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:c,coarseStep:d}=n.sd.img2imgStrength,{img2imgStrength:p}=e,h=t.shift?c:d;return{img2imgStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:h}},_e),ffe=()=>{const{img2imgStrength:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s}=H(dfe),i=oe(),{t:c}=J(),d=l.useCallback(h=>i(Bh(h)),[i]),p=l.useCallback(()=>{i(Bh(t))},[i,t]);return a.jsx(wn,{feature:"paramDenoisingStrength",children:a.jsx(Mu,{children:a.jsx(Pt,{label:`${c("parameters.denoisingStrength")}`,step:s,min:n,max:r,onChange:d,handleReset:p,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,sliderNumberInputProps:{max:o}})})})},PR=l.memo(ffe),pfe=()=>{const{t:e}=J(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=V2();return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(Eu,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(Eu,{})]}),a.jsx(PR,{}),a.jsx(wR,{})]})})},hfe=l.memo(pfe),mfe=()=>a.jsxs(a.Fragment,{children:[a.jsx(U2,{}),a.jsx(hfe,{}),a.jsx(Xu,{}),a.jsx(Ku,{}),a.jsx(qu,{}),a.jsx(G2,{}),a.jsx(Qu,{})]}),gfe=l.memo(mfe),vfe=de([Ce],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:c,coarseStep:d}=n.sd.hrfStrength,{hrfStrength:p,hrfEnabled:h}=e,m=t.shift?c:d;return{hrfStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:m,hrfEnabled:h}},_e),bfe=()=>{const{hrfStrength:e,initial:t,min:n,sliderMax:r,step:o,hrfEnabled:s}=H(vfe),i=oe(),{t:c}=J(),d=l.useCallback(()=>{i(Hh(t))},[i,t]),p=l.useCallback(h=>{i(Hh(h))},[i]);return a.jsx(Fn,{label:c("hrf.strengthTooltip"),placement:"right",hasArrow:!0,children:a.jsx(Pt,{label:c("parameters.denoisingStrength"),min:n,max:r,step:o,value:e,onChange:p,withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d,isDisabled:!s})})},xfe=l.memo(bfe);function yfe(){const e=oe(),{t}=J(),n=H(o=>o.generation.hrfEnabled),r=l.useCallback(o=>e(B1(o.target.checked)),[e]);return a.jsx(jr,{label:t("hrf.enableHrf"),isChecked:n,onChange:r,tooltip:t("hrf.enableHrfTooltip")})}const Cfe=de(Ce,({generation:e})=>{const{hrfMethod:t,hrfEnabled:n}=e;return{hrfMethod:t,hrfEnabled:n}},_e),wfe=["ESRGAN","bilinear"],Sfe=()=>{const e=oe(),{t}=J(),{hrfMethod:n,hrfEnabled:r}=H(Cfe),o=l.useCallback(s=>{s&&e(H1(s))},[e]);return a.jsx(Ar,{label:t("hrf.upscaleMethod"),value:n,data:wfe,onChange:o,disabled:!r})},kfe=l.memo(Sfe),jfe=de(Ce,e=>{const{hrfEnabled:t}=e.generation;return{hrfEnabled:t}},_e);function _fe(){const{t:e}=J(),t=jn("hrf").isFeatureEnabled,{hrfEnabled:n}=H(jfe),r=l.useMemo(()=>{if(n)return e("common.on")},[e,n]);return t?a.jsx(Ao,{label:e("hrf.hrf"),activeLabel:r,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsx(yfe,{}),a.jsx(xfe,{}),a.jsx(kfe,{})]})}):null}const Ife=()=>a.jsxs(a.Fragment,{children:[a.jsx(U2,{}),a.jsx(jR,{}),a.jsx(Xu,{}),a.jsx(Ku,{}),a.jsx(qu,{}),a.jsx(G2,{}),a.jsx(_fe,{}),a.jsx(Qu,{})]}),Pfe=l.memo(Ife),Efe=()=>{const{t:e}=J(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=V2();return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(tg,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(tg,{})]}),a.jsx(PR,{})]})})},Mfe=l.memo(Efe),Ofe=()=>a.jsxs(a.Fragment,{children:[a.jsx(U2,{}),a.jsx(Mfe,{}),a.jsx(Xu,{}),a.jsx(Ku,{}),a.jsx(qu,{}),a.jsx(G2,{}),a.jsx(IR,{}),a.jsx(_R,{}),a.jsx(Qu,{})]}),Rfe=l.memo(Ofe),Afe=()=>{const e=H(ro),t=H(n=>n.generation.model);return e==="txt2img"?a.jsx(Nh,{children:t&&t.base_model==="sdxl"?a.jsx(gde,{}):a.jsx(Pfe,{})}):e==="img2img"?a.jsx(Nh,{children:t&&t.base_model==="sdxl"?a.jsx(pde,{}):a.jsx(gfe,{})}):e==="unifiedCanvas"?a.jsx(Nh,{children:t&&t.base_model==="sdxl"?a.jsx(sfe,{}):a.jsx(Rfe,{})}):null},Dfe=l.memo(Afe),Nh=l.memo(e=>a.jsxs(N,{sx:{w:"full",h:"full",flexDir:"column",gap:2},children:[a.jsx(O8,{}),a.jsx(N,{layerStyle:"first",sx:{w:"full",h:"full",position:"relative",borderRadius:"base",p:2},children:a.jsx(N,{sx:{w:"full",h:"full",position:"relative"},children:a.jsx(Te,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(o0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:800,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:a.jsx(N,{sx:{gap:2,flexDirection:"column",h:"full",w:"full"},children:e.children})})})})})]}));Nh.displayName="ParametersPanelWrapper";const Tfe=de([Ce],e=>{const{initialImage:t}=e.generation;return{initialImage:t,isResetButtonDisabled:!t}},_e),Nfe=()=>{const{initialImage:e}=H(Tfe),{currentData:t}=Ps((e==null?void 0:e.imageName)??Os.skipToken),n=l.useMemo(()=>{if(t)return{id:"initial-image",payloadType:"IMAGE_DTO",payload:{imageDTO:t}}},[t]),r=l.useMemo(()=>({id:"initial-image",actionType:"SET_INITIAL_IMAGE"}),[]);return a.jsx(il,{imageDTO:t,droppableData:r,draggableData:n,isUploadDisabled:!0,fitContainer:!0,dropLabel:"Set as Initial Image",noContentFallback:a.jsx(qr,{label:"No initial image selected"}),dataTestId:"initial-image"})},$fe=l.memo(Nfe),Lfe=de([Ce],e=>{const{initialImage:t}=e.generation;return{isResetButtonDisabled:!t}},_e),zfe={type:"SET_INITIAL_IMAGE"},Ffe=()=>{const{isResetButtonDisabled:e}=H(Lfe),t=oe(),{getUploadButtonProps:n,getUploadInputProps:r}=k2({postUploadAction:zfe}),o=l.useCallback(()=>{t(UT())},[t]);return a.jsxs(N,{layerStyle:"first",sx:{position:"relative",flexDirection:"column",height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",p:2,gap:4},children:[a.jsxs(N,{sx:{w:"full",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(Se,{sx:{ps:2,fontWeight:600,userSelect:"none",color:"base.700",_dark:{color:"base.200"}},children:"Initial Image"}),a.jsx(ji,{}),a.jsx(tt,{tooltip:"Upload Initial Image","aria-label":"Upload Initial Image",icon:a.jsx(Jg,{}),...n()}),a.jsx(tt,{tooltip:"Reset Initial Image","aria-label":"Reset Initial Image",icon:a.jsx(Yg,{}),onClick:o,isDisabled:e})]}),a.jsx($fe,{}),a.jsx("input",{...r()})]})},Bfe=l.memo(Ffe),Hfe=e=>{const{onClick:t,isDisabled:n}=e,{t:r}=J(),o=H(s=>s.system.isConnected);return a.jsx(tt,{onClick:t,icon:a.jsx(qo,{}),tooltip:`${r("gallery.deleteImage")} (Del)`,"aria-label":`${r("gallery.deleteImage")} (Del)`,isDisabled:n||!o,colorScheme:"error"})},ER=()=>{const[e,{isLoading:t}]=cg({fixedCacheKey:"enqueueBatch"}),[n,{isLoading:r}]=tP({fixedCacheKey:"resumeProcessor"}),[o,{isLoading:s}]=ZI({fixedCacheKey:"pauseProcessor"}),[i,{isLoading:c}]=Tx({fixedCacheKey:"cancelQueueItem"}),[d,{isLoading:p}]=JI({fixedCacheKey:"clearQueue"}),[h,{isLoading:m}]=dP({fixedCacheKey:"pruneQueue"});return t||r||s||c||p||m},Wfe=[{label:"RealESRGAN x2 Plus",value:"RealESRGAN_x2plus.pth",tooltip:"Attempts to retain sharpness, low smoothing",group:"x2 Upscalers"},{label:"RealESRGAN x4 Plus",value:"RealESRGAN_x4plus.pth",tooltip:"Best for photos and highly detailed images, medium smoothing",group:"x4 Upscalers"},{label:"RealESRGAN x4 Plus (anime 6B)",value:"RealESRGAN_x4plus_anime_6B.pth",tooltip:"Best for anime/manga, high smoothing",group:"x4 Upscalers"},{label:"ESRGAN SRx4",value:"ESRGAN_SRx4_DF2KOST_official-ff704c30.pth",tooltip:"Retains sharpness, low smoothing",group:"x4 Upscalers"}];function Vfe(){const e=H(r=>r.postprocessing.esrganModelName),t=oe(),n=l.useCallback(r=>t(GT(r)),[t]);return a.jsx(Ar,{label:"ESRGAN Model",value:e,itemComponent:pl,onChange:n,data:Wfe})}const Ufe=e=>{const{imageDTO:t}=e,n=oe(),r=ER(),{t:o}=J(),{isOpen:s,onOpen:i,onClose:c}=ls(),{isAllowedToUpscale:d,detail:p}=qT(t),h=l.useCallback(()=>{c(),!(!t||!d)&&n(fP({imageDTO:t}))},[n,t,d,c]);return a.jsx(Uf,{isOpen:s,onClose:c,triggerComponent:a.jsx(tt,{tooltip:o("parameters.upscale"),onClick:i,icon:a.jsx(VM,{}),"aria-label":o("parameters.upscale")}),children:a.jsxs(N,{sx:{flexDirection:"column",gap:4},children:[a.jsx(Vfe,{}),a.jsx(Rt,{tooltip:p,size:"sm",isDisabled:!t||r||!d,onClick:h,children:o("parameters.upscaleImage")})]})})},Gfe=l.memo(Ufe),qfe=de([Ce,ro],({gallery:e,system:t,ui:n,config:r},o)=>{const{isConnected:s,shouldConfirmOnDelete:i,denoiseProgress:c}=t,{shouldShowImageDetails:d,shouldHidePreview:p,shouldShowProgressInViewer:h}=n,{shouldFetchMetadataFromApi:m}=r,g=e.selection[e.selection.length-1];return{shouldConfirmOnDelete:i,isConnected:s,shouldDisableToolbarButtons:!!(c!=null&&c.progress_image)||!g,shouldShowImageDetails:d,activeTabName:o,shouldHidePreview:p,shouldShowProgressInViewer:h,lastSelectedImage:g,shouldFetchMetadataFromApi:m}},{memoizeOptions:{resultEqualityCheck:Tn}}),Kfe=()=>{const e=oe(),{isConnected:t,shouldDisableToolbarButtons:n,shouldShowImageDetails:r,lastSelectedImage:o,shouldShowProgressInViewer:s}=H(qfe),i=jn("upscaling").isFeatureEnabled,c=ER(),d=Zl(),{t:p}=J(),{recallBothPrompts:h,recallSeed:m,recallAllParameters:g}=f0(),{currentData:b}=Ps((o==null?void 0:o.image_name)??Os.skipToken),{metadata:y,isLoading:x}=E2(o==null?void 0:o.image_name),{workflow:C,isLoading:S}=M2(o==null?void 0:o.workflow_id),j=l.useCallback(()=>{C&&e(Ax(C))},[e,C]),_=l.useCallback(()=>{g(y)},[y,g]);It("a",_,[y]);const I=l.useCallback(()=>{m(y==null?void 0:y.seed)},[y==null?void 0:y.seed,m]);It("s",I,[b]);const P=l.useCallback(()=>{h(y==null?void 0:y.positive_prompt,y==null?void 0:y.negative_prompt,y==null?void 0:y.positive_style_prompt,y==null?void 0:y.negative_style_prompt)},[y==null?void 0:y.negative_prompt,y==null?void 0:y.positive_prompt,y==null?void 0:y.positive_style_prompt,y==null?void 0:y.negative_style_prompt,h]);It("p",P,[b]),It("w",j,[C]);const M=l.useCallback(()=>{e(C8()),e(ig(b))},[e,b]);It("shift+i",M,[b]);const R=l.useCallback(()=>{b&&e(fP({imageDTO:b}))},[e,b]),A=l.useCallback(()=>{b&&e(lg([b]))},[e,b]);It("Shift+U",()=>{R()},{enabled:()=>!!(i&&!n&&t)},[i,b,n,t]);const D=l.useCallback(()=>e(KT(!r)),[e,r]);It("i",()=>{b?D():d({title:p("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[b,r,d]),It("delete",()=>{A()},[e,b]);const O=l.useCallback(()=>{e(AI(!s))},[e,s]);return a.jsx(a.Fragment,{children:a.jsxs(N,{sx:{flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(zn,{isAttached:!0,isDisabled:n,children:a.jsxs(Cg,{isLazy:!0,children:[a.jsx(wg,{as:tt,"aria-label":p("parameters.imageActions"),tooltip:p("parameters.imageActions"),isDisabled:!b,icon:a.jsx(Hoe,{})}),a.jsx(Gl,{motionProps:pu,children:b&&a.jsx(w8,{imageDTO:b})})]})}),a.jsxs(zn,{isAttached:!0,isDisabled:n,children:[a.jsx(tt,{isLoading:S,icon:a.jsx(j2,{}),tooltip:`${p("nodes.loadWorkflow")} (W)`,"aria-label":`${p("nodes.loadWorkflow")} (W)`,isDisabled:!C,onClick:j}),a.jsx(tt,{isLoading:x,icon:a.jsx(XM,{}),tooltip:`${p("parameters.usePrompt")} (P)`,"aria-label":`${p("parameters.usePrompt")} (P)`,isDisabled:!(y!=null&&y.positive_prompt),onClick:P}),a.jsx(tt,{isLoading:x,icon:a.jsx(YM,{}),tooltip:`${p("parameters.useSeed")} (S)`,"aria-label":`${p("parameters.useSeed")} (S)`,isDisabled:(y==null?void 0:y.seed)===null||(y==null?void 0:y.seed)===void 0,onClick:I}),a.jsx(tt,{isLoading:x,icon:a.jsx(FM,{}),tooltip:`${p("parameters.useAll")} (A)`,"aria-label":`${p("parameters.useAll")} (A)`,isDisabled:!y,onClick:_})]}),i&&a.jsx(zn,{isAttached:!0,isDisabled:c,children:i&&a.jsx(Gfe,{imageDTO:b})}),a.jsx(zn,{isAttached:!0,children:a.jsx(tt,{icon:a.jsx(HM,{}),tooltip:`${p("parameters.info")} (I)`,"aria-label":`${p("parameters.info")} (I)`,isChecked:r,onClick:D})}),a.jsx(zn,{isAttached:!0,children:a.jsx(tt,{"aria-label":p("settings.displayInProgress"),tooltip:p("settings.displayInProgress"),icon:a.jsx(dee,{}),isChecked:s,onClick:O})}),a.jsx(zn,{isAttached:!0,children:a.jsx(Hfe,{onClick:A})})]})})},Qfe=l.memo(Kfe),Xfe=de([Ce,Dx],(e,t)=>{var j,_;const{data:n,status:r}=QT.endpoints.listImages.select(t)(e),{data:o}=e.gallery.galleryView==="images"?aS.endpoints.getBoardImagesTotal.select(t.board_id??"none")(e):aS.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(e),s=e.gallery.selection[e.gallery.selection.length-1],i=r==="pending";if(!n||!s||(o==null?void 0:o.total)===0)return{isFetching:i,queryArgs:t,isOnFirstImage:!0,isOnLastImage:!0};const c={...t,offset:n.ids.length,limit:YI},d=XT.getSelectors(),p=d.selectAll(n),h=p.findIndex(I=>I.image_name===s.image_name),m=Bl(h+1,0,p.length-1),g=Bl(h-1,0,p.length-1),b=(j=p[m])==null?void 0:j.image_name,y=(_=p[g])==null?void 0:_.image_name,x=b?d.selectById(n,b):void 0,C=y?d.selectById(n,y):void 0,S=p.length;return{loadedImagesCount:p.length,currentImageIndex:h,areMoreImagesAvailable:((o==null?void 0:o.total)??0)>S,isFetching:r==="pending",nextImage:x,prevImage:C,queryArgs:c}},{memoizeOptions:{resultEqualityCheck:Tn}}),MR=()=>{const e=oe(),{nextImage:t,prevImage:n,areMoreImagesAvailable:r,isFetching:o,queryArgs:s,loadedImagesCount:i,currentImageIndex:c}=H(Xfe),d=l.useCallback(()=>{n&&e(iS(n))},[e,n]),p=l.useCallback(()=>{t&&e(iS(t))},[e,t]),[h]=XI(),m=l.useCallback(()=>{h(s)},[h,s]);return{handlePrevImage:d,handleNextImage:p,isOnFirstImage:c===0,isOnLastImage:c!==void 0&&c===i-1,nextImage:t,prevImage:n,areMoreImagesAvailable:r,handleLoadMoreImages:m,isFetching:o}};function Yfe(e){return Qe({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 Jfe=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>{const{t:i}=J(),c=l.useCallback(()=>navigator.clipboard.writeText(t.toString()),[t]);return t?a.jsxs(N,{gap:2,children:[n&&a.jsx(Fn,{label:`Recall ${e}`,children:a.jsx(_a,{"aria-label":i("accessibility.useThisParameter"),icon:a.jsx(Yfe,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&a.jsx(Fn,{label:`Copy ${e}`,children:a.jsx(_a,{"aria-label":`Copy ${e}`,icon:a.jsx(Hu,{}),size:"xs",variant:"ghost",fontSize:14,onClick:c})}),a.jsxs(N,{direction:o?"column":"row",children:[a.jsxs(Se,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?a.jsxs(bg,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",a.jsx(DO,{mx:"2px"})]}):a.jsx(Se,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}):null},Lr=l.memo(Jfe),Zfe=e=>{var F;const{metadata:t}=e,{t:n}=J(),{recallPositivePrompt:r,recallNegativePrompt:o,recallSeed:s,recallCfgScale:i,recallModel:c,recallScheduler:d,recallVaeModel:p,recallSteps:h,recallWidth:m,recallHeight:g,recallStrength:b,recallHrfEnabled:y,recallHrfStrength:x,recallHrfMethod:C,recallLoRA:S,recallControlNet:j,recallIPAdapter:_,recallT2IAdapter:I}=f0(),P=l.useCallback(()=>{r(t==null?void 0:t.positive_prompt)},[t==null?void 0:t.positive_prompt,r]),M=l.useCallback(()=>{o(t==null?void 0:t.negative_prompt)},[t==null?void 0:t.negative_prompt,o]),R=l.useCallback(()=>{s(t==null?void 0:t.seed)},[t==null?void 0:t.seed,s]),A=l.useCallback(()=>{c(t==null?void 0:t.model)},[t==null?void 0:t.model,c]),D=l.useCallback(()=>{m(t==null?void 0:t.width)},[t==null?void 0:t.width,m]),O=l.useCallback(()=>{g(t==null?void 0:t.height)},[t==null?void 0:t.height,g]),T=l.useCallback(()=>{d(t==null?void 0:t.scheduler)},[t==null?void 0:t.scheduler,d]),Y=l.useCallback(()=>{p(t==null?void 0:t.vae)},[t==null?void 0:t.vae,p]),z=l.useCallback(()=>{h(t==null?void 0:t.steps)},[t==null?void 0:t.steps,h]),W=l.useCallback(()=>{i(t==null?void 0:t.cfg_scale)},[t==null?void 0:t.cfg_scale,i]),Q=l.useCallback(()=>{b(t==null?void 0:t.strength)},[t==null?void 0:t.strength,b]),U=l.useCallback(()=>{y(t==null?void 0:t.hrf_enabled)},[t==null?void 0:t.hrf_enabled,y]),L=l.useCallback(()=>{x(t==null?void 0:t.hrf_strength)},[t==null?void 0:t.hrf_strength,x]),ee=l.useCallback(()=>{C(t==null?void 0:t.hrf_method)},[t==null?void 0:t.hrf_method,C]),K=l.useCallback(X=>{S(X)},[S]),Z=l.useCallback(X=>{j(X)},[j]),se=l.useCallback(X=>{_(X)},[_]),fe=l.useCallback(X=>{I(X)},[I]),G=l.useMemo(()=>t!=null&&t.controlnets?t.controlnets.filter(X=>Wh(X.control_model)):[],[t==null?void 0:t.controlnets]),te=l.useMemo(()=>t!=null&&t.ipAdapters?t.ipAdapters.filter(X=>Wh(X.ip_adapter_model)):[],[t==null?void 0:t.ipAdapters]),V=l.useMemo(()=>t!=null&&t.t2iAdapters?t.t2iAdapters.filter(X=>YT(X.t2i_adapter_model)):[],[t==null?void 0:t.t2iAdapters]);return!t||Object.keys(t).length===0?null:(console.log(t),a.jsxs(a.Fragment,{children:[t.created_by&&a.jsx(Lr,{label:n("metadata.createdBy"),value:t.created_by}),t.generation_mode&&a.jsx(Lr,{label:n("metadata.generationMode"),value:t.generation_mode}),t.positive_prompt&&a.jsx(Lr,{label:n("metadata.positivePrompt"),labelPosition:"top",value:t.positive_prompt,onClick:P}),t.negative_prompt&&a.jsx(Lr,{label:n("metadata.negativePrompt"),labelPosition:"top",value:t.negative_prompt,onClick:M}),t.seed!==void 0&&t.seed!==null&&a.jsx(Lr,{label:n("metadata.seed"),value:t.seed,onClick:R}),t.model!==void 0&&t.model!==null&&t.model.model_name&&a.jsx(Lr,{label:n("metadata.model"),value:t.model.model_name,onClick:A}),t.width&&a.jsx(Lr,{label:n("metadata.width"),value:t.width,onClick:D}),t.height&&a.jsx(Lr,{label:n("metadata.height"),value:t.height,onClick:O}),t.scheduler&&a.jsx(Lr,{label:n("metadata.scheduler"),value:t.scheduler,onClick:T}),a.jsx(Lr,{label:n("metadata.vae"),value:((F=t.vae)==null?void 0:F.model_name)??"Default",onClick:Y}),t.steps&&a.jsx(Lr,{label:n("metadata.steps"),value:t.steps,onClick:z}),t.cfg_scale!==void 0&&t.cfg_scale!==null&&a.jsx(Lr,{label:n("metadata.cfgScale"),value:t.cfg_scale,onClick:W}),t.strength&&a.jsx(Lr,{label:n("metadata.strength"),value:t.strength,onClick:Q}),t.hrf_enabled&&a.jsx(Lr,{label:n("hrf.metadata.enabled"),value:t.hrf_enabled,onClick:U}),t.hrf_enabled&&t.hrf_strength&&a.jsx(Lr,{label:n("hrf.metadata.strength"),value:t.hrf_strength,onClick:L}),t.hrf_enabled&&t.hrf_method&&a.jsx(Lr,{label:n("hrf.metadata.method"),value:t.hrf_method,onClick:ee}),t.loras&&t.loras.map((X,ue)=>{if($I(X.lora))return a.jsx(Lr,{label:"LoRA",value:`${X.lora.model_name} - ${X.weight}`,onClick:K.bind(null,X)},ue)}),G.map((X,ue)=>{var q;return a.jsx(Lr,{label:"ControlNet",value:`${(q=X.control_model)==null?void 0:q.model_name} - ${X.control_weight}`,onClick:Z.bind(null,X)},ue)}),te.map((X,ue)=>{var q;return a.jsx(Lr,{label:"IP Adapter",value:`${(q=X.ip_adapter_model)==null?void 0:q.model_name} - ${X.weight}`,onClick:se.bind(null,X)},ue)}),V.map((X,ue)=>{var q;return a.jsx(Lr,{label:"T2I Adapter",value:`${(q=X.t2i_adapter_model)==null?void 0:q.model_name} - ${X.weight}`,onClick:fe.bind(null,X)},ue)})]}))},epe=l.memo(Zfe),tpe=({image:e})=>{const{t}=J(),{metadata:n}=E2(e.image_name),{workflow:r}=M2(e.workflow_id);return a.jsxs(N,{layerStyle:"first",sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",borderRadius:"base",position:"absolute",overflow:"hidden"},children:[a.jsxs(N,{gap:2,children:[a.jsx(Se,{fontWeight:"semibold",children:"File:"}),a.jsxs(bg,{href:e.image_url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.image_name,a.jsx(DO,{mx:"2px"})]})]}),a.jsxs(tc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(nc,{children:[a.jsx(xo,{children:t("metadata.recallParameters")}),a.jsx(xo,{children:t("metadata.metadata")}),a.jsx(xo,{children:t("metadata.imageDetails")}),a.jsx(xo,{children:t("metadata.workflow")})]}),a.jsxs(zu,{children:[a.jsx(Ho,{children:n?a.jsx(lc,{children:a.jsx(epe,{metadata:n})}):a.jsx(qr,{label:t("metadata.noRecallParameters")})}),a.jsx(Ho,{children:n?a.jsx(el,{data:n,label:t("metadata.metadata")}):a.jsx(qr,{label:t("metadata.noMetaData")})}),a.jsx(Ho,{children:e?a.jsx(el,{data:e,label:t("metadata.imageDetails")}):a.jsx(qr,{label:t("metadata.noImageDetails")})}),a.jsx(Ho,{children:r?a.jsx(el,{data:r,label:t("metadata.workflow")}):a.jsx(qr,{label:t("nodes.noWorkflow")})})]})]})]})},npe=l.memo(tpe),M1={color:"base.100",pointerEvents:"auto"},rpe=()=>{const{t:e}=J(),{handlePrevImage:t,handleNextImage:n,isOnFirstImage:r,isOnLastImage:o,handleLoadMoreImages:s,areMoreImagesAvailable:i,isFetching:c}=MR();return a.jsxs(Te,{sx:{position:"relative",height:"100%",width:"100%"},children:[a.jsx(Te,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineStart:0},children:!r&&a.jsx(_a,{"aria-label":e("accessibility.previousImage"),icon:a.jsx(GZ,{size:64}),variant:"unstyled",onClick:t,boxSize:16,sx:M1})}),a.jsxs(Te,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineEnd:0},children:[!o&&a.jsx(_a,{"aria-label":e("accessibility.nextImage"),icon:a.jsx(qZ,{size:64}),variant:"unstyled",onClick:n,boxSize:16,sx:M1}),o&&i&&!c&&a.jsx(_a,{"aria-label":e("accessibility.loadMore"),icon:a.jsx(UZ,{size:64}),variant:"unstyled",onClick:s,boxSize:16,sx:M1}),o&&i&&c&&a.jsx(N,{sx:{w:16,h:16,alignItems:"center",justifyContent:"center"},children:a.jsx(bi,{opacity:.5,size:"xl"})})]})]})},OR=l.memo(rpe),ope=de([Ce,JT],({ui:e,system:t},n)=>{const{shouldShowImageDetails:r,shouldHidePreview:o,shouldShowProgressInViewer:s}=e,{denoiseProgress:i,shouldAntialiasProgressImage:c}=t;return{shouldShowImageDetails:r,shouldHidePreview:o,imageName:n==null?void 0:n.image_name,denoiseProgress:i,shouldShowProgressInViewer:s,shouldAntialiasProgressImage:c}},{memoizeOptions:{resultEqualityCheck:Tn}}),spe=()=>{const{shouldShowImageDetails:e,imageName:t,denoiseProgress:n,shouldShowProgressInViewer:r,shouldAntialiasProgressImage:o}=H(ope),{handlePrevImage:s,handleNextImage:i,isOnLastImage:c,handleLoadMoreImages:d,areMoreImagesAvailable:p,isFetching:h}=MR();It("left",()=>{s()},[s]),It("right",()=>{if(c&&p&&!h){d();return}c||i()},[c,p,d,h,i]);const{currentData:m}=Ps(t??Os.skipToken),g=l.useMemo(()=>{if(m)return{id:"current-image",payloadType:"IMAGE_DTO",payload:{imageDTO:m}}},[m]),b=l.useMemo(()=>({id:"current-image",actionType:"SET_CURRENT_IMAGE"}),[]),[y,x]=l.useState(!1),C=l.useRef(0),{t:S}=J(),j=l.useCallback(()=>{x(!0),window.clearTimeout(C.current)},[]),_=l.useCallback(()=>{C.current=window.setTimeout(()=>{x(!1)},500)},[]);return a.jsxs(N,{onMouseOver:j,onMouseOut:_,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative"},children:[n!=null&&n.progress_image&&r?a.jsx(Si,{src:n.progress_image.dataURL,width:n.progress_image.width,height:n.progress_image.height,draggable:!1,"data-testid":"progress-image",sx:{objectFit:"contain",maxWidth:"full",maxHeight:"full",height:"auto",position:"absolute",borderRadius:"base",imageRendering:o?"auto":"pixelated"}}):a.jsx(il,{imageDTO:m,droppableData:b,draggableData:g,isUploadDisabled:!0,fitContainer:!0,useThumbailFallback:!0,dropLabel:S("gallery.setCurrentImage"),noContentFallback:a.jsx(qr,{icon:Ql,label:"No image selected"}),dataTestId:"image-preview"}),e&&m&&a.jsx(Te,{sx:{position:"absolute",top:"0",width:"full",height:"full",borderRadius:"base"},children:a.jsx(npe,{image:m})}),a.jsx(yo,{children:!e&&m&&y&&a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:"0",width:"100%",height:"100%",pointerEvents:"none"},children:a.jsx(OR,{})},"nextPrevButtons")})]})},ape=l.memo(spe),ipe=()=>a.jsxs(N,{sx:{position:"relative",flexDirection:"column",height:"100%",width:"100%",rowGap:4,alignItems:"center",justifyContent:"center"},children:[a.jsx(Qfe,{}),a.jsx(ape,{})]}),lpe=l.memo(ipe),cpe=()=>a.jsx(Te,{layerStyle:"first",sx:{position:"relative",width:"100%",height:"100%",p:2,borderRadius:"base"},children:a.jsx(N,{sx:{width:"100%",height:"100%"},children:a.jsx(lpe,{})})}),RR=l.memo(cpe),upe=()=>{const e=l.useRef(null),t=l.useCallback(()=>{e.current&&e.current.setLayout([50,50])},[]),n=N2();return a.jsx(Te,{sx:{w:"full",h:"full"},children:a.jsxs(g0,{ref:e,autoSaveId:"imageTab.content",direction:"horizontal",style:{height:"100%",width:"100%"},storage:n,units:"percentages",children:[a.jsx(Zi,{id:"imageTab.content.initImage",order:0,defaultSize:50,minSize:25,style:{position:"relative"},children:a.jsx(Bfe,{})}),a.jsx(Zm,{onDoubleClick:t}),a.jsx(Zi,{id:"imageTab.content.selectedImage",order:1,defaultSize:50,minSize:25,children:a.jsx(RR,{})})]})})},dpe=l.memo(upe);var fpe=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n};const $_=hf(fpe);function lx(e){return e===null||typeof e!="object"?{}:Object.keys(e).reduce((t,n)=>{const r=e[n];return r!=null&&r!==!1&&(t[n]=r),t},{})}var ppe=Object.defineProperty,L_=Object.getOwnPropertySymbols,hpe=Object.prototype.hasOwnProperty,mpe=Object.prototype.propertyIsEnumerable,z_=(e,t,n)=>t in e?ppe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gpe=(e,t)=>{for(var n in t||(t={}))hpe.call(t,n)&&z_(e,n,t[n]);if(L_)for(var n of L_(t))mpe.call(t,n)&&z_(e,n,t[n]);return e};function AR(e,t){if(t===null||typeof t!="object")return{};const n=gpe({},t);return Object.keys(t).forEach(r=>{r.includes(`${String(e)}.`)&&delete n[r]}),n}const vpe="__MANTINE_FORM_INDEX__";function F_(e,t){return t?typeof t=="boolean"?t:Array.isArray(t)?t.includes(e.replace(/[.][0-9]/g,`.${vpe}`)):!1:!1}function B_(e,t,n){typeof n.value=="object"&&(n.value=Qc(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function Qc(e){if(typeof e!="object")return e;var t=0,n,r,o,s=Object.prototype.toString.call(e);if(s==="[object Object]"?o=Object.create(e.__proto__||null):s==="[object Array]"?o=Array(e.length):s==="[object Set]"?(o=new Set,e.forEach(function(i){o.add(Qc(i))})):s==="[object Map]"?(o=new Map,e.forEach(function(i,c){o.set(Qc(c),Qc(i))})):s==="[object Date]"?o=new Date(+e):s==="[object RegExp]"?o=new RegExp(e.source,e.flags):s==="[object DataView]"?o=new e.constructor(Qc(e.buffer)):s==="[object ArrayBuffer]"?o=e.slice(0):s.slice(-6)==="Array]"&&(o=new e.constructor(e)),o){for(r=Object.getOwnPropertySymbols(e);t0,errors:t}}function cx(e,t,n="",r={}){return typeof e!="object"||e===null?r:Object.keys(e).reduce((o,s)=>{const i=e[s],c=`${n===""?"":`${n}.`}${s}`,d=ni(c,t);let p=!1;return typeof i=="function"&&(o[c]=i(d,t,c)),typeof i=="object"&&Array.isArray(d)&&(p=!0,d.forEach((h,m)=>cx(i,t,`${c}.${m}`,o))),typeof i=="object"&&typeof d=="object"&&d!==null&&(p||cx(i,t,c,o)),o},r)}function ux(e,t){return H_(typeof e=="function"?e(t):cx(e,t))}function yh(e,t,n){if(typeof e!="string")return{hasError:!1,error:null};const r=ux(t,n),o=Object.keys(r.errors).find(s=>e.split(".").every((i,c)=>i===s.split(".")[c]));return{hasError:!!o,error:o?r.errors[o]:null}}function bpe(e,{from:t,to:n},r){const o=ni(e,r);if(!Array.isArray(o))return r;const s=[...o],i=o[t];return s.splice(t,1),s.splice(n,0,i),S0(e,s,r)}var xpe=Object.defineProperty,W_=Object.getOwnPropertySymbols,ype=Object.prototype.hasOwnProperty,Cpe=Object.prototype.propertyIsEnumerable,V_=(e,t,n)=>t in e?xpe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wpe=(e,t)=>{for(var n in t||(t={}))ype.call(t,n)&&V_(e,n,t[n]);if(W_)for(var n of W_(t))Cpe.call(t,n)&&V_(e,n,t[n]);return e};function Spe(e,{from:t,to:n},r){const o=`${e}.${t}`,s=`${e}.${n}`,i=wpe({},r);return Object.keys(r).every(c=>{let d,p;if(c.startsWith(o)&&(d=c,p=c.replace(o,s)),c.startsWith(s)&&(d=c.replace(s,o),p=c),d&&p){const h=i[d],m=i[p];return m===void 0?delete i[d]:i[d]=m,h===void 0?delete i[p]:i[p]=h,!1}return!0}),i}function kpe(e,t,n){const r=ni(e,n);return Array.isArray(r)?S0(e,r.filter((o,s)=>s!==t),n):n}var jpe=Object.defineProperty,U_=Object.getOwnPropertySymbols,_pe=Object.prototype.hasOwnProperty,Ipe=Object.prototype.propertyIsEnumerable,G_=(e,t,n)=>t in e?jpe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ppe=(e,t)=>{for(var n in t||(t={}))_pe.call(t,n)&&G_(e,n,t[n]);if(U_)for(var n of U_(t))Ipe.call(t,n)&&G_(e,n,t[n]);return e};function q_(e,t){const n=e.substring(t.length+1).split(".")[0];return parseInt(n,10)}function K_(e,t,n,r){if(t===void 0)return n;const o=`${String(e)}`;let s=n;r===-1&&(s=AR(`${o}.${t}`,s));const i=Ppe({},s),c=new Set;return Object.entries(s).filter(([d])=>{if(!d.startsWith(`${o}.`))return!1;const p=q_(d,o);return Number.isNaN(p)?!1:p>=t}).forEach(([d,p])=>{const h=q_(d,o),m=d.replace(`${o}.${h}`,`${o}.${h+r}`);i[m]=p,c.add(m),c.has(d)||delete i[d]}),i}function Epe(e,t,n,r){const o=ni(e,r);if(!Array.isArray(o))return r;const s=[...o];return s.splice(typeof n=="number"?n:s.length,0,t),S0(e,s,r)}function Q_(e,t){const n=Object.keys(e);if(typeof t=="string"){const r=n.filter(o=>o.startsWith(`${t}.`));return e[t]||r.some(o=>e[o])||!1}return n.some(r=>e[r])}function Mpe(e){return t=>{if(!t)e(t);else if(typeof t=="function")e(t);else if(typeof t=="object"&&"nativeEvent"in t){const{currentTarget:n}=t;n instanceof HTMLInputElement?n.type==="checkbox"?e(n.checked):e(n.value):(n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)&&e(n.value)}else e(t)}}var Ope=Object.defineProperty,Rpe=Object.defineProperties,Ape=Object.getOwnPropertyDescriptors,X_=Object.getOwnPropertySymbols,Dpe=Object.prototype.hasOwnProperty,Tpe=Object.prototype.propertyIsEnumerable,Y_=(e,t,n)=>t in e?Ope(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fi=(e,t)=>{for(var n in t||(t={}))Dpe.call(t,n)&&Y_(e,n,t[n]);if(X_)for(var n of X_(t))Tpe.call(t,n)&&Y_(e,n,t[n]);return e},O1=(e,t)=>Rpe(e,Ape(t));function cc({initialValues:e={},initialErrors:t={},initialDirty:n={},initialTouched:r={},clearInputErrorOnChange:o=!0,validateInputOnChange:s=!1,validateInputOnBlur:i=!1,transformValues:c=p=>p,validate:d}={}){const[p,h]=l.useState(r),[m,g]=l.useState(n),[b,y]=l.useState(e),[x,C]=l.useState(lx(t)),S=l.useRef(e),j=V=>{S.current=V},_=l.useCallback(()=>h({}),[]),I=V=>{const F=V?Fi(Fi({},b),V):b;j(F),g({})},P=l.useCallback(V=>C(F=>lx(typeof V=="function"?V(F):V)),[]),M=l.useCallback(()=>C({}),[]),R=l.useCallback(()=>{y(e),M(),j(e),g({}),_()},[]),A=l.useCallback((V,F)=>P(X=>O1(Fi({},X),{[V]:F})),[]),D=l.useCallback(V=>P(F=>{if(typeof V!="string")return F;const X=Fi({},F);return delete X[V],X}),[]),O=l.useCallback(V=>g(F=>{if(typeof V!="string")return F;const X=AR(V,F);return delete X[V],X}),[]),T=l.useCallback((V,F)=>{const X=F_(V,s);O(V),h(ue=>O1(Fi({},ue),{[V]:!0})),y(ue=>{const q=S0(V,F,ue);if(X){const ne=yh(V,d,q);ne.hasError?A(V,ne.error):D(V)}return q}),!X&&o&&A(V,null)},[]),Y=l.useCallback(V=>{y(F=>{const X=typeof V=="function"?V(F):V;return Fi(Fi({},F),X)}),o&&M()},[]),z=l.useCallback((V,F)=>{O(V),y(X=>bpe(V,F,X)),C(X=>Spe(V,F,X))},[]),W=l.useCallback((V,F)=>{O(V),y(X=>kpe(V,F,X)),C(X=>K_(V,F,X,-1))},[]),Q=l.useCallback((V,F,X)=>{O(V),y(ue=>Epe(V,F,X,ue)),C(ue=>K_(V,X,ue,1))},[]),U=l.useCallback(()=>{const V=ux(d,b);return C(V.errors),V},[b,d]),L=l.useCallback(V=>{const F=yh(V,d,b);return F.hasError?A(V,F.error):D(V),F},[b,d]),ee=(V,{type:F="input",withError:X=!0,withFocus:ue=!0}={})=>{const ne={onChange:Mpe(pe=>T(V,pe))};return X&&(ne.error=x[V]),F==="checkbox"?ne.checked=ni(V,b):ne.value=ni(V,b),ue&&(ne.onFocus=()=>h(pe=>O1(Fi({},pe),{[V]:!0})),ne.onBlur=()=>{if(F_(V,i)){const pe=yh(V,d,b);pe.hasError?A(V,pe.error):D(V)}}),ne},K=(V,F)=>X=>{X==null||X.preventDefault();const ue=U();ue.hasErrors?F==null||F(ue.errors,b,X):V==null||V(c(b),X)},Z=V=>c(V||b),se=l.useCallback(V=>{V.preventDefault(),R()},[]),fe=V=>{if(V){const X=ni(V,m);if(typeof X=="boolean")return X;const ue=ni(V,b),q=ni(V,S.current);return!$_(ue,q)}return Object.keys(m).length>0?Q_(m):!$_(b,S.current)},G=l.useCallback(V=>Q_(p,V),[p]),te=l.useCallback(V=>V?!yh(V,d,b).hasError:!ux(d,b).hasErrors,[b,d]);return{values:b,errors:x,setValues:Y,setErrors:P,setFieldValue:T,setFieldError:A,clearFieldError:D,clearErrors:M,reset:R,validate:U,validateField:L,reorderListItem:z,removeListItem:W,insertListItem:Q,getInputProps:ee,onSubmit:K,onReset:se,isDirty:fe,isTouched:G,setTouched:h,setDirty:g,resetTouched:_,resetDirty:I,isValid:te,getTransformedValues:Z}}function Mr(e){const{...t}=e,{base50:n,base100:r,base200:o,base300:s,base800:i,base700:c,base900:d,accent500:p,accent300:h}=Hf(),{colorMode:m}=wi(),g=l.useCallback(()=>({input:{color:Ke(d,r)(m),backgroundColor:Ke(n,d)(m),borderColor:Ke(o,i)(m),borderWidth:2,outline:"none",":focus":{borderColor:Ke(h,p)(m)}},label:{color:Ke(c,s)(m),fontWeight:"normal",marginBottom:4}}),[h,p,r,o,s,n,c,i,d,m]);return a.jsx(MM,{styles:g,...t})}const Npe=[{value:"sd-1",label:gr["sd-1"]},{value:"sd-2",label:gr["sd-2"]},{value:"sdxl",label:gr.sdxl},{value:"sdxl-refiner",label:gr["sdxl-refiner"]}];function Qf(e){const{...t}=e,{t:n}=J();return a.jsx(Ar,{label:n("modelManager.baseModel"),data:Npe,...t})}function TR(e){const{data:t}=pP(),{...n}=e;return a.jsx(Ar,{label:"Config File",placeholder:"Select A Config File",data:t||[],...n})}const $pe=[{value:"normal",label:"Normal"},{value:"inpaint",label:"Inpaint"},{value:"depth",label:"Depth"}];function k0(e){const{...t}=e,{t:n}=J();return a.jsx(Ar,{label:n("modelManager.variant"),data:$pe,...t})}function ng(e,t=!0){let n;t?n=new RegExp("[^\\\\/]+(?=\\.)"):n=new RegExp("[^\\\\/]+(?=[\\\\/]?$)");const r=e.match(n);return r?r[0]:""}function NR(e){const{t}=J(),n=oe(),{model_path:r}=e,o=cc({initialValues:{model_name:r?ng(r):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"checkpoint",error:void 0,vae:"",variant:"normal",config:"configs\\stable-diffusion\\v1-inference.yaml"}}),[s]=hP(),[i,c]=l.useState(!1),d=m=>{s({body:m}).unwrap().then(g=>{n(Bt(Zn({title:t("modelManager.modelAdded",{modelName:m.model_name}),status:"success"}))),o.reset(),r&&n(xf(null))}).catch(g=>{g&&n(Bt(Zn({title:t("toast.modelAddFailed"),status:"error"})))})},p=l.useCallback(m=>{if(o.values.model_name===""){const g=ng(m.currentTarget.value);g&&o.setFieldValue("model_name",g)}},[o]),h=l.useCallback(()=>c(m=>!m),[]);return a.jsx("form",{onSubmit:o.onSubmit(m=>d(m)),style:{width:"100%"},children:a.jsxs(N,{flexDirection:"column",gap:2,children:[a.jsx(Mr,{label:t("modelManager.model"),required:!0,...o.getInputProps("model_name")}),a.jsx(Qf,{label:t("modelManager.baseModel"),...o.getInputProps("base_model")}),a.jsx(Mr,{label:t("modelManager.modelLocation"),required:!0,...o.getInputProps("path"),onBlur:p}),a.jsx(Mr,{label:t("modelManager.description"),...o.getInputProps("description")}),a.jsx(Mr,{label:t("modelManager.vaeLocation"),...o.getInputProps("vae")}),a.jsx(k0,{label:t("modelManager.variant"),...o.getInputProps("variant")}),a.jsxs(N,{flexDirection:"column",width:"100%",gap:2,children:[i?a.jsx(Mr,{required:!0,label:t("modelManager.customConfigFileLocation"),...o.getInputProps("config")}):a.jsx(TR,{required:!0,width:"100%",...o.getInputProps("config")}),a.jsx(Io,{isChecked:i,onChange:h,label:t("modelManager.useCustomConfig")}),a.jsx(Rt,{mt:2,type:"submit",children:t("modelManager.addModel")})]})]})})}function $R(e){const{t}=J(),n=oe(),{model_path:r}=e,[o]=hP(),s=cc({initialValues:{model_name:r?ng(r,!1):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"diffusers",error:void 0,vae:"",variant:"normal"}}),i=d=>{o({body:d}).unwrap().then(p=>{n(Bt(Zn({title:t("modelManager.modelAdded",{modelName:d.model_name}),status:"success"}))),s.reset(),r&&n(xf(null))}).catch(p=>{p&&n(Bt(Zn({title:t("toast.modelAddFailed"),status:"error"})))})},c=l.useCallback(d=>{if(s.values.model_name===""){const p=ng(d.currentTarget.value,!1);p&&s.setFieldValue("model_name",p)}},[s]);return a.jsx("form",{onSubmit:s.onSubmit(d=>i(d)),style:{width:"100%"},children:a.jsxs(N,{flexDirection:"column",gap:2,children:[a.jsx(Mr,{required:!0,label:t("modelManager.model"),...s.getInputProps("model_name")}),a.jsx(Qf,{label:t("modelManager.baseModel"),...s.getInputProps("base_model")}),a.jsx(Mr,{required:!0,label:t("modelManager.modelLocation"),placeholder:t("modelManager.modelLocationValidationMsg"),...s.getInputProps("path"),onBlur:c}),a.jsx(Mr,{label:t("modelManager.description"),...s.getInputProps("description")}),a.jsx(Mr,{label:t("modelManager.vaeLocation"),...s.getInputProps("vae")}),a.jsx(k0,{label:t("modelManager.variant"),...s.getInputProps("variant")}),a.jsx(Rt,{mt:2,type:"submit",children:t("modelManager.addModel")})]})})}const LR=[{label:"Diffusers",value:"diffusers"},{label:"Checkpoint / Safetensors",value:"checkpoint"}];function Lpe(){const[e,t]=l.useState("diffusers"),{t:n}=J(),r=l.useCallback(o=>{o&&t(o)},[]);return a.jsxs(N,{flexDirection:"column",gap:4,width:"100%",children:[a.jsx(Ar,{label:n("modelManager.modelType"),value:e,data:LR,onChange:r}),a.jsxs(N,{sx:{p:4,borderRadius:4,bg:"base.300",_dark:{bg:"base.850"}},children:[e==="diffusers"&&a.jsx($R,{}),e==="checkpoint"&&a.jsx(NR,{})]})]})}const zpe=[{label:"None",value:"none"},{label:"v_prediction",value:"v_prediction"},{label:"epsilon",value:"epsilon"},{label:"sample",value:"sample"}];function Fpe(){const e=oe(),{t}=J(),[n,{isLoading:r}]=mP(),o=cc({initialValues:{location:"",prediction_type:void 0}}),s=i=>{const c={location:i.location,prediction_type:i.prediction_type==="none"?void 0:i.prediction_type};n({body:c}).unwrap().then(d=>{e(Bt(Zn({title:t("toast.modelAddedSimple"),status:"success"}))),o.reset()}).catch(d=>{d&&e(Bt(Zn({title:`${d.data.detail} `,status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(i=>s(i)),style:{width:"100%"},children:a.jsxs(N,{flexDirection:"column",width:"100%",gap:4,children:[a.jsx(Mr,{label:t("modelManager.modelLocation"),placeholder:t("modelManager.simpleModelDesc"),w:"100%",...o.getInputProps("location")}),a.jsx(Ar,{label:t("modelManager.predictionType"),data:zpe,defaultValue:"none",...o.getInputProps("prediction_type")}),a.jsx(Rt,{type:"submit",isLoading:r,children:t("modelManager.addModel")})]})})}function Bpe(){const[e,t]=l.useState("simple"),n=l.useCallback(()=>t("simple"),[]),r=l.useCallback(()=>t("advanced"),[]);return a.jsxs(N,{flexDirection:"column",width:"100%",overflow:"scroll",maxHeight:window.innerHeight-250,gap:4,children:[a.jsxs(zn,{isAttached:!0,children:[a.jsx(Rt,{size:"sm",isChecked:e=="simple",onClick:n,children:"Simple"}),a.jsx(Rt,{size:"sm",isChecked:e=="advanced",onClick:r,children:"Advanced"})]}),a.jsxs(N,{sx:{p:4,borderRadius:4,background:"base.200",_dark:{background:"base.800"}},children:[e==="simple"&&a.jsx(Fpe,{}),e==="advanced"&&a.jsx(Lpe,{})]})]})}function Hpe(e){const{...t}=e;return a.jsx(SE,{w:"100%",...t,children:e.children})}function Wpe(){const e=H(C=>C.modelmanager.searchFolder),[t,n]=l.useState(""),{data:r}=na(Ol),{foundModels:o,alreadyInstalled:s,filteredModels:i}=gP({search_path:e||""},{selectFromResult:({data:C})=>{const S=x$(r==null?void 0:r.entities),j=Ro(S,"path"),_=h$(C,j),I=k$(C,j);return{foundModels:C,alreadyInstalled:J_(I,t),filteredModels:J_(_,t)}}}),[c,{isLoading:d}]=mP(),p=oe(),{t:h}=J(),m=l.useCallback(C=>{const S=C.currentTarget.id.split("\\").splice(-1)[0];c({body:{location:C.currentTarget.id}}).unwrap().then(j=>{p(Bt(Zn({title:`Added Model: ${S}`,status:"success"})))}).catch(j=>{j&&p(Bt(Zn({title:h("toast.modelAddFailed"),status:"error"})))})},[p,c,h]),g=l.useCallback(C=>{n(C.target.value)},[]),b=l.useCallback(C=>p(xf(C)),[p]),y=({models:C,showActions:S=!0})=>C.map(j=>a.jsxs(N,{sx:{p:4,gap:4,alignItems:"center",borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(N,{w:"100%",sx:{flexDirection:"column",minW:"25%"},children:[a.jsx(Se,{sx:{fontWeight:600},children:j.split("\\").slice(-1)[0]}),a.jsx(Se,{sx:{fontSize:"sm",color:"base.600",_dark:{color:"base.400"}},children:j})]}),S?a.jsxs(N,{gap:2,children:[a.jsx(Rt,{id:j,onClick:m,isLoading:d,children:h("modelManager.quickAdd")}),a.jsx(Rt,{onClick:b.bind(null,j),isLoading:d,children:h("modelManager.advanced")})]}):a.jsx(Se,{sx:{fontWeight:600,p:2,borderRadius:4,color:"accent.50",bg:"accent.400",_dark:{color:"accent.100",bg:"accent.600"}},children:"Installed"})]},j));return(()=>e?!o||o.length===0?a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",height:96,userSelect:"none",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(Se,{variant:"subtext",children:h("modelManager.noModels")})}):a.jsxs(N,{sx:{flexDirection:"column",gap:2,w:"100%",minW:"50%"},children:[a.jsx(Cs,{onChange:g,label:h("modelManager.search"),labelPos:"side"}),a.jsxs(N,{p:2,gap:2,children:[a.jsxs(Se,{sx:{fontWeight:600},children:["Models Found: ",o.length]}),a.jsxs(Se,{sx:{fontWeight:600,color:"accent.500",_dark:{color:"accent.200"}},children:["Not Installed: ",i.length]})]}),a.jsx(Hpe,{offsetScrollbars:!0,children:a.jsxs(N,{gap:2,flexDirection:"column",children:[y({models:i}),y({models:s,showActions:!1})]})})]}):null)()}const J_=(e,t)=>{const n=[];return Kr(e,r=>{if(!r)return null;r.includes(t)&&n.push(r)}),n};function Vpe(){const e=H(p=>p.modelmanager.advancedAddScanModel),{t}=J(),[n,r]=l.useState("diffusers"),[o,s]=l.useState(!0);l.useEffect(()=>{e&&[".ckpt",".safetensors",".pth",".pt"].some(p=>e.endsWith(p))?r("checkpoint"):r("diffusers")},[e,r,o]);const i=oe(),c=l.useCallback(()=>i(xf(null)),[i]),d=l.useCallback(p=>{p&&(r(p),s(p==="checkpoint"))},[]);return e?a.jsxs(Te,{as:Or.div,initial:{x:-100,opacity:0},animate:{x:0,opacity:1,transition:{duration:.2}},sx:{display:"flex",flexDirection:"column",minWidth:"40%",maxHeight:window.innerHeight-300,overflow:"scroll",p:4,gap:4,borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(N,{justifyContent:"space-between",alignItems:"center",children:[a.jsx(Se,{size:"xl",fontWeight:600,children:o||n==="checkpoint"?"Add Checkpoint Model":"Add Diffusers Model"}),a.jsx(tt,{icon:a.jsx(ju,{}),"aria-label":t("modelManager.closeAdvanced"),onClick:c,size:"sm"})]}),a.jsx(Ar,{label:t("modelManager.modelType"),value:n,data:LR,onChange:d}),o?a.jsx(NR,{model_path:e},e):a.jsx($R,{model_path:e},e)]}):null}function Upe(){const e=oe(),{t}=J(),n=H(d=>d.modelmanager.searchFolder),{refetch:r}=gP({search_path:n||""}),o=cc({initialValues:{folder:""}}),s=l.useCallback(d=>{e(lS(d.folder))},[e]),i=l.useCallback(()=>{r()},[r]),c=l.useCallback(()=>{e(lS(null)),e(xf(null))},[e]);return a.jsx("form",{onSubmit:o.onSubmit(d=>s(d)),style:{width:"100%"},children:a.jsxs(N,{sx:{w:"100%",gap:2,borderRadius:4,alignItems:"center"},children:[a.jsxs(N,{w:"100%",alignItems:"center",gap:4,minH:12,children:[a.jsx(Se,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",minW:"max-content",_dark:{color:"base.300"}},children:"Folder"}),n?a.jsx(N,{sx:{w:"100%",p:2,px:4,bg:"base.300",borderRadius:4,fontSize:"sm",fontWeight:"bold",_dark:{bg:"base.700"}},children:n}):a.jsx(Cs,{w:"100%",size:"md",...o.getInputProps("folder")})]}),a.jsxs(N,{gap:2,children:[n?a.jsx(tt,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:a.jsx(Xg,{}),onClick:i,fontSize:18,size:"sm"}):a.jsx(tt,{"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),icon:a.jsx(See,{}),fontSize:18,size:"sm",type:"submit"}),a.jsx(tt,{"aria-label":t("modelManager.clearCheckpointFolder"),tooltip:t("modelManager.clearCheckpointFolder"),icon:a.jsx(qo,{}),size:"sm",onClick:c,isDisabled:!n,colorScheme:"red"})]})]})})}const Gpe=l.memo(Upe);function qpe(){return a.jsxs(N,{flexDirection:"column",w:"100%",gap:4,children:[a.jsx(Gpe,{}),a.jsxs(N,{gap:4,children:[a.jsx(N,{sx:{maxHeight:window.innerHeight-300,overflow:"scroll",gap:4,w:"100%"},children:a.jsx(Wpe,{})}),a.jsx(Vpe,{})]})]})}function Kpe(){const[e,t]=l.useState("add"),{t:n}=J(),r=l.useCallback(()=>t("add"),[]),o=l.useCallback(()=>t("scan"),[]);return a.jsxs(N,{flexDirection:"column",gap:4,children:[a.jsxs(zn,{isAttached:!0,children:[a.jsx(Rt,{onClick:r,isChecked:e=="add",size:"sm",width:"100%",children:n("modelManager.addModel")}),a.jsx(Rt,{onClick:o,isChecked:e=="scan",size:"sm",width:"100%",children:n("modelManager.scanForModels")})]}),e=="add"&&a.jsx(Bpe,{}),e=="scan"&&a.jsx(qpe,{})]})}const Qpe=[{label:"Stable Diffusion 1",value:"sd-1"},{label:"Stable Diffusion 2",value:"sd-2"}];function Xpe(){var X,ue;const{t:e}=J(),t=oe(),{data:n}=na(Ol),[r,{isLoading:o}]=ZT(),[s,i]=l.useState("sd-1"),c=CS(n==null?void 0:n.entities,(q,ne)=>(q==null?void 0:q.model_format)==="diffusers"&&(q==null?void 0:q.base_model)==="sd-1"),d=CS(n==null?void 0:n.entities,(q,ne)=>(q==null?void 0:q.model_format)==="diffusers"&&(q==null?void 0:q.base_model)==="sd-2"),p=l.useMemo(()=>({"sd-1":c,"sd-2":d}),[c,d]),[h,m]=l.useState(((X=Object.keys(p[s]))==null?void 0:X[0])??null),[g,b]=l.useState(((ue=Object.keys(p[s]))==null?void 0:ue[1])??null),[y,x]=l.useState(null),[C,S]=l.useState(""),[j,_]=l.useState(.5),[I,P]=l.useState("weighted_sum"),[M,R]=l.useState("root"),[A,D]=l.useState(""),[O,T]=l.useState(!1),Y=Object.keys(p[s]).filter(q=>q!==g&&q!==y),z=Object.keys(p[s]).filter(q=>q!==h&&q!==y),W=Object.keys(p[s]).filter(q=>q!==h&&q!==g),Q=l.useCallback(q=>{i(q),m(null),b(null)},[]),U=l.useCallback(q=>{m(q)},[]),L=l.useCallback(q=>{b(q)},[]),ee=l.useCallback(q=>{q?(x(q),P("weighted_sum")):(x(null),P("add_difference"))},[]),K=l.useCallback(q=>S(q.target.value),[]),Z=l.useCallback(q=>_(q),[]),se=l.useCallback(()=>_(.5),[]),fe=l.useCallback(q=>P(q),[]),G=l.useCallback(q=>R(q),[]),te=l.useCallback(q=>D(q.target.value),[]),V=l.useCallback(q=>T(q.target.checked),[]),F=l.useCallback(()=>{const q=[];let ne=[h,g,y];ne=ne.filter(le=>le!==null),ne.forEach(le=>{var ve;const we=(ve=le==null?void 0:le.split("/"))==null?void 0:ve[2];we&&q.push(we)});const pe={model_names:q,merged_model_name:C!==""?C:q.join("-"),alpha:j,interp:I,force:O,merge_dest_directory:M==="root"?void 0:A};r({base_model:s,body:{body:pe}}).unwrap().then(le=>{t(Bt(Zn({title:e("modelManager.modelsMerged"),status:"success"})))}).catch(le=>{le&&t(Bt(Zn({title:e("modelManager.modelsMergeFailed"),status:"error"})))})},[s,t,r,C,j,A,O,I,M,h,y,g,e]);return a.jsxs(N,{flexDirection:"column",rowGap:4,children:[a.jsxs(N,{sx:{flexDirection:"column",rowGap:1},children:[a.jsx(Se,{children:e("modelManager.modelMergeHeaderHelp1")}),a.jsx(Se,{fontSize:"sm",variant:"subtext",children:e("modelManager.modelMergeHeaderHelp2")})]}),a.jsxs(N,{columnGap:4,children:[a.jsx(Ar,{label:"Model Type",w:"100%",data:Qpe,value:s,onChange:Q}),a.jsx(tr,{label:e("modelManager.modelOne"),w:"100%",value:h,placeholder:e("modelManager.selectModel"),data:Y,onChange:U}),a.jsx(tr,{label:e("modelManager.modelTwo"),w:"100%",placeholder:e("modelManager.selectModel"),value:g,data:z,onChange:L}),a.jsx(tr,{label:e("modelManager.modelThree"),data:W,w:"100%",placeholder:e("modelManager.selectModel"),clearable:!0,onChange:ee})]}),a.jsx(Cs,{label:e("modelManager.mergedModelName"),value:C,onChange:K}),a.jsxs(N,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(Pt,{label:e("modelManager.alpha"),min:.01,max:.99,step:.01,value:j,onChange:Z,withInput:!0,withReset:!0,handleReset:se,withSliderMarks:!0}),a.jsx(Se,{variant:"subtext",fontSize:"sm",children:e("modelManager.modelMergeAlphaHelp")})]}),a.jsxs(N,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(Se,{fontWeight:500,fontSize:"sm",variant:"subtext",children:e("modelManager.interpolationType")}),a.jsx(em,{value:I,onChange:fe,children:a.jsx(N,{columnGap:4,children:y===null?a.jsxs(a.Fragment,{children:[a.jsx(Za,{value:"weighted_sum",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.weightedSum")})}),a.jsx(Za,{value:"sigmoid",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.sigmoid")})}),a.jsx(Za,{value:"inv_sigmoid",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.inverseSigmoid")})})]}):a.jsx(Za,{value:"add_difference",children:a.jsx(Fn,{label:e("modelManager.modelMergeInterpAddDifferenceHelp"),children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.addDifference")})})})})})]}),a.jsxs(N,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.900"}},children:[a.jsxs(N,{columnGap:4,children:[a.jsx(Se,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:e("modelManager.mergedModelSaveLocation")}),a.jsx(em,{value:M,onChange:G,children:a.jsxs(N,{columnGap:4,children:[a.jsx(Za,{value:"root",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.invokeAIFolder")})}),a.jsx(Za,{value:"custom",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.custom")})})]})})]}),M==="custom"&&a.jsx(Cs,{label:e("modelManager.mergedModelCustomSaveLocation"),value:A,onChange:te})]}),a.jsx(Io,{label:e("modelManager.ignoreMismatch"),isChecked:O,onChange:V,fontWeight:"500"}),a.jsx(Rt,{onClick:F,isLoading:o,isDisabled:h===null||g===null,children:e("modelManager.merge")})]})}function Ype(e){const{model:t}=e,n=oe(),{t:r}=J(),[o,{isLoading:s}]=eN(),[i,c]=l.useState("InvokeAIRoot"),[d,p]=l.useState("");l.useEffect(()=>{c("InvokeAIRoot")},[t]);const h=l.useCallback(()=>{c("InvokeAIRoot")},[]),m=l.useCallback(y=>{c(y)},[]),g=l.useCallback(y=>{p(y.target.value)},[]),b=l.useCallback(()=>{const y={base_model:t.base_model,model_name:t.model_name,convert_dest_directory:i==="Custom"?d:void 0};if(i==="Custom"&&d===""){n(Bt(Zn({title:r("modelManager.noCustomLocationProvided"),status:"error"})));return}n(Bt(Zn({title:`${r("modelManager.convertingModelBegin")}: ${t.model_name}`,status:"info"}))),o(y).unwrap().then(()=>{n(Bt(Zn({title:`${r("modelManager.modelConverted")}: ${t.model_name}`,status:"success"})))}).catch(()=>{n(Bt(Zn({title:`${r("modelManager.modelConversionFailed")}: ${t.model_name}`,status:"error"})))})},[o,d,n,t.base_model,t.model_name,i,r]);return a.jsxs(p0,{title:`${r("modelManager.convert")} ${t.model_name}`,acceptCallback:b,cancelCallback:h,acceptButtonText:`${r("modelManager.convert")}`,triggerComponent:a.jsxs(Rt,{size:"sm","aria-label":r("modelManager.convertToDiffusers"),className:" modal-close-btn",isLoading:s,children:["🧨 ",r("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[a.jsxs(N,{flexDirection:"column",rowGap:4,children:[a.jsx(Se,{children:r("modelManager.convertToDiffusersHelpText1")}),a.jsxs(Mf,{children:[a.jsx(ws,{children:r("modelManager.convertToDiffusersHelpText2")}),a.jsx(ws,{children:r("modelManager.convertToDiffusersHelpText3")}),a.jsx(ws,{children:r("modelManager.convertToDiffusersHelpText4")}),a.jsx(ws,{children:r("modelManager.convertToDiffusersHelpText5")})]}),a.jsx(Se,{children:r("modelManager.convertToDiffusersHelpText6")})]}),a.jsxs(N,{flexDir:"column",gap:2,children:[a.jsxs(N,{marginTop:4,flexDir:"column",gap:2,children:[a.jsx(Se,{fontWeight:"600",children:r("modelManager.convertToDiffusersSaveLocation")}),a.jsx(em,{value:i,onChange:m,children:a.jsxs(N,{gap:4,children:[a.jsx(Za,{value:"InvokeAIRoot",children:a.jsx(Fn,{label:"Save converted model in the InvokeAI root folder",children:r("modelManager.invokeRoot")})}),a.jsx(Za,{value:"Custom",children:a.jsx(Fn,{label:"Save converted model in a custom folder",children:r("modelManager.custom")})})]})})]}),i==="Custom"&&a.jsxs(N,{flexDirection:"column",rowGap:2,children:[a.jsx(Se,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:r("modelManager.customSaveLocation")}),a.jsx(Cs,{value:d,onChange:g,width:"full"})]})]})]})}function Jpe(e){const{model:t}=e,[n,{isLoading:r}]=vP(),{data:o}=pP(),[s,i]=l.useState(!1);l.useEffect(()=>{o!=null&&o.includes(t.config)||i(!0)},[o,t.config]);const c=oe(),{t:d}=J(),p=cc({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"checkpoint",vae:t.vae?t.vae:"",config:t.config?t.config:"",variant:t.variant},validate:{path:g=>g.trim().length===0?"Must provide a path":null}}),h=l.useCallback(()=>i(g=>!g),[]),m=l.useCallback(g=>{const b={base_model:t.base_model,model_name:t.model_name,body:g};n(b).unwrap().then(y=>{p.setValues(y),c(Bt(Zn({title:d("modelManager.modelUpdated"),status:"success"})))}).catch(y=>{p.reset(),c(Bt(Zn({title:d("modelManager.modelUpdateFailed"),status:"error"})))})},[p,c,t.base_model,t.model_name,d,n]);return a.jsxs(N,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(N,{justifyContent:"space-between",alignItems:"center",children:[a.jsxs(N,{flexDirection:"column",children:[a.jsx(Se,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(Se,{fontSize:"sm",color:"base.400",children:[gr[t.base_model]," Model"]})]}),[""].includes(t.base_model)?a.jsx(Ha,{sx:{p:2,borderRadius:4,bg:"error.200",_dark:{bg:"error.400"}},children:"Conversion Not Supported"}):a.jsx(Ype,{model:t})]}),a.jsx(no,{}),a.jsx(N,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",children:a.jsx("form",{onSubmit:p.onSubmit(g=>m(g)),children:a.jsxs(N,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Mr,{label:d("modelManager.name"),...p.getInputProps("model_name")}),a.jsx(Mr,{label:d("modelManager.description"),...p.getInputProps("description")}),a.jsx(Qf,{required:!0,...p.getInputProps("base_model")}),a.jsx(k0,{required:!0,...p.getInputProps("variant")}),a.jsx(Mr,{required:!0,label:d("modelManager.modelLocation"),...p.getInputProps("path")}),a.jsx(Mr,{label:d("modelManager.vaeLocation"),...p.getInputProps("vae")}),a.jsxs(N,{flexDirection:"column",gap:2,children:[s?a.jsx(Mr,{required:!0,label:d("modelManager.config"),...p.getInputProps("config")}):a.jsx(TR,{required:!0,...p.getInputProps("config")}),a.jsx(Io,{isChecked:s,onChange:h,label:"Use Custom Config"})]}),a.jsx(Rt,{type:"submit",isLoading:r,children:d("modelManager.updateModel")})]})})})]})}function Zpe(e){const{model:t}=e,[n,{isLoading:r}]=vP(),o=oe(),{t:s}=J(),i=cc({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"diffusers",vae:t.vae?t.vae:"",variant:t.variant},validate:{path:d=>d.trim().length===0?"Must provide a path":null}}),c=l.useCallback(d=>{const p={base_model:t.base_model,model_name:t.model_name,body:d};n(p).unwrap().then(h=>{i.setValues(h),o(Bt(Zn({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(h=>{i.reset(),o(Bt(Zn({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[i,o,t.base_model,t.model_name,s,n]);return a.jsxs(N,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(N,{flexDirection:"column",children:[a.jsx(Se,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(Se,{fontSize:"sm",color:"base.400",children:[gr[t.base_model]," Model"]})]}),a.jsx(no,{}),a.jsx("form",{onSubmit:i.onSubmit(d=>c(d)),children:a.jsxs(N,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Mr,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(Mr,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Qf,{required:!0,...i.getInputProps("base_model")}),a.jsx(k0,{required:!0,...i.getInputProps("variant")}),a.jsx(Mr,{required:!0,label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(Mr,{label:s("modelManager.vaeLocation"),...i.getInputProps("vae")}),a.jsx(Rt,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function ehe(e){const{model:t}=e,[n,{isLoading:r}]=tN(),o=oe(),{t:s}=J(),i=cc({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"lora",path:t.path?t.path:"",description:t.description?t.description:"",model_format:t.model_format},validate:{path:d=>d.trim().length===0?"Must provide a path":null}}),c=l.useCallback(d=>{const p={base_model:t.base_model,model_name:t.model_name,body:d};n(p).unwrap().then(h=>{i.setValues(h),o(Bt(Zn({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(h=>{i.reset(),o(Bt(Zn({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[o,i,t.base_model,t.model_name,s,n]);return a.jsxs(N,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(N,{flexDirection:"column",children:[a.jsx(Se,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(Se,{fontSize:"sm",color:"base.400",children:[gr[t.base_model]," Model ⋅"," ",nN[t.model_format]," format"]})]}),a.jsx(no,{}),a.jsx("form",{onSubmit:i.onSubmit(d=>c(d)),children:a.jsxs(N,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Mr,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(Mr,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Qf,{...i.getInputProps("base_model")}),a.jsx(Mr,{label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(Rt,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function the(e){const{t}=J(),n=oe(),[r]=rN(),[o]=oN(),{model:s,isSelected:i,setSelectedModelId:c}=e,d=l.useCallback(()=>{c(s.id)},[s.id,c]),p=l.useCallback(()=>{const h={main:r,lora:o,onnx:r}[s.model_type];h(s).unwrap().then(m=>{n(Bt(Zn({title:`${t("modelManager.modelDeleted")}: ${s.model_name}`,status:"success"})))}).catch(m=>{m&&n(Bt(Zn({title:`${t("modelManager.modelDeleteFailed")}: ${s.model_name}`,status:"error"})))}),c(void 0)},[r,o,s,c,n,t]);return a.jsxs(N,{sx:{gap:2,alignItems:"center",w:"full"},children:[a.jsx(N,{as:Rt,isChecked:i,sx:{justifyContent:"start",p:2,borderRadius:"base",w:"full",alignItems:"center",bg:i?"accent.400":"base.100",color:i?"base.50":"base.800",_hover:{bg:i?"accent.500":"base.300",color:i?"base.50":"base.800"},_dark:{color:i?"base.50":"base.100",bg:i?"accent.600":"base.850",_hover:{color:i?"base.50":"base.100",bg:i?"accent.550":"base.700"}}},onClick:d,children:a.jsxs(N,{gap:4,alignItems:"center",children:[a.jsx(Ha,{minWidth:14,p:.5,fontSize:"sm",variant:"solid",children:sN[s.base_model]}),a.jsx(Fn,{label:s.description,hasArrow:!0,placement:"bottom",children:a.jsx(Se,{sx:{fontWeight:500},children:s.model_name})})]})}),a.jsx(p0,{title:t("modelManager.deleteModel"),acceptCallback:p,acceptButtonText:t("modelManager.delete"),triggerComponent:a.jsx(tt,{icon:a.jsx(_ne,{}),"aria-label":t("modelManager.deleteConfig"),colorScheme:"error"}),children:a.jsxs(N,{rowGap:4,flexDirection:"column",children:[a.jsx("p",{style:{fontWeight:"bold"},children:t("modelManager.deleteMsg1")}),a.jsx("p",{children:t("modelManager.deleteMsg2")})]})})]})}const nhe=e=>{const{selectedModelId:t,setSelectedModelId:n}=e,{t:r}=J(),[o,s]=l.useState(""),[i,c]=l.useState("all"),{filteredDiffusersModels:d,isLoadingDiffusersModels:p}=na(Ol,{selectFromResult:({data:_,isLoading:I})=>({filteredDiffusersModels:Sd(_,"main","diffusers",o),isLoadingDiffusersModels:I})}),{filteredCheckpointModels:h,isLoadingCheckpointModels:m}=na(Ol,{selectFromResult:({data:_,isLoading:I})=>({filteredCheckpointModels:Sd(_,"main","checkpoint",o),isLoadingCheckpointModels:I})}),{filteredLoraModels:g,isLoadingLoraModels:b}=vf(void 0,{selectFromResult:({data:_,isLoading:I})=>({filteredLoraModels:Sd(_,"lora",void 0,o),isLoadingLoraModels:I})}),{filteredOnnxModels:y,isLoadingOnnxModels:x}=Wd(Ol,{selectFromResult:({data:_,isLoading:I})=>({filteredOnnxModels:Sd(_,"onnx","onnx",o),isLoadingOnnxModels:I})}),{filteredOliveModels:C,isLoadingOliveModels:S}=Wd(Ol,{selectFromResult:({data:_,isLoading:I})=>({filteredOliveModels:Sd(_,"onnx","olive",o),isLoadingOliveModels:I})}),j=l.useCallback(_=>{s(_.target.value)},[]);return a.jsx(N,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:a.jsxs(N,{flexDirection:"column",gap:4,paddingInlineEnd:4,children:[a.jsxs(zn,{isAttached:!0,children:[a.jsx(Rt,{onClick:c.bind(null,"all"),isChecked:i==="all",size:"sm",children:r("modelManager.allModels")}),a.jsx(Rt,{size:"sm",onClick:c.bind(null,"diffusers"),isChecked:i==="diffusers",children:r("modelManager.diffusersModels")}),a.jsx(Rt,{size:"sm",onClick:c.bind(null,"checkpoint"),isChecked:i==="checkpoint",children:r("modelManager.checkpointModels")}),a.jsx(Rt,{size:"sm",onClick:c.bind(null,"onnx"),isChecked:i==="onnx",children:r("modelManager.onnxModels")}),a.jsx(Rt,{size:"sm",onClick:c.bind(null,"olive"),isChecked:i==="olive",children:r("modelManager.oliveModels")}),a.jsx(Rt,{size:"sm",onClick:c.bind(null,"lora"),isChecked:i==="lora",children:r("modelManager.loraModels")})]}),a.jsx(Cs,{onChange:j,label:r("modelManager.search"),labelPos:"side"}),a.jsxs(N,{flexDirection:"column",gap:4,maxHeight:window.innerHeight-280,overflow:"scroll",children:[p&&a.jsx(Hc,{loadingMessage:"Loading Diffusers..."}),["all","diffusers"].includes(i)&&!p&&d.length>0&&a.jsx(Bc,{title:"Diffusers",modelList:d,selected:{selectedModelId:t,setSelectedModelId:n}},"diffusers"),m&&a.jsx(Hc,{loadingMessage:"Loading Checkpoints..."}),["all","checkpoint"].includes(i)&&!m&&h.length>0&&a.jsx(Bc,{title:"Checkpoints",modelList:h,selected:{selectedModelId:t,setSelectedModelId:n}},"checkpoints"),b&&a.jsx(Hc,{loadingMessage:"Loading LoRAs..."}),["all","lora"].includes(i)&&!b&&g.length>0&&a.jsx(Bc,{title:"LoRAs",modelList:g,selected:{selectedModelId:t,setSelectedModelId:n}},"loras"),S&&a.jsx(Hc,{loadingMessage:"Loading Olives..."}),["all","olive"].includes(i)&&!S&&C.length>0&&a.jsx(Bc,{title:"Olives",modelList:C,selected:{selectedModelId:t,setSelectedModelId:n}},"olive"),x&&a.jsx(Hc,{loadingMessage:"Loading ONNX..."}),["all","onnx"].includes(i)&&!x&&y.length>0&&a.jsx(Bc,{title:"ONNX",modelList:y,selected:{selectedModelId:t,setSelectedModelId:n}},"onnx")]})]})})},rhe=l.memo(nhe),Sd=(e,t,n,r)=>{const o=[];return Kr(e==null?void 0:e.entities,s=>{if(!s)return;const i=s.model_name.toLowerCase().includes(r.toLowerCase()),c=n===void 0||s.model_format===n,d=s.model_type===t;i&&c&&d&&o.push(s)}),o},q2=l.memo(e=>a.jsx(N,{flexDirection:"column",gap:4,borderRadius:4,p:4,sx:{bg:"base.200",_dark:{bg:"base.800"}},children:e.children}));q2.displayName="StyledModelContainer";const Bc=l.memo(e=>{const{title:t,modelList:n,selected:r}=e;return a.jsx(q2,{children:a.jsxs(N,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Se,{variant:"subtext",fontSize:"sm",children:t}),n.map(o=>a.jsx(the,{model:o,isSelected:r.selectedModelId===o.id,setSelectedModelId:r.setSelectedModelId},o.id))]})})});Bc.displayName="ModelListWrapper";const Hc=l.memo(({loadingMessage:e})=>a.jsx(q2,{children:a.jsxs(N,{justifyContent:"center",alignItems:"center",flexDirection:"column",p:4,gap:8,children:[a.jsx(bi,{}),a.jsx(Se,{variant:"subtext",children:e||"Fetching..."})]})}));Hc.displayName="FetchingModelsLoader";function ohe(){const[e,t]=l.useState(),{mainModel:n}=na(Ol,{selectFromResult:({data:s})=>({mainModel:e?s==null?void 0:s.entities[e]:void 0})}),{loraModel:r}=vf(void 0,{selectFromResult:({data:s})=>({loraModel:e?s==null?void 0:s.entities[e]:void 0})}),o=n||r;return a.jsxs(N,{sx:{gap:8,w:"full",h:"full"},children:[a.jsx(rhe,{selectedModelId:e,setSelectedModelId:t}),a.jsx(she,{model:o})]})}const she=e=>{const{model:t}=e;return(t==null?void 0:t.model_format)==="checkpoint"?a.jsx(Jpe,{model:t},t.id):(t==null?void 0:t.model_format)==="diffusers"?a.jsx(Zpe,{model:t},t.id):(t==null?void 0:t.model_type)==="lora"?a.jsx(ehe,{model:t},t.id):a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",maxH:96,userSelect:"none"},children:a.jsx(Se,{variant:"subtext",children:"No Model Selected"})})};function ahe(){const{t:e}=J();return a.jsxs(N,{sx:{w:"full",p:4,borderRadius:4,gap:4,justifyContent:"space-between",alignItems:"center",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsx(Se,{sx:{fontWeight:600},children:e("modelManager.syncModels")}),a.jsx(Se,{fontSize:"sm",sx:{_dark:{color:"base.400"}},children:e("modelManager.syncModelsDesc")})]}),a.jsx(Gu,{})]})}function ihe(){return a.jsx(N,{children:a.jsx(ahe,{})})}const Z_=[{id:"modelManager",label:on.t("modelManager.modelManager"),content:a.jsx(ohe,{})},{id:"importModels",label:on.t("modelManager.importModels"),content:a.jsx(Kpe,{})},{id:"mergeModels",label:on.t("modelManager.mergeModels"),content:a.jsx(Xpe,{})},{id:"settings",label:on.t("modelManager.settings"),content:a.jsx(ihe,{})}],lhe=()=>a.jsxs(tc,{isLazy:!0,variant:"line",layerStyle:"first",sx:{w:"full",h:"full",p:4,gap:4,borderRadius:"base"},children:[a.jsx(nc,{children:Z_.map(e=>a.jsx(xo,{sx:{borderTopRadius:"base"},children:e.label},e.id))}),a.jsx(zu,{sx:{w:"full",h:"full"},children:Z_.map(e=>a.jsx(Ho,{sx:{w:"full",h:"full"},children:e.content},e.id))})]}),che=l.memo(lhe),uhe=de([e=>e.nodes],e=>e.nodeTemplates),dhe=()=>{const e=H(uhe),t=Bx();return l.useCallback(n=>{var d;let r=window.innerWidth/2,o=window.innerHeight/2;const s=(d=document.querySelector("#workflow-editor"))==null?void 0:d.getBoundingClientRect();s&&(r=s.width/2-K1/2,o=s.height/2-K1/2);const i=t.project({x:r,y:o}),c=e[n];return aN(n,i,c)},[e,t])},zR=l.forwardRef(({label:e,description:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs("div",{children:[a.jsx(Se,{fontWeight:600,children:e}),a.jsx(Se,{size:"xs",sx:{color:"base.600",_dark:{color:"base.500"}},children:t})]})}));zR.displayName="AddNodePopoverSelectItem";const fhe=(e,t)=>{const n=new RegExp(e.trim().replace(/[-[\]{}()*+!<=:?./\\^$|#,]/g,"").split(" ").join(".*"),"gi");return n.test(t.label)||n.test(t.description)||t.tags.some(r=>n.test(r))},phe=()=>{const e=oe(),t=dhe(),n=Zl(),{t:r}=J(),o=H(C=>C.nodes.currentConnectionFieldType),s=H(C=>{var S;return(S=C.nodes.connectionStartParams)==null?void 0:S.handleType}),i=de([Ce],({nodes:C})=>{const S=o?g$(C.nodeTemplates,_=>{const I=s=="source"?_.inputs:_.outputs;return Qs(I,P=>{const M=s=="source"?o:P.type,R=s=="target"?o:P.type;return Hx(M,R)})}):Ro(C.nodeTemplates),j=Ro(S,_=>({label:_.title,value:_.type,description:_.description,tags:_.tags}));return o===null&&(j.push({label:r("nodes.currentImage"),value:"current_image",description:r("nodes.currentImageDescription"),tags:["progress"]}),j.push({label:r("nodes.notes"),value:"notes",description:r("nodes.notesDescription"),tags:["notes"]})),j.sort((_,I)=>_.label.localeCompare(I.label)),{data:j,t:r}},_e),{data:c}=H(i),d=H(C=>C.nodes.isAddNodePopoverOpen),p=l.useRef(null),h=l.useCallback(C=>{const S=t(C);if(!S){const j=r("nodes.unknownNode",{nodeType:C});n({status:"error",title:j});return}e(iN(S))},[e,t,n,r]),m=l.useCallback(C=>{C&&h(C)},[h]),g=l.useCallback(()=>{e(lN())},[e]),b=l.useCallback(()=>{e(bP())},[e]),y=l.useCallback(C=>{C.preventDefault(),b(),setTimeout(()=>{var S;(S=p.current)==null||S.focus()},0)},[b]),x=l.useCallback(()=>{g()},[g]);return It(["shift+a","space"],y),It(["escape"],x),a.jsxs(Nf,{initialFocusRef:p,isOpen:d,onClose:g,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(b3,{children:a.jsx(N,{sx:{position:"absolute",top:"15%",insetInlineStart:"50%",pointerEvents:"none"}})}),a.jsx($f,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Ag,{sx:{p:0},children:a.jsx(tr,{inputRef:p,selectOnBlur:!1,placeholder:r("nodes.nodeSearch"),value:null,data:c,maxDropdownHeight:400,nothingFound:r("nodes.noMatchingNodes"),itemComponent:zR,filter:fhe,onChange:m,hoverOnSearchChange:!0,onDropdownClose:g,sx:{width:"32rem",input:{padding:"0.5rem"}}})})})]})},hhe=l.memo(phe),mhe=()=>{const e=Bx(),t=H(r=>r.nodes.shouldValidateGraph);return l.useCallback(({source:r,sourceHandle:o,target:s,targetHandle:i})=>{var b,y;const c=e.getEdges(),d=e.getNodes();if(!(r&&o&&s&&i))return!1;const p=e.getNode(r),h=e.getNode(s);if(!(p&&h&&p.data&&h.data))return!1;const m=(b=p.data.outputs[o])==null?void 0:b.type,g=(y=h.data.inputs[i])==null?void 0:y.type;return!m||!g||r===s?!1:t?c.find(x=>{x.target===s&&x.targetHandle===i&&x.source===r&&x.sourceHandle})||c.find(x=>x.target===s&&x.targetHandle===i)&&g!=="CollectionItem"||!Hx(m,g)?!1:xP(r,s,d,c):!0},[e,t])},df=e=>`var(--invokeai-colors-${e.split(".").join("-")})`,ghe=de(Ce,({nodes:e})=>{const{shouldAnimateEdges:t,currentConnectionFieldType:n,shouldColorEdges:r}=e,o=df(n&&r?bf[n].color:"base.500");let s="react-flow__custom_connection-path";return t&&(s=s.concat(" animated")),{stroke:o,className:s}}),vhe=({fromX:e,fromY:t,fromPosition:n,toX:r,toY:o,toPosition:s})=>{const{stroke:i,className:c}=H(ghe),d={sourceX:e,sourceY:t,sourcePosition:n,targetX:r,targetY:o,targetPosition:s},[p]=Wx(d);return a.jsx("g",{children:a.jsx("path",{fill:"none",stroke:i,strokeWidth:2,className:c,d:p,style:{opacity:.8}})})},bhe=l.memo(vhe),FR=(e,t,n,r,o)=>de(Ce,({nodes:s})=>{var g,b;const i=s.nodes.find(y=>y.id===e),c=s.nodes.find(y=>y.id===n),d=Rr(i)&&Rr(c),p=(i==null?void 0:i.selected)||(c==null?void 0:c.selected)||o,h=d?(b=(g=i==null?void 0:i.data)==null?void 0:g.outputs[t||""])==null?void 0:b.type:void 0,m=h&&s.shouldColorEdges?df(bf[h].color):df("base.500");return{isSelected:p,shouldAnimate:s.shouldAnimateEdges&&p,stroke:m}},_e),xhe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,data:c,selected:d,source:p,target:h,sourceHandleId:m,targetHandleId:g})=>{const b=l.useMemo(()=>FR(p,m,h,g,d),[d,p,m,h,g]),{isSelected:y,shouldAnimate:x}=H(b),[C,S,j]=Wx({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s}),{base500:_}=Hf();return a.jsxs(a.Fragment,{children:[a.jsx(yP,{path:C,markerEnd:i,style:{strokeWidth:y?3:2,stroke:_,opacity:y?.8:.5,animation:x?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:x?5:"none"}}),(c==null?void 0:c.count)&&c.count>1&&a.jsx(cN,{children:a.jsx(N,{sx:{position:"absolute",transform:`translate(-50%, -50%) translate(${S}px,${j}px)`},className:"nodrag nopan",children:a.jsx(Ha,{variant:"solid",sx:{bg:"base.500",opacity:y?.8:.5,boxShadow:"base"},children:c.count})})})]})},yhe=l.memo(xhe),Che=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,selected:c,source:d,target:p,sourceHandleId:h,targetHandleId:m})=>{const g=l.useMemo(()=>FR(d,h,p,m,c),[d,h,p,m,c]),{isSelected:b,shouldAnimate:y,stroke:x}=H(g),[C]=Wx({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s});return a.jsx(yP,{path:C,markerEnd:i,style:{strokeWidth:b?3:2,stroke:x,opacity:b?.8:.5,animation:y?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:y?5:"none"}})},whe=l.memo(Che),She=e=>{const{nodeId:t,width:n,children:r,selected:o}=e,{isMouseOverNode:s,handleMouseOut:i,handleMouseOver:c}=Q8(t),d=l.useMemo(()=>de(Ce,({nodes:j})=>{var _;return((_=j.nodeExecutionStates[t])==null?void 0:_.status)===ri.IN_PROGRESS}),[t]),p=H(d),[h,m,g,b]=Ks("shadows",["nodeInProgress.light","nodeInProgress.dark","shadows.xl","shadows.base"]),y=oe(),x=di(h,m),C=H(j=>j.nodes.nodeOpacity),S=l.useCallback(j=>{!j.ctrlKey&&!j.altKey&&!j.metaKey&&!j.shiftKey&&y(uN(t)),y(CP())},[y,t]);return a.jsxs(Te,{onClick:S,onMouseEnter:c,onMouseLeave:i,className:Du,sx:{h:"full",position:"relative",borderRadius:"base",w:n??K1,transitionProperty:"common",transitionDuration:"0.1s",cursor:"grab",opacity:C},children:[a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",pointerEvents:"none",shadow:`${g}, ${b}, ${b}`,zIndex:-1}}),a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"md",pointerEvents:"none",transitionProperty:"common",transitionDuration:"0.1s",opacity:.7,shadow:p?x:void 0,zIndex:-1}}),r,a.jsx(K8,{isSelected:o,isHovered:s})]})},j0=l.memo(She),khe=de(Ce,({system:e,gallery:t})=>{var r;return{imageDTO:t.selection[t.selection.length-1],progressImage:(r=e.denoiseProgress)==null?void 0:r.progress_image}}),jhe=e=>{const{progressImage:t,imageDTO:n}=dN(khe);return t?a.jsx(R1,{nodeProps:e,children:a.jsx(Si,{src:t.dataURL,sx:{w:"full",h:"full",objectFit:"contain",borderRadius:"base"}})}):n?a.jsx(R1,{nodeProps:e,children:a.jsx(il,{imageDTO:n,isDragDisabled:!0,useThumbailFallback:!0})}):a.jsx(R1,{nodeProps:e,children:a.jsx(qr,{})})},_he=l.memo(jhe),R1=e=>{const[t,n]=l.useState(!1),r=l.useCallback(()=>{n(!0)},[]),o=l.useCallback(()=>{n(!1)},[]);return a.jsx(j0,{nodeId:e.nodeProps.id,selected:e.nodeProps.selected,width:384,children:a.jsxs(N,{onMouseEnter:r,onMouseLeave:o,className:Du,sx:{position:"relative",flexDirection:"column"},children:[a.jsx(N,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",alignItems:"center",justifyContent:"center",h:8},children:a.jsx(Se,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",_dark:{color:"base.200"}},children:"Current Image"})}),a.jsxs(N,{layerStyle:"nodeBody",sx:{w:"full",h:"full",borderBottomRadius:"base",p:2},children:[e.children,t&&a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:40,left:-2,right:-2,bottom:0,pointerEvents:"none"},children:a.jsx(OR,{})},"nextPrevButtons")]})]})})},K2=e=>{const t=e.filter(o=>!o.ui_hidden),n=t.filter(o=>!oi(o.ui_order)).sort((o,s)=>(o.ui_order??0)-(s.ui_order??0)),r=t.filter(o=>oi(o.ui_order));return n.concat(r).map(o=>o.name).filter(o=>o!=="is_intermediate")},Ihe=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(c=>c.id===e);if(!Rr(o))return[];const s=r.nodeTemplates[o.data.type];if(!s)return[];const i=Ro(s.inputs).filter(c=>(["any","direct"].includes(c.input)||Vx.includes(c.type))&&wP.includes(c.type));return K2(i)},_e),[e]);return H(t)},Phe=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(c=>c.id===e);if(!Rr(o))return[];const s=r.nodeTemplates[o.data.type];if(!s)return[];const i=Ro(s.inputs).filter(c=>c.input==="connection"&&!Vx.includes(c.type)||!wP.includes(c.type));return K2(i)},_e),[e]);return H(t)},Ehe=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Rr(o))return[];const s=r.nodeTemplates[o.data.type];return s?K2(Ro(s.outputs)):[]},_e),[e]);return H(t)},Q2=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?Qs(o.data.outputs,s=>fN.includes(s.type)&&o.data.type!=="image"):!1},_e),[e]);return H(t)},Mhe=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.embedWorkflow:!1},_e),[e]);return H(t)},Ohe=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Rr(o))return!1;const s=r.nodeTemplates[(o==null?void 0:o.data.type)??""];return s?s.withWorkflow:!1},_e),[e]);return H(t)},Rhe=({nodeId:e})=>{const t=oe(),n=Ohe(e),r=Mhe(e),o=l.useCallback(s=>{t(pN({nodeId:e,embedWorkflow:s.target.checked}))},[t,e]);return n?a.jsxs(Bn,{as:N,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(vr,{sx:{fontSize:"xs",mb:"1px"},children:"Workflow"}),a.jsx(_f,{className:"nopan",size:"sm",onChange:o,isChecked:r})]}):null},Ahe=l.memo(Rhe),Dhe=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.isIntermediate:!1},_e),[e]);return H(t)},The=({nodeId:e})=>{const t=oe(),n=Q2(e),r=Dhe(e),o=l.useCallback(s=>{t(hN({nodeId:e,isIntermediate:!s.target.checked}))},[t,e]);return n?a.jsxs(Bn,{as:N,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(vr,{sx:{fontSize:"xs",mb:"1px"},children:"Save to Gallery"}),a.jsx(_f,{className:"nopan",size:"sm",onChange:o,isChecked:!r})]}):null},Nhe=l.memo(The),$he=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.useCache:!1},_e),[e]);return H(t)},Lhe=({nodeId:e})=>{const t=oe(),n=$he(e),r=l.useCallback(o=>{t(mN({nodeId:e,useCache:o.target.checked}))},[t,e]);return a.jsxs(Bn,{as:N,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(vr,{sx:{fontSize:"xs",mb:"1px"},children:"Use Cache"}),a.jsx(_f,{className:"nopan",size:"sm",onChange:r,isChecked:n})]})},zhe=l.memo(Lhe),Fhe=({nodeId:e})=>{const t=Q2(e),n=jn("invocationCache").isFeatureEnabled;return a.jsxs(N,{className:Du,layerStyle:"nodeFooter",sx:{w:"full",borderBottomRadius:"base",px:2,py:0,h:6,justifyContent:"space-between"},children:[n&&a.jsx(zhe,{nodeId:e}),t&&a.jsx(Ahe,{nodeId:e}),t&&a.jsx(Nhe,{nodeId:e})]})},Bhe=l.memo(Fhe),Hhe=({nodeId:e,isOpen:t})=>{const n=oe(),r=gN(),o=l.useCallback(()=>{n(vN({nodeId:e,isOpen:!t})),r(e)},[n,t,e,r]);return a.jsx(tt,{className:"nodrag",onClick:o,"aria-label":"Minimize",sx:{minW:8,w:8,h:8,color:"base.500",_dark:{color:"base.500"},_hover:{color:"base.700",_dark:{color:"base.300"}}},variant:"link",icon:a.jsx(s0,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})})},X2=l.memo(Hhe),Whe=({nodeId:e,title:t})=>{const n=oe(),r=U8(e),o=G8(e),{t:s}=J(),[i,c]=l.useState(""),d=l.useCallback(async h=>{n(nP({nodeId:e,label:h})),c(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),p=l.useCallback(h=>{c(h)},[]);return l.useEffect(()=>{c(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx(N,{sx:{overflow:"hidden",w:"full",h:"full",alignItems:"center",justifyContent:"center",cursor:"text"},children:a.jsxs(Ef,{as:N,value:i,onChange:p,onSubmit:d,sx:{alignItems:"center",position:"relative",w:"full",h:"full"},children:[a.jsx(Pf,{fontSize:"sm",sx:{p:0,w:"full"},noOfLines:1}),a.jsx(If,{className:"nodrag",fontSize:"sm",sx:{p:0,fontWeight:700,_focusVisible:{p:0,boxShadow:"none"}}}),a.jsx(Vhe,{})]})})},BR=l.memo(Whe);function Vhe(){const{isEditing:e,getEditButtonProps:t}=JP(),n=l.useCallback(r=>{const{onClick:o}=t();o&&o(r)},[t]);return e?null:a.jsx(Te,{className:Du,onDoubleClick:n,sx:{position:"absolute",w:"full",h:"full",top:0,cursor:"grab"}})}const Uhe=({nodeId:e})=>{const t=L2(e),{base400:n,base600:r}=Hf(),o=di(n,r),s=l.useMemo(()=>({borderWidth:0,borderRadius:"3px",width:"1rem",height:"1rem",backgroundColor:o,zIndex:-1}),[o]);return Vh(t)?a.jsxs(a.Fragment,{children:[a.jsx(Id,{type:"target",id:`${t.id}-collapsed-target`,isConnectable:!1,position:Vc.Left,style:{...s,left:"-0.5rem"}}),Ro(t.inputs,i=>a.jsx(Id,{type:"target",id:i.name,isConnectable:!1,position:Vc.Left,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-input-handle`)),a.jsx(Id,{type:"source",id:`${t.id}-collapsed-source`,isConnectable:!1,position:Vc.Right,style:{...s,right:"-0.5rem"}}),Ro(t.outputs,i=>a.jsx(Id,{type:"source",id:i.name,isConnectable:!1,position:Vc.Right,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-output-handle`))]}):null},Ghe=l.memo(Uhe),qhe=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);return r.nodeTemplates[(o==null?void 0:o.data.type)??""]},_e),[e]);return H(t)},Khe=({nodeId:e})=>{const{needsUpdate:t}=rP(e);return a.jsx(Fn,{label:a.jsx(HR,{nodeId:e}),placement:"top",shouldWrapChildren:!0,children:a.jsx(zr,{as:GM,sx:{boxSize:4,w:8,color:t?"error.400":"base.400"}})})},Qhe=l.memo(Khe),HR=l.memo(({nodeId:e})=>{const t=L2(e),n=qhe(e),{t:r}=J(),o=l.useMemo(()=>t!=null&&t.label&&(n!=null&&n.title)?`${t.label} (${n.title})`:t!=null&&t.label&&!n?t.label:!(t!=null&&t.label)&&n?n.title:r("nodes.unknownNode"),[t,n,r]),s=l.useMemo(()=>!Vh(t)||!n?null:t.version?n.version?cS(t.version,n.version,"<")?a.jsxs(Se,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateNode"),")"]}):cS(t.version,n.version,">")?a.jsxs(Se,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateApp"),")"]}):a.jsxs(Se,{as:"span",children:[r("nodes.version")," ",t.version]}):a.jsxs(Se,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.unknownTemplate"),")"]}):a.jsx(Se,{as:"span",sx:{color:"error.500"},children:r("nodes.versionUnknown")}),[t,n,r]);return Vh(t)?a.jsxs(N,{sx:{flexDir:"column"},children:[a.jsx(Se,{as:"span",sx:{fontWeight:600},children:o}),a.jsx(Se,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:n==null?void 0:n.description}),s,(t==null?void 0:t.notes)&&a.jsx(Se,{children:t.notes})]}):a.jsx(Se,{sx:{fontWeight:600},children:r("nodes.unknownNode")})});HR.displayName="TooltipContent";const A1=3,eI={circle:{transitionProperty:"none",transitionDuration:"0s"},".chakra-progress__track":{stroke:"transparent"}},Xhe=({nodeId:e})=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>r.nodeExecutionStates[e]),[e]),n=H(t);return n?a.jsx(Fn,{label:a.jsx(WR,{nodeExecutionState:n}),placement:"top",children:a.jsx(N,{className:Du,sx:{w:5,h:"full",alignItems:"center",justifyContent:"flex-end"},children:a.jsx(VR,{nodeExecutionState:n})})}):null},Yhe=l.memo(Xhe),WR=l.memo(({nodeExecutionState:e})=>{const{status:t,progress:n,progressImage:r}=e,{t:o}=J();return t===ri.PENDING?a.jsx(Se,{children:"Pending"}):t===ri.IN_PROGRESS?r?a.jsxs(N,{sx:{pos:"relative",pt:1.5,pb:.5},children:[a.jsx(Si,{src:r.dataURL,sx:{w:32,h:32,borderRadius:"base",objectFit:"contain"}}),n!==null&&a.jsxs(Ha,{variant:"solid",sx:{pos:"absolute",top:2.5,insetInlineEnd:1},children:[Math.round(n*100),"%"]})]}):n!==null?a.jsxs(Se,{children:[o("nodes.executionStateInProgress")," (",Math.round(n*100),"%)"]}):a.jsx(Se,{children:o("nodes.executionStateInProgress")}):t===ri.COMPLETED?a.jsx(Se,{children:o("nodes.executionStateCompleted")}):t===ri.FAILED?a.jsx(Se,{children:o("nodes.executionStateError")}):null});WR.displayName="TooltipLabel";const VR=l.memo(e=>{const{progress:t,status:n}=e.nodeExecutionState;return n===ri.PENDING?a.jsx(zr,{as:nee,sx:{boxSize:A1,color:"base.600",_dark:{color:"base.300"}}}):n===ri.IN_PROGRESS?t===null?a.jsx(xb,{isIndeterminate:!0,size:"14px",color:"base.500",thickness:14,sx:eI}):a.jsx(xb,{value:Math.round(t*100),size:"14px",color:"base.500",thickness:14,sx:eI}):n===ri.COMPLETED?a.jsx(zr,{as:BM,sx:{boxSize:A1,color:"ok.600",_dark:{color:"ok.300"}}}):n===ri.FAILED?a.jsx(zr,{as:see,sx:{boxSize:A1,color:"error.600",_dark:{color:"error.300"}}}):null});VR.displayName="StatusIcon";const Jhe=({nodeId:e,isOpen:t})=>a.jsxs(N,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",justifyContent:"space-between",h:8,textAlign:"center",fontWeight:500,color:"base.700",_dark:{color:"base.200"}},children:[a.jsx(X2,{nodeId:e,isOpen:t}),a.jsx(BR,{nodeId:e}),a.jsxs(N,{alignItems:"center",children:[a.jsx(Yhe,{nodeId:e}),a.jsx(Qhe,{nodeId:e})]}),!t&&a.jsx(Ghe,{nodeId:e})]}),Zhe=l.memo(Jhe),eme=(e,t,n,r)=>de(Ce,o=>{if(!r)return on.t("nodes.noFieldType");const{currentConnectionFieldType:s,connectionStartParams:i,nodes:c,edges:d}=o.nodes;if(!i||!s)return on.t("nodes.noConnectionInProgress");const{handleType:p,nodeId:h,handleId:m}=i;if(!p||!h||!m)return on.t("nodes.noConnectionData");const g=n==="target"?r:s,b=n==="source"?r:s;if(e===h)return on.t("nodes.cannotConnectToSelf");if(n===p)return n==="source"?on.t("nodes.cannotConnectOutputToOutput"):on.t("nodes.cannotConnectInputToInput");const y=n==="target"?e:h,x=n==="target"?t:m,C=n==="source"?e:h,S=n==="source"?t:m;return d.find(_=>{_.target===y&&_.targetHandle===x&&_.source===C&&_.sourceHandle})?on.t("nodes.cannotDuplicateConnection"):d.find(_=>_.target===y&&_.targetHandle===x)&&g!=="CollectionItem"?on.t("nodes.inputMayOnlyHaveOneConnection"):Hx(b,g)?xP(p==="source"?h:e,p==="source"?e:h,c,d)?null:on.t("nodes.connectionWouldCreateCycle"):on.t("nodes.fieldTypesMustMatch")}),tme=(e,t,n)=>{const r=l.useMemo(()=>de(Ce,({nodes:s})=>{var c;const i=s.nodes.find(d=>d.id===e);if(Rr(i))return(c=i==null?void 0:i.data[zx[n]][t])==null?void 0:c.type},_e),[t,n,e]);return H(r)},nme=de(Ce,({nodes:e})=>e.currentConnectionFieldType!==null&&e.connectionStartParams!==null),UR=({nodeId:e,fieldName:t,kind:n})=>{const r=tme(e,t,n),o=l.useMemo(()=>de(Ce,({nodes:g})=>!!g.edges.filter(b=>(n==="input"?b.target:b.source)===e&&(n==="input"?b.targetHandle:b.sourceHandle)===t).length),[t,n,e]),s=l.useMemo(()=>eme(e,t,n==="input"?"target":"source",r),[e,t,n,r]),i=l.useMemo(()=>de(Ce,({nodes:g})=>{var b,y,x;return((b=g.connectionStartParams)==null?void 0:b.nodeId)===e&&((y=g.connectionStartParams)==null?void 0:y.handleId)===t&&((x=g.connectionStartParams)==null?void 0:x.handleType)==={input:"target",output:"source"}[n]}),[t,n,e]),c=H(o),d=H(nme),p=H(i),h=H(s),m=l.useMemo(()=>!!(d&&h&&!p),[h,d,p]);return{isConnected:c,isConnectionInProgress:d,isConnectionStartField:p,connectionError:h,shouldDim:m}},rme=(e,t)=>{const n=l.useMemo(()=>de(Ce,({nodes:o})=>{var i;const s=o.nodes.find(c=>c.id===e);if(Rr(s))return((i=s==null?void 0:s.data.inputs[t])==null?void 0:i.value)!==void 0},_e),[t,e]);return H(n)},ome=(e,t)=>{const n=l.useMemo(()=>de(Ce,({nodes:o})=>{const s=o.nodes.find(d=>d.id===e);if(!Rr(s))return;const i=o.nodeTemplates[(s==null?void 0:s.data.type)??""],c=i==null?void 0:i.inputs[t];return c==null?void 0:c.input},_e),[t,e]);return H(n)},sme=({nodeId:e,fieldName:t,kind:n,children:r})=>{const o=oe(),s=X8(e,t),i=Y8(e,t,n),c=ome(e,t),{t:d}=J(),p=l.useCallback(S=>{S.preventDefault()},[]),h=l.useMemo(()=>de(Ce,({nodes:S})=>({isExposed:!!S.workflow.exposedFields.find(_=>_.nodeId===e&&_.fieldName===t)}),_e),[t,e]),m=l.useMemo(()=>["any","direct"].includes(c??"__UNKNOWN_INPUT__"),[c]),{isExposed:g}=H(h),b=l.useCallback(()=>{o(bN({nodeId:e,fieldName:t}))},[o,t,e]),y=l.useCallback(()=>{o(aP({nodeId:e,fieldName:t}))},[o,t,e]),x=l.useMemo(()=>{const S=[];return m&&!g&&S.push(a.jsx(Vn,{icon:a.jsx(Yi,{}),onClick:b,children:"Add to Linear View"},`${e}.${t}.expose-field`)),m&&g&&S.push(a.jsx(Vn,{icon:a.jsx(gee,{}),onClick:y,children:"Remove from Linear View"},`${e}.${t}.unexpose-field`)),S},[t,b,y,g,m,e]),C=l.useCallback(()=>x.length?a.jsx(Gl,{sx:{visibility:"visible !important"},motionProps:pu,onContextMenu:p,children:a.jsx(Yd,{title:s||i||d("nodes.unknownField"),children:x})}):null,[i,s,x,p,d]);return a.jsx(p2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:C,children:r})},ame=l.memo(sme),ime=e=>{const{fieldTemplate:t,handleType:n,isConnectionInProgress:r,isConnectionStartField:o,connectionError:s}=e,{name:i,type:c}=t,{color:d,title:p}=bf[c],h=l.useMemo(()=>{const g=xN.includes(c),b=Vx.includes(c),y=yN.includes(c),x=df(d),C={backgroundColor:g||b?"var(--invokeai-colors-base-900)":x,position:"absolute",width:"1rem",height:"1rem",borderWidth:g||b?4:0,borderStyle:"solid",borderColor:x,borderRadius:y?4:"100%",zIndex:1};return n==="target"?C.insetInlineStart="-1rem":C.insetInlineEnd="-1rem",r&&!o&&s&&(C.filter="opacity(0.4) grayscale(0.7)"),r&&s?o?C.cursor="grab":C.cursor="not-allowed":C.cursor="crosshair",C},[s,n,r,o,c,d]),m=l.useMemo(()=>r&&o?p:r&&s?s??p:p,[s,r,o,p]);return a.jsx(Fn,{label:m,placement:n==="target"?"start":"end",hasArrow:!0,openDelay:ug,children:a.jsx(Id,{type:n,id:i,position:n==="target"?Vc.Left:Vc.Right,style:h})})},GR=l.memo(ime),lme=({nodeId:e,fieldName:t})=>{const n=v0(e,t,"input"),r=rme(e,t),{isConnected:o,isConnectionInProgress:s,isConnectionStartField:i,connectionError:c,shouldDim:d}=UR({nodeId:e,fieldName:t,kind:"input"}),p=l.useMemo(()=>{if((n==null?void 0:n.fieldKind)!=="input"||!n.required)return!1;if(!o&&n.input==="connection"||!r&&!o&&n.input==="any")return!0},[n,o,r]);return(n==null?void 0:n.fieldKind)!=="input"?a.jsx(dx,{shouldDim:d,children:a.jsxs(Bn,{sx:{color:"error.400",textAlign:"left",fontSize:"sm"},children:["Unknown input: ",t]})}):a.jsxs(dx,{shouldDim:d,children:[a.jsxs(Bn,{isInvalid:p,isDisabled:o,sx:{alignItems:"stretch",justifyContent:"space-between",ps:n.input==="direct"?0:2,gap:2,h:"full",w:"full"},children:[a.jsx(ame,{nodeId:e,fieldName:t,kind:"input",children:h=>a.jsx(vr,{sx:{display:"flex",alignItems:"center",h:"full",mb:0,px:1,gap:2},children:a.jsx(Z8,{ref:h,nodeId:e,fieldName:t,kind:"input",isMissingInput:p,withTooltip:!0})})}),a.jsx(Te,{children:a.jsx(uR,{nodeId:e,fieldName:t})})]}),n.input!=="direct"&&a.jsx(GR,{fieldTemplate:n,handleType:"target",isConnectionInProgress:s,isConnectionStartField:i,connectionError:c})]})},tI=l.memo(lme),dx=l.memo(({shouldDim:e,children:t})=>a.jsx(N,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",w:"full",h:"full"},children:t}));dx.displayName="InputFieldWrapper";const cme=({nodeId:e,fieldName:t})=>{const n=v0(e,t,"output"),{isConnected:r,isConnectionInProgress:o,isConnectionStartField:s,connectionError:i,shouldDim:c}=UR({nodeId:e,fieldName:t,kind:"output"});return(n==null?void 0:n.fieldKind)!=="output"?a.jsx(fx,{shouldDim:c,children:a.jsxs(Bn,{sx:{color:"error.400",textAlign:"right",fontSize:"sm"},children:["Unknown output: ",t]})}):a.jsxs(fx,{shouldDim:c,children:[a.jsx(Fn,{label:a.jsx(z2,{nodeId:e,fieldName:t,kind:"output"}),openDelay:ug,placement:"top",shouldWrapChildren:!0,hasArrow:!0,children:a.jsx(Bn,{isDisabled:r,pe:2,children:a.jsx(vr,{sx:{mb:0,fontWeight:500},children:n==null?void 0:n.title})})}),a.jsx(GR,{fieldTemplate:n,handleType:"source",isConnectionInProgress:o,isConnectionStartField:s,connectionError:i})]})},ume=l.memo(cme),fx=l.memo(({shouldDim:e,children:t})=>a.jsx(N,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",justifyContent:"flex-end"},children:t}));fx.displayName="OutputFieldWrapper";const dme=e=>{const t=Q2(e),n=jn("invocationCache").isFeatureEnabled;return l.useMemo(()=>t||n,[t,n])},fme=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>{const s=Phe(e),i=Ihe(e),c=dme(e),d=Ehe(e);return a.jsxs(j0,{nodeId:e,selected:o,children:[a.jsx(Zhe,{nodeId:e,isOpen:t,label:n,selected:o,type:r}),t&&a.jsxs(a.Fragment,{children:[a.jsx(N,{layerStyle:"nodeBody",sx:{flexDirection:"column",w:"full",h:"full",py:2,gap:1,borderBottomRadius:c?0:"base"},children:a.jsxs(N,{sx:{flexDir:"column",px:2,w:"full",h:"full"},children:[a.jsxs(nl,{gridTemplateColumns:"1fr auto",gridAutoRows:"1fr",children:[s.map((p,h)=>a.jsx(Kd,{gridColumnStart:1,gridRowStart:h+1,children:a.jsx(tI,{nodeId:e,fieldName:p})},`${e}.${p}.input-field`)),d.map((p,h)=>a.jsx(Kd,{gridColumnStart:2,gridRowStart:h+1,children:a.jsx(ume,{nodeId:e,fieldName:p})},`${e}.${p}.output-field`))]}),i.map(p=>a.jsx(tI,{nodeId:e,fieldName:p},`${e}.${p}.input-field`))]})}),c&&a.jsx(Bhe,{nodeId:e})]})]})},pme=l.memo(fme),hme=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>a.jsxs(j0,{nodeId:e,selected:o,children:[a.jsxs(N,{className:Du,layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",h:8,fontWeight:600,fontSize:"sm"},children:[a.jsx(X2,{nodeId:e,isOpen:t}),a.jsx(Se,{sx:{w:"full",textAlign:"center",pe:8,color:"error.500",_dark:{color:"error.300"}},children:n?`${n} (${r})`:r})]}),t&&a.jsx(N,{layerStyle:"nodeBody",sx:{userSelect:"auto",flexDirection:"column",w:"full",h:"full",p:4,gap:1,borderBottomRadius:"base",fontSize:"sm"},children:a.jsxs(Te,{children:[a.jsx(Se,{as:"span",children:"Unknown node type: "}),a.jsx(Se,{as:"span",fontWeight:600,children:r})]})})]}),mme=l.memo(hme),gme=e=>{const{data:t,selected:n}=e,{id:r,type:o,isOpen:s,label:i}=t,c=l.useMemo(()=>de(Ce,({nodes:p})=>!!p.nodeTemplates[o]),[o]);return H(c)?a.jsx(pme,{nodeId:r,isOpen:s,label:i,type:o,selected:n}):a.jsx(mme,{nodeId:r,isOpen:s,label:i,type:o,selected:n})},vme=l.memo(gme),bme=e=>{const{id:t,data:n,selected:r}=e,{notes:o,isOpen:s}=n,i=oe(),c=l.useCallback(d=>{i(CN({nodeId:t,value:d.target.value}))},[i,t]);return a.jsxs(j0,{nodeId:t,selected:r,children:[a.jsxs(N,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:s?0:"base",alignItems:"center",justifyContent:"space-between",h:8},children:[a.jsx(X2,{nodeId:t,isOpen:s}),a.jsx(BR,{nodeId:t,title:"Notes"}),a.jsx(Te,{minW:8})]}),s&&a.jsx(a.Fragment,{children:a.jsx(N,{layerStyle:"nodeBody",className:"nopan",sx:{cursor:"auto",flexDirection:"column",borderBottomRadius:"base",w:"full",h:"full",p:2,gap:1},children:a.jsx(N,{className:"nopan",sx:{flexDir:"column",w:"full",h:"full"},children:a.jsx(vi,{value:o,onChange:c,rows:8,resize:"none",sx:{fontSize:"xs"}})})})})]})},xme=l.memo(bme),yme=["Delete","Backspace"],Cme={collapsed:yhe,default:whe},wme={invocation:vme,current_image:_he,notes:xme},Sme={hideAttribution:!0},kme=de(Ce,({nodes:e})=>{const{shouldSnapToGrid:t,selectionMode:n}=e;return{shouldSnapToGrid:t,selectionMode:n}},_e),jme=()=>{const e=oe(),t=H(O=>O.nodes.nodes),n=H(O=>O.nodes.edges),r=H(O=>O.nodes.viewport),{shouldSnapToGrid:o,selectionMode:s}=H(kme),i=l.useRef(null),c=l.useRef(),d=mhe(),[p]=Ks("radii",["base"]),h=l.useCallback(O=>{e(wN(O))},[e]),m=l.useCallback(O=>{e(SN(O))},[e]),g=l.useCallback((O,T)=>{e(kN(T))},[e]),b=l.useCallback(O=>{e(uS(O))},[e]),y=l.useCallback(()=>{e(jN({cursorPosition:c.current}))},[e]),x=l.useCallback(O=>{e(_N(O))},[e]),C=l.useCallback(O=>{e(IN(O))},[e]),S=l.useCallback(({nodes:O,edges:T})=>{e(PN(O?O.map(Y=>Y.id):[])),e(EN(T?T.map(Y=>Y.id):[]))},[e]),j=l.useCallback((O,T)=>{e(MN(T))},[e]),_=l.useCallback(()=>{e(CP())},[e]),I=l.useCallback(O=>{dS.set(O),O.fitView()},[]),P=l.useCallback(O=>{var Y,z;const T=(Y=i.current)==null?void 0:Y.getBoundingClientRect();if(T){const W=(z=dS.get())==null?void 0:z.project({x:O.clientX-T.left,y:O.clientY-T.top});c.current=W}},[]),M=l.useRef(),R=l.useCallback((O,T,Y)=>{M.current=O,e(ON(T.id)),e(RN())},[e]),A=l.useCallback((O,T)=>{e(uS(T))},[e]),D=l.useCallback((O,T,Y)=>{var z,W;!("touches"in O)&&((z=M.current)==null?void 0:z.clientX)===O.clientX&&((W=M.current)==null?void 0:W.clientY)===O.clientY&&e(AN(T)),M.current=void 0},[e]);return It(["Ctrl+c","Meta+c"],O=>{O.preventDefault(),e(DN())}),It(["Ctrl+a","Meta+a"],O=>{O.preventDefault(),e(TN())}),It(["Ctrl+v","Meta+v"],O=>{O.preventDefault(),e(NN({cursorPosition:c.current}))}),a.jsx($N,{id:"workflow-editor",ref:i,defaultViewport:r,nodeTypes:wme,edgeTypes:Cme,nodes:t,edges:n,onInit:I,onMouseMove:P,onNodesChange:h,onEdgesChange:m,onEdgesDelete:x,onEdgeUpdate:A,onEdgeUpdateStart:R,onEdgeUpdateEnd:D,onNodesDelete:C,onConnectStart:g,onConnect:b,onConnectEnd:y,onMoveEnd:j,connectionLineComponent:bhe,onSelectionChange:S,isValidConnection:d,minZoom:.1,snapToGrid:o,snapGrid:[25,25],connectionRadius:30,proOptions:Sme,style:{borderRadius:p},onPaneClick:_,deleteKeyCode:yme,selectionMode:s,children:a.jsx(V$,{})})},_me=de(Ce,e=>{const t=e.nodes.nodes,n=e.nodes.nodeTemplates;return t.some(o=>{const s=n[o.data.type];return LN(o,s)})},_e),Ime=()=>H(_me),Pme=()=>{const e=oe(),{t}=J(),n=Ime(),r=l.useCallback(()=>{e(bP())},[e]),o=l.useCallback(()=>{e(zN())},[e]);return a.jsxs(N,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:2},children:[a.jsx(tt,{tooltip:t("nodes.addNodeToolTip"),"aria-label":t("nodes.addNode"),icon:a.jsx(Yi,{}),onClick:r}),n&&a.jsx(Rt,{leftIcon:a.jsx(Xg,{}),onClick:o,children:t("nodes.updateAllNodes")})]})},Eme=l.memo(Pme),Mme=()=>{const e=oe(),t=q3("nodes"),{t:n}=J();return l.useCallback(o=>{if(!o)return;const s=new FileReader;s.onload=async()=>{const i=s.result;try{const c=JSON.parse(String(i)),d=GI.safeParse(c);if(!d.success){const{message:p}=FN(d.error,{prefix:n("nodes.workflowValidation")});t.error({error:BN(d.error)},p),e(Bt(Zn({title:n("nodes.unableToValidateWorkflow"),status:"error",duration:5e3}))),s.abort();return}e(Ax(d.data)),s.abort()}catch{e(Bt(Zn({title:n("nodes.unableToLoadWorkflow"),status:"error"})))}},s.readAsText(o)},[e,t,n])},Ome=l.memo(e=>e.error.issues[0]?a.jsx(Se,{children:fS(e.error.issues[0],{prefix:null}).toString()}):a.jsx(Mf,{children:e.error.issues.map((t,n)=>a.jsx(ws,{children:a.jsx(Se,{children:fS(t,{prefix:null}).toString()})},n))}));Ome.displayName="WorkflowValidationErrorContent";const Rme=()=>{const{t:e}=J(),t=l.useRef(null),n=Mme();return a.jsx(hM,{resetRef:t,accept:"application/json",onChange:n,children:r=>a.jsx(tt,{icon:a.jsx(Jg,{}),tooltip:e("nodes.loadWorkflow"),"aria-label":e("nodes.loadWorkflow"),...r})})},Ame=l.memo(Rme),Dme=()=>{const{t:e}=J(),t=oe(),{isOpen:n,onOpen:r,onClose:o}=ls(),s=l.useRef(null),i=H(d=>d.nodes.nodes.length),c=l.useCallback(()=>{t(HN()),t(Bt(Zn({title:e("toast.nodesCleared"),status:"success"}))),o()},[t,e,o]);return a.jsxs(a.Fragment,{children:[a.jsx(tt,{icon:a.jsx(qo,{}),tooltip:e("nodes.resetWorkflow"),"aria-label":e("nodes.resetWorkflow"),onClick:r,isDisabled:!i,colorScheme:"error"}),a.jsxs(Df,{isOpen:n,onClose:o,leastDestructiveRef:s,isCentered:!0,children:[a.jsx(Ma,{}),a.jsxs(Tf,{children:[a.jsx(Ea,{fontSize:"lg",fontWeight:"bold",children:e("nodes.resetWorkflow")}),a.jsx(Oa,{py:4,children:a.jsxs(N,{flexDir:"column",gap:2,children:[a.jsx(Se,{children:e("nodes.resetWorkflowDesc")}),a.jsx(Se,{variant:"subtext",children:e("nodes.resetWorkflowDesc2")})]})}),a.jsxs(pi,{children:[a.jsx(tl,{ref:s,onClick:o,children:e("common.cancel")}),a.jsx(tl,{colorScheme:"error",ml:3,onClick:c,children:e("common.accept")})]})]})]})]})},Tme=l.memo(Dme),Nme=()=>{const{t:e}=J(),t=q8(),n=l.useCallback(()=>{const r=new Blob([JSON.stringify(t,null,2)]),o=document.createElement("a");o.href=URL.createObjectURL(r),o.download=`${t.name||"My Workflow"}.json`,document.body.appendChild(o),o.click(),o.remove()},[t]);return a.jsx(tt,{icon:a.jsx(Wu,{}),tooltip:e("nodes.downloadWorkflow"),"aria-label":e("nodes.downloadWorkflow"),onClick:n})},$me=l.memo(Nme),Lme=()=>a.jsxs(N,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:"50%",transform:"translate(-50%)"},children:[a.jsx($me,{}),a.jsx(Ame,{}),a.jsx(Tme,{})]}),zme=l.memo(Lme),Fme=()=>a.jsx(N,{sx:{gap:2,flexDir:"column"},children:Ro(bf,({title:e,description:t,color:n},r)=>a.jsx(Fn,{label:t,children:a.jsx(Ha,{sx:{userSelect:"none",color:parseInt(n.split(".")[1]??"0",10)<500?"base.800":"base.50",bg:n},textAlign:"center",children:e})},r))}),Bme=l.memo(Fme),Hme=()=>{const{t:e}=J(),t=oe(),n=l.useCallback(()=>{t(WN())},[t]);return a.jsx(Rt,{leftIcon:a.jsx(_ee,{}),tooltip:e("nodes.reloadNodeTemplates"),"aria-label":e("nodes.reloadNodeTemplates"),onClick:n,children:e("nodes.reloadNodeTemplates")})},Wme=l.memo(Hme),kd={fontWeight:600},Vme=de(Ce,({nodes:e})=>{const{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionMode:s}=e;return{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionModeIsChecked:s===VN.Full}},_e),Ume=Oe((e,t)=>{const{isOpen:n,onOpen:r,onClose:o}=ls(),s=oe(),{shouldAnimateEdges:i,shouldValidateGraph:c,shouldSnapToGrid:d,shouldColorEdges:p,selectionModeIsChecked:h}=H(Vme),m=l.useCallback(S=>{s(UN(S.target.checked))},[s]),g=l.useCallback(S=>{s(GN(S.target.checked))},[s]),b=l.useCallback(S=>{s(qN(S.target.checked))},[s]),y=l.useCallback(S=>{s(KN(S.target.checked))},[s]),x=l.useCallback(S=>{s(QN(S.target.checked))},[s]),{t:C}=J();return a.jsxs(a.Fragment,{children:[a.jsx(tt,{ref:t,"aria-label":C("nodes.workflowSettings"),tooltip:C("nodes.workflowSettings"),icon:a.jsx(WM,{}),onClick:r}),a.jsxs(bu,{isOpen:n,onClose:o,size:"2xl",isCentered:!0,children:[a.jsx(Ma,{}),a.jsxs(xu,{children:[a.jsx(Ea,{children:C("nodes.workflowSettings")}),a.jsx(kg,{}),a.jsx(Oa,{children:a.jsxs(N,{sx:{flexDirection:"column",gap:4,py:4},children:[a.jsx(vo,{size:"sm",children:"General"}),a.jsx(jr,{formLabelProps:kd,onChange:g,isChecked:i,label:C("nodes.animatedEdges"),helperText:C("nodes.animatedEdgesHelp")}),a.jsx(no,{}),a.jsx(jr,{formLabelProps:kd,isChecked:d,onChange:b,label:C("nodes.snapToGrid"),helperText:C("nodes.snapToGridHelp")}),a.jsx(no,{}),a.jsx(jr,{formLabelProps:kd,isChecked:p,onChange:y,label:C("nodes.colorCodeEdges"),helperText:C("nodes.colorCodeEdgesHelp")}),a.jsx(jr,{formLabelProps:kd,isChecked:h,onChange:x,label:C("nodes.fullyContainNodes"),helperText:C("nodes.fullyContainNodesHelp")}),a.jsx(vo,{size:"sm",pt:4,children:"Advanced"}),a.jsx(jr,{formLabelProps:kd,isChecked:c,onChange:m,label:C("nodes.validateConnections"),helperText:C("nodes.validateConnectionsHelp")}),a.jsx(Wme,{})]})})]})]})]})}),Gme=l.memo(Ume),qme=()=>{const e=H(t=>t.nodes.shouldShowFieldTypeLegend);return a.jsxs(N,{sx:{gap:2,position:"absolute",top:2,insetInlineEnd:2},children:[a.jsx(Gme,{}),e&&a.jsx(Bme,{})]})},Kme=l.memo(qme);function Qme(){const e=oe(),t=H(o=>o.nodes.nodeOpacity),{t:n}=J(),r=l.useCallback(o=>{e(XN(o))},[e]);return a.jsx(N,{alignItems:"center",children:a.jsxs(jy,{"aria-label":n("nodes.nodeOpacity"),value:t,min:.5,max:1,step:.01,onChange:r,orientation:"vertical",defaultValue:30,h:"calc(100% - 0.5rem)",children:[a.jsx(Iy,{children:a.jsx(Py,{})}),a.jsx(_y,{})]})})}const Xme=()=>{const{t:e}=J(),{zoomIn:t,zoomOut:n,fitView:r}=Bx(),o=oe(),s=H(h=>h.nodes.shouldShowMinimapPanel),i=l.useCallback(()=>{t()},[t]),c=l.useCallback(()=>{n()},[n]),d=l.useCallback(()=>{r()},[r]),p=l.useCallback(()=>{o(YN(!s))},[s,o]);return a.jsxs(zn,{isAttached:!0,orientation:"vertical",children:[a.jsx(tt,{tooltip:e("nodes.zoomInNodes"),"aria-label":e("nodes.zoomInNodes"),onClick:i,icon:a.jsx(Voe,{})}),a.jsx(tt,{tooltip:e("nodes.zoomOutNodes"),"aria-label":e("nodes.zoomOutNodes"),onClick:c,icon:a.jsx(Woe,{})}),a.jsx(tt,{tooltip:e("nodes.fitViewportNodes"),"aria-label":e("nodes.fitViewportNodes"),onClick:d,icon:a.jsx(VM,{})}),a.jsx(tt,{tooltip:e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),"aria-label":e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),isChecked:s,onClick:p,icon:a.jsx(mee,{})})]})},Yme=l.memo(Xme),Jme=()=>a.jsxs(N,{sx:{gap:2,position:"absolute",bottom:2,insetInlineStart:2},children:[a.jsx(Yme,{}),a.jsx(Qme,{})]}),Zme=l.memo(Jme),ege=Ee(L$),tge=()=>{const e=H(r=>r.nodes.shouldShowMinimapPanel),t=di("var(--invokeai-colors-accent-300)","var(--invokeai-colors-accent-600)"),n=di("var(--invokeai-colors-blackAlpha-300)","var(--invokeai-colors-blackAlpha-600)");return a.jsx(N,{sx:{gap:2,position:"absolute",bottom:2,insetInlineEnd:2},children:e&&a.jsx(ege,{pannable:!0,zoomable:!0,nodeBorderRadius:15,sx:{m:"0 !important",backgroundColor:"base.200 !important",borderRadius:"base",_dark:{backgroundColor:"base.500 !important"},svg:{borderRadius:"inherit"}},nodeColor:t,maskColor:n})})},nge=l.memo(tge),rge=()=>{const e=H(n=>n.nodes.isReady),{t}=J();return a.jsxs(N,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center"},children:[a.jsx(yo,{children:e&&a.jsxs(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"relative",width:"100%",height:"100%"},children:[a.jsx(jme,{}),a.jsx(hhe,{}),a.jsx(Eme,{}),a.jsx(zme,{}),a.jsx(Kme,{}),a.jsx(Zme,{}),a.jsx(nge,{})]})}),a.jsx(yo,{children:!e&&a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"absolute",width:"100%",height:"100%"},children:a.jsx(N,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:a.jsx(qr,{label:t("nodes.loadingNodes"),icon:Uoe})})})})]})},oge=l.memo(rge),sge=()=>a.jsx(JN,{children:a.jsx(oge,{})}),age=l.memo(sge),ige=()=>{const{t:e}=J(),t=oe(),{data:n}=yf(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=ZN({fixedCacheKey:"clearInvocationCache"}),i=l.useMemo(()=>!(n!=null&&n.size)||!r,[n==null?void 0:n.size,r]);return{clearInvocationCache:l.useCallback(async()=>{if(!i)try{await o().unwrap(),t(Bt({title:e("invocationCache.clearSucceeded"),status:"success"}))}catch{t(Bt({title:e("invocationCache.clearFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},lge=()=>{const{t:e}=J(),{clearInvocationCache:t,isDisabled:n,isLoading:r}=ige();return a.jsx(Rt,{isDisabled:n,isLoading:r,onClick:t,children:e("invocationCache.clear")})},cge=l.memo(lge),uge=()=>{const{t:e}=J(),t=oe(),{data:n}=yf(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=e9({fixedCacheKey:"disableInvocationCache"}),i=l.useMemo(()=>!(n!=null&&n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{disableInvocationCache:l.useCallback(async()=>{if(!i)try{await o().unwrap(),t(Bt({title:e("invocationCache.disableSucceeded"),status:"success"}))}catch{t(Bt({title:e("invocationCache.disableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},dge=()=>{const{t:e}=J(),t=oe(),{data:n}=yf(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=t9({fixedCacheKey:"enableInvocationCache"}),i=l.useMemo(()=>(n==null?void 0:n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{enableInvocationCache:l.useCallback(async()=>{if(!i)try{await o().unwrap(),t(Bt({title:e("invocationCache.enableSucceeded"),status:"success"}))}catch{t(Bt({title:e("invocationCache.enableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},fge=()=>{const{t:e}=J(),{data:t}=yf(),{enableInvocationCache:n,isDisabled:r,isLoading:o}=dge(),{disableInvocationCache:s,isDisabled:i,isLoading:c}=uge();return t!=null&&t.enabled?a.jsx(Rt,{isDisabled:i,isLoading:c,onClick:s,children:e("invocationCache.disable")}):a.jsx(Rt,{isDisabled:r,isLoading:o,onClick:n,children:e("invocationCache.enable")})},pge=l.memo(fge),hge=({children:e,...t})=>a.jsx(B3,{alignItems:"center",justifyContent:"center",w:"full",h:"full",layerStyle:"second",borderRadius:"base",py:2,px:3,gap:6,flexWrap:"nowrap",...t,children:e}),qR=l.memo(hge),mge={'&[aria-disabled="true"]':{color:"base.400",_dark:{color:"base.500"}}},gge=({label:e,value:t,isDisabled:n=!1,...r})=>a.jsxs(F3,{flexGrow:1,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap","aria-disabled":n,sx:mge,...r,children:[a.jsx(H3,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:e}),a.jsx(W3,{children:t})]}),ya=l.memo(gge),vge=()=>{const{t:e}=J(),{data:t}=yf(void 0);return a.jsxs(qR,{children:[a.jsx(ya,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.cacheSize"),value:(t==null?void 0:t.size)??0}),a.jsx(ya,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.hits"),value:(t==null?void 0:t.hits)??0}),a.jsx(ya,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.misses"),value:(t==null?void 0:t.misses)??0}),a.jsx(ya,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.maxCacheSize"),value:(t==null?void 0:t.max_size)??0}),a.jsxs(zn,{w:24,orientation:"vertical",size:"xs",children:[a.jsx(cge,{}),a.jsx(pge,{})]})]})},bge=l.memo(vge),KR=e=>{const t=H(c=>c.system.isConnected),[n,{isLoading:r}]=Tx(),o=oe(),{t:s}=J();return{cancelQueueItem:l.useCallback(async()=>{try{await n(e).unwrap(),o(Bt({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(Bt({title:s("queue.cancelFailed"),status:"error"}))}},[o,e,s,n]),isLoading:r,isDisabled:!t}},QR=(e,t)=>Number(((Date.parse(t)-Date.parse(e))/1e3).toFixed(2)),nI={pending:{colorScheme:"cyan",translationKey:"queue.pending"},in_progress:{colorScheme:"yellow",translationKey:"queue.in_progress"},completed:{colorScheme:"green",translationKey:"queue.completed"},failed:{colorScheme:"red",translationKey:"queue.failed"},canceled:{colorScheme:"orange",translationKey:"queue.canceled"}},xge=({status:e})=>{const{t}=J();return a.jsx(Ha,{colorScheme:nI[e].colorScheme,children:t(nI[e].translationKey)})},yge=l.memo(xge),Cge=e=>{const t=H(d=>d.system.isConnected),{isCanceled:n}=n9({batch_id:e},{selectFromResult:({data:d})=>d?{isCanceled:(d==null?void 0:d.in_progress)===0&&(d==null?void 0:d.pending)===0}:{isCanceled:!0}}),[r,{isLoading:o}]=r9({fixedCacheKey:"cancelByBatchIds"}),s=oe(),{t:i}=J();return{cancelBatch:l.useCallback(async()=>{if(!n)try{await r({batch_ids:[e]}).unwrap(),s(Bt({title:i("queue.cancelBatchSucceeded"),status:"success"}))}catch{s(Bt({title:i("queue.cancelBatchFailed"),status:"error"}))}},[e,s,n,i,r]),isLoading:o,isCanceled:n,isDisabled:!t}},wge=({queueItemDTO:e})=>{const{session_id:t,batch_id:n,item_id:r}=e,{t:o}=J(),{cancelBatch:s,isLoading:i,isCanceled:c}=Cge(n),{cancelQueueItem:d,isLoading:p}=KR(r),{data:h}=o9(r),m=l.useMemo(()=>{if(!h)return o("common.loading");if(!h.completed_at||!h.started_at)return o(`queue.${h.status}`);const g=QR(h.started_at,h.completed_at);return h.status==="completed"?`${o("queue.completedIn")} ${g}${g===1?"":"s"}`:`${g}s`},[h,o]);return a.jsxs(N,{layerStyle:"third",flexDir:"column",p:2,pt:0,borderRadius:"base",gap:2,children:[a.jsxs(N,{layerStyle:"second",p:2,gap:2,justifyContent:"space-between",alignItems:"center",borderRadius:"base",h:20,children:[a.jsx(Ch,{label:o("queue.status"),data:m}),a.jsx(Ch,{label:o("queue.item"),data:r}),a.jsx(Ch,{label:o("queue.batch"),data:n}),a.jsx(Ch,{label:o("queue.session"),data:t}),a.jsxs(zn,{size:"xs",orientation:"vertical",children:[a.jsx(Rt,{onClick:d,isLoading:p,isDisabled:h?["canceled","completed","failed"].includes(h.status):!0,"aria-label":o("queue.cancelItem"),icon:a.jsx(ju,{}),colorScheme:"error",children:o("queue.cancelItem")}),a.jsx(Rt,{onClick:s,isLoading:i,isDisabled:c,"aria-label":o("queue.cancelBatch"),icon:a.jsx(ju,{}),colorScheme:"error",children:o("queue.cancelBatch")})]})]}),(h==null?void 0:h.error)&&a.jsxs(N,{layerStyle:"second",p:3,gap:1,justifyContent:"space-between",alignItems:"flex-start",borderRadius:"base",flexDir:"column",children:[a.jsx(vo,{size:"sm",color:"error.500",_dark:{color:"error.400"},children:"Error"}),a.jsx("pre",{children:h.error})]}),a.jsx(N,{layerStyle:"second",h:512,w:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",children:h?a.jsx(lc,{children:a.jsx(el,{label:"Queue Item",data:h})}):a.jsx(bi,{opacity:.5})})]})},Sge=l.memo(wge),Ch=({label:e,data:t})=>a.jsxs(N,{flexDir:"column",justifyContent:"flex-start",p:1,gap:1,overflow:"hidden",h:"full",w:"full",children:[a.jsx(vo,{size:"md",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:e}),a.jsx(Se,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),wa={number:"3rem",statusBadge:"5.7rem",statusDot:2,time:"4rem",batchId:"5rem",fieldValues:"auto",actions:"auto"},rI={bg:"base.300",_dark:{bg:"base.750"}},kge={_hover:rI,"&[aria-selected='true']":rI},jge=({index:e,item:t,context:n})=>{const{t:r}=J(),o=l.useCallback(()=>{n.toggleQueueItem(t.item_id)},[n,t.item_id]),{cancelQueueItem:s,isLoading:i}=KR(t.item_id),c=l.useCallback(m=>{m.stopPropagation(),s()},[s]),d=l.useMemo(()=>n.openQueueItems.includes(t.item_id),[n.openQueueItems,t.item_id]),p=l.useMemo(()=>!t.completed_at||!t.started_at?void 0:`${QR(t.started_at,t.completed_at)}s`,[t]),h=l.useMemo(()=>["canceled","completed","failed"].includes(t.status),[t.status]);return a.jsxs(N,{flexDir:"column","aria-selected":d,fontSize:"sm",borderRadius:"base",justifyContent:"center",sx:kge,"data-testid":"queue-item",children:[a.jsxs(N,{minH:9,alignItems:"center",gap:4,p:1.5,cursor:"pointer",onClick:o,children:[a.jsx(N,{w:wa.number,justifyContent:"flex-end",alignItems:"center",flexShrink:0,children:a.jsx(Se,{variant:"subtext",children:e+1})}),a.jsx(N,{w:wa.statusBadge,alignItems:"center",flexShrink:0,children:a.jsx(yge,{status:t.status})}),a.jsx(N,{w:wa.time,alignItems:"center",flexShrink:0,children:p||"-"}),a.jsx(N,{w:wa.batchId,flexShrink:0,children:a.jsx(Se,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",alignItems:"center",children:t.batch_id})}),a.jsx(N,{alignItems:"center",overflow:"hidden",flexGrow:1,children:t.field_values&&a.jsx(N,{gap:2,w:"full",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:t.field_values.filter(m=>m.node_path!=="metadata_accumulator").map(({node_path:m,field_name:g,value:b})=>a.jsxs(Se,{as:"span",children:[a.jsxs(Se,{as:"span",fontWeight:600,children:[m,".",g]}),": ",b]},`${t.item_id}.${m}.${g}.${b}`))})}),a.jsx(N,{alignItems:"center",w:wa.actions,pe:3,children:a.jsx(zn,{size:"xs",variant:"ghost",children:a.jsx(tt,{onClick:c,isDisabled:h,isLoading:i,"aria-label":r("queue.cancelItem"),icon:a.jsx(ju,{})})})})]}),a.jsx(Sf,{in:d,transition:{enter:{duration:.1},exit:{duration:.1}},unmountOnExit:!0,children:a.jsx(Sge,{queueItemDTO:t})})]})},_ge=l.memo(jge),Ige=l.memo(Oe((e,t)=>a.jsx(N,{...e,ref:t,flexDirection:"column",gap:.5,children:e.children}))),Pge=l.memo(Ige),Ege=()=>a.jsxs(N,{alignItems:"center",gap:4,p:1,pb:2,textTransform:"uppercase",fontWeight:700,fontSize:"xs",letterSpacing:1,children:[a.jsx(N,{w:wa.number,justifyContent:"flex-end",alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"#"})}),a.jsx(N,{ps:.5,w:wa.statusBadge,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"status"})}),a.jsx(N,{ps:.5,w:wa.time,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"time"})}),a.jsx(N,{ps:.5,w:wa.batchId,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"batch"})}),a.jsx(N,{ps:.5,w:wa.fieldValues,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"batch field values"})})]}),Mge=l.memo(Ege),Oge={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},Rge=de(Ce,({queue:e})=>{const{listCursor:t,listPriority:n}=e;return{listCursor:t,listPriority:n}},_e),Age=(e,t)=>t.item_id,Dge={List:Pge},Tge=(e,t,n)=>a.jsx(_ge,{index:e,item:t,context:n}),Nge=()=>{const{listCursor:e,listPriority:t}=H(Rge),n=oe(),r=l.useRef(null),[o,s]=l.useState(null),[i,c]=u2(Oge),{t:d}=J();l.useEffect(()=>{const{current:S}=r;return o&&S&&i({target:S,elements:{viewport:o}}),()=>{var j;return(j=c())==null?void 0:j.destroy()}},[o,i,c]);const{data:p,isLoading:h}=s9({cursor:e,priority:t}),m=l.useMemo(()=>p?a9.getSelectors().selectAll(p):[],[p]),g=l.useCallback(()=>{if(!(p!=null&&p.has_more))return;const S=m[m.length-1];S&&(n(Nx(S.item_id)),n($x(S.priority)))},[n,p==null?void 0:p.has_more,m]),[b,y]=l.useState([]),x=l.useCallback(S=>{y(j=>j.includes(S)?j.filter(_=>_!==S):[...j,S])},[]),C=l.useMemo(()=>({openQueueItems:b,toggleQueueItem:x}),[b,x]);return h?a.jsx(are,{}):m.length?a.jsxs(N,{w:"full",h:"full",flexDir:"column",children:[a.jsx(Mge,{}),a.jsx(N,{ref:r,w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(voe,{data:m,endReached:g,scrollerRef:s,itemContent:Tge,computeItemKey:Age,components:Dge,context:C})})]}):a.jsx(N,{w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(vo,{color:"base.400",_dark:{color:"base.500"},children:d("queue.queueEmpty")})})},$ge=l.memo(Nge),Lge=()=>{const{data:e}=Fa(),{t}=J();return a.jsxs(qR,{"data-testid":"queue-status",children:[a.jsx(ya,{label:t("queue.in_progress"),value:(e==null?void 0:e.queue.in_progress)??0}),a.jsx(ya,{label:t("queue.pending"),value:(e==null?void 0:e.queue.pending)??0}),a.jsx(ya,{label:t("queue.completed"),value:(e==null?void 0:e.queue.completed)??0}),a.jsx(ya,{label:t("queue.failed"),value:(e==null?void 0:e.queue.failed)??0}),a.jsx(ya,{label:t("queue.canceled"),value:(e==null?void 0:e.queue.canceled)??0}),a.jsx(ya,{label:t("queue.total"),value:(e==null?void 0:e.queue.total)??0})]})},zge=l.memo(Lge);function Fge(e){return Qe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M7.657 6.247c.11-.33.576-.33.686 0l.645 1.937a2.89 2.89 0 0 0 1.829 1.828l1.936.645c.33.11.33.576 0 .686l-1.937.645a2.89 2.89 0 0 0-1.828 1.829l-.645 1.936a.361.361 0 0 1-.686 0l-.645-1.937a2.89 2.89 0 0 0-1.828-1.828l-1.937-.645a.361.361 0 0 1 0-.686l1.937-.645a2.89 2.89 0 0 0 1.828-1.828l.645-1.937zM3.794 1.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387A1.734 1.734 0 0 0 4.593 5.69l-.387 1.162a.217.217 0 0 1-.412 0L3.407 5.69A1.734 1.734 0 0 0 2.31 4.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387A1.734 1.734 0 0 0 3.407 2.31l.387-1.162zM10.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732L9.1 2.137a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L10.863.1z"}}]})(e)}const Bge=()=>{const e=oe(),{t}=J(),n=H(d=>d.system.isConnected),[r,{isLoading:o}]=dP({fixedCacheKey:"pruneQueue"}),{finishedCount:s}=Fa(void 0,{selectFromResult:({data:d})=>d?{finishedCount:d.queue.completed+d.queue.canceled+d.queue.failed}:{finishedCount:0}}),i=l.useCallback(async()=>{if(s)try{const d=await r().unwrap();e(Bt({title:t("queue.pruneSucceeded",{item_count:d.deleted}),status:"success"})),e(Nx(void 0)),e($x(void 0))}catch{e(Bt({title:t("queue.pruneFailed"),status:"error"}))}},[s,r,e,t]),c=l.useMemo(()=>!n||!s,[s,n]);return{pruneQueue:i,isLoading:o,finishedCount:s,isDisabled:c}},Hge=({asIconButton:e})=>{const{t}=J(),{pruneQueue:n,isLoading:r,finishedCount:o,isDisabled:s}=Bge();return a.jsx(ic,{isDisabled:s,isLoading:r,asIconButton:e,label:t("queue.prune"),tooltip:t("queue.pruneTooltip",{item_count:o}),icon:a.jsx(Fge,{}),onClick:n,colorScheme:"blue"})},Wge=l.memo(Hge),Vge=()=>{const e=jn("pauseQueue").isFeatureEnabled,t=jn("resumeQueue").isFeatureEnabled;return a.jsxs(N,{layerStyle:"second",borderRadius:"base",p:2,gap:2,children:[e||t?a.jsxs(zn,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[t?a.jsx(M8,{}):a.jsx(a.Fragment,{}),e?a.jsx(k8,{}):a.jsx(a.Fragment,{})]}):a.jsx(a.Fragment,{}),a.jsxs(zn,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[a.jsx(Wge,{}),a.jsx(O2,{})]})]})},Uge=l.memo(Vge),Gge=()=>{const e=jn("invocationCache").isFeatureEnabled;return a.jsxs(N,{layerStyle:"first",borderRadius:"base",w:"full",h:"full",p:2,flexDir:"column",gap:2,children:[a.jsxs(N,{gap:2,w:"full",children:[a.jsx(Uge,{}),a.jsx(zge,{}),e&&a.jsx(bge,{})]}),a.jsx(Te,{layerStyle:"second",p:2,borderRadius:"base",w:"full",h:"full",children:a.jsx($ge,{})})]})},qge=l.memo(Gge),Kge=()=>a.jsx(qge,{}),Qge=l.memo(Kge),Xge=()=>a.jsx(RR,{}),Yge=l.memo(Xge);var px={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var n=pS;Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return n.Konva}});const r=pS;e.exports=r.Konva})(px,px.exports);var Jge=px.exports;const ff=hf(Jge);var XR={exports:{}};/** * @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 Zge=function(t){var n={},r=l,o=Sh,s=Object.assign;function i(u){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+u,v=1;vae||k[$]!==E[ae]){var ge=` `+k[$].replace(" at new "," at ");return u.displayName&&ge.includes("")&&(ge=ge.replace("",u.displayName)),ge}while(1<=$&&0<=ae);break}}}finally{Zt=!1,Error.prepareStackTrace=v}return(u=u?u.displayName||u.name:"")?Vt(u):""}var sn=Object.prototype.hasOwnProperty,Yt=[],He=-1;function Ct(u){return{current:u}}function zt(u){0>He||(u.current=Yt[He],Yt[He]=null,He--)}function Qt(u,f){He++,Yt[He]=u.current,u.current=f}var Nn={},Jt=Ct(Nn),vn=Ct(!1),fn=Nn;function Br(u,f){var v=u.type.contextTypes;if(!v)return Nn;var w=u.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===f)return w.__reactInternalMemoizedMaskedChildContext;var k={},E;for(E in v)k[E]=f[E];return w&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=f,u.__reactInternalMemoizedMaskedChildContext=k),k}function cr(u){return u=u.childContextTypes,u!=null}function Dt(){zt(vn),zt(Jt)}function $n(u,f,v){if(Jt.current!==Nn)throw Error(i(168));Qt(Jt,f),Qt(vn,v)}function Wn(u,f,v){var w=u.stateNode;if(f=f.childContextTypes,typeof w.getChildContext!="function")return v;w=w.getChildContext();for(var k in w)if(!(k in f))throw Error(i(108,A(u)||"Unknown",k));return s({},v,w)}function ur(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||Nn,fn=Jt.current,Qt(Jt,u),Qt(vn,vn.current),!0}function Ir(u,f,v){var w=u.stateNode;if(!w)throw Error(i(169));v?(u=Wn(u,f,fn),w.__reactInternalMemoizedMergedChildContext=u,zt(vn),zt(Jt),Qt(Jt,u)):zt(vn),Qt(vn,v)}var Kn=Math.clz32?Math.clz32:On,Qn=Math.log,bn=Math.LN2;function On(u){return u>>>=0,u===0?32:31-(Qn(u)/bn|0)|0}var Ln=64,In=4194304;function Pn(u){switch(u&-u){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 u&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return u&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return u}}function Je(u,f){var v=u.pendingLanes;if(v===0)return 0;var w=0,k=u.suspendedLanes,E=u.pingedLanes,$=v&268435455;if($!==0){var ae=$&~k;ae!==0?w=Pn(ae):(E&=$,E!==0&&(w=Pn(E)))}else $=v&~k,$!==0?w=Pn($):E!==0&&(w=Pn(E));if(w===0)return 0;if(f!==0&&f!==w&&!(f&k)&&(k=w&-w,E=f&-f,k>=E||k===16&&(E&4194240)!==0))return f;if(w&4&&(w|=v&16),f=u.entangledLanes,f!==0)for(u=u.entanglements,f&=w;0v;v++)f.push(u);return f}function bt(u,f,v){u.pendingLanes|=f,f!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,f=31-Kn(f),u[f]=v}function st(u,f){var v=u.pendingLanes&~f;u.pendingLanes=f,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=f,u.mutableReadLanes&=f,u.entangledLanes&=f,f=u.entanglements;var w=u.eventTimes;for(u=u.expirationTimes;0>=$,k-=$,Jo=1<<32-Kn(f)+k|v<Rn?(eo=rn,rn=null):eo=rn.sibling;var An=ct(me,rn,ye[Rn],dt);if(An===null){rn===null&&(rn=eo);break}u&&rn&&An.alternate===null&&f(me,rn),ce=E(An,ce,Rn),un===null?Wt=An:un.sibling=An,un=An,rn=eo}if(Rn===ye.length)return v(me,rn),dr&&xl(me,Rn),Wt;if(rn===null){for(;RnRn?(eo=rn,rn=null):eo=rn.sibling;var $i=ct(me,rn,An.value,dt);if($i===null){rn===null&&(rn=eo);break}u&&rn&&$i.alternate===null&&f(me,rn),ce=E($i,ce,Rn),un===null?Wt=$i:un.sibling=$i,un=$i,rn=eo}if(An.done)return v(me,rn),dr&&xl(me,Rn),Wt;if(rn===null){for(;!An.done;Rn++,An=ye.next())An=nn(me,An.value,dt),An!==null&&(ce=E(An,ce,Rn),un===null?Wt=An:un.sibling=An,un=An);return dr&&xl(me,Rn),Wt}for(rn=w(me,rn);!An.done;Rn++,An=ye.next())An=lr(rn,me,Rn,An.value,dt),An!==null&&(u&&An.alternate!==null&&rn.delete(An.key===null?Rn:An.key),ce=E(An,ce,Rn),un===null?Wt=An:un.sibling=An,un=An);return u&&rn.forEach(function(FA){return f(me,FA)}),dr&&xl(me,Rn),Wt}function Ya(me,ce,ye,dt){if(typeof ye=="object"&&ye!==null&&ye.type===h&&ye.key===null&&(ye=ye.props.children),typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case d:e:{for(var Wt=ye.key,un=ce;un!==null;){if(un.key===Wt){if(Wt=ye.type,Wt===h){if(un.tag===7){v(me,un.sibling),ce=k(un,ye.props.children),ce.return=me,me=ce;break e}}else if(un.elementType===Wt||typeof Wt=="object"&&Wt!==null&&Wt.$$typeof===_&&hC(Wt)===un.type){v(me,un.sibling),ce=k(un,ye.props),ce.ref=Ju(me,un,ye),ce.return=me,me=ce;break e}v(me,un);break}else f(me,un);un=un.sibling}ye.type===h?(ce=_l(ye.props.children,me.mode,dt,ye.key),ce.return=me,me=ce):(dt=Mp(ye.type,ye.key,ye.props,null,me.mode,dt),dt.ref=Ju(me,ce,ye),dt.return=me,me=dt)}return $(me);case p:e:{for(un=ye.key;ce!==null;){if(ce.key===un)if(ce.tag===4&&ce.stateNode.containerInfo===ye.containerInfo&&ce.stateNode.implementation===ye.implementation){v(me,ce.sibling),ce=k(ce,ye.children||[]),ce.return=me,me=ce;break e}else{v(me,ce);break}else f(me,ce);ce=ce.sibling}ce=Iv(ye,me.mode,dt),ce.return=me,me=ce}return $(me);case _:return un=ye._init,Ya(me,ce,un(ye._payload),dt)}if(Q(ye))return Yn(me,ce,ye,dt);if(M(ye))return Lo(me,ce,ye,dt);op(me,ye)}return typeof ye=="string"&&ye!==""||typeof ye=="number"?(ye=""+ye,ce!==null&&ce.tag===6?(v(me,ce.sibling),ce=k(ce,ye),ce.return=me,me=ce):(v(me,ce),ce=_v(ye,me.mode,dt),ce.return=me,me=ce),$(me)):v(me,ce)}return Ya}var hc=mC(!0),gC=mC(!1),Zu={},hs=Ct(Zu),ed=Ct(Zu),mc=Ct(Zu);function pa(u){if(u===Zu)throw Error(i(174));return u}function F0(u,f){Qt(mc,f),Qt(ed,u),Qt(hs,Zu),u=L(f),zt(hs),Qt(hs,u)}function gc(){zt(hs),zt(ed),zt(mc)}function vC(u){var f=pa(mc.current),v=pa(hs.current);f=ee(v,u.type,f),v!==f&&(Qt(ed,u),Qt(hs,f))}function B0(u){ed.current===u&&(zt(hs),zt(ed))}var yr=Ct(0);function sp(u){for(var f=u;f!==null;){if(f.tag===13){var v=f.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||Yr(v)||ca(v)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if(f.flags&128)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var H0=[];function W0(){for(var u=0;uv?v:4,u(!0);var w=V0.transition;V0.transition={};try{u(!1),f()}finally{Ae=v,V0.transition=w}}function TC(){return ms().memoizedState}function pA(u,f,v){var w=Di(u);if(v={lane:w,action:v,hasEagerState:!1,eagerState:null,next:null},NC(u))$C(f,v);else if(v=aC(u,f,v,w),v!==null){var k=mo();gs(v,u,w,k),LC(v,f,w)}}function hA(u,f,v){var w=Di(u),k={lane:w,action:v,hasEagerState:!1,eagerState:null,next:null};if(NC(u))$C(f,k);else{var E=u.alternate;if(u.lanes===0&&(E===null||E.lanes===0)&&(E=f.lastRenderedReducer,E!==null))try{var $=f.lastRenderedState,ae=E($,v);if(k.hasEagerState=!0,k.eagerState=ae,xn(ae,$)){var ge=f.interleaved;ge===null?(k.next=k,N0(f)):(k.next=ge.next,ge.next=k),f.interleaved=k;return}}catch{}finally{}v=aC(u,f,k,w),v!==null&&(k=mo(),gs(v,u,w,k),LC(v,f,w))}}function NC(u){var f=u.alternate;return u===Cr||f!==null&&f===Cr}function $C(u,f){td=ip=!0;var v=u.pending;v===null?f.next=f:(f.next=v.next,v.next=f),u.pending=f}function LC(u,f,v){if(v&4194240){var w=f.lanes;w&=u.pendingLanes,v|=w,f.lanes=v,Le(u,v)}}var up={readContext:ps,useCallback:fo,useContext:fo,useEffect:fo,useImperativeHandle:fo,useInsertionEffect:fo,useLayoutEffect:fo,useMemo:fo,useReducer:fo,useRef:fo,useState:fo,useDebugValue:fo,useDeferredValue:fo,useTransition:fo,useMutableSource:fo,useSyncExternalStore:fo,useId:fo,unstable_isNewReconciler:!1},mA={readContext:ps,useCallback:function(u,f){return ha().memoizedState=[u,f===void 0?null:f],u},useContext:ps,useEffect:IC,useImperativeHandle:function(u,f,v){return v=v!=null?v.concat([u]):null,lp(4194308,4,MC.bind(null,f,u),v)},useLayoutEffect:function(u,f){return lp(4194308,4,u,f)},useInsertionEffect:function(u,f){return lp(4,2,u,f)},useMemo:function(u,f){var v=ha();return f=f===void 0?null:f,u=u(),v.memoizedState=[u,f],u},useReducer:function(u,f,v){var w=ha();return f=v!==void 0?v(f):f,w.memoizedState=w.baseState=f,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:f},w.queue=u,u=u.dispatch=pA.bind(null,Cr,u),[w.memoizedState,u]},useRef:function(u){var f=ha();return u={current:u},f.memoizedState=u},useState:jC,useDebugValue:Y0,useDeferredValue:function(u){return ha().memoizedState=u},useTransition:function(){var u=jC(!1),f=u[0];return u=fA.bind(null,u[1]),ha().memoizedState=u,[f,u]},useMutableSource:function(){},useSyncExternalStore:function(u,f,v){var w=Cr,k=ha();if(dr){if(v===void 0)throw Error(i(407));v=v()}else{if(v=f(),Zr===null)throw Error(i(349));Cl&30||yC(w,f,v)}k.memoizedState=v;var E={value:v,getSnapshot:f};return k.queue=E,IC(wC.bind(null,w,E,u),[u]),w.flags|=2048,od(9,CC.bind(null,w,E,v,f),void 0,null),v},useId:function(){var u=ha(),f=Zr.identifierPrefix;if(dr){var v=uo,w=Jo;v=(w&~(1<<32-Kn(w)-1)).toString(32)+v,f=":"+f+"R"+v,v=nd++,0bv&&(f.flags|=128,w=!0,id(k,!1),f.lanes=4194304)}else{if(!w)if(u=sp(E),u!==null){if(f.flags|=128,w=!0,u=u.updateQueue,u!==null&&(f.updateQueue=u,f.flags|=4),id(k,!0),k.tail===null&&k.tailMode==="hidden"&&!E.alternate&&!dr)return po(f),null}else 2*Ue()-k.renderingStartTime>bv&&v!==1073741824&&(f.flags|=128,w=!0,id(k,!1),f.lanes=4194304);k.isBackwards?(E.sibling=f.child,f.child=E):(u=k.last,u!==null?u.sibling=E:f.child=E,k.last=E)}return k.tail!==null?(f=k.tail,k.rendering=f,k.tail=f.sibling,k.renderingStartTime=Ue(),f.sibling=null,u=yr.current,Qt(yr,w?u&1|2:u&1),f):(po(f),null);case 22:case 23:return Sv(),v=f.memoizedState!==null,u!==null&&u.memoizedState!==null!==v&&(f.flags|=8192),v&&f.mode&1?es&1073741824&&(po(f),pe&&f.subtreeFlags&6&&(f.flags|=8192)):po(f),null;case 24:return null;case 25:return null}throw Error(i(156,f.tag))}function SA(u,f){switch(P0(f),f.tag){case 1:return cr(f.type)&&Dt(),u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 3:return gc(),zt(vn),zt(Jt),W0(),u=f.flags,u&65536&&!(u&128)?(f.flags=u&-65537|128,f):null;case 5:return B0(f),null;case 13:if(zt(yr),u=f.memoizedState,u!==null&&u.dehydrated!==null){if(f.alternate===null)throw Error(i(340));dc()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 19:return zt(yr),null;case 4:return gc(),null;case 10:return D0(f.type._context),null;case 22:case 23:return Sv(),null;case 24:return null;default:return null}}var mp=!1,ho=!1,kA=typeof WeakSet=="function"?WeakSet:Set,gt=null;function bc(u,f){var v=u.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(w){fr(u,f,w)}else v.current=null}function av(u,f,v){try{v()}catch(w){fr(u,f,w)}}var rw=!1;function jA(u,f){for(K(u.containerInfo),gt=f;gt!==null;)if(u=gt,f=u.child,(u.subtreeFlags&1028)!==0&&f!==null)f.return=u,gt=f;else for(;gt!==null;){u=gt;try{var v=u.alternate;if(u.flags&1024)switch(u.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var w=v.memoizedProps,k=v.memoizedState,E=u.stateNode,$=E.getSnapshotBeforeUpdate(u.elementType===u.type?w:Fs(u.type,w),k);E.__reactInternalSnapshotBeforeUpdate=$}break;case 3:pe&&hn(u.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(ae){fr(u,u.return,ae)}if(f=u.sibling,f!==null){f.return=u.return,gt=f;break}gt=u.return}return v=rw,rw=!1,v}function ld(u,f,v){var w=f.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var k=w=w.next;do{if((k.tag&u)===u){var E=k.destroy;k.destroy=void 0,E!==void 0&&av(f,v,E)}k=k.next}while(k!==w)}}function gp(u,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&u)===u){var w=v.create;v.destroy=w()}v=v.next}while(v!==f)}}function iv(u){var f=u.ref;if(f!==null){var v=u.stateNode;switch(u.tag){case 5:u=U(v);break;default:u=v}typeof f=="function"?f(u):f.current=u}}function ow(u){var f=u.alternate;f!==null&&(u.alternate=null,ow(f)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(f=u.stateNode,f!==null&&De(f)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function sw(u){return u.tag===5||u.tag===3||u.tag===4}function aw(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||sw(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function lv(u,f,v){var w=u.tag;if(w===5||w===6)u=u.stateNode,f?_n(v,u,f):ht(v,u);else if(w!==4&&(u=u.child,u!==null))for(lv(u,f,v),u=u.sibling;u!==null;)lv(u,f,v),u=u.sibling}function cv(u,f,v){var w=u.tag;if(w===5||w===6)u=u.stateNode,f?Xe(v,u,f):je(v,u);else if(w!==4&&(u=u.child,u!==null))for(cv(u,f,v),u=u.sibling;u!==null;)cv(u,f,v),u=u.sibling}var lo=null,Bs=!1;function ga(u,f,v){for(v=v.child;v!==null;)uv(u,f,v),v=v.sibling}function uv(u,f,v){if(Sn&&typeof Sn.onCommitFiberUnmount=="function")try{Sn.onCommitFiberUnmount(ir,v)}catch{}switch(v.tag){case 5:ho||bc(v,f);case 6:if(pe){var w=lo,k=Bs;lo=null,ga(u,f,v),lo=w,Bs=k,lo!==null&&(Bs?Ze(lo,v.stateNode):Me(lo,v.stateNode))}else ga(u,f,v);break;case 18:pe&&lo!==null&&(Bs?We(lo,v.stateNode):wt(lo,v.stateNode));break;case 4:pe?(w=lo,k=Bs,lo=v.stateNode.containerInfo,Bs=!0,ga(u,f,v),lo=w,Bs=k):(le&&(w=v.stateNode.containerInfo,k=Dr(w),or(w,k)),ga(u,f,v));break;case 0:case 11:case 14:case 15:if(!ho&&(w=v.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){k=w=w.next;do{var E=k,$=E.destroy;E=E.tag,$!==void 0&&(E&2||E&4)&&av(v,f,$),k=k.next}while(k!==w)}ga(u,f,v);break;case 1:if(!ho&&(bc(v,f),w=v.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=v.memoizedProps,w.state=v.memoizedState,w.componentWillUnmount()}catch(ae){fr(v,f,ae)}ga(u,f,v);break;case 21:ga(u,f,v);break;case 22:v.mode&1?(ho=(w=ho)||v.memoizedState!==null,ga(u,f,v),ho=w):ga(u,f,v);break;default:ga(u,f,v)}}function iw(u){var f=u.updateQueue;if(f!==null){u.updateQueue=null;var v=u.stateNode;v===null&&(v=u.stateNode=new kA),f.forEach(function(w){var k=DA.bind(null,u,w);v.has(w)||(v.add(w),w.then(k,k))})}}function Hs(u,f){var v=f.deletions;if(v!==null)for(var w=0;w";case bp:return":has("+(pv(u)||"")+")";case xp:return'[role="'+u.value+'"]';case Cp:return'"'+u.value+'"';case yp:return'[data-testname="'+u.value+'"]';default:throw Error(i(365))}}function pw(u,f){var v=[];u=[u,0];for(var w=0;wk&&(k=$),w&=~E}if(w=k,w=Ue()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*IA(w/1960))-w,10u?16:u,Ai===null)var w=!1;else{if(u=Ai,Ai=null,_p=0,pn&6)throw Error(i(331));var k=pn;for(pn|=4,gt=u.current;gt!==null;){var E=gt,$=E.child;if(gt.flags&16){var ae=E.deletions;if(ae!==null){for(var ge=0;geUe()-vv?Sl(u,0):gv|=v),$o(u,f)}function ww(u,f){f===0&&(u.mode&1?(f=In,In<<=1,!(In&130023424)&&(In=4194304)):f=1);var v=mo();u=fa(u,f),u!==null&&(bt(u,f,v),$o(u,v))}function AA(u){var f=u.memoizedState,v=0;f!==null&&(v=f.retryLane),ww(u,v)}function DA(u,f){var v=0;switch(u.tag){case 13:var w=u.stateNode,k=u.memoizedState;k!==null&&(v=k.retryLane);break;case 19:w=u.stateNode;break;default:throw Error(i(314))}w!==null&&w.delete(f),ww(u,v)}var Sw;Sw=function(u,f,v){if(u!==null)if(u.memoizedProps!==f.pendingProps||vn.current)To=!0;else{if(!(u.lanes&v)&&!(f.flags&128))return To=!1,CA(u,f,v);To=!!(u.flags&131072)}else To=!1,dr&&f.flags&1048576&&eC(f,So,f.index);switch(f.lanes=0,f.tag){case 2:var w=f.type;fp(u,f),u=f.pendingProps;var k=Br(f,Jt.current);pc(f,v),k=G0(null,f,w,u,k,v);var E=q0();return f.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,cr(w)?(E=!0,ur(f)):E=!1,f.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,$0(f),k.updater=rp,f.stateNode=k,k._reactInternals=f,z0(f,w,u,v),f=tv(null,f,w,!0,E,v)):(f.tag=0,dr&&E&&I0(f),_o(null,f,k,v),f=f.child),f;case 16:w=f.elementType;e:{switch(fp(u,f),u=f.pendingProps,k=w._init,w=k(w._payload),f.type=w,k=f.tag=NA(w),u=Fs(w,u),k){case 0:f=ev(null,f,w,u,v);break e;case 1:f=QC(null,f,w,u,v);break e;case 11:f=VC(null,f,w,u,v);break e;case 14:f=UC(null,f,w,Fs(w.type,u),v);break e}throw Error(i(306,w,""))}return f;case 0:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),ev(u,f,w,k,v);case 1:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),QC(u,f,w,k,v);case 3:e:{if(XC(f),u===null)throw Error(i(387));w=f.pendingProps,E=f.memoizedState,k=E.element,iC(u,f),np(f,w,null,v);var $=f.memoizedState;if(w=$.element,we&&E.isDehydrated)if(E={element:w,isDehydrated:!1,cache:$.cache,pendingSuspenseBoundaries:$.pendingSuspenseBoundaries,transitions:$.transitions},f.updateQueue.baseState=E,f.memoizedState=E,f.flags&256){k=vc(Error(i(423)),f),f=YC(u,f,w,v,k);break e}else if(w!==k){k=vc(Error(i(424)),f),f=YC(u,f,w,v,k);break e}else for(we&&(fs=ie(f.stateNode.containerInfo),Zo=f,dr=!0,zs=null,Yu=!1),v=gC(f,null,w,v),f.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(dc(),w===k){f=Qa(u,f,v);break e}_o(u,f,w,v)}f=f.child}return f;case 5:return vC(f),u===null&&M0(f),w=f.type,k=f.pendingProps,E=u!==null?u.memoizedProps:null,$=k.children,V(w,k)?$=null:E!==null&&V(w,E)&&(f.flags|=32),KC(u,f),_o(u,f,$,v),f.child;case 6:return u===null&&M0(f),null;case 13:return JC(u,f,v);case 4:return F0(f,f.stateNode.containerInfo),w=f.pendingProps,u===null?f.child=hc(f,null,w,v):_o(u,f,w,v),f.child;case 11:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),VC(u,f,w,k,v);case 7:return _o(u,f,f.pendingProps,v),f.child;case 8:return _o(u,f,f.pendingProps.children,v),f.child;case 12:return _o(u,f,f.pendingProps.children,v),f.child;case 10:e:{if(w=f.type._context,k=f.pendingProps,E=f.memoizedProps,$=k.value,sC(f,w,$),E!==null)if(xn(E.value,$)){if(E.children===k.children&&!vn.current){f=Qa(u,f,v);break e}}else for(E=f.child,E!==null&&(E.return=f);E!==null;){var ae=E.dependencies;if(ae!==null){$=E.child;for(var ge=ae.firstContext;ge!==null;){if(ge.context===w){if(E.tag===1){ge=Ka(-1,v&-v),ge.tag=2;var Fe=E.updateQueue;if(Fe!==null){Fe=Fe.shared;var xt=Fe.pending;xt===null?ge.next=ge:(ge.next=xt.next,xt.next=ge),Fe.pending=ge}}E.lanes|=v,ge=E.alternate,ge!==null&&(ge.lanes|=v),T0(E.return,v,f),ae.lanes|=v;break}ge=ge.next}}else if(E.tag===10)$=E.type===f.type?null:E.child;else if(E.tag===18){if($=E.return,$===null)throw Error(i(341));$.lanes|=v,ae=$.alternate,ae!==null&&(ae.lanes|=v),T0($,v,f),$=E.sibling}else $=E.child;if($!==null)$.return=E;else for($=E;$!==null;){if($===f){$=null;break}if(E=$.sibling,E!==null){E.return=$.return,$=E;break}$=$.return}E=$}_o(u,f,k.children,v),f=f.child}return f;case 9:return k=f.type,w=f.pendingProps.children,pc(f,v),k=ps(k),w=w(k),f.flags|=1,_o(u,f,w,v),f.child;case 14:return w=f.type,k=Fs(w,f.pendingProps),k=Fs(w.type,k),UC(u,f,w,k,v);case 15:return GC(u,f,f.type,f.pendingProps,v);case 17:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),fp(u,f),f.tag=1,cr(w)?(u=!0,ur(f)):u=!1,pc(f,v),fC(f,w,k),z0(f,w,k,v),tv(null,f,w,!0,u,v);case 19:return ew(u,f,v);case 22:return qC(u,f,v)}throw Error(i(156,f.tag))};function kw(u,f){return Ve(u,f)}function TA(u,f,v,w){this.tag=u,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vs(u,f,v,w){return new TA(u,f,v,w)}function jv(u){return u=u.prototype,!(!u||!u.isReactComponent)}function NA(u){if(typeof u=="function")return jv(u)?1:0;if(u!=null){if(u=u.$$typeof,u===x)return 11;if(u===j)return 14}return 2}function Ni(u,f){var v=u.alternate;return v===null?(v=vs(u.tag,f,u.key,u.mode),v.elementType=u.elementType,v.type=u.type,v.stateNode=u.stateNode,v.alternate=u,u.alternate=v):(v.pendingProps=f,v.type=u.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=u.flags&14680064,v.childLanes=u.childLanes,v.lanes=u.lanes,v.child=u.child,v.memoizedProps=u.memoizedProps,v.memoizedState=u.memoizedState,v.updateQueue=u.updateQueue,f=u.dependencies,v.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},v.sibling=u.sibling,v.index=u.index,v.ref=u.ref,v}function Mp(u,f,v,w,k,E){var $=2;if(w=u,typeof u=="function")jv(u)&&($=1);else if(typeof u=="string")$=5;else e:switch(u){case h:return _l(v.children,k,E,f);case m:$=8,k|=8;break;case g:return u=vs(12,v,f,k|2),u.elementType=g,u.lanes=E,u;case C:return u=vs(13,v,f,k),u.elementType=C,u.lanes=E,u;case S:return u=vs(19,v,f,k),u.elementType=S,u.lanes=E,u;case I:return Op(v,k,E,f);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case b:$=10;break e;case y:$=9;break e;case x:$=11;break e;case j:$=14;break e;case _:$=16,w=null;break e}throw Error(i(130,u==null?u:typeof u,""))}return f=vs($,v,f,k),f.elementType=u,f.type=w,f.lanes=E,f}function _l(u,f,v,w){return u=vs(7,u,w,f),u.lanes=v,u}function Op(u,f,v,w){return u=vs(22,u,w,f),u.elementType=I,u.lanes=v,u.stateNode={isHidden:!1},u}function _v(u,f,v){return u=vs(6,u,null,f),u.lanes=v,u}function Iv(u,f,v){return f=vs(4,u.children!==null?u.children:[],u.key,f),f.lanes=v,f.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},f}function $A(u,f,v,w,k){this.tag=f,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=q,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Gt(0),this.expirationTimes=Gt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gt(0),this.identifierPrefix=w,this.onRecoverableError=k,we&&(this.mutableSourceEagerHydrationData=null)}function jw(u,f,v,w,k,E,$,ae,ge){return u=new $A(u,f,v,ae,ge),f===1?(f=1,E===!0&&(f|=8)):f=0,E=vs(3,null,null,f),u.current=E,E.stateNode=u,E.memoizedState={element:w,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},$0(E),u}function _w(u){if(!u)return Nn;u=u._reactInternals;e:{if(D(u)!==u||u.tag!==1)throw Error(i(170));var f=u;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(cr(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(i(171))}if(u.tag===1){var v=u.type;if(cr(v))return Wn(u,v,f)}return f}function Iw(u){var f=u._reactInternals;if(f===void 0)throw typeof u.render=="function"?Error(i(188)):(u=Object.keys(u).join(","),Error(i(268,u)));return u=Y(f),u===null?null:u.stateNode}function Pw(u,f){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var v=u.retryLane;u.retryLane=v!==0&&v=Fe&&E>=nn&&k<=xt&&$<=ct){u.splice(f,1);break}else if(w!==Fe||v.width!==ge.width||ct$){if(!(E!==nn||v.height!==ge.height||xtk)){Fe>w&&(ge.width+=Fe-w,ge.x=w),xtE&&(ge.height+=nn-E,ge.y=E),ct<$&&(ge.height=$-nn),u.splice(f,1);break}}}return u},n.findHostInstance=Iw,n.findHostInstanceWithNoPortals=function(u){return u=T(u),u=u!==null?W(u):null,u===null?null:u.stateNode},n.findHostInstanceWithWarning=function(u){return Iw(u)},n.flushControlled=function(u){var f=pn;pn|=1;var v=Tr.transition,w=Ae;try{Tr.transition=null,Ae=1,u()}finally{Ae=w,Tr.transition=v,pn=f,pn===0&&(yc(),Yo())}},n.flushPassiveEffects=jl,n.flushSync=gw,n.focusWithin=function(u,f){if(!ot)throw Error(i(363));for(u=dv(u),f=pw(u,f),f=Array.from(f),u=0;uv&&(v=$)),$ ")+` No matching component was found for: `)+u.join(" > ")}return null},n.getPublicRootInstance=function(u){if(u=u.current,!u.child)return null;switch(u.child.tag){case 5:return U(u.child.stateNode);default:return u.child.stateNode}},n.injectIntoDevTools=function(u){if(u={bundleType:u.bundleType,version:u.version,rendererPackageName:u.rendererPackageName,rendererConfig:u.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:LA,findFiberByHostInstance:u.findFiberByHostInstance||zA,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")u=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)u=!0;else{try{ir=f.inject(u),Sn=f}catch{}u=!!f.checkDCE}}return u},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(u,f,v,w){if(!ot)throw Error(i(363));u=hv(u,f);var k=Ht(u,v,w).disconnect;return{disconnect:function(){k()}}},n.registerMutableSourceForHydration=function(u,f){var v=f._getVersion;v=v(f._source),u.mutableSourceEagerHydrationData==null?u.mutableSourceEagerHydrationData=[f,v]:u.mutableSourceEagerHydrationData.push(f,v)},n.runWithPriority=function(u,f){var v=Ae;try{return Ae=u,f()}finally{Ae=v}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(u,f,v,w){var k=f.current,E=mo(),$=Di(k);return v=_w(v),f.context===null?f.context=v:f.pendingContext=v,f=Ka(E,$),f.payload={element:u},w=w===void 0?null:w,w!==null&&(f.callback=w),u=Oi(k,f,$),u!==null&&(gs(u,k,$,E),tp(u,k,$)),$},n};XR.exports=Zge;var e0e=XR.exports;const t0e=hf(e0e);var YR={exports:{}},uc={};/** * @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. */uc.ConcurrentRoot=1;uc.ContinuousEventPriority=4;uc.DefaultEventPriority=16;uc.DiscreteEventPriority=1;uc.IdleEventPriority=536870912;uc.LegacyRoot=0;YR.exports=uc;var JR=YR.exports;const oI={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let sI=!1,aI=!1;const Y2=".react-konva-event",n0e=`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 `,r0e=`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 `,o0e={};function _0(e,t,n=o0e){if(!sI&&"zIndex"in t&&(console.warn(r0e),sI=!0),!aI&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(n0e),aI=!0)}for(var s in n)if(!oI[s]){var i=s.slice(0,2)==="on",c=n[s]!==t[s];if(i&&c){var d=s.substr(2).toLowerCase();d.substr(0,7)==="content"&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),e.off(d,n[s])}var p=!t.hasOwnProperty(s);p&&e.setAttr(s,void 0)}var h=t._useStrictMode,m={},g=!1;const b={};for(var s in t)if(!oI[s]){var i=s.slice(0,2)==="on",y=n[s]!==t[s];if(i&&y){var d=s.substr(2).toLowerCase();d.substr(0,7)==="content"&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),t[s]&&(b[d]=t[s])}!i&&(t[s]!==n[s]||h&&t[s]!==e.getAttr(s))&&(g=!0,m[s]=t[s])}g&&(e.setAttrs(m),bl(e));for(var d in b)e.on(d+Y2,b[d])}function bl(e){if(!i9.Konva.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const ZR={},s0e={};ff.Node.prototype._applyProps=_0;function a0e(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),bl(e)}function i0e(e,t,n){let r=ff[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=ff.Group);const o={},s={};for(var i in t){var c=i.slice(0,2)==="on";c?s[i]=t[i]:o[i]=t[i]}const d=new r(o);return _0(d,s),d}function l0e(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function c0e(e,t,n){return!1}function u0e(e){return e}function d0e(){return null}function f0e(){return null}function p0e(e,t,n,r){return s0e}function h0e(){}function m0e(e){}function g0e(e,t){return!1}function v0e(){return ZR}function b0e(){return ZR}const x0e=setTimeout,y0e=clearTimeout,C0e=-1;function w0e(e,t){return!1}const S0e=!1,k0e=!0,j0e=!0;function _0e(e,t){t.parent===e?t.moveToTop():e.add(t),bl(e)}function I0e(e,t){t.parent===e?t.moveToTop():e.add(t),bl(e)}function eA(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),bl(e)}function P0e(e,t,n){eA(e,t,n)}function E0e(e,t){t.destroy(),t.off(Y2),bl(e)}function M0e(e,t){t.destroy(),t.off(Y2),bl(e)}function O0e(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function R0e(e,t,n){}function A0e(e,t,n,r,o){_0(e,o,r)}function D0e(e){e.hide(),bl(e)}function T0e(e){}function N0e(e,t){(t.visible==null||t.visible)&&e.show()}function $0e(e,t){}function L0e(e){}function z0e(){}const F0e=()=>JR.DefaultEventPriority,B0e=Object.freeze(Object.defineProperty({__proto__:null,appendChild:_0e,appendChildToContainer:I0e,appendInitialChild:a0e,cancelTimeout:y0e,clearContainer:L0e,commitMount:R0e,commitTextUpdate:O0e,commitUpdate:A0e,createInstance:i0e,createTextInstance:l0e,detachDeletedInstance:z0e,finalizeInitialChildren:c0e,getChildHostContext:b0e,getCurrentEventPriority:F0e,getPublicInstance:u0e,getRootHostContext:v0e,hideInstance:D0e,hideTextInstance:T0e,idlePriority:Sh.unstable_IdlePriority,insertBefore:eA,insertInContainerBefore:P0e,isPrimaryRenderer:S0e,noTimeout:C0e,now:Sh.unstable_now,prepareForCommit:d0e,preparePortalMount:f0e,prepareUpdate:p0e,removeChild:E0e,removeChildFromContainer:M0e,resetAfterCommit:h0e,resetTextContent:m0e,run:Sh.unstable_runWithPriority,scheduleTimeout:x0e,shouldDeprioritizeSubtree:g0e,shouldSetTextContent:w0e,supportsMutation:j0e,unhideInstance:N0e,unhideTextInstance:$0e,warnsIfNotActing:k0e},Symbol.toStringTag,{value:"Module"}));var H0e=Object.defineProperty,W0e=Object.defineProperties,V0e=Object.getOwnPropertyDescriptors,iI=Object.getOwnPropertySymbols,U0e=Object.prototype.hasOwnProperty,G0e=Object.prototype.propertyIsEnumerable,lI=(e,t,n)=>t in e?H0e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cI=(e,t)=>{for(var n in t||(t={}))U0e.call(t,n)&&lI(e,n,t[n]);if(iI)for(var n of iI(t))G0e.call(t,n)&&lI(e,n,t[n]);return e},q0e=(e,t)=>W0e(e,V0e(t));function tA(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=tA(r,t,n);if(o)return o;r=t?null:r.sibling}}function nA(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const J2=nA(l.createContext(null));class rA extends l.Component{render(){return l.createElement(J2.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:uI,ReactCurrentDispatcher:dI}=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function K0e(){const e=l.useContext(J2);if(e===null)throw new Error("its-fine: useFiber must be called within a !");const t=l.useId();return l.useMemo(()=>{for(const r of[uI==null?void 0:uI.current,e,e==null?void 0:e.alternate]){if(!r)continue;const o=tA(r,!1,s=>{let i=s.memoizedState;for(;i;){if(i.memoizedState===t)return!0;i=i.next}});if(o)return o}},[e,t])}function Q0e(){var e,t;const n=K0e(),[r]=l.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==J2&&!r.has(s)&&r.set(s,(t=dI==null?void 0:dI.current)==null?void 0:t.readContext(nA(s))),o=o.return}return r}function X0e(){const e=Q0e();return l.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>l.createElement(t,null,l.createElement(n.Provider,q0e(cI({},r),{value:e.get(n)}))),t=>l.createElement(rA,cI({},t))),[e])}function Y0e(e){const t=B.useRef({});return B.useLayoutEffect(()=>{t.current=e}),B.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}const J0e=e=>{const t=B.useRef(),n=B.useRef(),r=B.useRef(),o=Y0e(e),s=X0e(),i=c=>{const{forwardedRef:d}=e;d&&(typeof d=="function"?d(c):d.current=c)};return B.useLayoutEffect(()=>(n.current=new ff.Stage({width:e.width,height:e.height,container:t.current}),i(n.current),r.current=Od.createContainer(n.current,JR.LegacyRoot,!1,null),Od.updateContainer(B.createElement(s,{},e.children),r.current),()=>{ff.isBrowser&&(i(null),Od.updateContainer(null,r.current,null),n.current.destroy())}),[]),B.useLayoutEffect(()=>{i(n.current),_0(n.current,e,o),Od.updateContainer(B.createElement(s,{},e.children),r.current,null)}),B.createElement("div",{ref:t,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},jd="Layer",La="Group",za="Rect",Il="Circle",rg="Line",oA="Image",Z0e="Text",eve="Transformer",Od=t0e(B0e);Od.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:B.version,rendererPackageName:"react-konva"});const tve=B.forwardRef((e,t)=>B.createElement(rA,{},B.createElement(J0e,{...e,forwardedRef:t}))),nve=de([_r,Ns],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),rve=()=>{const e=oe(),{tool:t,isStaging:n,isMovingBoundingBox:r}=H(nve);return{handleDragStart:l.useCallback(()=>{(t==="move"||n)&&!r&&e(Gh(!0))},[e,r,n,t]),handleDragMove:l.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(SP(s))},[e,r,n,t]),handleDragEnd:l.useCallback(()=>{(t==="move"||n)&&!r&&e(Gh(!1))},[e,r,n,t])}},ove=de([_r,ro,Ns],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isMaskEnabled:c,shouldSnapToGrid:d}=e;return{activeTabName:t,isCursorOnCanvas:!!r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isStaging:n,isMaskEnabled:c,shouldSnapToGrid:d}},{memoizeOptions:{resultEqualityCheck:Tn}}),sve=()=>{const e=oe(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:i}=H(ove),c=l.useRef(null),d=kP(),p=()=>e(jP());It(["shift+c"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[]);const h=()=>e(Ux(!s));It(["h"],()=>{h()},{enabled:()=>!o,preventDefault:!0},[s]),It(["n"],()=>{e(qh(!i))},{enabled:!0,preventDefault:!0},[i]),It("esc",()=>{e(l9())},{enabled:()=>!0,preventDefault:!0}),It("shift+h",()=>{e(c9(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),It(["space"],m=>{m.repeat||(d==null||d.container().focus(),r!=="move"&&(c.current=r,e(Zc("move"))),r==="move"&&c.current&&c.current!=="move"&&(e(Zc(c.current)),c.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,c])},Z2=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}},sA=()=>{const e=oe(),t=Q1(),n=kP();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=u9.pixelRatio,[s,i,c,d]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;s===void 0||i===void 0||c===void 0||d===void 0||e(d9({r:s,g:i,b:c,a:d}))},commitColorUnderCursor:()=>{e(f9())}}},ave=de([ro,_r,Ns],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),ive=e=>{const t=oe(),{tool:n,isStaging:r}=H(ave),{commitColorUnderCursor:o}=sA();return l.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Gh(!0));return}if(n==="colorPicker"){o();return}const i=Z2(e.current);i&&(s.evt.preventDefault(),t(_P(!0)),t(p9([i.x,i.y])))},[e,n,r,t,o])},lve=de([ro,_r,Ns],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),cve=(e,t,n)=>{const r=oe(),{isDrawing:o,tool:s,isStaging:i}=H(lve),{updateColorUnderCursor:c}=sA();return l.useCallback(()=>{if(!e.current)return;const d=Z2(e.current);if(d){if(r(h9(d)),n.current=d,s==="colorPicker"){c();return}!o||s==="move"||i||(t.current=!0,r(IP([d.x,d.y])))}},[t,r,o,i,n,e,s,c])},uve=()=>{const e=oe();return l.useCallback(()=>{e(m9())},[e])},dve=de([ro,_r,Ns],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),fve=(e,t)=>{const n=oe(),{tool:r,isDrawing:o,isStaging:s}=H(dve);return l.useCallback(()=>{if(r==="move"||s){n(Gh(!1));return}if(!t.current&&o&&e.current){const i=Z2(e.current);if(!i)return;n(IP([i.x,i.y]))}else t.current=!1;n(_P(!1))},[t,n,o,s,e,r])},pve=de([_r],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),hve=e=>{const t=oe(),{isMoveStageKeyHeld:n,stageScale:r}=H(pve);return l.useCallback(o=>{if(!e.current||n)return;o.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const i={x:(s.x-e.current.x())/r,y:(s.y-e.current.y())/r};let c=o.evt.deltaY;o.evt.ctrlKey&&(c=-c);const d=Bl(r*b9**c,v9,g9),p={x:s.x-i.x*d,y:s.y-i.y*d};t(x9(d)),t(SP(p))},[e,n,r,t])},mve=de(_r,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:o,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i,stageDimensions:r,stageScale:o}},{memoizeOptions:{resultEqualityCheck:Tn}}),gve=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=H(mve);return a.jsxs(La,{children:[a.jsx(za,{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}),a.jsx(za,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},vve=l.memo(gve),bve=de([_r],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),xve=()=>{const{stageScale:e,stageCoordinates:t,stageDimensions:n}=H(bve),{colorMode:r}=wi(),[o,s]=l.useState([]),[i,c]=Ks("colors",["base.800","base.200"]),d=l.useCallback(p=>p/e,[e]);return l.useLayoutEffect(()=>{const{width:p,height:h}=n,{x:m,y:g}=t,b={x1:0,y1:0,x2:p,y2:h,offset:{x:d(m),y:d(g)}},y={x:Math.ceil(d(m)/64)*64,y:Math.ceil(d(g)/64)*64},x={x1:-y.x,y1:-y.y,x2:d(p)-y.x+64,y2:d(h)-y.y+64},S={x1:Math.min(b.x1,x.x1),y1:Math.min(b.y1,x.y1),x2:Math.max(b.x2,x.x2),y2:Math.max(b.y2,x.y2)},j=S.x2-S.x1,_=S.y2-S.y1,I=Math.round(j/64)+1,P=Math.round(_/64)+1,M=hS(0,I).map(A=>a.jsx(rg,{x:S.x1+A*64,y:S.y1,points:[0,0,0,_],stroke:r==="dark"?i:c,strokeWidth:1},`x_${A}`)),R=hS(0,P).map(A=>a.jsx(rg,{x:S.x1,y:S.y1+A*64,points:[0,0,j,0],stroke:r==="dark"?i:c,strokeWidth:1},`y_${A}`));s(M.concat(R))},[e,t,n,d,r,i,c]),a.jsx(La,{children:o})},yve=l.memo(xve),Cve=de([Ce],({system:e,canvas:t})=>{const{denoiseProgress:n}=e,{boundingBox:r}=t.layerState.stagingArea,{batchIds:o}=t;return{boundingBox:r,progressImage:n&&o.includes(n.batch_id)?n.progress_image:void 0}},{memoizeOptions:{resultEqualityCheck:Tn}}),wve=e=>{const{...t}=e,{progressImage:n,boundingBox:r}=H(Cve),[o,s]=l.useState(null);return l.useEffect(()=>{if(!n)return;const i=new Image;i.onload=()=>{s(i)},i.src=n.dataURL},[n]),n&&r&&o?a.jsx(oA,{x:r.x,y:r.y,width:r.width,height:r.height,image:o,listening:!1,...t}):null},Sve=l.memo(wve),Fl=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},kve=de(_r,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:Fl(t)}}),fI=e=>`data:image/svg+xml;utf8, `.replaceAll("black",e),jve=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=H(kve),[i,c]=l.useState(null),[d,p]=l.useState(0),h=l.useRef(null),m=l.useCallback(()=>{p(d+1),setTimeout(m,500)},[d]);return l.useEffect(()=>{if(i)return;const g=new Image;g.onload=()=>{c(g)},g.src=fI(n)},[i,n]),l.useEffect(()=>{i&&(i.src=fI(n))},[i,n]),l.useEffect(()=>{const g=setInterval(()=>p(b=>(b+1)%5),50);return()=>clearInterval(g)},[]),!i||!Sc(r.x)||!Sc(r.y)||!Sc(s)||!Sc(o.width)||!Sc(o.height)?null:a.jsx(za,{ref:h,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:i,fillPatternOffsetY:Sc(d)?d:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},_ve=l.memo(jve),Ive=de([_r],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:Tn}}),Pve=e=>{const{...t}=e,{objects:n}=H(Ive);return a.jsx(La,{listening:!1,...t,children:n.filter(y9).map((r,o)=>a.jsx(rg,{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))})},Eve=l.memo(Pve);var Pl=l,Mve=function(t,n,r){const o=Pl.useRef("loading"),s=Pl.useRef(),[i,c]=Pl.useState(0),d=Pl.useRef(),p=Pl.useRef(),h=Pl.useRef();return(d.current!==t||p.current!==n||h.current!==r)&&(o.current="loading",s.current=void 0,d.current=t,p.current=n,h.current=r),Pl.useLayoutEffect(function(){if(!t)return;var m=document.createElement("img");function g(){o.current="loaded",s.current=m,c(Math.random())}function b(){o.current="failed",s.current=void 0,c(Math.random())}return m.addEventListener("load",g),m.addEventListener("error",b),n&&(m.crossOrigin=n),r&&(m.referrerPolicy=r),m.src=t,function(){m.removeEventListener("load",g),m.removeEventListener("error",b)}},[t,n,r]),[s.current,o.current]};const Ove=hf(Mve),Rve=({canvasImage:e})=>{const[t,n,r,o]=Ks("colors",["base.400","base.500","base.700","base.900"]),s=di(t,n),i=di(r,o),{t:c}=J();return a.jsxs(La,{children:[a.jsx(za,{x:e.x,y:e.y,width:e.width,height:e.height,fill:s}),a.jsx(Z0e,{x:e.x,y:e.y,width:e.width,height:e.height,align:"center",verticalAlign:"middle",fontFamily:'"Inter Variable", sans-serif',fontSize:e.width/16,fontStyle:"600",text:c("common.imageFailedToLoad"),fill:i})]})},Ave=l.memo(Rve),Dve=e=>{const{x:t,y:n,imageName:r}=e.canvasImage,{currentData:o,isError:s}=Ps(r??Os.skipToken),[i,c]=Ove((o==null?void 0:o.image_url)??"",WI.get()?"use-credentials":"anonymous");return s||c==="failed"?a.jsx(Ave,{canvasImage:e.canvasImage}):a.jsx(oA,{x:t,y:n,image:i,listening:!1})},aA=l.memo(Dve),Tve=de([_r],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:Tn}}),Nve=()=>{const{objects:e}=H(Tve);return e?a.jsx(La,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(C9(t))return a.jsx(aA,{canvasImage:t},n);if(w9(t)){const r=a.jsx(rg,{points:t.points,stroke:t.color?Fl(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?a.jsx(La,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(S9(t))return a.jsx(za,{x:t.x,y:t.y,width:t.width,height:t.height,fill:Fl(t.color)},n);if(k9(t))return a.jsx(za,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},$ve=l.memo(Nve),Lve=de([_r],e=>{const{layerState:t,shouldShowStagingImage:n,shouldShowStagingOutline:r,boundingBoxCoordinates:o,boundingBoxDimensions:s}=e,{selectedImageIndex:i,images:c,boundingBox:d}=t.stagingArea;return{currentStagingAreaImage:c.length>0&&i!==void 0?c[i]:void 0,isOnFirstImage:i===0,isOnLastImage:i===c.length-1,shouldShowStagingImage:n,shouldShowStagingOutline:r,x:(d==null?void 0:d.x)??o.x,y:(d==null?void 0:d.y)??o.y,width:(d==null?void 0:d.width)??s.width,height:(d==null?void 0:d.height)??s.height}},{memoizeOptions:{resultEqualityCheck:Tn}}),zve=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:i,width:c,height:d}=H(Lve);return a.jsxs(La,{...t,children:[r&&n&&a.jsx(aA,{canvasImage:n}),o&&a.jsxs(La,{children:[a.jsx(za,{x:s,y:i,width:c,height:d,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),a.jsx(za,{x:s,y:i,width:c,height:d,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},Fve=l.memo(zve),Bve=de([_r],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingOutline:r,shouldShowStagingImage:o}=e;return{currentIndex:n,total:t.length,currentStagingAreaImage:t.length>0?t[n]:void 0,shouldShowStagingImage:o,shouldShowStagingOutline:r}},_e),Hve=()=>{const e=oe(),{currentStagingAreaImage:t,shouldShowStagingImage:n,currentIndex:r,total:o}=H(Bve),{t:s}=J(),i=l.useCallback(()=>{e(mS(!0))},[e]),c=l.useCallback(()=>{e(mS(!1))},[e]),d=l.useCallback(()=>e(j9()),[e]),p=l.useCallback(()=>e(_9()),[e]),h=l.useCallback(()=>e(I9()),[e]);It(["left"],d,{enabled:()=>!0,preventDefault:!0}),It(["right"],p,{enabled:()=>!0,preventDefault:!0}),It(["enter"],()=>h,{enabled:()=>!0,preventDefault:!0});const{data:m}=Ps((t==null?void 0:t.imageName)??Os.skipToken),g=l.useCallback(()=>{e(P9(!n))},[e,n]),b=l.useCallback(()=>{m&&e(E9({imageDTO:m}))},[e,m]),y=l.useCallback(()=>{e(M9())},[e]);return t?a.jsxs(N,{pos:"absolute",bottom:4,gap:2,w:"100%",align:"center",justify:"center",onMouseEnter:i,onMouseLeave:c,children:[a.jsxs(zn,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(tt,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:a.jsx(KZ,{}),onClick:d,colorScheme:"accent",isDisabled:!n}),a.jsx(Rt,{colorScheme:"base",pointerEvents:"none",isDisabled:!n,minW:20,children:`${r+1}/${o}`}),a.jsx(tt,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:a.jsx(QZ,{}),onClick:p,colorScheme:"accent",isDisabled:!n})]}),a.jsxs(zn,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(tt,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:a.jsx(BM,{}),onClick:h,colorScheme:"accent"}),a.jsx(tt,{tooltip:s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"aria-label":s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"data-alert":!n,icon:n?a.jsx(lee,{}):a.jsx(iee,{}),onClick:g,colorScheme:"accent"}),a.jsx(tt,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),isDisabled:!m||!m.is_intermediate,icon:a.jsx(Qg,{}),onClick:b,colorScheme:"accent"}),a.jsx(tt,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:a.jsx(ju,{}),onClick:y,colorScheme:"error",fontSize:20})]})]}):null},Wve=l.memo(Hve),Vve=()=>{const e=H(c=>c.canvas.layerState),t=H(c=>c.canvas.boundingBoxCoordinates),n=H(c=>c.canvas.boundingBoxDimensions),r=H(c=>c.canvas.isMaskEnabled),o=H(c=>c.canvas.shouldPreserveMaskedArea),[s,i]=l.useState();return l.useEffect(()=>{i(void 0)},[e,t,n,r,o]),Dee(async()=>{const c=await O9(e,t,n,r,o);if(!c)return;const{baseImageData:d,maskImageData:p}=c,h=R9(d,p);i(h)},1e3,[e,t,n,r,o]),s},Uve={txt2img:"Text to Image",img2img:"Image to Image",inpaint:"Inpaint",outpaint:"Inpaint"},Gve=()=>{const e=Vve();return a.jsxs(Te,{children:["Mode: ",e?Uve[e]:"..."]})},qve=l.memo(Gve),Xc=e=>Math.round(e*100)/100,Kve=de([_r],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${Xc(n)}, ${Xc(r)})`}},{memoizeOptions:{resultEqualityCheck:Tn}});function Qve(){const{cursorCoordinatesString:e}=H(Kve),{t}=J();return a.jsx(Te,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const hx="var(--invokeai-colors-warning-500)",Xve=de([_r],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:i},scaledBoundingBoxDimensions:{width:c,height:d},boundingBoxCoordinates:{x:p,y:h},stageScale:m,shouldShowCanvasDebugInfo:g,layer:b,boundingBoxScaleMethod:y,shouldPreserveMaskedArea:x}=e;let C="inherit";return(y==="none"&&(s<512||i<512)||y==="manual"&&c*d<512*512)&&(C=hx),{activeLayerColor:b==="mask"?hx:"inherit",layer:b,boundingBoxColor:C,boundingBoxCoordinatesString:`(${Xc(p)}, ${Xc(h)})`,boundingBoxDimensionsString:`${s}×${i}`,scaledBoundingBoxDimensionsString:`${c}×${d}`,canvasCoordinatesString:`${Xc(r)}×${Xc(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(m*100),shouldShowCanvasDebugInfo:g,shouldShowBoundingBox:y!=="auto",shouldShowScaledBoundingBox:y!=="none",shouldPreserveMaskedArea:x}},{memoizeOptions:{resultEqualityCheck:Tn}}),Yve=()=>{const{activeLayerColor:e,layer:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:i,canvasCoordinatesString:c,canvasDimensionsString:d,canvasScaleString:p,shouldShowCanvasDebugInfo:h,shouldShowBoundingBox:m,shouldPreserveMaskedArea:g}=H(Xve),{t:b}=J();return a.jsxs(N,{sx:{flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,opacity:.65,display:"flex",fontSize:"sm",padding:1,px:2,minWidth:48,margin:1,borderRadius:"base",pointerEvents:"none",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(qve,{}),a.jsx(Te,{style:{color:e},children:`${b("unifiedCanvas.activeLayer")}: ${b(`unifiedCanvas.${t}`)}`}),a.jsx(Te,{children:`${b("unifiedCanvas.canvasScale")}: ${p}%`}),g&&a.jsxs(Te,{style:{color:hx},children:[b("unifiedCanvas.preserveMaskedArea"),": ",b("common.on")]}),m&&a.jsx(Te,{style:{color:n},children:`${b("unifiedCanvas.boundingBox")}: ${o}`}),i&&a.jsx(Te,{style:{color:n},children:`${b("unifiedCanvas.scaledBoundingBox")}: ${s}`}),h&&a.jsxs(a.Fragment,{children:[a.jsx(Te,{children:`${b("unifiedCanvas.boundingBoxPosition")}: ${r}`}),a.jsx(Te,{children:`${b("unifiedCanvas.canvasDimensions")}: ${d}`}),a.jsx(Te,{children:`${b("unifiedCanvas.canvasPosition")}: ${c}`}),a.jsx(Qve,{})]})]})},Jve=l.memo(Yve),Zve=de([Ce],({canvas:e,generation:t})=>{const{boundingBoxCoordinates:n,boundingBoxDimensions:r,stageScale:o,isDrawing:s,isTransformingBoundingBox:i,isMovingBoundingBox:c,tool:d,shouldSnapToGrid:p}=e,{aspectRatio:h}=t;return{boundingBoxCoordinates:n,boundingBoxDimensions:r,isDrawing:s,isMovingBoundingBox:c,isTransformingBoundingBox:i,stageScale:o,shouldSnapToGrid:p,tool:d,hitStrokeWidth:20/o,aspectRatio:h}},{memoizeOptions:{resultEqualityCheck:Tn}}),e1e=e=>{const{...t}=e,n=oe(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:i,isTransformingBoundingBox:c,stageScale:d,shouldSnapToGrid:p,tool:h,hitStrokeWidth:m,aspectRatio:g}=H(Zve),b=l.useRef(null),y=l.useRef(null),[x,C]=l.useState(!1);l.useEffect(()=>{var z;!b.current||!y.current||(b.current.nodes([y.current]),(z=b.current.getLayer())==null||z.batchDraw())},[]);const S=64*d;It("N",()=>{n(qh(!p))});const j=l.useCallback(z=>{if(!p){n(Av({x:Math.floor(z.target.x()),y:Math.floor(z.target.y())}));return}const W=z.target.x(),Q=z.target.y(),U=Mo(W,64),L=Mo(Q,64);z.target.x(U),z.target.y(L),n(Av({x:U,y:L}))},[n,p]),_=l.useCallback(()=>{if(!y.current)return;const z=y.current,W=z.scaleX(),Q=z.scaleY(),U=Math.round(z.width()*W),L=Math.round(z.height()*Q),ee=Math.round(z.x()),K=Math.round(z.y());if(g){const Z=Mo(U/g,64);n(Xs({width:U,height:Z}))}else n(Xs({width:U,height:L}));n(Av({x:p?_d(ee,64):ee,y:p?_d(K,64):K})),z.scaleX(1),z.scaleY(1)},[n,p,g]),I=l.useCallback((z,W,Q)=>{const U=z.x%S,L=z.y%S;return{x:_d(W.x,S)+U,y:_d(W.y,S)+L}},[S]),P=l.useCallback(()=>{n(Dv(!0))},[n]),M=l.useCallback(()=>{n(Dv(!1)),n(Tv(!1)),n(Lp(!1)),C(!1)},[n]),R=l.useCallback(()=>{n(Tv(!0))},[n]),A=l.useCallback(()=>{n(Dv(!1)),n(Tv(!1)),n(Lp(!1)),C(!1)},[n]),D=l.useCallback(()=>{C(!0)},[]),O=l.useCallback(()=>{!c&&!i&&C(!1)},[i,c]),T=l.useCallback(()=>{n(Lp(!0))},[n]),Y=l.useCallback(()=>{n(Lp(!1))},[n]);return a.jsxs(La,{...t,children:[a.jsx(za,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:T,onMouseOver:T,onMouseLeave:Y,onMouseOut:Y}),a.jsx(za,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:m,listening:!s&&h==="move",onDragStart:R,onDragEnd:A,onDragMove:j,onMouseDown:R,onMouseOut:O,onMouseOver:D,onMouseEnter:D,onMouseUp:A,onTransform:_,onTransformEnd:M,ref:y,stroke:x?"rgba(255,255,255,0.7)":"white",strokeWidth:(x?8:1)/d,width:o.width,x:r.x,y:r.y}),a.jsx(eve,{anchorCornerRadius:3,anchorDragBoundFunc:I,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:h==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&h==="move",onDragStart:R,onDragEnd:A,onMouseDown:P,onMouseUp:M,onTransformEnd:M,ref:b,rotateEnabled:!1})]})},t1e=l.memo(e1e),n1e=de(_r,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:i,layer:c,shouldShowBrush:d,isMovingBoundingBox:p,isTransformingBoundingBox:h,stageScale:m,stageDimensions:g,boundingBoxCoordinates:b,boundingBoxDimensions:y,shouldRestrictStrokesToBox:x}=e,C=x?{clipX:b.x,clipY:b.y,clipWidth:y.width,clipHeight:y.height}:{};return{cursorPosition:t,brushX:t?t.x:g.width/2,brushY:t?t.y:g.height/2,radius:n/2,colorPickerOuterRadius:gS/m,colorPickerInnerRadius:(gS-X1+1)/m,maskColorString:Fl({...o,a:.5}),brushColorString:Fl(s),colorPickerColorString:Fl(r),tool:i,layer:c,shouldShowBrush:d,shouldDrawBrushPreview:!(p||h||!t)&&d,strokeWidth:1.5/m,dotRadius:1.5/m,clip:C}},{memoizeOptions:{resultEqualityCheck:Tn}}),r1e=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:i,layer:c,shouldDrawBrushPreview:d,dotRadius:p,strokeWidth:h,brushColorString:m,colorPickerColorString:g,colorPickerInnerRadius:b,colorPickerOuterRadius:y,clip:x}=H(n1e);return d?a.jsxs(La,{listening:!1,...x,...t,children:[i==="colorPicker"?a.jsxs(a.Fragment,{children:[a.jsx(Il,{x:n,y:r,radius:y,stroke:m,strokeWidth:X1,strokeScaleEnabled:!1}),a.jsx(Il,{x:n,y:r,radius:b,stroke:g,strokeWidth:X1,strokeScaleEnabled:!1})]}):a.jsxs(a.Fragment,{children:[a.jsx(Il,{x:n,y:r,radius:o,fill:c==="mask"?s:m,globalCompositeOperation:i==="eraser"?"destination-out":"source-out"}),a.jsx(Il,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:h*2,strokeEnabled:!0,listening:!1}),a.jsx(Il,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:h,strokeEnabled:!0,listening:!1})]}),a.jsx(Il,{x:n,y:r,radius:p*2,fill:"rgba(255,255,255,0.4)",listening:!1}),a.jsx(Il,{x:n,y:r,radius:p,fill:"rgba(0,0,0,1)",listening:!1})]}):null},o1e=l.memo(r1e),s1e=de([_r,Ns],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:i,isMovingBoundingBox:c,stageDimensions:d,stageCoordinates:p,tool:h,isMovingStage:m,shouldShowIntermediates:g,shouldShowGrid:b,shouldRestrictStrokesToBox:y,shouldAntialias:x}=e;let C="none";return h==="move"||t?m?C="grabbing":C="grab":s?C=void 0:y&&!i&&(C="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||c,shouldShowBoundingBox:o,shouldShowGrid:b,stageCoordinates:p,stageCursor:C,stageDimensions:d,stageScale:r,tool:h,isStaging:t,shouldShowIntermediates:g,shouldAntialias:x}},_e),a1e=Ee(tve,{shouldForwardProp:e=>!["sx"].includes(e)}),i1e=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:i,stageScale:c,tool:d,isStaging:p,shouldShowIntermediates:h,shouldAntialias:m}=H(s1e);sve();const g=oe(),b=l.useRef(null),y=l.useRef(null),x=l.useRef(null),C=l.useCallback(z=>{A9(z),y.current=z},[]),S=l.useCallback(z=>{D9(z),x.current=z},[]),j=l.useRef({x:0,y:0}),_=l.useRef(!1),I=hve(y),P=ive(y),M=fve(y,_),R=cve(y,_,j),A=uve(),{handleDragStart:D,handleDragMove:O,handleDragEnd:T}=rve(),Y=l.useCallback(z=>z.evt.preventDefault(),[]);return l.useEffect(()=>{if(!b.current)return;const z=new ResizeObserver(U=>{for(const L of U)if(L.contentBoxSize){const{width:ee,height:K}=L.contentRect;g(vS({width:ee,height:K}))}});z.observe(b.current);const{width:W,height:Q}=b.current.getBoundingClientRect();return g(vS({width:W,height:Q})),()=>{z.disconnect()}},[g]),a.jsxs(N,{id:"canvas-container",ref:b,sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:[a.jsx(Te,{sx:{position:"absolute"},children:a.jsxs(a1e,{tabIndex:-1,ref:C,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:o.x,y:o.y,width:i.width,height:i.height,scale:{x:c,y:c},onTouchStart:P,onTouchMove:R,onTouchEnd:M,onMouseDown:P,onMouseLeave:A,onMouseMove:R,onMouseUp:M,onDragStart:D,onDragMove:O,onDragEnd:T,onContextMenu:Y,onWheel:I,draggable:(d==="move"||p)&&!t,children:[a.jsx(jd,{id:"grid",visible:r,children:a.jsx(yve,{})}),a.jsx(jd,{id:"base",ref:S,listening:!1,imageSmoothingEnabled:m,children:a.jsx($ve,{})}),a.jsxs(jd,{id:"mask",visible:e&&!p,listening:!1,children:[a.jsx(Eve,{visible:!0,listening:!1}),a.jsx(_ve,{listening:!1})]}),a.jsx(jd,{children:a.jsx(vve,{})}),a.jsxs(jd,{id:"preview",imageSmoothingEnabled:m,children:[!p&&a.jsx(o1e,{visible:d!=="move",listening:!1}),a.jsx(Fve,{visible:p}),h&&a.jsx(Sve,{}),a.jsx(t1e,{visible:n&&!p})]})]})}),a.jsx(Jve,{}),a.jsx(Wve,{})]})},l1e=l.memo(i1e);function c1e(e,t,n=250){const[r,o]=l.useState(0);return l.useEffect(()=>{const s=setTimeout(()=>{r===1&&e(),o(0)},n);return r===2&&t(),()=>clearTimeout(s)},[r,e,t,n]),()=>o(s=>s+1)}const D1={width:6,height:6,borderColor:"base.100"},u1e={".react-colorful__hue-pointer":D1,".react-colorful__saturation-pointer":D1,".react-colorful__alpha-pointer":D1,gap:2,flexDir:"column"},wh="4.2rem",d1e=e=>{const{color:t,onChange:n,withNumberInput:r,...o}=e,s=l.useCallback(p=>n({...t,r:p}),[t,n]),i=l.useCallback(p=>n({...t,g:p}),[t,n]),c=l.useCallback(p=>n({...t,b:p}),[t,n]),d=l.useCallback(p=>n({...t,a:p}),[t,n]);return a.jsxs(N,{sx:u1e,children:[a.jsx(oR,{color:t,onChange:n,style:{width:"100%"},...o}),r&&a.jsxs(N,{children:[a.jsx(ja,{value:t.r,onChange:s,min:0,max:255,step:1,label:"Red",w:wh}),a.jsx(ja,{value:t.g,onChange:i,min:0,max:255,step:1,label:"Green",w:wh}),a.jsx(ja,{value:t.b,onChange:c,min:0,max:255,step:1,label:"Blue",w:wh}),a.jsx(ja,{value:t.a,onChange:d,step:.1,min:0,max:1,label:"Alpha",w:wh,isInteger:!1})]})]})},iA=l.memo(d1e),f1e=de([_r,Ns],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:Fl(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Tn}}),p1e=()=>{const e=oe(),{t}=J(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:i}=H(f1e);It(["q"],()=>{c()},{enabled:()=>!i,preventDefault:!0},[n]),It(["shift+c"],()=>{d()},{enabled:()=>!i,preventDefault:!0},[]),It(["h"],()=>{p()},{enabled:()=>!i,preventDefault:!0},[o]);const c=l.useCallback(()=>{e(PP(n==="mask"?"base":"mask"))},[e,n]),d=l.useCallback(()=>{e(jP())},[e]),p=l.useCallback(()=>{e(Ux(!o))},[e,o]),h=l.useCallback(async()=>{e(T9())},[e]),m=l.useCallback(b=>{e(N9(b.target.checked))},[e]),g=l.useCallback(b=>{e($9(b))},[e]);return a.jsx(Uf,{triggerComponent:a.jsx(zn,{children:a.jsx(tt,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:a.jsx(QM,{}),isChecked:n==="mask",isDisabled:i})}),children:a.jsxs(N,{direction:"column",gap:2,children:[a.jsx(Io,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:p}),a.jsx(Io,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:m}),a.jsx(Te,{sx:{paddingTop:2,paddingBottom:2},children:a.jsx(iA,{color:r,onChange:g})}),a.jsx(Rt,{size:"sm",leftIcon:a.jsx(Qg,{}),onClick:h,children:"Save Mask"}),a.jsxs(Rt,{size:"sm",leftIcon:a.jsx(qo,{}),onClick:d,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},h1e=l.memo(p1e),m1e=de([Ce,ro],({canvas:e},t)=>{const{futureLayerStates:n}=e;return{canRedo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Tn}});function g1e(){const e=oe(),{canRedo:t,activeTabName:n}=H(m1e),{t:r}=J(),o=l.useCallback(()=>{e(L9())},[e]);return It(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),a.jsx(tt,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:a.jsx(Cee,{}),onClick:o,isDisabled:!t})}const v1e=()=>{const e=H(Ns),t=oe(),{t:n}=J(),r=l.useCallback(()=>t(z9()),[t]);return a.jsxs(p0,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:r,acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:a.jsx(Rt,{size:"sm",leftIcon:a.jsx(qo,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),a.jsx("br",{}),a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},b1e=l.memo(v1e),x1e=de([_r],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:c,shouldRestrictStrokesToBox:d,shouldAntialias:p}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:c,shouldRestrictStrokesToBox:d,shouldAntialias:p}},{memoizeOptions:{resultEqualityCheck:Tn}}),y1e=()=>{const e=oe(),{t}=J(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:i,shouldShowIntermediates:c,shouldSnapToGrid:d,shouldRestrictStrokesToBox:p,shouldAntialias:h}=H(x1e);It(["n"],()=>{e(qh(!d))},{enabled:!0,preventDefault:!0},[d]);const m=l.useCallback(I=>e(qh(I.target.checked)),[e]),g=l.useCallback(I=>e(F9(I.target.checked)),[e]),b=l.useCallback(I=>e(B9(I.target.checked)),[e]),y=l.useCallback(I=>e(H9(I.target.checked)),[e]),x=l.useCallback(I=>e(W9(I.target.checked)),[e]),C=l.useCallback(I=>e(V9(I.target.checked)),[e]),S=l.useCallback(I=>e(U9(I.target.checked)),[e]),j=l.useCallback(I=>e(G9(I.target.checked)),[e]),_=l.useCallback(I=>e(q9(I.target.checked)),[e]);return a.jsx(Uf,{isLazy:!1,triggerComponent:a.jsx(tt,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:a.jsx(ZM,{})}),children:a.jsxs(N,{direction:"column",gap:2,children:[a.jsx(Io,{label:t("unifiedCanvas.showIntermediates"),isChecked:c,onChange:g}),a.jsx(Io,{label:t("unifiedCanvas.showGrid"),isChecked:i,onChange:b}),a.jsx(Io,{label:t("unifiedCanvas.snapToGrid"),isChecked:d,onChange:m}),a.jsx(Io,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:y}),a.jsx(Io,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:x}),a.jsx(Io,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:C}),a.jsx(Io,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:p,onChange:S}),a.jsx(Io,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:j}),a.jsx(Io,{label:t("unifiedCanvas.antialiasing"),isChecked:h,onChange:_}),a.jsx(b1e,{})]})})},C1e=l.memo(y1e),w1e=de([Ce,Ns],({canvas:e},t)=>{const{tool:n,brushColor:r,brushSize:o}=e;return{tool:n,isStaging:t,brushColor:r,brushSize:o}},{memoizeOptions:{resultEqualityCheck:Tn}}),S1e=()=>{const e=oe(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=H(w1e),{t:s}=J();It(["b"],()=>{i()},{enabled:()=>!o,preventDefault:!0},[]),It(["e"],()=>{c()},{enabled:()=>!o,preventDefault:!0},[t]),It(["c"],()=>{d()},{enabled:()=>!o,preventDefault:!0},[t]),It(["shift+f"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),It(["delete","backspace"],()=>{h()},{enabled:()=>!o,preventDefault:!0}),It(["BracketLeft"],()=>{r-5<=5?e(zp(Math.max(r-1,1))):e(zp(Math.max(r-5,1)))},{enabled:()=>!o,preventDefault:!0},[r]),It(["BracketRight"],()=>{e(zp(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),It(["Shift+BracketLeft"],()=>{e(Nv({...n,a:Bl(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),It(["Shift+BracketRight"],()=>{e(Nv({...n,a:Bl(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const i=l.useCallback(()=>{e(Zc("brush"))},[e]),c=l.useCallback(()=>{e(Zc("eraser"))},[e]),d=l.useCallback(()=>{e(Zc("colorPicker"))},[e]),p=l.useCallback(()=>{e(K9())},[e]),h=l.useCallback(()=>{e(Q9())},[e]),m=l.useCallback(b=>{e(zp(b))},[e]),g=l.useCallback(b=>{e(Nv(b))},[e]);return a.jsxs(zn,{isAttached:!0,children:[a.jsx(tt,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:a.jsx(vee,{}),isChecked:t==="brush"&&!o,onClick:i,isDisabled:o}),a.jsx(tt,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:a.jsx(ree,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:c}),a.jsx(tt,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:a.jsx(cee,{}),isDisabled:o,onClick:p}),a.jsx(tt,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:a.jsx(Yi,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:h}),a.jsx(tt,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:a.jsx(aee,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:d}),a.jsx(Uf,{triggerComponent:a.jsx(tt,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:a.jsx(JM,{})}),children:a.jsxs(N,{minWidth:60,direction:"column",gap:4,width:"100%",children:[a.jsx(N,{gap:4,justifyContent:"space-between",children:a.jsx(Pt,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:m,sliderNumberInputProps:{max:500}})}),a.jsx(Te,{sx:{width:"100%",paddingTop:2,paddingBottom:2},children:a.jsx(iA,{withNumberInput:!0,color:n,onChange:g})})]})})]})},k1e=l.memo(S1e),j1e=de([Ce,ro],({canvas:e},t)=>{const{pastLayerStates:n}=e;return{canUndo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Tn}});function _1e(){const e=oe(),{t}=J(),{canUndo:n,activeTabName:r}=H(j1e),o=l.useCallback(()=>{e(X9())},[e]);return It(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),a.jsx(tt,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:a.jsx(Yg,{}),onClick:o,isDisabled:!n})}const I1e=de([Ce,Ns],({canvas:e},t)=>{const{tool:n,shouldCropToBoundingBoxOnSave:r,layer:o,isMaskEnabled:s}=e;return{isStaging:t,isMaskEnabled:s,tool:n,layer:o,shouldCropToBoundingBoxOnSave:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),P1e=()=>{const e=oe(),{isStaging:t,isMaskEnabled:n,layer:r,tool:o}=H(I1e),s=Q1(),{t:i}=J(),{isClipboardAPIAvailable:c}=x8(),{getUploadButtonProps:d,getUploadInputProps:p}=k2({postUploadAction:{type:"SET_CANVAS_INITIAL_IMAGE"}});It(["v"],()=>{h()},{enabled:()=>!t,preventDefault:!0},[]),It(["r"],()=>{g()},{enabled:()=>!0,preventDefault:!0},[s]),It(["shift+m"],()=>{y()},{enabled:()=>!t,preventDefault:!0},[s]),It(["shift+s"],()=>{x()},{enabled:()=>!t,preventDefault:!0},[s]),It(["meta+c","ctrl+c"],()=>{C()},{enabled:()=>!t&&c,preventDefault:!0},[s,c]),It(["shift+d"],()=>{S()},{enabled:()=>!t,preventDefault:!0},[s]);const h=l.useCallback(()=>{e(Zc("move"))},[e]),m=c1e(()=>g(!1),()=>g(!0)),g=(_=!1)=>{const I=Q1();if(!I)return;const P=I.getClientRect({skipTransform:!0});e(n$({contentRect:P,shouldScaleTo1:_}))},b=l.useCallback(()=>{e(OI())},[e]),y=l.useCallback(()=>{e(Y9())},[e]),x=l.useCallback(()=>{e(J9())},[e]),C=l.useCallback(()=>{c&&e(Z9())},[e,c]),S=l.useCallback(()=>{e(e$())},[e]),j=l.useCallback(_=>{const I=_;e(PP(I)),I==="mask"&&!n&&e(Ux(!0))},[e,n]);return a.jsxs(N,{sx:{alignItems:"center",gap:2,flexWrap:"wrap"},children:[a.jsx(Te,{w:24,children:a.jsx(Ar,{tooltip:`${i("unifiedCanvas.layer")} (Q)`,value:r,data:t$,onChange:j,disabled:t})}),a.jsx(h1e,{}),a.jsx(k1e,{}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(tt,{"aria-label":`${i("unifiedCanvas.move")} (V)`,tooltip:`${i("unifiedCanvas.move")} (V)`,icon:a.jsx(XZ,{}),isChecked:o==="move"||t,onClick:h}),a.jsx(tt,{"aria-label":`${i("unifiedCanvas.resetView")} (R)`,tooltip:`${i("unifiedCanvas.resetView")} (R)`,icon:a.jsx(eee,{}),onClick:m})]}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(tt,{"aria-label":`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:a.jsx(hee,{}),onClick:y,isDisabled:t}),a.jsx(tt,{"aria-label":`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:a.jsx(Qg,{}),onClick:x,isDisabled:t}),c&&a.jsx(tt,{"aria-label":`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:a.jsx(Hu,{}),onClick:C,isDisabled:t}),a.jsx(tt,{"aria-label":`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:a.jsx(Wu,{}),onClick:S,isDisabled:t})]}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(_1e,{}),a.jsx(g1e,{})]}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(tt,{"aria-label":`${i("common.upload")}`,tooltip:`${i("common.upload")}`,icon:a.jsx(Jg,{}),isDisabled:t,...d()}),a.jsx("input",{...p()}),a.jsx(tt,{"aria-label":`${i("unifiedCanvas.clearCanvas")}`,tooltip:`${i("unifiedCanvas.clearCanvas")}`,icon:a.jsx(qo,{}),onClick:b,colorScheme:"error",isDisabled:t})]}),a.jsx(zn,{isAttached:!0,children:a.jsx(C1e,{})})]})},E1e=l.memo(P1e),pI={id:"canvas-intial-image",actionType:"SET_CANVAS_INITIAL_IMAGE"},M1e=()=>{const{isOver:e,setNodeRef:t,active:n}=TO({id:"unifiedCanvas",data:pI});return a.jsxs(N,{layerStyle:"first",ref:t,tabIndex:-1,sx:{flexDirection:"column",alignItems:"center",gap:4,p:2,borderRadius:"base",w:"full",h:"full"},children:[a.jsx(E1e,{}),a.jsx(l1e,{}),NO(pI,n)&&a.jsx($O,{isOver:e,label:"Set Canvas Initial Image"})]})},O1e=l.memo(M1e),R1e=()=>a.jsx(O1e,{}),A1e=l.memo(R1e),D1e=[{id:"txt2img",translationKey:"common.txt2img",icon:a.jsx(zr,{as:uee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Yge,{})},{id:"img2img",translationKey:"common.img2img",icon:a.jsx(zr,{as:Ql,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(dpe,{})},{id:"unifiedCanvas",translationKey:"common.unifiedCanvas",icon:a.jsx(zr,{as:Goe,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(A1e,{})},{id:"nodes",translationKey:"common.nodes",icon:a.jsx(zr,{as:j2,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(age,{})},{id:"modelManager",translationKey:"modelManager.modelManager",icon:a.jsx(zr,{as:tee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(che,{})},{id:"queue",translationKey:"queue.queue",icon:a.jsx(zr,{as:jee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Qge,{})}],T1e=de([Ce],({config:e})=>{const{disabledTabs:t}=e;return D1e.filter(r=>!t.includes(r.id))},{memoizeOptions:{resultEqualityCheck:Tn}}),N1e=448,$1e=448,L1e=360,z1e=["modelManager","queue"],F1e=["modelManager","queue"],B1e=()=>{const e=H(r$),t=H(ro),n=H(T1e),{t:r}=J(),o=oe(),s=l.useCallback(O=>{O.target instanceof HTMLElement&&O.target.blur()},[]),i=l.useMemo(()=>n.map(O=>a.jsx(Fn,{hasArrow:!0,label:String(r(O.translationKey)),placement:"end",children:a.jsxs(xo,{onClick:s,children:[a.jsx(WP,{children:String(r(O.translationKey))}),O.icon]})},O.id)),[n,r,s]),c=l.useMemo(()=>n.map(O=>a.jsx(Ho,{children:O.content},O.id)),[n]),d=l.useCallback(O=>{const T=n[O];T&&o(ti(T.id))},[o,n]),{minSize:p,isCollapsed:h,setIsCollapsed:m,ref:g,reset:b,expand:y,collapse:x,toggle:C}=k_(N1e,"pixels"),{ref:S,minSize:j,isCollapsed:_,setIsCollapsed:I,reset:P,expand:M,collapse:R,toggle:A}=k_(L1e,"pixels");It("f",()=>{_||h?(M(),y()):(x(),R())},[o,_,h]),It(["t","o"],()=>{C()},[o]),It("g",()=>{A()},[o]);const D=N2();return a.jsxs(tc,{variant:"appTabs",defaultIndex:e,index:e,onChange:d,sx:{flexGrow:1,gap:4},isLazy:!0,children:[a.jsxs(nc,{sx:{pt:2,gap:4,flexDir:"column"},children:[i,a.jsx(ji,{})]}),a.jsxs(g0,{id:"app",autoSaveId:"app",direction:"horizontal",style:{height:"100%",width:"100%"},storage:D,units:"pixels",children:[!F1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(Zi,{order:0,id:"side",ref:g,defaultSize:p,minSize:p,onCollapse:m,collapsible:!0,children:t==="nodes"?a.jsx(tle,{}):a.jsx(Dfe,{})}),a.jsx(Zm,{onDoubleClick:b,collapsedDirection:h?"left":void 0}),a.jsx(sle,{isSidePanelCollapsed:h,sidePanelRef:g})]}),a.jsx(Zi,{id:"main",order:1,minSize:$1e,children:a.jsx(zu,{style:{height:"100%",width:"100%"},children:c})}),!z1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(Zm,{onDoubleClick:P,collapsedDirection:_?"right":void 0}),a.jsx(Zi,{id:"gallery",ref:S,order:2,defaultSize:j,minSize:j,onCollapse:I,collapsible:!0,children:a.jsx(_se,{})}),a.jsx(rle,{isGalleryCollapsed:_,galleryPanelRef:S})]})]})]})},H1e=l.memo(B1e),W1e=l.createContext(null),T1={didCatch:!1,error:null};class V1e extends l.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=T1}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,s=new Array(o),i=0;i0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}function G1e(e={}){let t;if(e.repoUrl)t=e.repoUrl;else if(e.user&&e.repo)t=`https://github.com/${e.user}/${e.repo}`;else throw new Error("You need to specify either the `repoUrl` option or both the `user` and `repo` options");const n=new URL(`${t}/issues/new`),r=["body","title","labels","template","milestone","assignee","projects"];for(const o of r){let s=e[o];if(s!==void 0){if(o==="labels"||o==="projects"){if(!Array.isArray(s))throw new TypeError(`The \`${o}\` option should be an array`);s=s.join(",")}n.searchParams.set(o,s)}}return n.toString()}const q1e=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),K1e=new Map(q1e),Q1e=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],mx=new WeakSet,X1e=e=>{mx.add(e);const t=e.toJSON();return mx.delete(e),t},Y1e=e=>K1e.get(e)??Error,lA=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:c})=>{if(!n)if(Array.isArray(e))n=[];else if(!c&&hI(e)){const p=Y1e(e.name);n=new p}else n={};if(t.push(e),s>=o)return n;if(i&&typeof e.toJSON=="function"&&!mx.has(e))return X1e(e);const d=p=>lA({from:p,seen:[...t],forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:c});for(const[p,h]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(h)){n[p]="[object Buffer]";continue}if(h!==null&&typeof h=="object"&&typeof h.pipe=="function"){n[p]="[object Stream]";continue}if(typeof h!="function"){if(!h||typeof h!="object"){n[p]=h;continue}if(!t.includes(e[p])){s++,n[p]=d(e[p]);continue}n[p]="[Circular]"}}for(const{property:p,enumerable:h}of Q1e)typeof e[p]<"u"&&e[p]!==null&&Object.defineProperty(n,p,{value:hI(e[p])?d(e[p]):e[p],enumerable:r?!0:h,configurable:!0,writable:!0});return n};function J1e(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?lA({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name??"anonymous"}]`:e}function hI(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const Z1e=({error:e,resetErrorBoundary:t})=>{const n=o$(),r=l.useCallback(()=>{const s=JSON.stringify(J1e(e),null,2);navigator.clipboard.writeText(`\`\`\` ${s} \`\`\``),n({title:"Error Copied"})},[e,n]),o=l.useMemo(()=>G1e({user:"invoke-ai",repo:"InvokeAI",template:"BUG_REPORT.yml",title:`[bug]: ${e.name}: ${e.message}`}),[e.message,e.name]);return a.jsx(N,{layerStyle:"body",sx:{w:"100vw",h:"100vh",alignItems:"center",justifyContent:"center",p:4},children:a.jsxs(N,{layerStyle:"first",sx:{flexDir:"column",borderRadius:"base",justifyContent:"center",gap:8,p:16},children:[a.jsx(vo,{children:"Something went wrong"}),a.jsx(N,{layerStyle:"second",sx:{px:8,py:4,borderRadius:"base",gap:4,justifyContent:"space-between",alignItems:"center"},children:a.jsxs(Se,{sx:{fontWeight:600,color:"error.500",_dark:{color:"error.400"}},children:[e.name,": ",e.message]})}),a.jsxs(N,{sx:{gap:4},children:[a.jsx(Rt,{leftIcon:a.jsx(zoe,{}),onClick:t,children:"Reset UI"}),a.jsx(Rt,{leftIcon:a.jsx(Hu,{}),onClick:r,children:"Copy Error"}),a.jsx(bg,{href:o,isExternal:!0,children:a.jsx(Rt,{leftIcon:a.jsx(Ky,{}),children:"Create Issue"})})]})]})})},ebe=l.memo(Z1e),tbe=de([Ce],({hotkeys:e})=>{const{shift:t,ctrl:n,meta:r}=e;return{shift:t,ctrl:n,meta:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),nbe=()=>{const e=oe(),{shift:t,ctrl:n,meta:r}=H(tbe),{queueBack:o,isDisabled:s,isLoading:i}=j8();It(["ctrl+enter","meta+enter"],o,{enabled:()=>!s&&!i,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,s,i]);const{queueFront:c,isDisabled:d,isLoading:p}=E8();return It(["ctrl+shift+enter","meta+shift+enter"],c,{enabled:()=>!d&&!p,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[c,d,p]),It("*",()=>{Oh("shift")?!t&&e(Uo(!0)):t&&e(Uo(!1)),Oh("ctrl")?!n&&e(bS(!0)):n&&e(bS(!1)),Oh("meta")?!r&&e(xS(!0)):r&&e(xS(!1))},{keyup:!0,keydown:!0},[t,n,r]),It("1",()=>{e(ti("txt2img"))}),It("2",()=>{e(ti("img2img"))}),It("3",()=>{e(ti("unifiedCanvas"))}),It("4",()=>{e(ti("nodes"))}),It("5",()=>{e(ti("modelManager"))}),null},rbe=l.memo(nbe),obe=e=>{const t=oe(),{recallAllParameters:n}=f0(),r=Zl(),{currentData:o}=Ps((e==null?void 0:e.imageName)??Os.skipToken),{currentData:s}=VI((e==null?void 0:e.imageName)??Os.skipToken),i=l.useCallback(()=>{o&&(t(qI(o)),t(ti("unifiedCanvas")),r({title:DI("toast.sentToUnifiedCanvas"),status:"info",duration:2500,isClosable:!0}))},[t,r,o]),c=l.useCallback(()=>{o&&t(ig(o))},[t,o]),d=l.useCallback(()=>{s&&n(s.metadata)},[s]);return l.useEffect(()=>{e&&e.action==="sendToCanvas"&&i()},[e,i]),l.useEffect(()=>{e&&e.action==="sendToImg2Img"&&c()},[e,c]),l.useEffect(()=>{e&&e.action==="useAllParameters"&&d()},[e,d]),{handleSendToCanvas:i,handleSendToImg2Img:c,handleUseAllMetadata:d}},sbe=e=>(obe(e.selectedImage),null),abe=l.memo(sbe),ibe={},lbe=({config:e=ibe,selectedImage:t})=>{const n=H(nO),r=q3("system"),o=oe(),s=l.useCallback(()=>(localStorage.clear(),location.reload(),!1),[]);l.useEffect(()=>{on.changeLanguage(n)},[n]),l.useEffect(()=>{iP(e)&&(r.info({config:e},"Received config"),o(s$(e)))},[o,e,r]),l.useEffect(()=>{o(a$())},[o]);const i=Bg(l$);return a.jsxs(V1e,{onReset:s,FallbackComponent:ebe,children:[a.jsx(nl,{w:"100vw",h:"100vh",position:"relative",overflow:"hidden",children:a.jsx(kG,{children:a.jsxs(nl,{sx:{gap:4,p:4,gridAutoRows:"min-content auto",w:"full",h:"full"},children:[i||a.jsx(Zee,{}),a.jsx(N,{sx:{gap:4,w:"full",h:"full"},children:a.jsx(H1e,{})})]})})}),a.jsx(FZ,{}),a.jsx(NZ,{}),a.jsx(i$,{}),a.jsx(rbe,{}),a.jsx(abe,{selectedImage:t})]})},hbe=l.memo(lbe);export{hbe as default};