import{a as Pu,b as pI,S as mI,c as hI,d as gI,e as A1,f as vI,i as D1,g as BA,h as xI,j as bI,k as HA,l as db,m as WA,n as VA,o as jw,p as yI,t as UA,q as GA,r as qA,s as KA,u as QA,v as d,w as a,x as fb,y as Rm,z as XA,A as YA,B as JA,C as ZA,P as eD,D as pb,E as tD,F as nD,G as rD,H as oD,I as CI,J as Oe,K as Lr,L as sD,M as aD,N as iD,O as Bn,Q as Ee,R as _t,T as pr,U as rt,V as ff,W as yo,X as Mr,Y as Kr,Z as ar,_ as vi,$ as il,a0 as qt,a1 as _s,a2 as Yc,a3 as xi,a4 as bi,a5 as eg,a6 as mb,a7 as pf,a8 as hr,a9 as lD,aa as H,ab as _w,ac as cD,ad as wI,ae as T1,af as mf,ag as Eu,ah as uD,ai as SI,aj as kI,ak as jI,al as Ks,am as dD,an as ce,ao as we,ap as Tn,aq as W,ar as fD,as as Iw,at as pD,au as mD,av as hD,aw as yi,ax as te,ay as gD,az as $t,aA as Gn,aB as De,aC as $,aD as xo,aE as ro,aF as je,aG as J,aH as _I,aI as vD,aJ as xD,aK as bD,aL as yD,aM as rs,aN as hb,aO as Ci,aP as Vo,aQ as hf,aR as CD,aS as wD,aT as Pw,aU as gb,aV as Se,aW as Qs,aX as SD,aY as II,aZ as PI,a_ as Ew,a$ as kD,b0 as jD,b1 as _D,b2 as wi,b3 as vb,b4 as on,b5 as ID,b6 as PD,b7 as Fa,b8 as EI,b9 as MI,ba as tg,bb as ED,bc as Mw,bd as OI,be as MD,bf as OD,bg as RD,bh as AD,bi as DD,bj as TD,bk as ND,bl as RI,bm as $D,bn as LD,bo as zD,bp as FD,bq as BD,br as fu,bs as xb,bt as HD,bu as WD,bv as VD,bw as wc,bx as UD,by as GD,bz as qD,bA as KD,bB as Ow,bC as QD,bD as XD,bE as oi,bF as AI,bG as DI,bH as ng,bI as bb,bJ as yb,bK as Ps,bL as TI,bM as YD,bN as Fl,bO as kd,bP as Rw,bQ as JD,bR as ZD,bS as e7,bT as Mp,bU as Op,bV as dd,bW as kv,bX as Md,bY as Od,bZ as Rd,b_ as Ad,b$ as Aw,c0 as Am,c1 as jv,c2 as Dm,c3 as Dw,c4 as N1,c5 as _v,c6 as $1,c7 as Iv,c8 as Tm,c9 as Tw,ca as Bl,cb as Nw,cc as Hl,cd as $w,ce as Nm,cf as gf,cg as NI,ch as t7,ci as Lw,cj as Cb,ck as $m,cl as $I,cm as Oo,cn as fd,co as Sc,cp as wb,cq as LI,cr as Rp,cs as Sb,ct as n7,cu as zI,cv as Pv,cw as rg,cx as r7,cy as FI,cz as L1,cA as z1,cB as BI,cC as o7,cD as F1,cE as s7,cF as B1,cG as a7,cH as H1,cI as i7,cJ as HI,cK as l7,cL as WI,cM as VI,cN as c7,cO as UI,cP as kb,cQ as jb,cR as _b,cS as Ib,cT as og,cU as Pb,cV as ti,cW as GI,cX as qI,cY as Eb,cZ as KI,c_ as u7,c$ as pd,d0 as di,d1 as QI,d2 as XI,d3 as zw,d4 as Mb,d5 as YI,d6 as Ob,d7 as Rb,d8 as JI,d9 as Or,da as d7,db as qr,dc as f7,dd as Mu,de as sg,df as Ab,dg as ZI,dh as eP,di as p7,dj as m7,dk as h7,dl as g7,dm as v7,dn as x7,dp as b7,dq as y7,dr as C7,ds as w7,dt as Fw,du as Db,dv as S7,dw as k7,dx as vf,dy as j7,dz as _7,dA as ag,dB as I7,dC as P7,dD as E7,dE as M7,dF as gr,dG as O7,dH as R7,dI as A7,dJ as D7,dK as T7,dL as N7,dM as Bd,dN as Bw,dO as na,dP as tP,dQ as $7,dR as Tb,dS as L7,dT as Hw,dU as z7,dV as F7,dW as B7,dX as nP,dY as H7,dZ as W7,d_ as V7,d$ as U7,e0 as G7,e1 as q7,e2 as rP,e3 as K7,e4 as Q7,e5 as Ww,e6 as X7,e7 as Y7,e8 as J7,e9 as Z7,ea as eT,eb as tT,ec as nT,ed as oP,ee as rT,ef as oT,eg as sT,eh as Vw,ei as Ap,ej as Rs,ek as aT,el as iT,em as lT,en as cT,eo as uT,ep as dT,eq as Xs,er as fT,es as pT,et as mT,eu as hT,ev as gT,ew as vT,ex as xT,ey as bT,ez as yT,eA as CT,eB as wT,eC as ST,eD as kT,eE as jT,eF as _T,eG as IT,eH as PT,eI as ET,eJ as MT,eK as OT,eL as RT,eM as AT,eN as DT,eO as TT,eP as NT,eQ as Uw,eR as Gw,eS as sP,eT as $T,eU as Us,eV as Hd,eW as Gr,eX as LT,eY as zT,eZ as aP,e_ as iP,e$ as FT,f0 as qw,f1 as BT,f2 as Kw,f3 as Qw,f4 as Xw,f5 as HT,f6 as WT,f7 as Yw,f8 as Jw,f9 as VT,fa as UT,fb as Lm,fc as GT,fd as Zw,fe as eS,ff as qT,fg as zm,fh as Fm,fi as tS,fj as KT,fk as QT,fl as lP,fm as XT,fn as YT,fo as cP,fp as JT,fq as ZT,fr as nS,fs as eN,ft as rS,fu as tN,fv as nN,fw as uP,fx as dP,fy as xf,fz as fP,fA as Ml,fB as pP,fC as oS,fD as rN,fE as oN,fF as mP,fG as sN,fH as aN,fI as iN,fJ as lN,fK as cN,fL as Nb,fM as W1,fN as sS,fO as ec,fP as uN,fQ as dN,fR as hP,fS as $b,fT as gP,fU as Lb,fV as vP,fW as fN,fX as ri,fY as pN,fZ as xP,f_ as mN,f$ as zb,g0 as bP,g1 as hN,g2 as gN,g3 as vN,g4 as xN,g5 as bN,g6 as yN,g7 as CN,g8 as Bm,g9 as jd,ga as Vc,gb as wN,gc as SN,gd as kN,ge as jN,gf as _N,gg as IN,gh as PN,gi as EN,gj as aS,gk as MN,gl as ON,gm as RN,gn as AN,go as DN,gp as TN,gq as iS,gr as NN,gs as $N,gt as LN,gu as zN,gv as FN,gw as BN,gx as HN,gy as lS,gz as WN,gA as VN,gB as UN,gC as GN,gD as qN,gE as KN,gF as QN,gG as XN,gH as YN,gI as JN,gJ as ZN,gK as e9,gL as t9,gM as bf,gN as n9,gO as r9,gP as o9,gQ as s9,gR as a9,gS as i9,gT as l9,gU as c9,gV as cS,gW as xm,gX as u9,gY as Hm,gZ as yP,g_ as Wm,g$ as d9,h0 as f9,h1 as Jc,h2 as CP,h3 as wP,h4 as Fb,h5 as p9,h6 as m9,h7 as h9,h8 as V1,h9 as SP,ha as g9,hb as v9,hc as kP,hd as x9,he as b9,hf as y9,hg as C9,hh as w9,hi as uS,hj as kc,hk as S9,hl as k9,hm as j9,hn as _9,ho as I9,hp as dS,hq as P9,hr as E9,hs as M9,ht as O9,hu as R9,hv as A9,hw as D9,hx as T9,hy as Ev,hz as Mv,hA as Ov,hB as Dp,hC as fS,hD as U1,hE as pS,hF as N9,hG as $9,hH as L9,hI as z9,hJ as jP,hK as F9,hL as B9,hM as H9,hN as W9,hO as V9,hP as U9,hQ as G9,hR as q9,hS as K9,hT as Q9,hU as X9,hV as Tp,hW as Rv,hX as Y9,hY as J9,hZ as Z9,h_ as e$,h$ as t$,i0 as n$,i1 as r$,i2 as o$,i3 as s$,i4 as a$,i5 as mS,i6 as hS,i7 as i$,i8 as l$,i9 as c$}from"./index-54a1ea80.js";import{u as _P,a as Si,b as u$,r as Ge,f as d$,g as gS,c as Xt,d as Nr}from"./MantineProvider-17a58e64.js";var f$=200;function p$(e,t,n,r){var o=-1,s=hI,i=!0,l=e.length,u=[],p=t.length;if(!l)return u;n&&(t=Pu(t,pI(n))),r?(s=gI,i=!1):t.length>=f$&&(s=A1,i=!1,t=new mI(t));e:for(;++o=120&&m.length>=120)?new mI(i&&m):void 0}m=e[0];var h=-1,g=l[0];e:for(;++h{r.has(s)&&n(o,s)})}function E$(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 IP=({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:l,strokeWidth:u,className:p,borderRadius:m,shapeRendering:h,onClick:g,selected:x})=>{const{background:y,backgroundColor:b}=s||{},C=i||y||b;return a.jsx("rect",{className:fb(["react-flow__minimap-node",{selected:x},p]),x:t,y:n,rx:m,ry:m,width:r,height:o,fill:C,stroke:l,strokeWidth:u,shapeRendering:h,onClick:g?S=>g(S,e):void 0})};IP.displayName="MiniMapNode";var M$=d.memo(IP);const O$=e=>e.nodeOrigin,R$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Av=e=>e instanceof Function?e:()=>e;function A$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=M$,onClick:i}){const l=Rm(R$,pb),u=Rm(O$),p=Av(t),m=Av(e),h=Av(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(x=>{const{x:y,y:b}=XA(x,u).positionAbsolute;return a.jsx(s,{x:y,y:b,width:x.width,height:x.height,style:x.style,selected:x.selected,className:h(x),color:p(x),borderRadius:r,strokeColor:m(x),strokeWidth:o,shapeRendering:g,onClick:i,id:x.id},x.id)})})}var D$=d.memo(A$);const T$=200,N$=150,$$=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}},L$="react-flow__minimap-desc";function PP({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:l,maskColor:u="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:m=1,position:h="bottom-right",onClick:g,onNodeClick:x,pannable:y=!1,zoomable:b=!1,ariaLabel:C="React Flow mini map",inversePan:S=!1,zoomStep:j=10,offsetScale:_=5}){const P=YA(),I=d.useRef(null),{boundingRect:M,viewBB:O,rfId:A}=Rm($$,pb),D=(e==null?void 0:e.width)??T$,R=(e==null?void 0:e.height)??N$,N=M.width/D,Y=M.height/R,F=Math.max(N,Y),V=F*D,Q=F*R,q=_*F,z=M.x-(V-M.width)/2-q,G=M.y-(Q-M.height)/2-q,T=V+q*2,B=Q+q*2,X=`${L$}-${A}`,re=d.useRef(0);re.current=F,d.useEffect(()=>{if(I.current){const K=JA(I.current),U=Z=>{const{transform:ue,d3Selection:fe,d3Zoom:ge}=P.getState();if(Z.sourceEvent.type!=="wheel"||!fe||!ge)return;const _e=-Z.sourceEvent.deltaY*(Z.sourceEvent.deltaMode===1?.05:Z.sourceEvent.deltaMode?1:.002)*j,ye=ue[2]*Math.pow(2,_e);ge.scaleTo(fe,ye)},ee=Z=>{const{transform:ue,d3Selection:fe,d3Zoom:ge,translateExtent:_e,width:ye,height:pe}=P.getState();if(Z.sourceEvent.type!=="mousemove"||!fe||!ge)return;const Te=re.current*Math.max(1,ue[2])*(S?-1:1),Ae={x:ue[0]-Z.sourceEvent.movementX*Te,y:ue[1]-Z.sourceEvent.movementY*Te},qe=[[0,0],[ye,pe]],Pt=tD.translate(Ae.x,Ae.y).scale(ue[2]),tt=ge.constrain()(Pt,qe,_e);ge.transform(fe,tt)},de=ZA().on("zoom",y?ee:null).on("zoom.wheel",b?U:null);return K.call(de),()=>{K.on("zoom",null)}}},[y,b,S,j]);const le=g?K=>{const U=nD(K);g(K,{x:U[0],y:U[1]})}:void 0,se=x?(K,U)=>{const ee=P.getState().nodeInternals.get(U);x(K,ee)}:void 0;return a.jsx(eD,{position:h,style:e,className:fb(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:D,height:R,viewBox:`${z} ${G} ${T} ${B}`,role:"img","aria-labelledby":X,ref:I,onClick:le,children:[C&&a.jsx("title",{id:X,children:C}),a.jsx(D$,{onClick:se,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${z-q},${G-q}h${T+q*2}v${B+q*2}h${-T-q*2}z M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fill:u,fillRule:"evenodd",stroke:p,strokeWidth:m,pointerEvents:"none"})]})})}PP.displayName="MiniMap";var z$=d.memo(PP),Ys;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ys||(Ys={}));function F$({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 B$({color:e,radius:t}){return a.jsx("circle",{cx:t,cy:t,r:t,fill:e})}const H$={[Ys.Dots]:"#91919a",[Ys.Lines]:"#eee",[Ys.Cross]:"#e2e2e2"},W$={[Ys.Dots]:1,[Ys.Lines]:1,[Ys.Cross]:6},V$=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function EP({id:e,variant:t=Ys.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=2,color:i,style:l,className:u}){const p=d.useRef(null),{transform:m,patternId:h}=Rm(V$,pb),g=i||H$[t],x=r||W$[t],y=t===Ys.Dots,b=t===Ys.Cross,C=Array.isArray(n)?n:[n,n],S=[C[0]*m[2]||1,C[1]*m[2]||1],j=x*m[2],_=b?[j,j]:S,P=y?[j/s,j/s]:[_[0]/s,_[1]/s];return a.jsxs("svg",{className:fb(["react-flow__background",u]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background",children:[a.jsx("pattern",{id:h+e,x:m[0]%S[0],y:m[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${P[0]},-${P[1]})`,children:y?a.jsx(B$,{color:g,radius:j/s}):a.jsx(F$,{dimensions:_,color:g,lineWidth:o})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+e})`})]})}EP.displayName="Background";var U$=d.memo(EP);const xS=(e,t,n)=>{G$(n);const r=CI(e,t);return MP[n].includes(r)},MP={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},bS=Object.keys(MP),G$=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(bS.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${bS.join("|")}`)};function q$(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var K$=q$();const OP=1/60*1e3,Q$=typeof performance<"u"?()=>performance.now():()=>Date.now(),RP=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(Q$()),OP);function X$(e){let t=[],n=[],r=0,o=!1,s=!1;const i=new WeakSet,l={schedule:(u,p=!1,m=!1)=>{const h=m&&o,g=h?t:n;return p&&i.add(u),g.indexOf(u)===-1&&(g.push(u),h&&o&&(r=t.length)),u},cancel:u=>{const p=n.indexOf(u);p!==-1&&n.splice(p,1),i.delete(u)},process:u=>{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]=X$(()=>Vd=!0),e),{}),J$=yf.reduce((e,t)=>{const n=ig[t];return e[t]=(r,o=!1,s=!1)=>(Vd||tL(),n.schedule(r,o,s)),e},{}),Z$=yf.reduce((e,t)=>(e[t]=ig[t].cancel,e),{});yf.reduce((e,t)=>(e[t]=()=>ig[t].process(Zc),e),{});const eL=e=>ig[e].process(Zc),AP=e=>{Vd=!1,Zc.delta=G1?OP:Math.max(Math.min(e-Zc.timestamp,Y$),1),Zc.timestamp=e,q1=!0,yf.forEach(eL),q1=!1,Vd&&(G1=!1,RP(AP))},tL=()=>{Vd=!0,G1=!0,q1||RP(AP)},yS=()=>Zc;function lg(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=d.Children.toArray(e.path),i=Oe((l,u)=>a.jsx(Lr,{ref:u,viewBox:t,...o,...l,children:s.length?s:a.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}function DP(e){const{theme:t}=sD(),n=aD();return d.useMemo(()=>iD(t.direction,{...n,...e}),[e,t.direction,n])}var nL=Object.defineProperty,rL=(e,t,n)=>t in e?nL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pr=(e,t,n)=>(rL(e,typeof t!="symbol"?t+"":t,n),n);function CS(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 oL=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function wS(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function SS(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var K1=typeof window<"u"?d.useLayoutEffect:d.useEffect,Vm=e=>e,sL=class{constructor(){Pr(this,"descendants",new Map),Pr(this,"register",e=>{if(e!=null)return oL(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),Pr(this,"unregister",e=>{this.descendants.delete(e);const t=CS(Array.from(this.descendants.keys()));this.assignIndex(t)}),Pr(this,"destroy",()=>{this.descendants.clear()}),Pr(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),Pr(this,"count",()=>this.descendants.size),Pr(this,"enabledCount",()=>this.enabledValues().length),Pr(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),Pr(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),Pr(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),Pr(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),Pr(this,"first",()=>this.item(0)),Pr(this,"firstEnabled",()=>this.enabledItem(0)),Pr(this,"last",()=>this.item(this.descendants.size-1)),Pr(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),Pr(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),Pr(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),Pr(this,"next",(e,t=!0)=>{const n=wS(e,this.count(),t);return this.item(n)}),Pr(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=wS(r,this.enabledCount(),t);return this.enabledItem(o)}),Pr(this,"prev",(e,t=!0)=>{const n=SS(e,this.count()-1,t);return this.item(n)}),Pr(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=SS(r,this.enabledCount()-1,t);return this.enabledItem(o)}),Pr(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=CS(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 aL(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=>{aL(n,t)})}}function iL(...e){return d.useMemo(()=>gn(...e),e)}function lL(){const e=d.useRef(new sL);return K1(()=>()=>e.current.destroy()),e.current}var[cL,TP]=Bn({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function uL(e){const t=TP(),[n,r]=d.useState(-1),o=d.useRef(null);K1(()=>()=>{o.current&&t.unregister(o.current)},[]),K1(()=>{if(!o.current)return;const i=Number(o.current.dataset.index);n!=i&&!Number.isNaN(i)&&r(i)});const s=Vm(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:gn(s,o)}}function Bb(){return[Vm(cL),()=>Vm(TP()),()=>lL(),o=>uL(o)]}var[dL,cg]=Bn({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[fL,Hb]=Bn({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[pL,mxe,mL,hL]=Bb(),Tc=Oe(function(t,n){const{getButtonProps:r}=Hb(),o=r(t,n),i={display:"flex",alignItems:"center",width:"100%",outline:0,...cg().button};return a.jsx(Ee.button,{...o,className:_t("chakra-accordion__button",t.className),__css:i})});Tc.displayName="AccordionButton";function Cf(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(g,x)=>g!==x}=e,s=pr(r),i=pr(o),[l,u]=d.useState(n),p=t!==void 0,m=p?t:l,h=pr(g=>{const y=typeof g=="function"?g(m):g;i(m,y)&&(p||u(y),s(y))},[p,s,m,i]);return[m,h]}function gL(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...i}=e;bL(e),yL(e);const l=mL(),[u,p]=d.useState(-1);d.useEffect(()=>()=>{p(-1)},[]);const[m,h]=Cf({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:m,setIndex:h,htmlProps:i,getAccordionItemProps:x=>{let y=!1;return x!==null&&(y=Array.isArray(m)?m.includes(x):m===x),{isOpen:y,onChange:C=>{if(x!==null)if(o&&Array.isArray(m)){const S=C?m.concat(x):m.filter(j=>j!==x);h(S)}else C?h(x):s&&h(-1)}}},focusedIndex:u,setFocusedIndex:p,descendants:l}}var[vL,Wb]=Bn({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function xL(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:i}=Wb(),l=d.useRef(null),u=d.useId(),p=r??u,m=`accordion-button-${p}`,h=`accordion-panel-${p}`;CL(e);const{register:g,index:x,descendants:y}=hL({disabled:t&&!n}),{isOpen:b,onChange:C}=s(x===-1?null:x);wL({isOpen:b,isDisabled:t});const S=()=>{C==null||C(!0)},j=()=>{C==null||C(!1)},_=d.useCallback(()=>{C==null||C(!b),i(x)},[x,i,b,C]),P=d.useCallback(A=>{const R={ArrowDown:()=>{const N=y.nextEnabled(x);N==null||N.node.focus()},ArrowUp:()=>{const N=y.prevEnabled(x);N==null||N.node.focus()},Home:()=>{const N=y.firstEnabled();N==null||N.node.focus()},End:()=>{const N=y.lastEnabled();N==null||N.node.focus()}}[A.key];R&&(A.preventDefault(),R(A))},[y,x]),I=d.useCallback(()=>{i(x)},[i,x]),M=d.useCallback(function(D={},R=null){return{...D,type:"button",ref:gn(g,l,R),id:m,disabled:!!t,"aria-expanded":!!b,"aria-controls":h,onClick:rt(D.onClick,_),onFocus:rt(D.onFocus,I),onKeyDown:rt(D.onKeyDown,P)}},[m,t,b,_,I,P,h,g]),O=d.useCallback(function(D={},R=null){return{...D,ref:R,role:"region",id:h,"aria-labelledby":m,hidden:!b}},[m,b,h]);return{isOpen:b,isDisabled:t,isFocusable:n,onOpen:S,onClose:j,getButtonProps:M,getPanelProps:O,htmlProps:o}}function bL(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;ff({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function yL(e){ff({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 CL(e){ff({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 wL(e){ff({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Nc(e){const{isOpen:t,isDisabled:n}=Hb(),{reduceMotion:r}=Wb(),o=_t("chakra-accordion__icon",e.className),s=cg(),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(Lr,{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"})})}Nc.displayName="AccordionIcon";var $c=Oe(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...i}=xL(t),u={...cg().container,overflowAnchor:"none"},p=d.useMemo(()=>i,[i]);return a.jsx(fL,{value:p,children:a.jsx(Ee.div,{ref:n,...s,className:_t("chakra-accordion__item",o),__css:u,children:typeof r=="function"?r({isExpanded:!!i.isOpen,isDisabled:!!i.isDisabled}):r})})});$c.displayName="AccordionItem";var Uc={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Al={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})},SL=e=>e!=null&&parseInt(e.toString(),10)>0,kS={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}}},kL={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:SL(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:si.exit(kS.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(kS.enter,o)}}},wf=d.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:i="auto",style:l,className:u,transition:p,transitionEnd:m,...h}=e,[g,x]=d.useState(!1);d.useEffect(()=>{const j=setTimeout(()=>{x(!0)});return()=>clearTimeout(j)},[]),ff({condition:Number(s)>0&&!!r,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const y=parseFloat(s.toString())>0,b={startingHeight:s,endingHeight:i,animateOpacity:o,transition:g?p:{enter:{duration:0}},transitionEnd:{enter:m==null?void 0:m.enter,exit:r?m==null?void 0:m.exit:{...m==null?void 0:m.exit,display:y?"block":"none"}}},C=r?n:!0,S=n||r?"enter":"exit";return a.jsx(yo,{initial:!1,custom:b,children:C&&a.jsx(Mr.div,{ref:t,...h,className:_t("chakra-collapse",u),style:{overflow:"hidden",display:"block",...l},custom:b,variants:kL,initial:r?"exit":!1,animate:S,exit:"exit"})})});wf.displayName="Collapse";var jL={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:si.enter(Al.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(Al.exit,n),transitionEnd:t==null?void 0:t.exit}}},NP={initial:"exit",animate:"enter",exit:"exit",variants:jL},_L=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:i,transitionEnd:l,delay:u,...p}=t,m=o||r?"enter":"exit",h=r?o&&r:!0,g={transition:i,transitionEnd:l,delay:u};return a.jsx(yo,{custom:g,children:h&&a.jsx(Mr.div,{ref:n,className:_t("chakra-fade",s),custom:g,...NP,animate:m,...p})})});_L.displayName="Fade";var IL={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(Al.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(Al.enter,n),transitionEnd:e==null?void 0:e.enter}}},$P={initial:"exit",animate:"enter",exit:"exit",variants:IL},PL=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:i=.95,className:l,transition:u,transitionEnd:p,delay:m,...h}=t,g=r?o&&r:!0,x=o||r?"enter":"exit",y={initialScale:i,reverse:s,transition:u,transitionEnd:p,delay:m};return a.jsx(yo,{custom:y,children:g&&a.jsx(Mr.div,{ref:n,className:_t("chakra-offset-slide",l),...$P,animate:x,custom:y,...h})})});PL.displayName="ScaleFade";var EL={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(Al.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(Al.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 l={x:t,y:e};return{opacity:0,transition:(i=n==null?void 0:n.exit)!=null?i:si.exit(Al.exit,s),...o?{...l,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...l,...r==null?void 0:r.exit}}}}},Q1={initial:"initial",animate:"enter",exit:"exit",variants:EL},ML=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:i,offsetX:l=0,offsetY:u=8,transition:p,transitionEnd:m,delay:h,...g}=t,x=r?o&&r:!0,y=o||r?"enter":"exit",b={offsetX:l,offsetY:u,reverse:s,transition:p,transitionEnd:m,delay:h};return a.jsx(yo,{custom:b,children:x&&a.jsx(Mr.div,{ref:n,className:_t("chakra-offset-slide",i),custom:b,...Q1,animate:y,...g})})});ML.displayName="SlideFade";var Lc=Oe(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:i}=Wb(),{getPanelProps:l,isOpen:u}=Hb(),p=l(s,n),m=_t("chakra-accordion__panel",r),h=cg();i||delete p.hidden;const g=a.jsx(Ee.div,{...p,__css:h.panel,className:m});return i?g:a.jsx(wf,{in:u,...o,children:g})});Lc.displayName="AccordionPanel";var LP=Oe(function({children:t,reduceMotion:n,...r},o){const s=Kr("Accordion",r),i=ar(r),{htmlProps:l,descendants:u,...p}=gL(i),m=d.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return a.jsx(pL,{value:u,children:a.jsx(vL,{value:m,children:a.jsx(dL,{value:s,children:a.jsx(Ee.div,{ref:o,...l,className:_t("chakra-accordion",r.className),__css:s.root,children:t})})})})});LP.displayName="Accordion";function ug(e){return d.Children.toArray(e).filter(t=>d.isValidElement(t))}var[OL,RL]=Bn({strict:!1,name:"ButtonGroupContext"}),AL={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}}},DL={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:l="0.5rem",isAttached:u,isDisabled:p,orientation:m="horizontal",...h}=t,g=_t("chakra-button__group",i),x=d.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let y={display:"inline-flex",...u?AL[m]:DL[m](l)};const b=m==="vertical";return a.jsx(OL,{value:x,children:a.jsx(Ee.div,{ref:n,role:"group",__css:y,className:g,"data-attached":u?"":void 0,"data-orientation":m,flexDir:b?"column":void 0,...h})})});zn.displayName="ButtonGroup";function TL(e){const[t,n]=d.useState(!e);return{ref:d.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function X1(e){const{children:t,className:n,...r}=e,o=d.isValidElement(t)?d.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=_t("chakra-button__icon",n);return a.jsx(Ee.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}X1.displayName="ButtonIcon";function Y1(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=a.jsx(vi,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:i,...l}=e,u=_t("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",m=d.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:u,...l,__css:m,children:o})}Y1.displayName="ButtonSpinner";var el=Oe((e,t)=>{const n=RL(),r=il("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:i,children:l,leftIcon:u,rightIcon:p,loadingText:m,iconSpacing:h="0.5rem",type:g,spinner:x,spinnerPlacement:y="start",className:b,as:C,...S}=ar(e),j=d.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:P}=TL(C),I={rightIcon:p,leftIcon:u,iconSpacing:h,children:l};return a.jsxs(Ee.button,{ref:iL(t,_),as:C,type:g??P,"data-active":qt(i),"data-loading":qt(s),__css:j,className:_t("chakra-button",b),...S,disabled:o||s,children:[s&&y==="start"&&a.jsx(Y1,{className:"chakra-button__spinner--start",label:m,placement:"start",spacing:h,children:x}),s?m||a.jsx(Ee.span,{opacity:0,children:a.jsx(jS,{...I})}):a.jsx(jS,{...I}),s&&y==="end"&&a.jsx(Y1,{className:"chakra-button__spinner--end",label:m,placement:"end",spacing:h,children:x})]})});el.displayName="Button";function jS(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return a.jsxs(a.Fragment,{children:[t&&a.jsx(X1,{marginEnd:o,children:t}),r,n&&a.jsx(X1,{marginStart:o,children:n})]})}var Pa=Oe((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...i}=e,l=n||r,u=d.isValidElement(l)?d.cloneElement(l,{"aria-hidden":!0,focusable:!1}):null;return a.jsx(el,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...i,children:u})});Pa.displayName="IconButton";var[hxe,NL]=Bn({name:"CheckboxGroupContext",strict:!1});function $L(e){const[t,n]=d.useState(e),[r,o]=d.useState(!1);return e!==t&&(o(!0),n(e)),r}function LL(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 zL(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 FL(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?zL:LL;return n||t?a.jsx(Ee.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:a.jsx(o,{...r})}):null}var[BL,zP]=Bn({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[HL,Sf]=Bn({strict:!1,name:"FormControlContext"});function WL(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...i}=e,l=d.useId(),u=t||`field-${l}`,p=`${u}-label`,m=`${u}-feedback`,h=`${u}-helptext`,[g,x]=d.useState(!1),[y,b]=d.useState(!1),[C,S]=d.useState(!1),j=d.useCallback((O={},A=null)=>({id:h,...O,ref:gn(A,D=>{D&&b(!0)})}),[h]),_=d.useCallback((O={},A=null)=>({...O,ref:A,"data-focus":qt(C),"data-disabled":qt(o),"data-invalid":qt(r),"data-readonly":qt(s),id:O.id!==void 0?O.id:p,htmlFor:O.htmlFor!==void 0?O.htmlFor:u}),[u,o,C,r,s,p]),P=d.useCallback((O={},A=null)=>({id:m,...O,ref:gn(A,D=>{D&&x(!0)}),"aria-live":"polite"}),[m]),I=d.useCallback((O={},A=null)=>({...O,...i,ref:A,role:"group"}),[i]),M=d.useCallback((O={},A=null)=>({...O,ref:A,role:"presentation","aria-hidden":!0,children:O.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!C,onFocus:()=>S(!0),onBlur:()=>S(!1),hasFeedbackText:g,setHasFeedbackText:x,hasHelpText:y,setHasHelpText:b,id:u,labelId:p,feedbackId:m,helpTextId:h,htmlProps:i,getHelpTextProps:j,getErrorMessageProps:P,getRootProps:I,getLabelProps:_,getRequiredIndicatorProps:M}}var Kn=Oe(function(t,n){const r=Kr("Form",t),o=ar(t),{getRootProps:s,htmlProps:i,...l}=WL(o),u=_t("chakra-form-control",t.className);return a.jsx(HL,{value:l,children:a.jsx(BL,{value:r,children:a.jsx(Ee.div,{...s({},n),className:u,__css:r.container})})})});Kn.displayName="FormControl";var FP=Oe(function(t,n){const r=Sf(),o=zP(),s=_t("chakra-form__helper-text",t.className);return a.jsx(Ee.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});FP.displayName="FormHelperText";var Rr=Oe(function(t,n){var r;const o=il("FormLabel",t),s=ar(t),{className:i,children:l,requiredIndicator:u=a.jsx(BP,{}),optionalIndicator:p=null,...m}=s,h=Sf(),g=(r=h==null?void 0:h.getLabelProps(m,n))!=null?r:{ref:n,...m};return a.jsxs(Ee.label,{...g,className:_t("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[l,h!=null&&h.isRequired?u:p]})});Rr.displayName="FormLabel";var BP=Oe(function(t,n){const r=Sf(),o=zP();if(!(r!=null&&r.isRequired))return null;const s=_t("chakra-form__required-indicator",t.className);return a.jsx(Ee.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});BP.displayName="RequiredIndicator";function Vb(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=Ub(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":_s(n),"aria-required":_s(o),"aria-readonly":_s(r)}}function Ub(e){var t,n,r;const o=Sf(),{id:s,disabled:i,readOnly:l,required:u,isRequired:p,isInvalid:m,isReadOnly:h,isDisabled:g,onFocus:x,onBlur:y,...b}=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),{...b,"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=l??h)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=u??p)!=null?r:o==null?void 0:o.isRequired,isInvalid:m??(o==null?void 0:o.isInvalid),onFocus:rt(o==null?void 0:o.onFocus,x),onBlur:rt(o==null?void 0:o.onBlur,y)}}var Gb={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},HP=Ee("span",{baseStyle:Gb});HP.displayName="VisuallyHidden";var VL=Ee("input",{baseStyle:Gb});VL.displayName="VisuallyHiddenInput";const UL=()=>typeof document<"u";let _S=!1,kf=null,Wl=!1,J1=!1;const Z1=new Set;function qb(e,t){Z1.forEach(n=>n(e,t))}const GL=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function qL(e){return!(e.metaKey||!GL&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function IS(e){Wl=!0,qL(e)&&(kf="keyboard",qb("keyboard",e))}function jc(e){if(kf="pointer",e.type==="mousedown"||e.type==="pointerdown"){Wl=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;qb("pointer",e)}}function KL(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function QL(e){KL(e)&&(Wl=!0,kf="virtual")}function XL(e){e.target===window||e.target===document||(!Wl&&!J1&&(kf="virtual",qb("virtual",e)),Wl=!1,J1=!1)}function YL(){Wl=!1,J1=!0}function PS(){return kf!=="pointer"}function JL(){if(!UL()||_S)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Wl=!0,e.apply(this,n)},document.addEventListener("keydown",IS,!0),document.addEventListener("keyup",IS,!0),document.addEventListener("click",QL,!0),window.addEventListener("focus",XL,!0),window.addEventListener("blur",YL,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",jc,!0),document.addEventListener("pointermove",jc,!0),document.addEventListener("pointerup",jc,!0)):(document.addEventListener("mousedown",jc,!0),document.addEventListener("mousemove",jc,!0),document.addEventListener("mouseup",jc,!0)),_S=!0}function WP(e){JL(),e(PS());const t=()=>e(PS());return Z1.add(t),()=>{Z1.delete(t)}}function ZL(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function VP(e={}){const t=Ub(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:i,onBlur:l,onFocus:u,"aria-describedby":p}=t,{defaultChecked:m,isChecked:h,isFocusable:g,onChange:x,isIndeterminate:y,name:b,value:C,tabIndex:S=void 0,"aria-label":j,"aria-labelledby":_,"aria-invalid":P,...I}=e,M=ZL(I,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),O=pr(x),A=pr(l),D=pr(u),[R,N]=d.useState(!1),[Y,F]=d.useState(!1),[V,Q]=d.useState(!1),[q,z]=d.useState(!1);d.useEffect(()=>WP(N),[]);const G=d.useRef(null),[T,B]=d.useState(!0),[X,re]=d.useState(!!m),le=h!==void 0,se=le?h:X,K=d.useCallback(pe=>{if(r||n){pe.preventDefault();return}le||re(se?pe.target.checked:y?!0:pe.target.checked),O==null||O(pe)},[r,n,se,le,y,O]);Yc(()=>{G.current&&(G.current.indeterminate=!!y)},[y]),xi(()=>{n&&F(!1)},[n,F]),Yc(()=>{const pe=G.current;if(!(pe!=null&&pe.form))return;const Te=()=>{re(!!m)};return pe.form.addEventListener("reset",Te),()=>{var Ae;return(Ae=pe.form)==null?void 0:Ae.removeEventListener("reset",Te)}},[]);const U=n&&!g,ee=d.useCallback(pe=>{pe.key===" "&&z(!0)},[z]),de=d.useCallback(pe=>{pe.key===" "&&z(!1)},[z]);Yc(()=>{if(!G.current)return;G.current.checked!==se&&re(G.current.checked)},[G.current]);const Z=d.useCallback((pe={},Te=null)=>{const Ae=qe=>{Y&&qe.preventDefault(),z(!0)};return{...pe,ref:Te,"data-active":qt(q),"data-hover":qt(V),"data-checked":qt(se),"data-focus":qt(Y),"data-focus-visible":qt(Y&&R),"data-indeterminate":qt(y),"data-disabled":qt(n),"data-invalid":qt(s),"data-readonly":qt(r),"aria-hidden":!0,onMouseDown:rt(pe.onMouseDown,Ae),onMouseUp:rt(pe.onMouseUp,()=>z(!1)),onMouseEnter:rt(pe.onMouseEnter,()=>Q(!0)),onMouseLeave:rt(pe.onMouseLeave,()=>Q(!1))}},[q,se,n,Y,R,V,y,s,r]),ue=d.useCallback((pe={},Te=null)=>({...pe,ref:Te,"data-active":qt(q),"data-hover":qt(V),"data-checked":qt(se),"data-focus":qt(Y),"data-focus-visible":qt(Y&&R),"data-indeterminate":qt(y),"data-disabled":qt(n),"data-invalid":qt(s),"data-readonly":qt(r)}),[q,se,n,Y,R,V,y,s,r]),fe=d.useCallback((pe={},Te=null)=>({...M,...pe,ref:gn(Te,Ae=>{Ae&&B(Ae.tagName==="LABEL")}),onClick:rt(pe.onClick,()=>{var Ae;T||((Ae=G.current)==null||Ae.click(),requestAnimationFrame(()=>{var qe;(qe=G.current)==null||qe.focus({preventScroll:!0})}))}),"data-disabled":qt(n),"data-checked":qt(se),"data-invalid":qt(s)}),[M,n,se,s,T]),ge=d.useCallback((pe={},Te=null)=>({...pe,ref:gn(G,Te),type:"checkbox",name:b,value:C,id:i,tabIndex:S,onChange:rt(pe.onChange,K),onBlur:rt(pe.onBlur,A,()=>F(!1)),onFocus:rt(pe.onFocus,D,()=>F(!0)),onKeyDown:rt(pe.onKeyDown,ee),onKeyUp:rt(pe.onKeyUp,de),required:o,checked:se,disabled:U,readOnly:r,"aria-label":j,"aria-labelledby":_,"aria-invalid":P?!!P:s,"aria-describedby":p,"aria-disabled":n,style:Gb}),[b,C,i,K,A,D,ee,de,o,se,U,r,j,_,P,s,p,n,S]),_e=d.useCallback((pe={},Te=null)=>({...pe,ref:Te,onMouseDown:rt(pe.onMouseDown,ez),"data-disabled":qt(n),"data-checked":qt(se),"data-invalid":qt(s)}),[se,n,s]);return{state:{isInvalid:s,isFocused:Y,isChecked:se,isActive:q,isHovered:V,isIndeterminate:y,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:fe,getCheckboxProps:Z,getIndicatorProps:ue,getInputProps:ge,getLabelProps:_e,htmlProps:M}}function ez(e){e.preventDefault(),e.stopPropagation()}var tz={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},nz={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},rz=bi({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),oz=bi({from:{opacity:0},to:{opacity:1}}),sz=bi({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),jf=Oe(function(t,n){const r=NL(),o={...r,...t},s=Kr("Checkbox",o),i=ar(t),{spacing:l="0.5rem",className:u,children:p,iconColor:m,iconSize:h,icon:g=a.jsx(FL,{}),isChecked:x,isDisabled:y=r==null?void 0:r.isDisabled,onChange:b,inputProps:C,...S}=i;let j=x;r!=null&&r.value&&i.value&&(j=r.value.includes(i.value));let _=b;r!=null&&r.onChange&&i.value&&(_=eg(r.onChange,b));const{state:P,getInputProps:I,getCheckboxProps:M,getLabelProps:O,getRootProps:A}=VP({...S,isDisabled:y,isChecked:j,onChange:_}),D=$L(P.isChecked),R=d.useMemo(()=>({animation:D?P.isIndeterminate?`${oz} 20ms linear, ${sz} 200ms linear`:`${rz} 200ms linear`:void 0,fontSize:h,color:m,...s.icon}),[m,h,D,P.isIndeterminate,s.icon]),N=d.cloneElement(g,{__css:R,isIndeterminate:P.isIndeterminate,isChecked:P.isChecked});return a.jsxs(Ee.label,{__css:{...nz,...s.container},className:_t("chakra-checkbox",u),...A(),children:[a.jsx("input",{className:"chakra-checkbox__input",...I(C,n)}),a.jsx(Ee.span,{__css:{...tz,...s.control},className:"chakra-checkbox__control",...M(),children:N}),p&&a.jsx(Ee.span,{className:"chakra-checkbox__label",...O(),__css:{marginStart:l,...s.label},children:p})]})});jf.displayName="Checkbox";function az(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function Kb(e,t){let n=az(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function ex(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 Um(e,t,n){return(e-t)*100/(n-t)}function UP(e,t,n){return(n-t)*e+t}function tx(e,t,n){const r=Math.round((e-t)/n)*n+t,o=ex(n);return Kb(r,o)}function eu(e,t,n){return e==null?e:(n{var R;return r==null?"":(R=Dv(r,s,n))!=null?R:""}),g=typeof o<"u",x=g?o:m,y=GP(Fi(x),s),b=n??y,C=d.useCallback(R=>{R!==x&&(g||h(R.toString()),p==null||p(R.toString(),Fi(R)))},[p,g,x]),S=d.useCallback(R=>{let N=R;return u&&(N=eu(N,i,l)),Kb(N,b)},[b,u,l,i]),j=d.useCallback((R=s)=>{let N;x===""?N=Fi(R):N=Fi(x)+R,N=S(N),C(N)},[S,s,C,x]),_=d.useCallback((R=s)=>{let N;x===""?N=Fi(-R):N=Fi(x)-R,N=S(N),C(N)},[S,s,C,x]),P=d.useCallback(()=>{var R;let N;r==null?N="":N=(R=Dv(r,s,n))!=null?R:i,C(N)},[r,n,s,C,i]),I=d.useCallback(R=>{var N;const Y=(N=Dv(R,s,b))!=null?N:i;C(Y)},[b,s,C,i]),M=Fi(x);return{isOutOfRange:M>l||M" `}),[cz,Qb]=Bn({name:"EditableContext",errorMessage:"useEditableContext: context is undefined. Seems you forgot to wrap the editable components in ``"}),KP={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent"},dg=Oe(function(t,n){const{getInputProps:r}=Qb(),o=qP(),s=r(t,n),i=_t("chakra-editable__input",t.className);return a.jsx(Ee.input,{...s,__css:{outline:0,...KP,...o.input},className:i})});dg.displayName="EditableInput";var fg=Oe(function(t,n){const{getPreviewProps:r}=Qb(),o=qP(),s=r(t,n),i=_t("chakra-editable__preview",t.className);return a.jsx(Ee.span,{...s,__css:{cursor:"text",display:"inline-block",...KP,...o.preview},className:i})});fg.displayName="EditablePreview";function Dl(e,t,n,r){const o=pr(n);return d.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 uz(e){return"current"in e}var QP=()=>typeof window<"u";function dz(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var fz=e=>QP()&&e.test(navigator.vendor),pz=e=>QP()&&e.test(dz()),mz=()=>pz(/mac|iphone|ipad|ipod/i),hz=()=>mz()&&fz(/apple/i);function XP(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};Dl(o,"pointerdown",s=>{if(!hz()||!r)return;const i=s.target,u=(n??[t]).some(p=>{const m=uz(p)?p.current:p;return(m==null?void 0:m.contains(i))||m===i});o().activeElement!==i&&u&&(s.preventDefault(),i.focus())})}function ES(e,t){return e?e===t||e.contains(t):!1}function gz(e={}){const{onChange:t,onCancel:n,onSubmit:r,onBlur:o,value:s,isDisabled:i,defaultValue:l,startWithEditView:u,isPreviewFocusable:p=!0,submitOnBlur:m=!0,selectAllOnFocus:h=!0,placeholder:g,onEdit:x,finalFocusRef:y,...b}=e,C=pr(x),S=!!(u&&!i),[j,_]=d.useState(S),[P,I]=Cf({defaultValue:l||"",value:s,onChange:t}),[M,O]=d.useState(P),A=d.useRef(null),D=d.useRef(null),R=d.useRef(null),N=d.useRef(null),Y=d.useRef(null);XP({ref:A,enabled:j,elements:[N,Y]});const F=!j&&!i;Yc(()=>{var Z,ue;j&&((Z=A.current)==null||Z.focus(),h&&((ue=A.current)==null||ue.select()))},[]),xi(()=>{var Z,ue,fe,ge;if(!j){y?(Z=y.current)==null||Z.focus():(ue=R.current)==null||ue.focus();return}(fe=A.current)==null||fe.focus(),h&&((ge=A.current)==null||ge.select()),C==null||C()},[j,C,h]);const V=d.useCallback(()=>{F&&_(!0)},[F]),Q=d.useCallback(()=>{O(P)},[P]),q=d.useCallback(()=>{_(!1),I(M),n==null||n(M),o==null||o(M)},[n,o,I,M]),z=d.useCallback(()=>{_(!1),O(P),r==null||r(P),o==null||o(M)},[P,r,o,M]);d.useEffect(()=>{if(j)return;const Z=A.current;(Z==null?void 0:Z.ownerDocument.activeElement)===Z&&(Z==null||Z.blur())},[j]);const G=d.useCallback(Z=>{I(Z.currentTarget.value)},[I]),T=d.useCallback(Z=>{const ue=Z.key,ge={Escape:q,Enter:_e=>{!_e.shiftKey&&!_e.metaKey&&z()}}[ue];ge&&(Z.preventDefault(),ge(Z))},[q,z]),B=d.useCallback(Z=>{const ue=Z.key,ge={Escape:q}[ue];ge&&(Z.preventDefault(),ge(Z))},[q]),X=P.length===0,re=d.useCallback(Z=>{var ue;if(!j)return;const fe=Z.currentTarget.ownerDocument,ge=(ue=Z.relatedTarget)!=null?ue:fe.activeElement,_e=ES(N.current,ge),ye=ES(Y.current,ge);!_e&&!ye&&(m?z():q())},[m,z,q,j]),le=d.useCallback((Z={},ue=null)=>{const fe=F&&p?0:void 0;return{...Z,ref:gn(ue,D),children:X?g:P,hidden:j,"aria-disabled":_s(i),tabIndex:fe,onFocus:rt(Z.onFocus,V,Q)}},[i,j,F,p,X,V,Q,g,P]),se=d.useCallback((Z={},ue=null)=>({...Z,hidden:!j,placeholder:g,ref:gn(ue,A),disabled:i,"aria-disabled":_s(i),value:P,onBlur:rt(Z.onBlur,re),onChange:rt(Z.onChange,G),onKeyDown:rt(Z.onKeyDown,T),onFocus:rt(Z.onFocus,Q)}),[i,j,re,G,T,Q,g,P]),K=d.useCallback((Z={},ue=null)=>({...Z,hidden:!j,placeholder:g,ref:gn(ue,A),disabled:i,"aria-disabled":_s(i),value:P,onBlur:rt(Z.onBlur,re),onChange:rt(Z.onChange,G),onKeyDown:rt(Z.onKeyDown,B),onFocus:rt(Z.onFocus,Q)}),[i,j,re,G,B,Q,g,P]),U=d.useCallback((Z={},ue=null)=>({"aria-label":"Edit",...Z,type:"button",onClick:rt(Z.onClick,V),ref:gn(ue,R),disabled:i}),[V,i]),ee=d.useCallback((Z={},ue=null)=>({...Z,"aria-label":"Submit",ref:gn(Y,ue),type:"button",onClick:rt(Z.onClick,z),disabled:i}),[z,i]),de=d.useCallback((Z={},ue=null)=>({"aria-label":"Cancel",id:"cancel",...Z,ref:gn(N,ue),type:"button",onClick:rt(Z.onClick,q),disabled:i}),[q,i]);return{isEditing:j,isDisabled:i,isValueEmpty:X,value:P,onEdit:V,onCancel:q,onSubmit:z,getPreviewProps:le,getInputProps:se,getTextareaProps:K,getEditButtonProps:U,getSubmitButtonProps:ee,getCancelButtonProps:de,htmlProps:b}}var pg=Oe(function(t,n){const r=Kr("Editable",t),o=ar(t),{htmlProps:s,...i}=gz(o),{isEditing:l,onSubmit:u,onCancel:p,onEdit:m}=i,h=_t("chakra-editable",t.className),g=mb(t.children,{isEditing:l,onSubmit:u,onCancel:p,onEdit:m});return a.jsx(cz,{value:i,children:a.jsx(lz,{value:r,children:a.jsx(Ee.div,{ref:n,...s,className:h,children:g})})})});pg.displayName="Editable";function YP(){const{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}=Qb();return{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}}var JP={exports:{}},vz="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",xz=vz,bz=xz;function ZP(){}function e3(){}e3.resetWarningCache=ZP;var yz=function(){function e(r,o,s,i,l,u){if(u!==bz){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:e3,resetWarningCache:ZP};return n.PropTypes=n,n};JP.exports=yz();var Cz=JP.exports;const Zn=pf(Cz);var nx="data-focus-lock",t3="data-focus-lock-disabled",wz="data-no-focus-lock",Sz="data-autofocus-inside",kz="data-no-autofocus";function jz(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function _z(e,t){var n=d.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 n3(e,t){return _z(t||null,function(n){return e.forEach(function(r){return jz(r,n)})})}var Tv={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},ka=function(){return ka=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(l){i={error:l}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function rx(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(Fz)},Bz=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],Zb=Bz.join(","),Hz="".concat(Zb,", [data-focus-guard]"),y3=function(e,t){return Ba((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?Hz:Zb)?[r]:[],y3(r))},[])},Wz=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=y3(r,t),i=(o=[]).concat.apply(o,s.map(function(l){return Wz(l,t)}));return n.concat(i,r.parentNode?Ba(r.parentNode.querySelectorAll(Zb)).filter(function(l){return l===r}):[])},[])},Vz=function(e){var t=e.querySelectorAll("[".concat(Sz,"]"));return Ba(t).map(function(n){return mg([n])}).reduce(function(n,r){return n.concat(r)},[])},ey=function(e,t){return Ba(e).filter(function(n){return m3(t,n)}).filter(function(n){return $z(n)})},OS=function(e,t){return t===void 0&&(t=new Map),Ba(e).filter(function(n){return h3(t,n)})},sx=function(e,t,n){return b3(ey(mg(e,n),t),!0,n)},RS=function(e,t){return b3(ey(mg(e),t),!1)},Uz=function(e,t){return ey(Vz(e),t)},tu=function(e,t){return e.shadowRoot?tu(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?tu(o,t):!1}return tu(n,t)})},Gz=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,l){return!t.has(l)})},C3=function(e){return e.parentNode?C3(e.parentNode):e},ty=function(e){var t=Gm(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(nx);return n.push.apply(n,o?Gz(Ba(C3(r).querySelectorAll("[".concat(nx,'="').concat(o,'"]:not([').concat(t3,'="disabled"])')))):[r]),n},[])},qz=function(e){try{return e()}catch{return}},Ud=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Ud(t.shadowRoot):t instanceof HTMLIFrameElement&&qz(function(){return t.contentWindow.document})?Ud(t.contentWindow.document):t}},Kz=function(e,t){return e===t},Qz=function(e,t){return!!Ba(e.querySelectorAll("iframe")).some(function(n){return Kz(n,t)})},w3=function(e,t){return t===void 0&&(t=Ud(d3(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:ty(e).some(function(n){return tu(n,t)||Qz(n,t)})},Xz=function(e){e===void 0&&(e=document);var t=Ud(e);return t?Ba(e.querySelectorAll("[".concat(wz,"]"))).some(function(n){return tu(n,t)}):!1},Yz=function(e,t){return t.filter(x3).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},ny=function(e,t){return x3(e)&&e.name?Yz(e,t):e},Jz=function(e){var t=new Set;return e.forEach(function(n){return t.add(ny(n,e))}),e.filter(function(n){return t.has(n)})},AS=function(e){return e[0]&&e.length>1?ny(e[0],e):e[0]},DS=function(e,t){return e.length>1?e.indexOf(ny(e[t],e)):t},S3="NEW_FOCUS",Zz=function(e,t,n,r){var o=e.length,s=e[0],i=e[o-1],l=Jb(n);if(!(n&&e.indexOf(n)>=0)){var u=n!==void 0?t.indexOf(n):-1,p=r?t.indexOf(r):u,m=r?e.indexOf(r):-1,h=u-p,g=t.indexOf(s),x=t.indexOf(i),y=Jz(t),b=n!==void 0?y.indexOf(n):-1,C=b-(r?y.indexOf(r):u),S=DS(e,0),j=DS(e,o-1);if(u===-1||m===-1)return S3;if(!h&&m>=0)return m;if(u<=g&&l&&Math.abs(h)>1)return j;if(u>=x&&l&&Math.abs(h)>1)return S;if(h&&Math.abs(C)>1)return m;if(u<=g)return j;if(u>x)return S;if(h)return Math.abs(h)>1?m:(o+m+h)%o}},eF=function(e){return function(t){var n,r=(n=g3(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},tF=function(e,t,n){var r=e.map(function(s){var i=s.node;return i}),o=OS(r.filter(eF(n)));return o&&o.length?AS(o):AS(OS(t))},ax=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&ax(e.parentNode.host||e.parentNode,t),t},Nv=function(e,t){for(var n=ax(e),r=ax(t),o=0;o=0)return s}return!1},k3=function(e,t,n){var r=Gm(e),o=Gm(t),s=r[0],i=!1;return o.filter(Boolean).forEach(function(l){i=Nv(i||l,l)||i,n.filter(Boolean).forEach(function(u){var p=Nv(s,u);p&&(!i||tu(p,i)?i=p:i=Nv(p,i))})}),i},nF=function(e,t){return e.reduce(function(n,r){return n.concat(Uz(r,t))},[])},rF=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(zz)},oF=function(e,t){var n=Ud(Gm(e).length>0?document:d3(e).ownerDocument),r=ty(e).filter(qm),o=k3(n||e,e,r),s=new Map,i=RS(r,s),l=sx(r,s).filter(function(x){var y=x.node;return qm(y)});if(!(!l[0]&&(l=i,!l[0]))){var u=RS([o],s).map(function(x){var y=x.node;return y}),p=rF(u,l),m=p.map(function(x){var y=x.node;return y}),h=Zz(m,u,n,t);if(h===S3){var g=tF(i,m,nF(r,s));if(g)return{node:g};console.warn("focus-lock: cannot find any node to move focus into");return}return h===void 0?h:p[h]}},sF=function(e){var t=ty(e).filter(qm),n=k3(e,e,t),r=new Map,o=sx([n],r,!0),s=sx(t,r).filter(function(i){var l=i.node;return qm(l)}).map(function(i){var l=i.node;return l});return o.map(function(i){var l=i.node,u=i.index;return{node:l,index:u,lockItem:s.indexOf(l)>=0,guard:Jb(l)}})},aF=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},$v=0,Lv=!1,j3=function(e,t,n){n===void 0&&(n={});var r=oF(e,t);if(!Lv&&r){if($v>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Lv=!0,setTimeout(function(){Lv=!1},1);return}$v++,aF(r.node,n.focusOptions),$v--}};function ry(e){setTimeout(e,1)}var iF=function(){return document&&document.activeElement===document.body},lF=function(){return iF()||Xz()},nu=null,Gc=null,ru=null,Gd=!1,cF=function(){return!0},uF=function(t){return(nu.whiteList||cF)(t)},dF=function(t,n){ru={observerNode:t,portaledElement:n}},fF=function(t){return ru&&ru.portaledElement===t};function TS(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 pF=function(t){return t&&"current"in t?t.current:t},mF=function(t){return t?!!Gd:Gd==="meanwhile"},hF=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},gF=function(t,n){return n.some(function(r){return hF(t,r,r)})},Km=function(){var t=!1;if(nu){var n=nu,r=n.observed,o=n.persistentFocus,s=n.autoFocus,i=n.shards,l=n.crossFrame,u=n.focusOptions,p=r||ru&&ru.portaledElement,m=document&&document.activeElement;if(p){var h=[p].concat(i.map(pF).filter(Boolean));if((!m||uF(m))&&(o||mF(l)||!lF()||!Gc&&s)&&(p&&!(w3(h)||m&&gF(m,h)||fF(m))&&(document&&!Gc&&m&&!s?(m.blur&&m.blur(),document.body.focus()):(t=j3(h,Gc,{focusOptions:u}),ru={})),Gd=!1,Gc=document&&document.activeElement),document){var g=document&&document.activeElement,x=sF(h),y=x.map(function(b){var C=b.node;return C}).indexOf(g);y>-1&&(x.filter(function(b){var C=b.guard,S=b.node;return C&&S.dataset.focusAutoGuard}).forEach(function(b){var C=b.node;return C.removeAttribute("tabIndex")}),TS(y,x.length,1,x),TS(y,-1,-1,x))}}}return t},_3=function(t){Km()&&t&&(t.stopPropagation(),t.preventDefault())},oy=function(){return ry(Km)},vF=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||dF(r,n)},xF=function(){return null},I3=function(){Gd="just",ry(function(){Gd="meanwhile"})},bF=function(){document.addEventListener("focusin",_3),document.addEventListener("focusout",oy),window.addEventListener("blur",I3)},yF=function(){document.removeEventListener("focusin",_3),document.removeEventListener("focusout",oy),window.removeEventListener("blur",I3)};function CF(e){return e.filter(function(t){var n=t.disabled;return!n})}function wF(e){var t=e.slice(-1)[0];t&&!nu&&bF();var n=nu,r=n&&t&&t.id===n.id;nu=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(),Km(),ry(Km)):(yF(),Gc=null)}l3.assignSyncMedium(vF);c3.assignMedium(oy);Pz.assignMedium(function(e){return e({moveFocusInside:j3,focusInside:w3})});const SF=Rz(CF,wF)(xF);var P3=d.forwardRef(function(t,n){return d.createElement(u3,hr({sideCar:SF,ref:n},t))}),E3=u3.propTypes||{};E3.sideCar;E$(E3,["sideCar"]);P3.propTypes={};const NS=P3;function M3(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function sy(e){var t;if(!M3(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function kF(e){var t,n;return(n=(t=O3(e))==null?void 0:t.defaultView)!=null?n:window}function O3(e){return M3(e)?e.ownerDocument:document}function jF(e){return O3(e).activeElement}function _F(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 IF(e){return e.localName==="html"?e:e.assignedSlot||e.parentElement||e.ownerDocument.documentElement}function R3(e){return["html","body","#document"].includes(e.localName)?e.ownerDocument.body:sy(e)&&_F(e)?e:R3(IF(e))}var A3=e=>e.hasAttribute("tabindex"),PF=e=>A3(e)&&e.tabIndex===-1;function EF(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function D3(e){return e.parentElement&&D3(e.parentElement)?!0:e.hidden}function MF(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function T3(e){if(!sy(e)||D3(e)||EF(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]():MF(e)?!0:A3(e)}function OF(e){return e?sy(e)&&T3(e)&&!PF(e):!1}var RF=["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]"],AF=RF.join(),DF=e=>e.offsetWidth>0&&e.offsetHeight>0;function N3(e){const t=Array.from(e.querySelectorAll(AF));return t.unshift(e),t.filter(n=>T3(n)&&DF(n))}var $S,TF=($S=NS.default)!=null?$S:NS,$3=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:i,autoFocus:l,persistentFocus:u,lockFocusAcrossFrames:p}=e,m=d.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&N3(r.current).length===0&&requestAnimationFrame(()=>{var y;(y=r.current)==null||y.focus()})},[t,r]),h=d.useCallback(()=>{var x;(x=n==null?void 0:n.current)==null||x.focus()},[n]),g=o&&!n;return a.jsx(TF,{crossFrame:p,persistentFocus:u,autoFocus:l,disabled:i,onActivation:m,onDeactivation:h,returnFocus:g,children:s})};$3.displayName="FocusLock";var NF=K$?d.useLayoutEffect:d.useEffect;function ix(e,t=[]){const n=d.useRef(e);return NF(()=>{n.current=e}),d.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function $F(e,t,n,r){const o=ix(t);return d.useEffect(()=>{var s;const i=(s=_w(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=_w(n))!=null?s:document).removeEventListener(e,o,r)}}function LF(e,t){const n=d.useId();return d.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function zF(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function Uo(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=ix(n),i=ix(t),[l,u]=d.useState(e.defaultIsOpen||!1),[p,m]=zF(r,l),h=LF(o,"disclosure"),g=d.useCallback(()=>{p||u(!1),i==null||i()},[p,i]),x=d.useCallback(()=>{p||u(!0),s==null||s()},[p,s]),y=d.useCallback(()=>{(m?g:x)()},[m,x,g]);return{isOpen:!!m,onOpen:x,onClose:g,onToggle:y,isControlled:p,getButtonProps:(b={})=>({...b,"aria-expanded":m,"aria-controls":h,onClick:cD(b.onClick,y)}),getDisclosureProps:(b={})=>({...b,hidden:!m,id:h})}}var[FF,BF]=Bn({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),L3=Oe(function(t,n){const r=Kr("Input",t),{children:o,className:s,...i}=ar(t),l=_t("chakra-input__group",s),u={},p=ug(o),m=r.field;p.forEach(g=>{var x,y;r&&(m&&g.type.id==="InputLeftElement"&&(u.paddingStart=(x=m.height)!=null?x:m.h),m&&g.type.id==="InputRightElement"&&(u.paddingEnd=(y=m.height)!=null?y:m.h),g.type.id==="InputRightAddon"&&(u.borderEndRadius=0),g.type.id==="InputLeftAddon"&&(u.borderStartRadius=0))});const h=p.map(g=>{var x,y;const b=wI({size:((x=g.props)==null?void 0:x.size)||t.size,variant:((y=g.props)==null?void 0:y.variant)||t.variant});return g.type.id!=="Input"?d.cloneElement(g,b):d.cloneElement(g,Object.assign(b,u,g.props))});return a.jsx(Ee.div,{className:l,ref:n,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...i,children:a.jsx(FF,{value:r,children:h})})});L3.displayName="InputGroup";var HF=Ee("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),hg=Oe(function(t,n){var r,o;const{placement:s="left",...i}=t,l=BF(),u=l.field,m={[s==="left"?"insetStart":"insetEnd"]:"0",width:(r=u==null?void 0:u.height)!=null?r:u==null?void 0:u.h,height:(o=u==null?void 0:u.height)!=null?o:u==null?void 0:u.h,fontSize:u==null?void 0:u.fontSize,...l.element};return a.jsx(HF,{ref:n,__css:m,...i})});hg.id="InputElement";hg.displayName="InputElement";var z3=Oe(function(t,n){const{className:r,...o}=t,s=_t("chakra-input__left-element",r);return a.jsx(hg,{ref:n,placement:"left",className:s,...o})});z3.id="InputLeftElement";z3.displayName="InputLeftElement";var ay=Oe(function(t,n){const{className:r,...o}=t,s=_t("chakra-input__right-element",r);return a.jsx(hg,{ref:n,placement:"right",className:s,...o})});ay.id="InputRightElement";ay.displayName="InputRightElement";var gg=Oe(function(t,n){const{htmlSize:r,...o}=t,s=Kr("Input",o),i=ar(o),l=Vb(i),u=_t("chakra-input",t.className);return a.jsx(Ee.input,{size:r,...l,__css:s.field,ref:n,className:u})});gg.displayName="Input";gg.id="Input";var vg=Oe(function(t,n){const r=il("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:_t("chakra-link",o),...i,__css:r})});vg.displayName="Link";var[WF,F3]=Bn({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),iy=Oe(function(t,n){const r=Kr("List",t),{children:o,styleType:s="none",stylePosition:i,spacing:l,...u}=ar(t),p=ug(o),h=l?{["& > *:not(style) ~ *:not(style)"]:{mt:l}}:{};return a.jsx(WF,{value:r,children:a.jsx(Ee.ul,{ref:n,listStyleType:s,listStylePosition:i,role:"list",__css:{...r.container,...h},...u,children:p})})});iy.displayName="List";var B3=Oe((e,t)=>{const{as:n,...r}=e;return a.jsx(iy,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});B3.displayName="OrderedList";var _f=Oe(function(t,n){const{as:r,...o}=t;return a.jsx(iy,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});_f.displayName="UnorderedList";var ws=Oe(function(t,n){const r=F3();return a.jsx(Ee.li,{ref:n,...t,__css:r.item})});ws.displayName="ListItem";var VF=Oe(function(t,n){const r=F3();return a.jsx(Lr,{ref:n,role:"presentation",...t,__css:r.icon})});VF.displayName="ListIcon";var tl=Oe(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:i,column:l,row:u,autoFlow:p,autoRows:m,templateRows:h,autoColumns:g,templateColumns:x,...y}=t,b={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:i,gridAutoColumns:g,gridColumn:l,gridRow:u,gridAutoFlow:p,gridAutoRows:m,gridTemplateRows:h,gridTemplateColumns:x};return a.jsx(Ee.div,{ref:n,__css:b,...y})});tl.displayName="Grid";function H3(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):T1(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var ki=Ee("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});ki.displayName="Spacer";var W3=e=>a.jsx(Ee.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});W3.displayName="StackItem";function UF(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{"&":H3(n,o=>r[o])}}var ly=Oe((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:i="0.5rem",wrap:l,children:u,divider:p,className:m,shouldWrapChildren:h,...g}=e,x=n?"row":r??"column",y=d.useMemo(()=>UF({spacing:i,direction:x}),[i,x]),b=!!p,C=!h&&!b,S=d.useMemo(()=>{const _=ug(u);return C?_:_.map((P,I)=>{const M=typeof P.key<"u"?P.key:I,O=I+1===_.length,D=h?a.jsx(W3,{children:P},M):P;if(!b)return D;const R=d.cloneElement(p,{__css:y}),N=O?null:R;return a.jsxs(d.Fragment,{children:[D,N]},M)})},[p,y,b,C,h,u]),j=_t("chakra-stack",m);return a.jsx(Ee.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:x,flexWrap:l,gap:b?void 0:i,className:j,...g,children:S})});ly.displayName="Stack";var V3=Oe((e,t)=>a.jsx(ly,{align:"center",...e,direction:"column",ref:t}));V3.displayName="VStack";var cy=Oe((e,t)=>a.jsx(ly,{align:"center",...e,direction:"row",ref:t}));cy.displayName="HStack";function LS(e){return H3(e,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}var qd=Oe(function(t,n){const{area:r,colSpan:o,colStart:s,colEnd:i,rowEnd:l,rowSpan:u,rowStart:p,...m}=t,h=wI({gridArea:r,gridColumn:LS(o),gridRow:LS(u),gridColumnStart:s,gridColumnEnd:i,gridRowStart:p,gridRowEnd:l});return a.jsx(Ee.div,{ref:n,__css:h,...m})});qd.displayName="GridItem";var Ha=Oe(function(t,n){const r=il("Badge",t),{className:o,...s}=ar(t);return a.jsx(Ee.span,{ref:n,className:_t("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:l,borderStyle:u,borderColor:p,...m}=il("Divider",t),{className:h,orientation:g="horizontal",__css:x,...y}=ar(t),b={vertical:{borderLeftWidth:r||i||l||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||l||"1px",width:"100%"}};return a.jsx(Ee.hr,{ref:n,"aria-orientation":g,...y,__css:{...m,border:"0",borderColor:p,borderStyle:u,...b[g],...x},className:_t("chakra-divider",h)})});no.displayName="Divider";function GF(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function qF(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=d.useState([]),s=d.useRef(),i=()=>{s.current&&(clearTimeout(s.current),s.current=null)},l=()=>{i(),s.current=setTimeout(()=>{o([]),s.current=null},t)};d.useEffect(()=>i,[]);function u(p){return m=>{if(m.key==="Backspace"){const h=[...r];h.pop(),o(h);return}if(GF(m)){const h=r.concat(m.key);n(m)&&(m.preventDefault(),m.stopPropagation()),o(h),p(h.join("")),l()}}}return u}function KF(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=d.useRef(new Map),t=e.current,n=d.useCallback((o,s,i,l)=>{e.current.set(i,{type:s,el:o,options:l}),o.addEventListener(s,i,l)},[]),r=d.useCallback((o,s,i,l)=>{o.removeEventListener(s,i,l),e.current.delete(i)},[]);return d.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function zv(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function U3(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:i,onMouseUp:l,onClick:u,onKeyDown:p,onKeyUp:m,tabIndex:h,onMouseOver:g,onMouseLeave:x,...y}=e,[b,C]=d.useState(!0),[S,j]=d.useState(!1),_=QF(),P=z=>{z&&z.tagName!=="BUTTON"&&C(!1)},I=b?h:h||0,M=n&&!r,O=d.useCallback(z=>{if(n){z.stopPropagation(),z.preventDefault();return}z.currentTarget.focus(),u==null||u(z)},[n,u]),A=d.useCallback(z=>{S&&zv(z)&&(z.preventDefault(),z.stopPropagation(),j(!1),_.remove(document,"keyup",A,!1))},[S,_]),D=d.useCallback(z=>{if(p==null||p(z),n||z.defaultPrevented||z.metaKey||!zv(z.nativeEvent)||b)return;const G=o&&z.key==="Enter";s&&z.key===" "&&(z.preventDefault(),j(!0)),G&&(z.preventDefault(),z.currentTarget.click()),_.add(document,"keyup",A,!1)},[n,b,p,o,s,_,A]),R=d.useCallback(z=>{if(m==null||m(z),n||z.defaultPrevented||z.metaKey||!zv(z.nativeEvent)||b)return;s&&z.key===" "&&(z.preventDefault(),j(!1),z.currentTarget.click())},[s,b,n,m]),N=d.useCallback(z=>{z.button===0&&(j(!1),_.remove(document,"mouseup",N,!1))},[_]),Y=d.useCallback(z=>{if(z.button!==0)return;if(n){z.stopPropagation(),z.preventDefault();return}b||j(!0),z.currentTarget.focus({preventScroll:!0}),_.add(document,"mouseup",N,!1),i==null||i(z)},[n,b,i,_,N]),F=d.useCallback(z=>{z.button===0&&(b||j(!1),l==null||l(z))},[l,b]),V=d.useCallback(z=>{if(n){z.preventDefault();return}g==null||g(z)},[n,g]),Q=d.useCallback(z=>{S&&(z.preventDefault(),j(!1)),x==null||x(z)},[S,x]),q=gn(t,P);return b?{...y,ref:q,type:"button","aria-disabled":M?void 0:n,disabled:M,onClick:O,onMouseDown:i,onMouseUp:l,onKeyUp:m,onKeyDown:p,onMouseOver:g,onMouseLeave:x}:{...y,ref:q,role:"button","data-active":qt(S),"aria-disabled":n?"true":void 0,tabIndex:M?void 0:I,onClick:O,onMouseDown:Y,onMouseUp:F,onKeyUp:R,onKeyDown:D,onMouseOver:V,onMouseLeave:Q}}function XF(e){const t=e.current;if(!t)return!1;const n=jF(t);return!n||t.contains(n)?!1:!!OF(n)}function G3(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;xi(()=>{if(!s||XF(e))return;const i=(o==null?void 0:o.current)||e.current;let l;if(i)return l=requestAnimationFrame(()=>{i.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(l)}},[s,e,o])}var YF={preventScroll:!0,shouldFocus:!1};function JF(e,t=YF){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,i=ZF(e)?e.current:e,l=o&&s,u=d.useRef(l),p=d.useRef(s);Yc(()=>{!p.current&&s&&(u.current=l),p.current=s},[s,l]);const m=d.useCallback(()=>{if(!(!s||!i||!u.current)&&(u.current=!1,!i.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var h;(h=n.current)==null||h.focus({preventScroll:r})});else{const h=N3(i);h.length>0&&requestAnimationFrame(()=>{h[0].focus({preventScroll:r})})}},[s,r,i,n]);xi(()=>{m()},[m]),Dl(i,"transitionend",m)}function ZF(e){return"current"in e}var _c=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),zr={arrowShadowColor:_c("--popper-arrow-shadow-color"),arrowSize:_c("--popper-arrow-size","8px"),arrowSizeHalf:_c("--popper-arrow-size-half"),arrowBg:_c("--popper-arrow-bg"),transformOrigin:_c("--popper-transform-origin"),arrowOffset:_c("--popper-arrow-offset")};function eB(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 tB={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"},nB=e=>tB[e],zS={scroll:!0,resize:!0};function rB(e){let t;return typeof e=="object"?t={enabled:!0,options:{...zS,...e}}:t={enabled:e,options:zS},t}var oB={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`}},sB={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{FS(e)},effect:({state:e})=>()=>{FS(e)}},FS=e=>{e.elements.popper.style.setProperty(zr.transformOrigin.var,nB(e.placement))},aB={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{iB(e)}},iB=e=>{var t;if(!e.placement)return;const n=lB(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:zr.arrowSize.varRef,height:zr.arrowSize.varRef,zIndex:-1});const r={[zr.arrowSizeHalf.var]:`calc(${zr.arrowSize.varRef} / 2 - 1px)`,[zr.arrowOffset.var]:`calc(${zr.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},lB=e=>{if(e.startsWith("top"))return{property:"bottom",value:zr.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:zr.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:zr.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:zr.arrowOffset.varRef}},cB={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{BS(e)},effect:({state:e})=>()=>{BS(e)}},BS=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=eB(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:zr.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},uB={"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"}},dB={"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 fB(e,t="ltr"){var n,r;const o=((n=uB[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=dB[e])!=null?r:o}var Ho="top",Es="bottom",Ms="right",Wo="left",uy="auto",If=[Ho,Es,Ms,Wo],pu="start",Kd="end",pB="clippingParents",q3="viewport",md="popper",mB="reference",HS=If.reduce(function(e,t){return e.concat([t+"-"+pu,t+"-"+Kd])},[]),K3=[].concat(If,[uy]).reduce(function(e,t){return e.concat([t,t+"-"+pu,t+"-"+Kd])},[]),hB="beforeRead",gB="read",vB="afterRead",xB="beforeMain",bB="main",yB="afterMain",CB="beforeWrite",wB="write",SB="afterWrite",kB=[hB,gB,vB,xB,bB,yB,CB,wB,SB];function Ma(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 Vl(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 dy(e){if(typeof ShadowRoot>"u")return!1;var t=cs(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function jB(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)||!Ma(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var l=o[i];l===!1?s.removeAttribute(i):s.setAttribute(i,l===!0?"":l)}))})}function _B(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]),l=i.reduce(function(u,p){return u[p]="",u},{});!Is(o)||!Ma(o)||(Object.assign(o.style,l),Object.keys(s).forEach(function(u){o.removeAttribute(u)}))})}}const IB={name:"applyStyles",enabled:!0,phase:"write",fn:jB,effect:_B,requires:["computeStyles"]};function Ea(e){return e.split("-")[0]}var Tl=Math.max,Qm=Math.min,mu=Math.round;function lx(){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 Q3(){return!/^((?!chrome|android).)*safari/i.test(lx())}function hu(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=Vl(e)?cs(e):window,l=i.visualViewport,u=!Q3()&&n,p=(r.left+(u&&l?l.offsetLeft:0))/o,m=(r.top+(u&&l?l.offsetTop:0))/s,h=r.width/o,g=r.height/s;return{width:h,height:g,top:m,right:p+h,bottom:m+g,left:p,x:p,y:m}}function fy(e){var t=hu(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 X3(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&dy(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 PB(e){return["table","td","th"].indexOf(Ma(e))>=0}function ll(e){return((Vl(e)?e.ownerDocument:e.document)||window.document).documentElement}function xg(e){return Ma(e)==="html"?e:e.assignedSlot||e.parentNode||(dy(e)?e.host:null)||ll(e)}function WS(e){return!Is(e)||fi(e).position==="fixed"?null:e.offsetParent}function EB(e){var t=/firefox/i.test(lx()),n=/Trident/i.test(lx());if(n&&Is(e)){var r=fi(e);if(r.position==="fixed")return null}var o=xg(e);for(dy(o)&&(o=o.host);Is(o)&&["html","body"].indexOf(Ma(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 Pf(e){for(var t=cs(e),n=WS(e);n&&PB(n)&&fi(n).position==="static";)n=WS(n);return n&&(Ma(n)==="html"||Ma(n)==="body"&&fi(n).position==="static")?t:n||EB(e)||t}function py(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Dd(e,t,n){return Tl(e,Qm(t,n))}function MB(e,t,n){var r=Dd(e,t,n);return r>n?n:r}function Y3(){return{top:0,right:0,bottom:0,left:0}}function J3(e){return Object.assign({},Y3(),e)}function Z3(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var OB=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,J3(typeof t!="number"?t:Z3(t,If))};function RB(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,l=Ea(n.placement),u=py(l),p=[Wo,Ms].indexOf(l)>=0,m=p?"height":"width";if(!(!s||!i)){var h=OB(o.padding,n),g=fy(s),x=u==="y"?Ho:Wo,y=u==="y"?Es:Ms,b=n.rects.reference[m]+n.rects.reference[u]-i[u]-n.rects.popper[m],C=i[u]-n.rects.reference[u],S=Pf(s),j=S?u==="y"?S.clientHeight||0:S.clientWidth||0:0,_=b/2-C/2,P=h[x],I=j-g[m]-h[y],M=j/2-g[m]/2+_,O=Dd(P,M,I),A=u;n.modifiersData[r]=(t={},t[A]=O,t.centerOffset=O-M,t)}}function AB(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)||X3(t.elements.popper,o)&&(t.elements.arrow=o))}const DB={name:"arrow",enabled:!0,phase:"main",fn:RB,effect:AB,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function gu(e){return e.split("-")[1]}var TB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function NB(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 VS(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,i=e.offsets,l=e.position,u=e.gpuAcceleration,p=e.adaptive,m=e.roundOffsets,h=e.isFixed,g=i.x,x=g===void 0?0:g,y=i.y,b=y===void 0?0:y,C=typeof m=="function"?m({x,y:b}):{x,y:b};x=C.x,b=C.y;var S=i.hasOwnProperty("x"),j=i.hasOwnProperty("y"),_=Wo,P=Ho,I=window;if(p){var M=Pf(n),O="clientHeight",A="clientWidth";if(M===cs(n)&&(M=ll(n),fi(M).position!=="static"&&l==="absolute"&&(O="scrollHeight",A="scrollWidth")),M=M,o===Ho||(o===Wo||o===Ms)&&s===Kd){P=Es;var D=h&&M===I&&I.visualViewport?I.visualViewport.height:M[O];b-=D-r.height,b*=u?1:-1}if(o===Wo||(o===Ho||o===Es)&&s===Kd){_=Ms;var R=h&&M===I&&I.visualViewport?I.visualViewport.width:M[A];x-=R-r.width,x*=u?1:-1}}var N=Object.assign({position:l},p&&TB),Y=m===!0?NB({x,y:b},cs(n)):{x,y:b};if(x=Y.x,b=Y.y,u){var F;return Object.assign({},N,(F={},F[P]=j?"0":"",F[_]=S?"0":"",F.transform=(I.devicePixelRatio||1)<=1?"translate("+x+"px, "+b+"px)":"translate3d("+x+"px, "+b+"px, 0)",F))}return Object.assign({},N,(t={},t[P]=j?b+"px":"",t[_]=S?x+"px":"",t.transform="",t))}function $B(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,l=n.roundOffsets,u=l===void 0?!0:l,p={placement:Ea(t.placement),variation:gu(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,VS(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:u})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,VS(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const LB={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:$B,data:{}};var Np={passive:!0};function zB(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,l=i===void 0?!0:i,u=cs(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(m){m.addEventListener("scroll",n.update,Np)}),l&&u.addEventListener("resize",n.update,Np),function(){s&&p.forEach(function(m){m.removeEventListener("scroll",n.update,Np)}),l&&u.removeEventListener("resize",n.update,Np)}}const FB={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:zB,data:{}};var BB={left:"right",right:"left",bottom:"top",top:"bottom"};function bm(e){return e.replace(/left|right|bottom|top/g,function(t){return BB[t]})}var HB={start:"end",end:"start"};function US(e){return e.replace(/start|end/g,function(t){return HB[t]})}function my(e){var t=cs(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function hy(e){return hu(ll(e)).left+my(e).scrollLeft}function WB(e,t){var n=cs(e),r=ll(e),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,l=0,u=0;if(o){s=o.width,i=o.height;var p=Q3();(p||!p&&t==="fixed")&&(l=o.offsetLeft,u=o.offsetTop)}return{width:s,height:i,x:l+hy(e),y:u}}function VB(e){var t,n=ll(e),r=my(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=Tl(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=Tl(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),l=-r.scrollLeft+hy(e),u=-r.scrollTop;return fi(o||n).direction==="rtl"&&(l+=Tl(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:l,y:u}}function gy(e){var t=fi(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function e5(e){return["html","body","#document"].indexOf(Ma(e))>=0?e.ownerDocument.body:Is(e)&&gy(e)?e:e5(xg(e))}function Td(e,t){var n;t===void 0&&(t=[]);var r=e5(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=cs(r),i=o?[s].concat(s.visualViewport||[],gy(r)?r:[]):r,l=t.concat(i);return o?l:l.concat(Td(xg(i)))}function cx(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function UB(e,t){var n=hu(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 GS(e,t,n){return t===q3?cx(WB(e,n)):Vl(t)?UB(t,n):cx(VB(ll(e)))}function GB(e){var t=Td(xg(e)),n=["absolute","fixed"].indexOf(fi(e).position)>=0,r=n&&Is(e)?Pf(e):e;return Vl(r)?t.filter(function(o){return Vl(o)&&X3(o,r)&&Ma(o)!=="body"}):[]}function qB(e,t,n,r){var o=t==="clippingParents"?GB(e):[].concat(t),s=[].concat(o,[n]),i=s[0],l=s.reduce(function(u,p){var m=GS(e,p,r);return u.top=Tl(m.top,u.top),u.right=Qm(m.right,u.right),u.bottom=Qm(m.bottom,u.bottom),u.left=Tl(m.left,u.left),u},GS(e,i,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function t5(e){var t=e.reference,n=e.element,r=e.placement,o=r?Ea(r):null,s=r?gu(r):null,i=t.x+t.width/2-n.width/2,l=t.y+t.height/2-n.height/2,u;switch(o){case Ho:u={x:i,y:t.y-n.height};break;case Es:u={x:i,y:t.y+t.height};break;case Ms:u={x:t.x+t.width,y:l};break;case Wo:u={x:t.x-n.width,y:l};break;default:u={x:t.x,y:t.y}}var p=o?py(o):null;if(p!=null){var m=p==="y"?"height":"width";switch(s){case pu:u[p]=u[p]-(t[m]/2-n[m]/2);break;case Kd:u[p]=u[p]+(t[m]/2-n[m]/2);break}}return u}function Qd(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,l=n.boundary,u=l===void 0?pB:l,p=n.rootBoundary,m=p===void 0?q3:p,h=n.elementContext,g=h===void 0?md:h,x=n.altBoundary,y=x===void 0?!1:x,b=n.padding,C=b===void 0?0:b,S=J3(typeof C!="number"?C:Z3(C,If)),j=g===md?mB:md,_=e.rects.popper,P=e.elements[y?j:g],I=qB(Vl(P)?P:P.contextElement||ll(e.elements.popper),u,m,i),M=hu(e.elements.reference),O=t5({reference:M,element:_,strategy:"absolute",placement:o}),A=cx(Object.assign({},_,O)),D=g===md?A:M,R={top:I.top-D.top+S.top,bottom:D.bottom-I.bottom+S.bottom,left:I.left-D.left+S.left,right:D.right-I.right+S.right},N=e.modifiersData.offset;if(g===md&&N){var Y=N[o];Object.keys(R).forEach(function(F){var V=[Ms,Es].indexOf(F)>=0?1:-1,Q=[Ho,Es].indexOf(F)>=0?"y":"x";R[F]+=Y[Q]*V})}return R}function KB(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,l=n.flipVariations,u=n.allowedAutoPlacements,p=u===void 0?K3:u,m=gu(r),h=m?l?HS:HS.filter(function(y){return gu(y)===m}):If,g=h.filter(function(y){return p.indexOf(y)>=0});g.length===0&&(g=h);var x=g.reduce(function(y,b){return y[b]=Qd(e,{placement:b,boundary:o,rootBoundary:s,padding:i})[Ea(b)],y},{});return Object.keys(x).sort(function(y,b){return x[y]-x[b]})}function QB(e){if(Ea(e)===uy)return[];var t=bm(e);return[US(e),t,US(t)]}function XB(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,l=i===void 0?!0:i,u=n.fallbackPlacements,p=n.padding,m=n.boundary,h=n.rootBoundary,g=n.altBoundary,x=n.flipVariations,y=x===void 0?!0:x,b=n.allowedAutoPlacements,C=t.options.placement,S=Ea(C),j=S===C,_=u||(j||!y?[bm(C)]:QB(C)),P=[C].concat(_).reduce(function(se,K){return se.concat(Ea(K)===uy?KB(t,{placement:K,boundary:m,rootBoundary:h,padding:p,flipVariations:y,allowedAutoPlacements:b}):K)},[]),I=t.rects.reference,M=t.rects.popper,O=new Map,A=!0,D=P[0],R=0;R=0,Q=V?"width":"height",q=Qd(t,{placement:N,boundary:m,rootBoundary:h,altBoundary:g,padding:p}),z=V?F?Ms:Wo:F?Es:Ho;I[Q]>M[Q]&&(z=bm(z));var G=bm(z),T=[];if(s&&T.push(q[Y]<=0),l&&T.push(q[z]<=0,q[G]<=0),T.every(function(se){return se})){D=N,A=!1;break}O.set(N,T)}if(A)for(var B=y?3:1,X=function(K){var U=P.find(function(ee){var de=O.get(ee);if(de)return de.slice(0,K).every(function(Z){return Z})});if(U)return D=U,"break"},re=B;re>0;re--){var le=X(re);if(le==="break")break}t.placement!==D&&(t.modifiersData[r]._skip=!0,t.placement=D,t.reset=!0)}}const YB={name:"flip",enabled:!0,phase:"main",fn:XB,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 KS(e){return[Ho,Ms,Es,Wo].some(function(t){return e[t]>=0})}function JB(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,i=Qd(t,{elementContext:"reference"}),l=Qd(t,{altBoundary:!0}),u=qS(i,r),p=qS(l,o,s),m=KS(u),h=KS(p);t.modifiersData[n]={referenceClippingOffsets:u,popperEscapeOffsets:p,isReferenceHidden:m,hasPopperEscaped:h},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":m,"data-popper-escaped":h})}const ZB={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:JB};function eH(e,t,n){var r=Ea(e),o=[Wo,Ho].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=s[0],l=s[1];return i=i||0,l=(l||0)*o,[Wo,Ms].indexOf(r)>=0?{x:l,y:i}:{x:i,y:l}}function tH(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,i=K3.reduce(function(m,h){return m[h]=eH(h,t.rects,s),m},{}),l=i[t.placement],u=l.x,p=l.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=u,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=i}const nH={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:tH};function rH(e){var t=e.state,n=e.name;t.modifiersData[n]=t5({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const oH={name:"popperOffsets",enabled:!0,phase:"read",fn:rH,data:{}};function sH(e){return e==="x"?"y":"x"}function aH(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!1:i,u=n.boundary,p=n.rootBoundary,m=n.altBoundary,h=n.padding,g=n.tether,x=g===void 0?!0:g,y=n.tetherOffset,b=y===void 0?0:y,C=Qd(t,{boundary:u,rootBoundary:p,padding:h,altBoundary:m}),S=Ea(t.placement),j=gu(t.placement),_=!j,P=py(S),I=sH(P),M=t.modifiersData.popperOffsets,O=t.rects.reference,A=t.rects.popper,D=typeof b=="function"?b(Object.assign({},t.rects,{placement:t.placement})):b,R=typeof D=="number"?{mainAxis:D,altAxis:D}:Object.assign({mainAxis:0,altAxis:0},D),N=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,Y={x:0,y:0};if(M){if(s){var F,V=P==="y"?Ho:Wo,Q=P==="y"?Es:Ms,q=P==="y"?"height":"width",z=M[P],G=z+C[V],T=z-C[Q],B=x?-A[q]/2:0,X=j===pu?O[q]:A[q],re=j===pu?-A[q]:-O[q],le=t.elements.arrow,se=x&&le?fy(le):{width:0,height:0},K=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Y3(),U=K[V],ee=K[Q],de=Dd(0,O[q],se[q]),Z=_?O[q]/2-B-de-U-R.mainAxis:X-de-U-R.mainAxis,ue=_?-O[q]/2+B+de+ee+R.mainAxis:re+de+ee+R.mainAxis,fe=t.elements.arrow&&Pf(t.elements.arrow),ge=fe?P==="y"?fe.clientTop||0:fe.clientLeft||0:0,_e=(F=N==null?void 0:N[P])!=null?F:0,ye=z+Z-_e-ge,pe=z+ue-_e,Te=Dd(x?Qm(G,ye):G,z,x?Tl(T,pe):T);M[P]=Te,Y[P]=Te-z}if(l){var Ae,qe=P==="x"?Ho:Wo,Pt=P==="x"?Es:Ms,tt=M[I],sn=I==="y"?"height":"width",mt=tt+C[qe],ct=tt-C[Pt],be=[Ho,Wo].indexOf(S)!==-1,We=(Ae=N==null?void 0:N[I])!=null?Ae:0,Rt=be?mt:tt-O[sn]-A[sn]-We+R.altAxis,Ut=be?tt+O[sn]+A[sn]-We-R.altAxis:ct,ke=x&&be?MB(Rt,tt,Ut):Dd(x?Rt:mt,tt,x?Ut:ct);M[I]=ke,Y[I]=ke-tt}t.modifiersData[r]=Y}}const iH={name:"preventOverflow",enabled:!0,phase:"main",fn:aH,requiresIfExists:["offset"]};function lH(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function cH(e){return e===cs(e)||!Is(e)?my(e):lH(e)}function uH(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 dH(e,t,n){n===void 0&&(n=!1);var r=Is(t),o=Is(t)&&uH(t),s=ll(t),i=hu(e,o,n),l={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(r||!r&&!n)&&((Ma(t)!=="body"||gy(s))&&(l=cH(t)),Is(t)?(u=hu(t,!0),u.x+=t.clientLeft,u.y+=t.clientTop):s&&(u.x=hy(s))),{x:i.left+l.scrollLeft-u.x,y:i.top+l.scrollTop-u.y,width:i.width,height:i.height}}function fH(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(l){if(!n.has(l)){var u=t.get(l);u&&o(u)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function pH(e){var t=fH(e);return kB.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function mH(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function hH(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 QS={placement:"bottom",modifiers:[],strategy:"absolute"};function XS(){for(var e=arguments.length,t=new Array(e),n=0;n{}),_=d.useCallback(()=>{var R;!t||!y.current||!b.current||((R=j.current)==null||R.call(j),C.current=xH(y.current,b.current,{placement:S,modifiers:[cB,aB,sB,{...oB,enabled:!!g},{name:"eventListeners",...rB(i)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:l??[0,u]}},{name:"flip",enabled:!!p,options:{padding:8}},{name:"preventOverflow",enabled:!!h,options:{boundary:m}},...n??[]],strategy:o}),C.current.forceUpdate(),j.current=C.current.destroy)},[S,t,n,g,i,s,l,u,p,h,m,o]);d.useEffect(()=>()=>{var R;!y.current&&!b.current&&((R=C.current)==null||R.destroy(),C.current=null)},[]);const P=d.useCallback(R=>{y.current=R,_()},[_]),I=d.useCallback((R={},N=null)=>({...R,ref:gn(P,N)}),[P]),M=d.useCallback(R=>{b.current=R,_()},[_]),O=d.useCallback((R={},N=null)=>({...R,ref:gn(M,N),style:{...R.style,position:o,minWidth:g?void 0:"max-content",inset:"0 auto auto 0"}}),[o,M,g]),A=d.useCallback((R={},N=null)=>{const{size:Y,shadowColor:F,bg:V,style:Q,...q}=R;return{...q,ref:N,"data-popper-arrow":"",style:bH(R)}},[]),D=d.useCallback((R={},N=null)=>({...R,ref:N,"data-popper-arrow-inner":""}),[]);return{update(){var R;(R=C.current)==null||R.update()},forceUpdate(){var R;(R=C.current)==null||R.forceUpdate()},transformOrigin:zr.transformOrigin.varRef,referenceRef:P,popperRef:M,getPopperProps:O,getArrowProps:A,getArrowInnerProps:D,getReferenceProps:I}}function bH(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 xy(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=pr(n),i=pr(t),[l,u]=d.useState(e.defaultIsOpen||!1),p=r!==void 0?r:l,m=r!==void 0,h=d.useId(),g=o??`disclosure-${h}`,x=d.useCallback(()=>{m||u(!1),i==null||i()},[m,i]),y=d.useCallback(()=>{m||u(!0),s==null||s()},[m,s]),b=d.useCallback(()=>{p?x():y()},[p,y,x]);function C(j={}){return{...j,"aria-expanded":p,"aria-controls":g,onClick(_){var P;(P=j.onClick)==null||P.call(j,_),b()}}}function S(j={}){return{...j,hidden:!p,id:g}}return{isOpen:p,onOpen:y,onClose:x,onToggle:b,isControlled:m,getButtonProps:C,getDisclosureProps:S}}function yH(e){const{ref:t,handler:n,enabled:r=!0}=e,o=pr(n),i=d.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;d.useEffect(()=>{if(!r)return;const l=h=>{Fv(h,t)&&(i.isPointerDown=!0)},u=h=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&Fv(h,t)&&(i.isPointerDown=!1,o(h))},p=h=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&Fv(h,t)&&(i.isPointerDown=!1,o(h))},m=n5(t.current);return m.addEventListener("mousedown",l,!0),m.addEventListener("mouseup",u,!0),m.addEventListener("touchstart",l,!0),m.addEventListener("touchend",p,!0),()=>{m.removeEventListener("mousedown",l,!0),m.removeEventListener("mouseup",u,!0),m.removeEventListener("touchstart",l,!0),m.removeEventListener("touchend",p,!0)}},[n,t,o,i,r])}function Fv(e,t){var n;const r=e.target;return r&&!n5(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function n5(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function r5(e){const{isOpen:t,ref:n}=e,[r,o]=d.useState(t),[s,i]=d.useState(!1);return d.useEffect(()=>{s||(o(t),i(!0))},[t,s,r]),Dl(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var u;const p=kF(n.current),m=new p.CustomEvent("animationend",{bubbles:!0});(u=n.current)==null||u.dispatchEvent(m)}}}function by(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[CH,wH,SH,kH]=Bb(),[jH,Ef]=Bn({strict:!1,name:"MenuContext"});function _H(e,...t){const n=d.useId(),r=e||n;return d.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function o5(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function YS(e){return o5(e).activeElement===e}function IH(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:i,isOpen:l,defaultIsOpen:u,onClose:p,onOpen:m,placement:h="bottom-start",lazyBehavior:g="unmount",direction:x,computePositionOnMount:y=!1,...b}=e,C=d.useRef(null),S=d.useRef(null),j=SH(),_=d.useCallback(()=>{requestAnimationFrame(()=>{var le;(le=C.current)==null||le.focus({preventScroll:!1})})},[]),P=d.useCallback(()=>{const le=setTimeout(()=>{var se;if(o)(se=o.current)==null||se.focus();else{const K=j.firstEnabled();K&&F(K.index)}});G.current.add(le)},[j,o]),I=d.useCallback(()=>{const le=setTimeout(()=>{const se=j.lastEnabled();se&&F(se.index)});G.current.add(le)},[j]),M=d.useCallback(()=>{m==null||m(),s?P():_()},[s,P,_,m]),{isOpen:O,onOpen:A,onClose:D,onToggle:R}=xy({isOpen:l,defaultIsOpen:u,onClose:p,onOpen:M});yH({enabled:O&&r,ref:C,handler:le=>{var se;(se=S.current)!=null&&se.contains(le.target)||D()}});const N=vy({...b,enabled:O||y,placement:h,direction:x}),[Y,F]=d.useState(-1);xi(()=>{O||F(-1)},[O]),G3(C,{focusRef:S,visible:O,shouldFocus:!0});const V=r5({isOpen:O,ref:C}),[Q,q]=_H(t,"menu-button","menu-list"),z=d.useCallback(()=>{A(),_()},[A,_]),G=d.useRef(new Set([]));DH(()=>{G.current.forEach(le=>clearTimeout(le)),G.current.clear()});const T=d.useCallback(()=>{A(),P()},[P,A]),B=d.useCallback(()=>{A(),I()},[A,I]),X=d.useCallback(()=>{var le,se;const K=o5(C.current),U=(le=C.current)==null?void 0:le.contains(K.activeElement);if(!(O&&!U))return;const de=(se=j.item(Y))==null?void 0:se.node;de==null||de.focus()},[O,Y,j]),re=d.useRef(null);return{openAndFocusMenu:z,openAndFocusFirstItem:T,openAndFocusLastItem:B,onTransitionEnd:X,unstable__animationState:V,descendants:j,popper:N,buttonId:Q,menuId:q,forceUpdate:N.forceUpdate,orientation:"vertical",isOpen:O,onToggle:R,onOpen:A,onClose:D,menuRef:C,buttonRef:S,focusedIndex:Y,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:F,isLazy:i,lazyBehavior:g,initialFocusRef:o,rafId:re}}function PH(e={},t=null){const n=Ef(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:i}=n,l=d.useCallback(u=>{const p=u.key,h={Enter:s,ArrowDown:s,ArrowUp:i}[p];h&&(u.preventDefault(),u.stopPropagation(),h(u))},[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,l)}}function ux(e){var t;return RH(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function EH(e={},t=null){const n=Ef();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:l,menuId:u,isLazy:p,lazyBehavior:m,unstable__animationState:h}=n,g=wH(),x=qF({preventDefault:S=>S.key!==" "&&ux(S.target)}),y=d.useCallback(S=>{if(!S.currentTarget.contains(S.target))return;const j=S.key,P={Tab:M=>M.preventDefault(),Escape:l,ArrowDown:()=>{const M=g.nextEnabled(r);M&&o(M.index)},ArrowUp:()=>{const M=g.prevEnabled(r);M&&o(M.index)}}[j];if(P){S.preventDefault(),P(S);return}const I=x(M=>{const O=KF(g.values(),M,A=>{var D,R;return(R=(D=A==null?void 0:A.node)==null?void 0:D.textContent)!=null?R:""},g.item(r));if(O){const A=g.indexOf(O.node);o(A)}});ux(S.target)&&I(S)},[g,r,x,l,o]),b=d.useRef(!1);i&&(b.current=!0);const C=by({wasSelected:b.current,enabled:p,mode:m,isSelected:h.present});return{...e,ref:gn(s,t),children:C?e.children:null,tabIndex:-1,role:"menu",id:u,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:rt(e.onKeyDown,y)}}function MH(e={}){const{popper:t,isOpen:n}=Ef();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function OH(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:i,isDisabled:l,isFocusable:u,closeOnSelect:p,type:m,...h}=e,g=Ef(),{setFocusedIndex:x,focusedIndex:y,closeOnSelect:b,onClose:C,menuRef:S,isOpen:j,menuId:_,rafId:P}=g,I=d.useRef(null),M=`${_}-menuitem-${d.useId()}`,{index:O,register:A}=kH({disabled:l&&!u}),D=d.useCallback(z=>{n==null||n(z),!l&&x(O)},[x,O,l,n]),R=d.useCallback(z=>{r==null||r(z),I.current&&!YS(I.current)&&D(z)},[D,r]),N=d.useCallback(z=>{o==null||o(z),!l&&x(-1)},[x,l,o]),Y=d.useCallback(z=>{s==null||s(z),ux(z.currentTarget)&&(p??b)&&C()},[C,s,b,p]),F=d.useCallback(z=>{i==null||i(z),x(O)},[x,i,O]),V=O===y,Q=l&&!u;xi(()=>{j&&(V&&!Q&&I.current?(P.current&&cancelAnimationFrame(P.current),P.current=requestAnimationFrame(()=>{var z;(z=I.current)==null||z.focus(),P.current=null})):S.current&&!YS(S.current)&&S.current.focus({preventScroll:!0}))},[V,Q,S,j]);const q=U3({onClick:Y,onFocus:F,onMouseEnter:D,onMouseMove:R,onMouseLeave:N,ref:gn(A,I,t),isDisabled:l,isFocusable:u});return{...h,...q,type:m??q.type,id:M,role:"menuitem",tabIndex:V?0:-1}}function RH(e){var t;if(!AH(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function AH(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function DH(e,t=[]){return d.useEffect(()=>()=>e(),t)}var[TH,Au]=Bn({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),bg=e=>{const{children:t}=e,n=Kr("Menu",e),r=ar(e),{direction:o}=mf(),{descendants:s,...i}=IH({...r,direction:o}),l=d.useMemo(()=>i,[i]),{isOpen:u,onClose:p,forceUpdate:m}=l;return a.jsx(CH,{value:s,children:a.jsx(jH,{value:l,children:a.jsx(TH,{value:n,children:mb(t,{isOpen:u,onClose:p,forceUpdate:m})})})})};bg.displayName="Menu";var s5=Oe((e,t)=>{const n=Au();return a.jsx(Ee.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});s5.displayName="MenuCommand";var NH=Oe((e,t)=>{const{type:n,...r}=e,o=Au(),s=r.as||n?n??void 0:"button",i=d.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})}),a5=e=>{const{className:t,children:n,...r}=e,o=Au(),s=d.Children.only(n),i=d.isValidElement(s)?d.cloneElement(s,{focusable:"false","aria-hidden":!0,className:_t("chakra-menu__icon",s.props.className)}):null,l=_t("chakra-menu__icon-wrapper",t);return a.jsx(Ee.span,{className:l,...r,__css:o.icon,children:i})};a5.displayName="MenuIcon";var Wn=Oe((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:i,...l}=e,u=OH(l,t),m=n||o?a.jsx("span",{style:{pointerEvents:"none",flex:1},children:i}):i;return a.jsxs(NH,{...u,className:_t("chakra-menu__menuitem",u.className),children:[n&&a.jsx(a5,{fontSize:"0.8em",marginEnd:r,children:n}),m,o&&a.jsx(s5,{marginStart:s,children:o})]})});Wn.displayName="MenuItem";var $H={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"}}},LH=Ee(Mr.div),Ul=Oe(function(t,n){var r,o;const{rootProps:s,motionProps:i,...l}=t,{isOpen:u,onTransitionEnd:p,unstable__animationState:m}=Ef(),h=EH(l,n),g=MH(s),x=Au();return a.jsx(Ee.div,{...g,__css:{zIndex:(o=t.zIndex)!=null?o:(r=x.list)==null?void 0:r.zIndex},children:a.jsx(LH,{variants:$H,initial:!1,animate:u?"enter":"exit",__css:{outline:0,...x.list},...i,className:_t("chakra-menu__menu-list",h.className),...h,onUpdate:p,onAnimationComplete:eg(m.onComplete,h.onAnimationComplete)})})});Ul.displayName="MenuList";var Xd=Oe((e,t)=>{const{title:n,children:r,className:o,...s}=e,i=_t("chakra-menu__group__title",o),l=Au();return a.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[n&&a.jsx(Ee.p,{className:i,...s,__css:l.groupTitle,children:n}),r]})});Xd.displayName="MenuGroup";var zH=Oe((e,t)=>{const n=Au();return a.jsx(Ee.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),yg=Oe((e,t)=>{const{children:n,as:r,...o}=e,s=PH(o,t),i=r||zH;return a.jsx(i,{...s,className:_t("chakra-menu__menu-button",e.className),children:a.jsx(Ee.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});yg.displayName="MenuButton";var FH={slideInBottom:{...Q1,custom:{offsetY:16,reverse:!0}},slideInRight:{...Q1,custom:{offsetX:16,reverse:!0}},scale:{...$P,custom:{initialScale:.95,reverse:!0}},none:{}},BH=Ee(Mr.section),HH=e=>FH[e||"none"],i5=d.forwardRef((e,t)=>{const{preset:n,motionProps:r=HH(n),...o}=e;return a.jsx(BH,{ref:t,...r,...o})});i5.displayName="ModalTransition";var WH=Object.defineProperty,VH=(e,t,n)=>t in e?WH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,UH=(e,t,n)=>(VH(e,typeof t!="symbol"?t+"":t,n),n),GH=class{constructor(){UH(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}},dx=new GH;function l5(e,t){const[n,r]=d.useState(0);return d.useEffect(()=>{const o=e.current;if(o){if(t){const s=dx.add(o);r(s)}return()=>{dx.remove(o),r(0)}}},[t,e]),n}var qH=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ic=new WeakMap,$p=new WeakMap,Lp={},Bv=0,c5=function(e){return e&&(e.host||c5(e.parentNode))},KH=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=c5(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=KH(t,Array.isArray(e)?e:[e]);Lp[n]||(Lp[n]=new WeakMap);var s=Lp[n],i=[],l=new Set,u=new Set(o),p=function(h){!h||l.has(h)||(l.add(h),p(h.parentNode))};o.forEach(p);var m=function(h){!h||u.has(h)||Array.prototype.forEach.call(h.children,function(g){if(l.has(g))m(g);else{var x=g.getAttribute(r),y=x!==null&&x!=="false",b=(Ic.get(g)||0)+1,C=(s.get(g)||0)+1;Ic.set(g,b),s.set(g,C),i.push(g),b===1&&y&&$p.set(g,!0),C===1&&g.setAttribute(n,"true"),y||g.setAttribute(r,"true")}})};return m(t),l.clear(),Bv++,function(){i.forEach(function(h){var g=Ic.get(h)-1,x=s.get(h)-1;Ic.set(h,g),s.set(h,x),g||($p.has(h)||h.removeAttribute(r),$p.delete(h)),x||h.removeAttribute(n)}),Bv--,Bv||(Ic=new WeakMap,Ic=new WeakMap,$p=new WeakMap,Lp={})}},XH=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||qH(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),QH(r,o,n,"aria-hidden")):function(){return null}};function YH(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:i=!0,onOverlayClick:l,onEsc:u}=e,p=d.useRef(null),m=d.useRef(null),[h,g,x]=ZH(r,"chakra-modal","chakra-modal--header","chakra-modal--body");JH(p,t&&i);const y=l5(p,t),b=d.useRef(null),C=d.useCallback(D=>{b.current=D.target},[]),S=d.useCallback(D=>{D.key==="Escape"&&(D.stopPropagation(),s&&(n==null||n()),u==null||u())},[s,n,u]),[j,_]=d.useState(!1),[P,I]=d.useState(!1),M=d.useCallback((D={},R=null)=>({role:"dialog",...D,ref:gn(R,p),id:h,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?g:void 0,"aria-describedby":P?x:void 0,onClick:rt(D.onClick,N=>N.stopPropagation())}),[x,P,h,g,j]),O=d.useCallback(D=>{D.stopPropagation(),b.current===D.target&&dx.isTopModal(p.current)&&(o&&(n==null||n()),l==null||l())},[n,o,l]),A=d.useCallback((D={},R=null)=>({...D,ref:gn(R,m),onClick:rt(D.onClick,O),onKeyDown:rt(D.onKeyDown,S),onMouseDown:rt(D.onMouseDown,C)}),[S,C,O]);return{isOpen:t,onClose:n,headerId:g,bodyId:x,setBodyMounted:I,setHeaderMounted:_,dialogRef:p,overlayRef:m,getDialogProps:M,getDialogContainerProps:A,index:y}}function JH(e,t){const n=e.current;d.useEffect(()=>{if(!(!e.current||!t))return XH(e.current)},[t,e,n])}function ZH(e,...t){const n=d.useId(),r=e||n;return d.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[eW,Du]=Bn({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[tW,Gl]=Bn({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),ql=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:l,returnFocusOnClose:u,blockScrollOnMount:p,allowPinchZoom:m,preserveScrollBarGap:h,motionPreset:g,lockFocusAcrossFrames:x,onCloseComplete:y}=t,b=Kr("Modal",t),S={...YH(t),autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:l,returnFocusOnClose:u,blockScrollOnMount:p,allowPinchZoom:m,preserveScrollBarGap:h,motionPreset:g,lockFocusAcrossFrames:x};return a.jsx(tW,{value:S,children:a.jsx(eW,{value:b,children:a.jsx(yo,{onExitComplete:y,children:S.isOpen&&a.jsx(Eu,{...n,children:r})})})})};ql.displayName="Modal";var ym="right-scroll-bar-position",Cm="width-before-scroll-bar",nW="with-scroll-bars-hidden",rW="--removed-body-scroll-bar-size",u5=a3(),Hv=function(){},Cg=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:Hv,onWheelCapture:Hv,onTouchMoveCapture:Hv}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,u=e.className,p=e.removeScrollBar,m=e.enabled,h=e.shards,g=e.sideCar,x=e.noIsolation,y=e.inert,b=e.allowPinchZoom,C=e.as,S=C===void 0?"div":C,j=e.gapMode,_=r3(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=g,I=n3([n,t]),M=ka(ka({},_),o);return d.createElement(d.Fragment,null,m&&d.createElement(P,{sideCar:u5,removeScrollBar:p,shards:h,noIsolation:x,inert:y,setCallbacks:s,allowPinchZoom:!!b,lockRef:n,gapMode:j}),i?d.cloneElement(d.Children.only(l),ka(ka({},M),{ref:I})):d.createElement(S,ka({},M,{className:u,ref:I}),l))});Cg.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Cg.classNames={fullWidth:Cm,zeroRight:ym};var JS,oW=function(){if(JS)return JS;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function sW(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=oW();return t&&e.setAttribute("nonce",t),e}function aW(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function iW(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var lW=function(){var e=0,t=null;return{add:function(n){e==0&&(t=sW())&&(aW(t,n),iW(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},cW=function(){var e=lW();return function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},d5=function(){var e=cW(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},uW={left:0,top:0,right:0,gap:0},Wv=function(e){return parseInt(e||"",10)||0},dW=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[Wv(n),Wv(r),Wv(o)]},fW=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return uW;var t=dW(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])}},pW=d5(),mW=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),` .`.concat(nW,` { overflow: hidden `).concat(r,`; padding-right: `).concat(l,"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(l,"px ").concat(r,`; `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),` } .`).concat(ym,` { right: `).concat(l,"px ").concat(r,`; } .`).concat(Cm,` { margin-right: `).concat(l,"px ").concat(r,`; } .`).concat(ym," .").concat(ym,` { right: 0 `).concat(r,`; } .`).concat(Cm," .").concat(Cm,` { margin-right: 0 `).concat(r,`; } body { `).concat(rW,": ").concat(l,`px; } `)},hW=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=d.useMemo(function(){return fW(o)},[o]);return d.createElement(pW,{styles:mW(s,!t,o,n?"":"!important")})},fx=!1;if(typeof window<"u")try{var zp=Object.defineProperty({},"passive",{get:function(){return fx=!0,!0}});window.addEventListener("test",zp,zp),window.removeEventListener("test",zp,zp)}catch{fx=!1}var Pc=fx?{passive:!1}:!1,gW=function(e){return e.tagName==="TEXTAREA"},f5=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!gW(e)&&n[t]==="visible")},vW=function(e){return f5(e,"overflowY")},xW=function(e){return f5(e,"overflowX")},ZS=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=p5(e,r);if(o){var s=m5(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},bW=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},yW=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},p5=function(e,t){return e==="v"?vW(t):xW(t)},m5=function(e,t){return e==="v"?bW(t):yW(t)},CW=function(e,t){return e==="h"&&t==="rtl"?-1:1},wW=function(e,t,n,r,o){var s=CW(e,window.getComputedStyle(t).direction),i=s*r,l=n.target,u=t.contains(l),p=!1,m=i>0,h=0,g=0;do{var x=m5(e,l),y=x[0],b=x[1],C=x[2],S=b-C-s*y;(y||S)&&p5(e,l)&&(h+=S,g+=y),l=l.parentNode}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return(m&&(o&&h===0||!o&&i>h)||!m&&(o&&g===0||!o&&-i>g))&&(p=!0),p},Fp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},e4=function(e){return[e.deltaX,e.deltaY]},t4=function(e){return e&&"current"in e?e.current:e},SW=function(e,t){return e[0]===t[0]&&e[1]===t[1]},kW=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},jW=0,Ec=[];function _W(e){var t=d.useRef([]),n=d.useRef([0,0]),r=d.useRef(),o=d.useState(jW++)[0],s=d.useState(d5)[0],i=d.useRef(e);d.useEffect(function(){i.current=e},[e]),d.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var b=rx([e.lockRef.current],(e.shards||[]).map(t4),!0).filter(Boolean);return b.forEach(function(C){return C.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),b.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=d.useCallback(function(b,C){if("touches"in b&&b.touches.length===2)return!i.current.allowPinchZoom;var S=Fp(b),j=n.current,_="deltaX"in b?b.deltaX:j[0]-S[0],P="deltaY"in b?b.deltaY:j[1]-S[1],I,M=b.target,O=Math.abs(_)>Math.abs(P)?"h":"v";if("touches"in b&&O==="h"&&M.type==="range")return!1;var A=ZS(O,M);if(!A)return!0;if(A?I=O:(I=O==="v"?"h":"v",A=ZS(O,M)),!A)return!1;if(!r.current&&"changedTouches"in b&&(_||P)&&(r.current=I),!I)return!0;var D=r.current||I;return wW(D,C,b,D==="h"?_:P,!0)},[]),u=d.useCallback(function(b){var C=b;if(!(!Ec.length||Ec[Ec.length-1]!==s)){var S="deltaY"in C?e4(C):Fp(C),j=t.current.filter(function(I){return I.name===C.type&&I.target===C.target&&SW(I.delta,S)})[0];if(j&&j.should){C.cancelable&&C.preventDefault();return}if(!j){var _=(i.current.shards||[]).map(t4).filter(Boolean).filter(function(I){return I.contains(C.target)}),P=_.length>0?l(C,_[0]):!i.current.noIsolation;P&&C.cancelable&&C.preventDefault()}}},[]),p=d.useCallback(function(b,C,S,j){var _={name:b,delta:C,target:S,should:j};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(P){return P!==_})},1)},[]),m=d.useCallback(function(b){n.current=Fp(b),r.current=void 0},[]),h=d.useCallback(function(b){p(b.type,e4(b),b.target,l(b,e.lockRef.current))},[]),g=d.useCallback(function(b){p(b.type,Fp(b),b.target,l(b,e.lockRef.current))},[]);d.useEffect(function(){return Ec.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Pc),document.addEventListener("touchmove",u,Pc),document.addEventListener("touchstart",m,Pc),function(){Ec=Ec.filter(function(b){return b!==s}),document.removeEventListener("wheel",u,Pc),document.removeEventListener("touchmove",u,Pc),document.removeEventListener("touchstart",m,Pc)}},[]);var x=e.removeScrollBar,y=e.inert;return d.createElement(d.Fragment,null,y?d.createElement(s,{styles:kW(o)}):null,x?d.createElement(hW,{gapMode:e.gapMode}):null)}const IW=Iz(u5,_W);var h5=d.forwardRef(function(e,t){return d.createElement(Cg,ka({},e,{ref:t,sideCar:IW}))});h5.classNames=Cg.classNames;const PW=h5;function EW(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:i,finalFocusRef:l,returnFocusOnClose:u,preserveScrollBarGap:p,lockFocusAcrossFrames:m,isOpen:h}=Gl(),[g,x]=uD();d.useEffect(()=>{!g&&x&&setTimeout(x)},[g,x]);const y=l5(r,h);return a.jsx($3,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:l,restoreFocus:u,contentRef:r,lockFocusAcrossFrames:m,children:a.jsx(PW,{removeScrollBar:!p,allowPinchZoom:i,enabled:y===1&&s,forwardProps:!0,children:e.children})})}var Kl=Oe((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...i}=e,{getDialogProps:l,getDialogContainerProps:u}=Gl(),p=l(i,t),m=u(o),h=_t("chakra-modal__content",n),g=Du(),x={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:b}=Gl();return a.jsx(EW,{children:a.jsx(Ee.div,{...m,className:"chakra-modal__content-container",tabIndex:-1,__css:y,children:a.jsx(i5,{preset:b,motionProps:s,className:h,...p,__css:x,children:r})})})});Kl.displayName="ModalContent";function Mf(e){const{leastDestructiveRef:t,...n}=e;return a.jsx(ql,{...n,initialFocusRef:t})}var Of=Oe((e,t)=>a.jsx(Kl,{ref:t,role:"alertdialog",...e})),Oa=Oe((e,t)=>{const{className:n,...r}=e,o=_t("chakra-modal__footer",n),i={display:"flex",alignItems:"center",justifyContent:"flex-end",...Du().footer};return a.jsx(Ee.footer,{ref:t,...r,__css:i,className:o})});Oa.displayName="ModalFooter";var ra=Oe((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=Gl();d.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=_t("chakra-modal__header",n),u={flex:0,...Du().header};return a.jsx(Ee.header,{ref:t,className:i,id:o,...r,__css:u})});ra.displayName="ModalHeader";var MW=Ee(Mr.div),oa=Oe((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,i=_t("chakra-modal__overlay",n),u={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...Du().overlay},{motionPreset:p}=Gl(),h=o||(p==="none"?{}:NP);return a.jsx(MW,{...h,__css:u,ref:t,className:i,...s})});oa.displayName="ModalOverlay";var sa=Oe((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=Gl();d.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=_t("chakra-modal__body",n),l=Du();return a.jsx(Ee.div,{ref:t,className:i,id:o,...r,__css:l.body})});sa.displayName="ModalBody";var Rf=Oe((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=Gl(),i=_t("chakra-modal__close-btn",r),l=Du();return a.jsx(SI,{ref:t,__css:l.closeButton,className:i,onClick:rt(n,u=>{u.stopPropagation(),s()}),...o})});Rf.displayName="ModalCloseButton";var OW=e=>a.jsx(Lr,{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"})}),RW=e=>a.jsx(Lr,{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 n4(e,t,n,r){d.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,i=Array.isArray(t)?t:[t],l=new s.MutationObserver(u=>{for(const p of u)p.type==="attributes"&&p.attributeName&&i.includes(p.attributeName)&&n(p)});return l.observe(e.current,{attributes:!0,attributeFilter:i}),()=>l.disconnect()})}function AW(e,t){const n=pr(e);d.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var DW=50,r4=300;function TW(e,t){const[n,r]=d.useState(!1),[o,s]=d.useState(null),[i,l]=d.useState(!0),u=d.useRef(null),p=()=>clearTimeout(u.current);AW(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?DW:null);const m=d.useCallback(()=>{i&&e(),u.current=setTimeout(()=>{l(!1),r(!0),s("increment")},r4)},[e,i]),h=d.useCallback(()=>{i&&t(),u.current=setTimeout(()=>{l(!1),r(!0),s("decrement")},r4)},[t,i]),g=d.useCallback(()=>{l(!0),r(!1),p()},[]);return d.useEffect(()=>()=>p(),[]),{up:m,down:h,stop:g,isSpinning:n}}var NW=/^[Ee0-9+\-.]$/;function $W(e){return NW.test(e)}function LW(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 zW(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:l,isDisabled:u,isRequired:p,isInvalid:m,pattern:h="[0-9]*(.[0-9]+)?",inputMode:g="decimal",allowMouseWheel:x,id:y,onChange:b,precision:C,name:S,"aria-describedby":j,"aria-label":_,"aria-labelledby":P,onFocus:I,onBlur:M,onInvalid:O,getAriaValueText:A,isValidCharacter:D,format:R,parse:N,...Y}=e,F=pr(I),V=pr(M),Q=pr(O),q=pr(D??$W),z=pr(A),G=iz(e),{update:T,increment:B,decrement:X}=G,[re,le]=d.useState(!1),se=!(l||u),K=d.useRef(null),U=d.useRef(null),ee=d.useRef(null),de=d.useRef(null),Z=d.useCallback(ke=>ke.split("").filter(q).join(""),[q]),ue=d.useCallback(ke=>{var Ct;return(Ct=N==null?void 0:N(ke))!=null?Ct:ke},[N]),fe=d.useCallback(ke=>{var Ct;return((Ct=R==null?void 0:R(ke))!=null?Ct:ke).toString()},[R]);xi(()=>{(G.valueAsNumber>s||G.valueAsNumber{if(!K.current)return;if(K.current.value!=G.value){const Ct=ue(K.current.value);G.setValue(Z(Ct))}},[ue,Z]);const ge=d.useCallback((ke=i)=>{se&&B(ke)},[B,se,i]),_e=d.useCallback((ke=i)=>{se&&X(ke)},[X,se,i]),ye=TW(ge,_e);n4(ee,"disabled",ye.stop,ye.isSpinning),n4(de,"disabled",ye.stop,ye.isSpinning);const pe=d.useCallback(ke=>{if(ke.nativeEvent.isComposing)return;const Ft=ue(ke.currentTarget.value);T(Z(Ft)),U.current={start:ke.currentTarget.selectionStart,end:ke.currentTarget.selectionEnd}},[T,Z,ue]),Te=d.useCallback(ke=>{var Ct,Ft,Wt;F==null||F(ke),U.current&&(ke.target.selectionStart=(Ft=U.current.start)!=null?Ft:(Ct=ke.currentTarget.value)==null?void 0:Ct.length,ke.currentTarget.selectionEnd=(Wt=U.current.end)!=null?Wt:ke.currentTarget.selectionStart)},[F]),Ae=d.useCallback(ke=>{if(ke.nativeEvent.isComposing)return;LW(ke,q)||ke.preventDefault();const Ct=qe(ke)*i,Ft=ke.key,Le={ArrowUp:()=>ge(Ct),ArrowDown:()=>_e(Ct),Home:()=>T(o),End:()=>T(s)}[Ft];Le&&(ke.preventDefault(),Le(ke))},[q,i,ge,_e,T,o,s]),qe=ke=>{let Ct=1;return(ke.metaKey||ke.ctrlKey)&&(Ct=.1),ke.shiftKey&&(Ct=10),Ct},Pt=d.useMemo(()=>{const ke=z==null?void 0:z(G.value);if(ke!=null)return ke;const Ct=G.value.toString();return Ct||void 0},[G.value,z]),tt=d.useCallback(()=>{let ke=G.value;if(G.value==="")return;/^[eE]/.test(G.value.toString())?G.setValue(""):(G.valueAsNumbers&&(ke=s),G.cast(ke))},[G,s,o]),sn=d.useCallback(()=>{le(!1),n&&tt()},[n,le,tt]),mt=d.useCallback(()=>{t&&requestAnimationFrame(()=>{var ke;(ke=K.current)==null||ke.focus()})},[t]),ct=d.useCallback(ke=>{ke.preventDefault(),ye.up(),mt()},[mt,ye]),be=d.useCallback(ke=>{ke.preventDefault(),ye.down(),mt()},[mt,ye]);Dl(()=>K.current,"wheel",ke=>{var Ct,Ft;const Le=((Ft=(Ct=K.current)==null?void 0:Ct.ownerDocument)!=null?Ft:document).activeElement===K.current;if(!x||!Le)return;ke.preventDefault();const Xe=qe(ke)*i,_n=Math.sign(ke.deltaY);_n===-1?ge(Xe):_n===1&&_e(Xe)},{passive:!1});const We=d.useCallback((ke={},Ct=null)=>{const Ft=u||r&&G.isAtMax;return{...ke,ref:gn(Ct,ee),role:"button",tabIndex:-1,onPointerDown:rt(ke.onPointerDown,Wt=>{Wt.button!==0||Ft||ct(Wt)}),onPointerLeave:rt(ke.onPointerLeave,ye.stop),onPointerUp:rt(ke.onPointerUp,ye.stop),disabled:Ft,"aria-disabled":_s(Ft)}},[G.isAtMax,r,ct,ye.stop,u]),Rt=d.useCallback((ke={},Ct=null)=>{const Ft=u||r&&G.isAtMin;return{...ke,ref:gn(Ct,de),role:"button",tabIndex:-1,onPointerDown:rt(ke.onPointerDown,Wt=>{Wt.button!==0||Ft||be(Wt)}),onPointerLeave:rt(ke.onPointerLeave,ye.stop),onPointerUp:rt(ke.onPointerUp,ye.stop),disabled:Ft,"aria-disabled":_s(Ft)}},[G.isAtMin,r,be,ye.stop,u]),Ut=d.useCallback((ke={},Ct=null)=>{var Ft,Wt,Le,Xe;return{name:S,inputMode:g,type:"text",pattern:h,"aria-labelledby":P,"aria-label":_,"aria-describedby":j,id:y,disabled:u,...ke,readOnly:(Ft=ke.readOnly)!=null?Ft:l,"aria-readonly":(Wt=ke.readOnly)!=null?Wt:l,"aria-required":(Le=ke.required)!=null?Le:p,required:(Xe=ke.required)!=null?Xe:p,ref:gn(K,Ct),value:fe(G.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(G.valueAsNumber)?void 0:G.valueAsNumber,"aria-invalid":_s(m??G.isOutOfRange),"aria-valuetext":Pt,autoComplete:"off",autoCorrect:"off",onChange:rt(ke.onChange,pe),onKeyDown:rt(ke.onKeyDown,Ae),onFocus:rt(ke.onFocus,Te,()=>le(!0)),onBlur:rt(ke.onBlur,V,sn)}},[S,g,h,P,_,fe,j,y,u,p,l,m,G.value,G.valueAsNumber,G.isOutOfRange,o,s,Pt,pe,Ae,Te,V,sn]);return{value:fe(G.value),valueAsNumber:G.valueAsNumber,isFocused:re,isDisabled:u,isReadOnly:l,getIncrementButtonProps:We,getDecrementButtonProps:Rt,getInputProps:Ut,htmlProps:Y}}var[FW,wg]=Bn({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[BW,yy]=Bn({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Sg=Oe(function(t,n){const r=Kr("NumberInput",t),o=ar(t),s=Ub(o),{htmlProps:i,...l}=zW(s),u=d.useMemo(()=>l,[l]);return a.jsx(BW,{value:u,children:a.jsx(FW,{value:r,children:a.jsx(Ee.div,{...i,ref:n,className:_t("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Sg.displayName="NumberInput";var kg=Oe(function(t,n){const r=wg();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}})});kg.displayName="NumberInputStepper";var jg=Oe(function(t,n){const{getInputProps:r}=yy(),o=r(t,n),s=wg();return a.jsx(Ee.input,{...o,className:_t("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});jg.displayName="NumberInputField";var g5=Ee("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),_g=Oe(function(t,n){var r;const o=wg(),{getDecrementButtonProps:s}=yy(),i=s(t,n);return a.jsx(g5,{...i,__css:o.stepper,children:(r=t.children)!=null?r:a.jsx(OW,{})})});_g.displayName="NumberDecrementStepper";var Ig=Oe(function(t,n){var r;const{getIncrementButtonProps:o}=yy(),s=o(t,n),i=wg();return a.jsx(g5,{...s,__css:i.stepper,children:(r=t.children)!=null?r:a.jsx(RW,{})})});Ig.displayName="NumberIncrementStepper";var[HW,tc]=Bn({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[WW,Pg]=Bn({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Eg(e){const t=d.Children.only(e.children),{getTriggerProps:n}=tc();return d.cloneElement(t,n(t.props,t.ref))}Eg.displayName="PopoverTrigger";var Mc={click:"click",hover:"hover"};function VW(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:i=!0,arrowSize:l,arrowShadowColor:u,trigger:p=Mc.click,openDelay:m=200,closeDelay:h=200,isLazy:g,lazyBehavior:x="unmount",computePositionOnMount:y,...b}=e,{isOpen:C,onClose:S,onOpen:j,onToggle:_}=xy(e),P=d.useRef(null),I=d.useRef(null),M=d.useRef(null),O=d.useRef(!1),A=d.useRef(!1);C&&(A.current=!0);const[D,R]=d.useState(!1),[N,Y]=d.useState(!1),F=d.useId(),V=o??F,[Q,q,z,G]=["popover-trigger","popover-content","popover-header","popover-body"].map(pe=>`${pe}-${V}`),{referenceRef:T,getArrowProps:B,getPopperProps:X,getArrowInnerProps:re,forceUpdate:le}=vy({...b,enabled:C||!!y}),se=r5({isOpen:C,ref:M});XP({enabled:C,ref:I}),G3(M,{focusRef:I,visible:C,shouldFocus:s&&p===Mc.click}),JF(M,{focusRef:r,visible:C,shouldFocus:i&&p===Mc.click});const K=by({wasSelected:A.current,enabled:g,mode:x,isSelected:se.present}),U=d.useCallback((pe={},Te=null)=>{const Ae={...pe,style:{...pe.style,transformOrigin:zr.transformOrigin.varRef,[zr.arrowSize.var]:l?`${l}px`:void 0,[zr.arrowShadowColor.var]:u},ref:gn(M,Te),children:K?pe.children:null,id:q,tabIndex:-1,role:"dialog",onKeyDown:rt(pe.onKeyDown,qe=>{n&&qe.key==="Escape"&&S()}),onBlur:rt(pe.onBlur,qe=>{const Pt=o4(qe),tt=Vv(M.current,Pt),sn=Vv(I.current,Pt);C&&t&&(!tt&&!sn)&&S()}),"aria-labelledby":D?z:void 0,"aria-describedby":N?G:void 0};return p===Mc.hover&&(Ae.role="tooltip",Ae.onMouseEnter=rt(pe.onMouseEnter,()=>{O.current=!0}),Ae.onMouseLeave=rt(pe.onMouseLeave,qe=>{qe.nativeEvent.relatedTarget!==null&&(O.current=!1,setTimeout(()=>S(),h))})),Ae},[K,q,D,z,N,G,p,n,S,C,t,h,u,l]),ee=d.useCallback((pe={},Te=null)=>X({...pe,style:{visibility:C?"visible":"hidden",...pe.style}},Te),[C,X]),de=d.useCallback((pe,Te=null)=>({...pe,ref:gn(Te,P,T)}),[P,T]),Z=d.useRef(),ue=d.useRef(),fe=d.useCallback(pe=>{P.current==null&&T(pe)},[T]),ge=d.useCallback((pe={},Te=null)=>{const Ae={...pe,ref:gn(I,Te,fe),id:Q,"aria-haspopup":"dialog","aria-expanded":C,"aria-controls":q};return p===Mc.click&&(Ae.onClick=rt(pe.onClick,_)),p===Mc.hover&&(Ae.onFocus=rt(pe.onFocus,()=>{Z.current===void 0&&j()}),Ae.onBlur=rt(pe.onBlur,qe=>{const Pt=o4(qe),tt=!Vv(M.current,Pt);C&&t&&tt&&S()}),Ae.onKeyDown=rt(pe.onKeyDown,qe=>{qe.key==="Escape"&&S()}),Ae.onMouseEnter=rt(pe.onMouseEnter,()=>{O.current=!0,Z.current=window.setTimeout(()=>j(),m)}),Ae.onMouseLeave=rt(pe.onMouseLeave,()=>{O.current=!1,Z.current&&(clearTimeout(Z.current),Z.current=void 0),ue.current=window.setTimeout(()=>{O.current===!1&&S()},h)})),Ae},[Q,C,q,p,fe,_,j,t,S,m,h]);d.useEffect(()=>()=>{Z.current&&clearTimeout(Z.current),ue.current&&clearTimeout(ue.current)},[]);const _e=d.useCallback((pe={},Te=null)=>({...pe,id:z,ref:gn(Te,Ae=>{R(!!Ae)})}),[z]),ye=d.useCallback((pe={},Te=null)=>({...pe,id:G,ref:gn(Te,Ae=>{Y(!!Ae)})}),[G]);return{forceUpdate:le,isOpen:C,onAnimationComplete:se.onComplete,onClose:S,getAnchorProps:de,getArrowProps:B,getArrowInnerProps:re,getPopoverPositionerProps:ee,getPopoverProps:U,getTriggerProps:ge,getHeaderProps:_e,getBodyProps:ye}}function Vv(e,t){return e===t||(e==null?void 0:e.contains(t))}function o4(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Af(e){const t=Kr("Popover",e),{children:n,...r}=ar(e),o=mf(),s=VW({...r,direction:o.direction});return a.jsx(HW,{value:s,children:a.jsx(WW,{value:t,children:mb(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Af.displayName="Popover";function v5(e){const t=d.Children.only(e.children),{getAnchorProps:n}=tc();return d.cloneElement(t,n(t.props,t.ref))}v5.displayName="PopoverAnchor";var Uv=(e,t)=>t?`${e}.${t}, ${t}`:void 0;function x5(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:i,shadowColor:l}=e,{getArrowProps:u,getArrowInnerProps:p}=tc(),m=Pg(),h=(t=n??r)!=null?t:o,g=s??i;return a.jsx(Ee.div,{...u(),className:"chakra-popover__arrow-positioner",children:a.jsx(Ee.div,{className:_t("chakra-popover__arrow",e.className),...p(e),__css:{"--popper-arrow-shadow-color":Uv("colors",l),"--popper-arrow-bg":Uv("colors",h),"--popper-arrow-shadow":Uv("shadows",g),...m.arrow}})})}x5.displayName="PopoverArrow";var Mg=Oe(function(t,n){const{getBodyProps:r}=tc(),o=Pg();return a.jsx(Ee.div,{...r(t,n),className:_t("chakra-popover__body",t.className),__css:o.body})});Mg.displayName="PopoverBody";var b5=Oe(function(t,n){const{onClose:r}=tc(),o=Pg();return a.jsx(SI,{size:"sm",onClick:r,className:_t("chakra-popover__close-btn",t.className),__css:o.closeButton,ref:n,...t})});b5.displayName="PopoverCloseButton";function UW(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var GW={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]}}},qW=Ee(Mr.section),y5=Oe(function(t,n){const{variants:r=GW,...o}=t,{isOpen:s}=tc();return a.jsx(qW,{ref:n,variants:UW(r),initial:!1,animate:s?"enter":"exit",...o})});y5.displayName="PopoverTransition";var Df=Oe(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:i,getPopoverPositionerProps:l,onAnimationComplete:u}=tc(),p=Pg(),m={position:"relative",display:"flex",flexDirection:"column",...p.content};return a.jsx(Ee.div,{...l(r),__css:p.popper,className:"chakra-popover__popper",children:a.jsx(y5,{...o,...i(s,n),onAnimationComplete:eg(u,s.onAnimationComplete),className:_t("chakra-popover__content",t.className),__css:m})})});Df.displayName="PopoverContent";var px=e=>a.jsx(Ee.circle,{cx:50,cy:50,r:42,fill:"transparent",...e});px.displayName="Circle";function KW(e,t,n){return(e-t)*100/(n-t)}var QW=bi({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}}),XW=bi({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),YW=bi({"0%":{left:"-40%"},"100%":{left:"100%"}}),JW=bi({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function C5(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:i,role:l="progressbar"}=e,u=KW(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,u):o})(),role:l},percent:u,value:t}}var w5=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?`${XW} 2s linear infinite`:void 0},...r})};w5.displayName="Shape";var mx=Oe((e,t)=>{var n;const{size:r="48px",max:o=100,min:s=0,valueText:i,getValueText:l,value:u,capIsRound:p,children:m,thickness:h="10px",color:g="#0078d4",trackColor:x="#edebe9",isIndeterminate:y,...b}=e,C=C5({min:s,max:o,value:u,valueText:i,getValueText:l,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"},P={display:"inline-block",position:"relative",verticalAlign:"middle",fontSize:r};return a.jsxs(Ee.div,{ref:t,className:"chakra-progress",...C.bind,...b,__css:P,children:[a.jsxs(w5,{size:r,isIndeterminate:y,children:[a.jsx(px,{stroke:x,strokeWidth:h,className:"chakra-progress__track"}),a.jsx(px,{stroke:g,strokeWidth:h,className:"chakra-progress__indicator",strokeLinecap:p?"round":void 0,opacity:C.value===0&&!y?0:void 0,..._})]}),m]})});mx.displayName="CircularProgress";var[ZW,eV]=Bn({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),tV=Oe((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:i,...l}=e,u=C5({value:o,min:n,max:r,isIndeterminate:s,role:i}),m={height:"100%",...eV().filledTrack};return a.jsx(Ee.div,{ref:t,style:{width:`${u.percent}%`,...l.style},...u.bind,...l,__css:m})}),S5=Oe((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:i,isAnimated:l,children:u,borderRadius:p,isIndeterminate:m,"aria-label":h,"aria-labelledby":g,"aria-valuetext":x,title:y,role:b,...C}=ar(e),S=Kr("Progress",e),j=p??((n=S.track)==null?void 0:n.borderRadius),_={animation:`${JW} 1s linear infinite`},M={...!m&&i&&l&&_,...m&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${YW} 1s ease infinite normal none running`}},O={overflow:"hidden",position:"relative",...S.track};return a.jsx(Ee.div,{ref:t,borderRadius:j,__css:O,...C,children:a.jsxs(ZW,{value:S,children:[a.jsx(tV,{"aria-label":h,"aria-labelledby":g,"aria-valuetext":x,min:o,max:s,value:r,isIndeterminate:m,css:M,borderRadius:j,title:y,role:b}),u]})})});S5.displayName="Progress";function nV(e){return e&&T1(e)&&T1(e.target)}function rV(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:i,isNative:l,...u}=e,[p,m]=d.useState(r||""),h=typeof n<"u",g=h?n:p,x=d.useRef(null),y=d.useCallback(()=>{const I=x.current;if(!I)return;let M="input:not(:disabled):checked";const O=I.querySelector(M);if(O){O.focus();return}M="input:not(:disabled)";const A=I.querySelector(M);A==null||A.focus()},[]),C=`radio-${d.useId()}`,S=o||C,j=d.useCallback(I=>{const M=nV(I)?I.target.value:I;h||m(M),t==null||t(String(M))},[t,h]),_=d.useCallback((I={},M=null)=>({...I,ref:gn(M,x),role:"radiogroup"}),[]),P=d.useCallback((I={},M=null)=>({...I,ref:M,name:S,[l?"checked":"isChecked"]:g!=null?I.value===g:void 0,onChange(A){j(A)},"data-radiogroup":!0}),[l,S,j,g]);return{getRootProps:_,getRadioProps:P,name:S,ref:x,focus:y,setValue:m,value:g,onChange:j,isDisabled:s,isFocusable:i,htmlProps:u}}var[oV,k5]=Bn({name:"RadioGroupContext",strict:!1}),Xm=Oe((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:i,isDisabled:l,isFocusable:u,...p}=e,{value:m,onChange:h,getRootProps:g,name:x,htmlProps:y}=rV(p),b=d.useMemo(()=>({name:x,size:r,onChange:h,colorScheme:n,value:m,variant:o,isDisabled:l,isFocusable:u}),[x,r,h,n,m,o,l,u]);return a.jsx(oV,{value:b,children:a.jsx(Ee.div,{...g(y,t),className:_t("chakra-radio-group",i),children:s})})});Xm.displayName="RadioGroup";var sV={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function aV(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:i,onChange:l,isInvalid:u,name:p,value:m,id:h,"data-radiogroup":g,"aria-describedby":x,...y}=e,b=`radio-${d.useId()}`,C=Sf(),j=!!k5()||!!g;let P=!!C&&!j?C.id:b;P=h??P;const I=o??(C==null?void 0:C.isDisabled),M=s??(C==null?void 0:C.isReadOnly),O=i??(C==null?void 0:C.isRequired),A=u??(C==null?void 0:C.isInvalid),[D,R]=d.useState(!1),[N,Y]=d.useState(!1),[F,V]=d.useState(!1),[Q,q]=d.useState(!1),[z,G]=d.useState(!!t),T=typeof n<"u",B=T?n:z;d.useEffect(()=>WP(R),[]);const X=d.useCallback(fe=>{if(M||I){fe.preventDefault();return}T||G(fe.target.checked),l==null||l(fe)},[T,I,M,l]),re=d.useCallback(fe=>{fe.key===" "&&q(!0)},[q]),le=d.useCallback(fe=>{fe.key===" "&&q(!1)},[q]),se=d.useCallback((fe={},ge=null)=>({...fe,ref:ge,"data-active":qt(Q),"data-hover":qt(F),"data-disabled":qt(I),"data-invalid":qt(A),"data-checked":qt(B),"data-focus":qt(N),"data-focus-visible":qt(N&&D),"data-readonly":qt(M),"aria-hidden":!0,onMouseDown:rt(fe.onMouseDown,()=>q(!0)),onMouseUp:rt(fe.onMouseUp,()=>q(!1)),onMouseEnter:rt(fe.onMouseEnter,()=>V(!0)),onMouseLeave:rt(fe.onMouseLeave,()=>V(!1))}),[Q,F,I,A,B,N,M,D]),{onFocus:K,onBlur:U}=C??{},ee=d.useCallback((fe={},ge=null)=>{const _e=I&&!r;return{...fe,id:P,ref:ge,type:"radio",name:p,value:m,onChange:rt(fe.onChange,X),onBlur:rt(U,fe.onBlur,()=>Y(!1)),onFocus:rt(K,fe.onFocus,()=>Y(!0)),onKeyDown:rt(fe.onKeyDown,re),onKeyUp:rt(fe.onKeyUp,le),checked:B,disabled:_e,readOnly:M,required:O,"aria-invalid":_s(A),"aria-disabled":_s(_e),"aria-required":_s(O),"data-readonly":qt(M),"aria-describedby":x,style:sV}},[I,r,P,p,m,X,U,K,re,le,B,M,O,A,x]);return{state:{isInvalid:A,isFocused:N,isChecked:B,isActive:Q,isHovered:F,isDisabled:I,isReadOnly:M,isRequired:O},getCheckboxProps:se,getRadioProps:se,getInputProps:ee,getLabelProps:(fe={},ge=null)=>({...fe,ref:ge,onMouseDown:rt(fe.onMouseDown,iV),"data-disabled":qt(I),"data-checked":qt(B),"data-invalid":qt(A)}),getRootProps:(fe,ge=null)=>({...fe,ref:ge,"data-disabled":qt(I),"data-checked":qt(B),"data-invalid":qt(A)}),htmlProps:y}}function iV(e){e.preventDefault(),e.stopPropagation()}function lV(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=k5(),{onChange:o,value:s}=e,i=Kr("Radio",{...r,...e}),l=ar(e),{spacing:u="0.5rem",children:p,isDisabled:m=r==null?void 0:r.isDisabled,isFocusable:h=r==null?void 0:r.isFocusable,inputProps:g,...x}=l;let y=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(y=r.value===s);let b=o;r!=null&&r.onChange&&s!=null&&(b=eg(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:P,htmlProps:I}=aV({...x,isChecked:y,isFocusable:h,isDisabled:m,onChange:b,name:C}),[M,O]=lV(I,kI),A=j(O),D=S(g,t),R=_(),N=Object.assign({},M,P()),Y={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...i.container},F={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...i.control},V={userSelect:"none",marginStart:u,...i.label};return a.jsxs(Ee.label,{className:"chakra-radio",...N,__css:Y,children:[a.jsx("input",{className:"chakra-radio__input",...D}),a.jsx(Ee.span,{className:"chakra-radio__control",...A,__css:F}),p&&a.jsx(Ee.span,{className:"chakra-radio__label",...R,__css:V,children:p})]})});Za.displayName="Radio";var j5=Oe(function(t,n){const{children:r,placeholder:o,className:s,...i}=t;return a.jsxs(Ee.select,{...i,ref:n,className:_t("chakra-select",s),children:[o&&a.jsx("option",{value:"",children:o}),r]})});j5.displayName="SelectField";function cV(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 _5=Oe((e,t)=>{var n;const r=Kr("Select",e),{rootProps:o,placeholder:s,icon:i,color:l,height:u,h:p,minH:m,minHeight:h,iconColor:g,iconSize:x,...y}=ar(e),[b,C]=cV(y,kI),S=Vb(C),j={width:"100%",height:"fit-content",position:"relative",color:l},_={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,...b,...o,children:[a.jsx(j5,{ref:t,height:p??u,minH:m??h,placeholder:s,...S,__css:_,children:e.children}),a.jsx(I5,{"data-disabled":qt(S.disabled),...(g||l)&&{color:g||l},__css:r.icon,...x&&{fontSize:x},children:i})]})});_5.displayName="Select";var uV=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"})}),dV=Ee("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),I5=e=>{const{children:t=a.jsx(uV,{}),...n}=e,r=d.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return a.jsx(dV,{...n,className:"chakra-select__icon-wrapper",children:d.isValidElement(t)?r:null})};I5.displayName="SelectIcon";function fV(){const e=d.useRef(!0);return d.useEffect(()=>{e.current=!1},[]),e.current}function pV(e){const t=d.useRef();return d.useEffect(()=>{t.current=e},[e]),t.current}var mV=Ee("div",{baseStyle:{boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none","&::before, &::after, *":{visibility:"hidden"}}}),hx=jI("skeleton-start-color"),gx=jI("skeleton-end-color"),hV=bi({from:{opacity:0},to:{opacity:1}}),gV=bi({from:{borderColor:hx.reference,background:hx.reference},to:{borderColor:gx.reference,background:gx.reference}}),Og=Oe((e,t)=>{const n={...e,fadeDuration:typeof e.fadeDuration=="number"?e.fadeDuration:.4,speed:typeof e.speed=="number"?e.speed:.8},r=il("Skeleton",n),o=fV(),{startColor:s="",endColor:i="",isLoaded:l,fadeDuration:u,speed:p,className:m,fitContent:h,...g}=ar(n),[x,y]=Ks("colors",[s,i]),b=pV(l),C=_t("chakra-skeleton",m),S={...x&&{[hx.variable]:x},...y&&{[gx.variable]:y}};if(l){const j=o||b?"none":`${hV} ${u}s`;return a.jsx(Ee.div,{ref:t,className:C,__css:{animation:j},...g})}return a.jsx(mV,{ref:t,className:C,...g,__css:{width:h?"fit-content":void 0,...r,...S,_dark:{...r._dark,...S},animation:`${p}s linear infinite alternate ${gV}`}})});Og.displayName="Skeleton";var bs=e=>e?"":void 0,ou=e=>e?!0:void 0,cl=(...e)=>e.filter(Boolean).join(" ");function su(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function vV(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 _d(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var wm={width:0,height:0},Bp=e=>e||wm;function P5(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=b=>{var C;const S=(C=r[b])!=null?C:wm;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",..._d({orientation:t,vertical:{bottom:`calc(${n[b]}% - ${S.height/2}px)`},horizontal:{left:`calc(${n[b]}% - ${S.width/2}px)`}})}},i=t==="vertical"?r.reduce((b,C)=>Bp(b).height>Bp(C).height?b:C,wm):r.reduce((b,C)=>Bp(b).width>Bp(C).width?b:C,wm),l={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,..._d({orientation:t,vertical:i?{paddingLeft:i.width/2,paddingRight:i.width/2}:{},horizontal:i?{paddingTop:i.height/2,paddingBottom:i.height/2}:{}})},u={position:"absolute",..._d({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},p=n.length===1,m=[0,o?100-n[0]:n[0]],h=p?m:n;let g=h[0];!p&&o&&(g=100-g);const x=Math.abs(h[h.length-1]-h[0]),y={...u,..._d({orientation:t,vertical:o?{height:`${x}%`,top:`${g}%`}:{height:`${x}%`,bottom:`${g}%`},horizontal:o?{width:`${x}%`,right:`${g}%`}:{width:`${x}%`,left:`${g}%`}})};return{trackStyle:u,innerTrackStyle:y,rootStyle:l,getThumbStyle:s}}function E5(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function xV(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function bV(e){const t=CV(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function M5(e){return!!e.touches}function yV(e){return M5(e)&&e.touches.length>1}function CV(e){var t;return(t=e.view)!=null?t:window}function wV(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function SV(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function O5(e,t="page"){return M5(e)?wV(e,t):SV(e,t)}function kV(e){return t=>{const n=bV(t);(!n||n&&t.button===0)&&e(t)}}function jV(e,t=!1){function n(o){e(o,{point:O5(o)})}return t?kV(n):n}function Sm(e,t,n,r){return xV(e,t,jV(n,t==="pointerdown"),r)}var _V=Object.defineProperty,IV=(e,t,n)=>t in e?_V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ws=(e,t,n)=>(IV(e,typeof t!="symbol"?t+"":t,n),n),PV=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 l=Gv(this.lastEventInfo,this.history),u=this.startEvent!==null,p=RV(l.offset,{x:0,y:0})>=this.threshold;if(!u&&!p)return;const{timestamp:m}=yS();this.history.push({...l.point,timestamp:m});const{onStart:h,onMove:g}=this.handlers;u||(h==null||h(this.lastEvent,l),this.startEvent=this.lastEvent),g==null||g(this.lastEvent,l)}),Ws(this,"onPointerMove",(l,u)=>{this.lastEvent=l,this.lastEventInfo=u,J$.update(this.updatePoint,!0)}),Ws(this,"onPointerUp",(l,u)=>{const p=Gv(u,this.history),{onEnd:m,onSessionEnd:h}=this.handlers;h==null||h(l,p),this.end(),!(!m||!this.startEvent)&&(m==null||m(l,p))});var r;if(this.win=(r=e.view)!=null?r:window,yV(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:O5(e)},{timestamp:s}=yS();this.history=[{...o.point,timestamp:s}];const{onSessionStart:i}=t;i==null||i(e,Gv(o,this.history)),this.removeListeners=OV(Sm(this.win,"pointermove",this.onPointerMove),Sm(this.win,"pointerup",this.onPointerUp),Sm(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),Z$.update(this.updatePoint)}};function s4(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Gv(e,t){return{point:e.point,delta:s4(e.point,t[t.length-1]),offset:s4(e.point,t[0]),velocity:MV(t,.1)}}var EV=e=>e*1e3;function MV(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>EV(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 OV(...e){return t=>e.reduce((n,r)=>r(n),t)}function qv(e,t){return Math.abs(e-t)}function a4(e){return"x"in e&&"y"in e}function RV(e,t){if(typeof e=="number"&&typeof t=="number")return qv(e,t);if(a4(e)&&a4(t)){const n=qv(e.x,t.x),r=qv(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function R5(e){const t=d.useRef(null);return t.current=e,t}function A5(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:i,threshold:l}=t,u=!!(n||r||o||s||i),p=d.useRef(null),m=R5({onSessionStart:s,onSessionEnd:i,onStart:r,onMove:n,onEnd(h,g){p.current=null,o==null||o(h,g)}});d.useEffect(()=>{var h;(h=p.current)==null||h.updateHandlers(m.current)}),d.useEffect(()=>{const h=e.current;if(!h||!u)return;function g(x){p.current=new PV(x,m.current,l)}return Sm(h,"pointerdown",g)},[e,u,m,l]),d.useEffect(()=>()=>{var h;(h=p.current)==null||h.end(),p.current=null},[])}function AV(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,l;if("borderBoxSize"in s){const u=s.borderBoxSize,p=Array.isArray(u)?u[0]:u;i=p.inlineSize,l=p.blockSize}else i=e.offsetWidth,l=e.offsetHeight;t({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}var DV=globalThis!=null&&globalThis.document?d.useLayoutEffect:d.useEffect;function TV(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 D5({getNodes:e,observeMutation:t=!0}){const[n,r]=d.useState([]),[o,s]=d.useState(0);return DV(()=>{const i=e(),l=i.map((u,p)=>AV(u,m=>{r(h=>[...h.slice(0,p),m,...h.slice(p+1)])}));if(t){const u=i[0];l.push(TV(u,()=>{s(p=>p+1)}))}return()=>{l.forEach(u=>{u==null||u()})}},[o]),n}function NV(e){return typeof e=="object"&&e!==null&&"current"in e}function $V(e){const[t]=D5({observeMutation:!1,getNodes(){return[NV(e)?e.current:e]}});return t}function LV(e){const{min:t=0,max:n=100,onChange:r,value:o,defaultValue:s,isReversed:i,direction:l="ltr",orientation:u="horizontal",id:p,isDisabled:m,isReadOnly:h,onChangeStart:g,onChangeEnd:x,step:y=1,getAriaValueText:b,"aria-valuetext":C,"aria-label":S,"aria-labelledby":j,name:_,focusThumbOnChange:P=!0,minStepsBetweenThumbs:I=0,...M}=e,O=pr(g),A=pr(x),D=pr(b),R=E5({isReversed:i,direction:l,orientation:u}),[N,Y]=Cf({value:o,defaultValue:s??[25,75],onChange:r});if(!Array.isArray(N))throw new TypeError(`[range-slider] You passed an invalid value for \`value\` or \`defaultValue\`, expected \`Array\` but got \`${typeof N}\``);const[F,V]=d.useState(!1),[Q,q]=d.useState(!1),[z,G]=d.useState(-1),T=!(m||h),B=d.useRef(N),X=N.map(Me=>eu(Me,t,n)),re=I*y,le=zV(X,t,n,re),se=d.useRef({eventSource:null,value:[],valueBounds:[]});se.current.value=X,se.current.valueBounds=le;const K=X.map(Me=>n-Me+t),ee=(R?K:X).map(Me=>Um(Me,t,n)),de=u==="vertical",Z=d.useRef(null),ue=d.useRef(null),fe=D5({getNodes(){const Me=ue.current,Ze=Me==null?void 0:Me.querySelectorAll("[role=slider]");return Ze?Array.from(Ze):[]}}),ge=d.useId(),ye=vV(p??ge),pe=d.useCallback(Me=>{var Ze,Ye;if(!Z.current)return;se.current.eventSource="pointer";const dt=Z.current.getBoundingClientRect(),{clientX:Vt,clientY:xr}=(Ye=(Ze=Me.touches)==null?void 0:Ze[0])!=null?Ye:Me,yn=de?dt.bottom-xr:Vt-dt.left,mn=de?dt.height:dt.width;let oo=yn/mn;return R&&(oo=1-oo),UP(oo,t,n)},[de,R,n,t]),Te=(n-t)/10,Ae=y||(n-t)/100,qe=d.useMemo(()=>({setValueAtIndex(Me,Ze){if(!T)return;const Ye=se.current.valueBounds[Me];Ze=parseFloat(tx(Ze,Ye.min,Ae)),Ze=eu(Ze,Ye.min,Ye.max);const dt=[...se.current.value];dt[Me]=Ze,Y(dt)},setActiveIndex:G,stepUp(Me,Ze=Ae){const Ye=se.current.value[Me],dt=R?Ye-Ze:Ye+Ze;qe.setValueAtIndex(Me,dt)},stepDown(Me,Ze=Ae){const Ye=se.current.value[Me],dt=R?Ye+Ze:Ye-Ze;qe.setValueAtIndex(Me,dt)},reset(){Y(B.current)}}),[Ae,R,Y,T]),Pt=d.useCallback(Me=>{const Ze=Me.key,dt={ArrowRight:()=>qe.stepUp(z),ArrowUp:()=>qe.stepUp(z),ArrowLeft:()=>qe.stepDown(z),ArrowDown:()=>qe.stepDown(z),PageUp:()=>qe.stepUp(z,Te),PageDown:()=>qe.stepDown(z,Te),Home:()=>{const{min:Vt}=le[z];qe.setValueAtIndex(z,Vt)},End:()=>{const{max:Vt}=le[z];qe.setValueAtIndex(z,Vt)}}[Ze];dt&&(Me.preventDefault(),Me.stopPropagation(),dt(Me),se.current.eventSource="keyboard")},[qe,z,Te,le]),{getThumbStyle:tt,rootStyle:sn,trackStyle:mt,innerTrackStyle:ct}=d.useMemo(()=>P5({isReversed:R,orientation:u,thumbRects:fe,thumbPercents:ee}),[R,u,ee,fe]),be=d.useCallback(Me=>{var Ze;const Ye=Me??z;if(Ye!==-1&&P){const dt=ye.getThumb(Ye),Vt=(Ze=ue.current)==null?void 0:Ze.ownerDocument.getElementById(dt);Vt&&setTimeout(()=>Vt.focus())}},[P,z,ye]);xi(()=>{se.current.eventSource==="keyboard"&&(A==null||A(se.current.value))},[X,A]);const We=Me=>{const Ze=pe(Me)||0,Ye=se.current.value.map(mn=>Math.abs(mn-Ze)),dt=Math.min(...Ye);let Vt=Ye.indexOf(dt);const xr=Ye.filter(mn=>mn===dt);xr.length>1&&Ze>se.current.value[Vt]&&(Vt=Vt+xr.length-1),G(Vt),qe.setValueAtIndex(Vt,Ze),be(Vt)},Rt=Me=>{if(z==-1)return;const Ze=pe(Me)||0;G(z),qe.setValueAtIndex(z,Ze),be(z)};A5(ue,{onPanSessionStart(Me){T&&(V(!0),We(Me),O==null||O(se.current.value))},onPanSessionEnd(){T&&(V(!1),A==null||A(se.current.value))},onPan(Me){T&&Rt(Me)}});const Ut=d.useCallback((Me={},Ze=null)=>({...Me,...M,id:ye.root,ref:gn(Ze,ue),tabIndex:-1,"aria-disabled":ou(m),"data-focused":bs(Q),style:{...Me.style,...sn}}),[M,m,Q,sn,ye]),ke=d.useCallback((Me={},Ze=null)=>({...Me,ref:gn(Ze,Z),id:ye.track,"data-disabled":bs(m),style:{...Me.style,...mt}}),[m,mt,ye]),Ct=d.useCallback((Me={},Ze=null)=>({...Me,ref:Ze,id:ye.innerTrack,style:{...Me.style,...ct}}),[ct,ye]),Ft=d.useCallback((Me,Ze=null)=>{var Ye;const{index:dt,...Vt}=Me,xr=X[dt];if(xr==null)throw new TypeError(`[range-slider > thumb] Cannot find value at index \`${dt}\`. The \`value\` or \`defaultValue\` length is : ${X.length}`);const yn=le[dt];return{...Vt,ref:Ze,role:"slider",tabIndex:T?0:void 0,id:ye.getThumb(dt),"data-active":bs(F&&z===dt),"aria-valuetext":(Ye=D==null?void 0:D(xr))!=null?Ye:C==null?void 0:C[dt],"aria-valuemin":yn.min,"aria-valuemax":yn.max,"aria-valuenow":xr,"aria-orientation":u,"aria-disabled":ou(m),"aria-readonly":ou(h),"aria-label":S==null?void 0:S[dt],"aria-labelledby":S!=null&&S[dt]||j==null?void 0:j[dt],style:{...Me.style,...tt(dt)},onKeyDown:su(Me.onKeyDown,Pt),onFocus:su(Me.onFocus,()=>{q(!0),G(dt)}),onBlur:su(Me.onBlur,()=>{q(!1),G(-1)})}},[ye,X,le,T,F,z,D,C,u,m,h,S,j,tt,Pt,q]),Wt=d.useCallback((Me={},Ze=null)=>({...Me,ref:Ze,id:ye.output,htmlFor:X.map((Ye,dt)=>ye.getThumb(dt)).join(" "),"aria-live":"off"}),[ye,X]),Le=d.useCallback((Me,Ze=null)=>{const{value:Ye,...dt}=Me,Vt=!(Yen),xr=Ye>=X[0]&&Ye<=X[X.length-1];let yn=Um(Ye,t,n);yn=R?100-yn:yn;const mn={position:"absolute",pointerEvents:"none",..._d({orientation:u,vertical:{bottom:`${yn}%`},horizontal:{left:`${yn}%`}})};return{...dt,ref:Ze,id:ye.getMarker(Me.value),role:"presentation","aria-hidden":!0,"data-disabled":bs(m),"data-invalid":bs(!Vt),"data-highlighted":bs(xr),style:{...Me.style,...mn}}},[m,R,n,t,u,X,ye]),Xe=d.useCallback((Me,Ze=null)=>{const{index:Ye,...dt}=Me;return{...dt,ref:Ze,id:ye.getInput(Ye),type:"hidden",value:X[Ye],name:Array.isArray(_)?_[Ye]:`${_}-${Ye}`}},[_,X,ye]);return{state:{value:X,isFocused:Q,isDragging:F,getThumbPercent:Me=>ee[Me],getThumbMinValue:Me=>le[Me].min,getThumbMaxValue:Me=>le[Me].max},actions:qe,getRootProps:Ut,getTrackProps:ke,getInnerTrackProps:Ct,getThumbProps:Ft,getMarkerProps:Le,getInputProps:Xe,getOutputProps:Wt}}function zV(e,t,n,r){return e.map((o,s)=>{const i=s===0?t:e[s-1]+r,l=s===e.length-1?n:e[s+1]-r;return{min:i,max:l}})}var[FV,Rg]=Bn({name:"SliderContext",errorMessage:"useSliderContext: `context` is undefined. Seems you forgot to wrap all slider components within "}),[BV,Ag]=Bn({name:"RangeSliderStylesContext",errorMessage:`useRangeSliderStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),T5=Oe(function(t,n){const r={orientation:"horizontal",...t},o=Kr("Slider",r),s=ar(r),{direction:i}=mf();s.direction=i;const{getRootProps:l,...u}=LV(s),p=d.useMemo(()=>({...u,name:r.name}),[u,r.name]);return a.jsx(FV,{value:p,children:a.jsx(BV,{value:o,children:a.jsx(Ee.div,{...l({},n),className:"chakra-slider",__css:o.container,children:r.children})})})});T5.displayName="RangeSlider";var vx=Oe(function(t,n){const{getThumbProps:r,getInputProps:o,name:s}=Rg(),i=Ag(),l=r(t,n);return a.jsxs(Ee.div,{...l,className:cl("chakra-slider__thumb",t.className),__css:i.thumb,children:[l.children,s&&a.jsx("input",{...o({index:t.index})})]})});vx.displayName="RangeSliderThumb";var N5=Oe(function(t,n){const{getTrackProps:r}=Rg(),o=Ag(),s=r(t,n);return a.jsx(Ee.div,{...s,className:cl("chakra-slider__track",t.className),__css:o.track,"data-testid":"chakra-range-slider-track"})});N5.displayName="RangeSliderTrack";var $5=Oe(function(t,n){const{getInnerTrackProps:r}=Rg(),o=Ag(),s=r(t,n);return a.jsx(Ee.div,{...s,className:"chakra-slider__filled-track",__css:o.filledTrack})});$5.displayName="RangeSliderFilledTrack";var km=Oe(function(t,n){const{getMarkerProps:r}=Rg(),o=Ag(),s=r(t,n);return a.jsx(Ee.div,{...s,className:cl("chakra-slider__marker",t.className),__css:o.mark})});km.displayName="RangeSliderMark";function HV(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:i,isReversed:l,direction:u="ltr",orientation:p="horizontal",id:m,isDisabled:h,isReadOnly:g,onChangeStart:x,onChangeEnd:y,step:b=1,getAriaValueText:C,"aria-valuetext":S,"aria-label":j,"aria-labelledby":_,name:P,focusThumbOnChange:I=!0,...M}=e,O=pr(x),A=pr(y),D=pr(C),R=E5({isReversed:l,direction:u,orientation:p}),[N,Y]=Cf({value:s,defaultValue:i??VV(n,r),onChange:o}),[F,V]=d.useState(!1),[Q,q]=d.useState(!1),z=!(h||g),G=(r-n)/10,T=b||(r-n)/100,B=eu(N,n,r),X=r-B+n,le=Um(R?X:B,n,r),se=p==="vertical",K=R5({min:n,max:r,step:b,isDisabled:h,value:B,isInteractive:z,isReversed:R,isVertical:se,eventSource:null,focusThumbOnChange:I,orientation:p}),U=d.useRef(null),ee=d.useRef(null),de=d.useRef(null),Z=d.useId(),ue=m??Z,[fe,ge]=[`slider-thumb-${ue}`,`slider-track-${ue}`],_e=d.useCallback(Le=>{var Xe,_n;if(!U.current)return;const Me=K.current;Me.eventSource="pointer";const Ze=U.current.getBoundingClientRect(),{clientX:Ye,clientY:dt}=(_n=(Xe=Le.touches)==null?void 0:Xe[0])!=null?_n:Le,Vt=se?Ze.bottom-dt:Ye-Ze.left,xr=se?Ze.height:Ze.width;let yn=Vt/xr;R&&(yn=1-yn);let mn=UP(yn,Me.min,Me.max);return Me.step&&(mn=parseFloat(tx(mn,Me.min,Me.step))),mn=eu(mn,Me.min,Me.max),mn},[se,R,K]),ye=d.useCallback(Le=>{const Xe=K.current;Xe.isInteractive&&(Le=parseFloat(tx(Le,Xe.min,T)),Le=eu(Le,Xe.min,Xe.max),Y(Le))},[T,Y,K]),pe=d.useMemo(()=>({stepUp(Le=T){const Xe=R?B-Le:B+Le;ye(Xe)},stepDown(Le=T){const Xe=R?B+Le:B-Le;ye(Xe)},reset(){ye(i||0)},stepTo(Le){ye(Le)}}),[ye,R,B,T,i]),Te=d.useCallback(Le=>{const Xe=K.current,Me={ArrowRight:()=>pe.stepUp(),ArrowUp:()=>pe.stepUp(),ArrowLeft:()=>pe.stepDown(),ArrowDown:()=>pe.stepDown(),PageUp:()=>pe.stepUp(G),PageDown:()=>pe.stepDown(G),Home:()=>ye(Xe.min),End:()=>ye(Xe.max)}[Le.key];Me&&(Le.preventDefault(),Le.stopPropagation(),Me(Le),Xe.eventSource="keyboard")},[pe,ye,G,K]),Ae=(t=D==null?void 0:D(B))!=null?t:S,qe=$V(ee),{getThumbStyle:Pt,rootStyle:tt,trackStyle:sn,innerTrackStyle:mt}=d.useMemo(()=>{const Le=K.current,Xe=qe??{width:0,height:0};return P5({isReversed:R,orientation:Le.orientation,thumbRects:[Xe],thumbPercents:[le]})},[R,qe,le,K]),ct=d.useCallback(()=>{K.current.focusThumbOnChange&&setTimeout(()=>{var Xe;return(Xe=ee.current)==null?void 0:Xe.focus()})},[K]);xi(()=>{const Le=K.current;ct(),Le.eventSource==="keyboard"&&(A==null||A(Le.value))},[B,A]);function be(Le){const Xe=_e(Le);Xe!=null&&Xe!==K.current.value&&Y(Xe)}A5(de,{onPanSessionStart(Le){const Xe=K.current;Xe.isInteractive&&(V(!0),ct(),be(Le),O==null||O(Xe.value))},onPanSessionEnd(){const Le=K.current;Le.isInteractive&&(V(!1),A==null||A(Le.value))},onPan(Le){K.current.isInteractive&&be(Le)}});const We=d.useCallback((Le={},Xe=null)=>({...Le,...M,ref:gn(Xe,de),tabIndex:-1,"aria-disabled":ou(h),"data-focused":bs(Q),style:{...Le.style,...tt}}),[M,h,Q,tt]),Rt=d.useCallback((Le={},Xe=null)=>({...Le,ref:gn(Xe,U),id:ge,"data-disabled":bs(h),style:{...Le.style,...sn}}),[h,ge,sn]),Ut=d.useCallback((Le={},Xe=null)=>({...Le,ref:Xe,style:{...Le.style,...mt}}),[mt]),ke=d.useCallback((Le={},Xe=null)=>({...Le,ref:gn(Xe,ee),role:"slider",tabIndex:z?0:void 0,id:fe,"data-active":bs(F),"aria-valuetext":Ae,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":B,"aria-orientation":p,"aria-disabled":ou(h),"aria-readonly":ou(g),"aria-label":j,"aria-labelledby":j?void 0:_,style:{...Le.style,...Pt(0)},onKeyDown:su(Le.onKeyDown,Te),onFocus:su(Le.onFocus,()=>q(!0)),onBlur:su(Le.onBlur,()=>q(!1))}),[z,fe,F,Ae,n,r,B,p,h,g,j,_,Pt,Te]),Ct=d.useCallback((Le,Xe=null)=>{const _n=!(Le.valuer),Me=B>=Le.value,Ze=Um(Le.value,n,r),Ye={position:"absolute",pointerEvents:"none",...WV({orientation:p,vertical:{bottom:R?`${100-Ze}%`:`${Ze}%`},horizontal:{left:R?`${100-Ze}%`:`${Ze}%`}})};return{...Le,ref:Xe,role:"presentation","aria-hidden":!0,"data-disabled":bs(h),"data-invalid":bs(!_n),"data-highlighted":bs(Me),style:{...Le.style,...Ye}}},[h,R,r,n,p,B]),Ft=d.useCallback((Le={},Xe=null)=>({...Le,ref:Xe,type:"hidden",value:B,name:P}),[P,B]);return{state:{value:B,isFocused:Q,isDragging:F},actions:pe,getRootProps:We,getTrackProps:Rt,getInnerTrackProps:Ut,getThumbProps:ke,getMarkerProps:Ct,getInputProps:Ft}}function WV(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function VV(e,t){return t"}),[GV,Tg]=Bn({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),Cy=Oe((e,t)=>{var n;const r={...e,orientation:(n=e==null?void 0:e.orientation)!=null?n:"horizontal"},o=Kr("Slider",r),s=ar(r),{direction:i}=mf();s.direction=i;const{getInputProps:l,getRootProps:u,...p}=HV(s),m=u(),h=l({},t);return a.jsx(UV,{value:p,children:a.jsx(GV,{value:o,children:a.jsxs(Ee.div,{...m,className:cl("chakra-slider",r.className),__css:o.container,children:[r.children,a.jsx("input",{...h})]})})})});Cy.displayName="Slider";var wy=Oe((e,t)=>{const{getThumbProps:n}=Dg(),r=Tg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:cl("chakra-slider__thumb",e.className),__css:r.thumb})});wy.displayName="SliderThumb";var Sy=Oe((e,t)=>{const{getTrackProps:n}=Dg(),r=Tg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:cl("chakra-slider__track",e.className),__css:r.track})});Sy.displayName="SliderTrack";var ky=Oe((e,t)=>{const{getInnerTrackProps:n}=Dg(),r=Tg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:cl("chakra-slider__filled-track",e.className),__css:r.filledTrack})});ky.displayName="SliderFilledTrack";var zc=Oe((e,t)=>{const{getMarkerProps:n}=Dg(),r=Tg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:cl("chakra-slider__marker",e.className),__css:r.mark})});zc.displayName="SliderMark";var[qV,L5]=Bn({name:"StatStylesContext",errorMessage:`useStatStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),z5=Oe(function(t,n){const r=Kr("Stat",t),o={position:"relative",flex:"1 1 0%",...r.container},{className:s,children:i,...l}=ar(t);return a.jsx(qV,{value:r,children:a.jsx(Ee.div,{ref:n,...l,className:_t("chakra-stat",s),__css:o,children:a.jsx("dl",{children:i})})})});z5.displayName="Stat";var F5=Oe(function(t,n){return a.jsx(Ee.div,{...t,ref:n,role:"group",className:_t("chakra-stat__group",t.className),__css:{display:"flex",flexWrap:"wrap",justifyContent:"space-around",alignItems:"flex-start"}})});F5.displayName="StatGroup";var B5=Oe(function(t,n){const r=L5();return a.jsx(Ee.dt,{ref:n,...t,className:_t("chakra-stat__label",t.className),__css:r.label})});B5.displayName="StatLabel";var H5=Oe(function(t,n){const r=L5();return a.jsx(Ee.dd,{ref:n,...t,className:_t("chakra-stat__number",t.className),__css:{...r.number,fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums"}})});H5.displayName="StatNumber";var jy=Oe(function(t,n){const r=Kr("Switch",t),{spacing:o="0.5rem",children:s,...i}=ar(t),{getIndicatorProps:l,getInputProps:u,getCheckboxProps:p,getRootProps:m,getLabelProps:h}=VP(i),g=d.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),x=d.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),y=d.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return a.jsxs(Ee.label,{...m(),className:_t("chakra-switch",t.className),__css:g,children:[a.jsx("input",{className:"chakra-switch__input",...u({},n)}),a.jsx(Ee.span,{...p(),className:"chakra-switch__track",__css:x,children:a.jsx(Ee.span,{__css:r.thumb,className:"chakra-switch__thumb",...l()})}),s&&a.jsx(Ee.span,{className:"chakra-switch__label",...h(),__css:y,children:s})]})});jy.displayName="Switch";var[KV,QV,XV,YV]=Bb();function JV(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:i,lazyBehavior:l="unmount",orientation:u="horizontal",direction:p="ltr",...m}=e,[h,g]=d.useState(n??0),[x,y]=Cf({defaultValue:n??0,value:o,onChange:r});d.useEffect(()=>{o!=null&&g(o)},[o]);const b=XV(),C=d.useId();return{id:`tabs-${(t=e.id)!=null?t:C}`,selectedIndex:x,focusedIndex:h,setSelectedIndex:y,setFocusedIndex:g,isManual:s,isLazy:i,lazyBehavior:l,orientation:u,descendants:b,direction:p,htmlProps:m}}var[ZV,Ng]=Bn({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function eU(e){const{focusedIndex:t,orientation:n,direction:r}=Ng(),o=QV(),s=d.useCallback(i=>{const l=()=>{var j;const _=o.nextEnabled(t);_&&((j=_.node)==null||j.focus())},u=()=>{var j;const _=o.prevEnabled(t);_&&((j=_.node)==null||j.focus())},p=()=>{var j;const _=o.firstEnabled();_&&((j=_.node)==null||j.focus())},m=()=>{var j;const _=o.lastEnabled();_&&((j=_.node)==null||j.focus())},h=n==="horizontal",g=n==="vertical",x=i.key,y=r==="ltr"?"ArrowLeft":"ArrowRight",b=r==="ltr"?"ArrowRight":"ArrowLeft",S={[y]:()=>h&&u(),[b]:()=>h&&l(),ArrowDown:()=>g&&l(),ArrowUp:()=>g&&u(),Home:p,End:m}[x];S&&(i.preventDefault(),S(i))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:rt(e.onKeyDown,s)}}function tU(e){const{isDisabled:t=!1,isFocusable:n=!1,...r}=e,{setSelectedIndex:o,isManual:s,id:i,setFocusedIndex:l,selectedIndex:u}=Ng(),{index:p,register:m}=YV({disabled:t&&!n}),h=p===u,g=()=>{o(p)},x=()=>{l(p),!s&&!(t&&n)&&o(p)},y=U3({...r,ref:gn(m,e.ref),isDisabled:t,isFocusable:n,onClick:rt(e.onClick,g)}),b="button";return{...y,id:W5(i,p),role:"tab",tabIndex:h?0:-1,type:b,"aria-selected":h,"aria-controls":V5(i,p),onFocus:t?void 0:rt(e.onFocus,x)}}var[nU,rU]=Bn({});function oU(e){const t=Ng(),{id:n,selectedIndex:r}=t,s=ug(e.children).map((i,l)=>d.createElement(nU,{key:l,value:{isSelected:l===r,id:V5(n,l),tabId:W5(n,l),selectedIndex:r}},i));return{...e,children:s}}function sU(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=Ng(),{isSelected:s,id:i,tabId:l}=rU(),u=d.useRef(!1);s&&(u.current=!0);const p=by({wasSelected:u.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:p?t:null,role:"tabpanel","aria-labelledby":l,hidden:!s,id:i}}function W5(e,t){return`${e}--tab-${t}`}function V5(e,t){return`${e}--tabpanel-${t}`}var[aU,$g]=Bn({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),nc=Oe(function(t,n){const r=Kr("Tabs",t),{children:o,className:s,...i}=ar(t),{htmlProps:l,descendants:u,...p}=JV(i),m=d.useMemo(()=>p,[p]),{isFitted:h,...g}=l;return a.jsx(KV,{value:u,children:a.jsx(ZV,{value:m,children:a.jsx(aU,{value:r,children:a.jsx(Ee.div,{className:_t("chakra-tabs",s),ref:n,...g,__css:r.root,children:o})})})})});nc.displayName="Tabs";var rc=Oe(function(t,n){const r=eU({...t,ref:n}),s={display:"flex",...$g().tablist};return a.jsx(Ee.div,{...r,className:_t("chakra-tabs__tablist",t.className),__css:s})});rc.displayName="TabList";var ss=Oe(function(t,n){const r=sU({...t,ref:n}),o=$g();return a.jsx(Ee.div,{outline:"0",...r,className:_t("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});ss.displayName="TabPanel";var Tu=Oe(function(t,n){const r=oU(t),o=$g();return a.jsx(Ee.div,{...r,width:"100%",ref:n,className:_t("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});Tu.displayName="TabPanels";var Po=Oe(function(t,n){const r=$g(),o=tU({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return a.jsx(Ee.button,{...o,className:_t("chakra-tabs__tab",t.className),__css:s})});Po.displayName="Tab";function iU(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var lU=["h","minH","height","minHeight"],U5=Oe((e,t)=>{const n=il("Textarea",e),{className:r,rows:o,...s}=ar(e),i=Vb(s),l=o?iU(n,lU):n;return a.jsx(Ee.textarea,{ref:t,rows:o,...i,className:_t("chakra-textarea",r),__css:l})});U5.displayName="Textarea";var cU={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]}}}},xx=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},jm=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function uU(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:i=o,closeOnEsc:l=!0,onOpen:u,onClose:p,placement:m,id:h,isOpen:g,defaultIsOpen:x,arrowSize:y=10,arrowShadowColor:b,arrowPadding:C,modifiers:S,isDisabled:j,gutter:_,offset:P,direction:I,...M}=e,{isOpen:O,onOpen:A,onClose:D}=xy({isOpen:g,defaultIsOpen:x,onOpen:u,onClose:p}),{referenceRef:R,getPopperProps:N,getArrowInnerProps:Y,getArrowProps:F}=vy({enabled:O,placement:m,arrowPadding:C,modifiers:S,gutter:_,offset:P,direction:I}),V=d.useId(),q=`tooltip-${h??V}`,z=d.useRef(null),G=d.useRef(),T=d.useCallback(()=>{G.current&&(clearTimeout(G.current),G.current=void 0)},[]),B=d.useRef(),X=d.useCallback(()=>{B.current&&(clearTimeout(B.current),B.current=void 0)},[]),re=d.useCallback(()=>{X(),D()},[D,X]),le=dU(z,re),se=d.useCallback(()=>{if(!j&&!G.current){O&&le();const ge=jm(z);G.current=ge.setTimeout(A,t)}},[le,j,O,A,t]),K=d.useCallback(()=>{T();const ge=jm(z);B.current=ge.setTimeout(re,n)},[n,re,T]),U=d.useCallback(()=>{O&&r&&K()},[r,K,O]),ee=d.useCallback(()=>{O&&i&&K()},[i,K,O]),de=d.useCallback(ge=>{O&&ge.key==="Escape"&&K()},[O,K]);Dl(()=>xx(z),"keydown",l?de:void 0),Dl(()=>{const ge=z.current;if(!ge)return null;const _e=R3(ge);return _e.localName==="body"?jm(z):_e},"scroll",()=>{O&&s&&re()},{passive:!0,capture:!0}),d.useEffect(()=>{j&&(T(),O&&D())},[j,O,D,T]),d.useEffect(()=>()=>{T(),X()},[T,X]),Dl(()=>z.current,"pointerleave",K);const Z=d.useCallback((ge={},_e=null)=>({...ge,ref:gn(z,_e,R),onPointerEnter:rt(ge.onPointerEnter,pe=>{pe.pointerType!=="touch"&&se()}),onClick:rt(ge.onClick,U),onPointerDown:rt(ge.onPointerDown,ee),onFocus:rt(ge.onFocus,se),onBlur:rt(ge.onBlur,K),"aria-describedby":O?q:void 0}),[se,K,ee,O,q,U,R]),ue=d.useCallback((ge={},_e=null)=>N({...ge,style:{...ge.style,[zr.arrowSize.var]:y?`${y}px`:void 0,[zr.arrowShadowColor.var]:b}},_e),[N,y,b]),fe=d.useCallback((ge={},_e=null)=>{const ye={...ge.style,position:"relative",transformOrigin:zr.transformOrigin.varRef};return{ref:_e,...M,...ge,id:q,role:"tooltip",style:ye}},[M,q]);return{isOpen:O,show:se,hide:K,getTriggerProps:Z,getTooltipProps:fe,getTooltipPositionerProps:ue,getArrowProps:F,getArrowInnerProps:Y}}var Kv="chakra-ui:close-tooltip";function dU(e,t){return d.useEffect(()=>{const n=xx(e);return n.addEventListener(Kv,t),()=>n.removeEventListener(Kv,t)},[t,e]),()=>{const n=xx(e),r=jm(e);n.dispatchEvent(new r.CustomEvent(Kv))}}function fU(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function pU(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var mU=Ee(Mr.div),Fn=Oe((e,t)=>{var n,r;const o=il("Tooltip",e),s=ar(e),i=mf(),{children:l,label:u,shouldWrapChildren:p,"aria-label":m,hasArrow:h,bg:g,portalProps:x,background:y,backgroundColor:b,bgColor:C,motionProps:S,...j}=s,_=(r=(n=y??b)!=null?n:g)!=null?r:C;if(_){o.bg=_;const N=dD(i,"colors",_);o[zr.arrowBg.var]=N}const P=uU({...j,direction:i.direction}),I=typeof l=="string"||p;let M;if(I)M=a.jsx(Ee.span,{display:"inline-block",tabIndex:0,...P.getTriggerProps(),children:l});else{const N=d.Children.only(l);M=d.cloneElement(N,P.getTriggerProps(N.props,N.ref))}const O=!!m,A=P.getTooltipProps({},t),D=O?fU(A,["role","id"]):A,R=pU(A,["role","id"]);return u?a.jsxs(a.Fragment,{children:[M,a.jsx(yo,{children:P.isOpen&&a.jsx(Eu,{...x,children:a.jsx(Ee.div,{...P.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:a.jsxs(mU,{variants:cU,initial:"exit",animate:"enter",exit:"exit",...S,...D,__css:o,children:[u,O&&a.jsx(Ee.span,{srOnly:!0,...R,children:m}),h&&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:l})});Fn.displayName="Tooltip";function Lg(e,t={}){let n=d.useCallback(o=>t.keys?P$(e,t.keys,o):e.listen(o),[t.keys,e]),r=e.get.bind(e);return d.useSyncExternalStore(n,r,r)}const hU=ce(we,({system:e})=>{const{consoleLogLevel:t,shouldLogToConsole:n}=e;return{consoleLogLevel:t,shouldLogToConsole:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),G5=e=>{const{consoleLogLevel:t,shouldLogToConsole:n}=W(hU);return d.useEffect(()=>{n?(localStorage.setItem("ROARR_LOG","true"),localStorage.setItem("ROARR_FILTER",`context.logLevel:>=${fD[t]}`)):localStorage.setItem("ROARR_LOG","false"),Iw.ROARR.write=pD.createLogWriter()},[t,n]),d.useEffect(()=>{const o={...mD};hD.set(Iw.Roarr.child(o))},[]),d.useMemo(()=>yi(e),[e])},gU=()=>{const e=te(),t=W(r=>r.system.toastQueue),n=DP();return d.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(gD())},[e,n,t]),null},oc=()=>{const e=te();return d.useCallback(n=>e($t(Gn(n))),[e])},vU=d.memo(gU);var xU=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 Tf(e,t){var n=bU(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 bU(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=xU.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var yU=[".DS_Store","Thumbs.db"];function CU(e){return Ou(this,void 0,void 0,function(){return Ru(this,function(t){return Ym(e)&&wU(e.dataTransfer)?[2,_U(e.dataTransfer,e.type)]:SU(e)?[2,kU(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,jU(e)]:[2,[]]})})}function wU(e){return Ym(e)}function SU(e){return Ym(e)&&Ym(e.target)}function Ym(e){return typeof e=="object"&&e!==null}function kU(e){return bx(e.target.files).map(function(t){return Tf(t)})}function jU(e){return Ou(this,void 0,void 0,function(){var t;return Ru(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 Tf(r)})]}})})}function _U(e,t){return Ou(this,void 0,void 0,function(){var n,r;return Ru(this,function(o){switch(o.label){case 0:return e.items?(n=bx(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(IU))]):[3,2];case 1:return r=o.sent(),[2,i4(q5(r))];case 2:return[2,i4(bx(e.files).map(function(s){return Tf(s)}))]}})})}function i4(e){return e.filter(function(t){return yU.indexOf(t.name)===-1})}function bx(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,f4(n)];if(e.sizen)return[!1,f4(n)]}return[!0,null]}function Pl(e){return e!=null}function WU(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,i=e.maxFiles,l=e.validator;return!s&&t.length>1||s&&i>=1&&t.length>i?!1:t.every(function(u){var p=Y5(u,n),m=Yd(p,1),h=m[0],g=J5(u,r,o),x=Yd(g,1),y=x[0],b=l?l(u):null;return h&&y&&!b})}function Jm(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Hp(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 m4(e){e.preventDefault()}function VU(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function UU(e){return e.indexOf("Edge/")!==-1}function GU(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return VU(e)||UU(e)}function Ca(){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 cG(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 _y=d.forwardRef(function(e,t){var n=e.children,r=Zm(e,JU),o=Iy(r),s=o.open,i=Zm(o,ZU);return d.useImperativeHandle(t,function(){return{open:s}},[s]),H.createElement(d.Fragment,null,n(Cr(Cr({},i),{},{open:s})))});_y.displayName="Dropzone";var n6={disabled:!1,getFilesFromEvent:CU,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};_y.defaultProps=n6;_y.propTypes={children:Zn.func,accept:Zn.objectOf(Zn.arrayOf(Zn.string)),multiple:Zn.bool,preventDropOnDocument:Zn.bool,noClick:Zn.bool,noKeyboard:Zn.bool,noDrag:Zn.bool,noDragEventsBubbling:Zn.bool,minSize:Zn.number,maxSize:Zn.number,maxFiles:Zn.number,disabled:Zn.bool,getFilesFromEvent:Zn.func,onFileDialogCancel:Zn.func,onFileDialogOpen:Zn.func,useFsAccessApi:Zn.bool,autoFocus:Zn.bool,onDragEnter:Zn.func,onDragLeave:Zn.func,onDragOver:Zn.func,onDrop:Zn.func,onDropAccepted:Zn.func,onDropRejected:Zn.func,onError:Zn.func,validator:Zn.func};var Sx={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Iy(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Cr(Cr({},n6),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,i=t.minSize,l=t.multiple,u=t.maxFiles,p=t.onDragEnter,m=t.onDragLeave,h=t.onDragOver,g=t.onDrop,x=t.onDropAccepted,y=t.onDropRejected,b=t.onFileDialogCancel,C=t.onFileDialogOpen,S=t.useFsAccessApi,j=t.autoFocus,_=t.preventDropOnDocument,P=t.noClick,I=t.noKeyboard,M=t.noDrag,O=t.noDragEventsBubbling,A=t.onError,D=t.validator,R=d.useMemo(function(){return QU(n)},[n]),N=d.useMemo(function(){return KU(n)},[n]),Y=d.useMemo(function(){return typeof C=="function"?C:g4},[C]),F=d.useMemo(function(){return typeof b=="function"?b:g4},[b]),V=d.useRef(null),Q=d.useRef(null),q=d.useReducer(uG,Sx),z=Qv(q,2),G=z[0],T=z[1],B=G.isFocused,X=G.isFileDialogActive,re=d.useRef(typeof window<"u"&&window.isSecureContext&&S&&qU()),le=function(){!re.current&&X&&setTimeout(function(){if(Q.current){var We=Q.current.files;We.length||(T({type:"closeDialog"}),F())}},300)};d.useEffect(function(){return window.addEventListener("focus",le,!1),function(){window.removeEventListener("focus",le,!1)}},[Q,X,F,re]);var se=d.useRef([]),K=function(We){V.current&&V.current.contains(We.target)||(We.preventDefault(),se.current=[])};d.useEffect(function(){return _&&(document.addEventListener("dragover",m4,!1),document.addEventListener("drop",K,!1)),function(){_&&(document.removeEventListener("dragover",m4),document.removeEventListener("drop",K))}},[V,_]),d.useEffect(function(){return!r&&j&&V.current&&V.current.focus(),function(){}},[V,j,r]);var U=d.useCallback(function(be){A?A(be):console.error(be)},[A]),ee=d.useCallback(function(be){be.preventDefault(),be.persist(),tt(be),se.current=[].concat(nG(se.current),[be.target]),Hp(be)&&Promise.resolve(o(be)).then(function(We){if(!(Jm(be)&&!O)){var Rt=We.length,Ut=Rt>0&&WU({files:We,accept:R,minSize:i,maxSize:s,multiple:l,maxFiles:u,validator:D}),ke=Rt>0&&!Ut;T({isDragAccept:Ut,isDragReject:ke,isDragActive:!0,type:"setDraggedFiles"}),p&&p(be)}}).catch(function(We){return U(We)})},[o,p,U,O,R,i,s,l,u,D]),de=d.useCallback(function(be){be.preventDefault(),be.persist(),tt(be);var We=Hp(be);if(We&&be.dataTransfer)try{be.dataTransfer.dropEffect="copy"}catch{}return We&&h&&h(be),!1},[h,O]),Z=d.useCallback(function(be){be.preventDefault(),be.persist(),tt(be);var We=se.current.filter(function(Ut){return V.current&&V.current.contains(Ut)}),Rt=We.indexOf(be.target);Rt!==-1&&We.splice(Rt,1),se.current=We,!(We.length>0)&&(T({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Hp(be)&&m&&m(be))},[V,m,O]),ue=d.useCallback(function(be,We){var Rt=[],Ut=[];be.forEach(function(ke){var Ct=Y5(ke,R),Ft=Qv(Ct,2),Wt=Ft[0],Le=Ft[1],Xe=J5(ke,i,s),_n=Qv(Xe,2),Me=_n[0],Ze=_n[1],Ye=D?D(ke):null;if(Wt&&Me&&!Ye)Rt.push(ke);else{var dt=[Le,Ze];Ye&&(dt=dt.concat(Ye)),Ut.push({file:ke,errors:dt.filter(function(Vt){return Vt})})}}),(!l&&Rt.length>1||l&&u>=1&&Rt.length>u)&&(Rt.forEach(function(ke){Ut.push({file:ke,errors:[HU]})}),Rt.splice(0)),T({acceptedFiles:Rt,fileRejections:Ut,type:"setFiles"}),g&&g(Rt,Ut,We),Ut.length>0&&y&&y(Ut,We),Rt.length>0&&x&&x(Rt,We)},[T,l,R,i,s,u,g,x,y,D]),fe=d.useCallback(function(be){be.preventDefault(),be.persist(),tt(be),se.current=[],Hp(be)&&Promise.resolve(o(be)).then(function(We){Jm(be)&&!O||ue(We,be)}).catch(function(We){return U(We)}),T({type:"reset"})},[o,ue,U,O]),ge=d.useCallback(function(){if(re.current){T({type:"openDialog"}),Y();var be={multiple:l,types:N};window.showOpenFilePicker(be).then(function(We){return o(We)}).then(function(We){ue(We,null),T({type:"closeDialog"})}).catch(function(We){XU(We)?(F(We),T({type:"closeDialog"})):YU(We)?(re.current=!1,Q.current?(Q.current.value=null,Q.current.click()):U(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."))):U(We)});return}Q.current&&(T({type:"openDialog"}),Y(),Q.current.value=null,Q.current.click())},[T,Y,F,S,ue,U,N,l]),_e=d.useCallback(function(be){!V.current||!V.current.isEqualNode(be.target)||(be.key===" "||be.key==="Enter"||be.keyCode===32||be.keyCode===13)&&(be.preventDefault(),ge())},[V,ge]),ye=d.useCallback(function(){T({type:"focus"})},[]),pe=d.useCallback(function(){T({type:"blur"})},[]),Te=d.useCallback(function(){P||(GU()?setTimeout(ge,0):ge())},[P,ge]),Ae=function(We){return r?null:We},qe=function(We){return I?null:Ae(We)},Pt=function(We){return M?null:Ae(We)},tt=function(We){O&&We.stopPropagation()},sn=d.useMemo(function(){return function(){var be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},We=be.refKey,Rt=We===void 0?"ref":We,Ut=be.role,ke=be.onKeyDown,Ct=be.onFocus,Ft=be.onBlur,Wt=be.onClick,Le=be.onDragEnter,Xe=be.onDragOver,_n=be.onDragLeave,Me=be.onDrop,Ze=Zm(be,eG);return Cr(Cr(wx({onKeyDown:qe(Ca(ke,_e)),onFocus:qe(Ca(Ct,ye)),onBlur:qe(Ca(Ft,pe)),onClick:Ae(Ca(Wt,Te)),onDragEnter:Pt(Ca(Le,ee)),onDragOver:Pt(Ca(Xe,de)),onDragLeave:Pt(Ca(_n,Z)),onDrop:Pt(Ca(Me,fe)),role:typeof Ut=="string"&&Ut!==""?Ut:"presentation"},Rt,V),!r&&!I?{tabIndex:0}:{}),Ze)}},[V,_e,ye,pe,Te,ee,de,Z,fe,I,M,r]),mt=d.useCallback(function(be){be.stopPropagation()},[]),ct=d.useMemo(function(){return function(){var be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},We=be.refKey,Rt=We===void 0?"ref":We,Ut=be.onChange,ke=be.onClick,Ct=Zm(be,tG),Ft=wx({accept:R,multiple:l,type:"file",style:{display:"none"},onChange:Ae(Ca(Ut,fe)),onClick:Ae(Ca(ke,mt)),tabIndex:-1},Rt,Q);return Cr(Cr({},Ft),Ct)}},[Q,n,l,fe,r]);return Cr(Cr({},G),{},{isFocused:B&&!r,getRootProps:sn,getInputProps:ct,rootRef:V,inputRef:Q,open:Ae(ge)})}function uG(e,t){switch(t.type){case"focus":return Cr(Cr({},e),{},{isFocused:!0});case"blur":return Cr(Cr({},e),{},{isFocused:!1});case"openDialog":return Cr(Cr({},Sx),{},{isFileDialogActive:!0});case"closeDialog":return Cr(Cr({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return Cr(Cr({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Cr(Cr({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return Cr({},Sx);default:return e}}function g4(){}function kx(){return kx=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 vG=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,i=n.mod,l=n.shift,u=n.ctrl,p=n.keys,m=t.key,h=t.code,g=t.ctrlKey,x=t.metaKey,y=t.shiftKey,b=t.altKey,C=Vi(h),S=m.toLowerCase();if(!r){if(o===!b&&S!=="alt"||l===!y&&S!=="shift")return!1;if(i){if(!x&&!g)return!1}else if(s===!x&&S!=="meta"&&S!=="os"||u===!g&&S!=="ctrl"&&S!=="control")return!1}return p&&p.length===1&&(p.includes(S)||p.includes(C))?!0:p?_m(p):!p},xG=d.createContext(void 0),bG=function(){return d.useContext(xG)};function i6(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&&i6(e[r],t[r])},!0):e===t}var yG=d.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),CG=function(){return d.useContext(yG)};function wG(e){var t=d.useRef(void 0);return i6(t.current,e)||(t.current=e),t.current}var v4=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},SG=typeof window<"u"?d.useLayoutEffect:d.useEffect;function It(e,t,n,r){var o=d.useRef(null),s=d.useRef(!1),i=n instanceof Array?r instanceof Array?void 0:r:n,l=Py(e)?e.join(i==null?void 0:i.splitKey):e,u=n instanceof Array?n:r instanceof Array?r:void 0,p=d.useCallback(t,u??[]),m=d.useRef(p);u?m.current=p:m.current=t;var h=wG(i),g=CG(),x=g.enabledScopes,y=bG();return SG(function(){if(!((h==null?void 0:h.enabled)===!1||!gG(x,h==null?void 0:h.scopes))){var b=function(P,I){var M;if(I===void 0&&(I=!1),!(hG(P)&&!a6(P,h==null?void 0:h.enableOnFormTags))&&!(h!=null&&h.ignoreEventWhen!=null&&h.ignoreEventWhen(P))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){v4(P);return}(M=P.target)!=null&&M.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||Xv(l,h==null?void 0:h.splitKey).forEach(function(O){var A,D=Yv(O,h==null?void 0:h.combinationKey);if(vG(P,D,h==null?void 0:h.ignoreModifiers)||(A=D.keys)!=null&&A.includes("*")){if(I&&s.current)return;if(pG(P,D,h==null?void 0:h.preventDefault),!mG(P,D,h==null?void 0:h.enabled)){v4(P);return}m.current(P,D),I||(s.current=!0)}})}},C=function(P){P.key!==void 0&&(o6(Vi(P.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&b(P))},S=function(P){P.key!==void 0&&(s6(Vi(P.code)),s.current=!1,h!=null&&h.keyup&&b(P,!0))},j=o.current||(i==null?void 0:i.document)||document;return j.addEventListener("keyup",S),j.addEventListener("keydown",C),y&&Xv(l,h==null?void 0:h.splitKey).forEach(function(_){return y.addHotkey(Yv(_,h==null?void 0:h.combinationKey,h==null?void 0:h.description))}),function(){j.removeEventListener("keyup",S),j.removeEventListener("keydown",C),y&&Xv(l,h==null?void 0:h.splitKey).forEach(function(_){return y.removeHotkey(Yv(_,h==null?void 0:h.combinationKey,h==null?void 0:h.description))})}}},[l,h,x]),o}const kG=e=>{const{isDragAccept:t,isDragReject:n,setIsHandlingUpload:r}=e;return It("esc",()=>{r(!1)}),a.jsxs(De,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:[a.jsx($,{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($,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"full",height:"full",alignItems:"center",justifyContent:"center",p:4},children:a.jsx($,{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(xo,{size:"lg",children:"Drop to Upload"}):a.jsxs(a.Fragment,{children:[a.jsx(xo,{size:"lg",children:"Invalid Upload"}),a.jsx(xo,{size:"md",children:"Must be single JPEG or PNG image"})]})})})]})},jG=d.memo(kG),_G=ce([we,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}},je),IG=e=>{const{children:t}=e,{autoAddBoardId:n,postUploadAction:r}=W(_G),o=oc(),{t:s}=J(),[i,l]=d.useState(!1),[u]=_I(),p=d.useCallback(_=>{l(!0),o({title:s("toast.uploadFailed"),description:_.errors.map(P=>P.message).join(` `),status:"error"})},[s,o]),m=d.useCallback(async _=>{u({file:_,image_category:"user",is_intermediate:!1,postUploadAction:r,board_id:n==="none"?void 0:n})},[n,r,u]),h=d.useCallback((_,P)=>{if(P.length>1){o({title:s("toast.uploadFailed"),description:s("toast.uploadFailedInvalidUploadDesc"),status:"error"});return}P.forEach(I=>{p(I)}),_.forEach(I=>{m(I)})},[s,o,m,p]),g=d.useCallback(()=>{l(!0)},[]),{getRootProps:x,getInputProps:y,isDragAccept:b,isDragReject:C,isDragActive:S,inputRef:j}=Iy({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:h,onDragOver:g,multiple:!1});return d.useEffect(()=>{const _=async P=>{var I,M;j.current&&(I=P.clipboardData)!=null&&I.files&&(j.current.files=P.clipboardData.files,(M=j.current)==null||M.dispatchEvent(new Event("change",{bubbles:!0})))};return document.addEventListener("paste",_),()=>{document.removeEventListener("paste",_)}},[j]),a.jsxs(De,{...x({style:{}}),onKeyDown:_=>{_.key},children:[a.jsx("input",{...y()}),t,a.jsx(yo,{children:S&&i&&a.jsx(Mr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(jG,{isDragAccept:b,isDragReject:C,setIsHandlingUpload:l})},"image-upload-overlay")})]})},PG=d.memo(IG),EG=Oe((e,t)=>{const{children:n,tooltip:r="",tooltipProps:{placement:o="top",hasArrow:s=!0,...i}={},isChecked:l,...u}=e;return a.jsx(Fn,{label:r,placement:o,hasArrow:s,...i,children:a.jsx(el,{ref:t,colorScheme:l?"accent":"base",...u,children:n})})}),Mt=d.memo(EG);function MG(e){const t=d.createContext(null);return[({children:o,value:s})=>H.createElement(t.Provider,{value:s},o),()=>{const o=d.useContext(t);if(o===null)throw new Error(e);return o}]}function l6(e){return Array.isArray(e)?e:[e]}const OG=()=>{};function RG(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||OG:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function c6({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 u6(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==H.Fragment:!1}function d6(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 TG=vD({key:"mantine",prepend:!0});function NG(){return _P()||TG}var $G=Object.defineProperty,x4=Object.getOwnPropertySymbols,LG=Object.prototype.hasOwnProperty,zG=Object.prototype.propertyIsEnumerable,b4=(e,t,n)=>t in e?$G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FG=(e,t)=>{for(var n in t||(t={}))LG.call(t,n)&&b4(e,n,t[n]);if(x4)for(var n of x4(t))zG.call(t,n)&&b4(e,n,t[n]);return e};const Jv="ref";function BG(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(!(Jv in n))return{args:e,ref:t};t=n[Jv];const r=FG({},n);return delete r[Jv],{args:[r],ref:t}}const{cssFactory:HG}=(()=>{function e(n,r,o){const s=[],i=yD(n,s,o);return s.length<2?o:i+r(s)}function t(n){const{cache:r}=n,o=(...i)=>{const{ref:l,args:u}=BG(i),p=xD(u,r.registered);return bD(r,p,!1),`${r.key}-${p.name}${l===void 0?"":` ${l}`}`};return{css:o,cx:(...i)=>e(r.registered,o,f6(i))}}return{cssFactory:t}})();function p6(){const e=NG();return DG(()=>HG({cache:e}),[e])}function WG({cx:e,classes:t,context:n,classNames:r,name:o,cache:s}){const i=n.reduce((l,u)=>(Object.keys(u.classNames).forEach(p=>{typeof l[p]!="string"?l[p]=`${u.classNames[p]}`:l[p]=`${l[p]} ${u.classNames[p]}`}),l),{});return Object.keys(t).reduce((l,u)=>(l[u]=e(t[u],i[u],r!=null&&r[u],Array.isArray(o)?o.filter(Boolean).map(p=>`${(s==null?void 0:s.key)||"mantine"}-${p}-${u}`).join(" "):o?`${(s==null?void 0:s.key)||"mantine"}-${o}-${u}`:null),l),{})}var VG=Object.defineProperty,y4=Object.getOwnPropertySymbols,UG=Object.prototype.hasOwnProperty,GG=Object.prototype.propertyIsEnumerable,C4=(e,t,n)=>t in e?VG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zv=(e,t)=>{for(var n in t||(t={}))UG.call(t,n)&&C4(e,n,t[n]);if(y4)for(var n of y4(t))GG.call(t,n)&&C4(e,n,t[n]);return e};function jx(e,t){return t&&Object.keys(t).forEach(n=>{e[n]?e[n]=Zv(Zv({},e[n]),t[n]):e[n]=Zv({},t[n])}),e}function w4(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)=>jx(s,i),{}):o(e)}function qG({ctx:e,theme:t,params:n,variant:r,size:o}){return e.reduce((s,i)=>(i.variants&&r in i.variants&&jx(s,i.variants[r](t,n,{variant:r,size:o})),i.sizes&&o in i.sizes&&jx(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=Si(),i=u$(o==null?void 0:o.name),l=_P(),u={variant:o==null?void 0:o.variant,size:o==null?void 0:o.size},{css:p,cx:m}=p6(),h=t(s,r,u),g=w4(o==null?void 0:o.styles,s,r,u),x=w4(i,s,r,u),y=qG({ctx:i,theme:s,params:r,variant:o==null?void 0:o.variant,size:o==null?void 0:o.size}),b=Object.fromEntries(Object.keys(h).map(C=>{const S=m({[p(h[C])]:!(o!=null&&o.unstyled)},p(y[C]),p(x[C]),p(g[C]));return[C,S]}));return{classes:WG({cx:m,classes:b,context:i,classNames:o==null?void 0:o.classNames,name:o==null?void 0:o.name,cache:l}),cx:m,theme:s}}return n}function S4(e){return`___ref-${e||""}`}var KG=Object.defineProperty,QG=Object.defineProperties,XG=Object.getOwnPropertyDescriptors,k4=Object.getOwnPropertySymbols,YG=Object.prototype.hasOwnProperty,JG=Object.prototype.propertyIsEnumerable,j4=(e,t,n)=>t in e?KG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hd=(e,t)=>{for(var n in t||(t={}))YG.call(t,n)&&j4(e,n,t[n]);if(k4)for(var n of k4(t))JG.call(t,n)&&j4(e,n,t[n]);return e},gd=(e,t)=>QG(e,XG(t));const vd={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${Ge(10)})`},transitionProperty:"transform, opacity"},Wp={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:gd(hd({},vd),{common:{transformOrigin:"center center"}}),"pop-bottom-left":gd(hd({},vd),{common:{transformOrigin:"bottom left"}}),"pop-bottom-right":gd(hd({},vd),{common:{transformOrigin:"bottom right"}}),"pop-top-left":gd(hd({},vd),{common:{transformOrigin:"top left"}}),"pop-top-right":gd(hd({},vd),{common:{transformOrigin:"top right"}})},_4=["mousedown","touchstart"];function ZG(e,t,n){const r=d.useRef();return d.useEffect(()=>{const o=s=>{const{target:i}=s??{};if(Array.isArray(n)){const l=(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))&&!l&&e()}else r.current&&!r.current.contains(i)&&e()};return(t||_4).forEach(s=>document.addEventListener(s,o)),()=>{(t||_4).forEach(s=>document.removeEventListener(s,o))}},[r,e,n]),r}function eq(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function tq(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function nq(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=d.useState(n?t:tq(e,t)),s=d.useRef();return d.useEffect(()=>{if("matchMedia"in window)return s.current=window.matchMedia(e),o(s.current.matches),eq(s.current,i=>o(i.matches))},[e]),r}const m6=typeof document<"u"?d.useLayoutEffect:d.useEffect;function Js(e,t){const n=d.useRef(!1);d.useEffect(()=>()=>{n.current=!1},[]),d.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function rq({opened:e,shouldReturnFocus:t=!0}){const n=d.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 oq=/input|select|textarea|button|object/,h6="a, input, select, textarea, button, object, [tabindex]";function sq(e){return e.style.display==="none"}function aq(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(sq(n))return!1;n=n.parentNode}return!0}function g6(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function _x(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(g6(e));return(oq.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&aq(e)}function v6(e){const t=g6(e);return(Number.isNaN(t)||t>=0)&&_x(e)}function iq(e){return Array.from(e.querySelectorAll(h6)).filter(v6)}function lq(e,t){const n=iq(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 My(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function cq(e,t="body > :not(script)"){const n=My(),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"),l=o.getAttribute("data-hidden"),u=o.getAttribute("data-focus-id");return o.setAttribute("data-focus-id",n),i===null||i==="false"?o.setAttribute("aria-hidden","true"):!l&&!u&&o.setAttribute("data-hidden",i),{node:o,ariaHidden:l||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 uq(e=!0){const t=d.useRef(),n=d.useRef(null),r=s=>{let i=s.querySelector("[data-autofocus]");if(!i){const l=Array.from(s.querySelectorAll(h6));i=l.find(v6)||l.find(_x)||null,!i&&_x(s)&&(i=s)}i&&i.focus({preventScroll:!0})},o=d.useCallback(s=>{if(e){if(s===null){n.current&&(n.current(),n.current=null);return}n.current=cq(s),t.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&r(s)}),t.current=s):t.current=null)}},[e]);return d.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const s=i=>{i.key==="Tab"&&t.current&&lq(t.current,i)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),n.current&&n.current()}},[e]),o}const dq=H["useId".toString()]||(()=>{});function fq(){const e=dq();return e?`mantine-${e.replace(/:/g,"")}`:""}function Oy(e){const t=fq(),[n,r]=d.useState(t);return m6(()=>{r(My())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function I4(e,t,n){d.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 pq(...e){return t=>{e.forEach(n=>x6(n,t))}}function Nf(...e){return d.useCallback(pq(...e),e)}function Jd({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=d.useState(t!==void 0?t:n),i=l=>{s(l),r==null||r(l)};return e!==void 0?[e,r,!0]:[o,i,!1]}function b6(e,t){return nq("(prefers-reduced-motion: reduce)",e,t)}const mq=e=>e<.5?2*e*e:-1+(4-2*e)*e,hq=({axis:e,target:t,parent:n,alignment:r,offset:o,isList:s})=>{if(!t||!n&&typeof document>"u")return 0;const i=!!n,u=(n||document.body).getBoundingClientRect(),p=t.getBoundingClientRect(),m=h=>p[h]-u[h];if(e==="y"){const h=m("top");if(h===0)return 0;if(r==="start"){const x=h-o;return x<=p.height*(s?0:1)||!s?x:0}const g=i?u.height:window.innerHeight;if(r==="end"){const x=h+o-g+p.height;return x>=-p.height*(s?0:1)||!s?x:0}return r==="center"?h-g/2+p.height/2:0}if(e==="x"){const h=m("left");if(h===0)return 0;if(r==="start"){const x=h-o;return x<=p.width||!s?x:0}const g=i?u.width:window.innerWidth;if(r==="end"){const x=h+o-g+p.width;return x>=-p.width||!s?x:0}return r==="center"?h-g/2+p.width/2:0}return 0},gq=({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]},vq=({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 y6({duration:e=1250,axis:t="y",onScrollFinish:n,easing:r=mq,offset:o=0,cancelable:s=!0,isList:i=!1}={}){const l=d.useRef(0),u=d.useRef(0),p=d.useRef(!1),m=d.useRef(null),h=d.useRef(null),g=b6(),x=()=>{l.current&&cancelAnimationFrame(l.current)},y=d.useCallback(({alignment:C="start"}={})=>{var S;p.current=!1,l.current&&x();const j=(S=gq({parent:m.current,axis:t}))!=null?S:0,_=hq({parent:m.current,target:h.current,axis:t,alignment:C,offset:o,isList:i})-(m.current?0:j);function P(){u.current===0&&(u.current=performance.now());const M=performance.now()-u.current,O=g||e===0?1:M/e,A=j+_*r(O);vq({parent:m.current,axis:t,distance:A}),!p.current&&O<1?l.current=requestAnimationFrame(P):(typeof n=="function"&&n(),u.current=0,l.current=0,x())}P()},[t,e,r,i,o,n,g]),b=()=>{s&&(p.current=!0)};return I4("wheel",b,{passive:!0}),I4("touchmove",b,{passive:!0}),d.useEffect(()=>x,[]),{scrollableRef:m,targetRef:h,scrollIntoView:y,cancel:x}}var P4=Object.getOwnPropertySymbols,xq=Object.prototype.hasOwnProperty,bq=Object.prototype.propertyIsEnumerable,yq=(e,t)=>{var n={};for(var r in e)xq.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&P4)for(var r of P4(e))t.indexOf(r)<0&&bq.call(e,r)&&(n[r]=e[r]);return n};function zg(e){const t=e,{m:n,mx:r,my:o,mt:s,mb:i,ml:l,mr:u,p,px:m,py:h,pt:g,pb:x,pl:y,pr:b,bg:C,c:S,opacity:j,ff:_,fz:P,fw:I,lts:M,ta:O,lh:A,fs:D,tt:R,td:N,w:Y,miw:F,maw:V,h:Q,mih:q,mah:z,bgsz:G,bgp:T,bgr:B,bga:X,pos:re,top:le,left:se,bottom:K,right:U,inset:ee,display:de}=t,Z=yq(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:d$({m:n,mx:r,my:o,mt:s,mb:i,ml:l,mr:u,p,px:m,py:h,pt:g,pb:x,pl:y,pr:b,bg:C,c:S,opacity:j,ff:_,fz:P,fw:I,lts:M,ta:O,lh:A,fs:D,tt:R,td:N,w:Y,miw:F,maw:V,h:Q,mih:q,mah:z,bgsz:G,bgp:T,bgr:B,bga:X,pos:re,top:le,left:se,bottom:K,right:U,inset:ee,display:de}),rest:Z}}function Cq(e,t){const n=Object.keys(e).filter(r=>r!=="base").sort((r,o)=>gS(Xt({size:r,sizes:t.breakpoints}))-gS(Xt({size:o,sizes:t.breakpoints})));return"base"in e?["base",...n]:n}function wq({value:e,theme:t,getValue:n,property:r}){if(e==null)return;if(typeof e=="object")return Cq(e,t).reduce((i,l)=>{if(l==="base"&&e.base!==void 0){const p=n(e.base,t);return Array.isArray(r)?(r.forEach(m=>{i[m]=p}),i):(i[r]=p,i)}const u=n(e[l],t);return Array.isArray(r)?(i[t.fn.largerThan(l)]={},r.forEach(p=>{i[t.fn.largerThan(l)][p]=u}),i):(i[t.fn.largerThan(l)]={[r]:u},i)},{});const o=n(e,t);return Array.isArray(r)?r.reduce((s,i)=>(s[i]=o,s),{}):{[r]:o}}function Sq(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 kq(e){return Ge(e)}function jq(e){return e}function _q(e,t){return Xt({size:e,sizes:t.fontSizes})}const Iq=["-xs","-sm","-md","-lg","-xl"];function Pq(e,t){return Iq.includes(e)?`calc(${Xt({size:e.replace("-",""),sizes:t.spacing})} * -1)`:Xt({size:e,sizes:t.spacing})}const Eq={identity:jq,color:Sq,size:kq,fontSize:_q,spacing:Pq},Mq={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 Oq=Object.defineProperty,E4=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Aq=Object.prototype.propertyIsEnumerable,M4=(e,t,n)=>t in e?Oq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O4=(e,t)=>{for(var n in t||(t={}))Rq.call(t,n)&&M4(e,n,t[n]);if(E4)for(var n of E4(t))Aq.call(t,n)&&M4(e,n,t[n]);return e};function R4(e,t,n=Mq){return Object.keys(n).reduce((o,s)=>(s in e&&e[s]!==void 0&&o.push(wq({value:e[s],getValue:Eq[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]=O4(O4({},o[i]),s[i]):o[i]=s[i]}),o),{})}function A4(e,t){return typeof e=="function"?e(t):e}function Dq(e,t,n){const r=Si(),{css:o,cx:s}=p6();return Array.isArray(e)?s(n,o(R4(t,r)),e.map(i=>o(A4(i,r)))):s(n,o(A4(e,r)),o(R4(t,r)))}var Tq=Object.defineProperty,eh=Object.getOwnPropertySymbols,C6=Object.prototype.hasOwnProperty,w6=Object.prototype.propertyIsEnumerable,D4=(e,t,n)=>t in e?Tq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nq=(e,t)=>{for(var n in t||(t={}))C6.call(t,n)&&D4(e,n,t[n]);if(eh)for(var n of eh(t))w6.call(t,n)&&D4(e,n,t[n]);return e},$q=(e,t)=>{var n={};for(var r in e)C6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&eh)for(var r of eh(e))t.indexOf(r)<0&&w6.call(e,r)&&(n[r]=e[r]);return n};const S6=d.forwardRef((e,t)=>{var n=e,{className:r,component:o,style:s,sx:i}=n,l=$q(n,["className","component","style","sx"]);const{systemStyles:u,rest:p}=zg(l),m=o||"div";return H.createElement(m,Nq({ref:t,className:Dq(i,u,r),style:s},p))});S6.displayName="@mantine/core/Box";const Go=S6;var Lq=Object.defineProperty,zq=Object.defineProperties,Fq=Object.getOwnPropertyDescriptors,T4=Object.getOwnPropertySymbols,Bq=Object.prototype.hasOwnProperty,Hq=Object.prototype.propertyIsEnumerable,N4=(e,t,n)=>t in e?Lq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$4=(e,t)=>{for(var n in t||(t={}))Bq.call(t,n)&&N4(e,n,t[n]);if(T4)for(var n of T4(t))Hq.call(t,n)&&N4(e,n,t[n]);return e},Wq=(e,t)=>zq(e,Fq(t)),Vq=Co(e=>({root:Wq($4($4({},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 Uq=Vq;var Gq=Object.defineProperty,th=Object.getOwnPropertySymbols,k6=Object.prototype.hasOwnProperty,j6=Object.prototype.propertyIsEnumerable,L4=(e,t,n)=>t in e?Gq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qq=(e,t)=>{for(var n in t||(t={}))k6.call(t,n)&&L4(e,n,t[n]);if(th)for(var n of th(t))j6.call(t,n)&&L4(e,n,t[n]);return e},Kq=(e,t)=>{var n={};for(var r in e)k6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&th)for(var r of th(e))t.indexOf(r)<0&&j6.call(e,r)&&(n[r]=e[r]);return n};const _6=d.forwardRef((e,t)=>{const n=Nr("UnstyledButton",{},e),{className:r,component:o="button",unstyled:s,variant:i}=n,l=Kq(n,["className","component","unstyled","variant"]),{classes:u,cx:p}=Uq(null,{name:"UnstyledButton",unstyled:s,variant:i});return H.createElement(Go,qq({component:o,ref:t,className:p(u.root,r),type:o==="button"?"button":void 0},l))});_6.displayName="@mantine/core/UnstyledButton";const Qq=_6;var Xq=Object.defineProperty,Yq=Object.defineProperties,Jq=Object.getOwnPropertyDescriptors,z4=Object.getOwnPropertySymbols,Zq=Object.prototype.hasOwnProperty,eK=Object.prototype.propertyIsEnumerable,F4=(e,t,n)=>t in e?Xq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ix=(e,t)=>{for(var n in t||(t={}))Zq.call(t,n)&&F4(e,n,t[n]);if(z4)for(var n of z4(t))eK.call(t,n)&&F4(e,n,t[n]);return e},B4=(e,t)=>Yq(e,Jq(t));const tK=["subtle","filled","outline","light","default","transparent","gradient"],Vp={xs:Ge(18),sm:Ge(22),md:Ge(28),lg:Ge(34),xl:Ge(44)};function nK({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%"})}:tK.includes(e)?Ix({border:`${Ge(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover})):null}var rK=Co((e,{radius:t,color:n,gradient:r},{variant:o,size:s})=>({root:B4(Ix({position:"relative",borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",height:Xt({size:s,sizes:Vp}),minHeight:Xt({size:s,sizes:Vp}),width:Xt({size:s,sizes:Vp}),minWidth:Xt({size:s,sizes:Vp})},nK({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":B4(Ix({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 oK=rK;var sK=Object.defineProperty,nh=Object.getOwnPropertySymbols,I6=Object.prototype.hasOwnProperty,P6=Object.prototype.propertyIsEnumerable,H4=(e,t,n)=>t in e?sK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W4=(e,t)=>{for(var n in t||(t={}))I6.call(t,n)&&H4(e,n,t[n]);if(nh)for(var n of nh(t))P6.call(t,n)&&H4(e,n,t[n]);return e},V4=(e,t)=>{var n={};for(var r in e)I6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&nh)for(var r of nh(e))t.indexOf(r)<0&&P6.call(e,r)&&(n[r]=e[r]);return n};function aK(e){var t=e,{size:n,color:r}=t,o=V4(t,["size","color"]);const s=o,{style:i}=s,l=V4(s,["style"]);return H.createElement("svg",W4({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:r,style:W4({width:n},i)},l),H.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},H.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"}),H.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"})),H.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},H.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"}),H.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"})),H.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},H.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"}),H.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"})),H.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},H.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"}),H.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 iK=Object.defineProperty,rh=Object.getOwnPropertySymbols,E6=Object.prototype.hasOwnProperty,M6=Object.prototype.propertyIsEnumerable,U4=(e,t,n)=>t in e?iK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G4=(e,t)=>{for(var n in t||(t={}))E6.call(t,n)&&U4(e,n,t[n]);if(rh)for(var n of rh(t))M6.call(t,n)&&U4(e,n,t[n]);return e},q4=(e,t)=>{var n={};for(var r in e)E6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&rh)for(var r of rh(e))t.indexOf(r)<0&&M6.call(e,r)&&(n[r]=e[r]);return n};function lK(e){var t=e,{size:n,color:r}=t,o=q4(t,["size","color"]);const s=o,{style:i}=s,l=q4(s,["style"]);return H.createElement("svg",G4({viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:r,style:G4({width:n,height:n},i)},l),H.createElement("g",{fill:"none",fillRule:"evenodd"},H.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},H.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),H.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},H.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}var cK=Object.defineProperty,oh=Object.getOwnPropertySymbols,O6=Object.prototype.hasOwnProperty,R6=Object.prototype.propertyIsEnumerable,K4=(e,t,n)=>t in e?cK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q4=(e,t)=>{for(var n in t||(t={}))O6.call(t,n)&&K4(e,n,t[n]);if(oh)for(var n of oh(t))R6.call(t,n)&&K4(e,n,t[n]);return e},X4=(e,t)=>{var n={};for(var r in e)O6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&oh)for(var r of oh(e))t.indexOf(r)<0&&R6.call(e,r)&&(n[r]=e[r]);return n};function uK(e){var t=e,{size:n,color:r}=t,o=X4(t,["size","color"]);const s=o,{style:i}=s,l=X4(s,["style"]);return H.createElement("svg",Q4({viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:r,style:Q4({width:n},i)},l),H.createElement("circle",{cx:"15",cy:"15",r:"15"},H.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},H.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("circle",{cx:"105",cy:"15",r:"15"},H.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var dK=Object.defineProperty,sh=Object.getOwnPropertySymbols,A6=Object.prototype.hasOwnProperty,D6=Object.prototype.propertyIsEnumerable,Y4=(e,t,n)=>t in e?dK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fK=(e,t)=>{for(var n in t||(t={}))A6.call(t,n)&&Y4(e,n,t[n]);if(sh)for(var n of sh(t))D6.call(t,n)&&Y4(e,n,t[n]);return e},pK=(e,t)=>{var n={};for(var r in e)A6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&sh)for(var r of sh(e))t.indexOf(r)<0&&D6.call(e,r)&&(n[r]=e[r]);return n};const e1={bars:aK,oval:lK,dots:uK},mK={xs:Ge(18),sm:Ge(22),md:Ge(36),lg:Ge(44),xl:Ge(58)},hK={size:"md"};function T6(e){const t=Nr("Loader",hK,e),{size:n,color:r,variant:o}=t,s=pK(t,["size","color","variant"]),i=Si(),l=o in e1?o:i.loader;return H.createElement(Go,fK({role:"presentation",component:e1[l]||e1.bars,size:Xt({size:n,sizes:mK}),color:i.fn.variant({variant:"filled",primaryFallback:!1,color:r||i.primaryColor}).background},s))}T6.displayName="@mantine/core/Loader";var gK=Object.defineProperty,ah=Object.getOwnPropertySymbols,N6=Object.prototype.hasOwnProperty,$6=Object.prototype.propertyIsEnumerable,J4=(e,t,n)=>t in e?gK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Z4=(e,t)=>{for(var n in t||(t={}))N6.call(t,n)&&J4(e,n,t[n]);if(ah)for(var n of ah(t))$6.call(t,n)&&J4(e,n,t[n]);return e},vK=(e,t)=>{var n={};for(var r in e)N6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ah)for(var r of ah(e))t.indexOf(r)<0&&$6.call(e,r)&&(n[r]=e[r]);return n};const xK={color:"gray",size:"md",variant:"subtle"},L6=d.forwardRef((e,t)=>{const n=Nr("ActionIcon",xK,e),{className:r,color:o,children:s,radius:i,size:l,variant:u,gradient:p,disabled:m,loaderProps:h,loading:g,unstyled:x,__staticSelector:y}=n,b=vK(n,["className","color","children","radius","size","variant","gradient","disabled","loaderProps","loading","unstyled","__staticSelector"]),{classes:C,cx:S,theme:j}=oK({radius:i,color:o,gradient:p},{name:["ActionIcon",y],unstyled:x,size:l,variant:u}),_=H.createElement(T6,Z4({color:j.fn.variant({color:o,variant:u}).color,size:"100%","data-action-icon-loader":!0},h));return H.createElement(Qq,Z4({className:S(C.root,r),ref:t,disabled:m,"data-disabled":m||void 0,"data-loading":g||void 0,unstyled:x},b),g?_:s)});L6.displayName="@mantine/core/ActionIcon";const bK=L6;var yK=Object.defineProperty,CK=Object.defineProperties,wK=Object.getOwnPropertyDescriptors,ih=Object.getOwnPropertySymbols,z6=Object.prototype.hasOwnProperty,F6=Object.prototype.propertyIsEnumerable,ek=(e,t,n)=>t in e?yK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SK=(e,t)=>{for(var n in t||(t={}))z6.call(t,n)&&ek(e,n,t[n]);if(ih)for(var n of ih(t))F6.call(t,n)&&ek(e,n,t[n]);return e},kK=(e,t)=>CK(e,wK(t)),jK=(e,t)=>{var n={};for(var r in e)z6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ih)for(var r of ih(e))t.indexOf(r)<0&&F6.call(e,r)&&(n[r]=e[r]);return n};function B6(e){const t=Nr("Portal",{},e),{children:n,target:r,className:o,innerRef:s}=t,i=jK(t,["children","target","className","innerRef"]),l=Si(),[u,p]=d.useState(!1),m=d.useRef();return m6(()=>(p(!0),m.current=r?typeof r=="string"?document.querySelector(r):r:document.createElement("div"),r||document.body.appendChild(m.current),()=>{!r&&document.body.removeChild(m.current)}),[r]),u?rs.createPortal(H.createElement("div",kK(SK({className:o,dir:l.dir},i),{ref:s}),n),m.current):null}B6.displayName="@mantine/core/Portal";var _K=Object.defineProperty,lh=Object.getOwnPropertySymbols,H6=Object.prototype.hasOwnProperty,W6=Object.prototype.propertyIsEnumerable,tk=(e,t,n)=>t in e?_K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,IK=(e,t)=>{for(var n in t||(t={}))H6.call(t,n)&&tk(e,n,t[n]);if(lh)for(var n of lh(t))W6.call(t,n)&&tk(e,n,t[n]);return e},PK=(e,t)=>{var n={};for(var r in e)H6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&lh)for(var r of lh(e))t.indexOf(r)<0&&W6.call(e,r)&&(n[r]=e[r]);return n};function V6(e){var t=e,{withinPortal:n=!0,children:r}=t,o=PK(t,["withinPortal","children"]);return n?H.createElement(B6,IK({},o),r):H.createElement(H.Fragment,null,r)}V6.displayName="@mantine/core/OptionalPortal";var EK=Object.defineProperty,ch=Object.getOwnPropertySymbols,U6=Object.prototype.hasOwnProperty,G6=Object.prototype.propertyIsEnumerable,nk=(e,t,n)=>t in e?EK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rk=(e,t)=>{for(var n in t||(t={}))U6.call(t,n)&&nk(e,n,t[n]);if(ch)for(var n of ch(t))G6.call(t,n)&&nk(e,n,t[n]);return e},MK=(e,t)=>{var n={};for(var r in e)U6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ch)for(var r of ch(e))t.indexOf(r)<0&&G6.call(e,r)&&(n[r]=e[r]);return n};function q6(e){const t=e,{width:n,height:r,style:o}=t,s=MK(t,["width","height","style"]);return H.createElement("svg",rk({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:rk({width:n,height:r},o)},s),H.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"}))}q6.displayName="@mantine/core/CloseIcon";var OK=Object.defineProperty,uh=Object.getOwnPropertySymbols,K6=Object.prototype.hasOwnProperty,Q6=Object.prototype.propertyIsEnumerable,ok=(e,t,n)=>t in e?OK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,RK=(e,t)=>{for(var n in t||(t={}))K6.call(t,n)&&ok(e,n,t[n]);if(uh)for(var n of uh(t))Q6.call(t,n)&&ok(e,n,t[n]);return e},AK=(e,t)=>{var n={};for(var r in e)K6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&uh)for(var r of uh(e))t.indexOf(r)<0&&Q6.call(e,r)&&(n[r]=e[r]);return n};const DK={xs:Ge(12),sm:Ge(16),md:Ge(20),lg:Ge(28),xl:Ge(34)},TK={size:"sm"},X6=d.forwardRef((e,t)=>{const n=Nr("CloseButton",TK,e),{iconSize:r,size:o,children:s}=n,i=AK(n,["iconSize","size","children"]),l=Ge(r||DK[o]);return H.createElement(bK,RK({ref:t,__staticSelector:"CloseButton",size:o},i),s||H.createElement(q6,{width:l,height:l}))});X6.displayName="@mantine/core/CloseButton";const Y6=X6;var NK=Object.defineProperty,$K=Object.defineProperties,LK=Object.getOwnPropertyDescriptors,sk=Object.getOwnPropertySymbols,zK=Object.prototype.hasOwnProperty,FK=Object.prototype.propertyIsEnumerable,ak=(e,t,n)=>t in e?NK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Up=(e,t)=>{for(var n in t||(t={}))zK.call(t,n)&&ak(e,n,t[n]);if(sk)for(var n of sk(t))FK.call(t,n)&&ak(e,n,t[n]);return e},BK=(e,t)=>$K(e,LK(t));function HK({underline:e,strikethrough:t}){const n=[];return e&&n.push("underline"),t&&n.push("line-through"),n.length>0?n.join(" "):"none"}function WK({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 VK(e){return typeof e=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}function UK({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 GK=Co((e,{color:t,lineClamp:n,truncate:r,inline:o,inherit:s,underline:i,gradient:l,weight:u,transform:p,align:m,strikethrough:h,italic:g},{size:x})=>{const y=e.fn.variant({variant:"gradient",gradient:l});return{root:BK(Up(Up(Up(Up({},e.fn.fontStyles()),e.fn.focusStyles()),VK(n)),UK({theme:e,truncate:r})),{color:WK({color:t,theme:e}),fontFamily:s?"inherit":e.fontFamily,fontSize:s||x===void 0?"inherit":Xt({size:x,sizes:e.fontSizes}),lineHeight:s?"inherit":o?1:e.lineHeight,textDecoration:HK({underline:i,strikethrough:h}),WebkitTapHighlightColor:"transparent",fontWeight:s?"inherit":u,textTransform:p,textAlign:m,fontStyle:g?"italic":void 0}),gradient:{backgroundImage:y.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}});const qK=GK;var KK=Object.defineProperty,dh=Object.getOwnPropertySymbols,J6=Object.prototype.hasOwnProperty,Z6=Object.prototype.propertyIsEnumerable,ik=(e,t,n)=>t in e?KK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QK=(e,t)=>{for(var n in t||(t={}))J6.call(t,n)&&ik(e,n,t[n]);if(dh)for(var n of dh(t))Z6.call(t,n)&&ik(e,n,t[n]);return e},XK=(e,t)=>{var n={};for(var r in e)J6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&dh)for(var r of dh(e))t.indexOf(r)<0&&Z6.call(e,r)&&(n[r]=e[r]);return n};const YK={variant:"text"},eE=d.forwardRef((e,t)=>{const n=Nr("Text",YK,e),{className:r,size:o,weight:s,transform:i,color:l,align:u,variant:p,lineClamp:m,truncate:h,gradient:g,inline:x,inherit:y,underline:b,strikethrough:C,italic:S,classNames:j,styles:_,unstyled:P,span:I,__staticSelector:M}=n,O=XK(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}=qK({color:l,lineClamp:m,truncate:h,inline:x,inherit:y,underline:b,strikethrough:C,italic:S,weight:s,transform:i,align:u,gradient:g},{unstyled:P,name:M||"Text",variant:p,size:o});return H.createElement(Go,QK({ref:t,className:D(A.root,{[A.gradient]:p==="gradient"},r),component:I?"span":"div"},O))});eE.displayName="@mantine/core/Text";const vu=eE,Gp={xs:Ge(1),sm:Ge(2),md:Ge(3),lg:Ge(4),xl:Ge(5)};function qp(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 JK=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:Gp})} ${r} ${qp(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${Xt({size:n,sizes:Gp})} ${r} ${qp(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:Gp})),borderTopColor:qp(e,t),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"auto",borderLeftWidth:Ge(Xt({size:n,sizes:Gp})),borderLeftColor:qp(e,t),borderLeftStyle:r}}));const ZK=JK;var eQ=Object.defineProperty,tQ=Object.defineProperties,nQ=Object.getOwnPropertyDescriptors,fh=Object.getOwnPropertySymbols,tE=Object.prototype.hasOwnProperty,nE=Object.prototype.propertyIsEnumerable,lk=(e,t,n)=>t in e?eQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ck=(e,t)=>{for(var n in t||(t={}))tE.call(t,n)&&lk(e,n,t[n]);if(fh)for(var n of fh(t))nE.call(t,n)&&lk(e,n,t[n]);return e},rQ=(e,t)=>tQ(e,nQ(t)),oQ=(e,t)=>{var n={};for(var r in e)tE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&fh)for(var r of fh(e))t.indexOf(r)<0&&nE.call(e,r)&&(n[r]=e[r]);return n};const sQ={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},Px=d.forwardRef((e,t)=>{const n=Nr("Divider",sQ,e),{className:r,color:o,orientation:s,size:i,label:l,labelPosition:u,labelProps:p,variant:m,styles:h,classNames:g,unstyled:x}=n,y=oQ(n,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames","unstyled"]),{classes:b,cx:C}=ZK({color:o},{classNames:g,styles:h,unstyled:x,name:"Divider",variant:m,size:i}),S=s==="vertical",j=s==="horizontal",_=!!l&&j,P=!(p!=null&&p.color);return H.createElement(Go,ck({ref:t,className:C(b.root,{[b.vertical]:S,[b.horizontal]:j,[b.withLabel]:_},r),role:"separator"},y),_&&H.createElement(vu,rQ(ck({},p),{size:(p==null?void 0:p.size)||"xs",mt:Ge(2),className:C(b.label,b[u],{[b.labelDefaultStyles]:P})}),l))});Px.displayName="@mantine/core/Divider";var aQ=Object.defineProperty,iQ=Object.defineProperties,lQ=Object.getOwnPropertyDescriptors,uk=Object.getOwnPropertySymbols,cQ=Object.prototype.hasOwnProperty,uQ=Object.prototype.propertyIsEnumerable,dk=(e,t,n)=>t in e?aQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fk=(e,t)=>{for(var n in t||(t={}))cQ.call(t,n)&&dk(e,n,t[n]);if(uk)for(var n of uk(t))uQ.call(t,n)&&dk(e,n,t[n]);return e},dQ=(e,t)=>iQ(e,lQ(t)),fQ=Co((e,t,{size:n})=>({item:dQ(fk({},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]":fk({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 pQ=fQ;var mQ=Object.defineProperty,pk=Object.getOwnPropertySymbols,hQ=Object.prototype.hasOwnProperty,gQ=Object.prototype.propertyIsEnumerable,mk=(e,t,n)=>t in e?mQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vQ=(e,t)=>{for(var n in t||(t={}))hQ.call(t,n)&&mk(e,n,t[n]);if(pk)for(var n of pk(t))gQ.call(t,n)&&mk(e,n,t[n]);return e};function Ry({data:e,hovered:t,classNames:n,styles:r,isItemSelected:o,uuid:s,__staticSelector:i,onItemHover:l,onItemSelect:u,itemsRefs:p,itemComponent:m,size:h,nothingFound:g,creatable:x,createLabel:y,unstyled:b,variant:C}){const{classes:S}=pQ(null,{classNames:n,styles:r,unstyled:b,name:i,variant:C,size:h}),j=[],_=[];let P=null;const I=(O,A)=>{const D=typeof o=="function"?o(O.value):!1;return H.createElement(m,vQ({key:O.value,className:S.item,"data-disabled":O.disabled||void 0,"data-hovered":!O.disabled&&t===A||void 0,"data-selected":!O.disabled&&D||void 0,selected:D,onMouseEnter:()=>l(A),id:`${s}-${A}`,role:"option",tabIndex:-1,"aria-selected":t===A,ref:R=>{p&&p.current&&(p.current[O.value]=R)},onMouseDown:O.disabled?null:R=>{R.preventDefault(),u(O)},disabled:O.disabled,variant:C},O))};let M=null;if(e.forEach((O,A)=>{O.creatable?P=A:O.group?(M!==O.group&&(M=O.group,_.push(H.createElement("div",{className:S.separator,key:`__mantine-divider-${A}`},H.createElement(Px,{classNames:{label:S.separatorLabel},label:O.group})))),_.push(I(O,A))):j.push(I(O,A))}),x){const O=e[P];j.push(H.createElement("div",{key:My(),className:S.item,"data-hovered":t===P||void 0,onMouseEnter:()=>l(P),onMouseDown:A=>{A.preventDefault(),u(O)},tabIndex:-1,ref:A=>{p&&p.current&&(p.current[O.value]=A)}},y))}return _.length>0&&j.length>0&&j.unshift(H.createElement("div",{className:S.separator,key:"empty-group-separator"},H.createElement(Px,null))),_.length>0||j.length>0?H.createElement(H.Fragment,null,_,j):H.createElement(vu,{size:h,unstyled:b,className:S.nothingFound},g)}Ry.displayName="@mantine/core/SelectItems";var xQ=Object.defineProperty,ph=Object.getOwnPropertySymbols,rE=Object.prototype.hasOwnProperty,oE=Object.prototype.propertyIsEnumerable,hk=(e,t,n)=>t in e?xQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bQ=(e,t)=>{for(var n in t||(t={}))rE.call(t,n)&&hk(e,n,t[n]);if(ph)for(var n of ph(t))oE.call(t,n)&&hk(e,n,t[n]);return e},yQ=(e,t)=>{var n={};for(var r in e)rE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ph)for(var r of ph(e))t.indexOf(r)<0&&oE.call(e,r)&&(n[r]=e[r]);return n};const Ay=d.forwardRef((e,t)=>{var n=e,{label:r,value:o}=n,s=yQ(n,["label","value"]);return H.createElement("div",bQ({ref:t},s),r||o)});Ay.displayName="@mantine/core/DefaultItem";function CQ(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function sE(...e){return t=>e.forEach(n=>CQ(n,t))}function sc(...e){return d.useCallback(sE(...e),e)}const aE=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(SQ);if(s){const i=s.props.children,l=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return d.createElement(Ex,hr({},r,{ref:t}),d.isValidElement(i)?d.cloneElement(i,void 0,l):null)}return d.createElement(Ex,hr({},r,{ref:t}),n)});aE.displayName="Slot";const Ex=d.forwardRef((e,t)=>{const{children:n,...r}=e;return d.isValidElement(n)?d.cloneElement(n,{...kQ(r,n.props),ref:sE(t,n.ref)}):d.Children.count(n)>1?d.Children.only(null):null});Ex.displayName="SlotClone";const wQ=({children:e})=>d.createElement(d.Fragment,null,e);function SQ(e){return d.isValidElement(e)&&e.type===wQ}function kQ(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]=(...l)=>{s(...l),o(...l)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}const jQ=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],$f=jQ.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,l=s?aE:t;return d.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),d.createElement(l,hr({},i,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Mx=globalThis!=null&&globalThis.document?d.useLayoutEffect:()=>{};function _Q(e,t){return d.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Lf=e=>{const{present:t,children:n}=e,r=IQ(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=sc(r.ref,o.ref);return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};Lf.displayName="Presence";function IQ(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[l,u]=_Q(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const p=Kp(r.current);s.current=l==="mounted"?p:"none"},[l]),Mx(()=>{const p=r.current,m=o.current;if(m!==e){const g=s.current,x=Kp(p);e?u("MOUNT"):x==="none"||(p==null?void 0:p.display)==="none"?u("UNMOUNT"):u(m&&g!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),Mx(()=>{if(t){const p=h=>{const x=Kp(r.current).includes(h.animationName);h.target===t&&x&&rs.flushSync(()=>u("ANIMATION_END"))},m=h=>{h.target===t&&(s.current=Kp(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:d.useCallback(p=>{p&&(r.current=getComputedStyle(p)),n(p)},[])}}function Kp(e){return(e==null?void 0:e.animationName)||"none"}function PQ(e,t=[]){let n=[];function r(s,i){const l=d.createContext(i),u=n.length;n=[...n,i];function p(h){const{scope:g,children:x,...y}=h,b=(g==null?void 0:g[e][u])||l,C=d.useMemo(()=>y,Object.values(y));return d.createElement(b.Provider,{value:C},x)}function m(h,g){const x=(g==null?void 0:g[e][u])||l,y=d.useContext(x);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${s}\``)}return p.displayName=s+"Provider",[p,m]}const o=()=>{const s=n.map(i=>d.createContext(i));return function(l){const u=(l==null?void 0:l[e])||s;return d.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return o.scopeName=e,[r,EQ(o,...t)]}function EQ(...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((l,{useScope:u,scopeName:p})=>{const h=u(s)[`__scope${p}`];return{...l,...h}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function El(e){const t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const MQ=d.createContext(void 0);function OQ(e){const t=d.useContext(MQ);return e||t||"ltr"}function RQ(e,[t,n]){return Math.min(n,Math.max(t,e))}function Nl(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 AQ(e,t){return d.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const iE="ScrollArea",[lE,gxe]=PQ(iE),[DQ,As]=lE(iE),TQ=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[l,u]=d.useState(null),[p,m]=d.useState(null),[h,g]=d.useState(null),[x,y]=d.useState(null),[b,C]=d.useState(null),[S,j]=d.useState(0),[_,P]=d.useState(0),[I,M]=d.useState(!1),[O,A]=d.useState(!1),D=sc(t,N=>u(N)),R=OQ(o);return d.createElement(DQ,{scope:n,type:r,dir:R,scrollHideDelay:s,scrollArea:l,viewport:p,onViewportChange:m,content:h,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:I,onScrollbarXEnabledChange:M,scrollbarY:b,onScrollbarYChange:C,scrollbarYEnabled:O,onScrollbarYEnabledChange:A,onCornerWidthChange:j,onCornerHeightChange:P},d.createElement($f.div,hr({dir:R},i,{ref:D,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})))}),NQ="ScrollAreaViewport",$Q=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,s=As(NQ,n),i=d.useRef(null),l=sc(t,i,s.onViewportChange);return d.createElement(d.Fragment,null,d.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}"}}),d.createElement($f.div,hr({"data-radix-scroll-area-viewport":""},o,{ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style}}),d.createElement("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),ji="ScrollAreaScrollbar",LQ=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=As(ji,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,l=e.orientation==="horizontal";return d.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),o.type==="hover"?d.createElement(zQ,hr({},r,{ref:t,forceMount:n})):o.type==="scroll"?d.createElement(FQ,hr({},r,{ref:t,forceMount:n})):o.type==="auto"?d.createElement(cE,hr({},r,{ref:t,forceMount:n})):o.type==="always"?d.createElement(Dy,hr({},r,{ref:t})):null}),zQ=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=As(ji,e.__scopeScrollArea),[s,i]=d.useState(!1);return d.useEffect(()=>{const l=o.scrollArea;let u=0;if(l){const p=()=>{window.clearTimeout(u),i(!0)},m=()=>{u=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",p),l.addEventListener("pointerleave",m),()=>{window.clearTimeout(u),l.removeEventListener("pointerenter",p),l.removeEventListener("pointerleave",m)}}},[o.scrollArea,o.scrollHideDelay]),d.createElement(Lf,{present:n||s},d.createElement(cE,hr({"data-state":s?"visible":"hidden"},r,{ref:t})))}),FQ=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=As(ji,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Bg(()=>u("SCROLL_END"),100),[l,u]=AQ("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 d.useEffect(()=>{if(l==="idle"){const p=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[l,o.scrollHideDelay,u]),d.useEffect(()=>{const p=o.viewport,m=s?"scrollLeft":"scrollTop";if(p){let h=p[m];const g=()=>{const x=p[m];h!==x&&(u("SCROLL"),i()),h=x};return p.addEventListener("scroll",g),()=>p.removeEventListener("scroll",g)}},[o.viewport,s,u,i]),d.createElement(Lf,{present:n||l!=="hidden"},d.createElement(Dy,hr({"data-state":l==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:Nl(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:Nl(e.onPointerLeave,()=>u("POINTER_LEAVE"))})))}),cE=d.forwardRef((e,t)=>{const n=As(ji,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=d.useState(!1),l=e.orientation==="horizontal",u=Bg(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=As(ji,e.__scopeScrollArea),s=d.useRef(null),i=d.useRef(0),[l,u]=d.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=pE(l.viewport,l.content),m={...r,sizes:l,onSizesChange:u,hasThumb:p>0&&p<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:g=>i.current=g};function h(g,x){return KQ(g,i.current,l,x)}return n==="horizontal"?d.createElement(BQ,hr({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollLeft,x=gk(g,l,o.dir);s.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollLeft=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollLeft=h(g,o.dir))}})):n==="vertical"?d.createElement(HQ,hr({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollTop,x=gk(g,l);s.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollTop=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollTop=h(g))}})):null}),BQ=d.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=As(ji,e.__scopeScrollArea),[i,l]=d.useState(),u=d.useRef(null),p=sc(t,u,s.onScrollbarXChange);return d.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),d.createElement(dE,hr({"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":Fg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,h)=>{if(s.viewport){const g=s.viewport.scrollLeft+m.deltaX;e.onWheelScroll(g),hE(g,h)&&m.preventDefault()}},onResize:()=>{u.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:mh(i.paddingLeft),paddingEnd:mh(i.paddingRight)}})}}))}),HQ=d.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=As(ji,e.__scopeScrollArea),[i,l]=d.useState(),u=d.useRef(null),p=sc(t,u,s.onScrollbarYChange);return d.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),d.createElement(dE,hr({"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":Fg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,h)=>{if(s.viewport){const g=s.viewport.scrollTop+m.deltaY;e.onWheelScroll(g),hE(g,h)&&m.preventDefault()}},onResize:()=>{u.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:mh(i.paddingTop),paddingEnd:mh(i.paddingBottom)}})}}))}),[WQ,uE]=lE(ji),dE=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:u,onDragScroll:p,onWheelScroll:m,onResize:h,...g}=e,x=As(ji,n),[y,b]=d.useState(null),C=sc(t,D=>b(D)),S=d.useRef(null),j=d.useRef(""),_=x.viewport,P=r.content-r.viewport,I=El(m),M=El(u),O=Bg(h,10);function A(D){if(S.current){const R=D.clientX-S.current.left,N=D.clientY-S.current.top;p({x:R,y:N})}}return d.useEffect(()=>{const D=R=>{const N=R.target;(y==null?void 0:y.contains(N))&&I(R,P)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[_,y,P,I]),d.useEffect(M,[r,M]),xu(y,O),xu(x.content,O),d.createElement(WQ,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:El(s),onThumbPointerUp:El(i),onThumbPositionChange:M,onThumbPointerDown:El(l)},d.createElement($f.div,hr({},g,{ref:C,style:{position:"absolute",...g.style},onPointerDown:Nl(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:Nl(e.onPointerMove,A),onPointerUp:Nl(e.onPointerUp,D=>{const R=D.target;R.hasPointerCapture(D.pointerId)&&R.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=j.current,S.current=null})})))}),Ox="ScrollAreaThumb",VQ=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=uE(Ox,e.__scopeScrollArea);return d.createElement(Lf,{present:n||o.hasThumb},d.createElement(UQ,hr({ref:t},r)))}),UQ=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=As(Ox,n),i=uE(Ox,n),{onThumbPositionChange:l}=i,u=sc(t,h=>i.onThumbChange(h)),p=d.useRef(),m=Bg(()=>{p.current&&(p.current(),p.current=void 0)},100);return d.useEffect(()=>{const h=s.viewport;if(h){const g=()=>{if(m(),!p.current){const x=QQ(h,l);p.current=x,l()}};return l(),h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,m,l]),d.createElement($f.div,hr({"data-state":i.hasThumb?"visible":"hidden"},o,{ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Nl(e.onPointerDownCapture,h=>{const x=h.target.getBoundingClientRect(),y=h.clientX-x.left,b=h.clientY-x.top;i.onThumbPointerDown({x:y,y:b})}),onPointerUp:Nl(e.onPointerUp,i.onThumbPointerUp)}))}),fE="ScrollAreaCorner",GQ=d.forwardRef((e,t)=>{const n=As(fE,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?d.createElement(qQ,hr({},e,{ref:t})):null}),qQ=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=As(fE,n),[s,i]=d.useState(0),[l,u]=d.useState(0),p=!!(s&&l);return xu(o.scrollbarX,()=>{var m;const h=((m=o.scrollbarX)===null||m===void 0?void 0:m.offsetHeight)||0;o.onCornerHeightChange(h),u(h)}),xu(o.scrollbarY,()=>{var m;const h=((m=o.scrollbarY)===null||m===void 0?void 0:m.offsetWidth)||0;o.onCornerWidthChange(h),i(h)}),p?d.createElement($f.div,hr({},r,{ref:t,style:{width:s,height:l,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function mh(e){return e?parseInt(e,10):0}function pE(e,t){const n=e/t;return isNaN(n)?0:n}function Fg(e){const t=pE(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function KQ(e,t,n,r="ltr"){const o=Fg(n),s=o/2,i=t||s,l=o-i,u=n.scrollbar.paddingStart+i,p=n.scrollbar.size-n.scrollbar.paddingEnd-l,m=n.content-n.viewport,h=r==="ltr"?[0,m]:[m*-1,0];return mE([u,p],h)(e)}function gk(e,t,n="ltr"){const r=Fg(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,l=s-r,u=n==="ltr"?[0,i]:[i*-1,0],p=RQ(e,u);return mE([0,i],[0,l])(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 hE(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,l=n.top!==s.top;(i||l)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function Bg(e,t){const n=El(e),r=d.useRef(0);return d.useEffect(()=>()=>window.clearTimeout(r.current),[]),d.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function xu(e,t){const n=El(t);Mx(()=>{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 XQ=TQ,YQ=$Q,vk=LQ,xk=VQ,JQ=GQ;var ZQ=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],[`& .${S4("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:S4("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 eX=ZQ;var tX=Object.defineProperty,nX=Object.defineProperties,rX=Object.getOwnPropertyDescriptors,hh=Object.getOwnPropertySymbols,gE=Object.prototype.hasOwnProperty,vE=Object.prototype.propertyIsEnumerable,bk=(e,t,n)=>t in e?tX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rx=(e,t)=>{for(var n in t||(t={}))gE.call(t,n)&&bk(e,n,t[n]);if(hh)for(var n of hh(t))vE.call(t,n)&&bk(e,n,t[n]);return e},xE=(e,t)=>nX(e,rX(t)),bE=(e,t)=>{var n={};for(var r in e)gE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&hh)for(var r of hh(e))t.indexOf(r)<0&&vE.call(e,r)&&(n[r]=e[r]);return n};const yE={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},Hg=d.forwardRef((e,t)=>{const n=Nr("ScrollArea",yE,e),{children:r,className:o,classNames:s,styles:i,scrollbarSize:l,scrollHideDelay:u,type:p,dir:m,offsetScrollbars:h,viewportRef:g,onScrollPositionChange:x,unstyled:y,variant:b,viewportProps:C}=n,S=bE(n,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","variant","viewportProps"]),[j,_]=d.useState(!1),P=Si(),{classes:I,cx:M}=eX({scrollbarSize:l,offsetScrollbars:h,scrollbarHovered:j,hidden:p==="never"},{name:"ScrollArea",classNames:s,styles:i,unstyled:y,variant:b});return H.createElement(XQ,{type:p==="never"?"always":p,scrollHideDelay:u,dir:m||P.dir,ref:t,asChild:!0},H.createElement(Go,Rx({className:M(I.root,o)},S),H.createElement(YQ,xE(Rx({},C),{className:I.viewport,ref:g,onScroll:typeof x=="function"?({currentTarget:O})=>x({x:O.scrollLeft,y:O.scrollTop}):void 0}),r),H.createElement(vk,{orientation:"horizontal",className:I.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},H.createElement(xk,{className:I.thumb})),H.createElement(vk,{orientation:"vertical",className:I.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},H.createElement(xk,{className:I.thumb})),H.createElement(JQ,{className:I.corner})))}),CE=d.forwardRef((e,t)=>{const n=Nr("ScrollAreaAutosize",yE,e),{children:r,classNames:o,styles:s,scrollbarSize:i,scrollHideDelay:l,type:u,dir:p,offsetScrollbars:m,viewportRef:h,onScrollPositionChange:g,unstyled:x,sx:y,variant:b,viewportProps:C}=n,S=bE(n,["children","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","sx","variant","viewportProps"]);return H.createElement(Go,xE(Rx({},S),{ref:t,sx:[{display:"flex"},...l6(y)]}),H.createElement(Go,{sx:{display:"flex",flexDirection:"column",flex:1}},H.createElement(Hg,{classNames:o,styles:s,scrollHideDelay:l,scrollbarSize:i,type:u,dir:p,offsetScrollbars:m,viewportRef:h,onScrollPositionChange:g,unstyled:x,variant:b,viewportProps:C},r)))});CE.displayName="@mantine/core/ScrollAreaAutosize";Hg.displayName="@mantine/core/ScrollArea";Hg.Autosize=CE;const wE=Hg;var oX=Object.defineProperty,sX=Object.defineProperties,aX=Object.getOwnPropertyDescriptors,gh=Object.getOwnPropertySymbols,SE=Object.prototype.hasOwnProperty,kE=Object.prototype.propertyIsEnumerable,yk=(e,t,n)=>t in e?oX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ck=(e,t)=>{for(var n in t||(t={}))SE.call(t,n)&&yk(e,n,t[n]);if(gh)for(var n of gh(t))kE.call(t,n)&&yk(e,n,t[n]);return e},iX=(e,t)=>sX(e,aX(t)),lX=(e,t)=>{var n={};for(var r in e)SE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gh)for(var r of gh(e))t.indexOf(r)<0&&kE.call(e,r)&&(n[r]=e[r]);return n};const Wg=d.forwardRef((e,t)=>{var n=e,{style:r}=n,o=lX(n,["style"]);return H.createElement(wE,iX(Ck({},o),{style:Ck({width:"100%"},r),viewportProps:{tabIndex:-1},viewportRef:t}),o.children)});Wg.displayName="@mantine/core/SelectScrollArea";var cX=Co(()=>({dropdown:{},itemsWrapper:{padding:Ge(4),display:"flex",width:"100%",boxSizing:"border-box"}}));const uX=cX;function Nu(e){return e.split("-")[1]}function Ty(e){return e==="y"?"height":"width"}function Zs(e){return e.split("-")[0]}function ul(e){return["top","bottom"].includes(Zs(e))?"x":"y"}function wk(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,l=ul(t),u=Ty(l),p=r[u]/2-o[u]/2,m=l==="x";let h;switch(Zs(t)){case"top":h={x:s,y:r.y-o.height};break;case"bottom":h={x:s,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:i};break;case"left":h={x:r.x-o.width,y:i};break;default:h={x:r.x,y:r.y}}switch(Nu(t)){case"start":h[l]-=p*(n&&m?-1:1);break;case"end":h[l]+=p*(n&&m?-1:1)}return h}const dX=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let p=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:m,y:h}=wk(p,r,u),g=r,x={},y=0;for(let b=0;b({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l}=t,{element:u,padding:p=0}=pi(e,t)||{};if(u==null)return{};const m=Ny(p),h={x:n,y:r},g=ul(o),x=Ty(g),y=await i.getDimensions(u),b=g==="y",C=b?"top":"left",S=b?"bottom":"right",j=b?"clientHeight":"clientWidth",_=s.reference[x]+s.reference[g]-h[g]-s.floating[x],P=h[g]-s.reference[g],I=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let M=I?I[j]:0;M&&await(i.isElement==null?void 0:i.isElement(I))||(M=l.floating[j]||s.floating[x]);const O=_/2-P/2,A=M/2-y[x]/2-1,D=nl(m[C],A),R=nl(m[S],A),N=D,Y=M-y[x]-R,F=M/2-y[x]/2+O,V=Ax(N,F,Y),Q=Nu(o)!=null&&F!=V&&s.reference[x]/2-(Fe.concat(t,t+"-start",t+"-end"),[]);const pX={left:"right",right:"left",bottom:"top",top:"bottom"};function vh(e){return e.replace(/left|right|bottom|top/g,t=>pX[t])}function mX(e,t,n){n===void 0&&(n=!1);const r=Nu(e),o=ul(e),s=Ty(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=vh(i)),{main:i,cross:vh(i)}}const hX={start:"end",end:"start"};function t1(e){return e.replace(/start|end/g,t=>hX[t])}const gX=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:l,elements:u}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:y=!0,...b}=pi(e,t),C=Zs(r),S=Zs(i)===i,j=await(l.isRTL==null?void 0:l.isRTL(u.floating)),_=h||(S||!y?[vh(i)]:function(N){const Y=vh(N);return[t1(N),Y,t1(Y)]}(i));h||x==="none"||_.push(...function(N,Y,F,V){const Q=Nu(N);let q=function(z,G,T){const B=["left","right"],X=["right","left"],re=["top","bottom"],le=["bottom","top"];switch(z){case"top":case"bottom":return T?G?X:B:G?B:X;case"left":case"right":return G?re:le;default:return[]}}(Zs(N),F==="start",V);return Q&&(q=q.map(z=>z+"-"+Q),Y&&(q=q.concat(q.map(t1)))),q}(i,y,x,j));const P=[i,..._],I=await $y(t,b),M=[];let O=((n=o.flip)==null?void 0:n.overflows)||[];if(p&&M.push(I[C]),m){const{main:N,cross:Y}=mX(r,s,j);M.push(I[N],I[Y])}if(O=[...O,{placement:r,overflows:M}],!M.every(N=>N<=0)){var A,D;const N=(((A=o.flip)==null?void 0:A.index)||0)+1,Y=P[N];if(Y)return{data:{index:N,overflows:O},reset:{placement:Y}};let F=(D=O.filter(V=>V.overflows[0]<=0).sort((V,Q)=>V.overflows[1]-Q.overflows[1])[0])==null?void 0:D.placement;if(!F)switch(g){case"bestFit":{var R;const V=(R=O.map(Q=>[Q.placement,Q.overflows.filter(q=>q>0).reduce((q,z)=>q+z,0)]).sort((Q,q)=>Q[1]-q[1])[0])==null?void 0:R[0];V&&(F=V);break}case"initialPlacement":F=i}if(r!==F)return{reset:{placement:F}}}return{}}}};function kk(e){const t=nl(...e.map(r=>r.left)),n=nl(...e.map(r=>r.top));return{x:t,y:n,width:wa(...e.map(r=>r.right))-t,height:wa(...e.map(r=>r.bottom))-n}}const vX=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:l=2,x:u,y:p}=pi(e,t),m=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),h=function(b){const C=b.slice().sort((_,P)=>_.y-P.y),S=[];let j=null;for(let _=0;_j.height/2?S.push([P]):S[S.length-1].push(P),j=P}return S.map(_=>bu(kk(_)))}(m),g=bu(kk(m)),x=Ny(l),y=await s.getElementRects({reference:{getBoundingClientRect:function(){if(h.length===2&&h[0].left>h[1].right&&u!=null&&p!=null)return h.find(b=>u>b.left-x.left&&ub.top-x.top&&p=2){if(ul(n)==="x"){const I=h[0],M=h[h.length-1],O=Zs(n)==="top",A=I.top,D=M.bottom,R=O?I.left:M.left,N=O?I.right:M.right;return{top:A,bottom:D,left:R,right:N,width:N-R,height:D-A,x:R,y:A}}const b=Zs(n)==="left",C=wa(...h.map(I=>I.right)),S=nl(...h.map(I=>I.left)),j=h.filter(I=>b?I.left===S:I.right===C),_=j[0].top,P=j[j.length-1].bottom;return{top:_,bottom:P,left:S,right:C,width:C-S,height:P-_,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}}:{}}}},xX=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:l,platform:u,elements:p}=s,m=await(u.isRTL==null?void 0:u.isRTL(p.floating)),h=Zs(l),g=Nu(l),x=ul(l)==="x",y=["left","top"].includes(h)?-1:1,b=m&&x?-1:1,C=pi(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*_:_),x?{x:j*b,y:S*y}:{x:S*y,y:j*b}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function jE(e){return e==="x"?"y":"x"}const bX=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:l={fn:C=>{let{x:S,y:j}=C;return{x:S,y:j}}},...u}=pi(e,t),p={x:n,y:r},m=await $y(t,u),h=ul(Zs(o)),g=jE(h);let x=p[h],y=p[g];if(s){const C=h==="y"?"bottom":"right";x=Ax(x+m[h==="y"?"top":"left"],x,x-m[C])}if(i){const C=g==="y"?"bottom":"right";y=Ax(y+m[g==="y"?"top":"left"],y,y-m[C])}const b=l.fn({...t,[h]:x,[g]:y});return{...b,data:{x:b.x-n,y:b.y-r}}}}},yX=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:u=!0,crossAxis:p=!0}=pi(e,t),m={x:n,y:r},h=ul(o),g=jE(h);let x=m[h],y=m[g];const b=pi(l,t),C=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(u){const _=h==="y"?"height":"width",P=s.reference[h]-s.floating[_]+C.mainAxis,I=s.reference[h]+s.reference[_]-C.mainAxis;xI&&(x=I)}if(p){var S,j;const _=h==="y"?"width":"height",P=["top","left"].includes(Zs(o)),I=s.reference[g]-s.floating[_]+(P&&((S=i.offset)==null?void 0:S[g])||0)+(P?0:C.crossAxis),M=s.reference[g]+s.reference[_]+(P?0:((j=i.offset)==null?void 0:j[g])||0)-(P?C.crossAxis:0);yM&&(y=M)}return{[h]:x,[g]:y}}}},CX=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=()=>{},...l}=pi(e,t),u=await $y(t,l),p=Zs(n),m=Nu(n),h=ul(n)==="x",{width:g,height:x}=r.floating;let y,b;p==="top"||p==="bottom"?(y=p,b=m===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(b=p,y=m==="end"?"top":"bottom");const C=x-u[y],S=g-u[b],j=!t.middlewareData.shift;let _=C,P=S;if(h){const M=g-u.left-u.right;P=m||j?nl(S,M):M}else{const M=x-u.top-u.bottom;_=m||j?nl(C,M):M}if(j&&!m){const M=wa(u.left,0),O=wa(u.right,0),A=wa(u.top,0),D=wa(u.bottom,0);h?P=g-2*(M!==0||O!==0?M+O:wa(u.left,u.right)):_=x-2*(A!==0||D!==0?A+D:wa(u.top,u.bottom))}await i({...t,availableWidth:P,availableHeight:_});const I=await o.getDimensions(s.floating);return g!==I.width||x!==I.height?{reset:{rects:!0}}:{}}}};function as(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ra(e){return as(e).getComputedStyle(e)}function _E(e){return e instanceof as(e).Node}function rl(e){return _E(e)?(e.nodeName||"").toLowerCase():"#document"}function aa(e){return e instanceof HTMLElement||e instanceof as(e).HTMLElement}function jk(e){return typeof ShadowRoot<"u"&&(e instanceof as(e).ShadowRoot||e instanceof ShadowRoot)}function Zd(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 wX(e){return["table","td","th"].includes(rl(e))}function Dx(e){const t=Ly(),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 Ly(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Vg(e){return["html","body","#document"].includes(rl(e))}const Tx=Math.min,au=Math.max,xh=Math.round,Qp=Math.floor,ol=e=>({x:e,y:e});function IE(e){const t=Ra(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=aa(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=xh(n)!==s||xh(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function ai(e){return e instanceof Element||e instanceof as(e).Element}function zy(e){return ai(e)?e:e.contextElement}function iu(e){const t=zy(e);if(!aa(t))return ol(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=IE(t);let i=(s?xh(n.width):n.width)/r,l=(s?xh(n.height):n.height)/o;return i&&Number.isFinite(i)||(i=1),l&&Number.isFinite(l)||(l=1),{x:i,y:l}}const SX=ol(0);function PE(e){const t=as(e);return Ly()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:SX}function Ql(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=zy(e);let i=ol(1);t&&(r?ai(r)&&(i=iu(r)):i=iu(e));const l=function(g,x,y){return x===void 0&&(x=!1),!(!y||x&&y!==as(g))&&x}(s,n,r)?PE(s):ol(0);let u=(o.left+l.x)/i.x,p=(o.top+l.y)/i.y,m=o.width/i.x,h=o.height/i.y;if(s){const g=as(s),x=r&&ai(r)?as(r):r;let y=g.frameElement;for(;y&&r&&x!==g;){const b=iu(y),C=y.getBoundingClientRect(),S=getComputedStyle(y),j=C.left+(y.clientLeft+parseFloat(S.paddingLeft))*b.x,_=C.top+(y.clientTop+parseFloat(S.paddingTop))*b.y;u*=b.x,p*=b.y,m*=b.x,h*=b.y,u+=j,p+=_,y=as(y).frameElement}}return bu({width:m,height:h,x:u,y:p})}function Ug(e){return ai(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ii(e){var t;return(t=(_E(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function EE(e){return Ql(ii(e)).left+Ug(e).scrollLeft}function yu(e){if(rl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||jk(e)&&e.host||ii(e);return jk(t)?t.host:t}function ME(e){const t=yu(e);return Vg(t)?e.ownerDocument?e.ownerDocument.body:e.body:aa(t)&&Zd(t)?t:ME(t)}function bh(e,t){var n;t===void 0&&(t=[]);const r=ME(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=as(r);return o?t.concat(s,s.visualViewport||[],Zd(r)?r:[]):t.concat(r,bh(r))}function _k(e,t,n){let r;if(t==="viewport")r=function(o,s){const i=as(o),l=ii(o),u=i.visualViewport;let p=l.clientWidth,m=l.clientHeight,h=0,g=0;if(u){p=u.width,m=u.height;const x=Ly();(!x||x&&s==="fixed")&&(h=u.offsetLeft,g=u.offsetTop)}return{width:p,height:m,x:h,y:g}}(e,n);else if(t==="document")r=function(o){const s=ii(o),i=Ug(o),l=o.ownerDocument.body,u=au(s.scrollWidth,s.clientWidth,l.scrollWidth,l.clientWidth),p=au(s.scrollHeight,s.clientHeight,l.scrollHeight,l.clientHeight);let m=-i.scrollLeft+EE(o);const h=-i.scrollTop;return Ra(l).direction==="rtl"&&(m+=au(s.clientWidth,l.clientWidth)-u),{width:u,height:p,x:m,y:h}}(ii(e));else if(ai(t))r=function(o,s){const i=Ql(o,!0,s==="fixed"),l=i.top+o.clientTop,u=i.left+o.clientLeft,p=aa(o)?iu(o):ol(1);return{width:o.clientWidth*p.x,height:o.clientHeight*p.y,x:u*p.x,y:l*p.y}}(t,n);else{const o=PE(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return bu(r)}function OE(e,t){const n=yu(e);return!(n===t||!ai(n)||Vg(n))&&(Ra(n).position==="fixed"||OE(n,t))}function kX(e,t,n){const r=aa(t),o=ii(t),s=n==="fixed",i=Ql(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=ol(0);if(r||!r&&!s)if((rl(t)!=="body"||Zd(o))&&(l=Ug(t)),aa(t)){const p=Ql(t,!0,s,t);u.x=p.x+t.clientLeft,u.y=p.y+t.clientTop}else o&&(u.x=EE(o));return{x:i.left+l.scrollLeft-u.x,y:i.top+l.scrollTop-u.y,width:i.width,height:i.height}}function Ik(e,t){return aa(e)&&Ra(e).position!=="fixed"?t?t(e):e.offsetParent:null}function Pk(e,t){const n=as(e);if(!aa(e))return n;let r=Ik(e,t);for(;r&&wX(r)&&Ra(r).position==="static";)r=Ik(r,t);return r&&(rl(r)==="html"||rl(r)==="body"&&Ra(r).position==="static"&&!Dx(r))?n:r||function(o){let s=yu(o);for(;aa(s)&&!Vg(s);){if(Dx(s))return s;s=yu(s)}return null}(e)||n}const jX={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=aa(n),s=ii(n);if(n===s)return t;let i={scrollLeft:0,scrollTop:0},l=ol(1);const u=ol(0);if((o||!o&&r!=="fixed")&&((rl(n)!=="body"||Zd(s))&&(i=Ug(n)),aa(n))){const p=Ql(n);l=iu(n),u.x=p.x+n.clientLeft,u.y=p.y+n.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-i.scrollLeft*l.x+u.x,y:t.y*l.y-i.scrollTop*l.y+u.y}},getDocumentElement:ii,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?function(u,p){const m=p.get(u);if(m)return m;let h=bh(u).filter(b=>ai(b)&&rl(b)!=="body"),g=null;const x=Ra(u).position==="fixed";let y=x?yu(u):u;for(;ai(y)&&!Vg(y);){const b=Ra(y),C=Dx(y);C||b.position!=="fixed"||(g=null),(x?!C&&!g:!C&&b.position==="static"&&g&&["absolute","fixed"].includes(g.position)||Zd(y)&&!C&&OE(u,y))?h=h.filter(S=>S!==y):g=b,y=yu(y)}return p.set(u,h),h}(t,this._c):[].concat(n),r],i=s[0],l=s.reduce((u,p)=>{const m=_k(t,p,o);return u.top=au(m.top,u.top),u.right=Tx(m.right,u.right),u.bottom=Tx(m.bottom,u.bottom),u.left=au(m.left,u.left),u},_k(t,i,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:Pk,getElementRects:async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||Pk,s=this.getDimensions;return{reference:kX(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 IE(e)},getScale:iu,isElement:ai,isRTL:function(e){return getComputedStyle(e).direction==="rtl"}};function _X(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,p=zy(e),m=o||s?[...p?bh(p):[],...bh(t)]:[];m.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=p&&l?function(C,S){let j,_=null;const P=ii(C);function I(){clearTimeout(j),_&&_.disconnect(),_=null}return function M(O,A){O===void 0&&(O=!1),A===void 0&&(A=1),I();const{left:D,top:R,width:N,height:Y}=C.getBoundingClientRect();if(O||S(),!N||!Y)return;const F={rootMargin:-Qp(R)+"px "+-Qp(P.clientWidth-(D+N))+"px "+-Qp(P.clientHeight-(R+Y))+"px "+-Qp(D)+"px",threshold:au(0,Tx(1,A))||1};let V=!0;function Q(q){const z=q[0].intersectionRatio;if(z!==A){if(!V)return M();z?M(!1,z):j=setTimeout(()=>{M(!1,1e-7)},100)}V=!1}try{_=new IntersectionObserver(Q,{...F,root:P.ownerDocument})}catch{_=new IntersectionObserver(Q,F)}_.observe(C)}(!0),I}(p,n):null;let g,x=-1,y=null;i&&(y=new ResizeObserver(C=>{let[S]=C;S&&S.target===p&&y&&(y.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{y&&y.observe(t)})),n()}),p&&!u&&y.observe(p),y.observe(t));let b=u?Ql(e):null;return u&&function C(){const S=Ql(e);!b||S.x===b.x&&S.y===b.y&&S.width===b.width&&S.height===b.height||n(),b=S,g=requestAnimationFrame(C)}(),n(),()=>{m.forEach(C=>{o&&C.removeEventListener("scroll",n),s&&C.removeEventListener("resize",n)}),h&&h(),y&&y.disconnect(),y=null,u&&cancelAnimationFrame(g)}}const IX=(e,t,n)=>{const r=new Map,o={platform:jX,...n},s={...o.platform,_c:r};return dX(e,t,{...o,platform:s})},PX=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?Sk({element:t.current,padding:n}).fn(o):{}:t?Sk({element:t,padding:n}).fn(o):{}}}};var Im=typeof document<"u"?d.useLayoutEffect:d.useEffect;function yh(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(!yh(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)&&!yh(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Ek(e){const t=d.useRef(e);return Im(()=>{t.current=e}),t}function EX(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:s,open:i}=e,[l,u]=d.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=d.useState(r);yh(p,r)||m(r);const h=d.useRef(null),g=d.useRef(null),x=d.useRef(l),y=Ek(s),b=Ek(o),[C,S]=d.useState(null),[j,_]=d.useState(null),P=d.useCallback(R=>{h.current!==R&&(h.current=R,S(R))},[]),I=d.useCallback(R=>{g.current!==R&&(g.current=R,_(R))},[]),M=d.useCallback(()=>{if(!h.current||!g.current)return;const R={placement:t,strategy:n,middleware:p};b.current&&(R.platform=b.current),IX(h.current,g.current,R).then(N=>{const Y={...N,isPositioned:!0};O.current&&!yh(x.current,Y)&&(x.current=Y,rs.flushSync(()=>{u(Y)}))})},[p,t,n,b]);Im(()=>{i===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,u(R=>({...R,isPositioned:!1})))},[i]);const O=d.useRef(!1);Im(()=>(O.current=!0,()=>{O.current=!1}),[]),Im(()=>{if(C&&j){if(y.current)return y.current(C,j,M);M()}},[C,j,M,y]);const A=d.useMemo(()=>({reference:h,floating:g,setReference:P,setFloating:I}),[P,I]),D=d.useMemo(()=>({reference:C,floating:j}),[C,j]);return d.useMemo(()=>({...l,update:M,refs:A,elements:D,reference:P,floating:I}),[l,M,A,D,P,I])}var MX=typeof document<"u"?d.useLayoutEffect:d.useEffect;function OX(){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 RX=d.createContext(null),AX=()=>d.useContext(RX);function DX(e){return(e==null?void 0:e.ownerDocument)||document}function TX(e){return DX(e).defaultView||window}function Xp(e){return e?e instanceof TX(e).Element:!1}const NX=hb["useInsertionEffect".toString()],$X=NX||(e=>e());function LX(e){const t=d.useRef(()=>{});return $X(()=>{t.current=e}),d.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;oOX())[0],[p,m]=d.useState(null),h=d.useCallback(S=>{const j=Xp(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;o.refs.setReference(j)},[o.refs]),g=d.useCallback(S=>{(Xp(S)||S===null)&&(i.current=S,m(S)),(Xp(o.refs.reference.current)||o.refs.reference.current===null||S!==null&&!Xp(S))&&o.refs.setReference(S)},[o.refs]),x=d.useMemo(()=>({...o.refs,setReference:g,setPositionReference:h,domReference:i}),[o.refs,g,h]),y=d.useMemo(()=>({...o.elements,domReference:p}),[o.elements,p]),b=LX(n),C=d.useMemo(()=>({...o,refs:x,elements:y,dataRef:l,nodeId:r,events:u,open:t,onOpenChange:b}),[o,r,u,t,b,x,y]);return MX(()=>{const S=s==null?void 0:s.nodesRef.current.find(j=>j.id===r);S&&(S.context=C)}),d.useMemo(()=>({...o,context:C,refs:x,reference:g,positionReference:h}),[o,x,C,g,h])}function FX({opened:e,floating:t,position:n,positionDependencies:r}){const[o,s]=d.useState(0);d.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return _X(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 BX(e){const t=[xX(e.offset)];return e.middlewares.shift&&t.push(bX({limiter:yX()})),e.middlewares.flip&&t.push(gX()),e.middlewares.inline&&t.push(vX()),t.push(PX({element:e.arrowRef,padding:e.arrowOffset})),t}function HX(e){const[t,n]=Jd({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,l;t?((i=e.onClose)==null||i.call(e),n(!1)):((l=e.onOpen)==null||l.call(e),n(!0))},s=zX({placement:e.position,middleware:[...BX(e),...e.width==="target"?[CX({apply({rects:i}){var l,u;Object.assign((u=(l=s.refs.floating.current)==null?void 0:l.style)!=null?u:{},{width:`${i.reference.width}px`})}})]:[]]});return FX({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,l;e.opened?(l=e.onOpen)==null||l.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 RE={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"},[WX,AE]=MG(RE.context);var VX=Object.defineProperty,UX=Object.defineProperties,GX=Object.getOwnPropertyDescriptors,Ch=Object.getOwnPropertySymbols,DE=Object.prototype.hasOwnProperty,TE=Object.prototype.propertyIsEnumerable,Mk=(e,t,n)=>t in e?VX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yp=(e,t)=>{for(var n in t||(t={}))DE.call(t,n)&&Mk(e,n,t[n]);if(Ch)for(var n of Ch(t))TE.call(t,n)&&Mk(e,n,t[n]);return e},qX=(e,t)=>UX(e,GX(t)),KX=(e,t)=>{var n={};for(var r in e)DE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ch)for(var r of Ch(e))t.indexOf(r)<0&&TE.call(e,r)&&(n[r]=e[r]);return n};const QX={refProp:"ref",popupType:"dialog"},NE=d.forwardRef((e,t)=>{const n=Nr("PopoverTarget",QX,e),{children:r,refProp:o,popupType:s}=n,i=KX(n,["children","refProp","popupType"]);if(!u6(r))throw new Error(RE.children);const l=i,u=AE(),p=Nf(u.reference,r.ref,t),m=u.withRoles?{"aria-haspopup":s,"aria-expanded":u.opened,"aria-controls":u.getDropdownId(),id:u.getTargetId()}:{};return d.cloneElement(r,Yp(qX(Yp(Yp(Yp({},l),m),u.targetProps),{className:f6(u.targetProps.className,l.className,r.props.className),[o]:p}),u.controlled?null:{onClick:u.onToggle}))});NE.displayName="@mantine/core/PopoverTarget";var XX=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 YX=XX;var JX=Object.defineProperty,Ok=Object.getOwnPropertySymbols,ZX=Object.prototype.hasOwnProperty,eY=Object.prototype.propertyIsEnumerable,Rk=(e,t,n)=>t in e?JX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oc=(e,t)=>{for(var n in t||(t={}))ZX.call(t,n)&&Rk(e,n,t[n]);if(Ok)for(var n of Ok(t))eY.call(t,n)&&Rk(e,n,t[n]);return e};const Ak={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function tY({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in Wp?Oc(Oc(Oc({transitionProperty:Wp[e].transitionProperty},o),Wp[e].common),Wp[e][Ak[t]]):null:Oc(Oc(Oc({transitionProperty:e.transitionProperty},o),e.common),e[Ak[t]])}function nY({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:i,onExited:l}){const u=Si(),p=b6(),m=u.respectReducedMotion?p:!1,[h,g]=d.useState(m?0:e),[x,y]=d.useState(r?"entered":"exited"),b=d.useRef(-1),C=S=>{const j=S?o:s,_=S?i:l;y(S?"pre-entering":"pre-exiting"),window.clearTimeout(b.current);const P=m?0:S?e:t;if(g(P),P===0)typeof j=="function"&&j(),typeof _=="function"&&_(),y(S?"entered":"exited");else{const I=window.setTimeout(()=>{typeof j=="function"&&j(),y(S?"entering":"exiting")},10);b.current=window.setTimeout(()=>{window.clearTimeout(I),typeof _=="function"&&_(),y(S?"entered":"exited")},P)}};return Js(()=>{C(r)},[r]),d.useEffect(()=>()=>window.clearTimeout(b.current),[]),{transitionDuration:h,transitionStatus:x,transitionTimingFunction:n||u.transitionTimingFunction}}function $E({keepMounted:e,transition:t,duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:i,onExit:l,onEntered:u,onEnter:p,onExited:m}){const{transitionDuration:h,transitionStatus:g,transitionTimingFunction:x}=nY({mounted:o,exitDuration:r,duration:n,timingFunction:i,onExit:l,onEntered:u,onEnter:p,onExited:m});return h===0?o?H.createElement(H.Fragment,null,s({})):e?s({display:"none"}):null:g==="exited"?e?s({display:"none"}):null:H.createElement(H.Fragment,null,s(tY({transition:t,duration:h,state:g,timingFunction:x})))}$E.displayName="@mantine/core/Transition";function LE({children:e,active:t=!0,refProp:n="ref"}){const r=uq(t),o=Nf(r,e==null?void 0:e.ref);return u6(e)?d.cloneElement(e,{[n]:o}):e}LE.displayName="@mantine/core/FocusTrap";var rY=Object.defineProperty,oY=Object.defineProperties,sY=Object.getOwnPropertyDescriptors,Dk=Object.getOwnPropertySymbols,aY=Object.prototype.hasOwnProperty,iY=Object.prototype.propertyIsEnumerable,Tk=(e,t,n)=>t in e?rY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$i=(e,t)=>{for(var n in t||(t={}))aY.call(t,n)&&Tk(e,n,t[n]);if(Dk)for(var n of Dk(t))iY.call(t,n)&&Tk(e,n,t[n]);return e},Jp=(e,t)=>oY(e,sY(t));function Nk(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function $k(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 lY={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function cY({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:i,dir:l}){const[u,p="center"]=e.split("-"),m={width:Ge(t),height:Ge(t),transform:"rotate(45deg)",position:"absolute",[lY[u]]:Ge(r)},h=Ge(-t/2);return u==="left"?Jp($i($i({},m),Nk(p,i,n,o)),{right:h,borderLeftColor:"transparent",borderBottomColor:"transparent"}):u==="right"?Jp($i($i({},m),Nk(p,i,n,o)),{left:h,borderRightColor:"transparent",borderTopColor:"transparent"}):u==="top"?Jp($i($i({},m),$k(p,s,n,o,l)),{bottom:h,borderTopColor:"transparent",borderLeftColor:"transparent"}):u==="bottom"?Jp($i($i({},m),$k(p,s,n,o,l)),{top:h,borderBottomColor:"transparent",borderRightColor:"transparent"}):{}}var uY=Object.defineProperty,dY=Object.defineProperties,fY=Object.getOwnPropertyDescriptors,wh=Object.getOwnPropertySymbols,zE=Object.prototype.hasOwnProperty,FE=Object.prototype.propertyIsEnumerable,Lk=(e,t,n)=>t in e?uY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pY=(e,t)=>{for(var n in t||(t={}))zE.call(t,n)&&Lk(e,n,t[n]);if(wh)for(var n of wh(t))FE.call(t,n)&&Lk(e,n,t[n]);return e},mY=(e,t)=>dY(e,fY(t)),hY=(e,t)=>{var n={};for(var r in e)zE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&wh)for(var r of wh(e))t.indexOf(r)<0&&FE.call(e,r)&&(n[r]=e[r]);return n};const BE=d.forwardRef((e,t)=>{var n=e,{position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:l,visible:u,arrowX:p,arrowY:m}=n,h=hY(n,["position","arrowSize","arrowOffset","arrowRadius","arrowPosition","visible","arrowX","arrowY"]);const g=Si();return u?H.createElement("div",mY(pY({},h),{ref:t,style:cY({position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:l,dir:g.dir,arrowX:p,arrowY:m})})):null});BE.displayName="@mantine/core/FloatingArrow";var gY=Object.defineProperty,vY=Object.defineProperties,xY=Object.getOwnPropertyDescriptors,Sh=Object.getOwnPropertySymbols,HE=Object.prototype.hasOwnProperty,WE=Object.prototype.propertyIsEnumerable,zk=(e,t,n)=>t in e?gY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rc=(e,t)=>{for(var n in t||(t={}))HE.call(t,n)&&zk(e,n,t[n]);if(Sh)for(var n of Sh(t))WE.call(t,n)&&zk(e,n,t[n]);return e},Zp=(e,t)=>vY(e,xY(t)),bY=(e,t)=>{var n={};for(var r in e)HE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Sh)for(var r of Sh(e))t.indexOf(r)<0&&WE.call(e,r)&&(n[r]=e[r]);return n};const yY={};function VE(e){var t;const n=Nr("PopoverDropdown",yY,e),{style:r,className:o,children:s,onKeyDownCapture:i}=n,l=bY(n,["style","className","children","onKeyDownCapture"]),u=AE(),{classes:p,cx:m}=YX({radius:u.radius,shadow:u.shadow},{name:u.__staticSelector,classNames:u.classNames,styles:u.styles,unstyled:u.unstyled,variant:u.variant}),h=rq({opened:u.opened,shouldReturnFocus:u.returnFocus}),g=u.withRoles?{"aria-labelledby":u.getTargetId(),id:u.getDropdownId(),role:"dialog"}:{};return u.disabled?null:H.createElement(V6,Zp(Rc({},u.portalProps),{withinPortal:u.withinPortal}),H.createElement($E,Zp(Rc({mounted:u.opened},u.transitionProps),{transition:u.transitionProps.transition||"fade",duration:(t=u.transitionProps.duration)!=null?t:150,keepMounted:u.keepMounted,exitDuration:typeof u.transitionProps.exitDuration=="number"?u.transitionProps.exitDuration:u.transitionProps.duration}),x=>{var y,b;return H.createElement(LE,{active:u.trapFocus},H.createElement(Go,Rc(Zp(Rc({},g),{tabIndex:-1,ref:u.floating,style:Zp(Rc(Rc({},r),x),{zIndex:u.zIndex,top:(y=u.y)!=null?y:0,left:(b=u.x)!=null?b:0,width:u.width==="target"?void 0:Ge(u.width)}),className:m(p.dropdown,o),onKeyDownCapture:RG(u.onClose,{active:u.closeOnEscape,onTrigger:h,onKeyDown:i}),"data-position":u.placement}),l),s,H.createElement(BE,{ref:u.arrowRef,arrowX:u.arrowX,arrowY:u.arrowY,visible:u.withArrow,position:u.placement,arrowSize:u.arrowSize,arrowRadius:u.arrowRadius,arrowOffset:u.arrowOffset,arrowPosition:u.arrowPosition,className:p.arrow})))}))}VE.displayName="@mantine/core/PopoverDropdown";function CY(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 Fk=Object.getOwnPropertySymbols,wY=Object.prototype.hasOwnProperty,SY=Object.prototype.propertyIsEnumerable,kY=(e,t)=>{var n={};for(var r in e)wY.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Fk)for(var r of Fk(e))t.indexOf(r)<0&&SY.call(e,r)&&(n[r]=e[r]);return n};const jY={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:Ey("popover"),__staticSelector:"Popover",width:"max-content"};function $u(e){var t,n,r,o,s,i;const l=d.useRef(null),u=Nr("Popover",jY,e),{children:p,position:m,offset:h,onPositionChange:g,positionDependencies:x,opened:y,transitionProps:b,width:C,middlewares:S,withArrow:j,arrowSize:_,arrowOffset:P,arrowRadius:I,arrowPosition:M,unstyled:O,classNames:A,styles:D,closeOnClickOutside:R,withinPortal:N,portalProps:Y,closeOnEscape:F,clickOutsideEvents:V,trapFocus:Q,onClose:q,onOpen:z,onChange:G,zIndex:T,radius:B,shadow:X,id:re,defaultOpened:le,__staticSelector:se,withRoles:K,disabled:U,returnFocus:ee,variant:de,keepMounted:Z}=u,ue=kY(u,["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"]),[fe,ge]=d.useState(null),[_e,ye]=d.useState(null),pe=Oy(re),Te=Si(),Ae=HX({middlewares:S,width:C,position:CY(Te.dir,m),offset:typeof h=="number"?h+(j?_/2:0):h,arrowRef:l,arrowOffset:P,onPositionChange:g,positionDependencies:x,opened:y,defaultOpened:le,onChange:G,onOpen:z,onClose:q});ZG(()=>Ae.opened&&R&&Ae.onClose(),V,[fe,_e]);const qe=d.useCallback(tt=>{ge(tt),Ae.floating.reference(tt)},[Ae.floating.reference]),Pt=d.useCallback(tt=>{ye(tt),Ae.floating.floating(tt)},[Ae.floating.floating]);return H.createElement(WX,{value:{returnFocus:ee,disabled:U,controlled:Ae.controlled,reference:qe,floating:Pt,x:Ae.floating.x,y:Ae.floating.y,arrowX:(r=(n=(t=Ae.floating)==null?void 0:t.middlewareData)==null?void 0:n.arrow)==null?void 0:r.x,arrowY:(i=(s=(o=Ae.floating)==null?void 0:o.middlewareData)==null?void 0:s.arrow)==null?void 0:i.y,opened:Ae.opened,arrowRef:l,transitionProps:b,width:C,withArrow:j,arrowSize:_,arrowOffset:P,arrowRadius:I,arrowPosition:M,placement:Ae.floating.placement,trapFocus:Q,withinPortal:N,portalProps:Y,zIndex:T,radius:B,shadow:X,closeOnEscape:F,onClose:Ae.onClose,onToggle:Ae.onToggle,getTargetId:()=>`${pe}-target`,getDropdownId:()=>`${pe}-dropdown`,withRoles:K,targetProps:ue,__staticSelector:se,classNames:A,styles:D,unstyled:O,variant:de,keepMounted:Z}},p)}$u.Target=NE;$u.Dropdown=VE;$u.displayName="@mantine/core/Popover";var _Y=Object.defineProperty,kh=Object.getOwnPropertySymbols,UE=Object.prototype.hasOwnProperty,GE=Object.prototype.propertyIsEnumerable,Bk=(e,t,n)=>t in e?_Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,IY=(e,t)=>{for(var n in t||(t={}))UE.call(t,n)&&Bk(e,n,t[n]);if(kh)for(var n of kh(t))GE.call(t,n)&&Bk(e,n,t[n]);return e},PY=(e,t)=>{var n={};for(var r in e)UE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&kh)for(var r of kh(e))t.indexOf(r)<0&&GE.call(e,r)&&(n[r]=e[r]);return n};function EY(e){var t=e,{children:n,component:r="div",maxHeight:o=220,direction:s="column",id:i,innerRef:l,__staticSelector:u,styles:p,classNames:m,unstyled:h}=t,g=PY(t,["children","component","maxHeight","direction","id","innerRef","__staticSelector","styles","classNames","unstyled"]);const{classes:x}=uX(null,{name:u,styles:p,classNames:m,unstyled:h});return H.createElement($u.Dropdown,IY({p:0,onMouseDown:y=>y.preventDefault()},g),H.createElement("div",{style:{maxHeight:Ge(o),display:"flex"}},H.createElement(Go,{component:r||"div",id:`${i}-items`,"aria-labelledby":`${i}-label`,role:"listbox",onMouseDown:y=>y.preventDefault(),style:{flex:1,overflowY:r!==Wg?"auto":void 0},"data-combobox-popover":!0,tabIndex:-1,ref:l},H.createElement("div",{className:x.itemsWrapper,style:{flexDirection:s}},n))))}function Ki({opened:e,transitionProps:t={transition:"fade",duration:0},shadow:n,withinPortal:r,portalProps:o,children:s,__staticSelector:i,onDirectionChange:l,switchDirectionOnFlip:u,zIndex:p,dropdownPosition:m,positionDependencies:h=[],classNames:g,styles:x,unstyled:y,readOnly:b,variant:C}){return H.createElement($u,{unstyled:y,classNames:g,styles:x,width:"target",withRoles:!1,opened:e,middlewares:{flip:m==="flip",shift:!1},position:m==="flip"?"bottom":m,positionDependencies:h,zIndex:p,__staticSelector:i,withinPortal:r,portalProps:o,transitionProps:t,shadow:n,disabled:b,onPositionChange:S=>u&&(l==null?void 0:l(S==="top"?"column-reverse":"column")),variant:C},s)}Ki.Target=$u.Target;Ki.Dropdown=EY;var MY=Object.defineProperty,OY=Object.defineProperties,RY=Object.getOwnPropertyDescriptors,jh=Object.getOwnPropertySymbols,qE=Object.prototype.hasOwnProperty,KE=Object.prototype.propertyIsEnumerable,Hk=(e,t,n)=>t in e?MY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,em=(e,t)=>{for(var n in t||(t={}))qE.call(t,n)&&Hk(e,n,t[n]);if(jh)for(var n of jh(t))KE.call(t,n)&&Hk(e,n,t[n]);return e},AY=(e,t)=>OY(e,RY(t)),DY=(e,t)=>{var n={};for(var r in e)qE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&jh)for(var r of jh(e))t.indexOf(r)<0&&KE.call(e,r)&&(n[r]=e[r]);return n};function QE(e,t,n){const r=Nr(e,t,n),{label:o,description:s,error:i,required:l,classNames:u,styles:p,className:m,unstyled:h,__staticSelector:g,sx:x,errorProps:y,labelProps:b,descriptionProps:C,wrapperProps:S,id:j,size:_,style:P,inputContainer:I,inputWrapperOrder:M,withAsterisk:O,variant:A}=r,D=DY(r,["label","description","error","required","classNames","styles","className","unstyled","__staticSelector","sx","errorProps","labelProps","descriptionProps","wrapperProps","id","size","style","inputContainer","inputWrapperOrder","withAsterisk","variant"]),R=Oy(j),{systemStyles:N,rest:Y}=zg(D),F=em({label:o,description:s,error:i,required:l,classNames:u,className:m,__staticSelector:g,sx:x,errorProps:y,labelProps:b,descriptionProps:C,unstyled:h,styles:p,id:R,size:_,style:P,inputContainer:I,inputWrapperOrder:M,withAsterisk:O,variant:A},S);return AY(em({},Y),{classNames:u,styles:p,unstyled:h,wrapperProps:em(em({},F),N),inputProps:{required:l,classNames:u,styles:p,unstyled:h,id:R,size:_,__staticSelector:g,error:i,variant:A}})}var TY=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 NY=TY;var $Y=Object.defineProperty,_h=Object.getOwnPropertySymbols,XE=Object.prototype.hasOwnProperty,YE=Object.prototype.propertyIsEnumerable,Wk=(e,t,n)=>t in e?$Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,LY=(e,t)=>{for(var n in t||(t={}))XE.call(t,n)&&Wk(e,n,t[n]);if(_h)for(var n of _h(t))YE.call(t,n)&&Wk(e,n,t[n]);return e},zY=(e,t)=>{var n={};for(var r in e)XE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_h)for(var r of _h(e))t.indexOf(r)<0&&YE.call(e,r)&&(n[r]=e[r]);return n};const FY={labelElement:"label",size:"sm"},Fy=d.forwardRef((e,t)=>{const n=Nr("InputLabel",FY,e),{labelElement:r,children:o,required:s,size:i,classNames:l,styles:u,unstyled:p,className:m,htmlFor:h,__staticSelector:g,variant:x,onMouseDown:y}=n,b=zY(n,["labelElement","children","required","size","classNames","styles","unstyled","className","htmlFor","__staticSelector","variant","onMouseDown"]),{classes:C,cx:S}=NY(null,{name:["InputWrapper",g],classNames:l,styles:u,unstyled:p,variant:x,size:i});return H.createElement(Go,LY({component:r,ref:t,className:S(C.label,m),htmlFor:r==="label"?h:void 0,onMouseDown:j=>{y==null||y(j),!j.defaultPrevented&&j.detail>1&&j.preventDefault()}},b),o,s&&H.createElement("span",{className:C.required,"aria-hidden":!0}," *"))});Fy.displayName="@mantine/core/InputLabel";var BY=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 HY=BY;var WY=Object.defineProperty,Ih=Object.getOwnPropertySymbols,JE=Object.prototype.hasOwnProperty,ZE=Object.prototype.propertyIsEnumerable,Vk=(e,t,n)=>t in e?WY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,VY=(e,t)=>{for(var n in t||(t={}))JE.call(t,n)&&Vk(e,n,t[n]);if(Ih)for(var n of Ih(t))ZE.call(t,n)&&Vk(e,n,t[n]);return e},UY=(e,t)=>{var n={};for(var r in e)JE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ih)for(var r of Ih(e))t.indexOf(r)<0&&ZE.call(e,r)&&(n[r]=e[r]);return n};const GY={size:"sm"},By=d.forwardRef((e,t)=>{const n=Nr("InputError",GY,e),{children:r,className:o,classNames:s,styles:i,unstyled:l,size:u,__staticSelector:p,variant:m}=n,h=UY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:x}=HY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:l,variant:m,size:u});return H.createElement(vu,VY({className:x(g.error,o),ref:t},h),r)});By.displayName="@mantine/core/InputError";var qY=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 KY=qY;var QY=Object.defineProperty,Ph=Object.getOwnPropertySymbols,eM=Object.prototype.hasOwnProperty,tM=Object.prototype.propertyIsEnumerable,Uk=(e,t,n)=>t in e?QY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,XY=(e,t)=>{for(var n in t||(t={}))eM.call(t,n)&&Uk(e,n,t[n]);if(Ph)for(var n of Ph(t))tM.call(t,n)&&Uk(e,n,t[n]);return e},YY=(e,t)=>{var n={};for(var r in e)eM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ph)for(var r of Ph(e))t.indexOf(r)<0&&tM.call(e,r)&&(n[r]=e[r]);return n};const JY={size:"sm"},Hy=d.forwardRef((e,t)=>{const n=Nr("InputDescription",JY,e),{children:r,className:o,classNames:s,styles:i,unstyled:l,size:u,__staticSelector:p,variant:m}=n,h=YY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:x}=KY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:l,variant:m,size:u});return H.createElement(vu,XY({color:"dimmed",className:x(g.description,o),ref:t,unstyled:l},h),r)});Hy.displayName="@mantine/core/InputDescription";const nM=d.createContext({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),ZY=nM.Provider,eJ=()=>d.useContext(nM);function tJ(e,{hasDescription:t,hasError:n}){const r=e.findIndex(u=>u==="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 nJ=Object.defineProperty,rJ=Object.defineProperties,oJ=Object.getOwnPropertyDescriptors,Gk=Object.getOwnPropertySymbols,sJ=Object.prototype.hasOwnProperty,aJ=Object.prototype.propertyIsEnumerable,qk=(e,t,n)=>t in e?nJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,iJ=(e,t)=>{for(var n in t||(t={}))sJ.call(t,n)&&qk(e,n,t[n]);if(Gk)for(var n of Gk(t))aJ.call(t,n)&&qk(e,n,t[n]);return e},lJ=(e,t)=>rJ(e,oJ(t)),cJ=Co(e=>({root:lJ(iJ({},e.fn.fontStyles()),{lineHeight:e.lineHeight})}));const uJ=cJ;var dJ=Object.defineProperty,fJ=Object.defineProperties,pJ=Object.getOwnPropertyDescriptors,Eh=Object.getOwnPropertySymbols,rM=Object.prototype.hasOwnProperty,oM=Object.prototype.propertyIsEnumerable,Kk=(e,t,n)=>t in e?dJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Li=(e,t)=>{for(var n in t||(t={}))rM.call(t,n)&&Kk(e,n,t[n]);if(Eh)for(var n of Eh(t))oM.call(t,n)&&Kk(e,n,t[n]);return e},Qk=(e,t)=>fJ(e,pJ(t)),mJ=(e,t)=>{var n={};for(var r in e)rM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Eh)for(var r of Eh(e))t.indexOf(r)<0&&oM.call(e,r)&&(n[r]=e[r]);return n};const hJ={labelElement:"label",size:"sm",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},sM=d.forwardRef((e,t)=>{const n=Nr("InputWrapper",hJ,e),{className:r,label:o,children:s,required:i,id:l,error:u,description:p,labelElement:m,labelProps:h,descriptionProps:g,errorProps:x,classNames:y,styles:b,size:C,inputContainer:S,__staticSelector:j,unstyled:_,inputWrapperOrder:P,withAsterisk:I,variant:M}=n,O=mJ(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}=uJ(null,{classNames:y,styles:b,name:["InputWrapper",j],unstyled:_,variant:M,size:C}),R={classNames:y,styles:b,unstyled:_,size:C,variant:M,__staticSelector:j},N=typeof I=="boolean"?I:i,Y=l?`${l}-error`:x==null?void 0:x.id,F=l?`${l}-description`:g==null?void 0:g.id,Q=`${!!u&&typeof u!="boolean"?Y:""} ${p?F:""}`,q=Q.trim().length>0?Q.trim():void 0,z=o&&H.createElement(Fy,Li(Li({key:"label",labelElement:m,id:l?`${l}-label`:void 0,htmlFor:l,required:N},R),h),o),G=p&&H.createElement(Hy,Qk(Li(Li({key:"description"},g),R),{size:(g==null?void 0:g.size)||R.size,id:(g==null?void 0:g.id)||F}),p),T=H.createElement(d.Fragment,{key:"input"},S(s)),B=typeof u!="boolean"&&u&&H.createElement(By,Qk(Li(Li({},x),R),{size:(x==null?void 0:x.size)||R.size,key:"error",id:(x==null?void 0:x.id)||Y}),u),X=P.map(re=>{switch(re){case"label":return z;case"input":return T;case"description":return G;case"error":return B;default:return null}});return H.createElement(ZY,{value:Li({describedBy:q},tJ(P,{hasDescription:!!G,hasError:!!B}))},H.createElement(Go,Li({className:D(A.root,r),ref:t},O),X))});sM.displayName="@mantine/core/InputWrapper";var gJ=Object.defineProperty,Mh=Object.getOwnPropertySymbols,aM=Object.prototype.hasOwnProperty,iM=Object.prototype.propertyIsEnumerable,Xk=(e,t,n)=>t in e?gJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vJ=(e,t)=>{for(var n in t||(t={}))aM.call(t,n)&&Xk(e,n,t[n]);if(Mh)for(var n of Mh(t))iM.call(t,n)&&Xk(e,n,t[n]);return e},xJ=(e,t)=>{var n={};for(var r in e)aM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mh)for(var r of Mh(e))t.indexOf(r)<0&&iM.call(e,r)&&(n[r]=e[r]);return n};const bJ={},lM=d.forwardRef((e,t)=>{const n=Nr("InputPlaceholder",bJ,e),{sx:r}=n,o=xJ(n,["sx"]);return H.createElement(Go,vJ({component:"span",sx:[s=>s.fn.placeholderStyles(),...l6(r)],ref:t},o))});lM.displayName="@mantine/core/InputPlaceholder";var yJ=Object.defineProperty,CJ=Object.defineProperties,wJ=Object.getOwnPropertyDescriptors,Yk=Object.getOwnPropertySymbols,SJ=Object.prototype.hasOwnProperty,kJ=Object.prototype.propertyIsEnumerable,Jk=(e,t,n)=>t in e?yJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tm=(e,t)=>{for(var n in t||(t={}))SJ.call(t,n)&&Jk(e,n,t[n]);if(Yk)for(var n of Yk(t))kJ.call(t,n)&&Jk(e,n,t[n]);return e},n1=(e,t)=>CJ(e,wJ(t));const xs={xs:Ge(30),sm:Ge(36),md:Ge(42),lg:Ge(50),xl:Ge(60)},jJ=["default","filled","unstyled"];function _J({theme:e,variant:t}){return jJ.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 IJ=Co((e,{multiline:t,radius:n,invalid:r,rightSectionWidth:o,withRightSection:s,iconWidth:i,offsetBottom:l,offsetTop:u,pointer:p},{variant:m,size:h})=>{const g=e.fn.variant({variant:"filled",color:"red"}).background,x=m==="default"||m==="filled"?{minHeight:Xt({size:h,sizes:xs}),paddingLeft:`calc(${Xt({size:h,sizes:xs})} / 3)`,paddingRight:s?o||Xt({size:h,sizes:xs}):`calc(${Xt({size:h,sizes:xs})} / 3)`,borderRadius:e.fn.radius(n)}:m==="unstyled"&&s?{paddingRight:o||Xt({size:h,sizes:xs})}:null;return{wrapper:{position:"relative",marginTop:u?`calc(${e.spacing.xs} / 2)`:void 0,marginBottom:l?`calc(${e.spacing.xs} / 2)`:void 0,"&:has(input:disabled)":{"& .mantine-Input-rightSection":{display:"none"}}},input:n1(tm(tm(n1(tm({},e.fn.fontStyles()),{height:t?m==="unstyled"?void 0:"auto":Xt({size:h,sizes:xs}),WebkitTapHighlightColor:"transparent",lineHeight:t?e.lineHeight:`calc(${Xt({size:h,sizes:xs})} - ${Ge(2)})`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:Xt({size:h,sizes:e.fontSizes}),width:"100%",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"block",textAlign:"left",cursor:p?"pointer":void 0}),_J({theme:e,variant:m})),x),{"&: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:h,sizes:xs})},"&::placeholder":n1(tm({},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:h,sizes:xs}),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:h,sizes:xs})}}});const PJ=IJ;var EJ=Object.defineProperty,MJ=Object.defineProperties,OJ=Object.getOwnPropertyDescriptors,Oh=Object.getOwnPropertySymbols,cM=Object.prototype.hasOwnProperty,uM=Object.prototype.propertyIsEnumerable,Zk=(e,t,n)=>t in e?EJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nm=(e,t)=>{for(var n in t||(t={}))cM.call(t,n)&&Zk(e,n,t[n]);if(Oh)for(var n of Oh(t))uM.call(t,n)&&Zk(e,n,t[n]);return e},ej=(e,t)=>MJ(e,OJ(t)),RJ=(e,t)=>{var n={};for(var r in e)cM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Oh)for(var r of Oh(e))t.indexOf(r)<0&&uM.call(e,r)&&(n[r]=e[r]);return n};const AJ={size:"sm",variant:"default"},ac=d.forwardRef((e,t)=>{const n=Nr("Input",AJ,e),{className:r,error:o,required:s,disabled:i,variant:l,icon:u,style:p,rightSectionWidth:m,iconWidth:h,rightSection:g,rightSectionProps:x,radius:y,size:b,wrapperProps:C,classNames:S,styles:j,__staticSelector:_,multiline:P,sx:I,unstyled:M,pointer:O}=n,A=RJ(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:R,describedBy:N}=eJ(),{classes:Y,cx:F}=PJ({radius:y,multiline:P,invalid:!!o,rightSectionWidth:m?Ge(m):void 0,iconWidth:h,withRightSection:!!g,offsetBottom:D,offsetTop:R,pointer:O},{classNames:S,styles:j,name:["Input",_],unstyled:M,variant:l,size:b}),{systemStyles:V,rest:Q}=zg(A);return H.createElement(Go,nm(nm({className:F(Y.wrapper,r),sx:I,style:p},V),C),u&&H.createElement("div",{className:Y.icon},u),H.createElement(Go,ej(nm({component:"input"},Q),{ref:t,required:s,"aria-invalid":!!o,"aria-describedby":N,disabled:i,"data-disabled":i||void 0,"data-with-icon":!!u||void 0,"data-invalid":!!o||void 0,className:Y.input})),g&&H.createElement("div",ej(nm({},x),{className:Y.rightSection}),g))});ac.displayName="@mantine/core/Input";ac.Wrapper=sM;ac.Label=Fy;ac.Description=Hy;ac.Error=By;ac.Placeholder=lM;const Cu=ac;var DJ=Object.defineProperty,Rh=Object.getOwnPropertySymbols,dM=Object.prototype.hasOwnProperty,fM=Object.prototype.propertyIsEnumerable,tj=(e,t,n)=>t in e?DJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nj=(e,t)=>{for(var n in t||(t={}))dM.call(t,n)&&tj(e,n,t[n]);if(Rh)for(var n of Rh(t))fM.call(t,n)&&tj(e,n,t[n]);return e},TJ=(e,t)=>{var n={};for(var r in e)dM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Rh)for(var r of Rh(e))t.indexOf(r)<0&&fM.call(e,r)&&(n[r]=e[r]);return n};const NJ={multiple:!1},pM=d.forwardRef((e,t)=>{const n=Nr("FileButton",NJ,e),{onChange:r,children:o,multiple:s,accept:i,name:l,form:u,resetRef:p,disabled:m,capture:h,inputProps:g}=n,x=TJ(n,["onChange","children","multiple","accept","name","form","resetRef","disabled","capture","inputProps"]),y=d.useRef(),b=()=>{!m&&y.current.click()},C=j=>{r(s?Array.from(j.currentTarget.files):j.currentTarget.files[0]||null)};return x6(p,()=>{y.current.value=""}),H.createElement(H.Fragment,null,o(nj({onClick:b},x)),H.createElement("input",nj({style:{display:"none"},type:"file",accept:i,multiple:s,onChange:C,ref:Nf(t,y),name:l,form:u,capture:h},g)))});pM.displayName="@mantine/core/FileButton";const mM={xs:Ge(16),sm:Ge(22),md:Ge(26),lg:Ge(30),xl:Ge(36)},$J={xs:Ge(10),sm:Ge(12),md:Ge(14),lg:Ge(16),xl:Ge(18)};var LJ=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:$J}),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 zJ=LJ;var FJ=Object.defineProperty,Ah=Object.getOwnPropertySymbols,hM=Object.prototype.hasOwnProperty,gM=Object.prototype.propertyIsEnumerable,rj=(e,t,n)=>t in e?FJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,BJ=(e,t)=>{for(var n in t||(t={}))hM.call(t,n)&&rj(e,n,t[n]);if(Ah)for(var n of Ah(t))gM.call(t,n)&&rj(e,n,t[n]);return e},HJ=(e,t)=>{var n={};for(var r in e)hM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ah)for(var r of Ah(e))t.indexOf(r)<0&&gM.call(e,r)&&(n[r]=e[r]);return n};const WJ={xs:16,sm:22,md:24,lg:26,xl:30};function vM(e){var t=e,{label:n,classNames:r,styles:o,className:s,onRemove:i,disabled:l,readOnly:u,size:p,radius:m="sm",variant:h,unstyled:g}=t,x=HJ(t,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:y,cx:b}=zJ({disabled:l,readOnly:u,radius:m},{name:"MultiSelect",classNames:r,styles:o,unstyled:g,size:p,variant:h});return H.createElement("div",BJ({className:b(y.defaultValue,s)},x),H.createElement("span",{className:y.defaultValueLabel},n),!l&&!u&&H.createElement(Y6,{"aria-hidden":!0,onMouseDown:i,size:WJ[p],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:y.defaultValueRemove,tabIndex:-1,unstyled:g}))}vM.displayName="@mantine/core/MultiSelect/DefaultValue";function VJ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,disableSelectedItemFiltering:i}){if(!t&&s.length===0)return e;if(!t){const u=[];for(let p=0;pm===e[p].value&&!e[p].disabled))&&u.push(e[p]);return u}const l=[];for(let u=0;up===e[u].value&&!e[u].disabled),e[u])&&l.push(e[u]),!(l.length>=n));u+=1);return l}var UJ=Object.defineProperty,Dh=Object.getOwnPropertySymbols,xM=Object.prototype.hasOwnProperty,bM=Object.prototype.propertyIsEnumerable,oj=(e,t,n)=>t in e?UJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sj=(e,t)=>{for(var n in t||(t={}))xM.call(t,n)&&oj(e,n,t[n]);if(Dh)for(var n of Dh(t))bM.call(t,n)&&oj(e,n,t[n]);return e},GJ=(e,t)=>{var n={};for(var r in e)xM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Dh)for(var r of Dh(e))t.indexOf(r)<0&&bM.call(e,r)&&(n[r]=e[r]);return n};const qJ={xs:Ge(14),sm:Ge(18),md:Ge(20),lg:Ge(24),xl:Ge(28)};function KJ(e){var t=e,{size:n,error:r,style:o}=t,s=GJ(t,["size","error","style"]);const i=Si(),l=Xt({size:n,sizes:qJ});return H.createElement("svg",sj({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:sj({color:r?i.colors.red[6]:i.colors.gray[6],width:l,height:l},o),"data-chevron":!0},s),H.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 QJ=Object.defineProperty,XJ=Object.defineProperties,YJ=Object.getOwnPropertyDescriptors,aj=Object.getOwnPropertySymbols,JJ=Object.prototype.hasOwnProperty,ZJ=Object.prototype.propertyIsEnumerable,ij=(e,t,n)=>t in e?QJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eZ=(e,t)=>{for(var n in t||(t={}))JJ.call(t,n)&&ij(e,n,t[n]);if(aj)for(var n of aj(t))ZJ.call(t,n)&&ij(e,n,t[n]);return e},tZ=(e,t)=>XJ(e,YJ(t));function yM({shouldClear:e,clearButtonProps:t,onClear:n,size:r,error:o}){return e?H.createElement(Y6,tZ(eZ({},t),{variant:"transparent",onClick:n,size:r,onMouseDown:s=>s.preventDefault()})):H.createElement(KJ,{error:o,size:r})}yM.displayName="@mantine/core/SelectRightSection";var nZ=Object.defineProperty,rZ=Object.defineProperties,oZ=Object.getOwnPropertyDescriptors,Th=Object.getOwnPropertySymbols,CM=Object.prototype.hasOwnProperty,wM=Object.prototype.propertyIsEnumerable,lj=(e,t,n)=>t in e?nZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,r1=(e,t)=>{for(var n in t||(t={}))CM.call(t,n)&&lj(e,n,t[n]);if(Th)for(var n of Th(t))wM.call(t,n)&&lj(e,n,t[n]);return e},cj=(e,t)=>rZ(e,oZ(t)),sZ=(e,t)=>{var n={};for(var r in e)CM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Th)for(var r of Th(e))t.indexOf(r)<0&&wM.call(e,r)&&(n[r]=e[r]);return n};function SM(e){var t=e,{styles:n,rightSection:r,rightSectionWidth:o,theme:s}=t,i=sZ(t,["styles","rightSection","rightSectionWidth","theme"]);if(r)return{rightSection:r,rightSectionWidth:o,styles:n};const l=typeof n=="function"?n(s):n;return{rightSection:!i.readOnly&&!(i.disabled&&i.shouldClear)&&H.createElement(yM,r1({},i)),styles:cj(r1({},l),{rightSection:cj(r1({},l==null?void 0:l.rightSection),{pointerEvents:i.shouldClear?void 0:"none"})})}}var aZ=Object.defineProperty,iZ=Object.defineProperties,lZ=Object.getOwnPropertyDescriptors,uj=Object.getOwnPropertySymbols,cZ=Object.prototype.hasOwnProperty,uZ=Object.prototype.propertyIsEnumerable,dj=(e,t,n)=>t in e?aZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dZ=(e,t)=>{for(var n in t||(t={}))cZ.call(t,n)&&dj(e,n,t[n]);if(uj)for(var n of uj(t))uZ.call(t,n)&&dj(e,n,t[n]);return e},fZ=(e,t)=>iZ(e,lZ(t)),pZ=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:xs})} - ${Ge(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:Xt({size:n,sizes:xs})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${Ge(2)}) calc(${e.spacing.xs} / 2)`},searchInput:fZ(dZ({},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 mZ=pZ;var hZ=Object.defineProperty,gZ=Object.defineProperties,vZ=Object.getOwnPropertyDescriptors,Nh=Object.getOwnPropertySymbols,kM=Object.prototype.hasOwnProperty,jM=Object.prototype.propertyIsEnumerable,fj=(e,t,n)=>t in e?hZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ac=(e,t)=>{for(var n in t||(t={}))kM.call(t,n)&&fj(e,n,t[n]);if(Nh)for(var n of Nh(t))jM.call(t,n)&&fj(e,n,t[n]);return e},pj=(e,t)=>gZ(e,vZ(t)),xZ=(e,t)=>{var n={};for(var r in e)kM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Nh)for(var r of Nh(e))t.indexOf(r)<0&&jM.call(e,r)&&(n[r]=e[r]);return n};function bZ(e,t,n){return t?!1:n.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function yZ(e,t){return!!e&&!t.some(n=>n.value.toLowerCase()===e.toLowerCase())}function mj(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 CZ={size:"sm",valueComponent:vM,itemComponent:Ay,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:bZ,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:yZ,switchDirectionOnFlip:!1,zIndex:Ey("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},_M=d.forwardRef((e,t)=>{const n=Nr("MultiSelect",CZ,e),{className:r,style:o,required:s,label:i,description:l,size:u,error:p,classNames:m,styles:h,wrapperProps:g,value:x,defaultValue:y,data:b,onChange:C,valueComponent:S,itemComponent:j,id:_,transitionProps:P,maxDropdownHeight:I,shadow:M,nothingFound:O,onFocus:A,onBlur:D,searchable:R,placeholder:N,filter:Y,limit:F,clearSearchOnChange:V,clearable:Q,clearSearchOnBlur:q,variant:z,onSearchChange:G,searchValue:T,disabled:B,initiallyOpened:X,radius:re,icon:le,rightSection:se,rightSectionWidth:K,creatable:U,getCreateLabel:ee,shouldCreate:de,onCreate:Z,sx:ue,dropdownComponent:fe,onDropdownClose:ge,onDropdownOpen:_e,maxSelectedValues:ye,withinPortal:pe,portalProps:Te,switchDirectionOnFlip:Ae,zIndex:qe,selectOnBlur:Pt,name:tt,dropdownPosition:sn,errorProps:mt,labelProps:ct,descriptionProps:be,form:We,positionDependencies:Rt,onKeyDown:Ut,unstyled:ke,inputContainer:Ct,inputWrapperOrder:Ft,readOnly:Wt,withAsterisk:Le,clearButtonProps:Xe,hoverOnSearchChange:_n,disableSelectedItemFiltering:Me}=n,Ze=xZ(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:dt,theme:Vt}=mZ({invalid:!!p},{name:"MultiSelect",classNames:m,styles:h,unstyled:ke,size:u,variant:z}),{systemStyles:xr,rest:yn}=zg(Ze),mn=d.useRef(),oo=d.useRef({}),Ar=Oy(_),[nr,rr]=d.useState(X),[or,Qr]=d.useState(-1),[Xo,so]=d.useState("column"),[ao,$s]=Jd({value:T,defaultValue:"",finalValue:void 0,onChange:G}),[Xr,fa]=d.useState(!1),{scrollIntoView:Ls,targetRef:Ua,scrollableRef:pa}=y6({duration:0,offset:5,cancelable:!1,isList:!0}),ne=U&&typeof ee=="function";let ae=null;const ve=b.map(Be=>typeof Be=="string"?{label:Be,value:Be}:Be),Pe=c6({data:ve}),[xe,pt]=Jd({value:mj(x,b),defaultValue:mj(y,b),finalValue:[],onChange:C}),it=d.useRef(!!ye&&ye{if(!Wt){const yt=xe.filter(Lt=>Lt!==Be);pt(yt),ye&&yt.length{$s(Be.currentTarget.value),!B&&!it.current&&R&&rr(!0)},wt=Be=>{typeof A=="function"&&A(Be),!B&&!it.current&&R&&rr(!0)},He=VJ({data:Pe,searchable:R,searchValue:ao,limit:F,filter:Y,value:xe,disableSelectedItemFiltering:Me});ne&&de(ao,Pe)&&(ae=ee(ao),He.push({label:ao,value:ao,creatable:!0}));const Ie=Math.min(or,He.length-1),et=(Be,yt,Lt)=>{let Qt=Be;for(;Lt(Qt);)if(Qt=yt(Qt),!He[Qt].disabled)return Qt;return Be};Js(()=>{Qr(_n&&ao?0:-1)},[ao,_n]),Js(()=>{!B&&xe.length>b.length&&rr(!1),ye&&xe.length=ye&&(it.current=!0,rr(!1))},[xe]);const Et=Be=>{if(!Wt)if(V&&$s(""),xe.includes(Be.value))Kt(Be.value);else{if(Be.creatable&&typeof Z=="function"){const yt=Z(Be.value);typeof yt<"u"&&yt!==null&&pt(typeof yt=="string"?[...xe,yt]:[...xe,yt.value])}else pt([...xe,Be.value]);xe.length===ye-1&&(it.current=!0,rr(!1)),He.length===1&&rr(!1)}},At=Be=>{typeof D=="function"&&D(Be),Pt&&He[Ie]&&nr&&Et(He[Ie]),q&&$s(""),rr(!1)},Ht=Be=>{if(Xr||(Ut==null||Ut(Be),Wt)||Be.key!=="Backspace"&&ye&&it.current)return;const yt=Xo==="column",Lt=()=>{Qr(Nn=>{var Jt;const vn=et(Nn,fn=>fn+1,fn=>fn{Qr(Nn=>{var Jt;const vn=et(Nn,fn=>fn-1,fn=>fn>0);return nr&&(Ua.current=oo.current[(Jt=He[vn])==null?void 0:Jt.value],Ls({alignment:yt?"start":"end"})),vn})};switch(Be.key){case"ArrowUp":{Be.preventDefault(),rr(!0),yt?Qt():Lt();break}case"ArrowDown":{Be.preventDefault(),rr(!0),yt?Lt():Qt();break}case"Enter":{Be.preventDefault(),He[Ie]&&nr?Et(He[Ie]):rr(!0);break}case" ":{R||(Be.preventDefault(),He[Ie]&&nr?Et(He[Ie]):rr(!0));break}case"Backspace":{xe.length>0&&ao.length===0&&(pt(xe.slice(0,-1)),rr(!0),ye&&(it.current=!1));break}case"Home":{if(!R){Be.preventDefault(),nr||rr(!0);const Nn=He.findIndex(Jt=>!Jt.disabled);Qr(Nn),Ls({alignment:yt?"end":"start"})}break}case"End":{if(!R){Be.preventDefault(),nr||rr(!0);const Nn=He.map(Jt=>!!Jt.disabled).lastIndexOf(!1);Qr(Nn),Ls({alignment:yt?"end":"start"})}break}case"Escape":rr(!1)}},Zt=xe.map(Be=>{let yt=Pe.find(Lt=>Lt.value===Be&&!Lt.disabled);return!yt&&ne&&(yt={value:Be,label:Be}),yt}).filter(Be=>!!Be).map((Be,yt)=>H.createElement(S,pj(Ac({},Be),{variant:z,disabled:B,className:Ye.value,readOnly:Wt,onRemove:Lt=>{Lt.preventDefault(),Lt.stopPropagation(),Kt(Be.value)},key:Be.value,size:u,styles:h,classNames:m,radius:re,index:yt}))),ln=Be=>xe.includes(Be),an=()=>{var Be;$s(""),pt([]),(Be=mn.current)==null||Be.focus(),ye&&(it.current=!1)},Yt=!Wt&&(He.length>0?nr:nr&&!!O);return Js(()=>{const Be=Yt?_e:ge;typeof Be=="function"&&Be()},[Yt]),H.createElement(Cu.Wrapper,Ac(Ac({required:s,id:Ar,label:i,error:p,description:l,size:u,className:r,style:o,classNames:m,styles:h,__staticSelector:"MultiSelect",sx:ue,errorProps:mt,descriptionProps:be,labelProps:ct,inputContainer:Ct,inputWrapperOrder:Ft,unstyled:ke,withAsterisk:Le,variant:z},xr),g),H.createElement(Ki,{opened:Yt,transitionProps:P,shadow:"sm",withinPortal:pe,portalProps:Te,__staticSelector:"MultiSelect",onDirectionChange:so,switchDirectionOnFlip:Ae,zIndex:qe,dropdownPosition:sn,positionDependencies:[...Rt,ao],classNames:m,styles:h,unstyled:ke,variant:z},H.createElement(Ki.Target,null,H.createElement("div",{className:Ye.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":nr&&Yt?`${Ar}-items`:null,"aria-controls":Ar,"aria-expanded":nr,onMouseLeave:()=>Qr(-1),tabIndex:-1},H.createElement("input",{type:"hidden",name:tt,value:xe.join(","),form:We,disabled:B}),H.createElement(Cu,Ac({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:u,variant:z,disabled:B,error:p,required:s,radius:re,icon:le,unstyled:ke,onMouseDown:Be=>{var yt;Be.preventDefault(),!B&&!it.current&&rr(!nr),(yt=mn.current)==null||yt.focus()},classNames:pj(Ac({},m),{input:dt({[Ye.input]:!R},m==null?void 0:m.input)})},SM({theme:Vt,rightSection:se,rightSectionWidth:K,styles:h,size:u,shouldClear:Q&&xe.length>0,onClear:an,error:p,disabled:B,clearButtonProps:Xe,readOnly:Wt})),H.createElement("div",{className:Ye.values,"data-clearable":Q||void 0},Zt,H.createElement("input",Ac({ref:Nf(t,mn),type:"search",id:Ar,className:dt(Ye.searchInput,{[Ye.searchInputPointer]:!R,[Ye.searchInputInputHidden]:!nr&&xe.length>0||!R&&xe.length>0,[Ye.searchInputEmpty]:xe.length===0}),onKeyDown:Ht,value:ao,onChange:ht,onFocus:wt,onBlur:At,readOnly:!R||it.current||Wt,placeholder:xe.length===0?N:void 0,disabled:B,"data-mantine-stop-propagation":nr,autoComplete:"off",onCompositionStart:()=>fa(!0),onCompositionEnd:()=>fa(!1)},yn)))))),H.createElement(Ki.Dropdown,{component:fe||Wg,maxHeight:I,direction:Xo,id:Ar,innerRef:pa,__staticSelector:"MultiSelect",classNames:m,styles:h},H.createElement(Ry,{data:He,hovered:Ie,classNames:m,styles:h,uuid:Ar,__staticSelector:"MultiSelect",onItemHover:Qr,onItemSelect:Et,itemsRefs:oo,itemComponent:j,size:u,nothingFound:O,isItemSelected:ln,creatable:U&&!!ae,createLabel:ae,unstyled:ke,variant:z}))))});_M.displayName="@mantine/core/MultiSelect";var wZ=Object.defineProperty,SZ=Object.defineProperties,kZ=Object.getOwnPropertyDescriptors,$h=Object.getOwnPropertySymbols,IM=Object.prototype.hasOwnProperty,PM=Object.prototype.propertyIsEnumerable,hj=(e,t,n)=>t in e?wZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,o1=(e,t)=>{for(var n in t||(t={}))IM.call(t,n)&&hj(e,n,t[n]);if($h)for(var n of $h(t))PM.call(t,n)&&hj(e,n,t[n]);return e},jZ=(e,t)=>SZ(e,kZ(t)),_Z=(e,t)=>{var n={};for(var r in e)IM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&$h)for(var r of $h(e))t.indexOf(r)<0&&PM.call(e,r)&&(n[r]=e[r]);return n};const IZ={type:"text",size:"sm",__staticSelector:"TextInput"},EM=d.forwardRef((e,t)=>{const n=QE("TextInput",IZ,e),{inputProps:r,wrapperProps:o}=n,s=_Z(n,["inputProps","wrapperProps"]);return H.createElement(Cu.Wrapper,o1({},o),H.createElement(Cu,jZ(o1(o1({},r),s),{ref:t})))});EM.displayName="@mantine/core/TextInput";function PZ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,filterDataOnExactSearchMatch:i}){if(!t)return e;const l=s!=null&&e.find(p=>p.value===s)||null;if(l&&!i&&(l==null?void 0:l.label)===r){if(n){if(n>=e.length)return e;const p=e.indexOf(l),m=p+n,h=m-e.length;return h>0?e.slice(p-h):e.slice(p,m)}return e}const u=[];for(let p=0;p=n));p+=1);return u}var EZ=Co(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}}));const MZ=EZ;var OZ=Object.defineProperty,RZ=Object.defineProperties,AZ=Object.getOwnPropertyDescriptors,Lh=Object.getOwnPropertySymbols,MM=Object.prototype.hasOwnProperty,OM=Object.prototype.propertyIsEnumerable,gj=(e,t,n)=>t in e?OZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xd=(e,t)=>{for(var n in t||(t={}))MM.call(t,n)&&gj(e,n,t[n]);if(Lh)for(var n of Lh(t))OM.call(t,n)&&gj(e,n,t[n]);return e},s1=(e,t)=>RZ(e,AZ(t)),DZ=(e,t)=>{var n={};for(var r in e)MM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Lh)for(var r of Lh(e))t.indexOf(r)<0&&OM.call(e,r)&&(n[r]=e[r]);return n};function TZ(e,t){return t.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function NZ(e,t){return!!e&&!t.some(n=>n.label.toLowerCase()===e.toLowerCase())}const $Z={required:!1,size:"sm",shadow:"sm",itemComponent:Ay,transitionProps:{transition:"fade",duration:0},initiallyOpened:!1,filter:TZ,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:NZ,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:Ey("popover"),positionDependencies:[],dropdownPosition:"flip"},Wy=d.forwardRef((e,t)=>{const n=QE("Select",$Z,e),{inputProps:r,wrapperProps:o,shadow:s,data:i,value:l,defaultValue:u,onChange:p,itemComponent:m,onKeyDown:h,onBlur:g,onFocus:x,transitionProps:y,initiallyOpened:b,unstyled:C,classNames:S,styles:j,filter:_,maxDropdownHeight:P,searchable:I,clearable:M,nothingFound:O,limit:A,disabled:D,onSearchChange:R,searchValue:N,rightSection:Y,rightSectionWidth:F,creatable:V,getCreateLabel:Q,shouldCreate:q,selectOnBlur:z,onCreate:G,dropdownComponent:T,onDropdownClose:B,onDropdownOpen:X,withinPortal:re,portalProps:le,switchDirectionOnFlip:se,zIndex:K,name:U,dropdownPosition:ee,allowDeselect:de,placeholder:Z,filterDataOnExactSearchMatch:ue,form:fe,positionDependencies:ge,readOnly:_e,clearButtonProps:ye,hoverOnSearchChange:pe}=n,Te=DZ(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:Ae,cx:qe,theme:Pt}=MZ(),[tt,sn]=d.useState(b),[mt,ct]=d.useState(-1),be=d.useRef(),We=d.useRef({}),[Rt,Ut]=d.useState("column"),ke=Rt==="column",{scrollIntoView:Ct,targetRef:Ft,scrollableRef:Wt}=y6({duration:0,offset:5,cancelable:!1,isList:!0}),Le=de===void 0?M:de,Xe=ae=>{if(tt!==ae){sn(ae);const ve=ae?X:B;typeof ve=="function"&&ve()}},_n=V&&typeof Q=="function";let Me=null;const Ze=i.map(ae=>typeof ae=="string"?{label:ae,value:ae}:ae),Ye=c6({data:Ze}),[dt,Vt,xr]=Jd({value:l,defaultValue:u,finalValue:null,onChange:p}),yn=Ye.find(ae=>ae.value===dt),[mn,oo]=Jd({value:N,defaultValue:(yn==null?void 0:yn.label)||"",finalValue:void 0,onChange:R}),Ar=ae=>{oo(ae),I&&typeof R=="function"&&R(ae)},nr=()=>{var ae;_e||(Vt(null),xr||Ar(""),(ae=be.current)==null||ae.focus())};d.useEffect(()=>{const ae=Ye.find(ve=>ve.value===dt);ae?Ar(ae.label):(!_n||!dt)&&Ar("")},[dt]),d.useEffect(()=>{yn&&(!I||!tt)&&Ar(yn.label)},[yn==null?void 0:yn.label]);const rr=ae=>{if(!_e)if(Le&&(yn==null?void 0:yn.value)===ae.value)Vt(null),Xe(!1);else{if(ae.creatable&&typeof G=="function"){const ve=G(ae.value);typeof ve<"u"&&ve!==null&&Vt(typeof ve=="string"?ve:ve.value)}else Vt(ae.value);xr||Ar(ae.label),ct(-1),Xe(!1),be.current.focus()}},or=PZ({data:Ye,searchable:I,limit:A,searchValue:mn,filter:_,filterDataOnExactSearchMatch:ue,value:dt});_n&&q(mn,or)&&(Me=Q(mn),or.push({label:mn,value:mn,creatable:!0}));const Qr=(ae,ve,Pe)=>{let xe=ae;for(;Pe(xe);)if(xe=ve(xe),!or[xe].disabled)return xe;return ae};Js(()=>{ct(pe&&mn?0:-1)},[mn,pe]);const Xo=dt?or.findIndex(ae=>ae.value===dt):0,so=!_e&&(or.length>0?tt:tt&&!!O),ao=()=>{ct(ae=>{var ve;const Pe=Qr(ae,xe=>xe-1,xe=>xe>0);return Ft.current=We.current[(ve=or[Pe])==null?void 0:ve.value],so&&Ct({alignment:ke?"start":"end"}),Pe})},$s=()=>{ct(ae=>{var ve;const Pe=Qr(ae,xe=>xe+1,xe=>xewindow.setTimeout(()=>{var ae;Ft.current=We.current[(ae=or[Xo])==null?void 0:ae.value],Ct({alignment:ke?"end":"start"})},50);Js(()=>{so&&Xr()},[so]);const fa=ae=>{switch(typeof h=="function"&&h(ae),ae.key){case"ArrowUp":{ae.preventDefault(),tt?ke?ao():$s():(ct(Xo),Xe(!0),Xr());break}case"ArrowDown":{ae.preventDefault(),tt?ke?$s():ao():(ct(Xo),Xe(!0),Xr());break}case"Home":{if(!I){ae.preventDefault(),tt||Xe(!0);const ve=or.findIndex(Pe=>!Pe.disabled);ct(ve),so&&Ct({alignment:ke?"end":"start"})}break}case"End":{if(!I){ae.preventDefault(),tt||Xe(!0);const ve=or.map(Pe=>!!Pe.disabled).lastIndexOf(!1);ct(ve),so&&Ct({alignment:ke?"end":"start"})}break}case"Escape":{ae.preventDefault(),Xe(!1),ct(-1);break}case" ":{I||(ae.preventDefault(),or[mt]&&tt?rr(or[mt]):(Xe(!0),ct(Xo),Xr()));break}case"Enter":I||ae.preventDefault(),or[mt]&&tt&&(ae.preventDefault(),rr(or[mt]))}},Ls=ae=>{typeof g=="function"&&g(ae);const ve=Ye.find(Pe=>Pe.value===dt);z&&or[mt]&&tt&&rr(or[mt]),Ar((ve==null?void 0:ve.label)||""),Xe(!1)},Ua=ae=>{typeof x=="function"&&x(ae),I&&Xe(!0)},pa=ae=>{_e||(Ar(ae.currentTarget.value),M&&ae.currentTarget.value===""&&Vt(null),ct(-1),Xe(!0))},ne=()=>{_e||(Xe(!tt),dt&&!tt&&ct(Xo))};return H.createElement(Cu.Wrapper,s1(xd({},o),{__staticSelector:"Select"}),H.createElement(Ki,{opened:so,transitionProps:y,shadow:s,withinPortal:re,portalProps:le,__staticSelector:"Select",onDirectionChange:Ut,switchDirectionOnFlip:se,zIndex:K,dropdownPosition:ee,positionDependencies:[...ge,mn],classNames:S,styles:j,unstyled:C,variant:r.variant},H.createElement(Ki.Target,null,H.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":so?`${r.id}-items`:null,"aria-controls":r.id,"aria-expanded":so,onMouseLeave:()=>ct(-1),tabIndex:-1},H.createElement("input",{type:"hidden",name:U,value:dt||"",form:fe,disabled:D}),H.createElement(Cu,xd(s1(xd(xd({autoComplete:"off",type:"search"},r),Te),{ref:Nf(t,be),onKeyDown:fa,__staticSelector:"Select",value:mn,placeholder:Z,onChange:pa,"aria-autocomplete":"list","aria-controls":so?`${r.id}-items`:null,"aria-activedescendant":mt>=0?`${r.id}-${mt}`:null,onMouseDown:ne,onBlur:Ls,onFocus:Ua,readOnly:!I||_e,disabled:D,"data-mantine-stop-propagation":so,name:null,classNames:s1(xd({},S),{input:qe({[Ae.input]:!I},S==null?void 0:S.input)})}),SM({theme:Pt,rightSection:Y,rightSectionWidth:F,styles:j,size:r.size,shouldClear:M&&!!yn,onClear:nr,error:o.error,clearButtonProps:ye,disabled:D,readOnly:_e}))))),H.createElement(Ki.Dropdown,{component:T||Wg,maxHeight:P,direction:Rt,id:r.id,innerRef:Wt,__staticSelector:"Select",classNames:S,styles:j},H.createElement(Ry,{data:or,hovered:mt,classNames:S,styles:j,isItemSelected:ae=>ae===dt,uuid:r.id,__staticSelector:"Select",onItemHover:ct,onItemSelect:rr,itemsRefs:We,itemComponent:m,size:r.size,nothingFound:O,creatable:_n&&!!Me,createLabel:Me,"aria-label":o.label,unstyled:C,variant:r.variant}))))});Wy.displayName="@mantine/core/Select";const zf=()=>{const[e,t,n,r,o,s,i,l,u,p,m,h,g,x,y,b,C,S,j,_,P,I,M,O,A,D,R,N,Y,F,V,Q,q,z,G,T,B,X,re,le,se,K,U,ee,de,Z,ue,fe,ge,_e,ye,pe,Te,Ae,qe,Pt,tt,sn,mt,ct,be,We,Rt,Ut,ke,Ct,Ft,Wt,Le,Xe,_n,Me,Ze,Ye,dt,Vt]=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:l,base450:u,base500:p,base550:m,base600:h,base650:g,base700:x,base750:y,base800:b,base850:C,base900:S,base950:j,accent50:_,accent100:P,accent150:I,accent200:M,accent250:O,accent300:A,accent350:D,accent400:R,accent450:N,accent500:Y,accent550:F,accent600:V,accent650:Q,accent700:q,accent750:z,accent800:G,accent850:T,accent900:B,accent950:X,baseAlpha50:re,baseAlpha100:le,baseAlpha150:se,baseAlpha200:K,baseAlpha250:U,baseAlpha300:ee,baseAlpha350:de,baseAlpha400:Z,baseAlpha450:ue,baseAlpha500:fe,baseAlpha550:ge,baseAlpha600:_e,baseAlpha650:ye,baseAlpha700:pe,baseAlpha750:Te,baseAlpha800:Ae,baseAlpha850:qe,baseAlpha900:Pt,baseAlpha950:tt,accentAlpha50:sn,accentAlpha100:mt,accentAlpha150:ct,accentAlpha200:be,accentAlpha250:We,accentAlpha300:Rt,accentAlpha350:Ut,accentAlpha400:ke,accentAlpha450:Ct,accentAlpha500:Ft,accentAlpha550:Wt,accentAlpha600:Le,accentAlpha650:Xe,accentAlpha700:_n,accentAlpha750:Me,accentAlpha800:Ze,accentAlpha850:Ye,accentAlpha900:dt,accentAlpha950:Vt}},Ke=(e,t)=>n=>n==="light"?e:t,RM=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:l,base800:u,base900:p,accent200:m,accent300:h,accent400:g,accent500:x,accent600:y}=zf(),{colorMode:b}=Ci(),[C]=Ks("shadows",["dark-lg"]),[S,j,_]=Ks("space",[1,2,6]),[P]=Ks("radii",["base"]),[I]=Ks("lineHeights",["base"]);return d.useCallback(()=>({label:{color:Ke(l,r)(b)},separatorLabel:{color:Ke(s,s)(b),"::after":{borderTopColor:Ke(r,l)(b)}},input:{border:"unset",backgroundColor:Ke(e,p)(b),borderRadius:P,borderStyle:"solid",borderWidth:"2px",borderColor:Ke(n,u)(b),color:Ke(p,t)(b),minHeight:"unset",lineHeight:I,height:"auto",paddingRight:0,paddingLeft:0,paddingInlineStart:j,paddingInlineEnd:_,paddingTop:S,paddingBottom:S,fontWeight:600,"&:hover":{borderColor:Ke(r,i)(b)},"&:focus":{borderColor:Ke(h,y)(b)},"&:is(:focus, :hover)":{borderColor:Ke(o,s)(b)},"&:focus-within":{borderColor:Ke(m,y)(b)},"&[data-disabled]":{backgroundColor:Ke(r,l)(b),color:Ke(i,o)(b),cursor:"not-allowed"}},value:{backgroundColor:Ke(t,p)(b),color:Ke(p,t)(b),button:{color:Ke(p,t)(b)},"&:hover":{backgroundColor:Ke(r,l)(b),cursor:"pointer"}},dropdown:{backgroundColor:Ke(n,u)(b),borderColor:Ke(n,u)(b),boxShadow:C},item:{backgroundColor:Ke(n,u)(b),color:Ke(u,n)(b),padding:6,"&[data-hovered]":{color:Ke(p,t)(b),backgroundColor:Ke(r,l)(b)},"&[data-active]":{backgroundColor:Ke(r,l)(b),"&:hover":{color:Ke(p,t)(b),backgroundColor:Ke(r,l)(b)}},"&[data-selected]":{backgroundColor:Ke(g,y)(b),color:Ke(e,t)(b),fontWeight:600,"&:hover":{backgroundColor:Ke(x,x)(b),color:Ke("white",e)(b)}},"&[data-disabled]":{color:Ke(s,i)(b),cursor:"not-allowed"}},rightSection:{width:32,button:{color:Ke(p,t)(b)}}}),[m,h,g,x,y,t,n,r,o,e,s,i,l,u,p,C,b,I,P,S,j,_])},AM=Oe((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,onChange:s,label:i,disabled:l,...u}=e,p=te(),[m,h]=d.useState(""),g=d.useCallback(C=>{C.shiftKey&&p(Vo(!0))},[p]),x=d.useCallback(C=>{C.shiftKey||p(Vo(!1))},[p]),y=d.useCallback(C=>{s&&s(C)},[s]),b=RM();return a.jsx(Fn,{label:r,placement:"top",hasArrow:!0,children:a.jsxs(Kn,{ref:t,isDisabled:l,position:"static","data-testid":`select-${i||e.placeholder}`,children:[i&&a.jsx(Rr,{children:i}),a.jsx(Wy,{ref:o,disabled:l,searchValue:m,onSearchChange:h,onChange:y,onKeyDown:g,onKeyUp:x,searchable:n,maxDropdownHeight:300,styles:b,...u})]})})});AM.displayName="IAIMantineSearchableSelect";const tr=d.memo(AM),LZ=ce([we],({changeBoardModal:e})=>{const{isModalOpen:t,imagesToChange:n}=e;return{isModalOpen:t,imagesToChange:n}},je),zZ=()=>{const e=te(),[t,n]=d.useState(),{data:r,isFetching:o}=hf(),{imagesToChange:s,isModalOpen:i}=W(LZ),[l]=CD(),[u]=wD(),{t:p}=J(),m=d.useMemo(()=>{const y=[{label:p("boards.uncategorized"),value:"none"}];return(r??[]).forEach(b=>y.push({label:b.board_name,value:b.board_id})),y},[r,p]),h=d.useCallback(()=>{e(Pw()),e(gb(!1))},[e]),g=d.useCallback(()=>{!s.length||!t||(t==="none"?u({imageDTOs:s}):l({imageDTOs:s,board_id:t}),n(null),e(Pw()))},[l,e,s,u,t]),x=d.useRef(null);return a.jsx(Mf,{isOpen:i,onClose:h,leastDestructiveRef:x,isCentered:!0,children:a.jsx(oa,{children:a.jsxs(Of,{children:[a.jsx(ra,{fontSize:"lg",fontWeight:"bold",children:p("boards.changeBoard")}),a.jsx(sa,{children:a.jsxs($,{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:y=>n(y),value:t,data:m})]})}),a.jsxs(Oa,{children:[a.jsx(Mt,{ref:x,onClick:h,children:p("boards.cancel")}),a.jsx(Mt,{colorScheme:"accent",onClick:g,ml:3,children:p("boards.move")})]})]})})})},FZ=d.memo(zZ),DM=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,tooltip:i,helperText:l,...u}=e;return a.jsx(Fn,{label:i,hasArrow:!0,placement:"top",isDisabled:!i,children:a.jsx(Kn,{isDisabled:n,width:r,alignItems:"center",...o,children:a.jsxs($,{sx:{flexDir:"column",w:"full"},children:[a.jsxs($,{sx:{alignItems:"center",w:"full"},children:[t&&a.jsx(Rr,{my:1,flexGrow:1,sx:{cursor:n?"not-allowed":"pointer",...s==null?void 0:s.sx,pe:4},...s,children:t}),a.jsx(jy,{...u})]}),l&&a.jsx(FP,{children:a.jsx(Se,{variant:"subtext",children:l})})]})})})};DM.displayName="IAISwitch";const kr=d.memo(DM),BZ=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(_f,{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})]})},TM=d.memo(BZ),HZ=ce([we,SD],(e,t)=>{const{system:n,config:r,deleteImageModal:o}=e,{shouldConfirmOnDelete:s}=n,{canRestoreDeletedImagesFromBin:i}=r,{imagesToDelete:l,isModalOpen:u}=o,p=(l??[]).map(({image_name:h})=>II(e,h)),m={isInitialImage:Qs(p,h=>h.isInitialImage),isCanvasImage:Qs(p,h=>h.isCanvasImage),isNodesImage:Qs(p,h=>h.isNodesImage),isControlImage:Qs(p,h=>h.isControlImage)};return{shouldConfirmOnDelete:s,canRestoreDeletedImagesFromBin:i,imagesToDelete:l,imagesUsage:t,isModalOpen:u,imageUsageSummary:m}},je),WZ=()=>{const e=te(),{t}=J(),{shouldConfirmOnDelete:n,canRestoreDeletedImagesFromBin:r,imagesToDelete:o,imagesUsage:s,isModalOpen:i,imageUsageSummary:l}=W(HZ),u=d.useCallback(g=>e(PI(!g.target.checked)),[e]),p=d.useCallback(()=>{e(Ew()),e(kD(!1))},[e]),m=d.useCallback(()=>{!o.length||!s.length||(e(Ew()),e(jD({imageDTOs:o,imagesUsage:s})))},[e,o,s]),h=d.useRef(null);return a.jsx(Mf,{isOpen:i,onClose:p,leastDestructiveRef:h,isCentered:!0,children:a.jsx(oa,{children:a.jsxs(Of,{children:[a.jsx(ra,{fontSize:"lg",fontWeight:"bold",children:t("gallery.deleteImage")}),a.jsx(sa,{children:a.jsxs($,{direction:"column",gap:3,children:[a.jsx(TM,{imageUsage:l}),a.jsx(no,{}),a.jsx(Se,{children:t(r?"gallery.deleteImageBin":"gallery.deleteImagePermanent")}),a.jsx(Se,{children:t("common.areYouSure")}),a.jsx(kr,{label:t("common.dontAskMeAgain"),isChecked:!n,onChange:u})]})}),a.jsxs(Oa,{children:[a.jsx(Mt,{ref:h,onClick:p,children:"Cancel"}),a.jsx(Mt,{colorScheme:"error",onClick:m,ml:3,children:"Delete"})]})]})})})},VZ=d.memo(WZ),NM=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(Pa,{ref:t,role:n,colorScheme:s?"accent":"base","data-testid":r,...i})})});NM.displayName="IAIIconButton";const ot=d.memo(NM);var $M={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},vj=H.createContext&&H.createContext($M),Qi=globalThis&&globalThis.__assign||function(){return Qi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const t=W(i=>i.config.disabledTabs),n=W(i=>i.config.disabledFeatures),r=W(i=>i.config.disabledSDFeatures),o=d.useMemo(()=>n.includes(e)||r.includes(e)||t.includes(e),[n,r,t,e]),s=d.useMemo(()=>!(n.includes(e)||r.includes(e)||t.includes(e)),[n,r,t,e]);return{isFeatureDisabled:o,isFeatureEnabled:s}};function Ree(e){const{title:t,hotkey:n,description:r}=e;return a.jsxs(tl,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs(tl,{children:[a.jsx(Se,{fontWeight:600,children:t}),r&&a.jsx(Se,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),a.jsx(De,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function Aee({children:e}){const{isOpen:t,onOpen:n,onClose:r}=Uo(),{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"}],l=[{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"}],u=[{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"}],m=h=>a.jsx($,{flexDir:"column",gap:4,children:h.map((g,x)=>a.jsxs($,{flexDir:"column",px:2,gap:4,children:[a.jsx(Ree,{title:g.title,description:g.desc,hotkey:g.hotkey}),x{const{data:t}=_D(),n=d.useRef(null),r=eO(n);return a.jsxs($,{alignItems:"center",gap:5,ps:1,ref:n,children:[a.jsx(wi,{src:vb,alt:"invoke-ai-logo",sx:{w:"32px",h:"32px",minW:"32px",minH:"32px",userSelect:"none"}}),a.jsxs($,{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(Mr.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")})]})]})},Bee=d.memo(Fee),tO=Oe((e,t)=>{const{tooltip:n,inputRef:r,label:o,disabled:s,required:i,...l}=e,u=RM();return a.jsx(Fn,{label:n,placement:"top",hasArrow:!0,children:a.jsxs(Kn,{ref:t,isRequired:i,isDisabled:s,position:"static","data-testid":`select-${o||e.placeholder}`,children:[a.jsx(Rr,{children:o}),a.jsx(Wy,{disabled:s,ref:r,styles:u,...l})]})})});tO.displayName="IAIMantineSelect";const Tr=d.memo(tO),Hee={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"})},Wee={CONNECTED:"common.statusConnected",DISCONNECTED:"common.statusDisconnected",PROCESSING:"common.statusProcessing",ERROR:"common.statusError",LOADING_MODEL:"common.statusLoadingModel"},nO=ce(we,({system:e})=>e.language,je);function Vs(e){const{t}=J(),{label:n,textProps:r,useBadge:o=!1,badgeLabel:s=t("settings.experimental"),badgeProps:i,...l}=e;return a.jsxs($,{justifyContent:"space-between",py:1,children:[a.jsxs($,{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(kr,{...l})]})}const Vee=e=>a.jsx($,{sx:{flexDirection:"column",gap:2,p:4,borderRadius:"base",bg:"base.100",_dark:{bg:"base.900"}},children:e.children}),Fc=d.memo(Vee);function Uee(){const{t:e}=J(),t=te(),{data:n}=ID(void 0,{refetchOnMountOrArgChange:!0}),[r,{isLoading:o}]=PD(),{data:s}=Fa(),i=s&&(s.queue.in_progress>0||s.queue.pending>0),l=d.useCallback(()=>{i||r().unwrap().then(u=>{t(EI()),t(MI()),t($t({title:e("settings.intermediatesCleared",{count:u}),status:"info"}))}).catch(()=>{t($t({title:e("settings.intermediatesClearedFailed"),status:"error"}))})},[e,r,t,i]);return a.jsxs(Fc,{children:[a.jsx(xo,{size:"sm",children:e("settings.clearIntermediates")}),a.jsx(Mt,{tooltip:i?e("settings.clearIntermediatesDisabled"):void 0,colorScheme:"warning",onClick:l,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 Gee=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:l,base800:u,base900:p,accent200:m,accent300:h,accent400:g,accent500:x,accent600:y}=zf(),{colorMode:b}=Ci(),[C]=Ks("shadows",["dark-lg"]);return d.useCallback(()=>({label:{color:Ke(l,r)(b)},separatorLabel:{color:Ke(s,s)(b),"::after":{borderTopColor:Ke(r,l)(b)}},searchInput:{":placeholder":{color:Ke(r,l)(b)}},input:{backgroundColor:Ke(e,p)(b),borderWidth:"2px",borderColor:Ke(n,u)(b),color:Ke(p,t)(b),paddingRight:24,fontWeight:600,"&:hover":{borderColor:Ke(r,i)(b)},"&:focus":{borderColor:Ke(h,y)(b)},"&:is(:focus, :hover)":{borderColor:Ke(o,s)(b)},"&:focus-within":{borderColor:Ke(m,y)(b)},"&[data-disabled]":{backgroundColor:Ke(r,l)(b),color:Ke(i,o)(b),cursor:"not-allowed"}},value:{backgroundColor:Ke(n,u)(b),color:Ke(p,t)(b),button:{color:Ke(p,t)(b)},"&:hover":{backgroundColor:Ke(r,l)(b),cursor:"pointer"}},dropdown:{backgroundColor:Ke(n,u)(b),borderColor:Ke(n,u)(b),boxShadow:C},item:{backgroundColor:Ke(n,u)(b),color:Ke(u,n)(b),padding:6,"&[data-hovered]":{color:Ke(p,t)(b),backgroundColor:Ke(r,l)(b)},"&[data-active]":{backgroundColor:Ke(r,l)(b),"&:hover":{color:Ke(p,t)(b),backgroundColor:Ke(r,l)(b)}},"&[data-selected]":{backgroundColor:Ke(g,y)(b),color:Ke(e,t)(b),fontWeight:600,"&:hover":{backgroundColor:Ke(x,x)(b),color:Ke("white",e)(b)}},"&[data-disabled]":{color:Ke(s,i)(b),cursor:"not-allowed"}},rightSection:{width:24,padding:20,button:{color:Ke(p,t)(b)}}}),[m,h,g,x,y,t,n,r,o,e,s,i,l,u,p,C,b])},rO=Oe((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,label:s,disabled:i,...l}=e,u=te(),p=d.useCallback(g=>{g.shiftKey&&u(Vo(!0))},[u]),m=d.useCallback(g=>{g.shiftKey||u(Vo(!1))},[u]),h=Gee();return a.jsx(Fn,{label:r,placement:"top",hasArrow:!0,isOpen:!0,children:a.jsxs(Kn,{ref:t,isDisabled:i,position:"static",children:[s&&a.jsx(Rr,{children:s}),a.jsx(_M,{ref:o,disabled:i,onKeyDown:p,onKeyUp:m,searchable:n,maxDropdownHeight:300,styles:h,...l})]})})});rO.displayName="IAIMantineMultiSelect";const qee=d.memo(rO),Kee=Ro(tg,(e,t)=>({value:t,label:e})).sort((e,t)=>e.label.localeCompare(t.label));function Qee(){const e=te(),{t}=J(),n=W(o=>o.ui.favoriteSchedulers),r=d.useCallback(o=>{e(ED(o))},[e]);return a.jsx(qee,{label:t("settings.favoriteSchedulers"),value:n,data:Kee,onChange:r,clearable:!0,searchable:!0,maxSelectedValues:99,placeholder:t("settings.favoriteSchedulersPlaceholder")})}const Xee=ce([we],({system:e,ui:t})=>{const{shouldConfirmOnDelete:n,enableImageDebugging:r,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:l,shouldUseWatermarker:u,shouldEnableInformationalPopovers:p}=e,{shouldUseSliders:m,shouldShowProgressInViewer:h,shouldAutoChangeDimensions:g}=t;return{shouldConfirmOnDelete:n,enableImageDebugging:r,shouldUseSliders:m,shouldShowProgressInViewer:h,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:l,shouldUseWatermarker:u,shouldAutoChangeDimensions:g,shouldEnableInformationalPopovers:p}},{memoizeOptions:{resultEqualityCheck:Tn}}),Yee=({children:e,config:t})=>{const n=te(),{t:r}=J(),[o,s]=d.useState(3),i=(t==null?void 0:t.shouldShowDeveloperSettings)??!0,l=(t==null?void 0:t.shouldShowResetWebUiText)??!0,u=(t==null?void 0:t.shouldShowClearIntermediates)??!0,p=(t==null?void 0:t.shouldShowLocalizationToggle)??!0;d.useEffect(()=>{i||n(Mw(!1))},[i,n]);const{isNSFWCheckerAvailable:m,isWatermarkerAvailable:h}=OI(void 0,{selectFromResult:({data:X})=>({isNSFWCheckerAvailable:(X==null?void 0:X.nsfw_methods.includes("nsfw_checker"))??!1,isWatermarkerAvailable:(X==null?void 0:X.watermarking_methods.includes("invisible_watermark"))??!1})}),{isOpen:g,onOpen:x,onClose:y}=Uo(),{isOpen:b,onOpen:C,onClose:S}=Uo(),{shouldConfirmOnDelete:j,enableImageDebugging:_,shouldUseSliders:P,shouldShowProgressInViewer:I,consoleLogLevel:M,shouldLogToConsole:O,shouldAntialiasProgressImage:A,shouldUseNSFWChecker:D,shouldUseWatermarker:R,shouldAutoChangeDimensions:N,shouldEnableInformationalPopovers:Y}=W(Xee),F=d.useCallback(()=>{Object.keys(window.localStorage).forEach(X=>{(MD.includes(X)||X.startsWith(OD))&&localStorage.removeItem(X)}),y(),C(),setInterval(()=>s(X=>X-1),1e3)},[y,C]);d.useEffect(()=>{o<=0&&window.location.reload()},[o]);const V=d.useCallback(X=>{n(RD(X))},[n]),Q=d.useCallback(X=>{n(AD(X))},[n]),q=d.useCallback(X=>{n(Mw(X.target.checked))},[n]),{colorMode:z,toggleColorMode:G}=Ci(),T=jn("localization").isFeatureEnabled,B=W(nO);return a.jsxs(a.Fragment,{children:[d.cloneElement(e,{onClick:x}),a.jsxs(ql,{isOpen:g,onClose:y,size:"2xl",isCentered:!0,children:[a.jsx(oa,{}),a.jsxs(Kl,{children:[a.jsx(ra,{bg:"none",children:r("common.settingsLabel")}),a.jsx(Rf,{}),a.jsx(sa,{children:a.jsxs($,{sx:{gap:4,flexDirection:"column"},children:[a.jsxs(Fc,{children:[a.jsx(xo,{size:"sm",children:r("settings.general")}),a.jsx(Vs,{label:r("settings.confirmOnDelete"),isChecked:j,onChange:X=>n(PI(X.target.checked))})]}),a.jsxs(Fc,{children:[a.jsx(xo,{size:"sm",children:r("settings.generation")}),a.jsx(Qee,{}),a.jsx(Vs,{label:"Enable NSFW Checker",isDisabled:!m,isChecked:D,onChange:X=>n(DD(X.target.checked))}),a.jsx(Vs,{label:"Enable Invisible Watermark",isDisabled:!h,isChecked:R,onChange:X=>n(TD(X.target.checked))})]}),a.jsxs(Fc,{children:[a.jsx(xo,{size:"sm",children:r("settings.ui")}),a.jsx(Vs,{label:r("common.darkMode"),isChecked:z==="dark",onChange:G}),a.jsx(Vs,{label:r("settings.useSlidersForAll"),isChecked:P,onChange:X=>n(ND(X.target.checked))}),a.jsx(Vs,{label:r("settings.showProgressInViewer"),isChecked:I,onChange:X=>n(RI(X.target.checked))}),a.jsx(Vs,{label:r("settings.antialiasProgressImages"),isChecked:A,onChange:X=>n($D(X.target.checked))}),a.jsx(Vs,{label:r("settings.autoChangeDimensions"),isChecked:N,onChange:X=>n(LD(X.target.checked))}),p&&a.jsx(Tr,{disabled:!T,label:r("common.languagePickerLabel"),value:B,data:Object.entries(Hee).map(([X,re])=>({value:X,label:re})),onChange:Q}),a.jsx(Vs,{label:"Enable informational popovers",isChecked:Y,onChange:X=>n(zD(X.target.checked))})]}),i&&a.jsxs(Fc,{children:[a.jsx(xo,{size:"sm",children:r("settings.developer")}),a.jsx(Vs,{label:r("settings.shouldLogToConsole"),isChecked:O,onChange:q}),a.jsx(Tr,{disabled:!O,label:r("settings.consoleLogLevel"),onChange:V,value:M,data:FD.concat()}),a.jsx(Vs,{label:r("settings.enableImageDebugging"),isChecked:_,onChange:X=>n(BD(X.target.checked))})]}),u&&a.jsx(Uee,{}),a.jsxs(Fc,{children:[a.jsx(xo,{size:"sm",children:r("settings.resetWebUI")}),a.jsx(Mt,{colorScheme:"error",onClick:F,children:r("settings.resetWebUI")}),l&&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(Oa,{children:a.jsx(Mt,{onClick:y,children:r("common.close")})})]})]}),a.jsxs(ql,{closeOnOverlayClick:!1,isOpen:b,onClose:S,isCentered:!0,closeOnEsc:!1,children:[a.jsx(oa,{backdropFilter:"blur(40px)"}),a.jsxs(Kl,{children:[a.jsx(ra,{}),a.jsx(sa,{children:a.jsx($,{justifyContent:"center",children:a.jsx(Se,{fontSize:"lg",children:a.jsxs(Se,{children:[r("settings.resetComplete")," Reloading in ",o,"..."]})})})}),a.jsx(Oa,{})]})]})]})},Jee=d.memo(Yee),Zee=ce(we,({system:e})=>{const{isConnected:t,status:n}=e;return{isConnected:t,statusTranslationKey:Wee[n]}},je),Cj={ok:"green.400",working:"yellow.400",error:"red.400"},wj={ok:"green.600",working:"yellow.500",error:"red.500"},ete=()=>{const{isConnected:e,statusTranslationKey:t}=W(Zee),{t:n}=J(),r=d.useRef(null),{data:o}=Fa(),s=d.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($,{ref:r,h:"full",px:2,alignItems:"center",gap:5,children:[a.jsx(yo,{children:i&&a.jsx(Mr.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:wj[s],_dark:{color:Cj[s]}},children:n(t)})},"statusText")}),a.jsx(Lr,{as:ree,sx:{boxSize:"0.5rem",color:wj[s],_dark:{color:Cj[s]}}})]})},tte=d.memo(ete),nte=()=>{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($,{sx:{gap:2,alignItems:"center"},children:[a.jsx(Bee,{}),a.jsx(ki,{}),a.jsx(tte,{}),a.jsxs(bg,{children:[a.jsx(yg,{as:ot,variant:"link","aria-label":e("accessibility.menu"),icon:a.jsx(tee,{}),sx:{boxSize:8}}),a.jsxs(Ul,{motionProps:fu,children:[a.jsxs(Xd,{title:e("common.communityLabel"),children:[r&&a.jsx(Wn,{as:"a",href:o,target:"_blank",icon:a.jsx(KZ,{}),children:e("common.githubLabel")}),t&&a.jsx(Wn,{as:"a",href:`${o}/issues`,target:"_blank",icon:a.jsx(nee,{}),children:e("common.reportBugLabel")}),n&&a.jsx(Wn,{as:"a",href:s,target:"_blank",icon:a.jsx(qZ,{}),children:e("common.discordLabel")})]}),a.jsxs(Xd,{title:e("common.settingsLabel"),children:[a.jsx(Aee,{children:a.jsx(Wn,{as:"button",icon:a.jsx(vee,{}),children:e("common.hotkeysLabel")})}),a.jsx(Jee,{children:a.jsx(Wn,{as:"button",icon:a.jsx(HM,{}),children:e("common.settingsLabel")})})]})]})]})]})},rte=d.memo(nte);/*! * OverlayScrollbars * Version: 2.2.1 * * Copyright (c) Rene Haas | KingSora. * https://github.com/KingSora * * Released under the MIT license. */function Dn(e,t){if(Xg(e))for(let n=0;nt(e[n],n,e));return e}function bo(e,t){const n=dl(t);if(la(t)||n){let o=n?"":{};if(e){const s=window.getComputedStyle(e,null);o=n?_j(e,s,t):t.reduce((i,l)=>(i[l]=_j(e,s,l),i),o)}return o}e&&Dn(us(t),o=>bte(e,o,t[o]))}const Gs=(e,t)=>{const{o:n,u:r,_:o}=e;let s=n,i;const l=(m,h)=>{const g=s,x=m,y=h||(r?!r(g,x):g!==x);return(y||o)&&(s=x,i=g),[s,y,i]};return[t?m=>l(t(s,i),m):l,m=>[s,!!m,i]]},Ff=()=>typeof window<"u",oO=Ff()&&Node.ELEMENT_NODE,{toString:ote,hasOwnProperty:a1}=Object.prototype,_i=e=>e===void 0,Qg=e=>e===null,ste=e=>_i(e)||Qg(e)?`${e}`:ote.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase(),Yi=e=>typeof e=="number",dl=e=>typeof e=="string",Uy=e=>typeof e=="boolean",ia=e=>typeof e=="function",la=e=>Array.isArray(e),ef=e=>typeof e=="object"&&!la(e)&&!Qg(e),Xg=e=>{const t=!!e&&e.length,n=Yi(t)&&t>-1&&t%1==0;return la(e)||!ia(e)&&n?t>0&&ef(e)?t-1 in e:!0:!1},Nx=e=>{if(!e||!ef(e)||ste(e)!=="object")return!1;let t;const n="constructor",r=e[n],o=r&&r.prototype,s=a1.call(e,n),i=o&&a1.call(o,"isPrototypeOf");if(r&&!s&&!i)return!1;for(t in e);return _i(t)||a1.call(e,t)},zh=e=>{const t=HTMLElement;return e?t?e instanceof t:e.nodeType===oO:!1},Yg=e=>{const t=Element;return e?t?e instanceof t:e.nodeType===oO:!1},Gy=(e,t,n)=>e.indexOf(t,n),Un=(e,t,n)=>(!n&&!dl(t)&&Xg(t)?Array.prototype.push.apply(e,t):e.push(t),e),Yl=e=>{const t=Array.from,n=[];return t&&e?t(e):(e instanceof Set?e.forEach(r=>{Un(n,r)}):Dn(e,r=>{Un(n,r)}),n)},qy=e=>!!e&&e.length===0,Wa=(e,t,n)=>{Dn(e,o=>o&&o.apply(void 0,t||[])),!n&&(e.length=0)},Jg=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),us=e=>e?Object.keys(e):[],Sr=(e,t,n,r,o,s,i)=>{const l=[t,n,r,o,s,i];return(typeof e!="object"||Qg(e))&&!ia(e)&&(e={}),Dn(l,u=>{Dn(us(u),p=>{const m=u[p];if(e===m)return!0;const h=la(m);if(m&&(Nx(m)||h)){const g=e[p];let x=g;h&&!la(g)?x=[]:!h&&!Nx(g)&&(x={}),e[p]=Sr(x,m)}else e[p]=m})}),e},Ky=e=>{for(const t in e)return!1;return!0},sO=(e,t,n,r)=>{if(_i(r))return n?n[e]:t;n&&(dl(r)||Yi(r))&&(n[e]=r)},vo=(e,t,n)=>{if(_i(n))return e?e.getAttribute(t):null;e&&e.setAttribute(t,n)},zo=(e,t)=>{e&&e.removeAttribute(t)},$l=(e,t,n,r)=>{if(n){const o=vo(e,t)||"",s=new Set(o.split(" "));s[r?"add":"delete"](n);const i=Yl(s).join(" ").trim();vo(e,t,i)}},ate=(e,t,n)=>{const r=vo(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),$x=Ff()&&Element.prototype,aO=(e,t)=>{const n=[],r=t?Yg(t)?t:null:document;return r?Un(n,r.querySelectorAll(e)):n},ite=(e,t)=>{const n=t?Yg(t)?t:null:document;return n?n.querySelector(e):null},Fh=(e,t)=>Yg(e)?($x.matches||$x.msMatchesSelector).call(e,t):!1,Qy=e=>e?Yl(e.childNodes):[],mi=e=>e?e.parentElement:null,qc=(e,t)=>{if(Yg(e)){const n=$x.closest;if(n)return n.call(e,t);do{if(Fh(e,t))return e;e=mi(e)}while(e)}return null},lte=(e,t,n)=>{const r=e&&qc(e,t),o=e&&ite(n,r),s=qc(o,t)===r;return r&&o?r===e||o===e||s&&qc(qc(e,n),t)!==r:!1},Xy=(e,t,n)=>{if(n&&e){let r=t,o;Xg(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)=>{Xy(e,null,t)},cte=(e,t)=>{Xy(mi(e),e,t)},Sj=(e,t)=>{Xy(mi(e),e&&e.nextSibling,t)},Aa=e=>{if(Xg(e))Dn(Yl(e),t=>Aa(t));else if(e){const t=mi(e);t&&t.removeChild(e)}},Ll=e=>{const t=document.createElement("div");return e&&vo(t,"class",e),t},iO=e=>{const t=Ll();return t.innerHTML=e.trim(),Dn(Qy(t),n=>Aa(n))},Lx=e=>e.charAt(0).toUpperCase()+e.slice(1),ute=()=>Ll().style,dte=["-webkit-","-moz-","-o-","-ms-"],fte=["WebKit","Moz","O","MS","webkit","moz","o","ms"],i1={},l1={},pte=e=>{let t=l1[e];if(Jg(l1,e))return t;const n=Lx(e),r=ute();return Dn(dte,o=>{const s=o.replace(/-/g,"");return!(t=[e,o+e,s+n,Lx(s)+n].find(l=>r[l]!==void 0))}),l1[e]=t||""},Bf=e=>{if(Ff()){let t=i1[e]||window[e];return Jg(i1,e)||(Dn(fte,n=>(t=t||window[n+Lx(e)],!t)),i1[e]=t),t}},mte=Bf("MutationObserver"),kj=Bf("IntersectionObserver"),Kc=Bf("ResizeObserver"),lO=Bf("cancelAnimationFrame"),cO=Bf("requestAnimationFrame"),Bh=Ff()&&window.setTimeout,zx=Ff()&&window.clearTimeout,hte=/[^\x20\t\r\n\f]+/g,uO=(e,t,n)=>{const r=e&&e.classList;let o,s=0,i=!1;if(r&&t&&dl(t)){const l=t.match(hte)||[];for(i=l.length>0;o=l[s++];)i=!!n(r,o)&&i}return i},Yy=(e,t)=>{uO(e,t,(n,r)=>n.remove(r))},ci=(e,t)=>(uO(e,t,(n,r)=>n.add(r)),Yy.bind(0,e,t)),Zg=(e,t,n,r)=>{if(e&&t){let o=!0;return Dn(n,s=>{const i=r?r(e[s]):e[s],l=r?r(t[s]):t[s];i!==l&&(o=!1)}),o}return!1},dO=(e,t)=>Zg(e,t,["w","h"]),fO=(e,t)=>Zg(e,t,["x","y"]),gte=(e,t)=>Zg(e,t,["t","r","b","l"]),jj=(e,t,n)=>Zg(e,t,["width","height"],n&&(r=>Math.round(r))),ys=()=>{},Bc=e=>{let t;const n=e?Bh:cO,r=e?zx:lO;return[o=>{r(t),t=n(o,ia(e)?e():e)},()=>r(t)]},Jy=(e,t)=>{let n,r,o,s=ys;const{v:i,g:l,p:u}=t||{},p=function(y){s(),zx(n),n=r=void 0,s=ys,e.apply(this,y)},m=x=>u&&r?u(r,x):x,h=()=>{s!==ys&&p(m(o)||o)},g=function(){const y=Yl(arguments),b=ia(i)?i():i;if(Yi(b)&&b>=0){const S=ia(l)?l():l,j=Yi(S)&&S>=0,_=b>0?Bh:cO,P=b>0?zx:lO,M=m(y)||y,O=p.bind(0,M);s();const A=_(O,b);s=()=>P(A),j&&!n&&(n=Bh(h,S)),r=o=M}else p(y)};return g.m=h,g},vte={opacity:1,zindex:1},rm=(e,t)=>{const n=t?parseFloat(e):parseInt(e,10);return n===n?n:0},xte=(e,t)=>!vte[e.toLowerCase()]&&Yi(t)?`${t}px`:t,_j=(e,t,n)=>t!=null?t[n]||t.getPropertyValue(n):e.style[n],bte=(e,t,n)=>{try{const{style:r}=e;_i(r[t])?r.setProperty(t,n):r[t]=xte(t,n)}catch{}},tf=e=>bo(e,"direction")==="rtl",Ij=(e,t,n)=>{const r=t?`${t}-`:"",o=n?`-${n}`:"",s=`${r}top${o}`,i=`${r}right${o}`,l=`${r}bottom${o}`,u=`${r}left${o}`,p=bo(e,[s,i,l,u]);return{t:rm(p[s],!0),r:rm(p[i],!0),b:rm(p[l],!0),l:rm(p[u],!0)}},{round:Pj}=Math,Zy={w:0,h:0},nf=e=>e?{w:e.offsetWidth,h:e.offsetHeight}:Zy,Pm=e=>e?{w:e.clientWidth,h:e.clientHeight}:Zy,Hh=e=>e?{w:e.scrollWidth,h:e.scrollHeight}:Zy,Wh=e=>{const t=parseFloat(bo(e,"height"))||0,n=parseFloat(bo(e,"width"))||0;return{w:n-Pj(n),h:t-Pj(t)}},_a=e=>e.getBoundingClientRect();let om;const yte=()=>{if(_i(om)){om=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get(){om=!0}}))}catch{}}return om},pO=e=>e.split(" "),Cte=(e,t,n,r)=>{Dn(pO(t),o=>{e.removeEventListener(o,n,r)})},Ur=(e,t,n,r)=>{var o;const s=yte(),i=(o=s&&r&&r.S)!=null?o:s,l=r&&r.$||!1,u=r&&r.C||!1,p=[],m=s?{passive:i,capture:l}:l;return Dn(pO(t),h=>{const g=u?x=>{e.removeEventListener(h,g,l),n&&n(x)}:n;Un(p,Cte.bind(null,e,h,g,l)),e.addEventListener(h,g,m)}),Wa.bind(0,p)},mO=e=>e.stopPropagation(),hO=e=>e.preventDefault(),wte={x:0,y:0},c1=e=>{const t=e?_a(e):0;return t?{x:t.left+window.pageYOffset,y:t.top+window.pageXOffset}:wte},Ej=(e,t)=>{Dn(la(t)?t:[t],e)},e2=e=>{const t=new Map,n=(s,i)=>{if(s){const l=t.get(s);Ej(u=>{l&&l[u?"delete":"clear"](u)},i)}else t.forEach(l=>{l.clear()}),t.clear()},r=(s,i)=>{if(dl(s)){const p=t.get(s)||new Set;return t.set(s,p),Ej(m=>{ia(m)&&p.add(m)},i),n.bind(0,s,i)}Uy(i)&&i&&n();const l=us(s),u=[];return Dn(l,p=>{const m=s[p];m&&Un(u,r(p,m))}),Wa.bind(0,u)},o=(s,i)=>{const l=t.get(s);Dn(Yl(l),u=>{i&&!qy(i)?u.apply(0,i):u()})};return r(e||{}),[r,n,o]},Mj=e=>JSON.stringify(e,(t,n)=>{if(ia(n))throw new Error;return n}),Ste={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(ef(s)&&ef(i))Sr(n[o]={},gO(s,i)),Ky(n[o])&&delete n[o];else if(Jg(t,o)&&i!==s){let l=!0;if(la(s)||la(i))try{Mj(s)===Mj(i)&&(l=!1)}catch{}l&&(n[o]=i)}}),n},vO="os-environment",xO=`${vO}-flexbox-glue`,kte=`${xO}-max`,bO="os-scrollbar-hidden",u1="data-overlayscrollbars-initialize",qs="data-overlayscrollbars",yO=`${qs}-overflow-x`,CO=`${qs}-overflow-y`,lu="overflowVisible",jte="scrollbarHidden",Oj="scrollbarPressed",Vh="updating",Bi="data-overlayscrollbars-viewport",d1="arrange",wO="scrollbarHidden",cu=lu,Fx="data-overlayscrollbars-padding",_te=cu,Rj="data-overlayscrollbars-content",t2="os-size-observer",Ite=`${t2}-appear`,Pte=`${t2}-listener`,Ete="os-trinsic-observer",Mte="os-no-css-vars",Ote="os-theme-none",Ko="os-scrollbar",Rte=`${Ko}-rtl`,Ate=`${Ko}-horizontal`,Dte=`${Ko}-vertical`,SO=`${Ko}-track`,n2=`${Ko}-handle`,Tte=`${Ko}-visible`,Nte=`${Ko}-cornerless`,Aj=`${Ko}-transitionless`,Dj=`${Ko}-interaction`,Tj=`${Ko}-unusable`,Nj=`${Ko}-auto-hidden`,$j=`${Ko}-wheel`,$te=`${SO}-interactive`,Lte=`${n2}-interactive`,kO={},Jl=()=>kO,zte=e=>{const t=[];return Dn(la(e)?e:[e],n=>{const r=us(n);Dn(r,o=>{Un(t,kO[o]=n[o])})}),t},Fte="__osOptionsValidationPlugin",Bte="__osSizeObserverPlugin",r2="__osScrollbarsHidingPlugin",Hte="__osClickScrollPlugin";let f1;const Lj=(e,t,n,r)=>{Ss(e,t);const o=Pm(t),s=nf(t),i=Wh(n);return r&&Aa(t),{x:s.h-o.h+i.h,y:s.w-o.w+i.w}},Wte=e=>{let t=!1;const n=ci(e,bO);try{t=bo(e,pte("scrollbar-width"))==="none"||window.getComputedStyle(e,"::-webkit-scrollbar").getPropertyValue("display")==="none"}catch{}return n(),t},Vte=(e,t)=>{const n="hidden";bo(e,{overflowX:n,overflowY:n,direction:"rtl"}),ea(e,0);const r=c1(e),o=c1(t);ea(e,-999);const s=c1(t);return{i:r.x===o.x,n:o.x!==s.x}},Ute=(e,t)=>{const n=ci(e,xO),r=_a(e),o=_a(t),s=jj(o,r,!0),i=ci(e,kte),l=_a(e),u=_a(t),p=jj(u,l,!0);return n(),i(),s&&p},Gte=()=>{const{body:e}=document,n=iO(`
`)[0],r=n.firstChild,[o,,s]=e2(),[i,l]=Gs({o:Lj(e,n,r),u:fO},Lj.bind(0,e,n,r,!0)),[u]=l(),p=Wte(n),m={x:u.x===0,y:u.y===0},h={elements:{host:null,padding:!p,viewport:j=>p&&j===j.ownerDocument.body&&j,content:!1},scrollbars:{slot:!0},cancel:{nativeScrollbarsOverlaid:!1,body:null}},g=Sr({},Ste),x=Sr.bind(0,{},g),y=Sr.bind(0,{},h),b={k:u,A:m,I:p,L:bo(n,"zIndex")==="-1",B:Vte(n,r),V:Ute(n,r),Y:o.bind(0,"z"),j:o.bind(0,"r"),N:y,q:j=>Sr(h,j)&&y(),F:x,G:j=>Sr(g,j)&&x(),X:Sr({},h),U:Sr({},g)},C=window.addEventListener,S=Jy(j=>s(j?"z":"r"),{v:33,g:99});if(zo(n,"style"),Aa(n),C("resize",S.bind(0,!1)),!p&&(!m.x||!m.y)){let j;C("resize",()=>{const _=Jl()[r2];j=j||_&&_.R(),j&&j(b,i,S.bind(0,!0))})}return b},Qo=()=>(f1||(f1=Gte()),f1),o2=(e,t)=>ia(t)?t.apply(0,e):t,qte=(e,t,n,r)=>{const o=_i(r)?n:r;return o2(e,o)||t.apply(0,e)},jO=(e,t,n,r)=>{const o=_i(r)?n:r,s=o2(e,o);return!!s&&(zh(s)?s:t.apply(0,e))},Kte=(e,t,n)=>{const{nativeScrollbarsOverlaid:r,body:o}=n||{},{A:s,I:i}=Qo(),{nativeScrollbarsOverlaid:l,body:u}=t,p=r??l,m=_i(o)?u:o,h=(s.x||s.y)&&p,g=e&&(Qg(m)?!i:m);return!!h||!!g},s2=new WeakMap,Qte=(e,t)=>{s2.set(e,t)},Xte=e=>{s2.delete(e)},_O=e=>s2.get(e),zj=(e,t)=>e?t.split(".").reduce((n,r)=>n&&Jg(n,r)?n[r]:void 0,e):void 0,Bx=(e,t,n)=>r=>[zj(e,r),n||zj(t,r)!==void 0],IO=e=>{let t=e;return[()=>t,n=>{t=Sr({},t,n)}]},sm="tabindex",am=Ll.bind(0,""),p1=e=>{Ss(mi(e),Qy(e)),Aa(e)},Yte=e=>{const t=Qo(),{N:n,I:r}=t,o=Jl()[r2],s=o&&o.T,{elements:i}=n(),{host:l,padding:u,viewport:p,content:m}=i,h=zh(e),g=h?{}:e,{elements:x}=g,{host:y,padding:b,viewport:C,content:S}=x||{},j=h?e:g.target,_=Fh(j,"textarea"),P=j.ownerDocument,I=P.documentElement,M=j===P.body,O=P.defaultView,A=qte.bind(0,[j]),D=jO.bind(0,[j]),R=o2.bind(0,[j]),N=A.bind(0,am,p),Y=D.bind(0,am,m),F=N(C),V=F===j,Q=V&&M,q=!V&&Y(S),z=!V&&zh(F)&&F===q,G=z&&!!R(m),T=G?N():F,B=G?q:Y(),re=Q?I:z?T:F,le=_?A(am,l,y):j,se=Q?re:le,K=z?B:q,U=P.activeElement,ee=!V&&O.top===O&&U===j,de={W:j,Z:se,J:re,K:!V&&D(am,u,b),tt:K,nt:!V&&!r&&s&&s(t),ot:Q?I:re,st:Q?P:re,et:O,ct:P,rt:_,it:M,lt:h,ut:V,dt:z,ft:(mt,ct)=>ate(re,V?qs:Bi,V?ct:mt),_t:(mt,ct,be)=>$l(re,V?qs:Bi,V?ct:mt,be)},Z=us(de).reduce((mt,ct)=>{const be=de[ct];return Un(mt,be&&!mi(be)?be:!1)},[]),ue=mt=>mt?Gy(Z,mt)>-1:null,{W:fe,Z:ge,K:_e,J:ye,tt:pe,nt:Te}=de,Ae=[()=>{zo(ge,qs),zo(ge,u1),zo(fe,u1),M&&(zo(I,qs),zo(I,u1))}],qe=_&&ue(ge);let Pt=_?fe:Qy([pe,ye,_e,ge,fe].find(mt=>ue(mt)===!1));const tt=Q?fe:pe||ye;return[de,()=>{vo(ge,qs,V?"viewport":"host"),vo(_e,Fx,""),vo(pe,Rj,""),V||vo(ye,Bi,"");const mt=M&&!V?ci(mi(j),bO):ys;if(qe&&(Sj(fe,ge),Un(Ae,()=>{Sj(ge,fe),Aa(ge)})),Ss(tt,Pt),Ss(ge,_e),Ss(_e||ge,!V&&ye),Ss(ye,pe),Un(Ae,()=>{mt(),zo(_e,Fx),zo(pe,Rj),zo(ye,yO),zo(ye,CO),zo(ye,Bi),ue(pe)&&p1(pe),ue(ye)&&p1(ye),ue(_e)&&p1(_e)}),r&&!V&&($l(ye,Bi,wO,!0),Un(Ae,zo.bind(0,ye,Bi))),Te&&(cte(ye,Te),Un(Ae,Aa.bind(0,Te))),ee){const ct=vo(ye,sm);vo(ye,sm,"-1"),ye.focus();const be=()=>ct?vo(ye,sm,ct):zo(ye,sm),We=Ur(P,"pointerdown keydown",()=>{be(),We()});Un(Ae,[be,We])}else U&&U.focus&&U.focus();Pt=0},Wa.bind(0,Ae)]},Jte=(e,t)=>{const{tt:n}=e,[r]=t;return o=>{const{V:s}=Qo(),{ht:i}=r(),{vt:l}=o,u=(n||!s)&&l;return u&&bo(n,{height:i?"":"100%"}),{gt:u,wt:u}}},Zte=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,ut:l}=e,[u,p]=Gs({u:gte,o:Ij()},Ij.bind(0,o,"padding",""));return(m,h,g)=>{let[x,y]=p(g);const{I:b,V:C}=Qo(),{bt:S}=n(),{gt:j,wt:_,yt:P}=m,[I,M]=h("paddingAbsolute");(j||y||!C&&_)&&([x,y]=u(g));const A=!l&&(M||P||y);if(A){const D=!I||!s&&!b,R=x.r+x.l,N=x.t+x.b,Y={marginRight:D&&!S?-R:0,marginBottom:D?-N:0,marginLeft:D&&S?-R:0,top:D?-x.t:0,right:D?S?-x.r:"auto":0,left:D?S?"auto":-x.l:0,width:D?`calc(100% + ${R}px)`:""},F={paddingTop:D?x.t:0,paddingRight:D?x.r:0,paddingBottom:D?x.b:0,paddingLeft:D?x.l:0};bo(s||i,Y),bo(i,F),r({K:x,St:!D,P:s?F:Sr({},Y,F)})}return{xt:A}}},{max:Hx}=Math,Hi=Hx.bind(0,0),PO="visible",Fj="hidden",ene=42,im={u:dO,o:{w:0,h:0}},tne={u:fO,o:{x:Fj,y:Fj}},nne=(e,t)=>{const n=window.devicePixelRatio%1!==0?1:0,r={w:Hi(e.w-t.w),h:Hi(e.h-t.h)};return{w:r.w>n?r.w:0,h:r.h>n?r.h:0}},lm=e=>e.indexOf(PO)===0,rne=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,nt:l,ut:u,_t:p,it:m,et:h}=e,{k:g,V:x,I:y,A:b}=Qo(),C=Jl()[r2],S=!u&&!y&&(b.x||b.y),j=m&&u,[_,P]=Gs(im,Wh.bind(0,i)),[I,M]=Gs(im,Hh.bind(0,i)),[O,A]=Gs(im),[D,R]=Gs(im),[N]=Gs(tne),Y=(G,T)=>{if(bo(i,{height:""}),T){const{St:B,K:X}=n(),{$t:re,D:le}=G,se=Wh(o),K=Pm(o),U=bo(i,"boxSizing")==="content-box",ee=B||U?X.b+X.t:0,de=!(b.x&&U);bo(i,{height:K.h+se.h+(re.x&&de?le.x:0)-ee})}},F=(G,T)=>{const B=!y&&!G?ene:0,X=(ue,fe,ge)=>{const _e=bo(i,ue),pe=(T?T[ue]:_e)==="scroll";return[_e,pe,pe&&!y?fe?B:ge:0,fe&&!!B]},[re,le,se,K]=X("overflowX",b.x,g.x),[U,ee,de,Z]=X("overflowY",b.y,g.y);return{Ct:{x:re,y:U},$t:{x:le,y:ee},D:{x:se,y:de},M:{x:K,y:Z}}},V=(G,T,B,X)=>{const re=(ee,de)=>{const Z=lm(ee),ue=de&&Z&&ee.replace(`${PO}-`,"")||"";return[de&&!Z?ee:"",lm(ue)?"hidden":ue]},[le,se]=re(B.x,T.x),[K,U]=re(B.y,T.y);return X.overflowX=se&&K?se:le,X.overflowY=U&&le?U:K,F(G,X)},Q=(G,T,B,X)=>{const{D:re,M:le}=G,{x:se,y:K}=le,{x:U,y:ee}=re,{P:de}=n(),Z=T?"marginLeft":"marginRight",ue=T?"paddingLeft":"paddingRight",fe=de[Z],ge=de.marginBottom,_e=de[ue],ye=de.paddingBottom;X.width=`calc(100% + ${ee+-1*fe}px)`,X[Z]=-ee+fe,X.marginBottom=-U+ge,B&&(X[ue]=_e+(K?ee:0),X.paddingBottom=ye+(se?U:0))},[q,z]=C?C.H(S,x,i,l,n,F,Q):[()=>S,()=>[ys]];return(G,T,B)=>{const{gt:X,Ot:re,wt:le,xt:se,vt:K,yt:U}=G,{ht:ee,bt:de}=n(),[Z,ue]=T("showNativeOverlaidScrollbars"),[fe,ge]=T("overflow"),_e=Z&&b.x&&b.y,ye=!u&&!x&&(X||le||re||ue||K),pe=lm(fe.x),Te=lm(fe.y),Ae=pe||Te;let qe=P(B),Pt=M(B),tt=A(B),sn=R(B),mt;if(ue&&y&&p(wO,jte,!_e),ye&&(mt=F(_e),Y(mt,ee)),X||se||le||U||ue){Ae&&p(cu,lu,!1);const[Me,Ze]=z(_e,de,mt),[Ye,dt]=qe=_(B),[Vt,xr]=Pt=I(B),yn=Pm(i);let mn=Vt,oo=yn;Me(),(xr||dt||ue)&&Ze&&!_e&&q(Ze,Vt,Ye,de)&&(oo=Pm(i),mn=Hh(i));const Ar={w:Hi(Hx(Vt.w,mn.w)+Ye.w),h:Hi(Hx(Vt.h,mn.h)+Ye.h)},nr={w:Hi((j?h.innerWidth:oo.w+Hi(yn.w-Vt.w))+Ye.w),h:Hi((j?h.innerHeight+Ye.h:oo.h+Hi(yn.h-Vt.h))+Ye.h)};sn=D(nr),tt=O(nne(Ar,nr),B)}const[ct,be]=sn,[We,Rt]=tt,[Ut,ke]=Pt,[Ct,Ft]=qe,Wt={x:We.w>0,y:We.h>0},Le=pe&&Te&&(Wt.x||Wt.y)||pe&&Wt.x&&!Wt.y||Te&&Wt.y&&!Wt.x;if(se||U||Ft||ke||be||Rt||ge||ue||ye){const Me={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},Ze=V(_e,Wt,fe,Me),Ye=q(Ze,Ut,Ct,de);u||Q(Ze,de,Ye,Me),ye&&Y(Ze,ee),u?(vo(o,yO,Me.overflowX),vo(o,CO,Me.overflowY)):bo(i,Me)}$l(o,qs,lu,Le),$l(s,Fx,_te,Le),u||$l(i,Bi,cu,Ae);const[Xe,_n]=N(F(_e).Ct);return r({Ct:Xe,zt:{x:ct.w,y:ct.h},Tt:{x:We.w,y:We.h},Et:Wt}),{It:_n,At:be,Lt:Rt}}},Bj=(e,t,n)=>{const r={},o=t||{},s=us(e).concat(us(o));return Dn(s,i=>{const l=e[i],u=o[i];r[i]=!!(n||l||u)}),r},one=(e,t)=>{const{W:n,J:r,_t:o,ut:s}=e,{I:i,A:l,V:u}=Qo(),p=!i&&(l.x||l.y),m=[Jte(e,t),Zte(e,t),rne(e,t)];return(h,g,x)=>{const y=Bj(Sr({gt:!1,xt:!1,yt:!1,vt:!1,At:!1,Lt:!1,It:!1,Ot:!1,wt:!1},g),{},x),b=p||!u,C=b&&ea(r),S=b&&li(r);o("",Vh,!0);let j=y;return Dn(m,_=>{j=Bj(j,_(j,h,!!x)||{},x)}),ea(r,C),li(r,S),o("",Vh),s||(ea(n,0),li(n,0)),j}},sne=(e,t,n)=>{let r,o=!1;const s=()=>{o=!0},i=l=>{if(n){const u=n.reduce((p,m)=>{if(m){const[h,g]=m,x=g&&h&&(l?l(h):aO(h,e));x&&x.length&&g&&dl(g)&&Un(p,[x,g.trim()],!0)}return p},[]);Dn(u,p=>Dn(p[0],m=>{const h=p[1],g=r.get(m)||[];if(e.contains(m)){const y=Ur(m,h,b=>{o?(y(),r.delete(m)):t(b)});r.set(m,Un(g,y))}else Wa(g),r.delete(m)}))}};return n&&(r=new WeakMap,i()),[s,i]},Hj=(e,t,n,r)=>{let o=!1;const{Ht:s,Pt:i,Dt:l,Mt:u,Rt:p,kt:m}=r||{},h=Jy(()=>{o&&n(!0)},{v:33,g:99}),[g,x]=sne(e,h,l),y=s||[],b=i||[],C=y.concat(b),S=(_,P)=>{const I=p||ys,M=m||ys,O=new Set,A=new Set;let D=!1,R=!1;if(Dn(_,N=>{const{attributeName:Y,target:F,type:V,oldValue:Q,addedNodes:q,removedNodes:z}=N,G=V==="attributes",T=V==="childList",B=e===F,X=G&&dl(Y)?vo(F,Y):0,re=X!==0&&Q!==X,le=Gy(b,Y)>-1&&re;if(t&&(T||!B)){const se=!G,K=G&&re,U=K&&u&&Fh(F,u),de=(U?!I(F,Y,Q,X):se||K)&&!M(N,!!U,e,r);Dn(q,Z=>O.add(Z)),Dn(z,Z=>O.add(Z)),R=R||de}!t&&B&&re&&!I(F,Y,Q,X)&&(A.add(Y),D=D||le)}),O.size>0&&x(N=>Yl(O).reduce((Y,F)=>(Un(Y,aO(N,F)),Fh(F,N)?Un(Y,F):Y),[])),t)return!P&&R&&n(!1),[!1];if(A.size>0||D){const N=[Yl(A),D];return!P&&n.apply(0,N),N}},j=new mte(_=>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){h.m();const _=j.takeRecords();return!qy(_)&&S(_,!0)}}]},cm=3333333,um=e=>e&&(e.height||e.width),EO=(e,t,n)=>{const{Bt:r=!1,Vt:o=!1}=n||{},s=Jl()[Bte],{B:i}=Qo(),u=iO(`
`)[0],p=u.firstChild,m=tf.bind(0,e),[h]=Gs({o:void 0,_:!0,u:(b,C)=>!(!b||!um(b)&&um(C))}),g=b=>{const C=la(b)&&b.length>0&&ef(b[0]),S=!C&&Uy(b[0]);let j=!1,_=!1,P=!0;if(C){const[I,,M]=h(b.pop().contentRect),O=um(I),A=um(M);j=!M||!O,_=!A&&O,P=!j}else S?[,P]=b:_=b===!0;if(r&&P){const I=S?b[0]:tf(u);ea(u,I?i.n?-cm:i.i?0:cm:cm),li(u,cm)}j||t({gt:!S,Yt:S?b:void 0,Vt:!!_})},x=[];let y=o?g:!1;return[()=>{Wa(x),Aa(u)},()=>{if(Kc){const b=new Kc(g);b.observe(p),Un(x,()=>{b.disconnect()})}else if(s){const[b,C]=s.O(p,g,o);y=b,Un(x,C)}if(r){const[b]=Gs({o:void 0},m);Un(x,Ur(u,"scroll",C=>{const S=b(),[j,_,P]=S;_&&(Yy(p,"ltr rtl"),j?ci(p,"rtl"):ci(p,"ltr"),g([!!j,_,P])),mO(C)}))}y&&(ci(u,Ite),Un(x,Ur(u,"animationstart",y,{C:!!Kc}))),(Kc||s)&&Ss(e,u)}]},ane=e=>e.h===0||e.isIntersecting||e.intersectionRatio>0,ine=(e,t)=>{let n;const r=Ll(Ete),o=[],[s]=Gs({o:!1}),i=(u,p)=>{if(u){const m=s(ane(u)),[,h]=m;if(h)return!p&&t(m),[m]}},l=(u,p)=>{if(u&&u.length>0)return i(u.pop(),p)};return[()=>{Wa(o),Aa(r)},()=>{if(kj)n=new kj(u=>l(u),{root:e}),n.observe(r),Un(o,()=>{n.disconnect()});else{const u=()=>{const h=nf(r);i(h)},[p,m]=EO(r,u);Un(o,p),m(),u()}Ss(e,r)},()=>{if(n)return l(n.takeRecords(),!0)}]},Wj=`[${qs}]`,lne=`[${Bi}]`,m1=["tabindex"],Vj=["wrap","cols","rows"],h1=["id","class","style","open"],cne=(e,t,n)=>{let r,o,s;const{Z:i,J:l,tt:u,rt:p,ut:m,ft:h,_t:g}=e,{V:x}=Qo(),[y]=Gs({u:dO,o:{w:0,h:0}},()=>{const V=h(cu,lu),Q=h(d1,""),q=Q&&ea(l),z=Q&&li(l);g(cu,lu),g(d1,""),g("",Vh,!0);const G=Hh(u),T=Hh(l),B=Wh(l);return g(cu,lu,V),g(d1,"",Q),g("",Vh),ea(l,q),li(l,z),{w:T.w+G.w+B.w,h:T.h+G.h+B.h}}),b=p?Vj:h1.concat(Vj),C=Jy(n,{v:()=>r,g:()=>o,p(V,Q){const[q]=V,[z]=Q;return[us(q).concat(us(z)).reduce((G,T)=>(G[T]=q[T]||z[T],G),{})]}}),S=V=>{Dn(V||m1,Q=>{if(Gy(m1,Q)>-1){const q=vo(i,Q);dl(q)?vo(l,Q,q):zo(l,Q)}})},j=(V,Q)=>{const[q,z]=V,G={vt:z};return t({ht:q}),!Q&&n(G),G},_=({gt:V,Yt:Q,Vt:q})=>{const z=!V||q?n:C;let G=!1;if(Q){const[T,B]=Q;G=B,t({bt:T})}z({gt:V,yt:G})},P=(V,Q)=>{const[,q]=y(),z={wt:q};return q&&!Q&&(V?n:C)(z),z},I=(V,Q,q)=>{const z={Ot:Q};return Q?!q&&C(z):m||S(V),z},[M,O,A]=u||!x?ine(i,j):[ys,ys,ys],[D,R]=m?[ys,ys]:EO(i,_,{Vt:!0,Bt:!0}),[N,Y]=Hj(i,!1,I,{Pt:h1,Ht:h1.concat(m1)}),F=m&&Kc&&new Kc(_.bind(0,{gt:!0}));return F&&F.observe(i),S(),[()=>{M(),D(),s&&s[0](),F&&F.disconnect(),N()},()=>{R(),O()},()=>{const V={},Q=Y(),q=A(),z=s&&s[1]();return Q&&Sr(V,I.apply(0,Un(Q,!0))),q&&Sr(V,j.apply(0,Un(q,!0))),z&&Sr(V,P.apply(0,Un(z,!0))),V},V=>{const[Q]=V("update.ignoreMutation"),[q,z]=V("update.attributes"),[G,T]=V("update.elementEvents"),[B,X]=V("update.debounce"),re=T||z,le=se=>ia(Q)&&Q(se);if(re&&(s&&(s[1](),s[0]()),s=Hj(u||l,!0,P,{Ht:b.concat(q||[]),Dt:G,Mt:Wj,kt:(se,K)=>{const{target:U,attributeName:ee}=se;return(!K&&ee&&!m?lte(U,Wj,lne):!1)||!!qc(U,`.${Ko}`)||!!le(se)}})),X)if(C.m(),la(B)){const se=B[0],K=B[1];r=Yi(se)&&se,o=Yi(K)&&K}else Yi(B)?(r=B,o=!1):(r=!1,o=!1)}]},Uj={x:0,y:0},une=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:Uj,Tt:Uj,Ct:{x:"hidden",y:"hidden"},Et:{x:!1,y:!1},ht:!1,bt:tf(e.Z)}),dne=(e,t)=>{const n=Bx(t,{}),[r,o,s]=e2(),[i,l,u]=Yte(e),p=IO(une(i)),[m,h]=p,g=one(i,p),x=(_,P,I)=>{const O=us(_).some(A=>_[A])||!Ky(P)||I;return O&&s("u",[_,P,I]),O},[y,b,C,S]=cne(i,h,_=>x(g(n,_),{},!1)),j=m.bind(0);return j.jt=_=>r("u",_),j.Nt=()=>{const{W:_,J:P}=i,I=ea(_),M=li(_);b(),l(),ea(P,I),li(P,M)},j.qt=i,[(_,P)=>{const I=Bx(t,_,P);return S(I),x(g(I,C(),P),_,!!P)},j,()=>{o(),y(),u()}]},{round:Gj}=Math,fne=e=>{const{width:t,height:n}=_a(e),{w:r,h:o}=nf(e);return{x:Gj(t)/r||1,y:Gj(n)/o||1}},pne=(e,t,n)=>{const r=t.scrollbars,{button:o,isPrimary:s,pointerType:i}=e,{pointers:l}=r;return o===0&&s&&r[n?"dragScroll":"clickScroll"]&&(l||[]).includes(i)},mne=(e,t)=>Ur(e,"mousedown",Ur.bind(0,t,"click",mO,{C:!0,$:!0}),{$:!0}),qj="pointerup pointerleave pointercancel lostpointercapture",hne=(e,t,n,r,o,s,i)=>{const{B:l}=Qo(),{Ft:u,Gt:p,Xt:m}=r,h=`scroll${i?"Left":"Top"}`,g=`client${i?"X":"Y"}`,x=i?"width":"height",y=i?"left":"top",b=i?"w":"h",C=i?"x":"y",S=(j,_)=>P=>{const{Tt:I}=s(),M=nf(p)[b]-nf(u)[b],A=_*P/M*I[C],R=tf(m)&&i?l.n||l.i?1:-1:1;o[h]=j+A*R};return Ur(p,"pointerdown",j=>{const _=qc(j.target,`.${n2}`)===u,P=_?u:p;if($l(t,qs,Oj,!0),pne(j,e,_)){const I=!_&&j.shiftKey,M=()=>_a(u),O=()=>_a(p),A=(T,B)=>(T||M())[y]-(B||O())[y],D=S(o[h]||0,1/fne(o)[C]),R=j[g],N=M(),Y=O(),F=N[x],V=A(N,Y)+F/2,Q=R-Y[y],q=_?0:Q-V,z=T=>{Wa(G),P.releasePointerCapture(T.pointerId)},G=[$l.bind(0,t,qs,Oj),Ur(n,qj,z),Ur(n,"selectstart",T=>hO(T),{S:!1}),Ur(p,qj,z),Ur(p,"pointermove",T=>{const B=T[g]-R;(_||I)&&D(q+B)})];if(I)D(q);else if(!_){const T=Jl()[Hte];T&&Un(G,T.O(D,A,q,F,Q))}P.setPointerCapture(j.pointerId)}})},gne=(e,t)=>(n,r,o,s,i,l)=>{const{Xt:u}=n,[p,m]=Bc(333),h=!!i.scrollBy;let g=!0;return Wa.bind(0,[Ur(u,"pointerenter",()=>{r(Dj,!0)}),Ur(u,"pointerleave pointercancel",()=>{r(Dj)}),Ur(u,"wheel",x=>{const{deltaX:y,deltaY:b,deltaMode:C}=x;h&&g&&C===0&&mi(u)===s&&i.scrollBy({left:y,top:b,behavior:"smooth"}),g=!1,r($j,!0),p(()=>{g=!0,r($j)}),hO(x)},{S:!1,$:!0}),mne(u,o),hne(e,s,o,n,i,t,l),m])},{min:Wx,max:Kj,abs:vne,round:xne}=Math,MO=(e,t,n,r)=>{if(r){const l=n?"x":"y",{Tt:u,zt:p}=r,m=p[l],h=u[l];return Kj(0,Wx(1,m/(m+h)))}const o=n?"width":"height",s=_a(e)[o],i=_a(t)[o];return Kj(0,Wx(1,s/i))},bne=(e,t,n,r,o,s)=>{const{B:i}=Qo(),l=s?"x":"y",u=s?"Left":"Top",{Tt:p}=r,m=xne(p[l]),h=vne(n[`scroll${u}`]),g=s&&o,x=i.i?h:m-h,b=Wx(1,(g?x:h)/m),C=MO(e,t,s);return 1/C*(1-C)*b},yne=(e,t,n)=>{const{N:r,L:o}=Qo(),{scrollbars:s}=r(),{slot:i}=s,{ct:l,W:u,Z:p,J:m,lt:h,ot:g,it:x,ut:y}=t,{scrollbars:b}=h?{}:e,{slot:C}=b||{},S=jO([u,p,m],()=>y&&x?u:p,i,C),j=(q,z,G)=>{const T=G?ci:Yy;Dn(q,B=>{T(B.Xt,z)})},_=(q,z)=>{Dn(q,G=>{const[T,B]=z(G);bo(T,B)})},P=(q,z,G)=>{_(q,T=>{const{Ft:B,Gt:X}=T;return[B,{[G?"width":"height"]:`${(100*MO(B,X,G,z)).toFixed(3)}%`}]})},I=(q,z,G)=>{const T=G?"X":"Y";_(q,B=>{const{Ft:X,Gt:re,Xt:le}=B,se=bne(X,re,g,z,tf(le),G);return[X,{transform:se===se?`translate${T}(${(100*se).toFixed(3)}%)`:""}]})},M=[],O=[],A=[],D=(q,z,G)=>{const T=Uy(G),B=T?G:!0,X=T?!G:!0;B&&j(O,q,z),X&&j(A,q,z)},R=q=>{P(O,q,!0),P(A,q)},N=q=>{I(O,q,!0),I(A,q)},Y=q=>{const z=q?Ate:Dte,G=q?O:A,T=qy(G)?Aj:"",B=Ll(`${Ko} ${z} ${T}`),X=Ll(SO),re=Ll(n2),le={Xt:B,Gt:X,Ft:re};return o||ci(B,Mte),Ss(B,X),Ss(X,re),Un(G,le),Un(M,[Aa.bind(0,B),n(le,D,l,p,g,q)]),le},F=Y.bind(0,!0),V=Y.bind(0,!1),Q=()=>{Ss(S,O[0].Xt),Ss(S,A[0].Xt),Bh(()=>{D(Aj)},300)};return F(),V(),[{Ut:R,Wt:N,Zt:D,Jt:{Kt:O,Qt:F,tn:_.bind(0,O)},nn:{Kt:A,Qt:V,tn:_.bind(0,A)}},Q,Wa.bind(0,M)]},Cne=(e,t,n,r)=>{let o,s,i,l,u,p=0;const m=IO({}),[h]=m,[g,x]=Bc(),[y,b]=Bc(),[C,S]=Bc(100),[j,_]=Bc(100),[P,I]=Bc(()=>p),[M,O,A]=yne(e,n.qt,gne(t,n)),{Z:D,J:R,ot:N,st:Y,ut:F,it:V}=n.qt,{Jt:Q,nn:q,Zt:z,Ut:G,Wt:T}=M,{tn:B}=Q,{tn:X}=q,re=ee=>{const{Xt:de}=ee,Z=F&&!V&&mi(de)===R&&de;return[Z,{transform:Z?`translate(${ea(N)}px, ${li(N)}px)`:""}]},le=(ee,de)=>{if(I(),ee)z(Nj);else{const Z=()=>z(Nj,!0);p>0&&!de?P(Z):Z()}},se=()=>{l=s,l&&le(!0)},K=[S,I,_,b,x,A,Ur(D,"pointerover",se,{C:!0}),Ur(D,"pointerenter",se),Ur(D,"pointerleave",()=>{l=!1,s&&le(!1)}),Ur(D,"pointermove",()=>{o&&g(()=>{S(),le(!0),j(()=>{o&&le(!1)})})}),Ur(Y,"scroll",ee=>{y(()=>{T(n()),i&&le(!0),C(()=>{i&&!l&&le(!1)})}),r(ee),F&&B(re),F&&X(re)})],U=h.bind(0);return U.qt=M,U.Nt=O,[(ee,de,Z)=>{const{At:ue,Lt:fe,It:ge,yt:_e}=Z,{A:ye}=Qo(),pe=Bx(t,ee,de),Te=n(),{Tt:Ae,Ct:qe,bt:Pt}=Te,[tt,sn]=pe("showNativeOverlaidScrollbars"),[mt,ct]=pe("scrollbars.theme"),[be,We]=pe("scrollbars.visibility"),[Rt,Ut]=pe("scrollbars.autoHide"),[ke]=pe("scrollbars.autoHideDelay"),[Ct,Ft]=pe("scrollbars.dragScroll"),[Wt,Le]=pe("scrollbars.clickScroll"),Xe=ue||fe||_e,_n=ge||We,Me=tt&&ye.x&&ye.y,Ze=(Ye,dt)=>{const Vt=be==="visible"||be==="auto"&&Ye==="scroll";return z(Tte,Vt,dt),Vt};if(p=ke,sn&&z(Ote,Me),ct&&(z(u),z(mt,!0),u=mt),Ut&&(o=Rt==="move",s=Rt==="leave",i=Rt!=="never",le(!i,!0)),Ft&&z(Lte,Ct),Le&&z($te,Wt),_n){const Ye=Ze(qe.x,!0),dt=Ze(qe.y,!1);z(Nte,!(Ye&&dt))}Xe&&(G(Te),T(Te),z(Tj,!Ae.x,!0),z(Tj,!Ae.y,!1),z(Rte,Pt&&!V))},U,Wa.bind(0,K)]},OO=(e,t,n)=>{ia(e)&&e(t||void 0,n||void 0)},Gi=(e,t,n)=>{const{F:r,N:o,Y:s,j:i}=Qo(),l=Jl(),u=zh(e),p=u?e:e.target,m=_O(p);if(t&&!m){let h=!1;const g=F=>{const V=Jl()[Fte],Q=V&&V.O;return Q?Q(F,!0):F},x=Sr({},r(),g(t)),[y,b,C]=e2(n),[S,j,_]=dne(e,x),[P,I,M]=Cne(e,x,j,F=>C("scroll",[Y,F])),O=(F,V)=>S(F,!!V),A=O.bind(0,{},!0),D=s(A),R=i(A),N=F=>{Xte(p),D(),R(),M(),_(),h=!0,C("destroyed",[Y,!!F]),b()},Y={options(F,V){if(F){const Q=V?r():{},q=gO(x,Sr(Q,g(F)));Ky(q)||(Sr(x,q),O(q))}return Sr({},x)},on:y,off:(F,V)=>{F&&V&&b(F,V)},state(){const{zt:F,Tt:V,Ct:Q,Et:q,K:z,St:G,bt:T}=j();return Sr({},{overflowEdge:F,overflowAmount:V,overflowStyle:Q,hasOverflow:q,padding:z,paddingAbsolute:G,directionRTL:T,destroyed:h})},elements(){const{W:F,Z:V,K:Q,J:q,tt:z,ot:G,st:T}=j.qt,{Jt:B,nn:X}=I.qt,re=se=>{const{Ft:K,Gt:U,Xt:ee}=se;return{scrollbar:ee,track:U,handle:K}},le=se=>{const{Kt:K,Qt:U}=se,ee=re(K[0]);return Sr({},ee,{clone:()=>{const de=re(U());return P({},!0,{}),de}})};return Sr({},{target:F,host:V,padding:Q||q,viewport:q,content:z||q,scrollOffsetElement:G,scrollEventElement:T,scrollbarHorizontal:le(B),scrollbarVertical:le(X)})},update:F=>O({},F),destroy:N.bind(0)};return j.jt((F,V,Q)=>{P(V,Q,F)}),Qte(p,Y),Dn(us(l),F=>OO(l[F],0,Y)),Kte(j.qt.it,o().cancel,!u&&e.cancel)?(N(!0),Y):(j.Nt(),I.Nt(),C("initialized",[Y]),j.jt((F,V,Q)=>{const{gt:q,yt:z,vt:G,At:T,Lt:B,It:X,wt:re,Ot:le}=F;C("updated",[Y,{updateHints:{sizeChanged:q,directionChanged:z,heightIntrinsicChanged:G,overflowEdgeChanged:T,overflowAmountChanged:B,overflowStyleChanged:X,contentMutation:re,hostMutation:le},changedOptions:V,force:Q}])}),Y.update(!0),Y)}return m};Gi.plugin=e=>{Dn(zte(e),t=>OO(t,Gi))};Gi.valid=e=>{const t=e&&e.elements,n=ia(t)&&t();return Nx(n)&&!!_O(n.target)};Gi.env=()=>{const{k:e,A:t,I:n,B:r,V:o,L:s,X:i,U:l,N:u,q:p,F:m,G:h}=Qo();return Sr({},{scrollbarsSize:e,scrollbarsOverlaid:t,scrollbarsHiding:n,rtlScrollBehavior:r,flexboxGlue:o,cssCustomProperties:s,staticDefaultInitialization:i,staticDefaultOptions:l,getDefaultInitialization:u,setDefaultInitialization:p,getDefaultOptions:m,setDefaultOptions:h})};const wne=()=>{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,l=r?n.cancelIdleCallback:s,u=()=>{l(e),s(t)};return[(p,m)=>{u(),e=i(r?()=>{u(),t=o(p)}:p,typeof m=="object"?m:{timeout:2233})},u]},a2=e=>{const{options:t,events:n,defer:r}=e||{},[o,s]=d.useMemo(wne,[]),i=d.useRef(null),l=d.useRef(r),u=d.useRef(t),p=d.useRef(n);return d.useEffect(()=>{l.current=r},[r]),d.useEffect(()=>{const{current:m}=i;u.current=t,Gi.valid(m)&&m.options(t||{},!0)},[t]),d.useEffect(()=>{const{current:m}=i;p.current=n,Gi.valid(m)&&m.on(n||{},!0)},[n]),d.useEffect(()=>()=>{var m;s(),(m=i.current)==null||m.destroy()},[]),d.useMemo(()=>[m=>{const h=i.current;if(Gi.valid(h))return;const g=l.current,x=u.current||{},y=p.current||{},b=()=>i.current=Gi(m,x,y);g?o(b,g):b()},()=>i.current],[])},Sne=(e,t)=>{const{element:n="div",options:r,events:o,defer:s,children:i,...l}=e,u=n,p=d.useRef(null),m=d.useRef(null),[h,g]=a2({options:r,events:o,defer:s});return d.useEffect(()=>{const{current:x}=p,{current:y}=m;return x&&y&&h({target:x,elements:{viewport:y,content:y}}),()=>{var b;return(b=g())==null?void 0:b.destroy()}},[h,n]),d.useImperativeHandle(t,()=>({osInstance:g,getElement:()=>p.current}),[]),H.createElement(u,{"data-overlayscrollbars-initialize":"",ref:p,...l},H.createElement("div",{ref:m},i))},e0=d.forwardRef(Sne);var RO={exports:{}},AO={};const ts=xb(HD),bd=xb(WD),kne=xb(VD);(function(e){var t,n,r=wc&&wc.__generator||function(ne,ae){var ve,Pe,xe,pt,it={label:0,sent:function(){if(1&xe[0])throw xe[1];return xe[1]},trys:[],ops:[]};return pt={next:Kt(0),throw:Kt(1),return:Kt(2)},typeof Symbol=="function"&&(pt[Symbol.iterator]=function(){return this}),pt;function Kt(ht){return function(wt){return function(He){if(ve)throw new TypeError("Generator is already executing.");for(;it;)try{if(ve=1,Pe&&(xe=2&He[0]?Pe.return:He[0]?Pe.throw||((xe=Pe.return)&&xe.call(Pe),0):Pe.next)&&!(xe=xe.call(Pe,He[1])).done)return xe;switch(Pe=0,xe&&(He=[2&He[0],xe.value]),He[0]){case 0:case 1:xe=He;break;case 4:return it.label++,{value:He[1],done:!1};case 5:it.label++,Pe=He[1],He=[0];continue;case 7:He=it.ops.pop(),it.trys.pop();continue;default:if(!((xe=(xe=it.trys).length>0&&xe[xe.length-1])||He[0]!==6&&He[0]!==2)){it=0;continue}if(He[0]===3&&(!xe||He[1]>xe[0]&&He[1]=200&&ne.status<=299},Y=function(ne){return/ion\/(vnd\.api\+)?json/.test(ne.get("content-type")||"")};function F(ne){if(!(0,D.isPlainObject)(ne))return ne;for(var ae=C({},ne),ve=0,Pe=Object.entries(ae);ve"u"&&it===R&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(an,Yt){return I(ae,null,function(){var Be,yt,Lt,Qt,Nn,Jt,vn,fn,Fr,cr,Ot,$n,Hn,ur,_r,Qn,Xn,xn,On,Ln,In,Pn,Je,Dt,kt,lt,St,Gt,vt,st,$e,Re,ze,Ve,nt,zt;return r(this,function(Tt){switch(Tt.label){case 0:return Be=Yt.signal,yt=Yt.getState,Lt=Yt.extra,Qt=Yt.endpoint,Nn=Yt.forced,Jt=Yt.type,Fr=(fn=typeof an=="string"?{url:an}:an).url,Ot=(cr=fn.headers)===void 0?new Headers(Zt.headers):cr,Hn=($n=fn.params)===void 0?void 0:$n,_r=(ur=fn.responseHandler)===void 0?At??"json":ur,Xn=(Qn=fn.validateStatus)===void 0?Ht??N:Qn,On=(xn=fn.timeout)===void 0?Et:xn,Ln=_(fn,["url","headers","params","responseHandler","validateStatus","timeout"]),In=C(S(C({},Zt),{signal:Be}),Ln),Ot=new Headers(F(Ot)),Pn=In,[4,xe(Ot,{getState:yt,extra:Lt,endpoint:Qt,forced:Nn,type:Jt})];case 1:Pn.headers=Tt.sent()||Ot,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)),Hn&&(Dt=~Fr.indexOf("?")?"&":"?",kt=Kt?Kt(Hn):new URLSearchParams(F(Hn)),Fr+=Dt+kt),Fr=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)}(ve,Fr),lt=new Request(Fr,In),St=lt.clone(),vn={request:St},vt=!1,st=On&&setTimeout(function(){vt=!0,Yt.abort()},On),Tt.label=2;case 2:return Tt.trys.push([2,4,5,6]),[4,it(lt)];case 3:return Gt=Tt.sent(),[3,6];case 4:return $e=Tt.sent(),[2,{error:{status:vt?"TIMEOUT_ERROR":"FETCH_ERROR",error:String($e)},meta:vn}];case 5:return st&&clearTimeout(st),[7];case 6:Re=Gt.clone(),vn.response=Re,Ve="",Tt.label=7;case 7:return Tt.trys.push([7,9,,10]),[4,Promise.all([ln(Gt,_r).then(function(Ue){return ze=Ue},function(Ue){return nt=Ue}),Re.text().then(function(Ue){return Ve=Ue},function(){})])];case 8:if(Tt.sent(),nt)throw nt;return[3,10];case 9:return zt=Tt.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:Gt.status,data:Ve,error:String(zt)},meta:vn}];case 10:return[2,Xn(Gt,ze)?{data:ze,meta:vn}:{error:{status:Gt.status,data:ze},meta:vn}]}})})};function ln(an,Yt){return I(this,null,function(){var Be;return r(this,function(yt){switch(yt.label){case 0:return typeof Yt=="function"?[2,Yt(an)]:(Yt==="content-type"&&(Yt=wt(an.headers)?"json":"text"),Yt!=="json"?[3,2]:[4,an.text()]);case 1:return[2,(Be=yt.sent()).length?JSON.parse(Be):null];case 2:return[2,an.text()]}})})}}var Q=function(ne,ae){ae===void 0&&(ae=void 0),this.value=ne,this.meta=ae};function q(ne,ae){return ne===void 0&&(ne=0),ae===void 0&&(ae=5),I(this,null,function(){var ve,Pe;return r(this,function(xe){switch(xe.label){case 0:return ve=Math.min(ne,ae),Pe=~~((Math.random()+.4)*(300<=Re)}var Ln=(0,qe.createAsyncThunk)(Hn+"/executeQuery",xn,{getPendingMeta:function(){var Je;return(Je={startedTimeStamp:Date.now()})[qe.SHOULD_AUTOBATCH]=!0,Je},condition:function(Je,Dt){var kt,lt,St,Gt=(0,Dt.getState)(),vt=(lt=(kt=Gt[Hn])==null?void 0:kt.queries)==null?void 0:lt[Je.queryCacheKey],st=vt==null?void 0:vt.fulfilledTimeStamp,$e=Je.originalArgs,Re=vt==null?void 0:vt.originalArgs,ze=_r[Je.endpointName];return!(!pe(Je)&&((vt==null?void 0:vt.status)==="pending"||!On(Je,Gt)&&(!Z(ze)||!((St=ze==null?void 0:ze.forceRefetch)!=null&&St.call(ze,{currentArg:$e,previousArg:Re,endpointState:vt,state:Gt})))&&st))},dispatchConditionRejection:!0}),In=(0,qe.createAsyncThunk)(Hn+"/executeMutation",xn,{getPendingMeta:function(){var Je;return(Je={startedTimeStamp:Date.now()})[qe.SHOULD_AUTOBATCH]=!0,Je}});function Pn(Je){return function(Dt){var kt,lt;return((lt=(kt=Dt==null?void 0:Dt.meta)==null?void 0:kt.arg)==null?void 0:lt.endpointName)===Je}}return{queryThunk:Ln,mutationThunk:In,prefetch:function(Je,Dt,kt){return function(lt,St){var Gt=function(ze){return"force"in ze}(kt)&&kt.force,vt=function(ze){return"ifOlderThan"in ze}(kt)&&kt.ifOlderThan,st=function(ze){return ze===void 0&&(ze=!0),Xn.endpoints[Je].initiate(Dt,{forceRefetch:ze})},$e=Xn.endpoints[Je].select(Dt)(St());if(Gt)lt(st());else if(vt){var Re=$e==null?void 0:$e.fulfilledTimeStamp;if(!Re)return void lt(st());(Number(new Date)-Number(new Date(Re)))/1e3>=vt&<(st())}else lt(st(!1))}},updateQueryData:function(Je,Dt,kt){return function(lt,St){var Gt,vt,st=Xn.endpoints[Je].select(Dt)(St()),$e={patches:[],inversePatches:[],undo:function(){return lt(Xn.util.patchQueryData(Je,Dt,$e.inversePatches))}};if(st.status===t.uninitialized)return $e;if("data"in st)if((0,Ae.isDraftable)(st.data)){var Re=(0,Ae.produceWithPatches)(st.data,kt),ze=Re[2];(Gt=$e.patches).push.apply(Gt,Re[1]),(vt=$e.inversePatches).push.apply(vt,ze)}else{var Ve=kt(st.data);$e.patches.push({op:"replace",path:[],value:Ve}),$e.inversePatches.push({op:"replace",path:[],value:st.data})}return lt(Xn.util.patchQueryData(Je,Dt,$e.patches)),$e}},upsertQueryData:function(Je,Dt,kt){return function(lt){var St;return lt(Xn.endpoints[Je].initiate(Dt,((St={subscribe:!1,forceRefetch:!0})[ye]=function(){return{data:kt}},St)))}},patchQueryData:function(Je,Dt,kt){return function(lt){lt(Xn.internalActions.queryResultPatched({queryCacheKey:Qn({queryArgs:Dt,endpointDefinition:_r[Je],endpointName:Je}),patches:kt}))}},buildMatchThunkActions:function(Je,Dt){return{matchPending:(0,Te.isAllOf)((0,Te.isPending)(Je),Pn(Dt)),matchFulfilled:(0,Te.isAllOf)((0,Te.isFulfilled)(Je),Pn(Dt)),matchRejected:(0,Te.isAllOf)((0,Te.isRejected)(Je),Pn(Dt))}}}}({baseQuery:Pe,reducerPath:xe,context:ve,api:ne,serializeQueryArgs:pt}),et=Ie.queryThunk,Et=Ie.mutationThunk,At=Ie.patchQueryData,Ht=Ie.updateQueryData,Zt=Ie.upsertQueryData,ln=Ie.prefetch,an=Ie.buildMatchThunkActions,Yt=function(Ot){var $n=Ot.reducerPath,Hn=Ot.queryThunk,ur=Ot.mutationThunk,_r=Ot.context,Qn=_r.endpointDefinitions,Xn=_r.apiUid,xn=_r.extractRehydrationInfo,On=_r.hasRehydrationInfo,Ln=Ot.assertTagType,In=Ot.config,Pn=(0,ge.createAction)($n+"/resetApiState"),Je=(0,ge.createSlice)({name:$n+"/queries",initialState:Rt,reducers:{removeQueryResult:{reducer:function(st,$e){delete st[$e.payload.queryCacheKey]},prepare:(0,ge.prepareAutoBatched)()},queryResultPatched:function(st,$e){var Re=$e.payload,ze=Re.patches;ct(st,Re.queryCacheKey,function(Ve){Ve.data=(0,mt.applyPatches)(Ve.data,ze.concat())})}},extraReducers:function(st){st.addCase(Hn.pending,function($e,Re){var ze,Ve=Re.meta,nt=Re.meta.arg,zt=pe(nt);(nt.subscribe||zt)&&($e[ze=nt.queryCacheKey]!=null||($e[ze]={status:t.uninitialized,endpointName:nt.endpointName})),ct($e,nt.queryCacheKey,function(Tt){Tt.status=t.pending,Tt.requestId=zt&&Tt.requestId?Tt.requestId:Ve.requestId,nt.originalArgs!==void 0&&(Tt.originalArgs=nt.originalArgs),Tt.startedTimeStamp=Ve.startedTimeStamp})}).addCase(Hn.fulfilled,function($e,Re){var ze=Re.meta,Ve=Re.payload;ct($e,ze.arg.queryCacheKey,function(nt){var zt;if(nt.requestId===ze.requestId||pe(ze.arg)){var Tt=Qn[ze.arg.endpointName].merge;if(nt.status=t.fulfilled,Tt)if(nt.data!==void 0){var Ue=ze.fulfilledTimeStamp,cn=ze.arg,En=ze.baseQueryMeta,Cn=ze.requestId,Ir=(0,ge.createNextState)(nt.data,function(ir){return Tt(ir,Ve,{arg:cn.originalArgs,baseQueryMeta:En,fulfilledTimeStamp:Ue,requestId:Cn})});nt.data=Ir}else nt.data=Ve;else nt.data=(zt=Qn[ze.arg.endpointName].structuralSharing)==null||zt?A((0,sn.isDraft)(nt.data)?(0,mt.original)(nt.data):nt.data,Ve):Ve;delete nt.error,nt.fulfilledTimeStamp=ze.fulfilledTimeStamp}})}).addCase(Hn.rejected,function($e,Re){var ze=Re.meta,Ve=ze.condition,nt=ze.requestId,zt=Re.error,Tt=Re.payload;ct($e,ze.arg.queryCacheKey,function(Ue){if(!Ve){if(Ue.requestId!==nt)return;Ue.status=t.rejected,Ue.error=Tt??zt}})}).addMatcher(On,function($e,Re){for(var ze=xn(Re).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,$e){st.middlewareRegistered=st.middlewareRegistered!=="conflict"&&Xn===$e.payload||"conflict"}},extraReducers:function(st){st.addCase(re,function($e){$e.online=!0}).addCase(le,function($e){$e.online=!1}).addCase(B,function($e){$e.focused=!0}).addCase(X,function($e){$e.focused=!1}).addMatcher(On,function($e){return C({},$e)})}}),vt=(0,ge.combineReducers)({queries:Je.reducer,mutations:Dt.reducer,provided:kt.reducer,subscriptions:St.reducer,config:Gt.reducer});return{reducer:function(st,$e){return vt(Pn.match($e)?void 0:st,$e)},actions:S(C(C(C(C(C({},Gt.actions),Je.actions),lt.actions),St.actions),Dt.actions),{unsubscribeMutationResult:Dt.actions.removeMutationResult,resetApiState:Pn})}}({context:ve,queryThunk:et,mutationThunk:Et,reducerPath:xe,assertTagType:He,config:{refetchOnFocus:ht,refetchOnReconnect:wt,refetchOnMountOrArgChange:Kt,keepUnusedDataFor:it,reducerPath:xe}}),Be=Yt.reducer,yt=Yt.actions;Xr(ne.util,{patchQueryData:At,updateQueryData:Ht,upsertQueryData:Zt,prefetch:ln,resetApiState:yt.resetApiState}),Xr(ne.internalActions,yt);var Lt=function(Ot){var $n=Ot.reducerPath,Hn=Ot.queryThunk,ur=Ot.api,_r=Ot.context,Qn=_r.apiUid,Xn={invalidateTags:(0,xr.createAction)($n+"/invalidateTags")},xn=[so,yn,oo,Ar,or,Xo];return{middleware:function(Ln){var In=!1,Pn=S(C({},Ot),{internalState:{currentSubscriptions:{}},refetchQuery:On}),Je=xn.map(function(lt){return lt(Pn)}),Dt=function(lt){var St=lt.api,Gt=lt.queryThunk,vt=lt.internalState,st=St.reducerPath+"/subscriptions",$e=null,Re=!1,ze=St.internalActions,Ve=ze.updateSubscriptionOptions,nt=ze.unsubscribeQueryResult;return function(zt,Tt){var Ue,cn;if($e||($e=JSON.parse(JSON.stringify(vt.currentSubscriptions))),St.util.resetApiState.match(zt))return $e=vt.currentSubscriptions={},[!0,!1];if(St.internalActions.internal_probeSubscription.match(zt)){var En=zt.payload;return[!1,!!((Ue=vt.currentSubscriptions[En.queryCacheKey])!=null&&Ue[En.requestId])]}var Cn=function(Sn,sr){var wo,bn,Yn,io,Br,Pi,qf,Yo,Ga;if(Ve.match(sr)){var ma=sr.payload,qa=ma.queryCacheKey,So=ma.requestId;return(wo=Sn==null?void 0:Sn[qa])!=null&&wo[So]&&(Sn[qa][So]=ma.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=(Yn=Sn[bn=uo.queryCacheKey])!=null?Yn:Sn[bn]={})[So]=(Br=(io=uo.subscriptionOptions)!=null?io:ds[So])!=null?Br:{},!0}if(Gt.rejected.match(sr)){var ds,Jo=sr.meta,uo=Jo.arg;if(So=Jo.requestId,Jo.condition&&uo.subscribe)return(ds=(qf=Sn[Pi=uo.queryCacheKey])!=null?qf:Sn[Pi]={})[So]=(Ga=(Yo=uo.subscriptionOptions)!=null?Yo:ds[So])!=null?Ga:{},!0}return!1}(vt.currentSubscriptions,zt);if(Cn){Re||($s(function(){var Sn=JSON.parse(JSON.stringify(vt.currentSubscriptions)),sr=(0,ao.produceWithPatches)($e,function(){return Sn});Tt.next(St.internalActions.subscriptionsUpdated(sr[1])),$e=Sn,Re=!1}),Re=!0);var Ir=!!((cn=zt.type)!=null&&cn.startsWith(st)),ir=Gt.rejected.match(zt)&&zt.meta.condition&&!!zt.meta.arg.subscribe;return[!Ir&&!ir,!1]}return[!0,!1]}}(Pn),kt=function(lt){var St=lt.reducerPath,Gt=lt.context,vt=lt.refetchQuery,st=lt.internalState,$e=lt.api.internalActions.removeQueryResult;function Re(ze,Ve){var nt=ze.getState()[St],zt=nt.queries,Tt=st.currentSubscriptions;Gt.batch(function(){for(var Ue=0,cn=Object.keys(Tt);Ue{const{boardToDelete:t,setBoardToDelete:n}=e,{t:r}=J(),o=W(j=>j.config.canRestoreDeletedImagesFromBin),{currentData:s,isFetching:i}=UD((t==null?void 0:t.board_id)??Os.skipToken),l=d.useMemo(()=>ce([we],j=>{const _=(s??[]).map(I=>II(j,I));return{imageUsageSummary:{isInitialImage:Qs(_,I=>I.isInitialImage),isCanvasImage:Qs(_,I=>I.isCanvasImage),isNodesImage:Qs(_,I=>I.isNodesImage),isControlImage:Qs(_,I=>I.isControlImage)}}}),[s]),[u,{isLoading:p}]=GD(),[m,{isLoading:h}]=qD(),{imageUsageSummary:g}=W(l),x=d.useCallback(()=>{t&&(u(t.board_id),n(void 0))},[t,u,n]),y=d.useCallback(()=>{t&&(m(t.board_id),n(void 0))},[t,m,n]),b=d.useCallback(()=>{n(void 0)},[n]),C=d.useRef(null),S=d.useMemo(()=>h||p||i,[h,p,i]);return t?a.jsx(Mf,{isOpen:!!t,onClose:b,leastDestructiveRef:C,isCentered:!0,children:a.jsx(oa,{children:a.jsxs(Of,{children:[a.jsxs(ra,{fontSize:"lg",fontWeight:"bold",children:["Delete ",t.board_name]}),a.jsx(sa,{children:a.jsxs($,{direction:"column",gap:3,children:[i?a.jsx(Og,{children:a.jsx($,{sx:{w:"full",h:32}})}):a.jsx(TM,{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(Oa,{children:a.jsxs($,{sx:{justifyContent:"space-between",width:"full",gap:2},children:[a.jsx(Mt,{ref:C,onClick:b,children:"Cancel"}),a.jsx(Mt,{colorScheme:"warning",isLoading:S,onClick:x,children:"Delete Board Only"}),a.jsx(Mt,{colorScheme:"error",isLoading:S,onClick:y,children:"Delete Board and Images"})]})})]})})}):null},_ne=d.memo(jne),Ine=()=>{const{t:e}=J(),[t,{isLoading:n}]=KD(),r=e("boards.myBoard"),o=d.useCallback(()=>{t(r)},[t,r]);return a.jsx(ot,{icon:a.jsx(Xi,{}),isLoading:n,tooltip:e("boards.addBoard"),"aria-label":e("boards.addBoard"),onClick:o,size:"sm","data-testid":"add-board-button"})},Pne=d.memo(Ine);var DO=lg({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"})]})}),t0=lg({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),Ene=lg({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"}),Mne=lg({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 One=ce([we],({gallery:e})=>{const{boardSearchText:t}=e;return{boardSearchText:t}},je),Rne=()=>{const e=te(),{boardSearchText:t}=W(One),n=d.useRef(null),{t:r}=J(),o=d.useCallback(u=>{e(Ow(u))},[e]),s=d.useCallback(()=>{e(Ow(""))},[e]),i=d.useCallback(u=>{u.key==="Escape"&&s()},[s]),l=d.useCallback(u=>{o(u.target.value)},[o]);return d.useEffect(()=>{n.current&&n.current.focus()},[]),a.jsxs(L3,{children:[a.jsx(gg,{ref:n,placeholder:r("boards.searchBoard"),value:t,onKeyDown:i,onChange:l,"data-testid":"board-search-input"}),t&&t.length&&a.jsx(ay,{children:a.jsx(Pa,{onClick:s,size:"xs",variant:"ghost","aria-label":r("boards.clearSearch"),opacity:.5,icon:a.jsx(Ene,{boxSize:2})})})]})},Ane=d.memo(Rne);function TO(e){return QD(e)}function Dne(e){return XD(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:l}=t.data.current.payload,u=l.board_id??"none",p=e.context.boardId;return u!==p}if(r==="IMAGE_DTOS"){const{imageDTOs:l}=t.data.current.payload,u=((o=l[0])==null?void 0:o.board_id)??"none",p=e.context.boardId;return u!==p}return!1}case"REMOVE_FROM_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:l}=t.data.current.payload;return(l.board_id??"none")!=="none"}if(r==="IMAGE_DTOS"){const{imageDTOs:l}=t.data.current.payload;return(((s=l[0])==null?void 0:s.board_id)??"none")!=="none"}return!1}default:return!1}},Tne=e=>{const{isOver:t,label:n="Drop"}=e,r=d.useRef(oi()),{colorMode:o}=Ci();return a.jsx(Mr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsxs($,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full"},children:[a.jsx($,{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($,{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(De,{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=d.memo(Tne),Nne=e=>{const{dropLabel:t,data:n,disabled:r}=e,o=d.useRef(oi()),{isOver:s,setNodeRef:i,active:l}=TO({id:o.current,disabled:r,data:n});return a.jsx(De,{ref:i,position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",pointerEvents:l?"auto":"none",children:a.jsx(yo,{children:NO(n,l)&&a.jsx($O,{isOver:s,label:t})})})},i2=d.memo(Nne),$ne=({isSelected:e,isHovered:t})=>a.jsx(De,{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}}}),l2=d.memo($ne),Lne=()=>{const{t:e}=J();return a.jsx($,{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=d.memo(Lne);function c2(e){const[t,n]=d.useState(!1),[r,o]=d.useState(!1),[s,i]=d.useState(!1),[l,u]=d.useState([0,0]),p=d.useRef(null),m=W(g=>g.ui.globalContextMenuCloseTrigger);d.useEffect(()=>{if(t)setTimeout(()=>{o(!0),setTimeout(()=>{i(!0)})});else{i(!1);const g=setTimeout(()=>{o(t)},1e3);return()=>clearTimeout(g)}},[t]),d.useEffect(()=>{n(!1),i(!1),o(!1)},[m]),$F("contextmenu",g=>{var x;(x=p.current)!=null&&x.contains(g.target)||g.target===p.current?(g.preventDefault(),n(!0),u([g.pageX,g.pageY])):n(!1)});const h=d.useCallback(()=>{var g,x;(x=(g=e.menuProps)==null?void 0:g.onClose)==null||x.call(g),n(!1)},[e.menuProps]);return a.jsxs(a.Fragment,{children:[e.children(p),r&&a.jsx(Eu,{...e.portalProps,children:a.jsxs(bg,{isOpen:s,gutter:0,...e.menuProps,onClose:h,children:[a.jsx(yg,{"aria-hidden":!0,w:1,h:1,style:{position:"absolute",left:l[0],top:l[1],cursor:"default"},...e.menuButtonProps}),e.renderMenu()]})})]})}const n0=e=>{const{boardName:t}=hf(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)||AI("boards.uncategorized")}}});return t},zne=({board:e,setBoardToDelete:t})=>{const n=d.useCallback(()=>{t&&t(e)},[e,t]);return a.jsxs(a.Fragment,{children:[e.image_count>0&&a.jsx(a.Fragment,{}),a.jsx(Wn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(qo,{}),onClick:n,children:"Delete Board"})]})},Fne=d.memo(zne),Bne=()=>a.jsx(a.Fragment,{}),Hne=d.memo(Bne),Wne=({board:e,board_id:t,setBoardToDelete:n,children:r})=>{const{t:o}=J(),s=te(),i=d.useMemo(()=>ce(we,({gallery:b})=>{const C=b.autoAddBoardId===t,S=b.autoAssignBoardOnClick;return{isAutoAdd:C,autoAssignBoardOnClick:S}},je),[t]),{isAutoAdd:l,autoAssignBoardOnClick:u}=W(i),p=n0(t),m=jn("bulkDownload").isFeatureEnabled,[h]=DI(),g=d.useCallback(()=>{s(ng(t))},[t,s]),x=d.useCallback(async()=>{try{const b=await h({image_names:[],board_id:t}).unwrap();s($t({title:o("gallery.preparingDownload"),status:"success",...b.response?{description:b.response}:{}}))}catch{s($t({title:o("gallery.preparingDownloadFailed"),status:"error"}))}},[o,t,h,s]),y=d.useCallback(b=>{b.preventDefault()},[]);return a.jsx(c2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>a.jsx(Ul,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:y,children:a.jsxs(Xd,{title:p,children:[a.jsx(Wn,{icon:a.jsx(Xi,{}),isDisabled:l||u,onClick:g,children:o("boards.menuItemAutoAdd")}),m&&a.jsx(Wn,{icon:a.jsx(zu,{}),onClickCapture:x,children:o("boards.downloadBoard")}),!e&&a.jsx(Hne,{}),e&&a.jsx(Fne,{board:e,setBoardToDelete:n})]})}),children:r})},zO=d.memo(Wne),Vne=({board:e,isSelected:t,setBoardToDelete:n})=>{const r=te(),o=d.useMemo(()=>ce(we,({gallery:D})=>{const R=e.board_id===D.autoAddBoardId,N=D.autoAssignBoardOnClick;return{isSelectedForAutoAdd:R,autoAssignBoardOnClick:N}},je),[e.board_id]),{isSelectedForAutoAdd:s,autoAssignBoardOnClick:i}=W(o),[l,u]=d.useState(!1),p=d.useCallback(()=>{u(!0)},[]),m=d.useCallback(()=>{u(!1)},[]),{data:h}=bb(e.board_id),{data:g}=yb(e.board_id),x=d.useMemo(()=>{if(!((h==null?void 0:h.total)===void 0||(g==null?void 0:g.total)===void 0))return`${h.total} image${h.total===1?"":"s"}, ${g.total} asset${g.total===1?"":"s"}`},[g,h]),{currentData:y}=Ps(e.cover_image_name??Os.skipToken),{board_name:b,board_id:C}=e,[S,j]=d.useState(b),_=d.useCallback(()=>{r(TI({boardId:C})),i&&r(ng(C))},[C,i,r]),[P,{isLoading:I}]=YD(),M=d.useMemo(()=>({id:C,actionType:"ADD_TO_BOARD",context:{boardId:C}}),[C]),O=d.useCallback(async D=>{if(!D.trim()){j(b);return}if(D!==b)try{const{board_name:R}=await P({board_id:C,changes:{board_name:D}}).unwrap();j(R)}catch{j(b)}},[C,b,P]),A=d.useCallback(D=>{j(D)},[]);return a.jsx(De,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx($,{onMouseOver:p,onMouseOut:m,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:x,openDelay:1e3,hasArrow:!0,children:a.jsxs($,{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(wi,{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($,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(Lr,{boxSize:12,as:Oee,sx:{mt:-6,opacity:.7,color:"base.500",_dark:{color:"base.500"}}})}),s&&a.jsx(LO,{}),a.jsx(l2,{isSelected:t,isHovered:l}),a.jsx($,{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(pg,{value:S,isDisabled:I,submitOnBlur:!0,onChange:A,onSubmit:O,sx:{w:"full"},children:[a.jsx(fg,{sx:{p:0,fontWeight:t?700:500,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},noOfLines:1}),a.jsx(dg,{sx:{p:0,_focusVisible:{p:0,textAlign:"center",boxShadow:"none"}}})]})}),a.jsx(i2,{data:M,dropLabel:a.jsx(Se,{fontSize:"md",children:"Move"})})]})})})})})},Une=d.memo(Vne),Gne=ce(we,({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},je),FO=d.memo(({isSelected:e})=>{const t=te(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=W(Gne),o=n0("none"),s=d.useCallback(()=>{t(TI({boardId:"none"})),r&&t(ng("none"))},[t,r]),[i,l]=d.useState(!1),{data:u}=bb("none"),{data:p}=yb("none"),m=d.useMemo(()=>{if(!((u==null?void 0:u.total)===void 0||(p==null?void 0:p.total)===void 0))return`${u.total} image${u.total===1?"":"s"}, ${p.total} asset${p.total===1?"":"s"}`},[p,u]),h=d.useCallback(()=>{l(!0)},[]),g=d.useCallback(()=>{l(!1)},[]),x=d.useMemo(()=>({id:"no_board",actionType:"REMOVE_FROM_BOARD"}),[]);return a.jsx(De,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx($,{onMouseOver:h,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:m,openDelay:1e3,hasArrow:!0,children:a.jsxs($,{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($,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(wi,{src:vb,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($,{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(l2,{isSelected:e,isHovered:i}),a.jsx(i2,{data:x,dropLabel:a.jsx(Se,{fontSize:"md",children:"Move"})})]})})})})})});FO.displayName="HoverableBoard";const qne=d.memo(FO),Kne=ce([we],({gallery:e})=>{const{selectedBoardId:t,boardSearchText:n}=e;return{selectedBoardId:t,boardSearchText:n}},je),Qne=e=>{const{isOpen:t}=e,{selectedBoardId:n,boardSearchText:r}=W(Kne),{data:o}=hf(),s=r?o==null?void 0:o.filter(u=>u.board_name.toLowerCase().includes(r.toLowerCase())):o,[i,l]=d.useState();return a.jsxs(a.Fragment,{children:[a.jsx(wf,{in:t,animateOpacity:!0,children:a.jsxs($,{layerStyle:"first",sx:{flexDir:"column",gap:2,p:2,mt:2,borderRadius:"base"},children:[a.jsxs($,{sx:{gap:2,alignItems:"center"},children:[a.jsx(Ane,{}),a.jsx(Pne,{})]}),a.jsx(e0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsxs(tl,{className:"list-container","data-testid":"boards-list",sx:{gridTemplateColumns:"repeat(auto-fill, minmax(108px, 1fr));",maxH:346},children:[a.jsx(qd,{sx:{p:1.5},"data-testid":"no-board",children:a.jsx(qne,{isSelected:n==="none"})}),s&&s.map((u,p)=>a.jsx(qd,{sx:{p:1.5},"data-testid":`board-${p}`,children:a.jsx(Une,{board:u,isSelected:n===u.board_id,setBoardToDelete:l})},u.board_id))]})})]})}),a.jsx(_ne,{boardToDelete:i,setBoardToDelete:l})]})},Xne=d.memo(Qne),Yne=ce([we],e=>{const{selectedBoardId:t}=e.gallery;return{selectedBoardId:t}},je),Jne=e=>{const{isOpen:t,onToggle:n}=e,{selectedBoardId:r}=W(Yne),o=n0(r),s=d.useMemo(()=>o.length>20?`${o.substring(0,20)}...`:o,[o]);return a.jsxs($,{as:el,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(t0,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]})},Zne=d.memo(Jne),ere=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return a.jsxs(Af,{isLazy:o,...s,children:[a.jsx(Eg,{children:t}),a.jsxs(Df,{shadow:"dark-lg",children:[r&&a.jsx(x5,{}),n]})]})},Hf=d.memo(ere);function tre(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]=d.useState(!1),{label:o,value:s,min:i=1,max:l=100,step:u=1,onChange:p,tooltipSuffix:m="",withSliderMarks:h=!1,withInput:g=!1,isInteger:x=!1,inputWidth:y=16,withReset:b=!1,hideTooltip:C=!1,isCompact:S=!1,isDisabled:j=!1,sliderMarks:_,handleReset:P,sliderFormControlProps:I,sliderFormLabelProps:M,sliderMarkProps:O,sliderTrackProps:A,sliderThumbProps:D,sliderNumberInputProps:R,sliderNumberInputFieldProps:N,sliderNumberInputStepperProps:Y,sliderTooltipProps:F,sliderIAIIconButtonProps:V,...Q}=e,q=te(),{t:z}=J(),[G,T]=d.useState(String(s));d.useEffect(()=>{T(s)},[s]);const B=d.useMemo(()=>R!=null&&R.min?R.min:i,[i,R==null?void 0:R.min]),X=d.useMemo(()=>R!=null&&R.max?R.max:l,[l,R==null?void 0:R.max]),re=d.useCallback(Z=>{p(Z)},[p]),le=d.useCallback(Z=>{Z.target.value===""&&(Z.target.value=String(B));const ue=Fl(x?Math.floor(Number(Z.target.value)):Number(G),B,X),fe=kd(ue,u);p(fe),T(fe)},[x,G,B,X,p,u]),se=d.useCallback(Z=>{T(Z)},[]),K=d.useCallback(()=>{P&&P()},[P]),U=d.useCallback(Z=>{Z.target instanceof HTMLDivElement&&Z.target.focus()},[]),ee=d.useCallback(Z=>{Z.shiftKey&&q(Vo(!0))},[q]),de=d.useCallback(Z=>{Z.shiftKey||q(Vo(!1))},[q]);return a.jsxs(Kn,{ref:t,onClick:U,sx:S?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},isDisabled:j,...I,children:[o&&a.jsx(Rr,{sx:g?{mb:-1.5}:{},...M,children:o}),a.jsxs(cy,{w:"100%",gap:2,alignItems:"center",children:[a.jsxs(Cy,{"aria-label":o,value:s,min:i,max:l,step:u,onChange:re,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),focusThumbOnChange:!1,isDisabled:j,...Q,children:[h&&!_&&a.jsxs(a.Fragment,{children:[a.jsx(zc,{value:i,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...O,children:i}),a.jsx(zc,{value:l,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...O,children:l})]}),h&&_&&a.jsx(a.Fragment,{children:_.map((Z,ue)=>ue===0?a.jsx(zc,{value:Z,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...O,children:Z},Z):ue===_.length-1?a.jsx(zc,{value:Z,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...O,children:Z},Z):a.jsx(zc,{value:Z,sx:{transform:"translateX(-50%)"},...O,children:Z},Z))}),a.jsx(Sy,{...A,children:a.jsx(ky,{})}),a.jsx(Fn,{hasArrow:!0,placement:"top",isOpen:n,label:`${s}${m}`,hidden:C,...F,children:a.jsx(wy,{...D,zIndex:0})})]}),g&&a.jsxs(Sg,{min:B,max:X,step:u,value:G,onChange:se,onBlur:le,focusInputOnChange:!1,...R,children:[a.jsx(jg,{onKeyDown:ee,onKeyUp:de,minWidth:y,...N}),a.jsxs(kg,{...Y,children:[a.jsx(Ig,{onClick:()=>p(Number(G))}),a.jsx(_g,{onClick:()=>p(Number(G))})]})]}),b&&a.jsx(ot,{size:"sm","aria-label":z("accessibility.reset"),tooltip:z("accessibility.reset"),icon:a.jsx(tre,{}),isDisabled:j,onClick:K,...V})]})]})});BO.displayName="IAISlider";const jt=d.memo(BO),HO=d.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(De,{ref:s,...o,children:a.jsxs(De,{children:[a.jsx(vu,{children:e}),n&&a.jsx(vu,{size:"xs",color:"base.600",children:n})]})})}));HO.displayName="IAIMantineSelectItemWithTooltip";const fl=d.memo(HO),nre=ce([we],({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},je),rre=()=>{const e=te(),{t}=J(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=W(nre),o=d.useRef(null),{boards:s,hasBoards:i}=hf(void 0,{selectFromResult:({data:u})=>{const p=[{label:"None",value:"none"}];return u==null||u.forEach(({board_id:m,board_name:h})=>{p.push({label:h,value:m})}),{boards:p,hasBoards:p.length>1}}}),l=d.useCallback(u=>{u&&e(ng(u))},[e]);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:fl,disabled:!i||r,filter:(u,p)=>{var m;return((m=p.label)==null?void 0:m.toLowerCase().includes(u.toLowerCase().trim()))||p.value.toLowerCase().includes(u.toLowerCase().trim())},onChange:l})},ore=d.memo(rre),sre=e=>{const{label:t,...n}=e,{colorMode:r}=Ci();return a.jsx(jf,{colorScheme:"accent",...n,children:a.jsx(Se,{sx:{fontSize:"sm",color:Ke("base.800","base.200")(r)},children:t})})},Io=d.memo(sre),are=ce([we],e=>{const{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}=e.gallery;return{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}},je),ire=()=>{const e=te(),{t}=J(),{galleryImageMinimumWidth:n,shouldAutoSwitch:r,autoAssignBoardOnClick:o}=W(are),s=d.useCallback(u=>{e(Rw(u))},[e]),i=d.useCallback(()=>{e(Rw(64))},[e]),l=d.useCallback(u=>{e(JD(u.target.checked))},[e]);return a.jsx(Hf,{triggerComponent:a.jsx(ot,{tooltip:t("gallery.gallerySettings"),"aria-label":t("gallery.gallerySettings"),size:"sm",icon:a.jsx(ZM,{})}),children:a.jsxs($,{direction:"column",gap:2,children:[a.jsx(jt,{value:n,onChange:s,min:45,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:i}),a.jsx(kr,{label:t("gallery.autoSwitchNewImages"),isChecked:r,onChange:l}),a.jsx(Io,{label:t("gallery.autoAssignBoardOnClick"),isChecked:o,onChange:u=>e(ZD(u.target.checked))}),a.jsx(ore,{})]})})},lre=d.memo(ire),cre=e=>e.image?a.jsx(Og,{sx:{w:`${e.image.width}px`,h:"auto",objectFit:"contain",aspectRatio:`${e.image.width}/${e.image.height}`}}):a.jsx($,{sx:{opacity:.7,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(vi,{size:"xl"})}),eo=e=>{const{icon:t=Xl,boxSize:n=16,sx:r,...o}=e;return a.jsxs($,{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(Lr,{as:t,boxSize:n,opacity:.7}),e.label&&a.jsx(Se,{textAlign:"center",children:e.label})]})},ure=e=>{const{sx:t,...n}=e;return a.jsxs($,{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(vi,{size:"xl"}),e.label&&a.jsx(Se,{textAlign:"center",children:e.label})]})},r0=0,pl=1,Fu=2,WO=4;function VO(e,t){return n=>e(t(n))}function dre(e,t){return t(e)}function UO(e,t){return n=>e(t,n)}function Qj(e,t){return()=>e(t)}function o0(e,t){return t(e),e}function vr(...e){return e}function fre(e){e()}function Xj(e){return()=>e}function pre(...e){return()=>{e.map(fre)}}function u2(e){return e!==void 0}function Bu(){}function qn(e,t){return e(pl,t)}function dn(e,t){e(r0,t)}function d2(e){e(Fu)}function ks(e){return e(WO)}function Nt(e,t){return qn(e,UO(t,r0))}function hi(e,t){const n=e(pl,r=>{n(),t(r)});return n}function Mn(){const e=[];return(t,n)=>{switch(t){case Fu:e.splice(0,e.length);return;case pl:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case r0: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 pl:o(t);break;case r0:t=o;break;case WO:return t}return n(r,o)}}function mre(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case pl:return s?n===s?void 0:(r(),n=s,t=qn(e,s),t):(r(),Bu);case Fu:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function is(e){return o0(Mn(),t=>Nt(e,t))}function Eo(e,t){return o0(at(t),n=>Nt(e,n))}function hre(...e){return t=>e.reduceRight(dre,t)}function Ne(e,...t){const n=hre(...t);return(r,o)=>{switch(r){case pl:return qn(e,n(o));case Fu:d2(e);return}}}function GO(e,t){return e===t}function mr(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 bt(e){return t=>VO(t,e)}function ei(e){return t=>()=>t(e)}function Ia(e,t){return n=>r=>n(t=e(t,r))}function Su(e){return t=>n=>{e>0?e--:t(n)}}function qi(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Yj(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function hn(...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 l=Math.pow(2,i);qn(s,u=>{const p=n;n=n|l,t[i]=u,p!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const l=()=>s([i].concat(t));n===o?l():r=l}}function Jj(...e){return function(t,n){switch(t){case pl:return pre(...e.map(r=>qn(r,n)));case Fu:return;default:throw new Error(`unrecognized action ${t}`)}}}function en(e,t=GO){return Ne(e,mr(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 l=Math.pow(2,i);qn(s,u=>{n[i]=u,r=r|l,r===o&&dn(t,n)})}),function(s,i){switch(s){case pl:return r===o&&i(n),qn(t,i);case Fu:return d2(t);default:throw new Error(`unrecognized action ${s}`)}}}function Vn(e,t=[],{singleton:n}={singleton:!0}){return{id:gre(),constructor:e,dependencies:t,singleton:n}}const gre=()=>Symbol();function vre(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:i})=>{if(i&&t.has(r))return t.get(r);const l=o(s.map(u=>n(u)));return i&&t.set(r,l),l};return n(e)}function xre(e,t){const n={},r={};let o=0;const s=e.length;for(;o(C[S]=j=>{const _=b[t.methods[S]];dn(_,j)},C),{})}function m(b){return i.reduce((C,S)=>(C[S]=mre(b[t.events[S]]),C),{})}return{Component:H.forwardRef((b,C)=>{const{children:S,...j}=b,[_]=H.useState(()=>o0(vre(e),I=>u(I,j))),[P]=H.useState(Qj(m,_));return dm(()=>{for(const I of i)I in j&&qn(P[I],j[I]);return()=>{Object.values(P).map(d2)}},[j,P,_]),dm(()=>{u(_,j)}),H.useImperativeHandle(C,Xj(p(_))),H.createElement(l.Provider,{value:_},n?H.createElement(n,xre([...r,...o,...i],j),S):S)}),usePublisher:b=>H.useCallback(UO(dn,H.useContext(l)[b]),[b]),useEmitterValue:b=>{const S=H.useContext(l)[b],[j,_]=H.useState(Qj(ks,S));return dm(()=>qn(S,P=>{P!==j&&_(Xj(P))}),[S,j]),j},useEmitter:(b,C)=>{const j=H.useContext(l)[b];dm(()=>qn(j,C),[C,j])}}}const bre=typeof document<"u"?H.useLayoutEffect:H.useEffect,yre=bre;var ls=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(ls||{});const Cre={0:"debug",1:"log",2:"warn",3:"error"},wre=()=>typeof globalThis>"u"?window:globalThis,ml=Vn(()=>{const e=at(3);return{log:at((n,r,o=1)=>{var s;const i=(s=wre().VIRTUOSO_LOG_LEVEL)!=null?s:ks(e);o>=i&&console[Cre[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function f2(e,t=!0){const n=H.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=H.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 ic(e,t=!0){return f2(e,t).callbackRef}function Sre(e,t,n,r,o,s,i){const l=H.useCallback(u=>{const p=kre(u.children,t,"offsetHeight",o);let m=u.parentElement;for(;!m.dataset.virtuosoScroller;)m=m.parentElement;const h=m.lastElementChild.dataset.viewportType==="window",g=i?i.scrollTop:h?window.pageYOffset||document.documentElement.scrollTop:m.scrollTop,x=i?i.scrollHeight:h?document.documentElement.scrollHeight:m.scrollHeight,y=i?i.offsetHeight:h?window.innerHeight:m.offsetHeight;r({scrollTop:Math.max(g,0),scrollHeight:x,viewportHeight:y}),s==null||s(jre("row-gap",getComputedStyle(u).rowGap,o)),p!==null&&e(p)},[e,t,o,s,i,r]);return f2(l,n)}function kre(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i{const g=h.target,x=g===window||g===document,y=x?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,b=x?document.documentElement.scrollHeight:g.scrollHeight,C=x?window.innerHeight:g.offsetHeight,S=()=>{e({scrollTop:Math.max(y,0),scrollHeight:b,viewportHeight:C})};h.suppressFlushSync?S():e7.flushSync(S),i.current!==null&&(y===i.current||y<=0||y===b-C)&&(i.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);H.useEffect(()=>{const h=o||s.current;return r(o||s.current),u({target:h,suppressFlushSync:!0}),h.addEventListener("scroll",u,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",u)}},[s,u,n,r,o]);function p(h){const g=s.current;if(!g||"offsetHeight"in g&&g.offsetHeight===0)return;const x=h.behavior==="smooth";let y,b,C;g===window?(b=Math.max(sl(document.documentElement,"height"),document.documentElement.scrollHeight),y=window.innerHeight,C=document.documentElement.scrollTop):(b=g.scrollHeight,y=sl(g,"height"),C=g.scrollTop);const S=b-y;if(h.top=Math.ceil(Math.max(Math.min(S,h.top),0)),KO(y,b)||h.top===C){e({scrollTop:C,scrollHeight:b,viewportHeight:y}),x&&t(!0);return}x?(i.current=h.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,i.current=null,t(!0)},1e3)):i.current=null,g.scrollTo(h)}function m(h){s.current.scrollBy(h)}return{scrollerRef:s,scrollByCallback:m,scrollToCallback:p}}const Do=Vn(()=>{const e=Mn(),t=Mn(),n=at(0),r=Mn(),o=at(0),s=Mn(),i=Mn(),l=at(0),u=at(0),p=at(0),m=at(0),h=Mn(),g=Mn(),x=at(!1);return Nt(Ne(e,bt(({scrollTop:y})=>y)),t),Nt(Ne(e,bt(({scrollHeight:y})=>y)),i),Nt(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:l,fixedHeaderHeight:u,fixedFooterHeight:p,footerHeight:m,scrollHeight:i,smoothScrollTargetReached:r,scrollTo:h,scrollBy:g,statefulScrollTop:o,deviation:n,scrollingInProgress:x}},[],{singleton:!0}),rf={lvl:0};function XO(e,t,n,r=rf,o=rf){return{k:e,v:t,lvl:n,l:r,r:o}}function er(e){return e===rf}function uu(){return rf}function Vx(e,t){if(er(e))return rf;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 Em(Vr(e,{k:s,v:i,l:JO(r)}))}}else return tt&&(l=l.concat(Ux(s,t,n))),r>=t&&r<=n&&l.push({k:r,v:o}),r<=n&&(l=l.concat(Ux(i,t,n))),l}function Ol(e){return er(e)?[]:[...Ol(e.l),{k:e.k,v:e.v},...Ol(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:Em(Vr(e,{r:JO(e.r)}))}function Vr(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 g1(e){return er(e)||e.lvl>e.r.lvl}function Zj(e){return Gx(e8(e))}function Em(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(g1(t))return e8(Vr(e,{lvl:r-1}));if(!er(t)&&!er(t.r))return Vr(t.r,{l:Vr(t,{r:t.r.l}),r:Vr(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(g1(e))return Gx(Vr(e,{lvl:r-1}));if(!er(n)&&!er(n.l)){const o=n.l,s=g1(o)?n.lvl-1:n.lvl;return Vr(o,{l:Vr(e,{r:o.l,lvl:r-1}),r:Gx(Vr(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function s0(e,t,n){if(er(e))return[];const r=ca(e,t)[0];return _re(Ux(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 Gx(e){const{r:t,lvl:n}=e;return!er(t)&&!er(t.r)&&t.lvl===n&&t.r.lvl===n?Vr(t,{l:Vr(e,{r:t.l}),lvl:n+1}):e}function e8(e){const{l:t}=e;return!er(t)&&t.lvl===e.lvl?Vr(t,{r:Vr(e,{l:t.r})}):e}function Uh(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],l=n(i,t);if(l===0)return s;if(l===-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[Uh(e,t,n)]}function Ire(e,t,n,r){const o=Uh(e,t,r),s=Uh(e,n,r,o);return e.slice(o,s+1)}const p2=Vn(()=>({recalcInProgress:at(!1)}),[],{singleton:!0});function Pre(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 e_(e,t){let n=0,r=0;for(;n=m||o===g)&&(e=Vx(e,m)):(p=g!==o,u=!0),h>i&&i>=m&&g!==o&&(e=os(e,i+1,g));p&&(e=os(e,s,o))}return[e,n]}function Mre(){return{offsetTree:[],sizeTree:uu(),groupOffsetTree:uu(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function m2({index:e},t){return t===e?0:t0&&(t=Math.max(t,t8(e,r,m2).offset)),ZO(Ire(e,t,n,Ore),Rre)}function qx(e,t,n,r){let o=e,s=0,i=0,l=0,u=0;if(t!==0){u=Uh(o,t-1,m2),l=o[u].offset;const m=ca(n,t-1);s=m[0],i=m[1],o.length&&o[u].size===ca(n,t)[1]&&(u-=1),o=o.slice(0,u+1)}else o=[];for(const{start:p,value:m}of s0(n,t,1/0)){const h=p-s,g=h*i+l+h*r;o.push({offset:g,size:m,index:p}),s=p,l=g,i=m}return{offsetTree:o,lastIndex:s,lastOffset:l,lastSize:i}}function Dre(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,ls.DEBUG);const s=e.sizeTree;let i=s,l=0;if(n.length>0&&er(s)&&t.length===2){const g=t[0].size,x=t[1].size;i=n.reduce((y,b)=>os(os(y,b,g),b+1,x),i)}else[i,l]=Ere(i,t);if(i===s)return e;const{offsetTree:u,lastIndex:p,lastSize:m,lastOffset:h}=qx(e.offsetTree,l,i,o);return{sizeTree:i,offsetTree:u,lastIndex:p,lastOffset:h,lastSize:m,groupOffsetTree:n.reduce((g,x)=>os(g,x,sf(x,u,o)),uu()),groupIndices:n}}function sf(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=t8(t,e,m2),i=e-o,l=s*i+(i-1)*n+r;return l>0?l+n:l}function Tre(e){return typeof e.groupIndex<"u"}function n8(e,t,n){if(Tre(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(!a0(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function a0(e){return!er(e.groupOffsetTree)}function Nre(e){return Ol(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 $re={offsetHeight:"height",offsetWidth:"width"},Va=Vn(([{log:e},{recalcInProgress:t}])=>{const n=Mn(),r=Mn(),o=Eo(r,0),s=Mn(),i=Mn(),l=at(0),u=at([]),p=at(void 0),m=at(void 0),h=at((I,M)=>sl(I,$re[M])),g=at(void 0),x=at(0),y=Mre(),b=Eo(Ne(n,hn(u,e,x),Ia(Dre,y),mr()),y),C=Eo(Ne(u,mr(),Ia((I,M)=>({prev:I.current,current:M}),{prev:[],current:[]}),bt(({prev:I})=>I)),[]);Nt(Ne(u,tn(I=>I.length>0),hn(b,x),bt(([I,M,O])=>{const A=I.reduce((D,R,N)=>os(D,R,sf(R,M.offsetTree,O)||N),uu());return{...M,groupIndices:I,groupOffsetTree:A}})),b),Nt(Ne(r,hn(b),tn(([I,{lastIndex:M}])=>I[{startIndex:I,endIndex:M,size:O}])),n),Nt(p,m);const S=Eo(Ne(p,bt(I=>I===void 0)),!0);Nt(Ne(m,tn(I=>I!==void 0&&er(ks(b).sizeTree)),bt(I=>[{startIndex:0,endIndex:0,size:I}])),n);const j=is(Ne(n,hn(b),Ia(({sizes:I},[M,O])=>({changed:O!==I,sizes:O}),{changed:!1,sizes:y}),bt(I=>I.changed)));qn(Ne(l,Ia((I,M)=>({diff:I.prev-M,prev:M}),{diff:0,prev:0}),bt(I=>I.diff)),I=>{const{groupIndices:M}=ks(b);if(I>0)dn(t,!0),dn(s,I+e_(I,M));else if(I<0){const O=ks(C);O.length>0&&(I-=e_(-I,O)),dn(i,I)}}),qn(Ne(l,hn(e)),([I,M])=>{I<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:l},ls.ERROR)});const _=is(s);Nt(Ne(s,hn(b),bt(([I,M])=>{const O=M.groupIndices.length>0,A=[],D=M.lastSize;if(O){const R=of(M.sizeTree,0);let N=0,Y=0;for(;N{let G=Q.ranges;return Q.prevSize!==0&&(G=[...Q.ranges,{startIndex:Q.prevIndex,endIndex:q+I-1,size:Q.prevSize}]),{ranges:G,prevIndex:q+I,prevSize:z}},{ranges:A,prevIndex:I,prevSize:0}).ranges}return Ol(M.sizeTree).reduce((R,{k:N,v:Y})=>({ranges:[...R.ranges,{startIndex:R.prevIndex,endIndex:N+I-1,size:R.prevSize}],prevIndex:N+I,prevSize:Y}),{ranges:[],prevIndex:0,prevSize:D}).ranges})),n);const P=is(Ne(i,hn(b,x),bt(([I,{offsetTree:M},O])=>{const A=-I;return sf(A,M,O)})));return Nt(Ne(i,hn(b,x),bt(([I,M,O])=>{if(M.groupIndices.length>0){if(er(M.sizeTree))return M;let D=uu();const R=ks(C);let N=0,Y=0,F=0;for(;N<-I;){F=R[Y];const Q=R[Y+1]-F-1;Y++,N+=Q+1}if(D=Ol(M.sizeTree).reduce((Q,{k:q,v:z})=>os(Q,Math.max(0,q+I),z),D),N!==-I){const Q=of(M.sizeTree,F);D=os(D,0,Q);const q=ca(M.sizeTree,-I+1)[1];D=os(D,1,q)}return{...M,sizeTree:D,...qx(M.offsetTree,0,D,O)}}else{const D=Ol(M.sizeTree).reduce((R,{k:N,v:Y})=>os(R,Math.max(0,N+I),Y),uu());return{...M,sizeTree:D,...qx(M.offsetTree,0,D,O)}}})),b),{data:g,totalCount:r,sizeRanges:n,groupIndices:u,defaultItemSize:m,fixedItemSize:p,unshiftWith:s,shiftWith:i,shiftWithOffset:P,beforeUnshiftWith:_,firstItemIndex:l,gap:x,sizes:b,listRefresh:j,statefulTotalCount:o,trackItemSizes:S,itemSize:h}},vr(ml,p2),{singleton:!0}),Lre=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||!Lre)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Wf=Vn(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:i,smoothScrollTargetReached:l,headerHeight:u,footerHeight:p,fixedHeaderHeight:m,fixedFooterHeight:h},{log:g}])=>{const x=Mn(),y=at(0);let b=null,C=null,S=null;function j(){b&&(b(),b=null),S&&(S(),S=null),C&&(clearTimeout(C),C=null),dn(o,!1)}return Nt(Ne(x,hn(e,s,t,y,u,p,g),hn(r,m,h),bt(([[_,P,I,M,O,A,D,R],N,Y,F])=>{const V=o8(_),{align:Q,behavior:q,offset:z}=V,G=M-1,T=n8(V,P,G);let B=sf(T,P.offsetTree,N)+A;Q==="end"?(B+=Y+ca(P.sizeTree,T)[1]-I+F,T===G&&(B+=D)):Q==="center"?B+=(Y+ca(P.sizeTree,T)[1]-I+F)/2:B-=O,z&&(B+=z);const X=re=>{j(),re?(R("retrying to scroll to",{location:_},ls.DEBUG),dn(x,_)):R("list did not change, scroll successful",{},ls.DEBUG)};if(j(),q==="smooth"){let re=!1;S=qn(n,le=>{re=re||le}),b=hi(l,()=>{X(re)})}else b=hi(Ne(n,zre(150)),X);return C=setTimeout(()=>{j()},1200),dn(o,!0),R("scrolling from index to",{index:T,top:B,behavior:q},ls.DEBUG),{top:B,behavior:q}})),i),{scrollToIndex:x,topListHeight:y}},vr(Va,Do,ml),{singleton:!0});function zre(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const af="up",Nd="down",Fre="none",Bre={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},Hre=0,Vf=Vn(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const i=at(!1),l=at(!0),u=Mn(),p=Mn(),m=at(4),h=at(Hre),g=Eo(Ne(Jj(Ne(en(t),Su(1),ei(!0)),Ne(en(t),Su(1),ei(!1),Yj(100))),mr()),!1),x=Eo(Ne(Jj(Ne(s,ei(!0)),Ne(s,ei(!1),Yj(200))),mr()),!1);Nt(Ne(to(en(t),en(h)),bt(([j,_])=>j<=_),mr()),l),Nt(Ne(l,qi(50)),p);const y=is(Ne(to(e,en(n),en(r),en(o),en(m)),Ia((j,[{scrollTop:_,scrollHeight:P},I,M,O,A])=>{const D=_+I-P>-A,R={viewportHeight:I,scrollTop:_,scrollHeight:P};if(D){let Y,F;return _>j.state.scrollTop?(Y="SCROLLED_DOWN",F=j.state.scrollTop-_):(Y="SIZE_DECREASED",F=j.state.scrollTop-_||j.scrollTopDelta),{atBottom:!0,state:R,atBottomBecause:Y,scrollTopDelta:F}}let N;return R.scrollHeight>j.state.scrollHeight?N="SIZE_INCREASED":Ij&&j.atBottom===_.atBottom))),b=Eo(Ne(e,Ia((j,{scrollTop:_,scrollHeight:P,viewportHeight:I})=>{if(KO(j.scrollHeight,P))return{scrollTop:_,scrollHeight:P,jump:0,changed:!1};{const M=P-(_+I)<1;return j.scrollTop!==_&&M?{scrollHeight:P,scrollTop:_,jump:j.scrollTop-_,changed:!0}:{scrollHeight:P,scrollTop:_,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),tn(j=>j.changed),bt(j=>j.jump)),0);Nt(Ne(y,bt(j=>j.atBottom)),i),Nt(Ne(i,qi(50)),u);const C=at(Nd);Nt(Ne(e,bt(({scrollTop:j})=>j),mr(),Ia((j,_)=>ks(x)?{direction:j.direction,prevScrollTop:_}:{direction:_j.direction)),C),Nt(Ne(e,qi(50),ei(Fre)),C);const S=at(0);return Nt(Ne(g,tn(j=>!j),ei(0)),S),Nt(Ne(t,qi(100),hn(g),tn(([j,_])=>!!_),Ia(([j,_],[P])=>[_,P],[0,0]),bt(([j,_])=>_-j)),S),{isScrolling:g,isAtTop:l,isAtBottom:i,atBottomState:y,atTopStateChange:p,atBottomStateChange:u,scrollDirection:C,atBottomThreshold:m,atTopThreshold:h,scrollVelocity:S,lastJumpDueToItemResize:b}},vr(Do)),hl=Vn(([{log:e}])=>{const t=at(!1),n=is(Ne(t,tn(r=>r),mr()));return qn(t,r=>{r&&ks(e)("props updated",{},ls.DEBUG)}),{propsReady:t,didMount:n}},vr(ml),{singleton:!0});function h2(e,t){e==0?t():requestAnimationFrame(()=>h2(e-1,t))}function g2(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Uf=Vn(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o},{didMount:s}])=>{const i=at(!0),l=at(0),u=at(!1);return Nt(Ne(s,hn(l),tn(([p,m])=>!!m),ei(!1)),i),qn(Ne(to(t,s),hn(i,e,n,u),tn(([[,p],m,{sizeTree:h},g,x])=>p&&(!er(h)||u2(g))&&!m&&!x),hn(l)),([,p])=>{dn(u,!0),h2(3,()=>{hi(r,()=>dn(i,!0)),dn(o,p)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:l}},vr(Va,Do,Wf,hl),{singleton:!0});function t_(e){return e?e==="smooth"?"smooth":"auto":!1}const Wre=(e,t)=>typeof e=="function"?t_(e(t)):t&&t_(e),Vre=Vn(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:i,didMount:l},{log:u},{scrollingInProgress:p}])=>{const m=at(!1),h=Mn();let g=null;function x(b){dn(o,{index:"LAST",align:"end",behavior:b})}qn(Ne(to(Ne(en(e),Su(1)),l),hn(en(m),n,s,p),bt(([[b,C],S,j,_,P])=>{let I=C&&_,M="auto";return I&&(M=Wre(S,j||P),I=I&&!!M),{totalCount:b,shouldFollow:I,followOutputBehavior:M}}),tn(({shouldFollow:b})=>b)),({totalCount:b,followOutputBehavior:C})=>{g&&(g(),g=null),g=hi(t,()=>{ks(u)("following output to ",{totalCount:b},ls.DEBUG),x(C),g=null})});function y(b){const C=hi(r,S=>{b&&!S.atBottom&&S.notAtBottomBecause==="SIZE_INCREASED"&&!g&&(ks(u)("scrolling to bottom due to increased size",{},ls.DEBUG),x("auto"))});setTimeout(C,100)}return qn(Ne(to(en(m),e,i),tn(([b,,C])=>b&&C),Ia(({value:b},[,C])=>({refreshed:b===C,value:C}),{refreshed:!1,value:0}),tn(({refreshed:b})=>b),hn(m,e)),([,b])=>{y(b!==!1)}),qn(h,()=>{y(ks(m)!==!1)}),qn(to(en(m),r),([b,C])=>{b&&!C.atBottom&&C.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&x("auto")}),{followOutput:m,autoscrollToBottom:h}},vr(Va,Vf,Wf,Uf,hl,ml,Do));function Ure(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const s8=Vn(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=Mn(),i=Mn(),l=is(Ne(s,bt(Ure)));return Nt(Ne(l,bt(u=>u.totalCount)),e),Nt(Ne(l,bt(u=>u.groupIndices)),t),Nt(Ne(to(r,n,o),tn(([u,p])=>a0(p)),bt(([u,p,m])=>ca(p.groupOffsetTree,Math.max(u-m,0),"v")[0]),mr(),bt(u=>[u])),i),{groupCounts:s,topItemsIndexes:i}},vr(Va,Do));function lf(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 Gh="top",qh="bottom",n_="none";function r_(e,t,n){return typeof e=="number"?n===af&&t===Gh||n===Nd&&t===qh?e:0:n===af?t===Gh?e.main:e.reverse:t===qh?e.main:e.reverse}function o_(e,t){return typeof e=="number"?e:e[t]||0}const v2=Vn(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=Mn(),i=at(0),l=at(0),u=at(0),p=Eo(Ne(to(en(e),en(t),en(r),en(s,lf),en(u),en(i),en(o),en(n),en(l)),bt(([m,h,g,[x,y],b,C,S,j,_])=>{const P=m-j,I=C+S,M=Math.max(g-P,0);let O=n_;const A=o_(_,Gh),D=o_(_,qh);return x-=j,x+=g+S,y+=g+S,y-=j,x>m+I-A&&(O=af),ym!=null),mr(lf)),[0,0]);return{listBoundary:s,overscan:u,topListHeight:i,increaseViewportBy:l,visibleRange:p}},vr(Do),{singleton:!0});function Gre(e,t,n){if(a0(t)){const r=r8(e,t);return[{index:ca(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 s_={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function a_(e,t,n){if(e.length===0)return[];if(!a0(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=s0(t.groupOffsetTree,r,o);let l,u=0;for(const p of e){(!l||l.end0){p=e[0].offset;const b=e[e.length-1];m=b.offset+b.size}const h=n-u,g=l+h*i+(h-1)*r,x=p,y=g-m;return{items:a_(e,o,s),topItems:a_(t,o,s),topListHeight:t.reduce((b,C)=>C.size+b,0),offsetTop:p,offsetBottom:y,top:x,bottom:m,totalCount:n,firstItemIndex:s}}const lc=Vn(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:i,listBoundary:l,topListHeight:u},{scrolledToInitialItem:p,initialTopMostItemIndex:m},{topListHeight:h},g,{didMount:x},{recalcInProgress:y}])=>{const b=at([]),C=Mn();Nt(s.topItemsIndexes,b);const S=Eo(Ne(to(x,y,en(i,lf),en(t),en(e),en(m),p,en(b),en(r),en(o),n),tn(([I,M,,O,,,,,,,A])=>{const D=A&&A.length!==O;return I&&!M&&!D}),bt(([,,[I,M],O,A,D,R,N,Y,F,V])=>{const Q=A,{sizeTree:q,offsetTree:z}=Q;if(O===0||I===0&&M===0)return{...s_,totalCount:O};if(er(q))return Mm(Gre(g2(D,O),Q,V),[],O,F,Q,Y);const G=[];if(N.length>0){const le=N[0],se=N[N.length-1];let K=0;for(const U of s0(q,le,se)){const ee=U.value,de=Math.max(U.start,le),Z=Math.min(U.end,se);for(let ue=de;ue<=Z;ue++)G.push({index:ue,size:ee,offset:K,data:V&&V[ue]}),K+=ee}}if(!R)return Mm([],G,O,F,Q,Y);const T=N.length>0?N[N.length-1]+1:0,B=Are(z,I,M,T);if(B.length===0)return null;const X=O-1,re=o0([],le=>{for(const se of B){const K=se.value;let U=K.offset,ee=se.start;const de=K.size;if(K.offset=M);ue++)le.push({index:ue,size:de,offset:U,data:V&&V[ue]}),U+=de+F}});return Mm(re,G,O,F,Q,Y)}),tn(I=>I!==null),mr()),s_);Nt(Ne(n,tn(u2),bt(I=>I==null?void 0:I.length)),t),Nt(Ne(S,bt(I=>I.topListHeight)),h),Nt(h,u),Nt(Ne(S,bt(I=>[I.top,I.bottom])),l),Nt(Ne(S,bt(I=>I.items)),C);const j=is(Ne(S,tn(({items:I})=>I.length>0),hn(t,n),tn(([{items:I},M])=>I[I.length-1].originalIndex===M-1),bt(([,I,M])=>[I-1,M]),mr(lf),bt(([I])=>I))),_=is(Ne(S,qi(200),tn(({items:I,topItems:M})=>I.length>0&&I[0].originalIndex===M.length),bt(({items:I})=>I[0].index),mr())),P=is(Ne(S,tn(({items:I})=>I.length>0),bt(({items:I})=>{let M=0,O=I.length-1;for(;I[M].type==="group"&&MM;)O--;return{startIndex:I[M].index,endIndex:I[O].index}}),mr(a8)));return{listState:S,topItemsIndexes:b,endReached:j,startReached:_,rangeChanged:P,itemsRendered:C,...g}},vr(Va,s8,v2,Uf,Wf,Vf,hl,p2),{singleton:!0}),qre=Vn(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{listState:s},{didMount:i}])=>{const l=at(0);return Nt(Ne(i,hn(l),tn(([,u])=>u!==0),hn(o,e,t,r,n),bt(([[,u],p,m,h,g,x=[]])=>{let y=0;if(m.groupIndices.length>0)for(const j of m.groupIndices){if(j-y>=u)break;y++}const b=u+y,C=g2(p,b),S=Array.from({length:b}).map((j,_)=>({index:_+C,size:0,offset:0,data:x[_+C]}));return Mm(S,[],b,g,m,h)})),s),{initialItemCount:l}},vr(Va,Uf,lc,hl),{singleton:!0}),i8=Vn(([{scrollVelocity:e}])=>{const t=at(!1),n=Mn(),r=at(!1);return Nt(Ne(e,hn(r,t,n),tn(([o,s])=>!!s),bt(([o,s,i,l])=>{const{exit:u,enter:p}=s;if(i){if(u(o,l))return!1}else if(p(o,l))return!0;return i}),mr()),t),qn(Ne(to(t,e,n),hn(r)),([[o,s,i],l])=>o&&l&&l.change&&l.change(s,i)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},vr(Vf),{singleton:!0}),Kre=Vn(([{topItemsIndexes:e}])=>{const t=at(0);return Nt(Ne(t,tn(n=>n>0),bt(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},vr(lc)),l8=Vn(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=Mn(),i=Eo(Ne(to(e,r,t,n,o),bt(([l,u,p,m,h])=>l+u+p+m+h.offsetBottom+h.bottom)),0);return Nt(en(i),s),{totalListHeight:i,totalListHeightChanged:s}},vr(Do,lc),{singleton:!0});function c8(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const Qre=c8(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Xre=Vn(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:i,lastJumpDueToItemResize:l},{listState:u},{beforeUnshiftWith:p,shiftWithOffset:m,sizes:h,gap:g},{log:x},{recalcInProgress:y}])=>{const b=is(Ne(u,hn(l),Ia(([,S,j,_],[{items:P,totalCount:I,bottom:M,offsetBottom:O},A])=>{const D=M+O;let R=0;return j===I&&S.length>0&&P.length>0&&(P[0].originalIndex===0&&S[0].originalIndex===0||(R=D-_,R!==0&&(R+=A))),[R,P,I,D]},[0,[],0,0]),tn(([S])=>S!==0),hn(t,i,r,s,x,y),tn(([,S,j,_,,,P])=>!P&&!_&&S!==0&&j===af),bt(([[S],,,,,j])=>(j("Upward scrolling compensation",{amount:S},ls.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(Ne(b,hn(n,o)),([S,j,_])=>{_&&Qre()?dn(n,j-S):C(-S)}),qn(Ne(to(Eo(o,!1),n,y),tn(([S,j,_])=>!S&&!_&&j!==0),bt(([S,j])=>j),qi(1)),C),Nt(Ne(m,bt(S=>({top:-S}))),e),qn(Ne(p,hn(h,g),bt(([S,{lastSize:j,groupIndices:_,sizeTree:P},I])=>{function M(O){return O*(j+I)}if(_.length===0)return M(S);{let O=0;const A=of(P,0);let D=0,R=0;for(;DS&&(O-=A,N=S-D+1),D+=N,O+=M(N),R++}return O}})),S=>{dn(n,S),requestAnimationFrame(()=>{dn(e,{top:S}),requestAnimationFrame(()=>{dn(n,0),dn(y,!1)})})}),{deviation:n}},vr(Do,Vf,lc,Va,ml,p2)),Yre=Vn(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=at(0);return qn(Ne(e,hn(r),tn(([,o])=>o!==0),bt(([,o])=>({top:o}))),o=>{hi(Ne(n,Su(1),tn(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{dn(t,o)})})}),{initialScrollTop:r}},vr(hl,Do,lc),{singleton:!0}),Jre=Vn(([{viewportHeight:e},{totalListHeight:t}])=>{const n=at(!1),r=Eo(Ne(to(n,e,t),tn(([o])=>o),bt(([,o,s])=>Math.max(0,o-s)),qi(0),mr()),0);return{alignToBottom:n,paddingTopAddition:r}},vr(Do,l8),{singleton:!0}),x2=Vn(([{scrollTo:e,scrollContainerState:t}])=>{const n=Mn(),r=Mn(),o=Mn(),s=at(!1),i=at(void 0);return Nt(Ne(to(n,r),bt(([{viewportHeight:l,scrollTop:u,scrollHeight:p},{offsetTop:m}])=>({scrollTop:Math.max(0,u-m),scrollHeight:p,viewportHeight:l}))),t),Nt(Ne(e,hn(r),bt(([l,{offsetTop:u}])=>({...l,top:l.top+u}))),o),{useWindowScroll:s,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},vr(Do)),Zre=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...i}})=>er?{...i,behavior:o,align:s??"end"}:null,eoe=Vn(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:i,fixedFooterHeight:l,scrollingInProgress:u},{scrollToIndex:p}])=>{const m=Mn();return Nt(Ne(m,hn(e,o,t,s,i,l,r),hn(n),bt(([[h,g,x,y,b,C,S,j],_])=>{const{done:P,behavior:I,align:M,calculateViewLocation:O=Zre,...A}=h,D=n8(h,g,y-1),R=sf(D,g.offsetTree,_)+b+C,N=R+ca(g.sizeTree,D)[1],Y=j+C,F=j+x-S,V=O({itemTop:R,itemBottom:N,viewportTop:Y,viewportBottom:F,locationParams:{behavior:I,align:M,...A}});return V?P&&hi(Ne(u,tn(Q=>Q===!1),Su(ks(u)?1:2)),P):P&&P(),V}),tn(h=>h!==null)),p),{scrollIntoView:m}},vr(Va,Do,Wf,lc,ml),{singleton:!0}),toe=Vn(([{sizes:e,sizeRanges:t},{scrollTop:n},{initialTopMostItemIndex:r},{didMount:o},{useWindowScroll:s,windowScrollContainerState:i,windowViewportRect:l}])=>{const u=Mn(),p=at(void 0),m=at(null),h=at(null);return Nt(i,m),Nt(l,h),qn(Ne(u,hn(e,n,s,m,h)),([g,x,y,b,C,S])=>{const j=Nre(x.sizeTree);b&&C!==null&&S!==null&&(y=C.scrollTop-S.offsetTop),g({ranges:j,scrollTop:y})}),Nt(Ne(p,tn(u2),bt(noe)),r),Nt(Ne(o,hn(p),tn(([,g])=>g!==void 0),mr(),bt(([,g])=>g.ranges)),t),{getState:u,restoreStateFrom:p}},vr(Va,Do,Uf,hl,x2));function noe(e){return{offset:e.scrollTop,index:0,align:"start"}}const roe=Vn(([e,t,n,r,o,s,i,l,u,p])=>({...e,...t,...n,...r,...o,...s,...i,...l,...u,...p}),vr(v2,qre,hl,i8,l8,Yre,Jre,x2,eoe,ml)),ooe=Vn(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:i,firstItemIndex:l,groupIndices:u,statefulTotalCount:p,gap:m,sizes:h},{initialTopMostItemIndex:g,scrolledToInitialItem:x},y,b,C,{listState:S,topItemsIndexes:j,..._},{scrollToIndex:P},I,{topItemCount:M},{groupCounts:O},A])=>(Nt(_.rangeChanged,A.scrollSeekRangeChanged),Nt(Ne(A.windowViewportRect,bt(D=>D.visibleHeight)),y.viewportHeight),{totalCount:e,data:i,firstItemIndex:l,sizeRanges:t,initialTopMostItemIndex:g,scrolledToInitialItem:x,topItemsIndexes:j,topItemCount:M,groupCounts:O,fixedItemHeight:n,defaultItemHeight:r,gap:m,...C,statefulTotalCount:p,listState:S,scrollToIndex:P,trackItemSizes:o,itemSize:s,groupIndices:u,..._,...A,...y,sizes:h,...b}),vr(Va,Uf,Do,toe,Vre,lc,Wf,Xre,Kre,s8,roe)),v1="-webkit-sticky",i_="sticky",u8=c8(()=>{if(typeof document>"u")return i_;const e=document.createElement("div");return e.style.position=v1,e.style.position===v1?v1:i_});function d8(e,t){const n=H.useRef(null),r=H.useCallback(l=>{if(l===null||!l.offsetParent)return;const u=l.getBoundingClientRect(),p=u.width;let m,h;if(t){const g=t.getBoundingClientRect(),x=u.top-g.top;m=g.height-Math.max(0,x),h=x+t.scrollTop}else m=window.innerHeight-Math.max(0,u.top),h=u.top+window.pageYOffset;n.current={offsetTop:h,visibleHeight:m,visibleWidth:p},e(n.current)},[e,t]),{callbackRef:o,ref:s}=f2(r),i=H.useCallback(()=>{r(s.current)},[r,s]);return H.useEffect(()=>{if(t){t.addEventListener("scroll",i);const l=new ResizeObserver(i);return l.observe(t),()=>{t.removeEventListener("scroll",i),l.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=H.createContext(void 0),p8=H.createContext(void 0);function m8(e){return e}const soe=Vn(()=>{const e=at(u=>`Item ${u}`),t=at(null),n=at(u=>`Group ${u}`),r=at({}),o=at(m8),s=at("div"),i=at(Bu),l=(u,p=null)=>Eo(Ne(r,bt(m=>m[u]),mr()),p);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:s,scrollerRef:i,FooterComponent:l("Footer"),HeaderComponent:l("Header"),TopItemListComponent:l("TopItemList"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),GroupComponent:l("Group","div"),ScrollerComponent:l("Scroller","div"),EmptyPlaceholder:l("EmptyPlaceholder"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder")}}),aoe=Vn(([e,t])=>({...e,...t}),vr(ooe,soe)),ioe=({height:e})=>H.createElement("div",{style:{height:e}}),loe={position:u8(),zIndex:1,overflowAnchor:"none"},coe={overflowAnchor:"none"},l_=H.memo(function({showTopList:t=!1}){const n=kn("listState"),r=js("sizeRanges"),o=kn("useWindowScroll"),s=kn("customScrollParent"),i=js("windowScrollContainerState"),l=js("scrollContainerState"),u=s||o?i:l,p=kn("itemContent"),m=kn("context"),h=kn("groupContent"),g=kn("trackItemSizes"),x=kn("itemSize"),y=kn("log"),b=js("gap"),{callbackRef:C}=Sre(r,x,g,t?Bu:u,y,b,s),[S,j]=H.useState(0);b2("deviation",V=>{S!==V&&j(V)});const _=kn("EmptyPlaceholder"),P=kn("ScrollSeekPlaceholder")||ioe,I=kn("ListComponent"),M=kn("ItemComponent"),O=kn("GroupComponent"),A=kn("computeItemKey"),D=kn("isSeeking"),R=kn("groupIndices").length>0,N=kn("paddingTopAddition"),Y=kn("scrolledToInitialItem"),F=t?{}:{boxSizing:"border-box",paddingTop:n.offsetTop+N,paddingBottom:n.offsetBottom,marginTop:S,...Y?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&_?H.createElement(_,Bo(_,m)):H.createElement(I,{...Bo(I,m),ref:C,style:F,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?n.topItems:n.items).map(V=>{const Q=V.originalIndex,q=A(Q+n.firstItemIndex,V.data,m);return D?H.createElement(P,{...Bo(P,m),key:q,index:V.index,height:V.size,type:V.type||"item",...V.type==="group"?{}:{groupIndex:V.groupIndex}}):V.type==="group"?H.createElement(O,{...Bo(O,m),key:q,"data-index":Q,"data-known-size":V.size,"data-item-index":V.index,style:loe},h(V.index,m)):H.createElement(M,{...Bo(M,m),key:q,"data-index":Q,"data-known-size":V.size,"data-item-index":V.index,"data-item-group-index":V.groupIndex,item:V.data,style:coe},R?p(V.index,V.groupIndex,V.data,m):p(V.index,V.data,m))}))}),uoe={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},i0={width:"100%",height:"100%",position:"absolute",top:0},doe={width:"100%",position:u8(),top:0,zIndex:1};function Bo(e,t){if(typeof e!="string")return{context:t}}const foe=H.memo(function(){const t=kn("HeaderComponent"),n=js("headerHeight"),r=kn("headerFooterTag"),o=ic(i=>n(sl(i,"height"))),s=kn("context");return t?H.createElement(r,{ref:o},H.createElement(t,Bo(t,s))):null}),poe=H.memo(function(){const t=kn("FooterComponent"),n=js("footerHeight"),r=kn("headerFooterTag"),o=ic(i=>n(sl(i,"height"))),s=kn("context");return t?H.createElement(r,{ref:o},H.createElement(t,Bo(t,s))):null});function h8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return H.memo(function({style:s,children:i,...l}){const u=e("scrollContainerState"),p=n("ScrollerComponent"),m=e("smoothScrollTargetReached"),h=n("scrollerRef"),g=n("context"),{scrollerRef:x,scrollByCallback:y,scrollToCallback:b}=QO(u,m,p,h);return t("scrollTo",b),t("scrollBy",y),H.createElement(p,{ref:x,style:{...uoe,...s},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...l,...Bo(p,g)},i)})}function g8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return H.memo(function({style:s,children:i,...l}){const u=e("windowScrollContainerState"),p=n("ScrollerComponent"),m=e("smoothScrollTargetReached"),h=n("totalListHeight"),g=n("deviation"),x=n("customScrollParent"),y=n("context"),{scrollerRef:b,scrollByCallback:C,scrollToCallback:S}=QO(u,m,p,Bu,x);return yre(()=>(b.current=x||window,()=>{b.current=null}),[b,x]),t("windowScrollTo",S),t("scrollBy",C),H.createElement(p,{style:{position:"relative",...s,...h!==0?{height:h+g}:{}},"data-virtuoso-scroller":!0,...l,...Bo(p,y)},i)})}const moe=({children:e})=>{const t=H.useContext(f8),n=js("viewportHeight"),r=js("fixedItemHeight"),o=ic(VO(n,s=>sl(s,"height")));return H.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),H.createElement("div",{style:i0,ref:o,"data-viewport-type":"element"},e)},hoe=({children:e})=>{const t=H.useContext(f8),n=js("windowViewportRect"),r=js("fixedItemHeight"),o=kn("customScrollParent"),s=d8(n,o);return H.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),H.createElement("div",{ref:s,style:i0,"data-viewport-type":"window"},e)},goe=({children:e})=>{const t=kn("TopItemListComponent"),n=kn("headerHeight"),r={...doe,marginTop:`${n}px`},o=kn("context");return H.createElement(t||"div",{style:r,context:o},e)},voe=H.memo(function(t){const n=kn("useWindowScroll"),r=kn("topItemsIndexes").length>0,o=kn("customScrollParent"),s=o||n?yoe:boe,i=o||n?hoe:moe;return H.createElement(s,{...t},r&&H.createElement(goe,null,H.createElement(l_,{showTopList:!0})),H.createElement(i,null,H.createElement(foe,null),H.createElement(l_,null),H.createElement(poe,null)))}),{Component:xoe,usePublisher:js,useEmitterValue:kn,useEmitter:b2}=qO(aoe,{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"}},voe),boe=h8({usePublisher:js,useEmitterValue:kn,useEmitter:b2}),yoe=g8({usePublisher:js,useEmitterValue:kn,useEmitter:b2}),Coe=xoe,c_={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},woe={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:u_,ceil:d_,floor:Kh,min:x1,max:$d}=Math;function Soe(e){return{...woe,items:e}}function f_(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 koe(e,t){return e&&e.column===t.column&&e.row===t.row}function fm(e,t){return e&&e.width===t.width&&e.height===t.height}const joe=Vn(([{overscan:e,visibleRange:t,listBoundary:n},{scrollTop:r,viewportHeight:o,scrollBy:s,scrollTo:i,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:p,headerHeight:m},h,g,{propsReady:x,didMount:y},{windowViewportRect:b,useWindowScroll:C,customScrollParent:S,windowScrollContainerState:j,windowScrollTo:_},P])=>{const I=at(0),M=at(0),O=at(c_),A=at({height:0,width:0}),D=at({height:0,width:0}),R=Mn(),N=Mn(),Y=at(0),F=at(null),V=at({row:0,column:0}),Q=Mn(),q=Mn(),z=at(!1),G=at(0),T=at(!0),B=at(!1);qn(Ne(y,hn(G),tn(([U,ee])=>!!ee)),()=>{dn(T,!1),dn(M,0)}),qn(Ne(to(y,T,D,A,G,B),tn(([U,ee,de,Z,,ue])=>U&&!ee&&de.height!==0&&Z.height!==0&&!ue)),([,,,,U])=>{dn(B,!0),h2(1,()=>{dn(R,U)}),hi(Ne(r),()=>{dn(n,[0,0]),dn(T,!0)})}),Nt(Ne(q,tn(U=>U!=null&&U.scrollTop>0),ei(0)),M),qn(Ne(y,hn(q),tn(([,U])=>U!=null)),([,U])=>{U&&(dn(A,U.viewport),dn(D,U==null?void 0:U.item),dn(V,U.gap),U.scrollTop>0&&(dn(z,!0),hi(Ne(r,Su(1)),ee=>{dn(z,!1)}),dn(i,{top:U.scrollTop})))}),Nt(Ne(A,bt(({height:U})=>U)),o),Nt(Ne(to(en(A,fm),en(D,fm),en(V,(U,ee)=>U&&U.column===ee.column&&U.row===ee.row),en(r)),bt(([U,ee,de,Z])=>({viewport:U,item:ee,gap:de,scrollTop:Z}))),Q),Nt(Ne(to(en(I),t,en(V,koe),en(D,fm),en(A,fm),en(F),en(M),en(z),en(T),en(G)),tn(([,,,,,,,U])=>!U),bt(([U,[ee,de],Z,ue,fe,ge,_e,,ye,pe])=>{const{row:Te,column:Ae}=Z,{height:qe,width:Pt}=ue,{width:tt}=fe;if(_e===0&&(U===0||tt===0))return c_;if(Pt===0){const Ft=g2(pe,U),Wt=Ft===0?Math.max(_e-1,0):Ft;return Soe(f_(Ft,Wt,ge))}const sn=v8(tt,Pt,Ae);let mt,ct;ye?ee===0&&de===0&&_e>0?(mt=0,ct=_e-1):(mt=sn*Kh((ee+Te)/(qe+Te)),ct=sn*d_((de+Te)/(qe+Te))-1,ct=x1(U-1,$d(ct,sn-1)),mt=x1(ct,$d(0,mt))):(mt=0,ct=-1);const be=f_(mt,ct,ge),{top:We,bottom:Rt}=p_(fe,Z,ue,be),Ut=d_(U/sn),Ct=Ut*qe+(Ut-1)*Te-Rt;return{items:be,offsetTop:We,offsetBottom:Ct,top:We,bottom:Rt,itemHeight:qe,itemWidth:Pt}})),O),Nt(Ne(F,tn(U=>U!==null),bt(U=>U.length)),I),Nt(Ne(to(A,D,O,V),tn(([U,ee,{items:de}])=>de.length>0&&ee.height!==0&&U.height!==0),bt(([U,ee,{items:de},Z])=>{const{top:ue,bottom:fe}=p_(U,Z,ee,de);return[ue,fe]}),mr(lf)),n);const X=at(!1);Nt(Ne(r,hn(X),bt(([U,ee])=>ee||U!==0)),X);const re=is(Ne(en(O),tn(({items:U})=>U.length>0),hn(I,X),tn(([{items:U},ee,de])=>de&&U[U.length-1].index===ee-1),bt(([,U])=>U-1),mr())),le=is(Ne(en(O),tn(({items:U})=>U.length>0&&U[0].index===0),ei(0),mr())),se=is(Ne(en(O),hn(z),tn(([{items:U},ee])=>U.length>0&&!ee),bt(([{items:U}])=>({startIndex:U[0].index,endIndex:U[U.length-1].index})),mr(a8),qi(0)));Nt(se,g.scrollSeekRangeChanged),Nt(Ne(R,hn(A,D,I,V),bt(([U,ee,de,Z,ue])=>{const fe=o8(U),{align:ge,behavior:_e,offset:ye}=fe;let pe=fe.index;pe==="LAST"&&(pe=Z-1),pe=$d(0,pe,x1(Z-1,pe));let Te=Kx(ee,ue,de,pe);return ge==="end"?Te=u_(Te-ee.height+de.height):ge==="center"&&(Te=u_(Te-ee.height/2+de.height/2)),ye&&(Te+=ye),{top:Te,behavior:_e}})),i);const K=Eo(Ne(O,bt(U=>U.offsetBottom+U.bottom)),0);return Nt(Ne(b,bt(U=>({width:U.visibleWidth,height:U.visibleHeight}))),A),{data:F,totalCount:I,viewportDimensions:A,itemDimensions:D,scrollTop:r,scrollHeight:N,overscan:e,scrollBy:s,scrollTo:i,scrollToIndex:R,smoothScrollTargetReached:l,windowViewportRect:b,windowScrollTo:_,useWindowScroll:C,customScrollParent:S,windowScrollContainerState:j,deviation:Y,scrollContainerState:u,footerHeight:p,headerHeight:m,initialItemCount:M,gap:V,restoreStateFrom:q,...g,initialTopMostItemIndex:G,gridState:O,totalListHeight:K,...h,startReached:le,endReached:re,rangeChanged:se,stateChanged:Q,propsReady:x,stateRestoreInProgress:z,...P}},vr(v2,Do,Vf,i8,hl,x2,ml));function p_(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=Kx(e,t,n,r[0].index),i=Kx(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:i}}function Kx(e,t,n,r){const o=v8(e.width,n.width,t.column),s=Kh(r/o),i=s*n.height+$d(0,s-1)*t.row;return i>0?i+t.row:i}function v8(e,t,n){return $d(1,Kh((e+n)/(Kh(t)+n)))}const _oe=Vn(()=>{const e=at(p=>`Item ${p}`),t=at({}),n=at(null),r=at("virtuoso-grid-item"),o=at("virtuoso-grid-list"),s=at(m8),i=at("div"),l=at(Bu),u=(p,m=null)=>Eo(Ne(t,bt(h=>h[p]),mr()),m);return{context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:i,scrollerRef:l,FooterComponent:u("Footer"),HeaderComponent:u("Header"),ListComponent:u("List","div"),ItemComponent:u("Item","div"),ScrollerComponent:u("Scroller","div"),ScrollSeekPlaceholder:u("ScrollSeekPlaceholder","div")}}),Ioe=Vn(([e,t])=>({...e,...t}),vr(joe,_oe)),Poe=H.memo(function(){const t=wr("gridState"),n=wr("listClassName"),r=wr("itemClassName"),o=wr("itemContent"),s=wr("computeItemKey"),i=wr("isSeeking"),l=ta("scrollHeight"),u=wr("ItemComponent"),p=wr("ListComponent"),m=wr("ScrollSeekPlaceholder"),h=wr("context"),g=ta("itemDimensions"),x=ta("gap"),y=wr("log"),b=wr("stateRestoreInProgress"),C=ic(S=>{const j=S.parentElement.parentElement.scrollHeight;l(j);const _=S.firstChild;if(_){const{width:P,height:I}=_.getBoundingClientRect();g({width:P,height:I})}x({row:m_("row-gap",getComputedStyle(S).rowGap,y),column:m_("column-gap",getComputedStyle(S).columnGap,y)})});return b?null:H.createElement(p,{ref:C,className:n,...Bo(p,h),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map(S=>{const j=s(S.index,S.data,h);return i?H.createElement(m,{key:j,...Bo(m,h),index:S.index,height:t.itemHeight,width:t.itemWidth}):H.createElement(u,{...Bo(u,h),className:r,"data-index":S.index,key:j},o(S.index,S.data,h))}))}),Eoe=H.memo(function(){const t=wr("HeaderComponent"),n=ta("headerHeight"),r=wr("headerFooterTag"),o=ic(i=>n(sl(i,"height"))),s=wr("context");return t?H.createElement(r,{ref:o},H.createElement(t,Bo(t,s))):null}),Moe=H.memo(function(){const t=wr("FooterComponent"),n=ta("footerHeight"),r=wr("headerFooterTag"),o=ic(i=>n(sl(i,"height"))),s=wr("context");return t?H.createElement(r,{ref:o},H.createElement(t,Bo(t,s))):null}),Ooe=({children:e})=>{const t=H.useContext(p8),n=ta("itemDimensions"),r=ta("viewportDimensions"),o=ic(s=>{r(s.getBoundingClientRect())});return H.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),H.createElement("div",{style:i0,ref:o},e)},Roe=({children:e})=>{const t=H.useContext(p8),n=ta("windowViewportRect"),r=ta("itemDimensions"),o=wr("customScrollParent"),s=d8(n,o);return H.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),H.createElement("div",{ref:s,style:i0},e)},Aoe=H.memo(function({...t}){const n=wr("useWindowScroll"),r=wr("customScrollParent"),o=r||n?Noe:Toe,s=r||n?Roe:Ooe;return H.createElement(o,{...t},H.createElement(s,null,H.createElement(Eoe,null),H.createElement(Poe,null),H.createElement(Moe,null)))}),{Component:Doe,usePublisher:ta,useEmitterValue:wr,useEmitter:x8}=qO(Ioe,{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"}},Aoe),Toe=h8({usePublisher:ta,useEmitterValue:wr,useEmitter:x8}),Noe=g8({usePublisher:ta,useEmitterValue:wr,useEmitter:x8});function m_(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,ls.WARN),t==="normal"?0:parseInt(t??"0",10)}const $oe=Doe,Loe=e=>{const t=W(s=>s.gallery.galleryView),{data:n}=bb(e),{data:r}=yb(e),o=d.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}},zoe=({imageDTO:e})=>a.jsx($,{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]})}),Foe=d.memo(zoe),y2=({postUploadAction:e,isDisabled:t})=>{const n=W(u=>u.gallery.autoAddBoardId),[r]=_I(),o=d.useCallback(u=>{const p=u[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:l}=Iy({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},onDropAccepted:o,disabled:t,noDrag:!0,multiple:!1});return{getUploadButtonProps:s,getUploadInputProps:i,openUploader:l}},Boe=ce(we,({generation:e})=>e.model,je),l0=()=>{const e=te(),t=oc(),{t:n}=J(),r=W(Boe),o=d.useCallback(()=>{t({title:n("toast.parameterSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),s=d.useCallback(T=>{t({title:n("toast.parameterNotSet"),description:T,status:"warning",duration:2500,isClosable:!0})},[n,t]),i=d.useCallback(()=>{t({title:n("toast.parametersSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),l=d.useCallback(T=>{t({title:n("toast.parametersNotSet"),status:"warning",description:T,duration:2500,isClosable:!0})},[n,t]),u=d.useCallback((T,B,X,re)=>{if(Mp(T)||Op(B)||dd(X)||kv(re)){Mp(T)&&e(Md(T)),Op(B)&&e(Od(B)),dd(X)&&e(Rd(X)),dd(re)&&e(Ad(re)),o();return}s()},[e,o,s]),p=d.useCallback(T=>{if(!Mp(T)){s();return}e(Md(T)),o()},[e,o,s]),m=d.useCallback(T=>{if(!Op(T)){s();return}e(Od(T)),o()},[e,o,s]),h=d.useCallback(T=>{if(!dd(T)){s();return}e(Rd(T)),o()},[e,o,s]),g=d.useCallback(T=>{if(!kv(T)){s();return}e(Ad(T)),o()},[e,o,s]),x=d.useCallback(T=>{if(!Aw(T)){s();return}e(Am(T)),o()},[e,o,s]),y=d.useCallback(T=>{if(!jv(T)){s();return}e(Dm(T)),o()},[e,o,s]),b=d.useCallback(T=>{if(!Dw(T)){s();return}e(N1(T)),o()},[e,o,s]),C=d.useCallback(T=>{if(!_v(T)){s();return}e($1(T)),o()},[e,o,s]),S=d.useCallback(T=>{if(!Iv(T)){s();return}e(Tm(T)),o()},[e,o,s]),j=d.useCallback(T=>{if(!Tw(T)){s();return}e(Bl(T)),o()},[e,o,s]),_=d.useCallback(T=>{if(!Nw(T)){s();return}e(Hl(T)),o()},[e,o,s]),P=d.useCallback(T=>{if(!$w(T)){s();return}e(Nm(T)),o()},[e,o,s]),{data:I}=gf(void 0),M=d.useCallback(T=>{if(!NI(T.lora))return{lora:null,error:"Invalid LoRA model"};const{base_model:B,model_name:X}=T.lora,re=I?t7.getSelectors().selectById(I,`${B}/lora/${X}`):void 0;return re?(re==null?void 0:re.base_model)===(r==null?void 0:r.base_model)?{lora:re,error:null}:{lora:null,error:"LoRA incompatible with currently-selected model"}:{lora:null,error:"LoRA model is not installed"}},[I,r==null?void 0:r.base_model]),O=d.useCallback(T=>{const B=M(T);if(!B.lora){s(B.error);return}e(Lw({...B.lora,weight:T.weight})),o()},[M,e,o,s]),{data:A}=Cb(void 0),D=d.useCallback(T=>{if(!$m(T.control_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:B,control_model:X,control_weight:re,begin_step_percent:le,end_step_percent:se,control_mode:K,resize_mode:U}=T,ee=A?$I.getSelectors().selectById(A,`${X.base_model}/controlnet/${X.model_name}`):void 0;if(!ee)return{controlnet:null,error:"ControlNet model is not installed"};if(!((ee==null?void 0:ee.base_model)===(r==null?void 0:r.base_model)))return{controlnet:null,error:"ControlNet incompatible with currently-selected model"};const Z="none",ue=Oo.none.default;return{controlnet:{type:"controlnet",isEnabled:!0,model:ee,weight:typeof re=="number"?re:fd.weight,beginStepPct:le||fd.beginStepPct,endStepPct:se||fd.endStepPct,controlMode:K||fd.controlMode,resizeMode:U||fd.resizeMode,controlImage:(B==null?void 0:B.image_name)||null,processedControlImage:(B==null?void 0:B.image_name)||null,processorType:Z,processorNode:ue,shouldAutoConfig:!0,id:oi()},error:null}},[A,r==null?void 0:r.base_model]),R=d.useCallback(T=>{const B=D(T);if(!B.controlnet){s(B.error);return}e(Sc(B.controlnet)),o()},[D,e,o,s]),{data:N}=wb(void 0),Y=d.useCallback(T=>{if(!$m(T.t2i_adapter_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:B,t2i_adapter_model:X,weight:re,begin_step_percent:le,end_step_percent:se,resize_mode:K}=T,U=N?LI.getSelectors().selectById(N,`${X.base_model}/t2i_adapter/${X.model_name}`):void 0;if(!U)return{controlnet:null,error:"ControlNet model is not installed"};if(!((U==null?void 0:U.base_model)===(r==null?void 0:r.base_model)))return{t2iAdapter:null,error:"ControlNet incompatible with currently-selected model"};const de="none",Z=Oo.none.default;return{t2iAdapter:{type:"t2i_adapter",isEnabled:!0,model:U,weight:typeof re=="number"?re:Rp.weight,beginStepPct:le||Rp.beginStepPct,endStepPct:se||Rp.endStepPct,resizeMode:K||Rp.resizeMode,controlImage:(B==null?void 0:B.image_name)||null,processedControlImage:(B==null?void 0:B.image_name)||null,processorType:de,processorNode:Z,shouldAutoConfig:!0,id:oi()},error:null}},[r==null?void 0:r.base_model,N]),F=d.useCallback(T=>{const B=Y(T);if(!B.t2iAdapter){s(B.error);return}e(Sc(B.t2iAdapter)),o()},[Y,e,o,s]),{data:V}=Sb(void 0),Q=d.useCallback(T=>{if(!n7(T==null?void 0:T.ip_adapter_model))return{ipAdapter:null,error:"Invalid IP Adapter model"};const{image:B,ip_adapter_model:X,weight:re,begin_step_percent:le,end_step_percent:se}=T,K=V?zI.getSelectors().selectById(V,`${X.base_model}/ip_adapter/${X.model_name}`):void 0;return K?(K==null?void 0:K.base_model)===(r==null?void 0:r.base_model)?{ipAdapter:{id:oi(),type:"ip_adapter",isEnabled:!0,controlImage:(B==null?void 0:B.image_name)??null,model:K,weight:re??Pv.weight,beginStepPct:le??Pv.beginStepPct,endStepPct:se??Pv.endStepPct},error:null}:{ipAdapter:null,error:"IP Adapter incompatible with currently-selected model"}:{ipAdapter:null,error:"IP Adapter model is not installed"}},[V,r==null?void 0:r.base_model]),q=d.useCallback(T=>{const B=Q(T);if(!B.ipAdapter){s(B.error);return}e(Sc(B.ipAdapter)),o()},[Q,e,o,s]),z=d.useCallback(T=>{e(rg(T))},[e]),G=d.useCallback(T=>{if(!T){l();return}const{cfg_scale:B,height:X,model:re,positive_prompt:le,negative_prompt:se,scheduler:K,seed:U,steps:ee,width:de,strength:Z,positive_style_prompt:ue,negative_style_prompt:fe,refiner_model:ge,refiner_cfg_scale:_e,refiner_steps:ye,refiner_scheduler:pe,refiner_positive_aesthetic_score:Te,refiner_negative_aesthetic_score:Ae,refiner_start:qe,loras:Pt,controlnets:tt,ipAdapters:sn,t2iAdapters:mt}=T;jv(B)&&e(Dm(B)),Dw(re)&&e(N1(re)),Mp(le)&&e(Md(le)),Op(se)&&e(Od(se)),_v(K)&&e($1(K)),Aw(U)&&e(Am(U)),Iv(ee)&&e(Tm(ee)),Tw(de)&&e(Bl(de)),Nw(X)&&e(Hl(X)),$w(Z)&&e(Nm(Z)),dd(ue)&&e(Rd(ue)),kv(fe)&&e(Ad(fe)),r7(ge)&&e(FI(ge)),Iv(ye)&&e(L1(ye)),jv(_e)&&e(z1(_e)),_v(pe)&&e(BI(pe)),o7(Te)&&e(F1(Te)),s7(Ae)&&e(B1(Ae)),a7(qe)&&e(H1(qe)),e(i7()),Pt==null||Pt.forEach(ct=>{const be=M(ct);be.lora&&e(Lw({...be.lora,weight:ct.weight}))}),e(EI()),tt==null||tt.forEach(ct=>{const be=D(ct);be.controlnet&&e(Sc(be.controlnet))}),sn==null||sn.forEach(ct=>{const be=Q(ct);be.ipAdapter&&e(Sc(be.ipAdapter))}),mt==null||mt.forEach(ct=>{const be=Y(ct);be.t2iAdapter&&e(Sc(be.t2iAdapter))}),i()},[e,i,l,M,D,Q,Y]);return{recallBothPrompts:u,recallPositivePrompt:p,recallNegativePrompt:m,recallSDXLPositiveStylePrompt:h,recallSDXLNegativeStylePrompt:g,recallSeed:x,recallCfgScale:y,recallModel:b,recallScheduler:C,recallSteps:S,recallWidth:j,recallHeight:_,recallStrength:P,recallLoRA:O,recallControlNet:R,recallIPAdapter:q,recallT2IAdapter:F,recallAllParameters:G,sendToImageToImage:z}},Hoe=()=>d.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(l){i(l)},"image/png")})))},r.crossOrigin=HI.get()?"use-credentials":"anonymous",r.src=t}),[]),b8=()=>{const e=oc(),{t}=J(),n=Hoe(),r=d.useMemo(()=>!!navigator.clipboard&&!!window.ClipboardItem,[]),o=d.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");l7(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 Woe(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 Voe(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 Uoe(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 C2(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 Goe(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 qoe(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 Koe(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 Qoe(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 Xoe(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 Yoe(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 w2(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 S2(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 Joe(e,t,n){var r=this,o=d.useRef(null),s=d.useRef(0),i=d.useRef(null),l=d.useRef([]),u=d.useRef(),p=d.useRef(),m=d.useRef(e),h=d.useRef(!0);d.useEffect(function(){m.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 x=!!(n=n||{}).leading,y=!("trailing"in n)||!!n.trailing,b="maxWait"in n,C=b?Math.max(+n.maxWait||0,t):null;d.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var S=d.useMemo(function(){var j=function(A){var D=l.current,R=u.current;return l.current=u.current=null,s.current=A,p.current=m.current.apply(R,D)},_=function(A,D){g&&cancelAnimationFrame(i.current),i.current=g?requestAnimationFrame(A):setTimeout(A,D)},P=function(A){if(!h.current)return!1;var D=A-o.current;return!o.current||D>=t||D<0||b&&A-s.current>=C},I=function(A){return i.current=null,y&&l.current?j(A):(l.current=u.current=null,p.current)},M=function A(){var D=Date.now();if(P(D))return I(D);if(h.current){var R=t-(D-o.current),N=b?Math.min(R,C-(D-s.current)):R;_(A,N)}},O=function(){var A=Date.now(),D=P(A);if(l.current=[].slice.call(arguments),u.current=r,o.current=A,D){if(!i.current&&h.current)return s.current=o.current,_(M,t),x?j(o.current):p.current;if(b)return _(M,t),j(o.current)}return i.current||_(M,t),p.current};return O.cancel=function(){i.current&&(g?cancelAnimationFrame(i.current):clearTimeout(i.current)),s.current=0,l.current=o.current=u.current=i.current=null},O.isPending=function(){return!!i.current},O.flush=function(){return i.current?I(Date.now()):p.current},O},[x,b,t,C,y,g]);return S}function Zoe(e,t){return e===t}function h_(e){return typeof e=="function"?function(){return e}:e}function k2(e,t,n){var r,o,s=n&&n.equalityFn||Zoe,i=(r=d.useState(h_(e)),o=r[1],[r[0],d.useCallback(function(h){return o(h_(h))},[])]),l=i[0],u=i[1],p=Joe(d.useCallback(function(h){return u(h)},[u]),t,n),m=d.useRef(e);return s(m.current,e)||(p(e),m.current=e),[l,p]}const j2=e=>{const t=W(s=>s.config.metadataFetchDebounce),[n]=k2(e,t??0),{data:r,isLoading:o}=WI(n??VI);return{metadata:r,isLoading:o}},ese=c7.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=UI.safeParse(t);if(n.success)return n.data;yi("images").warn("Problem parsing workflow")}}})})}),{useGetWorkflowQuery:tse}=ese,_2=e=>{const t=W(s=>s.config.workflowFetchDebounce),[n]=k2(e,t??0),{data:r,isLoading:o}=tse(n??VI);return{workflow:r,isLoading:o}};kb("gallery/requestedBoardImagesDeletion");const nse=kb("gallery/sentImageToCanvas"),C8=kb("gallery/sentImageToImg2Img"),rse=e=>{const{imageDTO:t}=e,n=te(),{t:r}=J(),o=oc(),s=jn("unifiedCanvas").isFeatureEnabled,i=Lg(jb),{metadata:l,isLoading:u}=j2(t==null?void 0:t.image_name),{workflow:p,isLoading:m}=_2(t==null?void 0:t.workflow_id),[h]=_b(),[g]=Ib(),{isClipboardAPIAvailable:x,copyImageToClipboard:y}=b8(),b=d.useCallback(()=>{t&&n(og([t]))},[n,t]),{recallBothPrompts:C,recallSeed:S,recallAllParameters:j}=l0(),_=d.useCallback(()=>{C(l==null?void 0:l.positive_prompt,l==null?void 0:l.negative_prompt,l==null?void 0:l.positive_style_prompt,l==null?void 0:l.negative_style_prompt)},[l==null?void 0:l.negative_prompt,l==null?void 0:l.positive_prompt,l==null?void 0:l.positive_style_prompt,l==null?void 0:l.negative_style_prompt,C]),P=d.useCallback(()=>{S(l==null?void 0:l.seed)},[l==null?void 0:l.seed,S]),I=d.useCallback(()=>{p&&n(Pb(p))},[n,p]),M=d.useCallback(()=>{n(C8()),n(rg(t))},[n,t]),O=d.useCallback(()=>{n(nse()),rs.flushSync(()=>{n(ti("unifiedCanvas"))}),n(GI(t)),o({title:r("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},[n,t,r,o]),A=d.useCallback(()=>{j(l)},[l,j]),D=d.useCallback(()=>{n(qI([t])),n(gb(!0))},[n,t]),R=d.useCallback(()=>{y(t.image_url)},[y,t.image_url]),N=d.useCallback(()=>{t&&h({imageDTOs:[t]})},[h,t]),Y=d.useCallback(()=>{t&&g({imageDTOs:[t]})},[g,t]);return a.jsxs(a.Fragment,{children:[a.jsx(Wn,{as:"a",href:t.image_url,target:"_blank",icon:a.jsx(Vy,{}),children:r("common.openInNewTab")}),x&&a.jsx(Wn,{icon:a.jsx(Lu,{}),onClickCapture:R,children:r("parameters.copyImage")}),a.jsx(Wn,{as:"a",download:!0,href:t.image_url,target:"_blank",icon:a.jsx(zu,{}),w:"100%",children:r("parameters.downloadImage")}),a.jsx(Wn,{icon:m?a.jsx(pm,{}):a.jsx(C2,{}),onClickCapture:I,isDisabled:m||!p,children:r("nodes.loadWorkflow")}),a.jsx(Wn,{icon:u?a.jsx(pm,{}):a.jsx(QM,{}),onClickCapture:_,isDisabled:u||(l==null?void 0:l.positive_prompt)===void 0&&(l==null?void 0:l.negative_prompt)===void 0,children:r("parameters.usePrompt")}),a.jsx(Wn,{icon:u?a.jsx(pm,{}):a.jsx(XM,{}),onClickCapture:P,isDisabled:u||(l==null?void 0:l.seed)===void 0,children:r("parameters.useSeed")}),a.jsx(Wn,{icon:u?a.jsx(pm,{}):a.jsx(zM,{}),onClickCapture:A,isDisabled:u||!l,children:r("parameters.useAll")}),a.jsx(Wn,{icon:a.jsx(xj,{}),onClickCapture:M,id:"send-to-img2img",children:r("parameters.sendToImg2Img")}),s&&a.jsx(Wn,{icon:a.jsx(xj,{}),onClickCapture:O,id:"send-to-canvas",children:r("parameters.sendToUnifiedCanvas")}),a.jsx(Wn,{icon:a.jsx(VM,{}),onClickCapture:D,children:"Change Board"}),t.starred?a.jsx(Wn,{icon:i?i.off.icon:a.jsx(S2,{}),onClickCapture:Y,children:i?i.off.text:"Unstar Image"}):a.jsx(Wn,{icon:i?i.on.icon:a.jsx(w2,{}),onClickCapture:N,children:i?i.on.text:"Star Image"}),a.jsx(Wn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(qo,{}),onClickCapture:b,children:r("gallery.deleteImage")})]})},w8=d.memo(rse),pm=()=>a.jsx($,{w:"14px",alignItems:"center",justifyContent:"center",children:a.jsx(vi,{size:"xs"})}),ose=()=>{const{t:e}=J(),t=te(),n=W(b=>b.gallery.selection),r=Lg(jb),o=jn("bulkDownload").isFeatureEnabled,[s]=_b(),[i]=Ib(),[l]=DI(),u=d.useCallback(()=>{t(qI(n)),t(gb(!0))},[t,n]),p=d.useCallback(()=>{t(og(n))},[t,n]),m=d.useCallback(()=>{s({imageDTOs:n})},[s,n]),h=d.useCallback(()=>{i({imageDTOs:n})},[i,n]),g=d.useCallback(async()=>{try{const b=await l({image_names:n.map(C=>C.image_name)}).unwrap();t($t({title:e("gallery.preparingDownload"),status:"success",...b.response?{description:b.response}:{}}))}catch{t($t({title:e("gallery.preparingDownloadFailed"),status:"error"}))}},[e,n,l,t]),x=d.useMemo(()=>n.every(b=>b.starred),[n]),y=d.useMemo(()=>n.every(b=>!b.starred),[n]);return a.jsxs(a.Fragment,{children:[x&&a.jsx(Wn,{icon:r?r.on.icon:a.jsx(w2,{}),onClickCapture:h,children:r?r.off.text:"Unstar All"}),(y||!x&&!y)&&a.jsx(Wn,{icon:r?r.on.icon:a.jsx(S2,{}),onClickCapture:m,children:r?r.on.text:"Star All"}),o&&a.jsx(Wn,{icon:a.jsx(zu,{}),onClickCapture:g,children:e("gallery.downloadSelection")}),a.jsx(Wn,{icon:a.jsx(VM,{}),onClickCapture:u,children:"Change Board"}),a.jsx(Wn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(qo,{}),onClickCapture:p,children:"Delete Selection"})]})},sse=d.memo(ose),ase=ce([we],({gallery:e})=>({selectionCount:e.selection.length}),je),ise=({imageDTO:e,children:t})=>{const{selectionCount:n}=W(ase),r=d.useCallback(o=>{o.preventDefault()},[]);return a.jsx(c2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>e?n>1?a.jsx(Ul,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:r,children:a.jsx(sse,{})}):a.jsx(Ul,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:r,children:a.jsx(w8,{imageDTO:e})}):null,children:t})},lse=d.memo(ise),cse=e=>{const{data:t,disabled:n,...r}=e,o=d.useRef(oi()),{attributes:s,listeners:i,setNodeRef:l}=Dne({id:o.current,disabled:n,data:t});return a.jsx(De,{ref:l,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,...s,...i,...r})},use=d.memo(cse),dse=a.jsx(Lr,{as:Kg,sx:{boxSize:16}}),fse=a.jsx(eo,{icon:Xl}),pse=e=>{const{imageDTO:t,onError:n,onClick:r,withMetadataOverlay:o=!1,isDropDisabled:s=!1,isDragDisabled:i=!1,isUploadDisabled:l=!1,minSize:u=24,postUploadAction:p,imageSx:m,fitContainer:h=!1,droppableData:g,draggableData:x,dropLabel:y,isSelected:b=!1,thumbnail:C=!1,noContentFallback:S=fse,uploadElement:j=dse,useThumbailFallback:_,withHoverOverlay:P=!1,children:I,onMouseOver:M,onMouseOut:O,dataTestId:A}=e,{colorMode:D}=Ci(),[R,N]=d.useState(!1),Y=d.useCallback(z=>{M&&M(z),N(!0)},[M]),F=d.useCallback(z=>{O&&O(z),N(!1)},[O]),{getUploadButtonProps:V,getUploadInputProps:Q}=y2({postUploadAction:p,isDisabled:l}),q=l?{}:{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(lse,{imageDTO:t,children:z=>a.jsxs($,{ref:z,onMouseOver:Y,onMouseOut:F,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative",minW:u||void 0,minH:u||void 0,userSelect:"none",cursor:i||!t?"default":"pointer"},children:[t&&a.jsxs($,{sx:{w:"full",h:"full",position:h?"absolute":"relative",alignItems:"center",justifyContent:"center"},children:[a.jsx(wi,{src:C?t.thumbnail_url:t.image_url,fallbackStrategy:"beforeLoadOrError",fallbackSrc:_?t.thumbnail_url:void 0,fallback:_?void 0:a.jsx(cre,{image:t}),onError:n,draggable:!1,sx:{w:t.width,objectFit:"contain",maxW:"full",maxH:"full",borderRadius:"base",...m},"data-testid":A}),o&&a.jsx(Foe,{imageDTO:t}),a.jsx(l2,{isSelected:b,isHovered:P?R:!1})]}),!t&&!l&&a.jsx(a.Fragment,{children:a.jsxs($,{sx:{minH:u,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",transitionProperty:"common",transitionDuration:"0.1s",color:Ke("base.500","base.500")(D),...q},...V(),children:[a.jsx("input",{...Q()}),j]})}),!t&&l&&S,t&&!i&&a.jsx(use,{data:x,disabled:i||!t,onClick:r}),I,!s&&a.jsx(i2,{data:g,disabled:s,dropLabel:y})]})})},al=d.memo(pse),mse=()=>a.jsx(Og,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:a.jsx(De,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full"}})}),hse=d.memo(mse),gse=ce([we,Eb],({gallery:e},t)=>{const n=e.selection;return{queryArgs:t,selection:n}},je),vse=e=>{const t=te(),{queryArgs:n,selection:r}=W(gse),{imageDTOs:o}=KI(n,{selectFromResult:p=>({imageDTOs:p.data?u7.selectAll(p.data):[]})}),s=jn("multiselect").isFeatureEnabled,i=d.useCallback(p=>{var m;if(e){if(!s){t(pd([e]));return}if(p.shiftKey){const h=e.image_name,g=(m=r[r.length-1])==null?void 0:m.image_name,x=o.findIndex(b=>b.image_name===g),y=o.findIndex(b=>b.image_name===h);if(x>-1&&y>-1){const b=Math.min(x,y),C=Math.max(x,y),S=o.slice(b,C+1);t(pd(r.concat(S)))}}else p.ctrlKey||p.metaKey?r.some(h=>h.image_name===e.image_name)&&r.length>1?t(pd(r.filter(h=>h.image_name!==e.image_name))):t(pd(r.concat(e))):t(pd([e]))}},[t,e,o,r,s]),l=d.useMemo(()=>e?r.some(p=>p.image_name===e.image_name):!1,[e,r]),u=d.useMemo(()=>r.length,[r.length]);return{selection:r,selectionCount:u,isSelected:l,handleClick:i}},xse=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(ot,{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})},du=d.memo(xse),bse=e=>{const t=te(),{imageName:n}=e,{currentData:r}=Ps(n),o=W(M=>M.hotkeys.shift),{t:s}=J(),{handleClick:i,isSelected:l,selection:u,selectionCount:p}=vse(r),m=Lg(jb),h=d.useCallback(M=>{M.stopPropagation(),r&&t(og([r]))},[t,r]),g=d.useMemo(()=>{if(p>1)return{id:"gallery-image",payloadType:"IMAGE_DTOS",payload:{imageDTOs:u}};if(r)return{id:"gallery-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r,u,p]),[x]=_b(),[y]=Ib(),b=d.useCallback(()=>{r&&(r.starred&&y({imageDTOs:[r]}),r.starred||x({imageDTOs:[r]}))},[x,y,r]),[C,S]=d.useState(!1),j=d.useCallback(()=>{S(!0)},[]),_=d.useCallback(()=>{S(!1)},[]),P=d.useMemo(()=>{if(r!=null&&r.starred)return m?m.on.icon:a.jsx(S2,{size:"20"});if(!(r!=null&&r.starred)&&C)return m?m.off.icon:a.jsx(w2,{size:"20"})},[r==null?void 0:r.starred,C,m]),I=d.useMemo(()=>r!=null&&r.starred?m?m.off.text:"Unstar":r!=null&&r.starred?"":m?m.on.text:"Star",[r==null?void 0:r.starred,m]);return r?a.jsx(De,{sx:{w:"full",h:"full",touchAction:"none"},"data-testid":`image-${r.image_name}`,children:a.jsx($,{userSelect:"none",sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:a.jsx(al,{onClick:i,imageDTO:r,draggableData:g,isSelected:l,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(du,{onClick:b,icon:P,tooltip:I}),C&&o&&a.jsx(du,{onClick:h,icon:a.jsx(qo,{}),tooltip:s("gallery.deleteImage"),styleOverrides:{bottom:2,top:"auto"}})]})})})}):a.jsx(hse,{})},yse=d.memo(bse),Cse=Oe((e,t)=>a.jsx(De,{className:"item-container",ref:t,p:1.5,"data-testid":"image-item-container",children:e.children})),wse=d.memo(Cse),Sse=Oe((e,t)=>{const n=W(r=>r.gallery.galleryImageMinimumWidth);return a.jsx(tl,{...e,className:"list-container",ref:t,sx:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr));`},"data-testid":"image-list-container",children:e.children})}),kse=d.memo(Sse),jse={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},_se=()=>{const{t:e}=J(),t=d.useRef(null),[n,r]=d.useState(null),[o,s]=a2(jse),i=W(C=>C.gallery.selectedBoardId),{currentViewTotal:l}=Loe(i),u=W(Eb),{currentData:p,isFetching:m,isSuccess:h,isError:g}=KI(u),[x]=QI(),y=d.useMemo(()=>!p||!l?!1:p.ids.length{y&&x({...u,offset:(p==null?void 0:p.ids.length)??0,limit:XI})},[y,x,u,p==null?void 0:p.ids.length]);return d.useEffect(()=>{const{current:C}=t;return n&&C&&o({target:C,elements:{viewport:n}}),()=>{var S;return(S=s())==null?void 0:S.destroy()}},[n,o,s]),p?h&&(p==null?void 0:p.ids.length)===0?a.jsx($,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(eo,{label:e("gallery.noImagesInGallery"),icon:Xl})}):h&&p?a.jsxs(a.Fragment,{children:[a.jsx(De,{ref:t,"data-overlayscrollbars":"",h:"100%",children:a.jsx($oe,{style:{height:"100%"},data:p.ids,endReached:b,components:{Item:wse,List:kse},scrollerRef:r,itemContent:(C,S)=>a.jsx(yse,{imageName:S},S)})}),a.jsx(Mt,{onClick:b,isDisabled:!y,isLoading:m,loadingText:e("gallery.loading"),flexShrink:0,children:`Load More (${p.ids.length} of ${l})`})]}):g?a.jsx(De,{sx:{w:"full",h:"full"},children:a.jsx(eo,{label:e("gallery.unableToLoad"),icon:lee})}):null:a.jsx($,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(eo,{label:e("gallery.loading"),icon:Xl})})},Ise=d.memo(_se),Pse=ce([we],e=>{const{galleryView:t}=e.gallery;return{galleryView:t}},je),Ese=()=>{const{t:e}=J(),t=d.useRef(null),n=d.useRef(null),{galleryView:r}=W(Pse),o=te(),{isOpen:s,onToggle:i}=Uo({defaultIsOpen:!0}),l=d.useCallback(()=>{o(zw("images"))},[o]),u=d.useCallback(()=>{o(zw("assets"))},[o]);return a.jsxs(V3,{layerStyle:"first",sx:{flexDirection:"column",h:"full",w:"full",borderRadius:"base",p:2},children:[a.jsxs(De,{sx:{w:"full"},children:[a.jsxs($,{ref:t,sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[a.jsx(Zne,{isOpen:s,onToggle:i}),a.jsx(lre,{})]}),a.jsx(De,{children:a.jsx(Xne,{isOpen:s})})]}),a.jsxs($,{ref:n,direction:"column",gap:2,h:"full",w:"full",children:[a.jsx($,{sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:a.jsx(nc,{index:r==="images"?0:1,variant:"unstyled",size:"sm",sx:{w:"full"},children:a.jsx(rc,{children:a.jsxs(zn,{isAttached:!0,sx:{w:"full"},children:[a.jsx(Po,{as:Mt,size:"sm",isChecked:r==="images",onClick:l,sx:{w:"full"},leftIcon:a.jsx(gee,{}),"data-testid":"images-tab",children:e("gallery.images")}),a.jsx(Po,{as:Mt,size:"sm",isChecked:r==="assets",onClick:u,sx:{w:"full"},leftIcon:a.jsx(Pee,{}),"data-testid":"assets-tab",children:e("gallery.assets")})]})})})}),a.jsx(Ise,{})]})]})},Mse=d.memo(Ese),Ose=()=>{const e=W(p=>p.system.isConnected),{data:t}=Fa(),[n,{isLoading:r}]=Mb(),o=te(),{t:s}=J(),i=d.useMemo(()=>t==null?void 0:t.queue.item_id,[t==null?void 0:t.queue.item_id]),l=d.useCallback(async()=>{if(i)try{await n(i).unwrap(),o($t({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o($t({title:s("queue.cancelFailed"),status:"error"}))}},[i,o,s,n]),u=d.useMemo(()=>!e||Wd(i),[e,i]);return{cancelQueueItem:l,isLoading:r,currentQueueItemId:i,isDisabled:u}},Rse=({label:e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,asIconButton:i,isLoading:l,loadingText:u,sx:p})=>i?a.jsx(ot,{"aria-label":e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:l,sx:p,"data-testid":e}):a.jsx(Mt,{"aria-label":e,tooltip:t,leftIcon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:l,loadingText:u??e,flexGrow:1,sx:p,"data-testid":e,children:e}),cc=d.memo(Rse),Ase=({asIconButton:e,sx:t})=>{const{t:n}=J(),{cancelQueueItem:r,isLoading:o,isDisabled:s}=Ose();return a.jsx(cc,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.cancel"),tooltip:n("queue.cancelTooltip"),icon:a.jsx(wu,{}),onClick:r,colorScheme:"error",sx:t})},S8=d.memo(Ase),Dse=()=>{const{t:e}=J(),t=te(),{data:n}=Fa(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=YI({fixedCacheKey:"clearQueue"}),i=d.useCallback(async()=>{if(n!=null&&n.queue.total)try{await o().unwrap(),t($t({title:e("queue.clearSucceeded"),status:"success"})),t(Ob(void 0)),t(Rb(void 0))}catch{t($t({title:e("queue.clearFailed"),status:"error"}))}},[n==null?void 0:n.queue.total,o,t,e]),l=d.useMemo(()=>!r||!(n!=null&&n.queue.total),[r,n==null?void 0:n.queue.total]);return{clearQueue:i,isLoading:s,queueStatus:n,isDisabled:l}},Tse=Oe((e,t)=>{const{t:n}=J(),{acceptButtonText:r=n("common.accept"),acceptCallback:o,cancelButtonText:s=n("common.cancel"),cancelCallback:i,children:l,title:u,triggerComponent:p}=e,{isOpen:m,onOpen:h,onClose:g}=Uo(),x=d.useRef(null),y=()=>{o(),g()},b=()=>{i&&i(),g()};return a.jsxs(a.Fragment,{children:[d.cloneElement(p,{onClick:h,ref:t}),a.jsx(Mf,{isOpen:m,leastDestructiveRef:x,onClose:g,isCentered:!0,children:a.jsx(oa,{children:a.jsxs(Of,{children:[a.jsx(ra,{fontSize:"lg",fontWeight:"bold",children:u}),a.jsx(sa,{children:l}),a.jsxs(Oa,{children:[a.jsx(Mt,{ref:x,onClick:b,children:s}),a.jsx(Mt,{colorScheme:"error",onClick:y,ml:3,children:r})]})]})})})]})}),c0=d.memo(Tse),Nse=({asIconButton:e,sx:t})=>{const{t:n}=J(),{clearQueue:r,isLoading:o,isDisabled:s}=Dse();return a.jsxs(c0,{title:n("queue.clearTooltip"),acceptCallback:r,acceptButtonText:n("queue.clear"),triggerComponent:a.jsx(cc,{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")})]})},I2=d.memo(Nse),$se=()=>{const e=te(),{t}=J(),n=W(p=>p.system.isConnected),{data:r}=Fa(),[o,{isLoading:s}]=JI({fixedCacheKey:"pauseProcessor"}),i=d.useMemo(()=>!!(r!=null&&r.processor.is_started),[r==null?void 0:r.processor.is_started]),l=d.useCallback(async()=>{if(i)try{await o().unwrap(),e($t({title:t("queue.pauseSucceeded"),status:"success"}))}catch{e($t({title:t("queue.pauseFailed"),status:"error"}))}},[i,o,e,t]),u=d.useMemo(()=>!n||!i,[n,i]);return{pauseProcessor:l,isLoading:s,isStarted:i,isDisabled:u}},Lse=({asIconButton:e})=>{const{t}=J(),{pauseProcessor:n,isLoading:r,isDisabled:o}=$se();return a.jsx(cc,{asIconButton:e,label:t("queue.pause"),tooltip:t("queue.pauseTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(wee,{}),onClick:n,colorScheme:"gold"})},k8=d.memo(Lse),zse=ce([we,ro],({controlAdapters:e,generation:t,system:n,nodes:r,dynamicPrompts:o},s)=>{const{initialImage:i,model:l}=t,{isConnected:u}=n,p=[];return u||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(m=>{if(!Or(m))return;const h=r.nodeTemplates[m.data.type];if(!h){p.push(on.t("parameters.invoke.missingNodeTemplate"));return}const g=d7([m],r.edges);qr(m.data.inputs,x=>{const y=h.inputs[x.name],b=g.some(C=>C.target===m.id&&C.targetHandle===x.name);if(!y){p.push(on.t("parameters.invoke.missingFieldTemplate"));return}if(y.required&&x.value===void 0&&!b){p.push(on.t("parameters.invoke.missingInputForField",{nodeLabel:m.data.label||h.title,fieldLabel:x.label||y.title}));return}})})):(o.prompts.length===0&&p.push(on.t("parameters.invoke.noPrompts")),l||p.push(on.t("parameters.invoke.noModelSelected")),f7(e).forEach((m,h)=>{m.isEnabled&&(m.model?m.model.base_model!==(l==null?void 0:l.base_model)&&p.push(on.t("parameters.invoke.incompatibleBaseModelForControlAdapter",{number:h+1})):p.push(on.t("parameters.invoke.noModelForControlAdapter",{number:h+1})),(!m.controlImage||Mu(m)&&!m.processedControlImage&&m.processorType!=="none")&&p.push(on.t("parameters.invoke.noControlImageForControlAdapter",{number:h+1})))})),{isReady:!p.length,reasons:p}},je),P2=()=>{const{isReady:e,reasons:t}=W(zse);return{isReady:e,reasons:t}},j8=()=>{const e=te(),t=W(ro),{isReady:n}=P2(),[r,{isLoading:o}]=sg({fixedCacheKey:"enqueueBatch"}),s=d.useMemo(()=>!n,[n]);return{queueBack:d.useCallback(()=>{s||(e(Ab()),e(ZI({tabName:t,prepend:!1})))},[e,s,t]),isLoading:o,isDisabled:s}},Fse=ce([we],({gallery:e})=>{const{autoAddBoardId:t}=e;return{autoAddBoardId:t}},je),Bse=({prepend:e=!1})=>{const{t}=J(),{isReady:n,reasons:r}=P2(),{autoAddBoardId:o}=W(Fse),s=n0(o),[i,{isLoading:l}]=sg({fixedCacheKey:"enqueueBatch"}),u=d.useMemo(()=>t(l?"queue.enqueueing":n?e?"queue.queueFront":"queue.queueBack":"queue.notReady"),[l,n,e,t]);return a.jsxs($,{flexDir:"column",gap:1,children:[a.jsx(Se,{fontWeight:600,children:u}),r.length>0&&a.jsx(_f,{children:r.map((p,m)=>a.jsx(ws,{children:a.jsx(Se,{fontWeight:400,children:p})},`${p}.${m}`))}),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=d.memo(Bse),I8=d.memo(()=>a.jsx(no,{opacity:.2,borderColor:"base.50",_dark:{borderColor:"base.900"}}));I8.displayName="StyledDivider";const Hse=()=>a.jsx(De,{pos:"relative",w:4,h:4,children:a.jsx(wi,{src:vb,alt:"invoke-ai-logo",pos:"absolute",top:-.5,insetInlineStart:-.5,w:5,h:5,minW:5,minH:5,filter:"saturate(0)"})}),Wse=d.memo(Hse),Vse=({asIconButton:e,sx:t})=>{const{t:n}=J(),{queueBack:r,isLoading:o,isDisabled:s}=j8();return a.jsx(cc,{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(Wse,{}):void 0})},P8=d.memo(Vse),E8=()=>{const e=te(),t=W(ro),{isReady:n}=P2(),[r,{isLoading:o}]=sg({fixedCacheKey:"enqueueBatch"}),s=jn("prependQueue").isFeatureEnabled,i=d.useMemo(()=>!n||!s,[n,s]);return{queueFront:d.useCallback(()=>{i||(e(Ab()),e(ZI({tabName:t,prepend:!0})))},[e,i,t]),isLoading:o,isDisabled:i}},Use=({asIconButton:e,sx:t})=>{const{t:n}=J(),{queueFront:r,isLoading:o,isDisabled:s}=E8();return a.jsx(cc,{asIconButton:e,colorScheme:"base",label:n("queue.queueFront"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(_8,{prepend:!0}),icon:a.jsx(Voe,{}),sx:t})},Gse=d.memo(Use),qse=()=>{const e=te(),t=W(p=>p.system.isConnected),{data:n}=Fa(),{t:r}=J(),[o,{isLoading:s}]=eP({fixedCacheKey:"resumeProcessor"}),i=d.useMemo(()=>!!(n!=null&&n.processor.is_started),[n==null?void 0:n.processor.is_started]),l=d.useCallback(async()=>{if(!i)try{await o().unwrap(),e($t({title:r("queue.resumeSucceeded"),status:"success"}))}catch{e($t({title:r("queue.resumeFailed"),status:"error"}))}},[i,o,e,r]),u=d.useMemo(()=>!t||i,[t,i]);return{resumeProcessor:l,isLoading:s,isStarted:i,isDisabled:u}},Kse=({asIconButton:e})=>{const{t}=J(),{resumeProcessor:n,isLoading:r,isDisabled:o}=qse();return a.jsx(cc,{asIconButton:e,label:t("queue.resume"),tooltip:t("queue.resumeTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(See,{}),onClick:n,colorScheme:"green"})},M8=d.memo(Kse),Qse=ce(we,({system:e})=>{var t;return{isConnected:e.isConnected,hasSteps:!!e.denoiseProgress,value:(((t=e.denoiseProgress)==null?void 0:t.percentage)??0)*100}},je),Xse=()=>{const{t:e}=J(),{data:t}=Fa(),{hasSteps:n,value:r,isConnected:o}=W(Qse);return a.jsx(S5,{value:r,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:o&&!!(t!=null&&t.queue.in_progress)&&!n,h:"full",w:"full",borderRadius:2,colorScheme:"accent"})},Yse=d.memo(Xse),Jse=()=>{const e=jn("pauseQueue").isFeatureEnabled,t=jn("resumeQueue").isFeatureEnabled,n=jn("prependQueue").isFeatureEnabled;return a.jsxs($,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,gap:2,flexDir:"column"},children:[a.jsxs($,{gap:2,w:"full",children:[a.jsxs(zn,{isAttached:!0,flexGrow:2,children:[a.jsx(P8,{}),n?a.jsx(Gse,{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(I2,{asIconButton:!0})]}),a.jsx($,{h:3,w:"full",children:a.jsx(Yse,{})}),a.jsx(R8,{})]})},O8=d.memo(Jse),R8=d.memo(()=>{const{t:e}=J(),t=te(),{hasItems:n,pending:r}=Fa(void 0,{selectFromResult:({data:s})=>{if(!s)return{hasItems:!1,pending:0};const{pending:i,in_progress:l}=s.queue;return{hasItems:i+l>0,pending:i}}}),o=d.useCallback(()=>{t(ti("queue"))},[t]);return a.jsxs($,{justifyContent:"space-between",alignItems:"center",pe:1,"data-testid":"queue-count",children:[a.jsx(ki,{}),a.jsx(el,{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:ku,createContext:Zse,forwardRef:A8,useCallback:Ja,useContext:D8,useEffect:ui,useImperativeHandle:T8,useLayoutEffect:eae,useMemo:tae,useRef:ns,useState:Ld}=hb,g_=hb["useId".toString()],zd=eae,nae=typeof g_=="function"?g_:()=>null;let rae=0;function E2(e=null){const t=nae(),n=ns(e||t||null);return n.current===null&&(n.current=""+rae++),n.current}const u0=Zse(null);u0.displayName="PanelGroupContext";function N8({children:e=null,className:t="",collapsedSize:n=0,collapsible:r=!1,defaultSize:o=null,forwardedRef:s,id:i=null,maxSize:l=null,minSize:u,onCollapse:p=null,onResize:m=null,order:h=null,style:g={},tagName:x="div"}){const y=D8(u0);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const b=E2(i),{collapsePanel:C,expandPanel:S,getPanelSize:j,getPanelStyle:_,registerPanel:P,resizePanel:I,units:M,unregisterPanel:O}=y;u==null&&(M==="percentages"?u=10:u=0);const A=ns({onCollapse:p,onResize:m});ui(()=>{A.current.onCollapse=p,A.current.onResize=m});const D=_(b,o),R=ns({size:v_(D)}),N=ns({callbacksRef:A,collapsedSize:n,collapsible:r,defaultSize:o,id:b,idWasAutoGenerated:i==null,maxSize:l,minSize:u,order:h});return zd(()=>{R.current.size=v_(D),N.current.callbacksRef=A,N.current.collapsedSize=n,N.current.collapsible=r,N.current.defaultSize=o,N.current.id=b,N.current.idWasAutoGenerated=i==null,N.current.maxSize=l,N.current.minSize=u,N.current.order=h}),zd(()=>(P(b,N),()=>{O(b)}),[h,b,P,O]),T8(s,()=>({collapse:()=>C(b),expand:()=>S(b),getCollapsed(){return R.current.size===0},getId(){return b},getSize(Y){return j(b,Y)},resize:(Y,F)=>I(b,Y,F)}),[C,S,j,b,I]),ku(x,{children:e,className:t,"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-id":b,"data-panel-size":parseFloat(""+D.flexGrow).toFixed(1),id:`data-panel-id-${b}`,style:{...D,...g}})}const Ji=A8((e,t)=>ku(N8,{...e,forwardedRef:t}));N8.displayName="Panel";Ji.displayName="forwardRef(Panel)";function v_(e){const{flexGrow:t}=e;return typeof t=="string"?parseFloat(t):t}const Zl=10;function Id(e,t,n,r,o,s,i,l){const{id:u,panels:p,units:m}=t,h=m==="pixels"?Wi(u):NaN,{sizes:g}=l||{},x=g||s,y=Fo(p),b=x.concat();let C=0;{const _=o<0?r:n,P=y.findIndex(A=>A.current.id===_),I=y[P],M=x[P],O=Qx(m,h,I,M,M+Math.abs(o),e);if(M===O)return x;O===0&&M>0&&i.set(_,M),o=o<0?M-O:O-M}let S=o<0?n:r,j=y.findIndex(_=>_.current.id===S);for(;;){const _=y[j],P=x[j],I=Math.abs(o)-Math.abs(C),M=Qx(m,h,_,P,P-I,e);if(P!==M&&(M===0&&P>0&&i.set(_.current.id,P),C+=P-M,b[j]=M,C.toPrecision(Zl).localeCompare(Math.abs(o).toPrecision(Zl),void 0,{numeric:!0})>=0))break;if(o<0){if(--j<0)break}else if(++j>=y.length)break}return C===0?x:(S=o<0?r:n,j=y.findIndex(_=>_.current.id===S),b[j]=x[j]+C,b)}function Dc(e,t,n){t.forEach((r,o)=>{const s=e[o];if(!s)return;const{callbacksRef:i,collapsedSize:l,collapsible:u,id:p}=s.current,m=n[p];if(m!==r){n[p]=r;const{onCollapse:h,onResize:g}=i.current;g&&g(r,m),u&&h&&((m==null||m===l)&&r!==l?h(!1):m!==l&&r===l&&h(!0))}})}function oae({groupId:e,panels:t,units:n}){const r=n==="pixels"?Wi(e):NaN,o=Fo(t),s=Array(o.length);let i=0,l=100;for(let u=0;ui.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 Wi(e){const t=cf(e);if(t==null)return NaN;const n=t.getAttribute("data-panel-group-direction"),r=M2(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(Zl)}function sae(e){const t=document.querySelector(`[data-panel-id="${e}"]`);return t||null}function cf(e){const t=document.querySelector(`[data-panel-group-id="${e}"]`);return t||null}function d0(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function aae(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 M2(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function O2(e,t,n){var u,p,m,h;const r=d0(t),o=M2(e),s=r?o.indexOf(r):-1,i=((p=(u=n[s])==null?void 0:u.current)==null?void 0:p.id)??null,l=((h=(m=n[s+1])==null?void 0:m.current)==null?void 0:h.id)??null;return[i,l]}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 Qx(e,t,n,r,o,s=null){var m;let{collapsedSize:i,collapsible:l,maxSize:u,minSize:p}=n.current;if(e==="pixels"&&(i=i/t*100,u!=null&&(u=u/t*100),p=p/t*100),l){if(r>i){if(o<=p/2+i)return i}else if(!((m=s==null?void 0:s.type)==null?void 0:m.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 y1({groupId:e,panels:t,nextSizes:n,prevSizes:r,units:o}){n=[...n];const s=Fo(t),i=o==="pixels"?Wi(e):NaN;let l=0;for(let u=0;u{const{direction:i,panels:l}=e.current,u=cf(t);z8(u!=null,`No group found for id "${t}"`);const{height:p,width:m}=u.getBoundingClientRect(),g=M2(t).map(x=>{const y=x.getAttribute("data-panel-resize-handle-id"),b=Fo(l),[C,S]=O2(t,y,b);if(C==null||S==null)return()=>{};let j=0,_=100,P=0,I=0;b.forEach(N=>{const{id:Y,maxSize:F,minSize:V}=N.current;Y===C?(j=V,_=F??100):(P+=V,I+=F??100)});const M=Math.min(_,100-P),O=Math.max(j,(b.length-1)*100-I),A=$8(l,C,o);x.setAttribute("aria-valuemax",""+Math.round(M)),x.setAttribute("aria-valuemin",""+Math.round(O)),x.setAttribute("aria-valuenow",""+Math.round(parseInt(A)));const D=N=>{if(!N.defaultPrevented)switch(N.key){case"Enter":{N.preventDefault();const Y=b.findIndex(F=>F.current.id===C);if(Y>=0){const F=b[Y],V=o[Y];if(V!=null){let Q=0;V.toPrecision(Zl)<=F.current.minSize.toPrecision(Zl)?Q=i==="horizontal"?m:p:Q=-(i==="horizontal"?m:p);const q=Id(N,e.current,C,S,Q,o,s.current,null);o!==q&&r(q)}}break}}};x.addEventListener("keydown",D);const R=sae(C);return R!=null&&x.setAttribute("aria-controls",R.id),()=>{x.removeAttribute("aria-valuemax"),x.removeAttribute("aria-valuemin"),x.removeAttribute("aria-valuenow"),x.removeEventListener("keydown",D),R!=null&&x.removeAttribute("aria-controls")}});return()=>{g.forEach(x=>x())}},[e,t,n,s,r,o])}function cae({disabled:e,handleId:t,resizeHandler:n}){ui(()=>{if(e||n==null)return;const r=d0(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(),l=aae(t);z8(l!==null);const u=s.shiftKey?l>0?l-1:i.length-1:l+1{r.removeEventListener("keydown",o)}},[e,t,n])}function C1(e,t){if(e.length!==t.length)return!1;for(let n=0;nO.current.id===P),M=r[I];if(M.current.collapsible){const O=m[I];(O===0||O.toPrecision(Zl)===M.current.minSize.toPrecision(Zl))&&(S=S<0?-M.current.minSize*y:M.current.minSize*y)}return S}else return F8(e,n,o,l,u)}function dae(e){return e.type==="keydown"}function Xx(e){return e.type.startsWith("mouse")}function Yx(e){return e.type.startsWith("touch")}let Jx=null,Rl=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 fae(){Rl!==null&&(document.head.removeChild(Rl),Jx=null,Rl=null)}function w1(e){if(Jx===e)return;Jx=e;const t=B8(e);Rl===null&&(Rl=document.createElement("style"),document.head.appendChild(Rl)),Rl.innerHTML=`*{cursor: ${t}!important;}`}function pae(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 mae(e,t,n){const r=W8(e,n);if(r){const o=H8(t);return r[o]??null}return null}function hae(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 S1={};function x_(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 Pd={getItem:e=>(x_(Pd),Pd.getItem(e)),setItem:(e,t)=>{x_(Pd),Pd.setItem(e,t)}};function V8({autoSaveId:e,children:t=null,className:n="",direction:r,disablePointerEventsDuringResize:o=!1,forwardedRef:s,id:i=null,onLayout:l,storage:u=Pd,style:p={},tagName:m="div",units:h="percentages"}){const g=E2(i),[x,y]=Ld(null),[b,C]=Ld(new Map),S=ns(null);ns({didLogDefaultSizeWarning:!1,didLogIdAndOrderWarning:!1,didLogInvalidLayoutWarning:!1,prevPanelIds:[]});const j=ns({onLayout:l});ui(()=>{j.current.onLayout=l});const _=ns({}),[P,I]=Ld([]),M=ns(new Map),O=ns(0),A=ns({direction:r,id:g,panels:b,sizes:P,units:h});T8(s,()=>({getId:()=>g,getLayout:T=>{const{sizes:B,units:X}=A.current;if((T??X)==="pixels"){const le=Wi(g);return B.map(se=>se/100*le)}else return B},setLayout:(T,B)=>{const{id:X,panels:re,sizes:le,units:se}=A.current;if((B||se)==="pixels"){const de=Wi(X);T=T.map(Z=>Z/de*100)}const K=_.current,U=Fo(re),ee=y1({groupId:X,panels:re,nextSizes:T,prevSizes:le,units:se});C1(le,ee)||(I(ee),Dc(U,ee,K))}}),[g]),zd(()=>{A.current.direction=r,A.current.id=g,A.current.panels=b,A.current.sizes=P,A.current.units=h}),lae({committedValuesRef:A,groupId:g,panels:b,setSizes:I,sizes:P,panelSizeBeforeCollapse:M}),ui(()=>{const{onLayout:T}=j.current,{panels:B,sizes:X}=A.current;if(X.length>0){T&&T(X);const re=_.current,le=Fo(B);Dc(le,X,re)}},[P]),zd(()=>{const{id:T,sizes:B,units:X}=A.current;if(B.length===b.size)return;let re=null;if(e){const le=Fo(b);re=mae(e,le,u)}if(re!=null){const le=y1({groupId:T,panels:b,nextSizes:re,prevSizes:re,units:X});I(le)}else{const le=oae({groupId:T,panels:b,units:X});I(le)}},[e,b,u]),ui(()=>{if(e){if(P.length===0||P.length!==b.size)return;const T=Fo(b);S1[e]||(S1[e]=pae(hae,100)),S1[e](e,T,P,u)}},[e,b,P,u]),zd(()=>{if(h==="pixels"){const T=new ResizeObserver(()=>{const{panels:B,sizes:X}=A.current,re=y1({groupId:g,panels:B,nextSizes:X,prevSizes:X,units:h});C1(X,re)||I(re)});return T.observe(cf(g)),()=>{T.disconnect()}}},[g,h]);const D=Ja((T,B)=>{const{panels:X,units:re}=A.current,se=Fo(X).findIndex(ee=>ee.current.id===T),K=P[se];if((B??re)==="pixels"){const ee=Wi(g);return K/100*ee}else return K},[g,P]),R=Ja((T,B)=>{const{panels:X}=A.current;return X.size===0?{flexBasis:0,flexGrow:B??void 0,flexShrink:1,overflow:"hidden"}:{flexBasis:0,flexGrow:$8(X,T,P),flexShrink:1,overflow:"hidden",pointerEvents:o&&x!==null?"none":void 0}},[x,o,P]),N=Ja((T,B)=>{const{units:X}=A.current;iae(X,B),C(re=>{if(re.has(T))return re;const le=new Map(re);return le.set(T,B),le})},[]),Y=Ja(T=>X=>{X.preventDefault();const{direction:re,panels:le,sizes:se}=A.current,K=Fo(le),[U,ee]=O2(g,T,K);if(U==null||ee==null)return;let de=uae(X,g,T,K,re,se,S.current);if(de===0)return;const ue=cf(g).getBoundingClientRect(),fe=re==="horizontal";document.dir==="rtl"&&fe&&(de=-de);const ge=fe?ue.width:ue.height,_e=de/ge*100,ye=Id(X,A.current,U,ee,_e,se,M.current,S.current),pe=!C1(se,ye);if((Xx(X)||Yx(X))&&O.current!=_e&&w1(pe?fe?"horizontal":"vertical":fe?de<0?"horizontal-min":"horizontal-max":de<0?"vertical-min":"vertical-max"),pe){const Te=_.current;I(ye),Dc(K,ye,Te)}O.current=_e},[g]),F=Ja(T=>{C(B=>{if(!B.has(T))return B;const X=new Map(B);return X.delete(T),X})},[]),V=Ja(T=>{const{panels:B,sizes:X}=A.current,re=B.get(T);if(re==null)return;const{collapsedSize:le,collapsible:se}=re.current;if(!se)return;const K=Fo(B),U=K.indexOf(re);if(U<0)return;const ee=X[U];if(ee===le)return;M.current.set(T,ee);const[de,Z]=b1(T,K);if(de==null||Z==null)return;const fe=U===K.length-1?ee:le-ee,ge=Id(null,A.current,de,Z,fe,X,M.current,null);if(X!==ge){const _e=_.current;I(ge),Dc(K,ge,_e)}},[]),Q=Ja(T=>{const{panels:B,sizes:X}=A.current,re=B.get(T);if(re==null)return;const{collapsedSize:le,minSize:se}=re.current,K=M.current.get(T)||se;if(!K)return;const U=Fo(B),ee=U.indexOf(re);if(ee<0||X[ee]!==le)return;const[Z,ue]=b1(T,U);if(Z==null||ue==null)return;const ge=ee===U.length-1?le-K:K,_e=Id(null,A.current,Z,ue,ge,X,M.current,null);if(X!==_e){const ye=_.current;I(_e),Dc(U,_e,ye)}},[]),q=Ja((T,B,X)=>{const{id:re,panels:le,sizes:se,units:K}=A.current;if((X||K)==="pixels"){const Pt=Wi(re);B=B/Pt*100}const U=le.get(T);if(U==null)return;let{collapsedSize:ee,collapsible:de,maxSize:Z,minSize:ue}=U.current;if(K==="pixels"){const Pt=Wi(re);ue=ue/Pt*100,Z!=null&&(Z=Z/Pt*100)}const fe=Fo(le),ge=fe.indexOf(U);if(ge<0)return;const _e=se[ge];if(_e===B)return;de&&B===ee||(B=Math.min(Z??100,Math.max(ue,B)));const[ye,pe]=b1(T,fe);if(ye==null||pe==null)return;const Ae=ge===fe.length-1?_e-B:B-_e,qe=Id(null,A.current,ye,pe,Ae,se,M.current,null);if(se!==qe){const Pt=_.current;I(qe),Dc(fe,qe,Pt)}},[]),z=tae(()=>({activeHandleId:x,collapsePanel:V,direction:r,expandPanel:Q,getPanelSize:D,getPanelStyle:R,groupId:g,registerPanel:N,registerResizeHandle:Y,resizePanel:q,startDragging:(T,B)=>{if(y(T),Xx(B)||Yx(B)){const X=d0(T);S.current={dragHandleRect:X.getBoundingClientRect(),dragOffset:F8(B,T,r),sizes:A.current.sizes}}},stopDragging:()=>{fae(),y(null),S.current=null},units:h,unregisterPanel:F}),[x,V,r,Q,D,R,g,N,Y,q,h,F]),G={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return ku(u0.Provider,{children:ku(m,{children:t,className:n,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":g,"data-panel-group-units":h,style:{...G,...p}}),value:z})}const f0=A8((e,t)=>ku(V8,{...e,forwardedRef:t}));V8.displayName="PanelGroup";f0.displayName="forwardRef(PanelGroup)";function Zx({children:e=null,className:t="",disabled:n=!1,id:r=null,onDragging:o,style:s={},tagName:i="div"}){const l=ns(null),u=ns({onDragging:o});ui(()=>{u.current.onDragging=o});const p=D8(u0);if(p===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{activeHandleId:m,direction:h,groupId:g,registerResizeHandle:x,startDragging:y,stopDragging:b}=p,C=E2(r),S=m===C,[j,_]=Ld(!1),[P,I]=Ld(null),M=Ja(()=>{l.current.blur(),b();const{onDragging:D}=u.current;D&&D(!1)},[b]);ui(()=>{if(n)I(null);else{const A=x(C);I(()=>A)}},[n,C,x]),ui(()=>{if(n||P==null||!S)return;const A=Y=>{P(Y)},D=Y=>{P(Y)},N=l.current.ownerDocument;return N.body.addEventListener("contextmenu",M),N.body.addEventListener("mousemove",A),N.body.addEventListener("touchmove",A),N.body.addEventListener("mouseleave",D),window.addEventListener("mouseup",M),window.addEventListener("touchend",M),()=>{N.body.removeEventListener("contextmenu",M),N.body.removeEventListener("mousemove",A),N.body.removeEventListener("touchmove",A),N.body.removeEventListener("mouseleave",D),window.removeEventListener("mouseup",M),window.removeEventListener("touchend",M)}},[h,n,S,P,M]),cae({disabled:n,handleId:C,resizeHandler:P});const O={cursor:B8(h),touchAction:"none",userSelect:"none"};return ku(i,{children:e,className:t,"data-resize-handle-active":S?"pointer":j?"keyboard":void 0,"data-panel-group-direction":h,"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}=u.current;D&&D(!0)},onMouseUp:M,onTouchCancel:M,onTouchEnd:M,onTouchStart:A=>{y(C,A.nativeEvent);const{onDragging:D}=u.current;D&&D(!0)},ref:l,role:"separator",style:{...O,...s},tabIndex:0})}Zx.displayName="PanelResizeHandle";const gae=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(Zx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx($,{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(De,{sx:{w:1,h:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})}):a.jsx(Zx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx($,{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(De,{sx:{h:1,w:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})})},Qh=d.memo(gae),R2=()=>{const e=te(),t=W(o=>o.ui.panels),n=d.useCallback(o=>t[o]??"",[t]),r=d.useCallback((o,s)=>{e(p7({name:o,value:s}))},[e]);return{getItem:n,setItem:r}};const vae=e=>{const{label:t,data:n,fileName:r,withDownload:o=!0,withCopy:s=!0}=e,i=d.useMemo(()=>m7(n)?n:JSON.stringify(n,null,2),[n]),l=d.useCallback(()=>{navigator.clipboard.writeText(i)},[i]),u=d.useCallback(()=>{const m=new Blob([i]),h=document.createElement("a");h.href=URL.createObjectURL(m),h.download=`${r||t}.json`,document.body.appendChild(h),h.click(),h.remove()},[i,t,r]),{t:p}=J();return a.jsxs($,{layerStyle:"second",sx:{borderRadius:"base",flexGrow:1,w:"full",h:"full",position:"relative"},children:[a.jsx(De,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"auto",p:4,fontSize:"sm"},children:a.jsx(e0,{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($,{sx:{position:"absolute",top:0,insetInlineEnd:0,p:2},children:[o&&a.jsx(Fn,{label:`${p("gallery.download")} ${t} JSON`,children:a.jsx(Pa,{"aria-label":`${p("gallery.download")} ${t} JSON`,icon:a.jsx(zu,{}),variant:"ghost",opacity:.7,onClick:u})}),s&&a.jsx(Fn,{label:`${p("gallery.copy")} ${t} JSON`,children:a.jsx(Pa,{"aria-label":`${p("gallery.copy")} ${t} JSON`,icon:a.jsx(Lu,{}),variant:"ghost",opacity:.7,onClick:l})})]})]})},Zi=d.memo(vae),xae=ce(we,({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}},je),bae=()=>{const{data:e}=W(xae);return e?a.jsx(Zi,{data:e,label:"Node Data"}):a.jsx(eo,{label:"No node selected",icon:null})},yae=d.memo(bae),Cae=({children:e,maxHeight:t})=>a.jsx($,{sx:{w:"full",h:"full",maxHeight:t,position:"relative"},children:a.jsx(De,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(e0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:e})})}),Hu=d.memo(Cae),wae=({output:e})=>{const{image:t}=e,{data:n}=Ps(t.image_name);return a.jsx(al,{imageDTO:n})},Sae=d.memo(wae),kae=ce(we,({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}},je),jae=()=>{const{node:e,template:t,nes:n}=W(kae),{t:r}=J();return!e||!n||!Or(e)?a.jsx(eo,{label:r("nodes.noNodeSelected"),icon:null}):n.outputs.length===0?a.jsx(eo,{label:r("nodes.noOutputRecorded"),icon:null}):a.jsx(De,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Hu,{children:a.jsx($,{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(Sae,{output:o},Iae(o,s))):a.jsx(Zi,{data:n.outputs,label:r("nodes.nodeOutputs")})})})})},_ae=d.memo(jae),Iae=(e,t)=>`${e.type}-${t}`,Pae=ce(we,({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}},je),Eae=()=>{const{template:e}=W(Pae),{t}=J();return e?a.jsx(Zi,{data:e,label:t("nodes.nodeTemplate")}):a.jsx(eo,{label:t("nodes.noNodeSelected"),icon:null})},Mae=d.memo(Eae),Oae=()=>a.jsx($,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(nc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(rc,{children:[a.jsx(Po,{children:"Outputs"}),a.jsx(Po,{children:"Data"}),a.jsx(Po,{children:"Template"})]}),a.jsxs(Tu,{children:[a.jsx(ss,{children:a.jsx(_ae,{})}),a.jsx(ss,{children:a.jsx(yae,{})}),a.jsx(ss,{children:a.jsx(Mae,{})})]})]})}),Rae=d.memo(Oae),A2=e=>{e.stopPropagation()},Aae={display:"flex",flexDirection:"row",alignItems:"center",gap:10},Dae=e=>{const{label:t="",labelPos:n="top",isDisabled:r=!1,isInvalid:o,formControlProps:s,...i}=e,l=te(),u=d.useCallback(m=>{m.shiftKey&&l(Vo(!0))},[l]),p=d.useCallback(m=>{m.shiftKey||l(Vo(!1))},[l]);return a.jsxs(Kn,{isInvalid:o,isDisabled:r,...s,style:n==="side"?Aae:void 0,children:[t!==""&&a.jsx(Rr,{children:t}),a.jsx(gg,{...i,onPaste:A2,onKeyDown:u,onKeyUp:p})]})},Cs=d.memo(Dae),Tae=Oe((e,t)=>{const n=te(),r=d.useCallback(s=>{s.shiftKey&&n(Vo(!0))},[n]),o=d.useCallback(s=>{s.shiftKey||n(Vo(!1))},[n]);return a.jsx(U5,{ref:t,onPaste:A2,onKeyDown:r,onKeyUp:o,...e})}),gi=d.memo(Tae),Nae=ce(we,({nodes:e})=>{const{author:t,name:n,description:r,tags:o,version:s,contact:i,notes:l}=e.workflow;return{name:n,author:t,description:r,tags:o,version:s,contact:i,notes:l}},je),$ae=()=>{const{author:e,name:t,description:n,tags:r,version:o,contact:s,notes:i}=W(Nae),l=te(),u=d.useCallback(C=>{l(h7(C.target.value))},[l]),p=d.useCallback(C=>{l(g7(C.target.value))},[l]),m=d.useCallback(C=>{l(v7(C.target.value))},[l]),h=d.useCallback(C=>{l(x7(C.target.value))},[l]),g=d.useCallback(C=>{l(b7(C.target.value))},[l]),x=d.useCallback(C=>{l(y7(C.target.value))},[l]),y=d.useCallback(C=>{l(C7(C.target.value))},[l]),{t:b}=J();return a.jsx(Hu,{children:a.jsxs($,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:[a.jsxs($,{sx:{gap:2,w:"full"},children:[a.jsx(Cs,{label:b("nodes.workflowName"),value:t,onChange:u}),a.jsx(Cs,{label:b("nodes.workflowVersion"),value:o,onChange:h})]}),a.jsxs($,{sx:{gap:2,w:"full"},children:[a.jsx(Cs,{label:b("nodes.workflowAuthor"),value:e,onChange:p}),a.jsx(Cs,{label:b("nodes.workflowContact"),value:s,onChange:m})]}),a.jsx(Cs,{label:b("nodes.workflowTags"),value:r,onChange:x}),a.jsxs(Kn,{as:$,sx:{flexDir:"column"},children:[a.jsx(Rr,{children:b("nodes.workflowDescription")}),a.jsx(gi,{onChange:g,value:n,fontSize:"sm",sx:{resize:"none"}})]}),a.jsxs(Kn,{as:$,sx:{flexDir:"column",h:"full"},children:[a.jsx(Rr,{children:b("nodes.workflowNotes")}),a.jsx(gi,{onChange:y,value:i,fontSize:"sm",sx:{h:"full",resize:"none"}})]})]})})},Lae=d.memo($ae),U8=()=>{const e=W(r=>r.nodes),[t]=k2(e,300);return d.useMemo(()=>w7(t),[t])},zae=()=>{const e=U8(),{t}=J();return a.jsx($,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:a.jsx(Zi,{data:e,label:t("nodes.workflow")})})},Fae=d.memo(zae),Bae=({isSelected:e,isHovered:t})=>{const n=d.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.light";if(e)return"nodeSelected.light";if(t)return"nodeHovered.light"},[t,e]),r=d.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.dark";if(e)return"nodeSelected.dark";if(t)return"nodeHovered.dark"},[t,e]);return a.jsx(De,{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}}})},G8=d.memo(Bae),q8=e=>{const t=te(),n=d.useMemo(()=>ce(we,({nodes:i})=>i.mouseOverNode===e,je),[e]),r=W(n),o=d.useCallback(()=>{!r&&t(Fw(e))},[t,e,r]),s=d.useCallback(()=>{r&&t(Fw(null))},[t,r]);return{isMouseOverNode:r,handleMouseOver:o,handleMouseOut:s}},K8=(e,t)=>{const n=d.useMemo(()=>ce(we,({nodes:o})=>{var i;const s=o.nodes.find(l=>l.id===e);if(Or(s))return(i=s==null?void 0:s.data.inputs[t])==null?void 0:i.label},je),[t,e]);return W(n)},Q8=(e,t,n)=>{const r=d.useMemo(()=>ce(we,({nodes:s})=>{var u;const i=s.nodes.find(p=>p.id===e);if(!Or(i))return;const l=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return(u=l==null?void 0:l[Db[n]][t])==null?void 0:u.title},je),[t,n,e]);return W(r)},X8=(e,t)=>{const n=d.useMemo(()=>ce(we,({nodes:o})=>{const s=o.nodes.find(i=>i.id===e);if(Or(s))return s==null?void 0:s.data.inputs[t]},je),[t,e]);return W(n)},p0=(e,t,n)=>{const r=d.useMemo(()=>ce(we,({nodes:s})=>{const i=s.nodes.find(u=>u.id===e);if(!Or(i))return;const l=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return l==null?void 0:l[Db[n]][t]},je),[t,n,e]);return W(r)},Hae=({nodeId:e,fieldName:t,kind:n})=>{const r=X8(e,t),o=p0(e,t,n),s=S7(o),{t:i}=J(),l=d.useMemo(()=>k7(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($,{sx:{flexDir:"column"},children:[a.jsx(Se,{sx:{fontWeight:600},children:l}),o&&a.jsx(Se,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:o.description}),o&&a.jsxs(Se,{children:["Type: ",vf[o.type].title]}),s&&a.jsxs(Se,{children:["Input: ",j7(o.input)]})]})},D2=d.memo(Hae),Wae=Oe((e,t)=>{const{nodeId:n,fieldName:r,kind:o,isMissingInput:s=!1,withTooltip:i=!1}=e,l=K8(n,r),u=Q8(n,r,o),{t:p}=J(),m=te(),[h,g]=d.useState(l||u||p("nodes.unknownField")),x=d.useCallback(async b=>{b&&(b===l||b===u)||(g(b||u||p("nodes.unknownField")),m(_7({nodeId:n,fieldName:r,label:b})))},[l,u,m,n,r,p]),y=d.useCallback(b=>{g(b)},[]);return d.useEffect(()=>{g(l||u||p("nodes.unknownField"))},[l,u,p]),a.jsx(Fn,{label:i?a.jsx(D2,{nodeId:n,fieldName:r,kind:"input"}):void 0,openDelay:ag,placement:"top",hasArrow:!0,children:a.jsx($,{ref:t,sx:{position:"relative",overflow:"hidden",alignItems:"center",justifyContent:"flex-start",gap:1,h:"full"},children:a.jsxs(pg,{value:h,onChange:y,onSubmit:x,as:$,sx:{position:"relative",alignItems:"center",h:"full"},children:[a.jsx(fg,{sx:{p:0,fontWeight:s?600:400,textAlign:"left",_hover:{fontWeight:"600 !important"}},noOfLines:1}),a.jsx(dg,{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(J8,{})]})})})}),Y8=d.memo(Wae),J8=d.memo(()=>{const{isEditing:e,getEditButtonProps:t}=YP(),n=d.useCallback(r=>{const{onClick:o}=t();o&&(o(r),r.preventDefault())},[t]);return e?null:a.jsx($,{onClick:n,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,cursor:"text"})});J8.displayName="EditableControls";const Vae=e=>{const{nodeId:t,field:n}=e,r=te(),o=d.useCallback(s=>{r(I7({nodeId:t,fieldName:n.name,value:s.target.checked}))},[r,n.name,t]);return a.jsx(jy,{className:"nodrag",onChange:o,isChecked:n.value})},Uae=d.memo(Vae);function m0(){return(m0=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function eb(e){var t=d.useRef(e),n=d.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var ju=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(b_(o.current,C,l.current)):b(!1)},y=function(){return b(!1)};function b(C){var S=u.current,j=tb(o.current),_=C?j.addEventListener:j.removeEventListener;_(S?"touchmove":"mousemove",x),_(S?"touchend":"mouseup",y)}return[function(C){var S=C.nativeEvent,j=o.current;if(j&&(y_(S),!function(P,I){return I&&!Fd(P)}(S,u.current)&&j)){if(Fd(S)){u.current=!0;var _=S.changedTouches||[];_.length&&(l.current=_[0].identifier)}j.focus(),s(b_(j,S,l.current)),b(!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}))},b]},[i,s]),m=p[0],h=p[1],g=p[2];return d.useEffect(function(){return g},[g]),H.createElement("div",m0({},r,{onTouchStart:m,onMouseDown:m,className:"react-colorful__interactive",ref:o,onKeyDown:h,tabIndex:0,role:"slider"}))}),h0=function(e){return e.filter(Boolean).join(" ")},N2=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=h0(["react-colorful__pointer",e.className]);return H.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},H.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Mo=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},eR=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:Mo(e.h),s:Mo(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:Mo(o/2),a:Mo(r,2)}},nb=function(e){var t=eR(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},k1=function(e){var t=eR(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},Gae=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),l=r*(1-(t-s)*n),u=r*(1-(1-t+s)*n),p=s%6;return{r:Mo(255*[r,l,i,i,u,r][p]),g:Mo(255*[u,r,r,l,i,i][p]),b:Mo(255*[i,i,u,r,r,l][p]),a:Mo(o,2)}},qae=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),l=i?s===t?(n-r)/i:s===n?2+(r-t)/i:4+(t-n)/i:0;return{h:Mo(60*(l<0?l+6:l)),s:Mo(s?i/s*100:0),v:Mo(s/255*100),a:o}},Kae=H.memo(function(e){var t=e.hue,n=e.onChange,r=h0(["react-colorful__hue",e.className]);return H.createElement("div",{className:r},H.createElement(T2,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:ju(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":Mo(t),"aria-valuemax":"360","aria-valuemin":"0"},H.createElement(N2,{className:"react-colorful__hue-pointer",left:t/360,color:nb({h:t,s:100,v:100,a:1})})))}),Qae=H.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:nb({h:t.h,s:100,v:100,a:1})};return H.createElement("div",{className:"react-colorful__saturation",style:r},H.createElement(T2,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:ju(t.s+100*o.left,0,100),v:ju(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Mo(t.s)+"%, Brightness "+Mo(t.v)+"%"},H.createElement(N2,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:nb(t)})))}),tR=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function Xae(e,t,n){var r=eb(n),o=d.useState(function(){return e.toHsva(t)}),s=o[0],i=o[1],l=d.useRef({color:t,hsva:s});d.useEffect(function(){if(!e.equal(t,l.current.color)){var p=e.toHsva(t);l.current={hsva:p,color:t},i(p)}},[t,e]),d.useEffect(function(){var p;tR(s,l.current.hsva)||e.equal(p=e.fromHsva(s),l.current.color)||(l.current={hsva:s,color:p},r(p))},[s,e,r]);var u=d.useCallback(function(p){i(function(m){return Object.assign({},m,p)})},[]);return[s,u]}var Yae=typeof window<"u"?d.useLayoutEffect:d.useEffect,Jae=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},C_=new Map,Zae=function(e){Yae(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!C_.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}`,C_.set(t,n);var r=Jae();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},eie=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+k1(Object.assign({},n,{a:0}))+", "+k1(Object.assign({},n,{a:1}))+")"},s=h0(["react-colorful__alpha",t]),i=Mo(100*n.a);return H.createElement("div",{className:s},H.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),H.createElement(T2,{onMove:function(l){r({a:l.left})},onKey:function(l){r({a:ju(n.a+l.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},H.createElement(N2,{className:"react-colorful__alpha-pointer",left:n.a,color:k1(n)})))},tie=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,i=Z8(e,["className","colorModel","color","onChange"]),l=d.useRef(null);Zae(l);var u=Xae(n,o,s),p=u[0],m=u[1],h=h0(["react-colorful",t]);return H.createElement("div",m0({},i,{ref:l,className:h}),H.createElement(Qae,{hsva:p,onChange:m}),H.createElement(Kae,{hue:p.h,onChange:m}),H.createElement(eie,{hsva:p,onChange:m,className:"react-colorful__last-control"}))},nie={defaultColor:{r:0,g:0,b:0,a:1},toHsva:qae,fromHsva:Gae,equal:tR},nR=function(e){return H.createElement(tie,m0({},e,{colorModel:nie}))};const rie=e=>{const{nodeId:t,field:n}=e,r=te(),o=d.useCallback(s=>{r(P7({nodeId:t,fieldName:n.name,value:s}))},[r,n.name,t]);return a.jsx(nR,{className:"nodrag",color:n.value,onChange:o})},oie=d.memo(rie),rR=e=>{const t=yi("models"),[n,r,o]=e.split("/"),s=E7.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},sie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Cb(),i=d.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]),l=d.useMemo(()=>{if(!s)return[];const p=[];return qr(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:gr[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=rR(p);m&&o(M7({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(Tr,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},aie=d.memo(sie),iie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),s=d.useCallback(i=>{o(O7({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return a.jsx(_5,{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))})},lie=d.memo(iie),cie=e=>{var p;const{nodeId:t,field:n}=e,r=te(),{currentData:o}=Ps(((p=n.value)==null?void 0:p.image_name)??Os.skipToken),s=d.useCallback(()=>{r(R7({nodeId:t,fieldName:n.name,value:void 0}))},[r,n.name,t]),i=d.useMemo(()=>{if(o)return{id:`node-${t}-${n.name}`,payloadType:"IMAGE_DTO",payload:{imageDTO:o}}},[n.name,o,t]),l=d.useMemo(()=>({id:`node-${t}-${n.name}`,actionType:"SET_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}}),[n.name,t]),u=d.useMemo(()=>({type:"SET_NODES_IMAGE",nodeId:t,fieldName:n.name}),[t,n.name]);return a.jsx($,{className:"nodrag",sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(al,{imageDTO:o,droppableData:l,draggableData:i,postUploadAction:u,useThumbailFallback:!0,uploadElement:a.jsx(oR,{}),dropLabel:a.jsx(sR,{}),minSize:8,children:a.jsx(du,{onClick:s,icon:o?a.jsx(qg,{}):void 0,tooltip:"Reset Image"})})})},uie=d.memo(cie),oR=d.memo(()=>a.jsx(Se,{fontSize:16,fontWeight:600,children:"Drop or Upload"}));oR.displayName="UploadElement";const sR=d.memo(()=>a.jsx(Se,{fontSize:16,fontWeight:600,children:"Drop"}));sR.displayName="DropLabel";const die=e=>{const t=yi("models"),[n,r,o]=e.split("/"),s=A7.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},fie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=gf(),{t:i}=J(),l=d.useMemo(()=>{if(!s)return[];const m=[];return qr(s.entities,(h,g)=>{h&&m.push({value:g,label:h.model_name,group:gr[h.base_model]})}),m.sort((h,g)=>h.disabled&&!g.disabled?1:-1)},[s]),u=d.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=d.useCallback(m=>{if(!m)return;const h=die(m);h&&o(D7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return(s==null?void 0:s.ids.length)===0?a.jsx($,{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:(u==null?void 0:u.id)??null,placeholder:l.length>0?i("models.selectLoRA"):i("models.noLoRAsAvailable"),data:l,nothingFound:i("models.noMatchingLoRAs"),itemComponent:fl,disabled:l.length===0,filter:(m,h)=>{var g;return((g=h.label)==null?void 0:g.toLowerCase().includes(m.toLowerCase().trim()))||h.value.toLowerCase().includes(m.toLowerCase().trim())},error:!u,onChange:p,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},pie=d.memo(fie),g0=e=>{const t=yi("models"),[n,r,o]=e.split("/"),s=T7.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 Wu(e){const{iconMode:t=!1,...n}=e,r=te(),{t:o}=J(),[s,{isLoading:i}]=N7(),l=()=>{s().unwrap().then(u=>{r($t(Gn({title:`${o("modelManager.modelsSynced")}`,status:"success"})))}).catch(u=>{u&&r($t(Gn({title:`${o("modelManager.modelSyncFailed")}`,status:"error"})))})};return t?a.jsx(ot,{icon:a.jsx(JM,{}),tooltip:o("modelManager.syncModels"),"aria-label":o("modelManager.syncModels"),isLoading:i,onClick:l,size:"sm",...n}):a.jsx(Mt,{isLoading:i,onClick:l,minW:"max-content",...n,children:"Sync Models"})}const mie=e=>{var y,b;const{nodeId:t,field:n}=e,r=te(),o=jn("syncModels").isFeatureEnabled,{t:s}=J(),{data:i,isLoading:l}=Bd(Bw),{data:u,isLoading:p}=na(Bw),m=d.useMemo(()=>l||p,[l,p]),h=d.useMemo(()=>{if(!u)return[];const C=[];return qr(u.entities,(S,j)=>{S&&C.push({value:j,label:S.model_name,group:gr[S.base_model]})}),i&&qr(i.entities,(S,j)=>{S&&C.push({value:j,label:S.model_name,group:gr[S.base_model]})}),C},[u,i]),g=d.useMemo(()=>{var C,S,j,_;return((u==null?void 0:u.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,(b=n.value)==null?void 0:b.model_name,u==null?void 0:u.entities,i==null?void 0:i.entities]),x=d.useCallback(C=>{if(!C)return;const S=g0(C);S&&r(tP({nodeId:t,fieldName:n.name,value:S}))},[r,n.name,t]);return a.jsxs($,{sx:{w:"full",alignItems:"center",gap:2},children:[m?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:h.length>0?s("models.selectModel"):s("models.noModelsAvailable"),data:h,error:!g,disabled:h.length===0,onChange:x,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),o&&a.jsx(Wu,{className:"nodrag",iconMode:!0})]})},hie=d.memo(mie),Xh=/^-?(0\.)?\.?$/,aR=Oe((e,t)=>{const{label:n,isDisabled:r=!1,showStepper:o=!0,isInvalid:s,value:i,onChange:l,min:u,max:p,isInteger:m=!0,formControlProps:h,formLabelProps:g,numberInputFieldProps:x,numberInputStepperProps:y,tooltipProps:b,...C}=e,S=te(),[j,_]=d.useState(String(i));d.useEffect(()=>{!j.match(Xh)&&i!==Number(j)&&_(String(i))},[i,j]);const P=A=>{_(A),A.match(Xh)||l(m?Math.floor(Number(A)):Number(A))},I=A=>{const D=Fl(m?Math.floor(Number(A.target.value)):Number(A.target.value),u,p);_(String(D)),l(D)},M=d.useCallback(A=>{A.shiftKey&&S(Vo(!0))},[S]),O=d.useCallback(A=>{A.shiftKey||S(Vo(!1))},[S]);return a.jsx(Fn,{...b,children:a.jsxs(Kn,{ref:t,isDisabled:r,isInvalid:s,...h,children:[n&&a.jsx(Rr,{...g,children:n}),a.jsxs(Sg,{value:j,min:u,max:p,keepWithinRange:!0,clampValueOnBlur:!1,onChange:P,onBlur:I,...C,onPaste:A2,children:[a.jsx(jg,{...x,onKeyDown:M,onKeyUp:O}),o&&a.jsxs(kg,{children:[a.jsx(Ig,{...y}),a.jsx(_g,{...y})]})]})]})})});aR.displayName="IAINumberInput";const Vu=d.memo(aR),gie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),[s,i]=d.useState(String(n.value)),l=d.useMemo(()=>r.type==="integer",[r.type]),u=p=>{i(p),p.match(Xh)||o($7({nodeId:t,fieldName:n.name,value:l?Math.floor(Number(p)):Number(p)}))};return d.useEffect(()=>{!s.match(Xh)&&n.value!==Number(s)&&i(String(n.value))},[n.value,s]),a.jsxs(Sg,{onChange:u,value:s,step:l?1:.1,precision:l?0:3,children:[a.jsx(jg,{className:"nodrag"}),a.jsxs(kg,{children:[a.jsx(Ig,{}),a.jsx(_g,{})]})]})},vie=d.memo(gie),xie=e=>{var h,g;const{nodeId:t,field:n}=e,r=te(),{t:o}=J(),s=jn("syncModels").isFeatureEnabled,{data:i,isLoading:l}=na(Tb),u=d.useMemo(()=>{if(!i)return[];const x=[];return qr(i.entities,(y,b)=>{y&&x.push({value:b,label:y.model_name,group:gr[y.base_model]})}),x},[i]),p=d.useMemo(()=>{var x,y;return(i==null?void 0:i.entities[`${(x=n.value)==null?void 0:x.base_model}/main/${(y=n.value)==null?void 0:y.model_name}`])??null},[(h=n.value)==null?void 0:h.base_model,(g=n.value)==null?void 0:g.model_name,i==null?void 0:i.entities]),m=d.useCallback(x=>{if(!x)return;const y=g0(x);y&&r(L7({nodeId:t,fieldName:n.name,value:y}))},[r,n.name,t]);return l?a.jsx(tr,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs($,{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:u.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:u,error:!p,disabled:u.length===0,onChange:m,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Wu,{className:"nodrag",iconMode:!0})]})},bie=d.memo(xie),yie=e=>{var g,x;const{nodeId:t,field:n}=e,r=te(),{t:o}=J(),s=jn("syncModels").isFeatureEnabled,{data:i}=Bd(Hw),{data:l,isLoading:u}=na(Hw),p=d.useMemo(()=>{if(!l)return[];const y=[];return qr(l.entities,(b,C)=>{!b||b.base_model!=="sdxl"||y.push({value:C,label:b.model_name,group:gr[b.base_model]})}),i&&qr(i.entities,(b,C)=>{!b||b.base_model!=="sdxl"||y.push({value:C,label:b.model_name,group:gr[b.base_model]})}),y},[l,i]),m=d.useMemo(()=>{var y,b,C,S;return((l==null?void 0:l.entities[`${(y=n.value)==null?void 0:y.base_model}/main/${(b=n.value)==null?void 0:b.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,(x=n.value)==null?void 0:x.model_name,l==null?void 0:l.entities,i==null?void 0:i.entities]),h=d.useCallback(y=>{if(!y)return;const b=g0(y);b&&r(tP({nodeId:t,fieldName:n.name,value:b}))},[r,n.name,t]);return u?a.jsx(tr,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs($,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(tr,{className:"nowheel nodrag",tooltip:m==null?void 0:m.description,value:m==null?void 0:m.id,placeholder:p.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:p,error:!m,disabled:p.length===0,onChange:h,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Wu,{className:"nodrag",iconMode:!0})]})},Cie=d.memo(yie),wie=ce([we],({ui:e})=>{const{favoriteSchedulers:t}=e;return{data:Ro(tg,(r,o)=>({value:o,label:r,group:t.includes(o)?"Favorites":void 0})).sort((r,o)=>r.label.localeCompare(o.label))}},je),Sie=e=>{const{nodeId:t,field:n}=e,r=te(),{data:o}=W(wie),s=d.useCallback(i=>{i&&r(z7({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})},kie=d.memo(Sie),jie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),s=d.useCallback(i=>{o(F7({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return r.ui_component==="textarea"?a.jsx(gi,{className:"nodrag",onChange:s,value:n.value,rows:5,resize:"none"}):a.jsx(Cs,{onChange:s,value:n.value})},_ie=d.memo(jie),iR=e=>{const t=yi("models"),[n,r,o]=e.split("/"),s=B7.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},Iie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=nP(),i=d.useMemo(()=>{if(!s)return[];const p=[{value:"default",label:"Default",group:"Default"}];return qr(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:gr[m.base_model]})}),p.sort((m,h)=>m.disabled&&!h.disabled?1:-1)},[s]),l=d.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]),u=d.useCallback(p=>{if(!p)return;const m=iR(p);m&&o(H7({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(tr,{className:"nowheel nodrag",itemComponent:fl,tooltip:l==null?void 0:l.description,value:(l==null?void 0:l.id)??"default",placeholder:"Default",data:i,onChange:u,disabled:i.length===0,error:!l,clearable:!0,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Pie=d.memo(Iie),Eie=e=>{const t=yi("models"),[n,r,o]=e.split("/"),s=W7.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},Mie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Sb(),i=d.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]),l=d.useMemo(()=>{if(!s)return[];const p=[];return qr(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:gr[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=Eie(p);m&&o(V7({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(Tr,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},Oie=d.memo(Mie),Rie=e=>{const t=yi("models"),[n,r,o]=e.split("/"),s=U7.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},Aie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=wb(),i=d.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]),l=d.useMemo(()=>{if(!s)return[];const p=[];return qr(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:gr[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=Rie(p);m&&o(G7({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(Tr,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},Die=d.memo(Aie),Tie=e=>{var l;const{nodeId:t,field:n}=e,r=te(),{data:o,hasBoards:s}=hf(void 0,{selectFromResult:({data:u})=>{const p=[{label:"None",value:"none"}];return u==null||u.forEach(({board_id:m,board_name:h})=>{p.push({label:h,value:m})}),{data:p,hasBoards:p.length>1}}}),i=d.useCallback(u=>{r(q7({nodeId:t,fieldName:n.name,value:u&&u!=="none"?{board_id:u}:void 0}))},[r,n.name,t]);return a.jsx(tr,{className:"nowheel nodrag",value:((l=n.value)==null?void 0:l.board_id)??"none",data:o,onChange:i,disabled:!s})},Nie=d.memo(Tie),$ie=({nodeId:e,fieldName:t})=>{const n=X8(e,t),r=p0(e,t,"input");return(r==null?void 0:r.fieldKind)==="output"?a.jsxs(De,{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(_ie,{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(Uae,{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(vie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="enum"&&(r==null?void 0:r.type)==="enum"?a.jsx(lie,{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(uie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="BoardField"&&(r==null?void 0:r.type)==="BoardField"?a.jsx(Nie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="MainModelField"&&(r==null?void 0:r.type)==="MainModelField"?a.jsx(hie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLRefinerModelField"&&(r==null?void 0:r.type)==="SDXLRefinerModelField"?a.jsx(bie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="VaeModelField"&&(r==null?void 0:r.type)==="VaeModelField"?a.jsx(Pie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="LoRAModelField"&&(r==null?void 0:r.type)==="LoRAModelField"?a.jsx(pie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ControlNetModelField"&&(r==null?void 0:r.type)==="ControlNetModelField"?a.jsx(aie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="IPAdapterModelField"&&(r==null?void 0:r.type)==="IPAdapterModelField"?a.jsx(Oie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="T2IAdapterModelField"&&(r==null?void 0:r.type)==="T2IAdapterModelField"?a.jsx(Die,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ColorField"&&(r==null?void 0:r.type)==="ColorField"?a.jsx(oie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLMainModelField"&&(r==null?void 0:r.type)==="SDXLMainModelField"?a.jsx(Cie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="Scheduler"&&(r==null?void 0:r.type)==="Scheduler"?a.jsx(kie,{nodeId:e,field:n,fieldTemplate:r}):n&&r?null:a.jsx(De,{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]})})},lR=d.memo($ie),Lie=({nodeId:e,fieldName:t})=>{const n=te(),{isMouseOverNode:r,handleMouseOut:o,handleMouseOver:s}=q8(e),{t:i}=J(),l=d.useCallback(()=>{n(rP({nodeId:e,fieldName:t}))},[n,t,e]);return a.jsxs($,{onMouseEnter:s,onMouseLeave:o,layerStyle:"second",sx:{position:"relative",borderRadius:"base",w:"full",p:2},children:[a.jsxs(Kn,{as:$,sx:{flexDir:"column",gap:1,flexShrink:1},children:[a.jsxs(Rr,{sx:{display:"flex",alignItems:"center",mb:0},children:[a.jsx(Y8,{nodeId:e,fieldName:t,kind:"input"}),a.jsx(ki,{}),a.jsx(Fn,{label:a.jsx(D2,{nodeId:e,fieldName:t,kind:"input"}),openDelay:ag,placement:"top",hasArrow:!0,children:a.jsx($,{h:"full",alignItems:"center",children:a.jsx(Lr,{as:UM})})}),a.jsx(ot,{"aria-label":i("nodes.removeLinearView"),tooltip:i("nodes.removeLinearView"),variant:"ghost",size:"sm",onClick:l,icon:a.jsx(qo,{})})]}),a.jsx(lR,{nodeId:e,fieldName:t})]}),a.jsx(G8,{isSelected:!1,isHovered:r})]})},zie=d.memo(Lie),Fie=ce(we,({nodes:e})=>({fields:e.workflow.exposedFields}),je),Bie=()=>{const{fields:e}=W(Fie),{t}=J();return a.jsx(De,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Hu,{children:a.jsx($,{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(zie,{nodeId:n,fieldName:r},`${n}.${r}`)):a.jsx(eo,{label:t("nodes.noFieldsLinearview"),icon:null})})})})},Hie=d.memo(Bie),Wie=()=>a.jsx($,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(nc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(rc,{children:[a.jsx(Po,{children:"Linear"}),a.jsx(Po,{children:"Details"}),a.jsx(Po,{children:"JSON"})]}),a.jsxs(Tu,{children:[a.jsx(ss,{children:a.jsx(Hie,{})}),a.jsx(ss,{children:a.jsx(Lae,{})}),a.jsx(ss,{children:a.jsx(Fae,{})})]})]})}),Vie=d.memo(Wie),Uie={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"}},Gie=1e3,qie=[{name:"preventOverflow",options:{padding:10}}],cR=Oe(({feature:e,children:t,wrapperProps:n,...r},o)=>{const{t:s}=J(),i=W(g=>g.system.shouldEnableInformationalPopovers),l=d.useMemo(()=>Uie[e],[e]),u=d.useMemo(()=>K7(Q7(l,["image","href","buttonLabel"]),r),[l,r]),p=d.useMemo(()=>s(`popovers.${e}.heading`),[e,s]),m=d.useMemo(()=>s(`popovers.${e}.paragraphs`,{returnObjects:!0})??[],[e,s]),h=d.useCallback(()=>{l!=null&&l.href&&window.open(l.href)},[l==null?void 0:l.href]);return i?a.jsxs(Af,{isLazy:!0,closeOnBlur:!1,trigger:"hover",variant:"informational",openDelay:Gie,modifiers:qie,placement:"top",...u,children:[a.jsx(Eg,{children:a.jsx(De,{ref:o,w:"full",...n,children:t})}),a.jsx(Eu,{children:a.jsxs(Df,{w:96,children:[a.jsx(b5,{}),a.jsx(Mg,{children:a.jsxs($,{sx:{gap:2,flexDirection:"column",alignItems:"flex-start"},children:[p&&a.jsxs(a.Fragment,{children:[a.jsx(xo,{size:"sm",children:p}),a.jsx(no,{})]}),(l==null?void 0:l.image)&&a.jsxs(a.Fragment,{children:[a.jsx(wi,{sx:{objectFit:"contain",maxW:"60%",maxH:"60%",backgroundColor:"white"},src:l.image,alt:"Optional Image"}),a.jsx(no,{})]}),m.map(g=>a.jsx(Se,{children:g},g)),(l==null?void 0:l.href)&&a.jsxs(a.Fragment,{children:[a.jsx(no,{}),a.jsx(el,{pt:1,onClick:h,leftIcon:a.jsx(Vy,{}),alignSelf:"flex-end",variant:"link",children:s("common.learnMore")??p})]})]})})]})})]}):a.jsx(De,{ref:o,w:"full",...n,children:t})});cR.displayName="IAIInformationalPopover";const wn=d.memo(cR),Kie=ce([we],e=>{const{initial:t,min:n,sliderMax:r,inputMax:o,fineStep:s,coarseStep:i}=e.config.sd.iterations,{iterations:l}=e.generation,{shouldUseSliders:u}=e.ui,p=e.hotkeys.shift?s:i;return{iterations:l,initial:t,min:n,sliderMax:r,inputMax:o,step:p,shouldUseSliders:u}},je),Qie=({asSlider:e})=>{const{iterations:t,initial:n,min:r,sliderMax:o,inputMax:s,step:i,shouldUseSliders:l}=W(Kie),u=te(),{t:p}=J(),m=d.useCallback(g=>{u(Ww(g))},[u]),h=d.useCallback(()=>{u(Ww(n))},[u,n]);return e||l?a.jsx(wn,{feature:"paramIterations",children:a.jsx(jt,{label:p("parameters.iterations"),step:i,min:r,max:o,onChange:m,handleReset:h,value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s}})}):a.jsx(wn,{feature:"paramIterations",children:a.jsx(Vu,{label:p("parameters.iterations"),step:i,min:r,max:s,onChange:m,value:t,numberInputFieldProps:{textAlign:"center"}})})},ua=d.memo(Qie),Xie=()=>{const[e,t]=d.useState(!1),[n,r]=d.useState(!1),o=d.useRef(null),s=R2(),i=d.useCallback(()=>{o.current&&o.current.setLayout([50,50])},[]);return a.jsxs($,{sx:{flexDir:"column",gap:2,height:"100%",width:"100%"},children:[a.jsx(O8,{}),a.jsx($,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,pb:3,gap:2,flexDir:"column"},children:a.jsx(ua,{asSlider:!0})}),a.jsxs(f0,{ref:o,id:"workflow-panel-group",autoSaveId:"workflow-panel-group",direction:"vertical",style:{height:"100%",width:"100%"},storage:s,children:[a.jsx(Ji,{id:"workflow",collapsible:!0,onCollapse:t,minSize:25,children:a.jsx(Vie,{})}),a.jsx(Qh,{direction:"vertical",onDoubleClick:i,collapsedDirection:e?"top":n?"bottom":void 0}),a.jsx(Ji,{id:"inspector",collapsible:!0,onCollapse:r,minSize:25,children:a.jsx(Rae,{})})]})]})},Yie=d.memo(Xie),w_=(e,t)=>{const n=d.useRef(null),[r,o]=d.useState(()=>{var p;return!!((p=n.current)!=null&&p.getCollapsed())}),s=d.useCallback(()=>{var p;(p=n.current)!=null&&p.getCollapsed()?rs.flushSync(()=>{var m;(m=n.current)==null||m.expand()}):rs.flushSync(()=>{var m;(m=n.current)==null||m.collapse()})},[]),i=d.useCallback(()=>{rs.flushSync(()=>{var p;(p=n.current)==null||p.expand()})},[]),l=d.useCallback(()=>{rs.flushSync(()=>{var p;(p=n.current)==null||p.collapse()})},[]),u=d.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:u,toggle:s,expand:i,collapse:l}},Jie=({isGalleryCollapsed:e,galleryPanelRef:t})=>{const{t:n}=J(),r=()=>{var o;(o=t.current)==null||o.expand()};return e?a.jsx(Eu,{children:a.jsx($,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineEnd:"1.63rem",children:a.jsx(ot,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":n("accessibility.showGalleryPanel"),onClick:r,icon:a.jsx(Yoe,{}),sx:{p:0,px:3,h:48,borderEndRadius:0}})})}):null},Zie=d.memo(Jie),mm={borderStartRadius:0,flexGrow:1},ele=({isSidePanelCollapsed:e,sidePanelRef:t})=>{const{t:n}=J(),r=()=>{var o;(o=t.current)==null||o.expand()};return e?a.jsx(Eu,{children:a.jsxs($,{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(ot,{tooltip:n("parameters.showOptionsPanel"),"aria-label":n("parameters.showOptionsPanel"),onClick:r,sx:mm,icon:a.jsx(YM,{})}),a.jsx(P8,{asIconButton:!0,sx:mm}),a.jsx(S8,{asIconButton:!0,sx:mm})]}),a.jsx(I2,{asIconButton:!0,sx:mm})]})}):null},tle=d.memo(ele),nle=e=>{const{label:t,activeLabel:n,children:r,defaultIsOpen:o=!1}=e,{isOpen:s,onToggle:i}=Uo({defaultIsOpen:o}),{colorMode:l}=Ci();return a.jsxs(De,{children:[a.jsxs($,{onClick:i,sx:{alignItems:"center",p:2,px:4,gap:2,borderTopRadius:"base",borderBottomRadius:s?0:"base",bg:Ke("base.250","base.750")(l),color:Ke("base.900","base.100")(l),_hover:{bg:Ke("base.300","base.700")(l)},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(Mr.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(ki,{}),a.jsx(t0,{sx:{w:"1rem",h:"1rem",transform:s?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]}),a.jsx(wf,{in:s,animateOpacity:!0,style:{overflow:"unset"},children:a.jsx(De,{sx:{p:4,pb:4,borderBottomRadius:"base",bg:"base.150",_dark:{bg:"base.800"}},children:r})})]})},Ao=d.memo(nle),rle=ce(we,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}},je),ole=()=>{const{maxPrompts:e,min:t,sliderMax:n,inputMax:r,isDisabled:o}=W(rle),s=te(),{t:i}=J(),l=d.useCallback(p=>{s(X7(p))},[s]),u=d.useCallback(()=>{s(Y7())},[s]);return a.jsx(wn,{feature:"dynamicPromptsMaxPrompts",children:a.jsx(jt,{label:i("dynamicPrompts.maxPrompts"),isDisabled:o,min:t,max:n,value:e,onChange:l,sliderNumberInputProps:{max:r},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})})},sle=d.memo(ole),ale=ce(we,e=>{const{isLoading:t,isError:n,prompts:r,parsingError:o}=e.dynamicPrompts;return{prompts:r,parsingError:o,isError:n,isLoading:t}},je),ile={"&::marker":{color:"base.500",_dark:{color:"base.500"}}},lle=()=>{const{prompts:e,parsingError:t,isLoading:n,isError:r}=W(ale);return r?a.jsx(wn,{feature:"dynamicPrompts",children:a.jsx($,{w:"full",h:"full",layerStyle:"second",alignItems:"center",justifyContent:"center",p:8,children:a.jsx(eo,{icon:Uoe,label:"Problem generating prompts"})})}):a.jsx(wn,{feature:"dynamicPrompts",children:a.jsxs(Kn,{isInvalid:!!t,children:[a.jsxs(Rr,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:["Prompts Preview (",e.length,")",t&&` - ${t}`]}),a.jsxs($,{h:64,pos:"relative",layerStyle:"third",borderRadius:"base",p:2,children:[a.jsx(Hu,{children:a.jsx(B3,{stylePosition:"inside",ms:0,children:e.map((o,s)=>a.jsx(ws,{fontSize:"sm",sx:ile,children:a.jsx(Se,{as:"span",children:o})},`${o}.${s}`))})}),n&&a.jsx($,{pos:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,layerStyle:"second",opacity:.7,alignItems:"center",justifyContent:"center",children:a.jsx(vi,{})})]})]})})},cle=d.memo(lle),uR=d.forwardRef(({label:e,description:t,...n},r)=>a.jsx(De,{ref:r,...n,children:a.jsxs(De,{children:[a.jsx(Se,{fontWeight:600,children:e}),t&&a.jsx(Se,{size:"xs",variant:"subtext",children:t})]})}));uR.displayName="IAIMantineSelectItemWithDescription";const ule=d.memo(uR),dle=()=>{const e=te(),{t}=J(),n=W(s=>s.dynamicPrompts.seedBehaviour),r=d.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=d.useCallback(s=>{s&&e(J7(s))},[e]);return a.jsx(wn,{feature:"dynamicPromptsSeedBehaviour",children:a.jsx(Tr,{label:t("dynamicPrompts.seedBehaviour.label"),value:n,data:r,itemComponent:ule,onChange:o})})},fle=d.memo(dle),ple=()=>{const{t:e}=J(),t=d.useMemo(()=>ce(we,({dynamicPrompts:o})=>{const s=o.prompts.length;if(s>1)return e("dynamicPrompts.promptsWithCount_other",{count:s})}),[e]),n=W(t);return jn("dynamicPrompting").isFeatureEnabled?a.jsx(Ao,{label:e("dynamicPrompts.dynamicPrompts"),activeLabel:n,children:a.jsxs($,{sx:{gap:2,flexDir:"column"},children:[a.jsx(cle,{}),a.jsx(fle,{}),a.jsx(sle,{})]})}):null},Uu=d.memo(ple),mle=e=>{const t=te(),{lora:n}=e,r=d.useCallback(i=>{t(Z7({id:n.id,weight:i}))},[t,n.id]),o=d.useCallback(()=>{t(eT(n.id))},[t,n.id]),s=d.useCallback(()=>{t(tT(n.id))},[t,n.id]);return a.jsx(wn,{feature:"lora",children:a.jsxs($,{sx:{gap:2.5,alignItems:"flex-end"},children:[a.jsx(jt,{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(ot,{size:"sm",onClick:s,tooltip:"Remove LoRA","aria-label":"Remove LoRA",icon:a.jsx(qo,{}),colorScheme:"error"})]})})},hle=d.memo(mle),gle=ce(we,({lora:e})=>({lorasArray:Ro(e.loras)}),je),vle=()=>{const{lorasArray:e}=W(gle);return a.jsx(a.Fragment,{children:e.map((t,n)=>a.jsxs($,{sx:{flexDirection:"column",gap:2},children:[n>0&&a.jsx(no,{pt:1}),a.jsx(hle,{lora:t})]},t.model_name))})},xle=d.memo(vle),ble=ce(we,({lora:e})=>({loras:e.loras}),je),yle=()=>{const e=te(),{loras:t}=W(ble),{data:n}=gf(),{t:r}=J(),o=W(l=>l.generation.model),s=d.useMemo(()=>{if(!n)return[];const l=[];return qr(n.entities,(u,p)=>{if(!u||p in t)return;const m=(o==null?void 0:o.base_model)!==u.base_model;l.push({value:p,label:u.model_name,disabled:m,group:gr[u.base_model],tooltip:m?`Incompatible base model: ${u.base_model}`:void 0})}),l.sort((u,p)=>u.label&&!p.label?1:-1),l.sort((u,p)=>u.disabled&&!p.disabled?1:-1)},[t,n,o==null?void 0:o.base_model]),i=d.useCallback(l=>{if(!l)return;const u=n==null?void 0:n.entities[l];u&&e(nT(u))},[e,n==null?void 0:n.entities]);return(n==null?void 0:n.ids.length)===0?a.jsx($,{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:fl,disabled:s.length===0,filter:(l,u)=>{var p;return((p=u.label)==null?void 0:p.toLowerCase().includes(l.toLowerCase().trim()))||u.value.toLowerCase().includes(l.toLowerCase().trim())},onChange:i,"data-testid":"add-lora"})},Cle=d.memo(yle),wle=ce(we,e=>{const t=oP(e.lora.loras);return{activeLabel:t>0?`${t} Active`:void 0}},je),Sle=()=>{const{t:e}=J(),{activeLabel:t}=W(wle);return jn("lora").isFeatureEnabled?a.jsx(Ao,{label:e("modelManager.loraModels"),activeLabel:t,children:a.jsxs($,{sx:{flexDir:"column",gap:2},children:[a.jsx(Cle,{}),a.jsx(xle,{})]})}):null},Gu=d.memo(Sle),kle=()=>{const e=te(),t=W(o=>o.generation.shouldUseCpuNoise),{t:n}=J(),r=d.useCallback(o=>{e(rT(o.target.checked))},[e]);return a.jsx(wn,{feature:"noiseUseCPU",children:a.jsx(kr,{label:n("parameters.useCpuNoise"),isChecked:t,onChange:r})})},da=e=>e.generation,jle=ce(da,e=>{const{seamlessXAxis:t}=e;return{seamlessXAxis:t}},je),_le=()=>{const{t:e}=J(),{seamlessXAxis:t}=W(jle),n=te(),r=d.useCallback(o=>{n(oT(o.target.checked))},[n]);return a.jsx(kr,{label:e("parameters.seamlessXAxis"),"aria-label":e("parameters.seamlessXAxis"),isChecked:t,onChange:r})},Ile=d.memo(_le),Ple=ce(da,e=>{const{seamlessYAxis:t}=e;return{seamlessYAxis:t}},je),Ele=()=>{const{t:e}=J(),{seamlessYAxis:t}=W(Ple),n=te(),r=d.useCallback(o=>{n(sT(o.target.checked))},[n]);return a.jsx(kr,{label:e("parameters.seamlessYAxis"),"aria-label":e("parameters.seamlessYAxis"),isChecked:t,onChange:r})},Mle=d.memo(Ele),Ole=()=>{const{t:e}=J();return jn("seamless").isFeatureEnabled?a.jsxs(Kn,{children:[a.jsx(Rr,{children:e("parameters.seamlessTiling")})," ",a.jsxs($,{sx:{gap:5},children:[a.jsx(De,{flexGrow:1,children:a.jsx(Ile,{})}),a.jsx(De,{flexGrow:1,children:a.jsx(Mle,{})})]})]}):null},Rle=d.memo(Ole);function Ale(){const e=W(u=>u.generation.clipSkip),{model:t}=W(u=>u.generation),n=te(),{t:r}=J(),o=d.useCallback(u=>{n(Vw(u))},[n]),s=d.useCallback(()=>{n(Vw(0))},[n]),i=d.useMemo(()=>t?Ap[t.base_model].maxClip:Ap["sd-1"].maxClip,[t]),l=d.useMemo(()=>t?Ap[t.base_model].markers:Ap["sd-1"].markers,[t]);return(t==null?void 0:t.base_model)==="sdxl"?null:a.jsx(wn,{feature:"clipSkip",placement:"top",children:a.jsx(jt,{label:r("parameters.clipSkip"),"aria-label":r("parameters.clipSkip"),min:0,max:i,step:1,value:e,onChange:o,withSliderMarks:!0,sliderMarks:l,withInput:!0,withReset:!0,handleReset:s})})}const Dle=ce(we,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}},je);function qu(){const{clipSkip:e,model:t,seamlessXAxis:n,seamlessYAxis:r,shouldUseCpuNoise:o}=W(Dle),{t:s}=J(),i=d.useMemo(()=>{const l=[];return o||l.push(s("parameters.gpuNoise")),e>0&&t&&t.base_model!=="sdxl"&&l.push(s("parameters.clipSkipWithLayerCount",{layerCount:e})),n&&r?l.push(s("parameters.seamlessX&Y")):n?l.push(s("parameters.seamlessX")):r&&l.push(s("parameters.seamlessY")),l.join(", ")},[e,t,n,r,o,s]);return a.jsx(Ao,{label:s("common.advanced"),activeLabel:i,children:a.jsxs($,{sx:{flexDir:"column",gap:2},children:[a.jsx(Rle,{}),a.jsx(no,{}),t&&(t==null?void 0:t.base_model)!=="sdxl"&&a.jsxs(a.Fragment,{children:[a.jsx(Ale,{}),a.jsx(no,{pt:2})]}),a.jsx(kle,{})]})})}const Ii=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{var o;return((o=Rs(r,e))==null?void 0:o.isEnabled)??!1},je),[e]);return W(t)},Tle=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.model},je),[e]);return W(t)},dR=e=>{const{data:t}=Cb(),n=d.useMemo(()=>t?$I.getSelectors().selectAll(t):[],[t]),{data:r}=wb(),o=d.useMemo(()=>r?LI.getSelectors().selectAll(r):[],[r]),{data:s}=Sb(),i=d.useMemo(()=>s?zI.getSelectors().selectAll(s):[],[s]);return e==="controlnet"?n:e==="t2i_adapter"?o:e==="ip_adapter"?i:[]},fR=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.type},je),[e]);return W(t)},Nle=ce(we,({generation:e})=>{const{model:t}=e;return{mainModel:t}},je),$le=({id:e})=>{const t=Ii(e),n=fR(e),r=Tle(e),o=te(),{mainModel:s}=W(Nle),{t:i}=J(),l=dR(n),u=d.useMemo(()=>{if(!l)return[];const h=[];return l.forEach(g=>{if(!g)return;const x=(g==null?void 0:g.base_model)!==(s==null?void 0:s.base_model);h.push({value:g.id,label:g.model_name,group:gr[g.base_model],disabled:x,tooltip:x?`${i("controlnet.incompatibleBaseModel")} ${g.base_model}`:void 0})}),h.sort((g,x)=>g.disabled?1:x.disabled?-1:g.label.localeCompare(x.label)),h},[s==null?void 0:s.base_model,l,i]),p=d.useMemo(()=>l.find(h=>(h==null?void 0:h.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,l]),m=d.useCallback(h=>{if(!h)return;const g=rR(h);g&&o(aT({id:e,model:g}))},[o,e]);return a.jsx(tr,{itemComponent:fl,data:u,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:m,disabled:!t,tooltip:p==null?void 0:p.description})},Lle=d.memo($le),zle=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.weight},je),[e]);return W(t)},Fle=({id:e})=>{const t=Ii(e),n=zle(e),r=te(),{t:o}=J(),s=d.useCallback(i=>{r(iT({id:e,weight:i}))},[r,e]);return Wd(n)?null:a.jsx(wn,{feature:"controlNetWeight",children:a.jsx(jt,{isDisabled:!t,label:o("controlnet.weight"),value:n,onChange:s,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2]})})},Ble=d.memo(Fle),Hle=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.controlImage},je),[e]);return W(t)},Wle=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{const o=Rs(r,e);return o&&Mu(o)?o.processedControlImage:void 0},je),[e]);return W(t)},Vle=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{const o=Rs(r,e);return o&&Mu(o)?o.processorType:void 0},je),[e]);return W(t)},Ule=ce(we,({controlAdapters:e,gallery:t})=>{const{pendingControlImages:n}=e,{autoAddBoardId:r}=t;return{pendingControlImages:n,autoAddBoardId:r}},je),Gle=({isSmall:e,id:t})=>{const n=Hle(t),r=Wle(t),o=Vle(t),s=te(),{t:i}=J(),{pendingControlImages:l,autoAddBoardId:u}=W(Ule),p=W(ro),[m,h]=d.useState(!1),{currentData:g}=Ps(n??Os.skipToken),{currentData:x}=Ps(r??Os.skipToken),[y]=lT(),[b]=cT(),[C]=uT(),S=d.useCallback(()=>{s(dT({id:t,controlImage:null}))},[t,s]),j=d.useCallback(async()=>{x&&(await y({imageDTO:x,is_intermediate:!1}).unwrap(),u!=="none"?b({imageDTO:x,board_id:u}):C({imageDTO:x}))},[x,y,u,b,C]),_=d.useCallback(()=>{g&&(p==="unifiedCanvas"?s(Xs({width:g.width,height:g.height})):(s(Bl(g.width)),s(Hl(g.height))))},[g,p,s]),P=d.useCallback(()=>{h(!0)},[]),I=d.useCallback(()=>{h(!1)},[]),M=d.useMemo(()=>{if(g)return{id:t,payloadType:"IMAGE_DTO",payload:{imageDTO:g}}},[g,t]),O=d.useMemo(()=>({id:t,actionType:"SET_CONTROL_ADAPTER_IMAGE",context:{id:t}}),[t]),A=d.useMemo(()=>({type:"SET_CONTROL_ADAPTER_IMAGE",id:t}),[t]),D=g&&x&&!m&&!l.includes(t)&&o!=="none";return a.jsxs($,{onMouseEnter:P,onMouseLeave:I,sx:{position:"relative",w:"full",h:e?28:366,alignItems:"center",justifyContent:"center"},children:[a.jsx(al,{draggableData:M,droppableData:O,imageDTO:g,isDropDisabled:D,postUploadAction:A}),a.jsx(De,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",opacity:D?1:0,transitionProperty:"common",transitionDuration:"normal",pointerEvents:"none"},children:a.jsx(al,{draggableData:M,droppableData:O,imageDTO:x,isUploadDisabled:!0})}),a.jsxs(a.Fragment,{children:[a.jsx(du,{onClick:S,icon:g?a.jsx(qg,{}):void 0,tooltip:i("controlnet.resetControlImage")}),a.jsx(du,{onClick:j,icon:g?a.jsx(Gg,{size:16}):void 0,tooltip:i("controlnet.saveControlImage"),styleOverrides:{marginTop:6}}),a.jsx(du,{onClick:_,icon:g?a.jsx(_ee,{size:16}):void 0,tooltip:i("controlnet.setControlImageDimensions"),styleOverrides:{marginTop:12}})]}),l.includes(t)&&a.jsx($,{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(vi,{size:"xl",sx:{color:"base.100",_dark:{color:"base.400"}}})})]})},S_=d.memo(Gle),Ds=()=>{const e=te();return d.useCallback((n,r)=>{e(fT({id:n,params:r}))},[e])};function Ts(e){return a.jsx($,{sx:{flexDirection:"column",gap:2,pb:2},children:e.children})}const k_=Oo.canny_image_processor.default,qle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{low_threshold:o,high_threshold:s}=n,i=Ds(),{t:l}=J(),u=d.useCallback(g=>{i(t,{low_threshold:g})},[t,i]),p=d.useCallback(()=>{i(t,{low_threshold:k_.low_threshold})},[t,i]),m=d.useCallback(g=>{i(t,{high_threshold:g})},[t,i]),h=d.useCallback(()=>{i(t,{high_threshold:k_.high_threshold})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(jt,{isDisabled:!r,label:l("controlnet.lowThreshold"),value:o,onChange:u,handleReset:p,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0}),a.jsx(jt,{isDisabled:!r,label:l("controlnet.highThreshold"),value:s,onChange:m,handleReset:h,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0})]})},Kle=d.memo(qle),Qle=Oo.color_map_image_processor.default,Xle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{color_map_tile_size:o}=n,s=Ds(),{t:i}=J(),l=d.useCallback(p=>{s(t,{color_map_tile_size:p})},[t,s]),u=d.useCallback(()=>{s(t,{color_map_tile_size:Qle.color_map_tile_size})},[t,s]);return a.jsx(Ts,{children:a.jsx(jt,{isDisabled:!r,label:i("controlnet.colorMapTileSize"),value:o,onChange:l,handleReset:u,withReset:!0,min:1,max:256,step:1,withInput:!0,withSliderMarks:!0,sliderNumberInputProps:{max:4096}})})},Yle=d.memo(Xle),yd=Oo.content_shuffle_image_processor.default,Jle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,w:i,h:l,f:u}=n,p=Ds(),{t:m}=J(),h=d.useCallback(I=>{p(t,{detect_resolution:I})},[t,p]),g=d.useCallback(()=>{p(t,{detect_resolution:yd.detect_resolution})},[t,p]),x=d.useCallback(I=>{p(t,{image_resolution:I})},[t,p]),y=d.useCallback(()=>{p(t,{image_resolution:yd.image_resolution})},[t,p]),b=d.useCallback(I=>{p(t,{w:I})},[t,p]),C=d.useCallback(()=>{p(t,{w:yd.w})},[t,p]),S=d.useCallback(I=>{p(t,{h:I})},[t,p]),j=d.useCallback(()=>{p(t,{h:yd.h})},[t,p]),_=d.useCallback(I=>{p(t,{f:I})},[t,p]),P=d.useCallback(()=>{p(t,{f:yd.f})},[t,p]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:m("controlnet.detectResolution"),value:s,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:m("controlnet.imageResolution"),value:o,onChange:x,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:m("controlnet.w"),value:i,onChange:b,handleReset:C,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:m("controlnet.h"),value:l,onChange:S,handleReset:j,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:m("controlnet.f"),value:u,onChange:_,handleReset:P,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Zle=d.memo(Jle),j_=Oo.hed_image_processor.default,ece=e=>{const{controlNetId:t,processorNode:{detect_resolution:n,image_resolution:r,scribble:o},isEnabled:s}=e,i=Ds(),{t:l}=J(),u=d.useCallback(x=>{i(t,{detect_resolution:x})},[t,i]),p=d.useCallback(x=>{i(t,{image_resolution:x})},[t,i]),m=d.useCallback(x=>{i(t,{scribble:x.target.checked})},[t,i]),h=d.useCallback(()=>{i(t,{detect_resolution:j_.detect_resolution})},[t,i]),g=d.useCallback(()=>{i(t,{image_resolution:j_.image_resolution})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:l("controlnet.detectResolution"),value:n,onChange:u,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(jt,{label:l("controlnet.imageResolution"),value:r,onChange:p,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(kr,{label:l("controlnet.scribble"),isChecked:o,onChange:m,isDisabled:!s})]})},tce=d.memo(ece),__=Oo.lineart_anime_image_processor.default,nce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Ds(),{t:l}=J(),u=d.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=d.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),m=d.useCallback(()=>{i(t,{detect_resolution:__.detect_resolution})},[t,i]),h=d.useCallback(()=>{i(t,{image_resolution:__.image_resolution})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:l("controlnet.detectResolution"),value:s,onChange:u,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:l("controlnet.imageResolution"),value:o,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},rce=d.memo(nce),I_=Oo.lineart_image_processor.default,oce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,coarse:i}=n,l=Ds(),{t:u}=J(),p=d.useCallback(y=>{l(t,{detect_resolution:y})},[t,l]),m=d.useCallback(y=>{l(t,{image_resolution:y})},[t,l]),h=d.useCallback(()=>{l(t,{detect_resolution:I_.detect_resolution})},[t,l]),g=d.useCallback(()=>{l(t,{image_resolution:I_.image_resolution})},[t,l]),x=d.useCallback(y=>{l(t,{coarse:y.target.checked})},[t,l]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:u("controlnet.detectResolution"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:u("controlnet.imageResolution"),value:o,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(kr,{label:u("controlnet.coarse"),isChecked:i,onChange:x,isDisabled:!r})]})},sce=d.memo(oce),P_=Oo.mediapipe_face_processor.default,ace=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{max_faces:o,min_confidence:s}=n,i=Ds(),{t:l}=J(),u=d.useCallback(g=>{i(t,{max_faces:g})},[t,i]),p=d.useCallback(g=>{i(t,{min_confidence:g})},[t,i]),m=d.useCallback(()=>{i(t,{max_faces:P_.max_faces})},[t,i]),h=d.useCallback(()=>{i(t,{min_confidence:P_.min_confidence})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:l("controlnet.maxFaces"),value:o,onChange:u,handleReset:m,withReset:!0,min:1,max:20,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:l("controlnet.minConfidence"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},ice=d.memo(ace),E_=Oo.midas_depth_image_processor.default,lce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{a_mult:o,bg_th:s}=n,i=Ds(),{t:l}=J(),u=d.useCallback(g=>{i(t,{a_mult:g})},[t,i]),p=d.useCallback(g=>{i(t,{bg_th:g})},[t,i]),m=d.useCallback(()=>{i(t,{a_mult:E_.a_mult})},[t,i]),h=d.useCallback(()=>{i(t,{bg_th:E_.bg_th})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:l("controlnet.amult"),value:o,onChange:u,handleReset:m,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:l("controlnet.bgth"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},cce=d.memo(lce),hm=Oo.mlsd_image_processor.default,uce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,thr_d:i,thr_v:l}=n,u=Ds(),{t:p}=J(),m=d.useCallback(j=>{u(t,{detect_resolution:j})},[t,u]),h=d.useCallback(j=>{u(t,{image_resolution:j})},[t,u]),g=d.useCallback(j=>{u(t,{thr_d:j})},[t,u]),x=d.useCallback(j=>{u(t,{thr_v:j})},[t,u]),y=d.useCallback(()=>{u(t,{detect_resolution:hm.detect_resolution})},[t,u]),b=d.useCallback(()=>{u(t,{image_resolution:hm.image_resolution})},[t,u]),C=d.useCallback(()=>{u(t,{thr_d:hm.thr_d})},[t,u]),S=d.useCallback(()=>{u(t,{thr_v:hm.thr_v})},[t,u]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:p("controlnet.detectResolution"),value:s,onChange:m,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:p("controlnet.imageResolution"),value:o,onChange:h,handleReset:b,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{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(jt,{label:p("controlnet.h"),value:l,onChange:x,handleReset:S,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},dce=d.memo(uce),M_=Oo.normalbae_image_processor.default,fce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Ds(),{t:l}=J(),u=d.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=d.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),m=d.useCallback(()=>{i(t,{detect_resolution:M_.detect_resolution})},[t,i]),h=d.useCallback(()=>{i(t,{image_resolution:M_.image_resolution})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:l("controlnet.detectResolution"),value:s,onChange:u,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:l("controlnet.imageResolution"),value:o,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},pce=d.memo(fce),O_=Oo.openpose_image_processor.default,mce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,hand_and_face:i}=n,l=Ds(),{t:u}=J(),p=d.useCallback(y=>{l(t,{detect_resolution:y})},[t,l]),m=d.useCallback(y=>{l(t,{image_resolution:y})},[t,l]),h=d.useCallback(()=>{l(t,{detect_resolution:O_.detect_resolution})},[t,l]),g=d.useCallback(()=>{l(t,{image_resolution:O_.image_resolution})},[t,l]),x=d.useCallback(y=>{l(t,{hand_and_face:y.target.checked})},[t,l]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:u("controlnet.detectResolution"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:u("controlnet.imageResolution"),value:o,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(kr,{label:u("controlnet.handAndFace"),isChecked:i,onChange:x,isDisabled:!r})]})},hce=d.memo(mce),R_=Oo.pidi_image_processor.default,gce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,scribble:i,safe:l}=n,u=Ds(),{t:p}=J(),m=d.useCallback(C=>{u(t,{detect_resolution:C})},[t,u]),h=d.useCallback(C=>{u(t,{image_resolution:C})},[t,u]),g=d.useCallback(()=>{u(t,{detect_resolution:R_.detect_resolution})},[t,u]),x=d.useCallback(()=>{u(t,{image_resolution:R_.image_resolution})},[t,u]),y=d.useCallback(C=>{u(t,{scribble:C.target.checked})},[t,u]),b=d.useCallback(C=>{u(t,{safe:C.target.checked})},[t,u]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:p("controlnet.detectResolution"),value:s,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:p("controlnet.imageResolution"),value:o,onChange:h,handleReset:x,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(kr,{label:p("controlnet.scribble"),isChecked:i,onChange:y}),a.jsx(kr,{label:p("controlnet.safe"),isChecked:l,onChange:b,isDisabled:!r})]})},vce=d.memo(gce),xce=e=>null,bce=d.memo(xce),pR=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{const o=Rs(r,e);return o&&Mu(o)?o.processorNode:void 0},je),[e]);return W(t)},yce=({id:e})=>{const t=Ii(e),n=pR(e);return n?n.type==="canny_image_processor"?a.jsx(Kle,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="color_map_image_processor"?a.jsx(Yle,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="hed_image_processor"?a.jsx(tce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="lineart_image_processor"?a.jsx(sce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="content_shuffle_image_processor"?a.jsx(Zle,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="lineart_anime_image_processor"?a.jsx(rce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="mediapipe_face_processor"?a.jsx(ice,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="midas_depth_image_processor"?a.jsx(cce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="mlsd_image_processor"?a.jsx(dce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="normalbae_image_processor"?a.jsx(pce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="openpose_image_processor"?a.jsx(hce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="pidi_image_processor"?a.jsx(vce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="zoe_depth_image_processor"?a.jsx(bce,{controlNetId:e,processorNode:n,isEnabled:t}):null:null},Cce=d.memo(yce),wce=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{const o=Rs(r,e);if(o&&Mu(o))return o.shouldAutoConfig},je),[e]);return W(t)},Sce=({id:e})=>{const t=Ii(e),n=wce(e),r=te(),{t:o}=J(),s=d.useCallback(()=>{r(pT({id:e}))},[e,r]);return Wd(n)?null:a.jsx(kr,{label:o("controlnet.autoConfigure"),"aria-label":o("controlnet.autoConfigure"),isChecked:n,onChange:s,isDisabled:!t})},kce=d.memo(Sce),jce=e=>{const{id:t}=e,n=te(),{t:r}=J(),o=d.useCallback(()=>{n(mT({id:t}))},[t,n]),s=d.useCallback(()=>{n(hT({id:t}))},[t,n]);return a.jsxs($,{sx:{gap:2},children:[a.jsx(ot,{size:"sm",icon:a.jsx(Xl,{}),tooltip:r("controlnet.importImageFromCanvas"),"aria-label":r("controlnet.importImageFromCanvas"),onClick:o}),a.jsx(ot,{size:"sm",icon:a.jsx(KM,{}),tooltip:r("controlnet.importMaskFromCanvas"),"aria-label":r("controlnet.importMaskFromCanvas"),onClick:s})]})},_ce=d.memo(jce),Ice=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{const o=Rs(r,e);return o?{beginStepPct:o.beginStepPct,endStepPct:o.endStepPct}:void 0},je),[e]);return W(t)},A_=e=>`${Math.round(e*100)}%`,Pce=({id:e})=>{const t=Ii(e),n=Ice(e),r=te(),{t:o}=J(),s=d.useCallback(i=>{r(gT({id:e,beginStepPct:i[0]})),r(vT({id:e,endStepPct:i[1]}))},[r,e]);return n?a.jsx(wn,{feature:"controlNetBeginEnd",children:a.jsxs(Kn,{isDisabled:!t,children:[a.jsx(Rr,{children:o("controlnet.beginEndStepPercent")}),a.jsx(cy,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(T5,{"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(N5,{children:a.jsx($5,{})}),a.jsx(Fn,{label:A_(n.beginStepPct),placement:"top",hasArrow:!0,children:a.jsx(vx,{index:0})}),a.jsx(Fn,{label:A_(n.endStepPct),placement:"top",hasArrow:!0,children:a.jsx(vx,{index:1})}),a.jsx(km,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(km,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(km,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})}):null},Ece=d.memo(Pce),Mce=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{const o=Rs(r,e);if(o&&xT(o))return o.controlMode},je),[e]);return W(t)};function Oce({id:e}){const t=Ii(e),n=Mce(e),r=te(),{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=d.useCallback(l=>{r(bT({id:e,controlMode:l}))},[e,r]);return n?a.jsx(wn,{feature:"controlNetControlMode",children:a.jsx(Tr,{disabled:!t,label:o("controlnet.controlMode"),data:s,value:n,onChange:i})}):null}const Rce=e=>e.config,Ace=ce(Rce,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)),je),Dce=({id:e})=>{const t=Ii(e),n=pR(e),r=te(),o=W(Ace),{t:s}=J(),i=d.useCallback(l=>{r(yT({id:e,processorType:l}))},[e,r]);return n?a.jsx(tr,{label:s("controlnet.processor"),value:n.type??"canny_image_processor",data:o,onChange:i,disabled:!t}):null},Tce=d.memo(Dce),Nce=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{const o=Rs(r,e);if(o&&Mu(o))return o.resizeMode},je),[e]);return W(t)};function $ce({id:e}){const t=Ii(e),n=Nce(e),r=te(),{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=d.useCallback(l=>{r(CT({id:e,resizeMode:l}))},[e,r]);return n?a.jsx(wn,{feature:"controlNetResizeMode",children:a.jsx(Tr,{disabled:!t,label:o("controlnet.resizeMode"),data:s,value:n,onChange:i})}):null}const Lce=e=>{const{id:t,number:n}=e,r=fR(t),o=te(),{t:s}=J(),i=W(ro),l=Ii(t),[u,p]=Nee(!1),m=d.useCallback(()=>{o(wT({id:t}))},[t,o]),h=d.useCallback(()=>{o(ST(t))},[t,o]),g=d.useCallback(x=>{o(kT({id:t,isEnabled:x.target.checked}))},[t,o]);return r?a.jsxs($,{sx:{flexDir:"column",gap:3,p:2,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx($,{sx:{gap:2,alignItems:"center",justifyContent:"space-between"},children:a.jsx(kr,{label:s(`controlnet.${r}`,{number:n}),"aria-label":s("controlnet.toggleControlNet"),isChecked:l,onChange:g,formControlProps:{w:"full"},formLabelProps:{fontWeight:600}})}),a.jsxs($,{sx:{gap:2,alignItems:"center"},children:[a.jsx(De,{sx:{w:"full",minW:0,transitionProperty:"common",transitionDuration:"0.1s"},children:a.jsx(Lle,{id:t})}),i==="unifiedCanvas"&&a.jsx(_ce,{id:t}),a.jsx(ot,{size:"sm",tooltip:s("controlnet.duplicate"),"aria-label":s("controlnet.duplicate"),onClick:h,icon:a.jsx(Lu,{})}),a.jsx(ot,{size:"sm",tooltip:s("controlnet.delete"),"aria-label":s("controlnet.delete"),colorScheme:"error",onClick:m,icon:a.jsx(qo,{})}),a.jsx(ot,{size:"sm",tooltip:s(u?"controlnet.hideAdvanced":"controlnet.showAdvanced"),"aria-label":s(u?"controlnet.hideAdvanced":"controlnet.showAdvanced"),onClick:p,variant:"ghost",sx:{_hover:{bg:"none"}},icon:a.jsx(t0,{sx:{boxSize:4,color:"base.700",transform:u?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal",_dark:{color:"base.300"}}})})]}),a.jsxs($,{sx:{w:"full",flexDirection:"column",gap:3},children:[a.jsxs($,{sx:{gap:4,w:"full",alignItems:"center"},children:[a.jsxs($,{sx:{flexDir:"column",gap:3,h:28,w:"full",paddingInlineStart:1,paddingInlineEnd:u?1:0,pb:2,justifyContent:"space-between"},children:[a.jsx(Ble,{id:t}),a.jsx(Ece,{id:t})]}),!u&&a.jsx($,{sx:{alignItems:"center",justifyContent:"center",h:28,w:28,aspectRatio:"1/1"},children:a.jsx(S_,{id:t,isSmall:!0})})]}),a.jsxs($,{sx:{gap:2},children:[a.jsx(Oce,{id:t}),a.jsx($ce,{id:t})]}),a.jsx(Tce,{id:t})]}),u&&a.jsxs(a.Fragment,{children:[a.jsx(S_,{id:t}),a.jsx(kce,{id:t}),a.jsx(Cce,{id:t})]})]}):null},zce=d.memo(Lce),j1=e=>{const t=W(l=>{var u;return(u=l.generation.model)==null?void 0:u.base_model}),n=te(),r=dR(e),o=d.useMemo(()=>{const l=r.filter(u=>t?u.base_model===t:!0)[0];return l||r[0]},[t,r]),s=d.useMemo(()=>!o,[o]);return[d.useCallback(()=>{s||n(jT({type:e,overrides:{model:o}}))},[n,o,s,e]),s]},Fce=ce([we],({controlAdapters:e})=>{const t=[];let n=!1;const r=_T(e).filter(m=>m.isEnabled).length,o=IT(e).length;r>0&&t.push(`${r} IP`),r>o&&(n=!0);const s=PT(e).filter(m=>m.isEnabled).length,i=ET(e).length;s>0&&t.push(`${s} ControlNet`),s>i&&(n=!0);const l=MT(e).filter(m=>m.isEnabled).length,u=OT(e).length;return l>0&&t.push(`${l} T2I`),l>u&&(n=!0),{controlAdapterIds:RT(e).map(String),activeLabel:t.join(", "),isError:n}},je),Bce=()=>{const{t:e}=J(),{controlAdapterIds:t,activeLabel:n}=W(Fce),r=jn("controlNet").isFeatureDisabled,[o,s]=j1("controlnet"),[i,l]=j1("ip_adapter"),[u,p]=j1("t2i_adapter");return r?null:a.jsx(Ao,{label:e("controlnet.controlAdapter_other"),activeLabel:n,children:a.jsxs($,{sx:{flexDir:"column",gap:2},children:[a.jsxs(zn,{size:"sm",w:"full",justifyContent:"space-between",children:[a.jsx(Mt,{tooltip:e("controlnet.addControlNet"),leftIcon:a.jsx(Xi,{}),onClick:o,"data-testid":"add controlnet",flexGrow:1,isDisabled:s,children:e("common.controlNet")}),a.jsx(Mt,{tooltip:e("controlnet.addIPAdapter"),leftIcon:a.jsx(Xi,{}),onClick:i,"data-testid":"add ip adapter",flexGrow:1,isDisabled:l,children:e("common.ipAdapter")}),a.jsx(Mt,{tooltip:e("controlnet.addT2IAdapter"),leftIcon:a.jsx(Xi,{}),onClick:u,"data-testid":"add t2i adapter",flexGrow:1,isDisabled:p,children:e("common.t2iAdapter")})]}),t.map((m,h)=>a.jsxs(d.Fragment,{children:[a.jsx(no,{}),a.jsx(zce,{id:m,number:h+1})]},m))]})})},Ku=d.memo(Bce),Hce=e=>{const{onClick:t}=e,{t:n}=J();return a.jsx(ot,{size:"sm","aria-label":n("embedding.addEmbedding"),tooltip:n("embedding.addEmbedding"),icon:a.jsx(BM,{}),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})},v0=d.memo(Hce),Wce="28rem",Vce=e=>{const{onSelect:t,isOpen:n,onClose:r,children:o}=e,{data:s}=AT(),i=d.useRef(null),{t:l}=J(),u=W(h=>h.generation.model),p=d.useMemo(()=>{if(!s)return[];const h=[];return qr(s.entities,(g,x)=>{if(!g)return;const y=(u==null?void 0:u.base_model)!==g.base_model;h.push({value:g.model_name,label:g.model_name,group:gr[g.base_model],disabled:y,tooltip:y?`${l("embedding.incompatibleModel")} ${g.base_model}`:void 0})}),h.sort((g,x)=>{var y;return g.label&&x.label?(y=g.label)!=null&&y.localeCompare(x.label)?-1:1:-1}),h.sort((g,x)=>g.disabled&&!x.disabled?1:-1)},[s,u==null?void 0:u.base_model,l]),m=d.useCallback(h=>{h&&t(h)},[t]);return a.jsxs(Af,{initialFocusRef:i,isOpen:n,onClose:r,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(Eg,{children:o}),a.jsx(Df,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Mg,{sx:{p:0,w:`calc(${Wce} - 2rem )`},children:p.length===0?a.jsx($,{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:l("embedding.addEmbedding"),value:null,data:p,nothingFound:l("embedding.noMatchingEmbedding"),itemComponent:fl,disabled:p.length===0,onDropdownClose:r,filter:(h,g)=>{var x;return((x=g.label)==null?void 0:x.toLowerCase().includes(h.toLowerCase().trim()))||g.value.toLowerCase().includes(h.toLowerCase().trim())},onChange:m})})})]})},x0=d.memo(Vce),Uce=()=>{const e=W(h=>h.generation.negativePrompt),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Uo(),s=te(),{t:i}=J(),l=d.useCallback(h=>{s(Od(h.target.value))},[s]),u=d.useCallback(h=>{h.key==="<"&&o()},[o]),p=d.useCallback(h=>{if(!t.current)return;const g=t.current.selectionStart;if(g===void 0)return;let x=e.slice(0,g);x[x.length-1]!=="<"&&(x+="<"),x+=`${h}>`;const y=x.length;x+=e.slice(g),rs.flushSync(()=>{s(Od(x))}),t.current.selectionEnd=y,r()},[s,r,e]),m=jn("embedding").isFeatureEnabled;return a.jsxs(Kn,{children:[a.jsx(x0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(wn,{feature:"paramNegativeConditioning",placement:"right",children:a.jsx(gi,{id:"negativePrompt",name:"negativePrompt",ref:t,value:e,placeholder:i("parameters.negativePromptPlaceholder"),onChange:l,resize:"vertical",fontSize:"sm",minH:16,...m&&{onKeyDown:u}})})}),!n&&m&&a.jsx(De,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(v0,{onClick:o})})]})},mR=d.memo(Uce),Gce=ce([we],({generation:e})=>({prompt:e.positivePrompt}),{memoizeOptions:{resultEqualityCheck:Tn}}),qce=()=>{const e=te(),{prompt:t}=W(Gce),n=d.useRef(null),{isOpen:r,onClose:o,onOpen:s}=Uo(),{t:i}=J(),l=d.useCallback(h=>{e(Md(h.target.value))},[e]);It("alt+a",()=>{var h;(h=n.current)==null||h.focus()},[]);const u=d.useCallback(h=>{if(!n.current)return;const g=n.current.selectionStart;if(g===void 0)return;let x=t.slice(0,g);x[x.length-1]!=="<"&&(x+="<"),x+=`${h}>`;const y=x.length;x+=t.slice(g),rs.flushSync(()=>{e(Md(x))}),n.current.selectionStart=y,n.current.selectionEnd=y,o()},[e,o,t]),p=jn("embedding").isFeatureEnabled,m=d.useCallback(h=>{p&&h.key==="<"&&s()},[s,p]);return a.jsxs(De,{position:"relative",children:[a.jsx(Kn,{children:a.jsx(x0,{isOpen:r,onClose:o,onSelect:u,children:a.jsx(wn,{feature:"paramPositiveConditioning",placement:"right",children:a.jsx(gi,{id:"prompt",name:"prompt",ref:n,value:t,placeholder:i("parameters.positivePromptPlaceholder"),onChange:l,onKeyDown:m,resize:"vertical",minH:32})})})}),!r&&p&&a.jsx(De,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(v0,{onClick:s})})]})},hR=d.memo(qce);function Kce(){const e=W(o=>o.sdxl.shouldConcatSDXLStylePrompt),t=te(),{t:n}=J(),r=()=>{t(DT(!e))};return a.jsx(ot,{"aria-label":n("sdxl.concatPromptStyle"),tooltip:n("sdxl.concatPromptStyle"),variant:"outline",isChecked:e,onClick:r,icon:a.jsx(GM,{}),size:"xs",sx:{position:"absolute",insetInlineEnd:1,top:6,border:"none",color:e?"accent.500":"base.500",_hover:{bg:"none"}}})}const D_={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 gR(){return a.jsxs($,{children:[a.jsx(De,{as:Mr.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",...D_,_dark:{borderColor:"accent.500"}}}),a.jsx(De,{as:Mr.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(GM,{size:12})}),a.jsx(De,{as:Mr.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",...D_,_dark:{borderColor:"accent.500"}}})]})}const Qce=ce([we],({sdxl:e})=>{const{negativeStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),Xce=()=>{const e=te(),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Uo(),{t:s}=J(),{prompt:i,shouldConcatSDXLStylePrompt:l}=W(Qce),u=d.useCallback(g=>{e(Ad(g.target.value))},[e]),p=d.useCallback(g=>{if(!t.current)return;const x=t.current.selectionStart;if(x===void 0)return;let y=i.slice(0,x);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const b=y.length;y+=i.slice(x),rs.flushSync(()=>{e(Ad(y))}),t.current.selectionStart=b,t.current.selectionEnd=b,r()},[e,r,i]),m=jn("embedding").isFeatureEnabled,h=d.useCallback(g=>{m&&g.key==="<"&&o()},[o,m]);return a.jsxs(De,{position:"relative",children:[a.jsx(yo,{children:l&&a.jsx(De,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(gR,{})})}),a.jsx(Kn,{children:a.jsx(x0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(gi,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.negStylePrompt"),onChange:u,onKeyDown:h,resize:"vertical",fontSize:"sm",minH:16})})}),!n&&m&&a.jsx(De,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(v0,{onClick:o})})]})},Yce=d.memo(Xce),Jce=ce([we],({sdxl:e})=>{const{positiveStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),Zce=()=>{const e=te(),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Uo(),{t:s}=J(),{prompt:i,shouldConcatSDXLStylePrompt:l}=W(Jce),u=d.useCallback(g=>{e(Rd(g.target.value))},[e]),p=d.useCallback(g=>{if(!t.current)return;const x=t.current.selectionStart;if(x===void 0)return;let y=i.slice(0,x);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const b=y.length;y+=i.slice(x),rs.flushSync(()=>{e(Rd(y))}),t.current.selectionStart=b,t.current.selectionEnd=b,r()},[e,r,i]),m=jn("embedding").isFeatureEnabled,h=d.useCallback(g=>{m&&g.key==="<"&&o()},[o,m]);return a.jsxs(De,{position:"relative",children:[a.jsx(yo,{children:l&&a.jsx(De,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(gR,{})})}),a.jsx(Kn,{children:a.jsx(x0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(gi,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.posStylePrompt"),onChange:u,onKeyDown:h,resize:"vertical",minH:16})})}),!n&&m&&a.jsx(De,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(v0,{onClick:o})})]})},eue=d.memo(Zce);function $2(){return a.jsxs($,{sx:{flexDirection:"column",gap:2},children:[a.jsx(hR,{}),a.jsx(Kce,{}),a.jsx(eue,{}),a.jsx(mR,{}),a.jsx(Yce,{})]})}const gl=()=>{const{isRefinerAvailable:e}=na(Tb,{selectFromResult:({data:t})=>({isRefinerAvailable:t?t.ids.length>0:!1})});return e},tue=ce([we],({sdxl:e,ui:t,hotkeys:n})=>{const{refinerCFGScale:r}=e,{shouldUseSliders:o}=t,{shift:s}=n;return{refinerCFGScale:r,shouldUseSliders:o,shift:s}},je),nue=()=>{const{refinerCFGScale:e,shouldUseSliders:t,shift:n}=W(tue),r=gl(),o=te(),{t:s}=J(),i=d.useCallback(u=>o(z1(u)),[o]),l=d.useCallback(()=>o(z1(7)),[o]);return t?a.jsx(jt,{label:s("sdxl.cfgScale"),step:n?.1:.5,min:1,max:20,onChange:i,handleReset:l,value:e,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!r}):a.jsx(Vu,{label:s("sdxl.cfgScale"),step:.5,min:1,max:200,onChange:i,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"},isDisabled:!r})},rue=d.memo(nue),oue=e=>{const t=yi("models"),[n,r,o]=e.split("/"),s=TT.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},sue=ce(we,e=>({model:e.sdxl.refinerModel}),je),aue=()=>{const e=te(),t=jn("syncModels").isFeatureEnabled,{model:n}=W(sue),{t:r}=J(),{data:o,isLoading:s}=na(Tb),i=d.useMemo(()=>{if(!o)return[];const p=[];return qr(o.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:gr[m.base_model]})}),p},[o]),l=d.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]),u=d.useCallback(p=>{if(!p)return;const m=oue(p);m&&e(FI(m))},[e]);return s?a.jsx(tr,{label:r("sdxl.refinermodel"),placeholder:r("sdxl.loading"),disabled:!0,data:[]}):a.jsxs($,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(tr,{tooltip:l==null?void 0:l.description,label:r("sdxl.refinermodel"),value:l==null?void 0:l.id,placeholder:i.length>0?r("sdxl.selectAModel"):r("sdxl.noModelsAvailable"),data:i,error:i.length===0,disabled:i.length===0,onChange:u,w:"100%"}),t&&a.jsx(De,{mt:7,children:a.jsx(Wu,{iconMode:!0})})]})},iue=d.memo(aue),lue=ce([we],({sdxl:e,hotkeys:t})=>{const{refinerNegativeAestheticScore:n}=e,{shift:r}=t;return{refinerNegativeAestheticScore:n,shift:r}},je),cue=()=>{const{refinerNegativeAestheticScore:e,shift:t}=W(lue),n=gl(),r=te(),{t:o}=J(),s=d.useCallback(l=>r(B1(l)),[r]),i=d.useCallback(()=>r(B1(2.5)),[r]);return a.jsx(jt,{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})},uue=d.memo(cue),due=ce([we],({sdxl:e,hotkeys:t})=>{const{refinerPositiveAestheticScore:n}=e,{shift:r}=t;return{refinerPositiveAestheticScore:n,shift:r}},je),fue=()=>{const{refinerPositiveAestheticScore:e,shift:t}=W(due),n=gl(),r=te(),{t:o}=J(),s=d.useCallback(l=>r(F1(l)),[r]),i=d.useCallback(()=>r(F1(6)),[r]);return a.jsx(jt,{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})},pue=d.memo(fue),mue=ce(we,({ui:e,sdxl:t})=>{const{refinerScheduler:n}=t,{favoriteSchedulers:r}=e,o=Ro(tg,(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}},je),hue=()=>{const e=te(),{t}=J(),{refinerScheduler:n,data:r}=W(mue),o=gl(),s=d.useCallback(i=>{i&&e(BI(i))},[e]);return a.jsx(tr,{w:"100%",label:t("sdxl.scheduler"),value:n,data:r,onChange:s,disabled:!o})},gue=d.memo(hue),vue=ce([we],({sdxl:e})=>{const{refinerStart:t}=e;return{refinerStart:t}},je),xue=()=>{const{refinerStart:e}=W(vue),t=te(),n=gl(),r=d.useCallback(i=>t(H1(i)),[t]),{t:o}=J(),s=d.useCallback(()=>t(H1(.8)),[t]);return a.jsx(jt,{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})},bue=d.memo(xue),yue=ce([we],({sdxl:e,ui:t})=>{const{refinerSteps:n}=e,{shouldUseSliders:r}=t;return{refinerSteps:n,shouldUseSliders:r}},je),Cue=()=>{const{refinerSteps:e,shouldUseSliders:t}=W(yue),n=gl(),r=te(),{t:o}=J(),s=d.useCallback(l=>{r(L1(l))},[r]),i=d.useCallback(()=>{r(L1(20))},[r]);return t?a.jsx(jt,{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(Vu,{label:o("sdxl.steps"),min:1,max:500,step:1,onChange:s,value:e,numberInputFieldProps:{textAlign:"center"},isDisabled:!n})},wue=d.memo(Cue);function Sue(){const e=W(s=>s.sdxl.shouldUseSDXLRefiner),t=gl(),n=te(),{t:r}=J(),o=s=>{n(NT(s.target.checked))};return a.jsx(kr,{label:r("sdxl.useRefiner"),isChecked:e,onChange:o,isDisabled:!t})}const kue=ce(we,e=>{const{shouldUseSDXLRefiner:t}=e.sdxl,{shouldUseSliders:n}=e.ui;return{activeLabel:t?"Enabled":void 0,shouldUseSliders:n}},je),jue=()=>{const{activeLabel:e,shouldUseSliders:t}=W(kue),{t:n}=J();return gl()?a.jsx(Ao,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsxs($,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Sue,{}),a.jsx(iue,{}),a.jsxs($,{gap:2,flexDirection:t?"column":"row",children:[a.jsx(wue,{}),a.jsx(rue,{})]}),a.jsx(gue,{}),a.jsx(pue,{}),a.jsx(uue,{}),a.jsx(bue,{})]})}):a.jsx(Ao,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsx($,{sx:{justifyContent:"center",p:2},children:a.jsx(Se,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:n("models.noRefinerModelsInstalled")})})})},L2=d.memo(jue),_ue=ce([we],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:l}=t.sd.guidance,{cfgScale:u}=e,{shouldUseSliders:p}=n,{shift:m}=r;return{cfgScale:u,initial:o,min:s,sliderMax:i,inputMax:l,shouldUseSliders:p,shift:m}},je),Iue=()=>{const{cfgScale:e,initial:t,min:n,sliderMax:r,inputMax:o,shouldUseSliders:s,shift:i}=W(_ue),l=te(),{t:u}=J(),p=d.useCallback(h=>l(Dm(h)),[l]),m=d.useCallback(()=>l(Dm(t)),[l,t]);return s?a.jsx(wn,{feature:"paramCFGScale",children:a.jsx(jt,{label:u("parameters.cfgScale"),step:i?.1:.5,min:n,max:r,onChange:p,handleReset:m,value:e,sliderNumberInputProps:{max:o},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1})}):a.jsx(wn,{feature:"paramCFGScale",children:a.jsx(Vu,{label:u("parameters.cfgScale"),step:.5,min:n,max:o,onChange:p,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})})},Da=d.memo(Iue),Pue=ce(we,e=>({model:e.generation.model}),je),Eue=()=>{const e=te(),{t}=J(),{model:n}=W(Pue),r=jn("syncModels").isFeatureEnabled,{data:o,isLoading:s}=na(Uw),{data:i,isLoading:l}=Bd(Uw),u=W(ro),p=d.useMemo(()=>{if(!o)return[];const g=[];return qr(o.entities,(x,y)=>{x&&g.push({value:y,label:x.model_name,group:gr[x.base_model]})}),qr(i==null?void 0:i.entities,(x,y)=>{!x||u==="unifiedCanvas"||u==="img2img"||g.push({value:y,label:x.model_name,group:gr[x.base_model]})}),g},[o,i,u]),m=d.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]),h=d.useCallback(g=>{if(!g)return;const x=g0(g);x&&e(N1(x))},[e]);return s||l?a.jsx(tr,{label:t("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):a.jsxs($,{w:"100%",alignItems:"center",gap:3,children:[a.jsx(wn,{feature:"paramModel",children:a.jsx(tr,{tooltip:m==null?void 0:m.description,label:t("modelManager.model"),value:m==null?void 0:m.id,placeholder:p.length>0?"Select a model":"No models available",data:p,error:p.length===0,disabled:p.length===0,onChange:h,w:"100%"})}),r&&a.jsx(De,{mt:6,children:a.jsx(Wu,{iconMode:!0})})]})},Mue=d.memo(Eue),Oue=ce(we,({generation:e})=>{const{model:t,vae:n}=e;return{model:t,vae:n}},je),Rue=()=>{const e=te(),{t}=J(),{model:n,vae:r}=W(Oue),{data:o}=nP(),s=d.useMemo(()=>{if(!o)return[];const u=[{value:"default",label:"Default",group:"Default"}];return qr(o.entities,(p,m)=>{if(!p)return;const h=(n==null?void 0:n.base_model)!==p.base_model;u.push({value:m,label:p.model_name,group:gr[p.base_model],disabled:h,tooltip:h?`Incompatible base model: ${p.base_model}`:void 0})}),u.sort((p,m)=>p.disabled&&!m.disabled?1:-1)},[o,n==null?void 0:n.base_model]),i=d.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]),l=d.useCallback(u=>{if(!u||u==="default"){e(Gw(null));return}const p=iR(u);p&&e(Gw(p))},[e]);return a.jsx(wn,{feature:"paramVAE",children:a.jsx(tr,{itemComponent:fl,tooltip:i==null?void 0:i.description,label:t("modelManager.vae"),value:(i==null?void 0:i.id)??"default",placeholder:"Default",data:s,onChange:l,disabled:s.length===0,clearable:!0})})},Aue=d.memo(Rue),Due=ce([sP,da],(e,t)=>{const{scheduler:n}=t,{favoriteSchedulers:r}=e,o=Ro(tg,(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}},je),Tue=()=>{const e=te(),{t}=J(),{scheduler:n,data:r}=W(Due),o=d.useCallback(s=>{s&&e($1(s))},[e]);return a.jsx(wn,{feature:"paramScheduler",children:a.jsx(tr,{label:t("parameters.scheduler"),value:n,data:r,onChange:o})})},Nue=d.memo(Tue),$ue=ce(we,({generation:e})=>{const{vaePrecision:t}=e;return{vaePrecision:t}},je),Lue=["fp16","fp32"],zue=()=>{const{t:e}=J(),t=te(),{vaePrecision:n}=W($ue),r=d.useCallback(o=>{o&&t($T(o))},[t]);return a.jsx(wn,{feature:"paramVAEPrecision",children:a.jsx(Tr,{label:e("modelManager.vaePrecision"),value:n,data:Lue,onChange:r})})},Fue=d.memo(zue),Bue=()=>{const e=jn("vae").isFeatureEnabled;return a.jsxs($,{gap:3,w:"full",flexWrap:e?"wrap":"nowrap",children:[a.jsx(De,{w:"full",children:a.jsx(Mue,{})}),a.jsx(De,{w:"full",children:a.jsx(Nue,{})}),e&&a.jsxs($,{w:"full",gap:3,children:[a.jsx(Aue,{}),a.jsx(Fue,{})]})]})},Ta=d.memo(Bue),vR=[{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}],xR=vR.map(e=>e.value);function bR(){const e=W(o=>o.generation.aspectRatio),t=te(),n=W(o=>o.generation.shouldFitToWidthHeight),r=W(ro);return a.jsx(zn,{isAttached:!0,children:vR.map(o=>a.jsx(Mt,{size:"sm",isChecked:e===o.value,isDisabled:r==="img2img"?!n:!1,onClick:()=>{t(Us(o.value)),t(Hd(!1))},children:o.name},o.name))})}const Hue=ce([we],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:l}=n.sd.height,{model:u,height:p}=e,{aspectRatio:m}=e,h=t.shift?i:l;return{model:u,height:p,min:r,sliderMax:o,inputMax:s,step:h,aspectRatio:m}},je),Wue=e=>{const{model:t,height:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:l}=W(Hue),u=te(),{t:p}=J(),m=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,h=d.useCallback(x=>{if(u(Hl(x)),l){const y=Gr(x*l,8);u(Bl(y))}},[u,l]),g=d.useCallback(()=>{if(u(Hl(m)),l){const x=Gr(m*l,8);u(Bl(x))}},[u,m,l]);return a.jsx(jt,{label:p("parameters.height"),value:n,min:r,step:i,max:o,onChange:h,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},Vue=d.memo(Wue),Uue=ce([we],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:l}=n.sd.width,{model:u,width:p,aspectRatio:m}=e,h=t.shift?i:l;return{model:u,width:p,min:r,sliderMax:o,inputMax:s,step:h,aspectRatio:m}},je),Gue=e=>{const{model:t,width:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:l}=W(Uue),u=te(),{t:p}=J(),m=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,h=d.useCallback(x=>{if(u(Bl(x)),l){const y=Gr(x/l,8);u(Hl(y))}},[u,l]),g=d.useCallback(()=>{if(u(Bl(m)),l){const x=Gr(m/l,8);u(Hl(x))}},[u,m,l]);return a.jsx(jt,{label:p("parameters.width"),value:n,min:r,step:i,max:o,onChange:h,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},que=d.memo(Gue),Kue=ce([da,ro],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}=e;return{activeTabName:t,shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}},je);function _u(){const{t:e}=J(),t=te(),{activeTabName:n,shouldFitToWidthHeight:r,shouldLockAspectRatio:o,width:s,height:i}=W(Kue),l=d.useCallback(()=>{o?(t(Hd(!1)),xR.includes(s/i)?t(Us(s/i)):t(Us(null))):(t(Hd(!0)),t(Us(s/i)))},[o,s,i,t]),u=d.useCallback(()=>{t(LT()),t(Us(null)),o&&t(Us(i/s))},[t,o,s,i]);return a.jsxs($,{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(Kn,{as:$,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(Rr,{children:e("parameters.aspectRatio")}),a.jsx(ki,{}),a.jsx(bR,{}),a.jsx(ot,{tooltip:e("ui.swapSizes"),"aria-label":e("ui.swapSizes"),size:"sm",icon:a.jsx(y8,{}),fontSize:20,isDisabled:n==="img2img"?!r:!1,onClick:u}),a.jsx(ot,{tooltip:e("ui.lockRatio"),"aria-label":e("ui.lockRatio"),size:"sm",icon:a.jsx(qM,{}),isChecked:o,isDisabled:n==="img2img"?!r:!1,onClick:l})]})}),a.jsx($,{gap:2,alignItems:"center",children:a.jsxs($,{gap:2,flexDirection:"column",width:"full",children:[a.jsx(que,{isDisabled:n==="img2img"?!r:!1}),a.jsx(Vue,{isDisabled:n==="img2img"?!r:!1})]})})]})}const Que=ce([we],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:l,fineStep:u,coarseStep:p}=t.sd.steps,{steps:m}=e,{shouldUseSliders:h}=n,g=r.shift?u:p;return{steps:m,initial:o,min:s,sliderMax:i,inputMax:l,step:g,shouldUseSliders:h}},je),Xue=()=>{const{steps:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:i}=W(Que),l=te(),{t:u}=J(),p=d.useCallback(g=>{l(Tm(g))},[l]),m=d.useCallback(()=>{l(Tm(t))},[l,t]),h=d.useCallback(()=>{l(Ab())},[l]);return i?a.jsx(wn,{feature:"paramSteps",children:a.jsx(jt,{label:u("parameters.steps"),min:n,max:r,step:s,onChange:p,handleReset:m,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:o}})}):a.jsx(wn,{feature:"paramSteps",children:a.jsx(Vu,{label:u("parameters.steps"),min:n,max:o,step:s,onChange:p,value:e,numberInputFieldProps:{textAlign:"center"},onBlur:h})})},Na=d.memo(Xue);function yR(){const e=te(),t=W(o=>o.generation.shouldFitToWidthHeight),n=o=>e(zT(o.target.checked)),{t:r}=J();return a.jsx(kr,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function Yue(){const e=W(i=>i.generation.seed),t=W(i=>i.generation.shouldRandomizeSeed),n=W(i=>i.generation.shouldGenerateVariations),{t:r}=J(),o=te(),s=i=>o(Am(i));return a.jsx(Vu,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:aP,max:iP,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e})}const Jue=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);function Zue(){const e=te(),t=W(o=>o.generation.shouldRandomizeSeed),{t:n}=J(),r=()=>e(Am(Jue(aP,iP)));return a.jsx(ot,{size:"sm",isDisabled:t,"aria-label":n("parameters.shuffle"),tooltip:n("parameters.shuffle"),onClick:r,icon:a.jsx(kee,{})})}const ede=()=>{const e=te(),{t}=J(),n=W(o=>o.generation.shouldRandomizeSeed),r=o=>e(FT(o.target.checked));return a.jsx(kr,{label:t("common.random"),isChecked:n,onChange:r})},tde=d.memo(ede),nde=()=>a.jsx(wn,{feature:"paramSeed",children:a.jsxs($,{sx:{gap:3,alignItems:"flex-end"},children:[a.jsx(Yue,{}),a.jsx(Zue,{}),a.jsx(tde,{})]})}),$a=d.memo(nde),CR=Oe((e,t)=>a.jsxs($,{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]}));CR.displayName="SubSettingsWrapper";const Iu=d.memo(CR),rde=ce([we],({sdxl:e})=>{const{sdxlImg2ImgDenoisingStrength:t}=e;return{sdxlImg2ImgDenoisingStrength:t}},je),ode=()=>{const{sdxlImg2ImgDenoisingStrength:e}=W(rde),t=te(),{t:n}=J(),r=d.useCallback(s=>t(qw(s)),[t]),o=d.useCallback(()=>{t(qw(.7))},[t]);return a.jsx(wn,{feature:"paramDenoisingStrength",children:a.jsx(Iu,{children:a.jsx(jt,{label:n("sdxl.denoisingStrength"),step:.01,min:0,max:1,onChange:r,handleReset:o,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0})})})},wR=d.memo(ode),sde=ce([sP,da],(e,t)=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},je),ade=()=>{const{t:e}=J(),{shouldUseSliders:t,activeLabel:n}=W(sde);return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs($,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(_u,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(_u,{})]}),a.jsx(wR,{}),a.jsx(yR,{})]})})},ide=d.memo(ade),lde=()=>a.jsxs(a.Fragment,{children:[a.jsx($2,{}),a.jsx(ide,{}),a.jsx(L2,{}),a.jsx(Ku,{}),a.jsx(Gu,{}),a.jsx(Uu,{}),a.jsx(qu,{})]}),cde=d.memo(lde),z2=()=>{const{t:e}=J(),t=W(i=>i.generation.shouldRandomizeSeed),n=W(i=>i.generation.iterations),r=d.useMemo(()=>n===1?e("parameters.iterationsWithCount_one",{count:1}):e("parameters.iterationsWithCount_other",{count:n}),[n,e]),o=d.useMemo(()=>e(t?"parameters.randomSeed":"parameters.manualSeed"),[t,e]);return{iterationsAndSeedLabel:d.useMemo(()=>[r,o].join(", "),[r,o]),iterationsLabel:r,seedLabel:o}},ude=()=>{const{t:e}=J(),t=W(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=z2();return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsx($,{sx:{flexDirection:"column",gap:3},children:t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(_u,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(_u,{})]})})})},SR=d.memo(ude),dde=()=>a.jsxs(a.Fragment,{children:[a.jsx($2,{}),a.jsx(SR,{}),a.jsx(L2,{}),a.jsx(Ku,{}),a.jsx(Gu,{}),a.jsx(Uu,{}),a.jsx(qu,{})]}),fde=d.memo(dde),pde=[{label:"Unmasked",value:"unmasked"},{label:"Mask",value:"mask"},{label:"Mask Edge",value:"edge"}],mde=()=>{const e=te(),t=W(o=>o.generation.canvasCoherenceMode),{t:n}=J(),r=o=>{o&&e(BT(o))};return a.jsx(wn,{feature:"compositingCoherenceMode",children:a.jsx(Tr,{label:n("parameters.coherenceMode"),data:pde,value:t,onChange:r})})},hde=d.memo(mde),gde=()=>{const e=te(),t=W(r=>r.generation.canvasCoherenceSteps),{t:n}=J();return a.jsx(wn,{feature:"compositingCoherenceSteps",children:a.jsx(jt,{label:n("parameters.coherenceSteps"),min:1,max:100,step:1,sliderNumberInputProps:{max:999},value:t,onChange:r=>{e(Kw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Kw(20))}})})},vde=d.memo(gde),xde=()=>{const e=te(),t=W(r=>r.generation.canvasCoherenceStrength),{t:n}=J();return a.jsx(wn,{feature:"compositingStrength",children:a.jsx(jt,{label:n("parameters.coherenceStrength"),min:0,max:1,step:.01,sliderNumberInputProps:{max:999},value:t,onChange:r=>{e(Qw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Qw(.3))}})})},bde=d.memo(xde);function yde(){const e=te(),t=W(r=>r.generation.maskBlur),{t:n}=J();return a.jsx(wn,{feature:"compositingBlur",children:a.jsx(jt,{label:n("parameters.maskBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(Xw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Xw(16))}})})}const Cde=[{label:"Box Blur",value:"box"},{label:"Gaussian Blur",value:"gaussian"}];function wde(){const e=W(o=>o.generation.maskBlurMethod),t=te(),{t:n}=J(),r=o=>{o&&t(HT(o))};return a.jsx(wn,{feature:"compositingBlurMethod",children:a.jsx(Tr,{value:e,onChange:r,label:n("parameters.maskBlurMethod"),data:Cde})})}const Sde=()=>{const{t:e}=J();return a.jsx(Ao,{label:e("parameters.compositingSettingsHeader"),children:a.jsxs($,{sx:{flexDirection:"column",gap:2},children:[a.jsxs(Iu,{label:e("parameters.coherencePassHeader"),children:[a.jsx(hde,{}),a.jsx(vde,{}),a.jsx(bde,{})]}),a.jsx(no,{}),a.jsxs(Iu,{label:e("parameters.maskAdjustmentsHeader"),children:[a.jsx(yde,{}),a.jsx(wde,{})]})]})})},kR=d.memo(Sde),kde=ce([we],({generation:e})=>{const{infillMethod:t}=e;return{infillMethod:t}},je),jde=()=>{const e=te(),{infillMethod:t}=W(kde),{data:n,isLoading:r}=OI(),o=n==null?void 0:n.infill_methods,{t:s}=J(),i=d.useCallback(l=>{e(WT(l))},[e]);return a.jsx(wn,{feature:"infillMethod",children:a.jsx(Tr,{disabled:(o==null?void 0:o.length)===0,placeholder:r?"Loading...":void 0,label:s("parameters.infillMethod"),value:t,data:o??[],onChange:i})})},_de=d.memo(jde),Ide=ce([da],e=>{const{infillPatchmatchDownscaleSize:t,infillMethod:n}=e;return{infillPatchmatchDownscaleSize:t,infillMethod:n}},je),Pde=()=>{const e=te(),{infillPatchmatchDownscaleSize:t,infillMethod:n}=W(Ide),{t:r}=J(),o=d.useCallback(i=>{e(Yw(i))},[e]),s=d.useCallback(()=>{e(Yw(2))},[e]);return a.jsx(jt,{isDisabled:n!=="patchmatch",label:r("parameters.patchmatchDownScaleSize"),min:1,max:10,value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},Ede=d.memo(Pde),Mde=ce([da],e=>{const{infillTileSize:t,infillMethod:n}=e;return{infillTileSize:t,infillMethod:n}},je),Ode=()=>{const e=te(),{infillTileSize:t,infillMethod:n}=W(Mde),{t:r}=J(),o=d.useCallback(i=>{e(Jw(i))},[e]),s=d.useCallback(()=>{e(Jw(32))},[e]);return a.jsx(jt,{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})},Rde=d.memo(Ode),Ade=ce([da],e=>{const{infillMethod:t}=e;return{infillMethod:t}},je);function Dde(){const{infillMethod:e}=W(Ade);return a.jsxs($,{children:[e==="tile"&&a.jsx(Rde,{}),e==="patchmatch"&&a.jsx(Ede,{})]})}const jr=e=>e.canvas,Ns=ce([we],({canvas:e})=>e.batchIds.length>0||e.layerState.stagingArea.images.length>0),Tde=ce([jr],e=>{const{boundingBoxScaleMethod:t}=e;return{boundingBoxScale:t}},je),Nde=()=>{const e=te(),{boundingBoxScale:t}=W(Tde),{t:n}=J(),r=o=>{e(UT(o))};return a.jsx(wn,{feature:"scaleBeforeProcessing",children:a.jsx(tr,{label:n("parameters.scaleBeforeProcessing"),data:VT,value:t,onChange:r})})},$de=d.memo(Nde),Lde=ce([da,jr],(e,t)=>{const{scaledBoundingBoxDimensions:n,boundingBoxScaleMethod:r}=t,{model:o,aspectRatio:s}=e;return{model:o,scaledBoundingBoxDimensions:n,isManual:r==="manual",aspectRatio:s}},je),zde=()=>{const e=te(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=W(Lde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=J(),l=p=>{let m=r.width;const h=Math.floor(p);o&&(m=Gr(h*o,64)),e(Lm({width:m,height:h}))},u=()=>{let p=r.width;const m=Math.floor(s);o&&(p=Gr(m*o,64)),e(Lm({width:p,height:m}))};return a.jsx(jt,{isDisabled:!n,label:i("parameters.scaledHeight"),min:64,max:1536,step:64,value:r.height,onChange:l,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},Fde=d.memo(zde),Bde=ce([jr,da],(e,t)=>{const{boundingBoxScaleMethod:n,scaledBoundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,scaledBoundingBoxDimensions:r,aspectRatio:s,isManual:n==="manual"}},je),Hde=()=>{const e=te(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=W(Bde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=J(),l=p=>{const m=Math.floor(p);let h=r.height;o&&(h=Gr(m/o,64)),e(Lm({width:m,height:h}))},u=()=>{const p=Math.floor(s);let m=r.height;o&&(m=Gr(p/o,64)),e(Lm({width:p,height:m}))};return a.jsx(jt,{isDisabled:!n,label:i("parameters.scaledWidth"),min:64,max:1536,step:64,value:r.width,onChange:l,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},Wde=d.memo(Hde),Vde=()=>{const{t:e}=J();return a.jsx(Ao,{label:e("parameters.infillScalingHeader"),children:a.jsxs($,{sx:{gap:2,flexDirection:"column"},children:[a.jsxs(Iu,{children:[a.jsx(_de,{}),a.jsx(Dde,{})]}),a.jsx(no,{}),a.jsxs(Iu,{children:[a.jsx($de,{}),a.jsx(Wde,{}),a.jsx(Fde,{})]})]})})},jR=d.memo(Vde),Ude=ce([we,Ns],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},je),Gde=()=>{const e=te(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=W(Ude),{t:s}=J(),i=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,l=p=>{if(e(Xs({...n,height:Math.floor(p)})),o){const m=Gr(p*o,64);e(Xs({width:m,height:Math.floor(p)}))}},u=()=>{if(e(Xs({...n,height:Math.floor(i)})),o){const p=Gr(i*o,64);e(Xs({width:p,height:Math.floor(i)}))}};return a.jsx(jt,{label:s("parameters.boundingBoxHeight"),min:64,max:1536,step:64,value:n.height,onChange:l,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},qde=d.memo(Gde),Kde=ce([we,Ns],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},je),Qde=()=>{const e=te(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=W(Kde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=J(),l=p=>{if(e(Xs({...n,width:Math.floor(p)})),o){const m=Gr(p/o,64);e(Xs({width:Math.floor(p),height:m}))}},u=()=>{if(e(Xs({...n,width:Math.floor(s)})),o){const p=Gr(s/o,64);e(Xs({width:Math.floor(s),height:p}))}};return a.jsx(jt,{label:i("parameters.boundingBoxWidth"),min:64,max:1536,step:64,value:n.width,onChange:l,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},Xde=d.memo(Qde),Yde=ce([da,jr],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r}=e,{boundingBoxDimensions:o}=t;return{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,boundingBoxDimensions:o}});function Yh(){const e=te(),{t}=J(),{shouldLockAspectRatio:n,boundingBoxDimensions:r}=W(Yde),o=d.useCallback(()=>{n?(e(Hd(!1)),xR.includes(r.width/r.height)?e(Us(r.width/r.height)):e(Us(null))):(e(Hd(!0)),e(Us(r.width/r.height)))},[n,r,e]),s=d.useCallback(()=>{e(GT()),e(Us(null)),n&&e(Us(r.height/r.width))},[e,n,r]);return a.jsxs($,{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(Kn,{as:$,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(Rr,{children:t("parameters.aspectRatio")}),a.jsx(ki,{}),a.jsx(bR,{}),a.jsx(ot,{tooltip:t("ui.swapSizes"),"aria-label":t("ui.swapSizes"),size:"sm",icon:a.jsx(y8,{}),fontSize:20,onClick:s}),a.jsx(ot,{tooltip:t("ui.lockRatio"),"aria-label":t("ui.lockRatio"),size:"sm",icon:a.jsx(qM,{}),isChecked:n,onClick:o})]})}),a.jsx(Xde,{}),a.jsx(qde,{})]})}const Jde=ce(we,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},je),Zde=()=>{const{t:e}=J(),{shouldUseSliders:t,activeLabel:n}=W(Jde);return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs($,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(Yh,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(Yh,{})]}),a.jsx(wR,{})]})})},efe=d.memo(Zde);function tfe(){return a.jsxs(a.Fragment,{children:[a.jsx($2,{}),a.jsx(efe,{}),a.jsx(L2,{}),a.jsx(Ku,{}),a.jsx(Gu,{}),a.jsx(Uu,{}),a.jsx(jR,{}),a.jsx(kR,{}),a.jsx(qu,{})]})}function F2(){return a.jsxs($,{sx:{flexDirection:"column",gap:2},children:[a.jsx(hR,{}),a.jsx(mR,{})]})}function nfe(){const e=W(o=>o.generation.horizontalSymmetrySteps),t=W(o=>o.generation.steps),n=te(),{t:r}=J();return a.jsx(jt,{label:r("parameters.hSymmetryStep"),value:e,onChange:o=>n(Zw(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(Zw(0))})}function rfe(){const e=W(o=>o.generation.verticalSymmetrySteps),t=W(o=>o.generation.steps),n=te(),{t:r}=J();return a.jsx(jt,{label:r("parameters.vSymmetryStep"),value:e,onChange:o=>n(eS(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(eS(0))})}function ofe(){const e=W(n=>n.generation.shouldUseSymmetry),t=te();return a.jsx(kr,{label:"Enable Symmetry",isChecked:e,onChange:n=>t(qT(n.target.checked))})}const sfe=ce(we,e=>({activeLabel:e.generation.shouldUseSymmetry?"Enabled":void 0}),je),afe=()=>{const{t:e}=J(),{activeLabel:t}=W(sfe);return jn("symmetry").isFeatureEnabled?a.jsx(Ao,{label:e("parameters.symmetry"),activeLabel:t,children:a.jsxs($,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(ofe,{}),a.jsx(nfe,{}),a.jsx(rfe,{})]})}):null},B2=d.memo(afe),ife=ce([we],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:l,coarseStep:u}=n.sd.img2imgStrength,{img2imgStrength:p}=e,m=t.shift?l:u;return{img2imgStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:m}},je),lfe=()=>{const{img2imgStrength:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s}=W(ife),i=te(),{t:l}=J(),u=d.useCallback(m=>i(Nm(m)),[i]),p=d.useCallback(()=>{i(Nm(t))},[i,t]);return a.jsx(wn,{feature:"paramDenoisingStrength",children:a.jsx(Iu,{children:a.jsx(jt,{label:`${l("parameters.denoisingStrength")}`,step:s,min:n,max:r,onChange:u,handleReset:p,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,sliderNumberInputProps:{max:o}})})})},_R=d.memo(lfe),cfe=()=>{const{t:e}=J(),t=W(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=z2();return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs($,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(_u,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(_u,{})]}),a.jsx(_R,{}),a.jsx(yR,{})]})})},ufe=d.memo(cfe),dfe=()=>a.jsxs(a.Fragment,{children:[a.jsx(F2,{}),a.jsx(ufe,{}),a.jsx(Ku,{}),a.jsx(Gu,{}),a.jsx(Uu,{}),a.jsx(B2,{}),a.jsx(qu,{})]}),ffe=d.memo(dfe);function pfe(e){return Math.floor((e-1)/8)*8}const mfe=ce([we],({generation:e,hotkeys:t,config:n})=>{const{min:r,fineStep:o,coarseStep:s}=n.sd.height,{model:i,height:l,hrfHeight:u,aspectRatio:p,hrfEnabled:m}=e,h=t.shift?o:s;return{model:i,height:l,hrfHeight:u,min:r,step:h,aspectRatio:p,hrfEnabled:m}},je),hfe=e=>{const{height:t,hrfHeight:n,min:r,step:o,aspectRatio:s,hrfEnabled:i}=W(mfe),l=te(),u=Math.max(pfe(t),r),p=d.useCallback(h=>{if(l(zm(h)),s){const g=Gr(h*s,8);l(Fm(g))}},[l,s]),m=d.useCallback(()=>{if(l(zm(u)),s){const h=Gr(u*s,8);l(Fm(h))}},[l,u,s]);return a.jsx(jt,{label:"Initial Height",value:n,min:r,step:o,max:u,onChange:p,handleReset:m,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:u},isDisabled:!i,...e})},gfe=d.memo(hfe),vfe=ce([we],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:l,coarseStep:u}=n.sd.hrfStrength,{hrfStrength:p,hrfEnabled:m}=e,h=t.shift?l:u;return{hrfStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:h,hrfEnabled:m}},je),xfe=()=>{const{hrfStrength:e,initial:t,min:n,sliderMax:r,step:o,hrfEnabled:s}=W(vfe),i=te(),l=d.useCallback(()=>{i(tS(t))},[i,t]),u=d.useCallback(p=>{i(tS(p))},[i]);return a.jsx(jt,{label:"Denoising Strength","aria-label":"High Resolution Denoising Strength",min:n,max:r,step:o,value:e,onChange:u,withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:l,isDisabled:!s})},bfe=d.memo(xfe);function yfe(){const e=te(),t=W(r=>r.generation.hrfEnabled),n=d.useCallback(r=>e(KT(r.target.checked)),[e]);return a.jsx(kr,{label:"Enable High Resolution Fix",isChecked:t,onChange:n})}function Cfe(e){return Math.floor((e-1)/8)*8}const wfe=ce([we],({generation:e,hotkeys:t,config:n})=>{const{min:r,fineStep:o,coarseStep:s}=n.sd.width,{model:i,width:l,hrfWidth:u,aspectRatio:p,hrfEnabled:m}=e,h=t.shift?o:s;return{model:i,width:l,hrfWidth:u,min:r,step:h,aspectRatio:p,hrfEnabled:m}},je),Sfe=e=>{const{width:t,hrfWidth:n,min:r,step:o,aspectRatio:s,hrfEnabled:i}=W(wfe),l=te(),u=Math.max(Cfe(t),r),p=d.useCallback(h=>{if(l(Fm(h)),s){const g=Gr(h/s,8);l(zm(g))}},[l,s]),m=d.useCallback(()=>{if(l(Fm(u)),s){const h=Gr(u/s,8);l(zm(h))}},[l,u,s]);return a.jsx(jt,{label:"Initial Width",value:n,min:r,step:o,max:u,onChange:p,handleReset:m,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:u},isDisabled:!i,...e})},kfe=d.memo(Sfe),jfe=ce(we,e=>{const{hrfEnabled:t}=e.generation;return{hrfEnabled:t}},je);function _fe(){const{t:e}=J(),t=jn("hrf").isFeatureEnabled,{hrfEnabled:n}=W(jfe),r=d.useMemo(()=>{if(n)return e("common.on")},[e,n]);return t?a.jsx(Ao,{label:"High Resolution Fix",activeLabel:r,children:a.jsxs($,{sx:{flexDir:"column",gap:2},children:[a.jsx(yfe,{}),n&&a.jsxs($,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.100",_dark:{bg:"base.750"}},children:[a.jsx(kfe,{}),a.jsx(gfe,{})]}),n&&a.jsx(bfe,{})]})}):null}const Ife=()=>a.jsxs(a.Fragment,{children:[a.jsx(F2,{}),a.jsx(SR,{}),a.jsx(Ku,{}),a.jsx(Gu,{}),a.jsx(Uu,{}),a.jsx(B2,{}),a.jsx(_fe,{}),a.jsx(qu,{})]}),Pfe=d.memo(Ife),Efe=()=>{const{t:e}=J(),t=W(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=z2();return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs($,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(Yh,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(Yh,{})]}),a.jsx(_R,{})]})})},Mfe=d.memo(Efe),Ofe=()=>a.jsxs(a.Fragment,{children:[a.jsx(F2,{}),a.jsx(Mfe,{}),a.jsx(Ku,{}),a.jsx(Gu,{}),a.jsx(Uu,{}),a.jsx(B2,{}),a.jsx(jR,{}),a.jsx(kR,{}),a.jsx(qu,{})]}),Rfe=d.memo(Ofe),Afe=()=>{const e=W(ro),t=W(n=>n.generation.model);return e==="txt2img"?a.jsx(Om,{children:t&&t.base_model==="sdxl"?a.jsx(fde,{}):a.jsx(Pfe,{})}):e==="img2img"?a.jsx(Om,{children:t&&t.base_model==="sdxl"?a.jsx(cde,{}):a.jsx(ffe,{})}):e==="unifiedCanvas"?a.jsx(Om,{children:t&&t.base_model==="sdxl"?a.jsx(tfe,{}):a.jsx(Rfe,{})}):null},Dfe=d.memo(Afe),Om=d.memo(e=>a.jsxs($,{sx:{w:"full",h:"full",flexDir:"column",gap:2},children:[a.jsx(O8,{}),a.jsx($,{layerStyle:"first",sx:{w:"full",h:"full",position:"relative",borderRadius:"base",p:2},children:a.jsx($,{sx:{w:"full",h:"full",position:"relative"},children:a.jsx(De,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(e0,{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($,{sx:{gap:2,flexDirection:"column",h:"full",w:"full"},children:e.children})})})})})]}));Om.displayName="ParametersPanelWrapper";const Tfe=ce([we],e=>{const{initialImage:t}=e.generation;return{initialImage:t,isResetButtonDisabled:!t}},je),Nfe=()=>{const{initialImage:e}=W(Tfe),{currentData:t}=Ps((e==null?void 0:e.imageName)??Os.skipToken),n=d.useMemo(()=>{if(t)return{id:"initial-image",payloadType:"IMAGE_DTO",payload:{imageDTO:t}}},[t]),r=d.useMemo(()=>({id:"initial-image",actionType:"SET_INITIAL_IMAGE"}),[]);return a.jsx(al,{imageDTO:t,droppableData:r,draggableData:n,isUploadDisabled:!0,fitContainer:!0,dropLabel:"Set as Initial Image",noContentFallback:a.jsx(eo,{label:"No initial image selected"}),dataTestId:"initial-image"})},$fe=d.memo(Nfe),Lfe=ce([we],e=>{const{initialImage:t}=e.generation;return{isResetButtonDisabled:!t}},je),zfe={type:"SET_INITIAL_IMAGE"},Ffe=()=>{const{isResetButtonDisabled:e}=W(Lfe),t=te(),{getUploadButtonProps:n,getUploadInputProps:r}=y2({postUploadAction:zfe}),o=d.useCallback(()=>{t(QT())},[t]);return a.jsxs($,{layerStyle:"first",sx:{position:"relative",flexDirection:"column",height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",p:2,gap:4},children:[a.jsxs($,{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(ki,{}),a.jsx(ot,{tooltip:"Upload Initial Image","aria-label":"Upload Initial Image",icon:a.jsx(Kg,{}),...n()}),a.jsx(ot,{tooltip:"Reset Initial Image","aria-label":"Reset Initial Image",icon:a.jsx(qg,{}),onClick:o,isDisabled:e})]}),a.jsx($fe,{}),a.jsx("input",{...r()})]})},Bfe=d.memo(Ffe),Hfe=e=>{const{onClick:t,isDisabled:n}=e,{t:r}=J(),o=W(s=>s.system.isConnected);return a.jsx(ot,{onClick:t,icon:a.jsx(qo,{}),tooltip:`${r("gallery.deleteImage")} (Del)`,"aria-label":`${r("gallery.deleteImage")} (Del)`,isDisabled:n||!o,colorScheme:"error"})},IR=()=>{const[e,{isLoading:t}]=sg({fixedCacheKey:"enqueueBatch"}),[n,{isLoading:r}]=eP({fixedCacheKey:"resumeProcessor"}),[o,{isLoading:s}]=JI({fixedCacheKey:"pauseProcessor"}),[i,{isLoading:l}]=Mb({fixedCacheKey:"cancelQueueItem"}),[u,{isLoading:p}]=YI({fixedCacheKey:"clearQueue"}),[m,{isLoading:h}]=lP({fixedCacheKey:"pruneQueue"});return t||r||s||l||p||h},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=W(r=>r.postprocessing.esrganModelName),t=te(),n=r=>t(XT(r));return a.jsx(Tr,{label:"ESRGAN Model",value:e,itemComponent:fl,onChange:n,data:Wfe})}const Ufe=e=>{const{imageDTO:t}=e,n=te(),r=IR(),{t:o}=J(),{isOpen:s,onOpen:i,onClose:l}=Uo(),{isAllowedToUpscale:u,detail:p}=YT(t),m=d.useCallback(()=>{l(),!(!t||!u)&&n(cP({imageDTO:t}))},[n,t,u,l]);return a.jsx(Hf,{isOpen:s,onClose:l,triggerComponent:a.jsx(ot,{tooltip:o("parameters.upscale"),onClick:i,icon:a.jsx(WM,{}),"aria-label":o("parameters.upscale")}),children:a.jsxs($,{sx:{flexDirection:"column",gap:4},children:[a.jsx(Vfe,{}),a.jsx(Mt,{tooltip:p,size:"sm",isDisabled:!t||r||!u,onClick:m,children:o("parameters.upscaleImage")})]})})},Gfe=d.memo(Ufe),qfe=ce([we,ro],({gallery:e,system:t,ui:n,config:r},o)=>{const{isConnected:s,shouldConfirmOnDelete:i,denoiseProgress:l}=t,{shouldShowImageDetails:u,shouldHidePreview:p,shouldShowProgressInViewer:m}=n,{shouldFetchMetadataFromApi:h}=r,g=e.selection[e.selection.length-1];return{shouldConfirmOnDelete:i,isConnected:s,shouldDisableToolbarButtons:!!(l!=null&&l.progress_image)||!g,shouldShowImageDetails:u,activeTabName:o,shouldHidePreview:p,shouldShowProgressInViewer:m,lastSelectedImage:g,shouldFetchMetadataFromApi:h}},{memoizeOptions:{resultEqualityCheck:Tn}}),Kfe=()=>{const e=te(),{isConnected:t,shouldDisableToolbarButtons:n,shouldShowImageDetails:r,lastSelectedImage:o,shouldShowProgressInViewer:s}=W(qfe),i=jn("upscaling").isFeatureEnabled,l=IR(),u=oc(),{t:p}=J(),{recallBothPrompts:m,recallSeed:h,recallAllParameters:g}=l0(),{currentData:x}=Ps((o==null?void 0:o.image_name)??Os.skipToken),{metadata:y,isLoading:b}=j2(o==null?void 0:o.image_name),{workflow:C,isLoading:S}=_2(o==null?void 0:o.workflow_id),j=d.useCallback(()=>{C&&e(Pb(C))},[e,C]),_=d.useCallback(()=>{g(y)},[y,g]);It("a",_,[y]);const P=d.useCallback(()=>{h(y==null?void 0:y.seed)},[y==null?void 0:y.seed,h]);It("s",P,[x]);const I=d.useCallback(()=>{m(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,m]);It("p",I,[x]),It("w",j,[C]);const M=d.useCallback(()=>{e(C8()),e(rg(x))},[e,x]);It("shift+i",M,[x]);const O=d.useCallback(()=>{x&&e(cP({imageDTO:x}))},[e,x]),A=d.useCallback(()=>{x&&e(og([x]))},[e,x]);It("Shift+U",()=>{O()},{enabled:()=>!!(i&&!n&&t)},[i,x,n,t]);const D=d.useCallback(()=>e(JT(!r)),[e,r]);It("i",()=>{x?D():u({title:p("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[x,r,u]),It("delete",()=>{A()},[e,x]);const R=d.useCallback(()=>{e(RI(!s))},[e,s]);return a.jsx(a.Fragment,{children:a.jsxs($,{sx:{flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(zn,{isAttached:!0,isDisabled:n,children:a.jsxs(bg,{isLazy:!0,children:[a.jsx(yg,{as:ot,"aria-label":p("parameters.imageActions"),tooltip:p("parameters.imageActions"),isDisabled:!x,icon:a.jsx(Goe,{})}),a.jsx(Ul,{motionProps:fu,children:x&&a.jsx(w8,{imageDTO:x})})]})}),a.jsxs(zn,{isAttached:!0,isDisabled:n,children:[a.jsx(ot,{isLoading:S,icon:a.jsx(C2,{}),tooltip:`${p("nodes.loadWorkflow")} (W)`,"aria-label":`${p("nodes.loadWorkflow")} (W)`,isDisabled:!C,onClick:j}),a.jsx(ot,{isLoading:b,icon:a.jsx(QM,{}),tooltip:`${p("parameters.usePrompt")} (P)`,"aria-label":`${p("parameters.usePrompt")} (P)`,isDisabled:!(y!=null&&y.positive_prompt),onClick:I}),a.jsx(ot,{isLoading:b,icon:a.jsx(XM,{}),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:P}),a.jsx(ot,{isLoading:b,icon:a.jsx(zM,{}),tooltip:`${p("parameters.useAll")} (A)`,"aria-label":`${p("parameters.useAll")} (A)`,isDisabled:!y,onClick:_})]}),i&&a.jsx(zn,{isAttached:!0,isDisabled:l,children:i&&a.jsx(Gfe,{imageDTO:x})}),a.jsx(zn,{isAttached:!0,children:a.jsx(ot,{icon:a.jsx(BM,{}),tooltip:`${p("parameters.info")} (I)`,"aria-label":`${p("parameters.info")} (I)`,isChecked:r,onClick:D})}),a.jsx(zn,{isAttached:!0,children:a.jsx(ot,{"aria-label":p("settings.displayInProgress"),tooltip:p("settings.displayInProgress"),icon:a.jsx(hee,{}),isChecked:s,onClick:R})}),a.jsx(zn,{isAttached:!0,children:a.jsx(Hfe,{onClick:A})})]})})},Qfe=d.memo(Kfe),Xfe=ce([we,Eb],(e,t)=>{var j,_;const{data:n,status:r}=ZT.endpoints.listImages.select(t)(e),{data:o}=e.gallery.galleryView==="images"?nS.endpoints.getBoardImagesTotal.select(t.board_id??"none")(e):nS.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 l={...t,offset:n.ids.length,limit:XI},u=eN.getSelectors(),p=u.selectAll(n),m=p.findIndex(P=>P.image_name===s.image_name),h=Fl(m+1,0,p.length-1),g=Fl(m-1,0,p.length-1),x=(j=p[h])==null?void 0:j.image_name,y=(_=p[g])==null?void 0:_.image_name,b=x?u.selectById(n,x):void 0,C=y?u.selectById(n,y):void 0,S=p.length;return{loadedImagesCount:p.length,currentImageIndex:m,areMoreImagesAvailable:((o==null?void 0:o.total)??0)>S,isFetching:r==="pending",nextImage:b,prevImage:C,queryArgs:l}},{memoizeOptions:{resultEqualityCheck:Tn}}),PR=()=>{const e=te(),{nextImage:t,prevImage:n,areMoreImagesAvailable:r,isFetching:o,queryArgs:s,loadedImagesCount:i,currentImageIndex:l}=W(Xfe),u=d.useCallback(()=>{n&&e(rS(n))},[e,n]),p=d.useCallback(()=>{t&&e(rS(t))},[e,t]),[m]=QI(),h=d.useCallback(()=>{m(s)},[m,s]);return{handlePrevImage:u,handleNextImage:p,isOnFirstImage:l===0,isOnLastImage:l!==void 0&&l===i-1,nextImage:t,prevImage:n,areMoreImagesAvailable:r,handleLoadMoreImages:h,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();return t?a.jsxs($,{gap:2,children:[n&&a.jsx(Fn,{label:`Recall ${e}`,children:a.jsx(Pa,{"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(Pa,{"aria-label":`Copy ${e}`,icon:a.jsx(Lu,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),a.jsxs($,{direction:o?"column":"row",children:[a.jsxs(Se,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?a.jsxs(vg,{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},go=d.memo(Jfe),Zfe=e=>{const{metadata:t}=e,{t:n}=J(),{recallPositivePrompt:r,recallNegativePrompt:o,recallSeed:s,recallCfgScale:i,recallModel:l,recallScheduler:u,recallSteps:p,recallWidth:m,recallHeight:h,recallStrength:g,recallLoRA:x,recallControlNet:y,recallIPAdapter:b,recallT2IAdapter:C}=l0(),S=d.useCallback(()=>{r(t==null?void 0:t.positive_prompt)},[t==null?void 0:t.positive_prompt,r]),j=d.useCallback(()=>{o(t==null?void 0:t.negative_prompt)},[t==null?void 0:t.negative_prompt,o]),_=d.useCallback(()=>{s(t==null?void 0:t.seed)},[t==null?void 0:t.seed,s]),P=d.useCallback(()=>{l(t==null?void 0:t.model)},[t==null?void 0:t.model,l]),I=d.useCallback(()=>{m(t==null?void 0:t.width)},[t==null?void 0:t.width,m]),M=d.useCallback(()=>{h(t==null?void 0:t.height)},[t==null?void 0:t.height,h]),O=d.useCallback(()=>{u(t==null?void 0:t.scheduler)},[t==null?void 0:t.scheduler,u]),A=d.useCallback(()=>{p(t==null?void 0:t.steps)},[t==null?void 0:t.steps,p]),D=d.useCallback(()=>{i(t==null?void 0:t.cfg_scale)},[t==null?void 0:t.cfg_scale,i]),R=d.useCallback(()=>{g(t==null?void 0:t.strength)},[t==null?void 0:t.strength,g]),N=d.useCallback(G=>{x(G)},[x]),Y=d.useCallback(G=>{y(G)},[y]),F=d.useCallback(G=>{b(G)},[b]),V=d.useCallback(G=>{C(G)},[C]),Q=d.useMemo(()=>t!=null&&t.controlnets?t.controlnets.filter(G=>$m(G.control_model)):[],[t==null?void 0:t.controlnets]),q=d.useMemo(()=>t!=null&&t.ipAdapters?t.ipAdapters.filter(G=>$m(G.ip_adapter_model)):[],[t==null?void 0:t.ipAdapters]),z=d.useMemo(()=>t!=null&&t.t2iAdapters?t.t2iAdapters.filter(G=>tN(G.t2i_adapter_model)):[],[t==null?void 0:t.t2iAdapters]);return!t||Object.keys(t).length===0?null:a.jsxs(a.Fragment,{children:[t.created_by&&a.jsx(go,{label:n("metadata.createdBy"),value:t.created_by}),t.generation_mode&&a.jsx(go,{label:n("metadata.generationMode"),value:t.generation_mode}),t.positive_prompt&&a.jsx(go,{label:n("metadata.positivePrompt"),labelPosition:"top",value:t.positive_prompt,onClick:S}),t.negative_prompt&&a.jsx(go,{label:n("metadata.negativePrompt"),labelPosition:"top",value:t.negative_prompt,onClick:j}),t.seed!==void 0&&t.seed!==null&&a.jsx(go,{label:n("metadata.seed"),value:t.seed,onClick:_}),t.model!==void 0&&t.model!==null&&t.model.model_name&&a.jsx(go,{label:n("metadata.model"),value:t.model.model_name,onClick:P}),t.width&&a.jsx(go,{label:n("metadata.width"),value:t.width,onClick:I}),t.height&&a.jsx(go,{label:n("metadata.height"),value:t.height,onClick:M}),t.scheduler&&a.jsx(go,{label:n("metadata.scheduler"),value:t.scheduler,onClick:O}),t.steps&&a.jsx(go,{label:n("metadata.steps"),value:t.steps,onClick:A}),t.cfg_scale!==void 0&&t.cfg_scale!==null&&a.jsx(go,{label:n("metadata.cfgScale"),value:t.cfg_scale,onClick:D}),t.strength&&a.jsx(go,{label:n("metadata.strength"),value:t.strength,onClick:R}),t.loras&&t.loras.map((G,T)=>{if(NI(G.lora))return a.jsx(go,{label:"LoRA",value:`${G.lora.model_name} - ${G.weight}`,onClick:()=>N(G)},T)}),Q.map((G,T)=>{var B;return a.jsx(go,{label:"ControlNet",value:`${(B=G.control_model)==null?void 0:B.model_name} - ${G.control_weight}`,onClick:()=>Y(G)},T)}),q.map((G,T)=>{var B;return a.jsx(go,{label:"IP Adapter",value:`${(B=G.ip_adapter_model)==null?void 0:B.model_name} - ${G.weight}`,onClick:()=>F(G)},T)}),z.map((G,T)=>{var B;return a.jsx(go,{label:"T2I Adapter",value:`${(B=G.t2i_adapter_model)==null?void 0:B.model_name} - ${G.weight}`,onClick:()=>V(G)},T)})]})},epe=d.memo(Zfe),tpe=({image:e})=>{const{t}=J(),{metadata:n}=j2(e.image_name),{workflow:r}=_2(e.workflow_id);return a.jsxs($,{layerStyle:"first",sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",borderRadius:"base",position:"absolute",overflow:"hidden"},children:[a.jsxs($,{gap:2,children:[a.jsx(Se,{fontWeight:"semibold",children:"File:"}),a.jsxs(vg,{href:e.image_url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.image_name,a.jsx(DO,{mx:"2px"})]})]}),a.jsxs(nc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(rc,{children:[a.jsx(Po,{children:t("metadata.recallParameters")}),a.jsx(Po,{children:t("metadata.metadata")}),a.jsx(Po,{children:t("metadata.imageDetails")}),a.jsx(Po,{children:t("metadata.workflow")})]}),a.jsxs(Tu,{children:[a.jsx(ss,{children:n?a.jsx(Hu,{children:a.jsx(epe,{metadata:n})}):a.jsx(eo,{label:t("metadata.noRecallParameters")})}),a.jsx(ss,{children:n?a.jsx(Zi,{data:n,label:t("metadata.metadata")}):a.jsx(eo,{label:t("metadata.noMetaData")})}),a.jsx(ss,{children:e?a.jsx(Zi,{data:e,label:t("metadata.imageDetails")}):a.jsx(eo,{label:t("metadata.noImageDetails")})}),a.jsx(ss,{children:r?a.jsx(Zi,{data:r,label:t("metadata.workflow")}):a.jsx(eo,{label:t("nodes.noWorkflow")})})]})]})]})},npe=d.memo(tpe),_1={color:"base.100",pointerEvents:"auto"},rpe=()=>{const{t:e}=J(),{handlePrevImage:t,handleNextImage:n,isOnFirstImage:r,isOnLastImage:o,handleLoadMoreImages:s,areMoreImagesAvailable:i,isFetching:l}=PR();return a.jsxs(De,{sx:{position:"relative",height:"100%",width:"100%"},children:[a.jsx(De,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineStart:0},children:!r&&a.jsx(Pa,{"aria-label":e("accessibility.previousImage"),icon:a.jsx(XZ,{size:64}),variant:"unstyled",onClick:t,boxSize:16,sx:_1})}),a.jsxs(De,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineEnd:0},children:[!o&&a.jsx(Pa,{"aria-label":e("accessibility.nextImage"),icon:a.jsx(YZ,{size:64}),variant:"unstyled",onClick:n,boxSize:16,sx:_1}),o&&i&&!l&&a.jsx(Pa,{"aria-label":e("accessibility.loadMore"),icon:a.jsx(QZ,{size:64}),variant:"unstyled",onClick:s,boxSize:16,sx:_1}),o&&i&&l&&a.jsx($,{sx:{w:16,h:16,alignItems:"center",justifyContent:"center"},children:a.jsx(vi,{opacity:.5,size:"xl"})})]})]})},ER=d.memo(rpe),ope=ce([we,nN],({ui:e,system:t},n)=>{const{shouldShowImageDetails:r,shouldHidePreview:o,shouldShowProgressInViewer:s}=e,{denoiseProgress:i,shouldAntialiasProgressImage:l}=t;return{shouldShowImageDetails:r,shouldHidePreview:o,imageName:n==null?void 0:n.image_name,denoiseProgress:i,shouldShowProgressInViewer:s,shouldAntialiasProgressImage:l}},{memoizeOptions:{resultEqualityCheck:Tn}}),spe=()=>{const{shouldShowImageDetails:e,imageName:t,denoiseProgress:n,shouldShowProgressInViewer:r,shouldAntialiasProgressImage:o}=W(ope),{handlePrevImage:s,handleNextImage:i,isOnLastImage:l,handleLoadMoreImages:u,areMoreImagesAvailable:p,isFetching:m}=PR();It("left",()=>{s()},[s]),It("right",()=>{if(l&&p&&!m){u();return}l||i()},[l,p,u,m,i]);const{currentData:h}=Ps(t??Os.skipToken),g=d.useMemo(()=>{if(h)return{id:"current-image",payloadType:"IMAGE_DTO",payload:{imageDTO:h}}},[h]),x=d.useMemo(()=>({id:"current-image",actionType:"SET_CURRENT_IMAGE"}),[]),[y,b]=d.useState(!1),C=d.useRef(0),{t:S}=J(),j=d.useCallback(()=>{b(!0),window.clearTimeout(C.current)},[]),_=d.useCallback(()=>{C.current=window.setTimeout(()=>{b(!1)},500)},[]);return a.jsxs($,{onMouseOver:j,onMouseOut:_,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative"},children:[n!=null&&n.progress_image&&r?a.jsx(wi,{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(al,{imageDTO:h,droppableData:x,draggableData:g,isUploadDisabled:!0,fitContainer:!0,useThumbailFallback:!0,dropLabel:S("gallery.setCurrentImage"),noContentFallback:a.jsx(eo,{icon:Xl,label:"No image selected"}),dataTestId:"image-preview"}),e&&h&&a.jsx(De,{sx:{position:"absolute",top:"0",width:"full",height:"full",borderRadius:"base"},children:a.jsx(npe,{image:h})}),a.jsx(yo,{children:!e&&h&&y&&a.jsx(Mr.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(ER,{})},"nextPrevButtons")})]})},ape=d.memo(spe),ipe=()=>a.jsxs($,{sx:{position:"relative",flexDirection:"column",height:"100%",width:"100%",rowGap:4,alignItems:"center",justifyContent:"center"},children:[a.jsx(Qfe,{}),a.jsx(ape,{})]}),lpe=d.memo(ipe),cpe=()=>a.jsx(De,{layerStyle:"first",sx:{position:"relative",width:"100%",height:"100%",p:2,borderRadius:"base"},children:a.jsx($,{sx:{width:"100%",height:"100%"},children:a.jsx(lpe,{})})}),MR=d.memo(cpe),upe=()=>{const e=d.useRef(null),t=d.useCallback(()=>{e.current&&e.current.setLayout([50,50])},[]),n=R2();return a.jsx(De,{sx:{w:"full",h:"full"},children:a.jsxs(f0,{ref:e,autoSaveId:"imageTab.content",direction:"horizontal",style:{height:"100%",width:"100%"},storage:n,units:"percentages",children:[a.jsx(Ji,{id:"imageTab.content.initImage",order:0,defaultSize:50,minSize:25,style:{position:"relative"},children:a.jsx(Bfe,{})}),a.jsx(Qh,{onDoubleClick:t}),a.jsx(Ji,{id:"imageTab.content.selectedImage",order:1,defaultSize:50,minSize:25,children:a.jsx(MR,{})})]})})},dpe=d.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 T_=pf(fpe);function rb(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,N_=Object.getOwnPropertySymbols,mpe=Object.prototype.hasOwnProperty,hpe=Object.prototype.propertyIsEnumerable,$_=(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={}))mpe.call(t,n)&&$_(e,n,t[n]);if(N_)for(var n of N_(t))hpe.call(t,n)&&$_(e,n,t[n]);return e};function OR(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 L_(e,t){return t?typeof t=="boolean"?t:Array.isArray(t)?t.includes(e.replace(/[.][0-9]/g,`.${vpe}`)):!1:!1}function z_(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,l){o.set(Qc(l),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 ob(e,t,n="",r={}){return typeof e!="object"||e===null?r:Object.keys(e).reduce((o,s)=>{const i=e[s],l=`${n===""?"":`${n}.`}${s}`,u=ni(l,t);let p=!1;return typeof i=="function"&&(o[l]=i(u,t,l)),typeof i=="object"&&Array.isArray(u)&&(p=!0,u.forEach((m,h)=>ob(i,t,`${l}.${h}`,o))),typeof i=="object"&&typeof u=="object"&&u!==null&&(p||ob(i,t,l,o)),o},r)}function sb(e,t){return F_(typeof e=="function"?e(t):ob(e,t))}function gm(e,t,n){if(typeof e!="string")return{hasError:!1,error:null};const r=sb(t,n),o=Object.keys(r.errors).find(s=>e.split(".").every((i,l)=>i===s.split(".")[l]));return{hasError:!!o,error:o?r.errors[o]:null}}function xpe(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),b0(e,s,r)}var bpe=Object.defineProperty,B_=Object.getOwnPropertySymbols,ype=Object.prototype.hasOwnProperty,Cpe=Object.prototype.propertyIsEnumerable,H_=(e,t,n)=>t in e?bpe(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)&&H_(e,n,t[n]);if(B_)for(var n of B_(t))Cpe.call(t,n)&&H_(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(l=>{let u,p;if(l.startsWith(o)&&(u=l,p=l.replace(o,s)),l.startsWith(s)&&(u=l.replace(s,o),p=l),u&&p){const m=i[u],h=i[p];return h===void 0?delete i[u]:i[u]=h,m===void 0?delete i[p]:i[p]=m,!1}return!0}),i}function kpe(e,t,n){const r=ni(e,n);return Array.isArray(r)?b0(e,r.filter((o,s)=>s!==t),n):n}var jpe=Object.defineProperty,W_=Object.getOwnPropertySymbols,_pe=Object.prototype.hasOwnProperty,Ipe=Object.prototype.propertyIsEnumerable,V_=(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)&&V_(e,n,t[n]);if(W_)for(var n of W_(t))Ipe.call(t,n)&&V_(e,n,t[n]);return e};function U_(e,t){const n=e.substring(t.length+1).split(".")[0];return parseInt(n,10)}function G_(e,t,n,r){if(t===void 0)return n;const o=`${String(e)}`;let s=n;r===-1&&(s=OR(`${o}.${t}`,s));const i=Ppe({},s),l=new Set;return Object.entries(s).filter(([u])=>{if(!u.startsWith(`${o}.`))return!1;const p=U_(u,o);return Number.isNaN(p)?!1:p>=t}).forEach(([u,p])=>{const m=U_(u,o),h=u.replace(`${o}.${m}`,`${o}.${m+r}`);i[h]=p,l.add(h),l.has(u)||delete i[u]}),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),b0(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,K_=Object.getOwnPropertySymbols,Dpe=Object.prototype.hasOwnProperty,Tpe=Object.prototype.propertyIsEnumerable,Q_=(e,t,n)=>t in e?Ope(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zi=(e,t)=>{for(var n in t||(t={}))Dpe.call(t,n)&&Q_(e,n,t[n]);if(K_)for(var n of K_(t))Tpe.call(t,n)&&Q_(e,n,t[n]);return e},I1=(e,t)=>Rpe(e,Ape(t));function uc({initialValues:e={},initialErrors:t={},initialDirty:n={},initialTouched:r={},clearInputErrorOnChange:o=!0,validateInputOnChange:s=!1,validateInputOnBlur:i=!1,transformValues:l=p=>p,validate:u}={}){const[p,m]=d.useState(r),[h,g]=d.useState(n),[x,y]=d.useState(e),[b,C]=d.useState(rb(t)),S=d.useRef(e),j=K=>{S.current=K},_=d.useCallback(()=>m({}),[]),P=K=>{const U=K?zi(zi({},x),K):x;j(U),g({})},I=d.useCallback(K=>C(U=>rb(typeof K=="function"?K(U):K)),[]),M=d.useCallback(()=>C({}),[]),O=d.useCallback(()=>{y(e),M(),j(e),g({}),_()},[]),A=d.useCallback((K,U)=>I(ee=>I1(zi({},ee),{[K]:U})),[]),D=d.useCallback(K=>I(U=>{if(typeof K!="string")return U;const ee=zi({},U);return delete ee[K],ee}),[]),R=d.useCallback(K=>g(U=>{if(typeof K!="string")return U;const ee=OR(K,U);return delete ee[K],ee}),[]),N=d.useCallback((K,U)=>{const ee=L_(K,s);R(K),m(de=>I1(zi({},de),{[K]:!0})),y(de=>{const Z=b0(K,U,de);if(ee){const ue=gm(K,u,Z);ue.hasError?A(K,ue.error):D(K)}return Z}),!ee&&o&&A(K,null)},[]),Y=d.useCallback(K=>{y(U=>{const ee=typeof K=="function"?K(U):K;return zi(zi({},U),ee)}),o&&M()},[]),F=d.useCallback((K,U)=>{R(K),y(ee=>xpe(K,U,ee)),C(ee=>Spe(K,U,ee))},[]),V=d.useCallback((K,U)=>{R(K),y(ee=>kpe(K,U,ee)),C(ee=>G_(K,U,ee,-1))},[]),Q=d.useCallback((K,U,ee)=>{R(K),y(de=>Epe(K,U,ee,de)),C(de=>G_(K,ee,de,1))},[]),q=d.useCallback(()=>{const K=sb(u,x);return C(K.errors),K},[x,u]),z=d.useCallback(K=>{const U=gm(K,u,x);return U.hasError?A(K,U.error):D(K),U},[x,u]),G=(K,{type:U="input",withError:ee=!0,withFocus:de=!0}={})=>{const ue={onChange:Mpe(fe=>N(K,fe))};return ee&&(ue.error=b[K]),U==="checkbox"?ue.checked=ni(K,x):ue.value=ni(K,x),de&&(ue.onFocus=()=>m(fe=>I1(zi({},fe),{[K]:!0})),ue.onBlur=()=>{if(L_(K,i)){const fe=gm(K,u,x);fe.hasError?A(K,fe.error):D(K)}}),ue},T=(K,U)=>ee=>{ee==null||ee.preventDefault();const de=q();de.hasErrors?U==null||U(de.errors,x,ee):K==null||K(l(x),ee)},B=K=>l(K||x),X=d.useCallback(K=>{K.preventDefault(),O()},[]),re=K=>{if(K){const ee=ni(K,h);if(typeof ee=="boolean")return ee;const de=ni(K,x),Z=ni(K,S.current);return!T_(de,Z)}return Object.keys(h).length>0?q_(h):!T_(x,S.current)},le=d.useCallback(K=>q_(p,K),[p]),se=d.useCallback(K=>K?!gm(K,u,x).hasError:!sb(u,x).hasErrors,[x,u]);return{values:x,errors:b,setValues:Y,setErrors:I,setFieldValue:N,setFieldError:A,clearFieldError:D,clearErrors:M,reset:O,validate:q,validateField:z,reorderListItem:F,removeListItem:V,insertListItem:Q,getInputProps:G,onSubmit:T,onReset:X,isDirty:re,isTouched:le,setTouched:m,setDirty:g,resetTouched:_,resetDirty:P,isValid:se,getTransformedValues:B}}function Er(e){const{...t}=e,{base50:n,base100:r,base200:o,base300:s,base800:i,base700:l,base900:u,accent500:p,accent300:m}=zf(),{colorMode:h}=Ci();return a.jsx(EM,{styles:()=>({input:{color:Ke(u,r)(h),backgroundColor:Ke(n,u)(h),borderColor:Ke(o,i)(h),borderWidth:2,outline:"none",":focus":{borderColor:Ke(m,p)(h)}},label:{color:Ke(l,s)(h),fontWeight:"normal",marginBottom:4}}),...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 Gf(e){const{...t}=e,{t:n}=J();return a.jsx(Tr,{label:n("modelManager.baseModel"),data:Npe,...t})}function AR(e){const{data:t}=uP(),{...n}=e;return a.jsx(Tr,{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 y0(e){const{...t}=e,{t:n}=J();return a.jsx(Tr,{label:n("modelManager.variant"),data:$pe,...t})}function Jh(e,t=!0){let n;t?n=new RegExp("[^\\\\/]+(?=\\.)"):n=new RegExp("[^\\\\/]+(?=[\\\\/]?$)");const r=e.match(n);return r?r[0]:""}function DR(e){const{t}=J(),n=te(),{model_path:r}=e,o=uc({initialValues:{model_name:r?Jh(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]=dP(),[i,l]=d.useState(!1),u=p=>{s({body:p}).unwrap().then(m=>{n($t(Gn({title:t("modelManager.modelAdded",{modelName:p.model_name}),status:"success"}))),o.reset(),r&&n(xf(null))}).catch(m=>{m&&n($t(Gn({title:t("toast.modelAddFailed"),status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(p=>u(p)),style:{width:"100%"},children:a.jsxs($,{flexDirection:"column",gap:2,children:[a.jsx(Er,{label:t("modelManager.model"),required:!0,...o.getInputProps("model_name")}),a.jsx(Gf,{label:t("modelManager.baseModel"),...o.getInputProps("base_model")}),a.jsx(Er,{label:t("modelManager.modelLocation"),required:!0,...o.getInputProps("path"),onBlur:p=>{if(o.values.model_name===""){const m=Jh(p.currentTarget.value);m&&o.setFieldValue("model_name",m)}}}),a.jsx(Er,{label:t("modelManager.description"),...o.getInputProps("description")}),a.jsx(Er,{label:t("modelManager.vaeLocation"),...o.getInputProps("vae")}),a.jsx(y0,{label:t("modelManager.variant"),...o.getInputProps("variant")}),a.jsxs($,{flexDirection:"column",width:"100%",gap:2,children:[i?a.jsx(Er,{required:!0,label:t("modelManager.customConfigFileLocation"),...o.getInputProps("config")}):a.jsx(AR,{required:!0,width:"100%",...o.getInputProps("config")}),a.jsx(Io,{isChecked:i,onChange:()=>l(!i),label:t("modelManager.useCustomConfig")}),a.jsx(Mt,{mt:2,type:"submit",children:t("modelManager.addModel")})]})]})})}function TR(e){const{t}=J(),n=te(),{model_path:r}=e,[o]=dP(),s=uc({initialValues:{model_name:r?Jh(r,!1):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"diffusers",error:void 0,vae:"",variant:"normal"}}),i=l=>{o({body:l}).unwrap().then(u=>{n($t(Gn({title:t("modelManager.modelAdded",{modelName:l.model_name}),status:"success"}))),s.reset(),r&&n(xf(null))}).catch(u=>{u&&n($t(Gn({title:t("toast.modelAddFailed"),status:"error"})))})};return a.jsx("form",{onSubmit:s.onSubmit(l=>i(l)),style:{width:"100%"},children:a.jsxs($,{flexDirection:"column",gap:2,children:[a.jsx(Er,{required:!0,label:t("modelManager.model"),...s.getInputProps("model_name")}),a.jsx(Gf,{label:t("modelManager.baseModel"),...s.getInputProps("base_model")}),a.jsx(Er,{required:!0,label:t("modelManager.modelLocation"),placeholder:t("modelManager.modelLocationValidationMsg"),...s.getInputProps("path"),onBlur:l=>{if(s.values.model_name===""){const u=Jh(l.currentTarget.value,!1);u&&s.setFieldValue("model_name",u)}}}),a.jsx(Er,{label:t("modelManager.description"),...s.getInputProps("description")}),a.jsx(Er,{label:t("modelManager.vaeLocation"),...s.getInputProps("vae")}),a.jsx(y0,{label:t("modelManager.variant"),...s.getInputProps("variant")}),a.jsx(Mt,{mt:2,type:"submit",children:t("modelManager.addModel")})]})})}const NR=[{label:"Diffusers",value:"diffusers"},{label:"Checkpoint / Safetensors",value:"checkpoint"}];function Lpe(){const[e,t]=d.useState("diffusers"),{t:n}=J();return a.jsxs($,{flexDirection:"column",gap:4,width:"100%",children:[a.jsx(Tr,{label:n("modelManager.modelType"),value:e,data:NR,onChange:r=>{r&&t(r)}}),a.jsxs($,{sx:{p:4,borderRadius:4,bg:"base.300",_dark:{bg:"base.850"}},children:[e==="diffusers"&&a.jsx(TR,{}),e==="checkpoint"&&a.jsx(DR,{})]})]})}const zpe=[{label:"None",value:"none"},{label:"v_prediction",value:"v_prediction"},{label:"epsilon",value:"epsilon"},{label:"sample",value:"sample"}];function Fpe(){const e=te(),{t}=J(),[n,{isLoading:r}]=fP(),o=uc({initialValues:{location:"",prediction_type:void 0}}),s=i=>{const l={location:i.location,prediction_type:i.prediction_type==="none"?void 0:i.prediction_type};n({body:l}).unwrap().then(u=>{e($t(Gn({title:t("toast.modelAddedSimple"),status:"success"}))),o.reset()}).catch(u=>{u&&e($t(Gn({title:`${u.data.detail} `,status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(i=>s(i)),style:{width:"100%"},children:a.jsxs($,{flexDirection:"column",width:"100%",gap:4,children:[a.jsx(Er,{label:t("modelManager.modelLocation"),placeholder:t("modelManager.simpleModelDesc"),w:"100%",...o.getInputProps("location")}),a.jsx(Tr,{label:t("modelManager.predictionType"),data:zpe,defaultValue:"none",...o.getInputProps("prediction_type")}),a.jsx(Mt,{type:"submit",isLoading:r,children:t("modelManager.addModel")})]})})}function Bpe(){const[e,t]=d.useState("simple");return a.jsxs($,{flexDirection:"column",width:"100%",overflow:"scroll",maxHeight:window.innerHeight-250,gap:4,children:[a.jsxs(zn,{isAttached:!0,children:[a.jsx(Mt,{size:"sm",isChecked:e=="simple",onClick:()=>t("simple"),children:"Simple"}),a.jsx(Mt,{size:"sm",isChecked:e=="advanced",onClick:()=>t("advanced"),children:"Advanced"})]}),a.jsxs($,{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(wE,{w:"100%",...t,children:e.children})}function Wpe(){const e=W(b=>b.modelmanager.searchFolder),[t,n]=d.useState(""),{data:r}=na(Ml),{foundModels:o,alreadyInstalled:s,filteredModels:i}=pP({search_path:e||""},{selectFromResult:({data:b})=>{const C=y$(r==null?void 0:r.entities),S=Ro(C,"path"),j=h$(b,S),_=j$(b,S);return{foundModels:b,alreadyInstalled:X_(_,t),filteredModels:X_(j,t)}}}),[l,{isLoading:u}]=fP(),p=te(),{t:m}=J(),h=d.useCallback(b=>{const C=b.currentTarget.id.split("\\").splice(-1)[0];l({body:{location:b.currentTarget.id}}).unwrap().then(S=>{p($t(Gn({title:`Added Model: ${C}`,status:"success"})))}).catch(S=>{S&&p($t(Gn({title:m("toast.modelAddFailed"),status:"error"})))})},[p,l,m]),g=d.useCallback(b=>{n(b.target.value)},[]),x=({models:b,showActions:C=!0})=>b.map(S=>a.jsxs($,{sx:{p:4,gap:4,alignItems:"center",borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs($,{w:"100%",sx:{flexDirection:"column",minW:"25%"},children:[a.jsx(Se,{sx:{fontWeight:600},children:S.split("\\").slice(-1)[0]}),a.jsx(Se,{sx:{fontSize:"sm",color:"base.600",_dark:{color:"base.400"}},children:S})]}),C?a.jsxs($,{gap:2,children:[a.jsx(Mt,{id:S,onClick:h,isLoading:u,children:m("modelManager.quickAdd")}),a.jsx(Mt,{onClick:()=>p(xf(S)),isLoading:u,children:m("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"})]},S));return(()=>e?!o||o.length===0?a.jsx($,{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:m("modelManager.noModels")})}):a.jsxs($,{sx:{flexDirection:"column",gap:2,w:"100%",minW:"50%"},children:[a.jsx(Cs,{onChange:g,label:m("modelManager.search"),labelPos:"side"}),a.jsxs($,{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($,{gap:2,flexDirection:"column",children:[x({models:i}),x({models:s,showActions:!1})]})})]}):null)()}const X_=(e,t)=>{const n=[];return qr(e,r=>{if(!r)return null;r.includes(t)&&n.push(r)}),n};function Vpe(){const e=W(l=>l.modelmanager.advancedAddScanModel),{t}=J(),[n,r]=d.useState("diffusers"),[o,s]=d.useState(!0);d.useEffect(()=>{e&&[".ckpt",".safetensors",".pth",".pt"].some(l=>e.endsWith(l))?r("checkpoint"):r("diffusers")},[e,r,o]);const i=te();return e?a.jsxs(De,{as:Mr.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($,{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(ot,{icon:a.jsx(wu,{}),"aria-label":t("modelManager.closeAdvanced"),onClick:()=>i(xf(null)),size:"sm"})]}),a.jsx(Tr,{label:t("modelManager.modelType"),value:n,data:NR,onChange:l=>{l&&(r(l),s(l==="checkpoint"))}}),o?a.jsx(DR,{model_path:e},e):a.jsx(TR,{model_path:e},e)]}):null}function Upe(){const e=te(),{t}=J(),n=W(l=>l.modelmanager.searchFolder),{refetch:r}=pP({search_path:n||""}),o=uc({initialValues:{folder:""}}),s=d.useCallback(l=>{e(oS(l.folder))},[e]),i=()=>{r()};return a.jsx("form",{onSubmit:o.onSubmit(l=>s(l)),style:{width:"100%"},children:a.jsxs($,{sx:{w:"100%",gap:2,borderRadius:4,alignItems:"center"},children:[a.jsxs($,{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($,{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($,{gap:2,children:[n?a.jsx(ot,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:a.jsx(JM,{}),onClick:i,fontSize:18,size:"sm"}):a.jsx(ot,{"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),icon:a.jsx(Iee,{}),fontSize:18,size:"sm",type:"submit"}),a.jsx(ot,{"aria-label":t("modelManager.clearCheckpointFolder"),tooltip:t("modelManager.clearCheckpointFolder"),icon:a.jsx(qo,{}),size:"sm",onClick:()=>{e(oS(null)),e(xf(null))},isDisabled:!n,colorScheme:"red"})]})]})})}const Gpe=d.memo(Upe);function qpe(){return a.jsxs($,{flexDirection:"column",w:"100%",gap:4,children:[a.jsx(Gpe,{}),a.jsxs($,{gap:4,children:[a.jsx($,{sx:{maxHeight:window.innerHeight-300,overflow:"scroll",gap:4,w:"100%"},children:a.jsx(Wpe,{})}),a.jsx(Vpe,{})]})]})}function Kpe(){const[e,t]=d.useState("add"),{t:n}=J();return a.jsxs($,{flexDirection:"column",gap:4,children:[a.jsxs(zn,{isAttached:!0,children:[a.jsx(Mt,{onClick:()=>t("add"),isChecked:e=="add",size:"sm",width:"100%",children:n("modelManager.addModel")}),a.jsx(Mt,{onClick:()=>t("scan"),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 z,G;const{t:e}=J(),t=te(),{data:n}=na(Ml),[r,{isLoading:o}]=rN(),[s,i]=d.useState("sd-1"),l=vS(n==null?void 0:n.entities,(T,B)=>(T==null?void 0:T.model_format)==="diffusers"&&(T==null?void 0:T.base_model)==="sd-1"),u=vS(n==null?void 0:n.entities,(T,B)=>(T==null?void 0:T.model_format)==="diffusers"&&(T==null?void 0:T.base_model)==="sd-2"),p=d.useMemo(()=>({"sd-1":l,"sd-2":u}),[l,u]),[m,h]=d.useState(((z=Object.keys(p[s]))==null?void 0:z[0])??null),[g,x]=d.useState(((G=Object.keys(p[s]))==null?void 0:G[1])??null),[y,b]=d.useState(null),[C,S]=d.useState(""),[j,_]=d.useState(.5),[P,I]=d.useState("weighted_sum"),[M,O]=d.useState("root"),[A,D]=d.useState(""),[R,N]=d.useState(!1),Y=Object.keys(p[s]).filter(T=>T!==g&&T!==y),F=Object.keys(p[s]).filter(T=>T!==m&&T!==y),V=Object.keys(p[s]).filter(T=>T!==m&&T!==g),Q=T=>{i(T),h(null),x(null)},q=()=>{const T=[];let B=[m,g,y];B=B.filter(re=>re!==null),B.forEach(re=>{var se;const le=(se=re==null?void 0:re.split("/"))==null?void 0:se[2];le&&T.push(le)});const X={model_names:T,merged_model_name:C!==""?C:T.join("-"),alpha:j,interp:P,force:R,merge_dest_directory:M==="root"?void 0:A};r({base_model:s,body:{body:X}}).unwrap().then(re=>{t($t(Gn({title:e("modelManager.modelsMerged"),status:"success"})))}).catch(re=>{re&&t($t(Gn({title:e("modelManager.modelsMergeFailed"),status:"error"})))})};return a.jsxs($,{flexDirection:"column",rowGap:4,children:[a.jsxs($,{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($,{columnGap:4,children:[a.jsx(Tr,{label:"Model Type",w:"100%",data:Qpe,value:s,onChange:Q}),a.jsx(tr,{label:e("modelManager.modelOne"),w:"100%",value:m,placeholder:e("modelManager.selectModel"),data:Y,onChange:T=>h(T)}),a.jsx(tr,{label:e("modelManager.modelTwo"),w:"100%",placeholder:e("modelManager.selectModel"),value:g,data:F,onChange:T=>x(T)}),a.jsx(tr,{label:e("modelManager.modelThree"),data:V,w:"100%",placeholder:e("modelManager.selectModel"),clearable:!0,onChange:T=>{T?(b(T),I("weighted_sum")):(b(null),I("add_difference"))}})]}),a.jsx(Cs,{label:e("modelManager.mergedModelName"),value:C,onChange:T=>S(T.target.value)}),a.jsxs($,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(jt,{label:e("modelManager.alpha"),min:.01,max:.99,step:.01,value:j,onChange:T=>_(T),withInput:!0,withReset:!0,handleReset:()=>_(.5),withSliderMarks:!0}),a.jsx(Se,{variant:"subtext",fontSize:"sm",children:e("modelManager.modelMergeAlphaHelp")})]}),a.jsxs($,{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(Xm,{value:P,onChange:T=>I(T),children:a.jsx($,{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($,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.900"}},children:[a.jsxs($,{columnGap:4,children:[a.jsx(Se,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:e("modelManager.mergedModelSaveLocation")}),a.jsx(Xm,{value:M,onChange:T=>O(T),children:a.jsxs($,{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:T=>D(T.target.value)})]}),a.jsx(Io,{label:e("modelManager.ignoreMismatch"),isChecked:R,onChange:T=>N(T.target.checked),fontWeight:"500"}),a.jsx(Mt,{onClick:q,isLoading:o,isDisabled:m===null||g===null,children:e("modelManager.merge")})]})}function Ype(e){const{model:t}=e,n=te(),{t:r}=J(),[o,{isLoading:s}]=oN(),[i,l]=d.useState("InvokeAIRoot"),[u,p]=d.useState("");d.useEffect(()=>{l("InvokeAIRoot")},[t]);const m=()=>{l("InvokeAIRoot")},h=()=>{const g={base_model:t.base_model,model_name:t.model_name,convert_dest_directory:i==="Custom"?u:void 0};if(i==="Custom"&&u===""){n($t(Gn({title:r("modelManager.noCustomLocationProvided"),status:"error"})));return}n($t(Gn({title:`${r("modelManager.convertingModelBegin")}: ${t.model_name}`,status:"info"}))),o(g).unwrap().then(()=>{n($t(Gn({title:`${r("modelManager.modelConverted")}: ${t.model_name}`,status:"success"})))}).catch(()=>{n($t(Gn({title:`${r("modelManager.modelConversionFailed")}: ${t.model_name}`,status:"error"})))})};return a.jsxs(c0,{title:`${r("modelManager.convert")} ${t.model_name}`,acceptCallback:h,cancelCallback:m,acceptButtonText:`${r("modelManager.convert")}`,triggerComponent:a.jsxs(Mt,{size:"sm","aria-label":r("modelManager.convertToDiffusers"),className:" modal-close-btn",isLoading:s,children:["🧨 ",r("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[a.jsxs($,{flexDirection:"column",rowGap:4,children:[a.jsx(Se,{children:r("modelManager.convertToDiffusersHelpText1")}),a.jsxs(_f,{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($,{flexDir:"column",gap:2,children:[a.jsxs($,{marginTop:4,flexDir:"column",gap:2,children:[a.jsx(Se,{fontWeight:"600",children:r("modelManager.convertToDiffusersSaveLocation")}),a.jsx(Xm,{value:i,onChange:g=>l(g),children:a.jsxs($,{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($,{flexDirection:"column",rowGap:2,children:[a.jsx(Se,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:r("modelManager.customSaveLocation")}),a.jsx(Cs,{value:u,onChange:g=>{p(g.target.value)},width:"full"})]})]})]})}function Jpe(e){const{model:t}=e,[n,{isLoading:r}]=mP(),{data:o}=uP(),[s,i]=d.useState(!1);d.useEffect(()=>{o!=null&&o.includes(t.config)||i(!0)},[o,t.config]);const l=te(),{t:u}=J(),p=uc({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:h=>h.trim().length===0?"Must provide a path":null}}),m=d.useCallback(h=>{const g={base_model:t.base_model,model_name:t.model_name,body:h};n(g).unwrap().then(x=>{p.setValues(x),l($t(Gn({title:u("modelManager.modelUpdated"),status:"success"})))}).catch(x=>{p.reset(),l($t(Gn({title:u("modelManager.modelUpdateFailed"),status:"error"})))})},[p,l,t.base_model,t.model_name,u,n]);return a.jsxs($,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs($,{justifyContent:"space-between",alignItems:"center",children:[a.jsxs($,{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($,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",children:a.jsx("form",{onSubmit:p.onSubmit(h=>m(h)),children:a.jsxs($,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Er,{label:u("modelManager.name"),...p.getInputProps("model_name")}),a.jsx(Er,{label:u("modelManager.description"),...p.getInputProps("description")}),a.jsx(Gf,{required:!0,...p.getInputProps("base_model")}),a.jsx(y0,{required:!0,...p.getInputProps("variant")}),a.jsx(Er,{required:!0,label:u("modelManager.modelLocation"),...p.getInputProps("path")}),a.jsx(Er,{label:u("modelManager.vaeLocation"),...p.getInputProps("vae")}),a.jsxs($,{flexDirection:"column",gap:2,children:[s?a.jsx(Er,{required:!0,label:u("modelManager.config"),...p.getInputProps("config")}):a.jsx(AR,{required:!0,...p.getInputProps("config")}),a.jsx(Io,{isChecked:s,onChange:()=>i(!s),label:"Use Custom Config"})]}),a.jsx(Mt,{type:"submit",isLoading:r,children:u("modelManager.updateModel")})]})})})]})}function Zpe(e){const{model:t}=e,[n,{isLoading:r}]=mP(),o=te(),{t:s}=J(),i=uc({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:u=>u.trim().length===0?"Must provide a path":null}}),l=d.useCallback(u=>{const p={base_model:t.base_model,model_name:t.model_name,body:u};n(p).unwrap().then(m=>{i.setValues(m),o($t(Gn({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{i.reset(),o($t(Gn({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[i,o,t.base_model,t.model_name,s,n]);return a.jsxs($,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs($,{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(u=>l(u)),children:a.jsxs($,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Er,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(Er,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Gf,{required:!0,...i.getInputProps("base_model")}),a.jsx(y0,{required:!0,...i.getInputProps("variant")}),a.jsx(Er,{required:!0,label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(Er,{label:s("modelManager.vaeLocation"),...i.getInputProps("vae")}),a.jsx(Mt,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function eme(e){const{model:t}=e,[n,{isLoading:r}]=sN(),o=te(),{t:s}=J(),i=uc({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:u=>u.trim().length===0?"Must provide a path":null}}),l=d.useCallback(u=>{const p={base_model:t.base_model,model_name:t.model_name,body:u};n(p).unwrap().then(m=>{i.setValues(m),o($t(Gn({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{i.reset(),o($t(Gn({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[o,i,t.base_model,t.model_name,s,n]);return a.jsxs($,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs($,{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 ⋅"," ",aN[t.model_format]," format"]})]}),a.jsx(no,{}),a.jsx("form",{onSubmit:i.onSubmit(u=>l(u)),children:a.jsxs($,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Er,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(Er,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Gf,{...i.getInputProps("base_model")}),a.jsx(Er,{label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(Mt,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function tme(e){const{t}=J(),n=te(),[r]=iN(),[o]=lN(),{model:s,isSelected:i,setSelectedModelId:l}=e,u=d.useCallback(()=>{l(s.id)},[s.id,l]),p=d.useCallback(()=>{const m={main:r,lora:o,onnx:r}[s.model_type];m(s).unwrap().then(h=>{n($t(Gn({title:`${t("modelManager.modelDeleted")}: ${s.model_name}`,status:"success"})))}).catch(h=>{h&&n($t(Gn({title:`${t("modelManager.modelDeleteFailed")}: ${s.model_name}`,status:"error"})))}),l(void 0)},[r,o,s,l,n,t]);return a.jsxs($,{sx:{gap:2,alignItems:"center",w:"full"},children:[a.jsx($,{as:Mt,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:u,children:a.jsxs($,{gap:4,alignItems:"center",children:[a.jsx(Ha,{minWidth:14,p:.5,fontSize:"sm",variant:"solid",children:cN[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(c0,{title:t("modelManager.deleteModel"),acceptCallback:p,acceptButtonText:t("modelManager.delete"),triggerComponent:a.jsx(ot,{icon:a.jsx(Mne,{}),"aria-label":t("modelManager.deleteConfig"),colorScheme:"error"}),children:a.jsxs($,{rowGap:4,flexDirection:"column",children:[a.jsx("p",{style:{fontWeight:"bold"},children:t("modelManager.deleteMsg1")}),a.jsx("p",{children:t("modelManager.deleteMsg2")})]})})]})}const nme=e=>{const{selectedModelId:t,setSelectedModelId:n}=e,{t:r}=J(),[o,s]=d.useState(""),[i,l]=d.useState("all"),{filteredDiffusersModels:u,isLoadingDiffusersModels:p}=na(Ml,{selectFromResult:({data:_,isLoading:P})=>({filteredDiffusersModels:Cd(_,"main","diffusers",o),isLoadingDiffusersModels:P})}),{filteredCheckpointModels:m,isLoadingCheckpointModels:h}=na(Ml,{selectFromResult:({data:_,isLoading:P})=>({filteredCheckpointModels:Cd(_,"main","checkpoint",o),isLoadingCheckpointModels:P})}),{filteredLoraModels:g,isLoadingLoraModels:x}=gf(void 0,{selectFromResult:({data:_,isLoading:P})=>({filteredLoraModels:Cd(_,"lora",void 0,o),isLoadingLoraModels:P})}),{filteredOnnxModels:y,isLoadingOnnxModels:b}=Bd(Ml,{selectFromResult:({data:_,isLoading:P})=>({filteredOnnxModels:Cd(_,"onnx","onnx",o),isLoadingOnnxModels:P})}),{filteredOliveModels:C,isLoadingOliveModels:S}=Bd(Ml,{selectFromResult:({data:_,isLoading:P})=>({filteredOliveModels:Cd(_,"onnx","olive",o),isLoadingOliveModels:P})}),j=d.useCallback(_=>{s(_.target.value)},[]);return a.jsx($,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:a.jsxs($,{flexDirection:"column",gap:4,paddingInlineEnd:4,children:[a.jsxs(zn,{isAttached:!0,children:[a.jsx(Mt,{onClick:()=>l("all"),isChecked:i==="all",size:"sm",children:r("modelManager.allModels")}),a.jsx(Mt,{size:"sm",onClick:()=>l("diffusers"),isChecked:i==="diffusers",children:r("modelManager.diffusersModels")}),a.jsx(Mt,{size:"sm",onClick:()=>l("checkpoint"),isChecked:i==="checkpoint",children:r("modelManager.checkpointModels")}),a.jsx(Mt,{size:"sm",onClick:()=>l("onnx"),isChecked:i==="onnx",children:r("modelManager.onnxModels")}),a.jsx(Mt,{size:"sm",onClick:()=>l("olive"),isChecked:i==="olive",children:r("modelManager.oliveModels")}),a.jsx(Mt,{size:"sm",onClick:()=>l("lora"),isChecked:i==="lora",children:r("modelManager.loraModels")})]}),a.jsx(Cs,{onChange:j,label:r("modelManager.search"),labelPos:"side"}),a.jsxs($,{flexDirection:"column",gap:4,maxHeight:window.innerHeight-280,overflow:"scroll",children:[p&&a.jsx(Wc,{loadingMessage:"Loading Diffusers..."}),["all","diffusers"].includes(i)&&!p&&u.length>0&&a.jsx(Hc,{title:"Diffusers",modelList:u,selected:{selectedModelId:t,setSelectedModelId:n}},"diffusers"),h&&a.jsx(Wc,{loadingMessage:"Loading Checkpoints..."}),["all","checkpoint"].includes(i)&&!h&&m.length>0&&a.jsx(Hc,{title:"Checkpoints",modelList:m,selected:{selectedModelId:t,setSelectedModelId:n}},"checkpoints"),x&&a.jsx(Wc,{loadingMessage:"Loading LoRAs..."}),["all","lora"].includes(i)&&!x&&g.length>0&&a.jsx(Hc,{title:"LoRAs",modelList:g,selected:{selectedModelId:t,setSelectedModelId:n}},"loras"),S&&a.jsx(Wc,{loadingMessage:"Loading Olives..."}),["all","olive"].includes(i)&&!S&&C.length>0&&a.jsx(Hc,{title:"Olives",modelList:C,selected:{selectedModelId:t,setSelectedModelId:n}},"olive"),b&&a.jsx(Wc,{loadingMessage:"Loading ONNX..."}),["all","onnx"].includes(i)&&!b&&y.length>0&&a.jsx(Hc,{title:"ONNX",modelList:y,selected:{selectedModelId:t,setSelectedModelId:n}},"onnx")]})]})})},rme=d.memo(nme),Cd=(e,t,n,r)=>{const o=[];return qr(e==null?void 0:e.entities,s=>{if(!s)return;const i=s.model_name.toLowerCase().includes(r.toLowerCase()),l=n===void 0||s.model_format===n,u=s.model_type===t;i&&l&&u&&o.push(s)}),o},H2=d.memo(e=>a.jsx($,{flexDirection:"column",gap:4,borderRadius:4,p:4,sx:{bg:"base.200",_dark:{bg:"base.800"}},children:e.children}));H2.displayName="StyledModelContainer";const Hc=d.memo(e=>{const{title:t,modelList:n,selected:r}=e;return a.jsx(H2,{children:a.jsxs($,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Se,{variant:"subtext",fontSize:"sm",children:t}),n.map(o=>a.jsx(tme,{model:o,isSelected:r.selectedModelId===o.id,setSelectedModelId:r.setSelectedModelId},o.id))]})})});Hc.displayName="ModelListWrapper";const Wc=d.memo(({loadingMessage:e})=>a.jsx(H2,{children:a.jsxs($,{justifyContent:"center",alignItems:"center",flexDirection:"column",p:4,gap:8,children:[a.jsx(vi,{}),a.jsx(Se,{variant:"subtext",children:e||"Fetching..."})]})}));Wc.displayName="FetchingModelsLoader";function ome(){const[e,t]=d.useState(),{mainModel:n}=na(Ml,{selectFromResult:({data:s})=>({mainModel:e?s==null?void 0:s.entities[e]:void 0})}),{loraModel:r}=gf(void 0,{selectFromResult:({data:s})=>({loraModel:e?s==null?void 0:s.entities[e]:void 0})}),o=n||r;return a.jsxs($,{sx:{gap:8,w:"full",h:"full"},children:[a.jsx(rme,{selectedModelId:e,setSelectedModelId:t}),a.jsx(sme,{model:o})]})}const sme=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(eme,{model:t},t.id):a.jsx($,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",maxH:96,userSelect:"none"},children:a.jsx(Se,{variant:"subtext",children:"No Model Selected"})})};function ame(){const{t:e}=J();return a.jsxs($,{sx:{w:"full",p:4,borderRadius:4,gap:4,justifyContent:"space-between",alignItems:"center",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs($,{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(Wu,{})]})}function ime(){return a.jsx($,{children:a.jsx(ame,{})})}const Y_=[{id:"modelManager",label:on.t("modelManager.modelManager"),content:a.jsx(ome,{})},{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(ime,{})}],lme=()=>a.jsxs(nc,{isLazy:!0,variant:"line",layerStyle:"first",sx:{w:"full",h:"full",p:4,gap:4,borderRadius:"base"},children:[a.jsx(rc,{children:Y_.map(e=>a.jsx(Po,{sx:{borderTopRadius:"base"},children:e.label},e.id))}),a.jsx(Tu,{sx:{w:"full",h:"full"},children:Y_.map(e=>a.jsx(ss,{sx:{w:"full",h:"full"},children:e.content},e.id))})]}),cme=d.memo(lme),ume={Any:void 0,enum:"",BoardField:void 0,boolean:!1,BooleanCollection:[],BooleanPolymorphic:!1,ClipField:void 0,Collection:[],CollectionItem:void 0,ColorCollection:[],ColorField:void 0,ColorPolymorphic:void 0,ConditioningCollection:[],ConditioningField:void 0,ConditioningPolymorphic:void 0,ControlCollection:[],ControlField:void 0,ControlNetModelField:void 0,ControlPolymorphic:void 0,DenoiseMaskField:void 0,float:0,FloatCollection:[],FloatPolymorphic:0,ImageCollection:[],ImageField:void 0,ImagePolymorphic:void 0,integer:0,IntegerCollection:[],IntegerPolymorphic:0,IPAdapterCollection:[],IPAdapterField:void 0,IPAdapterModelField:void 0,IPAdapterPolymorphic:void 0,LatentsCollection:[],LatentsField:void 0,LatentsPolymorphic:void 0,MetadataItemField:void 0,MetadataItemCollection:[],MetadataItemPolymorphic:void 0,MetadataField:void 0,MetadataCollection:[],LoRAModelField:void 0,MainModelField:void 0,ONNXModelField:void 0,Scheduler:"euler",SDXLMainModelField:void 0,SDXLRefinerModelField:void 0,string:"",StringCollection:[],StringPolymorphic:"",T2IAdapterCollection:[],T2IAdapterField:void 0,T2IAdapterModelField:void 0,T2IAdapterPolymorphic:void 0,UNetField:void 0,VaeField:void 0,VaeModelField:void 0},dme=(e,t)=>{const n={id:e,name:t.name,type:t.type,label:"",fieldKind:"input"};return n.value=t.default??ume[t.type],n},fme=ce([e=>e.nodes],e=>e.nodeTemplates),P1={dragHandle:`.${ec}`},pme=()=>{const e=W(fme),t=Nb();return d.useCallback(n=>{var x;const r=oi();let o=window.innerWidth/2,s=window.innerHeight/2;const i=(x=document.querySelector("#workflow-editor"))==null?void 0:x.getBoundingClientRect();i&&(o=i.width/2-W1/2,s=i.height/2-W1/2);const{x:l,y:u}=t.project({x:o,y:s});if(n==="current_image")return{...P1,id:r,type:"current_image",position:{x:l,y:u},data:{id:r,type:"current_image",isOpen:!0,label:"Current Image"}};if(n==="notes")return{...P1,id:r,type:"notes",position:{x:l,y:u},data:{id:r,isOpen:!0,label:"Notes",notes:"",type:"notes"}};const p=e[n];if(p===void 0){console.error(`Unable to find template ${n}.`);return}const m=sS(p.inputs,(y,b,C)=>{const S=oi(),j=dme(S,b);return y[C]=j,y},{}),h=sS(p.outputs,(y,b,C)=>{const j={id:oi(),name:C,type:b.type,fieldKind:"output"};return y[C]=j,y},{});return{...P1,id:r,type:"invocation",position:{x:l,y:u},data:{id:r,type:n,version:p.version,label:"",notes:"",isOpen:!0,embedWorkflow:!1,isIntermediate:n!=="save_image",inputs:m,outputs:h,useCache:p.useCache}}},[e,t])},$R=d.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})]})}));$R.displayName="AddNodePopoverSelectItem";const mme=(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))},hme=()=>{const e=te(),t=pme(),n=oc(),{t:r}=J(),o=W(C=>C.nodes.currentConnectionFieldType),s=W(C=>{var S;return(S=C.nodes.connectionStartParams)==null?void 0:S.handleType}),i=ce([we],({nodes:C})=>{const S=o?v$(C.nodeTemplates,_=>{const P=s=="source"?_.inputs:_.outputs;return Qs(P,I=>{const M=s=="source"?o:I.type,O=s=="target"?o:I.type;return $b(M,O)})}):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((_,P)=>_.label.localeCompare(P.label)),{data:j,t:r}},je),{data:l}=W(i),u=W(C=>C.nodes.isAddNodePopoverOpen),p=d.useRef(null),m=d.useCallback(C=>{const S=t(C);if(!S){const j=r("nodes.unknownNode",{nodeType:C});n({status:"error",title:j});return}e(uN(S))},[e,t,n,r]),h=d.useCallback(C=>{C&&m(C)},[m]),g=d.useCallback(()=>{e(dN())},[e]),x=d.useCallback(()=>{e(hP())},[e]),y=d.useCallback(C=>{C.preventDefault(),x(),setTimeout(()=>{var S;(S=p.current)==null||S.focus()},0)},[x]),b=d.useCallback(()=>{g()},[g]);return It(["shift+a","space"],y),It(["escape"],b),a.jsxs(Af,{initialFocusRef:p,isOpen:u,onClose:g,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(v5,{children:a.jsx($,{sx:{position:"absolute",top:"15%",insetInlineStart:"50%",pointerEvents:"none"}})}),a.jsx(Df,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Mg,{sx:{p:0},children:a.jsx(tr,{inputRef:p,selectOnBlur:!1,placeholder:r("nodes.nodeSearch"),value:null,data:l,maxDropdownHeight:400,nothingFound:r("nodes.noMatchingNodes"),itemComponent:$R,filter:mme,onChange:h,hoverOnSearchChange:!0,onDropdownClose:g,sx:{width:"32rem",input:{padding:"0.5rem"}}})})})]})},gme=d.memo(hme),vme=()=>{const e=Nb(),t=W(r=>r.nodes.shouldValidateGraph);return d.useCallback(({source:r,sourceHandle:o,target:s,targetHandle:i})=>{var x,y;const l=e.getEdges(),u=e.getNodes();if(!(r&&o&&s&&i))return!1;const p=e.getNode(r),m=e.getNode(s);if(!(p&&m&&p.data&&m.data))return!1;const h=(x=p.data.outputs[o])==null?void 0:x.type,g=(y=m.data.inputs[i])==null?void 0:y.type;return!h||!g||r===s?!1:t?l.find(b=>{b.target===s&&b.targetHandle===i&&b.source===r&&b.sourceHandle})||l.find(b=>b.target===s&&b.targetHandle===i)&&g!=="CollectionItem"||!$b(h,g)?!1:gP(r,s,u,l):!0},[e,t])},uf=e=>`var(--invokeai-colors-${e.split(".").join("-")})`,xme=ce(we,({nodes:e})=>{const{shouldAnimateEdges:t,currentConnectionFieldType:n,shouldColorEdges:r}=e,o=uf(n&&r?vf[n].color:"base.500");let s="react-flow__custom_connection-path";return t&&(s=s.concat(" animated")),{stroke:o,className:s}}),bme=({fromX:e,fromY:t,fromPosition:n,toX:r,toY:o,toPosition:s})=>{const{stroke:i,className:l}=W(xme),u={sourceX:e,sourceY:t,sourcePosition:n,targetX:r,targetY:o,targetPosition:s},[p]=Lb(u);return a.jsx("g",{children:a.jsx("path",{fill:"none",stroke:i,strokeWidth:2,className:l,d:p,style:{opacity:.8}})})},yme=d.memo(bme),LR=(e,t,n,r,o)=>ce(we,({nodes:s})=>{var g,x;const i=s.nodes.find(y=>y.id===e),l=s.nodes.find(y=>y.id===n),u=Or(i)&&Or(l),p=(i==null?void 0:i.selected)||(l==null?void 0:l.selected)||o,m=u?(x=(g=i==null?void 0:i.data)==null?void 0:g.outputs[t||""])==null?void 0:x.type:void 0,h=m&&s.shouldColorEdges?uf(vf[m].color):uf("base.500");return{isSelected:p,shouldAnimate:s.shouldAnimateEdges&&p,stroke:h}},je),Cme=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,data:l,selected:u,source:p,target:m,sourceHandleId:h,targetHandleId:g})=>{const x=d.useMemo(()=>LR(p,h,m,g,u),[u,p,h,m,g]),{isSelected:y,shouldAnimate:b}=W(x),[C,S,j]=Lb({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s}),{base500:_}=zf();return a.jsxs(a.Fragment,{children:[a.jsx(vP,{path:C,markerEnd:i,style:{strokeWidth:y?3:2,stroke:_,opacity:y?.8:.5,animation:b?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:b?5:"none"}}),(l==null?void 0:l.count)&&l.count>1&&a.jsx(fN,{children:a.jsx($,{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:l.count})})})]})},wme=d.memo(Cme),Sme=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,selected:l,source:u,target:p,sourceHandleId:m,targetHandleId:h})=>{const g=d.useMemo(()=>LR(u,m,p,h,l),[u,m,p,h,l]),{isSelected:x,shouldAnimate:y,stroke:b}=W(g),[C]=Lb({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s});return a.jsx(vP,{path:C,markerEnd:i,style:{strokeWidth:x?3:2,stroke:b,opacity:x?.8:.5,animation:y?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:y?5:"none"}})},kme=d.memo(Sme),jme=e=>{const{nodeId:t,width:n,children:r,selected:o}=e,{isMouseOverNode:s,handleMouseOut:i,handleMouseOver:l}=q8(t),u=d.useMemo(()=>ce(we,({nodes:j})=>{var _;return((_=j.nodeExecutionStates[t])==null?void 0:_.status)===ri.IN_PROGRESS}),[t]),p=W(u),[m,h,g,x]=Ks("shadows",["nodeInProgress.light","nodeInProgress.dark","shadows.xl","shadows.base"]),y=te(),b=di(m,h),C=W(j=>j.nodes.nodeOpacity),S=d.useCallback(j=>{!j.ctrlKey&&!j.altKey&&!j.metaKey&&!j.shiftKey&&y(pN(t)),y(xP())},[y,t]);return a.jsxs(De,{onClick:S,onMouseEnter:l,onMouseLeave:i,className:ec,sx:{h:"full",position:"relative",borderRadius:"base",w:n??W1,transitionProperty:"common",transitionDuration:"0.1s",cursor:"grab",opacity:C},children:[a.jsx(De,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",pointerEvents:"none",shadow:`${g}, ${x}, ${x}`,zIndex:-1}}),a.jsx(De,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"md",pointerEvents:"none",transitionProperty:"common",transitionDuration:"0.1s",opacity:.7,shadow:p?b:void 0,zIndex:-1}}),r,a.jsx(G8,{isSelected:o,isHovered:s})]})},C0=d.memo(jme),_me=ce(we,({system:e,gallery:t})=>{var r;return{imageDTO:t.selection[t.selection.length-1],progressImage:(r=e.denoiseProgress)==null?void 0:r.progress_image}}),Ime=e=>{const{progressImage:t,imageDTO:n}=mN(_me);return t?a.jsx(E1,{nodeProps:e,children:a.jsx(wi,{src:t.dataURL,sx:{w:"full",h:"full",objectFit:"contain",borderRadius:"base"}})}):n?a.jsx(E1,{nodeProps:e,children:a.jsx(al,{imageDTO:n,isDragDisabled:!0,useThumbailFallback:!0})}):a.jsx(E1,{nodeProps:e,children:a.jsx(eo,{})})},Pme=d.memo(Ime),E1=e=>{const[t,n]=d.useState(!1),r=()=>{n(!0)},o=()=>{n(!1)};return a.jsx(C0,{nodeId:e.nodeProps.id,selected:e.nodeProps.selected,width:384,children:a.jsxs($,{onMouseEnter:r,onMouseLeave:o,className:ec,sx:{position:"relative",flexDirection:"column"},children:[a.jsx($,{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($,{layerStyle:"nodeBody",sx:{w:"full",h:"full",borderBottomRadius:"base",p:2},children:[e.children,t&&a.jsx(Mr.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(ER,{})},"nextPrevButtons")]})]})})},W2=e=>{const t=e.filter(o=>!o.ui_hidden),n=t.filter(o=>!Wd(o.ui_order)).sort((o,s)=>(o.ui_order??0)-(s.ui_order??0)),r=t.filter(o=>Wd(o.ui_order));return n.concat(r).map(o=>o.name).filter(o=>o!=="is_intermediate")},Eme=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(l=>l.id===e);if(!Or(o))return[];const s=r.nodeTemplates[o.data.type];if(!s)return[];const i=Ro(s.inputs).filter(l=>(["any","direct"].includes(l.input)||zb.includes(l.type))&&bP.includes(l.type));return W2(i)},je),[e]);return W(t)},Mme=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(l=>l.id===e);if(!Or(o))return[];const s=r.nodeTemplates[o.data.type];if(!s)return[];const i=Ro(s.inputs).filter(l=>l.input==="connection"&&!zb.includes(l.type)||!bP.includes(l.type));return W2(i)},je),[e]);return W(t)},Ome=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Or(o))return[];const s=r.nodeTemplates[o.data.type];return s?W2(Ro(s.outputs)):[]},je),[e]);return W(t)},V2=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Or(o)?Qs(o.data.outputs,s=>hN.includes(s.type)&&o.data.type!=="image"):!1},je),[e]);return W(t)},Rme=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Or(o)?o.data.embedWorkflow:!1},je),[e]);return W(t)},Ame=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Or(o))return!1;const s=r.nodeTemplates[(o==null?void 0:o.data.type)??""];return s?s.withWorkflow:!1},je),[e]);return W(t)},Dme=({nodeId:e})=>{const t=te(),n=Ame(e),r=Rme(e),o=d.useCallback(s=>{t(gN({nodeId:e,embedWorkflow:s.target.checked}))},[t,e]);return n?a.jsxs(Kn,{as:$,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(Rr,{sx:{fontSize:"xs",mb:"1px"},children:"Workflow"}),a.jsx(jf,{className:"nopan",size:"sm",onChange:o,isChecked:r})]}):null},Tme=d.memo(Dme),Nme=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Or(o)?o.data.isIntermediate:!1},je),[e]);return W(t)},$me=({nodeId:e})=>{const t=te(),n=V2(e),r=Nme(e),o=d.useCallback(s=>{t(vN({nodeId:e,isIntermediate:!s.target.checked}))},[t,e]);return n?a.jsxs(Kn,{as:$,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(Rr,{sx:{fontSize:"xs",mb:"1px"},children:"Save to Gallery"}),a.jsx(jf,{className:"nopan",size:"sm",onChange:o,isChecked:!r})]}):null},Lme=d.memo($me),zme=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Or(o)?o.data.useCache:!1},je),[e]);return W(t)},Fme=({nodeId:e})=>{const t=te(),n=zme(e),r=d.useCallback(o=>{t(xN({nodeId:e,useCache:o.target.checked}))},[t,e]);return a.jsxs(Kn,{as:$,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(Rr,{sx:{fontSize:"xs",mb:"1px"},children:"Use Cache"}),a.jsx(jf,{className:"nopan",size:"sm",onChange:r,isChecked:n})]})},Bme=d.memo(Fme),Hme=({nodeId:e})=>{const t=V2(e),n=jn("invocationCache").isFeatureEnabled;return a.jsxs($,{className:ec,layerStyle:"nodeFooter",sx:{w:"full",borderBottomRadius:"base",px:2,py:0,h:6,justifyContent:"space-between"},children:[n&&a.jsx(Bme,{nodeId:e}),t&&a.jsx(Tme,{nodeId:e}),t&&a.jsx(Lme,{nodeId:e})]})},Wme=d.memo(Hme),Vme=({nodeId:e,isOpen:t})=>{const n=te(),r=bN(),o=d.useCallback(()=>{n(yN({nodeId:e,isOpen:!t})),r(e)},[n,t,e,r]);return a.jsx(ot,{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(t0,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})})},U2=d.memo(Vme),zR=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Or(o)?o.data.label:!1},je),[e]);return W(t)},FR=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Or(o))return!1;const s=o?r.nodeTemplates[o.data.type]:void 0;return s==null?void 0:s.title},je),[e]);return W(t)},Ume=({nodeId:e,title:t})=>{const n=te(),r=zR(e),o=FR(e),{t:s}=J(),[i,l]=d.useState(""),u=d.useCallback(async m=>{n(CN({nodeId:e,label:m})),l(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),p=d.useCallback(m=>{l(m)},[]);return d.useEffect(()=>{l(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx($,{sx:{overflow:"hidden",w:"full",h:"full",alignItems:"center",justifyContent:"center",cursor:"text"},children:a.jsxs(pg,{as:$,value:i,onChange:p,onSubmit:u,sx:{alignItems:"center",position:"relative",w:"full",h:"full"},children:[a.jsx(fg,{fontSize:"sm",sx:{p:0,w:"full"},noOfLines:1}),a.jsx(dg,{className:"nodrag",fontSize:"sm",sx:{p:0,fontWeight:700,_focusVisible:{p:0,boxShadow:"none"}}}),a.jsx(Gme,{})]})})},BR=d.memo(Ume);function Gme(){const{isEditing:e,getEditButtonProps:t}=YP(),n=d.useCallback(r=>{const{onClick:o}=t();o&&o(r)},[t]);return e?null:a.jsx(De,{className:ec,onDoubleClick:n,sx:{position:"absolute",w:"full",h:"full",top:0,cursor:"grab"}})}const G2=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return o==null?void 0:o.data},je),[e]);return W(t)},qme=({nodeId:e})=>{const t=G2(e),{base400:n,base600:r}=zf(),o=di(n,r),s=d.useMemo(()=>({borderWidth:0,borderRadius:"3px",width:"1rem",height:"1rem",backgroundColor:o,zIndex:-1}),[o]);return Bm(t)?a.jsxs(a.Fragment,{children:[a.jsx(jd,{type:"target",id:`${t.id}-collapsed-target`,isConnectable:!1,position:Vc.Left,style:{...s,left:"-0.5rem"}}),Ro(t.inputs,i=>a.jsx(jd,{type:"target",id:i.name,isConnectable:!1,position:Vc.Left,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-input-handle`)),a.jsx(jd,{type:"source",id:`${t.id}-collapsed-source`,isConnectable:!1,position:Vc.Right,style:{...s,right:"-0.5rem"}}),Ro(t.outputs,i=>a.jsx(jd,{type:"source",id:i.name,isConnectable:!1,position:Vc.Right,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-output-handle`))]}):null},Kme=d.memo(qme),Qme=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);return r.nodeTemplates[(o==null?void 0:o.data.type)??""]},je),[e]);return W(t)},Xme=({nodeId:e})=>{const t=te(),n=G2(e),{t:r}=J(),o=d.useCallback(s=>{t(wN({nodeId:e,notes:s.target.value}))},[t,e]);return Bm(n)?a.jsxs(Kn,{children:[a.jsx(Rr,{children:r("nodes.notes")}),a.jsx(gi,{value:n==null?void 0:n.notes,onChange:o,rows:10})]}):null},Yme=d.memo(Xme),Jme=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{var i;const o=r.nodes.find(l=>l.id===e);if(!Or(o))return!1;const s=r.nodeTemplates[(o==null?void 0:o.data.type)??""];return!(s!=null&&s.version)||!((i=o.data)!=null&&i.version)?!1:CI(s.version,o.data.version)===0},je),[e]);return W(t)},Zme=({nodeId:e})=>{const{isOpen:t,onOpen:n,onClose:r}=Uo(),o=zR(e),s=FR(e),i=Jme(e),{t:l}=J();return a.jsxs(a.Fragment,{children:[a.jsx(Fn,{label:a.jsx(HR,{nodeId:e}),placement:"top",shouldWrapChildren:!0,children:a.jsx($,{className:"nodrag",onClick:n,sx:{alignItems:"center",justifyContent:"center",w:8,h:8,cursor:"pointer"},children:a.jsx(Lr,{as:UM,sx:{boxSize:4,w:8,color:i?"base.400":"error.400"}})})}),a.jsxs(ql,{isOpen:t,onClose:r,isCentered:!0,children:[a.jsx(oa,{}),a.jsxs(Kl,{children:[a.jsx(ra,{children:o||s||l("nodes.unknownNode")}),a.jsx(Rf,{}),a.jsx(sa,{children:a.jsx(Yme,{nodeId:e})}),a.jsx(Oa,{})]})]})]})},ehe=d.memo(Zme),HR=d.memo(({nodeId:e})=>{const t=G2(e),n=Qme(e),{t:r}=J(),o=d.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=d.useMemo(()=>!Bm(t)||!n?null:t.version?n.version?xS(t.version,n.version,"<")?a.jsxs(Se,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateNode"),")"]}):xS(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 Bm(t)?a.jsxs($,{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 M1=3,J_={circle:{transitionProperty:"none",transitionDuration:"0s"},".chakra-progress__track":{stroke:"transparent"}},the=({nodeId:e})=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>r.nodeExecutionStates[e]),[e]),n=W(t);return n?a.jsx(Fn,{label:a.jsx(WR,{nodeExecutionState:n}),placement:"top",children:a.jsx($,{className:ec,sx:{w:5,h:"full",alignItems:"center",justifyContent:"flex-end"},children:a.jsx(VR,{nodeExecutionState:n})})}):null},nhe=d.memo(the),WR=d.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($,{sx:{pos:"relative",pt:1.5,pb:.5},children:[a.jsx(wi,{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=d.memo(e=>{const{progress:t,status:n}=e.nodeExecutionState;return n===ri.PENDING?a.jsx(Lr,{as:aee,sx:{boxSize:M1,color:"base.600",_dark:{color:"base.300"}}}):n===ri.IN_PROGRESS?t===null?a.jsx(mx,{isIndeterminate:!0,size:"14px",color:"base.500",thickness:14,sx:J_}):a.jsx(mx,{value:Math.round(t*100),size:"14px",color:"base.500",thickness:14,sx:J_}):n===ri.COMPLETED?a.jsx(Lr,{as:FM,sx:{boxSize:M1,color:"ok.600",_dark:{color:"ok.300"}}}):n===ri.FAILED?a.jsx(Lr,{as:cee,sx:{boxSize:M1,color:"error.600",_dark:{color:"error.300"}}}):null});VR.displayName="StatusIcon";const rhe=({nodeId:e,isOpen:t})=>a.jsxs($,{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(U2,{nodeId:e,isOpen:t}),a.jsx(BR,{nodeId:e}),a.jsxs($,{alignItems:"center",children:[a.jsx(nhe,{nodeId:e}),a.jsx(ehe,{nodeId:e})]}),!t&&a.jsx(Kme,{nodeId:e})]}),ohe=d.memo(rhe),she=(e,t,n,r)=>ce(we,o=>{if(!r)return on.t("nodes.noFieldType");const{currentConnectionFieldType:s,connectionStartParams:i,nodes:l,edges:u}=o.nodes;if(!i||!s)return on.t("nodes.noConnectionInProgress");const{handleType:p,nodeId:m,handleId:h}=i;if(!p||!m||!h)return on.t("nodes.noConnectionData");const g=n==="target"?r:s,x=n==="source"?r:s;if(e===m)return on.t("nodes.cannotConnectToSelf");if(n===p)return n==="source"?on.t("nodes.cannotConnectOutputToOutput"):on.t("nodes.cannotConnectInputToInput");const y=n==="target"?e:m,b=n==="target"?t:h,C=n==="source"?e:m,S=n==="source"?t:h;return u.find(_=>{_.target===y&&_.targetHandle===b&&_.source===C&&_.sourceHandle})?on.t("nodes.cannotDuplicateConnection"):u.find(_=>_.target===y&&_.targetHandle===b)&&g!=="CollectionItem"?on.t("nodes.inputMayOnlyHaveOneConnection"):$b(x,g)?gP(p==="source"?m:e,p==="source"?e:m,l,u)?null:on.t("nodes.connectionWouldCreateCycle"):on.t("nodes.fieldTypesMustMatch")}),ahe=(e,t,n)=>{const r=d.useMemo(()=>ce(we,({nodes:s})=>{var l;const i=s.nodes.find(u=>u.id===e);if(Or(i))return(l=i==null?void 0:i.data[Db[n]][t])==null?void 0:l.type},je),[t,n,e]);return W(r)},ihe=ce(we,({nodes:e})=>e.currentConnectionFieldType!==null&&e.connectionStartParams!==null),UR=({nodeId:e,fieldName:t,kind:n})=>{const r=ahe(e,t,n),o=d.useMemo(()=>ce(we,({nodes:g})=>!!g.edges.filter(x=>(n==="input"?x.target:x.source)===e&&(n==="input"?x.targetHandle:x.sourceHandle)===t).length),[t,n,e]),s=d.useMemo(()=>she(e,t,n==="input"?"target":"source",r),[e,t,n,r]),i=d.useMemo(()=>ce(we,({nodes:g})=>{var x,y,b;return((x=g.connectionStartParams)==null?void 0:x.nodeId)===e&&((y=g.connectionStartParams)==null?void 0:y.handleId)===t&&((b=g.connectionStartParams)==null?void 0:b.handleType)==={input:"target",output:"source"}[n]}),[t,n,e]),l=W(o),u=W(ihe),p=W(i),m=W(s),h=d.useMemo(()=>!!(u&&m&&!p),[m,u,p]);return{isConnected:l,isConnectionInProgress:u,isConnectionStartField:p,connectionError:m,shouldDim:h}},lhe=(e,t)=>{const n=d.useMemo(()=>ce(we,({nodes:o})=>{var i;const s=o.nodes.find(l=>l.id===e);if(Or(s))return((i=s==null?void 0:s.data.inputs[t])==null?void 0:i.value)!==void 0},je),[t,e]);return W(n)},che=(e,t)=>{const n=d.useMemo(()=>ce(we,({nodes:o})=>{const s=o.nodes.find(u=>u.id===e);if(!Or(s))return;const i=o.nodeTemplates[(s==null?void 0:s.data.type)??""],l=i==null?void 0:i.inputs[t];return l==null?void 0:l.input},je),[t,e]);return W(n)},uhe=({nodeId:e,fieldName:t,kind:n,children:r})=>{const o=te(),s=K8(e,t),i=Q8(e,t,n),l=che(e,t),{t:u}=J(),p=d.useCallback(C=>{C.preventDefault()},[]),m=d.useMemo(()=>ce(we,({nodes:C})=>({isExposed:!!C.workflow.exposedFields.find(j=>j.nodeId===e&&j.fieldName===t)}),je),[t,e]),h=d.useMemo(()=>["any","direct"].includes(l??"__UNKNOWN_INPUT__"),[l]),{isExposed:g}=W(m),x=d.useCallback(()=>{o(SN({nodeId:e,fieldName:t}))},[o,t,e]),y=d.useCallback(()=>{o(rP({nodeId:e,fieldName:t}))},[o,t,e]),b=d.useMemo(()=>{const C=[];return h&&!g&&C.push(a.jsx(Wn,{icon:a.jsx(Xi,{}),onClick:x,children:"Add to Linear View"},`${e}.${t}.expose-field`)),h&&g&&C.push(a.jsx(Wn,{icon:a.jsx(yee,{}),onClick:y,children:"Remove from Linear View"},`${e}.${t}.unexpose-field`)),C},[t,x,y,g,h,e]);return a.jsx(c2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>b.length?a.jsx(Ul,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:p,children:a.jsx(Xd,{title:s||i||u("nodes.unknownField"),children:b})}):null,children:r})},dhe=d.memo(uhe),fhe=e=>{const{fieldTemplate:t,handleType:n,isConnectionInProgress:r,isConnectionStartField:o,connectionError:s}=e,{name:i,type:l}=t,{color:u,title:p}=vf[l],m=d.useMemo(()=>{const g=kN.includes(l),x=zb.includes(l),y=jN.includes(l),b=uf(u),C={backgroundColor:g||x?"var(--invokeai-colors-base-900)":b,position:"absolute",width:"1rem",height:"1rem",borderWidth:g||x?4:0,borderStyle:"solid",borderColor:b,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,l,u]),h=d.useMemo(()=>r&&o?p:r&&s?s??p:p,[s,r,o,p]);return a.jsx(Fn,{label:h,placement:n==="target"?"start":"end",hasArrow:!0,openDelay:ag,children:a.jsx(jd,{type:n,id:i,position:n==="target"?Vc.Left:Vc.Right,style:m})})},GR=d.memo(fhe),phe=({nodeId:e,fieldName:t})=>{const n=p0(e,t,"input"),r=lhe(e,t),{isConnected:o,isConnectionInProgress:s,isConnectionStartField:i,connectionError:l,shouldDim:u}=UR({nodeId:e,fieldName:t,kind:"input"}),p=d.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(ab,{shouldDim:u,children:a.jsxs(Kn,{sx:{color:"error.400",textAlign:"left",fontSize:"sm"},children:["Unknown input: ",t]})}):a.jsxs(ab,{shouldDim:u,children:[a.jsxs(Kn,{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(dhe,{nodeId:e,fieldName:t,kind:"input",children:m=>a.jsx(Rr,{sx:{display:"flex",alignItems:"center",h:"full",mb:0,px:1,gap:2},children:a.jsx(Y8,{ref:m,nodeId:e,fieldName:t,kind:"input",isMissingInput:p,withTooltip:!0})})}),a.jsx(De,{children:a.jsx(lR,{nodeId:e,fieldName:t})})]}),n.input!=="direct"&&a.jsx(GR,{fieldTemplate:n,handleType:"target",isConnectionInProgress:s,isConnectionStartField:i,connectionError:l})]})},Z_=d.memo(phe),ab=d.memo(({shouldDim:e,children:t})=>a.jsx($,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",w:"full",h:"full"},children:t}));ab.displayName="InputFieldWrapper";const mhe=({nodeId:e,fieldName:t})=>{const n=p0(e,t,"output"),{isConnected:r,isConnectionInProgress:o,isConnectionStartField:s,connectionError:i,shouldDim:l}=UR({nodeId:e,fieldName:t,kind:"output"});return(n==null?void 0:n.fieldKind)!=="output"?a.jsx(ib,{shouldDim:l,children:a.jsxs(Kn,{sx:{color:"error.400",textAlign:"right",fontSize:"sm"},children:["Unknown output: ",t]})}):a.jsxs(ib,{shouldDim:l,children:[a.jsx(Fn,{label:a.jsx(D2,{nodeId:e,fieldName:t,kind:"output"}),openDelay:ag,placement:"top",shouldWrapChildren:!0,hasArrow:!0,children:a.jsx(Kn,{isDisabled:r,pe:2,children:a.jsx(Rr,{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})]})},hhe=d.memo(mhe),ib=d.memo(({shouldDim:e,children:t})=>a.jsx($,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",justifyContent:"flex-end"},children:t}));ib.displayName="OutputFieldWrapper";const ghe=e=>{const t=V2(e),n=jn("invocationCache").isFeatureEnabled;return d.useMemo(()=>t||n,[t,n])},vhe=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>{const s=Mme(e),i=Eme(e),l=ghe(e),u=Ome(e);return a.jsxs(C0,{nodeId:e,selected:o,children:[a.jsx(ohe,{nodeId:e,isOpen:t,label:n,selected:o,type:r}),t&&a.jsxs(a.Fragment,{children:[a.jsx($,{layerStyle:"nodeBody",sx:{flexDirection:"column",w:"full",h:"full",py:2,gap:1,borderBottomRadius:l?0:"base"},children:a.jsxs($,{sx:{flexDir:"column",px:2,w:"full",h:"full"},children:[a.jsxs(tl,{gridTemplateColumns:"1fr auto",gridAutoRows:"1fr",children:[s.map((p,m)=>a.jsx(qd,{gridColumnStart:1,gridRowStart:m+1,children:a.jsx(Z_,{nodeId:e,fieldName:p})},`${e}.${p}.input-field`)),u.map((p,m)=>a.jsx(qd,{gridColumnStart:2,gridRowStart:m+1,children:a.jsx(hhe,{nodeId:e,fieldName:p})},`${e}.${p}.output-field`))]}),i.map(p=>a.jsx(Z_,{nodeId:e,fieldName:p},`${e}.${p}.input-field`))]})}),l&&a.jsx(Wme,{nodeId:e})]})]})},xhe=d.memo(vhe),bhe=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>a.jsxs(C0,{nodeId:e,selected:o,children:[a.jsxs($,{className:ec,layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",h:8,fontWeight:600,fontSize:"sm"},children:[a.jsx(U2,{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($,{layerStyle:"nodeBody",sx:{userSelect:"auto",flexDirection:"column",w:"full",h:"full",p:4,gap:1,borderBottomRadius:"base",fontSize:"sm"},children:a.jsxs(De,{children:[a.jsx(Se,{as:"span",children:"Unknown node type: "}),a.jsx(Se,{as:"span",fontWeight:600,children:r})]})})]}),yhe=d.memo(bhe),Che=e=>{const{data:t,selected:n}=e,{id:r,type:o,isOpen:s,label:i}=t,l=d.useMemo(()=>ce(we,({nodes:p})=>!!p.nodeTemplates[o]),[o]);return W(l)?a.jsx(xhe,{nodeId:r,isOpen:s,label:i,type:o,selected:n}):a.jsx(yhe,{nodeId:r,isOpen:s,label:i,type:o,selected:n})},whe=d.memo(Che),She=e=>{const{id:t,data:n,selected:r}=e,{notes:o,isOpen:s}=n,i=te(),l=d.useCallback(u=>{i(_N({nodeId:t,value:u.target.value}))},[i,t]);return a.jsxs(C0,{nodeId:t,selected:r,children:[a.jsxs($,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:s?0:"base",alignItems:"center",justifyContent:"space-between",h:8},children:[a.jsx(U2,{nodeId:t,isOpen:s}),a.jsx(BR,{nodeId:t,title:"Notes"}),a.jsx(De,{minW:8})]}),s&&a.jsx(a.Fragment,{children:a.jsx($,{layerStyle:"nodeBody",className:"nopan",sx:{cursor:"auto",flexDirection:"column",borderBottomRadius:"base",w:"full",h:"full",p:2,gap:1},children:a.jsx($,{className:"nopan",sx:{flexDir:"column",w:"full",h:"full"},children:a.jsx(gi,{value:o,onChange:l,rows:8,resize:"none",sx:{fontSize:"xs"}})})})})]})},khe=d.memo(She),jhe=["Delete","Backspace"],_he={collapsed:wme,default:kme},Ihe={invocation:whe,current_image:Pme,notes:khe},Phe={hideAttribution:!0},Ehe=ce(we,({nodes:e})=>{const{shouldSnapToGrid:t,selectionMode:n}=e;return{shouldSnapToGrid:t,selectionMode:n}},je),Mhe=()=>{const e=te(),t=W(R=>R.nodes.nodes),n=W(R=>R.nodes.edges),r=W(R=>R.nodes.viewport),{shouldSnapToGrid:o,selectionMode:s}=W(Ehe),i=d.useRef(null),l=d.useRef(),u=vme(),[p]=Ks("radii",["base"]),m=d.useCallback(R=>{e(IN(R))},[e]),h=d.useCallback(R=>{e(PN(R))},[e]),g=d.useCallback((R,N)=>{e(EN(N))},[e]),x=d.useCallback(R=>{e(aS(R))},[e]),y=d.useCallback(()=>{e(MN({cursorPosition:l.current}))},[e]),b=d.useCallback(R=>{e(ON(R))},[e]),C=d.useCallback(R=>{e(RN(R))},[e]),S=d.useCallback(({nodes:R,edges:N})=>{e(AN(R?R.map(Y=>Y.id):[])),e(DN(N?N.map(Y=>Y.id):[]))},[e]),j=d.useCallback((R,N)=>{e(TN(N))},[e]),_=d.useCallback(()=>{e(xP())},[e]),P=d.useCallback(R=>{iS.set(R),R.fitView()},[]),I=d.useCallback(R=>{var Y,F;const N=(Y=i.current)==null?void 0:Y.getBoundingClientRect();if(N){const V=(F=iS.get())==null?void 0:F.project({x:R.clientX-N.left,y:R.clientY-N.top});l.current=V}},[]),M=d.useRef(),O=d.useCallback((R,N,Y)=>{M.current=R,e(NN(N.id)),e($N())},[e]),A=d.useCallback((R,N)=>{e(aS(N))},[e]),D=d.useCallback((R,N,Y)=>{var F,V;!("touches"in R)&&((F=M.current)==null?void 0:F.clientX)===R.clientX&&((V=M.current)==null?void 0:V.clientY)===R.clientY&&e(LN(N)),M.current=void 0},[e]);return It(["Ctrl+c","Meta+c"],R=>{R.preventDefault(),e(zN())}),It(["Ctrl+a","Meta+a"],R=>{R.preventDefault(),e(FN())}),It(["Ctrl+v","Meta+v"],R=>{R.preventDefault(),e(BN({cursorPosition:l.current}))}),a.jsx(HN,{id:"workflow-editor",ref:i,defaultViewport:r,nodeTypes:Ihe,edgeTypes:_he,nodes:t,edges:n,onInit:P,onMouseMove:I,onNodesChange:m,onEdgesChange:h,onEdgesDelete:b,onEdgeUpdate:A,onEdgeUpdateStart:O,onEdgeUpdateEnd:D,onNodesDelete:C,onConnectStart:g,onConnect:x,onConnectEnd:y,onMoveEnd:j,connectionLineComponent:yme,onSelectionChange:S,isValidConnection:u,minZoom:.1,snapToGrid:o,snapGrid:[25,25],connectionRadius:30,proOptions:Phe,style:{borderRadius:p},onPaneClick:_,deleteKeyCode:jhe,selectionMode:s,children:a.jsx(U$,{})})},Ohe=()=>{const e=te(),{t}=J(),n=d.useCallback(()=>{e(hP())},[e]);return a.jsx($,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:2},children:a.jsx(ot,{tooltip:t("nodes.addNodeToolTip"),"aria-label":t("nodes.addNode"),icon:a.jsx(Xi,{}),onClick:n})})},Rhe=d.memo(Ohe),Ahe=()=>{const e=te(),t=G5("nodes"),{t:n}=J();return d.useCallback(o=>{if(!o)return;const s=new FileReader;s.onload=async()=>{const i=s.result;try{const l=JSON.parse(String(i)),u=UI.safeParse(l);if(!u.success){const{message:p}=WN(u.error,{prefix:n("nodes.workflowValidation")});t.error({error:VN(u.error)},p),e($t(Gn({title:n("nodes.unableToValidateWorkflow"),status:"error",duration:5e3}))),s.abort();return}e(Pb(u.data)),s.abort()}catch{e($t(Gn({title:n("nodes.unableToLoadWorkflow"),status:"error"})))}},s.readAsText(o)},[e,t,n])},Dhe=d.memo(e=>e.error.issues[0]?a.jsx(Se,{children:lS(e.error.issues[0],{prefix:null}).toString()}):a.jsx(_f,{children:e.error.issues.map((t,n)=>a.jsx(ws,{children:a.jsx(Se,{children:lS(t,{prefix:null}).toString()})},n))}));Dhe.displayName="WorkflowValidationErrorContent";const The=()=>{const{t:e}=J(),t=d.useRef(null),n=Ahe();return a.jsx(pM,{resetRef:t,accept:"application/json",onChange:n,children:r=>a.jsx(ot,{icon:a.jsx(Kg,{}),tooltip:e("nodes.loadWorkflow"),"aria-label":e("nodes.loadWorkflow"),...r})})},Nhe=d.memo(The),$he=()=>{const{t:e}=J(),t=te(),{isOpen:n,onOpen:r,onClose:o}=Uo(),s=d.useRef(null),i=W(u=>u.nodes.nodes.length),l=d.useCallback(()=>{t(UN()),t($t(Gn({title:e("toast.nodesCleared"),status:"success"}))),o()},[t,e,o]);return a.jsxs(a.Fragment,{children:[a.jsx(ot,{icon:a.jsx(qo,{}),tooltip:e("nodes.resetWorkflow"),"aria-label":e("nodes.resetWorkflow"),onClick:r,isDisabled:!i,colorScheme:"error"}),a.jsxs(Mf,{isOpen:n,onClose:o,leastDestructiveRef:s,isCentered:!0,children:[a.jsx(oa,{}),a.jsxs(Of,{children:[a.jsx(ra,{fontSize:"lg",fontWeight:"bold",children:e("nodes.resetWorkflow")}),a.jsx(sa,{py:4,children:a.jsxs($,{flexDir:"column",gap:2,children:[a.jsx(Se,{children:e("nodes.resetWorkflowDesc")}),a.jsx(Se,{variant:"subtext",children:e("nodes.resetWorkflowDesc2")})]})}),a.jsxs(Oa,{children:[a.jsx(el,{ref:s,onClick:o,children:e("common.cancel")}),a.jsx(el,{colorScheme:"error",ml:3,onClick:l,children:e("common.accept")})]})]})]})]})},Lhe=d.memo($he),zhe=()=>{const{t:e}=J(),t=U8(),n=d.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(ot,{icon:a.jsx(zu,{}),tooltip:e("nodes.downloadWorkflow"),"aria-label":e("nodes.downloadWorkflow"),onClick:n})},Fhe=d.memo(zhe),Bhe=()=>a.jsxs($,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:"50%",transform:"translate(-50%)"},children:[a.jsx(Fhe,{}),a.jsx(Nhe,{}),a.jsx(Lhe,{})]}),Hhe=d.memo(Bhe),Whe=()=>a.jsx($,{sx:{gap:2,flexDir:"column"},children:Ro(vf,({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))}),Vhe=d.memo(Whe),Uhe=()=>{const{t:e}=J(),t=te(),n=d.useCallback(()=>{t(GN())},[t]);return a.jsx(Mt,{leftIcon:a.jsx(Mee,{}),tooltip:e("nodes.reloadNodeTemplates"),"aria-label":e("nodes.reloadNodeTemplates"),onClick:n,children:e("nodes.reloadNodeTemplates")})},Ghe=d.memo(Uhe),wd={fontWeight:600},qhe=ce(we,({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===qN.Full}},je),Khe=Oe((e,t)=>{const{isOpen:n,onOpen:r,onClose:o}=Uo(),s=te(),{shouldAnimateEdges:i,shouldValidateGraph:l,shouldSnapToGrid:u,shouldColorEdges:p,selectionModeIsChecked:m}=W(qhe),h=d.useCallback(S=>{s(KN(S.target.checked))},[s]),g=d.useCallback(S=>{s(QN(S.target.checked))},[s]),x=d.useCallback(S=>{s(XN(S.target.checked))},[s]),y=d.useCallback(S=>{s(YN(S.target.checked))},[s]),b=d.useCallback(S=>{s(JN(S.target.checked))},[s]),{t:C}=J();return a.jsxs(a.Fragment,{children:[a.jsx(ot,{ref:t,"aria-label":C("nodes.workflowSettings"),tooltip:C("nodes.workflowSettings"),icon:a.jsx(HM,{}),onClick:r}),a.jsxs(ql,{isOpen:n,onClose:o,size:"2xl",isCentered:!0,children:[a.jsx(oa,{}),a.jsxs(Kl,{children:[a.jsx(ra,{children:C("nodes.workflowSettings")}),a.jsx(Rf,{}),a.jsx(sa,{children:a.jsxs($,{sx:{flexDirection:"column",gap:4,py:4},children:[a.jsx(xo,{size:"sm",children:"General"}),a.jsx(kr,{formLabelProps:wd,onChange:g,isChecked:i,label:C("nodes.animatedEdges"),helperText:C("nodes.animatedEdgesHelp")}),a.jsx(no,{}),a.jsx(kr,{formLabelProps:wd,isChecked:u,onChange:x,label:C("nodes.snapToGrid"),helperText:C("nodes.snapToGridHelp")}),a.jsx(no,{}),a.jsx(kr,{formLabelProps:wd,isChecked:p,onChange:y,label:C("nodes.colorCodeEdges"),helperText:C("nodes.colorCodeEdgesHelp")}),a.jsx(kr,{formLabelProps:wd,isChecked:m,onChange:b,label:C("nodes.fullyContainNodes"),helperText:C("nodes.fullyContainNodesHelp")}),a.jsx(xo,{size:"sm",pt:4,children:"Advanced"}),a.jsx(kr,{formLabelProps:wd,isChecked:l,onChange:h,label:C("nodes.validateConnections"),helperText:C("nodes.validateConnectionsHelp")}),a.jsx(Ghe,{})]})})]})]})]})}),Qhe=d.memo(Khe),Xhe=()=>{const e=W(t=>t.nodes.shouldShowFieldTypeLegend);return a.jsxs($,{sx:{gap:2,position:"absolute",top:2,insetInlineEnd:2},children:[a.jsx(Qhe,{}),e&&a.jsx(Vhe,{})]})},Yhe=d.memo(Xhe);function Jhe(){const e=te(),t=W(o=>o.nodes.nodeOpacity),{t:n}=J(),r=d.useCallback(o=>{e(ZN(o))},[e]);return a.jsx($,{alignItems:"center",children:a.jsxs(Cy,{"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(Sy,{children:a.jsx(ky,{})}),a.jsx(wy,{})]})})}const Zhe=()=>{const{t:e}=J(),{zoomIn:t,zoomOut:n,fitView:r}=Nb(),o=te(),s=W(m=>m.nodes.shouldShowMinimapPanel),i=d.useCallback(()=>{t()},[t]),l=d.useCallback(()=>{n()},[n]),u=d.useCallback(()=>{r()},[r]),p=d.useCallback(()=>{o(e9(!s))},[s,o]);return a.jsxs(zn,{isAttached:!0,orientation:"vertical",children:[a.jsx(ot,{tooltip:e("nodes.zoomInNodes"),"aria-label":e("nodes.zoomInNodes"),onClick:i,icon:a.jsx(Koe,{})}),a.jsx(ot,{tooltip:e("nodes.zoomOutNodes"),"aria-label":e("nodes.zoomOutNodes"),onClick:l,icon:a.jsx(qoe,{})}),a.jsx(ot,{tooltip:e("nodes.fitViewportNodes"),"aria-label":e("nodes.fitViewportNodes"),onClick:u,icon:a.jsx(WM,{})}),a.jsx(ot,{tooltip:e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),"aria-label":e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),isChecked:s,onClick:p,icon:a.jsx(bee,{})})]})},ege=d.memo(Zhe),tge=()=>a.jsxs($,{sx:{gap:2,position:"absolute",bottom:2,insetInlineStart:2},children:[a.jsx(ege,{}),a.jsx(Jhe,{})]}),nge=d.memo(tge),rge=Ee(z$),oge=()=>{const e=W(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($,{sx:{gap:2,position:"absolute",bottom:2,insetInlineEnd:2},children:e&&a.jsx(rge,{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})})},sge=d.memo(oge),age=()=>{const e=W(n=>n.nodes.isReady),{t}=J();return a.jsxs($,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center"},children:[a.jsx(yo,{children:e&&a.jsxs(Mr.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(Mhe,{}),a.jsx(gme,{}),a.jsx(Rhe,{}),a.jsx(Hhe,{}),a.jsx(Yhe,{}),a.jsx(nge,{}),a.jsx(sge,{})]})}),a.jsx(yo,{children:!e&&a.jsx(Mr.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($,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:a.jsx(eo,{label:t("nodes.loadingNodes"),icon:Qoe})})})})]})},ige=d.memo(age),lge=()=>a.jsx(t9,{children:a.jsx(ige,{})}),cge=d.memo(lge),uge=()=>{const{t:e}=J(),t=te(),{data:n}=bf(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=n9({fixedCacheKey:"clearInvocationCache"}),i=d.useMemo(()=>!(n!=null&&n.size)||!r,[n==null?void 0:n.size,r]);return{clearInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t($t({title:e("invocationCache.clearSucceeded"),status:"success"}))}catch{t($t({title:e("invocationCache.clearFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},dge=()=>{const{t:e}=J(),{clearInvocationCache:t,isDisabled:n,isLoading:r}=uge();return a.jsx(Mt,{isDisabled:n,isLoading:r,onClick:t,children:e("invocationCache.clear")})},fge=d.memo(dge),pge=()=>{const{t:e}=J(),t=te(),{data:n}=bf(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=r9({fixedCacheKey:"disableInvocationCache"}),i=d.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:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t($t({title:e("invocationCache.disableSucceeded"),status:"success"}))}catch{t($t({title:e("invocationCache.disableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},mge=()=>{const{t:e}=J(),t=te(),{data:n}=bf(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=o9({fixedCacheKey:"enableInvocationCache"}),i=d.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:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t($t({title:e("invocationCache.enableSucceeded"),status:"success"}))}catch{t($t({title:e("invocationCache.enableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},hge=()=>{const{t:e}=J(),{data:t}=bf(),{enableInvocationCache:n,isDisabled:r,isLoading:o}=mge(),{disableInvocationCache:s,isDisabled:i,isLoading:l}=pge();return t!=null&&t.enabled?a.jsx(Mt,{isDisabled:i,isLoading:l,onClick:s,children:e("invocationCache.disable")}):a.jsx(Mt,{isDisabled:r,isLoading:o,onClick:n,children:e("invocationCache.enable")})},gge=d.memo(hge),vge=({children:e,...t})=>a.jsx(F5,{alignItems:"center",justifyContent:"center",w:"full",h:"full",layerStyle:"second",borderRadius:"base",py:2,px:3,gap:6,flexWrap:"nowrap",...t,children:e}),qR=d.memo(vge),xge={'&[aria-disabled="true"]':{color:"base.400",_dark:{color:"base.500"}}},bge=({label:e,value:t,isDisabled:n=!1,...r})=>a.jsxs(z5,{flexGrow:1,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap","aria-disabled":n,sx:xge,...r,children:[a.jsx(B5,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:e}),a.jsx(H5,{children:t})]}),Sa=d.memo(bge),yge=()=>{const{t:e}=J(),{data:t}=bf(void 0);return a.jsxs(qR,{children:[a.jsx(Sa,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.cacheSize"),value:(t==null?void 0:t.size)??0}),a.jsx(Sa,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.hits"),value:(t==null?void 0:t.hits)??0}),a.jsx(Sa,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.misses"),value:(t==null?void 0:t.misses)??0}),a.jsx(Sa,{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(fge,{}),a.jsx(gge,{})]})]})},Cge=d.memo(yge),KR=e=>{const t=W(l=>l.system.isConnected),[n,{isLoading:r}]=Mb(),o=te(),{t:s}=J();return{cancelQueueItem:d.useCallback(async()=>{try{await n(e).unwrap(),o($t({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o($t({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)),eI={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"}},wge=({status:e})=>{const{t}=J();return a.jsx(Ha,{colorScheme:eI[e].colorScheme,children:t(eI[e].translationKey)})},Sge=d.memo(wge),kge=e=>{const t=W(u=>u.system.isConnected),{isCanceled:n}=s9({batch_id:e},{selectFromResult:({data:u})=>u?{isCanceled:(u==null?void 0:u.in_progress)===0&&(u==null?void 0:u.pending)===0}:{isCanceled:!0}}),[r,{isLoading:o}]=a9({fixedCacheKey:"cancelByBatchIds"}),s=te(),{t:i}=J();return{cancelBatch:d.useCallback(async()=>{if(!n)try{await r({batch_ids:[e]}).unwrap(),s($t({title:i("queue.cancelBatchSucceeded"),status:"success"}))}catch{s($t({title:i("queue.cancelBatchFailed"),status:"error"}))}},[e,s,n,i,r]),isLoading:o,isCanceled:n,isDisabled:!t}},jge=({queueItemDTO:e})=>{const{session_id:t,batch_id:n,item_id:r}=e,{t:o}=J(),{cancelBatch:s,isLoading:i,isCanceled:l}=kge(n),{cancelQueueItem:u,isLoading:p}=KR(r),{data:m}=i9(r),h=d.useMemo(()=>{if(!m)return o("common.loading");if(!m.completed_at||!m.started_at)return o(`queue.${m.status}`);const g=QR(m.started_at,m.completed_at);return m.status==="completed"?`${o("queue.completedIn")} ${g}${g===1?"":"s"}`:`${g}s`},[m,o]);return a.jsxs($,{layerStyle:"third",flexDir:"column",p:2,pt:0,borderRadius:"base",gap:2,children:[a.jsxs($,{layerStyle:"second",p:2,gap:2,justifyContent:"space-between",alignItems:"center",borderRadius:"base",h:20,children:[a.jsx(vm,{label:o("queue.status"),data:h}),a.jsx(vm,{label:o("queue.item"),data:r}),a.jsx(vm,{label:o("queue.batch"),data:n}),a.jsx(vm,{label:o("queue.session"),data:t}),a.jsxs(zn,{size:"xs",orientation:"vertical",children:[a.jsx(Mt,{onClick:u,isLoading:p,isDisabled:m?["canceled","completed","failed"].includes(m.status):!0,"aria-label":o("queue.cancelItem"),icon:a.jsx(wu,{}),colorScheme:"error",children:o("queue.cancelItem")}),a.jsx(Mt,{onClick:s,isLoading:i,isDisabled:l,"aria-label":o("queue.cancelBatch"),icon:a.jsx(wu,{}),colorScheme:"error",children:o("queue.cancelBatch")})]})]}),(m==null?void 0:m.error)&&a.jsxs($,{layerStyle:"second",p:3,gap:1,justifyContent:"space-between",alignItems:"flex-start",borderRadius:"base",flexDir:"column",children:[a.jsx(xo,{size:"sm",color:"error.500",_dark:{color:"error.400"},children:"Error"}),a.jsx("pre",{children:m.error})]}),a.jsx($,{layerStyle:"second",h:512,w:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",children:m?a.jsx(Hu,{children:a.jsx(Zi,{label:"Queue Item",data:m})}):a.jsx(vi,{opacity:.5})})]})},_ge=d.memo(jge),vm=({label:e,data:t})=>a.jsxs($,{flexDir:"column",justifyContent:"flex-start",p:1,gap:1,overflow:"hidden",h:"full",w:"full",children:[a.jsx(xo,{size:"md",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:e}),a.jsx(Se,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),ja={number:"3rem",statusBadge:"5.7rem",statusDot:2,time:"4rem",batchId:"5rem",fieldValues:"auto",actions:"auto"},tI={bg:"base.300",_dark:{bg:"base.750"}},Ige={_hover:tI,"&[aria-selected='true']":tI},Pge=({index:e,item:t,context:n})=>{const{t:r}=J(),o=d.useCallback(()=>{n.toggleQueueItem(t.item_id)},[n,t.item_id]),{cancelQueueItem:s,isLoading:i}=KR(t.item_id),l=d.useCallback(h=>{h.stopPropagation(),s()},[s]),u=d.useMemo(()=>n.openQueueItems.includes(t.item_id),[n.openQueueItems,t.item_id]),p=d.useMemo(()=>!t.completed_at||!t.started_at?void 0:`${QR(t.started_at,t.completed_at)}s`,[t]),m=d.useMemo(()=>["canceled","completed","failed"].includes(t.status),[t.status]);return a.jsxs($,{flexDir:"column","aria-selected":u,fontSize:"sm",borderRadius:"base",justifyContent:"center",sx:Ige,"data-testid":"queue-item",children:[a.jsxs($,{minH:9,alignItems:"center",gap:4,p:1.5,cursor:"pointer",onClick:o,children:[a.jsx($,{w:ja.number,justifyContent:"flex-end",alignItems:"center",flexShrink:0,children:a.jsx(Se,{variant:"subtext",children:e+1})}),a.jsx($,{w:ja.statusBadge,alignItems:"center",flexShrink:0,children:a.jsx(Sge,{status:t.status})}),a.jsx($,{w:ja.time,alignItems:"center",flexShrink:0,children:p||"-"}),a.jsx($,{w:ja.batchId,flexShrink:0,children:a.jsx(Se,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",alignItems:"center",children:t.batch_id})}),a.jsx($,{alignItems:"center",overflow:"hidden",flexGrow:1,children:t.field_values&&a.jsx($,{gap:2,w:"full",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:t.field_values.filter(h=>h.node_path!=="metadata_accumulator").map(({node_path:h,field_name:g,value:x})=>a.jsxs(Se,{as:"span",children:[a.jsxs(Se,{as:"span",fontWeight:600,children:[h,".",g]}),": ",x]},`${t.item_id}.${h}.${g}.${x}`))})}),a.jsx($,{alignItems:"center",w:ja.actions,pe:3,children:a.jsx(zn,{size:"xs",variant:"ghost",children:a.jsx(ot,{onClick:l,isDisabled:m,isLoading:i,"aria-label":r("queue.cancelItem"),icon:a.jsx(wu,{})})})})]}),a.jsx(wf,{in:u,transition:{enter:{duration:.1},exit:{duration:.1}},unmountOnExit:!0,children:a.jsx(_ge,{queueItemDTO:t})})]})},Ege=d.memo(Pge),Mge=d.memo(Oe((e,t)=>a.jsx($,{...e,ref:t,flexDirection:"column",gap:.5,children:e.children}))),Oge=d.memo(Mge),Rge=()=>a.jsxs($,{alignItems:"center",gap:4,p:1,pb:2,textTransform:"uppercase",fontWeight:700,fontSize:"xs",letterSpacing:1,children:[a.jsx($,{w:ja.number,justifyContent:"flex-end",alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"#"})}),a.jsx($,{ps:.5,w:ja.statusBadge,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"status"})}),a.jsx($,{ps:.5,w:ja.time,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"time"})}),a.jsx($,{ps:.5,w:ja.batchId,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"batch"})}),a.jsx($,{ps:.5,w:ja.fieldValues,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"batch field values"})})]}),Age=d.memo(Rge),Dge={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},Tge=ce(we,({queue:e})=>{const{listCursor:t,listPriority:n}=e;return{listCursor:t,listPriority:n}},je),Nge=(e,t)=>t.item_id,$ge={List:Oge},Lge=(e,t,n)=>a.jsx(Ege,{index:e,item:t,context:n}),zge=()=>{const{listCursor:e,listPriority:t}=W(Tge),n=te(),r=d.useRef(null),[o,s]=d.useState(null),[i,l]=a2(Dge),{t:u}=J();d.useEffect(()=>{const{current:S}=r;return o&&S&&i({target:S,elements:{viewport:o}}),()=>{var j;return(j=l())==null?void 0:j.destroy()}},[o,i,l]);const{data:p,isLoading:m}=l9({cursor:e,priority:t}),h=d.useMemo(()=>p?c9.getSelectors().selectAll(p):[],[p]),g=d.useCallback(()=>{if(!(p!=null&&p.has_more))return;const S=h[h.length-1];S&&(n(Ob(S.item_id)),n(Rb(S.priority)))},[n,p==null?void 0:p.has_more,h]),[x,y]=d.useState([]),b=d.useCallback(S=>{y(j=>j.includes(S)?j.filter(_=>_!==S):[...j,S])},[]),C=d.useMemo(()=>({openQueueItems:x,toggleQueueItem:b}),[x,b]);return m?a.jsx(ure,{}):h.length?a.jsxs($,{w:"full",h:"full",flexDir:"column",children:[a.jsx(Age,{}),a.jsx($,{ref:r,w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(Coe,{data:h,endReached:g,scrollerRef:s,itemContent:Lge,computeItemKey:Nge,components:$ge,context:C})})]}):a.jsx($,{w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(xo,{color:"base.400",_dark:{color:"base.500"},children:u("queue.queueEmpty")})})},Fge=d.memo(zge),Bge=()=>{const{data:e}=Fa(),{t}=J();return a.jsxs(qR,{"data-testid":"queue-status",children:[a.jsx(Sa,{label:t("queue.in_progress"),value:(e==null?void 0:e.queue.in_progress)??0}),a.jsx(Sa,{label:t("queue.pending"),value:(e==null?void 0:e.queue.pending)??0}),a.jsx(Sa,{label:t("queue.completed"),value:(e==null?void 0:e.queue.completed)??0}),a.jsx(Sa,{label:t("queue.failed"),value:(e==null?void 0:e.queue.failed)??0}),a.jsx(Sa,{label:t("queue.canceled"),value:(e==null?void 0:e.queue.canceled)??0}),a.jsx(Sa,{label:t("queue.total"),value:(e==null?void 0:e.queue.total)??0})]})},Hge=d.memo(Bge);function Wge(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 Vge=()=>{const e=te(),{t}=J(),n=W(u=>u.system.isConnected),[r,{isLoading:o}]=lP({fixedCacheKey:"pruneQueue"}),{finishedCount:s}=Fa(void 0,{selectFromResult:({data:u})=>u?{finishedCount:u.queue.completed+u.queue.canceled+u.queue.failed}:{finishedCount:0}}),i=d.useCallback(async()=>{if(s)try{const u=await r().unwrap();e($t({title:t("queue.pruneSucceeded",{item_count:u.deleted}),status:"success"})),e(Ob(void 0)),e(Rb(void 0))}catch{e($t({title:t("queue.pruneFailed"),status:"error"}))}},[s,r,e,t]),l=d.useMemo(()=>!n||!s,[s,n]);return{pruneQueue:i,isLoading:o,finishedCount:s,isDisabled:l}},Uge=({asIconButton:e})=>{const{t}=J(),{pruneQueue:n,isLoading:r,finishedCount:o,isDisabled:s}=Vge();return a.jsx(cc,{isDisabled:s,isLoading:r,asIconButton:e,label:t("queue.prune"),tooltip:t("queue.pruneTooltip",{item_count:o}),icon:a.jsx(Wge,{}),onClick:n,colorScheme:"blue"})},Gge=d.memo(Uge),qge=()=>{const e=jn("pauseQueue").isFeatureEnabled,t=jn("resumeQueue").isFeatureEnabled;return a.jsxs($,{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(Gge,{}),a.jsx(I2,{})]})]})},Kge=d.memo(qge),Qge=()=>{const e=jn("invocationCache").isFeatureEnabled;return a.jsxs($,{layerStyle:"first",borderRadius:"base",w:"full",h:"full",p:2,flexDir:"column",gap:2,children:[a.jsxs($,{gap:2,w:"full",children:[a.jsx(Kge,{}),a.jsx(Hge,{}),e&&a.jsx(Cge,{})]}),a.jsx(De,{layerStyle:"second",p:2,borderRadius:"base",w:"full",h:"full",children:a.jsx(Fge,{})})]})},Xge=d.memo(Qge),Yge=()=>a.jsx(Xge,{}),Jge=d.memo(Yge),Zge=()=>a.jsx(MR,{}),e0e=d.memo(Zge);var lb={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var n=cS;Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return n.Konva}});const r=cS;e.exports=r.Konva})(lb,lb.exports);var t0e=lb.exports;const df=pf(t0e);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 n0e=function(t){var n={},r=d,o=xm,s=Object.assign;function i(c){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+c,v=1;voe||k[L]!==E[oe]){var he=` `+k[L].replace(" at new "," at ");return c.displayName&&he.includes("")&&(he=he.replace("",c.displayName)),he}while(1<=L&&0<=oe);break}}}finally{Zt=!1,Error.prepareStackTrace=v}return(c=c?c.displayName||c.name:"")?Ht(c):""}var an=Object.prototype.hasOwnProperty,Yt=[],Be=-1;function yt(c){return{current:c}}function Lt(c){0>Be||(c.current=Yt[Be],Yt[Be]=null,Be--)}function Qt(c,f){Be++,Yt[Be]=c.current,c.current=f}var Nn={},Jt=yt(Nn),vn=yt(!1),fn=Nn;function Fr(c,f){var v=c.type.contextTypes;if(!v)return Nn;var w=c.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===f)return w.__reactInternalMemoizedMaskedChildContext;var k={},E;for(E in v)k[E]=f[E];return w&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=f,c.__reactInternalMemoizedMaskedChildContext=k),k}function cr(c){return c=c.childContextTypes,c!=null}function Ot(){Lt(vn),Lt(Jt)}function $n(c,f,v){if(Jt.current!==Nn)throw Error(i(168));Qt(Jt,f),Qt(vn,v)}function Hn(c,f,v){var w=c.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(c)||"Unknown",k));return s({},v,w)}function ur(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||Nn,fn=Jt.current,Qt(Jt,c),Qt(vn,vn.current),!0}function _r(c,f,v){var w=c.stateNode;if(!w)throw Error(i(169));v?(c=Hn(c,f,fn),w.__reactInternalMemoizedMergedChildContext=c,Lt(vn),Lt(Jt),Qt(Jt,c)):Lt(vn),Qt(vn,v)}var Qn=Math.clz32?Math.clz32:On,Xn=Math.log,xn=Math.LN2;function On(c){return c>>>=0,c===0?32:31-(Xn(c)/xn|0)|0}var Ln=64,In=4194304;function Pn(c){switch(c&-c){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 c&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return c&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function Je(c,f){var v=c.pendingLanes;if(v===0)return 0;var w=0,k=c.suspendedLanes,E=c.pingedLanes,L=v&268435455;if(L!==0){var oe=L&~k;oe!==0?w=Pn(oe):(E&=L,E!==0&&(w=Pn(E)))}else L=v&~k,L!==0?w=Pn(L):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=c.entangledLanes,f!==0)for(c=c.entanglements,f&=w;0v;v++)f.push(c);return f}function vt(c,f,v){c.pendingLanes|=f,f!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,f=31-Qn(f),c[f]=v}function st(c,f){var v=c.pendingLanes&~f;c.pendingLanes=f,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=f,c.mutableReadLanes&=f,c.entangledLanes&=f,f=c.entanglements;var w=c.eventTimes;for(c=c.expirationTimes;0>=L,k-=L,Jo=1<<32-Qn(f)+k|v<Rn?(Zr=rn,rn=null):Zr=rn.sibling;var An=ut(me,rn,Ce[Rn],ft);if(An===null){rn===null&&(rn=Zr);break}c&&rn&&An.alternate===null&&f(me,rn),ie=E(An,ie,Rn),un===null?Bt=An:un.sibling=An,un=An,rn=Zr}if(Rn===Ce.length)return v(me,rn),dr&&xl(me,Rn),Bt;if(rn===null){for(;RnRn?(Zr=rn,rn=null):Zr=rn.sibling;var Ni=ut(me,rn,An.value,ft);if(Ni===null){rn===null&&(rn=Zr);break}c&&rn&&Ni.alternate===null&&f(me,rn),ie=E(Ni,ie,Rn),un===null?Bt=Ni:un.sibling=Ni,un=Ni,rn=Zr}if(An.done)return v(me,rn),dr&&xl(me,Rn),Bt;if(rn===null){for(;!An.done;Rn++,An=Ce.next())An=nn(me,An.value,ft),An!==null&&(ie=E(An,ie,Rn),un===null?Bt=An:un.sibling=An,un=An);return dr&&xl(me,Rn),Bt}for(rn=w(me,rn);!An.done;Rn++,An=Ce.next())An=lr(rn,me,Rn,An.value,ft),An!==null&&(c&&An.alternate!==null&&rn.delete(An.key===null?Rn:An.key),ie=E(An,ie,Rn),un===null?Bt=An:un.sibling=An,un=An);return c&&rn.forEach(function(FA){return f(me,FA)}),dr&&xl(me,Rn),Bt}function Ya(me,ie,Ce,ft){if(typeof Ce=="object"&&Ce!==null&&Ce.type===m&&Ce.key===null&&(Ce=Ce.props.children),typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case u:e:{for(var Bt=Ce.key,un=ie;un!==null;){if(un.key===Bt){if(Bt=Ce.type,Bt===m){if(un.tag===7){v(me,un.sibling),ie=k(un,Ce.props.children),ie.return=me,me=ie;break e}}else if(un.elementType===Bt||typeof Bt=="object"&&Bt!==null&&Bt.$$typeof===_&&uC(Bt)===un.type){v(me,un.sibling),ie=k(un,Ce.props),ie.ref=Xu(me,un,Ce),ie.return=me,me=ie;break e}v(me,un);break}else f(me,un);un=un.sibling}Ce.type===m?(ie=jl(Ce.props.children,me.mode,ft,Ce.key),ie.return=me,me=ie):(ft=Ip(Ce.type,Ce.key,Ce.props,null,me.mode,ft),ft.ref=Xu(me,ie,Ce),ft.return=me,me=ft)}return L(me);case p:e:{for(un=Ce.key;ie!==null;){if(ie.key===un)if(ie.tag===4&&ie.stateNode.containerInfo===Ce.containerInfo&&ie.stateNode.implementation===Ce.implementation){v(me,ie.sibling),ie=k(ie,Ce.children||[]),ie.return=me,me=ie;break e}else{v(me,ie);break}else f(me,ie);ie=ie.sibling}ie=Sv(Ce,me.mode,ft),ie.return=me,me=ie}return L(me);case _:return un=Ce._init,Ya(me,ie,un(Ce._payload),ft)}if(Q(Ce))return Jn(me,ie,Ce,ft);if(M(Ce))return Lo(me,ie,Ce,ft);tp(me,Ce)}return typeof Ce=="string"&&Ce!==""||typeof Ce=="number"?(Ce=""+Ce,ie!==null&&ie.tag===6?(v(me,ie.sibling),ie=k(ie,Ce),ie.return=me,me=ie):(v(me,ie),ie=wv(Ce,me.mode,ft),ie.return=me,me=ie),L(me)):v(me,ie)}return Ya}var hc=dC(!0),fC=dC(!1),Yu={},ms=yt(Yu),Ju=yt(Yu),gc=yt(Yu);function ga(c){if(c===Yu)throw Error(i(174));return c}function N0(c,f){Qt(gc,f),Qt(Ju,c),Qt(ms,Yu),c=z(f),Lt(ms),Qt(ms,c)}function vc(){Lt(ms),Lt(Ju),Lt(gc)}function pC(c){var f=ga(gc.current),v=ga(ms.current);f=G(v,c.type,f),v!==f&&(Qt(Ju,c),Qt(ms,f))}function $0(c){Ju.current===c&&(Lt(ms),Lt(Ju))}var br=yt(0);function np(c){for(var f=c;f!==null;){if(f.tag===13){var v=f.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||Xr(v)||fa(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===c)break;for(;f.sibling===null;){if(f.return===null||f.return===c)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var L0=[];function z0(){for(var c=0;cv?v:4,c(!0);var w=F0.transition;F0.transition={};try{c(!1),f()}finally{Re=v,F0.transition=w}}function OC(){return hs().memoizedState}function pA(c,f,v){var w=Ai(c);if(v={lane:w,action:v,hasEagerState:!1,eagerState:null,next:null},RC(c))AC(f,v);else if(v=nC(c,f,v,w),v!==null){var k=ho();gs(v,c,w,k),DC(v,f,w)}}function mA(c,f,v){var w=Ai(c),k={lane:w,action:v,hasEagerState:!1,eagerState:null,next:null};if(RC(c))AC(f,k);else{var E=c.alternate;if(c.lanes===0&&(E===null||E.lanes===0)&&(E=f.lastRenderedReducer,E!==null))try{var L=f.lastRenderedState,oe=E(L,v);if(k.hasEagerState=!0,k.eagerState=oe,bn(oe,L)){var he=f.interleaved;he===null?(k.next=k,R0(f)):(k.next=he.next,he.next=k),f.interleaved=k;return}}catch{}finally{}v=nC(c,f,k,w),v!==null&&(k=ho(),gs(v,c,w,k),DC(v,f,w))}}function RC(c){var f=c.alternate;return c===yr||f!==null&&f===yr}function AC(c,f){Zu=op=!0;var v=c.pending;v===null?f.next=f:(f.next=v.next,v.next=f),c.pending=f}function DC(c,f,v){if(v&4194240){var w=f.lanes;w&=c.pendingLanes,v|=w,f.lanes=v,$e(c,v)}}var ip={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},hA={readContext:ps,useCallback:function(c,f){return va().memoizedState=[c,f===void 0?null:f],c},useContext:ps,useEffect:SC,useImperativeHandle:function(c,f,v){return v=v!=null?v.concat([c]):null,sp(4194308,4,_C.bind(null,f,c),v)},useLayoutEffect:function(c,f){return sp(4194308,4,c,f)},useInsertionEffect:function(c,f){return sp(4,2,c,f)},useMemo:function(c,f){var v=va();return f=f===void 0?null:f,c=c(),v.memoizedState=[c,f],c},useReducer:function(c,f,v){var w=va();return f=v!==void 0?v(f):f,w.memoizedState=w.baseState=f,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:f},w.queue=c,c=c.dispatch=pA.bind(null,yr,c),[w.memoizedState,c]},useRef:function(c){var f=va();return c={current:c},f.memoizedState=c},useState:CC,useDebugValue:q0,useDeferredValue:function(c){return va().memoizedState=c},useTransition:function(){var c=CC(!1),f=c[0];return c=fA.bind(null,c[1]),va().memoizedState=c,[f,c]},useMutableSource:function(){},useSyncExternalStore:function(c,f,v){var w=yr,k=va();if(dr){if(v===void 0)throw Error(i(407));v=v()}else{if(v=f(),Jr===null)throw Error(i(349));yl&30||gC(w,f,v)}k.memoizedState=v;var E={value:v,getSnapshot:f};return k.queue=E,SC(xC.bind(null,w,E,c),[c]),w.flags|=2048,nd(9,vC.bind(null,w,E,v,f),void 0,null),v},useId:function(){var c=va(),f=Jr.identifierPrefix;if(dr){var v=uo,w=Jo;v=(w&~(1<<32-Qn(w)-1)).toString(32)+v,f=":"+f+"R"+v,v=ed++,0mv&&(f.flags|=128,w=!0,sd(k,!1),f.lanes=4194304)}else{if(!w)if(c=np(E),c!==null){if(f.flags|=128,w=!0,c=c.updateQueue,c!==null&&(f.updateQueue=c,f.flags|=4),sd(k,!0),k.tail===null&&k.tailMode==="hidden"&&!E.alternate&&!dr)return po(f),null}else 2*Ue()-k.renderingStartTime>mv&&v!==1073741824&&(f.flags|=128,w=!0,sd(k,!1),f.lanes=4194304);k.isBackwards?(E.sibling=f.child,f.child=E):(c=k.last,c!==null?c.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,c=br.current,Qt(br,w?c&1|2:c&1),f):(po(f),null);case 22:case 23:return bv(),v=f.memoizedState!==null,c!==null&&c.memoizedState!==null!==v&&(f.flags|=8192),v&&f.mode&1?es&1073741824&&(po(f),fe&&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(c,f){switch(k0(f),f.tag){case 1:return cr(f.type)&&Ot(),c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 3:return vc(),Lt(vn),Lt(Jt),z0(),c=f.flags,c&65536&&!(c&128)?(f.flags=c&-65537|128,f):null;case 5:return $0(f),null;case 13:if(Lt(br),c=f.memoizedState,c!==null&&c.dehydrated!==null){if(f.alternate===null)throw Error(i(340));fc()}return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 19:return Lt(br),null;case 4:return vc(),null;case 10:return M0(f.type._context),null;case 22:case 23:return bv(),null;case 24:return null;default:return null}}var fp=!1,mo=!1,kA=typeof WeakSet=="function"?WeakSet:Set,gt=null;function bc(c,f){var v=c.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(w){fr(c,f,w)}else v.current=null}function nv(c,f,v){try{v()}catch(w){fr(c,f,w)}}var ZC=!1;function jA(c,f){for(T(c.containerInfo),gt=f;gt!==null;)if(c=gt,f=c.child,(c.subtreeFlags&1028)!==0&&f!==null)f.return=c,gt=f;else for(;gt!==null;){c=gt;try{var v=c.alternate;if(c.flags&1024)switch(c.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var w=v.memoizedProps,k=v.memoizedState,E=c.stateNode,L=E.getSnapshotBeforeUpdate(c.elementType===c.type?w:Fs(c.type,w),k);E.__reactInternalSnapshotBeforeUpdate=L}break;case 3:fe&&mn(c.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(oe){fr(c,c.return,oe)}if(f=c.sibling,f!==null){f.return=c.return,gt=f;break}gt=c.return}return v=ZC,ZC=!1,v}function ad(c,f,v){var w=f.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var k=w=w.next;do{if((k.tag&c)===c){var E=k.destroy;k.destroy=void 0,E!==void 0&&nv(f,v,E)}k=k.next}while(k!==w)}}function pp(c,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&c)===c){var w=v.create;v.destroy=w()}v=v.next}while(v!==f)}}function rv(c){var f=c.ref;if(f!==null){var v=c.stateNode;switch(c.tag){case 5:c=q(v);break;default:c=v}typeof f=="function"?f(c):f.current=c}}function ew(c){var f=c.alternate;f!==null&&(c.alternate=null,ew(f)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(f=c.stateNode,f!==null&&Ae(f)),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function tw(c){return c.tag===5||c.tag===3||c.tag===4}function nw(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||tw(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function ov(c,f,v){var w=c.tag;if(w===5||w===6)c=c.stateNode,f?_n(v,c,f):Ct(v,c);else if(w!==4&&(c=c.child,c!==null))for(ov(c,f,v),c=c.sibling;c!==null;)ov(c,f,v),c=c.sibling}function sv(c,f,v){var w=c.tag;if(w===5||w===6)c=c.stateNode,f?Xe(v,c,f):ke(v,c);else if(w!==4&&(c=c.child,c!==null))for(sv(c,f,v),c=c.sibling;c!==null;)sv(c,f,v),c=c.sibling}var lo=null,Bs=!1;function ba(c,f,v){for(v=v.child;v!==null;)av(c,f,v),v=v.sibling}function av(c,f,v){if(Sn&&typeof Sn.onCommitFiberUnmount=="function")try{Sn.onCommitFiberUnmount(ir,v)}catch{}switch(v.tag){case 5:mo||bc(v,f);case 6:if(fe){var w=lo,k=Bs;lo=null,ba(c,f,v),lo=w,Bs=k,lo!==null&&(Bs?Ze(lo,v.stateNode):Me(lo,v.stateNode))}else ba(c,f,v);break;case 18:fe&&lo!==null&&(Bs?He(lo,v.stateNode):wt(lo,v.stateNode));break;case 4:fe?(w=lo,k=Bs,lo=v.stateNode.containerInfo,Bs=!0,ba(c,f,v),lo=w,Bs=k):(ge&&(w=v.stateNode.containerInfo,k=Ar(w),or(w,k)),ba(c,f,v));break;case 0:case 11:case 14:case 15:if(!mo&&(w=v.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){k=w=w.next;do{var E=k,L=E.destroy;E=E.tag,L!==void 0&&(E&2||E&4)&&nv(v,f,L),k=k.next}while(k!==w)}ba(c,f,v);break;case 1:if(!mo&&(bc(v,f),w=v.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=v.memoizedProps,w.state=v.memoizedState,w.componentWillUnmount()}catch(oe){fr(v,f,oe)}ba(c,f,v);break;case 21:ba(c,f,v);break;case 22:v.mode&1?(mo=(w=mo)||v.memoizedState!==null,ba(c,f,v),mo=w):ba(c,f,v);break;default:ba(c,f,v)}}function rw(c){var f=c.updateQueue;if(f!==null){c.updateQueue=null;var v=c.stateNode;v===null&&(v=c.stateNode=new kA),f.forEach(function(w){var k=DA.bind(null,c,w);v.has(w)||(v.add(w),w.then(k,k))})}}function Hs(c,f){var v=f.deletions;if(v!==null)for(var w=0;w";case hp:return":has("+(cv(c)||"")+")";case gp:return'[role="'+c.value+'"]';case xp:return'"'+c.value+'"';case vp:return'[data-testname="'+c.value+'"]';default:throw Error(i(365))}}function cw(c,f){var v=[];c=[c,0];for(var w=0;wk&&(k=L),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,10c?16:c,Ri===null)var w=!1;else{if(c=Ri,Ri=null,Sp=0,pn&6)throw Error(i(331));var k=pn;for(pn|=4,gt=c.current;gt!==null;){var E=gt,L=E.child;if(gt.flags&16){var oe=E.deletions;if(oe!==null){for(var he=0;heUe()-pv?wl(c,0):fv|=v),$o(c,f)}function xw(c,f){f===0&&(c.mode&1?(f=In,In<<=1,!(In&130023424)&&(In=4194304)):f=1);var v=ho();c=ha(c,f),c!==null&&(vt(c,f,v),$o(c,v))}function AA(c){var f=c.memoizedState,v=0;f!==null&&(v=f.retryLane),xw(c,v)}function DA(c,f){var v=0;switch(c.tag){case 13:var w=c.stateNode,k=c.memoizedState;k!==null&&(v=k.retryLane);break;case 19:w=c.stateNode;break;default:throw Error(i(314))}w!==null&&w.delete(f),xw(c,v)}var bw;bw=function(c,f,v){if(c!==null)if(c.memoizedProps!==f.pendingProps||vn.current)To=!0;else{if(!(c.lanes&v)&&!(f.flags&128))return To=!1,CA(c,f,v);To=!!(c.flags&131072)}else To=!1,dr&&f.flags&1048576&&X2(f,So,f.index);switch(f.lanes=0,f.tag){case 2:var w=f.type;cp(c,f),c=f.pendingProps;var k=Fr(f,Jt.current);mc(f,v),k=H0(null,f,w,c,k,v);var E=W0();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,A0(f),k.updater=ep,f.stateNode=k,k._reactInternals=f,T0(f,w,c,v),f=Y0(null,f,w,!0,E,v)):(f.tag=0,dr&&E&&S0(f),_o(null,f,k,v),f=f.child),f;case 16:w=f.elementType;e:{switch(cp(c,f),c=f.pendingProps,k=w._init,w=k(w._payload),f.type=w,k=f.tag=NA(w),c=Fs(w,c),k){case 0:f=X0(null,f,w,c,v);break e;case 1:f=UC(null,f,w,c,v);break e;case 11:f=FC(null,f,w,c,v);break e;case 14:f=BC(null,f,w,Fs(w.type,c),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),X0(c,f,w,k,v);case 1:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),UC(c,f,w,k,v);case 3:e:{if(GC(f),c===null)throw Error(i(387));w=f.pendingProps,E=f.memoizedState,k=E.element,rC(c,f),Zf(f,w,null,v);var L=f.memoizedState;if(w=L.element,_e&&E.isDehydrated)if(E={element:w,isDehydrated:!1,cache:L.cache,pendingSuspenseBoundaries:L.pendingSuspenseBoundaries,transitions:L.transitions},f.updateQueue.baseState=E,f.memoizedState=E,f.flags&256){k=xc(Error(i(423)),f),f=qC(c,f,w,v,k);break e}else if(w!==k){k=xc(Error(i(424)),f),f=qC(c,f,w,v,k);break e}else for(_e&&(fs=ae(f.stateNode.containerInfo),Zo=f,dr=!0,zs=null,Qu=!1),v=fC(f,null,w,v),f.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(fc(),w===k){f=Qa(c,f,v);break e}_o(c,f,w,v)}f=f.child}return f;case 5:return pC(f),c===null&&_0(f),w=f.type,k=f.pendingProps,E=c!==null?c.memoizedProps:null,L=k.children,K(w,k)?L=null:E!==null&&K(w,E)&&(f.flags|=32),VC(c,f),_o(c,f,L,v),f.child;case 6:return c===null&&_0(f),null;case 13:return KC(c,f,v);case 4:return N0(f,f.stateNode.containerInfo),w=f.pendingProps,c===null?f.child=hc(f,null,w,v):_o(c,f,w,v),f.child;case 11:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),FC(c,f,w,k,v);case 7:return _o(c,f,f.pendingProps,v),f.child;case 8:return _o(c,f,f.pendingProps.children,v),f.child;case 12:return _o(c,f,f.pendingProps.children,v),f.child;case 10:e:{if(w=f.type._context,k=f.pendingProps,E=f.memoizedProps,L=k.value,tC(f,w,L),E!==null)if(bn(E.value,L)){if(E.children===k.children&&!vn.current){f=Qa(c,f,v);break e}}else for(E=f.child,E!==null&&(E.return=f);E!==null;){var oe=E.dependencies;if(oe!==null){L=E.child;for(var he=oe.firstContext;he!==null;){if(he.context===w){if(E.tag===1){he=Ka(-1,v&-v),he.tag=2;var Fe=E.updateQueue;if(Fe!==null){Fe=Fe.shared;var xt=Fe.pending;xt===null?he.next=he:(he.next=xt.next,xt.next=he),Fe.pending=he}}E.lanes|=v,he=E.alternate,he!==null&&(he.lanes|=v),O0(E.return,v,f),oe.lanes|=v;break}he=he.next}}else if(E.tag===10)L=E.type===f.type?null:E.child;else if(E.tag===18){if(L=E.return,L===null)throw Error(i(341));L.lanes|=v,oe=L.alternate,oe!==null&&(oe.lanes|=v),O0(L,v,f),L=E.sibling}else L=E.child;if(L!==null)L.return=E;else for(L=E;L!==null;){if(L===f){L=null;break}if(E=L.sibling,E!==null){E.return=L.return,L=E;break}L=L.return}E=L}_o(c,f,k.children,v),f=f.child}return f;case 9:return k=f.type,w=f.pendingProps.children,mc(f,v),k=ps(k),w=w(k),f.flags|=1,_o(c,f,w,v),f.child;case 14:return w=f.type,k=Fs(w,f.pendingProps),k=Fs(w.type,k),BC(c,f,w,k,v);case 15:return HC(c,f,f.type,f.pendingProps,v);case 17:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),cp(c,f),f.tag=1,cr(w)?(c=!0,ur(f)):c=!1,mc(f,v),lC(f,w,k),T0(f,w,k,v),Y0(null,f,w,!0,c,v);case 19:return XC(c,f,v);case 22:return WC(c,f,v)}throw Error(i(156,f.tag))};function yw(c,f){return Ve(c,f)}function TA(c,f,v,w){this.tag=c,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(c,f,v,w){return new TA(c,f,v,w)}function Cv(c){return c=c.prototype,!(!c||!c.isReactComponent)}function NA(c){if(typeof c=="function")return Cv(c)?1:0;if(c!=null){if(c=c.$$typeof,c===b)return 11;if(c===j)return 14}return 2}function Ti(c,f){var v=c.alternate;return v===null?(v=vs(c.tag,f,c.key,c.mode),v.elementType=c.elementType,v.type=c.type,v.stateNode=c.stateNode,v.alternate=c,c.alternate=v):(v.pendingProps=f,v.type=c.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=c.flags&14680064,v.childLanes=c.childLanes,v.lanes=c.lanes,v.child=c.child,v.memoizedProps=c.memoizedProps,v.memoizedState=c.memoizedState,v.updateQueue=c.updateQueue,f=c.dependencies,v.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},v.sibling=c.sibling,v.index=c.index,v.ref=c.ref,v}function Ip(c,f,v,w,k,E){var L=2;if(w=c,typeof c=="function")Cv(c)&&(L=1);else if(typeof c=="string")L=5;else e:switch(c){case m:return jl(v.children,k,E,f);case h:L=8,k|=8;break;case g:return c=vs(12,v,f,k|2),c.elementType=g,c.lanes=E,c;case C:return c=vs(13,v,f,k),c.elementType=C,c.lanes=E,c;case S:return c=vs(19,v,f,k),c.elementType=S,c.lanes=E,c;case P:return Pp(v,k,E,f);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case x:L=10;break e;case y:L=9;break e;case b:L=11;break e;case j:L=14;break e;case _:L=16,w=null;break e}throw Error(i(130,c==null?c:typeof c,""))}return f=vs(L,v,f,k),f.elementType=c,f.type=w,f.lanes=E,f}function jl(c,f,v,w){return c=vs(7,c,w,f),c.lanes=v,c}function Pp(c,f,v,w){return c=vs(22,c,w,f),c.elementType=P,c.lanes=v,c.stateNode={isHidden:!1},c}function wv(c,f,v){return c=vs(6,c,null,f),c.lanes=v,c}function Sv(c,f,v){return f=vs(4,c.children!==null?c.children:[],c.key,f),f.lanes=v,f.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},f}function $A(c,f,v,w,k){this.tag=f,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Z,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,_e&&(this.mutableSourceEagerHydrationData=null)}function Cw(c,f,v,w,k,E,L,oe,he){return c=new $A(c,f,v,oe,he),f===1?(f=1,E===!0&&(f|=8)):f=0,E=vs(3,null,null,f),c.current=E,E.stateNode=c,E.memoizedState={element:w,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},A0(E),c}function ww(c){if(!c)return Nn;c=c._reactInternals;e:{if(D(c)!==c||c.tag!==1)throw Error(i(170));var f=c;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(c.tag===1){var v=c.type;if(cr(v))return Hn(c,v,f)}return f}function Sw(c){var f=c._reactInternals;if(f===void 0)throw typeof c.render=="function"?Error(i(188)):(c=Object.keys(c).join(","),Error(i(268,c)));return c=Y(f),c===null?null:c.stateNode}function kw(c,f){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var v=c.retryLane;c.retryLane=v!==0&&v=Fe&&E>=nn&&k<=xt&&L<=ut){c.splice(f,1);break}else if(w!==Fe||v.width!==he.width||utL){if(!(E!==nn||v.height!==he.height||xtk)){Fe>w&&(he.width+=Fe-w,he.x=w),xtE&&(he.height+=nn-E,he.y=E),utv&&(v=L)),L ")+` No matching component was found for: `)+c.join(" > ")}return null},n.getPublicRootInstance=function(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return q(c.child.stateNode);default:return c.child.stateNode}},n.injectIntoDevTools=function(c){if(c={bundleType:c.bundleType,version:c.version,rendererPackageName:c.rendererPackageName,rendererConfig:c.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:LA,findFiberByHostInstance:c.findFiberByHostInstance||zA,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")c=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)c=!0;else{try{ir=f.inject(c),Sn=f}catch{}c=!!f.checkDCE}}return c},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(c,f,v,w){if(!tt)throw Error(i(363));c=uv(c,f);var k=Ut(c,v,w).disconnect;return{disconnect:function(){k()}}},n.registerMutableSourceForHydration=function(c,f){var v=f._getVersion;v=v(f._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[f,v]:c.mutableSourceEagerHydrationData.push(f,v)},n.runWithPriority=function(c,f){var v=Re;try{return Re=c,f()}finally{Re=v}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(c,f,v,w){var k=f.current,E=ho(),L=Ai(k);return v=ww(v),f.context===null?f.context=v:f.pendingContext=v,f=Ka(E,L),f.payload={element:c},w=w===void 0?null:w,w!==null&&(f.callback=w),c=Mi(k,f,L),c!==null&&(gs(c,k,L,E),Jf(c,k,L)),L},n};XR.exports=n0e;var r0e=XR.exports;const o0e=pf(r0e);var YR={exports:{}},dc={};/** * @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. */dc.ConcurrentRoot=1;dc.ContinuousEventPriority=4;dc.DefaultEventPriority=16;dc.DiscreteEventPriority=1;dc.IdleEventPriority=536870912;dc.LegacyRoot=0;YR.exports=dc;var JR=YR.exports;const nI={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let rI=!1,oI=!1;const q2=".react-konva-event",s0e=`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 `,a0e=`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 `,i0e={};function w0(e,t,n=i0e){if(!rI&&"zIndex"in t&&(console.warn(a0e),rI=!0),!oI&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(s0e),oI=!0)}for(var s in n)if(!nI[s]){var i=s.slice(0,2)==="on",l=n[s]!==t[s];if(i&&l){var u=s.substr(2).toLowerCase();u.substr(0,7)==="content"&&(u="content"+u.substr(7,1).toUpperCase()+u.substr(8)),e.off(u,n[s])}var p=!t.hasOwnProperty(s);p&&e.setAttr(s,void 0)}var m=t._useStrictMode,h={},g=!1;const x={};for(var s in t)if(!nI[s]){var i=s.slice(0,2)==="on",y=n[s]!==t[s];if(i&&y){var u=s.substr(2).toLowerCase();u.substr(0,7)==="content"&&(u="content"+u.substr(7,1).toUpperCase()+u.substr(8)),t[s]&&(x[u]=t[s])}!i&&(t[s]!==n[s]||m&&t[s]!==e.getAttr(s))&&(g=!0,h[s]=t[s])}g&&(e.setAttrs(h),vl(e));for(var u in x)e.on(u+q2,x[u])}function vl(e){if(!u9.Konva.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const ZR={},l0e={};df.Node.prototype._applyProps=w0;function c0e(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),vl(e)}function u0e(e,t,n){let r=df[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=df.Group);const o={},s={};for(var i in t){var l=i.slice(0,2)==="on";l?s[i]=t[i]:o[i]=t[i]}const u=new r(o);return w0(u,s),u}function d0e(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function f0e(e,t,n){return!1}function p0e(e){return e}function m0e(){return null}function h0e(){return null}function g0e(e,t,n,r){return l0e}function v0e(){}function x0e(e){}function b0e(e,t){return!1}function y0e(){return ZR}function C0e(){return ZR}const w0e=setTimeout,S0e=clearTimeout,k0e=-1;function j0e(e,t){return!1}const _0e=!1,I0e=!0,P0e=!0;function E0e(e,t){t.parent===e?t.moveToTop():e.add(t),vl(e)}function M0e(e,t){t.parent===e?t.moveToTop():e.add(t),vl(e)}function eA(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),vl(e)}function O0e(e,t,n){eA(e,t,n)}function R0e(e,t){t.destroy(),t.off(q2),vl(e)}function A0e(e,t){t.destroy(),t.off(q2),vl(e)}function D0e(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function T0e(e,t,n){}function N0e(e,t,n,r,o){w0(e,o,r)}function $0e(e){e.hide(),vl(e)}function L0e(e){}function z0e(e,t){(t.visible==null||t.visible)&&e.show()}function F0e(e,t){}function B0e(e){}function H0e(){}const W0e=()=>JR.DefaultEventPriority,V0e=Object.freeze(Object.defineProperty({__proto__:null,appendChild:E0e,appendChildToContainer:M0e,appendInitialChild:c0e,cancelTimeout:S0e,clearContainer:B0e,commitMount:T0e,commitTextUpdate:D0e,commitUpdate:N0e,createInstance:u0e,createTextInstance:d0e,detachDeletedInstance:H0e,finalizeInitialChildren:f0e,getChildHostContext:C0e,getCurrentEventPriority:W0e,getPublicInstance:p0e,getRootHostContext:y0e,hideInstance:$0e,hideTextInstance:L0e,idlePriority:xm.unstable_IdlePriority,insertBefore:eA,insertInContainerBefore:O0e,isPrimaryRenderer:_0e,noTimeout:k0e,now:xm.unstable_now,prepareForCommit:m0e,preparePortalMount:h0e,prepareUpdate:g0e,removeChild:R0e,removeChildFromContainer:A0e,resetAfterCommit:v0e,resetTextContent:x0e,run:xm.unstable_runWithPriority,scheduleTimeout:w0e,shouldDeprioritizeSubtree:b0e,shouldSetTextContent:j0e,supportsMutation:P0e,unhideInstance:z0e,unhideTextInstance:F0e,warnsIfNotActing:I0e},Symbol.toStringTag,{value:"Module"}));var U0e=Object.defineProperty,G0e=Object.defineProperties,q0e=Object.getOwnPropertyDescriptors,sI=Object.getOwnPropertySymbols,K0e=Object.prototype.hasOwnProperty,Q0e=Object.prototype.propertyIsEnumerable,aI=(e,t,n)=>t in e?U0e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,iI=(e,t)=>{for(var n in t||(t={}))K0e.call(t,n)&&aI(e,n,t[n]);if(sI)for(var n of sI(t))Q0e.call(t,n)&&aI(e,n,t[n]);return e},X0e=(e,t)=>G0e(e,q0e(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 K2=nA(d.createContext(null));class rA extends d.Component{render(){return d.createElement(K2.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:lI,ReactCurrentDispatcher:cI}=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Y0e(){const e=d.useContext(K2);if(e===null)throw new Error("its-fine: useFiber must be called within a !");const t=d.useId();return d.useMemo(()=>{for(const r of[lI==null?void 0:lI.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 J0e(){var e,t;const n=Y0e(),[r]=d.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==K2&&!r.has(s)&&r.set(s,(t=cI==null?void 0:cI.current)==null?void 0:t.readContext(nA(s))),o=o.return}return r}function Z0e(){const e=J0e();return d.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>d.createElement(t,null,d.createElement(n.Provider,X0e(iI({},r),{value:e.get(n)}))),t=>d.createElement(rA,iI({},t))),[e])}function eve(e){const t=H.useRef({});return H.useLayoutEffect(()=>{t.current=e}),H.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}const tve=e=>{const t=H.useRef(),n=H.useRef(),r=H.useRef(),o=eve(e),s=Z0e(),i=l=>{const{forwardedRef:u}=e;u&&(typeof u=="function"?u(l):u.current=l)};return H.useLayoutEffect(()=>(n.current=new df.Stage({width:e.width,height:e.height,container:t.current}),i(n.current),r.current=Ed.createContainer(n.current,JR.LegacyRoot,!1,null),Ed.updateContainer(H.createElement(s,{},e.children),r.current),()=>{df.isBrowser&&(i(null),Ed.updateContainer(null,r.current,null),n.current.destroy())}),[]),H.useLayoutEffect(()=>{i(n.current),w0(n.current,e,o),Ed.updateContainer(H.createElement(s,{},e.children),r.current,null)}),H.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})},Sd="Layer",La="Group",za="Rect",_l="Circle",Zh="Line",oA="Image",nve="Text",rve="Transformer",Ed=o0e(V0e);Ed.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:H.version,rendererPackageName:"react-konva"});const ove=H.forwardRef((e,t)=>H.createElement(rA,{},H.createElement(tve,{...e,forwardedRef:t}))),sve=ce([jr,Ns],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),ave=()=>{const e=te(),{tool:t,isStaging:n,isMovingBoundingBox:r}=W(sve);return{handleDragStart:d.useCallback(()=>{(t==="move"||n)&&!r&&e(Hm(!0))},[e,r,n,t]),handleDragMove:d.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(yP(s))},[e,r,n,t]),handleDragEnd:d.useCallback(()=>{(t==="move"||n)&&!r&&e(Hm(!1))},[e,r,n,t])}},ive=ce([jr,ro,Ns],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isMaskEnabled:l,shouldSnapToGrid:u}=e;return{activeTabName:t,isCursorOnCanvas:!!r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isStaging:n,isMaskEnabled:l,shouldSnapToGrid:u}},{memoizeOptions:{resultEqualityCheck:Tn}}),lve=()=>{const e=te(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:i}=W(ive),l=d.useRef(null),u=CP(),p=()=>e(wP());It(["shift+c"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[]);const m=()=>e(Fb(!s));It(["h"],()=>{m()},{enabled:()=>!o,preventDefault:!0},[s]),It(["n"],()=>{e(Wm(!i))},{enabled:!0,preventDefault:!0},[i]),It("esc",()=>{e(d9())},{enabled:()=>!0,preventDefault:!0}),It("shift+h",()=>{e(f9(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),It(["space"],h=>{h.repeat||(u==null||u.container().focus(),r!=="move"&&(l.current=r,e(Jc("move"))),r==="move"&&l.current&&l.current!=="move"&&(e(Jc(l.current)),l.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,l])},Q2=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=te(),t=V1(),n=CP();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=p9.pixelRatio,[s,i,l,u]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;s===void 0||i===void 0||l===void 0||u===void 0||e(m9({r:s,g:i,b:l,a:u}))},commitColorUnderCursor:()=>{e(h9())}}},cve=ce([ro,jr,Ns],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),uve=e=>{const t=te(),{tool:n,isStaging:r}=W(cve),{commitColorUnderCursor:o}=sA();return d.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Hm(!0));return}if(n==="colorPicker"){o();return}const i=Q2(e.current);i&&(s.evt.preventDefault(),t(SP(!0)),t(g9([i.x,i.y])))},[e,n,r,t,o])},dve=ce([ro,jr,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,n)=>{const r=te(),{isDrawing:o,tool:s,isStaging:i}=W(dve),{updateColorUnderCursor:l}=sA();return d.useCallback(()=>{if(!e.current)return;const u=Q2(e.current);if(u){if(r(v9(u)),n.current=u,s==="colorPicker"){l();return}!o||s==="move"||i||(t.current=!0,r(kP([u.x,u.y])))}},[t,r,o,i,n,e,s,l])},pve=()=>{const e=te();return d.useCallback(()=>{e(x9())},[e])},mve=ce([ro,jr,Ns],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),hve=(e,t)=>{const n=te(),{tool:r,isDrawing:o,isStaging:s}=W(mve);return d.useCallback(()=>{if(r==="move"||s){n(Hm(!1));return}if(!t.current&&o&&e.current){const i=Q2(e.current);if(!i)return;n(kP([i.x,i.y]))}else t.current=!1;n(SP(!1))},[t,n,o,s,e,r])},gve=ce([jr],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),vve=e=>{const t=te(),{isMoveStageKeyHeld:n,stageScale:r}=W(gve);return d.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 l=o.evt.deltaY;o.evt.ctrlKey&&(l=-l);const u=Fl(r*C9**l,y9,b9),p={x:s.x-i.x*u,y:s.y-i.y*u};t(w9(u)),t(yP(p))},[e,n,r,t])},xve=ce(jr,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}}),bve=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=W(xve);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"})]})},yve=d.memo(bve),Cve=ce([jr],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),wve=()=>{const{stageScale:e,stageCoordinates:t,stageDimensions:n}=W(Cve),{colorMode:r}=Ci(),[o,s]=d.useState([]),[i,l]=Ks("colors",["base.800","base.200"]),u=d.useCallback(p=>p/e,[e]);return d.useLayoutEffect(()=>{const{width:p,height:m}=n,{x:h,y:g}=t,x={x1:0,y1:0,x2:p,y2:m,offset:{x:u(h),y:u(g)}},y={x:Math.ceil(u(h)/64)*64,y:Math.ceil(u(g)/64)*64},b={x1:-y.x,y1:-y.y,x2:u(p)-y.x+64,y2:u(m)-y.y+64},S={x1:Math.min(x.x1,b.x1),y1:Math.min(x.y1,b.y1),x2:Math.max(x.x2,b.x2),y2:Math.max(x.y2,b.y2)},j=S.x2-S.x1,_=S.y2-S.y1,P=Math.round(j/64)+1,I=Math.round(_/64)+1,M=uS(0,P).map(A=>a.jsx(Zh,{x:S.x1+A*64,y:S.y1,points:[0,0,0,_],stroke:r==="dark"?i:l,strokeWidth:1},`x_${A}`)),O=uS(0,I).map(A=>a.jsx(Zh,{x:S.x1,y:S.y1+A*64,points:[0,0,j,0],stroke:r==="dark"?i:l,strokeWidth:1},`y_${A}`));s(M.concat(O))},[e,t,n,u,r,i,l]),a.jsx(La,{children:o})},Sve=d.memo(wve),kve=ce([we],({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}}),jve=e=>{const{...t}=e,{progressImage:n,boundingBox:r}=W(kve),[o,s]=d.useState(null);return d.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},_ve=d.memo(jve),zl=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},Ive=ce(jr,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:zl(t)}}),uI=e=>`data:image/svg+xml;utf8, `.replaceAll("black",e),Pve=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=W(Ive),[i,l]=d.useState(null),[u,p]=d.useState(0),m=d.useRef(null),h=d.useCallback(()=>{p(u+1),setTimeout(h,500)},[u]);return d.useEffect(()=>{if(i)return;const g=new Image;g.onload=()=>{l(g)},g.src=uI(n)},[i,n]),d.useEffect(()=>{i&&(i.src=uI(n))},[i,n]),d.useEffect(()=>{const g=setInterval(()=>p(x=>(x+1)%5),50);return()=>clearInterval(g)},[]),!i||!kc(r.x)||!kc(r.y)||!kc(s)||!kc(o.width)||!kc(o.height)?null:a.jsx(za,{ref:m,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:i,fillPatternOffsetY:kc(u)?u:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},Eve=d.memo(Pve),Mve=ce([jr],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:Tn}}),Ove=e=>{const{...t}=e,{objects:n}=W(Mve);return a.jsx(La,{listening:!1,...t,children:n.filter(S9).map((r,o)=>a.jsx(Zh,{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))})},Rve=d.memo(Ove);var Il=d,Ave=function(t,n,r){const o=Il.useRef("loading"),s=Il.useRef(),[i,l]=Il.useState(0),u=Il.useRef(),p=Il.useRef(),m=Il.useRef();return(u.current!==t||p.current!==n||m.current!==r)&&(o.current="loading",s.current=void 0,u.current=t,p.current=n,m.current=r),Il.useLayoutEffect(function(){if(!t)return;var h=document.createElement("img");function g(){o.current="loaded",s.current=h,l(Math.random())}function x(){o.current="failed",s.current=void 0,l(Math.random())}return h.addEventListener("load",g),h.addEventListener("error",x),n&&(h.crossOrigin=n),r&&(h.referrerPolicy=r),h.src=t,function(){h.removeEventListener("load",g),h.removeEventListener("error",x)}},[t,n,r]),[s.current,o.current]};const Dve=pf(Ave),Tve=({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:l}=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(nve,{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:l("common.imageFailedToLoad"),fill:i})]})},Nve=d.memo(Tve),$ve=e=>{const{x:t,y:n,imageName:r}=e.canvasImage,{currentData:o,isError:s}=Ps(r??Os.skipToken),[i,l]=Dve((o==null?void 0:o.image_url)??"",HI.get()?"use-credentials":"anonymous");return s||l==="failed"?a.jsx(Nve,{canvasImage:e.canvasImage}):a.jsx(oA,{x:t,y:n,image:i,listening:!1})},aA=d.memo($ve),Lve=ce([jr],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:Tn}}),zve=()=>{const{objects:e}=W(Lve);return e?a.jsx(La,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(k9(t))return a.jsx(aA,{canvasImage:t},n);if(j9(t)){const r=a.jsx(Zh,{points:t.points,stroke:t.color?zl(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(_9(t))return a.jsx(za,{x:t.x,y:t.y,width:t.width,height:t.height,fill:zl(t.color)},n);if(I9(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},Fve=d.memo(zve),Bve=ce([jr],e=>{const{layerState:t,shouldShowStagingImage:n,shouldShowStagingOutline:r,boundingBoxCoordinates:o,boundingBoxDimensions:s}=e,{selectedImageIndex:i,images:l,boundingBox:u}=t.stagingArea;return{currentStagingAreaImage:l.length>0&&i!==void 0?l[i]:void 0,isOnFirstImage:i===0,isOnLastImage:i===l.length-1,shouldShowStagingImage:n,shouldShowStagingOutline:r,x:(u==null?void 0:u.x)??o.x,y:(u==null?void 0:u.y)??o.y,width:(u==null?void 0:u.width)??s.width,height:(u==null?void 0:u.height)??s.height}},{memoizeOptions:{resultEqualityCheck:Tn}}),Hve=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:i,width:l,height:u}=W(Bve);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:l,height:u,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),a.jsx(za,{x:s,y:i,width:l,height:u,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},Wve=d.memo(Hve),Vve=ce([jr],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}},je),Uve=()=>{const e=te(),{currentStagingAreaImage:t,shouldShowStagingImage:n,currentIndex:r,total:o}=W(Vve),{t:s}=J(),i=d.useCallback(()=>{e(dS(!0))},[e]),l=d.useCallback(()=>{e(dS(!1))},[e]),u=d.useCallback(()=>e(P9()),[e]),p=d.useCallback(()=>e(E9()),[e]),m=d.useCallback(()=>e(M9()),[e]);It(["left"],u,{enabled:()=>!0,preventDefault:!0}),It(["right"],p,{enabled:()=>!0,preventDefault:!0}),It(["enter"],()=>m,{enabled:()=>!0,preventDefault:!0});const{data:h}=Ps((t==null?void 0:t.imageName)??Os.skipToken),g=d.useCallback(()=>{e(O9(!n))},[e,n]),x=d.useCallback(()=>{h&&e(R9({imageDTO:h}))},[e,h]),y=d.useCallback(()=>{e(A9())},[e]);return t?a.jsxs($,{pos:"absolute",bottom:4,gap:2,w:"100%",align:"center",justify:"center",onMouseEnter:i,onMouseLeave:l,children:[a.jsxs(zn,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(ot,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:a.jsx(JZ,{}),onClick:u,colorScheme:"accent",isDisabled:!n}),a.jsx(Mt,{colorScheme:"base",pointerEvents:"none",isDisabled:!n,minW:20,children:`${r+1}/${o}`}),a.jsx(ot,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:a.jsx(ZZ,{}),onClick:p,colorScheme:"accent",isDisabled:!n})]}),a.jsxs(zn,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(ot,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:a.jsx(FM,{}),onClick:m,colorScheme:"accent"}),a.jsx(ot,{tooltip:s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"aria-label":s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"data-alert":!n,icon:n?a.jsx(fee,{}):a.jsx(dee,{}),onClick:g,colorScheme:"accent"}),a.jsx(ot,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),isDisabled:!h||!h.is_intermediate,icon:a.jsx(Gg,{}),onClick:x,colorScheme:"accent"}),a.jsx(ot,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:a.jsx(wu,{}),onClick:y,colorScheme:"error",fontSize:20})]})]}):null},Gve=d.memo(Uve),qve=()=>{const e=W(l=>l.canvas.layerState),t=W(l=>l.canvas.boundingBoxCoordinates),n=W(l=>l.canvas.boundingBoxDimensions),r=W(l=>l.canvas.isMaskEnabled),o=W(l=>l.canvas.shouldPreserveMaskedArea),[s,i]=d.useState();return d.useEffect(()=>{i(void 0)},[e,t,n,r,o]),Lee(async()=>{const l=await D9(e,t,n,r,o);if(!l)return;const{baseImageData:u,maskImageData:p}=l,m=T9(u,p);i(m)},1e3,[e,t,n,r,o]),s},Kve={txt2img:"Text to Image",img2img:"Image to Image",inpaint:"Inpaint",outpaint:"Inpaint"},Qve=()=>{const e=qve();return a.jsxs(De,{children:["Mode: ",e?Kve[e]:"..."]})},Xve=d.memo(Qve),Xc=e=>Math.round(e*100)/100,Yve=ce([jr],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 Jve(){const{cursorCoordinatesString:e}=W(Yve),{t}=J();return a.jsx(De,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const cb="var(--invokeai-colors-warning-500)",Zve=ce([jr],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:i},scaledBoundingBoxDimensions:{width:l,height:u},boundingBoxCoordinates:{x:p,y:m},stageScale:h,shouldShowCanvasDebugInfo:g,layer:x,boundingBoxScaleMethod:y,shouldPreserveMaskedArea:b}=e;let C="inherit";return(y==="none"&&(s<512||i<512)||y==="manual"&&l*u<512*512)&&(C=cb),{activeLayerColor:x==="mask"?cb:"inherit",layer:x,boundingBoxColor:C,boundingBoxCoordinatesString:`(${Xc(p)}, ${Xc(m)})`,boundingBoxDimensionsString:`${s}×${i}`,scaledBoundingBoxDimensionsString:`${l}×${u}`,canvasCoordinatesString:`${Xc(r)}×${Xc(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(h*100),shouldShowCanvasDebugInfo:g,shouldShowBoundingBox:y!=="auto",shouldShowScaledBoundingBox:y!=="none",shouldPreserveMaskedArea:b}},{memoizeOptions:{resultEqualityCheck:Tn}}),e1e=()=>{const{activeLayerColor:e,layer:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:i,canvasCoordinatesString:l,canvasDimensionsString:u,canvasScaleString:p,shouldShowCanvasDebugInfo:m,shouldShowBoundingBox:h,shouldPreserveMaskedArea:g}=W(Zve),{t:x}=J();return a.jsxs($,{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(Xve,{}),a.jsx(De,{style:{color:e},children:`${x("unifiedCanvas.activeLayer")}: ${x(`unifiedCanvas.${t}`)}`}),a.jsx(De,{children:`${x("unifiedCanvas.canvasScale")}: ${p}%`}),g&&a.jsxs(De,{style:{color:cb},children:[x("unifiedCanvas.preserveMaskedArea"),": ",x("common.on")]}),h&&a.jsx(De,{style:{color:n},children:`${x("unifiedCanvas.boundingBox")}: ${o}`}),i&&a.jsx(De,{style:{color:n},children:`${x("unifiedCanvas.scaledBoundingBox")}: ${s}`}),m&&a.jsxs(a.Fragment,{children:[a.jsx(De,{children:`${x("unifiedCanvas.boundingBoxPosition")}: ${r}`}),a.jsx(De,{children:`${x("unifiedCanvas.canvasDimensions")}: ${u}`}),a.jsx(De,{children:`${x("unifiedCanvas.canvasPosition")}: ${l}`}),a.jsx(Jve,{})]})]})},t1e=d.memo(e1e),n1e=ce([we],({canvas:e,generation:t})=>{const{boundingBoxCoordinates:n,boundingBoxDimensions:r,stageScale:o,isDrawing:s,isTransformingBoundingBox:i,isMovingBoundingBox:l,tool:u,shouldSnapToGrid:p}=e,{aspectRatio:m}=t;return{boundingBoxCoordinates:n,boundingBoxDimensions:r,isDrawing:s,isMovingBoundingBox:l,isTransformingBoundingBox:i,stageScale:o,shouldSnapToGrid:p,tool:u,hitStrokeWidth:20/o,aspectRatio:m}},{memoizeOptions:{resultEqualityCheck:Tn}}),r1e=e=>{const{...t}=e,n=te(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:i,isTransformingBoundingBox:l,stageScale:u,shouldSnapToGrid:p,tool:m,hitStrokeWidth:h,aspectRatio:g}=W(n1e),x=d.useRef(null),y=d.useRef(null),[b,C]=d.useState(!1);d.useEffect(()=>{var F;!x.current||!y.current||(x.current.nodes([y.current]),(F=x.current.getLayer())==null||F.batchDraw())},[]);const S=64*u;It("N",()=>{n(Wm(!p))});const j=d.useCallback(F=>{if(!p){n(Ev({x:Math.floor(F.target.x()),y:Math.floor(F.target.y())}));return}const V=F.target.x(),Q=F.target.y(),q=Gr(V,64),z=Gr(Q,64);F.target.x(q),F.target.y(z),n(Ev({x:q,y:z}))},[n,p]),_=d.useCallback(()=>{if(!y.current)return;const F=y.current,V=F.scaleX(),Q=F.scaleY(),q=Math.round(F.width()*V),z=Math.round(F.height()*Q),G=Math.round(F.x()),T=Math.round(F.y());if(g){const B=Gr(q/g,64);n(Xs({width:q,height:B}))}else n(Xs({width:q,height:z}));n(Ev({x:p?kd(G,64):G,y:p?kd(T,64):T})),F.scaleX(1),F.scaleY(1)},[n,p,g]),P=d.useCallback((F,V,Q)=>{const q=F.x%S,z=F.y%S;return{x:kd(V.x,S)+q,y:kd(V.y,S)+z}},[S]),I=d.useCallback(()=>{n(Mv(!0))},[n]),M=d.useCallback(()=>{n(Mv(!1)),n(Ov(!1)),n(Dp(!1)),C(!1)},[n]),O=d.useCallback(()=>{n(Ov(!0))},[n]),A=d.useCallback(()=>{n(Mv(!1)),n(Ov(!1)),n(Dp(!1)),C(!1)},[n]),D=d.useCallback(()=>{C(!0)},[]),R=d.useCallback(()=>{!l&&!i&&C(!1)},[i,l]),N=d.useCallback(()=>{n(Dp(!0))},[n]),Y=d.useCallback(()=>{n(Dp(!1))},[n]);return a.jsxs(La,{...t,children:[a.jsx(za,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:N,onMouseOver:N,onMouseLeave:Y,onMouseOut:Y}),a.jsx(za,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:h,listening:!s&&m==="move",onDragStart:O,onDragEnd:A,onDragMove:j,onMouseDown:O,onMouseOut:R,onMouseOver:D,onMouseEnter:D,onMouseUp:A,onTransform:_,onTransformEnd:M,ref:y,stroke:b?"rgba(255,255,255,0.7)":"white",strokeWidth:(b?8:1)/u,width:o.width,x:r.x,y:r.y}),a.jsx(rve,{anchorCornerRadius:3,anchorDragBoundFunc:P,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:m==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&m==="move",onDragStart:O,onDragEnd:A,onMouseDown:I,onMouseUp:M,onTransformEnd:M,ref:x,rotateEnabled:!1})]})},o1e=d.memo(r1e),s1e=ce(jr,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:i,layer:l,shouldShowBrush:u,isMovingBoundingBox:p,isTransformingBoundingBox:m,stageScale:h,stageDimensions:g,boundingBoxCoordinates:x,boundingBoxDimensions:y,shouldRestrictStrokesToBox:b}=e,C=b?{clipX:x.x,clipY:x.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:fS/h,colorPickerInnerRadius:(fS-U1+1)/h,maskColorString:zl({...o,a:.5}),brushColorString:zl(s),colorPickerColorString:zl(r),tool:i,layer:l,shouldShowBrush:u,shouldDrawBrushPreview:!(p||m||!t)&&u,strokeWidth:1.5/h,dotRadius:1.5/h,clip:C}},{memoizeOptions:{resultEqualityCheck:Tn}}),a1e=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:i,layer:l,shouldDrawBrushPreview:u,dotRadius:p,strokeWidth:m,brushColorString:h,colorPickerColorString:g,colorPickerInnerRadius:x,colorPickerOuterRadius:y,clip:b}=W(s1e);return u?a.jsxs(La,{listening:!1,...b,...t,children:[i==="colorPicker"?a.jsxs(a.Fragment,{children:[a.jsx(_l,{x:n,y:r,radius:y,stroke:h,strokeWidth:U1,strokeScaleEnabled:!1}),a.jsx(_l,{x:n,y:r,radius:x,stroke:g,strokeWidth:U1,strokeScaleEnabled:!1})]}):a.jsxs(a.Fragment,{children:[a.jsx(_l,{x:n,y:r,radius:o,fill:l==="mask"?s:h,globalCompositeOperation:i==="eraser"?"destination-out":"source-out"}),a.jsx(_l,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:m*2,strokeEnabled:!0,listening:!1}),a.jsx(_l,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:m,strokeEnabled:!0,listening:!1})]}),a.jsx(_l,{x:n,y:r,radius:p*2,fill:"rgba(255,255,255,0.4)",listening:!1}),a.jsx(_l,{x:n,y:r,radius:p,fill:"rgba(0,0,0,1)",listening:!1})]}):null},i1e=d.memo(a1e),l1e=ce([jr,Ns],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:i,isMovingBoundingBox:l,stageDimensions:u,stageCoordinates:p,tool:m,isMovingStage:h,shouldShowIntermediates:g,shouldShowGrid:x,shouldRestrictStrokesToBox:y,shouldAntialias:b}=e;let C="none";return m==="move"||t?h?C="grabbing":C="grab":s?C=void 0:y&&!i&&(C="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||l,shouldShowBoundingBox:o,shouldShowGrid:x,stageCoordinates:p,stageCursor:C,stageDimensions:u,stageScale:r,tool:m,isStaging:t,shouldShowIntermediates:g,shouldAntialias:b}},je),c1e=Ee(ove,{shouldForwardProp:e=>!["sx"].includes(e)}),u1e=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:i,stageScale:l,tool:u,isStaging:p,shouldShowIntermediates:m,shouldAntialias:h}=W(l1e);lve();const g=te(),x=d.useRef(null),y=d.useRef(null),b=d.useRef(null),C=d.useCallback(F=>{N9(F),y.current=F},[]),S=d.useCallback(F=>{$9(F),b.current=F},[]),j=d.useRef({x:0,y:0}),_=d.useRef(!1),P=vve(y),I=uve(y),M=hve(y,_),O=fve(y,_,j),A=pve(),{handleDragStart:D,handleDragMove:R,handleDragEnd:N}=ave(),Y=d.useCallback(F=>F.evt.preventDefault(),[]);return d.useEffect(()=>{if(!x.current)return;const F=new ResizeObserver(q=>{for(const z of q)if(z.contentBoxSize){const{width:G,height:T}=z.contentRect;g(pS({width:G,height:T}))}});F.observe(x.current);const{width:V,height:Q}=x.current.getBoundingClientRect();return g(pS({width:V,height:Q})),()=>{F.disconnect()}},[g]),a.jsxs($,{id:"canvas-container",ref:x,sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:[a.jsx(De,{sx:{position:"absolute"},children:a.jsxs(c1e,{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:l,y:l},onTouchStart:I,onTouchMove:O,onTouchEnd:M,onMouseDown:I,onMouseLeave:A,onMouseMove:O,onMouseUp:M,onDragStart:D,onDragMove:R,onDragEnd:N,onContextMenu:Y,onWheel:P,draggable:(u==="move"||p)&&!t,children:[a.jsx(Sd,{id:"grid",visible:r,children:a.jsx(Sve,{})}),a.jsx(Sd,{id:"base",ref:S,listening:!1,imageSmoothingEnabled:h,children:a.jsx(Fve,{})}),a.jsxs(Sd,{id:"mask",visible:e&&!p,listening:!1,children:[a.jsx(Rve,{visible:!0,listening:!1}),a.jsx(Eve,{listening:!1})]}),a.jsx(Sd,{children:a.jsx(yve,{})}),a.jsxs(Sd,{id:"preview",imageSmoothingEnabled:h,children:[!p&&a.jsx(i1e,{visible:u!=="move",listening:!1}),a.jsx(Wve,{visible:p}),m&&a.jsx(_ve,{}),a.jsx(o1e,{visible:n&&!p})]})]})}),a.jsx(t1e,{}),a.jsx(Gve,{})]})},d1e=d.memo(u1e);function f1e(e,t,n=250){const[r,o]=d.useState(0);return d.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 O1={width:6,height:6,borderColor:"base.100"},p1e={".react-colorful__hue-pointer":O1,".react-colorful__saturation-pointer":O1,".react-colorful__alpha-pointer":O1},m1e=e=>a.jsx(De,{sx:p1e,children:a.jsx(nR,{...e})}),iA=d.memo(m1e),h1e=ce([jr,Ns],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:zl(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Tn}}),g1e=()=>{const e=te(),{t}=J(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:i}=W(h1e);It(["q"],()=>{l()},{enabled:()=>!i,preventDefault:!0},[n]),It(["shift+c"],()=>{u()},{enabled:()=>!i,preventDefault:!0},[]),It(["h"],()=>{p()},{enabled:()=>!i,preventDefault:!0},[o]);const l=()=>{e(jP(n==="mask"?"base":"mask"))},u=()=>e(wP()),p=()=>e(Fb(!o)),m=async()=>{e(F9())};return a.jsx(Hf,{triggerComponent:a.jsx(zn,{children:a.jsx(ot,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:a.jsx(KM,{}),isChecked:n==="mask",isDisabled:i})}),children:a.jsxs($,{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:h=>e(L9(h.target.checked))}),a.jsx(De,{sx:{paddingTop:2,paddingBottom:2},children:a.jsx(iA,{color:r,onChange:h=>e(z9(h))})}),a.jsx(Mt,{size:"sm",leftIcon:a.jsx(Gg,{}),onClick:m,children:"Save Mask"}),a.jsxs(Mt,{size:"sm",leftIcon:a.jsx(qo,{}),onClick:u,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},v1e=d.memo(g1e),x1e=ce([we,ro],({canvas:e},t)=>{const{futureLayerStates:n}=e;return{canRedo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Tn}});function b1e(){const e=te(),{canRedo:t,activeTabName:n}=W(x1e),{t:r}=J(),o=()=>{e(B9())};return It(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),a.jsx(ot,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:a.jsx(jee,{}),onClick:o,isDisabled:!t})}const y1e=()=>{const e=W(Ns),t=te(),{t:n}=J();return a.jsxs(c0,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(H9()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:a.jsx(Mt,{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")})]})},C1e=d.memo(y1e),w1e=ce([jr],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:l,shouldRestrictStrokesToBox:u,shouldAntialias:p}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:l,shouldRestrictStrokesToBox:u,shouldAntialias:p}},{memoizeOptions:{resultEqualityCheck:Tn}}),S1e=()=>{const e=te(),{t}=J(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:i,shouldShowIntermediates:l,shouldSnapToGrid:u,shouldRestrictStrokesToBox:p,shouldAntialias:m}=W(w1e);It(["n"],()=>{e(Wm(!u))},{enabled:!0,preventDefault:!0},[u]);const h=g=>e(Wm(g.target.checked));return a.jsx(Hf,{isLazy:!1,triggerComponent:a.jsx(ot,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:a.jsx(ZM,{})}),children:a.jsxs($,{direction:"column",gap:2,children:[a.jsx(Io,{label:t("unifiedCanvas.showIntermediates"),isChecked:l,onChange:g=>e(W9(g.target.checked))}),a.jsx(Io,{label:t("unifiedCanvas.showGrid"),isChecked:i,onChange:g=>e(V9(g.target.checked))}),a.jsx(Io,{label:t("unifiedCanvas.snapToGrid"),isChecked:u,onChange:h}),a.jsx(Io,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:g=>e(U9(g.target.checked))}),a.jsx(Io,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:g=>e(G9(g.target.checked))}),a.jsx(Io,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:g=>e(q9(g.target.checked))}),a.jsx(Io,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:p,onChange:g=>e(K9(g.target.checked))}),a.jsx(Io,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:g=>e(Q9(g.target.checked))}),a.jsx(Io,{label:t("unifiedCanvas.antialiasing"),isChecked:m,onChange:g=>e(X9(g.target.checked))}),a.jsx(C1e,{})]})})},k1e=d.memo(S1e),j1e=ce([we,Ns],({canvas:e},t)=>{const{tool:n,brushColor:r,brushSize:o}=e;return{tool:n,isStaging:t,brushColor:r,brushSize:o}},{memoizeOptions:{resultEqualityCheck:Tn}}),_1e=()=>{const e=te(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=W(j1e),{t:s}=J();It(["b"],()=>{i()},{enabled:()=>!o,preventDefault:!0},[]),It(["e"],()=>{l()},{enabled:()=>!o,preventDefault:!0},[t]),It(["c"],()=>{u()},{enabled:()=>!o,preventDefault:!0},[t]),It(["shift+f"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),It(["delete","backspace"],()=>{m()},{enabled:()=>!o,preventDefault:!0}),It(["BracketLeft"],()=>{r-5<=5?e(Tp(Math.max(r-1,1))):e(Tp(Math.max(r-5,1)))},{enabled:()=>!o,preventDefault:!0},[r]),It(["BracketRight"],()=>{e(Tp(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),It(["Shift+BracketLeft"],()=>{e(Rv({...n,a:Fl(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),It(["Shift+BracketRight"],()=>{e(Rv({...n,a:Fl(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const i=()=>e(Jc("brush")),l=()=>e(Jc("eraser")),u=()=>e(Jc("colorPicker")),p=()=>e(Y9()),m=()=>e(J9());return a.jsxs(zn,{isAttached:!0,children:[a.jsx(ot,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:a.jsx(Cee,{}),isChecked:t==="brush"&&!o,onClick:i,isDisabled:o}),a.jsx(ot,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:a.jsx(iee,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:l}),a.jsx(ot,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:a.jsx(pee,{}),isDisabled:o,onClick:p}),a.jsx(ot,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:a.jsx(Xi,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:m}),a.jsx(ot,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:a.jsx(uee,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:u}),a.jsx(Hf,{triggerComponent:a.jsx(ot,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:a.jsx(YM,{})}),children:a.jsxs($,{minWidth:60,direction:"column",gap:4,width:"100%",children:[a.jsx($,{gap:4,justifyContent:"space-between",children:a.jsx(jt,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:h=>e(Tp(h)),sliderNumberInputProps:{max:500}})}),a.jsx(De,{sx:{width:"100%",paddingTop:2,paddingBottom:2},children:a.jsx(iA,{color:n,onChange:h=>e(Rv(h))})})]})})]})},I1e=d.memo(_1e),P1e=ce([we,ro],({canvas:e},t)=>{const{pastLayerStates:n}=e;return{canUndo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Tn}});function E1e(){const e=te(),{t}=J(),{canUndo:n,activeTabName:r}=W(P1e),o=()=>{e(Z9())};return It(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),a.jsx(ot,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:a.jsx(qg,{}),onClick:o,isDisabled:!n})}const M1e=ce([we,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}}),O1e=()=>{const e=te(),{isStaging:t,isMaskEnabled:n,layer:r,tool:o}=W(M1e),s=V1(),{t:i}=J(),{isClipboardAPIAvailable:l}=b8(),{getUploadButtonProps:u,getUploadInputProps:p}=y2({postUploadAction:{type:"SET_CANVAS_INITIAL_IMAGE"}});It(["v"],()=>{m()},{enabled:()=>!t,preventDefault:!0},[]),It(["r"],()=>{g()},{enabled:()=>!0,preventDefault:!0},[s]),It(["shift+m"],()=>{y()},{enabled:()=>!t,preventDefault:!0},[s]),It(["shift+s"],()=>{b()},{enabled:()=>!t,preventDefault:!0},[s]),It(["meta+c","ctrl+c"],()=>{C()},{enabled:()=>!t&&l,preventDefault:!0},[s,l]),It(["shift+d"],()=>{S()},{enabled:()=>!t,preventDefault:!0},[s]);const m=()=>e(Jc("move")),h=f1e(()=>g(!1),()=>g(!0)),g=(_=!1)=>{const P=V1();if(!P)return;const I=P.getClientRect({skipTransform:!0});e(t$({contentRect:I,shouldScaleTo1:_}))},x=()=>{e(MI())},y=()=>{e(n$())},b=()=>{e(r$())},C=()=>{l&&e(o$())},S=()=>{e(s$())},j=_=>{const P=_;e(jP(P)),P==="mask"&&!n&&e(Fb(!0))};return a.jsxs($,{sx:{alignItems:"center",gap:2,flexWrap:"wrap"},children:[a.jsx(De,{w:24,children:a.jsx(Tr,{tooltip:`${i("unifiedCanvas.layer")} (Q)`,value:r,data:e$,onChange:j,disabled:t})}),a.jsx(v1e,{}),a.jsx(I1e,{}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(ot,{"aria-label":`${i("unifiedCanvas.move")} (V)`,tooltip:`${i("unifiedCanvas.move")} (V)`,icon:a.jsx(eee,{}),isChecked:o==="move"||t,onClick:m}),a.jsx(ot,{"aria-label":`${i("unifiedCanvas.resetView")} (R)`,tooltip:`${i("unifiedCanvas.resetView")} (R)`,icon:a.jsx(oee,{}),onClick:h})]}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(ot,{"aria-label":`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:a.jsx(xee,{}),onClick:y,isDisabled:t}),a.jsx(ot,{"aria-label":`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:a.jsx(Gg,{}),onClick:b,isDisabled:t}),l&&a.jsx(ot,{"aria-label":`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:a.jsx(Lu,{}),onClick:C,isDisabled:t}),a.jsx(ot,{"aria-label":`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:a.jsx(zu,{}),onClick:S,isDisabled:t})]}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(E1e,{}),a.jsx(b1e,{})]}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(ot,{"aria-label":`${i("common.upload")}`,tooltip:`${i("common.upload")}`,icon:a.jsx(Kg,{}),isDisabled:t,...u()}),a.jsx("input",{...p()}),a.jsx(ot,{"aria-label":`${i("unifiedCanvas.clearCanvas")}`,tooltip:`${i("unifiedCanvas.clearCanvas")}`,icon:a.jsx(qo,{}),onClick:x,colorScheme:"error",isDisabled:t})]}),a.jsx(zn,{isAttached:!0,children:a.jsx(k1e,{})})]})},R1e=d.memo(O1e),dI={id:"canvas-intial-image",actionType:"SET_CANVAS_INITIAL_IMAGE"},A1e=()=>{const{isOver:e,setNodeRef:t,active:n}=TO({id:"unifiedCanvas",data:dI});return a.jsxs($,{layerStyle:"first",ref:t,tabIndex:-1,sx:{flexDirection:"column",alignItems:"center",gap:4,p:2,borderRadius:"base",w:"full",h:"full"},children:[a.jsx(R1e,{}),a.jsx(d1e,{}),NO(dI,n)&&a.jsx($O,{isOver:e,label:"Set Canvas Initial Image"})]})},D1e=d.memo(A1e),T1e=()=>a.jsx(D1e,{}),N1e=d.memo(T1e),$1e=[{id:"txt2img",translationKey:"common.txt2img",icon:a.jsx(Lr,{as:mee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(e0e,{})},{id:"img2img",translationKey:"common.img2img",icon:a.jsx(Lr,{as:Xl,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(dpe,{})},{id:"unifiedCanvas",translationKey:"common.unifiedCanvas",icon:a.jsx(Lr,{as:Xoe,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(N1e,{})},{id:"nodes",translationKey:"common.nodes",icon:a.jsx(Lr,{as:C2,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(cge,{})},{id:"modelManager",translationKey:"modelManager.modelManager",icon:a.jsx(Lr,{as:see,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(cme,{})},{id:"queue",translationKey:"queue.queue",icon:a.jsx(Lr,{as:Eee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Jge,{})}],L1e=ce([we],({config:e})=>{const{disabledTabs:t}=e;return $1e.filter(r=>!t.includes(r.id))},{memoizeOptions:{resultEqualityCheck:Tn}}),z1e=448,F1e=448,B1e=360,H1e=["modelManager","queue"],W1e=["modelManager","queue"],V1e=()=>{const e=W(a$),t=W(ro),n=W(L1e),{t:r}=J(),o=te(),s=d.useCallback(R=>{R.target instanceof HTMLElement&&R.target.blur()},[]),i=d.useMemo(()=>n.map(R=>a.jsx(Fn,{hasArrow:!0,label:String(r(R.translationKey)),placement:"end",children:a.jsxs(Po,{onClick:s,children:[a.jsx(HP,{children:String(r(R.translationKey))}),R.icon]})},R.id)),[n,r,s]),l=d.useMemo(()=>n.map(R=>a.jsx(ss,{children:R.content},R.id)),[n]),u=d.useCallback(R=>{const N=n[R];N&&o(ti(N.id))},[o,n]),{minSize:p,isCollapsed:m,setIsCollapsed:h,ref:g,reset:x,expand:y,collapse:b,toggle:C}=w_(z1e,"pixels"),{ref:S,minSize:j,isCollapsed:_,setIsCollapsed:P,reset:I,expand:M,collapse:O,toggle:A}=w_(B1e,"pixels");It("f",()=>{_||m?(M(),y()):(b(),O())},[o,_,m]),It(["t","o"],()=>{C()},[o]),It("g",()=>{A()},[o]);const D=R2();return a.jsxs(nc,{variant:"appTabs",defaultIndex:e,index:e,onChange:u,sx:{flexGrow:1,gap:4},isLazy:!0,children:[a.jsxs(rc,{sx:{pt:2,gap:4,flexDir:"column"},children:[i,a.jsx(ki,{})]}),a.jsxs(f0,{id:"app",autoSaveId:"app",direction:"horizontal",style:{height:"100%",width:"100%"},storage:D,units:"pixels",children:[!W1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(Ji,{order:0,id:"side",ref:g,defaultSize:p,minSize:p,onCollapse:h,collapsible:!0,children:t==="nodes"?a.jsx(Yie,{}):a.jsx(Dfe,{})}),a.jsx(Qh,{onDoubleClick:x,collapsedDirection:m?"left":void 0}),a.jsx(tle,{isSidePanelCollapsed:m,sidePanelRef:g})]}),a.jsx(Ji,{id:"main",order:1,minSize:F1e,children:a.jsx(Tu,{style:{height:"100%",width:"100%"},children:l})}),!H1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(Qh,{onDoubleClick:I,collapsedDirection:_?"right":void 0}),a.jsx(Ji,{id:"gallery",ref:S,order:2,defaultSize:j,minSize:j,onCollapse:P,collapsible:!0,children:a.jsx(Mse,{})}),a.jsx(Zie,{isGalleryCollapsed:_,galleryPanelRef:S})]})]})]})},U1e=d.memo(V1e),G1e=d.createContext(null),R1={didCatch:!1,error:null};class q1e extends d.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=R1}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 Q1e(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 X1e=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),Y1e=new Map(X1e),J1e=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],ub=new WeakSet,Z1e=e=>{ub.add(e);const t=e.toJSON();return ub.delete(e),t},exe=e=>Y1e.get(e)??Error,lA=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:l})=>{if(!n)if(Array.isArray(e))n=[];else if(!l&&fI(e)){const p=exe(e.name);n=new p}else n={};if(t.push(e),s>=o)return n;if(i&&typeof e.toJSON=="function"&&!ub.has(e))return Z1e(e);const u=p=>lA({from:p,seen:[...t],forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:l});for(const[p,m]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(m)){n[p]="[object Buffer]";continue}if(m!==null&&typeof m=="object"&&typeof m.pipe=="function"){n[p]="[object Stream]";continue}if(typeof m!="function"){if(!m||typeof m!="object"){n[p]=m;continue}if(!t.includes(e[p])){s++,n[p]=u(e[p]);continue}n[p]="[Circular]"}}for(const{property:p,enumerable:m}of J1e)typeof e[p]<"u"&&e[p]!==null&&Object.defineProperty(n,p,{value:fI(e[p])?u(e[p]):e[p],enumerable:r?!0:m,configurable:!0,writable:!0});return n};function txe(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 fI(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const nxe=({error:e,resetErrorBoundary:t})=>{const n=DP(),r=d.useCallback(()=>{const s=JSON.stringify(txe(e),null,2);navigator.clipboard.writeText(`\`\`\` ${s} \`\`\``),n({title:"Error Copied"})},[e,n]),o=d.useMemo(()=>Q1e({user:"invoke-ai",repo:"InvokeAI",template:"BUG_REPORT.yml",title:`[bug]: ${e.name}: ${e.message}`}),[e.message,e.name]);return a.jsx($,{layerStyle:"body",sx:{w:"100vw",h:"100vh",alignItems:"center",justifyContent:"center",p:4},children:a.jsxs($,{layerStyle:"first",sx:{flexDir:"column",borderRadius:"base",justifyContent:"center",gap:8,p:16},children:[a.jsx(xo,{children:"Something went wrong"}),a.jsx($,{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($,{sx:{gap:4},children:[a.jsx(Mt,{leftIcon:a.jsx(Woe,{}),onClick:t,children:"Reset UI"}),a.jsx(Mt,{leftIcon:a.jsx(Lu,{}),onClick:r,children:"Copy Error"}),a.jsx(vg,{href:o,isExternal:!0,children:a.jsx(Mt,{leftIcon:a.jsx(Vy,{}),children:"Create Issue"})})]})]})})},rxe=d.memo(nxe),oxe=ce([we],({hotkeys:e})=>{const{shift:t,ctrl:n,meta:r}=e;return{shift:t,ctrl:n,meta:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),sxe=()=>{const e=te(),{shift:t,ctrl:n,meta:r}=W(oxe),{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:l,isDisabled:u,isLoading:p}=E8();return It(["ctrl+shift+enter","meta+shift+enter"],l,{enabled:()=>!u&&!p,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[l,u,p]),It("*",()=>{_m("shift")?!t&&e(Vo(!0)):t&&e(Vo(!1)),_m("ctrl")?!n&&e(mS(!0)):n&&e(mS(!1)),_m("meta")?!r&&e(hS(!0)):r&&e(hS(!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},axe=d.memo(sxe),ixe=e=>{const t=te(),{recallAllParameters:n}=l0(),r=oc(),{currentData:o}=Ps((e==null?void 0:e.imageName)??Os.skipToken),{currentData:s}=WI((e==null?void 0:e.imageName)??Os.skipToken),i=d.useCallback(()=>{o&&(t(GI(o)),t(ti("unifiedCanvas")),r({title:AI("toast.sentToUnifiedCanvas"),status:"info",duration:2500,isClosable:!0}))},[t,r,o]),l=d.useCallback(()=>{o&&t(rg(o))},[t,o]),u=d.useCallback(()=>{s&&n(s.metadata)},[s]);return d.useEffect(()=>{e&&e.action==="sendToCanvas"&&i()},[e,i]),d.useEffect(()=>{e&&e.action==="sendToImg2Img"&&l()},[e,l]),d.useEffect(()=>{e&&e.action==="useAllParameters"&&u()},[e,u]),{handleSendToCanvas:i,handleSendToImg2Img:l,handleUseAllMetadata:u}},lxe=e=>(ixe(e.selectedImage),null),cxe=d.memo(lxe),uxe={},dxe=({config:e=uxe,selectedImage:t})=>{const n=W(nO),r=G5("system"),o=te(),s=d.useCallback(()=>(localStorage.clear(),location.reload(),!1),[]);d.useEffect(()=>{on.changeLanguage(n)},[n]),d.useEffect(()=>{oP(e)&&(r.info({config:e},"Received config"),o(i$(e)))},[o,e,r]),d.useEffect(()=>{o(l$())},[o]);const i=Lg(c$);return a.jsxs(q1e,{onReset:s,FallbackComponent:rxe,children:[a.jsx(tl,{w:"100vw",h:"100vh",position:"relative",overflow:"hidden",children:a.jsx(PG,{children:a.jsxs(tl,{sx:{gap:4,p:4,gridAutoRows:"min-content auto",w:"full",h:"full"},children:[i||a.jsx(rte,{}),a.jsx($,{sx:{gap:4,w:"full",h:"full"},children:a.jsx(U1e,{})})]})})}),a.jsx(VZ,{}),a.jsx(FZ,{}),a.jsx(vU,{}),a.jsx(axe,{}),a.jsx(cxe,{selectedImage:t})]})},vxe=d.memo(dxe);export{vxe as default};