import{a as Ou,b as vI,S as bI,c as xI,d as yI,e as G1,f as CI,i as q1,g as KR,h as wI,j as SI,k as QR,l as Ix,m as XR,n as YR,o as zw,p as kI,t as JR,q as ZR,r as eD,s as tD,u as nD,v as l,R as z,w as Px,x as Bh,y as rD,z as oD,A as sD,B as aD,P as iD,C as Ex,D as lD,E as cD,F as uD,G as dD,H as De,I as a,J as Gr,K as Un,L as Ae,M as kt,N as vr,O as ot,Q as wf,T as So,U as Ar,V as no,W as lr,X as Ci,Y as cl,Z as Vt,_ as Ms,$ as Yc,a0 as wi,a1 as Si,a2 as pg,a3 as Mx,a4 as Sf,a5 as K1,a6 as fD,a7 as Fw,a8 as pD,a9 as jI,aa as Q1,ab as kf,ac as Au,ad as hD,ae as _I,af as II,ag as PI,ah as ea,ai as mD,aj as me,ak as we,al as Nn,am as H,an as gD,ao as Bw,ap as vD,aq as bD,ar as xD,as as ki,at as Le,au as N,av as yo,aw as lo,ax as Ie,ay as Zl,az as Q,aA as EI,aB as yD,aC as CD,aD as wD,aE as SD,aF as ls,aG as Ox,aH as ji,aI as le,aJ as Qo,aK as jf,aL as kD,aM as jD,aN as Hw,aO as Ax,aP as je,aQ as ta,aR as _D,aS as MI,aT as OI,aU as Ww,aV as ID,aW as PD,aX as ED,aY as _i,aZ as Rx,a_ as fn,a$ as MD,b0 as OD,b1 as Ha,b2 as AI,b3 as RI,b4 as Ht,b5 as hg,b6 as AD,b7 as Vw,b8 as DI,b9 as RD,ba as DD,bb as TD,bc as ND,bd as $D,be as LD,bf as zD,bg as TI,bh as FD,bi as BD,bj as HD,bk as WD,bl as VD,bm as fu,bn as Dx,bo as UD,bp as GD,bq as qD,br as wc,bs as KD,bt as QD,bu as XD,bv as YD,bw as Uw,bx as JD,by as ZD,bz as Jc,bA as NI,bB as $I,bC as mg,bD as Tx,bE as Nx,bF as Rs,bG as LI,bH as e7,bI as Hl,bJ as Pd,bK as Gw,bL as t7,bM as n7,bN as r7,bO as Wp,bP as Vp,bQ as md,bR as Bv,bS as $d,bT as Ld,bU as zd,bV as Fd,bW as qw,bX as Hh,bY as Hv,bZ as Wh,b_ as Kw,b$ as X1,c0 as Wv,c1 as Y1,c2 as Qw,c3 as Vc,c4 as Vv,c5 as Vh,c6 as Xw,c7 as Wl,c8 as Yw,c9 as Vl,ca as Up,cb as Uh,cc as Jw,cd as J1,ce as Gh,cf as Zw,cg as Z1,ch as _f,ci as zI,cj as o7,ck as eS,cl as $x,cm as qh,cn as FI,co as Do,cp as gd,cq as Sc,cr as Lx,cs as BI,ct as Gp,cu as zx,cv as s7,cw as HI,cx as Uv,cy as gg,cz as a7,cA as WI,cB as eb,cC as tb,cD as VI,cE as i7,cF as nb,cG as l7,cH as rb,cI as c7,cJ as ob,cK as u7,cL as UI,cM as d7,cN as GI,cO as qI,cP as f7,cQ as KI,cR as Fx,cS as Bx,cT as Hx,cU as Wx,cV as vg,cW as Vx,cX as ni,cY as QI,cZ as XI,c_ as Ux,c$ as YI,d0 as p7,d1 as vd,d2 as di,d3 as JI,d4 as ZI,d5 as tS,d6 as Gx,d7 as eP,d8 as qx,d9 as Kx,da as tP,db as Rr,dc as h7,dd as to,de as m7,df as Ru,dg as bg,dh as Qx,di as nP,dj as rP,dk as g7,dl as v7,dm as b7,dn as Kh,dp as oP,dq as sP,dr as x7,ds as y7,dt as C7,du as w7,dv as S7,dw as k7,dx as j7,dy as _7,dz as nS,dA as Xx,dB as I7,dC as P7,dD as If,dE as E7,dF as M7,dG as xg,dH as O7,dI as A7,dJ as R7,dK as D7,dL as xr,dM as T7,dN as N7,dO as $7,dP as L7,dQ as z7,dR as F7,dS as rr,dT as Jd,dU as rS,dV as aa,dW as aP,dX as B7,dY as Yx,dZ as H7,d_ as oS,d$ as W7,e0 as V7,e1 as U7,e2 as iP,e3 as G7,e4 as q7,e5 as K7,e6 as Q7,e7 as X7,e8 as Y7,e9 as lP,ea as J7,eb as Z7,ec as sS,ed as eT,ee as tT,ef as nT,eg as rT,eh as oT,ei as sT,ej as aT,ek as cP,el as iT,em as lT,en as cT,eo as aS,ep as qp,eq as Fs,er as uT,es as dT,et as fT,eu as pT,ev as hT,ew as mT,ex as na,ey as gT,ez as vT,eA as bT,eB as xT,eC as yT,eD as CT,eE as wT,eF as ST,eG as kT,eH as jT,eI as _T,eJ as IT,eK as PT,eL as ET,eM as MT,eN as OT,eO as AT,eP as RT,eQ as DT,eR as TT,eS as NT,eT as $T,eU as LT,eV as zT,eW as FT,eX as iS,eY as uP,eZ as BT,e_ as Ys,e$ as Zd,f0 as Ro,f1 as HT,f2 as WT,f3 as dP,f4 as fP,f5 as VT,f6 as lS,f7 as UT,f8 as cS,f9 as uS,fa as dS,fb as GT,fc as qT,fd as fS,fe as pS,ff as KT,fg as QT,fh as Qh,fi as XT,fj as hS,fk as mS,fl as YT,fm as JT,fn as pP,fo as ZT,fp as eN,fq as hP,fr as tN,fs as nN,ft as gS,fu as rN,fv as vS,fw as oN,fx as sN,fy as mP,fz as gP,fA as Pf,fB as vP,fC as Al,fD as bP,fE as bS,fF as aN,fG as iN,fH as xP,fI as lN,fJ as cN,fK as uN,fL as dN,fM as fN,fN as Jx,fO as sb,fP as pN,fQ as hN,fR as mN,fS as yP,fT as Zx,fU as CP,fV as ey,fW as wP,fX as gN,fY as oi,fZ as vN,f_ as SP,f$ as Du,g0 as bN,g1 as ty,g2 as kP,g3 as xN,g4 as yN,g5 as CN,g6 as wN,g7 as SN,g8 as kN,g9 as Ed,ga as Uc,gb as xS,gc as jN,gd as _N,ge as IN,gf as PN,gg as EN,gh as MN,gi as ON,gj as yS,gk as AN,gl as RN,gm as DN,gn as TN,go as NN,gp as $N,gq as CS,gr as LN,gs as zN,gt as FN,gu as BN,gv as HN,gw as WN,gx as VN,gy as UN,gz as GN,gA as wS,gB as qN,gC as KN,gD as QN,gE as XN,gF as YN,gG as JN,gH as ZN,gI as e9,gJ as t9,gK as n9,gL as r9,gM as o9,gN as s9,gO as Ef,gP as a9,gQ as i9,gR as l9,gS as c9,gT as u9,gU as d9,gV as f9,gW as p9,gX as SS,gY as Ih,gZ as h9,g_ as Xh,g$ as jP,h0 as Yh,h1 as m9,h2 as g9,h3 as Zc,h4 as _P,h5 as IP,h6 as ny,h7 as v9,h8 as b9,h9 as x9,ha as ab,hb as PP,hc as y9,hd as C9,he as EP,hf as w9,hg as S9,hh as k9,hi as j9,hj as _9,hk as kS,hl as kc,hm as I9,hn as P9,ho as E9,hp as M9,hq as O9,hr as jS,hs as A9,ht as R9,hu as D9,hv as T9,hw as N9,hx as $9,hy as L9,hz as z9,hA as Gv,hB as qv,hC as Kv,hD as Kp,hE as _S,hF as ib,hG as IS,hH as F9,hI as B9,hJ as MP,hK as H9,hL as W9,hM as V9,hN as U9,hO as G9,hP as q9,hQ as K9,hR as Q9,hS as X9,hT as Y9,hU as J9,hV as Z9,hW as e$,hX as t$,hY as n$,hZ as Qp,h_ as Qv,h$ as r$,i0 as o$,i1 as s$,i2 as a$,i3 as i$,i4 as l$,i5 as c$,i6 as u$,i7 as d$,i8 as PS,i9 as ES,ia as f$,ib as p$,ic as h$,id as m$}from"./index-f820e2e3.js";import{u as OP,a as Ii,b as g$,r as qe,f as v$,g as MS,c as Xt,d as zr}from"./MantineProvider-a6a1d85c.js";var b$=200;function x$(e,t,n,r){var o=-1,s=xI,i=!0,c=e.length,d=[],p=t.length;if(!c)return d;n&&(t=Ou(t,vI(n))),r?(s=yI,i=!1):t.length>=b$&&(s=G1,i=!1,t=new bI(t));e:for(;++o=120&&h.length>=120)?new bI(i&&h):void 0}h=e[0];var m=-1,g=c[0];e:for(;++m{r.has(s)&&n(o,s)})}function T$(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 AP=({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:c,strokeWidth:d,className:p,borderRadius:h,shapeRendering:m,onClick:g,selected:b})=>{const{background:y,backgroundColor:x}=s||{},w=i||y||x;return z.createElement("rect",{className:Px(["react-flow__minimap-node",{selected:b},p]),x:t,y:n,rx:h,ry:h,width:r,height:o,fill:w,stroke:c,strokeWidth:d,shapeRendering:m,onClick:g?S=>g(S,e):void 0})};AP.displayName="MiniMapNode";var N$=l.memo(AP);const $$=e=>e.nodeOrigin,L$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Xv=e=>e instanceof Function?e:()=>e;function z$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=N$,onClick:i}){const c=Bh(L$,Ex),d=Bh($$),p=Xv(t),h=Xv(e),m=Xv(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return z.createElement(z.Fragment,null,c.map(b=>{const{x:y,y:x}=rD(b,d).positionAbsolute;return z.createElement(s,{key:b.id,x:y,y:x,width:b.width,height:b.height,style:b.style,selected:b.selected,className:m(b),color:p(b),borderRadius:r,strokeColor:h(b),strokeWidth:o,shapeRendering:g,onClick:i,id:b.id})}))}var F$=l.memo(z$);const B$=200,H$=150,W$=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?uD(dD(t,e.nodeOrigin),n):n,rfId:e.rfId}},V$="react-flow__minimap-desc";function RP({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:c,maskColor:d="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:g,onNodeClick:b,pannable:y=!1,zoomable:x=!1,ariaLabel:w="React Flow mini map",inversePan:S=!1,zoomStep:j=10,offsetScale:I=5}){const _=oD(),M=l.useRef(null),{boundingRect:E,viewBB:A,rfId:R}=Bh(W$,Ex),D=(e==null?void 0:e.width)??B$,O=(e==null?void 0:e.height)??H$,T=E.width/D,K=E.height/O,G=Math.max(T,K),X=G*D,Z=G*O,te=I*G,V=E.x-(X-E.width)/2-te,oe=E.y-(Z-E.height)/2-te,ne=X+te*2,se=Z+te*2,re=`${V$}-${R}`,ae=l.useRef(0);ae.current=G,l.useEffect(()=>{if(M.current){const $=sD(M.current),F=W=>{const{transform:U,d3Selection:ee,d3Zoom:J}=_.getState();if(W.sourceEvent.type!=="wheel"||!ee||!J)return;const ge=-W.sourceEvent.deltaY*(W.sourceEvent.deltaMode===1?.05:W.sourceEvent.deltaMode?1:.002)*j,he=U[2]*Math.pow(2,ge);J.scaleTo(ee,he)},q=W=>{const{transform:U,d3Selection:ee,d3Zoom:J,translateExtent:ge,width:he,height:de}=_.getState();if(W.sourceEvent.type!=="mousemove"||!ee||!J)return;const _e=ae.current*Math.max(1,U[2])*(S?-1:1),Pe={x:U[0]-W.sourceEvent.movementX*_e,y:U[1]-W.sourceEvent.movementY*_e},ze=[[0,0],[he,de]],ht=lD.translate(Pe.x,Pe.y).scale(U[2]),Je=J.constrain()(ht,ze,ge);J.transform(ee,Je)},pe=aD().on("zoom",y?q:null).on("zoom.wheel",x?F:null);return $.call(pe),()=>{$.on("zoom",null)}}},[y,x,S,j]);const B=g?$=>{const F=cD($);g($,{x:F[0],y:F[1]})}:void 0,Y=b?($,F)=>{const q=_.getState().nodeInternals.get(F);b($,q)}:void 0;return z.createElement(iD,{position:m,style:e,className:Px(["react-flow__minimap",t]),"data-testid":"rf__minimap"},z.createElement("svg",{width:D,height:O,viewBox:`${V} ${oe} ${ne} ${se}`,role:"img","aria-labelledby":re,ref:M,onClick:B},w&&z.createElement("title",{id:re},w),z.createElement(F$,{onClick:Y,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:c}),z.createElement("path",{className:"react-flow__minimap-mask",d:`M${V-te},${oe-te}h${ne+te*2}v${se+te*2}h${-ne-te*2}z M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:d,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}RP.displayName="MiniMap";var U$=l.memo(RP),ra;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ra||(ra={}));function G$({color:e,dimensions:t,lineWidth:n}){return z.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function q$({color:e,radius:t}){return z.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const K$={[ra.Dots]:"#91919a",[ra.Lines]:"#eee",[ra.Cross]:"#e2e2e2"},Q$={[ra.Dots]:1,[ra.Lines]:1,[ra.Cross]:6},X$=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function DP({id:e,variant:t=ra.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=2,color:i,style:c,className:d}){const p=l.useRef(null),{transform:h,patternId:m}=Bh(X$,Ex),g=i||K$[t],b=r||Q$[t],y=t===ra.Dots,x=t===ra.Cross,w=Array.isArray(n)?n:[n,n],S=[w[0]*h[2]||1,w[1]*h[2]||1],j=b*h[2],I=x?[j,j]:S,_=y?[j/s,j/s]:[I[0]/s,I[1]/s];return z.createElement("svg",{className:Px(["react-flow__background",d]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},z.createElement("pattern",{id:m+e,x:h[0]%S[0],y:h[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`},y?z.createElement(q$,{color:g,radius:j/s}):z.createElement(G$,{dimensions:I,color:g,lineWidth:o})),z.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}DP.displayName="Background";var Y$=l.memo(DP);function J$(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Z$=J$();const TP=1/60*1e3,eL=typeof performance<"u"?()=>performance.now():()=>Date.now(),NP=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(eL()),TP);function tL(e){let t=[],n=[],r=0,o=!1,s=!1;const i=new WeakSet,c={schedule:(d,p=!1,h=!1)=>{const m=h&&o,g=m?t:n;return p&&i.add(d),g.indexOf(d)===-1&&(g.push(d),m&&o&&(r=t.length)),d},cancel:d=>{const p=n.indexOf(d);p!==-1&&n.splice(p,1),i.delete(d)},process:d=>{if(o){s=!0;return}if(o=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let p=0;p(e[t]=tL(()=>ef=!0),e),{}),rL=Mf.reduce((e,t)=>{const n=yg[t];return e[t]=(r,o=!1,s=!1)=>(ef||aL(),n.schedule(r,o,s)),e},{}),oL=Mf.reduce((e,t)=>(e[t]=yg[t].cancel,e),{});Mf.reduce((e,t)=>(e[t]=()=>yg[t].process(eu),e),{});const sL=e=>yg[e].process(eu),$P=e=>{ef=!1,eu.delta=lb?TP:Math.max(Math.min(e-eu.timestamp,nL),1),eu.timestamp=e,cb=!0,Mf.forEach(sL),cb=!1,ef&&(lb=!1,NP($P))},aL=()=>{ef=!0,lb=!0,cb||NP($P)},AS=()=>eu;function Cg(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=l.Children.toArray(e.path),i=De((c,d)=>a.jsx(Gr,{ref:d,viewBox:t,...o,...c,children:s.length?s:a.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}var iL=Object.defineProperty,lL=(e,t,n)=>t in e?iL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mr=(e,t,n)=>(lL(e,typeof t!="symbol"?t+"":t,n),n);function RS(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 cL=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function DS(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function TS(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var ub=typeof window<"u"?l.useLayoutEffect:l.useEffect,Jh=e=>e,uL=class{constructor(){Mr(this,"descendants",new Map),Mr(this,"register",e=>{if(e!=null)return cL(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),Mr(this,"unregister",e=>{this.descendants.delete(e);const t=RS(Array.from(this.descendants.keys()));this.assignIndex(t)}),Mr(this,"destroy",()=>{this.descendants.clear()}),Mr(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),Mr(this,"count",()=>this.descendants.size),Mr(this,"enabledCount",()=>this.enabledValues().length),Mr(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),Mr(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),Mr(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),Mr(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),Mr(this,"first",()=>this.item(0)),Mr(this,"firstEnabled",()=>this.enabledItem(0)),Mr(this,"last",()=>this.item(this.descendants.size-1)),Mr(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),Mr(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),Mr(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),Mr(this,"next",(e,t=!0)=>{const n=DS(e,this.count(),t);return this.item(n)}),Mr(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=DS(r,this.enabledCount(),t);return this.enabledItem(o)}),Mr(this,"prev",(e,t=!0)=>{const n=TS(e,this.count()-1,t);return this.item(n)}),Mr(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=TS(r,this.enabledCount()-1,t);return this.enabledItem(o)}),Mr(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=RS(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 dL(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 xn(...e){return t=>{e.forEach(n=>{dL(n,t)})}}function fL(...e){return l.useMemo(()=>xn(...e),e)}function pL(){const e=l.useRef(new uL);return ub(()=>()=>e.current.destroy()),e.current}var[hL,LP]=Un({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function mL(e){const t=LP(),[n,r]=l.useState(-1),o=l.useRef(null);ub(()=>()=>{o.current&&t.unregister(o.current)},[]),ub(()=>{if(!o.current)return;const i=Number(o.current.dataset.index);n!=i&&!Number.isNaN(i)&&r(i)});const s=Jh(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:xn(s,o)}}function ry(){return[Jh(hL),()=>Jh(LP()),()=>pL(),o=>mL(o)]}var[gL,wg]=Un({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[vL,oy]=Un({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[bL,Mbe,xL,yL]=ry(),Nc=De(function(t,n){const{getButtonProps:r}=oy(),o=r(t,n),i={display:"flex",alignItems:"center",width:"100%",outline:0,...wg().button};return a.jsx(Ae.button,{...o,className:kt("chakra-accordion__button",t.className),__css:i})});Nc.displayName="AccordionButton";function Of(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(g,b)=>g!==b}=e,s=vr(r),i=vr(o),[c,d]=l.useState(n),p=t!==void 0,h=p?t:c,m=vr(g=>{const y=typeof g=="function"?g(h):g;i(h,y)&&(p||d(y),s(y))},[p,s,h,i]);return[h,m]}function CL(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...i}=e;kL(e),jL(e);const c=xL(),[d,p]=l.useState(-1);l.useEffect(()=>()=>{p(-1)},[]);const[h,m]=Of({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:h,setIndex:m,htmlProps:i,getAccordionItemProps:b=>{let y=!1;return b!==null&&(y=Array.isArray(h)?h.includes(b):h===b),{isOpen:y,onChange:w=>{if(b!==null)if(o&&Array.isArray(h)){const S=w?h.concat(b):h.filter(j=>j!==b);m(S)}else w?m(b):s&&m(-1)}}},focusedIndex:d,setFocusedIndex:p,descendants:c}}var[wL,sy]=Un({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function SL(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:i}=sy(),c=l.useRef(null),d=l.useId(),p=r??d,h=`accordion-button-${p}`,m=`accordion-panel-${p}`;_L(e);const{register:g,index:b,descendants:y}=yL({disabled:t&&!n}),{isOpen:x,onChange:w}=s(b===-1?null:b);IL({isOpen:x,isDisabled:t});const S=()=>{w==null||w(!0)},j=()=>{w==null||w(!1)},I=l.useCallback(()=>{w==null||w(!x),i(b)},[b,i,x,w]),_=l.useCallback(R=>{const O={ArrowDown:()=>{const T=y.nextEnabled(b);T==null||T.node.focus()},ArrowUp:()=>{const T=y.prevEnabled(b);T==null||T.node.focus()},Home:()=>{const T=y.firstEnabled();T==null||T.node.focus()},End:()=>{const T=y.lastEnabled();T==null||T.node.focus()}}[R.key];O&&(R.preventDefault(),O(R))},[y,b]),M=l.useCallback(()=>{i(b)},[i,b]),E=l.useCallback(function(D={},O=null){return{...D,type:"button",ref:xn(g,c,O),id:h,disabled:!!t,"aria-expanded":!!x,"aria-controls":m,onClick:ot(D.onClick,I),onFocus:ot(D.onFocus,M),onKeyDown:ot(D.onKeyDown,_)}},[h,t,x,I,M,_,m,g]),A=l.useCallback(function(D={},O=null){return{...D,ref:O,role:"region",id:m,"aria-labelledby":h,hidden:!x}},[h,x,m]);return{isOpen:x,isDisabled:t,isFocusable:n,onOpen:S,onClose:j,getButtonProps:E,getPanelProps:A,htmlProps:o}}function kL(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;wf({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function jL(e){wf({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 _L(e){wf({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 IL(e){wf({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function $c(e){const{isOpen:t,isDisabled:n}=oy(),{reduceMotion:r}=sy(),o=kt("chakra-accordion__icon",e.className),s=wg(),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(Gr,{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"})})}$c.displayName="AccordionIcon";var Lc=De(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...i}=SL(t),d={...wg().container,overflowAnchor:"none"},p=l.useMemo(()=>i,[i]);return a.jsx(vL,{value:p,children:a.jsx(Ae.div,{ref:n,...s,className:kt("chakra-accordion__item",o),__css:d,children:typeof r=="function"?r({isExpanded:!!i.isOpen,isDisabled:!!i.isDisabled}):r})})});Lc.displayName="AccordionItem";var Gc={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Tl={enter:{duration:.2,ease:Gc.easeOut},exit:{duration:.1,ease:Gc.easeIn}},ii={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})},PL=e=>e!=null&&parseInt(e.toString(),10)>0,NS={exit:{height:{duration:.2,ease:Gc.ease},opacity:{duration:.3,ease:Gc.ease}},enter:{height:{duration:.3,ease:Gc.ease},opacity:{duration:.4,ease:Gc.ease}}},EL={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:PL(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:ii.exit(NS.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:ii.enter(NS.enter,o)}}},Af=l.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:i="auto",style:c,className:d,transition:p,transitionEnd:h,...m}=e,[g,b]=l.useState(!1);l.useEffect(()=>{const j=setTimeout(()=>{b(!0)});return()=>clearTimeout(j)},[]),wf({condition:Number(s)>0&&!!r,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const y=parseFloat(s.toString())>0,x={startingHeight:s,endingHeight:i,animateOpacity:o,transition:g?p:{enter:{duration:0}},transitionEnd:{enter:h==null?void 0:h.enter,exit:r?h==null?void 0:h.exit:{...h==null?void 0:h.exit,display:y?"block":"none"}}},w=r?n:!0,S=n||r?"enter":"exit";return a.jsx(So,{initial:!1,custom:x,children:w&&a.jsx(Ar.div,{ref:t,...m,className:kt("chakra-collapse",d),style:{overflow:"hidden",display:"block",...c},custom:x,variants:EL,initial:r?"exit":!1,animate:S,exit:"exit"})})});Af.displayName="Collapse";var ML={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:ii.enter(Tl.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:ii.exit(Tl.exit,n),transitionEnd:t==null?void 0:t.exit}}},zP={initial:"exit",animate:"enter",exit:"exit",variants:ML},OL=l.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:i,transitionEnd:c,delay:d,...p}=t,h=o||r?"enter":"exit",m=r?o&&r:!0,g={transition:i,transitionEnd:c,delay:d};return a.jsx(So,{custom:g,children:m&&a.jsx(Ar.div,{ref:n,className:kt("chakra-fade",s),custom:g,...zP,animate:h,...p})})});OL.displayName="Fade";var AL={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:ii.exit(Tl.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:ii.enter(Tl.enter,n),transitionEnd:e==null?void 0:e.enter}}},FP={initial:"exit",animate:"enter",exit:"exit",variants:AL},RL=l.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:i=.95,className:c,transition:d,transitionEnd:p,delay:h,...m}=t,g=r?o&&r:!0,b=o||r?"enter":"exit",y={initialScale:i,reverse:s,transition:d,transitionEnd:p,delay:h};return a.jsx(So,{custom:y,children:g&&a.jsx(Ar.div,{ref:n,className:kt("chakra-offset-slide",c),...FP,animate:b,custom:y,...m})})});RL.displayName="ScaleFade";var DL={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:ii.exit(Tl.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:ii.enter(Tl.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var i;const c={x:t,y:e};return{opacity:0,transition:(i=n==null?void 0:n.exit)!=null?i:ii.exit(Tl.exit,s),...o?{...c,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...c,...r==null?void 0:r.exit}}}}},Md={initial:"initial",animate:"enter",exit:"exit",variants:DL},TL=l.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:i,offsetX:c=0,offsetY:d=8,transition:p,transitionEnd:h,delay:m,...g}=t,b=r?o&&r:!0,y=o||r?"enter":"exit",x={offsetX:c,offsetY:d,reverse:s,transition:p,transitionEnd:h,delay:m};return a.jsx(So,{custom:x,children:b&&a.jsx(Ar.div,{ref:n,className:kt("chakra-offset-slide",i),custom:x,...Md,animate:y,...g})})});TL.displayName="SlideFade";var zc=De(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:i}=sy(),{getPanelProps:c,isOpen:d}=oy(),p=c(s,n),h=kt("chakra-accordion__panel",r),m=wg();i||delete p.hidden;const g=a.jsx(Ae.div,{...p,__css:m.panel,className:h});return i?g:a.jsx(Af,{in:d,...o,children:g})});zc.displayName="AccordionPanel";var BP=De(function({children:t,reduceMotion:n,...r},o){const s=no("Accordion",r),i=lr(r),{htmlProps:c,descendants:d,...p}=CL(i),h=l.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return a.jsx(bL,{value:d,children:a.jsx(wL,{value:h,children:a.jsx(gL,{value:s,children:a.jsx(Ae.div,{ref:o,...c,className:kt("chakra-accordion",r.className),__css:s.root,children:t})})})})});BP.displayName="Accordion";function Sg(e){return l.Children.toArray(e).filter(t=>l.isValidElement(t))}var[NL,$L]=Un({strict:!1,name:"ButtonGroupContext"}),LL={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}}},zL={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},Hn=De(function(t,n){const{size:r,colorScheme:o,variant:s,className:i,spacing:c="0.5rem",isAttached:d,isDisabled:p,orientation:h="horizontal",...m}=t,g=kt("chakra-button__group",i),b=l.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let y={display:"inline-flex",...d?LL[h]:zL[h](c)};const x=h==="vertical";return a.jsx(NL,{value:b,children:a.jsx(Ae.div,{ref:n,role:"group",__css:y,className:g,"data-attached":d?"":void 0,"data-orientation":h,flexDir:x?"column":void 0,...m})})});Hn.displayName="ButtonGroup";function FL(e){const[t,n]=l.useState(!e);return{ref:l.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function db(e){const{children:t,className:n,...r}=e,o=l.isValidElement(t)?l.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=kt("chakra-button__icon",n);return a.jsx(Ae.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}db.displayName="ButtonIcon";function fb(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=a.jsx(Ci,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:i,...c}=e,d=kt("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",h=l.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[p]:t?r:0,fontSize:"1em",lineHeight:"normal",...i}),[i,t,p,r]);return a.jsx(Ae.div,{className:d,...c,__css:h,children:o})}fb.displayName="ButtonSpinner";var nl=De((e,t)=>{const n=$L(),r=cl("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:i,children:c,leftIcon:d,rightIcon:p,loadingText:h,iconSpacing:m="0.5rem",type:g,spinner:b,spinnerPlacement:y="start",className:x,as:w,...S}=lr(e),j=l.useMemo(()=>{const E={...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:E}}},[r,n]),{ref:I,type:_}=FL(w),M={rightIcon:p,leftIcon:d,iconSpacing:m,children:c};return a.jsxs(Ae.button,{ref:fL(t,I),as:w,type:g??_,"data-active":Vt(i),"data-loading":Vt(s),__css:j,className:kt("chakra-button",x),...S,disabled:o||s,children:[s&&y==="start"&&a.jsx(fb,{className:"chakra-button__spinner--start",label:h,placement:"start",spacing:m,children:b}),s?h||a.jsx(Ae.span,{opacity:0,children:a.jsx($S,{...M})}):a.jsx($S,{...M}),s&&y==="end"&&a.jsx(fb,{className:"chakra-button__spinner--end",label:h,placement:"end",spacing:m,children:b})]})});nl.displayName="Button";function $S(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return a.jsxs(a.Fragment,{children:[t&&a.jsx(db,{marginEnd:o,children:t}),r,n&&a.jsx(db,{marginStart:o,children:n})]})}var Ia=De((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...i}=e,c=n||r,d=l.isValidElement(c)?l.cloneElement(c,{"aria-hidden":!0,focusable:!1}):null;return a.jsx(nl,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...i,children:d})});Ia.displayName="IconButton";var[Obe,BL]=Un({name:"CheckboxGroupContext",strict:!1});function HL(e){const[t,n]=l.useState(e),[r,o]=l.useState(!1);return e!==t&&(o(!0),n(e)),r}function WL(e){return a.jsx(Ae.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 VL(e){return a.jsx(Ae.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 UL(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?VL:WL;return n||t?a.jsx(Ae.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:a.jsx(o,{...r})}):null}var[GL,HP]=Un({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[qL,Rf]=Un({strict:!1,name:"FormControlContext"});function KL(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...i}=e,c=l.useId(),d=t||`field-${c}`,p=`${d}-label`,h=`${d}-feedback`,m=`${d}-helptext`,[g,b]=l.useState(!1),[y,x]=l.useState(!1),[w,S]=l.useState(!1),j=l.useCallback((A={},R=null)=>({id:m,...A,ref:xn(R,D=>{D&&x(!0)})}),[m]),I=l.useCallback((A={},R=null)=>({...A,ref:R,"data-focus":Vt(w),"data-disabled":Vt(o),"data-invalid":Vt(r),"data-readonly":Vt(s),id:A.id!==void 0?A.id:p,htmlFor:A.htmlFor!==void 0?A.htmlFor:d}),[d,o,w,r,s,p]),_=l.useCallback((A={},R=null)=>({id:h,...A,ref:xn(R,D=>{D&&b(!0)}),"aria-live":"polite"}),[h]),M=l.useCallback((A={},R=null)=>({...A,...i,ref:R,role:"group","data-focus":Vt(w),"data-disabled":Vt(o),"data-invalid":Vt(r),"data-readonly":Vt(s)}),[i,o,w,r,s]),E=l.useCallback((A={},R=null)=>({...A,ref:R,role:"presentation","aria-hidden":!0,children:A.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!w,onFocus:()=>S(!0),onBlur:()=>S(!1),hasFeedbackText:g,setHasFeedbackText:b,hasHelpText:y,setHasHelpText:x,id:d,labelId:p,feedbackId:h,helpTextId:m,htmlProps:i,getHelpTextProps:j,getErrorMessageProps:_,getRootProps:M,getLabelProps:I,getRequiredIndicatorProps:E}}var Vn=De(function(t,n){const r=no("Form",t),o=lr(t),{getRootProps:s,htmlProps:i,...c}=KL(o),d=kt("chakra-form-control",t.className);return a.jsx(qL,{value:c,children:a.jsx(GL,{value:r,children:a.jsx(Ae.div,{...s({},n),className:d,__css:r.container})})})});Vn.displayName="FormControl";var WP=De(function(t,n){const r=Rf(),o=HP(),s=kt("chakra-form__helper-text",t.className);return a.jsx(Ae.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});WP.displayName="FormHelperText";var yr=De(function(t,n){var r;const o=cl("FormLabel",t),s=lr(t),{className:i,children:c,requiredIndicator:d=a.jsx(VP,{}),optionalIndicator:p=null,...h}=s,m=Rf(),g=(r=m==null?void 0:m.getLabelProps(h,n))!=null?r:{ref:n,...h};return a.jsxs(Ae.label,{...g,className:kt("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[c,m!=null&&m.isRequired?d:p]})});yr.displayName="FormLabel";var VP=De(function(t,n){const r=Rf(),o=HP();if(!(r!=null&&r.isRequired))return null;const s=kt("chakra-form__required-indicator",t.className);return a.jsx(Ae.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});VP.displayName="RequiredIndicator";function ay(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=iy(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":Ms(n),"aria-required":Ms(o),"aria-readonly":Ms(r)}}function iy(e){var t,n,r;const o=Rf(),{id:s,disabled:i,readOnly:c,required:d,isRequired:p,isInvalid:h,isReadOnly:m,isDisabled:g,onFocus:b,onBlur:y,...x}=e,w=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&w.push(o.feedbackId),o!=null&&o.hasHelpText&&w.push(o.helpTextId),{...x,"aria-describedby":w.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=i??g)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=c??m)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=d??p)!=null?r:o==null?void 0:o.isRequired,isInvalid:h??(o==null?void 0:o.isInvalid),onFocus:ot(o==null?void 0:o.onFocus,b),onBlur:ot(o==null?void 0:o.onBlur,y)}}var ly={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},UP=Ae("span",{baseStyle:ly});UP.displayName="VisuallyHidden";var QL=Ae("input",{baseStyle:ly});QL.displayName="VisuallyHiddenInput";var XL=()=>typeof document<"u",LS=!1,Df=null,Ul=!1,pb=!1,hb=new Set;function cy(e,t){hb.forEach(n=>n(e,t))}var YL=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function JL(e){return!(e.metaKey||!YL&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function zS(e){Ul=!0,JL(e)&&(Df="keyboard",cy("keyboard",e))}function jc(e){if(Df="pointer",e.type==="mousedown"||e.type==="pointerdown"){Ul=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;cy("pointer",e)}}function ZL(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function ez(e){ZL(e)&&(Ul=!0,Df="virtual")}function tz(e){e.target===window||e.target===document||(!Ul&&!pb&&(Df="virtual",cy("virtual",e)),Ul=!1,pb=!1)}function nz(){Ul=!1,pb=!0}function FS(){return Df!=="pointer"}function rz(){if(!XL()||LS)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Ul=!0,e.apply(this,n)},document.addEventListener("keydown",zS,!0),document.addEventListener("keyup",zS,!0),document.addEventListener("click",ez,!0),window.addEventListener("focus",tz,!0),window.addEventListener("blur",nz,!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)),LS=!0}function GP(e){rz(),e(FS());const t=()=>e(FS());return hb.add(t),()=>{hb.delete(t)}}function oz(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function qP(e={}){const t=iy(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:i,onBlur:c,onFocus:d,"aria-describedby":p}=t,{defaultChecked:h,isChecked:m,isFocusable:g,onChange:b,isIndeterminate:y,name:x,value:w,tabIndex:S=void 0,"aria-label":j,"aria-labelledby":I,"aria-invalid":_,...M}=e,E=oz(M,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),A=vr(b),R=vr(c),D=vr(d),[O,T]=l.useState(!1),[K,G]=l.useState(!1),[X,Z]=l.useState(!1),[te,V]=l.useState(!1);l.useEffect(()=>GP(T),[]);const oe=l.useRef(null),[ne,se]=l.useState(!0),[re,ae]=l.useState(!!h),B=m!==void 0,Y=B?m:re,$=l.useCallback(de=>{if(r||n){de.preventDefault();return}B||ae(Y?de.target.checked:y?!0:de.target.checked),A==null||A(de)},[r,n,Y,B,y,A]);Yc(()=>{oe.current&&(oe.current.indeterminate=!!y)},[y]),wi(()=>{n&&G(!1)},[n,G]),Yc(()=>{const de=oe.current;if(!(de!=null&&de.form))return;const _e=()=>{ae(!!h)};return de.form.addEventListener("reset",_e),()=>{var Pe;return(Pe=de.form)==null?void 0:Pe.removeEventListener("reset",_e)}},[]);const F=n&&!g,q=l.useCallback(de=>{de.key===" "&&V(!0)},[V]),pe=l.useCallback(de=>{de.key===" "&&V(!1)},[V]);Yc(()=>{if(!oe.current)return;oe.current.checked!==Y&&ae(oe.current.checked)},[oe.current]);const W=l.useCallback((de={},_e=null)=>{const Pe=ze=>{K&&ze.preventDefault(),V(!0)};return{...de,ref:_e,"data-active":Vt(te),"data-hover":Vt(X),"data-checked":Vt(Y),"data-focus":Vt(K),"data-focus-visible":Vt(K&&O),"data-indeterminate":Vt(y),"data-disabled":Vt(n),"data-invalid":Vt(s),"data-readonly":Vt(r),"aria-hidden":!0,onMouseDown:ot(de.onMouseDown,Pe),onMouseUp:ot(de.onMouseUp,()=>V(!1)),onMouseEnter:ot(de.onMouseEnter,()=>Z(!0)),onMouseLeave:ot(de.onMouseLeave,()=>Z(!1))}},[te,Y,n,K,O,X,y,s,r]),U=l.useCallback((de={},_e=null)=>({...de,ref:_e,"data-active":Vt(te),"data-hover":Vt(X),"data-checked":Vt(Y),"data-focus":Vt(K),"data-focus-visible":Vt(K&&O),"data-indeterminate":Vt(y),"data-disabled":Vt(n),"data-invalid":Vt(s),"data-readonly":Vt(r)}),[te,Y,n,K,O,X,y,s,r]),ee=l.useCallback((de={},_e=null)=>({...E,...de,ref:xn(_e,Pe=>{Pe&&se(Pe.tagName==="LABEL")}),onClick:ot(de.onClick,()=>{var Pe;ne||((Pe=oe.current)==null||Pe.click(),requestAnimationFrame(()=>{var ze;(ze=oe.current)==null||ze.focus({preventScroll:!0})}))}),"data-disabled":Vt(n),"data-checked":Vt(Y),"data-invalid":Vt(s)}),[E,n,Y,s,ne]),J=l.useCallback((de={},_e=null)=>({...de,ref:xn(oe,_e),type:"checkbox",name:x,value:w,id:i,tabIndex:S,onChange:ot(de.onChange,$),onBlur:ot(de.onBlur,R,()=>G(!1)),onFocus:ot(de.onFocus,D,()=>G(!0)),onKeyDown:ot(de.onKeyDown,q),onKeyUp:ot(de.onKeyUp,pe),required:o,checked:Y,disabled:F,readOnly:r,"aria-label":j,"aria-labelledby":I,"aria-invalid":_?!!_:s,"aria-describedby":p,"aria-disabled":n,style:ly}),[x,w,i,$,R,D,q,pe,o,Y,F,r,j,I,_,s,p,n,S]),ge=l.useCallback((de={},_e=null)=>({...de,ref:_e,onMouseDown:ot(de.onMouseDown,sz),"data-disabled":Vt(n),"data-checked":Vt(Y),"data-invalid":Vt(s)}),[Y,n,s]);return{state:{isInvalid:s,isFocused:K,isChecked:Y,isActive:te,isHovered:X,isIndeterminate:y,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:ee,getCheckboxProps:W,getIndicatorProps:U,getInputProps:J,getLabelProps:ge,htmlProps:E}}function sz(e){e.preventDefault(),e.stopPropagation()}var az={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},iz={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},lz=Si({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),cz=Si({from:{opacity:0},to:{opacity:1}}),uz=Si({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Tf=De(function(t,n){const r=BL(),o={...r,...t},s=no("Checkbox",o),i=lr(t),{spacing:c="0.5rem",className:d,children:p,iconColor:h,iconSize:m,icon:g=a.jsx(UL,{}),isChecked:b,isDisabled:y=r==null?void 0:r.isDisabled,onChange:x,inputProps:w,...S}=i;let j=b;r!=null&&r.value&&i.value&&(j=r.value.includes(i.value));let I=x;r!=null&&r.onChange&&i.value&&(I=pg(r.onChange,x));const{state:_,getInputProps:M,getCheckboxProps:E,getLabelProps:A,getRootProps:R}=qP({...S,isDisabled:y,isChecked:j,onChange:I}),D=HL(_.isChecked),O=l.useMemo(()=>({animation:D?_.isIndeterminate?`${cz} 20ms linear, ${uz} 200ms linear`:`${lz} 200ms linear`:void 0,fontSize:m,color:h,...s.icon}),[h,m,D,_.isIndeterminate,s.icon]),T=l.cloneElement(g,{__css:O,isIndeterminate:_.isIndeterminate,isChecked:_.isChecked});return a.jsxs(Ae.label,{__css:{...iz,...s.container},className:kt("chakra-checkbox",d),...R(),children:[a.jsx("input",{className:"chakra-checkbox__input",...M(w,n)}),a.jsx(Ae.span,{__css:{...az,...s.control},className:"chakra-checkbox__control",...E(),children:T}),p&&a.jsx(Ae.span,{className:"chakra-checkbox__label",...A(),__css:{marginStart:c,...s.label},children:p})]})});Tf.displayName="Checkbox";function dz(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function uy(e,t){let n=dz(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function mb(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 Zh(e,t,n){return(e-t)*100/(n-t)}function KP(e,t,n){return(n-t)*e+t}function gb(e,t,n){const r=Math.round((e-t)/n)*n+t,o=mb(n);return uy(r,o)}function tu(e,t,n){return e==null?e:(n{var O;return r==null?"":(O=Yv(r,s,n))!=null?O:""}),g=typeof o<"u",b=g?o:h,y=QP(Vi(b),s),x=n??y,w=l.useCallback(O=>{O!==b&&(g||m(O.toString()),p==null||p(O.toString(),Vi(O)))},[p,g,b]),S=l.useCallback(O=>{let T=O;return d&&(T=tu(T,i,c)),uy(T,x)},[x,d,c,i]),j=l.useCallback((O=s)=>{let T;b===""?T=Vi(O):T=Vi(b)+O,T=S(T),w(T)},[S,s,w,b]),I=l.useCallback((O=s)=>{let T;b===""?T=Vi(-O):T=Vi(b)-O,T=S(T),w(T)},[S,s,w,b]),_=l.useCallback(()=>{var O;let T;r==null?T="":T=(O=Yv(r,s,n))!=null?O:i,w(T)},[r,n,s,w,i]),M=l.useCallback(O=>{var T;const K=(T=Yv(O,s,x))!=null?T:i;w(K)},[x,s,w,i]),E=Vi(b);return{isOutOfRange:E>c||E" `}),[hz,dy]=Un({name:"EditableContext",errorMessage:"useEditableContext: context is undefined. Seems you forgot to wrap the editable components in ``"}),YP={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent"},Nf=De(function(t,n){const{getInputProps:r}=dy(),o=XP(),s=r(t,n),i=kt("chakra-editable__input",t.className);return a.jsx(Ae.input,{...s,__css:{outline:0,...YP,...o.input},className:i})});Nf.displayName="EditableInput";var $f=De(function(t,n){const{getPreviewProps:r}=dy(),o=XP(),s=r(t,n),i=kt("chakra-editable__preview",t.className);return a.jsx(Ae.span,{...s,__css:{cursor:"text",display:"inline-block",...YP,...o.preview},className:i})});$f.displayName="EditablePreview";function Nl(e,t,n,r){const o=vr(n);return l.useEffect(()=>{const s=typeof e=="function"?e():e??document;if(!(!n||!s))return s.addEventListener(t,o,r),()=>{s.removeEventListener(t,o,r)}},[t,e,r,o,n]),()=>{const s=typeof e=="function"?e():e??document;s==null||s.removeEventListener(t,o,r)}}function mz(e){return"current"in e}var JP=()=>typeof window<"u";function gz(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var vz=e=>JP()&&e.test(navigator.vendor),bz=e=>JP()&&e.test(gz()),xz=()=>bz(/mac|iphone|ipad|ipod/i),yz=()=>xz()&&vz(/apple/i);function ZP(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};Nl(o,"pointerdown",s=>{if(!yz()||!r)return;const i=s.target,d=(n??[t]).some(p=>{const h=mz(p)?p.current:p;return(h==null?void 0:h.contains(i))||h===i});o().activeElement!==i&&d&&(s.preventDefault(),i.focus())})}function BS(e,t){return e?e===t||e.contains(t):!1}function Cz(e={}){const{onChange:t,onCancel:n,onSubmit:r,onBlur:o,value:s,isDisabled:i,defaultValue:c,startWithEditView:d,isPreviewFocusable:p=!0,submitOnBlur:h=!0,selectAllOnFocus:m=!0,placeholder:g,onEdit:b,finalFocusRef:y,...x}=e,w=vr(b),S=!!(d&&!i),[j,I]=l.useState(S),[_,M]=Of({defaultValue:c||"",value:s,onChange:t}),[E,A]=l.useState(_),R=l.useRef(null),D=l.useRef(null),O=l.useRef(null),T=l.useRef(null),K=l.useRef(null);ZP({ref:R,enabled:j,elements:[T,K]});const G=!j&&!i;Yc(()=>{var W,U;j&&((W=R.current)==null||W.focus(),m&&((U=R.current)==null||U.select()))},[]),wi(()=>{var W,U,ee,J;if(!j){y?(W=y.current)==null||W.focus():(U=O.current)==null||U.focus();return}(ee=R.current)==null||ee.focus(),m&&((J=R.current)==null||J.select()),w==null||w()},[j,w,m]);const X=l.useCallback(()=>{G&&I(!0)},[G]),Z=l.useCallback(()=>{A(_)},[_]),te=l.useCallback(()=>{I(!1),M(E),n==null||n(E),o==null||o(E)},[n,o,M,E]),V=l.useCallback(()=>{I(!1),A(_),r==null||r(_),o==null||o(E)},[_,r,o,E]);l.useEffect(()=>{if(j)return;const W=R.current;(W==null?void 0:W.ownerDocument.activeElement)===W&&(W==null||W.blur())},[j]);const oe=l.useCallback(W=>{M(W.currentTarget.value)},[M]),ne=l.useCallback(W=>{const U=W.key,J={Escape:te,Enter:ge=>{!ge.shiftKey&&!ge.metaKey&&V()}}[U];J&&(W.preventDefault(),J(W))},[te,V]),se=l.useCallback(W=>{const U=W.key,J={Escape:te}[U];J&&(W.preventDefault(),J(W))},[te]),re=_.length===0,ae=l.useCallback(W=>{var U;if(!j)return;const ee=W.currentTarget.ownerDocument,J=(U=W.relatedTarget)!=null?U:ee.activeElement,ge=BS(T.current,J),he=BS(K.current,J);!ge&&!he&&(h?V():te())},[h,V,te,j]),B=l.useCallback((W={},U=null)=>{const ee=G&&p?0:void 0;return{...W,ref:xn(U,D),children:re?g:_,hidden:j,"aria-disabled":Ms(i),tabIndex:ee,onFocus:ot(W.onFocus,X,Z)}},[i,j,G,p,re,X,Z,g,_]),Y=l.useCallback((W={},U=null)=>({...W,hidden:!j,placeholder:g,ref:xn(U,R),disabled:i,"aria-disabled":Ms(i),value:_,onBlur:ot(W.onBlur,ae),onChange:ot(W.onChange,oe),onKeyDown:ot(W.onKeyDown,ne),onFocus:ot(W.onFocus,Z)}),[i,j,ae,oe,ne,Z,g,_]),$=l.useCallback((W={},U=null)=>({...W,hidden:!j,placeholder:g,ref:xn(U,R),disabled:i,"aria-disabled":Ms(i),value:_,onBlur:ot(W.onBlur,ae),onChange:ot(W.onChange,oe),onKeyDown:ot(W.onKeyDown,se),onFocus:ot(W.onFocus,Z)}),[i,j,ae,oe,se,Z,g,_]),F=l.useCallback((W={},U=null)=>({"aria-label":"Edit",...W,type:"button",onClick:ot(W.onClick,X),ref:xn(U,O),disabled:i}),[X,i]),q=l.useCallback((W={},U=null)=>({...W,"aria-label":"Submit",ref:xn(K,U),type:"button",onClick:ot(W.onClick,V),disabled:i}),[V,i]),pe=l.useCallback((W={},U=null)=>({"aria-label":"Cancel",id:"cancel",...W,ref:xn(T,U),type:"button",onClick:ot(W.onClick,te),disabled:i}),[te,i]);return{isEditing:j,isDisabled:i,isValueEmpty:re,value:_,onEdit:X,onCancel:te,onSubmit:V,getPreviewProps:B,getInputProps:Y,getTextareaProps:$,getEditButtonProps:F,getSubmitButtonProps:q,getCancelButtonProps:pe,htmlProps:x}}var Lf=De(function(t,n){const r=no("Editable",t),o=lr(t),{htmlProps:s,...i}=Cz(o),{isEditing:c,onSubmit:d,onCancel:p,onEdit:h}=i,m=kt("chakra-editable",t.className),g=Mx(t.children,{isEditing:c,onSubmit:d,onCancel:p,onEdit:h});return a.jsx(hz,{value:i,children:a.jsx(pz,{value:r,children:a.jsx(Ae.div,{ref:n,...s,className:m,children:g})})})});Lf.displayName="Editable";function e5(){const{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}=dy();return{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}}var t5={exports:{}},wz="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Sz=wz,kz=Sz;function n5(){}function r5(){}r5.resetWarningCache=n5;var jz=function(){function e(r,o,s,i,c,d){if(d!==kz){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:r5,resetWarningCache:n5};return n.PropTypes=n,n};t5.exports=jz();var _z=t5.exports;const nr=Sf(_z);var vb="data-focus-lock",o5="data-focus-lock-disabled",Iz="data-no-focus-lock",Pz="data-autofocus-inside",Ez="data-no-autofocus";function Mz(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Oz(e,t){var n=l.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}function s5(e,t){return Oz(t||null,function(n){return e.forEach(function(r){return Mz(r,n)})})}var Jv={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},wa=function(){return wa=Object.assign||function(t){for(var n,r=1,o=arguments.length;r=0}).sort(Gz)},qz=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],my=qz.join(","),Kz="".concat(my,", [data-focus-guard]"),S5=function(e,t){return Wa((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?Kz:my)?[r]:[],S5(r))},[])},Qz=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?kg([e.contentDocument.body],t):[e]},kg=function(e,t){return e.reduce(function(n,r){var o,s=S5(r,t),i=(o=[]).concat.apply(o,s.map(function(c){return Qz(c,t)}));return n.concat(i,r.parentNode?Wa(r.parentNode.querySelectorAll(my)).filter(function(c){return c===r}):[])},[])},Xz=function(e){var t=e.querySelectorAll("[".concat(Pz,"]"));return Wa(t).map(function(n){return kg([n])}).reduce(function(n,r){return n.concat(r)},[])},gy=function(e,t){return Wa(e).filter(function(n){return v5(t,n)}).filter(function(n){return Wz(n)})},HS=function(e,t){return t===void 0&&(t=new Map),Wa(e).filter(function(n){return b5(t,n)})},xb=function(e,t,n){return w5(gy(kg(e,n),t),!0,n)},WS=function(e,t){return w5(gy(kg(e),t),!1)},Yz=function(e,t){return gy(Xz(e),t)},nu=function(e,t){return e.shadowRoot?nu(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:Wa(e.children).some(function(n){var r;if(n instanceof HTMLIFrameElement){var o=(r=n.contentDocument)===null||r===void 0?void 0:r.body;return o?nu(o,t):!1}return nu(n,t)})},Jz=function(e){for(var t=new Set,n=e.length,r=0;r0&&t.add(o),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(i,c){return!t.has(c)})},k5=function(e){return e.parentNode?k5(e.parentNode):e},vy=function(e){var t=em(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(vb);return n.push.apply(n,o?Jz(Wa(k5(r).querySelectorAll("[".concat(vb,'="').concat(o,'"]:not([').concat(o5,'="disabled"])')))):[r]),n},[])},Zz=function(e){try{return e()}catch{return}},tf=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?tf(t.shadowRoot):t instanceof HTMLIFrameElement&&Zz(function(){return t.contentWindow.document})?tf(t.contentWindow.document):t}},eF=function(e,t){return e===t},tF=function(e,t){return!!Wa(e.querySelectorAll("iframe")).some(function(n){return eF(n,t)})},j5=function(e,t){return t===void 0&&(t=tf(h5(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:vy(e).some(function(n){return nu(n,t)||tF(n,t)})},nF=function(e){e===void 0&&(e=document);var t=tf(e);return t?Wa(e.querySelectorAll("[".concat(Iz,"]"))).some(function(n){return nu(n,t)}):!1},rF=function(e,t){return t.filter(C5).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},by=function(e,t){return C5(e)&&e.name?rF(e,t):e},oF=function(e){var t=new Set;return e.forEach(function(n){return t.add(by(n,e))}),e.filter(function(n){return t.has(n)})},VS=function(e){return e[0]&&e.length>1?by(e[0],e):e[0]},US=function(e,t){return e.length>1?e.indexOf(by(e[t],e)):t},_5="NEW_FOCUS",sF=function(e,t,n,r){var o=e.length,s=e[0],i=e[o-1],c=hy(n);if(!(n&&e.indexOf(n)>=0)){var d=n!==void 0?t.indexOf(n):-1,p=r?t.indexOf(r):d,h=r?e.indexOf(r):-1,m=d-p,g=t.indexOf(s),b=t.indexOf(i),y=oF(t),x=n!==void 0?y.indexOf(n):-1,w=x-(r?y.indexOf(r):d),S=US(e,0),j=US(e,o-1);if(d===-1||h===-1)return _5;if(!m&&h>=0)return h;if(d<=g&&c&&Math.abs(m)>1)return j;if(d>=b&&c&&Math.abs(m)>1)return S;if(m&&Math.abs(w)>1)return h;if(d<=g)return j;if(d>b)return S;if(m)return Math.abs(m)>1?h:(o+h+m)%o}},aF=function(e){return function(t){var n,r=(n=x5(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},iF=function(e,t,n){var r=e.map(function(s){var i=s.node;return i}),o=HS(r.filter(aF(n)));return o&&o.length?VS(o):VS(HS(t))},yb=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&yb(e.parentNode.host||e.parentNode,t),t},Zv=function(e,t){for(var n=yb(e),r=yb(t),o=0;o=0)return s}return!1},I5=function(e,t,n){var r=em(e),o=em(t),s=r[0],i=!1;return o.filter(Boolean).forEach(function(c){i=Zv(i||c,c)||i,n.filter(Boolean).forEach(function(d){var p=Zv(s,d);p&&(!i||nu(p,i)?i=p:i=Zv(p,i))})}),i},lF=function(e,t){return e.reduce(function(n,r){return n.concat(Yz(r,t))},[])},cF=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(Uz)},uF=function(e,t){var n=tf(em(e).length>0?document:h5(e).ownerDocument),r=vy(e).filter(tm),o=I5(n||e,e,r),s=new Map,i=WS(r,s),c=xb(r,s).filter(function(b){var y=b.node;return tm(y)});if(!(!c[0]&&(c=i,!c[0]))){var d=WS([o],s).map(function(b){var y=b.node;return y}),p=cF(d,c),h=p.map(function(b){var y=b.node;return y}),m=sF(h,d,n,t);if(m===_5){var g=iF(i,h,lF(r,s));if(g)return{node:g};console.warn("focus-lock: cannot find any node to move focus into");return}return m===void 0?m:p[m]}},dF=function(e){var t=vy(e).filter(tm),n=I5(e,e,t),r=new Map,o=xb([n],r,!0),s=xb(t,r).filter(function(i){var c=i.node;return tm(c)}).map(function(i){var c=i.node;return c});return o.map(function(i){var c=i.node,d=i.index;return{node:c,index:d,lockItem:s.indexOf(c)>=0,guard:hy(c)}})},fF=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},e1=0,t1=!1,P5=function(e,t,n){n===void 0&&(n={});var r=uF(e,t);if(!t1&&r){if(e1>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),t1=!0,setTimeout(function(){t1=!1},1);return}e1++,fF(r.node,n.focusOptions),e1--}};function xy(e){setTimeout(e,1)}var pF=function(){return document&&document.activeElement===document.body},hF=function(){return pF()||nF()},ru=null,qc=null,ou=null,nf=!1,mF=function(){return!0},gF=function(t){return(ru.whiteList||mF)(t)},vF=function(t,n){ou={observerNode:t,portaledElement:n}},bF=function(t){return ou&&ou.portaledElement===t};function GS(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 xF=function(t){return t&&"current"in t?t.current:t},yF=function(t){return t?!!nf:nf==="meanwhile"},CF=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},wF=function(t,n){return n.some(function(r){return CF(t,r,r)})},nm=function(){var t=!1;if(ru){var n=ru,r=n.observed,o=n.persistentFocus,s=n.autoFocus,i=n.shards,c=n.crossFrame,d=n.focusOptions,p=r||ou&&ou.portaledElement,h=document&&document.activeElement;if(p){var m=[p].concat(i.map(xF).filter(Boolean));if((!h||gF(h))&&(o||yF(c)||!hF()||!qc&&s)&&(p&&!(j5(m)||h&&wF(h,m)||bF(h))&&(document&&!qc&&h&&!s?(h.blur&&h.blur(),document.body.focus()):(t=P5(m,qc,{focusOptions:d}),ou={})),nf=!1,qc=document&&document.activeElement),document){var g=document&&document.activeElement,b=dF(m),y=b.map(function(x){var w=x.node;return w}).indexOf(g);y>-1&&(b.filter(function(x){var w=x.guard,S=x.node;return w&&S.dataset.focusAutoGuard}).forEach(function(x){var w=x.node;return w.removeAttribute("tabIndex")}),GS(y,b.length,1,b),GS(y,-1,-1,b))}}}return t},E5=function(t){nm()&&t&&(t.stopPropagation(),t.preventDefault())},yy=function(){return xy(nm)},SF=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||vF(r,n)},kF=function(){return null},M5=function(){nf="just",xy(function(){nf="meanwhile"})},jF=function(){document.addEventListener("focusin",E5),document.addEventListener("focusout",yy),window.addEventListener("blur",M5)},_F=function(){document.removeEventListener("focusin",E5),document.removeEventListener("focusout",yy),window.removeEventListener("blur",M5)};function IF(e){return e.filter(function(t){var n=t.disabled;return!n})}function PF(e){var t=e.slice(-1)[0];t&&!ru&&jF();var n=ru,r=n&&t&&t.id===n.id;ru=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(qc=null,(!r||n.observed!==t.observed)&&t.onActivation(),nm(),xy(nm)):(_F(),qc=null)}d5.assignSyncMedium(SF);f5.assignMedium(yy);Dz.assignMedium(function(e){return e({moveFocusInside:P5,focusInside:j5})});const EF=Lz(IF,PF)(kF);var O5=l.forwardRef(function(t,n){return l.createElement(p5,K1({sideCar:EF,ref:n},t))}),A5=p5.propTypes||{};A5.sideCar;T$(A5,["sideCar"]);O5.propTypes={};const qS=O5;function R5(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Cy(e){var t;if(!R5(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function MF(e){var t,n;return(n=(t=D5(e))==null?void 0:t.defaultView)!=null?n:window}function D5(e){return R5(e)?e.ownerDocument:document}function OF(e){return D5(e).activeElement}function AF(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 RF(e){return e.localName==="html"?e:e.assignedSlot||e.parentElement||e.ownerDocument.documentElement}function T5(e){return["html","body","#document"].includes(e.localName)?e.ownerDocument.body:Cy(e)&&AF(e)?e:T5(RF(e))}var N5=e=>e.hasAttribute("tabindex"),DF=e=>N5(e)&&e.tabIndex===-1;function TF(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function $5(e){return e.parentElement&&$5(e.parentElement)?!0:e.hidden}function NF(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function L5(e){if(!Cy(e)||$5(e)||TF(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]():NF(e)?!0:N5(e)}function $F(e){return e?Cy(e)&&L5(e)&&!DF(e):!1}var LF=["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]"],zF=LF.join(),FF=e=>e.offsetWidth>0&&e.offsetHeight>0;function z5(e){const t=Array.from(e.querySelectorAll(zF));return t.unshift(e),t.filter(n=>L5(n)&&FF(n))}var KS,BF=(KS=qS.default)!=null?KS:qS,F5=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:i,autoFocus:c,persistentFocus:d,lockFocusAcrossFrames:p}=e,h=l.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&z5(r.current).length===0&&requestAnimationFrame(()=>{var y;(y=r.current)==null||y.focus()})},[t,r]),m=l.useCallback(()=>{var b;(b=n==null?void 0:n.current)==null||b.focus()},[n]),g=o&&!n;return a.jsx(BF,{crossFrame:p,persistentFocus:d,autoFocus:c,disabled:i,onActivation:h,onDeactivation:m,returnFocus:g,children:s})};F5.displayName="FocusLock";var HF=Z$?l.useLayoutEffect:l.useEffect;function Cb(e,t=[]){const n=l.useRef(e);return HF(()=>{n.current=e}),l.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function WF(e,t,n,r){const o=Cb(t);return l.useEffect(()=>{var s;const i=(s=Fw(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=Fw(n))!=null?s:document).removeEventListener(e,o,r)}}function VF(e,t){const n=l.useId();return l.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function UF(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function hs(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=Cb(n),i=Cb(t),[c,d]=l.useState(e.defaultIsOpen||!1),[p,h]=UF(r,c),m=VF(o,"disclosure"),g=l.useCallback(()=>{p||d(!1),i==null||i()},[p,i]),b=l.useCallback(()=>{p||d(!0),s==null||s()},[p,s]),y=l.useCallback(()=>{(h?g:b)()},[h,b,g]);return{isOpen:!!h,onOpen:b,onClose:g,onToggle:y,isControlled:p,getButtonProps:(x={})=>({...x,"aria-expanded":h,"aria-controls":m,onClick:pD(x.onClick,y)}),getDisclosureProps:(x={})=>({...x,hidden:!h,id:m})}}var[GF,qF]=Un({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),B5=De(function(t,n){const r=no("Input",t),{children:o,className:s,...i}=lr(t),c=kt("chakra-input__group",s),d={},p=Sg(o),h=r.field;p.forEach(g=>{var b,y;r&&(h&&g.type.id==="InputLeftElement"&&(d.paddingStart=(b=h.height)!=null?b:h.h),h&&g.type.id==="InputRightElement"&&(d.paddingEnd=(y=h.height)!=null?y:h.h),g.type.id==="InputRightAddon"&&(d.borderEndRadius=0),g.type.id==="InputLeftAddon"&&(d.borderStartRadius=0))});const m=p.map(g=>{var b,y;const x=jI({size:((b=g.props)==null?void 0:b.size)||t.size,variant:((y=g.props)==null?void 0:y.variant)||t.variant});return g.type.id!=="Input"?l.cloneElement(g,x):l.cloneElement(g,Object.assign(x,d,g.props))});return a.jsx(Ae.div,{className:c,ref:n,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...i,children:a.jsx(GF,{value:r,children:m})})});B5.displayName="InputGroup";var KF=Ae("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),jg=De(function(t,n){var r,o;const{placement:s="left",...i}=t,c=qF(),d=c.field,h={[s==="left"?"insetStart":"insetEnd"]:"0",width:(r=d==null?void 0:d.height)!=null?r:d==null?void 0:d.h,height:(o=d==null?void 0:d.height)!=null?o:d==null?void 0:d.h,fontSize:d==null?void 0:d.fontSize,...c.element};return a.jsx(KF,{ref:n,__css:h,...i})});jg.id="InputElement";jg.displayName="InputElement";var H5=De(function(t,n){const{className:r,...o}=t,s=kt("chakra-input__left-element",r);return a.jsx(jg,{ref:n,placement:"left",className:s,...o})});H5.id="InputLeftElement";H5.displayName="InputLeftElement";var wy=De(function(t,n){const{className:r,...o}=t,s=kt("chakra-input__right-element",r);return a.jsx(jg,{ref:n,placement:"right",className:s,...o})});wy.id="InputRightElement";wy.displayName="InputRightElement";var _g=De(function(t,n){const{htmlSize:r,...o}=t,s=no("Input",o),i=lr(o),c=ay(i),d=kt("chakra-input",t.className);return a.jsx(Ae.input,{size:r,...c,__css:s.field,ref:n,className:d})});_g.displayName="Input";_g.id="Input";var Ig=De(function(t,n){const r=cl("Link",t),{className:o,isExternal:s,...i}=lr(t);return a.jsx(Ae.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:kt("chakra-link",o),...i,__css:r})});Ig.displayName="Link";var[QF,W5]=Un({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Sy=De(function(t,n){const r=no("List",t),{children:o,styleType:s="none",stylePosition:i,spacing:c,...d}=lr(t),p=Sg(o),m=c?{["& > *:not(style) ~ *:not(style)"]:{mt:c}}:{};return a.jsx(QF,{value:r,children:a.jsx(Ae.ul,{ref:n,listStyleType:s,listStylePosition:i,role:"list",__css:{...r.container,...m},...d,children:p})})});Sy.displayName="List";var V5=De((e,t)=>{const{as:n,...r}=e;return a.jsx(Sy,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});V5.displayName="OrderedList";var zf=De(function(t,n){const{as:r,...o}=t;return a.jsx(Sy,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});zf.displayName="UnorderedList";var Ps=De(function(t,n){const r=W5();return a.jsx(Ae.li,{ref:n,...t,__css:r.item})});Ps.displayName="ListItem";var XF=De(function(t,n){const r=W5();return a.jsx(Gr,{ref:n,role:"presentation",...t,__css:r.icon})});XF.displayName="ListIcon";var rl=De(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:i,column:c,row:d,autoFlow:p,autoRows:h,templateRows:m,autoColumns:g,templateColumns:b,...y}=t,x={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:i,gridAutoColumns:g,gridColumn:c,gridRow:d,gridAutoFlow:p,gridAutoRows:h,gridTemplateRows:m,gridTemplateColumns:b};return a.jsx(Ae.div,{ref:n,__css:x,...y})});rl.displayName="Grid";function U5(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):Q1(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var Pi=Ae("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});Pi.displayName="Spacer";var G5=e=>a.jsx(Ae.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});G5.displayName="StackItem";function YF(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{"&":U5(n,o=>r[o])}}var ky=De((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:i="0.5rem",wrap:c,children:d,divider:p,className:h,shouldWrapChildren:m,...g}=e,b=n?"row":r??"column",y=l.useMemo(()=>YF({spacing:i,direction:b}),[i,b]),x=!!p,w=!m&&!x,S=l.useMemo(()=>{const I=Sg(d);return w?I:I.map((_,M)=>{const E=typeof _.key<"u"?_.key:M,A=M+1===I.length,D=m?a.jsx(G5,{children:_},E):_;if(!x)return D;const O=l.cloneElement(p,{__css:y}),T=A?null:O;return a.jsxs(l.Fragment,{children:[D,T]},E)})},[p,y,x,w,m,d]),j=kt("chakra-stack",h);return a.jsx(Ae.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:b,flexWrap:c,gap:x?void 0:i,className:j,...g,children:S})});ky.displayName="Stack";var q5=De((e,t)=>a.jsx(ky,{align:"center",...e,direction:"column",ref:t}));q5.displayName="VStack";var Pg=De((e,t)=>a.jsx(ky,{align:"center",...e,direction:"row",ref:t}));Pg.displayName="HStack";function QS(e){return U5(e,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}var rf=De(function(t,n){const{area:r,colSpan:o,colStart:s,colEnd:i,rowEnd:c,rowSpan:d,rowStart:p,...h}=t,m=jI({gridArea:r,gridColumn:QS(o),gridRow:QS(d),gridColumnStart:s,gridColumnEnd:i,gridRowStart:p,gridRowEnd:c});return a.jsx(Ae.div,{ref:n,__css:m,...h})});rf.displayName="GridItem";var Va=De(function(t,n){const r=cl("Badge",t),{className:o,...s}=lr(t);return a.jsx(Ae.span,{ref:n,className:kt("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});Va.displayName="Badge";var io=De(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:i,borderWidth:c,borderStyle:d,borderColor:p,...h}=cl("Divider",t),{className:m,orientation:g="horizontal",__css:b,...y}=lr(t),x={vertical:{borderLeftWidth:r||i||c||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||c||"1px",width:"100%"}};return a.jsx(Ae.hr,{ref:n,"aria-orientation":g,...y,__css:{...h,border:"0",borderColor:p,borderStyle:d,...x[g],...b},className:kt("chakra-divider",m)})});io.displayName="Divider";function JF(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function ZF(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=l.useState([]),s=l.useRef(),i=()=>{s.current&&(clearTimeout(s.current),s.current=null)},c=()=>{i(),s.current=setTimeout(()=>{o([]),s.current=null},t)};l.useEffect(()=>i,[]);function d(p){return h=>{if(h.key==="Backspace"){const m=[...r];m.pop(),o(m);return}if(JF(h)){const m=r.concat(h.key);n(h)&&(h.preventDefault(),h.stopPropagation()),o(m),p(m.join("")),c()}}}return d}function eB(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 tB(){const e=l.useRef(new Map),t=e.current,n=l.useCallback((o,s,i,c)=>{e.current.set(i,{type:s,el:o,options:c}),o.addEventListener(s,i,c)},[]),r=l.useCallback((o,s,i,c)=>{o.removeEventListener(s,i,c),e.current.delete(i)},[]);return l.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function n1(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function K5(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:i,onMouseUp:c,onClick:d,onKeyDown:p,onKeyUp:h,tabIndex:m,onMouseOver:g,onMouseLeave:b,...y}=e,[x,w]=l.useState(!0),[S,j]=l.useState(!1),I=tB(),_=V=>{V&&V.tagName!=="BUTTON"&&w(!1)},M=x?m:m||0,E=n&&!r,A=l.useCallback(V=>{if(n){V.stopPropagation(),V.preventDefault();return}V.currentTarget.focus(),d==null||d(V)},[n,d]),R=l.useCallback(V=>{S&&n1(V)&&(V.preventDefault(),V.stopPropagation(),j(!1),I.remove(document,"keyup",R,!1))},[S,I]),D=l.useCallback(V=>{if(p==null||p(V),n||V.defaultPrevented||V.metaKey||!n1(V.nativeEvent)||x)return;const oe=o&&V.key==="Enter";s&&V.key===" "&&(V.preventDefault(),j(!0)),oe&&(V.preventDefault(),V.currentTarget.click()),I.add(document,"keyup",R,!1)},[n,x,p,o,s,I,R]),O=l.useCallback(V=>{if(h==null||h(V),n||V.defaultPrevented||V.metaKey||!n1(V.nativeEvent)||x)return;s&&V.key===" "&&(V.preventDefault(),j(!1),V.currentTarget.click())},[s,x,n,h]),T=l.useCallback(V=>{V.button===0&&(j(!1),I.remove(document,"mouseup",T,!1))},[I]),K=l.useCallback(V=>{if(V.button!==0)return;if(n){V.stopPropagation(),V.preventDefault();return}x||j(!0),V.currentTarget.focus({preventScroll:!0}),I.add(document,"mouseup",T,!1),i==null||i(V)},[n,x,i,I,T]),G=l.useCallback(V=>{V.button===0&&(x||j(!1),c==null||c(V))},[c,x]),X=l.useCallback(V=>{if(n){V.preventDefault();return}g==null||g(V)},[n,g]),Z=l.useCallback(V=>{S&&(V.preventDefault(),j(!1)),b==null||b(V)},[S,b]),te=xn(t,_);return x?{...y,ref:te,type:"button","aria-disabled":E?void 0:n,disabled:E,onClick:A,onMouseDown:i,onMouseUp:c,onKeyUp:h,onKeyDown:p,onMouseOver:g,onMouseLeave:b}:{...y,ref:te,role:"button","data-active":Vt(S),"aria-disabled":n?"true":void 0,tabIndex:E?void 0:M,onClick:A,onMouseDown:K,onMouseUp:G,onKeyUp:O,onKeyDown:D,onMouseOver:X,onMouseLeave:Z}}function nB(e){const t=e.current;if(!t)return!1;const n=OF(t);return!n||t.contains(n)?!1:!!$F(n)}function Q5(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;wi(()=>{if(!s||nB(e))return;const i=(o==null?void 0:o.current)||e.current;let c;if(i)return c=requestAnimationFrame(()=>{i.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(c)}},[s,e,o])}var rB={preventScroll:!0,shouldFocus:!1};function oB(e,t=rB){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,i=sB(e)?e.current:e,c=o&&s,d=l.useRef(c),p=l.useRef(s);Yc(()=>{!p.current&&s&&(d.current=c),p.current=s},[s,c]);const h=l.useCallback(()=>{if(!(!s||!i||!d.current)&&(d.current=!1,!i.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var m;(m=n.current)==null||m.focus({preventScroll:r})});else{const m=z5(i);m.length>0&&requestAnimationFrame(()=>{m[0].focus({preventScroll:r})})}},[s,r,i,n]);wi(()=>{h()},[h]),Nl(i,"transitionend",h)}function sB(e){return"current"in e}var _c=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),qr={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 aB(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 iB={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"},lB=e=>iB[e],XS={scroll:!0,resize:!0};function cB(e){let t;return typeof e=="object"?t={enabled:!0,options:{...XS,...e}}:t={enabled:e,options:XS},t}var uB={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`}},dB={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{YS(e)},effect:({state:e})=>()=>{YS(e)}},YS=e=>{e.elements.popper.style.setProperty(qr.transformOrigin.var,lB(e.placement))},fB={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{pB(e)}},pB=e=>{var t;if(!e.placement)return;const n=hB(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:qr.arrowSize.varRef,height:qr.arrowSize.varRef,zIndex:-1});const r={[qr.arrowSizeHalf.var]:`calc(${qr.arrowSize.varRef} / 2 - 1px)`,[qr.arrowOffset.var]:`calc(${qr.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},hB=e=>{if(e.startsWith("top"))return{property:"bottom",value:qr.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:qr.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:qr.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:qr.arrowOffset.varRef}},mB={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{JS(e)},effect:({state:e})=>()=>{JS(e)}},JS=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=aB(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:qr.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},gB={"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"}},vB={"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 bB(e,t="ltr"){var n,r;const o=((n=gB[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=vB[e])!=null?r:o}var qo="top",Ds="bottom",Ts="right",Ko="left",jy="auto",Ff=[qo,Ds,Ts,Ko],pu="start",of="end",xB="clippingParents",X5="viewport",bd="popper",yB="reference",ZS=Ff.reduce(function(e,t){return e.concat([t+"-"+pu,t+"-"+of])},[]),Y5=[].concat(Ff,[jy]).reduce(function(e,t){return e.concat([t,t+"-"+pu,t+"-"+of])},[]),CB="beforeRead",wB="read",SB="afterRead",kB="beforeMain",jB="main",_B="afterMain",IB="beforeWrite",PB="write",EB="afterWrite",MB=[CB,wB,SB,kB,jB,_B,IB,PB,EB];function Ma(e){return e?(e.nodeName||"").toLowerCase():null}function ms(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gl(e){var t=ms(e).Element;return e instanceof t||e instanceof Element}function Os(e){var t=ms(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function _y(e){if(typeof ShadowRoot>"u")return!1;var t=ms(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function OB(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];!Os(s)||!Ma(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var c=o[i];c===!1?s.removeAttribute(i):s.setAttribute(i,c===!0?"":c)}))})}function AB(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],s=t.attributes[r]||{},i=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),c=i.reduce(function(d,p){return d[p]="",d},{});!Os(o)||!Ma(o)||(Object.assign(o.style,c),Object.keys(s).forEach(function(d){o.removeAttribute(d)}))})}}const RB={name:"applyStyles",enabled:!0,phase:"write",fn:OB,effect:AB,requires:["computeStyles"]};function Pa(e){return e.split("-")[0]}var $l=Math.max,rm=Math.min,hu=Math.round;function wb(){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 J5(){return!/^((?!chrome|android).)*safari/i.test(wb())}function mu(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&Os(e)&&(o=e.offsetWidth>0&&hu(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&hu(r.height)/e.offsetHeight||1);var i=Gl(e)?ms(e):window,c=i.visualViewport,d=!J5()&&n,p=(r.left+(d&&c?c.offsetLeft:0))/o,h=(r.top+(d&&c?c.offsetTop:0))/s,m=r.width/o,g=r.height/s;return{width:m,height:g,top:h,right:p+m,bottom:h+g,left:p,x:p,y:h}}function Iy(e){var t=mu(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 Z5(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&_y(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 ms(e).getComputedStyle(e)}function DB(e){return["table","td","th"].indexOf(Ma(e))>=0}function ul(e){return((Gl(e)?e.ownerDocument:e.document)||window.document).documentElement}function Eg(e){return Ma(e)==="html"?e:e.assignedSlot||e.parentNode||(_y(e)?e.host:null)||ul(e)}function ek(e){return!Os(e)||fi(e).position==="fixed"?null:e.offsetParent}function TB(e){var t=/firefox/i.test(wb()),n=/Trident/i.test(wb());if(n&&Os(e)){var r=fi(e);if(r.position==="fixed")return null}var o=Eg(e);for(_y(o)&&(o=o.host);Os(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 Bf(e){for(var t=ms(e),n=ek(e);n&&DB(n)&&fi(n).position==="static";)n=ek(n);return n&&(Ma(n)==="html"||Ma(n)==="body"&&fi(n).position==="static")?t:n||TB(e)||t}function Py(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Bd(e,t,n){return $l(e,rm(t,n))}function NB(e,t,n){var r=Bd(e,t,n);return r>n?n:r}function e3(){return{top:0,right:0,bottom:0,left:0}}function t3(e){return Object.assign({},e3(),e)}function n3(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var $B=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,t3(typeof t!="number"?t:n3(t,Ff))};function LB(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,c=Pa(n.placement),d=Py(c),p=[Ko,Ts].indexOf(c)>=0,h=p?"height":"width";if(!(!s||!i)){var m=$B(o.padding,n),g=Iy(s),b=d==="y"?qo:Ko,y=d==="y"?Ds:Ts,x=n.rects.reference[h]+n.rects.reference[d]-i[d]-n.rects.popper[h],w=i[d]-n.rects.reference[d],S=Bf(s),j=S?d==="y"?S.clientHeight||0:S.clientWidth||0:0,I=x/2-w/2,_=m[b],M=j-g[h]-m[y],E=j/2-g[h]/2+I,A=Bd(_,E,M),R=d;n.modifiersData[r]=(t={},t[R]=A,t.centerOffset=A-E,t)}}function zB(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)||Z5(t.elements.popper,o)&&(t.elements.arrow=o))}const FB={name:"arrow",enabled:!0,phase:"main",fn:LB,effect:zB,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function gu(e){return e.split("-")[1]}var BB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function HB(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:hu(n*o)/o||0,y:hu(r*o)/o||0}}function tk(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,i=e.offsets,c=e.position,d=e.gpuAcceleration,p=e.adaptive,h=e.roundOffsets,m=e.isFixed,g=i.x,b=g===void 0?0:g,y=i.y,x=y===void 0?0:y,w=typeof h=="function"?h({x:b,y:x}):{x:b,y:x};b=w.x,x=w.y;var S=i.hasOwnProperty("x"),j=i.hasOwnProperty("y"),I=Ko,_=qo,M=window;if(p){var E=Bf(n),A="clientHeight",R="clientWidth";if(E===ms(n)&&(E=ul(n),fi(E).position!=="static"&&c==="absolute"&&(A="scrollHeight",R="scrollWidth")),E=E,o===qo||(o===Ko||o===Ts)&&s===of){_=Ds;var D=m&&E===M&&M.visualViewport?M.visualViewport.height:E[A];x-=D-r.height,x*=d?1:-1}if(o===Ko||(o===qo||o===Ds)&&s===of){I=Ts;var O=m&&E===M&&M.visualViewport?M.visualViewport.width:E[R];b-=O-r.width,b*=d?1:-1}}var T=Object.assign({position:c},p&&BB),K=h===!0?HB({x:b,y:x},ms(n)):{x:b,y:x};if(b=K.x,x=K.y,d){var G;return Object.assign({},T,(G={},G[_]=j?"0":"",G[I]=S?"0":"",G.transform=(M.devicePixelRatio||1)<=1?"translate("+b+"px, "+x+"px)":"translate3d("+b+"px, "+x+"px, 0)",G))}return Object.assign({},T,(t={},t[_]=j?x+"px":"",t[I]=S?b+"px":"",t.transform="",t))}function WB(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,i=s===void 0?!0:s,c=n.roundOffsets,d=c===void 0?!0:c,p={placement:Pa(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,tk(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:d})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,tk(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:d})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const VB={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:WB,data:{}};var Xp={passive:!0};function UB(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,c=i===void 0?!0:i,d=ms(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(h){h.addEventListener("scroll",n.update,Xp)}),c&&d.addEventListener("resize",n.update,Xp),function(){s&&p.forEach(function(h){h.removeEventListener("scroll",n.update,Xp)}),c&&d.removeEventListener("resize",n.update,Xp)}}const GB={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:UB,data:{}};var qB={left:"right",right:"left",bottom:"top",top:"bottom"};function Ph(e){return e.replace(/left|right|bottom|top/g,function(t){return qB[t]})}var KB={start:"end",end:"start"};function nk(e){return e.replace(/start|end/g,function(t){return KB[t]})}function Ey(e){var t=ms(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function My(e){return mu(ul(e)).left+Ey(e).scrollLeft}function QB(e,t){var n=ms(e),r=ul(e),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,c=0,d=0;if(o){s=o.width,i=o.height;var p=J5();(p||!p&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}return{width:s,height:i,x:c+My(e),y:d}}function XB(e){var t,n=ul(e),r=Ey(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=$l(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=$l(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),c=-r.scrollLeft+My(e),d=-r.scrollTop;return fi(o||n).direction==="rtl"&&(c+=$l(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:c,y:d}}function Oy(e){var t=fi(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function r3(e){return["html","body","#document"].indexOf(Ma(e))>=0?e.ownerDocument.body:Os(e)&&Oy(e)?e:r3(Eg(e))}function Hd(e,t){var n;t===void 0&&(t=[]);var r=r3(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=ms(r),i=o?[s].concat(s.visualViewport||[],Oy(r)?r:[]):r,c=t.concat(i);return o?c:c.concat(Hd(Eg(i)))}function Sb(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function YB(e,t){var n=mu(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 rk(e,t,n){return t===X5?Sb(QB(e,n)):Gl(t)?YB(t,n):Sb(XB(ul(e)))}function JB(e){var t=Hd(Eg(e)),n=["absolute","fixed"].indexOf(fi(e).position)>=0,r=n&&Os(e)?Bf(e):e;return Gl(r)?t.filter(function(o){return Gl(o)&&Z5(o,r)&&Ma(o)!=="body"}):[]}function ZB(e,t,n,r){var o=t==="clippingParents"?JB(e):[].concat(t),s=[].concat(o,[n]),i=s[0],c=s.reduce(function(d,p){var h=rk(e,p,r);return d.top=$l(h.top,d.top),d.right=rm(h.right,d.right),d.bottom=rm(h.bottom,d.bottom),d.left=$l(h.left,d.left),d},rk(e,i,r));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}function o3(e){var t=e.reference,n=e.element,r=e.placement,o=r?Pa(r):null,s=r?gu(r):null,i=t.x+t.width/2-n.width/2,c=t.y+t.height/2-n.height/2,d;switch(o){case qo:d={x:i,y:t.y-n.height};break;case Ds:d={x:i,y:t.y+t.height};break;case Ts:d={x:t.x+t.width,y:c};break;case Ko:d={x:t.x-n.width,y:c};break;default:d={x:t.x,y:t.y}}var p=o?Py(o):null;if(p!=null){var h=p==="y"?"height":"width";switch(s){case pu:d[p]=d[p]-(t[h]/2-n[h]/2);break;case of:d[p]=d[p]+(t[h]/2-n[h]/2);break}}return d}function sf(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,i=s===void 0?e.strategy:s,c=n.boundary,d=c===void 0?xB:c,p=n.rootBoundary,h=p===void 0?X5:p,m=n.elementContext,g=m===void 0?bd:m,b=n.altBoundary,y=b===void 0?!1:b,x=n.padding,w=x===void 0?0:x,S=t3(typeof w!="number"?w:n3(w,Ff)),j=g===bd?yB:bd,I=e.rects.popper,_=e.elements[y?j:g],M=ZB(Gl(_)?_:_.contextElement||ul(e.elements.popper),d,h,i),E=mu(e.elements.reference),A=o3({reference:E,element:I,strategy:"absolute",placement:o}),R=Sb(Object.assign({},I,A)),D=g===bd?R:E,O={top:M.top-D.top+S.top,bottom:D.bottom-M.bottom+S.bottom,left:M.left-D.left+S.left,right:D.right-M.right+S.right},T=e.modifiersData.offset;if(g===bd&&T){var K=T[o];Object.keys(O).forEach(function(G){var X=[Ts,Ds].indexOf(G)>=0?1:-1,Z=[qo,Ds].indexOf(G)>=0?"y":"x";O[G]+=K[Z]*X})}return O}function eH(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,c=n.flipVariations,d=n.allowedAutoPlacements,p=d===void 0?Y5:d,h=gu(r),m=h?c?ZS:ZS.filter(function(y){return gu(y)===h}):Ff,g=m.filter(function(y){return p.indexOf(y)>=0});g.length===0&&(g=m);var b=g.reduce(function(y,x){return y[x]=sf(e,{placement:x,boundary:o,rootBoundary:s,padding:i})[Pa(x)],y},{});return Object.keys(b).sort(function(y,x){return b[y]-b[x]})}function tH(e){if(Pa(e)===jy)return[];var t=Ph(e);return[nk(e),t,nk(t)]}function nH(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,c=i===void 0?!0:i,d=n.fallbackPlacements,p=n.padding,h=n.boundary,m=n.rootBoundary,g=n.altBoundary,b=n.flipVariations,y=b===void 0?!0:b,x=n.allowedAutoPlacements,w=t.options.placement,S=Pa(w),j=S===w,I=d||(j||!y?[Ph(w)]:tH(w)),_=[w].concat(I).reduce(function(Y,$){return Y.concat(Pa($)===jy?eH(t,{placement:$,boundary:h,rootBoundary:m,padding:p,flipVariations:y,allowedAutoPlacements:x}):$)},[]),M=t.rects.reference,E=t.rects.popper,A=new Map,R=!0,D=_[0],O=0;O<_.length;O++){var T=_[O],K=Pa(T),G=gu(T)===pu,X=[qo,Ds].indexOf(K)>=0,Z=X?"width":"height",te=sf(t,{placement:T,boundary:h,rootBoundary:m,altBoundary:g,padding:p}),V=X?G?Ts:Ko:G?Ds:qo;M[Z]>E[Z]&&(V=Ph(V));var oe=Ph(V),ne=[];if(s&&ne.push(te[K]<=0),c&&ne.push(te[V]<=0,te[oe]<=0),ne.every(function(Y){return Y})){D=T,R=!1;break}A.set(T,ne)}if(R)for(var se=y?3:1,re=function($){var F=_.find(function(q){var pe=A.get(q);if(pe)return pe.slice(0,$).every(function(W){return W})});if(F)return D=F,"break"},ae=se;ae>0;ae--){var B=re(ae);if(B==="break")break}t.placement!==D&&(t.modifiersData[r]._skip=!0,t.placement=D,t.reset=!0)}}const rH={name:"flip",enabled:!0,phase:"main",fn:nH,requiresIfExists:["offset"],data:{_skip:!1}};function ok(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 sk(e){return[qo,Ts,Ds,Ko].some(function(t){return e[t]>=0})}function oH(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,i=sf(t,{elementContext:"reference"}),c=sf(t,{altBoundary:!0}),d=ok(i,r),p=ok(c,o,s),h=sk(d),m=sk(p);t.modifiersData[n]={referenceClippingOffsets:d,popperEscapeOffsets:p,isReferenceHidden:h,hasPopperEscaped:m},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":m})}const sH={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:oH};function aH(e,t,n){var r=Pa(e),o=[Ko,qo].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=s[0],c=s[1];return i=i||0,c=(c||0)*o,[Ko,Ts].indexOf(r)>=0?{x:c,y:i}:{x:i,y:c}}function iH(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,i=Y5.reduce(function(h,m){return h[m]=aH(m,t.rects,s),h},{}),c=i[t.placement],d=c.x,p=c.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=d,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=i}const lH={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:iH};function cH(e){var t=e.state,n=e.name;t.modifiersData[n]=o3({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const uH={name:"popperOffsets",enabled:!0,phase:"read",fn:cH,data:{}};function dH(e){return e==="x"?"y":"x"}function fH(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,c=i===void 0?!1:i,d=n.boundary,p=n.rootBoundary,h=n.altBoundary,m=n.padding,g=n.tether,b=g===void 0?!0:g,y=n.tetherOffset,x=y===void 0?0:y,w=sf(t,{boundary:d,rootBoundary:p,padding:m,altBoundary:h}),S=Pa(t.placement),j=gu(t.placement),I=!j,_=Py(S),M=dH(_),E=t.modifiersData.popperOffsets,A=t.rects.reference,R=t.rects.popper,D=typeof x=="function"?x(Object.assign({},t.rects,{placement:t.placement})):x,O=typeof D=="number"?{mainAxis:D,altAxis:D}:Object.assign({mainAxis:0,altAxis:0},D),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,K={x:0,y:0};if(E){if(s){var G,X=_==="y"?qo:Ko,Z=_==="y"?Ds:Ts,te=_==="y"?"height":"width",V=E[_],oe=V+w[X],ne=V-w[Z],se=b?-R[te]/2:0,re=j===pu?A[te]:R[te],ae=j===pu?-R[te]:-A[te],B=t.elements.arrow,Y=b&&B?Iy(B):{width:0,height:0},$=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:e3(),F=$[X],q=$[Z],pe=Bd(0,A[te],Y[te]),W=I?A[te]/2-se-pe-F-O.mainAxis:re-pe-F-O.mainAxis,U=I?-A[te]/2+se+pe+q+O.mainAxis:ae+pe+q+O.mainAxis,ee=t.elements.arrow&&Bf(t.elements.arrow),J=ee?_==="y"?ee.clientTop||0:ee.clientLeft||0:0,ge=(G=T==null?void 0:T[_])!=null?G:0,he=V+W-ge-J,de=V+U-ge,_e=Bd(b?rm(oe,he):oe,V,b?$l(ne,de):ne);E[_]=_e,K[_]=_e-V}if(c){var Pe,ze=_==="x"?qo:Ko,ht=_==="x"?Ds:Ts,Je=E[M],qt=M==="y"?"height":"width",Pt=Je+w[ze],jt=Je-w[ht],Se=[qo,Ko].indexOf(S)!==-1,Fe=(Pe=T==null?void 0:T[M])!=null?Pe:0,it=Se?Pt:Je-A[qt]-R[qt]-Fe+O.altAxis,At=Se?Je+A[qt]+R[qt]-Fe-O.altAxis:jt,ke=b&&Se?NB(it,Je,At):Bd(b?it:Pt,Je,b?At:jt);E[M]=ke,K[M]=ke-Je}t.modifiersData[r]=K}}const pH={name:"preventOverflow",enabled:!0,phase:"main",fn:fH,requiresIfExists:["offset"]};function hH(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function mH(e){return e===ms(e)||!Os(e)?Ey(e):hH(e)}function gH(e){var t=e.getBoundingClientRect(),n=hu(t.width)/e.offsetWidth||1,r=hu(t.height)/e.offsetHeight||1;return n!==1||r!==1}function vH(e,t,n){n===void 0&&(n=!1);var r=Os(t),o=Os(t)&&gH(t),s=ul(t),i=mu(e,o,n),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(r||!r&&!n)&&((Ma(t)!=="body"||Oy(s))&&(c=mH(t)),Os(t)?(d=mu(t,!0),d.x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=My(s))),{x:i.left+c.scrollLeft-d.x,y:i.top+c.scrollTop-d.y,width:i.width,height:i.height}}function bH(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var i=[].concat(s.requires||[],s.requiresIfExists||[]);i.forEach(function(c){if(!n.has(c)){var d=t.get(c);d&&o(d)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function xH(e){var t=bH(e);return MB.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function yH(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function CH(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 ak={placement:"bottom",modifiers:[],strategy:"absolute"};function ik(){for(var e=arguments.length,t=new Array(e),n=0;n{}),I=l.useCallback(()=>{var O;!t||!y.current||!x.current||((O=j.current)==null||O.call(j),w.current=kH(y.current,x.current,{placement:S,modifiers:[mB,fB,dB,{...uB,enabled:!!g},{name:"eventListeners",...cB(i)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:c??[0,d]}},{name:"flip",enabled:!!p,options:{padding:8}},{name:"preventOverflow",enabled:!!m,options:{boundary:h}},...n??[]],strategy:o}),w.current.forceUpdate(),j.current=w.current.destroy)},[S,t,n,g,i,s,c,d,p,m,h,o]);l.useEffect(()=>()=>{var O;!y.current&&!x.current&&((O=w.current)==null||O.destroy(),w.current=null)},[]);const _=l.useCallback(O=>{y.current=O,I()},[I]),M=l.useCallback((O={},T=null)=>({...O,ref:xn(_,T)}),[_]),E=l.useCallback(O=>{x.current=O,I()},[I]),A=l.useCallback((O={},T=null)=>({...O,ref:xn(E,T),style:{...O.style,position:o,minWidth:g?void 0:"max-content",inset:"0 auto auto 0"}}),[o,E,g]),R=l.useCallback((O={},T=null)=>{const{size:K,shadowColor:G,bg:X,style:Z,...te}=O;return{...te,ref:T,"data-popper-arrow":"",style:jH(O)}},[]),D=l.useCallback((O={},T=null)=>({...O,ref:T,"data-popper-arrow-inner":""}),[]);return{update(){var O;(O=w.current)==null||O.update()},forceUpdate(){var O;(O=w.current)==null||O.forceUpdate()},transformOrigin:qr.transformOrigin.varRef,referenceRef:_,popperRef:E,getPopperProps:A,getArrowProps:R,getArrowInnerProps:D,getReferenceProps:M}}function jH(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 Ry(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=vr(n),i=vr(t),[c,d]=l.useState(e.defaultIsOpen||!1),p=r!==void 0?r:c,h=r!==void 0,m=l.useId(),g=o??`disclosure-${m}`,b=l.useCallback(()=>{h||d(!1),i==null||i()},[h,i]),y=l.useCallback(()=>{h||d(!0),s==null||s()},[h,s]),x=l.useCallback(()=>{p?b():y()},[p,y,b]);function w(j={}){return{...j,"aria-expanded":p,"aria-controls":g,onClick(I){var _;(_=j.onClick)==null||_.call(j,I),x()}}}function S(j={}){return{...j,hidden:!p,id:g}}return{isOpen:p,onOpen:y,onClose:b,onToggle:x,isControlled:h,getButtonProps:w,getDisclosureProps:S}}function _H(e){const{ref:t,handler:n,enabled:r=!0}=e,o=vr(n),i=l.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;l.useEffect(()=>{if(!r)return;const c=m=>{r1(m,t)&&(i.isPointerDown=!0)},d=m=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&r1(m,t)&&(i.isPointerDown=!1,o(m))},p=m=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&r1(m,t)&&(i.isPointerDown=!1,o(m))},h=s3(t.current);return h.addEventListener("mousedown",c,!0),h.addEventListener("mouseup",d,!0),h.addEventListener("touchstart",c,!0),h.addEventListener("touchend",p,!0),()=>{h.removeEventListener("mousedown",c,!0),h.removeEventListener("mouseup",d,!0),h.removeEventListener("touchstart",c,!0),h.removeEventListener("touchend",p,!0)}},[n,t,o,i,r])}function r1(e,t){var n;const r=e.target;return r&&!s3(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function s3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function a3(e){const{isOpen:t,ref:n}=e,[r,o]=l.useState(t),[s,i]=l.useState(!1);return l.useEffect(()=>{s||(o(t),i(!0))},[t,s,r]),Nl(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var d;const p=MF(n.current),h=new p.CustomEvent("animationend",{bubbles:!0});(d=n.current)==null||d.dispatchEvent(h)}}}function Dy(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[IH,PH,EH,MH]=ry(),[OH,Hf]=Un({strict:!1,name:"MenuContext"});function AH(e,...t){const n=l.useId(),r=e||n;return l.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function i3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function lk(e){return i3(e).activeElement===e}function RH(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:i,isOpen:c,defaultIsOpen:d,onClose:p,onOpen:h,placement:m="bottom-start",lazyBehavior:g="unmount",direction:b,computePositionOnMount:y=!1,...x}=e,w=l.useRef(null),S=l.useRef(null),j=EH(),I=l.useCallback(()=>{requestAnimationFrame(()=>{var B;(B=w.current)==null||B.focus({preventScroll:!1})})},[]),_=l.useCallback(()=>{const B=setTimeout(()=>{var Y;if(o)(Y=o.current)==null||Y.focus();else{const $=j.firstEnabled();$&&G($.index)}});oe.current.add(B)},[j,o]),M=l.useCallback(()=>{const B=setTimeout(()=>{const Y=j.lastEnabled();Y&&G(Y.index)});oe.current.add(B)},[j]),E=l.useCallback(()=>{h==null||h(),s?_():I()},[s,_,I,h]),{isOpen:A,onOpen:R,onClose:D,onToggle:O}=Ry({isOpen:c,defaultIsOpen:d,onClose:p,onOpen:E});_H({enabled:A&&r,ref:w,handler:B=>{var Y;(Y=S.current)!=null&&Y.contains(B.target)||D()}});const T=Ay({...x,enabled:A||y,placement:m,direction:b}),[K,G]=l.useState(-1);wi(()=>{A||G(-1)},[A]),Q5(w,{focusRef:S,visible:A,shouldFocus:!0});const X=a3({isOpen:A,ref:w}),[Z,te]=AH(t,"menu-button","menu-list"),V=l.useCallback(()=>{R(),I()},[R,I]),oe=l.useRef(new Set([]));l.useEffect(()=>{const B=oe.current;return()=>{B.forEach(Y=>clearTimeout(Y)),B.clear()}},[]);const ne=l.useCallback(()=>{R(),_()},[_,R]),se=l.useCallback(()=>{R(),M()},[R,M]),re=l.useCallback(()=>{var B,Y;const $=i3(w.current),F=(B=w.current)==null?void 0:B.contains($.activeElement);if(!(A&&!F))return;const pe=(Y=j.item(K))==null?void 0:Y.node;pe==null||pe.focus({preventScroll:!0})},[A,K,j]),ae=l.useRef(null);return{openAndFocusMenu:V,openAndFocusFirstItem:ne,openAndFocusLastItem:se,onTransitionEnd:re,unstable__animationState:X,descendants:j,popper:T,buttonId:Z,menuId:te,forceUpdate:T.forceUpdate,orientation:"vertical",isOpen:A,onToggle:O,onOpen:R,onClose:D,menuRef:w,buttonRef:S,focusedIndex:K,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:G,isLazy:i,lazyBehavior:g,initialFocusRef:o,rafId:ae}}function DH(e={},t=null){const n=Hf(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:i}=n,c=l.useCallback(d=>{const p=d.key,m={Enter:s,ArrowDown:s,ArrowUp:i}[p];m&&(d.preventDefault(),d.stopPropagation(),m(d))},[s,i]);return{...e,ref:xn(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":Vt(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:ot(e.onClick,r),onKeyDown:ot(e.onKeyDown,c)}}function kb(e){var t;return LH(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function TH(e={},t=null){const n=Hf();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:i,onClose:c,menuId:d,isLazy:p,lazyBehavior:h,unstable__animationState:m}=n,g=PH(),b=ZF({preventDefault:S=>S.key!==" "&&kb(S.target)}),y=l.useCallback(S=>{if(!S.currentTarget.contains(S.target))return;const j=S.key,_={Tab:E=>E.preventDefault(),Escape:c,ArrowDown:()=>{const E=g.nextEnabled(r);E&&o(E.index)},ArrowUp:()=>{const E=g.prevEnabled(r);E&&o(E.index)}}[j];if(_){S.preventDefault(),_(S);return}const M=b(E=>{const A=eB(g.values(),E,R=>{var D,O;return(O=(D=R==null?void 0:R.node)==null?void 0:D.textContent)!=null?O:""},g.item(r));if(A){const R=g.indexOf(A.node);o(R)}});kb(S.target)&&M(S)},[g,r,b,c,o]),x=l.useRef(!1);i&&(x.current=!0);const w=Dy({wasSelected:x.current,enabled:p,mode:h,isSelected:m.present});return{...e,ref:xn(s,t),children:w?e.children:null,tabIndex:-1,role:"menu",id:d,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:ot(e.onKeyDown,y)}}function NH(e={}){const{popper:t,isOpen:n}=Hf();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function $H(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:i,isDisabled:c,isFocusable:d,closeOnSelect:p,type:h,...m}=e,g=Hf(),{setFocusedIndex:b,focusedIndex:y,closeOnSelect:x,onClose:w,menuRef:S,isOpen:j,menuId:I,rafId:_}=g,M=l.useRef(null),E=`${I}-menuitem-${l.useId()}`,{index:A,register:R}=MH({disabled:c&&!d}),D=l.useCallback(V=>{n==null||n(V),!c&&b(A)},[b,A,c,n]),O=l.useCallback(V=>{r==null||r(V),M.current&&!lk(M.current)&&D(V)},[D,r]),T=l.useCallback(V=>{o==null||o(V),!c&&b(-1)},[b,c,o]),K=l.useCallback(V=>{s==null||s(V),kb(V.currentTarget)&&(p??x)&&w()},[w,s,x,p]),G=l.useCallback(V=>{i==null||i(V),b(A)},[b,i,A]),X=A===y,Z=c&&!d;wi(()=>{if(j)return X&&!Z&&M.current?(_.current&&cancelAnimationFrame(_.current),_.current=requestAnimationFrame(()=>{var V;(V=M.current)==null||V.focus({preventScroll:!0}),_.current=null})):S.current&&!lk(S.current)&&S.current.focus({preventScroll:!0}),()=>{_.current&&cancelAnimationFrame(_.current)}},[X,Z,S,j]);const te=K5({onClick:K,onFocus:G,onMouseEnter:D,onMouseMove:O,onMouseLeave:T,ref:xn(R,M,t),isDisabled:c,isFocusable:d});return{...m,...te,type:h??te.type,id:E,role:"menuitem",tabIndex:X?0:-1}}function LH(e){var t;if(!zH(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function zH(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}var[FH,Tu]=Un({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Mg=e=>{const{children:t}=e,n=no("Menu",e),r=lr(e),{direction:o}=kf(),{descendants:s,...i}=RH({...r,direction:o}),c=l.useMemo(()=>i,[i]),{isOpen:d,onClose:p,forceUpdate:h}=c;return a.jsx(IH,{value:s,children:a.jsx(OH,{value:c,children:a.jsx(FH,{value:n,children:Mx(t,{isOpen:d,onClose:p,forceUpdate:h})})})})};Mg.displayName="Menu";var l3=De((e,t)=>{const n=Tu();return a.jsx(Ae.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});l3.displayName="MenuCommand";var BH=De((e,t)=>{const{type:n,...r}=e,o=Tu(),s=r.as||n?n??void 0:"button",i=l.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...o.item}),[o.item]);return a.jsx(Ae.button,{ref:t,type:s,...r,__css:i})}),c3=e=>{const{className:t,children:n,...r}=e,o=Tu(),s=l.Children.only(n),i=l.isValidElement(s)?l.cloneElement(s,{focusable:"false","aria-hidden":!0,className:kt("chakra-menu__icon",s.props.className)}):null,c=kt("chakra-menu__icon-wrapper",t);return a.jsx(Ae.span,{className:c,...r,__css:o.icon,children:i})};c3.displayName="MenuIcon";var Kn=De((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:i,...c}=e,d=$H(c,t),h=n||o?a.jsx("span",{style:{pointerEvents:"none",flex:1},children:i}):i;return a.jsxs(BH,{...d,className:kt("chakra-menu__menuitem",d.className),children:[n&&a.jsx(c3,{fontSize:"0.8em",marginEnd:r,children:n}),h,o&&a.jsx(l3,{marginStart:s,children:o})]})});Kn.displayName="MenuItem";var HH={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"}}},WH=Ae(Ar.div),ql=De(function(t,n){var r,o;const{rootProps:s,motionProps:i,...c}=t,{isOpen:d,onTransitionEnd:p,unstable__animationState:h}=Hf(),m=TH(c,n),g=NH(s),b=Tu();return a.jsx(Ae.div,{...g,__css:{zIndex:(o=t.zIndex)!=null?o:(r=b.list)==null?void 0:r.zIndex},children:a.jsx(WH,{variants:HH,initial:!1,animate:d?"enter":"exit",__css:{outline:0,...b.list},...i,className:kt("chakra-menu__menu-list",m.className),...m,onUpdate:p,onAnimationComplete:pg(h.onComplete,m.onAnimationComplete)})})});ql.displayName="MenuList";var af=De((e,t)=>{const{title:n,children:r,className:o,...s}=e,i=kt("chakra-menu__group__title",o),c=Tu();return a.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[n&&a.jsx(Ae.p,{className:i,...s,__css:c.groupTitle,children:n}),r]})});af.displayName="MenuGroup";var VH=De((e,t)=>{const n=Tu();return a.jsx(Ae.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),Og=De((e,t)=>{const{children:n,as:r,...o}=e,s=DH(o,t),i=r||VH;return a.jsx(i,{...s,className:kt("chakra-menu__menu-button",e.className),children:a.jsx(Ae.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});Og.displayName="MenuButton";var UH={slideInBottom:{...Md,custom:{offsetY:16,reverse:!0}},slideInRight:{...Md,custom:{offsetX:16,reverse:!0}},slideInTop:{...Md,custom:{offsetY:-16,reverse:!0}},slideInLeft:{...Md,custom:{offsetX:-16,reverse:!0}},scale:{...FP,custom:{initialScale:.95,reverse:!0}},none:{}},GH=Ae(Ar.section),qH=e=>UH[e||"none"],u3=l.forwardRef((e,t)=>{const{preset:n,motionProps:r=qH(n),...o}=e;return a.jsx(GH,{ref:t,...r,...o})});u3.displayName="ModalTransition";var KH=Object.defineProperty,QH=(e,t,n)=>t in e?KH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,XH=(e,t,n)=>(QH(e,typeof t!="symbol"?t+"":t,n),n),YH=class{constructor(){XH(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}},jb=new YH;function d3(e,t){const[n,r]=l.useState(0);return l.useEffect(()=>{const o=e.current;if(o){if(t){const s=jb.add(o);r(s)}return()=>{jb.remove(o),r(0)}}},[t,e]),n}var JH=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ic=new WeakMap,Yp=new WeakMap,Jp={},o1=0,f3=function(e){return e&&(e.host||f3(e.parentNode))},ZH=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=f3(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})},eW=function(e,t,n,r){var o=ZH(t,Array.isArray(e)?e:[e]);Jp[n]||(Jp[n]=new WeakMap);var s=Jp[n],i=[],c=new Set,d=new Set(o),p=function(m){!m||c.has(m)||(c.add(m),p(m.parentNode))};o.forEach(p);var h=function(m){!m||d.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))h(g);else{var b=g.getAttribute(r),y=b!==null&&b!=="false",x=(Ic.get(g)||0)+1,w=(s.get(g)||0)+1;Ic.set(g,x),s.set(g,w),i.push(g),x===1&&y&&Yp.set(g,!0),w===1&&g.setAttribute(n,"true"),y||g.setAttribute(r,"true")}})};return h(t),c.clear(),o1++,function(){i.forEach(function(m){var g=Ic.get(m)-1,b=s.get(m)-1;Ic.set(m,g),s.set(m,b),g||(Yp.has(m)||m.removeAttribute(r),Yp.delete(m)),b||m.removeAttribute(n)}),o1--,o1||(Ic=new WeakMap,Ic=new WeakMap,Yp=new WeakMap,Jp={})}},tW=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||JH(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),eW(r,o,n,"aria-hidden")):function(){return null}};function nW(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:i=!0,onOverlayClick:c,onEsc:d}=e,p=l.useRef(null),h=l.useRef(null),[m,g,b]=oW(r,"chakra-modal","chakra-modal--header","chakra-modal--body");rW(p,t&&i);const y=d3(p,t),x=l.useRef(null),w=l.useCallback(D=>{x.current=D.target},[]),S=l.useCallback(D=>{D.key==="Escape"&&(D.stopPropagation(),s&&(n==null||n()),d==null||d())},[s,n,d]),[j,I]=l.useState(!1),[_,M]=l.useState(!1),E=l.useCallback((D={},O=null)=>({role:"dialog",...D,ref:xn(O,p),id:m,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?g:void 0,"aria-describedby":_?b:void 0,onClick:ot(D.onClick,T=>T.stopPropagation())}),[b,_,m,g,j]),A=l.useCallback(D=>{D.stopPropagation(),x.current===D.target&&jb.isTopModal(p.current)&&(o&&(n==null||n()),c==null||c())},[n,o,c]),R=l.useCallback((D={},O=null)=>({...D,ref:xn(O,h),onClick:ot(D.onClick,A),onKeyDown:ot(D.onKeyDown,S),onMouseDown:ot(D.onMouseDown,w)}),[S,w,A]);return{isOpen:t,onClose:n,headerId:g,bodyId:b,setBodyMounted:M,setHeaderMounted:I,dialogRef:p,overlayRef:h,getDialogProps:E,getDialogContainerProps:R,index:y}}function rW(e,t){const n=e.current;l.useEffect(()=>{if(!(!e.current||!t))return tW(e.current)},[t,e,n])}function oW(e,...t){const n=l.useId(),r=e||n;return l.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[sW,Nu]=Un({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[aW,Kl]=Un({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),vu=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:n,children:r,autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:c,returnFocusOnClose:d,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:m,motionPreset:g,lockFocusAcrossFrames:b,onCloseComplete:y}=t,x=no("Modal",t),S={...nW(t),autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:c,returnFocusOnClose:d,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:m,motionPreset:g,lockFocusAcrossFrames:b};return a.jsx(aW,{value:S,children:a.jsx(sW,{value:x,children:a.jsx(So,{onExitComplete:y,children:S.isOpen&&a.jsx(Au,{...n,children:r})})})})};vu.displayName="Modal";var Eh="right-scroll-bar-position",Mh="width-before-scroll-bar",iW="with-scroll-bars-hidden",lW="--removed-body-scroll-bar-size",p3=c5(),s1=function(){},Ag=l.forwardRef(function(e,t){var n=l.useRef(null),r=l.useState({onScrollCapture:s1,onWheelCapture:s1,onTouchMoveCapture:s1}),o=r[0],s=r[1],i=e.forwardProps,c=e.children,d=e.className,p=e.removeScrollBar,h=e.enabled,m=e.shards,g=e.sideCar,b=e.noIsolation,y=e.inert,x=e.allowPinchZoom,w=e.as,S=w===void 0?"div":w,j=e.gapMode,I=a5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=g,M=s5([n,t]),E=wa(wa({},I),o);return l.createElement(l.Fragment,null,h&&l.createElement(_,{sideCar:p3,removeScrollBar:p,shards:m,noIsolation:b,inert:y,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:j}),i?l.cloneElement(l.Children.only(c),wa(wa({},E),{ref:M})):l.createElement(S,wa({},E,{className:d,ref:M}),c))});Ag.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ag.classNames={fullWidth:Mh,zeroRight:Eh};var ck,cW=function(){if(ck)return ck;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function uW(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=cW();return t&&e.setAttribute("nonce",t),e}function dW(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function fW(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var pW=function(){var e=0,t=null;return{add:function(n){e==0&&(t=uW())&&(dW(t,n),fW(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},hW=function(){var e=pW();return function(t,n){l.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},h3=function(){var e=hW(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},mW={left:0,top:0,right:0,gap:0},a1=function(e){return parseInt(e||"",10)||0},gW=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[a1(n),a1(r),a1(o)]},vW=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return mW;var t=gW(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])}},bW=h3(),xW=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),` .`.concat(iW,` { overflow: hidden `).concat(r,`; padding-right: `).concat(c,"px ").concat(r,`; } body { overflow: hidden `).concat(r,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` padding-left: `.concat(o,`px; padding-top: `).concat(s,`px; padding-right: `).concat(i,`px; margin-left:0; margin-top:0; margin-right: `).concat(c,"px ").concat(r,`; `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` } .`).concat(Eh,` { right: `).concat(c,"px ").concat(r,`; } .`).concat(Mh,` { margin-right: `).concat(c,"px ").concat(r,`; } .`).concat(Eh," .").concat(Eh,` { right: 0 `).concat(r,`; } .`).concat(Mh," .").concat(Mh,` { margin-right: 0 `).concat(r,`; } body { `).concat(lW,": ").concat(c,`px; } `)},yW=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=l.useMemo(function(){return vW(o)},[o]);return l.createElement(bW,{styles:xW(s,!t,o,n?"":"!important")})},_b=!1;if(typeof window<"u")try{var Zp=Object.defineProperty({},"passive",{get:function(){return _b=!0,!0}});window.addEventListener("test",Zp,Zp),window.removeEventListener("test",Zp,Zp)}catch{_b=!1}var Pc=_b?{passive:!1}:!1,CW=function(e){return e.tagName==="TEXTAREA"},m3=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!CW(e)&&n[t]==="visible")},wW=function(e){return m3(e,"overflowY")},SW=function(e){return m3(e,"overflowX")},uk=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=g3(e,r);if(o){var s=v3(e,r),i=s[1],c=s[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},kW=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},jW=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},g3=function(e,t){return e==="v"?wW(t):SW(t)},v3=function(e,t){return e==="v"?kW(t):jW(t)},_W=function(e,t){return e==="h"&&t==="rtl"?-1:1},IW=function(e,t,n,r,o){var s=_W(e,window.getComputedStyle(t).direction),i=s*r,c=n.target,d=t.contains(c),p=!1,h=i>0,m=0,g=0;do{var b=v3(e,c),y=b[0],x=b[1],w=b[2],S=x-w-s*y;(y||S)&&g3(e,c)&&(m+=S,g+=y),c instanceof ShadowRoot?c=c.host:c=c.parentNode}while(!d&&c!==document.body||d&&(t.contains(c)||t===c));return(h&&(o&&Math.abs(m)<1||!o&&i>m)||!h&&(o&&Math.abs(g)<1||!o&&-i>g))&&(p=!0),p},eh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},dk=function(e){return[e.deltaX,e.deltaY]},fk=function(e){return e&&"current"in e?e.current:e},PW=function(e,t){return e[0]===t[0]&&e[1]===t[1]},EW=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},MW=0,Ec=[];function OW(e){var t=l.useRef([]),n=l.useRef([0,0]),r=l.useRef(),o=l.useState(MW++)[0],s=l.useState(h3)[0],i=l.useRef(e);l.useEffect(function(){i.current=e},[e]),l.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var x=Az([e.lockRef.current],(e.shards||[]).map(fk),!0).filter(Boolean);return x.forEach(function(w){return w.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),x.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=l.useCallback(function(x,w){if("touches"in x&&x.touches.length===2)return!i.current.allowPinchZoom;var S=eh(x),j=n.current,I="deltaX"in x?x.deltaX:j[0]-S[0],_="deltaY"in x?x.deltaY:j[1]-S[1],M,E=x.target,A=Math.abs(I)>Math.abs(_)?"h":"v";if("touches"in x&&A==="h"&&E.type==="range")return!1;var R=uk(A,E);if(!R)return!0;if(R?M=A:(M=A==="v"?"h":"v",R=uk(A,E)),!R)return!1;if(!r.current&&"changedTouches"in x&&(I||_)&&(r.current=M),!M)return!0;var D=r.current||M;return IW(D,w,x,D==="h"?I:_,!0)},[]),d=l.useCallback(function(x){var w=x;if(!(!Ec.length||Ec[Ec.length-1]!==s)){var S="deltaY"in w?dk(w):eh(w),j=t.current.filter(function(M){return M.name===w.type&&(M.target===w.target||w.target===M.shadowParent)&&PW(M.delta,S)})[0];if(j&&j.should){w.cancelable&&w.preventDefault();return}if(!j){var I=(i.current.shards||[]).map(fk).filter(Boolean).filter(function(M){return M.contains(w.target)}),_=I.length>0?c(w,I[0]):!i.current.noIsolation;_&&w.cancelable&&w.preventDefault()}}},[]),p=l.useCallback(function(x,w,S,j){var I={name:x,delta:w,target:S,should:j,shadowParent:AW(S)};t.current.push(I),setTimeout(function(){t.current=t.current.filter(function(_){return _!==I})},1)},[]),h=l.useCallback(function(x){n.current=eh(x),r.current=void 0},[]),m=l.useCallback(function(x){p(x.type,dk(x),x.target,c(x,e.lockRef.current))},[]),g=l.useCallback(function(x){p(x.type,eh(x),x.target,c(x,e.lockRef.current))},[]);l.useEffect(function(){return Ec.push(s),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",d,Pc),document.addEventListener("touchmove",d,Pc),document.addEventListener("touchstart",h,Pc),function(){Ec=Ec.filter(function(x){return x!==s}),document.removeEventListener("wheel",d,Pc),document.removeEventListener("touchmove",d,Pc),document.removeEventListener("touchstart",h,Pc)}},[]);var b=e.removeScrollBar,y=e.inert;return l.createElement(l.Fragment,null,y?l.createElement(s,{styles:EW(o)}):null,b?l.createElement(yW,{gapMode:e.gapMode}):null)}function AW(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const RW=Rz(p3,OW);var b3=l.forwardRef(function(e,t){return l.createElement(Ag,wa({},e,{ref:t,sideCar:RW}))});b3.classNames=Ag.classNames;const DW=b3;function TW(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:i,finalFocusRef:c,returnFocusOnClose:d,preserveScrollBarGap:p,lockFocusAcrossFrames:h,isOpen:m}=Kl(),[g,b]=hD();l.useEffect(()=>{!g&&b&&setTimeout(b)},[g,b]);const y=d3(r,m);return a.jsx(F5,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:c,restoreFocus:d,contentRef:r,lockFocusAcrossFrames:h,children:a.jsx(DW,{removeScrollBar:!p,allowPinchZoom:i,enabled:y===1&&s,forwardProps:!0,children:e.children})})}var bu=De((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...i}=e,{getDialogProps:c,getDialogContainerProps:d}=Kl(),p=c(i,t),h=d(o),m=kt("chakra-modal__content",n),g=Nu(),b={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...g.dialog},y={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...g.dialogContainer},{motionPreset:x}=Kl();return a.jsx(TW,{children:a.jsx(Ae.div,{...h,className:"chakra-modal__content-container",tabIndex:-1,__css:y,children:a.jsx(u3,{preset:x,motionProps:s,className:m,...p,__css:b,children:r})})})});bu.displayName="ModalContent";function Wf(e){const{leastDestructiveRef:t,...n}=e;return a.jsx(vu,{...n,initialFocusRef:t})}var Vf=De((e,t)=>a.jsx(bu,{ref:t,role:"alertdialog",...e})),pi=De((e,t)=>{const{className:n,...r}=e,o=kt("chakra-modal__footer",n),i={display:"flex",alignItems:"center",justifyContent:"flex-end",...Nu().footer};return a.jsx(Ae.footer,{ref:t,...r,__css:i,className:o})});pi.displayName="ModalFooter";var Oa=De((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=Kl();l.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=kt("chakra-modal__header",n),d={flex:0,...Nu().header};return a.jsx(Ae.header,{ref:t,className:i,id:o,...r,__css:d})});Oa.displayName="ModalHeader";var NW=Ae(Ar.div),Aa=De((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,i=kt("chakra-modal__overlay",n),d={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...Nu().overlay},{motionPreset:p}=Kl(),m=o||(p==="none"?{}:zP);return a.jsx(NW,{...m,__css:d,ref:t,className:i,...s})});Aa.displayName="ModalOverlay";var Ra=De((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=Kl();l.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=kt("chakra-modal__body",n),c=Nu();return a.jsx(Ae.div,{ref:t,className:i,id:o,...r,__css:c.body})});Ra.displayName="ModalBody";var Rg=De((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=Kl(),i=kt("chakra-modal__close-btn",r),c=Nu();return a.jsx(_I,{ref:t,__css:c.closeButton,className:i,onClick:ot(n,d=>{d.stopPropagation(),s()}),...o})});Rg.displayName="ModalCloseButton";var $W=e=>a.jsx(Gr,{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"})}),LW=e=>a.jsx(Gr,{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 pk(e,t,n,r){l.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,i=Array.isArray(t)?t:[t],c=new s.MutationObserver(d=>{for(const p of d)p.type==="attributes"&&p.attributeName&&i.includes(p.attributeName)&&n(p)});return c.observe(e.current,{attributes:!0,attributeFilter:i}),()=>c.disconnect()})}function zW(e,t){const n=vr(e);l.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var FW=50,hk=300;function BW(e,t){const[n,r]=l.useState(!1),[o,s]=l.useState(null),[i,c]=l.useState(!0),d=l.useRef(null),p=()=>clearTimeout(d.current);zW(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?FW:null);const h=l.useCallback(()=>{i&&e(),d.current=setTimeout(()=>{c(!1),r(!0),s("increment")},hk)},[e,i]),m=l.useCallback(()=>{i&&t(),d.current=setTimeout(()=>{c(!1),r(!0),s("decrement")},hk)},[t,i]),g=l.useCallback(()=>{c(!0),r(!1),p()},[]);return l.useEffect(()=>()=>p(),[]),{up:h,down:m,stop:g,isSpinning:n}}var HW=/^[Ee0-9+\-.]$/;function WW(e){return HW.test(e)}function VW(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 UW(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:o=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:i=1,isReadOnly:c,isDisabled:d,isRequired:p,isInvalid:h,pattern:m="[0-9]*(.[0-9]+)?",inputMode:g="decimal",allowMouseWheel:b,id:y,onChange:x,precision:w,name:S,"aria-describedby":j,"aria-label":I,"aria-labelledby":_,onFocus:M,onBlur:E,onInvalid:A,getAriaValueText:R,isValidCharacter:D,format:O,parse:T,...K}=e,G=vr(M),X=vr(E),Z=vr(A),te=vr(D??WW),V=vr(R),oe=fz(e),{update:ne,increment:se,decrement:re}=oe,[ae,B]=l.useState(!1),Y=!(c||d),$=l.useRef(null),F=l.useRef(null),q=l.useRef(null),pe=l.useRef(null),W=l.useCallback(ke=>ke.split("").filter(te).join(""),[te]),U=l.useCallback(ke=>{var lt;return(lt=T==null?void 0:T(ke))!=null?lt:ke},[T]),ee=l.useCallback(ke=>{var lt;return((lt=O==null?void 0:O(ke))!=null?lt:ke).toString()},[O]);wi(()=>{(oe.valueAsNumber>s||oe.valueAsNumber{if(!$.current)return;if($.current.value!=oe.value){const lt=U($.current.value);oe.setValue(W(lt))}},[U,W]);const J=l.useCallback((ke=i)=>{Y&&se(ke)},[se,Y,i]),ge=l.useCallback((ke=i)=>{Y&&re(ke)},[re,Y,i]),he=BW(J,ge);pk(q,"disabled",he.stop,he.isSpinning),pk(pe,"disabled",he.stop,he.isSpinning);const de=l.useCallback(ke=>{if(ke.nativeEvent.isComposing)return;const Rt=U(ke.currentTarget.value);ne(W(Rt)),F.current={start:ke.currentTarget.selectionStart,end:ke.currentTarget.selectionEnd}},[ne,W,U]),_e=l.useCallback(ke=>{var lt,Rt,zt;G==null||G(ke),F.current&&(ke.target.selectionStart=(Rt=F.current.start)!=null?Rt:(lt=ke.currentTarget.value)==null?void 0:lt.length,ke.currentTarget.selectionEnd=(zt=F.current.end)!=null?zt:ke.currentTarget.selectionStart)},[G]),Pe=l.useCallback(ke=>{if(ke.nativeEvent.isComposing)return;VW(ke,te)||ke.preventDefault();const lt=ze(ke)*i,Rt=ke.key,Re={ArrowUp:()=>J(lt),ArrowDown:()=>ge(lt),Home:()=>ne(o),End:()=>ne(s)}[Rt];Re&&(ke.preventDefault(),Re(ke))},[te,i,J,ge,ne,o,s]),ze=ke=>{let lt=1;return(ke.metaKey||ke.ctrlKey)&&(lt=.1),ke.shiftKey&&(lt=10),lt},ht=l.useMemo(()=>{const ke=V==null?void 0:V(oe.value);if(ke!=null)return ke;const lt=oe.value.toString();return lt||void 0},[oe.value,V]),Je=l.useCallback(()=>{let ke=oe.value;if(oe.value==="")return;/^[eE]/.test(oe.value.toString())?oe.setValue(""):(oe.valueAsNumbers&&(ke=s),oe.cast(ke))},[oe,s,o]),qt=l.useCallback(()=>{B(!1),n&&Je()},[n,B,Je]),Pt=l.useCallback(()=>{t&&requestAnimationFrame(()=>{var ke;(ke=$.current)==null||ke.focus()})},[t]),jt=l.useCallback(ke=>{ke.preventDefault(),he.up(),Pt()},[Pt,he]),Se=l.useCallback(ke=>{ke.preventDefault(),he.down(),Pt()},[Pt,he]);Nl(()=>$.current,"wheel",ke=>{var lt,Rt;const Re=((Rt=(lt=$.current)==null?void 0:lt.ownerDocument)!=null?Rt:document).activeElement===$.current;if(!b||!Re)return;ke.preventDefault();const Qe=ze(ke)*i,En=Math.sign(ke.deltaY);En===-1?J(Qe):En===1&&ge(Qe)},{passive:!1});const Fe=l.useCallback((ke={},lt=null)=>{const Rt=d||r&&oe.isAtMax;return{...ke,ref:xn(lt,q),role:"button",tabIndex:-1,onPointerDown:ot(ke.onPointerDown,zt=>{zt.button!==0||Rt||jt(zt)}),onPointerLeave:ot(ke.onPointerLeave,he.stop),onPointerUp:ot(ke.onPointerUp,he.stop),disabled:Rt,"aria-disabled":Ms(Rt)}},[oe.isAtMax,r,jt,he.stop,d]),it=l.useCallback((ke={},lt=null)=>{const Rt=d||r&&oe.isAtMin;return{...ke,ref:xn(lt,pe),role:"button",tabIndex:-1,onPointerDown:ot(ke.onPointerDown,zt=>{zt.button!==0||Rt||Se(zt)}),onPointerLeave:ot(ke.onPointerLeave,he.stop),onPointerUp:ot(ke.onPointerUp,he.stop),disabled:Rt,"aria-disabled":Ms(Rt)}},[oe.isAtMin,r,Se,he.stop,d]),At=l.useCallback((ke={},lt=null)=>{var Rt,zt,Re,Qe;return{name:S,inputMode:g,type:"text",pattern:m,"aria-labelledby":_,"aria-label":I,"aria-describedby":j,id:y,disabled:d,...ke,readOnly:(Rt=ke.readOnly)!=null?Rt:c,"aria-readonly":(zt=ke.readOnly)!=null?zt:c,"aria-required":(Re=ke.required)!=null?Re:p,required:(Qe=ke.required)!=null?Qe:p,ref:xn($,lt),value:ee(oe.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(oe.valueAsNumber)?void 0:oe.valueAsNumber,"aria-invalid":Ms(h??oe.isOutOfRange),"aria-valuetext":ht,autoComplete:"off",autoCorrect:"off",onChange:ot(ke.onChange,de),onKeyDown:ot(ke.onKeyDown,Pe),onFocus:ot(ke.onFocus,_e,()=>B(!0)),onBlur:ot(ke.onBlur,X,qt)}},[S,g,m,_,I,ee,j,y,d,p,c,h,oe.value,oe.valueAsNumber,oe.isOutOfRange,o,s,ht,de,Pe,_e,X,qt]);return{value:ee(oe.value),valueAsNumber:oe.valueAsNumber,isFocused:ae,isDisabled:d,isReadOnly:c,getIncrementButtonProps:Fe,getDecrementButtonProps:it,getInputProps:At,htmlProps:K}}var[GW,Dg]=Un({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[qW,Ty]=Un({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Tg=De(function(t,n){const r=no("NumberInput",t),o=lr(t),s=iy(o),{htmlProps:i,...c}=UW(s),d=l.useMemo(()=>c,[c]);return a.jsx(qW,{value:d,children:a.jsx(GW,{value:r,children:a.jsx(Ae.div,{...i,ref:n,className:kt("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Tg.displayName="NumberInput";var Ng=De(function(t,n){const r=Dg();return a.jsx(Ae.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}})});Ng.displayName="NumberInputStepper";var $g=De(function(t,n){const{getInputProps:r}=Ty(),o=r(t,n),s=Dg();return a.jsx(Ae.input,{...o,className:kt("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});$g.displayName="NumberInputField";var x3=Ae("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Lg=De(function(t,n){var r;const o=Dg(),{getDecrementButtonProps:s}=Ty(),i=s(t,n);return a.jsx(x3,{...i,__css:o.stepper,children:(r=t.children)!=null?r:a.jsx($W,{})})});Lg.displayName="NumberDecrementStepper";var zg=De(function(t,n){var r;const{getIncrementButtonProps:o}=Ty(),s=o(t,n),i=Dg();return a.jsx(x3,{...s,__css:i.stepper,children:(r=t.children)!=null?r:a.jsx(LW,{})})});zg.displayName="NumberIncrementStepper";var[KW,ec]=Un({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[QW,Fg]=Un({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Bg(e){const t=l.Children.only(e.children),{getTriggerProps:n}=ec();return l.cloneElement(t,n(t.props,t.ref))}Bg.displayName="PopoverTrigger";var Mc={click:"click",hover:"hover"};function XW(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:i=!0,arrowSize:c,arrowShadowColor:d,trigger:p=Mc.click,openDelay:h=200,closeDelay:m=200,isLazy:g,lazyBehavior:b="unmount",computePositionOnMount:y,...x}=e,{isOpen:w,onClose:S,onOpen:j,onToggle:I}=Ry(e),_=l.useRef(null),M=l.useRef(null),E=l.useRef(null),A=l.useRef(!1),R=l.useRef(!1);w&&(R.current=!0);const[D,O]=l.useState(!1),[T,K]=l.useState(!1),G=l.useId(),X=o??G,[Z,te,V,oe]=["popover-trigger","popover-content","popover-header","popover-body"].map(de=>`${de}-${X}`),{referenceRef:ne,getArrowProps:se,getPopperProps:re,getArrowInnerProps:ae,forceUpdate:B}=Ay({...x,enabled:w||!!y}),Y=a3({isOpen:w,ref:E});ZP({enabled:w,ref:M}),Q5(E,{focusRef:M,visible:w,shouldFocus:s&&p===Mc.click}),oB(E,{focusRef:r,visible:w,shouldFocus:i&&p===Mc.click});const $=Dy({wasSelected:R.current,enabled:g,mode:b,isSelected:Y.present}),F=l.useCallback((de={},_e=null)=>{const Pe={...de,style:{...de.style,transformOrigin:qr.transformOrigin.varRef,[qr.arrowSize.var]:c?`${c}px`:void 0,[qr.arrowShadowColor.var]:d},ref:xn(E,_e),children:$?de.children:null,id:te,tabIndex:-1,role:"dialog",onKeyDown:ot(de.onKeyDown,ze=>{n&&ze.key==="Escape"&&S()}),onBlur:ot(de.onBlur,ze=>{const ht=mk(ze),Je=i1(E.current,ht),qt=i1(M.current,ht);w&&t&&(!Je&&!qt)&&S()}),"aria-labelledby":D?V:void 0,"aria-describedby":T?oe:void 0};return p===Mc.hover&&(Pe.role="tooltip",Pe.onMouseEnter=ot(de.onMouseEnter,()=>{A.current=!0}),Pe.onMouseLeave=ot(de.onMouseLeave,ze=>{ze.nativeEvent.relatedTarget!==null&&(A.current=!1,setTimeout(()=>S(),m))})),Pe},[$,te,D,V,T,oe,p,n,S,w,t,m,d,c]),q=l.useCallback((de={},_e=null)=>re({...de,style:{visibility:w?"visible":"hidden",...de.style}},_e),[w,re]),pe=l.useCallback((de,_e=null)=>({...de,ref:xn(_e,_,ne)}),[_,ne]),W=l.useRef(),U=l.useRef(),ee=l.useCallback(de=>{_.current==null&&ne(de)},[ne]),J=l.useCallback((de={},_e=null)=>{const Pe={...de,ref:xn(M,_e,ee),id:Z,"aria-haspopup":"dialog","aria-expanded":w,"aria-controls":te};return p===Mc.click&&(Pe.onClick=ot(de.onClick,I)),p===Mc.hover&&(Pe.onFocus=ot(de.onFocus,()=>{W.current===void 0&&j()}),Pe.onBlur=ot(de.onBlur,ze=>{const ht=mk(ze),Je=!i1(E.current,ht);w&&t&&Je&&S()}),Pe.onKeyDown=ot(de.onKeyDown,ze=>{ze.key==="Escape"&&S()}),Pe.onMouseEnter=ot(de.onMouseEnter,()=>{A.current=!0,W.current=window.setTimeout(()=>j(),h)}),Pe.onMouseLeave=ot(de.onMouseLeave,()=>{A.current=!1,W.current&&(clearTimeout(W.current),W.current=void 0),U.current=window.setTimeout(()=>{A.current===!1&&S()},m)})),Pe},[Z,w,te,p,ee,I,j,t,S,h,m]);l.useEffect(()=>()=>{W.current&&clearTimeout(W.current),U.current&&clearTimeout(U.current)},[]);const ge=l.useCallback((de={},_e=null)=>({...de,id:V,ref:xn(_e,Pe=>{O(!!Pe)})}),[V]),he=l.useCallback((de={},_e=null)=>({...de,id:oe,ref:xn(_e,Pe=>{K(!!Pe)})}),[oe]);return{forceUpdate:B,isOpen:w,onAnimationComplete:Y.onComplete,onClose:S,getAnchorProps:pe,getArrowProps:se,getArrowInnerProps:ae,getPopoverPositionerProps:q,getPopoverProps:F,getTriggerProps:J,getHeaderProps:ge,getBodyProps:he}}function i1(e,t){return e===t||(e==null?void 0:e.contains(t))}function mk(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Uf(e){const t=no("Popover",e),{children:n,...r}=lr(e),o=kf(),s=XW({...r,direction:o.direction});return a.jsx(KW,{value:s,children:a.jsx(QW,{value:t,children:Mx(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Uf.displayName="Popover";function y3(e){const t=l.Children.only(e.children),{getAnchorProps:n}=ec();return l.cloneElement(t,n(t.props,t.ref))}y3.displayName="PopoverAnchor";var l1=(e,t)=>t?`${e}.${t}, ${t}`:void 0;function C3(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:i,shadowColor:c}=e,{getArrowProps:d,getArrowInnerProps:p}=ec(),h=Fg(),m=(t=n??r)!=null?t:o,g=s??i;return a.jsx(Ae.div,{...d(),className:"chakra-popover__arrow-positioner",children:a.jsx(Ae.div,{className:kt("chakra-popover__arrow",e.className),...p(e),__css:{"--popper-arrow-shadow-color":l1("colors",c),"--popper-arrow-bg":l1("colors",m),"--popper-arrow-shadow":l1("shadows",g),...h.arrow}})})}C3.displayName="PopoverArrow";var Hg=De(function(t,n){const{getBodyProps:r}=ec(),o=Fg();return a.jsx(Ae.div,{...r(t,n),className:kt("chakra-popover__body",t.className),__css:o.body})});Hg.displayName="PopoverBody";var w3=De(function(t,n){const{onClose:r}=ec(),o=Fg();return a.jsx(_I,{size:"sm",onClick:r,className:kt("chakra-popover__close-btn",t.className),__css:o.closeButton,ref:n,...t})});w3.displayName="PopoverCloseButton";function YW(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var JW={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]}}},ZW=Ae(Ar.section),S3=De(function(t,n){const{variants:r=JW,...o}=t,{isOpen:s}=ec();return a.jsx(ZW,{ref:n,variants:YW(r),initial:!1,animate:s?"enter":"exit",...o})});S3.displayName="PopoverTransition";var Gf=De(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:i,getPopoverPositionerProps:c,onAnimationComplete:d}=ec(),p=Fg(),h={position:"relative",display:"flex",flexDirection:"column",...p.content};return a.jsx(Ae.div,{...c(r),__css:p.popper,className:"chakra-popover__popper",children:a.jsx(S3,{...o,...i(s,n),onAnimationComplete:pg(d,s.onAnimationComplete),className:kt("chakra-popover__content",t.className),__css:h})})});Gf.displayName="PopoverContent";var Ib=e=>a.jsx(Ae.circle,{cx:50,cy:50,r:42,fill:"transparent",...e});Ib.displayName="Circle";function eV(e,t,n){return(e-t)*100/(n-t)}var tV=Si({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}}),nV=Si({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),rV=Si({"0%":{left:"-40%"},"100%":{left:"100%"}}),oV=Si({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function k3(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:i,role:c="progressbar"}=e,d=eV(t,n,r);return{bind:{"data-indeterminate":i?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":i?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,d):o})(),role:c},percent:d,value:t}}var j3=e=>{const{size:t,isIndeterminate:n,...r}=e;return a.jsx(Ae.svg,{viewBox:"0 0 100 100",__css:{width:t,height:t,animation:n?`${nV} 2s linear infinite`:void 0},...r})};j3.displayName="Shape";var Pb=De((e,t)=>{var n;const{size:r="48px",max:o=100,min:s=0,valueText:i,getValueText:c,value:d,capIsRound:p,children:h,thickness:m="10px",color:g="#0078d4",trackColor:b="#edebe9",isIndeterminate:y,...x}=e,w=k3({min:s,max:o,value:d,valueText:i,getValueText:c,isIndeterminate:y}),S=y?void 0:((n=w.percent)!=null?n:0)*2.64,j=S==null?void 0:`${S} ${264-S}`,I=y?{css:{animation:`${tV} 1.5s linear infinite`}}:{strokeDashoffset:66,strokeDasharray:j,transitionProperty:"stroke-dasharray, stroke",transitionDuration:"0.6s",transitionTimingFunction:"ease"},_={display:"inline-block",position:"relative",verticalAlign:"middle",fontSize:r};return a.jsxs(Ae.div,{ref:t,className:"chakra-progress",...w.bind,...x,__css:_,children:[a.jsxs(j3,{size:r,isIndeterminate:y,children:[a.jsx(Ib,{stroke:b,strokeWidth:m,className:"chakra-progress__track"}),a.jsx(Ib,{stroke:g,strokeWidth:m,className:"chakra-progress__indicator",strokeLinecap:p?"round":void 0,opacity:w.value===0&&!y?0:void 0,...I})]}),h]})});Pb.displayName="CircularProgress";var[sV,aV]=Un({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),iV=De((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:i,...c}=e,d=k3({value:o,min:n,max:r,isIndeterminate:s,role:i}),h={height:"100%",...aV().filledTrack};return a.jsx(Ae.div,{ref:t,style:{width:`${d.percent}%`,...c.style},...d.bind,...c,__css:h})}),_3=De((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:i,isAnimated:c,children:d,borderRadius:p,isIndeterminate:h,"aria-label":m,"aria-labelledby":g,"aria-valuetext":b,title:y,role:x,...w}=lr(e),S=no("Progress",e),j=p??((n=S.track)==null?void 0:n.borderRadius),I={animation:`${oV} 1s linear infinite`},E={...!h&&i&&c&&I,...h&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${rV} 1s ease infinite normal none running`}},A={overflow:"hidden",position:"relative",...S.track};return a.jsx(Ae.div,{ref:t,borderRadius:j,__css:A,...w,children:a.jsxs(sV,{value:S,children:[a.jsx(iV,{"aria-label":m,"aria-labelledby":g,"aria-valuetext":b,min:o,max:s,value:r,isIndeterminate:h,css:E,borderRadius:j,title:y,role:x}),d]})})});_3.displayName="Progress";function lV(e){return e&&Q1(e)&&Q1(e.target)}function cV(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:i,isNative:c,...d}=e,[p,h]=l.useState(r||""),m=typeof n<"u",g=m?n:p,b=l.useRef(null),y=l.useCallback(()=>{const M=b.current;if(!M)return;let E="input:not(:disabled):checked";const A=M.querySelector(E);if(A){A.focus();return}E="input:not(:disabled)";const R=M.querySelector(E);R==null||R.focus()},[]),w=`radio-${l.useId()}`,S=o||w,j=l.useCallback(M=>{const E=lV(M)?M.target.value:M;m||h(E),t==null||t(String(E))},[t,m]),I=l.useCallback((M={},E=null)=>({...M,ref:xn(E,b),role:"radiogroup"}),[]),_=l.useCallback((M={},E=null)=>({...M,ref:E,name:S,[c?"checked":"isChecked"]:g!=null?M.value===g:void 0,onChange(R){j(R)},"data-radiogroup":!0}),[c,S,j,g]);return{getRootProps:I,getRadioProps:_,name:S,ref:b,focus:y,setValue:h,value:g,onChange:j,isDisabled:s,isFocusable:i,htmlProps:d}}var[uV,I3]=Un({name:"RadioGroupContext",strict:!1}),om=De((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:i,isDisabled:c,isFocusable:d,...p}=e,{value:h,onChange:m,getRootProps:g,name:b,htmlProps:y}=cV(p),x=l.useMemo(()=>({name:b,size:r,onChange:m,colorScheme:n,value:h,variant:o,isDisabled:c,isFocusable:d}),[b,r,m,n,h,o,c,d]);return a.jsx(uV,{value:x,children:a.jsx(Ae.div,{...g(y,t),className:kt("chakra-radio-group",i),children:s})})});om.displayName="RadioGroup";var dV={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function fV(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:i,onChange:c,isInvalid:d,name:p,value:h,id:m,"data-radiogroup":g,"aria-describedby":b,...y}=e,x=`radio-${l.useId()}`,w=Rf(),j=!!I3()||!!g;let _=!!w&&!j?w.id:x;_=m??_;const M=o??(w==null?void 0:w.isDisabled),E=s??(w==null?void 0:w.isReadOnly),A=i??(w==null?void 0:w.isRequired),R=d??(w==null?void 0:w.isInvalid),[D,O]=l.useState(!1),[T,K]=l.useState(!1),[G,X]=l.useState(!1),[Z,te]=l.useState(!1),[V,oe]=l.useState(!!t),ne=typeof n<"u",se=ne?n:V;l.useEffect(()=>GP(O),[]);const re=l.useCallback(ee=>{if(E||M){ee.preventDefault();return}ne||oe(ee.target.checked),c==null||c(ee)},[ne,M,E,c]),ae=l.useCallback(ee=>{ee.key===" "&&te(!0)},[te]),B=l.useCallback(ee=>{ee.key===" "&&te(!1)},[te]),Y=l.useCallback((ee={},J=null)=>({...ee,ref:J,"data-active":Vt(Z),"data-hover":Vt(G),"data-disabled":Vt(M),"data-invalid":Vt(R),"data-checked":Vt(se),"data-focus":Vt(T),"data-focus-visible":Vt(T&&D),"data-readonly":Vt(E),"aria-hidden":!0,onMouseDown:ot(ee.onMouseDown,()=>te(!0)),onMouseUp:ot(ee.onMouseUp,()=>te(!1)),onMouseEnter:ot(ee.onMouseEnter,()=>X(!0)),onMouseLeave:ot(ee.onMouseLeave,()=>X(!1))}),[Z,G,M,R,se,T,E,D]),{onFocus:$,onBlur:F}=w??{},q=l.useCallback((ee={},J=null)=>{const ge=M&&!r;return{...ee,id:_,ref:J,type:"radio",name:p,value:h,onChange:ot(ee.onChange,re),onBlur:ot(F,ee.onBlur,()=>K(!1)),onFocus:ot($,ee.onFocus,()=>K(!0)),onKeyDown:ot(ee.onKeyDown,ae),onKeyUp:ot(ee.onKeyUp,B),checked:se,disabled:ge,readOnly:E,required:A,"aria-invalid":Ms(R),"aria-disabled":Ms(ge),"aria-required":Ms(A),"data-readonly":Vt(E),"aria-describedby":b,style:dV}},[M,r,_,p,h,re,F,$,ae,B,se,E,A,R,b]);return{state:{isInvalid:R,isFocused:T,isChecked:se,isActive:Z,isHovered:G,isDisabled:M,isReadOnly:E,isRequired:A},getCheckboxProps:Y,getRadioProps:Y,getInputProps:q,getLabelProps:(ee={},J=null)=>({...ee,ref:J,onMouseDown:ot(ee.onMouseDown,pV),"data-disabled":Vt(M),"data-checked":Vt(se),"data-invalid":Vt(R)}),getRootProps:(ee,J=null)=>({...ee,ref:J,"data-disabled":Vt(M),"data-checked":Vt(se),"data-invalid":Vt(R)}),htmlProps:y}}function pV(e){e.preventDefault(),e.stopPropagation()}function hV(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 ei=De((e,t)=>{var n;const r=I3(),{onChange:o,value:s}=e,i=no("Radio",{...r,...e}),c=lr(e),{spacing:d="0.5rem",children:p,isDisabled:h=r==null?void 0:r.isDisabled,isFocusable:m=r==null?void 0:r.isFocusable,inputProps:g,...b}=c;let y=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(y=r.value===s);let x=o;r!=null&&r.onChange&&s!=null&&(x=pg(r.onChange,o));const w=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:S,getCheckboxProps:j,getLabelProps:I,getRootProps:_,htmlProps:M}=fV({...b,isChecked:y,isFocusable:m,isDisabled:h,onChange:x,name:w}),[E,A]=hV(M,II),R=j(A),D=S(g,t),O=I(),T=Object.assign({},E,_()),K={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...i.container},G={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...i.control},X={userSelect:"none",marginStart:d,...i.label};return a.jsxs(Ae.label,{className:"chakra-radio",...T,__css:K,children:[a.jsx("input",{className:"chakra-radio__input",...D}),a.jsx(Ae.span,{className:"chakra-radio__control",...R,__css:G}),p&&a.jsx(Ae.span,{className:"chakra-radio__label",...O,__css:X,children:p})]})});ei.displayName="Radio";var P3=De(function(t,n){const{children:r,placeholder:o,className:s,...i}=t;return a.jsxs(Ae.select,{...i,ref:n,className:kt("chakra-select",s),children:[o&&a.jsx("option",{value:"",children:o}),r]})});P3.displayName="SelectField";function mV(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 E3=De((e,t)=>{var n;const r=no("Select",e),{rootProps:o,placeholder:s,icon:i,color:c,height:d,h:p,minH:h,minHeight:m,iconColor:g,iconSize:b,...y}=lr(e),[x,w]=mV(y,II),S=ay(w),j={width:"100%",height:"fit-content",position:"relative",color:c},I={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return a.jsxs(Ae.div,{className:"chakra-select__wrapper",__css:j,...x,...o,children:[a.jsx(P3,{ref:t,height:p??d,minH:h??m,placeholder:s,...S,__css:I,children:e.children}),a.jsx(M3,{"data-disabled":Vt(S.disabled),...(g||c)&&{color:g||c},__css:r.icon,...b&&{fontSize:b},children:i})]})});E3.displayName="Select";var gV=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"})}),vV=Ae("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),M3=e=>{const{children:t=a.jsx(gV,{}),...n}=e,r=l.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return a.jsx(vV,{...n,className:"chakra-select__icon-wrapper",children:l.isValidElement(t)?r:null})};M3.displayName="SelectIcon";function bV(){const e=l.useRef(!0);return l.useEffect(()=>{e.current=!1},[]),e.current}function xV(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}var yV=Ae("div",{baseStyle:{boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none","&::before, &::after, *":{visibility:"hidden"}}}),Eb=PI("skeleton-start-color"),Mb=PI("skeleton-end-color"),CV=Si({from:{opacity:0},to:{opacity:1}}),wV=Si({from:{borderColor:Eb.reference,background:Eb.reference},to:{borderColor:Mb.reference,background:Mb.reference}}),Wg=De((e,t)=>{const n={...e,fadeDuration:typeof e.fadeDuration=="number"?e.fadeDuration:.4,speed:typeof e.speed=="number"?e.speed:.8},r=cl("Skeleton",n),o=bV(),{startColor:s="",endColor:i="",isLoaded:c,fadeDuration:d,speed:p,className:h,fitContent:m,...g}=lr(n),[b,y]=ea("colors",[s,i]),x=xV(c),w=kt("chakra-skeleton",h),S={...b&&{[Eb.variable]:b},...y&&{[Mb.variable]:y}};if(c){const j=o||x?"none":`${CV} ${d}s`;return a.jsx(Ae.div,{ref:t,className:w,__css:{animation:j},...g})}return a.jsx(yV,{ref:t,className:w,...g,__css:{width:m?"fit-content":void 0,...r,...S,_dark:{...r._dark,...S},animation:`${p}s linear infinite alternate ${wV}`}})});Wg.displayName="Skeleton";var js=e=>e?"":void 0,su=e=>e?!0:void 0,dl=(...e)=>e.filter(Boolean).join(" ");function au(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function SV(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 Od(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var Oh={width:0,height:0},th=e=>e||Oh;function O3(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=x=>{var w;const S=(w=r[x])!=null?w:Oh;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Od({orientation:t,vertical:{bottom:`calc(${n[x]}% - ${S.height/2}px)`},horizontal:{left:`calc(${n[x]}% - ${S.width/2}px)`}})}},i=t==="vertical"?r.reduce((x,w)=>th(x).height>th(w).height?x:w,Oh):r.reduce((x,w)=>th(x).width>th(w).width?x:w,Oh),c={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Od({orientation:t,vertical:i?{paddingLeft:i.width/2,paddingRight:i.width/2}:{},horizontal:i?{paddingTop:i.height/2,paddingBottom:i.height/2}:{}})},d={position:"absolute",...Od({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},p=n.length===1,h=[0,o?100-n[0]:n[0]],m=p?h:n;let g=m[0];!p&&o&&(g=100-g);const b=Math.abs(m[m.length-1]-m[0]),y={...d,...Od({orientation:t,vertical:o?{height:`${b}%`,top:`${g}%`}:{height:`${b}%`,bottom:`${g}%`},horizontal:o?{width:`${b}%`,right:`${g}%`}:{width:`${b}%`,left:`${g}%`}})};return{trackStyle:d,innerTrackStyle:y,rootStyle:c,getThumbStyle:s}}function A3(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function kV(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function jV(e){const t=IV(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function R3(e){return!!e.touches}function _V(e){return R3(e)&&e.touches.length>1}function IV(e){var t;return(t=e.view)!=null?t:window}function PV(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function EV(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function D3(e,t="page"){return R3(e)?PV(e,t):EV(e,t)}function MV(e){return t=>{const n=jV(t);(!n||n&&t.button===0)&&e(t)}}function OV(e,t=!1){function n(o){e(o,{point:D3(o)})}return t?MV(n):n}function Ah(e,t,n,r){return kV(e,t,OV(n,t==="pointerdown"),r)}var AV=Object.defineProperty,RV=(e,t,n)=>t in e?AV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qs=(e,t,n)=>(RV(e,typeof t!="symbol"?t+"":t,n),n),DV=class{constructor(e,t,n){Qs(this,"history",[]),Qs(this,"startEvent",null),Qs(this,"lastEvent",null),Qs(this,"lastEventInfo",null),Qs(this,"handlers",{}),Qs(this,"removeListeners",()=>{}),Qs(this,"threshold",3),Qs(this,"win"),Qs(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const c=c1(this.lastEventInfo,this.history),d=this.startEvent!==null,p=LV(c.offset,{x:0,y:0})>=this.threshold;if(!d&&!p)return;const{timestamp:h}=AS();this.history.push({...c.point,timestamp:h});const{onStart:m,onMove:g}=this.handlers;d||(m==null||m(this.lastEvent,c),this.startEvent=this.lastEvent),g==null||g(this.lastEvent,c)}),Qs(this,"onPointerMove",(c,d)=>{this.lastEvent=c,this.lastEventInfo=d,rL.update(this.updatePoint,!0)}),Qs(this,"onPointerUp",(c,d)=>{const p=c1(d,this.history),{onEnd:h,onSessionEnd:m}=this.handlers;m==null||m(c,p),this.end(),!(!h||!this.startEvent)&&(h==null||h(c,p))});var r;if(this.win=(r=e.view)!=null?r:window,_V(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:D3(e)},{timestamp:s}=AS();this.history=[{...o.point,timestamp:s}];const{onSessionStart:i}=t;i==null||i(e,c1(o,this.history)),this.removeListeners=$V(Ah(this.win,"pointermove",this.onPointerMove),Ah(this.win,"pointerup",this.onPointerUp),Ah(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),oL.update(this.updatePoint)}};function gk(e,t){return{x:e.x-t.x,y:e.y-t.y}}function c1(e,t){return{point:e.point,delta:gk(e.point,t[t.length-1]),offset:gk(e.point,t[0]),velocity:NV(t,.1)}}var TV=e=>e*1e3;function NV(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>TV(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 $V(...e){return t=>e.reduce((n,r)=>r(n),t)}function u1(e,t){return Math.abs(e-t)}function vk(e){return"x"in e&&"y"in e}function LV(e,t){if(typeof e=="number"&&typeof t=="number")return u1(e,t);if(vk(e)&&vk(t)){const n=u1(e.x,t.x),r=u1(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function T3(e){const t=l.useRef(null);return t.current=e,t}function N3(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:i,threshold:c}=t,d=!!(n||r||o||s||i),p=l.useRef(null),h=T3({onSessionStart:s,onSessionEnd:i,onStart:r,onMove:n,onEnd(m,g){p.current=null,o==null||o(m,g)}});l.useEffect(()=>{var m;(m=p.current)==null||m.updateHandlers(h.current)}),l.useEffect(()=>{const m=e.current;if(!m||!d)return;function g(b){p.current=new DV(b,h.current,c)}return Ah(m,"pointerdown",g)},[e,d,h,c]),l.useEffect(()=>()=>{var m;(m=p.current)==null||m.end(),p.current=null},[])}function zV(e,t){if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const n=e.ownerDocument.defaultView??window,r=new n.ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const[s]=o;let i,c;if("borderBoxSize"in s){const d=s.borderBoxSize,p=Array.isArray(d)?d[0]:d;i=p.inlineSize,c=p.blockSize}else i=e.offsetWidth,c=e.offsetHeight;t({width:i,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}var FV=globalThis!=null&&globalThis.document?l.useLayoutEffect:l.useEffect;function BV(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 $3({getNodes:e,observeMutation:t=!0}){const[n,r]=l.useState([]),[o,s]=l.useState(0);return FV(()=>{const i=e(),c=i.map((d,p)=>zV(d,h=>{r(m=>[...m.slice(0,p),h,...m.slice(p+1)])}));if(t){const d=i[0];c.push(BV(d,()=>{s(p=>p+1)}))}return()=>{c.forEach(d=>{d==null||d()})}},[o]),n}function HV(e){return typeof e=="object"&&e!==null&&"current"in e}function WV(e){const[t]=$3({observeMutation:!1,getNodes(){return[HV(e)?e.current:e]}});return t}function VV(e){const{min:t=0,max:n=100,onChange:r,value:o,defaultValue:s,isReversed:i,direction:c="ltr",orientation:d="horizontal",id:p,isDisabled:h,isReadOnly:m,onChangeStart:g,onChangeEnd:b,step:y=1,getAriaValueText:x,"aria-valuetext":w,"aria-label":S,"aria-labelledby":j,name:I,focusThumbOnChange:_=!0,minStepsBetweenThumbs:M=0,...E}=e,A=vr(g),R=vr(b),D=vr(x),O=A3({isReversed:i,direction:c,orientation:d}),[T,K]=Of({value:o,defaultValue:s??[25,75],onChange:r});if(!Array.isArray(T))throw new TypeError(`[range-slider] You passed an invalid value for \`value\` or \`defaultValue\`, expected \`Array\` but got \`${typeof T}\``);const[G,X]=l.useState(!1),[Z,te]=l.useState(!1),[V,oe]=l.useState(-1),ne=!(h||m),se=l.useRef(T),re=T.map(Te=>tu(Te,t,n)),ae=M*y,B=UV(re,t,n,ae),Y=l.useRef({eventSource:null,value:[],valueBounds:[]});Y.current.value=re,Y.current.valueBounds=B;const $=re.map(Te=>n-Te+t),q=(O?$:re).map(Te=>Zh(Te,t,n)),pe=d==="vertical",W=l.useRef(null),U=l.useRef(null),ee=$3({getNodes(){const Te=U.current,ct=Te==null?void 0:Te.querySelectorAll("[role=slider]");return ct?Array.from(ct):[]}}),J=l.useId(),he=SV(p??J),de=l.useCallback(Te=>{var ct,ft;if(!W.current)return;Y.current.eventSource="pointer";const tt=W.current.getBoundingClientRect(),{clientX:en,clientY:ar}=(ft=(ct=Te.touches)==null?void 0:ct[0])!=null?ft:Te,vn=pe?tt.bottom-ar:en-tt.left,dn=pe?tt.height:tt.width;let Tr=vn/dn;return O&&(Tr=1-Tr),KP(Tr,t,n)},[pe,O,n,t]),_e=(n-t)/10,Pe=y||(n-t)/100,ze=l.useMemo(()=>({setValueAtIndex(Te,ct){if(!ne)return;const ft=Y.current.valueBounds[Te];ct=parseFloat(gb(ct,ft.min,Pe)),ct=tu(ct,ft.min,ft.max);const tt=[...Y.current.value];tt[Te]=ct,K(tt)},setActiveIndex:oe,stepUp(Te,ct=Pe){const ft=Y.current.value[Te],tt=O?ft-ct:ft+ct;ze.setValueAtIndex(Te,tt)},stepDown(Te,ct=Pe){const ft=Y.current.value[Te],tt=O?ft+ct:ft-ct;ze.setValueAtIndex(Te,tt)},reset(){K(se.current)}}),[Pe,O,K,ne]),ht=l.useCallback(Te=>{const ct=Te.key,tt={ArrowRight:()=>ze.stepUp(V),ArrowUp:()=>ze.stepUp(V),ArrowLeft:()=>ze.stepDown(V),ArrowDown:()=>ze.stepDown(V),PageUp:()=>ze.stepUp(V,_e),PageDown:()=>ze.stepDown(V,_e),Home:()=>{const{min:en}=B[V];ze.setValueAtIndex(V,en)},End:()=>{const{max:en}=B[V];ze.setValueAtIndex(V,en)}}[ct];tt&&(Te.preventDefault(),Te.stopPropagation(),tt(Te),Y.current.eventSource="keyboard")},[ze,V,_e,B]),{getThumbStyle:Je,rootStyle:qt,trackStyle:Pt,innerTrackStyle:jt}=l.useMemo(()=>O3({isReversed:O,orientation:d,thumbRects:ee,thumbPercents:q}),[O,d,q,ee]),Se=l.useCallback(Te=>{var ct;const ft=Te??V;if(ft!==-1&&_){const tt=he.getThumb(ft),en=(ct=U.current)==null?void 0:ct.ownerDocument.getElementById(tt);en&&setTimeout(()=>en.focus())}},[_,V,he]);wi(()=>{Y.current.eventSource==="keyboard"&&(R==null||R(Y.current.value))},[re,R]);const Fe=Te=>{const ct=de(Te)||0,ft=Y.current.value.map(dn=>Math.abs(dn-ct)),tt=Math.min(...ft);let en=ft.indexOf(tt);const ar=ft.filter(dn=>dn===tt);ar.length>1&&ct>Y.current.value[en]&&(en=en+ar.length-1),oe(en),ze.setValueAtIndex(en,ct),Se(en)},it=Te=>{if(V==-1)return;const ct=de(Te)||0;oe(V),ze.setValueAtIndex(V,ct),Se(V)};N3(U,{onPanSessionStart(Te){ne&&(X(!0),Fe(Te),A==null||A(Y.current.value))},onPanSessionEnd(){ne&&(X(!1),R==null||R(Y.current.value))},onPan(Te){ne&&it(Te)}});const At=l.useCallback((Te={},ct=null)=>({...Te,...E,id:he.root,ref:xn(ct,U),tabIndex:-1,"aria-disabled":su(h),"data-focused":js(Z),style:{...Te.style,...qt}}),[E,h,Z,qt,he]),ke=l.useCallback((Te={},ct=null)=>({...Te,ref:xn(ct,W),id:he.track,"data-disabled":js(h),style:{...Te.style,...Pt}}),[h,Pt,he]),lt=l.useCallback((Te={},ct=null)=>({...Te,ref:ct,id:he.innerTrack,style:{...Te.style,...jt}}),[jt,he]),Rt=l.useCallback((Te,ct=null)=>{var ft;const{index:tt,...en}=Te,ar=re[tt];if(ar==null)throw new TypeError(`[range-slider > thumb] Cannot find value at index \`${tt}\`. The \`value\` or \`defaultValue\` length is : ${re.length}`);const vn=B[tt];return{...en,ref:ct,role:"slider",tabIndex:ne?0:void 0,id:he.getThumb(tt),"data-active":js(G&&V===tt),"aria-valuetext":(ft=D==null?void 0:D(ar))!=null?ft:w==null?void 0:w[tt],"aria-valuemin":vn.min,"aria-valuemax":vn.max,"aria-valuenow":ar,"aria-orientation":d,"aria-disabled":su(h),"aria-readonly":su(m),"aria-label":S==null?void 0:S[tt],"aria-labelledby":S!=null&&S[tt]||j==null?void 0:j[tt],style:{...Te.style,...Je(tt)},onKeyDown:au(Te.onKeyDown,ht),onFocus:au(Te.onFocus,()=>{te(!0),oe(tt)}),onBlur:au(Te.onBlur,()=>{te(!1),oe(-1)})}},[he,re,B,ne,G,V,D,w,d,h,m,S,j,Je,ht,te]),zt=l.useCallback((Te={},ct=null)=>({...Te,ref:ct,id:he.output,htmlFor:re.map((ft,tt)=>he.getThumb(tt)).join(" "),"aria-live":"off"}),[he,re]),Re=l.useCallback((Te,ct=null)=>{const{value:ft,...tt}=Te,en=!(ftn),ar=ft>=re[0]&&ft<=re[re.length-1];let vn=Zh(ft,t,n);vn=O?100-vn:vn;const dn={position:"absolute",pointerEvents:"none",...Od({orientation:d,vertical:{bottom:`${vn}%`},horizontal:{left:`${vn}%`}})};return{...tt,ref:ct,id:he.getMarker(Te.value),role:"presentation","aria-hidden":!0,"data-disabled":js(h),"data-invalid":js(!en),"data-highlighted":js(ar),style:{...Te.style,...dn}}},[h,O,n,t,d,re,he]),Qe=l.useCallback((Te,ct=null)=>{const{index:ft,...tt}=Te;return{...tt,ref:ct,id:he.getInput(ft),type:"hidden",value:re[ft],name:Array.isArray(I)?I[ft]:`${I}-${ft}`}},[I,re,he]);return{state:{value:re,isFocused:Z,isDragging:G,getThumbPercent:Te=>q[Te],getThumbMinValue:Te=>B[Te].min,getThumbMaxValue:Te=>B[Te].max},actions:ze,getRootProps:At,getTrackProps:ke,getInnerTrackProps:lt,getThumbProps:Rt,getMarkerProps:Re,getInputProps:Qe,getOutputProps:zt}}function UV(e,t,n,r){return e.map((o,s)=>{const i=s===0?t:e[s-1]+r,c=s===e.length-1?n:e[s+1]-r;return{min:i,max:c}})}var[GV,Vg]=Un({name:"SliderContext",errorMessage:"useSliderContext: `context` is undefined. Seems you forgot to wrap all slider components within "}),[qV,Ug]=Un({name:"RangeSliderStylesContext",errorMessage:`useRangeSliderStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),L3=De(function(t,n){const r={orientation:"horizontal",...t},o=no("Slider",r),s=lr(r),{direction:i}=kf();s.direction=i;const{getRootProps:c,...d}=VV(s),p=l.useMemo(()=>({...d,name:r.name}),[d,r.name]);return a.jsx(GV,{value:p,children:a.jsx(qV,{value:o,children:a.jsx(Ae.div,{...c({},n),className:"chakra-slider",__css:o.container,children:r.children})})})});L3.displayName="RangeSlider";var Ob=De(function(t,n){const{getThumbProps:r,getInputProps:o,name:s}=Vg(),i=Ug(),c=r(t,n);return a.jsxs(Ae.div,{...c,className:dl("chakra-slider__thumb",t.className),__css:i.thumb,children:[c.children,s&&a.jsx("input",{...o({index:t.index})})]})});Ob.displayName="RangeSliderThumb";var z3=De(function(t,n){const{getTrackProps:r}=Vg(),o=Ug(),s=r(t,n);return a.jsx(Ae.div,{...s,className:dl("chakra-slider__track",t.className),__css:o.track,"data-testid":"chakra-range-slider-track"})});z3.displayName="RangeSliderTrack";var F3=De(function(t,n){const{getInnerTrackProps:r}=Vg(),o=Ug(),s=r(t,n);return a.jsx(Ae.div,{...s,className:"chakra-slider__filled-track",__css:o.filledTrack})});F3.displayName="RangeSliderFilledTrack";var Rh=De(function(t,n){const{getMarkerProps:r}=Vg(),o=Ug(),s=r(t,n);return a.jsx(Ae.div,{...s,className:dl("chakra-slider__marker",t.className),__css:o.mark})});Rh.displayName="RangeSliderMark";function KV(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:i,isReversed:c,direction:d="ltr",orientation:p="horizontal",id:h,isDisabled:m,isReadOnly:g,onChangeStart:b,onChangeEnd:y,step:x=1,getAriaValueText:w,"aria-valuetext":S,"aria-label":j,"aria-labelledby":I,name:_,focusThumbOnChange:M=!0,...E}=e,A=vr(b),R=vr(y),D=vr(w),O=A3({isReversed:c,direction:d,orientation:p}),[T,K]=Of({value:s,defaultValue:i??XV(n,r),onChange:o}),[G,X]=l.useState(!1),[Z,te]=l.useState(!1),V=!(m||g),oe=(r-n)/10,ne=x||(r-n)/100,se=tu(T,n,r),re=r-se+n,B=Zh(O?re:se,n,r),Y=p==="vertical",$=T3({min:n,max:r,step:x,isDisabled:m,value:se,isInteractive:V,isReversed:O,isVertical:Y,eventSource:null,focusThumbOnChange:M,orientation:p}),F=l.useRef(null),q=l.useRef(null),pe=l.useRef(null),W=l.useId(),U=h??W,[ee,J]=[`slider-thumb-${U}`,`slider-track-${U}`],ge=l.useCallback(Re=>{var Qe,En;if(!F.current)return;const Te=$.current;Te.eventSource="pointer";const ct=F.current.getBoundingClientRect(),{clientX:ft,clientY:tt}=(En=(Qe=Re.touches)==null?void 0:Qe[0])!=null?En:Re,en=Y?ct.bottom-tt:ft-ct.left,ar=Y?ct.height:ct.width;let vn=en/ar;O&&(vn=1-vn);let dn=KP(vn,Te.min,Te.max);return Te.step&&(dn=parseFloat(gb(dn,Te.min,Te.step))),dn=tu(dn,Te.min,Te.max),dn},[Y,O,$]),he=l.useCallback(Re=>{const Qe=$.current;Qe.isInteractive&&(Re=parseFloat(gb(Re,Qe.min,ne)),Re=tu(Re,Qe.min,Qe.max),K(Re))},[ne,K,$]),de=l.useMemo(()=>({stepUp(Re=ne){const Qe=O?se-Re:se+Re;he(Qe)},stepDown(Re=ne){const Qe=O?se+Re:se-Re;he(Qe)},reset(){he(i||0)},stepTo(Re){he(Re)}}),[he,O,se,ne,i]),_e=l.useCallback(Re=>{const Qe=$.current,Te={ArrowRight:()=>de.stepUp(),ArrowUp:()=>de.stepUp(),ArrowLeft:()=>de.stepDown(),ArrowDown:()=>de.stepDown(),PageUp:()=>de.stepUp(oe),PageDown:()=>de.stepDown(oe),Home:()=>he(Qe.min),End:()=>he(Qe.max)}[Re.key];Te&&(Re.preventDefault(),Re.stopPropagation(),Te(Re),Qe.eventSource="keyboard")},[de,he,oe,$]),Pe=(t=D==null?void 0:D(se))!=null?t:S,ze=WV(q),{getThumbStyle:ht,rootStyle:Je,trackStyle:qt,innerTrackStyle:Pt}=l.useMemo(()=>{const Re=$.current,Qe=ze??{width:0,height:0};return O3({isReversed:O,orientation:Re.orientation,thumbRects:[Qe],thumbPercents:[B]})},[O,ze,B,$]),jt=l.useCallback(()=>{$.current.focusThumbOnChange&&setTimeout(()=>{var Qe;return(Qe=q.current)==null?void 0:Qe.focus()})},[$]);wi(()=>{const Re=$.current;jt(),Re.eventSource==="keyboard"&&(R==null||R(Re.value))},[se,R]);function Se(Re){const Qe=ge(Re);Qe!=null&&Qe!==$.current.value&&K(Qe)}N3(pe,{onPanSessionStart(Re){const Qe=$.current;Qe.isInteractive&&(X(!0),jt(),Se(Re),A==null||A(Qe.value))},onPanSessionEnd(){const Re=$.current;Re.isInteractive&&(X(!1),R==null||R(Re.value))},onPan(Re){$.current.isInteractive&&Se(Re)}});const Fe=l.useCallback((Re={},Qe=null)=>({...Re,...E,ref:xn(Qe,pe),tabIndex:-1,"aria-disabled":su(m),"data-focused":js(Z),style:{...Re.style,...Je}}),[E,m,Z,Je]),it=l.useCallback((Re={},Qe=null)=>({...Re,ref:xn(Qe,F),id:J,"data-disabled":js(m),style:{...Re.style,...qt}}),[m,J,qt]),At=l.useCallback((Re={},Qe=null)=>({...Re,ref:Qe,style:{...Re.style,...Pt}}),[Pt]),ke=l.useCallback((Re={},Qe=null)=>({...Re,ref:xn(Qe,q),role:"slider",tabIndex:V?0:void 0,id:ee,"data-active":js(G),"aria-valuetext":Pe,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":se,"aria-orientation":p,"aria-disabled":su(m),"aria-readonly":su(g),"aria-label":j,"aria-labelledby":j?void 0:I,style:{...Re.style,...ht(0)},onKeyDown:au(Re.onKeyDown,_e),onFocus:au(Re.onFocus,()=>te(!0)),onBlur:au(Re.onBlur,()=>te(!1))}),[V,ee,G,Pe,n,r,se,p,m,g,j,I,ht,_e]),lt=l.useCallback((Re,Qe=null)=>{const En=!(Re.valuer),Te=se>=Re.value,ct=Zh(Re.value,n,r),ft={position:"absolute",pointerEvents:"none",...QV({orientation:p,vertical:{bottom:O?`${100-ct}%`:`${ct}%`},horizontal:{left:O?`${100-ct}%`:`${ct}%`}})};return{...Re,ref:Qe,role:"presentation","aria-hidden":!0,"data-disabled":js(m),"data-invalid":js(!En),"data-highlighted":js(Te),style:{...Re.style,...ft}}},[m,O,r,n,p,se]),Rt=l.useCallback((Re={},Qe=null)=>({...Re,ref:Qe,type:"hidden",value:se,name:_}),[_,se]);return{state:{value:se,isFocused:Z,isDragging:G},actions:de,getRootProps:Fe,getTrackProps:it,getInnerTrackProps:At,getThumbProps:ke,getMarkerProps:lt,getInputProps:Rt}}function QV(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function XV(e,t){return t"}),[JV,qg]=Un({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),Ny=De((e,t)=>{var n;const r={...e,orientation:(n=e==null?void 0:e.orientation)!=null?n:"horizontal"},o=no("Slider",r),s=lr(r),{direction:i}=kf();s.direction=i;const{getInputProps:c,getRootProps:d,...p}=KV(s),h=d(),m=c({},t);return a.jsx(YV,{value:p,children:a.jsx(JV,{value:o,children:a.jsxs(Ae.div,{...h,className:dl("chakra-slider",r.className),__css:o.container,children:[r.children,a.jsx("input",{...m})]})})})});Ny.displayName="Slider";var $y=De((e,t)=>{const{getThumbProps:n}=Gg(),r=qg(),o=n(e,t);return a.jsx(Ae.div,{...o,className:dl("chakra-slider__thumb",e.className),__css:r.thumb})});$y.displayName="SliderThumb";var Ly=De((e,t)=>{const{getTrackProps:n}=Gg(),r=qg(),o=n(e,t);return a.jsx(Ae.div,{...o,className:dl("chakra-slider__track",e.className),__css:r.track})});Ly.displayName="SliderTrack";var zy=De((e,t)=>{const{getInnerTrackProps:n}=Gg(),r=qg(),o=n(e,t);return a.jsx(Ae.div,{...o,className:dl("chakra-slider__filled-track",e.className),__css:r.filledTrack})});zy.displayName="SliderFilledTrack";var Fc=De((e,t)=>{const{getMarkerProps:n}=Gg(),r=qg(),o=n(e,t);return a.jsx(Ae.div,{...o,className:dl("chakra-slider__marker",e.className),__css:r.mark})});Fc.displayName="SliderMark";var[ZV,B3]=Un({name:"StatStylesContext",errorMessage:`useStatStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),H3=De(function(t,n){const r=no("Stat",t),o={position:"relative",flex:"1 1 0%",...r.container},{className:s,children:i,...c}=lr(t);return a.jsx(ZV,{value:r,children:a.jsx(Ae.div,{ref:n,...c,className:kt("chakra-stat",s),__css:o,children:a.jsx("dl",{children:i})})})});H3.displayName="Stat";var W3=De(function(t,n){return a.jsx(Ae.div,{...t,ref:n,role:"group",className:kt("chakra-stat__group",t.className),__css:{display:"flex",flexWrap:"wrap",justifyContent:"space-around",alignItems:"flex-start"}})});W3.displayName="StatGroup";var V3=De(function(t,n){const r=B3();return a.jsx(Ae.dt,{ref:n,...t,className:kt("chakra-stat__label",t.className),__css:r.label})});V3.displayName="StatLabel";var U3=De(function(t,n){const r=B3();return a.jsx(Ae.dd,{ref:n,...t,className:kt("chakra-stat__number",t.className),__css:{...r.number,fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums"}})});U3.displayName="StatNumber";var Fy=De(function(t,n){const r=no("Switch",t),{spacing:o="0.5rem",children:s,...i}=lr(t),{getIndicatorProps:c,getInputProps:d,getCheckboxProps:p,getRootProps:h,getLabelProps:m}=qP(i),g=l.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),b=l.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),y=l.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return a.jsxs(Ae.label,{...h(),className:kt("chakra-switch",t.className),__css:g,children:[a.jsx("input",{className:"chakra-switch__input",...d({},n)}),a.jsx(Ae.span,{...p(),className:"chakra-switch__track",__css:b,children:a.jsx(Ae.span,{__css:r.thumb,className:"chakra-switch__thumb",...c()})}),s&&a.jsx(Ae.span,{className:"chakra-switch__label",...m(),__css:y,children:s})]})});Fy.displayName="Switch";var[eU,tU,nU,rU]=ry();function oU(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:i,lazyBehavior:c="unmount",orientation:d="horizontal",direction:p="ltr",...h}=e,[m,g]=l.useState(n??0),[b,y]=Of({defaultValue:n??0,value:o,onChange:r});l.useEffect(()=>{o!=null&&g(o)},[o]);const x=nU(),w=l.useId();return{id:`tabs-${(t=e.id)!=null?t:w}`,selectedIndex:b,focusedIndex:m,setSelectedIndex:y,setFocusedIndex:g,isManual:s,isLazy:i,lazyBehavior:c,orientation:d,descendants:x,direction:p,htmlProps:h}}var[sU,Kg]=Un({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function aU(e){const{focusedIndex:t,orientation:n,direction:r}=Kg(),o=tU(),s=l.useCallback(i=>{const c=()=>{var j;const I=o.nextEnabled(t);I&&((j=I.node)==null||j.focus())},d=()=>{var j;const I=o.prevEnabled(t);I&&((j=I.node)==null||j.focus())},p=()=>{var j;const I=o.firstEnabled();I&&((j=I.node)==null||j.focus())},h=()=>{var j;const I=o.lastEnabled();I&&((j=I.node)==null||j.focus())},m=n==="horizontal",g=n==="vertical",b=i.key,y=r==="ltr"?"ArrowLeft":"ArrowRight",x=r==="ltr"?"ArrowRight":"ArrowLeft",S={[y]:()=>m&&d(),[x]:()=>m&&c(),ArrowDown:()=>g&&c(),ArrowUp:()=>g&&d(),Home:p,End:h}[b];S&&(i.preventDefault(),S(i))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:ot(e.onKeyDown,s)}}function iU(e){const{isDisabled:t=!1,isFocusable:n=!1,...r}=e,{setSelectedIndex:o,isManual:s,id:i,setFocusedIndex:c,selectedIndex:d}=Kg(),{index:p,register:h}=rU({disabled:t&&!n}),m=p===d,g=()=>{o(p)},b=()=>{c(p),!s&&!(t&&n)&&o(p)},y=K5({...r,ref:xn(h,e.ref),isDisabled:t,isFocusable:n,onClick:ot(e.onClick,g)}),x="button";return{...y,id:G3(i,p),role:"tab",tabIndex:m?0:-1,type:x,"aria-selected":m,"aria-controls":q3(i,p),onFocus:t?void 0:ot(e.onFocus,b)}}var[lU,cU]=Un({});function uU(e){const t=Kg(),{id:n,selectedIndex:r}=t,s=Sg(e.children).map((i,c)=>l.createElement(lU,{key:c,value:{isSelected:c===r,id:q3(n,c),tabId:G3(n,c),selectedIndex:r}},i));return{...e,children:s}}function dU(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=Kg(),{isSelected:s,id:i,tabId:c}=cU(),d=l.useRef(!1);s&&(d.current=!0);const p=Dy({wasSelected:d.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:p?t:null,role:"tabpanel","aria-labelledby":c,hidden:!s,id:i}}function G3(e,t){return`${e}--tab-${t}`}function q3(e,t){return`${e}--tabpanel-${t}`}var[fU,Qg]=Un({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),tc=De(function(t,n){const r=no("Tabs",t),{children:o,className:s,...i}=lr(t),{htmlProps:c,descendants:d,...p}=oU(i),h=l.useMemo(()=>p,[p]),{isFitted:m,...g}=c,b={position:"relative",...r.root};return a.jsx(eU,{value:d,children:a.jsx(sU,{value:h,children:a.jsx(fU,{value:r,children:a.jsx(Ae.div,{className:kt("chakra-tabs",s),ref:n,...g,__css:b,children:o})})})})});tc.displayName="Tabs";var nc=De(function(t,n){const r=aU({...t,ref:n}),s={display:"flex",...Qg().tablist};return a.jsx(Ae.div,{...r,className:kt("chakra-tabs__tablist",t.className),__css:s})});nc.displayName="TabList";var Go=De(function(t,n){const r=dU({...t,ref:n}),o=Qg();return a.jsx(Ae.div,{outline:"0",...r,className:kt("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});Go.displayName="TabPanel";var $u=De(function(t,n){const r=uU(t),o=Qg();return a.jsx(Ae.div,{...r,width:"100%",ref:n,className:kt("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});$u.displayName="TabPanels";var wo=De(function(t,n){const r=Qg(),o=iU({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return a.jsx(Ae.button,{...o,className:kt("chakra-tabs__tab",t.className),__css:s})});wo.displayName="Tab";function pU(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var hU=["h","minH","height","minHeight"],K3=De((e,t)=>{const n=cl("Textarea",e),{className:r,rows:o,...s}=lr(e),i=ay(s),c=o?pU(n,hU):n;return a.jsx(Ae.textarea,{ref:t,rows:o,...i,className:kt("chakra-textarea",r),__css:c})});K3.displayName="Textarea";var mU={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]}}}},Ab=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},Dh=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function gU(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:i=o,closeOnEsc:c=!0,onOpen:d,onClose:p,placement:h,id:m,isOpen:g,defaultIsOpen:b,arrowSize:y=10,arrowShadowColor:x,arrowPadding:w,modifiers:S,isDisabled:j,gutter:I,offset:_,direction:M,...E}=e,{isOpen:A,onOpen:R,onClose:D}=Ry({isOpen:g,defaultIsOpen:b,onOpen:d,onClose:p}),{referenceRef:O,getPopperProps:T,getArrowInnerProps:K,getArrowProps:G}=Ay({enabled:A,placement:h,arrowPadding:w,modifiers:S,gutter:I,offset:_,direction:M}),X=l.useId(),te=`tooltip-${m??X}`,V=l.useRef(null),oe=l.useRef(),ne=l.useCallback(()=>{oe.current&&(clearTimeout(oe.current),oe.current=void 0)},[]),se=l.useRef(),re=l.useCallback(()=>{se.current&&(clearTimeout(se.current),se.current=void 0)},[]),ae=l.useCallback(()=>{re(),D()},[D,re]),B=vU(V,ae),Y=l.useCallback(()=>{if(!j&&!oe.current){A&&B();const J=Dh(V);oe.current=J.setTimeout(R,t)}},[B,j,A,R,t]),$=l.useCallback(()=>{ne();const J=Dh(V);se.current=J.setTimeout(ae,n)},[n,ae,ne]),F=l.useCallback(()=>{A&&r&&$()},[r,$,A]),q=l.useCallback(()=>{A&&i&&$()},[i,$,A]),pe=l.useCallback(J=>{A&&J.key==="Escape"&&$()},[A,$]);Nl(()=>Ab(V),"keydown",c?pe:void 0),Nl(()=>{if(!s)return null;const J=V.current;if(!J)return null;const ge=T5(J);return ge.localName==="body"?Dh(V):ge},"scroll",()=>{A&&s&&ae()},{passive:!0,capture:!0}),l.useEffect(()=>{j&&(ne(),A&&D())},[j,A,D,ne]),l.useEffect(()=>()=>{ne(),re()},[ne,re]),Nl(()=>V.current,"pointerleave",$);const W=l.useCallback((J={},ge=null)=>({...J,ref:xn(V,ge,O),onPointerEnter:ot(J.onPointerEnter,de=>{de.pointerType!=="touch"&&Y()}),onClick:ot(J.onClick,F),onPointerDown:ot(J.onPointerDown,q),onFocus:ot(J.onFocus,Y),onBlur:ot(J.onBlur,$),"aria-describedby":A?te:void 0}),[Y,$,q,A,te,F,O]),U=l.useCallback((J={},ge=null)=>T({...J,style:{...J.style,[qr.arrowSize.var]:y?`${y}px`:void 0,[qr.arrowShadowColor.var]:x}},ge),[T,y,x]),ee=l.useCallback((J={},ge=null)=>{const he={...J.style,position:"relative",transformOrigin:qr.transformOrigin.varRef};return{ref:ge,...E,...J,id:te,role:"tooltip",style:he}},[E,te]);return{isOpen:A,show:Y,hide:$,getTriggerProps:W,getTooltipProps:ee,getTooltipPositionerProps:U,getArrowProps:G,getArrowInnerProps:K}}var d1="chakra-ui:close-tooltip";function vU(e,t){return l.useEffect(()=>{const n=Ab(e);return n.addEventListener(d1,t),()=>n.removeEventListener(d1,t)},[t,e]),()=>{const n=Ab(e),r=Dh(e);n.dispatchEvent(new r.CustomEvent(d1))}}function bU(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function xU(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var yU=Ae(Ar.div),Wn=De((e,t)=>{var n,r;const o=cl("Tooltip",e),s=lr(e),i=kf(),{children:c,label:d,shouldWrapChildren:p,"aria-label":h,hasArrow:m,bg:g,portalProps:b,background:y,backgroundColor:x,bgColor:w,motionProps:S,...j}=s,I=(r=(n=y??x)!=null?n:g)!=null?r:w;if(I){o.bg=I;const T=mD(i,"colors",I);o[qr.arrowBg.var]=T}const _=gU({...j,direction:i.direction}),M=typeof c=="string"||p;let E;if(M)E=a.jsx(Ae.span,{display:"inline-block",tabIndex:0,..._.getTriggerProps(),children:c});else{const T=l.Children.only(c);E=l.cloneElement(T,_.getTriggerProps(T.props,T.ref))}const A=!!h,R=_.getTooltipProps({},t),D=A?bU(R,["role","id"]):R,O=xU(R,["role","id"]);return d?a.jsxs(a.Fragment,{children:[E,a.jsx(So,{children:_.isOpen&&a.jsx(Au,{...b,children:a.jsx(Ae.div,{..._.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:a.jsxs(yU,{variants:mU,initial:"exit",animate:"enter",exit:"exit",...S,...D,__css:o,children:[d,A&&a.jsx(Ae.span,{srOnly:!0,...O,children:h}),m&&a.jsx(Ae.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:a.jsx(Ae.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):a.jsx(a.Fragment,{children:c})});Wn.displayName="Tooltip";function Xg(e,t={}){let n=l.useCallback(o=>t.keys?D$(e,t.keys,o):e.listen(o),[t.keys,e]),r=e.get.bind(e);return l.useSyncExternalStore(n,r,r)}const CU=me(we,({system:e})=>{const{consoleLogLevel:t,shouldLogToConsole:n}=e;return{consoleLogLevel:t,shouldLogToConsole:n}},{memoizeOptions:{resultEqualityCheck:Nn}}),Q3=e=>{const{consoleLogLevel:t,shouldLogToConsole:n}=H(CU);return l.useEffect(()=>{n?(localStorage.setItem("ROARR_LOG","true"),localStorage.setItem("ROARR_FILTER",`context.logLevel:>=${gD[t]}`)):localStorage.setItem("ROARR_LOG","false"),Bw.ROARR.write=vD.createLogWriter()},[t,n]),l.useEffect(()=>{const o={...bD};xD.set(Bw.Roarr.child(o))},[]),l.useMemo(()=>ki(e),[e])};function Lu(e,t,n,r){function o(s){return s instanceof n?s:new n(function(i){i(s)})}return new(n||(n=Promise))(function(s,i){function c(h){try{p(r.next(h))}catch(m){i(m)}}function d(h){try{p(r.throw(h))}catch(m){i(m)}}function p(h){h.done?s(h.value):o(h.value).then(c,d)}p((r=r.apply(e,t||[])).next())})}function zu(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,o,s,i;return i={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(p){return function(h){return d([p,h])}}function d(p){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,p[0]&&(n=0)),n;)try{if(r=1,o&&(s=p[0]&2?o.return:p[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,p[1])).done)return s;switch(o=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,o=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]0)&&!(o=r.next()).done;)s.push(o.value)}catch(c){i={error:c}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function xk(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function SU(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=wU.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var kU=[".DS_Store","Thumbs.db"];function jU(e){return Lu(this,void 0,void 0,function(){return zu(this,function(t){return sm(e)&&_U(e.dataTransfer)?[2,MU(e.dataTransfer,e.type)]:IU(e)?[2,PU(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,EU(e)]:[2,[]]})})}function _U(e){return sm(e)}function IU(e){return sm(e)&&sm(e.target)}function sm(e){return typeof e=="object"&&e!==null}function PU(e){return Rb(e.target.files).map(function(t){return qf(t)})}function EU(e){return Lu(this,void 0,void 0,function(){var t;return zu(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 qf(r)})]}})})}function MU(e,t){return Lu(this,void 0,void 0,function(){var n,r;return zu(this,function(o){switch(o.label){case 0:return e.items?(n=Rb(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(OU))]):[3,2];case 1:return r=o.sent(),[2,yk(X3(r))];case 2:return[2,yk(Rb(e.files).map(function(s){return qf(s)}))]}})})}function yk(e){return e.filter(function(t){return kU.indexOf(t.name)===-1})}function Rb(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,jk(n)];if(e.sizen)return[!1,jk(n)]}return[!0,null]}function Ml(e){return e!=null}function qU(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,i=e.maxFiles,c=e.validator;return!s&&t.length>1||s&&i>=1&&t.length>i?!1:t.every(function(d){var p=e6(d,n),h=lf(p,1),m=h[0],g=t6(d,r,o),b=lf(g,1),y=b[0],x=c?c(d):null;return m&&y&&!x})}function am(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function nh(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 Ik(e){e.preventDefault()}function KU(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function QU(e){return e.indexOf("Edge/")!==-1}function XU(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return KU(e)||QU(e)}function ya(){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 pG(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 By=l.forwardRef(function(e,t){var n=e.children,r=im(e,nG),o=Hy(r),s=o.open,i=im(o,rG);return l.useImperativeHandle(t,function(){return{open:s}},[s]),z.createElement(l.Fragment,null,n(kr(kr({},i),{},{open:s})))});By.displayName="Dropzone";var s6={disabled:!1,getFilesFromEvent:jU,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};By.defaultProps=s6;By.propTypes={children:nr.func,accept:nr.objectOf(nr.arrayOf(nr.string)),multiple:nr.bool,preventDropOnDocument:nr.bool,noClick:nr.bool,noKeyboard:nr.bool,noDrag:nr.bool,noDragEventsBubbling:nr.bool,minSize:nr.number,maxSize:nr.number,maxFiles:nr.number,disabled:nr.bool,getFilesFromEvent:nr.func,onFileDialogCancel:nr.func,onFileDialogOpen:nr.func,useFsAccessApi:nr.bool,autoFocus:nr.bool,onDragEnter:nr.func,onDragLeave:nr.func,onDragOver:nr.func,onDrop:nr.func,onDropAccepted:nr.func,onDropRejected:nr.func,onError:nr.func,validator:nr.func};var $b={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Hy(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=kr(kr({},s6),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,i=t.minSize,c=t.multiple,d=t.maxFiles,p=t.onDragEnter,h=t.onDragLeave,m=t.onDragOver,g=t.onDrop,b=t.onDropAccepted,y=t.onDropRejected,x=t.onFileDialogCancel,w=t.onFileDialogOpen,S=t.useFsAccessApi,j=t.autoFocus,I=t.preventDropOnDocument,_=t.noClick,M=t.noKeyboard,E=t.noDrag,A=t.noDragEventsBubbling,R=t.onError,D=t.validator,O=l.useMemo(function(){return ZU(n)},[n]),T=l.useMemo(function(){return JU(n)},[n]),K=l.useMemo(function(){return typeof w=="function"?w:Ek},[w]),G=l.useMemo(function(){return typeof x=="function"?x:Ek},[x]),X=l.useRef(null),Z=l.useRef(null),te=l.useReducer(hG,$b),V=f1(te,2),oe=V[0],ne=V[1],se=oe.isFocused,re=oe.isFileDialogActive,ae=l.useRef(typeof window<"u"&&window.isSecureContext&&S&&YU()),B=function(){!ae.current&&re&&setTimeout(function(){if(Z.current){var Fe=Z.current.files;Fe.length||(ne({type:"closeDialog"}),G())}},300)};l.useEffect(function(){return window.addEventListener("focus",B,!1),function(){window.removeEventListener("focus",B,!1)}},[Z,re,G,ae]);var Y=l.useRef([]),$=function(Fe){X.current&&X.current.contains(Fe.target)||(Fe.preventDefault(),Y.current=[])};l.useEffect(function(){return I&&(document.addEventListener("dragover",Ik,!1),document.addEventListener("drop",$,!1)),function(){I&&(document.removeEventListener("dragover",Ik),document.removeEventListener("drop",$))}},[X,I]),l.useEffect(function(){return!r&&j&&X.current&&X.current.focus(),function(){}},[X,j,r]);var F=l.useCallback(function(Se){R?R(Se):console.error(Se)},[R]),q=l.useCallback(function(Se){Se.preventDefault(),Se.persist(),Je(Se),Y.current=[].concat(aG(Y.current),[Se.target]),nh(Se)&&Promise.resolve(o(Se)).then(function(Fe){if(!(am(Se)&&!A)){var it=Fe.length,At=it>0&&qU({files:Fe,accept:O,minSize:i,maxSize:s,multiple:c,maxFiles:d,validator:D}),ke=it>0&&!At;ne({isDragAccept:At,isDragReject:ke,isDragActive:!0,type:"setDraggedFiles"}),p&&p(Se)}}).catch(function(Fe){return F(Fe)})},[o,p,F,A,O,i,s,c,d,D]),pe=l.useCallback(function(Se){Se.preventDefault(),Se.persist(),Je(Se);var Fe=nh(Se);if(Fe&&Se.dataTransfer)try{Se.dataTransfer.dropEffect="copy"}catch{}return Fe&&m&&m(Se),!1},[m,A]),W=l.useCallback(function(Se){Se.preventDefault(),Se.persist(),Je(Se);var Fe=Y.current.filter(function(At){return X.current&&X.current.contains(At)}),it=Fe.indexOf(Se.target);it!==-1&&Fe.splice(it,1),Y.current=Fe,!(Fe.length>0)&&(ne({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),nh(Se)&&h&&h(Se))},[X,h,A]),U=l.useCallback(function(Se,Fe){var it=[],At=[];Se.forEach(function(ke){var lt=e6(ke,O),Rt=f1(lt,2),zt=Rt[0],Re=Rt[1],Qe=t6(ke,i,s),En=f1(Qe,2),Te=En[0],ct=En[1],ft=D?D(ke):null;if(zt&&Te&&!ft)it.push(ke);else{var tt=[Re,ct];ft&&(tt=tt.concat(ft)),At.push({file:ke,errors:tt.filter(function(en){return en})})}}),(!c&&it.length>1||c&&d>=1&&it.length>d)&&(it.forEach(function(ke){At.push({file:ke,errors:[GU]})}),it.splice(0)),ne({acceptedFiles:it,fileRejections:At,type:"setFiles"}),g&&g(it,At,Fe),At.length>0&&y&&y(At,Fe),it.length>0&&b&&b(it,Fe)},[ne,c,O,i,s,d,g,b,y,D]),ee=l.useCallback(function(Se){Se.preventDefault(),Se.persist(),Je(Se),Y.current=[],nh(Se)&&Promise.resolve(o(Se)).then(function(Fe){am(Se)&&!A||U(Fe,Se)}).catch(function(Fe){return F(Fe)}),ne({type:"reset"})},[o,U,F,A]),J=l.useCallback(function(){if(ae.current){ne({type:"openDialog"}),K();var Se={multiple:c,types:T};window.showOpenFilePicker(Se).then(function(Fe){return o(Fe)}).then(function(Fe){U(Fe,null),ne({type:"closeDialog"})}).catch(function(Fe){eG(Fe)?(G(Fe),ne({type:"closeDialog"})):tG(Fe)?(ae.current=!1,Z.current?(Z.current.value=null,Z.current.click()):F(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."))):F(Fe)});return}Z.current&&(ne({type:"openDialog"}),K(),Z.current.value=null,Z.current.click())},[ne,K,G,S,U,F,T,c]),ge=l.useCallback(function(Se){!X.current||!X.current.isEqualNode(Se.target)||(Se.key===" "||Se.key==="Enter"||Se.keyCode===32||Se.keyCode===13)&&(Se.preventDefault(),J())},[X,J]),he=l.useCallback(function(){ne({type:"focus"})},[]),de=l.useCallback(function(){ne({type:"blur"})},[]),_e=l.useCallback(function(){_||(XU()?setTimeout(J,0):J())},[_,J]),Pe=function(Fe){return r?null:Fe},ze=function(Fe){return M?null:Pe(Fe)},ht=function(Fe){return E?null:Pe(Fe)},Je=function(Fe){A&&Fe.stopPropagation()},qt=l.useMemo(function(){return function(){var Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Fe=Se.refKey,it=Fe===void 0?"ref":Fe,At=Se.role,ke=Se.onKeyDown,lt=Se.onFocus,Rt=Se.onBlur,zt=Se.onClick,Re=Se.onDragEnter,Qe=Se.onDragOver,En=Se.onDragLeave,Te=Se.onDrop,ct=im(Se,oG);return kr(kr(Nb({onKeyDown:ze(ya(ke,ge)),onFocus:ze(ya(lt,he)),onBlur:ze(ya(Rt,de)),onClick:Pe(ya(zt,_e)),onDragEnter:ht(ya(Re,q)),onDragOver:ht(ya(Qe,pe)),onDragLeave:ht(ya(En,W)),onDrop:ht(ya(Te,ee)),role:typeof At=="string"&&At!==""?At:"presentation"},it,X),!r&&!M?{tabIndex:0}:{}),ct)}},[X,ge,he,de,_e,q,pe,W,ee,M,E,r]),Pt=l.useCallback(function(Se){Se.stopPropagation()},[]),jt=l.useMemo(function(){return function(){var Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Fe=Se.refKey,it=Fe===void 0?"ref":Fe,At=Se.onChange,ke=Se.onClick,lt=im(Se,sG),Rt=Nb({accept:O,multiple:c,type:"file",style:{display:"none"},onChange:Pe(ya(At,ee)),onClick:Pe(ya(ke,Pt)),tabIndex:-1},it,Z);return kr(kr({},Rt),lt)}},[Z,n,c,ee,r]);return kr(kr({},oe),{},{isFocused:se&&!r,getRootProps:qt,getInputProps:jt,rootRef:X,inputRef:Z,open:Pe(J)})}function hG(e,t){switch(t.type){case"focus":return kr(kr({},e),{},{isFocused:!0});case"blur":return kr(kr({},e),{},{isFocused:!1});case"openDialog":return kr(kr({},$b),{},{isFileDialogActive:!0});case"closeDialog":return kr(kr({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return kr(kr({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return kr(kr({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return kr({},$b);default:return e}}function Ek(){}function Lb(){return Lb=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 CG=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,i=n.mod,c=n.shift,d=n.ctrl,p=n.keys,h=t.key,m=t.code,g=t.ctrlKey,b=t.metaKey,y=t.shiftKey,x=t.altKey,w=qi(m),S=h.toLowerCase();if(!r){if(o===!x&&S!=="alt"||c===!y&&S!=="shift")return!1;if(i){if(!b&&!g)return!1}else if(s===!b&&S!=="meta"&&S!=="os"||d===!g&&S!=="ctrl"&&S!=="control")return!1}return p&&p.length===1&&(p.includes(S)||p.includes(w))?!0:p?Th(p):!p},wG=l.createContext(void 0),SG=function(){return l.useContext(wG)};function u6(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&&u6(e[r],t[r])},!0):e===t}var kG=l.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),jG=function(){return l.useContext(kG)};function _G(e){var t=l.useRef(void 0);return u6(t.current,e)||(t.current=e),t.current}var Mk=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},IG=typeof window<"u"?l.useLayoutEffect:l.useEffect;function _t(e,t,n,r){var o=l.useRef(null),s=l.useRef(!1),i=n instanceof Array?r instanceof Array?void 0:r:n,c=Wy(e)?e.join(i==null?void 0:i.splitKey):e,d=n instanceof Array?n:r instanceof Array?r:void 0,p=l.useCallback(t,d??[]),h=l.useRef(p);d?h.current=p:h.current=t;var m=_G(i),g=jG(),b=g.enabledScopes,y=SG();return IG(function(){if(!((m==null?void 0:m.enabled)===!1||!yG(b,m==null?void 0:m.scopes))){var x=function(_,M){var E;if(M===void 0&&(M=!1),!(xG(_)&&!c6(_,m==null?void 0:m.enableOnFormTags))&&!(m!=null&&m.ignoreEventWhen!=null&&m.ignoreEventWhen(_))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){Mk(_);return}(E=_.target)!=null&&E.isContentEditable&&!(m!=null&&m.enableOnContentEditable)||p1(c,m==null?void 0:m.splitKey).forEach(function(A){var R,D=h1(A,m==null?void 0:m.combinationKey);if(CG(_,D,m==null?void 0:m.ignoreModifiers)||(R=D.keys)!=null&&R.includes("*")){if(M&&s.current)return;if(vG(_,D,m==null?void 0:m.preventDefault),!bG(_,D,m==null?void 0:m.enabled)){Mk(_);return}h.current(_,D),M||(s.current=!0)}})}},w=function(_){_.key!==void 0&&(i6(qi(_.code)),((m==null?void 0:m.keydown)===void 0&&(m==null?void 0:m.keyup)!==!0||m!=null&&m.keydown)&&x(_))},S=function(_){_.key!==void 0&&(l6(qi(_.code)),s.current=!1,m!=null&&m.keyup&&x(_,!0))},j=o.current||(i==null?void 0:i.document)||document;return j.addEventListener("keyup",S),j.addEventListener("keydown",w),y&&p1(c,m==null?void 0:m.splitKey).forEach(function(I){return y.addHotkey(h1(I,m==null?void 0:m.combinationKey,m==null?void 0:m.description))}),function(){j.removeEventListener("keyup",S),j.removeEventListener("keydown",w),y&&p1(c,m==null?void 0:m.splitKey).forEach(function(I){return y.removeHotkey(h1(I,m==null?void 0:m.combinationKey,m==null?void 0:m.description))})}}},[c,m,b]),o}const PG=e=>{const{isDragAccept:t,isDragReject:n,setIsHandlingUpload:r}=e;return _t("esc",()=>{r(!1)}),a.jsxs(Le,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:[a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:"base.700",_dark:{bg:"base.900"},opacity:.7,alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"full",height:"full",alignItems:"center",justifyContent:"center",p:4},children:a.jsx(N,{sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",flexDir:"column",gap:4,borderWidth:3,borderRadius:"xl",borderStyle:"dashed",color:"base.100",borderColor:"base.100",_dark:{borderColor:"base.200"}},children:t?a.jsx(yo,{size:"lg",children:"Drop to Upload"}):a.jsxs(a.Fragment,{children:[a.jsx(yo,{size:"lg",children:"Invalid Upload"}),a.jsx(yo,{size:"md",children:"Must be single JPEG or PNG image"})]})})})]})},EG=l.memo(PG),MG=me([we,lo],({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}},Ie),OG=e=>{const{children:t}=e,{autoAddBoardId:n,postUploadAction:r}=H(MG),o=Zl(),{t:s}=Q(),[i,c]=l.useState(!1),[d]=EI(),p=l.useCallback(_=>{c(!0),o({title:s("toast.uploadFailed"),description:_.errors.map(M=>M.message).join(` `),status:"error"})},[s,o]),h=l.useCallback(async _=>{d({file:_,image_category:"user",is_intermediate:!1,postUploadAction:r,board_id:n==="none"?void 0:n})},[n,r,d]),m=l.useCallback((_,M)=>{if(M.length>1){o({title:s("toast.uploadFailed"),description:s("toast.uploadFailedInvalidUploadDesc"),status:"error"});return}M.forEach(E=>{p(E)}),_.forEach(E=>{h(E)})},[s,o,h,p]),g=l.useCallback(()=>{c(!0)},[]),{getRootProps:b,getInputProps:y,isDragAccept:x,isDragReject:w,isDragActive:S,inputRef:j}=Hy({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:m,onDragOver:g,multiple:!1});l.useEffect(()=>{const _=async M=>{var E,A;j.current&&(E=M.clipboardData)!=null&&E.files&&(j.current.files=M.clipboardData.files,(A=j.current)==null||A.dispatchEvent(new Event("change",{bubbles:!0})))};return document.addEventListener("paste",_),()=>{document.removeEventListener("paste",_)}},[j]);const I=l.useCallback(_=>{_.key},[]);return a.jsxs(Le,{...b({style:{}}),onKeyDown:I,children:[a.jsx("input",{...y()}),t,a.jsx(So,{children:S&&i&&a.jsx(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(EG,{isDragAccept:x,isDragReject:w,setIsHandlingUpload:c})},"image-upload-overlay")})]})},AG=l.memo(OG),RG=De((e,t)=>{const{children:n,tooltip:r="",tooltipProps:{placement:o="top",hasArrow:s=!0,...i}={},isChecked:c,...d}=e;return a.jsx(Wn,{label:r,placement:o,hasArrow:s,...i,children:a.jsx(nl,{ref:t,colorScheme:c?"accent":"base",...d,children:n})})}),Dt=l.memo(RG);function DG(e){const t=l.createContext(null);return[({children:o,value:s})=>z.createElement(t.Provider,{value:s},o),()=>{const o=l.useContext(t);if(o===null)throw new Error(e);return o}]}function d6(e){return Array.isArray(e)?e:[e]}const TG=()=>{};function NG(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||TG:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function f6({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 p6(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==z.Fragment:!1}function h6(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 zG=yD({key:"mantine",prepend:!0});function FG(){return OP()||zG}var BG=Object.defineProperty,Ok=Object.getOwnPropertySymbols,HG=Object.prototype.hasOwnProperty,WG=Object.prototype.propertyIsEnumerable,Ak=(e,t,n)=>t in e?BG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,VG=(e,t)=>{for(var n in t||(t={}))HG.call(t,n)&&Ak(e,n,t[n]);if(Ok)for(var n of Ok(t))WG.call(t,n)&&Ak(e,n,t[n]);return e};const m1="ref";function UG(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(!(m1 in n))return{args:e,ref:t};t=n[m1];const r=VG({},n);return delete r[m1],{args:[r],ref:t}}const{cssFactory:GG}=(()=>{function e(n,r,o){const s=[],i=SD(n,s,o);return s.length<2?o:i+r(s)}function t(n){const{cache:r}=n,o=(...i)=>{const{ref:c,args:d}=UG(i),p=CD(d,r.registered);return wD(r,p,!1),`${r.key}-${p.name}${c===void 0?"":` ${c}`}`};return{css:o,cx:(...i)=>e(r.registered,o,m6(i))}}return{cssFactory:t}})();function g6(){const e=FG();return LG(()=>GG({cache:e}),[e])}function qG({cx:e,classes:t,context:n,classNames:r,name:o,cache:s}){const i=n.reduce((c,d)=>(Object.keys(d.classNames).forEach(p=>{typeof c[p]!="string"?c[p]=`${d.classNames[p]}`:c[p]=`${c[p]} ${d.classNames[p]}`}),c),{});return Object.keys(t).reduce((c,d)=>(c[d]=e(t[d],i[d],r!=null&&r[d],Array.isArray(o)?o.filter(Boolean).map(p=>`${(s==null?void 0:s.key)||"mantine"}-${p}-${d}`).join(" "):o?`${(s==null?void 0:s.key)||"mantine"}-${o}-${d}`:null),c),{})}var KG=Object.defineProperty,Rk=Object.getOwnPropertySymbols,QG=Object.prototype.hasOwnProperty,XG=Object.prototype.propertyIsEnumerable,Dk=(e,t,n)=>t in e?KG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g1=(e,t)=>{for(var n in t||(t={}))QG.call(t,n)&&Dk(e,n,t[n]);if(Rk)for(var n of Rk(t))XG.call(t,n)&&Dk(e,n,t[n]);return e};function zb(e,t){return t&&Object.keys(t).forEach(n=>{e[n]?e[n]=g1(g1({},e[n]),t[n]):e[n]=g1({},t[n])}),e}function Tk(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)=>zb(s,i),{}):o(e)}function YG({ctx:e,theme:t,params:n,variant:r,size:o}){return e.reduce((s,i)=>(i.variants&&r in i.variants&&zb(s,i.variants[r](t,n,{variant:r,size:o})),i.sizes&&o in i.sizes&&zb(s,i.sizes[o](t,n,{variant:r,size:o})),s),{})}function ko(e){const t=typeof e=="function"?e:()=>e;function n(r,o){const s=Ii(),i=g$(o==null?void 0:o.name),c=OP(),d={variant:o==null?void 0:o.variant,size:o==null?void 0:o.size},{css:p,cx:h}=g6(),m=t(s,r,d),g=Tk(o==null?void 0:o.styles,s,r,d),b=Tk(i,s,r,d),y=YG({ctx:i,theme:s,params:r,variant:o==null?void 0:o.variant,size:o==null?void 0:o.size}),x=Object.fromEntries(Object.keys(m).map(w=>{const S=h({[p(m[w])]:!(o!=null&&o.unstyled)},p(y[w]),p(b[w]),p(g[w]));return[w,S]}));return{classes:qG({cx:h,classes:x,context:i,classNames:o==null?void 0:o.classNames,name:o==null?void 0:o.name,cache:c}),cx:h,theme:s}}return n}function Nk(e){return`___ref-${e||""}`}var JG=Object.defineProperty,ZG=Object.defineProperties,eq=Object.getOwnPropertyDescriptors,$k=Object.getOwnPropertySymbols,tq=Object.prototype.hasOwnProperty,nq=Object.prototype.propertyIsEnumerable,Lk=(e,t,n)=>t in e?JG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xd=(e,t)=>{for(var n in t||(t={}))tq.call(t,n)&&Lk(e,n,t[n]);if($k)for(var n of $k(t))nq.call(t,n)&&Lk(e,n,t[n]);return e},yd=(e,t)=>ZG(e,eq(t));const Cd={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${qe(10)})`},transitionProperty:"transform, opacity"},rh={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(-${qe(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(${qe(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(${qe(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${qe(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:yd(xd({},Cd),{common:{transformOrigin:"center center"}}),"pop-bottom-left":yd(xd({},Cd),{common:{transformOrigin:"bottom left"}}),"pop-bottom-right":yd(xd({},Cd),{common:{transformOrigin:"bottom right"}}),"pop-top-left":yd(xd({},Cd),{common:{transformOrigin:"top left"}}),"pop-top-right":yd(xd({},Cd),{common:{transformOrigin:"top right"}})},zk=["mousedown","touchstart"];function rq(e,t,n){const r=l.useRef();return l.useEffect(()=>{const o=s=>{const{target:i}=s??{};if(Array.isArray(n)){const c=(i==null?void 0:i.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(i)&&i.tagName!=="HTML";n.every(p=>!!p&&!s.composedPath().includes(p))&&!c&&e()}else r.current&&!r.current.contains(i)&&e()};return(t||zk).forEach(s=>document.addEventListener(s,o)),()=>{(t||zk).forEach(s=>document.removeEventListener(s,o))}},[r,e,n]),r}function oq(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function sq(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function aq(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=l.useState(n?t:sq(e,t)),s=l.useRef();return l.useEffect(()=>{if("matchMedia"in window)return s.current=window.matchMedia(e),o(s.current.matches),oq(s.current,i=>o(i.matches))},[e]),r}const v6=typeof document<"u"?l.useLayoutEffect:l.useEffect;function oa(e,t){const n=l.useRef(!1);l.useEffect(()=>()=>{n.current=!1},[]),l.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function iq({opened:e,shouldReturnFocus:t=!0}){const n=l.useRef(),r=()=>{var o;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((o=n.current)==null||o.focus({preventScroll:!0}))};return oa(()=>{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 lq=/input|select|textarea|button|object/,b6="a, input, select, textarea, button, object, [tabindex]";function cq(e){return e.style.display==="none"}function uq(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(cq(n))return!1;n=n.parentNode}return!0}function x6(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function Fb(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(x6(e));return(lq.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&uq(e)}function y6(e){const t=x6(e);return(Number.isNaN(t)||t>=0)&&Fb(e)}function dq(e){return Array.from(e.querySelectorAll(b6)).filter(y6)}function fq(e,t){const n=dq(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 Uy(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function pq(e,t="body > :not(script)"){const n=Uy(),r=Array.from(document.querySelectorAll(t)).map(o=>{var s;if((s=o==null?void 0:o.shadowRoot)!=null&&s.contains(e)||o.contains(e))return;const i=o.getAttribute("aria-hidden"),c=o.getAttribute("data-hidden"),d=o.getAttribute("data-focus-id");return o.setAttribute("data-focus-id",n),i===null||i==="false"?o.setAttribute("aria-hidden","true"):!c&&!d&&o.setAttribute("data-hidden",i),{node:o,ariaHidden:c||null}});return()=>{r.forEach(o=>{!o||n!==o.node.getAttribute("data-focus-id")||(o.ariaHidden===null?o.node.removeAttribute("aria-hidden"):o.node.setAttribute("aria-hidden",o.ariaHidden),o.node.removeAttribute("data-focus-id"),o.node.removeAttribute("data-hidden"))})}}function hq(e=!0){const t=l.useRef(),n=l.useRef(null),r=s=>{let i=s.querySelector("[data-autofocus]");if(!i){const c=Array.from(s.querySelectorAll(b6));i=c.find(y6)||c.find(Fb)||null,!i&&Fb(s)&&(i=s)}i&&i.focus({preventScroll:!0})},o=l.useCallback(s=>{if(e){if(s===null){n.current&&(n.current(),n.current=null);return}n.current=pq(s),t.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&r(s)}),t.current=s):t.current=null)}},[e]);return l.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const s=i=>{i.key==="Tab"&&t.current&&fq(t.current,i)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),n.current&&n.current()}},[e]),o}const mq=z["useId".toString()]||(()=>{});function gq(){const e=mq();return e?`mantine-${e.replace(/:/g,"")}`:""}function Gy(e){const t=gq(),[n,r]=l.useState(t);return v6(()=>{r(Uy())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function Fk(e,t,n){l.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function C6(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function vq(...e){return t=>{e.forEach(n=>C6(n,t))}}function Kf(...e){return l.useCallback(vq(...e),e)}function cf({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=l.useState(t!==void 0?t:n),i=c=>{s(c),r==null||r(c)};return e!==void 0?[e,r,!0]:[o,i,!1]}function w6(e,t){return aq("(prefers-reduced-motion: reduce)",e,t)}const bq=e=>e<.5?2*e*e:-1+(4-2*e)*e,xq=({axis:e,target:t,parent:n,alignment:r,offset:o,isList:s})=>{if(!t||!n&&typeof document>"u")return 0;const i=!!n,d=(n||document.body).getBoundingClientRect(),p=t.getBoundingClientRect(),h=m=>p[m]-d[m];if(e==="y"){const m=h("top");if(m===0)return 0;if(r==="start"){const b=m-o;return b<=p.height*(s?0:1)||!s?b:0}const g=i?d.height:window.innerHeight;if(r==="end"){const b=m+o-g+p.height;return b>=-p.height*(s?0:1)||!s?b:0}return r==="center"?m-g/2+p.height/2:0}if(e==="x"){const m=h("left");if(m===0)return 0;if(r==="start"){const b=m-o;return b<=p.width||!s?b:0}const g=i?d.width:window.innerWidth;if(r==="end"){const b=m+o-g+p.width;return b>=-p.width||!s?b:0}return r==="center"?m-g/2+p.width/2:0}return 0},yq=({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]},Cq=({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 S6({duration:e=1250,axis:t="y",onScrollFinish:n,easing:r=bq,offset:o=0,cancelable:s=!0,isList:i=!1}={}){const c=l.useRef(0),d=l.useRef(0),p=l.useRef(!1),h=l.useRef(null),m=l.useRef(null),g=w6(),b=()=>{c.current&&cancelAnimationFrame(c.current)},y=l.useCallback(({alignment:w="start"}={})=>{var S;p.current=!1,c.current&&b();const j=(S=yq({parent:h.current,axis:t}))!=null?S:0,I=xq({parent:h.current,target:m.current,axis:t,alignment:w,offset:o,isList:i})-(h.current?0:j);function _(){d.current===0&&(d.current=performance.now());const E=performance.now()-d.current,A=g||e===0?1:E/e,R=j+I*r(A);Cq({parent:h.current,axis:t,distance:R}),!p.current&&A<1?c.current=requestAnimationFrame(_):(typeof n=="function"&&n(),d.current=0,c.current=0,b())}_()},[t,e,r,i,o,n,g]),x=()=>{s&&(p.current=!0)};return Fk("wheel",x,{passive:!0}),Fk("touchmove",x,{passive:!0}),l.useEffect(()=>b,[]),{scrollableRef:h,targetRef:m,scrollIntoView:y,cancel:b}}var Bk=Object.getOwnPropertySymbols,wq=Object.prototype.hasOwnProperty,Sq=Object.prototype.propertyIsEnumerable,kq=(e,t)=>{var n={};for(var r in e)wq.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Bk)for(var r of Bk(e))t.indexOf(r)<0&&Sq.call(e,r)&&(n[r]=e[r]);return n};function Yg(e){const t=e,{m:n,mx:r,my:o,mt:s,mb:i,ml:c,mr:d,p,px:h,py:m,pt:g,pb:b,pl:y,pr:x,bg:w,c:S,opacity:j,ff:I,fz:_,fw:M,lts:E,ta:A,lh:R,fs:D,tt:O,td:T,w:K,miw:G,maw:X,h:Z,mih:te,mah:V,bgsz:oe,bgp:ne,bgr:se,bga:re,pos:ae,top:B,left:Y,bottom:$,right:F,inset:q,display:pe}=t,W=kq(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:v$({m:n,mx:r,my:o,mt:s,mb:i,ml:c,mr:d,p,px:h,py:m,pt:g,pb:b,pl:y,pr:x,bg:w,c:S,opacity:j,ff:I,fz:_,fw:M,lts:E,ta:A,lh:R,fs:D,tt:O,td:T,w:K,miw:G,maw:X,h:Z,mih:te,mah:V,bgsz:oe,bgp:ne,bgr:se,bga:re,pos:ae,top:B,left:Y,bottom:$,right:F,inset:q,display:pe}),rest:W}}function jq(e,t){const n=Object.keys(e).filter(r=>r!=="base").sort((r,o)=>MS(Xt({size:r,sizes:t.breakpoints}))-MS(Xt({size:o,sizes:t.breakpoints})));return"base"in e?["base",...n]:n}function _q({value:e,theme:t,getValue:n,property:r}){if(e==null)return;if(typeof e=="object")return jq(e,t).reduce((i,c)=>{if(c==="base"&&e.base!==void 0){const p=n(e.base,t);return Array.isArray(r)?(r.forEach(h=>{i[h]=p}),i):(i[r]=p,i)}const d=n(e[c],t);return Array.isArray(r)?(i[t.fn.largerThan(c)]={},r.forEach(p=>{i[t.fn.largerThan(c)][p]=d}),i):(i[t.fn.largerThan(c)]={[r]:d},i)},{});const o=n(e,t);return Array.isArray(r)?r.reduce((s,i)=>(s[i]=o,s),{}):{[r]:o}}function Iq(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 Pq(e){return qe(e)}function Eq(e){return e}function Mq(e,t){return Xt({size:e,sizes:t.fontSizes})}const Oq=["-xs","-sm","-md","-lg","-xl"];function Aq(e,t){return Oq.includes(e)?`calc(${Xt({size:e.replace("-",""),sizes:t.spacing})} * -1)`:Xt({size:e,sizes:t.spacing})}const Rq={identity:Eq,color:Iq,size:Pq,fontSize:Mq,spacing:Aq},Dq={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 Tq=Object.defineProperty,Hk=Object.getOwnPropertySymbols,Nq=Object.prototype.hasOwnProperty,$q=Object.prototype.propertyIsEnumerable,Wk=(e,t,n)=>t in e?Tq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vk=(e,t)=>{for(var n in t||(t={}))Nq.call(t,n)&&Wk(e,n,t[n]);if(Hk)for(var n of Hk(t))$q.call(t,n)&&Wk(e,n,t[n]);return e};function Uk(e,t,n=Dq){return Object.keys(n).reduce((o,s)=>(s in e&&e[s]!==void 0&&o.push(_q({value:e[s],getValue:Rq[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]=Vk(Vk({},o[i]),s[i]):o[i]=s[i]}),o),{})}function Gk(e,t){return typeof e=="function"?e(t):e}function Lq(e,t,n){const r=Ii(),{css:o,cx:s}=g6();return Array.isArray(e)?s(n,o(Uk(t,r)),e.map(i=>o(Gk(i,r)))):s(n,o(Gk(e,r)),o(Uk(t,r)))}var zq=Object.defineProperty,lm=Object.getOwnPropertySymbols,k6=Object.prototype.hasOwnProperty,j6=Object.prototype.propertyIsEnumerable,qk=(e,t,n)=>t in e?zq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fq=(e,t)=>{for(var n in t||(t={}))k6.call(t,n)&&qk(e,n,t[n]);if(lm)for(var n of lm(t))j6.call(t,n)&&qk(e,n,t[n]);return e},Bq=(e,t)=>{var n={};for(var r in e)k6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&lm)for(var r of lm(e))t.indexOf(r)<0&&j6.call(e,r)&&(n[r]=e[r]);return n};const _6=l.forwardRef((e,t)=>{var n=e,{className:r,component:o,style:s,sx:i}=n,c=Bq(n,["className","component","style","sx"]);const{systemStyles:d,rest:p}=Yg(c),h=o||"div";return z.createElement(h,Fq({ref:t,className:Lq(i,d,r),style:s},p))});_6.displayName="@mantine/core/Box";const Xo=_6;var Hq=Object.defineProperty,Wq=Object.defineProperties,Vq=Object.getOwnPropertyDescriptors,Kk=Object.getOwnPropertySymbols,Uq=Object.prototype.hasOwnProperty,Gq=Object.prototype.propertyIsEnumerable,Qk=(e,t,n)=>t in e?Hq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xk=(e,t)=>{for(var n in t||(t={}))Uq.call(t,n)&&Qk(e,n,t[n]);if(Kk)for(var n of Kk(t))Gq.call(t,n)&&Qk(e,n,t[n]);return e},qq=(e,t)=>Wq(e,Vq(t)),Kq=ko(e=>({root:qq(Xk(Xk({},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 Qq=Kq;var Xq=Object.defineProperty,cm=Object.getOwnPropertySymbols,I6=Object.prototype.hasOwnProperty,P6=Object.prototype.propertyIsEnumerable,Yk=(e,t,n)=>t in e?Xq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yq=(e,t)=>{for(var n in t||(t={}))I6.call(t,n)&&Yk(e,n,t[n]);if(cm)for(var n of cm(t))P6.call(t,n)&&Yk(e,n,t[n]);return e},Jq=(e,t)=>{var n={};for(var r in e)I6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&cm)for(var r of cm(e))t.indexOf(r)<0&&P6.call(e,r)&&(n[r]=e[r]);return n};const E6=l.forwardRef((e,t)=>{const n=zr("UnstyledButton",{},e),{className:r,component:o="button",unstyled:s,variant:i}=n,c=Jq(n,["className","component","unstyled","variant"]),{classes:d,cx:p}=Qq(null,{name:"UnstyledButton",unstyled:s,variant:i});return z.createElement(Xo,Yq({component:o,ref:t,className:p(d.root,r),type:o==="button"?"button":void 0},c))});E6.displayName="@mantine/core/UnstyledButton";const Zq=E6;var eK=Object.defineProperty,tK=Object.defineProperties,nK=Object.getOwnPropertyDescriptors,Jk=Object.getOwnPropertySymbols,rK=Object.prototype.hasOwnProperty,oK=Object.prototype.propertyIsEnumerable,Zk=(e,t,n)=>t in e?eK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bb=(e,t)=>{for(var n in t||(t={}))rK.call(t,n)&&Zk(e,n,t[n]);if(Jk)for(var n of Jk(t))oK.call(t,n)&&Zk(e,n,t[n]);return e},e4=(e,t)=>tK(e,nK(t));const sK=["subtle","filled","outline","light","default","transparent","gradient"],oh={xs:qe(18),sm:qe(22),md:qe(28),lg:qe(34),xl:qe(44)};function aK({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%"})}:sK.includes(e)?Bb({border:`${qe(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover})):null}var iK=ko((e,{radius:t,color:n,gradient:r},{variant:o,size:s})=>({root:e4(Bb({position:"relative",borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",height:Xt({size:s,sizes:oh}),minHeight:Xt({size:s,sizes:oh}),width:Xt({size:s,sizes:oh}),minWidth:Xt({size:s,sizes:oh})},aK({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":e4(Bb({content:'""'},e.fn.cover(qe(-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 lK=iK;var cK=Object.defineProperty,um=Object.getOwnPropertySymbols,M6=Object.prototype.hasOwnProperty,O6=Object.prototype.propertyIsEnumerable,t4=(e,t,n)=>t in e?cK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,n4=(e,t)=>{for(var n in t||(t={}))M6.call(t,n)&&t4(e,n,t[n]);if(um)for(var n of um(t))O6.call(t,n)&&t4(e,n,t[n]);return e},r4=(e,t)=>{var n={};for(var r in e)M6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&um)for(var r of um(e))t.indexOf(r)<0&&O6.call(e,r)&&(n[r]=e[r]);return n};function uK(e){var t=e,{size:n,color:r}=t,o=r4(t,["size","color"]);const s=o,{style:i}=s,c=r4(s,["style"]);return z.createElement("svg",n4({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:r,style:n4({width:n},i)},c),z.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},z.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"}),z.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"})),z.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},z.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"}),z.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"})),z.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},z.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),z.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),z.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},z.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"}),z.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"})),z.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},z.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"}),z.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 dK=Object.defineProperty,dm=Object.getOwnPropertySymbols,A6=Object.prototype.hasOwnProperty,R6=Object.prototype.propertyIsEnumerable,o4=(e,t,n)=>t in e?dK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,s4=(e,t)=>{for(var n in t||(t={}))A6.call(t,n)&&o4(e,n,t[n]);if(dm)for(var n of dm(t))R6.call(t,n)&&o4(e,n,t[n]);return e},a4=(e,t)=>{var n={};for(var r in e)A6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&dm)for(var r of dm(e))t.indexOf(r)<0&&R6.call(e,r)&&(n[r]=e[r]);return n};function fK(e){var t=e,{size:n,color:r}=t,o=a4(t,["size","color"]);const s=o,{style:i}=s,c=a4(s,["style"]);return z.createElement("svg",s4({viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:r,style:s4({width:n,height:n},i)},c),z.createElement("g",{fill:"none",fillRule:"evenodd"},z.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},z.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),z.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},z.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}var pK=Object.defineProperty,fm=Object.getOwnPropertySymbols,D6=Object.prototype.hasOwnProperty,T6=Object.prototype.propertyIsEnumerable,i4=(e,t,n)=>t in e?pK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l4=(e,t)=>{for(var n in t||(t={}))D6.call(t,n)&&i4(e,n,t[n]);if(fm)for(var n of fm(t))T6.call(t,n)&&i4(e,n,t[n]);return e},c4=(e,t)=>{var n={};for(var r in e)D6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&fm)for(var r of fm(e))t.indexOf(r)<0&&T6.call(e,r)&&(n[r]=e[r]);return n};function hK(e){var t=e,{size:n,color:r}=t,o=c4(t,["size","color"]);const s=o,{style:i}=s,c=c4(s,["style"]);return z.createElement("svg",l4({viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:r,style:l4({width:n},i)},c),z.createElement("circle",{cx:"15",cy:"15",r:"15"},z.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),z.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),z.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},z.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),z.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),z.createElement("circle",{cx:"105",cy:"15",r:"15"},z.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),z.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var mK=Object.defineProperty,pm=Object.getOwnPropertySymbols,N6=Object.prototype.hasOwnProperty,$6=Object.prototype.propertyIsEnumerable,u4=(e,t,n)=>t in e?mK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gK=(e,t)=>{for(var n in t||(t={}))N6.call(t,n)&&u4(e,n,t[n]);if(pm)for(var n of pm(t))$6.call(t,n)&&u4(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&&pm)for(var r of pm(e))t.indexOf(r)<0&&$6.call(e,r)&&(n[r]=e[r]);return n};const v1={bars:uK,oval:fK,dots:hK},bK={xs:qe(18),sm:qe(22),md:qe(36),lg:qe(44),xl:qe(58)},xK={size:"md"};function L6(e){const t=zr("Loader",xK,e),{size:n,color:r,variant:o}=t,s=vK(t,["size","color","variant"]),i=Ii(),c=o in v1?o:i.loader;return z.createElement(Xo,gK({role:"presentation",component:v1[c]||v1.bars,size:Xt({size:n,sizes:bK}),color:i.fn.variant({variant:"filled",primaryFallback:!1,color:r||i.primaryColor}).background},s))}L6.displayName="@mantine/core/Loader";var yK=Object.defineProperty,hm=Object.getOwnPropertySymbols,z6=Object.prototype.hasOwnProperty,F6=Object.prototype.propertyIsEnumerable,d4=(e,t,n)=>t in e?yK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,f4=(e,t)=>{for(var n in t||(t={}))z6.call(t,n)&&d4(e,n,t[n]);if(hm)for(var n of hm(t))F6.call(t,n)&&d4(e,n,t[n]);return e},CK=(e,t)=>{var n={};for(var r in e)z6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&hm)for(var r of hm(e))t.indexOf(r)<0&&F6.call(e,r)&&(n[r]=e[r]);return n};const wK={color:"gray",size:"md",variant:"subtle"},B6=l.forwardRef((e,t)=>{const n=zr("ActionIcon",wK,e),{className:r,color:o,children:s,radius:i,size:c,variant:d,gradient:p,disabled:h,loaderProps:m,loading:g,unstyled:b,__staticSelector:y}=n,x=CK(n,["className","color","children","radius","size","variant","gradient","disabled","loaderProps","loading","unstyled","__staticSelector"]),{classes:w,cx:S,theme:j}=lK({radius:i,color:o,gradient:p},{name:["ActionIcon",y],unstyled:b,size:c,variant:d}),I=z.createElement(L6,f4({color:j.fn.variant({color:o,variant:d}).color,size:"100%","data-action-icon-loader":!0},m));return z.createElement(Zq,f4({className:S(w.root,r),ref:t,disabled:h,"data-disabled":h||void 0,"data-loading":g||void 0,unstyled:b},x),g?I:s)});B6.displayName="@mantine/core/ActionIcon";const SK=B6;var kK=Object.defineProperty,jK=Object.defineProperties,_K=Object.getOwnPropertyDescriptors,mm=Object.getOwnPropertySymbols,H6=Object.prototype.hasOwnProperty,W6=Object.prototype.propertyIsEnumerable,p4=(e,t,n)=>t in e?kK(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)&&p4(e,n,t[n]);if(mm)for(var n of mm(t))W6.call(t,n)&&p4(e,n,t[n]);return e},PK=(e,t)=>jK(e,_K(t)),EK=(e,t)=>{var n={};for(var r in e)H6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mm)for(var r of mm(e))t.indexOf(r)<0&&W6.call(e,r)&&(n[r]=e[r]);return n};function V6(e){const t=zr("Portal",{},e),{children:n,target:r,className:o,innerRef:s}=t,i=EK(t,["children","target","className","innerRef"]),c=Ii(),[d,p]=l.useState(!1),h=l.useRef();return v6(()=>(p(!0),h.current=r?typeof r=="string"?document.querySelector(r):r:document.createElement("div"),r||document.body.appendChild(h.current),()=>{!r&&document.body.removeChild(h.current)}),[r]),d?ls.createPortal(z.createElement("div",PK(IK({className:o,dir:c.dir},i),{ref:s}),n),h.current):null}V6.displayName="@mantine/core/Portal";var MK=Object.defineProperty,gm=Object.getOwnPropertySymbols,U6=Object.prototype.hasOwnProperty,G6=Object.prototype.propertyIsEnumerable,h4=(e,t,n)=>t in e?MK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,OK=(e,t)=>{for(var n in t||(t={}))U6.call(t,n)&&h4(e,n,t[n]);if(gm)for(var n of gm(t))G6.call(t,n)&&h4(e,n,t[n]);return e},AK=(e,t)=>{var n={};for(var r in e)U6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gm)for(var r of gm(e))t.indexOf(r)<0&&G6.call(e,r)&&(n[r]=e[r]);return n};function q6(e){var t=e,{withinPortal:n=!0,children:r}=t,o=AK(t,["withinPortal","children"]);return n?z.createElement(V6,OK({},o),r):z.createElement(z.Fragment,null,r)}q6.displayName="@mantine/core/OptionalPortal";var RK=Object.defineProperty,vm=Object.getOwnPropertySymbols,K6=Object.prototype.hasOwnProperty,Q6=Object.prototype.propertyIsEnumerable,m4=(e,t,n)=>t in e?RK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g4=(e,t)=>{for(var n in t||(t={}))K6.call(t,n)&&m4(e,n,t[n]);if(vm)for(var n of vm(t))Q6.call(t,n)&&m4(e,n,t[n]);return e},DK=(e,t)=>{var n={};for(var r in e)K6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&vm)for(var r of vm(e))t.indexOf(r)<0&&Q6.call(e,r)&&(n[r]=e[r]);return n};function X6(e){const t=e,{width:n,height:r,style:o}=t,s=DK(t,["width","height","style"]);return z.createElement("svg",g4({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:g4({width:n,height:r},o)},s),z.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"}))}X6.displayName="@mantine/core/CloseIcon";var TK=Object.defineProperty,bm=Object.getOwnPropertySymbols,Y6=Object.prototype.hasOwnProperty,J6=Object.prototype.propertyIsEnumerable,v4=(e,t,n)=>t in e?TK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,NK=(e,t)=>{for(var n in t||(t={}))Y6.call(t,n)&&v4(e,n,t[n]);if(bm)for(var n of bm(t))J6.call(t,n)&&v4(e,n,t[n]);return e},$K=(e,t)=>{var n={};for(var r in e)Y6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&bm)for(var r of bm(e))t.indexOf(r)<0&&J6.call(e,r)&&(n[r]=e[r]);return n};const LK={xs:qe(12),sm:qe(16),md:qe(20),lg:qe(28),xl:qe(34)},zK={size:"sm"},Z6=l.forwardRef((e,t)=>{const n=zr("CloseButton",zK,e),{iconSize:r,size:o,children:s}=n,i=$K(n,["iconSize","size","children"]),c=qe(r||LK[o]);return z.createElement(SK,NK({ref:t,__staticSelector:"CloseButton",size:o},i),s||z.createElement(X6,{width:c,height:c}))});Z6.displayName="@mantine/core/CloseButton";const eE=Z6;var FK=Object.defineProperty,BK=Object.defineProperties,HK=Object.getOwnPropertyDescriptors,b4=Object.getOwnPropertySymbols,WK=Object.prototype.hasOwnProperty,VK=Object.prototype.propertyIsEnumerable,x4=(e,t,n)=>t in e?FK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sh=(e,t)=>{for(var n in t||(t={}))WK.call(t,n)&&x4(e,n,t[n]);if(b4)for(var n of b4(t))VK.call(t,n)&&x4(e,n,t[n]);return e},UK=(e,t)=>BK(e,HK(t));function GK({underline:e,strikethrough:t}){const n=[];return e&&n.push("underline"),t&&n.push("line-through"),n.length>0?n.join(" "):"none"}function qK({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 KK(e){return typeof e=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}function QK({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 XK=ko((e,{color:t,lineClamp:n,truncate:r,inline:o,inherit:s,underline:i,gradient:c,weight:d,transform:p,align:h,strikethrough:m,italic:g},{size:b})=>{const y=e.fn.variant({variant:"gradient",gradient:c});return{root:UK(sh(sh(sh(sh({},e.fn.fontStyles()),e.fn.focusStyles()),KK(n)),QK({theme:e,truncate:r})),{color:qK({color:t,theme:e}),fontFamily:s?"inherit":e.fontFamily,fontSize:s||b===void 0?"inherit":Xt({size:b,sizes:e.fontSizes}),lineHeight:s?"inherit":o?1:e.lineHeight,textDecoration:GK({underline:i,strikethrough:m}),WebkitTapHighlightColor:"transparent",fontWeight:s?"inherit":d,textTransform:p,textAlign:h,fontStyle:g?"italic":void 0}),gradient:{backgroundImage:y.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}});const YK=XK;var JK=Object.defineProperty,xm=Object.getOwnPropertySymbols,tE=Object.prototype.hasOwnProperty,nE=Object.prototype.propertyIsEnumerable,y4=(e,t,n)=>t in e?JK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ZK=(e,t)=>{for(var n in t||(t={}))tE.call(t,n)&&y4(e,n,t[n]);if(xm)for(var n of xm(t))nE.call(t,n)&&y4(e,n,t[n]);return e},eQ=(e,t)=>{var n={};for(var r in e)tE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&xm)for(var r of xm(e))t.indexOf(r)<0&&nE.call(e,r)&&(n[r]=e[r]);return n};const tQ={variant:"text"},rE=l.forwardRef((e,t)=>{const n=zr("Text",tQ,e),{className:r,size:o,weight:s,transform:i,color:c,align:d,variant:p,lineClamp:h,truncate:m,gradient:g,inline:b,inherit:y,underline:x,strikethrough:w,italic:S,classNames:j,styles:I,unstyled:_,span:M,__staticSelector:E}=n,A=eQ(n,["className","size","weight","transform","color","align","variant","lineClamp","truncate","gradient","inline","inherit","underline","strikethrough","italic","classNames","styles","unstyled","span","__staticSelector"]),{classes:R,cx:D}=YK({color:c,lineClamp:h,truncate:m,inline:b,inherit:y,underline:x,strikethrough:w,italic:S,weight:s,transform:i,align:d,gradient:g},{unstyled:_,name:E||"Text",variant:p,size:o});return z.createElement(Xo,ZK({ref:t,className:D(R.root,{[R.gradient]:p==="gradient"},r),component:M?"span":"div"},A))});rE.displayName="@mantine/core/Text";const xu=rE,ah={xs:qe(1),sm:qe(2),md:qe(3),lg:qe(4),xl:qe(5)};function ih(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 nQ=ko((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:qe(1),borderTop:`${Xt({size:n,sizes:ah})} ${r} ${ih(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${Xt({size:n,sizes:ah})} ${r} ${ih(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:qe(Xt({size:n,sizes:ah})),borderTopColor:ih(e,t),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"auto",borderLeftWidth:qe(Xt({size:n,sizes:ah})),borderLeftColor:ih(e,t),borderLeftStyle:r}}));const rQ=nQ;var oQ=Object.defineProperty,sQ=Object.defineProperties,aQ=Object.getOwnPropertyDescriptors,ym=Object.getOwnPropertySymbols,oE=Object.prototype.hasOwnProperty,sE=Object.prototype.propertyIsEnumerable,C4=(e,t,n)=>t in e?oQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w4=(e,t)=>{for(var n in t||(t={}))oE.call(t,n)&&C4(e,n,t[n]);if(ym)for(var n of ym(t))sE.call(t,n)&&C4(e,n,t[n]);return e},iQ=(e,t)=>sQ(e,aQ(t)),lQ=(e,t)=>{var n={};for(var r in e)oE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ym)for(var r of ym(e))t.indexOf(r)<0&&sE.call(e,r)&&(n[r]=e[r]);return n};const cQ={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},Hb=l.forwardRef((e,t)=>{const n=zr("Divider",cQ,e),{className:r,color:o,orientation:s,size:i,label:c,labelPosition:d,labelProps:p,variant:h,styles:m,classNames:g,unstyled:b}=n,y=lQ(n,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames","unstyled"]),{classes:x,cx:w}=rQ({color:o},{classNames:g,styles:m,unstyled:b,name:"Divider",variant:h,size:i}),S=s==="vertical",j=s==="horizontal",I=!!c&&j,_=!(p!=null&&p.color);return z.createElement(Xo,w4({ref:t,className:w(x.root,{[x.vertical]:S,[x.horizontal]:j,[x.withLabel]:I},r),role:"separator"},y),I&&z.createElement(xu,iQ(w4({},p),{size:(p==null?void 0:p.size)||"xs",mt:qe(2),className:w(x.label,x[d],{[x.labelDefaultStyles]:_})}),c))});Hb.displayName="@mantine/core/Divider";var uQ=Object.defineProperty,dQ=Object.defineProperties,fQ=Object.getOwnPropertyDescriptors,S4=Object.getOwnPropertySymbols,pQ=Object.prototype.hasOwnProperty,hQ=Object.prototype.propertyIsEnumerable,k4=(e,t,n)=>t in e?uQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j4=(e,t)=>{for(var n in t||(t={}))pQ.call(t,n)&&k4(e,n,t[n]);if(S4)for(var n of S4(t))hQ.call(t,n)&&k4(e,n,t[n]);return e},mQ=(e,t)=>dQ(e,fQ(t)),gQ=ko((e,t,{size:n})=>({item:mQ(j4({},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]":j4({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 vQ=gQ;var bQ=Object.defineProperty,_4=Object.getOwnPropertySymbols,xQ=Object.prototype.hasOwnProperty,yQ=Object.prototype.propertyIsEnumerable,I4=(e,t,n)=>t in e?bQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,CQ=(e,t)=>{for(var n in t||(t={}))xQ.call(t,n)&&I4(e,n,t[n]);if(_4)for(var n of _4(t))yQ.call(t,n)&&I4(e,n,t[n]);return e};function qy({data:e,hovered:t,classNames:n,styles:r,isItemSelected:o,uuid:s,__staticSelector:i,onItemHover:c,onItemSelect:d,itemsRefs:p,itemComponent:h,size:m,nothingFound:g,creatable:b,createLabel:y,unstyled:x,variant:w}){const{classes:S}=vQ(null,{classNames:n,styles:r,unstyled:x,name:i,variant:w,size:m}),j=[],I=[];let _=null;const M=(A,R)=>{const D=typeof o=="function"?o(A.value):!1;return z.createElement(h,CQ({key:A.value,className:S.item,"data-disabled":A.disabled||void 0,"data-hovered":!A.disabled&&t===R||void 0,"data-selected":!A.disabled&&D||void 0,selected:D,onMouseEnter:()=>c(R),id:`${s}-${R}`,role:"option",tabIndex:-1,"aria-selected":t===R,ref:O=>{p&&p.current&&(p.current[A.value]=O)},onMouseDown:A.disabled?null:O=>{O.preventDefault(),d(A)},disabled:A.disabled,variant:w},A))};let E=null;if(e.forEach((A,R)=>{A.creatable?_=R:A.group?(E!==A.group&&(E=A.group,I.push(z.createElement("div",{className:S.separator,key:`__mantine-divider-${R}`},z.createElement(Hb,{classNames:{label:S.separatorLabel},label:A.group})))),I.push(M(A,R))):j.push(M(A,R))}),b){const A=e[_];j.push(z.createElement("div",{key:Uy(),className:S.item,"data-hovered":t===_||void 0,onMouseEnter:()=>c(_),onMouseDown:R=>{R.preventDefault(),d(A)},tabIndex:-1,ref:R=>{p&&p.current&&(p.current[A.value]=R)}},y))}return I.length>0&&j.length>0&&j.unshift(z.createElement("div",{className:S.separator,key:"empty-group-separator"},z.createElement(Hb,null))),I.length>0||j.length>0?z.createElement(z.Fragment,null,I,j):z.createElement(xu,{size:m,unstyled:x,className:S.nothingFound},g)}qy.displayName="@mantine/core/SelectItems";var wQ=Object.defineProperty,Cm=Object.getOwnPropertySymbols,aE=Object.prototype.hasOwnProperty,iE=Object.prototype.propertyIsEnumerable,P4=(e,t,n)=>t in e?wQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SQ=(e,t)=>{for(var n in t||(t={}))aE.call(t,n)&&P4(e,n,t[n]);if(Cm)for(var n of Cm(t))iE.call(t,n)&&P4(e,n,t[n]);return e},kQ=(e,t)=>{var n={};for(var r in e)aE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Cm)for(var r of Cm(e))t.indexOf(r)<0&&iE.call(e,r)&&(n[r]=e[r]);return n};const Ky=l.forwardRef((e,t)=>{var n=e,{label:r,value:o}=n,s=kQ(n,["label","value"]);return z.createElement("div",SQ({ref:t},s),r||o)});Ky.displayName="@mantine/core/DefaultItem";function Kr(){return Kr=Object.assign?Object.assign.bind():function(e){for(var t=1;te.forEach(n=>jQ(n,t))}function rc(...e){return l.useCallback(lE(...e),e)}const cE=l.forwardRef((e,t)=>{const{children:n,...r}=e,o=l.Children.toArray(n),s=o.find(IQ);if(s){const i=s.props.children,c=o.map(d=>d===s?l.Children.count(i)>1?l.Children.only(null):l.isValidElement(i)?i.props.children:null:d);return l.createElement(Vb,wm({},r,{ref:t}),l.isValidElement(i)?l.cloneElement(i,void 0,c):null)}return l.createElement(Vb,wm({},r,{ref:t}),n)});cE.displayName="Slot";const Vb=l.forwardRef((e,t)=>{const{children:n,...r}=e;return l.isValidElement(n)?l.cloneElement(n,{...PQ(r,n.props),ref:lE(t,n.ref)}):l.Children.count(n)>1?l.Children.only(null):null});Vb.displayName="SlotClone";const _Q=({children:e})=>l.createElement(l.Fragment,null,e);function IQ(e){return l.isValidElement(e)&&e.type===_Q}function PQ(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...c)=>{s(...c),o(...c)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}const EQ=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],Qf=EQ.reduce((e,t)=>{const n=l.forwardRef((r,o)=>{const{asChild:s,...i}=r,c=s?cE:t;return l.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),l.createElement(c,Wb({},i,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Ub=globalThis!=null&&globalThis.document?l.useLayoutEffect:()=>{};function MQ(e,t){return l.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Xf=e=>{const{present:t,children:n}=e,r=OQ(t),o=typeof n=="function"?n({present:r.isPresent}):l.Children.only(n),s=rc(r.ref,o.ref);return typeof n=="function"||r.isPresent?l.cloneElement(o,{ref:s}):null};Xf.displayName="Presence";function OQ(e){const[t,n]=l.useState(),r=l.useRef({}),o=l.useRef(e),s=l.useRef("none"),i=e?"mounted":"unmounted",[c,d]=MQ(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return l.useEffect(()=>{const p=lh(r.current);s.current=c==="mounted"?p:"none"},[c]),Ub(()=>{const p=r.current,h=o.current;if(h!==e){const g=s.current,b=lh(p);e?d("MOUNT"):b==="none"||(p==null?void 0:p.display)==="none"?d("UNMOUNT"):d(h&&g!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),Ub(()=>{if(t){const p=m=>{const b=lh(r.current).includes(m.animationName);m.target===t&&b&&ls.flushSync(()=>d("ANIMATION_END"))},h=m=>{m.target===t&&(s.current=lh(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:l.useCallback(p=>{p&&(r.current=getComputedStyle(p)),n(p)},[])}}function lh(e){return(e==null?void 0:e.animationName)||"none"}function AQ(e,t=[]){let n=[];function r(s,i){const c=l.createContext(i),d=n.length;n=[...n,i];function p(m){const{scope:g,children:b,...y}=m,x=(g==null?void 0:g[e][d])||c,w=l.useMemo(()=>y,Object.values(y));return l.createElement(x.Provider,{value:w},b)}function h(m,g){const b=(g==null?void 0:g[e][d])||c,y=l.useContext(b);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${s}\``)}return p.displayName=s+"Provider",[p,h]}const o=()=>{const s=n.map(i=>l.createContext(i));return function(c){const d=(c==null?void 0:c[e])||s;return l.useMemo(()=>({[`__scope${e}`]:{...c,[e]:d}}),[c,d])}};return o.scopeName=e,[r,RQ(o,...t)]}function RQ(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((c,{useScope:d,scopeName:p})=>{const m=d(s)[`__scope${p}`];return{...c,...m}},{});return l.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Ol(e){const t=l.useRef(e);return l.useEffect(()=>{t.current=e}),l.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const DQ=l.createContext(void 0);function TQ(e){const t=l.useContext(DQ);return e||t||"ltr"}function NQ(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ll(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 $Q(e,t){return l.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const uE="ScrollArea",[dE,Abe]=AQ(uE),[LQ,Bs]=dE(uE),zQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[c,d]=l.useState(null),[p,h]=l.useState(null),[m,g]=l.useState(null),[b,y]=l.useState(null),[x,w]=l.useState(null),[S,j]=l.useState(0),[I,_]=l.useState(0),[M,E]=l.useState(!1),[A,R]=l.useState(!1),D=rc(t,T=>d(T)),O=TQ(o);return l.createElement(LQ,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:c,viewport:p,onViewportChange:h,content:m,onContentChange:g,scrollbarX:b,onScrollbarXChange:y,scrollbarXEnabled:M,onScrollbarXEnabledChange:E,scrollbarY:x,onScrollbarYChange:w,scrollbarYEnabled:A,onScrollbarYEnabledChange:R,onCornerWidthChange:j,onCornerHeightChange:_},l.createElement(Qf.div,Kr({dir:O},i,{ref:D,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":I+"px",...e.style}})))}),FQ="ScrollAreaViewport",BQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,s=Bs(FQ,n),i=l.useRef(null),c=rc(t,i,s.onViewportChange);return l.createElement(l.Fragment,null,l.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),l.createElement(Qf.div,Kr({"data-radix-scroll-area-viewport":""},o,{ref:c,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style}}),l.createElement("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),Ei="ScrollAreaScrollbar",HQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Bs(Ei,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,c=e.orientation==="horizontal";return l.useEffect(()=>(c?s(!0):i(!0),()=>{c?s(!1):i(!1)}),[c,s,i]),o.type==="hover"?l.createElement(WQ,Kr({},r,{ref:t,forceMount:n})):o.type==="scroll"?l.createElement(VQ,Kr({},r,{ref:t,forceMount:n})):o.type==="auto"?l.createElement(fE,Kr({},r,{ref:t,forceMount:n})):o.type==="always"?l.createElement(Qy,Kr({},r,{ref:t})):null}),WQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Bs(Ei,e.__scopeScrollArea),[s,i]=l.useState(!1);return l.useEffect(()=>{const c=o.scrollArea;let d=0;if(c){const p=()=>{window.clearTimeout(d),i(!0)},h=()=>{d=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return c.addEventListener("pointerenter",p),c.addEventListener("pointerleave",h),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",p),c.removeEventListener("pointerleave",h)}}},[o.scrollArea,o.scrollHideDelay]),l.createElement(Xf,{present:n||s},l.createElement(fE,Kr({"data-state":s?"visible":"hidden"},r,{ref:t})))}),VQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Bs(Ei,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Zg(()=>d("SCROLL_END"),100),[c,d]=$Q("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return l.useEffect(()=>{if(c==="idle"){const p=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[c,o.scrollHideDelay,d]),l.useEffect(()=>{const p=o.viewport,h=s?"scrollLeft":"scrollTop";if(p){let m=p[h];const g=()=>{const b=p[h];m!==b&&(d("SCROLL"),i()),m=b};return p.addEventListener("scroll",g),()=>p.removeEventListener("scroll",g)}},[o.viewport,s,d,i]),l.createElement(Xf,{present:n||c!=="hidden"},l.createElement(Qy,Kr({"data-state":c==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:Ll(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Ll(e.onPointerLeave,()=>d("POINTER_LEAVE"))})))}),fE=l.forwardRef((e,t)=>{const n=Bs(Ei,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=l.useState(!1),c=e.orientation==="horizontal",d=Zg(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=Bs(Ei,e.__scopeScrollArea),s=l.useRef(null),i=l.useRef(0),[c,d]=l.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=gE(c.viewport,c.content),h={...r,sizes:c,onSizesChange:d,hasThumb:p>0&&p<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:g=>i.current=g};function m(g,b){return JQ(g,i.current,c,b)}return n==="horizontal"?l.createElement(UQ,Kr({},h,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollLeft,b=E4(g,c,o.dir);s.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollLeft=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollLeft=m(g,o.dir))}})):n==="vertical"?l.createElement(GQ,Kr({},h,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollTop,b=E4(g,c);s.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollTop=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollTop=m(g))}})):null}),UQ=l.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=Bs(Ei,e.__scopeScrollArea),[i,c]=l.useState(),d=l.useRef(null),p=rc(t,d,s.onScrollbarXChange);return l.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),l.createElement(hE,Kr({"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":Jg(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,m)=>{if(s.viewport){const g=s.viewport.scrollLeft+h.deltaX;e.onWheelScroll(g),bE(g,m)&&h.preventDefault()}},onResize:()=>{d.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Sm(i.paddingLeft),paddingEnd:Sm(i.paddingRight)}})}}))}),GQ=l.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=Bs(Ei,e.__scopeScrollArea),[i,c]=l.useState(),d=l.useRef(null),p=rc(t,d,s.onScrollbarYChange);return l.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),l.createElement(hE,Kr({"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":Jg(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,m)=>{if(s.viewport){const g=s.viewport.scrollTop+h.deltaY;e.onWheelScroll(g),bE(g,m)&&h.preventDefault()}},onResize:()=>{d.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Sm(i.paddingTop),paddingEnd:Sm(i.paddingBottom)}})}}))}),[qQ,pE]=dE(Ei),hE=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:p,onWheelScroll:h,onResize:m,...g}=e,b=Bs(Ei,n),[y,x]=l.useState(null),w=rc(t,D=>x(D)),S=l.useRef(null),j=l.useRef(""),I=b.viewport,_=r.content-r.viewport,M=Ol(h),E=Ol(d),A=Zg(m,10);function R(D){if(S.current){const O=D.clientX-S.current.left,T=D.clientY-S.current.top;p({x:O,y:T})}}return l.useEffect(()=>{const D=O=>{const T=O.target;(y==null?void 0:y.contains(T))&&M(O,_)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[I,y,_,M]),l.useEffect(E,[r,E]),yu(y,A),yu(b.content,A),l.createElement(qQ,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:Ol(s),onThumbPointerUp:Ol(i),onThumbPositionChange:E,onThumbPointerDown:Ol(c)},l.createElement(Qf.div,Kr({},g,{ref:w,style:{position:"absolute",...g.style},onPointerDown:Ll(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",R(D))}),onPointerMove:Ll(e.onPointerMove,R),onPointerUp:Ll(e.onPointerUp,D=>{const O=D.target;O.hasPointerCapture(D.pointerId)&&O.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=j.current,S.current=null})})))}),Gb="ScrollAreaThumb",KQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=pE(Gb,e.__scopeScrollArea);return l.createElement(Xf,{present:n||o.hasThumb},l.createElement(QQ,Kr({ref:t},r)))}),QQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=Bs(Gb,n),i=pE(Gb,n),{onThumbPositionChange:c}=i,d=rc(t,m=>i.onThumbChange(m)),p=l.useRef(),h=Zg(()=>{p.current&&(p.current(),p.current=void 0)},100);return l.useEffect(()=>{const m=s.viewport;if(m){const g=()=>{if(h(),!p.current){const b=ZQ(m,c);p.current=b,c()}};return c(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[s.viewport,h,c]),l.createElement(Qf.div,Kr({"data-state":i.hasThumb?"visible":"hidden"},o,{ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ll(e.onPointerDownCapture,m=>{const b=m.target.getBoundingClientRect(),y=m.clientX-b.left,x=m.clientY-b.top;i.onThumbPointerDown({x:y,y:x})}),onPointerUp:Ll(e.onPointerUp,i.onThumbPointerUp)}))}),mE="ScrollAreaCorner",XQ=l.forwardRef((e,t)=>{const n=Bs(mE,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.createElement(YQ,Kr({},e,{ref:t})):null}),YQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=Bs(mE,n),[s,i]=l.useState(0),[c,d]=l.useState(0),p=!!(s&&c);return yu(o.scrollbarX,()=>{var h;const m=((h=o.scrollbarX)===null||h===void 0?void 0:h.offsetHeight)||0;o.onCornerHeightChange(m),d(m)}),yu(o.scrollbarY,()=>{var h;const m=((h=o.scrollbarY)===null||h===void 0?void 0:h.offsetWidth)||0;o.onCornerWidthChange(m),i(m)}),p?l.createElement(Qf.div,Kr({},r,{ref:t,style:{width:s,height:c,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function Sm(e){return e?parseInt(e,10):0}function gE(e,t){const n=e/t;return isNaN(n)?0:n}function Jg(e){const t=gE(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function JQ(e,t,n,r="ltr"){const o=Jg(n),s=o/2,i=t||s,c=o-i,d=n.scrollbar.paddingStart+i,p=n.scrollbar.size-n.scrollbar.paddingEnd-c,h=n.content-n.viewport,m=r==="ltr"?[0,h]:[h*-1,0];return vE([d,p],m)(e)}function E4(e,t,n="ltr"){const r=Jg(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,c=s-r,d=n==="ltr"?[0,i]:[i*-1,0],p=NQ(e,d);return vE([0,i],[0,c])(p)}function vE(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 bE(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,c=n.top!==s.top;(i||c)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function Zg(e,t){const n=Ol(e),r=l.useRef(0);return l.useEffect(()=>()=>window.clearTimeout(r.current),[]),l.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function yu(e,t){const n=Ol(t);Ub(()=>{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 eX=zQ,tX=BQ,M4=HQ,O4=KQ,nX=XQ;var rX=ko((e,{scrollbarSize:t,offsetScrollbars:n,scrollbarHovered:r,hidden:o})=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:n?qe(t):void 0,paddingBottom:n?qe(t):void 0},scrollbar:{display:o?"none":"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:`calc(${qe(t)} / 5)`,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.colors.gray[0],[`& .${Nk("thumb")}`]:{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.5):e.fn.rgba(e.black,.5)}},'&[data-orientation="vertical"]':{width:qe(t)},'&[data-orientation="horizontal"]':{flexDirection:"column",height:qe(t)},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:Nk("thumb"),flex:1,backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.4):e.fn.rgba(e.black,.4),borderRadius:qe(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:qe(44),minHeight:qe(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 oX=rX;var sX=Object.defineProperty,aX=Object.defineProperties,iX=Object.getOwnPropertyDescriptors,km=Object.getOwnPropertySymbols,xE=Object.prototype.hasOwnProperty,yE=Object.prototype.propertyIsEnumerable,A4=(e,t,n)=>t in e?sX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qb=(e,t)=>{for(var n in t||(t={}))xE.call(t,n)&&A4(e,n,t[n]);if(km)for(var n of km(t))yE.call(t,n)&&A4(e,n,t[n]);return e},CE=(e,t)=>aX(e,iX(t)),wE=(e,t)=>{var n={};for(var r in e)xE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&km)for(var r of km(e))t.indexOf(r)<0&&yE.call(e,r)&&(n[r]=e[r]);return n};const SE={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},e0=l.forwardRef((e,t)=>{const n=zr("ScrollArea",SE,e),{children:r,className:o,classNames:s,styles:i,scrollbarSize:c,scrollHideDelay:d,type:p,dir:h,offsetScrollbars:m,viewportRef:g,onScrollPositionChange:b,unstyled:y,variant:x,viewportProps:w}=n,S=wE(n,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","variant","viewportProps"]),[j,I]=l.useState(!1),_=Ii(),{classes:M,cx:E}=oX({scrollbarSize:c,offsetScrollbars:m,scrollbarHovered:j,hidden:p==="never"},{name:"ScrollArea",classNames:s,styles:i,unstyled:y,variant:x});return z.createElement(eX,{type:p==="never"?"always":p,scrollHideDelay:d,dir:h||_.dir,ref:t,asChild:!0},z.createElement(Xo,qb({className:E(M.root,o)},S),z.createElement(tX,CE(qb({},w),{className:M.viewport,ref:g,onScroll:typeof b=="function"?({currentTarget:A})=>b({x:A.scrollLeft,y:A.scrollTop}):void 0}),r),z.createElement(M4,{orientation:"horizontal",className:M.scrollbar,forceMount:!0,onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1)},z.createElement(O4,{className:M.thumb})),z.createElement(M4,{orientation:"vertical",className:M.scrollbar,forceMount:!0,onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1)},z.createElement(O4,{className:M.thumb})),z.createElement(nX,{className:M.corner})))}),kE=l.forwardRef((e,t)=>{const n=zr("ScrollAreaAutosize",SE,e),{children:r,classNames:o,styles:s,scrollbarSize:i,scrollHideDelay:c,type:d,dir:p,offsetScrollbars:h,viewportRef:m,onScrollPositionChange:g,unstyled:b,sx:y,variant:x,viewportProps:w}=n,S=wE(n,["children","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","sx","variant","viewportProps"]);return z.createElement(Xo,CE(qb({},S),{ref:t,sx:[{display:"flex"},...d6(y)]}),z.createElement(Xo,{sx:{display:"flex",flexDirection:"column",flex:1}},z.createElement(e0,{classNames:o,styles:s,scrollHideDelay:c,scrollbarSize:i,type:d,dir:p,offsetScrollbars:h,viewportRef:m,onScrollPositionChange:g,unstyled:b,variant:x,viewportProps:w},r)))});kE.displayName="@mantine/core/ScrollAreaAutosize";e0.displayName="@mantine/core/ScrollArea";e0.Autosize=kE;const jE=e0;var lX=Object.defineProperty,cX=Object.defineProperties,uX=Object.getOwnPropertyDescriptors,jm=Object.getOwnPropertySymbols,_E=Object.prototype.hasOwnProperty,IE=Object.prototype.propertyIsEnumerable,R4=(e,t,n)=>t in e?lX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D4=(e,t)=>{for(var n in t||(t={}))_E.call(t,n)&&R4(e,n,t[n]);if(jm)for(var n of jm(t))IE.call(t,n)&&R4(e,n,t[n]);return e},dX=(e,t)=>cX(e,uX(t)),fX=(e,t)=>{var n={};for(var r in e)_E.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&jm)for(var r of jm(e))t.indexOf(r)<0&&IE.call(e,r)&&(n[r]=e[r]);return n};const t0=l.forwardRef((e,t)=>{var n=e,{style:r}=n,o=fX(n,["style"]);return z.createElement(jE,dX(D4({},o),{style:D4({width:"100%"},r),viewportProps:{tabIndex:-1},viewportRef:t}),o.children)});t0.displayName="@mantine/core/SelectScrollArea";var pX=ko(()=>({dropdown:{},itemsWrapper:{padding:qe(4),display:"flex",width:"100%",boxSizing:"border-box"}}));const hX=pX,ia=Math.min,xo=Math.max,_m=Math.round,ch=Math.floor,ol=e=>({x:e,y:e}),mX={left:"right",right:"left",bottom:"top",top:"bottom"},gX={start:"end",end:"start"};function Kb(e,t,n){return xo(e,ia(t,n))}function hi(e,t){return typeof e=="function"?e(t):e}function la(e){return e.split("-")[0]}function Fu(e){return e.split("-")[1]}function Xy(e){return e==="x"?"y":"x"}function Yy(e){return e==="y"?"height":"width"}function oc(e){return["top","bottom"].includes(la(e))?"y":"x"}function Jy(e){return Xy(oc(e))}function vX(e,t,n){n===void 0&&(n=!1);const r=Fu(e),o=Jy(e),s=Yy(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Im(i)),[i,Im(i)]}function bX(e){const t=Im(e);return[Qb(e),t,Qb(t)]}function Qb(e){return e.replace(/start|end/g,t=>gX[t])}function xX(e,t,n){const r=["left","right"],o=["right","left"],s=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?s:i;default:return[]}}function yX(e,t,n,r){const o=Fu(e);let s=xX(la(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Qb)))),s}function Im(e){return e.replace(/left|right|bottom|top/g,t=>mX[t])}function CX(e){return{top:0,right:0,bottom:0,left:0,...e}}function Zy(e){return typeof e!="number"?CX(e):{top:e,right:e,bottom:e,left:e}}function Cu(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function T4(e,t,n){let{reference:r,floating:o}=e;const s=oc(t),i=Jy(t),c=Yy(i),d=la(t),p=s==="y",h=r.x+r.width/2-o.width/2,m=r.y+r.height/2-o.height/2,g=r[c]/2-o[c]/2;let b;switch(d){case"top":b={x:h,y:r.y-o.height};break;case"bottom":b={x:h,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:m};break;case"left":b={x:r.x-o.width,y:m};break;default:b={x:r.x,y:r.y}}switch(Fu(t)){case"start":b[i]-=g*(n&&p?-1:1);break;case"end":b[i]+=g*(n&&p?-1:1);break}return b}const wX=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),d=await(i.isRTL==null?void 0:i.isRTL(t));let p=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:m}=T4(p,r,d),g=r,b={},y=0;for(let x=0;x({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:d}=t,{element:p,padding:h=0}=hi(e,t)||{};if(p==null)return{};const m=Zy(h),g={x:n,y:r},b=Jy(o),y=Yy(b),x=await i.getDimensions(p),w=b==="y",S=w?"top":"left",j=w?"bottom":"right",I=w?"clientHeight":"clientWidth",_=s.reference[y]+s.reference[b]-g[b]-s.floating[y],M=g[b]-s.reference[b],E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(p));let A=E?E[I]:0;(!A||!await(i.isElement==null?void 0:i.isElement(E)))&&(A=c.floating[I]||s.floating[y]);const R=_/2-M/2,D=A/2-x[y]/2-1,O=ia(m[S],D),T=ia(m[j],D),K=O,G=A-x[y]-T,X=A/2-x[y]/2+R,Z=Kb(K,X,G),te=!d.arrow&&Fu(o)!=null&&X!=Z&&s.reference[y]/2-(XK<=0)){var D,O;const K=(((D=s.flip)==null?void 0:D.index)||0)+1,G=M[K];if(G)return{data:{index:K,overflows:R},reset:{placement:G}};let X=(O=R.filter(Z=>Z.overflows[0]<=0).sort((Z,te)=>Z.overflows[1]-te.overflows[1])[0])==null?void 0:O.placement;if(!X)switch(b){case"bestFit":{var T;const Z=(T=R.map(te=>[te.placement,te.overflows.filter(V=>V>0).reduce((V,oe)=>V+oe,0)]).sort((te,V)=>te[1]-V[1])[0])==null?void 0:T[0];Z&&(X=Z);break}case"initialPlacement":X=c;break}if(o!==X)return{reset:{placement:X}}}return{}}}};function PE(e){const t=ia(...e.map(s=>s.left)),n=ia(...e.map(s=>s.top)),r=xo(...e.map(s=>s.right)),o=xo(...e.map(s=>s.bottom));return{x:t,y:n,width:r-t,height:o-n}}function kX(e){const t=e.slice().sort((o,s)=>o.y-s.y),n=[];let r=null;for(let o=0;or.height/2?n.push([s]):n[n.length-1].push(s),r=s}return n.map(o=>Cu(PE(o)))}const jX=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:s,strategy:i}=t,{padding:c=2,x:d,y:p}=hi(e,t),h=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),m=kX(h),g=Cu(PE(h)),b=Zy(c);function y(){if(m.length===2&&m[0].left>m[1].right&&d!=null&&p!=null)return m.find(w=>d>w.left-b.left&&dw.top-b.top&&p=2){if(oc(n)==="y"){const O=m[0],T=m[m.length-1],K=la(n)==="top",G=O.top,X=T.bottom,Z=K?O.left:T.left,te=K?O.right:T.right,V=te-Z,oe=X-G;return{top:G,bottom:X,left:Z,right:te,width:V,height:oe,x:Z,y:G}}const w=la(n)==="left",S=xo(...m.map(O=>O.right)),j=ia(...m.map(O=>O.left)),I=m.filter(O=>w?O.left===j:O.right===S),_=I[0].top,M=I[I.length-1].bottom,E=j,A=S,R=A-E,D=M-_;return{top:_,bottom:M,left:E,right:A,width:R,height:D,x:E,y:_}}return g}const x=await s.getElementRects({reference:{getBoundingClientRect:y},floating:r.floating,strategy:i});return o.reference.x!==x.reference.x||o.reference.y!==x.reference.y||o.reference.width!==x.reference.width||o.reference.height!==x.reference.height?{reset:{rects:x}}:{}}}};async function _X(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=la(n),c=Fu(n),d=oc(n)==="y",p=["left","top"].includes(i)?-1:1,h=s&&d?-1:1,m=hi(t,e);let{mainAxis:g,crossAxis:b,alignmentAxis:y}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...m};return c&&typeof y=="number"&&(b=c==="end"?y*-1:y),d?{x:b*h,y:g*p}:{x:g*p,y:b*h}}const IX=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await _X(t,e);return{x:n+o.x,y:r+o.y,data:o}}}},PX=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:S,y:j}=w;return{x:S,y:j}}},...d}=hi(e,t),p={x:n,y:r},h=await e2(t,d),m=oc(la(o)),g=Xy(m);let b=p[g],y=p[m];if(s){const w=g==="y"?"top":"left",S=g==="y"?"bottom":"right",j=b+h[w],I=b-h[S];b=Kb(j,b,I)}if(i){const w=m==="y"?"top":"left",S=m==="y"?"bottom":"right",j=y+h[w],I=y-h[S];y=Kb(j,y,I)}const x=c.fn({...t,[g]:b,[m]:y});return{...x,data:{x:x.x-n,y:x.y-r}}}}},EX=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:d=!0,crossAxis:p=!0}=hi(e,t),h={x:n,y:r},m=oc(o),g=Xy(m);let b=h[g],y=h[m];const x=hi(c,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(d){const I=g==="y"?"height":"width",_=s.reference[g]-s.floating[I]+w.mainAxis,M=s.reference[g]+s.reference[I]-w.mainAxis;b<_?b=_:b>M&&(b=M)}if(p){var S,j;const I=g==="y"?"width":"height",_=["top","left"].includes(la(o)),M=s.reference[m]-s.floating[I]+(_&&((S=i.offset)==null?void 0:S[m])||0)+(_?0:w.crossAxis),E=s.reference[m]+s.reference[I]+(_?0:((j=i.offset)==null?void 0:j[m])||0)-(_?w.crossAxis:0);yE&&(y=E)}return{[g]:b,[m]:y}}}},MX=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...c}=hi(e,t),d=await e2(t,c),p=la(n),h=Fu(n),m=oc(n)==="y",{width:g,height:b}=r.floating;let y,x;p==="top"||p==="bottom"?(y=p,x=h===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(x=p,y=h==="end"?"top":"bottom");const w=b-d[y],S=g-d[x],j=!t.middlewareData.shift;let I=w,_=S;if(m){const E=g-d.left-d.right;_=h||j?ia(S,E):E}else{const E=b-d.top-d.bottom;I=h||j?ia(w,E):E}if(j&&!h){const E=xo(d.left,0),A=xo(d.right,0),R=xo(d.top,0),D=xo(d.bottom,0);m?_=g-2*(E!==0||A!==0?E+A:xo(d.left,d.right)):I=b-2*(R!==0||D!==0?R+D:xo(d.top,d.bottom))}await i({...t,availableWidth:_,availableHeight:I});const M=await o.getDimensions(s.floating);return g!==M.width||b!==M.height?{reset:{rects:!0}}:{}}}};function sl(e){return EE(e)?(e.nodeName||"").toLowerCase():"#document"}function ds(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mi(e){var t;return(t=(EE(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function EE(e){return e instanceof Node||e instanceof ds(e).Node}function mi(e){return e instanceof Element||e instanceof ds(e).Element}function Da(e){return e instanceof HTMLElement||e instanceof ds(e).HTMLElement}function $4(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ds(e).ShadowRoot}function Yf(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ns(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function OX(e){return["table","td","th"].includes(sl(e))}function t2(e){const t=n2(),n=Ns(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function AX(e){let t=wu(e);for(;Da(t)&&!n0(t);){if(t2(t))return t;t=wu(t)}return null}function n2(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function n0(e){return["html","body","#document"].includes(sl(e))}function Ns(e){return ds(e).getComputedStyle(e)}function r0(e){return mi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function wu(e){if(sl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||$4(e)&&e.host||Mi(e);return $4(t)?t.host:t}function ME(e){const t=wu(e);return n0(t)?e.ownerDocument?e.ownerDocument.body:e.body:Da(t)&&Yf(t)?t:ME(t)}function uf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ME(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=ds(o);return s?t.concat(i,i.visualViewport||[],Yf(o)?o:[],i.frameElement&&n?uf(i.frameElement):[]):t.concat(o,uf(o,[],n))}function OE(e){const t=Ns(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Da(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=_m(n)!==s||_m(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function r2(e){return mi(e)?e:e.contextElement}function iu(e){const t=r2(e);if(!Da(t))return ol(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=OE(t);let i=(s?_m(n.width):n.width)/r,c=(s?_m(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const RX=ol(0);function AE(e){const t=ds(e);return!n2()||!t.visualViewport?RX:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function DX(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ds(e)?!1:t}function Ql(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=r2(e);let i=ol(1);t&&(r?mi(r)&&(i=iu(r)):i=iu(e));const c=DX(s,n,r)?AE(s):ol(0);let d=(o.left+c.x)/i.x,p=(o.top+c.y)/i.y,h=o.width/i.x,m=o.height/i.y;if(s){const g=ds(s),b=r&&mi(r)?ds(r):r;let y=g.frameElement;for(;y&&r&&b!==g;){const x=iu(y),w=y.getBoundingClientRect(),S=Ns(y),j=w.left+(y.clientLeft+parseFloat(S.paddingLeft))*x.x,I=w.top+(y.clientTop+parseFloat(S.paddingTop))*x.y;d*=x.x,p*=x.y,h*=x.x,m*=x.y,d+=j,p+=I,y=ds(y).frameElement}}return Cu({width:h,height:m,x:d,y:p})}function TX(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Da(n),s=Mi(n);if(n===s)return t;let i={scrollLeft:0,scrollTop:0},c=ol(1);const d=ol(0);if((o||!o&&r!=="fixed")&&((sl(n)!=="body"||Yf(s))&&(i=r0(n)),Da(n))){const p=Ql(n);c=iu(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-i.scrollLeft*c.x+d.x,y:t.y*c.y-i.scrollTop*c.y+d.y}}function NX(e){return Array.from(e.getClientRects())}function RE(e){return Ql(Mi(e)).left+r0(e).scrollLeft}function $X(e){const t=Mi(e),n=r0(e),r=e.ownerDocument.body,o=xo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=xo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+RE(e);const c=-n.scrollTop;return Ns(r).direction==="rtl"&&(i+=xo(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}function LX(e,t){const n=ds(e),r=Mi(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,d=0;if(o){s=o.width,i=o.height;const p=n2();(!p||p&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}return{width:s,height:i,x:c,y:d}}function zX(e,t){const n=Ql(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Da(e)?iu(e):ol(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,d=o*s.x,p=r*s.y;return{width:i,height:c,x:d,y:p}}function L4(e,t,n){let r;if(t==="viewport")r=LX(e,n);else if(t==="document")r=$X(Mi(e));else if(mi(t))r=zX(t,n);else{const o=AE(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Cu(r)}function DE(e,t){const n=wu(e);return n===t||!mi(n)||n0(n)?!1:Ns(n).position==="fixed"||DE(n,t)}function FX(e,t){const n=t.get(e);if(n)return n;let r=uf(e,[],!1).filter(c=>mi(c)&&sl(c)!=="body"),o=null;const s=Ns(e).position==="fixed";let i=s?wu(e):e;for(;mi(i)&&!n0(i);){const c=Ns(i),d=t2(i);!d&&c.position==="fixed"&&(o=null),(s?!d&&!o:!d&&c.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Yf(i)&&!d&&DE(e,i))?r=r.filter(h=>h!==i):o=c,i=wu(i)}return t.set(e,r),r}function BX(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?FX(t,this._c):[].concat(n),r],c=i[0],d=i.reduce((p,h)=>{const m=L4(t,h,o);return p.top=xo(m.top,p.top),p.right=ia(m.right,p.right),p.bottom=ia(m.bottom,p.bottom),p.left=xo(m.left,p.left),p},L4(t,c,o));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function HX(e){return OE(e)}function WX(e,t,n){const r=Da(t),o=Mi(t),s=n==="fixed",i=Ql(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const d=ol(0);if(r||!r&&!s)if((sl(t)!=="body"||Yf(o))&&(c=r0(t)),r){const p=Ql(t,!0,s,t);d.x=p.x+t.clientLeft,d.y=p.y+t.clientTop}else o&&(d.x=RE(o));return{x:i.left+c.scrollLeft-d.x,y:i.top+c.scrollTop-d.y,width:i.width,height:i.height}}function z4(e,t){return!Da(e)||Ns(e).position==="fixed"?null:t?t(e):e.offsetParent}function TE(e,t){const n=ds(e);if(!Da(e))return n;let r=z4(e,t);for(;r&&OX(r)&&Ns(r).position==="static";)r=z4(r,t);return r&&(sl(r)==="html"||sl(r)==="body"&&Ns(r).position==="static"&&!t2(r))?n:r||AX(e)||n}const VX=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||TE,s=this.getDimensions;return{reference:WX(t,await o(n),r),floating:{x:0,y:0,...await s(n)}}};function UX(e){return Ns(e).direction==="rtl"}const GX={convertOffsetParentRelativeRectToViewportRelativeRect:TX,getDocumentElement:Mi,getClippingRect:BX,getOffsetParent:TE,getElementRects:VX,getClientRects:NX,getDimensions:HX,getScale:iu,isElement:mi,isRTL:UX};function qX(e,t){let n=null,r;const o=Mi(e);function s(){clearTimeout(r),n&&n.disconnect(),n=null}function i(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),s();const{left:p,top:h,width:m,height:g}=e.getBoundingClientRect();if(c||t(),!m||!g)return;const b=ch(h),y=ch(o.clientWidth-(p+m)),x=ch(o.clientHeight-(h+g)),w=ch(p),j={rootMargin:-b+"px "+-y+"px "+-x+"px "+-w+"px",threshold:xo(0,ia(1,d))||1};let I=!0;function _(M){const E=M[0].intersectionRatio;if(E!==d){if(!I)return i();E?i(!1,E):r=setTimeout(()=>{i(!1,1e-7)},100)}I=!1}try{n=new IntersectionObserver(_,{...j,root:o.ownerDocument})}catch{n=new IntersectionObserver(_,j)}n.observe(e)}return i(!0),s}function KX(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,p=r2(e),h=o||s?[...p?uf(p):[],...uf(t)]:[];h.forEach(S=>{o&&S.addEventListener("scroll",n,{passive:!0}),s&&S.addEventListener("resize",n)});const m=p&&c?qX(p,n):null;let g=-1,b=null;i&&(b=new ResizeObserver(S=>{let[j]=S;j&&j.target===p&&b&&(b.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{b&&b.observe(t)})),n()}),p&&!d&&b.observe(p),b.observe(t));let y,x=d?Ql(e):null;d&&w();function w(){const S=Ql(e);x&&(S.x!==x.x||S.y!==x.y||S.width!==x.width||S.height!==x.height)&&n(),x=S,y=requestAnimationFrame(w)}return n(),()=>{h.forEach(S=>{o&&S.removeEventListener("scroll",n),s&&S.removeEventListener("resize",n)}),m&&m(),b&&b.disconnect(),b=null,d&&cancelAnimationFrame(y)}}const QX=(e,t,n)=>{const r=new Map,o={platform:GX,...n},s={...o.platform,_c:r};return wX(e,t,{...o,platform:s})},XX=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?N4({element:t.current,padding:n}).fn(o):{}:t?N4({element:t,padding:n}).fn(o):{}}}};var Nh=typeof document<"u"?l.useLayoutEffect:l.useEffect;function Pm(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(!Pm(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)&&!Pm(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function F4(e){const t=l.useRef(e);return Nh(()=>{t.current=e}),t}function YX(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:s,open:i}=e,[c,d]=l.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=l.useState(r);Pm(p,r)||h(r);const m=l.useRef(null),g=l.useRef(null),b=l.useRef(c),y=F4(s),x=F4(o),[w,S]=l.useState(null),[j,I]=l.useState(null),_=l.useCallback(O=>{m.current!==O&&(m.current=O,S(O))},[]),M=l.useCallback(O=>{g.current!==O&&(g.current=O,I(O))},[]),E=l.useCallback(()=>{if(!m.current||!g.current)return;const O={placement:t,strategy:n,middleware:p};x.current&&(O.platform=x.current),QX(m.current,g.current,O).then(T=>{const K={...T,isPositioned:!0};A.current&&!Pm(b.current,K)&&(b.current=K,ls.flushSync(()=>{d(K)}))})},[p,t,n,x]);Nh(()=>{i===!1&&b.current.isPositioned&&(b.current.isPositioned=!1,d(O=>({...O,isPositioned:!1})))},[i]);const A=l.useRef(!1);Nh(()=>(A.current=!0,()=>{A.current=!1}),[]),Nh(()=>{if(w&&j){if(y.current)return y.current(w,j,E);E()}},[w,j,E,y]);const R=l.useMemo(()=>({reference:m,floating:g,setReference:_,setFloating:M}),[_,M]),D=l.useMemo(()=>({reference:w,floating:j}),[w,j]);return l.useMemo(()=>({...c,update:E,refs:R,elements:D,reference:_,floating:M}),[c,E,R,D,_,M])}var JX=typeof document<"u"?l.useLayoutEffect:l.useEffect;function ZX(){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 eY=l.createContext(null),tY=()=>l.useContext(eY);function nY(e){return(e==null?void 0:e.ownerDocument)||document}function rY(e){return nY(e).defaultView||window}function uh(e){return e?e instanceof rY(e).Element:!1}const oY=Ox["useInsertionEffect".toString()],sY=oY||(e=>e());function aY(e){const t=l.useRef(()=>{});return sY(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;oZX())[0],[p,h]=l.useState(null),m=l.useCallback(S=>{const j=uh(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;o.refs.setReference(j)},[o.refs]),g=l.useCallback(S=>{(uh(S)||S===null)&&(i.current=S,h(S)),(uh(o.refs.reference.current)||o.refs.reference.current===null||S!==null&&!uh(S))&&o.refs.setReference(S)},[o.refs]),b=l.useMemo(()=>({...o.refs,setReference:g,setPositionReference:m,domReference:i}),[o.refs,g,m]),y=l.useMemo(()=>({...o.elements,domReference:p}),[o.elements,p]),x=aY(n),w=l.useMemo(()=>({...o,refs:b,elements:y,dataRef:c,nodeId:r,events:d,open:t,onOpenChange:x}),[o,r,d,t,x,b,y]);return JX(()=>{const S=s==null?void 0:s.nodesRef.current.find(j=>j.id===r);S&&(S.context=w)}),l.useMemo(()=>({...o,context:w,refs:b,reference:g,positionReference:m}),[o,b,w,g,m])}function lY({opened:e,floating:t,position:n,positionDependencies:r}){const[o,s]=l.useState(0);l.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return KX(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),oa(()=>{t.update()},r),oa(()=>{s(i=>i+1)},[e])}function cY(e){const t=[IX(e.offset)];return e.middlewares.shift&&t.push(PX({limiter:EX()})),e.middlewares.flip&&t.push(SX()),e.middlewares.inline&&t.push(jX()),t.push(XX({element:e.arrowRef,padding:e.arrowOffset})),t}function uY(e){const[t,n]=cf({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=()=>{var i;(i=e.onClose)==null||i.call(e),n(!1)},o=()=>{var i,c;t?((i=e.onClose)==null||i.call(e),n(!1)):((c=e.onOpen)==null||c.call(e),n(!0))},s=iY({placement:e.position,middleware:[...cY(e),...e.width==="target"?[MX({apply({rects:i}){var c,d;Object.assign((d=(c=s.refs.floating.current)==null?void 0:c.style)!=null?d:{},{width:`${i.reference.width}px`})}})]:[]]});return lY({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies,floating:s}),oa(()=>{var i;(i=e.onPositionChange)==null||i.call(e,s.placement)},[s.placement]),oa(()=>{var i,c;e.opened?(c=e.onOpen)==null||c.call(e):(i=e.onClose)==null||i.call(e)},[e.opened]),{floating:s,controlled:typeof e.opened=="boolean",opened:t,onClose:r,onToggle:o}}const NE={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"},[dY,$E]=DG(NE.context);var fY=Object.defineProperty,pY=Object.defineProperties,hY=Object.getOwnPropertyDescriptors,Em=Object.getOwnPropertySymbols,LE=Object.prototype.hasOwnProperty,zE=Object.prototype.propertyIsEnumerable,B4=(e,t,n)=>t in e?fY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dh=(e,t)=>{for(var n in t||(t={}))LE.call(t,n)&&B4(e,n,t[n]);if(Em)for(var n of Em(t))zE.call(t,n)&&B4(e,n,t[n]);return e},mY=(e,t)=>pY(e,hY(t)),gY=(e,t)=>{var n={};for(var r in e)LE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Em)for(var r of Em(e))t.indexOf(r)<0&&zE.call(e,r)&&(n[r]=e[r]);return n};const vY={refProp:"ref",popupType:"dialog",shouldOverrideDefaultTargetId:!0},FE=l.forwardRef((e,t)=>{const n=zr("PopoverTarget",vY,e),{children:r,refProp:o,popupType:s,shouldOverrideDefaultTargetId:i}=n,c=gY(n,["children","refProp","popupType","shouldOverrideDefaultTargetId"]);if(!p6(r))throw new Error(NE.children);const d=c,p=$E(),h=Kf(p.reference,r.ref,t),m=p.withRoles?{"aria-haspopup":s,"aria-expanded":p.opened,"aria-controls":p.getDropdownId(),id:i?p.getTargetId():r.props.id}:{};return l.cloneElement(r,dh(mY(dh(dh(dh({},d),m),p.targetProps),{className:m6(p.targetProps.className,d.className,r.props.className),[o]:h}),p.controlled?null:{onClick:p.onToggle}))});FE.displayName="@mantine/core/PopoverTarget";var bY=ko((e,{radius:t,shadow:n})=>({dropdown:{position:"absolute",backgroundColor:e.white,background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${qe(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:`${qe(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,zIndex:1}}));const xY=bY;var yY=Object.defineProperty,H4=Object.getOwnPropertySymbols,CY=Object.prototype.hasOwnProperty,wY=Object.prototype.propertyIsEnumerable,W4=(e,t,n)=>t in e?yY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oc=(e,t)=>{for(var n in t||(t={}))CY.call(t,n)&&W4(e,n,t[n]);if(H4)for(var n of H4(t))wY.call(t,n)&&W4(e,n,t[n]);return e};const V4={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function SY({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in rh?Oc(Oc(Oc({transitionProperty:rh[e].transitionProperty},o),rh[e].common),rh[e][V4[t]]):null:Oc(Oc(Oc({transitionProperty:e.transitionProperty},o),e.common),e[V4[t]])}function kY({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:i,onExited:c}){const d=Ii(),p=w6(),h=d.respectReducedMotion?p:!1,[m,g]=l.useState(h?0:e),[b,y]=l.useState(r?"entered":"exited"),x=l.useRef(-1),w=S=>{const j=S?o:s,I=S?i:c;y(S?"pre-entering":"pre-exiting"),window.clearTimeout(x.current);const _=h?0:S?e:t;if(g(_),_===0)typeof j=="function"&&j(),typeof I=="function"&&I(),y(S?"entered":"exited");else{const M=window.setTimeout(()=>{typeof j=="function"&&j(),y(S?"entering":"exiting")},10);x.current=window.setTimeout(()=>{window.clearTimeout(M),typeof I=="function"&&I(),y(S?"entered":"exited")},_)}};return oa(()=>{w(r)},[r]),l.useEffect(()=>()=>window.clearTimeout(x.current),[]),{transitionDuration:m,transitionStatus:b,transitionTimingFunction:n||d.transitionTimingFunction}}function BE({keepMounted:e,transition:t,duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:i,onExit:c,onEntered:d,onEnter:p,onExited:h}){const{transitionDuration:m,transitionStatus:g,transitionTimingFunction:b}=kY({mounted:o,exitDuration:r,duration:n,timingFunction:i,onExit:c,onEntered:d,onEnter:p,onExited:h});return m===0?o?z.createElement(z.Fragment,null,s({})):e?s({display:"none"}):null:g==="exited"?e?s({display:"none"}):null:z.createElement(z.Fragment,null,s(SY({transition:t,duration:m,state:g,timingFunction:b})))}BE.displayName="@mantine/core/Transition";function HE({children:e,active:t=!0,refProp:n="ref"}){const r=hq(t),o=Kf(r,e==null?void 0:e.ref);return p6(e)?l.cloneElement(e,{[n]:o}):e}HE.displayName="@mantine/core/FocusTrap";var jY=Object.defineProperty,_Y=Object.defineProperties,IY=Object.getOwnPropertyDescriptors,U4=Object.getOwnPropertySymbols,PY=Object.prototype.hasOwnProperty,EY=Object.prototype.propertyIsEnumerable,G4=(e,t,n)=>t in e?jY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bi=(e,t)=>{for(var n in t||(t={}))PY.call(t,n)&&G4(e,n,t[n]);if(U4)for(var n of U4(t))EY.call(t,n)&&G4(e,n,t[n]);return e},fh=(e,t)=>_Y(e,IY(t));function q4(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function K4(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 MY={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function OY({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:i,dir:c}){const[d,p="center"]=e.split("-"),h={width:qe(t),height:qe(t),transform:"rotate(45deg)",position:"absolute",[MY[d]]:qe(r)},m=qe(-t/2);return d==="left"?fh(Bi(Bi({},h),q4(p,i,n,o)),{right:m,borderLeftColor:"transparent",borderBottomColor:"transparent"}):d==="right"?fh(Bi(Bi({},h),q4(p,i,n,o)),{left:m,borderRightColor:"transparent",borderTopColor:"transparent"}):d==="top"?fh(Bi(Bi({},h),K4(p,s,n,o,c)),{bottom:m,borderTopColor:"transparent",borderLeftColor:"transparent"}):d==="bottom"?fh(Bi(Bi({},h),K4(p,s,n,o,c)),{top:m,borderBottomColor:"transparent",borderRightColor:"transparent"}):{}}var AY=Object.defineProperty,RY=Object.defineProperties,DY=Object.getOwnPropertyDescriptors,Mm=Object.getOwnPropertySymbols,WE=Object.prototype.hasOwnProperty,VE=Object.prototype.propertyIsEnumerable,Q4=(e,t,n)=>t in e?AY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TY=(e,t)=>{for(var n in t||(t={}))WE.call(t,n)&&Q4(e,n,t[n]);if(Mm)for(var n of Mm(t))VE.call(t,n)&&Q4(e,n,t[n]);return e},NY=(e,t)=>RY(e,DY(t)),$Y=(e,t)=>{var n={};for(var r in e)WE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mm)for(var r of Mm(e))t.indexOf(r)<0&&VE.call(e,r)&&(n[r]=e[r]);return n};const UE=l.forwardRef((e,t)=>{var n=e,{position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:c,visible:d,arrowX:p,arrowY:h}=n,m=$Y(n,["position","arrowSize","arrowOffset","arrowRadius","arrowPosition","visible","arrowX","arrowY"]);const g=Ii();return d?z.createElement("div",NY(TY({},m),{ref:t,style:OY({position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:c,dir:g.dir,arrowX:p,arrowY:h})})):null});UE.displayName="@mantine/core/FloatingArrow";var LY=Object.defineProperty,zY=Object.defineProperties,FY=Object.getOwnPropertyDescriptors,Om=Object.getOwnPropertySymbols,GE=Object.prototype.hasOwnProperty,qE=Object.prototype.propertyIsEnumerable,X4=(e,t,n)=>t in e?LY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ac=(e,t)=>{for(var n in t||(t={}))GE.call(t,n)&&X4(e,n,t[n]);if(Om)for(var n of Om(t))qE.call(t,n)&&X4(e,n,t[n]);return e},ph=(e,t)=>zY(e,FY(t)),BY=(e,t)=>{var n={};for(var r in e)GE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Om)for(var r of Om(e))t.indexOf(r)<0&&qE.call(e,r)&&(n[r]=e[r]);return n};const HY={};function KE(e){var t;const n=zr("PopoverDropdown",HY,e),{style:r,className:o,children:s,onKeyDownCapture:i}=n,c=BY(n,["style","className","children","onKeyDownCapture"]),d=$E(),{classes:p,cx:h}=xY({radius:d.radius,shadow:d.shadow},{name:d.__staticSelector,classNames:d.classNames,styles:d.styles,unstyled:d.unstyled,variant:d.variant}),m=iq({opened:d.opened,shouldReturnFocus:d.returnFocus}),g=d.withRoles?{"aria-labelledby":d.getTargetId(),id:d.getDropdownId(),role:"dialog"}:{};return d.disabled?null:z.createElement(q6,ph(Ac({},d.portalProps),{withinPortal:d.withinPortal}),z.createElement(BE,ph(Ac({mounted:d.opened},d.transitionProps),{transition:d.transitionProps.transition||"fade",duration:(t=d.transitionProps.duration)!=null?t:150,keepMounted:d.keepMounted,exitDuration:typeof d.transitionProps.exitDuration=="number"?d.transitionProps.exitDuration:d.transitionProps.duration}),b=>{var y,x;return z.createElement(HE,{active:d.trapFocus},z.createElement(Xo,Ac(ph(Ac({},g),{tabIndex:-1,ref:d.floating,style:ph(Ac(Ac({},r),b),{zIndex:d.zIndex,top:(y=d.y)!=null?y:0,left:(x=d.x)!=null?x:0,width:d.width==="target"?void 0:qe(d.width)}),className:h(p.dropdown,o),onKeyDownCapture:NG(d.onClose,{active:d.closeOnEscape,onTrigger:m,onKeyDown:i}),"data-position":d.placement}),c),s,z.createElement(UE,{ref:d.arrowRef,arrowX:d.arrowX,arrowY:d.arrowY,visible:d.withArrow,position:d.placement,arrowSize:d.arrowSize,arrowRadius:d.arrowRadius,arrowOffset:d.arrowOffset,arrowPosition:d.arrowPosition,className:p.arrow})))}))}KE.displayName="@mantine/core/PopoverDropdown";function WY(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 Y4=Object.getOwnPropertySymbols,VY=Object.prototype.hasOwnProperty,UY=Object.prototype.propertyIsEnumerable,GY=(e,t)=>{var n={};for(var r in e)VY.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Y4)for(var r of Y4(e))t.indexOf(r)<0&&UY.call(e,r)&&(n[r]=e[r]);return n};const qY={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:Vy("popover"),__staticSelector:"Popover",width:"max-content"};function Bu(e){var t,n,r,o,s,i;const c=l.useRef(null),d=zr("Popover",qY,e),{children:p,position:h,offset:m,onPositionChange:g,positionDependencies:b,opened:y,transitionProps:x,width:w,middlewares:S,withArrow:j,arrowSize:I,arrowOffset:_,arrowRadius:M,arrowPosition:E,unstyled:A,classNames:R,styles:D,closeOnClickOutside:O,withinPortal:T,portalProps:K,closeOnEscape:G,clickOutsideEvents:X,trapFocus:Z,onClose:te,onOpen:V,onChange:oe,zIndex:ne,radius:se,shadow:re,id:ae,defaultOpened:B,__staticSelector:Y,withRoles:$,disabled:F,returnFocus:q,variant:pe,keepMounted:W}=d,U=GY(d,["children","position","offset","onPositionChange","positionDependencies","opened","transitionProps","width","middlewares","withArrow","arrowSize","arrowOffset","arrowRadius","arrowPosition","unstyled","classNames","styles","closeOnClickOutside","withinPortal","portalProps","closeOnEscape","clickOutsideEvents","trapFocus","onClose","onOpen","onChange","zIndex","radius","shadow","id","defaultOpened","__staticSelector","withRoles","disabled","returnFocus","variant","keepMounted"]),[ee,J]=l.useState(null),[ge,he]=l.useState(null),de=Gy(ae),_e=Ii(),Pe=uY({middlewares:S,width:w,position:WY(_e.dir,h),offset:typeof m=="number"?m+(j?I/2:0):m,arrowRef:c,arrowOffset:_,onPositionChange:g,positionDependencies:b,opened:y,defaultOpened:B,onChange:oe,onOpen:V,onClose:te});rq(()=>Pe.opened&&O&&Pe.onClose(),X,[ee,ge]);const ze=l.useCallback(Je=>{J(Je),Pe.floating.reference(Je)},[Pe.floating.reference]),ht=l.useCallback(Je=>{he(Je),Pe.floating.floating(Je)},[Pe.floating.floating]);return z.createElement(dY,{value:{returnFocus:q,disabled:F,controlled:Pe.controlled,reference:ze,floating:ht,x:Pe.floating.x,y:Pe.floating.y,arrowX:(r=(n=(t=Pe.floating)==null?void 0:t.middlewareData)==null?void 0:n.arrow)==null?void 0:r.x,arrowY:(i=(s=(o=Pe.floating)==null?void 0:o.middlewareData)==null?void 0:s.arrow)==null?void 0:i.y,opened:Pe.opened,arrowRef:c,transitionProps:x,width:w,withArrow:j,arrowSize:I,arrowOffset:_,arrowRadius:M,arrowPosition:E,placement:Pe.floating.placement,trapFocus:Z,withinPortal:T,portalProps:K,zIndex:ne,radius:se,shadow:re,closeOnEscape:G,onClose:Pe.onClose,onToggle:Pe.onToggle,getTargetId:()=>`${de}-target`,getDropdownId:()=>`${de}-dropdown`,withRoles:$,targetProps:U,__staticSelector:Y,classNames:R,styles:D,unstyled:A,variant:pe,keepMounted:W}},p)}Bu.Target=FE;Bu.Dropdown=KE;Bu.displayName="@mantine/core/Popover";var KY=Object.defineProperty,Am=Object.getOwnPropertySymbols,QE=Object.prototype.hasOwnProperty,XE=Object.prototype.propertyIsEnumerable,J4=(e,t,n)=>t in e?KY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QY=(e,t)=>{for(var n in t||(t={}))QE.call(t,n)&&J4(e,n,t[n]);if(Am)for(var n of Am(t))XE.call(t,n)&&J4(e,n,t[n]);return e},XY=(e,t)=>{var n={};for(var r in e)QE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Am)for(var r of Am(e))t.indexOf(r)<0&&XE.call(e,r)&&(n[r]=e[r]);return n};function YY(e){var t=e,{children:n,component:r="div",maxHeight:o=220,direction:s="column",id:i,innerRef:c,__staticSelector:d,styles:p,classNames:h,unstyled:m}=t,g=XY(t,["children","component","maxHeight","direction","id","innerRef","__staticSelector","styles","classNames","unstyled"]);const{classes:b}=hX(null,{name:d,styles:p,classNames:h,unstyled:m});return z.createElement(Bu.Dropdown,QY({p:0,onMouseDown:y=>y.preventDefault()},g),z.createElement("div",{style:{maxHeight:qe(o),display:"flex"}},z.createElement(Xo,{component:r||"div",id:`${i}-items`,"aria-labelledby":`${i}-label`,role:"listbox",onMouseDown:y=>y.preventDefault(),style:{flex:1,overflowY:r!==t0?"auto":void 0},"data-combobox-popover":!0,tabIndex:-1,ref:c},z.createElement("div",{className:b.itemsWrapper,style:{flexDirection:s}},n))))}function Yi({opened:e,transitionProps:t={transition:"fade",duration:0},shadow:n,withinPortal:r,portalProps:o,children:s,__staticSelector:i,onDirectionChange:c,switchDirectionOnFlip:d,zIndex:p,dropdownPosition:h,positionDependencies:m=[],classNames:g,styles:b,unstyled:y,readOnly:x,variant:w}){return z.createElement(Bu,{unstyled:y,classNames:g,styles:b,width:"target",withRoles:!1,opened:e,middlewares:{flip:h==="flip",shift:!1},position:h==="flip"?"bottom":h,positionDependencies:m,zIndex:p,__staticSelector:i,withinPortal:r,portalProps:o,transitionProps:t,shadow:n,disabled:x,onPositionChange:S=>d&&(c==null?void 0:c(S==="top"?"column-reverse":"column")),variant:w},s)}Yi.Target=Bu.Target;Yi.Dropdown=YY;var JY=Object.defineProperty,ZY=Object.defineProperties,eJ=Object.getOwnPropertyDescriptors,Rm=Object.getOwnPropertySymbols,YE=Object.prototype.hasOwnProperty,JE=Object.prototype.propertyIsEnumerable,Z4=(e,t,n)=>t in e?JY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hh=(e,t)=>{for(var n in t||(t={}))YE.call(t,n)&&Z4(e,n,t[n]);if(Rm)for(var n of Rm(t))JE.call(t,n)&&Z4(e,n,t[n]);return e},tJ=(e,t)=>ZY(e,eJ(t)),nJ=(e,t)=>{var n={};for(var r in e)YE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Rm)for(var r of Rm(e))t.indexOf(r)<0&&JE.call(e,r)&&(n[r]=e[r]);return n};function ZE(e,t,n){const r=zr(e,t,n),{label:o,description:s,error:i,required:c,classNames:d,styles:p,className:h,unstyled:m,__staticSelector:g,sx:b,errorProps:y,labelProps:x,descriptionProps:w,wrapperProps:S,id:j,size:I,style:_,inputContainer:M,inputWrapperOrder:E,withAsterisk:A,variant:R}=r,D=nJ(r,["label","description","error","required","classNames","styles","className","unstyled","__staticSelector","sx","errorProps","labelProps","descriptionProps","wrapperProps","id","size","style","inputContainer","inputWrapperOrder","withAsterisk","variant"]),O=Gy(j),{systemStyles:T,rest:K}=Yg(D),G=hh({label:o,description:s,error:i,required:c,classNames:d,className:h,__staticSelector:g,sx:b,errorProps:y,labelProps:x,descriptionProps:w,unstyled:m,styles:p,id:O,size:I,style:_,inputContainer:M,inputWrapperOrder:E,withAsterisk:A,variant:R},S);return tJ(hh({},K),{classNames:d,styles:p,unstyled:m,wrapperProps:hh(hh({},G),T),inputProps:{required:c,classNames:d,styles:p,unstyled:m,id:O,size:I,__staticSelector:g,error:i,variant:R}})}var rJ=ko((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 oJ=rJ;var sJ=Object.defineProperty,Dm=Object.getOwnPropertySymbols,eM=Object.prototype.hasOwnProperty,tM=Object.prototype.propertyIsEnumerable,ej=(e,t,n)=>t in e?sJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aJ=(e,t)=>{for(var n in t||(t={}))eM.call(t,n)&&ej(e,n,t[n]);if(Dm)for(var n of Dm(t))tM.call(t,n)&&ej(e,n,t[n]);return e},iJ=(e,t)=>{var n={};for(var r in e)eM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Dm)for(var r of Dm(e))t.indexOf(r)<0&&tM.call(e,r)&&(n[r]=e[r]);return n};const lJ={labelElement:"label",size:"sm"},o2=l.forwardRef((e,t)=>{const n=zr("InputLabel",lJ,e),{labelElement:r,children:o,required:s,size:i,classNames:c,styles:d,unstyled:p,className:h,htmlFor:m,__staticSelector:g,variant:b,onMouseDown:y}=n,x=iJ(n,["labelElement","children","required","size","classNames","styles","unstyled","className","htmlFor","__staticSelector","variant","onMouseDown"]),{classes:w,cx:S}=oJ(null,{name:["InputWrapper",g],classNames:c,styles:d,unstyled:p,variant:b,size:i});return z.createElement(Xo,aJ({component:r,ref:t,className:S(w.label,h),htmlFor:r==="label"?m:void 0,onMouseDown:j=>{y==null||y(j),!j.defaultPrevented&&j.detail>1&&j.preventDefault()}},x),o,s&&z.createElement("span",{className:w.required,"aria-hidden":!0}," *"))});o2.displayName="@mantine/core/InputLabel";var cJ=ko((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})} - ${qe(2)})`,lineHeight:1.2,display:"block"}}));const uJ=cJ;var dJ=Object.defineProperty,Tm=Object.getOwnPropertySymbols,nM=Object.prototype.hasOwnProperty,rM=Object.prototype.propertyIsEnumerable,tj=(e,t,n)=>t in e?dJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fJ=(e,t)=>{for(var n in t||(t={}))nM.call(t,n)&&tj(e,n,t[n]);if(Tm)for(var n of Tm(t))rM.call(t,n)&&tj(e,n,t[n]);return e},pJ=(e,t)=>{var n={};for(var r in e)nM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Tm)for(var r of Tm(e))t.indexOf(r)<0&&rM.call(e,r)&&(n[r]=e[r]);return n};const hJ={size:"sm"},s2=l.forwardRef((e,t)=>{const n=zr("InputError",hJ,e),{children:r,className:o,classNames:s,styles:i,unstyled:c,size:d,__staticSelector:p,variant:h}=n,m=pJ(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:b}=uJ(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:c,variant:h,size:d});return z.createElement(xu,fJ({className:b(g.error,o),ref:t},m),r)});s2.displayName="@mantine/core/InputError";var mJ=ko((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})} - ${qe(2)})`,lineHeight:1.2,display:"block"}}));const gJ=mJ;var vJ=Object.defineProperty,Nm=Object.getOwnPropertySymbols,oM=Object.prototype.hasOwnProperty,sM=Object.prototype.propertyIsEnumerable,nj=(e,t,n)=>t in e?vJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bJ=(e,t)=>{for(var n in t||(t={}))oM.call(t,n)&&nj(e,n,t[n]);if(Nm)for(var n of Nm(t))sM.call(t,n)&&nj(e,n,t[n]);return e},xJ=(e,t)=>{var n={};for(var r in e)oM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Nm)for(var r of Nm(e))t.indexOf(r)<0&&sM.call(e,r)&&(n[r]=e[r]);return n};const yJ={size:"sm"},a2=l.forwardRef((e,t)=>{const n=zr("InputDescription",yJ,e),{children:r,className:o,classNames:s,styles:i,unstyled:c,size:d,__staticSelector:p,variant:h}=n,m=xJ(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:b}=gJ(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:c,variant:h,size:d});return z.createElement(xu,bJ({color:"dimmed",className:b(g.description,o),ref:t,unstyled:c},m),r)});a2.displayName="@mantine/core/InputDescription";const aM=l.createContext({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),CJ=aM.Provider,wJ=()=>l.useContext(aM);function SJ(e,{hasDescription:t,hasError:n}){const r=e.findIndex(d=>d==="input"),o=e[r-1],s=e[r+1];return{offsetBottom:t&&s==="description"||n&&s==="error",offsetTop:t&&o==="description"||n&&o==="error"}}var kJ=Object.defineProperty,jJ=Object.defineProperties,_J=Object.getOwnPropertyDescriptors,rj=Object.getOwnPropertySymbols,IJ=Object.prototype.hasOwnProperty,PJ=Object.prototype.propertyIsEnumerable,oj=(e,t,n)=>t in e?kJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,EJ=(e,t)=>{for(var n in t||(t={}))IJ.call(t,n)&&oj(e,n,t[n]);if(rj)for(var n of rj(t))PJ.call(t,n)&&oj(e,n,t[n]);return e},MJ=(e,t)=>jJ(e,_J(t)),OJ=ko(e=>({root:MJ(EJ({},e.fn.fontStyles()),{lineHeight:e.lineHeight})}));const AJ=OJ;var RJ=Object.defineProperty,DJ=Object.defineProperties,TJ=Object.getOwnPropertyDescriptors,$m=Object.getOwnPropertySymbols,iM=Object.prototype.hasOwnProperty,lM=Object.prototype.propertyIsEnumerable,sj=(e,t,n)=>t in e?RJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hi=(e,t)=>{for(var n in t||(t={}))iM.call(t,n)&&sj(e,n,t[n]);if($m)for(var n of $m(t))lM.call(t,n)&&sj(e,n,t[n]);return e},aj=(e,t)=>DJ(e,TJ(t)),NJ=(e,t)=>{var n={};for(var r in e)iM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&$m)for(var r of $m(e))t.indexOf(r)<0&&lM.call(e,r)&&(n[r]=e[r]);return n};const $J={labelElement:"label",size:"sm",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},cM=l.forwardRef((e,t)=>{const n=zr("InputWrapper",$J,e),{className:r,label:o,children:s,required:i,id:c,error:d,description:p,labelElement:h,labelProps:m,descriptionProps:g,errorProps:b,classNames:y,styles:x,size:w,inputContainer:S,__staticSelector:j,unstyled:I,inputWrapperOrder:_,withAsterisk:M,variant:E}=n,A=NJ(n,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","inputContainer","__staticSelector","unstyled","inputWrapperOrder","withAsterisk","variant"]),{classes:R,cx:D}=AJ(null,{classNames:y,styles:x,name:["InputWrapper",j],unstyled:I,variant:E,size:w}),O={classNames:y,styles:x,unstyled:I,size:w,variant:E,__staticSelector:j},T=typeof M=="boolean"?M:i,K=c?`${c}-error`:b==null?void 0:b.id,G=c?`${c}-description`:g==null?void 0:g.id,Z=`${!!d&&typeof d!="boolean"?K:""} ${p?G:""}`,te=Z.trim().length>0?Z.trim():void 0,V=o&&z.createElement(o2,Hi(Hi({key:"label",labelElement:h,id:c?`${c}-label`:void 0,htmlFor:c,required:T},O),m),o),oe=p&&z.createElement(a2,aj(Hi(Hi({key:"description"},g),O),{size:(g==null?void 0:g.size)||O.size,id:(g==null?void 0:g.id)||G}),p),ne=z.createElement(l.Fragment,{key:"input"},S(s)),se=typeof d!="boolean"&&d&&z.createElement(s2,aj(Hi(Hi({},b),O),{size:(b==null?void 0:b.size)||O.size,key:"error",id:(b==null?void 0:b.id)||K}),d),re=_.map(ae=>{switch(ae){case"label":return V;case"input":return ne;case"description":return oe;case"error":return se;default:return null}});return z.createElement(CJ,{value:Hi({describedBy:te},SJ(_,{hasDescription:!!oe,hasError:!!se}))},z.createElement(Xo,Hi({className:D(R.root,r),ref:t},A),re))});cM.displayName="@mantine/core/InputWrapper";var LJ=Object.defineProperty,Lm=Object.getOwnPropertySymbols,uM=Object.prototype.hasOwnProperty,dM=Object.prototype.propertyIsEnumerable,ij=(e,t,n)=>t in e?LJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zJ=(e,t)=>{for(var n in t||(t={}))uM.call(t,n)&&ij(e,n,t[n]);if(Lm)for(var n of Lm(t))dM.call(t,n)&&ij(e,n,t[n]);return e},FJ=(e,t)=>{var n={};for(var r in e)uM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Lm)for(var r of Lm(e))t.indexOf(r)<0&&dM.call(e,r)&&(n[r]=e[r]);return n};const BJ={},fM=l.forwardRef((e,t)=>{const n=zr("InputPlaceholder",BJ,e),{sx:r}=n,o=FJ(n,["sx"]);return z.createElement(Xo,zJ({component:"span",sx:[s=>s.fn.placeholderStyles(),...d6(r)],ref:t},o))});fM.displayName="@mantine/core/InputPlaceholder";var HJ=Object.defineProperty,WJ=Object.defineProperties,VJ=Object.getOwnPropertyDescriptors,lj=Object.getOwnPropertySymbols,UJ=Object.prototype.hasOwnProperty,GJ=Object.prototype.propertyIsEnumerable,cj=(e,t,n)=>t in e?HJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mh=(e,t)=>{for(var n in t||(t={}))UJ.call(t,n)&&cj(e,n,t[n]);if(lj)for(var n of lj(t))GJ.call(t,n)&&cj(e,n,t[n]);return e},b1=(e,t)=>WJ(e,VJ(t));const ks={xs:qe(30),sm:qe(36),md:qe(42),lg:qe(50),xl:qe(60)},qJ=["default","filled","unstyled"];function KJ({theme:e,variant:t}){return qJ.includes(t)?t==="default"?{border:`${qe(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:`${qe(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:qe(28),outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}}:null}var QJ=ko((e,{multiline:t,radius:n,invalid:r,rightSectionWidth:o,withRightSection:s,iconWidth:i,offsetBottom:c,offsetTop:d,pointer:p},{variant:h,size:m})=>{const g=e.fn.variant({variant:"filled",color:"red"}).background,b=h==="default"||h==="filled"?{minHeight:Xt({size:m,sizes:ks}),paddingLeft:`calc(${Xt({size:m,sizes:ks})} / 3)`,paddingRight:s?o||Xt({size:m,sizes:ks}):`calc(${Xt({size:m,sizes:ks})} / 3)`,borderRadius:e.fn.radius(n)}:h==="unstyled"&&s?{paddingRight:o||Xt({size:m,sizes:ks})}:null;return{wrapper:{position:"relative",marginTop:d?`calc(${e.spacing.xs} / 2)`:void 0,marginBottom:c?`calc(${e.spacing.xs} / 2)`:void 0,"&:has(input:disabled)":{"& .mantine-Input-rightSection":{display:"none"}}},input:b1(mh(mh(b1(mh({},e.fn.fontStyles()),{height:t?h==="unstyled"?void 0:"auto":Xt({size:m,sizes:ks}),WebkitTapHighlightColor:"transparent",lineHeight:t?e.lineHeight:`calc(${Xt({size:m,sizes:ks})} - ${qe(2)})`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:Xt({size:m,sizes:e.fontSizes}),width:"100%",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"block",textAlign:"left",cursor:p?"pointer":void 0}),KJ({theme:e,variant:h})),b),{"&:disabled, &[data-disabled]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,cursor:"not-allowed",pointerEvents:"none","&::placeholder":{color:e.colors.dark[2]}},"&[data-invalid]":{color:g,borderColor:g,"&::placeholder":{opacity:1,color:g}},"&[data-with-icon]":{paddingLeft:typeof i=="number"?qe(i):Xt({size:m,sizes:ks})},"&::placeholder":b1(mh({},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?qe(i):Xt({size:m,sizes:ks}),color:r?e.colors.red[e.colorScheme==="dark"?6:7]:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[5]},rightSection:{position:"absolute",top:0,bottom:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:o||Xt({size:m,sizes:ks})}}});const XJ=QJ;var YJ=Object.defineProperty,JJ=Object.defineProperties,ZJ=Object.getOwnPropertyDescriptors,zm=Object.getOwnPropertySymbols,pM=Object.prototype.hasOwnProperty,hM=Object.prototype.propertyIsEnumerable,uj=(e,t,n)=>t in e?YJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gh=(e,t)=>{for(var n in t||(t={}))pM.call(t,n)&&uj(e,n,t[n]);if(zm)for(var n of zm(t))hM.call(t,n)&&uj(e,n,t[n]);return e},dj=(e,t)=>JJ(e,ZJ(t)),eZ=(e,t)=>{var n={};for(var r in e)pM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&zm)for(var r of zm(e))t.indexOf(r)<0&&hM.call(e,r)&&(n[r]=e[r]);return n};const tZ={size:"sm",variant:"default"},sc=l.forwardRef((e,t)=>{const n=zr("Input",tZ,e),{className:r,error:o,required:s,disabled:i,variant:c,icon:d,style:p,rightSectionWidth:h,iconWidth:m,rightSection:g,rightSectionProps:b,radius:y,size:x,wrapperProps:w,classNames:S,styles:j,__staticSelector:I,multiline:_,sx:M,unstyled:E,pointer:A}=n,R=eZ(n,["className","error","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx","unstyled","pointer"]),{offsetBottom:D,offsetTop:O,describedBy:T}=wJ(),{classes:K,cx:G}=XJ({radius:y,multiline:_,invalid:!!o,rightSectionWidth:h?qe(h):void 0,iconWidth:m,withRightSection:!!g,offsetBottom:D,offsetTop:O,pointer:A},{classNames:S,styles:j,name:["Input",I],unstyled:E,variant:c,size:x}),{systemStyles:X,rest:Z}=Yg(R);return z.createElement(Xo,gh(gh({className:G(K.wrapper,r),sx:M,style:p},X),w),d&&z.createElement("div",{className:K.icon},d),z.createElement(Xo,dj(gh({component:"input"},Z),{ref:t,required:s,"aria-invalid":!!o,"aria-describedby":T,disabled:i,"data-disabled":i||void 0,"data-with-icon":!!d||void 0,"data-invalid":!!o||void 0,className:K.input})),g&&z.createElement("div",dj(gh({},b),{className:K.rightSection}),g))});sc.displayName="@mantine/core/Input";sc.Wrapper=cM;sc.Label=o2;sc.Description=a2;sc.Error=s2;sc.Placeholder=fM;const Su=sc;var nZ=Object.defineProperty,Fm=Object.getOwnPropertySymbols,mM=Object.prototype.hasOwnProperty,gM=Object.prototype.propertyIsEnumerable,fj=(e,t,n)=>t in e?nZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pj=(e,t)=>{for(var n in t||(t={}))mM.call(t,n)&&fj(e,n,t[n]);if(Fm)for(var n of Fm(t))gM.call(t,n)&&fj(e,n,t[n]);return e},rZ=(e,t)=>{var n={};for(var r in e)mM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Fm)for(var r of Fm(e))t.indexOf(r)<0&&gM.call(e,r)&&(n[r]=e[r]);return n};const oZ={multiple:!1},vM=l.forwardRef((e,t)=>{const n=zr("FileButton",oZ,e),{onChange:r,children:o,multiple:s,accept:i,name:c,form:d,resetRef:p,disabled:h,capture:m,inputProps:g}=n,b=rZ(n,["onChange","children","multiple","accept","name","form","resetRef","disabled","capture","inputProps"]),y=l.useRef(),x=()=>{!h&&y.current.click()},w=j=>{r(s?Array.from(j.currentTarget.files):j.currentTarget.files[0]||null)};return C6(p,()=>{y.current.value=""}),z.createElement(z.Fragment,null,o(pj({onClick:x},b)),z.createElement("input",pj({style:{display:"none"},type:"file",accept:i,multiple:s,onChange:w,ref:Kf(t,y),name:c,form:d,capture:m},g)))});vM.displayName="@mantine/core/FileButton";const bM={xs:qe(16),sm:qe(22),md:qe(26),lg:qe(30),xl:qe(36)},sZ={xs:qe(10),sm:qe(12),md:qe(14),lg:qe(16),xl:qe(18)};var aZ=ko((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:bM}),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:sZ}),borderRadius:Xt({size:n,sizes:e.radius}),cursor:t?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${qe(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 iZ=aZ;var lZ=Object.defineProperty,Bm=Object.getOwnPropertySymbols,xM=Object.prototype.hasOwnProperty,yM=Object.prototype.propertyIsEnumerable,hj=(e,t,n)=>t in e?lZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cZ=(e,t)=>{for(var n in t||(t={}))xM.call(t,n)&&hj(e,n,t[n]);if(Bm)for(var n of Bm(t))yM.call(t,n)&&hj(e,n,t[n]);return e},uZ=(e,t)=>{var n={};for(var r in e)xM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Bm)for(var r of Bm(e))t.indexOf(r)<0&&yM.call(e,r)&&(n[r]=e[r]);return n};const dZ={xs:16,sm:22,md:24,lg:26,xl:30};function CM(e){var t=e,{label:n,classNames:r,styles:o,className:s,onRemove:i,disabled:c,readOnly:d,size:p,radius:h="sm",variant:m,unstyled:g}=t,b=uZ(t,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:y,cx:x}=iZ({disabled:c,readOnly:d,radius:h},{name:"MultiSelect",classNames:r,styles:o,unstyled:g,size:p,variant:m});return z.createElement("div",cZ({className:x(y.defaultValue,s)},b),z.createElement("span",{className:y.defaultValueLabel},n),!c&&!d&&z.createElement(eE,{"aria-hidden":!0,onMouseDown:i,size:dZ[p],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:y.defaultValueRemove,tabIndex:-1,unstyled:g}))}CM.displayName="@mantine/core/MultiSelect/DefaultValue";function fZ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,disableSelectedItemFiltering:i}){if(!t&&s.length===0)return e;if(!t){const d=[];for(let p=0;ph===e[p].value&&!e[p].disabled))&&d.push(e[p]);return d}const c=[];for(let d=0;dp===e[d].value&&!e[d].disabled),e[d])&&c.push(e[d]),!(c.length>=n));d+=1);return c}var pZ=Object.defineProperty,Hm=Object.getOwnPropertySymbols,wM=Object.prototype.hasOwnProperty,SM=Object.prototype.propertyIsEnumerable,mj=(e,t,n)=>t in e?pZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gj=(e,t)=>{for(var n in t||(t={}))wM.call(t,n)&&mj(e,n,t[n]);if(Hm)for(var n of Hm(t))SM.call(t,n)&&mj(e,n,t[n]);return e},hZ=(e,t)=>{var n={};for(var r in e)wM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Hm)for(var r of Hm(e))t.indexOf(r)<0&&SM.call(e,r)&&(n[r]=e[r]);return n};const mZ={xs:qe(14),sm:qe(18),md:qe(20),lg:qe(24),xl:qe(28)};function gZ(e){var t=e,{size:n,error:r,style:o}=t,s=hZ(t,["size","error","style"]);const i=Ii(),c=Xt({size:n,sizes:mZ});return z.createElement("svg",gj({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:gj({color:r?i.colors.red[6]:i.colors.gray[6],width:c,height:c},o),"data-chevron":!0},s),z.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 vZ=Object.defineProperty,bZ=Object.defineProperties,xZ=Object.getOwnPropertyDescriptors,vj=Object.getOwnPropertySymbols,yZ=Object.prototype.hasOwnProperty,CZ=Object.prototype.propertyIsEnumerable,bj=(e,t,n)=>t in e?vZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wZ=(e,t)=>{for(var n in t||(t={}))yZ.call(t,n)&&bj(e,n,t[n]);if(vj)for(var n of vj(t))CZ.call(t,n)&&bj(e,n,t[n]);return e},SZ=(e,t)=>bZ(e,xZ(t));function kM({shouldClear:e,clearButtonProps:t,onClear:n,size:r,error:o}){return e?z.createElement(eE,SZ(wZ({},t),{variant:"transparent",onClick:n,size:r,onMouseDown:s=>s.preventDefault()})):z.createElement(gZ,{error:o,size:r})}kM.displayName="@mantine/core/SelectRightSection";var kZ=Object.defineProperty,jZ=Object.defineProperties,_Z=Object.getOwnPropertyDescriptors,Wm=Object.getOwnPropertySymbols,jM=Object.prototype.hasOwnProperty,_M=Object.prototype.propertyIsEnumerable,xj=(e,t,n)=>t in e?kZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,x1=(e,t)=>{for(var n in t||(t={}))jM.call(t,n)&&xj(e,n,t[n]);if(Wm)for(var n of Wm(t))_M.call(t,n)&&xj(e,n,t[n]);return e},yj=(e,t)=>jZ(e,_Z(t)),IZ=(e,t)=>{var n={};for(var r in e)jM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Wm)for(var r of Wm(e))t.indexOf(r)<0&&_M.call(e,r)&&(n[r]=e[r]);return n};function IM(e){var t=e,{styles:n,rightSection:r,rightSectionWidth:o,theme:s}=t,i=IZ(t,["styles","rightSection","rightSectionWidth","theme"]);if(r)return{rightSection:r,rightSectionWidth:o,styles:n};const c=typeof n=="function"?n(s):n;return{rightSection:!i.readOnly&&!(i.disabled&&i.shouldClear)&&z.createElement(kM,x1({},i)),styles:yj(x1({},c),{rightSection:yj(x1({},c==null?void 0:c.rightSection),{pointerEvents:i.shouldClear?void 0:"none"})})}}var PZ=Object.defineProperty,EZ=Object.defineProperties,MZ=Object.getOwnPropertyDescriptors,Cj=Object.getOwnPropertySymbols,OZ=Object.prototype.hasOwnProperty,AZ=Object.prototype.propertyIsEnumerable,wj=(e,t,n)=>t in e?PZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,RZ=(e,t)=>{for(var n in t||(t={}))OZ.call(t,n)&&wj(e,n,t[n]);if(Cj)for(var n of Cj(t))AZ.call(t,n)&&wj(e,n,t[n]);return e},DZ=(e,t)=>EZ(e,MZ(t)),TZ=ko((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:ks})} - ${qe(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:Xt({size:n,sizes:ks})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${qe(2)}) calc(${e.spacing.xs} / 2)`},searchInput:DZ(RZ({},e.fn.fontStyles()),{flex:1,minWidth:qe(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:bM}),"&::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 NZ=TZ;var $Z=Object.defineProperty,LZ=Object.defineProperties,zZ=Object.getOwnPropertyDescriptors,Vm=Object.getOwnPropertySymbols,PM=Object.prototype.hasOwnProperty,EM=Object.prototype.propertyIsEnumerable,Sj=(e,t,n)=>t in e?$Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rc=(e,t)=>{for(var n in t||(t={}))PM.call(t,n)&&Sj(e,n,t[n]);if(Vm)for(var n of Vm(t))EM.call(t,n)&&Sj(e,n,t[n]);return e},kj=(e,t)=>LZ(e,zZ(t)),FZ=(e,t)=>{var n={};for(var r in e)PM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Vm)for(var r of Vm(e))t.indexOf(r)<0&&EM.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 HZ(e,t){return!!e&&!t.some(n=>n.value.toLowerCase()===e.toLowerCase())}function jj(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 WZ={size:"sm",valueComponent:CM,itemComponent:Ky,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:HZ,switchDirectionOnFlip:!1,zIndex:Vy("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},MM=l.forwardRef((e,t)=>{const n=zr("MultiSelect",WZ,e),{className:r,style:o,required:s,label:i,description:c,size:d,error:p,classNames:h,styles:m,wrapperProps:g,value:b,defaultValue:y,data:x,onChange:w,valueComponent:S,itemComponent:j,id:I,transitionProps:_,maxDropdownHeight:M,shadow:E,nothingFound:A,onFocus:R,onBlur:D,searchable:O,placeholder:T,filter:K,limit:G,clearSearchOnChange:X,clearable:Z,clearSearchOnBlur:te,variant:V,onSearchChange:oe,searchValue:ne,disabled:se,initiallyOpened:re,radius:ae,icon:B,rightSection:Y,rightSectionWidth:$,creatable:F,getCreateLabel:q,shouldCreate:pe,onCreate:W,sx:U,dropdownComponent:ee,onDropdownClose:J,onDropdownOpen:ge,maxSelectedValues:he,withinPortal:de,portalProps:_e,switchDirectionOnFlip:Pe,zIndex:ze,selectOnBlur:ht,name:Je,dropdownPosition:qt,errorProps:Pt,labelProps:jt,descriptionProps:Se,form:Fe,positionDependencies:it,onKeyDown:At,unstyled:ke,inputContainer:lt,inputWrapperOrder:Rt,readOnly:zt,withAsterisk:Re,clearButtonProps:Qe,hoverOnSearchChange:En,disableSelectedItemFiltering:Te}=n,ct=FZ(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:ft,cx:tt,theme:en}=NZ({invalid:!!p},{name:"MultiSelect",classNames:h,styles:m,unstyled:ke,size:d,variant:V}),{systemStyles:ar,rest:vn}=Yg(ct),dn=l.useRef(),Tr=l.useRef({}),ir=Gy(I),[$n,Jn]=l.useState(re),[Mn,Fr]=l.useState(-1),[co,Nr]=l.useState("column"),[$r,Lo]=cf({value:ne,defaultValue:"",finalValue:void 0,onChange:oe}),[Br,ts]=l.useState(!1),{scrollIntoView:gs,targetRef:Ga,scrollableRef:fa}=S6({duration:0,offset:5,cancelable:!1,isList:!0}),ie=F&&typeof q=="function";let ue=null;const xe=x.map(Ve=>typeof Ve=="string"?{label:Ve,value:Ve}:Ve),Me=f6({data:xe}),[ye,pt]=cf({value:jj(b,x),defaultValue:jj(y,x),finalValue:[],onChange:w}),at=l.useRef(!!he&&he{if(!zt){const Ct=ye.filter(Ft=>Ft!==Ve);pt(Ct),he&&Ct.length{Lo(Ve.currentTarget.value),!se&&!at.current&&O&&Jn(!0)},wt=Ve=>{typeof R=="function"&&R(Ve),!se&&!at.current&&O&&Jn(!0)},Ge=fZ({data:Me,searchable:O,searchValue:$r,limit:G,filter:K,value:ye,disableSelectedItemFiltering:Te});ie&&pe($r,Me)&&(ue=q($r),Ge.push({label:$r,value:$r,creatable:!0}));const Ee=Math.min(Mn,Ge.length-1),et=(Ve,Ct,Ft)=>{let Qt=Ve;for(;Ft(Qt);)if(Qt=Ct(Qt),!Ge[Qt].disabled)return Qt;return Ve};oa(()=>{Fr(En&&$r?0:-1)},[$r,En]),oa(()=>{!se&&ye.length>x.length&&Jn(!1),he&&ye.length=he&&(at.current=!0,Jn(!1))},[ye]);const Et=Ve=>{if(!zt)if(X&&Lo(""),ye.includes(Ve.value))Kt(Ve.value);else{if(Ve.creatable&&typeof W=="function"){const Ct=W(Ve.value);typeof Ct<"u"&&Ct!==null&&pt(typeof Ct=="string"?[...ye,Ct]:[...ye,Ct.value])}else pt([...ye,Ve.value]);ye.length===he-1&&(at.current=!0,Jn(!1)),Ge.length===1&&Jn(!1)}},$t=Ve=>{typeof D=="function"&&D(Ve),ht&&Ge[Ee]&&$n&&Et(Ge[Ee]),te&&Lo(""),Jn(!1)},Ut=Ve=>{if(Br||(At==null||At(Ve),zt)||Ve.key!=="Backspace"&&he&&at.current)return;const Ct=co==="column",Ft=()=>{Fr(Ln=>{var Jt;const yn=et(Ln,hn=>hn+1,hn=>hn{Fr(Ln=>{var Jt;const yn=et(Ln,hn=>hn-1,hn=>hn>0);return $n&&(Ga.current=Tr.current[(Jt=Ge[yn])==null?void 0:Jt.value],gs({alignment:Ct?"start":"end"})),yn})};switch(Ve.key){case"ArrowUp":{Ve.preventDefault(),Jn(!0),Ct?Qt():Ft();break}case"ArrowDown":{Ve.preventDefault(),Jn(!0),Ct?Ft():Qt();break}case"Enter":{Ve.preventDefault(),Ge[Ee]&&$n?Et(Ge[Ee]):Jn(!0);break}case" ":{O||(Ve.preventDefault(),Ge[Ee]&&$n?Et(Ge[Ee]):Jn(!0));break}case"Backspace":{ye.length>0&&$r.length===0&&(pt(ye.slice(0,-1)),Jn(!0),he&&(at.current=!1));break}case"Home":{if(!O){Ve.preventDefault(),$n||Jn(!0);const Ln=Ge.findIndex(Jt=>!Jt.disabled);Fr(Ln),gs({alignment:Ct?"end":"start"})}break}case"End":{if(!O){Ve.preventDefault(),$n||Jn(!0);const Ln=Ge.map(Jt=>!!Jt.disabled).lastIndexOf(!1);Fr(Ln),gs({alignment:Ct?"end":"start"})}break}case"Escape":Jn(!1)}},tn=ye.map(Ve=>{let Ct=Me.find(Ft=>Ft.value===Ve&&!Ft.disabled);return!Ct&&ie&&(Ct={value:Ve,label:Ve}),Ct}).filter(Ve=>!!Ve).map((Ve,Ct)=>z.createElement(S,kj(Rc({},Ve),{variant:V,disabled:se,className:ft.value,readOnly:zt,onRemove:Ft=>{Ft.preventDefault(),Ft.stopPropagation(),Kt(Ve.value)},key:Ve.value,size:d,styles:m,classNames:h,radius:ae,index:Ct}))),ln=Ve=>ye.includes(Ve),an=()=>{var Ve;Lo(""),pt([]),(Ve=dn.current)==null||Ve.focus(),he&&(at.current=!1)},Yt=!zt&&(Ge.length>0?$n:$n&&!!A);return oa(()=>{const Ve=Yt?ge:J;typeof Ve=="function"&&Ve()},[Yt]),z.createElement(Su.Wrapper,Rc(Rc({required:s,id:ir,label:i,error:p,description:c,size:d,className:r,style:o,classNames:h,styles:m,__staticSelector:"MultiSelect",sx:U,errorProps:Pt,descriptionProps:Se,labelProps:jt,inputContainer:lt,inputWrapperOrder:Rt,unstyled:ke,withAsterisk:Re,variant:V},ar),g),z.createElement(Yi,{opened:Yt,transitionProps:_,shadow:"sm",withinPortal:de,portalProps:_e,__staticSelector:"MultiSelect",onDirectionChange:Nr,switchDirectionOnFlip:Pe,zIndex:ze,dropdownPosition:qt,positionDependencies:[...it,$r],classNames:h,styles:m,unstyled:ke,variant:V},z.createElement(Yi.Target,null,z.createElement("div",{className:ft.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":$n&&Yt?`${ir}-items`:null,"aria-controls":ir,"aria-expanded":$n,onMouseLeave:()=>Fr(-1),tabIndex:-1},z.createElement("input",{type:"hidden",name:Je,value:ye.join(","),form:Fe,disabled:se}),z.createElement(Su,Rc({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:d,variant:V,disabled:se,error:p,required:s,radius:ae,icon:B,unstyled:ke,onMouseDown:Ve=>{var Ct;Ve.preventDefault(),!se&&!at.current&&Jn(!$n),(Ct=dn.current)==null||Ct.focus()},classNames:kj(Rc({},h),{input:tt({[ft.input]:!O},h==null?void 0:h.input)})},IM({theme:en,rightSection:Y,rightSectionWidth:$,styles:m,size:d,shouldClear:Z&&ye.length>0,onClear:an,error:p,disabled:se,clearButtonProps:Qe,readOnly:zt})),z.createElement("div",{className:ft.values,"data-clearable":Z||void 0},tn,z.createElement("input",Rc({ref:Kf(t,dn),type:"search",id:ir,className:tt(ft.searchInput,{[ft.searchInputPointer]:!O,[ft.searchInputInputHidden]:!$n&&ye.length>0||!O&&ye.length>0,[ft.searchInputEmpty]:ye.length===0}),onKeyDown:Ut,value:$r,onChange:gt,onFocus:wt,onBlur:$t,readOnly:!O||at.current||zt,placeholder:ye.length===0?T:void 0,disabled:se,"data-mantine-stop-propagation":$n,autoComplete:"off",onCompositionStart:()=>ts(!0),onCompositionEnd:()=>ts(!1)},vn)))))),z.createElement(Yi.Dropdown,{component:ee||t0,maxHeight:M,direction:co,id:ir,innerRef:fa,__staticSelector:"MultiSelect",classNames:h,styles:m},z.createElement(qy,{data:Ge,hovered:Ee,classNames:h,styles:m,uuid:ir,__staticSelector:"MultiSelect",onItemHover:Fr,onItemSelect:Et,itemsRefs:Tr,itemComponent:j,size:d,nothingFound:A,isItemSelected:ln,creatable:F&&!!ue,createLabel:ue,unstyled:ke,variant:V}))))});MM.displayName="@mantine/core/MultiSelect";var VZ=Object.defineProperty,UZ=Object.defineProperties,GZ=Object.getOwnPropertyDescriptors,Um=Object.getOwnPropertySymbols,OM=Object.prototype.hasOwnProperty,AM=Object.prototype.propertyIsEnumerable,_j=(e,t,n)=>t in e?VZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y1=(e,t)=>{for(var n in t||(t={}))OM.call(t,n)&&_j(e,n,t[n]);if(Um)for(var n of Um(t))AM.call(t,n)&&_j(e,n,t[n]);return e},qZ=(e,t)=>UZ(e,GZ(t)),KZ=(e,t)=>{var n={};for(var r in e)OM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Um)for(var r of Um(e))t.indexOf(r)<0&&AM.call(e,r)&&(n[r]=e[r]);return n};const QZ={type:"text",size:"sm",__staticSelector:"TextInput"},RM=l.forwardRef((e,t)=>{const n=ZE("TextInput",QZ,e),{inputProps:r,wrapperProps:o}=n,s=KZ(n,["inputProps","wrapperProps"]);return z.createElement(Su.Wrapper,y1({},o),z.createElement(Su,qZ(y1(y1({},r),s),{ref:t})))});RM.displayName="@mantine/core/TextInput";function XZ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,filterDataOnExactSearchMatch:i}){if(!t)return e;const c=s!=null&&e.find(p=>p.value===s)||null;if(c&&!i&&(c==null?void 0:c.label)===r){if(n){if(n>=e.length)return e;const p=e.indexOf(c),h=p+n,m=h-e.length;return m>0?e.slice(p-m):e.slice(p,h)}return e}const d=[];for(let p=0;p=n));p+=1);return d}var YZ=ko(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}}));const JZ=YZ;var ZZ=Object.defineProperty,eee=Object.defineProperties,tee=Object.getOwnPropertyDescriptors,Gm=Object.getOwnPropertySymbols,DM=Object.prototype.hasOwnProperty,TM=Object.prototype.propertyIsEnumerable,Ij=(e,t,n)=>t in e?ZZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wd=(e,t)=>{for(var n in t||(t={}))DM.call(t,n)&&Ij(e,n,t[n]);if(Gm)for(var n of Gm(t))TM.call(t,n)&&Ij(e,n,t[n]);return e},C1=(e,t)=>eee(e,tee(t)),nee=(e,t)=>{var n={};for(var r in e)DM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Gm)for(var r of Gm(e))t.indexOf(r)<0&&TM.call(e,r)&&(n[r]=e[r]);return n};function ree(e,t){return t.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function oee(e,t){return!!e&&!t.some(n=>n.label.toLowerCase()===e.toLowerCase())}const see={required:!1,size:"sm",shadow:"sm",itemComponent:Ky,transitionProps:{transition:"fade",duration:0},initiallyOpened:!1,filter:ree,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:oee,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:Vy("popover"),positionDependencies:[],dropdownPosition:"flip"},i2=l.forwardRef((e,t)=>{const n=ZE("Select",see,e),{inputProps:r,wrapperProps:o,shadow:s,data:i,value:c,defaultValue:d,onChange:p,itemComponent:h,onKeyDown:m,onBlur:g,onFocus:b,transitionProps:y,initiallyOpened:x,unstyled:w,classNames:S,styles:j,filter:I,maxDropdownHeight:_,searchable:M,clearable:E,nothingFound:A,limit:R,disabled:D,onSearchChange:O,searchValue:T,rightSection:K,rightSectionWidth:G,creatable:X,getCreateLabel:Z,shouldCreate:te,selectOnBlur:V,onCreate:oe,dropdownComponent:ne,onDropdownClose:se,onDropdownOpen:re,withinPortal:ae,portalProps:B,switchDirectionOnFlip:Y,zIndex:$,name:F,dropdownPosition:q,allowDeselect:pe,placeholder:W,filterDataOnExactSearchMatch:U,form:ee,positionDependencies:J,readOnly:ge,clearButtonProps:he,hoverOnSearchChange:de}=n,_e=nee(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:Pe,cx:ze,theme:ht}=JZ(),[Je,qt]=l.useState(x),[Pt,jt]=l.useState(-1),Se=l.useRef(),Fe=l.useRef({}),[it,At]=l.useState("column"),ke=it==="column",{scrollIntoView:lt,targetRef:Rt,scrollableRef:zt}=S6({duration:0,offset:5,cancelable:!1,isList:!0}),Re=pe===void 0?E:pe,Qe=ue=>{if(Je!==ue){qt(ue);const xe=ue?re:se;typeof xe=="function"&&xe()}},En=X&&typeof Z=="function";let Te=null;const ct=i.map(ue=>typeof ue=="string"?{label:ue,value:ue}:ue),ft=f6({data:ct}),[tt,en,ar]=cf({value:c,defaultValue:d,finalValue:null,onChange:p}),vn=ft.find(ue=>ue.value===tt),[dn,Tr]=cf({value:T,defaultValue:(vn==null?void 0:vn.label)||"",finalValue:void 0,onChange:O}),ir=ue=>{Tr(ue),M&&typeof O=="function"&&O(ue)},$n=()=>{var ue;ge||(en(null),ar||ir(""),(ue=Se.current)==null||ue.focus())};l.useEffect(()=>{const ue=ft.find(xe=>xe.value===tt);ue?ir(ue.label):(!En||!tt)&&ir("")},[tt]),l.useEffect(()=>{vn&&(!M||!Je)&&ir(vn.label)},[vn==null?void 0:vn.label]);const Jn=ue=>{if(!ge)if(Re&&(vn==null?void 0:vn.value)===ue.value)en(null),Qe(!1);else{if(ue.creatable&&typeof oe=="function"){const xe=oe(ue.value);typeof xe<"u"&&xe!==null&&en(typeof xe=="string"?xe:xe.value)}else en(ue.value);ar||ir(ue.label),jt(-1),Qe(!1),Se.current.focus()}},Mn=XZ({data:ft,searchable:M,limit:R,searchValue:dn,filter:I,filterDataOnExactSearchMatch:U,value:tt});En&&te(dn,Mn)&&(Te=Z(dn),Mn.push({label:dn,value:dn,creatable:!0}));const Fr=(ue,xe,Me)=>{let ye=ue;for(;Me(ye);)if(ye=xe(ye),!Mn[ye].disabled)return ye;return ue};oa(()=>{jt(de&&dn?0:-1)},[dn,de]);const co=tt?Mn.findIndex(ue=>ue.value===tt):0,Nr=!ge&&(Mn.length>0?Je:Je&&!!A),$r=()=>{jt(ue=>{var xe;const Me=Fr(ue,ye=>ye-1,ye=>ye>0);return Rt.current=Fe.current[(xe=Mn[Me])==null?void 0:xe.value],Nr&<({alignment:ke?"start":"end"}),Me})},Lo=()=>{jt(ue=>{var xe;const Me=Fr(ue,ye=>ye+1,ye=>yewindow.setTimeout(()=>{var ue;Rt.current=Fe.current[(ue=Mn[co])==null?void 0:ue.value],lt({alignment:ke?"end":"start"})},50);oa(()=>{Nr&&Br()},[Nr]);const ts=ue=>{switch(typeof m=="function"&&m(ue),ue.key){case"ArrowUp":{ue.preventDefault(),Je?ke?$r():Lo():(jt(co),Qe(!0),Br());break}case"ArrowDown":{ue.preventDefault(),Je?ke?Lo():$r():(jt(co),Qe(!0),Br());break}case"Home":{if(!M){ue.preventDefault(),Je||Qe(!0);const xe=Mn.findIndex(Me=>!Me.disabled);jt(xe),Nr&<({alignment:ke?"end":"start"})}break}case"End":{if(!M){ue.preventDefault(),Je||Qe(!0);const xe=Mn.map(Me=>!!Me.disabled).lastIndexOf(!1);jt(xe),Nr&<({alignment:ke?"end":"start"})}break}case"Escape":{ue.preventDefault(),Qe(!1),jt(-1);break}case" ":{M||(ue.preventDefault(),Mn[Pt]&&Je?Jn(Mn[Pt]):(Qe(!0),jt(co),Br()));break}case"Enter":M||ue.preventDefault(),Mn[Pt]&&Je&&(ue.preventDefault(),Jn(Mn[Pt]))}},gs=ue=>{typeof g=="function"&&g(ue);const xe=ft.find(Me=>Me.value===tt);V&&Mn[Pt]&&Je&&Jn(Mn[Pt]),ir((xe==null?void 0:xe.label)||""),Qe(!1)},Ga=ue=>{typeof b=="function"&&b(ue),M&&Qe(!0)},fa=ue=>{ge||(ir(ue.currentTarget.value),E&&ue.currentTarget.value===""&&en(null),jt(-1),Qe(!0))},ie=()=>{ge||(Qe(!Je),tt&&!Je&&jt(co))};return z.createElement(Su.Wrapper,C1(wd({},o),{__staticSelector:"Select"}),z.createElement(Yi,{opened:Nr,transitionProps:y,shadow:s,withinPortal:ae,portalProps:B,__staticSelector:"Select",onDirectionChange:At,switchDirectionOnFlip:Y,zIndex:$,dropdownPosition:q,positionDependencies:[...J,dn],classNames:S,styles:j,unstyled:w,variant:r.variant},z.createElement(Yi.Target,null,z.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":Nr?`${r.id}-items`:null,"aria-controls":r.id,"aria-expanded":Nr,onMouseLeave:()=>jt(-1),tabIndex:-1},z.createElement("input",{type:"hidden",name:F,value:tt||"",form:ee,disabled:D}),z.createElement(Su,wd(C1(wd(wd({autoComplete:"off",type:"search"},r),_e),{ref:Kf(t,Se),onKeyDown:ts,__staticSelector:"Select",value:dn,placeholder:W,onChange:fa,"aria-autocomplete":"list","aria-controls":Nr?`${r.id}-items`:null,"aria-activedescendant":Pt>=0?`${r.id}-${Pt}`:null,onMouseDown:ie,onBlur:gs,onFocus:Ga,readOnly:!M||ge,disabled:D,"data-mantine-stop-propagation":Nr,name:null,classNames:C1(wd({},S),{input:ze({[Pe.input]:!M},S==null?void 0:S.input)})}),IM({theme:ht,rightSection:K,rightSectionWidth:G,styles:j,size:r.size,shouldClear:E&&!!vn,onClear:$n,error:o.error,clearButtonProps:he,disabled:D,readOnly:ge}))))),z.createElement(Yi.Dropdown,{component:ne||t0,maxHeight:_,direction:it,id:r.id,innerRef:zt,__staticSelector:"Select",classNames:S,styles:j},z.createElement(qy,{data:Mn,hovered:Pt,classNames:S,styles:j,isItemSelected:ue=>ue===tt,uuid:r.id,__staticSelector:"Select",onItemHover:jt,onItemSelect:Jn,itemsRefs:Fe,itemComponent:h,size:r.size,nothingFound:A,creatable:En&&!!Te,createLabel:Te,"aria-label":o.label,unstyled:w,variant:r.variant}))))});i2.displayName="@mantine/core/Select";const Jf=()=>{const[e,t,n,r,o,s,i,c,d,p,h,m,g,b,y,x,w,S,j,I,_,M,E,A,R,D,O,T,K,G,X,Z,te,V,oe,ne,se,re,ae,B,Y,$,F,q,pe,W,U,ee,J,ge,he,de,_e,Pe,ze,ht,Je,qt,Pt,jt,Se,Fe,it,At,ke,lt,Rt,zt,Re,Qe,En,Te,ct,ft,tt,en]=ea("colors",["base.50","base.100","base.150","base.200","base.250","base.300","base.350","base.400","base.450","base.500","base.550","base.600","base.650","base.700","base.750","base.800","base.850","base.900","base.950","accent.50","accent.100","accent.150","accent.200","accent.250","accent.300","accent.350","accent.400","accent.450","accent.500","accent.550","accent.600","accent.650","accent.700","accent.750","accent.800","accent.850","accent.900","accent.950","baseAlpha.50","baseAlpha.100","baseAlpha.150","baseAlpha.200","baseAlpha.250","baseAlpha.300","baseAlpha.350","baseAlpha.400","baseAlpha.450","baseAlpha.500","baseAlpha.550","baseAlpha.600","baseAlpha.650","baseAlpha.700","baseAlpha.750","baseAlpha.800","baseAlpha.850","baseAlpha.900","baseAlpha.950","accentAlpha.50","accentAlpha.100","accentAlpha.150","accentAlpha.200","accentAlpha.250","accentAlpha.300","accentAlpha.350","accentAlpha.400","accentAlpha.450","accentAlpha.500","accentAlpha.550","accentAlpha.600","accentAlpha.650","accentAlpha.700","accentAlpha.750","accentAlpha.800","accentAlpha.850","accentAlpha.900","accentAlpha.950"]);return{base50:e,base100:t,base150:n,base200:r,base250:o,base300:s,base350:i,base400:c,base450:d,base500:p,base550:h,base600:m,base650:g,base700:b,base750:y,base800:x,base850:w,base900:S,base950:j,accent50:I,accent100:_,accent150:M,accent200:E,accent250:A,accent300:R,accent350:D,accent400:O,accent450:T,accent500:K,accent550:G,accent600:X,accent650:Z,accent700:te,accent750:V,accent800:oe,accent850:ne,accent900:se,accent950:re,baseAlpha50:ae,baseAlpha100:B,baseAlpha150:Y,baseAlpha200:$,baseAlpha250:F,baseAlpha300:q,baseAlpha350:pe,baseAlpha400:W,baseAlpha450:U,baseAlpha500:ee,baseAlpha550:J,baseAlpha600:ge,baseAlpha650:he,baseAlpha700:de,baseAlpha750:_e,baseAlpha800:Pe,baseAlpha850:ze,baseAlpha900:ht,baseAlpha950:Je,accentAlpha50:qt,accentAlpha100:Pt,accentAlpha150:jt,accentAlpha200:Se,accentAlpha250:Fe,accentAlpha300:it,accentAlpha350:At,accentAlpha400:ke,accentAlpha450:lt,accentAlpha500:Rt,accentAlpha550:zt,accentAlpha600:Re,accentAlpha650:Qe,accentAlpha700:En,accentAlpha750:Te,accentAlpha800:ct,accentAlpha850:ft,accentAlpha900:tt,accentAlpha950:en}},Xe=(e,t)=>n=>n==="light"?e:t,NM=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:c,base800:d,base900:p,accent200:h,accent300:m,accent400:g,accent500:b,accent600:y}=Jf(),{colorMode:x}=ji(),[w]=ea("shadows",["dark-lg"]),[S,j,I]=ea("space",[1,2,6]),[_]=ea("radii",["base"]),[M]=ea("lineHeights",["base"]);return l.useCallback(()=>({label:{color:Xe(c,r)(x)},separatorLabel:{color:Xe(s,s)(x),"::after":{borderTopColor:Xe(r,c)(x)}},input:{border:"unset",backgroundColor:Xe(e,p)(x),borderRadius:_,borderStyle:"solid",borderWidth:"2px",borderColor:Xe(n,d)(x),color:Xe(p,t)(x),minHeight:"unset",lineHeight:M,height:"auto",paddingRight:0,paddingLeft:0,paddingInlineStart:j,paddingInlineEnd:I,paddingTop:S,paddingBottom:S,fontWeight:600,"&:hover":{borderColor:Xe(r,i)(x)},"&:focus":{borderColor:Xe(m,y)(x)},"&:is(:focus, :hover)":{borderColor:Xe(o,s)(x)},"&:focus-within":{borderColor:Xe(h,y)(x)},"&[data-disabled]":{backgroundColor:Xe(r,c)(x),color:Xe(i,o)(x),cursor:"not-allowed"}},value:{backgroundColor:Xe(t,p)(x),color:Xe(p,t)(x),button:{color:Xe(p,t)(x)},"&:hover":{backgroundColor:Xe(r,c)(x),cursor:"pointer"}},dropdown:{backgroundColor:Xe(n,d)(x),borderColor:Xe(n,d)(x),boxShadow:w},item:{backgroundColor:Xe(n,d)(x),color:Xe(d,n)(x),padding:6,"&[data-hovered]":{color:Xe(p,t)(x),backgroundColor:Xe(r,c)(x)},"&[data-active]":{backgroundColor:Xe(r,c)(x),"&:hover":{color:Xe(p,t)(x),backgroundColor:Xe(r,c)(x)}},"&[data-selected]":{backgroundColor:Xe(g,y)(x),color:Xe(e,t)(x),fontWeight:600,"&:hover":{backgroundColor:Xe(b,b)(x),color:Xe("white",e)(x)}},"&[data-disabled]":{color:Xe(s,i)(x),cursor:"not-allowed"}},rightSection:{width:32,button:{color:Xe(p,t)(x)}}}),[h,m,g,b,y,t,n,r,o,e,s,i,c,d,p,w,x,M,_,S,j,I])},$M=De((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,onChange:s,label:i,disabled:c,...d}=e,p=le(),[h,m]=l.useState(""),g=l.useCallback(w=>{w.shiftKey&&p(Qo(!0))},[p]),b=l.useCallback(w=>{w.shiftKey||p(Qo(!1))},[p]),y=l.useCallback(w=>{s&&s(w)},[s]),x=NM();return a.jsx(Wn,{label:r,placement:"top",hasArrow:!0,children:a.jsxs(Vn,{ref:t,isDisabled:c,position:"static","data-testid":`select-${i||e.placeholder}`,children:[i&&a.jsx(yr,{children:i}),a.jsx(i2,{ref:o,disabled:c,searchValue:h,onSearchChange:m,onChange:y,onKeyDown:g,onKeyUp:b,searchable:n,maxDropdownHeight:300,styles:x,...d})]})})});$M.displayName="IAIMantineSearchableSelect";const sr=l.memo($M),aee=me([we],({changeBoardModal:e})=>{const{isModalOpen:t,imagesToChange:n}=e;return{isModalOpen:t,imagesToChange:n}},Ie),iee=()=>{const e=le(),[t,n]=l.useState(),{data:r,isFetching:o}=jf(),{imagesToChange:s,isModalOpen:i}=H(aee),[c]=kD(),[d]=jD(),{t:p}=Q(),h=l.useMemo(()=>{const x=[{label:p("boards.uncategorized"),value:"none"}];return(r??[]).forEach(w=>x.push({label:w.board_name,value:w.board_id})),x},[r,p]),m=l.useCallback(()=>{e(Hw()),e(Ax(!1))},[e]),g=l.useCallback(()=>{!s.length||!t||(t==="none"?d({imageDTOs:s}):c({imageDTOs:s,board_id:t}),n(null),e(Hw()))},[c,e,s,d,t]),b=l.useCallback(x=>n(x),[]),y=l.useRef(null);return a.jsx(Wf,{isOpen:i,onClose:m,leastDestructiveRef:y,isCentered:!0,children:a.jsx(Aa,{children:a.jsxs(Vf,{children:[a.jsx(Oa,{fontSize:"lg",fontWeight:"bold",children:p("boards.changeBoard")}),a.jsx(Ra,{children:a.jsxs(N,{sx:{flexDir:"column",gap:4},children:[a.jsxs(je,{children:["Moving ",`${s.length}`," image",`${s.length>1?"s":""}`," to board:"]}),a.jsx(sr,{placeholder:p(o?"boards.loading":"boards.selectBoard"),disabled:o,onChange:b,value:t,data:h})]})}),a.jsxs(pi,{children:[a.jsx(Dt,{ref:y,onClick:m,children:p("boards.cancel")}),a.jsx(Dt,{colorScheme:"accent",onClick:g,ml:3,children:p("boards.move")})]})]})})})},lee=l.memo(iee),LM=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,tooltip:i,helperText:c,...d}=e;return a.jsx(Wn,{label:i,hasArrow:!0,placement:"top",isDisabled:!i,children:a.jsx(Vn,{isDisabled:n,width:r,alignItems:"center",...o,children:a.jsxs(N,{sx:{flexDir:"column",w:"full"},children:[a.jsxs(N,{sx:{alignItems:"center",w:"full"},children:[t&&a.jsx(yr,{my:1,flexGrow:1,sx:{cursor:n?"not-allowed":"pointer",...s==null?void 0:s.sx,pe:4},...s,children:t}),a.jsx(Fy,{...d})]}),c&&a.jsx(WP,{children:a.jsx(je,{variant:"subtext",children:c})})]})})})};LM.displayName="IAISwitch";const _r=l.memo(LM),cee=e=>{const{t}=Q(),{imageUsage:n,topMessage:r=t("gallery.currentlyInUse"),bottomMessage:o=t("gallery.featuresWillReset")}=e;return!n||!ta(n)?null:a.jsxs(a.Fragment,{children:[a.jsx(je,{children:r}),a.jsxs(zf,{sx:{paddingInlineStart:6},children:[n.isInitialImage&&a.jsx(Ps,{children:t("common.img2img")}),n.isCanvasImage&&a.jsx(Ps,{children:t("common.unifiedCanvas")}),n.isControlImage&&a.jsx(Ps,{children:t("common.controlNet")}),n.isNodesImage&&a.jsx(Ps,{children:t("common.nodeEditor")})]}),a.jsx(je,{children:o})]})},zM=l.memo(cee),uee=me([we,_D],(e,t)=>{const{system:n,config:r,deleteImageModal:o}=e,{shouldConfirmOnDelete:s}=n,{canRestoreDeletedImagesFromBin:i}=r,{imagesToDelete:c,isModalOpen:d}=o,p=(c??[]).map(({image_name:m})=>MI(e,m)),h={isInitialImage:ta(p,m=>m.isInitialImage),isCanvasImage:ta(p,m=>m.isCanvasImage),isNodesImage:ta(p,m=>m.isNodesImage),isControlImage:ta(p,m=>m.isControlImage)};return{shouldConfirmOnDelete:s,canRestoreDeletedImagesFromBin:i,imagesToDelete:c,imagesUsage:t,isModalOpen:d,imageUsageSummary:h}},Ie),dee=()=>{const e=le(),{t}=Q(),{shouldConfirmOnDelete:n,canRestoreDeletedImagesFromBin:r,imagesToDelete:o,imagesUsage:s,isModalOpen:i,imageUsageSummary:c}=H(uee),d=l.useCallback(g=>e(OI(!g.target.checked)),[e]),p=l.useCallback(()=>{e(Ww()),e(ID(!1))},[e]),h=l.useCallback(()=>{!o.length||!s.length||(e(Ww()),e(PD({imageDTOs:o,imagesUsage:s})))},[e,o,s]),m=l.useRef(null);return a.jsx(Wf,{isOpen:i,onClose:p,leastDestructiveRef:m,isCentered:!0,children:a.jsx(Aa,{children:a.jsxs(Vf,{children:[a.jsx(Oa,{fontSize:"lg",fontWeight:"bold",children:t("gallery.deleteImage")}),a.jsx(Ra,{children:a.jsxs(N,{direction:"column",gap:3,children:[a.jsx(zM,{imageUsage:c}),a.jsx(io,{}),a.jsx(je,{children:t(r?"gallery.deleteImageBin":"gallery.deleteImagePermanent")}),a.jsx(je,{children:t("common.areYouSure")}),a.jsx(_r,{label:t("common.dontAskMeAgain"),isChecked:!n,onChange:d})]})}),a.jsxs(pi,{children:[a.jsx(Dt,{ref:m,onClick:p,children:"Cancel"}),a.jsx(Dt,{colorScheme:"error",onClick:h,ml:3,children:"Delete"})]})]})})})},fee=l.memo(dee),FM=De((e,t)=>{const{role:n,tooltip:r="",tooltipProps:o,isChecked:s,...i}=e;return a.jsx(Wn,{label:r,hasArrow:!0,...o,...o!=null&&o.placement?{placement:o.placement}:{placement:"top"},children:a.jsx(Ia,{ref:t,role:n,colorScheme:s?"accent":"base","data-testid":r,...i})})});FM.displayName="IAIIconButton";const rt=l.memo(FM);var BM={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Pj=z.createContext&&z.createContext(BM),Ji=globalThis&&globalThis.__assign||function(){return Ji=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const t=H(i=>i.config.disabledTabs),n=H(i=>i.config.disabledFeatures),r=H(i=>i.config.disabledSDFeatures),o=l.useMemo(()=>n.includes(e)||r.includes(e)||t.includes(e),[n,r,t,e]),s=l.useMemo(()=>!(n.includes(e)||r.includes(e)||t.includes(e)),[n,r,t,e]);return{isFeatureDisabled:o,isFeatureEnabled:s}};function ete(e){const{title:t,hotkey:n,description:r}=e;return a.jsxs(rl,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs(rl,{children:[a.jsx(je,{fontWeight:600,children:t}),r&&a.jsx(je,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),a.jsx(Le,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function tte({children:e}){const{isOpen:t,onOpen:n,onClose:r}=hs(),{t:o}=Q(),s=[{title:o("hotkeys.invoke.title"),desc:o("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:o("hotkeys.cancel.title"),desc:o("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:o("hotkeys.focusPrompt.title"),desc:o("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:o("hotkeys.toggleOptions.title"),desc:o("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:o("hotkeys.toggleGallery.title"),desc:o("hotkeys.toggleGallery.desc"),hotkey:"G"},{title:o("hotkeys.maximizeWorkSpace.title"),desc:o("hotkeys.maximizeWorkSpace.desc"),hotkey:"F"},{title:o("hotkeys.changeTabs.title"),desc:o("hotkeys.changeTabs.desc"),hotkey:"1-5"}],i=[{title:o("hotkeys.setPrompt.title"),desc:o("hotkeys.setPrompt.desc"),hotkey:"P"},{title:o("hotkeys.setSeed.title"),desc:o("hotkeys.setSeed.desc"),hotkey:"S"},{title:o("hotkeys.setParameters.title"),desc:o("hotkeys.setParameters.desc"),hotkey:"A"},{title:o("hotkeys.upscale.title"),desc:o("hotkeys.upscale.desc"),hotkey:"Shift+U"},{title:o("hotkeys.showInfo.title"),desc:o("hotkeys.showInfo.desc"),hotkey:"I"},{title:o("hotkeys.sendToImageToImage.title"),desc:o("hotkeys.sendToImageToImage.desc"),hotkey:"Shift+I"},{title:o("hotkeys.deleteImage.title"),desc:o("hotkeys.deleteImage.desc"),hotkey:"Del"},{title:o("hotkeys.closePanels.title"),desc:o("hotkeys.closePanels.desc"),hotkey:"Esc"}],c=[{title:o("hotkeys.previousImage.title"),desc:o("hotkeys.previousImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextImage.title"),desc:o("hotkeys.nextImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.increaseGalleryThumbSize.title"),desc:o("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys.decreaseGalleryThumbSize.title"),desc:o("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],d=[{title:o("hotkeys.selectBrush.title"),desc:o("hotkeys.selectBrush.desc"),hotkey:"B"},{title:o("hotkeys.selectEraser.title"),desc:o("hotkeys.selectEraser.desc"),hotkey:"E"},{title:o("hotkeys.decreaseBrushSize.title"),desc:o("hotkeys.decreaseBrushSize.desc"),hotkey:"["},{title:o("hotkeys.increaseBrushSize.title"),desc:o("hotkeys.increaseBrushSize.desc"),hotkey:"]"},{title:o("hotkeys.decreaseBrushOpacity.title"),desc:o("hotkeys.decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:o("hotkeys.increaseBrushOpacity.title"),desc:o("hotkeys.increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:o("hotkeys.moveTool.title"),desc:o("hotkeys.moveTool.desc"),hotkey:"V"},{title:o("hotkeys.fillBoundingBox.title"),desc:o("hotkeys.fillBoundingBox.desc"),hotkey:"Shift + F"},{title:o("hotkeys.eraseBoundingBox.title"),desc:o("hotkeys.eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:o("hotkeys.colorPicker.title"),desc:o("hotkeys.colorPicker.desc"),hotkey:"C"},{title:o("hotkeys.toggleSnap.title"),desc:o("hotkeys.toggleSnap.desc"),hotkey:"N"},{title:o("hotkeys.quickToggleMove.title"),desc:o("hotkeys.quickToggleMove.desc"),hotkey:"Hold Space"},{title:o("hotkeys.toggleLayer.title"),desc:o("hotkeys.toggleLayer.desc"),hotkey:"Q"},{title:o("hotkeys.clearMask.title"),desc:o("hotkeys.clearMask.desc"),hotkey:"Shift+C"},{title:o("hotkeys.hideMask.title"),desc:o("hotkeys.hideMask.desc"),hotkey:"H"},{title:o("hotkeys.showHideBoundingBox.title"),desc:o("hotkeys.showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:o("hotkeys.mergeVisible.title"),desc:o("hotkeys.mergeVisible.desc"),hotkey:"Shift+M"},{title:o("hotkeys.saveToGallery.title"),desc:o("hotkeys.saveToGallery.desc"),hotkey:"Shift+S"},{title:o("hotkeys.copyToClipboard.title"),desc:o("hotkeys.copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:o("hotkeys.downloadImage.title"),desc:o("hotkeys.downloadImage.desc"),hotkey:"Shift+D"},{title:o("hotkeys.undoStroke.title"),desc:o("hotkeys.undoStroke.desc"),hotkey:"Ctrl+Z"},{title:o("hotkeys.redoStroke.title"),desc:o("hotkeys.redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:o("hotkeys.resetView.title"),desc:o("hotkeys.resetView.desc"),hotkey:"R"},{title:o("hotkeys.previousStagingImage.title"),desc:o("hotkeys.previousStagingImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextStagingImage.title"),desc:o("hotkeys.nextStagingImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.acceptStagingImage.title"),desc:o("hotkeys.acceptStagingImage.desc"),hotkey:"Enter"}],p=[{title:o("hotkeys.addNodes.title"),desc:o("hotkeys.addNodes.desc"),hotkey:"Shift + A / Space"}],h=m=>a.jsx(N,{flexDir:"column",gap:4,children:m.map((g,b)=>a.jsxs(N,{flexDir:"column",px:2,gap:4,children:[a.jsx(ete,{title:g.title,description:g.desc,hotkey:g.hotkey}),b{const{data:t}=ED(),n=l.useRef(null),r=rO(n);return a.jsxs(N,{alignItems:"center",gap:5,ps:1,ref:n,children:[a.jsx(_i,{src:Rx,alt:"invoke-ai-logo",sx:{w:"32px",h:"32px",minW:"32px",minH:"32px",userSelect:"none"}}),a.jsxs(N,{sx:{gap:3,alignItems:"center"},children:[a.jsxs(je,{sx:{fontSize:"xl",userSelect:"none"},children:["invoke ",a.jsx("strong",{children:"ai"})]}),a.jsx(So,{children:e&&r&&t&&a.jsx(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(je,{sx:{fontWeight:600,marginTop:1,color:"base.300",fontSize:14},variant:"subtext",children:t.version})},"statusText")})]})]})},cte=l.memo(lte),oO=De((e,t)=>{const{tooltip:n,inputRef:r,label:o,disabled:s,required:i,...c}=e,d=NM();return a.jsx(Wn,{label:n,placement:"top",hasArrow:!0,children:a.jsxs(Vn,{ref:t,isRequired:i,isDisabled:s,position:"static","data-testid":`select-${o||e.placeholder}`,children:[a.jsx(yr,{children:o}),a.jsx(i2,{disabled:s,ref:r,styles:d,...c})]})})});oO.displayName="IAIMantineSelect";const Dr=l.memo(oO),ute={ar:fn.t("common.langArabic",{lng:"ar"}),nl:fn.t("common.langDutch",{lng:"nl"}),en:fn.t("common.langEnglish",{lng:"en"}),fr:fn.t("common.langFrench",{lng:"fr"}),de:fn.t("common.langGerman",{lng:"de"}),he:fn.t("common.langHebrew",{lng:"he"}),it:fn.t("common.langItalian",{lng:"it"}),ja:fn.t("common.langJapanese",{lng:"ja"}),ko:fn.t("common.langKorean",{lng:"ko"}),pl:fn.t("common.langPolish",{lng:"pl"}),pt_BR:fn.t("common.langBrPortuguese",{lng:"pt_BR"}),pt:fn.t("common.langPortuguese",{lng:"pt"}),ru:fn.t("common.langRussian",{lng:"ru"}),zh_CN:fn.t("common.langSimplifiedChinese",{lng:"zh_CN"}),es:fn.t("common.langSpanish",{lng:"es"}),uk:fn.t("common.langUkranian",{lng:"ua"})},dte={CONNECTED:"common.statusConnected",DISCONNECTED:"common.statusDisconnected",PROCESSING:"common.statusProcessing",ERROR:"common.statusError",LOADING_MODEL:"common.statusLoadingModel"},sO=me(we,({system:e})=>e.language,Ie);function Xs(e){const{t}=Q(),{label:n,textProps:r,useBadge:o=!1,badgeLabel:s=t("settings.experimental"),badgeProps:i,...c}=e;return a.jsxs(N,{justifyContent:"space-between",py:1,children:[a.jsxs(N,{gap:2,alignItems:"center",children:[a.jsx(je,{sx:{fontSize:14,_dark:{color:"base.300"}},...r,children:n}),o&&a.jsx(Va,{size:"xs",sx:{px:2,color:"base.700",bg:"accent.200",_dark:{bg:"accent.500",color:"base.200"}},...i,children:s})]}),a.jsx(_r,{...c})]})}const fte=e=>a.jsx(N,{sx:{flexDirection:"column",gap:2,p:4,borderRadius:"base",bg:"base.100",_dark:{bg:"base.900"}},children:e.children}),Bc=l.memo(fte);function pte(){const{t:e}=Q(),t=le(),{data:n}=MD(void 0,{refetchOnMountOrArgChange:!0}),[r,{isLoading:o}]=OD(),{data:s}=Ha(),i=s&&(s.queue.in_progress>0||s.queue.pending>0),c=l.useCallback(()=>{i||r().unwrap().then(d=>{t(AI()),t(RI()),t(Ht({title:e("settings.intermediatesCleared",{count:d}),status:"info"}))}).catch(()=>{t(Ht({title:e("settings.intermediatesClearedFailed"),status:"error"}))})},[e,r,t,i]);return a.jsxs(Bc,{children:[a.jsx(yo,{size:"sm",children:e("settings.clearIntermediates")}),a.jsx(Dt,{tooltip:i?e("settings.clearIntermediatesDisabled"):void 0,colorScheme:"warning",onClick:c,isLoading:o,isDisabled:!n||i,children:e("settings.clearIntermediatesWithCount",{count:n??0})}),a.jsx(je,{fontWeight:"bold",children:e("settings.clearIntermediatesDesc1")}),a.jsx(je,{variant:"subtext",children:e("settings.clearIntermediatesDesc2")}),a.jsx(je,{variant:"subtext",children:e("settings.clearIntermediatesDesc3")})]})}const hte=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:c,base800:d,base900:p,accent200:h,accent300:m,accent400:g,accent500:b,accent600:y}=Jf(),{colorMode:x}=ji(),[w]=ea("shadows",["dark-lg"]);return l.useCallback(()=>({label:{color:Xe(c,r)(x)},separatorLabel:{color:Xe(s,s)(x),"::after":{borderTopColor:Xe(r,c)(x)}},searchInput:{":placeholder":{color:Xe(r,c)(x)}},input:{backgroundColor:Xe(e,p)(x),borderWidth:"2px",borderColor:Xe(n,d)(x),color:Xe(p,t)(x),paddingRight:24,fontWeight:600,"&:hover":{borderColor:Xe(r,i)(x)},"&:focus":{borderColor:Xe(m,y)(x)},"&:is(:focus, :hover)":{borderColor:Xe(o,s)(x)},"&:focus-within":{borderColor:Xe(h,y)(x)},"&[data-disabled]":{backgroundColor:Xe(r,c)(x),color:Xe(i,o)(x),cursor:"not-allowed"}},value:{backgroundColor:Xe(n,d)(x),color:Xe(p,t)(x),button:{color:Xe(p,t)(x)},"&:hover":{backgroundColor:Xe(r,c)(x),cursor:"pointer"}},dropdown:{backgroundColor:Xe(n,d)(x),borderColor:Xe(n,d)(x),boxShadow:w},item:{backgroundColor:Xe(n,d)(x),color:Xe(d,n)(x),padding:6,"&[data-hovered]":{color:Xe(p,t)(x),backgroundColor:Xe(r,c)(x)},"&[data-active]":{backgroundColor:Xe(r,c)(x),"&:hover":{color:Xe(p,t)(x),backgroundColor:Xe(r,c)(x)}},"&[data-selected]":{backgroundColor:Xe(g,y)(x),color:Xe(e,t)(x),fontWeight:600,"&:hover":{backgroundColor:Xe(b,b)(x),color:Xe("white",e)(x)}},"&[data-disabled]":{color:Xe(s,i)(x),cursor:"not-allowed"}},rightSection:{width:24,padding:20,button:{color:Xe(p,t)(x)}}}),[h,m,g,b,y,t,n,r,o,e,s,i,c,d,p,w,x])},aO=De((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,label:s,disabled:i,...c}=e,d=le(),p=l.useCallback(g=>{g.shiftKey&&d(Qo(!0))},[d]),h=l.useCallback(g=>{g.shiftKey||d(Qo(!1))},[d]),m=hte();return a.jsx(Wn,{label:r,placement:"top",hasArrow:!0,isOpen:!0,children:a.jsxs(Vn,{ref:t,isDisabled:i,position:"static",children:[s&&a.jsx(yr,{children:s}),a.jsx(MM,{ref:o,disabled:i,onKeyDown:p,onKeyUp:h,searchable:n,maxDropdownHeight:300,styles:m,...c})]})})});aO.displayName="IAIMantineMultiSelect";const mte=l.memo(aO),gte=To(hg,(e,t)=>({value:t,label:e})).sort((e,t)=>e.label.localeCompare(t.label));function vte(){const e=le(),{t}=Q(),n=H(o=>o.ui.favoriteSchedulers),r=l.useCallback(o=>{e(AD(o))},[e]);return a.jsx(mte,{label:t("settings.favoriteSchedulers"),value:n,data:gte,onChange:r,clearable:!0,searchable:!0,maxSelectedValues:99,placeholder:t("settings.favoriteSchedulersPlaceholder")})}const bte=me([we],({system:e,ui:t})=>{const{shouldConfirmOnDelete:n,enableImageDebugging:r,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:c,shouldUseWatermarker:d,shouldEnableInformationalPopovers:p}=e,{shouldUseSliders:h,shouldShowProgressInViewer:m,shouldAutoChangeDimensions:g}=t;return{shouldConfirmOnDelete:n,enableImageDebugging:r,shouldUseSliders:h,shouldShowProgressInViewer:m,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:c,shouldUseWatermarker:d,shouldAutoChangeDimensions:g,shouldEnableInformationalPopovers:p}},{memoizeOptions:{resultEqualityCheck:Nn}}),xte=({children:e,config:t})=>{const n=le(),{t:r}=Q(),[o,s]=l.useState(3),i=(t==null?void 0:t.shouldShowDeveloperSettings)??!0,c=(t==null?void 0:t.shouldShowResetWebUiText)??!0,d=(t==null?void 0:t.shouldShowClearIntermediates)??!0,p=(t==null?void 0:t.shouldShowLocalizationToggle)??!0;l.useEffect(()=>{i||n(Vw(!1))},[i,n]);const{isNSFWCheckerAvailable:h,isWatermarkerAvailable:m}=DI(void 0,{selectFromResult:({data:U})=>({isNSFWCheckerAvailable:(U==null?void 0:U.nsfw_methods.includes("nsfw_checker"))??!1,isWatermarkerAvailable:(U==null?void 0:U.watermarking_methods.includes("invisible_watermark"))??!1})}),{isOpen:g,onOpen:b,onClose:y}=hs(),{isOpen:x,onOpen:w,onClose:S}=hs(),{shouldConfirmOnDelete:j,enableImageDebugging:I,shouldUseSliders:_,shouldShowProgressInViewer:M,consoleLogLevel:E,shouldLogToConsole:A,shouldAntialiasProgressImage:R,shouldUseNSFWChecker:D,shouldUseWatermarker:O,shouldAutoChangeDimensions:T,shouldEnableInformationalPopovers:K}=H(bte),G=l.useCallback(()=>{Object.keys(window.localStorage).forEach(U=>{(RD.includes(U)||U.startsWith(DD))&&localStorage.removeItem(U)}),y(),w(),setInterval(()=>s(U=>U-1),1e3)},[y,w]);l.useEffect(()=>{o<=0&&window.location.reload()},[o]);const X=l.useCallback(U=>{n(TD(U))},[n]),Z=l.useCallback(U=>{n(ND(U))},[n]),te=l.useCallback(U=>{n(Vw(U.target.checked))},[n]),{colorMode:V,toggleColorMode:oe}=ji(),ne=Pn("localization").isFeatureEnabled,se=H(sO),re=l.useCallback(U=>{n(OI(U.target.checked))},[n]),ae=l.useCallback(U=>{n($D(U.target.checked))},[n]),B=l.useCallback(U=>{n(LD(U.target.checked))},[n]),Y=l.useCallback(U=>{n(zD(U.target.checked))},[n]),$=l.useCallback(U=>{n(TI(U.target.checked))},[n]),F=l.useCallback(U=>{n(FD(U.target.checked))},[n]),q=l.useCallback(U=>{n(BD(U.target.checked))},[n]),pe=l.useCallback(U=>{n(HD(U.target.checked))},[n]),W=l.useCallback(U=>{n(WD(U.target.checked))},[n]);return a.jsxs(a.Fragment,{children:[l.cloneElement(e,{onClick:b}),a.jsxs(vu,{isOpen:g,onClose:y,size:"2xl",isCentered:!0,children:[a.jsx(Aa,{}),a.jsxs(bu,{children:[a.jsx(Oa,{bg:"none",children:r("common.settingsLabel")}),a.jsx(Rg,{}),a.jsx(Ra,{children:a.jsxs(N,{sx:{gap:4,flexDirection:"column"},children:[a.jsxs(Bc,{children:[a.jsx(yo,{size:"sm",children:r("settings.general")}),a.jsx(Xs,{label:r("settings.confirmOnDelete"),isChecked:j,onChange:re})]}),a.jsxs(Bc,{children:[a.jsx(yo,{size:"sm",children:r("settings.generation")}),a.jsx(vte,{}),a.jsx(Xs,{label:r("settings.enableNSFWChecker"),isDisabled:!h,isChecked:D,onChange:ae}),a.jsx(Xs,{label:r("settings.enableInvisibleWatermark"),isDisabled:!m,isChecked:O,onChange:B})]}),a.jsxs(Bc,{children:[a.jsx(yo,{size:"sm",children:r("settings.ui")}),a.jsx(Xs,{label:r("common.darkMode"),isChecked:V==="dark",onChange:oe}),a.jsx(Xs,{label:r("settings.useSlidersForAll"),isChecked:_,onChange:Y}),a.jsx(Xs,{label:r("settings.showProgressInViewer"),isChecked:M,onChange:$}),a.jsx(Xs,{label:r("settings.antialiasProgressImages"),isChecked:R,onChange:F}),a.jsx(Xs,{label:r("settings.autoChangeDimensions"),isChecked:T,onChange:q}),p&&a.jsx(Dr,{disabled:!ne,label:r("common.languagePickerLabel"),value:se,data:Object.entries(ute).map(([U,ee])=>({value:U,label:ee})),onChange:Z}),a.jsx(Xs,{label:r("settings.enableInformationalPopovers"),isChecked:K,onChange:pe})]}),i&&a.jsxs(Bc,{children:[a.jsx(yo,{size:"sm",children:r("settings.developer")}),a.jsx(Xs,{label:r("settings.shouldLogToConsole"),isChecked:A,onChange:te}),a.jsx(Dr,{disabled:!A,label:r("settings.consoleLogLevel"),onChange:X,value:E,data:VD.concat()}),a.jsx(Xs,{label:r("settings.enableImageDebugging"),isChecked:I,onChange:W})]}),d&&a.jsx(pte,{}),a.jsxs(Bc,{children:[a.jsx(yo,{size:"sm",children:r("settings.resetWebUI")}),a.jsx(Dt,{colorScheme:"error",onClick:G,children:r("settings.resetWebUI")}),c&&a.jsxs(a.Fragment,{children:[a.jsx(je,{variant:"subtext",children:r("settings.resetWebUIDesc1")}),a.jsx(je,{variant:"subtext",children:r("settings.resetWebUIDesc2")})]})]})]})}),a.jsx(pi,{children:a.jsx(Dt,{onClick:y,children:r("common.close")})})]})]}),a.jsxs(vu,{closeOnOverlayClick:!1,isOpen:x,onClose:S,isCentered:!0,closeOnEsc:!1,children:[a.jsx(Aa,{backdropFilter:"blur(40px)"}),a.jsxs(bu,{children:[a.jsx(Oa,{}),a.jsx(Ra,{children:a.jsx(N,{justifyContent:"center",children:a.jsx(je,{fontSize:"lg",children:a.jsxs(je,{children:[r("settings.resetComplete")," Reloading in ",o,"..."]})})})}),a.jsx(pi,{})]})]})]})},yte=l.memo(xte),Cte=me(we,({system:e})=>{const{isConnected:t,status:n}=e;return{isConnected:t,statusTranslationKey:dte[n]}},Ie),Aj={ok:"green.400",working:"yellow.400",error:"red.400"},Rj={ok:"green.600",working:"yellow.500",error:"red.500"},wte=()=>{const{isConnected:e,statusTranslationKey:t}=H(Cte),{t:n}=Q(),r=l.useRef(null),{data:o}=Ha(),s=l.useMemo(()=>e?o!=null&&o.queue.in_progress?"working":"ok":"error",[o==null?void 0:o.queue.in_progress,e]),i=rO(r);return a.jsxs(N,{ref:r,h:"full",px:2,alignItems:"center",gap:5,children:[a.jsx(So,{children:i&&a.jsx(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(je,{sx:{fontSize:"sm",fontWeight:"600",pb:"1px",userSelect:"none",color:Rj[s],_dark:{color:Aj[s]}},children:n(t)})},"statusText")}),a.jsx(Gr,{as:jee,sx:{boxSize:"0.5rem",color:Rj[s],_dark:{color:Aj[s]}}})]})},Ste=l.memo(wte),kte=()=>{const{t:e}=Q(),t=Pn("bugLink").isFeatureEnabled,n=Pn("discordLink").isFeatureEnabled,r=Pn("githubLink").isFeatureEnabled,o="http://github.com/invoke-ai/InvokeAI",s="https://discord.gg/ZmtBAhwWhy";return a.jsxs(N,{sx:{gap:2,alignItems:"center"},children:[a.jsx(cte,{}),a.jsx(Pi,{}),a.jsx(Ste,{}),a.jsxs(Mg,{children:[a.jsx(Og,{as:rt,variant:"link","aria-label":e("accessibility.menu"),icon:a.jsx(See,{}),sx:{boxSize:8}}),a.jsxs(ql,{motionProps:fu,children:[a.jsxs(af,{title:e("common.communityLabel"),children:[r&&a.jsx(Kn,{as:"a",href:o,target:"_blank",icon:a.jsx(gee,{}),children:e("common.githubLabel")}),t&&a.jsx(Kn,{as:"a",href:`${o}/issues`,target:"_blank",icon:a.jsx(kee,{}),children:e("common.reportBugLabel")}),n&&a.jsx(Kn,{as:"a",href:s,target:"_blank",icon:a.jsx(mee,{}),children:e("common.discordLabel")})]}),a.jsxs(af,{title:e("common.settingsLabel"),children:[a.jsx(tte,{children:a.jsx(Kn,{as:"button",icon:a.jsx(zee,{}),children:e("common.hotkeysLabel")})}),a.jsx(yte,{children:a.jsx(Kn,{as:"button",icon:a.jsx(GM,{}),children:e("common.settingsLabel")})})]})]})]})]})},jte=l.memo(kte);/*! * OverlayScrollbars * Version: 2.4.4 * * Copyright (c) Rene Haas | KingSora. * https://github.com/KingSora * * Released under the MIT license. */const Js=(e,t)=>{const{o:n,u:r,_:o}=e;let s=n,i;const c=(h,m)=>{const g=s,b=h,y=m||(r?!r(g,b):g!==b);return(y||o)&&(s=b,i=g),[s,y,i]};return[t?h=>c(t(s,i),h):c,h=>[s,!!h,i]]},c2=typeof window<"u",iO=c2&&Node.ELEMENT_NODE,{toString:_te,hasOwnProperty:w1}=Object.prototype,Ite=/^\[object (.+)\]$/,fl=e=>e===void 0,l0=e=>e===null,Pte=e=>fl(e)||l0(e)?`${e}`:_te.call(e).replace(Ite,"$1").toLowerCase(),Ea=e=>typeof e=="number",Zf=e=>typeof e=="string",lO=e=>typeof e=="boolean",Ta=e=>typeof e=="function",$s=e=>Array.isArray(e),df=e=>typeof e=="object"&&!$s(e)&&!l0(e),c0=e=>{const t=!!e&&e.length,n=Ea(t)&&t>-1&&t%1==0;return $s(e)||!Ta(e)&&n?t>0&&df(e)?t-1 in e:!0:!1},qm=e=>{if(!e||!df(e)||Pte(e)!=="object")return!1;let t;const n="constructor",r=e[n],o=r&&r.prototype,s=w1.call(e,n),i=o&&w1.call(o,"isPrototypeOf");if(r&&!s&&!i)return!1;for(t in e);return fl(t)||w1.call(e,t)},Wd=e=>{const t=HTMLElement;return e?t?e instanceof t:e.nodeType===iO:!1},u0=e=>{const t=Element;return e?t?e instanceof t:e.nodeType===iO:!1};function Xn(e,t){if(c0(e))for(let n=0;nt(e[n],n,e));return e}const d0=(e,t)=>e.indexOf(t)>=0,Qi=(e,t)=>e.concat(t),Qn=(e,t,n)=>(!n&&!Zf(t)&&c0(t)?Array.prototype.push.apply(e,t):e.push(t),e),Vu=e=>{const t=Array.from,n=[];return t&&e?t(e):(e instanceof Set?e.forEach(r=>{Qn(n,r)}):Xn(e,r=>{Qn(n,r)}),n)},Km=e=>!!e&&!e.length,Dj=e=>Vu(new Set(e)),Ls=(e,t,n)=>{Xn(e,o=>o&&o.apply(void 0,t||[])),!n&&(e.length=0)},f0=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),gi=e=>e?Object.keys(e):[],Bn=(e,t,n,r,o,s,i)=>{const c=[t,n,r,o,s,i];return(typeof e!="object"||l0(e))&&!Ta(e)&&(e={}),Xn(c,d=>{Xn(d,(p,h)=>{const m=d[h];if(e===m)return!0;const g=$s(m);if(m&&qm(m)){const b=e[h];let y=b;g&&!$s(b)?y=[]:!g&&!qm(b)&&(y={}),e[h]=Bn(y,m)}else e[h]=g?m.slice():m})}),e},cO=(e,t)=>Xn(Bn({},e),(n,r,o)=>{n===void 0?delete o[r]:t&&n&&qm(n)&&(o[r]=cO(n,t))}),u2=e=>{for(const t in e)return!1;return!0},Mo=(e,t,n)=>{if(fl(n))return e?e.getAttribute(t):null;e&&e.setAttribute(t,n)},uO=(e,t)=>new Set((Mo(e,t)||"").split(" ")),Wo=(e,t)=>{e&&e.removeAttribute(t)},zl=(e,t,n,r)=>{if(n){const o=uO(e,t);o[r?"add":"delete"](n);const s=Vu(o).join(" ").trim();Mo(e,t,s)}},Ete=(e,t,n)=>uO(e,t).has(n),Xb=c2&&Element.prototype,dO=(e,t)=>{const n=[],r=t?u0(t)&&t:document;return r?Qn(n,r.querySelectorAll(e)):n},Mte=(e,t)=>{const n=t?u0(t)&&t:document;return n?n.querySelector(e):null},Qm=(e,t)=>u0(e)?(Xb.matches||Xb.msMatchesSelector).call(e,t):!1,Yb=e=>e?Vu(e.childNodes):[],li=e=>e&&e.parentElement,Kc=(e,t)=>{if(u0(e)){const n=Xb.closest;if(n)return n.call(e,t);do{if(Qm(e,t))return e;e=li(e)}while(e)}},Ote=(e,t,n)=>{const r=Kc(e,t),o=e&&Mte(n,r),s=Kc(o,t)===r;return r&&o?r===e||o===e||s&&Kc(Kc(e,n),t)!==r:!1},As=()=>{},ci=e=>{if(c0(e))Xn(Vu(e),t=>ci(t));else if(e){const t=li(e);t&&t.removeChild(e)}},d2=(e,t,n)=>{if(n&&e){let r=t,o;return c0(n)?(o=document.createDocumentFragment(),Xn(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),()=>ci(n)}return As},_s=(e,t)=>d2(e,null,t),Ate=(e,t)=>d2(li(e),e,t),Tj=(e,t)=>d2(li(e),e&&e.nextSibling,t),Fl=e=>{const t=document.createElement("div");return Mo(t,"class",e),t},fO=e=>{const t=Fl();return t.innerHTML=e.trim(),Xn(Yb(t),n=>ci(n))},Yo=c2?window:{},Vd=Math.max,Rte=Math.min,ff=Math.round,pO=Yo.cancelAnimationFrame,hO=Yo.requestAnimationFrame,Xm=Yo.setTimeout,Jb=Yo.clearTimeout,Zb=e=>e.charAt(0).toUpperCase()+e.slice(1),Dte=()=>Fl().style,Tte=["-webkit-","-moz-","-o-","-ms-"],Nte=["WebKit","Moz","O","MS","webkit","moz","o","ms"],S1={},k1={},$te=e=>{let t=k1[e];if(f0(k1,e))return t;const n=Zb(e),r=Dte();return Xn(Tte,o=>{const s=o.replace(/-/g,"");return!(t=[e,o+e,s+n,Zb(s)+n].find(c=>r[c]!==void 0))}),k1[e]=t||""},p0=e=>{let t=S1[e]||Yo[e];return f0(S1,e)||(Xn(Nte,n=>(t=t||Yo[n+Zb(e)],!t)),S1[e]=t),t},Lte=p0("MutationObserver"),Nj=p0("IntersectionObserver"),Ym=p0("ResizeObserver"),ex=p0("ScrollTimeline"),Gt=(e,...t)=>e.bind(0,...t),El=e=>{let t;const n=e?Xm:hO,r=e?Jb:pO;return[o=>{r(t),t=n(o,Ta(e)?e():e)},()=>r(t)]},mO=(e,t)=>{let n,r,o,s=As;const{v:i,p:c,g:d}=t||{},p=function(y){s(),Jb(n),n=r=void 0,s=As,e.apply(this,y)},h=b=>d&&r?d(r,b):b,m=()=>{s!==As&&p(h(o)||o)},g=function(){const y=Vu(arguments),x=Ta(i)?i():i;if(Ea(x)&&x>=0){const S=Ta(c)?c():c,j=Ea(S)&&S>=0,I=x>0?Xm:hO,_=x>0?Jb:pO,E=h(y)||y,A=p.bind(0,E);s();const R=I(A,x);s=()=>_(R),j&&!n&&(n=Xm(m,S)),r=o=E}else p(y)};return g.m=m,g},zte=/[^\x20\t\r\n\f]+/g,gO=(e,t,n)=>{const r=e&&e.classList;let o,s=0,i=!1;if(r&&t&&Zf(t)){const c=t.match(zte)||[];for(i=c.length>0;o=c[s++];)i=!!n(r,o)&&i}return i},f2=(e,t)=>{gO(e,t,(n,r)=>n.remove(r))},al=(e,t)=>(gO(e,t,(n,r)=>n.add(r)),Gt(f2,e,t)),Fte={opacity:1,zIndex:1},vh=(e,t)=>{const n=e||"",r=t?parseFloat(n):parseInt(n,10);return r===r?r:0},Bte=(e,t)=>!Fte[e]&&Ea(t)?`${t}px`:t,$j=(e,t,n)=>String((t!=null?t[n]||t.getPropertyValue(n):e.style[n])||""),Hte=(e,t,n)=>{try{const{style:r}=e;fl(r[t])?r.setProperty(t,n):r[t]=Bte(t,n)}catch{}};function Co(e,t){const n=Zf(t);if($s(t)||n){let o=n?"":{};if(e){const s=Yo.getComputedStyle(e,null);o=n?$j(e,s,t):t.reduce((i,c)=>(i[c]=$j(e,s,c),i),o)}return o}e&&Xn(t,(o,s)=>Hte(e,s,t[s]))}const pf=e=>Co(e,"direction")==="rtl",Lj=(e,t,n)=>{const r=t?`${t}-`:"",o=n?`-${n}`:"",s=`${r}top${o}`,i=`${r}right${o}`,c=`${r}bottom${o}`,d=`${r}left${o}`,p=Co(e,[s,i,c,d]);return{t:vh(p[s],!0),r:vh(p[i],!0),b:vh(p[c],!0),l:vh(p[d],!0)}},Dc=(e,t)=>`translate${df(e)?`(${e.x},${e.y})`:`${t?"X":"Y"}(${e})`}`,vO="paddingTop",p2="paddingRight",h2="paddingLeft",Jm="paddingBottom",Zm="marginLeft",eg="marginRight",Ud="marginBottom",Ad="overflowX",Rd="overflowY",vi="width",bi="height",ju="hidden",Wte={w:0,h:0},h0=(e,t)=>t?{w:t[`${e}Width`],h:t[`${e}Height`]}:Wte,Vte=e=>h0("inner",e||Yo),Gd=Gt(h0,"offset"),$h=Gt(h0,"client"),tg=Gt(h0,"scroll"),ng=e=>{const t=parseFloat(Co(e,vi))||0,n=parseFloat(Co(e,bi))||0;return{w:t-ff(t),h:n-ff(n)}},ka=e=>e.getBoundingClientRect(),tx=e=>!!(e&&(e[bi]||e[vi])),bO=(e,t)=>{const n=tx(e);return!tx(t)&&n},m0=(e,t,n,r)=>{if(e&&t){let o=!0;return Xn(n,s=>{const i=r?r(e[s]):e[s],c=r?r(t[s]):t[s];i!==c&&(o=!1)}),o}return!1},xO=(e,t)=>m0(e,t,["w","h"]),yO=(e,t)=>m0(e,t,["x","y"]),Ute=(e,t)=>m0(e,t,["t","r","b","l"]),zj=(e,t,n)=>m0(e,t,[vi,bi],n&&(r=>ff(r)));let bh;const Fj="passive",Gte=()=>{if(fl(bh)){bh=!1;try{Yo.addEventListener(Fj,As,Object.defineProperty({},Fj,{get(){bh=!0}}))}catch{}}return bh},CO=e=>e.split(" "),Bj=(e,t,n,r)=>{Xn(CO(t),o=>{e.removeEventListener(o,n,r)})},Ur=(e,t,n,r)=>{var o;const s=Gte(),i=(o=s&&r&&r.S)!=null?o:s,c=r&&r.$||!1,d=r&&r.O||!1,p=s?{passive:i,capture:c}:c;return Gt(Ls,CO(t).map(h=>{const m=d?g=>{Bj(e,h,m,c),n(g)}:n;return e.addEventListener(h,m,p),Gt(Bj,e,h,m,c)}))},wO=e=>e.stopPropagation(),Hj=e=>e.preventDefault(),qte={x:0,y:0},j1=e=>{const t=e&&ka(e);return t?{x:t.left+Yo.pageYOffset,y:t.top+Yo.pageXOffset}:qte},SO=(e,t,n)=>n?n.n?-e:n.i?t-e:e:e,Kte=(e,t)=>[t&&t.i?e:0,SO(e,e,t)],Yl=(e,t)=>{const{x:n,y:r}=Ea(t)?{x:t,y:t}:t||{};Ea(n)&&(e.scrollLeft=n),Ea(r)&&(e.scrollTop=r)},g0=e=>({x:e.scrollLeft,y:e.scrollTop}),Wj=(e,t)=>{Xn($s(t)?t:[t],e)},nx=e=>{const t=new Map,n=(s,i)=>{if(s){const c=t.get(s);Wj(d=>{c&&c[d?"delete":"clear"](d)},i)}else t.forEach(c=>{c.clear()}),t.clear()},r=(s,i)=>{if(Zf(s)){const p=t.get(s)||new Set;return t.set(s,p),Wj(h=>{Ta(h)&&p.add(h)},i),Gt(n,s,i)}lO(i)&&i&&n();const c=gi(s),d=[];return Xn(c,p=>{const h=s[p];h&&Qn(d,r(p,h))}),Gt(Ls,d)},o=(s,i)=>{Xn(Vu(t.get(s)),c=>{i&&!Km(i)?c.apply(0,i):c()})};return r(e||{}),[r,n,o]},Vj=e=>JSON.stringify(e,(t,n)=>{if(Ta(n))throw 0;return n}),Uj=(e,t)=>e?`${t}`.split(".").reduce((n,r)=>n&&f0(n,r)?n[r]:void 0,e):void 0,Qte={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,autoHideSuspend:!1,dragScroll:!0,clickScroll:!1,pointers:["mouse","touch","pen"]}},kO=(e,t)=>{const n={},r=Qi(gi(t),gi(e));return Xn(r,o=>{const s=e[o],i=t[o];if(df(s)&&df(i))Bn(n[o]={},kO(s,i)),u2(n[o])&&delete n[o];else if(f0(t,o)&&i!==s){let c=!0;if($s(s)||$s(i))try{Vj(s)===Vj(i)&&(c=!1)}catch{}c&&(n[o]=i)}}),n},Xte=(e,t,n)=>r=>[Uj(e,r),n||Uj(t,r)!==void 0],ep="data-overlayscrollbars",jO="os-environment",_O=`${jO}-flexbox-glue`,Yte=`${_O}-max`,IO="os-scrollbar-hidden",_1=`${ep}-initialize`,Zs=ep,PO=`${Zs}-overflow-x`,EO=`${Zs}-overflow-y`,lu="overflowVisible",Jte="scrollbarHidden",Gj="scrollbarPressed",rg="updating",Ui=`${ep}-viewport`,I1="arrange",MO="scrollbarHidden",cu=lu,rx=`${ep}-padding`,Zte=cu,qj=`${ep}-content`,m2="os-size-observer",ene=`${m2}-appear`,tne=`${m2}-listener`,nne="os-trinsic-observer",rne="os-no-css-vars",one="os-theme-none",es="os-scrollbar",sne=`${es}-rtl`,ane=`${es}-horizontal`,ine=`${es}-vertical`,OO=`${es}-track`,g2=`${es}-handle`,lne=`${es}-visible`,cne=`${es}-cornerless`,Kj=`${es}-transitionless`,Qj=`${es}-interaction`,Xj=`${es}-unusable`,ox=`${es}-auto-hide`,Yj=`${ox}-hidden`,Jj=`${es}-wheel`,une=`${OO}-interactive`,dne=`${g2}-interactive`,AO={},RO={},fne=e=>{Xn(e,t=>Xn(t,(n,r)=>{AO[r]=t[r]}))},DO=(e,t,n)=>gi(e).map(r=>{const{static:o,instance:s}=e[r],[i,c,d]=n||[],p=n?s:o;if(p){const h=n?p(i,c,t):p(t);return(d||RO)[r]=h}}),Uu=e=>RO[e],pne="__osOptionsValidationPlugin",hne="__osSizeObserverPlugin",v2="__osScrollbarsHidingPlugin",mne="__osClickScrollPlugin";let P1;const Zj=(e,t,n,r)=>{_s(e,t);const o=$h(t),s=Gd(t),i=ng(n);return r&&ci(t),{x:s.h-o.h+i.h,y:s.w-o.w+i.w}},gne=e=>{let t=!1;const n=al(e,IO);try{t=Co(e,$te("scrollbar-width"))==="none"||Yo.getComputedStyle(e,"::-webkit-scrollbar").getPropertyValue("display")==="none"}catch{}return n(),t},vne=(e,t)=>{Co(e,{[Ad]:ju,[Rd]:ju,direction:"rtl"}),Yl(e,{x:0});const n=j1(e),r=j1(t);Yl(e,{x:-999});const o=j1(t);return{i:n.x===r.x,n:r.x!==o.x}},bne=(e,t)=>{const n=al(e,_O),r=ka(e),o=ka(t),s=zj(o,r,!0),i=al(e,Yte),c=ka(e),d=ka(t),p=zj(d,c,!0);return n(),i(),s&&p},xne=()=>{const{body:e}=document,n=fO(`
`)[0],r=n.firstChild,[o,,s]=nx(),[i,c]=Js({o:Zj(e,n,r),u:yO},Gt(Zj,e,n,r,!0)),[d]=c(),p=gne(n),h={x:d.x===0,y:d.y===0},m={elements:{host:null,padding:!p,viewport:w=>p&&w===w.ownerDocument.body&&w,content:!1},scrollbars:{slot:!0},cancel:{nativeScrollbarsOverlaid:!1,body:null}},g=Bn({},Qte),b=Gt(Bn,{},g),y=Gt(Bn,{},m),x={L:d,I:h,H:p,A:Co(n,"zIndex")==="-1",P:!!ex,V:vne(n,r),U:bne(n,r),B:Gt(o,"r"),j:y,N:w=>Bn(m,w)&&y(),G:b,q:w=>Bn(g,w)&&b(),F:Bn({},m),W:Bn({},g)};return Wo(n,"style"),ci(n),Yo.addEventListener("resize",()=>{let w;if(!p&&(!h.x||!h.y)){const S=Uu(v2);w=!!(S?S.R():As)(x,i)}s("r",[w])}),x},Jo=()=>(P1||(P1=xne()),P1),b2=(e,t)=>Ta(t)?t.apply(0,e):t,yne=(e,t,n,r)=>{const o=fl(r)?n:r;return b2(e,o)||t.apply(0,e)},TO=(e,t,n,r)=>{const o=fl(r)?n:r,s=b2(e,o);return!!s&&(Wd(s)?s:t.apply(0,e))},Cne=(e,t)=>{const{nativeScrollbarsOverlaid:n,body:r}=t||{},{I:o,H:s,j:i}=Jo(),{nativeScrollbarsOverlaid:c,body:d}=i().cancel,p=n??c,h=fl(r)?d:r,m=(o.x||o.y)&&p,g=e&&(l0(h)?!s:h);return!!m||!!g},x2=new WeakMap,wne=(e,t)=>{x2.set(e,t)},Sne=e=>{x2.delete(e)},NO=e=>x2.get(e),kne=(e,t,n)=>{let r=!1;const o=n?new WeakMap:!1,s=()=>{r=!0},i=c=>{if(o&&n){const d=n.map(p=>{const[h,m]=p||[];return[m&&h?(c||dO)(h,e):[],m]});Xn(d,p=>Xn(p[0],h=>{const m=p[1],g=o.get(h)||[];if(e.contains(h)&&m){const y=Ur(h,m.trim(),x=>{r?(y(),o.delete(h)):t(x)});o.set(h,Qn(g,y))}else Ls(g),o.delete(h)}))}};return i(),[s,i]},e_=(e,t,n,r)=>{let o=!1;const{X:s,Y:i,J:c,K:d,Z:p,tt:h}=r||{},m=mO(()=>o&&n(!0),{v:33,p:99}),[g,b]=kne(e,m,c),y=s||[],x=i||[],w=Qi(y,x),S=(I,_)=>{if(!Km(_)){const M=p||As,E=h||As,A=[],R=[];let D=!1,O=!1;if(Xn(_,T=>{const{attributeName:K,target:G,type:X,oldValue:Z,addedNodes:te,removedNodes:V}=T,oe=X==="attributes",ne=X==="childList",se=e===G,re=oe&&K,ae=re?Mo(G,K||""):null,B=re&&Z!==ae,Y=d0(x,K)&&B;if(t&&(ne||!se)){const $=oe&&B,F=$&&d&&Qm(G,d),pe=(F?!M(G,K,Z,ae):!oe||$)&&!E(T,!!F,e,r);Xn(te,W=>Qn(A,W)),Xn(V,W=>Qn(A,W)),O=O||pe}!t&&se&&B&&!M(G,K,Z,ae)&&(Qn(R,K),D=D||Y)}),b(T=>Dj(A).reduce((K,G)=>(Qn(K,dO(T,G)),Qm(G,T)?Qn(K,G):K),[])),t)return!I&&O&&n(!1),[!1];if(!Km(R)||D){const T=[Dj(R),D];return!I&&n.apply(0,T),T}}},j=new Lte(Gt(S,!1));return[()=>(j.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:w,subtree:t,childList:t,characterData:t}),o=!0,()=>{o&&(g(),j.disconnect(),o=!1)}),()=>{if(o)return m.m(),S(!0,j.takeRecords())}]},$O=(e,t,n)=>{const{nt:o,ot:s}=n||{},i=Uu(hne),{V:c}=Jo(),d=Gt(pf,e),[p]=Js({o:!1,_:!0});return()=>{const h=[],g=fO(`
`)[0],b=g.firstChild,y=x=>{const w=x instanceof ResizeObserverEntry,S=!w&&$s(x);let j=!1,I=!1,_=!0;if(w){const[M,,E]=p(x.contentRect),A=tx(M),R=bO(M,E);I=!E||R,j=!I&&!A,_=!j}else S?[,_]=x:I=x===!0;if(o&&_){const M=S?x[0]:pf(g);Yl(g,{x:SO(3333333,3333333,M&&c),y:3333333})}j||t({st:S?x:void 0,et:!S,ot:I})};if(Ym){const x=new Ym(w=>y(w.pop()));x.observe(b),Qn(h,()=>{x.disconnect()})}else if(i){const[x,w]=i(b,y,s);Qn(h,Qi([al(g,ene),Ur(g,"animationstart",x)],w))}else return As;if(o){const[x]=Js({o:void 0},d);Qn(h,Ur(g,"scroll",w=>{const S=x(),[j,I,_]=S;I&&(f2(b,"ltr rtl"),al(b,j?"rtl":"ltr"),y([!!j,I,_])),wO(w)}))}return Gt(Ls,Qn(h,_s(e,g)))}},jne=(e,t)=>{let n;const r=d=>d.h===0||d.isIntersecting||d.intersectionRatio>0,o=Fl(nne),[s]=Js({o:!1}),i=(d,p)=>{if(d){const h=s(r(d)),[,m]=h;return m&&!p&&t(h)&&[h]}},c=(d,p)=>i(p.pop(),d);return[()=>{const d=[];if(Nj)n=new Nj(Gt(c,!1),{root:e}),n.observe(o),Qn(d,()=>{n.disconnect()});else{const p=()=>{const h=Gd(o);i(h)};Qn(d,$O(o,p)()),p()}return Gt(Ls,Qn(d,_s(e,o)))},()=>n&&c(!0,n.takeRecords())]},_ne=(e,t)=>{let n,r,o,s,i;const{H:c}=Jo(),d=`[${Zs}]`,p=`[${Ui}]`,h=["tabindex"],m=["wrap","cols","rows"],g=["id","class","style","open"],b={ct:!1,rt:pf(e.lt)},{lt:y,it:x,ut:w,ft:S,_t:j,dt:I,vt:_}=e,{U:M,B:E}=Jo(),[A]=Js({u:xO,o:{w:0,h:0}},()=>{const re=I(cu,lu),ae=I(I1,""),B=ae&&g0(x);_(cu,lu),_(I1,""),_("",rg,!0);const Y=tg(w),$=tg(x),F=ng(x);return _(cu,lu,re),_(I1,"",ae),_("",rg),Yl(x,B),{w:$.w+Y.w+F.w,h:$.h+Y.h+F.h}}),R=S?m:Qi(g,m),D=mO(t,{v:()=>n,p:()=>r,g(re,ae){const[B]=re,[Y]=ae;return[Qi(gi(B),gi(Y)).reduce(($,F)=>($[F]=B[F]||Y[F],$),{})]}}),O=re=>{Xn(re||h,ae=>{if(d0(h,ae)){const B=Mo(y,ae);Zf(B)?Mo(x,ae,B):Wo(x,ae)}})},T=(re,ae)=>{const[B,Y]=re,$={ht:Y};return Bn(b,{ct:B}),!ae&&t($),$},K=({et:re,st:ae,ot:B})=>{const $=!(re&&!B&&!ae)&&c?D:t,[F,q]=ae||[];ae&&Bn(b,{rt:F}),$({et:re||B,ot:B,gt:q})},G=(re,ae)=>{const[,B]=A(),Y={bt:B};return B&&!ae&&(re?t:D)(Y),Y},X=(re,ae,B)=>{const Y={wt:ae};return ae&&!B?D(Y):j||O(re),Y},[Z,te]=w||!M?jne(y,T):[],V=!j&&$O(y,K,{ot:!0,nt:!0}),[oe,ne]=e_(y,!1,X,{Y:g,X:Qi(g,h)}),se=j&&Ym&&new Ym(re=>{const ae=re[re.length-1].contentRect;K({et:!0,ot:bO(ae,i)}),i=ae});return[()=>{O(),se&&se.observe(y);const re=V&&V(),ae=Z&&Z(),B=oe(),Y=E($=>{const[,F]=A();D({yt:$,bt:F})});return()=>{se&&se.disconnect(),re&&re(),ae&&ae(),s&&s(),B(),Y()}},({St:re,$t:ae,xt:B})=>{const Y={},[$]=re("update.ignoreMutation"),[F,q]=re("update.attributes"),[pe,W]=re("update.elementEvents"),[U,ee]=re("update.debounce"),J=W||q,ge=ae||B,he=de=>Ta($)&&$(de);if(J){o&&o(),s&&s();const[de,_e]=e_(w||x,!0,G,{X:Qi(R,F||[]),J:pe,K:d,tt:(Pe,ze)=>{const{target:ht,attributeName:Je}=Pe;return(!ze&&Je&&!j?Ote(ht,d,p):!1)||!!Kc(ht,`.${es}`)||!!he(Pe)}});s=de(),o=_e}if(ee)if(D.m(),$s(U)){const de=U[0],_e=U[1];n=Ea(de)&&de,r=Ea(_e)&&_e}else Ea(U)?(n=U,r=!1):(n=!1,r=!1);if(ge){const de=ne(),_e=te&&te(),Pe=o&&o();de&&Bn(Y,X(de[0],de[1],ge)),_e&&Bn(Y,T(_e[0],ge)),Pe&&Bn(Y,G(Pe[0],ge))}return Y},b]},sx=(e,t,n)=>Vd(e,Rte(t,n)),Ine=(e,t,n)=>{const r=ff(t),[o,s]=Kte(r,n),i=(s-e)/s,c=e/o,d=e/s,p=n?n.n?i:n.i?c:d:d;return sx(0,1,p)},LO=(e,t,n,r)=>{if(r){const c=n?"x":"y",{Ot:d,Ct:p}=r,h=p[c],m=d[c];return sx(0,1,h/(h+m))}const o=n?vi:bi,s=ka(e)[o],i=ka(t)[o];return sx(0,1,s/i)},t_=(e,t,n,r)=>{const o=LO(e,t,r);return 1/o*(1-o)*n},Pne=(e,t,n)=>{const{j:r,A:o}=Jo(),{scrollbars:s}=r(),{slot:i}=s,{Ht:c,lt:d,it:p,zt:h,It:m,At:g,_t:b}=t,{scrollbars:y}=h?{}:e,{slot:x}=y||{},w=new Map,S=U=>ex&&new ex({source:m,axis:U}),j=S("x"),I=S("y"),_=TO([c,d,p],()=>b&&g?c:d,i,x),M=U=>b&&!g&&li(U)===p,E=U=>{w.forEach((ee,J)=>{(U?d0($s(U)?U:[U],J):!0)&&((ee||[]).forEach(he=>{he&&he.cancel()}),w.delete(J))})},A=(U,ee,J)=>{const ge=J?al:f2;Xn(U,he=>{ge(he.Et,ee)})},R=(U,ee)=>{Xn(U,J=>{const[ge,he]=ee(J);Co(ge,he)})},D=U=>{const ee=U||0;return isFinite(ee)?ee:0},O=U=>`${(D(U)*100).toFixed(3)}%`,T=U=>`${D(U)}px`,K=(U,ee,J)=>{R(U,ge=>{const{Tt:he,kt:de}=ge;return[he,{[J?vi:bi]:O(LO(he,de,J,ee))}]})},G=(U,ee,J)=>{R(U,ge=>{const{Tt:he,kt:de,Et:_e}=ge,{V:Pe}=Jo(),ze=J?"x":"y",ht=J?"Left":"Top",{Ot:Je}=ee,qt=pf(_e),Pt=t_(he,de,Ine(m[`scroll${ht}`],Je[ze],J&&qt&&Pe),J);return[he,{transform:Dc(O(Pt),J)}]})},X=U=>{const{Et:ee}=U,J=M(ee)&&ee,{x:ge,y:he}=g0(m);return[J,{transform:J?Dc({x:T(ge),y:T(he)}):""}]},Z=(U,ee,J,ge)=>ee&&U.animate(J,{timeline:ee,composite:ge}),te=(U,ee,J,ge)=>Z(U,ee,{transform:[Dc(T(0),ge),Dc(T(Vd(0,J-.5)),ge)]},"add"),V=[],oe=[],ne=[],se=(U,ee,J)=>{const ge=lO(J),he=ge?J:!0,de=ge?!J:!0;he&&A(oe,U,ee),de&&A(ne,U,ee)},re=U=>{K(oe,U,!0),K(ne,U)},ae=U=>{!j&&!I&&(G(oe,U,!0),G(ne,U))},B=()=>{const U=(ee,{Et:J,kt:ge,Tt:he})=>{const de=ee&&pf(J),_e=Gt(t_,he,ge),Pe=_e(de?1:0,ee),ze=_e(de?0:1,ee);E(he),w.set(he,[Z(he,ee?j:I,Bn({transform:[Dc(O(Pe),ee),Dc(O(ze),ee)]},de?{clear:["left"]}:{}))])};oe.forEach(Gt(U,!0)),ne.forEach(Gt(U,!1))},Y=()=>{!I&&!I&&(b&&R(oe,X),b&&R(ne,X))},$=({Ot:U})=>{Qi(ne,oe).forEach(({Et:ee})=>{E(ee),M(ee)&&w.set(ee,[te(ee,j,U.x,!0),te(ee,I,U.y)])})},F=U=>{const ee=U?ane:ine,J=U?oe:ne,ge=Km(J)?Kj:"",he=Fl(`${es} ${ee} ${ge}`),de=Fl(OO),_e=Fl(g2),Pe={Et:he,kt:de,Tt:_e};return o||al(he,rne),Qn(J,Pe),Qn(V,[_s(he,de),_s(de,_e),Gt(ci,he),E,n(Pe,se,U)]),Pe},q=Gt(F,!0),pe=Gt(F,!1),W=()=>(_s(_,oe[0].Et),_s(_,ne[0].Et),Xm(()=>{se(Kj)},300),Gt(Ls,V));return q(),pe(),[{Dt:re,Mt:ae,Rt:B,Lt:$,Pt:Y,Vt:se,Ut:{P:j,Bt:oe,jt:q,Nt:Gt(R,oe)},Gt:{P:I,Bt:ne,jt:pe,Nt:Gt(R,ne)}},W]},Ene=(e,t,n)=>{const{lt:r,It:o,qt:s}=t,i=(c,d)=>{const{Tt:p,kt:h}=c,m=`scroll${d?"Left":"Top"}`,g=`client${d?"X":"Y"}`,b=d?vi:bi,y=d?"left":"top",x=d?"w":"h",w=d?"x":"y",S="pointerup pointerleave pointercancel lostpointercapture",j=(I,_)=>M=>{const{Ot:E}=n,A=Gd(h)[x]-Gd(p)[x],D=_*M/A*E[w];o[m]=I+D};return Ur(h,"pointerdown",I=>{const _=Kc(I.target,`.${g2}`)===p,M=_?p:h,E=e.scrollbars,{button:A,isPrimary:R,pointerType:D}=I,{pointers:O}=E,T=A===0&&R&&E[_?"dragScroll":"clickScroll"]&&(O||[]).includes(D);if(zl(r,Zs,Gj,!0),T){const K=!_&&I.shiftKey,G=Gt(ka,p),X=Gt(ka,h),Z=(q,pe)=>(q||G())[y]-(pe||X())[y],te=ff(ka(o)[b])/Gd(o)[x]||1,V=j(o[m]||0,1/te),oe=I[g],ne=G(),se=X(),re=ne[b],ae=Z(ne,se)+re/2,B=oe-se[y],Y=_?0:B-ae,$=q=>{Ls(F),M.releasePointerCapture(q.pointerId)},F=[Gt(zl,r,Zs,Gj),Ur(s,S,$),Ur(s,"selectstart",q=>Hj(q),{S:!1}),Ur(h,S,$),Ur(h,"pointermove",q=>{const pe=q[g]-oe;(_||K)&&V(Y+pe)})];if(K)V(Y);else if(!_){const q=Uu(mne);q&&Qn(F,q(V,Z,Y,re,B))}M.setPointerCapture(I.pointerId)}})};return(c,d,p)=>{const{Et:h}=c,[m,g]=El(333),b=!!o.scrollBy;let y=!0;return Gt(Ls,[Ur(h,"pointerenter",()=>{d(Qj,!0)}),Ur(h,"pointerleave pointercancel",()=>{d(Qj,!1)}),Ur(h,"wheel",x=>{const{deltaX:w,deltaY:S,deltaMode:j}=x;b&&y&&j===0&&li(h)===r&&o.scrollBy({left:w,top:S,behavior:"smooth"}),y=!1,d(Jj,!0),m(()=>{y=!0,d(Jj)}),Hj(x)},{S:!1,$:!0}),Ur(h,"mousedown",Gt(Ur,s,"click",wO,{O:!0,$:!0}),{$:!0}),i(c,p),g])}},Mne=(e,t,n,r,o,s)=>{let i,c,d,p,h,m=As,g=0;const[b,y]=El(),[x,w]=El(),[S,j]=El(100),[I,_]=El(100),[M,E]=El(100),[A,R]=El(()=>g),[D,O]=Pne(e,o,Ene(t,o,r)),{lt:T,Ft:K,At:G}=o,{Vt:X,Dt:Z,Mt:te,Rt:V,Lt:oe,Pt:ne}=D,se=$=>{X(ox,$,!0),X(ox,$,!1)},re=($,F)=>{if(R(),$)X(Yj);else{const q=Gt(X,Yj,!0);g>0&&!F?A(q):q()}},ae=$=>$.pointerType==="mouse",B=$=>{ae($)&&(p=c,p&&re(!0))},Y=[j,R,_,E,w,y,()=>m(),Ur(T,"pointerover",B,{O:!0}),Ur(T,"pointerenter",B),Ur(T,"pointerleave",$=>{ae($)&&(p=!1,c&&re(!1))}),Ur(T,"pointermove",$=>{ae($)&&i&&b(()=>{j(),re(!0),I(()=>{i&&re(!1)})})}),Ur(K,"scroll",$=>{x(()=>{te(r),d&&re(!0),S(()=>{d&&!p&&re(!1)})}),s($),ne()})];return[()=>Gt(Ls,Qn(Y,O())),({St:$,xt:F,Wt:q,Xt:pe})=>{const{Yt:W,Jt:U,Kt:ee}=pe||{},{gt:J,ot:ge}=q||{},{rt:he}=n,{I:de}=Jo(),{Ot:_e,Zt:Pe,Qt:ze}=r,[ht,Je]=$("showNativeOverlaidScrollbars"),[qt,Pt]=$("scrollbars.theme"),[jt,Se]=$("scrollbars.visibility"),[Fe,it]=$("scrollbars.autoHide"),[At,ke]=$("scrollbars.autoHideSuspend"),[lt]=$("scrollbars.autoHideDelay"),[Rt,zt]=$("scrollbars.dragScroll"),[Re,Qe]=$("scrollbars.clickScroll"),En=ge&&!F,Te=ze.x||ze.y,ct=W||U||J||F,ft=ee||Se,tt=ht&&de.x&&de.y,en=(ar,vn)=>{const dn=jt==="visible"||jt==="auto"&&ar==="scroll";return X(lne,dn,vn),dn};if(g=lt,En&&(At&&Te?(se(!1),m(),M(()=>{m=Ur(K,"scroll",Gt(se,!0),{O:!0})})):se(!0)),Je&&X(one,tt),Pt&&(X(h),X(qt,!0),h=qt),ke&&!At&&se(!0),it&&(i=Fe==="move",c=Fe==="leave",d=Fe!=="never",re(!d,!0)),zt&&X(dne,Rt),Qe&&X(une,Re),ft){const ar=en(Pe.x,!0),vn=en(Pe.y,!1);X(cne,!(ar&&vn))}ct&&(Z(r),te(r),V(r),ne(),oe(r),X(Xj,!_e.x,!0),X(Xj,!_e.y,!1),X(sne,he&&!G))},{},D]},One=e=>{const t=Jo(),{j:n,H:r}=t,o=Uu(v2),s=o&&o.C,{elements:i}=n(),{host:c,padding:d,viewport:p,content:h}=i,m=Wd(e),g=m?{}:e,{elements:b}=g,{host:y,padding:x,viewport:w,content:S}=b||{},j=m?e:g.target,I=Qm(j,"textarea"),_=j.ownerDocument,M=_.documentElement,E=j===_.body,A=_.defaultView,R=Gt(yne,[j]),D=Gt(TO,[j]),O=Gt(b2,[j]),T=Gt(Fl,""),K=Gt(R,T,p),G=Gt(D,T,h),X=K(w),Z=X===j,te=Z&&E,V=!Z&&G(S),oe=!Z&&Wd(X)&&X===V,ne=oe&&!!O(h),se=ne?K():X,re=ne?V:G(),B=te?M:oe?se:X,Y=I?R(T,c,y):j,$=te?B:Y,F=oe?re:V,q=_.activeElement,pe=!Z&&A.top===A&&q===j,W={Ht:j,lt:$,it:B,tn:!Z&&D(T,d,x),ut:F,nn:!Z&&!r&&s&&s(t),It:te?M:B,Ft:te?_:B,sn:A,qt:_,ft:I,At:E,zt:m,_t:Z,en:oe,dt:(Se,Fe)=>Ete(B,Z?Zs:Ui,Z?Fe:Se),vt:(Se,Fe,it)=>zl(B,Z?Zs:Ui,Z?Fe:Se,it)},U=gi(W).reduce((Se,Fe)=>{const it=W[Fe];return Qn(Se,it&&Wd(it)&&!li(it)?it:!1)},[]),ee=Se=>Se?d0(U,Se):null,{Ht:J,lt:ge,tn:he,it:de,ut:_e,nn:Pe}=W,ze=[()=>{Wo(ge,Zs),Wo(ge,_1),Wo(J,_1),E&&(Wo(M,Zs),Wo(M,_1))}],ht=I&&ee(ge);let Je=I?J:Yb([_e,de,he,ge,J].find(Se=>ee(Se)===!1));const qt=te?J:_e||de,Pt=Gt(Ls,ze);return[W,()=>{Mo(ge,Zs,Z?"viewport":"host"),Mo(he,rx,""),Mo(_e,qj,""),Z||Mo(de,Ui,"");const Se=E&&!Z?al(li(j),IO):As,Fe=it=>{_s(li(it),Yb(it)),ci(it)};if(ht&&(Tj(J,ge),Qn(ze,()=>{Tj(ge,J),ci(ge)})),_s(qt,Je),_s(ge,he),_s(he||ge,!Z&&de),_s(de,_e),Qn(ze,()=>{Se(),Wo(he,rx),Wo(_e,qj),Wo(de,PO),Wo(de,EO),Wo(de,Ui),ee(_e)&&Fe(_e),ee(de)&&Fe(de),ee(he)&&Fe(he)}),r&&!Z&&(zl(de,Ui,MO,!0),Qn(ze,Gt(Wo,de,Ui))),Pe&&(Ate(de,Pe),Qn(ze,Gt(ci,Pe))),pe){const it="tabindex",At=Mo(de,it);Mo(de,it,"-1"),de.focus();const ke=()=>At?Mo(de,it,At):Wo(de,it),lt=Ur(_,"pointerdown keydown",()=>{ke(),lt()});Qn(ze,[ke,lt])}else q&&q.focus&&q.focus();return Je=0,Pt},Pt]},Ane=({ut:e})=>({Wt:t,cn:n,xt:r})=>{const{U:o}=Jo(),{ht:s}=t||{},{ct:i}=n;(e||!o)&&(s||r)&&Co(e,{[bi]:i?"":"100%"})},Rne=({lt:e,tn:t,it:n,_t:r},o)=>{const[s,i]=Js({u:Ute,o:Lj()},Gt(Lj,e,"padding",""));return({St:c,Wt:d,cn:p,xt:h})=>{let[m,g]=i(h);const{H:b,U:y}=Jo(),{et:x,bt:w,gt:S}=d||{},{rt:j}=p,[I,_]=c("paddingAbsolute");(x||g||(h||!y&&w))&&([m,g]=s(h));const E=!r&&(_||S||g);if(E){const A=!I||!t&&!b,R=m.r+m.l,D=m.t+m.b,O={[eg]:A&&!j?-R:0,[Ud]:A?-D:0,[Zm]:A&&j?-R:0,top:A?-m.t:0,right:A?j?-m.r:"auto":0,left:A?j?"auto":-m.l:0,[vi]:A?`calc(100% + ${R}px)`:""},T={[vO]:A?m.t:0,[p2]:A?m.r:0,[Jm]:A?m.b:0,[h2]:A?m.l:0};Co(t||n,O),Co(n,T),Bn(o,{tn:m,rn:!A,k:t?T:Bn({},O,T)})}return{ln:E}}},Dne=({lt:e,tn:t,it:n,nn:r,_t:o,vt:s,At:i,sn:c},d)=>{const p=Gt(Vd,0),h="visible",m=42,g={u:xO,o:{w:0,h:0}},b={u:yO,o:{x:ju,y:ju}},y=(ae,B)=>{const Y=Yo.devicePixelRatio%1!==0?1:0,$={w:p(ae.w-B.w),h:p(ae.h-B.h)};return{w:$.w>Y?$.w:0,h:$.h>Y?$.h:0}},x=ae=>ae.indexOf(h)===0,{L:w,U:S,H:j,I}=Jo(),_=Uu(v2),M=!o&&!j&&(I.x||I.y),E=i&&o,[A,R]=Js(g,Gt(ng,n)),[D,O]=Js(g,Gt(tg,n)),[T,K]=Js(g),[G,X]=Js(g),[Z]=Js(b),te=(ae,B)=>{if(Co(n,{[bi]:""}),B){const{rn:Y,tn:$}=d,{an:F,D:q}=ae,pe=ng(e),W=$h(e),U=Co(n,"boxSizing")==="content-box",ee=Y||U?$.b+$.t:0,J=!(I.x&&U);Co(n,{[bi]:W.h+pe.h+(F.x&&J?q.x:0)-ee})}},V=(ae,B)=>{const Y=!j&&!ae?m:0,$=(he,de,_e)=>{const Pe=Co(n,he),ht=(B?B[he]:Pe)==="scroll";return[Pe,ht,ht&&!j?de?Y:_e:0,de&&!!Y]},[F,q,pe,W]=$(Ad,I.x,w.x),[U,ee,J,ge]=$(Rd,I.y,w.y);return{Zt:{x:F,y:U},an:{x:q,y:ee},D:{x:pe,y:J},M:{x:W,y:ge}}},oe=(ae,B,Y,$)=>{const F=(ee,J)=>{const ge=x(ee),he=J&&ge&&ee.replace(`${h}-`,"")||"";return[J&&!ge?ee:"",x(he)?"hidden":he]},[q,pe]=F(Y.x,B.x),[W,U]=F(Y.y,B.y);return $[Ad]=pe&&W?pe:q,$[Rd]=U&&q?U:W,V(ae,$)},ne=(ae,B,Y,$)=>{const{D:F,M:q}=ae,{x:pe,y:W}=q,{x:U,y:ee}=F,{k:J}=d,ge=B?Zm:eg,he=B?h2:p2,de=J[ge],_e=J[Ud],Pe=J[he],ze=J[Jm];$[vi]=`calc(100% + ${ee+de*-1}px)`,$[ge]=-ee+de,$[Ud]=-U+_e,Y&&($[he]=Pe+(W?ee:0),$[Jm]=ze+(pe?U:0))},[se,re]=_?_.T(M,S,n,r,d,V,ne):[()=>M,()=>[As]];return({St:ae,Wt:B,cn:Y,xt:$},{ln:F})=>{const{et:q,wt:pe,bt:W,ht:U,gt:ee,yt:J}=B||{},{ct:ge,rt:he}=Y,[de,_e]=ae("showNativeOverlaidScrollbars"),[Pe,ze]=ae("overflow"),ht=de&&I.x&&I.y,Je=!o&&!S&&(q||W||pe||_e||U),qt=q||F||W||ee||J||_e,Pt=x(Pe.x),jt=x(Pe.y),Se=Pt||jt;let Fe=R($),it=O($),At=K($),ke=X($),lt;if(_e&&j&&s(MO,Jte,!ht),Je&&(lt=V(ht),te(lt,ge)),qt){Se&&s(cu,lu,!1);const[Tr,ir]=re(ht,he,lt),[$n,Jn]=Fe=A($),[Mn,Fr]=it=D($),co=$h(n);let Nr=Mn,$r=co;Tr(),(Fr||Jn||_e)&&ir&&!ht&&se(ir,Mn,$n,he)&&($r=$h(n),Nr=tg(n));const Lo=Vte(c),Br={w:p(Vd(Mn.w,Nr.w)+$n.w),h:p(Vd(Mn.h,Nr.h)+$n.h)},ts={w:p((E?Lo.w:$r.w+p(co.w-Mn.w))+$n.w),h:p((E?Lo.h:$r.h+p(co.h-Mn.h))+$n.h)};ke=G(ts),At=T(y(Br,ts),$)}const[Rt,zt]=ke,[Re,Qe]=At,[En,Te]=it,[ct,ft]=Fe,tt={x:Re.w>0,y:Re.h>0},en=Pt&&jt&&(tt.x||tt.y)||Pt&&tt.x&&!tt.y||jt&&tt.y&&!tt.x;if(F||ee||J||ft||Te||zt||Qe||ze||_e||Je||qt){const Tr={[eg]:0,[Ud]:0,[Zm]:0,[vi]:"",[Ad]:"",[Rd]:""},ir=oe(ht,tt,Pe,Tr),$n=se(ir,En,ct,he);o||ne(ir,he,$n,Tr),Je&&te(ir,ge),o?(Mo(e,PO,Tr[Ad]),Mo(e,EO,Tr[Rd])):Co(n,Tr)}zl(e,Zs,lu,en),zl(t,rx,Zte,en),o||zl(n,Ui,cu,Se);const[vn,dn]=Z(V(ht).Zt);return Bn(d,{Zt:vn,Ct:{x:Rt.w,y:Rt.h},Ot:{x:Re.w,y:Re.h},Qt:tt}),{Kt:dn,Yt:zt,Jt:Qe}}},Tne=e=>{const[t,n,r]=One(e),o={tn:{t:0,r:0,b:0,l:0},rn:!1,k:{[eg]:0,[Ud]:0,[Zm]:0,[vO]:0,[p2]:0,[Jm]:0,[h2]:0},Ct:{x:0,y:0},Ot:{x:0,y:0},Zt:{x:ju,y:ju},Qt:{x:!1,y:!1}},{Ht:s,it:i,vt:c,_t:d}=t,{H:p,I:h,U:m}=Jo(),g=!p&&(h.x||h.y),b=[Ane(t),Rne(t,o),Dne(t,o)];return[n,y=>{const x={},S=(g||!m)&&g0(i);return c("",rg,!0),Xn(b,j=>{Bn(x,j(y,x)||{})}),c("",rg),Yl(i,S),!d&&Yl(s,0),x},o,t,r]},Nne=(e,t,n,r)=>{const[o,s,i,c,d]=Tne(e),[p,h,m]=_ne(c,S=>{w({},S)}),[g,b,,y]=Mne(e,t,m,i,c,r),x=S=>gi(S).some(j=>!!S[j]),w=(S,j)=>{const{un:I,xt:_,$t:M,fn:E}=S,A=I||{},R=!!_,D={St:Xte(t,A,R),un:A,xt:R};if(E)return b(D),!1;const O=j||h(Bn({},D,{$t:M})),T=s(Bn({},D,{cn:m,Wt:O}));b(Bn({},D,{Wt:O,Xt:T}));const K=x(O),G=x(T),X=K||G||!u2(A)||R;return X&&n(S,{Wt:O,Xt:T}),X};return[()=>{const{Ht:S,it:j,qt:I,At:_}=c,M=_?I.documentElement:S,E=g0(M),A=[p(),o(),g()];return Yl(j,E),Gt(Ls,A)},w,()=>({_n:m,dn:i}),{vn:c,hn:y},d]},ai=(e,t,n)=>{const{G:r}=Jo(),o=Wd(e),s=o?e:e.target,i=NO(s);if(t&&!i){let c=!1;const d=[],p={},h=O=>{const T=cO(O,!0),K=Uu(pne);return K?K(T,!0):T},m=Bn({},r(),h(t)),[g,b,y]=nx(),[x,w,S]=nx(n),j=(O,T)=>{S(O,T),y(O,T)},[I,_,M,E,A]=Nne(e,m,({un:O,xt:T},{Wt:K,Xt:G})=>{const{et:X,gt:Z,ht:te,bt:V,wt:oe,ot:ne}=K,{Yt:se,Jt:re,Kt:ae}=G;j("updated",[D,{updateHints:{sizeChanged:!!X,directionChanged:!!Z,heightIntrinsicChanged:!!te,overflowEdgeChanged:!!se,overflowAmountChanged:!!re,overflowStyleChanged:!!ae,contentMutation:!!V,hostMutation:!!oe,appear:!!ne},changedOptions:O||{},force:!!T}])},O=>j("scroll",[D,O])),R=O=>{Sne(s),Ls(d),c=!0,j("destroyed",[D,O]),b(),w()},D={options(O,T){if(O){const K=T?r():{},G=kO(m,Bn(K,h(O)));u2(G)||(Bn(m,G),_({un:G}))}return Bn({},m)},on:x,off:(O,T)=>{O&&T&&w(O,T)},state(){const{_n:O,dn:T}=M(),{rt:K}=O,{Ct:G,Ot:X,Zt:Z,Qt:te,tn:V,rn:oe}=T;return Bn({},{overflowEdge:G,overflowAmount:X,overflowStyle:Z,hasOverflow:te,padding:V,paddingAbsolute:oe,directionRTL:K,destroyed:c})},elements(){const{Ht:O,lt:T,tn:K,it:G,ut:X,It:Z,Ft:te}=E.vn,{Ut:V,Gt:oe}=E.hn,ne=re=>{const{Tt:ae,kt:B,Et:Y}=re;return{scrollbar:Y,track:B,handle:ae}},se=re=>{const{Bt:ae,jt:B}=re,Y=ne(ae[0]);return Bn({},Y,{clone:()=>{const $=ne(B());return _({fn:!0}),$}})};return Bn({},{target:O,host:T,padding:K||G,viewport:G,content:X||G,scrollOffsetElement:Z,scrollEventElement:te,scrollbarHorizontal:se(V),scrollbarVertical:se(oe)})},update:O=>_({xt:O,$t:!0}),destroy:Gt(R,!1),plugin:O=>p[gi(O)[0]]};return Qn(d,[A]),wne(s,D),DO(AO,ai,[D,g,p]),Cne(E.vn.At,!o&&e.cancel)?(R(!0),D):(Qn(d,I()),j("initialized",[D]),D.update(!0),D)}return i};ai.plugin=e=>{const t=$s(e),n=t?e:[e],r=n.map(o=>DO(o,ai)[0]);return fne(n),t?r:r[0]};ai.valid=e=>{const t=e&&e.elements,n=Ta(t)&&t();return qm(n)&&!!NO(n.target)};ai.env=()=>{const{L:e,I:t,H:n,V:r,U:o,A:s,P:i,F:c,W:d,j:p,N:h,G:m,q:g}=Jo();return Bn({},{scrollbarsSize:e,scrollbarsOverlaid:t,scrollbarsHiding:n,rtlScrollBehavior:r,flexboxGlue:o,cssCustomProperties:s,scrollTimeline:i,staticDefaultInitialization:c,staticDefaultOptions:d,getDefaultInitialization:p,setDefaultInitialization:h,getDefaultOptions:m,setDefaultOptions:g})};const $ne=()=>{if(typeof window>"u"){const p=()=>{};return[p,p]}let e,t;const n=window,r=typeof n.requestIdleCallback=="function",o=n.requestAnimationFrame,s=n.cancelAnimationFrame,i=r?n.requestIdleCallback:o,c=r?n.cancelIdleCallback:s,d=()=>{c(e),s(t)};return[(p,h)=>{d(),e=i(r?()=>{d(),t=o(p)}:p,typeof h=="object"?h:{timeout:2233})},d]},y2=e=>{const{options:t,events:n,defer:r}=e||{},[o,s]=l.useMemo($ne,[]),i=l.useRef(null),c=l.useRef(r),d=l.useRef(t),p=l.useRef(n);return l.useEffect(()=>{c.current=r},[r]),l.useEffect(()=>{const{current:h}=i;d.current=t,ai.valid(h)&&h.options(t||{},!0)},[t]),l.useEffect(()=>{const{current:h}=i;p.current=n,ai.valid(h)&&h.on(n||{},!0)},[n]),l.useEffect(()=>()=>{var h;s(),(h=i.current)==null||h.destroy()},[]),l.useMemo(()=>[h=>{const m=i.current;if(ai.valid(m))return;const g=c.current,b=d.current||{},y=p.current||{},x=()=>i.current=ai(h,b,y);g?o(x,g):x()},()=>i.current],[])},Lne=(e,t)=>{const{element:n="div",options:r,events:o,defer:s,children:i,...c}=e,d=n,p=l.useRef(null),h=l.useRef(null),[m,g]=y2({options:r,events:o,defer:s});return l.useEffect(()=>{const{current:b}=p,{current:y}=h;return b&&y&&m({target:b,elements:{viewport:y,content:y}}),()=>{var x;return(x=g())==null?void 0:x.destroy()}},[m,n]),l.useImperativeHandle(t,()=>({osInstance:g,getElement:()=>p.current}),[]),z.createElement(d,{"data-overlayscrollbars-initialize":"",ref:p,...c},z.createElement("div",{"data-overlayscrollbars-contents":"",ref:h},i))},v0=l.forwardRef(Lne);var zO={exports:{}},FO={};const as=Dx(UD),Sd=Dx(GD),zne=Dx(qD);(function(e){var t,n,r=wc&&wc.__generator||function(ie,ue){var xe,Me,ye,pt,at={label:0,sent:function(){if(1&ye[0])throw ye[1];return ye[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(gt){return function(wt){return function(Ge){if(xe)throw new TypeError("Generator is already executing.");for(;at;)try{if(xe=1,Me&&(ye=2&Ge[0]?Me.return:Ge[0]?Me.throw||((ye=Me.return)&&ye.call(Me),0):Me.next)&&!(ye=ye.call(Me,Ge[1])).done)return ye;switch(Me=0,ye&&(Ge=[2&Ge[0],ye.value]),Ge[0]){case 0:case 1:ye=Ge;break;case 4:return at.label++,{value:Ge[1],done:!1};case 5:at.label++,Me=Ge[1],Ge=[0];continue;case 7:Ge=at.ops.pop(),at.trys.pop();continue;default:if(!((ye=(ye=at.trys).length>0&&ye[ye.length-1])||Ge[0]!==6&&Ge[0]!==2)){at=0;continue}if(Ge[0]===3&&(!ye||Ge[1]>ye[0]&&Ge[1]=200&&ie.status<=299},K=function(ie){return/ion\/(vnd\.api\+)?json/.test(ie.get("content-type")||"")};function G(ie){if(!(0,D.isPlainObject)(ie))return ie;for(var ue=w({},ie),xe=0,Me=Object.entries(ue);xe"u"&&at===O&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(an,Yt){return M(ue,null,function(){var Ve,Ct,Ft,Qt,Ln,Jt,yn,hn,Hr,pr,Tt,zn,Gn,hr,Pr,er,qn,Cn,An,Rn,jn,Fn,Zt,vt,Mt,nt,mt,St,Bt,Ue,Be,Oe,$e,Ne,Ke,Nt;return r(this,function(Ot){switch(Ot.label){case 0:return Ve=Yt.signal,Ct=Yt.getState,Ft=Yt.extra,Qt=Yt.endpoint,Ln=Yt.forced,Jt=Yt.type,Hr=(hn=typeof an=="string"?{url:an}:an).url,Tt=(pr=hn.headers)===void 0?new Headers(tn.headers):pr,Gn=(zn=hn.params)===void 0?void 0:zn,Pr=(hr=hn.responseHandler)===void 0?$t??"json":hr,qn=(er=hn.validateStatus)===void 0?Ut??T:er,An=(Cn=hn.timeout)===void 0?Et:Cn,Rn=I(hn,["url","headers","params","responseHandler","validateStatus","timeout"]),jn=w(S(w({},tn),{signal:Ve}),Rn),Tt=new Headers(G(Tt)),Fn=jn,[4,ye(Tt,{getState:Ct,extra:Ft,endpoint:Qt,forced:Ln,type:Jt})];case 1:Fn.headers=Ot.sent()||Tt,Zt=function(Ze){return typeof Ze=="object"&&((0,D.isPlainObject)(Ze)||Array.isArray(Ze)||typeof Ze.toJSON=="function")},!jn.headers.has("content-type")&&Zt(jn.body)&&jn.headers.set("content-type",Ee),Zt(jn.body)&&wt(jn.headers)&&(jn.body=JSON.stringify(jn.body,et)),Gn&&(vt=~Hr.indexOf("?")?"&":"?",Mt=Kt?Kt(Gn):new URLSearchParams(G(Gn)),Hr+=vt+Mt),Hr=function(Ze,cn){if(!Ze)return cn;if(!cn)return Ze;if(function(Sn){return new RegExp("(^|:)//").test(Sn)}(cn))return cn;var wn=Ze.endsWith("/")||!cn.startsWith("?")?"/":"";return Ze=function(Sn){return Sn.replace(/\/$/,"")}(Ze),""+Ze+wn+function(Sn){return Sn.replace(/^\//,"")}(cn)}(xe,Hr),nt=new Request(Hr,jn),mt=new Request(Hr,jn),yn={request:mt},Bt=!1,Ue=An&&setTimeout(function(){Bt=!0,Yt.abort()},An),Ot.label=2;case 2:return Ot.trys.push([2,4,5,6]),[4,at(nt)];case 3:return St=Ot.sent(),[3,6];case 4:return Be=Ot.sent(),[2,{error:{status:Bt?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Be)},meta:yn}];case 5:return Ue&&clearTimeout(Ue),[7];case 6:Oe=St.clone(),yn.response=Oe,Ne="",Ot.label=7;case 7:return Ot.trys.push([7,9,,10]),[4,Promise.all([ln(St,Pr).then(function(Ze){return $e=Ze},function(Ze){return Ke=Ze}),Oe.text().then(function(Ze){return Ne=Ze},function(){})])];case 8:if(Ot.sent(),Ke)throw Ke;return[3,10];case 9:return Nt=Ot.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:St.status,data:Ne,error:String(Nt)},meta:yn}];case 10:return[2,qn(St,$e)?{data:$e,meta:yn}:{error:{status:St.status,data:$e},meta:yn}]}})})};function ln(an,Yt){return M(this,null,function(){var Ve;return r(this,function(Ct){switch(Ct.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,(Ve=Ct.sent()).length?JSON.parse(Ve):null];case 2:return[2,an.text()]}})})}}var Z=function(ie,ue){ue===void 0&&(ue=void 0),this.value=ie,this.meta=ue};function te(ie,ue){return ie===void 0&&(ie=0),ue===void 0&&(ue=5),M(this,null,function(){var xe,Me;return r(this,function(ye){switch(ye.label){case 0:return xe=Math.min(ie,ue),Me=~~((Math.random()+.4)*(300<=$e)}var jn=(0,ze.createAsyncThunk)(Gn+"/executeQuery",An,{getPendingMeta:function(){var vt;return(vt={startedTimeStamp:Date.now()})[ze.SHOULD_AUTOBATCH]=!0,vt},condition:function(vt,Mt){var nt,mt,St,Bt=(0,Mt.getState)(),Ue=(mt=(nt=Bt[Gn])==null?void 0:nt.queries)==null?void 0:mt[vt.queryCacheKey],Be=Ue==null?void 0:Ue.fulfilledTimeStamp,Oe=vt.originalArgs,$e=Ue==null?void 0:Ue.originalArgs,Ne=Pr[vt.endpointName];return!(!de(vt)&&((Ue==null?void 0:Ue.status)==="pending"||!Rn(vt,Bt)&&(!W(Ne)||!((St=Ne==null?void 0:Ne.forceRefetch)!=null&&St.call(Ne,{currentArg:Oe,previousArg:$e,endpointState:Ue,state:Bt})))&&Be))},dispatchConditionRejection:!0}),Fn=(0,ze.createAsyncThunk)(Gn+"/executeMutation",An,{getPendingMeta:function(){var vt;return(vt={startedTimeStamp:Date.now()})[ze.SHOULD_AUTOBATCH]=!0,vt}});function Zt(vt){return function(Mt){var nt,mt;return((mt=(nt=Mt==null?void 0:Mt.meta)==null?void 0:nt.arg)==null?void 0:mt.endpointName)===vt}}return{queryThunk:jn,mutationThunk:Fn,prefetch:function(vt,Mt,nt){return function(mt,St){var Bt=function(Ne){return"force"in Ne}(nt)&&nt.force,Ue=function(Ne){return"ifOlderThan"in Ne}(nt)&&nt.ifOlderThan,Be=function(Ne){return Ne===void 0&&(Ne=!0),qn.endpoints[vt].initiate(Mt,{forceRefetch:Ne})},Oe=qn.endpoints[vt].select(Mt)(St());if(Bt)mt(Be());else if(Ue){var $e=Oe==null?void 0:Oe.fulfilledTimeStamp;if(!$e)return void mt(Be());(Number(new Date)-Number(new Date($e)))/1e3>=Ue&&mt(Be())}else mt(Be(!1))}},updateQueryData:function(vt,Mt,nt,mt){return mt===void 0&&(mt=!0),function(St,Bt){var Ue,Be,Oe,$e=qn.endpoints[vt].select(Mt)(Bt()),Ne={patches:[],inversePatches:[],undo:function(){return St(qn.util.patchQueryData(vt,Mt,Ne.inversePatches,mt))}};if($e.status===t.uninitialized)return Ne;if("data"in $e)if((0,Pe.isDraftable)($e.data)){var Ke=(0,Pe.produceWithPatches)($e.data,nt),Nt=Ke[0],Ot=Ke[2];(Ue=Ne.patches).push.apply(Ue,Ke[1]),(Be=Ne.inversePatches).push.apply(Be,Ot),Oe=Nt}else Oe=nt($e.data),Ne.patches.push({op:"replace",path:[],value:Oe}),Ne.inversePatches.push({op:"replace",path:[],value:$e.data});return St(qn.util.patchQueryData(vt,Mt,Ne.patches,mt)),Ne}},upsertQueryData:function(vt,Mt,nt){return function(mt){var St;return mt(qn.endpoints[vt].initiate(Mt,((St={subscribe:!1,forceRefetch:!0})[he]=function(){return{data:nt}},St)))}},patchQueryData:function(vt,Mt,nt,mt){return function(St,Bt){var Ue=Pr[vt],Be=er({queryArgs:Mt,endpointDefinition:Ue,endpointName:vt});if(St(qn.internalActions.queryResultPatched({queryCacheKey:Be,patches:nt})),mt){var Oe=qn.endpoints[vt].select(Mt)(Bt()),$e=U(Ue.providesTags,Oe.data,void 0,Mt,{},Cn);St(qn.internalActions.updateProvidedBy({queryCacheKey:Be,providedTags:$e}))}}},buildMatchThunkActions:function(vt,Mt){return{matchPending:(0,_e.isAllOf)((0,_e.isPending)(vt),Zt(Mt)),matchFulfilled:(0,_e.isAllOf)((0,_e.isFulfilled)(vt),Zt(Mt)),matchRejected:(0,_e.isAllOf)((0,_e.isRejected)(vt),Zt(Mt))}}}}({baseQuery:Me,reducerPath:ye,context:xe,api:ie,serializeQueryArgs:pt,assertTagType:Ge}),et=Ee.queryThunk,Et=Ee.mutationThunk,$t=Ee.patchQueryData,Ut=Ee.updateQueryData,tn=Ee.upsertQueryData,ln=Ee.prefetch,an=Ee.buildMatchThunkActions,Yt=function(Tt){var zn=Tt.reducerPath,Gn=Tt.queryThunk,hr=Tt.mutationThunk,Pr=Tt.context,er=Pr.endpointDefinitions,qn=Pr.apiUid,Cn=Pr.extractRehydrationInfo,An=Pr.hasRehydrationInfo,Rn=Tt.assertTagType,jn=Tt.config,Fn=(0,J.createAction)(zn+"/resetApiState"),Zt=(0,J.createSlice)({name:zn+"/queries",initialState:it,reducers:{removeQueryResult:{reducer:function(Ue,Be){delete Ue[Be.payload.queryCacheKey]},prepare:(0,J.prepareAutoBatched)()},queryResultPatched:{reducer:function(Ue,Be){var Oe=Be.payload,$e=Oe.patches;jt(Ue,Oe.queryCacheKey,function(Ne){Ne.data=(0,Pt.applyPatches)(Ne.data,$e.concat())})},prepare:(0,J.prepareAutoBatched)()}},extraReducers:function(Ue){Ue.addCase(Gn.pending,function(Be,Oe){var $e,Ne=Oe.meta,Ke=Oe.meta.arg,Nt=de(Ke);(Ke.subscribe||Nt)&&(Be[$e=Ke.queryCacheKey]!=null||(Be[$e]={status:t.uninitialized,endpointName:Ke.endpointName})),jt(Be,Ke.queryCacheKey,function(Ot){Ot.status=t.pending,Ot.requestId=Nt&&Ot.requestId?Ot.requestId:Ne.requestId,Ke.originalArgs!==void 0&&(Ot.originalArgs=Ke.originalArgs),Ot.startedTimeStamp=Ne.startedTimeStamp})}).addCase(Gn.fulfilled,function(Be,Oe){var $e=Oe.meta,Ne=Oe.payload;jt(Be,$e.arg.queryCacheKey,function(Ke){var Nt;if(Ke.requestId===$e.requestId||de($e.arg)){var Ot=er[$e.arg.endpointName].merge;if(Ke.status=t.fulfilled,Ot)if(Ke.data!==void 0){var Ze=$e.fulfilledTimeStamp,cn=$e.arg,wn=$e.baseQueryMeta,Sn=$e.requestId,Er=(0,J.createNextState)(Ke.data,function(cr){return Ot(cr,Ne,{arg:cn.originalArgs,baseQueryMeta:wn,fulfilledTimeStamp:Ze,requestId:Sn})});Ke.data=Er}else Ke.data=Ne;else Ke.data=(Nt=er[$e.arg.endpointName].structuralSharing)==null||Nt?R((0,qt.isDraft)(Ke.data)?(0,Pt.original)(Ke.data):Ke.data,Ne):Ne;delete Ke.error,Ke.fulfilledTimeStamp=$e.fulfilledTimeStamp}})}).addCase(Gn.rejected,function(Be,Oe){var $e=Oe.meta,Ne=$e.condition,Ke=$e.requestId,Nt=Oe.error,Ot=Oe.payload;jt(Be,$e.arg.queryCacheKey,function(Ze){if(!Ne){if(Ze.requestId!==Ke)return;Ze.status=t.rejected,Ze.error=Ot??Nt}})}).addMatcher(An,function(Be,Oe){for(var $e=Cn(Oe).queries,Ne=0,Ke=Object.entries($e);Ne"u"||navigator.onLine===void 0||navigator.onLine,focused:typeof document>"u"||document.visibilityState!=="hidden",middlewareRegistered:!1},jn),reducers:{middlewareRegistered:function(Ue,Be){Ue.middlewareRegistered=Ue.middlewareRegistered!=="conflict"&&qn===Be.payload||"conflict"}},extraReducers:function(Ue){Ue.addCase(ae,function(Be){Be.online=!0}).addCase(B,function(Be){Be.online=!1}).addCase(se,function(Be){Be.focused=!0}).addCase(re,function(Be){Be.focused=!1}).addMatcher(An,function(Be){return w({},Be)})}}),Bt=(0,J.combineReducers)({queries:Zt.reducer,mutations:vt.reducer,provided:Mt.reducer,subscriptions:mt.reducer,config:St.reducer});return{reducer:function(Ue,Be){return Bt(Fn.match(Be)?void 0:Ue,Be)},actions:S(w(w(w(w(w(w({},St.actions),Zt.actions),nt.actions),mt.actions),vt.actions),Mt.actions),{unsubscribeMutationResult:vt.actions.removeMutationResult,resetApiState:Fn})}}({context:xe,queryThunk:et,mutationThunk:Et,reducerPath:ye,assertTagType:Ge,config:{refetchOnFocus:gt,refetchOnReconnect:wt,refetchOnMountOrArgChange:Kt,keepUnusedDataFor:at,reducerPath:ye}}),Ve=Yt.reducer,Ct=Yt.actions;Br(ie.util,{patchQueryData:$t,updateQueryData:Ut,upsertQueryData:tn,prefetch:ln,resetApiState:Ct.resetApiState}),Br(ie.internalActions,Ct);var Ft=function(Tt){var zn=Tt.reducerPath,Gn=Tt.queryThunk,hr=Tt.api,Pr=Tt.context,er=Pr.apiUid,qn={invalidateTags:(0,ar.createAction)(zn+"/invalidateTags")},Cn=[Nr,vn,Tr,ir,Mn,co];return{middleware:function(Rn){var jn=!1,Fn=S(w({},Tt),{internalState:{currentSubscriptions:{}},refetchQuery:An}),Zt=Cn.map(function(nt){return nt(Fn)}),vt=function(nt){var mt=nt.api,St=nt.queryThunk,Bt=nt.internalState,Ue=mt.reducerPath+"/subscriptions",Be=null,Oe=!1,$e=mt.internalActions,Ne=$e.updateSubscriptionOptions,Ke=$e.unsubscribeQueryResult;return function(Nt,Ot){var Ze,cn;if(Be||(Be=JSON.parse(JSON.stringify(Bt.currentSubscriptions))),mt.util.resetApiState.match(Nt))return Be=Bt.currentSubscriptions={},[!0,!1];if(mt.internalActions.internal_probeSubscription.match(Nt)){var wn=Nt.payload;return[!1,!!((Ze=Bt.currentSubscriptions[wn.queryCacheKey])!=null&&Ze[wn.requestId])]}var Sn=function(_n,ur){var po,dr,mn,Qr,Xr,Ai,ap,ns,qa;if(Ne.match(ur)){var pa=ur.payload,Ka=pa.queryCacheKey,jo=pa.requestId;return(po=_n==null?void 0:_n[Ka])!=null&&po[jo]&&(_n[Ka][jo]=pa.options),!0}if(Ke.match(ur)){var _o=ur.payload;return jo=_o.requestId,_n[Ka=_o.queryCacheKey]&&delete _n[Ka][jo],!0}if(mt.internalActions.removeQueryResult.match(ur))return delete _n[ur.payload.queryCacheKey],!0;if(St.pending.match(ur)){var Io=ur.meta;if(jo=Io.requestId,(ho=Io.arg).subscribe)return(vs=(mn=_n[dr=ho.queryCacheKey])!=null?mn:_n[dr]={})[jo]=(Xr=(Qr=ho.subscriptionOptions)!=null?Qr:vs[jo])!=null?Xr:{},!0}if(St.rejected.match(ur)){var vs,rs=ur.meta,ho=rs.arg;if(jo=rs.requestId,rs.condition&&ho.subscribe)return(vs=(ap=_n[Ai=ho.queryCacheKey])!=null?ap:_n[Ai]={})[jo]=(qa=(ns=ho.subscriptionOptions)!=null?ns:vs[jo])!=null?qa:{},!0}return!1}(Bt.currentSubscriptions,Nt);if(Sn){Oe||(Lo(function(){var _n=JSON.parse(JSON.stringify(Bt.currentSubscriptions)),ur=(0,$r.produceWithPatches)(Be,function(){return _n});Ot.next(mt.internalActions.subscriptionsUpdated(ur[1])),Be=_n,Oe=!1}),Oe=!0);var Er=!!((cn=Nt.type)!=null&&cn.startsWith(Ue)),cr=St.rejected.match(Nt)&&Nt.meta.condition&&!!Nt.meta.arg.subscribe;return[!Er&&!cr,!1]}return[!0,!1]}}(Fn),Mt=function(nt){var mt=nt.reducerPath,St=nt.context,Bt=nt.refetchQuery,Ue=nt.internalState,Be=nt.api.internalActions.removeQueryResult;function Oe($e,Ne){var Ke=$e.getState()[mt],Nt=Ke.queries,Ot=Ue.currentSubscriptions;St.batch(function(){for(var Ze=0,cn=Object.keys(Ot);Ze{const{boardToDelete:t,setBoardToDelete:n}=e,{t:r}=Q(),o=H(j=>j.config.canRestoreDeletedImagesFromBin),{currentData:s,isFetching:i}=KD((t==null?void 0:t.board_id)??zs.skipToken),c=l.useMemo(()=>me([we],j=>{const I=(s??[]).map(M=>MI(j,M));return{imageUsageSummary:{isInitialImage:ta(I,M=>M.isInitialImage),isCanvasImage:ta(I,M=>M.isCanvasImage),isNodesImage:ta(I,M=>M.isNodesImage),isControlImage:ta(I,M=>M.isControlImage)}}}),[s]),[d,{isLoading:p}]=QD(),[h,{isLoading:m}]=XD(),{imageUsageSummary:g}=H(c),b=l.useCallback(()=>{t&&(d(t.board_id),n(void 0))},[t,d,n]),y=l.useCallback(()=>{t&&(h(t.board_id),n(void 0))},[t,h,n]),x=l.useCallback(()=>{n(void 0)},[n]),w=l.useRef(null),S=l.useMemo(()=>m||p||i,[m,p,i]);return t?a.jsx(Wf,{isOpen:!!t,onClose:x,leastDestructiveRef:w,isCentered:!0,children:a.jsx(Aa,{children:a.jsxs(Vf,{children:[a.jsxs(Oa,{fontSize:"lg",fontWeight:"bold",children:[r("controlnet.delete")," ",t.board_name]}),a.jsx(Ra,{children:a.jsxs(N,{direction:"column",gap:3,children:[i?a.jsx(Wg,{children:a.jsx(N,{sx:{w:"full",h:32}})}):a.jsx(zM,{imageUsage:g,topMessage:r("boards.topMessage"),bottomMessage:r("boards.bottomMessage")}),a.jsx(je,{children:r("boards.deletedBoardsCannotbeRestored")}),a.jsx(je,{children:r(o?"gallery.deleteImageBin":"gallery.deleteImagePermanent")})]})}),a.jsx(pi,{children:a.jsxs(N,{sx:{justifyContent:"space-between",width:"full",gap:2},children:[a.jsx(Dt,{ref:w,onClick:x,children:r("boards.cancel")}),a.jsx(Dt,{colorScheme:"warning",isLoading:S,onClick:b,children:r("boards.deleteBoardOnly")}),a.jsx(Dt,{colorScheme:"error",isLoading:S,onClick:y,children:r("boards.deleteBoardAndImages")})]})})]})})}):null},Bne=l.memo(Fne),Hne=()=>{const{t:e}=Q(),[t,{isLoading:n}]=YD(),r=e("boards.myBoard"),o=l.useCallback(()=>{t(r)},[t,r]);return a.jsx(rt,{icon:a.jsx(Zi,{}),isLoading:n,tooltip:e("boards.addBoard"),"aria-label":e("boards.addBoard"),onClick:o,size:"sm","data-testid":"add-board-button"})},Wne=l.memo(Hne);var BO=Cg({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"})]})}),b0=Cg({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),Vne=Cg({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"}),Une=Cg({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 Gne=me([we],({gallery:e})=>{const{boardSearchText:t}=e;return{boardSearchText:t}},Ie),qne=()=>{const e=le(),{boardSearchText:t}=H(Gne),n=l.useRef(null),{t:r}=Q(),o=l.useCallback(d=>{e(Uw(d))},[e]),s=l.useCallback(()=>{e(Uw(""))},[e]),i=l.useCallback(d=>{d.key==="Escape"&&s()},[s]),c=l.useCallback(d=>{o(d.target.value)},[o]);return l.useEffect(()=>{n.current&&n.current.focus()},[]),a.jsxs(B5,{children:[a.jsx(_g,{ref:n,placeholder:r("boards.searchBoard"),value:t,onKeyDown:i,onChange:c,"data-testid":"board-search-input"}),t&&t.length&&a.jsx(wy,{children:a.jsx(Ia,{onClick:s,size:"xs",variant:"ghost","aria-label":r("boards.clearSearch"),opacity:.5,icon:a.jsx(Vne,{boxSize:2})})})]})},Kne=l.memo(qne);function HO(e){return JD(e)}function Qne(e){return ZD(e)}const WO=(e,t)=>{var o,s;if(!e||!(t!=null&&t.data.current))return!1;const{actionType:n}=e,{payloadType:r}=t.data.current;if(e.id===t.data.current.id)return!1;switch(n){case"ADD_FIELD_TO_LINEAR":return r==="NODE_FIELD";case"SET_CURRENT_IMAGE":return r==="IMAGE_DTO";case"SET_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_CONTROL_ADAPTER_IMAGE":return r==="IMAGE_DTO";case"SET_CANVAS_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_NODES_IMAGE":return r==="IMAGE_DTO";case"SET_MULTI_NODES_IMAGE":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BATCH":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:c}=t.data.current.payload,d=c.board_id??"none",p=e.context.boardId;return d!==p}if(r==="IMAGE_DTOS"){const{imageDTOs:c}=t.data.current.payload,d=((o=c[0])==null?void 0:o.board_id)??"none",p=e.context.boardId;return d!==p}return!1}case"REMOVE_FROM_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:c}=t.data.current.payload;return(c.board_id??"none")!=="none"}if(r==="IMAGE_DTOS"){const{imageDTOs:c}=t.data.current.payload;return(((s=c[0])==null?void 0:s.board_id)??"none")!=="none"}return!1}default:return!1}},Xne=e=>{const{isOver:t,label:n="Drop"}=e,r=l.useRef(Jc()),{colorMode:o}=ji();return a.jsx(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsxs(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full"},children:[a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:Xe("base.700","base.900")(o),opacity:.7,borderRadius:"base",alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(N,{sx:{position:"absolute",top:.5,insetInlineStart:.5,insetInlineEnd:.5,bottom:.5,opacity:1,borderWidth:2,borderColor:t?Xe("base.50","base.50")(o):Xe("base.200","base.300")(o),borderRadius:"lg",borderStyle:"dashed",transitionProperty:"common",transitionDuration:"0.1s",alignItems:"center",justifyContent:"center"},children:a.jsx(Le,{sx:{fontSize:"2xl",fontWeight:600,transform:t?"scale(1.1)":"scale(1)",color:t?Xe("base.50","base.50")(o):Xe("base.200","base.300")(o),transitionProperty:"common",transitionDuration:"0.1s"},children:n})})]})},r.current)},VO=l.memo(Xne),Yne=e=>{const{dropLabel:t,data:n,disabled:r}=e,o=l.useRef(Jc()),{isOver:s,setNodeRef:i,active:c}=HO({id:o.current,disabled:r,data:n});return a.jsx(Le,{ref:i,position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",pointerEvents:c?"auto":"none",children:a.jsx(So,{children:WO(n,c)&&a.jsx(VO,{isOver:s,label:t})})})},C2=l.memo(Yne),Jne=({isSelected:e,isHovered:t})=>a.jsx(Le,{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}}}),w2=l.memo(Jne),Zne=()=>{const{t:e}=Q();return a.jsx(N,{sx:{position:"absolute",insetInlineEnd:0,top:0,p:1},children:a.jsx(Va,{variant:"solid",sx:{bg:"accent.400",_dark:{bg:"accent.500"}},children:e("common.auto")})})},UO=l.memo(Zne);function S2(e){const[t,n]=l.useState(!1),[r,o]=l.useState(!1),[s,i]=l.useState(!1),[c,d]=l.useState([0,0]),p=l.useRef(null),h=H(g=>g.ui.globalContextMenuCloseTrigger);l.useEffect(()=>{if(t)setTimeout(()=>{o(!0),setTimeout(()=>{i(!0)})});else{i(!1);const g=setTimeout(()=>{o(t)},1e3);return()=>clearTimeout(g)}},[t]),l.useEffect(()=>{n(!1),i(!1),o(!1)},[h]),WF("contextmenu",g=>{var b;(b=p.current)!=null&&b.contains(g.target)||g.target===p.current?(g.preventDefault(),n(!0),d([g.pageX,g.pageY])):n(!1)});const m=l.useCallback(()=>{var g,b;(b=(g=e.menuProps)==null?void 0:g.onClose)==null||b.call(g),n(!1)},[e.menuProps]);return a.jsxs(a.Fragment,{children:[e.children(p),r&&a.jsx(Au,{...e.portalProps,children:a.jsxs(Mg,{isOpen:s,gutter:0,...e.menuProps,onClose:m,children:[a.jsx(Og,{"aria-hidden":!0,w:1,h:1,style:{position:"absolute",left:c[0],top:c[1],cursor:"default"},...e.menuButtonProps}),e.renderMenu()]})})]})}const x0=e=>{const{boardName:t}=jf(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)||NI("boards.uncategorized")}}});return t},ere=({board:e,setBoardToDelete:t})=>{const{t:n}=Q(),r=l.useCallback(()=>{t&&t(e)},[e,t]);return a.jsxs(a.Fragment,{children:[e.image_count>0&&a.jsx(a.Fragment,{}),a.jsx(Kn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Zo,{}),onClick:r,children:n("boards.deleteBoard")})]})},tre=l.memo(ere),nre=()=>a.jsx(a.Fragment,{}),rre=l.memo(nre),ore=({board:e,board_id:t,setBoardToDelete:n,children:r})=>{const{t:o}=Q(),s=le(),i=l.useMemo(()=>me(we,({gallery:w})=>{const S=w.autoAddBoardId===t,j=w.autoAssignBoardOnClick;return{isAutoAdd:S,autoAssignBoardOnClick:j}},Ie),[t]),{isAutoAdd:c,autoAssignBoardOnClick:d}=H(i),p=x0(t),h=Pn("bulkDownload").isFeatureEnabled,[m]=$I(),g=l.useCallback(()=>{s(mg(t))},[t,s]),b=l.useCallback(async()=>{try{const w=await m({image_names:[],board_id:t}).unwrap();s(Ht({title:o("gallery.preparingDownload"),status:"success",...w.response?{description:w.response}:{}}))}catch{s(Ht({title:o("gallery.preparingDownloadFailed"),status:"error"}))}},[o,t,m,s]),y=l.useCallback(w=>{w.preventDefault()},[]),x=l.useCallback(()=>a.jsx(ql,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:y,children:a.jsxs(af,{title:p,children:[a.jsx(Kn,{icon:a.jsx(Zi,{}),isDisabled:c||d,onClick:g,children:o("boards.menuItemAutoAdd")}),h&&a.jsx(Kn,{icon:a.jsx(Wu,{}),onClickCapture:b,children:o("boards.downloadBoard")}),!e&&a.jsx(rre,{}),e&&a.jsx(tre,{board:e,setBoardToDelete:n})]})}),[d,e,p,b,g,c,h,n,y,o]);return a.jsx(S2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:x,children:r})},GO=l.memo(ore),sre=({board:e,isSelected:t,setBoardToDelete:n})=>{const r=le(),o=l.useMemo(()=>me(we,({gallery:D})=>{const O=e.board_id===D.autoAddBoardId,T=D.autoAssignBoardOnClick;return{isSelectedForAutoAdd:O,autoAssignBoardOnClick:T}},Ie),[e.board_id]),{isSelectedForAutoAdd:s,autoAssignBoardOnClick:i}=H(o),[c,d]=l.useState(!1),p=l.useCallback(()=>{d(!0)},[]),h=l.useCallback(()=>{d(!1)},[]),{data:m}=Tx(e.board_id),{data:g}=Nx(e.board_id),b=l.useMemo(()=>{if(!((m==null?void 0:m.total)===void 0||(g==null?void 0:g.total)===void 0))return`${m.total} image${m.total===1?"":"s"}, ${g.total} asset${g.total===1?"":"s"}`},[g,m]),{currentData:y}=Rs(e.cover_image_name??zs.skipToken),{board_name:x,board_id:w}=e,[S,j]=l.useState(x),I=l.useCallback(()=>{r(LI({boardId:w})),i&&r(mg(w))},[w,i,r]),[_,{isLoading:M}]=e7(),E=l.useMemo(()=>({id:w,actionType:"ADD_TO_BOARD",context:{boardId:w}}),[w]),A=l.useCallback(async D=>{if(!D.trim()){j(x);return}if(D!==x)try{const{board_name:O}=await _({board_id:w,changes:{board_name:D}}).unwrap();j(O)}catch{j(x)}},[w,x,_]),R=l.useCallback(D=>{j(D)},[]);return a.jsx(Le,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(N,{onMouseOver:p,onMouseOut:h,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",w:"full",h:"full"},children:a.jsx(GO,{board:e,board_id:w,setBoardToDelete:n,children:D=>a.jsx(Wn,{label:b,openDelay:1e3,hasArrow:!0,children:a.jsxs(N,{ref:D,onClick:I,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(_i,{src:y==null?void 0:y.thumbnail_url,draggable:!1,sx:{objectFit:"cover",w:"full",h:"full",maxH:"full",borderRadius:"base",borderBottomRadius:"lg"}}):a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(Gr,{boxSize:12,as:Zee,sx:{mt:-6,opacity:.7,color:"base.500",_dark:{color:"base.500"}}})}),s&&a.jsx(UO,{}),a.jsx(w2,{isSelected:t,isHovered:c}),a.jsx(N,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:t?"accent.400":"base.500",color:t?"base.50":"base.100",_dark:{bg:t?"accent.500":"base.600",color:t?"base.50":"base.100"},lineHeight:"short",fontSize:"xs"},children:a.jsxs(Lf,{value:S,isDisabled:M,submitOnBlur:!0,onChange:R,onSubmit:A,sx:{w:"full"},children:[a.jsx($f,{sx:{p:0,fontWeight:t?700:500,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},noOfLines:1}),a.jsx(Nf,{sx:{p:0,_focusVisible:{p:0,textAlign:"center",boxShadow:"none"}}})]})}),a.jsx(C2,{data:E,dropLabel:a.jsx(je,{fontSize:"md",children:"Move"})})]})})})})})},are=l.memo(sre),ire=me(we,({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},Ie),qO=l.memo(({isSelected:e})=>{const t=le(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=H(ire),o=x0("none"),s=l.useCallback(()=>{t(LI({boardId:"none"})),r&&t(mg("none"))},[t,r]),[i,c]=l.useState(!1),{data:d}=Tx("none"),{data:p}=Nx("none"),h=l.useMemo(()=>{if(!((d==null?void 0:d.total)===void 0||(p==null?void 0:p.total)===void 0))return`${d.total} image${d.total===1?"":"s"}, ${p.total} asset${p.total===1?"":"s"}`},[p,d]),m=l.useCallback(()=>{c(!0)},[]),g=l.useCallback(()=>{c(!1)},[]),b=l.useMemo(()=>({id:"no_board",actionType:"REMOVE_FROM_BOARD"}),[]);return a.jsx(Le,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(N,{onMouseOver:m,onMouseOut:g,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",borderRadius:"base",w:"full",h:"full"},children:a.jsx(GO,{board_id:"none",children:y=>a.jsx(Wn,{label:h,openDelay:1e3,hasArrow:!0,children:a.jsxs(N,{ref:y,onClick:s,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(_i,{src:Rx,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(UO,{}),a.jsx(N,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:e?"accent.400":"base.500",color:e?"base.50":"base.100",_dark:{bg:e?"accent.500":"base.600",color:e?"base.50":"base.100"},lineHeight:"short",fontSize:"xs",fontWeight:e?700:500},children:o}),a.jsx(w2,{isSelected:e,isHovered:i}),a.jsx(C2,{data:b,dropLabel:a.jsx(je,{fontSize:"md",children:"Move"})})]})})})})})});qO.displayName="HoverableBoard";const lre=l.memo(qO),cre=me([we],({gallery:e})=>{const{selectedBoardId:t,boardSearchText:n}=e;return{selectedBoardId:t,boardSearchText:n}},Ie),ure=e=>{const{isOpen:t}=e,{selectedBoardId:n,boardSearchText:r}=H(cre),{data:o}=jf(),s=r?o==null?void 0:o.filter(d=>d.board_name.toLowerCase().includes(r.toLowerCase())):o,[i,c]=l.useState();return a.jsxs(a.Fragment,{children:[a.jsx(Af,{in:t,animateOpacity:!0,children:a.jsxs(N,{layerStyle:"first",sx:{flexDir:"column",gap:2,p:2,mt:2,borderRadius:"base"},children:[a.jsxs(N,{sx:{gap:2,alignItems:"center"},children:[a.jsx(Kne,{}),a.jsx(Wne,{})]}),a.jsx(v0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsxs(rl,{className:"list-container","data-testid":"boards-list",sx:{gridTemplateColumns:"repeat(auto-fill, minmax(108px, 1fr));",maxH:346},children:[a.jsx(rf,{sx:{p:1.5},"data-testid":"no-board",children:a.jsx(lre,{isSelected:n==="none"})}),s&&s.map((d,p)=>a.jsx(rf,{sx:{p:1.5},"data-testid":`board-${p}`,children:a.jsx(are,{board:d,isSelected:n===d.board_id,setBoardToDelete:c})},d.board_id))]})})]})}),a.jsx(Bne,{boardToDelete:i,setBoardToDelete:c})]})},dre=l.memo(ure),fre=me([we],e=>{const{selectedBoardId:t}=e.gallery;return{selectedBoardId:t}},Ie),pre=e=>{const{isOpen:t,onToggle:n}=e,{selectedBoardId:r}=H(fre),o=x0(r),s=l.useMemo(()=>o.length>20?`${o.substring(0,20)}...`:o,[o]);return a.jsxs(N,{as:nl,onClick:n,size:"sm",sx:{position:"relative",gap:2,w:"full",justifyContent:"space-between",alignItems:"center",px:2},children:[a.jsx(je,{noOfLines:1,sx:{fontWeight:600,w:"100%",textAlign:"center",color:"base.800",_dark:{color:"base.200"}},children:s}),a.jsx(b0,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]})},hre=l.memo(pre),mre=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return a.jsxs(Uf,{isLazy:o,...s,children:[a.jsx(Bg,{children:t}),a.jsxs(Gf,{shadow:"dark-lg",children:[r&&a.jsx(C3,{}),n]})]})},tp=l.memo(mre);function gre(e){return Ye({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 KO=De((e,t)=>{const[n,r]=l.useState(!1),{label:o,value:s,min:i=1,max:c=100,step:d=1,onChange:p,tooltipSuffix:h="",withSliderMarks:m=!1,withInput:g=!1,isInteger:b=!1,inputWidth:y=16,withReset:x=!1,hideTooltip:w=!1,isCompact:S=!1,isDisabled:j=!1,sliderMarks:I,handleReset:_,sliderFormControlProps:M,sliderFormLabelProps:E,sliderMarkProps:A,sliderTrackProps:R,sliderThumbProps:D,sliderNumberInputProps:O,sliderNumberInputFieldProps:T,sliderNumberInputStepperProps:K,sliderTooltipProps:G,sliderIAIIconButtonProps:X,...Z}=e,te=le(),{t:V}=Q(),[oe,ne]=l.useState(String(s));l.useEffect(()=>{ne(s)},[s]);const se=l.useMemo(()=>O!=null&&O.min?O.min:i,[i,O==null?void 0:O.min]),re=l.useMemo(()=>O!=null&&O.max?O.max:c,[c,O==null?void 0:O.max]),ae=l.useCallback(J=>{p(J)},[p]),B=l.useCallback(J=>{J.target.value===""&&(J.target.value=String(se));const ge=Hl(b?Math.floor(Number(J.target.value)):Number(oe),se,re),he=Pd(ge,d);p(he),ne(he)},[b,oe,se,re,p,d]),Y=l.useCallback(J=>{ne(J)},[]),$=l.useCallback(()=>{_&&_()},[_]),F=l.useCallback(J=>{J.target instanceof HTMLDivElement&&J.target.focus()},[]),q=l.useCallback(J=>{J.shiftKey&&te(Qo(!0))},[te]),pe=l.useCallback(J=>{J.shiftKey||te(Qo(!1))},[te]),W=l.useCallback(()=>r(!0),[]),U=l.useCallback(()=>r(!1),[]),ee=l.useCallback(()=>p(Number(oe)),[oe,p]);return a.jsxs(Vn,{ref:t,onClick:F,sx:S?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},isDisabled:j,...M,children:[o&&a.jsx(yr,{sx:g?{mb:-1.5}:{},...E,children:o}),a.jsxs(Pg,{w:"100%",gap:2,alignItems:"center",children:[a.jsxs(Ny,{"aria-label":o,value:s,min:i,max:c,step:d,onChange:ae,onMouseEnter:W,onMouseLeave:U,focusThumbOnChange:!1,isDisabled:j,...Z,children:[m&&!I&&a.jsxs(a.Fragment,{children:[a.jsx(Fc,{value:i,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...A,children:i}),a.jsx(Fc,{value:c,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...A,children:c})]}),m&&I&&a.jsx(a.Fragment,{children:I.map((J,ge)=>ge===0?a.jsx(Fc,{value:J,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...A,children:J},J):ge===I.length-1?a.jsx(Fc,{value:J,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...A,children:J},J):a.jsx(Fc,{value:J,sx:{transform:"translateX(-50%)"},...A,children:J},J))}),a.jsx(Ly,{...R,children:a.jsx(zy,{})}),a.jsx(Wn,{hasArrow:!0,placement:"top",isOpen:n,label:`${s}${h}`,hidden:w,...G,children:a.jsx($y,{...D,zIndex:0})})]}),g&&a.jsxs(Tg,{min:se,max:re,step:d,value:oe,onChange:Y,onBlur:B,focusInputOnChange:!1,...O,children:[a.jsx($g,{onKeyDown:q,onKeyUp:pe,minWidth:y,...T}),a.jsxs(Ng,{...K,children:[a.jsx(zg,{onClick:ee}),a.jsx(Lg,{onClick:ee})]})]}),x&&a.jsx(rt,{size:"sm","aria-label":V("accessibility.reset"),tooltip:V("accessibility.reset"),icon:a.jsx(gre,{}),isDisabled:j,onClick:$,...X})]})]})});KO.displayName="IAISlider";const It=l.memo(KO),QO=l.forwardRef(({label:e,tooltip:t,description:n,disabled:r,...o},s)=>a.jsx(Wn,{label:t,placement:"top",hasArrow:!0,openDelay:500,children:a.jsx(Le,{ref:s,...o,children:a.jsxs(Le,{children:[a.jsx(xu,{children:e}),n&&a.jsx(xu,{size:"xs",color:"base.600",children:n})]})})}));QO.displayName="IAIMantineSelectItemWithTooltip";const pl=l.memo(QO),vre=me([we],({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},Ie),bre=()=>{const e=le(),{t}=Q(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=H(vre),o=l.useRef(null),{boards:s,hasBoards:i}=jf(void 0,{selectFromResult:({data:p})=>{const h=[{label:"None",value:"none"}];return p==null||p.forEach(({board_id:m,board_name:g})=>{h.push({label:g,value:m})}),{boards:h,hasBoards:h.length>1}}}),c=l.useCallback(p=>{p&&e(mg(p))},[e]),d=l.useCallback((p,h)=>{var m;return((m=h.label)==null?void 0:m.toLowerCase().includes(p.toLowerCase().trim()))||h.value.toLowerCase().includes(p.toLowerCase().trim())},[]);return a.jsx(sr,{label:t("boards.autoAddBoard"),inputRef:o,autoFocus:!0,placeholder:t("boards.selectBoard"),value:n,data:s,nothingFound:t("boards.noMatching"),itemComponent:pl,disabled:!i||r,filter:d,onChange:c})},xre=l.memo(bre),yre=e=>{const{label:t,...n}=e,{colorMode:r}=ji();return a.jsx(Tf,{colorScheme:"accent",...n,children:a.jsx(je,{sx:{fontSize:"sm",color:Xe("base.800","base.200")(r)},children:t})})},Eo=l.memo(yre),Cre=me([we],e=>{const{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}=e.gallery;return{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}},Ie),wre=()=>{const e=le(),{t}=Q(),{galleryImageMinimumWidth:n,shouldAutoSwitch:r,autoAssignBoardOnClick:o}=H(Cre),s=l.useCallback(p=>{e(Gw(p))},[e]),i=l.useCallback(()=>{e(Gw(64))},[e]),c=l.useCallback(p=>{e(t7(p.target.checked))},[e]),d=l.useCallback(p=>e(n7(p.target.checked)),[e]);return a.jsx(tp,{triggerComponent:a.jsx(rt,{tooltip:t("gallery.gallerySettings"),"aria-label":t("gallery.gallerySettings"),size:"sm",icon:a.jsx(nO,{})}),children:a.jsxs(N,{direction:"column",gap:2,children:[a.jsx(It,{value:n,onChange:s,min:45,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:i}),a.jsx(_r,{label:t("gallery.autoSwitchNewImages"),isChecked:r,onChange:c}),a.jsx(Eo,{label:t("gallery.autoAssignBoardOnClick"),isChecked:o,onChange:d}),a.jsx(xre,{})]})})},Sre=l.memo(wre),kre=e=>e.image?a.jsx(Wg,{sx:{w:`${e.image.width}px`,h:"auto",objectFit:"contain",aspectRatio:`${e.image.width}/${e.image.height}`}}):a.jsx(N,{sx:{opacity:.7,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(Ci,{size:"xl"})}),eo=e=>{const{icon:t=Xl,boxSize:n=16,sx:r,...o}=e;return a.jsxs(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...r},...o,children:[t&&a.jsx(Gr,{as:t,boxSize:n,opacity:.7}),e.label&&a.jsx(je,{textAlign:"center",children:e.label})]})},jre=e=>{const{sx:t,...n}=e;return a.jsxs(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...t},...n,children:[a.jsx(Ci,{size:"xl"}),e.label&&a.jsx(je,{textAlign:"center",children:e.label})]})},y0=0,hl=1,Gu=2,XO=4;function YO(e,t){return n=>e(t(n))}function _re(e,t){return t(e)}function JO(e,t){return n=>e(t,n)}function n_(e,t){return()=>e(t)}function C0(e,t){return t(e),e}function Cr(...e){return e}function Ire(e){e()}function r_(e){return()=>e}function Pre(...e){return()=>{e.map(Ire)}}function k2(e){return e!==void 0}function qu(){}function Zn(e,t){return e(hl,t)}function pn(e,t){e(y0,t)}function j2(e){e(Gu)}function us(e){return e(XO)}function Lt(e,t){return Zn(e,JO(t,y0))}function xi(e,t){const n=e(hl,r=>{n(),t(r)});return n}function On(){const e=[];return(t,n)=>{switch(t){case Gu:e.splice(0,e.length);return;case hl:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case y0:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function st(e){let t=e;const n=On();return(r,o)=>{switch(r){case hl:o(t);break;case y0:t=o;break;case XO:return t}return n(r,o)}}function Ere(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case hl:return s?n===s?void 0:(r(),n=s,t=Zn(e,s),t):(r(),qu);case Gu:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function fs(e){return C0(On(),t=>Lt(e,t))}function Oo(e,t){return C0(st(t),n=>Lt(e,n))}function Mre(...e){return t=>e.reduceRight(_re,t)}function He(e,...t){const n=Mre(...t);return(r,o)=>{switch(r){case hl:return Zn(e,n(o));case Gu:j2(e);return}}}function ZO(e,t){return e===t}function br(e=ZO){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function rn(e){return t=>n=>{e(n)&&t(n)}}function yt(e){return t=>YO(t,e)}function ti(e){return t=>()=>t(e)}function ja(e,t){return n=>r=>n(t=e(t,r))}function _u(e){return t=>n=>{e>0?e--:t(n)}}function Xi(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function o_(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function bn(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const c=Math.pow(2,i);Zn(s,d=>{const p=n;n=n|c,t[i]=d,p!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const c=()=>s([i].concat(t));n===o?c():r=c}}function s_(...e){return function(t,n){switch(t){case hl:return Pre(...e.map(r=>Zn(r,n)));case Gu:return;default:throw new Error(`unrecognized action ${t}`)}}}function nn(e,t=ZO){return He(e,br(t))}function ao(...e){const t=On(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const c=Math.pow(2,i);Zn(s,d=>{n[i]=d,r=r|c,r===o&&pn(t,n)})}),function(s,i){switch(s){case hl:return r===o&&i(n),Zn(t,i);case Gu:return j2(t);default:throw new Error(`unrecognized action ${s}`)}}}function Yn(e,t=[],{singleton:n}={singleton:!0}){return{id:Ore(),constructor:e,dependencies:t,singleton:n}}const Ore=()=>Symbol();function Are(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:i})=>{if(i&&t.has(r))return t.get(r);const c=o(s.map(d=>n(d)));return i&&t.set(r,c),c};return n(e)}function Rre(e,t){const n={},r={};let o=0;const s=e.length;for(;o(w[S]=j=>{const I=x[t.methods[S]];pn(I,j)},w),{})}function h(x){return i.reduce((w,S)=>(w[S]=Ere(x[t.events[S]]),w),{})}return{Component:z.forwardRef((x,w)=>{const{children:S,...j}=x,[I]=z.useState(()=>C0(Are(e),M=>d(M,j))),[_]=z.useState(n_(h,I));return xh(()=>{for(const M of i)M in j&&Zn(_[M],j[M]);return()=>{Object.values(_).map(j2)}},[j,_,I]),xh(()=>{d(I,j)}),z.useImperativeHandle(w,r_(p(I))),z.createElement(c.Provider,{value:I},n?z.createElement(n,Rre([...r,...o,...i],j),S):S)}),usePublisher:x=>z.useCallback(JO(pn,z.useContext(c)[x]),[x]),useEmitterValue:x=>{const S=z.useContext(c)[x],[j,I]=z.useState(n_(us,S));return xh(()=>Zn(S,_=>{_!==j&&I(r_(_))}),[S,j]),j},useEmitter:(x,w)=>{const j=z.useContext(c)[x];xh(()=>Zn(j,w),[w,j])}}}const Dre=typeof document<"u"?z.useLayoutEffect:z.useEffect,Tre=Dre;var ps=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(ps||{});const Nre={0:"debug",1:"log",2:"warn",3:"error"},$re=()=>typeof globalThis>"u"?window:globalThis,ml=Yn(()=>{const e=st(3);return{log:st((n,r,o=1)=>{var s;const i=(s=$re().VIRTUOSO_LOG_LEVEL)!=null?s:us(e);o>=i&&console[Nre[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function _2(e,t=!0){const n=z.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=z.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 ac(e,t=!0){return _2(e,t).callbackRef}function Lre(e,t,n,r,o,s,i){const c=z.useCallback(d=>{const p=zre(d.children,t,"offsetHeight",o);let h=d.parentElement;for(;!h.dataset.virtuosoScroller;)h=h.parentElement;const m=h.lastElementChild.dataset.viewportType==="window",g=i?i.scrollTop:m?window.pageYOffset||document.documentElement.scrollTop:h.scrollTop,b=i?i.scrollHeight:m?document.documentElement.scrollHeight:h.scrollHeight,y=i?i.offsetHeight:m?window.innerHeight:h.offsetHeight;r({scrollTop:Math.max(g,0),scrollHeight:b,viewportHeight:y}),s==null||s(Fre("row-gap",getComputedStyle(d).rowGap,o)),p!==null&&e(p)},[e,t,o,s,i,r]);return _2(c,n)}function zre(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i{const g=m.target,b=g===window||g===document,y=b?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,x=b?document.documentElement.scrollHeight:g.scrollHeight,w=b?window.innerHeight:g.offsetHeight,S=()=>{e({scrollTop:Math.max(y,0),scrollHeight:x,viewportHeight:w})};m.suppressFlushSync?S():r7.flushSync(S),i.current!==null&&(y===i.current||y<=0||y===x-w)&&(i.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t]);z.useEffect(()=>{const m=o||s.current;return r(o||s.current),d({target:m,suppressFlushSync:!0}),m.addEventListener("scroll",d,{passive:!0}),()=>{r(null),m.removeEventListener("scroll",d)}},[s,d,n,r,o]);function p(m){const g=s.current;if(!g||"offsetHeight"in g&&g.offsetHeight===0)return;const b=m.behavior==="smooth";let y,x,w;g===window?(x=Math.max(il(document.documentElement,"height"),document.documentElement.scrollHeight),y=window.innerHeight,w=document.documentElement.scrollTop):(x=g.scrollHeight,y=il(g,"height"),w=g.scrollTop);const S=x-y;if(m.top=Math.ceil(Math.max(Math.min(S,m.top),0)),t8(y,x)||m.top===w){e({scrollTop:w,scrollHeight:x,viewportHeight:y}),b&&t(!0);return}b?(i.current=m.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,i.current=null,t(!0)},1e3)):i.current=null,g.scrollTo(m)}function h(m){s.current.scrollBy(m)}return{scrollerRef:s,scrollByCallback:h,scrollToCallback:p}}const $o=Yn(()=>{const e=On(),t=On(),n=st(0),r=On(),o=st(0),s=On(),i=On(),c=st(0),d=st(0),p=st(0),h=st(0),m=On(),g=On(),b=st(!1);return Lt(He(e,yt(({scrollTop:y})=>y)),t),Lt(He(e,yt(({scrollHeight:y})=>y)),i),Lt(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:c,fixedHeaderHeight:d,fixedFooterHeight:p,footerHeight:h,scrollHeight:i,smoothScrollTargetReached:r,scrollTo:m,scrollBy:g,statefulScrollTop:o,deviation:n,scrollingInProgress:b}},[],{singleton:!0}),hf={lvl:0};function r8(e,t,n,r=hf,o=hf){return{k:e,v:t,lvl:n,l:r,r:o}}function or(e){return e===hf}function uu(){return hf}function ax(e,t){if(or(e))return hf;const{k:n,l:r,r:o}=e;if(t===n){if(or(r))return o;if(or(o))return r;{const[s,i]=o8(r);return Lh(Zr(e,{k:s,v:i,l:s8(r)}))}}else return tt&&(c=c.concat(ix(s,t,n))),r>=t&&r<=n&&c.push({k:r,v:o}),r<=n&&(c=c.concat(ix(i,t,n))),c}function Rl(e){return or(e)?[]:[...Rl(e.l),{k:e.k,v:e.v},...Rl(e.r)]}function o8(e){return or(e.r)?[e.k,e.v]:o8(e.r)}function s8(e){return or(e.r)?e.l:Lh(Zr(e,{r:s8(e.r)}))}function Zr(e,t){return r8(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 E1(e){return or(e)||e.lvl>e.r.lvl}function a_(e){return lx(i8(e))}function Lh(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(E1(t))return i8(Zr(e,{lvl:r-1}));if(!or(t)&&!or(t.r))return Zr(t.r,{l:Zr(t,{r:t.r.l}),r:Zr(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(E1(e))return lx(Zr(e,{lvl:r-1}));if(!or(n)&&!or(n.l)){const o=n.l,s=E1(o)?n.lvl-1:n.lvl;return Zr(o,{l:Zr(e,{r:o.l,lvl:r-1}),r:lx(Zr(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function w0(e,t,n){if(or(e))return[];const r=ca(e,t)[0];return Bre(ix(e,r,n))}function a8(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 lx(e){const{r:t,lvl:n}=e;return!or(t)&&!or(t.r)&&t.lvl===n&&t.r.lvl===n?Zr(t,{l:Zr(e,{r:t.l}),lvl:n+1}):e}function i8(e){const{l:t}=e;return!or(t)&&t.lvl===e.lvl?Zr(t,{r:Zr(e,{l:t.r})}):e}function og(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],c=n(i,t);if(c===0)return s;if(c===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function l8(e,t,n){return e[og(e,t,n)]}function Hre(e,t,n,r){const o=og(e,t,r),s=og(e,n,r,o);return e.slice(o,s+1)}const I2=Yn(()=>({recalcInProgress:st(!1)}),[],{singleton:!0});function Wre(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 i_(e,t){let n=0,r=0;for(;n=h||o===g)&&(e=ax(e,h)):(p=g!==o,d=!0),m>i&&i>=h&&g!==o&&(e=cs(e,i+1,g));p&&(e=cs(e,s,o))}return[e,n]}function Ure(){return{offsetTree:[],sizeTree:uu(),groupOffsetTree:uu(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function P2({index:e},t){return t===e?0:t0&&(t=Math.max(t,l8(e,r,P2).offset)),a8(Hre(e,t,n,Gre),qre)}function cx(e,t,n,r){let o=e,s=0,i=0,c=0,d=0;if(t!==0){d=og(o,t-1,P2),c=o[d].offset;const h=ca(n,t-1);s=h[0],i=h[1],o.length&&o[d].size===ca(n,t)[1]&&(d-=1),o=o.slice(0,d+1)}else o=[];for(const{start:p,value:h}of w0(n,t,1/0)){const m=p-s,g=m*i+c+m*r;o.push({offset:g,size:h,index:p}),s=p,c=g,i=h}return{offsetTree:o,lastIndex:s,lastOffset:c,lastSize:i}}function Qre(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,ps.DEBUG);const s=e.sizeTree;let i=s,c=0;if(n.length>0&&or(s)&&t.length===2){const g=t[0].size,b=t[1].size;i=n.reduce((y,x)=>cs(cs(y,x,g),x+1,b),i)}else[i,c]=Vre(i,t);if(i===s)return e;const{offsetTree:d,lastIndex:p,lastSize:h,lastOffset:m}=cx(e.offsetTree,c,i,o);return{sizeTree:i,offsetTree:d,lastIndex:p,lastOffset:m,lastSize:h,groupOffsetTree:n.reduce((g,b)=>cs(g,b,gf(b,d,o)),uu()),groupIndices:n}}function gf(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=l8(t,e,P2),i=e-o,c=s*i+(i-1)*n+r;return c>0?c+n:c}function Xre(e){return typeof e.groupIndex<"u"}function c8(e,t,n){if(Xre(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=u8(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function u8(e,t){if(!S0(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function S0(e){return!or(e.groupOffsetTree)}function Yre(e){return Rl(e).map(({k:t,v:n},r,o)=>{const s=o[r+1],i=s?s.k-1:1/0;return{startIndex:t,endIndex:i,size:n}})}const Jre={offsetHeight:"height",offsetWidth:"width"},Ua=Yn(([{log:e},{recalcInProgress:t}])=>{const n=On(),r=On(),o=Oo(r,0),s=On(),i=On(),c=st(0),d=st([]),p=st(void 0),h=st(void 0),m=st((M,E)=>il(M,Jre[E])),g=st(void 0),b=st(0),y=Ure(),x=Oo(He(n,bn(d,e,b),ja(Qre,y),br()),y),w=Oo(He(d,br(),ja((M,E)=>({prev:M.current,current:E}),{prev:[],current:[]}),yt(({prev:M})=>M)),[]);Lt(He(d,rn(M=>M.length>0),bn(x,b),yt(([M,E,A])=>{const R=M.reduce((D,O,T)=>cs(D,O,gf(O,E.offsetTree,A)||T),uu());return{...E,groupIndices:M,groupOffsetTree:R}})),x),Lt(He(r,bn(x),rn(([M,{lastIndex:E}])=>M[{startIndex:M,endIndex:E,size:A}])),n),Lt(p,h);const S=Oo(He(p,yt(M=>M===void 0)),!0);Lt(He(h,rn(M=>M!==void 0&&or(us(x).sizeTree)),yt(M=>[{startIndex:0,endIndex:0,size:M}])),n);const j=fs(He(n,bn(x),ja(({sizes:M},[E,A])=>({changed:A!==M,sizes:A}),{changed:!1,sizes:y}),yt(M=>M.changed)));Zn(He(c,ja((M,E)=>({diff:M.prev-E,prev:E}),{diff:0,prev:0}),yt(M=>M.diff)),M=>{const{groupIndices:E}=us(x);if(M>0)pn(t,!0),pn(s,M+i_(M,E));else if(M<0){const A=us(w);A.length>0&&(M-=i_(-M,A)),pn(i,M)}}),Zn(He(c,bn(e)),([M,E])=>{M<0&&E("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},ps.ERROR)});const I=fs(s);Lt(He(s,bn(x),yt(([M,E])=>{const A=E.groupIndices.length>0,R=[],D=E.lastSize;if(A){const O=mf(E.sizeTree,0);let T=0,K=0;for(;T{let oe=Z.ranges;return Z.prevSize!==0&&(oe=[...Z.ranges,{startIndex:Z.prevIndex,endIndex:te+M-1,size:Z.prevSize}]),{ranges:oe,prevIndex:te+M,prevSize:V}},{ranges:R,prevIndex:M,prevSize:0}).ranges}return Rl(E.sizeTree).reduce((O,{k:T,v:K})=>({ranges:[...O.ranges,{startIndex:O.prevIndex,endIndex:T+M-1,size:O.prevSize}],prevIndex:T+M,prevSize:K}),{ranges:[],prevIndex:0,prevSize:D}).ranges})),n);const _=fs(He(i,bn(x,b),yt(([M,{offsetTree:E},A])=>{const R=-M;return gf(R,E,A)})));return Lt(He(i,bn(x,b),yt(([M,E,A])=>{if(E.groupIndices.length>0){if(or(E.sizeTree))return E;let D=uu();const O=us(w);let T=0,K=0,G=0;for(;T<-M;){G=O[K];const Z=O[K+1]-G-1;K++,T+=Z+1}if(D=Rl(E.sizeTree).reduce((Z,{k:te,v:V})=>cs(Z,Math.max(0,te+M),V),D),T!==-M){const Z=mf(E.sizeTree,G);D=cs(D,0,Z);const te=ca(E.sizeTree,-M+1)[1];D=cs(D,1,te)}return{...E,sizeTree:D,...cx(E.offsetTree,0,D,A)}}else{const D=Rl(E.sizeTree).reduce((O,{k:T,v:K})=>cs(O,Math.max(0,T+M),K),uu());return{...E,sizeTree:D,...cx(E.offsetTree,0,D,A)}}})),x),{data:g,totalCount:r,sizeRanges:n,groupIndices:d,defaultItemSize:h,fixedItemSize:p,unshiftWith:s,shiftWith:i,shiftWithOffset:_,beforeUnshiftWith:I,firstItemIndex:c,gap:b,sizes:x,listRefresh:j,statefulTotalCount:o,trackItemSizes:S,itemSize:m}},Cr(ml,I2),{singleton:!0}),Zre=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function d8(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Zre)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const np=Yn(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:i,smoothScrollTargetReached:c,headerHeight:d,footerHeight:p,fixedHeaderHeight:h,fixedFooterHeight:m},{log:g}])=>{const b=On(),y=st(0);let x=null,w=null,S=null;function j(){x&&(x(),x=null),S&&(S(),S=null),w&&(clearTimeout(w),w=null),pn(o,!1)}return Lt(He(b,bn(e,s,t,y,d,p,g),bn(r,h,m),yt(([[I,_,M,E,A,R,D,O],T,K,G])=>{const X=d8(I),{align:Z,behavior:te,offset:V}=X,oe=E-1,ne=c8(X,_,oe);let se=gf(ne,_.offsetTree,T)+R;Z==="end"?(se+=K+ca(_.sizeTree,ne)[1]-M+G,ne===oe&&(se+=D)):Z==="center"?se+=(K+ca(_.sizeTree,ne)[1]-M+G)/2:se-=A,V&&(se+=V);const re=ae=>{j(),ae?(O("retrying to scroll to",{location:I},ps.DEBUG),pn(b,I)):O("list did not change, scroll successful",{},ps.DEBUG)};if(j(),te==="smooth"){let ae=!1;S=Zn(n,B=>{ae=ae||B}),x=xi(c,()=>{re(ae)})}else x=xi(He(n,eoe(150)),re);return w=setTimeout(()=>{j()},1200),pn(o,!0),O("scrolling from index to",{index:ne,top:se,behavior:te},ps.DEBUG),{top:se,behavior:te}})),i),{scrollToIndex:b,topListHeight:y}},Cr(Ua,$o,ml),{singleton:!0});function eoe(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const vf="up",qd="down",toe="none",noe={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},roe=0,rp=Yn(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const i=st(!1),c=st(!0),d=On(),p=On(),h=st(4),m=st(roe),g=Oo(He(s_(He(nn(t),_u(1),ti(!0)),He(nn(t),_u(1),ti(!1),o_(100))),br()),!1),b=Oo(He(s_(He(s,ti(!0)),He(s,ti(!1),o_(200))),br()),!1);Lt(He(ao(nn(t),nn(m)),yt(([j,I])=>j<=I),br()),c),Lt(He(c,Xi(50)),p);const y=fs(He(ao(e,nn(n),nn(r),nn(o),nn(h)),ja((j,[{scrollTop:I,scrollHeight:_},M,E,A,R])=>{const D=I+M-_>-R,O={viewportHeight:M,scrollTop:I,scrollHeight:_};if(D){let K,G;return I>j.state.scrollTop?(K="SCROLLED_DOWN",G=j.state.scrollTop-I):(K="SIZE_DECREASED",G=j.state.scrollTop-I||j.scrollTopDelta),{atBottom:!0,state:O,atBottomBecause:K,scrollTopDelta:G}}let T;return O.scrollHeight>j.state.scrollHeight?T="SIZE_INCREASED":Mj&&j.atBottom===I.atBottom))),x=Oo(He(e,ja((j,{scrollTop:I,scrollHeight:_,viewportHeight:M})=>{if(t8(j.scrollHeight,_))return{scrollTop:I,scrollHeight:_,jump:0,changed:!1};{const E=_-(I+M)<1;return j.scrollTop!==I&&E?{scrollHeight:_,scrollTop:I,jump:j.scrollTop-I,changed:!0}:{scrollHeight:_,scrollTop:I,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),rn(j=>j.changed),yt(j=>j.jump)),0);Lt(He(y,yt(j=>j.atBottom)),i),Lt(He(i,Xi(50)),d);const w=st(qd);Lt(He(e,yt(({scrollTop:j})=>j),br(),ja((j,I)=>us(b)?{direction:j.direction,prevScrollTop:I}:{direction:Ij.direction)),w),Lt(He(e,Xi(50),ti(toe)),w);const S=st(0);return Lt(He(g,rn(j=>!j),ti(0)),S),Lt(He(t,Xi(100),bn(g),rn(([j,I])=>!!I),ja(([j,I],[_])=>[I,_],[0,0]),yt(([j,I])=>I-j)),S),{isScrolling:g,isAtTop:c,isAtBottom:i,atBottomState:y,atTopStateChange:p,atBottomStateChange:d,scrollDirection:w,atBottomThreshold:h,atTopThreshold:m,scrollVelocity:S,lastJumpDueToItemResize:x}},Cr($o)),gl=Yn(([{log:e}])=>{const t=st(!1),n=fs(He(t,rn(r=>r),br()));return Zn(t,r=>{r&&us(e)("props updated",{},ps.DEBUG)}),{propsReady:t,didMount:n}},Cr(ml),{singleton:!0});function E2(e,t){e==0?t():requestAnimationFrame(()=>E2(e-1,t))}function M2(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const op=Yn(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o},{didMount:s}])=>{const i=st(!0),c=st(0),d=st(!1);return Lt(He(s,bn(c),rn(([p,h])=>!!h),ti(!1)),i),Zn(He(ao(t,s),bn(i,e,n,d),rn(([[,p],h,{sizeTree:m},g,b])=>p&&(!or(m)||k2(g))&&!h&&!b),bn(c)),([,p])=>{pn(d,!0),E2(3,()=>{xi(r,()=>pn(i,!0)),pn(o,p)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:c}},Cr(Ua,$o,np,gl),{singleton:!0});function l_(e){return e?e==="smooth"?"smooth":"auto":!1}const ooe=(e,t)=>typeof e=="function"?l_(e(t)):t&&l_(e),soe=Yn(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:i,didMount:c},{log:d},{scrollingInProgress:p}])=>{const h=st(!1),m=On();let g=null;function b(x){pn(o,{index:"LAST",align:"end",behavior:x})}Zn(He(ao(He(nn(e),_u(1)),c),bn(nn(h),n,s,p),yt(([[x,w],S,j,I,_])=>{let M=w&&I,E="auto";return M&&(E=ooe(S,j||_),M=M&&!!E),{totalCount:x,shouldFollow:M,followOutputBehavior:E}}),rn(({shouldFollow:x})=>x)),({totalCount:x,followOutputBehavior:w})=>{g&&(g(),g=null),g=xi(t,()=>{us(d)("following output to ",{totalCount:x},ps.DEBUG),b(w),g=null})});function y(x){const w=xi(r,S=>{x&&!S.atBottom&&S.notAtBottomBecause==="SIZE_INCREASED"&&!g&&(us(d)("scrolling to bottom due to increased size",{},ps.DEBUG),b("auto"))});setTimeout(w,100)}return Zn(He(ao(nn(h),e,i),rn(([x,,w])=>x&&w),ja(({value:x},[,w])=>({refreshed:x===w,value:w}),{refreshed:!1,value:0}),rn(({refreshed:x})=>x),bn(h,e)),([,x])=>{y(x!==!1)}),Zn(m,()=>{y(us(h)!==!1)}),Zn(ao(nn(h),r),([x,w])=>{x&&!w.atBottom&&w.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&b("auto")}),{followOutput:h,autoscrollToBottom:m}},Cr(Ua,rp,np,op,gl,ml,$o));function aoe(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const f8=Yn(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=On(),i=On(),c=fs(He(s,yt(aoe)));return Lt(He(c,yt(d=>d.totalCount)),e),Lt(He(c,yt(d=>d.groupIndices)),t),Lt(He(ao(r,n,o),rn(([d,p])=>S0(p)),yt(([d,p,h])=>ca(p.groupOffsetTree,Math.max(d-h,0),"v")[0]),br(),yt(d=>[d])),i),{groupCounts:s,topItemsIndexes:i}},Cr(Ua,$o));function bf(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function p8(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const sg="top",ag="bottom",c_="none";function u_(e,t,n){return typeof e=="number"?n===vf&&t===sg||n===qd&&t===ag?e:0:n===vf?t===sg?e.main:e.reverse:t===ag?e.main:e.reverse}function d_(e,t){return typeof e=="number"?e:e[t]||0}const O2=Yn(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=On(),i=st(0),c=st(0),d=st(0),p=Oo(He(ao(nn(e),nn(t),nn(r),nn(s,bf),nn(d),nn(i),nn(o),nn(n),nn(c)),yt(([h,m,g,[b,y],x,w,S,j,I])=>{const _=h-j,M=w+S,E=Math.max(g-_,0);let A=c_;const R=d_(I,sg),D=d_(I,ag);return b-=j,b+=g+S,y+=g+S,y-=j,b>h+M-R&&(A=vf),yh!=null),br(bf)),[0,0]);return{listBoundary:s,overscan:d,topListHeight:i,increaseViewportBy:c,visibleRange:p}},Cr($o),{singleton:!0});function ioe(e,t,n){if(S0(t)){const r=u8(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 M1={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function f_(e,t,n){if(e.length===0)return[];if(!S0(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=w0(t.groupOffsetTree,r,o);let c,d=0;for(const p of e){(!c||c.end0){p=e[0].offset;const x=e[e.length-1];h=x.offset+x.size}const m=n-d,g=c+m*i+(m-1)*r,b=p,y=g-h;return{items:f_(e,o,s),topItems:f_(t,o,s),topListHeight:t.reduce((x,w)=>w.size+x,0),offsetTop:p,offsetBottom:y,top:b,bottom:h,totalCount:n,firstItemIndex:s}}function h8(e,t,n,r,o,s){let i=0;if(n.groupIndices.length>0)for(const h of n.groupIndices){if(h-i>=e)break;i++}const c=e+i,d=M2(t,c),p=Array.from({length:c}).map((h,m)=>({index:m+d,size:0,offset:0,data:s[m+d]}));return zh(p,[],c,o,n,r)}const ic=Yn(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:i,listBoundary:c,topListHeight:d},{scrolledToInitialItem:p,initialTopMostItemIndex:h},{topListHeight:m},g,{didMount:b},{recalcInProgress:y}])=>{const x=st([]),w=st(0),S=On();Lt(s.topItemsIndexes,x);const j=Oo(He(ao(b,y,nn(i,bf),nn(t),nn(e),nn(h),p,nn(x),nn(r),nn(o),n),rn(([E,A,,R,,,,,,,D])=>{const O=D&&D.length!==R;return E&&!A&&!O}),yt(([,,[E,A],R,D,O,T,K,G,X,Z])=>{const te=D,{sizeTree:V,offsetTree:oe}=te,ne=us(w);if(R===0)return{...M1,totalCount:R};if(E===0&&A===0)return ne===0?{...M1,totalCount:R}:h8(ne,O,D,G,X,Z||[]);if(or(V))return ne>0?null:zh(ioe(M2(O,R),te,Z),[],R,X,te,G);const se=[];if(K.length>0){const $=K[0],F=K[K.length-1];let q=0;for(const pe of w0(V,$,F)){const W=pe.value,U=Math.max(pe.start,$),ee=Math.min(pe.end,F);for(let J=U;J<=ee;J++)se.push({index:J,size:W,offset:q,data:Z&&Z[J]}),q+=W}}if(!T)return zh([],se,R,X,te,G);const re=K.length>0?K[K.length-1]+1:0,ae=Kre(oe,E,A,re);if(ae.length===0)return null;const B=R-1,Y=C0([],$=>{for(const F of ae){const q=F.value;let pe=q.offset,W=F.start;const U=q.size;if(q.offset=A);J++)$.push({index:J,size:U,offset:pe,data:Z&&Z[J]}),pe+=U+X}});return zh(Y,se,R,X,te,G)}),rn(E=>E!==null),br()),M1);Lt(He(n,rn(k2),yt(E=>E==null?void 0:E.length)),t),Lt(He(j,yt(E=>E.topListHeight)),m),Lt(m,d),Lt(He(j,yt(E=>[E.top,E.bottom])),c),Lt(He(j,yt(E=>E.items)),S);const I=fs(He(j,rn(({items:E})=>E.length>0),bn(t,n),rn(([{items:E},A])=>E[E.length-1].originalIndex===A-1),yt(([,E,A])=>[E-1,A]),br(bf),yt(([E])=>E))),_=fs(He(j,Xi(200),rn(({items:E,topItems:A})=>E.length>0&&E[0].originalIndex===A.length),yt(({items:E})=>E[0].index),br())),M=fs(He(j,rn(({items:E})=>E.length>0),yt(({items:E})=>{let A=0,R=E.length-1;for(;E[A].type==="group"&&AA;)R--;return{startIndex:E[A].index,endIndex:E[R].index}}),br(p8)));return{listState:j,topItemsIndexes:x,endReached:I,startReached:_,rangeChanged:M,itemsRendered:S,initialItemCount:w,...g}},Cr(Ua,f8,O2,op,np,rp,gl,I2),{singleton:!0}),loe=Yn(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:c}])=>(Lt(He(c,bn(s),rn(([,d])=>d!==0),bn(o,e,t,r,n),yt(([[,d],p,h,m,g,b=[]])=>h8(d,p,h,m,g,b))),i),{}),Cr(Ua,op,ic,gl),{singleton:!0}),m8=Yn(([{scrollVelocity:e}])=>{const t=st(!1),n=On(),r=st(!1);return Lt(He(e,bn(r,t,n),rn(([o,s])=>!!s),yt(([o,s,i,c])=>{const{exit:d,enter:p}=s;if(i){if(d(o,c))return!1}else if(p(o,c))return!0;return i}),br()),t),Zn(He(ao(t,e,n),bn(r)),([[o,s,i],c])=>o&&c&&c.change&&c.change(s,i)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},Cr(rp),{singleton:!0}),coe=Yn(([{topItemsIndexes:e}])=>{const t=st(0);return Lt(He(t,rn(n=>n>0),yt(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},Cr(ic)),g8=Yn(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=On(),i=Oo(He(ao(e,r,t,n,o),yt(([c,d,p,h,m])=>c+d+p+h+m.offsetBottom+m.bottom)),0);return Lt(nn(i),s),{totalListHeight:i,totalListHeightChanged:s}},Cr($o,ic),{singleton:!0});function v8(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const uoe=v8(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),doe=Yn(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:i,lastJumpDueToItemResize:c},{listState:d},{beforeUnshiftWith:p,shiftWithOffset:h,sizes:m,gap:g},{log:b},{recalcInProgress:y}])=>{const x=fs(He(d,bn(c),ja(([,S,j,I],[{items:_,totalCount:M,bottom:E,offsetBottom:A},R])=>{const D=E+A;let O=0;return j===M&&S.length>0&&_.length>0&&(_[0].originalIndex===0&&S[0].originalIndex===0||(O=D-I,O!==0&&(O+=R))),[O,_,M,D]},[0,[],0,0]),rn(([S])=>S!==0),bn(t,i,r,s,b,y),rn(([,S,j,I,,,_])=>!_&&!I&&S!==0&&j===vf),yt(([[S],,,,,j])=>(j("Upward scrolling compensation",{amount:S},ps.DEBUG),S))));function w(S){S>0?(pn(e,{top:-S,behavior:"auto"}),pn(n,0)):(pn(n,0),pn(e,{top:-S,behavior:"auto"}))}return Zn(He(x,bn(n,o)),([S,j,I])=>{I&&uoe()?pn(n,j-S):w(-S)}),Zn(He(ao(Oo(o,!1),n,y),rn(([S,j,I])=>!S&&!I&&j!==0),yt(([S,j])=>j),Xi(1)),w),Lt(He(h,yt(S=>({top:-S}))),e),Zn(He(p,bn(m,g),yt(([S,{lastSize:j,groupIndices:I,sizeTree:_},M])=>{function E(A){return A*(j+M)}if(I.length===0)return E(S);{let A=0;const R=mf(_,0);let D=0,O=0;for(;DS&&(A-=R,T=S-D+1),D+=T,A+=E(T),O++}return A}})),S=>{pn(n,S),requestAnimationFrame(()=>{pn(e,{top:S}),requestAnimationFrame(()=>{pn(n,0),pn(y,!1)})})}),{deviation:n}},Cr($o,rp,ic,Ua,ml,I2)),foe=Yn(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=st(0);return Zn(He(e,bn(r),rn(([,o])=>o!==0),yt(([,o])=>({top:o}))),o=>{xi(He(n,_u(1),rn(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{pn(t,o)})})}),{initialScrollTop:r}},Cr(gl,$o,ic),{singleton:!0}),poe=Yn(([{viewportHeight:e},{totalListHeight:t}])=>{const n=st(!1),r=Oo(He(ao(n,e,t),rn(([o])=>o),yt(([,o,s])=>Math.max(0,o-s)),Xi(0),br()),0);return{alignToBottom:n,paddingTopAddition:r}},Cr($o,g8),{singleton:!0}),A2=Yn(([{scrollTo:e,scrollContainerState:t}])=>{const n=On(),r=On(),o=On(),s=st(!1),i=st(void 0);return Lt(He(ao(n,r),yt(([{viewportHeight:c,scrollTop:d,scrollHeight:p},{offsetTop:h}])=>({scrollTop:Math.max(0,d-h),scrollHeight:p,viewportHeight:c}))),t),Lt(He(e,bn(r),yt(([c,{offsetTop:d}])=>({...c,top:c.top+d}))),o),{useWindowScroll:s,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},Cr($o)),hoe=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...i}})=>er?{...i,behavior:o,align:s??"end"}:null,moe=Yn(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:i,fixedFooterHeight:c,scrollingInProgress:d},{scrollToIndex:p}])=>{const h=On();return Lt(He(h,bn(e,o,t,s,i,c,r),bn(n),yt(([[m,g,b,y,x,w,S,j],I])=>{const{done:_,behavior:M,align:E,calculateViewLocation:A=hoe,...R}=m,D=c8(m,g,y-1),O=gf(D,g.offsetTree,I)+x+w,T=O+ca(g.sizeTree,D)[1],K=j+w,G=j+b-S,X=A({itemTop:O,itemBottom:T,viewportTop:K,viewportBottom:G,locationParams:{behavior:M,align:E,...R}});return X?_&&xi(He(d,rn(Z=>Z===!1),_u(us(d)?1:2)),_):_&&_(),X}),rn(m=>m!==null)),p),{scrollIntoView:h}},Cr(Ua,$o,np,ic,ml),{singleton:!0}),goe=Yn(([{sizes:e,sizeRanges:t},{scrollTop:n},{initialTopMostItemIndex:r},{didMount:o},{useWindowScroll:s,windowScrollContainerState:i,windowViewportRect:c}])=>{const d=On(),p=st(void 0),h=st(null),m=st(null);return Lt(i,h),Lt(c,m),Zn(He(d,bn(e,n,s,h,m)),([g,b,y,x,w,S])=>{const j=Yre(b.sizeTree);x&&w!==null&&S!==null&&(y=w.scrollTop-S.offsetTop),g({ranges:j,scrollTop:y})}),Lt(He(p,rn(k2),yt(voe)),r),Lt(He(o,bn(p),rn(([,g])=>g!==void 0),br(),yt(([,g])=>g.ranges)),t),{getState:d,restoreStateFrom:p}},Cr(Ua,$o,op,gl,A2));function voe(e){return{offset:e.scrollTop,index:0,align:"start"}}const boe=Yn(([e,t,n,r,o,s,i,c,d,p])=>({...e,...t,...n,...r,...o,...s,...i,...c,...d,...p}),Cr(O2,loe,gl,m8,g8,foe,poe,A2,moe,ml)),xoe=Yn(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:i,firstItemIndex:c,groupIndices:d,statefulTotalCount:p,gap:h,sizes:m},{initialTopMostItemIndex:g,scrolledToInitialItem:b},y,x,w,{listState:S,topItemsIndexes:j,...I},{scrollToIndex:_},M,{topItemCount:E},{groupCounts:A},R])=>(Lt(I.rangeChanged,R.scrollSeekRangeChanged),Lt(He(R.windowViewportRect,yt(D=>D.visibleHeight)),y.viewportHeight),{totalCount:e,data:i,firstItemIndex:c,sizeRanges:t,initialTopMostItemIndex:g,scrolledToInitialItem:b,topItemsIndexes:j,topItemCount:E,groupCounts:A,fixedItemHeight:n,defaultItemHeight:r,gap:h,...w,statefulTotalCount:p,listState:S,scrollToIndex:_,trackItemSizes:o,itemSize:s,groupIndices:d,...I,...R,...y,sizes:m,...x}),Cr(Ua,op,$o,goe,soe,ic,np,doe,coe,f8,boe)),O1="-webkit-sticky",p_="sticky",b8=v8(()=>{if(typeof document>"u")return p_;const e=document.createElement("div");return e.style.position=O1,e.style.position===O1?O1:p_});function x8(e,t){const n=z.useRef(null),r=z.useCallback(c=>{if(c===null||!c.offsetParent)return;const d=c.getBoundingClientRect(),p=d.width;let h,m;if(t){const g=t.getBoundingClientRect(),b=d.top-g.top;h=g.height-Math.max(0,b),m=b+t.scrollTop}else h=window.innerHeight-Math.max(0,d.top),m=d.top+window.pageYOffset;n.current={offsetTop:m,visibleHeight:h,visibleWidth:p},e(n.current)},[e,t]),{callbackRef:o,ref:s}=_2(r),i=z.useCallback(()=>{r(s.current)},[r,s]);return z.useEffect(()=>{if(t){t.addEventListener("scroll",i);const c=new ResizeObserver(i);return c.observe(t),()=>{t.removeEventListener("scroll",i),c.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),o}const y8=z.createContext(void 0),C8=z.createContext(void 0);function w8(e){return e}const yoe=Yn(()=>{const e=st(d=>`Item ${d}`),t=st(null),n=st(d=>`Group ${d}`),r=st({}),o=st(w8),s=st("div"),i=st(qu),c=(d,p=null)=>Oo(He(r,yt(h=>h[d]),br()),p);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:s,scrollerRef:i,FooterComponent:c("Footer"),HeaderComponent:c("Header"),TopItemListComponent:c("TopItemList"),ListComponent:c("List","div"),ItemComponent:c("Item","div"),GroupComponent:c("Group","div"),ScrollerComponent:c("Scroller","div"),EmptyPlaceholder:c("EmptyPlaceholder"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder")}}),Coe=Yn(([e,t])=>({...e,...t}),Cr(xoe,yoe)),woe=({height:e})=>z.createElement("div",{style:{height:e}}),Soe={position:b8(),zIndex:1,overflowAnchor:"none"},koe={overflowAnchor:"none"},h_=z.memo(function({showTopList:t=!1}){const n=In("listState"),r=Es("sizeRanges"),o=In("useWindowScroll"),s=In("customScrollParent"),i=Es("windowScrollContainerState"),c=Es("scrollContainerState"),d=s||o?i:c,p=In("itemContent"),h=In("context"),m=In("groupContent"),g=In("trackItemSizes"),b=In("itemSize"),y=In("log"),x=Es("gap"),{callbackRef:w}=Lre(r,b,g,t?qu:d,y,x,s),[S,j]=z.useState(0);R2("deviation",X=>{S!==X&&j(X)});const I=In("EmptyPlaceholder"),_=In("ScrollSeekPlaceholder")||woe,M=In("ListComponent"),E=In("ItemComponent"),A=In("GroupComponent"),R=In("computeItemKey"),D=In("isSeeking"),O=In("groupIndices").length>0,T=In("paddingTopAddition"),K=In("scrolledToInitialItem"),G=t?{}:{boxSizing:"border-box",paddingTop:n.offsetTop+T,paddingBottom:n.offsetBottom,marginTop:S,...K?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&I?z.createElement(I,Uo(I,h)):z.createElement(M,{...Uo(M,h),ref:w,style:G,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?n.topItems:n.items).map(X=>{const Z=X.originalIndex,te=R(Z+n.firstItemIndex,X.data,h);return D?z.createElement(_,{...Uo(_,h),key:te,index:X.index,height:X.size,type:X.type||"item",...X.type==="group"?{}:{groupIndex:X.groupIndex}}):X.type==="group"?z.createElement(A,{...Uo(A,h),key:te,"data-index":Z,"data-known-size":X.size,"data-item-index":X.index,style:Soe},m(X.index,h)):z.createElement(E,{...Uo(E,h),...Ioe(E,X.data),key:te,"data-index":Z,"data-known-size":X.size,"data-item-index":X.index,"data-item-group-index":X.groupIndex,style:koe},O?p(X.index,X.groupIndex,X.data,h):p(X.index,X.data,h))}))}),joe={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},k0={width:"100%",height:"100%",position:"absolute",top:0},_oe={width:"100%",position:b8(),top:0,zIndex:1};function Uo(e,t){if(typeof e!="string")return{context:t}}function Ioe(e,t){return{item:typeof e=="string"?void 0:t}}const Poe=z.memo(function(){const t=In("HeaderComponent"),n=Es("headerHeight"),r=In("headerFooterTag"),o=ac(i=>n(il(i,"height"))),s=In("context");return t?z.createElement(r,{ref:o},z.createElement(t,Uo(t,s))):null}),Eoe=z.memo(function(){const t=In("FooterComponent"),n=Es("footerHeight"),r=In("headerFooterTag"),o=ac(i=>n(il(i,"height"))),s=In("context");return t?z.createElement(r,{ref:o},z.createElement(t,Uo(t,s))):null});function S8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return z.memo(function({style:s,children:i,...c}){const d=e("scrollContainerState"),p=n("ScrollerComponent"),h=e("smoothScrollTargetReached"),m=n("scrollerRef"),g=n("context"),{scrollerRef:b,scrollByCallback:y,scrollToCallback:x}=n8(d,h,p,m);return t("scrollTo",x),t("scrollBy",y),z.createElement(p,{ref:b,style:{...joe,...s},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...c,...Uo(p,g)},i)})}function k8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return z.memo(function({style:s,children:i,...c}){const d=e("windowScrollContainerState"),p=n("ScrollerComponent"),h=e("smoothScrollTargetReached"),m=n("totalListHeight"),g=n("deviation"),b=n("customScrollParent"),y=n("context"),{scrollerRef:x,scrollByCallback:w,scrollToCallback:S}=n8(d,h,p,qu,b);return Tre(()=>(x.current=b||window,()=>{x.current=null}),[x,b]),t("windowScrollTo",S),t("scrollBy",w),z.createElement(p,{style:{position:"relative",...s,...m!==0?{height:m+g}:{}},"data-virtuoso-scroller":!0,...c,...Uo(p,y)},i)})}const Moe=({children:e})=>{const t=z.useContext(y8),n=Es("viewportHeight"),r=Es("fixedItemHeight"),o=ac(YO(n,s=>il(s,"height")));return z.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),z.createElement("div",{style:k0,ref:o,"data-viewport-type":"element"},e)},Ooe=({children:e})=>{const t=z.useContext(y8),n=Es("windowViewportRect"),r=Es("fixedItemHeight"),o=In("customScrollParent"),s=x8(n,o);return z.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),z.createElement("div",{ref:s,style:k0,"data-viewport-type":"window"},e)},Aoe=({children:e})=>{const t=In("TopItemListComponent"),n=In("headerHeight"),r={..._oe,marginTop:`${n}px`},o=In("context");return z.createElement(t||"div",{style:r,context:o},e)},Roe=z.memo(function(t){const n=In("useWindowScroll"),r=In("topItemsIndexes").length>0,o=In("customScrollParent"),s=o||n?Noe:Toe,i=o||n?Ooe:Moe;return z.createElement(s,{...t},r&&z.createElement(Aoe,null,z.createElement(h_,{showTopList:!0})),z.createElement(i,null,z.createElement(Poe,null),z.createElement(h_,null),z.createElement(Eoe,null)))}),{Component:Doe,usePublisher:Es,useEmitterValue:In,useEmitter:R2}=e8(Coe,{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"}},Roe),Toe=S8({usePublisher:Es,useEmitterValue:In,useEmitter:R2}),Noe=k8({usePublisher:Es,useEmitterValue:In,useEmitter:R2}),$oe=Doe,m_={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Loe={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:g_,ceil:v_,floor:ig,min:A1,max:Kd}=Math;function zoe(e){return{...Loe,items:e}}function b_(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 Foe(e,t){return e&&e.column===t.column&&e.row===t.row}function yh(e,t){return e&&e.width===t.width&&e.height===t.height}const Boe=Yn(([{overscan:e,visibleRange:t,listBoundary:n},{scrollTop:r,viewportHeight:o,scrollBy:s,scrollTo:i,smoothScrollTargetReached:c,scrollContainerState:d,footerHeight:p,headerHeight:h},m,g,{propsReady:b,didMount:y},{windowViewportRect:x,useWindowScroll:w,customScrollParent:S,windowScrollContainerState:j,windowScrollTo:I},_])=>{const M=st(0),E=st(0),A=st(m_),R=st({height:0,width:0}),D=st({height:0,width:0}),O=On(),T=On(),K=st(0),G=st(null),X=st({row:0,column:0}),Z=On(),te=On(),V=st(!1),oe=st(0),ne=st(!0),se=st(!1);Zn(He(y,bn(oe),rn(([F,q])=>!!q)),()=>{pn(ne,!1),pn(E,0)}),Zn(He(ao(y,ne,D,R,oe,se),rn(([F,q,pe,W,,U])=>F&&!q&&pe.height!==0&&W.height!==0&&!U)),([,,,,F])=>{pn(se,!0),E2(1,()=>{pn(O,F)}),xi(He(r),()=>{pn(n,[0,0]),pn(ne,!0)})}),Lt(He(te,rn(F=>F!=null&&F.scrollTop>0),ti(0)),E),Zn(He(y,bn(te),rn(([,F])=>F!=null)),([,F])=>{F&&(pn(R,F.viewport),pn(D,F==null?void 0:F.item),pn(X,F.gap),F.scrollTop>0&&(pn(V,!0),xi(He(r,_u(1)),q=>{pn(V,!1)}),pn(i,{top:F.scrollTop})))}),Lt(He(R,yt(({height:F})=>F)),o),Lt(He(ao(nn(R,yh),nn(D,yh),nn(X,(F,q)=>F&&F.column===q.column&&F.row===q.row),nn(r)),yt(([F,q,pe,W])=>({viewport:F,item:q,gap:pe,scrollTop:W}))),Z),Lt(He(ao(nn(M),t,nn(X,Foe),nn(D,yh),nn(R,yh),nn(G),nn(E),nn(V),nn(ne),nn(oe)),rn(([,,,,,,,F])=>!F),yt(([F,[q,pe],W,U,ee,J,ge,,he,de])=>{const{row:_e,column:Pe}=W,{height:ze,width:ht}=U,{width:Je}=ee;if(ge===0&&(F===0||Je===0))return m_;if(ht===0){const Rt=M2(de,F),zt=Rt===0?Math.max(ge-1,0):Rt;return zoe(b_(Rt,zt,J))}const qt=j8(Je,ht,Pe);let Pt,jt;he?q===0&&pe===0&&ge>0?(Pt=0,jt=ge-1):(Pt=qt*ig((q+_e)/(ze+_e)),jt=qt*v_((pe+_e)/(ze+_e))-1,jt=A1(F-1,Kd(jt,qt-1)),Pt=A1(jt,Kd(0,Pt))):(Pt=0,jt=-1);const Se=b_(Pt,jt,J),{top:Fe,bottom:it}=x_(ee,W,U,Se),At=v_(F/qt),lt=At*ze+(At-1)*_e-it;return{items:Se,offsetTop:Fe,offsetBottom:lt,top:Fe,bottom:it,itemHeight:ze,itemWidth:ht}})),A),Lt(He(G,rn(F=>F!==null),yt(F=>F.length)),M),Lt(He(ao(R,D,A,X),rn(([F,q,{items:pe}])=>pe.length>0&&q.height!==0&&F.height!==0),yt(([F,q,{items:pe},W])=>{const{top:U,bottom:ee}=x_(F,W,q,pe);return[U,ee]}),br(bf)),n);const re=st(!1);Lt(He(r,bn(re),yt(([F,q])=>q||F!==0)),re);const ae=fs(He(nn(A),rn(({items:F})=>F.length>0),bn(M,re),rn(([{items:F},q,pe])=>pe&&F[F.length-1].index===q-1),yt(([,F])=>F-1),br())),B=fs(He(nn(A),rn(({items:F})=>F.length>0&&F[0].index===0),ti(0),br())),Y=fs(He(nn(A),bn(V),rn(([{items:F},q])=>F.length>0&&!q),yt(([{items:F}])=>({startIndex:F[0].index,endIndex:F[F.length-1].index})),br(p8),Xi(0)));Lt(Y,g.scrollSeekRangeChanged),Lt(He(O,bn(R,D,M,X),yt(([F,q,pe,W,U])=>{const ee=d8(F),{align:J,behavior:ge,offset:he}=ee;let de=ee.index;de==="LAST"&&(de=W-1),de=Kd(0,de,A1(W-1,de));let _e=ux(q,U,pe,de);return J==="end"?_e=g_(_e-q.height+pe.height):J==="center"&&(_e=g_(_e-q.height/2+pe.height/2)),he&&(_e+=he),{top:_e,behavior:ge}})),i);const $=Oo(He(A,yt(F=>F.offsetBottom+F.bottom)),0);return Lt(He(x,yt(F=>({width:F.visibleWidth,height:F.visibleHeight}))),R),{data:G,totalCount:M,viewportDimensions:R,itemDimensions:D,scrollTop:r,scrollHeight:T,overscan:e,scrollBy:s,scrollTo:i,scrollToIndex:O,smoothScrollTargetReached:c,windowViewportRect:x,windowScrollTo:I,useWindowScroll:w,customScrollParent:S,windowScrollContainerState:j,deviation:K,scrollContainerState:d,footerHeight:p,headerHeight:h,initialItemCount:E,gap:X,restoreStateFrom:te,...g,initialTopMostItemIndex:oe,gridState:A,totalListHeight:$,...m,startReached:B,endReached:ae,rangeChanged:Y,stateChanged:Z,propsReady:b,stateRestoreInProgress:V,..._}},Cr(O2,$o,rp,m8,gl,A2,ml));function x_(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=ux(e,t,n,r[0].index),i=ux(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:i}}function ux(e,t,n,r){const o=j8(e.width,n.width,t.column),s=ig(r/o),i=s*n.height+Kd(0,s-1)*t.row;return i>0?i+t.row:i}function j8(e,t,n){return Kd(1,ig((e+n)/(ig(t)+n)))}const Hoe=Yn(()=>{const e=st(p=>`Item ${p}`),t=st({}),n=st(null),r=st("virtuoso-grid-item"),o=st("virtuoso-grid-list"),s=st(w8),i=st("div"),c=st(qu),d=(p,h=null)=>Oo(He(t,yt(m=>m[p]),br()),h);return{context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:i,scrollerRef:c,FooterComponent:d("Footer"),HeaderComponent:d("Header"),ListComponent:d("List","div"),ItemComponent:d("Item","div"),ScrollerComponent:d("Scroller","div"),ScrollSeekPlaceholder:d("ScrollSeekPlaceholder","div")}}),Woe=Yn(([e,t])=>({...e,...t}),Cr(Boe,Hoe)),Voe=z.memo(function(){const t=jr("gridState"),n=jr("listClassName"),r=jr("itemClassName"),o=jr("itemContent"),s=jr("computeItemKey"),i=jr("isSeeking"),c=sa("scrollHeight"),d=jr("ItemComponent"),p=jr("ListComponent"),h=jr("ScrollSeekPlaceholder"),m=jr("context"),g=sa("itemDimensions"),b=sa("gap"),y=jr("log"),x=jr("stateRestoreInProgress"),w=ac(S=>{const j=S.parentElement.parentElement.scrollHeight;c(j);const I=S.firstChild;if(I){const{width:_,height:M}=I.getBoundingClientRect();g({width:_,height:M})}b({row:y_("row-gap",getComputedStyle(S).rowGap,y),column:y_("column-gap",getComputedStyle(S).columnGap,y)})});return x?null:z.createElement(p,{ref:w,className:n,...Uo(p,m),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map(S=>{const j=s(S.index,S.data,m);return i?z.createElement(h,{key:j,...Uo(h,m),index:S.index,height:t.itemHeight,width:t.itemWidth}):z.createElement(d,{...Uo(d,m),className:r,"data-index":S.index,key:j},o(S.index,S.data,m))}))}),Uoe=z.memo(function(){const t=jr("HeaderComponent"),n=sa("headerHeight"),r=jr("headerFooterTag"),o=ac(i=>n(il(i,"height"))),s=jr("context");return t?z.createElement(r,{ref:o},z.createElement(t,Uo(t,s))):null}),Goe=z.memo(function(){const t=jr("FooterComponent"),n=sa("footerHeight"),r=jr("headerFooterTag"),o=ac(i=>n(il(i,"height"))),s=jr("context");return t?z.createElement(r,{ref:o},z.createElement(t,Uo(t,s))):null}),qoe=({children:e})=>{const t=z.useContext(C8),n=sa("itemDimensions"),r=sa("viewportDimensions"),o=ac(s=>{r(s.getBoundingClientRect())});return z.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),z.createElement("div",{style:k0,ref:o},e)},Koe=({children:e})=>{const t=z.useContext(C8),n=sa("windowViewportRect"),r=sa("itemDimensions"),o=jr("customScrollParent"),s=x8(n,o);return z.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),z.createElement("div",{ref:s,style:k0},e)},Qoe=z.memo(function({...t}){const n=jr("useWindowScroll"),r=jr("customScrollParent"),o=r||n?Joe:Yoe,s=r||n?Koe:qoe;return z.createElement(o,{...t},z.createElement(s,null,z.createElement(Uoe,null),z.createElement(Voe,null),z.createElement(Goe,null)))}),{Component:Xoe,usePublisher:sa,useEmitterValue:jr,useEmitter:_8}=e8(Woe,{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"}},Qoe),Yoe=S8({usePublisher:sa,useEmitterValue:jr,useEmitter:_8}),Joe=k8({usePublisher:sa,useEmitterValue:jr,useEmitter:_8});function y_(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,ps.WARN),t==="normal"?0:parseInt(t??"0",10)}const Zoe=Xoe,ese=e=>{const t=H(s=>s.gallery.galleryView),{data:n}=Tx(e),{data:r}=Nx(e),o=l.useMemo(()=>t==="images"?n==null?void 0:n.total:r==null?void 0:r.total,[t,r,n]);return{totalImages:n,totalAssets:r,currentViewTotal:o}},tse=({imageDTO:e})=>a.jsx(N,{sx:{pointerEvents:"none",flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,p:2,alignItems:"flex-start",gap:2},children:a.jsxs(Va,{variant:"solid",colorScheme:"base",children:[e.width," × ",e.height]})}),nse=l.memo(tse),D2=({postUploadAction:e,isDisabled:t})=>{const n=H(d=>d.gallery.autoAddBoardId),[r]=EI(),o=l.useCallback(d=>{const p=d[0];p&&r({file:p,image_category:"user",is_intermediate:!1,postUploadAction:e??{type:"TOAST"},board_id:n==="none"?void 0:n})},[n,e,r]),{getRootProps:s,getInputProps:i,open:c}=Hy({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},onDropAccepted:o,disabled:t,noDrag:!0,multiple:!1});return{getUploadButtonProps:s,getUploadInputProps:i,openUploader:c}},rse=me(we,({generation:e})=>e.model,Ie),j0=()=>{const e=le(),t=Zl(),{t:n}=Q(),r=H(rse),o=l.useCallback(()=>{t({title:n("toast.parameterSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),s=l.useCallback(B=>{t({title:n("toast.parameterNotSet"),description:B,status:"warning",duration:2500,isClosable:!0})},[n,t]),i=l.useCallback(()=>{t({title:n("toast.parametersSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),c=l.useCallback(B=>{t({title:n("toast.parametersNotSet"),status:"warning",description:B,duration:2500,isClosable:!0})},[n,t]),d=l.useCallback((B,Y,$,F)=>{if(Wp(B)||Vp(Y)||md($)||Bv(F)){Wp(B)&&e($d(B)),Vp(Y)&&e(Ld(Y)),md($)&&e(zd($)),md(F)&&e(Fd(F)),o();return}s()},[e,o,s]),p=l.useCallback(B=>{if(!Wp(B)){s();return}e($d(B)),o()},[e,o,s]),h=l.useCallback(B=>{if(!Vp(B)){s();return}e(Ld(B)),o()},[e,o,s]),m=l.useCallback(B=>{if(!md(B)){s();return}e(zd(B)),o()},[e,o,s]),g=l.useCallback(B=>{if(!Bv(B)){s();return}e(Fd(B)),o()},[e,o,s]),b=l.useCallback(B=>{if(!qw(B)){s();return}e(Hh(B)),o()},[e,o,s]),y=l.useCallback(B=>{if(!Hv(B)){s();return}e(Wh(B)),o()},[e,o,s]),x=l.useCallback(B=>{if(!Kw(B)){s();return}e(X1(B)),o()},[e,o,s]),w=l.useCallback(B=>{if(!Wv(B)){s();return}e(Y1(B)),o()},[e,o,s]),S=l.useCallback(B=>{if(!Qw(B)&&!si(B)){s();return}si(B)?e(Vc(null)):e(Vc(B)),o()},[e,o,s]),j=l.useCallback(B=>{if(!Vv(B)){s();return}e(Vh(B)),o()},[e,o,s]),I=l.useCallback(B=>{if(!Xw(B)){s();return}e(Wl(B)),o()},[e,o,s]),_=l.useCallback(B=>{if(!Yw(B)){s();return}e(Vl(B)),o()},[e,o,s]),M=l.useCallback(B=>{if(!Up(B)){s();return}e(Uh(B)),o()},[e,o,s]),E=l.useCallback(B=>{if(!Jw(B)){s();return}e(J1(B)),o()},[e,o,s]),A=l.useCallback(B=>{if(!Up(B)){s();return}e(Gh(B)),o()},[e,o,s]),R=l.useCallback(B=>{if(!Zw(B)){s();return}e(Z1(B)),o()},[e,o,s]),{data:D}=_f(void 0),O=l.useCallback(B=>{if(!zI(B.lora))return{lora:null,error:"Invalid LoRA model"};const{base_model:Y,model_name:$}=B.lora,F=D?o7.getSelectors().selectById(D,`${Y}/lora/${$}`):void 0;return F?(F==null?void 0:F.base_model)===(r==null?void 0:r.base_model)?{lora:F,error:null}:{lora:null,error:"LoRA incompatible with currently-selected model"}:{lora:null,error:"LoRA model is not installed"}},[D,r==null?void 0:r.base_model]),T=l.useCallback(B=>{const Y=O(B);if(!Y.lora){s(Y.error);return}e(eS({...Y.lora,weight:B.weight})),o()},[O,e,o,s]),{data:K}=$x(void 0),G=l.useCallback(B=>{if(!qh(B.control_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:Y,control_model:$,control_weight:F,begin_step_percent:q,end_step_percent:pe,control_mode:W,resize_mode:U}=B,ee=K?FI.getSelectors().selectById(K,`${$.base_model}/controlnet/${$.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 ge="none",he=Do.none.default;return{controlnet:{type:"controlnet",isEnabled:!0,model:ee,weight:typeof F=="number"?F:gd.weight,beginStepPct:q||gd.beginStepPct,endStepPct:pe||gd.endStepPct,controlMode:W||gd.controlMode,resizeMode:U||gd.resizeMode,controlImage:(Y==null?void 0:Y.image_name)||null,processedControlImage:(Y==null?void 0:Y.image_name)||null,processorType:ge,processorNode:he,shouldAutoConfig:!0,id:Jc()},error:null}},[K,r==null?void 0:r.base_model]),X=l.useCallback(B=>{const Y=G(B);if(!Y.controlnet){s(Y.error);return}e(Sc(Y.controlnet)),o()},[G,e,o,s]),{data:Z}=Lx(void 0),te=l.useCallback(B=>{if(!qh(B.t2i_adapter_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:Y,t2i_adapter_model:$,weight:F,begin_step_percent:q,end_step_percent:pe,resize_mode:W}=B,U=Z?BI.getSelectors().selectById(Z,`${$.base_model}/t2i_adapter/${$.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 J="none",ge=Do.none.default;return{t2iAdapter:{type:"t2i_adapter",isEnabled:!0,model:U,weight:typeof F=="number"?F:Gp.weight,beginStepPct:q||Gp.beginStepPct,endStepPct:pe||Gp.endStepPct,resizeMode:W||Gp.resizeMode,controlImage:(Y==null?void 0:Y.image_name)||null,processedControlImage:(Y==null?void 0:Y.image_name)||null,processorType:J,processorNode:ge,shouldAutoConfig:!0,id:Jc()},error:null}},[r==null?void 0:r.base_model,Z]),V=l.useCallback(B=>{const Y=te(B);if(!Y.t2iAdapter){s(Y.error);return}e(Sc(Y.t2iAdapter)),o()},[te,e,o,s]),{data:oe}=zx(void 0),ne=l.useCallback(B=>{if(!s7(B==null?void 0:B.ip_adapter_model))return{ipAdapter:null,error:"Invalid IP Adapter model"};const{image:Y,ip_adapter_model:$,weight:F,begin_step_percent:q,end_step_percent:pe}=B,W=oe?HI.getSelectors().selectById(oe,`${$.base_model}/ip_adapter/${$.model_name}`):void 0;return W?(W==null?void 0:W.base_model)===(r==null?void 0:r.base_model)?{ipAdapter:{id:Jc(),type:"ip_adapter",isEnabled:!0,controlImage:(Y==null?void 0:Y.image_name)??null,model:W,weight:F??Uv.weight,beginStepPct:q??Uv.beginStepPct,endStepPct:pe??Uv.endStepPct},error:null}:{ipAdapter:null,error:"IP Adapter incompatible with currently-selected model"}:{ipAdapter:null,error:"IP Adapter model is not installed"}},[oe,r==null?void 0:r.base_model]),se=l.useCallback(B=>{const Y=ne(B);if(!Y.ipAdapter){s(Y.error);return}e(Sc(Y.ipAdapter)),o()},[ne,e,o,s]),re=l.useCallback(B=>{e(gg(B))},[e]),ae=l.useCallback(B=>{if(!B){c();return}const{cfg_scale:Y,height:$,model:F,positive_prompt:q,negative_prompt:pe,scheduler:W,vae:U,seed:ee,steps:J,width:ge,strength:he,hrf_enabled:de,hrf_strength:_e,hrf_method:Pe,positive_style_prompt:ze,negative_style_prompt:ht,refiner_model:Je,refiner_cfg_scale:qt,refiner_steps:Pt,refiner_scheduler:jt,refiner_positive_aesthetic_score:Se,refiner_negative_aesthetic_score:Fe,refiner_start:it,loras:At,controlnets:ke,ipAdapters:lt,t2iAdapters:Rt}=B;Hv(Y)&&e(Wh(Y)),Kw(F)&&e(X1(F)),Wp(q)&&e($d(q)),Vp(pe)&&e(Ld(pe)),Wv(W)&&e(Y1(W)),(Qw(U)||si(U))&&(si(U)?e(Vc(null)):e(Vc(U))),qw(ee)&&e(Hh(ee)),Vv(J)&&e(Vh(J)),Xw(ge)&&e(Wl(ge)),Yw($)&&e(Vl($)),Up(he)&&e(Uh(he)),Jw(de)&&e(J1(de)),Up(_e)&&e(Gh(_e)),Zw(Pe)&&e(Z1(Pe)),md(ze)&&e(zd(ze)),Bv(ht)&&e(Fd(ht)),a7(Je)&&e(WI(Je)),Vv(Pt)&&e(eb(Pt)),Hv(qt)&&e(tb(qt)),Wv(jt)&&e(VI(jt)),i7(Se)&&e(nb(Se)),l7(Fe)&&e(rb(Fe)),c7(it)&&e(ob(it)),e(u7()),At==null||At.forEach(zt=>{const Re=O(zt);Re.lora&&e(eS({...Re.lora,weight:zt.weight}))}),e(AI()),ke==null||ke.forEach(zt=>{const Re=G(zt);Re.controlnet&&e(Sc(Re.controlnet))}),lt==null||lt.forEach(zt=>{const Re=ne(zt);Re.ipAdapter&&e(Sc(Re.ipAdapter))}),Rt==null||Rt.forEach(zt=>{const Re=te(zt);Re.t2iAdapter&&e(Sc(Re.t2iAdapter))}),i()},[e,i,c,O,G,ne,te]);return{recallBothPrompts:d,recallPositivePrompt:p,recallNegativePrompt:h,recallSDXLPositiveStylePrompt:m,recallSDXLNegativeStylePrompt:g,recallSeed:b,recallCfgScale:y,recallModel:x,recallScheduler:w,recallVaeModel:S,recallSteps:j,recallWidth:I,recallHeight:_,recallStrength:M,recallHrfEnabled:E,recallHrfStrength:A,recallHrfMethod:R,recallLoRA:T,recallControlNet:X,recallIPAdapter:se,recallT2IAdapter:V,recallAllParameters:ae,sendToImageToImage:re}},ose=()=>l.useCallback(async t=>new Promise(n=>{const r=new Image;r.onload=()=>{const o=document.createElement("canvas");o.width=r.width,o.height=r.height;const s=o.getContext("2d");s&&(s.drawImage(r,0,0),n(new Promise(i=>{o.toBlob(function(c){i(c)},"image/png")})))},r.crossOrigin=UI.get()?"use-credentials":"anonymous",r.src=t}),[]),I8=()=>{const e=Zl(),{t}=Q(),n=ose(),r=l.useMemo(()=>!!navigator.clipboard&&!!window.ClipboardItem,[]),o=l.useCallback(async s=>{r||e({title:t("toast.problemCopyingImage"),description:"Your browser doesn't support the Clipboard API.",status:"error",duration:2500,isClosable:!0});try{const i=await n(s);if(!i)throw new Error("Unable to create Blob");d7(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 sse(e){return Ye({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 ase(e){return Ye({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 ise(e){return Ye({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 T2(e){return Ye({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 lse(e){return Ye({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 cse(e){return Ye({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 use(e){return Ye({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 dse(e){return Ye({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 fse(e){return Ye({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 pse(e){return Ye({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 N2(e){return Ye({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 $2(e){return Ye({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 P8(e){return Ye({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 hse(e,t,n){var r=this,o=l.useRef(null),s=l.useRef(0),i=l.useRef(null),c=l.useRef([]),d=l.useRef(),p=l.useRef(),h=l.useRef(e),m=l.useRef(!0);h.current=e;var g=typeof window<"u",b=!t&&t!==0&&g;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var y=!!(n=n||{}).leading,x=!("trailing"in n)||!!n.trailing,w="maxWait"in n,S="debounceOnServer"in n&&!!n.debounceOnServer,j=w?Math.max(+n.maxWait||0,t):null;l.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var I=l.useMemo(function(){var _=function(O){var T=c.current,K=d.current;return c.current=d.current=null,s.current=O,p.current=h.current.apply(K,T)},M=function(O,T){b&&cancelAnimationFrame(i.current),i.current=b?requestAnimationFrame(O):setTimeout(O,T)},E=function(O){if(!m.current)return!1;var T=O-o.current;return!o.current||T>=t||T<0||w&&O-s.current>=j},A=function(O){return i.current=null,x&&c.current?_(O):(c.current=d.current=null,p.current)},R=function O(){var T=Date.now();if(E(T))return A(T);if(m.current){var K=t-(T-o.current),G=w?Math.min(K,j-(T-s.current)):K;M(O,G)}},D=function(){if(g||S){var O=Date.now(),T=E(O);if(c.current=[].slice.call(arguments),d.current=r,o.current=O,T){if(!i.current&&m.current)return s.current=o.current,M(R,t),y?_(o.current):p.current;if(w)return M(R,t),_(o.current)}return i.current||M(R,t),p.current}};return D.cancel=function(){i.current&&(b?cancelAnimationFrame(i.current):clearTimeout(i.current)),s.current=0,c.current=o.current=d.current=i.current=null},D.isPending=function(){return!!i.current},D.flush=function(){return i.current?A(Date.now()):p.current},D},[y,w,t,j,x,b,g,S]);return I}function mse(e,t){return e===t}function gse(e,t){return t}function L2(e,t,n){var r=n&&n.equalityFn||mse,o=l.useReducer(gse,e),s=o[0],i=o[1],c=hse(l.useCallback(function(p){return i(p)},[i]),t,n),d=l.useRef(e);return r(d.current,e)||(c(e),d.current=e),[s,c]}const z2=e=>{const t=H(s=>s.config.metadataFetchDebounce),[n]=L2(e,t??0),{data:r,isLoading:o}=GI(n??qI);return{metadata:r,isLoading:o}},vse=f7.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=KI.safeParse(t);if(n.success)return n.data;ki("images").warn("Problem parsing workflow")}}})})}),{useGetWorkflowQuery:bse}=vse,F2=e=>{const t=H(s=>s.config.workflowFetchDebounce),[n]=L2(e,t??0),{data:r,isLoading:o}=bse(n??qI);return{workflow:r,isLoading:o}};Fx("gallery/requestedBoardImagesDeletion");const xse=Fx("gallery/sentImageToCanvas"),E8=Fx("gallery/sentImageToImg2Img"),yse=e=>{const{imageDTO:t}=e,n=le(),{t:r}=Q(),o=Zl(),s=Pn("unifiedCanvas").isFeatureEnabled,i=Xg(Bx),{metadata:c,isLoading:d}=z2(t==null?void 0:t.image_name),{workflow:p,isLoading:h}=F2(t==null?void 0:t.workflow_id),[m]=Hx(),[g]=Wx(),{isClipboardAPIAvailable:b,copyImageToClipboard:y}=I8(),x=l.useCallback(()=>{t&&n(vg([t]))},[n,t]),{recallBothPrompts:w,recallSeed:S,recallAllParameters:j}=j0(),I=l.useCallback(()=>{w(c==null?void 0:c.positive_prompt,c==null?void 0:c.negative_prompt,c==null?void 0:c.positive_style_prompt,c==null?void 0:c.negative_style_prompt)},[c==null?void 0:c.negative_prompt,c==null?void 0:c.positive_prompt,c==null?void 0:c.positive_style_prompt,c==null?void 0:c.negative_style_prompt,w]),_=l.useCallback(()=>{S(c==null?void 0:c.seed)},[c==null?void 0:c.seed,S]),M=l.useCallback(()=>{p&&n(Vx(p))},[n,p]),E=l.useCallback(()=>{n(E8()),n(gg(t))},[n,t]),A=l.useCallback(()=>{n(xse()),ls.flushSync(()=>{n(ni("unifiedCanvas"))}),n(QI(t)),o({title:r("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},[n,t,r,o]),R=l.useCallback(()=>{j(c)},[c,j]),D=l.useCallback(()=>{n(XI([t])),n(Ax(!0))},[n,t]),O=l.useCallback(()=>{y(t.image_url)},[y,t.image_url]),T=l.useCallback(()=>{t&&m({imageDTOs:[t]})},[m,t]),K=l.useCallback(()=>{t&&g({imageDTOs:[t]})},[g,t]);return a.jsxs(a.Fragment,{children:[a.jsx(Kn,{as:"a",href:t.image_url,target:"_blank",icon:a.jsx(l2,{}),children:r("common.openInNewTab")}),b&&a.jsx(Kn,{icon:a.jsx(Hu,{}),onClickCapture:O,children:r("parameters.copyImage")}),a.jsx(Kn,{as:"a",download:!0,href:t.image_url,target:"_blank",icon:a.jsx(Wu,{}),w:"100%",children:r("parameters.downloadImage")}),a.jsx(Kn,{icon:h?a.jsx(Ch,{}):a.jsx(T2,{}),onClickCapture:M,isDisabled:h||!p,children:r("nodes.loadWorkflow")}),a.jsx(Kn,{icon:d?a.jsx(Ch,{}):a.jsx(ZM,{}),onClickCapture:I,isDisabled:d||(c==null?void 0:c.positive_prompt)===void 0&&(c==null?void 0:c.negative_prompt)===void 0,children:r("parameters.usePrompt")}),a.jsx(Kn,{icon:d?a.jsx(Ch,{}):a.jsx(eO,{}),onClickCapture:_,isDisabled:d||(c==null?void 0:c.seed)===void 0,children:r("parameters.useSeed")}),a.jsx(Kn,{icon:d?a.jsx(Ch,{}):a.jsx(WM,{}),onClickCapture:R,isDisabled:d||!c,children:r("parameters.useAll")}),a.jsx(Kn,{icon:a.jsx(Ej,{}),onClickCapture:E,id:"send-to-img2img",children:r("parameters.sendToImg2Img")}),s&&a.jsx(Kn,{icon:a.jsx(Ej,{}),onClickCapture:A,id:"send-to-canvas",children:r("parameters.sendToUnifiedCanvas")}),a.jsx(Kn,{icon:a.jsx(KM,{}),onClickCapture:D,children:r("boards.changeBoard")}),t.starred?a.jsx(Kn,{icon:i?i.off.icon:a.jsx($2,{}),onClickCapture:K,children:i?i.off.text:r("controlnet.unstarImage")}):a.jsx(Kn,{icon:i?i.on.icon:a.jsx(N2,{}),onClickCapture:T,children:i?i.on.text:"Star Image"}),a.jsx(Kn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Zo,{}),onClickCapture:x,children:r("gallery.deleteImage")})]})},M8=l.memo(yse),Ch=()=>a.jsx(N,{w:"14px",alignItems:"center",justifyContent:"center",children:a.jsx(Ci,{size:"xs"})}),Cse=()=>{const{t:e}=Q(),t=le(),n=H(x=>x.gallery.selection),r=Xg(Bx),o=Pn("bulkDownload").isFeatureEnabled,[s]=Hx(),[i]=Wx(),[c]=$I(),d=l.useCallback(()=>{t(XI(n)),t(Ax(!0))},[t,n]),p=l.useCallback(()=>{t(vg(n))},[t,n]),h=l.useCallback(()=>{s({imageDTOs:n})},[s,n]),m=l.useCallback(()=>{i({imageDTOs:n})},[i,n]),g=l.useCallback(async()=>{try{const x=await c({image_names:n.map(w=>w.image_name)}).unwrap();t(Ht({title:e("gallery.preparingDownload"),status:"success",...x.response?{description:x.response}:{}}))}catch{t(Ht({title:e("gallery.preparingDownloadFailed"),status:"error"}))}},[e,n,c,t]),b=l.useMemo(()=>n.every(x=>x.starred),[n]),y=l.useMemo(()=>n.every(x=>!x.starred),[n]);return a.jsxs(a.Fragment,{children:[b&&a.jsx(Kn,{icon:r?r.on.icon:a.jsx(N2,{}),onClickCapture:m,children:r?r.off.text:"Unstar All"}),(y||!b&&!y)&&a.jsx(Kn,{icon:r?r.on.icon:a.jsx($2,{}),onClickCapture:h,children:r?r.on.text:"Star All"}),o&&a.jsx(Kn,{icon:a.jsx(Wu,{}),onClickCapture:g,children:e("gallery.downloadSelection")}),a.jsx(Kn,{icon:a.jsx(KM,{}),onClickCapture:d,children:e("boards.changeBoard")}),a.jsx(Kn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Zo,{}),onClickCapture:p,children:"Delete Selection"})]})},wse=l.memo(Cse),Sse=me([we],({gallery:e})=>({selectionCount:e.selection.length}),Ie),kse=({imageDTO:e,children:t})=>{const{selectionCount:n}=H(Sse),r=l.useCallback(s=>{s.preventDefault()},[]),o=l.useCallback(()=>e?n>1?a.jsx(ql,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:r,children:a.jsx(wse,{})}):a.jsx(ql,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:r,children:a.jsx(M8,{imageDTO:e})}):null,[e,n,r]);return a.jsx(S2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:o,children:t})},jse=l.memo(kse),_se=e=>{const{data:t,disabled:n,...r}=e,o=l.useRef(Jc()),{attributes:s,listeners:i,setNodeRef:c}=Qne({id:o.current,disabled:n,data:t});return a.jsx(Le,{ref:c,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,...s,...i,...r})},Ise=l.memo(_se),Pse=a.jsx(Gr,{as:i0,sx:{boxSize:16}}),Ese=a.jsx(eo,{icon:Xl}),Mse=e=>{const{imageDTO:t,onError:n,onClick:r,withMetadataOverlay:o=!1,isDropDisabled:s=!1,isDragDisabled:i=!1,isUploadDisabled:c=!1,minSize:d=24,postUploadAction:p,imageSx:h,fitContainer:m=!1,droppableData:g,draggableData:b,dropLabel:y,isSelected:x=!1,thumbnail:w=!1,noContentFallback:S=Ese,uploadElement:j=Pse,useThumbailFallback:I,withHoverOverlay:_=!1,children:M,onMouseOver:E,onMouseOut:A,dataTestId:R}=e,{colorMode:D}=ji(),[O,T]=l.useState(!1),K=l.useCallback(V=>{E&&E(V),T(!0)},[E]),G=l.useCallback(V=>{A&&A(V),T(!1)},[A]),{getUploadButtonProps:X,getUploadInputProps:Z}=D2({postUploadAction:p,isDisabled:c}),te=c?{}:{cursor:"pointer",bg:Xe("base.200","base.700")(D),_hover:{bg:Xe("base.300","base.650")(D),color:Xe("base.500","base.300")(D)}};return a.jsx(jse,{imageDTO:t,children:V=>a.jsxs(N,{ref:V,onMouseOver:K,onMouseOut:G,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative",minW:d||void 0,minH:d||void 0,userSelect:"none",cursor:i||!t?"default":"pointer"},children:[t&&a.jsxs(N,{sx:{w:"full",h:"full",position:m?"absolute":"relative",alignItems:"center",justifyContent:"center"},children:[a.jsx(_i,{src:w?t.thumbnail_url:t.image_url,fallbackStrategy:"beforeLoadOrError",fallbackSrc:I?t.thumbnail_url:void 0,fallback:I?void 0:a.jsx(kre,{image:t}),onError:n,draggable:!1,sx:{w:t.width,objectFit:"contain",maxW:"full",maxH:"full",borderRadius:"base",...h},"data-testid":R}),o&&a.jsx(nse,{imageDTO:t}),a.jsx(w2,{isSelected:x,isHovered:_?O:!1})]}),!t&&!c&&a.jsx(a.Fragment,{children:a.jsxs(N,{sx:{minH:d,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",transitionProperty:"common",transitionDuration:"0.1s",color:Xe("base.500","base.500")(D),...te},...X(),children:[a.jsx("input",{...Z()}),j]})}),!t&&c&&S,t&&!i&&a.jsx(Ise,{data:b,disabled:i||!t,onClick:r}),M,!s&&a.jsx(C2,{data:g,disabled:s,dropLabel:y})]})})},ll=l.memo(Mse),Ose=()=>a.jsx(Wg,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full"}})}),Ase=l.memo(Ose),Rse=me([we,Ux],({gallery:e},t)=>{const n=e.selection;return{queryArgs:t,selection:n}},Ie),Dse=e=>{const t=le(),{queryArgs:n,selection:r}=H(Rse),{imageDTOs:o}=YI(n,{selectFromResult:p=>({imageDTOs:p.data?p7.selectAll(p.data):[]})}),s=Pn("multiselect").isFeatureEnabled,i=l.useCallback(p=>{var h;if(e){if(!s){t(vd([e]));return}if(p.shiftKey){const m=e.image_name,g=(h=r[r.length-1])==null?void 0:h.image_name,b=o.findIndex(x=>x.image_name===g),y=o.findIndex(x=>x.image_name===m);if(b>-1&&y>-1){const x=Math.min(b,y),w=Math.max(b,y),S=o.slice(x,w+1);t(vd(r.concat(S)))}}else p.ctrlKey||p.metaKey?r.some(m=>m.image_name===e.image_name)&&r.length>1?t(vd(r.filter(m=>m.image_name!==e.image_name))):t(vd(r.concat(e))):t(vd([e]))}},[t,e,o,r,s]),c=l.useMemo(()=>e?r.some(p=>p.image_name===e.image_name):!1,[e,r]),d=l.useMemo(()=>r.length,[r.length]);return{selection:r,selectionCount:d,isSelected:c,handleClick:i}},Tse=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(rt,{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=l.memo(Tse),Nse=e=>{const t=le(),{imageName:n}=e,{currentData:r}=Rs(n),o=H(E=>E.hotkeys.shift),{t:s}=Q(),{handleClick:i,isSelected:c,selection:d,selectionCount:p}=Dse(r),h=Xg(Bx),m=l.useCallback(E=>{E.stopPropagation(),r&&t(vg([r]))},[t,r]),g=l.useMemo(()=>{if(p>1)return{id:"gallery-image",payloadType:"IMAGE_DTOS",payload:{imageDTOs:d}};if(r)return{id:"gallery-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r,d,p]),[b]=Hx(),[y]=Wx(),x=l.useCallback(()=>{r&&(r.starred&&y({imageDTOs:[r]}),r.starred||b({imageDTOs:[r]}))},[b,y,r]),[w,S]=l.useState(!1),j=l.useCallback(()=>{S(!0)},[]),I=l.useCallback(()=>{S(!1)},[]),_=l.useMemo(()=>{if(r!=null&&r.starred)return h?h.on.icon:a.jsx($2,{size:"20"});if(!(r!=null&&r.starred)&&w)return h?h.off.icon:a.jsx(N2,{size:"20"})},[r==null?void 0:r.starred,w,h]),M=l.useMemo(()=>r!=null&&r.starred?h?h.off.text:"Unstar":r!=null&&r.starred?"":h?h.on.text:"Star",[r==null?void 0:r.starred,h]);return r?a.jsx(Le,{sx:{w:"full",h:"full",touchAction:"none"},"data-testid":`image-${r.image_name}`,children:a.jsx(N,{userSelect:"none",sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:a.jsx(ll,{onClick:i,imageDTO:r,draggableData:g,isSelected:c,minSize:0,imageSx:{w:"full",h:"full"},isDropDisabled:!0,isUploadDisabled:!0,thumbnail:!0,withHoverOverlay:!0,onMouseOver:j,onMouseOut:I,children:a.jsxs(a.Fragment,{children:[a.jsx(du,{onClick:x,icon:_,tooltip:M}),w&&o&&a.jsx(du,{onClick:m,icon:a.jsx(Zo,{}),tooltip:s("gallery.deleteImage"),styleOverrides:{bottom:2,top:"auto"}})]})})})}):a.jsx(Ase,{})},$se=l.memo(Nse),Lse=De((e,t)=>a.jsx(Le,{className:"item-container",ref:t,p:1.5,"data-testid":"image-item-container",children:e.children})),zse=l.memo(Lse),Fse=De((e,t)=>{const n=H(r=>r.gallery.galleryImageMinimumWidth);return a.jsx(rl,{...e,className:"list-container",ref:t,sx:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr));`},"data-testid":"image-list-container",children:e.children})}),Bse=l.memo(Fse),Hse={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},Wse=()=>{const{t:e}=Q(),t=l.useRef(null),[n,r]=l.useState(null),[o,s]=y2(Hse),i=H(S=>S.gallery.selectedBoardId),{currentViewTotal:c}=ese(i),d=H(Ux),{currentData:p,isFetching:h,isSuccess:m,isError:g}=YI(d),[b]=JI(),y=l.useMemo(()=>!p||!c?!1:p.ids.length{y&&b({...d,offset:(p==null?void 0:p.ids.length)??0,limit:ZI})},[y,b,d,p==null?void 0:p.ids.length]),w=l.useCallback((S,j)=>a.jsx($se,{imageName:j},j),[]);return l.useEffect(()=>{const{current:S}=t;return n&&S&&o({target:S,elements:{viewport:n}}),()=>{var j;return(j=s())==null?void 0:j.destroy()}},[n,o,s]),p?m&&(p==null?void 0:p.ids.length)===0?a.jsx(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(eo,{label:e("gallery.noImagesInGallery"),icon:Xl})}):m&&p?a.jsxs(a.Fragment,{children:[a.jsx(Le,{ref:t,"data-overlayscrollbars":"",h:"100%",children:a.jsx(Zoe,{style:{height:"100%"},data:p.ids,endReached:x,components:{Item:zse,List:Bse},scrollerRef:r,itemContent:w})}),a.jsx(Dt,{onClick:x,isDisabled:!y,isLoading:h,loadingText:e("gallery.loading"),flexShrink:0,children:`Load More (${p.ids.length} of ${c})`})]}):g?a.jsx(Le,{sx:{w:"full",h:"full"},children:a.jsx(eo,{label:e("gallery.unableToLoad"),icon:Mee})}):null:a.jsx(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(eo,{label:e("gallery.loading"),icon:Xl})})},Vse=l.memo(Wse),Use=me([we],e=>{const{galleryView:t}=e.gallery;return{galleryView:t}},Ie),Gse=()=>{const{t:e}=Q(),t=l.useRef(null),n=l.useRef(null),{galleryView:r}=H(Use),o=le(),{isOpen:s,onToggle:i}=hs({defaultIsOpen:!0}),c=l.useCallback(()=>{o(tS("images"))},[o]),d=l.useCallback(()=>{o(tS("assets"))},[o]);return a.jsxs(q5,{layerStyle:"first",sx:{flexDirection:"column",h:"full",w:"full",borderRadius:"base",p:2},children:[a.jsxs(Le,{sx:{w:"full"},children:[a.jsxs(N,{ref:t,sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[a.jsx(hre,{isOpen:s,onToggle:i}),a.jsx(Sre,{})]}),a.jsx(Le,{children:a.jsx(dre,{isOpen:s})})]}),a.jsxs(N,{ref:n,direction:"column",gap:2,h:"full",w:"full",children:[a.jsx(N,{sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:a.jsx(tc,{index:r==="images"?0:1,variant:"unstyled",size:"sm",sx:{w:"full"},children:a.jsx(nc,{children:a.jsxs(Hn,{isAttached:!0,sx:{w:"full"},children:[a.jsx(wo,{as:Dt,size:"sm",isChecked:r==="images",onClick:c,sx:{w:"full"},leftIcon:a.jsx(Lee,{}),"data-testid":"images-tab",children:e("gallery.images")}),a.jsx(wo,{as:Dt,size:"sm",isChecked:r==="assets",onClick:d,sx:{w:"full"},leftIcon:a.jsx(Xee,{}),"data-testid":"assets-tab",children:e("gallery.assets")})]})})})}),a.jsx(Vse,{})]})]})},qse=l.memo(Gse),Kse=()=>{const e=H(p=>p.system.isConnected),{data:t}=Ha(),[n,{isLoading:r}]=Gx(),o=le(),{t:s}=Q(),i=l.useMemo(()=>t==null?void 0:t.queue.item_id,[t==null?void 0:t.queue.item_id]),c=l.useCallback(async()=>{if(i)try{await n(i).unwrap(),o(Ht({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(Ht({title:s("queue.cancelFailed"),status:"error"}))}},[i,o,s,n]),d=l.useMemo(()=>!e||si(i),[e,i]);return{cancelQueueItem:c,isLoading:r,currentQueueItemId:i,isDisabled:d}},Qse=({label:e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,asIconButton:i,isLoading:c,loadingText:d,sx:p})=>i?a.jsx(rt,{"aria-label":e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:c,sx:p,"data-testid":e}):a.jsx(Dt,{"aria-label":e,tooltip:t,leftIcon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:c,loadingText:d??e,flexGrow:1,sx:p,"data-testid":e,children:e}),lc=l.memo(Qse),Xse=({asIconButton:e,sx:t})=>{const{t:n}=Q(),{cancelQueueItem:r,isLoading:o,isDisabled:s}=Kse();return a.jsx(lc,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.cancel"),tooltip:n("queue.cancelTooltip"),icon:a.jsx(ku,{}),onClick:r,colorScheme:"error",sx:t})},O8=l.memo(Xse),Yse=()=>{const{t:e}=Q(),t=le(),{data:n}=Ha(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=eP({fixedCacheKey:"clearQueue"}),i=l.useCallback(async()=>{if(n!=null&&n.queue.total)try{await o().unwrap(),t(Ht({title:e("queue.clearSucceeded"),status:"success"})),t(qx(void 0)),t(Kx(void 0))}catch{t(Ht({title:e("queue.clearFailed"),status:"error"}))}},[n==null?void 0:n.queue.total,o,t,e]),c=l.useMemo(()=>!r||!(n!=null&&n.queue.total),[r,n==null?void 0:n.queue.total]);return{clearQueue:i,isLoading:s,queueStatus:n,isDisabled:c}},Jse=De((e,t)=>{const{t:n}=Q(),{acceptButtonText:r=n("common.accept"),acceptCallback:o,cancelButtonText:s=n("common.cancel"),cancelCallback:i,children:c,title:d,triggerComponent:p}=e,{isOpen:h,onOpen:m,onClose:g}=hs(),b=l.useRef(null),y=l.useCallback(()=>{o(),g()},[o,g]),x=l.useCallback(()=>{i&&i(),g()},[i,g]);return a.jsxs(a.Fragment,{children:[l.cloneElement(p,{onClick:m,ref:t}),a.jsx(Wf,{isOpen:h,leastDestructiveRef:b,onClose:g,isCentered:!0,children:a.jsx(Aa,{children:a.jsxs(Vf,{children:[a.jsx(Oa,{fontSize:"lg",fontWeight:"bold",children:d}),a.jsx(Ra,{children:c}),a.jsxs(pi,{children:[a.jsx(Dt,{ref:b,onClick:x,children:s}),a.jsx(Dt,{colorScheme:"error",onClick:y,ml:3,children:r})]})]})})})]})}),_0=l.memo(Jse),Zse=({asIconButton:e,sx:t})=>{const{t:n}=Q(),{clearQueue:r,isLoading:o,isDisabled:s}=Yse();return a.jsxs(_0,{title:n("queue.clearTooltip"),acceptCallback:r,acceptButtonText:n("queue.clear"),triggerComponent:a.jsx(lc,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.clear"),tooltip:n("queue.clearTooltip"),icon:a.jsx(Zo,{}),colorScheme:"error",sx:t}),children:[a.jsx(je,{children:n("queue.clearQueueAlertDialog")}),a.jsx("br",{}),a.jsx(je,{children:n("queue.clearQueueAlertDialog2")})]})},B2=l.memo(Zse),eae=()=>{const e=le(),{t}=Q(),n=H(p=>p.system.isConnected),{data:r}=Ha(),[o,{isLoading:s}]=tP({fixedCacheKey:"pauseProcessor"}),i=l.useMemo(()=>!!(r!=null&&r.processor.is_started),[r==null?void 0:r.processor.is_started]),c=l.useCallback(async()=>{if(i)try{await o().unwrap(),e(Ht({title:t("queue.pauseSucceeded"),status:"success"}))}catch{e(Ht({title:t("queue.pauseFailed"),status:"error"}))}},[i,o,e,t]),d=l.useMemo(()=>!n||!i,[n,i]);return{pauseProcessor:c,isLoading:s,isStarted:i,isDisabled:d}},tae=({asIconButton:e})=>{const{t}=Q(),{pauseProcessor:n,isLoading:r,isDisabled:o}=eae();return a.jsx(lc,{asIconButton:e,label:t("queue.pause"),tooltip:t("queue.pauseTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(Vee,{}),onClick:n,colorScheme:"gold"})},A8=l.memo(tae),nae=me([we,lo],({controlAdapters:e,generation:t,system:n,nodes:r,dynamicPrompts:o},s)=>{const{initialImage:i,model:c}=t,{isConnected:d}=n,p=[];return d||p.push(fn.t("parameters.invoke.systemDisconnected")),s==="img2img"&&!i&&p.push(fn.t("parameters.invoke.noInitialImageSelected")),s==="nodes"?r.shouldValidateGraph&&(r.nodes.length||p.push(fn.t("parameters.invoke.noNodesInGraph")),r.nodes.forEach(h=>{if(!Rr(h))return;const m=r.nodeTemplates[h.data.type];if(!m){p.push(fn.t("parameters.invoke.missingNodeTemplate"));return}const g=h7([h],r.edges);to(h.data.inputs,b=>{const y=m.inputs[b.name],x=g.some(w=>w.target===h.id&&w.targetHandle===b.name);if(!y){p.push(fn.t("parameters.invoke.missingFieldTemplate"));return}if(y.required&&b.value===void 0&&!x){p.push(fn.t("parameters.invoke.missingInputForField",{nodeLabel:h.data.label||m.title,fieldLabel:b.label||y.title}));return}})})):(o.prompts.length===0&&p.push(fn.t("parameters.invoke.noPrompts")),c||p.push(fn.t("parameters.invoke.noModelSelected")),m7(e).forEach((h,m)=>{h.isEnabled&&(h.model?h.model.base_model!==(c==null?void 0:c.base_model)&&p.push(fn.t("parameters.invoke.incompatibleBaseModelForControlAdapter",{number:m+1})):p.push(fn.t("parameters.invoke.noModelForControlAdapter",{number:m+1})),(!h.controlImage||Ru(h)&&!h.processedControlImage&&h.processorType!=="none")&&p.push(fn.t("parameters.invoke.noControlImageForControlAdapter",{number:m+1})))})),{isReady:!p.length,reasons:p}},Ie),H2=()=>{const{isReady:e,reasons:t}=H(nae);return{isReady:e,reasons:t}},R8=()=>{const e=le(),t=H(lo),{isReady:n}=H2(),[r,{isLoading:o}]=bg({fixedCacheKey:"enqueueBatch"}),s=l.useMemo(()=>!n,[n]);return{queueBack:l.useCallback(()=>{s||(e(Qx()),e(nP({tabName:t,prepend:!1})))},[e,s,t]),isLoading:o,isDisabled:s}},rae=me([we],({gallery:e})=>{const{autoAddBoardId:t}=e;return{autoAddBoardId:t}},Ie),oae=({prepend:e=!1})=>{const{t}=Q(),{isReady:n,reasons:r}=H2(),{autoAddBoardId:o}=H(rae),s=x0(o),[i,{isLoading:c}]=bg({fixedCacheKey:"enqueueBatch"}),d=l.useMemo(()=>t(c?"queue.enqueueing":n?e?"queue.queueFront":"queue.queueBack":"queue.notReady"),[c,n,e,t]);return a.jsxs(N,{flexDir:"column",gap:1,children:[a.jsx(je,{fontWeight:600,children:d}),r.length>0&&a.jsx(zf,{children:r.map((p,h)=>a.jsx(Ps,{children:a.jsx(je,{fontWeight:400,children:p})},`${p}.${h}`))}),a.jsx(T8,{}),a.jsxs(je,{fontWeight:400,fontStyle:"oblique 10deg",children:[t("parameters.invoke.addingImagesTo")," ",a.jsx(je,{as:"span",fontWeight:600,children:s||t("boards.uncategorized")})]})]})},D8=l.memo(oae),T8=l.memo(()=>a.jsx(io,{opacity:.2,borderColor:"base.50",_dark:{borderColor:"base.900"}}));T8.displayName="StyledDivider";const sae=()=>a.jsx(Le,{pos:"relative",w:4,h:4,children:a.jsx(_i,{src:Rx,alt:"invoke-ai-logo",pos:"absolute",top:-.5,insetInlineStart:-.5,w:5,h:5,minW:5,minH:5,filter:"saturate(0)"})}),aae=l.memo(sae),iae=({asIconButton:e,sx:t})=>{const{t:n}=Q(),{queueBack:r,isLoading:o,isDisabled:s}=R8();return a.jsx(lc,{asIconButton:e,colorScheme:"accent",label:n("parameters.invoke.invoke"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(D8,{}),sx:t,icon:e?a.jsx(aae,{}):void 0})},N8=l.memo(iae),$8=()=>{const e=le(),t=H(lo),{isReady:n}=H2(),[r,{isLoading:o}]=bg({fixedCacheKey:"enqueueBatch"}),s=Pn("prependQueue").isFeatureEnabled,i=l.useMemo(()=>!n||!s,[n,s]);return{queueFront:l.useCallback(()=>{i||(e(Qx()),e(nP({tabName:t,prepend:!0})))},[e,i,t]),isLoading:o,isDisabled:i}},lae=({asIconButton:e,sx:t})=>{const{t:n}=Q(),{queueFront:r,isLoading:o,isDisabled:s}=$8();return a.jsx(lc,{asIconButton:e,colorScheme:"base",label:n("queue.queueFront"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(D8,{prepend:!0}),icon:a.jsx(ase,{}),sx:t})},cae=l.memo(lae),uae=()=>{const e=le(),t=H(p=>p.system.isConnected),{data:n}=Ha(),{t:r}=Q(),[o,{isLoading:s}]=rP({fixedCacheKey:"resumeProcessor"}),i=l.useMemo(()=>!!(n!=null&&n.processor.is_started),[n==null?void 0:n.processor.is_started]),c=l.useCallback(async()=>{if(!i)try{await o().unwrap(),e(Ht({title:r("queue.resumeSucceeded"),status:"success"}))}catch{e(Ht({title:r("queue.resumeFailed"),status:"error"}))}},[i,o,e,r]),d=l.useMemo(()=>!t||i,[t,i]);return{resumeProcessor:c,isLoading:s,isStarted:i,isDisabled:d}},dae=({asIconButton:e})=>{const{t}=Q(),{resumeProcessor:n,isLoading:r,isDisabled:o}=uae();return a.jsx(lc,{asIconButton:e,label:t("queue.resume"),tooltip:t("queue.resumeTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(Uee,{}),onClick:n,colorScheme:"green"})},L8=l.memo(dae),fae=me(we,({system:e})=>{var t;return{isConnected:e.isConnected,hasSteps:!!e.denoiseProgress,value:(((t=e.denoiseProgress)==null?void 0:t.percentage)??0)*100}},Ie),pae=()=>{const{t:e}=Q(),{data:t}=Ha(),{hasSteps:n,value:r,isConnected:o}=H(fae);return a.jsx(_3,{value:r,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:o&&!!(t!=null&&t.queue.in_progress)&&!n,h:"full",w:"full",borderRadius:2,colorScheme:"accent"})},hae=l.memo(pae),mae=()=>{const e=Pn("pauseQueue").isFeatureEnabled,t=Pn("resumeQueue").isFeatureEnabled,n=Pn("prependQueue").isFeatureEnabled;return a.jsxs(N,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,gap:2,flexDir:"column"},children:[a.jsxs(N,{gap:2,w:"full",children:[a.jsxs(Hn,{isAttached:!0,flexGrow:2,children:[a.jsx(N8,{}),n?a.jsx(cae,{asIconButton:!0}):a.jsx(a.Fragment,{}),a.jsx(O8,{asIconButton:!0})]}),a.jsxs(Hn,{isAttached:!0,children:[t?a.jsx(L8,{asIconButton:!0}):a.jsx(a.Fragment,{}),e?a.jsx(A8,{asIconButton:!0}):a.jsx(a.Fragment,{})]}),a.jsx(B2,{asIconButton:!0})]}),a.jsx(N,{h:3,w:"full",children:a.jsx(hae,{})}),a.jsx(F8,{})]})},z8=l.memo(mae),F8=l.memo(()=>{const{t:e}=Q(),t=le(),{hasItems:n,pending:r}=Ha(void 0,{selectFromResult:({data:s})=>{if(!s)return{hasItems:!1,pending:0};const{pending:i,in_progress:c}=s.queue;return{hasItems:i+c>0,pending:i}}}),o=l.useCallback(()=>{t(ni("queue"))},[t]);return a.jsxs(N,{justifyContent:"space-between",alignItems:"center",pe:1,"data-testid":"queue-count",children:[a.jsx(Pi,{}),a.jsx(nl,{onClick:o,size:"sm",variant:"link",fontWeight:400,opacity:.7,fontStyle:"oblique 10deg",children:n?e("queue.queuedCount",{pending:r}):e("queue.queueEmpty")})]})});F8.displayName="QueueCounts";const{createElement:Iu,createContext:gae,forwardRef:B8,useCallback:Za,useContext:H8,useEffect:ui,useImperativeHandle:W8,useLayoutEffect:vae,useMemo:bae,useRef:is,useState:Qd}=Ox,C_=Ox["useId".toString()],Xd=vae,xae=typeof C_=="function"?C_:()=>null;let yae=0;function W2(e=null){const t=xae(),n=is(e||t||null);return n.current===null&&(n.current=""+yae++),n.current}const I0=gae(null);I0.displayName="PanelGroupContext";function V8({children:e=null,className:t="",collapsedSize:n=0,collapsible:r=!1,defaultSize:o=null,forwardedRef:s,id:i=null,maxSize:c=null,minSize:d,onCollapse:p=null,onResize:h=null,order:m=null,style:g={},tagName:b="div"}){const y=H8(I0);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const x=W2(i),{collapsePanel:w,expandPanel:S,getPanelSize:j,getPanelStyle:I,registerPanel:_,resizePanel:M,units:E,unregisterPanel:A}=y;d==null&&(E==="percentages"?d=10:d=0);const R=is({onCollapse:p,onResize:h});ui(()=>{R.current.onCollapse=p,R.current.onResize=h});const D=I(x,o),O=is({size:w_(D)}),T=is({callbacksRef:R,collapsedSize:n,collapsible:r,defaultSize:o,id:x,idWasAutoGenerated:i==null,maxSize:c,minSize:d,order:m});return Xd(()=>{O.current.size=w_(D),T.current.callbacksRef=R,T.current.collapsedSize=n,T.current.collapsible=r,T.current.defaultSize=o,T.current.id=x,T.current.idWasAutoGenerated=i==null,T.current.maxSize=c,T.current.minSize=d,T.current.order=m}),Xd(()=>(_(x,T),()=>{A(x)}),[m,x,_,A]),W8(s,()=>({collapse:()=>w(x),expand:()=>S(x),getCollapsed(){return O.current.size===0},getId(){return x},getSize(K){return j(x,K)},resize:(K,G)=>M(x,K,G)}),[w,S,j,x,M]),Iu(b,{children:e,className:t,"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-id":x,"data-panel-size":parseFloat(""+D.flexGrow).toFixed(1),id:`data-panel-id-${x}`,style:{...D,...g}})}const el=B8((e,t)=>Iu(V8,{...e,forwardedRef:t}));V8.displayName="Panel";el.displayName="forwardRef(Panel)";function w_(e){const{flexGrow:t}=e;return typeof t=="string"?parseFloat(t):t}const Jl=10;function Dd(e,t,n,r,o,s,i,c){const{id:d,panels:p,units:h}=t,m=h==="pixels"?Gi(d):NaN,{sizes:g}=c||{},b=g||s,y=Vo(p),x=b.concat();let w=0;{const I=o<0?r:n,_=y.findIndex(R=>R.current.id===I),M=y[_],E=b[_],A=dx(h,m,M,E,E+Math.abs(o),e);if(E===A)return b;A===0&&E>0&&i.set(I,E),o=o<0?E-A:A-E}let S=o<0?n:r,j=y.findIndex(I=>I.current.id===S);for(;;){const I=y[j],_=b[j],M=Math.abs(o)-Math.abs(w),E=dx(h,m,I,_,_-M,e);if(_!==E&&(E===0&&_>0&&i.set(I.current.id,_),w+=_-E,x[j]=E,w.toPrecision(Jl).localeCompare(Math.abs(o).toPrecision(Jl),void 0,{numeric:!0})>=0))break;if(o<0){if(--j<0)break}else if(++j>=y.length)break}return w===0?b:(S=o<0?r:n,j=y.findIndex(I=>I.current.id===S),x[j]=b[j]+w,x)}function Tc(e,t,n){t.forEach((r,o)=>{const s=e[o];if(!s)return;const{callbacksRef:i,collapsedSize:c,collapsible:d,id:p}=s.current,h=n[p];if(h!==r){n[p]=r;const{onCollapse:m,onResize:g}=i.current;g&&g(r,h),d&&m&&((h==null||h===c)&&r!==c?m(!1):h!==c&&r===c&&m(!0))}})}function Cae({groupId:e,panels:t,units:n}){const r=n==="pixels"?Gi(e):NaN,o=Vo(t),s=Array(o.length);let i=0,c=100;for(let d=0;di.current.id===e);if(n<0)return[null,null];const r=n===t.length-1,o=r?t[n-1].current.id:e,s=r?e:t[n+1].current.id;return[o,s]}function Gi(e){const t=xf(e);if(t==null)return NaN;const n=t.getAttribute("data-panel-group-direction"),r=V2(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 U8(e,t,n){if(e.size===1)return"100";const o=Vo(e).findIndex(i=>i.current.id===t),s=n[o];return s==null?"0":s.toPrecision(Jl)}function wae(e){const t=document.querySelector(`[data-panel-id="${e}"]`);return t||null}function xf(e){const t=document.querySelector(`[data-panel-group-id="${e}"]`);return t||null}function P0(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function Sae(e){return G8().findIndex(r=>r.getAttribute("data-panel-resize-handle-id")===e)??null}function G8(){return Array.from(document.querySelectorAll("[data-panel-resize-handle-id]"))}function V2(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function U2(e,t,n){var d,p,h,m;const r=P0(t),o=V2(e),s=r?o.indexOf(r):-1,i=((p=(d=n[s])==null?void 0:d.current)==null?void 0:p.id)??null,c=((m=(h=n[s+1])==null?void 0:h.current)==null?void 0:m.id)??null;return[i,c]}function Vo(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 dx(e,t,n,r,o,s=null){var h;let{collapsedSize:i,collapsible:c,maxSize:d,minSize:p}=n.current;if(e==="pixels"&&(i=i/t*100,d!=null&&(d=d/t*100),p=p/t*100),c){if(r>i){if(o<=p/2+i)return i}else if(!((h=s==null?void 0:s.type)==null?void 0:h.startsWith("key"))&&o100)&&(t.current.minSize=0),o!=null&&(o<0||e==="percentages"&&o>100)&&(t.current.maxSize=null),r!==null&&(r<0||e==="percentages"&&r>100?t.current.defaultSize=null:ro&&(t.current.defaultSize=o))}function D1({groupId:e,panels:t,nextSizes:n,prevSizes:r,units:o}){n=[...n];const s=Vo(t),i=o==="pixels"?Gi(e):NaN;let c=0;for(let d=0;d{const{direction:i,panels:c}=e.current,d=xf(t);q8(d!=null,`No group found for id "${t}"`);const{height:p,width:h}=d.getBoundingClientRect(),g=V2(t).map(b=>{const y=b.getAttribute("data-panel-resize-handle-id"),x=Vo(c),[w,S]=U2(t,y,x);if(w==null||S==null)return()=>{};let j=0,I=100,_=0,M=0;x.forEach(T=>{const{id:K,maxSize:G,minSize:X}=T.current;K===w?(j=X,I=G??100):(_+=X,M+=G??100)});const E=Math.min(I,100-_),A=Math.max(j,(x.length-1)*100-M),R=U8(c,w,o);b.setAttribute("aria-valuemax",""+Math.round(E)),b.setAttribute("aria-valuemin",""+Math.round(A)),b.setAttribute("aria-valuenow",""+Math.round(parseInt(R)));const D=T=>{if(!T.defaultPrevented)switch(T.key){case"Enter":{T.preventDefault();const K=x.findIndex(G=>G.current.id===w);if(K>=0){const G=x[K],X=o[K];if(X!=null){let Z=0;X.toPrecision(Jl)<=G.current.minSize.toPrecision(Jl)?Z=i==="horizontal"?h:p:Z=-(i==="horizontal"?h:p);const te=Dd(T,e.current,w,S,Z,o,s.current,null);o!==te&&r(te)}}break}}};b.addEventListener("keydown",D);const O=wae(w);return O!=null&&b.setAttribute("aria-controls",O.id),()=>{b.removeAttribute("aria-valuemax"),b.removeAttribute("aria-valuemin"),b.removeAttribute("aria-valuenow"),b.removeEventListener("keydown",D),O!=null&&b.removeAttribute("aria-controls")}});return()=>{g.forEach(b=>b())}},[e,t,n,s,r,o])}function _ae({disabled:e,handleId:t,resizeHandler:n}){ui(()=>{if(e||n==null)return;const r=P0(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=G8(),c=Sae(t);q8(c!==null);const d=s.shiftKey?c>0?c-1:i.length-1:c+1{r.removeEventListener("keydown",o)}},[e,t,n])}function T1(e,t){if(e.length!==t.length)return!1;for(let n=0;nA.current.id===_),E=r[M];if(E.current.collapsible){const A=h[M];(A===0||A.toPrecision(Jl)===E.current.minSize.toPrecision(Jl))&&(S=S<0?-E.current.minSize*y:E.current.minSize*y)}return S}else return K8(e,n,o,c,d)}function Pae(e){return e.type==="keydown"}function fx(e){return e.type.startsWith("mouse")}function px(e){return e.type.startsWith("touch")}let hx=null,Dl=null;function Q8(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 Eae(){Dl!==null&&(document.head.removeChild(Dl),hx=null,Dl=null)}function N1(e){if(hx===e)return;hx=e;const t=Q8(e);Dl===null&&(Dl=document.createElement("style"),document.head.appendChild(Dl)),Dl.innerHTML=`*{cursor: ${t}!important;}`}function Mae(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function X8(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 Y8(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 Oae(e,t,n){const r=Y8(e,n);if(r){const o=X8(t);return r[o]??null}return null}function Aae(e,t,n,r){const o=X8(t),s=Y8(e,r)||{};s[o]=n;try{r.setItem(`PanelGroup:sizes:${e}`,JSON.stringify(s))}catch(i){console.error(i)}}const $1={};function S_(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 Td={getItem:e=>(S_(Td),Td.getItem(e)),setItem:(e,t)=>{S_(Td),Td.setItem(e,t)}};function J8({autoSaveId:e,children:t=null,className:n="",direction:r,disablePointerEventsDuringResize:o=!1,forwardedRef:s,id:i=null,onLayout:c,storage:d=Td,style:p={},tagName:h="div",units:m="percentages"}){const g=W2(i),[b,y]=Qd(null),[x,w]=Qd(new Map),S=is(null);is({didLogDefaultSizeWarning:!1,didLogIdAndOrderWarning:!1,didLogInvalidLayoutWarning:!1,prevPanelIds:[]});const j=is({onLayout:c});ui(()=>{j.current.onLayout=c});const I=is({}),[_,M]=Qd([]),E=is(new Map),A=is(0),R=is({direction:r,id:g,panels:x,sizes:_,units:m});W8(s,()=>({getId:()=>g,getLayout:ne=>{const{sizes:se,units:re}=R.current;if((ne??re)==="pixels"){const B=Gi(g);return se.map(Y=>Y/100*B)}else return se},setLayout:(ne,se)=>{const{id:re,panels:ae,sizes:B,units:Y}=R.current;if((se||Y)==="pixels"){const pe=Gi(re);ne=ne.map(W=>W/pe*100)}const $=I.current,F=Vo(ae),q=D1({groupId:re,panels:ae,nextSizes:ne,prevSizes:B,units:Y});T1(B,q)||(M(q),Tc(F,q,$))}}),[g]),Xd(()=>{R.current.direction=r,R.current.id=g,R.current.panels=x,R.current.sizes=_,R.current.units=m}),jae({committedValuesRef:R,groupId:g,panels:x,setSizes:M,sizes:_,panelSizeBeforeCollapse:E}),ui(()=>{const{onLayout:ne}=j.current,{panels:se,sizes:re}=R.current;if(re.length>0){ne&&ne(re);const ae=I.current,B=Vo(se);Tc(B,re,ae)}},[_]),Xd(()=>{const{id:ne,sizes:se,units:re}=R.current;if(se.length===x.size)return;let ae=null;if(e){const B=Vo(x);ae=Oae(e,B,d)}if(ae!=null){const B=D1({groupId:ne,panels:x,nextSizes:ae,prevSizes:ae,units:re});M(B)}else{const B=Cae({groupId:ne,panels:x,units:re});M(B)}},[e,x,d]),ui(()=>{if(e){if(_.length===0||_.length!==x.size)return;const ne=Vo(x);$1[e]||($1[e]=Mae(Aae,100)),$1[e](e,ne,_,d)}},[e,x,_,d]),Xd(()=>{if(m==="pixels"){const ne=new ResizeObserver(()=>{const{panels:se,sizes:re}=R.current,ae=D1({groupId:g,panels:se,nextSizes:re,prevSizes:re,units:m});T1(re,ae)||M(ae)});return ne.observe(xf(g)),()=>{ne.disconnect()}}},[g,m]);const D=Za((ne,se)=>{const{panels:re,units:ae}=R.current,Y=Vo(re).findIndex(q=>q.current.id===ne),$=_[Y];if((se??ae)==="pixels"){const q=Gi(g);return $/100*q}else return $},[g,_]),O=Za((ne,se)=>{const{panels:re}=R.current;return re.size===0?{flexBasis:0,flexGrow:se??void 0,flexShrink:1,overflow:"hidden"}:{flexBasis:0,flexGrow:U8(re,ne,_),flexShrink:1,overflow:"hidden",pointerEvents:o&&b!==null?"none":void 0}},[b,o,_]),T=Za((ne,se)=>{const{units:re}=R.current;kae(re,se),w(ae=>{if(ae.has(ne))return ae;const B=new Map(ae);return B.set(ne,se),B})},[]),K=Za(ne=>re=>{re.preventDefault();const{direction:ae,panels:B,sizes:Y}=R.current,$=Vo(B),[F,q]=U2(g,ne,$);if(F==null||q==null)return;let pe=Iae(re,g,ne,$,ae,Y,S.current);if(pe===0)return;const U=xf(g).getBoundingClientRect(),ee=ae==="horizontal";document.dir==="rtl"&&ee&&(pe=-pe);const J=ee?U.width:U.height,ge=pe/J*100,he=Dd(re,R.current,F,q,ge,Y,E.current,S.current),de=!T1(Y,he);if((fx(re)||px(re))&&A.current!=ge&&N1(de?ee?"horizontal":"vertical":ee?pe<0?"horizontal-min":"horizontal-max":pe<0?"vertical-min":"vertical-max"),de){const _e=I.current;M(he),Tc($,he,_e)}A.current=ge},[g]),G=Za(ne=>{w(se=>{if(!se.has(ne))return se;const re=new Map(se);return re.delete(ne),re})},[]),X=Za(ne=>{const{panels:se,sizes:re}=R.current,ae=se.get(ne);if(ae==null)return;const{collapsedSize:B,collapsible:Y}=ae.current;if(!Y)return;const $=Vo(se),F=$.indexOf(ae);if(F<0)return;const q=re[F];if(q===B)return;E.current.set(ne,q);const[pe,W]=R1(ne,$);if(pe==null||W==null)return;const ee=F===$.length-1?q:B-q,J=Dd(null,R.current,pe,W,ee,re,E.current,null);if(re!==J){const ge=I.current;M(J),Tc($,J,ge)}},[]),Z=Za(ne=>{const{panels:se,sizes:re}=R.current,ae=se.get(ne);if(ae==null)return;const{collapsedSize:B,minSize:Y}=ae.current,$=E.current.get(ne)||Y;if(!$)return;const F=Vo(se),q=F.indexOf(ae);if(q<0||re[q]!==B)return;const[W,U]=R1(ne,F);if(W==null||U==null)return;const J=q===F.length-1?B-$:$,ge=Dd(null,R.current,W,U,J,re,E.current,null);if(re!==ge){const he=I.current;M(ge),Tc(F,ge,he)}},[]),te=Za((ne,se,re)=>{const{id:ae,panels:B,sizes:Y,units:$}=R.current;if((re||$)==="pixels"){const ht=Gi(ae);se=se/ht*100}const F=B.get(ne);if(F==null)return;let{collapsedSize:q,collapsible:pe,maxSize:W,minSize:U}=F.current;if($==="pixels"){const ht=Gi(ae);U=U/ht*100,W!=null&&(W=W/ht*100)}const ee=Vo(B),J=ee.indexOf(F);if(J<0)return;const ge=Y[J];if(ge===se)return;pe&&se===q||(se=Math.min(W??100,Math.max(U,se)));const[he,de]=R1(ne,ee);if(he==null||de==null)return;const Pe=J===ee.length-1?ge-se:se-ge,ze=Dd(null,R.current,he,de,Pe,Y,E.current,null);if(Y!==ze){const ht=I.current;M(ze),Tc(ee,ze,ht)}},[]),V=bae(()=>({activeHandleId:b,collapsePanel:X,direction:r,expandPanel:Z,getPanelSize:D,getPanelStyle:O,groupId:g,registerPanel:T,registerResizeHandle:K,resizePanel:te,startDragging:(ne,se)=>{if(y(ne),fx(se)||px(se)){const re=P0(ne);S.current={dragHandleRect:re.getBoundingClientRect(),dragOffset:K8(se,ne,r),sizes:R.current.sizes}}},stopDragging:()=>{Eae(),y(null),S.current=null},units:m,unregisterPanel:G}),[b,X,r,Z,D,O,g,T,K,te,m,G]),oe={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Iu(I0.Provider,{children:Iu(h,{children:t,className:n,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":g,"data-panel-group-units":m,style:{...oe,...p}}),value:V})}const E0=B8((e,t)=>Iu(J8,{...e,forwardedRef:t}));J8.displayName="PanelGroup";E0.displayName="forwardRef(PanelGroup)";function mx({children:e=null,className:t="",disabled:n=!1,id:r=null,onDragging:o,style:s={},tagName:i="div"}){const c=is(null),d=is({onDragging:o});ui(()=>{d.current.onDragging=o});const p=H8(I0);if(p===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{activeHandleId:h,direction:m,groupId:g,registerResizeHandle:b,startDragging:y,stopDragging:x}=p,w=W2(r),S=h===w,[j,I]=Qd(!1),[_,M]=Qd(null),E=Za(()=>{c.current.blur(),x();const{onDragging:D}=d.current;D&&D(!1)},[x]);ui(()=>{if(n)M(null);else{const R=b(w);M(()=>R)}},[n,w,b]),ui(()=>{if(n||_==null||!S)return;const R=K=>{_(K)},D=K=>{_(K)},T=c.current.ownerDocument;return T.body.addEventListener("contextmenu",E),T.body.addEventListener("mousemove",R),T.body.addEventListener("touchmove",R),T.body.addEventListener("mouseleave",D),window.addEventListener("mouseup",E),window.addEventListener("touchend",E),()=>{T.body.removeEventListener("contextmenu",E),T.body.removeEventListener("mousemove",R),T.body.removeEventListener("touchmove",R),T.body.removeEventListener("mouseleave",D),window.removeEventListener("mouseup",E),window.removeEventListener("touchend",E)}},[m,n,S,_,E]),_ae({disabled:n,handleId:w,resizeHandler:_});const A={cursor:Q8(m),touchAction:"none",userSelect:"none"};return Iu(i,{children:e,className:t,"data-resize-handle-active":S?"pointer":j?"keyboard":void 0,"data-panel-group-direction":m,"data-panel-group-id":g,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":w,onBlur:()=>I(!1),onFocus:()=>I(!0),onMouseDown:R=>{y(w,R.nativeEvent);const{onDragging:D}=d.current;D&&D(!0)},onMouseUp:E,onTouchCancel:E,onTouchEnd:E,onTouchStart:R=>{y(w,R.nativeEvent);const{onDragging:D}=d.current;D&&D(!0)},ref:c,role:"separator",style:{...A,...s},tabIndex:0})}mx.displayName="PanelResizeHandle";const Rae=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(mx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(N,{className:"resize-handle-horizontal",sx:{w:n?2.5:4,h:"full",justifyContent:n?n==="left"?"flex-start":"flex-end":"center",alignItems:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Le,{sx:{w:1,h:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})}):a.jsx(mx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(N,{className:"resize-handle-vertical",sx:{w:"full",h:n?2.5:4,alignItems:n?n==="top"?"flex-start":"flex-end":"center",justifyContent:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Le,{sx:{h:1,w:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})})},lg=l.memo(Rae),G2=()=>{const e=le(),t=H(o=>o.ui.panels),n=l.useCallback(o=>t[o]??"",[t]),r=l.useCallback((o,s)=>{e(g7({name:o,value:s}))},[e]);return{getItem:n,setItem:r}};const Dae=e=>{const{label:t,data:n,fileName:r,withDownload:o=!0,withCopy:s=!0}=e,i=l.useMemo(()=>v7(n)?n:JSON.stringify(n,null,2),[n]),c=l.useCallback(()=>{navigator.clipboard.writeText(i)},[i]),d=l.useCallback(()=>{const h=new Blob([i]),m=document.createElement("a");m.href=URL.createObjectURL(h),m.download=`${r||t}.json`,document.body.appendChild(m),m.click(),m.remove()},[i,t,r]),{t:p}=Q();return a.jsxs(N,{layerStyle:"second",sx:{borderRadius:"base",flexGrow:1,w:"full",h:"full",position:"relative"},children:[a.jsx(Le,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"auto",p:4,fontSize:"sm"},children:a.jsx(v0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsx("pre",{children:i})})}),a.jsxs(N,{sx:{position:"absolute",top:0,insetInlineEnd:0,p:2},children:[o&&a.jsx(Wn,{label:`${p("gallery.download")} ${t} JSON`,children:a.jsx(Ia,{"aria-label":`${p("gallery.download")} ${t} JSON`,icon:a.jsx(Wu,{}),variant:"ghost",opacity:.7,onClick:d})}),s&&a.jsx(Wn,{label:`${p("gallery.copy")} ${t} JSON`,children:a.jsx(Ia,{"aria-label":`${p("gallery.copy")} ${t} JSON`,icon:a.jsx(Hu,{}),variant:"ghost",opacity:.7,onClick:c})})]})]})},tl=l.memo(Dae),Tae=me(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}},Ie),Nae=()=>{const{data:e}=H(Tae);return e?a.jsx(tl,{data:e,label:"Node Data"}):a.jsx(eo,{label:"No node selected",icon:null})},$ae=l.memo(Nae),Lae=({children:e,maxHeight:t})=>a.jsx(N,{sx:{w:"full",h:"full",maxHeight:t,position:"relative"},children:a.jsx(Le,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(v0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:e})})}),cc=l.memo(Lae),zae=({output:e})=>{const{image:t}=e,{data:n}=Rs(t.image_name);return a.jsx(ll,{imageDTO:n})},Fae=l.memo(zae),Bae=me(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}},Ie),Hae=()=>{const{node:e,template:t,nes:n}=H(Bae),{t:r}=Q();return!e||!n||!Rr(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(Le,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(cc,{children:a.jsx(N,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:(t==null?void 0:t.outputType)==="image_output"?n.outputs.map((o,s)=>a.jsx(Fae,{output:o},Vae(o,s))):a.jsx(tl,{data:n.outputs,label:r("nodes.nodeOutputs")})})})})},Wae=l.memo(Hae),Vae=(e,t)=>`${e.type}-${t}`,Uae=me(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}},Ie),Gae=()=>{const{template:e}=H(Uae),{t}=Q();return e?a.jsx(tl,{data:e,label:t("nodes.nodeTemplate")}):a.jsx(eo,{label:t("nodes.noNodeSelected"),icon:null})},qae=l.memo(Gae),q2=e=>{e.stopPropagation()},Kae=De((e,t)=>{const n=le(),r=l.useCallback(s=>{s.shiftKey&&n(Qo(!0))},[n]),o=l.useCallback(s=>{s.shiftKey||n(Qo(!1))},[n]);return a.jsx(K3,{ref:t,onPaste:q2,onKeyDown:r,onKeyUp:o,...e})}),yi=l.memo(Kae),K2=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return o==null?void 0:o.data},Ie),[e]);return H(t)},Qae=({nodeId:e})=>{const t=le(),n=K2(e),{t:r}=Q(),o=l.useCallback(s=>{t(b7({nodeId:e,notes:s.target.value}))},[t,e]);return Kh(n)?a.jsxs(Vn,{children:[a.jsx(yr,{children:r("nodes.notes")}),a.jsx(yi,{value:n==null?void 0:n.notes,onChange:o,rows:10})]}):null},Xae=l.memo(Qae),Z8=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.label:!1},Ie),[e]);return H(t)},eA=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Rr(o))return!1;const s=o?r.nodeTemplates[o.data.type]:void 0;return s==null?void 0:s.title},Ie),[e]);return H(t)},Yae=({nodeId:e,title:t})=>{const n=le(),r=Z8(e),o=eA(e),{t:s}=Q(),[i,c]=l.useState(""),d=l.useCallback(async h=>{n(oP({nodeId:e,label:h})),c(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),p=l.useCallback(h=>{c(h)},[]);return l.useEffect(()=>{c(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsxs(Lf,{as:N,value:i,onChange:p,onSubmit:d,w:"full",fontWeight:600,children:[a.jsx($f,{noOfLines:1}),a.jsx(Nf,{className:"nodrag",_focusVisible:{boxShadow:"none"}})]})})},Jae=l.memo(Yae),Zae=me(we,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(o=>o.id===t),r=n?e.nodeTemplates[n.data.type]:void 0;return{node:n,template:r}},Ie),eie=()=>{const{node:e,template:t}=H(Zae),{t:n}=Q();return!t||!Rr(e)?a.jsx(eo,{label:n("nodes.noNodeSelected"),icon:null}):a.jsx(nie,{node:e,template:t})},tie=l.memo(eie),nie=e=>{const{t}=Q(),{needsUpdate:n,updateNode:r}=sP(e.node.id);return a.jsx(Le,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(cc,{children:a.jsxs(N,{sx:{flexDir:"column",position:"relative",p:1,gap:2,w:"full"},children:[a.jsx(Jae,{nodeId:e.node.data.id}),a.jsxs(Pg,{children:[a.jsxs(Vn,{children:[a.jsx(yr,{children:"Node Type"}),a.jsx(je,{fontSize:"sm",fontWeight:600,children:e.template.title})]}),a.jsxs(N,{flexDir:"row",alignItems:"center",justifyContent:"space-between",w:"full",children:[a.jsxs(Vn,{isInvalid:n,children:[a.jsx(yr,{children:"Node Version"}),a.jsx(je,{fontSize:"sm",fontWeight:600,children:e.node.data.version})]}),n&&a.jsx(rt,{"aria-label":t("nodes.updateNode"),tooltip:t("nodes.updateNode"),icon:a.jsx(s0,{}),onClick:r})]})]}),a.jsx(Xae,{nodeId:e.node.data.id})]})})})},rie=()=>{const{t:e}=Q();return a.jsx(N,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(tc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(nc,{children:[a.jsx(wo,{children:e("common.details")}),a.jsx(wo,{children:e("common.outputs")}),a.jsx(wo,{children:e("common.data")}),a.jsx(wo,{children:e("common.template")})]}),a.jsxs($u,{children:[a.jsx(Go,{children:a.jsx(tie,{})}),a.jsx(Go,{children:a.jsx(Wae,{})}),a.jsx(Go,{children:a.jsx($ae,{})}),a.jsx(Go,{children:a.jsx(qae,{})})]})]})})},oie=l.memo(rie),sie={display:"flex",flexDirection:"row",alignItems:"center",gap:10},aie=e=>{const{label:t="",labelPos:n="top",isDisabled:r=!1,isInvalid:o,formControlProps:s,...i}=e,c=le(),d=l.useCallback(h=>{h.shiftKey&&c(Qo(!0))},[c]),p=l.useCallback(h=>{h.shiftKey||c(Qo(!1))},[c]);return a.jsxs(Vn,{isInvalid:o,isDisabled:r,...s,style:n==="side"?sie:void 0,children:[t!==""&&a.jsx(yr,{children:t}),a.jsx(_g,{...i,onPaste:q2,onKeyDown:d,onKeyUp:p})]})},Is=l.memo(aie),iie=me(we,({nodes:e})=>{const{author:t,name:n,description:r,tags:o,version:s,contact:i,notes:c}=e.workflow;return{name:n,author:t,description:r,tags:o,version:s,contact:i,notes:c}},Ie),lie=()=>{const{author:e,name:t,description:n,tags:r,version:o,contact:s,notes:i}=H(iie),c=le(),d=l.useCallback(w=>{c(x7(w.target.value))},[c]),p=l.useCallback(w=>{c(y7(w.target.value))},[c]),h=l.useCallback(w=>{c(C7(w.target.value))},[c]),m=l.useCallback(w=>{c(w7(w.target.value))},[c]),g=l.useCallback(w=>{c(S7(w.target.value))},[c]),b=l.useCallback(w=>{c(k7(w.target.value))},[c]),y=l.useCallback(w=>{c(j7(w.target.value))},[c]),{t:x}=Q();return a.jsx(cc,{children:a.jsxs(N,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:[a.jsxs(N,{sx:{gap:2,w:"full"},children:[a.jsx(Is,{label:x("nodes.workflowName"),value:t,onChange:d}),a.jsx(Is,{label:x("nodes.workflowVersion"),value:o,onChange:m})]}),a.jsxs(N,{sx:{gap:2,w:"full"},children:[a.jsx(Is,{label:x("nodes.workflowAuthor"),value:e,onChange:p}),a.jsx(Is,{label:x("nodes.workflowContact"),value:s,onChange:h})]}),a.jsx(Is,{label:x("nodes.workflowTags"),value:r,onChange:b}),a.jsxs(Vn,{as:N,sx:{flexDir:"column"},children:[a.jsx(yr,{children:x("nodes.workflowDescription")}),a.jsx(yi,{onChange:g,value:n,fontSize:"sm",sx:{resize:"none"}})]}),a.jsxs(Vn,{as:N,sx:{flexDir:"column",h:"full"},children:[a.jsx(yr,{children:x("nodes.workflowNotes")}),a.jsx(yi,{onChange:y,value:i,fontSize:"sm",sx:{h:"full",resize:"none"}})]})]})})},cie=l.memo(lie),tA=()=>{const e=H(r=>r.nodes),[t]=L2(e,300);return l.useMemo(()=>_7(t),[t])},uie=()=>{const e=tA(),{t}=Q();return a.jsx(N,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:a.jsx(tl,{data:e,label:t("nodes.workflow")})})},die=l.memo(uie),fie=({isSelected:e,isHovered:t})=>{const n=l.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.light";if(e)return"nodeSelected.light";if(t)return"nodeHovered.light"},[t,e]),r=l.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.dark";if(e)return"nodeSelected.dark";if(t)return"nodeHovered.dark"},[t,e]);return a.jsx(Le,{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}}})},nA=l.memo(fie),rA=e=>{const t=le(),n=l.useMemo(()=>me(we,({nodes:i})=>i.mouseOverNode===e,Ie),[e]),r=H(n),o=l.useCallback(()=>{!r&&t(nS(e))},[t,e,r]),s=l.useCallback(()=>{r&&t(nS(null))},[t,r]);return{isMouseOverNode:r,handleMouseOver:o,handleMouseOut:s}},oA=(e,t)=>{const n=l.useMemo(()=>me(we,({nodes:o})=>{var i;const s=o.nodes.find(c=>c.id===e);if(Rr(s))return(i=s==null?void 0:s.data.inputs[t])==null?void 0:i.label},Ie),[t,e]);return H(n)},sA=(e,t,n)=>{const r=l.useMemo(()=>me(we,({nodes:s})=>{var d;const i=s.nodes.find(p=>p.id===e);if(!Rr(i))return;const c=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return(d=c==null?void 0:c[Xx[n]][t])==null?void 0:d.title},Ie),[t,n,e]);return H(r)},aA=(e,t)=>{const n=l.useMemo(()=>me(we,({nodes:o})=>{const s=o.nodes.find(i=>i.id===e);if(Rr(s))return s==null?void 0:s.data.inputs[t]},Ie),[t,e]);return H(n)},M0=(e,t,n)=>{const r=l.useMemo(()=>me(we,({nodes:s})=>{const i=s.nodes.find(d=>d.id===e);if(!Rr(i))return;const c=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return c==null?void 0:c[Xx[n]][t]},Ie),[t,n,e]);return H(r)},pie=({nodeId:e,fieldName:t,kind:n})=>{const r=aA(e,t),o=M0(e,t,n),s=I7(o),{t:i}=Q(),c=l.useMemo(()=>P7(r)?r.label&&(o!=null&&o.title)?`${r.label} (${o.title})`:r.label&&!o?r.label:!r.label&&o?o.title:i("nodes.unknownField"):(o==null?void 0:o.title)||i("nodes.unknownField"),[r,o,i]);return a.jsxs(N,{sx:{flexDir:"column"},children:[a.jsx(je,{sx:{fontWeight:600},children:c}),o&&a.jsx(je,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:o.description}),o&&a.jsxs(je,{children:["Type: ",If[o.type].title]}),s&&a.jsxs(je,{children:["Input: ",E7(o.input)]})]})},Q2=l.memo(pie),hie=De((e,t)=>{const{nodeId:n,fieldName:r,kind:o,isMissingInput:s=!1,withTooltip:i=!1}=e,c=oA(n,r),d=sA(n,r,o),{t:p}=Q(),h=le(),[m,g]=l.useState(c||d||p("nodes.unknownField")),b=l.useCallback(async x=>{x&&(x===c||x===d)||(g(x||d||p("nodes.unknownField")),h(M7({nodeId:n,fieldName:r,label:x})))},[c,d,h,n,r,p]),y=l.useCallback(x=>{g(x)},[]);return l.useEffect(()=>{g(c||d||p("nodes.unknownField"))},[c,d,p]),a.jsx(Wn,{label:i?a.jsx(Q2,{nodeId:n,fieldName:r,kind:"input"}):void 0,openDelay:xg,placement:"top",hasArrow:!0,children:a.jsx(N,{ref:t,sx:{position:"relative",overflow:"hidden",alignItems:"center",justifyContent:"flex-start",gap:1,h:"full"},children:a.jsxs(Lf,{value:m,onChange:y,onSubmit:b,as:N,sx:{position:"relative",alignItems:"center",h:"full"},children:[a.jsx($f,{sx:{p:0,fontWeight:s?600:400,textAlign:"left",_hover:{fontWeight:"600 !important"}},noOfLines:1}),a.jsx(Nf,{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(lA,{})]})})})}),iA=l.memo(hie),lA=l.memo(()=>{const{isEditing:e,getEditButtonProps:t}=e5(),n=l.useCallback(r=>{const{onClick:o}=t();o&&(o(r),r.preventDefault())},[t]);return e?null:a.jsx(N,{onClick:n,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,cursor:"text"})});lA.displayName="EditableControls";const mie=e=>{const{nodeId:t,field:n}=e,r=le(),o=l.useCallback(s=>{r(O7({nodeId:t,fieldName:n.name,value:s.target.checked}))},[r,n.name,t]);return a.jsx(Fy,{className:"nodrag",onChange:o,isChecked:n.value})},gie=l.memo(mie);function O0(){return(O0=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function gx(e){var t=l.useRef(e),n=l.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Pu=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:w.buttons>0)&&o.current?s(k_(o.current,w,c.current)):x(!1)},y=function(){return x(!1)};function x(w){var S=d.current,j=vx(o.current),I=w?j.addEventListener:j.removeEventListener;I(S?"touchmove":"mousemove",b),I(S?"touchend":"mouseup",y)}return[function(w){var S=w.nativeEvent,j=o.current;if(j&&(j_(S),!function(_,M){return M&&!Yd(_)}(S,d.current)&&j)){if(Yd(S)){d.current=!0;var I=S.changedTouches||[];I.length&&(c.current=I[0].identifier)}j.focus(),s(k_(j,S,c.current)),x(!0)}},function(w){var S=w.which||w.keyCode;S<37||S>40||(w.preventDefault(),i({left:S===39?.05:S===37?-.05:0,top:S===40?.05:S===38?-.05:0}))},x]},[i,s]),h=p[0],m=p[1],g=p[2];return l.useEffect(function(){return g},[g]),z.createElement("div",O0({},r,{onTouchStart:h,onMouseDown:h,className:"react-colorful__interactive",ref:o,onKeyDown:m,tabIndex:0,role:"slider"}))}),A0=function(e){return e.filter(Boolean).join(" ")},Y2=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=A0(["react-colorful__pointer",e.className]);return z.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},z.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Ao=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},uA=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:Ao(e.h),s:Ao(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:Ao(o/2),a:Ao(r,2)}},bx=function(e){var t=uA(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},L1=function(e){var t=uA(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},vie=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),i=r*(1-n),c=r*(1-(t-s)*n),d=r*(1-(1-t+s)*n),p=s%6;return{r:Ao(255*[r,c,i,i,d,r][p]),g:Ao(255*[d,r,r,c,i,i][p]),b:Ao(255*[i,i,d,r,r,c][p]),a:Ao(o,2)}},bie=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),i=s-Math.min(t,n,r),c=i?s===t?(n-r)/i:s===n?2+(r-t)/i:4+(t-n)/i:0;return{h:Ao(60*(c<0?c+6:c)),s:Ao(s?i/s*100:0),v:Ao(s/255*100),a:o}},xie=z.memo(function(e){var t=e.hue,n=e.onChange,r=A0(["react-colorful__hue",e.className]);return z.createElement("div",{className:r},z.createElement(X2,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Pu(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":Ao(t),"aria-valuemax":"360","aria-valuemin":"0"},z.createElement(Y2,{className:"react-colorful__hue-pointer",left:t/360,color:bx({h:t,s:100,v:100,a:1})})))}),yie=z.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:bx({h:t.h,s:100,v:100,a:1})};return z.createElement("div",{className:"react-colorful__saturation",style:r},z.createElement(X2,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Pu(t.s+100*o.left,0,100),v:Pu(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Ao(t.s)+"%, Brightness "+Ao(t.v)+"%"},z.createElement(Y2,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:bx(t)})))}),dA=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function Cie(e,t,n){var r=gx(n),o=l.useState(function(){return e.toHsva(t)}),s=o[0],i=o[1],c=l.useRef({color:t,hsva:s});l.useEffect(function(){if(!e.equal(t,c.current.color)){var p=e.toHsva(t);c.current={hsva:p,color:t},i(p)}},[t,e]),l.useEffect(function(){var p;dA(s,c.current.hsva)||e.equal(p=e.fromHsva(s),c.current.color)||(c.current={hsva:s,color:p},r(p))},[s,e,r]);var d=l.useCallback(function(p){i(function(h){return Object.assign({},h,p)})},[]);return[s,d]}var wie=typeof window<"u"?l.useLayoutEffect:l.useEffect,Sie=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},__=new Map,kie=function(e){wie(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!__.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,__.set(t,n);var r=Sie();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},jie=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+L1(Object.assign({},n,{a:0}))+", "+L1(Object.assign({},n,{a:1}))+")"},s=A0(["react-colorful__alpha",t]),i=Ao(100*n.a);return z.createElement("div",{className:s},z.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),z.createElement(X2,{onMove:function(c){r({a:c.left})},onKey:function(c){r({a:Pu(n.a+c.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},z.createElement(Y2,{className:"react-colorful__alpha-pointer",left:n.a,color:L1(n)})))},_ie=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,i=cA(e,["className","colorModel","color","onChange"]),c=l.useRef(null);kie(c);var d=Cie(n,o,s),p=d[0],h=d[1],m=A0(["react-colorful",t]);return z.createElement("div",O0({},i,{ref:c,className:m}),z.createElement(yie,{hsva:p,onChange:h}),z.createElement(xie,{hue:p.h,onChange:h}),z.createElement(jie,{hsva:p,onChange:h,className:"react-colorful__last-control"}))},Iie={defaultColor:{r:0,g:0,b:0,a:1},toHsva:bie,fromHsva:vie,equal:dA},fA=function(e){return z.createElement(_ie,O0({},e,{colorModel:Iie}))};const Pie=e=>{const{nodeId:t,field:n}=e,r=le(),o=l.useCallback(s=>{r(A7({nodeId:t,fieldName:n.name,value:s}))},[r,n.name,t]);return a.jsx(fA,{className:"nodrag",color:n.value,onChange:o})},Eie=l.memo(Pie),pA=e=>{const t=ki("models"),[n,r,o]=e.split("/"),s=R7.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},Mie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=le(),{data:s}=$x(),i=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/controlnet/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),c=l.useMemo(()=>{if(!s)return[];const p=[];return to(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:xr[h.base_model]})}),p},[s]),d=l.useCallback(p=>{if(!p)return;const h=pA(p);h&&o(D7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(Dr,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:c,onChange:d,sx:{width:"100%"}})},Oie=l.memo(Mie),Aie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=le(),s=l.useCallback(i=>{o(T7({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return a.jsx(E3,{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))})},Rie=l.memo(Aie),Die=e=>{var p;const{nodeId:t,field:n}=e,r=le(),{currentData:o}=Rs(((p=n.value)==null?void 0:p.image_name)??zs.skipToken),s=l.useCallback(()=>{r(N7({nodeId:t,fieldName:n.name,value:void 0}))},[r,n.name,t]),i=l.useMemo(()=>{if(o)return{id:`node-${t}-${n.name}`,payloadType:"IMAGE_DTO",payload:{imageDTO:o}}},[n.name,o,t]),c=l.useMemo(()=>({id:`node-${t}-${n.name}`,actionType:"SET_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}}),[n.name,t]),d=l.useMemo(()=>({type:"SET_NODES_IMAGE",nodeId:t,fieldName:n.name}),[t,n.name]);return a.jsx(N,{className:"nodrag",sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(ll,{imageDTO:o,droppableData:c,draggableData:i,postUploadAction:d,useThumbailFallback:!0,uploadElement:a.jsx(hA,{}),dropLabel:a.jsx(mA,{}),minSize:8,children:a.jsx(du,{onClick:s,icon:o?a.jsx(a0,{}):void 0,tooltip:"Reset Image"})})})},Tie=l.memo(Die),hA=l.memo(()=>a.jsx(je,{fontSize:16,fontWeight:600,children:"Drop or Upload"}));hA.displayName="UploadElement";const mA=l.memo(()=>a.jsx(je,{fontSize:16,fontWeight:600,children:"Drop"}));mA.displayName="DropLabel";const Nie=e=>{const t=ki("models"),[n,r,o]=e.split("/"),s=$7.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},$ie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=le(),{data:s}=_f(),{t:i}=Q(),c=l.useMemo(()=>{if(!s)return[];const m=[];return to(s.entities,(g,b)=>{g&&m.push({value:b,label:g.model_name,group:xr[g.base_model]})}),m.sort((g,b)=>g.disabled&&!b.disabled?1:-1)},[s]),d=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/lora/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r==null?void 0:r.base_model,r==null?void 0:r.model_name]),p=l.useCallback(m=>{if(!m)return;const g=Nie(m);g&&o(L7({nodeId:t,fieldName:n.name,value:g}))},[o,n.name,t]),h=l.useCallback((m,g)=>{var b;return((b=g.label)==null?void 0:b.toLowerCase().includes(m.toLowerCase().trim()))||g.value.toLowerCase().includes(m.toLowerCase().trim())},[]);return(s==null?void 0:s.ids.length)===0?a.jsx(N,{sx:{justifyContent:"center",p:2},children:a.jsx(je,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(sr,{className:"nowheel nodrag",value:(d==null?void 0:d.id)??null,placeholder:c.length>0?i("models.selectLoRA"):i("models.noLoRAsAvailable"),data:c,nothingFound:i("models.noMatchingLoRAs"),itemComponent:pl,disabled:c.length===0,filter:h,error:!d,onChange:p,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Lie=l.memo($ie),R0=e=>{const t=ki("models"),[n,r,o]=e.split("/"),s=z7.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 Ku(e){const{iconMode:t=!1,...n}=e,r=le(),{t:o}=Q(),[s,{isLoading:i}]=F7(),c=l.useCallback(()=>{s().unwrap().then(d=>{r(Ht(rr({title:`${o("modelManager.modelsSynced")}`,status:"success"})))}).catch(d=>{d&&r(Ht(rr({title:`${o("modelManager.modelSyncFailed")}`,status:"error"})))})},[r,s,o]);return t?a.jsx(rt,{icon:a.jsx(s0,{}),tooltip:o("modelManager.syncModels"),"aria-label":o("modelManager.syncModels"),isLoading:i,onClick:c,size:"sm",...n}):a.jsx(Dt,{isLoading:i,onClick:c,minW:"max-content",...n,children:o("modelManager.syncModels")})}const zie=e=>{var y,x;const{nodeId:t,field:n}=e,r=le(),o=Pn("syncModels").isFeatureEnabled,{t:s}=Q(),{data:i,isLoading:c}=Jd(rS),{data:d,isLoading:p}=aa(rS),h=l.useMemo(()=>c||p,[c,p]),m=l.useMemo(()=>{if(!d)return[];const w=[];return to(d.entities,(S,j)=>{S&&w.push({value:j,label:S.model_name,group:xr[S.base_model]})}),i&&to(i.entities,(S,j)=>{S&&w.push({value:j,label:S.model_name,group:xr[S.base_model]})}),w},[d,i]),g=l.useMemo(()=>{var w,S,j,I;return((d==null?void 0:d.entities[`${(w=n.value)==null?void 0:w.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/${(I=n.value)==null?void 0:I.model_name}`]))??null},[(y=n.value)==null?void 0:y.base_model,(x=n.value)==null?void 0:x.model_name,d==null?void 0:d.entities,i==null?void 0:i.entities]),b=l.useCallback(w=>{if(!w)return;const S=R0(w);S&&r(aP({nodeId:t,fieldName:n.name,value:S}))},[r,n.name,t]);return a.jsxs(N,{sx:{w:"full",alignItems:"center",gap:2},children:[h?a.jsx(je,{variant:"subtext",children:"Loading..."}):a.jsx(sr,{className:"nowheel nodrag",tooltip:g==null?void 0:g.description,value:g==null?void 0:g.id,placeholder:m.length>0?s("models.selectModel"):s("models.noModelsAvailable"),data:m,error:!g,disabled:m.length===0,onChange:b,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),o&&a.jsx(Ku,{className:"nodrag",iconMode:!0})]})},Fie=l.memo(zie),cg=/^-?(0\.)?\.?$/,gA=De((e,t)=>{const{label:n,isDisabled:r=!1,showStepper:o=!0,isInvalid:s,value:i,onChange:c,min:d,max:p,isInteger:h=!0,formControlProps:m,formLabelProps:g,numberInputFieldProps:b,numberInputStepperProps:y,tooltipProps:x,...w}=e,S=le(),[j,I]=l.useState(String(i));l.useEffect(()=>{!j.match(cg)&&i!==Number(j)&&I(String(i))},[i,j]);const _=l.useCallback(R=>{I(R),R.match(cg)||c(h?Math.floor(Number(R)):Number(R))},[h,c]),M=l.useCallback(R=>{const D=Hl(h?Math.floor(Number(R.target.value)):Number(R.target.value),d,p);I(String(D)),c(D)},[h,p,d,c]),E=l.useCallback(R=>{R.shiftKey&&S(Qo(!0))},[S]),A=l.useCallback(R=>{R.shiftKey||S(Qo(!1))},[S]);return a.jsx(Wn,{...x,children:a.jsxs(Vn,{ref:t,isDisabled:r,isInvalid:s,...m,children:[n&&a.jsx(yr,{...g,children:n}),a.jsxs(Tg,{value:j,min:d,max:p,keepWithinRange:!0,clampValueOnBlur:!1,onChange:_,onBlur:M,...w,onPaste:q2,children:[a.jsx($g,{...b,onKeyDown:E,onKeyUp:A}),o&&a.jsxs(Ng,{children:[a.jsx(zg,{...y}),a.jsx(Lg,{...y})]})]})]})})});gA.displayName="IAINumberInput";const _a=l.memo(gA),Bie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=le(),[s,i]=l.useState(String(n.value)),c=l.useMemo(()=>r.type==="integer",[r.type]),d=l.useCallback(p=>{i(p),p.match(cg)||o(B7({nodeId:t,fieldName:n.name,value:c?Math.floor(Number(p)):Number(p)}))},[o,n.name,c,t]);return l.useEffect(()=>{!s.match(cg)&&n.value!==Number(s)&&i(String(n.value))},[n.value,s]),a.jsxs(Tg,{onChange:d,value:s,step:c?1:.1,precision:c?0:3,children:[a.jsx($g,{className:"nodrag"}),a.jsxs(Ng,{children:[a.jsx(zg,{}),a.jsx(Lg,{})]})]})},Hie=l.memo(Bie),Wie=e=>{var m,g;const{nodeId:t,field:n}=e,r=le(),{t:o}=Q(),s=Pn("syncModels").isFeatureEnabled,{data:i,isLoading:c}=aa(Yx),d=l.useMemo(()=>{if(!i)return[];const b=[];return to(i.entities,(y,x)=>{y&&b.push({value:x,label:y.model_name,group:xr[y.base_model]})}),b},[i]),p=l.useMemo(()=>{var b,y;return(i==null?void 0:i.entities[`${(b=n.value)==null?void 0:b.base_model}/main/${(y=n.value)==null?void 0:y.model_name}`])??null},[(m=n.value)==null?void 0:m.base_model,(g=n.value)==null?void 0:g.model_name,i==null?void 0:i.entities]),h=l.useCallback(b=>{if(!b)return;const y=R0(b);y&&r(H7({nodeId:t,fieldName:n.name,value:y}))},[r,n.name,t]);return c?a.jsx(sr,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(sr,{className:"nowheel nodrag",tooltip:p==null?void 0:p.description,value:p==null?void 0:p.id,placeholder:d.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:d,error:!p,disabled:d.length===0,onChange:h,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Ku,{className:"nodrag",iconMode:!0})]})},Vie=l.memo(Wie),Uie=e=>{var g,b;const{nodeId:t,field:n}=e,r=le(),{t:o}=Q(),s=Pn("syncModels").isFeatureEnabled,{data:i}=Jd(oS),{data:c,isLoading:d}=aa(oS),p=l.useMemo(()=>{if(!c)return[];const y=[];return to(c.entities,(x,w)=>{!x||x.base_model!=="sdxl"||y.push({value:w,label:x.model_name,group:xr[x.base_model]})}),i&&to(i.entities,(x,w)=>{!x||x.base_model!=="sdxl"||y.push({value:w,label:x.model_name,group:xr[x.base_model]})}),y},[c,i]),h=l.useMemo(()=>{var y,x,w,S;return((c==null?void 0:c.entities[`${(y=n.value)==null?void 0:y.base_model}/main/${(x=n.value)==null?void 0:x.model_name}`])||(i==null?void 0:i.entities[`${(w=n.value)==null?void 0:w.base_model}/onnx/${(S=n.value)==null?void 0:S.model_name}`]))??null},[(g=n.value)==null?void 0:g.base_model,(b=n.value)==null?void 0:b.model_name,c==null?void 0:c.entities,i==null?void 0:i.entities]),m=l.useCallback(y=>{if(!y)return;const x=R0(y);x&&r(aP({nodeId:t,fieldName:n.name,value:x}))},[r,n.name,t]);return d?a.jsx(sr,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(sr,{className:"nowheel nodrag",tooltip:h==null?void 0:h.description,value:h==null?void 0:h.id,placeholder:p.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:p,error:!h,disabled:p.length===0,onChange:m,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Ku,{className:"nodrag",iconMode:!0})]})},Gie=l.memo(Uie),qie=me([we],({ui:e})=>{const{favoriteSchedulers:t}=e;return{data:To(hg,(r,o)=>({value:o,label:r,group:t.includes(o)?"Favorites":void 0})).sort((r,o)=>r.label.localeCompare(o.label))}},Ie),Kie=e=>{const{nodeId:t,field:n}=e,r=le(),{data:o}=H(qie),s=l.useCallback(i=>{i&&r(W7({nodeId:t,fieldName:n.name,value:i}))},[r,n.name,t]);return a.jsx(sr,{className:"nowheel nodrag",value:n.value,data:o,onChange:s})},Qie=l.memo(Kie),Xie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=le(),s=l.useCallback(i=>{o(V7({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return r.ui_component==="textarea"?a.jsx(yi,{className:"nodrag",onChange:s,value:n.value,rows:5,resize:"none"}):a.jsx(Is,{onChange:s,value:n.value})},Yie=l.memo(Xie),vA=e=>{const t=ki("models"),[n,r,o]=e.split("/"),s=U7.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},Jie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=le(),{data:s}=iP(),i=l.useMemo(()=>{if(!s)return[];const p=[{value:"default",label:"Default",group:"Default"}];return to(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:xr[h.base_model]})}),p.sort((h,m)=>h.disabled&&!m.disabled?1:-1)},[s]),c=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r]),d=l.useCallback(p=>{if(!p)return;const h=vA(p);h&&o(G7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(sr,{className:"nowheel nodrag",itemComponent:pl,tooltip:c==null?void 0:c.description,value:(c==null?void 0:c.id)??"default",placeholder:"Default",data:i,onChange:d,disabled:i.length===0,error:!c,clearable:!0,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Zie=l.memo(Jie),ele=e=>{const t=ki("models"),[n,r,o]=e.split("/"),s=q7.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},tle=e=>{const{nodeId:t,field:n}=e,r=n.value,o=le(),{data:s}=zx(),i=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/ip_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),c=l.useMemo(()=>{if(!s)return[];const p=[];return to(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:xr[h.base_model]})}),p},[s]),d=l.useCallback(p=>{if(!p)return;const h=ele(p);h&&o(K7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(Dr,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:c,onChange:d,sx:{width:"100%"}})},nle=l.memo(tle),rle=e=>{const t=ki("models"),[n,r,o]=e.split("/"),s=Q7.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},ole=e=>{const{nodeId:t,field:n}=e,r=n.value,o=le(),{data:s}=Lx(),i=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/t2i_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),c=l.useMemo(()=>{if(!s)return[];const p=[];return to(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:xr[h.base_model]})}),p},[s]),d=l.useCallback(p=>{if(!p)return;const h=rle(p);h&&o(X7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(Dr,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:c,onChange:d,sx:{width:"100%"}})},sle=l.memo(ole),ale=e=>{var c;const{nodeId:t,field:n}=e,r=le(),{data:o,hasBoards:s}=jf(void 0,{selectFromResult:({data:d})=>{const p=[{label:"None",value:"none"}];return d==null||d.forEach(({board_id:h,board_name:m})=>{p.push({label:m,value:h})}),{data:p,hasBoards:p.length>1}}}),i=l.useCallback(d=>{r(Y7({nodeId:t,fieldName:n.name,value:d&&d!=="none"?{board_id:d}:void 0}))},[r,n.name,t]);return a.jsx(sr,{className:"nowheel nodrag",value:((c=n.value)==null?void 0:c.board_id)??"none",data:o,onChange:i,disabled:!s})},ile=l.memo(ale),lle=({nodeId:e,fieldName:t})=>{const n=aA(e,t),r=M0(e,t,"input");return(r==null?void 0:r.fieldKind)==="output"?a.jsxs(Le,{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(Yie,{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(gie,{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(Hie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="enum"&&(r==null?void 0:r.type)==="enum"?a.jsx(Rie,{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(Tie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="BoardField"&&(r==null?void 0:r.type)==="BoardField"?a.jsx(ile,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="MainModelField"&&(r==null?void 0:r.type)==="MainModelField"?a.jsx(Fie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLRefinerModelField"&&(r==null?void 0:r.type)==="SDXLRefinerModelField"?a.jsx(Vie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="VaeModelField"&&(r==null?void 0:r.type)==="VaeModelField"?a.jsx(Zie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="LoRAModelField"&&(r==null?void 0:r.type)==="LoRAModelField"?a.jsx(Lie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ControlNetModelField"&&(r==null?void 0:r.type)==="ControlNetModelField"?a.jsx(Oie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="IPAdapterModelField"&&(r==null?void 0:r.type)==="IPAdapterModelField"?a.jsx(nle,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="T2IAdapterModelField"&&(r==null?void 0:r.type)==="T2IAdapterModelField"?a.jsx(sle,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ColorField"&&(r==null?void 0:r.type)==="ColorField"?a.jsx(Eie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLMainModelField"&&(r==null?void 0:r.type)==="SDXLMainModelField"?a.jsx(Gie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="Scheduler"&&(r==null?void 0:r.type)==="Scheduler"?a.jsx(Qie,{nodeId:e,field:n,fieldTemplate:r}):n&&r?null:a.jsx(Le,{p:1,children:a.jsxs(je,{sx:{fontSize:"sm",fontWeight:600,color:"error.400",_dark:{color:"error.300"}},children:["Unknown field type: ",n==null?void 0:n.type]})})},bA=l.memo(lle),cle=({nodeId:e,fieldName:t})=>{const n=le(),{isMouseOverNode:r,handleMouseOut:o,handleMouseOver:s}=rA(e),{t:i}=Q(),c=l.useCallback(()=>{n(lP({nodeId:e,fieldName:t}))},[n,t,e]);return a.jsxs(N,{onMouseEnter:s,onMouseLeave:o,layerStyle:"second",sx:{position:"relative",borderRadius:"base",w:"full",p:2},children:[a.jsxs(Vn,{as:N,sx:{flexDir:"column",gap:1,flexShrink:1},children:[a.jsxs(yr,{sx:{display:"flex",alignItems:"center",mb:0},children:[a.jsx(iA,{nodeId:e,fieldName:t,kind:"input"}),a.jsx(Pi,{}),a.jsx(Wn,{label:a.jsx(Q2,{nodeId:e,fieldName:t,kind:"input"}),openDelay:xg,placement:"top",hasArrow:!0,children:a.jsx(N,{h:"full",alignItems:"center",children:a.jsx(Gr,{as:QM})})}),a.jsx(rt,{"aria-label":i("nodes.removeLinearView"),tooltip:i("nodes.removeLinearView"),variant:"ghost",size:"sm",onClick:c,icon:a.jsx(Zo,{})})]}),a.jsx(bA,{nodeId:e,fieldName:t})]}),a.jsx(nA,{isSelected:!1,isHovered:r})]})},ule=l.memo(cle),dle=me(we,({nodes:e})=>({fields:e.workflow.exposedFields}),Ie),fle=()=>{const{fields:e}=H(dle),{t}=Q();return a.jsx(Le,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(cc,{children:a.jsx(N,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:e.length?e.map(({nodeId:n,fieldName:r})=>a.jsx(ule,{nodeId:n,fieldName:r},`${n}.${r}`)):a.jsx(eo,{label:t("nodes.noFieldsLinearview"),icon:null})})})})},ple=l.memo(fle),hle=()=>{const{t:e}=Q();return a.jsx(N,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(tc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(nc,{children:[a.jsx(wo,{children:e("common.linear")}),a.jsx(wo,{children:e("common.details")}),a.jsx(wo,{children:"JSON"})]}),a.jsxs($u,{children:[a.jsx(Go,{children:a.jsx(ple,{})}),a.jsx(Go,{children:a.jsx(cie,{})}),a.jsx(Go,{children:a.jsx(die,{})})]})]})})},mle=l.memo(hle),gle={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"}},vle=1e3,ble=[{name:"preventOverflow",options:{padding:10}}],xA=De(({feature:e,children:t,wrapperProps:n,...r},o)=>{const{t:s}=Q(),i=H(g=>g.system.shouldEnableInformationalPopovers),c=l.useMemo(()=>gle[e],[e]),d=l.useMemo(()=>J7(Z7(c,["image","href","buttonLabel"]),r),[c,r]),p=l.useMemo(()=>s(`popovers.${e}.heading`),[e,s]),h=l.useMemo(()=>s(`popovers.${e}.paragraphs`,{returnObjects:!0})??[],[e,s]),m=l.useCallback(()=>{c!=null&&c.href&&window.open(c.href)},[c==null?void 0:c.href]);return i?a.jsxs(Uf,{isLazy:!0,closeOnBlur:!1,trigger:"hover",variant:"informational",openDelay:vle,modifiers:ble,placement:"top",...d,children:[a.jsx(Bg,{children:a.jsx(Le,{ref:o,w:"full",...n,children:t})}),a.jsx(Au,{children:a.jsxs(Gf,{w:96,children:[a.jsx(w3,{}),a.jsx(Hg,{children:a.jsxs(N,{sx:{gap:2,flexDirection:"column",alignItems:"flex-start"},children:[p&&a.jsxs(a.Fragment,{children:[a.jsx(yo,{size:"sm",children:p}),a.jsx(io,{})]}),(c==null?void 0:c.image)&&a.jsxs(a.Fragment,{children:[a.jsx(_i,{sx:{objectFit:"contain",maxW:"60%",maxH:"60%",backgroundColor:"white"},src:c.image,alt:"Optional Image"}),a.jsx(io,{})]}),h.map(g=>a.jsx(je,{children:g},g)),(c==null?void 0:c.href)&&a.jsxs(a.Fragment,{children:[a.jsx(io,{}),a.jsx(nl,{pt:1,onClick:m,leftIcon:a.jsx(l2,{}),alignSelf:"flex-end",variant:"link",children:s("common.learnMore")??p})]})]})})]})})]}):a.jsx(Le,{ref:o,w:"full",...n,children:t})});xA.displayName="IAIInformationalPopover";const kn=l.memo(xA),xle=me([we],e=>{const{initial:t,min:n,sliderMax:r,inputMax:o,fineStep:s,coarseStep:i}=e.config.sd.iterations,{iterations:c}=e.generation,{shouldUseSliders:d}=e.ui,p=e.hotkeys.shift?s:i;return{iterations:c,initial:t,min:n,sliderMax:r,inputMax:o,step:p,shouldUseSliders:d}},Ie),yle=({asSlider:e})=>{const{iterations:t,initial:n,min:r,sliderMax:o,inputMax:s,step:i,shouldUseSliders:c}=H(xle),d=le(),{t:p}=Q(),h=l.useCallback(g=>{d(sS(g))},[d]),m=l.useCallback(()=>{d(sS(n))},[d,n]);return e||c?a.jsx(kn,{feature:"paramIterations",children:a.jsx(It,{label:p("parameters.iterations"),step:i,min:r,max:o,onChange:h,handleReset:m,value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s}})}):a.jsx(kn,{feature:"paramIterations",children:a.jsx(_a,{label:p("parameters.iterations"),step:i,min:r,max:s,onChange:h,value:t,numberInputFieldProps:{textAlign:"center"}})})},ua=l.memo(yle),Cle=()=>{const[e,t]=l.useState(!1),[n,r]=l.useState(!1),o=l.useRef(null),s=G2(),i=l.useCallback(()=>{o.current&&o.current.setLayout([50,50])},[]);return a.jsxs(N,{sx:{flexDir:"column",gap:2,height:"100%",width:"100%"},children:[a.jsx(z8,{}),a.jsx(N,{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(E0,{ref:o,id:"workflow-panel-group",autoSaveId:"workflow-panel-group",direction:"vertical",style:{height:"100%",width:"100%"},storage:s,children:[a.jsx(el,{id:"workflow",collapsible:!0,onCollapse:t,minSize:25,children:a.jsx(mle,{})}),a.jsx(lg,{direction:"vertical",onDoubleClick:i,collapsedDirection:e?"top":n?"bottom":void 0}),a.jsx(el,{id:"inspector",collapsible:!0,onCollapse:r,minSize:25,children:a.jsx(oie,{})})]})]})},wle=l.memo(Cle),I_=(e,t)=>{const n=l.useRef(null),[r,o]=l.useState(()=>{var p;return!!((p=n.current)!=null&&p.getCollapsed())}),s=l.useCallback(()=>{var p;(p=n.current)!=null&&p.getCollapsed()?ls.flushSync(()=>{var h;(h=n.current)==null||h.expand()}):ls.flushSync(()=>{var h;(h=n.current)==null||h.collapse()})},[]),i=l.useCallback(()=>{ls.flushSync(()=>{var p;(p=n.current)==null||p.expand()})},[]),c=l.useCallback(()=>{ls.flushSync(()=>{var p;(p=n.current)==null||p.collapse()})},[]),d=l.useCallback(()=>{ls.flushSync(()=>{var p;(p=n.current)==null||p.resize(e,t)})},[e,t]);return{ref:n,minSize:e,isCollapsed:r,setIsCollapsed:o,reset:d,toggle:s,expand:i,collapse:c}},Sle=({isGalleryCollapsed:e,galleryPanelRef:t})=>{const{t:n}=Q(),r=l.useCallback(()=>{var o;(o=t.current)==null||o.expand()},[t]);return e?a.jsx(Au,{children:a.jsx(N,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineEnd:"1.63rem",children:a.jsx(rt,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":n("accessibility.showGalleryPanel"),onClick:r,icon:a.jsx(pse,{}),sx:{p:0,px:3,h:48,borderEndRadius:0}})})}):null},kle=l.memo(Sle),wh={borderStartRadius:0,flexGrow:1},jle=({isSidePanelCollapsed:e,sidePanelRef:t})=>{const{t:n}=Q(),r=l.useCallback(()=>{var o;(o=t.current)==null||o.expand()},[t]);return e?a.jsx(Au,{children:a.jsxs(N,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineStart:"5.13rem",direction:"column",gap:2,h:48,children:[a.jsxs(Hn,{isAttached:!0,orientation:"vertical",flexGrow:3,children:[a.jsx(rt,{tooltip:n("parameters.showOptionsPanel"),"aria-label":n("parameters.showOptionsPanel"),onClick:r,sx:wh,icon:a.jsx(tO,{})}),a.jsx(N8,{asIconButton:!0,sx:wh}),a.jsx(O8,{asIconButton:!0,sx:wh})]}),a.jsx(B2,{asIconButton:!0,sx:wh})]})}):null},_le=l.memo(jle),Ile=e=>{const{label:t,activeLabel:n,children:r,defaultIsOpen:o=!1}=e,{isOpen:s,onToggle:i}=hs({defaultIsOpen:o}),{colorMode:c}=ji();return a.jsxs(Le,{children:[a.jsxs(N,{onClick:i,sx:{alignItems:"center",p:2,px:4,gap:2,borderTopRadius:"base",borderBottomRadius:s?0:"base",bg:Xe("base.250","base.750")(c),color:Xe("base.900","base.100")(c),_hover:{bg:Xe("base.300","base.700")(c)},fontSize:"sm",fontWeight:600,cursor:"pointer",transitionProperty:"common",transitionDuration:"normal",userSelect:"none"},"data-testid":`${t} collapsible`,children:[t,a.jsx(So,{children:n&&a.jsx(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(je,{sx:{color:"accent.500",_dark:{color:"accent.300"}},children:n})},"statusText")}),a.jsx(Pi,{}),a.jsx(b0,{sx:{w:"1rem",h:"1rem",transform:s?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]}),a.jsx(Af,{in:s,animateOpacity:!0,style:{overflow:"unset"},children:a.jsx(Le,{sx:{p:4,pb:4,borderBottomRadius:"base",bg:"base.150",_dark:{bg:"base.800"}},children:r})})]})},No=l.memo(Ile),Ple=me(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}},Ie),Ele=()=>{const{maxPrompts:e,min:t,sliderMax:n,inputMax:r,isDisabled:o}=H(Ple),s=le(),{t:i}=Q(),c=l.useCallback(p=>{s(eT(p))},[s]),d=l.useCallback(()=>{s(tT())},[s]);return a.jsx(kn,{feature:"dynamicPromptsMaxPrompts",children:a.jsx(It,{label:i("dynamicPrompts.maxPrompts"),isDisabled:o,min:t,max:n,value:e,onChange:c,sliderNumberInputProps:{max:r},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})})},Mle=l.memo(Ele),Ole=me(we,e=>{const{isLoading:t,isError:n,prompts:r,parsingError:o}=e.dynamicPrompts;return{prompts:r,parsingError:o,isError:n,isLoading:t}},Ie),Ale={"&::marker":{color:"base.500",_dark:{color:"base.500"}}},Rle=()=>{const{t:e}=Q(),{prompts:t,parsingError:n,isLoading:r,isError:o}=H(Ole);return o?a.jsx(kn,{feature:"dynamicPrompts",children:a.jsx(N,{w:"full",h:"full",layerStyle:"second",alignItems:"center",justifyContent:"center",p:8,children:a.jsx(eo,{icon:ise,label:"Problem generating prompts"})})}):a.jsx(kn,{feature:"dynamicPrompts",children:a.jsxs(Vn,{isInvalid:!!n,children:[a.jsxs(yr,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[e("dynamicPrompts.promptsPreview")," (",t.length,")",n&&` - ${n}`]}),a.jsxs(N,{h:64,pos:"relative",layerStyle:"third",borderRadius:"base",p:2,children:[a.jsx(cc,{children:a.jsx(V5,{stylePosition:"inside",ms:0,children:t.map((s,i)=>a.jsx(Ps,{fontSize:"sm",sx:Ale,children:a.jsx(je,{as:"span",children:s})},`${s}.${i}`))})}),r&&a.jsx(N,{pos:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,layerStyle:"second",opacity:.7,alignItems:"center",justifyContent:"center",children:a.jsx(Ci,{})})]})]})})},Dle=l.memo(Rle),yA=l.forwardRef(({label:e,description:t,...n},r)=>a.jsx(Le,{ref:r,...n,children:a.jsxs(Le,{children:[a.jsx(je,{fontWeight:600,children:e}),t&&a.jsx(je,{size:"xs",variant:"subtext",children:t})]})}));yA.displayName="IAIMantineSelectItemWithDescription";const Tle=l.memo(yA),Nle=()=>{const e=le(),{t}=Q(),n=H(s=>s.dynamicPrompts.seedBehaviour),r=l.useMemo(()=>[{value:"PER_ITERATION",label:t("dynamicPrompts.seedBehaviour.perIterationLabel"),description:t("dynamicPrompts.seedBehaviour.perIterationDesc")},{value:"PER_PROMPT",label:t("dynamicPrompts.seedBehaviour.perPromptLabel"),description:t("dynamicPrompts.seedBehaviour.perPromptDesc")}],[t]),o=l.useCallback(s=>{s&&e(nT(s))},[e]);return a.jsx(kn,{feature:"dynamicPromptsSeedBehaviour",children:a.jsx(Dr,{label:t("dynamicPrompts.seedBehaviour.label"),value:n,data:r,itemComponent:Tle,onChange:o})})},$le=l.memo(Nle),Lle=()=>{const{t:e}=Q(),t=l.useMemo(()=>me(we,({dynamicPrompts:o})=>{const s=o.prompts.length;if(s>1)return e("dynamicPrompts.promptsWithCount_other",{count:s})}),[e]),n=H(t);return Pn("dynamicPrompting").isFeatureEnabled?a.jsx(No,{label:e("dynamicPrompts.dynamicPrompts"),activeLabel:n,children:a.jsxs(N,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Dle,{}),a.jsx($le,{}),a.jsx(Mle,{})]})}):null},Qu=l.memo(Lle),zle=e=>{const t=le(),{lora:n}=e,r=l.useCallback(i=>{t(rT({id:n.id,weight:i}))},[t,n.id]),o=l.useCallback(()=>{t(oT(n.id))},[t,n.id]),s=l.useCallback(()=>{t(sT(n.id))},[t,n.id]);return a.jsx(kn,{feature:"lora",children:a.jsxs(N,{sx:{gap:2.5,alignItems:"flex-end"},children:[a.jsx(It,{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(rt,{size:"sm",onClick:s,tooltip:"Remove LoRA","aria-label":"Remove LoRA",icon:a.jsx(Zo,{}),colorScheme:"error"})]})})},Fle=l.memo(zle),Ble=me(we,({lora:e})=>({lorasArray:To(e.loras)}),Ie),Hle=()=>{const{lorasArray:e}=H(Ble);return a.jsx(a.Fragment,{children:e.map((t,n)=>a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[n>0&&a.jsx(io,{pt:1}),a.jsx(Fle,{lora:t})]},t.model_name))})},Wle=l.memo(Hle),Vle=me(we,({lora:e})=>({loras:e.loras}),Ie),Ule=()=>{const e=le(),{loras:t}=H(Vle),{data:n}=_f(),{t:r}=Q(),o=H(d=>d.generation.model),s=l.useMemo(()=>{if(!n)return[];const d=[];return to(n.entities,(p,h)=>{if(!p||h in t)return;const m=(o==null?void 0:o.base_model)!==p.base_model;d.push({value:h,label:p.model_name,disabled:m,group:xr[p.base_model],tooltip:m?`Incompatible base model: ${p.base_model}`:void 0})}),d.sort((p,h)=>p.label&&!h.label?1:-1),d.sort((p,h)=>p.disabled&&!h.disabled?1:-1)},[t,n,o==null?void 0:o.base_model]),i=l.useCallback(d=>{if(!d)return;const p=n==null?void 0:n.entities[d];p&&e(aT(p))},[e,n==null?void 0:n.entities]),c=l.useCallback((d,p)=>{var h;return((h=p.label)==null?void 0:h.toLowerCase().includes(d.toLowerCase().trim()))||p.value.toLowerCase().includes(d.toLowerCase().trim())},[]);return(n==null?void 0:n.ids.length)===0?a.jsx(N,{sx:{justifyContent:"center",p:2},children:a.jsx(je,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:r("models.noLoRAsInstalled")})}):a.jsx(sr,{placeholder:s.length===0?"All LoRAs added":r("models.addLora"),value:null,data:s,nothingFound:"No matching LoRAs",itemComponent:pl,disabled:s.length===0,filter:c,onChange:i,"data-testid":"add-lora"})},Gle=l.memo(Ule),qle=me(we,e=>{const t=cP(e.lora.loras);return{activeLabel:t>0?`${t} Active`:void 0}},Ie),Kle=()=>{const{t:e}=Q(),{activeLabel:t}=H(qle);return Pn("lora").isFeatureEnabled?a.jsx(No,{label:e("modelManager.loraModels"),activeLabel:t,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsx(Gle,{}),a.jsx(Wle,{})]})}):null},Xu=l.memo(Kle),Qle=()=>{const e=le(),t=H(o=>o.generation.shouldUseCpuNoise),{t:n}=Q(),r=l.useCallback(o=>{e(iT(o.target.checked))},[e]);return a.jsx(kn,{feature:"noiseUseCPU",children:a.jsx(_r,{label:n("parameters.useCpuNoise"),isChecked:t,onChange:r})})},da=e=>e.generation,Xle=me(da,e=>{const{seamlessXAxis:t}=e;return{seamlessXAxis:t}},Ie),Yle=()=>{const{t:e}=Q(),{seamlessXAxis:t}=H(Xle),n=le(),r=l.useCallback(o=>{n(lT(o.target.checked))},[n]);return a.jsx(_r,{label:e("parameters.seamlessXAxis"),"aria-label":e("parameters.seamlessXAxis"),isChecked:t,onChange:r})},Jle=l.memo(Yle),Zle=me(da,e=>{const{seamlessYAxis:t}=e;return{seamlessYAxis:t}},Ie),ece=()=>{const{t:e}=Q(),{seamlessYAxis:t}=H(Zle),n=le(),r=l.useCallback(o=>{n(cT(o.target.checked))},[n]);return a.jsx(_r,{label:e("parameters.seamlessYAxis"),"aria-label":e("parameters.seamlessYAxis"),isChecked:t,onChange:r})},tce=l.memo(ece),nce=()=>{const{t:e}=Q();return Pn("seamless").isFeatureEnabled?a.jsxs(Vn,{children:[a.jsx(yr,{children:e("parameters.seamlessTiling")})," ",a.jsxs(N,{sx:{gap:5},children:[a.jsx(Le,{flexGrow:1,children:a.jsx(Jle,{})}),a.jsx(Le,{flexGrow:1,children:a.jsx(tce,{})})]})]}):null},rce=l.memo(nce);function oce(){const e=H(d=>d.generation.clipSkip),{model:t}=H(d=>d.generation),n=le(),{t:r}=Q(),o=l.useCallback(d=>{n(aS(d))},[n]),s=l.useCallback(()=>{n(aS(0))},[n]),i=l.useMemo(()=>t?qp[t.base_model].maxClip:qp["sd-1"].maxClip,[t]),c=l.useMemo(()=>t?qp[t.base_model].markers:qp["sd-1"].markers,[t]);return(t==null?void 0:t.base_model)==="sdxl"?null:a.jsx(kn,{feature:"clipSkip",placement:"top",children:a.jsx(It,{label:r("parameters.clipSkip"),"aria-label":r("parameters.clipSkip"),min:0,max:i,step:1,value:e,onChange:o,withSliderMarks:!0,sliderMarks:c,withInput:!0,withReset:!0,handleReset:s})})}const sce=me(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}},Ie);function Yu(){const{clipSkip:e,model:t,seamlessXAxis:n,seamlessYAxis:r,shouldUseCpuNoise:o}=H(sce),{t:s}=Q(),i=l.useMemo(()=>{const c=[];return o||c.push(s("parameters.gpuNoise")),e>0&&t&&t.base_model!=="sdxl"&&c.push(s("parameters.clipSkipWithLayerCount",{layerCount:e})),n&&r?c.push(s("parameters.seamlessX&Y")):n?c.push(s("parameters.seamlessX")):r&&c.push(s("parameters.seamlessY")),c.join(", ")},[e,t,n,r,o,s]);return a.jsx(No,{label:s("common.advanced"),activeLabel:i,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsx(rce,{}),a.jsx(io,{}),t&&(t==null?void 0:t.base_model)!=="sdxl"&&a.jsxs(a.Fragment,{children:[a.jsx(oce,{}),a.jsx(io,{pt:2})]}),a.jsx(Qle,{})]})})}const Oi=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{var o;return((o=Fs(r,e))==null?void 0:o.isEnabled)??!1},Ie),[e]);return H(t)},ace=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{var o;return(o=Fs(r,e))==null?void 0:o.model},Ie),[e]);return H(t)},CA=e=>{const{data:t}=$x(),n=l.useMemo(()=>t?FI.getSelectors().selectAll(t):[],[t]),{data:r}=Lx(),o=l.useMemo(()=>r?BI.getSelectors().selectAll(r):[],[r]),{data:s}=zx(),i=l.useMemo(()=>s?HI.getSelectors().selectAll(s):[],[s]);return e==="controlnet"?n:e==="t2i_adapter"?o:e==="ip_adapter"?i:[]},wA=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{var o;return(o=Fs(r,e))==null?void 0:o.type},Ie),[e]);return H(t)},ice=me(we,({generation:e})=>{const{model:t}=e;return{mainModel:t}},Ie),lce=({id:e})=>{const t=Oi(e),n=wA(e),r=ace(e),o=le(),{mainModel:s}=H(ice),{t:i}=Q(),c=CA(n),d=l.useMemo(()=>{if(!c)return[];const m=[];return c.forEach(g=>{if(!g)return;const b=(g==null?void 0:g.base_model)!==(s==null?void 0:s.base_model);m.push({value:g.id,label:g.model_name,group:xr[g.base_model],disabled:b,tooltip:b?`${i("controlnet.incompatibleBaseModel")} ${g.base_model}`:void 0})}),m.sort((g,b)=>g.disabled?1:b.disabled?-1:g.label.localeCompare(b.label)),m},[s==null?void 0:s.base_model,c,i]),p=l.useMemo(()=>c.find(m=>(m==null?void 0:m.id)===`${r==null?void 0:r.base_model}/${n}/${r==null?void 0:r.model_name}`),[n,r==null?void 0:r.base_model,r==null?void 0:r.model_name,c]),h=l.useCallback(m=>{if(!m)return;const g=pA(m);g&&o(uT({id:e,model:g}))},[o,e]);return a.jsx(sr,{itemComponent:pl,data:d,error:!p||(s==null?void 0:s.base_model)!==p.base_model,placeholder:i("controlnet.selectModel"),value:(p==null?void 0:p.id)??null,onChange:h,disabled:!t,tooltip:p==null?void 0:p.description})},cce=l.memo(lce),uce=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{var o;return(o=Fs(r,e))==null?void 0:o.weight},Ie),[e]);return H(t)},dce=({id:e})=>{const t=Oi(e),n=uce(e),r=le(),{t:o}=Q(),s=l.useCallback(i=>{r(dT({id:e,weight:i}))},[r,e]);return si(n)?null:a.jsx(kn,{feature:"controlNetWeight",children:a.jsx(It,{isDisabled:!t,label:o("controlnet.weight"),value:n,onChange:s,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2]})})},fce=l.memo(dce),pce=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{var o;return(o=Fs(r,e))==null?void 0:o.controlImage},Ie),[e]);return H(t)},hce=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{const o=Fs(r,e);return o&&Ru(o)?o.processedControlImage:void 0},Ie),[e]);return H(t)},mce=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{const o=Fs(r,e);return o&&Ru(o)?o.processorType:void 0},Ie),[e]);return H(t)},gce=me(we,({controlAdapters:e,gallery:t})=>{const{pendingControlImages:n}=e,{autoAddBoardId:r}=t;return{pendingControlImages:n,autoAddBoardId:r}},Ie),vce=({isSmall:e,id:t})=>{const n=pce(t),r=hce(t),o=mce(t),s=le(),{t:i}=Q(),{pendingControlImages:c,autoAddBoardId:d}=H(gce),p=H(lo),[h,m]=l.useState(!1),{currentData:g}=Rs(n??zs.skipToken),{currentData:b}=Rs(r??zs.skipToken),[y]=fT(),[x]=pT(),[w]=hT(),S=l.useCallback(()=>{s(mT({id:t,controlImage:null}))},[t,s]),j=l.useCallback(async()=>{b&&(await y({imageDTO:b,is_intermediate:!1}).unwrap(),d!=="none"?x({imageDTO:b,board_id:d}):w({imageDTO:b}))},[b,y,d,x,w]),I=l.useCallback(()=>{g&&(p==="unifiedCanvas"?s(na({width:g.width,height:g.height})):(s(Wl(g.width)),s(Vl(g.height))))},[g,p,s]),_=l.useCallback(()=>{m(!0)},[]),M=l.useCallback(()=>{m(!1)},[]),E=l.useMemo(()=>{if(g)return{id:t,payloadType:"IMAGE_DTO",payload:{imageDTO:g}}},[g,t]),A=l.useMemo(()=>({id:t,actionType:"SET_CONTROL_ADAPTER_IMAGE",context:{id:t}}),[t]),R=l.useMemo(()=>({type:"SET_CONTROL_ADAPTER_IMAGE",id:t}),[t]),D=g&&b&&!h&&!c.includes(t)&&o!=="none";return a.jsxs(N,{onMouseEnter:_,onMouseLeave:M,sx:{position:"relative",w:"full",h:e?28:366,alignItems:"center",justifyContent:"center"},children:[a.jsx(ll,{draggableData:E,droppableData:A,imageDTO:g,isDropDisabled:D,postUploadAction:R}),a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",opacity:D?1:0,transitionProperty:"common",transitionDuration:"normal",pointerEvents:"none"},children:a.jsx(ll,{draggableData:E,droppableData:A,imageDTO:b,isUploadDisabled:!0})}),a.jsxs(a.Fragment,{children:[a.jsx(du,{onClick:S,icon:g?a.jsx(a0,{}):void 0,tooltip:i("controlnet.resetControlImage")}),a.jsx(du,{onClick:j,icon:g?a.jsx(o0,{size:16}):void 0,tooltip:i("controlnet.saveControlImage"),styleOverrides:{marginTop:6}}),a.jsx(du,{onClick:I,icon:g?a.jsx(Kee,{size:16}):void 0,tooltip:i("controlnet.setControlImageDimensions"),styleOverrides:{marginTop:12}})]}),c.includes(t)&&a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",alignItems:"center",justifyContent:"center",opacity:.8,borderRadius:"base",bg:"base.400",_dark:{bg:"base.900"}},children:a.jsx(Ci,{size:"xl",sx:{color:"base.100",_dark:{color:"base.400"}}})})]})},P_=l.memo(vce),Hs=()=>{const e=le();return l.useCallback((n,r)=>{e(gT({id:n,params:r}))},[e])};function Ws(e){return a.jsx(N,{sx:{flexDirection:"column",gap:2,pb:2},children:e.children})}const E_=Do.canny_image_processor.default,bce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{low_threshold:o,high_threshold:s}=n,i=Hs(),{t:c}=Q(),d=l.useCallback(g=>{i(t,{low_threshold:g})},[t,i]),p=l.useCallback(()=>{i(t,{low_threshold:E_.low_threshold})},[t,i]),h=l.useCallback(g=>{i(t,{high_threshold:g})},[t,i]),m=l.useCallback(()=>{i(t,{high_threshold:E_.high_threshold})},[t,i]);return a.jsxs(Ws,{children:[a.jsx(It,{isDisabled:!r,label:c("controlnet.lowThreshold"),value:o,onChange:d,handleReset:p,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0}),a.jsx(It,{isDisabled:!r,label:c("controlnet.highThreshold"),value:s,onChange:h,handleReset:m,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0})]})},xce=l.memo(bce),yce=Do.color_map_image_processor.default,Cce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{color_map_tile_size:o}=n,s=Hs(),{t:i}=Q(),c=l.useCallback(p=>{s(t,{color_map_tile_size:p})},[t,s]),d=l.useCallback(()=>{s(t,{color_map_tile_size:yce.color_map_tile_size})},[t,s]);return a.jsx(Ws,{children:a.jsx(It,{isDisabled:!r,label:i("controlnet.colorMapTileSize"),value:o,onChange:c,handleReset:d,withReset:!0,min:1,max:256,step:1,withInput:!0,withSliderMarks:!0,sliderNumberInputProps:{max:4096}})})},wce=l.memo(Cce),kd=Do.content_shuffle_image_processor.default,Sce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,w:i,h:c,f:d}=n,p=Hs(),{t:h}=Q(),m=l.useCallback(M=>{p(t,{detect_resolution:M})},[t,p]),g=l.useCallback(()=>{p(t,{detect_resolution:kd.detect_resolution})},[t,p]),b=l.useCallback(M=>{p(t,{image_resolution:M})},[t,p]),y=l.useCallback(()=>{p(t,{image_resolution:kd.image_resolution})},[t,p]),x=l.useCallback(M=>{p(t,{w:M})},[t,p]),w=l.useCallback(()=>{p(t,{w:kd.w})},[t,p]),S=l.useCallback(M=>{p(t,{h:M})},[t,p]),j=l.useCallback(()=>{p(t,{h:kd.h})},[t,p]),I=l.useCallback(M=>{p(t,{f:M})},[t,p]),_=l.useCallback(()=>{p(t,{f:kd.f})},[t,p]);return a.jsxs(Ws,{children:[a.jsx(It,{label:h("controlnet.detectResolution"),value:s,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:h("controlnet.imageResolution"),value:o,onChange:b,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:h("controlnet.w"),value:i,onChange:x,handleReset:w,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:h("controlnet.h"),value:c,onChange:S,handleReset:j,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:h("controlnet.f"),value:d,onChange:I,handleReset:_,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},kce=l.memo(Sce),M_=Do.hed_image_processor.default,jce=e=>{const{controlNetId:t,processorNode:{detect_resolution:n,image_resolution:r,scribble:o},isEnabled:s}=e,i=Hs(),{t:c}=Q(),d=l.useCallback(b=>{i(t,{detect_resolution:b})},[t,i]),p=l.useCallback(b=>{i(t,{image_resolution:b})},[t,i]),h=l.useCallback(b=>{i(t,{scribble:b.target.checked})},[t,i]),m=l.useCallback(()=>{i(t,{detect_resolution:M_.detect_resolution})},[t,i]),g=l.useCallback(()=>{i(t,{image_resolution:M_.image_resolution})},[t,i]);return a.jsxs(Ws,{children:[a.jsx(It,{label:c("controlnet.detectResolution"),value:n,onChange:d,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(It,{label:c("controlnet.imageResolution"),value:r,onChange:p,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(_r,{label:c("controlnet.scribble"),isChecked:o,onChange:h,isDisabled:!s})]})},_ce=l.memo(jce),O_=Do.lineart_anime_image_processor.default,Ice=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Hs(),{t:c}=Q(),d=l.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=l.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),h=l.useCallback(()=>{i(t,{detect_resolution:O_.detect_resolution})},[t,i]),m=l.useCallback(()=>{i(t,{image_resolution:O_.image_resolution})},[t,i]);return a.jsxs(Ws,{children:[a.jsx(It,{label:c("controlnet.detectResolution"),value:s,onChange:d,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:c("controlnet.imageResolution"),value:o,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Pce=l.memo(Ice),A_=Do.lineart_image_processor.default,Ece=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,coarse:i}=n,c=Hs(),{t:d}=Q(),p=l.useCallback(y=>{c(t,{detect_resolution:y})},[t,c]),h=l.useCallback(y=>{c(t,{image_resolution:y})},[t,c]),m=l.useCallback(()=>{c(t,{detect_resolution:A_.detect_resolution})},[t,c]),g=l.useCallback(()=>{c(t,{image_resolution:A_.image_resolution})},[t,c]),b=l.useCallback(y=>{c(t,{coarse:y.target.checked})},[t,c]);return a.jsxs(Ws,{children:[a.jsx(It,{label:d("controlnet.detectResolution"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:d("controlnet.imageResolution"),value:o,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(_r,{label:d("controlnet.coarse"),isChecked:i,onChange:b,isDisabled:!r})]})},Mce=l.memo(Ece),R_=Do.mediapipe_face_processor.default,Oce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{max_faces:o,min_confidence:s}=n,i=Hs(),{t:c}=Q(),d=l.useCallback(g=>{i(t,{max_faces:g})},[t,i]),p=l.useCallback(g=>{i(t,{min_confidence:g})},[t,i]),h=l.useCallback(()=>{i(t,{max_faces:R_.max_faces})},[t,i]),m=l.useCallback(()=>{i(t,{min_confidence:R_.min_confidence})},[t,i]);return a.jsxs(Ws,{children:[a.jsx(It,{label:c("controlnet.maxFaces"),value:o,onChange:d,handleReset:h,withReset:!0,min:1,max:20,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:c("controlnet.minConfidence"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Ace=l.memo(Oce),D_=Do.midas_depth_image_processor.default,Rce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{a_mult:o,bg_th:s}=n,i=Hs(),{t:c}=Q(),d=l.useCallback(g=>{i(t,{a_mult:g})},[t,i]),p=l.useCallback(g=>{i(t,{bg_th:g})},[t,i]),h=l.useCallback(()=>{i(t,{a_mult:D_.a_mult})},[t,i]),m=l.useCallback(()=>{i(t,{bg_th:D_.bg_th})},[t,i]);return a.jsxs(Ws,{children:[a.jsx(It,{label:c("controlnet.amult"),value:o,onChange:d,handleReset:h,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:c("controlnet.bgth"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Dce=l.memo(Rce),Sh=Do.mlsd_image_processor.default,Tce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,thr_d:i,thr_v:c}=n,d=Hs(),{t:p}=Q(),h=l.useCallback(j=>{d(t,{detect_resolution:j})},[t,d]),m=l.useCallback(j=>{d(t,{image_resolution:j})},[t,d]),g=l.useCallback(j=>{d(t,{thr_d:j})},[t,d]),b=l.useCallback(j=>{d(t,{thr_v:j})},[t,d]),y=l.useCallback(()=>{d(t,{detect_resolution:Sh.detect_resolution})},[t,d]),x=l.useCallback(()=>{d(t,{image_resolution:Sh.image_resolution})},[t,d]),w=l.useCallback(()=>{d(t,{thr_d:Sh.thr_d})},[t,d]),S=l.useCallback(()=>{d(t,{thr_v:Sh.thr_v})},[t,d]);return a.jsxs(Ws,{children:[a.jsx(It,{label:p("controlnet.detectResolution"),value:s,onChange:h,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:p("controlnet.imageResolution"),value:o,onChange:m,handleReset:x,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:p("controlnet.w"),value:i,onChange:g,handleReset:w,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:p("controlnet.h"),value:c,onChange:b,handleReset:S,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Nce=l.memo(Tce),T_=Do.normalbae_image_processor.default,$ce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Hs(),{t:c}=Q(),d=l.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=l.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),h=l.useCallback(()=>{i(t,{detect_resolution:T_.detect_resolution})},[t,i]),m=l.useCallback(()=>{i(t,{image_resolution:T_.image_resolution})},[t,i]);return a.jsxs(Ws,{children:[a.jsx(It,{label:c("controlnet.detectResolution"),value:s,onChange:d,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:c("controlnet.imageResolution"),value:o,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Lce=l.memo($ce),N_=Do.openpose_image_processor.default,zce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,hand_and_face:i}=n,c=Hs(),{t:d}=Q(),p=l.useCallback(y=>{c(t,{detect_resolution:y})},[t,c]),h=l.useCallback(y=>{c(t,{image_resolution:y})},[t,c]),m=l.useCallback(()=>{c(t,{detect_resolution:N_.detect_resolution})},[t,c]),g=l.useCallback(()=>{c(t,{image_resolution:N_.image_resolution})},[t,c]),b=l.useCallback(y=>{c(t,{hand_and_face:y.target.checked})},[t,c]);return a.jsxs(Ws,{children:[a.jsx(It,{label:d("controlnet.detectResolution"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:d("controlnet.imageResolution"),value:o,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(_r,{label:d("controlnet.handAndFace"),isChecked:i,onChange:b,isDisabled:!r})]})},Fce=l.memo(zce),$_=Do.pidi_image_processor.default,Bce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,scribble:i,safe:c}=n,d=Hs(),{t:p}=Q(),h=l.useCallback(w=>{d(t,{detect_resolution:w})},[t,d]),m=l.useCallback(w=>{d(t,{image_resolution:w})},[t,d]),g=l.useCallback(()=>{d(t,{detect_resolution:$_.detect_resolution})},[t,d]),b=l.useCallback(()=>{d(t,{image_resolution:$_.image_resolution})},[t,d]),y=l.useCallback(w=>{d(t,{scribble:w.target.checked})},[t,d]),x=l.useCallback(w=>{d(t,{safe:w.target.checked})},[t,d]);return a.jsxs(Ws,{children:[a.jsx(It,{label:p("controlnet.detectResolution"),value:s,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:p("controlnet.imageResolution"),value:o,onChange:m,handleReset:b,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(_r,{label:p("controlnet.scribble"),isChecked:i,onChange:y}),a.jsx(_r,{label:p("controlnet.safe"),isChecked:c,onChange:x,isDisabled:!r})]})},Hce=l.memo(Bce),Wce=e=>null,Vce=l.memo(Wce),SA=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{const o=Fs(r,e);return o&&Ru(o)?o.processorNode:void 0},Ie),[e]);return H(t)},Uce=({id:e})=>{const t=Oi(e),n=SA(e);return n?n.type==="canny_image_processor"?a.jsx(xce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="color_map_image_processor"?a.jsx(wce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="hed_image_processor"?a.jsx(_ce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="lineart_image_processor"?a.jsx(Mce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="content_shuffle_image_processor"?a.jsx(kce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="lineart_anime_image_processor"?a.jsx(Pce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="mediapipe_face_processor"?a.jsx(Ace,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="midas_depth_image_processor"?a.jsx(Dce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="mlsd_image_processor"?a.jsx(Nce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="normalbae_image_processor"?a.jsx(Lce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="openpose_image_processor"?a.jsx(Fce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="pidi_image_processor"?a.jsx(Hce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="zoe_depth_image_processor"?a.jsx(Vce,{controlNetId:e,processorNode:n,isEnabled:t}):null:null},Gce=l.memo(Uce),qce=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{const o=Fs(r,e);if(o&&Ru(o))return o.shouldAutoConfig},Ie),[e]);return H(t)},Kce=({id:e})=>{const t=Oi(e),n=qce(e),r=le(),{t:o}=Q(),s=l.useCallback(()=>{r(vT({id:e}))},[e,r]);return si(n)?null:a.jsx(_r,{label:o("controlnet.autoConfigure"),"aria-label":o("controlnet.autoConfigure"),isChecked:n,onChange:s,isDisabled:!t})},Qce=l.memo(Kce),Xce=e=>{const{id:t}=e,n=le(),{t:r}=Q(),o=l.useCallback(()=>{n(bT({id:t}))},[t,n]),s=l.useCallback(()=>{n(xT({id:t}))},[t,n]);return a.jsxs(N,{sx:{gap:2},children:[a.jsx(rt,{size:"sm",icon:a.jsx(Xl,{}),tooltip:r("controlnet.importImageFromCanvas"),"aria-label":r("controlnet.importImageFromCanvas"),onClick:o}),a.jsx(rt,{size:"sm",icon:a.jsx(JM,{}),tooltip:r("controlnet.importMaskFromCanvas"),"aria-label":r("controlnet.importMaskFromCanvas"),onClick:s})]})},Yce=l.memo(Xce),Jce=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{const o=Fs(r,e);return o?{beginStepPct:o.beginStepPct,endStepPct:o.endStepPct}:void 0},Ie),[e]);return H(t)},L_=e=>`${Math.round(e*100)}%`,Zce=({id:e})=>{const t=Oi(e),n=Jce(e),r=le(),{t:o}=Q(),s=l.useCallback(i=>{r(yT({id:e,beginStepPct:i[0]})),r(CT({id:e,endStepPct:i[1]}))},[r,e]);return n?a.jsx(kn,{feature:"controlNetBeginEnd",children:a.jsxs(Vn,{isDisabled:!t,children:[a.jsx(yr,{children:o("controlnet.beginEndStepPercent")}),a.jsx(Pg,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(L3,{"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(z3,{children:a.jsx(F3,{})}),a.jsx(Wn,{label:L_(n.beginStepPct),placement:"top",hasArrow:!0,children:a.jsx(Ob,{index:0})}),a.jsx(Wn,{label:L_(n.endStepPct),placement:"top",hasArrow:!0,children:a.jsx(Ob,{index:1})}),a.jsx(Rh,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(Rh,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(Rh,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})}):null},eue=l.memo(Zce),tue=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{const o=Fs(r,e);if(o&&wT(o))return o.controlMode},Ie),[e]);return H(t)};function nue({id:e}){const t=Oi(e),n=tue(e),r=le(),{t:o}=Q(),s=[{label:o("controlnet.balanced"),value:"balanced"},{label:o("controlnet.prompt"),value:"more_prompt"},{label:o("controlnet.control"),value:"more_control"},{label:o("controlnet.megaControl"),value:"unbalanced"}],i=l.useCallback(c=>{r(ST({id:e,controlMode:c}))},[e,r]);return n?a.jsx(kn,{feature:"controlNetControlMode",children:a.jsx(Dr,{disabled:!t,label:o("controlnet.controlMode"),data:s,value:n,onChange:i})}):null}const rue=e=>e.config,oue=me(rue,e=>To(Do,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)),Ie),sue=({id:e})=>{const t=Oi(e),n=SA(e),r=le(),o=H(oue),{t:s}=Q(),i=l.useCallback(c=>{r(kT({id:e,processorType:c}))},[e,r]);return n?a.jsx(sr,{label:s("controlnet.processor"),value:n.type??"canny_image_processor",data:o,onChange:i,disabled:!t}):null},aue=l.memo(sue),iue=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{const o=Fs(r,e);if(o&&Ru(o))return o.resizeMode},Ie),[e]);return H(t)};function lue({id:e}){const t=Oi(e),n=iue(e),r=le(),{t:o}=Q(),s=[{label:o("controlnet.resize"),value:"just_resize"},{label:o("controlnet.crop"),value:"crop_resize"},{label:o("controlnet.fill"),value:"fill_resize"}],i=l.useCallback(c=>{r(jT({id:e,resizeMode:c}))},[e,r]);return n?a.jsx(kn,{feature:"controlNetResizeMode",children:a.jsx(Dr,{disabled:!t,label:o("controlnet.resizeMode"),data:s,value:n,onChange:i})}):null}const cue=e=>{const{id:t,number:n}=e,r=wA(t),o=le(),{t:s}=Q(),i=H(lo),c=Oi(t),[d,p]=ote(!1),h=l.useCallback(()=>{o(_T({id:t}))},[t,o]),m=l.useCallback(()=>{o(IT(t))},[t,o]),g=l.useCallback(b=>{o(PT({id:t,isEnabled:b.target.checked}))},[t,o]);return r?a.jsxs(N,{sx:{flexDir:"column",gap:3,p:2,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx(N,{sx:{gap:2,alignItems:"center",justifyContent:"space-between"},children:a.jsx(_r,{label:s(`controlnet.${r}`,{number:n}),"aria-label":s("controlnet.toggleControlNet"),isChecked:c,onChange:g,formControlProps:{w:"full"},formLabelProps:{fontWeight:600}})}),a.jsxs(N,{sx:{gap:2,alignItems:"center"},children:[a.jsx(Le,{sx:{w:"full",minW:0,transitionProperty:"common",transitionDuration:"0.1s"},children:a.jsx(cce,{id:t})}),i==="unifiedCanvas"&&a.jsx(Yce,{id:t}),a.jsx(rt,{size:"sm",tooltip:s("controlnet.duplicate"),"aria-label":s("controlnet.duplicate"),onClick:m,icon:a.jsx(Hu,{})}),a.jsx(rt,{size:"sm",tooltip:s("controlnet.delete"),"aria-label":s("controlnet.delete"),colorScheme:"error",onClick:h,icon:a.jsx(Zo,{})}),a.jsx(rt,{size:"sm",tooltip:s(d?"controlnet.hideAdvanced":"controlnet.showAdvanced"),"aria-label":s(d?"controlnet.hideAdvanced":"controlnet.showAdvanced"),onClick:p,variant:"ghost",sx:{_hover:{bg:"none"}},icon:a.jsx(b0,{sx:{boxSize:4,color:"base.700",transform:d?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal",_dark:{color:"base.300"}}})})]}),a.jsxs(N,{sx:{w:"full",flexDirection:"column",gap:3},children:[a.jsxs(N,{sx:{gap:4,w:"full",alignItems:"center"},children:[a.jsxs(N,{sx:{flexDir:"column",gap:3,h:28,w:"full",paddingInlineStart:1,paddingInlineEnd:d?1:0,pb:2,justifyContent:"space-between"},children:[a.jsx(fce,{id:t}),a.jsx(eue,{id:t})]}),!d&&a.jsx(N,{sx:{alignItems:"center",justifyContent:"center",h:28,w:28,aspectRatio:"1/1"},children:a.jsx(P_,{id:t,isSmall:!0})})]}),a.jsxs(N,{sx:{gap:2},children:[a.jsx(nue,{id:t}),a.jsx(lue,{id:t})]}),a.jsx(aue,{id:t})]}),d&&a.jsxs(a.Fragment,{children:[a.jsx(P_,{id:t}),a.jsx(Qce,{id:t}),a.jsx(Gce,{id:t})]})]}):null},uue=l.memo(cue),z1=e=>{const t=H(c=>{var d;return(d=c.generation.model)==null?void 0:d.base_model}),n=le(),r=CA(e),o=l.useMemo(()=>{const c=r.filter(d=>t?d.base_model===t:!0)[0];return c||r[0]},[t,r]),s=l.useMemo(()=>!o,[o]);return[l.useCallback(()=>{s||n(ET({type:e,overrides:{model:o}}))},[n,o,s,e]),s]},due=me([we],({controlAdapters:e})=>{const t=[];let n=!1;const r=MT(e).filter(h=>h.isEnabled).length,o=OT(e).length;r>0&&t.push(`${r} IP`),r>o&&(n=!0);const s=AT(e).filter(h=>h.isEnabled).length,i=RT(e).length;s>0&&t.push(`${s} ControlNet`),s>i&&(n=!0);const c=DT(e).filter(h=>h.isEnabled).length,d=TT(e).length;return c>0&&t.push(`${c} T2I`),c>d&&(n=!0),{controlAdapterIds:NT(e).map(String),activeLabel:t.join(", "),isError:n}},Ie),fue=()=>{const{t:e}=Q(),{controlAdapterIds:t,activeLabel:n}=H(due),r=Pn("controlNet").isFeatureDisabled,[o,s]=z1("controlnet"),[i,c]=z1("ip_adapter"),[d,p]=z1("t2i_adapter");return r?null:a.jsx(No,{label:e("controlnet.controlAdapter_other"),activeLabel:n,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsxs(Hn,{size:"sm",w:"full",justifyContent:"space-between",children:[a.jsx(Dt,{tooltip:e("controlnet.addControlNet"),leftIcon:a.jsx(Zi,{}),onClick:o,"data-testid":"add controlnet",flexGrow:1,isDisabled:s,children:e("common.controlNet")}),a.jsx(Dt,{tooltip:e("controlnet.addIPAdapter"),leftIcon:a.jsx(Zi,{}),onClick:i,"data-testid":"add ip adapter",flexGrow:1,isDisabled:c,children:e("common.ipAdapter")}),a.jsx(Dt,{tooltip:e("controlnet.addT2IAdapter"),leftIcon:a.jsx(Zi,{}),onClick:d,"data-testid":"add t2i adapter",flexGrow:1,isDisabled:p,children:e("common.t2iAdapter")})]}),t.map((h,m)=>a.jsxs(l.Fragment,{children:[a.jsx(io,{}),a.jsx(uue,{id:h,number:m+1})]},h))]})})},Ju=l.memo(fue),pue=e=>{const{onClick:t}=e,{t:n}=Q();return a.jsx(rt,{size:"sm","aria-label":n("embedding.addEmbedding"),tooltip:n("embedding.addEmbedding"),icon:a.jsx(UM,{}),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})},D0=l.memo(pue),hue="28rem",mue=e=>{const{onSelect:t,isOpen:n,onClose:r,children:o}=e,{data:s}=$T(),i=l.useRef(null),{t:c}=Q(),d=H(g=>g.generation.model),p=l.useMemo(()=>{if(!s)return[];const g=[];return to(s.entities,(b,y)=>{if(!b)return;const x=(d==null?void 0:d.base_model)!==b.base_model;g.push({value:b.model_name,label:b.model_name,group:xr[b.base_model],disabled:x,tooltip:x?`${c("embedding.incompatibleModel")} ${b.base_model}`:void 0})}),g.sort((b,y)=>{var x;return b.label&&y.label?(x=b.label)!=null&&x.localeCompare(y.label)?-1:1:-1}),g.sort((b,y)=>b.disabled&&!y.disabled?1:-1)},[s,d==null?void 0:d.base_model,c]),h=l.useCallback(g=>{g&&t(g)},[t]),m=l.useCallback((g,b)=>{var y;return((y=b.label)==null?void 0:y.toLowerCase().includes(g.toLowerCase().trim()))||b.value.toLowerCase().includes(g.toLowerCase().trim())},[]);return a.jsxs(Uf,{initialFocusRef:i,isOpen:n,onClose:r,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(Bg,{children:o}),a.jsx(Gf,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Hg,{sx:{p:0,w:`calc(${hue} - 2rem )`},children:p.length===0?a.jsx(N,{sx:{justifyContent:"center",p:2,fontSize:"sm",color:"base.500",_dark:{color:"base.700"}},children:a.jsx(je,{children:"No Embeddings Loaded"})}):a.jsx(sr,{inputRef:i,autoFocus:!0,placeholder:c("embedding.addEmbedding"),value:null,data:p,nothingFound:c("embedding.noMatchingEmbedding"),itemComponent:pl,disabled:p.length===0,onDropdownClose:r,filter:m,onChange:h})})})]})},T0=l.memo(mue),gue=()=>{const e=H(m=>m.generation.negativePrompt),t=l.useRef(null),{isOpen:n,onClose:r,onOpen:o}=hs(),s=le(),{t:i}=Q(),c=l.useCallback(m=>{s(Ld(m.target.value))},[s]),d=l.useCallback(m=>{m.key==="<"&&o()},[o]),p=l.useCallback(m=>{if(!t.current)return;const g=t.current.selectionStart;if(g===void 0)return;let b=e.slice(0,g);b[b.length-1]!=="<"&&(b+="<"),b+=`${m}>`;const y=b.length;b+=e.slice(g),ls.flushSync(()=>{s(Ld(b))}),t.current.selectionEnd=y,r()},[s,r,e]),h=Pn("embedding").isFeatureEnabled;return a.jsxs(Vn,{children:[a.jsx(T0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(kn,{feature:"paramNegativeConditioning",placement:"right",children:a.jsx(yi,{id:"negativePrompt",name:"negativePrompt",ref:t,value:e,placeholder:i("parameters.negativePromptPlaceholder"),onChange:c,resize:"vertical",fontSize:"sm",minH:16,...h&&{onKeyDown:d}})})}),!n&&h&&a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(D0,{onClick:o})})]})},kA=l.memo(gue),vue=me([we],({generation:e})=>({prompt:e.positivePrompt}),{memoizeOptions:{resultEqualityCheck:Nn}}),bue=()=>{const e=le(),{prompt:t}=H(vue),n=l.useRef(null),{isOpen:r,onClose:o,onOpen:s}=hs(),{t:i}=Q(),c=l.useCallback(m=>{e($d(m.target.value))},[e]);_t("alt+a",()=>{var m;(m=n.current)==null||m.focus()},[]);const d=l.useCallback(m=>{if(!n.current)return;const g=n.current.selectionStart;if(g===void 0)return;let b=t.slice(0,g);b[b.length-1]!=="<"&&(b+="<"),b+=`${m}>`;const y=b.length;b+=t.slice(g),ls.flushSync(()=>{e($d(b))}),n.current.selectionStart=y,n.current.selectionEnd=y,o()},[e,o,t]),p=Pn("embedding").isFeatureEnabled,h=l.useCallback(m=>{p&&m.key==="<"&&s()},[s,p]);return a.jsxs(Le,{position:"relative",children:[a.jsx(Vn,{children:a.jsx(T0,{isOpen:r,onClose:o,onSelect:d,children:a.jsx(kn,{feature:"paramPositiveConditioning",placement:"right",children:a.jsx(yi,{id:"prompt",name:"prompt",ref:n,value:t,placeholder:i("parameters.positivePromptPlaceholder"),onChange:c,onKeyDown:h,resize:"vertical",minH:32})})})}),!r&&p&&a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(D0,{onClick:s})})]})},jA=l.memo(bue);function xue(){const e=H(o=>o.sdxl.shouldConcatSDXLStylePrompt),t=le(),{t:n}=Q(),r=l.useCallback(()=>{t(LT(!e))},[t,e]);return a.jsx(rt,{"aria-label":n("sdxl.concatPromptStyle"),tooltip:n("sdxl.concatPromptStyle"),variant:"outline",isChecked:e,onClick:r,icon:a.jsx(XM,{}),size:"xs",sx:{position:"absolute",insetInlineEnd:1,top:6,border:"none",color:e?"accent.500":"base.500",_hover:{bg:"none"}}})}const z_={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 _A(){return a.jsxs(N,{children:[a.jsx(Le,{as:Ar.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",...z_,_dark:{borderColor:"accent.500"}}}),a.jsx(Le,{as:Ar.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(XM,{size:12})}),a.jsx(Le,{as:Ar.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",...z_,_dark:{borderColor:"accent.500"}}})]})}const yue=me([we],({sdxl:e})=>{const{negativeStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Nn}}),Cue=()=>{const e=le(),t=l.useRef(null),{isOpen:n,onClose:r,onOpen:o}=hs(),{t:s}=Q(),{prompt:i,shouldConcatSDXLStylePrompt:c}=H(yue),d=l.useCallback(g=>{e(Fd(g.target.value))},[e]),p=l.useCallback(g=>{if(!t.current)return;const b=t.current.selectionStart;if(b===void 0)return;let y=i.slice(0,b);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const x=y.length;y+=i.slice(b),ls.flushSync(()=>{e(Fd(y))}),t.current.selectionStart=x,t.current.selectionEnd=x,r()},[e,r,i]),h=Pn("embedding").isFeatureEnabled,m=l.useCallback(g=>{h&&g.key==="<"&&o()},[o,h]);return a.jsxs(Le,{position:"relative",children:[a.jsx(So,{children:c&&a.jsx(Le,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(_A,{})})}),a.jsx(Vn,{children:a.jsx(T0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(yi,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.negStylePrompt"),onChange:d,onKeyDown:m,resize:"vertical",fontSize:"sm",minH:16})})}),!n&&h&&a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(D0,{onClick:o})})]})},wue=l.memo(Cue),Sue=me([we],({sdxl:e})=>{const{positiveStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Nn}}),kue=()=>{const e=le(),t=l.useRef(null),{isOpen:n,onClose:r,onOpen:o}=hs(),{t:s}=Q(),{prompt:i,shouldConcatSDXLStylePrompt:c}=H(Sue),d=l.useCallback(g=>{e(zd(g.target.value))},[e]),p=l.useCallback(g=>{if(!t.current)return;const b=t.current.selectionStart;if(b===void 0)return;let y=i.slice(0,b);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const x=y.length;y+=i.slice(b),ls.flushSync(()=>{e(zd(y))}),t.current.selectionStart=x,t.current.selectionEnd=x,r()},[e,r,i]),h=Pn("embedding").isFeatureEnabled,m=l.useCallback(g=>{h&&g.key==="<"&&o()},[o,h]);return a.jsxs(Le,{position:"relative",children:[a.jsx(So,{children:c&&a.jsx(Le,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(_A,{})})}),a.jsx(Vn,{children:a.jsx(T0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(yi,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.posStylePrompt"),onChange:d,onKeyDown:m,resize:"vertical",minH:16})})}),!n&&h&&a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(D0,{onClick:o})})]})},jue=l.memo(kue);function J2(){return a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsx(jA,{}),a.jsx(xue,{}),a.jsx(jue,{}),a.jsx(kA,{}),a.jsx(wue,{})]})}const vl=()=>{const{isRefinerAvailable:e}=aa(Yx,{selectFromResult:({data:t})=>({isRefinerAvailable:t?t.ids.length>0:!1})});return e},_ue=me([we],({sdxl:e,ui:t,hotkeys:n})=>{const{refinerCFGScale:r}=e,{shouldUseSliders:o}=t,{shift:s}=n;return{refinerCFGScale:r,shouldUseSliders:o,shift:s}},Ie),Iue=()=>{const{refinerCFGScale:e,shouldUseSliders:t,shift:n}=H(_ue),r=vl(),o=le(),{t:s}=Q(),i=l.useCallback(d=>o(tb(d)),[o]),c=l.useCallback(()=>o(tb(7)),[o]);return t?a.jsx(It,{label:s("sdxl.cfgScale"),step:n?.1:.5,min:1,max:20,onChange:i,handleReset:c,value:e,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!r}):a.jsx(_a,{label:s("sdxl.cfgScale"),step:.5,min:1,max:200,onChange:i,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"},isDisabled:!r})},Pue=l.memo(Iue),Eue=e=>{const t=ki("models"),[n,r,o]=e.split("/"),s=zT.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},Mue=me(we,e=>({model:e.sdxl.refinerModel}),Ie),Oue=()=>{const e=le(),t=Pn("syncModels").isFeatureEnabled,{model:n}=H(Mue),{t:r}=Q(),{data:o,isLoading:s}=aa(Yx),i=l.useMemo(()=>{if(!o)return[];const p=[];return to(o.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:xr[h.base_model]})}),p},[o]),c=l.useMemo(()=>(o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])??null,[o==null?void 0:o.entities,n]),d=l.useCallback(p=>{if(!p)return;const h=Eue(p);h&&e(WI(h))},[e]);return s?a.jsx(sr,{label:r("sdxl.refinermodel"),placeholder:r("sdxl.loading"),disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(sr,{tooltip:c==null?void 0:c.description,label:r("sdxl.refinermodel"),value:c==null?void 0:c.id,placeholder:i.length>0?r("sdxl.selectAModel"):r("sdxl.noModelsAvailable"),data:i,error:i.length===0,disabled:i.length===0,onChange:d,w:"100%"}),t&&a.jsx(Le,{mt:7,children:a.jsx(Ku,{iconMode:!0})})]})},Aue=l.memo(Oue),Rue=me([we],({sdxl:e,hotkeys:t})=>{const{refinerNegativeAestheticScore:n}=e,{shift:r}=t;return{refinerNegativeAestheticScore:n,shift:r}},Ie),Due=()=>{const{refinerNegativeAestheticScore:e,shift:t}=H(Rue),n=vl(),r=le(),{t:o}=Q(),s=l.useCallback(c=>r(rb(c)),[r]),i=l.useCallback(()=>r(rb(2.5)),[r]);return a.jsx(It,{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})},Tue=l.memo(Due),Nue=me([we],({sdxl:e,hotkeys:t})=>{const{refinerPositiveAestheticScore:n}=e,{shift:r}=t;return{refinerPositiveAestheticScore:n,shift:r}},Ie),$ue=()=>{const{refinerPositiveAestheticScore:e,shift:t}=H(Nue),n=vl(),r=le(),{t:o}=Q(),s=l.useCallback(c=>r(nb(c)),[r]),i=l.useCallback(()=>r(nb(6)),[r]);return a.jsx(It,{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})},Lue=l.memo($ue),zue=me(we,({ui:e,sdxl:t})=>{const{refinerScheduler:n}=t,{favoriteSchedulers:r}=e,o=To(hg,(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}},Ie),Fue=()=>{const e=le(),{t}=Q(),{refinerScheduler:n,data:r}=H(zue),o=vl(),s=l.useCallback(i=>{i&&e(VI(i))},[e]);return a.jsx(sr,{w:"100%",label:t("sdxl.scheduler"),value:n,data:r,onChange:s,disabled:!o})},Bue=l.memo(Fue),Hue=me([we],({sdxl:e})=>{const{refinerStart:t}=e;return{refinerStart:t}},Ie),Wue=()=>{const{refinerStart:e}=H(Hue),t=le(),n=vl(),r=l.useCallback(i=>t(ob(i)),[t]),{t:o}=Q(),s=l.useCallback(()=>t(ob(.8)),[t]);return a.jsx(It,{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})},Vue=l.memo(Wue),Uue=me([we],({sdxl:e,ui:t})=>{const{refinerSteps:n}=e,{shouldUseSliders:r}=t;return{refinerSteps:n,shouldUseSliders:r}},Ie),Gue=()=>{const{refinerSteps:e,shouldUseSliders:t}=H(Uue),n=vl(),r=le(),{t:o}=Q(),s=l.useCallback(c=>{r(eb(c))},[r]),i=l.useCallback(()=>{r(eb(20))},[r]);return t?a.jsx(It,{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(_a,{label:o("sdxl.steps"),min:1,max:500,step:1,onChange:s,value:e,numberInputFieldProps:{textAlign:"center"},isDisabled:!n})},que=l.memo(Gue);function Kue(){const e=H(s=>s.sdxl.shouldUseSDXLRefiner),t=vl(),n=le(),{t:r}=Q(),o=l.useCallback(s=>{n(FT(s.target.checked))},[n]);return a.jsx(_r,{label:r("sdxl.useRefiner"),isChecked:e,onChange:o,isDisabled:!t})}const Que=me(we,e=>{const{shouldUseSDXLRefiner:t}=e.sdxl,{shouldUseSliders:n}=e.ui;return{activeLabel:t?"Enabled":void 0,shouldUseSliders:n}},Ie),Xue=()=>{const{activeLabel:e,shouldUseSliders:t}=H(Que),{t:n}=Q();return vl()?a.jsx(No,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsxs(N,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Kue,{}),a.jsx(Aue,{}),a.jsxs(N,{gap:2,flexDirection:t?"column":"row",children:[a.jsx(que,{}),a.jsx(Pue,{})]}),a.jsx(Bue,{}),a.jsx(Lue,{}),a.jsx(Tue,{}),a.jsx(Vue,{})]})}):a.jsx(No,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsx(N,{sx:{justifyContent:"center",p:2},children:a.jsx(je,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:n("models.noRefinerModelsInstalled")})})})},Z2=l.memo(Xue),Yue=me([we],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:c}=t.sd.guidance,{cfgScale:d}=e,{shouldUseSliders:p}=n,{shift:h}=r;return{cfgScale:d,initial:o,min:s,sliderMax:i,inputMax:c,shouldUseSliders:p,shift:h}},Ie),Jue=()=>{const{cfgScale:e,initial:t,min:n,sliderMax:r,inputMax:o,shouldUseSliders:s,shift:i}=H(Yue),c=le(),{t:d}=Q(),p=l.useCallback(m=>c(Wh(m)),[c]),h=l.useCallback(()=>c(Wh(t)),[c,t]);return s?a.jsx(kn,{feature:"paramCFGScale",children:a.jsx(It,{label:d("parameters.cfgScale"),step:i?.1:.5,min:n,max:r,onChange:p,handleReset:h,value:e,sliderNumberInputProps:{max:o},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1})}):a.jsx(kn,{feature:"paramCFGScale",children:a.jsx(_a,{label:d("parameters.cfgScale"),step:.5,min:n,max:o,onChange:p,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})})},Na=l.memo(Jue),Zue=me(we,e=>({model:e.generation.model}),Ie),ede=()=>{const e=le(),{t}=Q(),{model:n}=H(Zue),r=Pn("syncModels").isFeatureEnabled,{data:o,isLoading:s}=aa(iS),{data:i,isLoading:c}=Jd(iS),d=H(lo),p=l.useMemo(()=>{if(!o)return[];const g=[];return to(o.entities,(b,y)=>{b&&g.push({value:y,label:b.model_name,group:xr[b.base_model]})}),to(i==null?void 0:i.entities,(b,y)=>{!b||d==="unifiedCanvas"||d==="img2img"||g.push({value:y,label:b.model_name,group:xr[b.base_model]})}),g},[o,i,d]),h=l.useMemo(()=>((o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])||(i==null?void 0:i.entities[`${n==null?void 0:n.base_model}/onnx/${n==null?void 0:n.model_name}`]))??null,[o==null?void 0:o.entities,n,i==null?void 0:i.entities]),m=l.useCallback(g=>{if(!g)return;const b=R0(g);b&&e(X1(b))},[e]);return s||c?a.jsx(sr,{label:t("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:3,children:[a.jsx(kn,{feature:"paramModel",children:a.jsx(sr,{tooltip:h==null?void 0:h.description,label:t("modelManager.model"),value:h==null?void 0:h.id,placeholder:p.length>0?"Select a model":"No models available",data:p,error:p.length===0,disabled:p.length===0,onChange:m,w:"100%"})}),r&&a.jsx(Le,{mt:6,children:a.jsx(Ku,{iconMode:!0})})]})},tde=l.memo(ede),nde=me(we,({generation:e})=>{const{model:t,vae:n}=e;return{model:t,vae:n}},Ie),rde=()=>{const e=le(),{t}=Q(),{model:n,vae:r}=H(nde),{data:o}=iP(),s=l.useMemo(()=>{if(!o)return[];const d=[{value:"default",label:"Default",group:"Default"}];return to(o.entities,(p,h)=>{if(!p)return;const m=(n==null?void 0:n.base_model)!==p.base_model;d.push({value:h,label:p.model_name,group:xr[p.base_model],disabled:m,tooltip:m?`Incompatible base model: ${p.base_model}`:void 0})}),d.sort((p,h)=>p.disabled&&!h.disabled?1:-1)},[o,n==null?void 0:n.base_model]),i=l.useMemo(()=>(o==null?void 0:o.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[o==null?void 0:o.entities,r]),c=l.useCallback(d=>{if(!d||d==="default"){e(Vc(null));return}const p=vA(d);p&&e(Vc(p))},[e]);return a.jsx(kn,{feature:"paramVAE",children:a.jsx(sr,{itemComponent:pl,tooltip:i==null?void 0:i.description,label:t("modelManager.vae"),value:(i==null?void 0:i.id)??"default",placeholder:"Default",data:s,onChange:c,disabled:s.length===0,clearable:!0})})},ode=l.memo(rde),sde=me([uP,da],(e,t)=>{const{scheduler:n}=t,{favoriteSchedulers:r}=e,o=To(hg,(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}},Ie),ade=()=>{const e=le(),{t}=Q(),{scheduler:n,data:r}=H(sde),o=l.useCallback(s=>{s&&e(Y1(s))},[e]);return a.jsx(kn,{feature:"paramScheduler",children:a.jsx(sr,{label:t("parameters.scheduler"),value:n,data:r,onChange:o})})},ide=l.memo(ade),lde=me(we,({generation:e})=>{const{vaePrecision:t}=e;return{vaePrecision:t}},Ie),cde=["fp16","fp32"],ude=()=>{const{t:e}=Q(),t=le(),{vaePrecision:n}=H(lde),r=l.useCallback(o=>{o&&t(BT(o))},[t]);return a.jsx(kn,{feature:"paramVAEPrecision",children:a.jsx(Dr,{label:e("modelManager.vaePrecision"),value:n,data:cde,onChange:r})})},dde=l.memo(ude),fde=()=>{const e=Pn("vae").isFeatureEnabled;return a.jsxs(N,{gap:3,w:"full",flexWrap:e?"wrap":"nowrap",children:[a.jsx(Le,{w:"full",children:a.jsx(tde,{})}),a.jsx(Le,{w:"full",children:a.jsx(ide,{})}),e&&a.jsxs(N,{w:"full",gap:3,children:[a.jsx(ode,{}),a.jsx(dde,{})]})]})},$a=l.memo(fde),IA=[{name:fn.t("parameters.aspectRatioFree"),value:null},{name:"2:3",value:2/3},{name:"16:9",value:16/9},{name:"1:1",value:1/1}],PA=IA.map(e=>e.value);function EA(){const e=H(s=>s.generation.aspectRatio),t=le(),n=H(s=>s.generation.shouldFitToWidthHeight),r=H(lo),o=l.useCallback(s=>{t(Ys(s.value)),t(Zd(!1))},[t]);return a.jsx(Hn,{isAttached:!0,children:IA.map(s=>a.jsx(Dt,{size:"sm",isChecked:e===s.value,isDisabled:r==="img2img"?!n:!1,onClick:o.bind(null,s),children:s.name},s.name))})}const pde=me([we],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:c}=n.sd.height,{model:d,height:p}=e,{aspectRatio:h}=e,m=t.shift?i:c;return{model:d,height:p,min:r,sliderMax:o,inputMax:s,step:m,aspectRatio:h}},Ie),hde=e=>{const{model:t,height:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:c}=H(pde),d=le(),{t:p}=Q(),h=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,m=l.useCallback(b=>{if(d(Vl(b)),c){const y=Ro(b*c,8);d(Wl(y))}},[d,c]),g=l.useCallback(()=>{if(d(Vl(h)),c){const b=Ro(h*c,8);d(Wl(b))}},[d,h,c]);return a.jsx(It,{label:p("parameters.height"),value:n,min:r,step:i,max:o,onChange:m,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},mde=l.memo(hde),gde=me([we],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:c}=n.sd.width,{model:d,width:p,aspectRatio:h}=e,m=t.shift?i:c;return{model:d,width:p,min:r,sliderMax:o,inputMax:s,step:m,aspectRatio:h}},Ie),vde=e=>{const{model:t,width:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:c}=H(gde),d=le(),{t:p}=Q(),h=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,m=l.useCallback(b=>{if(d(Wl(b)),c){const y=Ro(b/c,8);d(Vl(y))}},[d,c]),g=l.useCallback(()=>{if(d(Wl(h)),c){const b=Ro(h/c,8);d(Vl(b))}},[d,h,c]);return a.jsx(It,{label:p("parameters.width"),value:n,min:r,step:i,max:o,onChange:m,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},bde=l.memo(vde),xde=me([da,lo],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}=e;return{activeTabName:t,shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}},Ie);function Eu(){const{t:e}=Q(),t=le(),{activeTabName:n,shouldFitToWidthHeight:r,shouldLockAspectRatio:o,width:s,height:i}=H(xde),c=l.useCallback(()=>{o?(t(Zd(!1)),PA.includes(s/i)?t(Ys(s/i)):t(Ys(null))):(t(Zd(!0)),t(Ys(s/i)))},[o,s,i,t]),d=l.useCallback(()=>{t(HT()),t(Ys(null)),o&&t(Ys(i/s))},[t,o,s,i]);return a.jsxs(N,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.150",_dark:{bg:"base.750"}},children:[a.jsx(kn,{feature:"paramRatio",children:a.jsxs(Vn,{as:N,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(yr,{children:e("parameters.aspectRatio")}),a.jsx(Pi,{}),a.jsx(EA,{}),a.jsx(rt,{tooltip:e("ui.swapSizes"),"aria-label":e("ui.swapSizes"),size:"sm",icon:a.jsx(P8,{}),fontSize:20,isDisabled:n==="img2img"?!r:!1,onClick:d}),a.jsx(rt,{tooltip:e("ui.lockRatio"),"aria-label":e("ui.lockRatio"),size:"sm",icon:a.jsx(YM,{}),isChecked:o,isDisabled:n==="img2img"?!r:!1,onClick:c})]})}),a.jsx(N,{gap:2,alignItems:"center",children:a.jsxs(N,{gap:2,flexDirection:"column",width:"full",children:[a.jsx(bde,{isDisabled:n==="img2img"?!r:!1}),a.jsx(mde,{isDisabled:n==="img2img"?!r:!1})]})})]})}const yde=me([we],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:c,fineStep:d,coarseStep:p}=t.sd.steps,{steps:h}=e,{shouldUseSliders:m}=n,g=r.shift?d:p;return{steps:h,initial:o,min:s,sliderMax:i,inputMax:c,step:g,shouldUseSliders:m}},Ie),Cde=()=>{const{steps:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:i}=H(yde),c=le(),{t:d}=Q(),p=l.useCallback(g=>{c(Vh(g))},[c]),h=l.useCallback(()=>{c(Vh(t))},[c,t]),m=l.useCallback(()=>{c(Qx())},[c]);return i?a.jsx(kn,{feature:"paramSteps",children:a.jsx(It,{label:d("parameters.steps"),min:n,max:r,step:s,onChange:p,handleReset:h,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:o}})}):a.jsx(kn,{feature:"paramSteps",children:a.jsx(_a,{label:d("parameters.steps"),min:n,max:o,step:s,onChange:p,value:e,numberInputFieldProps:{textAlign:"center"},onBlur:m})})},La=l.memo(Cde);function MA(){const e=le(),t=H(o=>o.generation.shouldFitToWidthHeight),n=l.useCallback(o=>{e(WT(o.target.checked))},[e]),{t:r}=Q();return a.jsx(_r,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function wde(){const e=H(i=>i.generation.seed),t=H(i=>i.generation.shouldRandomizeSeed),n=H(i=>i.generation.shouldGenerateVariations),{t:r}=Q(),o=le(),s=l.useCallback(i=>o(Hh(i)),[o]);return a.jsx(_a,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:dP,max:fP,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e})}const Sde=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);function kde(){const e=le(),t=H(o=>o.generation.shouldRandomizeSeed),{t:n}=Q(),r=l.useCallback(()=>e(Hh(Sde(dP,fP))),[e]);return a.jsx(rt,{size:"sm",isDisabled:t,"aria-label":n("parameters.shuffle"),tooltip:n("parameters.shuffle"),onClick:r,icon:a.jsx(Gee,{})})}const jde=()=>{const e=le(),{t}=Q(),n=H(o=>o.generation.shouldRandomizeSeed),r=l.useCallback(o=>e(VT(o.target.checked)),[e]);return a.jsx(_r,{label:t("common.random"),isChecked:n,onChange:r})},_de=l.memo(jde),Ide=()=>a.jsx(kn,{feature:"paramSeed",children:a.jsxs(N,{sx:{gap:3,alignItems:"flex-end"},children:[a.jsx(wde,{}),a.jsx(kde,{}),a.jsx(_de,{})]})}),za=l.memo(Ide),OA=De((e,t)=>a.jsxs(N,{ref:t,sx:{flexDir:"column",gap:2,bg:"base.100",px:4,pt:2,pb:4,borderRadius:"base",_dark:{bg:"base.750"}},children:[a.jsx(je,{fontSize:"sm",fontWeight:"bold",sx:{color:"base.600",_dark:{color:"base.300"}},children:e.label}),e.children]}));OA.displayName="SubSettingsWrapper";const Mu=l.memo(OA),Pde=me([we],({sdxl:e})=>{const{sdxlImg2ImgDenoisingStrength:t}=e;return{sdxlImg2ImgDenoisingStrength:t}},Ie),Ede=()=>{const{sdxlImg2ImgDenoisingStrength:e}=H(Pde),t=le(),{t:n}=Q(),r=l.useCallback(s=>t(lS(s)),[t]),o=l.useCallback(()=>{t(lS(.7))},[t]);return a.jsx(kn,{feature:"paramDenoisingStrength",children:a.jsx(Mu,{children:a.jsx(It,{label:n("sdxl.denoisingStrength"),step:.01,min:0,max:1,onChange:r,handleReset:o,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0})})})},AA=l.memo(Ede),Mde=me([uP,da],(e,t)=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},Ie),Ode=()=>{const{t:e}=Q(),{shouldUseSliders:t,activeLabel:n}=H(Mde);return a.jsx(No,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(Eu,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{})]}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(Eu,{})]}),a.jsx(AA,{}),a.jsx(MA,{})]})})},Ade=l.memo(Ode),Rde=()=>a.jsxs(a.Fragment,{children:[a.jsx(J2,{}),a.jsx(Ade,{}),a.jsx(Z2,{}),a.jsx(Ju,{}),a.jsx(Xu,{}),a.jsx(Qu,{}),a.jsx(Yu,{})]}),Dde=l.memo(Rde),eC=()=>{const{t:e}=Q(),t=H(i=>i.generation.shouldRandomizeSeed),n=H(i=>i.generation.iterations),r=l.useMemo(()=>n===1?e("parameters.iterationsWithCount_one",{count:1}):e("parameters.iterationsWithCount_other",{count:n}),[n,e]),o=l.useMemo(()=>e(t?"parameters.randomSeed":"parameters.manualSeed"),[t,e]);return{iterationsAndSeedLabel:l.useMemo(()=>[r,o].join(", "),[r,o]),iterationsLabel:r,seedLabel:o}},Tde=()=>{const{t:e}=Q(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=eC();return a.jsx(No,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsx(N,{sx:{flexDirection:"column",gap:3},children:t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(Eu,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{})]}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(Eu,{})]})})})},RA=l.memo(Tde),Nde=()=>a.jsxs(a.Fragment,{children:[a.jsx(J2,{}),a.jsx(RA,{}),a.jsx(Z2,{}),a.jsx(Ju,{}),a.jsx(Xu,{}),a.jsx(Qu,{}),a.jsx(Yu,{})]}),$de=l.memo(Nde),Lde=()=>{const e=le(),t=H(s=>s.generation.canvasCoherenceMode),{t:n}=Q(),r=l.useMemo(()=>[{label:n("parameters.unmasked"),value:"unmasked"},{label:n("unifiedCanvas.mask"),value:"mask"},{label:n("parameters.maskEdge"),value:"edge"}],[n]),o=l.useCallback(s=>{s&&e(UT(s))},[e]);return a.jsx(kn,{feature:"compositingCoherenceMode",children:a.jsx(Dr,{label:n("parameters.coherenceMode"),data:r,value:t,onChange:o})})},zde=l.memo(Lde),Fde=()=>{const e=le(),t=H(s=>s.generation.canvasCoherenceSteps),{t:n}=Q(),r=l.useCallback(s=>{e(cS(s))},[e]),o=l.useCallback(()=>{e(cS(20))},[e]);return a.jsx(kn,{feature:"compositingCoherenceSteps",children:a.jsx(It,{label:n("parameters.coherenceSteps"),min:1,max:100,step:1,sliderNumberInputProps:{max:999},value:t,onChange:r,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:o})})},Bde=l.memo(Fde),Hde=()=>{const e=le(),t=H(s=>s.generation.canvasCoherenceStrength),{t:n}=Q(),r=l.useCallback(s=>{e(uS(s))},[e]),o=l.useCallback(()=>{e(uS(.3))},[e]);return a.jsx(kn,{feature:"compositingStrength",children:a.jsx(It,{label:n("parameters.coherenceStrength"),min:0,max:1,step:.01,sliderNumberInputProps:{max:999},value:t,onChange:r,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:o})})},Wde=l.memo(Hde);function Vde(){const e=le(),t=H(s=>s.generation.maskBlur),{t:n}=Q(),r=l.useCallback(s=>{e(dS(s))},[e]),o=l.useCallback(()=>{e(dS(16))},[e]);return a.jsx(kn,{feature:"compositingBlur",children:a.jsx(It,{label:n("parameters.maskBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:o})})}const Ude=[{label:"Box Blur",value:"box"},{label:"Gaussian Blur",value:"gaussian"}];function Gde(){const e=H(o=>o.generation.maskBlurMethod),t=le(),{t:n}=Q(),r=l.useCallback(o=>{o&&t(GT(o))},[t]);return a.jsx(kn,{feature:"compositingBlurMethod",children:a.jsx(Dr,{value:e,onChange:r,label:n("parameters.maskBlurMethod"),data:Ude})})}const qde=()=>{const{t:e}=Q();return a.jsx(No,{label:e("parameters.compositingSettingsHeader"),children:a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsxs(Mu,{label:e("parameters.coherencePassHeader"),children:[a.jsx(zde,{}),a.jsx(Bde,{}),a.jsx(Wde,{})]}),a.jsx(io,{}),a.jsxs(Mu,{label:e("parameters.maskAdjustmentsHeader"),children:[a.jsx(Vde,{}),a.jsx(Gde,{})]})]})})},DA=l.memo(qde),Kde=me([we],({generation:e})=>{const{infillMethod:t}=e;return{infillMethod:t}},Ie),Qde=()=>{const e=le(),{infillMethod:t}=H(Kde),{data:n,isLoading:r}=DI(),o=n==null?void 0:n.infill_methods,{t:s}=Q(),i=l.useCallback(c=>{e(qT(c))},[e]);return a.jsx(kn,{feature:"infillMethod",children:a.jsx(Dr,{disabled:(o==null?void 0:o.length)===0,placeholder:r?"Loading...":void 0,label:s("parameters.infillMethod"),value:t,data:o??[],onChange:i})})},Xde=l.memo(Qde),Yde=me([da],e=>{const{infillPatchmatchDownscaleSize:t,infillMethod:n}=e;return{infillPatchmatchDownscaleSize:t,infillMethod:n}},Ie),Jde=()=>{const e=le(),{infillPatchmatchDownscaleSize:t,infillMethod:n}=H(Yde),{t:r}=Q(),o=l.useCallback(i=>{e(fS(i))},[e]),s=l.useCallback(()=>{e(fS(2))},[e]);return a.jsx(It,{isDisabled:n!=="patchmatch",label:r("parameters.patchmatchDownScaleSize"),min:1,max:10,value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},Zde=l.memo(Jde),efe=me([da],e=>{const{infillTileSize:t,infillMethod:n}=e;return{infillTileSize:t,infillMethod:n}},Ie),tfe=()=>{const e=le(),{infillTileSize:t,infillMethod:n}=H(efe),{t:r}=Q(),o=l.useCallback(i=>{e(pS(i))},[e]),s=l.useCallback(()=>{e(pS(32))},[e]);return a.jsx(It,{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})},nfe=l.memo(tfe),rfe=me([da],e=>{const{infillMethod:t}=e;return{infillMethod:t}},Ie);function ofe(){const{infillMethod:e}=H(rfe);return a.jsxs(N,{children:[e==="tile"&&a.jsx(nfe,{}),e==="patchmatch"&&a.jsx(Zde,{})]})}const Ir=e=>e.canvas,Vs=me([we],({canvas:e})=>e.batchIds.length>0||e.layerState.stagingArea.images.length>0),sfe=me([Ir],e=>{const{boundingBoxScaleMethod:t}=e;return{boundingBoxScale:t}},Ie),afe=()=>{const e=le(),{boundingBoxScale:t}=H(sfe),{t:n}=Q(),r=l.useCallback(o=>{e(KT(o))},[e]);return a.jsx(kn,{feature:"scaleBeforeProcessing",children:a.jsx(sr,{label:n("parameters.scaleBeforeProcessing"),data:QT,value:t,onChange:r})})},ife=l.memo(afe),lfe=me([da,Ir],(e,t)=>{const{scaledBoundingBoxDimensions:n,boundingBoxScaleMethod:r}=t,{model:o,aspectRatio:s}=e;return{model:o,scaledBoundingBoxDimensions:n,isManual:r==="manual",aspectRatio:s}},Ie),cfe=()=>{const e=le(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=H(lfe),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Q(),c=l.useCallback(p=>{let h=r.width;const m=Math.floor(p);o&&(h=Ro(m*o,64)),e(Qh({width:h,height:m}))},[o,e,r.width]),d=l.useCallback(()=>{let p=r.width;const h=Math.floor(s);o&&(p=Ro(h*o,64)),e(Qh({width:p,height:h}))},[o,e,s,r.width]);return a.jsx(It,{isDisabled:!n,label:i("parameters.scaledHeight"),min:64,max:1536,step:64,value:r.height,onChange:c,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},ufe=l.memo(cfe),dfe=me([Ir,da],(e,t)=>{const{boundingBoxScaleMethod:n,scaledBoundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,scaledBoundingBoxDimensions:r,aspectRatio:s,isManual:n==="manual"}},Ie),ffe=()=>{const e=le(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=H(dfe),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Q(),c=l.useCallback(p=>{const h=Math.floor(p);let m=r.height;o&&(m=Ro(h/o,64)),e(Qh({width:h,height:m}))},[o,e,r.height]),d=l.useCallback(()=>{const p=Math.floor(s);let h=r.height;o&&(h=Ro(p/o,64)),e(Qh({width:p,height:h}))},[o,e,s,r.height]);return a.jsx(It,{isDisabled:!n,label:i("parameters.scaledWidth"),min:64,max:1536,step:64,value:r.width,onChange:c,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},pfe=l.memo(ffe),hfe=()=>{const{t:e}=Q();return a.jsx(No,{label:e("parameters.infillScalingHeader"),children:a.jsxs(N,{sx:{gap:2,flexDirection:"column"},children:[a.jsxs(Mu,{children:[a.jsx(Xde,{}),a.jsx(ofe,{})]}),a.jsx(io,{}),a.jsxs(Mu,{children:[a.jsx(ife,{}),a.jsx(pfe,{}),a.jsx(ufe,{})]})]})})},TA=l.memo(hfe),mfe=me([we,Vs],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},Ie),gfe=()=>{const e=le(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=H(mfe),{t:s}=Q(),i=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,c=l.useCallback(p=>{if(e(na({...n,height:Math.floor(p)})),o){const h=Ro(p*o,64);e(na({width:h,height:Math.floor(p)}))}},[o,n,e]),d=l.useCallback(()=>{if(e(na({...n,height:Math.floor(i)})),o){const p=Ro(i*o,64);e(na({width:p,height:Math.floor(i)}))}},[o,n,e,i]);return a.jsx(It,{label:s("parameters.boundingBoxHeight"),min:64,max:1536,step:64,value:n.height,onChange:c,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},vfe=l.memo(gfe),bfe=me([we,Vs],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},Ie),xfe=()=>{const e=le(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=H(bfe),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Q(),c=l.useCallback(p=>{if(e(na({...n,width:Math.floor(p)})),o){const h=Ro(p/o,64);e(na({width:Math.floor(p),height:h}))}},[o,n,e]),d=l.useCallback(()=>{if(e(na({...n,width:Math.floor(s)})),o){const p=Ro(s/o,64);e(na({width:Math.floor(s),height:p}))}},[o,n,e,s]);return a.jsx(It,{label:i("parameters.boundingBoxWidth"),min:64,max:1536,step:64,value:n.width,onChange:c,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},yfe=l.memo(xfe),Cfe=me([da,Ir],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r}=e,{boundingBoxDimensions:o}=t;return{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,boundingBoxDimensions:o}});function ug(){const e=le(),{t}=Q(),{shouldLockAspectRatio:n,boundingBoxDimensions:r}=H(Cfe),o=l.useCallback(()=>{n?(e(Zd(!1)),PA.includes(r.width/r.height)?e(Ys(r.width/r.height)):e(Ys(null))):(e(Zd(!0)),e(Ys(r.width/r.height)))},[n,r,e]),s=l.useCallback(()=>{e(XT()),e(Ys(null)),n&&e(Ys(r.height/r.width))},[e,n,r]);return a.jsxs(N,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.100",_dark:{bg:"base.750"}},children:[a.jsx(kn,{feature:"paramRatio",children:a.jsxs(Vn,{as:N,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(yr,{children:t("parameters.aspectRatio")}),a.jsx(Pi,{}),a.jsx(EA,{}),a.jsx(rt,{tooltip:t("ui.swapSizes"),"aria-label":t("ui.swapSizes"),size:"sm",icon:a.jsx(P8,{}),fontSize:20,onClick:s}),a.jsx(rt,{tooltip:t("ui.lockRatio"),"aria-label":t("ui.lockRatio"),size:"sm",icon:a.jsx(YM,{}),isChecked:n,onClick:o})]})}),a.jsx(yfe,{}),a.jsx(vfe,{})]})}const wfe=me(we,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},Ie),Sfe=()=>{const{t:e}=Q(),{shouldUseSliders:t,activeLabel:n}=H(wfe);return a.jsx(No,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(ug,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{})]}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(ug,{})]}),a.jsx(AA,{})]})})},kfe=l.memo(Sfe);function jfe(){return a.jsxs(a.Fragment,{children:[a.jsx(J2,{}),a.jsx(kfe,{}),a.jsx(Z2,{}),a.jsx(Ju,{}),a.jsx(Xu,{}),a.jsx(Qu,{}),a.jsx(TA,{}),a.jsx(DA,{}),a.jsx(Yu,{})]})}function tC(){return a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsx(jA,{}),a.jsx(kA,{})]})}function _fe(){const e=H(i=>i.generation.horizontalSymmetrySteps),t=H(i=>i.generation.steps),n=le(),{t:r}=Q(),o=l.useCallback(i=>{n(hS(i))},[n]),s=l.useCallback(()=>{n(hS(0))},[n]);return a.jsx(It,{label:r("parameters.hSymmetryStep"),value:e,onChange:o,min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})}function Ife(){const e=H(i=>i.generation.verticalSymmetrySteps),t=H(i=>i.generation.steps),n=le(),{t:r}=Q(),o=l.useCallback(i=>{n(mS(i))},[n]),s=l.useCallback(()=>{n(mS(0))},[n]);return a.jsx(It,{label:r("parameters.vSymmetryStep"),value:e,onChange:o,min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})}function Pfe(){const e=H(r=>r.generation.shouldUseSymmetry),t=le(),n=l.useCallback(r=>{t(YT(r.target.checked))},[t]);return a.jsx(_r,{label:"Enable Symmetry",isChecked:e,onChange:n})}const Efe=me(we,e=>({activeLabel:e.generation.shouldUseSymmetry?"Enabled":void 0}),Ie),Mfe=()=>{const{t:e}=Q(),{activeLabel:t}=H(Efe);return Pn("symmetry").isFeatureEnabled?a.jsx(No,{label:e("parameters.symmetry"),activeLabel:t,children:a.jsxs(N,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(Pfe,{}),a.jsx(_fe,{}),a.jsx(Ife,{})]})}):null},nC=l.memo(Mfe),Ofe=me([we],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:c,coarseStep:d}=n.sd.img2imgStrength,{img2imgStrength:p}=e,h=t.shift?c:d;return{img2imgStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:h}},Ie),Afe=()=>{const{img2imgStrength:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s}=H(Ofe),i=le(),{t:c}=Q(),d=l.useCallback(h=>i(Uh(h)),[i]),p=l.useCallback(()=>{i(Uh(t))},[i,t]);return a.jsx(kn,{feature:"paramDenoisingStrength",children:a.jsx(Mu,{children:a.jsx(It,{label:`${c("parameters.denoisingStrength")}`,step:s,min:n,max:r,onChange:d,handleReset:p,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,sliderNumberInputProps:{max:o}})})})},NA=l.memo(Afe),Rfe=()=>{const{t:e}=Q(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=eC();return a.jsx(No,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(Eu,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{})]}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(Eu,{})]}),a.jsx(NA,{}),a.jsx(MA,{})]})})},Dfe=l.memo(Rfe),Tfe=()=>a.jsxs(a.Fragment,{children:[a.jsx(tC,{}),a.jsx(Dfe,{}),a.jsx(Ju,{}),a.jsx(Xu,{}),a.jsx(Qu,{}),a.jsx(nC,{}),a.jsx(Yu,{})]}),Nfe=l.memo(Tfe),$fe=me([we],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:c,coarseStep:d}=n.sd.hrfStrength,{hrfStrength:p,hrfEnabled:h}=e,m=t.shift?c:d;return{hrfStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:m,hrfEnabled:h}},Ie),Lfe=()=>{const{hrfStrength:e,initial:t,min:n,sliderMax:r,step:o,hrfEnabled:s}=H($fe),i=le(),{t:c}=Q(),d=l.useCallback(()=>{i(Gh(t))},[i,t]),p=l.useCallback(h=>{i(Gh(h))},[i]);return a.jsx(Wn,{label:c("hrf.strengthTooltip"),placement:"right",hasArrow:!0,children:a.jsx(It,{label:c("parameters.denoisingStrength"),min:n,max:r,step:o,value:e,onChange:p,withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d,isDisabled:!s})})},zfe=l.memo(Lfe);function Ffe(){const e=le(),{t}=Q(),n=H(o=>o.generation.hrfEnabled),r=l.useCallback(o=>e(J1(o.target.checked)),[e]);return a.jsx(_r,{label:t("hrf.enableHrf"),isChecked:n,onChange:r,tooltip:t("hrf.enableHrfTooltip")})}const Bfe=me(we,({generation:e})=>{const{hrfMethod:t,hrfEnabled:n}=e;return{hrfMethod:t,hrfEnabled:n}},Ie),Hfe=["ESRGAN","bilinear"],Wfe=()=>{const e=le(),{t}=Q(),{hrfMethod:n,hrfEnabled:r}=H(Bfe),o=l.useCallback(s=>{s&&e(Z1(s))},[e]);return a.jsx(Dr,{label:t("hrf.upscaleMethod"),value:n,data:Hfe,onChange:o,disabled:!r})},Vfe=l.memo(Wfe),Ufe=me(we,e=>{const{hrfEnabled:t}=e.generation;return{hrfEnabled:t}},Ie);function Gfe(){const{t:e}=Q(),t=Pn("hrf").isFeatureEnabled,{hrfEnabled:n}=H(Ufe),r=l.useMemo(()=>{if(n)return e("common.on")},[e,n]);return t?a.jsx(No,{label:e("hrf.hrf"),activeLabel:r,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsx(Ffe,{}),a.jsx(zfe,{}),a.jsx(Vfe,{})]})}):null}const qfe=()=>a.jsxs(a.Fragment,{children:[a.jsx(tC,{}),a.jsx(RA,{}),a.jsx(Ju,{}),a.jsx(Xu,{}),a.jsx(Qu,{}),a.jsx(nC,{}),a.jsx(Gfe,{}),a.jsx(Yu,{})]}),Kfe=l.memo(qfe),Qfe=()=>{const{t:e}=Q(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=eC();return a.jsx(No,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(ug,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{})]}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(ug,{})]}),a.jsx(NA,{})]})})},Xfe=l.memo(Qfe),Yfe=()=>a.jsxs(a.Fragment,{children:[a.jsx(tC,{}),a.jsx(Xfe,{}),a.jsx(Ju,{}),a.jsx(Xu,{}),a.jsx(Qu,{}),a.jsx(nC,{}),a.jsx(TA,{}),a.jsx(DA,{}),a.jsx(Yu,{})]}),Jfe=l.memo(Yfe),Zfe=()=>{const e=H(lo),t=H(n=>n.generation.model);return e==="txt2img"?a.jsx(Fh,{children:t&&t.base_model==="sdxl"?a.jsx($de,{}):a.jsx(Kfe,{})}):e==="img2img"?a.jsx(Fh,{children:t&&t.base_model==="sdxl"?a.jsx(Dde,{}):a.jsx(Nfe,{})}):e==="unifiedCanvas"?a.jsx(Fh,{children:t&&t.base_model==="sdxl"?a.jsx(jfe,{}):a.jsx(Jfe,{})}):null},epe=l.memo(Zfe),Fh=l.memo(e=>a.jsxs(N,{sx:{w:"full",h:"full",flexDir:"column",gap:2},children:[a.jsx(z8,{}),a.jsx(N,{layerStyle:"first",sx:{w:"full",h:"full",position:"relative",borderRadius:"base",p:2},children:a.jsx(N,{sx:{w:"full",h:"full",position:"relative"},children:a.jsx(Le,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(v0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:800,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:a.jsx(N,{sx:{gap:2,flexDirection:"column",h:"full",w:"full"},children:e.children})})})})})]}));Fh.displayName="ParametersPanelWrapper";const tpe=me([we],e=>{const{initialImage:t}=e.generation;return{initialImage:t,isResetButtonDisabled:!t}},Ie),npe=()=>{const{initialImage:e}=H(tpe),{currentData:t}=Rs((e==null?void 0:e.imageName)??zs.skipToken),n=l.useMemo(()=>{if(t)return{id:"initial-image",payloadType:"IMAGE_DTO",payload:{imageDTO:t}}},[t]),r=l.useMemo(()=>({id:"initial-image",actionType:"SET_INITIAL_IMAGE"}),[]);return a.jsx(ll,{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"})},rpe=l.memo(npe),ope=me([we],e=>{const{initialImage:t}=e.generation;return{isResetButtonDisabled:!t}},Ie),spe={type:"SET_INITIAL_IMAGE"},ape=()=>{const{isResetButtonDisabled:e}=H(ope),t=le(),{getUploadButtonProps:n,getUploadInputProps:r}=D2({postUploadAction:spe}),o=l.useCallback(()=>{t(JT())},[t]);return a.jsxs(N,{layerStyle:"first",sx:{position:"relative",flexDirection:"column",height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",p:2,gap:4},children:[a.jsxs(N,{sx:{w:"full",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(je,{sx:{ps:2,fontWeight:600,userSelect:"none",color:"base.700",_dark:{color:"base.200"}},children:"Initial Image"}),a.jsx(Pi,{}),a.jsx(rt,{tooltip:"Upload Initial Image","aria-label":"Upload Initial Image",icon:a.jsx(i0,{}),...n()}),a.jsx(rt,{tooltip:"Reset Initial Image","aria-label":"Reset Initial Image",icon:a.jsx(a0,{}),onClick:o,isDisabled:e})]}),a.jsx(rpe,{}),a.jsx("input",{...r()})]})},ipe=l.memo(ape),lpe=e=>{const{onClick:t,isDisabled:n}=e,{t:r}=Q(),o=H(s=>s.system.isConnected);return a.jsx(rt,{onClick:t,icon:a.jsx(Zo,{}),tooltip:`${r("gallery.deleteImage")} (Del)`,"aria-label":`${r("gallery.deleteImage")} (Del)`,isDisabled:n||!o,colorScheme:"error"})},$A=()=>{const[e,{isLoading:t}]=bg({fixedCacheKey:"enqueueBatch"}),[n,{isLoading:r}]=rP({fixedCacheKey:"resumeProcessor"}),[o,{isLoading:s}]=tP({fixedCacheKey:"pauseProcessor"}),[i,{isLoading:c}]=Gx({fixedCacheKey:"cancelQueueItem"}),[d,{isLoading:p}]=eP({fixedCacheKey:"clearQueue"}),[h,{isLoading:m}]=pP({fixedCacheKey:"pruneQueue"});return t||r||s||c||p||m},cpe=[{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 upe(){const{t:e}=Q(),t=H(o=>o.postprocessing.esrganModelName),n=le(),r=l.useCallback(o=>n(ZT(o)),[n]);return a.jsx(Dr,{label:e("models.esrganModel"),value:t,itemComponent:pl,onChange:r,data:cpe})}const dpe=e=>{const{imageDTO:t}=e,n=le(),r=$A(),{t:o}=Q(),{isOpen:s,onOpen:i,onClose:c}=hs(),{isAllowedToUpscale:d,detail:p}=eN(t),h=l.useCallback(()=>{c(),!(!t||!d)&&n(hP({imageDTO:t}))},[n,t,d,c]);return a.jsx(tp,{isOpen:s,onClose:c,triggerComponent:a.jsx(rt,{tooltip:o("parameters.upscale"),onClick:i,icon:a.jsx(qM,{}),"aria-label":o("parameters.upscale")}),children:a.jsxs(N,{sx:{flexDirection:"column",gap:4},children:[a.jsx(upe,{}),a.jsx(Dt,{tooltip:p,size:"sm",isDisabled:!t||r||!d,onClick:h,children:o("parameters.upscaleImage")})]})})},fpe=l.memo(dpe),ppe=me([we,lo],({gallery:e,system:t,ui:n,config:r},o)=>{const{isConnected:s,shouldConfirmOnDelete:i,denoiseProgress:c}=t,{shouldShowImageDetails:d,shouldHidePreview:p,shouldShowProgressInViewer:h}=n,{shouldFetchMetadataFromApi:m}=r,g=e.selection[e.selection.length-1];return{shouldConfirmOnDelete:i,isConnected:s,shouldDisableToolbarButtons:!!(c!=null&&c.progress_image)||!g,shouldShowImageDetails:d,activeTabName:o,shouldHidePreview:p,shouldShowProgressInViewer:h,lastSelectedImage:g,shouldFetchMetadataFromApi:m}},{memoizeOptions:{resultEqualityCheck:Nn}}),hpe=()=>{const e=le(),{isConnected:t,shouldDisableToolbarButtons:n,shouldShowImageDetails:r,lastSelectedImage:o,shouldShowProgressInViewer:s}=H(ppe),i=Pn("upscaling").isFeatureEnabled,c=$A(),d=Zl(),{t:p}=Q(),{recallBothPrompts:h,recallSeed:m,recallAllParameters:g}=j0(),{currentData:b}=Rs((o==null?void 0:o.image_name)??zs.skipToken),{metadata:y,isLoading:x}=z2(o==null?void 0:o.image_name),{workflow:w,isLoading:S}=F2(o==null?void 0:o.workflow_id),j=l.useCallback(()=>{w&&e(Vx(w))},[e,w]),I=l.useCallback(()=>{g(y)},[y,g]);_t("a",I,[y]);const _=l.useCallback(()=>{m(y==null?void 0:y.seed)},[y==null?void 0:y.seed,m]);_t("s",_,[b]);const M=l.useCallback(()=>{h(y==null?void 0:y.positive_prompt,y==null?void 0:y.negative_prompt,y==null?void 0:y.positive_style_prompt,y==null?void 0:y.negative_style_prompt)},[y==null?void 0:y.negative_prompt,y==null?void 0:y.positive_prompt,y==null?void 0:y.positive_style_prompt,y==null?void 0:y.negative_style_prompt,h]);_t("p",M,[b]),_t("w",j,[w]);const E=l.useCallback(()=>{e(E8()),e(gg(b))},[e,b]);_t("shift+i",E,[b]);const A=l.useCallback(()=>{b&&e(hP({imageDTO:b}))},[e,b]),R=l.useCallback(()=>{b&&e(vg([b]))},[e,b]);_t("Shift+U",()=>{A()},{enabled:()=>!!(i&&!n&&t)},[i,b,n,t]);const D=l.useCallback(()=>e(tN(!r)),[e,r]);_t("i",()=>{b?D():d({title:p("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[b,r,d]),_t("delete",()=>{R()},[e,b]);const O=l.useCallback(()=>{e(TI(!s))},[e,s]);return a.jsx(a.Fragment,{children:a.jsxs(N,{sx:{flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(Hn,{isAttached:!0,isDisabled:n,children:a.jsxs(Mg,{isLazy:!0,children:[a.jsx(Og,{as:rt,"aria-label":p("parameters.imageActions"),tooltip:p("parameters.imageActions"),isDisabled:!b,icon:a.jsx(lse,{})}),a.jsx(ql,{motionProps:fu,children:b&&a.jsx(M8,{imageDTO:b})})]})}),a.jsxs(Hn,{isAttached:!0,isDisabled:n,children:[a.jsx(rt,{isLoading:S,icon:a.jsx(T2,{}),tooltip:`${p("nodes.loadWorkflow")} (W)`,"aria-label":`${p("nodes.loadWorkflow")} (W)`,isDisabled:!w,onClick:j}),a.jsx(rt,{isLoading:x,icon:a.jsx(ZM,{}),tooltip:`${p("parameters.usePrompt")} (P)`,"aria-label":`${p("parameters.usePrompt")} (P)`,isDisabled:!(y!=null&&y.positive_prompt),onClick:M}),a.jsx(rt,{isLoading:x,icon:a.jsx(eO,{}),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:_}),a.jsx(rt,{isLoading:x,icon:a.jsx(WM,{}),tooltip:`${p("parameters.useAll")} (A)`,"aria-label":`${p("parameters.useAll")} (A)`,isDisabled:!y,onClick:I})]}),i&&a.jsx(Hn,{isAttached:!0,isDisabled:c,children:i&&a.jsx(fpe,{imageDTO:b})}),a.jsx(Hn,{isAttached:!0,children:a.jsx(rt,{icon:a.jsx(UM,{}),tooltip:`${p("parameters.info")} (I)`,"aria-label":`${p("parameters.info")} (I)`,isChecked:r,onClick:D})}),a.jsx(Hn,{isAttached:!0,children:a.jsx(rt,{"aria-label":p("settings.displayInProgress"),tooltip:p("settings.displayInProgress"),icon:a.jsx($ee,{}),isChecked:s,onClick:O})}),a.jsx(Hn,{isAttached:!0,children:a.jsx(lpe,{onClick:R})})]})})},mpe=l.memo(hpe),gpe=me([we,Ux],(e,t)=>{var j,I;const{data:n,status:r}=nN.endpoints.listImages.select(t)(e),{data:o}=e.gallery.galleryView==="images"?gS.endpoints.getBoardImagesTotal.select(t.board_id??"none")(e):gS.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(e),s=e.gallery.selection[e.gallery.selection.length-1],i=r==="pending";if(!n||!s||(o==null?void 0:o.total)===0)return{isFetching:i,queryArgs:t,isOnFirstImage:!0,isOnLastImage:!0};const c={...t,offset:n.ids.length,limit:ZI},d=rN.getSelectors(),p=d.selectAll(n),h=p.findIndex(_=>_.image_name===s.image_name),m=Hl(h+1,0,p.length-1),g=Hl(h-1,0,p.length-1),b=(j=p[m])==null?void 0:j.image_name,y=(I=p[g])==null?void 0:I.image_name,x=b?d.selectById(n,b):void 0,w=y?d.selectById(n,y):void 0,S=p.length;return{loadedImagesCount:p.length,currentImageIndex:h,areMoreImagesAvailable:((o==null?void 0:o.total)??0)>S,isFetching:r==="pending",nextImage:x,prevImage:w,queryArgs:c}},{memoizeOptions:{resultEqualityCheck:Nn}}),LA=()=>{const e=le(),{nextImage:t,prevImage:n,areMoreImagesAvailable:r,isFetching:o,queryArgs:s,loadedImagesCount:i,currentImageIndex:c}=H(gpe),d=l.useCallback(()=>{n&&e(vS(n))},[e,n]),p=l.useCallback(()=>{t&&e(vS(t))},[e,t]),[h]=JI(),m=l.useCallback(()=>{h(s)},[h,s]);return{handlePrevImage:d,handleNextImage:p,isOnFirstImage:c===0,isOnLastImage:c!==void 0&&c===i-1,nextImage:t,prevImage:n,areMoreImagesAvailable:r,handleLoadMoreImages:m,isFetching:o}};function vpe(e){return Ye({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 bpe=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>{const{t:i}=Q(),c=l.useCallback(()=>navigator.clipboard.writeText(t.toString()),[t]);return t?a.jsxs(N,{gap:2,children:[n&&a.jsx(Wn,{label:`Recall ${e}`,children:a.jsx(Ia,{"aria-label":i("accessibility.useThisParameter"),icon:a.jsx(vpe,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&a.jsx(Wn,{label:`Copy ${e}`,children:a.jsx(Ia,{"aria-label":`Copy ${e}`,icon:a.jsx(Hu,{}),size:"xs",variant:"ghost",fontSize:14,onClick:c})}),a.jsxs(N,{direction:o?"column":"row",children:[a.jsxs(je,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?a.jsxs(Ig,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",a.jsx(BO,{mx:"2px"})]}):a.jsx(je,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}):null},Vr=l.memo(bpe),xpe=e=>{var F;const{metadata:t}=e,{t:n}=Q(),{recallPositivePrompt:r,recallNegativePrompt:o,recallSeed:s,recallCfgScale:i,recallModel:c,recallScheduler:d,recallVaeModel:p,recallSteps:h,recallWidth:m,recallHeight:g,recallStrength:b,recallHrfEnabled:y,recallHrfStrength:x,recallHrfMethod:w,recallLoRA:S,recallControlNet:j,recallIPAdapter:I,recallT2IAdapter:_}=j0(),M=l.useCallback(()=>{r(t==null?void 0:t.positive_prompt)},[t==null?void 0:t.positive_prompt,r]),E=l.useCallback(()=>{o(t==null?void 0:t.negative_prompt)},[t==null?void 0:t.negative_prompt,o]),A=l.useCallback(()=>{s(t==null?void 0:t.seed)},[t==null?void 0:t.seed,s]),R=l.useCallback(()=>{c(t==null?void 0:t.model)},[t==null?void 0:t.model,c]),D=l.useCallback(()=>{m(t==null?void 0:t.width)},[t==null?void 0:t.width,m]),O=l.useCallback(()=>{g(t==null?void 0:t.height)},[t==null?void 0:t.height,g]),T=l.useCallback(()=>{d(t==null?void 0:t.scheduler)},[t==null?void 0:t.scheduler,d]),K=l.useCallback(()=>{p(t==null?void 0:t.vae)},[t==null?void 0:t.vae,p]),G=l.useCallback(()=>{h(t==null?void 0:t.steps)},[t==null?void 0:t.steps,h]),X=l.useCallback(()=>{i(t==null?void 0:t.cfg_scale)},[t==null?void 0:t.cfg_scale,i]),Z=l.useCallback(()=>{b(t==null?void 0:t.strength)},[t==null?void 0:t.strength,b]),te=l.useCallback(()=>{y(t==null?void 0:t.hrf_enabled)},[t==null?void 0:t.hrf_enabled,y]),V=l.useCallback(()=>{x(t==null?void 0:t.hrf_strength)},[t==null?void 0:t.hrf_strength,x]),oe=l.useCallback(()=>{w(t==null?void 0:t.hrf_method)},[t==null?void 0:t.hrf_method,w]),ne=l.useCallback(q=>{S(q)},[S]),se=l.useCallback(q=>{j(q)},[j]),re=l.useCallback(q=>{I(q)},[I]),ae=l.useCallback(q=>{_(q)},[_]),B=l.useMemo(()=>t!=null&&t.controlnets?t.controlnets.filter(q=>qh(q.control_model)):[],[t==null?void 0:t.controlnets]),Y=l.useMemo(()=>t!=null&&t.ipAdapters?t.ipAdapters.filter(q=>qh(q.ip_adapter_model)):[],[t==null?void 0:t.ipAdapters]),$=l.useMemo(()=>t!=null&&t.t2iAdapters?t.t2iAdapters.filter(q=>oN(q.t2i_adapter_model)):[],[t==null?void 0:t.t2iAdapters]);return!t||Object.keys(t).length===0?null:(console.log(t),a.jsxs(a.Fragment,{children:[t.created_by&&a.jsx(Vr,{label:n("metadata.createdBy"),value:t.created_by}),t.generation_mode&&a.jsx(Vr,{label:n("metadata.generationMode"),value:t.generation_mode}),t.positive_prompt&&a.jsx(Vr,{label:n("metadata.positivePrompt"),labelPosition:"top",value:t.positive_prompt,onClick:M}),t.negative_prompt&&a.jsx(Vr,{label:n("metadata.negativePrompt"),labelPosition:"top",value:t.negative_prompt,onClick:E}),t.seed!==void 0&&t.seed!==null&&a.jsx(Vr,{label:n("metadata.seed"),value:t.seed,onClick:A}),t.model!==void 0&&t.model!==null&&t.model.model_name&&a.jsx(Vr,{label:n("metadata.model"),value:t.model.model_name,onClick:R}),t.width&&a.jsx(Vr,{label:n("metadata.width"),value:t.width,onClick:D}),t.height&&a.jsx(Vr,{label:n("metadata.height"),value:t.height,onClick:O}),t.scheduler&&a.jsx(Vr,{label:n("metadata.scheduler"),value:t.scheduler,onClick:T}),a.jsx(Vr,{label:n("metadata.vae"),value:((F=t.vae)==null?void 0:F.model_name)??"Default",onClick:K}),t.steps&&a.jsx(Vr,{label:n("metadata.steps"),value:t.steps,onClick:G}),t.cfg_scale!==void 0&&t.cfg_scale!==null&&a.jsx(Vr,{label:n("metadata.cfgScale"),value:t.cfg_scale,onClick:X}),t.strength&&a.jsx(Vr,{label:n("metadata.strength"),value:t.strength,onClick:Z}),t.hrf_enabled&&a.jsx(Vr,{label:n("hrf.metadata.enabled"),value:t.hrf_enabled,onClick:te}),t.hrf_enabled&&t.hrf_strength&&a.jsx(Vr,{label:n("hrf.metadata.strength"),value:t.hrf_strength,onClick:V}),t.hrf_enabled&&t.hrf_method&&a.jsx(Vr,{label:n("hrf.metadata.method"),value:t.hrf_method,onClick:oe}),t.loras&&t.loras.map((q,pe)=>{if(zI(q.lora))return a.jsx(Vr,{label:"LoRA",value:`${q.lora.model_name} - ${q.weight}`,onClick:ne.bind(null,q)},pe)}),B.map((q,pe)=>{var W;return a.jsx(Vr,{label:"ControlNet",value:`${(W=q.control_model)==null?void 0:W.model_name} - ${q.control_weight}`,onClick:se.bind(null,q)},pe)}),Y.map((q,pe)=>{var W;return a.jsx(Vr,{label:"IP Adapter",value:`${(W=q.ip_adapter_model)==null?void 0:W.model_name} - ${q.weight}`,onClick:re.bind(null,q)},pe)}),$.map((q,pe)=>{var W;return a.jsx(Vr,{label:"T2I Adapter",value:`${(W=q.t2i_adapter_model)==null?void 0:W.model_name} - ${q.weight}`,onClick:ae.bind(null,q)},pe)})]}))},ype=l.memo(xpe),Cpe=({image:e})=>{const{t}=Q(),{metadata:n}=z2(e.image_name),{workflow:r}=F2(e.workflow_id);return a.jsxs(N,{layerStyle:"first",sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",borderRadius:"base",position:"absolute",overflow:"hidden"},children:[a.jsxs(N,{gap:2,children:[a.jsx(je,{fontWeight:"semibold",children:"File:"}),a.jsxs(Ig,{href:e.image_url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.image_name,a.jsx(BO,{mx:"2px"})]})]}),a.jsxs(tc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(nc,{children:[a.jsx(wo,{children:t("metadata.recallParameters")}),a.jsx(wo,{children:t("metadata.metadata")}),a.jsx(wo,{children:t("metadata.imageDetails")}),a.jsx(wo,{children:t("metadata.workflow")})]}),a.jsxs($u,{children:[a.jsx(Go,{children:n?a.jsx(cc,{children:a.jsx(ype,{metadata:n})}):a.jsx(eo,{label:t("metadata.noRecallParameters")})}),a.jsx(Go,{children:n?a.jsx(tl,{data:n,label:t("metadata.metadata")}):a.jsx(eo,{label:t("metadata.noMetaData")})}),a.jsx(Go,{children:e?a.jsx(tl,{data:e,label:t("metadata.imageDetails")}):a.jsx(eo,{label:t("metadata.noImageDetails")})}),a.jsx(Go,{children:r?a.jsx(tl,{data:r,label:t("metadata.workflow")}):a.jsx(eo,{label:t("nodes.noWorkflow")})})]})]})]})},wpe=l.memo(Cpe),F1={color:"base.100",pointerEvents:"auto"},Spe=()=>{const{t:e}=Q(),{handlePrevImage:t,handleNextImage:n,isOnFirstImage:r,isOnLastImage:o,handleLoadMoreImages:s,areMoreImagesAvailable:i,isFetching:c}=LA();return a.jsxs(Le,{sx:{position:"relative",height:"100%",width:"100%"},children:[a.jsx(Le,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineStart:0},children:!r&&a.jsx(Ia,{"aria-label":e("accessibility.previousImage"),icon:a.jsx(bee,{size:64}),variant:"unstyled",onClick:t,boxSize:16,sx:F1})}),a.jsxs(Le,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineEnd:0},children:[!o&&a.jsx(Ia,{"aria-label":e("accessibility.nextImage"),icon:a.jsx(xee,{size:64}),variant:"unstyled",onClick:n,boxSize:16,sx:F1}),o&&i&&!c&&a.jsx(Ia,{"aria-label":e("accessibility.loadMore"),icon:a.jsx(vee,{size:64}),variant:"unstyled",onClick:s,boxSize:16,sx:F1}),o&&i&&c&&a.jsx(N,{sx:{w:16,h:16,alignItems:"center",justifyContent:"center"},children:a.jsx(Ci,{opacity:.5,size:"xl"})})]})]})},zA=l.memo(Spe),kpe=me([we,sN],({ui:e,system:t},n)=>{const{shouldShowImageDetails:r,shouldHidePreview:o,shouldShowProgressInViewer:s}=e,{denoiseProgress:i,shouldAntialiasProgressImage:c}=t;return{shouldShowImageDetails:r,shouldHidePreview:o,imageName:n==null?void 0:n.image_name,denoiseProgress:i,shouldShowProgressInViewer:s,shouldAntialiasProgressImage:c}},{memoizeOptions:{resultEqualityCheck:Nn}}),jpe=()=>{const{shouldShowImageDetails:e,imageName:t,denoiseProgress:n,shouldShowProgressInViewer:r,shouldAntialiasProgressImage:o}=H(kpe),{handlePrevImage:s,handleNextImage:i,isOnLastImage:c,handleLoadMoreImages:d,areMoreImagesAvailable:p,isFetching:h}=LA();_t("left",()=>{s()},[s]),_t("right",()=>{if(c&&p&&!h){d();return}c||i()},[c,p,d,h,i]);const{currentData:m}=Rs(t??zs.skipToken),g=l.useMemo(()=>{if(m)return{id:"current-image",payloadType:"IMAGE_DTO",payload:{imageDTO:m}}},[m]),b=l.useMemo(()=>({id:"current-image",actionType:"SET_CURRENT_IMAGE"}),[]),[y,x]=l.useState(!1),w=l.useRef(0),{t:S}=Q(),j=l.useCallback(()=>{x(!0),window.clearTimeout(w.current)},[]),I=l.useCallback(()=>{w.current=window.setTimeout(()=>{x(!1)},500)},[]);return a.jsxs(N,{onMouseOver:j,onMouseOut:I,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative"},children:[n!=null&&n.progress_image&&r?a.jsx(_i,{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(ll,{imageDTO:m,droppableData:b,draggableData:g,isUploadDisabled:!0,fitContainer:!0,useThumbailFallback:!0,dropLabel:S("gallery.setCurrentImage"),noContentFallback:a.jsx(eo,{icon:Xl,label:S("gallery.noImageSelected")}),dataTestId:"image-preview"}),e&&m&&a.jsx(Le,{sx:{position:"absolute",top:"0",width:"full",height:"full",borderRadius:"base"},children:a.jsx(wpe,{image:m})}),a.jsx(So,{children:!e&&m&&y&&a.jsx(Ar.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(zA,{})},"nextPrevButtons")})]})},_pe=l.memo(jpe),Ipe=()=>a.jsxs(N,{sx:{position:"relative",flexDirection:"column",height:"100%",width:"100%",rowGap:4,alignItems:"center",justifyContent:"center"},children:[a.jsx(mpe,{}),a.jsx(_pe,{})]}),Ppe=l.memo(Ipe),Epe=()=>a.jsx(Le,{layerStyle:"first",sx:{position:"relative",width:"100%",height:"100%",p:2,borderRadius:"base"},children:a.jsx(N,{sx:{width:"100%",height:"100%"},children:a.jsx(Ppe,{})})}),FA=l.memo(Epe),Mpe=()=>{const e=l.useRef(null),t=l.useCallback(()=>{e.current&&e.current.setLayout([50,50])},[]),n=G2();return a.jsx(Le,{sx:{w:"full",h:"full"},children:a.jsxs(E0,{ref:e,autoSaveId:"imageTab.content",direction:"horizontal",style:{height:"100%",width:"100%"},storage:n,units:"percentages",children:[a.jsx(el,{id:"imageTab.content.initImage",order:0,defaultSize:50,minSize:25,style:{position:"relative"},children:a.jsx(ipe,{})}),a.jsx(lg,{onDoubleClick:t}),a.jsx(el,{id:"imageTab.content.selectedImage",order:1,defaultSize:50,minSize:25,children:a.jsx(FA,{})})]})})},Ope=l.memo(Mpe);var Ape=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 F_=Sf(Ape);function xx(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 Rpe=Object.defineProperty,B_=Object.getOwnPropertySymbols,Dpe=Object.prototype.hasOwnProperty,Tpe=Object.prototype.propertyIsEnumerable,H_=(e,t,n)=>t in e?Rpe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Npe=(e,t)=>{for(var n in t||(t={}))Dpe.call(t,n)&&H_(e,n,t[n]);if(B_)for(var n of B_(t))Tpe.call(t,n)&&H_(e,n,t[n]);return e};function BA(e,t){if(t===null||typeof t!="object")return{};const n=Npe({},t);return Object.keys(t).forEach(r=>{r.includes(`${String(e)}.`)&&delete n[r]}),n}const $pe="__MANTINE_FORM_INDEX__";function W_(e,t){return t?typeof t=="boolean"?t:Array.isArray(t)?t.includes(e.replace(/[.][0-9]/g,`.${$pe}`)):!1:!1}function V_(e,t,n){typeof n.value=="object"&&(n.value=Qc(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function Qc(e){if(typeof e!="object")return e;var t=0,n,r,o,s=Object.prototype.toString.call(e);if(s==="[object Object]"?o=Object.create(e.__proto__||null):s==="[object Array]"?o=Array(e.length):s==="[object Set]"?(o=new Set,e.forEach(function(i){o.add(Qc(i))})):s==="[object Map]"?(o=new Map,e.forEach(function(i,c){o.set(Qc(c),Qc(i))})):s==="[object Date]"?o=new Date(+e):s==="[object RegExp]"?o=new RegExp(e.source,e.flags):s==="[object DataView]"?o=new e.constructor(Qc(e.buffer)):s==="[object ArrayBuffer]"?o=e.slice(0):s.slice(-6)==="Array]"&&(o=new e.constructor(e)),o){for(r=Object.getOwnPropertySymbols(e);t0,errors:t}}function yx(e,t,n="",r={}){return typeof e!="object"||e===null?r:Object.keys(e).reduce((o,s)=>{const i=e[s],c=`${n===""?"":`${n}.`}${s}`,d=ri(c,t);let p=!1;return typeof i=="function"&&(o[c]=i(d,t,c)),typeof i=="object"&&Array.isArray(d)&&(p=!0,d.forEach((h,m)=>yx(i,t,`${c}.${m}`,o))),typeof i=="object"&&typeof d=="object"&&d!==null&&(p||yx(i,t,c,o)),o},r)}function Cx(e,t){return U_(typeof e=="function"?e(t):yx(e,t))}function kh(e,t,n){if(typeof e!="string")return{hasError:!1,error:null};const r=Cx(t,n),o=Object.keys(r.errors).find(s=>e.split(".").every((i,c)=>i===s.split(".")[c]));return{hasError:!!o,error:o?r.errors[o]:null}}function Lpe(e,{from:t,to:n},r){const o=ri(e,r);if(!Array.isArray(o))return r;const s=[...o],i=o[t];return s.splice(t,1),s.splice(n,0,i),N0(e,s,r)}var zpe=Object.defineProperty,G_=Object.getOwnPropertySymbols,Fpe=Object.prototype.hasOwnProperty,Bpe=Object.prototype.propertyIsEnumerable,q_=(e,t,n)=>t in e?zpe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hpe=(e,t)=>{for(var n in t||(t={}))Fpe.call(t,n)&&q_(e,n,t[n]);if(G_)for(var n of G_(t))Bpe.call(t,n)&&q_(e,n,t[n]);return e};function Wpe(e,{from:t,to:n},r){const o=`${e}.${t}`,s=`${e}.${n}`,i=Hpe({},r);return Object.keys(r).every(c=>{let d,p;if(c.startsWith(o)&&(d=c,p=c.replace(o,s)),c.startsWith(s)&&(d=c.replace(s,o),p=c),d&&p){const h=i[d],m=i[p];return m===void 0?delete i[d]:i[d]=m,h===void 0?delete i[p]:i[p]=h,!1}return!0}),i}function Vpe(e,t,n){const r=ri(e,n);return Array.isArray(r)?N0(e,r.filter((o,s)=>s!==t),n):n}var Upe=Object.defineProperty,K_=Object.getOwnPropertySymbols,Gpe=Object.prototype.hasOwnProperty,qpe=Object.prototype.propertyIsEnumerable,Q_=(e,t,n)=>t in e?Upe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kpe=(e,t)=>{for(var n in t||(t={}))Gpe.call(t,n)&&Q_(e,n,t[n]);if(K_)for(var n of K_(t))qpe.call(t,n)&&Q_(e,n,t[n]);return e};function X_(e,t){const n=e.substring(t.length+1).split(".")[0];return parseInt(n,10)}function Y_(e,t,n,r){if(t===void 0)return n;const o=`${String(e)}`;let s=n;r===-1&&(s=BA(`${o}.${t}`,s));const i=Kpe({},s),c=new Set;return Object.entries(s).filter(([d])=>{if(!d.startsWith(`${o}.`))return!1;const p=X_(d,o);return Number.isNaN(p)?!1:p>=t}).forEach(([d,p])=>{const h=X_(d,o),m=d.replace(`${o}.${h}`,`${o}.${h+r}`);i[m]=p,c.add(m),c.has(d)||delete i[d]}),i}function Qpe(e,t,n,r){const o=ri(e,r);if(!Array.isArray(o))return r;const s=[...o];return s.splice(typeof n=="number"?n:s.length,0,t),N0(e,s,r)}function J_(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 Xpe(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 Ype=Object.defineProperty,Jpe=Object.defineProperties,Zpe=Object.getOwnPropertyDescriptors,Z_=Object.getOwnPropertySymbols,ehe=Object.prototype.hasOwnProperty,the=Object.prototype.propertyIsEnumerable,eI=(e,t,n)=>t in e?Ype(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wi=(e,t)=>{for(var n in t||(t={}))ehe.call(t,n)&&eI(e,n,t[n]);if(Z_)for(var n of Z_(t))the.call(t,n)&&eI(e,n,t[n]);return e},B1=(e,t)=>Jpe(e,Zpe(t));function uc({initialValues:e={},initialErrors:t={},initialDirty:n={},initialTouched:r={},clearInputErrorOnChange:o=!0,validateInputOnChange:s=!1,validateInputOnBlur:i=!1,transformValues:c=p=>p,validate:d}={}){const[p,h]=l.useState(r),[m,g]=l.useState(n),[b,y]=l.useState(e),[x,w]=l.useState(xx(t)),S=l.useRef(e),j=$=>{S.current=$},I=l.useCallback(()=>h({}),[]),_=$=>{const F=$?Wi(Wi({},b),$):b;j(F),g({})},M=l.useCallback($=>w(F=>xx(typeof $=="function"?$(F):$)),[]),E=l.useCallback(()=>w({}),[]),A=l.useCallback(()=>{y(e),E(),j(e),g({}),I()},[]),R=l.useCallback(($,F)=>M(q=>B1(Wi({},q),{[$]:F})),[]),D=l.useCallback($=>M(F=>{if(typeof $!="string")return F;const q=Wi({},F);return delete q[$],q}),[]),O=l.useCallback($=>g(F=>{if(typeof $!="string")return F;const q=BA($,F);return delete q[$],q}),[]),T=l.useCallback(($,F)=>{const q=W_($,s);O($),h(pe=>B1(Wi({},pe),{[$]:!0})),y(pe=>{const W=N0($,F,pe);if(q){const U=kh($,d,W);U.hasError?R($,U.error):D($)}return W}),!q&&o&&R($,null)},[]),K=l.useCallback($=>{y(F=>{const q=typeof $=="function"?$(F):$;return Wi(Wi({},F),q)}),o&&E()},[]),G=l.useCallback(($,F)=>{O($),y(q=>Lpe($,F,q)),w(q=>Wpe($,F,q))},[]),X=l.useCallback(($,F)=>{O($),y(q=>Vpe($,F,q)),w(q=>Y_($,F,q,-1))},[]),Z=l.useCallback(($,F,q)=>{O($),y(pe=>Qpe($,F,q,pe)),w(pe=>Y_($,q,pe,1))},[]),te=l.useCallback(()=>{const $=Cx(d,b);return w($.errors),$},[b,d]),V=l.useCallback($=>{const F=kh($,d,b);return F.hasError?R($,F.error):D($),F},[b,d]),oe=($,{type:F="input",withError:q=!0,withFocus:pe=!0}={})=>{const U={onChange:Xpe(ee=>T($,ee))};return q&&(U.error=x[$]),F==="checkbox"?U.checked=ri($,b):U.value=ri($,b),pe&&(U.onFocus=()=>h(ee=>B1(Wi({},ee),{[$]:!0})),U.onBlur=()=>{if(W_($,i)){const ee=kh($,d,b);ee.hasError?R($,ee.error):D($)}}),U},ne=($,F)=>q=>{q==null||q.preventDefault();const pe=te();pe.hasErrors?F==null||F(pe.errors,b,q):$==null||$(c(b),q)},se=$=>c($||b),re=l.useCallback($=>{$.preventDefault(),A()},[]),ae=$=>{if($){const q=ri($,m);if(typeof q=="boolean")return q;const pe=ri($,b),W=ri($,S.current);return!F_(pe,W)}return Object.keys(m).length>0?J_(m):!F_(b,S.current)},B=l.useCallback($=>J_(p,$),[p]),Y=l.useCallback($=>$?!kh($,d,b).hasError:!Cx(d,b).hasErrors,[b,d]);return{values:b,errors:x,setValues:K,setErrors:M,setFieldValue:T,setFieldError:R,clearFieldError:D,clearErrors:E,reset:A,validate:te,validateField:V,reorderListItem:G,removeListItem:X,insertListItem:Z,getInputProps:oe,onSubmit:ne,onReset:re,isDirty:ae,isTouched:B,setTouched:h,setDirty:g,resetTouched:I,resetDirty:_,isValid:Y,getTransformedValues:se}}function Or(e){const{...t}=e,{base50:n,base100:r,base200:o,base300:s,base800:i,base700:c,base900:d,accent500:p,accent300:h}=Jf(),{colorMode:m}=ji(),g=l.useCallback(()=>({input:{color:Xe(d,r)(m),backgroundColor:Xe(n,d)(m),borderColor:Xe(o,i)(m),borderWidth:2,outline:"none",":focus":{borderColor:Xe(h,p)(m)}},label:{color:Xe(c,s)(m),fontWeight:"normal",marginBottom:4}}),[h,p,r,o,s,n,c,i,d,m]);return a.jsx(RM,{styles:g,...t})}const nhe=[{value:"sd-1",label:xr["sd-1"]},{value:"sd-2",label:xr["sd-2"]},{value:"sdxl",label:xr.sdxl},{value:"sdxl-refiner",label:xr["sdxl-refiner"]}];function sp(e){const{...t}=e,{t:n}=Q();return a.jsx(Dr,{label:n("modelManager.baseModel"),data:nhe,...t})}function WA(e){const{data:t}=mP(),{...n}=e;return a.jsx(Dr,{label:"Config File",placeholder:"Select A Config File",data:t||[],...n})}const rhe=[{value:"normal",label:"Normal"},{value:"inpaint",label:"Inpaint"},{value:"depth",label:"Depth"}];function $0(e){const{...t}=e,{t:n}=Q();return a.jsx(Dr,{label:n("modelManager.variant"),data:rhe,...t})}function dg(e,t=!0){let n;t?n=new RegExp("[^\\\\/]+(?=\\.)"):n=new RegExp("[^\\\\/]+(?=[\\\\/]?$)");const r=e.match(n);return r?r[0]:""}function VA(e){const{t}=Q(),n=le(),{model_path:r}=e,o=uc({initialValues:{model_name:r?dg(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]=gP(),[i,c]=l.useState(!1),d=m=>{s({body:m}).unwrap().then(g=>{n(Ht(rr({title:t("modelManager.modelAdded",{modelName:m.model_name}),status:"success"}))),o.reset(),r&&n(Pf(null))}).catch(g=>{g&&n(Ht(rr({title:t("toast.modelAddFailed"),status:"error"})))})},p=l.useCallback(m=>{if(o.values.model_name===""){const g=dg(m.currentTarget.value);g&&o.setFieldValue("model_name",g)}},[o]),h=l.useCallback(()=>c(m=>!m),[]);return a.jsx("form",{onSubmit:o.onSubmit(m=>d(m)),style:{width:"100%"},children:a.jsxs(N,{flexDirection:"column",gap:2,children:[a.jsx(Or,{label:t("modelManager.model"),required:!0,...o.getInputProps("model_name")}),a.jsx(sp,{label:t("modelManager.baseModel"),...o.getInputProps("base_model")}),a.jsx(Or,{label:t("modelManager.modelLocation"),required:!0,...o.getInputProps("path"),onBlur:p}),a.jsx(Or,{label:t("modelManager.description"),...o.getInputProps("description")}),a.jsx(Or,{label:t("modelManager.vaeLocation"),...o.getInputProps("vae")}),a.jsx($0,{label:t("modelManager.variant"),...o.getInputProps("variant")}),a.jsxs(N,{flexDirection:"column",width:"100%",gap:2,children:[i?a.jsx(Or,{required:!0,label:t("modelManager.customConfigFileLocation"),...o.getInputProps("config")}):a.jsx(WA,{required:!0,width:"100%",...o.getInputProps("config")}),a.jsx(Eo,{isChecked:i,onChange:h,label:t("modelManager.useCustomConfig")}),a.jsx(Dt,{mt:2,type:"submit",children:t("modelManager.addModel")})]})]})})}function UA(e){const{t}=Q(),n=le(),{model_path:r}=e,[o]=gP(),s=uc({initialValues:{model_name:r?dg(r,!1):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"diffusers",error:void 0,vae:"",variant:"normal"}}),i=d=>{o({body:d}).unwrap().then(p=>{n(Ht(rr({title:t("modelManager.modelAdded",{modelName:d.model_name}),status:"success"}))),s.reset(),r&&n(Pf(null))}).catch(p=>{p&&n(Ht(rr({title:t("toast.modelAddFailed"),status:"error"})))})},c=l.useCallback(d=>{if(s.values.model_name===""){const p=dg(d.currentTarget.value,!1);p&&s.setFieldValue("model_name",p)}},[s]);return a.jsx("form",{onSubmit:s.onSubmit(d=>i(d)),style:{width:"100%"},children:a.jsxs(N,{flexDirection:"column",gap:2,children:[a.jsx(Or,{required:!0,label:t("modelManager.model"),...s.getInputProps("model_name")}),a.jsx(sp,{label:t("modelManager.baseModel"),...s.getInputProps("base_model")}),a.jsx(Or,{required:!0,label:t("modelManager.modelLocation"),placeholder:t("modelManager.modelLocationValidationMsg"),...s.getInputProps("path"),onBlur:c}),a.jsx(Or,{label:t("modelManager.description"),...s.getInputProps("description")}),a.jsx(Or,{label:t("modelManager.vaeLocation"),...s.getInputProps("vae")}),a.jsx($0,{label:t("modelManager.variant"),...s.getInputProps("variant")}),a.jsx(Dt,{mt:2,type:"submit",children:t("modelManager.addModel")})]})})}function ohe(){const[e,t]=l.useState("diffusers"),{t:n}=Q(),r=l.useCallback(s=>{s&&t(s)},[]),o=l.useMemo(()=>[{label:n("modelManager.diffusersModels"),value:"diffusers"},{label:n("modelManager.checkpointOrSafetensors"),value:"checkpoint"}],[n]);return a.jsxs(N,{flexDirection:"column",gap:4,width:"100%",children:[a.jsx(Dr,{label:n("modelManager.modelType"),value:e,data:o,onChange:r}),a.jsxs(N,{sx:{p:4,borderRadius:4,bg:"base.300",_dark:{bg:"base.850"}},children:[e==="diffusers"&&a.jsx(UA,{}),e==="checkpoint"&&a.jsx(VA,{})]})]})}const she=[{label:"None",value:"none"},{label:"v_prediction",value:"v_prediction"},{label:"epsilon",value:"epsilon"},{label:"sample",value:"sample"}];function ahe(){const e=le(),{t}=Q(),[n,{isLoading:r}]=vP(),o=uc({initialValues:{location:"",prediction_type:void 0}}),s=i=>{const c={location:i.location,prediction_type:i.prediction_type==="none"?void 0:i.prediction_type};n({body:c}).unwrap().then(d=>{e(Ht(rr({title:t("toast.modelAddedSimple"),status:"success"}))),o.reset()}).catch(d=>{d&&e(Ht(rr({title:`${d.data.detail} `,status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(i=>s(i)),style:{width:"100%"},children:a.jsxs(N,{flexDirection:"column",width:"100%",gap:4,children:[a.jsx(Or,{label:t("modelManager.modelLocation"),placeholder:t("modelManager.simpleModelDesc"),w:"100%",...o.getInputProps("location")}),a.jsx(Dr,{label:t("modelManager.predictionType"),data:she,defaultValue:"none",...o.getInputProps("prediction_type")}),a.jsx(Dt,{type:"submit",isLoading:r,children:t("modelManager.addModel")})]})})}function ihe(){const{t:e}=Q(),[t,n]=l.useState("simple"),r=l.useCallback(()=>n("simple"),[]),o=l.useCallback(()=>n("advanced"),[]);return a.jsxs(N,{flexDirection:"column",width:"100%",overflow:"scroll",maxHeight:window.innerHeight-250,gap:4,children:[a.jsxs(Hn,{isAttached:!0,children:[a.jsx(Dt,{size:"sm",isChecked:t=="simple",onClick:r,children:e("common.simple")}),a.jsx(Dt,{size:"sm",isChecked:t=="advanced",onClick:o,children:e("common.advanced")})]}),a.jsxs(N,{sx:{p:4,borderRadius:4,background:"base.200",_dark:{background:"base.800"}},children:[t==="simple"&&a.jsx(ahe,{}),t==="advanced"&&a.jsx(ohe,{})]})]})}function lhe(e){const{...t}=e;return a.jsx(jE,{w:"100%",...t,children:e.children})}function che(){const e=H(w=>w.modelmanager.searchFolder),[t,n]=l.useState(""),{data:r}=aa(Al),{foundModels:o,alreadyInstalled:s,filteredModels:i}=bP({search_path:e||""},{selectFromResult:({data:w})=>{const S=_$(r==null?void 0:r.entities),j=To(S,"path"),I=C$(w,j),_=O$(w,j);return{foundModels:w,alreadyInstalled:tI(_,t),filteredModels:tI(I,t)}}}),[c,{isLoading:d}]=vP(),p=le(),{t:h}=Q(),m=l.useCallback(w=>{const S=w.currentTarget.id.split("\\").splice(-1)[0];c({body:{location:w.currentTarget.id}}).unwrap().then(j=>{p(Ht(rr({title:`Added Model: ${S}`,status:"success"})))}).catch(j=>{j&&p(Ht(rr({title:h("toast.modelAddFailed"),status:"error"})))})},[p,c,h]),g=l.useCallback(w=>{n(w.target.value)},[]),b=l.useCallback(w=>p(Pf(w)),[p]),y=({models:w,showActions:S=!0})=>w.map(j=>a.jsxs(N,{sx:{p:4,gap:4,alignItems:"center",borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(N,{w:"100%",sx:{flexDirection:"column",minW:"25%"},children:[a.jsx(je,{sx:{fontWeight:600},children:j.split("\\").slice(-1)[0]}),a.jsx(je,{sx:{fontSize:"sm",color:"base.600",_dark:{color:"base.400"}},children:j})]}),S?a.jsxs(N,{gap:2,children:[a.jsx(Dt,{id:j,onClick:m,isLoading:d,children:h("modelManager.quickAdd")}),a.jsx(Dt,{onClick:b.bind(null,j),isLoading:d,children:h("modelManager.advanced")})]}):a.jsx(je,{sx:{fontWeight:600,p:2,borderRadius:4,color:"accent.50",bg:"accent.400",_dark:{color:"accent.100",bg:"accent.600"}},children:"Installed"})]},j));return(()=>e?!o||o.length===0?a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",height:96,userSelect:"none",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(je,{variant:"subtext",children:h("modelManager.noModels")})}):a.jsxs(N,{sx:{flexDirection:"column",gap:2,w:"100%",minW:"50%"},children:[a.jsx(Is,{onChange:g,label:h("modelManager.search"),labelPos:"side"}),a.jsxs(N,{p:2,gap:2,children:[a.jsxs(je,{sx:{fontWeight:600},children:["Models Found: ",o.length]}),a.jsxs(je,{sx:{fontWeight:600,color:"accent.500",_dark:{color:"accent.200"}},children:["Not Installed: ",i.length]})]}),a.jsx(lhe,{offsetScrollbars:!0,children:a.jsxs(N,{gap:2,flexDirection:"column",children:[y({models:i}),y({models:s,showActions:!1})]})})]}):null)()}const tI=(e,t)=>{const n=[];return to(e,r=>{if(!r)return null;r.includes(t)&&n.push(r)}),n};function uhe(){const e=H(h=>h.modelmanager.advancedAddScanModel),{t}=Q(),n=l.useMemo(()=>[{label:t("modelManager.diffusersModels"),value:"diffusers"},{label:t("modelManager.checkpointOrSafetensors"),value:"checkpoint"}],[t]),[r,o]=l.useState("diffusers"),[s,i]=l.useState(!0);l.useEffect(()=>{e&&[".ckpt",".safetensors",".pth",".pt"].some(h=>e.endsWith(h))?o("checkpoint"):o("diffusers")},[e,o,s]);const c=le(),d=l.useCallback(()=>c(Pf(null)),[c]),p=l.useCallback(h=>{h&&(o(h),i(h==="checkpoint"))},[]);return e?a.jsxs(Le,{as:Ar.div,initial:{x:-100,opacity:0},animate:{x:0,opacity:1,transition:{duration:.2}},sx:{display:"flex",flexDirection:"column",minWidth:"40%",maxHeight:window.innerHeight-300,overflow:"scroll",p:4,gap:4,borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(N,{justifyContent:"space-between",alignItems:"center",children:[a.jsx(je,{size:"xl",fontWeight:600,children:s||r==="checkpoint"?"Add Checkpoint Model":"Add Diffusers Model"}),a.jsx(rt,{icon:a.jsx(ku,{}),"aria-label":t("modelManager.closeAdvanced"),onClick:d,size:"sm"})]}),a.jsx(Dr,{label:t("modelManager.modelType"),value:r,data:n,onChange:p}),s?a.jsx(VA,{model_path:e},e):a.jsx(UA,{model_path:e},e)]}):null}function dhe(){const e=le(),{t}=Q(),n=H(d=>d.modelmanager.searchFolder),{refetch:r}=bP({search_path:n||""}),o=uc({initialValues:{folder:""}}),s=l.useCallback(d=>{e(bS(d.folder))},[e]),i=l.useCallback(()=>{r()},[r]),c=l.useCallback(()=>{e(bS(null)),e(Pf(null))},[e]);return a.jsx("form",{onSubmit:o.onSubmit(d=>s(d)),style:{width:"100%"},children:a.jsxs(N,{sx:{w:"100%",gap:2,borderRadius:4,alignItems:"center"},children:[a.jsxs(N,{w:"100%",alignItems:"center",gap:4,minH:12,children:[a.jsx(je,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",minW:"max-content",_dark:{color:"base.300"}},children:"Folder"}),n?a.jsx(N,{sx:{w:"100%",p:2,px:4,bg:"base.300",borderRadius:4,fontSize:"sm",fontWeight:"bold",_dark:{bg:"base.700"}},children:n}):a.jsx(Is,{w:"100%",size:"md",...o.getInputProps("folder")})]}),a.jsxs(N,{gap:2,children:[n?a.jsx(rt,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:a.jsx(s0,{}),onClick:i,fontSize:18,size:"sm"}):a.jsx(rt,{"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),icon:a.jsx(Qee,{}),fontSize:18,size:"sm",type:"submit"}),a.jsx(rt,{"aria-label":t("modelManager.clearCheckpointFolder"),tooltip:t("modelManager.clearCheckpointFolder"),icon:a.jsx(Zo,{}),size:"sm",onClick:c,isDisabled:!n,colorScheme:"red"})]})]})})}const fhe=l.memo(dhe);function phe(){return a.jsxs(N,{flexDirection:"column",w:"100%",gap:4,children:[a.jsx(fhe,{}),a.jsxs(N,{gap:4,children:[a.jsx(N,{sx:{maxHeight:window.innerHeight-300,overflow:"scroll",gap:4,w:"100%"},children:a.jsx(che,{})}),a.jsx(uhe,{})]})]})}function hhe(){const[e,t]=l.useState("add"),{t:n}=Q(),r=l.useCallback(()=>t("add"),[]),o=l.useCallback(()=>t("scan"),[]);return a.jsxs(N,{flexDirection:"column",gap:4,children:[a.jsxs(Hn,{isAttached:!0,children:[a.jsx(Dt,{onClick:r,isChecked:e=="add",size:"sm",width:"100%",children:n("modelManager.addModel")}),a.jsx(Dt,{onClick:o,isChecked:e=="scan",size:"sm",width:"100%",children:n("modelManager.scanForModels")})]}),e=="add"&&a.jsx(ihe,{}),e=="scan"&&a.jsx(phe,{})]})}const mhe=[{label:"Stable Diffusion 1",value:"sd-1"},{label:"Stable Diffusion 2",value:"sd-2"}];function ghe(){var q,pe;const{t:e}=Q(),t=le(),{data:n}=aa(Al),[r,{isLoading:o}]=aN(),[s,i]=l.useState("sd-1"),c=OS(n==null?void 0:n.entities,(W,U)=>(W==null?void 0:W.model_format)==="diffusers"&&(W==null?void 0:W.base_model)==="sd-1"),d=OS(n==null?void 0:n.entities,(W,U)=>(W==null?void 0:W.model_format)==="diffusers"&&(W==null?void 0:W.base_model)==="sd-2"),p=l.useMemo(()=>({"sd-1":c,"sd-2":d}),[c,d]),[h,m]=l.useState(((q=Object.keys(p[s]))==null?void 0:q[0])??null),[g,b]=l.useState(((pe=Object.keys(p[s]))==null?void 0:pe[1])??null),[y,x]=l.useState(null),[w,S]=l.useState(""),[j,I]=l.useState(.5),[_,M]=l.useState("weighted_sum"),[E,A]=l.useState("root"),[R,D]=l.useState(""),[O,T]=l.useState(!1),K=Object.keys(p[s]).filter(W=>W!==g&&W!==y),G=Object.keys(p[s]).filter(W=>W!==h&&W!==y),X=Object.keys(p[s]).filter(W=>W!==h&&W!==g),Z=l.useCallback(W=>{i(W),m(null),b(null)},[]),te=l.useCallback(W=>{m(W)},[]),V=l.useCallback(W=>{b(W)},[]),oe=l.useCallback(W=>{W?(x(W),M("weighted_sum")):(x(null),M("add_difference"))},[]),ne=l.useCallback(W=>S(W.target.value),[]),se=l.useCallback(W=>I(W),[]),re=l.useCallback(()=>I(.5),[]),ae=l.useCallback(W=>M(W),[]),B=l.useCallback(W=>A(W),[]),Y=l.useCallback(W=>D(W.target.value),[]),$=l.useCallback(W=>T(W.target.checked),[]),F=l.useCallback(()=>{const W=[];let U=[h,g,y];U=U.filter(J=>J!==null),U.forEach(J=>{var he;const ge=(he=J==null?void 0:J.split("/"))==null?void 0:he[2];ge&&W.push(ge)});const ee={model_names:W,merged_model_name:w!==""?w:W.join("-"),alpha:j,interp:_,force:O,merge_dest_directory:E==="root"?void 0:R};r({base_model:s,body:{body:ee}}).unwrap().then(J=>{t(Ht(rr({title:e("modelManager.modelsMerged"),status:"success"})))}).catch(J=>{J&&t(Ht(rr({title:e("modelManager.modelsMergeFailed"),status:"error"})))})},[s,t,r,w,j,R,O,_,E,h,y,g,e]);return a.jsxs(N,{flexDirection:"column",rowGap:4,children:[a.jsxs(N,{sx:{flexDirection:"column",rowGap:1},children:[a.jsx(je,{children:e("modelManager.modelMergeHeaderHelp1")}),a.jsx(je,{fontSize:"sm",variant:"subtext",children:e("modelManager.modelMergeHeaderHelp2")})]}),a.jsxs(N,{columnGap:4,children:[a.jsx(Dr,{label:e("modelManager.modelType"),w:"100%",data:mhe,value:s,onChange:Z}),a.jsx(sr,{label:e("modelManager.modelOne"),w:"100%",value:h,placeholder:e("modelManager.selectModel"),data:K,onChange:te}),a.jsx(sr,{label:e("modelManager.modelTwo"),w:"100%",placeholder:e("modelManager.selectModel"),value:g,data:G,onChange:V}),a.jsx(sr,{label:e("modelManager.modelThree"),data:X,w:"100%",placeholder:e("modelManager.selectModel"),clearable:!0,onChange:oe})]}),a.jsx(Is,{label:e("modelManager.mergedModelName"),value:w,onChange:ne}),a.jsxs(N,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(It,{label:e("modelManager.alpha"),min:.01,max:.99,step:.01,value:j,onChange:se,withInput:!0,withReset:!0,handleReset:re,withSliderMarks:!0}),a.jsx(je,{variant:"subtext",fontSize:"sm",children:e("modelManager.modelMergeAlphaHelp")})]}),a.jsxs(N,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(je,{fontWeight:500,fontSize:"sm",variant:"subtext",children:e("modelManager.interpolationType")}),a.jsx(om,{value:_,onChange:ae,children:a.jsx(N,{columnGap:4,children:y===null?a.jsxs(a.Fragment,{children:[a.jsx(ei,{value:"weighted_sum",children:a.jsx(je,{fontSize:"sm",children:e("modelManager.weightedSum")})}),a.jsx(ei,{value:"sigmoid",children:a.jsx(je,{fontSize:"sm",children:e("modelManager.sigmoid")})}),a.jsx(ei,{value:"inv_sigmoid",children:a.jsx(je,{fontSize:"sm",children:e("modelManager.inverseSigmoid")})})]}):a.jsx(ei,{value:"add_difference",children:a.jsx(Wn,{label:e("modelManager.modelMergeInterpAddDifferenceHelp"),children:a.jsx(je,{fontSize:"sm",children:e("modelManager.addDifference")})})})})})]}),a.jsxs(N,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.900"}},children:[a.jsxs(N,{columnGap:4,children:[a.jsx(je,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:e("modelManager.mergedModelSaveLocation")}),a.jsx(om,{value:E,onChange:B,children:a.jsxs(N,{columnGap:4,children:[a.jsx(ei,{value:"root",children:a.jsx(je,{fontSize:"sm",children:e("modelManager.invokeAIFolder")})}),a.jsx(ei,{value:"custom",children:a.jsx(je,{fontSize:"sm",children:e("modelManager.custom")})})]})})]}),E==="custom"&&a.jsx(Is,{label:e("modelManager.mergedModelCustomSaveLocation"),value:R,onChange:Y})]}),a.jsx(Eo,{label:e("modelManager.ignoreMismatch"),isChecked:O,onChange:$,fontWeight:"500"}),a.jsx(Dt,{onClick:F,isLoading:o,isDisabled:h===null||g===null,children:e("modelManager.merge")})]})}function vhe(e){const{model:t}=e,n=le(),{t:r}=Q(),[o,{isLoading:s}]=iN(),[i,c]=l.useState("InvokeAIRoot"),[d,p]=l.useState("");l.useEffect(()=>{c("InvokeAIRoot")},[t]);const h=l.useCallback(()=>{c("InvokeAIRoot")},[]),m=l.useCallback(y=>{c(y)},[]),g=l.useCallback(y=>{p(y.target.value)},[]),b=l.useCallback(()=>{const y={base_model:t.base_model,model_name:t.model_name,convert_dest_directory:i==="Custom"?d:void 0};if(i==="Custom"&&d===""){n(Ht(rr({title:r("modelManager.noCustomLocationProvided"),status:"error"})));return}n(Ht(rr({title:`${r("modelManager.convertingModelBegin")}: ${t.model_name}`,status:"info"}))),o(y).unwrap().then(()=>{n(Ht(rr({title:`${r("modelManager.modelConverted")}: ${t.model_name}`,status:"success"})))}).catch(()=>{n(Ht(rr({title:`${r("modelManager.modelConversionFailed")}: ${t.model_name}`,status:"error"})))})},[o,d,n,t.base_model,t.model_name,i,r]);return a.jsxs(_0,{title:`${r("modelManager.convert")} ${t.model_name}`,acceptCallback:b,cancelCallback:h,acceptButtonText:`${r("modelManager.convert")}`,triggerComponent:a.jsxs(Dt,{size:"sm","aria-label":r("modelManager.convertToDiffusers"),className:" modal-close-btn",isLoading:s,children:["🧨 ",r("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[a.jsxs(N,{flexDirection:"column",rowGap:4,children:[a.jsx(je,{children:r("modelManager.convertToDiffusersHelpText1")}),a.jsxs(zf,{children:[a.jsx(Ps,{children:r("modelManager.convertToDiffusersHelpText2")}),a.jsx(Ps,{children:r("modelManager.convertToDiffusersHelpText3")}),a.jsx(Ps,{children:r("modelManager.convertToDiffusersHelpText4")}),a.jsx(Ps,{children:r("modelManager.convertToDiffusersHelpText5")})]}),a.jsx(je,{children:r("modelManager.convertToDiffusersHelpText6")})]}),a.jsxs(N,{flexDir:"column",gap:2,children:[a.jsxs(N,{marginTop:4,flexDir:"column",gap:2,children:[a.jsx(je,{fontWeight:"600",children:r("modelManager.convertToDiffusersSaveLocation")}),a.jsx(om,{value:i,onChange:m,children:a.jsxs(N,{gap:4,children:[a.jsx(ei,{value:"InvokeAIRoot",children:a.jsx(Wn,{label:"Save converted model in the InvokeAI root folder",children:r("modelManager.invokeRoot")})}),a.jsx(ei,{value:"Custom",children:a.jsx(Wn,{label:"Save converted model in a custom folder",children:r("modelManager.custom")})})]})})]}),i==="Custom"&&a.jsxs(N,{flexDirection:"column",rowGap:2,children:[a.jsx(je,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:r("modelManager.customSaveLocation")}),a.jsx(Is,{value:d,onChange:g,width:"full"})]})]})]})}function bhe(e){const{model:t}=e,[n,{isLoading:r}]=xP(),{data:o}=mP(),[s,i]=l.useState(!1);l.useEffect(()=>{o!=null&&o.includes(t.config)||i(!0)},[o,t.config]);const c=le(),{t:d}=Q(),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:g=>g.trim().length===0?"Must provide a path":null}}),h=l.useCallback(()=>i(g=>!g),[]),m=l.useCallback(g=>{const b={base_model:t.base_model,model_name:t.model_name,body:g};n(b).unwrap().then(y=>{p.setValues(y),c(Ht(rr({title:d("modelManager.modelUpdated"),status:"success"})))}).catch(y=>{p.reset(),c(Ht(rr({title:d("modelManager.modelUpdateFailed"),status:"error"})))})},[p,c,t.base_model,t.model_name,d,n]);return a.jsxs(N,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(N,{justifyContent:"space-between",alignItems:"center",children:[a.jsxs(N,{flexDirection:"column",children:[a.jsx(je,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(je,{fontSize:"sm",color:"base.400",children:[xr[t.base_model]," Model"]})]}),[""].includes(t.base_model)?a.jsx(Va,{sx:{p:2,borderRadius:4,bg:"error.200",_dark:{bg:"error.400"}},children:"Conversion Not Supported"}):a.jsx(vhe,{model:t})]}),a.jsx(io,{}),a.jsx(N,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",children:a.jsx("form",{onSubmit:p.onSubmit(g=>m(g)),children:a.jsxs(N,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Or,{label:d("modelManager.name"),...p.getInputProps("model_name")}),a.jsx(Or,{label:d("modelManager.description"),...p.getInputProps("description")}),a.jsx(sp,{required:!0,...p.getInputProps("base_model")}),a.jsx($0,{required:!0,...p.getInputProps("variant")}),a.jsx(Or,{required:!0,label:d("modelManager.modelLocation"),...p.getInputProps("path")}),a.jsx(Or,{label:d("modelManager.vaeLocation"),...p.getInputProps("vae")}),a.jsxs(N,{flexDirection:"column",gap:2,children:[s?a.jsx(Or,{required:!0,label:d("modelManager.config"),...p.getInputProps("config")}):a.jsx(WA,{required:!0,...p.getInputProps("config")}),a.jsx(Eo,{isChecked:s,onChange:h,label:"Use Custom Config"})]}),a.jsx(Dt,{type:"submit",isLoading:r,children:d("modelManager.updateModel")})]})})})]})}function xhe(e){const{model:t}=e,[n,{isLoading:r}]=xP(),o=le(),{t:s}=Q(),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:d=>d.trim().length===0?"Must provide a path":null}}),c=l.useCallback(d=>{const p={base_model:t.base_model,model_name:t.model_name,body:d};n(p).unwrap().then(h=>{i.setValues(h),o(Ht(rr({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(h=>{i.reset(),o(Ht(rr({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[i,o,t.base_model,t.model_name,s,n]);return a.jsxs(N,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(N,{flexDirection:"column",children:[a.jsx(je,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(je,{fontSize:"sm",color:"base.400",children:[xr[t.base_model]," Model"]})]}),a.jsx(io,{}),a.jsx("form",{onSubmit:i.onSubmit(d=>c(d)),children:a.jsxs(N,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Or,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(Or,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(sp,{required:!0,...i.getInputProps("base_model")}),a.jsx($0,{required:!0,...i.getInputProps("variant")}),a.jsx(Or,{required:!0,label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(Or,{label:s("modelManager.vaeLocation"),...i.getInputProps("vae")}),a.jsx(Dt,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function yhe(e){const{model:t}=e,[n,{isLoading:r}]=lN(),o=le(),{t:s}=Q(),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:d=>d.trim().length===0?"Must provide a path":null}}),c=l.useCallback(d=>{const p={base_model:t.base_model,model_name:t.model_name,body:d};n(p).unwrap().then(h=>{i.setValues(h),o(Ht(rr({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(h=>{i.reset(),o(Ht(rr({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[o,i,t.base_model,t.model_name,s,n]);return a.jsxs(N,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(N,{flexDirection:"column",children:[a.jsx(je,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(je,{fontSize:"sm",color:"base.400",children:[xr[t.base_model]," Model ⋅"," ",cN[t.model_format]," format"]})]}),a.jsx(io,{}),a.jsx("form",{onSubmit:i.onSubmit(d=>c(d)),children:a.jsxs(N,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Or,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(Or,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(sp,{...i.getInputProps("base_model")}),a.jsx(Or,{label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(Dt,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function Che(e){const{t}=Q(),n=le(),[r]=uN(),[o]=dN(),{model:s,isSelected:i,setSelectedModelId:c}=e,d=l.useCallback(()=>{c(s.id)},[s.id,c]),p=l.useCallback(()=>{const h={main:r,lora:o,onnx:r}[s.model_type];h(s).unwrap().then(m=>{n(Ht(rr({title:`${t("modelManager.modelDeleted")}: ${s.model_name}`,status:"success"})))}).catch(m=>{m&&n(Ht(rr({title:`${t("modelManager.modelDeleteFailed")}: ${s.model_name}`,status:"error"})))}),c(void 0)},[r,o,s,c,n,t]);return a.jsxs(N,{sx:{gap:2,alignItems:"center",w:"full"},children:[a.jsx(N,{as:Dt,isChecked:i,sx:{justifyContent:"start",p:2,borderRadius:"base",w:"full",alignItems:"center",bg:i?"accent.400":"base.100",color:i?"base.50":"base.800",_hover:{bg:i?"accent.500":"base.300",color:i?"base.50":"base.800"},_dark:{color:i?"base.50":"base.100",bg:i?"accent.600":"base.850",_hover:{color:i?"base.50":"base.100",bg:i?"accent.550":"base.700"}}},onClick:d,children:a.jsxs(N,{gap:4,alignItems:"center",children:[a.jsx(Va,{minWidth:14,p:.5,fontSize:"sm",variant:"solid",children:fN[s.base_model]}),a.jsx(Wn,{label:s.description,hasArrow:!0,placement:"bottom",children:a.jsx(je,{sx:{fontWeight:500},children:s.model_name})})]})}),a.jsx(_0,{title:t("modelManager.deleteModel"),acceptCallback:p,acceptButtonText:t("modelManager.delete"),triggerComponent:a.jsx(rt,{icon:a.jsx(Une,{}),"aria-label":t("modelManager.deleteConfig"),colorScheme:"error"}),children:a.jsxs(N,{rowGap:4,flexDirection:"column",children:[a.jsx("p",{style:{fontWeight:"bold"},children:t("modelManager.deleteMsg1")}),a.jsx("p",{children:t("modelManager.deleteMsg2")})]})})]})}const whe=e=>{const{selectedModelId:t,setSelectedModelId:n}=e,{t:r}=Q(),[o,s]=l.useState(""),[i,c]=l.useState("all"),{filteredDiffusersModels:d,isLoadingDiffusersModels:p}=aa(Al,{selectFromResult:({data:I,isLoading:_})=>({filteredDiffusersModels:jd(I,"main","diffusers",o),isLoadingDiffusersModels:_})}),{filteredCheckpointModels:h,isLoadingCheckpointModels:m}=aa(Al,{selectFromResult:({data:I,isLoading:_})=>({filteredCheckpointModels:jd(I,"main","checkpoint",o),isLoadingCheckpointModels:_})}),{filteredLoraModels:g,isLoadingLoraModels:b}=_f(void 0,{selectFromResult:({data:I,isLoading:_})=>({filteredLoraModels:jd(I,"lora",void 0,o),isLoadingLoraModels:_})}),{filteredOnnxModels:y,isLoadingOnnxModels:x}=Jd(Al,{selectFromResult:({data:I,isLoading:_})=>({filteredOnnxModels:jd(I,"onnx","onnx",o),isLoadingOnnxModels:_})}),{filteredOliveModels:w,isLoadingOliveModels:S}=Jd(Al,{selectFromResult:({data:I,isLoading:_})=>({filteredOliveModels:jd(I,"onnx","olive",o),isLoadingOliveModels:_})}),j=l.useCallback(I=>{s(I.target.value)},[]);return a.jsx(N,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:a.jsxs(N,{flexDirection:"column",gap:4,paddingInlineEnd:4,children:[a.jsxs(Hn,{isAttached:!0,children:[a.jsx(Dt,{onClick:c.bind(null,"all"),isChecked:i==="all",size:"sm",children:r("modelManager.allModels")}),a.jsx(Dt,{size:"sm",onClick:c.bind(null,"diffusers"),isChecked:i==="diffusers",children:r("modelManager.diffusersModels")}),a.jsx(Dt,{size:"sm",onClick:c.bind(null,"checkpoint"),isChecked:i==="checkpoint",children:r("modelManager.checkpointModels")}),a.jsx(Dt,{size:"sm",onClick:c.bind(null,"onnx"),isChecked:i==="onnx",children:r("modelManager.onnxModels")}),a.jsx(Dt,{size:"sm",onClick:c.bind(null,"olive"),isChecked:i==="olive",children:r("modelManager.oliveModels")}),a.jsx(Dt,{size:"sm",onClick:c.bind(null,"lora"),isChecked:i==="lora",children:r("modelManager.loraModels")})]}),a.jsx(Is,{onChange:j,label:r("modelManager.search"),labelPos:"side"}),a.jsxs(N,{flexDirection:"column",gap:4,maxHeight:window.innerHeight-280,overflow:"scroll",children:[p&&a.jsx(Wc,{loadingMessage:"Loading Diffusers..."}),["all","diffusers"].includes(i)&&!p&&d.length>0&&a.jsx(Hc,{title:"Diffusers",modelList:d,selected:{selectedModelId:t,setSelectedModelId:n}},"diffusers"),m&&a.jsx(Wc,{loadingMessage:"Loading Checkpoints..."}),["all","checkpoint"].includes(i)&&!m&&h.length>0&&a.jsx(Hc,{title:"Checkpoints",modelList:h,selected:{selectedModelId:t,setSelectedModelId:n}},"checkpoints"),b&&a.jsx(Wc,{loadingMessage:"Loading LoRAs..."}),["all","lora"].includes(i)&&!b&&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&&w.length>0&&a.jsx(Hc,{title:"Olives",modelList:w,selected:{selectedModelId:t,setSelectedModelId:n}},"olive"),x&&a.jsx(Wc,{loadingMessage:"Loading ONNX..."}),["all","onnx"].includes(i)&&!x&&y.length>0&&a.jsx(Hc,{title:"ONNX",modelList:y,selected:{selectedModelId:t,setSelectedModelId:n}},"onnx")]})]})})},She=l.memo(whe),jd=(e,t,n,r)=>{const o=[];return to(e==null?void 0:e.entities,s=>{if(!s)return;const i=s.model_name.toLowerCase().includes(r.toLowerCase()),c=n===void 0||s.model_format===n,d=s.model_type===t;i&&c&&d&&o.push(s)}),o},rC=l.memo(e=>a.jsx(N,{flexDirection:"column",gap:4,borderRadius:4,p:4,sx:{bg:"base.200",_dark:{bg:"base.800"}},children:e.children}));rC.displayName="StyledModelContainer";const Hc=l.memo(e=>{const{title:t,modelList:n,selected:r}=e;return a.jsx(rC,{children:a.jsxs(N,{sx:{gap:2,flexDir:"column"},children:[a.jsx(je,{variant:"subtext",fontSize:"sm",children:t}),n.map(o=>a.jsx(Che,{model:o,isSelected:r.selectedModelId===o.id,setSelectedModelId:r.setSelectedModelId},o.id))]})})});Hc.displayName="ModelListWrapper";const Wc=l.memo(({loadingMessage:e})=>a.jsx(rC,{children:a.jsxs(N,{justifyContent:"center",alignItems:"center",flexDirection:"column",p:4,gap:8,children:[a.jsx(Ci,{}),a.jsx(je,{variant:"subtext",children:e||"Fetching..."})]})}));Wc.displayName="FetchingModelsLoader";function khe(){const[e,t]=l.useState(),{mainModel:n}=aa(Al,{selectFromResult:({data:s})=>({mainModel:e?s==null?void 0:s.entities[e]:void 0})}),{loraModel:r}=_f(void 0,{selectFromResult:({data:s})=>({loraModel:e?s==null?void 0:s.entities[e]:void 0})}),o=n||r;return a.jsxs(N,{sx:{gap:8,w:"full",h:"full"},children:[a.jsx(She,{selectedModelId:e,setSelectedModelId:t}),a.jsx(jhe,{model:o})]})}const jhe=e=>{const{t}=Q(),{model:n}=e;return(n==null?void 0:n.model_format)==="checkpoint"?a.jsx(bhe,{model:n},n.id):(n==null?void 0:n.model_format)==="diffusers"?a.jsx(xhe,{model:n},n.id):(n==null?void 0:n.model_type)==="lora"?a.jsx(yhe,{model:n},n.id):a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",maxH:96,userSelect:"none"},children:a.jsx(je,{variant:"subtext",children:t("modelManager.noModelSelected")})})};function _he(){const{t:e}=Q();return a.jsxs(N,{sx:{w:"full",p:4,borderRadius:4,gap:4,justifyContent:"space-between",alignItems:"center",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsx(je,{sx:{fontWeight:600},children:e("modelManager.syncModels")}),a.jsx(je,{fontSize:"sm",sx:{_dark:{color:"base.400"}},children:e("modelManager.syncModelsDesc")})]}),a.jsx(Ku,{})]})}function Ihe(){return a.jsx(N,{children:a.jsx(_he,{})})}const Phe=()=>{const{t:e}=Q(),t=l.useMemo(()=>[{id:"modelManager",label:e("modelManager.modelManager"),content:a.jsx(khe,{})},{id:"importModels",label:e("modelManager.importModels"),content:a.jsx(hhe,{})},{id:"mergeModels",label:e("modelManager.mergeModels"),content:a.jsx(ghe,{})},{id:"settings",label:e("modelManager.settings"),content:a.jsx(Ihe,{})}],[e]);return a.jsxs(tc,{isLazy:!0,variant:"line",layerStyle:"first",sx:{w:"full",h:"full",p:4,gap:4,borderRadius:"base"},children:[a.jsx(nc,{children:t.map(n=>a.jsx(wo,{sx:{borderTopRadius:"base"},children:n.label},n.id))}),a.jsx($u,{sx:{w:"full",h:"full"},children:t.map(n=>a.jsx(Go,{sx:{w:"full",h:"full"},children:n.content},n.id))})]})},Ehe=l.memo(Phe),Mhe=me([e=>e.nodes],e=>e.nodeTemplates),Ohe=()=>{const e=H(Mhe),t=Jx();return l.useCallback(n=>{var d;let r=window.innerWidth/2,o=window.innerHeight/2;const s=(d=document.querySelector("#workflow-editor"))==null?void 0:d.getBoundingClientRect();s&&(r=s.width/2-sb/2,o=s.height/2-sb/2);const i=t.project({x:r,y:o}),c=e[n];return pN(n,i,c)},[e,t])},GA=l.forwardRef(({label:e,description:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs("div",{children:[a.jsx(je,{fontWeight:600,children:e}),a.jsx(je,{size:"xs",sx:{color:"base.600",_dark:{color:"base.500"}},children:t})]})}));GA.displayName="AddNodePopoverSelectItem";const Ahe=(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))},Rhe=()=>{const e=le(),t=Ohe(),n=Zl(),{t:r}=Q(),o=H(w=>w.nodes.currentConnectionFieldType),s=H(w=>{var S;return(S=w.nodes.connectionStartParams)==null?void 0:S.handleType}),i=me([we],({nodes:w})=>{const S=o?S$(w.nodeTemplates,I=>{const _=s=="source"?I.inputs:I.outputs;return ta(_,M=>{const E=s=="source"?o:M.type,A=s=="target"?o:M.type;return Zx(E,A)})}):To(w.nodeTemplates),j=To(S,I=>({label:I.title,value:I.type,description:I.description,tags:I.tags}));return o===null&&(j.push({label:r("nodes.currentImage"),value:"current_image",description:r("nodes.currentImageDescription"),tags:["progress"]}),j.push({label:r("nodes.notes"),value:"notes",description:r("nodes.notesDescription"),tags:["notes"]})),j.sort((I,_)=>I.label.localeCompare(_.label)),{data:j,t:r}},Ie),{data:c}=H(i),d=H(w=>w.nodes.isAddNodePopoverOpen),p=l.useRef(null),h=l.useCallback(w=>{const S=t(w);if(!S){const j=r("nodes.unknownNode",{nodeType:w});n({status:"error",title:j});return}e(hN(S))},[e,t,n,r]),m=l.useCallback(w=>{w&&h(w)},[h]),g=l.useCallback(()=>{e(mN())},[e]),b=l.useCallback(()=>{e(yP())},[e]),y=l.useCallback(w=>{w.preventDefault(),b(),setTimeout(()=>{var S;(S=p.current)==null||S.focus()},0)},[b]),x=l.useCallback(()=>{g()},[g]);return _t(["shift+a","space"],y),_t(["escape"],x),a.jsxs(Uf,{initialFocusRef:p,isOpen:d,onClose:g,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(y3,{children:a.jsx(N,{sx:{position:"absolute",top:"15%",insetInlineStart:"50%",pointerEvents:"none"}})}),a.jsx(Gf,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Hg,{sx:{p:0},children:a.jsx(sr,{inputRef:p,selectOnBlur:!1,placeholder:r("nodes.nodeSearch"),value:null,data:c,maxDropdownHeight:400,nothingFound:r("nodes.noMatchingNodes"),itemComponent:GA,filter:Ahe,onChange:m,hoverOnSearchChange:!0,onDropdownClose:g,sx:{width:"32rem",input:{padding:"0.5rem"}}})})})]})},Dhe=l.memo(Rhe),The=()=>{const e=Jx(),t=H(r=>r.nodes.shouldValidateGraph);return l.useCallback(({source:r,sourceHandle:o,target:s,targetHandle:i})=>{var b,y;const c=e.getEdges(),d=e.getNodes();if(!(r&&o&&s&&i))return!1;const p=e.getNode(r),h=e.getNode(s);if(!(p&&h&&p.data&&h.data))return!1;const m=(b=p.data.outputs[o])==null?void 0:b.type,g=(y=h.data.inputs[i])==null?void 0:y.type;return!m||!g||r===s?!1:t?c.find(x=>{x.target===s&&x.targetHandle===i&&x.source===r&&x.sourceHandle})||c.find(x=>x.target===s&&x.targetHandle===i)&&g!=="CollectionItem"||!Zx(m,g)?!1:CP(r,s,d,c):!0},[e,t])},yf=e=>`var(--invokeai-colors-${e.split(".").join("-")})`,Nhe=me(we,({nodes:e})=>{const{shouldAnimateEdges:t,currentConnectionFieldType:n,shouldColorEdges:r}=e,o=yf(n&&r?If[n].color:"base.500");let s="react-flow__custom_connection-path";return t&&(s=s.concat(" animated")),{stroke:o,className:s}}),$he=({fromX:e,fromY:t,fromPosition:n,toX:r,toY:o,toPosition:s})=>{const{stroke:i,className:c}=H(Nhe),d={sourceX:e,sourceY:t,sourcePosition:n,targetX:r,targetY:o,targetPosition:s},[p]=ey(d);return a.jsx("g",{children:a.jsx("path",{fill:"none",stroke:i,strokeWidth:2,className:c,d:p,style:{opacity:.8}})})},Lhe=l.memo($he),qA=(e,t,n,r,o)=>me(we,({nodes:s})=>{var g,b;const i=s.nodes.find(y=>y.id===e),c=s.nodes.find(y=>y.id===n),d=Rr(i)&&Rr(c),p=(i==null?void 0:i.selected)||(c==null?void 0:c.selected)||o,h=d?(b=(g=i==null?void 0:i.data)==null?void 0:g.outputs[t||""])==null?void 0:b.type:void 0,m=h&&s.shouldColorEdges?yf(If[h].color):yf("base.500");return{isSelected:p,shouldAnimate:s.shouldAnimateEdges&&p,stroke:m}},Ie),zhe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,data:c,selected:d,source:p,target:h,sourceHandleId:m,targetHandleId:g})=>{const b=l.useMemo(()=>qA(p,m,h,g,d),[d,p,m,h,g]),{isSelected:y,shouldAnimate:x}=H(b),[w,S,j]=ey({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s}),{base500:I}=Jf();return a.jsxs(a.Fragment,{children:[a.jsx(wP,{path:w,markerEnd:i,style:{strokeWidth:y?3:2,stroke:I,opacity:y?.8:.5,animation:x?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:x?5:"none"}}),(c==null?void 0:c.count)&&c.count>1&&a.jsx(gN,{children:a.jsx(N,{sx:{position:"absolute",transform:`translate(-50%, -50%) translate(${S}px,${j}px)`},className:"nodrag nopan",children:a.jsx(Va,{variant:"solid",sx:{bg:"base.500",opacity:y?.8:.5,boxShadow:"base"},children:c.count})})})]})},Fhe=l.memo(zhe),Bhe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,selected:c,source:d,target:p,sourceHandleId:h,targetHandleId:m})=>{const g=l.useMemo(()=>qA(d,h,p,m,c),[d,h,p,m,c]),{isSelected:b,shouldAnimate:y,stroke:x}=H(g),[w]=ey({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s});return a.jsx(wP,{path:w,markerEnd:i,style:{strokeWidth:b?3:2,stroke:x,opacity:b?.8:.5,animation:y?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:y?5:"none"}})},Hhe=l.memo(Bhe),Whe=e=>{const{nodeId:t,width:n,children:r,selected:o}=e,{isMouseOverNode:s,handleMouseOut:i,handleMouseOver:c}=rA(t),d=l.useMemo(()=>me(we,({nodes:j})=>{var I;return((I=j.nodeExecutionStates[t])==null?void 0:I.status)===oi.IN_PROGRESS}),[t]),p=H(d),[h,m,g,b]=ea("shadows",["nodeInProgress.light","nodeInProgress.dark","shadows.xl","shadows.base"]),y=le(),x=di(h,m),w=H(j=>j.nodes.nodeOpacity),S=l.useCallback(j=>{!j.ctrlKey&&!j.altKey&&!j.metaKey&&!j.shiftKey&&y(vN(t)),y(SP())},[y,t]);return a.jsxs(Le,{onClick:S,onMouseEnter:c,onMouseLeave:i,className:Du,sx:{h:"full",position:"relative",borderRadius:"base",w:n??sb,transitionProperty:"common",transitionDuration:"0.1s",cursor:"grab",opacity:w},children:[a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",pointerEvents:"none",shadow:`${g}, ${b}, ${b}`,zIndex:-1}}),a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"md",pointerEvents:"none",transitionProperty:"common",transitionDuration:"0.1s",opacity:.7,shadow:p?x:void 0,zIndex:-1}}),r,a.jsx(nA,{isSelected:o,isHovered:s})]})},L0=l.memo(Whe),Vhe=me(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}}),Uhe=e=>{const{progressImage:t,imageDTO:n}=bN(Vhe);return t?a.jsx(H1,{nodeProps:e,children:a.jsx(_i,{src:t.dataURL,sx:{w:"full",h:"full",objectFit:"contain",borderRadius:"base"}})}):n?a.jsx(H1,{nodeProps:e,children:a.jsx(ll,{imageDTO:n,isDragDisabled:!0,useThumbailFallback:!0})}):a.jsx(H1,{nodeProps:e,children:a.jsx(eo,{})})},Ghe=l.memo(Uhe),H1=e=>{const[t,n]=l.useState(!1),r=l.useCallback(()=>{n(!0)},[]),o=l.useCallback(()=>{n(!1)},[]);return a.jsx(L0,{nodeId:e.nodeProps.id,selected:e.nodeProps.selected,width:384,children:a.jsxs(N,{onMouseEnter:r,onMouseLeave:o,className:Du,sx:{position:"relative",flexDirection:"column"},children:[a.jsx(N,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",alignItems:"center",justifyContent:"center",h:8},children:a.jsx(je,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",_dark:{color:"base.200"}},children:"Current Image"})}),a.jsxs(N,{layerStyle:"nodeBody",sx:{w:"full",h:"full",borderBottomRadius:"base",p:2},children:[e.children,t&&a.jsx(Ar.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(zA,{})},"nextPrevButtons")]})]})})},oC=e=>{const t=e.filter(o=>!o.ui_hidden),n=t.filter(o=>!si(o.ui_order)).sort((o,s)=>(o.ui_order??0)-(s.ui_order??0)),r=t.filter(o=>si(o.ui_order));return n.concat(r).map(o=>o.name).filter(o=>o!=="is_intermediate")},qhe=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(c=>c.id===e);if(!Rr(o))return[];const s=r.nodeTemplates[o.data.type];if(!s)return[];const i=To(s.inputs).filter(c=>(["any","direct"].includes(c.input)||ty.includes(c.type))&&kP.includes(c.type));return oC(i)},Ie),[e]);return H(t)},Khe=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(c=>c.id===e);if(!Rr(o))return[];const s=r.nodeTemplates[o.data.type];if(!s)return[];const i=To(s.inputs).filter(c=>c.input==="connection"&&!ty.includes(c.type)||!kP.includes(c.type));return oC(i)},Ie),[e]);return H(t)},Qhe=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Rr(o))return[];const s=r.nodeTemplates[o.data.type];return s?oC(To(s.outputs)):[]},Ie),[e]);return H(t)},sC=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?ta(o.data.outputs,s=>xN.includes(s.type)&&o.data.type!=="image"):!1},Ie),[e]);return H(t)},Xhe=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.embedWorkflow:!1},Ie),[e]);return H(t)},Yhe=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Rr(o))return!1;const s=r.nodeTemplates[(o==null?void 0:o.data.type)??""];return s?s.withWorkflow:!1},Ie),[e]);return H(t)},Jhe=({nodeId:e})=>{const t=le(),n=Yhe(e),r=Xhe(e),o=l.useCallback(s=>{t(yN({nodeId:e,embedWorkflow:s.target.checked}))},[t,e]);return n?a.jsxs(Vn,{as:N,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(yr,{sx:{fontSize:"xs",mb:"1px"},children:"Workflow"}),a.jsx(Tf,{className:"nopan",size:"sm",onChange:o,isChecked:r})]}):null},Zhe=l.memo(Jhe),eme=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.isIntermediate:!1},Ie),[e]);return H(t)},tme=({nodeId:e})=>{const t=le(),n=sC(e),r=eme(e),o=l.useCallback(s=>{t(CN({nodeId:e,isIntermediate:!s.target.checked}))},[t,e]);return n?a.jsxs(Vn,{as:N,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(yr,{sx:{fontSize:"xs",mb:"1px"},children:"Save to Gallery"}),a.jsx(Tf,{className:"nopan",size:"sm",onChange:o,isChecked:!r})]}):null},nme=l.memo(tme),rme=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.useCache:!1},Ie),[e]);return H(t)},ome=({nodeId:e})=>{const t=le(),n=rme(e),r=l.useCallback(o=>{t(wN({nodeId:e,useCache:o.target.checked}))},[t,e]);return a.jsxs(Vn,{as:N,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(yr,{sx:{fontSize:"xs",mb:"1px"},children:"Use Cache"}),a.jsx(Tf,{className:"nopan",size:"sm",onChange:r,isChecked:n})]})},sme=l.memo(ome),ame=({nodeId:e})=>{const t=sC(e),n=Pn("invocationCache").isFeatureEnabled;return a.jsxs(N,{className:Du,layerStyle:"nodeFooter",sx:{w:"full",borderBottomRadius:"base",px:2,py:0,h:6,justifyContent:"space-between"},children:[n&&a.jsx(sme,{nodeId:e}),t&&a.jsx(Zhe,{nodeId:e}),t&&a.jsx(nme,{nodeId:e})]})},ime=l.memo(ame),lme=({nodeId:e,isOpen:t})=>{const n=le(),r=SN(),o=l.useCallback(()=>{n(kN({nodeId:e,isOpen:!t})),r(e)},[n,t,e,r]);return a.jsx(rt,{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(b0,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})})},aC=l.memo(lme),cme=({nodeId:e,title:t})=>{const n=le(),r=Z8(e),o=eA(e),{t:s}=Q(),[i,c]=l.useState(""),d=l.useCallback(async h=>{n(oP({nodeId:e,label:h})),c(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),p=l.useCallback(h=>{c(h)},[]);return l.useEffect(()=>{c(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx(N,{sx:{overflow:"hidden",w:"full",h:"full",alignItems:"center",justifyContent:"center",cursor:"text"},children:a.jsxs(Lf,{as:N,value:i,onChange:p,onSubmit:d,sx:{alignItems:"center",position:"relative",w:"full",h:"full"},children:[a.jsx($f,{fontSize:"sm",sx:{p:0,w:"full"},noOfLines:1}),a.jsx(Nf,{className:"nodrag",fontSize:"sm",sx:{p:0,fontWeight:700,_focusVisible:{p:0,boxShadow:"none"}}}),a.jsx(ume,{})]})})},KA=l.memo(cme);function ume(){const{isEditing:e,getEditButtonProps:t}=e5(),n=l.useCallback(r=>{const{onClick:o}=t();o&&o(r)},[t]);return e?null:a.jsx(Le,{className:Du,onDoubleClick:n,sx:{position:"absolute",w:"full",h:"full",top:0,cursor:"grab"}})}const dme=({nodeId:e})=>{const t=K2(e),{base400:n,base600:r}=Jf(),o=di(n,r),s=l.useMemo(()=>({borderWidth:0,borderRadius:"3px",width:"1rem",height:"1rem",backgroundColor:o,zIndex:-1}),[o]);return Kh(t)?a.jsxs(a.Fragment,{children:[a.jsx(Ed,{type:"target",id:`${t.id}-collapsed-target`,isConnectable:!1,position:Uc.Left,style:{...s,left:"-0.5rem"}}),To(t.inputs,i=>a.jsx(Ed,{type:"target",id:i.name,isConnectable:!1,position:Uc.Left,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-input-handle`)),a.jsx(Ed,{type:"source",id:`${t.id}-collapsed-source`,isConnectable:!1,position:Uc.Right,style:{...s,right:"-0.5rem"}}),To(t.outputs,i=>a.jsx(Ed,{type:"source",id:i.name,isConnectable:!1,position:Uc.Right,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-output-handle`))]}):null},fme=l.memo(dme),pme=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);return r.nodeTemplates[(o==null?void 0:o.data.type)??""]},Ie),[e]);return H(t)},hme=({nodeId:e})=>{const{needsUpdate:t}=sP(e);return a.jsx(Wn,{label:a.jsx(QA,{nodeId:e}),placement:"top",shouldWrapChildren:!0,children:a.jsx(Gr,{as:QM,sx:{boxSize:4,w:8,color:t?"error.400":"base.400"}})})},mme=l.memo(hme),QA=l.memo(({nodeId:e})=>{const t=K2(e),n=pme(e),{t:r}=Q(),o=l.useMemo(()=>t!=null&&t.label&&(n!=null&&n.title)?`${t.label} (${n.title})`:t!=null&&t.label&&!n?t.label:!(t!=null&&t.label)&&n?n.title:r("nodes.unknownNode"),[t,n,r]),s=l.useMemo(()=>!Kh(t)||!n?null:t.version?n.version?xS(t.version,n.version,"<")?a.jsxs(je,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateNode"),")"]}):xS(t.version,n.version,">")?a.jsxs(je,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateApp"),")"]}):a.jsxs(je,{as:"span",children:[r("nodes.version")," ",t.version]}):a.jsxs(je,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.unknownTemplate"),")"]}):a.jsx(je,{as:"span",sx:{color:"error.500"},children:r("nodes.versionUnknown")}),[t,n,r]);return Kh(t)?a.jsxs(N,{sx:{flexDir:"column"},children:[a.jsx(je,{as:"span",sx:{fontWeight:600},children:o}),a.jsx(je,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:n==null?void 0:n.description}),s,(t==null?void 0:t.notes)&&a.jsx(je,{children:t.notes})]}):a.jsx(je,{sx:{fontWeight:600},children:r("nodes.unknownNode")})});QA.displayName="TooltipContent";const W1=3,nI={circle:{transitionProperty:"none",transitionDuration:"0s"},".chakra-progress__track":{stroke:"transparent"}},gme=({nodeId:e})=>{const t=l.useMemo(()=>me(we,({nodes:r})=>r.nodeExecutionStates[e]),[e]),n=H(t);return n?a.jsx(Wn,{label:a.jsx(XA,{nodeExecutionState:n}),placement:"top",children:a.jsx(N,{className:Du,sx:{w:5,h:"full",alignItems:"center",justifyContent:"flex-end"},children:a.jsx(YA,{nodeExecutionState:n})})}):null},vme=l.memo(gme),XA=l.memo(({nodeExecutionState:e})=>{const{status:t,progress:n,progressImage:r}=e,{t:o}=Q();return t===oi.PENDING?a.jsx(je,{children:"Pending"}):t===oi.IN_PROGRESS?r?a.jsxs(N,{sx:{pos:"relative",pt:1.5,pb:.5},children:[a.jsx(_i,{src:r.dataURL,sx:{w:32,h:32,borderRadius:"base",objectFit:"contain"}}),n!==null&&a.jsxs(Va,{variant:"solid",sx:{pos:"absolute",top:2.5,insetInlineEnd:1},children:[Math.round(n*100),"%"]})]}):n!==null?a.jsxs(je,{children:[o("nodes.executionStateInProgress")," (",Math.round(n*100),"%)"]}):a.jsx(je,{children:o("nodes.executionStateInProgress")}):t===oi.COMPLETED?a.jsx(je,{children:o("nodes.executionStateCompleted")}):t===oi.FAILED?a.jsx(je,{children:o("nodes.executionStateError")}):null});XA.displayName="TooltipLabel";const YA=l.memo(e=>{const{progress:t,status:n}=e.nodeExecutionState;return n===oi.PENDING?a.jsx(Gr,{as:Pee,sx:{boxSize:W1,color:"base.600",_dark:{color:"base.300"}}}):n===oi.IN_PROGRESS?t===null?a.jsx(Pb,{isIndeterminate:!0,size:"14px",color:"base.500",thickness:14,sx:nI}):a.jsx(Pb,{value:Math.round(t*100),size:"14px",color:"base.500",thickness:14,sx:nI}):n===oi.COMPLETED?a.jsx(Gr,{as:VM,sx:{boxSize:W1,color:"ok.600",_dark:{color:"ok.300"}}}):n===oi.FAILED?a.jsx(Gr,{as:Oee,sx:{boxSize:W1,color:"error.600",_dark:{color:"error.300"}}}):null});YA.displayName="StatusIcon";const bme=({nodeId:e,isOpen:t})=>a.jsxs(N,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",justifyContent:"space-between",h:8,textAlign:"center",fontWeight:500,color:"base.700",_dark:{color:"base.200"}},children:[a.jsx(aC,{nodeId:e,isOpen:t}),a.jsx(KA,{nodeId:e}),a.jsxs(N,{alignItems:"center",children:[a.jsx(vme,{nodeId:e}),a.jsx(mme,{nodeId:e})]}),!t&&a.jsx(fme,{nodeId:e})]}),xme=l.memo(bme),yme=(e,t,n,r)=>me(we,o=>{if(!r)return fn.t("nodes.noFieldType");const{currentConnectionFieldType:s,connectionStartParams:i,nodes:c,edges:d}=o.nodes;if(!i||!s)return fn.t("nodes.noConnectionInProgress");const{handleType:p,nodeId:h,handleId:m}=i;if(!p||!h||!m)return fn.t("nodes.noConnectionData");const g=n==="target"?r:s,b=n==="source"?r:s;if(e===h)return fn.t("nodes.cannotConnectToSelf");if(n===p)return n==="source"?fn.t("nodes.cannotConnectOutputToOutput"):fn.t("nodes.cannotConnectInputToInput");const y=n==="target"?e:h,x=n==="target"?t:m,w=n==="source"?e:h,S=n==="source"?t:m;return d.find(I=>{I.target===y&&I.targetHandle===x&&I.source===w&&I.sourceHandle})?fn.t("nodes.cannotDuplicateConnection"):d.find(I=>I.target===y&&I.targetHandle===x)&&g!=="CollectionItem"?fn.t("nodes.inputMayOnlyHaveOneConnection"):Zx(b,g)?CP(p==="source"?h:e,p==="source"?e:h,c,d)?null:fn.t("nodes.connectionWouldCreateCycle"):fn.t("nodes.fieldTypesMustMatch")}),Cme=(e,t,n)=>{const r=l.useMemo(()=>me(we,({nodes:s})=>{var c;const i=s.nodes.find(d=>d.id===e);if(Rr(i))return(c=i==null?void 0:i.data[Xx[n]][t])==null?void 0:c.type},Ie),[t,n,e]);return H(r)},wme=me(we,({nodes:e})=>e.currentConnectionFieldType!==null&&e.connectionStartParams!==null),JA=({nodeId:e,fieldName:t,kind:n})=>{const r=Cme(e,t,n),o=l.useMemo(()=>me(we,({nodes:g})=>!!g.edges.filter(b=>(n==="input"?b.target:b.source)===e&&(n==="input"?b.targetHandle:b.sourceHandle)===t).length),[t,n,e]),s=l.useMemo(()=>yme(e,t,n==="input"?"target":"source",r),[e,t,n,r]),i=l.useMemo(()=>me(we,({nodes:g})=>{var b,y,x;return((b=g.connectionStartParams)==null?void 0:b.nodeId)===e&&((y=g.connectionStartParams)==null?void 0:y.handleId)===t&&((x=g.connectionStartParams)==null?void 0:x.handleType)==={input:"target",output:"source"}[n]}),[t,n,e]),c=H(o),d=H(wme),p=H(i),h=H(s),m=l.useMemo(()=>!!(d&&h&&!p),[h,d,p]);return{isConnected:c,isConnectionInProgress:d,isConnectionStartField:p,connectionError:h,shouldDim:m}},Sme=(e,t)=>{const n=l.useMemo(()=>me(we,({nodes:o})=>{var i;const s=o.nodes.find(c=>c.id===e);if(Rr(s))return((i=s==null?void 0:s.data.inputs[t])==null?void 0:i.value)!==void 0},Ie),[t,e]);return H(n)},kme=(e,t)=>{const n=l.useMemo(()=>me(we,({nodes:o})=>{const s=o.nodes.find(d=>d.id===e);if(!Rr(s))return;const i=o.nodeTemplates[(s==null?void 0:s.data.type)??""],c=i==null?void 0:i.inputs[t];return c==null?void 0:c.input},Ie),[t,e]);return H(n)},jme=({nodeId:e,fieldName:t,kind:n,children:r})=>{const o=le(),s=oA(e,t),i=sA(e,t,n),c=kme(e,t),{t:d}=Q(),p=l.useCallback(S=>{S.preventDefault()},[]),h=l.useMemo(()=>me(we,({nodes:S})=>({isExposed:!!S.workflow.exposedFields.find(I=>I.nodeId===e&&I.fieldName===t)}),Ie),[t,e]),m=l.useMemo(()=>["any","direct"].includes(c??"__UNKNOWN_INPUT__"),[c]),{isExposed:g}=H(h),b=l.useCallback(()=>{o(jN({nodeId:e,fieldName:t}))},[o,t,e]),y=l.useCallback(()=>{o(lP({nodeId:e,fieldName:t}))},[o,t,e]),x=l.useMemo(()=>{const S=[];return m&&!g&&S.push(a.jsx(Kn,{icon:a.jsx(Zi,{}),onClick:b,children:"Add to Linear View"},`${e}.${t}.expose-field`)),m&&g&&S.push(a.jsx(Kn,{icon:a.jsx(Hee,{}),onClick:y,children:"Remove from Linear View"},`${e}.${t}.unexpose-field`)),S},[t,b,y,g,m,e]),w=l.useCallback(()=>x.length?a.jsx(ql,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:p,children:a.jsx(af,{title:s||i||d("nodes.unknownField"),children:x})}):null,[i,s,x,p,d]);return a.jsx(S2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:w,children:r})},_me=l.memo(jme),Ime=e=>{const{fieldTemplate:t,handleType:n,isConnectionInProgress:r,isConnectionStartField:o,connectionError:s}=e,{name:i,type:c}=t,{color:d,title:p}=If[c],h=l.useMemo(()=>{const g=_N.includes(c),b=ty.includes(c),y=IN.includes(c),x=yf(d),w={backgroundColor:g||b?"var(--invokeai-colors-base-900)":x,position:"absolute",width:"1rem",height:"1rem",borderWidth:g||b?4:0,borderStyle:"solid",borderColor:x,borderRadius:y?4:"100%",zIndex:1};return n==="target"?w.insetInlineStart="-1rem":w.insetInlineEnd="-1rem",r&&!o&&s&&(w.filter="opacity(0.4) grayscale(0.7)"),r&&s?o?w.cursor="grab":w.cursor="not-allowed":w.cursor="crosshair",w},[s,n,r,o,c,d]),m=l.useMemo(()=>r&&o?p:r&&s?s??p:p,[s,r,o,p]);return a.jsx(Wn,{label:m,placement:n==="target"?"start":"end",hasArrow:!0,openDelay:xg,children:a.jsx(Ed,{type:n,id:i,position:n==="target"?Uc.Left:Uc.Right,style:h})})},ZA=l.memo(Ime),Pme=({nodeId:e,fieldName:t})=>{const n=M0(e,t,"input"),r=Sme(e,t),{isConnected:o,isConnectionInProgress:s,isConnectionStartField:i,connectionError:c,shouldDim:d}=JA({nodeId:e,fieldName:t,kind:"input"}),p=l.useMemo(()=>{if((n==null?void 0:n.fieldKind)!=="input"||!n.required)return!1;if(!o&&n.input==="connection"||!r&&!o&&n.input==="any")return!0},[n,o,r]);return(n==null?void 0:n.fieldKind)!=="input"?a.jsx(wx,{shouldDim:d,children:a.jsxs(Vn,{sx:{color:"error.400",textAlign:"left",fontSize:"sm"},children:["Unknown input: ",t]})}):a.jsxs(wx,{shouldDim:d,children:[a.jsxs(Vn,{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(_me,{nodeId:e,fieldName:t,kind:"input",children:h=>a.jsx(yr,{sx:{display:"flex",alignItems:"center",h:"full",mb:0,px:1,gap:2},children:a.jsx(iA,{ref:h,nodeId:e,fieldName:t,kind:"input",isMissingInput:p,withTooltip:!0})})}),a.jsx(Le,{children:a.jsx(bA,{nodeId:e,fieldName:t})})]}),n.input!=="direct"&&a.jsx(ZA,{fieldTemplate:n,handleType:"target",isConnectionInProgress:s,isConnectionStartField:i,connectionError:c})]})},rI=l.memo(Pme),wx=l.memo(({shouldDim:e,children:t})=>a.jsx(N,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",w:"full",h:"full"},children:t}));wx.displayName="InputFieldWrapper";const Eme=({nodeId:e,fieldName:t})=>{const n=M0(e,t,"output"),{isConnected:r,isConnectionInProgress:o,isConnectionStartField:s,connectionError:i,shouldDim:c}=JA({nodeId:e,fieldName:t,kind:"output"});return(n==null?void 0:n.fieldKind)!=="output"?a.jsx(Sx,{shouldDim:c,children:a.jsxs(Vn,{sx:{color:"error.400",textAlign:"right",fontSize:"sm"},children:["Unknown output: ",t]})}):a.jsxs(Sx,{shouldDim:c,children:[a.jsx(Wn,{label:a.jsx(Q2,{nodeId:e,fieldName:t,kind:"output"}),openDelay:xg,placement:"top",shouldWrapChildren:!0,hasArrow:!0,children:a.jsx(Vn,{isDisabled:r,pe:2,children:a.jsx(yr,{sx:{mb:0,fontWeight:500},children:n==null?void 0:n.title})})}),a.jsx(ZA,{fieldTemplate:n,handleType:"source",isConnectionInProgress:o,isConnectionStartField:s,connectionError:i})]})},Mme=l.memo(Eme),Sx=l.memo(({shouldDim:e,children:t})=>a.jsx(N,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",justifyContent:"flex-end"},children:t}));Sx.displayName="OutputFieldWrapper";const Ome=e=>{const t=sC(e),n=Pn("invocationCache").isFeatureEnabled;return l.useMemo(()=>t||n,[t,n])},Ame=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>{const s=Khe(e),i=qhe(e),c=Ome(e),d=Qhe(e);return a.jsxs(L0,{nodeId:e,selected:o,children:[a.jsx(xme,{nodeId:e,isOpen:t,label:n,selected:o,type:r}),t&&a.jsxs(a.Fragment,{children:[a.jsx(N,{layerStyle:"nodeBody",sx:{flexDirection:"column",w:"full",h:"full",py:2,gap:1,borderBottomRadius:c?0:"base"},children:a.jsxs(N,{sx:{flexDir:"column",px:2,w:"full",h:"full"},children:[a.jsxs(rl,{gridTemplateColumns:"1fr auto",gridAutoRows:"1fr",children:[s.map((p,h)=>a.jsx(rf,{gridColumnStart:1,gridRowStart:h+1,children:a.jsx(rI,{nodeId:e,fieldName:p})},`${e}.${p}.input-field`)),d.map((p,h)=>a.jsx(rf,{gridColumnStart:2,gridRowStart:h+1,children:a.jsx(Mme,{nodeId:e,fieldName:p})},`${e}.${p}.output-field`))]}),i.map(p=>a.jsx(rI,{nodeId:e,fieldName:p},`${e}.${p}.input-field`))]})}),c&&a.jsx(ime,{nodeId:e})]})]})},Rme=l.memo(Ame),Dme=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>a.jsxs(L0,{nodeId:e,selected:o,children:[a.jsxs(N,{className:Du,layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",h:8,fontWeight:600,fontSize:"sm"},children:[a.jsx(aC,{nodeId:e,isOpen:t}),a.jsx(je,{sx:{w:"full",textAlign:"center",pe:8,color:"error.500",_dark:{color:"error.300"}},children:n?`${n} (${r})`:r})]}),t&&a.jsx(N,{layerStyle:"nodeBody",sx:{userSelect:"auto",flexDirection:"column",w:"full",h:"full",p:4,gap:1,borderBottomRadius:"base",fontSize:"sm"},children:a.jsxs(Le,{children:[a.jsx(je,{as:"span",children:"Unknown node type: "}),a.jsx(je,{as:"span",fontWeight:600,children:r})]})})]}),Tme=l.memo(Dme),Nme=e=>{const{data:t,selected:n}=e,{id:r,type:o,isOpen:s,label:i}=t,c=l.useMemo(()=>me(we,({nodes:p})=>!!p.nodeTemplates[o]),[o]);return H(c)?a.jsx(Rme,{nodeId:r,isOpen:s,label:i,type:o,selected:n}):a.jsx(Tme,{nodeId:r,isOpen:s,label:i,type:o,selected:n})},$me=l.memo(Nme),Lme=e=>{const{id:t,data:n,selected:r}=e,{notes:o,isOpen:s}=n,i=le(),c=l.useCallback(d=>{i(PN({nodeId:t,value:d.target.value}))},[i,t]);return a.jsxs(L0,{nodeId:t,selected:r,children:[a.jsxs(N,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:s?0:"base",alignItems:"center",justifyContent:"space-between",h:8},children:[a.jsx(aC,{nodeId:t,isOpen:s}),a.jsx(KA,{nodeId:t,title:"Notes"}),a.jsx(Le,{minW:8})]}),s&&a.jsx(a.Fragment,{children:a.jsx(N,{layerStyle:"nodeBody",className:"nopan",sx:{cursor:"auto",flexDirection:"column",borderBottomRadius:"base",w:"full",h:"full",p:2,gap:1},children:a.jsx(N,{className:"nopan",sx:{flexDir:"column",w:"full",h:"full"},children:a.jsx(yi,{value:o,onChange:c,rows:8,resize:"none",sx:{fontSize:"xs"}})})})})]})},zme=l.memo(Lme),Fme=["Delete","Backspace"],Bme={collapsed:Fhe,default:Hhe},Hme={invocation:$me,current_image:Ghe,notes:zme},Wme={hideAttribution:!0},Vme=me(we,({nodes:e})=>{const{shouldSnapToGrid:t,selectionMode:n}=e;return{shouldSnapToGrid:t,selectionMode:n}},Ie),Ume=()=>{const e=le(),t=H(O=>O.nodes.nodes),n=H(O=>O.nodes.edges),r=H(O=>O.nodes.viewport),{shouldSnapToGrid:o,selectionMode:s}=H(Vme),i=l.useRef(null),c=l.useRef(),d=The(),[p]=ea("radii",["base"]),h=l.useCallback(O=>{e(EN(O))},[e]),m=l.useCallback(O=>{e(MN(O))},[e]),g=l.useCallback((O,T)=>{e(ON(T))},[e]),b=l.useCallback(O=>{e(yS(O))},[e]),y=l.useCallback(()=>{e(AN({cursorPosition:c.current}))},[e]),x=l.useCallback(O=>{e(RN(O))},[e]),w=l.useCallback(O=>{e(DN(O))},[e]),S=l.useCallback(({nodes:O,edges:T})=>{e(TN(O?O.map(K=>K.id):[])),e(NN(T?T.map(K=>K.id):[]))},[e]),j=l.useCallback((O,T)=>{e($N(T))},[e]),I=l.useCallback(()=>{e(SP())},[e]),_=l.useCallback(O=>{CS.set(O),O.fitView()},[]),M=l.useCallback(O=>{var K,G;const T=(K=i.current)==null?void 0:K.getBoundingClientRect();if(T){const X=(G=CS.get())==null?void 0:G.project({x:O.clientX-T.left,y:O.clientY-T.top});c.current=X}},[]),E=l.useRef(),A=l.useCallback((O,T,K)=>{E.current=O,e(LN(T.id)),e(zN())},[e]),R=l.useCallback((O,T)=>{e(yS(T))},[e]),D=l.useCallback((O,T,K)=>{var G,X;!("touches"in O)&&((G=E.current)==null?void 0:G.clientX)===O.clientX&&((X=E.current)==null?void 0:X.clientY)===O.clientY&&e(FN(T)),E.current=void 0},[e]);return _t(["Ctrl+c","Meta+c"],O=>{O.preventDefault(),e(BN())}),_t(["Ctrl+a","Meta+a"],O=>{O.preventDefault(),e(HN())}),_t(["Ctrl+v","Meta+v"],O=>{O.preventDefault(),e(WN({cursorPosition:c.current}))}),a.jsx(VN,{id:"workflow-editor",ref:i,defaultViewport:r,nodeTypes:Hme,edgeTypes:Bme,nodes:t,edges:n,onInit:_,onMouseMove:M,onNodesChange:h,onEdgesChange:m,onEdgesDelete:x,onEdgeUpdate:R,onEdgeUpdateStart:A,onEdgeUpdateEnd:D,onNodesDelete:w,onConnectStart:g,onConnect:b,onConnectEnd:y,onMoveEnd:j,connectionLineComponent:Lhe,onSelectionChange:S,isValidConnection:d,minZoom:.1,snapToGrid:o,snapGrid:[25,25],connectionRadius:30,proOptions:Wme,style:{borderRadius:p},onPaneClick:I,deleteKeyCode:Fme,selectionMode:s,children:a.jsx(Y$,{})})},Gme=me(we,e=>{const t=e.nodes.nodes,n=e.nodes.nodeTemplates;return t.some(o=>{const s=n[o.data.type];return UN(o,s)})},Ie),qme=()=>H(Gme),Kme=()=>{const e=le(),{t}=Q(),n=qme(),r=l.useCallback(()=>{e(yP())},[e]),o=l.useCallback(()=>{e(GN())},[e]);return a.jsxs(N,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:2},children:[a.jsx(rt,{tooltip:t("nodes.addNodeToolTip"),"aria-label":t("nodes.addNode"),icon:a.jsx(Zi,{}),onClick:r}),n&&a.jsx(Dt,{leftIcon:a.jsx(s0,{}),onClick:o,children:t("nodes.updateAllNodes")})]})},Qme=l.memo(Kme),Xme=()=>{const e=le(),t=Q3("nodes"),{t:n}=Q();return l.useCallback(o=>{if(!o)return;const s=new FileReader;s.onload=async()=>{const i=s.result;try{const c=JSON.parse(String(i)),d=KI.safeParse(c);if(!d.success){const{message:p}=qN(d.error,{prefix:n("nodes.workflowValidation")});t.error({error:KN(d.error)},p),e(Ht(rr({title:n("nodes.unableToValidateWorkflow"),status:"error",duration:5e3}))),s.abort();return}e(Vx(d.data)),s.abort()}catch{e(Ht(rr({title:n("nodes.unableToLoadWorkflow"),status:"error"})))}},s.readAsText(o)},[e,t,n])},Yme=l.memo(e=>e.error.issues[0]?a.jsx(je,{children:wS(e.error.issues[0],{prefix:null}).toString()}):a.jsx(zf,{children:e.error.issues.map((t,n)=>a.jsx(Ps,{children:a.jsx(je,{children:wS(t,{prefix:null}).toString()})},n))}));Yme.displayName="WorkflowValidationErrorContent";const Jme=()=>{const{t:e}=Q(),t=l.useRef(null),n=Xme();return a.jsx(vM,{resetRef:t,accept:"application/json",onChange:n,children:r=>a.jsx(rt,{icon:a.jsx(i0,{}),tooltip:e("nodes.loadWorkflow"),"aria-label":e("nodes.loadWorkflow"),...r})})},Zme=l.memo(Jme),ege=()=>{const{t:e}=Q(),t=le(),{isOpen:n,onOpen:r,onClose:o}=hs(),s=l.useRef(null),i=H(d=>d.nodes.nodes.length),c=l.useCallback(()=>{t(QN()),t(Ht(rr({title:e("toast.nodesCleared"),status:"success"}))),o()},[t,e,o]);return a.jsxs(a.Fragment,{children:[a.jsx(rt,{icon:a.jsx(Zo,{}),tooltip:e("nodes.resetWorkflow"),"aria-label":e("nodes.resetWorkflow"),onClick:r,isDisabled:!i,colorScheme:"error"}),a.jsxs(Wf,{isOpen:n,onClose:o,leastDestructiveRef:s,isCentered:!0,children:[a.jsx(Aa,{}),a.jsxs(Vf,{children:[a.jsx(Oa,{fontSize:"lg",fontWeight:"bold",children:e("nodes.resetWorkflow")}),a.jsx(Ra,{py:4,children:a.jsxs(N,{flexDir:"column",gap:2,children:[a.jsx(je,{children:e("nodes.resetWorkflowDesc")}),a.jsx(je,{variant:"subtext",children:e("nodes.resetWorkflowDesc2")})]})}),a.jsxs(pi,{children:[a.jsx(nl,{ref:s,onClick:o,children:e("common.cancel")}),a.jsx(nl,{colorScheme:"error",ml:3,onClick:c,children:e("common.accept")})]})]})]})]})},tge=l.memo(ege),nge=()=>{const{t:e}=Q(),t=tA(),n=l.useCallback(()=>{const r=new Blob([JSON.stringify(t,null,2)]),o=document.createElement("a");o.href=URL.createObjectURL(r),o.download=`${t.name||"My Workflow"}.json`,document.body.appendChild(o),o.click(),o.remove()},[t]);return a.jsx(rt,{icon:a.jsx(Wu,{}),tooltip:e("nodes.downloadWorkflow"),"aria-label":e("nodes.downloadWorkflow"),onClick:n})},rge=l.memo(nge),oge=()=>a.jsxs(N,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:"50%",transform:"translate(-50%)"},children:[a.jsx(rge,{}),a.jsx(Zme,{}),a.jsx(tge,{})]}),sge=l.memo(oge),age=()=>a.jsx(N,{sx:{gap:2,flexDir:"column"},children:To(If,({title:e,description:t,color:n},r)=>a.jsx(Wn,{label:t,children:a.jsx(Va,{sx:{userSelect:"none",color:parseInt(n.split(".")[1]??"0",10)<500?"base.800":"base.50",bg:n},textAlign:"center",children:e})},r))}),ige=l.memo(age),lge=()=>{const{t:e}=Q(),t=le(),n=l.useCallback(()=>{t(XN())},[t]);return a.jsx(Dt,{leftIcon:a.jsx(Jee,{}),tooltip:e("nodes.reloadNodeTemplates"),"aria-label":e("nodes.reloadNodeTemplates"),onClick:n,children:e("nodes.reloadNodeTemplates")})},cge=l.memo(lge),_d={fontWeight:600},uge=me(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===YN.Full}},Ie),dge=De((e,t)=>{const{isOpen:n,onOpen:r,onClose:o}=hs(),s=le(),{shouldAnimateEdges:i,shouldValidateGraph:c,shouldSnapToGrid:d,shouldColorEdges:p,selectionModeIsChecked:h}=H(uge),m=l.useCallback(S=>{s(JN(S.target.checked))},[s]),g=l.useCallback(S=>{s(ZN(S.target.checked))},[s]),b=l.useCallback(S=>{s(e9(S.target.checked))},[s]),y=l.useCallback(S=>{s(t9(S.target.checked))},[s]),x=l.useCallback(S=>{s(n9(S.target.checked))},[s]),{t:w}=Q();return a.jsxs(a.Fragment,{children:[a.jsx(rt,{ref:t,"aria-label":w("nodes.workflowSettings"),tooltip:w("nodes.workflowSettings"),icon:a.jsx(GM,{}),onClick:r}),a.jsxs(vu,{isOpen:n,onClose:o,size:"2xl",isCentered:!0,children:[a.jsx(Aa,{}),a.jsxs(bu,{children:[a.jsx(Oa,{children:w("nodes.workflowSettings")}),a.jsx(Rg,{}),a.jsx(Ra,{children:a.jsxs(N,{sx:{flexDirection:"column",gap:4,py:4},children:[a.jsx(yo,{size:"sm",children:w("parameters.general")}),a.jsx(_r,{formLabelProps:_d,onChange:g,isChecked:i,label:w("nodes.animatedEdges"),helperText:w("nodes.animatedEdgesHelp")}),a.jsx(io,{}),a.jsx(_r,{formLabelProps:_d,isChecked:d,onChange:b,label:w("nodes.snapToGrid"),helperText:w("nodes.snapToGridHelp")}),a.jsx(io,{}),a.jsx(_r,{formLabelProps:_d,isChecked:p,onChange:y,label:w("nodes.colorCodeEdges"),helperText:w("nodes.colorCodeEdgesHelp")}),a.jsx(_r,{formLabelProps:_d,isChecked:h,onChange:x,label:w("nodes.fullyContainNodes"),helperText:w("nodes.fullyContainNodesHelp")}),a.jsx(yo,{size:"sm",pt:4,children:w("common.advanced")}),a.jsx(_r,{formLabelProps:_d,isChecked:c,onChange:m,label:w("nodes.validateConnections"),helperText:w("nodes.validateConnectionsHelp")}),a.jsx(cge,{})]})})]})]})]})}),fge=l.memo(dge),pge=()=>{const e=H(t=>t.nodes.shouldShowFieldTypeLegend);return a.jsxs(N,{sx:{gap:2,position:"absolute",top:2,insetInlineEnd:2},children:[a.jsx(fge,{}),e&&a.jsx(ige,{})]})},hge=l.memo(pge);function mge(){const e=le(),t=H(o=>o.nodes.nodeOpacity),{t:n}=Q(),r=l.useCallback(o=>{e(r9(o))},[e]);return a.jsx(N,{alignItems:"center",children:a.jsxs(Ny,{"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(Ly,{children:a.jsx(zy,{})}),a.jsx($y,{})]})})}const gge=()=>{const{t:e}=Q(),{zoomIn:t,zoomOut:n,fitView:r}=Jx(),o=le(),s=H(h=>h.nodes.shouldShowMinimapPanel),i=l.useCallback(()=>{t()},[t]),c=l.useCallback(()=>{n()},[n]),d=l.useCallback(()=>{r()},[r]),p=l.useCallback(()=>{o(o9(!s))},[s,o]);return a.jsxs(Hn,{isAttached:!0,orientation:"vertical",children:[a.jsx(rt,{tooltip:e("nodes.zoomInNodes"),"aria-label":e("nodes.zoomInNodes"),onClick:i,icon:a.jsx(use,{})}),a.jsx(rt,{tooltip:e("nodes.zoomOutNodes"),"aria-label":e("nodes.zoomOutNodes"),onClick:c,icon:a.jsx(cse,{})}),a.jsx(rt,{tooltip:e("nodes.fitViewportNodes"),"aria-label":e("nodes.fitViewportNodes"),onClick:d,icon:a.jsx(qM,{})}),a.jsx(rt,{tooltip:e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),"aria-label":e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),isChecked:s,onClick:p,icon:a.jsx(Bee,{})})]})},vge=l.memo(gge),bge=()=>a.jsxs(N,{sx:{gap:2,position:"absolute",bottom:2,insetInlineStart:2},children:[a.jsx(vge,{}),a.jsx(mge,{})]}),xge=l.memo(bge),yge=Ae(U$),Cge=()=>{const e=H(r=>r.nodes.shouldShowMinimapPanel),t=di("var(--invokeai-colors-accent-300)","var(--invokeai-colors-accent-600)"),n=di("var(--invokeai-colors-blackAlpha-300)","var(--invokeai-colors-blackAlpha-600)");return a.jsx(N,{sx:{gap:2,position:"absolute",bottom:2,insetInlineEnd:2},children:e&&a.jsx(yge,{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})})},wge=l.memo(Cge),Sge=()=>{const e=H(n=>n.nodes.isReady),{t}=Q();return a.jsxs(N,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center"},children:[a.jsx(So,{children:e&&a.jsxs(Ar.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(Ume,{}),a.jsx(Dhe,{}),a.jsx(Qme,{}),a.jsx(sge,{}),a.jsx(hge,{}),a.jsx(xge,{}),a.jsx(wge,{})]})}),a.jsx(So,{children:!e&&a.jsx(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"absolute",width:"100%",height:"100%"},children:a.jsx(N,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:a.jsx(eo,{label:t("nodes.loadingNodes"),icon:dse})})})})]})},kge=l.memo(Sge),jge=()=>a.jsx(s9,{children:a.jsx(kge,{})}),_ge=l.memo(jge),Ige=()=>{const{t:e}=Q(),t=le(),{data:n}=Ef(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=a9({fixedCacheKey:"clearInvocationCache"}),i=l.useMemo(()=>!(n!=null&&n.size)||!r,[n==null?void 0:n.size,r]);return{clearInvocationCache:l.useCallback(async()=>{if(!i)try{await o().unwrap(),t(Ht({title:e("invocationCache.clearSucceeded"),status:"success"}))}catch{t(Ht({title:e("invocationCache.clearFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},Pge=()=>{const{t:e}=Q(),{clearInvocationCache:t,isDisabled:n,isLoading:r}=Ige();return a.jsx(Dt,{isDisabled:n,isLoading:r,onClick:t,children:e("invocationCache.clear")})},Ege=l.memo(Pge),Mge=()=>{const{t:e}=Q(),t=le(),{data:n}=Ef(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=i9({fixedCacheKey:"disableInvocationCache"}),i=l.useMemo(()=>!(n!=null&&n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{disableInvocationCache:l.useCallback(async()=>{if(!i)try{await o().unwrap(),t(Ht({title:e("invocationCache.disableSucceeded"),status:"success"}))}catch{t(Ht({title:e("invocationCache.disableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},Oge=()=>{const{t:e}=Q(),t=le(),{data:n}=Ef(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=l9({fixedCacheKey:"enableInvocationCache"}),i=l.useMemo(()=>(n==null?void 0:n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{enableInvocationCache:l.useCallback(async()=>{if(!i)try{await o().unwrap(),t(Ht({title:e("invocationCache.enableSucceeded"),status:"success"}))}catch{t(Ht({title:e("invocationCache.enableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},Age=()=>{const{t:e}=Q(),{data:t}=Ef(),{enableInvocationCache:n,isDisabled:r,isLoading:o}=Oge(),{disableInvocationCache:s,isDisabled:i,isLoading:c}=Mge();return t!=null&&t.enabled?a.jsx(Dt,{isDisabled:i,isLoading:c,onClick:s,children:e("invocationCache.disable")}):a.jsx(Dt,{isDisabled:r,isLoading:o,onClick:n,children:e("invocationCache.enable")})},Rge=l.memo(Age),Dge=({children:e,...t})=>a.jsx(W3,{alignItems:"center",justifyContent:"center",w:"full",h:"full",layerStyle:"second",borderRadius:"base",py:2,px:3,gap:6,flexWrap:"nowrap",...t,children:e}),eR=l.memo(Dge),Tge={'&[aria-disabled="true"]':{color:"base.400",_dark:{color:"base.500"}}},Nge=({label:e,value:t,isDisabled:n=!1,...r})=>a.jsxs(H3,{flexGrow:1,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap","aria-disabled":n,sx:Tge,...r,children:[a.jsx(V3,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:e}),a.jsx(U3,{children:t})]}),Ca=l.memo(Nge),$ge=()=>{const{t:e}=Q(),{data:t}=Ef(void 0);return a.jsxs(eR,{children:[a.jsx(Ca,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.cacheSize"),value:(t==null?void 0:t.size)??0}),a.jsx(Ca,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.hits"),value:(t==null?void 0:t.hits)??0}),a.jsx(Ca,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.misses"),value:(t==null?void 0:t.misses)??0}),a.jsx(Ca,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.maxCacheSize"),value:(t==null?void 0:t.max_size)??0}),a.jsxs(Hn,{w:24,orientation:"vertical",size:"xs",children:[a.jsx(Ege,{}),a.jsx(Rge,{})]})]})},Lge=l.memo($ge),tR=e=>{const t=H(c=>c.system.isConnected),[n,{isLoading:r}]=Gx(),o=le(),{t:s}=Q();return{cancelQueueItem:l.useCallback(async()=>{try{await n(e).unwrap(),o(Ht({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(Ht({title:s("queue.cancelFailed"),status:"error"}))}},[o,e,s,n]),isLoading:r,isDisabled:!t}},nR=(e,t)=>Number(((Date.parse(t)-Date.parse(e))/1e3).toFixed(2)),oI={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"}},zge=({status:e})=>{const{t}=Q();return a.jsx(Va,{colorScheme:oI[e].colorScheme,children:t(oI[e].translationKey)})},Fge=l.memo(zge),Bge=e=>{const t=H(d=>d.system.isConnected),{isCanceled:n}=c9({batch_id:e},{selectFromResult:({data:d})=>d?{isCanceled:(d==null?void 0:d.in_progress)===0&&(d==null?void 0:d.pending)===0}:{isCanceled:!0}}),[r,{isLoading:o}]=u9({fixedCacheKey:"cancelByBatchIds"}),s=le(),{t:i}=Q();return{cancelBatch:l.useCallback(async()=>{if(!n)try{await r({batch_ids:[e]}).unwrap(),s(Ht({title:i("queue.cancelBatchSucceeded"),status:"success"}))}catch{s(Ht({title:i("queue.cancelBatchFailed"),status:"error"}))}},[e,s,n,i,r]),isLoading:o,isCanceled:n,isDisabled:!t}},Hge=({queueItemDTO:e})=>{const{session_id:t,batch_id:n,item_id:r}=e,{t:o}=Q(),{cancelBatch:s,isLoading:i,isCanceled:c}=Bge(n),{cancelQueueItem:d,isLoading:p}=tR(r),{data:h}=d9(r),m=l.useMemo(()=>{if(!h)return o("common.loading");if(!h.completed_at||!h.started_at)return o(`queue.${h.status}`);const g=nR(h.started_at,h.completed_at);return h.status==="completed"?`${o("queue.completedIn")} ${g}${g===1?"":"s"}`:`${g}s`},[h,o]);return a.jsxs(N,{layerStyle:"third",flexDir:"column",p:2,pt:0,borderRadius:"base",gap:2,children:[a.jsxs(N,{layerStyle:"second",p:2,gap:2,justifyContent:"space-between",alignItems:"center",borderRadius:"base",h:20,children:[a.jsx(jh,{label:o("queue.status"),data:m}),a.jsx(jh,{label:o("queue.item"),data:r}),a.jsx(jh,{label:o("queue.batch"),data:n}),a.jsx(jh,{label:o("queue.session"),data:t}),a.jsxs(Hn,{size:"xs",orientation:"vertical",children:[a.jsx(Dt,{onClick:d,isLoading:p,isDisabled:h?["canceled","completed","failed"].includes(h.status):!0,"aria-label":o("queue.cancelItem"),icon:a.jsx(ku,{}),colorScheme:"error",children:o("queue.cancelItem")}),a.jsx(Dt,{onClick:s,isLoading:i,isDisabled:c,"aria-label":o("queue.cancelBatch"),icon:a.jsx(ku,{}),colorScheme:"error",children:o("queue.cancelBatch")})]})]}),(h==null?void 0:h.error)&&a.jsxs(N,{layerStyle:"second",p:3,gap:1,justifyContent:"space-between",alignItems:"flex-start",borderRadius:"base",flexDir:"column",children:[a.jsx(yo,{size:"sm",color:"error.500",_dark:{color:"error.400"},children:"Error"}),a.jsx("pre",{children:h.error})]}),a.jsx(N,{layerStyle:"second",h:512,w:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",children:h?a.jsx(cc,{children:a.jsx(tl,{label:"Queue Item",data:h})}):a.jsx(Ci,{opacity:.5})})]})},Wge=l.memo(Hge),jh=({label:e,data:t})=>a.jsxs(N,{flexDir:"column",justifyContent:"flex-start",p:1,gap:1,overflow:"hidden",h:"full",w:"full",children:[a.jsx(yo,{size:"md",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:e}),a.jsx(je,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),Sa={number:"3rem",statusBadge:"5.7rem",statusDot:2,time:"4rem",batchId:"5rem",fieldValues:"auto",actions:"auto"},sI={bg:"base.300",_dark:{bg:"base.750"}},Vge={_hover:sI,"&[aria-selected='true']":sI},Uge=({index:e,item:t,context:n})=>{const{t:r}=Q(),o=l.useCallback(()=>{n.toggleQueueItem(t.item_id)},[n,t.item_id]),{cancelQueueItem:s,isLoading:i}=tR(t.item_id),c=l.useCallback(m=>{m.stopPropagation(),s()},[s]),d=l.useMemo(()=>n.openQueueItems.includes(t.item_id),[n.openQueueItems,t.item_id]),p=l.useMemo(()=>!t.completed_at||!t.started_at?void 0:`${nR(t.started_at,t.completed_at)}s`,[t]),h=l.useMemo(()=>["canceled","completed","failed"].includes(t.status),[t.status]);return a.jsxs(N,{flexDir:"column","aria-selected":d,fontSize:"sm",borderRadius:"base",justifyContent:"center",sx:Vge,"data-testid":"queue-item",children:[a.jsxs(N,{minH:9,alignItems:"center",gap:4,p:1.5,cursor:"pointer",onClick:o,children:[a.jsx(N,{w:Sa.number,justifyContent:"flex-end",alignItems:"center",flexShrink:0,children:a.jsx(je,{variant:"subtext",children:e+1})}),a.jsx(N,{w:Sa.statusBadge,alignItems:"center",flexShrink:0,children:a.jsx(Fge,{status:t.status})}),a.jsx(N,{w:Sa.time,alignItems:"center",flexShrink:0,children:p||"-"}),a.jsx(N,{w:Sa.batchId,flexShrink:0,children:a.jsx(je,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",alignItems:"center",children:t.batch_id})}),a.jsx(N,{alignItems:"center",overflow:"hidden",flexGrow:1,children:t.field_values&&a.jsx(N,{gap:2,w:"full",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:t.field_values.filter(m=>m.node_path!=="metadata_accumulator").map(({node_path:m,field_name:g,value:b})=>a.jsxs(je,{as:"span",children:[a.jsxs(je,{as:"span",fontWeight:600,children:[m,".",g]}),": ",b]},`${t.item_id}.${m}.${g}.${b}`))})}),a.jsx(N,{alignItems:"center",w:Sa.actions,pe:3,children:a.jsx(Hn,{size:"xs",variant:"ghost",children:a.jsx(rt,{onClick:c,isDisabled:h,isLoading:i,"aria-label":r("queue.cancelItem"),icon:a.jsx(ku,{})})})})]}),a.jsx(Af,{in:d,transition:{enter:{duration:.1},exit:{duration:.1}},unmountOnExit:!0,children:a.jsx(Wge,{queueItemDTO:t})})]})},Gge=l.memo(Uge),qge=l.memo(De((e,t)=>a.jsx(N,{...e,ref:t,flexDirection:"column",gap:.5,children:e.children}))),Kge=l.memo(qge),Qge=()=>{const{t:e}=Q();return a.jsxs(N,{alignItems:"center",gap:4,p:1,pb:2,textTransform:"uppercase",fontWeight:700,fontSize:"xs",letterSpacing:1,children:[a.jsx(N,{w:Sa.number,justifyContent:"flex-end",alignItems:"center",children:a.jsx(je,{variant:"subtext",children:"#"})}),a.jsx(N,{ps:.5,w:Sa.statusBadge,alignItems:"center",children:a.jsx(je,{variant:"subtext",children:e("queue.status")})}),a.jsx(N,{ps:.5,w:Sa.time,alignItems:"center",children:a.jsx(je,{variant:"subtext",children:e("queue.time")})}),a.jsx(N,{ps:.5,w:Sa.batchId,alignItems:"center",children:a.jsx(je,{variant:"subtext",children:e("queue.batch")})}),a.jsx(N,{ps:.5,w:Sa.fieldValues,alignItems:"center",children:a.jsx(je,{variant:"subtext",children:e("queue.batchFieldValues")})})]})},Xge=l.memo(Qge),Yge={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},Jge=me(we,({queue:e})=>{const{listCursor:t,listPriority:n}=e;return{listCursor:t,listPriority:n}},Ie),Zge=(e,t)=>t.item_id,e0e={List:Kge},t0e=(e,t,n)=>a.jsx(Gge,{index:e,item:t,context:n}),n0e=()=>{const{listCursor:e,listPriority:t}=H(Jge),n=le(),r=l.useRef(null),[o,s]=l.useState(null),[i,c]=y2(Yge),{t:d}=Q();l.useEffect(()=>{const{current:S}=r;return o&&S&&i({target:S,elements:{viewport:o}}),()=>{var j;return(j=c())==null?void 0:j.destroy()}},[o,i,c]);const{data:p,isLoading:h}=f9({cursor:e,priority:t}),m=l.useMemo(()=>p?p9.getSelectors().selectAll(p):[],[p]),g=l.useCallback(()=>{if(!(p!=null&&p.has_more))return;const S=m[m.length-1];S&&(n(qx(S.item_id)),n(Kx(S.priority)))},[n,p==null?void 0:p.has_more,m]),[b,y]=l.useState([]),x=l.useCallback(S=>{y(j=>j.includes(S)?j.filter(I=>I!==S):[...j,S])},[]),w=l.useMemo(()=>({openQueueItems:b,toggleQueueItem:x}),[b,x]);return h?a.jsx(jre,{}):m.length?a.jsxs(N,{w:"full",h:"full",flexDir:"column",children:[a.jsx(Xge,{}),a.jsx(N,{ref:r,w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx($oe,{data:m,endReached:g,scrollerRef:s,itemContent:t0e,computeItemKey:Zge,components:e0e,context:w})})]}):a.jsx(N,{w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(yo,{color:"base.400",_dark:{color:"base.500"},children:d("queue.queueEmpty")})})},r0e=l.memo(n0e),o0e=()=>{const{data:e}=Ha(),{t}=Q();return a.jsxs(eR,{"data-testid":"queue-status",children:[a.jsx(Ca,{label:t("queue.in_progress"),value:(e==null?void 0:e.queue.in_progress)??0}),a.jsx(Ca,{label:t("queue.pending"),value:(e==null?void 0:e.queue.pending)??0}),a.jsx(Ca,{label:t("queue.completed"),value:(e==null?void 0:e.queue.completed)??0}),a.jsx(Ca,{label:t("queue.failed"),value:(e==null?void 0:e.queue.failed)??0}),a.jsx(Ca,{label:t("queue.canceled"),value:(e==null?void 0:e.queue.canceled)??0}),a.jsx(Ca,{label:t("queue.total"),value:(e==null?void 0:e.queue.total)??0})]})},s0e=l.memo(o0e);function a0e(e){return Ye({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 i0e=()=>{const e=le(),{t}=Q(),n=H(d=>d.system.isConnected),[r,{isLoading:o}]=pP({fixedCacheKey:"pruneQueue"}),{finishedCount:s}=Ha(void 0,{selectFromResult:({data:d})=>d?{finishedCount:d.queue.completed+d.queue.canceled+d.queue.failed}:{finishedCount:0}}),i=l.useCallback(async()=>{if(s)try{const d=await r().unwrap();e(Ht({title:t("queue.pruneSucceeded",{item_count:d.deleted}),status:"success"})),e(qx(void 0)),e(Kx(void 0))}catch{e(Ht({title:t("queue.pruneFailed"),status:"error"}))}},[s,r,e,t]),c=l.useMemo(()=>!n||!s,[s,n]);return{pruneQueue:i,isLoading:o,finishedCount:s,isDisabled:c}},l0e=({asIconButton:e})=>{const{t}=Q(),{pruneQueue:n,isLoading:r,finishedCount:o,isDisabled:s}=i0e();return a.jsx(lc,{isDisabled:s,isLoading:r,asIconButton:e,label:t("queue.prune"),tooltip:t("queue.pruneTooltip",{item_count:o}),icon:a.jsx(a0e,{}),onClick:n,colorScheme:"blue"})},c0e=l.memo(l0e),u0e=()=>{const e=Pn("pauseQueue").isFeatureEnabled,t=Pn("resumeQueue").isFeatureEnabled;return a.jsxs(N,{layerStyle:"second",borderRadius:"base",p:2,gap:2,children:[e||t?a.jsxs(Hn,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[t?a.jsx(L8,{}):a.jsx(a.Fragment,{}),e?a.jsx(A8,{}):a.jsx(a.Fragment,{})]}):a.jsx(a.Fragment,{}),a.jsxs(Hn,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[a.jsx(c0e,{}),a.jsx(B2,{})]})]})},d0e=l.memo(u0e),f0e=()=>{const e=Pn("invocationCache").isFeatureEnabled;return a.jsxs(N,{layerStyle:"first",borderRadius:"base",w:"full",h:"full",p:2,flexDir:"column",gap:2,children:[a.jsxs(N,{gap:2,w:"full",children:[a.jsx(d0e,{}),a.jsx(s0e,{}),e&&a.jsx(Lge,{})]}),a.jsx(Le,{layerStyle:"second",p:2,borderRadius:"base",w:"full",h:"full",children:a.jsx(r0e,{})})]})},p0e=l.memo(f0e),h0e=()=>a.jsx(p0e,{}),m0e=l.memo(h0e),g0e=()=>a.jsx(FA,{}),v0e=l.memo(g0e);var kx={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var n=SS;Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return n.Konva}});const r=SS;e.exports=r.Konva})(kx,kx.exports);var b0e=kx.exports;const Cf=Sf(b0e);var rR={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 x0e=function(t){var n={},r=l,o=Ih,s=Object.assign;function i(u){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+u,v=1;vce||k[L]!==P[ce]){var be=` `+k[L].replace(" at new "," at ");return u.displayName&&be.includes("")&&(be=be.replace("",u.displayName)),be}while(1<=L&&0<=ce);break}}}finally{tn=!1,Error.prepareStackTrace=v}return(u=u?u.displayName||u.name:"")?Ut(u):""}var an=Object.prototype.hasOwnProperty,Yt=[],Ve=-1;function Ct(u){return{current:u}}function Ft(u){0>Ve||(u.current=Yt[Ve],Yt[Ve]=null,Ve--)}function Qt(u,f){Ve++,Yt[Ve]=u.current,u.current=f}var Ln={},Jt=Ct(Ln),yn=Ct(!1),hn=Ln;function Hr(u,f){var v=u.type.contextTypes;if(!v)return Ln;var C=u.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===f)return C.__reactInternalMemoizedMaskedChildContext;var k={},P;for(P in v)k[P]=f[P];return C&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=f,u.__reactInternalMemoizedMaskedChildContext=k),k}function pr(u){return u=u.childContextTypes,u!=null}function Tt(){Ft(yn),Ft(Jt)}function zn(u,f,v){if(Jt.current!==Ln)throw Error(i(168));Qt(Jt,f),Qt(yn,v)}function Gn(u,f,v){var C=u.stateNode;if(f=f.childContextTypes,typeof C.getChildContext!="function")return v;C=C.getChildContext();for(var k in C)if(!(k in f))throw Error(i(108,R(u)||"Unknown",k));return s({},v,C)}function hr(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||Ln,hn=Jt.current,Qt(Jt,u),Qt(yn,yn.current),!0}function Pr(u,f,v){var C=u.stateNode;if(!C)throw Error(i(169));v?(u=Gn(u,f,hn),C.__reactInternalMemoizedMergedChildContext=u,Ft(yn),Ft(Jt),Qt(Jt,u)):Ft(yn),Qt(yn,v)}var er=Math.clz32?Math.clz32:An,qn=Math.log,Cn=Math.LN2;function An(u){return u>>>=0,u===0?32:31-(qn(u)/Cn|0)|0}var Rn=64,jn=4194304;function Fn(u){switch(u&-u){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return u&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return u}}function Zt(u,f){var v=u.pendingLanes;if(v===0)return 0;var C=0,k=u.suspendedLanes,P=u.pingedLanes,L=v&268435455;if(L!==0){var ce=L&~k;ce!==0?C=Fn(ce):(P&=L,P!==0&&(C=Fn(P)))}else L=v&~k,L!==0?C=Fn(L):P!==0&&(C=Fn(P));if(C===0)return 0;if(f!==0&&f!==C&&!(f&k)&&(k=C&-C,P=f&-f,k>=P||k===16&&(P&4194240)!==0))return f;if(C&4&&(C|=v&16),f=u.entangledLanes,f!==0)for(u=u.entanglements,f&=C;0v;v++)f.push(u);return f}function Bt(u,f,v){u.pendingLanes|=f,f!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,f=31-er(f),u[f]=v}function Ue(u,f){var v=u.pendingLanes&~f;u.pendingLanes=f,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=f,u.mutableReadLanes&=f,u.entangledLanes&=f,f=u.entanglements;var C=u.eventTimes;for(u=u.expirationTimes;0>=L,k-=L,rs=1<<32-er(f)+k|v<Dn?(so=sn,sn=null):so=sn.sibling;var Tn=ut(ve,sn,Ce[Dn],dt);if(Tn===null){sn===null&&(sn=so);break}u&&sn&&Tn.alternate===null&&f(ve,sn),fe=P(Tn,fe,Dn),un===null?Wt=Tn:un.sibling=Tn,un=Tn,sn=so}if(Dn===Ce.length)return v(ve,sn),mr&&xl(ve,Dn),Wt;if(sn===null){for(;DnDn?(so=sn,sn=null):so=sn.sibling;var Fi=ut(ve,sn,Tn.value,dt);if(Fi===null){sn===null&&(sn=so);break}u&&sn&&Fi.alternate===null&&f(ve,sn),fe=P(Fi,fe,Dn),un===null?Wt=Fi:un.sibling=Fi,un=Fi,sn=so}if(Tn.done)return v(ve,sn),mr&&xl(ve,Dn),Wt;if(sn===null){for(;!Tn.done;Dn++,Tn=Ce.next())Tn=on(ve,Tn.value,dt),Tn!==null&&(fe=P(Tn,fe,Dn),un===null?Wt=Tn:un.sibling=Tn,un=Tn);return mr&&xl(ve,Dn),Wt}for(sn=C(ve,sn);!Tn.done;Dn++,Tn=Ce.next())Tn=fr(sn,ve,Dn,Tn.value,dt),Tn!==null&&(u&&Tn.alternate!==null&&sn.delete(Tn.key===null?Dn:Tn.key),fe=P(Tn,fe,Dn),un===null?Wt=Tn:un.sibling=Tn,un=Tn);return u&&sn.forEach(function(qR){return f(ve,qR)}),mr&&xl(ve,Dn),Wt}function Ja(ve,fe,Ce,dt){if(typeof Ce=="object"&&Ce!==null&&Ce.type===h&&Ce.key===null&&(Ce=Ce.props.children),typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case d:e:{for(var Wt=Ce.key,un=fe;un!==null;){if(un.key===Wt){if(Wt=Ce.type,Wt===h){if(un.tag===7){v(ve,un.sibling),fe=k(un,Ce.props.children),fe.return=ve,ve=fe;break e}}else if(un.elementType===Wt||typeof Wt=="object"&&Wt!==null&&Wt.$$typeof===I&&kC(Wt)===un.type){v(ve,un.sibling),fe=k(un,Ce.props),fe.ref=ed(ve,un,Ce),fe.return=ve,ve=fe;break e}v(ve,un);break}else f(ve,un);un=un.sibling}Ce.type===h?(fe=_l(Ce.props.children,ve.mode,dt,Ce.key),fe.return=ve,ve=fe):(dt=Fp(Ce.type,Ce.key,Ce.props,null,ve.mode,dt),dt.ref=ed(ve,fe,Ce),dt.return=ve,ve=dt)}return L(ve);case p:e:{for(un=Ce.key;fe!==null;){if(fe.key===un)if(fe.tag===4&&fe.stateNode.containerInfo===Ce.containerInfo&&fe.stateNode.implementation===Ce.implementation){v(ve,fe.sibling),fe=k(fe,Ce.children||[]),fe.return=ve,ve=fe;break e}else{v(ve,fe);break}else f(ve,fe);fe=fe.sibling}fe=Fv(Ce,ve.mode,dt),fe.return=ve,ve=fe}return L(ve);case I:return un=Ce._init,Ja(ve,fe,un(Ce._payload),dt)}if(Z(Ce))return tr(ve,fe,Ce,dt);if(E(Ce))return Ho(ve,fe,Ce,dt);hp(ve,Ce)}return typeof Ce=="string"&&Ce!==""||typeof Ce=="number"?(Ce=""+Ce,fe!==null&&fe.tag===6?(v(ve,fe.sibling),fe=k(fe,Ce),fe.return=ve,ve=fe):(v(ve,fe),fe=zv(Ce,ve.mode,dt),fe.return=ve,ve=fe),L(ve)):v(ve,fe)}return Ja}var mc=jC(!0),_C=jC(!1),td={},ys=Ct(td),nd=Ct(td),gc=Ct(td);function ma(u){if(u===td)throw Error(i(174));return u}function Z0(u,f){Qt(gc,f),Qt(nd,u),Qt(ys,td),u=V(f),Ft(ys),Qt(ys,u)}function vc(){Ft(ys),Ft(nd),Ft(gc)}function IC(u){var f=ma(gc.current),v=ma(ys.current);f=oe(v,u.type,f),v!==f&&(Qt(nd,u),Qt(ys,f))}function ev(u){nd.current===u&&(Ft(ys),Ft(nd))}var wr=Ct(0);function mp(u){for(var f=u;f!==null;){if(f.tag===13){var v=f.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||Br(v)||ts(v)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if(f.flags&128)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var tv=[];function nv(){for(var u=0;uv?v:4,u(!0);var C=rv.transition;rv.transition={};try{u(!1),f()}finally{Oe=v,rv.transition=C}}function UC(){return Cs().memoizedState}function yR(u,f,v){var C=$i(u);if(v={lane:C,action:v,hasEagerState:!1,eagerState:null,next:null},GC(u))qC(f,v);else if(v=gC(u,f,v,C),v!==null){var k=bo();ws(v,u,C,k),KC(v,f,C)}}function CR(u,f,v){var C=$i(u),k={lane:C,action:v,hasEagerState:!1,eagerState:null,next:null};if(GC(u))qC(f,k);else{var P=u.alternate;if(u.lanes===0&&(P===null||P.lanes===0)&&(P=f.lastRenderedReducer,P!==null))try{var L=f.lastRenderedState,ce=P(L,v);if(k.hasEagerState=!0,k.eagerState=ce,dr(ce,L)){var be=f.interleaved;be===null?(k.next=k,Q0(f)):(k.next=be.next,be.next=k),f.interleaved=k;return}}catch{}finally{}v=gC(u,f,k,C),v!==null&&(k=bo(),ws(v,u,C,k),KC(v,f,C))}}function GC(u){var f=u.alternate;return u===Sr||f!==null&&f===Sr}function qC(u,f){rd=vp=!0;var v=u.pending;v===null?f.next=f:(f.next=v.next,v.next=f),u.pending=f}function KC(u,f,v){if(v&4194240){var C=f.lanes;C&=u.pendingLanes,v|=C,f.lanes=v,Be(u,v)}}var yp={readContext:xs,useCallback:mo,useContext:mo,useEffect:mo,useImperativeHandle:mo,useInsertionEffect:mo,useLayoutEffect:mo,useMemo:mo,useReducer:mo,useRef:mo,useState:mo,useDebugValue:mo,useDeferredValue:mo,useTransition:mo,useMutableSource:mo,useSyncExternalStore:mo,useId:mo,unstable_isNewReconciler:!1},wR={readContext:xs,useCallback:function(u,f){return ga().memoizedState=[u,f===void 0?null:f],u},useContext:xs,useEffect:$C,useImperativeHandle:function(u,f,v){return v=v!=null?v.concat([u]):null,bp(4194308,4,FC.bind(null,f,u),v)},useLayoutEffect:function(u,f){return bp(4194308,4,u,f)},useInsertionEffect:function(u,f){return bp(4,2,u,f)},useMemo:function(u,f){var v=ga();return f=f===void 0?null:f,u=u(),v.memoizedState=[u,f],u},useReducer:function(u,f,v){var C=ga();return f=v!==void 0?v(f):f,C.memoizedState=C.baseState=f,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:f},C.queue=u,u=u.dispatch=yR.bind(null,Sr,u),[C.memoizedState,u]},useRef:function(u){var f=ga();return u={current:u},f.memoizedState=u},useState:TC,useDebugValue:uv,useDeferredValue:function(u){return ga().memoizedState=u},useTransition:function(){var u=TC(!1),f=u[0];return u=xR.bind(null,u[1]),ga().memoizedState=u,[f,u]},useMutableSource:function(){},useSyncExternalStore:function(u,f,v){var C=Sr,k=ga();if(mr){if(v===void 0)throw Error(i(407));v=v()}else{if(v=f(),oo===null)throw Error(i(349));Cl&30||MC(C,f,v)}k.memoizedState=v;var P={value:v,getSnapshot:f};return k.queue=P,$C(AC.bind(null,C,P,u),[u]),C.flags|=2048,ad(9,OC.bind(null,C,P,v,f),void 0,null),v},useId:function(){var u=ga(),f=oo.identifierPrefix;if(mr){var v=ho,C=rs;v=(C&~(1<<32-er(C)-1)).toString(32)+v,f=":"+f+"R"+v,v=od++,0Ov&&(f.flags|=128,C=!0,cd(k,!1),f.lanes=4194304)}else{if(!C)if(u=mp(P),u!==null){if(f.flags|=128,C=!0,u=u.updateQueue,u!==null&&(f.updateQueue=u,f.flags|=4),cd(k,!0),k.tail===null&&k.tailMode==="hidden"&&!P.alternate&&!mr)return go(f),null}else 2*Ze()-k.renderingStartTime>Ov&&v!==1073741824&&(f.flags|=128,C=!0,cd(k,!1),f.lanes=4194304);k.isBackwards?(P.sibling=f.child,f.child=P):(u=k.last,u!==null?u.sibling=P:f.child=P,k.last=P)}return k.tail!==null?(f=k.tail,k.rendering=f,k.tail=f.sibling,k.renderingStartTime=Ze(),f.sibling=null,u=wr.current,Qt(wr,C?u&1|2:u&1),f):(go(f),null);case 22:case 23:return Nv(),v=f.memoizedState!==null,u!==null&&u.memoizedState!==null!==v&&(f.flags|=8192),v&&f.mode&1?ss&1073741824&&(go(f),ee&&f.subtreeFlags&6&&(f.flags|=8192)):go(f),null;case 24:return null;case 25:return null}throw Error(i(156,f.tag))}function MR(u,f){switch(B0(f),f.tag){case 1:return pr(f.type)&&Tt(),u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 3:return vc(),Ft(yn),Ft(Jt),nv(),u=f.flags,u&65536&&!(u&128)?(f.flags=u&-65537|128,f):null;case 5:return ev(f),null;case 13:if(Ft(wr),u=f.memoizedState,u!==null&&u.dehydrated!==null){if(f.alternate===null)throw Error(i(340));fc()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 19:return Ft(wr),null;case 4:return vc(),null;case 10:return q0(f.type._context),null;case 22:case 23:return Nv(),null;case 24:return null;default:return null}}var jp=!1,vo=!1,OR=typeof WeakSet=="function"?WeakSet:Set,bt=null;function xc(u,f){var v=u.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(C){gr(u,f,C)}else v.current=null}function xv(u,f,v){try{v()}catch(C){gr(u,f,C)}}var pw=!1;function AR(u,f){for(ne(u.containerInfo),bt=f;bt!==null;)if(u=bt,f=u.child,(u.subtreeFlags&1028)!==0&&f!==null)f.return=u,bt=f;else for(;bt!==null;){u=bt;try{var v=u.alternate;if(u.flags&1024)switch(u.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var C=v.memoizedProps,k=v.memoizedState,P=u.stateNode,L=P.getSnapshotBeforeUpdate(u.elementType===u.type?C:Gs(u.type,C),k);P.__reactInternalSnapshotBeforeUpdate=L}break;case 3:ee&&dn(u.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(ce){gr(u,u.return,ce)}if(f=u.sibling,f!==null){f.return=u.return,bt=f;break}bt=u.return}return v=pw,pw=!1,v}function ud(u,f,v){var C=f.updateQueue;if(C=C!==null?C.lastEffect:null,C!==null){var k=C=C.next;do{if((k.tag&u)===u){var P=k.destroy;k.destroy=void 0,P!==void 0&&xv(f,v,P)}k=k.next}while(k!==C)}}function _p(u,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&u)===u){var C=v.create;v.destroy=C()}v=v.next}while(v!==f)}}function yv(u){var f=u.ref;if(f!==null){var v=u.stateNode;switch(u.tag){case 5:u=te(v);break;default:u=v}typeof f=="function"?f(u):f.current=u}}function hw(u){var f=u.alternate;f!==null&&(u.alternate=null,hw(f)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(f=u.stateNode,f!==null&&Pe(f)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function mw(u){return u.tag===5||u.tag===3||u.tag===4}function gw(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||mw(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function Cv(u,f,v){var C=u.tag;if(C===5||C===6)u=u.stateNode,f?En(v,u,f):lt(v,u);else if(C!==4&&(u=u.child,u!==null))for(Cv(u,f,v),u=u.sibling;u!==null;)Cv(u,f,v),u=u.sibling}function wv(u,f,v){var C=u.tag;if(C===5||C===6)u=u.stateNode,f?Qe(v,u,f):ke(v,u);else if(C!==4&&(u=u.child,u!==null))for(wv(u,f,v),u=u.sibling;u!==null;)wv(u,f,v),u=u.sibling}var uo=null,qs=!1;function ba(u,f,v){for(v=v.child;v!==null;)Sv(u,f,v),v=v.sibling}function Sv(u,f,v){if(_n&&typeof _n.onCommitFiberUnmount=="function")try{_n.onCommitFiberUnmount(cr,v)}catch{}switch(v.tag){case 5:vo||xc(v,f);case 6:if(ee){var C=uo,k=qs;uo=null,ba(u,f,v),uo=C,qs=k,uo!==null&&(qs?ct(uo,v.stateNode):Te(uo,v.stateNode))}else ba(u,f,v);break;case 18:ee&&uo!==null&&(qs?Ge(uo,v.stateNode):wt(uo,v.stateNode));break;case 4:ee?(C=uo,k=qs,uo=v.stateNode.containerInfo,qs=!0,ba(u,f,v),uo=C,qs=k):(J&&(C=v.stateNode.containerInfo,k=ir(C),Mn(C,k)),ba(u,f,v));break;case 0:case 11:case 14:case 15:if(!vo&&(C=v.updateQueue,C!==null&&(C=C.lastEffect,C!==null))){k=C=C.next;do{var P=k,L=P.destroy;P=P.tag,L!==void 0&&(P&2||P&4)&&xv(v,f,L),k=k.next}while(k!==C)}ba(u,f,v);break;case 1:if(!vo&&(xc(v,f),C=v.stateNode,typeof C.componentWillUnmount=="function"))try{C.props=v.memoizedProps,C.state=v.memoizedState,C.componentWillUnmount()}catch(ce){gr(v,f,ce)}ba(u,f,v);break;case 21:ba(u,f,v);break;case 22:v.mode&1?(vo=(C=vo)||v.memoizedState!==null,ba(u,f,v),vo=C):ba(u,f,v);break;default:ba(u,f,v)}}function vw(u){var f=u.updateQueue;if(f!==null){u.updateQueue=null;var v=u.stateNode;v===null&&(v=u.stateNode=new OR),f.forEach(function(C){var k=BR.bind(null,u,C);v.has(C)||(v.add(C),C.then(k,k))})}}function Ks(u,f){var v=f.deletions;if(v!==null)for(var C=0;C";case Pp:return":has("+(_v(u)||"")+")";case Ep:return'[role="'+u.value+'"]';case Op:return'"'+u.value+'"';case Mp:return'[data-testname="'+u.value+'"]';default:throw Error(i(365))}}function Sw(u,f){var v=[];u=[u,0];for(var C=0;Ck&&(k=L),C&=~P}if(C=k,C=Ze()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*DR(C/1960))-C,10u?16:u,Ni===null)var C=!1;else{if(u=Ni,Ni=null,Np=0,gn&6)throw Error(i(331));var k=gn;for(gn|=4,bt=u.current;bt!==null;){var P=bt,L=P.child;if(bt.flags&16){var ce=P.deletions;if(ce!==null){for(var be=0;beZe()-Mv?Sl(u,0):Ev|=v),Bo(u,f)}function Aw(u,f){f===0&&(u.mode&1?(f=jn,jn<<=1,!(jn&130023424)&&(jn=4194304)):f=1);var v=bo();u=ha(u,f),u!==null&&(Bt(u,f,v),Bo(u,v))}function FR(u){var f=u.memoizedState,v=0;f!==null&&(v=f.retryLane),Aw(u,v)}function BR(u,f){var v=0;switch(u.tag){case 13:var C=u.stateNode,k=u.memoizedState;k!==null&&(v=k.retryLane);break;case 19:C=u.stateNode;break;default:throw Error(i(314))}C!==null&&C.delete(f),Aw(u,v)}var Rw;Rw=function(u,f,v){if(u!==null)if(u.memoizedProps!==f.pendingProps||yn.current)zo=!0;else{if(!(u.lanes&v)&&!(f.flags&128))return zo=!1,PR(u,f,v);zo=!!(u.flags&131072)}else zo=!1,mr&&f.flags&1048576&&uC(f,jo,f.index);switch(f.lanes=0,f.tag){case 2:var C=f.type;wp(u,f),u=f.pendingProps;var k=Hr(f,Jt.current);hc(f,v),k=sv(null,f,C,u,k,v);var P=av();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,pr(C)?(P=!0,hr(f)):P=!1,f.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,X0(f),k.updater=pp,f.stateNode=k,k._reactInternals=f,J0(f,C,u,v),f=hv(null,f,C,!0,P,v)):(f.tag=0,mr&&P&&F0(f),Po(null,f,k,v),f=f.child),f;case 16:C=f.elementType;e:{switch(wp(u,f),u=f.pendingProps,k=C._init,C=k(C._payload),f.type=C,k=f.tag=WR(C),u=Gs(C,u),k){case 0:f=pv(null,f,C,u,v);break e;case 1:f=sw(null,f,C,u,v);break e;case 11:f=ew(null,f,C,u,v);break e;case 14:f=tw(null,f,C,Gs(C.type,u),v);break e}throw Error(i(306,C,""))}return f;case 0:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Gs(C,k),pv(u,f,C,k,v);case 1:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Gs(C,k),sw(u,f,C,k,v);case 3:e:{if(aw(f),u===null)throw Error(i(387));C=f.pendingProps,P=f.memoizedState,k=P.element,vC(u,f),fp(f,C,null,v);var L=f.memoizedState;if(C=L.element,ge&&P.isDehydrated)if(P={element:C,isDehydrated:!1,cache:L.cache,pendingSuspenseBoundaries:L.pendingSuspenseBoundaries,transitions:L.transitions},f.updateQueue.baseState=P,f.memoizedState=P,f.flags&256){k=bc(Error(i(423)),f),f=iw(u,f,C,v,k);break e}else if(C!==k){k=bc(Error(i(424)),f),f=iw(u,f,C,v,k);break e}else for(ge&&(bs=ue(f.stateNode.containerInfo),os=f,mr=!0,Us=null,Zu=!1),v=_C(f,null,C,v),f.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(fc(),C===k){f=Xa(u,f,v);break e}Po(u,f,C,v)}f=f.child}return f;case 5:return IC(f),u===null&&W0(f),C=f.type,k=f.pendingProps,P=u!==null?u.memoizedProps:null,L=k.children,$(C,k)?L=null:P!==null&&$(C,P)&&(f.flags|=32),ow(u,f),Po(u,f,L,v),f.child;case 6:return u===null&&W0(f),null;case 13:return lw(u,f,v);case 4:return Z0(f,f.stateNode.containerInfo),C=f.pendingProps,u===null?f.child=mc(f,null,C,v):Po(u,f,C,v),f.child;case 11:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Gs(C,k),ew(u,f,C,k,v);case 7:return Po(u,f,f.pendingProps,v),f.child;case 8:return Po(u,f,f.pendingProps.children,v),f.child;case 12:return Po(u,f,f.pendingProps.children,v),f.child;case 10:e:{if(C=f.type._context,k=f.pendingProps,P=f.memoizedProps,L=k.value,mC(f,C,L),P!==null)if(dr(P.value,L)){if(P.children===k.children&&!yn.current){f=Xa(u,f,v);break e}}else for(P=f.child,P!==null&&(P.return=f);P!==null;){var ce=P.dependencies;if(ce!==null){L=P.child;for(var be=ce.firstContext;be!==null;){if(be.context===C){if(P.tag===1){be=Qa(-1,v&-v),be.tag=2;var We=P.updateQueue;if(We!==null){We=We.shared;var xt=We.pending;xt===null?be.next=be:(be.next=xt.next,xt.next=be),We.pending=be}}P.lanes|=v,be=P.alternate,be!==null&&(be.lanes|=v),K0(P.return,v,f),ce.lanes|=v;break}be=be.next}}else if(P.tag===10)L=P.type===f.type?null:P.child;else if(P.tag===18){if(L=P.return,L===null)throw Error(i(341));L.lanes|=v,ce=L.alternate,ce!==null&&(ce.lanes|=v),K0(L,v,f),L=P.sibling}else L=P.child;if(L!==null)L.return=P;else for(L=P;L!==null;){if(L===f){L=null;break}if(P=L.sibling,P!==null){P.return=L.return,L=P;break}L=L.return}P=L}Po(u,f,k.children,v),f=f.child}return f;case 9:return k=f.type,C=f.pendingProps.children,hc(f,v),k=xs(k),C=C(k),f.flags|=1,Po(u,f,C,v),f.child;case 14:return C=f.type,k=Gs(C,f.pendingProps),k=Gs(C.type,k),tw(u,f,C,k,v);case 15:return nw(u,f,f.type,f.pendingProps,v);case 17:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Gs(C,k),wp(u,f),f.tag=1,pr(C)?(u=!0,hr(f)):u=!1,hc(f,v),wC(f,C,k),J0(f,C,k,v),hv(null,f,C,!0,u,v);case 19:return uw(u,f,v);case 22:return rw(u,f,v)}throw Error(i(156,f.tag))};function Dw(u,f){return Ne(u,f)}function HR(u,f,v,C){this.tag=u,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ss(u,f,v,C){return new HR(u,f,v,C)}function Lv(u){return u=u.prototype,!(!u||!u.isReactComponent)}function WR(u){if(typeof u=="function")return Lv(u)?1:0;if(u!=null){if(u=u.$$typeof,u===x)return 11;if(u===j)return 14}return 2}function zi(u,f){var v=u.alternate;return v===null?(v=Ss(u.tag,f,u.key,u.mode),v.elementType=u.elementType,v.type=u.type,v.stateNode=u.stateNode,v.alternate=u,u.alternate=v):(v.pendingProps=f,v.type=u.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=u.flags&14680064,v.childLanes=u.childLanes,v.lanes=u.lanes,v.child=u.child,v.memoizedProps=u.memoizedProps,v.memoizedState=u.memoizedState,v.updateQueue=u.updateQueue,f=u.dependencies,v.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},v.sibling=u.sibling,v.index=u.index,v.ref=u.ref,v}function Fp(u,f,v,C,k,P){var L=2;if(C=u,typeof u=="function")Lv(u)&&(L=1);else if(typeof u=="string")L=5;else e:switch(u){case h:return _l(v.children,k,P,f);case m:L=8,k|=8;break;case g:return u=Ss(12,v,f,k|2),u.elementType=g,u.lanes=P,u;case w:return u=Ss(13,v,f,k),u.elementType=w,u.lanes=P,u;case S:return u=Ss(19,v,f,k),u.elementType=S,u.lanes=P,u;case _:return Bp(v,k,P,f);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case b:L=10;break e;case y:L=9;break e;case x:L=11;break e;case j:L=14;break e;case I:L=16,C=null;break e}throw Error(i(130,u==null?u:typeof u,""))}return f=Ss(L,v,f,k),f.elementType=u,f.type=C,f.lanes=P,f}function _l(u,f,v,C){return u=Ss(7,u,C,f),u.lanes=v,u}function Bp(u,f,v,C){return u=Ss(22,u,C,f),u.elementType=_,u.lanes=v,u.stateNode={isHidden:!1},u}function zv(u,f,v){return u=Ss(6,u,null,f),u.lanes=v,u}function Fv(u,f,v){return f=Ss(4,u.children!==null?u.children:[],u.key,f),f.lanes=v,f.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},f}function VR(u,f,v,C,k){this.tag=f,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=W,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=St(0),this.expirationTimes=St(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=St(0),this.identifierPrefix=C,this.onRecoverableError=k,ge&&(this.mutableSourceEagerHydrationData=null)}function Tw(u,f,v,C,k,P,L,ce,be){return u=new VR(u,f,v,ce,be),f===1?(f=1,P===!0&&(f|=8)):f=0,P=Ss(3,null,null,f),u.current=P,P.stateNode=u,P.memoizedState={element:C,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},X0(P),u}function Nw(u){if(!u)return Ln;u=u._reactInternals;e:{if(D(u)!==u||u.tag!==1)throw Error(i(170));var f=u;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(pr(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(i(171))}if(u.tag===1){var v=u.type;if(pr(v))return Gn(u,v,f)}return f}function $w(u){var f=u._reactInternals;if(f===void 0)throw typeof u.render=="function"?Error(i(188)):(u=Object.keys(u).join(","),Error(i(268,u)));return u=K(f),u===null?null:u.stateNode}function Lw(u,f){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var v=u.retryLane;u.retryLane=v!==0&&v=We&&P>=on&&k<=xt&&L<=ut){u.splice(f,1);break}else if(C!==We||v.width!==be.width||utL){if(!(P!==on||v.height!==be.height||xtk)){We>C&&(be.width+=We-C,be.x=C),xtP&&(be.height+=on-P,be.y=P),utv&&(v=L)),L ")+` No matching component was found for: `)+u.join(" > ")}return null},n.getPublicRootInstance=function(u){if(u=u.current,!u.child)return null;switch(u.child.tag){case 5:return te(u.child.stateNode);default:return u.child.stateNode}},n.injectIntoDevTools=function(u){if(u={bundleType:u.bundleType,version:u.version,rendererPackageName:u.rendererPackageName,rendererConfig:u.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:UR,findFiberByHostInstance:u.findFiberByHostInstance||GR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")u=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)u=!0;else{try{cr=f.inject(u),_n=f}catch{}u=!!f.checkDCE}}return u},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(u,f,v,C){if(!Je)throw Error(i(363));u=Iv(u,f);var k=At(u,v,C).disconnect;return{disconnect:function(){k()}}},n.registerMutableSourceForHydration=function(u,f){var v=f._getVersion;v=v(f._source),u.mutableSourceEagerHydrationData==null?u.mutableSourceEagerHydrationData=[f,v]:u.mutableSourceEagerHydrationData.push(f,v)},n.runWithPriority=function(u,f){var v=Oe;try{return Oe=u,f()}finally{Oe=v}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(u,f,v,C){var k=f.current,P=bo(),L=$i(k);return v=Nw(v),f.context===null?f.context=v:f.pendingContext=v,f=Qa(P,L),f.payload={element:u},C=C===void 0?null:C,C!==null&&(f.callback=C),u=Di(k,f,L),u!==null&&(ws(u,k,L,P),dp(u,k,L)),L},n};rR.exports=x0e;var y0e=rR.exports;const C0e=Sf(y0e);var oR={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;oR.exports=dc;var sR=oR.exports;const aI={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let iI=!1,lI=!1;const iC=".react-konva-event",w0e=`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 `,S0e=`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 `,k0e={};function z0(e,t,n=k0e){if(!iI&&"zIndex"in t&&(console.warn(S0e),iI=!0),!lI&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(w0e),lI=!0)}for(var s in n)if(!aI[s]){var i=s.slice(0,2)==="on",c=n[s]!==t[s];if(i&&c){var d=s.substr(2).toLowerCase();d.substr(0,7)==="content"&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),e.off(d,n[s])}var p=!t.hasOwnProperty(s);p&&e.setAttr(s,void 0)}var h=t._useStrictMode,m={},g=!1;const b={};for(var s in t)if(!aI[s]){var i=s.slice(0,2)==="on",y=n[s]!==t[s];if(i&&y){var d=s.substr(2).toLowerCase();d.substr(0,7)==="content"&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),t[s]&&(b[d]=t[s])}!i&&(t[s]!==n[s]||h&&t[s]!==e.getAttr(s))&&(g=!0,m[s]=t[s])}g&&(e.setAttrs(m),bl(e));for(var d in b)e.on(d+iC,b[d])}function bl(e){if(!h9.Konva.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const aR={},j0e={};Cf.Node.prototype._applyProps=z0;function _0e(e,t){if(typeof t=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),bl(e)}function I0e(e,t,n){let r=Cf[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=Cf.Group);const o={},s={};for(var i in t){var c=i.slice(0,2)==="on";c?s[i]=t[i]:o[i]=t[i]}const d=new r(o);return z0(d,s),d}function P0e(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function E0e(e,t,n){return!1}function M0e(e){return e}function O0e(){return null}function A0e(){return null}function R0e(e,t,n,r){return j0e}function D0e(){}function T0e(e){}function N0e(e,t){return!1}function $0e(){return aR}function L0e(){return aR}const z0e=setTimeout,F0e=clearTimeout,B0e=-1;function H0e(e,t){return!1}const W0e=!1,V0e=!0,U0e=!0;function G0e(e,t){t.parent===e?t.moveToTop():e.add(t),bl(e)}function q0e(e,t){t.parent===e?t.moveToTop():e.add(t),bl(e)}function iR(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),bl(e)}function K0e(e,t,n){iR(e,t,n)}function Q0e(e,t){t.destroy(),t.off(iC),bl(e)}function X0e(e,t){t.destroy(),t.off(iC),bl(e)}function Y0e(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function J0e(e,t,n){}function Z0e(e,t,n,r,o){z0(e,o,r)}function eve(e){e.hide(),bl(e)}function tve(e){}function nve(e,t){(t.visible==null||t.visible)&&e.show()}function rve(e,t){}function ove(e){}function sve(){}const ave=()=>sR.DefaultEventPriority,ive=Object.freeze(Object.defineProperty({__proto__:null,appendChild:G0e,appendChildToContainer:q0e,appendInitialChild:_0e,cancelTimeout:F0e,clearContainer:ove,commitMount:J0e,commitTextUpdate:Y0e,commitUpdate:Z0e,createInstance:I0e,createTextInstance:P0e,detachDeletedInstance:sve,finalizeInitialChildren:E0e,getChildHostContext:L0e,getCurrentEventPriority:ave,getPublicInstance:M0e,getRootHostContext:$0e,hideInstance:eve,hideTextInstance:tve,idlePriority:Ih.unstable_IdlePriority,insertBefore:iR,insertInContainerBefore:K0e,isPrimaryRenderer:W0e,noTimeout:B0e,now:Ih.unstable_now,prepareForCommit:O0e,preparePortalMount:A0e,prepareUpdate:R0e,removeChild:Q0e,removeChildFromContainer:X0e,resetAfterCommit:D0e,resetTextContent:T0e,run:Ih.unstable_runWithPriority,scheduleTimeout:z0e,shouldDeprioritizeSubtree:N0e,shouldSetTextContent:H0e,supportsMutation:U0e,unhideInstance:nve,unhideTextInstance:rve,warnsIfNotActing:V0e},Symbol.toStringTag,{value:"Module"}));var lve=Object.defineProperty,cve=Object.defineProperties,uve=Object.getOwnPropertyDescriptors,cI=Object.getOwnPropertySymbols,dve=Object.prototype.hasOwnProperty,fve=Object.prototype.propertyIsEnumerable,uI=(e,t,n)=>t in e?lve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dI=(e,t)=>{for(var n in t||(t={}))dve.call(t,n)&&uI(e,n,t[n]);if(cI)for(var n of cI(t))fve.call(t,n)&&uI(e,n,t[n]);return e},pve=(e,t)=>cve(e,uve(t));function lR(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=lR(r,t,n);if(o)return o;r=t?null:r.sibling}}function cR(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const lC=cR(l.createContext(null));class uR extends l.Component{render(){return l.createElement(lC.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:fI,ReactCurrentDispatcher:pI}=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function hve(){const e=l.useContext(lC);if(e===null)throw new Error("its-fine: useFiber must be called within a !");const t=l.useId();return l.useMemo(()=>{for(const r of[fI==null?void 0:fI.current,e,e==null?void 0:e.alternate]){if(!r)continue;const o=lR(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 mve(){var e,t;const n=hve(),[r]=l.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==lC&&!r.has(s)&&r.set(s,(t=pI==null?void 0:pI.current)==null?void 0:t.readContext(cR(s))),o=o.return}return r}function gve(){const e=mve();return l.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>l.createElement(t,null,l.createElement(n.Provider,pve(dI({},r),{value:e.get(n)}))),t=>l.createElement(uR,dI({},t))),[e])}function vve(e){const t=z.useRef({});return z.useLayoutEffect(()=>{t.current=e}),z.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}const bve=e=>{const t=z.useRef(),n=z.useRef(),r=z.useRef(),o=vve(e),s=gve(),i=c=>{const{forwardedRef:d}=e;d&&(typeof d=="function"?d(c):d.current=c)};return z.useLayoutEffect(()=>(n.current=new Cf.Stage({width:e.width,height:e.height,container:t.current}),i(n.current),r.current=Nd.createContainer(n.current,sR.LegacyRoot,!1,null),Nd.updateContainer(z.createElement(s,{},e.children),r.current),()=>{Cf.isBrowser&&(i(null),Nd.updateContainer(null,r.current,null),n.current.destroy())}),[]),z.useLayoutEffect(()=>{i(n.current),z0(n.current,e,o),Nd.updateContainer(z.createElement(s,{},e.children),r.current,null)}),z.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})},Id="Layer",Fa="Group",Ba="Rect",Il="Circle",fg="Line",dR="Image",xve="Text",yve="Transformer",Nd=C0e(ive);Nd.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:z.version,rendererPackageName:"react-konva"});const Cve=z.forwardRef((e,t)=>z.createElement(uR,{},z.createElement(bve,{...e,forwardedRef:t}))),wve=me([Ir,Vs],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:Nn}}),Sve=()=>{const e=le(),{tool:t,isStaging:n,isMovingBoundingBox:r}=H(wve);return{handleDragStart:l.useCallback(()=>{(t==="move"||n)&&!r&&e(Xh(!0))},[e,r,n,t]),handleDragMove:l.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(jP(s))},[e,r,n,t]),handleDragEnd:l.useCallback(()=>{(t==="move"||n)&&!r&&e(Xh(!1))},[e,r,n,t])}},kve=me([Ir,lo,Vs],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isMaskEnabled:c,shouldSnapToGrid:d}=e;return{activeTabName:t,isCursorOnCanvas:!!r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isStaging:n,isMaskEnabled:c,shouldSnapToGrid:d}},{memoizeOptions:{resultEqualityCheck:Nn}}),jve=()=>{const e=le(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:i}=H(kve),c=l.useRef(null),d=_P(),p=()=>e(IP());_t(["shift+c"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[]);const h=()=>e(ny(!s));_t(["h"],()=>{h()},{enabled:()=>!o,preventDefault:!0},[s]),_t(["n"],()=>{e(Yh(!i))},{enabled:!0,preventDefault:!0},[i]),_t("esc",()=>{e(m9())},{enabled:()=>!0,preventDefault:!0}),_t("shift+h",()=>{e(g9(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),_t(["space"],m=>{m.repeat||(d==null||d.container().focus(),r!=="move"&&(c.current=r,e(Zc("move"))),r==="move"&&c.current&&c.current!=="move"&&(e(Zc(c.current)),c.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,c])},cC=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}},fR=()=>{const e=le(),t=ab(),n=_P();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=v9.pixelRatio,[s,i,c,d]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;s===void 0||i===void 0||c===void 0||d===void 0||e(b9({r:s,g:i,b:c,a:d}))},commitColorUnderCursor:()=>{e(x9())}}},_ve=me([lo,Ir,Vs],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Nn}}),Ive=e=>{const t=le(),{tool:n,isStaging:r}=H(_ve),{commitColorUnderCursor:o}=fR();return l.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Xh(!0));return}if(n==="colorPicker"){o();return}const i=cC(e.current);i&&(s.evt.preventDefault(),t(PP(!0)),t(y9([i.x,i.y])))},[e,n,r,t,o])},Pve=me([lo,Ir,Vs],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Nn}}),Eve=(e,t,n)=>{const r=le(),{isDrawing:o,tool:s,isStaging:i}=H(Pve),{updateColorUnderCursor:c}=fR();return l.useCallback(()=>{if(!e.current)return;const d=cC(e.current);if(d){if(r(C9(d)),n.current=d,s==="colorPicker"){c();return}!o||s==="move"||i||(t.current=!0,r(EP([d.x,d.y])))}},[t,r,o,i,n,e,s,c])},Mve=()=>{const e=le();return l.useCallback(()=>{e(w9())},[e])},Ove=me([lo,Ir,Vs],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Nn}}),Ave=(e,t)=>{const n=le(),{tool:r,isDrawing:o,isStaging:s}=H(Ove);return l.useCallback(()=>{if(r==="move"||s){n(Xh(!1));return}if(!t.current&&o&&e.current){const i=cC(e.current);if(!i)return;n(EP([i.x,i.y]))}else t.current=!1;n(PP(!1))},[t,n,o,s,e,r])},Rve=me([Ir],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:Nn}}),Dve=e=>{const t=le(),{isMoveStageKeyHeld:n,stageScale:r}=H(Rve);return l.useCallback(o=>{if(!e.current||n)return;o.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const i={x:(s.x-e.current.x())/r,y:(s.y-e.current.y())/r};let c=o.evt.deltaY;o.evt.ctrlKey&&(c=-c);const d=Hl(r*j9**c,k9,S9),p={x:s.x-i.x*d,y:s.y-i.y*d};t(_9(d)),t(jP(p))},[e,n,r,t])},Tve=me(Ir,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:Nn}}),Nve=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=H(Tve);return a.jsxs(Fa,{children:[a.jsx(Ba,{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(Ba,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},$ve=l.memo(Nve),Lve=me([Ir],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:Nn}}),zve=()=>{const{stageScale:e,stageCoordinates:t,stageDimensions:n}=H(Lve),{colorMode:r}=ji(),[o,s]=l.useState([]),[i,c]=ea("colors",["base.800","base.200"]),d=l.useCallback(p=>p/e,[e]);return l.useLayoutEffect(()=>{const{width:p,height:h}=n,{x:m,y:g}=t,b={x1:0,y1:0,x2:p,y2:h,offset:{x:d(m),y:d(g)}},y={x:Math.ceil(d(m)/64)*64,y:Math.ceil(d(g)/64)*64},x={x1:-y.x,y1:-y.y,x2:d(p)-y.x+64,y2:d(h)-y.y+64},S={x1:Math.min(b.x1,x.x1),y1:Math.min(b.y1,x.y1),x2:Math.max(b.x2,x.x2),y2:Math.max(b.y2,x.y2)},j=S.x2-S.x1,I=S.y2-S.y1,_=Math.round(j/64)+1,M=Math.round(I/64)+1,E=kS(0,_).map(R=>a.jsx(fg,{x:S.x1+R*64,y:S.y1,points:[0,0,0,I],stroke:r==="dark"?i:c,strokeWidth:1},`x_${R}`)),A=kS(0,M).map(R=>a.jsx(fg,{x:S.x1,y:S.y1+R*64,points:[0,0,j,0],stroke:r==="dark"?i:c,strokeWidth:1},`y_${R}`));s(E.concat(A))},[e,t,n,d,r,i,c]),a.jsx(Fa,{children:o})},Fve=l.memo(zve),Bve=me([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:Nn}}),Hve=e=>{const{...t}=e,{progressImage:n,boundingBox:r}=H(Bve),[o,s]=l.useState(null);return l.useEffect(()=>{if(!n)return;const i=new Image;i.onload=()=>{s(i)},i.src=n.dataURL},[n]),n&&r&&o?a.jsx(dR,{x:r.x,y:r.y,width:r.width,height:r.height,image:o,listening:!1,...t}):null},Wve=l.memo(Hve),Bl=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},Vve=me(Ir,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:Bl(t)}}),hI=e=>`data:image/svg+xml;utf8, `.replaceAll("black",e),Uve=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=H(Vve),[i,c]=l.useState(null),[d,p]=l.useState(0),h=l.useRef(null),m=l.useCallback(()=>{p(d+1),setTimeout(m,500)},[d]);return l.useEffect(()=>{if(i)return;const g=new Image;g.onload=()=>{c(g)},g.src=hI(n)},[i,n]),l.useEffect(()=>{i&&(i.src=hI(n))},[i,n]),l.useEffect(()=>{const g=setInterval(()=>p(b=>(b+1)%5),50);return()=>clearInterval(g)},[]),!i||!kc(r.x)||!kc(r.y)||!kc(s)||!kc(o.width)||!kc(o.height)?null:a.jsx(Ba,{ref:h,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:i,fillPatternOffsetY:kc(d)?d:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},Gve=l.memo(Uve),qve=me([Ir],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:Nn}}),Kve=e=>{const{...t}=e,{objects:n}=H(qve);return a.jsx(Fa,{listening:!1,...t,children:n.filter(I9).map((r,o)=>a.jsx(fg,{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))})},Qve=l.memo(Kve);var Pl=l,Xve=function(t,n,r){const o=Pl.useRef("loading"),s=Pl.useRef(),[i,c]=Pl.useState(0),d=Pl.useRef(),p=Pl.useRef(),h=Pl.useRef();return(d.current!==t||p.current!==n||h.current!==r)&&(o.current="loading",s.current=void 0,d.current=t,p.current=n,h.current=r),Pl.useLayoutEffect(function(){if(!t)return;var m=document.createElement("img");function g(){o.current="loaded",s.current=m,c(Math.random())}function b(){o.current="failed",s.current=void 0,c(Math.random())}return m.addEventListener("load",g),m.addEventListener("error",b),n&&(m.crossOrigin=n),r&&(m.referrerPolicy=r),m.src=t,function(){m.removeEventListener("load",g),m.removeEventListener("error",b)}},[t,n,r]),[s.current,o.current]};const Yve=Sf(Xve),Jve=({canvasImage:e})=>{const[t,n,r,o]=ea("colors",["base.400","base.500","base.700","base.900"]),s=di(t,n),i=di(r,o),{t:c}=Q();return a.jsxs(Fa,{children:[a.jsx(Ba,{x:e.x,y:e.y,width:e.width,height:e.height,fill:s}),a.jsx(xve,{x:e.x,y:e.y,width:e.width,height:e.height,align:"center",verticalAlign:"middle",fontFamily:'"Inter Variable", sans-serif',fontSize:e.width/16,fontStyle:"600",text:c("common.imageFailedToLoad"),fill:i})]})},Zve=l.memo(Jve),e1e=e=>{const{x:t,y:n,imageName:r}=e.canvasImage,{currentData:o,isError:s}=Rs(r??zs.skipToken),[i,c]=Yve((o==null?void 0:o.image_url)??"",UI.get()?"use-credentials":"anonymous");return s||c==="failed"?a.jsx(Zve,{canvasImage:e.canvasImage}):a.jsx(dR,{x:t,y:n,image:i,listening:!1})},pR=l.memo(e1e),t1e=me([Ir],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:Nn}}),n1e=()=>{const{objects:e}=H(t1e);return e?a.jsx(Fa,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(P9(t))return a.jsx(pR,{canvasImage:t},n);if(E9(t)){const r=a.jsx(fg,{points:t.points,stroke:t.color?Bl(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(Fa,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(M9(t))return a.jsx(Ba,{x:t.x,y:t.y,width:t.width,height:t.height,fill:Bl(t.color)},n);if(O9(t))return a.jsx(Ba,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},r1e=l.memo(n1e),o1e=me([Ir],e=>{const{layerState:t,shouldShowStagingImage:n,shouldShowStagingOutline:r,boundingBoxCoordinates:o,boundingBoxDimensions:s}=e,{selectedImageIndex:i,images:c,boundingBox:d}=t.stagingArea;return{currentStagingAreaImage:c.length>0&&i!==void 0?c[i]:void 0,isOnFirstImage:i===0,isOnLastImage:i===c.length-1,shouldShowStagingImage:n,shouldShowStagingOutline:r,x:(d==null?void 0:d.x)??o.x,y:(d==null?void 0:d.y)??o.y,width:(d==null?void 0:d.width)??s.width,height:(d==null?void 0:d.height)??s.height}},{memoizeOptions:{resultEqualityCheck:Nn}}),s1e=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:i,width:c,height:d}=H(o1e);return a.jsxs(Fa,{...t,children:[r&&n&&a.jsx(pR,{canvasImage:n}),o&&a.jsxs(Fa,{children:[a.jsx(Ba,{x:s,y:i,width:c,height:d,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),a.jsx(Ba,{x:s,y:i,width:c,height:d,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},a1e=l.memo(s1e),i1e=me([Ir],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}},Ie),l1e=()=>{const e=le(),{currentStagingAreaImage:t,shouldShowStagingImage:n,currentIndex:r,total:o}=H(i1e),{t:s}=Q(),i=l.useCallback(()=>{e(jS(!0))},[e]),c=l.useCallback(()=>{e(jS(!1))},[e]),d=l.useCallback(()=>e(A9()),[e]),p=l.useCallback(()=>e(R9()),[e]),h=l.useCallback(()=>e(D9()),[e]);_t(["left"],d,{enabled:()=>!0,preventDefault:!0}),_t(["right"],p,{enabled:()=>!0,preventDefault:!0}),_t(["enter"],()=>h,{enabled:()=>!0,preventDefault:!0});const{data:m}=Rs((t==null?void 0:t.imageName)??zs.skipToken),g=l.useCallback(()=>{e(T9(!n))},[e,n]),b=l.useCallback(()=>{m&&e(N9({imageDTO:m}))},[e,m]),y=l.useCallback(()=>{e($9())},[e]);return t?a.jsxs(N,{pos:"absolute",bottom:4,gap:2,w:"100%",align:"center",justify:"center",onMouseEnter:i,onMouseLeave:c,children:[a.jsxs(Hn,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(rt,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:a.jsx(yee,{}),onClick:d,colorScheme:"accent",isDisabled:!n}),a.jsx(Dt,{colorScheme:"base",pointerEvents:"none",isDisabled:!n,minW:20,children:`${r+1}/${o}`}),a.jsx(rt,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:a.jsx(Cee,{}),onClick:p,colorScheme:"accent",isDisabled:!n})]}),a.jsxs(Hn,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(rt,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:a.jsx(VM,{}),onClick:h,colorScheme:"accent"}),a.jsx(rt,{tooltip:s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"aria-label":s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"data-alert":!n,icon:n?a.jsx(Dee,{}):a.jsx(Ree,{}),onClick:g,colorScheme:"accent"}),a.jsx(rt,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),isDisabled:!m||!m.is_intermediate,icon:a.jsx(o0,{}),onClick:b,colorScheme:"accent"}),a.jsx(rt,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:a.jsx(ku,{}),onClick:y,colorScheme:"error",fontSize:20})]})]}):null},c1e=l.memo(l1e),u1e=()=>{const e=H(c=>c.canvas.layerState),t=H(c=>c.canvas.boundingBoxCoordinates),n=H(c=>c.canvas.boundingBoxDimensions),r=H(c=>c.canvas.isMaskEnabled),o=H(c=>c.canvas.shouldPreserveMaskedArea),[s,i]=l.useState();return l.useEffect(()=>{i(void 0)},[e,t,n,r,o]),ate(async()=>{const c=await L9(e,t,n,r,o);if(!c)return;const{baseImageData:d,maskImageData:p}=c,h=z9(d,p);i(h)},1e3,[e,t,n,r,o]),s},d1e=()=>{const e=u1e(),{t}=Q(),n=l.useMemo(()=>({txt2img:t("common.txt2img"),img2img:t("common.img2img"),inpaint:t("common.inpaint"),outpaint:t("common.outpaint")}),[t]);return a.jsxs(Le,{children:[t("accessibility.mode"),":"," ",e?n[e]:"..."]})},f1e=l.memo(d1e),Xc=e=>Math.round(e*100)/100,p1e=me([Ir],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:Nn}});function h1e(){const{cursorCoordinatesString:e}=H(p1e),{t}=Q();return a.jsx(Le,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const jx="var(--invokeai-colors-warning-500)",m1e=me([Ir],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:i},scaledBoundingBoxDimensions:{width:c,height:d},boundingBoxCoordinates:{x:p,y:h},stageScale:m,shouldShowCanvasDebugInfo:g,layer:b,boundingBoxScaleMethod:y,shouldPreserveMaskedArea:x}=e;let w="inherit";return(y==="none"&&(s<512||i<512)||y==="manual"&&c*d<512*512)&&(w=jx),{activeLayerColor:b==="mask"?jx:"inherit",layer:b,boundingBoxColor:w,boundingBoxCoordinatesString:`(${Xc(p)}, ${Xc(h)})`,boundingBoxDimensionsString:`${s}×${i}`,scaledBoundingBoxDimensionsString:`${c}×${d}`,canvasCoordinatesString:`${Xc(r)}×${Xc(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(m*100),shouldShowCanvasDebugInfo:g,shouldShowBoundingBox:y!=="auto",shouldShowScaledBoundingBox:y!=="none",shouldPreserveMaskedArea:x}},{memoizeOptions:{resultEqualityCheck:Nn}}),g1e=()=>{const{activeLayerColor:e,layer:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:i,canvasCoordinatesString:c,canvasDimensionsString:d,canvasScaleString:p,shouldShowCanvasDebugInfo:h,shouldShowBoundingBox:m,shouldPreserveMaskedArea:g}=H(m1e),{t:b}=Q();return a.jsxs(N,{sx:{flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,opacity:.65,display:"flex",fontSize:"sm",padding:1,px:2,minWidth:48,margin:1,borderRadius:"base",pointerEvents:"none",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(f1e,{}),a.jsx(Le,{style:{color:e},children:`${b("unifiedCanvas.activeLayer")}: ${b(`unifiedCanvas.${t}`)}`}),a.jsx(Le,{children:`${b("unifiedCanvas.canvasScale")}: ${p}%`}),g&&a.jsxs(Le,{style:{color:jx},children:[b("unifiedCanvas.preserveMaskedArea"),": ",b("common.on")]}),m&&a.jsx(Le,{style:{color:n},children:`${b("unifiedCanvas.boundingBox")}: ${o}`}),i&&a.jsx(Le,{style:{color:n},children:`${b("unifiedCanvas.scaledBoundingBox")}: ${s}`}),h&&a.jsxs(a.Fragment,{children:[a.jsx(Le,{children:`${b("unifiedCanvas.boundingBoxPosition")}: ${r}`}),a.jsx(Le,{children:`${b("unifiedCanvas.canvasDimensions")}: ${d}`}),a.jsx(Le,{children:`${b("unifiedCanvas.canvasPosition")}: ${c}`}),a.jsx(h1e,{})]})]})},v1e=l.memo(g1e),b1e=me([we],({canvas:e,generation:t})=>{const{boundingBoxCoordinates:n,boundingBoxDimensions:r,stageScale:o,isDrawing:s,isTransformingBoundingBox:i,isMovingBoundingBox:c,tool:d,shouldSnapToGrid:p}=e,{aspectRatio:h}=t;return{boundingBoxCoordinates:n,boundingBoxDimensions:r,isDrawing:s,isMovingBoundingBox:c,isTransformingBoundingBox:i,stageScale:o,shouldSnapToGrid:p,tool:d,hitStrokeWidth:20/o,aspectRatio:h}},{memoizeOptions:{resultEqualityCheck:Nn}}),x1e=e=>{const{...t}=e,n=le(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:i,isTransformingBoundingBox:c,stageScale:d,shouldSnapToGrid:p,tool:h,hitStrokeWidth:m,aspectRatio:g}=H(b1e),b=l.useRef(null),y=l.useRef(null),[x,w]=l.useState(!1);l.useEffect(()=>{var G;!b.current||!y.current||(b.current.nodes([y.current]),(G=b.current.getLayer())==null||G.batchDraw())},[]);const S=64*d;_t("N",()=>{n(Yh(!p))});const j=l.useCallback(G=>{if(!p){n(Gv({x:Math.floor(G.target.x()),y:Math.floor(G.target.y())}));return}const X=G.target.x(),Z=G.target.y(),te=Ro(X,64),V=Ro(Z,64);G.target.x(te),G.target.y(V),n(Gv({x:te,y:V}))},[n,p]),I=l.useCallback(()=>{if(!y.current)return;const G=y.current,X=G.scaleX(),Z=G.scaleY(),te=Math.round(G.width()*X),V=Math.round(G.height()*Z),oe=Math.round(G.x()),ne=Math.round(G.y());if(g){const se=Ro(te/g,64);n(na({width:te,height:se}))}else n(na({width:te,height:V}));n(Gv({x:p?Pd(oe,64):oe,y:p?Pd(ne,64):ne})),G.scaleX(1),G.scaleY(1)},[n,p,g]),_=l.useCallback((G,X,Z)=>{const te=G.x%S,V=G.y%S;return{x:Pd(X.x,S)+te,y:Pd(X.y,S)+V}},[S]),M=l.useCallback(()=>{n(qv(!0))},[n]),E=l.useCallback(()=>{n(qv(!1)),n(Kv(!1)),n(Kp(!1)),w(!1)},[n]),A=l.useCallback(()=>{n(Kv(!0))},[n]),R=l.useCallback(()=>{n(qv(!1)),n(Kv(!1)),n(Kp(!1)),w(!1)},[n]),D=l.useCallback(()=>{w(!0)},[]),O=l.useCallback(()=>{!c&&!i&&w(!1)},[i,c]),T=l.useCallback(()=>{n(Kp(!0))},[n]),K=l.useCallback(()=>{n(Kp(!1))},[n]);return a.jsxs(Fa,{...t,children:[a.jsx(Ba,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:T,onMouseOver:T,onMouseLeave:K,onMouseOut:K}),a.jsx(Ba,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:m,listening:!s&&h==="move",onDragStart:A,onDragEnd:R,onDragMove:j,onMouseDown:A,onMouseOut:O,onMouseOver:D,onMouseEnter:D,onMouseUp:R,onTransform:I,onTransformEnd:E,ref:y,stroke:x?"rgba(255,255,255,0.7)":"white",strokeWidth:(x?8:1)/d,width:o.width,x:r.x,y:r.y}),a.jsx(yve,{anchorCornerRadius:3,anchorDragBoundFunc:_,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:h==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&h==="move",onDragStart:A,onDragEnd:R,onMouseDown:M,onMouseUp:E,onTransformEnd:E,ref:b,rotateEnabled:!1})]})},y1e=l.memo(x1e),C1e=me(Ir,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:i,layer:c,shouldShowBrush:d,isMovingBoundingBox:p,isTransformingBoundingBox:h,stageScale:m,stageDimensions:g,boundingBoxCoordinates:b,boundingBoxDimensions:y,shouldRestrictStrokesToBox:x}=e,w=x?{clipX:b.x,clipY:b.y,clipWidth:y.width,clipHeight:y.height}:{};return{cursorPosition:t,brushX:t?t.x:g.width/2,brushY:t?t.y:g.height/2,radius:n/2,colorPickerOuterRadius:_S/m,colorPickerInnerRadius:(_S-ib+1)/m,maskColorString:Bl({...o,a:.5}),brushColorString:Bl(s),colorPickerColorString:Bl(r),tool:i,layer:c,shouldShowBrush:d,shouldDrawBrushPreview:!(p||h||!t)&&d,strokeWidth:1.5/m,dotRadius:1.5/m,clip:w}},{memoizeOptions:{resultEqualityCheck:Nn}}),w1e=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:i,layer:c,shouldDrawBrushPreview:d,dotRadius:p,strokeWidth:h,brushColorString:m,colorPickerColorString:g,colorPickerInnerRadius:b,colorPickerOuterRadius:y,clip:x}=H(C1e);return d?a.jsxs(Fa,{listening:!1,...x,...t,children:[i==="colorPicker"?a.jsxs(a.Fragment,{children:[a.jsx(Il,{x:n,y:r,radius:y,stroke:m,strokeWidth:ib,strokeScaleEnabled:!1}),a.jsx(Il,{x:n,y:r,radius:b,stroke:g,strokeWidth:ib,strokeScaleEnabled:!1})]}):a.jsxs(a.Fragment,{children:[a.jsx(Il,{x:n,y:r,radius:o,fill:c==="mask"?s:m,globalCompositeOperation:i==="eraser"?"destination-out":"source-out"}),a.jsx(Il,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:h*2,strokeEnabled:!0,listening:!1}),a.jsx(Il,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:h,strokeEnabled:!0,listening:!1})]}),a.jsx(Il,{x:n,y:r,radius:p*2,fill:"rgba(255,255,255,0.4)",listening:!1}),a.jsx(Il,{x:n,y:r,radius:p,fill:"rgba(0,0,0,1)",listening:!1})]}):null},S1e=l.memo(w1e),k1e=me([Ir,Vs],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:i,isMovingBoundingBox:c,stageDimensions:d,stageCoordinates:p,tool:h,isMovingStage:m,shouldShowIntermediates:g,shouldShowGrid:b,shouldRestrictStrokesToBox:y,shouldAntialias:x}=e;let w="none";return h==="move"||t?m?w="grabbing":w="grab":s?w=void 0:y&&!i&&(w="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||c,shouldShowBoundingBox:o,shouldShowGrid:b,stageCoordinates:p,stageCursor:w,stageDimensions:d,stageScale:r,tool:h,isStaging:t,shouldShowIntermediates:g,shouldAntialias:x}},Ie),j1e=Ae(Cve,{shouldForwardProp:e=>!["sx"].includes(e)}),_1e=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:i,stageScale:c,tool:d,isStaging:p,shouldShowIntermediates:h,shouldAntialias:m}=H(k1e);jve();const g=le(),b=l.useRef(null),y=l.useRef(null),x=l.useRef(null),w=l.useCallback(G=>{F9(G),y.current=G},[]),S=l.useCallback(G=>{B9(G),x.current=G},[]),j=l.useRef({x:0,y:0}),I=l.useRef(!1),_=Dve(y),M=Ive(y),E=Ave(y,I),A=Eve(y,I,j),R=Mve(),{handleDragStart:D,handleDragMove:O,handleDragEnd:T}=Sve(),K=l.useCallback(G=>G.evt.preventDefault(),[]);return l.useEffect(()=>{if(!b.current)return;const G=new ResizeObserver(te=>{for(const V of te)if(V.contentBoxSize){const{width:oe,height:ne}=V.contentRect;g(IS({width:oe,height:ne}))}});G.observe(b.current);const{width:X,height:Z}=b.current.getBoundingClientRect();return g(IS({width:X,height:Z})),()=>{G.disconnect()}},[g]),a.jsxs(N,{id:"canvas-container",ref:b,sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:[a.jsx(Le,{sx:{position:"absolute"},children:a.jsxs(j1e,{tabIndex:-1,ref:w,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:o.x,y:o.y,width:i.width,height:i.height,scale:{x:c,y:c},onTouchStart:M,onTouchMove:A,onTouchEnd:E,onMouseDown:M,onMouseLeave:R,onMouseMove:A,onMouseUp:E,onDragStart:D,onDragMove:O,onDragEnd:T,onContextMenu:K,onWheel:_,draggable:(d==="move"||p)&&!t,children:[a.jsx(Id,{id:"grid",visible:r,children:a.jsx(Fve,{})}),a.jsx(Id,{id:"base",ref:S,listening:!1,imageSmoothingEnabled:m,children:a.jsx(r1e,{})}),a.jsxs(Id,{id:"mask",visible:e&&!p,listening:!1,children:[a.jsx(Qve,{visible:!0,listening:!1}),a.jsx(Gve,{listening:!1})]}),a.jsx(Id,{children:a.jsx($ve,{})}),a.jsxs(Id,{id:"preview",imageSmoothingEnabled:m,children:[!p&&a.jsx(S1e,{visible:d!=="move",listening:!1}),a.jsx(a1e,{visible:p}),h&&a.jsx(Wve,{}),a.jsx(y1e,{visible:n&&!p})]})]})}),a.jsx(v1e,{}),a.jsx(c1e,{})]})},I1e=l.memo(_1e);function P1e(e,t,n=250){const[r,o]=l.useState(0);return l.useEffect(()=>{const s=setTimeout(()=>{r===1&&e(),o(0)},n);return r===2&&t(),()=>clearTimeout(s)},[r,e,t,n]),()=>o(s=>s+1)}const V1={width:6,height:6,borderColor:"base.100"},E1e={".react-colorful__hue-pointer":V1,".react-colorful__saturation-pointer":V1,".react-colorful__alpha-pointer":V1,gap:2,flexDir:"column"},_h="4.2rem",M1e=e=>{const{color:t,onChange:n,withNumberInput:r,...o}=e,s=l.useCallback(p=>n({...t,r:p}),[t,n]),i=l.useCallback(p=>n({...t,g:p}),[t,n]),c=l.useCallback(p=>n({...t,b:p}),[t,n]),d=l.useCallback(p=>n({...t,a:p}),[t,n]);return a.jsxs(N,{sx:E1e,children:[a.jsx(fA,{color:t,onChange:n,style:{width:"100%"},...o}),r&&a.jsxs(N,{children:[a.jsx(_a,{value:t.r,onChange:s,min:0,max:255,step:1,label:"Red",w:_h}),a.jsx(_a,{value:t.g,onChange:i,min:0,max:255,step:1,label:"Green",w:_h}),a.jsx(_a,{value:t.b,onChange:c,min:0,max:255,step:1,label:"Blue",w:_h}),a.jsx(_a,{value:t.a,onChange:d,step:.1,min:0,max:1,label:"Alpha",w:_h,isInteger:!1})]})]})},hR=l.memo(M1e),O1e=me([Ir,Vs],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:Bl(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Nn}}),A1e=()=>{const e=le(),{t}=Q(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:i}=H(O1e);_t(["q"],()=>{c()},{enabled:()=>!i,preventDefault:!0},[n]),_t(["shift+c"],()=>{d()},{enabled:()=>!i,preventDefault:!0},[]),_t(["h"],()=>{p()},{enabled:()=>!i,preventDefault:!0},[o]);const c=l.useCallback(()=>{e(MP(n==="mask"?"base":"mask"))},[e,n]),d=l.useCallback(()=>{e(IP())},[e]),p=l.useCallback(()=>{e(ny(!o))},[e,o]),h=l.useCallback(async()=>{e(H9())},[e]),m=l.useCallback(b=>{e(W9(b.target.checked))},[e]),g=l.useCallback(b=>{e(V9(b))},[e]);return a.jsx(tp,{triggerComponent:a.jsx(Hn,{children:a.jsx(rt,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:a.jsx(JM,{}),isChecked:n==="mask",isDisabled:i})}),children:a.jsxs(N,{direction:"column",gap:2,children:[a.jsx(Eo,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:p}),a.jsx(Eo,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:m}),a.jsx(Le,{sx:{paddingTop:2,paddingBottom:2},children:a.jsx(hR,{color:r,onChange:g})}),a.jsx(Dt,{size:"sm",leftIcon:a.jsx(o0,{}),onClick:h,children:"Save Mask"}),a.jsxs(Dt,{size:"sm",leftIcon:a.jsx(Zo,{}),onClick:d,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},R1e=l.memo(A1e),D1e=me([we,lo],({canvas:e},t)=>{const{futureLayerStates:n}=e;return{canRedo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Nn}});function T1e(){const e=le(),{canRedo:t,activeTabName:n}=H(D1e),{t:r}=Q(),o=l.useCallback(()=>{e(U9())},[e]);return _t(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),a.jsx(rt,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:a.jsx(qee,{}),onClick:o,isDisabled:!t})}const N1e=()=>{const e=H(Vs),t=le(),{t:n}=Q(),r=l.useCallback(()=>t(G9()),[t]);return a.jsxs(_0,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:r,acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:a.jsx(Dt,{size:"sm",leftIcon:a.jsx(Zo,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),a.jsx("br",{}),a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},$1e=l.memo(N1e),L1e=me([Ir],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:c,shouldRestrictStrokesToBox:d,shouldAntialias:p}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:c,shouldRestrictStrokesToBox:d,shouldAntialias:p}},{memoizeOptions:{resultEqualityCheck:Nn}}),z1e=()=>{const e=le(),{t}=Q(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:i,shouldShowIntermediates:c,shouldSnapToGrid:d,shouldRestrictStrokesToBox:p,shouldAntialias:h}=H(L1e);_t(["n"],()=>{e(Yh(!d))},{enabled:!0,preventDefault:!0},[d]);const m=l.useCallback(_=>e(Yh(_.target.checked)),[e]),g=l.useCallback(_=>e(q9(_.target.checked)),[e]),b=l.useCallback(_=>e(K9(_.target.checked)),[e]),y=l.useCallback(_=>e(Q9(_.target.checked)),[e]),x=l.useCallback(_=>e(X9(_.target.checked)),[e]),w=l.useCallback(_=>e(Y9(_.target.checked)),[e]),S=l.useCallback(_=>e(J9(_.target.checked)),[e]),j=l.useCallback(_=>e(Z9(_.target.checked)),[e]),I=l.useCallback(_=>e(e$(_.target.checked)),[e]);return a.jsx(tp,{isLazy:!1,triggerComponent:a.jsx(rt,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:a.jsx(nO,{})}),children:a.jsxs(N,{direction:"column",gap:2,children:[a.jsx(Eo,{label:t("unifiedCanvas.showIntermediates"),isChecked:c,onChange:g}),a.jsx(Eo,{label:t("unifiedCanvas.showGrid"),isChecked:i,onChange:b}),a.jsx(Eo,{label:t("unifiedCanvas.snapToGrid"),isChecked:d,onChange:m}),a.jsx(Eo,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:y}),a.jsx(Eo,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:x}),a.jsx(Eo,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:w}),a.jsx(Eo,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:p,onChange:S}),a.jsx(Eo,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:j}),a.jsx(Eo,{label:t("unifiedCanvas.antialiasing"),isChecked:h,onChange:I}),a.jsx($1e,{})]})})},F1e=l.memo(z1e),B1e=me([we,Vs],({canvas:e},t)=>{const{tool:n,brushColor:r,brushSize:o}=e;return{tool:n,isStaging:t,brushColor:r,brushSize:o}},{memoizeOptions:{resultEqualityCheck:Nn}}),H1e=()=>{const e=le(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=H(B1e),{t:s}=Q();_t(["b"],()=>{i()},{enabled:()=>!o,preventDefault:!0},[]),_t(["e"],()=>{c()},{enabled:()=>!o,preventDefault:!0},[t]),_t(["c"],()=>{d()},{enabled:()=>!o,preventDefault:!0},[t]),_t(["shift+f"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),_t(["delete","backspace"],()=>{h()},{enabled:()=>!o,preventDefault:!0}),_t(["BracketLeft"],()=>{r-5<=5?e(Qp(Math.max(r-1,1))):e(Qp(Math.max(r-5,1)))},{enabled:()=>!o,preventDefault:!0},[r]),_t(["BracketRight"],()=>{e(Qp(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),_t(["Shift+BracketLeft"],()=>{e(Qv({...n,a:Hl(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),_t(["Shift+BracketRight"],()=>{e(Qv({...n,a:Hl(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const i=l.useCallback(()=>{e(Zc("brush"))},[e]),c=l.useCallback(()=>{e(Zc("eraser"))},[e]),d=l.useCallback(()=>{e(Zc("colorPicker"))},[e]),p=l.useCallback(()=>{e(t$())},[e]),h=l.useCallback(()=>{e(n$())},[e]),m=l.useCallback(b=>{e(Qp(b))},[e]),g=l.useCallback(b=>{e(Qv(b))},[e]);return a.jsxs(Hn,{isAttached:!0,children:[a.jsx(rt,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:a.jsx(Wee,{}),isChecked:t==="brush"&&!o,onClick:i,isDisabled:o}),a.jsx(rt,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:a.jsx(Eee,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:c}),a.jsx(rt,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:a.jsx(Tee,{}),isDisabled:o,onClick:p}),a.jsx(rt,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:a.jsx(Zi,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:h}),a.jsx(rt,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:a.jsx(Aee,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:d}),a.jsx(tp,{triggerComponent:a.jsx(rt,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:a.jsx(tO,{})}),children:a.jsxs(N,{minWidth:60,direction:"column",gap:4,width:"100%",children:[a.jsx(N,{gap:4,justifyContent:"space-between",children:a.jsx(It,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:m,sliderNumberInputProps:{max:500}})}),a.jsx(Le,{sx:{width:"100%",paddingTop:2,paddingBottom:2},children:a.jsx(hR,{withNumberInput:!0,color:n,onChange:g})})]})})]})},W1e=l.memo(H1e),V1e=me([we,lo],({canvas:e},t)=>{const{pastLayerStates:n}=e;return{canUndo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Nn}});function U1e(){const e=le(),{t}=Q(),{canUndo:n,activeTabName:r}=H(V1e),o=l.useCallback(()=>{e(r$())},[e]);return _t(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),a.jsx(rt,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:a.jsx(a0,{}),onClick:o,isDisabled:!n})}const G1e=me([we,Vs],({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:Nn}}),q1e=()=>{const e=le(),{isStaging:t,isMaskEnabled:n,layer:r,tool:o}=H(G1e),s=ab(),{t:i}=Q(),{isClipboardAPIAvailable:c}=I8(),{getUploadButtonProps:d,getUploadInputProps:p}=D2({postUploadAction:{type:"SET_CANVAS_INITIAL_IMAGE"}});_t(["v"],()=>{h()},{enabled:()=>!t,preventDefault:!0},[]),_t(["r"],()=>{g()},{enabled:()=>!0,preventDefault:!0},[s]),_t(["shift+m"],()=>{y()},{enabled:()=>!t,preventDefault:!0},[s]),_t(["shift+s"],()=>{x()},{enabled:()=>!t,preventDefault:!0},[s]),_t(["meta+c","ctrl+c"],()=>{w()},{enabled:()=>!t&&c,preventDefault:!0},[s,c]),_t(["shift+d"],()=>{S()},{enabled:()=>!t,preventDefault:!0},[s]);const h=l.useCallback(()=>{e(Zc("move"))},[e]),m=P1e(()=>g(!1),()=>g(!0)),g=(I=!1)=>{const _=ab();if(!_)return;const M=_.getClientRect({skipTransform:!0});e(c$({contentRect:M,shouldScaleTo1:I}))},b=l.useCallback(()=>{e(RI())},[e]),y=l.useCallback(()=>{e(o$())},[e]),x=l.useCallback(()=>{e(s$())},[e]),w=l.useCallback(()=>{c&&e(a$())},[e,c]),S=l.useCallback(()=>{e(i$())},[e]),j=l.useCallback(I=>{const _=I;e(MP(_)),_==="mask"&&!n&&e(ny(!0))},[e,n]);return a.jsxs(N,{sx:{alignItems:"center",gap:2,flexWrap:"wrap"},children:[a.jsx(Le,{w:24,children:a.jsx(Dr,{tooltip:`${i("unifiedCanvas.layer")} (Q)`,value:r,data:l$,onChange:j,disabled:t})}),a.jsx(R1e,{}),a.jsx(W1e,{}),a.jsxs(Hn,{isAttached:!0,children:[a.jsx(rt,{"aria-label":`${i("unifiedCanvas.move")} (V)`,tooltip:`${i("unifiedCanvas.move")} (V)`,icon:a.jsx(wee,{}),isChecked:o==="move"||t,onClick:h}),a.jsx(rt,{"aria-label":`${i("unifiedCanvas.resetView")} (R)`,tooltip:`${i("unifiedCanvas.resetView")} (R)`,icon:a.jsx(_ee,{}),onClick:m})]}),a.jsxs(Hn,{isAttached:!0,children:[a.jsx(rt,{"aria-label":`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:a.jsx(Fee,{}),onClick:y,isDisabled:t}),a.jsx(rt,{"aria-label":`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:a.jsx(o0,{}),onClick:x,isDisabled:t}),c&&a.jsx(rt,{"aria-label":`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:a.jsx(Hu,{}),onClick:w,isDisabled:t}),a.jsx(rt,{"aria-label":`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:a.jsx(Wu,{}),onClick:S,isDisabled:t})]}),a.jsxs(Hn,{isAttached:!0,children:[a.jsx(U1e,{}),a.jsx(T1e,{})]}),a.jsxs(Hn,{isAttached:!0,children:[a.jsx(rt,{"aria-label":`${i("common.upload")}`,tooltip:`${i("common.upload")}`,icon:a.jsx(i0,{}),isDisabled:t,...d()}),a.jsx("input",{...p()}),a.jsx(rt,{"aria-label":`${i("unifiedCanvas.clearCanvas")}`,tooltip:`${i("unifiedCanvas.clearCanvas")}`,icon:a.jsx(Zo,{}),onClick:b,colorScheme:"error",isDisabled:t})]}),a.jsx(Hn,{isAttached:!0,children:a.jsx(F1e,{})})]})},K1e=l.memo(q1e),mI={id:"canvas-intial-image",actionType:"SET_CANVAS_INITIAL_IMAGE"},Q1e=()=>{const{t:e}=Q(),{isOver:t,setNodeRef:n,active:r}=HO({id:"unifiedCanvas",data:mI});return a.jsxs(N,{layerStyle:"first",ref:n,tabIndex:-1,sx:{flexDirection:"column",alignItems:"center",gap:4,p:2,borderRadius:"base",w:"full",h:"full"},children:[a.jsx(K1e,{}),a.jsx(I1e,{}),WO(mI,r)&&a.jsx(VO,{isOver:t,label:e("toast.setCanvasInitialImage")})]})},X1e=l.memo(Q1e),Y1e=()=>a.jsx(X1e,{}),J1e=l.memo(Y1e),Z1e=[{id:"txt2img",translationKey:"common.txt2img",icon:a.jsx(Gr,{as:Nee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(v0e,{})},{id:"img2img",translationKey:"common.img2img",icon:a.jsx(Gr,{as:Xl,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Ope,{})},{id:"unifiedCanvas",translationKey:"common.unifiedCanvas",icon:a.jsx(Gr,{as:fse,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(J1e,{})},{id:"nodes",translationKey:"common.nodes",icon:a.jsx(Gr,{as:T2,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(_ge,{})},{id:"modelManager",translationKey:"modelManager.modelManager",icon:a.jsx(Gr,{as:Iee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Ehe,{})},{id:"queue",translationKey:"queue.queue",icon:a.jsx(Gr,{as:Yee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(m0e,{})}],ebe=me([we],({config:e})=>{const{disabledTabs:t}=e;return Z1e.filter(r=>!t.includes(r.id))},{memoizeOptions:{resultEqualityCheck:Nn}}),tbe=448,nbe=448,rbe=360,obe=["modelManager","queue"],sbe=["modelManager","queue"],abe=()=>{const e=H(u$),t=H(lo),n=H(ebe),{t:r}=Q(),o=le(),s=l.useCallback(O=>{O.target instanceof HTMLElement&&O.target.blur()},[]),i=l.useMemo(()=>n.map(O=>a.jsx(Wn,{hasArrow:!0,label:String(r(O.translationKey)),placement:"end",children:a.jsxs(wo,{onClick:s,children:[a.jsx(UP,{children:String(r(O.translationKey))}),O.icon]})},O.id)),[n,r,s]),c=l.useMemo(()=>n.map(O=>a.jsx(Go,{children:O.content},O.id)),[n]),d=l.useCallback(O=>{const T=n[O];T&&o(ni(T.id))},[o,n]),{minSize:p,isCollapsed:h,setIsCollapsed:m,ref:g,reset:b,expand:y,collapse:x,toggle:w}=I_(tbe,"pixels"),{ref:S,minSize:j,isCollapsed:I,setIsCollapsed:_,reset:M,expand:E,collapse:A,toggle:R}=I_(rbe,"pixels");_t("f",()=>{I||h?(E(),y()):(x(),A())},[o,I,h]),_t(["t","o"],()=>{w()},[o]),_t("g",()=>{R()},[o]);const D=G2();return a.jsxs(tc,{variant:"appTabs",defaultIndex:e,index:e,onChange:d,sx:{flexGrow:1,gap:4},isLazy:!0,children:[a.jsxs(nc,{sx:{pt:2,gap:4,flexDir:"column"},children:[i,a.jsx(Pi,{})]}),a.jsxs(E0,{id:"app",autoSaveId:"app",direction:"horizontal",style:{height:"100%",width:"100%"},storage:D,units:"pixels",children:[!sbe.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(el,{order:0,id:"side",ref:g,defaultSize:p,minSize:p,onCollapse:m,collapsible:!0,children:t==="nodes"?a.jsx(wle,{}):a.jsx(epe,{})}),a.jsx(lg,{onDoubleClick:b,collapsedDirection:h?"left":void 0}),a.jsx(_le,{isSidePanelCollapsed:h,sidePanelRef:g})]}),a.jsx(el,{id:"main",order:1,minSize:nbe,children:a.jsx($u,{style:{height:"100%",width:"100%"},children:c})}),!obe.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(lg,{onDoubleClick:M,collapsedDirection:I?"right":void 0}),a.jsx(el,{id:"gallery",ref:S,order:2,defaultSize:j,minSize:j,onCollapse:_,collapsible:!0,children:a.jsx(qse,{})}),a.jsx(kle,{isGalleryCollapsed:I,galleryPanelRef:S})]})]})]})},ibe=l.memo(abe),lbe=l.createContext(null),U1={didCatch:!1,error:null};class cbe extends l.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=U1}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 dbe(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 fbe=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),pbe=new Map(fbe),hbe=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],_x=new WeakSet,mbe=e=>{_x.add(e);const t=e.toJSON();return _x.delete(e),t},gbe=e=>pbe.get(e)??Error,mR=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:c})=>{if(!n)if(Array.isArray(e))n=[];else if(!c&&gI(e)){const p=gbe(e.name);n=new p}else n={};if(t.push(e),s>=o)return n;if(i&&typeof e.toJSON=="function"&&!_x.has(e))return mbe(e);const d=p=>mR({from:p,seen:[...t],forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:c});for(const[p,h]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(h)){n[p]="[object Buffer]";continue}if(h!==null&&typeof h=="object"&&typeof h.pipe=="function"){n[p]="[object Stream]";continue}if(typeof h!="function"){if(!h||typeof h!="object"){try{n[p]=h}catch{}continue}if(!t.includes(e[p])){s++,n[p]=d(e[p]);continue}n[p]="[Circular]"}}for(const{property:p,enumerable:h}of hbe)typeof e[p]<"u"&&e[p]!==null&&Object.defineProperty(n,p,{value:gI(e[p])?d(e[p]):e[p],enumerable:r?!0:h,configurable:!0,writable:!0});return n};function vbe(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?mR({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name||"anonymous"}]`:e}function gI(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const bbe=({error:e,resetErrorBoundary:t})=>{const n=d$(),r=l.useCallback(()=>{const s=JSON.stringify(vbe(e),null,2);navigator.clipboard.writeText(`\`\`\` ${s} \`\`\``),n({title:"Error Copied"})},[e,n]),o=l.useMemo(()=>dbe({user:"invoke-ai",repo:"InvokeAI",template:"BUG_REPORT.yml",title:`[bug]: ${e.name}: ${e.message}`}),[e.message,e.name]);return a.jsx(N,{layerStyle:"body",sx:{w:"100vw",h:"100vh",alignItems:"center",justifyContent:"center",p:4},children:a.jsxs(N,{layerStyle:"first",sx:{flexDir:"column",borderRadius:"base",justifyContent:"center",gap:8,p:16},children:[a.jsx(yo,{children:"Something went wrong"}),a.jsx(N,{layerStyle:"second",sx:{px:8,py:4,borderRadius:"base",gap:4,justifyContent:"space-between",alignItems:"center"},children:a.jsxs(je,{sx:{fontWeight:600,color:"error.500",_dark:{color:"error.400"}},children:[e.name,": ",e.message]})}),a.jsxs(N,{sx:{gap:4},children:[a.jsx(Dt,{leftIcon:a.jsx(sse,{}),onClick:t,children:"Reset UI"}),a.jsx(Dt,{leftIcon:a.jsx(Hu,{}),onClick:r,children:"Copy Error"}),a.jsx(Ig,{href:o,isExternal:!0,children:a.jsx(Dt,{leftIcon:a.jsx(l2,{}),children:"Create Issue"})})]})]})})},xbe=l.memo(bbe),ybe=me([we],({hotkeys:e})=>{const{shift:t,ctrl:n,meta:r}=e;return{shift:t,ctrl:n,meta:r}},{memoizeOptions:{resultEqualityCheck:Nn}}),Cbe=()=>{const e=le(),{shift:t,ctrl:n,meta:r}=H(ybe),{queueBack:o,isDisabled:s,isLoading:i}=R8();_t(["ctrl+enter","meta+enter"],o,{enabled:()=>!s&&!i,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,s,i]);const{queueFront:c,isDisabled:d,isLoading:p}=$8();return _t(["ctrl+shift+enter","meta+shift+enter"],c,{enabled:()=>!d&&!p,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[c,d,p]),_t("*",()=>{Th("shift")?!t&&e(Qo(!0)):t&&e(Qo(!1)),Th("ctrl")?!n&&e(PS(!0)):n&&e(PS(!1)),Th("meta")?!r&&e(ES(!0)):r&&e(ES(!1))},{keyup:!0,keydown:!0},[t,n,r]),_t("1",()=>{e(ni("txt2img"))}),_t("2",()=>{e(ni("img2img"))}),_t("3",()=>{e(ni("unifiedCanvas"))}),_t("4",()=>{e(ni("nodes"))}),_t("5",()=>{e(ni("modelManager"))}),null},wbe=l.memo(Cbe),Sbe=e=>{const t=le(),{recallAllParameters:n}=j0(),r=Zl(),{currentData:o}=Rs((e==null?void 0:e.imageName)??zs.skipToken),{currentData:s}=GI((e==null?void 0:e.imageName)??zs.skipToken),i=l.useCallback(()=>{o&&(t(QI(o)),t(ni("unifiedCanvas")),r({title:NI("toast.sentToUnifiedCanvas"),status:"info",duration:2500,isClosable:!0}))},[t,r,o]),c=l.useCallback(()=>{o&&t(gg(o))},[t,o]),d=l.useCallback(()=>{s&&n(s.metadata)},[s]);return l.useEffect(()=>{e&&e.action==="sendToCanvas"&&i()},[e,i]),l.useEffect(()=>{e&&e.action==="sendToImg2Img"&&c()},[e,c]),l.useEffect(()=>{e&&e.action==="useAllParameters"&&d()},[e,d]),{handleSendToCanvas:i,handleSendToImg2Img:c,handleUseAllMetadata:d}},kbe=e=>(Sbe(e.selectedImage),null),jbe=l.memo(kbe),_be={},Ibe=({config:e=_be,selectedImage:t})=>{const n=H(sO),r=Q3("system"),o=le(),s=l.useCallback(()=>(localStorage.clear(),location.reload(),!1),[]);l.useEffect(()=>{fn.changeLanguage(n)},[n]),l.useEffect(()=>{cP(e)&&(r.info({config:e},"Received config"),o(f$(e)))},[o,e,r]),l.useEffect(()=>{o(p$())},[o]);const i=Xg(m$);return a.jsxs(cbe,{onReset:s,FallbackComponent:xbe,children:[a.jsx(rl,{w:"100vw",h:"100vh",position:"relative",overflow:"hidden",children:a.jsx(AG,{children:a.jsxs(rl,{sx:{gap:4,p:4,gridAutoRows:"min-content auto",w:"full",h:"full"},children:[i||a.jsx(jte,{}),a.jsx(N,{sx:{gap:4,w:"full",h:"full"},children:a.jsx(ibe,{})})]})})}),a.jsx(fee,{}),a.jsx(lee,{}),a.jsx(h$,{}),a.jsx(wbe,{}),a.jsx(jbe,{selectedImage:t})]})},Rbe=l.memo(Ibe);export{Rbe as default};