From 861c0fe76b0d4a0da81376ab97a58f8ad13454c5 Mon Sep 17 00:00:00 2001 From: Brandon Rising Date: Wed, 26 Jul 2023 12:25:46 -0400 Subject: [PATCH] Correct issues caused by merging main --- .../backend/model_management/models/base.py | 5 +- .../frontend/web/dist/assets/App-10c521da.js | 169 ++++++++++ .../frontend/web/dist/assets/App-3ab46138.js | 169 ---------- .../dist/assets/MantineProvider-48183abc.js | 1 - .../dist/assets/MantineProvider-97b2a7de.js | 1 + .../assets/ThemeLocaleProvider-aff3d007.js | 302 ------------------ .../assets/ThemeLocaleProvider-e6f4b86d.js | 302 ++++++++++++++++++ .../web/dist/assets/index-9e78a66d.js | 125 -------- .../web/dist/assets/index-efb4c895.js | 125 ++++++++ invokeai/frontend/web/dist/index.html | 2 +- invokeai/frontend/web/dist/locales/en.json | 1 + .../util/modelIdToMainModelParam.ts | 2 +- .../web/src/services/api/endpoints/models.ts | 10 +- 13 files changed, 613 insertions(+), 601 deletions(-) create mode 100644 invokeai/frontend/web/dist/assets/App-10c521da.js delete mode 100644 invokeai/frontend/web/dist/assets/App-3ab46138.js delete mode 100644 invokeai/frontend/web/dist/assets/MantineProvider-48183abc.js create mode 100644 invokeai/frontend/web/dist/assets/MantineProvider-97b2a7de.js delete mode 100644 invokeai/frontend/web/dist/assets/ThemeLocaleProvider-aff3d007.js create mode 100644 invokeai/frontend/web/dist/assets/ThemeLocaleProvider-e6f4b86d.js delete mode 100644 invokeai/frontend/web/dist/assets/index-9e78a66d.js create mode 100644 invokeai/frontend/web/dist/assets/index-efb4c895.js diff --git a/invokeai/backend/model_management/models/base.py b/invokeai/backend/model_management/models/base.py index 43c68a5643..370265dba8 100644 --- a/invokeai/backend/model_management/models/base.py +++ b/invokeai/backend/model_management/models/base.py @@ -583,7 +583,10 @@ class IAIOnnxRuntimeModel: providers.append(self.provider) else: providers = get_available_providers() - self.session = InferenceSession(self.proto.SerializeToString(), providers=providers, sess_options=sess) + try: + self.session = InferenceSession(self.proto.SerializeToString(), providers=providers, sess_options=sess) + except Exception as e: + raise e #self.session = InferenceSession("tmp.onnx", providers=[self.provider], sess_options=self.sess_options) # self.io_binding = self.session.io_binding() diff --git a/invokeai/frontend/web/dist/assets/App-10c521da.js b/invokeai/frontend/web/dist/assets/App-10c521da.js new file mode 100644 index 0000000000..2735630114 --- /dev/null +++ b/invokeai/frontend/web/dist/assets/App-10c521da.js @@ -0,0 +1,169 @@ +import{t as cv,r as X8,i as uv,a as Rc,b as m_,S as g_,c as v_,d as b_,e as dv,f as y_,g as fv,h as J8,j as Z8,k as eR,l as tR,m as x_,n as nR,o as rR,p as oR,q as w_,s as sR,u as aR,v as iR,w as lR,x as cR,y as uR,z as f,A as i,B as Xh,C as Ip,D as dR,E as S_,F as C_,G as fR,P as ld,H as M1,I as pR,J as hR,K as mR,L as gR,M as vR,N as bR,O as yR,Q as P2,R as xR,T as Te,U as je,V as Ct,W as et,X as cd,Y as Fo,Z as Yr,_ as Br,$ as qn,a0 as dl,a1 as ia,a2 as Ft,a3 as ns,a4 as Zl,a5 as za,a6 as Jh,a7 as D1,a8 as ud,a9 as or,aa as wR,ab as F,ac as k_,ad as j2,ae as __,af as pv,ag as Mc,ah as SR,ai as P_,aj as j_,ak as Dc,al as CR,am as fe,an as Ge,ao as Jt,ap as L,aq as kR,ar as I2,as as _R,at as PR,au as E2,av as te,aw as jR,ax as Dn,ay as Bn,az as Re,aA as W,aB as Qs,aC as Ye,aD as Kn,aE as I_,aF as E_,aG as O_,aH as _i,aI as Ds,aJ as T1,aK as IR,aL as ER,aM as OR,aN as Rl,aO as wu,aP as RR,aQ as MR,aR as DR,aS as TR,aT as AR,aU as O2,aV as ui,aW as A1,aX as Ep,aY as Zh,aZ as R_,a_ as os,a$ as M_,b0 as NR,b1 as Tc,b2 as D_,b3 as T_,b4 as Es,b5 as Po,b6 as Su,b7 as $R,b8 as zR,b9 as LR,ba as BR,bb as N1,bc as Op,bd as FR,be as HR,bf as If,bg as Ef,bh as Mu,bi as Du,bj as R2,bk as Rp,bl as M2,bm as Mp,bn as D2,bo as hv,bp as T2,bq as mv,br as A2,bs as Dp,bt as N2,bu as hc,bv as $2,bw as mc,bx as z2,by as Tp,bz as $1,bA as z1,bB as A_,bC as L1,bD as B1,bE as WR,bF as VR,bG as em,bH as ql,bI as UR,bJ as GR,bK as vp,bL as qR,bM as KR,bN as YR,bO as gv,bP as N_,bQ as QR,bR as $_,bS as z_,bT as ss,bU as L2,bV as La,bW as XR,bX as vv,bY as JR,bZ as L_,b_ as B2,b$ as ZR,c0 as e7,c1 as t7,c2 as n7,c3 as r7,c4 as o7,c5 as F1,c6 as H1,c7 as s7,c8 as Ln,c9 as F2,ca as B_,cb as a7,cc as i7,cd as l7,ce as c7,cf as u7,cg as d7,ch as f7,ci as p7,cj as h7,ck as F_,cl as m7,cm as g7,cn as v7,co as b7,cp as y7,cq as x7,cr as w7,cs as S7,ct as C7,cu as k7,cv as so,cw as sr,cx as _7,cy as W1,cz as dd,cA as fd,cB as P7,cC as H2,cD as j7,cE as W2,cF as I7,cG as E7,cH as O7,cI as V2,cJ as U2,cK as na,cL as V1,cM as G2,cN as q2,cO as tm,cP as R7,cQ as M7,cR as D7,cS as T7,cT as K2,cU as Y2,cV as A7,cW as Q2,cX as H_,cY as N7,cZ as W_,c_ as X2,c$ as $7,d0 as z7,d1 as Ss,d2 as L7,d3 as B7,d4 as V_,d5 as U_,d6 as F7,d7 as J2,d8 as H7,d9 as W7,da as G_,db as V7,dc as U7,dd as G7,de as q7,df as K7,dg as Y7,dh as Q7,di as q_,dj as X7,dk as K_,dl as Z2,dm as Of,dn as J7,dp as U1,dq as Y_,dr as Z7,ds as eM,dt as tM,du as ls,dv as nM,dw as rM,dx as oM,dy as sM,dz as aM,dA as iM,dB as lM,dC as cM,dD as uM,dE as dM,dF as fM,dG as pM,dH as hM,dI as mM,dJ as ew,dK as tw,dL as gM,dM as Q_,dN as X_,dO as pd,dP as J_,dQ as Wu,dR as Z_,dS as nw,dT as vM,dU as bM,dV as e3,dW as yM,dX as G1,dY as rw,dZ as t3,d_ as xM,d$ as ow,e0 as n3,e1 as Ts,e2 as wM,e3 as r3,e4 as sw,e5 as SM,e6 as CM,e7 as kM,e8 as _M,e9 as PM,ea as jM,eb as IM,ec as EM,ed as OM,ee as RM,ef as MM,eg as DM,eh as TM,ei as AM,ej as NM,ek as $M,el as zM,em as LM,en as BM,eo as FM,ep as aw,eq as bp,er as HM,es as Ap,et as o3,eu as Vu,ev as WM,ew as VM,ex as ea,ey as s3,ez as q1,eA as hd,eB as UM,eC as GM,eD as qM,eE as Ea,eF as a3,eG as KM,eH as YM,eI as i3,eJ as QM,eK as XM,eL as JM,eM as ZM,eN as eD,eO as tD,eP as nD,eQ as rD,eR as oD,eS as sD,eT as iw,eU as aD,eV as iD,eW as lD,eX as cD,eY as uD,eZ as dD,e_ as fD,e$ as pD,f0 as a0,f1 as Js,f2 as i0,f3 as l0,f4 as Rf,f5 as lw,f6 as bv,f7 as hD,f8 as mD,f9 as gD,fa as vD,fb as Np,fc as l3,fd as c3,fe as bD,ff as yD,fg as u3,fh as d3,fi as f3,fj as p3,fk as h3,fl as m3,fm as g3,fn as v3,fo as ec,fp as tc,fq as b3,fr as y3,fs as xD,ft as x3,fu as w3,fv as S3,fw as C3,fx as k3,fy as _3,fz as K1,fA as wD,fB as cw,fC as SD,fD as CD,fE as $p,fF as uw,fG as dw,fH as fw,fI as pw,fJ as kD,fK as _D,fL as PD,fM as jD,fN as ID,fO as ED,fP as OD,fQ as RD,fR as MD}from"./index-efb4c895.js";import{u as DD,c as TD,a as Rn,b as rr,I as no,d as Ba,P as Uu,C as AD,e as be,m as nm,f as P3,g as Fa,h as ND,r as Ue,i as $D,j as hw,k as Vt,l as wr}from"./MantineProvider-97b2a7de.js";function zD(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 mw=1/0,LD=17976931348623157e292;function c0(e){if(!e)return e===0?e:0;if(e=cv(e),e===mw||e===-mw){var t=e<0?-1:1;return t*LD}return e===e?e:0}var BD=function(){return X8.Date.now()};const u0=BD;var FD="Expected a function",HD=Math.max,WD=Math.min;function VD(e,t,n){var r,o,s,a,c,d,p=0,h=!1,m=!1,v=!0;if(typeof e!="function")throw new TypeError(FD);t=cv(t)||0,uv(n)&&(h=!!n.leading,m="maxWait"in n,s=m?HD(cv(n.maxWait)||0,t):s,v="trailing"in n?!!n.trailing:v);function b(O){var R=r,M=o;return r=o=void 0,p=O,a=e.apply(M,R),a}function w(O){return p=O,c=setTimeout(k,t),h?b(O):a}function y(O){var R=O-d,M=O-p,T=t-R;return m?WD(T,s-M):T}function S(O){var R=O-d,M=O-p;return d===void 0||R>=t||R<0||m&&M>=s}function k(){var O=u0();if(S(O))return _(O);c=setTimeout(k,y(O))}function _(O){return c=void 0,v&&r?b(O):(r=o=void 0,a)}function I(){c!==void 0&&clearTimeout(c),p=0,r=d=o=c=void 0}function P(){return c===void 0?a:_(u0())}function E(){var O=u0(),R=S(O);if(r=arguments,o=this,d=O,R){if(c===void 0)return w(d);if(m)return clearTimeout(c),c=setTimeout(k,t),b(d)}return c===void 0&&(c=setTimeout(k,t)),a}return E.cancel=I,E.flush=P,E}var UD=200;function GD(e,t,n,r){var o=-1,s=v_,a=!0,c=e.length,d=[],p=t.length;if(!c)return d;n&&(t=Rc(t,m_(n))),r?(s=b_,a=!1):t.length>=UD&&(s=dv,a=!1,t=new g_(t));e:for(;++o=120&&h.length>=120)?new g_(a&&h):void 0}h=e[0];var m=-1,v=c[0];e:for(;++m{r.has(s)&&n(o,s)})}const j3=({id:e,x:t,y:n,width:r,height:o,style:s,color:a,strokeColor:c,strokeWidth:d,className:p,borderRadius:h,shapeRendering:m,onClick:v})=>{const{background:b,backgroundColor:w}=s||{},y=a||b||w;return i.jsx("rect",{className:Xh(["react-flow__minimap-node",p]),x:t,y:n,rx:h,ry:h,width:r,height:o,fill:y,stroke:c,strokeWidth:d,shapeRendering:m,onClick:v?S=>v(S,e):void 0})};j3.displayName="MiniMapNode";var fT=f.memo(j3);const pT=e=>e.nodeOrigin,hT=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),d0=e=>e instanceof Function?e:()=>e;function mT({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=fT,onClick:a}){const c=Ip(hT,M1),d=Ip(pT),p=d0(t),h=d0(e),m=d0(n),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return i.jsx(i.Fragment,{children:c.map(b=>{const{x:w,y}=dR(b,d).positionAbsolute;return i.jsx(s,{x:w,y,width:b.width,height:b.height,style:b.style,className:m(b),color:p(b),borderRadius:r,strokeColor:h(b),strokeWidth:o,shapeRendering:v,onClick:a,id:b.id},b.id)})})}var gT=f.memo(mT);const vT=200,bT=150,yT=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?mR(gR(t,e.nodeOrigin),n):n,rfId:e.rfId}},xT="react-flow__minimap-desc";function I3({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:c,maskColor:d="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:v,onNodeClick:b,pannable:w=!1,zoomable:y=!1,ariaLabel:S="React Flow mini map",inversePan:k=!1,zoomStep:_=10}){const I=S_(),P=f.useRef(null),{boundingRect:E,viewBB:O,rfId:R}=Ip(yT,M1),M=(e==null?void 0:e.width)??vT,T=(e==null?void 0:e.height)??bT,A=E.width/M,$=E.height/T,Q=Math.max(A,$),B=Q*M,V=Q*T,q=5*Q,G=E.x-(B-E.width)/2-q,D=E.y-(V-E.height)/2-q,z=B+q*2,H=V+q*2,Y=`${xT}-${R}`,ie=f.useRef(0);ie.current=Q,f.useEffect(()=>{if(P.current){const oe=C_(P.current),K=re=>{const{transform:se,d3Selection:pe,d3Zoom:le}=I.getState();if(re.sourceEvent.type!=="wheel"||!pe||!le)return;const ge=-re.sourceEvent.deltaY*(re.sourceEvent.deltaMode===1?.05:re.sourceEvent.deltaMode?1:.002)*_,ke=se[2]*Math.pow(2,ge);le.scaleTo(pe,ke)},U=re=>{const{transform:se,d3Selection:pe,d3Zoom:le,translateExtent:ge,width:ke,height:xe}=I.getState();if(re.sourceEvent.type!=="mousemove"||!pe||!le)return;const de=ie.current*Math.max(1,se[2])*(k?-1:1),Ae={x:se[0]-re.sourceEvent.movementX*de,y:se[1]-re.sourceEvent.movementY*de},Ee=[[0,0],[ke,xe]],$e=pR.translate(Ae.x,Ae.y).scale(se[2]),kt=le.constrain()($e,Ee,ge);le.transform(pe,kt)},ae=fR().on("zoom",w?U:null).on("zoom.wheel",y?K:null);return oe.call(ae),()=>{oe.on("zoom",null)}}},[w,y,k,_]);const ye=v?oe=>{const K=hR(oe);v(oe,{x:K[0],y:K[1]})}:void 0,Z=b?(oe,K)=>{const U=I.getState().nodeInternals.get(K);b(oe,U)}:void 0;return i.jsx(ld,{position:m,style:e,className:Xh(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:i.jsxs("svg",{width:M,height:T,viewBox:`${G} ${D} ${z} ${H}`,role:"img","aria-labelledby":Y,ref:P,onClick:ye,children:[S&&i.jsx("title",{id:Y,children:S}),i.jsx(gT,{onClick:Z,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:a,nodeComponent:c}),i.jsx("path",{className:"react-flow__minimap-mask",d:`M${G-q},${D-q}h${z+q*2}v${H+q*2}h${-z-q*2}z + M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fill:d,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})]})})}I3.displayName="MiniMap";var wT=f.memo(I3),Cs;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Cs||(Cs={}));function ST({color:e,dimensions:t,lineWidth:n}){return i.jsx("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function CT({color:e,radius:t}){return i.jsx("circle",{cx:t,cy:t,r:t,fill:e})}const kT={[Cs.Dots]:"#91919a",[Cs.Lines]:"#eee",[Cs.Cross]:"#e2e2e2"},_T={[Cs.Dots]:1,[Cs.Lines]:1,[Cs.Cross]:6},PT=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function E3({id:e,variant:t=Cs.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=2,color:a,style:c,className:d}){const p=f.useRef(null),{transform:h,patternId:m}=Ip(PT,M1),v=a||kT[t],b=r||_T[t],w=t===Cs.Dots,y=t===Cs.Cross,S=Array.isArray(n)?n:[n,n],k=[S[0]*h[2]||1,S[1]*h[2]||1],_=b*h[2],I=y?[_,_]:k,P=w?[_/s,_/s]:[I[0]/s,I[1]/s];return i.jsxs("svg",{className:Xh(["react-flow__background",d]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background",children:[i.jsx("pattern",{id:m+e,x:h[0]%k[0],y:h[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${P[0]},-${P[1]})`,children:w?i.jsx(CT,{color:v,radius:_/s}):i.jsx(ST,{dimensions:I,color:v,lineWidth:o})}),i.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`})]})}E3.displayName="Background";var jT=f.memo(E3),Tu;(function(e){e.Line="line",e.Handle="handle"})(Tu||(Tu={}));function IT({width:e,prevWidth:t,height:n,prevHeight:r,invertX:o,invertY:s}){const a=e-t,c=n-r,d=[a>0?1:a<0?-1:0,c>0?1:c<0?-1:0];return a&&o&&(d[0]=d[0]*-1),c&&s&&(d[1]=d[1]*-1),d}const O3={width:0,height:0,x:0,y:0},ET={...O3,pointerX:0,pointerY:0,aspectRatio:1};function OT({nodeId:e,position:t,variant:n=Tu.Handle,className:r,style:o={},children:s,color:a,minWidth:c=10,minHeight:d=10,maxWidth:p=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:m=!1,shouldResize:v,onResizeStart:b,onResize:w,onResizeEnd:y}){const S=vR(),k=typeof e=="string"?e:S,_=S_(),I=f.useRef(null),P=f.useRef(ET),E=f.useRef(O3),O=bR(),R=n===Tu.Line?"right":"bottom-right",M=t??R;f.useEffect(()=>{if(!I.current||!k)return;const Q=C_(I.current),B=M.includes("right")||M.includes("left"),V=M.includes("bottom")||M.includes("top"),q=M.includes("left"),G=M.includes("top"),D=yR().on("start",z=>{const H=_.getState().nodeInternals.get(k),{xSnapped:Y,ySnapped:ie}=O(z);E.current={width:(H==null?void 0:H.width)??0,height:(H==null?void 0:H.height)??0,x:(H==null?void 0:H.position.x)??0,y:(H==null?void 0:H.position.y)??0},P.current={...E.current,pointerX:Y,pointerY:ie,aspectRatio:E.current.width/E.current.height},b==null||b(z,{...E.current})}).on("drag",z=>{const{nodeInternals:H,triggerNodeChanges:Y}=_.getState(),{xSnapped:ie,ySnapped:ye}=O(z),Z=H.get(k);if(Z){const oe=[],{pointerX:K,pointerY:U,width:ae,height:re,x:se,y:pe,aspectRatio:le}=P.current,{x:ge,y:ke,width:xe,height:de}=E.current,Ae=Math.floor(B?ie-K:0),Ee=Math.floor(V?ye-U:0);let $e=P2(ae+(q?-Ae:Ae),c,p),kt=P2(re+(G?-Ee:Ee),d,h);if(m){const Me=$e/kt,Pt=B&&V,At=B&&!V,we=V&&!B;$e=Me<=le&&Pt||we?kt*le:$e,kt=Me>le&&Pt||At?$e/le:kt,$e>=p?($e=p,kt=p/le):$e<=c&&($e=c,kt=c/le),kt>=h?(kt=h,$e=h*le):kt<=d&&(kt=d,$e=d*le)}const ct=$e!==xe,on=kt!==de;if(q||G){const Me=q?se-($e-ae):se,Pt=G?pe-(kt-re):pe,At=Me!==ge&&ct,we=Pt!==ke&&on;if(At||we){const ht={id:Z.id,type:"position",position:{x:At?Me:ge,y:we?Pt:ke}};oe.push(ht),E.current.x=ht.position.x,E.current.y=ht.position.y}}if(ct||on){const Me={id:k,type:"dimensions",updateStyle:!0,resizing:!0,dimensions:{width:$e,height:kt}};oe.push(Me),E.current.width=$e,E.current.height=kt}if(oe.length===0)return;const vt=IT({width:E.current.width,prevWidth:xe,height:E.current.height,prevHeight:de,invertX:q,invertY:G}),bt={...E.current,direction:vt};if((v==null?void 0:v(z,bt))===!1)return;w==null||w(z,bt),Y(oe)}}).on("end",z=>{const H={id:k,type:"dimensions",resizing:!1};y==null||y(z,{...E.current}),_.getState().triggerNodeChanges([H])});return Q.call(D),()=>{Q.on(".drag",null)}},[k,M,c,d,p,h,m,O,b,w,y]);const T=M.split("-"),A=n===Tu.Line?"borderColor":"backgroundColor",$=a?{...o,[A]:a}:o;return i.jsx("div",{className:Xh(["react-flow__resize-control","nodrag",...T,n,r]),ref:I,style:$,children:s})}var RT=f.memo(OT);const R3=1/60*1e3,MT=typeof performance<"u"?()=>performance.now():()=>Date.now(),M3=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(MT()),R3);function DT(e){let t=[],n=[],r=0,o=!1,s=!1;const a=new WeakSet,c={schedule:(d,p=!1,h=!1)=>{const m=h&&o,v=m?t:n;return p&&a.add(d),v.indexOf(d)===-1&&(v.push(d),m&&o&&(r=t.length)),d},cancel:d=>{const p=n.indexOf(d);p!==-1&&n.splice(p,1),a.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]=DT(()=>Gu=!0),e),{}),AT=md.reduce((e,t)=>{const n=rm[t];return e[t]=(r,o=!1,s=!1)=>(Gu||zT(),n.schedule(r,o,s)),e},{}),NT=md.reduce((e,t)=>(e[t]=rm[t].cancel,e),{});md.reduce((e,t)=>(e[t]=()=>rm[t].process(nc),e),{});const $T=e=>rm[e].process(nc),D3=e=>{Gu=!1,nc.delta=yv?R3:Math.max(Math.min(e-nc.timestamp,TT),1),nc.timestamp=e,xv=!0,md.forEach($T),xv=!1,Gu&&(yv=!1,M3(D3))},zT=()=>{Gu=!0,yv=!0,xv||M3(D3)},bw=()=>nc;function Y1(e){const t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function LT(e){const{theme:t}=xR(),n=DD();return f.useMemo(()=>TD(t.direction,{...n,...e}),[e,t.direction,n])}var BT=Object.defineProperty,FT=(e,t,n)=>t in e?BT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vr=(e,t,n)=>(FT(e,typeof t!="symbol"?t+"":t,n),n);function yw(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 HT=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function xw(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function ww(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var wv=typeof window<"u"?f.useLayoutEffect:f.useEffect,zp=e=>e,WT=class{constructor(){vr(this,"descendants",new Map),vr(this,"register",e=>{if(e!=null)return HT(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),vr(this,"unregister",e=>{this.descendants.delete(e);const t=yw(Array.from(this.descendants.keys()));this.assignIndex(t)}),vr(this,"destroy",()=>{this.descendants.clear()}),vr(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),vr(this,"count",()=>this.descendants.size),vr(this,"enabledCount",()=>this.enabledValues().length),vr(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),vr(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),vr(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),vr(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),vr(this,"first",()=>this.item(0)),vr(this,"firstEnabled",()=>this.enabledItem(0)),vr(this,"last",()=>this.item(this.descendants.size-1)),vr(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),vr(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),vr(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),vr(this,"next",(e,t=!0)=>{const n=xw(e,this.count(),t);return this.item(n)}),vr(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=xw(r,this.enabledCount(),t);return this.enabledItem(o)}),vr(this,"prev",(e,t=!0)=>{const n=ww(e,this.count()-1,t);return this.item(n)}),vr(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=ww(r,this.enabledCount()-1,t);return this.enabledItem(o)}),vr(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=yw(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 VT(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 cn(...e){return t=>{e.forEach(n=>{VT(n,t)})}}function UT(...e){return f.useMemo(()=>cn(...e),e)}function GT(){const e=f.useRef(new WT);return wv(()=>()=>e.current.destroy()),e.current}var[qT,T3]=Rn({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function KT(e){const t=T3(),[n,r]=f.useState(-1),o=f.useRef(null);wv(()=>()=>{o.current&&t.unregister(o.current)},[]),wv(()=>{if(!o.current)return;const a=Number(o.current.dataset.index);n!=a&&!Number.isNaN(a)&&r(a)});const s=zp(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:cn(s,o)}}function Q1(){return[zp(qT),()=>zp(T3()),()=>GT(),o=>KT(o)]}var[YT,om]=Rn({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[QT,X1]=Rn({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[XT,gde,JT,ZT]=Q1(),Cu=Te(function(t,n){const{getButtonProps:r}=X1(),o=r(t,n),a={display:"flex",alignItems:"center",width:"100%",outline:0,...om().button};return i.jsx(je.button,{...o,className:Ct("chakra-accordion__button",t.className),__css:a})});Cu.displayName="AccordionButton";function Ac(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(v,b)=>v!==b}=e,s=rr(r),a=rr(o),[c,d]=f.useState(n),p=t!==void 0,h=p?t:c,m=rr(v=>{const w=typeof v=="function"?v(h):v;a(h,w)&&(p||d(w),s(w))},[p,s,h,a]);return[h,m]}function eA(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...a}=e;rA(e),oA(e);const c=JT(),[d,p]=f.useState(-1);f.useEffect(()=>()=>{p(-1)},[]);const[h,m]=Ac({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:h,setIndex:m,htmlProps:a,getAccordionItemProps:b=>{let w=!1;return b!==null&&(w=Array.isArray(h)?h.includes(b):h===b),{isOpen:w,onChange:S=>{if(b!==null)if(o&&Array.isArray(h)){const k=S?h.concat(b):h.filter(_=>_!==b);m(k)}else S?m(b):s&&m(-1)}}},focusedIndex:d,setFocusedIndex:p,descendants:c}}var[tA,J1]=Rn({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function nA(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:a}=J1(),c=f.useRef(null),d=f.useId(),p=r??d,h=`accordion-button-${p}`,m=`accordion-panel-${p}`;sA(e);const{register:v,index:b,descendants:w}=ZT({disabled:t&&!n}),{isOpen:y,onChange:S}=s(b===-1?null:b);aA({isOpen:y,isDisabled:t});const k=()=>{S==null||S(!0)},_=()=>{S==null||S(!1)},I=f.useCallback(()=>{S==null||S(!y),a(b)},[b,a,y,S]),P=f.useCallback(M=>{const A={ArrowDown:()=>{const $=w.nextEnabled(b);$==null||$.node.focus()},ArrowUp:()=>{const $=w.prevEnabled(b);$==null||$.node.focus()},Home:()=>{const $=w.firstEnabled();$==null||$.node.focus()},End:()=>{const $=w.lastEnabled();$==null||$.node.focus()}}[M.key];A&&(M.preventDefault(),A(M))},[w,b]),E=f.useCallback(()=>{a(b)},[a,b]),O=f.useCallback(function(T={},A=null){return{...T,type:"button",ref:cn(v,c,A),id:h,disabled:!!t,"aria-expanded":!!y,"aria-controls":m,onClick:et(T.onClick,I),onFocus:et(T.onFocus,E),onKeyDown:et(T.onKeyDown,P)}},[h,t,y,I,E,P,m,v]),R=f.useCallback(function(T={},A=null){return{...T,ref:A,role:"region",id:m,"aria-labelledby":h,hidden:!y}},[h,y,m]);return{isOpen:y,isDisabled:t,isFocusable:n,onOpen:k,onClose:_,getButtonProps:O,getPanelProps:R,htmlProps:o}}function rA(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;cd({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function oA(e){cd({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 sA(e){cd({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 aA(e){cd({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function ku(e){const{isOpen:t,isDisabled:n}=X1(),{reduceMotion:r}=J1(),o=Ct("chakra-accordion__icon",e.className),s=om(),a={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return i.jsx(no,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:a,...e,children:i.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}ku.displayName="AccordionIcon";var _u=Te(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...a}=nA(t),d={...om().container,overflowAnchor:"none"},p=f.useMemo(()=>a,[a]);return i.jsx(QT,{value:p,children:i.jsx(je.div,{ref:n,...s,className:Ct("chakra-accordion__item",o),__css:d,children:typeof r=="function"?r({isExpanded:!!a.isOpen,isDisabled:!!a.isDisabled}):r})})});_u.displayName="AccordionItem";var Gi={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},du={scale:{enter:{scale:1},exit:{scale:.95}},fade:{enter:{opacity:1},exit:{opacity:0}},pushLeft:{enter:{x:"100%"},exit:{x:"-30%"}},pushRight:{enter:{x:"-100%"},exit:{x:"30%"}},pushUp:{enter:{y:"100%"},exit:{y:"-30%"}},pushDown:{enter:{y:"-100%"},exit:{y:"30%"}},slideLeft:{position:{left:0,top:0,bottom:0,width:"100%"},enter:{x:0,y:0},exit:{x:"-100%",y:0}},slideRight:{position:{right:0,top:0,bottom:0,width:"100%"},enter:{x:0,y:0},exit:{x:"100%",y:0}},slideUp:{position:{top:0,left:0,right:0,maxWidth:"100vw"},enter:{x:0,y:0},exit:{x:0,y:"-100%"}},slideDown:{position:{bottom:0,left:0,right:0,maxWidth:"100vw"},enter:{x:0,y:0},exit:{x:0,y:"100%"}}};function Sv(e){var t;switch((t=e==null?void 0:e.direction)!=null?t:"right"){case"right":return du.slideRight;case"left":return du.slideLeft;case"bottom":return du.slideDown;case"top":return du.slideUp;default:return du.slideRight}}var Ki={enter:{duration:.2,ease:Gi.easeOut},exit:{duration:.1,ease:Gi.easeIn}},ks={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})},iA=e=>e!=null&&parseInt(e.toString(),10)>0,Sw={exit:{height:{duration:.2,ease:Gi.ease},opacity:{duration:.3,ease:Gi.ease}},enter:{height:{duration:.3,ease:Gi.ease},opacity:{duration:.4,ease:Gi.ease}}},lA={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:iA(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:ks.exit(Sw.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:ks.enter(Sw.enter,o)}}},sm=f.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:a="auto",style:c,className:d,transition:p,transitionEnd:h,...m}=e,[v,b]=f.useState(!1);f.useEffect(()=>{const _=setTimeout(()=>{b(!0)});return()=>clearTimeout(_)},[]),cd({condition:Number(s)>0&&!!r,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const w=parseFloat(s.toString())>0,y={startingHeight:s,endingHeight:a,animateOpacity:o,transition:v?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:w?"block":"none"}}},S=r?n:!0,k=n||r?"enter":"exit";return i.jsx(Fo,{initial:!1,custom:y,children:S&&i.jsx(Yr.div,{ref:t,...m,className:Ct("chakra-collapse",d),style:{overflow:"hidden",display:"block",...c},custom:y,variants:lA,initial:r?"exit":!1,animate:k,exit:"exit"})})});sm.displayName="Collapse";var cA={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:ks.enter(Ki.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:ks.exit(Ki.exit,n),transitionEnd:t==null?void 0:t.exit}}},A3={initial:"exit",animate:"enter",exit:"exit",variants:cA},uA=f.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:a,transitionEnd:c,delay:d,...p}=t,h=o||r?"enter":"exit",m=r?o&&r:!0,v={transition:a,transitionEnd:c,delay:d};return i.jsx(Fo,{custom:v,children:m&&i.jsx(Yr.div,{ref:n,className:Ct("chakra-fade",s),custom:v,...A3,animate:h,...p})})});uA.displayName="Fade";var dA={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:ks.exit(Ki.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:ks.enter(Ki.enter,n),transitionEnd:e==null?void 0:e.enter}}},N3={initial:"exit",animate:"enter",exit:"exit",variants:dA},fA=f.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:a=.95,className:c,transition:d,transitionEnd:p,delay:h,...m}=t,v=r?o&&r:!0,b=o||r?"enter":"exit",w={initialScale:a,reverse:s,transition:d,transitionEnd:p,delay:h};return i.jsx(Fo,{custom:w,children:v&&i.jsx(Yr.div,{ref:n,className:Ct("chakra-offset-slide",c),...N3,animate:b,custom:w,...m})})});fA.displayName="ScaleFade";var pA={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:ks.exit(Ki.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:ks.enter(Ki.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var a;const c={x:t,y:e};return{opacity:0,transition:(a=n==null?void 0:n.exit)!=null?a:ks.exit(Ki.exit,s),...o?{...c,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...c,...r==null?void 0:r.exit}}}}},Cv={initial:"initial",animate:"enter",exit:"exit",variants:pA},hA=f.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:a,offsetX:c=0,offsetY:d=8,transition:p,transitionEnd:h,delay:m,...v}=t,b=r?o&&r:!0,w=o||r?"enter":"exit",y={offsetX:c,offsetY:d,reverse:s,transition:p,transitionEnd:h,delay:m};return i.jsx(Fo,{custom:y,children:b&&i.jsx(Yr.div,{ref:n,className:Ct("chakra-offset-slide",a),custom:y,...Cv,animate:w,...v})})});hA.displayName="SlideFade";var Cw={exit:{duration:.15,ease:Gi.easeInOut},enter:{type:"spring",damping:25,stiffness:180}},mA={exit:({direction:e,transition:t,transitionEnd:n,delay:r})=>{var o;const{exit:s}=Sv({direction:e});return{...s,transition:(o=t==null?void 0:t.exit)!=null?o:ks.exit(Cw.exit,r),transitionEnd:n==null?void 0:n.exit}},enter:({direction:e,transitionEnd:t,transition:n,delay:r})=>{var o;const{enter:s}=Sv({direction:e});return{...s,transition:(o=n==null?void 0:n.enter)!=null?o:ks.enter(Cw.enter,r),transitionEnd:t==null?void 0:t.enter}}},$3=f.forwardRef(function(t,n){const{direction:r="right",style:o,unmountOnExit:s,in:a,className:c,transition:d,transitionEnd:p,delay:h,motionProps:m,...v}=t,b=Sv({direction:r}),w=Object.assign({position:"fixed"},b.position,o),y=s?a&&s:!0,S=a||s?"enter":"exit",k={transitionEnd:p,transition:d,direction:r,delay:h};return i.jsx(Fo,{custom:k,children:y&&i.jsx(Yr.div,{...v,ref:n,initial:"exit",className:Ct("chakra-slide",c),animate:S,exit:"exit",custom:k,variants:mA,style:w,...m})})});$3.displayName="Slide";var Pu=Te(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:a}=J1(),{getPanelProps:c,isOpen:d}=X1(),p=c(s,n),h=Ct("chakra-accordion__panel",r),m=om();a||delete p.hidden;const v=i.jsx(je.div,{...p,__css:m.panel,className:h});return a?v:i.jsx(sm,{in:d,...o,children:v})});Pu.displayName="AccordionPanel";var z3=Te(function({children:t,reduceMotion:n,...r},o){const s=Br("Accordion",r),a=qn(r),{htmlProps:c,descendants:d,...p}=eA(a),h=f.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return i.jsx(XT,{value:d,children:i.jsx(tA,{value:h,children:i.jsx(YT,{value:s,children:i.jsx(je.div,{ref:o,...c,className:Ct("chakra-accordion",r.className),__css:s.root,children:t})})})})});z3.displayName="Accordion";function gd(e){return f.Children.toArray(e).filter(t=>f.isValidElement(t))}var[gA,vA]=Rn({strict:!1,name:"ButtonGroupContext"}),bA={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}}},yA={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},nr=Te(function(t,n){const{size:r,colorScheme:o,variant:s,className:a,spacing:c="0.5rem",isAttached:d,isDisabled:p,orientation:h="horizontal",...m}=t,v=Ct("chakra-button__group",a),b=f.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let w={display:"inline-flex",...d?bA[h]:yA[h](c)};const y=h==="vertical";return i.jsx(gA,{value:b,children:i.jsx(je.div,{ref:n,role:"group",__css:w,className:v,"data-attached":d?"":void 0,"data-orientation":h,flexDir:y?"column":void 0,...m})})});nr.displayName="ButtonGroup";function xA(e){const[t,n]=f.useState(!e);return{ref:f.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function kv(e){const{children:t,className:n,...r}=e,o=f.isValidElement(t)?f.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=Ct("chakra-button__icon",n);return i.jsx(je.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}kv.displayName="ButtonIcon";function Lp(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=i.jsx(dl,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:a,...c}=e,d=Ct("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",h=f.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[p]:t?r:0,fontSize:"1em",lineHeight:"normal",...a}),[a,t,p,r]);return i.jsx(je.div,{className:d,...c,__css:h,children:o})}Lp.displayName="ButtonSpinner";var gc=Te((e,t)=>{const n=vA(),r=ia("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:a,children:c,leftIcon:d,rightIcon:p,loadingText:h,iconSpacing:m="0.5rem",type:v,spinner:b,spinnerPlacement:w="start",className:y,as:S,...k}=qn(e),_=f.useMemo(()=>{const O={...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:O}}},[r,n]),{ref:I,type:P}=xA(S),E={rightIcon:p,leftIcon:d,iconSpacing:m,children:c};return i.jsxs(je.button,{ref:UT(t,I),as:S,type:v??P,"data-active":Ft(a),"data-loading":Ft(s),__css:_,className:Ct("chakra-button",y),...k,disabled:o||s,children:[s&&w==="start"&&i.jsx(Lp,{className:"chakra-button__spinner--start",label:h,placement:"start",spacing:m,children:b}),s?h||i.jsx(je.span,{opacity:0,children:i.jsx(kw,{...E})}):i.jsx(kw,{...E}),s&&w==="end"&&i.jsx(Lp,{className:"chakra-button__spinner--end",label:h,placement:"end",spacing:m,children:b})]})});gc.displayName="Button";function kw(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return i.jsxs(i.Fragment,{children:[t&&i.jsx(kv,{marginEnd:o,children:t}),r,n&&i.jsx(kv,{marginStart:o,children:n})]})}var Ca=Te((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...a}=e,c=n||r,d=f.isValidElement(c)?f.cloneElement(c,{"aria-hidden":!0,focusable:!1}):null;return i.jsx(gc,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...a,children:d})});Ca.displayName="IconButton";var[vde,wA]=Rn({name:"CheckboxGroupContext",strict:!1});function SA(e){const[t,n]=f.useState(e),[r,o]=f.useState(!1);return e!==t&&(o(!0),n(e)),r}function CA(e){return i.jsx(je.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:i.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function kA(e){return i.jsx(je.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:i.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function _A(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?kA:CA;return n||t?i.jsx(je.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:i.jsx(o,{...r})}):null}var[PA,L3]=Rn({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[jA,vd]=Rn({strict:!1,name:"FormControlContext"});function IA(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...a}=e,c=f.useId(),d=t||`field-${c}`,p=`${d}-label`,h=`${d}-feedback`,m=`${d}-helptext`,[v,b]=f.useState(!1),[w,y]=f.useState(!1),[S,k]=f.useState(!1),_=f.useCallback((R={},M=null)=>({id:m,...R,ref:cn(M,T=>{T&&y(!0)})}),[m]),I=f.useCallback((R={},M=null)=>({...R,ref:M,"data-focus":Ft(S),"data-disabled":Ft(o),"data-invalid":Ft(r),"data-readonly":Ft(s),id:R.id!==void 0?R.id:p,htmlFor:R.htmlFor!==void 0?R.htmlFor:d}),[d,o,S,r,s,p]),P=f.useCallback((R={},M=null)=>({id:h,...R,ref:cn(M,T=>{T&&b(!0)}),"aria-live":"polite"}),[h]),E=f.useCallback((R={},M=null)=>({...R,...a,ref:M,role:"group"}),[a]),O=f.useCallback((R={},M=null)=>({...R,ref:M,role:"presentation","aria-hidden":!0,children:R.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!S,onFocus:()=>k(!0),onBlur:()=>k(!1),hasFeedbackText:v,setHasFeedbackText:b,hasHelpText:w,setHasHelpText:y,id:d,labelId:p,feedbackId:h,helpTextId:m,htmlProps:a,getHelpTextProps:_,getErrorMessageProps:P,getRootProps:E,getLabelProps:I,getRequiredIndicatorProps:O}}var mo=Te(function(t,n){const r=Br("Form",t),o=qn(t),{getRootProps:s,htmlProps:a,...c}=IA(o),d=Ct("chakra-form-control",t.className);return i.jsx(jA,{value:c,children:i.jsx(PA,{value:r,children:i.jsx(je.div,{...s({},n),className:d,__css:r.container})})})});mo.displayName="FormControl";var EA=Te(function(t,n){const r=vd(),o=L3(),s=Ct("chakra-form__helper-text",t.className);return i.jsx(je.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});EA.displayName="FormHelperText";var zo=Te(function(t,n){var r;const o=ia("FormLabel",t),s=qn(t),{className:a,children:c,requiredIndicator:d=i.jsx(B3,{}),optionalIndicator:p=null,...h}=s,m=vd(),v=(r=m==null?void 0:m.getLabelProps(h,n))!=null?r:{ref:n,...h};return i.jsxs(je.label,{...v,className:Ct("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[c,m!=null&&m.isRequired?d:p]})});zo.displayName="FormLabel";var B3=Te(function(t,n){const r=vd(),o=L3();if(!(r!=null&&r.isRequired))return null;const s=Ct("chakra-form__required-indicator",t.className);return i.jsx(je.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});B3.displayName="RequiredIndicator";function Z1(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=eb(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":ns(n),"aria-required":ns(o),"aria-readonly":ns(r)}}function eb(e){var t,n,r;const o=vd(),{id:s,disabled:a,readOnly:c,required:d,isRequired:p,isInvalid:h,isReadOnly:m,isDisabled:v,onFocus:b,onBlur:w,...y}=e,S=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&S.push(o.feedbackId),o!=null&&o.hasHelpText&&S.push(o.helpTextId),{...y,"aria-describedby":S.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=a??v)!=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:et(o==null?void 0:o.onFocus,b),onBlur:et(o==null?void 0:o.onBlur,w)}}var tb={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},F3=je("span",{baseStyle:tb});F3.displayName="VisuallyHidden";var OA=je("input",{baseStyle:tb});OA.displayName="VisuallyHiddenInput";const RA=()=>typeof document<"u";let _w=!1,bd=null,nl=!1,_v=!1;const Pv=new Set;function nb(e,t){Pv.forEach(n=>n(e,t))}const MA=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function DA(e){return!(e.metaKey||!MA&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Pw(e){nl=!0,DA(e)&&(bd="keyboard",nb("keyboard",e))}function Dl(e){if(bd="pointer",e.type==="mousedown"||e.type==="pointerdown"){nl=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;nb("pointer",e)}}function TA(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function AA(e){TA(e)&&(nl=!0,bd="virtual")}function NA(e){e.target===window||e.target===document||(!nl&&!_v&&(bd="virtual",nb("virtual",e)),nl=!1,_v=!1)}function $A(){nl=!1,_v=!0}function jw(){return bd!=="pointer"}function zA(){if(!RA()||_w)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){nl=!0,e.apply(this,n)},document.addEventListener("keydown",Pw,!0),document.addEventListener("keyup",Pw,!0),document.addEventListener("click",AA,!0),window.addEventListener("focus",NA,!0),window.addEventListener("blur",$A,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",Dl,!0),document.addEventListener("pointermove",Dl,!0),document.addEventListener("pointerup",Dl,!0)):(document.addEventListener("mousedown",Dl,!0),document.addEventListener("mousemove",Dl,!0),document.addEventListener("mouseup",Dl,!0)),_w=!0}function H3(e){zA(),e(jw());const t=()=>e(jw());return Pv.add(t),()=>{Pv.delete(t)}}function LA(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function W3(e={}){const t=eb(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:a,onBlur:c,onFocus:d,"aria-describedby":p}=t,{defaultChecked:h,isChecked:m,isFocusable:v,onChange:b,isIndeterminate:w,name:y,value:S,tabIndex:k=void 0,"aria-label":_,"aria-labelledby":I,"aria-invalid":P,...E}=e,O=LA(E,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),R=rr(b),M=rr(c),T=rr(d),[A,$]=f.useState(!1),[Q,B]=f.useState(!1),[V,q]=f.useState(!1),[G,D]=f.useState(!1);f.useEffect(()=>H3($),[]);const z=f.useRef(null),[H,Y]=f.useState(!0),[ie,ye]=f.useState(!!h),Z=m!==void 0,oe=Z?m:ie,K=f.useCallback(de=>{if(r||n){de.preventDefault();return}Z||ye(oe?de.target.checked:w?!0:de.target.checked),R==null||R(de)},[r,n,oe,Z,w,R]);Zl(()=>{z.current&&(z.current.indeterminate=!!w)},[w]),Ba(()=>{n&&B(!1)},[n,B]),Zl(()=>{const de=z.current;if(!(de!=null&&de.form))return;const Ae=()=>{ye(!!h)};return de.form.addEventListener("reset",Ae),()=>{var Ee;return(Ee=de.form)==null?void 0:Ee.removeEventListener("reset",Ae)}},[]);const U=n&&!v,ae=f.useCallback(de=>{de.key===" "&&D(!0)},[D]),re=f.useCallback(de=>{de.key===" "&&D(!1)},[D]);Zl(()=>{if(!z.current)return;z.current.checked!==oe&&ye(z.current.checked)},[z.current]);const se=f.useCallback((de={},Ae=null)=>{const Ee=$e=>{Q&&$e.preventDefault(),D(!0)};return{...de,ref:Ae,"data-active":Ft(G),"data-hover":Ft(V),"data-checked":Ft(oe),"data-focus":Ft(Q),"data-focus-visible":Ft(Q&&A),"data-indeterminate":Ft(w),"data-disabled":Ft(n),"data-invalid":Ft(s),"data-readonly":Ft(r),"aria-hidden":!0,onMouseDown:et(de.onMouseDown,Ee),onMouseUp:et(de.onMouseUp,()=>D(!1)),onMouseEnter:et(de.onMouseEnter,()=>q(!0)),onMouseLeave:et(de.onMouseLeave,()=>q(!1))}},[G,oe,n,Q,A,V,w,s,r]),pe=f.useCallback((de={},Ae=null)=>({...de,ref:Ae,"data-active":Ft(G),"data-hover":Ft(V),"data-checked":Ft(oe),"data-focus":Ft(Q),"data-focus-visible":Ft(Q&&A),"data-indeterminate":Ft(w),"data-disabled":Ft(n),"data-invalid":Ft(s),"data-readonly":Ft(r)}),[G,oe,n,Q,A,V,w,s,r]),le=f.useCallback((de={},Ae=null)=>({...O,...de,ref:cn(Ae,Ee=>{Ee&&Y(Ee.tagName==="LABEL")}),onClick:et(de.onClick,()=>{var Ee;H||((Ee=z.current)==null||Ee.click(),requestAnimationFrame(()=>{var $e;($e=z.current)==null||$e.focus({preventScroll:!0})}))}),"data-disabled":Ft(n),"data-checked":Ft(oe),"data-invalid":Ft(s)}),[O,n,oe,s,H]),ge=f.useCallback((de={},Ae=null)=>({...de,ref:cn(z,Ae),type:"checkbox",name:y,value:S,id:a,tabIndex:k,onChange:et(de.onChange,K),onBlur:et(de.onBlur,M,()=>B(!1)),onFocus:et(de.onFocus,T,()=>B(!0)),onKeyDown:et(de.onKeyDown,ae),onKeyUp:et(de.onKeyUp,re),required:o,checked:oe,disabled:U,readOnly:r,"aria-label":_,"aria-labelledby":I,"aria-invalid":P?!!P:s,"aria-describedby":p,"aria-disabled":n,style:tb}),[y,S,a,K,M,T,ae,re,o,oe,U,r,_,I,P,s,p,n,k]),ke=f.useCallback((de={},Ae=null)=>({...de,ref:Ae,onMouseDown:et(de.onMouseDown,BA),"data-disabled":Ft(n),"data-checked":Ft(oe),"data-invalid":Ft(s)}),[oe,n,s]);return{state:{isInvalid:s,isFocused:Q,isChecked:oe,isActive:G,isHovered:V,isIndeterminate:w,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:le,getCheckboxProps:se,getIndicatorProps:pe,getInputProps:ge,getLabelProps:ke,htmlProps:O}}function BA(e){e.preventDefault(),e.stopPropagation()}var FA={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},HA={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},WA=za({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),VA=za({from:{opacity:0},to:{opacity:1}}),UA=za({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),V3=Te(function(t,n){const r=wA(),o={...r,...t},s=Br("Checkbox",o),a=qn(t),{spacing:c="0.5rem",className:d,children:p,iconColor:h,iconSize:m,icon:v=i.jsx(_A,{}),isChecked:b,isDisabled:w=r==null?void 0:r.isDisabled,onChange:y,inputProps:S,...k}=a;let _=b;r!=null&&r.value&&a.value&&(_=r.value.includes(a.value));let I=y;r!=null&&r.onChange&&a.value&&(I=Jh(r.onChange,y));const{state:P,getInputProps:E,getCheckboxProps:O,getLabelProps:R,getRootProps:M}=W3({...k,isDisabled:w,isChecked:_,onChange:I}),T=SA(P.isChecked),A=f.useMemo(()=>({animation:T?P.isIndeterminate?`${VA} 20ms linear, ${UA} 200ms linear`:`${WA} 200ms linear`:void 0,fontSize:m,color:h,...s.icon}),[h,m,T,P.isIndeterminate,s.icon]),$=f.cloneElement(v,{__css:A,isIndeterminate:P.isIndeterminate,isChecked:P.isChecked});return i.jsxs(je.label,{__css:{...HA,...s.container},className:Ct("chakra-checkbox",d),...M(),children:[i.jsx("input",{className:"chakra-checkbox__input",...E(S,n)}),i.jsx(je.span,{__css:{...FA,...s.control},className:"chakra-checkbox__control",...O(),children:$}),p&&i.jsx(je.span,{className:"chakra-checkbox__label",...R(),__css:{marginStart:c,...s.label},children:p})]})});V3.displayName="Checkbox";function GA(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function rb(e,t){let n=GA(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function jv(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 Bp(e,t,n){return(e-t)*100/(n-t)}function U3(e,t,n){return(n-t)*e+t}function Iv(e,t,n){const r=Math.round((e-t)/n)*n+t,o=jv(n);return rb(r,o)}function rc(e,t,n){return e==null?e:(n{var A;return r==null?"":(A=f0(r,s,n))!=null?A:""}),v=typeof o<"u",b=v?o:h,w=G3(ni(b),s),y=n??w,S=f.useCallback(A=>{A!==b&&(v||m(A.toString()),p==null||p(A.toString(),ni(A)))},[p,v,b]),k=f.useCallback(A=>{let $=A;return d&&($=rc($,a,c)),rb($,y)},[y,d,c,a]),_=f.useCallback((A=s)=>{let $;b===""?$=ni(A):$=ni(b)+A,$=k($),S($)},[k,s,S,b]),I=f.useCallback((A=s)=>{let $;b===""?$=ni(-A):$=ni(b)-A,$=k($),S($)},[k,s,S,b]),P=f.useCallback(()=>{var A;let $;r==null?$="":$=(A=f0(r,s,n))!=null?A:a,S($)},[r,n,s,S,a]),E=f.useCallback(A=>{var $;const Q=($=f0(A,s,y))!=null?$:a;S(Q)},[y,s,S,a]),O=ni(b);return{isOutOfRange:O>c||O" `}),[YA,K3]=Rn({name:"EditableContext",errorMessage:"useEditableContext: context is undefined. Seems you forgot to wrap the editable components in ``"}),Y3={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent"},Q3=Te(function(t,n){const{getInputProps:r}=K3(),o=q3(),s=r(t,n),a=Ct("chakra-editable__input",t.className);return i.jsx(je.input,{...s,__css:{outline:0,...Y3,...o.input},className:a})});Q3.displayName="EditableInput";var X3=Te(function(t,n){const{getPreviewProps:r}=K3(),o=q3(),s=r(t,n),a=Ct("chakra-editable__preview",t.className);return i.jsx(je.span,{...s,__css:{cursor:"text",display:"inline-block",...Y3,...o.preview},className:a})});X3.displayName="EditablePreview";function Yi(e,t,n,r){const o=rr(n);return f.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 QA(e){return"current"in e}var J3=()=>typeof window<"u";function XA(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var JA=e=>J3()&&e.test(navigator.vendor),ZA=e=>J3()&&e.test(XA()),e9=()=>ZA(/mac|iphone|ipad|ipod/i),t9=()=>e9()&&JA(/apple/i);function Z3(e){const{ref:t,elements:n,enabled:r}=e,o=()=>{var s,a;return(a=(s=t.current)==null?void 0:s.ownerDocument)!=null?a:document};Yi(o,"pointerdown",s=>{if(!t9()||!r)return;const a=s.target,d=(n??[t]).some(p=>{const h=QA(p)?p.current:p;return(h==null?void 0:h.contains(a))||h===a});o().activeElement!==a&&d&&(s.preventDefault(),a.focus())})}function Iw(e,t){return e?e===t||e.contains(t):!1}function n9(e={}){const{onChange:t,onCancel:n,onSubmit:r,onBlur:o,value:s,isDisabled:a,defaultValue:c,startWithEditView:d,isPreviewFocusable:p=!0,submitOnBlur:h=!0,selectAllOnFocus:m=!0,placeholder:v,onEdit:b,finalFocusRef:w,...y}=e,S=rr(b),k=!!(d&&!a),[_,I]=f.useState(k),[P,E]=Ac({defaultValue:c||"",value:s,onChange:t}),[O,R]=f.useState(P),M=f.useRef(null),T=f.useRef(null),A=f.useRef(null),$=f.useRef(null),Q=f.useRef(null);Z3({ref:M,enabled:_,elements:[$,Q]});const B=!_&&!a;Zl(()=>{var se,pe;_&&((se=M.current)==null||se.focus(),m&&((pe=M.current)==null||pe.select()))},[]),Ba(()=>{var se,pe,le,ge;if(!_){w?(se=w.current)==null||se.focus():(pe=A.current)==null||pe.focus();return}(le=M.current)==null||le.focus(),m&&((ge=M.current)==null||ge.select()),S==null||S()},[_,S,m]);const V=f.useCallback(()=>{B&&I(!0)},[B]),q=f.useCallback(()=>{R(P)},[P]),G=f.useCallback(()=>{I(!1),E(O),n==null||n(O),o==null||o(O)},[n,o,E,O]),D=f.useCallback(()=>{I(!1),R(P),r==null||r(P),o==null||o(O)},[P,r,o,O]);f.useEffect(()=>{if(_)return;const se=M.current;(se==null?void 0:se.ownerDocument.activeElement)===se&&(se==null||se.blur())},[_]);const z=f.useCallback(se=>{E(se.currentTarget.value)},[E]),H=f.useCallback(se=>{const pe=se.key,ge={Escape:G,Enter:ke=>{!ke.shiftKey&&!ke.metaKey&&D()}}[pe];ge&&(se.preventDefault(),ge(se))},[G,D]),Y=f.useCallback(se=>{const pe=se.key,ge={Escape:G}[pe];ge&&(se.preventDefault(),ge(se))},[G]),ie=P.length===0,ye=f.useCallback(se=>{var pe;if(!_)return;const le=se.currentTarget.ownerDocument,ge=(pe=se.relatedTarget)!=null?pe:le.activeElement,ke=Iw($.current,ge),xe=Iw(Q.current,ge);!ke&&!xe&&(h?D():G())},[h,D,G,_]),Z=f.useCallback((se={},pe=null)=>{const le=B&&p?0:void 0;return{...se,ref:cn(pe,T),children:ie?v:P,hidden:_,"aria-disabled":ns(a),tabIndex:le,onFocus:et(se.onFocus,V,q)}},[a,_,B,p,ie,V,q,v,P]),oe=f.useCallback((se={},pe=null)=>({...se,hidden:!_,placeholder:v,ref:cn(pe,M),disabled:a,"aria-disabled":ns(a),value:P,onBlur:et(se.onBlur,ye),onChange:et(se.onChange,z),onKeyDown:et(se.onKeyDown,H),onFocus:et(se.onFocus,q)}),[a,_,ye,z,H,q,v,P]),K=f.useCallback((se={},pe=null)=>({...se,hidden:!_,placeholder:v,ref:cn(pe,M),disabled:a,"aria-disabled":ns(a),value:P,onBlur:et(se.onBlur,ye),onChange:et(se.onChange,z),onKeyDown:et(se.onKeyDown,Y),onFocus:et(se.onFocus,q)}),[a,_,ye,z,Y,q,v,P]),U=f.useCallback((se={},pe=null)=>({"aria-label":"Edit",...se,type:"button",onClick:et(se.onClick,V),ref:cn(pe,A),disabled:a}),[V,a]),ae=f.useCallback((se={},pe=null)=>({...se,"aria-label":"Submit",ref:cn(Q,pe),type:"button",onClick:et(se.onClick,D),disabled:a}),[D,a]),re=f.useCallback((se={},pe=null)=>({"aria-label":"Cancel",id:"cancel",...se,ref:cn($,pe),type:"button",onClick:et(se.onClick,G),disabled:a}),[G,a]);return{isEditing:_,isDisabled:a,isValueEmpty:ie,value:P,onEdit:V,onCancel:G,onSubmit:D,getPreviewProps:Z,getInputProps:oe,getTextareaProps:K,getEditButtonProps:U,getSubmitButtonProps:ae,getCancelButtonProps:re,htmlProps:y}}var e5=Te(function(t,n){const r=Br("Editable",t),o=qn(t),{htmlProps:s,...a}=n9(o),{isEditing:c,onSubmit:d,onCancel:p,onEdit:h}=a,m=Ct("chakra-editable",t.className),v=D1(t.children,{isEditing:c,onSubmit:d,onCancel:p,onEdit:h});return i.jsx(YA,{value:a,children:i.jsx(KA,{value:r,children:i.jsx(je.div,{ref:n,...s,className:m,children:v})})})});e5.displayName="Editable";var t5={exports:{}},r9="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",o9=r9,s9=o9;function n5(){}function r5(){}r5.resetWarningCache=n5;var a9=function(){function e(r,o,s,a,c,d){if(d!==s9){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=a9();var i9=t5.exports;const zn=ud(i9);var Ev="data-focus-lock",o5="data-focus-lock-disabled",l9="data-no-focus-lock",c9="data-autofocus-inside",u9="data-no-autofocus";function d9(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function f9(e,t){var n=f.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 f9(t||null,function(n){return e.forEach(function(r){return d9(r,n)})})}var p0={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},Xs=function(){return Xs=Object.assign||function(t){for(var n,r=1,o=arguments.length;r0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]0)&&!(o=r.next()).done;)s.push(o.value)}catch(c){a={error:c}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return s}function Ov(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(P9)},j9=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],ib=j9.join(","),I9="".concat(ib,", [data-focus-guard]"),C5=function(e,t){return la((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?I9:ib)?[r]:[],C5(r))},[])},E9=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?am([e.contentDocument.body],t):[e]},am=function(e,t){return e.reduce(function(n,r){var o,s=C5(r,t),a=(o=[]).concat.apply(o,s.map(function(c){return E9(c,t)}));return n.concat(a,r.parentNode?la(r.parentNode.querySelectorAll(ib)).filter(function(c){return c===r}):[])},[])},O9=function(e){var t=e.querySelectorAll("[".concat(c9,"]"));return la(t).map(function(n){return am([n])}).reduce(function(n,r){return n.concat(r)},[])},lb=function(e,t){return la(e).filter(function(n){return v5(t,n)}).filter(function(n){return C9(n)})},Ow=function(e,t){return t===void 0&&(t=new Map),la(e).filter(function(n){return b5(t,n)})},Mv=function(e,t,n){return S5(lb(am(e,n),t),!0,n)},Rw=function(e,t){return S5(lb(am(e),t),!1)},R9=function(e,t){return lb(O9(e),t)},oc=function(e,t){return e.shadowRoot?oc(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:la(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?oc(o,t):!1}return oc(n,t)})},M9=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(a,c){return!t.has(c)})},k5=function(e){return e.parentNode?k5(e.parentNode):e},cb=function(e){var t=Fp(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(Ev);return n.push.apply(n,o?M9(la(k5(r).querySelectorAll("[".concat(Ev,'="').concat(o,'"]:not([').concat(o5,'="disabled"])')))):[r]),n},[])},D9=function(e){try{return e()}catch{return}},qu=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?qu(t.shadowRoot):t instanceof HTMLIFrameElement&&D9(function(){return t.contentWindow.document})?qu(t.contentWindow.document):t}},T9=function(e,t){return e===t},A9=function(e,t){return!!la(e.querySelectorAll("iframe")).some(function(n){return T9(n,t)})},_5=function(e,t){return t===void 0&&(t=qu(h5(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:cb(e).some(function(n){return oc(n,t)||A9(n,t)})},N9=function(e){e===void 0&&(e=document);var t=qu(e);return t?la(e.querySelectorAll("[".concat(l9,"]"))).some(function(n){return oc(n,t)}):!1},$9=function(e,t){return t.filter(w5).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},ub=function(e,t){return w5(e)&&e.name?$9(e,t):e},z9=function(e){var t=new Set;return e.forEach(function(n){return t.add(ub(n,e))}),e.filter(function(n){return t.has(n)})},Mw=function(e){return e[0]&&e.length>1?ub(e[0],e):e[0]},Dw=function(e,t){return e.length>1?e.indexOf(ub(e[t],e)):t},P5="NEW_FOCUS",L9=function(e,t,n,r){var o=e.length,s=e[0],a=e[o-1],c=ab(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,v=t.indexOf(s),b=t.indexOf(a),w=z9(t),y=n!==void 0?w.indexOf(n):-1,S=y-(r?w.indexOf(r):d),k=Dw(e,0),_=Dw(e,o-1);if(d===-1||h===-1)return P5;if(!m&&h>=0)return h;if(d<=v&&c&&Math.abs(m)>1)return _;if(d>=b&&c&&Math.abs(m)>1)return k;if(m&&Math.abs(S)>1)return h;if(d<=v)return _;if(d>b)return k;if(m)return Math.abs(m)>1?h:(o+h+m)%o}},B9=function(e){return function(t){var n,r=(n=y5(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},F9=function(e,t,n){var r=e.map(function(s){var a=s.node;return a}),o=Ow(r.filter(B9(n)));return o&&o.length?Mw(o):Mw(Ow(t))},Dv=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&Dv(e.parentNode.host||e.parentNode,t),t},h0=function(e,t){for(var n=Dv(e),r=Dv(t),o=0;o=0)return s}return!1},j5=function(e,t,n){var r=Fp(e),o=Fp(t),s=r[0],a=!1;return o.filter(Boolean).forEach(function(c){a=h0(a||c,c)||a,n.filter(Boolean).forEach(function(d){var p=h0(s,d);p&&(!a||oc(p,a)?a=p:a=h0(p,a))})}),a},H9=function(e,t){return e.reduce(function(n,r){return n.concat(R9(r,t))},[])},W9=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(_9)},V9=function(e,t){var n=qu(Fp(e).length>0?document:h5(e).ownerDocument),r=cb(e).filter(Hp),o=j5(n||e,e,r),s=new Map,a=Rw(r,s),c=Mv(r,s).filter(function(b){var w=b.node;return Hp(w)});if(!(!c[0]&&(c=a,!c[0]))){var d=Rw([o],s).map(function(b){var w=b.node;return w}),p=W9(d,c),h=p.map(function(b){var w=b.node;return w}),m=L9(h,d,n,t);if(m===P5){var v=F9(a,h,H9(r,s));if(v)return{node:v};console.warn("focus-lock: cannot find any node to move focus into");return}return m===void 0?m:p[m]}},U9=function(e){var t=cb(e).filter(Hp),n=j5(e,e,t),r=new Map,o=Mv([n],r,!0),s=Mv(t,r).filter(function(a){var c=a.node;return Hp(c)}).map(function(a){var c=a.node;return c});return o.map(function(a){var c=a.node,d=a.index;return{node:c,index:d,lockItem:s.indexOf(c)>=0,guard:ab(c)}})},G9=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},m0=0,g0=!1,I5=function(e,t,n){n===void 0&&(n={});var r=V9(e,t);if(!g0&&r){if(m0>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),g0=!0,setTimeout(function(){g0=!1},1);return}m0++,G9(r.node,n.focusOptions),m0--}};function db(e){setTimeout(e,1)}var q9=function(){return document&&document.activeElement===document.body},K9=function(){return q9()||N9()},sc=null,Kl=null,ac=null,Ku=!1,Y9=function(){return!0},Q9=function(t){return(sc.whiteList||Y9)(t)},X9=function(t,n){ac={observerNode:t,portaledElement:n}},J9=function(t){return ac&&ac.portaledElement===t};function Tw(e,t,n,r){var o=null,s=e;do{var a=r[s];if(a.guard)a.node.dataset.focusAutoGuard&&(o=a);else if(a.lockItem){if(s!==e)return;o=null}else break}while((s+=n)!==t);o&&(o.node.tabIndex=0)}var Z9=function(t){return t&&"current"in t?t.current:t},eN=function(t){return t?!!Ku:Ku==="meanwhile"},tN=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},nN=function(t,n){return n.some(function(r){return tN(t,r,r)})},Wp=function(){var t=!1;if(sc){var n=sc,r=n.observed,o=n.persistentFocus,s=n.autoFocus,a=n.shards,c=n.crossFrame,d=n.focusOptions,p=r||ac&&ac.portaledElement,h=document&&document.activeElement;if(p){var m=[p].concat(a.map(Z9).filter(Boolean));if((!h||Q9(h))&&(o||eN(c)||!K9()||!Kl&&s)&&(p&&!(_5(m)||h&&nN(h,m)||J9(h))&&(document&&!Kl&&h&&!s?(h.blur&&h.blur(),document.body.focus()):(t=I5(m,Kl,{focusOptions:d}),ac={})),Ku=!1,Kl=document&&document.activeElement),document){var v=document&&document.activeElement,b=U9(m),w=b.map(function(y){var S=y.node;return S}).indexOf(v);w>-1&&(b.filter(function(y){var S=y.guard,k=y.node;return S&&k.dataset.focusAutoGuard}).forEach(function(y){var S=y.node;return S.removeAttribute("tabIndex")}),Tw(w,b.length,1,b),Tw(w,-1,-1,b))}}}return t},E5=function(t){Wp()&&t&&(t.stopPropagation(),t.preventDefault())},fb=function(){return db(Wp)},rN=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||X9(r,n)},oN=function(){return null},O5=function(){Ku="just",db(function(){Ku="meanwhile"})},sN=function(){document.addEventListener("focusin",E5),document.addEventListener("focusout",fb),window.addEventListener("blur",O5)},aN=function(){document.removeEventListener("focusin",E5),document.removeEventListener("focusout",fb),window.removeEventListener("blur",O5)};function iN(e){return e.filter(function(t){var n=t.disabled;return!n})}function lN(e){var t=e.slice(-1)[0];t&&!sc&&sN();var n=sc,r=n&&t&&t.id===n.id;sc=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(Kl=null,(!r||n.observed!==t.observed)&&t.onActivation(),Wp(),db(Wp)):(aN(),Kl=null)}d5.assignSyncMedium(rN);f5.assignMedium(fb);h9.assignMedium(function(e){return e({moveFocusInside:I5,focusInside:_5})});const cN=b9(iN,lN)(oN);var R5=f.forwardRef(function(t,n){return f.createElement(p5,or({sideCar:cN,ref:n},t))}),M5=p5.propTypes||{};M5.sideCar;zD(M5,["sideCar"]);R5.propTypes={};const Aw=R5;function D5(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function pb(e){var t;if(!D5(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function uN(e){var t,n;return(n=(t=T5(e))==null?void 0:t.defaultView)!=null?n:window}function T5(e){return D5(e)?e.ownerDocument:document}function dN(e){return T5(e).activeElement}function fN(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 pN(e){return e.localName==="html"?e:e.assignedSlot||e.parentElement||e.ownerDocument.documentElement}function A5(e){return["html","body","#document"].includes(e.localName)?e.ownerDocument.body:pb(e)&&fN(e)?e:A5(pN(e))}var N5=e=>e.hasAttribute("tabindex"),hN=e=>N5(e)&&e.tabIndex===-1;function mN(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function $5(e){return e.parentElement&&$5(e.parentElement)?!0:e.hidden}function gN(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function z5(e){if(!pb(e)||$5(e)||mN(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]():gN(e)?!0:N5(e)}function vN(e){return e?pb(e)&&z5(e)&&!hN(e):!1}var bN=["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]"],yN=bN.join(),xN=e=>e.offsetWidth>0&&e.offsetHeight>0;function L5(e){const t=Array.from(e.querySelectorAll(yN));return t.unshift(e),t.filter(n=>z5(n)&&xN(n))}var Nw,wN=(Nw=Aw.default)!=null?Nw:Aw,B5=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:a,autoFocus:c,persistentFocus:d,lockFocusAcrossFrames:p}=e,h=f.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&L5(r.current).length===0&&requestAnimationFrame(()=>{var w;(w=r.current)==null||w.focus()})},[t,r]),m=f.useCallback(()=>{var b;(b=n==null?void 0:n.current)==null||b.focus()},[n]),v=o&&!n;return i.jsx(wN,{crossFrame:p,persistentFocus:d,autoFocus:c,disabled:a,onActivation:h,onDeactivation:m,returnFocus:v,children:s})};B5.displayName="FocusLock";function SN(e,t,n,r){const o=k_(t);return f.useEffect(()=>{var s;const a=(s=j2(n))!=null?s:document;if(t)return a.addEventListener(e,o,r),()=>{a.removeEventListener(e,o,r)}},[e,n,r,o,t]),()=>{var s;((s=j2(n))!=null?s:document).removeEventListener(e,o,r)}}function CN(e){const{ref:t,handler:n,enabled:r=!0}=e,o=k_(n),a=f.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;f.useEffect(()=>{if(!r)return;const c=m=>{v0(m,t)&&(a.isPointerDown=!0)},d=m=>{if(a.ignoreEmulatedMouseEvents){a.ignoreEmulatedMouseEvents=!1;return}a.isPointerDown&&n&&v0(m,t)&&(a.isPointerDown=!1,o(m))},p=m=>{a.ignoreEmulatedMouseEvents=!0,n&&a.isPointerDown&&v0(m,t)&&(a.isPointerDown=!1,o(m))},h=__(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,a,r])}function v0(e,t){var n;const r=e.target;return r&&!__(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}var[kN,_N]=Rn({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),F5=Te(function(t,n){const r=Br("Input",t),{children:o,className:s,...a}=qn(t),c=Ct("chakra-input__group",s),d={},p=gd(o),h=r.field;p.forEach(v=>{var b,w;r&&(h&&v.type.id==="InputLeftElement"&&(d.paddingStart=(b=h.height)!=null?b:h.h),h&&v.type.id==="InputRightElement"&&(d.paddingEnd=(w=h.height)!=null?w:h.h),v.type.id==="InputRightAddon"&&(d.borderEndRadius=0),v.type.id==="InputLeftAddon"&&(d.borderStartRadius=0))});const m=p.map(v=>{var b,w;const y=Y1({size:((b=v.props)==null?void 0:b.size)||t.size,variant:((w=v.props)==null?void 0:w.variant)||t.variant});return v.type.id!=="Input"?f.cloneElement(v,y):f.cloneElement(v,Object.assign(y,d,v.props))});return i.jsx(je.div,{className:c,ref:n,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...a,children:i.jsx(kN,{value:r,children:m})})});F5.displayName="InputGroup";var PN=je("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),im=Te(function(t,n){var r,o;const{placement:s="left",...a}=t,c=_N(),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 i.jsx(PN,{ref:n,__css:h,...a})});im.id="InputElement";im.displayName="InputElement";var H5=Te(function(t,n){const{className:r,...o}=t,s=Ct("chakra-input__left-element",r);return i.jsx(im,{ref:n,placement:"left",className:s,...o})});H5.id="InputLeftElement";H5.displayName="InputLeftElement";var hb=Te(function(t,n){const{className:r,...o}=t,s=Ct("chakra-input__right-element",r);return i.jsx(im,{ref:n,placement:"right",className:s,...o})});hb.id="InputRightElement";hb.displayName="InputRightElement";var yd=Te(function(t,n){const{htmlSize:r,...o}=t,s=Br("Input",o),a=qn(o),c=Z1(a),d=Ct("chakra-input",t.className);return i.jsx(je.input,{size:r,...c,__css:s.field,ref:n,className:d})});yd.displayName="Input";yd.id="Input";var mb=Te(function(t,n){const r=ia("Link",t),{className:o,isExternal:s,...a}=qn(t);return i.jsx(je.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:Ct("chakra-link",o),...a,__css:r})});mb.displayName="Link";var[jN,W5]=Rn({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),gb=Te(function(t,n){const r=Br("List",t),{children:o,styleType:s="none",stylePosition:a,spacing:c,...d}=qn(t),p=gd(o),m=c?{["& > *:not(style) ~ *:not(style)"]:{mt:c}}:{};return i.jsx(jN,{value:r,children:i.jsx(je.ul,{ref:n,listStyleType:s,listStylePosition:a,role:"list",__css:{...r.container,...m},...d,children:p})})});gb.displayName="List";var IN=Te((e,t)=>{const{as:n,...r}=e;return i.jsx(gb,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});IN.displayName="OrderedList";var vb=Te(function(t,n){const{as:r,...o}=t;return i.jsx(gb,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});vb.displayName="UnorderedList";var wa=Te(function(t,n){const r=W5();return i.jsx(je.li,{ref:n,...t,__css:r.item})});wa.displayName="ListItem";var EN=Te(function(t,n){const r=W5();return i.jsx(no,{ref:n,role:"presentation",...t,__css:r.icon})});EN.displayName="ListIcon";var rl=Te(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:a,column:c,row:d,autoFlow:p,autoRows:h,templateRows:m,autoColumns:v,templateColumns:b,...w}=t,y={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:a,gridAutoColumns:v,gridColumn:c,gridRow:d,gridAutoFlow:p,gridAutoRows:h,gridTemplateRows:m,gridTemplateColumns:b};return i.jsx(je.div,{ref:n,__css:y,...w})});rl.displayName="Grid";function V5(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):pv(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var fl=je("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});fl.displayName="Spacer";var tt=Te(function(t,n){const r=ia("Text",t),{className:o,align:s,decoration:a,casing:c,...d}=qn(t),p=Y1({textAlign:t.align,textDecoration:t.decoration,textTransform:t.casing});return i.jsx(je.p,{ref:n,className:Ct("chakra-text",t.className),...p,...d,__css:r})});tt.displayName="Text";var U5=e=>i.jsx(je.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});U5.displayName="StackItem";function ON(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{"&":V5(n,o=>r[o])}}var bb=Te((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:a="0.5rem",wrap:c,children:d,divider:p,className:h,shouldWrapChildren:m,...v}=e,b=n?"row":r??"column",w=f.useMemo(()=>ON({spacing:a,direction:b}),[a,b]),y=!!p,S=!m&&!y,k=f.useMemo(()=>{const I=gd(d);return S?I:I.map((P,E)=>{const O=typeof P.key<"u"?P.key:E,R=E+1===I.length,T=m?i.jsx(U5,{children:P},O):P;if(!y)return T;const A=f.cloneElement(p,{__css:w}),$=R?null:A;return i.jsxs(f.Fragment,{children:[T,$]},O)})},[p,w,y,S,m,d]),_=Ct("chakra-stack",h);return i.jsx(je.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:b,flexWrap:c,gap:y?void 0:a,className:_,...v,children:k})});bb.displayName="Stack";var G5=Te((e,t)=>i.jsx(bb,{align:"center",...e,direction:"column",ref:t}));G5.displayName="VStack";var di=Te((e,t)=>i.jsx(bb,{align:"center",...e,direction:"row",ref:t}));di.displayName="HStack";function $w(e){return V5(e,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}var Tv=Te(function(t,n){const{area:r,colSpan:o,colStart:s,colEnd:a,rowEnd:c,rowSpan:d,rowStart:p,...h}=t,m=Y1({gridArea:r,gridColumn:$w(o),gridRow:$w(d),gridColumnStart:s,gridColumnEnd:a,gridRowStart:p,gridRowEnd:c});return i.jsx(je.div,{ref:n,__css:m,...h})});Tv.displayName="GridItem";var pl=Te(function(t,n){const r=ia("Badge",t),{className:o,...s}=qn(t);return i.jsx(je.span,{ref:n,className:Ct("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});pl.displayName="Badge";var hl=Te(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:a,borderWidth:c,borderStyle:d,borderColor:p,...h}=ia("Divider",t),{className:m,orientation:v="horizontal",__css:b,...w}=qn(t),y={vertical:{borderLeftWidth:r||a||c||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||c||"1px",width:"100%"}};return i.jsx(je.hr,{ref:n,"aria-orientation":v,...w,__css:{...h,border:"0",borderColor:p,borderStyle:d,...y[v],...b},className:Ct("chakra-divider",m)})});hl.displayName="Divider";function RN(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function MN(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=f.useState([]),s=f.useRef(),a=()=>{s.current&&(clearTimeout(s.current),s.current=null)},c=()=>{a(),s.current=setTimeout(()=>{o([]),s.current=null},t)};f.useEffect(()=>a,[]);function d(p){return h=>{if(h.key==="Backspace"){const m=[...r];m.pop(),o(m);return}if(RN(h)){const m=r.concat(h.key);n(h)&&(h.preventDefault(),h.stopPropagation()),o(m),p(m.join("")),c()}}}return d}function DN(e,t,n,r){if(t==null)return r;if(!r)return e.find(a=>n(a).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 TN(){const e=f.useRef(new Map),t=e.current,n=f.useCallback((o,s,a,c)=>{e.current.set(a,{type:s,el:o,options:c}),o.addEventListener(s,a,c)},[]),r=f.useCallback((o,s,a,c)=>{o.removeEventListener(s,a,c),e.current.delete(a)},[]);return f.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function b0(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function q5(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:a,onMouseUp:c,onClick:d,onKeyDown:p,onKeyUp:h,tabIndex:m,onMouseOver:v,onMouseLeave:b,...w}=e,[y,S]=f.useState(!0),[k,_]=f.useState(!1),I=TN(),P=D=>{D&&D.tagName!=="BUTTON"&&S(!1)},E=y?m:m||0,O=n&&!r,R=f.useCallback(D=>{if(n){D.stopPropagation(),D.preventDefault();return}D.currentTarget.focus(),d==null||d(D)},[n,d]),M=f.useCallback(D=>{k&&b0(D)&&(D.preventDefault(),D.stopPropagation(),_(!1),I.remove(document,"keyup",M,!1))},[k,I]),T=f.useCallback(D=>{if(p==null||p(D),n||D.defaultPrevented||D.metaKey||!b0(D.nativeEvent)||y)return;const z=o&&D.key==="Enter";s&&D.key===" "&&(D.preventDefault(),_(!0)),z&&(D.preventDefault(),D.currentTarget.click()),I.add(document,"keyup",M,!1)},[n,y,p,o,s,I,M]),A=f.useCallback(D=>{if(h==null||h(D),n||D.defaultPrevented||D.metaKey||!b0(D.nativeEvent)||y)return;s&&D.key===" "&&(D.preventDefault(),_(!1),D.currentTarget.click())},[s,y,n,h]),$=f.useCallback(D=>{D.button===0&&(_(!1),I.remove(document,"mouseup",$,!1))},[I]),Q=f.useCallback(D=>{if(D.button!==0)return;if(n){D.stopPropagation(),D.preventDefault();return}y||_(!0),D.currentTarget.focus({preventScroll:!0}),I.add(document,"mouseup",$,!1),a==null||a(D)},[n,y,a,I,$]),B=f.useCallback(D=>{D.button===0&&(y||_(!1),c==null||c(D))},[c,y]),V=f.useCallback(D=>{if(n){D.preventDefault();return}v==null||v(D)},[n,v]),q=f.useCallback(D=>{k&&(D.preventDefault(),_(!1)),b==null||b(D)},[k,b]),G=cn(t,P);return y?{...w,ref:G,type:"button","aria-disabled":O?void 0:n,disabled:O,onClick:R,onMouseDown:a,onMouseUp:c,onKeyUp:h,onKeyDown:p,onMouseOver:v,onMouseLeave:b}:{...w,ref:G,role:"button","data-active":Ft(k),"aria-disabled":n?"true":void 0,tabIndex:O?void 0:E,onClick:R,onMouseDown:Q,onMouseUp:B,onKeyUp:A,onKeyDown:T,onMouseOver:V,onMouseLeave:q}}function AN(e){const t=e.current;if(!t)return!1;const n=dN(t);return!n||t.contains(n)?!1:!!vN(n)}function K5(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;Ba(()=>{if(!s||AN(e))return;const a=(o==null?void 0:o.current)||e.current;let c;if(a)return c=requestAnimationFrame(()=>{a.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(c)}},[s,e,o])}var NN={preventScroll:!0,shouldFocus:!1};function $N(e,t=NN){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,a=zN(e)?e.current:e,c=o&&s,d=f.useRef(c),p=f.useRef(s);Zl(()=>{!p.current&&s&&(d.current=c),p.current=s},[s,c]);const h=f.useCallback(()=>{if(!(!s||!a||!d.current)&&(d.current=!1,!a.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var m;(m=n.current)==null||m.focus({preventScroll:r})});else{const m=L5(a);m.length>0&&requestAnimationFrame(()=>{m[0].focus({preventScroll:r})})}},[s,r,a,n]);Ba(()=>{h()},[h]),Yi(a,"transitionend",h)}function zN(e){return"current"in e}var Tl=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),_r={arrowShadowColor:Tl("--popper-arrow-shadow-color"),arrowSize:Tl("--popper-arrow-size","8px"),arrowSizeHalf:Tl("--popper-arrow-size-half"),arrowBg:Tl("--popper-arrow-bg"),transformOrigin:Tl("--popper-transform-origin"),arrowOffset:Tl("--popper-arrow-offset")};function LN(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 BN={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"},FN=e=>BN[e],zw={scroll:!0,resize:!0};function HN(e){let t;return typeof e=="object"?t={enabled:!0,options:{...zw,...e}}:t={enabled:e,options:zw},t}var WN={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`}},VN={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{Lw(e)},effect:({state:e})=>()=>{Lw(e)}},Lw=e=>{e.elements.popper.style.setProperty(_r.transformOrigin.var,FN(e.placement))},UN={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{GN(e)}},GN=e=>{var t;if(!e.placement)return;const n=qN(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:_r.arrowSize.varRef,height:_r.arrowSize.varRef,zIndex:-1});const r={[_r.arrowSizeHalf.var]:`calc(${_r.arrowSize.varRef} / 2 - 1px)`,[_r.arrowOffset.var]:`calc(${_r.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},qN=e=>{if(e.startsWith("top"))return{property:"bottom",value:_r.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:_r.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:_r.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:_r.arrowOffset.varRef}},KN={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{Bw(e)},effect:({state:e})=>()=>{Bw(e)}},Bw=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=LN(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:_r.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},YN={"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"}},QN={"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 XN(e,t="ltr"){var n,r;const o=((n=YN[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=QN[e])!=null?r:o}var ko="top",as="bottom",is="right",_o="left",yb="auto",xd=[ko,as,is,_o],vc="start",Yu="end",JN="clippingParents",Y5="viewport",fu="popper",ZN="reference",Fw=xd.reduce(function(e,t){return e.concat([t+"-"+vc,t+"-"+Yu])},[]),Q5=[].concat(xd,[yb]).reduce(function(e,t){return e.concat([t,t+"-"+vc,t+"-"+Yu])},[]),e$="beforeRead",t$="read",n$="afterRead",r$="beforeMain",o$="main",s$="afterMain",a$="beforeWrite",i$="write",l$="afterWrite",c$=[e$,t$,n$,r$,o$,s$,a$,i$,l$];function ra(e){return e?(e.nodeName||"").toLowerCase():null}function Lo(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function ol(e){var t=Lo(e).Element;return e instanceof t||e instanceof Element}function rs(e){var t=Lo(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function xb(e){if(typeof ShadowRoot>"u")return!1;var t=Lo(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function u$(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];!rs(s)||!ra(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(a){var c=o[a];c===!1?s.removeAttribute(a):s.setAttribute(a,c===!0?"":c)}))})}function d$(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]||{},a=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),c=a.reduce(function(d,p){return d[p]="",d},{});!rs(o)||!ra(o)||(Object.assign(o.style,c),Object.keys(s).forEach(function(d){o.removeAttribute(d)}))})}}const f$={name:"applyStyles",enabled:!0,phase:"write",fn:u$,effect:d$,requires:["computeStyles"]};function ta(e){return e.split("-")[0]}var Qi=Math.max,Vp=Math.min,bc=Math.round;function Av(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function X5(){return!/^((?!chrome|android).)*safari/i.test(Av())}function yc(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&rs(e)&&(o=e.offsetWidth>0&&bc(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&bc(r.height)/e.offsetHeight||1);var a=ol(e)?Lo(e):window,c=a.visualViewport,d=!X5()&&n,p=(r.left+(d&&c?c.offsetLeft:0))/o,h=(r.top+(d&&c?c.offsetTop:0))/s,m=r.width/o,v=r.height/s;return{width:m,height:v,top:h,right:p+m,bottom:h+v,left:p,x:p,y:h}}function wb(e){var t=yc(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 J5(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&xb(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Oa(e){return Lo(e).getComputedStyle(e)}function p$(e){return["table","td","th"].indexOf(ra(e))>=0}function Pi(e){return((ol(e)?e.ownerDocument:e.document)||window.document).documentElement}function lm(e){return ra(e)==="html"?e:e.assignedSlot||e.parentNode||(xb(e)?e.host:null)||Pi(e)}function Hw(e){return!rs(e)||Oa(e).position==="fixed"?null:e.offsetParent}function h$(e){var t=/firefox/i.test(Av()),n=/Trident/i.test(Av());if(n&&rs(e)){var r=Oa(e);if(r.position==="fixed")return null}var o=lm(e);for(xb(o)&&(o=o.host);rs(o)&&["html","body"].indexOf(ra(o))<0;){var s=Oa(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 wd(e){for(var t=Lo(e),n=Hw(e);n&&p$(n)&&Oa(n).position==="static";)n=Hw(n);return n&&(ra(n)==="html"||ra(n)==="body"&&Oa(n).position==="static")?t:n||h$(e)||t}function Sb(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Au(e,t,n){return Qi(e,Vp(t,n))}function m$(e,t,n){var r=Au(e,t,n);return r>n?n:r}function Z5(){return{top:0,right:0,bottom:0,left:0}}function eP(e){return Object.assign({},Z5(),e)}function tP(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var g$=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,eP(typeof t!="number"?t:tP(t,xd))};function v$(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,a=n.modifiersData.popperOffsets,c=ta(n.placement),d=Sb(c),p=[_o,is].indexOf(c)>=0,h=p?"height":"width";if(!(!s||!a)){var m=g$(o.padding,n),v=wb(s),b=d==="y"?ko:_o,w=d==="y"?as:is,y=n.rects.reference[h]+n.rects.reference[d]-a[d]-n.rects.popper[h],S=a[d]-n.rects.reference[d],k=wd(s),_=k?d==="y"?k.clientHeight||0:k.clientWidth||0:0,I=y/2-S/2,P=m[b],E=_-v[h]-m[w],O=_/2-v[h]/2+I,R=Au(P,O,E),M=d;n.modifiersData[r]=(t={},t[M]=R,t.centerOffset=R-O,t)}}function b$(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)||J5(t.elements.popper,o)&&(t.elements.arrow=o))}const y$={name:"arrow",enabled:!0,phase:"main",fn:v$,effect:b$,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function xc(e){return e.split("-")[1]}var x$={top:"auto",right:"auto",bottom:"auto",left:"auto"};function w$(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:bc(n*o)/o||0,y:bc(r*o)/o||0}}function Ww(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,a=e.offsets,c=e.position,d=e.gpuAcceleration,p=e.adaptive,h=e.roundOffsets,m=e.isFixed,v=a.x,b=v===void 0?0:v,w=a.y,y=w===void 0?0:w,S=typeof h=="function"?h({x:b,y}):{x:b,y};b=S.x,y=S.y;var k=a.hasOwnProperty("x"),_=a.hasOwnProperty("y"),I=_o,P=ko,E=window;if(p){var O=wd(n),R="clientHeight",M="clientWidth";if(O===Lo(n)&&(O=Pi(n),Oa(O).position!=="static"&&c==="absolute"&&(R="scrollHeight",M="scrollWidth")),O=O,o===ko||(o===_o||o===is)&&s===Yu){P=as;var T=m&&O===E&&E.visualViewport?E.visualViewport.height:O[R];y-=T-r.height,y*=d?1:-1}if(o===_o||(o===ko||o===as)&&s===Yu){I=is;var A=m&&O===E&&E.visualViewport?E.visualViewport.width:O[M];b-=A-r.width,b*=d?1:-1}}var $=Object.assign({position:c},p&&x$),Q=h===!0?w$({x:b,y},Lo(n)):{x:b,y};if(b=Q.x,y=Q.y,d){var B;return Object.assign({},$,(B={},B[P]=_?"0":"",B[I]=k?"0":"",B.transform=(E.devicePixelRatio||1)<=1?"translate("+b+"px, "+y+"px)":"translate3d("+b+"px, "+y+"px, 0)",B))}return Object.assign({},$,(t={},t[P]=_?y+"px":"",t[I]=k?b+"px":"",t.transform="",t))}function S$(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,a=s===void 0?!0:s,c=n.roundOffsets,d=c===void 0?!0:c,p={placement:ta(t.placement),variation:xc(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,Ww(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:d})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Ww(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 C$={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:S$,data:{}};var Mf={passive:!0};function k$(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,a=r.resize,c=a===void 0?!0:a,d=Lo(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(h){h.addEventListener("scroll",n.update,Mf)}),c&&d.addEventListener("resize",n.update,Mf),function(){s&&p.forEach(function(h){h.removeEventListener("scroll",n.update,Mf)}),c&&d.removeEventListener("resize",n.update,Mf)}}const _$={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:k$,data:{}};var P$={left:"right",right:"left",bottom:"top",top:"bottom"};function yp(e){return e.replace(/left|right|bottom|top/g,function(t){return P$[t]})}var j$={start:"end",end:"start"};function Vw(e){return e.replace(/start|end/g,function(t){return j$[t]})}function Cb(e){var t=Lo(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function kb(e){return yc(Pi(e)).left+Cb(e).scrollLeft}function I$(e,t){var n=Lo(e),r=Pi(e),o=n.visualViewport,s=r.clientWidth,a=r.clientHeight,c=0,d=0;if(o){s=o.width,a=o.height;var p=X5();(p||!p&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}return{width:s,height:a,x:c+kb(e),y:d}}function E$(e){var t,n=Pi(e),r=Cb(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=Qi(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=Qi(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),c=-r.scrollLeft+kb(e),d=-r.scrollTop;return Oa(o||n).direction==="rtl"&&(c+=Qi(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:a,x:c,y:d}}function _b(e){var t=Oa(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function nP(e){return["html","body","#document"].indexOf(ra(e))>=0?e.ownerDocument.body:rs(e)&&_b(e)?e:nP(lm(e))}function Nu(e,t){var n;t===void 0&&(t=[]);var r=nP(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Lo(r),a=o?[s].concat(s.visualViewport||[],_b(r)?r:[]):r,c=t.concat(a);return o?c:c.concat(Nu(lm(a)))}function Nv(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function O$(e,t){var n=yc(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 Uw(e,t,n){return t===Y5?Nv(I$(e,n)):ol(t)?O$(t,n):Nv(E$(Pi(e)))}function R$(e){var t=Nu(lm(e)),n=["absolute","fixed"].indexOf(Oa(e).position)>=0,r=n&&rs(e)?wd(e):e;return ol(r)?t.filter(function(o){return ol(o)&&J5(o,r)&&ra(o)!=="body"}):[]}function M$(e,t,n,r){var o=t==="clippingParents"?R$(e):[].concat(t),s=[].concat(o,[n]),a=s[0],c=s.reduce(function(d,p){var h=Uw(e,p,r);return d.top=Qi(h.top,d.top),d.right=Vp(h.right,d.right),d.bottom=Vp(h.bottom,d.bottom),d.left=Qi(h.left,d.left),d},Uw(e,a,r));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}function rP(e){var t=e.reference,n=e.element,r=e.placement,o=r?ta(r):null,s=r?xc(r):null,a=t.x+t.width/2-n.width/2,c=t.y+t.height/2-n.height/2,d;switch(o){case ko:d={x:a,y:t.y-n.height};break;case as:d={x:a,y:t.y+t.height};break;case is:d={x:t.x+t.width,y:c};break;case _o:d={x:t.x-n.width,y:c};break;default:d={x:t.x,y:t.y}}var p=o?Sb(o):null;if(p!=null){var h=p==="y"?"height":"width";switch(s){case vc:d[p]=d[p]-(t[h]/2-n[h]/2);break;case Yu:d[p]=d[p]+(t[h]/2-n[h]/2);break}}return d}function Qu(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,a=s===void 0?e.strategy:s,c=n.boundary,d=c===void 0?JN:c,p=n.rootBoundary,h=p===void 0?Y5:p,m=n.elementContext,v=m===void 0?fu:m,b=n.altBoundary,w=b===void 0?!1:b,y=n.padding,S=y===void 0?0:y,k=eP(typeof S!="number"?S:tP(S,xd)),_=v===fu?ZN:fu,I=e.rects.popper,P=e.elements[w?_:v],E=M$(ol(P)?P:P.contextElement||Pi(e.elements.popper),d,h,a),O=yc(e.elements.reference),R=rP({reference:O,element:I,strategy:"absolute",placement:o}),M=Nv(Object.assign({},I,R)),T=v===fu?M:O,A={top:E.top-T.top+k.top,bottom:T.bottom-E.bottom+k.bottom,left:E.left-T.left+k.left,right:T.right-E.right+k.right},$=e.modifiersData.offset;if(v===fu&&$){var Q=$[o];Object.keys(A).forEach(function(B){var V=[is,as].indexOf(B)>=0?1:-1,q=[ko,as].indexOf(B)>=0?"y":"x";A[B]+=Q[q]*V})}return A}function D$(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,a=n.padding,c=n.flipVariations,d=n.allowedAutoPlacements,p=d===void 0?Q5:d,h=xc(r),m=h?c?Fw:Fw.filter(function(w){return xc(w)===h}):xd,v=m.filter(function(w){return p.indexOf(w)>=0});v.length===0&&(v=m);var b=v.reduce(function(w,y){return w[y]=Qu(e,{placement:y,boundary:o,rootBoundary:s,padding:a})[ta(y)],w},{});return Object.keys(b).sort(function(w,y){return b[w]-b[y]})}function T$(e){if(ta(e)===yb)return[];var t=yp(e);return[Vw(e),t,Vw(t)]}function A$(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,a=n.altAxis,c=a===void 0?!0:a,d=n.fallbackPlacements,p=n.padding,h=n.boundary,m=n.rootBoundary,v=n.altBoundary,b=n.flipVariations,w=b===void 0?!0:b,y=n.allowedAutoPlacements,S=t.options.placement,k=ta(S),_=k===S,I=d||(_||!w?[yp(S)]:T$(S)),P=[S].concat(I).reduce(function(oe,K){return oe.concat(ta(K)===yb?D$(t,{placement:K,boundary:h,rootBoundary:m,padding:p,flipVariations:w,allowedAutoPlacements:y}):K)},[]),E=t.rects.reference,O=t.rects.popper,R=new Map,M=!0,T=P[0],A=0;A=0,q=V?"width":"height",G=Qu(t,{placement:$,boundary:h,rootBoundary:m,altBoundary:v,padding:p}),D=V?B?is:_o:B?as:ko;E[q]>O[q]&&(D=yp(D));var z=yp(D),H=[];if(s&&H.push(G[Q]<=0),c&&H.push(G[D]<=0,G[z]<=0),H.every(function(oe){return oe})){T=$,M=!1;break}R.set($,H)}if(M)for(var Y=w?3:1,ie=function(K){var U=P.find(function(ae){var re=R.get(ae);if(re)return re.slice(0,K).every(function(se){return se})});if(U)return T=U,"break"},ye=Y;ye>0;ye--){var Z=ie(ye);if(Z==="break")break}t.placement!==T&&(t.modifiersData[r]._skip=!0,t.placement=T,t.reset=!0)}}const N$={name:"flip",enabled:!0,phase:"main",fn:A$,requiresIfExists:["offset"],data:{_skip:!1}};function Gw(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 qw(e){return[ko,is,as,_o].some(function(t){return e[t]>=0})}function $$(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,a=Qu(t,{elementContext:"reference"}),c=Qu(t,{altBoundary:!0}),d=Gw(a,r),p=Gw(c,o,s),h=qw(d),m=qw(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 z$={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:$$};function L$(e,t,n){var r=ta(e),o=[_o,ko].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,a=s[0],c=s[1];return a=a||0,c=(c||0)*o,[_o,is].indexOf(r)>=0?{x:c,y:a}:{x:a,y:c}}function B$(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,a=Q5.reduce(function(h,m){return h[m]=L$(m,t.rects,s),h},{}),c=a[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]=a}const F$={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:B$};function H$(e){var t=e.state,n=e.name;t.modifiersData[n]=rP({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const W$={name:"popperOffsets",enabled:!0,phase:"read",fn:H$,data:{}};function V$(e){return e==="x"?"y":"x"}function U$(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,a=n.altAxis,c=a===void 0?!1:a,d=n.boundary,p=n.rootBoundary,h=n.altBoundary,m=n.padding,v=n.tether,b=v===void 0?!0:v,w=n.tetherOffset,y=w===void 0?0:w,S=Qu(t,{boundary:d,rootBoundary:p,padding:m,altBoundary:h}),k=ta(t.placement),_=xc(t.placement),I=!_,P=Sb(k),E=V$(P),O=t.modifiersData.popperOffsets,R=t.rects.reference,M=t.rects.popper,T=typeof y=="function"?y(Object.assign({},t.rects,{placement:t.placement})):y,A=typeof T=="number"?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),$=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,Q={x:0,y:0};if(O){if(s){var B,V=P==="y"?ko:_o,q=P==="y"?as:is,G=P==="y"?"height":"width",D=O[P],z=D+S[V],H=D-S[q],Y=b?-M[G]/2:0,ie=_===vc?R[G]:M[G],ye=_===vc?-M[G]:-R[G],Z=t.elements.arrow,oe=b&&Z?wb(Z):{width:0,height:0},K=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Z5(),U=K[V],ae=K[q],re=Au(0,R[G],oe[G]),se=I?R[G]/2-Y-re-U-A.mainAxis:ie-re-U-A.mainAxis,pe=I?-R[G]/2+Y+re+ae+A.mainAxis:ye+re+ae+A.mainAxis,le=t.elements.arrow&&wd(t.elements.arrow),ge=le?P==="y"?le.clientTop||0:le.clientLeft||0:0,ke=(B=$==null?void 0:$[P])!=null?B:0,xe=D+se-ke-ge,de=D+pe-ke,Ae=Au(b?Vp(z,xe):z,D,b?Qi(H,de):H);O[P]=Ae,Q[P]=Ae-D}if(c){var Ee,$e=P==="x"?ko:_o,kt=P==="x"?as:is,ct=O[E],on=E==="y"?"height":"width",vt=ct+S[$e],bt=ct-S[kt],Se=[ko,_o].indexOf(k)!==-1,Me=(Ee=$==null?void 0:$[E])!=null?Ee:0,Pt=Se?vt:ct-R[on]-M[on]-Me+A.altAxis,At=Se?ct+R[on]+M[on]-Me-A.altAxis:bt,we=b&&Se?m$(Pt,ct,At):Au(b?Pt:vt,ct,b?At:bt);O[E]=we,Q[E]=we-ct}t.modifiersData[r]=Q}}const G$={name:"preventOverflow",enabled:!0,phase:"main",fn:U$,requiresIfExists:["offset"]};function q$(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function K$(e){return e===Lo(e)||!rs(e)?Cb(e):q$(e)}function Y$(e){var t=e.getBoundingClientRect(),n=bc(t.width)/e.offsetWidth||1,r=bc(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Q$(e,t,n){n===void 0&&(n=!1);var r=rs(t),o=rs(t)&&Y$(t),s=Pi(t),a=yc(e,o,n),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(r||!r&&!n)&&((ra(t)!=="body"||_b(s))&&(c=K$(t)),rs(t)?(d=yc(t,!0),d.x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=kb(s))),{x:a.left+c.scrollLeft-d.x,y:a.top+c.scrollTop-d.y,width:a.width,height:a.height}}function X$(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 a=[].concat(s.requires||[],s.requiresIfExists||[]);a.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 J$(e){var t=X$(e);return c$.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function Z$(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function ez(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 Kw={placement:"bottom",modifiers:[],strategy:"absolute"};function Yw(){for(var e=arguments.length,t=new Array(e),n=0;n{}),I=f.useCallback(()=>{var A;!t||!w.current||!y.current||((A=_.current)==null||A.call(_),S.current=rz(w.current,y.current,{placement:k,modifiers:[KN,UN,VN,{...WN,enabled:!!v},{name:"eventListeners",...HN(a)},{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}),S.current.forceUpdate(),_.current=S.current.destroy)},[k,t,n,v,a,s,c,d,p,m,h,o]);f.useEffect(()=>()=>{var A;!w.current&&!y.current&&((A=S.current)==null||A.destroy(),S.current=null)},[]);const P=f.useCallback(A=>{w.current=A,I()},[I]),E=f.useCallback((A={},$=null)=>({...A,ref:cn(P,$)}),[P]),O=f.useCallback(A=>{y.current=A,I()},[I]),R=f.useCallback((A={},$=null)=>({...A,ref:cn(O,$),style:{...A.style,position:o,minWidth:v?void 0:"max-content",inset:"0 auto auto 0"}}),[o,O,v]),M=f.useCallback((A={},$=null)=>{const{size:Q,shadowColor:B,bg:V,style:q,...G}=A;return{...G,ref:$,"data-popper-arrow":"",style:oz(A)}},[]),T=f.useCallback((A={},$=null)=>({...A,ref:$,"data-popper-arrow-inner":""}),[]);return{update(){var A;(A=S.current)==null||A.update()},forceUpdate(){var A;(A=S.current)==null||A.forceUpdate()},transformOrigin:_r.transformOrigin.varRef,referenceRef:P,popperRef:O,getPopperProps:R,getArrowProps:M,getArrowInnerProps:T,getReferenceProps:E}}function oz(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 jb(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=rr(n),a=rr(t),[c,d]=f.useState(e.defaultIsOpen||!1),p=r!==void 0?r:c,h=r!==void 0,m=f.useId(),v=o??`disclosure-${m}`,b=f.useCallback(()=>{h||d(!1),a==null||a()},[h,a]),w=f.useCallback(()=>{h||d(!0),s==null||s()},[h,s]),y=f.useCallback(()=>{p?b():w()},[p,w,b]);function S(_={}){return{..._,"aria-expanded":p,"aria-controls":v,onClick(I){var P;(P=_.onClick)==null||P.call(_,I),y()}}}function k(_={}){return{..._,hidden:!p,id:v}}return{isOpen:p,onOpen:w,onClose:b,onToggle:y,isControlled:h,getButtonProps:S,getDisclosureProps:k}}function sz(e){const{ref:t,handler:n,enabled:r=!0}=e,o=rr(n),a=f.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;f.useEffect(()=>{if(!r)return;const c=m=>{y0(m,t)&&(a.isPointerDown=!0)},d=m=>{if(a.ignoreEmulatedMouseEvents){a.ignoreEmulatedMouseEvents=!1;return}a.isPointerDown&&n&&y0(m,t)&&(a.isPointerDown=!1,o(m))},p=m=>{a.ignoreEmulatedMouseEvents=!0,n&&a.isPointerDown&&y0(m,t)&&(a.isPointerDown=!1,o(m))},h=oP(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,a,r])}function y0(e,t){var n;const r=e.target;return r&&!oP(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function oP(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function sP(e){const{isOpen:t,ref:n}=e,[r,o]=f.useState(t),[s,a]=f.useState(!1);return f.useEffect(()=>{s||(o(t),a(!0))},[t,s,r]),Yi(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var d;const p=uN(n.current),h=new p.CustomEvent("animationend",{bubbles:!0});(d=n.current)==null||d.dispatchEvent(h)}}}function Ib(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[az,iz,lz,cz]=Q1(),[uz,Sd]=Rn({strict:!1,name:"MenuContext"});function dz(e,...t){const n=f.useId(),r=e||n;return f.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function aP(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Qw(e){return aP(e).activeElement===e}function fz(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:a,isOpen:c,defaultIsOpen:d,onClose:p,onOpen:h,placement:m="bottom-start",lazyBehavior:v="unmount",direction:b,computePositionOnMount:w=!1,...y}=e,S=f.useRef(null),k=f.useRef(null),_=lz(),I=f.useCallback(()=>{requestAnimationFrame(()=>{var Z;(Z=S.current)==null||Z.focus({preventScroll:!1})})},[]),P=f.useCallback(()=>{const Z=setTimeout(()=>{var oe;if(o)(oe=o.current)==null||oe.focus();else{const K=_.firstEnabled();K&&B(K.index)}});z.current.add(Z)},[_,o]),E=f.useCallback(()=>{const Z=setTimeout(()=>{const oe=_.lastEnabled();oe&&B(oe.index)});z.current.add(Z)},[_]),O=f.useCallback(()=>{h==null||h(),s?P():I()},[s,P,I,h]),{isOpen:R,onOpen:M,onClose:T,onToggle:A}=jb({isOpen:c,defaultIsOpen:d,onClose:p,onOpen:O});sz({enabled:R&&r,ref:S,handler:Z=>{var oe;(oe=k.current)!=null&&oe.contains(Z.target)||T()}});const $=Pb({...y,enabled:R||w,placement:m,direction:b}),[Q,B]=f.useState(-1);Ba(()=>{R||B(-1)},[R]),K5(S,{focusRef:k,visible:R,shouldFocus:!0});const V=sP({isOpen:R,ref:S}),[q,G]=dz(t,"menu-button","menu-list"),D=f.useCallback(()=>{M(),I()},[M,I]),z=f.useRef(new Set([]));xz(()=>{z.current.forEach(Z=>clearTimeout(Z)),z.current.clear()});const H=f.useCallback(()=>{M(),P()},[P,M]),Y=f.useCallback(()=>{M(),E()},[M,E]),ie=f.useCallback(()=>{var Z,oe;const K=aP(S.current),U=(Z=S.current)==null?void 0:Z.contains(K.activeElement);if(!(R&&!U))return;const re=(oe=_.item(Q))==null?void 0:oe.node;re==null||re.focus()},[R,Q,_]),ye=f.useRef(null);return{openAndFocusMenu:D,openAndFocusFirstItem:H,openAndFocusLastItem:Y,onTransitionEnd:ie,unstable__animationState:V,descendants:_,popper:$,buttonId:q,menuId:G,forceUpdate:$.forceUpdate,orientation:"vertical",isOpen:R,onToggle:A,onOpen:M,onClose:T,menuRef:S,buttonRef:k,focusedIndex:Q,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:B,isLazy:a,lazyBehavior:v,initialFocusRef:o,rafId:ye}}function pz(e={},t=null){const n=Sd(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:a}=n,c=f.useCallback(d=>{const p=d.key,m={Enter:s,ArrowDown:s,ArrowUp:a}[p];m&&(d.preventDefault(),d.stopPropagation(),m(d))},[s,a]);return{...e,ref:cn(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":Ft(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:et(e.onClick,r),onKeyDown:et(e.onKeyDown,c)}}function $v(e){var t;return bz(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function hz(e={},t=null){const n=Sd();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:a,onClose:c,menuId:d,isLazy:p,lazyBehavior:h,unstable__animationState:m}=n,v=iz(),b=MN({preventDefault:k=>k.key!==" "&&$v(k.target)}),w=f.useCallback(k=>{if(!k.currentTarget.contains(k.target))return;const _=k.key,P={Tab:O=>O.preventDefault(),Escape:c,ArrowDown:()=>{const O=v.nextEnabled(r);O&&o(O.index)},ArrowUp:()=>{const O=v.prevEnabled(r);O&&o(O.index)}}[_];if(P){k.preventDefault(),P(k);return}const E=b(O=>{const R=DN(v.values(),O,M=>{var T,A;return(A=(T=M==null?void 0:M.node)==null?void 0:T.textContent)!=null?A:""},v.item(r));if(R){const M=v.indexOf(R.node);o(M)}});$v(k.target)&&E(k)},[v,r,b,c,o]),y=f.useRef(!1);a&&(y.current=!0);const S=Ib({wasSelected:y.current,enabled:p,mode:h,isSelected:m.present});return{...e,ref:cn(s,t),children:S?e.children:null,tabIndex:-1,role:"menu",id:d,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:et(e.onKeyDown,w)}}function mz(e={}){const{popper:t,isOpen:n}=Sd();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function iP(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:a,isDisabled:c,isFocusable:d,closeOnSelect:p,type:h,...m}=e,v=Sd(),{setFocusedIndex:b,focusedIndex:w,closeOnSelect:y,onClose:S,menuRef:k,isOpen:_,menuId:I,rafId:P}=v,E=f.useRef(null),O=`${I}-menuitem-${f.useId()}`,{index:R,register:M}=cz({disabled:c&&!d}),T=f.useCallback(D=>{n==null||n(D),!c&&b(R)},[b,R,c,n]),A=f.useCallback(D=>{r==null||r(D),E.current&&!Qw(E.current)&&T(D)},[T,r]),$=f.useCallback(D=>{o==null||o(D),!c&&b(-1)},[b,c,o]),Q=f.useCallback(D=>{s==null||s(D),$v(D.currentTarget)&&(p??y)&&S()},[S,s,y,p]),B=f.useCallback(D=>{a==null||a(D),b(R)},[b,a,R]),V=R===w,q=c&&!d;Ba(()=>{_&&(V&&!q&&E.current?(P.current&&cancelAnimationFrame(P.current),P.current=requestAnimationFrame(()=>{var D;(D=E.current)==null||D.focus(),P.current=null})):k.current&&!Qw(k.current)&&k.current.focus({preventScroll:!0}))},[V,q,k,_]);const G=q5({onClick:Q,onFocus:B,onMouseEnter:T,onMouseMove:A,onMouseLeave:$,ref:cn(M,E,t),isDisabled:c,isFocusable:d});return{...m,...G,type:h??G.type,id:O,role:"menuitem",tabIndex:V?0:-1}}function gz(e={},t=null){const{type:n="radio",isChecked:r,...o}=e;return{...iP(o,t),role:`menuitem${n}`,"aria-checked":r}}function vz(e={}){const{children:t,type:n="radio",value:r,defaultValue:o,onChange:s,...a}=e,d=n==="radio"?"":[],[p,h]=Ac({defaultValue:o??d,value:r,onChange:s}),m=f.useCallback(w=>{if(n==="radio"&&typeof p=="string"&&h(w),n==="checkbox"&&Array.isArray(p)){const y=p.includes(w)?p.filter(S=>S!==w):p.concat(w);h(y)}},[p,h,n]),b=gd(t).map(w=>{if(w.type.id!=="MenuItemOption")return w;const y=k=>{var _,I;m(w.props.value),(I=(_=w.props).onClick)==null||I.call(_,k)},S=n==="radio"?w.props.value===p:p.includes(w.props.value);return f.cloneElement(w,{type:n,onClick:y,isChecked:S})});return{...a,children:b}}function bz(e){var t;if(!yz(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function yz(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function xz(e,t=[]){return f.useEffect(()=>()=>e(),t)}var[wz,zc]=Rn({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Cd=e=>{const{children:t}=e,n=Br("Menu",e),r=qn(e),{direction:o}=Mc(),{descendants:s,...a}=fz({...r,direction:o}),c=f.useMemo(()=>a,[a]),{isOpen:d,onClose:p,forceUpdate:h}=c;return i.jsx(az,{value:s,children:i.jsx(uz,{value:c,children:i.jsx(wz,{value:n,children:D1(t,{isOpen:d,onClose:p,forceUpdate:h})})})})};Cd.displayName="Menu";var lP=Te((e,t)=>{const n=zc();return i.jsx(je.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});lP.displayName="MenuCommand";var cP=Te((e,t)=>{const{type:n,...r}=e,o=zc(),s=r.as||n?n??void 0:"button",a=f.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 i.jsx(je.button,{ref:t,type:s,...r,__css:a})}),Eb=e=>{const{className:t,children:n,...r}=e,o=zc(),s=f.Children.only(n),a=f.isValidElement(s)?f.cloneElement(s,{focusable:"false","aria-hidden":!0,className:Ct("chakra-menu__icon",s.props.className)}):null,c=Ct("chakra-menu__icon-wrapper",t);return i.jsx(je.span,{className:c,...r,__css:o.icon,children:a})};Eb.displayName="MenuIcon";var kr=Te((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:a,...c}=e,d=iP(c,t),h=n||o?i.jsx("span",{style:{pointerEvents:"none",flex:1},children:a}):a;return i.jsxs(cP,{...d,className:Ct("chakra-menu__menuitem",d.className),children:[n&&i.jsx(Eb,{fontSize:"0.8em",marginEnd:r,children:n}),h,o&&i.jsx(lP,{marginStart:s,children:o})]})});kr.displayName="MenuItem";var Sz={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"}}},Cz=je(Yr.div),Lc=Te(function(t,n){var r,o;const{rootProps:s,motionProps:a,...c}=t,{isOpen:d,onTransitionEnd:p,unstable__animationState:h}=Sd(),m=hz(c,n),v=mz(s),b=zc();return i.jsx(je.div,{...v,__css:{zIndex:(o=t.zIndex)!=null?o:(r=b.list)==null?void 0:r.zIndex},children:i.jsx(Cz,{variants:Sz,initial:!1,animate:d?"enter":"exit",__css:{outline:0,...b.list},...a,className:Ct("chakra-menu__menu-list",m.className),...m,onUpdate:p,onAnimationComplete:Jh(h.onComplete,m.onAnimationComplete)})})});Lc.displayName="MenuList";var Xu=Te((e,t)=>{const{title:n,children:r,className:o,...s}=e,a=Ct("chakra-menu__group__title",o),c=zc();return i.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[n&&i.jsx(je.p,{className:a,...s,__css:c.groupTitle,children:n}),r]})});Xu.displayName="MenuGroup";var uP=e=>{const{className:t,title:n,...r}=e,o=vz(r);return i.jsx(Xu,{title:n,className:Ct("chakra-menu__option-group",t),...o})};uP.displayName="MenuOptionGroup";var kz=Te((e,t)=>{const n=zc();return i.jsx(je.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),kd=Te((e,t)=>{const{children:n,as:r,...o}=e,s=pz(o,t),a=r||kz;return i.jsx(a,{...s,className:Ct("chakra-menu__menu-button",e.className),children:i.jsx(je.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});kd.displayName="MenuButton";var _z=e=>i.jsx("svg",{viewBox:"0 0 14 14",width:"1em",height:"1em",...e,children:i.jsx("polygon",{fill:"currentColor",points:"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039"})}),Up=Te((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",...o}=e,s=gz(o,t);return i.jsxs(cP,{...s,className:Ct("chakra-menu__menuitem-option",o.className),children:[n!==null&&i.jsx(Eb,{fontSize:"0.8em",marginEnd:r,opacity:e.isChecked?1:0,children:n||i.jsx(_z,{})}),i.jsx("span",{style:{flex:1},children:s.children})]})});Up.id="MenuItemOption";Up.displayName="MenuItemOption";var Pz={slideInBottom:{...Cv,custom:{offsetY:16,reverse:!0}},slideInRight:{...Cv,custom:{offsetX:16,reverse:!0}},scale:{...N3,custom:{initialScale:.95,reverse:!0}},none:{}},jz=je(Yr.section),Iz=e=>Pz[e||"none"],dP=f.forwardRef((e,t)=>{const{preset:n,motionProps:r=Iz(n),...o}=e;return i.jsx(jz,{ref:t,...r,...o})});dP.displayName="ModalTransition";var Ez=Object.defineProperty,Oz=(e,t,n)=>t in e?Ez(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rz=(e,t,n)=>(Oz(e,typeof t!="symbol"?t+"":t,n),n),Mz=class{constructor(){Rz(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}},zv=new Mz;function fP(e,t){const[n,r]=f.useState(0);return f.useEffect(()=>{const o=e.current;if(o){if(t){const s=zv.add(o);r(s)}return()=>{zv.remove(o),r(0)}}},[t,e]),n}var Dz=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Al=new WeakMap,Df=new WeakMap,Tf={},x0=0,pP=function(e){return e&&(e.host||pP(e.parentNode))},Tz=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=pP(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})},Az=function(e,t,n,r){var o=Tz(t,Array.isArray(e)?e:[e]);Tf[n]||(Tf[n]=new WeakMap);var s=Tf[n],a=[],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(v){if(c.has(v))h(v);else{var b=v.getAttribute(r),w=b!==null&&b!=="false",y=(Al.get(v)||0)+1,S=(s.get(v)||0)+1;Al.set(v,y),s.set(v,S),a.push(v),y===1&&w&&Df.set(v,!0),S===1&&v.setAttribute(n,"true"),w||v.setAttribute(r,"true")}})};return h(t),c.clear(),x0++,function(){a.forEach(function(m){var v=Al.get(m)-1,b=s.get(m)-1;Al.set(m,v),s.set(m,b),v||(Df.has(m)||m.removeAttribute(r),Df.delete(m)),b||m.removeAttribute(n)}),x0--,x0||(Al=new WeakMap,Al=new WeakMap,Df=new WeakMap,Tf={})}},Nz=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||Dz(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),Az(r,o,n,"aria-hidden")):function(){return null}};function $z(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:a=!0,onOverlayClick:c,onEsc:d}=e,p=f.useRef(null),h=f.useRef(null),[m,v,b]=Lz(r,"chakra-modal","chakra-modal--header","chakra-modal--body");zz(p,t&&a);const w=fP(p,t),y=f.useRef(null),S=f.useCallback(T=>{y.current=T.target},[]),k=f.useCallback(T=>{T.key==="Escape"&&(T.stopPropagation(),s&&(n==null||n()),d==null||d())},[s,n,d]),[_,I]=f.useState(!1),[P,E]=f.useState(!1),O=f.useCallback((T={},A=null)=>({role:"dialog",...T,ref:cn(A,p),id:m,tabIndex:-1,"aria-modal":!0,"aria-labelledby":_?v:void 0,"aria-describedby":P?b:void 0,onClick:et(T.onClick,$=>$.stopPropagation())}),[b,P,m,v,_]),R=f.useCallback(T=>{T.stopPropagation(),y.current===T.target&&zv.isTopModal(p.current)&&(o&&(n==null||n()),c==null||c())},[n,o,c]),M=f.useCallback((T={},A=null)=>({...T,ref:cn(A,h),onClick:et(T.onClick,R),onKeyDown:et(T.onKeyDown,k),onMouseDown:et(T.onMouseDown,S)}),[k,S,R]);return{isOpen:t,onClose:n,headerId:v,bodyId:b,setBodyMounted:E,setHeaderMounted:I,dialogRef:p,overlayRef:h,getDialogProps:O,getDialogContainerProps:M,index:w}}function zz(e,t){const n=e.current;f.useEffect(()=>{if(!(!e.current||!t))return Nz(e.current)},[t,e,n])}function Lz(e,...t){const n=f.useId(),r=e||n;return f.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[Bz,Bc]=Rn({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Fz,sl]=Rn({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),Ju=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:a,finalFocusRef:c,returnFocusOnClose:d,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:m,motionPreset:v,lockFocusAcrossFrames:b,onCloseComplete:w}=t,y=Br("Modal",t),k={...$z(t),autoFocus:o,trapFocus:s,initialFocusRef:a,finalFocusRef:c,returnFocusOnClose:d,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:m,motionPreset:v,lockFocusAcrossFrames:b};return i.jsx(Fz,{value:k,children:i.jsx(Bz,{value:y,children:i.jsx(Fo,{onExitComplete:w,children:k.isOpen&&i.jsx(Uu,{...n,children:r})})})})};Ju.displayName="Modal";var xp="right-scroll-bar-position",wp="width-before-scroll-bar",Hz="with-scroll-bars-hidden",Wz="--removed-body-scroll-bar-size",hP=c5(),w0=function(){},cm=f.forwardRef(function(e,t){var n=f.useRef(null),r=f.useState({onScrollCapture:w0,onWheelCapture:w0,onTouchMoveCapture:w0}),o=r[0],s=r[1],a=e.forwardProps,c=e.children,d=e.className,p=e.removeScrollBar,h=e.enabled,m=e.shards,v=e.sideCar,b=e.noIsolation,w=e.inert,y=e.allowPinchZoom,S=e.as,k=S===void 0?"div":S,_=e.gapMode,I=a5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=v,E=s5([n,t]),O=Xs(Xs({},I),o);return f.createElement(f.Fragment,null,h&&f.createElement(P,{sideCar:hP,removeScrollBar:p,shards:m,noIsolation:b,inert:w,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:_}),a?f.cloneElement(f.Children.only(c),Xs(Xs({},O),{ref:E})):f.createElement(k,Xs({},O,{className:d,ref:E}),c))});cm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};cm.classNames={fullWidth:wp,zeroRight:xp};var Xw,Vz=function(){if(Xw)return Xw;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Uz(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Vz();return t&&e.setAttribute("nonce",t),e}function Gz(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function qz(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Kz=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Uz())&&(Gz(t,n),qz(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Yz=function(){var e=Kz();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},mP=function(){var e=Yz(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Qz={left:0,top:0,right:0,gap:0},S0=function(e){return parseInt(e||"",10)||0},Xz=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[S0(n),S0(r),S0(o)]},Jz=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Qz;var t=Xz(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])}},Zz=mP(),eL=function(e,t,n,r){var o=e.left,s=e.top,a=e.right,c=e.gap;return n===void 0&&(n="margin"),` + .`.concat(Hz,` { + 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(a,`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(xp,` { + right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(wp,` { + margin-right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(xp," .").concat(xp,` { + right: 0 `).concat(r,`; + } + + .`).concat(wp," .").concat(wp,` { + margin-right: 0 `).concat(r,`; + } + + body { + `).concat(Wz,": ").concat(c,`px; + } +`)},tL=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=f.useMemo(function(){return Jz(o)},[o]);return f.createElement(Zz,{styles:eL(s,!t,o,n?"":"!important")})},Lv=!1;if(typeof window<"u")try{var Af=Object.defineProperty({},"passive",{get:function(){return Lv=!0,!0}});window.addEventListener("test",Af,Af),window.removeEventListener("test",Af,Af)}catch{Lv=!1}var Nl=Lv?{passive:!1}:!1,nL=function(e){return e.tagName==="TEXTAREA"},gP=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!nL(e)&&n[t]==="visible")},rL=function(e){return gP(e,"overflowY")},oL=function(e){return gP(e,"overflowX")},Jw=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=vP(e,r);if(o){var s=bP(e,r),a=s[1],c=s[2];if(a>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},sL=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},aL=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},vP=function(e,t){return e==="v"?rL(t):oL(t)},bP=function(e,t){return e==="v"?sL(t):aL(t)},iL=function(e,t){return e==="h"&&t==="rtl"?-1:1},lL=function(e,t,n,r,o){var s=iL(e,window.getComputedStyle(t).direction),a=s*r,c=n.target,d=t.contains(c),p=!1,h=a>0,m=0,v=0;do{var b=bP(e,c),w=b[0],y=b[1],S=b[2],k=y-S-s*w;(w||k)&&vP(e,c)&&(m+=k,v+=w),c=c.parentNode}while(!d&&c!==document.body||d&&(t.contains(c)||t===c));return(h&&(o&&m===0||!o&&a>m)||!h&&(o&&v===0||!o&&-a>v))&&(p=!0),p},Nf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Zw=function(e){return[e.deltaX,e.deltaY]},eS=function(e){return e&&"current"in e?e.current:e},cL=function(e,t){return e[0]===t[0]&&e[1]===t[1]},uL=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},dL=0,$l=[];function fL(e){var t=f.useRef([]),n=f.useRef([0,0]),r=f.useRef(),o=f.useState(dL++)[0],s=f.useState(mP)[0],a=f.useRef(e);f.useEffect(function(){a.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var y=Ov([e.lockRef.current],(e.shards||[]).map(eS),!0).filter(Boolean);return y.forEach(function(S){return S.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),y.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=f.useCallback(function(y,S){if("touches"in y&&y.touches.length===2)return!a.current.allowPinchZoom;var k=Nf(y),_=n.current,I="deltaX"in y?y.deltaX:_[0]-k[0],P="deltaY"in y?y.deltaY:_[1]-k[1],E,O=y.target,R=Math.abs(I)>Math.abs(P)?"h":"v";if("touches"in y&&R==="h"&&O.type==="range")return!1;var M=Jw(R,O);if(!M)return!0;if(M?E=R:(E=R==="v"?"h":"v",M=Jw(R,O)),!M)return!1;if(!r.current&&"changedTouches"in y&&(I||P)&&(r.current=E),!E)return!0;var T=r.current||E;return lL(T,S,y,T==="h"?I:P,!0)},[]),d=f.useCallback(function(y){var S=y;if(!(!$l.length||$l[$l.length-1]!==s)){var k="deltaY"in S?Zw(S):Nf(S),_=t.current.filter(function(E){return E.name===S.type&&E.target===S.target&&cL(E.delta,k)})[0];if(_&&_.should){S.cancelable&&S.preventDefault();return}if(!_){var I=(a.current.shards||[]).map(eS).filter(Boolean).filter(function(E){return E.contains(S.target)}),P=I.length>0?c(S,I[0]):!a.current.noIsolation;P&&S.cancelable&&S.preventDefault()}}},[]),p=f.useCallback(function(y,S,k,_){var I={name:y,delta:S,target:k,should:_};t.current.push(I),setTimeout(function(){t.current=t.current.filter(function(P){return P!==I})},1)},[]),h=f.useCallback(function(y){n.current=Nf(y),r.current=void 0},[]),m=f.useCallback(function(y){p(y.type,Zw(y),y.target,c(y,e.lockRef.current))},[]),v=f.useCallback(function(y){p(y.type,Nf(y),y.target,c(y,e.lockRef.current))},[]);f.useEffect(function(){return $l.push(s),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:v}),document.addEventListener("wheel",d,Nl),document.addEventListener("touchmove",d,Nl),document.addEventListener("touchstart",h,Nl),function(){$l=$l.filter(function(y){return y!==s}),document.removeEventListener("wheel",d,Nl),document.removeEventListener("touchmove",d,Nl),document.removeEventListener("touchstart",h,Nl)}},[]);var b=e.removeScrollBar,w=e.inert;return f.createElement(f.Fragment,null,w?f.createElement(s,{styles:uL(o)}):null,b?f.createElement(tL,{gapMode:e.gapMode}):null)}const pL=p9(hP,fL);var yP=f.forwardRef(function(e,t){return f.createElement(cm,Xs({},e,{ref:t,sideCar:pL}))});yP.classNames=cm.classNames;const hL=yP;function mL(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:a,finalFocusRef:c,returnFocusOnClose:d,preserveScrollBarGap:p,lockFocusAcrossFrames:h,isOpen:m}=sl(),[v,b]=SR();f.useEffect(()=>{!v&&b&&setTimeout(b)},[v,b]);const w=fP(r,m);return i.jsx(B5,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:c,restoreFocus:d,contentRef:r,lockFocusAcrossFrames:h,children:i.jsx(hL,{removeScrollBar:!p,allowPinchZoom:a,enabled:w===1&&s,forwardProps:!0,children:e.children})})}var Zu=Te((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...a}=e,{getDialogProps:c,getDialogContainerProps:d}=sl(),p=c(a,t),h=d(o),m=Ct("chakra-modal__content",n),v=Bc(),b={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...v.dialog},w={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...v.dialogContainer},{motionPreset:y}=sl();return i.jsx(mL,{children:i.jsx(je.div,{...h,className:"chakra-modal__content-container",tabIndex:-1,__css:w,children:i.jsx(dP,{preset:y,motionProps:s,className:m,...p,__css:b,children:r})})})});Zu.displayName="ModalContent";function _d(e){const{leastDestructiveRef:t,...n}=e;return i.jsx(Ju,{...n,initialFocusRef:t})}var Pd=Te((e,t)=>i.jsx(Zu,{ref:t,role:"alertdialog",...e})),Ra=Te((e,t)=>{const{className:n,...r}=e,o=Ct("chakra-modal__footer",n),a={display:"flex",alignItems:"center",justifyContent:"flex-end",...Bc().footer};return i.jsx(je.footer,{ref:t,...r,__css:a,className:o})});Ra.displayName="ModalFooter";var Ma=Te((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=sl();f.useEffect(()=>(s(!0),()=>s(!1)),[s]);const a=Ct("chakra-modal__header",n),d={flex:0,...Bc().header};return i.jsx(je.header,{ref:t,className:a,id:o,...r,__css:d})});Ma.displayName="ModalHeader";var gL=je(Yr.div),Da=Te((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,a=Ct("chakra-modal__overlay",n),d={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...Bc().overlay},{motionPreset:p}=sl(),m=o||(p==="none"?{}:A3);return i.jsx(gL,{...m,__css:d,ref:t,className:a,...s})});Da.displayName="ModalOverlay";var Ta=Te((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=sl();f.useEffect(()=>(s(!0),()=>s(!1)),[s]);const a=Ct("chakra-modal__body",n),c=Bc();return i.jsx(je.div,{ref:t,className:a,id:o,...r,__css:c.body})});Ta.displayName="ModalBody";var Ob=Te((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=sl(),a=Ct("chakra-modal__close-btn",r),c=Bc();return i.jsx(AD,{ref:t,__css:c.closeButton,className:a,onClick:et(n,d=>{d.stopPropagation(),s()}),...o})});Ob.displayName="ModalCloseButton";var vL=e=>i.jsx(no,{viewBox:"0 0 24 24",...e,children:i.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"})}),bL=e=>i.jsx(no,{viewBox:"0 0 24 24",...e,children:i.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 tS(e,t,n,r){f.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,a=Array.isArray(t)?t:[t],c=new s.MutationObserver(d=>{for(const p of d)p.type==="attributes"&&p.attributeName&&a.includes(p.attributeName)&&n(p)});return c.observe(e.current,{attributes:!0,attributeFilter:a}),()=>c.disconnect()})}function yL(e,t){const n=rr(e);f.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var xL=50,nS=300;function wL(e,t){const[n,r]=f.useState(!1),[o,s]=f.useState(null),[a,c]=f.useState(!0),d=f.useRef(null),p=()=>clearTimeout(d.current);yL(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?xL:null);const h=f.useCallback(()=>{a&&e(),d.current=setTimeout(()=>{c(!1),r(!0),s("increment")},nS)},[e,a]),m=f.useCallback(()=>{a&&t(),d.current=setTimeout(()=>{c(!1),r(!0),s("decrement")},nS)},[t,a]),v=f.useCallback(()=>{c(!0),r(!1),p()},[]);return f.useEffect(()=>()=>p(),[]),{up:h,down:m,stop:v,isSpinning:n}}var SL=/^[Ee0-9+\-.]$/;function CL(e){return SL.test(e)}function kL(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 _L(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:o=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:a=1,isReadOnly:c,isDisabled:d,isRequired:p,isInvalid:h,pattern:m="[0-9]*(.[0-9]+)?",inputMode:v="decimal",allowMouseWheel:b,id:w,onChange:y,precision:S,name:k,"aria-describedby":_,"aria-label":I,"aria-labelledby":P,onFocus:E,onBlur:O,onInvalid:R,getAriaValueText:M,isValidCharacter:T,format:A,parse:$,...Q}=e,B=rr(E),V=rr(O),q=rr(R),G=rr(T??CL),D=rr(M),z=qA(e),{update:H,increment:Y,decrement:ie}=z,[ye,Z]=f.useState(!1),oe=!(c||d),K=f.useRef(null),U=f.useRef(null),ae=f.useRef(null),re=f.useRef(null),se=f.useCallback(we=>we.split("").filter(G).join(""),[G]),pe=f.useCallback(we=>{var ht;return(ht=$==null?void 0:$(we))!=null?ht:we},[$]),le=f.useCallback(we=>{var ht;return((ht=A==null?void 0:A(we))!=null?ht:we).toString()},[A]);Ba(()=>{(z.valueAsNumber>s||z.valueAsNumber{if(!K.current)return;if(K.current.value!=z.value){const ht=pe(K.current.value);z.setValue(se(ht))}},[pe,se]);const ge=f.useCallback((we=a)=>{oe&&Y(we)},[Y,oe,a]),ke=f.useCallback((we=a)=>{oe&&ie(we)},[ie,oe,a]),xe=wL(ge,ke);tS(ae,"disabled",xe.stop,xe.isSpinning),tS(re,"disabled",xe.stop,xe.isSpinning);const de=f.useCallback(we=>{if(we.nativeEvent.isComposing)return;const $t=pe(we.currentTarget.value);H(se($t)),U.current={start:we.currentTarget.selectionStart,end:we.currentTarget.selectionEnd}},[H,se,pe]),Ae=f.useCallback(we=>{var ht,$t,zt;B==null||B(we),U.current&&(we.target.selectionStart=($t=U.current.start)!=null?$t:(ht=we.currentTarget.value)==null?void 0:ht.length,we.currentTarget.selectionEnd=(zt=U.current.end)!=null?zt:we.currentTarget.selectionStart)},[B]),Ee=f.useCallback(we=>{if(we.nativeEvent.isComposing)return;kL(we,G)||we.preventDefault();const ht=$e(we)*a,$t=we.key,ze={ArrowUp:()=>ge(ht),ArrowDown:()=>ke(ht),Home:()=>H(o),End:()=>H(s)}[$t];ze&&(we.preventDefault(),ze(we))},[G,a,ge,ke,H,o,s]),$e=we=>{let ht=1;return(we.metaKey||we.ctrlKey)&&(ht=.1),we.shiftKey&&(ht=10),ht},kt=f.useMemo(()=>{const we=D==null?void 0:D(z.value);if(we!=null)return we;const ht=z.value.toString();return ht||void 0},[z.value,D]),ct=f.useCallback(()=>{let we=z.value;if(z.value==="")return;/^[eE]/.test(z.value.toString())?z.setValue(""):(z.valueAsNumbers&&(we=s),z.cast(we))},[z,s,o]),on=f.useCallback(()=>{Z(!1),n&&ct()},[n,Z,ct]),vt=f.useCallback(()=>{t&&requestAnimationFrame(()=>{var we;(we=K.current)==null||we.focus()})},[t]),bt=f.useCallback(we=>{we.preventDefault(),xe.up(),vt()},[vt,xe]),Se=f.useCallback(we=>{we.preventDefault(),xe.down(),vt()},[vt,xe]);Yi(()=>K.current,"wheel",we=>{var ht,$t;const ze=(($t=(ht=K.current)==null?void 0:ht.ownerDocument)!=null?$t:document).activeElement===K.current;if(!b||!ze)return;we.preventDefault();const qe=$e(we)*a,Pn=Math.sign(we.deltaY);Pn===-1?ge(qe):Pn===1&&ke(qe)},{passive:!1});const Me=f.useCallback((we={},ht=null)=>{const $t=d||r&&z.isAtMax;return{...we,ref:cn(ht,ae),role:"button",tabIndex:-1,onPointerDown:et(we.onPointerDown,zt=>{zt.button!==0||$t||bt(zt)}),onPointerLeave:et(we.onPointerLeave,xe.stop),onPointerUp:et(we.onPointerUp,xe.stop),disabled:$t,"aria-disabled":ns($t)}},[z.isAtMax,r,bt,xe.stop,d]),Pt=f.useCallback((we={},ht=null)=>{const $t=d||r&&z.isAtMin;return{...we,ref:cn(ht,re),role:"button",tabIndex:-1,onPointerDown:et(we.onPointerDown,zt=>{zt.button!==0||$t||Se(zt)}),onPointerLeave:et(we.onPointerLeave,xe.stop),onPointerUp:et(we.onPointerUp,xe.stop),disabled:$t,"aria-disabled":ns($t)}},[z.isAtMin,r,Se,xe.stop,d]),At=f.useCallback((we={},ht=null)=>{var $t,zt,ze,qe;return{name:k,inputMode:v,type:"text",pattern:m,"aria-labelledby":P,"aria-label":I,"aria-describedby":_,id:w,disabled:d,...we,readOnly:($t=we.readOnly)!=null?$t:c,"aria-readonly":(zt=we.readOnly)!=null?zt:c,"aria-required":(ze=we.required)!=null?ze:p,required:(qe=we.required)!=null?qe:p,ref:cn(K,ht),value:le(z.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(z.valueAsNumber)?void 0:z.valueAsNumber,"aria-invalid":ns(h??z.isOutOfRange),"aria-valuetext":kt,autoComplete:"off",autoCorrect:"off",onChange:et(we.onChange,de),onKeyDown:et(we.onKeyDown,Ee),onFocus:et(we.onFocus,Ae,()=>Z(!0)),onBlur:et(we.onBlur,V,on)}},[k,v,m,P,I,le,_,w,d,p,c,h,z.value,z.valueAsNumber,z.isOutOfRange,o,s,kt,de,Ee,Ae,V,on]);return{value:le(z.value),valueAsNumber:z.valueAsNumber,isFocused:ye,isDisabled:d,isReadOnly:c,getIncrementButtonProps:Me,getDecrementButtonProps:Pt,getInputProps:At,htmlProps:Q}}var[PL,um]=Rn({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[jL,Rb]=Rn({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),dm=Te(function(t,n){const r=Br("NumberInput",t),o=qn(t),s=eb(o),{htmlProps:a,...c}=_L(s),d=f.useMemo(()=>c,[c]);return i.jsx(jL,{value:d,children:i.jsx(PL,{value:r,children:i.jsx(je.div,{...a,ref:n,className:Ct("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});dm.displayName="NumberInput";var fm=Te(function(t,n){const r=um();return i.jsx(je.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}})});fm.displayName="NumberInputStepper";var pm=Te(function(t,n){const{getInputProps:r}=Rb(),o=r(t,n),s=um();return i.jsx(je.input,{...o,className:Ct("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});pm.displayName="NumberInputField";var xP=je("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),hm=Te(function(t,n){var r;const o=um(),{getDecrementButtonProps:s}=Rb(),a=s(t,n);return i.jsx(xP,{...a,__css:o.stepper,children:(r=t.children)!=null?r:i.jsx(vL,{})})});hm.displayName="NumberDecrementStepper";var mm=Te(function(t,n){var r;const{getIncrementButtonProps:o}=Rb(),s=o(t,n),a=um();return i.jsx(xP,{...s,__css:a.stepper,children:(r=t.children)!=null?r:i.jsx(bL,{})})});mm.displayName="NumberIncrementStepper";var[IL,jd]=Rn({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[EL,Mb]=Rn({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Db(e){const t=f.Children.only(e.children),{getTriggerProps:n}=jd();return f.cloneElement(t,n(t.props,t.ref))}Db.displayName="PopoverTrigger";var zl={click:"click",hover:"hover"};function OL(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:a=!0,arrowSize:c,arrowShadowColor:d,trigger:p=zl.click,openDelay:h=200,closeDelay:m=200,isLazy:v,lazyBehavior:b="unmount",computePositionOnMount:w,...y}=e,{isOpen:S,onClose:k,onOpen:_,onToggle:I}=jb(e),P=f.useRef(null),E=f.useRef(null),O=f.useRef(null),R=f.useRef(!1),M=f.useRef(!1);S&&(M.current=!0);const[T,A]=f.useState(!1),[$,Q]=f.useState(!1),B=f.useId(),V=o??B,[q,G,D,z]=["popover-trigger","popover-content","popover-header","popover-body"].map(de=>`${de}-${V}`),{referenceRef:H,getArrowProps:Y,getPopperProps:ie,getArrowInnerProps:ye,forceUpdate:Z}=Pb({...y,enabled:S||!!w}),oe=sP({isOpen:S,ref:O});Z3({enabled:S,ref:E}),K5(O,{focusRef:E,visible:S,shouldFocus:s&&p===zl.click}),$N(O,{focusRef:r,visible:S,shouldFocus:a&&p===zl.click});const K=Ib({wasSelected:M.current,enabled:v,mode:b,isSelected:oe.present}),U=f.useCallback((de={},Ae=null)=>{const Ee={...de,style:{...de.style,transformOrigin:_r.transformOrigin.varRef,[_r.arrowSize.var]:c?`${c}px`:void 0,[_r.arrowShadowColor.var]:d},ref:cn(O,Ae),children:K?de.children:null,id:G,tabIndex:-1,role:"dialog",onKeyDown:et(de.onKeyDown,$e=>{n&&$e.key==="Escape"&&k()}),onBlur:et(de.onBlur,$e=>{const kt=rS($e),ct=C0(O.current,kt),on=C0(E.current,kt);S&&t&&(!ct&&!on)&&k()}),"aria-labelledby":T?D:void 0,"aria-describedby":$?z:void 0};return p===zl.hover&&(Ee.role="tooltip",Ee.onMouseEnter=et(de.onMouseEnter,()=>{R.current=!0}),Ee.onMouseLeave=et(de.onMouseLeave,$e=>{$e.nativeEvent.relatedTarget!==null&&(R.current=!1,setTimeout(()=>k(),m))})),Ee},[K,G,T,D,$,z,p,n,k,S,t,m,d,c]),ae=f.useCallback((de={},Ae=null)=>ie({...de,style:{visibility:S?"visible":"hidden",...de.style}},Ae),[S,ie]),re=f.useCallback((de,Ae=null)=>({...de,ref:cn(Ae,P,H)}),[P,H]),se=f.useRef(),pe=f.useRef(),le=f.useCallback(de=>{P.current==null&&H(de)},[H]),ge=f.useCallback((de={},Ae=null)=>{const Ee={...de,ref:cn(E,Ae,le),id:q,"aria-haspopup":"dialog","aria-expanded":S,"aria-controls":G};return p===zl.click&&(Ee.onClick=et(de.onClick,I)),p===zl.hover&&(Ee.onFocus=et(de.onFocus,()=>{se.current===void 0&&_()}),Ee.onBlur=et(de.onBlur,$e=>{const kt=rS($e),ct=!C0(O.current,kt);S&&t&&ct&&k()}),Ee.onKeyDown=et(de.onKeyDown,$e=>{$e.key==="Escape"&&k()}),Ee.onMouseEnter=et(de.onMouseEnter,()=>{R.current=!0,se.current=window.setTimeout(()=>_(),h)}),Ee.onMouseLeave=et(de.onMouseLeave,()=>{R.current=!1,se.current&&(clearTimeout(se.current),se.current=void 0),pe.current=window.setTimeout(()=>{R.current===!1&&k()},m)})),Ee},[q,S,G,p,le,I,_,t,k,h,m]);f.useEffect(()=>()=>{se.current&&clearTimeout(se.current),pe.current&&clearTimeout(pe.current)},[]);const ke=f.useCallback((de={},Ae=null)=>({...de,id:D,ref:cn(Ae,Ee=>{A(!!Ee)})}),[D]),xe=f.useCallback((de={},Ae=null)=>({...de,id:z,ref:cn(Ae,Ee=>{Q(!!Ee)})}),[z]);return{forceUpdate:Z,isOpen:S,onAnimationComplete:oe.onComplete,onClose:k,getAnchorProps:re,getArrowProps:Y,getArrowInnerProps:ye,getPopoverPositionerProps:ae,getPopoverProps:U,getTriggerProps:ge,getHeaderProps:ke,getBodyProps:xe}}function C0(e,t){return e===t||(e==null?void 0:e.contains(t))}function rS(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Tb(e){const t=Br("Popover",e),{children:n,...r}=qn(e),o=Mc(),s=OL({...r,direction:o.direction});return i.jsx(IL,{value:s,children:i.jsx(EL,{value:t,children:D1(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Tb.displayName="Popover";var k0=(e,t)=>t?`${e}.${t}, ${t}`:void 0;function wP(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:a,shadowColor:c}=e,{getArrowProps:d,getArrowInnerProps:p}=jd(),h=Mb(),m=(t=n??r)!=null?t:o,v=s??a;return i.jsx(je.div,{...d(),className:"chakra-popover__arrow-positioner",children:i.jsx(je.div,{className:Ct("chakra-popover__arrow",e.className),...p(e),__css:{"--popper-arrow-shadow-color":k0("colors",c),"--popper-arrow-bg":k0("colors",m),"--popper-arrow-shadow":k0("shadows",v),...h.arrow}})})}wP.displayName="PopoverArrow";var SP=Te(function(t,n){const{getBodyProps:r}=jd(),o=Mb();return i.jsx(je.div,{...r(t,n),className:Ct("chakra-popover__body",t.className),__css:o.body})});SP.displayName="PopoverBody";function RL(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var ML={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]}}},DL=je(Yr.section),CP=Te(function(t,n){const{variants:r=ML,...o}=t,{isOpen:s}=jd();return i.jsx(DL,{ref:n,variants:RL(r),initial:!1,animate:s?"enter":"exit",...o})});CP.displayName="PopoverTransition";var Ab=Te(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:a,getPopoverPositionerProps:c,onAnimationComplete:d}=jd(),p=Mb(),h={position:"relative",display:"flex",flexDirection:"column",...p.content};return i.jsx(je.div,{...c(r),__css:p.popper,className:"chakra-popover__popper",children:i.jsx(CP,{...o,...a(s,n),onAnimationComplete:Jh(d,s.onAnimationComplete),className:Ct("chakra-popover__content",t.className),__css:h})})});Ab.displayName="PopoverContent";function TL(e,t,n){return(e-t)*100/(n-t)}za({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});za({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var AL=za({"0%":{left:"-40%"},"100%":{left:"100%"}}),NL=za({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function $L(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:a,role:c="progressbar"}=e,d=TL(t,n,r);return{bind:{"data-indeterminate":a?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":a?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,d):o})(),role:c},percent:d,value:t}}var[zL,LL]=Rn({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),BL=Te((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:a,...c}=e,d=$L({value:o,min:n,max:r,isIndeterminate:s,role:a}),h={height:"100%",...LL().filledTrack};return i.jsx(je.div,{ref:t,style:{width:`${d.percent}%`,...c.style},...d.bind,...c,__css:h})}),kP=Te((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:a,isAnimated:c,children:d,borderRadius:p,isIndeterminate:h,"aria-label":m,"aria-labelledby":v,"aria-valuetext":b,title:w,role:y,...S}=qn(e),k=Br("Progress",e),_=p??((n=k.track)==null?void 0:n.borderRadius),I={animation:`${NL} 1s linear infinite`},O={...!h&&a&&c&&I,...h&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${AL} 1s ease infinite normal none running`}},R={overflow:"hidden",position:"relative",...k.track};return i.jsx(je.div,{ref:t,borderRadius:_,__css:R,...S,children:i.jsxs(zL,{value:k,children:[i.jsx(BL,{"aria-label":m,"aria-labelledby":v,"aria-valuetext":b,min:o,max:s,value:r,isIndeterminate:h,css:O,borderRadius:_,title:w,role:y}),d]})})});kP.displayName="Progress";function FL(e){return e&&pv(e)&&pv(e.target)}function HL(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:a,isNative:c,...d}=e,[p,h]=f.useState(r||""),m=typeof n<"u",v=m?n:p,b=f.useRef(null),w=f.useCallback(()=>{const E=b.current;if(!E)return;let O="input:not(:disabled):checked";const R=E.querySelector(O);if(R){R.focus();return}O="input:not(:disabled)";const M=E.querySelector(O);M==null||M.focus()},[]),S=`radio-${f.useId()}`,k=o||S,_=f.useCallback(E=>{const O=FL(E)?E.target.value:E;m||h(O),t==null||t(String(O))},[t,m]),I=f.useCallback((E={},O=null)=>({...E,ref:cn(O,b),role:"radiogroup"}),[]),P=f.useCallback((E={},O=null)=>({...E,ref:O,name:k,[c?"checked":"isChecked"]:v!=null?E.value===v:void 0,onChange(M){_(M)},"data-radiogroup":!0}),[c,k,_,v]);return{getRootProps:I,getRadioProps:P,name:k,ref:b,focus:w,setValue:h,value:v,onChange:_,isDisabled:s,isFocusable:a,htmlProps:d}}var[WL,_P]=Rn({name:"RadioGroupContext",strict:!1}),Gp=Te((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:a,isDisabled:c,isFocusable:d,...p}=e,{value:h,onChange:m,getRootProps:v,name:b,htmlProps:w}=HL(p),y=f.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 i.jsx(WL,{value:y,children:i.jsx(je.div,{...v(w,t),className:Ct("chakra-radio-group",a),children:s})})});Gp.displayName="RadioGroup";var VL={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function UL(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:a,onChange:c,isInvalid:d,name:p,value:h,id:m,"data-radiogroup":v,"aria-describedby":b,...w}=e,y=`radio-${f.useId()}`,S=vd(),_=!!_P()||!!v;let P=!!S&&!_?S.id:y;P=m??P;const E=o??(S==null?void 0:S.isDisabled),O=s??(S==null?void 0:S.isReadOnly),R=a??(S==null?void 0:S.isRequired),M=d??(S==null?void 0:S.isInvalid),[T,A]=f.useState(!1),[$,Q]=f.useState(!1),[B,V]=f.useState(!1),[q,G]=f.useState(!1),[D,z]=f.useState(!!t),H=typeof n<"u",Y=H?n:D;f.useEffect(()=>H3(A),[]);const ie=f.useCallback(le=>{if(O||E){le.preventDefault();return}H||z(le.target.checked),c==null||c(le)},[H,E,O,c]),ye=f.useCallback(le=>{le.key===" "&&G(!0)},[G]),Z=f.useCallback(le=>{le.key===" "&&G(!1)},[G]),oe=f.useCallback((le={},ge=null)=>({...le,ref:ge,"data-active":Ft(q),"data-hover":Ft(B),"data-disabled":Ft(E),"data-invalid":Ft(M),"data-checked":Ft(Y),"data-focus":Ft($),"data-focus-visible":Ft($&&T),"data-readonly":Ft(O),"aria-hidden":!0,onMouseDown:et(le.onMouseDown,()=>G(!0)),onMouseUp:et(le.onMouseUp,()=>G(!1)),onMouseEnter:et(le.onMouseEnter,()=>V(!0)),onMouseLeave:et(le.onMouseLeave,()=>V(!1))}),[q,B,E,M,Y,$,O,T]),{onFocus:K,onBlur:U}=S??{},ae=f.useCallback((le={},ge=null)=>{const ke=E&&!r;return{...le,id:P,ref:ge,type:"radio",name:p,value:h,onChange:et(le.onChange,ie),onBlur:et(U,le.onBlur,()=>Q(!1)),onFocus:et(K,le.onFocus,()=>Q(!0)),onKeyDown:et(le.onKeyDown,ye),onKeyUp:et(le.onKeyUp,Z),checked:Y,disabled:ke,readOnly:O,required:R,"aria-invalid":ns(M),"aria-disabled":ns(ke),"aria-required":ns(R),"data-readonly":Ft(O),"aria-describedby":b,style:VL}},[E,r,P,p,h,ie,U,K,ye,Z,Y,O,R,M,b]);return{state:{isInvalid:M,isFocused:$,isChecked:Y,isActive:q,isHovered:B,isDisabled:E,isReadOnly:O,isRequired:R},getCheckboxProps:oe,getRadioProps:oe,getInputProps:ae,getLabelProps:(le={},ge=null)=>({...le,ref:ge,onMouseDown:et(le.onMouseDown,GL),"data-disabled":Ft(E),"data-checked":Ft(Y),"data-invalid":Ft(M)}),getRootProps:(le,ge=null)=>({...le,ref:ge,"data-disabled":Ft(E),"data-checked":Ft(Y),"data-invalid":Ft(M)}),htmlProps:w}}function GL(e){e.preventDefault(),e.stopPropagation()}function qL(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 ya=Te((e,t)=>{var n;const r=_P(),{onChange:o,value:s}=e,a=Br("Radio",{...r,...e}),c=qn(e),{spacing:d="0.5rem",children:p,isDisabled:h=r==null?void 0:r.isDisabled,isFocusable:m=r==null?void 0:r.isFocusable,inputProps:v,...b}=c;let w=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(w=r.value===s);let y=o;r!=null&&r.onChange&&s!=null&&(y=Jh(r.onChange,o));const S=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:k,getCheckboxProps:_,getLabelProps:I,getRootProps:P,htmlProps:E}=UL({...b,isChecked:w,isFocusable:m,isDisabled:h,onChange:y,name:S}),[O,R]=qL(E,P_),M=_(R),T=k(v,t),A=I(),$=Object.assign({},O,P()),Q={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...a.container},B={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...a.control},V={userSelect:"none",marginStart:d,...a.label};return i.jsxs(je.label,{className:"chakra-radio",...$,__css:Q,children:[i.jsx("input",{className:"chakra-radio__input",...T}),i.jsx(je.span,{className:"chakra-radio__control",...M,__css:B}),p&&i.jsx(je.span,{className:"chakra-radio__label",...A,__css:V,children:p})]})});ya.displayName="Radio";var PP=Te(function(t,n){const{children:r,placeholder:o,className:s,...a}=t;return i.jsxs(je.select,{...a,ref:n,className:Ct("chakra-select",s),children:[o&&i.jsx("option",{value:"",children:o}),r]})});PP.displayName="SelectField";function KL(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 jP=Te((e,t)=>{var n;const r=Br("Select",e),{rootProps:o,placeholder:s,icon:a,color:c,height:d,h:p,minH:h,minHeight:m,iconColor:v,iconSize:b,...w}=qn(e),[y,S]=KL(w,P_),k=Z1(S),_={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 i.jsxs(je.div,{className:"chakra-select__wrapper",__css:_,...y,...o,children:[i.jsx(PP,{ref:t,height:p??d,minH:h??m,placeholder:s,...k,__css:I,children:e.children}),i.jsx(IP,{"data-disabled":Ft(k.disabled),...(v||c)&&{color:v||c},__css:r.icon,...b&&{fontSize:b},children:a})]})});jP.displayName="Select";var YL=e=>i.jsx("svg",{viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),QL=je("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),IP=e=>{const{children:t=i.jsx(YL,{}),...n}=e,r=f.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return i.jsx(QL,{...n,className:"chakra-select__icon-wrapper",children:f.isValidElement(t)?r:null})};IP.displayName="SelectIcon";function XL(){const e=f.useRef(!0);return f.useEffect(()=>{e.current=!1},[]),e.current}function JL(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}var ZL=je("div",{baseStyle:{boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none","&::before, &::after, *":{visibility:"hidden"}}}),Bv=j_("skeleton-start-color"),Fv=j_("skeleton-end-color"),eB=za({from:{opacity:0},to:{opacity:1}}),tB=za({from:{borderColor:Bv.reference,background:Bv.reference},to:{borderColor:Fv.reference,background:Fv.reference}}),gm=Te((e,t)=>{const n={...e,fadeDuration:typeof e.fadeDuration=="number"?e.fadeDuration:.4,speed:typeof e.speed=="number"?e.speed:.8},r=ia("Skeleton",n),o=XL(),{startColor:s="",endColor:a="",isLoaded:c,fadeDuration:d,speed:p,className:h,fitContent:m,...v}=qn(n),[b,w]=Dc("colors",[s,a]),y=JL(c),S=Ct("chakra-skeleton",h),k={...b&&{[Bv.variable]:b},...w&&{[Fv.variable]:w}};if(c){const _=o||y?"none":`${eB} ${d}s`;return i.jsx(je.div,{ref:t,className:S,__css:{animation:_},...v})}return i.jsx(ZL,{ref:t,className:S,...v,__css:{width:m?"fit-content":void 0,...r,...k,_dark:{...r._dark,...k},animation:`${p}s linear infinite alternate ${tB}`}})});gm.displayName="Skeleton";var Jo=e=>e?"":void 0,ic=e=>e?!0:void 0,ji=(...e)=>e.filter(Boolean).join(" ");function lc(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function nB(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 ju(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var Sp={width:0,height:0},$f=e=>e||Sp;function EP(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=y=>{var S;const k=(S=r[y])!=null?S:Sp;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...ju({orientation:t,vertical:{bottom:`calc(${n[y]}% - ${k.height/2}px)`},horizontal:{left:`calc(${n[y]}% - ${k.width/2}px)`}})}},a=t==="vertical"?r.reduce((y,S)=>$f(y).height>$f(S).height?y:S,Sp):r.reduce((y,S)=>$f(y).width>$f(S).width?y:S,Sp),c={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...ju({orientation:t,vertical:a?{paddingLeft:a.width/2,paddingRight:a.width/2}:{},horizontal:a?{paddingTop:a.height/2,paddingBottom:a.height/2}:{}})},d={position:"absolute",...ju({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 v=m[0];!p&&o&&(v=100-v);const b=Math.abs(m[m.length-1]-m[0]),w={...d,...ju({orientation:t,vertical:o?{height:`${b}%`,top:`${v}%`}:{height:`${b}%`,bottom:`${v}%`},horizontal:o?{width:`${b}%`,right:`${v}%`}:{width:`${b}%`,left:`${v}%`}})};return{trackStyle:d,innerTrackStyle:w,rootStyle:c,getThumbStyle:s}}function OP(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function rB(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function oB(e){const t=aB(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function RP(e){return!!e.touches}function sB(e){return RP(e)&&e.touches.length>1}function aB(e){var t;return(t=e.view)!=null?t:window}function iB(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function lB(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function MP(e,t="page"){return RP(e)?iB(e,t):lB(e,t)}function cB(e){return t=>{const n=oB(t);(!n||n&&t.button===0)&&e(t)}}function uB(e,t=!1){function n(o){e(o,{point:MP(o)})}return t?cB(n):n}function Cp(e,t,n,r){return rB(e,t,uB(n,t==="pointerdown"),r)}var dB=Object.defineProperty,fB=(e,t,n)=>t in e?dB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bs=(e,t,n)=>(fB(e,typeof t!="symbol"?t+"":t,n),n),pB=class{constructor(e,t,n){bs(this,"history",[]),bs(this,"startEvent",null),bs(this,"lastEvent",null),bs(this,"lastEventInfo",null),bs(this,"handlers",{}),bs(this,"removeListeners",()=>{}),bs(this,"threshold",3),bs(this,"win"),bs(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const c=_0(this.lastEventInfo,this.history),d=this.startEvent!==null,p=vB(c.offset,{x:0,y:0})>=this.threshold;if(!d&&!p)return;const{timestamp:h}=bw();this.history.push({...c.point,timestamp:h});const{onStart:m,onMove:v}=this.handlers;d||(m==null||m(this.lastEvent,c),this.startEvent=this.lastEvent),v==null||v(this.lastEvent,c)}),bs(this,"onPointerMove",(c,d)=>{this.lastEvent=c,this.lastEventInfo=d,AT.update(this.updatePoint,!0)}),bs(this,"onPointerUp",(c,d)=>{const p=_0(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,sB(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:MP(e)},{timestamp:s}=bw();this.history=[{...o.point,timestamp:s}];const{onSessionStart:a}=t;a==null||a(e,_0(o,this.history)),this.removeListeners=gB(Cp(this.win,"pointermove",this.onPointerMove),Cp(this.win,"pointerup",this.onPointerUp),Cp(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),NT.update(this.updatePoint)}};function oS(e,t){return{x:e.x-t.x,y:e.y-t.y}}function _0(e,t){return{point:e.point,delta:oS(e.point,t[t.length-1]),offset:oS(e.point,t[0]),velocity:mB(t,.1)}}var hB=e=>e*1e3;function mB(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>hB(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 a={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function gB(...e){return t=>e.reduce((n,r)=>r(n),t)}function P0(e,t){return Math.abs(e-t)}function sS(e){return"x"in e&&"y"in e}function vB(e,t){if(typeof e=="number"&&typeof t=="number")return P0(e,t);if(sS(e)&&sS(t)){const n=P0(e.x,t.x),r=P0(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function DP(e){const t=f.useRef(null);return t.current=e,t}function TP(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:a,threshold:c}=t,d=!!(n||r||o||s||a),p=f.useRef(null),h=DP({onSessionStart:s,onSessionEnd:a,onStart:r,onMove:n,onEnd(m,v){p.current=null,o==null||o(m,v)}});f.useEffect(()=>{var m;(m=p.current)==null||m.updateHandlers(h.current)}),f.useEffect(()=>{const m=e.current;if(!m||!d)return;function v(b){p.current=new pB(b,h.current,c)}return Cp(m,"pointerdown",v)},[e,d,h,c]),f.useEffect(()=>()=>{var m;(m=p.current)==null||m.end(),p.current=null},[])}function bB(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 a,c;if("borderBoxSize"in s){const d=s.borderBoxSize,p=Array.isArray(d)?d[0]:d;a=p.inlineSize,c=p.blockSize}else a=e.offsetWidth,c=e.offsetHeight;t({width:a,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}var yB=globalThis!=null&&globalThis.document?f.useLayoutEffect:f.useEffect;function xB(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 AP({getNodes:e,observeMutation:t=!0}){const[n,r]=f.useState([]),[o,s]=f.useState(0);return yB(()=>{const a=e(),c=a.map((d,p)=>bB(d,h=>{r(m=>[...m.slice(0,p),h,...m.slice(p+1)])}));if(t){const d=a[0];c.push(xB(d,()=>{s(p=>p+1)}))}return()=>{c.forEach(d=>{d==null||d()})}},[o]),n}function wB(e){return typeof e=="object"&&e!==null&&"current"in e}function SB(e){const[t]=AP({observeMutation:!1,getNodes(){return[wB(e)?e.current:e]}});return t}function CB(e){const{min:t=0,max:n=100,onChange:r,value:o,defaultValue:s,isReversed:a,direction:c="ltr",orientation:d="horizontal",id:p,isDisabled:h,isReadOnly:m,onChangeStart:v,onChangeEnd:b,step:w=1,getAriaValueText:y,"aria-valuetext":S,"aria-label":k,"aria-labelledby":_,name:I,focusThumbOnChange:P=!0,minStepsBetweenThumbs:E=0,...O}=e,R=rr(v),M=rr(b),T=rr(y),A=OP({isReversed:a,direction:c,orientation:d}),[$,Q]=Ac({value:o,defaultValue:s??[25,75],onChange:r});if(!Array.isArray($))throw new TypeError(`[range-slider] You passed an invalid value for \`value\` or \`defaultValue\`, expected \`Array\` but got \`${typeof $}\``);const[B,V]=f.useState(!1),[q,G]=f.useState(!1),[D,z]=f.useState(-1),H=!(h||m),Y=f.useRef($),ie=$.map(Pe=>rc(Pe,t,n)),ye=E*w,Z=kB(ie,t,n,ye),oe=f.useRef({eventSource:null,value:[],valueBounds:[]});oe.current.value=ie,oe.current.valueBounds=Z;const K=ie.map(Pe=>n-Pe+t),ae=(A?K:ie).map(Pe=>Bp(Pe,t,n)),re=d==="vertical",se=f.useRef(null),pe=f.useRef(null),le=AP({getNodes(){const Pe=pe.current,Je=Pe==null?void 0:Pe.querySelectorAll("[role=slider]");return Je?Array.from(Je):[]}}),ge=f.useId(),xe=nB(p??ge),de=f.useCallback(Pe=>{var Je,Qe;if(!se.current)return;oe.current.eventSource="pointer";const dt=se.current.getBoundingClientRect(),{clientX:Lt,clientY:cr}=(Qe=(Je=Pe.touches)==null?void 0:Je[0])!=null?Qe:Pe,pn=re?dt.bottom-cr:Lt-dt.left,ln=re?dt.height:dt.width;let Fr=pn/ln;return A&&(Fr=1-Fr),U3(Fr,t,n)},[re,A,n,t]),Ae=(n-t)/10,Ee=w||(n-t)/100,$e=f.useMemo(()=>({setValueAtIndex(Pe,Je){if(!H)return;const Qe=oe.current.valueBounds[Pe];Je=parseFloat(Iv(Je,Qe.min,Ee)),Je=rc(Je,Qe.min,Qe.max);const dt=[...oe.current.value];dt[Pe]=Je,Q(dt)},setActiveIndex:z,stepUp(Pe,Je=Ee){const Qe=oe.current.value[Pe],dt=A?Qe-Je:Qe+Je;$e.setValueAtIndex(Pe,dt)},stepDown(Pe,Je=Ee){const Qe=oe.current.value[Pe],dt=A?Qe+Je:Qe-Je;$e.setValueAtIndex(Pe,dt)},reset(){Q(Y.current)}}),[Ee,A,Q,H]),kt=f.useCallback(Pe=>{const Je=Pe.key,dt={ArrowRight:()=>$e.stepUp(D),ArrowUp:()=>$e.stepUp(D),ArrowLeft:()=>$e.stepDown(D),ArrowDown:()=>$e.stepDown(D),PageUp:()=>$e.stepUp(D,Ae),PageDown:()=>$e.stepDown(D,Ae),Home:()=>{const{min:Lt}=Z[D];$e.setValueAtIndex(D,Lt)},End:()=>{const{max:Lt}=Z[D];$e.setValueAtIndex(D,Lt)}}[Je];dt&&(Pe.preventDefault(),Pe.stopPropagation(),dt(Pe),oe.current.eventSource="keyboard")},[$e,D,Ae,Z]),{getThumbStyle:ct,rootStyle:on,trackStyle:vt,innerTrackStyle:bt}=f.useMemo(()=>EP({isReversed:A,orientation:d,thumbRects:le,thumbPercents:ae}),[A,d,ae,le]),Se=f.useCallback(Pe=>{var Je;const Qe=Pe??D;if(Qe!==-1&&P){const dt=xe.getThumb(Qe),Lt=(Je=pe.current)==null?void 0:Je.ownerDocument.getElementById(dt);Lt&&setTimeout(()=>Lt.focus())}},[P,D,xe]);Ba(()=>{oe.current.eventSource==="keyboard"&&(M==null||M(oe.current.value))},[ie,M]);const Me=Pe=>{const Je=de(Pe)||0,Qe=oe.current.value.map(ln=>Math.abs(ln-Je)),dt=Math.min(...Qe);let Lt=Qe.indexOf(dt);const cr=Qe.filter(ln=>ln===dt);cr.length>1&&Je>oe.current.value[Lt]&&(Lt=Lt+cr.length-1),z(Lt),$e.setValueAtIndex(Lt,Je),Se(Lt)},Pt=Pe=>{if(D==-1)return;const Je=de(Pe)||0;z(D),$e.setValueAtIndex(D,Je),Se(D)};TP(pe,{onPanSessionStart(Pe){H&&(V(!0),Me(Pe),R==null||R(oe.current.value))},onPanSessionEnd(){H&&(V(!1),M==null||M(oe.current.value))},onPan(Pe){H&&Pt(Pe)}});const At=f.useCallback((Pe={},Je=null)=>({...Pe,...O,id:xe.root,ref:cn(Je,pe),tabIndex:-1,"aria-disabled":ic(h),"data-focused":Jo(q),style:{...Pe.style,...on}}),[O,h,q,on,xe]),we=f.useCallback((Pe={},Je=null)=>({...Pe,ref:cn(Je,se),id:xe.track,"data-disabled":Jo(h),style:{...Pe.style,...vt}}),[h,vt,xe]),ht=f.useCallback((Pe={},Je=null)=>({...Pe,ref:Je,id:xe.innerTrack,style:{...Pe.style,...bt}}),[bt,xe]),$t=f.useCallback((Pe,Je=null)=>{var Qe;const{index:dt,...Lt}=Pe,cr=ie[dt];if(cr==null)throw new TypeError(`[range-slider > thumb] Cannot find value at index \`${dt}\`. The \`value\` or \`defaultValue\` length is : ${ie.length}`);const pn=Z[dt];return{...Lt,ref:Je,role:"slider",tabIndex:H?0:void 0,id:xe.getThumb(dt),"data-active":Jo(B&&D===dt),"aria-valuetext":(Qe=T==null?void 0:T(cr))!=null?Qe:S==null?void 0:S[dt],"aria-valuemin":pn.min,"aria-valuemax":pn.max,"aria-valuenow":cr,"aria-orientation":d,"aria-disabled":ic(h),"aria-readonly":ic(m),"aria-label":k==null?void 0:k[dt],"aria-labelledby":k!=null&&k[dt]||_==null?void 0:_[dt],style:{...Pe.style,...ct(dt)},onKeyDown:lc(Pe.onKeyDown,kt),onFocus:lc(Pe.onFocus,()=>{G(!0),z(dt)}),onBlur:lc(Pe.onBlur,()=>{G(!1),z(-1)})}},[xe,ie,Z,H,B,D,T,S,d,h,m,k,_,ct,kt,G]),zt=f.useCallback((Pe={},Je=null)=>({...Pe,ref:Je,id:xe.output,htmlFor:ie.map((Qe,dt)=>xe.getThumb(dt)).join(" "),"aria-live":"off"}),[xe,ie]),ze=f.useCallback((Pe,Je=null)=>{const{value:Qe,...dt}=Pe,Lt=!(Qen),cr=Qe>=ie[0]&&Qe<=ie[ie.length-1];let pn=Bp(Qe,t,n);pn=A?100-pn:pn;const ln={position:"absolute",pointerEvents:"none",...ju({orientation:d,vertical:{bottom:`${pn}%`},horizontal:{left:`${pn}%`}})};return{...dt,ref:Je,id:xe.getMarker(Pe.value),role:"presentation","aria-hidden":!0,"data-disabled":Jo(h),"data-invalid":Jo(!Lt),"data-highlighted":Jo(cr),style:{...Pe.style,...ln}}},[h,A,n,t,d,ie,xe]),qe=f.useCallback((Pe,Je=null)=>{const{index:Qe,...dt}=Pe;return{...dt,ref:Je,id:xe.getInput(Qe),type:"hidden",value:ie[Qe],name:Array.isArray(I)?I[Qe]:`${I}-${Qe}`}},[I,ie,xe]);return{state:{value:ie,isFocused:q,isDragging:B,getThumbPercent:Pe=>ae[Pe],getThumbMinValue:Pe=>Z[Pe].min,getThumbMaxValue:Pe=>Z[Pe].max},actions:$e,getRootProps:At,getTrackProps:we,getInnerTrackProps:ht,getThumbProps:$t,getMarkerProps:ze,getInputProps:qe,getOutputProps:zt}}function kB(e,t,n,r){return e.map((o,s)=>{const a=s===0?t:e[s-1]+r,c=s===e.length-1?n:e[s+1]-r;return{min:a,max:c}})}var[_B,vm]=Rn({name:"SliderContext",errorMessage:"useSliderContext: `context` is undefined. Seems you forgot to wrap all slider components within "}),[PB,bm]=Rn({name:"RangeSliderStylesContext",errorMessage:`useRangeSliderStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),NP=Te(function(t,n){const r={orientation:"horizontal",...t},o=Br("Slider",r),s=qn(r),{direction:a}=Mc();s.direction=a;const{getRootProps:c,...d}=CB(s),p=f.useMemo(()=>({...d,name:r.name}),[d,r.name]);return i.jsx(_B,{value:p,children:i.jsx(PB,{value:o,children:i.jsx(je.div,{...c({},n),className:"chakra-slider",__css:o.container,children:r.children})})})});NP.displayName="RangeSlider";var Hv=Te(function(t,n){const{getThumbProps:r,getInputProps:o,name:s}=vm(),a=bm(),c=r(t,n);return i.jsxs(je.div,{...c,className:ji("chakra-slider__thumb",t.className),__css:a.thumb,children:[c.children,s&&i.jsx("input",{...o({index:t.index})})]})});Hv.displayName="RangeSliderThumb";var $P=Te(function(t,n){const{getTrackProps:r}=vm(),o=bm(),s=r(t,n);return i.jsx(je.div,{...s,className:ji("chakra-slider__track",t.className),__css:o.track,"data-testid":"chakra-range-slider-track"})});$P.displayName="RangeSliderTrack";var zP=Te(function(t,n){const{getInnerTrackProps:r}=vm(),o=bm(),s=r(t,n);return i.jsx(je.div,{...s,className:"chakra-slider__filled-track",__css:o.filledTrack})});zP.displayName="RangeSliderFilledTrack";var kp=Te(function(t,n){const{getMarkerProps:r}=vm(),o=bm(),s=r(t,n);return i.jsx(je.div,{...s,className:ji("chakra-slider__marker",t.className),__css:o.mark})});kp.displayName="RangeSliderMark";function jB(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:a,isReversed:c,direction:d="ltr",orientation:p="horizontal",id:h,isDisabled:m,isReadOnly:v,onChangeStart:b,onChangeEnd:w,step:y=1,getAriaValueText:S,"aria-valuetext":k,"aria-label":_,"aria-labelledby":I,name:P,focusThumbOnChange:E=!0,...O}=e,R=rr(b),M=rr(w),T=rr(S),A=OP({isReversed:c,direction:d,orientation:p}),[$,Q]=Ac({value:s,defaultValue:a??EB(n,r),onChange:o}),[B,V]=f.useState(!1),[q,G]=f.useState(!1),D=!(m||v),z=(r-n)/10,H=y||(r-n)/100,Y=rc($,n,r),ie=r-Y+n,Z=Bp(A?ie:Y,n,r),oe=p==="vertical",K=DP({min:n,max:r,step:y,isDisabled:m,value:Y,isInteractive:D,isReversed:A,isVertical:oe,eventSource:null,focusThumbOnChange:E,orientation:p}),U=f.useRef(null),ae=f.useRef(null),re=f.useRef(null),se=f.useId(),pe=h??se,[le,ge]=[`slider-thumb-${pe}`,`slider-track-${pe}`],ke=f.useCallback(ze=>{var qe,Pn;if(!U.current)return;const Pe=K.current;Pe.eventSource="pointer";const Je=U.current.getBoundingClientRect(),{clientX:Qe,clientY:dt}=(Pn=(qe=ze.touches)==null?void 0:qe[0])!=null?Pn:ze,Lt=oe?Je.bottom-dt:Qe-Je.left,cr=oe?Je.height:Je.width;let pn=Lt/cr;A&&(pn=1-pn);let ln=U3(pn,Pe.min,Pe.max);return Pe.step&&(ln=parseFloat(Iv(ln,Pe.min,Pe.step))),ln=rc(ln,Pe.min,Pe.max),ln},[oe,A,K]),xe=f.useCallback(ze=>{const qe=K.current;qe.isInteractive&&(ze=parseFloat(Iv(ze,qe.min,H)),ze=rc(ze,qe.min,qe.max),Q(ze))},[H,Q,K]),de=f.useMemo(()=>({stepUp(ze=H){const qe=A?Y-ze:Y+ze;xe(qe)},stepDown(ze=H){const qe=A?Y+ze:Y-ze;xe(qe)},reset(){xe(a||0)},stepTo(ze){xe(ze)}}),[xe,A,Y,H,a]),Ae=f.useCallback(ze=>{const qe=K.current,Pe={ArrowRight:()=>de.stepUp(),ArrowUp:()=>de.stepUp(),ArrowLeft:()=>de.stepDown(),ArrowDown:()=>de.stepDown(),PageUp:()=>de.stepUp(z),PageDown:()=>de.stepDown(z),Home:()=>xe(qe.min),End:()=>xe(qe.max)}[ze.key];Pe&&(ze.preventDefault(),ze.stopPropagation(),Pe(ze),qe.eventSource="keyboard")},[de,xe,z,K]),Ee=(t=T==null?void 0:T(Y))!=null?t:k,$e=SB(ae),{getThumbStyle:kt,rootStyle:ct,trackStyle:on,innerTrackStyle:vt}=f.useMemo(()=>{const ze=K.current,qe=$e??{width:0,height:0};return EP({isReversed:A,orientation:ze.orientation,thumbRects:[qe],thumbPercents:[Z]})},[A,$e,Z,K]),bt=f.useCallback(()=>{K.current.focusThumbOnChange&&setTimeout(()=>{var qe;return(qe=ae.current)==null?void 0:qe.focus()})},[K]);Ba(()=>{const ze=K.current;bt(),ze.eventSource==="keyboard"&&(M==null||M(ze.value))},[Y,M]);function Se(ze){const qe=ke(ze);qe!=null&&qe!==K.current.value&&Q(qe)}TP(re,{onPanSessionStart(ze){const qe=K.current;qe.isInteractive&&(V(!0),bt(),Se(ze),R==null||R(qe.value))},onPanSessionEnd(){const ze=K.current;ze.isInteractive&&(V(!1),M==null||M(ze.value))},onPan(ze){K.current.isInteractive&&Se(ze)}});const Me=f.useCallback((ze={},qe=null)=>({...ze,...O,ref:cn(qe,re),tabIndex:-1,"aria-disabled":ic(m),"data-focused":Jo(q),style:{...ze.style,...ct}}),[O,m,q,ct]),Pt=f.useCallback((ze={},qe=null)=>({...ze,ref:cn(qe,U),id:ge,"data-disabled":Jo(m),style:{...ze.style,...on}}),[m,ge,on]),At=f.useCallback((ze={},qe=null)=>({...ze,ref:qe,style:{...ze.style,...vt}}),[vt]),we=f.useCallback((ze={},qe=null)=>({...ze,ref:cn(qe,ae),role:"slider",tabIndex:D?0:void 0,id:le,"data-active":Jo(B),"aria-valuetext":Ee,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":Y,"aria-orientation":p,"aria-disabled":ic(m),"aria-readonly":ic(v),"aria-label":_,"aria-labelledby":_?void 0:I,style:{...ze.style,...kt(0)},onKeyDown:lc(ze.onKeyDown,Ae),onFocus:lc(ze.onFocus,()=>G(!0)),onBlur:lc(ze.onBlur,()=>G(!1))}),[D,le,B,Ee,n,r,Y,p,m,v,_,I,kt,Ae]),ht=f.useCallback((ze,qe=null)=>{const Pn=!(ze.valuer),Pe=Y>=ze.value,Je=Bp(ze.value,n,r),Qe={position:"absolute",pointerEvents:"none",...IB({orientation:p,vertical:{bottom:A?`${100-Je}%`:`${Je}%`},horizontal:{left:A?`${100-Je}%`:`${Je}%`}})};return{...ze,ref:qe,role:"presentation","aria-hidden":!0,"data-disabled":Jo(m),"data-invalid":Jo(!Pn),"data-highlighted":Jo(Pe),style:{...ze.style,...Qe}}},[m,A,r,n,p,Y]),$t=f.useCallback((ze={},qe=null)=>({...ze,ref:qe,type:"hidden",value:Y,name:P}),[P,Y]);return{state:{value:Y,isFocused:q,isDragging:B},actions:de,getRootProps:Me,getTrackProps:Pt,getInnerTrackProps:At,getThumbProps:we,getMarkerProps:ht,getInputProps:$t}}function IB(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function EB(e,t){return t"}),[RB,xm]=Rn({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),LP=Te((e,t)=>{var n;const r={...e,orientation:(n=e==null?void 0:e.orientation)!=null?n:"horizontal"},o=Br("Slider",r),s=qn(r),{direction:a}=Mc();s.direction=a;const{getInputProps:c,getRootProps:d,...p}=jB(s),h=d(),m=c({},t);return i.jsx(OB,{value:p,children:i.jsx(RB,{value:o,children:i.jsxs(je.div,{...h,className:ji("chakra-slider",r.className),__css:o.container,children:[r.children,i.jsx("input",{...m})]})})})});LP.displayName="Slider";var BP=Te((e,t)=>{const{getThumbProps:n}=ym(),r=xm(),o=n(e,t);return i.jsx(je.div,{...o,className:ji("chakra-slider__thumb",e.className),__css:r.thumb})});BP.displayName="SliderThumb";var FP=Te((e,t)=>{const{getTrackProps:n}=ym(),r=xm(),o=n(e,t);return i.jsx(je.div,{...o,className:ji("chakra-slider__track",e.className),__css:r.track})});FP.displayName="SliderTrack";var HP=Te((e,t)=>{const{getInnerTrackProps:n}=ym(),r=xm(),o=n(e,t);return i.jsx(je.div,{...o,className:ji("chakra-slider__filled-track",e.className),__css:r.filledTrack})});HP.displayName="SliderFilledTrack";var Vl=Te((e,t)=>{const{getMarkerProps:n}=ym(),r=xm(),o=n(e,t);return i.jsx(je.div,{...o,className:ji("chakra-slider__marker",e.className),__css:r.mark})});Vl.displayName="SliderMark";var Nb=Te(function(t,n){const r=Br("Switch",t),{spacing:o="0.5rem",children:s,...a}=qn(t),{getIndicatorProps:c,getInputProps:d,getCheckboxProps:p,getRootProps:h,getLabelProps:m}=W3(a),v=f.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),b=f.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),w=f.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return i.jsxs(je.label,{...h(),className:Ct("chakra-switch",t.className),__css:v,children:[i.jsx("input",{className:"chakra-switch__input",...d({},n)}),i.jsx(je.span,{...p(),className:"chakra-switch__track",__css:b,children:i.jsx(je.span,{__css:r.thumb,className:"chakra-switch__thumb",...c()})}),s&&i.jsx(je.span,{className:"chakra-switch__label",...m(),__css:w,children:s})]})});Nb.displayName="Switch";var[MB,DB,TB,AB]=Q1();function NB(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:a,lazyBehavior:c="unmount",orientation:d="horizontal",direction:p="ltr",...h}=e,[m,v]=f.useState(n??0),[b,w]=Ac({defaultValue:n??0,value:o,onChange:r});f.useEffect(()=>{o!=null&&v(o)},[o]);const y=TB(),S=f.useId();return{id:`tabs-${(t=e.id)!=null?t:S}`,selectedIndex:b,focusedIndex:m,setSelectedIndex:w,setFocusedIndex:v,isManual:s,isLazy:a,lazyBehavior:c,orientation:d,descendants:y,direction:p,htmlProps:h}}var[$B,wm]=Rn({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function zB(e){const{focusedIndex:t,orientation:n,direction:r}=wm(),o=DB(),s=f.useCallback(a=>{const c=()=>{var _;const I=o.nextEnabled(t);I&&((_=I.node)==null||_.focus())},d=()=>{var _;const I=o.prevEnabled(t);I&&((_=I.node)==null||_.focus())},p=()=>{var _;const I=o.firstEnabled();I&&((_=I.node)==null||_.focus())},h=()=>{var _;const I=o.lastEnabled();I&&((_=I.node)==null||_.focus())},m=n==="horizontal",v=n==="vertical",b=a.key,w=r==="ltr"?"ArrowLeft":"ArrowRight",y=r==="ltr"?"ArrowRight":"ArrowLeft",k={[w]:()=>m&&d(),[y]:()=>m&&c(),ArrowDown:()=>v&&c(),ArrowUp:()=>v&&d(),Home:p,End:h}[b];k&&(a.preventDefault(),k(a))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:et(e.onKeyDown,s)}}function LB(e){const{isDisabled:t=!1,isFocusable:n=!1,...r}=e,{setSelectedIndex:o,isManual:s,id:a,setFocusedIndex:c,selectedIndex:d}=wm(),{index:p,register:h}=AB({disabled:t&&!n}),m=p===d,v=()=>{o(p)},b=()=>{c(p),!s&&!(t&&n)&&o(p)},w=q5({...r,ref:cn(h,e.ref),isDisabled:t,isFocusable:n,onClick:et(e.onClick,v)}),y="button";return{...w,id:WP(a,p),role:"tab",tabIndex:m?0:-1,type:y,"aria-selected":m,"aria-controls":VP(a,p),onFocus:t?void 0:et(e.onFocus,b)}}var[BB,FB]=Rn({});function HB(e){const t=wm(),{id:n,selectedIndex:r}=t,s=gd(e.children).map((a,c)=>f.createElement(BB,{key:c,value:{isSelected:c===r,id:VP(n,c),tabId:WP(n,c),selectedIndex:r}},a));return{...e,children:s}}function WB(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=wm(),{isSelected:s,id:a,tabId:c}=FB(),d=f.useRef(!1);s&&(d.current=!0);const p=Ib({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:a}}function WP(e,t){return`${e}--tab-${t}`}function VP(e,t){return`${e}--tabpanel-${t}`}var[VB,Sm]=Rn({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Id=Te(function(t,n){const r=Br("Tabs",t),{children:o,className:s,...a}=qn(t),{htmlProps:c,descendants:d,...p}=NB(a),h=f.useMemo(()=>p,[p]),{isFitted:m,...v}=c;return i.jsx(MB,{value:d,children:i.jsx($B,{value:h,children:i.jsx(VB,{value:r,children:i.jsx(je.div,{className:Ct("chakra-tabs",s),ref:n,...v,__css:r.root,children:o})})})})});Id.displayName="Tabs";var Ed=Te(function(t,n){const r=zB({...t,ref:n}),s={display:"flex",...Sm().tablist};return i.jsx(je.div,{...r,className:Ct("chakra-tabs__tablist",t.className),__css:s})});Ed.displayName="TabList";var Cm=Te(function(t,n){const r=WB({...t,ref:n}),o=Sm();return i.jsx(je.div,{outline:"0",...r,className:Ct("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});Cm.displayName="TabPanel";var km=Te(function(t,n){const r=HB(t),o=Sm();return i.jsx(je.div,{...r,width:"100%",ref:n,className:Ct("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});km.displayName="TabPanels";var wc=Te(function(t,n){const r=Sm(),o=LB({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return i.jsx(je.button,{...o,className:Ct("chakra-tabs__tab",t.className),__css:s})});wc.displayName="Tab";function UB(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var GB=["h","minH","height","minHeight"],UP=Te((e,t)=>{const n=ia("Textarea",e),{className:r,rows:o,...s}=qn(e),a=Z1(s),c=o?UB(n,GB):n;return i.jsx(je.textarea,{ref:t,rows:o,...a,className:Ct("chakra-textarea",r),__css:c})});UP.displayName="Textarea";var qB={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]}}}},Wv=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},_p=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function KB(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:a=o,closeOnEsc:c=!0,onOpen:d,onClose:p,placement:h,id:m,isOpen:v,defaultIsOpen:b,arrowSize:w=10,arrowShadowColor:y,arrowPadding:S,modifiers:k,isDisabled:_,gutter:I,offset:P,direction:E,...O}=e,{isOpen:R,onOpen:M,onClose:T}=jb({isOpen:v,defaultIsOpen:b,onOpen:d,onClose:p}),{referenceRef:A,getPopperProps:$,getArrowInnerProps:Q,getArrowProps:B}=Pb({enabled:R,placement:h,arrowPadding:S,modifiers:k,gutter:I,offset:P,direction:E}),V=f.useId(),G=`tooltip-${m??V}`,D=f.useRef(null),z=f.useRef(),H=f.useCallback(()=>{z.current&&(clearTimeout(z.current),z.current=void 0)},[]),Y=f.useRef(),ie=f.useCallback(()=>{Y.current&&(clearTimeout(Y.current),Y.current=void 0)},[]),ye=f.useCallback(()=>{ie(),T()},[T,ie]),Z=YB(D,ye),oe=f.useCallback(()=>{if(!_&&!z.current){R&&Z();const ge=_p(D);z.current=ge.setTimeout(M,t)}},[Z,_,R,M,t]),K=f.useCallback(()=>{H();const ge=_p(D);Y.current=ge.setTimeout(ye,n)},[n,ye,H]),U=f.useCallback(()=>{R&&r&&K()},[r,K,R]),ae=f.useCallback(()=>{R&&a&&K()},[a,K,R]),re=f.useCallback(ge=>{R&&ge.key==="Escape"&&K()},[R,K]);Yi(()=>Wv(D),"keydown",c?re:void 0),Yi(()=>{const ge=D.current;if(!ge)return null;const ke=A5(ge);return ke.localName==="body"?_p(D):ke},"scroll",()=>{R&&s&&ye()},{passive:!0,capture:!0}),f.useEffect(()=>{_&&(H(),R&&T())},[_,R,T,H]),f.useEffect(()=>()=>{H(),ie()},[H,ie]),Yi(()=>D.current,"pointerleave",K);const se=f.useCallback((ge={},ke=null)=>({...ge,ref:cn(D,ke,A),onPointerEnter:et(ge.onPointerEnter,de=>{de.pointerType!=="touch"&&oe()}),onClick:et(ge.onClick,U),onPointerDown:et(ge.onPointerDown,ae),onFocus:et(ge.onFocus,oe),onBlur:et(ge.onBlur,K),"aria-describedby":R?G:void 0}),[oe,K,ae,R,G,U,A]),pe=f.useCallback((ge={},ke=null)=>$({...ge,style:{...ge.style,[_r.arrowSize.var]:w?`${w}px`:void 0,[_r.arrowShadowColor.var]:y}},ke),[$,w,y]),le=f.useCallback((ge={},ke=null)=>{const xe={...ge.style,position:"relative",transformOrigin:_r.transformOrigin.varRef};return{ref:ke,...O,...ge,id:G,role:"tooltip",style:xe}},[O,G]);return{isOpen:R,show:oe,hide:K,getTriggerProps:se,getTooltipProps:le,getTooltipPositionerProps:pe,getArrowProps:B,getArrowInnerProps:Q}}var j0="chakra-ui:close-tooltip";function YB(e,t){return f.useEffect(()=>{const n=Wv(e);return n.addEventListener(j0,t),()=>n.removeEventListener(j0,t)},[t,e]),()=>{const n=Wv(e),r=_p(e);n.dispatchEvent(new r.CustomEvent(j0))}}function QB(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function XB(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var JB=je(Yr.div),wn=Te((e,t)=>{var n,r;const o=ia("Tooltip",e),s=qn(e),a=Mc(),{children:c,label:d,shouldWrapChildren:p,"aria-label":h,hasArrow:m,bg:v,portalProps:b,background:w,backgroundColor:y,bgColor:S,motionProps:k,..._}=s,I=(r=(n=w??y)!=null?n:v)!=null?r:S;if(I){o.bg=I;const $=CR(a,"colors",I);o[_r.arrowBg.var]=$}const P=KB({..._,direction:a.direction}),E=typeof c=="string"||p;let O;if(E)O=i.jsx(je.span,{display:"inline-block",tabIndex:0,...P.getTriggerProps(),children:c});else{const $=f.Children.only(c);O=f.cloneElement($,P.getTriggerProps($.props,$.ref))}const R=!!h,M=P.getTooltipProps({},t),T=R?QB(M,["role","id"]):M,A=XB(M,["role","id"]);return d?i.jsxs(i.Fragment,{children:[O,i.jsx(Fo,{children:P.isOpen&&i.jsx(Uu,{...b,children:i.jsx(je.div,{...P.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:i.jsxs(JB,{variants:qB,initial:"exit",animate:"enter",exit:"exit",...k,...T,__css:o,children:[d,R&&i.jsx(je.span,{srOnly:!0,...A,children:h}),m&&i.jsx(je.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:i.jsx(je.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):i.jsx(i.Fragment,{children:c})});wn.displayName="Tooltip";function ZB(e,t={}){let n=f.useCallback(o=>t.keys?dT(e,t.keys,o):e.listen(o),[t.keys,e]),r=e.get.bind(e);return f.useSyncExternalStore(n,r,r)}const go=e=>e.system,eF=e=>e.system.toastQueue,GP=fe(go,e=>e.language,Ge),jr=fe(e=>e,e=>e.system.isProcessing||!e.system.isConnected),tF=fe(go,e=>{const{consoleLogLevel:t,shouldLogToConsole:n}=e;return{consoleLogLevel:t,shouldLogToConsole:n}},{memoizeOptions:{resultEqualityCheck:Jt}}),nF=()=>{const{consoleLogLevel:e,shouldLogToConsole:t}=L(tF);return f.useEffect(()=>{t?(localStorage.setItem("ROARR_LOG","true"),localStorage.setItem("ROARR_FILTER",`context.logLevel:>=${kR[e]}`)):localStorage.setItem("ROARR_LOG","false"),I2.ROARR.write=_R.createLogWriter()},[e,t]),f.useEffect(()=>{const r={...PR};E2.set(I2.Roarr.child(r))},[]),ZB(E2)},rF=()=>{const e=te(),t=L(eF),n=LT();return f.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(jR())},[e,n,t]),null},Fc=()=>{const e=te();return f.useCallback(n=>e(Dn(Bn(n))),[e])};var oF=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function Od(e,t){var n=sF(e);if(typeof n.path!="string"){var r=e.webkitRelativePath;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function sF(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=oF.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var aF=[".DS_Store","Thumbs.db"];function iF(e){return Nc(this,void 0,void 0,function(){return $c(this,function(t){return qp(e)&&lF(e.dataTransfer)?[2,fF(e.dataTransfer,e.type)]:cF(e)?[2,uF(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,dF(e)]:[2,[]]})})}function lF(e){return qp(e)}function cF(e){return qp(e)&&qp(e.target)}function qp(e){return typeof e=="object"&&e!==null}function uF(e){return Vv(e.target.files).map(function(t){return Od(t)})}function dF(e){return Nc(this,void 0,void 0,function(){var t;return $c(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 Od(r)})]}})})}function fF(e,t){return Nc(this,void 0,void 0,function(){var n,r;return $c(this,function(o){switch(o.label){case 0:return e.items?(n=Vv(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(pF))]):[3,2];case 1:return r=o.sent(),[2,aS(qP(r))];case 2:return[2,aS(Vv(e.files).map(function(s){return Od(s)}))]}})})}function aS(e){return e.filter(function(t){return aF.indexOf(t.name)===-1})}function Vv(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,dS(n)];if(e.sizen)return[!1,dS(n)]}return[!0,null]}function Vi(e){return e!=null}function EF(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,a=e.maxFiles,c=e.validator;return!s&&t.length>1||s&&a>=1&&t.length>a?!1:t.every(function(d){var p=XP(d,n),h=ed(p,1),m=h[0],v=JP(d,r,o),b=ed(v,1),w=b[0],y=c?c(d):null;return m&&w&&!y})}function Kp(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function zf(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 pS(e){e.preventDefault()}function OF(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function RF(e){return e.indexOf("Edge/")!==-1}function MF(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return OF(e)||RF(e)}function Gs(){for(var e=arguments.length,t=new Array(e),n=0;n1?o-1:0),a=1;ae.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 YF(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 $b=f.forwardRef(function(e,t){var n=e.children,r=Yp(e,zF),o=zb(r),s=o.open,a=Yp(o,LF);return f.useImperativeHandle(t,function(){return{open:s}},[s]),F.createElement(f.Fragment,null,n(fr(fr({},a),{},{open:s})))});$b.displayName="Dropzone";var n6={disabled:!1,getFilesFromEvent:iF,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};$b.defaultProps=n6;$b.propTypes={children:zn.func,accept:zn.objectOf(zn.arrayOf(zn.string)),multiple:zn.bool,preventDropOnDocument:zn.bool,noClick:zn.bool,noKeyboard:zn.bool,noDrag:zn.bool,noDragEventsBubbling:zn.bool,minSize:zn.number,maxSize:zn.number,maxFiles:zn.number,disabled:zn.bool,getFilesFromEvent:zn.func,onFileDialogCancel:zn.func,onFileDialogOpen:zn.func,useFsAccessApi:zn.bool,autoFocus:zn.bool,onDragEnter:zn.func,onDragLeave:zn.func,onDragOver:zn.func,onDrop:zn.func,onDropAccepted:zn.func,onDropRejected:zn.func,onError:zn.func,validator:zn.func};var Kv={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function zb(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=fr(fr({},n6),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,a=t.minSize,c=t.multiple,d=t.maxFiles,p=t.onDragEnter,h=t.onDragLeave,m=t.onDragOver,v=t.onDrop,b=t.onDropAccepted,w=t.onDropRejected,y=t.onFileDialogCancel,S=t.onFileDialogOpen,k=t.useFsAccessApi,_=t.autoFocus,I=t.preventDropOnDocument,P=t.noClick,E=t.noKeyboard,O=t.noDrag,R=t.noDragEventsBubbling,M=t.onError,T=t.validator,A=f.useMemo(function(){return AF(n)},[n]),$=f.useMemo(function(){return TF(n)},[n]),Q=f.useMemo(function(){return typeof S=="function"?S:mS},[S]),B=f.useMemo(function(){return typeof y=="function"?y:mS},[y]),V=f.useRef(null),q=f.useRef(null),G=f.useReducer(QF,Kv),D=I0(G,2),z=D[0],H=D[1],Y=z.isFocused,ie=z.isFileDialogActive,ye=f.useRef(typeof window<"u"&&window.isSecureContext&&k&&DF()),Z=function(){!ye.current&&ie&&setTimeout(function(){if(q.current){var Me=q.current.files;Me.length||(H({type:"closeDialog"}),B())}},300)};f.useEffect(function(){return window.addEventListener("focus",Z,!1),function(){window.removeEventListener("focus",Z,!1)}},[q,ie,B,ye]);var oe=f.useRef([]),K=function(Me){V.current&&V.current.contains(Me.target)||(Me.preventDefault(),oe.current=[])};f.useEffect(function(){return I&&(document.addEventListener("dragover",pS,!1),document.addEventListener("drop",K,!1)),function(){I&&(document.removeEventListener("dragover",pS),document.removeEventListener("drop",K))}},[V,I]),f.useEffect(function(){return!r&&_&&V.current&&V.current.focus(),function(){}},[V,_,r]);var U=f.useCallback(function(Se){M?M(Se):console.error(Se)},[M]),ae=f.useCallback(function(Se){Se.preventDefault(),Se.persist(),ct(Se),oe.current=[].concat(HF(oe.current),[Se.target]),zf(Se)&&Promise.resolve(o(Se)).then(function(Me){if(!(Kp(Se)&&!R)){var Pt=Me.length,At=Pt>0&&EF({files:Me,accept:A,minSize:a,maxSize:s,multiple:c,maxFiles:d,validator:T}),we=Pt>0&&!At;H({isDragAccept:At,isDragReject:we,isDragActive:!0,type:"setDraggedFiles"}),p&&p(Se)}}).catch(function(Me){return U(Me)})},[o,p,U,R,A,a,s,c,d,T]),re=f.useCallback(function(Se){Se.preventDefault(),Se.persist(),ct(Se);var Me=zf(Se);if(Me&&Se.dataTransfer)try{Se.dataTransfer.dropEffect="copy"}catch{}return Me&&m&&m(Se),!1},[m,R]),se=f.useCallback(function(Se){Se.preventDefault(),Se.persist(),ct(Se);var Me=oe.current.filter(function(At){return V.current&&V.current.contains(At)}),Pt=Me.indexOf(Se.target);Pt!==-1&&Me.splice(Pt,1),oe.current=Me,!(Me.length>0)&&(H({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),zf(Se)&&h&&h(Se))},[V,h,R]),pe=f.useCallback(function(Se,Me){var Pt=[],At=[];Se.forEach(function(we){var ht=XP(we,A),$t=I0(ht,2),zt=$t[0],ze=$t[1],qe=JP(we,a,s),Pn=I0(qe,2),Pe=Pn[0],Je=Pn[1],Qe=T?T(we):null;if(zt&&Pe&&!Qe)Pt.push(we);else{var dt=[ze,Je];Qe&&(dt=dt.concat(Qe)),At.push({file:we,errors:dt.filter(function(Lt){return Lt})})}}),(!c&&Pt.length>1||c&&d>=1&&Pt.length>d)&&(Pt.forEach(function(we){At.push({file:we,errors:[IF]})}),Pt.splice(0)),H({acceptedFiles:Pt,fileRejections:At,type:"setFiles"}),v&&v(Pt,At,Me),At.length>0&&w&&w(At,Me),Pt.length>0&&b&&b(Pt,Me)},[H,c,A,a,s,d,v,b,w,T]),le=f.useCallback(function(Se){Se.preventDefault(),Se.persist(),ct(Se),oe.current=[],zf(Se)&&Promise.resolve(o(Se)).then(function(Me){Kp(Se)&&!R||pe(Me,Se)}).catch(function(Me){return U(Me)}),H({type:"reset"})},[o,pe,U,R]),ge=f.useCallback(function(){if(ye.current){H({type:"openDialog"}),Q();var Se={multiple:c,types:$};window.showOpenFilePicker(Se).then(function(Me){return o(Me)}).then(function(Me){pe(Me,null),H({type:"closeDialog"})}).catch(function(Me){NF(Me)?(B(Me),H({type:"closeDialog"})):$F(Me)?(ye.current=!1,q.current?(q.current.value=null,q.current.click()):U(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."))):U(Me)});return}q.current&&(H({type:"openDialog"}),Q(),q.current.value=null,q.current.click())},[H,Q,B,k,pe,U,$,c]),ke=f.useCallback(function(Se){!V.current||!V.current.isEqualNode(Se.target)||(Se.key===" "||Se.key==="Enter"||Se.keyCode===32||Se.keyCode===13)&&(Se.preventDefault(),ge())},[V,ge]),xe=f.useCallback(function(){H({type:"focus"})},[]),de=f.useCallback(function(){H({type:"blur"})},[]),Ae=f.useCallback(function(){P||(MF()?setTimeout(ge,0):ge())},[P,ge]),Ee=function(Me){return r?null:Me},$e=function(Me){return E?null:Ee(Me)},kt=function(Me){return O?null:Ee(Me)},ct=function(Me){R&&Me.stopPropagation()},on=f.useMemo(function(){return function(){var Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Me=Se.refKey,Pt=Me===void 0?"ref":Me,At=Se.role,we=Se.onKeyDown,ht=Se.onFocus,$t=Se.onBlur,zt=Se.onClick,ze=Se.onDragEnter,qe=Se.onDragOver,Pn=Se.onDragLeave,Pe=Se.onDrop,Je=Yp(Se,BF);return fr(fr(qv({onKeyDown:$e(Gs(we,ke)),onFocus:$e(Gs(ht,xe)),onBlur:$e(Gs($t,de)),onClick:Ee(Gs(zt,Ae)),onDragEnter:kt(Gs(ze,ae)),onDragOver:kt(Gs(qe,re)),onDragLeave:kt(Gs(Pn,se)),onDrop:kt(Gs(Pe,le)),role:typeof At=="string"&&At!==""?At:"presentation"},Pt,V),!r&&!E?{tabIndex:0}:{}),Je)}},[V,ke,xe,de,Ae,ae,re,se,le,E,O,r]),vt=f.useCallback(function(Se){Se.stopPropagation()},[]),bt=f.useMemo(function(){return function(){var Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Me=Se.refKey,Pt=Me===void 0?"ref":Me,At=Se.onChange,we=Se.onClick,ht=Yp(Se,FF),$t=qv({accept:A,multiple:c,type:"file",style:{display:"none"},onChange:Ee(Gs(At,le)),onClick:Ee(Gs(we,vt)),tabIndex:-1},Pt,q);return fr(fr({},$t),ht)}},[q,n,c,le,r]);return fr(fr({},z),{},{isFocused:Y&&!r,getRootProps:on,getInputProps:bt,rootRef:V,inputRef:q,open:Ee(ge)})}function QF(e,t){switch(t.type){case"focus":return fr(fr({},e),{},{isFocused:!0});case"blur":return fr(fr({},e),{},{isFocused:!1});case"openDialog":return fr(fr({},Kv),{},{isFileDialogActive:!0});case"closeDialog":return fr(fr({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return fr(fr({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return fr(fr({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return fr({},Kv);default:return e}}function mS(){}function Yv(){return Yv=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 rH=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,a=n.mod,c=n.shift,d=n.ctrl,p=n.keys,h=t.key,m=t.code,v=t.ctrlKey,b=t.metaKey,w=t.shiftKey,y=t.altKey,S=ii(m),k=h.toLowerCase();if(!r){if(o===!y&&k!=="alt"||c===!w&&k!=="shift")return!1;if(a){if(!b&&!v)return!1}else if(s===!b&&k!=="meta"&&k!=="os"||d===!v&&k!=="ctrl"&&k!=="control")return!1}return p&&p.length===1&&(p.includes(k)||p.includes(S))?!0:p?o6(p):!p},oH=f.createContext(void 0),sH=function(){return f.useContext(oH)};function l6(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&l6(e[r],t[r])},!0):e===t}var aH=f.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),iH=function(){return f.useContext(aH)};function lH(e){var t=f.useRef(void 0);return l6(t.current,e)||(t.current=e),t.current}var gS=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},cH=typeof window<"u"?f.useLayoutEffect:f.useEffect;function nt(e,t,n,r){var o=f.useRef(null),s=f.useRef(!1),a=n instanceof Array?r instanceof Array?void 0:r:n,c=e instanceof Array?e.join(a==null?void 0:a.splitKey):e,d=n instanceof Array?n:r instanceof Array?r:void 0,p=f.useCallback(t,d??[]),h=f.useRef(p);d?h.current=p:h.current=t;var m=lH(a),v=iH(),b=v.enabledScopes,w=sH();return cH(function(){if(!((m==null?void 0:m.enabled)===!1||!nH(b,m==null?void 0:m.scopes))){var y=function(P,E){var O;if(E===void 0&&(E=!1),!(tH(P)&&!i6(P,m==null?void 0:m.enableOnFormTags))&&!(m!=null&&m.ignoreEventWhen!=null&&m.ignoreEventWhen(P))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){gS(P);return}(O=P.target)!=null&&O.isContentEditable&&!(m!=null&&m.enableOnContentEditable)||E0(c,m==null?void 0:m.splitKey).forEach(function(R){var M,T=O0(R,m==null?void 0:m.combinationKey);if(rH(P,T,m==null?void 0:m.ignoreModifiers)||(M=T.keys)!=null&&M.includes("*")){if(E&&s.current)return;if(ZF(P,T,m==null?void 0:m.preventDefault),!eH(P,T,m==null?void 0:m.enabled)){gS(P);return}h.current(P,T),E||(s.current=!0)}})}},S=function(P){P.key!==void 0&&(s6(ii(P.code)),((m==null?void 0:m.keydown)===void 0&&(m==null?void 0:m.keyup)!==!0||m!=null&&m.keydown)&&y(P))},k=function(P){P.key!==void 0&&(a6(ii(P.code)),s.current=!1,m!=null&&m.keyup&&y(P,!0))},_=o.current||(a==null?void 0:a.document)||document;return _.addEventListener("keyup",k),_.addEventListener("keydown",S),w&&E0(c,m==null?void 0:m.splitKey).forEach(function(I){return w.addHotkey(O0(I,m==null?void 0:m.combinationKey,m==null?void 0:m.description))}),function(){_.removeEventListener("keyup",k),_.removeEventListener("keydown",S),w&&E0(c,m==null?void 0:m.splitKey).forEach(function(I){return w.removeHotkey(O0(I,m==null?void 0:m.combinationKey,m==null?void 0:m.description))})}}},[c,m,b]),o}const uH=e=>{const{isDragAccept:t,isDragReject:n,setIsHandlingUpload:r}=e;return nt("esc",()=>{r(!1)}),i.jsxs(Re,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:[i.jsx(W,{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"}}),i.jsx(W,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"full",height:"full",alignItems:"center",justifyContent:"center",p:4},children:i.jsx(W,{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?i.jsx(Qs,{size:"lg",children:"Drop to Upload"}):i.jsxs(i.Fragment,{children:[i.jsx(Qs,{size:"lg",children:"Invalid Upload"}),i.jsx(Qs,{size:"md",children:"Must be single JPEG or PNG image"})]})})})]})},dH=fe([Ye,Kn],({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}},Ge),fH=e=>{const{children:t}=e,{autoAddBoardId:n,postUploadAction:r}=L(dH),o=L(jr),s=Fc(),{t:a}=be(),[c,d]=f.useState(!1),[p]=I_(),h=f.useCallback(I=>{d(!0),s({title:a("toast.uploadFailed"),description:I.errors.map(P=>P.message).join(` +`),status:"error"})},[a,s]),m=f.useCallback(async I=>{p({file:I,image_category:"user",is_intermediate:!1,postUploadAction:r,board_id:n})},[n,r,p]),v=f.useCallback((I,P)=>{if(P.length>1){s({title:a("toast.uploadFailed"),description:a("toast.uploadFailedInvalidUploadDesc"),status:"error"});return}P.forEach(E=>{h(E)}),I.forEach(E=>{m(E)})},[a,s,m,h]),{getRootProps:b,getInputProps:w,isDragAccept:y,isDragReject:S,isDragActive:k,inputRef:_}=zb({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:v,onDragOver:()=>d(!0),disabled:o,multiple:!1});return f.useEffect(()=>{const I=async P=>{var E,O;_.current&&(E=P.clipboardData)!=null&&E.files&&(_.current.files=P.clipboardData.files,(O=_.current)==null||O.dispatchEvent(new Event("change",{bubbles:!0})))};return document.addEventListener("paste",I),()=>{document.removeEventListener("paste",I)}},[_]),i.jsxs(Re,{...b({style:{}}),onKeyDown:I=>{I.key},children:[i.jsx("input",{...w()}),t,i.jsx(Fo,{children:k&&c&&i.jsx(Yr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:i.jsx(uH,{isDragAccept:y,isDragReject:S,setIsHandlingUpload:d})},"image-upload-overlay")})]})},pH=f.memo(fH),mn=e=>e.canvas,lr=fe([mn,Kn,go],(e,t,n)=>e.layerState.stagingArea.images.length>0||t==="unifiedCanvas"&&n.isProcessing),hH=e=>e.canvas.layerState.objects.find(E_),mH=VD(e=>{e(O_(!0))},300),Co=()=>(e,t)=>{Kn(t())==="unifiedCanvas"&&mH(e)};var gH=globalThis&&globalThis.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Cr=globalThis&&globalThis.__assign||function(){return Cr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"u"?void 0:Number(r),maxHeight:typeof o>"u"?void 0:Number(o),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof a>"u"?void 0:Number(a)}},CH=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],wS="__resizable_base__",kH=function(e){yH(t,e);function t(n){var r=e.call(this,n)||this;return r.ratio=1,r.resizable=null,r.parentLeft=0,r.parentTop=0,r.resizableLeft=0,r.resizableRight=0,r.resizableTop=0,r.resizableBottom=0,r.targetLeft=0,r.targetTop=0,r.appendBase=function(){if(!r.resizable||!r.window)return null;var o=r.parentNode;if(!o)return null;var s=r.window.document.createElement("div");return s.style.width="100%",s.style.height="100%",s.style.position="absolute",s.style.transform="scale(0, 0)",s.style.left="0",s.style.flex="0 0 100%",s.classList?s.classList.add(wS):s.className+=wS,o.appendChild(s),s},r.removeBase=function(o){var s=r.parentNode;s&&s.removeChild(o)},r.ref=function(o){o&&(r.resizable=o)},r.state={isResizing:!1,width:typeof(r.propsSize&&r.propsSize.width)>"u"?"auto":r.propsSize&&r.propsSize.width,height:typeof(r.propsSize&&r.propsSize.height)>"u"?"auto":r.propsSize&&r.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},r.onResizeStart=r.onResizeStart.bind(r),r.onMouseMove=r.onMouseMove.bind(r),r.onMouseUp=r.onMouseUp.bind(r),r}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||xH},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var o=this.resizable.offsetWidth,s=this.resizable.offsetHeight,a=this.resizable.style.position;a!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:o,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=a}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,o=function(c){if(typeof n.state[c]>"u"||n.state[c]==="auto")return"auto";if(n.propsSize&&n.propsSize[c]&&n.propsSize[c].toString().endsWith("%")){if(n.state[c].toString().endsWith("%"))return n.state[c].toString();var d=n.getParentSize(),p=Number(n.state[c].toString().replace("px","")),h=p/d[c]*100;return h+"%"}return R0(n.state[c])},s=r&&typeof r.width<"u"&&!this.state.isResizing?R0(r.width):o("width"),a=r&&typeof r.height<"u"&&!this.state.isResizing?R0(r.height):o("height");return{width:s,height:a}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var r=!1,o=this.parentNode.style.flexWrap;o!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var s={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=o),this.removeBase(n),s},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,r){var o=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof o>"u"||o==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var o=this.props.boundsByDirection,s=this.state.direction,a=o&&Ll("left",s),c=o&&Ll("top",s),d,p;if(this.props.bounds==="parent"){var h=this.parentNode;h&&(d=a?this.resizableRight-this.parentLeft:h.offsetWidth+(this.parentLeft-this.resizableLeft),p=c?this.resizableBottom-this.parentTop:h.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(d=a?this.resizableRight:this.window.innerWidth-this.resizableLeft,p=c?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(d=a?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),p=c?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return d&&Number.isFinite(d)&&(n=n&&n"u"?10:s.width,m=typeof o.width>"u"||o.width<0?n:o.width,v=typeof s.height>"u"?10:s.height,b=typeof o.height>"u"||o.height<0?r:o.height,w=d||0,y=p||0;if(c){var S=(v-w)*this.ratio+y,k=(b-w)*this.ratio+y,_=(h-y)/this.ratio+w,I=(m-y)/this.ratio+w,P=Math.max(h,S),E=Math.min(m,k),O=Math.max(v,_),R=Math.min(b,I);n=Bf(n,P,E),r=Bf(r,O,R)}else n=Bf(n,h,m),r=Bf(r,v,b);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){if(this.props.bounds==="parent"){var n=this.parentNode;if(n){var r=n.getBoundingClientRect();this.parentLeft=r.left,this.parentTop=r.top}}if(this.props.bounds&&typeof this.props.bounds!="string"){var o=this.props.bounds.getBoundingClientRect();this.targetLeft=o.left,this.targetTop=o.top}if(this.resizable){var s=this.resizable.getBoundingClientRect(),a=s.left,c=s.top,d=s.right,p=s.bottom;this.resizableLeft=a,this.resizableRight=d,this.resizableTop=c,this.resizableBottom=p}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var o=0,s=0;if(n.nativeEvent&&wH(n.nativeEvent)?(o=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&Ff(n.nativeEvent)&&(o=n.nativeEvent.touches[0].clientX,s=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var a=this.props.onResizeStart(n,r,this.resizable);if(a===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var c,d=this.window.getComputedStyle(this.resizable);if(d.flexBasis!=="auto"){var p=this.parentNode;if(p){var h=this.window.getComputedStyle(p).flexDirection;this.flexDir=h.startsWith("row")?"row":"column",c=d.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var m={original:{x:o,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:qs(qs({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:c};this.setState(m)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Ff(n))try{n.preventDefault(),n.stopPropagation()}catch{}var o=this.props,s=o.maxWidth,a=o.maxHeight,c=o.minWidth,d=o.minHeight,p=Ff(n)?n.touches[0].clientX:n.clientX,h=Ff(n)?n.touches[0].clientY:n.clientY,m=this.state,v=m.direction,b=m.original,w=m.width,y=m.height,S=this.getParentSize(),k=SH(S,this.window.innerWidth,this.window.innerHeight,s,a,c,d);s=k.maxWidth,a=k.maxHeight,c=k.minWidth,d=k.minHeight;var _=this.calculateNewSizeFromDirection(p,h),I=_.newHeight,P=_.newWidth,E=this.calculateNewMaxFromBoundary(s,a);this.props.snap&&this.props.snap.x&&(P=xS(P,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(I=xS(I,this.props.snap.y,this.props.snapGap));var O=this.calculateNewSizeFromAspectRatio(P,I,{width:E.maxWidth,height:E.maxHeight},{width:c,height:d});if(P=O.newWidth,I=O.newHeight,this.props.grid){var R=yS(P,this.props.grid[0]),M=yS(I,this.props.grid[1]),T=this.props.snapGap||0;P=T===0||Math.abs(R-P)<=T?R:P,I=T===0||Math.abs(M-I)<=T?M:I}var A={width:P-b.width,height:I-b.height};if(w&&typeof w=="string"){if(w.endsWith("%")){var $=P/S.width*100;P=$+"%"}else if(w.endsWith("vw")){var Q=P/this.window.innerWidth*100;P=Q+"vw"}else if(w.endsWith("vh")){var B=P/this.window.innerHeight*100;P=B+"vh"}}if(y&&typeof y=="string"){if(y.endsWith("%")){var $=I/S.height*100;I=$+"%"}else if(y.endsWith("vw")){var Q=I/this.window.innerWidth*100;I=Q+"vw"}else if(y.endsWith("vh")){var B=I/this.window.innerHeight*100;I=B+"vh"}}var V={width:this.createSizeForCssProperty(P,"width"),height:this.createSizeForCssProperty(I,"height")};this.flexDir==="row"?V.flexBasis=V.width:this.flexDir==="column"&&(V.flexBasis=V.height),_i.flushSync(function(){r.setState(V)}),this.props.onResize&&this.props.onResize(n,v,this.resizable,A)}},t.prototype.onMouseUp=function(n){var r=this.state,o=r.isResizing,s=r.direction,a=r.original;if(!(!o||!this.resizable)){var c={width:this.size.width-a.width,height:this.size.height-a.height};this.props.onResizeStop&&this.props.onResizeStop(n,s,this.resizable,c),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:qs(qs({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){this.setState({width:n.width,height:n.height})},t.prototype.renderResizer=function(){var n=this,r=this.props,o=r.enable,s=r.handleStyles,a=r.handleClasses,c=r.handleWrapperStyle,d=r.handleWrapperClass,p=r.handleComponent;if(!o)return null;var h=Object.keys(o).map(function(m){return o[m]!==!1?f.createElement(bH,{key:m,direction:m,onResizeStart:n.onResizeStart,replaceStyles:s&&s[m],className:a&&a[m]},p&&p[m]?p[m]:null):null});return f.createElement("div",{className:d,style:c},h)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(a,c){return CH.indexOf(c)!==-1||(a[c]=n.props[c]),a},{}),o=qs(qs(qs({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(o.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return f.createElement(s,qs({ref:this.ref,style:o,className:this.props.className},r),this.state.isResizing&&f.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(f.PureComponent);const _H=({direction:e,langDirection:t})=>({top:e==="bottom",right:t!=="rtl"&&e==="left"||t==="rtl"&&e==="right",bottom:e==="top",left:t!=="rtl"&&e==="right"||t==="rtl"&&e==="left"}),PH=({direction:e,minWidth:t,maxWidth:n,minHeight:r,maxHeight:o})=>{const s=t??(["left","right"].includes(e)?10:void 0),a=n??(["left","right"].includes(e)?"95vw":void 0),c=r??(["top","bottom"].includes(e)?10:void 0),d=o??(["top","bottom"].includes(e)?"95vh":void 0);return{...s?{minWidth:s}:{},...a?{maxWidth:a}:{},...c?{minHeight:c}:{},...d?{maxHeight:d}:{}}},ba="0.75rem",Wf="1rem",pu="5px",jH=({isResizable:e,direction:t})=>{const n=`calc((2 * ${ba} + ${pu}) / -2)`;return t==="top"?{containerStyles:{borderBottomWidth:pu,paddingBottom:Wf},handleStyles:e?{top:{paddingTop:ba,paddingBottom:ba,bottom:n}}:{}}:t==="left"?{containerStyles:{borderInlineEndWidth:pu,paddingInlineEnd:Wf},handleStyles:e?{right:{paddingInlineStart:ba,paddingInlineEnd:ba,insetInlineEnd:n}}:{}}:t==="bottom"?{containerStyles:{borderTopWidth:pu,paddingTop:Wf},handleStyles:e?{bottom:{paddingTop:ba,paddingBottom:ba,top:n}}:{}}:t==="right"?{containerStyles:{borderInlineStartWidth:pu,paddingInlineStart:Wf},handleStyles:e?{left:{paddingInlineStart:ba,paddingInlineEnd:ba,insetInlineStart:n}}:{}}:{containerStyles:{},handleStyles:{}}},IH=(e,t)=>["top","bottom"].includes(e)?e:e==="left"?t==="rtl"?"right":"left":e==="right"?t==="rtl"?"left":"right":"left",Be=(e,t)=>n=>n==="light"?e:t,EH=je(kH,{shouldForwardProp:e=>!["sx"].includes(e)}),c6=({direction:e="left",isResizable:t,isOpen:n,onClose:r,children:o,initialWidth:s,minWidth:a,maxWidth:c,initialHeight:d,minHeight:p,maxHeight:h,onResizeStart:m,onResizeStop:v,onResize:b,sx:w={}})=>{const y=Mc().direction,{colorMode:S}=Ds(),k=f.useRef(null),_=f.useMemo(()=>s??a??(["left","right"].includes(e)?"auto":"100%"),[s,a,e]),I=f.useMemo(()=>d??p??(["top","bottom"].includes(e)?"auto":"100%"),[d,p,e]),[P,E]=f.useState(_),[O,R]=f.useState(I);CN({ref:k,handler:()=>{r()},enabled:n});const M=f.useMemo(()=>t?_H({direction:e,langDirection:y}):{},[t,y,e]),T=f.useMemo(()=>PH({direction:e,minWidth:a,maxWidth:c,minHeight:p,maxHeight:h}),[a,c,p,h,e]),{containerStyles:A,handleStyles:$}=f.useMemo(()=>jH({isResizable:t,direction:e}),[t,e]),Q=f.useMemo(()=>IH(e,y),[e,y]);return f.useEffect(()=>{["left","right"].includes(e)&&R("100vh"),["top","bottom"].includes(e)&&E("100vw")},[e]),i.jsx($3,{direction:Q,in:n,motionProps:{initial:!1},style:{width:"full"},children:i.jsx(Re,{ref:k,sx:{width:"full",height:"full"},children:i.jsx(EH,{size:{width:t?P:_,height:t?O:I},enable:M,handleStyles:$,...T,sx:{borderColor:Be("base.200","base.800")(S),p:4,bg:Be("base.50","base.900")(S),height:"full",shadow:n?"dark-lg":void 0,...A,...w},onResizeStart:(B,V,q)=>{m&&m(B,V,q)},onResize:(B,V,q,G)=>{b&&b(B,V,q,G)},onResizeStop:(B,V,q,G)=>{["left","right"].includes(V)&&E(Number(P)+G.width),["top","bottom"].includes(V)&&R(Number(O)+G.height),v&&v(B,V,q,G)},children:o})})})},OH=Te((e,t)=>{const{children:n,tooltip:r="",tooltipProps:{placement:o="top",hasArrow:s=!0,...a}={},isChecked:c,...d}=e;return i.jsx(wn,{label:r,placement:o,hasArrow:s,...a,children:i.jsx(gc,{ref:t,colorScheme:c?"accent":"base",...d,children:n})})}),rn=f.memo(OH);var u6={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},SS=F.createContext&&F.createContext(u6),fi=globalThis&&globalThis.__assign||function(){return fi=Object.assign||function(e){for(var t,n=1,r=arguments.length;nt(e[n],n,e));return e}function ro(e,t){const n=Ii(t);if(Rs(t)||n){let o=n?"":{};if(e){const s=window.getComputedStyle(e,null);o=n?jS(e,s,t):t.reduce((a,c)=>(a[c]=jS(e,s,c),a),o)}return o}e&&_n(Bo(t),o=>MW(e,o,t[o]))}const xs=(e,t)=>{const{o:n,u:r,_:o}=e;let s=n,a;const c=(h,m)=>{const v=s,b=h,w=m||(r?!r(v,b):v!==b);return(w||o)&&(s=b,a=v),[s,w,a]};return[t?h=>c(t(s,a),h):c,h=>[s,!!h,a]]},Md=()=>typeof window<"u",_6=Md()&&Node.ELEMENT_NODE,{toString:vW,hasOwnProperty:D0}=Object.prototype,Ha=e=>e===void 0,Pm=e=>e===null,bW=e=>Ha(e)||Pm(e)?`${e}`:vW.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase(),pi=e=>typeof e=="number",Ii=e=>typeof e=="string",Vb=e=>typeof e=="boolean",Os=e=>typeof e=="function",Rs=e=>Array.isArray(e),td=e=>typeof e=="object"&&!Rs(e)&&!Pm(e),jm=e=>{const t=!!e&&e.length,n=pi(t)&&t>-1&&t%1==0;return Rs(e)||!Os(e)&&n?t>0&&td(e)?t-1 in e:!0:!1},Qv=e=>{if(!e||!td(e)||bW(e)!=="object")return!1;let t;const n="constructor",r=e[n],o=r&&r.prototype,s=D0.call(e,n),a=o&&D0.call(o,"isPrototypeOf");if(r&&!s&&!a)return!1;for(t in e);return Ha(t)||D0.call(e,t)},Qp=e=>{const t=HTMLElement;return e?t?e instanceof t:e.nodeType===_6:!1},Im=e=>{const t=Element;return e?t?e instanceof t:e.nodeType===_6:!1},Ub=(e,t,n)=>e.indexOf(t,n),Mn=(e,t,n)=>(!n&&!Ii(t)&&jm(t)?Array.prototype.push.apply(e,t):e.push(t),e),il=e=>{const t=Array.from,n=[];return t&&e?t(e):(e instanceof Set?e.forEach(r=>{Mn(n,r)}):_n(e,r=>{Mn(n,r)}),n)},Gb=e=>!!e&&e.length===0,ca=(e,t,n)=>{_n(e,o=>o&&o.apply(void 0,t||[])),!n&&(e.length=0)},Em=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Bo=e=>e?Object.keys(e):[],hr=(e,t,n,r,o,s,a)=>{const c=[t,n,r,o,s,a];return(typeof e!="object"||Pm(e))&&!Os(e)&&(e={}),_n(c,d=>{_n(Bo(d),p=>{const h=d[p];if(e===h)return!0;const m=Rs(h);if(h&&(Qv(h)||m)){const v=e[p];let b=v;m&&!Rs(v)?b=[]:!m&&!Qv(v)&&(b={}),e[p]=hr(b,h)}else e[p]=h})}),e},qb=e=>{for(const t in e)return!1;return!0},P6=(e,t,n,r)=>{if(Ha(r))return n?n[e]:t;n&&(Ii(r)||pi(r))&&(n[e]=r)},to=(e,t,n)=>{if(Ha(n))return e?e.getAttribute(t):null;e&&e.setAttribute(t,n)},wo=(e,t)=>{e&&e.removeAttribute(t)},Xi=(e,t,n,r)=>{if(n){const o=to(e,t)||"",s=new Set(o.split(" "));s[r?"add":"delete"](n);const a=il(s).join(" ").trim();to(e,t,a)}},yW=(e,t,n)=>{const r=to(e,t)||"";return new Set(r.split(" ")).has(n)},_s=(e,t)=>P6("scrollLeft",0,e,t),ka=(e,t)=>P6("scrollTop",0,e,t),Xv=Md()&&Element.prototype,j6=(e,t)=>{const n=[],r=t?Im(t)?t:null:document;return r?Mn(n,r.querySelectorAll(e)):n},xW=(e,t)=>{const n=t?Im(t)?t:null:document;return n?n.querySelector(e):null},Xp=(e,t)=>Im(e)?(Xv.matches||Xv.msMatchesSelector).call(e,t):!1,Kb=e=>e?il(e.childNodes):[],Aa=e=>e?e.parentElement:null,Yl=(e,t)=>{if(Im(e)){const n=Xv.closest;if(n)return n.call(e,t);do{if(Xp(e,t))return e;e=Aa(e)}while(e)}return null},wW=(e,t,n)=>{const r=e&&Yl(e,t),o=e&&xW(n,r),s=Yl(o,t)===r;return r&&o?r===e||o===e||s&&Yl(Yl(e,n),t)!==r:!1},Yb=(e,t,n)=>{if(n&&e){let r=t,o;jm(n)?(o=document.createDocumentFragment(),_n(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)}},ts=(e,t)=>{Yb(e,null,t)},SW=(e,t)=>{Yb(Aa(e),e,t)},kS=(e,t)=>{Yb(Aa(e),e&&e.nextSibling,t)},oa=e=>{if(jm(e))_n(il(e),t=>oa(t));else if(e){const t=Aa(e);t&&t.removeChild(e)}},Ji=e=>{const t=document.createElement("div");return e&&to(t,"class",e),t},I6=e=>{const t=Ji();return t.innerHTML=e.trim(),_n(Kb(t),n=>oa(n))},Jv=e=>e.charAt(0).toUpperCase()+e.slice(1),CW=()=>Ji().style,kW=["-webkit-","-moz-","-o-","-ms-"],_W=["WebKit","Moz","O","MS","webkit","moz","o","ms"],T0={},A0={},PW=e=>{let t=A0[e];if(Em(A0,e))return t;const n=Jv(e),r=CW();return _n(kW,o=>{const s=o.replace(/-/g,"");return!(t=[e,o+e,s+n,Jv(s)+n].find(c=>r[c]!==void 0))}),A0[e]=t||""},Dd=e=>{if(Md()){let t=T0[e]||window[e];return Em(T0,e)||(_n(_W,n=>(t=t||window[n+Jv(e)],!t)),T0[e]=t),t}},jW=Dd("MutationObserver"),_S=Dd("IntersectionObserver"),Ql=Dd("ResizeObserver"),E6=Dd("cancelAnimationFrame"),O6=Dd("requestAnimationFrame"),Jp=Md()&&window.setTimeout,Zv=Md()&&window.clearTimeout,IW=/[^\x20\t\r\n\f]+/g,R6=(e,t,n)=>{const r=e&&e.classList;let o,s=0,a=!1;if(r&&t&&Ii(t)){const c=t.match(IW)||[];for(a=c.length>0;o=c[s++];)a=!!n(r,o)&&a}return a},Qb=(e,t)=>{R6(e,t,(n,r)=>n.remove(r))},_a=(e,t)=>(R6(e,t,(n,r)=>n.add(r)),Qb.bind(0,e,t)),Om=(e,t,n,r)=>{if(e&&t){let o=!0;return _n(n,s=>{const a=r?r(e[s]):e[s],c=r?r(t[s]):t[s];a!==c&&(o=!1)}),o}return!1},M6=(e,t)=>Om(e,t,["w","h"]),D6=(e,t)=>Om(e,t,["x","y"]),EW=(e,t)=>Om(e,t,["t","r","b","l"]),PS=(e,t,n)=>Om(e,t,["width","height"],n&&(r=>Math.round(r))),es=()=>{},Ul=e=>{let t;const n=e?Jp:O6,r=e?Zv:E6;return[o=>{r(t),t=n(o,Os(e)?e():e)},()=>r(t)]},Xb=(e,t)=>{let n,r,o,s=es;const{v:a,g:c,p:d}=t||{},p=function(w){s(),Zv(n),n=r=void 0,s=es,e.apply(this,w)},h=b=>d&&r?d(r,b):b,m=()=>{s!==es&&p(h(o)||o)},v=function(){const w=il(arguments),y=Os(a)?a():a;if(pi(y)&&y>=0){const k=Os(c)?c():c,_=pi(k)&&k>=0,I=y>0?Jp:O6,P=y>0?Zv:E6,O=h(w)||w,R=p.bind(0,O);s();const M=I(R,y);s=()=>P(M),_&&!n&&(n=Jp(m,k)),r=o=O}else p(w)};return v.m=m,v},OW={opacity:1,zindex:1},Vf=(e,t)=>{const n=t?parseFloat(e):parseInt(e,10);return n===n?n:0},RW=(e,t)=>!OW[e.toLowerCase()]&&pi(t)?`${t}px`:t,jS=(e,t,n)=>t!=null?t[n]||t.getPropertyValue(n):e.style[n],MW=(e,t,n)=>{try{const{style:r}=e;Ha(r[t])?r.setProperty(t,n):r[t]=RW(t,n)}catch{}},nd=e=>ro(e,"direction")==="rtl",IS=(e,t,n)=>{const r=t?`${t}-`:"",o=n?`-${n}`:"",s=`${r}top${o}`,a=`${r}right${o}`,c=`${r}bottom${o}`,d=`${r}left${o}`,p=ro(e,[s,a,c,d]);return{t:Vf(p[s],!0),r:Vf(p[a],!0),b:Vf(p[c],!0),l:Vf(p[d],!0)}},{round:ES}=Math,Jb={w:0,h:0},rd=e=>e?{w:e.offsetWidth,h:e.offsetHeight}:Jb,Pp=e=>e?{w:e.clientWidth,h:e.clientHeight}:Jb,Zp=e=>e?{w:e.scrollWidth,h:e.scrollHeight}:Jb,eh=e=>{const t=parseFloat(ro(e,"height"))||0,n=parseFloat(ro(e,"width"))||0;return{w:n-ES(n),h:t-ES(t)}},Zs=e=>e.getBoundingClientRect();let Uf;const DW=()=>{if(Ha(Uf)){Uf=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get(){Uf=!0}}))}catch{}}return Uf},T6=e=>e.split(" "),TW=(e,t,n,r)=>{_n(T6(t),o=>{e.removeEventListener(o,n,r)})},Dr=(e,t,n,r)=>{var o;const s=DW(),a=(o=s&&r&&r.S)!=null?o:s,c=r&&r.$||!1,d=r&&r.C||!1,p=[],h=s?{passive:a,capture:c}:c;return _n(T6(t),m=>{const v=d?b=>{e.removeEventListener(m,v,c),n&&n(b)}:n;Mn(p,TW.bind(null,e,m,v,c)),e.addEventListener(m,v,h)}),ca.bind(0,p)},A6=e=>e.stopPropagation(),N6=e=>e.preventDefault(),AW={x:0,y:0},N0=e=>{const t=e?Zs(e):0;return t?{x:t.left+window.pageYOffset,y:t.top+window.pageXOffset}:AW},OS=(e,t)=>{_n(Rs(t)?t:[t],e)},Zb=e=>{const t=new Map,n=(s,a)=>{if(s){const c=t.get(s);OS(d=>{c&&c[d?"delete":"clear"](d)},a)}else t.forEach(c=>{c.clear()}),t.clear()},r=(s,a)=>{if(Ii(s)){const p=t.get(s)||new Set;return t.set(s,p),OS(h=>{Os(h)&&p.add(h)},a),n.bind(0,s,a)}Vb(a)&&a&&n();const c=Bo(s),d=[];return _n(c,p=>{const h=s[p];h&&Mn(d,r(p,h))}),ca.bind(0,d)},o=(s,a)=>{const c=t.get(s);_n(il(c),d=>{a&&!Gb(a)?d.apply(0,a):d()})};return r(e||{}),[r,n,o]},RS=e=>JSON.stringify(e,(t,n)=>{if(Os(n))throw new Error;return n}),NW={paddingAbsolute:!1,showNativeOverlaidScrollbars:!1,update:{elementEvents:[["img","load"]],debounce:[0,33],attributes:null,ignoreMutation:null},overflow:{x:"scroll",y:"scroll"},scrollbars:{theme:"os-theme-dark",visibility:"auto",autoHide:"never",autoHideDelay:1300,dragScroll:!0,clickScroll:!1,pointers:["mouse","touch","pen"]}},$6=(e,t)=>{const n={},r=Bo(t).concat(Bo(e));return _n(r,o=>{const s=e[o],a=t[o];if(td(s)&&td(a))hr(n[o]={},$6(s,a)),qb(n[o])&&delete n[o];else if(Em(t,o)&&a!==s){let c=!0;if(Rs(s)||Rs(a))try{RS(s)===RS(a)&&(c=!1)}catch{}c&&(n[o]=a)}}),n},z6="os-environment",L6=`${z6}-flexbox-glue`,$W=`${L6}-max`,B6="os-scrollbar-hidden",$0="data-overlayscrollbars-initialize",ws="data-overlayscrollbars",F6=`${ws}-overflow-x`,H6=`${ws}-overflow-y`,cc="overflowVisible",zW="scrollbarHidden",MS="scrollbarPressed",th="updating",oi="data-overlayscrollbars-viewport",z0="arrange",W6="scrollbarHidden",uc=cc,e1="data-overlayscrollbars-padding",LW=uc,DS="data-overlayscrollbars-content",ey="os-size-observer",BW=`${ey}-appear`,FW=`${ey}-listener`,HW="os-trinsic-observer",WW="os-no-css-vars",VW="os-theme-none",Io="os-scrollbar",UW=`${Io}-rtl`,GW=`${Io}-horizontal`,qW=`${Io}-vertical`,V6=`${Io}-track`,ty=`${Io}-handle`,KW=`${Io}-visible`,YW=`${Io}-cornerless`,TS=`${Io}-transitionless`,AS=`${Io}-interaction`,NS=`${Io}-unusable`,$S=`${Io}-auto-hidden`,zS=`${Io}-wheel`,QW=`${V6}-interactive`,XW=`${ty}-interactive`,U6={},ll=()=>U6,JW=e=>{const t=[];return _n(Rs(e)?e:[e],n=>{const r=Bo(n);_n(r,o=>{Mn(t,U6[o]=n[o])})}),t},ZW="__osOptionsValidationPlugin",eV="__osSizeObserverPlugin",ny="__osScrollbarsHidingPlugin",tV="__osClickScrollPlugin";let L0;const LS=(e,t,n,r)=>{ts(e,t);const o=Pp(t),s=rd(t),a=eh(n);return r&&oa(t),{x:s.h-o.h+a.h,y:s.w-o.w+a.w}},nV=e=>{let t=!1;const n=_a(e,B6);try{t=ro(e,PW("scrollbar-width"))==="none"||window.getComputedStyle(e,"::-webkit-scrollbar").getPropertyValue("display")==="none"}catch{}return n(),t},rV=(e,t)=>{const n="hidden";ro(e,{overflowX:n,overflowY:n,direction:"rtl"}),_s(e,0);const r=N0(e),o=N0(t);_s(e,-999);const s=N0(t);return{i:r.x===o.x,n:o.x!==s.x}},oV=(e,t)=>{const n=_a(e,L6),r=Zs(e),o=Zs(t),s=PS(o,r,!0),a=_a(e,$W),c=Zs(e),d=Zs(t),p=PS(d,c,!0);return n(),a(),s&&p},sV=()=>{const{body:e}=document,n=I6(`
`)[0],r=n.firstChild,[o,,s]=Zb(),[a,c]=xs({o:LS(e,n,r),u:D6},LS.bind(0,e,n,r,!0)),[d]=c(),p=nV(n),h={x:d.x===0,y:d.y===0},m={elements:{host:null,padding:!p,viewport:_=>p&&_===_.ownerDocument.body&&_,content:!1},scrollbars:{slot:!0},cancel:{nativeScrollbarsOverlaid:!1,body:null}},v=hr({},NW),b=hr.bind(0,{},v),w=hr.bind(0,{},m),y={k:d,A:h,I:p,L:ro(n,"zIndex")==="-1",B:rV(n,r),V:oV(n,r),Y:o.bind(0,"z"),j:o.bind(0,"r"),N:w,q:_=>hr(m,_)&&w(),F:b,G:_=>hr(v,_)&&b(),X:hr({},m),U:hr({},v)},S=window.addEventListener,k=Xb(_=>s(_?"z":"r"),{v:33,g:99});if(wo(n,"style"),oa(n),S("resize",k.bind(0,!1)),!p&&(!h.x||!h.y)){let _;S("resize",()=>{const I=ll()[ny];_=_||I&&I.R(),_&&_(y,a,k.bind(0,!0))})}return y},Eo=()=>(L0||(L0=sV()),L0),ry=(e,t)=>Os(t)?t.apply(0,e):t,aV=(e,t,n,r)=>{const o=Ha(r)?n:r;return ry(e,o)||t.apply(0,e)},G6=(e,t,n,r)=>{const o=Ha(r)?n:r,s=ry(e,o);return!!s&&(Qp(s)?s:t.apply(0,e))},iV=(e,t,n)=>{const{nativeScrollbarsOverlaid:r,body:o}=n||{},{A:s,I:a}=Eo(),{nativeScrollbarsOverlaid:c,body:d}=t,p=r??c,h=Ha(o)?d:o,m=(s.x||s.y)&&p,v=e&&(Pm(h)?!a:h);return!!m||!!v},oy=new WeakMap,lV=(e,t)=>{oy.set(e,t)},cV=e=>{oy.delete(e)},q6=e=>oy.get(e),BS=(e,t)=>e?t.split(".").reduce((n,r)=>n&&Em(n,r)?n[r]:void 0,e):void 0,t1=(e,t,n)=>r=>[BS(e,r),n||BS(t,r)!==void 0],K6=e=>{let t=e;return[()=>t,n=>{t=hr({},t,n)}]},Gf="tabindex",qf=Ji.bind(0,""),B0=e=>{ts(Aa(e),Kb(e)),oa(e)},uV=e=>{const t=Eo(),{N:n,I:r}=t,o=ll()[ny],s=o&&o.T,{elements:a}=n(),{host:c,padding:d,viewport:p,content:h}=a,m=Qp(e),v=m?{}:e,{elements:b}=v,{host:w,padding:y,viewport:S,content:k}=b||{},_=m?e:v.target,I=Xp(_,"textarea"),P=_.ownerDocument,E=P.documentElement,O=_===P.body,R=P.defaultView,M=aV.bind(0,[_]),T=G6.bind(0,[_]),A=ry.bind(0,[_]),$=M.bind(0,qf,p),Q=T.bind(0,qf,h),B=$(S),V=B===_,q=V&&O,G=!V&&Q(k),D=!V&&Qp(B)&&B===G,z=D&&!!A(h),H=z?$():B,Y=z?G:Q(),ye=q?E:D?H:B,Z=I?M(qf,c,w):_,oe=q?ye:Z,K=D?Y:G,U=P.activeElement,ae=!V&&R.top===R&&U===_,re={W:_,Z:oe,J:ye,K:!V&&T(qf,d,y),tt:K,nt:!V&&!r&&s&&s(t),ot:q?E:ye,st:q?P:ye,et:R,ct:P,rt:I,it:O,lt:m,ut:V,dt:D,ft:(vt,bt)=>yW(ye,V?ws:oi,V?bt:vt),_t:(vt,bt,Se)=>Xi(ye,V?ws:oi,V?bt:vt,Se)},se=Bo(re).reduce((vt,bt)=>{const Se=re[bt];return Mn(vt,Se&&!Aa(Se)?Se:!1)},[]),pe=vt=>vt?Ub(se,vt)>-1:null,{W:le,Z:ge,K:ke,J:xe,tt:de,nt:Ae}=re,Ee=[()=>{wo(ge,ws),wo(ge,$0),wo(le,$0),O&&(wo(E,ws),wo(E,$0))}],$e=I&&pe(ge);let kt=I?le:Kb([de,xe,ke,ge,le].find(vt=>pe(vt)===!1));const ct=q?le:de||xe;return[re,()=>{to(ge,ws,V?"viewport":"host"),to(ke,e1,""),to(de,DS,""),V||to(xe,oi,"");const vt=O&&!V?_a(Aa(_),B6):es;if($e&&(kS(le,ge),Mn(Ee,()=>{kS(ge,le),oa(ge)})),ts(ct,kt),ts(ge,ke),ts(ke||ge,!V&&xe),ts(xe,de),Mn(Ee,()=>{vt(),wo(ke,e1),wo(de,DS),wo(xe,F6),wo(xe,H6),wo(xe,oi),pe(de)&&B0(de),pe(xe)&&B0(xe),pe(ke)&&B0(ke)}),r&&!V&&(Xi(xe,oi,W6,!0),Mn(Ee,wo.bind(0,xe,oi))),Ae&&(SW(xe,Ae),Mn(Ee,oa.bind(0,Ae))),ae){const bt=to(xe,Gf);to(xe,Gf,"-1"),xe.focus();const Se=()=>bt?to(xe,Gf,bt):wo(xe,Gf),Me=Dr(P,"pointerdown keydown",()=>{Se(),Me()});Mn(Ee,[Se,Me])}else U&&U.focus&&U.focus();kt=0},ca.bind(0,Ee)]},dV=(e,t)=>{const{tt:n}=e,[r]=t;return o=>{const{V:s}=Eo(),{ht:a}=r(),{vt:c}=o,d=(n||!s)&&c;return d&&ro(n,{height:a?"":"100%"}),{gt:d,wt:d}}},fV=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:a,ut:c}=e,[d,p]=xs({u:EW,o:IS()},IS.bind(0,o,"padding",""));return(h,m,v)=>{let[b,w]=p(v);const{I:y,V:S}=Eo(),{bt:k}=n(),{gt:_,wt:I,yt:P}=h,[E,O]=m("paddingAbsolute");(_||w||!S&&I)&&([b,w]=d(v));const M=!c&&(O||P||w);if(M){const T=!E||!s&&!y,A=b.r+b.l,$=b.t+b.b,Q={marginRight:T&&!k?-A:0,marginBottom:T?-$:0,marginLeft:T&&k?-A:0,top:T?-b.t:0,right:T?k?-b.r:"auto":0,left:T?k?"auto":-b.l:0,width:T?`calc(100% + ${A}px)`:""},B={paddingTop:T?b.t:0,paddingRight:T?b.r:0,paddingBottom:T?b.b:0,paddingLeft:T?b.l:0};ro(s||a,Q),ro(a,B),r({K:b,St:!T,P:s?B:hr({},Q,B)})}return{xt:M}}},{max:n1}=Math,si=n1.bind(0,0),Y6="visible",FS="hidden",pV=42,Kf={u:M6,o:{w:0,h:0}},hV={u:D6,o:{x:FS,y:FS}},mV=(e,t)=>{const n=window.devicePixelRatio%1!==0?1:0,r={w:si(e.w-t.w),h:si(e.h-t.h)};return{w:r.w>n?r.w:0,h:r.h>n?r.h:0}},Yf=e=>e.indexOf(Y6)===0,gV=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:a,nt:c,ut:d,_t:p,it:h,et:m}=e,{k:v,V:b,I:w,A:y}=Eo(),S=ll()[ny],k=!d&&!w&&(y.x||y.y),_=h&&d,[I,P]=xs(Kf,eh.bind(0,a)),[E,O]=xs(Kf,Zp.bind(0,a)),[R,M]=xs(Kf),[T,A]=xs(Kf),[$]=xs(hV),Q=(z,H)=>{if(ro(a,{height:""}),H){const{St:Y,K:ie}=n(),{$t:ye,D:Z}=z,oe=eh(o),K=Pp(o),U=ro(a,"boxSizing")==="content-box",ae=Y||U?ie.b+ie.t:0,re=!(y.x&&U);ro(a,{height:K.h+oe.h+(ye.x&&re?Z.x:0)-ae})}},B=(z,H)=>{const Y=!w&&!z?pV:0,ie=(pe,le,ge)=>{const ke=ro(a,pe),de=(H?H[pe]:ke)==="scroll";return[ke,de,de&&!w?le?Y:ge:0,le&&!!Y]},[ye,Z,oe,K]=ie("overflowX",y.x,v.x),[U,ae,re,se]=ie("overflowY",y.y,v.y);return{Ct:{x:ye,y:U},$t:{x:Z,y:ae},D:{x:oe,y:re},M:{x:K,y:se}}},V=(z,H,Y,ie)=>{const ye=(ae,re)=>{const se=Yf(ae),pe=re&&se&&ae.replace(`${Y6}-`,"")||"";return[re&&!se?ae:"",Yf(pe)?"hidden":pe]},[Z,oe]=ye(Y.x,H.x),[K,U]=ye(Y.y,H.y);return ie.overflowX=oe&&K?oe:Z,ie.overflowY=U&&Z?U:K,B(z,ie)},q=(z,H,Y,ie)=>{const{D:ye,M:Z}=z,{x:oe,y:K}=Z,{x:U,y:ae}=ye,{P:re}=n(),se=H?"marginLeft":"marginRight",pe=H?"paddingLeft":"paddingRight",le=re[se],ge=re.marginBottom,ke=re[pe],xe=re.paddingBottom;ie.width=`calc(100% + ${ae+-1*le}px)`,ie[se]=-ae+le,ie.marginBottom=-U+ge,Y&&(ie[pe]=ke+(K?ae:0),ie.paddingBottom=xe+(oe?U:0))},[G,D]=S?S.H(k,b,a,c,n,B,q):[()=>k,()=>[es]];return(z,H,Y)=>{const{gt:ie,Ot:ye,wt:Z,xt:oe,vt:K,yt:U}=z,{ht:ae,bt:re}=n(),[se,pe]=H("showNativeOverlaidScrollbars"),[le,ge]=H("overflow"),ke=se&&y.x&&y.y,xe=!d&&!b&&(ie||Z||ye||pe||K),de=Yf(le.x),Ae=Yf(le.y),Ee=de||Ae;let $e=P(Y),kt=O(Y),ct=M(Y),on=A(Y),vt;if(pe&&w&&p(W6,zW,!ke),xe&&(vt=B(ke),Q(vt,ae)),ie||oe||Z||U||pe){Ee&&p(uc,cc,!1);const[Pe,Je]=D(ke,re,vt),[Qe,dt]=$e=I(Y),[Lt,cr]=kt=E(Y),pn=Pp(a);let ln=Lt,Fr=pn;Pe(),(cr||dt||pe)&&Je&&!ke&&G(Je,Lt,Qe,re)&&(Fr=Pp(a),ln=Zp(a));const br={w:si(n1(Lt.w,ln.w)+Qe.w),h:si(n1(Lt.h,ln.h)+Qe.h)},Fn={w:si((_?m.innerWidth:Fr.w+si(pn.w-Lt.w))+Qe.w),h:si((_?m.innerHeight+Qe.h:Fr.h+si(pn.h-Lt.h))+Qe.h)};on=T(Fn),ct=R(mV(br,Fn),Y)}const[bt,Se]=on,[Me,Pt]=ct,[At,we]=kt,[ht,$t]=$e,zt={x:Me.w>0,y:Me.h>0},ze=de&&Ae&&(zt.x||zt.y)||de&&zt.x&&!zt.y||Ae&&zt.y&&!zt.x;if(oe||U||$t||we||Se||Pt||ge||pe||xe){const Pe={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},Je=V(ke,zt,le,Pe),Qe=G(Je,At,ht,re);d||q(Je,re,Qe,Pe),xe&&Q(Je,ae),d?(to(o,F6,Pe.overflowX),to(o,H6,Pe.overflowY)):ro(a,Pe)}Xi(o,ws,cc,ze),Xi(s,e1,LW,ze),d||Xi(a,oi,uc,Ee);const[qe,Pn]=$(B(ke).Ct);return r({Ct:qe,zt:{x:bt.w,y:bt.h},Tt:{x:Me.w,y:Me.h},Et:zt}),{It:Pn,At:Se,Lt:Pt}}},HS=(e,t,n)=>{const r={},o=t||{},s=Bo(e).concat(Bo(o));return _n(s,a=>{const c=e[a],d=o[a];r[a]=!!(n||c||d)}),r},vV=(e,t)=>{const{W:n,J:r,_t:o,ut:s}=e,{I:a,A:c,V:d}=Eo(),p=!a&&(c.x||c.y),h=[dV(e,t),fV(e,t),gV(e,t)];return(m,v,b)=>{const w=HS(hr({gt:!1,xt:!1,yt:!1,vt:!1,At:!1,Lt:!1,It:!1,Ot:!1,wt:!1},v),{},b),y=p||!d,S=y&&_s(r),k=y&&ka(r);o("",th,!0);let _=w;return _n(h,I=>{_=HS(_,I(_,m,!!b)||{},b)}),_s(r,S),ka(r,k),o("",th),s||(_s(n,0),ka(n,0)),_}},bV=(e,t,n)=>{let r,o=!1;const s=()=>{o=!0},a=c=>{if(n){const d=n.reduce((p,h)=>{if(h){const[m,v]=h,b=v&&m&&(c?c(m):j6(m,e));b&&b.length&&v&&Ii(v)&&Mn(p,[b,v.trim()],!0)}return p},[]);_n(d,p=>_n(p[0],h=>{const m=p[1],v=r.get(h)||[];if(e.contains(h)){const w=Dr(h,m,y=>{o?(w(),r.delete(h)):t(y)});r.set(h,Mn(v,w))}else ca(v),r.delete(h)}))}};return n&&(r=new WeakMap,a()),[s,a]},WS=(e,t,n,r)=>{let o=!1;const{Ht:s,Pt:a,Dt:c,Mt:d,Rt:p,kt:h}=r||{},m=Xb(()=>{o&&n(!0)},{v:33,g:99}),[v,b]=bV(e,m,c),w=s||[],y=a||[],S=w.concat(y),k=(I,P)=>{const E=p||es,O=h||es,R=new Set,M=new Set;let T=!1,A=!1;if(_n(I,$=>{const{attributeName:Q,target:B,type:V,oldValue:q,addedNodes:G,removedNodes:D}=$,z=V==="attributes",H=V==="childList",Y=e===B,ie=z&&Ii(Q)?to(B,Q):0,ye=ie!==0&&q!==ie,Z=Ub(y,Q)>-1&&ye;if(t&&(H||!Y)){const oe=!z,K=z&&ye,U=K&&d&&Xp(B,d),re=(U?!E(B,Q,q,ie):oe||K)&&!O($,!!U,e,r);_n(G,se=>R.add(se)),_n(D,se=>R.add(se)),A=A||re}!t&&Y&&ye&&!E(B,Q,q,ie)&&(M.add(Q),T=T||Z)}),R.size>0&&b($=>il(R).reduce((Q,B)=>(Mn(Q,j6($,B)),Xp(B,$)?Mn(Q,B):Q),[])),t)return!P&&A&&n(!1),[!1];if(M.size>0||T){const $=[il(M),T];return!P&&n.apply(0,$),$}},_=new jW(I=>k(I));return _.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:S,subtree:t,childList:t,characterData:t}),o=!0,[()=>{o&&(v(),_.disconnect(),o=!1)},()=>{if(o){m.m();const I=_.takeRecords();return!Gb(I)&&k(I,!0)}}]},Qf=3333333,Xf=e=>e&&(e.height||e.width),Q6=(e,t,n)=>{const{Bt:r=!1,Vt:o=!1}=n||{},s=ll()[eV],{B:a}=Eo(),d=I6(`
`)[0],p=d.firstChild,h=nd.bind(0,e),[m]=xs({o:void 0,_:!0,u:(y,S)=>!(!y||!Xf(y)&&Xf(S))}),v=y=>{const S=Rs(y)&&y.length>0&&td(y[0]),k=!S&&Vb(y[0]);let _=!1,I=!1,P=!0;if(S){const[E,,O]=m(y.pop().contentRect),R=Xf(E),M=Xf(O);_=!O||!R,I=!M&&R,P=!_}else k?[,P]=y:I=y===!0;if(r&&P){const E=k?y[0]:nd(d);_s(d,E?a.n?-Qf:a.i?0:Qf:Qf),ka(d,Qf)}_||t({gt:!k,Yt:k?y:void 0,Vt:!!I})},b=[];let w=o?v:!1;return[()=>{ca(b),oa(d)},()=>{if(Ql){const y=new Ql(v);y.observe(p),Mn(b,()=>{y.disconnect()})}else if(s){const[y,S]=s.O(p,v,o);w=y,Mn(b,S)}if(r){const[y]=xs({o:void 0},h);Mn(b,Dr(d,"scroll",S=>{const k=y(),[_,I,P]=k;I&&(Qb(p,"ltr rtl"),_?_a(p,"rtl"):_a(p,"ltr"),v([!!_,I,P])),A6(S)}))}w&&(_a(d,BW),Mn(b,Dr(d,"animationstart",w,{C:!!Ql}))),(Ql||s)&&ts(e,d)}]},yV=e=>e.h===0||e.isIntersecting||e.intersectionRatio>0,xV=(e,t)=>{let n;const r=Ji(HW),o=[],[s]=xs({o:!1}),a=(d,p)=>{if(d){const h=s(yV(d)),[,m]=h;if(m)return!p&&t(h),[h]}},c=(d,p)=>{if(d&&d.length>0)return a(d.pop(),p)};return[()=>{ca(o),oa(r)},()=>{if(_S)n=new _S(d=>c(d),{root:e}),n.observe(r),Mn(o,()=>{n.disconnect()});else{const d=()=>{const m=rd(r);a(m)},[p,h]=Q6(r,d);Mn(o,p),h(),d()}ts(e,r)},()=>{if(n)return c(n.takeRecords(),!0)}]},VS=`[${ws}]`,wV=`[${oi}]`,F0=["tabindex"],US=["wrap","cols","rows"],H0=["id","class","style","open"],SV=(e,t,n)=>{let r,o,s;const{Z:a,J:c,tt:d,rt:p,ut:h,ft:m,_t:v}=e,{V:b}=Eo(),[w]=xs({u:M6,o:{w:0,h:0}},()=>{const V=m(uc,cc),q=m(z0,""),G=q&&_s(c),D=q&&ka(c);v(uc,cc),v(z0,""),v("",th,!0);const z=Zp(d),H=Zp(c),Y=eh(c);return v(uc,cc,V),v(z0,"",q),v("",th),_s(c,G),ka(c,D),{w:H.w+z.w+Y.w,h:H.h+z.h+Y.h}}),y=p?US:H0.concat(US),S=Xb(n,{v:()=>r,g:()=>o,p(V,q){const[G]=V,[D]=q;return[Bo(G).concat(Bo(D)).reduce((z,H)=>(z[H]=G[H]||D[H],z),{})]}}),k=V=>{_n(V||F0,q=>{if(Ub(F0,q)>-1){const G=to(a,q);Ii(G)?to(c,q,G):wo(c,q)}})},_=(V,q)=>{const[G,D]=V,z={vt:D};return t({ht:G}),!q&&n(z),z},I=({gt:V,Yt:q,Vt:G})=>{const D=!V||G?n:S;let z=!1;if(q){const[H,Y]=q;z=Y,t({bt:H})}D({gt:V,yt:z})},P=(V,q)=>{const[,G]=w(),D={wt:G};return G&&!q&&(V?n:S)(D),D},E=(V,q,G)=>{const D={Ot:q};return q?!G&&S(D):h||k(V),D},[O,R,M]=d||!b?xV(a,_):[es,es,es],[T,A]=h?[es,es]:Q6(a,I,{Vt:!0,Bt:!0}),[$,Q]=WS(a,!1,E,{Pt:H0,Ht:H0.concat(F0)}),B=h&&Ql&&new Ql(I.bind(0,{gt:!0}));return B&&B.observe(a),k(),[()=>{O(),T(),s&&s[0](),B&&B.disconnect(),$()},()=>{A(),R()},()=>{const V={},q=Q(),G=M(),D=s&&s[1]();return q&&hr(V,E.apply(0,Mn(q,!0))),G&&hr(V,_.apply(0,Mn(G,!0))),D&&hr(V,P.apply(0,Mn(D,!0))),V},V=>{const[q]=V("update.ignoreMutation"),[G,D]=V("update.attributes"),[z,H]=V("update.elementEvents"),[Y,ie]=V("update.debounce"),ye=H||D,Z=oe=>Os(q)&&q(oe);if(ye&&(s&&(s[1](),s[0]()),s=WS(d||c,!0,P,{Ht:y.concat(G||[]),Dt:z,Mt:VS,kt:(oe,K)=>{const{target:U,attributeName:ae}=oe;return(!K&&ae&&!h?wW(U,VS,wV):!1)||!!Yl(U,`.${Io}`)||!!Z(oe)}})),ie)if(S.m(),Rs(Y)){const oe=Y[0],K=Y[1];r=pi(oe)&&oe,o=pi(K)&&K}else pi(Y)?(r=Y,o=!1):(r=!1,o=!1)}]},GS={x:0,y:0},CV=e=>({K:{t:0,r:0,b:0,l:0},St:!1,P:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0},zt:GS,Tt:GS,Ct:{x:"hidden",y:"hidden"},Et:{x:!1,y:!1},ht:!1,bt:nd(e.Z)}),kV=(e,t)=>{const n=t1(t,{}),[r,o,s]=Zb(),[a,c,d]=uV(e),p=K6(CV(a)),[h,m]=p,v=vV(a,p),b=(I,P,E)=>{const R=Bo(I).some(M=>I[M])||!qb(P)||E;return R&&s("u",[I,P,E]),R},[w,y,S,k]=SV(a,m,I=>b(v(n,I),{},!1)),_=h.bind(0);return _.jt=I=>r("u",I),_.Nt=()=>{const{W:I,J:P}=a,E=_s(I),O=ka(I);y(),c(),_s(P,E),ka(P,O)},_.qt=a,[(I,P)=>{const E=t1(t,I,P);return k(E),b(v(E,S(),P),I,!!P)},_,()=>{o(),w(),d()}]},{round:qS}=Math,_V=e=>{const{width:t,height:n}=Zs(e),{w:r,h:o}=rd(e);return{x:qS(t)/r||1,y:qS(n)/o||1}},PV=(e,t,n)=>{const r=t.scrollbars,{button:o,isPrimary:s,pointerType:a}=e,{pointers:c}=r;return o===0&&s&&r[n?"dragScroll":"clickScroll"]&&(c||[]).includes(a)},jV=(e,t)=>Dr(e,"mousedown",Dr.bind(0,t,"click",A6,{C:!0,$:!0}),{$:!0}),KS="pointerup pointerleave pointercancel lostpointercapture",IV=(e,t,n,r,o,s,a)=>{const{B:c}=Eo(),{Ft:d,Gt:p,Xt:h}=r,m=`scroll${a?"Left":"Top"}`,v=`client${a?"X":"Y"}`,b=a?"width":"height",w=a?"left":"top",y=a?"w":"h",S=a?"x":"y",k=(_,I)=>P=>{const{Tt:E}=s(),O=rd(p)[y]-rd(d)[y],M=I*P/O*E[S],A=nd(h)&&a?c.n||c.i?1:-1:1;o[m]=_+M*A};return Dr(p,"pointerdown",_=>{const I=Yl(_.target,`.${ty}`)===d,P=I?d:p;if(Xi(t,ws,MS,!0),PV(_,e,I)){const E=!I&&_.shiftKey,O=()=>Zs(d),R=()=>Zs(p),M=(H,Y)=>(H||O())[w]-(Y||R())[w],T=k(o[m]||0,1/_V(o)[S]),A=_[v],$=O(),Q=R(),B=$[b],V=M($,Q)+B/2,q=A-Q[w],G=I?0:q-V,D=H=>{ca(z),P.releasePointerCapture(H.pointerId)},z=[Xi.bind(0,t,ws,MS),Dr(n,KS,D),Dr(n,"selectstart",H=>N6(H),{S:!1}),Dr(p,KS,D),Dr(p,"pointermove",H=>{const Y=H[v]-A;(I||E)&&T(G+Y)})];if(E)T(G);else if(!I){const H=ll()[tV];H&&Mn(z,H.O(T,M,G,B,q))}P.setPointerCapture(_.pointerId)}})},EV=(e,t)=>(n,r,o,s,a,c)=>{const{Xt:d}=n,[p,h]=Ul(333),m=!!a.scrollBy;let v=!0;return ca.bind(0,[Dr(d,"pointerenter",()=>{r(AS,!0)}),Dr(d,"pointerleave pointercancel",()=>{r(AS)}),Dr(d,"wheel",b=>{const{deltaX:w,deltaY:y,deltaMode:S}=b;m&&v&&S===0&&Aa(d)===s&&a.scrollBy({left:w,top:y,behavior:"smooth"}),v=!1,r(zS,!0),p(()=>{v=!0,r(zS)}),N6(b)},{S:!1,$:!0}),jV(d,o),IV(e,s,o,n,a,t,c),h])},{min:r1,max:YS,abs:OV,round:RV}=Math,X6=(e,t,n,r)=>{if(r){const c=n?"x":"y",{Tt:d,zt:p}=r,h=p[c],m=d[c];return YS(0,r1(1,h/(h+m)))}const o=n?"width":"height",s=Zs(e)[o],a=Zs(t)[o];return YS(0,r1(1,s/a))},MV=(e,t,n,r,o,s)=>{const{B:a}=Eo(),c=s?"x":"y",d=s?"Left":"Top",{Tt:p}=r,h=RV(p[c]),m=OV(n[`scroll${d}`]),v=s&&o,b=a.i?m:h-m,y=r1(1,(v?b:m)/h),S=X6(e,t,s);return 1/S*(1-S)*y},DV=(e,t,n)=>{const{N:r,L:o}=Eo(),{scrollbars:s}=r(),{slot:a}=s,{ct:c,W:d,Z:p,J:h,lt:m,ot:v,it:b,ut:w}=t,{scrollbars:y}=m?{}:e,{slot:S}=y||{},k=G6([d,p,h],()=>w&&b?d:p,a,S),_=(G,D,z)=>{const H=z?_a:Qb;_n(G,Y=>{H(Y.Xt,D)})},I=(G,D)=>{_n(G,z=>{const[H,Y]=D(z);ro(H,Y)})},P=(G,D,z)=>{I(G,H=>{const{Ft:Y,Gt:ie}=H;return[Y,{[z?"width":"height"]:`${(100*X6(Y,ie,z,D)).toFixed(3)}%`}]})},E=(G,D,z)=>{const H=z?"X":"Y";I(G,Y=>{const{Ft:ie,Gt:ye,Xt:Z}=Y,oe=MV(ie,ye,v,D,nd(Z),z);return[ie,{transform:oe===oe?`translate${H}(${(100*oe).toFixed(3)}%)`:""}]})},O=[],R=[],M=[],T=(G,D,z)=>{const H=Vb(z),Y=H?z:!0,ie=H?!z:!0;Y&&_(R,G,D),ie&&_(M,G,D)},A=G=>{P(R,G,!0),P(M,G)},$=G=>{E(R,G,!0),E(M,G)},Q=G=>{const D=G?GW:qW,z=G?R:M,H=Gb(z)?TS:"",Y=Ji(`${Io} ${D} ${H}`),ie=Ji(V6),ye=Ji(ty),Z={Xt:Y,Gt:ie,Ft:ye};return o||_a(Y,WW),ts(Y,ie),ts(ie,ye),Mn(z,Z),Mn(O,[oa.bind(0,Y),n(Z,T,c,p,v,G)]),Z},B=Q.bind(0,!0),V=Q.bind(0,!1),q=()=>{ts(k,R[0].Xt),ts(k,M[0].Xt),Jp(()=>{T(TS)},300)};return B(),V(),[{Ut:A,Wt:$,Zt:T,Jt:{Kt:R,Qt:B,tn:I.bind(0,R)},nn:{Kt:M,Qt:V,tn:I.bind(0,M)}},q,ca.bind(0,O)]},TV=(e,t,n,r)=>{let o,s,a,c,d,p=0;const h=K6({}),[m]=h,[v,b]=Ul(),[w,y]=Ul(),[S,k]=Ul(100),[_,I]=Ul(100),[P,E]=Ul(()=>p),[O,R,M]=DV(e,n.qt,EV(t,n)),{Z:T,J:A,ot:$,st:Q,ut:B,it:V}=n.qt,{Jt:q,nn:G,Zt:D,Ut:z,Wt:H}=O,{tn:Y}=q,{tn:ie}=G,ye=ae=>{const{Xt:re}=ae,se=B&&!V&&Aa(re)===A&&re;return[se,{transform:se?`translate(${_s($)}px, ${ka($)}px)`:""}]},Z=(ae,re)=>{if(E(),ae)D($S);else{const se=()=>D($S,!0);p>0&&!re?P(se):se()}},oe=()=>{c=s,c&&Z(!0)},K=[k,E,I,y,b,M,Dr(T,"pointerover",oe,{C:!0}),Dr(T,"pointerenter",oe),Dr(T,"pointerleave",()=>{c=!1,s&&Z(!1)}),Dr(T,"pointermove",()=>{o&&v(()=>{k(),Z(!0),_(()=>{o&&Z(!1)})})}),Dr(Q,"scroll",ae=>{w(()=>{H(n()),a&&Z(!0),S(()=>{a&&!c&&Z(!1)})}),r(ae),B&&Y(ye),B&&ie(ye)})],U=m.bind(0);return U.qt=O,U.Nt=R,[(ae,re,se)=>{const{At:pe,Lt:le,It:ge,yt:ke}=se,{A:xe}=Eo(),de=t1(t,ae,re),Ae=n(),{Tt:Ee,Ct:$e,bt:kt}=Ae,[ct,on]=de("showNativeOverlaidScrollbars"),[vt,bt]=de("scrollbars.theme"),[Se,Me]=de("scrollbars.visibility"),[Pt,At]=de("scrollbars.autoHide"),[we]=de("scrollbars.autoHideDelay"),[ht,$t]=de("scrollbars.dragScroll"),[zt,ze]=de("scrollbars.clickScroll"),qe=pe||le||ke,Pn=ge||Me,Pe=ct&&xe.x&&xe.y,Je=(Qe,dt)=>{const Lt=Se==="visible"||Se==="auto"&&Qe==="scroll";return D(KW,Lt,dt),Lt};if(p=we,on&&D(VW,Pe),bt&&(D(d),D(vt,!0),d=vt),At&&(o=Pt==="move",s=Pt==="leave",a=Pt!=="never",Z(!a,!0)),$t&&D(XW,ht),ze&&D(QW,zt),Pn){const Qe=Je($e.x,!0),dt=Je($e.y,!1);D(YW,!(Qe&&dt))}qe&&(z(Ae),H(Ae),D(NS,!Ee.x,!0),D(NS,!Ee.y,!1),D(UW,kt&&!V))},U,ca.bind(0,K)]},J6=(e,t,n)=>{Os(e)&&e(t||void 0,n||void 0)},ci=(e,t,n)=>{const{F:r,N:o,Y:s,j:a}=Eo(),c=ll(),d=Qp(e),p=d?e:e.target,h=q6(p);if(t&&!h){let m=!1;const v=B=>{const V=ll()[ZW],q=V&&V.O;return q?q(B,!0):B},b=hr({},r(),v(t)),[w,y,S]=Zb(n),[k,_,I]=kV(e,b),[P,E,O]=TV(e,b,_,B=>S("scroll",[Q,B])),R=(B,V)=>k(B,!!V),M=R.bind(0,{},!0),T=s(M),A=a(M),$=B=>{cV(p),T(),A(),O(),I(),m=!0,S("destroyed",[Q,!!B]),y()},Q={options(B,V){if(B){const q=V?r():{},G=$6(b,hr(q,v(B)));qb(G)||(hr(b,G),R(G))}return hr({},b)},on:w,off:(B,V)=>{B&&V&&y(B,V)},state(){const{zt:B,Tt:V,Ct:q,Et:G,K:D,St:z,bt:H}=_();return hr({},{overflowEdge:B,overflowAmount:V,overflowStyle:q,hasOverflow:G,padding:D,paddingAbsolute:z,directionRTL:H,destroyed:m})},elements(){const{W:B,Z:V,K:q,J:G,tt:D,ot:z,st:H}=_.qt,{Jt:Y,nn:ie}=E.qt,ye=oe=>{const{Ft:K,Gt:U,Xt:ae}=oe;return{scrollbar:ae,track:U,handle:K}},Z=oe=>{const{Kt:K,Qt:U}=oe,ae=ye(K[0]);return hr({},ae,{clone:()=>{const re=ye(U());return P({},!0,{}),re}})};return hr({},{target:B,host:V,padding:q||G,viewport:G,content:D||G,scrollOffsetElement:z,scrollEventElement:H,scrollbarHorizontal:Z(Y),scrollbarVertical:Z(ie)})},update:B=>R({},B),destroy:$.bind(0)};return _.jt((B,V,q)=>{P(V,q,B)}),lV(p,Q),_n(Bo(c),B=>J6(c[B],0,Q)),iV(_.qt.it,o().cancel,!d&&e.cancel)?($(!0),Q):(_.Nt(),E.Nt(),S("initialized",[Q]),_.jt((B,V,q)=>{const{gt:G,yt:D,vt:z,At:H,Lt:Y,It:ie,wt:ye,Ot:Z}=B;S("updated",[Q,{updateHints:{sizeChanged:G,directionChanged:D,heightIntrinsicChanged:z,overflowEdgeChanged:H,overflowAmountChanged:Y,overflowStyleChanged:ie,contentMutation:ye,hostMutation:Z},changedOptions:V,force:q}])}),Q.update(!0),Q)}return h};ci.plugin=e=>{_n(JW(e),t=>J6(t,ci))};ci.valid=e=>{const t=e&&e.elements,n=Os(t)&&t();return Qv(n)&&!!q6(n.target)};ci.env=()=>{const{k:e,A:t,I:n,B:r,V:o,L:s,X:a,U:c,N:d,q:p,F:h,G:m}=Eo();return hr({},{scrollbarsSize:e,scrollbarsOverlaid:t,scrollbarsHiding:n,rtlScrollBehavior:r,flexboxGlue:o,cssCustomProperties:s,staticDefaultInitialization:a,staticDefaultOptions:c,getDefaultInitialization:d,setDefaultInitialization:p,getDefaultOptions:h,setDefaultOptions:m})};const AV=()=>{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,a=r?n.requestIdleCallback:o,c=r?n.cancelIdleCallback:s,d=()=>{c(e),s(t)};return[(p,h)=>{d(),e=a(r?()=>{d(),t=o(p)}:p,typeof h=="object"?h:{timeout:2233})},d]},sy=e=>{const{options:t,events:n,defer:r}=e||{},[o,s]=f.useMemo(AV,[]),a=f.useRef(null),c=f.useRef(r),d=f.useRef(t),p=f.useRef(n);return f.useEffect(()=>{c.current=r},[r]),f.useEffect(()=>{const{current:h}=a;d.current=t,ci.valid(h)&&h.options(t||{},!0)},[t]),f.useEffect(()=>{const{current:h}=a;p.current=n,ci.valid(h)&&h.on(n||{},!0)},[n]),f.useEffect(()=>()=>{var h;s(),(h=a.current)==null||h.destroy()},[]),f.useMemo(()=>[h=>{const m=a.current;if(ci.valid(m))return;const v=c.current,b=d.current||{},w=p.current||{},y=()=>a.current=ci(h,b,w);v?o(y,v):y()},()=>a.current],[])},NV=(e,t)=>{const{element:n="div",options:r,events:o,defer:s,children:a,...c}=e,d=n,p=f.useRef(null),h=f.useRef(null),[m,v]=sy({options:r,events:o,defer:s});return f.useEffect(()=>{const{current:b}=p,{current:w}=h;return b&&w&&m({target:b,elements:{viewport:w,content:w}}),()=>{var y;return(y=v())==null?void 0:y.destroy()}},[m,n]),f.useImperativeHandle(t,()=>({osInstance:v,getElement:()=>p.current}),[]),F.createElement(d,{"data-overlayscrollbars-initialize":"",ref:p,...c},F.createElement("div",{ref:h},a))},Z6=f.forwardRef(NV);var ej={exports:{}},tj={};const No=T1(IR),hu=T1(ER),$V=T1(OR);(function(e){var t,n,r=Rl&&Rl.__generator||function(X,ee){var he,_e,me,ut,st={label:0,sent:function(){if(1&me[0])throw me[1];return me[1]},trys:[],ops:[]};return ut={next:Ht(0),throw:Ht(1),return:Ht(2)},typeof Symbol=="function"&&(ut[Symbol.iterator]=function(){return this}),ut;function Ht(ft){return function(xt){return function(He){if(he)throw new TypeError("Generator is already executing.");for(;st;)try{if(he=1,_e&&(me=2&He[0]?_e.return:He[0]?_e.throw||((me=_e.return)&&me.call(_e),0):_e.next)&&!(me=me.call(_e,He[1])).done)return me;switch(_e=0,me&&(He=[2&He[0],me.value]),He[0]){case 0:case 1:me=He;break;case 4:return st.label++,{value:He[1],done:!1};case 5:st.label++,_e=He[1],He=[0];continue;case 7:He=st.ops.pop(),st.trys.pop();continue;default:if(!((me=(me=st.trys).length>0&&me[me.length-1])||He[0]!==6&&He[0]!==2)){st=0;continue}if(He[0]===3&&(!me||He[1]>me[0]&&He[1]=200&&X.status<=299},Q=function(X){return/ion\/(vnd\.api\+)?json/.test(X.get("content-type")||"")};function B(X){if(!(0,T.isPlainObject)(X))return X;for(var ee=S({},X),he=0,_e=Object.entries(ee);he<_e.length;he++){var me=_e[he];me[1]===void 0&&delete ee[me[0]]}return ee}function V(X){var ee=this;X===void 0&&(X={});var he=X.baseUrl,_e=X.prepareHeaders,me=_e===void 0?function(Zt){return Zt}:_e,ut=X.fetchFn,st=ut===void 0?A:ut,Ht=X.paramsSerializer,ft=X.isJsonContentType,xt=ft===void 0?Q:ft,He=X.jsonContentType,Ce=He===void 0?"application/json":He,Xe=X.jsonReplacer,jt=X.timeout,Et=X.responseHandler,Nt=X.validateStatus,qt=I(X,["baseUrl","prepareHeaders","fetchFn","paramsSerializer","isJsonContentType","jsonContentType","jsonReplacer","timeout","responseHandler","validateStatus"]);return typeof fetch>"u"&&st===A&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(Zt,Ut){return E(ee,null,function(){var Le,yt,Mt,Wt,jn,Gt,un,sn,Ir,Xn,It,In,On,Jn,mr,Tn,An,dn,Sn,En,vn,bn,Ke,Ot,St,at,wt,Bt,mt,ot,Oe,Ie,De,We,Ze,Dt;return r(this,function(Rt){switch(Rt.label){case 0:return Le=Ut.signal,yt=Ut.getState,Mt=Ut.extra,Wt=Ut.endpoint,jn=Ut.forced,Gt=Ut.type,Ir=(sn=typeof Zt=="string"?{url:Zt}:Zt).url,It=(Xn=sn.headers)===void 0?new Headers(qt.headers):Xn,On=(In=sn.params)===void 0?void 0:In,mr=(Jn=sn.responseHandler)===void 0?Et??"json":Jn,An=(Tn=sn.validateStatus)===void 0?Nt??$:Tn,Sn=(dn=sn.timeout)===void 0?jt:dn,En=I(sn,["url","headers","params","responseHandler","validateStatus","timeout"]),vn=S(k(S({},qt),{signal:Le}),En),It=new Headers(B(It)),bn=vn,[4,me(It,{getState:yt,extra:Mt,endpoint:Wt,forced:jn,type:Gt})];case 1:bn.headers=Rt.sent()||It,Ke=function(Ve){return typeof Ve=="object"&&((0,T.isPlainObject)(Ve)||Array.isArray(Ve)||typeof Ve.toJSON=="function")},!vn.headers.has("content-type")&&Ke(vn.body)&&vn.headers.set("content-type",Ce),Ke(vn.body)&&xt(vn.headers)&&(vn.body=JSON.stringify(vn.body,Xe)),On&&(Ot=~Ir.indexOf("?")?"&":"?",St=Ht?Ht(On):new URLSearchParams(B(On)),Ir+=Ot+St),Ir=function(Ve,tn){if(!Ve)return tn;if(!tn)return Ve;if(function(hn){return new RegExp("(^|:)//").test(hn)}(tn))return tn;var yn=Ve.endsWith("/")||!tn.startsWith("?")?"/":"";return Ve=function(hn){return hn.replace(/\/$/,"")}(Ve),""+Ve+yn+function(hn){return hn.replace(/^\//,"")}(tn)}(he,Ir),at=new Request(Ir,vn),wt=at.clone(),un={request:wt},mt=!1,ot=Sn&&setTimeout(function(){mt=!0,Ut.abort()},Sn),Rt.label=2;case 2:return Rt.trys.push([2,4,5,6]),[4,st(at)];case 3:return Bt=Rt.sent(),[3,6];case 4:return Oe=Rt.sent(),[2,{error:{status:mt?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Oe)},meta:un}];case 5:return ot&&clearTimeout(ot),[7];case 6:Ie=Bt.clone(),un.response=Ie,We="",Rt.label=7;case 7:return Rt.trys.push([7,9,,10]),[4,Promise.all([en(Bt,mr).then(function(Ve){return De=Ve},function(Ve){return Ze=Ve}),Ie.text().then(function(Ve){return We=Ve},function(){})])];case 8:if(Rt.sent(),Ze)throw Ze;return[3,10];case 9:return Dt=Rt.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:Bt.status,data:We,error:String(Dt)},meta:un}];case 10:return[2,An(Bt,De)?{data:De,meta:un}:{error:{status:Bt.status,data:De},meta:un}]}})})};function en(Zt,Ut){return E(this,null,function(){var Le;return r(this,function(yt){switch(yt.label){case 0:return typeof Ut=="function"?[2,Ut(Zt)]:(Ut==="content-type"&&(Ut=xt(Zt.headers)?"json":"text"),Ut!=="json"?[3,2]:[4,Zt.text()]);case 1:return[2,(Le=yt.sent()).length?JSON.parse(Le):null];case 2:return[2,Zt.text()]}})})}}var q=function(X,ee){ee===void 0&&(ee=void 0),this.value=X,this.meta=ee};function G(X,ee){return X===void 0&&(X=0),ee===void 0&&(ee=5),E(this,null,function(){var he,_e;return r(this,function(me){switch(me.label){case 0:return he=Math.min(X,ee),_e=~~((Math.random()+.4)*(300<=Ie)}var En=(0,$e.createAsyncThunk)(On+"/executeQuery",dn,{getPendingMeta:function(){var Ke;return(Ke={startedTimeStamp:Date.now()})[$e.SHOULD_AUTOBATCH]=!0,Ke},condition:function(Ke,Ot){var St,at,wt,Bt=(0,Ot.getState)(),mt=(at=(St=Bt[On])==null?void 0:St.queries)==null?void 0:at[Ke.queryCacheKey],ot=mt==null?void 0:mt.fulfilledTimeStamp,Oe=Ke.originalArgs,Ie=mt==null?void 0:mt.originalArgs,De=mr[Ke.endpointName];return!(!de(Ke)&&((mt==null?void 0:mt.status)==="pending"||!Sn(Ke,Bt)&&(!se(De)||!((wt=De==null?void 0:De.forceRefetch)!=null&&wt.call(De,{currentArg:Oe,previousArg:Ie,endpointState:mt,state:Bt})))&&ot))},dispatchConditionRejection:!0}),vn=(0,$e.createAsyncThunk)(On+"/executeMutation",dn,{getPendingMeta:function(){var Ke;return(Ke={startedTimeStamp:Date.now()})[$e.SHOULD_AUTOBATCH]=!0,Ke}});function bn(Ke){return function(Ot){var St,at;return((at=(St=Ot==null?void 0:Ot.meta)==null?void 0:St.arg)==null?void 0:at.endpointName)===Ke}}return{queryThunk:En,mutationThunk:vn,prefetch:function(Ke,Ot,St){return function(at,wt){var Bt=function(De){return"force"in De}(St)&&St.force,mt=function(De){return"ifOlderThan"in De}(St)&&St.ifOlderThan,ot=function(De){return De===void 0&&(De=!0),An.endpoints[Ke].initiate(Ot,{forceRefetch:De})},Oe=An.endpoints[Ke].select(Ot)(wt());if(Bt)at(ot());else if(mt){var Ie=Oe==null?void 0:Oe.fulfilledTimeStamp;if(!Ie)return void at(ot());(Number(new Date)-Number(new Date(Ie)))/1e3>=mt&&at(ot())}else at(ot(!1))}},updateQueryData:function(Ke,Ot,St){return function(at,wt){var Bt,mt,ot=An.endpoints[Ke].select(Ot)(wt()),Oe={patches:[],inversePatches:[],undo:function(){return at(An.util.patchQueryData(Ke,Ot,Oe.inversePatches))}};if(ot.status===t.uninitialized)return Oe;if("data"in ot)if((0,Ee.isDraftable)(ot.data)){var Ie=(0,Ee.produceWithPatches)(ot.data,St),De=Ie[2];(Bt=Oe.patches).push.apply(Bt,Ie[1]),(mt=Oe.inversePatches).push.apply(mt,De)}else{var We=St(ot.data);Oe.patches.push({op:"replace",path:[],value:We}),Oe.inversePatches.push({op:"replace",path:[],value:ot.data})}return at(An.util.patchQueryData(Ke,Ot,Oe.patches)),Oe}},upsertQueryData:function(Ke,Ot,St){return function(at){var wt;return at(An.endpoints[Ke].initiate(Ot,((wt={subscribe:!1,forceRefetch:!0})[xe]=function(){return{data:St}},wt)))}},patchQueryData:function(Ke,Ot,St){return function(at){at(An.internalActions.queryResultPatched({queryCacheKey:Tn({queryArgs:Ot,endpointDefinition:mr[Ke],endpointName:Ke}),patches:St}))}},buildMatchThunkActions:function(Ke,Ot){return{matchPending:(0,Ae.isAllOf)((0,Ae.isPending)(Ke),bn(Ot)),matchFulfilled:(0,Ae.isAllOf)((0,Ae.isFulfilled)(Ke),bn(Ot)),matchRejected:(0,Ae.isAllOf)((0,Ae.isRejected)(Ke),bn(Ot))}}}}({baseQuery:_e,reducerPath:me,context:he,api:X,serializeQueryArgs:ut}),Xe=Ce.queryThunk,jt=Ce.mutationThunk,Et=Ce.patchQueryData,Nt=Ce.updateQueryData,qt=Ce.upsertQueryData,en=Ce.prefetch,Zt=Ce.buildMatchThunkActions,Ut=function(It){var In=It.reducerPath,On=It.queryThunk,Jn=It.mutationThunk,mr=It.context,Tn=mr.endpointDefinitions,An=mr.apiUid,dn=mr.extractRehydrationInfo,Sn=mr.hasRehydrationInfo,En=It.assertTagType,vn=It.config,bn=(0,ge.createAction)(In+"/resetApiState"),Ke=(0,ge.createSlice)({name:In+"/queries",initialState:Pt,reducers:{removeQueryResult:{reducer:function(ot,Oe){delete ot[Oe.payload.queryCacheKey]},prepare:(0,ge.prepareAutoBatched)()},queryResultPatched:function(ot,Oe){var Ie=Oe.payload,De=Ie.patches;bt(ot,Ie.queryCacheKey,function(We){We.data=(0,vt.applyPatches)(We.data,De.concat())})}},extraReducers:function(ot){ot.addCase(On.pending,function(Oe,Ie){var De,We=Ie.meta,Ze=Ie.meta.arg,Dt=de(Ze);(Ze.subscribe||Dt)&&(Oe[De=Ze.queryCacheKey]!=null||(Oe[De]={status:t.uninitialized,endpointName:Ze.endpointName})),bt(Oe,Ze.queryCacheKey,function(Rt){Rt.status=t.pending,Rt.requestId=Dt&&Rt.requestId?Rt.requestId:We.requestId,Ze.originalArgs!==void 0&&(Rt.originalArgs=Ze.originalArgs),Rt.startedTimeStamp=We.startedTimeStamp})}).addCase(On.fulfilled,function(Oe,Ie){var De=Ie.meta,We=Ie.payload;bt(Oe,De.arg.queryCacheKey,function(Ze){var Dt;if(Ze.requestId===De.requestId||de(De.arg)){var Rt=Tn[De.arg.endpointName].merge;if(Ze.status=t.fulfilled,Rt)if(Ze.data!==void 0){var Ve=De.fulfilledTimeStamp,tn=De.arg,yn=De.baseQueryMeta,hn=De.requestId,gr=(0,ge.createNextState)(Ze.data,function(Yn){return Rt(Yn,We,{arg:tn.originalArgs,baseQueryMeta:yn,fulfilledTimeStamp:Ve,requestId:hn})});Ze.data=gr}else Ze.data=We;else Ze.data=(Dt=Tn[De.arg.endpointName].structuralSharing)==null||Dt?M((0,on.isDraft)(Ze.data)?(0,vt.original)(Ze.data):Ze.data,We):We;delete Ze.error,Ze.fulfilledTimeStamp=De.fulfilledTimeStamp}})}).addCase(On.rejected,function(Oe,Ie){var De=Ie.meta,We=De.condition,Ze=De.requestId,Dt=Ie.error,Rt=Ie.payload;bt(Oe,De.arg.queryCacheKey,function(Ve){if(!We){if(Ve.requestId!==Ze)return;Ve.status=t.rejected,Ve.error=Rt??Dt}})}).addMatcher(Sn,function(Oe,Ie){for(var De=dn(Ie).queries,We=0,Ze=Object.entries(De);We"u"||navigator.onLine===void 0||navigator.onLine,focused:typeof document>"u"||document.visibilityState!=="hidden",middlewareRegistered:!1},vn),reducers:{middlewareRegistered:function(ot,Oe){ot.middlewareRegistered=ot.middlewareRegistered!=="conflict"&&An===Oe.payload||"conflict"}},extraReducers:function(ot){ot.addCase(ye,function(Oe){Oe.online=!0}).addCase(Z,function(Oe){Oe.online=!1}).addCase(Y,function(Oe){Oe.focused=!0}).addCase(ie,function(Oe){Oe.focused=!1}).addMatcher(Sn,function(Oe){return S({},Oe)})}}),mt=(0,ge.combineReducers)({queries:Ke.reducer,mutations:Ot.reducer,provided:St.reducer,subscriptions:wt.reducer,config:Bt.reducer});return{reducer:function(ot,Oe){return mt(bn.match(Oe)?void 0:ot,Oe)},actions:k(S(S(S(S(S({},Bt.actions),Ke.actions),at.actions),wt.actions),Ot.actions),{unsubscribeMutationResult:Ot.actions.removeMutationResult,resetApiState:bn})}}({context:he,queryThunk:Xe,mutationThunk:jt,reducerPath:me,assertTagType:He,config:{refetchOnFocus:ft,refetchOnReconnect:xt,refetchOnMountOrArgChange:Ht,keepUnusedDataFor:st,reducerPath:me}}),Le=Ut.reducer,yt=Ut.actions;Nr(X.util,{patchQueryData:Et,updateQueryData:Nt,upsertQueryData:qt,prefetch:en,resetApiState:yt.resetApiState}),Nr(X.internalActions,yt);var Mt=function(It){var In=It.reducerPath,On=It.queryThunk,Jn=It.api,mr=It.context,Tn=mr.apiUid,An={invalidateTags:(0,cr.createAction)(In+"/invalidateTags")},dn=[Hr,pn,Fr,br,Wn,Ro];return{middleware:function(En){var vn=!1,bn=k(S({},It),{internalState:{currentSubscriptions:{}},refetchQuery:Sn}),Ke=dn.map(function(at){return at(bn)}),Ot=function(at){var wt=at.api,Bt=at.queryThunk,mt=at.internalState,ot=wt.reducerPath+"/subscriptions",Oe=null,Ie=!1,De=wt.internalActions,We=De.updateSubscriptionOptions,Ze=De.unsubscribeQueryResult;return function(Dt,Rt){var Ve,tn;if(Oe||(Oe=JSON.parse(JSON.stringify(mt.currentSubscriptions))),wt.util.resetApiState.match(Dt))return Oe=mt.currentSubscriptions={},[!0,!1];if(wt.internalActions.internal_probeSubscription.match(Dt)){var yn=Dt.payload;return[!1,!!((Ve=mt.currentSubscriptions[yn.queryCacheKey])!=null&&Ve[yn.requestId])]}var hn=function(gn,Vn){var io,fn,Nn,Vr,Er,Va,Vd,Mo,fa;if(We.match(Vn)){var Ls=Vn.payload,pa=Ls.queryCacheKey,lo=Ls.requestId;return(io=gn==null?void 0:gn[pa])!=null&&io[lo]&&(gn[pa][lo]=Ls.options),!0}if(Ze.match(Vn)){var co=Vn.payload;return lo=co.requestId,gn[pa=co.queryCacheKey]&&delete gn[pa][lo],!0}if(wt.internalActions.removeQueryResult.match(Vn))return delete gn[Vn.payload.queryCacheKey],!0;if(Bt.pending.match(Vn)){var uo=Vn.meta;if(lo=uo.requestId,(Qr=uo.arg).subscribe)return(Ho=(Nn=gn[fn=Qr.queryCacheKey])!=null?Nn:gn[fn]={})[lo]=(Er=(Vr=Qr.subscriptionOptions)!=null?Vr:Ho[lo])!=null?Er:{},!0}if(Bt.rejected.match(Vn)){var Ho,Do=Vn.meta,Qr=Do.arg;if(lo=Do.requestId,Do.condition&&Qr.subscribe)return(Ho=(Vd=gn[Va=Qr.queryCacheKey])!=null?Vd:gn[Va]={})[lo]=(fa=(Mo=Qr.subscriptionOptions)!=null?Mo:Ho[lo])!=null?fa:{},!0}return!1}(mt.currentSubscriptions,Dt);if(hn){Ie||(fs(function(){var gn=JSON.parse(JSON.stringify(mt.currentSubscriptions)),Vn=(0,Wr.produceWithPatches)(Oe,function(){return gn});Rt.next(wt.internalActions.subscriptionsUpdated(Vn[1])),Oe=gn,Ie=!1}),Ie=!0);var gr=!!((tn=Dt.type)!=null&&tn.startsWith(ot)),Yn=Bt.rejected.match(Dt)&&Dt.meta.condition&&!!Dt.meta.arg.subscribe;return[!gr&&!Yn,!1]}return[!0,!1]}}(bn),St=function(at){var wt=at.reducerPath,Bt=at.context,mt=at.refetchQuery,ot=at.internalState,Oe=at.api.internalActions.removeQueryResult;function Ie(De,We){var Ze=De.getState()[wt],Dt=Ze.queries,Rt=ot.currentSubscriptions;Bt.batch(function(){for(var Ve=0,tn=Object.keys(Rt);Ve{const{imageUsage:t,topMessage:n="This image is currently in use in the following features:",bottomMessage:r="If you delete this image, those features will immediately be reset."}=e;return!t||!wu(t)?null:i.jsxs(i.Fragment,{children:[i.jsx(tt,{children:n}),i.jsxs(vb,{sx:{paddingInlineStart:6},children:[t.isInitialImage&&i.jsx(wa,{children:"Image to Image"}),t.isCanvasImage&&i.jsx(wa,{children:"Unified Canvas"}),t.isControlNetImage&&i.jsx(wa,{children:"ControlNet"}),t.isNodesImage&&i.jsx(wa,{children:"Node Editor"})]}),i.jsx(tt,{children:r})]})},nj=f.memo(zV),LV=e=>{const{boardToDelete:t,setBoardToDelete:n}=e,{t:r}=be(),o=L(_=>_.config.canRestoreDeletedImagesFromBin),{currentData:s,isFetching:a}=RR((t==null?void 0:t.board_id)??oo.skipToken),c=f.useMemo(()=>fe([Ye],_=>{const I=(s??[]).map(E=>MR(_,E));return{imageUsageSummary:{isInitialImage:wu(I,E=>E.isInitialImage),isCanvasImage:wu(I,E=>E.isCanvasImage),isNodesImage:wu(I,E=>E.isNodesImage),isControlNetImage:wu(I,E=>E.isControlNetImage)}}}),[s]),[d,{isLoading:p}]=DR(),[h,{isLoading:m}]=TR(),{imageUsageSummary:v}=L(c),b=f.useCallback(()=>{t&&(d(t.board_id),n(void 0))},[t,d,n]),w=f.useCallback(()=>{t&&(h(t.board_id),n(void 0))},[t,h,n]),y=f.useCallback(()=>{n(void 0)},[n]),S=f.useRef(null),k=f.useMemo(()=>m||p||a,[m,p,a]);return t?i.jsx(_d,{isOpen:!!t,onClose:y,leastDestructiveRef:S,isCentered:!0,children:i.jsx(Da,{children:i.jsxs(Pd,{children:[i.jsxs(Ma,{fontSize:"lg",fontWeight:"bold",children:["Delete ",t.board_name]}),i.jsx(Ta,{children:i.jsxs(W,{direction:"column",gap:3,children:[a?i.jsx(gm,{children:i.jsx(W,{sx:{w:"full",h:32}})}):i.jsx(nj,{imageUsage:v,topMessage:"This board contains images used in the following features:",bottomMessage:"Deleting this board and its images will reset any features currently using them."}),i.jsx(tt,{children:"Deleted boards cannot be restored."}),i.jsx(tt,{children:r(o?"gallery.deleteImageBin":"gallery.deleteImagePermanent")})]})}),i.jsx(Ra,{children:i.jsxs(W,{sx:{justifyContent:"space-between",width:"full",gap:2},children:[i.jsx(rn,{ref:S,onClick:y,children:"Cancel"}),i.jsx(rn,{colorScheme:"warning",isLoading:k,onClick:b,children:"Delete Board Only"}),i.jsx(rn,{colorScheme:"error",isLoading:k,onClick:w,children:"Delete Board and Images"})]})})]})})}):null},BV=f.memo(LV),rj=Te((e,t)=>{const{role:n,tooltip:r="",tooltipProps:o,isChecked:s,...a}=e;return i.jsx(wn,{label:r,hasArrow:!0,...o,...o!=null&&o.placement?{placement:o.placement}:{placement:"top"},children:i.jsx(Ca,{ref:t,role:n,colorScheme:s?"accent":"base",...a})})});rj.displayName="IAIIconButton";const Fe=f.memo(rj),FV="My Board",HV=()=>{const[e,{isLoading:t}]=AR(),n=f.useCallback(()=>{e(FV)},[e]);return i.jsx(Fe,{icon:i.jsx(ml,{}),isLoading:t,tooltip:"Add Board","aria-label":"Add Board",onClick:n,size:"sm"})};var QS={path:i.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),i.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),i.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},oj=Te((e,t)=>{const{as:n,viewBox:r,color:o="currentColor",focusable:s=!1,children:a,className:c,__css:d,...p}=e,h=Ct("chakra-icon",c),m=ia("Icon",e),v={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:o,...d,...m},b={ref:t,focusable:s,className:h,__css:v},w=r??QS.viewBox;if(n&&typeof n!="string")return i.jsx(je.svg,{as:n,...b,...p});const y=a??QS.path;return i.jsx(je.svg,{verticalAlign:"middle",viewBox:w,...b,...p,children:y})});oj.displayName="Icon";function Td(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=f.Children.toArray(e.path),a=Te((c,d)=>i.jsx(oj,{ref:d,viewBox:t,...o,...c,children:s.length?s:i.jsx("path",{fill:"currentColor",d:n})}));return a.displayName=r,a}var sj=Td({displayName:"ExternalLinkIcon",path:i.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[i.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),i.jsx("path",{d:"M15 3h6v6"}),i.jsx("path",{d:"M10 14L21 3"})]})}),ay=Td({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),WV=Td({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"}),VV=Td({displayName:"DeleteIcon",path:i.jsx("g",{fill:"currentColor",children:i.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"})})}),UV=Td({displayName:"ChevronDownIcon",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"});const GV=fe([Ye],({boards:e})=>{const{searchText:t}=e;return{searchText:t}},Ge),qV=()=>{const e=te(),{searchText:t}=L(GV),n=f.useRef(null),r=f.useCallback(c=>{e(O2(c))},[e]),o=f.useCallback(()=>{e(O2(""))},[e]),s=f.useCallback(c=>{c.key==="Escape"&&o()},[o]),a=f.useCallback(c=>{r(c.target.value)},[r]);return f.useEffect(()=>{n.current&&n.current.focus()},[]),i.jsxs(F5,{children:[i.jsx(yd,{ref:n,placeholder:"Search Boards...",value:t,onKeyDown:s,onChange:a}),t&&t.length&&i.jsx(hb,{children:i.jsx(Ca,{onClick:o,size:"xs",variant:"ghost","aria-label":"Clear Search",opacity:.5,icon:i.jsx(WV,{boxSize:2})})})]})},KV=f.memo(qV),YV=e=>{const{isOver:t,label:n="Drop"}=e,r=f.useRef(ui()),{colorMode:o}=Ds();return i.jsx(Yr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:i.jsxs(W,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full"},children:[i.jsx(W,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:Be("base.700","base.900")(o),opacity:.7,borderRadius:"base",alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),i.jsx(W,{sx:{position:"absolute",top:.5,insetInlineStart:.5,insetInlineEnd:.5,bottom:.5,opacity:1,borderWidth:2,borderColor:t?Be("base.50","base.50")(o):Be("base.200","base.300")(o),borderRadius:"lg",borderStyle:"dashed",transitionProperty:"common",transitionDuration:"0.1s",alignItems:"center",justifyContent:"center"},children:i.jsx(tt,{sx:{fontSize:"2xl",fontWeight:600,transform:t?"scale(1.1)":"scale(1)",color:t?Be("base.50","base.50")(o):Be("base.200","base.300")(o),transitionProperty:"common",transitionDuration:"0.1s"},children:n})})]})},r.current)},nh=f.memo(YV),QV=e=>{const{dropLabel:t,data:n,disabled:r}=e,o=f.useRef(ui()),{isOver:s,setNodeRef:a,active:c}=A1({id:o.current,disabled:r,data:n});return i.jsx(Re,{ref:a,position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",pointerEvents:"none",children:i.jsx(Fo,{children:Ep(n,c)&&i.jsx(nh,{isOver:s,label:t})})})},iy=f.memo(QV),ly=({isSelected:e,isHovered:t})=>i.jsx(Re,{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",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}}}),aj=()=>i.jsx(W,{sx:{position:"absolute",insetInlineEnd:0,top:0,p:1},children:i.jsx(pl,{variant:"solid",sx:{bg:"accent.400",_dark:{bg:"accent.500"}},children:"auto"})});var $u=globalThis&&globalThis.__assign||function(){return $u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const{boardName:t}=Zh(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)||"Uncategorized"}}});return t},XV=({board:e,setBoardToDelete:t})=>{const n=f.useCallback(()=>{t&&t(e)},[e,t]);return i.jsxs(i.Fragment,{children:[e.image_count>0&&i.jsx(i.Fragment,{}),i.jsx(kr,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:i.jsx(us,{}),onClick:n,children:"Delete Board"})]})},JV=f.memo(XV),ZV=()=>i.jsx(i.Fragment,{}),eU=f.memo(ZV),cy=f.memo(({board:e,board_id:t,setBoardToDelete:n,children:r})=>{const o=te(),s=f.useMemo(()=>fe(Ye,({gallery:h})=>({isAutoAdd:h.autoAddBoardId===t})),[t]),{isAutoAdd:a}=L(s),c=Rm(t),d=f.useCallback(()=>{o(R_(t))},[t,o]),p=f.useCallback(h=>{h.preventDefault()},[]);return i.jsx(ij,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>i.jsx(Lc,{sx:{visibility:"visible !important"},motionProps:nm,onContextMenu:p,children:i.jsxs(Xu,{title:c,children:[i.jsx(kr,{icon:i.jsx(ml,{}),isDisabled:a,onClick:d,children:"Auto-add to this Board"}),!e&&i.jsx(eU,{}),e&&i.jsx(JV,{board:e,setBoardToDelete:n})]})}),children:r})});cy.displayName="HoverableBoard";const lj=f.memo(({board:e,isSelected:t,setBoardToDelete:n})=>{const r=te(),o=f.useMemo(()=>fe(Ye,({gallery:E})=>({isSelectedForAutoAdd:e.board_id===E.autoAddBoardId}),Ge),[e.board_id]),{isSelectedForAutoAdd:s}=L(o),[a,c]=f.useState(!1),d=f.useCallback(()=>{c(!0)},[]),p=f.useCallback(()=>{c(!1)},[]),{currentData:h}=os(e.cover_image_name??oo.skipToken),{board_name:m,board_id:v}=e,[b,w]=f.useState(m),y=f.useCallback(()=>{r(M_(v))},[v,r]),[S,{isLoading:k}]=NR(),_=f.useMemo(()=>({id:v,actionType:"MOVE_BOARD",context:{boardId:v}}),[v]),I=f.useCallback(async E=>{if(!E.trim()){w(m);return}if(E!==m)try{const{board_name:O}=await S({board_id:v,changes:{board_name:E}}).unwrap();w(O)}catch{w(m)}},[v,m,S]),P=f.useCallback(E=>{w(E)},[]);return i.jsx(Re,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:i.jsx(W,{onMouseOver:d,onMouseOut:p,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",w:"full",h:"full"},children:i.jsx(cy,{board:e,board_id:v,setBoardToDelete:n,children:E=>i.jsxs(W,{ref:E,onClick:y,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[h!=null&&h.thumbnail_url?i.jsx(Tc,{src:h==null?void 0:h.thumbnail_url,draggable:!1,sx:{objectFit:"cover",w:"full",h:"full",maxH:"full",borderRadius:"base",borderBottomRadius:"lg"}}):i.jsx(W,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:i.jsx(no,{boxSize:12,as:gW,sx:{mt:-6,opacity:.7,color:"base.500",_dark:{color:"base.500"}}})}),s&&i.jsx(aj,{}),i.jsx(ly,{isSelected:t,isHovered:a}),i.jsx(W,{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:i.jsxs(e5,{value:b,isDisabled:k,submitOnBlur:!0,onChange:P,onSubmit:I,sx:{w:"full"},children:[i.jsx(X3,{sx:{p:0,fontWeight:t?700:500,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},noOfLines:1}),i.jsx(Q3,{sx:{p:0,_focusVisible:{p:0,textAlign:"center",boxShadow:"none"}}})]})}),i.jsx(iy,{data:_,dropLabel:i.jsx(tt,{fontSize:"md",children:"Move"})})]})})})})});lj.displayName="HoverableBoard";const tU=fe(Ye,({gallery:e})=>{const{autoAddBoardId:t}=e;return{autoAddBoardId:t}},Ge),cj=f.memo(({isSelected:e})=>{const t=te(),{autoAddBoardId:n}=L(tU),r=Rm(void 0),o=f.useCallback(()=>{t(M_(void 0))},[t]),[s,a]=f.useState(!1),c=f.useCallback(()=>{a(!0)},[]),d=f.useCallback(()=>{a(!1)},[]),p=f.useMemo(()=>({id:"no_board",actionType:"MOVE_BOARD",context:{boardId:void 0}}),[]);return i.jsx(Re,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:i.jsx(W,{onMouseOver:c,onMouseOut:d,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",borderRadius:"base",w:"full",h:"full"},children:i.jsx(cy,{children:h=>i.jsxs(W,{ref:h,onClick:o,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[i.jsx(W,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:i.jsx(Tc,{src:D_,alt:"invoke-ai-logo",sx:{opacity:.4,filter:"grayscale(1)",mt:-6,w:16,h:16,minW:16,minH:16,userSelect:"none"}})}),!n&&i.jsx(aj,{}),i.jsx(W,{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:r}),i.jsx(ly,{isSelected:e,isHovered:s}),i.jsx(iy,{data:p,dropLabel:i.jsx(tt,{fontSize:"md",children:"Move"})})]})})})})});cj.displayName="HoverableBoard";const nU=fe([Ye],({boards:e,gallery:t})=>{const{searchText:n}=e,{selectedBoardId:r}=t;return{selectedBoardId:r,searchText:n}},Ge),rU=e=>{const{isOpen:t}=e,{selectedBoardId:n,searchText:r}=L(nU),{data:o}=Zh(),s=r?o==null?void 0:o.filter(d=>d.board_name.toLowerCase().includes(r.toLowerCase())):o,[a,c]=f.useState();return i.jsxs(i.Fragment,{children:[i.jsx(sm,{in:t,animateOpacity:!0,children:i.jsxs(W,{layerStyle:"first",sx:{flexDir:"column",gap:2,p:2,mt:2,borderRadius:"base"},children:[i.jsxs(W,{sx:{gap:2,alignItems:"center"},children:[i.jsx(KV,{}),i.jsx(HV,{})]}),i.jsx(Z6,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:i.jsxs(rl,{className:"list-container",sx:{gridTemplateColumns:"repeat(auto-fill, minmax(108px, 1fr));",maxH:346},children:[i.jsx(Tv,{sx:{p:1.5},children:i.jsx(cj,{isSelected:n===void 0})}),s&&s.map(d=>i.jsx(Tv,{sx:{p:1.5},children:i.jsx(lj,{board:d,isSelected:n===d.board_id,setBoardToDelete:c})},d.board_id))]})})]})}),i.jsx(BV,{boardToDelete:a,setBoardToDelete:c})]})},oU=f.memo(rU),sU=fe([Ye],e=>{const{selectedBoardId:t}=e.gallery;return{selectedBoardId:t}},Ge),aU=e=>{const{isOpen:t,onToggle:n}=e,{selectedBoardId:r}=L(sU),o=Rm(r),s=f.useMemo(()=>o.length>20?`${o.substring(0,20)}...`:o,[o]);return i.jsxs(W,{as:gc,onClick:n,size:"sm",sx:{position:"relative",gap:2,w:"full",justifyContent:"space-between",alignItems:"center",px:2},children:[i.jsx(tt,{noOfLines:1,sx:{fontWeight:600,w:"100%",textAlign:"center",color:"base.800",_dark:{color:"base.200"}},children:s}),i.jsx(ay,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]})},iU=f.memo(aU);function uj(e){return rt({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146z"}}]})(e)}function dj(e){return rt({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146zm.122 2.112v-.002.002zm0-.002v.002a.5.5 0 0 1-.122.51L6.293 6.878a.5.5 0 0 1-.511.12H5.78l-.014-.004a4.507 4.507 0 0 0-.288-.076 4.922 4.922 0 0 0-.765-.116c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a4.924 4.924 0 0 0-.192-1.054l-.004-.013v-.001a.5.5 0 0 1 .12-.512l3.536-3.535a.5.5 0 0 1 .532-.115l.096.022c.087.017.208.034.344.034.114 0 .23-.011.343-.04L9.927 2.028c-.029.113-.04.23-.04.343a1.779 1.779 0 0 0 .062.46z"}}]})(e)}const lU=fe([Ye],e=>{const{shouldPinGallery:t}=e.ui;return{shouldPinGallery:t}},Ge),cU=()=>{const e=te(),{t}=be(),{shouldPinGallery:n}=L(lU),r=()=>{e(T_()),e(Co())};return i.jsx(Fe,{size:"sm","aria-label":t("gallery.pinGallery"),tooltip:`${t("gallery.pinGallery")} (Shift+G)`,onClick:r,icon:n?i.jsx(uj,{}):i.jsx(dj,{})})},uU=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return i.jsxs(Tb,{isLazy:o,...s,children:[i.jsx(Db,{children:t}),i.jsxs(Ab,{shadow:"dark-lg",children:[r&&i.jsx(wP,{}),n]})]})},gl=f.memo(uU),dU=e=>{const{label:t,...n}=e,{colorMode:r}=Ds();return i.jsx(V3,{colorScheme:"accent",...n,children:i.jsx(tt,{sx:{fontSize:"sm",color:Be("base.800","base.200")(r)},children:t})})},Gn=f.memo(dU);function fU(e){return rt({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 pU=e=>{const[t,n]=f.useState(!1),{label:r,value:o,min:s=1,max:a=100,step:c=1,onChange:d,tooltipSuffix:p="",withSliderMarks:h=!1,withInput:m=!1,isInteger:v=!1,inputWidth:b=16,withReset:w=!1,hideTooltip:y=!1,isCompact:S=!1,isDisabled:k=!1,sliderMarks:_,handleReset:I,sliderFormControlProps:P,sliderFormLabelProps:E,sliderMarkProps:O,sliderTrackProps:R,sliderThumbProps:M,sliderNumberInputProps:T,sliderNumberInputFieldProps:A,sliderNumberInputStepperProps:$,sliderTooltipProps:Q,sliderIAIIconButtonProps:B,...V}=e,q=te(),{t:G}=be(),[D,z]=f.useState(String(o));f.useEffect(()=>{z(o)},[o]);const H=f.useMemo(()=>T!=null&&T.min?T.min:s,[s,T==null?void 0:T.min]),Y=f.useMemo(()=>T!=null&&T.max?T.max:a,[a,T==null?void 0:T.max]),ie=f.useCallback(re=>{d(re)},[d]),ye=f.useCallback(re=>{re.target.value===""&&(re.target.value=String(H));const se=Es(v?Math.floor(Number(re.target.value)):Number(D),H,Y),pe=Su(se,c);d(pe),z(pe)},[v,D,H,Y,d,c]),Z=f.useCallback(re=>{z(re)},[]),oe=f.useCallback(()=>{I&&I()},[I]),K=f.useCallback(re=>{re.target instanceof HTMLDivElement&&re.target.focus()},[]),U=f.useCallback(re=>{re.shiftKey&&q(Po(!0))},[q]),ae=f.useCallback(re=>{re.shiftKey||q(Po(!1))},[q]);return i.jsxs(mo,{onClick:K,sx:S?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},isDisabled:k,...P,children:[r&&i.jsx(zo,{sx:m?{mb:-1.5}:{},...E,children:r}),i.jsxs(di,{w:"100%",gap:2,alignItems:"center",children:[i.jsxs(LP,{"aria-label":r,value:o,min:s,max:a,step:c,onChange:ie,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),focusThumbOnChange:!1,isDisabled:k,...V,children:[h&&!_&&i.jsxs(i.Fragment,{children:[i.jsx(Vl,{value:s,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...O,children:s}),i.jsx(Vl,{value:a,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...O,children:a})]}),h&&_&&i.jsx(i.Fragment,{children:_.map((re,se)=>se===0?i.jsx(Vl,{value:re,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...O,children:re},re):se===_.length-1?i.jsx(Vl,{value:re,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...O,children:re},re):i.jsx(Vl,{value:re,sx:{transform:"translateX(-50%)"},...O,children:re},re))}),i.jsx(FP,{...R,children:i.jsx(HP,{})}),i.jsx(wn,{hasArrow:!0,placement:"top",isOpen:t,label:`${o}${p}`,hidden:y,...Q,children:i.jsx(BP,{...M,zIndex:0})})]}),m&&i.jsxs(dm,{min:H,max:Y,step:c,value:D,onChange:Z,onBlur:ye,focusInputOnChange:!1,...T,children:[i.jsx(pm,{onKeyDown:U,onKeyUp:ae,minWidth:b,...A}),i.jsxs(fm,{...$,children:[i.jsx(mm,{onClick:()=>d(Number(D))}),i.jsx(hm,{onClick:()=>d(Number(D))})]})]}),w&&i.jsx(Fe,{size:"sm","aria-label":G("accessibility.reset"),tooltip:G("accessibility.reset"),icon:i.jsx(fU,{}),isDisabled:k,onClick:oe,...B})]})]})},_t=f.memo(pU);function hU(e){const t=f.createContext(null);return[({children:o,value:s})=>F.createElement(t.Provider,{value:s},o),()=>{const o=f.useContext(t);if(o===null)throw new Error(e);return o}]}function fj(e){return Array.isArray(e)?e:[e]}const mU=()=>{};function gU(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||mU:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function pj({data:e}){const t=[],n=[],r=e.reduce((o,s,a)=>(s.group?o[s.group]?o[s.group].push(a):o[s.group]=[a]:n.push(a),o),{});return Object.keys(r).forEach(o=>{t.push(...r[o].map(s=>e[s]))}),t.push(...n.map(o=>e[o])),t}function hj(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==F.Fragment:!1}function mj(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 yU=$R({key:"mantine",prepend:!0});function xU(){return P3()||yU}var wU=Object.defineProperty,XS=Object.getOwnPropertySymbols,SU=Object.prototype.hasOwnProperty,CU=Object.prototype.propertyIsEnumerable,JS=(e,t,n)=>t in e?wU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kU=(e,t)=>{for(var n in t||(t={}))SU.call(t,n)&&JS(e,n,t[n]);if(XS)for(var n of XS(t))CU.call(t,n)&&JS(e,n,t[n]);return e};const W0="ref";function _U(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(!(W0 in n))return{args:e,ref:t};t=n[W0];const r=kU({},n);return delete r[W0],{args:[r],ref:t}}const{cssFactory:PU}=(()=>{function e(n,r,o){const s=[],a=BR(n,s,o);return s.length<2?o:a+r(s)}function t(n){const{cache:r}=n,o=(...a)=>{const{ref:c,args:d}=_U(a),p=zR(d,r.registered);return LR(r,p,!1),`${r.key}-${p.name}${c===void 0?"":` ${c}`}`};return{css:o,cx:(...a)=>e(r.registered,o,gj(a))}}return{cssFactory:t}})();function vj(){const e=xU();return bU(()=>PU({cache:e}),[e])}function jU({cx:e,classes:t,context:n,classNames:r,name:o,cache:s}){const a=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],a[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 IU=Object.defineProperty,ZS=Object.getOwnPropertySymbols,EU=Object.prototype.hasOwnProperty,OU=Object.prototype.propertyIsEnumerable,eC=(e,t,n)=>t in e?IU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,V0=(e,t)=>{for(var n in t||(t={}))EU.call(t,n)&&eC(e,n,t[n]);if(ZS)for(var n of ZS(t))OU.call(t,n)&&eC(e,n,t[n]);return e};function o1(e,t){return t&&Object.keys(t).forEach(n=>{e[n]?e[n]=V0(V0({},e[n]),t[n]):e[n]=V0({},t[n])}),e}function tC(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,a)=>o1(s,a),{}):o(e)}function RU({ctx:e,theme:t,params:n,variant:r,size:o}){return e.reduce((s,a)=>(a.variants&&r in a.variants&&o1(s,a.variants[r](t,n,{variant:r,size:o})),a.sizes&&o in a.sizes&&o1(s,a.sizes[o](t,n,{variant:r,size:o})),s),{})}function ao(e){const t=typeof e=="function"?e:()=>e;function n(r,o){const s=Fa(),a=ND(o==null?void 0:o.name),c=P3(),d={variant:o==null?void 0:o.variant,size:o==null?void 0:o.size},{css:p,cx:h}=vj(),m=t(s,r,d),v=tC(o==null?void 0:o.styles,s,r,d),b=tC(a,s,r,d),w=RU({ctx:a,theme:s,params:r,variant:o==null?void 0:o.variant,size:o==null?void 0:o.size}),y=Object.fromEntries(Object.keys(m).map(S=>{const k=h({[p(m[S])]:!(o!=null&&o.unstyled)},p(w[S]),p(b[S]),p(v[S]));return[S,k]}));return{classes:jU({cx:h,classes:y,context:a,classNames:o==null?void 0:o.classNames,name:o==null?void 0:o.name,cache:c}),cx:h,theme:s}}return n}function nC(e){return`___ref-${e||""}`}var MU=Object.defineProperty,DU=Object.defineProperties,TU=Object.getOwnPropertyDescriptors,rC=Object.getOwnPropertySymbols,AU=Object.prototype.hasOwnProperty,NU=Object.prototype.propertyIsEnumerable,oC=(e,t,n)=>t in e?MU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mu=(e,t)=>{for(var n in t||(t={}))AU.call(t,n)&&oC(e,n,t[n]);if(rC)for(var n of rC(t))NU.call(t,n)&&oC(e,n,t[n]);return e},gu=(e,t)=>DU(e,TU(t));const vu={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${Ue(10)})`},transitionProperty:"transform, opacity"},Jf={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(-${Ue(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(${Ue(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(${Ue(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Ue(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:gu(mu({},vu),{common:{transformOrigin:"center center"}}),"pop-bottom-left":gu(mu({},vu),{common:{transformOrigin:"bottom left"}}),"pop-bottom-right":gu(mu({},vu),{common:{transformOrigin:"bottom right"}}),"pop-top-left":gu(mu({},vu),{common:{transformOrigin:"top left"}}),"pop-top-right":gu(mu({},vu),{common:{transformOrigin:"top right"}})},sC=["mousedown","touchstart"];function $U(e,t,n){const r=f.useRef();return f.useEffect(()=>{const o=s=>{const{target:a}=s??{};if(Array.isArray(n)){const c=(a==null?void 0:a.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(a)&&a.tagName!=="HTML";n.every(p=>!!p&&!s.composedPath().includes(p))&&!c&&e()}else r.current&&!r.current.contains(a)&&e()};return(t||sC).forEach(s=>document.addEventListener(s,o)),()=>{(t||sC).forEach(s=>document.removeEventListener(s,o))}},[r,e,n]),r}function zU(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function LU(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function BU(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=f.useState(n?t:LU(e,t)),s=f.useRef();return f.useEffect(()=>{if("matchMedia"in window)return s.current=window.matchMedia(e),o(s.current.matches),zU(s.current,a=>o(a.matches))},[e]),r}const bj=typeof document<"u"?f.useLayoutEffect:f.useEffect;function Ps(e,t){const n=f.useRef(!1);f.useEffect(()=>()=>{n.current=!1},[]),f.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function FU({opened:e,shouldReturnFocus:t=!0}){const n=f.useRef(),r=()=>{var o;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((o=n.current)==null||o.focus({preventScroll:!0}))};return Ps(()=>{let o=-1;const s=a=>{a.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 HU=/input|select|textarea|button|object/,yj="a, input, select, textarea, button, object, [tabindex]";function WU(e){return e.style.display==="none"}function VU(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(WU(n))return!1;n=n.parentNode}return!0}function xj(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function s1(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(xj(e));return(HU.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&VU(e)}function wj(e){const t=xj(e);return(Number.isNaN(t)||t>=0)&&s1(e)}function UU(e){return Array.from(e.querySelectorAll(yj)).filter(wj)}function GU(e,t){const n=UU(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 a=n[t.shiftKey?n.length-1:0];a&&a.focus()}function dy(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function qU(e,t="body > :not(script)"){const n=dy(),r=Array.from(document.querySelectorAll(t)).map(o=>{var s;if((s=o==null?void 0:o.shadowRoot)!=null&&s.contains(e)||o.contains(e))return;const a=o.getAttribute("aria-hidden"),c=o.getAttribute("data-hidden"),d=o.getAttribute("data-focus-id");return o.setAttribute("data-focus-id",n),a===null||a==="false"?o.setAttribute("aria-hidden","true"):!c&&!d&&o.setAttribute("data-hidden",a),{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 KU(e=!0){const t=f.useRef(),n=f.useRef(null),r=s=>{let a=s.querySelector("[data-autofocus]");if(!a){const c=Array.from(s.querySelectorAll(yj));a=c.find(wj)||c.find(s1)||null,!a&&s1(s)&&(a=s)}a&&a.focus({preventScroll:!0})},o=f.useCallback(s=>{if(e){if(s===null){n.current&&(n.current(),n.current=null);return}n.current=qU(s),t.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&r(s)}),t.current=s):t.current=null)}},[e]);return f.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const s=a=>{a.key==="Tab"&&t.current&&GU(t.current,a)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),n.current&&n.current()}},[e]),o}const YU=F["useId".toString()]||(()=>{});function QU(){const e=YU();return e?`mantine-${e.replace(/:/g,"")}`:""}function fy(e){const t=QU(),[n,r]=f.useState(t);return bj(()=>{r(dy())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function aC(e,t,n){f.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function Sj(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function XU(...e){return t=>{e.forEach(n=>Sj(n,t))}}function Ad(...e){return f.useCallback(XU(...e),e)}function od({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=f.useState(t!==void 0?t:n),a=c=>{s(c),r==null||r(c)};return e!==void 0?[e,r,!0]:[o,a,!1]}function Cj(e,t){return BU("(prefers-reduced-motion: reduce)",e,t)}const JU=e=>e<.5?2*e*e:-1+(4-2*e)*e,ZU=({axis:e,target:t,parent:n,alignment:r,offset:o,isList:s})=>{if(!t||!n&&typeof document>"u")return 0;const a=!!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 v=a?d.height:window.innerHeight;if(r==="end"){const b=m+o-v+p.height;return b>=-p.height*(s?0:1)||!s?b:0}return r==="center"?m-v/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 v=a?d.width:window.innerWidth;if(r==="end"){const b=m+o-v+p.width;return b>=-p.width||!s?b:0}return r==="center"?m-v/2+p.width/2:0}return 0},eG=({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]},tG=({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 kj({duration:e=1250,axis:t="y",onScrollFinish:n,easing:r=JU,offset:o=0,cancelable:s=!0,isList:a=!1}={}){const c=f.useRef(0),d=f.useRef(0),p=f.useRef(!1),h=f.useRef(null),m=f.useRef(null),v=Cj(),b=()=>{c.current&&cancelAnimationFrame(c.current)},w=f.useCallback(({alignment:S="start"}={})=>{var k;p.current=!1,c.current&&b();const _=(k=eG({parent:h.current,axis:t}))!=null?k:0,I=ZU({parent:h.current,target:m.current,axis:t,alignment:S,offset:o,isList:a})-(h.current?0:_);function P(){d.current===0&&(d.current=performance.now());const O=performance.now()-d.current,R=v||e===0?1:O/e,M=_+I*r(R);tG({parent:h.current,axis:t,distance:M}),!p.current&&R<1?c.current=requestAnimationFrame(P):(typeof n=="function"&&n(),d.current=0,c.current=0,b())}P()},[t,e,r,a,o,n,v]),y=()=>{s&&(p.current=!0)};return aC("wheel",y,{passive:!0}),aC("touchmove",y,{passive:!0}),f.useEffect(()=>b,[]),{scrollableRef:h,targetRef:m,scrollIntoView:w,cancel:b}}var iC=Object.getOwnPropertySymbols,nG=Object.prototype.hasOwnProperty,rG=Object.prototype.propertyIsEnumerable,oG=(e,t)=>{var n={};for(var r in e)nG.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&iC)for(var r of iC(e))t.indexOf(r)<0&&rG.call(e,r)&&(n[r]=e[r]);return n};function Mm(e){const t=e,{m:n,mx:r,my:o,mt:s,mb:a,ml:c,mr:d,p,px:h,py:m,pt:v,pb:b,pl:w,pr:y,bg:S,c:k,opacity:_,ff:I,fz:P,fw:E,lts:O,ta:R,lh:M,fs:T,tt:A,td:$,w:Q,miw:B,maw:V,h:q,mih:G,mah:D,bgsz:z,bgp:H,bgr:Y,bga:ie,pos:ye,top:Z,left:oe,bottom:K,right:U,inset:ae,display:re}=t,se=oG(t,["m","mx","my","mt","mb","ml","mr","p","px","py","pt","pb","pl","pr","bg","c","opacity","ff","fz","fw","lts","ta","lh","fs","tt","td","w","miw","maw","h","mih","mah","bgsz","bgp","bgr","bga","pos","top","left","bottom","right","inset","display"]);return{systemStyles:$D({m:n,mx:r,my:o,mt:s,mb:a,ml:c,mr:d,p,px:h,py:m,pt:v,pb:b,pl:w,pr:y,bg:S,c:k,opacity:_,ff:I,fz:P,fw:E,lts:O,ta:R,lh:M,fs:T,tt:A,td:$,w:Q,miw:B,maw:V,h:q,mih:G,mah:D,bgsz:z,bgp:H,bgr:Y,bga:ie,pos:ye,top:Z,left:oe,bottom:K,right:U,inset:ae,display:re}),rest:se}}function sG(e,t){const n=Object.keys(e).filter(r=>r!=="base").sort((r,o)=>hw(Vt({size:r,sizes:t.breakpoints}))-hw(Vt({size:o,sizes:t.breakpoints})));return"base"in e?["base",...n]:n}function aG({value:e,theme:t,getValue:n,property:r}){if(e==null)return;if(typeof e=="object")return sG(e,t).reduce((a,c)=>{if(c==="base"&&e.base!==void 0){const p=n(e.base,t);return Array.isArray(r)?(r.forEach(h=>{a[h]=p}),a):(a[r]=p,a)}const d=n(e[c],t);return Array.isArray(r)?(a[t.fn.largerThan(c)]={},r.forEach(p=>{a[t.fn.largerThan(c)][p]=d}),a):(a[t.fn.largerThan(c)]={[r]:d},a)},{});const o=n(e,t);return Array.isArray(r)?r.reduce((s,a)=>(s[a]=o,s),{}):{[r]:o}}function iG(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 lG(e){return Ue(e)}function cG(e){return e}function uG(e,t){return Vt({size:e,sizes:t.fontSizes})}const dG=["-xs","-sm","-md","-lg","-xl"];function fG(e,t){return dG.includes(e)?`calc(${Vt({size:e.replace("-",""),sizes:t.spacing})} * -1)`:Vt({size:e,sizes:t.spacing})}const pG={identity:cG,color:iG,size:lG,fontSize:uG,spacing:fG},hG={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 mG=Object.defineProperty,lC=Object.getOwnPropertySymbols,gG=Object.prototype.hasOwnProperty,vG=Object.prototype.propertyIsEnumerable,cC=(e,t,n)=>t in e?mG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uC=(e,t)=>{for(var n in t||(t={}))gG.call(t,n)&&cC(e,n,t[n]);if(lC)for(var n of lC(t))vG.call(t,n)&&cC(e,n,t[n]);return e};function dC(e,t,n=hG){return Object.keys(n).reduce((o,s)=>(s in e&&e[s]!==void 0&&o.push(aG({value:e[s],getValue:pG[n[s].type],property:n[s].property,theme:t})),o),[]).reduce((o,s)=>(Object.keys(s).forEach(a=>{typeof s[a]=="object"&&s[a]!==null&&a in o?o[a]=uC(uC({},o[a]),s[a]):o[a]=s[a]}),o),{})}function fC(e,t){return typeof e=="function"?e(t):e}function bG(e,t,n){const r=Fa(),{css:o,cx:s}=vj();return Array.isArray(e)?s(n,o(dC(t,r)),e.map(a=>o(fC(a,r)))):s(n,o(fC(e,r)),o(dC(t,r)))}var yG=Object.defineProperty,rh=Object.getOwnPropertySymbols,_j=Object.prototype.hasOwnProperty,Pj=Object.prototype.propertyIsEnumerable,pC=(e,t,n)=>t in e?yG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xG=(e,t)=>{for(var n in t||(t={}))_j.call(t,n)&&pC(e,n,t[n]);if(rh)for(var n of rh(t))Pj.call(t,n)&&pC(e,n,t[n]);return e},wG=(e,t)=>{var n={};for(var r in e)_j.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&rh)for(var r of rh(e))t.indexOf(r)<0&&Pj.call(e,r)&&(n[r]=e[r]);return n};const jj=f.forwardRef((e,t)=>{var n=e,{className:r,component:o,style:s,sx:a}=n,c=wG(n,["className","component","style","sx"]);const{systemStyles:d,rest:p}=Mm(c),h=o||"div";return F.createElement(h,xG({ref:t,className:bG(a,d,r),style:s},p))});jj.displayName="@mantine/core/Box";const jo=jj;var SG=Object.defineProperty,CG=Object.defineProperties,kG=Object.getOwnPropertyDescriptors,hC=Object.getOwnPropertySymbols,_G=Object.prototype.hasOwnProperty,PG=Object.prototype.propertyIsEnumerable,mC=(e,t,n)=>t in e?SG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gC=(e,t)=>{for(var n in t||(t={}))_G.call(t,n)&&mC(e,n,t[n]);if(hC)for(var n of hC(t))PG.call(t,n)&&mC(e,n,t[n]);return e},jG=(e,t)=>CG(e,kG(t)),IG=ao(e=>({root:jG(gC(gC({},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 EG=IG;var OG=Object.defineProperty,oh=Object.getOwnPropertySymbols,Ij=Object.prototype.hasOwnProperty,Ej=Object.prototype.propertyIsEnumerable,vC=(e,t,n)=>t in e?OG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,RG=(e,t)=>{for(var n in t||(t={}))Ij.call(t,n)&&vC(e,n,t[n]);if(oh)for(var n of oh(t))Ej.call(t,n)&&vC(e,n,t[n]);return e},MG=(e,t)=>{var n={};for(var r in e)Ij.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&oh)for(var r of oh(e))t.indexOf(r)<0&&Ej.call(e,r)&&(n[r]=e[r]);return n};const Oj=f.forwardRef((e,t)=>{const n=wr("UnstyledButton",{},e),{className:r,component:o="button",unstyled:s,variant:a}=n,c=MG(n,["className","component","unstyled","variant"]),{classes:d,cx:p}=EG(null,{name:"UnstyledButton",unstyled:s,variant:a});return F.createElement(jo,RG({component:o,ref:t,className:p(d.root,r),type:o==="button"?"button":void 0},c))});Oj.displayName="@mantine/core/UnstyledButton";const DG=Oj;var TG=Object.defineProperty,AG=Object.defineProperties,NG=Object.getOwnPropertyDescriptors,bC=Object.getOwnPropertySymbols,$G=Object.prototype.hasOwnProperty,zG=Object.prototype.propertyIsEnumerable,yC=(e,t,n)=>t in e?TG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,a1=(e,t)=>{for(var n in t||(t={}))$G.call(t,n)&&yC(e,n,t[n]);if(bC)for(var n of bC(t))zG.call(t,n)&&yC(e,n,t[n]);return e},xC=(e,t)=>AG(e,NG(t));const LG=["subtle","filled","outline","light","default","transparent","gradient"],Zf={xs:Ue(18),sm:Ue(22),md:Ue(28),lg:Ue(34),xl:Ue(44)};function BG({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%"})}:LG.includes(e)?a1({border:`${Ue(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover})):null}var FG=ao((e,{radius:t,color:n,gradient:r},{variant:o,size:s})=>({root:xC(a1({position:"relative",borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",height:Vt({size:s,sizes:Zf}),minHeight:Vt({size:s,sizes:Zf}),width:Vt({size:s,sizes:Zf}),minWidth:Vt({size:s,sizes:Zf})},BG({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":xC(a1({content:'""'},e.fn.cover(Ue(-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 HG=FG;var WG=Object.defineProperty,sh=Object.getOwnPropertySymbols,Rj=Object.prototype.hasOwnProperty,Mj=Object.prototype.propertyIsEnumerable,wC=(e,t,n)=>t in e?WG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SC=(e,t)=>{for(var n in t||(t={}))Rj.call(t,n)&&wC(e,n,t[n]);if(sh)for(var n of sh(t))Mj.call(t,n)&&wC(e,n,t[n]);return e},CC=(e,t)=>{var n={};for(var r in e)Rj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&sh)for(var r of sh(e))t.indexOf(r)<0&&Mj.call(e,r)&&(n[r]=e[r]);return n};function VG(e){var t=e,{size:n,color:r}=t,o=CC(t,["size","color"]);const s=o,{style:a}=s,c=CC(s,["style"]);return F.createElement("svg",SC({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:r,style:SC({width:n},a)},c),F.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},F.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"}),F.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"})),F.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},F.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"}),F.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"})),F.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},F.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),F.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),F.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},F.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"}),F.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"})),F.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},F.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"}),F.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 UG=Object.defineProperty,ah=Object.getOwnPropertySymbols,Dj=Object.prototype.hasOwnProperty,Tj=Object.prototype.propertyIsEnumerable,kC=(e,t,n)=>t in e?UG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_C=(e,t)=>{for(var n in t||(t={}))Dj.call(t,n)&&kC(e,n,t[n]);if(ah)for(var n of ah(t))Tj.call(t,n)&&kC(e,n,t[n]);return e},PC=(e,t)=>{var n={};for(var r in e)Dj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ah)for(var r of ah(e))t.indexOf(r)<0&&Tj.call(e,r)&&(n[r]=e[r]);return n};function GG(e){var t=e,{size:n,color:r}=t,o=PC(t,["size","color"]);const s=o,{style:a}=s,c=PC(s,["style"]);return F.createElement("svg",_C({viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:r,style:_C({width:n,height:n},a)},c),F.createElement("g",{fill:"none",fillRule:"evenodd"},F.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},F.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),F.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},F.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}var qG=Object.defineProperty,ih=Object.getOwnPropertySymbols,Aj=Object.prototype.hasOwnProperty,Nj=Object.prototype.propertyIsEnumerable,jC=(e,t,n)=>t in e?qG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,IC=(e,t)=>{for(var n in t||(t={}))Aj.call(t,n)&&jC(e,n,t[n]);if(ih)for(var n of ih(t))Nj.call(t,n)&&jC(e,n,t[n]);return e},EC=(e,t)=>{var n={};for(var r in e)Aj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ih)for(var r of ih(e))t.indexOf(r)<0&&Nj.call(e,r)&&(n[r]=e[r]);return n};function KG(e){var t=e,{size:n,color:r}=t,o=EC(t,["size","color"]);const s=o,{style:a}=s,c=EC(s,["style"]);return F.createElement("svg",IC({viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:r,style:IC({width:n},a)},c),F.createElement("circle",{cx:"15",cy:"15",r:"15"},F.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),F.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),F.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},F.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),F.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),F.createElement("circle",{cx:"105",cy:"15",r:"15"},F.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),F.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var YG=Object.defineProperty,lh=Object.getOwnPropertySymbols,$j=Object.prototype.hasOwnProperty,zj=Object.prototype.propertyIsEnumerable,OC=(e,t,n)=>t in e?YG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QG=(e,t)=>{for(var n in t||(t={}))$j.call(t,n)&&OC(e,n,t[n]);if(lh)for(var n of lh(t))zj.call(t,n)&&OC(e,n,t[n]);return e},XG=(e,t)=>{var n={};for(var r in e)$j.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&lh)for(var r of lh(e))t.indexOf(r)<0&&zj.call(e,r)&&(n[r]=e[r]);return n};const U0={bars:VG,oval:GG,dots:KG},JG={xs:Ue(18),sm:Ue(22),md:Ue(36),lg:Ue(44),xl:Ue(58)},ZG={size:"md"};function Lj(e){const t=wr("Loader",ZG,e),{size:n,color:r,variant:o}=t,s=XG(t,["size","color","variant"]),a=Fa(),c=o in U0?o:a.loader;return F.createElement(jo,QG({role:"presentation",component:U0[c]||U0.bars,size:Vt({size:n,sizes:JG}),color:a.fn.variant({variant:"filled",primaryFallback:!1,color:r||a.primaryColor}).background},s))}Lj.displayName="@mantine/core/Loader";var eq=Object.defineProperty,ch=Object.getOwnPropertySymbols,Bj=Object.prototype.hasOwnProperty,Fj=Object.prototype.propertyIsEnumerable,RC=(e,t,n)=>t in e?eq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,MC=(e,t)=>{for(var n in t||(t={}))Bj.call(t,n)&&RC(e,n,t[n]);if(ch)for(var n of ch(t))Fj.call(t,n)&&RC(e,n,t[n]);return e},tq=(e,t)=>{var n={};for(var r in e)Bj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ch)for(var r of ch(e))t.indexOf(r)<0&&Fj.call(e,r)&&(n[r]=e[r]);return n};const nq={color:"gray",size:"md",variant:"subtle"},Hj=f.forwardRef((e,t)=>{const n=wr("ActionIcon",nq,e),{className:r,color:o,children:s,radius:a,size:c,variant:d,gradient:p,disabled:h,loaderProps:m,loading:v,unstyled:b,__staticSelector:w}=n,y=tq(n,["className","color","children","radius","size","variant","gradient","disabled","loaderProps","loading","unstyled","__staticSelector"]),{classes:S,cx:k,theme:_}=HG({radius:a,color:o,gradient:p},{name:["ActionIcon",w],unstyled:b,size:c,variant:d}),I=F.createElement(Lj,MC({color:_.fn.variant({color:o,variant:d}).color,size:"100%","data-action-icon-loader":!0},m));return F.createElement(DG,MC({className:k(S.root,r),ref:t,disabled:h,"data-disabled":h||void 0,"data-loading":v||void 0,unstyled:b},y),v?I:s)});Hj.displayName="@mantine/core/ActionIcon";const rq=Hj;var oq=Object.defineProperty,sq=Object.defineProperties,aq=Object.getOwnPropertyDescriptors,uh=Object.getOwnPropertySymbols,Wj=Object.prototype.hasOwnProperty,Vj=Object.prototype.propertyIsEnumerable,DC=(e,t,n)=>t in e?oq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,iq=(e,t)=>{for(var n in t||(t={}))Wj.call(t,n)&&DC(e,n,t[n]);if(uh)for(var n of uh(t))Vj.call(t,n)&&DC(e,n,t[n]);return e},lq=(e,t)=>sq(e,aq(t)),cq=(e,t)=>{var n={};for(var r in e)Wj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&uh)for(var r of uh(e))t.indexOf(r)<0&&Vj.call(e,r)&&(n[r]=e[r]);return n};function Uj(e){const t=wr("Portal",{},e),{children:n,target:r,className:o,innerRef:s}=t,a=cq(t,["children","target","className","innerRef"]),c=Fa(),[d,p]=f.useState(!1),h=f.useRef();return bj(()=>(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?_i.createPortal(F.createElement("div",lq(iq({className:o,dir:c.dir},a),{ref:s}),n),h.current):null}Uj.displayName="@mantine/core/Portal";var uq=Object.defineProperty,dh=Object.getOwnPropertySymbols,Gj=Object.prototype.hasOwnProperty,qj=Object.prototype.propertyIsEnumerable,TC=(e,t,n)=>t in e?uq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dq=(e,t)=>{for(var n in t||(t={}))Gj.call(t,n)&&TC(e,n,t[n]);if(dh)for(var n of dh(t))qj.call(t,n)&&TC(e,n,t[n]);return e},fq=(e,t)=>{var n={};for(var r in e)Gj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&dh)for(var r of dh(e))t.indexOf(r)<0&&qj.call(e,r)&&(n[r]=e[r]);return n};function Kj(e){var t=e,{withinPortal:n=!0,children:r}=t,o=fq(t,["withinPortal","children"]);return n?F.createElement(Uj,dq({},o),r):F.createElement(F.Fragment,null,r)}Kj.displayName="@mantine/core/OptionalPortal";var pq=Object.defineProperty,fh=Object.getOwnPropertySymbols,Yj=Object.prototype.hasOwnProperty,Qj=Object.prototype.propertyIsEnumerable,AC=(e,t,n)=>t in e?pq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,NC=(e,t)=>{for(var n in t||(t={}))Yj.call(t,n)&&AC(e,n,t[n]);if(fh)for(var n of fh(t))Qj.call(t,n)&&AC(e,n,t[n]);return e},hq=(e,t)=>{var n={};for(var r in e)Yj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&fh)for(var r of fh(e))t.indexOf(r)<0&&Qj.call(e,r)&&(n[r]=e[r]);return n};function Xj(e){const t=e,{width:n,height:r,style:o}=t,s=hq(t,["width","height","style"]);return F.createElement("svg",NC({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:NC({width:n,height:r},o)},s),F.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"}))}Xj.displayName="@mantine/core/CloseIcon";var mq=Object.defineProperty,ph=Object.getOwnPropertySymbols,Jj=Object.prototype.hasOwnProperty,Zj=Object.prototype.propertyIsEnumerable,$C=(e,t,n)=>t in e?mq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gq=(e,t)=>{for(var n in t||(t={}))Jj.call(t,n)&&$C(e,n,t[n]);if(ph)for(var n of ph(t))Zj.call(t,n)&&$C(e,n,t[n]);return e},vq=(e,t)=>{var n={};for(var r in e)Jj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ph)for(var r of ph(e))t.indexOf(r)<0&&Zj.call(e,r)&&(n[r]=e[r]);return n};const bq={xs:Ue(12),sm:Ue(16),md:Ue(20),lg:Ue(28),xl:Ue(34)},yq={size:"sm"},eI=f.forwardRef((e,t)=>{const n=wr("CloseButton",yq,e),{iconSize:r,size:o,children:s}=n,a=vq(n,["iconSize","size","children"]),c=Ue(r||bq[o]);return F.createElement(rq,gq({ref:t,__staticSelector:"CloseButton",size:o},a),s||F.createElement(Xj,{width:c,height:c}))});eI.displayName="@mantine/core/CloseButton";const tI=eI;var xq=Object.defineProperty,wq=Object.defineProperties,Sq=Object.getOwnPropertyDescriptors,zC=Object.getOwnPropertySymbols,Cq=Object.prototype.hasOwnProperty,kq=Object.prototype.propertyIsEnumerable,LC=(e,t,n)=>t in e?xq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ep=(e,t)=>{for(var n in t||(t={}))Cq.call(t,n)&&LC(e,n,t[n]);if(zC)for(var n of zC(t))kq.call(t,n)&&LC(e,n,t[n]);return e},_q=(e,t)=>wq(e,Sq(t));function Pq({underline:e,strikethrough:t}){const n=[];return e&&n.push("underline"),t&&n.push("line-through"),n.length>0?n.join(" "):"none"}function jq({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 Iq(e){return typeof e=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}function Eq({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 Oq=ao((e,{color:t,lineClamp:n,truncate:r,inline:o,inherit:s,underline:a,gradient:c,weight:d,transform:p,align:h,strikethrough:m,italic:v},{size:b})=>{const w=e.fn.variant({variant:"gradient",gradient:c});return{root:_q(ep(ep(ep(ep({},e.fn.fontStyles()),e.fn.focusStyles()),Iq(n)),Eq({theme:e,truncate:r})),{color:jq({color:t,theme:e}),fontFamily:s?"inherit":e.fontFamily,fontSize:s||b===void 0?"inherit":Vt({size:b,sizes:e.fontSizes}),lineHeight:s?"inherit":o?1:e.lineHeight,textDecoration:Pq({underline:a,strikethrough:m}),WebkitTapHighlightColor:"transparent",fontWeight:s?"inherit":d,textTransform:p,textAlign:h,fontStyle:v?"italic":void 0}),gradient:{backgroundImage:w.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}});const Rq=Oq;var Mq=Object.defineProperty,hh=Object.getOwnPropertySymbols,nI=Object.prototype.hasOwnProperty,rI=Object.prototype.propertyIsEnumerable,BC=(e,t,n)=>t in e?Mq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dq=(e,t)=>{for(var n in t||(t={}))nI.call(t,n)&&BC(e,n,t[n]);if(hh)for(var n of hh(t))rI.call(t,n)&&BC(e,n,t[n]);return e},Tq=(e,t)=>{var n={};for(var r in e)nI.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&hh)for(var r of hh(e))t.indexOf(r)<0&&rI.call(e,r)&&(n[r]=e[r]);return n};const Aq={variant:"text"},oI=f.forwardRef((e,t)=>{const n=wr("Text",Aq,e),{className:r,size:o,weight:s,transform:a,color:c,align:d,variant:p,lineClamp:h,truncate:m,gradient:v,inline:b,inherit:w,underline:y,strikethrough:S,italic:k,classNames:_,styles:I,unstyled:P,span:E,__staticSelector:O}=n,R=Tq(n,["className","size","weight","transform","color","align","variant","lineClamp","truncate","gradient","inline","inherit","underline","strikethrough","italic","classNames","styles","unstyled","span","__staticSelector"]),{classes:M,cx:T}=Rq({color:c,lineClamp:h,truncate:m,inline:b,inherit:w,underline:y,strikethrough:S,italic:k,weight:s,transform:a,align:d,gradient:v},{unstyled:P,name:O||"Text",variant:p,size:o});return F.createElement(jo,Dq({ref:t,className:T(M.root,{[M.gradient]:p==="gradient"},r),component:E?"span":"div"},R))});oI.displayName="@mantine/core/Text";const Sc=oI,tp={xs:Ue(1),sm:Ue(2),md:Ue(3),lg:Ue(4),xl:Ue(5)};function np(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=ao((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:Ue(1),borderTop:`${Vt({size:n,sizes:tp})} ${r} ${np(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${Vt({size:n,sizes:tp})} ${r} ${np(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:Ue(Vt({size:n,sizes:tp})),borderTopColor:np(e,t),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"auto",borderLeftWidth:Ue(Vt({size:n,sizes:tp})),borderLeftColor:np(e,t),borderLeftStyle:r}}));const $q=Nq;var zq=Object.defineProperty,Lq=Object.defineProperties,Bq=Object.getOwnPropertyDescriptors,mh=Object.getOwnPropertySymbols,sI=Object.prototype.hasOwnProperty,aI=Object.prototype.propertyIsEnumerable,FC=(e,t,n)=>t in e?zq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,HC=(e,t)=>{for(var n in t||(t={}))sI.call(t,n)&&FC(e,n,t[n]);if(mh)for(var n of mh(t))aI.call(t,n)&&FC(e,n,t[n]);return e},Fq=(e,t)=>Lq(e,Bq(t)),Hq=(e,t)=>{var n={};for(var r in e)sI.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mh)for(var r of mh(e))t.indexOf(r)<0&&aI.call(e,r)&&(n[r]=e[r]);return n};const Wq={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},i1=f.forwardRef((e,t)=>{const n=wr("Divider",Wq,e),{className:r,color:o,orientation:s,size:a,label:c,labelPosition:d,labelProps:p,variant:h,styles:m,classNames:v,unstyled:b}=n,w=Hq(n,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames","unstyled"]),{classes:y,cx:S}=$q({color:o},{classNames:v,styles:m,unstyled:b,name:"Divider",variant:h,size:a}),k=s==="vertical",_=s==="horizontal",I=!!c&&_,P=!(p!=null&&p.color);return F.createElement(jo,HC({ref:t,className:S(y.root,{[y.vertical]:k,[y.horizontal]:_,[y.withLabel]:I},r),role:"separator"},w),I&&F.createElement(Sc,Fq(HC({},p),{size:(p==null?void 0:p.size)||"xs",mt:Ue(2),className:S(y.label,y[d],{[y.labelDefaultStyles]:P})}),c))});i1.displayName="@mantine/core/Divider";var Vq=Object.defineProperty,Uq=Object.defineProperties,Gq=Object.getOwnPropertyDescriptors,WC=Object.getOwnPropertySymbols,qq=Object.prototype.hasOwnProperty,Kq=Object.prototype.propertyIsEnumerable,VC=(e,t,n)=>t in e?Vq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,UC=(e,t)=>{for(var n in t||(t={}))qq.call(t,n)&&VC(e,n,t[n]);if(WC)for(var n of WC(t))Kq.call(t,n)&&VC(e,n,t[n]);return e},Yq=(e,t)=>Uq(e,Gq(t)),Qq=ao((e,t,{size:n})=>({item:Yq(UC({},e.fn.fontStyles()),{boxSizing:"border-box",wordBreak:"break-all",textAlign:"left",width:"100%",padding:`calc(${Vt({size:n,sizes:e.spacing})} / 1.5) ${Vt({size:n,sizes:e.spacing})}`,cursor:"pointer",fontSize:Vt({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]":UC({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(${Vt({size:n,sizes:e.spacing})} / 2)`,paddingBottom:`calc(${Vt({size:n,sizes:e.spacing})} / 2)`,textAlign:"center"},separator:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`calc(${Vt({size:n,sizes:e.spacing})} / 1.5) ${Vt({size:n,sizes:e.spacing})}`},separatorLabel:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}));const Xq=Qq;var Jq=Object.defineProperty,GC=Object.getOwnPropertySymbols,Zq=Object.prototype.hasOwnProperty,eK=Object.prototype.propertyIsEnumerable,qC=(e,t,n)=>t in e?Jq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tK=(e,t)=>{for(var n in t||(t={}))Zq.call(t,n)&&qC(e,n,t[n]);if(GC)for(var n of GC(t))eK.call(t,n)&&qC(e,n,t[n]);return e};function py({data:e,hovered:t,classNames:n,styles:r,isItemSelected:o,uuid:s,__staticSelector:a,onItemHover:c,onItemSelect:d,itemsRefs:p,itemComponent:h,size:m,nothingFound:v,creatable:b,createLabel:w,unstyled:y,variant:S}){const{classes:k}=Xq(null,{classNames:n,styles:r,unstyled:y,name:a,variant:S,size:m}),_=[],I=[];let P=null;const E=(R,M)=>{const T=typeof o=="function"?o(R.value):!1;return F.createElement(h,tK({key:R.value,className:k.item,"data-disabled":R.disabled||void 0,"data-hovered":!R.disabled&&t===M||void 0,"data-selected":!R.disabled&&T||void 0,selected:T,onMouseEnter:()=>c(M),id:`${s}-${M}`,role:"option",tabIndex:-1,"aria-selected":t===M,ref:A=>{p&&p.current&&(p.current[R.value]=A)},onMouseDown:R.disabled?null:A=>{A.preventDefault(),d(R)},disabled:R.disabled,variant:S},R))};let O=null;if(e.forEach((R,M)=>{R.creatable?P=M:R.group?(O!==R.group&&(O=R.group,I.push(F.createElement("div",{className:k.separator,key:`__mantine-divider-${M}`},F.createElement(i1,{classNames:{label:k.separatorLabel},label:R.group})))),I.push(E(R,M))):_.push(E(R,M))}),b){const R=e[P];_.push(F.createElement("div",{key:dy(),className:k.item,"data-hovered":t===P||void 0,onMouseEnter:()=>c(P),onMouseDown:M=>{M.preventDefault(),d(R)},tabIndex:-1,ref:M=>{p&&p.current&&(p.current[R.value]=M)}},w))}return I.length>0&&_.length>0&&_.unshift(F.createElement("div",{className:k.separator,key:"empty-group-separator"},F.createElement(i1,null))),I.length>0||_.length>0?F.createElement(F.Fragment,null,I,_):F.createElement(Sc,{size:m,unstyled:y,className:k.nothingFound},v)}py.displayName="@mantine/core/SelectItems";var nK=Object.defineProperty,gh=Object.getOwnPropertySymbols,iI=Object.prototype.hasOwnProperty,lI=Object.prototype.propertyIsEnumerable,KC=(e,t,n)=>t in e?nK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rK=(e,t)=>{for(var n in t||(t={}))iI.call(t,n)&&KC(e,n,t[n]);if(gh)for(var n of gh(t))lI.call(t,n)&&KC(e,n,t[n]);return e},oK=(e,t)=>{var n={};for(var r in e)iI.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gh)for(var r of gh(e))t.indexOf(r)<0&&lI.call(e,r)&&(n[r]=e[r]);return n};const hy=f.forwardRef((e,t)=>{var n=e,{label:r,value:o}=n,s=oK(n,["label","value"]);return F.createElement("div",rK({ref:t},s),r||o)});hy.displayName="@mantine/core/DefaultItem";function sK(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function cI(...e){return t=>e.forEach(n=>sK(n,t))}function vl(...e){return f.useCallback(cI(...e),e)}const uI=f.forwardRef((e,t)=>{const{children:n,...r}=e,o=f.Children.toArray(n),s=o.find(iK);if(s){const a=s.props.children,c=o.map(d=>d===s?f.Children.count(a)>1?f.Children.only(null):f.isValidElement(a)?a.props.children:null:d);return f.createElement(l1,or({},r,{ref:t}),f.isValidElement(a)?f.cloneElement(a,void 0,c):null)}return f.createElement(l1,or({},r,{ref:t}),n)});uI.displayName="Slot";const l1=f.forwardRef((e,t)=>{const{children:n,...r}=e;return f.isValidElement(n)?f.cloneElement(n,{...lK(r,n.props),ref:cI(t,n.ref)}):f.Children.count(n)>1?f.Children.only(null):null});l1.displayName="SlotClone";const aK=({children:e})=>f.createElement(f.Fragment,null,e);function iK(e){return f.isValidElement(e)&&e.type===aK}function lK(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 cK=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],Nd=cK.reduce((e,t)=>{const n=f.forwardRef((r,o)=>{const{asChild:s,...a}=r,c=s?uI:t;return f.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),f.createElement(c,or({},a,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),c1=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{};function uK(e,t){return f.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const $d=e=>{const{present:t,children:n}=e,r=dK(t),o=typeof n=="function"?n({present:r.isPresent}):f.Children.only(n),s=vl(r.ref,o.ref);return typeof n=="function"||r.isPresent?f.cloneElement(o,{ref:s}):null};$d.displayName="Presence";function dK(e){const[t,n]=f.useState(),r=f.useRef({}),o=f.useRef(e),s=f.useRef("none"),a=e?"mounted":"unmounted",[c,d]=uK(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const p=rp(r.current);s.current=c==="mounted"?p:"none"},[c]),c1(()=>{const p=r.current,h=o.current;if(h!==e){const v=s.current,b=rp(p);e?d("MOUNT"):b==="none"||(p==null?void 0:p.display)==="none"?d("UNMOUNT"):d(h&&v!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),c1(()=>{if(t){const p=m=>{const b=rp(r.current).includes(m.animationName);m.target===t&&b&&_i.flushSync(()=>d("ANIMATION_END"))},h=m=>{m.target===t&&(s.current=rp(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:f.useCallback(p=>{p&&(r.current=getComputedStyle(p)),n(p)},[])}}function rp(e){return(e==null?void 0:e.animationName)||"none"}function fK(e,t=[]){let n=[];function r(s,a){const c=f.createContext(a),d=n.length;n=[...n,a];function p(m){const{scope:v,children:b,...w}=m,y=(v==null?void 0:v[e][d])||c,S=f.useMemo(()=>w,Object.values(w));return f.createElement(y.Provider,{value:S},b)}function h(m,v){const b=(v==null?void 0:v[e][d])||c,w=f.useContext(b);if(w)return w;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${s}\``)}return p.displayName=s+"Provider",[p,h]}const o=()=>{const s=n.map(a=>f.createContext(a));return function(c){const d=(c==null?void 0:c[e])||s;return f.useMemo(()=>({[`__scope${e}`]:{...c,[e]:d}}),[c,d])}};return o.scopeName=e,[r,pK(o,...t)]}function pK(...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 a=r.reduce((c,{useScope:d,scopeName:p})=>{const m=d(s)[`__scope${p}`];return{...c,...m}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Ui(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const hK=f.createContext(void 0);function mK(e){const t=f.useContext(hK);return e||t||"ltr"}function gK(e,[t,n]){return Math.min(n,Math.max(t,e))}function Zi(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 vK(e,t){return f.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const dI="ScrollArea",[fI,bde]=fK(dI),[bK,ds]=fI(dI),yK=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...a}=e,[c,d]=f.useState(null),[p,h]=f.useState(null),[m,v]=f.useState(null),[b,w]=f.useState(null),[y,S]=f.useState(null),[k,_]=f.useState(0),[I,P]=f.useState(0),[E,O]=f.useState(!1),[R,M]=f.useState(!1),T=vl(t,$=>d($)),A=mK(o);return f.createElement(bK,{scope:n,type:r,dir:A,scrollHideDelay:s,scrollArea:c,viewport:p,onViewportChange:h,content:m,onContentChange:v,scrollbarX:b,onScrollbarXChange:w,scrollbarXEnabled:E,onScrollbarXEnabledChange:O,scrollbarY:y,onScrollbarYChange:S,scrollbarYEnabled:R,onScrollbarYEnabledChange:M,onCornerWidthChange:_,onCornerHeightChange:P},f.createElement(Nd.div,or({dir:A},a,{ref:T,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":I+"px",...e.style}})))}),xK="ScrollAreaViewport",wK=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,s=ds(xK,n),a=f.useRef(null),c=vl(t,a,s.onViewportChange);return f.createElement(f.Fragment,null,f.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}"}}),f.createElement(Nd.div,or({"data-radix-scroll-area-viewport":""},o,{ref:c,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style}}),f.createElement("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),Wa="ScrollAreaScrollbar",SK=f.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ds(Wa,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:a}=o,c=e.orientation==="horizontal";return f.useEffect(()=>(c?s(!0):a(!0),()=>{c?s(!1):a(!1)}),[c,s,a]),o.type==="hover"?f.createElement(CK,or({},r,{ref:t,forceMount:n})):o.type==="scroll"?f.createElement(kK,or({},r,{ref:t,forceMount:n})):o.type==="auto"?f.createElement(pI,or({},r,{ref:t,forceMount:n})):o.type==="always"?f.createElement(my,or({},r,{ref:t})):null}),CK=f.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ds(Wa,e.__scopeScrollArea),[s,a]=f.useState(!1);return f.useEffect(()=>{const c=o.scrollArea;let d=0;if(c){const p=()=>{window.clearTimeout(d),a(!0)},h=()=>{d=window.setTimeout(()=>a(!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]),f.createElement($d,{present:n||s},f.createElement(pI,or({"data-state":s?"visible":"hidden"},r,{ref:t})))}),kK=f.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ds(Wa,e.__scopeScrollArea),s=e.orientation==="horizontal",a=Tm(()=>d("SCROLL_END"),100),[c,d]=vK("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 f.useEffect(()=>{if(c==="idle"){const p=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[c,o.scrollHideDelay,d]),f.useEffect(()=>{const p=o.viewport,h=s?"scrollLeft":"scrollTop";if(p){let m=p[h];const v=()=>{const b=p[h];m!==b&&(d("SCROLL"),a()),m=b};return p.addEventListener("scroll",v),()=>p.removeEventListener("scroll",v)}},[o.viewport,s,d,a]),f.createElement($d,{present:n||c!=="hidden"},f.createElement(my,or({"data-state":c==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:Zi(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Zi(e.onPointerLeave,()=>d("POINTER_LEAVE"))})))}),pI=f.forwardRef((e,t)=>{const n=ds(Wa,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,a]=f.useState(!1),c=e.orientation==="horizontal",d=Tm(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=ds(Wa,e.__scopeScrollArea),s=f.useRef(null),a=f.useRef(0),[c,d]=f.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=vI(c.viewport,c.content),h={...r,sizes:c,onSizesChange:d,hasThumb:p>0&&p<1,onThumbChange:v=>s.current=v,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:v=>a.current=v};function m(v,b){return MK(v,a.current,c,b)}return n==="horizontal"?f.createElement(_K,or({},h,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const v=o.viewport.scrollLeft,b=YC(v,c,o.dir);s.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:v=>{o.viewport&&(o.viewport.scrollLeft=v)},onDragScroll:v=>{o.viewport&&(o.viewport.scrollLeft=m(v,o.dir))}})):n==="vertical"?f.createElement(PK,or({},h,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const v=o.viewport.scrollTop,b=YC(v,c);s.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:v=>{o.viewport&&(o.viewport.scrollTop=v)},onDragScroll:v=>{o.viewport&&(o.viewport.scrollTop=m(v))}})):null}),_K=f.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=ds(Wa,e.__scopeScrollArea),[a,c]=f.useState(),d=f.useRef(null),p=vl(t,d,s.onScrollbarXChange);return f.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),f.createElement(mI,or({"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":Dm(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,m)=>{if(s.viewport){const v=s.viewport.scrollLeft+h.deltaX;e.onWheelScroll(v),yI(v,m)&&h.preventDefault()}},onResize:()=>{d.current&&s.viewport&&a&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:vh(a.paddingLeft),paddingEnd:vh(a.paddingRight)}})}}))}),PK=f.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=ds(Wa,e.__scopeScrollArea),[a,c]=f.useState(),d=f.useRef(null),p=vl(t,d,s.onScrollbarYChange);return f.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),f.createElement(mI,or({"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":Dm(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,m)=>{if(s.viewport){const v=s.viewport.scrollTop+h.deltaY;e.onWheelScroll(v),yI(v,m)&&h.preventDefault()}},onResize:()=>{d.current&&s.viewport&&a&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:vh(a.paddingTop),paddingEnd:vh(a.paddingBottom)}})}}))}),[jK,hI]=fI(Wa),mI=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:a,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:p,onWheelScroll:h,onResize:m,...v}=e,b=ds(Wa,n),[w,y]=f.useState(null),S=vl(t,T=>y(T)),k=f.useRef(null),_=f.useRef(""),I=b.viewport,P=r.content-r.viewport,E=Ui(h),O=Ui(d),R=Tm(m,10);function M(T){if(k.current){const A=T.clientX-k.current.left,$=T.clientY-k.current.top;p({x:A,y:$})}}return f.useEffect(()=>{const T=A=>{const $=A.target;(w==null?void 0:w.contains($))&&E(A,P)};return document.addEventListener("wheel",T,{passive:!1}),()=>document.removeEventListener("wheel",T,{passive:!1})},[I,w,P,E]),f.useEffect(O,[r,O]),Cc(w,R),Cc(b.content,R),f.createElement(jK,{scope:n,scrollbar:w,hasThumb:o,onThumbChange:Ui(s),onThumbPointerUp:Ui(a),onThumbPositionChange:O,onThumbPointerDown:Ui(c)},f.createElement(Nd.div,or({},v,{ref:S,style:{position:"absolute",...v.style},onPointerDown:Zi(e.onPointerDown,T=>{T.button===0&&(T.target.setPointerCapture(T.pointerId),k.current=w.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",M(T))}),onPointerMove:Zi(e.onPointerMove,M),onPointerUp:Zi(e.onPointerUp,T=>{const A=T.target;A.hasPointerCapture(T.pointerId)&&A.releasePointerCapture(T.pointerId),document.body.style.webkitUserSelect=_.current,k.current=null})})))}),u1="ScrollAreaThumb",IK=f.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=hI(u1,e.__scopeScrollArea);return f.createElement($d,{present:n||o.hasThumb},f.createElement(EK,or({ref:t},r)))}),EK=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=ds(u1,n),a=hI(u1,n),{onThumbPositionChange:c}=a,d=vl(t,m=>a.onThumbChange(m)),p=f.useRef(),h=Tm(()=>{p.current&&(p.current(),p.current=void 0)},100);return f.useEffect(()=>{const m=s.viewport;if(m){const v=()=>{if(h(),!p.current){const b=DK(m,c);p.current=b,c()}};return c(),m.addEventListener("scroll",v),()=>m.removeEventListener("scroll",v)}},[s.viewport,h,c]),f.createElement(Nd.div,or({"data-state":a.hasThumb?"visible":"hidden"},o,{ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Zi(e.onPointerDownCapture,m=>{const b=m.target.getBoundingClientRect(),w=m.clientX-b.left,y=m.clientY-b.top;a.onThumbPointerDown({x:w,y})}),onPointerUp:Zi(e.onPointerUp,a.onThumbPointerUp)}))}),gI="ScrollAreaCorner",OK=f.forwardRef((e,t)=>{const n=ds(gI,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?f.createElement(RK,or({},e,{ref:t})):null}),RK=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=ds(gI,n),[s,a]=f.useState(0),[c,d]=f.useState(0),p=!!(s&&c);return Cc(o.scrollbarX,()=>{var h;const m=((h=o.scrollbarX)===null||h===void 0?void 0:h.offsetHeight)||0;o.onCornerHeightChange(m),d(m)}),Cc(o.scrollbarY,()=>{var h;const m=((h=o.scrollbarY)===null||h===void 0?void 0:h.offsetWidth)||0;o.onCornerWidthChange(m),a(m)}),p?f.createElement(Nd.div,or({},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 vh(e){return e?parseInt(e,10):0}function vI(e,t){const n=e/t;return isNaN(n)?0:n}function Dm(e){const t=vI(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function MK(e,t,n,r="ltr"){const o=Dm(n),s=o/2,a=t||s,c=o-a,d=n.scrollbar.paddingStart+a,p=n.scrollbar.size-n.scrollbar.paddingEnd-c,h=n.content-n.viewport,m=r==="ltr"?[0,h]:[h*-1,0];return bI([d,p],m)(e)}function YC(e,t,n="ltr"){const r=Dm(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,a=t.content-t.viewport,c=s-r,d=n==="ltr"?[0,a]:[a*-1,0],p=gK(e,d);return bI([0,a],[0,c])(p)}function bI(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 yI(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},a=n.left!==s.left,c=n.top!==s.top;(a||c)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function Tm(e,t){const n=Ui(e),r=f.useRef(0);return f.useEffect(()=>()=>window.clearTimeout(r.current),[]),f.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Cc(e,t){const n=Ui(t);c1(()=>{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 TK=yK,AK=wK,QC=SK,XC=IK,NK=OK;var $K=ao((e,{scrollbarSize:t,offsetScrollbars:n,scrollbarHovered:r,hidden:o})=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:n?Ue(t):void 0,paddingBottom:n?Ue(t):void 0},scrollbar:{display:o?"none":"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:`calc(${Ue(t)} / 5)`,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.colors.gray[0],[`& .${nC("thumb")}`]:{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.5):e.fn.rgba(e.black,.5)}},'&[data-orientation="vertical"]':{width:Ue(t)},'&[data-orientation="horizontal"]':{flexDirection:"column",height:Ue(t)},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:nC("thumb"),flex:1,backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.4):e.fn.rgba(e.black,.4),borderRadius:Ue(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:Ue(44),minHeight:Ue(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 zK=$K;var LK=Object.defineProperty,BK=Object.defineProperties,FK=Object.getOwnPropertyDescriptors,bh=Object.getOwnPropertySymbols,xI=Object.prototype.hasOwnProperty,wI=Object.prototype.propertyIsEnumerable,JC=(e,t,n)=>t in e?LK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d1=(e,t)=>{for(var n in t||(t={}))xI.call(t,n)&&JC(e,n,t[n]);if(bh)for(var n of bh(t))wI.call(t,n)&&JC(e,n,t[n]);return e},SI=(e,t)=>BK(e,FK(t)),CI=(e,t)=>{var n={};for(var r in e)xI.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&bh)for(var r of bh(e))t.indexOf(r)<0&&wI.call(e,r)&&(n[r]=e[r]);return n};const kI={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},Am=f.forwardRef((e,t)=>{const n=wr("ScrollArea",kI,e),{children:r,className:o,classNames:s,styles:a,scrollbarSize:c,scrollHideDelay:d,type:p,dir:h,offsetScrollbars:m,viewportRef:v,onScrollPositionChange:b,unstyled:w,variant:y,viewportProps:S}=n,k=CI(n,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","variant","viewportProps"]),[_,I]=f.useState(!1),P=Fa(),{classes:E,cx:O}=zK({scrollbarSize:c,offsetScrollbars:m,scrollbarHovered:_,hidden:p==="never"},{name:"ScrollArea",classNames:s,styles:a,unstyled:w,variant:y});return F.createElement(TK,{type:p==="never"?"always":p,scrollHideDelay:d,dir:h||P.dir,ref:t,asChild:!0},F.createElement(jo,d1({className:O(E.root,o)},k),F.createElement(AK,SI(d1({},S),{className:E.viewport,ref:v,onScroll:typeof b=="function"?({currentTarget:R})=>b({x:R.scrollLeft,y:R.scrollTop}):void 0}),r),F.createElement(QC,{orientation:"horizontal",className:E.scrollbar,forceMount:!0,onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1)},F.createElement(XC,{className:E.thumb})),F.createElement(QC,{orientation:"vertical",className:E.scrollbar,forceMount:!0,onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1)},F.createElement(XC,{className:E.thumb})),F.createElement(NK,{className:E.corner})))}),_I=f.forwardRef((e,t)=>{const n=wr("ScrollAreaAutosize",kI,e),{children:r,classNames:o,styles:s,scrollbarSize:a,scrollHideDelay:c,type:d,dir:p,offsetScrollbars:h,viewportRef:m,onScrollPositionChange:v,unstyled:b,sx:w,variant:y,viewportProps:S}=n,k=CI(n,["children","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","sx","variant","viewportProps"]);return F.createElement(jo,SI(d1({},k),{ref:t,sx:[{display:"flex"},...fj(w)]}),F.createElement(jo,{sx:{display:"flex",flexDirection:"column",flex:1}},F.createElement(Am,{classNames:o,styles:s,scrollHideDelay:c,scrollbarSize:a,type:d,dir:p,offsetScrollbars:h,viewportRef:m,onScrollPositionChange:v,unstyled:b,variant:y,viewportProps:S},r)))});_I.displayName="@mantine/core/ScrollAreaAutosize";Am.displayName="@mantine/core/ScrollArea";Am.Autosize=_I;const PI=Am;var HK=Object.defineProperty,WK=Object.defineProperties,VK=Object.getOwnPropertyDescriptors,yh=Object.getOwnPropertySymbols,jI=Object.prototype.hasOwnProperty,II=Object.prototype.propertyIsEnumerable,ZC=(e,t,n)=>t in e?HK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,e4=(e,t)=>{for(var n in t||(t={}))jI.call(t,n)&&ZC(e,n,t[n]);if(yh)for(var n of yh(t))II.call(t,n)&&ZC(e,n,t[n]);return e},UK=(e,t)=>WK(e,VK(t)),GK=(e,t)=>{var n={};for(var r in e)jI.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&yh)for(var r of yh(e))t.indexOf(r)<0&&II.call(e,r)&&(n[r]=e[r]);return n};const Nm=f.forwardRef((e,t)=>{var n=e,{style:r}=n,o=GK(n,["style"]);return F.createElement(PI,UK(e4({},o),{style:e4({width:"100%"},r),viewportProps:{tabIndex:-1},viewportRef:t}),o.children)});Nm.displayName="@mantine/core/SelectScrollArea";var qK=ao(()=>({dropdown:{},itemsWrapper:{padding:Ue(4),display:"flex",width:"100%",boxSizing:"border-box"}}));const KK=qK;function Wc(e){return e.split("-")[1]}function gy(e){return e==="y"?"height":"width"}function js(e){return e.split("-")[0]}function Ei(e){return["top","bottom"].includes(js(e))?"x":"y"}function t4(e,t,n){let{reference:r,floating:o}=e;const s=r.x+r.width/2-o.width/2,a=r.y+r.height/2-o.height/2,c=Ei(t),d=gy(c),p=r[d]/2-o[d]/2,h=c==="x";let m;switch(js(t)){case"top":m={x:s,y:r.y-o.height};break;case"bottom":m={x:s,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:a};break;case"left":m={x:r.x-o.width,y:a};break;default:m={x:r.x,y:r.y}}switch(Wc(t)){case"start":m[c]-=p*(n&&h?-1:1);break;case"end":m[c]+=p*(n&&h?-1:1)}return m}const YK=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,c=s.filter(Boolean),d=await(a.isRTL==null?void 0:a.isRTL(t));let p=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:m}=t4(p,r,d),v=r,b={},w=0;for(let y=0;y({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:a,elements:c}=t,{element:d,padding:p=0}=Na(e,t)||{};if(d==null)return{};const h=vy(p),m={x:n,y:r},v=Ei(o),b=gy(v),w=await a.getDimensions(d),y=v==="y",S=y?"top":"left",k=y?"bottom":"right",_=y?"clientHeight":"clientWidth",I=s.reference[b]+s.reference[v]-m[v]-s.floating[b],P=m[v]-s.reference[v],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let O=E?E[_]:0;O&&await(a.isElement==null?void 0:a.isElement(E))||(O=c.floating[_]||s.floating[b]);const R=I/2-P/2,M=O/2-w[b]/2-1,T=gi(h[S],M),A=gi(h[k],M),$=T,Q=O-w[b]-A,B=O/2-w[b]/2+R,V=f1($,B,Q),q=Wc(o)!=null&&B!=V&&s.reference[b]/2-(B<$?T:A)-w[b]/2<0?B<$?$-B:Q-B:0;return{[v]:m[v]-q,data:{[v]:V,centerOffset:B-V+q}}}}),QK=["top","right","bottom","left"];QK.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]);const XK={left:"right",right:"left",bottom:"top",top:"bottom"};function xh(e){return e.replace(/left|right|bottom|top/g,t=>XK[t])}function JK(e,t,n){n===void 0&&(n=!1);const r=Wc(e),o=Ei(e),s=gy(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=xh(a)),{main:a,cross:xh(a)}}const ZK={start:"end",end:"start"};function G0(e){return e.replace(/start|end/g,t=>ZK[t])}const eY=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:s,initialPlacement:a,platform:c,elements:d}=t,{mainAxis:p=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:w=!0,...y}=Na(e,t),S=js(r),k=js(a)===a,_=await(c.isRTL==null?void 0:c.isRTL(d.floating)),I=m||(k||!w?[xh(a)]:function($){const Q=xh($);return[G0($),Q,G0(Q)]}(a));m||b==="none"||I.push(...function($,Q,B,V){const q=Wc($);let G=function(D,z,H){const Y=["left","right"],ie=["right","left"],ye=["top","bottom"],Z=["bottom","top"];switch(D){case"top":case"bottom":return H?z?ie:Y:z?Y:ie;case"left":case"right":return z?ye:Z;default:return[]}}(js($),B==="start",V);return q&&(G=G.map(D=>D+"-"+q),Q&&(G=G.concat(G.map(G0)))),G}(a,w,b,_));const P=[a,...I],E=await by(t,y),O=[];let R=((n=o.flip)==null?void 0:n.overflows)||[];if(p&&O.push(E[S]),h){const{main:$,cross:Q}=JK(r,s,_);O.push(E[$],E[Q])}if(R=[...R,{placement:r,overflows:O}],!O.every($=>$<=0)){var M,T;const $=(((M=o.flip)==null?void 0:M.index)||0)+1,Q=P[$];if(Q)return{data:{index:$,overflows:R},reset:{placement:Q}};let B=(T=R.filter(V=>V.overflows[0]<=0).sort((V,q)=>V.overflows[1]-q.overflows[1])[0])==null?void 0:T.placement;if(!B)switch(v){case"bestFit":{var A;const V=(A=R.map(q=>[q.placement,q.overflows.filter(G=>G>0).reduce((G,D)=>G+D,0)]).sort((q,G)=>q[1]-G[1])[0])==null?void 0:A[0];V&&(B=V);break}case"initialPlacement":B=a}if(r!==B)return{reset:{placement:B}}}return{}}}};function r4(e){const t=gi(...e.map(r=>r.left)),n=gi(...e.map(r=>r.top));return{x:t,y:n,width:Ks(...e.map(r=>r.right))-t,height:Ks(...e.map(r=>r.bottom))-n}}const tY=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:s,strategy:a}=t,{padding:c=2,x:d,y:p}=Na(e,t),h=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),m=function(y){const S=y.slice().sort((I,P)=>I.y-P.y),k=[];let _=null;for(let I=0;I_.height/2?k.push([P]):k[k.length-1].push(P),_=P}return k.map(I=>kc(r4(I)))}(h),v=kc(r4(h)),b=vy(c),w=await s.getElementRects({reference:{getBoundingClientRect:function(){if(m.length===2&&m[0].left>m[1].right&&d!=null&&p!=null)return m.find(y=>d>y.left-b.left&&dy.top-b.top&&p=2){if(Ei(n)==="x"){const E=m[0],O=m[m.length-1],R=js(n)==="top",M=E.top,T=O.bottom,A=R?E.left:O.left,$=R?E.right:O.right;return{top:M,bottom:T,left:A,right:$,width:$-A,height:T-M,x:A,y:M}}const y=js(n)==="left",S=Ks(...m.map(E=>E.right)),k=gi(...m.map(E=>E.left)),_=m.filter(E=>y?E.left===k:E.right===S),I=_[0].top,P=_[_.length-1].bottom;return{top:I,bottom:P,left:k,right:S,width:S-k,height:P-I,x:k,y:I}}return v}},floating:r.floating,strategy:a});return o.reference.x!==w.reference.x||o.reference.y!==w.reference.y||o.reference.width!==w.reference.width||o.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}},nY=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(s,a){const{placement:c,platform:d,elements:p}=s,h=await(d.isRTL==null?void 0:d.isRTL(p.floating)),m=js(c),v=Wc(c),b=Ei(c)==="x",w=["left","top"].includes(m)?-1:1,y=h&&b?-1:1,S=Na(a,s);let{mainAxis:k,crossAxis:_,alignmentAxis:I}=typeof S=="number"?{mainAxis:S,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...S};return v&&typeof I=="number"&&(_=v==="end"?-1*I:I),b?{x:_*y,y:k*w}:{x:k*w,y:_*y}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function EI(e){return e==="x"?"y":"x"}const rY=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:a=!1,limiter:c={fn:S=>{let{x:k,y:_}=S;return{x:k,y:_}}},...d}=Na(e,t),p={x:n,y:r},h=await by(t,d),m=Ei(js(o)),v=EI(m);let b=p[m],w=p[v];if(s){const S=m==="y"?"bottom":"right";b=f1(b+h[m==="y"?"top":"left"],b,b-h[S])}if(a){const S=v==="y"?"bottom":"right";w=f1(w+h[v==="y"?"top":"left"],w,w-h[S])}const y=c.fn({...t,[m]:b,[v]:w});return{...y,data:{x:y.x-n,y:y.y-r}}}}},oY=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:a}=t,{offset:c=0,mainAxis:d=!0,crossAxis:p=!0}=Na(e,t),h={x:n,y:r},m=Ei(o),v=EI(m);let b=h[m],w=h[v];const y=Na(c,t),S=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(d){const I=m==="y"?"height":"width",P=s.reference[m]-s.floating[I]+S.mainAxis,E=s.reference[m]+s.reference[I]-S.mainAxis;bE&&(b=E)}if(p){var k,_;const I=m==="y"?"width":"height",P=["top","left"].includes(js(o)),E=s.reference[v]-s.floating[I]+(P&&((k=a.offset)==null?void 0:k[v])||0)+(P?0:S.crossAxis),O=s.reference[v]+s.reference[I]+(P?0:((_=a.offset)==null?void 0:_[v])||0)-(P?S.crossAxis:0);wO&&(w=O)}return{[m]:b,[v]:w}}}},sY=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:a=()=>{},...c}=Na(e,t),d=await by(t,c),p=js(n),h=Wc(n),m=Ei(n)==="x",{width:v,height:b}=r.floating;let w,y;p==="top"||p==="bottom"?(w=p,y=h===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(y=p,w=h==="end"?"top":"bottom");const S=b-d[w],k=v-d[y],_=!t.middlewareData.shift;let I=S,P=k;if(m){const O=v-d.left-d.right;P=h||_?gi(k,O):O}else{const O=b-d.top-d.bottom;I=h||_?gi(S,O):O}if(_&&!h){const O=Ks(d.left,0),R=Ks(d.right,0),M=Ks(d.top,0),T=Ks(d.bottom,0);m?P=v-2*(O!==0||R!==0?O+R:Ks(d.left,d.right)):I=b-2*(M!==0||T!==0?M+T:Ks(d.top,d.bottom))}await a({...t,availableWidth:P,availableHeight:I});const E=await o.getDimensions(s.floating);return v!==E.width||b!==E.height?{reset:{rects:!0}}:{}}}};function $o(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function sa(e){return $o(e).getComputedStyle(e)}function OI(e){return e instanceof $o(e).Node}function vi(e){return OI(e)?(e.nodeName||"").toLowerCase():"#document"}function Ms(e){return e instanceof HTMLElement||e instanceof $o(e).HTMLElement}function o4(e){return typeof ShadowRoot<"u"&&(e instanceof $o(e).ShadowRoot||e instanceof ShadowRoot)}function sd(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=sa(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function aY(e){return["table","td","th"].includes(vi(e))}function p1(e){const t=yy(),n=sa(e);return n.transform!=="none"||n.perspective!=="none"||!!n.containerType&&n.containerType!=="normal"||!t&&!!n.backdropFilter&&n.backdropFilter!=="none"||!t&&!!n.filter&&n.filter!=="none"||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function yy(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function $m(e){return["html","body","#document"].includes(vi(e))}const h1=Math.min,dc=Math.max,wh=Math.round,op=Math.floor,bi=e=>({x:e,y:e});function RI(e){const t=sa(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ms(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,c=wh(n)!==s||wh(r)!==a;return c&&(n=s,r=a),{width:n,height:r,$:c}}function Pa(e){return e instanceof Element||e instanceof $o(e).Element}function xy(e){return Pa(e)?e:e.contextElement}function fc(e){const t=xy(e);if(!Ms(t))return bi(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=RI(t);let a=(s?wh(n.width):n.width)/r,c=(s?wh(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),c&&Number.isFinite(c)||(c=1),{x:a,y:c}}const iY=bi(0);function MI(e){const t=$o(e);return yy()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:iY}function cl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=xy(e);let a=bi(1);t&&(r?Pa(r)&&(a=fc(r)):a=fc(e));const c=function(v,b,w){return b===void 0&&(b=!1),!(!w||b&&w!==$o(v))&&b}(s,n,r)?MI(s):bi(0);let d=(o.left+c.x)/a.x,p=(o.top+c.y)/a.y,h=o.width/a.x,m=o.height/a.y;if(s){const v=$o(s),b=r&&Pa(r)?$o(r):r;let w=v.frameElement;for(;w&&r&&b!==v;){const y=fc(w),S=w.getBoundingClientRect(),k=getComputedStyle(w),_=S.left+(w.clientLeft+parseFloat(k.paddingLeft))*y.x,I=S.top+(w.clientTop+parseFloat(k.paddingTop))*y.y;d*=y.x,p*=y.y,h*=y.x,m*=y.y,d+=_,p+=I,w=$o(w).frameElement}}return kc({width:h,height:m,x:d,y:p})}function zm(e){return Pa(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ja(e){var t;return(t=(OI(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function DI(e){return cl(ja(e)).left+zm(e).scrollLeft}function _c(e){if(vi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||o4(e)&&e.host||ja(e);return o4(t)?t.host:t}function TI(e){const t=_c(e);return $m(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ms(t)&&sd(t)?t:TI(t)}function Sh(e,t){var n;t===void 0&&(t=[]);const r=TI(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=$o(r);return o?t.concat(s,s.visualViewport||[],sd(r)?r:[]):t.concat(r,Sh(r))}function s4(e,t,n){let r;if(t==="viewport")r=function(o,s){const a=$o(o),c=ja(o),d=a.visualViewport;let p=c.clientWidth,h=c.clientHeight,m=0,v=0;if(d){p=d.width,h=d.height;const b=yy();(!b||b&&s==="fixed")&&(m=d.offsetLeft,v=d.offsetTop)}return{width:p,height:h,x:m,y:v}}(e,n);else if(t==="document")r=function(o){const s=ja(o),a=zm(o),c=o.ownerDocument.body,d=dc(s.scrollWidth,s.clientWidth,c.scrollWidth,c.clientWidth),p=dc(s.scrollHeight,s.clientHeight,c.scrollHeight,c.clientHeight);let h=-a.scrollLeft+DI(o);const m=-a.scrollTop;return sa(c).direction==="rtl"&&(h+=dc(s.clientWidth,c.clientWidth)-d),{width:d,height:p,x:h,y:m}}(ja(e));else if(Pa(t))r=function(o,s){const a=cl(o,!0,s==="fixed"),c=a.top+o.clientTop,d=a.left+o.clientLeft,p=Ms(o)?fc(o):bi(1);return{width:o.clientWidth*p.x,height:o.clientHeight*p.y,x:d*p.x,y:c*p.y}}(t,n);else{const o=MI(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return kc(r)}function AI(e,t){const n=_c(e);return!(n===t||!Pa(n)||$m(n))&&(sa(n).position==="fixed"||AI(n,t))}function lY(e,t,n){const r=Ms(t),o=ja(t),s=n==="fixed",a=cl(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const d=bi(0);if(r||!r&&!s)if((vi(t)!=="body"||sd(o))&&(c=zm(t)),Ms(t)){const p=cl(t,!0,s,t);d.x=p.x+t.clientLeft,d.y=p.y+t.clientTop}else o&&(d.x=DI(o));return{x:a.left+c.scrollLeft-d.x,y:a.top+c.scrollTop-d.y,width:a.width,height:a.height}}function a4(e,t){return Ms(e)&&sa(e).position!=="fixed"?t?t(e):e.offsetParent:null}function i4(e,t){const n=$o(e);if(!Ms(e))return n;let r=a4(e,t);for(;r&&aY(r)&&sa(r).position==="static";)r=a4(r,t);return r&&(vi(r)==="html"||vi(r)==="body"&&sa(r).position==="static"&&!p1(r))?n:r||function(o){let s=_c(o);for(;Ms(s)&&!$m(s);){if(p1(s))return s;s=_c(s)}return null}(e)||n}const cY={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Ms(n),s=ja(n);if(n===s)return t;let a={scrollLeft:0,scrollTop:0},c=bi(1);const d=bi(0);if((o||!o&&r!=="fixed")&&((vi(n)!=="body"||sd(s))&&(a=zm(n)),Ms(n))){const p=cl(n);c=fc(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-a.scrollLeft*c.x+d.x,y:t.y*c.y-a.scrollTop*c.y+d.y}},getDocumentElement:ja,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?function(d,p){const h=p.get(d);if(h)return h;let m=Sh(d).filter(y=>Pa(y)&&vi(y)!=="body"),v=null;const b=sa(d).position==="fixed";let w=b?_c(d):d;for(;Pa(w)&&!$m(w);){const y=sa(w),S=p1(w);S||y.position!=="fixed"||(v=null),(b?!S&&!v:!S&&y.position==="static"&&v&&["absolute","fixed"].includes(v.position)||sd(w)&&!S&&AI(d,w))?m=m.filter(k=>k!==w):v=y,w=_c(w)}return p.set(d,m),m}(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((d,p)=>{const h=s4(t,p,o);return d.top=dc(h.top,d.top),d.right=h1(h.right,d.right),d.bottom=h1(h.bottom,d.bottom),d.left=dc(h.left,d.left),d},s4(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:i4,getElementRects:async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||i4,s=this.getDimensions;return{reference:lY(t,await o(n),r),floating:{x:0,y:0,...await s(n)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){return RI(e)},getScale:fc,isElement:Pa,isRTL:function(e){return getComputedStyle(e).direction==="rtl"}};function uY(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,p=xy(e),h=o||s?[...p?Sh(p):[],...Sh(t)]:[];h.forEach(S=>{o&&S.addEventListener("scroll",n,{passive:!0}),s&&S.addEventListener("resize",n)});const m=p&&c?function(S,k){let _,I=null;const P=ja(S);function E(){clearTimeout(_),I&&I.disconnect(),I=null}return function O(R,M){R===void 0&&(R=!1),M===void 0&&(M=1),E();const{left:T,top:A,width:$,height:Q}=S.getBoundingClientRect();if(R||k(),!$||!Q)return;const B={rootMargin:-op(A)+"px "+-op(P.clientWidth-(T+$))+"px "+-op(P.clientHeight-(A+Q))+"px "+-op(T)+"px",threshold:dc(0,h1(1,M))||1};let V=!0;function q(G){const D=G[0].intersectionRatio;if(D!==M){if(!V)return O();D?O(!1,D):_=setTimeout(()=>{O(!1,1e-7)},100)}V=!1}try{I=new IntersectionObserver(q,{...B,root:P.ownerDocument})}catch{I=new IntersectionObserver(q,B)}I.observe(S)}(!0),E}(p,n):null;let v,b=-1,w=null;a&&(w=new ResizeObserver(S=>{let[k]=S;k&&k.target===p&&w&&(w.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{w&&w.observe(t)})),n()}),p&&!d&&w.observe(p),w.observe(t));let y=d?cl(e):null;return d&&function S(){const k=cl(e);!y||k.x===y.x&&k.y===y.y&&k.width===y.width&&k.height===y.height||n(),y=k,v=requestAnimationFrame(S)}(),n(),()=>{h.forEach(S=>{o&&S.removeEventListener("scroll",n),s&&S.removeEventListener("resize",n)}),m&&m(),w&&w.disconnect(),w=null,d&&cancelAnimationFrame(v)}}const dY=(e,t,n)=>{const r=new Map,o={platform:cY,...n},s={...o.platform,_c:r};return YK(e,t,{...o,platform:s})},fY=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 jp=typeof document<"u"?f.useLayoutEffect:f.useEffect;function Ch(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(!Ch(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)&&!Ch(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function l4(e){const t=f.useRef(e);return jp(()=>{t.current=e}),t}function pY(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:s,open:a}=e,[c,d]=f.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=f.useState(r);Ch(p,r)||h(r);const m=f.useRef(null),v=f.useRef(null),b=f.useRef(c),w=l4(s),y=l4(o),[S,k]=f.useState(null),[_,I]=f.useState(null),P=f.useCallback(A=>{m.current!==A&&(m.current=A,k(A))},[]),E=f.useCallback(A=>{v.current!==A&&(v.current=A,I(A))},[]),O=f.useCallback(()=>{if(!m.current||!v.current)return;const A={placement:t,strategy:n,middleware:p};y.current&&(A.platform=y.current),dY(m.current,v.current,A).then($=>{const Q={...$,isPositioned:!0};R.current&&!Ch(b.current,Q)&&(b.current=Q,_i.flushSync(()=>{d(Q)}))})},[p,t,n,y]);jp(()=>{a===!1&&b.current.isPositioned&&(b.current.isPositioned=!1,d(A=>({...A,isPositioned:!1})))},[a]);const R=f.useRef(!1);jp(()=>(R.current=!0,()=>{R.current=!1}),[]),jp(()=>{if(S&&_){if(w.current)return w.current(S,_,O);O()}},[S,_,O,w]);const M=f.useMemo(()=>({reference:m,floating:v,setReference:P,setFloating:E}),[P,E]),T=f.useMemo(()=>({reference:S,floating:_}),[S,_]);return f.useMemo(()=>({...c,update:O,refs:M,elements:T,reference:P,floating:E}),[c,O,M,T,P,E])}var hY=typeof document<"u"?f.useLayoutEffect:f.useEffect;function mY(){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 gY=f.createContext(null),vY=()=>f.useContext(gY);function bY(e){return(e==null?void 0:e.ownerDocument)||document}function yY(e){return bY(e).defaultView||window}function sp(e){return e?e instanceof yY(e).Element:!1}const xY=N1["useInsertionEffect".toString()],wY=xY||(e=>e());function SY(e){const t=f.useRef(()=>{});return wY(()=>{t.current=e}),f.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;omY())[0],[p,h]=f.useState(null),m=f.useCallback(k=>{const _=sp(k)?{getBoundingClientRect:()=>k.getBoundingClientRect(),contextElement:k}:k;o.refs.setReference(_)},[o.refs]),v=f.useCallback(k=>{(sp(k)||k===null)&&(a.current=k,h(k)),(sp(o.refs.reference.current)||o.refs.reference.current===null||k!==null&&!sp(k))&&o.refs.setReference(k)},[o.refs]),b=f.useMemo(()=>({...o.refs,setReference:v,setPositionReference:m,domReference:a}),[o.refs,v,m]),w=f.useMemo(()=>({...o.elements,domReference:p}),[o.elements,p]),y=SY(n),S=f.useMemo(()=>({...o,refs:b,elements:w,dataRef:c,nodeId:r,events:d,open:t,onOpenChange:y}),[o,r,d,t,y,b,w]);return hY(()=>{const k=s==null?void 0:s.nodesRef.current.find(_=>_.id===r);k&&(k.context=S)}),f.useMemo(()=>({...o,context:S,refs:b,reference:v,positionReference:m}),[o,b,S,v,m])}function kY({opened:e,floating:t,position:n,positionDependencies:r}){const[o,s]=f.useState(0);f.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return uY(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),Ps(()=>{t.update()},r),Ps(()=>{s(a=>a+1)},[e])}function _Y(e){const t=[nY(e.offset)];return e.middlewares.shift&&t.push(rY({limiter:oY()})),e.middlewares.flip&&t.push(eY()),e.middlewares.inline&&t.push(tY()),t.push(fY({element:e.arrowRef,padding:e.arrowOffset})),t}function PY(e){const[t,n]=od({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=()=>{var a;(a=e.onClose)==null||a.call(e),n(!1)},o=()=>{var a,c;t?((a=e.onClose)==null||a.call(e),n(!1)):((c=e.onOpen)==null||c.call(e),n(!0))},s=CY({placement:e.position,middleware:[..._Y(e),...e.width==="target"?[sY({apply({rects:a}){var c,d;Object.assign((d=(c=s.refs.floating.current)==null?void 0:c.style)!=null?d:{},{width:`${a.reference.width}px`})}})]:[]]});return kY({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies,floating:s}),Ps(()=>{var a;(a=e.onPositionChange)==null||a.call(e,s.placement)},[s.placement]),Ps(()=>{var a,c;e.opened?(c=e.onOpen)==null||c.call(e):(a=e.onClose)==null||a.call(e)},[e.opened]),{floating:s,controlled:typeof e.opened=="boolean",opened:t,onClose:r,onToggle:o}}const NI={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"},[jY,$I]=hU(NI.context);var IY=Object.defineProperty,EY=Object.defineProperties,OY=Object.getOwnPropertyDescriptors,kh=Object.getOwnPropertySymbols,zI=Object.prototype.hasOwnProperty,LI=Object.prototype.propertyIsEnumerable,c4=(e,t,n)=>t in e?IY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ap=(e,t)=>{for(var n in t||(t={}))zI.call(t,n)&&c4(e,n,t[n]);if(kh)for(var n of kh(t))LI.call(t,n)&&c4(e,n,t[n]);return e},RY=(e,t)=>EY(e,OY(t)),MY=(e,t)=>{var n={};for(var r in e)zI.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&kh)for(var r of kh(e))t.indexOf(r)<0&&LI.call(e,r)&&(n[r]=e[r]);return n};const DY={refProp:"ref",popupType:"dialog"},BI=f.forwardRef((e,t)=>{const n=wr("PopoverTarget",DY,e),{children:r,refProp:o,popupType:s}=n,a=MY(n,["children","refProp","popupType"]);if(!hj(r))throw new Error(NI.children);const c=a,d=$I(),p=Ad(d.reference,r.ref,t),h=d.withRoles?{"aria-haspopup":s,"aria-expanded":d.opened,"aria-controls":d.getDropdownId(),id:d.getTargetId()}:{};return f.cloneElement(r,ap(RY(ap(ap(ap({},c),h),d.targetProps),{className:gj(d.targetProps.className,c.className,r.props.className),[o]:p}),d.controlled?null:{onClick:d.onToggle}))});BI.displayName="@mantine/core/PopoverTarget";var TY=ao((e,{radius:t,shadow:n})=>({dropdown:{position:"absolute",backgroundColor:e.white,background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${Ue(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:`${Ue(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,zIndex:1}}));const AY=TY;var NY=Object.defineProperty,u4=Object.getOwnPropertySymbols,$Y=Object.prototype.hasOwnProperty,zY=Object.prototype.propertyIsEnumerable,d4=(e,t,n)=>t in e?NY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bl=(e,t)=>{for(var n in t||(t={}))$Y.call(t,n)&&d4(e,n,t[n]);if(u4)for(var n of u4(t))zY.call(t,n)&&d4(e,n,t[n]);return e};const f4={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function LY({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in Jf?Bl(Bl(Bl({transitionProperty:Jf[e].transitionProperty},o),Jf[e].common),Jf[e][f4[t]]):null:Bl(Bl(Bl({transitionProperty:e.transitionProperty},o),e.common),e[f4[t]])}function BY({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:a,onExited:c}){const d=Fa(),p=Cj(),h=d.respectReducedMotion?p:!1,[m,v]=f.useState(h?0:e),[b,w]=f.useState(r?"entered":"exited"),y=f.useRef(-1),S=k=>{const _=k?o:s,I=k?a:c;w(k?"pre-entering":"pre-exiting"),window.clearTimeout(y.current);const P=h?0:k?e:t;if(v(P),P===0)typeof _=="function"&&_(),typeof I=="function"&&I(),w(k?"entered":"exited");else{const E=window.setTimeout(()=>{typeof _=="function"&&_(),w(k?"entering":"exiting")},10);y.current=window.setTimeout(()=>{window.clearTimeout(E),typeof I=="function"&&I(),w(k?"entered":"exited")},P)}};return Ps(()=>{S(r)},[r]),f.useEffect(()=>()=>window.clearTimeout(y.current),[]),{transitionDuration:m,transitionStatus:b,transitionTimingFunction:n||d.transitionTimingFunction}}function FI({keepMounted:e,transition:t,duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:a,onExit:c,onEntered:d,onEnter:p,onExited:h}){const{transitionDuration:m,transitionStatus:v,transitionTimingFunction:b}=BY({mounted:o,exitDuration:r,duration:n,timingFunction:a,onExit:c,onEntered:d,onEnter:p,onExited:h});return m===0?o?F.createElement(F.Fragment,null,s({})):e?s({display:"none"}):null:v==="exited"?e?s({display:"none"}):null:F.createElement(F.Fragment,null,s(LY({transition:t,duration:m,state:v,timingFunction:b})))}FI.displayName="@mantine/core/Transition";function HI({children:e,active:t=!0,refProp:n="ref"}){const r=KU(t),o=Ad(r,e==null?void 0:e.ref);return hj(e)?f.cloneElement(e,{[n]:o}):e}HI.displayName="@mantine/core/FocusTrap";var FY=Object.defineProperty,HY=Object.defineProperties,WY=Object.getOwnPropertyDescriptors,p4=Object.getOwnPropertySymbols,VY=Object.prototype.hasOwnProperty,UY=Object.prototype.propertyIsEnumerable,h4=(e,t,n)=>t in e?FY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Za=(e,t)=>{for(var n in t||(t={}))VY.call(t,n)&&h4(e,n,t[n]);if(p4)for(var n of p4(t))UY.call(t,n)&&h4(e,n,t[n]);return e},ip=(e,t)=>HY(e,WY(t));function m4(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function g4(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 GY={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function qY({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:a,dir:c}){const[d,p="center"]=e.split("-"),h={width:Ue(t),height:Ue(t),transform:"rotate(45deg)",position:"absolute",[GY[d]]:Ue(r)},m=Ue(-t/2);return d==="left"?ip(Za(Za({},h),m4(p,a,n,o)),{right:m,borderLeftColor:"transparent",borderBottomColor:"transparent"}):d==="right"?ip(Za(Za({},h),m4(p,a,n,o)),{left:m,borderRightColor:"transparent",borderTopColor:"transparent"}):d==="top"?ip(Za(Za({},h),g4(p,s,n,o,c)),{bottom:m,borderTopColor:"transparent",borderLeftColor:"transparent"}):d==="bottom"?ip(Za(Za({},h),g4(p,s,n,o,c)),{top:m,borderBottomColor:"transparent",borderRightColor:"transparent"}):{}}var KY=Object.defineProperty,YY=Object.defineProperties,QY=Object.getOwnPropertyDescriptors,_h=Object.getOwnPropertySymbols,WI=Object.prototype.hasOwnProperty,VI=Object.prototype.propertyIsEnumerable,v4=(e,t,n)=>t in e?KY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,XY=(e,t)=>{for(var n in t||(t={}))WI.call(t,n)&&v4(e,n,t[n]);if(_h)for(var n of _h(t))VI.call(t,n)&&v4(e,n,t[n]);return e},JY=(e,t)=>YY(e,QY(t)),ZY=(e,t)=>{var n={};for(var r in e)WI.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_h)for(var r of _h(e))t.indexOf(r)<0&&VI.call(e,r)&&(n[r]=e[r]);return n};const UI=f.forwardRef((e,t)=>{var n=e,{position:r,arrowSize:o,arrowOffset:s,arrowRadius:a,arrowPosition:c,visible:d,arrowX:p,arrowY:h}=n,m=ZY(n,["position","arrowSize","arrowOffset","arrowRadius","arrowPosition","visible","arrowX","arrowY"]);const v=Fa();return d?F.createElement("div",JY(XY({},m),{ref:t,style:qY({position:r,arrowSize:o,arrowOffset:s,arrowRadius:a,arrowPosition:c,dir:v.dir,arrowX:p,arrowY:h})})):null});UI.displayName="@mantine/core/FloatingArrow";var eQ=Object.defineProperty,tQ=Object.defineProperties,nQ=Object.getOwnPropertyDescriptors,Ph=Object.getOwnPropertySymbols,GI=Object.prototype.hasOwnProperty,qI=Object.prototype.propertyIsEnumerable,b4=(e,t,n)=>t in e?eQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fl=(e,t)=>{for(var n in t||(t={}))GI.call(t,n)&&b4(e,n,t[n]);if(Ph)for(var n of Ph(t))qI.call(t,n)&&b4(e,n,t[n]);return e},lp=(e,t)=>tQ(e,nQ(t)),rQ=(e,t)=>{var n={};for(var r in e)GI.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ph)for(var r of Ph(e))t.indexOf(r)<0&&qI.call(e,r)&&(n[r]=e[r]);return n};const oQ={};function KI(e){var t;const n=wr("PopoverDropdown",oQ,e),{style:r,className:o,children:s,onKeyDownCapture:a}=n,c=rQ(n,["style","className","children","onKeyDownCapture"]),d=$I(),{classes:p,cx:h}=AY({radius:d.radius,shadow:d.shadow},{name:d.__staticSelector,classNames:d.classNames,styles:d.styles,unstyled:d.unstyled,variant:d.variant}),m=FU({opened:d.opened,shouldReturnFocus:d.returnFocus}),v=d.withRoles?{"aria-labelledby":d.getTargetId(),id:d.getDropdownId(),role:"dialog"}:{};return d.disabled?null:F.createElement(Kj,lp(Fl({},d.portalProps),{withinPortal:d.withinPortal}),F.createElement(FI,lp(Fl({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 w,y;return F.createElement(HI,{active:d.trapFocus},F.createElement(jo,Fl(lp(Fl({},v),{tabIndex:-1,ref:d.floating,style:lp(Fl(Fl({},r),b),{zIndex:d.zIndex,top:(w=d.y)!=null?w:0,left:(y=d.x)!=null?y:0,width:d.width==="target"?void 0:Ue(d.width)}),className:h(p.dropdown,o),onKeyDownCapture:gU(d.onClose,{active:d.closeOnEscape,onTrigger:m,onKeyDown:a}),"data-position":d.placement}),c),s,F.createElement(UI,{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})))}))}KI.displayName="@mantine/core/PopoverDropdown";function sQ(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,aQ=Object.prototype.hasOwnProperty,iQ=Object.prototype.propertyIsEnumerable,lQ=(e,t)=>{var n={};for(var r in e)aQ.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&&iQ.call(e,r)&&(n[r]=e[r]);return n};const cQ={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:uy("popover"),__staticSelector:"Popover",width:"max-content"};function Vc(e){var t,n,r,o,s,a;const c=f.useRef(null),d=wr("Popover",cQ,e),{children:p,position:h,offset:m,onPositionChange:v,positionDependencies:b,opened:w,transitionProps:y,width:S,middlewares:k,withArrow:_,arrowSize:I,arrowOffset:P,arrowRadius:E,arrowPosition:O,unstyled:R,classNames:M,styles:T,closeOnClickOutside:A,withinPortal:$,portalProps:Q,closeOnEscape:B,clickOutsideEvents:V,trapFocus:q,onClose:G,onOpen:D,onChange:z,zIndex:H,radius:Y,shadow:ie,id:ye,defaultOpened:Z,__staticSelector:oe,withRoles:K,disabled:U,returnFocus:ae,variant:re,keepMounted:se}=d,pe=lQ(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"]),[le,ge]=f.useState(null),[ke,xe]=f.useState(null),de=fy(ye),Ae=Fa(),Ee=PY({middlewares:k,width:S,position:sQ(Ae.dir,h),offset:typeof m=="number"?m+(_?I/2:0):m,arrowRef:c,arrowOffset:P,onPositionChange:v,positionDependencies:b,opened:w,defaultOpened:Z,onChange:z,onOpen:D,onClose:G});$U(()=>Ee.opened&&A&&Ee.onClose(),V,[le,ke]);const $e=f.useCallback(ct=>{ge(ct),Ee.floating.reference(ct)},[Ee.floating.reference]),kt=f.useCallback(ct=>{xe(ct),Ee.floating.floating(ct)},[Ee.floating.floating]);return F.createElement(jY,{value:{returnFocus:ae,disabled:U,controlled:Ee.controlled,reference:$e,floating:kt,x:Ee.floating.x,y:Ee.floating.y,arrowX:(r=(n=(t=Ee.floating)==null?void 0:t.middlewareData)==null?void 0:n.arrow)==null?void 0:r.x,arrowY:(a=(s=(o=Ee.floating)==null?void 0:o.middlewareData)==null?void 0:s.arrow)==null?void 0:a.y,opened:Ee.opened,arrowRef:c,transitionProps:y,width:S,withArrow:_,arrowSize:I,arrowOffset:P,arrowRadius:E,arrowPosition:O,placement:Ee.floating.placement,trapFocus:q,withinPortal:$,portalProps:Q,zIndex:H,radius:Y,shadow:ie,closeOnEscape:B,onClose:Ee.onClose,onToggle:Ee.onToggle,getTargetId:()=>`${de}-target`,getDropdownId:()=>`${de}-dropdown`,withRoles:K,targetProps:pe,__staticSelector:oe,classNames:M,styles:T,unstyled:R,variant:re,keepMounted:se}},p)}Vc.Target=BI;Vc.Dropdown=KI;Vc.displayName="@mantine/core/Popover";var uQ=Object.defineProperty,jh=Object.getOwnPropertySymbols,YI=Object.prototype.hasOwnProperty,QI=Object.prototype.propertyIsEnumerable,x4=(e,t,n)=>t in e?uQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dQ=(e,t)=>{for(var n in t||(t={}))YI.call(t,n)&&x4(e,n,t[n]);if(jh)for(var n of jh(t))QI.call(t,n)&&x4(e,n,t[n]);return e},fQ=(e,t)=>{var n={};for(var r in e)YI.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&jh)for(var r of jh(e))t.indexOf(r)<0&&QI.call(e,r)&&(n[r]=e[r]);return n};function pQ(e){var t=e,{children:n,component:r="div",maxHeight:o=220,direction:s="column",id:a,innerRef:c,__staticSelector:d,styles:p,classNames:h,unstyled:m}=t,v=fQ(t,["children","component","maxHeight","direction","id","innerRef","__staticSelector","styles","classNames","unstyled"]);const{classes:b}=KK(null,{name:d,styles:p,classNames:h,unstyled:m});return F.createElement(Vc.Dropdown,dQ({p:0,onMouseDown:w=>w.preventDefault()},v),F.createElement("div",{style:{maxHeight:Ue(o),display:"flex"}},F.createElement(jo,{component:r||"div",id:`${a}-items`,"aria-labelledby":`${a}-label`,role:"listbox",onMouseDown:w=>w.preventDefault(),style:{flex:1,overflowY:r!==Nm?"auto":void 0},"data-combobox-popover":!0,tabIndex:-1,ref:c},F.createElement("div",{className:b.itemsWrapper,style:{flexDirection:s}},n))))}function hi({opened:e,transitionProps:t={transition:"fade",duration:0},shadow:n,withinPortal:r,portalProps:o,children:s,__staticSelector:a,onDirectionChange:c,switchDirectionOnFlip:d,zIndex:p,dropdownPosition:h,positionDependencies:m=[],classNames:v,styles:b,unstyled:w,readOnly:y,variant:S}){return F.createElement(Vc,{unstyled:w,classNames:v,styles:b,width:"target",withRoles:!1,opened:e,middlewares:{flip:h==="flip",shift:!1},position:h==="flip"?"bottom":h,positionDependencies:m,zIndex:p,__staticSelector:a,withinPortal:r,portalProps:o,transitionProps:t,shadow:n,disabled:y,onPositionChange:k=>d&&(c==null?void 0:c(k==="top"?"column-reverse":"column")),variant:S},s)}hi.Target=Vc.Target;hi.Dropdown=pQ;var hQ=Object.defineProperty,mQ=Object.defineProperties,gQ=Object.getOwnPropertyDescriptors,Ih=Object.getOwnPropertySymbols,XI=Object.prototype.hasOwnProperty,JI=Object.prototype.propertyIsEnumerable,w4=(e,t,n)=>t in e?hQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cp=(e,t)=>{for(var n in t||(t={}))XI.call(t,n)&&w4(e,n,t[n]);if(Ih)for(var n of Ih(t))JI.call(t,n)&&w4(e,n,t[n]);return e},vQ=(e,t)=>mQ(e,gQ(t)),bQ=(e,t)=>{var n={};for(var r in e)XI.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ih)for(var r of Ih(e))t.indexOf(r)<0&&JI.call(e,r)&&(n[r]=e[r]);return n};function ZI(e,t,n){const r=wr(e,t,n),{label:o,description:s,error:a,required:c,classNames:d,styles:p,className:h,unstyled:m,__staticSelector:v,sx:b,errorProps:w,labelProps:y,descriptionProps:S,wrapperProps:k,id:_,size:I,style:P,inputContainer:E,inputWrapperOrder:O,withAsterisk:R,variant:M}=r,T=bQ(r,["label","description","error","required","classNames","styles","className","unstyled","__staticSelector","sx","errorProps","labelProps","descriptionProps","wrapperProps","id","size","style","inputContainer","inputWrapperOrder","withAsterisk","variant"]),A=fy(_),{systemStyles:$,rest:Q}=Mm(T),B=cp({label:o,description:s,error:a,required:c,classNames:d,className:h,__staticSelector:v,sx:b,errorProps:w,labelProps:y,descriptionProps:S,unstyled:m,styles:p,id:A,size:I,style:P,inputContainer:E,inputWrapperOrder:O,withAsterisk:R,variant:M},k);return vQ(cp({},Q),{classNames:d,styles:p,unstyled:m,wrapperProps:cp(cp({},B),$),inputProps:{required:c,classNames:d,styles:p,unstyled:m,id:A,size:I,__staticSelector:v,error:a,variant:M}})}var yQ=ao((e,t,{size:n})=>({label:{display:"inline-block",fontSize:Vt({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 xQ=yQ;var wQ=Object.defineProperty,Eh=Object.getOwnPropertySymbols,eE=Object.prototype.hasOwnProperty,tE=Object.prototype.propertyIsEnumerable,S4=(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={}))eE.call(t,n)&&S4(e,n,t[n]);if(Eh)for(var n of Eh(t))tE.call(t,n)&&S4(e,n,t[n]);return e},CQ=(e,t)=>{var n={};for(var r in e)eE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Eh)for(var r of Eh(e))t.indexOf(r)<0&&tE.call(e,r)&&(n[r]=e[r]);return n};const kQ={labelElement:"label",size:"sm"},wy=f.forwardRef((e,t)=>{const n=wr("InputLabel",kQ,e),{labelElement:r,children:o,required:s,size:a,classNames:c,styles:d,unstyled:p,className:h,htmlFor:m,__staticSelector:v,variant:b,onMouseDown:w}=n,y=CQ(n,["labelElement","children","required","size","classNames","styles","unstyled","className","htmlFor","__staticSelector","variant","onMouseDown"]),{classes:S,cx:k}=xQ(null,{name:["InputWrapper",v],classNames:c,styles:d,unstyled:p,variant:b,size:a});return F.createElement(jo,SQ({component:r,ref:t,className:k(S.label,h),htmlFor:r==="label"?m:void 0,onMouseDown:_=>{w==null||w(_),!_.defaultPrevented&&_.detail>1&&_.preventDefault()}},y),o,s&&F.createElement("span",{className:S.required,"aria-hidden":!0}," *"))});wy.displayName="@mantine/core/InputLabel";var _Q=ao((e,t,{size:n})=>({error:{wordBreak:"break-word",color:e.fn.variant({variant:"filled",color:"red"}).background,fontSize:`calc(${Vt({size:n,sizes:e.fontSizes})} - ${Ue(2)})`,lineHeight:1.2,display:"block"}}));const PQ=_Q;var jQ=Object.defineProperty,Oh=Object.getOwnPropertySymbols,nE=Object.prototype.hasOwnProperty,rE=Object.prototype.propertyIsEnumerable,C4=(e,t,n)=>t in e?jQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,IQ=(e,t)=>{for(var n in t||(t={}))nE.call(t,n)&&C4(e,n,t[n]);if(Oh)for(var n of Oh(t))rE.call(t,n)&&C4(e,n,t[n]);return e},EQ=(e,t)=>{var n={};for(var r in e)nE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Oh)for(var r of Oh(e))t.indexOf(r)<0&&rE.call(e,r)&&(n[r]=e[r]);return n};const OQ={size:"sm"},Sy=f.forwardRef((e,t)=>{const n=wr("InputError",OQ,e),{children:r,className:o,classNames:s,styles:a,unstyled:c,size:d,__staticSelector:p,variant:h}=n,m=EQ(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:v,cx:b}=PQ(null,{name:["InputWrapper",p],classNames:s,styles:a,unstyled:c,variant:h,size:d});return F.createElement(Sc,IQ({className:b(v.error,o),ref:t},m),r)});Sy.displayName="@mantine/core/InputError";var RQ=ao((e,t,{size:n})=>({description:{wordBreak:"break-word",color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontSize:`calc(${Vt({size:n,sizes:e.fontSizes})} - ${Ue(2)})`,lineHeight:1.2,display:"block"}}));const MQ=RQ;var DQ=Object.defineProperty,Rh=Object.getOwnPropertySymbols,oE=Object.prototype.hasOwnProperty,sE=Object.prototype.propertyIsEnumerable,k4=(e,t,n)=>t in e?DQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TQ=(e,t)=>{for(var n in t||(t={}))oE.call(t,n)&&k4(e,n,t[n]);if(Rh)for(var n of Rh(t))sE.call(t,n)&&k4(e,n,t[n]);return e},AQ=(e,t)=>{var n={};for(var r in e)oE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Rh)for(var r of Rh(e))t.indexOf(r)<0&&sE.call(e,r)&&(n[r]=e[r]);return n};const NQ={size:"sm"},Cy=f.forwardRef((e,t)=>{const n=wr("InputDescription",NQ,e),{children:r,className:o,classNames:s,styles:a,unstyled:c,size:d,__staticSelector:p,variant:h}=n,m=AQ(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:v,cx:b}=MQ(null,{name:["InputWrapper",p],classNames:s,styles:a,unstyled:c,variant:h,size:d});return F.createElement(Sc,TQ({color:"dimmed",className:b(v.description,o),ref:t,unstyled:c},m),r)});Cy.displayName="@mantine/core/InputDescription";const aE=f.createContext({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),$Q=aE.Provider,zQ=()=>f.useContext(aE);function LQ(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 BQ=Object.defineProperty,FQ=Object.defineProperties,HQ=Object.getOwnPropertyDescriptors,_4=Object.getOwnPropertySymbols,WQ=Object.prototype.hasOwnProperty,VQ=Object.prototype.propertyIsEnumerable,P4=(e,t,n)=>t in e?BQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,UQ=(e,t)=>{for(var n in t||(t={}))WQ.call(t,n)&&P4(e,n,t[n]);if(_4)for(var n of _4(t))VQ.call(t,n)&&P4(e,n,t[n]);return e},GQ=(e,t)=>FQ(e,HQ(t)),qQ=ao(e=>({root:GQ(UQ({},e.fn.fontStyles()),{lineHeight:e.lineHeight})}));const KQ=qQ;var YQ=Object.defineProperty,QQ=Object.defineProperties,XQ=Object.getOwnPropertyDescriptors,Mh=Object.getOwnPropertySymbols,iE=Object.prototype.hasOwnProperty,lE=Object.prototype.propertyIsEnumerable,j4=(e,t,n)=>t in e?YQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ei=(e,t)=>{for(var n in t||(t={}))iE.call(t,n)&&j4(e,n,t[n]);if(Mh)for(var n of Mh(t))lE.call(t,n)&&j4(e,n,t[n]);return e},I4=(e,t)=>QQ(e,XQ(t)),JQ=(e,t)=>{var n={};for(var r in e)iE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mh)for(var r of Mh(e))t.indexOf(r)<0&&lE.call(e,r)&&(n[r]=e[r]);return n};const ZQ={labelElement:"label",size:"sm",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},cE=f.forwardRef((e,t)=>{const n=wr("InputWrapper",ZQ,e),{className:r,label:o,children:s,required:a,id:c,error:d,description:p,labelElement:h,labelProps:m,descriptionProps:v,errorProps:b,classNames:w,styles:y,size:S,inputContainer:k,__staticSelector:_,unstyled:I,inputWrapperOrder:P,withAsterisk:E,variant:O}=n,R=JQ(n,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","inputContainer","__staticSelector","unstyled","inputWrapperOrder","withAsterisk","variant"]),{classes:M,cx:T}=KQ(null,{classNames:w,styles:y,name:["InputWrapper",_],unstyled:I,variant:O,size:S}),A={classNames:w,styles:y,unstyled:I,size:S,variant:O,__staticSelector:_},$=typeof E=="boolean"?E:a,Q=c?`${c}-error`:b==null?void 0:b.id,B=c?`${c}-description`:v==null?void 0:v.id,q=`${!!d&&typeof d!="boolean"?Q:""} ${p?B:""}`,G=q.trim().length>0?q.trim():void 0,D=o&&F.createElement(wy,ei(ei({key:"label",labelElement:h,id:c?`${c}-label`:void 0,htmlFor:c,required:$},A),m),o),z=p&&F.createElement(Cy,I4(ei(ei({key:"description"},v),A),{size:(v==null?void 0:v.size)||A.size,id:(v==null?void 0:v.id)||B}),p),H=F.createElement(f.Fragment,{key:"input"},k(s)),Y=typeof d!="boolean"&&d&&F.createElement(Sy,I4(ei(ei({},b),A),{size:(b==null?void 0:b.size)||A.size,key:"error",id:(b==null?void 0:b.id)||Q}),d),ie=P.map(ye=>{switch(ye){case"label":return D;case"input":return H;case"description":return z;case"error":return Y;default:return null}});return F.createElement($Q,{value:ei({describedBy:G},LQ(P,{hasDescription:!!z,hasError:!!Y}))},F.createElement(jo,ei({className:T(M.root,r),ref:t},R),ie))});cE.displayName="@mantine/core/InputWrapper";var eX=Object.defineProperty,Dh=Object.getOwnPropertySymbols,uE=Object.prototype.hasOwnProperty,dE=Object.prototype.propertyIsEnumerable,E4=(e,t,n)=>t in e?eX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tX=(e,t)=>{for(var n in t||(t={}))uE.call(t,n)&&E4(e,n,t[n]);if(Dh)for(var n of Dh(t))dE.call(t,n)&&E4(e,n,t[n]);return e},nX=(e,t)=>{var n={};for(var r in e)uE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Dh)for(var r of Dh(e))t.indexOf(r)<0&&dE.call(e,r)&&(n[r]=e[r]);return n};const rX={},fE=f.forwardRef((e,t)=>{const n=wr("InputPlaceholder",rX,e),{sx:r}=n,o=nX(n,["sx"]);return F.createElement(jo,tX({component:"span",sx:[s=>s.fn.placeholderStyles(),...fj(r)],ref:t},o))});fE.displayName="@mantine/core/InputPlaceholder";var oX=Object.defineProperty,sX=Object.defineProperties,aX=Object.getOwnPropertyDescriptors,O4=Object.getOwnPropertySymbols,iX=Object.prototype.hasOwnProperty,lX=Object.prototype.propertyIsEnumerable,R4=(e,t,n)=>t in e?oX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,up=(e,t)=>{for(var n in t||(t={}))iX.call(t,n)&&R4(e,n,t[n]);if(O4)for(var n of O4(t))lX.call(t,n)&&R4(e,n,t[n]);return e},q0=(e,t)=>sX(e,aX(t));const Qo={xs:Ue(30),sm:Ue(36),md:Ue(42),lg:Ue(50),xl:Ue(60)},cX=["default","filled","unstyled"];function uX({theme:e,variant:t}){return cX.includes(t)?t==="default"?{border:`${Ue(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:`${Ue(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:Ue(28),outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}}:null}var dX=ao((e,{multiline:t,radius:n,invalid:r,rightSectionWidth:o,withRightSection:s,iconWidth:a,offsetBottom:c,offsetTop:d,pointer:p},{variant:h,size:m})=>{const v=e.fn.variant({variant:"filled",color:"red"}).background,b=h==="default"||h==="filled"?{minHeight:Vt({size:m,sizes:Qo}),paddingLeft:`calc(${Vt({size:m,sizes:Qo})} / 3)`,paddingRight:s?o||Vt({size:m,sizes:Qo}):`calc(${Vt({size:m,sizes:Qo})} / 3)`,borderRadius:e.fn.radius(n)}:h==="unstyled"&&s?{paddingRight:o||Vt({size:m,sizes:Qo})}: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:q0(up(up(q0(up({},e.fn.fontStyles()),{height:t?h==="unstyled"?void 0:"auto":Vt({size:m,sizes:Qo}),WebkitTapHighlightColor:"transparent",lineHeight:t?e.lineHeight:`calc(${Vt({size:m,sizes:Qo})} - ${Ue(2)})`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:Vt({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}),uX({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:v,borderColor:v,"&::placeholder":{opacity:1,color:v}},"&[data-with-icon]":{paddingLeft:typeof a=="number"?Ue(a):Vt({size:m,sizes:Qo})},"&::placeholder":q0(up({},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:a?Ue(a):Vt({size:m,sizes:Qo}),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||Vt({size:m,sizes:Qo})}}});const fX=dX;var pX=Object.defineProperty,hX=Object.defineProperties,mX=Object.getOwnPropertyDescriptors,Th=Object.getOwnPropertySymbols,pE=Object.prototype.hasOwnProperty,hE=Object.prototype.propertyIsEnumerable,M4=(e,t,n)=>t in e?pX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dp=(e,t)=>{for(var n in t||(t={}))pE.call(t,n)&&M4(e,n,t[n]);if(Th)for(var n of Th(t))hE.call(t,n)&&M4(e,n,t[n]);return e},D4=(e,t)=>hX(e,mX(t)),gX=(e,t)=>{var n={};for(var r in e)pE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Th)for(var r of Th(e))t.indexOf(r)<0&&hE.call(e,r)&&(n[r]=e[r]);return n};const vX={size:"sm",variant:"default"},bl=f.forwardRef((e,t)=>{const n=wr("Input",vX,e),{className:r,error:o,required:s,disabled:a,variant:c,icon:d,style:p,rightSectionWidth:h,iconWidth:m,rightSection:v,rightSectionProps:b,radius:w,size:y,wrapperProps:S,classNames:k,styles:_,__staticSelector:I,multiline:P,sx:E,unstyled:O,pointer:R}=n,M=gX(n,["className","error","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx","unstyled","pointer"]),{offsetBottom:T,offsetTop:A,describedBy:$}=zQ(),{classes:Q,cx:B}=fX({radius:w,multiline:P,invalid:!!o,rightSectionWidth:h?Ue(h):void 0,iconWidth:m,withRightSection:!!v,offsetBottom:T,offsetTop:A,pointer:R},{classNames:k,styles:_,name:["Input",I],unstyled:O,variant:c,size:y}),{systemStyles:V,rest:q}=Mm(M);return F.createElement(jo,dp(dp({className:B(Q.wrapper,r),sx:E,style:p},V),S),d&&F.createElement("div",{className:Q.icon},d),F.createElement(jo,D4(dp({component:"input"},q),{ref:t,required:s,"aria-invalid":!!o,"aria-describedby":$,disabled:a,"data-disabled":a||void 0,"data-with-icon":!!d||void 0,"data-invalid":!!o||void 0,className:Q.input})),v&&F.createElement("div",D4(dp({},b),{className:Q.rightSection}),v))});bl.displayName="@mantine/core/Input";bl.Wrapper=cE;bl.Label=wy;bl.Description=Cy;bl.Error=Sy;bl.Placeholder=fE;const Pc=bl;var bX=Object.defineProperty,Ah=Object.getOwnPropertySymbols,mE=Object.prototype.hasOwnProperty,gE=Object.prototype.propertyIsEnumerable,T4=(e,t,n)=>t in e?bX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A4=(e,t)=>{for(var n in t||(t={}))mE.call(t,n)&&T4(e,n,t[n]);if(Ah)for(var n of Ah(t))gE.call(t,n)&&T4(e,n,t[n]);return e},yX=(e,t)=>{var n={};for(var r in e)mE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ah)for(var r of Ah(e))t.indexOf(r)<0&&gE.call(e,r)&&(n[r]=e[r]);return n};const xX={multiple:!1},vE=f.forwardRef((e,t)=>{const n=wr("FileButton",xX,e),{onChange:r,children:o,multiple:s,accept:a,name:c,form:d,resetRef:p,disabled:h,capture:m,inputProps:v}=n,b=yX(n,["onChange","children","multiple","accept","name","form","resetRef","disabled","capture","inputProps"]),w=f.useRef(),y=()=>{!h&&w.current.click()},S=_=>{r(s?Array.from(_.currentTarget.files):_.currentTarget.files[0]||null)};return Sj(p,()=>{w.current.value=""}),F.createElement(F.Fragment,null,o(A4({onClick:y},b)),F.createElement("input",A4({style:{display:"none"},type:"file",accept:a,multiple:s,onChange:S,ref:Ad(t,w),name:c,form:d,capture:m},v)))});vE.displayName="@mantine/core/FileButton";const bE={xs:Ue(16),sm:Ue(22),md:Ue(26),lg:Ue(30),xl:Ue(36)},wX={xs:Ue(10),sm:Ue(12),md:Ue(14),lg:Ue(16),xl:Ue(18)};var SX=ao((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:Vt({size:o,sizes:bE}),paddingLeft:`calc(${Vt({size:o,sizes:e.spacing})} / 1.5)`,paddingRight:t||r?Vt({size:o,sizes:e.spacing}):0,fontWeight:500,fontSize:Vt({size:o,sizes:wX}),borderRadius:Vt({size:n,sizes:e.radius}),cursor:t?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${Ue(10)})`},defaultValueRemove:{color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],marginLeft:`calc(${Vt({size:o,sizes:e.spacing})} / 6)`},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}));const CX=SX;var kX=Object.defineProperty,Nh=Object.getOwnPropertySymbols,yE=Object.prototype.hasOwnProperty,xE=Object.prototype.propertyIsEnumerable,N4=(e,t,n)=>t in e?kX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_X=(e,t)=>{for(var n in t||(t={}))yE.call(t,n)&&N4(e,n,t[n]);if(Nh)for(var n of Nh(t))xE.call(t,n)&&N4(e,n,t[n]);return e},PX=(e,t)=>{var n={};for(var r in e)yE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Nh)for(var r of Nh(e))t.indexOf(r)<0&&xE.call(e,r)&&(n[r]=e[r]);return n};const jX={xs:16,sm:22,md:24,lg:26,xl:30};function wE(e){var t=e,{label:n,classNames:r,styles:o,className:s,onRemove:a,disabled:c,readOnly:d,size:p,radius:h="sm",variant:m,unstyled:v}=t,b=PX(t,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:w,cx:y}=CX({disabled:c,readOnly:d,radius:h},{name:"MultiSelect",classNames:r,styles:o,unstyled:v,size:p,variant:m});return F.createElement("div",_X({className:y(w.defaultValue,s)},b),F.createElement("span",{className:w.defaultValueLabel},n),!c&&!d&&F.createElement(tI,{"aria-hidden":!0,onMouseDown:a,size:jX[p],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:w.defaultValueRemove,tabIndex:-1,unstyled:v}))}wE.displayName="@mantine/core/MultiSelect/DefaultValue";function IX({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,disableSelectedItemFiltering:a}){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 EX=Object.defineProperty,$h=Object.getOwnPropertySymbols,SE=Object.prototype.hasOwnProperty,CE=Object.prototype.propertyIsEnumerable,$4=(e,t,n)=>t in e?EX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z4=(e,t)=>{for(var n in t||(t={}))SE.call(t,n)&&$4(e,n,t[n]);if($h)for(var n of $h(t))CE.call(t,n)&&$4(e,n,t[n]);return e},OX=(e,t)=>{var n={};for(var r in e)SE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&$h)for(var r of $h(e))t.indexOf(r)<0&&CE.call(e,r)&&(n[r]=e[r]);return n};const RX={xs:Ue(14),sm:Ue(18),md:Ue(20),lg:Ue(24),xl:Ue(28)};function MX(e){var t=e,{size:n,error:r,style:o}=t,s=OX(t,["size","error","style"]);const a=Fa(),c=Vt({size:n,sizes:RX});return F.createElement("svg",z4({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:z4({color:r?a.colors.red[6]:a.colors.gray[6],width:c,height:c},o),"data-chevron":!0},s),F.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 DX=Object.defineProperty,TX=Object.defineProperties,AX=Object.getOwnPropertyDescriptors,L4=Object.getOwnPropertySymbols,NX=Object.prototype.hasOwnProperty,$X=Object.prototype.propertyIsEnumerable,B4=(e,t,n)=>t in e?DX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zX=(e,t)=>{for(var n in t||(t={}))NX.call(t,n)&&B4(e,n,t[n]);if(L4)for(var n of L4(t))$X.call(t,n)&&B4(e,n,t[n]);return e},LX=(e,t)=>TX(e,AX(t));function kE({shouldClear:e,clearButtonProps:t,onClear:n,size:r,error:o}){return e?F.createElement(tI,LX(zX({},t),{variant:"transparent",onClick:n,size:r,onMouseDown:s=>s.preventDefault()})):F.createElement(MX,{error:o,size:r})}kE.displayName="@mantine/core/SelectRightSection";var BX=Object.defineProperty,FX=Object.defineProperties,HX=Object.getOwnPropertyDescriptors,zh=Object.getOwnPropertySymbols,_E=Object.prototype.hasOwnProperty,PE=Object.prototype.propertyIsEnumerable,F4=(e,t,n)=>t in e?BX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,K0=(e,t)=>{for(var n in t||(t={}))_E.call(t,n)&&F4(e,n,t[n]);if(zh)for(var n of zh(t))PE.call(t,n)&&F4(e,n,t[n]);return e},H4=(e,t)=>FX(e,HX(t)),WX=(e,t)=>{var n={};for(var r in e)_E.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&zh)for(var r of zh(e))t.indexOf(r)<0&&PE.call(e,r)&&(n[r]=e[r]);return n};function jE(e){var t=e,{styles:n,rightSection:r,rightSectionWidth:o,theme:s}=t,a=WX(t,["styles","rightSection","rightSectionWidth","theme"]);if(r)return{rightSection:r,rightSectionWidth:o,styles:n};const c=typeof n=="function"?n(s):n;return{rightSection:!a.readOnly&&!(a.disabled&&a.shouldClear)&&F.createElement(kE,K0({},a)),styles:H4(K0({},c),{rightSection:H4(K0({},c==null?void 0:c.rightSection),{pointerEvents:a.shouldClear?void 0:"none"})})}}var VX=Object.defineProperty,UX=Object.defineProperties,GX=Object.getOwnPropertyDescriptors,W4=Object.getOwnPropertySymbols,qX=Object.prototype.hasOwnProperty,KX=Object.prototype.propertyIsEnumerable,V4=(e,t,n)=>t in e?VX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,YX=(e,t)=>{for(var n in t||(t={}))qX.call(t,n)&&V4(e,n,t[n]);if(W4)for(var n of W4(t))KX.call(t,n)&&V4(e,n,t[n]);return e},QX=(e,t)=>UX(e,GX(t)),XX=ao((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(${Vt({size:n,sizes:Qo})} - ${Ue(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:Vt({size:n,sizes:Qo})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${Ue(2)}) calc(${e.spacing.xs} / 2)`},searchInput:QX(YX({},e.fn.fontStyles()),{flex:1,minWidth:Ue(60),backgroundColor:"transparent",border:0,outline:0,fontSize:Vt({size:n,sizes:e.fontSizes}),padding:0,marginLeft:`calc(${e.spacing.xs} / 2)`,appearance:"none",color:"inherit",maxHeight:Vt({size:n,sizes:bE}),"&::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 JX=XX;var ZX=Object.defineProperty,eJ=Object.defineProperties,tJ=Object.getOwnPropertyDescriptors,Lh=Object.getOwnPropertySymbols,IE=Object.prototype.hasOwnProperty,EE=Object.prototype.propertyIsEnumerable,U4=(e,t,n)=>t in e?ZX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hl=(e,t)=>{for(var n in t||(t={}))IE.call(t,n)&&U4(e,n,t[n]);if(Lh)for(var n of Lh(t))EE.call(t,n)&&U4(e,n,t[n]);return e},G4=(e,t)=>eJ(e,tJ(t)),nJ=(e,t)=>{var n={};for(var r in e)IE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Lh)for(var r of Lh(e))t.indexOf(r)<0&&EE.call(e,r)&&(n[r]=e[r]);return n};function rJ(e,t,n){return t?!1:n.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function oJ(e,t){return!!e&&!t.some(n=>n.value.toLowerCase()===e.toLowerCase())}function q4(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 sJ={size:"sm",valueComponent:wE,itemComponent:hy,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:rJ,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:oJ,switchDirectionOnFlip:!1,zIndex:uy("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},OE=f.forwardRef((e,t)=>{const n=wr("MultiSelect",sJ,e),{className:r,style:o,required:s,label:a,description:c,size:d,error:p,classNames:h,styles:m,wrapperProps:v,value:b,defaultValue:w,data:y,onChange:S,valueComponent:k,itemComponent:_,id:I,transitionProps:P,maxDropdownHeight:E,shadow:O,nothingFound:R,onFocus:M,onBlur:T,searchable:A,placeholder:$,filter:Q,limit:B,clearSearchOnChange:V,clearable:q,clearSearchOnBlur:G,variant:D,onSearchChange:z,searchValue:H,disabled:Y,initiallyOpened:ie,radius:ye,icon:Z,rightSection:oe,rightSectionWidth:K,creatable:U,getCreateLabel:ae,shouldCreate:re,onCreate:se,sx:pe,dropdownComponent:le,onDropdownClose:ge,onDropdownOpen:ke,maxSelectedValues:xe,withinPortal:de,portalProps:Ae,switchDirectionOnFlip:Ee,zIndex:$e,selectOnBlur:kt,name:ct,dropdownPosition:on,errorProps:vt,labelProps:bt,descriptionProps:Se,form:Me,positionDependencies:Pt,onKeyDown:At,unstyled:we,inputContainer:ht,inputWrapperOrder:$t,readOnly:zt,withAsterisk:ze,clearButtonProps:qe,hoverOnSearchChange:Pn,disableSelectedItemFiltering:Pe}=n,Je=nJ(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:Qe,cx:dt,theme:Lt}=JX({invalid:!!p},{name:"MultiSelect",classNames:h,styles:m,unstyled:we,size:d,variant:D}),{systemStyles:cr,rest:pn}=Mm(Je),ln=f.useRef(),Fr=f.useRef({}),br=fy(I),[Fn,Hn]=f.useState(ie),[Wn,Ar]=f.useState(-1),[Ro,Hr]=f.useState("column"),[Wr,fs]=od({value:H,defaultValue:"",finalValue:void 0,onChange:z}),[Nr,$s]=f.useState(!1),{scrollIntoView:ps,targetRef:da,scrollableRef:zs}=kj({duration:0,offset:5,cancelable:!1,isList:!0}),X=U&&typeof ae=="function";let ee=null;const he=y.map(Le=>typeof Le=="string"?{label:Le,value:Le}:Le),_e=pj({data:he}),[me,ut]=od({value:q4(b,y),defaultValue:q4(w,y),finalValue:[],onChange:S}),st=f.useRef(!!xe&&xe{if(!zt){const yt=me.filter(Mt=>Mt!==Le);ut(yt),xe&&yt.length{fs(Le.currentTarget.value),!Y&&!st.current&&A&&Hn(!0)},xt=Le=>{typeof M=="function"&&M(Le),!Y&&!st.current&&A&&Hn(!0)},He=IX({data:_e,searchable:A,searchValue:Wr,limit:B,filter:Q,value:me,disableSelectedItemFiltering:Pe});X&&re(Wr,_e)&&(ee=ae(Wr),He.push({label:Wr,value:Wr,creatable:!0}));const Ce=Math.min(Wn,He.length-1),Xe=(Le,yt,Mt)=>{let Wt=Le;for(;Mt(Wt);)if(Wt=yt(Wt),!He[Wt].disabled)return Wt;return Le};Ps(()=>{Ar(Pn&&Wr?0:-1)},[Wr,Pn]),Ps(()=>{!Y&&me.length>y.length&&Hn(!1),xe&&me.length=xe&&(st.current=!0,Hn(!1))},[me]);const jt=Le=>{if(!zt)if(V&&fs(""),me.includes(Le.value))Ht(Le.value);else{if(Le.creatable&&typeof se=="function"){const yt=se(Le.value);typeof yt<"u"&&yt!==null&&ut(typeof yt=="string"?[...me,yt]:[...me,yt.value])}else ut([...me,Le.value]);me.length===xe-1&&(st.current=!0,Hn(!1)),He.length===1&&Hn(!1)}},Et=Le=>{typeof T=="function"&&T(Le),kt&&He[Ce]&&Fn&&jt(He[Ce]),G&&fs(""),Hn(!1)},Nt=Le=>{if(Nr||(At==null||At(Le),zt)||Le.key!=="Backspace"&&xe&&st.current)return;const yt=Ro==="column",Mt=()=>{Ar(jn=>{var Gt;const un=Xe(jn,sn=>sn+1,sn=>sn{Ar(jn=>{var Gt;const un=Xe(jn,sn=>sn-1,sn=>sn>0);return Fn&&(da.current=Fr.current[(Gt=He[un])==null?void 0:Gt.value],ps({alignment:yt?"start":"end"})),un})};switch(Le.key){case"ArrowUp":{Le.preventDefault(),Hn(!0),yt?Wt():Mt();break}case"ArrowDown":{Le.preventDefault(),Hn(!0),yt?Mt():Wt();break}case"Enter":{Le.preventDefault(),He[Ce]&&Fn?jt(He[Ce]):Hn(!0);break}case" ":{A||(Le.preventDefault(),He[Ce]&&Fn?jt(He[Ce]):Hn(!0));break}case"Backspace":{me.length>0&&Wr.length===0&&(ut(me.slice(0,-1)),Hn(!0),xe&&(st.current=!1));break}case"Home":{if(!A){Le.preventDefault(),Fn||Hn(!0);const jn=He.findIndex(Gt=>!Gt.disabled);Ar(jn),ps({alignment:yt?"end":"start"})}break}case"End":{if(!A){Le.preventDefault(),Fn||Hn(!0);const jn=He.map(Gt=>!!Gt.disabled).lastIndexOf(!1);Ar(jn),ps({alignment:yt?"end":"start"})}break}case"Escape":Hn(!1)}},qt=me.map(Le=>{let yt=_e.find(Mt=>Mt.value===Le&&!Mt.disabled);return!yt&&X&&(yt={value:Le,label:Le}),yt}).filter(Le=>!!Le).map((Le,yt)=>F.createElement(k,G4(Hl({},Le),{variant:D,disabled:Y,className:Qe.value,readOnly:zt,onRemove:Mt=>{Mt.preventDefault(),Mt.stopPropagation(),Ht(Le.value)},key:Le.value,size:d,styles:m,classNames:h,radius:ye,index:yt}))),en=Le=>me.includes(Le),Zt=()=>{var Le;fs(""),ut([]),(Le=ln.current)==null||Le.focus(),xe&&(st.current=!1)},Ut=!zt&&(He.length>0?Fn:Fn&&!!R);return Ps(()=>{const Le=Ut?ke:ge;typeof Le=="function"&&Le()},[Ut]),F.createElement(Pc.Wrapper,Hl(Hl({required:s,id:br,label:a,error:p,description:c,size:d,className:r,style:o,classNames:h,styles:m,__staticSelector:"MultiSelect",sx:pe,errorProps:vt,descriptionProps:Se,labelProps:bt,inputContainer:ht,inputWrapperOrder:$t,unstyled:we,withAsterisk:ze,variant:D},cr),v),F.createElement(hi,{opened:Ut,transitionProps:P,shadow:"sm",withinPortal:de,portalProps:Ae,__staticSelector:"MultiSelect",onDirectionChange:Hr,switchDirectionOnFlip:Ee,zIndex:$e,dropdownPosition:on,positionDependencies:[...Pt,Wr],classNames:h,styles:m,unstyled:we,variant:D},F.createElement(hi.Target,null,F.createElement("div",{className:Qe.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":Fn&&Ut?`${br}-items`:null,"aria-controls":br,"aria-expanded":Fn,onMouseLeave:()=>Ar(-1),tabIndex:-1},F.createElement("input",{type:"hidden",name:ct,value:me.join(","),form:Me,disabled:Y}),F.createElement(Pc,Hl({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:d,variant:D,disabled:Y,error:p,required:s,radius:ye,icon:Z,unstyled:we,onMouseDown:Le=>{var yt;Le.preventDefault(),!Y&&!st.current&&Hn(!Fn),(yt=ln.current)==null||yt.focus()},classNames:G4(Hl({},h),{input:dt({[Qe.input]:!A},h==null?void 0:h.input)})},jE({theme:Lt,rightSection:oe,rightSectionWidth:K,styles:m,size:d,shouldClear:q&&me.length>0,onClear:Zt,error:p,disabled:Y,clearButtonProps:qe,readOnly:zt})),F.createElement("div",{className:Qe.values,"data-clearable":q||void 0},qt,F.createElement("input",Hl({ref:Ad(t,ln),type:"search",id:br,className:dt(Qe.searchInput,{[Qe.searchInputPointer]:!A,[Qe.searchInputInputHidden]:!Fn&&me.length>0||!A&&me.length>0,[Qe.searchInputEmpty]:me.length===0}),onKeyDown:Nt,value:Wr,onChange:ft,onFocus:xt,onBlur:Et,readOnly:!A||st.current||zt,placeholder:me.length===0?$:void 0,disabled:Y,"data-mantine-stop-propagation":Fn,autoComplete:"off",onCompositionStart:()=>$s(!0),onCompositionEnd:()=>$s(!1)},pn)))))),F.createElement(hi.Dropdown,{component:le||Nm,maxHeight:E,direction:Ro,id:br,innerRef:zs,__staticSelector:"MultiSelect",classNames:h,styles:m},F.createElement(py,{data:He,hovered:Ce,classNames:h,styles:m,uuid:br,__staticSelector:"MultiSelect",onItemHover:Ar,onItemSelect:jt,itemsRefs:Fr,itemComponent:_,size:d,nothingFound:R,isItemSelected:en,creatable:U&&!!ee,createLabel:ee,unstyled:we,variant:D}))))});OE.displayName="@mantine/core/MultiSelect";var aJ=Object.defineProperty,iJ=Object.defineProperties,lJ=Object.getOwnPropertyDescriptors,Bh=Object.getOwnPropertySymbols,RE=Object.prototype.hasOwnProperty,ME=Object.prototype.propertyIsEnumerable,K4=(e,t,n)=>t in e?aJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y0=(e,t)=>{for(var n in t||(t={}))RE.call(t,n)&&K4(e,n,t[n]);if(Bh)for(var n of Bh(t))ME.call(t,n)&&K4(e,n,t[n]);return e},cJ=(e,t)=>iJ(e,lJ(t)),uJ=(e,t)=>{var n={};for(var r in e)RE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Bh)for(var r of Bh(e))t.indexOf(r)<0&&ME.call(e,r)&&(n[r]=e[r]);return n};const dJ={type:"text",size:"sm",__staticSelector:"TextInput"},DE=f.forwardRef((e,t)=>{const n=ZI("TextInput",dJ,e),{inputProps:r,wrapperProps:o}=n,s=uJ(n,["inputProps","wrapperProps"]);return F.createElement(Pc.Wrapper,Y0({},o),F.createElement(Pc,cJ(Y0(Y0({},r),s),{ref:t})))});DE.displayName="@mantine/core/TextInput";function fJ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,filterDataOnExactSearchMatch:a}){if(!t)return e;const c=s!=null&&e.find(p=>p.value===s)||null;if(c&&!a&&(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 pJ=ao(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}}));const hJ=pJ;var mJ=Object.defineProperty,gJ=Object.defineProperties,vJ=Object.getOwnPropertyDescriptors,Fh=Object.getOwnPropertySymbols,TE=Object.prototype.hasOwnProperty,AE=Object.prototype.propertyIsEnumerable,Y4=(e,t,n)=>t in e?mJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bu=(e,t)=>{for(var n in t||(t={}))TE.call(t,n)&&Y4(e,n,t[n]);if(Fh)for(var n of Fh(t))AE.call(t,n)&&Y4(e,n,t[n]);return e},Q0=(e,t)=>gJ(e,vJ(t)),bJ=(e,t)=>{var n={};for(var r in e)TE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Fh)for(var r of Fh(e))t.indexOf(r)<0&&AE.call(e,r)&&(n[r]=e[r]);return n};function yJ(e,t){return t.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function xJ(e,t){return!!e&&!t.some(n=>n.label.toLowerCase()===e.toLowerCase())}const wJ={required:!1,size:"sm",shadow:"sm",itemComponent:hy,transitionProps:{transition:"fade",duration:0},initiallyOpened:!1,filter:yJ,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:xJ,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:uy("popover"),positionDependencies:[],dropdownPosition:"flip"},ky=f.forwardRef((e,t)=>{const n=ZI("Select",wJ,e),{inputProps:r,wrapperProps:o,shadow:s,data:a,value:c,defaultValue:d,onChange:p,itemComponent:h,onKeyDown:m,onBlur:v,onFocus:b,transitionProps:w,initiallyOpened:y,unstyled:S,classNames:k,styles:_,filter:I,maxDropdownHeight:P,searchable:E,clearable:O,nothingFound:R,limit:M,disabled:T,onSearchChange:A,searchValue:$,rightSection:Q,rightSectionWidth:B,creatable:V,getCreateLabel:q,shouldCreate:G,selectOnBlur:D,onCreate:z,dropdownComponent:H,onDropdownClose:Y,onDropdownOpen:ie,withinPortal:ye,portalProps:Z,switchDirectionOnFlip:oe,zIndex:K,name:U,dropdownPosition:ae,allowDeselect:re,placeholder:se,filterDataOnExactSearchMatch:pe,form:le,positionDependencies:ge,readOnly:ke,clearButtonProps:xe,hoverOnSearchChange:de}=n,Ae=bJ(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:Ee,cx:$e,theme:kt}=hJ(),[ct,on]=f.useState(y),[vt,bt]=f.useState(-1),Se=f.useRef(),Me=f.useRef({}),[Pt,At]=f.useState("column"),we=Pt==="column",{scrollIntoView:ht,targetRef:$t,scrollableRef:zt}=kj({duration:0,offset:5,cancelable:!1,isList:!0}),ze=re===void 0?O:re,qe=ee=>{if(ct!==ee){on(ee);const he=ee?ie:Y;typeof he=="function"&&he()}},Pn=V&&typeof q=="function";let Pe=null;const Je=a.map(ee=>typeof ee=="string"?{label:ee,value:ee}:ee),Qe=pj({data:Je}),[dt,Lt,cr]=od({value:c,defaultValue:d,finalValue:null,onChange:p}),pn=Qe.find(ee=>ee.value===dt),[ln,Fr]=od({value:$,defaultValue:(pn==null?void 0:pn.label)||"",finalValue:void 0,onChange:A}),br=ee=>{Fr(ee),E&&typeof A=="function"&&A(ee)},Fn=()=>{var ee;ke||(Lt(null),cr||br(""),(ee=Se.current)==null||ee.focus())};f.useEffect(()=>{const ee=Qe.find(he=>he.value===dt);ee?br(ee.label):(!Pn||!dt)&&br("")},[dt]),f.useEffect(()=>{pn&&(!E||!ct)&&br(pn.label)},[pn==null?void 0:pn.label]);const Hn=ee=>{if(!ke)if(ze&&(pn==null?void 0:pn.value)===ee.value)Lt(null),qe(!1);else{if(ee.creatable&&typeof z=="function"){const he=z(ee.value);typeof he<"u"&&he!==null&&Lt(typeof he=="string"?he:he.value)}else Lt(ee.value);cr||br(ee.label),bt(-1),qe(!1),Se.current.focus()}},Wn=fJ({data:Qe,searchable:E,limit:M,searchValue:ln,filter:I,filterDataOnExactSearchMatch:pe,value:dt});Pn&&G(ln,Wn)&&(Pe=q(ln),Wn.push({label:ln,value:ln,creatable:!0}));const Ar=(ee,he,_e)=>{let me=ee;for(;_e(me);)if(me=he(me),!Wn[me].disabled)return me;return ee};Ps(()=>{bt(de&&ln?0:-1)},[ln,de]);const Ro=dt?Wn.findIndex(ee=>ee.value===dt):0,Hr=!ke&&(Wn.length>0?ct:ct&&!!R),Wr=()=>{bt(ee=>{var he;const _e=Ar(ee,me=>me-1,me=>me>0);return $t.current=Me.current[(he=Wn[_e])==null?void 0:he.value],Hr&&ht({alignment:we?"start":"end"}),_e})},fs=()=>{bt(ee=>{var he;const _e=Ar(ee,me=>me+1,me=>mewindow.setTimeout(()=>{var ee;$t.current=Me.current[(ee=Wn[Ro])==null?void 0:ee.value],ht({alignment:we?"end":"start"})},50);Ps(()=>{Hr&&Nr()},[Hr]);const $s=ee=>{switch(typeof m=="function"&&m(ee),ee.key){case"ArrowUp":{ee.preventDefault(),ct?we?Wr():fs():(bt(Ro),qe(!0),Nr());break}case"ArrowDown":{ee.preventDefault(),ct?we?fs():Wr():(bt(Ro),qe(!0),Nr());break}case"Home":{if(!E){ee.preventDefault(),ct||qe(!0);const he=Wn.findIndex(_e=>!_e.disabled);bt(he),Hr&&ht({alignment:we?"end":"start"})}break}case"End":{if(!E){ee.preventDefault(),ct||qe(!0);const he=Wn.map(_e=>!!_e.disabled).lastIndexOf(!1);bt(he),Hr&&ht({alignment:we?"end":"start"})}break}case"Escape":{ee.preventDefault(),qe(!1),bt(-1);break}case" ":{E||(ee.preventDefault(),Wn[vt]&&ct?Hn(Wn[vt]):(qe(!0),bt(Ro),Nr()));break}case"Enter":E||ee.preventDefault(),Wn[vt]&&ct&&(ee.preventDefault(),Hn(Wn[vt]))}},ps=ee=>{typeof v=="function"&&v(ee);const he=Qe.find(_e=>_e.value===dt);D&&Wn[vt]&&ct&&Hn(Wn[vt]),br((he==null?void 0:he.label)||""),qe(!1)},da=ee=>{typeof b=="function"&&b(ee),E&&qe(!0)},zs=ee=>{ke||(br(ee.currentTarget.value),O&&ee.currentTarget.value===""&&Lt(null),bt(-1),qe(!0))},X=()=>{ke||(qe(!ct),dt&&!ct&&bt(Ro))};return F.createElement(Pc.Wrapper,Q0(bu({},o),{__staticSelector:"Select"}),F.createElement(hi,{opened:Hr,transitionProps:w,shadow:s,withinPortal:ye,portalProps:Z,__staticSelector:"Select",onDirectionChange:At,switchDirectionOnFlip:oe,zIndex:K,dropdownPosition:ae,positionDependencies:[...ge,ln],classNames:k,styles:_,unstyled:S,variant:r.variant},F.createElement(hi.Target,null,F.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":Hr?`${r.id}-items`:null,"aria-controls":r.id,"aria-expanded":Hr,onMouseLeave:()=>bt(-1),tabIndex:-1},F.createElement("input",{type:"hidden",name:U,value:dt||"",form:le,disabled:T}),F.createElement(Pc,bu(Q0(bu(bu({autoComplete:"off",type:"search"},r),Ae),{ref:Ad(t,Se),onKeyDown:$s,__staticSelector:"Select",value:ln,placeholder:se,onChange:zs,"aria-autocomplete":"list","aria-controls":Hr?`${r.id}-items`:null,"aria-activedescendant":vt>=0?`${r.id}-${vt}`:null,onMouseDown:X,onBlur:ps,onFocus:da,readOnly:!E||ke,disabled:T,"data-mantine-stop-propagation":Hr,name:null,classNames:Q0(bu({},k),{input:$e({[Ee.input]:!E},k==null?void 0:k.input)})}),jE({theme:kt,rightSection:Q,rightSectionWidth:B,styles:_,size:r.size,shouldClear:O&&!!pn,onClear:Fn,error:o.error,clearButtonProps:xe,disabled:T,readOnly:ke}))))),F.createElement(hi.Dropdown,{component:H||Nm,maxHeight:P,direction:Pt,id:r.id,innerRef:zt,__staticSelector:"Select",classNames:k,styles:_},F.createElement(py,{data:Wn,hovered:vt,classNames:k,styles:_,isItemSelected:ee=>ee===dt,uuid:r.id,__staticSelector:"Select",onItemHover:bt,onItemSelect:Hn,itemsRefs:Me,itemComponent:h,size:r.size,nothingFound:R,creatable:Pn&&!!Pe,createLabel:Pe,"aria-label":o.label,unstyled:S,variant:r.variant}))))});ky.displayName="@mantine/core/Select";const _y=()=>{const[e,t,n,r,o,s,a,c,d,p,h,m,v,b,w,y,S,k,_,I,P,E,O,R,M,T,A,$,Q,B,V,q,G,D,z,H,Y,ie]=Dc("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"]);return{base50:e,base100:t,base150:n,base200:r,base250:o,base300:s,base350:a,base400:c,base450:d,base500:p,base550:h,base600:m,base650:v,base700:b,base750:w,base800:y,base850:S,base900:k,base950:_,accent50:I,accent100:P,accent150:E,accent200:O,accent250:R,accent300:M,accent350:T,accent400:A,accent450:$,accent500:Q,accent550:B,accent600:V,accent650:q,accent700:G,accent750:D,accent800:z,accent850:H,accent900:Y,accent950:ie}},NE=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:a,base700:c,base800:d,base900:p,accent200:h,accent300:m,accent400:v,accent500:b,accent600:w}=_y(),{colorMode:y}=Ds(),[S]=Dc("shadows",["dark-lg"]);return f.useCallback(()=>({label:{color:Be(c,r)(y)},separatorLabel:{color:Be(s,s)(y),"::after":{borderTopColor:Be(r,c)(y)}},input:{backgroundColor:Be(e,p)(y),borderWidth:"2px",borderColor:Be(n,d)(y),color:Be(p,t)(y),paddingRight:24,fontWeight:600,"&:hover":{borderColor:Be(r,a)(y)},"&:focus":{borderColor:Be(m,w)(y)},"&:is(:focus, :hover)":{borderColor:Be(o,s)(y)},"&:focus-within":{borderColor:Be(h,w)(y)},"&[data-disabled]":{backgroundColor:Be(r,c)(y),color:Be(a,o)(y),cursor:"not-allowed"}},value:{backgroundColor:Be(t,p)(y),color:Be(p,t)(y),button:{color:Be(p,t)(y)},"&:hover":{backgroundColor:Be(r,c)(y),cursor:"pointer"}},dropdown:{backgroundColor:Be(n,d)(y),borderColor:Be(n,d)(y),boxShadow:S},item:{backgroundColor:Be(n,d)(y),color:Be(d,n)(y),padding:6,"&[data-hovered]":{color:Be(p,t)(y),backgroundColor:Be(r,c)(y)},"&[data-active]":{backgroundColor:Be(r,c)(y),"&:hover":{color:Be(p,t)(y),backgroundColor:Be(r,c)(y)}},"&[data-selected]":{backgroundColor:Be(v,w)(y),color:Be(e,t)(y),fontWeight:600,"&:hover":{backgroundColor:Be(b,b)(y),color:Be("white",e)(y)}},"&[data-disabled]":{color:Be(s,a)(y),cursor:"not-allowed"}},rightSection:{width:32,button:{color:Be(p,t)(y)}}}),[h,m,v,b,w,t,n,r,o,e,s,a,c,d,p,S,y])},SJ=e=>{const{searchable:t=!0,tooltip:n,inputRef:r,onChange:o,label:s,disabled:a,...c}=e,d=te(),[p,h]=f.useState(""),m=f.useCallback(y=>{y.shiftKey&&d(Po(!0))},[d]),v=f.useCallback(y=>{y.shiftKey||d(Po(!1))},[d]),b=f.useCallback(y=>{h(""),o&&o(y)},[o]),w=NE();return i.jsx(wn,{label:n,placement:"top",hasArrow:!0,children:i.jsx(ky,{ref:r,label:s?i.jsx(mo,{isDisabled:a,children:i.jsx(zo,{children:s})}):void 0,disabled:a,searchValue:p,onSearchChange:h,onChange:b,onKeyDown:m,onKeyUp:v,searchable:t,maxDropdownHeight:300,styles:w,...c})})},ar=f.memo(SJ),$E=f.forwardRef(({label:e,tooltip:t,description:n,disabled:r,...o},s)=>i.jsx(wn,{label:t,placement:"top",hasArrow:!0,openDelay:500,children:i.jsx(Re,{ref:s,...o,children:i.jsxs(Re,{children:[i.jsx(Sc,{children:e}),n&&i.jsx(Sc,{size:"xs",color:"base.600",children:n})]})})}));$E.displayName="IAIMantineSelectItemWithTooltip";const Oi=f.memo($E),CJ=fe([Ye],({gallery:e})=>{const{autoAddBoardId:t}=e;return{autoAddBoardId:t}},Ge),kJ=()=>{const e=te(),{autoAddBoardId:t}=L(CJ),n=f.useRef(null),{boards:r,hasBoards:o}=Zh(void 0,{selectFromResult:({data:a})=>{const c=[{label:"None",value:"none"}];return a==null||a.forEach(({board_id:d,board_name:p})=>{c.push({label:p,value:d})}),{boards:c,hasBoards:c.length>1}}}),s=f.useCallback(a=>{a&&e(R_(a==="none"?void 0:a))},[e]);return i.jsx(ar,{label:"Auto-Add Board",inputRef:n,autoFocus:!0,placeholder:"Select a Board",value:t,data:r,nothingFound:"No matching Boards",itemComponent:Oi,disabled:!o,filter:(a,c)=>{var d;return((d=c.label)==null?void 0:d.toLowerCase().includes(a.toLowerCase().trim()))||c.value.toLowerCase().includes(a.toLowerCase().trim())},onChange:s})},_J=fe([Ye],e=>{const{galleryImageMinimumWidth:t,shouldAutoSwitch:n}=e.gallery;return{galleryImageMinimumWidth:t,shouldAutoSwitch:n}},Ge),PJ=()=>{const e=te(),{t}=be(),{galleryImageMinimumWidth:n,shouldAutoSwitch:r}=L(_J),o=s=>{e(Op(s))};return i.jsx(gl,{triggerComponent:i.jsx(Fe,{tooltip:t("gallery.gallerySettings"),"aria-label":t("gallery.gallerySettings"),size:"sm",icon:i.jsx(Wb,{})}),children:i.jsxs(W,{direction:"column",gap:4,children:[i.jsx(_t,{value:n,onChange:o,min:32,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:()=>e(Op(64))}),i.jsx(Gn,{label:t("gallery.autoSwitchNewImages"),isChecked:r,onChange:s=>e(FR(s.target.checked))}),i.jsx(kJ,{})]})})},jJ=e=>e.image?i.jsx(gm,{sx:{w:`${e.image.width}px`,h:"auto",objectFit:"contain",aspectRatio:`${e.image.width}/${e.image.height}`}}):i.jsx(W,{sx:{opacity:.7,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",bg:"base.200",_dark:{bg:"base.900"}},children:i.jsx(dl,{size:"xl"})}),mi=e=>{const{icon:t=al,boxSize:n=16}=e;return i.jsxs(W,{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"},...e.sx},children:[i.jsx(no,{as:t,boxSize:n,opacity:.7}),e.label&&i.jsx(tt,{textAlign:"center",children:e.label})]})},Lm=0,Ri=1,Uc=2,zE=4;function IJ(e,t){return n=>e(t(n))}function EJ(e,t){return t(e)}function LE(e,t){return n=>e(t,n)}function Q4(e,t){return()=>e(t)}function Py(e,t){return t(e),e}function yl(...e){return e}function OJ(e){e()}function X4(e){return()=>e}function RJ(...e){return()=>{e.map(OJ)}}function Bm(){}function ho(e,t){return e(Ri,t)}function Mr(e,t){e(Lm,t)}function jy(e){e(Uc)}function Fm(e){return e(zE)}function Un(e,t){return ho(e,LE(t,Lm))}function J4(e,t){const n=e(Ri,r=>{n(),t(r)});return n}function xr(){const e=[];return(t,n)=>{switch(t){case Uc:e.splice(0,e.length);return;case Ri:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case Lm:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function Kt(e){let t=e;const n=xr();return(r,o)=>{switch(r){case Ri:o(t);break;case Lm:t=o;break;case zE:return t}return n(r,o)}}function MJ(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case Ri:return s?n===s?void 0:(r(),n=s,t=ho(e,s),t):(r(),Bm);case Uc:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function zu(e){return Py(xr(),t=>Un(e,t))}function pc(e,t){return Py(Kt(t),n=>Un(e,n))}function DJ(...e){return t=>e.reduceRight(EJ,t)}function Yt(e,...t){const n=DJ(...t);return(r,o)=>{switch(r){case Ri:return ho(e,n(o));case Uc:jy(e);return}}}function BE(e,t){return e===t}function So(e=BE){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function qr(e){return t=>n=>{e(n)&&t(n)}}function tr(e){return t=>IJ(t,e)}function ai(e){return t=>()=>t(e)}function fp(e,t){return n=>r=>n(t=e(t,r))}function m1(e){return t=>n=>{e>0?e--:t(n)}}function Iu(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Z4(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Ys(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,a)=>{const c=Math.pow(2,a);ho(s,d=>{const p=n;n=n|c,t[a]=d,p!==o&&n===o&&r&&(r(),r=null)})}),s=>a=>{const c=()=>s([a].concat(t));n===o?c():r=c}}function ek(...e){return function(t,n){switch(t){case Ri:return RJ(...e.map(r=>ho(r,n)));case Uc:return;default:throw new Error(`unrecognized action ${t}`)}}}function xn(e,t=BE){return Yt(e,So(t))}function Sa(...e){const t=xr(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,a)=>{const c=Math.pow(2,a);ho(s,d=>{n[a]=d,r=r|c,r===o&&Mr(t,n)})}),function(s,a){switch(s){case Ri:return r===o&&a(n),ho(t,a);case Uc:return jy(t);default:throw new Error(`unrecognized action ${s}`)}}}function ua(e,t=[],{singleton:n}={singleton:!0}){return{id:TJ(),constructor:e,dependencies:t,singleton:n}}const TJ=()=>Symbol();function AJ(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:a})=>{if(a&&t.has(r))return t.get(r);const c=o(s.map(d=>n(d)));return a&&t.set(r,c),c};return n(e)}function NJ(e,t){const n={},r={};let o=0;const s=e.length;for(;o(S[k]=_=>{const I=y[t.methods[k]];Mr(I,_)},S),{})}function h(y){return a.reduce((S,k)=>(S[k]=MJ(y[t.events[k]]),S),{})}return{Component:F.forwardRef((y,S)=>{const{children:k,..._}=y,[I]=F.useState(()=>Py(AJ(e),E=>d(E,_))),[P]=F.useState(Q4(h,I));return pp(()=>{for(const E of a)E in _&&ho(P[E],_[E]);return()=>{Object.values(P).map(jy)}},[_,P,I]),pp(()=>{d(I,_)}),F.useImperativeHandle(S,X4(p(I))),F.createElement(c.Provider,{value:I},n?F.createElement(n,NJ([...r,...o,...a],_),k):k)}),usePublisher:y=>F.useCallback(LE(Mr,F.useContext(c)[y]),[y]),useEmitterValue:y=>{const k=F.useContext(c)[y],[_,I]=F.useState(Q4(Fm,k));return pp(()=>ho(k,P=>{P!==_&&I(X4(P))}),[k,_]),_},useEmitter:(y,S)=>{const _=F.useContext(c)[y];pp(()=>ho(_,S),[S,_])}}}const zJ=typeof document<"u"?F.useLayoutEffect:F.useEffect,LJ=zJ;var Iy=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Iy||{});const BJ={0:"debug",1:"log",2:"warn",3:"error"},FJ=()=>typeof globalThis>"u"?window:globalThis,FE=ua(()=>{const e=Kt(3);return{log:Kt((n,r,o=1)=>{var s;const a=(s=FJ().VIRTUOSO_LOG_LEVEL)!=null?s:Fm(e);o>=a&&console[BJ[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function HE(e,t=!0){const n=F.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=F.useMemo(()=>new ResizeObserver(s=>{const a=s[0].target;a.offsetParent!==null&&e(a)}),[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 Hm(e,t=!0){return HE(e,t).callbackRef}function Hh(e,t){return Math.round(e.getBoundingClientRect()[t])}function WE(e,t){return Math.abs(e-t)<1.01}function VE(e,t,n,r=Bm,o){const s=F.useRef(null),a=F.useRef(null),c=F.useRef(null),d=F.useCallback(m=>{const v=m.target,b=v===window||v===document,w=b?window.pageYOffset||document.documentElement.scrollTop:v.scrollTop,y=b?document.documentElement.scrollHeight:v.scrollHeight,S=b?window.innerHeight:v.offsetHeight,k=()=>{e({scrollTop:Math.max(w,0),scrollHeight:y,viewportHeight:S})};m.suppressFlushSync?k():HR.flushSync(k),a.current!==null&&(w===a.current||w<=0||w===y-S)&&(a.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t]);F.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 v=s.current;if(!v||"offsetHeight"in v&&v.offsetHeight===0)return;const b=m.behavior==="smooth";let w,y,S;v===window?(y=Math.max(Hh(document.documentElement,"height"),document.documentElement.scrollHeight),w=window.innerHeight,S=document.documentElement.scrollTop):(y=v.scrollHeight,w=Hh(v,"height"),S=v.scrollTop);const k=y-w;if(m.top=Math.ceil(Math.max(Math.min(k,m.top),0)),WE(w,y)||m.top===S){e({scrollTop:S,scrollHeight:y,viewportHeight:w}),b&&t(!0);return}b?(a.current=m.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,a.current=null,t(!0)},1e3)):a.current=null,v.scrollTo(m)}function h(m){s.current.scrollBy(m)}return{scrollerRef:s,scrollByCallback:h,scrollToCallback:p}}const Wm=ua(()=>{const e=xr(),t=xr(),n=Kt(0),r=xr(),o=Kt(0),s=xr(),a=xr(),c=Kt(0),d=Kt(0),p=Kt(0),h=Kt(0),m=xr(),v=xr(),b=Kt(!1);return Un(Yt(e,tr(({scrollTop:w})=>w)),t),Un(Yt(e,tr(({scrollHeight:w})=>w)),a),Un(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:c,fixedHeaderHeight:d,fixedFooterHeight:p,footerHeight:h,scrollHeight:a,smoothScrollTargetReached:r,scrollTo:m,scrollBy:v,statefulScrollTop:o,deviation:n,scrollingInProgress:b}},[],{singleton:!0}),HJ=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function WJ(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!HJ)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Wh="up",Lu="down",VJ="none",UJ={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},GJ=0,UE=ua(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const a=Kt(!1),c=Kt(!0),d=xr(),p=xr(),h=Kt(4),m=Kt(GJ),v=pc(Yt(ek(Yt(xn(t),m1(1),ai(!0)),Yt(xn(t),m1(1),ai(!1),Z4(100))),So()),!1),b=pc(Yt(ek(Yt(s,ai(!0)),Yt(s,ai(!1),Z4(200))),So()),!1);Un(Yt(Sa(xn(t),xn(m)),tr(([_,I])=>_<=I),So()),c),Un(Yt(c,Iu(50)),p);const w=zu(Yt(Sa(e,xn(n),xn(r),xn(o),xn(h)),fp((_,[{scrollTop:I,scrollHeight:P},E,O,R,M])=>{const T=I+E-P>-M,A={viewportHeight:E,scrollTop:I,scrollHeight:P};if(T){let Q,B;return I>_.state.scrollTop?(Q="SCROLLED_DOWN",B=_.state.scrollTop-I):(Q="SIZE_DECREASED",B=_.state.scrollTop-I||_.scrollTopDelta),{atBottom:!0,state:A,atBottomBecause:Q,scrollTopDelta:B}}let $;return A.scrollHeight>_.state.scrollHeight?$="SIZE_INCREASED":E<_.state.viewportHeight?$="VIEWPORT_HEIGHT_DECREASING":I<_.state.scrollTop?$="SCROLLING_UPWARDS":$="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:$,state:A}},UJ),So((_,I)=>_&&_.atBottom===I.atBottom))),y=pc(Yt(e,fp((_,{scrollTop:I,scrollHeight:P,viewportHeight:E})=>{if(WE(_.scrollHeight,P))return{scrollTop:I,scrollHeight:P,jump:0,changed:!1};{const O=P-(I+E)<1;return _.scrollTop!==I&&O?{scrollHeight:P,scrollTop:I,jump:_.scrollTop-I,changed:!0}:{scrollHeight:P,scrollTop:I,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),qr(_=>_.changed),tr(_=>_.jump)),0);Un(Yt(w,tr(_=>_.atBottom)),a),Un(Yt(a,Iu(50)),d);const S=Kt(Lu);Un(Yt(e,tr(({scrollTop:_})=>_),So(),fp((_,I)=>Fm(b)?{direction:_.direction,prevScrollTop:I}:{direction:I<_.prevScrollTop?Wh:Lu,prevScrollTop:I},{direction:Lu,prevScrollTop:0}),tr(_=>_.direction)),S),Un(Yt(e,Iu(50),ai(VJ)),S);const k=Kt(0);return Un(Yt(v,qr(_=>!_),ai(0)),k),Un(Yt(t,Iu(100),Ys(v),qr(([_,I])=>!!I),fp(([_,I],[P])=>[I,P],[0,0]),tr(([_,I])=>I-_)),k),{isScrolling:v,isAtTop:c,isAtBottom:a,atBottomState:w,atTopStateChange:p,atBottomStateChange:d,scrollDirection:S,atBottomThreshold:h,atTopThreshold:m,scrollVelocity:k,lastJumpDueToItemResize:y}},yl(Wm)),qJ=ua(([{log:e}])=>{const t=Kt(!1),n=zu(Yt(t,qr(r=>r),So()));return ho(t,r=>{r&&Fm(e)("props updated",{},Iy.DEBUG)}),{propsReady:t,didMount:n}},yl(FE),{singleton:!0});function GE(e,t){e==0?t():requestAnimationFrame(()=>GE(e-1,t))}function KJ(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}function g1(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function YJ(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const Vh="top",Uh="bottom",tk="none";function nk(e,t,n){return typeof e=="number"?n===Wh&&t===Vh||n===Lu&&t===Uh?e:0:n===Wh?t===Vh?e.main:e.reverse:t===Uh?e.main:e.reverse}function rk(e,t){return typeof e=="number"?e:e[t]||0}const QJ=ua(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=xr(),a=Kt(0),c=Kt(0),d=Kt(0),p=pc(Yt(Sa(xn(e),xn(t),xn(r),xn(s,g1),xn(d),xn(a),xn(o),xn(n),xn(c)),tr(([h,m,v,[b,w],y,S,k,_,I])=>{const P=h-_,E=S+k,O=Math.max(v-P,0);let R=tk;const M=rk(I,Vh),T=rk(I,Uh);return b-=_,b+=v+k,w+=v+k,w-=_,b>h+E-M&&(R=Wh),wh!=null),So(g1)),[0,0]);return{listBoundary:s,overscan:d,topListHeight:a,increaseViewportBy:c,visibleRange:p}},yl(Wm),{singleton:!0}),XJ=ua(([{scrollVelocity:e}])=>{const t=Kt(!1),n=xr(),r=Kt(!1);return Un(Yt(e,Ys(r,t,n),qr(([o,s])=>!!s),tr(([o,s,a,c])=>{const{exit:d,enter:p}=s;if(a){if(d(o,c))return!1}else if(p(o,c))return!0;return a}),So()),t),ho(Yt(Sa(t,e,n),Ys(r)),([[o,s,a],c])=>o&&c&&c.change&&c.change(s,a)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},yl(UE),{singleton:!0});function JJ(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const ZJ=ua(([{scrollTo:e,scrollContainerState:t}])=>{const n=xr(),r=xr(),o=xr(),s=Kt(!1),a=Kt(void 0);return Un(Yt(Sa(n,r),tr(([{viewportHeight:c,scrollTop:d,scrollHeight:p},{offsetTop:h}])=>({scrollTop:Math.max(0,d-h),scrollHeight:p,viewportHeight:c}))),t),Un(Yt(e,Ys(r),tr(([c,{offsetTop:d}])=>({...c,top:c.top+d}))),o),{useWindowScroll:s,customScrollParent:a,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},yl(Wm)),X0="-webkit-sticky",ok="sticky",qE=JJ(()=>{if(typeof document>"u")return ok;const e=document.createElement("div");return e.style.position=X0,e.style.position===X0?X0:ok});function eZ(e,t){const n=F.useRef(null),r=F.useCallback(c=>{if(c===null||!c.offsetParent)return;const d=c.getBoundingClientRect(),p=d.width;let h,m;if(t){const v=t.getBoundingClientRect(),b=d.top-v.top;h=v.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}=HE(r),a=F.useCallback(()=>{r(s.current)},[r,s]);return F.useEffect(()=>{if(t){t.addEventListener("scroll",a);const c=new ResizeObserver(a);return c.observe(t),()=>{t.removeEventListener("scroll",a),c.unobserve(t)}}else return window.addEventListener("scroll",a),window.addEventListener("resize",a),()=>{window.removeEventListener("scroll",a),window.removeEventListener("resize",a)}},[a,t]),o}F.createContext(void 0);const KE=F.createContext(void 0);function tZ(e){return e}qE();const nZ={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},YE={width:"100%",height:"100%",position:"absolute",top:0};qE();function el(e,t){if(typeof e!="string")return{context:t}}function rZ({usePublisher:e,useEmitter:t,useEmitterValue:n}){return F.memo(function({style:s,children:a,...c}){const d=e("scrollContainerState"),p=n("ScrollerComponent"),h=e("smoothScrollTargetReached"),m=n("scrollerRef"),v=n("context"),{scrollerRef:b,scrollByCallback:w,scrollToCallback:y}=VE(d,h,p,m);return t("scrollTo",y),t("scrollBy",w),F.createElement(p,{ref:b,style:{...nZ,...s},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...c,...el(p,v)},a)})}function oZ({usePublisher:e,useEmitter:t,useEmitterValue:n}){return F.memo(function({style:s,children:a,...c}){const d=e("windowScrollContainerState"),p=n("ScrollerComponent"),h=e("smoothScrollTargetReached"),m=n("totalListHeight"),v=n("deviation"),b=n("customScrollParent"),w=n("context"),{scrollerRef:y,scrollByCallback:S,scrollToCallback:k}=VE(d,h,p,Bm,b);return LJ(()=>(y.current=b||window,()=>{y.current=null}),[y,b]),t("windowScrollTo",k),t("scrollBy",S),F.createElement(p,{style:{position:"relative",...s,...m!==0?{height:m+v}:{}},"data-virtuoso-scroller":!0,...c,...el(p,w)},a)})}const sk={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},sZ={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:ak,ceil:ik,floor:Gh,min:J0,max:Bu}=Math;function aZ(e){return{...sZ,items:e}}function lk(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 iZ(e,t){return e&&e.column===t.column&&e.row===t.row}function hp(e,t){return e&&e.width===t.width&&e.height===t.height}const lZ=ua(([{overscan:e,visibleRange:t,listBoundary:n},{scrollTop:r,viewportHeight:o,scrollBy:s,scrollTo:a,smoothScrollTargetReached:c,scrollContainerState:d,footerHeight:p,headerHeight:h},m,v,{propsReady:b,didMount:w},{windowViewportRect:y,useWindowScroll:S,customScrollParent:k,windowScrollContainerState:_,windowScrollTo:I},P])=>{const E=Kt(0),O=Kt(0),R=Kt(sk),M=Kt({height:0,width:0}),T=Kt({height:0,width:0}),A=xr(),$=xr(),Q=Kt(0),B=Kt(null),V=Kt({row:0,column:0}),q=xr(),G=xr(),D=Kt(!1),z=Kt(0),H=Kt(!0),Y=Kt(!1);ho(Yt(w,Ys(z),qr(([U,ae])=>!!ae)),()=>{Mr(H,!1),Mr(O,0)}),ho(Yt(Sa(w,H,T,M,z,Y),qr(([U,ae,re,se,,pe])=>U&&!ae&&re.height!==0&&se.height!==0&&!pe)),([,,,,U])=>{Mr(Y,!0),GE(1,()=>{Mr(A,U)}),J4(Yt(r),()=>{Mr(n,[0,0]),Mr(H,!0)})}),Un(Yt(G,qr(U=>U!=null&&U.scrollTop>0),ai(0)),O),ho(Yt(w,Ys(G),qr(([,U])=>U!=null)),([,U])=>{U&&(Mr(M,U.viewport),Mr(T,U==null?void 0:U.item),Mr(V,U.gap),U.scrollTop>0&&(Mr(D,!0),J4(Yt(r,m1(1)),ae=>{Mr(D,!1)}),Mr(a,{top:U.scrollTop})))}),Un(Yt(M,tr(({height:U})=>U)),o),Un(Yt(Sa(xn(M,hp),xn(T,hp),xn(V,(U,ae)=>U&&U.column===ae.column&&U.row===ae.row),xn(r)),tr(([U,ae,re,se])=>({viewport:U,item:ae,gap:re,scrollTop:se}))),q),Un(Yt(Sa(xn(E),t,xn(V,iZ),xn(T,hp),xn(M,hp),xn(B),xn(O),xn(D),xn(H),xn(z)),qr(([,,,,,,,U])=>!U),tr(([U,[ae,re],se,pe,le,ge,ke,,xe,de])=>{const{row:Ae,column:Ee}=se,{height:$e,width:kt}=pe,{width:ct}=le;if(ke===0&&(U===0||ct===0))return sk;if(kt===0){const $t=KJ(de,U),zt=$t===0?Math.max(ke-1,0):$t;return aZ(lk($t,zt,ge))}const on=QE(ct,kt,Ee);let vt,bt;xe?ae===0&&re===0&&ke>0?(vt=0,bt=ke-1):(vt=on*Gh((ae+Ae)/($e+Ae)),bt=on*ik((re+Ae)/($e+Ae))-1,bt=J0(U-1,Bu(bt,on-1)),vt=J0(bt,Bu(0,vt))):(vt=0,bt=-1);const Se=lk(vt,bt,ge),{top:Me,bottom:Pt}=ck(le,se,pe,Se),At=ik(U/on),ht=At*$e+(At-1)*Ae-Pt;return{items:Se,offsetTop:Me,offsetBottom:ht,top:Me,bottom:Pt,itemHeight:$e,itemWidth:kt}})),R),Un(Yt(B,qr(U=>U!==null),tr(U=>U.length)),E),Un(Yt(Sa(M,T,R,V),qr(([U,ae,{items:re}])=>re.length>0&&ae.height!==0&&U.height!==0),tr(([U,ae,{items:re},se])=>{const{top:pe,bottom:le}=ck(U,se,ae,re);return[pe,le]}),So(g1)),n);const ie=Kt(!1);Un(Yt(r,Ys(ie),tr(([U,ae])=>ae||U!==0)),ie);const ye=zu(Yt(xn(R),qr(({items:U})=>U.length>0),Ys(E,ie),qr(([{items:U},ae,re])=>re&&U[U.length-1].index===ae-1),tr(([,U])=>U-1),So())),Z=zu(Yt(xn(R),qr(({items:U})=>U.length>0&&U[0].index===0),ai(0),So())),oe=zu(Yt(xn(R),Ys(D),qr(([{items:U},ae])=>U.length>0&&!ae),tr(([{items:U}])=>({startIndex:U[0].index,endIndex:U[U.length-1].index})),So(YJ),Iu(0)));Un(oe,v.scrollSeekRangeChanged),Un(Yt(A,Ys(M,T,E,V),tr(([U,ae,re,se,pe])=>{const le=WJ(U),{align:ge,behavior:ke,offset:xe}=le;let de=le.index;de==="LAST"&&(de=se-1),de=Bu(0,de,J0(se-1,de));let Ae=v1(ae,pe,re,de);return ge==="end"?Ae=ak(Ae-ae.height+re.height):ge==="center"&&(Ae=ak(Ae-ae.height/2+re.height/2)),xe&&(Ae+=xe),{top:Ae,behavior:ke}})),a);const K=pc(Yt(R,tr(U=>U.offsetBottom+U.bottom)),0);return Un(Yt(y,tr(U=>({width:U.visibleWidth,height:U.visibleHeight}))),M),{data:B,totalCount:E,viewportDimensions:M,itemDimensions:T,scrollTop:r,scrollHeight:$,overscan:e,scrollBy:s,scrollTo:a,scrollToIndex:A,smoothScrollTargetReached:c,windowViewportRect:y,windowScrollTo:I,useWindowScroll:S,customScrollParent:k,windowScrollContainerState:_,deviation:Q,scrollContainerState:d,footerHeight:p,headerHeight:h,initialItemCount:O,gap:V,restoreStateFrom:G,...v,initialTopMostItemIndex:z,gridState:R,totalListHeight:K,...m,startReached:Z,endReached:ye,rangeChanged:oe,stateChanged:q,propsReady:b,stateRestoreInProgress:D,...P}},yl(QJ,Wm,UE,XJ,qJ,ZJ,FE));function ck(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=v1(e,t,n,r[0].index),a=v1(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:a}}function v1(e,t,n,r){const o=QE(e.width,n.width,t.column),s=Gh(r/o),a=s*n.height+Bu(0,s-1)*t.row;return a>0?a+t.row:a}function QE(e,t,n){return Bu(1,Gh((e+n)/(Gh(t)+n)))}const cZ=ua(()=>{const e=Kt(p=>`Item ${p}`),t=Kt({}),n=Kt(null),r=Kt("virtuoso-grid-item"),o=Kt("virtuoso-grid-list"),s=Kt(tZ),a=Kt("div"),c=Kt(Bm),d=(p,h=null)=>pc(Yt(t,tr(m=>m[p]),So()),h);return{context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:a,scrollerRef:c,FooterComponent:d("Footer"),HeaderComponent:d("Header"),ListComponent:d("List","div"),ItemComponent:d("Item","div"),ScrollerComponent:d("Scroller","div"),ScrollSeekPlaceholder:d("ScrollSeekPlaceholder","div")}}),uZ=ua(([e,t])=>({...e,...t}),yl(lZ,cZ)),dZ=F.memo(function(){const t=pr("gridState"),n=pr("listClassName"),r=pr("itemClassName"),o=pr("itemContent"),s=pr("computeItemKey"),a=pr("isSeeking"),c=Is("scrollHeight"),d=pr("ItemComponent"),p=pr("ListComponent"),h=pr("ScrollSeekPlaceholder"),m=pr("context"),v=Is("itemDimensions"),b=Is("gap"),w=pr("log"),y=pr("stateRestoreInProgress"),S=Hm(k=>{const _=k.parentElement.parentElement.scrollHeight;c(_);const I=k.firstChild;if(I){const{width:P,height:E}=I.getBoundingClientRect();v({width:P,height:E})}b({row:uk("row-gap",getComputedStyle(k).rowGap,w),column:uk("column-gap",getComputedStyle(k).columnGap,w)})});return y?null:F.createElement(p,{ref:S,className:n,...el(p,m),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map(k=>{const _=s(k.index,k.data,m);return a?F.createElement(h,{key:_,...el(h,m),index:k.index,height:t.itemHeight,width:t.itemWidth}):F.createElement(d,{...el(d,m),className:r,"data-index":k.index,key:_},o(k.index,k.data,m))}))}),fZ=F.memo(function(){const t=pr("HeaderComponent"),n=Is("headerHeight"),r=pr("headerFooterTag"),o=Hm(a=>n(Hh(a,"height"))),s=pr("context");return t?F.createElement(r,{ref:o},F.createElement(t,el(t,s))):null}),pZ=F.memo(function(){const t=pr("FooterComponent"),n=Is("footerHeight"),r=pr("headerFooterTag"),o=Hm(a=>n(Hh(a,"height"))),s=pr("context");return t?F.createElement(r,{ref:o},F.createElement(t,el(t,s))):null}),hZ=({children:e})=>{const t=F.useContext(KE),n=Is("itemDimensions"),r=Is("viewportDimensions"),o=Hm(s=>{r(s.getBoundingClientRect())});return F.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),F.createElement("div",{style:YE,ref:o},e)},mZ=({children:e})=>{const t=F.useContext(KE),n=Is("windowViewportRect"),r=Is("itemDimensions"),o=pr("customScrollParent"),s=eZ(n,o);return F.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),F.createElement("div",{ref:s,style:YE},e)},gZ=F.memo(function({...t}){const n=pr("useWindowScroll"),r=pr("customScrollParent"),o=r||n?yZ:bZ,s=r||n?mZ:hZ;return F.createElement(o,{...t},F.createElement(s,null,F.createElement(fZ,null),F.createElement(dZ,null),F.createElement(pZ,null)))}),{Component:vZ,usePublisher:Is,useEmitterValue:pr,useEmitter:XE}=$J(uZ,{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"}},gZ),bZ=rZ({usePublisher:Is,useEmitterValue:pr,useEmitter:XE}),yZ=oZ({usePublisher:Is,useEmitterValue:pr,useEmitter:XE});function uk(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Iy.WARN),t==="normal"?0:parseInt(t??"0",10)}const JE=vZ,xZ=({imageDTO:e})=>i.jsx(W,{sx:{pointerEvents:"none",flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,p:2,alignItems:"flex-start",gap:2},children:i.jsxs(pl,{variant:"solid",colorScheme:"base",children:[e.width," × ",e.height]})}),Vm=({postUploadAction:e,isDisabled:t})=>{const n=L(d=>d.gallery.autoAddBoardId),[r]=I_(),o=f.useCallback(d=>{const p=d[0];p&&r({file:p,image_category:"user",is_intermediate:!1,postUploadAction:e??{type:"TOAST"},board_id:n})},[n,e,r]),{getRootProps:s,getInputProps:a,open:c}=zb({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},onDropAccepted:o,disabled:t,noDrag:!0,multiple:!1});return{getUploadButtonProps:s,getUploadInputProps:a,openUploader:c}},Ey=()=>{const e=te(),t=Fc(),{t:n}=be(),r=f.useCallback(()=>{t({title:n("toast.parameterSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),o=f.useCallback(()=>{t({title:n("toast.parameterNotSet"),status:"warning",duration:2500,isClosable:!0})},[n,t]),s=f.useCallback(()=>{t({title:n("toast.parametersSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),a=f.useCallback(()=>{t({title:n("toast.parametersNotSet"),status:"warning",duration:2500,isClosable:!0})},[n,t]),c=f.useCallback((P,E)=>{if(If(P)||Ef(E)){If(P)&&e(Mu(P)),Ef(E)&&e(Du(E)),r();return}o()},[e,r,o]),d=f.useCallback(P=>{if(!If(P)){o();return}e(Mu(P)),r()},[e,r,o]),p=f.useCallback(P=>{if(!Ef(P)){o();return}e(Du(P)),r()},[e,r,o]),h=f.useCallback(P=>{if(!R2(P)){o();return}e(Rp(P)),r()},[e,r,o]),m=f.useCallback(P=>{if(!M2(P)){o();return}e(Mp(P)),r()},[e,r,o]),v=f.useCallback(P=>{if(!D2(P)){o();return}e(hv(P)),r()},[e,r,o]),b=f.useCallback(P=>{if(!T2(P)){o();return}e(mv(P)),r()},[e,r,o]),w=f.useCallback(P=>{if(!A2(P)){o();return}e(Dp(P)),r()},[e,r,o]),y=f.useCallback(P=>{if(!N2(P)){o();return}e(hc(P)),r()},[e,r,o]),S=f.useCallback(P=>{if(!$2(P)){o();return}e(mc(P)),r()},[e,r,o]),k=f.useCallback(P=>{if(!z2(P)){o();return}e(Tp(P)),r()},[e,r,o]),_=f.useCallback(P=>{e($1(P))},[e]),I=f.useCallback(P=>{if(!P){a();return}const{cfg_scale:E,height:O,model:R,positive_prompt:M,negative_prompt:T,scheduler:A,seed:$,steps:Q,width:B,strength:V}=P;M2(E)&&e(Mp(E)),D2(R)&&e(hv(R)),If(M)&&e(Mu(M)),Ef(T)&&e(Du(T)),T2(A)&&e(mv(A)),R2($)&&e(Rp($)),A2(Q)&&e(Dp(Q)),N2(B)&&e(hc(B)),$2(O)&&e(mc(O)),z2(V)&&e(Tp(V)),s()},[a,s,e]);return{recallBothPrompts:c,recallPositivePrompt:d,recallNegativePrompt:p,recallSeed:h,recallCfgScale:m,recallModel:v,recallScheduler:b,recallSteps:w,recallWidth:y,recallHeight:S,recallStrength:k,recallAllParameters:I,sendToImageToImage:_}},ir=e=>{const t=L(a=>a.config.disabledTabs),n=L(a=>a.config.disabledFeatures),r=L(a=>a.config.disabledSDFeatures),o=f.useMemo(()=>n.includes(e)||r.includes(e)||t.includes(e),[n,r,t,e]),s=f.useMemo(()=>!(n.includes(e)||r.includes(e)||t.includes(e)),[n,r,t,e]);return{isFeatureDisabled:o,isFeatureEnabled:s}},Oy=()=>{const e=Fc(),{t}=be(),n=f.useMemo(()=>!!navigator.clipboard&&!!window.ClipboardItem,[]),r=f.useCallback(async o=>{n||e({title:t("toast.problemCopyingImage"),description:"Your browser doesn't support the Clipboard API.",status:"error",duration:2500,isClosable:!0});try{const a=await(await fetch(o)).blob();await navigator.clipboard.write([new ClipboardItem({[a.type]:a})]),e({title:t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})}catch(s){e({title:t("toast.problemCopyingImage"),description:String(s),status:"error",duration:2500,isClosable:!0})}},[n,t,e]);return{isClipboardAPIAvailable:n,copyImageToClipboard:r}};function wZ(e,t,n){var r=this,o=f.useRef(null),s=f.useRef(0),a=f.useRef(null),c=f.useRef([]),d=f.useRef(),p=f.useRef(),h=f.useRef(e),m=f.useRef(!0);f.useEffect(function(){h.current=e},[e]);var v=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var b=!!(n=n||{}).leading,w=!("trailing"in n)||!!n.trailing,y="maxWait"in n,S=y?Math.max(+n.maxWait||0,t):null;f.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var k=f.useMemo(function(){var _=function(M){var T=c.current,A=d.current;return c.current=d.current=null,s.current=M,p.current=h.current.apply(A,T)},I=function(M,T){v&&cancelAnimationFrame(a.current),a.current=v?requestAnimationFrame(M):setTimeout(M,T)},P=function(M){if(!m.current)return!1;var T=M-o.current;return!o.current||T>=t||T<0||y&&M-s.current>=S},E=function(M){return a.current=null,w&&c.current?_(M):(c.current=d.current=null,p.current)},O=function M(){var T=Date.now();if(P(T))return E(T);if(m.current){var A=t-(T-o.current),$=y?Math.min(A,S-(T-s.current)):A;I(M,$)}},R=function(){var M=Date.now(),T=P(M);if(c.current=[].slice.call(arguments),d.current=r,o.current=M,T){if(!a.current&&m.current)return s.current=o.current,I(O,t),b?_(o.current):p.current;if(y)return I(O,t),_(o.current)}return a.current||I(O,t),p.current};return R.cancel=function(){a.current&&(v?cancelAnimationFrame(a.current):clearTimeout(a.current)),s.current=0,c.current=o.current=d.current=a.current=null},R.isPending=function(){return!!a.current},R.flush=function(){return a.current?E(Date.now()):p.current},R},[b,y,t,S,w,v]);return k}function SZ(e,t){return e===t}function dk(e){return typeof e=="function"?function(){return e}:e}function Ry(e,t,n){var r,o,s=n&&n.equalityFn||SZ,a=(r=f.useState(dk(e)),o=r[1],[r[0],f.useCallback(function(m){return o(dk(m))},[])]),c=a[0],d=a[1],p=wZ(f.useCallback(function(m){return d(m)},[d]),t,n),h=f.useRef(e);return s(h.current,e)||(p(e),h.current=e),[c,p]}z1("gallery/requestedBoardImagesDeletion");const CZ=z1("gallery/sentImageToCanvas"),ZE=z1("gallery/sentImageToImg2Img"),kZ=e=>{const{imageDTO:t}=e,n=f.useMemo(()=>fe([Ye],({gallery:V})=>({isInBatch:V.batchImageNames.includes(t.image_name)}),Ge),[t.image_name]),{isInBatch:r}=L(n),o=te(),{t:s}=be(),a=Fc(),c=ir("unifiedCanvas").isFeatureEnabled,d=ir("batches").isFeatureEnabled,{onClickAddToBoard:p}=f.useContext(A_),[h,m]=Ry(t.image_name,500),{currentData:v}=L1(m.isPending()?oo.skipToken:h??oo.skipToken),{isClipboardAPIAvailable:b,copyImageToClipboard:w}=Oy(),y=v==null?void 0:v.metadata,S=f.useCallback(()=>{t&&o(B1(t))},[o,t]),{recallBothPrompts:k,recallSeed:_,recallAllParameters:I}=Ey(),[P]=WR(),E=f.useCallback(()=>{k(y==null?void 0:y.positive_prompt,y==null?void 0:y.negative_prompt)},[y==null?void 0:y.negative_prompt,y==null?void 0:y.positive_prompt,k]),O=f.useCallback(()=>{_(y==null?void 0:y.seed)},[y==null?void 0:y.seed,_]),R=f.useCallback(()=>{o(ZE()),o($1(t))},[o,t]),M=f.useCallback(()=>{o(CZ()),o(VR(t)),o(em()),o(ql("unifiedCanvas")),a({title:s("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},[o,t,s,a]),T=f.useCallback(()=>{console.log(y),I(y)},[y,I]),A=f.useCallback(()=>{p(t)},[t,p]),$=f.useCallback(()=>{t.board_id&&P({imageDTO:t})},[t,P]),Q=f.useCallback(()=>{o(UR([t.image_name]))},[o,t.image_name]),B=f.useCallback(()=>{w(t.image_url)},[w,t.image_url]);return i.jsxs(i.Fragment,{children:[i.jsx(kr,{as:"a",href:t.image_url,target:"_blank",icon:i.jsx(QH,{}),children:s("common.openInNewTab")}),b&&i.jsx(kr,{icon:i.jsx(Hc,{}),onClickCapture:B,children:s("parameters.copyImage")}),i.jsx(kr,{as:"a",download:!0,href:t.image_url,target:"_blank",icon:i.jsx(Bb,{}),w:"100%",children:s("parameters.downloadImage")}),i.jsx(kr,{icon:i.jsx(S6,{}),onClickCapture:E,isDisabled:(y==null?void 0:y.positive_prompt)===void 0&&(y==null?void 0:y.negative_prompt)===void 0,children:s("parameters.usePrompt")}),i.jsx(kr,{icon:i.jsx(C6,{}),onClickCapture:O,isDisabled:(y==null?void 0:y.seed)===void 0,children:s("parameters.useSeed")}),i.jsx(kr,{icon:i.jsx(p6,{}),onClickCapture:T,isDisabled:!y,children:s("parameters.useAll")}),i.jsx(kr,{icon:i.jsx(CS,{}),onClickCapture:R,id:"send-to-img2img",children:s("parameters.sendToImg2Img")}),c&&i.jsx(kr,{icon:i.jsx(CS,{}),onClickCapture:M,id:"send-to-canvas",children:s("parameters.sendToUnifiedCanvas")}),d&&i.jsx(kr,{icon:i.jsx(M0,{}),isDisabled:r,onClickCapture:Q,children:"Add to Batch"}),i.jsx(kr,{icon:i.jsx(M0,{}),onClickCapture:A,children:t.board_id?"Change Board":"Add to Board"}),t.board_id&&i.jsx(kr,{icon:i.jsx(M0,{}),onClickCapture:$,children:"Remove from Board"}),i.jsx(kr,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:i.jsx(us,{}),onClickCapture:S,children:s("gallery.deleteImage")})]})},eO=f.memo(kZ),_Z=({imageDTO:e,children:t})=>{const n=f.useCallback(r=>{r.preventDefault()},[]);return i.jsx(ij,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>e?i.jsx(Lc,{sx:{visibility:"visible !important"},motionProps:nm,onContextMenu:n,children:i.jsx(eO,{imageDTO:e})}):null,children:t})},tO=f.memo(_Z),PZ=e=>{const{data:t,disabled:n,onClick:r}=e,o=f.useRef(ui()),{attributes:s,listeners:a,setNodeRef:c}=GR({id:o.current,disabled:n,data:t});return i.jsx(Re,{onClick:r,ref:c,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,...s,...a})},jZ=f.memo(PZ),IZ=e=>{const{imageDTO:t,onClickReset:n,onError:r,onClick:o,withResetIcon:s=!1,withMetadataOverlay:a=!1,isDropDisabled:c=!1,isDragDisabled:d=!1,isUploadDisabled:p=!1,minSize:h=24,postUploadAction:m,imageSx:v,fitContainer:b=!1,droppableData:w,draggableData:y,dropLabel:S,isSelected:k=!1,thumbnail:_=!1,resetTooltip:I="Reset",resetIcon:P=i.jsx(Hb,{}),noContentFallback:E=i.jsx(mi,{icon:al}),useThumbailFallback:O,withHoverOverlay:R=!1}=e,{colorMode:M}=Ds(),[T,A]=f.useState(!1),$=f.useCallback(()=>{A(!0)},[]),Q=f.useCallback(()=>{A(!1)},[]),{getUploadButtonProps:B,getUploadInputProps:V}=Vm({postUploadAction:m,isDisabled:p}),q=vp("drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-600))","drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-800))"),G=p?{}:{cursor:"pointer",bg:Be("base.200","base.800")(M),_hover:{bg:Be("base.300","base.650")(M),color:Be("base.500","base.300")(M)}};return i.jsx(tO,{imageDTO:t,children:D=>i.jsxs(W,{ref:D,onMouseOver:$,onMouseOut:Q,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative",minW:h||void 0,minH:h||void 0,userSelect:"none",cursor:d||!t?"default":"pointer"},children:[t&&i.jsxs(W,{sx:{w:"full",h:"full",position:b?"absolute":"relative",alignItems:"center",justifyContent:"center"},children:[i.jsx(Tc,{src:_?t.thumbnail_url:t.image_url,fallbackStrategy:"beforeLoadOrError",fallbackSrc:O?t.thumbnail_url:void 0,fallback:O?void 0:i.jsx(jJ,{image:t}),width:t.width,height:t.height,onError:r,draggable:!1,sx:{objectFit:"contain",maxW:"full",maxH:"full",borderRadius:"base",...v}}),a&&i.jsx(xZ,{imageDTO:t}),i.jsx(ly,{isSelected:k,isHovered:R?T:!1})]}),!t&&!p&&i.jsx(i.Fragment,{children:i.jsxs(W,{sx:{minH:h,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",transitionProperty:"common",transitionDuration:"0.1s",color:Be("base.500","base.500")(M),...G},...B(),children:[i.jsx("input",{...V()}),i.jsx(no,{as:Rd,sx:{boxSize:16}})]})}),!t&&p&&E,t&&!d&&i.jsx(jZ,{data:y,disabled:d||!t,onClick:o}),!c&&i.jsx(iy,{data:w,disabled:c,dropLabel:S}),n&&s&&t&&i.jsx(Fe,{onClick:n,"aria-label":I,tooltip:I,icon:P,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:q}}})]})})},yi=f.memo(IZ),EZ=()=>i.jsx(Re,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:i.jsx(W,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",bg:"base.100",color:"base.500",_dark:{color:"base.700",bg:"base.850"}},children:i.jsx(no,{as:qH,boxSize:16,opacity:.7})})}),nO=()=>i.jsx(gm,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:i.jsx(Re,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full"}})}),OZ=e=>fe([Ye],t=>({selectionCount:t.gallery.selection.length,selection:t.gallery.selection,isSelected:t.gallery.selection.includes(e)}),Ge),RZ=e=>{const t=te(),{imageName:n}=e,{currentData:r,isLoading:o,isError:s}=os(n),a=f.useMemo(()=>OZ(n),[n]),{isSelected:c,selectionCount:d,selection:p}=L(a),h=f.useCallback(()=>{t(qR([n]))},[t,n]),m=f.useMemo(()=>{if(d>1)return{id:"batch",payloadType:"IMAGE_NAMES",payload:{image_names:p}};if(r)return{id:"batch",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r,p,d]);return o?i.jsx(nO,{}):s||!r?i.jsx(EZ,{}):i.jsx(Re,{sx:{w:"full",h:"full",touchAction:"none"},children:i.jsx(tO,{imageDTO:r,children:v=>i.jsx(Re,{position:"relative",userSelect:"none",ref:v,sx:{display:"flex",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:i.jsx(yi,{imageDTO:r,draggableData:m,isSelected:c,minSize:0,onClickReset:h,isDropDisabled:!0,imageSx:{w:"full",h:"full"},isUploadDisabled:!0,resetTooltip:"Remove from batch",withResetIcon:!0,thumbnail:!0})},n)})})},MZ=f.memo(RZ),rO=Te((e,t)=>i.jsx(Re,{className:"item-container",ref:t,p:1.5,children:e.children})),oO=Te((e,t)=>{const n=L(r=>r.gallery.galleryImageMinimumWidth);return i.jsx(rl,{...e,className:"list-container",ref:t,sx:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr));`},children:e.children})}),DZ=fe([Ye],e=>({imageNames:e.gallery.batchImageNames}),Ge),TZ=()=>{const{t:e}=be(),t=f.useRef(null),[n,r]=f.useState(null),[o,s]=sy({defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"leave",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}}),{imageNames:a}=L(DZ);return f.useEffect(()=>{const{current:c}=t;return n&&c&&o({target:c,elements:{viewport:n}}),()=>{var d;return(d=s())==null?void 0:d.destroy()}},[n,o,s]),a.length?i.jsx(Re,{ref:t,"data-overlayscrollbars":"",h:"100%",children:i.jsx(JE,{style:{height:"100%"},data:a,components:{Item:rO,List:oO},scrollerRef:r,itemContent:(c,d)=>i.jsx(MZ,{imageName:d},d)})}):i.jsx(mi,{label:e("gallery.noImagesInGallery"),icon:al})},AZ=f.memo(TZ),NZ=e=>{const t=L(s=>s.gallery.galleryView),{data:n}=KR(e),{data:r}=YR(e),o=f.useMemo(()=>t==="images"?n:r,[t,r,n]);return{totalImages:n,totalAssets:r,currentViewTotal:o}},$Z=e=>fe([Ye],({gallery:t})=>({isSelected:t.selection.includes(e),selectionCount:t.selection.length,selection:t.selection}),Ge),zZ=e=>{const t=te(),{imageName:n}=e,{currentData:r}=os(n),o=f.useMemo(()=>$Z(n),[n]),{isSelected:s,selectionCount:a,selection:c}=L(o),d=f.useCallback(()=>{t(gv(n))},[t,n]),p=f.useCallback(m=>{m.stopPropagation(),r&&t(B1(r))},[t,r]),h=f.useMemo(()=>{if(a>1)return{id:"gallery-image",payloadType:"IMAGE_NAMES",payload:{image_names:c}};if(r)return{id:"gallery-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r,c,a]);return r?i.jsx(Re,{sx:{w:"full",h:"full",touchAction:"none"},children:i.jsx(W,{userSelect:"none",sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:i.jsx(yi,{onClick:d,imageDTO:r,draggableData:h,isSelected:s,minSize:0,onClickReset:p,imageSx:{w:"full",h:"full"},isDropDisabled:!0,isUploadDisabled:!0,thumbnail:!0,withHoverOverlay:!0})})}):i.jsx(nO,{})},LZ=f.memo(zZ),BZ={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"leave",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},FZ=()=>{const{t:e}=be(),t=f.useRef(null),[n,r]=f.useState(null),[o,s]=sy(BZ),a=L(S=>S.gallery.selectedBoardId),{currentViewTotal:c}=NZ(a),d=L(N_),{currentData:p,isFetching:h,isSuccess:m,isError:v}=QR(d),[b]=$_(),w=f.useMemo(()=>!p||!c?!1:p.ids.length{w&&b({...d,offset:(p==null?void 0:p.ids.length)??0,limit:z_})},[w,b,d,p==null?void 0:p.ids.length]);return f.useEffect(()=>{const{current:S}=t;return n&&S&&o({target:S,elements:{viewport:n}}),()=>{var k;return(k=s())==null?void 0:k.destroy()}},[n,o,s]),p?m&&(p==null?void 0:p.ids.length)===0?i.jsx(W,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:i.jsx(mi,{label:e("gallery.noImagesInGallery"),icon:al})}):m&&p?i.jsxs(i.Fragment,{children:[i.jsx(Re,{ref:t,"data-overlayscrollbars":"",h:"100%",children:i.jsx(JE,{style:{height:"100%"},data:p.ids,endReached:y,components:{Item:rO,List:oO},scrollerRef:r,itemContent:(S,k)=>i.jsx(LZ,{imageName:k},k)})}),i.jsx(rn,{onClick:y,isDisabled:!w,isLoading:h,loadingText:"Loading",flexShrink:0,children:`Load More (${p.ids.length} of ${c})`})]}):v?i.jsx(Re,{sx:{w:"full",h:"full"},children:i.jsx(mi,{label:"Unable to load Gallery",icon:g6})}):null:i.jsx(W,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:i.jsx(mi,{label:"Loading...",icon:al})})},HZ=f.memo(FZ),WZ=fe([Ye],e=>{const{selectedBoardId:t,galleryView:n}=e.gallery;return{selectedBoardId:t,galleryView:n}},Ge),VZ=()=>{const e=f.useRef(null),t=f.useRef(null),{selectedBoardId:n,galleryView:r}=L(WZ),o=te(),{isOpen:s,onToggle:a}=ss(),c=f.useCallback(()=>{o(L2("images"))},[o]),d=f.useCallback(()=>{o(L2("assets"))},[o]);return i.jsxs(G5,{sx:{flexDirection:"column",h:"full",w:"full",borderRadius:"base"},children:[i.jsxs(Re,{sx:{w:"full"},children:[i.jsxs(W,{ref:e,sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[i.jsx(iU,{isOpen:s,onToggle:a}),i.jsx(PJ,{}),i.jsx(cU,{})]}),i.jsx(Re,{children:i.jsx(oU,{isOpen:s})})]}),i.jsxs(W,{ref:t,direction:"column",gap:2,h:"full",w:"full",children:[i.jsx(W,{sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:i.jsx(Id,{index:r==="images"?0:1,variant:"unstyled",size:"sm",sx:{w:"full"},children:i.jsx(Ed,{children:i.jsxs(nr,{isAttached:!0,sx:{w:"full"},children:[i.jsx(wc,{as:rn,size:"sm",isChecked:r==="images",onClick:c,sx:{w:"full"},leftIcon:i.jsx(tW,{}),children:"Images"}),i.jsx(wc,{as:rn,size:"sm",isChecked:r==="assets",onClick:d,sx:{w:"full"},leftIcon:i.jsx(fW,{}),children:"Assets"})]})})})}),n==="batch"?i.jsx(AZ,{}):i.jsx(HZ,{})]})]})},sO=f.memo(VZ),UZ=fe([Kn,La,XR,lr],(e,t,n,r)=>{const{shouldPinGallery:o,shouldShowGallery:s}=t,{galleryImageMinimumWidth:a}=n;return{activeTabName:e,isStaging:r,shouldPinGallery:o,shouldShowGallery:s,galleryImageMinimumWidth:a,isResizable:e!=="unifiedCanvas"}},{memoizeOptions:{resultEqualityCheck:Jt}}),GZ=()=>{const e=te(),{shouldPinGallery:t,shouldShowGallery:n,galleryImageMinimumWidth:r}=L(UZ),o=()=>{e(vv(!1)),t&&e(Co())};nt("esc",()=>{e(vv(!1))},{enabled:()=>!t,preventDefault:!0},[t]);const s=32;return nt("shift+up",()=>{if(r<256){const a=Es(r+s,32,256);e(Op(a))}},[r]),nt("shift+down",()=>{if(r>32){const a=Es(r-s,32,256);e(Op(a))}},[r]),t?null:i.jsx(c6,{direction:"right",isResizable:!0,isOpen:n,onClose:o,minWidth:400,children:i.jsx(sO,{})})},qZ=f.memo(GZ),KZ=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,tooltip:a,...c}=e;return i.jsx(wn,{label:a,hasArrow:!0,placement:"top",isDisabled:!a,children:i.jsxs(mo,{isDisabled:n,width:r,display:"flex",alignItems:"center",...o,children:[t&&i.jsx(zo,{my:1,flexGrow:1,sx:{cursor:n?"not-allowed":"pointer",...s==null?void 0:s.sx,pe:4},...s,children:t}),i.jsx(Nb,{...c})]})})},Pr=f.memo(KZ),YZ=fe([Ye,JR],({system:e,config:t,imageDeletion:n},r)=>{const{shouldConfirmOnDelete:o}=e,{canRestoreDeletedImagesFromBin:s}=t,{imageToDelete:a,isModalOpen:c}=n;return{shouldConfirmOnDelete:o,canRestoreDeletedImagesFromBin:s,imageToDelete:a,imageUsage:r,isModalOpen:c}},Ge),QZ=()=>{const e=te(),{t}=be(),{shouldConfirmOnDelete:n,canRestoreDeletedImagesFromBin:r,imageToDelete:o,imageUsage:s,isModalOpen:a}=L(YZ),c=f.useCallback(m=>e(L_(!m.target.checked)),[e]),d=f.useCallback(()=>{e(B2()),e(ZR(!1))},[e]),p=f.useCallback(()=>{!o||!s||(e(B2()),e(e7({imageDTO:o,imageUsage:s})))},[e,o,s]),h=f.useRef(null);return i.jsx(_d,{isOpen:a,onClose:d,leastDestructiveRef:h,isCentered:!0,children:i.jsx(Da,{children:i.jsxs(Pd,{children:[i.jsx(Ma,{fontSize:"lg",fontWeight:"bold",children:t("gallery.deleteImage")}),i.jsx(Ta,{children:i.jsxs(W,{direction:"column",gap:3,children:[i.jsx(nj,{imageUsage:s}),i.jsx(hl,{}),i.jsx(tt,{children:t(r?"gallery.deleteImageBin":"gallery.deleteImagePermanent")}),i.jsx(tt,{children:t("common.areYouSure")}),i.jsx(Pr,{label:t("common.dontAskMeAgain"),isChecked:!n,onChange:c})]})}),i.jsxs(Ra,{children:[i.jsx(rn,{ref:h,onClick:d,children:"Cancel"}),i.jsx(rn,{colorScheme:"error",onClick:p,ml:3,children:"Delete"})]})]})})})},XZ=f.memo(QZ);function JZ(e){const{title:t,hotkey:n,description:r}=e;return i.jsxs(rl,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[i.jsxs(rl,{children:[i.jsx(tt,{fontWeight:600,children:t}),r&&i.jsx(tt,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),i.jsx(Re,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function ZZ({children:e}){const{isOpen:t,onOpen:n,onClose:r}=ss(),{t:o}=be(),s=[{title:o("hotkeys.invoke.title"),desc:o("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:o("hotkeys.cancel.title"),desc:o("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:o("hotkeys.focusPrompt.title"),desc:o("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:o("hotkeys.toggleOptions.title"),desc:o("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:o("hotkeys.pinOptions.title"),desc:o("hotkeys.pinOptions.desc"),hotkey:"Shift+O"},{title:o("hotkeys.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"}],a=[{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.toggleGalleryPin.title"),desc:o("hotkeys.toggleGalleryPin.desc"),hotkey:"Shift+G"},{title:o("hotkeys.increaseGalleryThumbSize.title"),desc:o("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys.decreaseGalleryThumbSize.title"),desc:o("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],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=h=>i.jsx(W,{flexDir:"column",gap:4,children:h.map((m,v)=>i.jsxs(W,{flexDir:"column",px:2,gap:4,children:[i.jsx(JZ,{title:m.title,description:m.desc,hotkey:m.hotkey}),v{const{data:t}=t7(),n=f.useRef(null),r=aO(n);return i.jsxs(W,{alignItems:"center",gap:3,ps:1,ref:n,children:[i.jsx(Tc,{src:D_,alt:"invoke-ai-logo",sx:{w:"32px",h:"32px",minW:"32px",minH:"32px",userSelect:"none"}}),i.jsxs(W,{sx:{gap:3,alignItems:"center"},children:[i.jsxs(tt,{sx:{fontSize:"xl",userSelect:"none"},children:["invoke ",i.jsx("strong",{children:"ai"})]}),i.jsx(Fo,{children:e&&r&&t&&i.jsx(Yr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:i.jsx(tt,{sx:{fontWeight:600,marginTop:1,color:"base.300",fontSize:14},variant:"subtext",children:t.version})},"statusText")})]})]})},aee=e=>{const{tooltip:t,inputRef:n,label:r,disabled:o,required:s,...a}=e,c=NE();return i.jsx(wn,{label:t,placement:"top",hasArrow:!0,children:i.jsx(ky,{label:r?i.jsx(mo,{isRequired:s,isDisabled:o,children:i.jsx(zo,{children:r})}):void 0,disabled:o,ref:n,styles:c,...a})})},Kr=f.memo(aee);function Yo(e){const{t}=be(),{label:n,textProps:r,useBadge:o=!1,badgeLabel:s=t("settings.experimental"),badgeProps:a,...c}=e;return i.jsxs(W,{justifyContent:"space-between",py:1,children:[i.jsxs(W,{gap:2,alignItems:"center",children:[i.jsx(tt,{sx:{fontSize:14,_dark:{color:"base.300"}},...r,children:n}),o&&i.jsx(pl,{size:"xs",sx:{px:2,color:"base.700",bg:"accent.200",_dark:{bg:"accent.500",color:"base.200"}},...a,children:s})]}),i.jsx(Pr,{...c})]})}const Gl=e=>i.jsx(W,{sx:{flexDirection:"column",gap:2,p:4,borderRadius:"base",bg:"base.100",_dark:{bg:"base.900"}},children:e.children});function iee(){const e=te(),{data:t,refetch:n}=n7(),[r,{isLoading:o}]=r7(),s=f.useCallback(()=>{r().unwrap().then(c=>{e(o7()),e(F1()),e(Dn({title:`Cleared ${c} intermediates`,status:"info"}))})},[r,e]);f.useEffect(()=>{n()},[n]);const a=t?`Clear ${t} Intermediate${t>1?"s":""}`:"No Intermediates to Clear";return i.jsxs(Gl,{children:[i.jsx(Qs,{size:"sm",children:"Clear Intermediates"}),i.jsx(rn,{colorScheme:"warning",onClick:s,isLoading:o,isDisabled:!t,children:a}),i.jsx(tt,{fontWeight:"bold",children:"Clearing intermediates will reset your Canvas and ControlNet state."}),i.jsx(tt,{variant:"subtext",children:"Intermediate images are byproducts of generation, different from the result images in the gallery. Clearing intermediates will free disk space."}),i.jsx(tt,{variant:"subtext",children:"Your gallery images will not be deleted."})]})}const lee=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:a,base700:c,base800:d,base900:p,accent200:h,accent300:m,accent400:v,accent500:b,accent600:w}=_y(),{colorMode:y}=Ds(),[S]=Dc("shadows",["dark-lg"]);return f.useCallback(()=>({label:{color:Be(c,r)(y)},separatorLabel:{color:Be(s,s)(y),"::after":{borderTopColor:Be(r,c)(y)}},searchInput:{":placeholder":{color:Be(r,c)(y)}},input:{backgroundColor:Be(e,p)(y),borderWidth:"2px",borderColor:Be(n,d)(y),color:Be(p,t)(y),paddingRight:24,fontWeight:600,"&:hover":{borderColor:Be(r,a)(y)},"&:focus":{borderColor:Be(m,w)(y)},"&:is(:focus, :hover)":{borderColor:Be(o,s)(y)},"&:focus-within":{borderColor:Be(h,w)(y)},"&[data-disabled]":{backgroundColor:Be(r,c)(y),color:Be(a,o)(y),cursor:"not-allowed"}},value:{backgroundColor:Be(n,d)(y),color:Be(p,t)(y),button:{color:Be(p,t)(y)},"&:hover":{backgroundColor:Be(r,c)(y),cursor:"pointer"}},dropdown:{backgroundColor:Be(n,d)(y),borderColor:Be(n,d)(y),boxShadow:S},item:{backgroundColor:Be(n,d)(y),color:Be(d,n)(y),padding:6,"&[data-hovered]":{color:Be(p,t)(y),backgroundColor:Be(r,c)(y)},"&[data-active]":{backgroundColor:Be(r,c)(y),"&:hover":{color:Be(p,t)(y),backgroundColor:Be(r,c)(y)}},"&[data-selected]":{backgroundColor:Be(v,w)(y),color:Be(e,t)(y),fontWeight:600,"&:hover":{backgroundColor:Be(b,b)(y),color:Be("white",e)(y)}},"&[data-disabled]":{color:Be(s,a)(y),cursor:"not-allowed"}},rightSection:{width:24,padding:20,button:{color:Be(p,t)(y)}}}),[h,m,v,b,w,t,n,r,o,e,s,a,c,d,p,S,y])},cee=e=>{const{searchable:t=!0,tooltip:n,inputRef:r,label:o,disabled:s,...a}=e,c=te(),d=f.useCallback(m=>{m.shiftKey&&c(Po(!0))},[c]),p=f.useCallback(m=>{m.shiftKey||c(Po(!1))},[c]),h=lee();return i.jsx(wn,{label:n,placement:"top",hasArrow:!0,isOpen:!0,children:i.jsx(OE,{label:o?i.jsx(mo,{isDisabled:s,children:i.jsx(zo,{children:o})}):void 0,ref:r,disabled:s,onKeyDown:d,onKeyUp:p,searchable:t,maxDropdownHeight:300,styles:h,...a})})},uee=f.memo(cee),dee=cs(H1,(e,t)=>({value:t,label:e})).sort((e,t)=>e.label.localeCompare(t.label));function fee(){const e=te(),{t}=be(),n=L(o=>o.ui.favoriteSchedulers),r=f.useCallback(o=>{e(s7(o))},[e]);return i.jsx(uee,{label:t("settings.favoriteSchedulers"),value:n,data:dee,onChange:r,clearable:!0,searchable:!0,maxSelectedValues:99,placeholder:t("settings.favoriteSchedulersPlaceholder")})}const pee={ar:Ln.t("common.langArabic",{lng:"ar"}),nl:Ln.t("common.langDutch",{lng:"nl"}),en:Ln.t("common.langEnglish",{lng:"en"}),fr:Ln.t("common.langFrench",{lng:"fr"}),de:Ln.t("common.langGerman",{lng:"de"}),he:Ln.t("common.langHebrew",{lng:"he"}),it:Ln.t("common.langItalian",{lng:"it"}),ja:Ln.t("common.langJapanese",{lng:"ja"}),ko:Ln.t("common.langKorean",{lng:"ko"}),pl:Ln.t("common.langPolish",{lng:"pl"}),pt_BR:Ln.t("common.langBrPortuguese",{lng:"pt_BR"}),pt:Ln.t("common.langPortuguese",{lng:"pt"}),ru:Ln.t("common.langRussian",{lng:"ru"}),zh_CN:Ln.t("common.langSimplifiedChinese",{lng:"zh_CN"}),es:Ln.t("common.langSpanish",{lng:"es"}),uk:Ln.t("common.langUkranian",{lng:"ua"})},hee=fe([Ye],({system:e,ui:t,generation:n})=>{const{shouldConfirmOnDelete:r,enableImageDebugging:o,consoleLogLevel:s,shouldLogToConsole:a,shouldAntialiasProgressImage:c,isNodesEnabled:d,shouldUseNSFWChecker:p,shouldUseWatermarker:h}=e,{shouldUseCanvasBetaLayout:m,shouldUseSliders:v,shouldShowProgressInViewer:b}=t,{shouldShowAdvancedOptions:w}=n;return{shouldConfirmOnDelete:r,enableImageDebugging:o,shouldUseCanvasBetaLayout:m,shouldUseSliders:v,shouldShowProgressInViewer:b,consoleLogLevel:s,shouldLogToConsole:a,shouldAntialiasProgressImage:c,shouldShowAdvancedOptions:w,isNodesEnabled:d,shouldUseNSFWChecker:p,shouldUseWatermarker:h}},{memoizeOptions:{resultEqualityCheck:Jt}}),mee=({children:e,config:t})=>{const n=te(),{t:r}=be(),o=(t==null?void 0:t.shouldShowBetaLayout)??!0,s=(t==null?void 0:t.shouldShowDeveloperSettings)??!0,a=(t==null?void 0:t.shouldShowResetWebUiText)??!0,c=(t==null?void 0:t.shouldShowAdvancedOptionsSettings)??!0,d=(t==null?void 0:t.shouldShowClearIntermediates)??!0,p=(t==null?void 0:t.shouldShowNodesToggle)??!0;f.useEffect(()=>{s||n(F2(!1))},[s,n]);const{isNSFWCheckerAvailable:h,isWatermarkerAvailable:m}=B_(void 0,{selectFromResult:({data:Z})=>({isNSFWCheckerAvailable:(Z==null?void 0:Z.nsfw_methods.includes("nsfw_checker"))??!1,isWatermarkerAvailable:(Z==null?void 0:Z.watermarking_methods.includes("invisible_watermark"))??!1})}),{isOpen:v,onOpen:b,onClose:w}=ss(),{isOpen:y,onOpen:S,onClose:k}=ss(),{shouldConfirmOnDelete:_,enableImageDebugging:I,shouldUseCanvasBetaLayout:P,shouldUseSliders:E,shouldShowProgressInViewer:O,consoleLogLevel:R,shouldLogToConsole:M,shouldAntialiasProgressImage:T,shouldShowAdvancedOptions:A,isNodesEnabled:$,shouldUseNSFWChecker:Q,shouldUseWatermarker:B}=L(hee),V=f.useCallback(()=>{Object.keys(window.localStorage).forEach(Z=>{(a7.includes(Z)||Z.startsWith(i7))&&localStorage.removeItem(Z)}),w(),S()},[w,S]),q=f.useCallback(Z=>{n(l7(Z))},[n]),G=f.useCallback(Z=>{n(c7(Z))},[n]),D=f.useCallback(Z=>{n(F2(Z.target.checked))},[n]),z=f.useCallback(Z=>{n(u7(Z.target.checked))},[n]),{colorMode:H,toggleColorMode:Y}=Ds(),ie=ir("localization").isFeatureEnabled,ye=L(GP);return i.jsxs(i.Fragment,{children:[f.cloneElement(e,{onClick:b}),i.jsxs(Ju,{isOpen:v,onClose:w,size:"2xl",isCentered:!0,children:[i.jsx(Da,{}),i.jsxs(Zu,{children:[i.jsx(Ma,{bg:"none",children:r("common.settingsLabel")}),i.jsx(Ob,{}),i.jsx(Ta,{children:i.jsxs(W,{sx:{gap:4,flexDirection:"column"},children:[i.jsxs(Gl,{children:[i.jsx(Qs,{size:"sm",children:r("settings.general")}),i.jsx(Yo,{label:r("settings.confirmOnDelete"),isChecked:_,onChange:Z=>n(L_(Z.target.checked))}),c&&i.jsx(Yo,{label:r("settings.showAdvancedOptions"),isChecked:A,onChange:Z=>n(d7(Z.target.checked))})]}),i.jsxs(Gl,{children:[i.jsx(Qs,{size:"sm",children:r("settings.generation")}),i.jsx(fee,{}),i.jsx(Yo,{label:"Enable NSFW Checker",isDisabled:!h,isChecked:Q,onChange:Z=>n(f7(Z.target.checked))}),i.jsx(Yo,{label:"Enable Invisible Watermark",isDisabled:!m,isChecked:B,onChange:Z=>n(p7(Z.target.checked))})]}),i.jsxs(Gl,{children:[i.jsx(Qs,{size:"sm",children:r("settings.ui")}),i.jsx(Yo,{label:r("common.darkMode"),isChecked:H==="dark",onChange:Y}),i.jsx(Yo,{label:r("settings.useSlidersForAll"),isChecked:E,onChange:Z=>n(h7(Z.target.checked))}),i.jsx(Yo,{label:r("settings.showProgressInViewer"),isChecked:O,onChange:Z=>n(F_(Z.target.checked))}),i.jsx(Yo,{label:r("settings.antialiasProgressImages"),isChecked:T,onChange:Z=>n(m7(Z.target.checked))}),o&&i.jsx(Yo,{label:r("settings.alternateCanvasLayout"),useBadge:!0,badgeLabel:r("settings.beta"),isChecked:P,onChange:Z=>n(g7(Z.target.checked))}),p&&i.jsx(Yo,{label:r("settings.enableNodesEditor"),useBadge:!0,isChecked:$,onChange:z}),i.jsx(Kr,{disabled:!ie,label:r("common.languagePickerLabel"),value:ye,data:Object.entries(pee).map(([Z,oe])=>({value:Z,label:oe})),onChange:G})]}),s&&i.jsxs(Gl,{children:[i.jsx(Qs,{size:"sm",children:r("settings.developer")}),i.jsx(Yo,{label:r("settings.shouldLogToConsole"),isChecked:M,onChange:D}),i.jsx(Kr,{disabled:!M,label:r("settings.consoleLogLevel"),onChange:q,value:R,data:v7.concat()}),i.jsx(Yo,{label:r("settings.enableImageDebugging"),isChecked:I,onChange:Z=>n(b7(Z.target.checked))})]}),d&&i.jsx(iee,{}),i.jsxs(Gl,{children:[i.jsx(Qs,{size:"sm",children:r("settings.resetWebUI")}),i.jsx(rn,{colorScheme:"error",onClick:V,children:r("settings.resetWebUI")}),a&&i.jsxs(i.Fragment,{children:[i.jsx(tt,{variant:"subtext",children:r("settings.resetWebUIDesc1")}),i.jsx(tt,{variant:"subtext",children:r("settings.resetWebUIDesc2")})]})]})]})}),i.jsx(Ra,{children:i.jsx(rn,{onClick:w,children:r("common.close")})})]})]}),i.jsxs(Ju,{closeOnOverlayClick:!1,isOpen:y,onClose:k,isCentered:!0,children:[i.jsx(Da,{backdropFilter:"blur(40px)"}),i.jsxs(Zu,{children:[i.jsx(Ma,{}),i.jsx(Ta,{children:i.jsx(W,{justifyContent:"center",children:i.jsx(tt,{fontSize:"lg",children:i.jsx(tt,{children:r("settings.resetComplete")})})})}),i.jsx(Ra,{})]})]})]})},gee=fe(go,e=>{const{isConnected:t,isProcessing:n,statusTranslationKey:r,currentIteration:o,totalIterations:s,currentStatusHasSteps:a}=e;return{isConnected:t,isProcessing:n,currentIteration:o,totalIterations:s,statusTranslationKey:r,currentStatusHasSteps:a}},Ge),hk={ok:"green.400",working:"yellow.400",error:"red.400"},mk={ok:"green.600",working:"yellow.500",error:"red.500"},vee=()=>{const{isConnected:e,isProcessing:t,currentIteration:n,totalIterations:r,statusTranslationKey:o}=L(gee),{t:s}=be(),a=f.useRef(null),c=f.useMemo(()=>t?"working":e?"ok":"error",[t,e]),d=f.useMemo(()=>{if(n&&r)return` (${n}/${r})`},[n,r]),p=aO(a);return i.jsxs(W,{ref:a,h:"full",px:2,alignItems:"center",gap:5,children:[i.jsx(Fo,{children:p&&i.jsx(Yr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:i.jsxs(tt,{sx:{fontSize:"sm",fontWeight:"600",pb:"1px",userSelect:"none",color:mk[c],_dark:{color:hk[c]}},children:[s(o),d]})},"statusText")}),i.jsx(no,{as:VH,sx:{boxSize:"0.5rem",color:mk[c],_dark:{color:hk[c]}}})]})},bee=()=>{const{t:e}=be(),t=ir("bugLink").isFeatureEnabled,n=ir("discordLink").isFeatureEnabled,r=ir("githubLink").isFeatureEnabled,o="http://github.com/invoke-ai/InvokeAI",s="https://discord.gg/ZmtBAhwWhy";return i.jsxs(W,{sx:{gap:2,alignItems:"center"},children:[i.jsx(iO,{}),i.jsx(fl,{}),i.jsx(vee,{}),i.jsxs(Cd,{children:[i.jsx(kd,{as:Fe,variant:"link","aria-label":e("accessibility.menu"),icon:i.jsx(FH,{}),sx:{boxSize:8}}),i.jsxs(Lc,{motionProps:nm,children:[i.jsxs(Xu,{title:e("common.communityLabel"),children:[r&&i.jsx(kr,{as:"a",href:o,target:"_blank",icon:i.jsx(TH,{}),children:e("common.githubLabel")}),t&&i.jsx(kr,{as:"a",href:`${o}/issues`,target:"_blank",icon:i.jsx(HH,{}),children:e("common.reportBugLabel")}),n&&i.jsx(kr,{as:"a",href:s,target:"_blank",icon:i.jsx(DH,{}),children:e("common.discordLabel")})]}),i.jsxs(Xu,{title:e("common.settingsLabel"),children:[i.jsx(ZZ,{children:i.jsx(kr,{as:"button",icon:i.jsx(oW,{}),children:e("common.hotkeysLabel")})}),i.jsx(mee,{children:i.jsx(kr,{as:"button",icon:i.jsx(UH,{}),children:e("common.settingsLabel")})})]})]})]})]})},yee=f.memo(bee);function xee(e){return rt({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M16.5 9c-.42 0-.83.04-1.24.11L1.01 3 1 10l9 2-9 2 .01 7 8.07-3.46C9.59 21.19 12.71 24 16.5 24c4.14 0 7.5-3.36 7.5-7.5S20.64 9 16.5 9zm0 13c-3.03 0-5.5-2.47-5.5-5.5s2.47-5.5 5.5-5.5 5.5 2.47 5.5 5.5-2.47 5.5-5.5 5.5z"}},{tag:"path",attr:{d:"M18.27 14.03l-1.77 1.76-1.77-1.76-.7.7 1.76 1.77-1.76 1.77.7.7 1.77-1.76 1.77 1.76.7-.7-1.76-1.77 1.76-1.77z"}}]})(e)}function wee(e){return rt({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 See(e){return rt({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 Cee(e){return rt({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 kee(e){return rt({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}}]})(e)}function lO(e){return rt({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)}const _ee=fe(go,e=>{const{isUploading:t}=e;let n="";return t&&(n="Uploading..."),{tooltip:n,shouldShow:t}}),Pee=()=>{const{shouldShow:e,tooltip:t}=L(_ee);return e?i.jsx(W,{sx:{alignItems:"center",justifyContent:"center",color:"base.600"},children:i.jsx(wn,{label:t,placement:"right",hasArrow:!0,children:i.jsx(dl,{})})}):null},jee=f.memo(Pee),cO=e=>e.config,{createElement:jc,createContext:Iee,forwardRef:uO,useCallback:ri,useContext:dO,useEffect:Ia,useImperativeHandle:fO,useLayoutEffect:Eee,useMemo:Oee,useRef:Zo,useState:Fu}=N1,gk=N1["useId".toString()],Ree=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",qh=Ree?Eee:()=>{},Mee=typeof gk=="function"?gk:()=>null;let Dee=0;function My(e=null){const t=Mee(),n=Zo(e||t||null);return n.current===null&&(n.current=""+Dee++),n.current}const Um=Iee(null);Um.displayName="PanelGroupContext";function pO({children:e=null,className:t="",collapsedSize:n=0,collapsible:r=!1,defaultSize:o=null,forwardedRef:s,id:a=null,maxSize:c=100,minSize:d=10,onCollapse:p=null,onResize:h=null,order:m=null,style:v={},tagName:b="div"}){const w=dO(Um);if(w===null)throw Error("Panel components must be rendered within a PanelGroup container");const y=My(a),{collapsePanel:S,expandPanel:k,getPanelStyle:_,registerPanel:I,resizePanel:P,unregisterPanel:E}=w,O=Zo({onCollapse:p,onResize:h});if(Ia(()=>{O.current.onCollapse=p,O.current.onResize=h}),d<0||d>100)throw Error(`Panel minSize must be between 0 and 100, but was ${d}`);if(c<0||c>100)throw Error(`Panel maxSize must be between 0 and 100, but was ${c}`);if(o!==null){if(o<0||o>100)throw Error(`Panel defaultSize must be between 0 and 100, but was ${o}`);d>o&&!r&&(console.error(`Panel minSize ${d} cannot be greater than defaultSize ${o}`),o=d)}const R=_(y,o),M=Zo({size:vk(R)}),T=Zo({callbacksRef:O,collapsedSize:n,collapsible:r,defaultSize:o,id:y,maxSize:c,minSize:d,order:m});return qh(()=>{M.current.size=vk(R),T.current.callbacksRef=O,T.current.collapsedSize=n,T.current.collapsible=r,T.current.defaultSize=o,T.current.id=y,T.current.maxSize=c,T.current.minSize=d,T.current.order=m}),qh(()=>(I(y,T),()=>{E(y)}),[m,y,I,E]),fO(s,()=>({collapse:()=>S(y),expand:()=>k(y),getCollapsed(){return M.current.size===0},getSize(){return M.current.size},resize:A=>P(y,A)}),[S,k,y,P]),jc(b,{children:e,className:t,"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-id":y,"data-panel-size":parseFloat(""+R.flexGrow).toFixed(1),id:`data-panel-id-${y}`,style:{...R,...v}})}const ad=uO((e,t)=>jc(pO,{...e,forwardedRef:t}));pO.displayName="Panel";ad.displayName="forwardRef(Panel)";function vk(e){const{flexGrow:t}=e;return typeof t=="string"?parseFloat(t):t}const ul=10;function Eu(e,t,n,r,o,s,a,c){const{sizes:d}=c||{},p=d||s;if(o===0)return p;const h=Xo(t),m=p.concat();let v=0;{const y=o<0?r:n,S=h.findIndex(P=>P.current.id===y),k=h[S],_=p[S],I=bk(k,Math.abs(o),_,e);if(_===I)return p;I===0&&_>0&&a.set(y,_),o=o<0?_-I:I-_}let b=o<0?n:r,w=h.findIndex(y=>y.current.id===b);for(;;){const y=h[w],S=p[w],k=Math.abs(o)-Math.abs(v),_=bk(y,0-k,S,e);if(S!==_&&(_===0&&S>0&&a.set(y.current.id,S),v+=S-_,m[w]=_,v.toPrecision(ul).localeCompare(Math.abs(o).toPrecision(ul),void 0,{numeric:!0})>=0))break;if(o<0){if(--w<0)break}else if(++w>=h.length)break}return v===0?p:(b=o<0?r:n,w=h.findIndex(y=>y.current.id===b),m[w]=p[w]+v,m)}function Wl(e,t,n){t.forEach((r,o)=>{const{callbacksRef:s,collapsedSize:a,collapsible:c,id:d}=e[o].current,p=n[d];if(p!==r){n[d]=r;const{onCollapse:h,onResize:m}=s.current;m&&m(r,p),c&&h&&((p==null||p===a)&&r!==a?h(!1):p!==a&&r===a&&h(!0))}})}function Z0(e,t){if(t.length<2)return[null,null];const n=t.findIndex(a=>a.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 hO(e,t,n){if(e.size===1)return"100";const o=Xo(e).findIndex(a=>a.current.id===t),s=n[o];return s==null?"0":s.toPrecision(ul)}function Tee(e){const t=document.querySelector(`[data-panel-id="${e}"]`);return t||null}function Dy(e){const t=document.querySelector(`[data-panel-group-id="${e}"]`);return t||null}function Gm(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function Aee(e){return mO().findIndex(r=>r.getAttribute("data-panel-resize-handle-id")===e)??null}function mO(){return Array.from(document.querySelectorAll("[data-panel-resize-handle-id]"))}function gO(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function Ty(e,t,n){var d,p,h,m;const r=Gm(t),o=gO(e),s=r?o.indexOf(r):-1,a=((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[a,c]}function Xo(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 bk(e,t,n,r){var h;const o=n+t,{collapsedSize:s,collapsible:a,maxSize:c,minSize:d}=e.current;if(a){if(n>s){if(o<=d/2+s)return s}else if(!((h=r==null?void 0:r.type)==null?void 0:h.startsWith("key"))&&o{const{direction:a,panels:c}=e.current,d=Dy(t),{height:p,width:h}=d.getBoundingClientRect(),v=gO(t).map(b=>{const w=b.getAttribute("data-panel-resize-handle-id"),y=Xo(c),[S,k]=Ty(t,w,y);if(S==null||k==null)return()=>{};let _=0,I=100,P=0,E=0;y.forEach($=>{$.current.id===S?(I=$.current.maxSize,_=$.current.minSize):(P+=$.current.minSize,E+=$.current.maxSize)});const O=Math.min(I,100-P),R=Math.max(_,(y.length-1)*100-E),M=hO(c,S,o);b.setAttribute("aria-valuemax",""+Math.round(O)),b.setAttribute("aria-valuemin",""+Math.round(R)),b.setAttribute("aria-valuenow",""+Math.round(parseInt(M)));const T=$=>{if(!$.defaultPrevented)switch($.key){case"Enter":{$.preventDefault();const Q=y.findIndex(B=>B.current.id===S);if(Q>=0){const B=y[Q],V=o[Q];if(V!=null){let q=0;V.toPrecision(ul)<=B.current.minSize.toPrecision(ul)?q=a==="horizontal"?h:p:q=-(a==="horizontal"?h:p);const G=Eu($,c,S,k,q,o,s.current,null);o!==G&&r(G)}}break}}};b.addEventListener("keydown",T);const A=Tee(S);return A!=null&&b.setAttribute("aria-controls",A.id),()=>{b.removeAttribute("aria-valuemax"),b.removeAttribute("aria-valuemin"),b.removeAttribute("aria-valuenow"),b.removeEventListener("keydown",T),A!=null&&b.removeAttribute("aria-controls")}});return()=>{v.forEach(b=>b())}},[e,t,n,s,r,o])}function $ee({disabled:e,handleId:t,resizeHandler:n}){Ia(()=>{if(e||n==null)return;const r=Gm(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 a=mO(),c=Aee(t);vO(c!==null);const d=s.shiftKey?c>0?c-1:a.length-1:c+1{r.removeEventListener("keydown",o)}},[e,t,n])}function zee(e,t){if(e.length!==t.length)return!1;for(let n=0;nR.current.id===P),O=r[E];if(O.current.collapsible){const R=h[E];(R===0||R.toPrecision(ul)===O.current.minSize.toPrecision(ul))&&(k=k<0?-O.current.minSize*w:O.current.minSize*w)}return k}else return bO(e,n,o,c,d)}function Bee(e){return e.type==="keydown"}function b1(e){return e.type.startsWith("mouse")}function y1(e){return e.type.startsWith("touch")}let x1=null,qi=null;function yO(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 Fee(){qi!==null&&(document.head.removeChild(qi),x1=null,qi=null)}function ev(e){if(x1===e)return;x1=e;const t=yO(e);qi===null&&(qi=document.createElement("style"),document.head.appendChild(qi)),qi.innerHTML=`*{cursor: ${t}!important;}`}function Hee(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function xO(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 wO(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 Wee(e,t,n){const r=wO(e,n);if(r){const o=xO(t);return r[o]??null}return null}function Vee(e,t,n,r){const o=xO(t),s=wO(e,r)||{};s[o]=n;try{r.setItem(`PanelGroup:sizes:${e}`,JSON.stringify(s))}catch(a){console.error(a)}}const tv={};function yk(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 Ou={getItem:e=>(yk(Ou),Ou.getItem(e)),setItem:(e,t)=>{yk(Ou),Ou.setItem(e,t)}};function SO({autoSaveId:e,children:t=null,className:n="",direction:r,disablePointerEventsDuringResize:o=!1,forwardedRef:s,id:a=null,onLayout:c,storage:d=Ou,style:p={},tagName:h="div"}){const m=My(a),[v,b]=Fu(null),[w,y]=Fu(new Map),S=Zo(null),k=Zo({onLayout:c});Ia(()=>{k.current.onLayout=c});const _=Zo({}),[I,P]=Fu([]),E=Zo(new Map),O=Zo(0),R=Zo({direction:r,panels:w,sizes:I});fO(s,()=>({getLayout:()=>{const{sizes:D}=R.current;return D},setLayout:D=>{const z=D.reduce((ye,Z)=>ye+Z,0);vO(z===100,"Panel sizes must add up to 100%");const{panels:H}=R.current,Y=_.current,ie=Xo(H);P(D),Wl(ie,D,Y)}}),[]),qh(()=>{R.current.direction=r,R.current.panels=w,R.current.sizes=I}),Nee({committedValuesRef:R,groupId:m,panels:w,setSizes:P,sizes:I,panelSizeBeforeCollapse:E}),Ia(()=>{const{onLayout:D}=k.current,{panels:z,sizes:H}=R.current;if(H.length>0){D&&D(H);const Y=_.current,ie=Xo(z);Wl(ie,H,Y)}},[I]),qh(()=>{if(R.current.sizes.length===w.size)return;let z=null;if(e){const H=Xo(w);z=Wee(e,H,d)}if(z!=null)P(z);else{const H=Xo(w);let Y=0,ie=0,ye=0;if(H.forEach(Z=>{ye+=Z.current.minSize,Z.current.defaultSize===null?Y++:ie+=Z.current.defaultSize}),ie>100)throw new Error("Default panel sizes cannot exceed 100%");if(H.length>1&&Y===0&&ie!==100)throw new Error("Invalid default sizes specified for panels");if(ye>100)throw new Error("Minimum panel sizes cannot exceed 100%");P(H.map(Z=>Z.current.defaultSize===null?(100-ie)/Y:Z.current.defaultSize))}},[e,w,d]),Ia(()=>{if(e){if(I.length===0||I.length!==w.size)return;const D=Xo(w);tv[e]||(tv[e]=Hee(Vee,100)),tv[e](e,D,I,d)}},[e,w,I,d]);const M=ri((D,z)=>{const{panels:H}=R.current;return H.size===0?{flexBasis:0,flexGrow:z??void 0,flexShrink:1,overflow:"hidden"}:{flexBasis:0,flexGrow:hO(H,D,I),flexShrink:1,overflow:"hidden",pointerEvents:o&&v!==null?"none":void 0}},[v,o,I]),T=ri((D,z)=>{y(H=>{if(H.has(D))return H;const Y=new Map(H);return Y.set(D,z),Y})},[]),A=ri(D=>H=>{H.preventDefault();const{direction:Y,panels:ie,sizes:ye}=R.current,Z=Xo(ie),[oe,K]=Ty(m,D,Z);if(oe==null||K==null)return;let U=Lee(H,m,D,Z,Y,ye,S.current);if(U===0)return;const re=Dy(m).getBoundingClientRect(),se=Y==="horizontal";document.dir==="rtl"&&se&&(U=-U);const pe=se?re.width:re.height,le=U/pe*100,ge=Eu(H,ie,oe,K,le,ye,E.current,S.current),ke=!zee(ye,ge);if((b1(H)||y1(H))&&O.current!=le&&ev(ke?se?"horizontal":"vertical":se?U<0?"horizontal-min":"horizontal-max":U<0?"vertical-min":"vertical-max"),ke){const xe=_.current;P(ge),Wl(Z,ge,xe)}O.current=le},[m]),$=ri(D=>{y(z=>{if(!z.has(D))return z;const H=new Map(z);return H.delete(D),H})},[]),Q=ri(D=>{const{panels:z,sizes:H}=R.current,Y=z.get(D);if(Y==null)return;const{collapsedSize:ie,collapsible:ye}=Y.current;if(!ye)return;const Z=Xo(z),oe=Z.indexOf(Y);if(oe<0)return;const K=H[oe];if(K===ie)return;E.current.set(D,K);const[U,ae]=Z0(D,Z);if(U==null||ae==null)return;const se=oe===Z.length-1?K:ie-K,pe=Eu(null,z,U,ae,se,H,E.current,null);if(H!==pe){const le=_.current;P(pe),Wl(Z,pe,le)}},[]),B=ri(D=>{const{panels:z,sizes:H}=R.current,Y=z.get(D);if(Y==null)return;const{collapsedSize:ie,minSize:ye}=Y.current,Z=E.current.get(D)||ye;if(!Z)return;const oe=Xo(z),K=oe.indexOf(Y);if(K<0||H[K]!==ie)return;const[ae,re]=Z0(D,oe);if(ae==null||re==null)return;const pe=K===oe.length-1?ie-Z:Z,le=Eu(null,z,ae,re,pe,H,E.current,null);if(H!==le){const ge=_.current;P(le),Wl(oe,le,ge)}},[]),V=ri((D,z)=>{const{panels:H,sizes:Y}=R.current,ie=H.get(D);if(ie==null)return;const{collapsedSize:ye,collapsible:Z,maxSize:oe,minSize:K}=ie.current,U=Xo(H),ae=U.indexOf(ie);if(ae<0)return;const re=Y[ae];if(re===z)return;Z&&z===ye||(z=Math.min(oe,Math.max(K,z)));const[se,pe]=Z0(D,U);if(se==null||pe==null)return;const ge=ae===U.length-1?re-z:z-re,ke=Eu(null,H,se,pe,ge,Y,E.current,null);if(Y!==ke){const xe=_.current;P(ke),Wl(U,ke,xe)}},[]),q=Oee(()=>({activeHandleId:v,collapsePanel:Q,direction:r,expandPanel:B,getPanelStyle:M,groupId:m,registerPanel:T,registerResizeHandle:A,resizePanel:V,startDragging:(D,z)=>{if(b(D),b1(z)||y1(z)){const H=Gm(D);S.current={dragHandleRect:H.getBoundingClientRect(),dragOffset:bO(z,D,r),sizes:R.current.sizes}}},stopDragging:()=>{Fee(),b(null),S.current=null},unregisterPanel:$}),[v,Q,r,B,M,m,T,A,V,$]),G={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return jc(Um.Provider,{children:jc(h,{children:t,className:n,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":m,style:{...G,...p}}),value:q})}const Ay=uO((e,t)=>jc(SO,{...e,forwardedRef:t}));SO.displayName="PanelGroup";Ay.displayName="forwardRef(PanelGroup)";function w1({children:e=null,className:t="",disabled:n=!1,id:r=null,onDragging:o,style:s={},tagName:a="div"}){const c=Zo(null),d=Zo({onDragging:o});Ia(()=>{d.current.onDragging=o});const p=dO(Um);if(p===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{activeHandleId:h,direction:m,groupId:v,registerResizeHandle:b,startDragging:w,stopDragging:y}=p,S=My(r),k=h===S,[_,I]=Fu(!1),[P,E]=Fu(null),O=ri(()=>{c.current.blur(),y();const{onDragging:T}=d.current;T&&T(!1)},[y]);Ia(()=>{if(n)E(null);else{const M=b(S);E(()=>M)}},[n,S,b]),Ia(()=>{if(n||P==null||!k)return;const M=Q=>{P(Q)},T=Q=>{P(Q)},$=c.current.ownerDocument;return $.body.addEventListener("contextmenu",O),$.body.addEventListener("mousemove",M),$.body.addEventListener("touchmove",M),$.body.addEventListener("mouseleave",T),window.addEventListener("mouseup",O),window.addEventListener("touchend",O),()=>{$.body.removeEventListener("contextmenu",O),$.body.removeEventListener("mousemove",M),$.body.removeEventListener("touchmove",M),$.body.removeEventListener("mouseleave",T),window.removeEventListener("mouseup",O),window.removeEventListener("touchend",O)}},[m,n,k,P,O]),$ee({disabled:n,handleId:S,resizeHandler:P});const R={cursor:yO(m),touchAction:"none",userSelect:"none"};return jc(a,{children:e,className:t,"data-resize-handle-active":k?"pointer":_?"keyboard":void 0,"data-panel-group-direction":m,"data-panel-group-id":v,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":S,onBlur:()=>I(!1),onFocus:()=>I(!0),onMouseDown:M=>{w(S,M.nativeEvent);const{onDragging:T}=d.current;T&&T(!0)},onMouseUp:O,onTouchCancel:O,onTouchEnd:O,onTouchStart:M=>{w(S,M.nativeEvent);const{onDragging:T}=d.current;T&&T(!0)},ref:c,role:"separator",style:{...R,...s},tabIndex:0})}w1.displayName="PanelResizeHandle";const Uee=(e,t,n,r="horizontal")=>{const o=f.useRef(null),[s,a]=f.useState(t),c=f.useCallback(()=>{var p,h;const d=(p=o.current)==null?void 0:p.getSize();d!==void 0&&d{const d=document.querySelector(`[data-panel-group-id="${n}"]`),p=document.querySelectorAll("[data-panel-resize-handle-id]");if(!d)return;const h=new ResizeObserver(()=>{let m=r==="horizontal"?d.getBoundingClientRect().width:d.getBoundingClientRect().height;p.forEach(v=>{m-=r==="horizontal"?v.getBoundingClientRect().width:v.getBoundingClientRect().height}),a(e/m*100)});return h.observe(d),p.forEach(m=>{h.observe(m)}),window.addEventListener("resize",c),()=>{h.disconnect(),window.removeEventListener("resize",c)}},[n,c,s,e,r]),{ref:o,minSizePct:s}},Gee=fe([Ye],e=>{const{initialImage:t}=e.generation;return{initialImage:t,isResetButtonDisabled:!t}},Ge),qee=()=>{const{initialImage:e}=L(Gee),{currentData:t}=os((e==null?void 0:e.imageName)??oo.skipToken),n=f.useMemo(()=>{if(t)return{id:"initial-image",payloadType:"IMAGE_DTO",payload:{imageDTO:t}}},[t]),r=f.useMemo(()=>({id:"initial-image",actionType:"SET_INITIAL_IMAGE"}),[]);return i.jsx(yi,{imageDTO:t,droppableData:r,draggableData:n,isUploadDisabled:!0,fitContainer:!0,dropLabel:"Set as Initial Image",noContentFallback:i.jsx(mi,{label:"No initial image selected"})})},Kee=fe([Ye],e=>{const{initialImage:t}=e.generation;return{isResetButtonDisabled:!t}},Ge),Yee={type:"SET_INITIAL_IMAGE"},Qee=()=>{const{isResetButtonDisabled:e}=L(Kee),t=te(),{getUploadButtonProps:n,getUploadInputProps:r}=Vm({postUploadAction:Yee}),o=f.useCallback(()=>{t(y7())},[t]);return i.jsxs(W,{layerStyle:"first",sx:{position:"relative",flexDirection:"column",height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",p:4,gap:4},children:[i.jsxs(W,{sx:{w:"full",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[i.jsx(tt,{sx:{fontWeight:600,userSelect:"none",color:"base.700",_dark:{color:"base.200"}},children:"Initial Image"}),i.jsx(fl,{}),i.jsx(Fe,{tooltip:"Upload Initial Image","aria-label":"Upload Initial Image",icon:i.jsx(Rd,{}),...n()}),i.jsx(Fe,{tooltip:"Reset Initial Image","aria-label":"Reset Initial Image",icon:i.jsx(Hb,{}),onClick:o,isDisabled:e})]}),i.jsx(qee,{}),i.jsx("input",{...r()})]})},Xee=e=>{const{label:t,activeLabel:n,children:r,defaultIsOpen:o=!1}=e,{isOpen:s,onToggle:a}=ss({defaultIsOpen:o}),{colorMode:c}=Ds();return i.jsxs(Re,{children:[i.jsxs(W,{onClick:a,sx:{alignItems:"center",p:2,px:4,gap:2,borderTopRadius:"base",borderBottomRadius:s?0:"base",bg:s?Be("base.200","base.750")(c):Be("base.150","base.800")(c),color:Be("base.900","base.100")(c),_hover:{bg:s?Be("base.250","base.700")(c):Be("base.200","base.750")(c)},fontSize:"sm",fontWeight:600,cursor:"pointer",transitionProperty:"common",transitionDuration:"normal",userSelect:"none"},children:[t,i.jsx(Fo,{children:n&&i.jsx(Yr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:i.jsx(tt,{sx:{color:"accent.500",_dark:{color:"accent.300"}},children:n})},"statusText")}),i.jsx(fl,{}),i.jsx(ay,{sx:{w:"1rem",h:"1rem",transform:s?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]}),i.jsx(sm,{in:s,animateOpacity:!0,style:{overflow:"unset"},children:i.jsx(Re,{sx:{p:4,borderBottomRadius:"base",bg:"base.100",_dark:{bg:"base.800"}},children:r})})]})},Oo=f.memo(Xee),Jee=fe(Ye,e=>{const{combinatorial:t,isEnabled:n}=e.dynamicPrompts;return{combinatorial:t,isDisabled:!n}},Ge),Zee=()=>{const{combinatorial:e,isDisabled:t}=L(Jee),n=te(),r=f.useCallback(()=>{n(x7())},[n]);return i.jsx(Pr,{isDisabled:t,label:"Combinatorial Generation",isChecked:e,onChange:r})},ete=fe(Ye,e=>{const{isEnabled:t}=e.dynamicPrompts;return{isEnabled:t}},Ge),tte=()=>{const e=te(),{isEnabled:t}=L(ete),n=f.useCallback(()=>{e(w7())},[e]);return i.jsx(Pr,{label:"Enable Dynamic Prompts",isChecked:t,onChange:n})},nte=fe(Ye,e=>{const{maxPrompts:t,combinatorial:n,isEnabled:r}=e.dynamicPrompts,{min:o,sliderMax:s,inputMax:a}=e.config.sd.dynamicPrompts.maxPrompts;return{maxPrompts:t,min:o,sliderMax:s,inputMax:a,isDisabled:!r||!n}},Ge),rte=()=>{const{maxPrompts:e,min:t,sliderMax:n,inputMax:r,isDisabled:o}=L(nte),s=te(),a=f.useCallback(d=>{s(S7(d))},[s]),c=f.useCallback(()=>{s(C7())},[s]);return i.jsx(_t,{label:"Max Prompts",isDisabled:o,min:t,max:n,value:e,onChange:a,sliderNumberInputProps:{max:r},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:c})},ote=fe(Ye,e=>{const{isEnabled:t}=e.dynamicPrompts;return{activeLabel:t?"Enabled":void 0}},Ge),zd=()=>{const{activeLabel:e}=L(ote);return ir("dynamicPrompting").isFeatureEnabled?i.jsx(Oo,{label:"Dynamic Prompts",activeLabel:e,children:i.jsxs(W,{sx:{gap:2,flexDir:"column"},children:[i.jsx(tte,{}),i.jsx(Zee,{}),i.jsx(rte,{})]})}):null},Ny=e=>{e.stopPropagation()},ste=Te((e,t)=>{const n=te(),r=f.useCallback(s=>{s.shiftKey&&n(Po(!0))},[n]),o=f.useCallback(s=>{s.shiftKey||n(Po(!1))},[n]);return i.jsx(UP,{ref:t,onPaste:Ny,onKeyDown:r,onKeyUp:o,...e})}),qm=f.memo(ste),ate=e=>{const{onClick:t}=e;return i.jsx(Fe,{size:"sm","aria-label":"Add Embedding",tooltip:"Add Embedding",icon:i.jsx(Lb,{}),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})},Km=f.memo(ate),$y="28rem",Ym=e=>{const{onSelect:t,isOpen:n,onClose:r,children:o}=e,{data:s}=k7(),a=f.useRef(null),c=L(h=>h.generation.model),d=f.useMemo(()=>{if(!s)return[];const h=[];return so(s.entities,(m,v)=>{if(!m)return;const b=(c==null?void 0:c.base_model)!==m.base_model;h.push({value:m.model_name,label:m.model_name,group:sr[m.base_model],disabled:b,tooltip:b?`Incompatible base model: ${m.base_model}`:void 0})}),h.sort((m,v)=>{var b;return m.label&&v.label?(b=m.label)!=null&&b.localeCompare(v.label)?-1:1:-1}),h.sort((m,v)=>m.disabled&&!v.disabled?1:-1)},[s,c==null?void 0:c.base_model]),p=f.useCallback(h=>{h&&t(h)},[t]);return i.jsxs(Tb,{initialFocusRef:a,isOpen:n,onClose:r,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[i.jsx(Db,{children:o}),i.jsx(Ab,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:i.jsx(SP,{sx:{p:0,w:`calc(${$y} - 2rem )`},children:d.length===0?i.jsx(W,{sx:{justifyContent:"center",p:2,fontSize:"sm",color:"base.500",_dark:{color:"base.700"}},children:i.jsx(tt,{children:"No Embeddings Loaded"})}):i.jsx(ar,{inputRef:a,autoFocus:!0,placeholder:"Add Embedding",value:null,data:d,nothingFound:"No matching Embeddings",itemComponent:Oi,disabled:d.length===0,onDropdownClose:r,filter:(h,m)=>{var v;return((v=m.label)==null?void 0:v.toLowerCase().includes(h.toLowerCase().trim()))||m.value.toLowerCase().includes(h.toLowerCase().trim())},onChange:p})})})]})},Ld=()=>{const e=L(m=>m.generation.negativePrompt),t=f.useRef(null),{isOpen:n,onClose:r,onOpen:o}=ss(),s=te(),{t:a}=be(),c=f.useCallback(m=>{s(Du(m.target.value))},[s]),d=f.useCallback(m=>{m.key==="<"&&o()},[o]),p=f.useCallback(m=>{if(!t.current)return;const v=t.current.selectionStart;if(v===void 0)return;let b=e.slice(0,v);b[b.length-1]!=="<"&&(b+="<"),b+=`${m}>`;const w=b.length;b+=e.slice(v),_i.flushSync(()=>{s(Du(b))}),t.current.selectionEnd=w,r()},[s,r,e]),h=ir("embedding").isFeatureEnabled;return i.jsxs(mo,{children:[i.jsx(Ym,{isOpen:n,onClose:r,onSelect:p,children:i.jsx(qm,{id:"negativePrompt",name:"negativePrompt",ref:t,value:e,placeholder:a("parameters.negativePromptPlaceholder"),onChange:c,resize:"vertical",fontSize:"sm",minH:16,...h&&{onKeyDown:d}})}),!n&&h&&i.jsx(Re,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:i.jsx(Km,{onClick:o})})]})},ite=fe([Ye,Kn],(e,t)=>{const{generation:n,system:r}=e,{initialImage:o}=n,{isProcessing:s,isConnected:a}=r;let c=!0;const d=[];t==="img2img"&&!o&&(c=!1,d.push("No initial image selected"));const{isSuccess:p}=_7.endpoints.getMainModels.select(W1)(e);return p||(c=!1,d.push("Models are not loaded")),s&&(c=!1,d.push("System Busy")),a||(c=!1,d.push("System Disconnected")),so(e.controlNet.controlNets,(h,m)=>{h.model||(c=!1,d.push(`ControlNet ${m} has no model selected.`))}),{isReady:c,reasonsWhyNotReady:d}},Ge),Bd=()=>{const{isReady:e}=L(ite);return e},lte=fe([Ye,Kn],({generation:e,ui:t},n)=>({shouldPinParametersPanel:t.shouldPinParametersPanel,prompt:e.positivePrompt,activeTabName:n}),{memoizeOptions:{resultEqualityCheck:Jt}}),Fd=()=>{const e=te(),{prompt:t,shouldPinParametersPanel:n,activeTabName:r}=L(lte),o=Bd(),s=f.useRef(null),{isOpen:a,onClose:c,onOpen:d}=ss(),{t:p}=be(),h=f.useCallback(w=>{e(Mu(w.target.value))},[e]);nt("alt+a",()=>{var w;(w=s.current)==null||w.focus()},[]);const m=f.useCallback(w=>{if(!s.current)return;const y=s.current.selectionStart;if(y===void 0)return;let S=t.slice(0,y);S[S.length-1]!=="<"&&(S+="<"),S+=`${w}>`;const k=S.length;S+=t.slice(y),_i.flushSync(()=>{e(Mu(S))}),s.current.selectionStart=k,s.current.selectionEnd=k,c()},[e,c,t]),v=ir("embedding").isFeatureEnabled,b=f.useCallback(w=>{w.key==="Enter"&&w.shiftKey===!1&&o&&(w.preventDefault(),e(dd()),e(fd(r))),v&&w.key==="<"&&d()},[o,e,r,d,v]);return i.jsxs(Re,{position:"relative",children:[i.jsx(mo,{children:i.jsx(Ym,{isOpen:a,onClose:c,onSelect:m,children:i.jsx(qm,{id:"prompt",name:"prompt",ref:s,value:t,placeholder:p("parameters.positivePromptPlaceholder"),onChange:h,onKeyDown:b,resize:"vertical",minH:32})})}),!a&&v&&i.jsx(Re,{sx:{position:"absolute",top:n?6:0,insetInlineEnd:0},children:i.jsx(Km,{onClick:d})})]})},cte=fe(Ye,e=>{const{shouldUseNoiseSettings:t,shouldUseCpuNoise:n}=e.generation;return{isDisabled:!t,shouldUseCpuNoise:n}},Ge),ute=()=>{const e=te(),{isDisabled:t,shouldUseCpuNoise:n}=L(cte),r=o=>e(P7(o.target.checked));return i.jsx(Pr,{isDisabled:t,label:"Use CPU Noise",isChecked:n,onChange:r})},dte=fe(Ye,e=>{const{shouldUseNoiseSettings:t,threshold:n}=e.generation;return{isDisabled:!t,threshold:n}},Ge);function fte(){const e=te(),{threshold:t,isDisabled:n}=L(dte),{t:r}=be();return i.jsx(_t,{isDisabled:n,label:r("parameters.noiseThreshold"),min:0,max:20,step:.1,onChange:o=>e(H2(o)),handleReset:()=>e(H2(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}const pte=()=>{const e=te(),t=L(r=>r.generation.shouldUseNoiseSettings),n=r=>e(j7(r.target.checked));return i.jsx(Pr,{label:"Enable Noise Settings",isChecked:t,onChange:n})},hte=fe(Ye,e=>{const{shouldUseNoiseSettings:t,perlin:n}=e.generation;return{isDisabled:!t,perlin:n}},Ge);function mte(){const e=te(),{perlin:t,isDisabled:n}=L(hte),{t:r}=be();return i.jsx(_t,{isDisabled:n,label:r("parameters.perlinNoise"),min:0,max:1,step:.05,onChange:o=>e(W2(o)),handleReset:()=>e(W2(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}const gte=fe(Ye,e=>{const{shouldUseNoiseSettings:t}=e.generation;return{activeLabel:t?"Enabled":void 0}},Ge),vte=()=>{const{t:e}=be(),t=ir("noise").isFeatureEnabled,n=ir("perlinNoise").isFeatureEnabled,r=ir("noiseThreshold").isFeatureEnabled,{activeLabel:o}=L(gte);return t?i.jsx(Oo,{label:e("parameters.noiseSettings"),activeLabel:o,children:i.jsxs(W,{sx:{gap:2,flexDirection:"column"},children:[i.jsx(pte,{}),i.jsx(ute,{}),n&&i.jsx(mte,{}),r&&i.jsx(fte,{})]})}):null},Qm=f.memo(vte),bte=fe(go,e=>({isProcessing:e.isProcessing,isConnected:e.isConnected,isCancelable:e.isCancelable,currentIteration:e.currentIteration,totalIterations:e.totalIterations,sessionId:e.sessionId,cancelType:e.cancelType,isCancelScheduled:e.isCancelScheduled}),{memoizeOptions:{resultEqualityCheck:Jt}}),yte=e=>{const t=te(),{btnGroupWidth:n="auto",...r}=e,{isProcessing:o,isConnected:s,isCancelable:a,cancelType:c,isCancelScheduled:d,sessionId:p}=L(bte),h=f.useCallback(()=>{if(p){if(c==="scheduled"){t(I7());return}t(E7({session_id:p}))}},[t,p,c]),{t:m}=be(),v=f.useCallback(y=>{const S=Array.isArray(y)?y[0]:y;t(O7(S))},[t]);nt("shift+x",()=>{(s||o)&&a&&h()},[s,o,a]);const b=f.useMemo(()=>m(d?"parameters.cancel.isScheduled":c==="immediate"?"parameters.cancel.immediate":"parameters.cancel.schedule"),[m,c,d]),w=f.useMemo(()=>d?i.jsx(Lp,{}):c==="immediate"?i.jsx(kee,{}):i.jsx(xee,{}),[c,d]);return i.jsxs(nr,{isAttached:!0,width:n,children:[i.jsx(Fe,{icon:w,tooltip:b,"aria-label":b,isDisabled:!s||!o||!a,onClick:h,colorScheme:"error",id:"cancel-button",...r}),i.jsxs(Cd,{closeOnSelect:!1,children:[i.jsx(kd,{as:Fe,tooltip:m("parameters.cancel.setType"),"aria-label":m("parameters.cancel.setType"),icon:i.jsx(UV,{w:"1em",h:"1em"}),paddingX:0,paddingY:0,colorScheme:"error",minWidth:5,...r}),i.jsx(Lc,{minWidth:"240px",children:i.jsxs(uP,{value:c,title:"Cancel Type",type:"radio",onChange:v,children:[i.jsx(Up,{value:"immediate",children:m("parameters.cancel.immediate")}),i.jsx(Up,{value:"scheduled",children:m("parameters.cancel.schedule")})]})})]})]})},Xm=f.memo(yte),xte=fe(go,e=>({isProcessing:e.isProcessing,currentStep:e.currentStep,totalSteps:e.totalSteps,currentStatusHasSteps:e.currentStatusHasSteps}),{memoizeOptions:{resultEqualityCheck:Jt}}),wte=()=>{const{t:e}=be(),{isProcessing:t,currentStep:n,totalSteps:r,currentStatusHasSteps:o}=L(xte),s=n?Math.round(n*100/r):0;return i.jsx(kP,{value:s,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:t&&!o,height:"full",colorScheme:"accent"})},CO=f.memo(wte),xk={_disabled:{bg:"none",color:"base.600",cursor:"not-allowed",_hover:{color:"base.600",bg:"none"}}},Ste=fe([Ye,Kn,jr],({gallery:e},t,n)=>{const{autoAddBoardId:r}=e;return{isBusy:n,autoAddBoardId:r,activeTabName:t}},Ge);function zy(e){const{iconButton:t=!1,...n}=e,r=te(),o=Bd(),{isBusy:s,autoAddBoardId:a,activeTabName:c}=L(Ste),d=Rm(a),p=f.useCallback(()=>{r(dd()),r(fd(c))},[r,c]),{t:h}=be();return nt(["ctrl+enter","meta+enter"],p,{enabled:()=>o,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,c]),i.jsx(Re,{style:{flexGrow:4},position:"relative",children:i.jsxs(Re,{style:{position:"relative"},children:[!o&&i.jsx(Re,{borderRadius:"base",style:{position:"absolute",bottom:"0",left:"0",right:"0",height:"100%",overflow:"clip"},...n,children:i.jsx(CO,{})}),i.jsx(wn,{placement:"top",hasArrow:!0,openDelay:500,label:a?`Auto-Adding to ${d}`:void 0,children:t?i.jsx(Fe,{"aria-label":h("parameters.invoke"),type:"submit",icon:i.jsx(w6,{}),isDisabled:!o||s,onClick:p,tooltip:h("parameters.invoke"),tooltipProps:{placement:"top"},colorScheme:"accent",id:"invoke-button",...n,sx:{w:"full",flexGrow:1,...s?xk:{}}}):i.jsx(rn,{"aria-label":h("parameters.invoke"),type:"submit",isDisabled:!o||s,onClick:p,colorScheme:"accent",id:"invoke-button",...n,sx:{w:"full",flexGrow:1,fontWeight:700,...s?xk:{}},children:"Invoke"})})]})})}const Hd=()=>i.jsxs(W,{gap:2,children:[i.jsx(zy,{}),i.jsx(Xm,{})]}),Cte=fe([Ye,Kn],({sdxl:e},t)=>({prompt:e.negativeStylePrompt,activeTabName:t}),{memoizeOptions:{resultEqualityCheck:Jt}}),kO=()=>{const e=te(),{prompt:t,activeTabName:n}=L(Cte),r=Bd(),o=f.useRef(null),{isOpen:s,onClose:a,onOpen:c}=ss(),d=f.useCallback(v=>{e(V2(v.target.value))},[e]),p=f.useCallback(v=>{if(!o.current)return;const b=o.current.selectionStart;if(b===void 0)return;let w=t.slice(0,b);w[w.length-1]!=="<"&&(w+="<"),w+=`${v}>`;const y=w.length;w+=t.slice(b),_i.flushSync(()=>{e(V2(w))}),o.current.selectionStart=y,o.current.selectionEnd=y,a()},[e,a,t]),h=ir("embedding").isFeatureEnabled,m=f.useCallback(v=>{v.key==="Enter"&&v.shiftKey===!1&&r&&(v.preventDefault(),e(dd()),e(fd(n))),h&&v.key==="<"&&c()},[r,e,n,c,h]);return i.jsxs(Re,{position:"relative",children:[i.jsx(mo,{children:i.jsx(Ym,{isOpen:s,onClose:a,onSelect:p,children:i.jsx(qm,{id:"prompt",name:"prompt",ref:o,value:t,placeholder:"Negative Style Prompt",onChange:d,onKeyDown:m,resize:"vertical",fontSize:"sm",minH:16})})}),!s&&h&&i.jsx(Re,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:i.jsx(Km,{onClick:c})})]})},kte=fe([Ye,Kn],({sdxl:e},t)=>({prompt:e.positiveStylePrompt,activeTabName:t}),{memoizeOptions:{resultEqualityCheck:Jt}}),_O=()=>{const e=te(),{prompt:t,activeTabName:n}=L(kte),r=Bd(),o=f.useRef(null),{isOpen:s,onClose:a,onOpen:c}=ss(),d=f.useCallback(v=>{e(U2(v.target.value))},[e]),p=f.useCallback(v=>{if(!o.current)return;const b=o.current.selectionStart;if(b===void 0)return;let w=t.slice(0,b);w[w.length-1]!=="<"&&(w+="<"),w+=`${v}>`;const y=w.length;w+=t.slice(b),_i.flushSync(()=>{e(U2(w))}),o.current.selectionStart=y,o.current.selectionEnd=y,a()},[e,a,t]),h=ir("embedding").isFeatureEnabled,m=f.useCallback(v=>{v.key==="Enter"&&v.shiftKey===!1&&r&&(v.preventDefault(),e(dd()),e(fd(n))),h&&v.key==="<"&&c()},[r,e,n,c,h]);return i.jsxs(Re,{position:"relative",children:[i.jsx(mo,{children:i.jsx(Ym,{isOpen:s,onClose:a,onSelect:p,children:i.jsx(qm,{id:"prompt",name:"prompt",ref:o,value:t,placeholder:"Positive Style Prompt",onChange:d,onKeyDown:m,resize:"vertical",minH:16})})}),!s&&h&&i.jsx(Re,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:i.jsx(Km,{onClick:c})})]})},Gc=()=>{const{isRefinerAvailable:e}=na(V1,{selectFromResult:({data:t})=>({isRefinerAvailable:t?t.ids.length>0:!1})});return e},_te=fe([Ye],({sdxl:e,hotkeys:t})=>{const{refinerAestheticScore:n}=e,{shift:r}=t;return{refinerAestheticScore:n,shift:r}},Ge),Pte=()=>{const{refinerAestheticScore:e,shift:t}=L(_te),n=Gc(),r=te(),o=f.useCallback(a=>r(G2(a)),[r]),s=f.useCallback(()=>r(G2(6)),[r]);return i.jsx(_t,{label:"Aesthetic Score",step:t?.1:.5,min:1,max:10,onChange:o,handleReset:s,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},jte=f.memo(Pte),Kh=/^-?(0\.)?\.?$/,Ite=e=>{const{label:t,isDisabled:n=!1,showStepper:r=!0,isInvalid:o,value:s,onChange:a,min:c,max:d,isInteger:p=!0,formControlProps:h,formLabelProps:m,numberInputFieldProps:v,numberInputStepperProps:b,tooltipProps:w,...y}=e,S=te(),[k,_]=f.useState(String(s));f.useEffect(()=>{!k.match(Kh)&&s!==Number(k)&&_(String(s))},[s,k]);const I=R=>{_(R),R.match(Kh)||a(p?Math.floor(Number(R)):Number(R))},P=R=>{const M=Es(p?Math.floor(Number(R.target.value)):Number(R.target.value),c,d);_(String(M)),a(M)},E=f.useCallback(R=>{R.shiftKey&&S(Po(!0))},[S]),O=f.useCallback(R=>{R.shiftKey||S(Po(!1))},[S]);return i.jsx(wn,{...w,children:i.jsxs(mo,{isDisabled:n,isInvalid:o,...h,children:[t&&i.jsx(zo,{...m,children:t}),i.jsxs(dm,{value:k,min:c,max:d,keepWithinRange:!0,clampValueOnBlur:!1,onChange:I,onBlur:P,...y,onPaste:Ny,children:[i.jsx(pm,{...v,onKeyDown:E,onKeyUp:O}),r&&i.jsxs(fm,{children:[i.jsx(mm,{...b}),i.jsx(hm,{...b})]})]})]})})},qc=f.memo(Ite),Ete=fe([Ye],({sdxl:e,ui:t,hotkeys:n})=>{const{refinerCFGScale:r}=e,{shouldUseSliders:o}=t,{shift:s}=n;return{refinerCFGScale:r,shouldUseSliders:o,shift:s}},Ge),Ote=()=>{const{refinerCFGScale:e,shouldUseSliders:t,shift:n}=L(Ete),r=Gc(),o=te(),{t:s}=be(),a=f.useCallback(d=>o(q2(d)),[o]),c=f.useCallback(()=>o(q2(7)),[o]);return t?i.jsx(_t,{label:s("parameters.cfgScale"),step:n?.1:.5,min:1,max:20,onChange:a,handleReset:c,value:e,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!r}):i.jsx(qc,{label:s("parameters.cfgScale"),step:.5,min:1,max:200,onChange:a,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"},isDisabled:!r})},Rte=f.memo(Ote),Jm=e=>{const t=tm("models"),[n,r,o]=e.split("/"),s=R7.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data};function Wd(e){const{iconMode:t=!1}=e,n=te(),{t:r}=be(),[o,{isLoading:s}]=M7(),a=()=>{o().unwrap().then(c=>{n(Dn(Bn({title:`${r("modelManager.modelsSynced")}`,status:"success"})))}).catch(c=>{c&&n(Dn(Bn({title:`${r("modelManager.modelSyncFailed")}`,status:"error"})))})};return t?i.jsx(Fe,{icon:i.jsx(k6,{}),tooltip:r("modelManager.syncModels"),"aria-label":r("modelManager.syncModels"),isLoading:s,onClick:a,size:"sm"}):i.jsx(rn,{isLoading:s,onClick:a,minW:"max-content",children:"Sync Models"})}const Mte=fe(Ye,e=>({model:e.sdxl.refinerModel}),Ge),Dte=()=>{const e=te(),t=ir("syncModels").isFeatureEnabled,{model:n}=L(Mte),{data:r,isLoading:o}=na(V1),s=f.useMemo(()=>{if(!r)return[];const d=[];return so(r.entities,(p,h)=>{p&&d.push({value:h,label:p.model_name,group:sr[p.base_model]})}),d},[r]),a=f.useMemo(()=>(r==null?void 0:r.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])??null,[r==null?void 0:r.entities,n]),c=f.useCallback(d=>{if(!d)return;const p=Jm(d);p&&e(D7(p))},[e]);return o?i.jsx(ar,{label:"Refiner Model",placeholder:"Loading...",disabled:!0,data:[]}):i.jsxs(W,{w:"100%",alignItems:"center",gap:2,children:[i.jsx(ar,{tooltip:a==null?void 0:a.description,label:"Refiner Model",value:a==null?void 0:a.id,placeholder:s.length>0?"Select a model":"No models available",data:s,error:s.length===0,disabled:s.length===0,onChange:c,w:"100%"}),t&&i.jsx(Re,{mt:7,children:i.jsx(Wd,{iconMode:!0})})]})},Tte=f.memo(Dte),Ate=fe(Ye,({ui:e,sdxl:t})=>{const{refinerScheduler:n}=t,{favoriteSchedulers:r}=e,o=cs(H1,(s,a)=>({value:a,label:s,group:r.includes(a)?"Favorites":void 0})).sort((s,a)=>s.label.localeCompare(a.label));return{refinerScheduler:n,data:o}},Ge),Nte=()=>{const e=te(),{t}=be(),{refinerScheduler:n,data:r}=L(Ate),o=Gc(),s=f.useCallback(a=>{a&&e(T7(a))},[e]);return i.jsx(ar,{w:"100%",label:t("parameters.scheduler"),value:n,data:r,onChange:s,disabled:!o})},$te=f.memo(Nte),zte=fe([Ye],({sdxl:e})=>{const{refinerStart:t}=e;return{refinerStart:t}},Ge),Lte=()=>{const{refinerStart:e}=L(zte),t=te(),n=Gc(),r=f.useCallback(s=>t(K2(s)),[t]),o=f.useCallback(()=>t(K2(.7)),[t]);return i.jsx(_t,{label:"Refiner Start",step:.01,min:0,max:1,onChange:r,handleReset:o,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Bte=f.memo(Lte),Fte=fe([Ye],({sdxl:e,ui:t})=>{const{refinerSteps:n}=e,{shouldUseSliders:r}=t;return{refinerSteps:n,shouldUseSliders:r}},Ge),Hte=()=>{const{refinerSteps:e,shouldUseSliders:t}=L(Fte),n=Gc(),r=te(),{t:o}=be(),s=f.useCallback(c=>{r(Y2(c))},[r]),a=f.useCallback(()=>{r(Y2(20))},[r]);return t?i.jsx(_t,{label:o("parameters.steps"),min:1,max:100,step:1,onChange:s,handleReset:a,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:500},isDisabled:!n}):i.jsx(qc,{label:o("parameters.steps"),min:1,max:500,step:1,onChange:s,value:e,numberInputFieldProps:{textAlign:"center"},isDisabled:!n})},Wte=f.memo(Hte);function Vte(){const e=L(o=>o.sdxl.shouldUseSDXLRefiner),t=Gc(),n=te(),r=o=>{n(A7(o.target.checked))};return i.jsx(Pr,{label:"Use Refiner",isChecked:e,onChange:r,isDisabled:!t})}const Ute=fe(Ye,e=>{const{shouldUseSDXLRefiner:t}=e.sdxl,{shouldUseSliders:n}=e.ui;return{activeLabel:t?"Enabled":void 0,shouldUseSliders:n}},Ge),PO=()=>{const{activeLabel:e,shouldUseSliders:t}=L(Ute);return i.jsx(Oo,{label:"Refiner",activeLabel:e,children:i.jsxs(W,{sx:{gap:2,flexDir:"column"},children:[i.jsx(Vte,{}),i.jsx(Tte,{}),i.jsxs(W,{gap:2,flexDirection:t?"column":"row",children:[i.jsx(Wte,{}),i.jsx(Rte,{})]}),i.jsx($te,{}),i.jsx(jte,{}),i.jsx(Bte,{})]})})},Gte=fe([Ye],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:a,inputMax:c}=t.sd.guidance,{cfgScale:d}=e,{shouldUseSliders:p}=n,{shift:h}=r;return{cfgScale:d,initial:o,min:s,sliderMax:a,inputMax:c,shouldUseSliders:p,shift:h}},Ge),qte=()=>{const{cfgScale:e,initial:t,min:n,sliderMax:r,inputMax:o,shouldUseSliders:s,shift:a}=L(Gte),c=te(),{t:d}=be(),p=f.useCallback(m=>c(Mp(m)),[c]),h=f.useCallback(()=>c(Mp(t)),[c,t]);return s?i.jsx(_t,{label:d("parameters.cfgScale"),step:a?.1:.5,min:n,max:r,onChange:p,handleReset:h,value:e,sliderNumberInputProps:{max:o},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1}):i.jsx(qc,{label:d("parameters.cfgScale"),step:.5,min:n,max:o,onChange:p,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})},xi=f.memo(qte),Kte=fe([Ye],e=>{const{initial:t,min:n,sliderMax:r,inputMax:o,fineStep:s,coarseStep:a}=e.config.sd.iterations,{iterations:c}=e.generation,{shouldUseSliders:d}=e.ui,p=e.dynamicPrompts.isEnabled&&e.dynamicPrompts.combinatorial,h=e.hotkeys.shift?s:a;return{iterations:c,initial:t,min:n,sliderMax:r,inputMax:o,step:h,shouldUseSliders:d,isDisabled:p}},Ge),Yte=()=>{const{iterations:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:a,isDisabled:c}=L(Kte),d=te(),{t:p}=be(),h=f.useCallback(v=>{d(Q2(v))},[d]),m=f.useCallback(()=>{d(Q2(t))},[d,t]);return a?i.jsx(_t,{isDisabled:c,label:p("parameters.images"),step:s,min:n,max:r,onChange:h,handleReset:m,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:o}}):i.jsx(qc,{isDisabled:c,label:p("parameters.images"),step:s,min:n,max:o,onChange:h,value:e,numberInputFieldProps:{textAlign:"center"}})},wi=f.memo(Yte),Qte=e=>{const[t,n,r]=e.split("/");return{base_model:t,model_name:r,model_type:n}},Xte=fe(Ye,e=>({model:e.generation.model}),Ge),Jte=()=>{const e=te(),{t}=be(),{model:n}=L(Xte),r=ir("syncModels").isFeatureEnabled,{data:o,isLoading:s}=na(W1),{data:a,isLoading:c}=H_(),d=L(Kn),p=f.useMemo(()=>{if(!o)return[];const v=[];return so(o.entities,(b,w)=>{!b||d==="unifiedCanvas"&&b.base_model==="sdxl"||v.push({value:w,label:b.model_name,group:sr[b.base_model]})}),so(a==null?void 0:a.entities,(b,w)=>{b&&v.push({value:w,label:b.model_name,group:sr[b.base_model]})}),v},[o,a,d]),h=f.useMemo(()=>((o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])||(a==null?void 0:a.entities[`${n==null?void 0:n.base_model}/onnx/${n==null?void 0:n.model_name}`]))??null,[o==null?void 0:o.entities,n,a==null?void 0:a.entities]),m=f.useCallback(v=>{if(!v)return;let b=Jm(v);v.includes("onnx")&&(b=Qte(v)),b&&e(hv(b))},[e]);return s||c?i.jsx(ar,{label:t("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):i.jsxs(W,{w:"100%",alignItems:"center",gap:3,children:[i.jsx(ar,{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&&i.jsx(Re,{mt:7,children:i.jsx(Wd,{iconMode:!0})})]})},Zte=f.memo(Jte),jO=e=>{const t=tm("models"),[n,r,o]=e.split("/"),s=N7.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},ene=fe(Ye,({generation:e})=>{const{model:t,vae:n}=e;return{model:t,vae:n}},Ge),tne=()=>{const e=te(),{t}=be(),{model:n,vae:r}=L(ene),{data:o}=W_(),s=f.useMemo(()=>{if(!o)return[];const d=[{value:"default",label:"Default",group:"Default"}];return so(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:sr[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]),a=f.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=f.useCallback(d=>{if(!d||d==="default"){e(X2(null));return}const p=jO(d);p&&e(X2(p))},[e]);return i.jsx(ar,{itemComponent:Oi,tooltip:a==null?void 0:a.description,label:t("modelManager.vae"),value:(a==null?void 0:a.id)??"default",placeholder:"Default",data:s,onChange:c,disabled:s.length===0,clearable:!0})},nne=f.memo(tne),Mi=e=>e.generation,rne=fe([La,Mi],(e,t)=>{const{scheduler:n}=t,{favoriteSchedulers:r}=e,o=cs(H1,(s,a)=>({value:a,label:s,group:r.includes(a)?"Favorites":void 0})).sort((s,a)=>s.label.localeCompare(a.label));return{scheduler:n,data:o}},Ge),one=()=>{const e=te(),{t}=be(),{scheduler:n,data:r}=L(rne),o=f.useCallback(s=>{s&&e(mv(s))},[e]);return i.jsx(ar,{label:t("parameters.scheduler"),value:n,data:r,onChange:o})},sne=f.memo(one),ane=fe(Ye,({generation:e})=>{const{vaePrecision:t}=e;return{vaePrecision:t}},Ge),ine=["fp16","fp32"],lne=()=>{const e=te(),{vaePrecision:t}=L(ane),n=f.useCallback(r=>{r&&e($7(r))},[e]);return i.jsx(Kr,{label:"VAE Precision",value:t,data:ine,onChange:n})},cne=f.memo(lne),une=()=>{const e=ir("vae").isFeatureEnabled;return i.jsxs(W,{gap:3,w:"full",flexWrap:e?"wrap":"nowrap",children:[i.jsx(Re,{w:"full",children:i.jsx(Zte,{})}),i.jsx(Re,{w:"full",children:i.jsx(sne,{})}),e&&i.jsxs(W,{w:"full",gap:3,children:[i.jsx(nne,{}),i.jsx(cne,{})]})]})},Si=f.memo(une),dne=[{name:"Free",value:null},{name:"2:3",value:2/3},{name:"16:9",value:16/9},{name:"1:1",value:1/1}];function IO(){const e=L(o=>o.generation.aspectRatio),t=te(),n=L(o=>o.generation.shouldFitToWidthHeight),r=L(Kn);return i.jsx(W,{gap:2,flexGrow:1,children:i.jsx(nr,{isAttached:!0,children:dne.map(o=>i.jsx(rn,{size:"sm",isChecked:e===o.value,isDisabled:r==="img2img"?!n:!1,onClick:()=>t(z7(o.value)),children:o.name},o.name))})})}const fne=fe([Ye],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:a,fineStep:c,coarseStep:d}=n.sd.height,{height:p}=e,{aspectRatio:h}=e,m=t.shift?c:d;return{height:p,initial:r,min:o,sliderMax:s,inputMax:a,step:m,aspectRatio:h}},Ge),pne=e=>{const{height:t,initial:n,min:r,sliderMax:o,inputMax:s,step:a,aspectRatio:c}=L(fne),d=te(),{t:p}=be(),h=f.useCallback(v=>{if(d(mc(v)),c){const b=Ss(v*c,8);d(hc(b))}},[d,c]),m=f.useCallback(()=>{if(d(mc(n)),c){const v=Ss(n*c,8);d(hc(v))}},[d,n,c]);return i.jsx(_t,{label:p("parameters.height"),value:t,min:r,step:a,max:o,onChange:h,handleReset:m,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},hne=f.memo(pne),mne=fe([Ye],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:a,fineStep:c,coarseStep:d}=n.sd.width,{width:p,aspectRatio:h}=e,m=t.shift?c:d;return{width:p,initial:r,min:o,sliderMax:s,inputMax:a,step:m,aspectRatio:h}},Ge),gne=e=>{const{width:t,initial:n,min:r,sliderMax:o,inputMax:s,step:a,aspectRatio:c}=L(mne),d=te(),{t:p}=be(),h=f.useCallback(v=>{if(d(hc(v)),c){const b=Ss(v/c,8);d(mc(b))}},[d,c]),m=f.useCallback(()=>{if(d(hc(n)),c){const v=Ss(n/c,8);d(mc(v))}},[d,n,c]);return i.jsx(_t,{label:p("parameters.width"),value:t,min:r,step:a,max:o,onChange:h,handleReset:m,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},vne=f.memo(gne);function Ic(){const{t:e}=be(),t=te(),n=L(o=>o.generation.shouldFitToWidthHeight),r=L(Kn);return i.jsxs(W,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.150",_dark:{bg:"base.750"}},children:[i.jsxs(W,{alignItems:"center",gap:2,children:[i.jsx(tt,{sx:{fontSize:"sm",width:"full",color:"base.700",_dark:{color:"base.300"}},children:e("parameters.aspectRatio")}),i.jsx(fl,{}),i.jsx(IO,{}),i.jsx(Fe,{tooltip:e("ui.swapSizes"),"aria-label":e("ui.swapSizes"),size:"sm",icon:i.jsx(lO,{}),fontSize:20,isDisabled:r==="img2img"?!n:!1,onClick:()=>t(L7())})]}),i.jsx(W,{gap:2,alignItems:"center",children:i.jsxs(W,{gap:2,flexDirection:"column",width:"full",children:[i.jsx(vne,{isDisabled:r==="img2img"?!n:!1}),i.jsx(hne,{isDisabled:r==="img2img"?!n:!1})]})})]})}const bne=fe([Ye],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:a,inputMax:c,fineStep:d,coarseStep:p}=t.sd.steps,{steps:h}=e,{shouldUseSliders:m}=n,v=r.shift?d:p;return{steps:h,initial:o,min:s,sliderMax:a,inputMax:c,step:v,shouldUseSliders:m}},Ge),yne=()=>{const{steps:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:a}=L(bne),c=te(),{t:d}=be(),p=f.useCallback(v=>{c(Dp(v))},[c]),h=f.useCallback(()=>{c(Dp(t))},[c,t]),m=f.useCallback(()=>{c(dd())},[c]);return a?i.jsx(_t,{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}}):i.jsx(qc,{label:d("parameters.steps"),min:n,max:o,step:s,onChange:p,value:e,numberInputFieldProps:{textAlign:"center"},onBlur:m})},Ci=f.memo(yne);function EO(){const e=te(),t=L(o=>o.generation.shouldFitToWidthHeight),n=o=>e(B7(o.target.checked)),{t:r}=be();return i.jsx(Pr,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function xne(){const e=L(a=>a.generation.seed),t=L(a=>a.generation.shouldRandomizeSeed),n=L(a=>a.generation.shouldGenerateVariations),{t:r}=be(),o=te(),s=a=>o(Rp(a));return i.jsx(qc,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:V_,max:U_,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e})}const wne=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);function Sne(){const e=te(),t=L(o=>o.generation.shouldRandomizeSeed),{t:n}=be(),r=()=>e(Rp(wne(V_,U_)));return i.jsx(Fe,{size:"sm",isDisabled:t,"aria-label":n("parameters.shuffle"),tooltip:n("parameters.shuffle"),onClick:r,icon:i.jsx(cW,{})})}const Cne=()=>{const e=te(),{t}=be(),n=L(o=>o.generation.shouldRandomizeSeed),r=o=>e(F7(o.target.checked));return i.jsx(Pr,{label:t("common.random"),isChecked:n,onChange:r})},kne=f.memo(Cne),_ne=()=>i.jsxs(W,{sx:{gap:3,alignItems:"flex-end"},children:[i.jsx(xne,{}),i.jsx(Sne,{}),i.jsx(kne,{})]}),ki=f.memo(_ne),Pne=fe([Ye],({sdxl:e})=>{const{sdxlImg2ImgDenoisingStrength:t}=e;return{sdxlImg2ImgDenoisingStrength:t}},Ge),jne=()=>{const{sdxlImg2ImgDenoisingStrength:e}=L(Pne),t=te(),{t:n}=be(),r=f.useCallback(s=>t(J2(s)),[t]),o=f.useCallback(()=>{t(J2(.7))},[t]);return i.jsx(_t,{label:`${n("parameters.denoisingStrength")}`,step:.01,min:0,max:1,onChange:r,handleReset:o,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0})},Ine=f.memo(jne),Ene=fe([La,Mi],(e,t)=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},Ge),One=()=>{const{shouldUseSliders:e,activeLabel:t}=L(Ene);return i.jsx(Oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:i.jsxs(W,{sx:{flexDirection:"column",gap:3},children:[e?i.jsxs(i.Fragment,{children:[i.jsx(wi,{}),i.jsx(Ci,{}),i.jsx(xi,{}),i.jsx(Si,{}),i.jsx(Re,{pt:2,children:i.jsx(ki,{})}),i.jsx(Ic,{})]}):i.jsxs(i.Fragment,{children:[i.jsxs(W,{gap:3,children:[i.jsx(wi,{}),i.jsx(Ci,{}),i.jsx(xi,{})]}),i.jsx(Si,{}),i.jsx(Re,{pt:2,children:i.jsx(ki,{})}),i.jsx(Ic,{})]}),i.jsx(Ine,{}),i.jsx(EO,{})]})})},Rne=f.memo(One),Mne=()=>i.jsxs(i.Fragment,{children:[i.jsx(Fd,{}),i.jsx(_O,{}),i.jsx(Ld,{}),i.jsx(kO,{}),i.jsx(Hd,{}),i.jsx(Rne,{}),i.jsx(PO,{}),i.jsx(zd,{}),i.jsx(Qm,{})]}),OO=e=>{const{sx:t}=e,n=te(),r=L(a=>a.ui.shouldPinParametersPanel),{t:o}=be(),s=()=>{n(H7(!r)),n(Co())};return i.jsx(Fe,{...e,tooltip:o("common.pinOptionsPanel"),"aria-label":o("common.pinOptionsPanel"),onClick:s,icon:r?i.jsx(uj,{}):i.jsx(dj,{}),variant:"ghost",size:"sm",sx:{color:"base.500",_hover:{color:"base.600"},_active:{color:"base.700"},_dark:{color:"base.500",_hover:{color:"base.400"},_active:{color:"base.300"}},...t}})},Dne=fe(La,e=>{const{shouldPinParametersPanel:t,shouldShowParametersPanel:n}=e;return{shouldPinParametersPanel:t,shouldShowParametersPanel:n}}),Tne=e=>{const{shouldPinParametersPanel:t,shouldShowParametersPanel:n}=L(Dne);return t&&n?i.jsxs(Re,{sx:{position:"relative",h:"full",w:$y,flexShrink:0},children:[i.jsx(W,{sx:{gap:2,flexDirection:"column",h:"full",w:"full",position:"absolute",overflowY:"auto"},children:e.children}),i.jsx(OO,{sx:{position:"absolute",top:0,insetInlineEnd:0}})]}):null},Ly=f.memo(Tne),Ane=e=>{const{direction:t="horizontal",...n}=e,{colorMode:r}=Ds();return t==="horizontal"?i.jsx(w1,{children:i.jsx(W,{sx:{w:6,h:"full",justifyContent:"center",alignItems:"center"},...n,children:i.jsx(Re,{sx:{w:.5,h:"calc(100% - 4px)",bg:Be("base.100","base.850")(r)}})})}):i.jsx(w1,{children:i.jsx(W,{sx:{w:"full",h:6,justifyContent:"center",alignItems:"center"},...n,children:i.jsx(Re,{sx:{w:"calc(100% - 4px)",h:.5,bg:Be("base.100","base.850")(r)}})})})},RO=f.memo(Ane),Nne=fe([Ye],({system:e})=>{const{isProcessing:t,isConnected:n}=e;return n&&!t}),$ne=e=>{const{onClick:t,isDisabled:n}=e,{t:r}=be(),o=L(Nne);return i.jsx(Fe,{onClick:t,icon:i.jsx(us,{}),tooltip:`${r("gallery.deleteImage")} (Del)`,"aria-label":`${r("gallery.deleteImage")} (Del)`,isDisabled:n||!o,colorScheme:"error"})},zne=[{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 Lne(){const e=L(r=>r.postprocessing.esrganModelName),t=te(),n=r=>t(W7(r));return i.jsx(Kr,{label:"ESRGAN Model",value:e,itemComponent:Oi,onChange:n,data:zne})}const Bne=e=>{const{imageDTO:t}=e,n=te(),r=L(jr),{t:o}=be(),{isOpen:s,onOpen:a,onClose:c}=ss(),d=f.useCallback(()=>{c(),t&&n(G_({image_name:t.image_name}))},[n,t,c]);return i.jsx(gl,{isOpen:s,onClose:c,triggerComponent:i.jsx(Fe,{onClick:a,icon:i.jsx(KH,{}),"aria-label":o("parameters.upscale")}),children:i.jsxs(W,{sx:{flexDirection:"column",gap:4},children:[i.jsx(Lne,{}),i.jsx(rn,{size:"sm",isDisabled:!t||r,onClick:d,children:o("parameters.upscaleImage")})]})})},Fne=fe([Ye,Kn],({gallery:e,system:t,ui:n},r)=>{const{isProcessing:o,isConnected:s,shouldConfirmOnDelete:a,progressImage:c}=t,{shouldShowImageDetails:d,shouldHidePreview:p,shouldShowProgressInViewer:h}=n,m=e.selection[e.selection.length-1];return{canDeleteImage:s&&!o,shouldConfirmOnDelete:a,isProcessing:o,isConnected:s,shouldDisableToolbarButtons:!!c||!m,shouldShowImageDetails:d,activeTabName:r,shouldHidePreview:p,shouldShowProgressInViewer:h,lastSelectedImage:m}},{memoizeOptions:{resultEqualityCheck:Jt}}),Hne=e=>{const t=te(),{isProcessing:n,isConnected:r,shouldDisableToolbarButtons:o,shouldShowImageDetails:s,lastSelectedImage:a,shouldShowProgressInViewer:c}=L(Fne),d=ir("upscaling").isFeatureEnabled,p=Fc(),{t:h}=be(),{recallBothPrompts:m,recallSeed:v,recallAllParameters:b}=Ey(),[w,y]=Ry(a,500),{currentData:S}=os(a??oo.skipToken),{currentData:k}=L1(y.isPending()?oo.skipToken:w??oo.skipToken),_=k==null?void 0:k.metadata,I=f.useCallback(()=>{b(_)},[_,b]);nt("a",()=>{},[_,b]);const P=f.useCallback(()=>{v(_==null?void 0:_.seed)},[_==null?void 0:_.seed,v]);nt("s",P,[S]);const E=f.useCallback(()=>{m(_==null?void 0:_.positive_prompt,_==null?void 0:_.negative_prompt)},[_==null?void 0:_.negative_prompt,_==null?void 0:_.positive_prompt,m]);nt("p",E,[S]);const O=f.useCallback(()=>{t(ZE()),t($1(S))},[t,S]);nt("shift+i",O,[S]);const R=f.useCallback(()=>{S&&t(G_({image_name:S.image_name}))},[t,S]),M=f.useCallback(()=>{S&&t(B1(S))},[t,S]);nt("Shift+U",()=>{R()},{enabled:()=>!!(d&&!o&&r&&!n)},[d,S,o,r,n]);const T=f.useCallback(()=>t(V7(!s)),[t,s]);nt("i",()=>{S?T():p({title:h("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[S,s,p]),nt("delete",()=>{M()},[t,S]);const A=f.useCallback(()=>{t(F_(!c))},[t,c]);return i.jsx(i.Fragment,{children:i.jsxs(W,{sx:{flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},...e,children:[i.jsx(nr,{isAttached:!0,isDisabled:o,children:i.jsxs(Cd,{children:[i.jsx(kd,{as:Fe,"aria-label":`${h("parameters.sendTo")}...`,tooltip:`${h("parameters.sendTo")}...`,isDisabled:!S,icon:i.jsx(pW,{})}),i.jsx(Lc,{motionProps:nm,children:S&&i.jsx(eO,{imageDTO:S})})]})}),i.jsxs(nr,{isAttached:!0,isDisabled:o,children:[i.jsx(Fe,{icon:i.jsx(S6,{}),tooltip:`${h("parameters.usePrompt")} (P)`,"aria-label":`${h("parameters.usePrompt")} (P)`,isDisabled:!(_!=null&&_.positive_prompt),onClick:E}),i.jsx(Fe,{icon:i.jsx(C6,{}),tooltip:`${h("parameters.useSeed")} (S)`,"aria-label":`${h("parameters.useSeed")} (S)`,isDisabled:!(_!=null&&_.seed),onClick:P}),i.jsx(Fe,{icon:i.jsx(p6,{}),tooltip:`${h("parameters.useAll")} (A)`,"aria-label":`${h("parameters.useAll")} (A)`,isDisabled:!_,onClick:I})]}),d&&i.jsx(nr,{isAttached:!0,isDisabled:o,children:d&&i.jsx(Bne,{imageDTO:S})}),i.jsx(nr,{isAttached:!0,isDisabled:o,children:i.jsx(Fe,{icon:i.jsx(Lb,{}),tooltip:`${h("parameters.info")} (I)`,"aria-label":`${h("parameters.info")} (I)`,isChecked:s,onClick:T})}),i.jsx(nr,{isAttached:!0,children:i.jsx(Fe,{"aria-label":h("settings.displayInProgress"),tooltip:h("settings.displayInProgress"),icon:i.jsx(eW,{}),isChecked:c,onClick:A})}),i.jsx(nr,{isAttached:!0,children:i.jsx($ne,{onClick:M,isDisabled:o})})]})})},Wne=fe([Ye,N_],(e,t)=>{var k,_;const{data:n,status:r}=U7.endpoints.listImages.select(t)(e),o=e.gallery.selection[e.gallery.selection.length-1],s=r==="pending";if(!n||!o||n.total===0)return{isFetching:s,queryArgs:t,isOnFirstImage:!0,isOnLastImage:!0};const a={...t,offset:n.ids.length,limit:z_},c=G7.getSelectors(),d=c.selectAll(n),p=d.findIndex(I=>I.image_name===o),h=Es(p+1,0,d.length-1),m=Es(p-1,0,d.length-1),v=(k=d[h])==null?void 0:k.image_name,b=(_=d[m])==null?void 0:_.image_name,w=c.selectById(n,v),y=c.selectById(n,b),S=d.length;return{isOnFirstImage:p===0,isOnLastImage:!isNaN(p)&&p===S-1,areMoreImagesAvailable:((n==null?void 0:n.total)??0)>S,isFetching:r==="pending",nextImage:w,prevImage:y,nextImageId:v,prevImageId:b,queryArgs:a}},{memoizeOptions:{resultEqualityCheck:Jt}}),MO=()=>{const e=te(),{isOnFirstImage:t,isOnLastImage:n,nextImageId:r,prevImageId:o,areMoreImagesAvailable:s,isFetching:a,queryArgs:c}=L(Wne),d=f.useCallback(()=>{o&&e(gv(o))},[e,o]),p=f.useCallback(()=>{r&&e(gv(r))},[e,r]),[h]=$_(),m=f.useCallback(()=>{h(c)},[h,c]);return{handlePrevImage:d,handleNextImage:p,isOnFirstImage:t,isOnLastImage:n,nextImageId:r,prevImageId:o,areMoreImagesAvailable:s,handleLoadMoreImages:m,isFetching:a}};function Vne(e){return rt({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 ys=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>{const{t:a}=be();return t?i.jsxs(W,{gap:2,children:[n&&i.jsx(wn,{label:`Recall ${e}`,children:i.jsx(Ca,{"aria-label":a("accessibility.useThisParameter"),icon:i.jsx(Vne,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&i.jsx(wn,{label:`Copy ${e}`,children:i.jsx(Ca,{"aria-label":`Copy ${e}`,icon:i.jsx(Hc,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),i.jsxs(W,{direction:o?"column":"row",children:[i.jsxs(tt,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?i.jsxs(mb,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",i.jsx(sj,{mx:"2px"})]}):i.jsx(tt,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}):null},Une=e=>{const{metadata:t}=e,{recallPositivePrompt:n,recallNegativePrompt:r,recallSeed:o,recallCfgScale:s,recallModel:a,recallScheduler:c,recallSteps:d,recallWidth:p,recallHeight:h,recallStrength:m}=Ey(),v=f.useCallback(()=>{n(t==null?void 0:t.positive_prompt)},[t==null?void 0:t.positive_prompt,n]),b=f.useCallback(()=>{r(t==null?void 0:t.negative_prompt)},[t==null?void 0:t.negative_prompt,r]),w=f.useCallback(()=>{o(t==null?void 0:t.seed)},[t==null?void 0:t.seed,o]),y=f.useCallback(()=>{a(t==null?void 0:t.model)},[t==null?void 0:t.model,a]),S=f.useCallback(()=>{p(t==null?void 0:t.width)},[t==null?void 0:t.width,p]),k=f.useCallback(()=>{h(t==null?void 0:t.height)},[t==null?void 0:t.height,h]),_=f.useCallback(()=>{c(t==null?void 0:t.scheduler)},[t==null?void 0:t.scheduler,c]),I=f.useCallback(()=>{d(t==null?void 0:t.steps)},[t==null?void 0:t.steps,d]),P=f.useCallback(()=>{s(t==null?void 0:t.cfg_scale)},[t==null?void 0:t.cfg_scale,s]),E=f.useCallback(()=>{m(t==null?void 0:t.strength)},[t==null?void 0:t.strength,m]);return!t||Object.keys(t).length===0?null:i.jsxs(i.Fragment,{children:[t.generation_mode&&i.jsx(ys,{label:"Generation Mode",value:t.generation_mode}),t.positive_prompt&&i.jsx(ys,{label:"Positive Prompt",labelPosition:"top",value:t.positive_prompt,onClick:v}),t.negative_prompt&&i.jsx(ys,{label:"Negative Prompt",labelPosition:"top",value:t.negative_prompt,onClick:b}),t.seed!==void 0&&i.jsx(ys,{label:"Seed",value:t.seed,onClick:w}),t.model!==void 0&&i.jsx(ys,{label:"Model",value:t.model.model_name,onClick:y}),t.width&&i.jsx(ys,{label:"Width",value:t.width,onClick:S}),t.height&&i.jsx(ys,{label:"Height",value:t.height,onClick:k}),t.scheduler&&i.jsx(ys,{label:"Scheduler",value:t.scheduler,onClick:_}),t.steps&&i.jsx(ys,{label:"Steps",value:t.steps,onClick:I}),t.cfg_scale!==void 0&&i.jsx(ys,{label:"CFG scale",value:t.cfg_scale,onClick:P}),t.strength&&i.jsx(ys,{label:"Image to image strength",value:t.strength,onClick:E})]})},Gne=e=>{const{copyTooltip:t,jsonObject:n}=e,r=f.useMemo(()=>JSON.stringify(n,null,2),[n]);return i.jsxs(W,{sx:{borderRadius:"base",bg:"whiteAlpha.500",_dark:{bg:"blackAlpha.500"},flexGrow:1,w:"full",h:"full",position:"relative"},children:[i.jsx(Re,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"auto",p:4},children:i.jsx(Z6,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:i.jsx("pre",{children:r})})}),i.jsx(W,{sx:{position:"absolute",top:0,insetInlineEnd:0,p:2},children:i.jsx(wn,{label:t,children:i.jsx(Ca,{"aria-label":t,icon:i.jsx(Hc,{}),variant:"ghost",onClick:()=>navigator.clipboard.writeText(r)})})})]})},qne=({image:e})=>{const[t,n]=Ry(e.image_name,500),{currentData:r}=L1(n.isPending()?oo.skipToken:t??oo.skipToken),o=r==null?void 0:r.metadata,s=r==null?void 0:r.graph,a=f.useMemo(()=>{const c=[];return o&&c.push({label:"Core Metadata",data:o,copyTooltip:"Copy Core Metadata JSON"}),e&&c.push({label:"Image Details",data:e,copyTooltip:"Copy Image Details JSON"}),s&&c.push({label:"Graph",data:s,copyTooltip:"Copy Graph JSON"}),c},[o,s,e]);return i.jsxs(W,{sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",backdropFilter:"blur(20px)",bg:"baseAlpha.200",_dark:{bg:"blackAlpha.600"},borderRadius:"base",position:"absolute",overflow:"hidden"},children:[i.jsxs(W,{gap:2,children:[i.jsx(tt,{fontWeight:"semibold",children:"File:"}),i.jsxs(mb,{href:e.image_url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.image_name,i.jsx(sj,{mx:"2px"})]})]}),i.jsx(Une,{metadata:o}),i.jsxs(Id,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[i.jsx(Ed,{children:a.map(c=>i.jsx(wc,{sx:{borderTopRadius:"base"},children:i.jsx(tt,{sx:{color:"base.700",_dark:{color:"base.300"}},children:c.label})},c.label))}),i.jsx(km,{sx:{w:"full",h:"full"},children:a.map(c=>i.jsx(Cm,{sx:{w:"full",h:"full",p:0,pt:4},children:i.jsx(Gne,{jsonObject:c.data,copyTooltip:c.copyTooltip})},c.label))})]})]})},Kne=f.memo(qne),nv={color:"base.100",pointerEvents:"auto"},Yne=()=>{const{t:e}=be(),{handlePrevImage:t,handleNextImage:n,isOnFirstImage:r,isOnLastImage:o,handleLoadMoreImages:s,areMoreImagesAvailable:a,isFetching:c}=MO();return i.jsxs(Re,{sx:{position:"relative",height:"100%",width:"100%"},children:[i.jsx(Re,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineStart:0},children:!r&&i.jsx(Ca,{"aria-label":e("accessibility.previousImage"),icon:i.jsx($H,{size:64}),variant:"unstyled",onClick:t,boxSize:16,sx:nv})}),i.jsxs(Re,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineEnd:0},children:[!o&&i.jsx(Ca,{"aria-label":e("accessibility.nextImage"),icon:i.jsx(zH,{size:64}),variant:"unstyled",onClick:n,boxSize:16,sx:nv}),o&&a&&!c&&i.jsx(Ca,{"aria-label":e("accessibility.loadMore"),icon:i.jsx(NH,{size:64}),variant:"unstyled",onClick:s,boxSize:16,sx:nv}),o&&a&&c&&i.jsx(W,{sx:{w:16,h:16,alignItems:"center",justifyContent:"center"},children:i.jsx(dl,{opacity:.5,size:"xl"})})]})]})},Qne=f.memo(Yne),Xne=fe([Ye,q7],({ui:e,system:t},n)=>{const{shouldShowImageDetails:r,shouldHidePreview:o,shouldShowProgressInViewer:s}=e,{progressImage:a,shouldAntialiasProgressImage:c}=t;return{shouldShowImageDetails:r,shouldHidePreview:o,imageName:n,progressImage:a,shouldShowProgressInViewer:s,shouldAntialiasProgressImage:c}},{memoizeOptions:{resultEqualityCheck:Jt}}),Jne=()=>{const{shouldShowImageDetails:e,imageName:t,progressImage:n,shouldShowProgressInViewer:r,shouldAntialiasProgressImage:o}=L(Xne),{handlePrevImage:s,handleNextImage:a,prevImageId:c,nextImageId:d,isOnLastImage:p,handleLoadMoreImages:h,areMoreImagesAvailable:m,isFetching:v}=MO();nt("left",()=>{s()},[c]),nt("right",()=>{if(p&&m&&!v){h();return}p||a()},[d,p,m,h,v]);const{currentData:b}=os(t??oo.skipToken),w=f.useMemo(()=>{if(b)return{id:"current-image",payloadType:"IMAGE_DTO",payload:{imageDTO:b}}},[b]),y=f.useMemo(()=>({id:"current-image",actionType:"SET_CURRENT_IMAGE"}),[]),[S,k]=f.useState(!1),_=f.useRef(0),I=f.useCallback(()=>{k(!0),window.clearTimeout(_.current)},[]),P=f.useCallback(()=>{_.current=window.setTimeout(()=>{k(!1)},500)},[]);return i.jsxs(W,{onMouseOver:I,onMouseOut:P,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative"},children:[n&&r?i.jsx(Tc,{src:n.dataURL,width:n.width,height:n.height,draggable:!1,sx:{objectFit:"contain",maxWidth:"full",maxHeight:"full",height:"auto",position:"absolute",borderRadius:"base",imageRendering:o?"auto":"pixelated"}}):i.jsx(yi,{imageDTO:b,droppableData:y,draggableData:w,isUploadDisabled:!0,fitContainer:!0,useThumbailFallback:!0,dropLabel:"Set as Current Image",noContentFallback:i.jsx(mi,{icon:al,label:"No image selected"})}),e&&b&&i.jsx(Re,{sx:{position:"absolute",top:"0",width:"full",height:"full",borderRadius:"base"},children:i.jsx(Kne,{image:b})}),i.jsx(Fo,{children:!e&&b&&S&&i.jsx(Yr.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:i.jsx(Qne,{})},"nextPrevButtons")})]})},Zne=f.memo(Jne),ere=()=>i.jsxs(W,{sx:{position:"relative",flexDirection:"column",height:"100%",width:"100%",rowGap:4,alignItems:"center",justifyContent:"center"},children:[i.jsx(Hne,{}),i.jsx(Zne,{})]}),DO=()=>i.jsx(Re,{layerStyle:"first",sx:{position:"relative",width:"100%",height:"100%",p:4,borderRadius:"base"},children:i.jsx(W,{sx:{width:"100%",height:"100%"},children:i.jsx(ere,{})})}),tre=e=>{const t=te(),{lora:n}=e,r=f.useCallback(a=>{t(K7({id:n.id,weight:a}))},[t,n.id]),o=f.useCallback(()=>{t(Y7(n.id))},[t,n.id]),s=f.useCallback(()=>{t(Q7(n.id))},[t,n.id]);return i.jsxs(W,{sx:{gap:2.5,alignItems:"flex-end"},children:[i.jsx(_t,{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}}),i.jsx(Fe,{size:"sm",onClick:s,tooltip:"Remove LoRA","aria-label":"Remove LoRA",icon:i.jsx(us,{}),colorScheme:"error"})]})},nre=f.memo(tre),rre=fe(Ye,({lora:e})=>{const{loras:t}=e;return{loras:t}},Ge),ore=()=>{const{loras:e}=L(rre);return i.jsx(i.Fragment,{children:cs(e,t=>i.jsx(nre,{lora:t},t.model_name))})},sre=fe(Ye,({lora:e})=>({loras:e.loras}),Ge),are=()=>{const e=te(),{loras:t}=L(sre),{data:n}=q_(),r=L(a=>a.generation.model),o=f.useMemo(()=>{if(!n)return[];const a=[];return so(n.entities,(c,d)=>{if(!c||d in t)return;const p=(r==null?void 0:r.base_model)!==c.base_model;a.push({value:d,label:c.model_name,disabled:p,group:sr[c.base_model],tooltip:p?`Incompatible base model: ${c.base_model}`:void 0})}),a.sort((c,d)=>{var p;return c.label&&d.label&&(p=c.label)!=null&&p.localeCompare(d.label)?1:-1}),a.sort((c,d)=>c.disabled&&!d.disabled?-1:1)},[t,n,r==null?void 0:r.base_model]),s=f.useCallback(a=>{if(!a)return;const c=n==null?void 0:n.entities[a];c&&e(X7(c))},[e,n==null?void 0:n.entities]);return(n==null?void 0:n.ids.length)===0?i.jsx(W,{sx:{justifyContent:"center",p:2},children:i.jsx(tt,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):i.jsx(ar,{placeholder:o.length===0?"All LoRAs added":"Add LoRA",value:null,data:o,nothingFound:"No matching LoRAs",itemComponent:Oi,disabled:o.length===0,filter:(a,c)=>{var d;return((d=c.label)==null?void 0:d.toLowerCase().includes(a.toLowerCase().trim()))||c.value.toLowerCase().includes(a.toLowerCase().trim())},onChange:s})},ire=fe(Ye,e=>{const t=K_(e.lora.loras);return{activeLabel:t>0?`${t} Active`:void 0}},Ge),lre=()=>{const{activeLabel:e}=L(ire);return ir("lora").isFeatureEnabled?i.jsx(Oo,{label:"LoRA",activeLabel:e,children:i.jsxs(W,{sx:{flexDir:"column",gap:2},children:[i.jsx(are,{}),i.jsx(ore,{})]})}):null},By=f.memo(lre);function cre(){const e=L(d=>d.generation.clipSkip),{model:t}=L(d=>d.generation),n=te(),{t:r}=be(),o=f.useCallback(d=>{n(Z2(d))},[n]),s=f.useCallback(()=>{n(Z2(0))},[n]),a=f.useMemo(()=>t?Of[t.base_model].maxClip:Of["sd-1"].maxClip,[t]),c=f.useMemo(()=>t?Of[t.base_model].markers:Of["sd-1"].markers,[t]);return i.jsx(_t,{label:r("parameters.clipSkip"),"aria-label":r("parameters.clipSkip"),min:0,max:a,step:1,value:e,onChange:o,withSliderMarks:!0,sliderMarks:c,withInput:!0,withReset:!0,handleReset:s})}const ure=fe(Ye,e=>({activeLabel:e.generation.clipSkip>0?"Clip Skip":void 0}),Ge);function Fy(){const{activeLabel:e}=L(ure);return L(n=>n.generation.shouldShowAdvancedOptions)?i.jsx(Oo,{label:"Advanced",activeLabel:e,children:i.jsx(W,{sx:{flexDir:"column",gap:2},children:i.jsx(cre,{})})}):null}const TO=e=>{const t=tm("models"),[n,r,o]=e.split("/"),s=J7.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},dre=e=>{const{controlNetId:t}=e,n=te(),r=L(jr),o=f.useMemo(()=>fe(Ye,({generation:v,controlNet:b})=>{var k,_;const{model:w}=v,y=(k=b.controlNets[t])==null?void 0:k.model,S=(_=b.controlNets[t])==null?void 0:_.isEnabled;return{mainModel:w,controlNetModel:y,isEnabled:S}},Ge),[t]),{mainModel:s,controlNetModel:a,isEnabled:c}=L(o),{data:d}=U1(),p=f.useMemo(()=>{if(!d)return[];const v=[];return so(d.entities,(b,w)=>{if(!b)return;const y=(b==null?void 0:b.base_model)!==(s==null?void 0:s.base_model);v.push({value:w,label:b.model_name,group:sr[b.base_model],disabled:y,tooltip:y?`Incompatible base model: ${b.base_model}`:void 0})}),v},[d,s==null?void 0:s.base_model]),h=f.useMemo(()=>(d==null?void 0:d.entities[`${a==null?void 0:a.base_model}/controlnet/${a==null?void 0:a.model_name}`])??null,[a==null?void 0:a.base_model,a==null?void 0:a.model_name,d==null?void 0:d.entities]),m=f.useCallback(v=>{if(!v)return;const b=TO(v);b&&n(Y_({controlNetId:t,model:b}))},[t,n]);return i.jsx(ar,{itemComponent:Oi,data:p,error:!h||(s==null?void 0:s.base_model)!==h.base_model,placeholder:"Select a model",value:(h==null?void 0:h.id)??null,onChange:m,disabled:r||!c,tooltip:h==null?void 0:h.description})},fre=f.memo(dre),pre=e=>{const{controlNetId:t}=e,n=te(),r=f.useMemo(()=>fe(Ye,({controlNet:c})=>{const{weight:d,isEnabled:p}=c.controlNets[t];return{weight:d,isEnabled:p}},Ge),[t]),{weight:o,isEnabled:s}=L(r),a=f.useCallback(c=>{n(Z7({controlNetId:t,weight:c}))},[t,n]);return i.jsx(_t,{isDisabled:!s,label:"Weight",value:o,onChange:a,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2]})},hre=f.memo(pre),mre=e=>{const{height:t,controlNetId:n}=e,r=te(),o=f.useMemo(()=>fe(Ye,({controlNet:E})=>{const{pendingControlImages:O}=E,{controlImage:R,processedControlImage:M,processorType:T,isEnabled:A}=E.controlNets[n];return{controlImageName:R,processedControlImageName:M,processorType:T,isEnabled:A,pendingControlImages:O}},Ge),[n]),{controlImageName:s,processedControlImageName:a,processorType:c,pendingControlImages:d,isEnabled:p}=L(o),[h,m]=f.useState(!1),{currentData:v}=os(s??oo.skipToken),{currentData:b}=os(a??oo.skipToken),w=f.useCallback(()=>{r(eM({controlNetId:n,controlImage:null}))},[n,r]),y=f.useCallback(()=>{m(!0)},[]),S=f.useCallback(()=>{m(!1)},[]),k=f.useMemo(()=>{if(v)return{id:n,payloadType:"IMAGE_DTO",payload:{imageDTO:v}}},[v,n]),_=f.useMemo(()=>({id:n,actionType:"SET_CONTROLNET_IMAGE",context:{controlNetId:n}}),[n]),I=f.useMemo(()=>({type:"SET_CONTROLNET_IMAGE",controlNetId:n}),[n]),P=v&&b&&!h&&!d.includes(n)&&c!=="none";return i.jsxs(W,{onMouseEnter:y,onMouseLeave:S,sx:{position:"relative",w:"full",h:t,alignItems:"center",justifyContent:"center",pointerEvents:p?"auto":"none",opacity:p?1:.5},children:[i.jsx(yi,{draggableData:k,droppableData:_,imageDTO:v,isDropDisabled:P||!p,onClickReset:w,postUploadAction:I,resetTooltip:"Reset Control Image",withResetIcon:!!v}),i.jsx(Re,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",opacity:P?1:0,transitionProperty:"common",transitionDuration:"normal",pointerEvents:"none"},children:i.jsx(yi,{draggableData:k,droppableData:_,imageDTO:b,isUploadDisabled:!0,isDropDisabled:!p,onClickReset:w,resetTooltip:"Reset Control Image",withResetIcon:!!v})}),d.includes(n)&&i.jsx(W,{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:i.jsx(dl,{size:"xl",sx:{color:"base.100",_dark:{color:"base.400"}}})})]})},wk=f.memo(mre),As=()=>{const e=te();return f.useCallback((n,r)=>{e(tM({controlNetId:n,changes:r}))},[e])};function Ns(e){return i.jsx(W,{sx:{flexDirection:"column",gap:2},children:e.children})}const Sk=ls.canny_image_processor.default,gre=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{low_threshold:o,high_threshold:s}=n,a=L(jr),c=As(),d=f.useCallback(v=>{c(t,{low_threshold:v})},[t,c]),p=f.useCallback(()=>{c(t,{low_threshold:Sk.low_threshold})},[t,c]),h=f.useCallback(v=>{c(t,{high_threshold:v})},[t,c]),m=f.useCallback(()=>{c(t,{high_threshold:Sk.high_threshold})},[t,c]);return i.jsxs(Ns,{children:[i.jsx(_t,{isDisabled:a||!r,label:"Low Threshold",value:o,onChange:d,handleReset:p,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0}),i.jsx(_t,{isDisabled:a||!r,label:"High Threshold",value:s,onChange:h,handleReset:m,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0})]})},vre=f.memo(gre),yu=ls.content_shuffle_image_processor.default,bre=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,w:a,h:c,f:d}=n,p=As(),h=L(jr),m=f.useCallback(E=>{p(t,{detect_resolution:E})},[t,p]),v=f.useCallback(()=>{p(t,{detect_resolution:yu.detect_resolution})},[t,p]),b=f.useCallback(E=>{p(t,{image_resolution:E})},[t,p]),w=f.useCallback(()=>{p(t,{image_resolution:yu.image_resolution})},[t,p]),y=f.useCallback(E=>{p(t,{w:E})},[t,p]),S=f.useCallback(()=>{p(t,{w:yu.w})},[t,p]),k=f.useCallback(E=>{p(t,{h:E})},[t,p]),_=f.useCallback(()=>{p(t,{h:yu.h})},[t,p]),I=f.useCallback(E=>{p(t,{f:E})},[t,p]),P=f.useCallback(()=>{p(t,{f:yu.f})},[t,p]);return i.jsxs(Ns,{children:[i.jsx(_t,{label:"Detect Resolution",value:s,onChange:m,handleReset:v,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:h||!r}),i.jsx(_t,{label:"Image Resolution",value:o,onChange:b,handleReset:w,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:h||!r}),i.jsx(_t,{label:"W",value:a,onChange:y,handleReset:S,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:h||!r}),i.jsx(_t,{label:"H",value:c,onChange:k,handleReset:_,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:h||!r}),i.jsx(_t,{label:"F",value:d,onChange:I,handleReset:P,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:h||!r})]})},yre=f.memo(bre),Ck=ls.hed_image_processor.default,xre=e=>{const{controlNetId:t,processorNode:{detect_resolution:n,image_resolution:r,scribble:o},isEnabled:s}=e,a=L(jr),c=As(),d=f.useCallback(b=>{c(t,{detect_resolution:b})},[t,c]),p=f.useCallback(b=>{c(t,{image_resolution:b})},[t,c]),h=f.useCallback(b=>{c(t,{scribble:b.target.checked})},[t,c]),m=f.useCallback(()=>{c(t,{detect_resolution:Ck.detect_resolution})},[t,c]),v=f.useCallback(()=>{c(t,{image_resolution:Ck.image_resolution})},[t,c]);return i.jsxs(Ns,{children:[i.jsx(_t,{label:"Detect Resolution",value:n,onChange:d,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:a||!s}),i.jsx(_t,{label:"Image Resolution",value:r,onChange:p,handleReset:v,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:a||!s}),i.jsx(Pr,{label:"Scribble",isChecked:o,onChange:h,isDisabled:a||!s})]})},wre=f.memo(xre),kk=ls.lineart_anime_image_processor.default,Sre=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,a=As(),c=L(jr),d=f.useCallback(v=>{a(t,{detect_resolution:v})},[t,a]),p=f.useCallback(v=>{a(t,{image_resolution:v})},[t,a]),h=f.useCallback(()=>{a(t,{detect_resolution:kk.detect_resolution})},[t,a]),m=f.useCallback(()=>{a(t,{image_resolution:kk.image_resolution})},[t,a]);return i.jsxs(Ns,{children:[i.jsx(_t,{label:"Detect Resolution",value:s,onChange:d,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:c||!r}),i.jsx(_t,{label:"Image Resolution",value:o,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:c||!r})]})},Cre=f.memo(Sre),_k=ls.lineart_image_processor.default,kre=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,coarse:a}=n,c=As(),d=L(jr),p=f.useCallback(w=>{c(t,{detect_resolution:w})},[t,c]),h=f.useCallback(w=>{c(t,{image_resolution:w})},[t,c]),m=f.useCallback(()=>{c(t,{detect_resolution:_k.detect_resolution})},[t,c]),v=f.useCallback(()=>{c(t,{image_resolution:_k.image_resolution})},[t,c]),b=f.useCallback(w=>{c(t,{coarse:w.target.checked})},[t,c]);return i.jsxs(Ns,{children:[i.jsx(_t,{label:"Detect Resolution",value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:d||!r}),i.jsx(_t,{label:"Image Resolution",value:o,onChange:h,handleReset:v,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:d||!r}),i.jsx(Pr,{label:"Coarse",isChecked:a,onChange:b,isDisabled:d||!r})]})},_re=f.memo(kre),Pk=ls.mediapipe_face_processor.default,Pre=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{max_faces:o,min_confidence:s}=n,a=As(),c=L(jr),d=f.useCallback(v=>{a(t,{max_faces:v})},[t,a]),p=f.useCallback(v=>{a(t,{min_confidence:v})},[t,a]),h=f.useCallback(()=>{a(t,{max_faces:Pk.max_faces})},[t,a]),m=f.useCallback(()=>{a(t,{min_confidence:Pk.min_confidence})},[t,a]);return i.jsxs(Ns,{children:[i.jsx(_t,{label:"Max Faces",value:o,onChange:d,handleReset:h,withReset:!0,min:1,max:20,withInput:!0,withSliderMarks:!0,isDisabled:c||!r}),i.jsx(_t,{label:"Min Confidence",value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:c||!r})]})},jre=f.memo(Pre),jk=ls.midas_depth_image_processor.default,Ire=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{a_mult:o,bg_th:s}=n,a=As(),c=L(jr),d=f.useCallback(v=>{a(t,{a_mult:v})},[t,a]),p=f.useCallback(v=>{a(t,{bg_th:v})},[t,a]),h=f.useCallback(()=>{a(t,{a_mult:jk.a_mult})},[t,a]),m=f.useCallback(()=>{a(t,{bg_th:jk.bg_th})},[t,a]);return i.jsxs(Ns,{children:[i.jsx(_t,{label:"a_mult",value:o,onChange:d,handleReset:h,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:c||!r}),i.jsx(_t,{label:"bg_th",value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:c||!r})]})},Ere=f.memo(Ire),mp=ls.mlsd_image_processor.default,Ore=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,thr_d:a,thr_v:c}=n,d=As(),p=L(jr),h=f.useCallback(_=>{d(t,{detect_resolution:_})},[t,d]),m=f.useCallback(_=>{d(t,{image_resolution:_})},[t,d]),v=f.useCallback(_=>{d(t,{thr_d:_})},[t,d]),b=f.useCallback(_=>{d(t,{thr_v:_})},[t,d]),w=f.useCallback(()=>{d(t,{detect_resolution:mp.detect_resolution})},[t,d]),y=f.useCallback(()=>{d(t,{image_resolution:mp.image_resolution})},[t,d]),S=f.useCallback(()=>{d(t,{thr_d:mp.thr_d})},[t,d]),k=f.useCallback(()=>{d(t,{thr_v:mp.thr_v})},[t,d]);return i.jsxs(Ns,{children:[i.jsx(_t,{label:"Detect Resolution",value:s,onChange:h,handleReset:w,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:p||!r}),i.jsx(_t,{label:"Image Resolution",value:o,onChange:m,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:p||!r}),i.jsx(_t,{label:"W",value:a,onChange:v,handleReset:S,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:p||!r}),i.jsx(_t,{label:"H",value:c,onChange:b,handleReset:k,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:p||!r})]})},Rre=f.memo(Ore),Ik=ls.normalbae_image_processor.default,Mre=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,a=As(),c=L(jr),d=f.useCallback(v=>{a(t,{detect_resolution:v})},[t,a]),p=f.useCallback(v=>{a(t,{image_resolution:v})},[t,a]),h=f.useCallback(()=>{a(t,{detect_resolution:Ik.detect_resolution})},[t,a]),m=f.useCallback(()=>{a(t,{image_resolution:Ik.image_resolution})},[t,a]);return i.jsxs(Ns,{children:[i.jsx(_t,{label:"Detect Resolution",value:s,onChange:d,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:c||!r}),i.jsx(_t,{label:"Image Resolution",value:o,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:c||!r})]})},Dre=f.memo(Mre),Ek=ls.openpose_image_processor.default,Tre=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,hand_and_face:a}=n,c=As(),d=L(jr),p=f.useCallback(w=>{c(t,{detect_resolution:w})},[t,c]),h=f.useCallback(w=>{c(t,{image_resolution:w})},[t,c]),m=f.useCallback(()=>{c(t,{detect_resolution:Ek.detect_resolution})},[t,c]),v=f.useCallback(()=>{c(t,{image_resolution:Ek.image_resolution})},[t,c]),b=f.useCallback(w=>{c(t,{hand_and_face:w.target.checked})},[t,c]);return i.jsxs(Ns,{children:[i.jsx(_t,{label:"Detect Resolution",value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:d||!r}),i.jsx(_t,{label:"Image Resolution",value:o,onChange:h,handleReset:v,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:d||!r}),i.jsx(Pr,{label:"Hand and Face",isChecked:a,onChange:b,isDisabled:d||!r})]})},Are=f.memo(Tre),Ok=ls.pidi_image_processor.default,Nre=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,scribble:a,safe:c}=n,d=As(),p=L(jr),h=f.useCallback(S=>{d(t,{detect_resolution:S})},[t,d]),m=f.useCallback(S=>{d(t,{image_resolution:S})},[t,d]),v=f.useCallback(()=>{d(t,{detect_resolution:Ok.detect_resolution})},[t,d]),b=f.useCallback(()=>{d(t,{image_resolution:Ok.image_resolution})},[t,d]),w=f.useCallback(S=>{d(t,{scribble:S.target.checked})},[t,d]),y=f.useCallback(S=>{d(t,{safe:S.target.checked})},[t,d]);return i.jsxs(Ns,{children:[i.jsx(_t,{label:"Detect Resolution",value:s,onChange:h,handleReset:v,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:p||!r}),i.jsx(_t,{label:"Image Resolution",value:o,onChange:m,handleReset:b,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:p||!r}),i.jsx(Pr,{label:"Scribble",isChecked:a,onChange:w}),i.jsx(Pr,{label:"Safe",isChecked:c,onChange:y,isDisabled:p||!r})]})},$re=f.memo(Nre),zre=e=>null,Lre=f.memo(zre),Bre=e=>{const{controlNetId:t}=e,n=f.useMemo(()=>fe(Ye,({controlNet:s})=>{const{isEnabled:a,processorNode:c}=s.controlNets[t];return{isEnabled:a,processorNode:c}},Ge),[t]),{isEnabled:r,processorNode:o}=L(n);return o.type==="canny_image_processor"?i.jsx(vre,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="hed_image_processor"?i.jsx(wre,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="lineart_image_processor"?i.jsx(_re,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="content_shuffle_image_processor"?i.jsx(yre,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="lineart_anime_image_processor"?i.jsx(Cre,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="mediapipe_face_processor"?i.jsx(jre,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="midas_depth_image_processor"?i.jsx(Ere,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="mlsd_image_processor"?i.jsx(Rre,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="normalbae_image_processor"?i.jsx(Dre,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="openpose_image_processor"?i.jsx(Are,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="pidi_image_processor"?i.jsx($re,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="zoe_depth_image_processor"?i.jsx(Lre,{controlNetId:t,processorNode:o,isEnabled:r}):null},Fre=f.memo(Bre),Hre=e=>{const{controlNetId:t}=e,n=te(),r=f.useMemo(()=>fe(Ye,({controlNet:d})=>{const{isEnabled:p,shouldAutoConfig:h}=d.controlNets[t];return{isEnabled:p,shouldAutoConfig:h}},Ge),[t]),{isEnabled:o,shouldAutoConfig:s}=L(r),a=L(jr),c=f.useCallback(()=>{n(nM({controlNetId:t}))},[t,n]);return i.jsx(Pr,{label:"Auto configure processor","aria-label":"Auto configure processor",isChecked:s,onChange:c,isDisabled:a||!o})},Wre=f.memo(Hre),Rk=e=>`${Math.round(e*100)}%`,Vre=e=>{const{controlNetId:t}=e,n=te(),r=f.useMemo(()=>fe(Ye,({controlNet:d})=>{const{beginStepPct:p,endStepPct:h,isEnabled:m}=d.controlNets[t];return{beginStepPct:p,endStepPct:h,isEnabled:m}},Ge),[t]),{beginStepPct:o,endStepPct:s,isEnabled:a}=L(r),c=f.useCallback(d=>{n(rM({controlNetId:t,beginStepPct:d[0]})),n(oM({controlNetId:t,endStepPct:d[1]}))},[t,n]);return i.jsxs(mo,{isDisabled:!a,children:[i.jsx(zo,{children:"Begin / End Step Percentage"}),i.jsx(di,{w:"100%",gap:2,alignItems:"center",children:i.jsxs(NP,{"aria-label":["Begin Step %","End Step %"],value:[o,s],onChange:c,min:0,max:1,step:.01,minStepsBetweenThumbs:5,isDisabled:!a,children:[i.jsx($P,{children:i.jsx(zP,{})}),i.jsx(wn,{label:Rk(o),placement:"top",hasArrow:!0,children:i.jsx(Hv,{index:0})}),i.jsx(wn,{label:Rk(s),placement:"top",hasArrow:!0,children:i.jsx(Hv,{index:1})}),i.jsx(kp,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),i.jsx(kp,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),i.jsx(kp,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})},Ure=f.memo(Vre),Gre=[{label:"Balanced",value:"balanced"},{label:"Prompt",value:"more_prompt"},{label:"Control",value:"more_control"},{label:"Mega Control",value:"unbalanced"}];function qre(e){const{controlNetId:t}=e,n=te(),r=f.useMemo(()=>fe(Ye,({controlNet:c})=>{const{controlMode:d,isEnabled:p}=c.controlNets[t];return{controlMode:d,isEnabled:p}},Ge),[t]),{controlMode:o,isEnabled:s}=L(r),a=f.useCallback(c=>{n(sM({controlNetId:t,controlMode:c}))},[t,n]);return i.jsx(Kr,{disabled:!s,label:"Control Mode",data:Gre,value:String(o),onChange:a})}const Kre=fe(cO,e=>cs(ls,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)),Ge),Yre=e=>{const t=te(),{controlNetId:n}=e,r=f.useMemo(()=>fe(Ye,({controlNet:p})=>{const{isEnabled:h,processorNode:m}=p.controlNets[n];return{isEnabled:h,processorNode:m}},Ge),[n]),o=L(jr),s=L(Kre),{isEnabled:a,processorNode:c}=L(r),d=f.useCallback(p=>{t(aM({controlNetId:n,processorType:p}))},[n,t]);return i.jsx(ar,{label:"Processor",value:c.type??"canny_image_processor",data:s,onChange:d,disabled:o||!a})},Qre=f.memo(Yre),Xre=[{label:"Resize",value:"just_resize"},{label:"Crop",value:"crop_resize"},{label:"Fill",value:"fill_resize"}];function Jre(e){const{controlNetId:t}=e,n=te(),r=f.useMemo(()=>fe(Ye,({controlNet:c})=>{const{resizeMode:d,isEnabled:p}=c.controlNets[t];return{resizeMode:d,isEnabled:p}},Ge),[t]),{resizeMode:o,isEnabled:s}=L(r),a=f.useCallback(c=>{n(iM({controlNetId:t,resizeMode:c}))},[t,n]);return i.jsx(Kr,{disabled:!s,label:"Resize Mode",data:Xre,value:String(o),onChange:a})}const Zre=e=>{const{controlNetId:t}=e,n=te(),r=fe(Ye,({controlNet:m})=>{const{isEnabled:v,shouldAutoConfig:b}=m.controlNets[t];return{isEnabled:v,shouldAutoConfig:b}},Ge),{isEnabled:o,shouldAutoConfig:s}=L(r),[a,c]=nee(!1),d=f.useCallback(()=>{n(lM({controlNetId:t}))},[t,n]),p=f.useCallback(()=>{n(cM({sourceControlNetId:t,newControlNetId:ui()}))},[t,n]),h=f.useCallback(()=>{n(uM({controlNetId:t}))},[t,n]);return i.jsxs(W,{sx:{flexDir:"column",gap:3,p:3,borderRadius:"base",position:"relative",bg:"base.200",_dark:{bg:"base.850"}},children:[i.jsxs(W,{sx:{gap:2,alignItems:"center"},children:[i.jsx(Pr,{tooltip:"Toggle this ControlNet","aria-label":"Toggle this ControlNet",isChecked:o,onChange:h}),i.jsx(Re,{sx:{w:"full",minW:0,opacity:o?1:.5,pointerEvents:o?"auto":"none",transitionProperty:"common",transitionDuration:"0.1s"},children:i.jsx(fre,{controlNetId:t})}),i.jsx(Fe,{size:"sm",tooltip:"Duplicate","aria-label":"Duplicate",onClick:p,icon:i.jsx(Hc,{})}),i.jsx(Fe,{size:"sm",tooltip:"Delete","aria-label":"Delete",colorScheme:"error",onClick:d,icon:i.jsx(us,{})}),i.jsx(Fe,{size:"sm",tooltip:a?"Hide Advanced":"Show Advanced","aria-label":a?"Hide Advanced":"Show Advanced",onClick:c,variant:"ghost",sx:{_hover:{bg:"none"}},icon:i.jsx(ay,{sx:{boxSize:4,color:"base.700",transform:a?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal",_dark:{color:"base.300"}}})}),!s&&i.jsx(Re,{sx:{position:"absolute",w:1.5,h:1.5,borderRadius:"full",top:4,insetInlineEnd:4,bg:"accent.700",_dark:{bg:"accent.400"}}})]}),i.jsxs(W,{sx:{w:"full",flexDirection:"column",gap:3},children:[i.jsxs(W,{sx:{gap:4,w:"full",alignItems:"center"},children:[i.jsxs(W,{sx:{flexDir:"column",gap:3,h:28,w:"full",paddingInlineStart:1,paddingInlineEnd:a?1:0,pb:2,justifyContent:"space-between"},children:[i.jsx(hre,{controlNetId:t}),i.jsx(Ure,{controlNetId:t})]}),!a&&i.jsx(W,{sx:{alignItems:"center",justifyContent:"center",h:28,w:28,aspectRatio:"1/1"},children:i.jsx(wk,{controlNetId:t,height:28})})]}),i.jsxs(W,{sx:{gap:2},children:[i.jsx(qre,{controlNetId:t}),i.jsx(Jre,{controlNetId:t})]}),i.jsx(Qre,{controlNetId:t})]}),a&&i.jsxs(i.Fragment,{children:[i.jsx(wk,{controlNetId:t,height:"392px"}),i.jsx(Wre,{controlNetId:t}),i.jsx(Fre,{controlNetId:t})]})]})},eoe=f.memo(Zre),toe=fe(Ye,e=>{const{isEnabled:t}=e.controlNet;return{isEnabled:t}},Ge),noe=()=>{const{isEnabled:e}=L(toe),t=te(),n=f.useCallback(()=>{t(dM())},[t]);return i.jsx(Pr,{label:"Enable ControlNet",isChecked:e,onChange:n,formControlProps:{width:"100%"}})},roe=fe([Ye],({controlNet:e})=>{const{controlNets:t,isEnabled:n}=e,r=fM(t),o=n&&r.length>0?`${r.length} Active`:void 0;return{controlNetsArray:cs(t),activeLabel:o}},Ge),ooe=()=>{const{controlNetsArray:e,activeLabel:t}=L(roe),n=ir("controlNet").isFeatureDisabled,r=te(),{firstModel:o}=U1(void 0,{selectFromResult:a=>{var d,p;return{firstModel:(p=a.data)==null?void 0:p.entities[(d=a.data)==null?void 0:d.ids[0]]}}}),s=f.useCallback(()=>{if(!o)return;const a=ui();r(pM({controlNetId:a})),r(Y_({controlNetId:a,model:o}))},[r,o]);return n?null:i.jsx(Oo,{label:"ControlNet",activeLabel:t,children:i.jsxs(W,{sx:{flexDir:"column",gap:3},children:[i.jsxs(W,{gap:2,alignItems:"center",children:[i.jsx(W,{sx:{flexDirection:"column",w:"100%",gap:2,px:4,py:2,borderRadius:4,bg:"base.200",_dark:{bg:"base.850"}},children:i.jsx(noe,{})}),i.jsx(Fe,{tooltip:"Add ControlNet","aria-label":"Add ControlNet",icon:i.jsx(ml,{}),isDisabled:!o,flexGrow:1,size:"md",onClick:s})]}),e.map((a,c)=>i.jsxs(f.Fragment,{children:[c>0&&i.jsx(hl,{}),i.jsx(eoe,{controlNetId:a.controlNetId})]},a.controlNetId))]})})},Hy=f.memo(ooe),soe=fe(Mi,e=>{const{seamlessXAxis:t}=e;return{seamlessXAxis:t}},Ge),aoe=()=>{const{t:e}=be(),{seamlessXAxis:t}=L(soe),n=te(),r=f.useCallback(o=>{n(hM(o.target.checked))},[n]);return i.jsx(Pr,{label:e("parameters.seamlessXAxis"),"aria-label":e("parameters.seamlessXAxis"),isChecked:t,onChange:r})},ioe=f.memo(aoe),loe=fe(Mi,e=>{const{seamlessYAxis:t}=e;return{seamlessYAxis:t}},Ge),coe=()=>{const{t:e}=be(),{seamlessYAxis:t}=L(loe),n=te(),r=f.useCallback(o=>{n(mM(o.target.checked))},[n]);return i.jsx(Pr,{label:e("parameters.seamlessYAxis"),"aria-label":e("parameters.seamlessYAxis"),isChecked:t,onChange:r})},uoe=f.memo(coe),doe=(e,t)=>{if(e&&t)return"X & Y";if(e)return"X";if(t)return"Y"},foe=fe(Mi,e=>{const{seamlessXAxis:t,seamlessYAxis:n}=e;return{activeLabel:doe(t,n)}},Ge),poe=()=>{const{t:e}=be(),{activeLabel:t}=L(foe);return ir("seamless").isFeatureEnabled?i.jsx(Oo,{label:e("parameters.seamlessTiling"),activeLabel:t,children:i.jsxs(W,{sx:{gap:5},children:[i.jsx(Re,{flexGrow:1,children:i.jsx(ioe,{})}),i.jsx(Re,{flexGrow:1,children:i.jsx(uoe,{})})]})}):null},AO=f.memo(poe);function hoe(){const e=L(o=>o.generation.horizontalSymmetrySteps),t=L(o=>o.generation.steps),n=te(),{t:r}=be();return i.jsx(_t,{label:r("parameters.hSymmetryStep"),value:e,onChange:o=>n(ew(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(ew(0))})}function moe(){const e=L(o=>o.generation.verticalSymmetrySteps),t=L(o=>o.generation.steps),n=te(),{t:r}=be();return i.jsx(_t,{label:r("parameters.vSymmetryStep"),value:e,onChange:o=>n(tw(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(tw(0))})}function goe(){const e=L(n=>n.generation.shouldUseSymmetry),t=te();return i.jsx(Pr,{label:"Enable Symmetry",isChecked:e,onChange:n=>t(gM(n.target.checked))})}const voe=fe(Ye,e=>({activeLabel:e.generation.shouldUseSymmetry?"Enabled":void 0}),Ge),boe=()=>{const{t:e}=be(),{activeLabel:t}=L(voe);return ir("symmetry").isFeatureEnabled?i.jsx(Oo,{label:e("parameters.symmetry"),activeLabel:t,children:i.jsxs(W,{sx:{gap:2,flexDirection:"column"},children:[i.jsx(goe,{}),i.jsx(hoe,{}),i.jsx(moe,{})]})}):null},Wy=f.memo(boe),yoe=fe([Ye],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:a,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:a,step:h}},Ge),xoe=()=>{const{img2imgStrength:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s}=L(yoe),a=te(),{t:c}=be(),d=f.useCallback(h=>a(Tp(h)),[a]),p=f.useCallback(()=>{a(Tp(t))},[a,t]);return i.jsx(_t,{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}})},NO=f.memo(xoe),woe=fe([La,Mi],(e,t)=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},Ge),Soe=()=>{const{shouldUseSliders:e,activeLabel:t}=L(woe);return i.jsx(Oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:i.jsxs(W,{sx:{flexDirection:"column",gap:3},children:[e?i.jsxs(i.Fragment,{children:[i.jsx(wi,{}),i.jsx(Ci,{}),i.jsx(xi,{}),i.jsx(Si,{}),i.jsx(Re,{pt:2,children:i.jsx(ki,{})}),i.jsx(Ic,{})]}):i.jsxs(i.Fragment,{children:[i.jsxs(W,{gap:3,children:[i.jsx(wi,{}),i.jsx(Ci,{}),i.jsx(xi,{})]}),i.jsx(Si,{}),i.jsx(Re,{pt:2,children:i.jsx(ki,{})}),i.jsx(Ic,{})]}),i.jsx(NO,{}),i.jsx(EO,{})]})})},Coe=f.memo(Soe),$O=()=>i.jsxs(i.Fragment,{children:[i.jsx(Fd,{}),i.jsx(Ld,{}),i.jsx(Hd,{}),i.jsx(Coe,{}),i.jsx(Hy,{}),i.jsx(By,{}),i.jsx(zd,{}),i.jsx(Qm,{}),i.jsx(Wy,{}),i.jsx(AO,{}),i.jsx(Fy,{})]}),koe=()=>{const e=te(),t=f.useRef(null),n=L(o=>o.generation.model),r=f.useCallback(()=>{t.current&&t.current.setLayout([50,50])},[]);return i.jsxs(W,{sx:{gap:4,w:"full",h:"full"},children:[i.jsx(Ly,{children:n&&n.base_model==="sdxl"?i.jsx(Mne,{}):i.jsx($O,{})}),i.jsx(Re,{sx:{w:"full",h:"full"},children:i.jsxs(Ay,{ref:t,autoSaveId:"imageTab.content",direction:"horizontal",style:{height:"100%",width:"100%"},children:[i.jsx(ad,{id:"imageTab.content.initImage",order:0,defaultSize:50,minSize:25,style:{position:"relative"},children:i.jsx(Qee,{})}),i.jsx(RO,{onDoubleClick:r}),i.jsx(ad,{id:"imageTab.content.selectedImage",order:1,defaultSize:50,minSize:25,onResize:()=>{e(Co())},children:i.jsx(DO,{})})]})})]})},_oe=f.memo(koe);var Poe=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 a=s[o];if(!e(t[a],n[a]))return!1}return!0}return t!==t&&n!==n};const Mk=ud(Poe);function S1(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 joe=Object.defineProperty,Dk=Object.getOwnPropertySymbols,Ioe=Object.prototype.hasOwnProperty,Eoe=Object.prototype.propertyIsEnumerable,Tk=(e,t,n)=>t in e?joe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ooe=(e,t)=>{for(var n in t||(t={}))Ioe.call(t,n)&&Tk(e,n,t[n]);if(Dk)for(var n of Dk(t))Eoe.call(t,n)&&Tk(e,n,t[n]);return e};function zO(e,t){if(t===null||typeof t!="object")return{};const n=Ooe({},t);return Object.keys(t).forEach(r=>{r.includes(`${String(e)}.`)&&delete n[r]}),n}const Roe="__MANTINE_FORM_INDEX__";function Ak(e,t){return t?typeof t=="boolean"?t:Array.isArray(t)?t.includes(e.replace(/[.][0-9]/g,`.${Roe}`)):!1:!1}function Nk(e,t,n){typeof n.value=="object"&&(n.value=Xl(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function Xl(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(a){o.add(Xl(a))})):s==="[object Map]"?(o=new Map,e.forEach(function(a,c){o.set(Xl(c),Xl(a))})):s==="[object Date]"?o=new Date(+e):s==="[object RegExp]"?o=new RegExp(e.source,e.flags):s==="[object DataView]"?o=new e.constructor(Xl(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 C1(e,t,n="",r={}){return typeof e!="object"||e===null?r:Object.keys(e).reduce((o,s)=>{const a=e[s],c=`${n===""?"":`${n}.`}${s}`,d=xa(c,t);let p=!1;return typeof a=="function"&&(o[c]=a(d,t,c)),typeof a=="object"&&Array.isArray(d)&&(p=!0,d.forEach((h,m)=>C1(a,t,`${c}.${m}`,o))),typeof a=="object"&&typeof d=="object"&&d!==null&&(p||C1(a,t,c,o)),o},r)}function k1(e,t){return $k(typeof e=="function"?e(t):C1(e,t))}function gp(e,t,n){if(typeof e!="string")return{hasError:!1,error:null};const r=k1(t,n),o=Object.keys(r.errors).find(s=>e.split(".").every((a,c)=>a===s.split(".")[c]));return{hasError:!!o,error:o?r.errors[o]:null}}function Moe(e,{from:t,to:n},r){const o=xa(e,r);if(!Array.isArray(o))return r;const s=[...o],a=o[t];return s.splice(t,1),s.splice(n,0,a),Zm(e,s,r)}var Doe=Object.defineProperty,zk=Object.getOwnPropertySymbols,Toe=Object.prototype.hasOwnProperty,Aoe=Object.prototype.propertyIsEnumerable,Lk=(e,t,n)=>t in e?Doe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Noe=(e,t)=>{for(var n in t||(t={}))Toe.call(t,n)&&Lk(e,n,t[n]);if(zk)for(var n of zk(t))Aoe.call(t,n)&&Lk(e,n,t[n]);return e};function $oe(e,{from:t,to:n},r){const o=`${e}.${t}`,s=`${e}.${n}`,a=Noe({},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=a[d],m=a[p];return m===void 0?delete a[d]:a[d]=m,h===void 0?delete a[p]:a[p]=h,!1}return!0}),a}function zoe(e,t,n){const r=xa(e,n);return Array.isArray(r)?Zm(e,r.filter((o,s)=>s!==t),n):n}var Loe=Object.defineProperty,Bk=Object.getOwnPropertySymbols,Boe=Object.prototype.hasOwnProperty,Foe=Object.prototype.propertyIsEnumerable,Fk=(e,t,n)=>t in e?Loe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hoe=(e,t)=>{for(var n in t||(t={}))Boe.call(t,n)&&Fk(e,n,t[n]);if(Bk)for(var n of Bk(t))Foe.call(t,n)&&Fk(e,n,t[n]);return e};function Hk(e,t){const n=e.substring(t.length+1).split(".")[0];return parseInt(n,10)}function Wk(e,t,n,r){if(t===void 0)return n;const o=`${String(e)}`;let s=n;r===-1&&(s=zO(`${o}.${t}`,s));const a=Hoe({},s),c=new Set;return Object.entries(s).filter(([d])=>{if(!d.startsWith(`${o}.`))return!1;const p=Hk(d,o);return Number.isNaN(p)?!1:p>=t}).forEach(([d,p])=>{const h=Hk(d,o),m=d.replace(`${o}.${h}`,`${o}.${h+r}`);a[m]=p,c.add(m),c.has(d)||delete a[d]}),a}function Woe(e,t,n,r){const o=xa(e,r);if(!Array.isArray(o))return r;const s=[...o];return s.splice(typeof n=="number"?n:s.length,0,t),Zm(e,s,r)}function Vk(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 Voe(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 Uoe=Object.defineProperty,Goe=Object.defineProperties,qoe=Object.getOwnPropertyDescriptors,Uk=Object.getOwnPropertySymbols,Koe=Object.prototype.hasOwnProperty,Yoe=Object.prototype.propertyIsEnumerable,Gk=(e,t,n)=>t in e?Uoe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ti=(e,t)=>{for(var n in t||(t={}))Koe.call(t,n)&&Gk(e,n,t[n]);if(Uk)for(var n of Uk(t))Yoe.call(t,n)&&Gk(e,n,t[n]);return e},rv=(e,t)=>Goe(e,qoe(t));function Kc({initialValues:e={},initialErrors:t={},initialDirty:n={},initialTouched:r={},clearInputErrorOnChange:o=!0,validateInputOnChange:s=!1,validateInputOnBlur:a=!1,transformValues:c=p=>p,validate:d}={}){const[p,h]=f.useState(r),[m,v]=f.useState(n),[b,w]=f.useState(e),[y,S]=f.useState(S1(t)),k=f.useRef(e),_=K=>{k.current=K},I=f.useCallback(()=>h({}),[]),P=K=>{const U=K?ti(ti({},b),K):b;_(U),v({})},E=f.useCallback(K=>S(U=>S1(typeof K=="function"?K(U):K)),[]),O=f.useCallback(()=>S({}),[]),R=f.useCallback(()=>{w(e),O(),_(e),v({}),I()},[]),M=f.useCallback((K,U)=>E(ae=>rv(ti({},ae),{[K]:U})),[]),T=f.useCallback(K=>E(U=>{if(typeof K!="string")return U;const ae=ti({},U);return delete ae[K],ae}),[]),A=f.useCallback(K=>v(U=>{if(typeof K!="string")return U;const ae=zO(K,U);return delete ae[K],ae}),[]),$=f.useCallback((K,U)=>{const ae=Ak(K,s);A(K),h(re=>rv(ti({},re),{[K]:!0})),w(re=>{const se=Zm(K,U,re);if(ae){const pe=gp(K,d,se);pe.hasError?M(K,pe.error):T(K)}return se}),!ae&&o&&M(K,null)},[]),Q=f.useCallback(K=>{w(U=>{const ae=typeof K=="function"?K(U):K;return ti(ti({},U),ae)}),o&&O()},[]),B=f.useCallback((K,U)=>{A(K),w(ae=>Moe(K,U,ae)),S(ae=>$oe(K,U,ae))},[]),V=f.useCallback((K,U)=>{A(K),w(ae=>zoe(K,U,ae)),S(ae=>Wk(K,U,ae,-1))},[]),q=f.useCallback((K,U,ae)=>{A(K),w(re=>Woe(K,U,ae,re)),S(re=>Wk(K,ae,re,1))},[]),G=f.useCallback(()=>{const K=k1(d,b);return S(K.errors),K},[b,d]),D=f.useCallback(K=>{const U=gp(K,d,b);return U.hasError?M(K,U.error):T(K),U},[b,d]),z=(K,{type:U="input",withError:ae=!0,withFocus:re=!0}={})=>{const pe={onChange:Voe(le=>$(K,le))};return ae&&(pe.error=y[K]),U==="checkbox"?pe.checked=xa(K,b):pe.value=xa(K,b),re&&(pe.onFocus=()=>h(le=>rv(ti({},le),{[K]:!0})),pe.onBlur=()=>{if(Ak(K,a)){const le=gp(K,d,b);le.hasError?M(K,le.error):T(K)}}),pe},H=(K,U)=>ae=>{ae==null||ae.preventDefault();const re=G();re.hasErrors?U==null||U(re.errors,b,ae):K==null||K(c(b),ae)},Y=K=>c(K||b),ie=f.useCallback(K=>{K.preventDefault(),R()},[]),ye=K=>{if(K){const ae=xa(K,m);if(typeof ae=="boolean")return ae;const re=xa(K,b),se=xa(K,k.current);return!Mk(re,se)}return Object.keys(m).length>0?Vk(m):!Mk(b,k.current)},Z=f.useCallback(K=>Vk(p,K),[p]),oe=f.useCallback(K=>K?!gp(K,d,b).hasError:!k1(d,b).hasErrors,[b,d]);return{values:b,errors:y,setValues:Q,setErrors:E,setFieldValue:$,setFieldError:M,clearFieldError:T,clearErrors:O,reset:R,validate:G,validateField:D,reorderListItem:B,removeListItem:V,insertListItem:q,getInputProps:z,onSubmit:H,onReset:ie,isDirty:ye,isTouched:Z,setTouched:h,setDirty:v,resetTouched:I,resetDirty:P,isValid:oe,getTransformedValues:Y}}function Tr(e){const{...t}=e,{base50:n,base100:r,base200:o,base300:s,base800:a,base700:c,base900:d,accent500:p,accent300:h}=_y(),{colorMode:m}=Ds();return i.jsx(DE,{styles:()=>({input:{color:Be(d,r)(m),backgroundColor:Be(n,d)(m),borderColor:Be(o,a)(m),borderWidth:2,outline:"none",":focus":{borderColor:Be(h,p)(m)}},label:{color:Be(c,s)(m),fontWeight:"normal",marginBottom:4}}),...t})}const Qoe=[{value:"sd-1",label:sr["sd-1"]},{value:"sd-2",label:sr["sd-2"]},{value:"sdxl",label:sr.sdxl},{value:"sdxl-refiner",label:sr["sdxl-refiner"]}];function eg(e){const{...t}=e,{t:n}=be();return i.jsx(Kr,{label:n("modelManager.baseModel"),data:Qoe,...t})}function BO(e){const{data:t}=Q_(),{...n}=e;return i.jsx(Kr,{label:"Config File",placeholder:"Select A Config File",data:t||[],...n})}const Xoe=[{value:"normal",label:"Normal"},{value:"inpaint",label:"Inpaint"},{value:"depth",label:"Depth"}];function tg(e){const{...t}=e,{t:n}=be();return i.jsx(Kr,{label:n("modelManager.variant"),data:Xoe,...t})}function FO(e){const{t}=be(),n=te(),{model_path:r}=e,o=Kc({initialValues:{model_name:r?r.split("\\").splice(-1)[0].split(".")[0]:"",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]=X_(),[a,c]=f.useState(!1),d=p=>{s({body:p}).unwrap().then(h=>{n(Dn(Bn({title:`Model Added: ${p.model_name}`,status:"success"}))),o.reset(),r&&n(pd(null))}).catch(h=>{h&&n(Dn(Bn({title:"Model Add Failed",status:"error"})))})};return i.jsx("form",{onSubmit:o.onSubmit(p=>d(p)),style:{width:"100%"},children:i.jsxs(W,{flexDirection:"column",gap:2,children:[i.jsx(Tr,{label:"Model Name",required:!0,...o.getInputProps("model_name")}),i.jsx(eg,{...o.getInputProps("base_model")}),i.jsx(Tr,{label:"Model Location",required:!0,...o.getInputProps("path")}),i.jsx(Tr,{label:"Description",...o.getInputProps("description")}),i.jsx(Tr,{label:"VAE Location",...o.getInputProps("vae")}),i.jsx(tg,{...o.getInputProps("variant")}),i.jsxs(W,{flexDirection:"column",width:"100%",gap:2,children:[a?i.jsx(Tr,{required:!0,label:"Custom Config File Location",...o.getInputProps("config")}):i.jsx(BO,{required:!0,width:"100%",...o.getInputProps("config")}),i.jsx(Gn,{isChecked:a,onChange:()=>c(!a),label:"Use Custom Config"}),i.jsx(rn,{mt:2,type:"submit",children:t("modelManager.addModel")})]})]})})}function HO(e){const{t}=be(),n=te(),{model_path:r}=e,[o]=X_(),s=Kc({initialValues:{model_name:r?r.split("\\").splice(-1)[0]:"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"diffusers",error:void 0,vae:"",variant:"normal"}}),a=c=>{o({body:c}).unwrap().then(d=>{n(Dn(Bn({title:`Model Added: ${c.model_name}`,status:"success"}))),s.reset(),r&&n(pd(null))}).catch(d=>{d&&n(Dn(Bn({title:"Model Add Failed",status:"error"})))})};return i.jsx("form",{onSubmit:s.onSubmit(c=>a(c)),style:{width:"100%"},children:i.jsxs(W,{flexDirection:"column",gap:2,children:[i.jsx(Tr,{required:!0,label:"Model Name",...s.getInputProps("model_name")}),i.jsx(eg,{...s.getInputProps("base_model")}),i.jsx(Tr,{required:!0,label:"Model Location",placeholder:"Provide the path to a local folder where your Diffusers Model is stored",...s.getInputProps("path")}),i.jsx(Tr,{label:"Description",...s.getInputProps("description")}),i.jsx(Tr,{label:"VAE Location",...s.getInputProps("vae")}),i.jsx(tg,{...s.getInputProps("variant")}),i.jsx(rn,{mt:2,type:"submit",children:t("modelManager.addModel")})]})})}const WO=[{label:"Diffusers",value:"diffusers"},{label:"Checkpoint / Safetensors",value:"checkpoint"}];function Joe(){const[e,t]=f.useState("diffusers");return i.jsxs(W,{flexDirection:"column",gap:4,width:"100%",children:[i.jsx(Kr,{label:"Model Type",value:e,data:WO,onChange:n=>{n&&t(n)}}),i.jsxs(W,{sx:{p:4,borderRadius:4,bg:"base.300",_dark:{bg:"base.850"}},children:[e==="diffusers"&&i.jsx(HO,{}),e==="checkpoint"&&i.jsx(FO,{})]})]})}const Zoe=[{label:"None",value:"none"},{label:"v_prediction",value:"v_prediction"},{label:"epsilon",value:"epsilon"},{label:"sample",value:"sample"}];function ese(){const e=te(),{t}=be(),n=L(c=>c.system.isProcessing),[r,{isLoading:o}]=J_(),s=Kc({initialValues:{location:"",prediction_type:void 0}}),a=c=>{const d={location:c.location,prediction_type:c.prediction_type==="none"?void 0:c.prediction_type};r({body:d}).unwrap().then(p=>{e(Dn(Bn({title:"Model Added",status:"success"}))),s.reset()}).catch(p=>{p&&(console.log(p),e(Dn(Bn({title:`${p.data.detail} `,status:"error"}))))})};return i.jsx("form",{onSubmit:s.onSubmit(c=>a(c)),style:{width:"100%"},children:i.jsxs(W,{flexDirection:"column",width:"100%",gap:4,children:[i.jsx(Tr,{label:"Model Location",placeholder:"Provide a path to a local Diffusers model, local checkpoint / safetensors model a HuggingFace Repo ID, or a checkpoint/diffusers model URL.",w:"100%",...s.getInputProps("location")}),i.jsx(Kr,{label:"Prediction Type (for Stable Diffusion 2.x Models only)",data:Zoe,defaultValue:"none",...s.getInputProps("prediction_type")}),i.jsx(rn,{type:"submit",isLoading:o,isDisabled:o||n,children:t("modelManager.addModel")})]})})}function tse(){const[e,t]=f.useState("simple");return i.jsxs(W,{flexDirection:"column",width:"100%",overflow:"scroll",maxHeight:window.innerHeight-250,gap:4,children:[i.jsxs(nr,{isAttached:!0,children:[i.jsx(rn,{size:"sm",isChecked:e=="simple",onClick:()=>t("simple"),children:"Simple"}),i.jsx(rn,{size:"sm",isChecked:e=="advanced",onClick:()=>t("advanced"),children:"Advanced"})]}),i.jsxs(W,{sx:{p:4,borderRadius:4,background:"base.200",_dark:{background:"base.800"}},children:[e==="simple"&&i.jsx(ese,{}),e==="advanced"&&i.jsx(Joe,{})]})]})}const nse={display:"flex",flexDirection:"row",alignItems:"center",gap:10},rse=e=>{const{label:t="",labelPos:n="top",isDisabled:r=!1,isInvalid:o,formControlProps:s,...a}=e,c=te(),d=f.useCallback(h=>{h.shiftKey&&c(Po(!0))},[c]),p=f.useCallback(h=>{h.shiftKey||c(Po(!1))},[c]);return i.jsxs(mo,{isInvalid:o,isDisabled:r,...s,style:n==="side"?nse:void 0,children:[t!==""&&i.jsx(zo,{children:t}),i.jsx(yd,{...a,onPaste:Ny,onKeyDown:d,onKeyUp:p})]})},Ec=f.memo(rse);function ose(e){const{...t}=e;return i.jsx(PI,{w:"100%",...t,children:e.children})}function sse(){const e=L(y=>y.modelmanager.searchFolder),[t,n]=f.useState(""),{data:r}=na(Wu),{foundModels:o,alreadyInstalled:s,filteredModels:a}=Z_({search_path:e||""},{selectFromResult:({data:y})=>{const S=XD(r==null?void 0:r.entities),k=cs(S,"path"),_=KD(y,k),I=nT(y,k);return{foundModels:y,alreadyInstalled:qk(I,t),filteredModels:qk(_,t)}}}),[c,{isLoading:d}]=J_(),p=te(),{t:h}=be(),m=f.useCallback(y=>{const S=y.currentTarget.id.split("\\").splice(-1)[0];c({body:{location:y.currentTarget.id}}).unwrap().then(k=>{p(Dn(Bn({title:`Added Model: ${S}`,status:"success"})))}).catch(k=>{k&&p(Dn(Bn({title:"Failed To Add Model",status:"error"})))})},[p,c]),v=f.useCallback(y=>{n(y.target.value)},[]),b=({models:y,showActions:S=!0})=>y.map(k=>i.jsxs(W,{sx:{p:4,gap:4,alignItems:"center",borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[i.jsxs(W,{w:"100%",sx:{flexDirection:"column",minW:"25%"},children:[i.jsx(tt,{sx:{fontWeight:600},children:k.split("\\").slice(-1)[0]}),i.jsx(tt,{sx:{fontSize:"sm",color:"base.600",_dark:{color:"base.400"}},children:k})]}),S?i.jsxs(W,{gap:2,children:[i.jsx(rn,{id:k,onClick:m,isLoading:d,children:"Quick Add"}),i.jsx(rn,{onClick:()=>p(pd(k)),isLoading:d,children:"Advanced"})]}):i.jsx(tt,{sx:{fontWeight:600,p:2,borderRadius:4,color:"accent.50",bg:"accent.400",_dark:{color:"accent.100",bg:"accent.600"}},children:"Installed"})]},k));return(()=>e?!o||o.length===0?i.jsx(W,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",height:96,userSelect:"none",bg:"base.200",_dark:{bg:"base.900"}},children:i.jsx(tt,{variant:"subtext",children:"No Models Found"})}):i.jsxs(W,{sx:{flexDirection:"column",gap:2,w:"100%",minW:"50%"},children:[i.jsx(Ec,{onChange:v,label:h("modelManager.search"),labelPos:"side"}),i.jsxs(W,{p:2,gap:2,children:[i.jsxs(tt,{sx:{fontWeight:600},children:["Models Found: ",o.length]}),i.jsxs(tt,{sx:{fontWeight:600,color:"accent.500",_dark:{color:"accent.200"}},children:["Not Installed: ",a.length]})]}),i.jsx(ose,{offsetScrollbars:!0,children:i.jsxs(W,{gap:2,flexDirection:"column",children:[b({models:a}),b({models:s,showActions:!1})]})})]}):null)()}const qk=(e,t)=>{const n=[];return so(e,r=>{if(!r)return null;r.includes(t)&&n.push(r)}),n};function ase(){const e=L(a=>a.modelmanager.advancedAddScanModel),[t,n]=f.useState("diffusers"),[r,o]=f.useState(!0);f.useEffect(()=>{e&&[".ckpt",".safetensors",".pth",".pt"].some(a=>e.endsWith(a))?n("checkpoint"):n("diffusers")},[e,n,r]);const s=te();return e?i.jsxs(Re,{as:Yr.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:[i.jsxs(W,{justifyContent:"space-between",alignItems:"center",children:[i.jsx(tt,{size:"xl",fontWeight:600,children:r||t==="checkpoint"?"Add Checkpoint Model":"Add Diffusers Model"}),i.jsx(Fe,{icon:i.jsx(mW,{}),"aria-label":"Close Advanced",onClick:()=>s(pd(null)),size:"sm"})]}),i.jsx(Kr,{label:"Model Type",value:t,data:WO,onChange:a=>{a&&(n(a),o(a==="checkpoint"))}}),r?i.jsx(FO,{model_path:e},e):i.jsx(HO,{model_path:e},e)]}):null}function ise(){const e=te(),{t}=be(),n=L(c=>c.modelmanager.searchFolder),{refetch:r}=Z_({search_path:n||""}),o=Kc({initialValues:{folder:""}}),s=f.useCallback(c=>{e(nw(c.folder))},[e]),a=()=>{r()};return i.jsx("form",{onSubmit:o.onSubmit(c=>s(c)),style:{width:"100%"},children:i.jsxs(W,{sx:{w:"100%",gap:2,borderRadius:4,alignItems:"center"},children:[i.jsxs(W,{w:"100%",alignItems:"center",gap:4,minH:12,children:[i.jsx(tt,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",minW:"max-content",_dark:{color:"base.300"}},children:"Folder"}),n?i.jsx(W,{sx:{w:"100%",p:2,px:4,bg:"base.300",borderRadius:4,fontSize:"sm",fontWeight:"bold",_dark:{bg:"base.700"}},children:n}):i.jsx(Ec,{w:"100%",size:"md",...o.getInputProps("folder")})]}),i.jsxs(W,{gap:2,children:[n?i.jsx(Fe,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:i.jsx(k6,{}),onClick:a,fontSize:18,size:"sm"}):i.jsx(Fe,{"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),icon:i.jsx(dW,{}),fontSize:18,size:"sm",type:"submit"}),i.jsx(Fe,{"aria-label":t("modelManager.clearCheckpointFolder"),tooltip:t("modelManager.clearCheckpointFolder"),icon:i.jsx(us,{}),size:"sm",onClick:()=>{e(nw(null)),e(pd(null))},isDisabled:!n,colorScheme:"red"})]})]})})}const lse=f.memo(ise);function cse(){return i.jsxs(W,{flexDirection:"column",w:"100%",gap:4,children:[i.jsx(lse,{}),i.jsxs(W,{gap:4,children:[i.jsx(W,{sx:{maxHeight:window.innerHeight-300,overflow:"scroll",gap:4,w:"100%"},children:i.jsx(sse,{})}),i.jsx(ase,{})]})]})}function use(){const[e,t]=f.useState("add"),{t:n}=be();return i.jsxs(W,{flexDirection:"column",gap:4,children:[i.jsxs(nr,{isAttached:!0,children:[i.jsx(rn,{onClick:()=>t("add"),isChecked:e=="add",size:"sm",width:"100%",children:n("modelManager.addModel")}),i.jsx(rn,{onClick:()=>t("scan"),isChecked:e=="scan",size:"sm",width:"100%",children:n("modelManager.scanForModels")})]}),e=="add"&&i.jsx(tse,{}),e=="scan"&&i.jsx(cse,{})]})}const dse=[{label:"Stable Diffusion 1",value:"sd-1"},{label:"Stable Diffusion 2",value:"sd-2"}];function fse(){const{t:e}=be(),t=te(),{data:n}=na(Wu),[r,{isLoading:o}]=vM(),[s,a]=f.useState("sd-1"),c=gw(n==null?void 0:n.entities,(D,z)=>(D==null?void 0:D.model_format)==="diffusers"&&(D==null?void 0:D.base_model)==="sd-1"),d=gw(n==null?void 0:n.entities,(D,z)=>(D==null?void 0:D.model_format)==="diffusers"&&(D==null?void 0:D.base_model)==="sd-2"),p=f.useMemo(()=>({"sd-1":c,"sd-2":d}),[c,d]),[h,m]=f.useState(Object.keys(p[s])[0]),[v,b]=f.useState(Object.keys(p[s])[1]),[w,y]=f.useState(null),[S,k]=f.useState(""),[_,I]=f.useState(.5),[P,E]=f.useState("weighted_sum"),[O,R]=f.useState("root"),[M,T]=f.useState(""),[A,$]=f.useState(!1),Q=Object.keys(p[s]).filter(D=>D!==v&&D!==w),B=Object.keys(p[s]).filter(D=>D!==h&&D!==w),V=Object.keys(p[s]).filter(D=>D!==h&&D!==v),q=D=>{a(D),m(null),b(null)},G=()=>{const D=[];let z=[h,v,w];z=z.filter(Y=>Y!==null),z.forEach(Y=>{Y&&D.push(Y==null?void 0:Y.split("/")[2])});const H={model_names:D,merged_model_name:S!==""?S:D.join("-"),alpha:_,interp:P,force:A,merge_dest_directory:O==="root"?void 0:M};r({base_model:s,body:H}).unwrap().then(Y=>{t(Dn(Bn({title:e("modelManager.modelsMerged"),status:"success"})))}).catch(Y=>{Y&&t(Dn(Bn({title:e("modelManager.modelsMergeFailed"),status:"error"})))})};return i.jsxs(W,{flexDirection:"column",rowGap:4,children:[i.jsxs(W,{sx:{flexDirection:"column",rowGap:1},children:[i.jsx(tt,{children:e("modelManager.modelMergeHeaderHelp1")}),i.jsx(tt,{fontSize:"sm",variant:"subtext",children:e("modelManager.modelMergeHeaderHelp2")})]}),i.jsxs(W,{columnGap:4,children:[i.jsx(Kr,{label:"Model Type",w:"100%",data:dse,value:s,onChange:q}),i.jsx(ar,{label:e("modelManager.modelOne"),w:"100%",value:h,placeholder:e("modelManager.selectModel"),data:Q,onChange:D=>m(D)}),i.jsx(ar,{label:e("modelManager.modelTwo"),w:"100%",placeholder:e("modelManager.selectModel"),value:v,data:B,onChange:D=>b(D)}),i.jsx(ar,{label:e("modelManager.modelThree"),data:V,w:"100%",placeholder:e("modelManager.selectModel"),clearable:!0,onChange:D=>{D?(y(D),E("weighted_sum")):(y(null),E("add_difference"))}})]}),i.jsx(Ec,{label:e("modelManager.mergedModelName"),value:S,onChange:D=>k(D.target.value)}),i.jsxs(W,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[i.jsx(_t,{label:e("modelManager.alpha"),min:.01,max:.99,step:.01,value:_,onChange:D=>I(D),withInput:!0,withReset:!0,handleReset:()=>I(.5),withSliderMarks:!0}),i.jsx(tt,{variant:"subtext",fontSize:"sm",children:e("modelManager.modelMergeAlphaHelp")})]}),i.jsxs(W,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[i.jsx(tt,{fontWeight:500,fontSize:"sm",variant:"subtext",children:e("modelManager.interpolationType")}),i.jsx(Gp,{value:P,onChange:D=>E(D),children:i.jsx(W,{columnGap:4,children:w===null?i.jsxs(i.Fragment,{children:[i.jsx(ya,{value:"weighted_sum",children:i.jsx(tt,{fontSize:"sm",children:e("modelManager.weightedSum")})}),i.jsx(ya,{value:"sigmoid",children:i.jsx(tt,{fontSize:"sm",children:e("modelManager.sigmoid")})}),i.jsx(ya,{value:"inv_sigmoid",children:i.jsx(tt,{fontSize:"sm",children:e("modelManager.inverseSigmoid")})})]}):i.jsx(ya,{value:"add_difference",children:i.jsx(wn,{label:e("modelManager.modelMergeInterpAddDifferenceHelp"),children:i.jsx(tt,{fontSize:"sm",children:e("modelManager.addDifference")})})})})})]}),i.jsxs(W,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.900"}},children:[i.jsxs(W,{columnGap:4,children:[i.jsx(tt,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:e("modelManager.mergedModelSaveLocation")}),i.jsx(Gp,{value:O,onChange:D=>R(D),children:i.jsxs(W,{columnGap:4,children:[i.jsx(ya,{value:"root",children:i.jsx(tt,{fontSize:"sm",children:e("modelManager.invokeAIFolder")})}),i.jsx(ya,{value:"custom",children:i.jsx(tt,{fontSize:"sm",children:e("modelManager.custom")})})]})})]}),O==="custom"&&i.jsx(Ec,{label:e("modelManager.mergedModelCustomSaveLocation"),value:M,onChange:D=>T(D.target.value)})]}),i.jsx(Gn,{label:e("modelManager.ignoreMismatch"),isChecked:A,onChange:D=>$(D.target.checked),fontWeight:"500"}),i.jsx(rn,{onClick:G,isLoading:o,isDisabled:h===null||v===null,children:e("modelManager.merge")})]})}const pse=Te((e,t)=>{const{t:n}=be(),{acceptButtonText:r=n("common.accept"),acceptCallback:o,cancelButtonText:s=n("common.cancel"),cancelCallback:a,children:c,title:d,triggerComponent:p}=e,{isOpen:h,onOpen:m,onClose:v}=ss(),b=f.useRef(null),w=()=>{o(),v()},y=()=>{a&&a(),v()};return i.jsxs(i.Fragment,{children:[f.cloneElement(p,{onClick:m,ref:t}),i.jsx(_d,{isOpen:h,leastDestructiveRef:b,onClose:v,isCentered:!0,children:i.jsx(Da,{children:i.jsxs(Pd,{children:[i.jsx(Ma,{fontSize:"lg",fontWeight:"bold",children:d}),i.jsx(Ta,{children:c}),i.jsxs(Ra,{children:[i.jsx(rn,{ref:b,onClick:y,children:s}),i.jsx(rn,{colorScheme:"error",onClick:w,ml:3,children:r})]})]})})})]})}),Vy=f.memo(pse);function hse(e){const{model:t}=e,n=te(),{t:r}=be(),[o,{isLoading:s}]=bM(),[a,c]=f.useState("InvokeAIRoot"),[d,p]=f.useState("");f.useEffect(()=>{c("InvokeAIRoot")},[t]);const h=()=>{c("InvokeAIRoot")},m=()=>{const v={base_model:t.base_model,model_name:t.model_name,params:{convert_dest_directory:a==="Custom"?d:void 0}};if(a==="Custom"&&d===""){n(Dn(Bn({title:r("modelManager.noCustomLocationProvided"),status:"error"})));return}n(Dn(Bn({title:`${r("modelManager.convertingModelBegin")}: ${t.model_name}`,status:"success"}))),o(v).unwrap().then(b=>{n(Dn(Bn({title:`${r("modelManager.modelConverted")}: ${t.model_name}`,status:"success"})))}).catch(b=>{n(Dn(Bn({title:`${r("modelManager.modelConversionFailed")}: ${t.model_name}`,status:"error"})))})};return i.jsxs(Vy,{title:`${r("modelManager.convert")} ${t.model_name}`,acceptCallback:m,cancelCallback:h,acceptButtonText:`${r("modelManager.convert")}`,triggerComponent:i.jsxs(rn,{size:"sm","aria-label":r("modelManager.convertToDiffusers"),className:" modal-close-btn",isLoading:s,children:["🧨 ",r("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[i.jsxs(W,{flexDirection:"column",rowGap:4,children:[i.jsx(tt,{children:r("modelManager.convertToDiffusersHelpText1")}),i.jsxs(vb,{children:[i.jsx(wa,{children:r("modelManager.convertToDiffusersHelpText2")}),i.jsx(wa,{children:r("modelManager.convertToDiffusersHelpText3")}),i.jsx(wa,{children:r("modelManager.convertToDiffusersHelpText4")}),i.jsx(wa,{children:r("modelManager.convertToDiffusersHelpText5")})]}),i.jsx(tt,{children:r("modelManager.convertToDiffusersHelpText6")})]}),i.jsxs(W,{flexDir:"column",gap:2,children:[i.jsxs(W,{marginTop:4,flexDir:"column",gap:2,children:[i.jsx(tt,{fontWeight:"600",children:r("modelManager.convertToDiffusersSaveLocation")}),i.jsx(Gp,{value:a,onChange:v=>c(v),children:i.jsxs(W,{gap:4,children:[i.jsx(ya,{value:"InvokeAIRoot",children:i.jsx(wn,{label:"Save converted model in the InvokeAI root folder",children:r("modelManager.invokeRoot")})}),i.jsx(ya,{value:"Custom",children:i.jsx(wn,{label:"Save converted model in a custom folder",children:r("modelManager.custom")})})]})})]}),a==="Custom"&&i.jsxs(W,{flexDirection:"column",rowGap:2,children:[i.jsx(tt,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:r("modelManager.customSaveLocation")}),i.jsx(Ec,{value:d,onChange:v=>{p(v.target.value)},width:"full"})]})]})]})}function mse(e){const t=L(jr),{model:n}=e,[r,{isLoading:o}]=e3(),{data:s}=Q_(),[a,c]=f.useState(!1);f.useEffect(()=>{s!=null&&s.includes(n.config)||c(!0)},[s,n.config]);const d=te(),{t:p}=be(),h=Kc({initialValues:{model_name:n.model_name?n.model_name:"",base_model:n.base_model,model_type:"main",path:n.path?n.path:"",description:n.description?n.description:"",model_format:"checkpoint",vae:n.vae?n.vae:"",config:n.config?n.config:"",variant:n.variant},validate:{path:v=>v.trim().length===0?"Must provide a path":null}}),m=f.useCallback(v=>{const b={base_model:n.base_model,model_name:n.model_name,body:v};r(b).unwrap().then(w=>{h.setValues(w),d(Dn(Bn({title:p("modelManager.modelUpdated"),status:"success"})))}).catch(w=>{h.reset(),d(Dn(Bn({title:p("modelManager.modelUpdateFailed"),status:"error"})))})},[h,d,n.base_model,n.model_name,p,r]);return i.jsxs(W,{flexDirection:"column",rowGap:4,width:"100%",children:[i.jsxs(W,{justifyContent:"space-between",alignItems:"center",children:[i.jsxs(W,{flexDirection:"column",children:[i.jsx(tt,{fontSize:"lg",fontWeight:"bold",children:n.model_name}),i.jsxs(tt,{fontSize:"sm",color:"base.400",children:[sr[n.base_model]," Model"]})]}),[""].includes(n.base_model)?i.jsx(pl,{sx:{p:2,borderRadius:4,bg:"error.200",_dark:{bg:"error.400"}},children:"Conversion Not Supported"}):i.jsx(hse,{model:n})]}),i.jsx(hl,{}),i.jsx(W,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",children:i.jsx("form",{onSubmit:h.onSubmit(v=>m(v)),children:i.jsxs(W,{flexDirection:"column",overflowY:"scroll",gap:4,children:[i.jsx(Tr,{label:p("modelManager.name"),...h.getInputProps("model_name")}),i.jsx(Tr,{label:p("modelManager.description"),...h.getInputProps("description")}),i.jsx(eg,{required:!0,...h.getInputProps("base_model")}),i.jsx(tg,{required:!0,...h.getInputProps("variant")}),i.jsx(Tr,{required:!0,label:p("modelManager.modelLocation"),...h.getInputProps("path")}),i.jsx(Tr,{label:p("modelManager.vaeLocation"),...h.getInputProps("vae")}),i.jsxs(W,{flexDirection:"column",gap:2,children:[a?i.jsx(Tr,{required:!0,label:p("modelManager.config"),...h.getInputProps("config")}):i.jsx(BO,{required:!0,...h.getInputProps("config")}),i.jsx(Gn,{isChecked:a,onChange:()=>c(!a),label:"Use Custom Config"})]}),i.jsx(rn,{type:"submit",isDisabled:t||o,isLoading:o,children:p("modelManager.updateModel")})]})})})]})}function gse(e){const t=L(jr),{model:n}=e,[r,{isLoading:o}]=e3(),s=te(),{t:a}=be(),c=Kc({initialValues:{model_name:n.model_name?n.model_name:"",base_model:n.base_model,model_type:"main",path:n.path?n.path:"",description:n.description?n.description:"",model_format:"diffusers",vae:n.vae?n.vae:"",variant:n.variant},validate:{path:p=>p.trim().length===0?"Must provide a path":null}}),d=f.useCallback(p=>{const h={base_model:n.base_model,model_name:n.model_name,body:p};r(h).unwrap().then(m=>{c.setValues(m),s(Dn(Bn({title:a("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{c.reset(),s(Dn(Bn({title:a("modelManager.modelUpdateFailed"),status:"error"})))})},[c,s,n.base_model,n.model_name,a,r]);return i.jsxs(W,{flexDirection:"column",rowGap:4,width:"100%",children:[i.jsxs(W,{flexDirection:"column",children:[i.jsx(tt,{fontSize:"lg",fontWeight:"bold",children:n.model_name}),i.jsxs(tt,{fontSize:"sm",color:"base.400",children:[sr[n.base_model]," Model"]})]}),i.jsx(hl,{}),i.jsx("form",{onSubmit:c.onSubmit(p=>d(p)),children:i.jsxs(W,{flexDirection:"column",overflowY:"scroll",gap:4,children:[i.jsx(Tr,{label:a("modelManager.name"),...c.getInputProps("model_name")}),i.jsx(Tr,{label:a("modelManager.description"),...c.getInputProps("description")}),i.jsx(eg,{required:!0,...c.getInputProps("base_model")}),i.jsx(tg,{required:!0,...c.getInputProps("variant")}),i.jsx(Tr,{required:!0,label:a("modelManager.modelLocation"),...c.getInputProps("path")}),i.jsx(Tr,{label:a("modelManager.vaeLocation"),...c.getInputProps("vae")}),i.jsx(rn,{type:"submit",isDisabled:t||o,isLoading:o,children:a("modelManager.updateModel")})]})})]})}const vse={"sd-1":"SD1","sd-2":"SD2",sdxl:"SDXL","sdxl-refiner":"SDXLR"};function Kk(e){const t=L(jr),{t:n}=be(),r=te(),[o]=yM(),{model:s,isSelected:a,setSelectedModelId:c}=e,d=f.useCallback(()=>{c(s.id)},[s.id,c]),p=f.useCallback(()=>{o(s).unwrap().then(h=>{r(Dn(Bn({title:`${n("modelManager.modelDeleted")}: ${s.model_name}`,status:"success"})))}).catch(h=>{h&&r(Dn(Bn({title:`${n("modelManager.modelDeleteFailed")}: ${s.model_name}`,status:"success"})))}),c(void 0)},[o,s,c,r,n]);return i.jsxs(W,{sx:{gap:2,alignItems:"center",w:"full"},children:[i.jsx(W,{as:rn,isChecked:a,sx:{justifyContent:"start",p:2,borderRadius:"base",w:"full",alignItems:"center",bg:a?"accent.400":"base.100",color:a?"base.50":"base.800",_hover:{bg:a?"accent.500":"base.300",color:a?"base.50":"base.800"},_dark:{color:a?"base.50":"base.100",bg:a?"accent.600":"base.850",_hover:{color:a?"base.50":"base.100",bg:a?"accent.550":"base.700"}}},onClick:d,children:i.jsxs(W,{gap:4,alignItems:"center",children:[i.jsx(pl,{minWidth:14,p:.5,fontSize:"sm",variant:"solid",children:vse[s.base_model]}),i.jsx(wn,{label:s.description,hasArrow:!0,placement:"bottom",children:i.jsx(tt,{sx:{fontWeight:500},children:s.model_name})})]})}),i.jsx(Vy,{title:n("modelManager.deleteModel"),acceptCallback:p,acceptButtonText:n("modelManager.delete"),triggerComponent:i.jsx(Fe,{icon:i.jsx(VV,{}),"aria-label":n("modelManager.deleteConfig"),isDisabled:t,colorScheme:"error"}),children:i.jsxs(W,{rowGap:4,flexDirection:"column",children:[i.jsx("p",{style:{fontWeight:"bold"},children:n("modelManager.deleteMsg1")}),i.jsx("p",{children:n("modelManager.deleteMsg2")})]})})]})}const bse=e=>{const{selectedModelId:t,setSelectedModelId:n}=e,{t:r}=be(),[o,s]=f.useState(""),[a,c]=f.useState("images"),{filteredDiffusersModels:d}=na(Wu,{selectFromResult:({data:m})=>({filteredDiffusersModels:Yk(m,"diffusers",o)})}),{filteredCheckpointModels:p}=na(Wu,{selectFromResult:({data:m})=>({filteredCheckpointModels:Yk(m,"checkpoint",o)})}),h=f.useCallback(m=>{s(m.target.value)},[]);return i.jsx(W,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:i.jsxs(W,{flexDirection:"column",gap:4,paddingInlineEnd:4,children:[i.jsxs(nr,{isAttached:!0,children:[i.jsx(rn,{onClick:()=>c("images"),isChecked:a==="images",size:"sm",children:r("modelManager.allModels")}),i.jsx(rn,{size:"sm",onClick:()=>c("diffusers"),isChecked:a==="diffusers",children:r("modelManager.diffusersModels")}),i.jsx(rn,{size:"sm",onClick:()=>c("checkpoint"),isChecked:a==="checkpoint",children:r("modelManager.checkpointModels")})]}),i.jsx(Ec,{onChange:h,label:r("modelManager.search"),labelPos:"side"}),i.jsxs(W,{flexDirection:"column",gap:4,maxHeight:window.innerHeight-280,overflow:"scroll",children:[["images","diffusers"].includes(a)&&d.length>0&&i.jsx(Qk,{children:i.jsxs(W,{sx:{gap:2,flexDir:"column"},children:[i.jsx(tt,{variant:"subtext",fontSize:"sm",children:"Diffusers"}),d.map(m=>i.jsx(Kk,{model:m,isSelected:t===m.id,setSelectedModelId:n},m.id))]})}),["images","checkpoint"].includes(a)&&p.length>0&&i.jsx(Qk,{children:i.jsxs(W,{sx:{gap:2,flexDir:"column"},children:[i.jsx(tt,{variant:"subtext",fontSize:"sm",children:"Checkpoints"}),p.map(m=>i.jsx(Kk,{model:m,isSelected:t===m.id,setSelectedModelId:n},m.id))]})})]})]})})},Yk=(e,t,n)=>{const r=[];return so(e==null?void 0:e.entities,o=>{if(!o)return;const s=o.model_name.toLowerCase().includes(n.toLowerCase()),a=o.model_format===t;s&&a&&r.push(o)}),r},Qk=e=>i.jsx(W,{flexDirection:"column",gap:4,borderRadius:4,p:4,sx:{bg:"base.200",_dark:{bg:"base.800"}},children:e.children});function yse(){const[e,t]=f.useState(),{model:n}=na(Wu,{selectFromResult:({data:r})=>({model:e?r==null?void 0:r.entities[e]:void 0})});return i.jsxs(W,{sx:{gap:8,w:"full",h:"full"},children:[i.jsx(bse,{selectedModelId:e,setSelectedModelId:t}),i.jsx(xse,{model:n})]})}const xse=e=>{const{model:t}=e;return(t==null?void 0:t.model_format)==="checkpoint"?i.jsx(mse,{model:t},t.id):(t==null?void 0:t.model_format)==="diffusers"?i.jsx(gse,{model:t},t.id):i.jsx(W,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",maxH:96,userSelect:"none"},children:i.jsx(tt,{variant:"subtext",children:"No Model Selected"})})};function wse(){const{t:e}=be();return i.jsxs(W,{sx:{w:"full",p:4,borderRadius:4,gap:4,justifyContent:"space-between",alignItems:"center",bg:"base.200",_dark:{bg:"base.800"}},children:[i.jsxs(W,{sx:{flexDirection:"column",gap:2},children:[i.jsx(tt,{sx:{fontWeight:600},children:e("modelManager.syncModels")}),i.jsx(tt,{fontSize:"sm",sx:{_dark:{color:"base.400"}},children:e("modelManager.syncModelsDesc")})]}),i.jsx(Wd,{})]})}function Sse(){return i.jsx(W,{children:i.jsx(wse,{})})}const Xk=[{id:"modelManager",label:Ln.t("modelManager.modelManager"),content:i.jsx(yse,{})},{id:"importModels",label:Ln.t("modelManager.importModels"),content:i.jsx(use,{})},{id:"mergeModels",label:Ln.t("modelManager.mergeModels"),content:i.jsx(fse,{})},{id:"settings",label:Ln.t("modelManager.settings"),content:i.jsx(Sse,{})}],Cse=()=>i.jsxs(Id,{isLazy:!0,variant:"line",layerStyle:"first",sx:{w:"full",h:"full",p:4,gap:4,borderRadius:"base"},children:[i.jsx(Ed,{children:Xk.map(e=>i.jsx(wc,{sx:{borderTopRadius:"base"},children:e.label},e.id))}),i.jsx(km,{sx:{w:"full",h:"full"},children:Xk.map(e=>i.jsx(Cm,{sx:{w:"full",h:"full"},children:e.content},e.id))})]}),kse=f.memo(Cse);const _se=e=>fe([t=>t.nodes],t=>{const n=t.invocationTemplates[e];if(n)return n},{memoizeOptions:{resultEqualityCheck:(t,n)=>t!==void 0&&n!==void 0&&t.type===n.type}}),Pse=(e,t)=>{const n={id:e,name:t.name,type:t.type};return t.inputRequirement!=="never"&&(t.type==="string"&&(n.value=t.default??""),t.type==="integer"&&(n.value=t.default??0),t.type==="float"&&(n.value=t.default??0),t.type==="boolean"&&(n.value=t.default??!1),t.type==="enum"&&(t.enumType==="number"&&(n.value=t.default??0),t.enumType==="string"&&(n.value=t.default??"")),t.type==="array"&&(n.value=t.default??1),t.type==="image"&&(n.value=void 0),t.type==="image_collection"&&(n.value=[]),t.type==="latents"&&(n.value=void 0),t.type==="conditioning"&&(n.value=void 0),t.type==="unet"&&(n.value=void 0),t.type==="clip"&&(n.value=void 0),t.type==="vae"&&(n.value=void 0),t.type==="control"&&(n.value=void 0),t.type==="model"&&(n.value=void 0),t.type==="refiner_model"&&(n.value=void 0),t.type==="vae_model"&&(n.value=void 0),t.type==="lora_model"&&(n.value=void 0),t.type==="controlnet_model"&&(n.value=void 0)),n},jse=fe([e=>e.nodes],e=>e.invocationTemplates),Uy="node-drag-handle",Jk={dragHandle:`.${Uy}`},Ise=()=>{const e=L(jse),t=G1();return f.useCallback(n=>{if(n==="progress_image"){const{x:h,y:m}=t.project({x:window.innerWidth/2.5,y:window.innerHeight/8});return{...Jk,id:"progress_image",type:"progress_image",position:{x:h,y:m},data:{}}}const r=e[n];if(r===void 0){console.error(`Unable to find template ${n}.`);return}const o=ui(),s=rw(r.inputs,(h,m,v)=>{const b=ui(),w=Pse(b,m);return h[v]=w,h},{}),a=rw(r.outputs,(h,m,v)=>{const w={id:ui(),name:v,type:m.type};return h[v]=w,h},{}),{x:c,y:d}=t.project({x:window.innerWidth/2.5,y:window.innerHeight/8});return{...Jk,id:o,type:"invocation",position:{x:c,y:d},data:{id:o,type:n,inputs:s,outputs:a}}},[e,t])},Ese=e=>{const{nodeId:t,title:n,description:r}=e;return i.jsxs(W,{className:Uy,sx:{borderTopRadius:"md",alignItems:"center",justifyContent:"space-between",px:2,py:1,bg:"base.100",_dark:{bg:"base.900"}},children:[i.jsx(wn,{label:t,children:i.jsx(Qs,{size:"xs",sx:{fontWeight:600,color:"base.900",_dark:{color:"base.200"}},children:n})}),i.jsx(wn,{label:r,placement:"top",hasArrow:!0,shouldWrapChildren:!0,children:i.jsx(no,{sx:{h:"min-content",color:"base.700",_dark:{color:"base.300"}},as:nW})})]})},VO=f.memo(Ese),UO=()=>()=>!0,Ose={position:"absolute",width:"1rem",height:"1rem",borderWidth:0},Rse={left:"-1rem"},Mse={right:"-0.5rem"},Dse=e=>{const{field:t,isValidConnection:n,handleType:r,styles:o}=e,{name:s,type:a}=t;return i.jsx(wn,{label:a,placement:r==="target"?"start":"end",hasArrow:!0,openDelay:t3,children:i.jsx(xM,{type:r,id:s,isValidConnection:n,position:r==="target"?ow.Left:ow.Right,style:{backgroundColor:n3[a].colorCssVar,...o,...Ose,...r==="target"?Rse:Mse}})})},GO=f.memo(Dse),Tse=e=>i.jsx(sW,{}),Ase=f.memo(Tse),Nse=e=>{const{nodeId:t,field:n}=e,r=te(),o=s=>{r(Ts({nodeId:t,fieldName:n.name,value:s.target.checked}))};return i.jsx(Nb,{onChange:o,isChecked:n.value})},$se=f.memo(Nse),zse=e=>null,Lse=f.memo(zse);function ng(){return(ng=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function _1(e){var t=f.useRef(e),n=f.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Oc=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:S.buttons>0)&&o.current?s(Zk(o.current,S,c.current)):y(!1)},w=function(){return y(!1)};function y(S){var k=d.current,_=P1(o.current),I=S?_.addEventListener:_.removeEventListener;I(k?"touchmove":"mousemove",b),I(k?"touchend":"mouseup",w)}return[function(S){var k=S.nativeEvent,_=o.current;if(_&&(e_(k),!function(P,E){return E&&!Hu(P)}(k,d.current)&&_)){if(Hu(k)){d.current=!0;var I=k.changedTouches||[];I.length&&(c.current=I[0].identifier)}_.focus(),s(Zk(_,k,c.current)),y(!0)}},function(S){var k=S.which||S.keyCode;k<37||k>40||(S.preventDefault(),a({left:k===39?.05:k===37?-.05:0,top:k===40?.05:k===38?-.05:0}))},y]},[a,s]),h=p[0],m=p[1],v=p[2];return f.useEffect(function(){return v},[v]),F.createElement("div",ng({},r,{onTouchStart:h,onMouseDown:h,className:"react-colorful__interactive",ref:o,onKeyDown:m,tabIndex:0,role:"slider"}))}),rg=function(e){return e.filter(Boolean).join(" ")},qy=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=rg(["react-colorful__pointer",e.className]);return F.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},F.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},po=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},KO=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:po(e.h),s:po(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:po(o/2),a:po(r,2)}},j1=function(e){var t=KO(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},ov=function(e){var t=KO(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},Bse=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),a=r*(1-n),c=r*(1-(t-s)*n),d=r*(1-(1-t+s)*n),p=s%6;return{r:po(255*[r,c,a,a,d,r][p]),g:po(255*[d,r,r,c,a,a][p]),b:po(255*[a,a,d,r,r,c][p]),a:po(o,2)}},Fse=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),a=s-Math.min(t,n,r),c=a?s===t?(n-r)/a:s===n?2+(r-t)/a:4+(t-n)/a:0;return{h:po(60*(c<0?c+6:c)),s:po(s?a/s*100:0),v:po(s/255*100),a:o}},Hse=F.memo(function(e){var t=e.hue,n=e.onChange,r=rg(["react-colorful__hue",e.className]);return F.createElement("div",{className:r},F.createElement(Gy,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Oc(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":po(t),"aria-valuemax":"360","aria-valuemin":"0"},F.createElement(qy,{className:"react-colorful__hue-pointer",left:t/360,color:j1({h:t,s:100,v:100,a:1})})))}),Wse=F.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:j1({h:t.h,s:100,v:100,a:1})};return F.createElement("div",{className:"react-colorful__saturation",style:r},F.createElement(Gy,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Oc(t.s+100*o.left,0,100),v:Oc(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+po(t.s)+"%, Brightness "+po(t.v)+"%"},F.createElement(qy,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:j1(t)})))}),YO=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function Vse(e,t,n){var r=_1(n),o=f.useState(function(){return e.toHsva(t)}),s=o[0],a=o[1],c=f.useRef({color:t,hsva:s});f.useEffect(function(){if(!e.equal(t,c.current.color)){var p=e.toHsva(t);c.current={hsva:p,color:t},a(p)}},[t,e]),f.useEffect(function(){var p;YO(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=f.useCallback(function(p){a(function(h){return Object.assign({},h,p)})},[]);return[s,d]}var Use=typeof window<"u"?f.useLayoutEffect:f.useEffect,Gse=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},t_=new Map,qse=function(e){Use(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!t_.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}`,t_.set(t,n);var r=Gse();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},Kse=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+ov(Object.assign({},n,{a:0}))+", "+ov(Object.assign({},n,{a:1}))+")"},s=rg(["react-colorful__alpha",t]),a=po(100*n.a);return F.createElement("div",{className:s},F.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),F.createElement(Gy,{onMove:function(c){r({a:c.left})},onKey:function(c){r({a:Oc(n.a+c.left)})},"aria-label":"Alpha","aria-valuetext":a+"%","aria-valuenow":a,"aria-valuemin":"0","aria-valuemax":"100"},F.createElement(qy,{className:"react-colorful__alpha-pointer",left:n.a,color:ov(n)})))},Yse=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,a=qO(e,["className","colorModel","color","onChange"]),c=f.useRef(null);qse(c);var d=Vse(n,o,s),p=d[0],h=d[1],m=rg(["react-colorful",t]);return F.createElement("div",ng({},a,{ref:c,className:m}),F.createElement(Wse,{hsva:p,onChange:h}),F.createElement(Hse,{hue:p.h,onChange:h}),F.createElement(Kse,{hsva:p,onChange:h,className:"react-colorful__last-control"}))},Qse={defaultColor:{r:0,g:0,b:0,a:1},toHsva:Fse,fromHsva:Bse,equal:YO},QO=function(e){return F.createElement(Yse,ng({},e,{colorModel:Qse}))};const Xse=e=>{const{nodeId:t,field:n}=e,r=te(),o=s=>{r(Ts({nodeId:t,fieldName:n.name,value:s}))};return i.jsx(QO,{className:"nodrag",color:n.value,onChange:o})},Jse=f.memo(Xse),Zse=e=>null,eae=f.memo(Zse),tae=e=>null,nae=f.memo(tae),rae=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=U1(),a=f.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=f.useMemo(()=>{if(!s)return[];const p=[];return so(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:sr[h.base_model]})}),p},[s]),d=f.useCallback(p=>{if(!p)return;const h=TO(p);h&&o(Ts({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return i.jsx(Kr,{tooltip:a==null?void 0:a.description,label:(a==null?void 0:a.base_model)&&sr[a==null?void 0:a.base_model],value:(a==null?void 0:a.id)??null,placeholder:"Pick one",error:!a,data:c,onChange:d})},oae=f.memo(rae),sae=e=>{const{nodeId:t,field:n,template:r}=e,o=te(),s=a=>{o(Ts({nodeId:t,fieldName:n.name,value:a.target.value}))};return i.jsx(jP,{onChange:s,value:n.value,children:r.options.map(a=>i.jsx("option",{children:a},a))})},aae=f.memo(sae),iae=e=>{var c;const{nodeId:t,field:n}=e,r={id:`node-${t}-${n.name}`,actionType:"SET_MULTI_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}},{isOver:o,setNodeRef:s,active:a}=A1({id:`node_${t}`,data:r});return i.jsxs(W,{ref:s,sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",position:"relative",minH:"10rem"},children:[(c=n.value)==null?void 0:c.map(({image_name:d})=>i.jsx(cae,{imageName:d},d)),Ep(r,a)&&i.jsx(nh,{isOver:o})]})},lae=f.memo(iae),cae=e=>{const{currentData:t}=os(e.imageName);return i.jsx(yi,{imageDTO:t,isDropDisabled:!0,isDragDisabled:!0})},uae=e=>{var p;const{nodeId:t,field:n}=e,r=te(),{currentData:o}=os(((p=n.value)==null?void 0:p.image_name)??oo.skipToken),s=f.useCallback(()=>{r(Ts({nodeId:t,fieldName:n.name,value:void 0}))},[r,n.name,t]),a=f.useMemo(()=>{if(o)return{id:`node-${t}-${n.name}`,payloadType:"IMAGE_DTO",payload:{imageDTO:o}}},[n.name,o,t]),c=f.useMemo(()=>({id:`node-${t}-${n.name}`,actionType:"SET_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}}),[n.name,t]),d=f.useMemo(()=>({type:"SET_NODES_IMAGE",nodeId:t,fieldName:n.name}),[t,n.name]);return i.jsx(W,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:i.jsx(yi,{imageDTO:o,droppableData:c,draggableData:a,onClickReset:s,postUploadAction:d})})},dae=f.memo(uae),fae=e=>i.jsx(AH,{}),n_=f.memo(fae),pae=e=>null,hae=f.memo(pae),mae=e=>{const t=tm("models"),[n,r,o]=e.split("/"),s=wM.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},gae=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=q_(),a=f.useMemo(()=>{if(!s)return[];const p=[];return so(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:sr[h.base_model]})}),p.sort((h,m)=>h.disabled&&!m.disabled?1:-1)},[s]),c=f.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]),d=f.useCallback(p=>{if(!p)return;const h=mae(p);h&&o(Ts({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return(s==null?void 0:s.ids.length)===0?i.jsx(W,{sx:{justifyContent:"center",p:2},children:i.jsx(tt,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):i.jsx(ar,{value:(c==null?void 0:c.id)??null,label:(c==null?void 0:c.base_model)&&sr[c==null?void 0:c.base_model],placeholder:a.length>0?"Select a LoRA":"No LoRAs available",data:a,nothingFound:"No matching LoRAs",itemComponent:Oi,disabled:a.length===0,filter:(p,h)=>{var m;return((m=h.label)==null?void 0:m.toLowerCase().includes(p.toLowerCase().trim()))||h.value.toLowerCase().includes(p.toLowerCase().trim())},onChange:d})},vae=f.memo(gae),bae=e=>{var v,b;const{nodeId:t,field:n}=e,r=te(),{t:o}=be(),s=ir("syncModels").isFeatureEnabled,{data:a}=H_(),{data:c,isLoading:d}=na(W1),p=f.useMemo(()=>{if(!c)return[];const w=[];return so(c.entities,(y,S)=>{y&&w.push({value:S,label:y.model_name,group:sr[y.base_model]})}),a&&so(a.entities,(y,S)=>{y&&w.push({value:S,label:y.model_name,group:sr[y.base_model]})}),w},[c,a]),h=f.useMemo(()=>{var w,y,S,k;return((c==null?void 0:c.entities[`${(w=n.value)==null?void 0:w.base_model}/main/${(y=n.value)==null?void 0:y.model_name}`])||(a==null?void 0:a.entities[`${(S=n.value)==null?void 0:S.base_model}/onnx/${(k=n.value)==null?void 0:k.model_name}`]))??null},[(v=n.value)==null?void 0:v.base_model,(b=n.value)==null?void 0:b.model_name,c==null?void 0:c.entities,a==null?void 0:a.entities]),m=f.useCallback(w=>{if(!w)return;const y=Jm(w);y&&r(Ts({nodeId:t,fieldName:n.name,value:y}))},[r,n.name,t]);return d?i.jsx(ar,{label:o("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):i.jsxs(W,{w:"100%",alignItems:"center",gap:2,children:[i.jsx(ar,{tooltip:h==null?void 0:h.description,label:(h==null?void 0:h.base_model)&&sr[h==null?void 0:h.base_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}),s&&i.jsx(Re,{mt:7,children:i.jsx(Wd,{iconMode:!0})})]})},yae=f.memo(bae),xae=e=>{const{nodeId:t,field:n}=e,r=te(),[o,s]=f.useState(String(n.value)),a=c=>{s(c),c.match(Kh)||r(Ts({nodeId:t,fieldName:n.name,value:e.template.type==="integer"?Math.floor(Number(c)):Number(c)}))};return f.useEffect(()=>{!o.match(Kh)&&n.value!==Number(o)&&s(String(n.value))},[n.value,o]),i.jsxs(dm,{onChange:a,value:o,step:e.template.type==="integer"?1:.1,precision:e.template.type==="integer"?0:3,children:[i.jsx(pm,{}),i.jsxs(fm,{children:[i.jsx(mm,{}),i.jsx(hm,{})]})]})},wae=f.memo(xae),Sae=e=>{const{nodeId:t,field:n}=e,r=te(),o=s=>{r(Ts({nodeId:t,fieldName:n.name,value:s.target.value}))};return i.jsx(yd,{onChange:o,value:n.value})},Cae=f.memo(Sae),kae=e=>null,_ae=f.memo(kae),Pae=e=>null,jae=f.memo(Pae),Iae=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=W_(),a=f.useMemo(()=>{if(!s)return[];const p=[{value:"default",label:"Default",group:"Default"}];return so(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:sr[h.base_model]})}),p.sort((h,m)=>h.disabled&&!m.disabled?1:-1)},[s]),c=f.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=f.useCallback(p=>{if(!p)return;const h=jO(p);h&&o(Ts({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return i.jsx(ar,{itemComponent:Oi,tooltip:c==null?void 0:c.description,label:(c==null?void 0:c.base_model)&&sr[c==null?void 0:c.base_model],value:(c==null?void 0:c.id)??"default",placeholder:"Default",data:a,onChange:d,disabled:a.length===0,clearable:!0})},Eae=f.memo(Iae),Oae=e=>{var m,v;const{nodeId:t,field:n}=e,r=te(),{t:o}=be(),s=ir("syncModels").isFeatureEnabled,{data:a,isLoading:c}=na(V1),d=f.useMemo(()=>{if(!a)return[];const b=[];return so(a.entities,(w,y)=>{w&&b.push({value:y,label:w.model_name,group:sr[w.base_model]})}),b},[a]),p=f.useMemo(()=>{var b,w;return(a==null?void 0:a.entities[`${(b=n.value)==null?void 0:b.base_model}/main/${(w=n.value)==null?void 0:w.model_name}`])??null},[(m=n.value)==null?void 0:m.base_model,(v=n.value)==null?void 0:v.model_name,a==null?void 0:a.entities]),h=f.useCallback(b=>{if(!b)return;const w=Jm(b);w&&r(Ts({nodeId:t,fieldName:n.name,value:w}))},[r,n.name,t]);return c?i.jsx(ar,{label:o("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):i.jsxs(W,{w:"100%",alignItems:"center",gap:2,children:[i.jsx(ar,{tooltip:p==null?void 0:p.description,label:(p==null?void 0:p.base_model)&&sr[p==null?void 0:p.base_model],value:p==null?void 0:p.id,placeholder:d.length>0?"Select a model":"No models available",data:d,error:d.length===0,disabled:d.length===0,onChange:h}),s&&i.jsx(Re,{mt:7,children:i.jsx(Wd,{iconMode:!0})})]})},Rae=f.memo(Oae),Mae=e=>{const{nodeId:t,field:n,template:r}=e,{type:o}=n;return o==="string"&&r.type==="string"?i.jsx(Cae,{nodeId:t,field:n,template:r}):o==="boolean"&&r.type==="boolean"?i.jsx($se,{nodeId:t,field:n,template:r}):o==="integer"&&r.type==="integer"||o==="float"&&r.type==="float"?i.jsx(wae,{nodeId:t,field:n,template:r}):o==="enum"&&r.type==="enum"?i.jsx(aae,{nodeId:t,field:n,template:r}):o==="image"&&r.type==="image"?i.jsx(dae,{nodeId:t,field:n,template:r}):o==="latents"&&r.type==="latents"?i.jsx(hae,{nodeId:t,field:n,template:r}):o==="conditioning"&&r.type==="conditioning"?i.jsx(eae,{nodeId:t,field:n,template:r}):o==="unet"&&r.type==="unet"?i.jsx(_ae,{nodeId:t,field:n,template:r}):o==="clip"&&r.type==="clip"?i.jsx(Lse,{nodeId:t,field:n,template:r}):o==="vae"&&r.type==="vae"?i.jsx(jae,{nodeId:t,field:n,template:r}):o==="control"&&r.type==="control"?i.jsx(nae,{nodeId:t,field:n,template:r}):o==="model"&&r.type==="model"?i.jsx(yae,{nodeId:t,field:n,template:r}):o==="refiner_model"&&r.type==="refiner_model"?i.jsx(Rae,{nodeId:t,field:n,template:r}):o==="vae_model"&&r.type==="vae_model"?i.jsx(Eae,{nodeId:t,field:n,template:r}):o==="lora_model"&&r.type==="lora_model"?i.jsx(vae,{nodeId:t,field:n,template:r}):o==="controlnet_model"&&r.type==="controlnet_model"?i.jsx(oae,{nodeId:t,field:n,template:r}):o==="array"&&r.type==="array"?i.jsx(Ase,{nodeId:t,field:n,template:r}):o==="item"&&r.type==="item"?i.jsx(n_,{nodeId:t,field:n,template:r}):o==="color"&&r.type==="color"?i.jsx(Jse,{nodeId:t,field:n,template:r}):o==="item"&&r.type==="item"?i.jsx(n_,{nodeId:t,field:n,template:r}):o==="image_collection"&&r.type==="image_collection"?i.jsx(lae,{nodeId:t,field:n,template:r}):i.jsxs(Re,{p:2,children:["Unknown field type: ",o]})},Dae=f.memo(Mae);function Tae(e){const{nodeId:t,input:n,template:r,connected:o}=e,s=UO();return i.jsx(Re,{className:"nopan",position:"relative",borderColor:r?!o&&["always","connectionOnly"].includes(String(r==null?void 0:r.inputRequirement))&&n.value===void 0?"warning.400":void 0:"error.400",children:i.jsx(mo,{isDisabled:r?o:!0,pl:2,children:r?i.jsxs(i.Fragment,{children:[i.jsxs(di,{justifyContent:"space-between",alignItems:"center",children:[i.jsx(di,{children:i.jsx(wn,{label:r==null?void 0:r.description,placement:"top",hasArrow:!0,shouldWrapChildren:!0,openDelay:t3,children:i.jsx(zo,{children:r==null?void 0:r.title})})}),i.jsx(Dae,{nodeId:t,field:n,template:r})]}),!["never","directOnly"].includes((r==null?void 0:r.inputRequirement)??"")&&i.jsx(GO,{nodeId:t,field:r,isValidConnection:s,handleType:"target"})]}):i.jsx(di,{justifyContent:"space-between",alignItems:"center",children:i.jsxs(zo,{children:["Unknown input: ",n.name]})})})})}const Aae=e=>{const{nodeId:t,template:n,inputs:r}=e,o=L(a=>a.nodes.edges);return f.useCallback(()=>{const a=[],c=cs(r);return c.forEach((d,p)=>{const h=n.inputs[d.name],m=!!o.filter(v=>v.target===t&&v.targetHandle===d.name).length;p{const{nodeId:t,template:n,outputs:r}=e,o=L(a=>a.nodes.edges);return f.useCallback(()=>{const a=[];return cs(r).forEach(d=>{const p=n.outputs[d.name],h=!!o.filter(m=>m.source===t&&m.sourceHandle===d.name).length;a.push(i.jsx($ae,{nodeId:t,output:d,template:p,connected:h},d.id))}),i.jsx(W,{flexDir:"column",children:a})},[o,t,r,n.outputs])()},Lae=f.memo(zae),Bae=e=>{const{...t}=e;return i.jsx(RT,{style:{position:"absolute",border:"none",background:"transparent",width:15,height:15,bottom:0,right:0},minWidth:r3,...t})},I1=f.memo(Bae),E1=e=>{const[t,n]=Dc("shadows",["nodeSelectedOutline","dark-lg"]),r=L(o=>o.hotkeys.shift);return i.jsx(Re,{className:r?Uy:"nopan",sx:{position:"relative",borderRadius:"md",minWidth:r3,shadow:e.selected?`${t}, ${n}`:`${n}`},children:e.children})},XO=f.memo(e=>{const{id:t,data:n,selected:r}=e,{type:o,inputs:s,outputs:a}=n,c=f.useMemo(()=>_se(o),[o]),d=L(c);return d?i.jsxs(E1,{selected:r,children:[i.jsx(VO,{nodeId:t,title:d.title,description:d.description}),i.jsxs(W,{className:"nopan",sx:{cursor:"auto",flexDirection:"column",borderBottomRadius:"md",py:2,bg:"base.150",_dark:{bg:"base.800"}},children:[i.jsx(Lae,{nodeId:t,outputs:a,template:d}),i.jsx(Nae,{nodeId:t,inputs:s,template:d})]}),i.jsx(I1,{})]}):i.jsx(E1,{selected:r,children:i.jsxs(W,{className:"nopan",sx:{alignItems:"center",justifyContent:"center",cursor:"auto"},children:[i.jsx(no,{as:g6,sx:{boxSize:32,color:"base.600",_dark:{color:"base.400"}}}),i.jsx(I1,{})]})})});XO.displayName="InvocationComponent";const Fae=e=>{const t=sw(a=>a.system.progressImage),n=sw(a=>a.nodes.progressNodeSize),r=SM(),{selected:o}=e,s=(a,c)=>{r(CM(c))};return i.jsxs(E1,{selected:o,children:[i.jsx(VO,{title:"Progress Image",description:"Displays the progress image in the Node Editor"}),i.jsx(W,{sx:{flexDirection:"column",flexShrink:0,borderBottomRadius:"md",bg:"base.200",_dark:{bg:"base.800"},width:n.width-2,height:n.height-2,minW:250,minH:250,overflow:"hidden"},children:t?i.jsx(Tc,{src:t.dataURL,sx:{w:"full",h:"full",objectFit:"contain"}}):i.jsx(W,{sx:{minW:250,minH:250,width:n.width-2,height:n.height-2},children:i.jsx(mi,{})})}),i.jsx(I1,{onResize:s})]})},Hae=f.memo(Fae),Wae=()=>{const{t:e}=be(),{zoomIn:t,zoomOut:n,fitView:r}=G1(),o=te(),s=L(w=>w.nodes.shouldShowGraphOverlay),a=L(w=>w.nodes.shouldShowFieldTypeLegend),c=L(w=>w.nodes.shouldShowMinimapPanel),d=f.useCallback(()=>{t()},[t]),p=f.useCallback(()=>{n()},[n]),h=f.useCallback(()=>{r()},[r]),m=f.useCallback(()=>{o(kM(!s))},[s,o]),v=f.useCallback(()=>{o(_M(!a))},[a,o]),b=f.useCallback(()=>{o(PM(!c))},[c,o]);return i.jsxs(nr,{isAttached:!0,orientation:"vertical",children:[i.jsx(wn,{label:e("nodes.zoomInNodes"),children:i.jsx(Fe,{"aria-label":"Zoom in ",onClick:d,icon:i.jsx(ml,{})})}),i.jsx(wn,{label:e("nodes.zoomOutNodes"),children:i.jsx(Fe,{"aria-label":"Zoom out",onClick:p,icon:i.jsx(lW,{})})}),i.jsx(wn,{label:e("nodes.fitViewportNodes"),children:i.jsx(Fe,{"aria-label":"Fit viewport",onClick:h,icon:i.jsx(YH,{})})}),i.jsx(wn,{label:e(s?"nodes.hideGraphNodes":"nodes.showGraphNodes"),children:i.jsx(Fe,{"aria-label":"Toggle nodes graph overlay",isChecked:s,onClick:m,icon:i.jsx(Lb,{})})}),i.jsx(wn,{label:e(a?"nodes.hideLegendNodes":"nodes.showLegendNodes"),children:i.jsx(Fe,{"aria-label":"Toggle field type legend",isChecked:a,onClick:v,icon:i.jsx(rW,{})})}),i.jsx(wn,{label:e(c?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),children:i.jsx(Fe,{"aria-label":"Toggle minimap",isChecked:c,onClick:b,icon:i.jsx(aW,{})})})]})},Vae=f.memo(Wae),Uae=()=>i.jsx(ld,{position:"bottom-left",children:i.jsx(Vae,{})}),Gae=f.memo(Uae),qae=()=>{const e=vp({background:"var(--invokeai-colors-base-200)"},{background:"var(--invokeai-colors-base-500)"}),t=L(o=>o.nodes.shouldShowMinimapPanel),n=vp("var(--invokeai-colors-accent-300)","var(--invokeai-colors-accent-700)"),r=vp("var(--invokeai-colors-blackAlpha-300)","var(--invokeai-colors-blackAlpha-600)");return i.jsx(i.Fragment,{children:t&&i.jsx(wT,{nodeStrokeWidth:3,pannable:!0,zoomable:!0,nodeBorderRadius:30,style:e,nodeColor:n,maskColor:r})})},Kae=f.memo(qae),Yae=()=>{const{t:e}=be(),t=te(),{isOpen:n,onOpen:r,onClose:o}=ss(),s=f.useRef(null),a=L(d=>d.nodes.nodes),c=f.useCallback(()=>{t(jM()),t(Dn(Bn({title:e("toast.nodesCleared"),status:"success"}))),o()},[t,e,o]);return i.jsxs(i.Fragment,{children:[i.jsx(Fe,{icon:i.jsx(us,{}),tooltip:e("nodes.clearGraph"),"aria-label":e("nodes.clearGraph"),onClick:r,isDisabled:a.length===0}),i.jsxs(_d,{isOpen:n,onClose:o,leastDestructiveRef:s,isCentered:!0,children:[i.jsx(Da,{}),i.jsxs(Pd,{children:[i.jsx(Ma,{fontSize:"lg",fontWeight:"bold",children:e("nodes.clearGraph")}),i.jsx(Ta,{children:i.jsx(tt,{children:e("nodes.clearGraphDesc")})}),i.jsxs(Ra,{children:[i.jsx(gc,{ref:s,onClick:o,children:e("common.cancel")}),i.jsx(gc,{colorScheme:"red",ml:3,onClick:c,children:e("common.accept")})]})]})]})]})},Qae=f.memo(Yae);function Xae(e){const t=["nodes","edges","viewport"];for(const s of t)if(!(s in e))return{isValid:!1,message:Ln.t("toast.nodesNotValidGraph")};if(!Array.isArray(e.nodes)||!Array.isArray(e.edges))return{isValid:!1,message:Ln.t("toast.nodesNotValidGraph")};const n=["data","type"],r=["invocation","progress_image"];if(e.nodes.length>0)for(const s of e.nodes)for(const a of n){if(!(a in s))return{isValid:!1,message:Ln.t("toast.nodesNotValidGraph")};if(a==="type"&&!r.includes(s[a]))return{isValid:!1,message:Ln.t("toast.nodesUnrecognizedTypes")}}const o=["source","sourceHandle","target","targetHandle"];if(e.edges.length>0){for(const s of e.edges)for(const a of o)if(!(a in s))return{isValid:!1,message:Ln.t("toast.nodesBrokenConnections")}}return{isValid:!0,message:Ln.t("toast.nodesLoaded")}}const Jae=()=>{const{t:e}=be(),t=te(),{fitView:n}=G1(),r=f.useRef(null),o=f.useCallback(s=>{var c;if(!s)return;const a=new FileReader;a.onload=async()=>{const d=a.result;try{const p=await JSON.parse(String(d)),{isValid:h,message:m}=Xae(p);h?(t(IM(p.nodes)),t(EM(p.edges)),n(),t(Dn(Bn({title:m,status:"success"})))):t(Dn(Bn({title:m,status:"error"}))),a.abort()}catch(p){p&&t(Dn(Bn({title:e("toast.nodesNotValidJSON"),status:"error"})))}},a.readAsText(s),(c=r.current)==null||c.call(r)},[n,t,e]);return i.jsx(vE,{resetRef:r,accept:"application/json",onChange:o,children:s=>i.jsx(Fe,{icon:i.jsx(Rd,{}),tooltip:e("nodes.loadGraph"),"aria-label":e("nodes.loadGraph"),...s})})},Zae=f.memo(Jae);function eie(e){const{iconButton:t=!1,...n}=e,r=te(),o=L(Kn),s=Bd(),a=f.useCallback(()=>{r(fd("nodes"))},[r]),{t:c}=be();return nt(["ctrl+enter","meta+enter"],a,{enabled:()=>s,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[s,o]),i.jsx(Re,{style:{flexGrow:4},position:"relative",children:i.jsxs(Re,{style:{position:"relative"},children:[!s&&i.jsx(Re,{borderRadius:"base",style:{position:"absolute",bottom:"0",left:"0",right:"0",height:"100%",overflow:"clip"},children:i.jsx(CO,{})}),t?i.jsx(Fe,{"aria-label":c("parameters.invoke"),type:"submit",icon:i.jsx(w6,{}),isDisabled:!s,onClick:a,flexGrow:1,w:"100%",tooltip:c("parameters.invoke"),tooltipProps:{placement:"bottom"},colorScheme:"accent",id:"invoke-button",_disabled:{background:"none",_hover:{background:"none"}},...n}):i.jsx(rn,{"aria-label":c("parameters.invoke"),type:"submit",isDisabled:!s,onClick:a,flexGrow:1,w:"100%",colorScheme:"accent",id:"invoke-button",fontWeight:700,_disabled:{background:"none",_hover:{background:"none"}},...n,children:"Invoke"})]})})}function tie(){const{t:e}=be(),t=te(),n=f.useCallback(()=>{t(OM())},[t]);return i.jsx(Fe,{icon:i.jsx(hW,{}),tooltip:e("nodes.reloadSchema"),"aria-label":e("nodes.reloadSchema"),onClick:n})}const nie=()=>{const{t:e}=be(),t=L(o=>o.nodes.editorInstance),n=L(o=>o.nodes.nodes),r=f.useCallback(()=>{if(t){const o=t.toObject();o.edges=cs(o.edges,c=>RM(c,["style"]));const s=new Blob([JSON.stringify(o)]),a=document.createElement("a");a.href=URL.createObjectURL(s),a.download="MyNodes.json",document.body.appendChild(a),a.click(),a.remove()}},[t]);return i.jsx(Fe,{icon:i.jsx(_m,{}),fontSize:18,tooltip:e("nodes.saveGraph"),"aria-label":e("nodes.saveGraph"),onClick:r,isDisabled:n.length===0})},rie=f.memo(nie),oie=()=>i.jsx(ld,{position:"top-center",children:i.jsxs(di,{children:[i.jsx(eie,{}),i.jsx(Xm,{}),i.jsx(tie,{}),i.jsx(rie,{}),i.jsx(Zae,{}),i.jsx(Qae,{})]})}),sie=f.memo(oie),aie=fe([Ye],({nodes:e})=>{const t=cs(e.invocationTemplates,n=>({label:n.title,value:n.type,description:n.description}));return t.push({label:"Progress Image",value:"progress_image",description:"Displays the progress image in the Node Editor"}),{data:t}},Ge),iie=()=>{const e=te(),{data:t}=L(aie),n=Ise(),r=Fc(),o=f.useCallback(a=>{const c=n(a);if(!c){r({status:"error",title:`Unknown Invocation type ${a}`});return}e(MM(c))},[e,n,r]),s=f.useCallback(a=>{a&&o(a)},[o]);return i.jsx(W,{sx:{gap:2,alignItems:"center"},children:i.jsx(ar,{selectOnBlur:!1,placeholder:"Add Node",value:null,data:t,maxDropdownHeight:400,nothingFound:"No matching nodes",itemComponent:JO,filter:(a,c)=>c.label.toLowerCase().includes(a.toLowerCase().trim())||c.value.toLowerCase().includes(a.toLowerCase().trim())||c.description.toLowerCase().includes(a.toLowerCase().trim()),onChange:s,sx:{width:"18rem"}})})},JO=f.forwardRef(({label:e,description:t,...n},r)=>i.jsx("div",{ref:r,...n,children:i.jsxs("div",{children:[i.jsx(tt,{fontWeight:600,children:e}),i.jsx(tt,{size:"xs",sx:{color:"base.600",_dark:{color:"base.500"}},children:t})]})}));JO.displayName="SelectItem";const lie=()=>i.jsx(ld,{position:"top-left",children:i.jsx(iie,{})}),cie=f.memo(lie),uie=()=>i.jsx(W,{sx:{gap:2,flexDir:"column"},children:cs(n3,({title:e,description:t,color:n},r)=>i.jsx(wn,{label:t,children:i.jsx(pl,{colorScheme:n,sx:{userSelect:"none"},textAlign:"center",children:e})},r))}),die=f.memo(uie),fie=()=>{const e=L(n=>n),t=DM(e);return i.jsx(Re,{as:"pre",sx:{fontFamily:"monospace",position:"absolute",top:2,right:2,opacity:.7,p:2,maxHeight:500,maxWidth:500,overflowY:"scroll",borderRadius:"base",bg:"base.200",_dark:{bg:"base.800"}},children:JSON.stringify(t,null,2)})},pie=f.memo(fie),hie=()=>{const e=L(n=>n.nodes.shouldShowGraphOverlay),t=L(n=>n.nodes.shouldShowFieldTypeLegend);return i.jsxs(ld,{position:"top-right",children:[t&&i.jsx(die,{}),e&&i.jsx(pie,{})]})},mie=f.memo(hie),gie={invocation:XO,progress_image:Hae},vie=()=>{const e=te(),t=L(p=>p.nodes.nodes),n=L(p=>p.nodes.edges),r=f.useCallback(p=>{e(TM(p))},[e]),o=f.useCallback(p=>{e(AM(p))},[e]),s=f.useCallback((p,h)=>{e(NM(h))},[e]),a=f.useCallback(p=>{e($M(p))},[e]),c=f.useCallback(()=>{e(zM())},[e]),d=f.useCallback(p=>{e(LM(p)),p&&p.fitView()},[e]);return i.jsxs(BM,{nodeTypes:gie,nodes:t,edges:n,onNodesChange:r,onEdgesChange:o,onConnectStart:s,onConnect:a,onConnectEnd:c,onInit:d,defaultEdgeOptions:{style:{strokeWidth:2}},children:[i.jsx(cie,{}),i.jsx(sie,{}),i.jsx(mie,{}),i.jsx(Gae,{}),i.jsx(jT,{}),i.jsx(Kae,{})]})},bie=()=>i.jsx(Re,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base"},children:i.jsx(FM,{children:i.jsx(vie,{})})}),yie=f.memo(bie),xie=()=>i.jsx(yie,{}),wie=f.memo(xie),Sie=fe(Ye,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},Ge),Cie=()=>{const{shouldUseSliders:e,activeLabel:t}=L(Sie);return i.jsx(Oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:i.jsx(W,{sx:{flexDirection:"column",gap:3},children:e?i.jsxs(i.Fragment,{children:[i.jsx(wi,{}),i.jsx(Ci,{}),i.jsx(xi,{}),i.jsx(Si,{}),i.jsx(Re,{pt:2,children:i.jsx(ki,{})}),i.jsx(Ic,{})]}):i.jsxs(i.Fragment,{children:[i.jsxs(W,{gap:3,children:[i.jsx(wi,{}),i.jsx(Ci,{}),i.jsx(xi,{})]}),i.jsx(Si,{}),i.jsx(Re,{pt:2,children:i.jsx(ki,{})}),i.jsx(Ic,{})]})})})},ZO=f.memo(Cie),kie=()=>i.jsxs(i.Fragment,{children:[i.jsx(Fd,{}),i.jsx(_O,{}),i.jsx(Ld,{}),i.jsx(kO,{}),i.jsx(Hd,{}),i.jsx(ZO,{}),i.jsx(PO,{}),i.jsx(zd,{}),i.jsx(Qm,{})]}),e8=()=>i.jsxs(i.Fragment,{children:[i.jsx(Fd,{}),i.jsx(Ld,{}),i.jsx(Hd,{}),i.jsx(ZO,{}),i.jsx(Hy,{}),i.jsx(By,{}),i.jsx(zd,{}),i.jsx(Qm,{}),i.jsx(Wy,{}),i.jsx(AO,{}),i.jsx(Fy,{})]}),_ie=()=>{const e=L(t=>t.generation.model);return i.jsxs(W,{sx:{gap:4,w:"full",h:"full"},children:[i.jsx(Ly,{children:e&&e.base_model==="sdxl"?i.jsx(kie,{}):i.jsx(e8,{})}),i.jsx(DO,{})]})},Pie=f.memo(_ie);var O1={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var n=aw;Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return n.Konva}});const r=aw;e.exports=r.Konva})(O1,O1.exports);var jie=O1.exports;const id=ud(jie);var t8={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 Iie=function(t){var n={},r=f,o=bp,s=Object.assign;function a(l){for(var u="https://reactjs.org/docs/error-decoder.html?invariant="+l,g=1;gJ||C[N]!==j[J]){var ue=` +`+C[N].replace(" at new "," at ");return l.displayName&&ue.includes("")&&(ue=ue.replace("",l.displayName)),ue}while(1<=N&&0<=J);break}}}finally{qt=!1,Error.prepareStackTrace=g}return(l=l?l.displayName||l.name:"")?Nt(l):""}var Zt=Object.prototype.hasOwnProperty,Ut=[],Le=-1;function yt(l){return{current:l}}function Mt(l){0>Le||(l.current=Ut[Le],Ut[Le]=null,Le--)}function Wt(l,u){Le++,Ut[Le]=l.current,l.current=u}var jn={},Gt=yt(jn),un=yt(!1),sn=jn;function Ir(l,u){var g=l.type.contextTypes;if(!g)return jn;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===u)return x.__reactInternalMemoizedMaskedChildContext;var C={},j;for(j in g)C[j]=u[j];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=u,l.__reactInternalMemoizedMaskedChildContext=C),C}function Xn(l){return l=l.childContextTypes,l!=null}function It(){Mt(un),Mt(Gt)}function In(l,u,g){if(Gt.current!==jn)throw Error(a(168));Wt(Gt,u),Wt(un,g)}function On(l,u,g){var x=l.stateNode;if(u=u.childContextTypes,typeof x.getChildContext!="function")return g;x=x.getChildContext();for(var C in x)if(!(C in u))throw Error(a(108,M(l)||"Unknown",C));return s({},g,x)}function Jn(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||jn,sn=Gt.current,Wt(Gt,l),Wt(un,un.current),!0}function mr(l,u,g){var x=l.stateNode;if(!x)throw Error(a(169));g?(l=On(l,u,sn),x.__reactInternalMemoizedMergedChildContext=l,Mt(un),Mt(Gt),Wt(Gt,l)):Mt(un),Wt(un,g)}var Tn=Math.clz32?Math.clz32:Sn,An=Math.log,dn=Math.LN2;function Sn(l){return l>>>=0,l===0?32:31-(An(l)/dn|0)|0}var En=64,vn=4194304;function bn(l){switch(l&-l){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 l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function Ke(l,u){var g=l.pendingLanes;if(g===0)return 0;var x=0,C=l.suspendedLanes,j=l.pingedLanes,N=g&268435455;if(N!==0){var J=N&~C;J!==0?x=bn(J):(j&=N,j!==0&&(x=bn(j)))}else N=g&~C,N!==0?x=bn(N):j!==0&&(x=bn(j));if(x===0)return 0;if(u!==0&&u!==x&&!(u&C)&&(C=x&-x,j=u&-u,C>=j||C===16&&(j&4194240)!==0))return u;if(x&4&&(x|=g&16),u=l.entangledLanes,u!==0)for(l=l.entanglements,u&=x;0g;g++)u.push(l);return u}function mt(l,u,g){l.pendingLanes|=u,u!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,u=31-Tn(u),l[u]=g}function ot(l,u){var g=l.pendingLanes&~u;l.pendingLanes=u,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=u,l.mutableReadLanes&=u,l.entangledLanes&=u,u=l.entanglements;var x=l.eventTimes;for(l=l.expirationTimes;0>=N,C-=N,Do=1<<32-Tn(u)+C|g<Cn?(Lr=Xt,Xt=null):Lr=Xt.sibling;var kn=it(ce,Xt,ve[Cn],lt);if(kn===null){Xt===null&&(Xt=Lr);break}l&&Xt&&kn.alternate===null&&u(ce,Xt),ne=j(kn,ne,Cn),nn===null?Tt=kn:nn.sibling=kn,nn=kn,Xt=Lr}if(Cn===ve.length)return g(ce,Xt),Zn&&Ti(ce,Cn),Tt;if(Xt===null){for(;CnCn?(Lr=Xt,Xt=null):Lr=Xt.sibling;var Ja=it(ce,Xt,kn.value,lt);if(Ja===null){Xt===null&&(Xt=Lr);break}l&&Xt&&Ja.alternate===null&&u(ce,Xt),ne=j(Ja,ne,Cn),nn===null?Tt=Ja:nn.sibling=Ja,nn=Ja,Xt=Lr}if(kn.done)return g(ce,Xt),Zn&&Ti(ce,Cn),Tt;if(Xt===null){for(;!kn.done;Cn++,kn=ve.next())kn=Qt(ce,kn.value,lt),kn!==null&&(ne=j(kn,ne,Cn),nn===null?Tt=kn:nn.sibling=kn,nn=kn);return Zn&&Ti(ce,Cn),Tt}for(Xt=x(ce,Xt);!kn.done;Cn++,kn=ve.next())kn=Qn(Xt,ce,Cn,kn.value,lt),kn!==null&&(l&&kn.alternate!==null&&Xt.delete(kn.key===null?Cn:kn.key),ne=j(kn,ne,Cn),nn===null?Tt=kn:nn.sibling=kn,nn=kn);return l&&Xt.forEach(function(Q8){return u(ce,Q8)}),Zn&&Ti(ce,Cn),Tt}function va(ce,ne,ve,lt){if(typeof ve=="object"&&ve!==null&&ve.type===h&&ve.key===null&&(ve=ve.props.children),typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case d:e:{for(var Tt=ve.key,nn=ne;nn!==null;){if(nn.key===Tt){if(Tt=ve.type,Tt===h){if(nn.tag===7){g(ce,nn.sibling),ne=C(nn,ve.props.children),ne.return=ce,ce=ne;break e}}else if(nn.elementType===Tt||typeof Tt=="object"&&Tt!==null&&Tt.$$typeof===I&&dx(Tt)===nn.type){g(ce,nn.sibling),ne=C(nn,ve.props),ne.ref=Qc(ce,nn,ve),ne.return=ce,ce=ne;break e}g(ce,nn);break}else u(ce,nn);nn=nn.sibling}ve.type===h?(ne=Fi(ve.props.children,ce.mode,lt,ve.key),ne.return=ce,ce=ne):(lt=_f(ve.type,ve.key,ve.props,null,ce.mode,lt),lt.ref=Qc(ce,ne,ve),lt.return=ce,ce=lt)}return N(ce);case p:e:{for(nn=ve.key;ne!==null;){if(ne.key===nn)if(ne.tag===4&&ne.stateNode.containerInfo===ve.containerInfo&&ne.stateNode.implementation===ve.implementation){g(ce,ne.sibling),ne=C(ne,ve.children||[]),ne.return=ce,ce=ne;break e}else{g(ce,ne);break}else u(ce,ne);ne=ne.sibling}ne=s0(ve,ce.mode,lt),ne.return=ce,ce=ne}return N(ce);case I:return nn=ve._init,va(ce,ne,nn(ve._payload),lt)}if(q(ve))return $n(ce,ne,ve,lt);if(O(ve))return xo(ce,ne,ve,lt);Jd(ce,ve)}return typeof ve=="string"&&ve!==""||typeof ve=="number"?(ve=""+ve,ne!==null&&ne.tag===6?(g(ce,ne.sibling),ne=C(ne,ve),ne.return=ce,ce=ne):(g(ce,ne),ne=o0(ve,ce.mode,lt),ne.return=ce,ce=ne),N(ce)):g(ce,ne)}return va}var kl=fx(!0),px=fx(!1),Xc={},Uo=yt(Xc),Jc=yt(Xc),_l=yt(Xc);function Fs(l){if(l===Xc)throw Error(a(174));return l}function bg(l,u){Wt(_l,u),Wt(Jc,l),Wt(Uo,Xc),l=D(u),Mt(Uo),Wt(Uo,l)}function Pl(){Mt(Uo),Mt(Jc),Mt(_l)}function hx(l){var u=Fs(_l.current),g=Fs(Uo.current);u=z(g,l.type,u),g!==u&&(Wt(Jc,l),Wt(Uo,u))}function yg(l){Jc.current===l&&(Mt(Uo),Mt(Jc))}var ur=yt(0);function Zd(l){for(var u=l;u!==null;){if(u.tag===13){var g=u.memoizedState;if(g!==null&&(g=g.dehydrated,g===null||Nr(g)||$s(g)))return u}else if(u.tag===19&&u.memoizedProps.revealOrder!==void 0){if(u.flags&128)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===l)break;for(;u.sibling===null;){if(u.return===null||u.return===l)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var xg=[];function wg(){for(var l=0;lg?g:4,l(!0);var x=Sg.transition;Sg.transition={};try{l(!1),u()}finally{Ie=g,Sg.transition=x}}function Mx(){return Go().memoizedState}function C8(l,u,g){var x=Ya(l);if(g={lane:x,action:g,hasEagerState:!1,eagerState:null,next:null},Dx(l))Tx(u,g);else if(g=rx(l,u,g,x),g!==null){var C=eo();qo(g,l,x,C),Ax(g,u,x)}}function k8(l,u,g){var x=Ya(l),C={lane:x,action:g,hasEagerState:!1,eagerState:null,next:null};if(Dx(l))Tx(u,C);else{var j=l.alternate;if(l.lanes===0&&(j===null||j.lanes===0)&&(j=u.lastRenderedReducer,j!==null))try{var N=u.lastRenderedState,J=j(N,g);if(C.hasEagerState=!0,C.eagerState=J,fn(J,N)){var ue=u.interleaved;ue===null?(C.next=C,hg(u)):(C.next=ue.next,ue.next=C),u.interleaved=C;return}}catch{}finally{}g=rx(l,u,C,x),g!==null&&(C=eo(),qo(g,l,x,C),Ax(g,u,x))}}function Dx(l){var u=l.alternate;return l===dr||u!==null&&u===dr}function Tx(l,u){Zc=tf=!0;var g=l.pending;g===null?u.next=u:(u.next=g.next,g.next=u),l.pending=u}function Ax(l,u,g){if(g&4194240){var x=u.lanes;x&=l.pendingLanes,g|=x,u.lanes=g,Oe(l,g)}}var of={readContext:Vo,useCallback:Xr,useContext:Xr,useEffect:Xr,useImperativeHandle:Xr,useInsertionEffect:Xr,useLayoutEffect:Xr,useMemo:Xr,useReducer:Xr,useRef:Xr,useState:Xr,useDebugValue:Xr,useDeferredValue:Xr,useTransition:Xr,useMutableSource:Xr,useSyncExternalStore:Xr,useId:Xr,unstable_isNewReconciler:!1},_8={readContext:Vo,useCallback:function(l,u){return Hs().memoizedState=[l,u===void 0?null:u],l},useContext:Vo,useEffect:kx,useImperativeHandle:function(l,u,g){return g=g!=null?g.concat([l]):null,nf(4194308,4,jx.bind(null,u,l),g)},useLayoutEffect:function(l,u){return nf(4194308,4,l,u)},useInsertionEffect:function(l,u){return nf(4,2,l,u)},useMemo:function(l,u){var g=Hs();return u=u===void 0?null:u,l=l(),g.memoizedState=[l,u],l},useReducer:function(l,u,g){var x=Hs();return u=g!==void 0?g(u):u,x.memoizedState=x.baseState=u,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},x.queue=l,l=l.dispatch=C8.bind(null,dr,l),[x.memoizedState,l]},useRef:function(l){var u=Hs();return l={current:l},u.memoizedState=l},useState:Sx,useDebugValue:Eg,useDeferredValue:function(l){return Hs().memoizedState=l},useTransition:function(){var l=Sx(!1),u=l[0];return l=S8.bind(null,l[1]),Hs().memoizedState=l,[u,l]},useMutableSource:function(){},useSyncExternalStore:function(l,u,g){var x=dr,C=Hs();if(Zn){if(g===void 0)throw Error(a(407));g=g()}else{if(g=u(),zr===null)throw Error(a(349));Ni&30||vx(x,u,g)}C.memoizedState=g;var j={value:g,getSnapshot:u};return C.queue=j,kx(yx.bind(null,x,j,l),[l]),x.flags|=2048,nu(9,bx.bind(null,x,j,g,u),void 0,null),g},useId:function(){var l=Hs(),u=zr.identifierPrefix;if(Zn){var g=Qr,x=Do;g=(x&~(1<<32-Tn(x)-1)).toString(32)+g,u=":"+u+"R"+g,g=eu++,0Qg&&(u.flags|=128,x=!0,su(C,!1),u.lanes=4194304)}else{if(!x)if(l=Zd(j),l!==null){if(u.flags|=128,x=!0,l=l.updateQueue,l!==null&&(u.updateQueue=l,u.flags|=4),su(C,!0),C.tail===null&&C.tailMode==="hidden"&&!j.alternate&&!Zn)return Jr(u),null}else 2*Ve()-C.renderingStartTime>Qg&&g!==1073741824&&(u.flags|=128,x=!0,su(C,!1),u.lanes=4194304);C.isBackwards?(j.sibling=u.child,u.child=j):(l=C.last,l!==null?l.sibling=j:u.child=j,C.last=j)}return C.tail!==null?(u=C.tail,C.rendering=u,C.tail=u.sibling,C.renderingStartTime=Ve(),u.sibling=null,l=ur.current,Wt(ur,x?l&1|2:l&1),u):(Jr(u),null);case 22:case 23:return t0(),g=u.memoizedState!==null,l!==null&&l.memoizedState!==null!==g&&(u.flags|=8192),g&&u.mode&1?Ao&1073741824&&(Jr(u),le&&u.subtreeFlags&6&&(u.flags|=8192)):Jr(u),null;case 24:return null;case 25:return null}throw Error(a(156,u.tag))}function D8(l,u){switch(ag(u),u.tag){case 1:return Xn(u.type)&&It(),l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 3:return Pl(),Mt(un),Mt(Gt),wg(),l=u.flags,l&65536&&!(l&128)?(u.flags=l&-65537|128,u):null;case 5:return yg(u),null;case 13:if(Mt(ur),l=u.memoizedState,l!==null&&l.dehydrated!==null){if(u.alternate===null)throw Error(a(340));wl()}return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 19:return Mt(ur),null;case 4:return Pl(),null;case 10:return fg(u.type._context),null;case 22:case 23:return t0(),null;case 24:return null;default:return null}}var uf=!1,Zr=!1,T8=typeof WeakSet=="function"?WeakSet:Set,pt=null;function Il(l,u){var g=l.ref;if(g!==null)if(typeof g=="function")try{g(null)}catch(x){er(l,u,x)}else g.current=null}function zg(l,u,g){try{g()}catch(x){er(l,u,x)}}var e2=!1;function A8(l,u){for(H(l.containerInfo),pt=u;pt!==null;)if(l=pt,u=l.child,(l.subtreeFlags&1028)!==0&&u!==null)u.return=l,pt=u;else for(;pt!==null;){l=pt;try{var g=l.alternate;if(l.flags&1024)switch(l.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var x=g.memoizedProps,C=g.memoizedState,j=l.stateNode,N=j.getSnapshotBeforeUpdate(l.elementType===l.type?x:ms(l.type,x),C);j.__reactInternalSnapshotBeforeUpdate=N}break;case 3:le&&ln(l.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(J){er(l,l.return,J)}if(u=l.sibling,u!==null){u.return=l.return,pt=u;break}pt=l.return}return g=e2,e2=!1,g}function au(l,u,g){var x=u.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var C=x=x.next;do{if((C.tag&l)===l){var j=C.destroy;C.destroy=void 0,j!==void 0&&zg(u,g,j)}C=C.next}while(C!==x)}}function df(l,u){if(u=u.updateQueue,u=u!==null?u.lastEffect:null,u!==null){var g=u=u.next;do{if((g.tag&l)===l){var x=g.create;g.destroy=x()}g=g.next}while(g!==u)}}function Lg(l){var u=l.ref;if(u!==null){var g=l.stateNode;switch(l.tag){case 5:l=G(g);break;default:l=g}typeof u=="function"?u(l):u.current=l}}function t2(l){var u=l.alternate;u!==null&&(l.alternate=null,t2(u)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(u=l.stateNode,u!==null&&Ee(u)),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function n2(l){return l.tag===5||l.tag===3||l.tag===4}function r2(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||n2(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Bg(l,u,g){var x=l.tag;if(x===5||x===6)l=l.stateNode,u?Pn(g,l,u):ht(g,l);else if(x!==4&&(l=l.child,l!==null))for(Bg(l,u,g),l=l.sibling;l!==null;)Bg(l,u,g),l=l.sibling}function Fg(l,u,g){var x=l.tag;if(x===5||x===6)l=l.stateNode,u?qe(g,l,u):we(g,l);else if(x!==4&&(l=l.child,l!==null))for(Fg(l,u,g),l=l.sibling;l!==null;)Fg(l,u,g),l=l.sibling}var Ur=null,gs=!1;function Vs(l,u,g){for(g=g.child;g!==null;)Hg(l,u,g),g=g.sibling}function Hg(l,u,g){if(gn&&typeof gn.onCommitFiberUnmount=="function")try{gn.onCommitFiberUnmount(Yn,g)}catch{}switch(g.tag){case 5:Zr||Il(g,u);case 6:if(le){var x=Ur,C=gs;Ur=null,Vs(l,u,g),Ur=x,gs=C,Ur!==null&&(gs?Je(Ur,g.stateNode):Pe(Ur,g.stateNode))}else Vs(l,u,g);break;case 18:le&&Ur!==null&&(gs?He(Ur,g.stateNode):xt(Ur,g.stateNode));break;case 4:le?(x=Ur,C=gs,Ur=g.stateNode.containerInfo,gs=!0,Vs(l,u,g),Ur=x,gs=C):(ge&&(x=g.stateNode.containerInfo,C=br(x),Wn(x,C)),Vs(l,u,g));break;case 0:case 11:case 14:case 15:if(!Zr&&(x=g.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){C=x=x.next;do{var j=C,N=j.destroy;j=j.tag,N!==void 0&&(j&2||j&4)&&zg(g,u,N),C=C.next}while(C!==x)}Vs(l,u,g);break;case 1:if(!Zr&&(Il(g,u),x=g.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=g.memoizedProps,x.state=g.memoizedState,x.componentWillUnmount()}catch(J){er(g,u,J)}Vs(l,u,g);break;case 21:Vs(l,u,g);break;case 22:g.mode&1?(Zr=(x=Zr)||g.memoizedState!==null,Vs(l,u,g),Zr=x):Vs(l,u,g);break;default:Vs(l,u,g)}}function o2(l){var u=l.updateQueue;if(u!==null){l.updateQueue=null;var g=l.stateNode;g===null&&(g=l.stateNode=new T8),u.forEach(function(x){var C=V8.bind(null,l,x);g.has(x)||(g.add(x),x.then(C,C))})}}function vs(l,u){var g=u.deletions;if(g!==null)for(var x=0;x";case pf:return":has("+(Ug(l)||"")+")";case hf:return'[role="'+l.value+'"]';case gf:return'"'+l.value+'"';case mf:return'[data-testname="'+l.value+'"]';default:throw Error(a(365))}}function u2(l,u){var g=[];l=[l,0];for(var x=0;xC&&(C=N),x&=~j}if(x=C,x=Ve()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*$8(x/1960))-x,10l?16:l,Ka===null)var x=!1;else{if(l=Ka,Ka=null,wf=0,an&6)throw Error(a(331));var C=an;for(an|=4,pt=l.current;pt!==null;){var j=pt,N=j.child;if(pt.flags&16){var J=j.deletions;if(J!==null){for(var ue=0;ueVe()-Yg?zi(l,0):Kg|=g),yo(l,u)}function y2(l,u){u===0&&(l.mode&1?(u=vn,vn<<=1,!(vn&130023424)&&(vn=4194304)):u=1);var g=eo();l=Bs(l,u),l!==null&&(mt(l,u,g),yo(l,g))}function W8(l){var u=l.memoizedState,g=0;u!==null&&(g=u.retryLane),y2(l,g)}function V8(l,u){var g=0;switch(l.tag){case 13:var x=l.stateNode,C=l.memoizedState;C!==null&&(g=C.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(a(314))}x!==null&&x.delete(u),y2(l,g)}var x2;x2=function(l,u,g){if(l!==null)if(l.memoizedProps!==u.pendingProps||un.current)vo=!0;else{if(!(l.lanes&g)&&!(u.flags&128))return vo=!1,R8(l,u,g);vo=!!(l.flags&131072)}else vo=!1,Zn&&u.flags&1048576&&Xy(u,lo,u.index);switch(u.lanes=0,u.tag){case 2:var x=u.type;af(l,u),l=u.pendingProps;var C=Ir(u,Gt.current);Cl(u,g),C=kg(null,u,x,l,C,g);var j=_g();return u.flags|=1,typeof C=="object"&&C!==null&&typeof C.render=="function"&&C.$$typeof===void 0?(u.tag=1,u.memoizedState=null,u.updateQueue=null,Xn(x)?(j=!0,Jn(u)):j=!1,u.memoizedState=C.state!==null&&C.state!==void 0?C.state:null,mg(u),C.updater=Xd,u.stateNode=C,C._reactInternals=u,vg(u,x,l,g),u=Dg(null,u,x,!0,j,g)):(u.tag=0,Zn&&j&&sg(u),fo(null,u,C,g),u=u.child),u;case 16:x=u.elementType;e:{switch(af(l,u),l=u.pendingProps,C=x._init,x=C(x._payload),u.type=x,C=u.tag=G8(x),l=ms(x,l),C){case 0:u=Mg(null,u,x,l,g);break e;case 1:u=Gx(null,u,x,l,g);break e;case 11:u=Fx(null,u,x,l,g);break e;case 14:u=Hx(null,u,x,ms(x.type,l),g);break e}throw Error(a(306,x,""))}return u;case 0:return x=u.type,C=u.pendingProps,C=u.elementType===x?C:ms(x,C),Mg(l,u,x,C,g);case 1:return x=u.type,C=u.pendingProps,C=u.elementType===x?C:ms(x,C),Gx(l,u,x,C,g);case 3:e:{if(qx(u),l===null)throw Error(a(387));x=u.pendingProps,j=u.memoizedState,C=j.element,ox(l,u),Qd(u,x,null,g);var N=u.memoizedState;if(x=N.element,ke&&j.isDehydrated)if(j={element:x,isDehydrated:!1,cache:N.cache,pendingSuspenseBoundaries:N.pendingSuspenseBoundaries,transitions:N.transitions},u.updateQueue.baseState=j,u.memoizedState=j,u.flags&256){C=jl(Error(a(423)),u),u=Kx(l,u,x,g,C);break e}else if(x!==C){C=jl(Error(a(424)),u),u=Kx(l,u,x,g,C);break e}else for(ke&&(Wo=ee(u.stateNode.containerInfo),To=u,Zn=!0,hs=null,Yc=!1),g=px(u,null,x,g),u.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(wl(),x===C){u=ma(l,u,g);break e}fo(l,u,x,g)}u=u.child}return u;case 5:return hx(u),l===null&&lg(u),x=u.type,C=u.pendingProps,j=l!==null?l.memoizedProps:null,N=C.children,K(x,C)?N=null:j!==null&&K(x,j)&&(u.flags|=32),Ux(l,u),fo(l,u,N,g),u.child;case 6:return l===null&&lg(u),null;case 13:return Yx(l,u,g);case 4:return bg(u,u.stateNode.containerInfo),x=u.pendingProps,l===null?u.child=kl(u,null,x,g):fo(l,u,x,g),u.child;case 11:return x=u.type,C=u.pendingProps,C=u.elementType===x?C:ms(x,C),Fx(l,u,x,C,g);case 7:return fo(l,u,u.pendingProps,g),u.child;case 8:return fo(l,u,u.pendingProps.children,g),u.child;case 12:return fo(l,u,u.pendingProps.children,g),u.child;case 10:e:{if(x=u.type._context,C=u.pendingProps,j=u.memoizedProps,N=C.value,nx(u,x,N),j!==null)if(fn(j.value,N)){if(j.children===C.children&&!un.current){u=ma(l,u,g);break e}}else for(j=u.child,j!==null&&(j.return=u);j!==null;){var J=j.dependencies;if(J!==null){N=j.child;for(var ue=J.firstContext;ue!==null;){if(ue.context===x){if(j.tag===1){ue=ha(-1,g&-g),ue.tag=2;var Ne=j.updateQueue;if(Ne!==null){Ne=Ne.shared;var gt=Ne.pending;gt===null?ue.next=ue:(ue.next=gt.next,gt.next=ue),Ne.pending=ue}}j.lanes|=g,ue=j.alternate,ue!==null&&(ue.lanes|=g),pg(j.return,g,u),J.lanes|=g;break}ue=ue.next}}else if(j.tag===10)N=j.type===u.type?null:j.child;else if(j.tag===18){if(N=j.return,N===null)throw Error(a(341));N.lanes|=g,J=N.alternate,J!==null&&(J.lanes|=g),pg(N,g,u),N=j.sibling}else N=j.child;if(N!==null)N.return=j;else for(N=j;N!==null;){if(N===u){N=null;break}if(j=N.sibling,j!==null){j.return=N.return,N=j;break}N=N.return}j=N}fo(l,u,C.children,g),u=u.child}return u;case 9:return C=u.type,x=u.pendingProps.children,Cl(u,g),C=Vo(C),x=x(C),u.flags|=1,fo(l,u,x,g),u.child;case 14:return x=u.type,C=ms(x,u.pendingProps),C=ms(x.type,C),Hx(l,u,x,C,g);case 15:return Wx(l,u,u.type,u.pendingProps,g);case 17:return x=u.type,C=u.pendingProps,C=u.elementType===x?C:ms(x,C),af(l,u),u.tag=1,Xn(x)?(l=!0,Jn(u)):l=!1,Cl(u,g),cx(u,x,C),vg(u,x,C,g),Dg(null,u,x,!0,l,g);case 19:return Xx(l,u,g);case 22:return Vx(l,u,g)}throw Error(a(156,u.tag))};function w2(l,u){return We(l,u)}function U8(l,u,g,x){this.tag=l,this.key=g,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ko(l,u,g,x){return new U8(l,u,g,x)}function r0(l){return l=l.prototype,!(!l||!l.isReactComponent)}function G8(l){if(typeof l=="function")return r0(l)?1:0;if(l!=null){if(l=l.$$typeof,l===y)return 11;if(l===_)return 14}return 2}function Xa(l,u){var g=l.alternate;return g===null?(g=Ko(l.tag,u,l.key,l.mode),g.elementType=l.elementType,g.type=l.type,g.stateNode=l.stateNode,g.alternate=l,l.alternate=g):(g.pendingProps=u,g.type=l.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=l.flags&14680064,g.childLanes=l.childLanes,g.lanes=l.lanes,g.child=l.child,g.memoizedProps=l.memoizedProps,g.memoizedState=l.memoizedState,g.updateQueue=l.updateQueue,u=l.dependencies,g.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},g.sibling=l.sibling,g.index=l.index,g.ref=l.ref,g}function _f(l,u,g,x,C,j){var N=2;if(x=l,typeof l=="function")r0(l)&&(N=1);else if(typeof l=="string")N=5;else e:switch(l){case h:return Fi(g.children,C,j,u);case m:N=8,C|=8;break;case v:return l=Ko(12,g,u,C|2),l.elementType=v,l.lanes=j,l;case S:return l=Ko(13,g,u,C),l.elementType=S,l.lanes=j,l;case k:return l=Ko(19,g,u,C),l.elementType=k,l.lanes=j,l;case P:return Pf(g,C,j,u);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case b:N=10;break e;case w:N=9;break e;case y:N=11;break e;case _:N=14;break e;case I:N=16,x=null;break e}throw Error(a(130,l==null?l:typeof l,""))}return u=Ko(N,g,u,C),u.elementType=l,u.type=x,u.lanes=j,u}function Fi(l,u,g,x){return l=Ko(7,l,x,u),l.lanes=g,l}function Pf(l,u,g,x){return l=Ko(22,l,x,u),l.elementType=P,l.lanes=g,l.stateNode={isHidden:!1},l}function o0(l,u,g){return l=Ko(6,l,null,u),l.lanes=g,l}function s0(l,u,g){return u=Ko(4,l.children!==null?l.children:[],l.key,u),u.lanes=g,u.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},u}function q8(l,u,g,x,C){this.tag=u,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=se,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Bt(0),this.expirationTimes=Bt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bt(0),this.identifierPrefix=x,this.onRecoverableError=C,ke&&(this.mutableSourceEagerHydrationData=null)}function S2(l,u,g,x,C,j,N,J,ue){return l=new q8(l,u,g,J,ue),u===1?(u=1,j===!0&&(u|=8)):u=0,j=Ko(3,null,null,u),l.current=j,j.stateNode=l,j.memoizedState={element:x,isDehydrated:g,cache:null,transitions:null,pendingSuspenseBoundaries:null},mg(j),l}function C2(l){if(!l)return jn;l=l._reactInternals;e:{if(T(l)!==l||l.tag!==1)throw Error(a(170));var u=l;do{switch(u.tag){case 3:u=u.stateNode.context;break e;case 1:if(Xn(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break e}}u=u.return}while(u!==null);throw Error(a(171))}if(l.tag===1){var g=l.type;if(Xn(g))return On(l,g,u)}return u}function k2(l){var u=l._reactInternals;if(u===void 0)throw typeof l.render=="function"?Error(a(188)):(l=Object.keys(l).join(","),Error(a(268,l)));return l=Q(u),l===null?null:l.stateNode}function _2(l,u){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var g=l.retryLane;l.retryLane=g!==0&&g=Ne&&j>=Qt&&C<=gt&&N<=it){l.splice(u,1);break}else if(x!==Ne||g.width!==ue.width||itN){if(!(j!==Qt||g.height!==ue.height||gtC)){Ne>x&&(ue.width+=Ne-x,ue.x=x),gtj&&(ue.height+=Qt-j,ue.y=j),itg&&(g=N)),N ")+` + +No matching component was found for: + `)+l.join(" > ")}return null},n.getPublicRootInstance=function(l){if(l=l.current,!l.child)return null;switch(l.child.tag){case 5:return G(l.child.stateNode);default:return l.child.stateNode}},n.injectIntoDevTools=function(l){if(l={bundleType:l.bundleType,version:l.version,rendererPackageName:l.rendererPackageName,rendererConfig:l.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:K8,findFiberByHostInstance:l.findFiberByHostInstance||Y8,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")l=!1;else{var u=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(u.isDisabled||!u.supportsFiber)l=!0;else{try{Yn=u.inject(l),gn=u}catch{}l=!!u.checkDCE}}return l},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(l,u,g,x){if(!ct)throw Error(a(363));l=Gg(l,u);var C=At(l,g,x).disconnect;return{disconnect:function(){C()}}},n.registerMutableSourceForHydration=function(l,u){var g=u._getVersion;g=g(u._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[u,g]:l.mutableSourceEagerHydrationData.push(u,g)},n.runWithPriority=function(l,u){var g=Ie;try{return Ie=l,u()}finally{Ie=g}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(l,u,g,x){var C=u.current,j=eo(),N=Ya(C);return g=C2(g),u.context===null?u.context=g:u.pendingContext=g,u=ha(j,N),u.payload={element:l},x=x===void 0?null:x,x!==null&&(u.callback=x),l=Ga(C,u,N),l!==null&&(qo(l,C,N,j),Yd(l,C,N)),N},n};t8.exports=Iie;var Eie=t8.exports;const Oie=ud(Eie);var n8={exports:{}},xl={};/** + * @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. + */xl.ConcurrentRoot=1;xl.ContinuousEventPriority=4;xl.DefaultEventPriority=16;xl.DiscreteEventPriority=1;xl.IdleEventPriority=536870912;xl.LegacyRoot=0;n8.exports=xl;var r8=n8.exports;const r_={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let o_=!1,s_=!1;const Ky=".react-konva-event",Rie=`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 +`,Mie=`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 +`,Die={};function og(e,t,n=Die){if(!o_&&"zIndex"in t&&(console.warn(Mie),o_=!0),!s_&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(Rie),s_=!0)}for(var s in n)if(!r_[s]){var a=s.slice(0,2)==="on",c=n[s]!==t[s];if(a&&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={},v=!1;const b={};for(var s in t)if(!r_[s]){var a=s.slice(0,2)==="on",w=n[s]!==t[s];if(a&&w){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])}!a&&(t[s]!==n[s]||h&&t[s]!==e.getAttr(s))&&(v=!0,m[s]=t[s])}v&&(e.setAttrs(m),Di(e));for(var d in b)e.on(d+Ky,b[d])}function Di(e){if(!HM.Konva.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const o8={},Tie={};id.Node.prototype._applyProps=og;function Aie(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),Di(e)}function Nie(e,t,n){let r=id[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=id.Group);const o={},s={};for(var a in t){var c=a.slice(0,2)==="on";c?s[a]=t[a]:o[a]=t[a]}const d=new r(o);return og(d,s),d}function $ie(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function zie(e,t,n){return!1}function Lie(e){return e}function Bie(){return null}function Fie(){return null}function Hie(e,t,n,r){return Tie}function Wie(){}function Vie(e){}function Uie(e,t){return!1}function Gie(){return o8}function qie(){return o8}const Kie=setTimeout,Yie=clearTimeout,Qie=-1;function Xie(e,t){return!1}const Jie=!1,Zie=!0,ele=!0;function tle(e,t){t.parent===e?t.moveToTop():e.add(t),Di(e)}function nle(e,t){t.parent===e?t.moveToTop():e.add(t),Di(e)}function s8(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),Di(e)}function rle(e,t,n){s8(e,t,n)}function ole(e,t){t.destroy(),t.off(Ky),Di(e)}function sle(e,t){t.destroy(),t.off(Ky),Di(e)}function ale(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function ile(e,t,n){}function lle(e,t,n,r,o){og(e,o,r)}function cle(e){e.hide(),Di(e)}function ule(e){}function dle(e,t){(t.visible==null||t.visible)&&e.show()}function fle(e,t){}function ple(e){}function hle(){}const mle=()=>r8.DefaultEventPriority,gle=Object.freeze(Object.defineProperty({__proto__:null,appendChild:tle,appendChildToContainer:nle,appendInitialChild:Aie,cancelTimeout:Yie,clearContainer:ple,commitMount:ile,commitTextUpdate:ale,commitUpdate:lle,createInstance:Nie,createTextInstance:$ie,detachDeletedInstance:hle,finalizeInitialChildren:zie,getChildHostContext:qie,getCurrentEventPriority:mle,getPublicInstance:Lie,getRootHostContext:Gie,hideInstance:cle,hideTextInstance:ule,idlePriority:bp.unstable_IdlePriority,insertBefore:s8,insertInContainerBefore:rle,isPrimaryRenderer:Jie,noTimeout:Qie,now:bp.unstable_now,prepareForCommit:Bie,preparePortalMount:Fie,prepareUpdate:Hie,removeChild:ole,removeChildFromContainer:sle,resetAfterCommit:Wie,resetTextContent:Vie,run:bp.unstable_runWithPriority,scheduleTimeout:Kie,shouldDeprioritizeSubtree:Uie,shouldSetTextContent:Xie,supportsMutation:ele,unhideInstance:dle,unhideTextInstance:fle,warnsIfNotActing:Zie},Symbol.toStringTag,{value:"Module"}));var vle=Object.defineProperty,ble=Object.defineProperties,yle=Object.getOwnPropertyDescriptors,a_=Object.getOwnPropertySymbols,xle=Object.prototype.hasOwnProperty,wle=Object.prototype.propertyIsEnumerable,i_=(e,t,n)=>t in e?vle(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l_=(e,t)=>{for(var n in t||(t={}))xle.call(t,n)&&i_(e,n,t[n]);if(a_)for(var n of a_(t))wle.call(t,n)&&i_(e,n,t[n]);return e},Sle=(e,t)=>ble(e,yle(t));function a8(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=a8(r,t,n);if(o)return o;r=t?null:r.sibling}}function i8(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const Yy=i8(f.createContext(null));class l8 extends f.Component{render(){return f.createElement(Yy.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:c_,ReactCurrentDispatcher:u_}=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Cle(){const e=f.useContext(Yy);if(e===null)throw new Error("its-fine: useFiber must be called within a !");const t=f.useId();return f.useMemo(()=>{for(const r of[c_==null?void 0:c_.current,e,e==null?void 0:e.alternate]){if(!r)continue;const o=a8(r,!1,s=>{let a=s.memoizedState;for(;a;){if(a.memoizedState===t)return!0;a=a.next}});if(o)return o}},[e,t])}function kle(){var e,t;const n=Cle(),[r]=f.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==Yy&&!r.has(s)&&r.set(s,(t=u_==null?void 0:u_.current)==null?void 0:t.readContext(i8(s))),o=o.return}return r}function _le(){const e=kle();return f.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>f.createElement(t,null,f.createElement(n.Provider,Sle(l_({},r),{value:e.get(n)}))),t=>f.createElement(l8,l_({},t))),[e])}function Ple(e){const t=F.useRef({});return F.useLayoutEffect(()=>{t.current=e}),F.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}const jle=e=>{const t=F.useRef(),n=F.useRef(),r=F.useRef(),o=Ple(e),s=_le(),a=c=>{const{forwardedRef:d}=e;d&&(typeof d=="function"?d(c):d.current=c)};return F.useLayoutEffect(()=>(n.current=new id.Stage({width:e.width,height:e.height,container:t.current}),a(n.current),r.current=Ru.createContainer(n.current,r8.LegacyRoot,!1,null),Ru.updateContainer(F.createElement(s,{},e.children),r.current),()=>{id.isBrowser&&(a(null),Ru.updateContainer(null,r.current,null),n.current.destroy())}),[]),F.useLayoutEffect(()=>{a(n.current),og(n.current,e,o),Ru.updateContainer(F.createElement(s,{},e.children),r.current,null)}),F.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})},xu="Layer",$a="Group",aa="Rect",Hi="Circle",Yh="Line",c8="Image",Ile="Transformer",Ru=Oie(gle);Ru.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:F.version,rendererPackageName:"react-konva"});const Ele=F.forwardRef((e,t)=>F.createElement(l8,{},F.createElement(jle,{...e,forwardedRef:t}))),Ole=fe([mn,lr],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:Jt}}),Rle=()=>{const e=te(),{tool:t,isStaging:n,isMovingBoundingBox:r}=L(Ole);return{handleDragStart:f.useCallback(()=>{(t==="move"||n)&&!r&&e(Ap(!0))},[e,r,n,t]),handleDragMove:f.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(o3(s))},[e,r,n,t]),handleDragEnd:f.useCallback(()=>{(t==="move"||n)&&!r&&e(Ap(!1))},[e,r,n,t])}},Mle=fe([mn,Kn,lr],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:a,isMaskEnabled:c,shouldSnapToGrid:d}=e;return{activeTabName:t,isCursorOnCanvas:!!r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:a,isStaging:n,isMaskEnabled:c,shouldSnapToGrid:d}},{memoizeOptions:{resultEqualityCheck:Jt}}),Dle=()=>{const e=te(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:a}=L(Mle),c=f.useRef(null),d=s3(),p=()=>e(q1());nt(["shift+c"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[]);const h=()=>e(hd(!s));nt(["h"],()=>{h()},{enabled:()=>!o,preventDefault:!0},[s]),nt(["n"],()=>{e(Vu(!a))},{enabled:!0,preventDefault:!0},[a]),nt("esc",()=>{e(WM())},{enabled:()=>!0,preventDefault:!0}),nt("shift+h",()=>{e(VM(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),nt(["space"],m=>{m.repeat||(d==null||d.container().focus(),r!=="move"&&(c.current=r,e(ea("move"))),r==="move"&&c.current&&c.current!=="move"&&(e(ea(c.current)),c.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,c])},Qy=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}},u8=()=>{const e=te(),t=Ea(),n=s3();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=UM.pixelRatio,[s,a,c,d]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;e(GM({r:s,g:a,b:c,a:d}))},commitColorUnderCursor:()=>{e(qM())}}},Tle=fe([Kn,mn,lr],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Jt}}),Ale=e=>{const t=te(),{tool:n,isStaging:r}=L(Tle),{commitColorUnderCursor:o}=u8();return f.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Ap(!0));return}if(n==="colorPicker"){o();return}const a=Qy(e.current);a&&(s.evt.preventDefault(),t(a3(!0)),t(KM([a.x,a.y])))},[e,n,r,t,o])},Nle=fe([Kn,mn,lr],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Jt}}),$le=(e,t,n)=>{const r=te(),{isDrawing:o,tool:s,isStaging:a}=L(Nle),{updateColorUnderCursor:c}=u8();return f.useCallback(()=>{if(!e.current)return;const d=Qy(e.current);if(d){if(r(YM(d)),n.current=d,s==="colorPicker"){c();return}!o||s==="move"||a||(t.current=!0,r(i3([d.x,d.y])))}},[t,r,o,a,n,e,s,c])},zle=()=>{const e=te();return f.useCallback(()=>{e(QM())},[e])},Lle=fe([Kn,mn,lr],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Jt}}),Ble=(e,t)=>{const n=te(),{tool:r,isDrawing:o,isStaging:s}=L(Lle);return f.useCallback(()=>{if(r==="move"||s){n(Ap(!1));return}if(!t.current&&o&&e.current){const a=Qy(e.current);if(!a)return;n(i3([a.x,a.y]))}else t.current=!1;n(a3(!1))},[t,n,o,s,e,r])},Fle=fe([mn],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:Jt}}),Hle=e=>{const t=te(),{isMoveStageKeyHeld:n,stageScale:r}=L(Fle);return f.useCallback(o=>{if(!e.current||n)return;o.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const a={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=Es(r*ZM**c,JM,XM),p={x:s.x-a.x*d,y:s.y-a.y*d};t(eD(d)),t(o3(p))},[e,n,r,t])},Wle=fe(mn,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:o,shouldDarkenOutsideBoundingBox:s,stageCoordinates:a}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:a,stageDimensions:r,stageScale:o}},{memoizeOptions:{resultEqualityCheck:Jt}}),Vle=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=L(Wle);return i.jsxs($a,{children:[i.jsx(aa,{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}),i.jsx(aa,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},Ule=fe([mn],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:Jt}}),Gle=()=>{const{stageScale:e,stageCoordinates:t,stageDimensions:n}=L(Ule),{colorMode:r}=Ds(),[o,s]=f.useState([]),[a,c]=Dc("colors",["base.800","base.200"]),d=f.useCallback(p=>p/e,[e]);return f.useLayoutEffect(()=>{const{width:p,height:h}=n,{x:m,y:v}=t,b={x1:0,y1:0,x2:p,y2:h,offset:{x:d(m),y:d(v)}},w={x:Math.ceil(d(m)/64)*64,y:Math.ceil(d(v)/64)*64},y={x1:-w.x,y1:-w.y,x2:d(p)-w.x+64,y2:d(h)-w.y+64},k={x1:Math.min(b.x1,y.x1),y1:Math.min(b.y1,y.y1),x2:Math.max(b.x2,y.x2),y2:Math.max(b.y2,y.y2)},_=k.x2-k.x1,I=k.y2-k.y1,P=Math.round(_/64)+1,E=Math.round(I/64)+1,O=vw(0,P).map(M=>i.jsx(Yh,{x:k.x1+M*64,y:k.y1,points:[0,0,0,I],stroke:r==="dark"?a:c,strokeWidth:1},`x_${M}`)),R=vw(0,E).map(M=>i.jsx(Yh,{x:k.x1,y:k.y1+M*64,points:[0,0,_,0],stroke:r==="dark"?a:c,strokeWidth:1},`y_${M}`));s(O.concat(R))},[e,t,n,d,r,a,c]),i.jsx($a,{children:o})},qle=fe([go,mn],(e,t)=>{const{progressImage:n,sessionId:r}=e,{sessionId:o,boundingBox:s}=t.layerState.stagingArea;return{boundingBox:s,progressImage:r===o?n:void 0}},{memoizeOptions:{resultEqualityCheck:Jt}}),Kle=e=>{const{...t}=e,{progressImage:n,boundingBox:r}=L(qle),[o,s]=f.useState(null);return f.useEffect(()=>{if(!n)return;const a=new Image;a.onload=()=>{s(a)},a.src=n.dataURL},[n]),n&&r&&o?i.jsx(c8,{x:r.x,y:r.y,width:r.width,height:r.height,image:o,listening:!1,...t}):null},tl=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},Yle=fe(mn,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:tl(t)}}),d_=e=>`data:image/svg+xml;utf8, + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`.replaceAll("black",e),Qle=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=L(Yle),[a,c]=f.useState(null),[d,p]=f.useState(0),h=f.useRef(null),m=f.useCallback(()=>{p(d+1),setTimeout(m,500)},[d]);return f.useEffect(()=>{if(a)return;const v=new Image;v.onload=()=>{c(v)},v.src=d_(n)},[a,n]),f.useEffect(()=>{a&&(a.src=d_(n))},[a,n]),f.useEffect(()=>{const v=setInterval(()=>p(b=>(b+1)%5),50);return()=>clearInterval(v)},[]),!a||!Ml(r.x)||!Ml(r.y)||!Ml(s)||!Ml(o.width)||!Ml(o.height)?null:i.jsx(aa,{ref:h,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:a,fillPatternOffsetY:Ml(d)?d:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},Xle=fe([mn],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:Jt}}),Jle=e=>{const{...t}=e,{objects:n}=L(Xle);return i.jsx($a,{listening:!1,...t,children:n.filter(tD).map((r,o)=>i.jsx(Yh,{points:r.points,stroke:"rgb(0,0,0)",strokeWidth:r.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:r.tool==="brush"?"source-over":"destination-out"},o))})};var Wi=f,Zle=function(t,n,r){const o=Wi.useRef("loading"),s=Wi.useRef(),[a,c]=Wi.useState(0),d=Wi.useRef(),p=Wi.useRef(),h=Wi.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),Wi.useLayoutEffect(function(){if(!t)return;var m=document.createElement("img");function v(){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",v),m.addEventListener("error",b),n&&(m.crossOrigin=n),r&&(m.referrerPolicy=r),m.src=t,function(){m.removeEventListener("load",v),m.removeEventListener("error",b)}},[t,n,r]),[s.current,o.current]};const ece=ud(Zle),d8=e=>{const{width:t,height:n,x:r,y:o,imageName:s}=e.canvasImage,{currentData:a,isError:c}=os(s??oo.skipToken),[d]=ece((a==null?void 0:a.image_url)??"",nD.get()?"use-credentials":"anonymous");return c?i.jsx(aa,{x:r,y:o,width:t,height:n,fill:"red"}):i.jsx(c8,{x:r,y:o,image:d,listening:!1})},tce=fe([mn],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:Jt}}),nce=()=>{const{objects:e}=L(tce);return e?i.jsx($a,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(E_(t))return i.jsx(d8,{canvasImage:t},n);if(rD(t)){const r=i.jsx(Yh,{points:t.points,stroke:t.color?tl(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?i.jsx($a,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(oD(t))return i.jsx(aa,{x:t.x,y:t.y,width:t.width,height:t.height,fill:tl(t.color)},n);if(sD(t))return i.jsx(aa,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},rce=fe([mn],e=>{const{layerState:t,shouldShowStagingImage:n,shouldShowStagingOutline:r,boundingBoxCoordinates:{x:o,y:s},boundingBoxDimensions:{width:a,height:c}}=e,{selectedImageIndex:d,images:p}=t.stagingArea;return{currentStagingAreaImage:p.length>0&&d!==void 0?p[d]:void 0,isOnFirstImage:d===0,isOnLastImage:d===p.length-1,shouldShowStagingImage:n,shouldShowStagingOutline:r,x:o,y:s,width:a,height:c}},{memoizeOptions:{resultEqualityCheck:Jt}}),oce=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:a,width:c,height:d}=L(rce);return i.jsxs($a,{...t,children:[r&&n&&i.jsx(d8,{canvasImage:n}),o&&i.jsxs($a,{children:[i.jsx(aa,{x:s,y:a,width:c,height:d,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),i.jsx(aa,{x:s,y:a,width:c,height:d,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},sce=fe([mn],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n,sessionId:r}},shouldShowStagingOutline:o,shouldShowStagingImage:s}=e;return{currentStagingAreaImage:t.length>0?t[n]:void 0,isOnFirstImage:n===0,isOnLastImage:n===t.length-1,shouldShowStagingImage:s,shouldShowStagingOutline:o,sessionId:r}},{memoizeOptions:{resultEqualityCheck:Jt}}),ace=()=>{const e=te(),{isOnFirstImage:t,isOnLastImage:n,currentStagingAreaImage:r,shouldShowStagingImage:o,sessionId:s}=L(sce),{t:a}=be(),c=f.useCallback(()=>{e(iw(!0))},[e]),d=f.useCallback(()=>{e(iw(!1))},[e]);nt(["left"],()=>{p()},{enabled:()=>!0,preventDefault:!0}),nt(["right"],()=>{h()},{enabled:()=>!0,preventDefault:!0}),nt(["enter"],()=>{m()},{enabled:()=>!0,preventDefault:!0});const p=f.useCallback(()=>e(aD()),[e]),h=f.useCallback(()=>e(iD()),[e]),m=f.useCallback(()=>e(lD(s)),[e,s]),{data:v}=os((r==null?void 0:r.imageName)??oo.skipToken);return r?i.jsx(W,{pos:"absolute",bottom:4,w:"100%",align:"center",justify:"center",filter:"drop-shadow(0 0.5rem 1rem rgba(0,0,0))",onMouseOver:c,onMouseOut:d,children:i.jsxs(nr,{isAttached:!0,children:[i.jsx(Fe,{tooltip:`${a("unifiedCanvas.previous")} (Left)`,"aria-label":`${a("unifiedCanvas.previous")} (Left)`,icon:i.jsx(LH,{}),onClick:p,colorScheme:"accent",isDisabled:t}),i.jsx(Fe,{tooltip:`${a("unifiedCanvas.next")} (Right)`,"aria-label":`${a("unifiedCanvas.next")} (Right)`,icon:i.jsx(BH,{}),onClick:h,colorScheme:"accent",isDisabled:n}),i.jsx(Fe,{tooltip:`${a("unifiedCanvas.accept")} (Enter)`,"aria-label":`${a("unifiedCanvas.accept")} (Enter)`,icon:i.jsx(WH,{}),onClick:m,colorScheme:"accent"}),i.jsx(Fe,{tooltip:a("unifiedCanvas.showHide"),"aria-label":a("unifiedCanvas.showHide"),"data-alert":!o,icon:o?i.jsx(JH,{}):i.jsx(XH,{}),onClick:()=>e(cD(!o)),colorScheme:"accent"}),i.jsx(Fe,{tooltip:a("unifiedCanvas.saveToGallery"),"aria-label":a("unifiedCanvas.saveToGallery"),isDisabled:!v||!v.is_intermediate,icon:i.jsx(_m,{}),onClick:()=>{v&&e(uD({imageDTO:v}))},colorScheme:"accent"}),i.jsx(Fe,{tooltip:a("unifiedCanvas.discardAll"),"aria-label":a("unifiedCanvas.discardAll"),icon:i.jsx(ml,{style:{transform:"rotate(45deg)"}}),onClick:()=>e(dD()),colorScheme:"error",fontSize:20})]})}):null},ice=()=>{const e=L(c=>c.canvas.layerState),t=L(c=>c.canvas.boundingBoxCoordinates),n=L(c=>c.canvas.boundingBoxDimensions),r=L(c=>c.canvas.isMaskEnabled),o=L(c=>c.canvas.shouldPreserveMaskedArea),[s,a]=f.useState();return f.useEffect(()=>{a(void 0)},[e,t,n,r,o]),oee(async()=>{const c=await fD(e,t,n,r,o);if(!c)return;const{baseImageData:d,maskImageData:p}=c,h=pD(d,p);a(h)},1e3,[e,t,n,r,o]),s},lce={txt2img:"Text to Image",img2img:"Image to Image",inpaint:"Inpaint",outpaint:"Inpaint"},cce=()=>{const e=ice();return i.jsxs(Re,{children:["Mode: ",e?lce[e]:"..."]})},Jl=e=>Math.round(e*100)/100,uce=fe([mn],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${Jl(n)}, ${Jl(r)})`}},{memoizeOptions:{resultEqualityCheck:Jt}});function dce(){const{cursorCoordinatesString:e}=L(uce),{t}=be();return i.jsx(Re,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const R1="var(--invokeai-colors-warning-500)",fce=fe([mn],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:a},scaledBoundingBoxDimensions:{width:c,height:d},boundingBoxCoordinates:{x:p,y:h},stageScale:m,shouldShowCanvasDebugInfo:v,layer:b,boundingBoxScaleMethod:w,shouldPreserveMaskedArea:y}=e;let S="inherit";return(w==="none"&&(s<512||a<512)||w==="manual"&&c*d<512*512)&&(S=R1),{activeLayerColor:b==="mask"?R1:"inherit",activeLayerString:b.charAt(0).toUpperCase()+b.slice(1),boundingBoxColor:S,boundingBoxCoordinatesString:`(${Jl(p)}, ${Jl(h)})`,boundingBoxDimensionsString:`${s}×${a}`,scaledBoundingBoxDimensionsString:`${c}×${d}`,canvasCoordinatesString:`${Jl(r)}×${Jl(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(m*100),shouldShowCanvasDebugInfo:v,shouldShowBoundingBox:w!=="auto",shouldShowScaledBoundingBox:w!=="none",shouldPreserveMaskedArea:y}},{memoizeOptions:{resultEqualityCheck:Jt}}),pce=()=>{const{activeLayerColor:e,activeLayerString:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:a,canvasCoordinatesString:c,canvasDimensionsString:d,canvasScaleString:p,shouldShowCanvasDebugInfo:h,shouldShowBoundingBox:m,shouldPreserveMaskedArea:v}=L(fce),{t:b}=be();return i.jsxs(W,{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:[i.jsx(cce,{}),i.jsx(Re,{style:{color:e},children:`${b("unifiedCanvas.activeLayer")}: ${t}`}),i.jsx(Re,{children:`${b("unifiedCanvas.canvasScale")}: ${p}%`}),v&&i.jsx(Re,{style:{color:R1},children:"Preserve Masked Area: On"}),m&&i.jsx(Re,{style:{color:n},children:`${b("unifiedCanvas.boundingBox")}: ${o}`}),a&&i.jsx(Re,{style:{color:n},children:`${b("unifiedCanvas.scaledBoundingBox")}: ${s}`}),h&&i.jsxs(i.Fragment,{children:[i.jsx(Re,{children:`${b("unifiedCanvas.boundingBoxPosition")}: ${r}`}),i.jsx(Re,{children:`${b("unifiedCanvas.canvasDimensions")}: ${d}`}),i.jsx(Re,{children:`${b("unifiedCanvas.canvasPosition")}: ${c}`}),i.jsx(dce,{})]})]})},hce=fe([Ye],({canvas:e,generation:t})=>{const{boundingBoxCoordinates:n,boundingBoxDimensions:r,stageScale:o,isDrawing:s,isTransformingBoundingBox:a,isMovingBoundingBox:c,tool:d,shouldSnapToGrid:p}=e,{aspectRatio:h}=t;return{boundingBoxCoordinates:n,boundingBoxDimensions:r,isDrawing:s,isMovingBoundingBox:c,isTransformingBoundingBox:a,stageScale:o,shouldSnapToGrid:p,tool:d,hitStrokeWidth:20/o,aspectRatio:h}},{memoizeOptions:{resultEqualityCheck:Jt}}),mce=e=>{const{...t}=e,n=te(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:a,isTransformingBoundingBox:c,stageScale:d,shouldSnapToGrid:p,tool:h,hitStrokeWidth:m,aspectRatio:v}=L(hce),b=f.useRef(null),w=f.useRef(null),[y,S]=f.useState(!1);f.useEffect(()=>{var B;!b.current||!w.current||(b.current.nodes([w.current]),(B=b.current.getLayer())==null||B.batchDraw())},[]);const k=64*d;nt("N",()=>{n(Vu(!p))});const _=f.useCallback(B=>{if(!p){n(a0({x:Math.floor(B.target.x()),y:Math.floor(B.target.y())}));return}const V=B.target.x(),q=B.target.y(),G=Ss(V,64),D=Ss(q,64);B.target.x(G),B.target.y(D),n(a0({x:G,y:D}))},[n,p]),I=f.useCallback(()=>{if(!w.current)return;const B=w.current,V=B.scaleX(),q=B.scaleY(),G=Math.round(B.width()*V),D=Math.round(B.height()*q),z=Math.round(B.x()),H=Math.round(B.y());if(v){const Y=Ss(G/v,64);n(Js({width:G,height:Y}))}else n(Js({width:G,height:D}));n(a0({x:p?Su(z,64):z,y:p?Su(H,64):H})),B.scaleX(1),B.scaleY(1)},[n,p,v]),P=f.useCallback((B,V,q)=>{const G=B.x%k,D=B.y%k;return{x:Su(V.x,k)+G,y:Su(V.y,k)+D}},[k]),E=()=>{n(i0(!0))},O=()=>{n(i0(!1)),n(l0(!1)),n(Rf(!1)),S(!1)},R=()=>{n(l0(!0))},M=()=>{n(i0(!1)),n(l0(!1)),n(Rf(!1)),S(!1)},T=()=>{S(!0)},A=()=>{!c&&!a&&S(!1)},$=()=>{n(Rf(!0))},Q=()=>{n(Rf(!1))};return i.jsxs($a,{...t,children:[i.jsx(aa,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:$,onMouseOver:$,onMouseLeave:Q,onMouseOut:Q}),i.jsx(aa,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:m,listening:!s&&h==="move",onDragStart:R,onDragEnd:M,onDragMove:_,onMouseDown:R,onMouseOut:A,onMouseOver:T,onMouseEnter:T,onMouseUp:M,onTransform:I,onTransformEnd:O,ref:w,stroke:y?"rgba(255,255,255,0.7)":"white",strokeWidth:(y?8:1)/d,width:o.width,x:r.x,y:r.y}),i.jsx(Ile,{anchorCornerRadius:3,anchorDragBoundFunc:P,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:h==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&h==="move",onDragStart:R,onDragEnd:M,onMouseDown:E,onMouseUp:O,onTransformEnd:O,ref:b,rotateEnabled:!1})]})},gce=fe(mn,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:a,layer:c,shouldShowBrush:d,isMovingBoundingBox:p,isTransformingBoundingBox:h,stageScale:m,stageDimensions:v,boundingBoxCoordinates:b,boundingBoxDimensions:w,shouldRestrictStrokesToBox:y}=e,S=y?{clipX:b.x,clipY:b.y,clipWidth:w.width,clipHeight:w.height}:{};return{cursorPosition:t,brushX:t?t.x:v.width/2,brushY:t?t.y:v.height/2,radius:n/2,colorPickerOuterRadius:lw/m,colorPickerInnerRadius:(lw-bv+1)/m,maskColorString:tl({...o,a:.5}),brushColorString:tl(s),colorPickerColorString:tl(r),tool:a,layer:c,shouldShowBrush:d,shouldDrawBrushPreview:!(p||h||!t)&&d,strokeWidth:1.5/m,dotRadius:1.5/m,clip:S}},{memoizeOptions:{resultEqualityCheck:Jt}}),vce=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:a,layer:c,shouldDrawBrushPreview:d,dotRadius:p,strokeWidth:h,brushColorString:m,colorPickerColorString:v,colorPickerInnerRadius:b,colorPickerOuterRadius:w,clip:y}=L(gce);return d?i.jsxs($a,{listening:!1,...y,...t,children:[a==="colorPicker"?i.jsxs(i.Fragment,{children:[i.jsx(Hi,{x:n,y:r,radius:w,stroke:m,strokeWidth:bv,strokeScaleEnabled:!1}),i.jsx(Hi,{x:n,y:r,radius:b,stroke:v,strokeWidth:bv,strokeScaleEnabled:!1})]}):i.jsxs(i.Fragment,{children:[i.jsx(Hi,{x:n,y:r,radius:o,fill:c==="mask"?s:m,globalCompositeOperation:a==="eraser"?"destination-out":"source-out"}),i.jsx(Hi,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:h*2,strokeEnabled:!0,listening:!1}),i.jsx(Hi,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:h,strokeEnabled:!0,listening:!1})]}),i.jsx(Hi,{x:n,y:r,radius:p*2,fill:"rgba(255,255,255,0.4)",listening:!1}),i.jsx(Hi,{x:n,y:r,radius:p,fill:"rgba(0,0,0,1)",listening:!1})]}):null},bce=fe([mn,lr],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:a,isMovingBoundingBox:c,stageDimensions:d,stageCoordinates:p,tool:h,isMovingStage:m,shouldShowIntermediates:v,shouldShowGrid:b,shouldRestrictStrokesToBox:w,shouldAntialias:y}=e;let S="none";return h==="move"||t?m?S="grabbing":S="grab":s?S=void 0:w&&!a&&(S="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||c,shouldShowBoundingBox:o,shouldShowGrid:b,stageCoordinates:p,stageCursor:S,stageDimensions:d,stageScale:r,tool:h,isStaging:t,shouldShowIntermediates:v,shouldAntialias:y}},Ge),yce=je(Ele,{shouldForwardProp:e=>!["sx"].includes(e)}),f_=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:a,stageScale:c,tool:d,isStaging:p,shouldShowIntermediates:h,shouldAntialias:m}=L(bce);Dle();const v=f.useRef(null),b=f.useRef(null),w=f.useCallback(A=>{mD(A),v.current=A},[]),y=f.useCallback(A=>{hD(A),b.current=A},[]),S=f.useRef({x:0,y:0}),k=f.useRef(!1),_=Hle(v),I=Ale(v),P=Ble(v,k),E=$le(v,k,S),O=zle(),{handleDragStart:R,handleDragMove:M,handleDragEnd:T}=Rle();return i.jsx(W,{sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:i.jsxs(Re,{sx:{position:"relative"},children:[i.jsxs(yce,{tabIndex:-1,ref:w,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:o.x,y:o.y,width:a.width,height:a.height,scale:{x:c,y:c},onTouchStart:I,onTouchMove:E,onTouchEnd:P,onMouseDown:I,onMouseLeave:O,onMouseMove:E,onMouseUp:P,onDragStart:R,onDragMove:M,onDragEnd:T,onContextMenu:A=>A.evt.preventDefault(),onWheel:_,draggable:(d==="move"||p)&&!t,children:[i.jsx(xu,{id:"grid",visible:r,children:i.jsx(Gle,{})}),i.jsx(xu,{id:"base",ref:y,listening:!1,imageSmoothingEnabled:m,children:i.jsx(nce,{})}),i.jsxs(xu,{id:"mask",visible:e,listening:!1,children:[i.jsx(Jle,{visible:!0,listening:!1}),i.jsx(Qle,{listening:!1})]}),i.jsx(xu,{children:i.jsx(Vle,{})}),i.jsxs(xu,{id:"preview",imageSmoothingEnabled:m,children:[!p&&i.jsx(vce,{visible:d!=="move",listening:!1}),i.jsx(oce,{visible:p}),h&&i.jsx(Kle,{}),i.jsx(mce,{visible:n&&!p})]})]}),i.jsx(pce,{}),i.jsx(ace,{})]})})},xce=fe(mn,hH,Kn,(e,t,n)=>{const{doesCanvasNeedScaling:r,isCanvasInitialized:o}=e;return{doesCanvasNeedScaling:r,activeTabName:n,initialCanvasImage:t,isCanvasInitialized:o}}),p_=()=>{const e=te(),{doesCanvasNeedScaling:t,activeTabName:n,initialCanvasImage:r,isCanvasInitialized:o}=L(xce),s=f.useRef(null);return f.useLayoutEffect(()=>{window.setTimeout(()=>{if(!s.current)return;const{clientWidth:a,clientHeight:c}=s.current;e(gD({width:a,height:c})),e(o?vD():em()),e(O_(!1))},0)},[e,r,t,n,o]),i.jsx(W,{ref:s,sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:i.jsx(dl,{thickness:"2px",size:"xl"})})};function f8(e,t,n=250){const[r,o]=f.useState(0);return f.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 wce=je(QO,{baseStyle:{paddingInline:4},shouldForwardProp:e=>!["pickerColor"].includes(e)}),sv={width:6,height:6,borderColor:"base.100"},Sce=e=>{const{styleClass:t="",...n}=e;return i.jsx(wce,{sx:{".react-colorful__hue-pointer":sv,".react-colorful__saturation-pointer":sv,".react-colorful__alpha-pointer":sv},className:t,...n})},Qh=f.memo(Sce),Cce=fe([mn,lr],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:tl(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Jt}}),kce=()=>{const e=te(),{t}=be(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:a}=L(Cce);nt(["q"],()=>{c()},{enabled:()=>!a,preventDefault:!0},[n]),nt(["shift+c"],()=>{d()},{enabled:()=>!a,preventDefault:!0},[]),nt(["h"],()=>{p()},{enabled:()=>!a,preventDefault:!0},[o]);const c=()=>{e(Np(n==="mask"?"base":"mask"))},d=()=>e(q1()),p=()=>e(hd(!o));return i.jsx(gl,{triggerComponent:i.jsx(nr,{children:i.jsx(Fe,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:i.jsx(iW,{}),isChecked:n==="mask",isDisabled:a})}),children:i.jsxs(W,{direction:"column",gap:2,children:[i.jsx(Gn,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:p}),i.jsx(Gn,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:h=>e(l3(h.target.checked))}),i.jsx(Qh,{sx:{paddingTop:2,paddingBottom:2},pickerColor:r,onChange:h=>e(c3(h))}),i.jsxs(rn,{size:"sm",leftIcon:i.jsx(us,{}),onClick:d,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},_ce=fe([mn,Kn,go],(e,t,n)=>{const{futureLayerStates:r}=e;return{canRedo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Jt}});function p8(){const e=te(),{canRedo:t,activeTabName:n}=L(_ce),{t:r}=be(),o=()=>{e(bD())};return nt(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),i.jsx(Fe,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:i.jsx(uW,{}),onClick:o,isDisabled:!t})}const h8=()=>{const e=L(lr),t=te(),{t:n}=be();return i.jsxs(Vy,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(yD()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:i.jsx(rn,{size:"sm",leftIcon:i.jsx(us,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[i.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),i.jsx("br",{}),i.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},Pce=fe([mn],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:a,shouldSnapToGrid:c,shouldRestrictStrokesToBox:d,shouldAntialias:p}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:a,shouldSnapToGrid:c,shouldRestrictStrokesToBox:d,shouldAntialias:p}},{memoizeOptions:{resultEqualityCheck:Jt}}),jce=()=>{const e=te(),{t}=be(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:a,shouldShowIntermediates:c,shouldSnapToGrid:d,shouldRestrictStrokesToBox:p,shouldAntialias:h}=L(Pce);nt(["n"],()=>{e(Vu(!d))},{enabled:!0,preventDefault:!0},[d]);const m=v=>e(Vu(v.target.checked));return i.jsx(gl,{isLazy:!1,triggerComponent:i.jsx(Fe,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:i.jsx(Wb,{})}),children:i.jsxs(W,{direction:"column",gap:2,children:[i.jsx(Gn,{label:t("unifiedCanvas.showIntermediates"),isChecked:c,onChange:v=>e(u3(v.target.checked))}),i.jsx(Gn,{label:t("unifiedCanvas.showGrid"),isChecked:a,onChange:v=>e(d3(v.target.checked))}),i.jsx(Gn,{label:t("unifiedCanvas.snapToGrid"),isChecked:d,onChange:m}),i.jsx(Gn,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:v=>e(f3(v.target.checked))}),i.jsx(Gn,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:v=>e(p3(v.target.checked))}),i.jsx(Gn,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:v=>e(h3(v.target.checked))}),i.jsx(Gn,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:p,onChange:v=>e(m3(v.target.checked))}),i.jsx(Gn,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:v=>e(g3(v.target.checked))}),i.jsx(Gn,{label:t("unifiedCanvas.antialiasing"),isChecked:h,onChange:v=>e(v3(v.target.checked))}),i.jsx(h8,{})]})})},Ice=fe([mn,lr,go],(e,t,n)=>{const{isProcessing:r}=n,{tool:o,brushColor:s,brushSize:a}=e;return{tool:o,isStaging:t,isProcessing:r,brushColor:s,brushSize:a}},{memoizeOptions:{resultEqualityCheck:Jt}}),Ece=()=>{const e=te(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=L(Ice),{t:s}=be();nt(["b"],()=>{a()},{enabled:()=>!o,preventDefault:!0},[]),nt(["e"],()=>{c()},{enabled:()=>!o,preventDefault:!0},[t]),nt(["c"],()=>{d()},{enabled:()=>!o,preventDefault:!0},[t]),nt(["shift+f"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),nt(["delete","backspace"],()=>{h()},{enabled:()=>!o,preventDefault:!0}),nt(["BracketLeft"],()=>{e(ec(Math.max(r-5,5)))},{enabled:()=>!o,preventDefault:!0},[r]),nt(["BracketRight"],()=>{e(ec(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),nt(["Shift+BracketLeft"],()=>{e(tc({...n,a:Es(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),nt(["Shift+BracketRight"],()=>{e(tc({...n,a:Es(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const a=()=>e(ea("brush")),c=()=>e(ea("eraser")),d=()=>e(ea("colorPicker")),p=()=>e(b3()),h=()=>e(y3());return i.jsxs(nr,{isAttached:!0,children:[i.jsx(Fe,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:i.jsx(x6,{}),isChecked:t==="brush"&&!o,onClick:a,isDisabled:o}),i.jsx(Fe,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:i.jsx(m6,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:c}),i.jsx(Fe,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:i.jsx(b6,{}),isDisabled:o,onClick:p}),i.jsx(Fe,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:i.jsx(ml,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:h}),i.jsx(Fe,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:i.jsx(v6,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:d}),i.jsx(gl,{triggerComponent:i.jsx(Fe,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:i.jsx(Fb,{})}),children:i.jsxs(W,{minWidth:60,direction:"column",gap:4,width:"100%",children:[i.jsx(W,{gap:4,justifyContent:"space-between",children:i.jsx(_t,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:m=>e(ec(m)),sliderNumberInputProps:{max:500}})}),i.jsx(Qh,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:m=>e(tc(m))})]})})]})},Oce=fe([mn,Kn,go],(e,t,n)=>{const{pastLayerStates:r}=e;return{canUndo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Jt}});function m8(){const e=te(),{t}=be(),{canUndo:n,activeTabName:r}=L(Oce),o=()=>{e(xD())};return nt(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),i.jsx(Fe,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:i.jsx(Hb,{}),onClick:o,isDisabled:!n})}const Rce=fe([go,mn,lr],(e,t,n)=>{const{isProcessing:r}=e,{tool:o,shouldCropToBoundingBoxOnSave:s,layer:a,isMaskEnabled:c}=t;return{isProcessing:r,isStaging:n,isMaskEnabled:c,tool:o,layer:a,shouldCropToBoundingBoxOnSave:s}},{memoizeOptions:{resultEqualityCheck:Jt}}),Mce=()=>{const e=te(),{isProcessing:t,isStaging:n,isMaskEnabled:r,layer:o,tool:s}=L(Rce),a=Ea(),{t:c}=be(),{isClipboardAPIAvailable:d}=Oy(),{getUploadButtonProps:p,getUploadInputProps:h}=Vm({postUploadAction:{type:"SET_CANVAS_INITIAL_IMAGE"}});nt(["v"],()=>{m()},{enabled:()=>!n,preventDefault:!0},[]),nt(["r"],()=>{b()},{enabled:()=>!0,preventDefault:!0},[a]),nt(["shift+m"],()=>{y()},{enabled:()=>!n,preventDefault:!0},[a,t]),nt(["shift+s"],()=>{S()},{enabled:()=>!n,preventDefault:!0},[a,t]),nt(["meta+c","ctrl+c"],()=>{k()},{enabled:()=>!n&&d,preventDefault:!0},[a,t,d]),nt(["shift+d"],()=>{_()},{enabled:()=>!n,preventDefault:!0},[a,t]);const m=()=>e(ea("move")),v=f8(()=>b(!1),()=>b(!0)),b=(P=!1)=>{const E=Ea();if(!E)return;const O=E.getClientRect({skipTransform:!0});e(x3({contentRect:O,shouldScaleTo1:P}))},w=()=>{e(F1()),e(em())},y=()=>{e(w3())},S=()=>{e(S3())},k=()=>{d&&e(C3())},_=()=>{e(k3())},I=P=>{const E=P;e(Np(E)),E==="mask"&&!r&&e(hd(!0))};return i.jsxs(W,{sx:{alignItems:"center",gap:2,flexWrap:"wrap"},children:[i.jsx(Re,{w:24,children:i.jsx(Kr,{tooltip:`${c("unifiedCanvas.layer")} (Q)`,value:o,data:_3,onChange:I,disabled:n})}),i.jsx(kce,{}),i.jsx(Ece,{}),i.jsxs(nr,{isAttached:!0,children:[i.jsx(Fe,{"aria-label":`${c("unifiedCanvas.move")} (V)`,tooltip:`${c("unifiedCanvas.move")} (V)`,icon:i.jsx(f6,{}),isChecked:s==="move"||n,onClick:m}),i.jsx(Fe,{"aria-label":`${c("unifiedCanvas.resetView")} (R)`,tooltip:`${c("unifiedCanvas.resetView")} (R)`,icon:i.jsx(h6,{}),onClick:v})]}),i.jsxs(nr,{isAttached:!0,children:[i.jsx(Fe,{"aria-label":`${c("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${c("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:i.jsx(y6,{}),onClick:y,isDisabled:n}),i.jsx(Fe,{"aria-label":`${c("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${c("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:i.jsx(_m,{}),onClick:S,isDisabled:n}),d&&i.jsx(Fe,{"aria-label":`${c("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${c("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:i.jsx(Hc,{}),onClick:k,isDisabled:n}),i.jsx(Fe,{"aria-label":`${c("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${c("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:i.jsx(Bb,{}),onClick:_,isDisabled:n})]}),i.jsxs(nr,{isAttached:!0,children:[i.jsx(m8,{}),i.jsx(p8,{})]}),i.jsxs(nr,{isAttached:!0,children:[i.jsx(Fe,{"aria-label":`${c("common.upload")}`,tooltip:`${c("common.upload")}`,icon:i.jsx(Rd,{}),isDisabled:n,...p()}),i.jsx("input",{...h()}),i.jsx(Fe,{"aria-label":`${c("unifiedCanvas.clearCanvas")}`,tooltip:`${c("unifiedCanvas.clearCanvas")}`,icon:i.jsx(us,{}),onClick:w,colorScheme:"error",isDisabled:n})]}),i.jsx(nr,{isAttached:!0,children:i.jsx(jce,{})})]})};function Dce(){const e=te(),t=L(o=>o.canvas.brushSize),{t:n}=be(),r=L(lr);return nt(["BracketLeft"],()=>{e(ec(Math.max(t-5,5)))},{enabled:()=>!r,preventDefault:!0},[t]),nt(["BracketRight"],()=>{e(ec(Math.min(t+5,500)))},{enabled:()=>!r,preventDefault:!0},[t]),i.jsx(_t,{label:n("unifiedCanvas.brushSize"),value:t,withInput:!0,onChange:o=>e(ec(o)),sliderNumberInputProps:{max:500},isCompact:!0})}const Tce=fe([mn,lr],(e,t)=>{const{brushColor:n,maskColor:r,layer:o}=e;return{brushColor:n,maskColor:r,layer:o,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Jt}});function Ace(){const e=te(),{brushColor:t,maskColor:n,layer:r,isStaging:o}=L(Tce),s=()=>{if(r==="base")return`rgba(${t.r},${t.g},${t.b},${t.a})`;if(r==="mask")return`rgba(${n.r},${n.g},${n.b},${n.a})`};return nt(["shift+BracketLeft"],()=>{e(tc({...t,a:Es(t.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[t]),nt(["shift+BracketRight"],()=>{e(tc({...t,a:Es(t.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[t]),i.jsx(gl,{triggerComponent:i.jsx(Re,{sx:{width:7,height:7,minWidth:7,minHeight:7,borderRadius:"full",bg:s(),cursor:"pointer"}}),children:i.jsxs(W,{minWidth:60,direction:"column",gap:4,width:"100%",children:[r==="base"&&i.jsx(Qh,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:t,onChange:a=>e(tc(a))}),r==="mask"&&i.jsx(Qh,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:a=>e(c3(a))})]})})}function g8(){return i.jsxs(W,{columnGap:4,alignItems:"center",children:[i.jsx(Dce,{}),i.jsx(Ace,{})]})}function Nce(){const e=te(),t=L(r=>r.canvas.shouldRestrictStrokesToBox),{t:n}=be();return i.jsx(Gn,{label:n("unifiedCanvas.betaLimitToBox"),isChecked:t,onChange:r=>e(m3(r.target.checked))})}function $ce(){return i.jsxs(W,{gap:4,alignItems:"center",children:[i.jsx(g8,{}),i.jsx(Nce,{})]})}function zce(){const e=te(),{t}=be(),n=()=>e(q1());return i.jsx(rn,{size:"sm",leftIcon:i.jsx(us,{}),onClick:n,tooltip:`${t("unifiedCanvas.clearMask")} (Shift+C)`,children:t("unifiedCanvas.betaClear")})}function Lce(){const e=L(o=>o.canvas.isMaskEnabled),t=te(),{t:n}=be(),r=()=>t(hd(!e));return i.jsx(Gn,{label:`${n("unifiedCanvas.enableMask")} (H)`,isChecked:e,onChange:r})}function Bce(){const e=te(),{t}=be(),n=L(r=>r.canvas.shouldPreserveMaskedArea);return i.jsx(Gn,{label:t("unifiedCanvas.betaPreserveMasked"),isChecked:n,onChange:r=>e(l3(r.target.checked))})}function Fce(){return i.jsxs(W,{gap:4,alignItems:"center",children:[i.jsx(g8,{}),i.jsx(Lce,{}),i.jsx(Bce,{}),i.jsx(zce,{})]})}function Hce(){const e=L(r=>r.canvas.shouldDarkenOutsideBoundingBox),t=te(),{t:n}=be();return i.jsx(Gn,{label:n("unifiedCanvas.betaDarkenOutside"),isChecked:e,onChange:r=>t(f3(r.target.checked))})}function Wce(){const e=L(r=>r.canvas.shouldShowGrid),t=te(),{t:n}=be();return i.jsx(Gn,{label:n("unifiedCanvas.showGrid"),isChecked:e,onChange:r=>t(d3(r.target.checked))})}function Vce(){const e=L(o=>o.canvas.shouldSnapToGrid),t=te(),{t:n}=be(),r=o=>t(Vu(o.target.checked));return i.jsx(Gn,{label:`${n("unifiedCanvas.snapToGrid")} (N)`,isChecked:e,onChange:r})}function Uce(){return i.jsxs(W,{alignItems:"center",gap:4,children:[i.jsx(Wce,{}),i.jsx(Vce,{}),i.jsx(Hce,{})]})}const Gce=fe([mn],e=>{const{tool:t,layer:n}=e;return{tool:t,layer:n}},{memoizeOptions:{resultEqualityCheck:Jt}});function qce(){const{tool:e,layer:t}=L(Gce);return i.jsxs(W,{height:8,minHeight:8,maxHeight:8,alignItems:"center",children:[t=="base"&&["brush","eraser","colorPicker"].includes(e)&&i.jsx($ce,{}),t=="mask"&&["brush","eraser","colorPicker"].includes(e)&&i.jsx(Fce,{}),e=="move"&&i.jsx(Uce,{})]})}const Kce=fe([mn],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:o,shouldAntialias:s}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:o,shouldAntialias:s}},{memoizeOptions:{resultEqualityCheck:Jt}}),Yce=()=>{const e=te(),{t}=be(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldShowCanvasDebugInfo:o,shouldShowIntermediates:s,shouldAntialias:a}=L(Kce);return i.jsx(gl,{isLazy:!1,triggerComponent:i.jsx(Fe,{tooltip:t("unifiedCanvas.canvasSettings"),tooltipProps:{placement:"bottom"},"aria-label":t("unifiedCanvas.canvasSettings"),icon:i.jsx(Wb,{})}),children:i.jsxs(W,{direction:"column",gap:2,children:[i.jsx(Gn,{label:t("unifiedCanvas.showIntermediates"),isChecked:s,onChange:c=>e(u3(c.target.checked))}),i.jsx(Gn,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:c=>e(p3(c.target.checked))}),i.jsx(Gn,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:c=>e(h3(c.target.checked))}),i.jsx(Gn,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:o,onChange:c=>e(g3(c.target.checked))}),i.jsx(Gn,{label:t("unifiedCanvas.antialiasing"),isChecked:a,onChange:c=>e(v3(c.target.checked))}),i.jsx(h8,{})]})})};function Qce(){const e=L(lr),t=Ea(),{isClipboardAPIAvailable:n}=Oy(),r=L(c=>c.system.isProcessing),o=te(),{t:s}=be();nt(["meta+c","ctrl+c"],()=>{a()},{enabled:()=>!e&&n,preventDefault:!0},[t,r,n]);const a=f.useCallback(()=>{n&&o(C3())},[o,n]);return n?i.jsx(Fe,{"aria-label":`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:i.jsx(Hc,{}),onClick:a,isDisabled:e}):null}function Xce(){const e=te(),{t}=be(),n=Ea(),r=L(lr);nt(["shift+d"],()=>{o()},{enabled:()=>!r,preventDefault:!0},[n]);const o=()=>{e(k3())};return i.jsx(Fe,{"aria-label":`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:i.jsx(Bb,{}),onClick:o,isDisabled:r})}function Jce(){const e=L(lr),{getUploadButtonProps:t,getUploadInputProps:n}=Vm({postUploadAction:{type:"SET_CANVAS_INITIAL_IMAGE"}}),{t:r}=be();return i.jsxs(i.Fragment,{children:[i.jsx(Fe,{"aria-label":r("common.upload"),tooltip:r("common.upload"),icon:i.jsx(Rd,{}),isDisabled:e,...t()}),i.jsx("input",{...n()})]})}const Zce=fe([mn,lr],(e,t)=>{const{layer:n,isMaskEnabled:r}=e;return{layer:n,isMaskEnabled:r,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Jt}});function eue(){const e=te(),{t}=be(),{layer:n,isMaskEnabled:r,isStaging:o}=L(Zce),s=()=>{e(Np(n==="mask"?"base":"mask"))};nt(["q"],()=>{s()},{enabled:()=>!o,preventDefault:!0},[n]);const a=c=>{const d=c;e(Np(d)),d==="mask"&&!r&&e(hd(!0))};return i.jsx(Kr,{tooltip:`${t("unifiedCanvas.layer")} (Q)`,"aria-label":`${t("unifiedCanvas.layer")} (Q)`,value:n,data:_3,onChange:a,disabled:o,w:"full"})}function tue(){const e=te(),{t}=be(),n=Ea(),r=L(lr),o=L(a=>a.system.isProcessing);nt(["shift+m"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n,o]);const s=()=>{e(w3())};return i.jsx(Fe,{"aria-label":`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:i.jsx(y6,{}),onClick:s,isDisabled:r})}function nue(){const e=L(s=>s.canvas.tool),t=L(lr),n=te(),{t:r}=be();nt(["v"],()=>{o()},{enabled:()=>!t,preventDefault:!0},[]);const o=()=>n(ea("move"));return i.jsx(Fe,{"aria-label":`${r("unifiedCanvas.move")} (V)`,tooltip:`${r("unifiedCanvas.move")} (V)`,icon:i.jsx(f6,{}),isChecked:e==="move"||t,onClick:o})}function rue(){const e=L(s=>s.ui.shouldPinParametersPanel),t=L(s=>s.ui.shouldShowParametersPanel),n=te(),{t:r}=be(),o=()=>{n(K1(!0)),e&&n(Co())};return!e||!t?i.jsxs(W,{flexDirection:"column",gap:2,children:[i.jsx(Fe,{tooltip:`${r("parameters.showOptionsPanel")} (O)`,tooltipProps:{placement:"top"},"aria-label":r("parameters.showOptionsPanel"),onClick:o,children:i.jsx(Fb,{})}),i.jsx(W,{children:i.jsx(zy,{iconButton:!0})}),i.jsx(W,{children:i.jsx(Xm,{width:"100%",height:"40px",btnGroupWidth:"100%"})})]}):null}function oue(){const e=te(),{t}=be(),n=L(lr),r=()=>{e(F1()),e(em())};return i.jsx(Fe,{"aria-label":t("unifiedCanvas.clearCanvas"),tooltip:t("unifiedCanvas.clearCanvas"),icon:i.jsx(us,{}),onClick:r,isDisabled:n,colorScheme:"error"})}function sue(){const e=Ea(),t=te(),{t:n}=be();nt(["r"],()=>{o()},{enabled:()=>!0,preventDefault:!0},[e]);const r=f8(()=>o(!1),()=>o(!0)),o=(s=!1)=>{const a=Ea();if(!a)return;const c=a.getClientRect({skipTransform:!0});t(x3({contentRect:c,shouldScaleTo1:s}))};return i.jsx(Fe,{"aria-label":`${n("unifiedCanvas.resetView")} (R)`,tooltip:`${n("unifiedCanvas.resetView")} (R)`,icon:i.jsx(h6,{}),onClick:r})}function aue(){const e=L(lr),t=Ea(),n=L(a=>a.system.isProcessing),r=te(),{t:o}=be();nt(["shift+s"],()=>{s()},{enabled:()=>!e,preventDefault:!0},[t,n]);const s=()=>{r(S3())};return i.jsx(Fe,{"aria-label":`${o("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${o("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:i.jsx(_m,{}),onClick:s,isDisabled:e})}const iue=fe([mn,lr,go],(e,t,n)=>{const{isProcessing:r}=n,{tool:o}=e;return{tool:o,isStaging:t,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:Jt}}),lue=()=>{const e=te(),{t}=be(),{tool:n,isStaging:r}=L(iue);nt(["b"],()=>{o()},{enabled:()=>!r,preventDefault:!0},[]),nt(["e"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n]),nt(["c"],()=>{a()},{enabled:()=>!r,preventDefault:!0},[n]),nt(["shift+f"],()=>{c()},{enabled:()=>!r,preventDefault:!0}),nt(["delete","backspace"],()=>{d()},{enabled:()=>!r,preventDefault:!0});const o=()=>e(ea("brush")),s=()=>e(ea("eraser")),a=()=>e(ea("colorPicker")),c=()=>e(b3()),d=()=>e(y3());return i.jsxs(W,{flexDirection:"column",gap:2,children:[i.jsxs(nr,{children:[i.jsx(Fe,{"aria-label":`${t("unifiedCanvas.brush")} (B)`,tooltip:`${t("unifiedCanvas.brush")} (B)`,icon:i.jsx(x6,{}),isChecked:n==="brush"&&!r,onClick:o,isDisabled:r}),i.jsx(Fe,{"aria-label":`${t("unifiedCanvas.eraser")} (E)`,tooltip:`${t("unifiedCanvas.eraser")} (B)`,icon:i.jsx(m6,{}),isChecked:n==="eraser"&&!r,isDisabled:r,onClick:s})]}),i.jsxs(nr,{children:[i.jsx(Fe,{"aria-label":`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:i.jsx(b6,{}),isDisabled:r,onClick:c}),i.jsx(Fe,{"aria-label":`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:i.jsx(ml,{style:{transform:"rotate(45deg)"}}),isDisabled:r,onClick:d})]}),i.jsx(Fe,{"aria-label":`${t("unifiedCanvas.colorPicker")} (C)`,tooltip:`${t("unifiedCanvas.colorPicker")} (C)`,icon:i.jsx(v6,{}),isChecked:n==="colorPicker"&&!r,isDisabled:r,onClick:a,width:"max-content"})]})},cue=()=>i.jsxs(W,{flexDirection:"column",rowGap:2,width:"min-content",children:[i.jsx(eue,{}),i.jsx(lue,{}),i.jsxs(W,{gap:2,children:[i.jsx(nue,{}),i.jsx(sue,{})]}),i.jsxs(W,{columnGap:2,children:[i.jsx(tue,{}),i.jsx(aue,{})]}),i.jsxs(W,{columnGap:2,children:[i.jsx(Qce,{}),i.jsx(Xce,{})]}),i.jsxs(W,{gap:2,children:[i.jsx(m8,{}),i.jsx(p8,{})]}),i.jsxs(W,{gap:2,children:[i.jsx(Jce,{}),i.jsx(oue,{})]}),i.jsx(Yce,{}),i.jsx(rue,{})]}),uue=fe([mn,La],(e,t)=>{const{doesCanvasNeedScaling:n}=e,{shouldUseCanvasBetaLayout:r}=t;return{doesCanvasNeedScaling:n,shouldUseCanvasBetaLayout:r}},Ge),av={id:"canvas-intial-image",actionType:"SET_CANVAS_INITIAL_IMAGE"},due=()=>{const e=te(),{doesCanvasNeedScaling:t,shouldUseCanvasBetaLayout:n}=L(uue),{isOver:r,setNodeRef:o,active:s}=A1({id:"unifiedCanvas",data:av});return f.useLayoutEffect(()=>{const a=()=>{e(Co())};return window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[e]),n?i.jsx(Re,{layerStyle:"first",ref:o,tabIndex:0,sx:{w:"full",h:"full",p:4,borderRadius:"base"},children:i.jsxs(W,{sx:{w:"full",h:"full",gap:4},children:[i.jsx(cue,{}),i.jsxs(W,{sx:{flexDir:"column",w:"full",h:"full",gap:4,position:"relative"},children:[i.jsx(qce,{}),i.jsxs(Re,{sx:{w:"full",h:"full",position:"relative"},children:[t?i.jsx(p_,{}):i.jsx(f_,{}),Ep(av,s)&&i.jsx(nh,{isOver:r,label:"Set Canvas Initial Image"})]})]})]})}):i.jsx(Re,{ref:o,tabIndex:-1,sx:{layerStyle:"first",w:"full",h:"full",p:4,borderRadius:"base"},children:i.jsxs(W,{sx:{flexDirection:"column",alignItems:"center",gap:4,w:"full",h:"full"},children:[i.jsx(Mce,{}),i.jsx(W,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,w:"full",h:"full"},children:i.jsxs(Re,{sx:{w:"full",h:"full",position:"relative"},children:[t?i.jsx(p_,{}):i.jsx(f_,{}),Ep(av,s)&&i.jsx(nh,{isOver:r,label:"Set Canvas Initial Image"})]})})]})})},fue=f.memo(due),pue=fe([Ye],({generation:e})=>{const{infillMethod:t}=e;return{infillMethod:t}},Ge),hue=()=>{const e=te(),{infillMethod:t}=L(pue),{data:n,isLoading:r}=B_(),o=n==null?void 0:n.infill_methods,{t:s}=be(),a=f.useCallback(c=>{e(wD(c))},[e]);return i.jsx(Kr,{disabled:(o==null?void 0:o.length)===0,placeholder:r?"Loading...":void 0,label:s("parameters.infillMethod"),value:t,data:o??[],onChange:a})},mue=f.memo(hue),gue=fe([Mi],e=>{const{tileSize:t,infillMethod:n}=e;return{tileSize:t,infillMethod:n}},Ge),vue=()=>{const e=te(),{tileSize:t,infillMethod:n}=L(gue),{t:r}=be(),o=f.useCallback(a=>{e(cw(a))},[e]),s=f.useCallback(()=>{e(cw(32))},[e]);return i.jsx(_t,{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})},bue=f.memo(vue),yue=fe([mn],e=>{const{boundingBoxScaleMethod:t}=e;return{boundingBoxScale:t}},Ge),xue=()=>{const e=te(),{boundingBoxScale:t}=L(yue),{t:n}=be(),r=o=>{e(CD(o))};return i.jsx(ar,{label:n("parameters.scaleBeforeProcessing"),data:SD,value:t,onChange:r})},wue=f.memo(xue),Sue=fe([Mi,go,mn],(e,t,n)=>{const{scaledBoundingBoxDimensions:r,boundingBoxScaleMethod:o}=n;return{scaledBoundingBoxDimensions:r,isManual:o==="manual"}},Ge),Cue=()=>{const e=te(),{isManual:t,scaledBoundingBoxDimensions:n}=L(Sue),{t:r}=be(),o=a=>{e($p({...n,height:Math.floor(a)}))},s=()=>{e($p({...n,height:Math.floor(512)}))};return i.jsx(_t,{isDisabled:!t,label:r("parameters.scaledHeight"),min:64,max:1024,step:64,value:n.height,onChange:o,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:s})},kue=f.memo(Cue),_ue=fe([mn],e=>{const{boundingBoxScaleMethod:t,scaledBoundingBoxDimensions:n}=e;return{scaledBoundingBoxDimensions:n,isManual:t==="manual"}},Ge),Pue=()=>{const e=te(),{isManual:t,scaledBoundingBoxDimensions:n}=L(_ue),{t:r}=be(),o=a=>{e($p({...n,width:Math.floor(a)}))},s=()=>{e($p({...n,width:Math.floor(512)}))};return i.jsx(_t,{isDisabled:!t,label:r("parameters.scaledWidth"),min:64,max:1024,step:64,value:n.width,onChange:o,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:s})},jue=f.memo(Pue),Iue=()=>{const{t:e}=be();return i.jsx(Oo,{label:e("parameters.infillScalingHeader"),children:i.jsxs(W,{sx:{gap:2,flexDirection:"column"},children:[i.jsx(mue,{}),i.jsx(bue,{}),i.jsx(wue,{}),i.jsx(jue,{}),i.jsx(kue,{})]})})},Eue=f.memo(Iue);function Oue(){const e=te(),t=L(r=>r.generation.seamBlur),{t:n}=be();return i.jsx(_t,{label:n("parameters.seamBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(uw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(uw(16))}})}function Rue(){const e=te(),{t}=be(),n=L(r=>r.generation.seamSize);return i.jsx(_t,{label:t("parameters.seamSize"),min:1,max:256,sliderNumberInputProps:{max:512},value:n,onChange:r=>{e(dw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>e(dw(96))})}function Mue(){const{t:e}=be(),t=L(r=>r.generation.seamSteps),n=te();return i.jsx(_t,{label:e("parameters.seamSteps"),min:1,max:100,sliderNumberInputProps:{max:999},value:t,onChange:r=>{n(fw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{n(fw(30))}})}function Due(){const e=te(),{t}=be(),n=L(r=>r.generation.seamStrength);return i.jsx(_t,{label:t("parameters.seamStrength"),min:.01,max:.99,step:.01,value:n,onChange:r=>{e(pw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(pw(.7))}})}const Tue=()=>{const{t:e}=be();return i.jsxs(Oo,{label:e("parameters.seamCorrectionHeader"),children:[i.jsx(Rue,{}),i.jsx(Oue,{}),i.jsx(Due,{}),i.jsx(Mue,{})]})},Aue=f.memo(Tue),Nue=fe([Ye,lr],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{aspectRatio:o}=t;return{boundingBoxDimensions:r,isStaging:n,aspectRatio:o}},Ge),$ue=()=>{const e=te(),{boundingBoxDimensions:t,isStaging:n,aspectRatio:r}=L(Nue),{t:o}=be(),s=c=>{if(e(Js({...t,height:Math.floor(c)})),r){const d=Ss(c*r,64);e(Js({width:d,height:Math.floor(c)}))}},a=()=>{if(e(Js({...t,height:Math.floor(512)})),r){const c=Ss(512*r,64);e(Js({width:c,height:Math.floor(512)}))}};return i.jsx(_t,{label:o("parameters.boundingBoxHeight"),min:64,max:1024,step:64,value:t.height,onChange:s,isDisabled:n,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:a})},zue=f.memo($ue),Lue=fe([Ye,lr],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{aspectRatio:o}=t;return{boundingBoxDimensions:r,isStaging:n,aspectRatio:o}},Ge),Bue=()=>{const e=te(),{boundingBoxDimensions:t,isStaging:n,aspectRatio:r}=L(Lue),{t:o}=be(),s=c=>{if(e(Js({...t,width:Math.floor(c)})),r){const d=Ss(c/r,64);e(Js({width:Math.floor(c),height:d}))}},a=()=>{if(e(Js({...t,width:Math.floor(512)})),r){const c=Ss(512/r,64);e(Js({width:Math.floor(512),height:c}))}};return i.jsx(_t,{label:o("parameters.boundingBoxWidth"),min:64,max:1024,step:64,value:t.width,onChange:s,isDisabled:n,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:a})},Fue=f.memo(Bue);function h_(){const e=te(),{t}=be();return i.jsxs(W,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.150",_dark:{bg:"base.750"}},children:[i.jsxs(W,{alignItems:"center",gap:2,children:[i.jsx(tt,{sx:{fontSize:"sm",width:"full",color:"base.700",_dark:{color:"base.300"}},children:t("parameters.aspectRatio")}),i.jsx(fl,{}),i.jsx(IO,{}),i.jsx(Fe,{tooltip:t("ui.swapSizes"),"aria-label":t("ui.swapSizes"),size:"sm",icon:i.jsx(lO,{}),fontSize:20,onClick:()=>e(kD())})]}),i.jsx(Fue,{}),i.jsx(zue,{})]})}const Hue=fe(Ye,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},Ge),Wue=()=>{const{shouldUseSliders:e,activeLabel:t}=L(Hue);return i.jsx(Oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:i.jsxs(W,{sx:{flexDirection:"column",gap:3},children:[e?i.jsxs(i.Fragment,{children:[i.jsx(wi,{}),i.jsx(Ci,{}),i.jsx(xi,{}),i.jsx(Si,{}),i.jsx(Re,{pt:2,children:i.jsx(ki,{})}),i.jsx(h_,{})]}):i.jsxs(i.Fragment,{children:[i.jsxs(W,{gap:3,children:[i.jsx(wi,{}),i.jsx(Ci,{}),i.jsx(xi,{})]}),i.jsx(Si,{}),i.jsx(Re,{pt:2,children:i.jsx(ki,{})}),i.jsx(h_,{})]}),i.jsx(NO,{})]})})},Vue=f.memo(Wue),v8=()=>i.jsxs(i.Fragment,{children:[i.jsx(Fd,{}),i.jsx(Ld,{}),i.jsx(Hd,{}),i.jsx(Vue,{}),i.jsx(Hy,{}),i.jsx(By,{}),i.jsx(zd,{}),i.jsx(Wy,{}),i.jsx(Aue,{}),i.jsx(Eue,{}),i.jsx(Fy,{})]}),Uue=()=>i.jsxs(W,{sx:{gap:4,w:"full",h:"full"},children:[i.jsx(Ly,{children:i.jsx(v8,{})}),i.jsx(fue,{})]}),Gue=f.memo(Uue),que=[{id:"txt2img",translationKey:"common.txt2img",icon:i.jsx(no,{as:ZH,sx:{boxSize:6,pointerEvents:"none"}}),content:i.jsx(Pie,{})},{id:"img2img",translationKey:"common.img2img",icon:i.jsx(no,{as:al,sx:{boxSize:6,pointerEvents:"none"}}),content:i.jsx(_oe,{})},{id:"unifiedCanvas",translationKey:"common.unifiedCanvas",icon:i.jsx(no,{as:See,sx:{boxSize:6,pointerEvents:"none"}}),content:i.jsx(Gue,{})},{id:"nodes",translationKey:"common.nodes",icon:i.jsx(no,{as:wee,sx:{boxSize:6,pointerEvents:"none"}}),content:i.jsx(wie,{})},{id:"modelManager",translationKey:"modelManager.modelManager",icon:i.jsx(no,{as:GH,sx:{boxSize:6,pointerEvents:"none"}}),content:i.jsx(kse,{})}],Kue=fe([cO,go],(e,t)=>{const{disabledTabs:n}=e,{isNodesEnabled:r}=t;return que.filter(s=>s.id==="nodes"?r&&!n.includes(s.id):!n.includes(s.id))},{memoizeOptions:{resultEqualityCheck:Jt}}),Yue=350,iv=20,b8=["modelManager"],Que=()=>{const e=L(_D),t=L(Kn),n=L(Kue),{shouldPinGallery:r,shouldPinParametersPanel:o,shouldShowGallery:s}=L(y=>y.ui),{t:a}=be(),c=te();nt("f",()=>{c(PD()),(r||o)&&c(Co())},[r,o]);const d=f.useCallback(()=>{t==="unifiedCanvas"&&c(Co())},[c,t]),p=f.useCallback(y=>{y.target instanceof HTMLElement&&y.target.blur()},[]),h=f.useMemo(()=>n.map(y=>i.jsx(wn,{hasArrow:!0,label:String(a(y.translationKey)),placement:"end",children:i.jsxs(wc,{onClick:p,children:[i.jsx(F3,{children:String(a(y.translationKey))}),y.icon]})},y.id)),[n,a,p]),m=f.useMemo(()=>n.map(y=>i.jsx(Cm,{children:y.content},y.id)),[n]),{ref:v,minSizePct:b}=Uee(Yue,iv,"app"),w=f.useCallback(y=>{const S=jD[y];S&&c(ql(S))},[c]);return i.jsxs(Id,{defaultIndex:e,index:e,onChange:w,sx:{flexGrow:1,gap:4},isLazy:!0,children:[i.jsxs(Ed,{sx:{pt:2,gap:4,flexDir:"column"},children:[h,i.jsx(fl,{}),i.jsx(jee,{})]}),i.jsxs(Ay,{id:"app",autoSaveId:"app",direction:"horizontal",style:{height:"100%",width:"100%"},children:[i.jsx(ad,{id:"main",children:i.jsx(km,{style:{height:"100%",width:"100%"},children:m})}),r&&s&&!b8.includes(t)&&i.jsxs(i.Fragment,{children:[i.jsx(RO,{}),i.jsx(ad,{ref:v,onResize:d,id:"gallery",order:3,defaultSize:b>iv?b:iv,minSize:b,maxSize:50,children:i.jsx(sO,{})})]})]})]})},Xue=f.memo(Que),Jue=fe([Kn,La],(e,t)=>{const{shouldPinGallery:n,shouldShowGallery:r}=t;return{shouldPinGallery:n,shouldShowGalleryButton:b8.includes(e)?!1:!r}},{memoizeOptions:{resultEqualityCheck:Jt}}),Zue=()=>{const{t:e}=be(),{shouldPinGallery:t,shouldShowGalleryButton:n}=L(Jue),r=te(),o=()=>{r(vv(!0)),t&&r(Co())};return n?i.jsx(Fe,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":e("accessibility.showGallery"),onClick:o,sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",p:0,insetInlineEnd:0,px:3,h:48,w:8,borderStartEndRadius:0,borderEndEndRadius:0,shadow:"2xl"},children:i.jsx(Cee,{})}):null},ede=f.memo(Zue),lv={borderStartStartRadius:0,borderEndStartRadius:0,shadow:"2xl"},tde=fe([La,Kn],(e,t)=>{const{shouldPinParametersPanel:n,shouldUseCanvasBetaLayout:r,shouldShowParametersPanel:o}=e,s=r&&t==="unifiedCanvas",a=!s&&(!n||!o),c=!s&&!o&&["txt2img","img2img","unifiedCanvas"].includes(t);return{shouldPinParametersPanel:n,shouldShowParametersPanelButton:c,shouldShowProcessButtons:a}},{memoizeOptions:{resultEqualityCheck:Jt}}),nde=()=>{const e=te(),{t}=be(),{shouldShowProcessButtons:n,shouldShowParametersPanelButton:r,shouldPinParametersPanel:o}=L(tde),s=()=>{e(K1(!0)),o&&e(Co())};return r?i.jsxs(W,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineStart:"4.5rem",direction:"column",gap:2,children:[i.jsx(Fe,{tooltip:"Show Options Panel (O)",tooltipProps:{placement:"top"},"aria-label":t("accessibility.showOptionsPanel"),onClick:s,sx:lv,children:i.jsx(Fb,{})}),n&&i.jsxs(i.Fragment,{children:[i.jsx(zy,{iconButton:!0,sx:lv}),i.jsx(Xm,{sx:lv})]})]}):null},rde=f.memo(nde),ode=fe([La,Kn],(e,t)=>{const{shouldPinParametersPanel:n,shouldShowParametersPanel:r}=e;return{activeTabName:t,shouldPinParametersPanel:n,shouldShowParametersPanel:r}},Ge),sde=()=>{const e=te(),{shouldPinParametersPanel:t,shouldShowParametersPanel:n,activeTabName:r}=L(ode),o=()=>{e(K1(!1))},s=f.useMemo(()=>r==="txt2img"?i.jsx(e8,{}):r==="img2img"?i.jsx($O,{}):r==="unifiedCanvas"?i.jsx(v8,{}):null,[r]);return t?null:i.jsx(c6,{direction:"left",isResizable:!1,isOpen:n,onClose:o,children:i.jsxs(W,{sx:{flexDir:"column",h:"full",w:$y,gap:2,position:"relative",flexShrink:0,overflowY:"auto"},children:[i.jsxs(W,{paddingBottom:4,justifyContent:"space-between",alignItems:"center",children:[i.jsx(iO,{}),i.jsx(OO,{})]}),i.jsx(W,{sx:{gap:2,flexDirection:"column",h:"full",w:"full"},children:s})]})})},ade=f.memo(sde),ide=()=>{const{data:e,isFetching:t}=Zh(),{isOpen:n,onClose:r,handleAddToBoard:o,image:s}=f.useContext(A_),[a,c]=f.useState(),d=f.useRef(null),p=e==null?void 0:e.find(h=>h.board_id===(s==null?void 0:s.board_id));return i.jsx(_d,{isOpen:n,leastDestructiveRef:d,onClose:r,isCentered:!0,children:i.jsx(Da,{children:i.jsxs(Pd,{children:[i.jsx(Ma,{fontSize:"lg",fontWeight:"bold",children:p?"Move Image to Board":"Add Image to Board"}),i.jsx(Ta,{children:i.jsx(Re,{children:i.jsxs(W,{direction:"column",gap:3,children:[p&&i.jsxs(tt,{children:["Moving this image from"," ",i.jsx("strong",{children:p.board_name})," to"]}),t?i.jsx(dl,{}):i.jsx(ar,{placeholder:"Select Board",onChange:h=>c(h),value:a,data:(e??[]).map(h=>({label:h.board_name,value:h.board_id}))})]})})}),i.jsxs(Ra,{children:[i.jsx(rn,{onClick:r,children:"Cancel"}),i.jsx(rn,{isDisabled:!a,colorScheme:"accent",onClick:()=>{a&&o(a)},ml:3,children:p?"Move":"Add"})]})]})})})},lde=f.memo(ide),cde=fe([e=>e.hotkeys,e=>e.ui],(e,t)=>{const{shift:n}=e,{shouldPinParametersPanel:r,shouldPinGallery:o}=t;return{shift:n,shouldPinGallery:o,shouldPinParametersPanel:r}},{memoizeOptions:{resultEqualityCheck:Jt}}),ude=()=>{const e=te(),{shift:t,shouldPinParametersPanel:n,shouldPinGallery:r}=L(cde),o=L(Kn);return nt("*",()=>{o6("shift")?!t&&e(Po(!0)):t&&e(Po(!1))},{keyup:!0,keydown:!0},[t]),nt("o",()=>{e(ID()),o==="unifiedCanvas"&&n&&e(Co())}),nt(["shift+o"],()=>{e(ED()),o==="unifiedCanvas"&&e(Co())}),nt("g",()=>{e(OD()),o==="unifiedCanvas"&&r&&e(Co())}),nt(["shift+g"],()=>{e(T_()),o==="unifiedCanvas"&&e(Co())}),nt("1",()=>{e(ql("txt2img"))}),nt("2",()=>{e(ql("img2img"))}),nt("3",()=>{e(ql("unifiedCanvas"))}),nt("4",()=>{e(ql("nodes"))}),null},dde=f.memo(ude),fde={},pde=({config:e=fde,headerComponent:t})=>{const n=L(GP),r=nF(),o=te();return f.useEffect(()=>{Ln.changeLanguage(n)},[n]),f.useEffect(()=>{K_(e)&&(r.info({namespace:"App",config:e},"Received config"),o(RD(e)))},[o,e,r]),f.useEffect(()=>{o(MD())},[o]),i.jsxs(i.Fragment,{children:[i.jsxs(rl,{w:"100vw",h:"100vh",position:"relative",overflow:"hidden",children:[i.jsx(pH,{children:i.jsxs(rl,{sx:{gap:4,p:4,gridAutoRows:"min-content auto",w:"full",h:"full"},children:[t||i.jsx(yee,{}),i.jsx(W,{sx:{gap:4,w:"full",h:"full"},children:i.jsx(Xue,{})})]})}),i.jsx(qZ,{}),i.jsx(ade,{}),i.jsx(Uu,{children:i.jsx(rde,{})}),i.jsx(Uu,{children:i.jsx(ede,{})})]}),i.jsx(XZ,{}),i.jsx(lde,{}),i.jsx(rF,{}),i.jsx(dde,{})]})},yde=f.memo(pde);export{yde as default}; diff --git a/invokeai/frontend/web/dist/assets/App-3ab46138.js b/invokeai/frontend/web/dist/assets/App-3ab46138.js deleted file mode 100644 index 35276eba23..0000000000 --- a/invokeai/frontend/web/dist/assets/App-3ab46138.js +++ /dev/null @@ -1,169 +0,0 @@ -import{t as Wg,r as iE,i as lE,a as hu,b as a4,S as i4,c as l4,d as c4,e as Vg,f as u4,g as Ug,h as cE,j as uE,k as dE,l as fE,m as pE,n as hE,o as mE,p as gE,q as vE,s as f,u as tt,v as a,I as mo,w as cr,x as Wn,y as He,z as Ot,A as mu,B as mt,C as gu,D as ws,E as io,F as lo,G as wr,H as yE,J as bE,K as Ua,L as Wc,M as Ni,N as sn,O as Sa,P as Vp,Q as ev,R as Sl,T as tv,U as vu,_ as Qn,V as xE,W as N,X as d4,Y as f4,Z as zb,$ as p4,a0 as Up,a1 as nv,a2 as Kl,a3 as wE,a4 as SE,a5 as CE,a6 as _E,a7 as h4,a8 as m4,a9 as Gp,aa as xf,ab as kE,ac as PE,ad as Hm,ae as Lb,af as jE,ag as g4,ah as v4,ai as Yl,aj as Bb,ak as Fb,al as IE,am as EE,an as OE,ao as RE,ap as ME,aq as Wm,ar as nl,as as Vm,at as DE,au as TE,av as AE,aw as rv,ax as qp,ay as wf,az as NE,aA as y4,aB as b4,aC as $E,aD as yu,aE as ov,aF as zE,aG as LE,aH as BE,aI as FE,aJ as HE,aK as WE,aL as VE,aM as Hb,aN as ze,aO as F,aP as aa,aQ as ve,aR as Mo,aS as ur,aT as te,aU as L,aV as Ql,aW as fe,aX as x4,aY as w4,aZ as Xl,a_ as Do,a$ as Ve,b0 as _n,b1 as Sf,b2 as UE,b3 as Ga,b4 as sv,b5 as Cf,b6 as S4,b7 as av,b8 as Mt,b9 as iv,ba as GE,bb as qE,bc as KE,bd as rl,be as gs,bf as C4,bg as YE,bh as QE,bi as bu,bj as it,bk as lv,bl as qa,bm as Wb,bn as XE,bo as JE,bp as ZE,bq as _d,br as kd,bs as Vc,bt as Uc,bu as Vb,bv as _f,bw as Ub,bx as kf,by as Gb,bz as Gg,bA as qb,bB as qg,bC as Kb,bD as Pf,bE as Yb,bF as Tl,bG as Qb,bH as Al,bI as Xb,bJ as jf,bK as e8,bL as If,bM as _4,bN as cv,bO as uv,bP as t8,bQ as k4,bR as n8,bS as r8,bT as Kp,bU as gl,bV as o8,bW as ff,bX as je,bY as s8,bZ as a8,b_ as i8,b$ as Ef,c0 as Jl,c1 as P4,c2 as l8,c3 as j4,c4 as Jb,c5 as Zb,c6 as c8,c7 as Ws,c8 as ex,c9 as St,ca as Of,cb as u8,cc as I4,cd as Jr,ce as d8,cf as Xn,cg as Qt,ch as Kg,ci as Vs,cj as Ss,ck as vs,cl as E4,cm as f8,cn as O4,co as tx,cp as p8,cq as h8,cr as m8,cs as g8,ct as yr,cu as R4,cv as v8,cw as y8,cx as b8,cy as x8,cz as w8,cA as dv,cB as Yo,cC as M4,cD as D4,cE as S8,cF as nx,cG as C8,cH as _8,cI as k8,cJ as P8,cK as j8,cL as I8,cM as E8,cN as T4,cO as O8,cP as R8,cQ as M8,cR as D8,cS as T8,cT as A8,cU as $r,cV as A4,cW as N8,cX as rx,cY as $8,cZ as z8,c_ as L8,c$ as B8,d0 as F8,d1 as H8,d2 as W8,d3 as V8,d4 as N4,d5 as yo,d6 as U8,d7 as G8,d8 as q8,d9 as Yp,da as K8,db as fv,dc as $4,dd as Y8,de as Q8,df as X8,dg as Xo,dh as J8,di as ox,dj as sx,dk as Cl,dl as Z8,dm as e7,dn as t7,dp as n7,dq as r7,dr as o7,ds as s7,dt as a7,du as i7,dv as l7,dw as c7,dx as pv,dy as hv,dz as u7,dA as ax,dB as d7,dC as ix,dD as Jo,dE as f7,dF as p7,dG as lx,dH as cx,dI as h7,dJ as ux,dK as m7,dL as g7,dM as v7,dN as y7,dO as b7,dP as x7,dQ as z4,dR as L4,dS as B4,dT as F4,dU as H4,dV as xu,dW as dx,dX as w7,dY as ji,dZ as W4,d_ as S7,d$ as V4,e0 as fx,e1 as C7,e2 as cs,e3 as _7,e4 as k7,e5 as U4,e6 as G4,e7 as P7,e8 as q4,e9 as K4,ea as rr,eb as or,ec as wu,ed as Y4,ee as Q4,ef as px,eg as j7,eh as hx,ei as I7,ej as X4,ek as E7,el as Qp,em as mx,en as J4,eo as O7,ep as gx,eq as Z4,er as Qo,es as R7,et as M7,eu as e3,ev as D7,ew as T7,ex as A7,ey as N7,ez as $7,eA as z7,eB as L7,eC as B7,eD as F7,eE as H7,eF as W7,eG as V7,eH as U7,eI as G7,eJ as q7,eK as K7,eL as Y7,eM as Q7,eN as X7,eO as vx,eP as pf,eQ as J7,eR as en,eS as Rf,eT as t3,eU as eu,eV as Z7,eW as eO,eX as Hs,eY as n3,eZ as mv,e_ as Su,e$ as tO,f0 as nO,f1 as rO,f2 as ha,f3 as r3,f4 as oO,f5 as sO,f6 as o3,f7 as aO,f8 as iO,f9 as lO,fa as cO,fb as uO,fc as dO,fd as fO,fe as pO,ff as hO,fg as mO,fh as gO,fi as yx,fj as vO,fk as yO,fl as bO,fm as xO,fn as wO,fo as SO,fp as Um,fq as Bs,fr as Pd,fs as Gm,ft as qm,fu as jd,fv as bx,fw as Yg,fx as CO,fy as _O,fz as kO,fA as PO,fB as jO,fC as Mf,fD as s3,fE as a3,fF as IO,fG as EO,fH as i3,fI as l3,fJ as c3,fK as u3,fL as d3,fM as f3,fN as p3,fO as h3,fP as _l,fQ as kl,fR as m3,fS as g3,fT as OO,fU as v3,fV as y3,fW as b3,fX as x3,fY as w3,fZ as S3,f_ as C3,f$ as gv,g0 as RO,g1 as MO,g2 as xx,g3 as DO,g4 as TO,g5 as Df,g6 as wx,g7 as Sx,g8 as Cx,g9 as _x,ga as AO,gb as NO,gc as $O,gd as zO,ge as LO,gf as BO,gg as FO,gh as HO,gi as WO,gj as VO}from"./index-9e78a66d.js";import{m as _3,u as k3,a as Ca,b as UO,r as $e,f as GO,g as kx,c as At,d as gr}from"./MantineProvider-48183abc.js";function qO(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 Px=1/0,KO=17976931348623157e292;function Km(e){if(!e)return e===0?e:0;if(e=Wg(e),e===Px||e===-Px){var t=e<0?-1:1;return t*KO}return e===e?e:0}var YO=function(){return iE.Date.now()};const Ym=YO;var QO="Expected a function",XO=Math.max,JO=Math.min;function ZO(e,t,n){var r,o,s,i,u,d,p=0,h=!1,m=!1,v=!0;if(typeof e!="function")throw new TypeError(QO);t=Wg(t)||0,lE(n)&&(h=!!n.leading,m="maxWait"in n,s=m?XO(Wg(n.maxWait)||0,t):s,v="trailing"in n?!!n.trailing:v);function b(O){var R=r,T=o;return r=o=void 0,p=O,i=e.apply(T,R),i}function S(O){return p=O,u=setTimeout(_,t),h?b(O):i}function w(O){var R=O-d,T=O-p,A=t-R;return m?JO(A,s-T):A}function C(O){var R=O-d,T=O-p;return d===void 0||R>=t||R<0||m&&T>=s}function _(){var O=Ym();if(C(O))return k(O);u=setTimeout(_,w(O))}function k(O){return u=void 0,v&&r?b(O):(r=o=void 0,i)}function j(){u!==void 0&&clearTimeout(u),p=0,r=d=o=u=void 0}function E(){return u===void 0?i:k(Ym())}function I(){var O=Ym(),R=C(O);if(r=arguments,o=this,d=O,R){if(u===void 0)return S(d);if(m)return clearTimeout(u),u=setTimeout(_,t),b(d)}return u===void 0&&(u=setTimeout(_,t)),i}return I.cancel=j,I.flush=E,I}var e9=200;function t9(e,t,n,r){var o=-1,s=l4,i=!0,u=e.length,d=[],p=t.length;if(!u)return d;n&&(t=hu(t,a4(n))),r?(s=c4,i=!1):t.length>=e9&&(s=Vg,i=!1,t=new i4(t));e:for(;++o=120&&h.length>=120)?new i4(i&&h):void 0}h=e[0];var m=-1,v=u[0];e:for(;++ma.jsx(mo,{ref:d,viewBox:t,...o,...u,children:s.length?s:a.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}var y9=Object.defineProperty,b9=(e,t,n)=>t in e?y9(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lr=(e,t,n)=>(b9(e,typeof t!="symbol"?t+"":t,n),n);function Ix(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 x9=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function Ex(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function Ox(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var Qg=typeof window<"u"?f.useLayoutEffect:f.useEffect,Tf=e=>e,w9=class{constructor(){lr(this,"descendants",new Map),lr(this,"register",e=>{if(e!=null)return x9(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),lr(this,"unregister",e=>{this.descendants.delete(e);const t=Ix(Array.from(this.descendants.keys()));this.assignIndex(t)}),lr(this,"destroy",()=>{this.descendants.clear()}),lr(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),lr(this,"count",()=>this.descendants.size),lr(this,"enabledCount",()=>this.enabledValues().length),lr(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),lr(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),lr(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),lr(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),lr(this,"first",()=>this.item(0)),lr(this,"firstEnabled",()=>this.enabledItem(0)),lr(this,"last",()=>this.item(this.descendants.size-1)),lr(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),lr(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),lr(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),lr(this,"next",(e,t=!0)=>{const n=Ex(e,this.count(),t);return this.item(n)}),lr(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=Ex(r,this.enabledCount(),t);return this.enabledItem(o)}),lr(this,"prev",(e,t=!0)=>{const n=Ox(e,this.count()-1,t);return this.item(n)}),lr(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=Ox(r,this.enabledCount()-1,t);return this.enabledItem(o)}),lr(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=Ix(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 S9(){const e=f.useRef(new w9);return Qg(()=>()=>e.current.destroy()),e.current}var[C9,P3]=cr({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function _9(e){const t=P3(),[n,r]=f.useState(-1),o=f.useRef(null);Qg(()=>()=>{o.current&&t.unregister(o.current)},[]),Qg(()=>{if(!o.current)return;const i=Number(o.current.dataset.index);n!=i&&!Number.isNaN(i)&&r(i)});const s=Tf(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:Wn(s,o)}}function yv(){return[Tf(C9),()=>Tf(P3()),()=>S9(),o=>_9(o)]}var[k9,Xp]=cr({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[P9,bv]=cr({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[j9,Voe,I9,E9]=yv(),Ac=tt(function(t,n){const{getButtonProps:r}=bv(),o=r(t,n),i={display:"flex",alignItems:"center",width:"100%",outline:0,...Xp().button};return a.jsx(He.button,{...o,className:Ot("chakra-accordion__button",t.className),__css:i})});Ac.displayName="AccordionButton";function O9(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...i}=e;D9(e),T9(e);const u=I9(),[d,p]=f.useState(-1);f.useEffect(()=>()=>{p(-1)},[]);const[h,m]=mu({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:h,setIndex:m,htmlProps:i,getAccordionItemProps:b=>{let S=!1;return b!==null&&(S=Array.isArray(h)?h.includes(b):h===b),{isOpen:S,onChange:C=>{if(b!==null)if(o&&Array.isArray(h)){const _=C?h.concat(b):h.filter(k=>k!==b);m(_)}else C?m(b):s&&m(-1)}}},focusedIndex:d,setFocusedIndex:p,descendants:u}}var[R9,xv]=cr({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function M9(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:i}=xv(),u=f.useRef(null),d=f.useId(),p=r??d,h=`accordion-button-${p}`,m=`accordion-panel-${p}`;A9(e);const{register:v,index:b,descendants:S}=E9({disabled:t&&!n}),{isOpen:w,onChange:C}=s(b===-1?null:b);N9({isOpen:w,isDisabled:t});const _=()=>{C==null||C(!0)},k=()=>{C==null||C(!1)},j=f.useCallback(()=>{C==null||C(!w),i(b)},[b,i,w,C]),E=f.useCallback(T=>{const z={ArrowDown:()=>{const $=S.nextEnabled(b);$==null||$.node.focus()},ArrowUp:()=>{const $=S.prevEnabled(b);$==null||$.node.focus()},Home:()=>{const $=S.firstEnabled();$==null||$.node.focus()},End:()=>{const $=S.lastEnabled();$==null||$.node.focus()}}[T.key];z&&(T.preventDefault(),z(T))},[S,b]),I=f.useCallback(()=>{i(b)},[i,b]),O=f.useCallback(function(A={},z=null){return{...A,type:"button",ref:Wn(v,u,z),id:h,disabled:!!t,"aria-expanded":!!w,"aria-controls":m,onClick:mt(A.onClick,j),onFocus:mt(A.onFocus,I),onKeyDown:mt(A.onKeyDown,E)}},[h,t,w,j,I,E,m,v]),R=f.useCallback(function(A={},z=null){return{...A,ref:z,role:"region",id:m,"aria-labelledby":h,hidden:!w}},[h,w,m]);return{isOpen:w,isDisabled:t,isFocusable:n,onOpen:_,onClose:k,getButtonProps:O,getPanelProps:R,htmlProps:o}}function D9(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;gu({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function T9(e){gu({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 A9(e){gu({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 N9(e){gu({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Nc(e){const{isOpen:t,isDisabled:n}=bv(),{reduceMotion:r}=xv(),o=Ot("chakra-accordion__icon",e.className),s=Xp(),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(mo,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:i,...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Nc.displayName="AccordionIcon";var $c=tt(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...i}=M9(t),d={...Xp().container,overflowAnchor:"none"},p=f.useMemo(()=>i,[i]);return a.jsx(P9,{value:p,children:a.jsx(He.div,{ref:n,...s,className:Ot("chakra-accordion__item",o),__css:d,children:typeof r=="function"?r({isExpanded:!!i.isOpen,isDisabled:!!i.isDisabled}):r})})});$c.displayName="AccordionItem";var bi={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},kc={scale:{enter:{scale:1},exit:{scale:.95}},fade:{enter:{opacity:1},exit:{opacity:0}},pushLeft:{enter:{x:"100%"},exit:{x:"-30%"}},pushRight:{enter:{x:"-100%"},exit:{x:"30%"}},pushUp:{enter:{y:"100%"},exit:{y:"-30%"}},pushDown:{enter:{y:"-100%"},exit:{y:"30%"}},slideLeft:{position:{left:0,top:0,bottom:0,width:"100%"},enter:{x:0,y:0},exit:{x:"-100%",y:0}},slideRight:{position:{right:0,top:0,bottom:0,width:"100%"},enter:{x:0,y:0},exit:{x:"100%",y:0}},slideUp:{position:{top:0,left:0,right:0,maxWidth:"100vw"},enter:{x:0,y:0},exit:{x:0,y:"-100%"}},slideDown:{position:{bottom:0,left:0,right:0,maxWidth:"100vw"},enter:{x:0,y:0},exit:{x:0,y:"100%"}}};function Xg(e){var t;switch((t=e==null?void 0:e.direction)!=null?t:"right"){case"right":return kc.slideRight;case"left":return kc.slideLeft;case"bottom":return kc.slideDown;case"top":return kc.slideUp;default:return kc.slideRight}}var wi={enter:{duration:.2,ease:bi.easeOut},exit:{duration:.1,ease:bi.easeIn}},us={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})},$9=e=>e!=null&&parseInt(e.toString(),10)>0,Rx={exit:{height:{duration:.2,ease:bi.ease},opacity:{duration:.3,ease:bi.ease}},enter:{height:{duration:.3,ease:bi.ease},opacity:{duration:.4,ease:bi.ease}}},z9={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:$9(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:us.exit(Rx.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:us.enter(Rx.enter,o)}}},Jp=f.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:i="auto",style:u,className:d,transition:p,transitionEnd:h,...m}=e,[v,b]=f.useState(!1);f.useEffect(()=>{const k=setTimeout(()=>{b(!0)});return()=>clearTimeout(k)},[]),gu({condition:Number(s)>0&&!!r,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const S=parseFloat(s.toString())>0,w={startingHeight:s,endingHeight:i,animateOpacity:o,transition:v?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:S?"block":"none"}}},C=r?n:!0,_=n||r?"enter":"exit";return a.jsx(ws,{initial:!1,custom:w,children:C&&a.jsx(io.div,{ref:t,...m,className:Ot("chakra-collapse",d),style:{overflow:"hidden",display:"block",...u},custom:w,variants:z9,initial:r?"exit":!1,animate:_,exit:"exit"})})});Jp.displayName="Collapse";var L9={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:us.enter(wi.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:us.exit(wi.exit,n),transitionEnd:t==null?void 0:t.exit}}},j3={initial:"exit",animate:"enter",exit:"exit",variants:L9},B9=f.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:i,transitionEnd:u,delay:d,...p}=t,h=o||r?"enter":"exit",m=r?o&&r:!0,v={transition:i,transitionEnd:u,delay:d};return a.jsx(ws,{custom:v,children:m&&a.jsx(io.div,{ref:n,className:Ot("chakra-fade",s),custom:v,...j3,animate:h,...p})})});B9.displayName="Fade";var F9={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:us.exit(wi.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:us.enter(wi.enter,n),transitionEnd:e==null?void 0:e.enter}}},I3={initial:"exit",animate:"enter",exit:"exit",variants:F9},H9=f.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:i=.95,className:u,transition:d,transitionEnd:p,delay:h,...m}=t,v=r?o&&r:!0,b=o||r?"enter":"exit",S={initialScale:i,reverse:s,transition:d,transitionEnd:p,delay:h};return a.jsx(ws,{custom:S,children:v&&a.jsx(io.div,{ref:n,className:Ot("chakra-offset-slide",u),...I3,animate:b,custom:S,...m})})});H9.displayName="ScaleFade";var W9={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:us.exit(wi.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:us.enter(wi.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 u={x:t,y:e};return{opacity:0,transition:(i=n==null?void 0:n.exit)!=null?i:us.exit(wi.exit,s),...o?{...u,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...u,...r==null?void 0:r.exit}}}}},Jg={initial:"initial",animate:"enter",exit:"exit",variants:W9},V9=f.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:i,offsetX:u=0,offsetY:d=8,transition:p,transitionEnd:h,delay:m,...v}=t,b=r?o&&r:!0,S=o||r?"enter":"exit",w={offsetX:u,offsetY:d,reverse:s,transition:p,transitionEnd:h,delay:m};return a.jsx(ws,{custom:w,children:b&&a.jsx(io.div,{ref:n,className:Ot("chakra-offset-slide",i),custom:w,...Jg,animate:S,...v})})});V9.displayName="SlideFade";var Mx={exit:{duration:.15,ease:bi.easeInOut},enter:{type:"spring",damping:25,stiffness:180}},U9={exit:({direction:e,transition:t,transitionEnd:n,delay:r})=>{var o;const{exit:s}=Xg({direction:e});return{...s,transition:(o=t==null?void 0:t.exit)!=null?o:us.exit(Mx.exit,r),transitionEnd:n==null?void 0:n.exit}},enter:({direction:e,transitionEnd:t,transition:n,delay:r})=>{var o;const{enter:s}=Xg({direction:e});return{...s,transition:(o=n==null?void 0:n.enter)!=null?o:us.enter(Mx.enter,r),transitionEnd:t==null?void 0:t.enter}}},E3=f.forwardRef(function(t,n){const{direction:r="right",style:o,unmountOnExit:s,in:i,className:u,transition:d,transitionEnd:p,delay:h,motionProps:m,...v}=t,b=Xg({direction:r}),S=Object.assign({position:"fixed"},b.position,o),w=s?i&&s:!0,C=i||s?"enter":"exit",_={transitionEnd:p,transition:d,direction:r,delay:h};return a.jsx(ws,{custom:_,children:w&&a.jsx(io.div,{...v,ref:n,initial:"exit",className:Ot("chakra-slide",u),animate:C,exit:"exit",custom:_,variants:U9,style:S,...m})})});E3.displayName="Slide";var zc=tt(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:i}=xv(),{getPanelProps:u,isOpen:d}=bv(),p=u(s,n),h=Ot("chakra-accordion__panel",r),m=Xp();i||delete p.hidden;const v=a.jsx(He.div,{...p,__css:m.panel,className:h});return i?v:a.jsx(Jp,{in:d,...o,children:v})});zc.displayName="AccordionPanel";var O3=tt(function({children:t,reduceMotion:n,...r},o){const s=lo("Accordion",r),i=wr(r),{htmlProps:u,descendants:d,...p}=O9(i),h=f.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return a.jsx(j9,{value:d,children:a.jsx(R9,{value:h,children:a.jsx(k9,{value:s,children:a.jsx(He.div,{ref:o,...u,className:Ot("chakra-accordion",r.className),__css:s.root,children:t})})})})});O3.displayName="Accordion";var G9={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}}},q9={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},Yn=tt(function(t,n){const{size:r,colorScheme:o,variant:s,className:i,spacing:u="0.5rem",isAttached:d,isDisabled:p,orientation:h="horizontal",...m}=t,v=Ot("chakra-button__group",i),b=f.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let S={display:"inline-flex",...d?G9[h]:q9[h](u)};const w=h==="vertical";return a.jsx(yE,{value:b,children:a.jsx(He.div,{ref:n,role:"group",__css:S,className:v,"data-attached":d?"":void 0,"data-orientation":h,flexDir:w?"column":void 0,...m})})});Yn.displayName="ButtonGroup";var[Uoe,K9]=cr({name:"CheckboxGroupContext",strict:!1});function Y9(e){const[t,n]=f.useState(e),[r,o]=f.useState(!1);return e!==t&&(o(!0),n(e)),r}function Q9(e){return a.jsx(He.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 X9(e){return a.jsx(He.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 J9(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?X9:Q9;return n||t?a.jsx(He.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:a.jsx(o,{...r})}):null}var wv={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},R3=He("span",{baseStyle:wv});R3.displayName="VisuallyHidden";var Z9=He("input",{baseStyle:wv});Z9.displayName="VisuallyHiddenInput";var Dx=!1,_u=null,Ii=!1,Zg=!1,e0=new Set;function Sv(e,t){e0.forEach(n=>n(e,t))}var eR=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function tR(e){return!(e.metaKey||!eR&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Tx(e){Ii=!0,tR(e)&&(_u="keyboard",Sv("keyboard",e))}function sl(e){if(_u="pointer",e.type==="mousedown"||e.type==="pointerdown"){Ii=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;Sv("pointer",e)}}function nR(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function rR(e){nR(e)&&(Ii=!0,_u="virtual")}function oR(e){e.target===window||e.target===document||(!Ii&&!Zg&&(_u="virtual",Sv("virtual",e)),Ii=!1,Zg=!1)}function sR(){Ii=!1,Zg=!0}function Ax(){return _u!=="pointer"}function aR(){if(typeof window>"u"||Dx)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Ii=!0,e.apply(this,n)},document.addEventListener("keydown",Tx,!0),document.addEventListener("keyup",Tx,!0),document.addEventListener("click",rR,!0),window.addEventListener("focus",oR,!0),window.addEventListener("blur",sR,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",sl,!0),document.addEventListener("pointermove",sl,!0),document.addEventListener("pointerup",sl,!0)):(document.addEventListener("mousedown",sl,!0),document.addEventListener("mousemove",sl,!0),document.addEventListener("mouseup",sl,!0)),Dx=!0}function M3(e){aR(),e(Ax());const t=()=>e(Ax());return e0.add(t),()=>{e0.delete(t)}}function iR(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function D3(e={}){const t=bE(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:i,onBlur:u,onFocus:d,"aria-describedby":p}=t,{defaultChecked:h,isChecked:m,isFocusable:v,onChange:b,isIndeterminate:S,name:w,value:C,tabIndex:_=void 0,"aria-label":k,"aria-labelledby":j,"aria-invalid":E,...I}=e,O=iR(I,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),R=Ua(b),T=Ua(u),A=Ua(d),[z,$]=f.useState(!1),[ee,B]=f.useState(!1),[H,G]=f.useState(!1),[K,M]=f.useState(!1);f.useEffect(()=>M3($),[]);const U=f.useRef(null),[V,J]=f.useState(!0),[ie,xe]=f.useState(!!h),he=m!==void 0,ae=he?m:ie,Z=f.useCallback(me=>{if(r||n){me.preventDefault();return}he||xe(ae?me.target.checked:S?!0:me.target.checked),R==null||R(me)},[r,n,ae,he,S,R]);Wc(()=>{U.current&&(U.current.indeterminate=!!S)},[S]),Ni(()=>{n&&B(!1)},[n,B]),Wc(()=>{const me=U.current;me!=null&&me.form&&(me.form.onreset=()=>{xe(!!h)})},[]);const W=n&&!v,re=f.useCallback(me=>{me.key===" "&&M(!0)},[M]),pe=f.useCallback(me=>{me.key===" "&&M(!1)},[M]);Wc(()=>{if(!U.current)return;U.current.checked!==ae&&xe(U.current.checked)},[U.current]);const ne=f.useCallback((me={},_e=null)=>{const We=Le=>{ee&&Le.preventDefault(),M(!0)};return{...me,ref:_e,"data-active":sn(K),"data-hover":sn(H),"data-checked":sn(ae),"data-focus":sn(ee),"data-focus-visible":sn(ee&&z),"data-indeterminate":sn(S),"data-disabled":sn(n),"data-invalid":sn(s),"data-readonly":sn(r),"aria-hidden":!0,onMouseDown:mt(me.onMouseDown,We),onMouseUp:mt(me.onMouseUp,()=>M(!1)),onMouseEnter:mt(me.onMouseEnter,()=>G(!0)),onMouseLeave:mt(me.onMouseLeave,()=>G(!1))}},[K,ae,n,ee,z,H,S,s,r]),ge=f.useCallback((me={},_e=null)=>({...O,...me,ref:Wn(_e,We=>{We&&J(We.tagName==="LABEL")}),onClick:mt(me.onClick,()=>{var We;V||((We=U.current)==null||We.click(),requestAnimationFrame(()=>{var Le;(Le=U.current)==null||Le.focus({preventScroll:!0})}))}),"data-disabled":sn(n),"data-checked":sn(ae),"data-invalid":sn(s)}),[O,n,ae,s,V]),ue=f.useCallback((me={},_e=null)=>({...me,ref:Wn(U,_e),type:"checkbox",name:w,value:C,id:i,tabIndex:_,onChange:mt(me.onChange,Z),onBlur:mt(me.onBlur,T,()=>B(!1)),onFocus:mt(me.onFocus,A,()=>B(!0)),onKeyDown:mt(me.onKeyDown,re),onKeyUp:mt(me.onKeyUp,pe),required:o,checked:ae,disabled:W,readOnly:r,"aria-label":k,"aria-labelledby":j,"aria-invalid":E?!!E:s,"aria-describedby":p,"aria-disabled":n,style:wv}),[w,C,i,Z,T,A,re,pe,o,ae,W,r,k,j,E,s,p,n,_]),Ce=f.useCallback((me={},_e=null)=>({...me,ref:_e,onMouseDown:mt(me.onMouseDown,lR),"data-disabled":sn(n),"data-checked":sn(ae),"data-invalid":sn(s)}),[ae,n,s]);return{state:{isInvalid:s,isFocused:ee,isChecked:ae,isActive:K,isHovered:H,isIndeterminate:S,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:ge,getCheckboxProps:ne,getInputProps:ue,getLabelProps:Ce,htmlProps:O}}function lR(e){e.preventDefault(),e.stopPropagation()}var cR={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},uR={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},dR=Sa({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),fR=Sa({from:{opacity:0},to:{opacity:1}}),pR=Sa({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),T3=tt(function(t,n){const r=K9(),o={...r,...t},s=lo("Checkbox",o),i=wr(t),{spacing:u="0.5rem",className:d,children:p,iconColor:h,iconSize:m,icon:v=a.jsx(J9,{}),isChecked:b,isDisabled:S=r==null?void 0:r.isDisabled,onChange:w,inputProps:C,..._}=i;let k=b;r!=null&&r.value&&i.value&&(k=r.value.includes(i.value));let j=w;r!=null&&r.onChange&&i.value&&(j=Vp(r.onChange,w));const{state:E,getInputProps:I,getCheckboxProps:O,getLabelProps:R,getRootProps:T}=D3({..._,isDisabled:S,isChecked:k,onChange:j}),A=Y9(E.isChecked),z=f.useMemo(()=>({animation:A?E.isIndeterminate?`${fR} 20ms linear, ${pR} 200ms linear`:`${dR} 200ms linear`:void 0,fontSize:m,color:h,...s.icon}),[h,m,A,E.isIndeterminate,s.icon]),$=f.cloneElement(v,{__css:z,isIndeterminate:E.isIndeterminate,isChecked:E.isChecked});return a.jsxs(He.label,{__css:{...uR,...s.container},className:Ot("chakra-checkbox",d),...T(),children:[a.jsx("input",{className:"chakra-checkbox__input",...I(C,n)}),a.jsx(He.span,{__css:{...cR,...s.control},className:"chakra-checkbox__control",...O(),children:$}),p&&a.jsx(He.span,{className:"chakra-checkbox__label",...R(),__css:{marginStart:u,...s.label},children:p})]})});T3.displayName="Checkbox";var[hR,A3]=cr({name:"EditableStylesContext",errorMessage:`useEditableStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[mR,N3]=cr({name:"EditableContext",errorMessage:"useEditableContext: context is undefined. Seems you forgot to wrap the editable components in ``"}),$3={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent"},z3=tt(function(t,n){const{getInputProps:r}=N3(),o=A3(),s=r(t,n),i=Ot("chakra-editable__input",t.className);return a.jsx(He.input,{...s,__css:{outline:0,...$3,...o.input},className:i})});z3.displayName="EditableInput";var L3=tt(function(t,n){const{getPreviewProps:r}=N3(),o=A3(),s=r(t,n),i=Ot("chakra-editable__preview",t.className);return a.jsx(He.span,{...s,__css:{cursor:"text",display:"inline-block",...$3,...o.preview},className:i})});L3.displayName="EditablePreview";function gR(e){return"current"in e}var B3=()=>typeof window<"u";function vR(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var yR=e=>B3()&&e.test(navigator.vendor),bR=e=>B3()&&e.test(vR()),xR=()=>bR(/mac|iphone|ipad|ipod/i),wR=()=>xR()&&yR(/apple/i);function F3(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};ev(o,"pointerdown",s=>{if(!wR()||!r)return;const i=s.target,d=(n??[t]).some(p=>{const h=gR(p)?p.current:p;return(h==null?void 0:h.contains(i))||h===i});o().activeElement!==i&&d&&(s.preventDefault(),i.focus())})}function Nx(e,t){return e?e===t||e.contains(t):!1}function SR(e={}){const{onChange:t,onCancel:n,onSubmit:r,onBlur:o,value:s,isDisabled:i,defaultValue:u,startWithEditView:d,isPreviewFocusable:p=!0,submitOnBlur:h=!0,selectAllOnFocus:m=!0,placeholder:v,onEdit:b,finalFocusRef:S,...w}=e,C=Ua(b),_=!!(d&&!i),[k,j]=f.useState(_),[E,I]=mu({defaultValue:u||"",value:s,onChange:t}),[O,R]=f.useState(E),T=f.useRef(null),A=f.useRef(null),z=f.useRef(null),$=f.useRef(null),ee=f.useRef(null);F3({ref:T,enabled:k,elements:[$,ee]});const B=!k&&!i;Wc(()=>{var ne,ge;k&&((ne=T.current)==null||ne.focus(),m&&((ge=T.current)==null||ge.select()))},[]),Ni(()=>{var ne,ge,ue,Ce;if(!k){S?(ne=S.current)==null||ne.focus():(ge=z.current)==null||ge.focus();return}(ue=T.current)==null||ue.focus(),m&&((Ce=T.current)==null||Ce.select()),C==null||C()},[k,C,m]);const H=f.useCallback(()=>{B&&j(!0)},[B]),G=f.useCallback(()=>{R(E)},[E]),K=f.useCallback(()=>{j(!1),I(O),n==null||n(O),o==null||o(O)},[n,o,I,O]),M=f.useCallback(()=>{j(!1),R(E),r==null||r(E),o==null||o(O)},[E,r,o,O]);f.useEffect(()=>{if(k)return;const ne=T.current;(ne==null?void 0:ne.ownerDocument.activeElement)===ne&&(ne==null||ne.blur())},[k]);const U=f.useCallback(ne=>{I(ne.currentTarget.value)},[I]),V=f.useCallback(ne=>{const ge=ne.key,Ce={Escape:K,Enter:Me=>{!Me.shiftKey&&!Me.metaKey&&M()}}[ge];Ce&&(ne.preventDefault(),Ce(ne))},[K,M]),J=f.useCallback(ne=>{const ge=ne.key,Ce={Escape:K}[ge];Ce&&(ne.preventDefault(),Ce(ne))},[K]),ie=E.length===0,xe=f.useCallback(ne=>{var ge;if(!k)return;const ue=ne.currentTarget.ownerDocument,Ce=(ge=ne.relatedTarget)!=null?ge:ue.activeElement,Me=Nx($.current,Ce),me=Nx(ee.current,Ce);!Me&&!me&&(h?M():K())},[h,M,K,k]),he=f.useCallback((ne={},ge=null)=>{const ue=B&&p?0:void 0;return{...ne,ref:Wn(ge,A),children:ie?v:E,hidden:k,"aria-disabled":Sl(i),tabIndex:ue,onFocus:mt(ne.onFocus,H,G)}},[i,k,B,p,ie,H,G,v,E]),ae=f.useCallback((ne={},ge=null)=>({...ne,hidden:!k,placeholder:v,ref:Wn(ge,T),disabled:i,"aria-disabled":Sl(i),value:E,onBlur:mt(ne.onBlur,xe),onChange:mt(ne.onChange,U),onKeyDown:mt(ne.onKeyDown,V),onFocus:mt(ne.onFocus,G)}),[i,k,xe,U,V,G,v,E]),Z=f.useCallback((ne={},ge=null)=>({...ne,hidden:!k,placeholder:v,ref:Wn(ge,T),disabled:i,"aria-disabled":Sl(i),value:E,onBlur:mt(ne.onBlur,xe),onChange:mt(ne.onChange,U),onKeyDown:mt(ne.onKeyDown,J),onFocus:mt(ne.onFocus,G)}),[i,k,xe,U,J,G,v,E]),W=f.useCallback((ne={},ge=null)=>({"aria-label":"Edit",...ne,type:"button",onClick:mt(ne.onClick,H),ref:Wn(ge,z),disabled:i}),[H,i]),re=f.useCallback((ne={},ge=null)=>({...ne,"aria-label":"Submit",ref:Wn(ee,ge),type:"button",onClick:mt(ne.onClick,M),disabled:i}),[M,i]),pe=f.useCallback((ne={},ge=null)=>({"aria-label":"Cancel",id:"cancel",...ne,ref:Wn($,ge),type:"button",onClick:mt(ne.onClick,K),disabled:i}),[K,i]);return{isEditing:k,isDisabled:i,isValueEmpty:ie,value:E,onEdit:H,onCancel:K,onSubmit:M,getPreviewProps:he,getInputProps:ae,getTextareaProps:Z,getEditButtonProps:W,getSubmitButtonProps:re,getCancelButtonProps:pe,htmlProps:w}}var H3=tt(function(t,n){const r=lo("Editable",t),o=wr(t),{htmlProps:s,...i}=SR(o),{isEditing:u,onSubmit:d,onCancel:p,onEdit:h}=i,m=Ot("chakra-editable",t.className),v=tv(t.children,{isEditing:u,onSubmit:d,onCancel:p,onEdit:h});return a.jsx(mR,{value:i,children:a.jsx(hR,{value:r,children:a.jsx(He.div,{ref:n,...s,className:m,children:v})})})});H3.displayName="Editable";var W3={exports:{}},CR="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",_R=CR,kR=_R;function V3(){}function U3(){}U3.resetWarningCache=V3;var PR=function(){function e(r,o,s,i,u,d){if(d!==kR){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:U3,resetWarningCache:V3};return n.PropTypes=n,n};W3.exports=PR();var jR=W3.exports;const Tn=vu(jR);var t0="data-focus-lock",G3="data-focus-lock-disabled",IR="data-no-focus-lock",ER="data-autofocus-inside",OR="data-no-autofocus";function RR(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function MR(e,t){var n=f.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 q3(e,t){return MR(t||null,function(n){return e.forEach(function(r){return RR(r,n)})})}var Qm={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},Ls=function(){return Ls=Object.assign||function(t){for(var n,r=1,o=arguments.length;r0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]0)&&!(o=r.next()).done;)s.push(o.value)}catch(u){i={error:u}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function n0(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(GR)},qR=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],Pv=qR.join(","),KR="".concat(Pv,", [data-focus-guard]"),d6=function(e,t){return Ks((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?KR:Pv)?[r]:[],d6(r))},[])},YR=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?Zp([e.contentDocument.body],t):[e]},Zp=function(e,t){return e.reduce(function(n,r){var o,s=d6(r,t),i=(o=[]).concat.apply(o,s.map(function(u){return YR(u,t)}));return n.concat(i,r.parentNode?Ks(r.parentNode.querySelectorAll(Pv)).filter(function(u){return u===r}):[])},[])},QR=function(e){var t=e.querySelectorAll("[".concat(ER,"]"));return Ks(t).map(function(n){return Zp([n])}).reduce(function(n,r){return n.concat(r)},[])},jv=function(e,t){return Ks(e).filter(function(n){return s6(t,n)}).filter(function(n){return WR(n)})},zx=function(e,t){return t===void 0&&(t=new Map),Ks(e).filter(function(n){return a6(t,n)})},o0=function(e,t,n){return u6(jv(Zp(e,n),t),!0,n)},Lx=function(e,t){return u6(jv(Zp(e),t),!1)},XR=function(e,t){return jv(QR(e),t)},Pl=function(e,t){return e.shadowRoot?Pl(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:Ks(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?Pl(o,t):!1}return Pl(n,t)})},JR=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,u){return!t.has(u)})},f6=function(e){return e.parentNode?f6(e.parentNode):e},Iv=function(e){var t=Af(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(t0);return n.push.apply(n,o?JR(Ks(f6(r).querySelectorAll("[".concat(t0,'="').concat(o,'"]:not([').concat(G3,'="disabled"])')))):[r]),n},[])},ZR=function(e){try{return e()}catch{return}},tu=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?tu(t.shadowRoot):t instanceof HTMLIFrameElement&&ZR(function(){return t.contentWindow.document})?tu(t.contentWindow.document):t}},eM=function(e,t){return e===t},tM=function(e,t){return!!Ks(e.querySelectorAll("iframe")).some(function(n){return eM(n,t)})},p6=function(e,t){return t===void 0&&(t=tu(n6(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:Iv(e).some(function(n){return Pl(n,t)||tM(n,t)})},nM=function(e){e===void 0&&(e=document);var t=tu(e);return t?Ks(e.querySelectorAll("[".concat(IR,"]"))).some(function(n){return Pl(n,t)}):!1},rM=function(e,t){return t.filter(c6).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},Ev=function(e,t){return c6(e)&&e.name?rM(e,t):e},oM=function(e){var t=new Set;return e.forEach(function(n){return t.add(Ev(n,e))}),e.filter(function(n){return t.has(n)})},Bx=function(e){return e[0]&&e.length>1?Ev(e[0],e):e[0]},Fx=function(e,t){return e.length>1?e.indexOf(Ev(e[t],e)):t},h6="NEW_FOCUS",sM=function(e,t,n,r){var o=e.length,s=e[0],i=e[o-1],u=kv(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,v=t.indexOf(s),b=t.indexOf(i),S=oM(t),w=n!==void 0?S.indexOf(n):-1,C=w-(r?S.indexOf(r):d),_=Fx(e,0),k=Fx(e,o-1);if(d===-1||h===-1)return h6;if(!m&&h>=0)return h;if(d<=v&&u&&Math.abs(m)>1)return k;if(d>=b&&u&&Math.abs(m)>1)return _;if(m&&Math.abs(C)>1)return h;if(d<=v)return k;if(d>b)return _;if(m)return Math.abs(m)>1?h:(o+h+m)%o}},aM=function(e){return function(t){var n,r=(n=i6(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},iM=function(e,t,n){var r=e.map(function(s){var i=s.node;return i}),o=zx(r.filter(aM(n)));return o&&o.length?Bx(o):Bx(zx(t))},s0=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&s0(e.parentNode.host||e.parentNode,t),t},Xm=function(e,t){for(var n=s0(e),r=s0(t),o=0;o=0)return s}return!1},m6=function(e,t,n){var r=Af(e),o=Af(t),s=r[0],i=!1;return o.filter(Boolean).forEach(function(u){i=Xm(i||u,u)||i,n.filter(Boolean).forEach(function(d){var p=Xm(s,d);p&&(!i||Pl(p,i)?i=p:i=Xm(p,i))})}),i},lM=function(e,t){return e.reduce(function(n,r){return n.concat(XR(r,t))},[])},cM=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(UR)},uM=function(e,t){var n=tu(Af(e).length>0?document:n6(e).ownerDocument),r=Iv(e).filter(Nf),o=m6(n||e,e,r),s=new Map,i=Lx(r,s),u=o0(r,s).filter(function(b){var S=b.node;return Nf(S)});if(!(!u[0]&&(u=i,!u[0]))){var d=Lx([o],s).map(function(b){var S=b.node;return S}),p=cM(d,u),h=p.map(function(b){var S=b.node;return S}),m=sM(h,d,n,t);if(m===h6){var v=iM(i,h,lM(r,s));if(v)return{node:v};console.warn("focus-lock: cannot find any node to move focus into");return}return m===void 0?m:p[m]}},dM=function(e){var t=Iv(e).filter(Nf),n=m6(e,e,t),r=new Map,o=o0([n],r,!0),s=o0(t,r).filter(function(i){var u=i.node;return Nf(u)}).map(function(i){var u=i.node;return u});return o.map(function(i){var u=i.node,d=i.index;return{node:u,index:d,lockItem:s.indexOf(u)>=0,guard:kv(u)}})},fM=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},Jm=0,Zm=!1,g6=function(e,t,n){n===void 0&&(n={});var r=uM(e,t);if(!Zm&&r){if(Jm>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Zm=!0,setTimeout(function(){Zm=!1},1);return}Jm++,fM(r.node,n.focusOptions),Jm--}};function Ov(e){setTimeout(e,1)}var pM=function(){return document&&document.activeElement===document.body},hM=function(){return pM()||nM()},jl=null,vl=null,Il=null,nu=!1,mM=function(){return!0},gM=function(t){return(jl.whiteList||mM)(t)},vM=function(t,n){Il={observerNode:t,portaledElement:n}},yM=function(t){return Il&&Il.portaledElement===t};function Hx(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 bM=function(t){return t&&"current"in t?t.current:t},xM=function(t){return t?!!nu:nu==="meanwhile"},wM=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},SM=function(t,n){return n.some(function(r){return wM(t,r,r)})},$f=function(){var t=!1;if(jl){var n=jl,r=n.observed,o=n.persistentFocus,s=n.autoFocus,i=n.shards,u=n.crossFrame,d=n.focusOptions,p=r||Il&&Il.portaledElement,h=document&&document.activeElement;if(p){var m=[p].concat(i.map(bM).filter(Boolean));if((!h||gM(h))&&(o||xM(u)||!hM()||!vl&&s)&&(p&&!(p6(m)||h&&SM(h,m)||yM(h))&&(document&&!vl&&h&&!s?(h.blur&&h.blur(),document.body.focus()):(t=g6(m,vl,{focusOptions:d}),Il={})),nu=!1,vl=document&&document.activeElement),document){var v=document&&document.activeElement,b=dM(m),S=b.map(function(w){var C=w.node;return C}).indexOf(v);S>-1&&(b.filter(function(w){var C=w.guard,_=w.node;return C&&_.dataset.focusAutoGuard}).forEach(function(w){var C=w.node;return C.removeAttribute("tabIndex")}),Hx(S,b.length,1,b),Hx(S,-1,-1,b))}}}return t},v6=function(t){$f()&&t&&(t.stopPropagation(),t.preventDefault())},Rv=function(){return Ov($f)},CM=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||vM(r,n)},_M=function(){return null},y6=function(){nu="just",Ov(function(){nu="meanwhile"})},kM=function(){document.addEventListener("focusin",v6),document.addEventListener("focusout",Rv),window.addEventListener("blur",y6)},PM=function(){document.removeEventListener("focusin",v6),document.removeEventListener("focusout",Rv),window.removeEventListener("blur",y6)};function jM(e){return e.filter(function(t){var n=t.disabled;return!n})}function IM(e){var t=e.slice(-1)[0];t&&!jl&&kM();var n=jl,r=n&&t&&t.id===n.id;jl=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(vl=null,(!r||n.observed!==t.observed)&&t.onActivation(),$f(),Ov($f)):(PM(),vl=null)}Z3.assignSyncMedium(CM);e6.assignMedium(Rv);TR.assignMedium(function(e){return e({moveFocusInside:g6,focusInside:p6})});const EM=zR(jM,IM)(_M);var b6=f.forwardRef(function(t,n){return f.createElement(t6,Qn({sideCar:EM,ref:n},t))}),x6=t6.propTypes||{};x6.sideCar;qO(x6,["sideCar"]);b6.propTypes={};const Wx=b6;var w6=e=>e.hasAttribute("tabindex"),OM=e=>w6(e)&&e.tabIndex===-1;function RM(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function S6(e){return e.parentElement&&S6(e.parentElement)?!0:e.hidden}function MM(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function C6(e){if(!d4(e)||S6(e)||RM(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]():MM(e)?!0:w6(e)}function DM(e){return e?d4(e)&&C6(e)&&!OM(e):!1}var TM=["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]"],AM=TM.join(),NM=e=>e.offsetWidth>0&&e.offsetHeight>0;function _6(e){const t=Array.from(e.querySelectorAll(AM));return t.unshift(e),t.filter(n=>C6(n)&&NM(n))}var Vx,$M=(Vx=Wx.default)!=null?Vx:Wx,k6=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:i,autoFocus:u,persistentFocus:d,lockFocusAcrossFrames:p}=e,h=f.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&_6(r.current).length===0&&requestAnimationFrame(()=>{var S;(S=r.current)==null||S.focus()})},[t,r]),m=f.useCallback(()=>{var b;(b=n==null?void 0:n.current)==null||b.focus()},[n]),v=o&&!n;return a.jsx($M,{crossFrame:p,persistentFocus:d,autoFocus:u,disabled:i,onActivation:h,onDeactivation:m,returnFocus:v,children:s})};k6.displayName="FocusLock";function zM(e,t,n,r){const o=f4(t);return f.useEffect(()=>{var s;const i=(s=zb(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=zb(n))!=null?s:document).removeEventListener(e,o,r)}}function LM(e){const{ref:t,handler:n,enabled:r=!0}=e,o=f4(n),i=f.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;f.useEffect(()=>{if(!r)return;const u=m=>{eg(m,t)&&(i.isPointerDown=!0)},d=m=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&eg(m,t)&&(i.isPointerDown=!1,o(m))},p=m=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&eg(m,t)&&(i.isPointerDown=!1,o(m))},h=p4(t.current);return h.addEventListener("mousedown",u,!0),h.addEventListener("mouseup",d,!0),h.addEventListener("touchstart",u,!0),h.addEventListener("touchend",p,!0),()=>{h.removeEventListener("mousedown",u,!0),h.removeEventListener("mouseup",d,!0),h.removeEventListener("touchstart",u,!0),h.removeEventListener("touchend",p,!0)}},[n,t,o,i,r])}function eg(e,t){var n;const r=e.target;return r&&!p4(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}var[BM,FM]=cr({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),P6=tt(function(t,n){const r=lo("Input",t),{children:o,className:s,...i}=wr(t),u=Ot("chakra-input__group",s),d={},p=Up(o),h=r.field;p.forEach(v=>{var b,S;r&&(h&&v.type.id==="InputLeftElement"&&(d.paddingStart=(b=h.height)!=null?b:h.h),h&&v.type.id==="InputRightElement"&&(d.paddingEnd=(S=h.height)!=null?S:h.h),v.type.id==="InputRightAddon"&&(d.borderEndRadius=0),v.type.id==="InputLeftAddon"&&(d.borderStartRadius=0))});const m=p.map(v=>{var b,S;const w=vv({size:((b=v.props)==null?void 0:b.size)||t.size,variant:((S=v.props)==null?void 0:S.variant)||t.variant});return v.type.id!=="Input"?f.cloneElement(v,w):f.cloneElement(v,Object.assign(w,d,v.props))});return a.jsx(He.div,{className:u,ref:n,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate"},"data-group":!0,...i,children:a.jsx(BM,{value:r,children:m})})});P6.displayName="InputGroup";var HM=He("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),eh=tt(function(t,n){var r,o;const{placement:s="left",...i}=t,u=FM(),d=u.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,...u.element};return a.jsx(HM,{ref:n,__css:h,...i})});eh.id="InputElement";eh.displayName="InputElement";var j6=tt(function(t,n){const{className:r,...o}=t,s=Ot("chakra-input__left-element",r);return a.jsx(eh,{ref:n,placement:"left",className:s,...o})});j6.id="InputLeftElement";j6.displayName="InputLeftElement";var Mv=tt(function(t,n){const{className:r,...o}=t,s=Ot("chakra-input__right-element",r);return a.jsx(eh,{ref:n,placement:"right",className:s,...o})});Mv.id="InputRightElement";Mv.displayName="InputRightElement";var ku=tt(function(t,n){const{htmlSize:r,...o}=t,s=lo("Input",o),i=wr(o),u=nv(i),d=Ot("chakra-input",t.className);return a.jsx(He.input,{size:r,...u,__css:s.field,ref:n,className:d})});ku.displayName="Input";ku.id="Input";var Ka=tt(function(t,n){const r=Kl("Link",t),{className:o,isExternal:s,...i}=wr(t);return a.jsx(He.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:Ot("chakra-link",o),...i,__css:r})});Ka.displayName="Link";var[WM,I6]=cr({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Dv=tt(function(t,n){const r=lo("List",t),{children:o,styleType:s="none",stylePosition:i,spacing:u,...d}=wr(t),p=Up(o),m=u?{["& > *:not(style) ~ *:not(style)"]:{mt:u}}:{};return a.jsx(WM,{value:r,children:a.jsx(He.ul,{ref:n,listStyleType:s,listStylePosition:i,role:"list",__css:{...r.container,...m},...d,children:p})})});Dv.displayName="List";var VM=tt((e,t)=>{const{as:n,...r}=e;return a.jsx(Dv,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});VM.displayName="OrderedList";var th=tt(function(t,n){const{as:r,...o}=t;return a.jsx(Dv,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});th.displayName="UnorderedList";var Eo=tt(function(t,n){const r=I6();return a.jsx(He.li,{ref:n,...t,__css:r.item})});Eo.displayName="ListItem";var UM=tt(function(t,n){const r=I6();return a.jsx(mo,{ref:n,role:"presentation",...t,__css:r.icon})});UM.displayName="ListIcon";var Ei=tt(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:i,column:u,row:d,autoFlow:p,autoRows:h,templateRows:m,autoColumns:v,templateColumns:b,...S}=t,w={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:i,gridAutoColumns:v,gridColumn:u,gridRow:d,gridAutoFlow:p,gridAutoRows:h,gridTemplateRows:m,gridTemplateColumns:b};return a.jsx(He.div,{ref:n,__css:w,...S})});Ei.displayName="Grid";var $i=He("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});$i.displayName="Spacer";var nt=tt(function(t,n){const r=Kl("Text",t),{className:o,align:s,decoration:i,casing:u,...d}=wr(t),p=vv({textAlign:t.align,textDecoration:t.decoration,textTransform:t.casing});return a.jsx(He.p,{ref:n,className:Ot("chakra-text",t.className),...p,...d,__css:r})});nt.displayName="Text";var E6=tt((e,t)=>a.jsx(wE,{align:"center",...e,direction:"column",ref:t}));E6.displayName="VStack";function Ux(e){return SE(e,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}var hf=tt(function(t,n){const{area:r,colSpan:o,colStart:s,colEnd:i,rowEnd:u,rowSpan:d,rowStart:p,...h}=t,m=vv({gridArea:r,gridColumn:Ux(o),gridRow:Ux(d),gridColumnStart:s,gridColumnEnd:i,gridRowStart:p,gridRowEnd:u});return a.jsx(He.div,{ref:n,__css:m,...h})});hf.displayName="GridItem";var Xa=tt(function(t,n){const r=Kl("Badge",t),{className:o,...s}=wr(t);return a.jsx(He.span,{ref:n,className:Ot("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});Xa.displayName="Badge";var ni=tt(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:i,borderWidth:u,borderStyle:d,borderColor:p,...h}=Kl("Divider",t),{className:m,orientation:v="horizontal",__css:b,...S}=wr(t),w={vertical:{borderLeftWidth:r||i||u||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||u||"1px",width:"100%"}};return a.jsx(He.hr,{ref:n,"aria-orientation":v,...S,__css:{...h,border:"0",borderColor:p,borderStyle:d,...w[v],...b},className:Ot("chakra-divider",m)})});ni.displayName="Divider";function GM(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function qM(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=f.useState([]),s=f.useRef(),i=()=>{s.current&&(clearTimeout(s.current),s.current=null)},u=()=>{i(),s.current=setTimeout(()=>{o([]),s.current=null},t)};f.useEffect(()=>i,[]);function d(p){return h=>{if(h.key==="Backspace"){const m=[...r];m.pop(),o(m);return}if(GM(h)){const m=r.concat(h.key);n(h)&&(h.preventDefault(),h.stopPropagation()),o(m),p(m.join("")),u()}}}return d}function KM(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 YM(){const e=f.useRef(new Map),t=e.current,n=f.useCallback((o,s,i,u)=>{e.current.set(i,{type:s,el:o,options:u}),o.addEventListener(s,i,u)},[]),r=f.useCallback((o,s,i,u)=>{o.removeEventListener(s,i,u),e.current.delete(i)},[]);return f.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function tg(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function O6(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:i,onMouseUp:u,onClick:d,onKeyDown:p,onKeyUp:h,tabIndex:m,onMouseOver:v,onMouseLeave:b,...S}=e,[w,C]=f.useState(!0),[_,k]=f.useState(!1),j=YM(),E=M=>{M&&M.tagName!=="BUTTON"&&C(!1)},I=w?m:m||0,O=n&&!r,R=f.useCallback(M=>{if(n){M.stopPropagation(),M.preventDefault();return}M.currentTarget.focus(),d==null||d(M)},[n,d]),T=f.useCallback(M=>{_&&tg(M)&&(M.preventDefault(),M.stopPropagation(),k(!1),j.remove(document,"keyup",T,!1))},[_,j]),A=f.useCallback(M=>{if(p==null||p(M),n||M.defaultPrevented||M.metaKey||!tg(M.nativeEvent)||w)return;const U=o&&M.key==="Enter";s&&M.key===" "&&(M.preventDefault(),k(!0)),U&&(M.preventDefault(),M.currentTarget.click()),j.add(document,"keyup",T,!1)},[n,w,p,o,s,j,T]),z=f.useCallback(M=>{if(h==null||h(M),n||M.defaultPrevented||M.metaKey||!tg(M.nativeEvent)||w)return;s&&M.key===" "&&(M.preventDefault(),k(!1),M.currentTarget.click())},[s,w,n,h]),$=f.useCallback(M=>{M.button===0&&(k(!1),j.remove(document,"mouseup",$,!1))},[j]),ee=f.useCallback(M=>{if(M.button!==0)return;if(n){M.stopPropagation(),M.preventDefault();return}w||k(!0),M.currentTarget.focus({preventScroll:!0}),j.add(document,"mouseup",$,!1),i==null||i(M)},[n,w,i,j,$]),B=f.useCallback(M=>{M.button===0&&(w||k(!1),u==null||u(M))},[u,w]),H=f.useCallback(M=>{if(n){M.preventDefault();return}v==null||v(M)},[n,v]),G=f.useCallback(M=>{_&&(M.preventDefault(),k(!1)),b==null||b(M)},[_,b]),K=Wn(t,E);return w?{...S,ref:K,type:"button","aria-disabled":O?void 0:n,disabled:O,onClick:R,onMouseDown:i,onMouseUp:u,onKeyUp:h,onKeyDown:p,onMouseOver:v,onMouseLeave:b}:{...S,ref:K,role:"button","data-active":sn(_),"aria-disabled":n?"true":void 0,tabIndex:O?void 0:I,onClick:R,onMouseDown:ee,onMouseUp:B,onKeyUp:z,onKeyDown:A,onMouseOver:H,onMouseLeave:G}}function QM(e){const t=e.current;if(!t)return!1;const n=CE(t);return!n||t.contains(n)?!1:!!DM(n)}function R6(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;Ni(()=>{if(!s||QM(e))return;const i=(o==null?void 0:o.current)||e.current;let u;if(i)return u=requestAnimationFrame(()=>{i.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(u)}},[s,e,o])}var XM={preventScroll:!0,shouldFocus:!1};function JM(e,t=XM){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,i=ZM(e)?e.current:e,u=o&&s,d=f.useRef(u),p=f.useRef(s);Wc(()=>{!p.current&&s&&(d.current=u),p.current=s},[s,u]);const h=f.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=_6(i);m.length>0&&requestAnimationFrame(()=>{m[0].focus({preventScroll:r})})}},[s,r,i,n]);Ni(()=>{h()},[h]),ev(i,"transitionend",h)}function ZM(e){return"current"in e}function eD(e){const{ref:t,handler:n,enabled:r=!0}=e,o=Ua(n),i=f.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;f.useEffect(()=>{if(!r)return;const u=m=>{ng(m,t)&&(i.isPointerDown=!0)},d=m=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&ng(m,t)&&(i.isPointerDown=!1,o(m))},p=m=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&ng(m,t)&&(i.isPointerDown=!1,o(m))},h=M6(t.current);return h.addEventListener("mousedown",u,!0),h.addEventListener("mouseup",d,!0),h.addEventListener("touchstart",u,!0),h.addEventListener("touchend",p,!0),()=>{h.removeEventListener("mousedown",u,!0),h.removeEventListener("mouseup",d,!0),h.removeEventListener("touchstart",u,!0),h.removeEventListener("touchend",p,!0)}},[n,t,o,i,r])}function ng(e,t){var n;const r=e.target;return r&&!M6(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function M6(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function D6(e){const{isOpen:t,ref:n}=e,[r,o]=f.useState(t),[s,i]=f.useState(!1);return f.useEffect(()=>{s||(o(t),i(!0))},[t,s,r]),ev(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var d;const p=_E(n.current),h=new p.CustomEvent("animationend",{bubbles:!0});(d=n.current)==null||d.dispatchEvent(h)}}}function Tv(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[tD,nD,rD,oD]=yv(),[sD,Pu]=cr({strict:!1,name:"MenuContext"});function aD(e,...t){const n=f.useId(),r=e||n;return f.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function T6(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Gx(e){return T6(e).activeElement===e}function iD(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:i,isOpen:u,defaultIsOpen:d,onClose:p,onOpen:h,placement:m="bottom-start",lazyBehavior:v="unmount",direction:b,computePositionOnMount:S=!1,...w}=e,C=f.useRef(null),_=f.useRef(null),k=rD(),j=f.useCallback(()=>{requestAnimationFrame(()=>{var he;(he=C.current)==null||he.focus({preventScroll:!1})})},[]),E=f.useCallback(()=>{const he=setTimeout(()=>{var ae;if(o)(ae=o.current)==null||ae.focus();else{const Z=k.firstEnabled();Z&&B(Z.index)}});U.current.add(he)},[k,o]),I=f.useCallback(()=>{const he=setTimeout(()=>{const ae=k.lastEnabled();ae&&B(ae.index)});U.current.add(he)},[k]),O=f.useCallback(()=>{h==null||h(),s?E():j()},[s,E,j,h]),{isOpen:R,onOpen:T,onClose:A,onToggle:z}=h4({isOpen:u,defaultIsOpen:d,onClose:p,onOpen:O});eD({enabled:R&&r,ref:C,handler:he=>{var ae;(ae=_.current)!=null&&ae.contains(he.target)||A()}});const $=m4({...w,enabled:R||S,placement:m,direction:b}),[ee,B]=f.useState(-1);Ni(()=>{R||B(-1)},[R]),R6(C,{focusRef:_,visible:R,shouldFocus:!0});const H=D6({isOpen:R,ref:C}),[G,K]=aD(t,"menu-button","menu-list"),M=f.useCallback(()=>{T(),j()},[T,j]),U=f.useRef(new Set([]));mD(()=>{U.current.forEach(he=>clearTimeout(he)),U.current.clear()});const V=f.useCallback(()=>{T(),E()},[E,T]),J=f.useCallback(()=>{T(),I()},[T,I]),ie=f.useCallback(()=>{var he,ae;const Z=T6(C.current),W=(he=C.current)==null?void 0:he.contains(Z.activeElement);if(!(R&&!W))return;const pe=(ae=k.item(ee))==null?void 0:ae.node;pe==null||pe.focus()},[R,ee,k]),xe=f.useRef(null);return{openAndFocusMenu:M,openAndFocusFirstItem:V,openAndFocusLastItem:J,onTransitionEnd:ie,unstable__animationState:H,descendants:k,popper:$,buttonId:G,menuId:K,forceUpdate:$.forceUpdate,orientation:"vertical",isOpen:R,onToggle:z,onOpen:T,onClose:A,menuRef:C,buttonRef:_,focusedIndex:ee,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:B,isLazy:i,lazyBehavior:v,initialFocusRef:o,rafId:xe}}function lD(e={},t=null){const n=Pu(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:i}=n,u=f.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:Wn(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":sn(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:mt(e.onClick,r),onKeyDown:mt(e.onKeyDown,u)}}function a0(e){var t;return pD(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function cD(e={},t=null){const n=Pu();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:u,menuId:d,isLazy:p,lazyBehavior:h,unstable__animationState:m}=n,v=nD(),b=qM({preventDefault:_=>_.key!==" "&&a0(_.target)}),S=f.useCallback(_=>{if(!_.currentTarget.contains(_.target))return;const k=_.key,E={Tab:O=>O.preventDefault(),Escape:u,ArrowDown:()=>{const O=v.nextEnabled(r);O&&o(O.index)},ArrowUp:()=>{const O=v.prevEnabled(r);O&&o(O.index)}}[k];if(E){_.preventDefault(),E(_);return}const I=b(O=>{const R=KM(v.values(),O,T=>{var A,z;return(z=(A=T==null?void 0:T.node)==null?void 0:A.textContent)!=null?z:""},v.item(r));if(R){const T=v.indexOf(R.node);o(T)}});a0(_.target)&&I(_)},[v,r,b,u,o]),w=f.useRef(!1);i&&(w.current=!0);const C=Tv({wasSelected:w.current,enabled:p,mode:h,isSelected:m.present});return{...e,ref:Wn(s,t),children:C?e.children:null,tabIndex:-1,role:"menu",id:d,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:mt(e.onKeyDown,S)}}function uD(e={}){const{popper:t,isOpen:n}=Pu();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function A6(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:i,isDisabled:u,isFocusable:d,closeOnSelect:p,type:h,...m}=e,v=Pu(),{setFocusedIndex:b,focusedIndex:S,closeOnSelect:w,onClose:C,menuRef:_,isOpen:k,menuId:j,rafId:E}=v,I=f.useRef(null),O=`${j}-menuitem-${f.useId()}`,{index:R,register:T}=oD({disabled:u&&!d}),A=f.useCallback(M=>{n==null||n(M),!u&&b(R)},[b,R,u,n]),z=f.useCallback(M=>{r==null||r(M),I.current&&!Gx(I.current)&&A(M)},[A,r]),$=f.useCallback(M=>{o==null||o(M),!u&&b(-1)},[b,u,o]),ee=f.useCallback(M=>{s==null||s(M),a0(M.currentTarget)&&(p??w)&&C()},[C,s,w,p]),B=f.useCallback(M=>{i==null||i(M),b(R)},[b,i,R]),H=R===S,G=u&&!d;Ni(()=>{k&&(H&&!G&&I.current?(E.current&&cancelAnimationFrame(E.current),E.current=requestAnimationFrame(()=>{var M;(M=I.current)==null||M.focus(),E.current=null})):_.current&&!Gx(_.current)&&_.current.focus({preventScroll:!0}))},[H,G,_,k]);const K=O6({onClick:ee,onFocus:B,onMouseEnter:A,onMouseMove:z,onMouseLeave:$,ref:Wn(T,I,t),isDisabled:u,isFocusable:d});return{...m,...K,type:h??K.type,id:O,role:"menuitem",tabIndex:H?0:-1}}function dD(e={},t=null){const{type:n="radio",isChecked:r,...o}=e;return{...A6(o,t),role:`menuitem${n}`,"aria-checked":r}}function fD(e={}){const{children:t,type:n="radio",value:r,defaultValue:o,onChange:s,...i}=e,d=n==="radio"?"":[],[p,h]=mu({defaultValue:o??d,value:r,onChange:s}),m=f.useCallback(S=>{if(n==="radio"&&typeof p=="string"&&h(S),n==="checkbox"&&Array.isArray(p)){const w=p.includes(S)?p.filter(C=>C!==S):p.concat(S);h(w)}},[p,h,n]),b=Up(t).map(S=>{if(S.type.id!=="MenuItemOption")return S;const w=_=>{var k,j;m(S.props.value),(j=(k=S.props).onClick)==null||j.call(k,_)},C=n==="radio"?S.props.value===p:p.includes(S.props.value);return f.cloneElement(S,{type:n,onClick:w,isChecked:C})});return{...i,children:b}}function pD(e){var t;if(!hD(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function hD(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function mD(e,t=[]){return f.useEffect(()=>()=>e(),t)}var[gD,ju]=cr({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Iu=e=>{const{children:t}=e,n=lo("Menu",e),r=wr(e),{direction:o}=Gp(),{descendants:s,...i}=iD({...r,direction:o}),u=f.useMemo(()=>i,[i]),{isOpen:d,onClose:p,forceUpdate:h}=u;return a.jsx(tD,{value:s,children:a.jsx(sD,{value:u,children:a.jsx(gD,{value:n,children:tv(t,{isOpen:d,onClose:p,forceUpdate:h})})})})};Iu.displayName="Menu";var N6=tt((e,t)=>{const n=ju();return a.jsx(He.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});N6.displayName="MenuCommand";var $6=tt((e,t)=>{const{type:n,...r}=e,o=ju(),s=r.as||n?n??void 0:"button",i=f.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(He.button,{ref:t,type:s,...r,__css:i})}),Av=e=>{const{className:t,children:n,...r}=e,o=f.Children.only(n),s=f.isValidElement(o)?f.cloneElement(o,{focusable:"false","aria-hidden":!0,className:Ot("chakra-menu__icon",o.props.className)}):null,i=Ot("chakra-menu__icon-wrapper",t);return a.jsx(He.span,{className:i,...r,__css:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:s})};Av.displayName="MenuIcon";var jr=tt((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:i,...u}=e,d=A6(u,t),h=n||o?a.jsx("span",{style:{pointerEvents:"none",flex:1},children:i}):i;return a.jsxs($6,{...d,className:Ot("chakra-menu__menuitem",d.className),children:[n&&a.jsx(Av,{fontSize:"0.8em",marginEnd:r,children:n}),h,o&&a.jsx(N6,{marginStart:s,children:o})]})});jr.displayName="MenuItem";var vD={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"}}},yD=He(io.div),tc=tt(function(t,n){var r,o;const{rootProps:s,motionProps:i,...u}=t,{isOpen:d,onTransitionEnd:p,unstable__animationState:h}=Pu(),m=cD(u,n),v=uD(s),b=ju();return a.jsx(He.div,{...v,__css:{zIndex:(o=t.zIndex)!=null?o:(r=b.list)==null?void 0:r.zIndex},children:a.jsx(yD,{variants:vD,initial:!1,animate:d?"enter":"exit",__css:{outline:0,...b.list},...i,className:Ot("chakra-menu__menu-list",m.className),...m,onUpdate:p,onAnimationComplete:Vp(h.onComplete,m.onAnimationComplete)})})});tc.displayName="MenuList";var z6=tt((e,t)=>{const{title:n,children:r,className:o,...s}=e,i=Ot("chakra-menu__group__title",o),u=ju();return a.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[n&&a.jsx(He.p,{className:i,...s,__css:u.groupTitle,children:n}),r]})});z6.displayName="MenuGroup";var Nv=e=>{const{className:t,title:n,...r}=e,o=fD(r);return a.jsx(z6,{title:n,className:Ot("chakra-menu__option-group",t),...o})};Nv.displayName="MenuOptionGroup";var bD=tt((e,t)=>{const n=ju();return a.jsx(He.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),Eu=tt((e,t)=>{const{children:n,as:r,...o}=e,s=lD(o,t),i=r||bD;return a.jsx(i,{...s,className:Ot("chakra-menu__menu-button",e.className),children:a.jsx(He.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});Eu.displayName="MenuButton";var xD=e=>a.jsx("svg",{viewBox:"0 0 14 14",width:"1em",height:"1em",...e,children:a.jsx("polygon",{fill:"currentColor",points:"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039"})}),ru=tt((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",...o}=e,s=dD(o,t);return a.jsxs($6,{...s,className:Ot("chakra-menu__menuitem-option",o.className),children:[n!==null&&a.jsx(Av,{fontSize:"0.8em",marginEnd:r,opacity:e.isChecked?1:0,children:n||a.jsx(xD,{})}),a.jsx("span",{style:{flex:1},children:s.children})]})});ru.id="MenuItemOption";ru.displayName="MenuItemOption";var wD={slideInBottom:{...Jg,custom:{offsetY:16,reverse:!0}},slideInRight:{...Jg,custom:{offsetX:16,reverse:!0}},scale:{...I3,custom:{initialScale:.95,reverse:!0}},none:{}},SD=He(io.section),CD=e=>wD[e||"none"],L6=f.forwardRef((e,t)=>{const{preset:n,motionProps:r=CD(n),...o}=e;return a.jsx(SD,{ref:t,...r,...o})});L6.displayName="ModalTransition";var _D=Object.defineProperty,kD=(e,t,n)=>t in e?_D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,PD=(e,t,n)=>(kD(e,typeof t!="symbol"?t+"":t,n),n),jD=class{constructor(){PD(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}},i0=new jD;function B6(e,t){const[n,r]=f.useState(0);return f.useEffect(()=>{const o=e.current;if(o){if(t){const s=i0.add(o);r(s)}return()=>{i0.remove(o),r(0)}}},[t,e]),n}var ID=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},al=new WeakMap,Id=new WeakMap,Ed={},rg=0,F6=function(e){return e&&(e.host||F6(e.parentNode))},ED=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=F6(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})},OD=function(e,t,n,r){var o=ED(t,Array.isArray(e)?e:[e]);Ed[n]||(Ed[n]=new WeakMap);var s=Ed[n],i=[],u=new Set,d=new Set(o),p=function(m){!m||u.has(m)||(u.add(m),p(m.parentNode))};o.forEach(p);var h=function(m){!m||d.has(m)||Array.prototype.forEach.call(m.children,function(v){if(u.has(v))h(v);else{var b=v.getAttribute(r),S=b!==null&&b!=="false",w=(al.get(v)||0)+1,C=(s.get(v)||0)+1;al.set(v,w),s.set(v,C),i.push(v),w===1&&S&&Id.set(v,!0),C===1&&v.setAttribute(n,"true"),S||v.setAttribute(r,"true")}})};return h(t),u.clear(),rg++,function(){i.forEach(function(m){var v=al.get(m)-1,b=s.get(m)-1;al.set(m,v),s.set(m,b),v||(Id.has(m)||m.removeAttribute(r),Id.delete(m)),b||m.removeAttribute(n)}),rg--,rg||(al=new WeakMap,al=new WeakMap,Id=new WeakMap,Ed={})}},RD=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||ID(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),OD(r,o,n,"aria-hidden")):function(){return null}};function MD(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:i=!0,onOverlayClick:u,onEsc:d}=e,p=f.useRef(null),h=f.useRef(null),[m,v,b]=TD(r,"chakra-modal","chakra-modal--header","chakra-modal--body");DD(p,t&&i);const S=B6(p,t),w=f.useRef(null),C=f.useCallback(A=>{w.current=A.target},[]),_=f.useCallback(A=>{A.key==="Escape"&&(A.stopPropagation(),s&&(n==null||n()),d==null||d())},[s,n,d]),[k,j]=f.useState(!1),[E,I]=f.useState(!1),O=f.useCallback((A={},z=null)=>({role:"dialog",...A,ref:Wn(z,p),id:m,tabIndex:-1,"aria-modal":!0,"aria-labelledby":k?v:void 0,"aria-describedby":E?b:void 0,onClick:mt(A.onClick,$=>$.stopPropagation())}),[b,E,m,v,k]),R=f.useCallback(A=>{A.stopPropagation(),w.current===A.target&&i0.isTopModal(p.current)&&(o&&(n==null||n()),u==null||u())},[n,o,u]),T=f.useCallback((A={},z=null)=>({...A,ref:Wn(z,h),onClick:mt(A.onClick,R),onKeyDown:mt(A.onKeyDown,_),onMouseDown:mt(A.onMouseDown,C)}),[_,C,R]);return{isOpen:t,onClose:n,headerId:v,bodyId:b,setBodyMounted:I,setHeaderMounted:j,dialogRef:p,overlayRef:h,getDialogProps:O,getDialogContainerProps:T,index:S}}function DD(e,t){const n=e.current;f.useEffect(()=>{if(!(!e.current||!t))return RD(e.current)},[t,e,n])}function TD(e,...t){const n=f.useId(),r=e||n;return f.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[AD,nc]=cr({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[ND,Oi]=cr({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),ou=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:u,returnFocusOnClose:d,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:m,motionPreset:v,lockFocusAcrossFrames:b,onCloseComplete:S}=t,w=lo("Modal",t),_={...MD(t),autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:u,returnFocusOnClose:d,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:m,motionPreset:v,lockFocusAcrossFrames:b};return a.jsx(ND,{value:_,children:a.jsx(AD,{value:w,children:a.jsx(ws,{onExitComplete:S,children:_.isOpen&&a.jsx(xf,{...n,children:r})})})})};ou.displayName="Modal";var mf="right-scroll-bar-position",gf="width-before-scroll-bar",$D="with-scroll-bars-hidden",zD="--removed-body-scroll-bar-size",H6=X3(),og=function(){},nh=f.forwardRef(function(e,t){var n=f.useRef(null),r=f.useState({onScrollCapture:og,onWheelCapture:og,onTouchMoveCapture:og}),o=r[0],s=r[1],i=e.forwardProps,u=e.children,d=e.className,p=e.removeScrollBar,h=e.enabled,m=e.shards,v=e.sideCar,b=e.noIsolation,S=e.inert,w=e.allowPinchZoom,C=e.as,_=C===void 0?"div":C,k=e.gapMode,j=K3(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=v,I=q3([n,t]),O=Ls(Ls({},j),o);return f.createElement(f.Fragment,null,h&&f.createElement(E,{sideCar:H6,removeScrollBar:p,shards:m,noIsolation:b,inert:S,setCallbacks:s,allowPinchZoom:!!w,lockRef:n,gapMode:k}),i?f.cloneElement(f.Children.only(u),Ls(Ls({},O),{ref:I})):f.createElement(_,Ls({},O,{className:d,ref:I}),u))});nh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};nh.classNames={fullWidth:gf,zeroRight:mf};var qx,LD=function(){if(qx)return qx;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function BD(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=LD();return t&&e.setAttribute("nonce",t),e}function FD(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function HD(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var WD=function(){var e=0,t=null;return{add:function(n){e==0&&(t=BD())&&(FD(t,n),HD(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},VD=function(){var e=WD();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},W6=function(){var e=VD(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},UD={left:0,top:0,right:0,gap:0},sg=function(e){return parseInt(e||"",10)||0},GD=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[sg(n),sg(r),sg(o)]},qD=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return UD;var t=GD(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])}},KD=W6(),YD=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,u=e.gap;return n===void 0&&(n="margin"),` - .`.concat($D,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(u,"px ").concat(r,`; - } - body { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(o,`px; - padding-top: `).concat(s,`px; - padding-right: `).concat(i,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(u,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(mf,` { - right: `).concat(u,"px ").concat(r,`; - } - - .`).concat(gf,` { - margin-right: `).concat(u,"px ").concat(r,`; - } - - .`).concat(mf," .").concat(mf,` { - right: 0 `).concat(r,`; - } - - .`).concat(gf," .").concat(gf,` { - margin-right: 0 `).concat(r,`; - } - - body { - `).concat(zD,": ").concat(u,`px; - } -`)},QD=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=f.useMemo(function(){return qD(o)},[o]);return f.createElement(KD,{styles:YD(s,!t,o,n?"":"!important")})},l0=!1;if(typeof window<"u")try{var Od=Object.defineProperty({},"passive",{get:function(){return l0=!0,!0}});window.addEventListener("test",Od,Od),window.removeEventListener("test",Od,Od)}catch{l0=!1}var il=l0?{passive:!1}:!1,XD=function(e){return e.tagName==="TEXTAREA"},V6=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!XD(e)&&n[t]==="visible")},JD=function(e){return V6(e,"overflowY")},ZD=function(e){return V6(e,"overflowX")},Kx=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=U6(e,r);if(o){var s=G6(e,r),i=s[1],u=s[2];if(i>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},eT=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},tT=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},U6=function(e,t){return e==="v"?JD(t):ZD(t)},G6=function(e,t){return e==="v"?eT(t):tT(t)},nT=function(e,t){return e==="h"&&t==="rtl"?-1:1},rT=function(e,t,n,r,o){var s=nT(e,window.getComputedStyle(t).direction),i=s*r,u=n.target,d=t.contains(u),p=!1,h=i>0,m=0,v=0;do{var b=G6(e,u),S=b[0],w=b[1],C=b[2],_=w-C-s*S;(S||_)&&U6(e,u)&&(m+=_,v+=S),u=u.parentNode}while(!d&&u!==document.body||d&&(t.contains(u)||t===u));return(h&&(o&&m===0||!o&&i>m)||!h&&(o&&v===0||!o&&-i>v))&&(p=!0),p},Rd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Yx=function(e){return[e.deltaX,e.deltaY]},Qx=function(e){return e&&"current"in e?e.current:e},oT=function(e,t){return e[0]===t[0]&&e[1]===t[1]},sT=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},aT=0,ll=[];function iT(e){var t=f.useRef([]),n=f.useRef([0,0]),r=f.useRef(),o=f.useState(aT++)[0],s=f.useState(W6)[0],i=f.useRef(e);f.useEffect(function(){i.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var w=n0([e.lockRef.current],(e.shards||[]).map(Qx),!0).filter(Boolean);return w.forEach(function(C){return C.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),w.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var u=f.useCallback(function(w,C){if("touches"in w&&w.touches.length===2)return!i.current.allowPinchZoom;var _=Rd(w),k=n.current,j="deltaX"in w?w.deltaX:k[0]-_[0],E="deltaY"in w?w.deltaY:k[1]-_[1],I,O=w.target,R=Math.abs(j)>Math.abs(E)?"h":"v";if("touches"in w&&R==="h"&&O.type==="range")return!1;var T=Kx(R,O);if(!T)return!0;if(T?I=R:(I=R==="v"?"h":"v",T=Kx(R,O)),!T)return!1;if(!r.current&&"changedTouches"in w&&(j||E)&&(r.current=I),!I)return!0;var A=r.current||I;return rT(A,C,w,A==="h"?j:E,!0)},[]),d=f.useCallback(function(w){var C=w;if(!(!ll.length||ll[ll.length-1]!==s)){var _="deltaY"in C?Yx(C):Rd(C),k=t.current.filter(function(I){return I.name===C.type&&I.target===C.target&&oT(I.delta,_)})[0];if(k&&k.should){C.cancelable&&C.preventDefault();return}if(!k){var j=(i.current.shards||[]).map(Qx).filter(Boolean).filter(function(I){return I.contains(C.target)}),E=j.length>0?u(C,j[0]):!i.current.noIsolation;E&&C.cancelable&&C.preventDefault()}}},[]),p=f.useCallback(function(w,C,_,k){var j={name:w,delta:C,target:_,should:k};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(E){return E!==j})},1)},[]),h=f.useCallback(function(w){n.current=Rd(w),r.current=void 0},[]),m=f.useCallback(function(w){p(w.type,Yx(w),w.target,u(w,e.lockRef.current))},[]),v=f.useCallback(function(w){p(w.type,Rd(w),w.target,u(w,e.lockRef.current))},[]);f.useEffect(function(){return ll.push(s),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:v}),document.addEventListener("wheel",d,il),document.addEventListener("touchmove",d,il),document.addEventListener("touchstart",h,il),function(){ll=ll.filter(function(w){return w!==s}),document.removeEventListener("wheel",d,il),document.removeEventListener("touchmove",d,il),document.removeEventListener("touchstart",h,il)}},[]);var b=e.removeScrollBar,S=e.inert;return f.createElement(f.Fragment,null,S?f.createElement(s,{styles:sT(o)}):null,b?f.createElement(QD,{gapMode:e.gapMode}):null)}const lT=DR(H6,iT);var q6=f.forwardRef(function(e,t){return f.createElement(nh,Ls({},e,{ref:t,sideCar:lT}))});q6.classNames=nh.classNames;const cT=q6;function uT(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:i,finalFocusRef:u,returnFocusOnClose:d,preserveScrollBarGap:p,lockFocusAcrossFrames:h,isOpen:m}=Oi(),[v,b]=kE();f.useEffect(()=>{!v&&b&&setTimeout(b)},[v,b]);const S=B6(r,m);return a.jsx(k6,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:u,restoreFocus:d,contentRef:r,lockFocusAcrossFrames:h,children:a.jsx(cT,{removeScrollBar:!p,allowPinchZoom:i,enabled:S===1&&s,forwardProps:!0,children:e.children})})}var su=tt((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...i}=e,{getDialogProps:u,getDialogContainerProps:d}=Oi(),p=u(i,t),h=d(o),m=Ot("chakra-modal__content",n),v=nc(),b={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...v.dialog},S={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...v.dialogContainer},{motionPreset:w}=Oi();return a.jsx(uT,{children:a.jsx(He.div,{...h,className:"chakra-modal__content-container",tabIndex:-1,__css:S,children:a.jsx(L6,{preset:w,motionProps:s,className:m,...p,__css:b,children:r})})})});su.displayName="ModalContent";function Ou(e){const{leastDestructiveRef:t,...n}=e;return a.jsx(ou,{...n,initialFocusRef:t})}var Ru=tt((e,t)=>a.jsx(su,{ref:t,role:"alertdialog",...e})),ma=tt((e,t)=>{const{className:n,...r}=e,o=Ot("chakra-modal__footer",n),i={display:"flex",alignItems:"center",justifyContent:"flex-end",...nc().footer};return a.jsx(He.footer,{ref:t,...r,__css:i,className:o})});ma.displayName="ModalFooter";var ga=tt((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=Oi();f.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=Ot("chakra-modal__header",n),d={flex:0,...nc().header};return a.jsx(He.header,{ref:t,className:i,id:o,...r,__css:d})});ga.displayName="ModalHeader";var dT=He(io.div),va=tt((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,i=Ot("chakra-modal__overlay",n),d={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...nc().overlay},{motionPreset:p}=Oi(),m=o||(p==="none"?{}:j3);return a.jsx(dT,{...m,__css:d,ref:t,className:i,...s})});va.displayName="ModalOverlay";var ya=tt((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=Oi();f.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=Ot("chakra-modal__body",n),u=nc();return a.jsx(He.div,{ref:t,className:i,id:o,...r,__css:u.body})});ya.displayName="ModalBody";var $v=tt((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=Oi(),i=Ot("chakra-modal__close-btn",r),u=nc();return a.jsx(PE,{ref:t,__css:u.closeButton,className:i,onClick:mt(n,d=>{d.stopPropagation(),s()}),...o})});$v.displayName="ModalCloseButton";var[fT,Mu]=cr({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[pT,zv]=cr({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Lv(e){const t=f.Children.only(e.children),{getTriggerProps:n}=Mu();return f.cloneElement(t,n(t.props,t.ref))}Lv.displayName="PopoverTrigger";var cl={click:"click",hover:"hover"};function hT(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:i=!0,arrowSize:u,arrowShadowColor:d,trigger:p=cl.click,openDelay:h=200,closeDelay:m=200,isLazy:v,lazyBehavior:b="unmount",computePositionOnMount:S,...w}=e,{isOpen:C,onClose:_,onOpen:k,onToggle:j}=h4(e),E=f.useRef(null),I=f.useRef(null),O=f.useRef(null),R=f.useRef(!1),T=f.useRef(!1);C&&(T.current=!0);const[A,z]=f.useState(!1),[$,ee]=f.useState(!1),B=f.useId(),H=o??B,[G,K,M,U]=["popover-trigger","popover-content","popover-header","popover-body"].map(_e=>`${_e}-${H}`),{referenceRef:V,getArrowProps:J,getPopperProps:ie,getArrowInnerProps:xe,forceUpdate:he}=m4({...w,enabled:C||!!S}),ae=D6({isOpen:C,ref:O});F3({enabled:C,ref:I}),R6(O,{focusRef:I,visible:C,shouldFocus:s&&p===cl.click}),JM(O,{focusRef:r,visible:C,shouldFocus:i&&p===cl.click});const Z=Tv({wasSelected:T.current,enabled:v,mode:b,isSelected:ae.present}),W=f.useCallback((_e={},We=null)=>{const Le={..._e,style:{..._e.style,transformOrigin:Hm.transformOrigin.varRef,[Hm.arrowSize.var]:u?`${u}px`:void 0,[Hm.arrowShadowColor.var]:d},ref:Wn(O,We),children:Z?_e.children:null,id:K,tabIndex:-1,role:"dialog",onKeyDown:mt(_e.onKeyDown,Ue=>{n&&Ue.key==="Escape"&&_()}),onBlur:mt(_e.onBlur,Ue=>{const kt=Xx(Ue),gt=ag(O.current,kt),Pn=ag(I.current,kt);C&&t&&(!gt&&!Pn)&&_()}),"aria-labelledby":A?M:void 0,"aria-describedby":$?U:void 0};return p===cl.hover&&(Le.role="tooltip",Le.onMouseEnter=mt(_e.onMouseEnter,()=>{R.current=!0}),Le.onMouseLeave=mt(_e.onMouseLeave,Ue=>{Ue.nativeEvent.relatedTarget!==null&&(R.current=!1,setTimeout(()=>_(),m))})),Le},[Z,K,A,M,$,U,p,n,_,C,t,m,d,u]),re=f.useCallback((_e={},We=null)=>ie({..._e,style:{visibility:C?"visible":"hidden",..._e.style}},We),[C,ie]),pe=f.useCallback((_e,We=null)=>({..._e,ref:Wn(We,E,V)}),[E,V]),ne=f.useRef(),ge=f.useRef(),ue=f.useCallback(_e=>{E.current==null&&V(_e)},[V]),Ce=f.useCallback((_e={},We=null)=>{const Le={..._e,ref:Wn(I,We,ue),id:G,"aria-haspopup":"dialog","aria-expanded":C,"aria-controls":K};return p===cl.click&&(Le.onClick=mt(_e.onClick,j)),p===cl.hover&&(Le.onFocus=mt(_e.onFocus,()=>{ne.current===void 0&&k()}),Le.onBlur=mt(_e.onBlur,Ue=>{const kt=Xx(Ue),gt=!ag(O.current,kt);C&&t&>&&_()}),Le.onKeyDown=mt(_e.onKeyDown,Ue=>{Ue.key==="Escape"&&_()}),Le.onMouseEnter=mt(_e.onMouseEnter,()=>{R.current=!0,ne.current=window.setTimeout(()=>k(),h)}),Le.onMouseLeave=mt(_e.onMouseLeave,()=>{R.current=!1,ne.current&&(clearTimeout(ne.current),ne.current=void 0),ge.current=window.setTimeout(()=>{R.current===!1&&_()},m)})),Le},[G,C,K,p,ue,j,k,t,_,h,m]);f.useEffect(()=>()=>{ne.current&&clearTimeout(ne.current),ge.current&&clearTimeout(ge.current)},[]);const Me=f.useCallback((_e={},We=null)=>({..._e,id:M,ref:Wn(We,Le=>{z(!!Le)})}),[M]),me=f.useCallback((_e={},We=null)=>({..._e,id:U,ref:Wn(We,Le=>{ee(!!Le)})}),[U]);return{forceUpdate:he,isOpen:C,onAnimationComplete:ae.onComplete,onClose:_,getAnchorProps:pe,getArrowProps:J,getArrowInnerProps:xe,getPopoverPositionerProps:re,getPopoverProps:W,getTriggerProps:Ce,getHeaderProps:Me,getBodyProps:me}}function ag(e,t){return e===t||(e==null?void 0:e.contains(t))}function Xx(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Bv(e){const t=lo("Popover",e),{children:n,...r}=wr(e),o=Gp(),s=hT({...r,direction:o.direction});return a.jsx(fT,{value:s,children:a.jsx(pT,{value:t,children:tv(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Bv.displayName="Popover";var ig=(e,t)=>t?`${e}.${t}, ${t}`:void 0;function K6(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:i,shadowColor:u}=e,{getArrowProps:d,getArrowInnerProps:p}=Mu(),h=zv(),m=(t=n??r)!=null?t:o,v=s??i;return a.jsx(He.div,{...d(),className:"chakra-popover__arrow-positioner",children:a.jsx(He.div,{className:Ot("chakra-popover__arrow",e.className),...p(e),__css:{"--popper-arrow-shadow-color":ig("colors",u),"--popper-arrow-bg":ig("colors",m),"--popper-arrow-shadow":ig("shadows",v),...h.arrow}})})}K6.displayName="PopoverArrow";var Y6=tt(function(t,n){const{getBodyProps:r}=Mu(),o=zv();return a.jsx(He.div,{...r(t,n),className:Ot("chakra-popover__body",t.className),__css:o.body})});Y6.displayName="PopoverBody";function mT(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var gT={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]}}},vT=He(io.section),Q6=tt(function(t,n){const{variants:r=gT,...o}=t,{isOpen:s}=Mu();return a.jsx(vT,{ref:n,variants:mT(r),initial:!1,animate:s?"enter":"exit",...o})});Q6.displayName="PopoverTransition";var Fv=tt(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:i,getPopoverPositionerProps:u,onAnimationComplete:d}=Mu(),p=zv(),h={position:"relative",display:"flex",flexDirection:"column",...p.content};return a.jsx(He.div,{...u(r),__css:p.popper,className:"chakra-popover__popper",children:a.jsx(Q6,{...o,...i(s,n),onAnimationComplete:Vp(d,s.onAnimationComplete),className:Ot("chakra-popover__content",t.className),__css:h})})});Fv.displayName="PopoverContent";function yT(e,t,n){return(e-t)*100/(n-t)}Sa({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});Sa({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var bT=Sa({"0%":{left:"-40%"},"100%":{left:"100%"}}),xT=Sa({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function wT(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:i,role:u="progressbar"}=e,d=yT(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:u},percent:d,value:t}}var[ST,CT]=cr({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),_T=tt((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:i,...u}=e,d=wT({value:o,min:n,max:r,isIndeterminate:s,role:i}),h={height:"100%",...CT().filledTrack};return a.jsx(He.div,{ref:t,style:{width:`${d.percent}%`,...u.style},...d.bind,...u,__css:h})}),X6=tt((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:i,isAnimated:u,children:d,borderRadius:p,isIndeterminate:h,"aria-label":m,"aria-labelledby":v,"aria-valuetext":b,title:S,role:w,...C}=wr(e),_=lo("Progress",e),k=p??((n=_.track)==null?void 0:n.borderRadius),j={animation:`${xT} 1s linear infinite`},O={...!h&&i&&u&&j,...h&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${bT} 1s ease infinite normal none running`}},R={overflow:"hidden",position:"relative",..._.track};return a.jsx(He.div,{ref:t,borderRadius:k,__css:R,...C,children:a.jsxs(ST,{value:_,children:[a.jsx(_T,{"aria-label":m,"aria-labelledby":v,"aria-valuetext":b,min:o,max:s,value:r,isIndeterminate:h,css:O,borderRadius:k,title:S,role:w}),d]})})});X6.displayName="Progress";function kT(e){return e&&Lb(e)&&Lb(e.target)}function PT(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:i,isNative:u,...d}=e,[p,h]=f.useState(r||""),m=typeof n<"u",v=m?n:p,b=f.useRef(null),S=f.useCallback(()=>{const I=b.current;if(!I)return;let O="input:not(:disabled):checked";const R=I.querySelector(O);if(R){R.focus();return}O="input:not(:disabled)";const T=I.querySelector(O);T==null||T.focus()},[]),C=`radio-${f.useId()}`,_=o||C,k=f.useCallback(I=>{const O=kT(I)?I.target.value:I;m||h(O),t==null||t(String(O))},[t,m]),j=f.useCallback((I={},O=null)=>({...I,ref:Wn(O,b),role:"radiogroup"}),[]),E=f.useCallback((I={},O=null)=>({...I,ref:O,name:_,[u?"checked":"isChecked"]:v!=null?I.value===v:void 0,onChange(T){k(T)},"data-radiogroup":!0}),[u,_,k,v]);return{getRootProps:j,getRadioProps:E,name:_,ref:b,focus:S,setValue:h,value:v,onChange:k,isDisabled:s,isFocusable:i,htmlProps:d}}var[jT,J6]=cr({name:"RadioGroupContext",strict:!1}),zf=tt((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:i,isDisabled:u,isFocusable:d,...p}=e,{value:h,onChange:m,getRootProps:v,name:b,htmlProps:S}=PT(p),w=f.useMemo(()=>({name:b,size:r,onChange:m,colorScheme:n,value:h,variant:o,isDisabled:u,isFocusable:d}),[b,r,m,n,h,o,u,d]);return a.jsx(jT,{value:w,children:a.jsx(He.div,{...v(S,t),className:Ot("chakra-radio-group",i),children:s})})});zf.displayName="RadioGroup";var IT={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function ET(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:i,onChange:u,isInvalid:d,name:p,value:h,id:m,"data-radiogroup":v,"aria-describedby":b,...S}=e,w=`radio-${f.useId()}`,C=jE(),k=!!J6()||!!v;let E=!!C&&!k?C.id:w;E=m??E;const I=o??(C==null?void 0:C.isDisabled),O=s??(C==null?void 0:C.isReadOnly),R=i??(C==null?void 0:C.isRequired),T=d??(C==null?void 0:C.isInvalid),[A,z]=f.useState(!1),[$,ee]=f.useState(!1),[B,H]=f.useState(!1),[G,K]=f.useState(!1),[M,U]=f.useState(!!t),V=typeof n<"u",J=V?n:M;f.useEffect(()=>M3(z),[]);const ie=f.useCallback(ue=>{if(O||I){ue.preventDefault();return}V||U(ue.target.checked),u==null||u(ue)},[V,I,O,u]),xe=f.useCallback(ue=>{ue.key===" "&&K(!0)},[K]),he=f.useCallback(ue=>{ue.key===" "&&K(!1)},[K]),ae=f.useCallback((ue={},Ce=null)=>({...ue,ref:Ce,"data-active":sn(G),"data-hover":sn(B),"data-disabled":sn(I),"data-invalid":sn(T),"data-checked":sn(J),"data-focus":sn($),"data-focus-visible":sn($&&A),"data-readonly":sn(O),"aria-hidden":!0,onMouseDown:mt(ue.onMouseDown,()=>K(!0)),onMouseUp:mt(ue.onMouseUp,()=>K(!1)),onMouseEnter:mt(ue.onMouseEnter,()=>H(!0)),onMouseLeave:mt(ue.onMouseLeave,()=>H(!1))}),[G,B,I,T,J,$,O,A]),{onFocus:Z,onBlur:W}=C??{},re=f.useCallback((ue={},Ce=null)=>{const Me=I&&!r;return{...ue,id:E,ref:Ce,type:"radio",name:p,value:h,onChange:mt(ue.onChange,ie),onBlur:mt(W,ue.onBlur,()=>ee(!1)),onFocus:mt(Z,ue.onFocus,()=>ee(!0)),onKeyDown:mt(ue.onKeyDown,xe),onKeyUp:mt(ue.onKeyUp,he),checked:J,disabled:Me,readOnly:O,required:R,"aria-invalid":Sl(T),"aria-disabled":Sl(Me),"aria-required":Sl(R),"data-readonly":sn(O),"aria-describedby":b,style:IT}},[I,r,E,p,h,ie,W,Z,xe,he,J,O,R,T,b]);return{state:{isInvalid:T,isFocused:$,isChecked:J,isActive:G,isHovered:B,isDisabled:I,isReadOnly:O,isRequired:R},getCheckboxProps:ae,getRadioProps:ae,getInputProps:re,getLabelProps:(ue={},Ce=null)=>({...ue,ref:Ce,onMouseDown:mt(ue.onMouseDown,OT),"data-disabled":sn(I),"data-checked":sn(J),"data-invalid":sn(T)}),getRootProps:(ue,Ce=null)=>({...ue,ref:Ce,"data-disabled":sn(I),"data-checked":sn(J),"data-invalid":sn(T)}),htmlProps:S}}function OT(e){e.preventDefault(),e.stopPropagation()}function RT(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 sa=tt((e,t)=>{var n;const r=J6(),{onChange:o,value:s}=e,i=lo("Radio",{...r,...e}),u=wr(e),{spacing:d="0.5rem",children:p,isDisabled:h=r==null?void 0:r.isDisabled,isFocusable:m=r==null?void 0:r.isFocusable,inputProps:v,...b}=u;let S=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(S=r.value===s);let w=o;r!=null&&r.onChange&&s!=null&&(w=Vp(r.onChange,o));const C=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:_,getCheckboxProps:k,getLabelProps:j,getRootProps:E,htmlProps:I}=ET({...b,isChecked:S,isFocusable:m,isDisabled:h,onChange:w,name:C}),[O,R]=RT(I,g4),T=k(R),A=_(v,t),z=j(),$=Object.assign({},O,E()),ee={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...i.container},B={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...i.control},H={userSelect:"none",marginStart:d,...i.label};return a.jsxs(He.label,{className:"chakra-radio",...$,__css:ee,children:[a.jsx("input",{className:"chakra-radio__input",...A}),a.jsx(He.span,{className:"chakra-radio__control",...T,__css:B}),p&&a.jsx(He.span,{className:"chakra-radio__label",...z,__css:H,children:p})]})});sa.displayName="Radio";var Z6=tt(function(t,n){const{children:r,placeholder:o,className:s,...i}=t;return a.jsxs(He.select,{...i,ref:n,className:Ot("chakra-select",s),children:[o&&a.jsx("option",{value:"",children:o}),r]})});Z6.displayName="SelectField";function MT(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 e5=tt((e,t)=>{var n;const r=lo("Select",e),{rootProps:o,placeholder:s,icon:i,color:u,height:d,h:p,minH:h,minHeight:m,iconColor:v,iconSize:b,...S}=wr(e),[w,C]=MT(S,g4),_=nv(C),k={width:"100%",height:"fit-content",position:"relative",color:u},j={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return a.jsxs(He.div,{className:"chakra-select__wrapper",__css:k,...w,...o,children:[a.jsx(Z6,{ref:t,height:p??d,minH:h??m,placeholder:s,..._,__css:j,children:e.children}),a.jsx(t5,{"data-disabled":sn(_.disabled),...(v||u)&&{color:v||u},__css:r.icon,...b&&{fontSize:b},children:i})]})});e5.displayName="Select";var DT=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"})}),TT=He("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),t5=e=>{const{children:t=a.jsx(DT,{}),...n}=e,r=f.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return a.jsx(TT,{...n,className:"chakra-select__icon-wrapper",children:f.isValidElement(t)?r:null})};t5.displayName="SelectIcon";function AT(){const e=f.useRef(!0);return f.useEffect(()=>{e.current=!1},[]),e.current}function NT(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}var $T=He("div",{baseStyle:{boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none","&::before, &::after, *":{visibility:"hidden"}}}),c0=v4("skeleton-start-color"),u0=v4("skeleton-end-color"),zT=Sa({from:{opacity:0},to:{opacity:1}}),LT=Sa({from:{borderColor:c0.reference,background:c0.reference},to:{borderColor:u0.reference,background:u0.reference}}),n5=tt((e,t)=>{const n={...e,fadeDuration:typeof e.fadeDuration=="number"?e.fadeDuration:.4,speed:typeof e.speed=="number"?e.speed:.8},r=Kl("Skeleton",n),o=AT(),{startColor:s="",endColor:i="",isLoaded:u,fadeDuration:d,speed:p,className:h,fitContent:m,...v}=wr(n),[b,S]=Yl("colors",[s,i]),w=NT(u),C=Ot("chakra-skeleton",h),_={...b&&{[c0.variable]:b},...S&&{[u0.variable]:S}};if(u){const k=o||w?"none":`${zT} ${d}s`;return a.jsx(He.div,{ref:t,className:C,__css:{animation:k},...v})}return a.jsx($T,{ref:t,className:C,...v,__css:{width:m?"fit-content":void 0,...r,..._,_dark:{...r._dark,..._},animation:`${p}s linear infinite alternate ${LT}`}})});n5.displayName="Skeleton";function BT(e){const{min:t=0,max:n=100,onChange:r,value:o,defaultValue:s,isReversed:i,direction:u="ltr",orientation:d="horizontal",id:p,isDisabled:h,isReadOnly:m,onChangeStart:v,onChangeEnd:b,step:S=1,getAriaValueText:w,"aria-valuetext":C,"aria-label":_,"aria-labelledby":k,name:j,focusThumbOnChange:E=!0,minStepsBetweenThumbs:I=0,...O}=e,R=Ua(v),T=Ua(b),A=Ua(w),z=TE({isReversed:i,direction:u,orientation:d}),[$,ee]=mu({value:o,defaultValue:s??[25,75],onChange:r});if(!Array.isArray($))throw new TypeError(`[range-slider] You passed an invalid value for \`value\` or \`defaultValue\`, expected \`Array\` but got \`${typeof $}\``);const[B,H]=f.useState(!1),[G,K]=f.useState(!1),[M,U]=f.useState(-1),V=!(h||m),J=f.useRef($),ie=$.map(Ee=>Bb(Ee,t,n)),xe=I*S,he=FT(ie,t,n,xe),ae=f.useRef({eventSource:null,value:[],valueBounds:[]});ae.current.value=ie,ae.current.valueBounds=he;const Z=ie.map(Ee=>n-Ee+t),re=(z?Z:ie).map(Ee=>Fb(Ee,t,n)),pe=d==="vertical",ne=f.useRef(null),ge=f.useRef(null),ue=IE({getNodes(){const Ee=ge.current,at=Ee==null?void 0:Ee.querySelectorAll("[role=slider]");return at?Array.from(at):[]}}),Ce=f.useId(),me=AE(p??Ce),_e=f.useCallback(Ee=>{var at,Ye;if(!ne.current)return;ae.current.eventSource="pointer";const rt=ne.current.getBoundingClientRect(),{clientX:Nt,clientY:dr}=(Ye=(at=Ee.touches)==null?void 0:at[0])!=null?Ye:Ee,yn=pe?rt.bottom-dr:Nt-rt.left,bn=pe?rt.height:rt.width;let zr=yn/bn;return z&&(zr=1-zr),EE(zr,t,n)},[pe,z,n,t]),We=(n-t)/10,Le=S||(n-t)/100,Ue=f.useMemo(()=>({setValueAtIndex(Ee,at){if(!V)return;const Ye=ae.current.valueBounds[Ee];at=parseFloat(OE(at,Ye.min,Le)),at=Bb(at,Ye.min,Ye.max);const rt=[...ae.current.value];rt[Ee]=at,ee(rt)},setActiveIndex:U,stepUp(Ee,at=Le){const Ye=ae.current.value[Ee],rt=z?Ye-at:Ye+at;Ue.setValueAtIndex(Ee,rt)},stepDown(Ee,at=Le){const Ye=ae.current.value[Ee],rt=z?Ye+at:Ye-at;Ue.setValueAtIndex(Ee,rt)},reset(){ee(J.current)}}),[Le,z,ee,V]),kt=f.useCallback(Ee=>{const at=Ee.key,rt={ArrowRight:()=>Ue.stepUp(M),ArrowUp:()=>Ue.stepUp(M),ArrowLeft:()=>Ue.stepDown(M),ArrowDown:()=>Ue.stepDown(M),PageUp:()=>Ue.stepUp(M,We),PageDown:()=>Ue.stepDown(M,We),Home:()=>{const{min:Nt}=he[M];Ue.setValueAtIndex(M,Nt)},End:()=>{const{max:Nt}=he[M];Ue.setValueAtIndex(M,Nt)}}[at];rt&&(Ee.preventDefault(),Ee.stopPropagation(),rt(Ee),ae.current.eventSource="keyboard")},[Ue,M,We,he]),{getThumbStyle:gt,rootStyle:Pn,trackStyle:Pt,innerTrackStyle:yt}=f.useMemo(()=>RE({isReversed:z,orientation:d,thumbRects:ue,thumbPercents:re}),[z,d,re,ue]),be=f.useCallback(Ee=>{var at;const Ye=Ee??M;if(Ye!==-1&&E){const rt=me.getThumb(Ye),Nt=(at=ge.current)==null?void 0:at.ownerDocument.getElementById(rt);Nt&&setTimeout(()=>Nt.focus())}},[E,M,me]);Ni(()=>{ae.current.eventSource==="keyboard"&&(T==null||T(ae.current.value))},[ie,T]);const Te=Ee=>{const at=_e(Ee)||0,Ye=ae.current.value.map(bn=>Math.abs(bn-at)),rt=Math.min(...Ye);let Nt=Ye.indexOf(rt);const dr=Ye.filter(bn=>bn===rt);dr.length>1&&at>ae.current.value[Nt]&&(Nt=Nt+dr.length-1),U(Nt),Ue.setValueAtIndex(Nt,at),be(Nt)},It=Ee=>{if(M==-1)return;const at=_e(Ee)||0;U(M),Ue.setValueAtIndex(M,at),be(M)};ME(ge,{onPanSessionStart(Ee){V&&(H(!0),Te(Ee),R==null||R(ae.current.value))},onPanSessionEnd(){V&&(H(!1),T==null||T(ae.current.value))},onPan(Ee){V&&It(Ee)}});const Ft=f.useCallback((Ee={},at=null)=>({...Ee,...O,id:me.root,ref:Wn(at,ge),tabIndex:-1,"aria-disabled":Wm(h),"data-focused":nl(G),style:{...Ee.style,...Pn}}),[O,h,G,Pn,me]),Wt=f.useCallback((Ee={},at=null)=>({...Ee,ref:Wn(at,ne),id:me.track,"data-disabled":nl(h),style:{...Ee.style,...Pt}}),[h,Pt,me]),Cn=f.useCallback((Ee={},at=null)=>({...Ee,ref:at,id:me.innerTrack,style:{...Ee.style,...yt}}),[yt,me]),En=f.useCallback((Ee,at=null)=>{var Ye;const{index:rt,...Nt}=Ee,dr=ie[rt];if(dr==null)throw new TypeError(`[range-slider > thumb] Cannot find value at index \`${rt}\`. The \`value\` or \`defaultValue\` length is : ${ie.length}`);const yn=he[rt];return{...Nt,ref:at,role:"slider",tabIndex:V?0:void 0,id:me.getThumb(rt),"data-active":nl(B&&M===rt),"aria-valuetext":(Ye=A==null?void 0:A(dr))!=null?Ye:C==null?void 0:C[rt],"aria-valuemin":yn.min,"aria-valuemax":yn.max,"aria-valuenow":dr,"aria-orientation":d,"aria-disabled":Wm(h),"aria-readonly":Wm(m),"aria-label":_==null?void 0:_[rt],"aria-labelledby":_!=null&&_[rt]||k==null?void 0:k[rt],style:{...Ee.style,...gt(rt)},onKeyDown:Vm(Ee.onKeyDown,kt),onFocus:Vm(Ee.onFocus,()=>{K(!0),U(rt)}),onBlur:Vm(Ee.onBlur,()=>{K(!1),U(-1)})}},[me,ie,he,V,B,M,A,C,d,h,m,_,k,gt,kt,K]),ln=f.useCallback((Ee={},at=null)=>({...Ee,ref:at,id:me.output,htmlFor:ie.map((Ye,rt)=>me.getThumb(rt)).join(" "),"aria-live":"off"}),[me,ie]),Sr=f.useCallback((Ee,at=null)=>{const{value:Ye,...rt}=Ee,Nt=!(Yen),dr=Ye>=ie[0]&&Ye<=ie[ie.length-1];let yn=Fb(Ye,t,n);yn=z?100-yn:yn;const bn={position:"absolute",pointerEvents:"none",...DE({orientation:d,vertical:{bottom:`${yn}%`},horizontal:{left:`${yn}%`}})};return{...rt,ref:at,id:me.getMarker(Ee.value),role:"presentation","aria-hidden":!0,"data-disabled":nl(h),"data-invalid":nl(!Nt),"data-highlighted":nl(dr),style:{...Ee.style,...bn}}},[h,z,n,t,d,ie,me]),vn=f.useCallback((Ee,at=null)=>{const{index:Ye,...rt}=Ee;return{...rt,ref:at,id:me.getInput(Ye),type:"hidden",value:ie[Ye],name:Array.isArray(j)?j[Ye]:`${j}-${Ye}`}},[j,ie,me]);return{state:{value:ie,isFocused:G,isDragging:B,getThumbPercent:Ee=>re[Ee],getThumbMinValue:Ee=>he[Ee].min,getThumbMaxValue:Ee=>he[Ee].max},actions:Ue,getRootProps:Ft,getTrackProps:Wt,getInnerTrackProps:Cn,getThumbProps:En,getMarkerProps:Sr,getInputProps:vn,getOutputProps:ln}}function FT(e,t,n,r){return e.map((o,s)=>{const i=s===0?t:e[s-1]+r,u=s===e.length-1?n:e[s+1]-r;return{min:i,max:u}})}var[HT,rh]=cr({name:"SliderContext",errorMessage:"useSliderContext: `context` is undefined. Seems you forgot to wrap all slider components within "}),[WT,oh]=cr({name:"RangeSliderStylesContext",errorMessage:`useRangeSliderStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),r5=tt(function(t,n){const r={orientation:"horizontal",...t},o=lo("Slider",r),s=wr(r),{direction:i}=Gp();s.direction=i;const{getRootProps:u,...d}=BT(s),p=f.useMemo(()=>({...d,name:r.name}),[d,r.name]);return a.jsx(HT,{value:p,children:a.jsx(WT,{value:o,children:a.jsx(He.div,{...u({},n),className:"chakra-slider",__css:o.container,children:r.children})})})});r5.displayName="RangeSlider";var d0=tt(function(t,n){const{getThumbProps:r,getInputProps:o,name:s}=rh(),i=oh(),u=r(t,n);return a.jsxs(He.div,{...u,className:rv("chakra-slider__thumb",t.className),__css:i.thumb,children:[u.children,s&&a.jsx("input",{...o({index:t.index})})]})});d0.displayName="RangeSliderThumb";var o5=tt(function(t,n){const{getTrackProps:r}=rh(),o=oh(),s=r(t,n);return a.jsx(He.div,{...s,className:rv("chakra-slider__track",t.className),__css:o.track,"data-testid":"chakra-range-slider-track"})});o5.displayName="RangeSliderTrack";var s5=tt(function(t,n){const{getInnerTrackProps:r}=rh(),o=oh(),s=r(t,n);return a.jsx(He.div,{...s,className:"chakra-slider__filled-track",__css:o.filledTrack})});s5.displayName="RangeSliderFilledTrack";var vf=tt(function(t,n){const{getMarkerProps:r}=rh(),o=oh(),s=r(t,n);return a.jsx(He.div,{...s,className:rv("chakra-slider__marker",t.className),__css:o.mark})});vf.displayName="RangeSliderMark";var Hv=tt(function(t,n){const r=lo("Switch",t),{spacing:o="0.5rem",children:s,...i}=wr(t),{state:u,getInputProps:d,getCheckboxProps:p,getRootProps:h,getLabelProps:m}=D3(i),v=f.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),b=f.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),S=f.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return a.jsxs(He.label,{...h(),className:Ot("chakra-switch",t.className),__css:v,children:[a.jsx("input",{className:"chakra-switch__input",...d({},n)}),a.jsx(He.span,{...p(),className:"chakra-switch__track",__css:b,children:a.jsx(He.span,{__css:r.thumb,className:"chakra-switch__thumb","data-checked":sn(u.isChecked),"data-hover":sn(u.isHovered)})}),s&&a.jsx(He.span,{className:"chakra-switch__label",...m(),__css:S,children:s})]})});Hv.displayName="Switch";var[VT,UT,GT,qT]=yv();function KT(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:i,lazyBehavior:u="unmount",orientation:d="horizontal",direction:p="ltr",...h}=e,[m,v]=f.useState(n??0),[b,S]=mu({defaultValue:n??0,value:o,onChange:r});f.useEffect(()=>{o!=null&&v(o)},[o]);const w=GT(),C=f.useId();return{id:`tabs-${(t=e.id)!=null?t:C}`,selectedIndex:b,focusedIndex:m,setSelectedIndex:S,setFocusedIndex:v,isManual:s,isLazy:i,lazyBehavior:u,orientation:d,descendants:w,direction:p,htmlProps:h}}var[YT,sh]=cr({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function QT(e){const{focusedIndex:t,orientation:n,direction:r}=sh(),o=UT(),s=f.useCallback(i=>{const u=()=>{var k;const j=o.nextEnabled(t);j&&((k=j.node)==null||k.focus())},d=()=>{var k;const j=o.prevEnabled(t);j&&((k=j.node)==null||k.focus())},p=()=>{var k;const j=o.firstEnabled();j&&((k=j.node)==null||k.focus())},h=()=>{var k;const j=o.lastEnabled();j&&((k=j.node)==null||k.focus())},m=n==="horizontal",v=n==="vertical",b=i.key,S=r==="ltr"?"ArrowLeft":"ArrowRight",w=r==="ltr"?"ArrowRight":"ArrowLeft",_={[S]:()=>m&&d(),[w]:()=>m&&u(),ArrowDown:()=>v&&u(),ArrowUp:()=>v&&d(),Home:p,End:h}[b];_&&(i.preventDefault(),_(i))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:mt(e.onKeyDown,s)}}function XT(e){const{isDisabled:t,isFocusable:n,...r}=e,{setSelectedIndex:o,isManual:s,id:i,setFocusedIndex:u,selectedIndex:d}=sh(),{index:p,register:h}=qT({disabled:t&&!n}),m=p===d,v=()=>{o(p)},b=()=>{u(p),!s&&!(t&&n)&&o(p)},S=O6({...r,ref:Wn(h,e.ref),isDisabled:t,isFocusable:n,onClick:mt(e.onClick,v)}),w="button";return{...S,id:a5(i,p),role:"tab",tabIndex:m?0:-1,type:w,"aria-selected":m,"aria-controls":i5(i,p),onFocus:t?void 0:mt(e.onFocus,b)}}var[JT,ZT]=cr({});function eA(e){const t=sh(),{id:n,selectedIndex:r}=t,s=Up(e.children).map((i,u)=>f.createElement(JT,{key:u,value:{isSelected:u===r,id:i5(n,u),tabId:a5(n,u),selectedIndex:r}},i));return{...e,children:s}}function tA(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=sh(),{isSelected:s,id:i,tabId:u}=ZT(),d=f.useRef(!1);s&&(d.current=!0);const p=Tv({wasSelected:d.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:p?t:null,role:"tabpanel","aria-labelledby":u,hidden:!s,id:i}}function a5(e,t){return`${e}--tab-${t}`}function i5(e,t){return`${e}--tabpanel-${t}`}var[nA,ah]=cr({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),ih=tt(function(t,n){const r=lo("Tabs",t),{children:o,className:s,...i}=wr(t),{htmlProps:u,descendants:d,...p}=KT(i),h=f.useMemo(()=>p,[p]),{isFitted:m,...v}=u;return a.jsx(VT,{value:d,children:a.jsx(YT,{value:h,children:a.jsx(nA,{value:r,children:a.jsx(He.div,{className:Ot("chakra-tabs",s),ref:n,...v,__css:r.root,children:o})})})})});ih.displayName="Tabs";var lh=tt(function(t,n){const r=QT({...t,ref:n}),s={display:"flex",...ah().tablist};return a.jsx(He.div,{...r,className:Ot("chakra-tabs__tablist",t.className),__css:s})});lh.displayName="TabList";var ch=tt(function(t,n){const r=tA({...t,ref:n}),o=ah();return a.jsx(He.div,{outline:"0",...r,className:Ot("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});ch.displayName="TabPanel";var uh=tt(function(t,n){const r=eA(t),o=ah();return a.jsx(He.div,{...r,width:"100%",ref:n,className:Ot("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});uh.displayName="TabPanels";var dh=tt(function(t,n){const r=ah(),o=XT({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return a.jsx(He.button,{...o,className:Ot("chakra-tabs__tab",t.className),__css:s})});dh.displayName="Tab";function rA(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var oA=["h","minH","height","minHeight"],l5=tt((e,t)=>{const n=Kl("Textarea",e),{className:r,rows:o,...s}=wr(e),i=nv(s),u=o?rA(n,oA):n;return a.jsx(He.textarea,{ref:t,rows:o,...i,className:Ot("chakra-textarea",r),__css:u})});l5.displayName="Textarea";const c5=({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:u,strokeWidth:d,className:p,borderRadius:h,shapeRendering:m,onClick:v})=>{const{background:b,backgroundColor:S}=s||{},w=i||b||S;return a.jsx("rect",{className:qp(["react-flow__minimap-node",p]),x:t,y:n,rx:h,ry:h,width:r,height:o,fill:w,stroke:u,strokeWidth:d,shapeRendering:m,onClick:v?C=>v(C,e):void 0})};c5.displayName="MiniMapNode";var sA=f.memo(c5);const aA=e=>e.nodeOrigin,iA=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),lg=e=>e instanceof Function?e:()=>e;function lA({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=sA,onClick:i}){const u=wf(iA,ov),d=wf(aA),p=lg(t),h=lg(e),m=lg(n),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:u.map(b=>{const{x:S,y:w}=NE(b,d).positionAbsolute;return a.jsx(s,{x:S,y:w,width:b.width,height:b.height,style:b.style,className:m(b),color:p(b),borderRadius:r,strokeColor:h(b),strokeWidth:o,shapeRendering:v,onClick:i,id:b.id},b.id)})})}var cA=f.memo(lA);const uA=200,dA=150,fA=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?BE(FE(t,e.nodeOrigin),n):n,rfId:e.rfId}},pA="react-flow__minimap-desc";function u5({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:u,maskColor:d="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:v,onNodeClick:b,pannable:S=!1,zoomable:w=!1,ariaLabel:C="React Flow mini map",inversePan:_=!1,zoomStep:k=10}){const j=y4(),E=f.useRef(null),{boundingRect:I,viewBB:O,rfId:R}=wf(fA,ov),T=(e==null?void 0:e.width)??uA,A=(e==null?void 0:e.height)??dA,z=I.width/T,$=I.height/A,ee=Math.max(z,$),B=ee*T,H=ee*A,G=5*ee,K=I.x-(B-I.width)/2-G,M=I.y-(H-I.height)/2-G,U=B+G*2,V=H+G*2,J=`${pA}-${R}`,ie=f.useRef(0);ie.current=ee,f.useEffect(()=>{if(E.current){const ae=b4(E.current),Z=pe=>{const{transform:ne,d3Selection:ge,d3Zoom:ue}=j.getState();if(pe.sourceEvent.type!=="wheel"||!ge||!ue)return;const Ce=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*k,Me=ne[2]*Math.pow(2,Ce);ue.scaleTo(ge,Me)},W=pe=>{const{transform:ne,d3Selection:ge,d3Zoom:ue,translateExtent:Ce,width:Me,height:me}=j.getState();if(pe.sourceEvent.type!=="mousemove"||!ge||!ue)return;const _e=ie.current*Math.max(1,ne[2])*(_?-1:1),We={x:ne[0]-pe.sourceEvent.movementX*_e,y:ne[1]-pe.sourceEvent.movementY*_e},Le=[[0,0],[Me,me]],Ue=zE.translate(We.x,We.y).scale(ne[2]),kt=ue.constrain()(Ue,Le,Ce);ue.transform(ge,kt)},re=$E().on("zoom",S?W:null).on("zoom.wheel",w?Z:null);return ae.call(re),()=>{ae.on("zoom",null)}}},[S,w,_,k]);const xe=v?ae=>{const Z=LE(ae);v(ae,{x:Z[0],y:Z[1]})}:void 0,he=b?(ae,Z)=>{const W=j.getState().nodeInternals.get(Z);b(ae,W)}:void 0;return a.jsx(yu,{position:m,style:e,className:qp(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:T,height:A,viewBox:`${K} ${M} ${U} ${V}`,role:"img","aria-labelledby":J,ref:E,onClick:xe,children:[C&&a.jsx("title",{id:J,children:C}),a.jsx(cA,{onClick:he,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:u}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${K-G},${M-G}h${U+G*2}v${V+G*2}h${-U-G*2}z - M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fill:d,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})]})})}u5.displayName="MiniMap";var hA=f.memo(u5),ds;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ds||(ds={}));function mA({color:e,dimensions:t,lineWidth:n}){return a.jsx("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function gA({color:e,radius:t}){return a.jsx("circle",{cx:t,cy:t,r:t,fill:e})}const vA={[ds.Dots]:"#91919a",[ds.Lines]:"#eee",[ds.Cross]:"#e2e2e2"},yA={[ds.Dots]:1,[ds.Lines]:1,[ds.Cross]:6},bA=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function d5({id:e,variant:t=ds.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=2,color:i,style:u,className:d}){const p=f.useRef(null),{transform:h,patternId:m}=wf(bA,ov),v=i||vA[t],b=r||yA[t],S=t===ds.Dots,w=t===ds.Cross,C=Array.isArray(n)?n:[n,n],_=[C[0]*h[2]||1,C[1]*h[2]||1],k=b*h[2],j=w?[k,k]:_,E=S?[k/s,k/s]:[j[0]/s,j[1]/s];return a.jsxs("svg",{className:qp(["react-flow__background",d]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background",children:[a.jsx("pattern",{id:m+e,x:h[0]%_[0],y:h[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:S?a.jsx(gA,{color:v,radius:k/s}):a.jsx(mA,{dimensions:j,color:v,lineWidth:o})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`})]})}d5.displayName="Background";var xA=f.memo(d5),Gc;(function(e){e.Line="line",e.Handle="handle"})(Gc||(Gc={}));function wA({width:e,prevWidth:t,height:n,prevHeight:r,invertX:o,invertY:s}){const i=e-t,u=n-r,d=[i>0?1:i<0?-1:0,u>0?1:u<0?-1:0];return i&&o&&(d[0]=d[0]*-1),u&&s&&(d[1]=d[1]*-1),d}const f5={width:0,height:0,x:0,y:0},SA={...f5,pointerX:0,pointerY:0,aspectRatio:1};function CA({nodeId:e,position:t,variant:n=Gc.Handle,className:r,style:o={},children:s,color:i,minWidth:u=10,minHeight:d=10,maxWidth:p=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:m=!1,shouldResize:v,onResizeStart:b,onResize:S,onResizeEnd:w}){const C=HE(),_=typeof e=="string"?e:C,k=y4(),j=f.useRef(null),E=f.useRef(SA),I=f.useRef(f5),O=WE(),R=n===Gc.Line?"right":"bottom-right",T=t??R;f.useEffect(()=>{if(!j.current||!_)return;const ee=b4(j.current),B=T.includes("right")||T.includes("left"),H=T.includes("bottom")||T.includes("top"),G=T.includes("left"),K=T.includes("top"),M=VE().on("start",U=>{const V=k.getState().nodeInternals.get(_),{xSnapped:J,ySnapped:ie}=O(U);I.current={width:(V==null?void 0:V.width)??0,height:(V==null?void 0:V.height)??0,x:(V==null?void 0:V.position.x)??0,y:(V==null?void 0:V.position.y)??0},E.current={...I.current,pointerX:J,pointerY:ie,aspectRatio:I.current.width/I.current.height},b==null||b(U,{...I.current})}).on("drag",U=>{const{nodeInternals:V,triggerNodeChanges:J}=k.getState(),{xSnapped:ie,ySnapped:xe}=O(U),he=V.get(_);if(he){const ae=[],{pointerX:Z,pointerY:W,width:re,height:pe,x:ne,y:ge,aspectRatio:ue}=E.current,{x:Ce,y:Me,width:me,height:_e}=I.current,We=Math.floor(B?ie-Z:0),Le=Math.floor(H?xe-W:0);let Ue=Hb(re+(G?-We:We),u,p),kt=Hb(pe+(K?-Le:Le),d,h);if(m){const Te=Ue/kt,It=B&&H,Ft=B&&!H,Wt=H&&!B;Ue=Te<=ue&&It||Wt?kt*ue:Ue,kt=Te>ue&&It||Ft?Ue/ue:kt,Ue>=p?(Ue=p,kt=p/ue):Ue<=u&&(Ue=u,kt=u/ue),kt>=h?(kt=h,Ue=h*ue):kt<=d&&(kt=d,Ue=d*ue)}const gt=Ue!==me,Pn=kt!==_e;if(G||K){const Te=G?ne-(Ue-re):ne,It=K?ge-(kt-pe):ge,Ft=Te!==Ce&>,Wt=It!==Me&&Pn;if(Ft||Wt){const Cn={id:he.id,type:"position",position:{x:Ft?Te:Ce,y:Wt?It:Me}};ae.push(Cn),I.current.x=Cn.position.x,I.current.y=Cn.position.y}}if(gt||Pn){const Te={id:_,type:"dimensions",updateStyle:!0,resizing:!0,dimensions:{width:Ue,height:kt}};ae.push(Te),I.current.width=Ue,I.current.height=kt}if(ae.length===0)return;const Pt=wA({width:I.current.width,prevWidth:me,height:I.current.height,prevHeight:_e,invertX:G,invertY:K}),yt={...I.current,direction:Pt};if((v==null?void 0:v(U,yt))===!1)return;S==null||S(U,yt),J(ae)}}).on("end",U=>{const V={id:_,type:"dimensions",resizing:!1};w==null||w(U,{...I.current}),k.getState().triggerNodeChanges([V])});return ee.call(M),()=>{ee.on(".drag",null)}},[_,T,u,d,p,h,m,O,b,S,w]);const A=T.split("-"),z=n===Gc.Line?"borderColor":"backgroundColor",$=i?{...o,[z]:i}:o;return a.jsx("div",{className:qp(["react-flow__resize-control","nodrag",...A,n,r]),ref:j,style:$,children:s})}var _A=f.memo(CA);let Jx=()=>{};const fh=()=>({setOpenUploaderFunction:f.useCallback(t=>{t&&(Jx=t)},[]),openUploader:Jx});var kA=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function Du(e,t){var n=PA(e);if(typeof n.path!="string"){var r=e.webkitRelativePath;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function PA(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=kA.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var jA=[".DS_Store","Thumbs.db"];function IA(e){return Zl(this,void 0,void 0,function(){return ec(this,function(t){return Lf(e)&&EA(e.dataTransfer)?[2,DA(e.dataTransfer,e.type)]:OA(e)?[2,RA(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,MA(e)]:[2,[]]})})}function EA(e){return Lf(e)}function OA(e){return Lf(e)&&Lf(e.target)}function Lf(e){return typeof e=="object"&&e!==null}function RA(e){return f0(e.target.files).map(function(t){return Du(t)})}function MA(e){return Zl(this,void 0,void 0,function(){var t;return ec(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 Du(r)})]}})})}function DA(e,t){return Zl(this,void 0,void 0,function(){var n,r;return ec(this,function(o){switch(o.label){case 0:return e.items?(n=f0(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(TA))]):[3,2];case 1:return r=o.sent(),[2,Zx(p5(r))];case 2:return[2,Zx(f0(e.files).map(function(s){return Du(s)}))]}})})}function Zx(e){return e.filter(function(t){return jA.indexOf(t.name)===-1})}function f0(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,o2(n)];if(e.sizen)return[!1,o2(n)]}return[!0,null]}function vi(e){return e!=null}function QA(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,i=e.maxFiles,u=e.validator;return!s&&t.length>1||s&&i>=1&&t.length>i?!1:t.every(function(d){var p=v5(d,n),h=au(p,1),m=h[0],v=y5(d,r,o),b=au(v,1),S=b[0],w=u?u(d):null;return m&&S&&!w})}function Bf(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Md(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 a2(e){e.preventDefault()}function XA(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function JA(e){return e.indexOf("Edge/")!==-1}function ZA(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return XA(e)||JA(e)}function As(){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 gN(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 Wv=f.forwardRef(function(e,t){var n=e.children,r=Ff(e,sN),o=Vv(r),s=o.open,i=Ff(o,aN);return f.useImperativeHandle(t,function(){return{open:s}},[s]),N.createElement(f.Fragment,null,n(er(er({},i),{},{open:s})))});Wv.displayName="Dropzone";var S5={disabled:!1,getFilesFromEvent:IA,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};Wv.defaultProps=S5;Wv.propTypes={children:Tn.func,accept:Tn.objectOf(Tn.arrayOf(Tn.string)),multiple:Tn.bool,preventDropOnDocument:Tn.bool,noClick:Tn.bool,noKeyboard:Tn.bool,noDrag:Tn.bool,noDragEventsBubbling:Tn.bool,minSize:Tn.number,maxSize:Tn.number,maxFiles:Tn.number,disabled:Tn.bool,getFilesFromEvent:Tn.func,onFileDialogCancel:Tn.func,onFileDialogOpen:Tn.func,useFsAccessApi:Tn.bool,autoFocus:Tn.bool,onDragEnter:Tn.func,onDragLeave:Tn.func,onDragOver:Tn.func,onDrop:Tn.func,onDropAccepted:Tn.func,onDropRejected:Tn.func,onError:Tn.func,validator:Tn.func};var g0={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Vv(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=er(er({},S5),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,i=t.minSize,u=t.multiple,d=t.maxFiles,p=t.onDragEnter,h=t.onDragLeave,m=t.onDragOver,v=t.onDrop,b=t.onDropAccepted,S=t.onDropRejected,w=t.onFileDialogCancel,C=t.onFileDialogOpen,_=t.useFsAccessApi,k=t.autoFocus,j=t.preventDropOnDocument,E=t.noClick,I=t.noKeyboard,O=t.noDrag,R=t.noDragEventsBubbling,T=t.onError,A=t.validator,z=f.useMemo(function(){return nN(n)},[n]),$=f.useMemo(function(){return tN(n)},[n]),ee=f.useMemo(function(){return typeof C=="function"?C:l2},[C]),B=f.useMemo(function(){return typeof w=="function"?w:l2},[w]),H=f.useRef(null),G=f.useRef(null),K=f.useReducer(vN,g0),M=cg(K,2),U=M[0],V=M[1],J=U.isFocused,ie=U.isFileDialogActive,xe=f.useRef(typeof window<"u"&&window.isSecureContext&&_&&eN()),he=function(){!xe.current&&ie&&setTimeout(function(){if(G.current){var Te=G.current.files;Te.length||(V({type:"closeDialog"}),B())}},300)};f.useEffect(function(){return window.addEventListener("focus",he,!1),function(){window.removeEventListener("focus",he,!1)}},[G,ie,B,xe]);var ae=f.useRef([]),Z=function(Te){H.current&&H.current.contains(Te.target)||(Te.preventDefault(),ae.current=[])};f.useEffect(function(){return j&&(document.addEventListener("dragover",a2,!1),document.addEventListener("drop",Z,!1)),function(){j&&(document.removeEventListener("dragover",a2),document.removeEventListener("drop",Z))}},[H,j]),f.useEffect(function(){return!r&&k&&H.current&&H.current.focus(),function(){}},[H,k,r]);var W=f.useCallback(function(be){T?T(be):console.error(be)},[T]),re=f.useCallback(function(be){be.preventDefault(),be.persist(),gt(be),ae.current=[].concat(cN(ae.current),[be.target]),Md(be)&&Promise.resolve(o(be)).then(function(Te){if(!(Bf(be)&&!R)){var It=Te.length,Ft=It>0&&QA({files:Te,accept:z,minSize:i,maxSize:s,multiple:u,maxFiles:d,validator:A}),Wt=It>0&&!Ft;V({isDragAccept:Ft,isDragReject:Wt,isDragActive:!0,type:"setDraggedFiles"}),p&&p(be)}}).catch(function(Te){return W(Te)})},[o,p,W,R,z,i,s,u,d,A]),pe=f.useCallback(function(be){be.preventDefault(),be.persist(),gt(be);var Te=Md(be);if(Te&&be.dataTransfer)try{be.dataTransfer.dropEffect="copy"}catch{}return Te&&m&&m(be),!1},[m,R]),ne=f.useCallback(function(be){be.preventDefault(),be.persist(),gt(be);var Te=ae.current.filter(function(Ft){return H.current&&H.current.contains(Ft)}),It=Te.indexOf(be.target);It!==-1&&Te.splice(It,1),ae.current=Te,!(Te.length>0)&&(V({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Md(be)&&h&&h(be))},[H,h,R]),ge=f.useCallback(function(be,Te){var It=[],Ft=[];be.forEach(function(Wt){var Cn=v5(Wt,z),En=cg(Cn,2),ln=En[0],Sr=En[1],vn=y5(Wt,i,s),sr=cg(vn,2),Ee=sr[0],at=sr[1],Ye=A?A(Wt):null;if(ln&&Ee&&!Ye)It.push(Wt);else{var rt=[Sr,at];Ye&&(rt=rt.concat(Ye)),Ft.push({file:Wt,errors:rt.filter(function(Nt){return Nt})})}}),(!u&&It.length>1||u&&d>=1&&It.length>d)&&(It.forEach(function(Wt){Ft.push({file:Wt,errors:[YA]})}),It.splice(0)),V({acceptedFiles:It,fileRejections:Ft,type:"setFiles"}),v&&v(It,Ft,Te),Ft.length>0&&S&&S(Ft,Te),It.length>0&&b&&b(It,Te)},[V,u,z,i,s,d,v,b,S,A]),ue=f.useCallback(function(be){be.preventDefault(),be.persist(),gt(be),ae.current=[],Md(be)&&Promise.resolve(o(be)).then(function(Te){Bf(be)&&!R||ge(Te,be)}).catch(function(Te){return W(Te)}),V({type:"reset"})},[o,ge,W,R]),Ce=f.useCallback(function(){if(xe.current){V({type:"openDialog"}),ee();var be={multiple:u,types:$};window.showOpenFilePicker(be).then(function(Te){return o(Te)}).then(function(Te){ge(Te,null),V({type:"closeDialog"})}).catch(function(Te){rN(Te)?(B(Te),V({type:"closeDialog"})):oN(Te)?(xe.current=!1,G.current?(G.current.value=null,G.current.click()):W(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."))):W(Te)});return}G.current&&(V({type:"openDialog"}),ee(),G.current.value=null,G.current.click())},[V,ee,B,_,ge,W,$,u]),Me=f.useCallback(function(be){!H.current||!H.current.isEqualNode(be.target)||(be.key===" "||be.key==="Enter"||be.keyCode===32||be.keyCode===13)&&(be.preventDefault(),Ce())},[H,Ce]),me=f.useCallback(function(){V({type:"focus"})},[]),_e=f.useCallback(function(){V({type:"blur"})},[]),We=f.useCallback(function(){E||(ZA()?setTimeout(Ce,0):Ce())},[E,Ce]),Le=function(Te){return r?null:Te},Ue=function(Te){return I?null:Le(Te)},kt=function(Te){return O?null:Le(Te)},gt=function(Te){R&&Te.stopPropagation()},Pn=f.useMemo(function(){return function(){var be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Te=be.refKey,It=Te===void 0?"ref":Te,Ft=be.role,Wt=be.onKeyDown,Cn=be.onFocus,En=be.onBlur,ln=be.onClick,Sr=be.onDragEnter,vn=be.onDragOver,sr=be.onDragLeave,Ee=be.onDrop,at=Ff(be,iN);return er(er(m0({onKeyDown:Ue(As(Wt,Me)),onFocus:Ue(As(Cn,me)),onBlur:Ue(As(En,_e)),onClick:Le(As(ln,We)),onDragEnter:kt(As(Sr,re)),onDragOver:kt(As(vn,pe)),onDragLeave:kt(As(sr,ne)),onDrop:kt(As(Ee,ue)),role:typeof Ft=="string"&&Ft!==""?Ft:"presentation"},It,H),!r&&!I?{tabIndex:0}:{}),at)}},[H,Me,me,_e,We,re,pe,ne,ue,I,O,r]),Pt=f.useCallback(function(be){be.stopPropagation()},[]),yt=f.useMemo(function(){return function(){var be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Te=be.refKey,It=Te===void 0?"ref":Te,Ft=be.onChange,Wt=be.onClick,Cn=Ff(be,lN),En=m0({accept:z,multiple:u,type:"file",style:{display:"none"},onChange:Le(As(Ft,ue)),onClick:Le(As(Wt,Pt)),tabIndex:-1},It,G);return er(er({},En),Cn)}},[G,n,u,ue,r]);return er(er({},U),{},{isFocused:J&&!r,getRootProps:Pn,getInputProps:yt,rootRef:H,inputRef:G,open:Le(Ce)})}function vN(e,t){switch(t.type){case"focus":return er(er({},e),{},{isFocused:!0});case"blur":return er(er({},e),{},{isFocused:!1});case"openDialog":return er(er({},g0),{},{isFileDialogActive:!0});case"closeDialog":return er(er({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return er(er({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return er(er({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return er({},g0);default:return e}}function l2(){}function v0(){return v0=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 _N=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,i=n.mod,u=n.shift,d=n.ctrl,p=n.keys,h=t.key,m=t.code,v=t.ctrlKey,b=t.metaKey,S=t.shiftKey,w=t.altKey,C=Ha(m),_=h.toLowerCase();if(!r){if(o===!w&&_!=="alt"||u===!S&&_!=="shift")return!1;if(i){if(!b&&!v)return!1}else if(s===!b&&_!=="meta"&&_!=="os"||d===!v&&_!=="ctrl"&&_!=="control")return!1}return p&&p.length===1&&(p.includes(_)||p.includes(C))?!0:p?_5(p):!p},kN=f.createContext(void 0),PN=function(){return f.useContext(kN)};function I5(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&&I5(e[r],t[r])},!0):e===t}var jN=f.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),IN=function(){return f.useContext(jN)};function EN(e){var t=f.useRef(void 0);return I5(t.current,e)||(t.current=e),t.current}var c2=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},ON=typeof window<"u"?f.useLayoutEffect:f.useEffect;function Ke(e,t,n,r){var o=f.useRef(null),s=f.useRef(!1),i=n instanceof Array?r instanceof Array?void 0:r:n,u=e instanceof Array?e.join(i==null?void 0:i.splitKey):e,d=n instanceof Array?n:r instanceof Array?r:void 0,p=f.useCallback(t,d??[]),h=f.useRef(p);d?h.current=p:h.current=t;var m=EN(i),v=IN(),b=v.enabledScopes,S=PN();return ON(function(){if(!((m==null?void 0:m.enabled)===!1||!CN(b,m==null?void 0:m.scopes))){var w=function(E,I){var O;if(I===void 0&&(I=!1),!(SN(E)&&!j5(E,m==null?void 0:m.enableOnFormTags))&&!(m!=null&&m.ignoreEventWhen!=null&&m.ignoreEventWhen(E))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){c2(E);return}(O=E.target)!=null&&O.isContentEditable&&!(m!=null&&m.enableOnContentEditable)||ug(u,m==null?void 0:m.splitKey).forEach(function(R){var T,A=dg(R,m==null?void 0:m.combinationKey);if(_N(E,A,m==null?void 0:m.ignoreModifiers)||(T=A.keys)!=null&&T.includes("*")){if(I&&s.current)return;if(xN(E,A,m==null?void 0:m.preventDefault),!wN(E,A,m==null?void 0:m.enabled)){c2(E);return}h.current(E,A),I||(s.current=!0)}})}},C=function(E){E.key!==void 0&&(k5(Ha(E.code)),((m==null?void 0:m.keydown)===void 0&&(m==null?void 0:m.keyup)!==!0||m!=null&&m.keydown)&&w(E))},_=function(E){E.key!==void 0&&(P5(Ha(E.code)),s.current=!1,m!=null&&m.keyup&&w(E,!0))},k=o.current||(i==null?void 0:i.document)||document;return k.addEventListener("keyup",_),k.addEventListener("keydown",C),S&&ug(u,m==null?void 0:m.splitKey).forEach(function(j){return S.addHotkey(dg(j,m==null?void 0:m.combinationKey,m==null?void 0:m.description))}),function(){k.removeEventListener("keyup",_),k.removeEventListener("keydown",C),S&&ug(u,m==null?void 0:m.splitKey).forEach(function(j){return S.removeHotkey(dg(j,m==null?void 0:m.combinationKey,m==null?void 0:m.description))})}}},[u,m,b]),o}const RN=e=>{const{isDragAccept:t,isDragReject:n,setIsHandlingUpload:r}=e;return Ke("esc",()=>{r(!1)}),a.jsx(ze,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:a.jsx(F,{sx:{opacity:.4,width:"100%",height:"100%",flexDirection:"column",rowGap:4,alignItems:"center",justifyContent:"center",bg:"base.900",boxShadow:`inset 0 0 20rem 1rem var(--invokeai-colors-${t?"accent":"error"}-500)`},children:t?a.jsx(aa,{size:"lg",children:"Drop to Upload"}):a.jsxs(a.Fragment,{children:[a.jsx(aa,{size:"lg",children:"Invalid Upload"}),a.jsx(aa,{size:"md",children:"Must be single JPEG or PNG image"})]})})})},MN=ve([Mo,ur],(e,t)=>{const{isConnected:n,isUploading:r}=e;return{isUploaderDisabled:!n||r,activeTabName:t}}),DN=e=>{const{children:t}=e,n=te(),{isUploaderDisabled:r,activeTabName:o}=L(MN),s=Ql(),{t:i}=fe(),[u,d]=f.useState(!1),{setOpenUploaderFunction:p}=fh(),h=f.useCallback(E=>{d(!0),s({title:i("toast.uploadFailed"),description:E.errors.map(I=>I.message).join(` -`),status:"error"})},[i,s]),m=f.useCallback(async E=>{n(x4({file:E,image_category:"user",is_intermediate:!1,postUploadAction:{type:"TOAST_UPLOADED"}}))},[n]),v=f.useCallback((E,I)=>{if(I.length>1){s({title:i("toast.uploadFailed"),description:i("toast.uploadFailedInvalidUploadDesc"),status:"error"});return}I.forEach(O=>{h(O)}),E.forEach(O=>{m(O)})},[i,s,m,h]),{getRootProps:b,getInputProps:S,isDragAccept:w,isDragReject:C,isDragActive:_,inputRef:k,open:j}=Vv({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:v,onDragOver:()=>d(!0),disabled:r,multiple:!1});return f.useEffect(()=>{const E=async I=>{var O,R;k.current&&(O=I.clipboardData)!=null&&O.files&&(k.current.files=I.clipboardData.files,(R=k.current)==null||R.dispatchEvent(new Event("change",{bubbles:!0})))};return p(j),document.addEventListener("paste",E),()=>{document.removeEventListener("paste",E),p(()=>{})}},[k,j,p]),a.jsxs(ze,{...b({style:{}}),onKeyDown:E=>{E.key},children:[a.jsx("input",{...S()}),t,_&&u&&a.jsx(RN,{isDragAccept:w,isDragReject:C,setIsHandlingUpload:d})]})},TN=f.memo(DN),AN=ZO(e=>{e(w4(!0))},300),vo=()=>(e,t)=>{ur(t())==="unifiedCanvas"&&AN(e)};var NN=globalThis&&globalThis.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),br=globalThis&&globalThis.__assign||function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"u"?void 0:Number(r),maxHeight:typeof o>"u"?void 0:Number(o),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof i>"u"?void 0:Number(i)}},WN=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],h2="__resizable_base__",VN=function(e){LN(t,e);function t(n){var r=e.call(this,n)||this;return r.ratio=1,r.resizable=null,r.parentLeft=0,r.parentTop=0,r.resizableLeft=0,r.resizableRight=0,r.resizableTop=0,r.resizableBottom=0,r.targetLeft=0,r.targetTop=0,r.appendBase=function(){if(!r.resizable||!r.window)return null;var o=r.parentNode;if(!o)return null;var s=r.window.document.createElement("div");return s.style.width="100%",s.style.height="100%",s.style.position="absolute",s.style.transform="scale(0, 0)",s.style.left="0",s.style.flex="0 0 100%",s.classList?s.classList.add(h2):s.className+=h2,o.appendChild(s),s},r.removeBase=function(o){var s=r.parentNode;s&&s.removeChild(o)},r.ref=function(o){o&&(r.resizable=o)},r.state={isResizing:!1,width:typeof(r.propsSize&&r.propsSize.width)>"u"?"auto":r.propsSize&&r.propsSize.width,height:typeof(r.propsSize&&r.propsSize.height)>"u"?"auto":r.propsSize&&r.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},r.onResizeStart=r.onResizeStart.bind(r),r.onMouseMove=r.onMouseMove.bind(r),r.onMouseUp=r.onMouseUp.bind(r),r}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||BN},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var o=this.resizable.offsetWidth,s=this.resizable.offsetHeight,i=this.resizable.style.position;i!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:o,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=i}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,o=function(u){if(typeof n.state[u]>"u"||n.state[u]==="auto")return"auto";if(n.propsSize&&n.propsSize[u]&&n.propsSize[u].toString().endsWith("%")){if(n.state[u].toString().endsWith("%"))return n.state[u].toString();var d=n.getParentSize(),p=Number(n.state[u].toString().replace("px","")),h=p/d[u]*100;return h+"%"}return fg(n.state[u])},s=r&&typeof r.width<"u"&&!this.state.isResizing?fg(r.width):o("width"),i=r&&typeof r.height<"u"&&!this.state.isResizing?fg(r.height):o("height");return{width:s,height:i}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var r=!1,o=this.parentNode.style.flexWrap;o!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var s={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=o),this.removeBase(n),s},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,r){var o=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof o>"u"||o==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var o=this.props.boundsByDirection,s=this.state.direction,i=o&&ul("left",s),u=o&&ul("top",s),d,p;if(this.props.bounds==="parent"){var h=this.parentNode;h&&(d=i?this.resizableRight-this.parentLeft:h.offsetWidth+(this.parentLeft-this.resizableLeft),p=u?this.resizableBottom-this.parentTop:h.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(d=i?this.resizableRight:this.window.innerWidth-this.resizableLeft,p=u?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(d=i?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),p=u?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return d&&Number.isFinite(d)&&(n=n&&n"u"?10:s.width,m=typeof o.width>"u"||o.width<0?n:o.width,v=typeof s.height>"u"?10:s.height,b=typeof o.height>"u"||o.height<0?r:o.height,S=d||0,w=p||0;if(u){var C=(v-S)*this.ratio+w,_=(b-S)*this.ratio+w,k=(h-w)/this.ratio+S,j=(m-w)/this.ratio+S,E=Math.max(h,C),I=Math.min(m,_),O=Math.max(v,k),R=Math.min(b,j);n=Td(n,E,I),r=Td(r,O,R)}else n=Td(n,h,m),r=Td(r,v,b);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){if(this.props.bounds==="parent"){var n=this.parentNode;if(n){var r=n.getBoundingClientRect();this.parentLeft=r.left,this.parentTop=r.top}}if(this.props.bounds&&typeof this.props.bounds!="string"){var o=this.props.bounds.getBoundingClientRect();this.targetLeft=o.left,this.targetTop=o.top}if(this.resizable){var s=this.resizable.getBoundingClientRect(),i=s.left,u=s.top,d=s.right,p=s.bottom;this.resizableLeft=i,this.resizableRight=d,this.resizableTop=u,this.resizableBottom=p}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var o=0,s=0;if(n.nativeEvent&&FN(n.nativeEvent)?(o=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&Ad(n.nativeEvent)&&(o=n.nativeEvent.touches[0].clientX,s=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var i=this.props.onResizeStart(n,r,this.resizable);if(i===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var u,d=this.window.getComputedStyle(this.resizable);if(d.flexBasis!=="auto"){var p=this.parentNode;if(p){var h=this.window.getComputedStyle(p).flexDirection;this.flexDir=h.startsWith("row")?"row":"column",u=d.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var m={original:{x:o,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Ns(Ns({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:u};this.setState(m)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Ad(n))try{n.preventDefault(),n.stopPropagation()}catch{}var o=this.props,s=o.maxWidth,i=o.maxHeight,u=o.minWidth,d=o.minHeight,p=Ad(n)?n.touches[0].clientX:n.clientX,h=Ad(n)?n.touches[0].clientY:n.clientY,m=this.state,v=m.direction,b=m.original,S=m.width,w=m.height,C=this.getParentSize(),_=HN(C,this.window.innerWidth,this.window.innerHeight,s,i,u,d);s=_.maxWidth,i=_.maxHeight,u=_.minWidth,d=_.minHeight;var k=this.calculateNewSizeFromDirection(p,h),j=k.newHeight,E=k.newWidth,I=this.calculateNewMaxFromBoundary(s,i);this.props.snap&&this.props.snap.x&&(E=p2(E,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(j=p2(j,this.props.snap.y,this.props.snapGap));var O=this.calculateNewSizeFromAspectRatio(E,j,{width:I.maxWidth,height:I.maxHeight},{width:u,height:d});if(E=O.newWidth,j=O.newHeight,this.props.grid){var R=f2(E,this.props.grid[0]),T=f2(j,this.props.grid[1]),A=this.props.snapGap||0;E=A===0||Math.abs(R-E)<=A?R:E,j=A===0||Math.abs(T-j)<=A?T:j}var z={width:E-b.width,height:j-b.height};if(S&&typeof S=="string"){if(S.endsWith("%")){var $=E/C.width*100;E=$+"%"}else if(S.endsWith("vw")){var ee=E/this.window.innerWidth*100;E=ee+"vw"}else if(S.endsWith("vh")){var B=E/this.window.innerHeight*100;E=B+"vh"}}if(w&&typeof w=="string"){if(w.endsWith("%")){var $=j/C.height*100;j=$+"%"}else if(w.endsWith("vw")){var ee=j/this.window.innerWidth*100;j=ee+"vw"}else if(w.endsWith("vh")){var B=j/this.window.innerHeight*100;j=B+"vh"}}var H={width:this.createSizeForCssProperty(E,"width"),height:this.createSizeForCssProperty(j,"height")};this.flexDir==="row"?H.flexBasis=H.width:this.flexDir==="column"&&(H.flexBasis=H.height),Xl.flushSync(function(){r.setState(H)}),this.props.onResize&&this.props.onResize(n,v,this.resizable,z)}},t.prototype.onMouseUp=function(n){var r=this.state,o=r.isResizing,s=r.direction,i=r.original;if(!(!o||!this.resizable)){var u={width:this.size.width-i.width,height:this.size.height-i.height};this.props.onResizeStop&&this.props.onResizeStop(n,s,this.resizable,u),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:Ns(Ns({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){this.setState({width:n.width,height:n.height})},t.prototype.renderResizer=function(){var n=this,r=this.props,o=r.enable,s=r.handleStyles,i=r.handleClasses,u=r.handleWrapperStyle,d=r.handleWrapperClass,p=r.handleComponent;if(!o)return null;var h=Object.keys(o).map(function(m){return o[m]!==!1?f.createElement(zN,{key:m,direction:m,onResizeStart:n.onResizeStart,replaceStyles:s&&s[m],className:i&&i[m]},p&&p[m]?p[m]:null):null});return f.createElement("div",{className:d,style:u},h)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(i,u){return WN.indexOf(u)!==-1||(i[u]=n.props[u]),i},{}),o=Ns(Ns(Ns({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(o.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return f.createElement(s,Ns({ref:this.ref,style:o,className:this.props.className},r),this.state.isResizing&&f.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(f.PureComponent);const UN=({direction:e,langDirection:t})=>({top:e==="bottom",right:t!=="rtl"&&e==="left"||t==="rtl"&&e==="right",bottom:e==="top",left:t!=="rtl"&&e==="right"||t==="rtl"&&e==="left"}),GN=({direction:e,minWidth:t,maxWidth:n,minHeight:r,maxHeight:o})=>{const s=t??(["left","right"].includes(e)?10:void 0),i=n??(["left","right"].includes(e)?"95vw":void 0),u=r??(["top","bottom"].includes(e)?10:void 0),d=o??(["top","bottom"].includes(e)?"95vh":void 0);return{...s?{minWidth:s}:{},...i?{maxWidth:i}:{},...u?{minHeight:u}:{},...d?{maxHeight:d}:{}}},oa="0.75rem",$d="1rem",Pc="5px",qN=({isResizable:e,direction:t})=>{const n=`calc((2 * ${oa} + ${Pc}) / -2)`;return t==="top"?{containerStyles:{borderBottomWidth:Pc,paddingBottom:$d},handleStyles:e?{top:{paddingTop:oa,paddingBottom:oa,bottom:n}}:{}}:t==="left"?{containerStyles:{borderInlineEndWidth:Pc,paddingInlineEnd:$d},handleStyles:e?{right:{paddingInlineStart:oa,paddingInlineEnd:oa,insetInlineEnd:n}}:{}}:t==="bottom"?{containerStyles:{borderTopWidth:Pc,paddingTop:$d},handleStyles:e?{bottom:{paddingTop:oa,paddingBottom:oa,top:n}}:{}}:t==="right"?{containerStyles:{borderInlineStartWidth:Pc,paddingInlineStart:$d},handleStyles:e?{left:{paddingInlineStart:oa,paddingInlineEnd:oa,insetInlineStart:n}}:{}}:{containerStyles:{},handleStyles:{}}},KN=(e,t)=>["top","bottom"].includes(e)?e:e==="left"?t==="rtl"?"right":"left":e==="right"?t==="rtl"?"left":"right":"left",ke=(e,t)=>n=>n==="light"?e:t,YN=He(VN,{shouldForwardProp:e=>!["sx"].includes(e)}),E5=({direction:e="left",isResizable:t,isOpen:n,onClose:r,children:o,initialWidth:s,minWidth:i,maxWidth:u,initialHeight:d,minHeight:p,maxHeight:h,onResizeStart:m,onResizeStop:v,onResize:b,sx:S={}})=>{const w=Gp().direction,{colorMode:C}=Do(),_=f.useRef(null),k=f.useMemo(()=>s??i??(["left","right"].includes(e)?"auto":"100%"),[s,i,e]),j=f.useMemo(()=>d??p??(["top","bottom"].includes(e)?"auto":"100%"),[d,p,e]),[E,I]=f.useState(k),[O,R]=f.useState(j);LM({ref:_,handler:()=>{r()},enabled:n});const T=f.useMemo(()=>t?UN({direction:e,langDirection:w}):{},[t,w,e]),A=f.useMemo(()=>GN({direction:e,minWidth:i,maxWidth:u,minHeight:p,maxHeight:h}),[i,u,p,h,e]),{containerStyles:z,handleStyles:$}=f.useMemo(()=>qN({isResizable:t,direction:e}),[t,e]),ee=f.useMemo(()=>KN(e,w),[e,w]);return f.useEffect(()=>{["left","right"].includes(e)&&R("100vh"),["top","bottom"].includes(e)&&I("100vw")},[e]),a.jsx(E3,{direction:ee,in:n,motionProps:{initial:!1},style:{width:"full"},children:a.jsx(ze,{ref:_,sx:{width:"full",height:"full"},children:a.jsx(YN,{size:{width:t?E:k,height:t?O:j},enable:T,handleStyles:$,...A,sx:{borderColor:ke("base.200","base.800")(C),p:4,bg:ke("base.100","base.900")(C),height:"full",shadow:n?"dark-lg":void 0,...z,...S},onResizeStart:(B,H,G)=>{m&&m(B,H,G)},onResize:(B,H,G,K)=>{b&&b(B,H,G,K)},onResizeStop:(B,H,G,K)=>{["left","right"].includes(H)&&I(Number(E)+K.width),["top","bottom"].includes(H)&&R(Number(O)+K.height),v&&v(B,H,G,K)},children:o})})})},QN=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return a.jsxs(Bv,{isLazy:o,...s,children:[a.jsx(Lv,{children:t}),a.jsxs(Fv,{shadow:"dark-lg",children:[r&&a.jsx(K6,{}),n]})]})},zi=f.memo(QN),XN=e=>{const{label:t,...n}=e,{colorMode:r}=Do();return a.jsx(T3,{colorScheme:"accent",...n,children:a.jsx(nt,{sx:{fontSize:"sm",color:ke("base.800","base.200")(r)},children:t})})},Bn=f.memo(XN);function O5(e){return Ve({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146z"}}]})(e)}function R5(e){return Ve({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146zm.122 2.112v-.002.002zm0-.002v.002a.5.5 0 0 1-.122.51L6.293 6.878a.5.5 0 0 1-.511.12H5.78l-.014-.004a4.507 4.507 0 0 0-.288-.076 4.922 4.922 0 0 0-.765-.116c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a4.924 4.924 0 0 0-.192-1.054l-.004-.013v-.001a.5.5 0 0 1 .12-.512l3.536-3.535a.5.5 0 0 1 .532-.115l.096.022c.087.017.208.034.344.034.114 0 .23-.011.343-.04L9.927 2.028c-.029.113-.04.23-.04.343a1.779 1.779 0 0 0 .062.46z"}}]})(e)}function JN(e){return Ve({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M524.531,69.836a1.5,1.5,0,0,0-.764-.7A485.065,485.065,0,0,0,404.081,32.03a1.816,1.816,0,0,0-1.923.91,337.461,337.461,0,0,0-14.9,30.6,447.848,447.848,0,0,0-134.426,0,309.541,309.541,0,0,0-15.135-30.6,1.89,1.89,0,0,0-1.924-.91A483.689,483.689,0,0,0,116.085,69.137a1.712,1.712,0,0,0-.788.676C39.068,183.651,18.186,294.69,28.43,404.354a2.016,2.016,0,0,0,.765,1.375A487.666,487.666,0,0,0,176.02,479.918a1.9,1.9,0,0,0,2.063-.676A348.2,348.2,0,0,0,208.12,430.4a1.86,1.86,0,0,0-1.019-2.588,321.173,321.173,0,0,1-45.868-21.853,1.885,1.885,0,0,1-.185-3.126c3.082-2.309,6.166-4.711,9.109-7.137a1.819,1.819,0,0,1,1.9-.256c96.229,43.917,200.41,43.917,295.5,0a1.812,1.812,0,0,1,1.924.233c2.944,2.426,6.027,4.851,9.132,7.16a1.884,1.884,0,0,1-.162,3.126,301.407,301.407,0,0,1-45.89,21.83,1.875,1.875,0,0,0-1,2.611,391.055,391.055,0,0,0,30.014,48.815,1.864,1.864,0,0,0,2.063.7A486.048,486.048,0,0,0,610.7,405.729a1.882,1.882,0,0,0,.765-1.352C623.729,277.594,590.933,167.465,524.531,69.836ZM222.491,337.58c-28.972,0-52.844-26.587-52.844-59.239S193.056,219.1,222.491,219.1c29.665,0,53.306,26.82,52.843,59.239C275.334,310.993,251.924,337.58,222.491,337.58Zm195.38,0c-28.971,0-52.843-26.587-52.843-59.239S388.437,219.1,417.871,219.1c29.667,0,53.307,26.82,52.844,59.239C470.715,310.993,447.538,337.58,417.871,337.58Z"}}]})(e)}function ZN(e){return Ve({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"}}]})(e)}function e$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M528 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-352 96c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zm112 236.8c0 10.6-10 19.2-22.4 19.2H86.4C74 384 64 375.4 64 364.8v-19.2c0-31.8 30.1-57.6 67.2-57.6h5c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h5c37.1 0 67.2 25.8 67.2 57.6v19.2zM512 312c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16zm0-64c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16zm0-64c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16z"}}]})(e)}function t$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34zm192-34l-136-136c-9.4-9.4-24.6-9.4-33.9 0l-22.6 22.6c-9.4 9.4-9.4 24.6 0 33.9l96.4 96.4-96.4 96.4c-9.4 9.4-9.4 24.6 0 33.9l22.6 22.6c9.4 9.4 24.6 9.4 33.9 0l136-136c9.4-9.2 9.4-24.4 0-33.8z"}}]})(e)}function n$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z"}}]})(e)}function r$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"}}]})(e)}function o$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"}}]})(e)}function s$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"}}]})(e)}function M5(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"}}]})(e)}function D5(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M478.21 334.093L336 256l142.21-78.093c11.795-6.477 15.961-21.384 9.232-33.037l-19.48-33.741c-6.728-11.653-21.72-15.499-33.227-8.523L296 186.718l3.475-162.204C299.763 11.061 288.937 0 275.48 0h-38.96c-13.456 0-24.283 11.061-23.994 24.514L216 186.718 77.265 102.607c-11.506-6.976-26.499-3.13-33.227 8.523l-19.48 33.741c-6.728 11.653-2.562 26.56 9.233 33.037L176 256 33.79 334.093c-11.795 6.477-15.961 21.384-9.232 33.037l19.48 33.741c6.728 11.653 21.721 15.499 33.227 8.523L216 325.282l-3.475 162.204C212.237 500.939 223.064 512 236.52 512h38.961c13.456 0 24.283-11.061 23.995-24.514L296 325.282l138.735 84.111c11.506 6.976 26.499 3.13 33.227-8.523l19.48-33.741c6.728-11.653 2.563-26.559-9.232-33.036z"}}]})(e)}function a$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M511.988 288.9c-.478 17.43-15.217 31.1-32.653 31.1H424v16c0 21.864-4.882 42.584-13.6 61.145l60.228 60.228c12.496 12.497 12.496 32.758 0 45.255-12.498 12.497-32.759 12.496-45.256 0l-54.736-54.736C345.886 467.965 314.351 480 280 480V236c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v244c-34.351 0-65.886-12.035-90.636-32.108l-54.736 54.736c-12.498 12.497-32.759 12.496-45.256 0-12.496-12.497-12.496-32.758 0-45.255l60.228-60.228C92.882 378.584 88 357.864 88 336v-16H32.666C15.23 320 .491 306.33.013 288.9-.484 270.816 14.028 256 32 256h56v-58.745l-46.628-46.628c-12.496-12.497-12.496-32.758 0-45.255 12.498-12.497 32.758-12.497 45.256 0L141.255 160h229.489l54.627-54.627c12.498-12.497 32.758-12.497 45.256 0 12.496 12.497 12.496 32.758 0 45.255L424 197.255V256h56c17.972 0 32.484 14.816 31.988 32.9zM257 0c-61.856 0-112 50.144-112 112h224C369 50.144 318.856 0 257 0z"}}]})(e)}function i$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"}}]})(e)}function l$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"}}]})(e)}function Uv(e){return Ve({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"}}]})(e)}function rc(e){return Ve({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z"}}]})(e)}function T5(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500 224h-30.364C455.724 130.325 381.675 56.276 288 42.364V12c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v30.364C130.325 56.276 56.276 130.325 42.364 224H12c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h30.364C56.276 381.675 130.325 455.724 224 469.636V500c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12v-30.364C381.675 455.724 455.724 381.675 469.636 288H500c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12zM288 404.634V364c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40.634C165.826 392.232 119.783 346.243 107.366 288H148c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12h-40.634C119.768 165.826 165.757 119.783 224 107.366V148c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12v-40.634C346.174 119.768 392.217 165.757 404.634 224H364c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40.634C392.232 346.174 346.243 392.217 288 404.634zM288 256c0 17.673-14.327 32-32 32s-32-14.327-32-32c0-17.673 14.327-32 32-32s32 14.327 32 32z"}}]})(e)}function c$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z"}}]})(e)}function Gv(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function A5(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M497.941 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.745-18.745-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48.004 48.004 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12H355.883l142.058-142.059zm-302.627-62.627l137.373 137.373L265.373 416H150.628l-80-80 124.686-124.686z"}}]})(e)}function u$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"}}]})(e)}function d$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 192 512"},child:[{tag:"path",attr:{d:"M176 432c0 44.112-35.888 80-80 80s-80-35.888-80-80 35.888-80 80-80 80 35.888 80 80zM25.26 25.199l13.6 272C39.499 309.972 50.041 320 62.83 320h66.34c12.789 0 23.331-10.028 23.97-22.801l13.6-272C167.425 11.49 156.496 0 142.77 0H49.23C35.504 0 24.575 11.49 25.26 25.199z"}}]})(e)}function f$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 344v112a23.94 23.94 0 0 1-24 24H312c-21.39 0-32.09-25.9-17-41l36.2-36.2L224 295.6 116.77 402.9 153 439c15.09 15.1 4.39 41-17 41H24a23.94 23.94 0 0 1-24-24V344c0-21.4 25.89-32.1 41-17l36.19 36.2L184.46 256 77.18 148.7 41 185c-15.1 15.1-41 4.4-41-17V56a23.94 23.94 0 0 1 24-24h112c21.39 0 32.09 25.9 17 41l-36.2 36.2L224 216.4l107.23-107.3L295 73c-15.09-15.1-4.39-41 17-41h112a23.94 23.94 0 0 1 24 24v112c0 21.4-25.89 32.1-41 17l-36.19-36.2L263.54 256l107.28 107.3L407 327.1c15.1-15.2 41-4.5 41 16.9z"}}]})(e)}function p$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z"}}]})(e)}function h$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"}}]})(e)}function N5(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M50.75 333.25c-12 12-18.75 28.28-18.75 45.26V424L0 480l32 32 56-32h45.49c16.97 0 33.25-6.74 45.25-18.74l126.64-126.62-128-128L50.75 333.25zM483.88 28.12c-37.47-37.5-98.28-37.5-135.75 0l-77.09 77.09-13.1-13.1c-9.44-9.44-24.65-9.31-33.94 0l-40.97 40.97c-9.37 9.37-9.37 24.57 0 33.94l161.94 161.94c9.44 9.44 24.65 9.31 33.94 0L419.88 288c9.37-9.37 9.37-24.57 0-33.94l-13.1-13.1 77.09-77.09c37.51-37.48 37.51-98.26.01-135.75z"}}]})(e)}function m$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"}}]})(e)}function g$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"}}]})(e)}function $5(e){return Ve({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M512 320s-64 92.65-64 128c0 35.35 28.66 64 64 64s64-28.65 64-64-64-128-64-128zm-9.37-102.94L294.94 9.37C288.69 3.12 280.5 0 272.31 0s-16.38 3.12-22.62 9.37l-81.58 81.58L81.93 4.76c-6.25-6.25-16.38-6.25-22.62 0L36.69 27.38c-6.24 6.25-6.24 16.38 0 22.62l86.19 86.18-94.76 94.76c-37.49 37.48-37.49 98.26 0 135.75l117.19 117.19c18.74 18.74 43.31 28.12 67.87 28.12 24.57 0 49.13-9.37 67.87-28.12l221.57-221.57c12.5-12.5 12.5-32.75.01-45.25zm-116.22 70.97H65.93c1.36-3.84 3.57-7.98 7.43-11.83l13.15-13.15 81.61-81.61 58.6 58.6c12.49 12.49 32.75 12.49 45.24 0s12.49-32.75 0-45.24l-58.6-58.6 58.95-58.95 162.44 162.44-48.34 48.34z"}}]})(e)}function v$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464,128H272L208,64H48A48,48,0,0,0,0,112V400a48,48,0,0,0,48,48H464a48,48,0,0,0,48-48V176A48,48,0,0,0,464,128ZM359.5,296a16,16,0,0,1-16,16h-64v64a16,16,0,0,1-16,16h-16a16,16,0,0,1-16-16V312h-64a16,16,0,0,1-16-16V280a16,16,0,0,1,16-16h64V200a16,16,0,0,1,16-16h16a16,16,0,0,1,16,16v64h64a16,16,0,0,1,16,16Z"}}]})(e)}function qc(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 128H272l-64-64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V176c0-26.51-21.49-48-48-48z"}}]})(e)}function y$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 416h-23.41L277.88 53.69A32 32 0 0 0 247.58 32h-47.16a32 32 0 0 0-30.3 21.69L39.41 416H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16h-19.58l23.3-64h152.56l23.3 64H304a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM176.85 272L224 142.51 271.15 272z"}}]})(e)}function b$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M360 0H24C10.745 0 0 10.745 0 24v16c0 13.255 10.745 24 24 24 0 90.965 51.016 167.734 120.842 192C75.016 280.266 24 357.035 24 448c-13.255 0-24 10.745-24 24v16c0 13.255 10.745 24 24 24h336c13.255 0 24-10.745 24-24v-16c0-13.255-10.745-24-24-24 0-90.965-51.016-167.734-120.842-192C308.984 231.734 360 154.965 360 64c13.255 0 24-10.745 24-24V24c0-13.255-10.745-24-24-24zm-75.078 384H99.08c17.059-46.797 52.096-80 92.92-80 40.821 0 75.862 33.196 92.922 80zm.019-256H99.078C91.988 108.548 88 86.748 88 64h208c0 22.805-3.987 44.587-11.059 64z"}}]})(e)}function oc(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"}}]})(e)}function z5(e){return Ve({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M480 416v16c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V176c0-26.51 21.49-48 48-48h16v208c0 44.112 35.888 80 80 80h336zm96-80V80c0-26.51-21.49-48-48-48H144c-26.51 0-48 21.49-48 48v256c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48zM256 128c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-96 144l55.515-55.515c4.686-4.686 12.284-4.686 16.971 0L272 256l135.515-135.515c4.686-4.686 12.284-4.686 16.971 0L512 208v112H160v-48z"}}]})(e)}function x$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"}}]})(e)}function w$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 192 512"},child:[{tag:"path",attr:{d:"M20 424.229h20V279.771H20c-11.046 0-20-8.954-20-20V212c0-11.046 8.954-20 20-20h112c11.046 0 20 8.954 20 20v212.229h20c11.046 0 20 8.954 20 20V492c0 11.046-8.954 20-20 20H20c-11.046 0-20-8.954-20-20v-47.771c0-11.046 8.954-20 20-20zM96 0C56.235 0 24 32.235 24 72s32.235 72 72 72 72-32.235 72-72S135.764 0 96 0z"}}]})(e)}function S$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M528 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h480c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM128 180v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm288 0v-40c0-6.627-5.373-12-12-12H172c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h232c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12z"}}]})(e)}function qv(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M12.41 148.02l232.94 105.67c6.8 3.09 14.49 3.09 21.29 0l232.94-105.67c16.55-7.51 16.55-32.52 0-40.03L266.65 2.31a25.607 25.607 0 0 0-21.29 0L12.41 107.98c-16.55 7.51-16.55 32.53 0 40.04zm487.18 88.28l-58.09-26.33-161.64 73.27c-7.56 3.43-15.59 5.17-23.86 5.17s-16.29-1.74-23.86-5.17L70.51 209.97l-58.1 26.33c-16.55 7.5-16.55 32.5 0 40l232.94 105.59c6.8 3.08 14.49 3.08 21.29 0L499.59 276.3c16.55-7.5 16.55-32.5 0-40zm0 127.8l-57.87-26.23-161.86 73.37c-7.56 3.43-15.59 5.17-23.86 5.17s-16.29-1.74-23.86-5.17L70.29 337.87 12.41 364.1c-16.55 7.5-16.55 32.5 0 40l232.94 105.59c6.8 3.08 14.49 3.08 21.29 0L499.59 404.1c16.55-7.5 16.55-32.5 0-40z"}}]})(e)}function C$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"}}]})(e)}function _$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z"}}]})(e)}function k$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320.67 64c-442.6 0-357.57 384-158.46 384 39.9 0 77.47-20.69 101.42-55.86l25.73-37.79c15.66-22.99 46.97-22.99 62.63 0l25.73 37.79C401.66 427.31 439.23 448 479.13 448c189.86 0 290.63-384-158.46-384zM184 308.36c-41.06 0-67.76-25.66-80.08-41.05-5.23-6.53-5.23-16.09 0-22.63 12.32-15.4 39.01-41.05 80.08-41.05s67.76 25.66 80.08 41.05c5.23 6.53 5.23 16.09 0 22.63-12.32 15.4-39.02 41.05-80.08 41.05zm272 0c-41.06 0-67.76-25.66-80.08-41.05-5.23-6.53-5.23-16.09 0-22.63 12.32-15.4 39.01-41.05 80.08-41.05s67.76 25.66 80.08 41.05c5.23 6.53 5.23 16.09 0 22.63-12.32 15.4-39.02 41.05-80.08 41.05z"}}]})(e)}function P$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function j$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z"}}]})(e)}function L5(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M167.02 309.34c-40.12 2.58-76.53 17.86-97.19 72.3-2.35 6.21-8 9.98-14.59 9.98-11.11 0-45.46-27.67-55.25-34.35C0 439.62 37.93 512 128 512c75.86 0 128-43.77 128-120.19 0-3.11-.65-6.08-.97-9.13l-88.01-73.34zM457.89 0c-15.16 0-29.37 6.71-40.21 16.45C213.27 199.05 192 203.34 192 257.09c0 13.7 3.25 26.76 8.73 38.7l63.82 53.18c7.21 1.8 14.64 3.03 22.39 3.03 62.11 0 98.11-45.47 211.16-256.46 7.38-14.35 13.9-29.85 13.9-45.99C512 20.64 486 0 457.89 0z"}}]})(e)}function B5(e){return Ve({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"}}]})(e)}function Tu(e){return Ve({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function F5(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 32H336c-26.5 0-48 21.5-48 48v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48zm-288 0H48C21.5 32 0 53.5 0 80v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48z"}}]})(e)}function I$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M504.971 359.029c9.373 9.373 9.373 24.569 0 33.941l-80 79.984c-15.01 15.01-40.971 4.49-40.971-16.971V416h-58.785a12.004 12.004 0 0 1-8.773-3.812l-70.556-75.596 53.333-57.143L352 336h32v-39.981c0-21.438 25.943-31.998 40.971-16.971l80 79.981zM12 176h84l52.781 56.551 53.333-57.143-70.556-75.596A11.999 11.999 0 0 0 122.785 96H12c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12zm372 0v39.984c0 21.46 25.961 31.98 40.971 16.971l80-79.984c9.373-9.373 9.373-24.569 0-33.941l-80-79.981C409.943 24.021 384 34.582 384 56.019V96h-58.785a12.004 12.004 0 0 0-8.773 3.812L96 336H12c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12h110.785c3.326 0 6.503-1.381 8.773-3.812L352 176h32z"}}]})(e)}function E$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500.33 0h-47.41a12 12 0 0 0-12 12.57l4 82.76A247.42 247.42 0 0 0 256 8C119.34 8 7.9 119.53 8 256.19 8.1 393.07 119.1 504 256 504a247.1 247.1 0 0 0 166.18-63.91 12 12 0 0 0 .48-17.43l-34-34a12 12 0 0 0-16.38-.55A176 176 0 1 1 402.1 157.8l-101.53-4.87a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12h200.33a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12z"}}]})(e)}function ph(e){return Ve({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"}}]})(e)}function O$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"}}]})(e)}function H5(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M64 96H0c0 123.7 100.3 224 224 224v144c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V320C288 196.3 187.7 96 64 96zm384-64c-84.2 0-157.4 46.5-195.7 115.2 27.7 30.2 48.2 66.9 59 107.6C424 243.1 512 147.9 512 32h-64z"}}]})(e)}function R$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M480 160H32c-17.673 0-32-14.327-32-32V64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24z"}}]})(e)}function M$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 320c-22.608 0-43.387 7.819-59.79 20.895l-102.486-64.054a96.551 96.551 0 0 0 0-41.683l102.486-64.054C308.613 184.181 329.392 192 352 192c53.019 0 96-42.981 96-96S405.019 0 352 0s-96 42.981-96 96c0 7.158.79 14.13 2.276 20.841L155.79 180.895C139.387 167.819 118.608 160 96 160c-53.019 0-96 42.981-96 96s42.981 96 96 96c22.608 0 43.387-7.819 59.79-20.895l102.486 64.054A96.301 96.301 0 0 0 256 416c0 53.019 42.981 96 96 96s96-42.981 96-96-42.981-96-96-96z"}}]})(e)}function m2(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M503.691 189.836L327.687 37.851C312.281 24.546 288 35.347 288 56.015v80.053C127.371 137.907 0 170.1 0 322.326c0 61.441 39.581 122.309 83.333 154.132 13.653 9.931 33.111-2.533 28.077-18.631C66.066 312.814 132.917 274.316 288 272.085V360c0 20.7 24.3 31.453 39.687 18.164l176.004-152c11.071-9.562 11.086-26.753 0-36.328z"}}]})(e)}function Kv(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 384H160v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h80v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h336c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160h-80v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h336v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h80c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160H288V48c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16C7.2 64 0 71.2 0 80v32c0 8.8 7.2 16 16 16h208v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h208c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16z"}}]})(e)}function D$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 160c-52.9 0-96 43.1-96 96s43.1 96 96 96 96-43.1 96-96-43.1-96-96-96zm246.4 80.5l-94.7-47.3 33.5-100.4c4.5-13.6-8.4-26.5-21.9-21.9l-100.4 33.5-47.4-94.8c-6.4-12.8-24.6-12.8-31 0l-47.3 94.7L92.7 70.8c-13.6-4.5-26.5 8.4-21.9 21.9l33.5 100.4-94.7 47.4c-12.8 6.4-12.8 24.6 0 31l94.7 47.3-33.5 100.5c-4.5 13.6 8.4 26.5 21.9 21.9l100.4-33.5 47.3 94.7c6.4 12.8 24.6 12.8 31 0l47.3-94.7 100.4 33.5c13.6 4.5 26.5-8.4 21.9-21.9l-33.5-100.4 94.7-47.3c13-6.5 13-24.7.2-31.1zm-155.9 106c-49.9 49.9-131.1 49.9-181 0-49.9-49.9-49.9-131.1 0-181 49.9-49.9 131.1-49.9 181 0 49.9 49.9 49.9 131.1 0 181z"}}]})(e)}function T$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M370.72 133.28C339.458 104.008 298.888 87.962 255.848 88c-77.458.068-144.328 53.178-162.791 126.85-1.344 5.363-6.122 9.15-11.651 9.15H24.103c-7.498 0-13.194-6.807-11.807-14.176C33.933 94.924 134.813 8 256 8c66.448 0 126.791 26.136 171.315 68.685L463.03 40.97C478.149 25.851 504 36.559 504 57.941V192c0 13.255-10.745 24-24 24H345.941c-21.382 0-32.09-25.851-16.971-40.971l41.75-41.749zM32 296h134.059c21.382 0 32.09 25.851 16.971 40.971l-41.75 41.75c31.262 29.273 71.835 45.319 114.876 45.28 77.418-.07 144.315-53.144 162.787-126.849 1.344-5.363 6.122-9.15 11.651-9.15h57.304c7.498 0 13.194 6.807 11.807 14.176C478.067 417.076 377.187 504 256 504c-66.448 0-126.791-26.136-171.315-68.685L48.97 471.03C33.851 486.149 8 475.441 8 454.059V320c0-13.255 10.745-24 24-24z"}}]})(e)}function A$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M440.65 12.57l4 82.77A247.16 247.16 0 0 0 255.83 8C134.73 8 33.91 94.92 12.29 209.82A12 12 0 0 0 24.09 224h49.05a12 12 0 0 0 11.67-9.26 175.91 175.91 0 0 1 317-56.94l-101.46-4.86a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12H500a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12h-47.37a12 12 0 0 0-11.98 12.57zM255.83 432a175.61 175.61 0 0 1-146-77.8l101.8 4.87a12 12 0 0 0 12.57-12v-47.4a12 12 0 0 0-12-12H12a12 12 0 0 0-12 12V500a12 12 0 0 0 12 12h47.35a12 12 0 0 0 12-12.6l-4.15-82.57A247.17 247.17 0 0 0 255.83 504c121.11 0 221.93-86.92 243.55-201.82a12 12 0 0 0-11.8-14.18h-49.05a12 12 0 0 0-11.67 9.26A175.86 175.86 0 0 1 255.83 432z"}}]})(e)}function N$(e){return Ve({tag:"svg",attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"}}]})(e)}function bo(e){return Ve({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"}}]})(e)}function Yv(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M212.333 224.333H12c-6.627 0-12-5.373-12-12V12C0 5.373 5.373 0 12 0h48c6.627 0 12 5.373 12 12v78.112C117.773 39.279 184.26 7.47 258.175 8.007c136.906.994 246.448 111.623 246.157 248.532C504.041 393.258 393.12 504 256.333 504c-64.089 0-122.496-24.313-166.51-64.215-5.099-4.622-5.334-12.554-.467-17.42l33.967-33.967c4.474-4.474 11.662-4.717 16.401-.525C170.76 415.336 211.58 432 256.333 432c97.268 0 176-78.716 176-176 0-97.267-78.716-176-176-176-58.496 0-110.28 28.476-142.274 72.333h98.274c6.627 0 12 5.373 12 12v48c0 6.627-5.373 12-12 12z"}}]})(e)}function Au(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function Qv(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M507.73 109.1c-2.24-9.03-13.54-12.09-20.12-5.51l-74.36 74.36-67.88-11.31-11.31-67.88 74.36-74.36c6.62-6.62 3.43-17.9-5.66-20.16-47.38-11.74-99.55.91-136.58 37.93-39.64 39.64-50.55 97.1-34.05 147.2L18.74 402.76c-24.99 24.99-24.99 65.51 0 90.5 24.99 24.99 65.51 24.99 90.5 0l213.21-213.21c50.12 16.71 107.47 5.68 147.37-34.22 37.07-37.07 49.7-89.32 37.91-136.73zM64 472c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"}}]})(e)}var W5=Cu({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"})]})}),Xv=Cu({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),$$=Cu({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"}),z$=Cu({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"})})}),L$=Cu({displayName:"ChevronDownIcon",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"});/*! - * OverlayScrollbars - * Version: 2.2.1 - * - * Copyright (c) Rene Haas | KingSora. - * https://github.com/KingSora - * - * Released under the MIT license. - */function gn(e,t){if(mh(e))for(let n=0;nt(e[n],n,e));return e}function Xr(e,t){const n=ri(t);if(bs(t)||n){let o=n?"":{};if(e){const s=window.getComputedStyle(e,null);o=n?b2(e,s,t):t.reduce((i,u)=>(i[u]=b2(e,s,u),i),o)}return o}e&&gn(Ro(t),o=>tz(e,o,t[o]))}const is=(e,t)=>{const{o:n,u:r,_:o}=e;let s=n,i;const u=(h,m)=>{const v=s,b=h,S=m||(r?!r(v,b):v!==b);return(S||o)&&(s=b,i=v),[s,S,i]};return[t?h=>u(t(s,i),h):u,h=>[s,!!h,i]]},Nu=()=>typeof window<"u",V5=Nu()&&Node.ELEMENT_NODE,{toString:B$,hasOwnProperty:pg}=Object.prototype,_a=e=>e===void 0,hh=e=>e===null,F$=e=>_a(e)||hh(e)?`${e}`:B$.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase(),Ya=e=>typeof e=="number",ri=e=>typeof e=="string",Jv=e=>typeof e=="boolean",ys=e=>typeof e=="function",bs=e=>Array.isArray(e),iu=e=>typeof e=="object"&&!bs(e)&&!hh(e),mh=e=>{const t=!!e&&e.length,n=Ya(t)&&t>-1&&t%1==0;return bs(e)||!ys(e)&&n?t>0&&iu(e)?t-1 in e:!0:!1},y0=e=>{if(!e||!iu(e)||F$(e)!=="object")return!1;let t;const n="constructor",r=e[n],o=r&&r.prototype,s=pg.call(e,n),i=o&&pg.call(o,"isPrototypeOf");if(r&&!s&&!i)return!1;for(t in e);return _a(t)||pg.call(e,t)},Hf=e=>{const t=HTMLElement;return e?t?e instanceof t:e.nodeType===V5:!1},gh=e=>{const t=Element;return e?t?e instanceof t:e.nodeType===V5:!1},Zv=(e,t,n)=>e.indexOf(t,n),In=(e,t,n)=>(!n&&!ri(t)&&mh(t)?Array.prototype.push.apply(e,t):e.push(t),e),Ri=e=>{const t=Array.from,n=[];return t&&e?t(e):(e instanceof Set?e.forEach(r=>{In(n,r)}):gn(e,r=>{In(n,r)}),n)},e1=e=>!!e&&e.length===0,Ys=(e,t,n)=>{gn(e,o=>o&&o.apply(void 0,t||[])),!n&&(e.length=0)},vh=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Ro=e=>e?Object.keys(e):[],nr=(e,t,n,r,o,s,i)=>{const u=[t,n,r,o,s,i];return(typeof e!="object"||hh(e))&&!ys(e)&&(e={}),gn(u,d=>{gn(Ro(d),p=>{const h=d[p];if(e===h)return!0;const m=bs(h);if(h&&(y0(h)||m)){const v=e[p];let b=v;m&&!bs(v)?b=[]:!m&&!y0(v)&&(b={}),e[p]=nr(b,h)}else e[p]=h})}),e},t1=e=>{for(const t in e)return!1;return!0},U5=(e,t,n,r)=>{if(_a(r))return n?n[e]:t;n&&(ri(r)||Ya(r))&&(n[e]=r)},Qr=(e,t,n)=>{if(_a(n))return e?e.getAttribute(t):null;e&&e.setAttribute(t,n)},ho=(e,t)=>{e&&e.removeAttribute(t)},Si=(e,t,n,r)=>{if(n){const o=Qr(e,t)||"",s=new Set(o.split(" "));s[r?"add":"delete"](n);const i=Ri(s).join(" ").trim();Qr(e,t,i)}},H$=(e,t,n)=>{const r=Qr(e,t)||"";return new Set(r.split(" ")).has(n)},fs=(e,t)=>U5("scrollLeft",0,e,t),ca=(e,t)=>U5("scrollTop",0,e,t),b0=Nu()&&Element.prototype,G5=(e,t)=>{const n=[],r=t?gh(t)?t:null:document;return r?In(n,r.querySelectorAll(e)):n},W$=(e,t)=>{const n=t?gh(t)?t:null:document;return n?n.querySelector(e):null},Wf=(e,t)=>gh(e)?(b0.matches||b0.msMatchesSelector).call(e,t):!1,n1=e=>e?Ri(e.childNodes):[],ba=e=>e?e.parentElement:null,yl=(e,t)=>{if(gh(e)){const n=b0.closest;if(n)return n.call(e,t);do{if(Wf(e,t))return e;e=ba(e)}while(e)}return null},V$=(e,t,n)=>{const r=e&&yl(e,t),o=e&&W$(n,r),s=yl(o,t)===r;return r&&o?r===e||o===e||s&&yl(yl(e,n),t)!==r:!1},r1=(e,t,n)=>{if(n&&e){let r=t,o;mh(n)?(o=document.createDocumentFragment(),gn(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)}},qo=(e,t)=>{r1(e,null,t)},U$=(e,t)=>{r1(ba(e),e,t)},g2=(e,t)=>{r1(ba(e),e&&e.nextSibling,t)},Us=e=>{if(mh(e))gn(Ri(e),t=>Us(t));else if(e){const t=ba(e);t&&t.removeChild(e)}},Ci=e=>{const t=document.createElement("div");return e&&Qr(t,"class",e),t},q5=e=>{const t=Ci();return t.innerHTML=e.trim(),gn(n1(t),n=>Us(n))},x0=e=>e.charAt(0).toUpperCase()+e.slice(1),G$=()=>Ci().style,q$=["-webkit-","-moz-","-o-","-ms-"],K$=["WebKit","Moz","O","MS","webkit","moz","o","ms"],hg={},mg={},Y$=e=>{let t=mg[e];if(vh(mg,e))return t;const n=x0(e),r=G$();return gn(q$,o=>{const s=o.replace(/-/g,"");return!(t=[e,o+e,s+n,x0(s)+n].find(u=>r[u]!==void 0))}),mg[e]=t||""},$u=e=>{if(Nu()){let t=hg[e]||window[e];return vh(hg,e)||(gn(K$,n=>(t=t||window[n+x0(e)],!t)),hg[e]=t),t}},Q$=$u("MutationObserver"),v2=$u("IntersectionObserver"),bl=$u("ResizeObserver"),K5=$u("cancelAnimationFrame"),Y5=$u("requestAnimationFrame"),Vf=Nu()&&window.setTimeout,w0=Nu()&&window.clearTimeout,X$=/[^\x20\t\r\n\f]+/g,Q5=(e,t,n)=>{const r=e&&e.classList;let o,s=0,i=!1;if(r&&t&&ri(t)){const u=t.match(X$)||[];for(i=u.length>0;o=u[s++];)i=!!n(r,o)&&i}return i},o1=(e,t)=>{Q5(e,t,(n,r)=>n.remove(r))},ua=(e,t)=>(Q5(e,t,(n,r)=>n.add(r)),o1.bind(0,e,t)),yh=(e,t,n,r)=>{if(e&&t){let o=!0;return gn(n,s=>{const i=r?r(e[s]):e[s],u=r?r(t[s]):t[s];i!==u&&(o=!1)}),o}return!1},X5=(e,t)=>yh(e,t,["w","h"]),J5=(e,t)=>yh(e,t,["x","y"]),J$=(e,t)=>yh(e,t,["t","r","b","l"]),y2=(e,t,n)=>yh(e,t,["width","height"],n&&(r=>Math.round(r))),Go=()=>{},ml=e=>{let t;const n=e?Vf:Y5,r=e?w0:K5;return[o=>{r(t),t=n(o,ys(e)?e():e)},()=>r(t)]},s1=(e,t)=>{let n,r,o,s=Go;const{v:i,g:u,p:d}=t||{},p=function(S){s(),w0(n),n=r=void 0,s=Go,e.apply(this,S)},h=b=>d&&r?d(r,b):b,m=()=>{s!==Go&&p(h(o)||o)},v=function(){const S=Ri(arguments),w=ys(i)?i():i;if(Ya(w)&&w>=0){const _=ys(u)?u():u,k=Ya(_)&&_>=0,j=w>0?Vf:Y5,E=w>0?w0:K5,O=h(S)||S,R=p.bind(0,O);s();const T=j(R,w);s=()=>E(T),k&&!n&&(n=Vf(m,_)),r=o=O}else p(S)};return v.m=m,v},Z$={opacity:1,zindex:1},zd=(e,t)=>{const n=t?parseFloat(e):parseInt(e,10);return n===n?n:0},ez=(e,t)=>!Z$[e.toLowerCase()]&&Ya(t)?`${t}px`:t,b2=(e,t,n)=>t!=null?t[n]||t.getPropertyValue(n):e.style[n],tz=(e,t,n)=>{try{const{style:r}=e;_a(r[t])?r.setProperty(t,n):r[t]=ez(t,n)}catch{}},lu=e=>Xr(e,"direction")==="rtl",x2=(e,t,n)=>{const r=t?`${t}-`:"",o=n?`-${n}`:"",s=`${r}top${o}`,i=`${r}right${o}`,u=`${r}bottom${o}`,d=`${r}left${o}`,p=Xr(e,[s,i,u,d]);return{t:zd(p[s],!0),r:zd(p[i],!0),b:zd(p[u],!0),l:zd(p[d],!0)}},{round:w2}=Math,a1={w:0,h:0},cu=e=>e?{w:e.offsetWidth,h:e.offsetHeight}:a1,yf=e=>e?{w:e.clientWidth,h:e.clientHeight}:a1,Uf=e=>e?{w:e.scrollWidth,h:e.scrollHeight}:a1,Gf=e=>{const t=parseFloat(Xr(e,"height"))||0,n=parseFloat(Xr(e,"width"))||0;return{w:n-w2(n),h:t-w2(t)}},Fs=e=>e.getBoundingClientRect();let Ld;const nz=()=>{if(_a(Ld)){Ld=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get(){Ld=!0}}))}catch{}}return Ld},Z5=e=>e.split(" "),rz=(e,t,n,r)=>{gn(Z5(t),o=>{e.removeEventListener(o,n,r)})},Er=(e,t,n,r)=>{var o;const s=nz(),i=(o=s&&r&&r.S)!=null?o:s,u=r&&r.$||!1,d=r&&r.C||!1,p=[],h=s?{passive:i,capture:u}:u;return gn(Z5(t),m=>{const v=d?b=>{e.removeEventListener(m,v,u),n&&n(b)}:n;In(p,rz.bind(null,e,m,v,u)),e.addEventListener(m,v,h)}),Ys.bind(0,p)},e_=e=>e.stopPropagation(),t_=e=>e.preventDefault(),oz={x:0,y:0},gg=e=>{const t=e?Fs(e):0;return t?{x:t.left+window.pageYOffset,y:t.top+window.pageXOffset}:oz},S2=(e,t)=>{gn(bs(t)?t:[t],e)},i1=e=>{const t=new Map,n=(s,i)=>{if(s){const u=t.get(s);S2(d=>{u&&u[d?"delete":"clear"](d)},i)}else t.forEach(u=>{u.clear()}),t.clear()},r=(s,i)=>{if(ri(s)){const p=t.get(s)||new Set;return t.set(s,p),S2(h=>{ys(h)&&p.add(h)},i),n.bind(0,s,i)}Jv(i)&&i&&n();const u=Ro(s),d=[];return gn(u,p=>{const h=s[p];h&&In(d,r(p,h))}),Ys.bind(0,d)},o=(s,i)=>{const u=t.get(s);gn(Ri(u),d=>{i&&!e1(i)?d.apply(0,i):d()})};return r(e||{}),[r,n,o]},C2=e=>JSON.stringify(e,(t,n)=>{if(ys(n))throw new Error;return n}),sz={paddingAbsolute:!1,showNativeOverlaidScrollbars:!1,update:{elementEvents:[["img","load"]],debounce:[0,33],attributes:null,ignoreMutation:null},overflow:{x:"scroll",y:"scroll"},scrollbars:{theme:"os-theme-dark",visibility:"auto",autoHide:"never",autoHideDelay:1300,dragScroll:!0,clickScroll:!1,pointers:["mouse","touch","pen"]}},n_=(e,t)=>{const n={},r=Ro(t).concat(Ro(e));return gn(r,o=>{const s=e[o],i=t[o];if(iu(s)&&iu(i))nr(n[o]={},n_(s,i)),t1(n[o])&&delete n[o];else if(vh(t,o)&&i!==s){let u=!0;if(bs(s)||bs(i))try{C2(s)===C2(i)&&(u=!1)}catch{}u&&(n[o]=i)}}),n},r_="os-environment",o_=`${r_}-flexbox-glue`,az=`${o_}-max`,s_="os-scrollbar-hidden",vg="data-overlayscrollbars-initialize",ls="data-overlayscrollbars",a_=`${ls}-overflow-x`,i_=`${ls}-overflow-y`,El="overflowVisible",iz="scrollbarHidden",_2="scrollbarPressed",qf="updating",La="data-overlayscrollbars-viewport",yg="arrange",l_="scrollbarHidden",Ol=El,S0="data-overlayscrollbars-padding",lz=Ol,k2="data-overlayscrollbars-content",l1="os-size-observer",cz=`${l1}-appear`,uz=`${l1}-listener`,dz="os-trinsic-observer",fz="os-no-css-vars",pz="os-theme-none",wo="os-scrollbar",hz=`${wo}-rtl`,mz=`${wo}-horizontal`,gz=`${wo}-vertical`,c_=`${wo}-track`,c1=`${wo}-handle`,vz=`${wo}-visible`,yz=`${wo}-cornerless`,P2=`${wo}-transitionless`,j2=`${wo}-interaction`,I2=`${wo}-unusable`,E2=`${wo}-auto-hidden`,O2=`${wo}-wheel`,bz=`${c_}-interactive`,xz=`${c1}-interactive`,u_={},Mi=()=>u_,wz=e=>{const t=[];return gn(bs(e)?e:[e],n=>{const r=Ro(n);gn(r,o=>{In(t,u_[o]=n[o])})}),t},Sz="__osOptionsValidationPlugin",Cz="__osSizeObserverPlugin",u1="__osScrollbarsHidingPlugin",_z="__osClickScrollPlugin";let bg;const R2=(e,t,n,r)=>{qo(e,t);const o=yf(t),s=cu(t),i=Gf(n);return r&&Us(t),{x:s.h-o.h+i.h,y:s.w-o.w+i.w}},kz=e=>{let t=!1;const n=ua(e,s_);try{t=Xr(e,Y$("scrollbar-width"))==="none"||window.getComputedStyle(e,"::-webkit-scrollbar").getPropertyValue("display")==="none"}catch{}return n(),t},Pz=(e,t)=>{const n="hidden";Xr(e,{overflowX:n,overflowY:n,direction:"rtl"}),fs(e,0);const r=gg(e),o=gg(t);fs(e,-999);const s=gg(t);return{i:r.x===o.x,n:o.x!==s.x}},jz=(e,t)=>{const n=ua(e,o_),r=Fs(e),o=Fs(t),s=y2(o,r,!0),i=ua(e,az),u=Fs(e),d=Fs(t),p=y2(d,u,!0);return n(),i(),s&&p},Iz=()=>{const{body:e}=document,n=q5(`
`)[0],r=n.firstChild,[o,,s]=i1(),[i,u]=is({o:R2(e,n,r),u:J5},R2.bind(0,e,n,r,!0)),[d]=u(),p=kz(n),h={x:d.x===0,y:d.y===0},m={elements:{host:null,padding:!p,viewport:k=>p&&k===k.ownerDocument.body&&k,content:!1},scrollbars:{slot:!0},cancel:{nativeScrollbarsOverlaid:!1,body:null}},v=nr({},sz),b=nr.bind(0,{},v),S=nr.bind(0,{},m),w={k:d,A:h,I:p,L:Xr(n,"zIndex")==="-1",B:Pz(n,r),V:jz(n,r),Y:o.bind(0,"z"),j:o.bind(0,"r"),N:S,q:k=>nr(m,k)&&S(),F:b,G:k=>nr(v,k)&&b(),X:nr({},m),U:nr({},v)},C=window.addEventListener,_=s1(k=>s(k?"z":"r"),{v:33,g:99});if(ho(n,"style"),Us(n),C("resize",_.bind(0,!1)),!p&&(!h.x||!h.y)){let k;C("resize",()=>{const j=Mi()[u1];k=k||j&&j.R(),k&&k(w,i,_.bind(0,!0))})}return w},So=()=>(bg||(bg=Iz()),bg),d1=(e,t)=>ys(t)?t.apply(0,e):t,Ez=(e,t,n,r)=>{const o=_a(r)?n:r;return d1(e,o)||t.apply(0,e)},d_=(e,t,n,r)=>{const o=_a(r)?n:r,s=d1(e,o);return!!s&&(Hf(s)?s:t.apply(0,e))},Oz=(e,t,n)=>{const{nativeScrollbarsOverlaid:r,body:o}=n||{},{A:s,I:i}=So(),{nativeScrollbarsOverlaid:u,body:d}=t,p=r??u,h=_a(o)?d:o,m=(s.x||s.y)&&p,v=e&&(hh(h)?!i:h);return!!m||!!v},f1=new WeakMap,Rz=(e,t)=>{f1.set(e,t)},Mz=e=>{f1.delete(e)},f_=e=>f1.get(e),M2=(e,t)=>e?t.split(".").reduce((n,r)=>n&&vh(n,r)?n[r]:void 0,e):void 0,C0=(e,t,n)=>r=>[M2(e,r),n||M2(t,r)!==void 0],p_=e=>{let t=e;return[()=>t,n=>{t=nr({},t,n)}]},Bd="tabindex",Fd=Ci.bind(0,""),xg=e=>{qo(ba(e),n1(e)),Us(e)},Dz=e=>{const t=So(),{N:n,I:r}=t,o=Mi()[u1],s=o&&o.T,{elements:i}=n(),{host:u,padding:d,viewport:p,content:h}=i,m=Hf(e),v=m?{}:e,{elements:b}=v,{host:S,padding:w,viewport:C,content:_}=b||{},k=m?e:v.target,j=Wf(k,"textarea"),E=k.ownerDocument,I=E.documentElement,O=k===E.body,R=E.defaultView,T=Ez.bind(0,[k]),A=d_.bind(0,[k]),z=d1.bind(0,[k]),$=T.bind(0,Fd,p),ee=A.bind(0,Fd,h),B=$(C),H=B===k,G=H&&O,K=!H&&ee(_),M=!H&&Hf(B)&&B===K,U=M&&!!z(h),V=U?$():B,J=U?K:ee(),xe=G?I:M?V:B,he=j?T(Fd,u,S):k,ae=G?xe:he,Z=M?J:K,W=E.activeElement,re=!H&&R.top===R&&W===k,pe={W:k,Z:ae,J:xe,K:!H&&A(Fd,d,w),tt:Z,nt:!H&&!r&&s&&s(t),ot:G?I:xe,st:G?E:xe,et:R,ct:E,rt:j,it:O,lt:m,ut:H,dt:M,ft:(Pt,yt)=>H$(xe,H?ls:La,H?yt:Pt),_t:(Pt,yt,be)=>Si(xe,H?ls:La,H?yt:Pt,be)},ne=Ro(pe).reduce((Pt,yt)=>{const be=pe[yt];return In(Pt,be&&!ba(be)?be:!1)},[]),ge=Pt=>Pt?Zv(ne,Pt)>-1:null,{W:ue,Z:Ce,K:Me,J:me,tt:_e,nt:We}=pe,Le=[()=>{ho(Ce,ls),ho(Ce,vg),ho(ue,vg),O&&(ho(I,ls),ho(I,vg))}],Ue=j&&ge(Ce);let kt=j?ue:n1([_e,me,Me,Ce,ue].find(Pt=>ge(Pt)===!1));const gt=G?ue:_e||me;return[pe,()=>{Qr(Ce,ls,H?"viewport":"host"),Qr(Me,S0,""),Qr(_e,k2,""),H||Qr(me,La,"");const Pt=O&&!H?ua(ba(k),s_):Go;if(Ue&&(g2(ue,Ce),In(Le,()=>{g2(Ce,ue),Us(Ce)})),qo(gt,kt),qo(Ce,Me),qo(Me||Ce,!H&&me),qo(me,_e),In(Le,()=>{Pt(),ho(Me,S0),ho(_e,k2),ho(me,a_),ho(me,i_),ho(me,La),ge(_e)&&xg(_e),ge(me)&&xg(me),ge(Me)&&xg(Me)}),r&&!H&&(Si(me,La,l_,!0),In(Le,ho.bind(0,me,La))),We&&(U$(me,We),In(Le,Us.bind(0,We))),re){const yt=Qr(me,Bd);Qr(me,Bd,"-1"),me.focus();const be=()=>yt?Qr(me,Bd,yt):ho(me,Bd),Te=Er(E,"pointerdown keydown",()=>{be(),Te()});In(Le,[be,Te])}else W&&W.focus&&W.focus();kt=0},Ys.bind(0,Le)]},Tz=(e,t)=>{const{tt:n}=e,[r]=t;return o=>{const{V:s}=So(),{ht:i}=r(),{vt:u}=o,d=(n||!s)&&u;return d&&Xr(n,{height:i?"":"100%"}),{gt:d,wt:d}}},Az=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,ut:u}=e,[d,p]=is({u:J$,o:x2()},x2.bind(0,o,"padding",""));return(h,m,v)=>{let[b,S]=p(v);const{I:w,V:C}=So(),{bt:_}=n(),{gt:k,wt:j,yt:E}=h,[I,O]=m("paddingAbsolute");(k||S||!C&&j)&&([b,S]=d(v));const T=!u&&(O||E||S);if(T){const A=!I||!s&&!w,z=b.r+b.l,$=b.t+b.b,ee={marginRight:A&&!_?-z:0,marginBottom:A?-$:0,marginLeft:A&&_?-z:0,top:A?-b.t:0,right:A?_?-b.r:"auto":0,left:A?_?"auto":-b.l:0,width:A?`calc(100% + ${z}px)`:""},B={paddingTop:A?b.t:0,paddingRight:A?b.r:0,paddingBottom:A?b.b:0,paddingLeft:A?b.l:0};Xr(s||i,ee),Xr(i,B),r({K:b,St:!A,P:s?B:nr({},ee,B)})}return{xt:T}}},{max:_0}=Math,Ba=_0.bind(0,0),h_="visible",D2="hidden",Nz=42,Hd={u:X5,o:{w:0,h:0}},$z={u:J5,o:{x:D2,y:D2}},zz=(e,t)=>{const n=window.devicePixelRatio%1!==0?1:0,r={w:Ba(e.w-t.w),h:Ba(e.h-t.h)};return{w:r.w>n?r.w:0,h:r.h>n?r.h:0}},Wd=e=>e.indexOf(h_)===0,Lz=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,nt:u,ut:d,_t:p,it:h,et:m}=e,{k:v,V:b,I:S,A:w}=So(),C=Mi()[u1],_=!d&&!S&&(w.x||w.y),k=h&&d,[j,E]=is(Hd,Gf.bind(0,i)),[I,O]=is(Hd,Uf.bind(0,i)),[R,T]=is(Hd),[A,z]=is(Hd),[$]=is($z),ee=(U,V)=>{if(Xr(i,{height:""}),V){const{St:J,K:ie}=n(),{$t:xe,D:he}=U,ae=Gf(o),Z=yf(o),W=Xr(i,"boxSizing")==="content-box",re=J||W?ie.b+ie.t:0,pe=!(w.x&&W);Xr(i,{height:Z.h+ae.h+(xe.x&&pe?he.x:0)-re})}},B=(U,V)=>{const J=!S&&!U?Nz:0,ie=(ge,ue,Ce)=>{const Me=Xr(i,ge),_e=(V?V[ge]:Me)==="scroll";return[Me,_e,_e&&!S?ue?J:Ce:0,ue&&!!J]},[xe,he,ae,Z]=ie("overflowX",w.x,v.x),[W,re,pe,ne]=ie("overflowY",w.y,v.y);return{Ct:{x:xe,y:W},$t:{x:he,y:re},D:{x:ae,y:pe},M:{x:Z,y:ne}}},H=(U,V,J,ie)=>{const xe=(re,pe)=>{const ne=Wd(re),ge=pe&&ne&&re.replace(`${h_}-`,"")||"";return[pe&&!ne?re:"",Wd(ge)?"hidden":ge]},[he,ae]=xe(J.x,V.x),[Z,W]=xe(J.y,V.y);return ie.overflowX=ae&&Z?ae:he,ie.overflowY=W&&he?W:Z,B(U,ie)},G=(U,V,J,ie)=>{const{D:xe,M:he}=U,{x:ae,y:Z}=he,{x:W,y:re}=xe,{P:pe}=n(),ne=V?"marginLeft":"marginRight",ge=V?"paddingLeft":"paddingRight",ue=pe[ne],Ce=pe.marginBottom,Me=pe[ge],me=pe.paddingBottom;ie.width=`calc(100% + ${re+-1*ue}px)`,ie[ne]=-re+ue,ie.marginBottom=-W+Ce,J&&(ie[ge]=Me+(Z?re:0),ie.paddingBottom=me+(ae?W:0))},[K,M]=C?C.H(_,b,i,u,n,B,G):[()=>_,()=>[Go]];return(U,V,J)=>{const{gt:ie,Ot:xe,wt:he,xt:ae,vt:Z,yt:W}=U,{ht:re,bt:pe}=n(),[ne,ge]=V("showNativeOverlaidScrollbars"),[ue,Ce]=V("overflow"),Me=ne&&w.x&&w.y,me=!d&&!b&&(ie||he||xe||ge||Z),_e=Wd(ue.x),We=Wd(ue.y),Le=_e||We;let Ue=E(J),kt=O(J),gt=T(J),Pn=z(J),Pt;if(ge&&S&&p(l_,iz,!Me),me&&(Pt=B(Me),ee(Pt,re)),ie||ae||he||W||ge){Le&&p(Ol,El,!1);const[Ee,at]=M(Me,pe,Pt),[Ye,rt]=Ue=j(J),[Nt,dr]=kt=I(J),yn=yf(i);let bn=Nt,zr=yn;Ee(),(dr||rt||ge)&&at&&!Me&&K(at,Nt,Ye,pe)&&(zr=yf(i),bn=Uf(i));const fr={w:Ba(_0(Nt.w,bn.w)+Ye.w),h:Ba(_0(Nt.h,bn.h)+Ye.h)},An={w:Ba((k?m.innerWidth:zr.w+Ba(yn.w-Nt.w))+Ye.w),h:Ba((k?m.innerHeight+Ye.h:zr.h+Ba(yn.h-Nt.h))+Ye.h)};Pn=A(An),gt=R(zz(fr,An),J)}const[yt,be]=Pn,[Te,It]=gt,[Ft,Wt]=kt,[Cn,En]=Ue,ln={x:Te.w>0,y:Te.h>0},Sr=_e&&We&&(ln.x||ln.y)||_e&&ln.x&&!ln.y||We&&ln.y&&!ln.x;if(ae||W||En||Wt||be||It||Ce||ge||me){const Ee={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},at=H(Me,ln,ue,Ee),Ye=K(at,Ft,Cn,pe);d||G(at,pe,Ye,Ee),me&&ee(at,re),d?(Qr(o,a_,Ee.overflowX),Qr(o,i_,Ee.overflowY)):Xr(i,Ee)}Si(o,ls,El,Sr),Si(s,S0,lz,Sr),d||Si(i,La,Ol,Le);const[vn,sr]=$(B(Me).Ct);return r({Ct:vn,zt:{x:yt.w,y:yt.h},Tt:{x:Te.w,y:Te.h},Et:ln}),{It:sr,At:be,Lt:It}}},T2=(e,t,n)=>{const r={},o=t||{},s=Ro(e).concat(Ro(o));return gn(s,i=>{const u=e[i],d=o[i];r[i]=!!(n||u||d)}),r},Bz=(e,t)=>{const{W:n,J:r,_t:o,ut:s}=e,{I:i,A:u,V:d}=So(),p=!i&&(u.x||u.y),h=[Tz(e,t),Az(e,t),Lz(e,t)];return(m,v,b)=>{const S=T2(nr({gt:!1,xt:!1,yt:!1,vt:!1,At:!1,Lt:!1,It:!1,Ot:!1,wt:!1},v),{},b),w=p||!d,C=w&&fs(r),_=w&&ca(r);o("",qf,!0);let k=S;return gn(h,j=>{k=T2(k,j(k,m,!!b)||{},b)}),fs(r,C),ca(r,_),o("",qf),s||(fs(n,0),ca(n,0)),k}},Fz=(e,t,n)=>{let r,o=!1;const s=()=>{o=!0},i=u=>{if(n){const d=n.reduce((p,h)=>{if(h){const[m,v]=h,b=v&&m&&(u?u(m):G5(m,e));b&&b.length&&v&&ri(v)&&In(p,[b,v.trim()],!0)}return p},[]);gn(d,p=>gn(p[0],h=>{const m=p[1],v=r.get(h)||[];if(e.contains(h)){const S=Er(h,m,w=>{o?(S(),r.delete(h)):t(w)});r.set(h,In(v,S))}else Ys(v),r.delete(h)}))}};return n&&(r=new WeakMap,i()),[s,i]},A2=(e,t,n,r)=>{let o=!1;const{Ht:s,Pt:i,Dt:u,Mt:d,Rt:p,kt:h}=r||{},m=s1(()=>{o&&n(!0)},{v:33,g:99}),[v,b]=Fz(e,m,u),S=s||[],w=i||[],C=S.concat(w),_=(j,E)=>{const I=p||Go,O=h||Go,R=new Set,T=new Set;let A=!1,z=!1;if(gn(j,$=>{const{attributeName:ee,target:B,type:H,oldValue:G,addedNodes:K,removedNodes:M}=$,U=H==="attributes",V=H==="childList",J=e===B,ie=U&&ri(ee)?Qr(B,ee):0,xe=ie!==0&&G!==ie,he=Zv(w,ee)>-1&&xe;if(t&&(V||!J)){const ae=!U,Z=U&&xe,W=Z&&d&&Wf(B,d),pe=(W?!I(B,ee,G,ie):ae||Z)&&!O($,!!W,e,r);gn(K,ne=>R.add(ne)),gn(M,ne=>R.add(ne)),z=z||pe}!t&&J&&xe&&!I(B,ee,G,ie)&&(T.add(ee),A=A||he)}),R.size>0&&b($=>Ri(R).reduce((ee,B)=>(In(ee,G5($,B)),Wf(B,$)?In(ee,B):ee),[])),t)return!E&&z&&n(!1),[!1];if(T.size>0||A){const $=[Ri(T),A];return!E&&n.apply(0,$),$}},k=new Q$(j=>_(j));return k.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:C,subtree:t,childList:t,characterData:t}),o=!0,[()=>{o&&(v(),k.disconnect(),o=!1)},()=>{if(o){m.m();const j=k.takeRecords();return!e1(j)&&_(j,!0)}}]},Vd=3333333,Ud=e=>e&&(e.height||e.width),m_=(e,t,n)=>{const{Bt:r=!1,Vt:o=!1}=n||{},s=Mi()[Cz],{B:i}=So(),d=q5(`
`)[0],p=d.firstChild,h=lu.bind(0,e),[m]=is({o:void 0,_:!0,u:(w,C)=>!(!w||!Ud(w)&&Ud(C))}),v=w=>{const C=bs(w)&&w.length>0&&iu(w[0]),_=!C&&Jv(w[0]);let k=!1,j=!1,E=!0;if(C){const[I,,O]=m(w.pop().contentRect),R=Ud(I),T=Ud(O);k=!O||!R,j=!T&&R,E=!k}else _?[,E]=w:j=w===!0;if(r&&E){const I=_?w[0]:lu(d);fs(d,I?i.n?-Vd:i.i?0:Vd:Vd),ca(d,Vd)}k||t({gt:!_,Yt:_?w:void 0,Vt:!!j})},b=[];let S=o?v:!1;return[()=>{Ys(b),Us(d)},()=>{if(bl){const w=new bl(v);w.observe(p),In(b,()=>{w.disconnect()})}else if(s){const[w,C]=s.O(p,v,o);S=w,In(b,C)}if(r){const[w]=is({o:void 0},h);In(b,Er(d,"scroll",C=>{const _=w(),[k,j,E]=_;j&&(o1(p,"ltr rtl"),k?ua(p,"rtl"):ua(p,"ltr"),v([!!k,j,E])),e_(C)}))}S&&(ua(d,cz),In(b,Er(d,"animationstart",S,{C:!!bl}))),(bl||s)&&qo(e,d)}]},Hz=e=>e.h===0||e.isIntersecting||e.intersectionRatio>0,Wz=(e,t)=>{let n;const r=Ci(dz),o=[],[s]=is({o:!1}),i=(d,p)=>{if(d){const h=s(Hz(d)),[,m]=h;if(m)return!p&&t(h),[h]}},u=(d,p)=>{if(d&&d.length>0)return i(d.pop(),p)};return[()=>{Ys(o),Us(r)},()=>{if(v2)n=new v2(d=>u(d),{root:e}),n.observe(r),In(o,()=>{n.disconnect()});else{const d=()=>{const m=cu(r);i(m)},[p,h]=m_(r,d);In(o,p),h(),d()}qo(e,r)},()=>{if(n)return u(n.takeRecords(),!0)}]},N2=`[${ls}]`,Vz=`[${La}]`,wg=["tabindex"],$2=["wrap","cols","rows"],Sg=["id","class","style","open"],Uz=(e,t,n)=>{let r,o,s;const{Z:i,J:u,tt:d,rt:p,ut:h,ft:m,_t:v}=e,{V:b}=So(),[S]=is({u:X5,o:{w:0,h:0}},()=>{const H=m(Ol,El),G=m(yg,""),K=G&&fs(u),M=G&&ca(u);v(Ol,El),v(yg,""),v("",qf,!0);const U=Uf(d),V=Uf(u),J=Gf(u);return v(Ol,El,H),v(yg,"",G),v("",qf),fs(u,K),ca(u,M),{w:V.w+U.w+J.w,h:V.h+U.h+J.h}}),w=p?$2:Sg.concat($2),C=s1(n,{v:()=>r,g:()=>o,p(H,G){const[K]=H,[M]=G;return[Ro(K).concat(Ro(M)).reduce((U,V)=>(U[V]=K[V]||M[V],U),{})]}}),_=H=>{gn(H||wg,G=>{if(Zv(wg,G)>-1){const K=Qr(i,G);ri(K)?Qr(u,G,K):ho(u,G)}})},k=(H,G)=>{const[K,M]=H,U={vt:M};return t({ht:K}),!G&&n(U),U},j=({gt:H,Yt:G,Vt:K})=>{const M=!H||K?n:C;let U=!1;if(G){const[V,J]=G;U=J,t({bt:V})}M({gt:H,yt:U})},E=(H,G)=>{const[,K]=S(),M={wt:K};return K&&!G&&(H?n:C)(M),M},I=(H,G,K)=>{const M={Ot:G};return G?!K&&C(M):h||_(H),M},[O,R,T]=d||!b?Wz(i,k):[Go,Go,Go],[A,z]=h?[Go,Go]:m_(i,j,{Vt:!0,Bt:!0}),[$,ee]=A2(i,!1,I,{Pt:Sg,Ht:Sg.concat(wg)}),B=h&&bl&&new bl(j.bind(0,{gt:!0}));return B&&B.observe(i),_(),[()=>{O(),A(),s&&s[0](),B&&B.disconnect(),$()},()=>{z(),R()},()=>{const H={},G=ee(),K=T(),M=s&&s[1]();return G&&nr(H,I.apply(0,In(G,!0))),K&&nr(H,k.apply(0,In(K,!0))),M&&nr(H,E.apply(0,In(M,!0))),H},H=>{const[G]=H("update.ignoreMutation"),[K,M]=H("update.attributes"),[U,V]=H("update.elementEvents"),[J,ie]=H("update.debounce"),xe=V||M,he=ae=>ys(G)&&G(ae);if(xe&&(s&&(s[1](),s[0]()),s=A2(d||u,!0,E,{Ht:w.concat(K||[]),Dt:U,Mt:N2,kt:(ae,Z)=>{const{target:W,attributeName:re}=ae;return(!Z&&re&&!h?V$(W,N2,Vz):!1)||!!yl(W,`.${wo}`)||!!he(ae)}})),ie)if(C.m(),bs(J)){const ae=J[0],Z=J[1];r=Ya(ae)&&ae,o=Ya(Z)&&Z}else Ya(J)?(r=J,o=!1):(r=!1,o=!1)}]},z2={x:0,y:0},Gz=e=>({K:{t:0,r:0,b:0,l:0},St:!1,P:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0},zt:z2,Tt:z2,Ct:{x:"hidden",y:"hidden"},Et:{x:!1,y:!1},ht:!1,bt:lu(e.Z)}),qz=(e,t)=>{const n=C0(t,{}),[r,o,s]=i1(),[i,u,d]=Dz(e),p=p_(Gz(i)),[h,m]=p,v=Bz(i,p),b=(j,E,I)=>{const R=Ro(j).some(T=>j[T])||!t1(E)||I;return R&&s("u",[j,E,I]),R},[S,w,C,_]=Uz(i,m,j=>b(v(n,j),{},!1)),k=h.bind(0);return k.jt=j=>r("u",j),k.Nt=()=>{const{W:j,J:E}=i,I=fs(j),O=ca(j);w(),u(),fs(E,I),ca(E,O)},k.qt=i,[(j,E)=>{const I=C0(t,j,E);return _(I),b(v(I,C(),E),j,!!E)},k,()=>{o(),S(),d()}]},{round:L2}=Math,Kz=e=>{const{width:t,height:n}=Fs(e),{w:r,h:o}=cu(e);return{x:L2(t)/r||1,y:L2(n)/o||1}},Yz=(e,t,n)=>{const r=t.scrollbars,{button:o,isPrimary:s,pointerType:i}=e,{pointers:u}=r;return o===0&&s&&r[n?"dragScroll":"clickScroll"]&&(u||[]).includes(i)},Qz=(e,t)=>Er(e,"mousedown",Er.bind(0,t,"click",e_,{C:!0,$:!0}),{$:!0}),B2="pointerup pointerleave pointercancel lostpointercapture",Xz=(e,t,n,r,o,s,i)=>{const{B:u}=So(),{Ft:d,Gt:p,Xt:h}=r,m=`scroll${i?"Left":"Top"}`,v=`client${i?"X":"Y"}`,b=i?"width":"height",S=i?"left":"top",w=i?"w":"h",C=i?"x":"y",_=(k,j)=>E=>{const{Tt:I}=s(),O=cu(p)[w]-cu(d)[w],T=j*E/O*I[C],z=lu(h)&&i?u.n||u.i?1:-1:1;o[m]=k+T*z};return Er(p,"pointerdown",k=>{const j=yl(k.target,`.${c1}`)===d,E=j?d:p;if(Si(t,ls,_2,!0),Yz(k,e,j)){const I=!j&&k.shiftKey,O=()=>Fs(d),R=()=>Fs(p),T=(V,J)=>(V||O())[S]-(J||R())[S],A=_(o[m]||0,1/Kz(o)[C]),z=k[v],$=O(),ee=R(),B=$[b],H=T($,ee)+B/2,G=z-ee[S],K=j?0:G-H,M=V=>{Ys(U),E.releasePointerCapture(V.pointerId)},U=[Si.bind(0,t,ls,_2),Er(n,B2,M),Er(n,"selectstart",V=>t_(V),{S:!1}),Er(p,B2,M),Er(p,"pointermove",V=>{const J=V[v]-z;(j||I)&&A(K+J)})];if(I)A(K);else if(!j){const V=Mi()[_z];V&&In(U,V.O(A,T,K,B,G))}E.setPointerCapture(k.pointerId)}})},Jz=(e,t)=>(n,r,o,s,i,u)=>{const{Xt:d}=n,[p,h]=ml(333),m=!!i.scrollBy;let v=!0;return Ys.bind(0,[Er(d,"pointerenter",()=>{r(j2,!0)}),Er(d,"pointerleave pointercancel",()=>{r(j2)}),Er(d,"wheel",b=>{const{deltaX:S,deltaY:w,deltaMode:C}=b;m&&v&&C===0&&ba(d)===s&&i.scrollBy({left:S,top:w,behavior:"smooth"}),v=!1,r(O2,!0),p(()=>{v=!0,r(O2)}),t_(b)},{S:!1,$:!0}),Qz(d,o),Xz(e,s,o,n,i,t,u),h])},{min:k0,max:F2,abs:Zz,round:eL}=Math,g_=(e,t,n,r)=>{if(r){const u=n?"x":"y",{Tt:d,zt:p}=r,h=p[u],m=d[u];return F2(0,k0(1,h/(h+m)))}const o=n?"width":"height",s=Fs(e)[o],i=Fs(t)[o];return F2(0,k0(1,s/i))},tL=(e,t,n,r,o,s)=>{const{B:i}=So(),u=s?"x":"y",d=s?"Left":"Top",{Tt:p}=r,h=eL(p[u]),m=Zz(n[`scroll${d}`]),v=s&&o,b=i.i?m:h-m,w=k0(1,(v?b:m)/h),C=g_(e,t,s);return 1/C*(1-C)*w},nL=(e,t,n)=>{const{N:r,L:o}=So(),{scrollbars:s}=r(),{slot:i}=s,{ct:u,W:d,Z:p,J:h,lt:m,ot:v,it:b,ut:S}=t,{scrollbars:w}=m?{}:e,{slot:C}=w||{},_=d_([d,p,h],()=>S&&b?d:p,i,C),k=(K,M,U)=>{const V=U?ua:o1;gn(K,J=>{V(J.Xt,M)})},j=(K,M)=>{gn(K,U=>{const[V,J]=M(U);Xr(V,J)})},E=(K,M,U)=>{j(K,V=>{const{Ft:J,Gt:ie}=V;return[J,{[U?"width":"height"]:`${(100*g_(J,ie,U,M)).toFixed(3)}%`}]})},I=(K,M,U)=>{const V=U?"X":"Y";j(K,J=>{const{Ft:ie,Gt:xe,Xt:he}=J,ae=tL(ie,xe,v,M,lu(he),U);return[ie,{transform:ae===ae?`translate${V}(${(100*ae).toFixed(3)}%)`:""}]})},O=[],R=[],T=[],A=(K,M,U)=>{const V=Jv(U),J=V?U:!0,ie=V?!U:!0;J&&k(R,K,M),ie&&k(T,K,M)},z=K=>{E(R,K,!0),E(T,K)},$=K=>{I(R,K,!0),I(T,K)},ee=K=>{const M=K?mz:gz,U=K?R:T,V=e1(U)?P2:"",J=Ci(`${wo} ${M} ${V}`),ie=Ci(c_),xe=Ci(c1),he={Xt:J,Gt:ie,Ft:xe};return o||ua(J,fz),qo(J,ie),qo(ie,xe),In(U,he),In(O,[Us.bind(0,J),n(he,A,u,p,v,K)]),he},B=ee.bind(0,!0),H=ee.bind(0,!1),G=()=>{qo(_,R[0].Xt),qo(_,T[0].Xt),Vf(()=>{A(P2)},300)};return B(),H(),[{Ut:z,Wt:$,Zt:A,Jt:{Kt:R,Qt:B,tn:j.bind(0,R)},nn:{Kt:T,Qt:H,tn:j.bind(0,T)}},G,Ys.bind(0,O)]},rL=(e,t,n,r)=>{let o,s,i,u,d,p=0;const h=p_({}),[m]=h,[v,b]=ml(),[S,w]=ml(),[C,_]=ml(100),[k,j]=ml(100),[E,I]=ml(()=>p),[O,R,T]=nL(e,n.qt,Jz(t,n)),{Z:A,J:z,ot:$,st:ee,ut:B,it:H}=n.qt,{Jt:G,nn:K,Zt:M,Ut:U,Wt:V}=O,{tn:J}=G,{tn:ie}=K,xe=re=>{const{Xt:pe}=re,ne=B&&!H&&ba(pe)===z&&pe;return[ne,{transform:ne?`translate(${fs($)}px, ${ca($)}px)`:""}]},he=(re,pe)=>{if(I(),re)M(E2);else{const ne=()=>M(E2,!0);p>0&&!pe?E(ne):ne()}},ae=()=>{u=s,u&&he(!0)},Z=[_,I,j,w,b,T,Er(A,"pointerover",ae,{C:!0}),Er(A,"pointerenter",ae),Er(A,"pointerleave",()=>{u=!1,s&&he(!1)}),Er(A,"pointermove",()=>{o&&v(()=>{_(),he(!0),k(()=>{o&&he(!1)})})}),Er(ee,"scroll",re=>{S(()=>{V(n()),i&&he(!0),C(()=>{i&&!u&&he(!1)})}),r(re),B&&J(xe),B&&ie(xe)})],W=m.bind(0);return W.qt=O,W.Nt=R,[(re,pe,ne)=>{const{At:ge,Lt:ue,It:Ce,yt:Me}=ne,{A:me}=So(),_e=C0(t,re,pe),We=n(),{Tt:Le,Ct:Ue,bt:kt}=We,[gt,Pn]=_e("showNativeOverlaidScrollbars"),[Pt,yt]=_e("scrollbars.theme"),[be,Te]=_e("scrollbars.visibility"),[It,Ft]=_e("scrollbars.autoHide"),[Wt]=_e("scrollbars.autoHideDelay"),[Cn,En]=_e("scrollbars.dragScroll"),[ln,Sr]=_e("scrollbars.clickScroll"),vn=ge||ue||Me,sr=Ce||Te,Ee=gt&&me.x&&me.y,at=(Ye,rt)=>{const Nt=be==="visible"||be==="auto"&&Ye==="scroll";return M(vz,Nt,rt),Nt};if(p=Wt,Pn&&M(pz,Ee),yt&&(M(d),M(Pt,!0),d=Pt),Ft&&(o=It==="move",s=It==="leave",i=It!=="never",he(!i,!0)),En&&M(xz,Cn),Sr&&M(bz,ln),sr){const Ye=at(Ue.x,!0),rt=at(Ue.y,!1);M(yz,!(Ye&&rt))}vn&&(U(We),V(We),M(I2,!Le.x,!0),M(I2,!Le.y,!1),M(hz,kt&&!H))},W,Ys.bind(0,Z)]},v_=(e,t,n)=>{ys(e)&&e(t||void 0,n||void 0)},Va=(e,t,n)=>{const{F:r,N:o,Y:s,j:i}=So(),u=Mi(),d=Hf(e),p=d?e:e.target,h=f_(p);if(t&&!h){let m=!1;const v=B=>{const H=Mi()[Sz],G=H&&H.O;return G?G(B,!0):B},b=nr({},r(),v(t)),[S,w,C]=i1(n),[_,k,j]=qz(e,b),[E,I,O]=rL(e,b,k,B=>C("scroll",[ee,B])),R=(B,H)=>_(B,!!H),T=R.bind(0,{},!0),A=s(T),z=i(T),$=B=>{Mz(p),A(),z(),O(),j(),m=!0,C("destroyed",[ee,!!B]),w()},ee={options(B,H){if(B){const G=H?r():{},K=n_(b,nr(G,v(B)));t1(K)||(nr(b,K),R(K))}return nr({},b)},on:S,off:(B,H)=>{B&&H&&w(B,H)},state(){const{zt:B,Tt:H,Ct:G,Et:K,K:M,St:U,bt:V}=k();return nr({},{overflowEdge:B,overflowAmount:H,overflowStyle:G,hasOverflow:K,padding:M,paddingAbsolute:U,directionRTL:V,destroyed:m})},elements(){const{W:B,Z:H,K:G,J:K,tt:M,ot:U,st:V}=k.qt,{Jt:J,nn:ie}=I.qt,xe=ae=>{const{Ft:Z,Gt:W,Xt:re}=ae;return{scrollbar:re,track:W,handle:Z}},he=ae=>{const{Kt:Z,Qt:W}=ae,re=xe(Z[0]);return nr({},re,{clone:()=>{const pe=xe(W());return E({},!0,{}),pe}})};return nr({},{target:B,host:H,padding:G||K,viewport:K,content:M||K,scrollOffsetElement:U,scrollEventElement:V,scrollbarHorizontal:he(J),scrollbarVertical:he(ie)})},update:B=>R({},B),destroy:$.bind(0)};return k.jt((B,H,G)=>{E(H,G,B)}),Rz(p,ee),gn(Ro(u),B=>v_(u[B],0,ee)),Oz(k.qt.it,o().cancel,!d&&e.cancel)?($(!0),ee):(k.Nt(),I.Nt(),C("initialized",[ee]),k.jt((B,H,G)=>{const{gt:K,yt:M,vt:U,At:V,Lt:J,It:ie,wt:xe,Ot:he}=B;C("updated",[ee,{updateHints:{sizeChanged:K,directionChanged:M,heightIntrinsicChanged:U,overflowEdgeChanged:V,overflowAmountChanged:J,overflowStyleChanged:ie,contentMutation:xe,hostMutation:he},changedOptions:H,force:G}])}),ee.update(!0),ee)}return h};Va.plugin=e=>{gn(wz(e),t=>v_(t,Va))};Va.valid=e=>{const t=e&&e.elements,n=ys(t)&&t();return y0(n)&&!!f_(n.target)};Va.env=()=>{const{k:e,A:t,I:n,B:r,V:o,L:s,X:i,U:u,N:d,q:p,F:h,G:m}=So();return nr({},{scrollbarsSize:e,scrollbarsOverlaid:t,scrollbarsHiding:n,rtlScrollBehavior:r,flexboxGlue:o,cssCustomProperties:s,staticDefaultInitialization:i,staticDefaultOptions:u,getDefaultInitialization:d,setDefaultInitialization:p,getDefaultOptions:h,setDefaultOptions:m})};const oL=()=>{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,u=r?n.cancelIdleCallback:s,d=()=>{u(e),s(t)};return[(p,h)=>{d(),e=i(r?()=>{d(),t=o(p)}:p,typeof h=="object"?h:{timeout:2233})},d]},p1=e=>{const{options:t,events:n,defer:r}=e||{},[o,s]=f.useMemo(oL,[]),i=f.useRef(null),u=f.useRef(r),d=f.useRef(t),p=f.useRef(n);return f.useEffect(()=>{u.current=r},[r]),f.useEffect(()=>{const{current:h}=i;d.current=t,Va.valid(h)&&h.options(t||{},!0)},[t]),f.useEffect(()=>{const{current:h}=i;p.current=n,Va.valid(h)&&h.on(n||{},!0)},[n]),f.useEffect(()=>()=>{var h;s(),(h=i.current)==null||h.destroy()},[]),f.useMemo(()=>[h=>{const m=i.current;if(Va.valid(m))return;const v=u.current,b=d.current||{},S=p.current||{},w=()=>i.current=Va(h,b,S);v?o(w,v):w()},()=>i.current],[])},sL=(e,t)=>{const{element:n="div",options:r,events:o,defer:s,children:i,...u}=e,d=n,p=f.useRef(null),h=f.useRef(null),[m,v]=p1({options:r,events:o,defer:s});return f.useEffect(()=>{const{current:b}=p,{current:S}=h;return b&&S&&m({target:b,elements:{viewport:S,content:S}}),()=>{var w;return(w=v())==null?void 0:w.destroy()}},[m,n]),f.useImperativeHandle(t,()=>({osInstance:v,getElement:()=>p.current}),[]),N.createElement(d,{"data-overlayscrollbars-initialize":"",ref:p,...u},N.createElement("div",{ref:h},i))},y_=f.forwardRef(sL),aL=tt((e,t)=>{const{children:n,tooltip:r="",tooltipProps:{placement:o="top",hasArrow:s=!0,...i}={},isChecked:u,...d}=e;return a.jsx(_n,{label:r,placement:o,hasArrow:s,...i,children:a.jsx(Sf,{ref:t,colorScheme:u?"accent":"base",...d,children:n})})}),Zt=f.memo(aL),iL="My Board",lL=()=>{const[e,{isLoading:t}]=UE(),n=f.useCallback(()=>{e(iL)},[e]);return a.jsx(Zt,{isLoading:t,"aria-label":"Add Board",onClick:n,size:"sm",sx:{px:4},children:"Add Board"})},cL=e=>{const{isOver:t,label:n="Drop"}=e,r=f.useRef(Ga()),{colorMode:o}=Do();return a.jsx(io.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsxs(F,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full"},children:[a.jsx(F,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:ke("base.700","base.900")(o),opacity:.7,borderRadius:"base",alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(F,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",opacity:1,borderWidth:3,borderColor:t?ke("base.50","base.200")(o):ke("base.100","base.500")(o),borderRadius:"base",borderStyle:"dashed",transitionProperty:"common",transitionDuration:"0.1s",alignItems:"center",justifyContent:"center"},children:a.jsx(nt,{sx:{fontSize:"2xl",fontWeight:600,transform:t?"scale(1.02)":"scale(1)",color:t?ke("base.50","base.50")(o):ke("base.100","base.200")(o),transitionProperty:"common",transitionDuration:"0.1s"},children:n})})]})},r.current)},Kf=f.memo(cL),uL=e=>{const{dropLabel:t,data:n,disabled:r}=e,o=f.useRef(Ga()),{isOver:s,setNodeRef:i,active:u}=sv({id:o.current,disabled:r,data:n});return a.jsx(ze,{ref:i,position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",pointerEvents:"none",children:a.jsx(ws,{children:Cf(n,u)&&a.jsx(Kf,{isOver:s,label:t})})})},h1=f.memo(uL),Li=e=>{const{icon:t=oc,boxSize:n=16}=e;return a.jsxs(F,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",color:"base.700",_dark:{color:"base.500"},...e.sx},children:[a.jsx(mo,{as:t,boxSize:n,opacity:.7}),e.label&&a.jsx(nt,{textAlign:"center",children:e.label})]})},b_=e=>{const{droppableData:t,onClick:n,isSelected:r,icon:o,label:s,badgeCount:i}=e;return a.jsxs(F,{sx:{flexDir:"column",justifyContent:"space-between",alignItems:"center",cursor:"pointer",w:"full",h:"full",borderRadius:"base"},children:[a.jsxs(F,{onClick:n,sx:{position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",w:"full",aspectRatio:"1/1",overflow:"hidden",shadow:r?"selected.light":void 0,_dark:{shadow:r?"selected.dark":void 0},flexShrink:0},children:[a.jsx(Li,{boxSize:8,icon:o,sx:{border:"2px solid var(--invokeai-colors-base-200)",_dark:{border:"2px solid var(--invokeai-colors-base-800)"}}}),a.jsx(F,{sx:{position:"absolute",insetInlineEnd:0,top:0,p:1},children:i!==void 0&&a.jsx(Xa,{variant:"solid",children:i})}),a.jsx(h1,{data:t})]}),a.jsx(F,{sx:{h:"full",alignItems:"center",fontWeight:r?600:void 0,fontSize:"xs",color:r?"base.900":"base.700",_dark:{color:r?"base.50":"base.200"}},children:s})]})},dL=({isSelected:e})=>{const t=S4(),n=()=>{t(av("all"))},r={id:"all-images-board",actionType:"MOVE_BOARD",context:{boardId:null}};return a.jsx(b_,{droppableData:r,onClick:n,isSelected:e,icon:z5,label:"All Images"})},fL=ve(Mt,e=>({count:e.gallery.batchImageNames.length})),pL=({isSelected:e})=>{const t=S4(),{count:n}=L(fL),r=f.useCallback(()=>{t(av("batch"))},[t]),o={id:"batch-board",actionType:"ADD_TO_BATCH"};return a.jsx(b_,{droppableData:o,onClick:r,isSelected:e,icon:qv,label:"Batch",badgeCount:n})};var Kc=globalThis&&globalThis.__assign||function(){return Kc=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&ce[ce.length-1])||De[0]!==6&&De[0]!==2)){Qe=0;continue}if(De[0]===3&&(!ce||De[1]>ce[0]&&De[1]=200&&q.status<=299},ee=function(q){return/ion\/(vnd\.api\+)?json/.test(q.get("content-type")||"")};function B(q){if(!(0,A.isPlainObject)(q))return q;for(var Q=C({},q),le=0,we=Object.entries(Q);le"u"&&Qe===z&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(Gt,$t){return I(Q,null,function(){var Re,ut,Ct,Tt,xn,zt,tn,Xt,Cr,Vn,vt,wn,kn,Un,ar,On,Rn,nn,pn,Sn,cn,un,Be,xt,pt,Xe,ft,Rt,lt,qe,Pe,Se,Ie,Ae,Ge,_t;return r(this,function(wt){switch(wt.label){case 0:return Re=$t.signal,ut=$t.getState,Ct=$t.extra,Tt=$t.endpoint,xn=$t.forced,zt=$t.type,Cr=(Xt=typeof Gt=="string"?{url:Gt}:Gt).url,vt=(Vn=Xt.headers)===void 0?new Headers(Lt.headers):Vn,kn=(wn=Xt.params)===void 0?void 0:wn,ar=(Un=Xt.responseHandler)===void 0?bt??"json":Un,Rn=(On=Xt.validateStatus)===void 0?Et??$:On,pn=(nn=Xt.timeout)===void 0?ht:nn,Sn=j(Xt,["url","headers","params","responseHandler","validateStatus","timeout"]),cn=C(_(C({},Lt),{signal:Re}),Sn),vt=new Headers(B(vt)),un=cn,[4,ce(vt,{getState:ut,extra:Ct,endpoint:Tt,forced:xn,type:zt})];case 1:un.headers=wt.sent()||vt,Be=function(Ne){return typeof Ne=="object"&&((0,A.isPlainObject)(Ne)||Array.isArray(Ne)||typeof Ne.toJSON=="function")},!cn.headers.has("content-type")&&Be(cn.body)&&cn.headers.set("content-type",ye),Be(cn.body)&&dt(cn.headers)&&(cn.body=JSON.stringify(cn.body,Fe)),kn&&(xt=~Cr.indexOf("?")?"&":"?",pt=Dt?Dt(kn):new URLSearchParams(B(kn)),Cr+=xt+pt),Cr=function(Ne,Kt){if(!Ne)return Kt;if(!Kt)return Ne;if(function(on){return new RegExp("(^|:)//").test(on)}(Kt))return Kt;var dn=Ne.endsWith("/")||!Kt.startsWith("?")?"/":"";return Ne=function(on){return on.replace(/\/$/,"")}(Ne),""+Ne+dn+function(on){return on.replace(/^\//,"")}(Kt)}(le,Cr),Xe=new Request(Cr,cn),ft=Xe.clone(),tn={request:ft},lt=!1,qe=pn&&setTimeout(function(){lt=!0,$t.abort()},pn),wt.label=2;case 2:return wt.trys.push([2,4,5,6]),[4,Qe(Xe)];case 3:return Rt=wt.sent(),[3,6];case 4:return Pe=wt.sent(),[2,{error:{status:lt?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Pe)},meta:tn}];case 5:return qe&&clearTimeout(qe),[7];case 6:Se=Rt.clone(),tn.response=Se,Ae="",wt.label=7;case 7:return wt.trys.push([7,9,,10]),[4,Promise.all([qt(Rt,ar).then(function(Ne){return Ie=Ne},function(Ne){return Ge=Ne}),Se.text().then(function(Ne){return Ae=Ne},function(){})])];case 8:if(wt.sent(),Ge)throw Ge;return[3,10];case 9:return _t=wt.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:Rt.status,data:Ae,error:String(_t)},meta:tn}];case 10:return[2,Rn(Rt,Ie)?{data:Ie,meta:tn}:{error:{status:Rt.status,data:Ie},meta:tn}]}})})};function qt(Gt,$t){return I(this,null,function(){var Re;return r(this,function(ut){switch(ut.label){case 0:return typeof $t=="function"?[2,$t(Gt)]:($t==="content-type"&&($t=dt(Gt.headers)?"json":"text"),$t!=="json"?[3,2]:[4,Gt.text()]);case 1:return[2,(Re=ut.sent()).length?JSON.parse(Re):null];case 2:return[2,Gt.text()]}})})}}var G=function(q,Q){Q===void 0&&(Q=void 0),this.value=q,this.meta=Q};function K(q,Q){return q===void 0&&(q=0),Q===void 0&&(Q=5),I(this,null,function(){var le,we;return r(this,function(ce){switch(ce.label){case 0:return le=Math.min(q,Q),we=~~((Math.random()+.4)*(300<=Se)}var Sn=(0,Ue.createAsyncThunk)(kn+"/executeQuery",nn,{getPendingMeta:function(){var Be;return(Be={startedTimeStamp:Date.now()})[Ue.SHOULD_AUTOBATCH]=!0,Be},condition:function(Be,xt){var pt,Xe,ft,Rt=(0,xt.getState)(),lt=(Xe=(pt=Rt[kn])==null?void 0:pt.queries)==null?void 0:Xe[Be.queryCacheKey],qe=lt==null?void 0:lt.fulfilledTimeStamp,Pe=Be.originalArgs,Se=lt==null?void 0:lt.originalArgs,Ie=ar[Be.endpointName];return!(!_e(Be)&&((lt==null?void 0:lt.status)==="pending"||!pn(Be,Rt)&&(!ne(Ie)||!((ft=Ie==null?void 0:Ie.forceRefetch)!=null&&ft.call(Ie,{currentArg:Pe,previousArg:Se,endpointState:lt,state:Rt})))&&qe))},dispatchConditionRejection:!0}),cn=(0,Ue.createAsyncThunk)(kn+"/executeMutation",nn,{getPendingMeta:function(){var Be;return(Be={startedTimeStamp:Date.now()})[Ue.SHOULD_AUTOBATCH]=!0,Be}});function un(Be){return function(xt){var pt,Xe;return((Xe=(pt=xt==null?void 0:xt.meta)==null?void 0:pt.arg)==null?void 0:Xe.endpointName)===Be}}return{queryThunk:Sn,mutationThunk:cn,prefetch:function(Be,xt,pt){return function(Xe,ft){var Rt=function(Ie){return"force"in Ie}(pt)&&pt.force,lt=function(Ie){return"ifOlderThan"in Ie}(pt)&&pt.ifOlderThan,qe=function(Ie){return Ie===void 0&&(Ie=!0),Rn.endpoints[Be].initiate(xt,{forceRefetch:Ie})},Pe=Rn.endpoints[Be].select(xt)(ft());if(Rt)Xe(qe());else if(lt){var Se=Pe==null?void 0:Pe.fulfilledTimeStamp;if(!Se)return void Xe(qe());(Number(new Date)-Number(new Date(Se)))/1e3>=lt&&Xe(qe())}else Xe(qe(!1))}},updateQueryData:function(Be,xt,pt){return function(Xe,ft){var Rt,lt,qe=Rn.endpoints[Be].select(xt)(ft()),Pe={patches:[],inversePatches:[],undo:function(){return Xe(Rn.util.patchQueryData(Be,xt,Pe.inversePatches))}};if(qe.status===t.uninitialized)return Pe;if("data"in qe)if((0,Le.isDraftable)(qe.data)){var Se=(0,Le.produceWithPatches)(qe.data,pt),Ie=Se[2];(Rt=Pe.patches).push.apply(Rt,Se[1]),(lt=Pe.inversePatches).push.apply(lt,Ie)}else{var Ae=pt(qe.data);Pe.patches.push({op:"replace",path:[],value:Ae}),Pe.inversePatches.push({op:"replace",path:[],value:qe.data})}return Xe(Rn.util.patchQueryData(Be,xt,Pe.patches)),Pe}},upsertQueryData:function(Be,xt,pt){return function(Xe){var ft;return Xe(Rn.endpoints[Be].initiate(xt,((ft={subscribe:!1,forceRefetch:!0})[me]=function(){return{data:pt}},ft)))}},patchQueryData:function(Be,xt,pt){return function(Xe){Xe(Rn.internalActions.queryResultPatched({queryCacheKey:On({queryArgs:xt,endpointDefinition:ar[Be],endpointName:Be}),patches:pt}))}},buildMatchThunkActions:function(Be,xt){return{matchPending:(0,We.isAllOf)((0,We.isPending)(Be),un(xt)),matchFulfilled:(0,We.isAllOf)((0,We.isFulfilled)(Be),un(xt)),matchRejected:(0,We.isAllOf)((0,We.isRejected)(Be),un(xt))}}}}({baseQuery:we,reducerPath:ce,context:le,api:q,serializeQueryArgs:et}),Fe=ye.queryThunk,ht=ye.mutationThunk,bt=ye.patchQueryData,Et=ye.updateQueryData,Lt=ye.upsertQueryData,qt=ye.prefetch,Gt=ye.buildMatchThunkActions,$t=function(vt){var wn=vt.reducerPath,kn=vt.queryThunk,Un=vt.mutationThunk,ar=vt.context,On=ar.endpointDefinitions,Rn=ar.apiUid,nn=ar.extractRehydrationInfo,pn=ar.hasRehydrationInfo,Sn=vt.assertTagType,cn=vt.config,un=(0,Ce.createAction)(wn+"/resetApiState"),Be=(0,Ce.createSlice)({name:wn+"/queries",initialState:It,reducers:{removeQueryResult:{reducer:function(qe,Pe){delete qe[Pe.payload.queryCacheKey]},prepare:(0,Ce.prepareAutoBatched)()},queryResultPatched:function(qe,Pe){var Se=Pe.payload,Ie=Se.patches;yt(qe,Se.queryCacheKey,function(Ae){Ae.data=(0,Pt.applyPatches)(Ae.data,Ie.concat())})}},extraReducers:function(qe){qe.addCase(kn.pending,function(Pe,Se){var Ie,Ae=Se.meta,Ge=Se.meta.arg,_t=_e(Ge);(Ge.subscribe||_t)&&(Pe[Ie=Ge.queryCacheKey]!=null||(Pe[Ie]={status:t.uninitialized,endpointName:Ge.endpointName})),yt(Pe,Ge.queryCacheKey,function(wt){wt.status=t.pending,wt.requestId=_t&&wt.requestId?wt.requestId:Ae.requestId,Ge.originalArgs!==void 0&&(wt.originalArgs=Ge.originalArgs),wt.startedTimeStamp=Ae.startedTimeStamp})}).addCase(kn.fulfilled,function(Pe,Se){var Ie=Se.meta,Ae=Se.payload;yt(Pe,Ie.arg.queryCacheKey,function(Ge){var _t;if(Ge.requestId===Ie.requestId||_e(Ie.arg)){var wt=On[Ie.arg.endpointName].merge;if(Ge.status=t.fulfilled,wt)if(Ge.data!==void 0){var Ne=Ie.fulfilledTimeStamp,Kt=Ie.arg,dn=Ie.baseQueryMeta,on=Ie.requestId,ir=(0,Ce.createNextState)(Ge.data,function(Fn){return wt(Fn,Ae,{arg:Kt.originalArgs,baseQueryMeta:dn,fulfilledTimeStamp:Ne,requestId:on})});Ge.data=ir}else Ge.data=Ae;else Ge.data=(_t=On[Ie.arg.endpointName].structuralSharing)==null||_t?T((0,Pn.isDraft)(Ge.data)?(0,Pt.original)(Ge.data):Ge.data,Ae):Ae;delete Ge.error,Ge.fulfilledTimeStamp=Ie.fulfilledTimeStamp}})}).addCase(kn.rejected,function(Pe,Se){var Ie=Se.meta,Ae=Ie.condition,Ge=Ie.requestId,_t=Se.error,wt=Se.payload;yt(Pe,Ie.arg.queryCacheKey,function(Ne){if(!Ae){if(Ne.requestId!==Ge)return;Ne.status=t.rejected,Ne.error=wt??_t}})}).addMatcher(pn,function(Pe,Se){for(var Ie=nn(Se).queries,Ae=0,Ge=Object.entries(Ie);Ae"u"||navigator.onLine===void 0||navigator.onLine,focused:typeof document>"u"||document.visibilityState!=="hidden",middlewareRegistered:!1},cn),reducers:{middlewareRegistered:function(qe,Pe){qe.middlewareRegistered=qe.middlewareRegistered!=="conflict"&&Rn===Pe.payload||"conflict"}},extraReducers:function(qe){qe.addCase(xe,function(Pe){Pe.online=!0}).addCase(he,function(Pe){Pe.online=!1}).addCase(J,function(Pe){Pe.focused=!0}).addCase(ie,function(Pe){Pe.focused=!1}).addMatcher(pn,function(Pe){return C({},Pe)})}}),lt=(0,Ce.combineReducers)({queries:Be.reducer,mutations:xt.reducer,provided:pt.reducer,subscriptions:ft.reducer,config:Rt.reducer});return{reducer:function(qe,Pe){return lt(un.match(Pe)?void 0:qe,Pe)},actions:_(C(C(C(C(C({},Rt.actions),Be.actions),Xe.actions),ft.actions),xt.actions),{unsubscribeMutationResult:xt.actions.removeMutationResult,resetApiState:un})}}({context:le,queryThunk:Fe,mutationThunk:ht,reducerPath:ce,assertTagType:De,config:{refetchOnFocus:ot,refetchOnReconnect:dt,refetchOnMountOrArgChange:Dt,keepUnusedDataFor:Qe,reducerPath:ce}}),Re=$t.reducer,ut=$t.actions;Dr(q.util,{patchQueryData:bt,updateQueryData:Et,upsertQueryData:Lt,prefetch:qt,resetApiState:ut.resetApiState}),Dr(q.internalActions,ut);var Ct=function(vt){var wn=vt.reducerPath,kn=vt.queryThunk,Un=vt.api,ar=vt.context,On=ar.apiUid,Rn={invalidateTags:(0,dr.createAction)(wn+"/invalidateTags")},nn=[Lr,yn,zr,fr,$n,Co];return{middleware:function(Sn){var cn=!1,un=_(C({},vt),{internalState:{currentSubscriptions:{}},refetchQuery:pn}),Be=nn.map(function(Xe){return Xe(un)}),xt=function(Xe){var ft=Xe.api,Rt=Xe.queryThunk,lt=Xe.internalState,qe=ft.reducerPath+"/subscriptions",Pe=null,Se=!1,Ie=ft.internalActions,Ae=Ie.updateSubscriptionOptions,Ge=Ie.unsubscribeQueryResult;return function(_t,wt){var Ne,Kt;if(Pe||(Pe=JSON.parse(JSON.stringify(lt.currentSubscriptions))),ft.util.resetApiState.match(_t))return Pe=lt.currentSubscriptions={},[!0,!1];if(ft.internalActions.internal_probeSubscription.match(_t)){var dn=_t.payload;return[!1,!!((Ne=lt.currentSubscriptions[dn.queryCacheKey])!=null&&Ne[dn.requestId])]}var on=function(an,zn){var eo,rn,Mn,Fr,_r,Pa,Fu,_o,Js;if(Ae.match(zn)){var Is=zn.payload,Zs=Is.queryCacheKey,to=Is.requestId;return(eo=an==null?void 0:an[Zs])!=null&&eo[to]&&(an[Zs][to]=Is.options),!0}if(Ge.match(zn)){var no=zn.payload;return to=no.requestId,an[Zs=no.queryCacheKey]&&delete an[Zs][to],!0}if(ft.internalActions.removeQueryResult.match(zn))return delete an[zn.payload.queryCacheKey],!0;if(Rt.pending.match(zn)){var ro=zn.meta;if(to=ro.requestId,(Ur=ro.arg).subscribe)return(No=(Mn=an[rn=Ur.queryCacheKey])!=null?Mn:an[rn]={})[to]=(_r=(Fr=Ur.subscriptionOptions)!=null?Fr:No[to])!=null?_r:{},!0}if(Rt.rejected.match(zn)){var No,ko=zn.meta,Ur=ko.arg;if(to=ko.requestId,ko.condition&&Ur.subscribe)return(No=(Fu=an[Pa=Ur.queryCacheKey])!=null?Fu:an[Pa]={})[to]=(Js=(_o=Ur.subscriptionOptions)!=null?_o:No[to])!=null?Js:{},!0}return!1}(lt.currentSubscriptions,_t);if(on){Se||(es(function(){var an=JSON.parse(JSON.stringify(lt.currentSubscriptions)),zn=(0,Br.produceWithPatches)(Pe,function(){return an});wt.next(ft.internalActions.subscriptionsUpdated(zn[1])),Pe=an,Se=!1}),Se=!0);var ir=!!((Kt=_t.type)!=null&&Kt.startsWith(qe)),Fn=Rt.rejected.match(_t)&&_t.meta.condition&&!!_t.meta.arg.subscribe;return[!ir&&!Fn,!1]}return[!0,!1]}}(un),pt=function(Xe){var ft=Xe.reducerPath,Rt=Xe.context,lt=Xe.refetchQuery,qe=Xe.internalState,Pe=Xe.api.internalActions.removeQueryResult;function Se(Ie,Ae){var Ge=Ie.getState()[ft],_t=Ge.queries,wt=qe.currentSubscriptions;Rt.batch(function(){for(var Ne=0,Kt=Object.keys(wt);Ne{const n=te(),{currentData:r}=gs(e.cover_image_name??Ko.skipToken),{colorMode:o}=Do(),{board_name:s,board_id:i}=e,{onClickDeleteBoardImages:u}=f.useContext(C4),d=f.useCallback(()=>{n(av(i))},[i,n]),[p,{isLoading:h}]=YE(),[m,{isLoading:v}]=QE(),b=k=>{p({board_id:i,changes:{board_name:k}})},S=f.useCallback(()=>{m(i)},[i,m]),w=f.useCallback(()=>{},[]),C=f.useCallback(()=>{u(e)},[e,u]),_=f.useMemo(()=>({id:i,actionType:"MOVE_BOARD",context:{boardId:i}}),[i]);return a.jsx(ze,{sx:{touchAction:"none",height:"full"},children:a.jsx(x_,{menuProps:{size:"sm",isLazy:!0},renderMenu:()=>a.jsxs(tc,{sx:{visibility:"visible !important"},children:[e.image_count>0&&a.jsxs(a.Fragment,{children:[a.jsx(jr,{isDisabled:!e.image_count,icon:a.jsx(z5,{}),onClickCapture:w,children:"Add Board to Batch"}),a.jsx(jr,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(bo,{}),onClickCapture:C,children:"Delete Board and Images"})]}),a.jsx(jr,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(bo,{}),onClickCapture:S,children:"Delete Board"})]}),children:k=>a.jsxs(F,{userSelect:"none",ref:k,sx:{flexDir:"column",justifyContent:"space-between",alignItems:"center",cursor:"pointer",w:"full",h:"full"},children:[a.jsxs(F,{onClick:d,sx:{position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",w:"full",aspectRatio:"1/1",overflow:"hidden",shadow:t?"selected.light":void 0,_dark:{shadow:t?"selected.dark":void 0},flexShrink:0},children:[e.cover_image_name&&(r==null?void 0:r.image_url)&&a.jsx(bu,{src:r==null?void 0:r.image_url,draggable:!1}),!(e.cover_image_name&&(r!=null&&r.image_url))&&a.jsx(Li,{boxSize:8,icon:qc,sx:{border:"2px solid var(--invokeai-colors-base-200)",_dark:{border:"2px solid var(--invokeai-colors-base-800)"}}}),a.jsx(F,{sx:{position:"absolute",insetInlineEnd:0,top:0,p:1},children:a.jsx(Xa,{variant:"solid",children:e.image_count})}),a.jsx(h1,{data:_})]}),a.jsx(F,{sx:{width:"full",height:"full",justifyContent:"center",alignItems:"center"},children:a.jsxs(H3,{defaultValue:s,submitOnBlur:!1,onSubmit:j=>{b(j)},children:[a.jsx(L3,{sx:{color:t?ke("base.900","base.50")(o):ke("base.700","base.200")(o),fontWeight:t?600:void 0,fontSize:"xs",textAlign:"center",p:0},noOfLines:1}),a.jsx(z3,{sx:{color:ke("base.900","base.50")(o),fontSize:"xs",borderColor:ke("base.500","base.500")(o),p:0,outline:0}})]})})]},i)})})});C_.displayName="HoverableBoard";const xr=e=>{const t=L(i=>i.config.disabledTabs),n=L(i=>i.config.disabledFeatures),r=L(i=>i.config.disabledSDFeatures),o=f.useMemo(()=>n.includes(e)||r.includes(e)||t.includes(e),[n,r,t,e]),s=f.useMemo(()=>!(n.includes(e)||r.includes(e)||t.includes(e)),[n,r,t,e]);return{isFeatureDisabled:o,isFeatureEnabled:s}},mL=ve([Mt],({boards:e,gallery:t})=>{const{searchText:n}=e,{selectedBoardId:r}=t;return{selectedBoardId:r,searchText:n}},it),gL=e=>{const{isOpen:t}=e,n=te(),{selectedBoardId:r,searchText:o}=L(mL),{data:s}=lv(),i=xr("batches").isFeatureEnabled,u=o?s==null?void 0:s.filter(v=>v.board_name.toLowerCase().includes(o.toLowerCase())):s,[d,p]=f.useState(!1),h=v=>{p(v.length>0),n(Wb(v))},m=()=>{p(!1),n(Wb(""))};return a.jsx(Jp,{in:t,animateOpacity:!0,children:a.jsxs(F,{layerStyle:"first",sx:{flexDir:"column",gap:2,p:2,mt:2,borderRadius:"base"},children:[a.jsxs(F,{sx:{gap:2,alignItems:"center"},children:[a.jsxs(P6,{children:[a.jsx(ku,{placeholder:"Search Boards...",value:o,onChange:v=>{h(v.target.value)}}),o&&o.length&&a.jsx(Mv,{children:a.jsx(qa,{onClick:m,size:"xs",variant:"ghost","aria-label":"Clear Search",icon:a.jsx($$,{boxSize:3})})})]}),a.jsx(lL,{})]}),a.jsx(y_,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsxs(Ei,{className:"list-container",sx:{gridTemplateRows:"6.5rem 6.5rem",gridAutoFlow:"column dense",gridAutoColumns:"5rem"},children:[!d&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{sx:{p:1.5},children:a.jsx(dL,{isSelected:r==="all"})}),i&&a.jsx(hf,{sx:{p:1.5},children:a.jsx(pL,{isSelected:r==="batch"})})]}),u&&u.map(v=>a.jsx(hf,{sx:{p:1.5},children:a.jsx(C_,{board:v,isSelected:r===v.board_id})},v.board_id))]})})]})})},vL=f.memo(gL),bh=0,oi=1,sc=2,__=4;function yL(e,t){return n=>e(t(n))}function bL(e,t){return t(e)}function k_(e,t){return n=>e(t,n)}function H2(e,t){return()=>e(t)}function m1(e,t){return t(e),e}function Bi(...e){return e}function xL(e){e()}function W2(e){return()=>e}function wL(...e){return()=>{e.map(xL)}}function xh(){}function ao(e,t){return e(oi,t)}function Ir(e,t){e(bh,t)}function g1(e){e(sc)}function wh(e){return e(__)}function Ln(e,t){return ao(e,k_(t,bh))}function V2(e,t){const n=e(oi,r=>{n(),t(r)});return n}function hr(){const e=[];return(t,n)=>{switch(t){case sc:e.splice(0,e.length);return;case oi:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case bh:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function Bt(e){let t=e;const n=hr();return(r,o)=>{switch(r){case oi:o(t);break;case bh:t=o;break;case __:return t}return n(r,o)}}function SL(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case oi:return s?n===s?void 0:(r(),n=s,t=ao(e,s),t):(r(),xh);case sc:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function Yc(e){return m1(hr(),t=>Ln(e,t))}function Rl(e,t){return m1(Bt(t),n=>Ln(e,n))}function CL(...e){return t=>e.reduceRight(bL,t)}function Ht(e,...t){const n=CL(...t);return(r,o)=>{switch(r){case oi:return ao(e,n(o));case sc:g1(e);return}}}function P_(e,t){return e===t}function go(e=P_){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Vr(e){return t=>n=>{e(n)&&t(n)}}function Kn(e){return t=>yL(t,e)}function Fa(e){return t=>()=>t(e)}function Gd(e,t){return n=>r=>n(t=e(t,r))}function P0(e){return t=>n=>{e>0?e--:t(n)}}function Lc(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function U2(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function $s(...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 u=Math.pow(2,i);ao(s,d=>{const p=n;n=n|u,t[i]=d,p!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const u=()=>s([i].concat(t));n===o?u():r=u}}function G2(...e){return function(t,n){switch(t){case oi:return wL(...e.map(r=>ao(r,n)));case sc:return;default:throw new Error(`unrecognized action ${t}`)}}}function fn(e,t=P_){return Ht(e,go(t))}function la(...e){const t=hr(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const u=Math.pow(2,i);ao(s,d=>{n[i]=d,r=r|u,r===o&&Ir(t,n)})}),function(s,i){switch(s){case oi:return r===o&&i(n),ao(t,i);case sc:return g1(t);default:throw new Error(`unrecognized action ${s}`)}}}function Qs(e,t=[],{singleton:n}={singleton:!0}){return{id:_L(),constructor:e,dependencies:t,singleton:n}}const _L=()=>Symbol();function kL(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:i})=>{if(i&&t.has(r))return t.get(r);const u=o(s.map(d=>n(d)));return i&&t.set(r,u),u};return n(e)}function PL(e,t){const n={},r={};let o=0;const s=e.length;for(;o(C[_]=k=>{const j=w[t.methods[_]];Ir(j,k)},C),{})}function h(w){return i.reduce((C,_)=>(C[_]=SL(w[t.events[_]]),C),{})}return{Component:N.forwardRef((w,C)=>{const{children:_,...k}=w,[j]=N.useState(()=>m1(kL(e),I=>d(I,k))),[E]=N.useState(H2(h,j));return qd(()=>{for(const I of i)I in k&&ao(E[I],k[I]);return()=>{Object.values(E).map(g1)}},[k,E,j]),qd(()=>{d(j,k)}),N.useImperativeHandle(C,W2(p(j))),N.createElement(u.Provider,{value:j},n?N.createElement(n,PL([...r,...o,...i],k),_):_)}),usePublisher:w=>N.useCallback(k_(Ir,N.useContext(u)[w]),[w]),useEmitterValue:w=>{const _=N.useContext(u)[w],[k,j]=N.useState(H2(wh,_));return qd(()=>ao(_,E=>{E!==k&&j(W2(E))}),[_,k]),k},useEmitter:(w,C)=>{const k=N.useContext(u)[w];qd(()=>ao(k,C),[C,k])}}}const IL=typeof document<"u"?N.useLayoutEffect:N.useEffect,EL=IL;var v1=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(v1||{});const OL={0:"debug",1:"log",2:"warn",3:"error"},RL=()=>typeof globalThis>"u"?window:globalThis,j_=Qs(()=>{const e=Bt(3);return{log:Bt((n,r,o=1)=>{var s;const i=(s=RL().VIRTUOSO_LOG_LEVEL)!=null?s:wh(e);o>=i&&console[OL[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function I_(e,t=!0){const n=N.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=N.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 Sh(e,t=!0){return I_(e,t).callbackRef}function Yf(e,t){return Math.round(e.getBoundingClientRect()[t])}function E_(e,t){return Math.abs(e-t)<1.01}function O_(e,t,n,r=xh,o){const s=N.useRef(null),i=N.useRef(null),u=N.useRef(null),d=N.useCallback(m=>{const v=m.target,b=v===window||v===document,S=b?window.pageYOffset||document.documentElement.scrollTop:v.scrollTop,w=b?document.documentElement.scrollHeight:v.scrollHeight,C=b?window.innerHeight:v.offsetHeight,_=()=>{e({scrollTop:Math.max(S,0),scrollHeight:w,viewportHeight:C})};m.suppressFlushSync?_():XE.flushSync(_),i.current!==null&&(S===i.current||S<=0||S===w-C)&&(i.current=null,t(!0),u.current&&(clearTimeout(u.current),u.current=null))},[e,t]);N.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 v=s.current;if(!v||"offsetHeight"in v&&v.offsetHeight===0)return;const b=m.behavior==="smooth";let S,w,C;v===window?(w=Math.max(Yf(document.documentElement,"height"),document.documentElement.scrollHeight),S=window.innerHeight,C=document.documentElement.scrollTop):(w=v.scrollHeight,S=Yf(v,"height"),C=v.scrollTop);const _=w-S;if(m.top=Math.ceil(Math.max(Math.min(_,m.top),0)),E_(S,w)||m.top===C){e({scrollTop:C,scrollHeight:w,viewportHeight:S}),b&&t(!0);return}b?(i.current=m.top,u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,i.current=null,t(!0)},1e3)):i.current=null,v.scrollTo(m)}function h(m){s.current.scrollBy(m)}return{scrollerRef:s,scrollByCallback:h,scrollToCallback:p}}const Ch=Qs(()=>{const e=hr(),t=hr(),n=Bt(0),r=hr(),o=Bt(0),s=hr(),i=hr(),u=Bt(0),d=Bt(0),p=Bt(0),h=Bt(0),m=hr(),v=hr(),b=Bt(!1);return Ln(Ht(e,Kn(({scrollTop:S})=>S)),t),Ln(Ht(e,Kn(({scrollHeight:S})=>S)),i),Ln(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:u,fixedHeaderHeight:d,fixedFooterHeight:p,footerHeight:h,scrollHeight:i,smoothScrollTargetReached:r,scrollTo:m,scrollBy:v,statefulScrollTop:o,deviation:n,scrollingInProgress:b}},[],{singleton:!0}),ML=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function DL(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!ML)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Qf="up",Qc="down",TL="none",AL={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},NL=0,R_=Qs(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const i=Bt(!1),u=Bt(!0),d=hr(),p=hr(),h=Bt(4),m=Bt(NL),v=Rl(Ht(G2(Ht(fn(t),P0(1),Fa(!0)),Ht(fn(t),P0(1),Fa(!1),U2(100))),go()),!1),b=Rl(Ht(G2(Ht(s,Fa(!0)),Ht(s,Fa(!1),U2(200))),go()),!1);Ln(Ht(la(fn(t),fn(m)),Kn(([k,j])=>k<=j),go()),u),Ln(Ht(u,Lc(50)),p);const S=Yc(Ht(la(e,fn(n),fn(r),fn(o),fn(h)),Gd((k,[{scrollTop:j,scrollHeight:E},I,O,R,T])=>{const A=j+I-E>-T,z={viewportHeight:I,scrollTop:j,scrollHeight:E};if(A){let ee,B;return j>k.state.scrollTop?(ee="SCROLLED_DOWN",B=k.state.scrollTop-j):(ee="SIZE_DECREASED",B=k.state.scrollTop-j||k.scrollTopDelta),{atBottom:!0,state:z,atBottomBecause:ee,scrollTopDelta:B}}let $;return z.scrollHeight>k.state.scrollHeight?$="SIZE_INCREASED":Ik&&k.atBottom===j.atBottom))),w=Rl(Ht(e,Gd((k,{scrollTop:j,scrollHeight:E,viewportHeight:I})=>{if(E_(k.scrollHeight,E))return{scrollTop:j,scrollHeight:E,jump:0,changed:!1};{const O=E-(j+I)<1;return k.scrollTop!==j&&O?{scrollHeight:E,scrollTop:j,jump:k.scrollTop-j,changed:!0}:{scrollHeight:E,scrollTop:j,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),Vr(k=>k.changed),Kn(k=>k.jump)),0);Ln(Ht(S,Kn(k=>k.atBottom)),i),Ln(Ht(i,Lc(50)),d);const C=Bt(Qc);Ln(Ht(e,Kn(({scrollTop:k})=>k),go(),Gd((k,j)=>wh(b)?{direction:k.direction,prevScrollTop:j}:{direction:jk.direction)),C),Ln(Ht(e,Lc(50),Fa(TL)),C);const _=Bt(0);return Ln(Ht(v,Vr(k=>!k),Fa(0)),_),Ln(Ht(t,Lc(100),$s(v),Vr(([k,j])=>!!j),Gd(([k,j],[E])=>[j,E],[0,0]),Kn(([k,j])=>j-k)),_),{isScrolling:v,isAtTop:u,isAtBottom:i,atBottomState:S,atTopStateChange:p,atBottomStateChange:d,scrollDirection:C,atBottomThreshold:h,atTopThreshold:m,scrollVelocity:_,lastJumpDueToItemResize:w}},Bi(Ch)),$L=Qs(([{log:e}])=>{const t=Bt(!1),n=Yc(Ht(t,Vr(r=>r),go()));return ao(t,r=>{r&&wh(e)("props updated",{},v1.DEBUG)}),{propsReady:t,didMount:n}},Bi(j_),{singleton:!0});function M_(e,t){e==0?t():requestAnimationFrame(()=>M_(e-1,t))}function zL(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}function j0(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function LL(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const Xf="top",Jf="bottom",q2="none";function K2(e,t,n){return typeof e=="number"?n===Qf&&t===Xf||n===Qc&&t===Jf?e:0:n===Qf?t===Xf?e.main:e.reverse:t===Jf?e.main:e.reverse}function Y2(e,t){return typeof e=="number"?e:e[t]||0}const BL=Qs(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=hr(),i=Bt(0),u=Bt(0),d=Bt(0),p=Rl(Ht(la(fn(e),fn(t),fn(r),fn(s,j0),fn(d),fn(i),fn(o),fn(n),fn(u)),Kn(([h,m,v,[b,S],w,C,_,k,j])=>{const E=h-k,I=C+_,O=Math.max(v-E,0);let R=q2;const T=Y2(j,Xf),A=Y2(j,Jf);return b-=k,b+=v+_,S+=v+_,S-=k,b>h+I-T&&(R=Qf),Sh!=null),go(j0)),[0,0]);return{listBoundary:s,overscan:d,topListHeight:i,increaseViewportBy:u,visibleRange:p}},Bi(Ch),{singleton:!0}),FL=Qs(([{scrollVelocity:e}])=>{const t=Bt(!1),n=hr(),r=Bt(!1);return Ln(Ht(e,$s(r,t,n),Vr(([o,s])=>!!s),Kn(([o,s,i,u])=>{const{exit:d,enter:p}=s;if(i){if(d(o,u))return!1}else if(p(o,u))return!0;return i}),go()),t),ao(Ht(la(t,e,n),$s(r)),([[o,s,i],u])=>o&&u&&u.change&&u.change(s,i)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},Bi(R_),{singleton:!0});function HL(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const WL=Qs(([{scrollTo:e,scrollContainerState:t}])=>{const n=hr(),r=hr(),o=hr(),s=Bt(!1),i=Bt(void 0);return Ln(Ht(la(n,r),Kn(([{viewportHeight:u,scrollTop:d,scrollHeight:p},{offsetTop:h}])=>({scrollTop:Math.max(0,d-h),scrollHeight:p,viewportHeight:u}))),t),Ln(Ht(e,$s(r),Kn(([u,{offsetTop:d}])=>({...u,top:u.top+d}))),o),{useWindowScroll:s,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},Bi(Ch)),Cg="-webkit-sticky",Q2="sticky",D_=HL(()=>{if(typeof document>"u")return Q2;const e=document.createElement("div");return e.style.position=Cg,e.style.position===Cg?Cg:Q2});function VL(e,t){const n=N.useRef(null),r=N.useCallback(u=>{if(u===null||!u.offsetParent)return;const d=u.getBoundingClientRect(),p=d.width;let h,m;if(t){const v=t.getBoundingClientRect(),b=d.top-v.top;h=v.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}=I_(r),i=N.useCallback(()=>{r(s.current)},[r,s]);return N.useEffect(()=>{if(t){t.addEventListener("scroll",i);const u=new ResizeObserver(i);return u.observe(t),()=>{t.removeEventListener("scroll",i),u.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),o}N.createContext(void 0);const T_=N.createContext(void 0);function UL(e){return e}D_();const GL={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},A_={width:"100%",height:"100%",position:"absolute",top:0};D_();function _i(e,t){if(typeof e!="string")return{context:t}}function qL({usePublisher:e,useEmitter:t,useEmitterValue:n}){return N.memo(function({style:s,children:i,...u}){const d=e("scrollContainerState"),p=n("ScrollerComponent"),h=e("smoothScrollTargetReached"),m=n("scrollerRef"),v=n("context"),{scrollerRef:b,scrollByCallback:S,scrollToCallback:w}=O_(d,h,p,m);return t("scrollTo",w),t("scrollBy",S),N.createElement(p,{ref:b,style:{...GL,...s},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...u,..._i(p,v)},i)})}function KL({usePublisher:e,useEmitter:t,useEmitterValue:n}){return N.memo(function({style:s,children:i,...u}){const d=e("windowScrollContainerState"),p=n("ScrollerComponent"),h=e("smoothScrollTargetReached"),m=n("totalListHeight"),v=n("deviation"),b=n("customScrollParent"),S=n("context"),{scrollerRef:w,scrollByCallback:C,scrollToCallback:_}=O_(d,h,p,xh,b);return EL(()=>(w.current=b||window,()=>{w.current=null}),[w,b]),t("windowScrollTo",_),t("scrollBy",C),N.createElement(p,{style:{position:"relative",...s,...m!==0?{height:m+v}:{}},"data-virtuoso-scroller":!0,...u,..._i(p,S)},i)})}const X2={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},YL={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:J2,ceil:Z2,floor:Zf,min:_g,max:Xc}=Math;function QL(e){return{...YL,items:e}}function ew(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 XL(e,t){return e&&e.column===t.column&&e.row===t.row}function Kd(e,t){return e&&e.width===t.width&&e.height===t.height}const JL=Qs(([{overscan:e,visibleRange:t,listBoundary:n},{scrollTop:r,viewportHeight:o,scrollBy:s,scrollTo:i,smoothScrollTargetReached:u,scrollContainerState:d,footerHeight:p,headerHeight:h},m,v,{propsReady:b,didMount:S},{windowViewportRect:w,useWindowScroll:C,customScrollParent:_,windowScrollContainerState:k,windowScrollTo:j},E])=>{const I=Bt(0),O=Bt(0),R=Bt(X2),T=Bt({height:0,width:0}),A=Bt({height:0,width:0}),z=hr(),$=hr(),ee=Bt(0),B=Bt(null),H=Bt({row:0,column:0}),G=hr(),K=hr(),M=Bt(!1),U=Bt(0),V=Bt(!0),J=Bt(!1);ao(Ht(S,$s(U),Vr(([W,re])=>!!re)),()=>{Ir(V,!1),Ir(O,0)}),ao(Ht(la(S,V,A,T,U,J),Vr(([W,re,pe,ne,,ge])=>W&&!re&&pe.height!==0&&ne.height!==0&&!ge)),([,,,,W])=>{Ir(J,!0),M_(1,()=>{Ir(z,W)}),V2(Ht(r),()=>{Ir(n,[0,0]),Ir(V,!0)})}),Ln(Ht(K,Vr(W=>W!=null&&W.scrollTop>0),Fa(0)),O),ao(Ht(S,$s(K),Vr(([,W])=>W!=null)),([,W])=>{W&&(Ir(T,W.viewport),Ir(A,W==null?void 0:W.item),Ir(H,W.gap),W.scrollTop>0&&(Ir(M,!0),V2(Ht(r,P0(1)),re=>{Ir(M,!1)}),Ir(i,{top:W.scrollTop})))}),Ln(Ht(T,Kn(({height:W})=>W)),o),Ln(Ht(la(fn(T,Kd),fn(A,Kd),fn(H,(W,re)=>W&&W.column===re.column&&W.row===re.row),fn(r)),Kn(([W,re,pe,ne])=>({viewport:W,item:re,gap:pe,scrollTop:ne}))),G),Ln(Ht(la(fn(I),t,fn(H,XL),fn(A,Kd),fn(T,Kd),fn(B),fn(O),fn(M),fn(V),fn(U)),Vr(([,,,,,,,W])=>!W),Kn(([W,[re,pe],ne,ge,ue,Ce,Me,,me,_e])=>{const{row:We,column:Le}=ne,{height:Ue,width:kt}=ge,{width:gt}=ue;if(Me===0&&(W===0||gt===0))return X2;if(kt===0){const En=zL(_e,W),ln=En===0?Math.max(Me-1,0):En;return QL(ew(En,ln,Ce))}const Pn=N_(gt,kt,Le);let Pt,yt;me?re===0&&pe===0&&Me>0?(Pt=0,yt=Me-1):(Pt=Pn*Zf((re+We)/(Ue+We)),yt=Pn*Z2((pe+We)/(Ue+We))-1,yt=_g(W-1,Xc(yt,Pn-1)),Pt=_g(yt,Xc(0,Pt))):(Pt=0,yt=-1);const be=ew(Pt,yt,Ce),{top:Te,bottom:It}=tw(ue,ne,ge,be),Ft=Z2(W/Pn),Cn=Ft*Ue+(Ft-1)*We-It;return{items:be,offsetTop:Te,offsetBottom:Cn,top:Te,bottom:It,itemHeight:Ue,itemWidth:kt}})),R),Ln(Ht(B,Vr(W=>W!==null),Kn(W=>W.length)),I),Ln(Ht(la(T,A,R,H),Vr(([W,re,{items:pe}])=>pe.length>0&&re.height!==0&&W.height!==0),Kn(([W,re,{items:pe},ne])=>{const{top:ge,bottom:ue}=tw(W,ne,re,pe);return[ge,ue]}),go(j0)),n);const ie=Bt(!1);Ln(Ht(r,$s(ie),Kn(([W,re])=>re||W!==0)),ie);const xe=Yc(Ht(fn(R),Vr(({items:W})=>W.length>0),$s(I,ie),Vr(([{items:W},re,pe])=>pe&&W[W.length-1].index===re-1),Kn(([,W])=>W-1),go())),he=Yc(Ht(fn(R),Vr(({items:W})=>W.length>0&&W[0].index===0),Fa(0),go())),ae=Yc(Ht(fn(R),$s(M),Vr(([{items:W},re])=>W.length>0&&!re),Kn(([{items:W}])=>({startIndex:W[0].index,endIndex:W[W.length-1].index})),go(LL),Lc(0)));Ln(ae,v.scrollSeekRangeChanged),Ln(Ht(z,$s(T,A,I,H),Kn(([W,re,pe,ne,ge])=>{const ue=DL(W),{align:Ce,behavior:Me,offset:me}=ue;let _e=ue.index;_e==="LAST"&&(_e=ne-1),_e=Xc(0,_e,_g(ne-1,_e));let We=I0(re,ge,pe,_e);return Ce==="end"?We=J2(We-re.height+pe.height):Ce==="center"&&(We=J2(We-re.height/2+pe.height/2)),me&&(We+=me),{top:We,behavior:Me}})),i);const Z=Rl(Ht(R,Kn(W=>W.offsetBottom+W.bottom)),0);return Ln(Ht(w,Kn(W=>({width:W.visibleWidth,height:W.visibleHeight}))),T),{data:B,totalCount:I,viewportDimensions:T,itemDimensions:A,scrollTop:r,scrollHeight:$,overscan:e,scrollBy:s,scrollTo:i,scrollToIndex:z,smoothScrollTargetReached:u,windowViewportRect:w,windowScrollTo:j,useWindowScroll:C,customScrollParent:_,windowScrollContainerState:k,deviation:ee,scrollContainerState:d,footerHeight:p,headerHeight:h,initialItemCount:O,gap:H,restoreStateFrom:K,...v,initialTopMostItemIndex:U,gridState:R,totalListHeight:Z,...m,startReached:he,endReached:xe,rangeChanged:ae,stateChanged:G,propsReady:b,stateRestoreInProgress:M,...E}},Bi(BL,Ch,R_,FL,$L,WL,j_));function tw(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=I0(e,t,n,r[0].index),i=I0(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:i}}function I0(e,t,n,r){const o=N_(e.width,n.width,t.column),s=Zf(r/o),i=s*n.height+Xc(0,s-1)*t.row;return i>0?i+t.row:i}function N_(e,t,n){return Xc(1,Zf((e+n)/(Zf(t)+n)))}const ZL=Qs(()=>{const e=Bt(p=>`Item ${p}`),t=Bt({}),n=Bt(null),r=Bt("virtuoso-grid-item"),o=Bt("virtuoso-grid-list"),s=Bt(UL),i=Bt("div"),u=Bt(xh),d=(p,h=null)=>Rl(Ht(t,Kn(m=>m[p]),go()),h);return{context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:i,scrollerRef:u,FooterComponent:d("Footer"),HeaderComponent:d("Header"),ListComponent:d("List","div"),ItemComponent:d("Item","div"),ScrollerComponent:d("Scroller","div"),ScrollSeekPlaceholder:d("ScrollSeekPlaceholder","div")}}),eB=Qs(([e,t])=>({...e,...t}),Bi(JL,ZL)),tB=N.memo(function(){const t=tr("gridState"),n=tr("listClassName"),r=tr("itemClassName"),o=tr("itemContent"),s=tr("computeItemKey"),i=tr("isSeeking"),u=ps("scrollHeight"),d=tr("ItemComponent"),p=tr("ListComponent"),h=tr("ScrollSeekPlaceholder"),m=tr("context"),v=ps("itemDimensions"),b=ps("gap"),S=tr("log"),w=tr("stateRestoreInProgress"),C=Sh(_=>{const k=_.parentElement.parentElement.scrollHeight;u(k);const j=_.firstChild;if(j){const{width:E,height:I}=j.getBoundingClientRect();v({width:E,height:I})}b({row:nw("row-gap",getComputedStyle(_).rowGap,S),column:nw("column-gap",getComputedStyle(_).columnGap,S)})});return w?null:N.createElement(p,{ref:C,className:n,..._i(p,m),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map(_=>{const k=s(_.index,_.data,m);return i?N.createElement(h,{key:k,..._i(h,m),index:_.index,height:t.itemHeight,width:t.itemWidth}):N.createElement(d,{..._i(d,m),className:r,"data-index":_.index,key:k},o(_.index,_.data,m))}))}),nB=N.memo(function(){const t=tr("HeaderComponent"),n=ps("headerHeight"),r=tr("headerFooterTag"),o=Sh(i=>n(Yf(i,"height"))),s=tr("context");return t?N.createElement(r,{ref:o},N.createElement(t,_i(t,s))):null}),rB=N.memo(function(){const t=tr("FooterComponent"),n=ps("footerHeight"),r=tr("headerFooterTag"),o=Sh(i=>n(Yf(i,"height"))),s=tr("context");return t?N.createElement(r,{ref:o},N.createElement(t,_i(t,s))):null}),oB=({children:e})=>{const t=N.useContext(T_),n=ps("itemDimensions"),r=ps("viewportDimensions"),o=Sh(s=>{r(s.getBoundingClientRect())});return N.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),N.createElement("div",{style:A_,ref:o},e)},sB=({children:e})=>{const t=N.useContext(T_),n=ps("windowViewportRect"),r=ps("itemDimensions"),o=tr("customScrollParent"),s=VL(n,o);return N.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),N.createElement("div",{ref:s,style:A_},e)},aB=N.memo(function({...t}){const n=tr("useWindowScroll"),r=tr("customScrollParent"),o=r||n?cB:lB,s=r||n?sB:oB;return N.createElement(o,{...t},N.createElement(s,null,N.createElement(nB,null),N.createElement(tB,null),N.createElement(rB,null)))}),{Component:iB,usePublisher:ps,useEmitterValue:tr,useEmitter:$_}=jL(eB,{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"}},aB),lB=qL({usePublisher:ps,useEmitterValue:tr,useEmitter:$_}),cB=KL({usePublisher:ps,useEmitterValue:tr,useEmitter:$_});function nw(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,v1.WARN),t==="normal"?0:parseInt(t??"0",10)}const z_=iB,uB=({image:e})=>{const t=f.useMemo(()=>{var n,r;if(JE((n=e.metadata)==null?void 0:n.model))return(r=e.metadata)==null?void 0:r.model},[e.metadata]);return a.jsxs(F,{sx:{pointerEvents:"none",flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,p:2,alignItems:"flex-start",gap:2},children:[a.jsxs(Xa,{variant:"solid",colorScheme:"base",children:[e.width," × ",e.height]}),t&&a.jsx(Xa,{variant:"solid",colorScheme:"base",children:t})]})},L_=({postUploadAction:e,isDisabled:t})=>{const n=te(),r=f.useCallback(u=>{const d=u[0];d&&n(x4({file:d,image_category:"user",is_intermediate:!1,postUploadAction:e}))},[n,e]),{getRootProps:o,getInputProps:s,open:i}=Vv({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},onDropAccepted:r,disabled:t,noDrag:!0,multiple:!1});return{getUploadButtonProps:o,getUploadInputProps:s,openUploader:i}},dB=e=>{const{data:t,disabled:n,onClick:r}=e,o=f.useRef(Ga()),{attributes:s,listeners:i,setNodeRef:u}=ZE({id:o.current,disabled:n,data:t});return a.jsx(ze,{onClick:r,ref:u,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,...s,...i})},fB=f.memo(dB),pB=()=>{const e=f.useCallback(()=>{},[]),t=f.useCallback(()=>{},[]),n=f.useCallback(()=>{},[]);return a.jsxs(a.Fragment,{children:[a.jsx(jr,{icon:a.jsx(qc,{}),onClickCapture:e,children:"Move Selection to Board"}),a.jsx(jr,{icon:a.jsx(v$,{}),onClickCapture:n,children:"Add Selection to Batch"}),a.jsx(jr,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(bo,{}),onClickCapture:t,children:"Delete Selection"})]})},y1=()=>{const e=te(),t=Ql(),{t:n}=fe(),r=f.useCallback(()=>{t({title:n("toast.parameterSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),o=f.useCallback(()=>{t({title:n("toast.parameterNotSet"),status:"warning",duration:2500,isClosable:!0})},[n,t]),s=f.useCallback(()=>{t({title:n("toast.parametersSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),i=f.useCallback(()=>{t({title:n("toast.parametersNotSet"),status:"warning",duration:2500,isClosable:!0})},[n,t]),u=f.useCallback((I,O)=>{if(_d(I)||kd(O)){_d(I)&&e(Vc(I)),kd(O)&&e(Uc(O)),r();return}o()},[e,r,o]),d=f.useCallback(I=>{if(!_d(I)){o();return}e(Vc(I)),r()},[e,r,o]),p=f.useCallback(I=>{if(!kd(I)){o();return}e(Uc(I)),r()},[e,r,o]),h=f.useCallback(I=>{if(!Vb(I)){o();return}e(_f(I)),r()},[e,r,o]),m=f.useCallback(I=>{if(!Ub(I)){o();return}e(kf(I)),r()},[e,r,o]),v=f.useCallback(I=>{if(!Gb(I)){o();return}e(Gg(I)),r()},[e,r,o]),b=f.useCallback(I=>{if(!qb(I)){o();return}e(qg(I)),r()},[e,r,o]),S=f.useCallback(I=>{if(!Kb(I)){o();return}e(Pf(I)),r()},[e,r,o]),w=f.useCallback(I=>{if(!Yb(I)){o();return}e(Tl(I)),r()},[e,r,o]),C=f.useCallback(I=>{if(!Qb(I)){o();return}e(Al(I)),r()},[e,r,o]),_=f.useCallback(I=>{if(!Xb(I)){o();return}e(jf(I)),r()},[e,r,o]),k=f.useCallback(async I=>{if(!e8(I)){o();return}e(If(I.image_name)),r()},[e,r,o]),j=f.useCallback(I=>{e(If(I))},[e]),E=f.useCallback(I=>{if(!I){i();return}const{cfg_scale:O,height:R,model:T,positive_prompt:A,negative_prompt:z,scheduler:$,seed:ee,steps:B,width:H,strength:G}=I;Ub(O)&&e(kf(O)),Gb(T)&&e(Gg(T)),_d(A)&&e(Vc(A)),kd(z)&&e(Uc(z)),qb($)&&e(qg($)),Vb(ee)&&e(_f(ee)),Kb(B)&&e(Pf(B)),Yb(H)&&e(Tl(H)),Qb(R)&&e(Al(R)),Xb(G)&&e(jf(G)),s()},[i,s,e]);return{recallBothPrompts:u,recallPositivePrompt:d,recallNegativePrompt:p,recallSeed:h,recallInitialImage:k,recallCfgScale:m,recallModel:v,recallScheduler:b,recallSteps:S,recallWidth:w,recallHeight:C,recallStrength:_,recallAllParameters:E,sendToImageToImage:j}},b1=()=>{const e=Ql(),{t}=fe(),n=f.useMemo(()=>!!navigator.clipboard&&!!window.ClipboardItem,[]),r=f.useCallback(async o=>{n||e({title:t("toast.problemCopyingImage"),description:"Your browser doesn't support the Clipboard API.",status:"error",duration:2500,isClosable:!0});try{const i=await(await fetch(o)).blob();await navigator.clipboard.write([new ClipboardItem({[i.type]:i})]),e({title:t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})}catch(s){e({title:t("toast.problemCopyingImage"),description:String(s),status:"error",duration:2500,isClosable:!0})}},[n,t,e]);return{isClipboardAPIAvailable:n,copyImageToClipboard:r}},hB=e=>{const{imageDTO:t}=e,n=f.useMemo(()=>ve([Mt],({gallery:B})=>({isInBatch:B.batchImageNames.includes(t.image_name)}),it),[t.image_name]),{isInBatch:r}=L(n),o=te(),{t:s}=fe(),i=Ql(),u=xr("unifiedCanvas").isFeatureEnabled,d=xr("batches").isFeatureEnabled,{onClickAddToBoard:p}=f.useContext(_4),{currentData:h}=cv(t.image_name),{isClipboardAPIAvailable:m,copyImageToClipboard:v}=b1(),b=h==null?void 0:h.metadata,S=f.useCallback(()=>{t&&o(uv(t))},[o,t]),{recallBothPrompts:w,recallSeed:C,recallAllParameters:_}=y1(),[k]=t8(),j=f.useCallback(()=>{w(b==null?void 0:b.positive_prompt,b==null?void 0:b.negative_prompt)},[b==null?void 0:b.negative_prompt,b==null?void 0:b.positive_prompt,w]),E=f.useCallback(()=>{C(b==null?void 0:b.seed)},[b==null?void 0:b.seed,C]),I=f.useCallback(()=>{o(k4()),o(If(t))},[o,t]),O=f.useCallback(()=>{o(n8()),o(r8(t)),o(Kp()),o(gl("unifiedCanvas")),i({title:s("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},[o,t,s,i]),R=f.useCallback(()=>{console.log(b),_(b)},[b,_]),T=f.useCallback(()=>{p(t)},[t,p]),A=f.useCallback(()=>{t.board_id&&k({board_id:t.board_id,image_name:t.image_name})},[t.board_id,t.image_name,k]),z=f.useCallback(()=>{window.open(t.image_url,"_blank")},[t.image_url]),$=f.useCallback(()=>{o(o8([t.image_name]))},[o,t.image_name]),ee=f.useCallback(()=>{v(t.image_url)},[v,t.image_url]);return a.jsxs(a.Fragment,{children:[a.jsx(Ka,{href:t.image_url,target:"_blank",children:a.jsx(jr,{icon:a.jsx(h$,{}),onClickCapture:z,children:s("common.openInNewTab")})}),m&&a.jsx(jr,{icon:a.jsx(rc,{}),onClickCapture:ee,children:s("parameters.copyImage")}),a.jsx(jr,{icon:a.jsx(F5,{}),onClickCapture:j,isDisabled:(b==null?void 0:b.positive_prompt)===void 0&&(b==null?void 0:b.negative_prompt)===void 0,children:s("parameters.usePrompt")}),a.jsx(jr,{icon:a.jsx(H5,{}),onClickCapture:E,isDisabled:(b==null?void 0:b.seed)===void 0,children:s("parameters.useSeed")}),a.jsx(jr,{icon:a.jsx(D5,{}),onClickCapture:R,isDisabled:!b,children:s("parameters.useAll")}),a.jsx(jr,{icon:a.jsx(m2,{}),onClickCapture:I,id:"send-to-img2img",children:s("parameters.sendToImg2Img")}),u&&a.jsx(jr,{icon:a.jsx(m2,{}),onClickCapture:O,id:"send-to-canvas",children:s("parameters.sendToUnifiedCanvas")}),d&&a.jsx(jr,{icon:a.jsx(qc,{}),isDisabled:r,onClickCapture:$,children:"Add to Batch"}),a.jsx(jr,{icon:a.jsx(qc,{}),onClickCapture:T,children:t.board_id?"Change Board":"Add to Board"}),t.board_id&&a.jsx(jr,{icon:a.jsx(qc,{}),onClickCapture:A,children:"Remove from Board"}),a.jsx(Ka,{download:!0,href:t.image_url,target:"_blank",children:a.jsx(jr,{icon:a.jsx(Gv,{}),w:"100%",children:s("parameters.downloadImage")})}),a.jsx(jr,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(bo,{}),onClickCapture:S,children:s("gallery.deleteImage")})]})},B_=f.memo(hB),mB=({imageDTO:e,children:t})=>{const n=f.useMemo(()=>ve([Mt],({gallery:s})=>({selectionCount:s.selection.length}),it),[]),{selectionCount:r}=L(n),o=f.useCallback(s=>{s.preventDefault()},[]);return a.jsx(x_,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>e?a.jsx(tc,{sx:{visibility:"visible !important"},motionProps:_3,onContextMenu:o,children:r===1?a.jsx(B_,{imageDTO:e}):a.jsx(pB,{})}):null,children:t})},x1=f.memo(mB),gB=e=>{const{imageDTO:t,onClickReset:n,onError:r,onClick:o,withResetIcon:s=!1,withMetadataOverlay:i=!1,isDropDisabled:u=!1,isDragDisabled:d=!1,isUploadDisabled:p=!1,minSize:h=24,postUploadAction:m,imageSx:v,fitContainer:b=!1,droppableData:S,draggableData:w,dropLabel:C,isSelected:_=!1,thumbnail:k=!1,resetTooltip:j="Reset",resetIcon:E=a.jsx(Yv,{}),noContentFallback:I=a.jsx(Li,{icon:oc})}=e,{colorMode:O}=Do(),{getUploadButtonProps:R,getUploadInputProps:T}=L_({postUploadAction:m,isDisabled:p}),A=ff("drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-600))","drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-800))"),z=p?{}:{cursor:"pointer",bg:ke("base.200","base.800")(O),_hover:{bg:ke("base.300","base.650")(O),color:ke("base.500","base.300")(O)}};return a.jsx(x1,{imageDTO:t,children:$=>a.jsxs(F,{ref:$,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative",minW:h||void 0,minH:h||void 0,userSelect:"none",cursor:d||!t?"default":"pointer"},children:[t&&a.jsxs(F,{sx:{w:"full",h:"full",position:b?"absolute":"relative",alignItems:"center",justifyContent:"center"},children:[a.jsx(bu,{src:k?t.thumbnail_url:t.image_url,fallbackStrategy:"beforeLoadOrError",fallbackSrc:t.thumbnail_url,width:t.width,height:t.height,onError:r,draggable:!1,sx:{objectFit:"contain",maxW:"full",maxH:"full",borderRadius:"base",shadow:_?"selected.light":void 0,_dark:{shadow:_?"selected.dark":void 0},...v}}),i&&a.jsx(uB,{image:t})]}),!t&&!p&&a.jsx(a.Fragment,{children:a.jsxs(F,{sx:{minH:h,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",transitionProperty:"common",transitionDuration:"0.1s",color:ke("base.500","base.500")(O),...z},...R(),children:[a.jsx("input",{...T()}),a.jsx(mo,{as:Au,sx:{boxSize:16}})]})}),!t&&p&&I,!u&&a.jsx(h1,{data:S,disabled:u,dropLabel:C}),t&&!d&&a.jsx(fB,{data:w,disabled:d||!t,onClick:o}),n&&s&&t&&a.jsx(je,{onClick:n,"aria-label":j,tooltip:j,icon:E,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:A}}})]})})},Ja=f.memo(gB),vB=()=>a.jsx(ze,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:a.jsx(F,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",bg:"base.100",color:"base.500",_dark:{color:"base.700",bg:"base.850"}},children:a.jsx(mo,{as:d$,boxSize:16,opacity:.7})})}),yB=()=>a.jsx(n5,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:a.jsx(ze,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full"}})}),bB=e=>ve([Mt],t=>({selectionCount:t.gallery.selection.length,selection:t.gallery.selection,isSelected:t.gallery.selection.includes(e)}),it),xB=e=>{const t=te(),{imageName:n}=e,{currentData:r,isLoading:o,isError:s,isSuccess:i}=gs(n),u=f.useMemo(()=>bB(n),[n]),{isSelected:d,selectionCount:p,selection:h}=L(u),m=f.useCallback(()=>{t(s8([n]))},[t,n]),v=f.useCallback(S=>{S.shiftKey?t(a8(n)):S.ctrlKey||S.metaKey?t(i8(n)):t(Ef(n))},[t,n]),b=f.useMemo(()=>{if(p>1)return{id:"batch",payloadType:"IMAGE_NAMES",payload:{image_names:h}};if(r)return{id:"batch",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r,h,p]);return o?a.jsx(yB,{}):s||!r?a.jsx(vB,{}):a.jsx(ze,{sx:{w:"full",h:"full",touchAction:"none"},children:a.jsx(x1,{imageDTO:r,children:S=>a.jsx(ze,{position:"relative",userSelect:"none",ref:S,sx:{display:"flex",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:a.jsx(Ja,{onClick:v,imageDTO:r,draggableData:b,isSelected:d,minSize:0,onClickReset:m,isDropDisabled:!0,imageSx:{w:"full",h:"full"},isUploadDisabled:!0,resetTooltip:"Remove from batch",withResetIcon:!0,thumbnail:!0})},n)})})},wB=f.memo(xB),F_=tt((e,t)=>a.jsx(ze,{className:"item-container",ref:t,p:1.5,children:e.children})),H_=tt((e,t)=>{const n=L(r=>r.gallery.galleryImageMinimumWidth);return a.jsx(Ei,{...e,className:"list-container",ref:t,sx:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr));`},children:e.children})}),SB=ve([Mt],e=>({imageNames:e.gallery.batchImageNames}),it),CB=()=>{const{t:e}=fe(),t=f.useRef(null),[n,r]=f.useState(null),[o,s]=p1({defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"leave",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}}),{imageNames:i}=L(SB);return f.useEffect(()=>{const{current:u}=t;return n&&u&&o({target:u,elements:{viewport:n}}),()=>{var d;return(d=s())==null?void 0:d.destroy()}},[n,o,s]),i.length?a.jsx(ze,{ref:t,"data-overlayscrollbars":"",h:"100%",children:a.jsx(z_,{style:{height:"100%"},data:i,components:{Item:F_,List:H_},scrollerRef:r,itemContent:(u,d)=>a.jsx(wB,{imageName:d},d)})}):a.jsx(Li,{label:e("gallery.noImagesInGallery"),icon:oc})},_B=f.memo(CB),kB=e=>ve([Mt],({gallery:t})=>({isSelected:t.selection.includes(e),selectionCount:t.selection.length,selection:t.selection}),it),PB=e=>{const t=te(),{imageName:n}=e,{currentData:r}=gs(n),o=f.useMemo(()=>kB(n),[n]),{isSelected:s,selectionCount:i,selection:u}=L(o),d=f.useCallback(m=>{t(Ef(n))},[t,n]),p=f.useCallback(m=>{m.stopPropagation(),r&&t(uv(r))},[t,r]),h=f.useMemo(()=>{if(i>1)return{id:"gallery-image",payloadType:"IMAGE_NAMES",payload:{image_names:u}};if(r)return{id:"gallery-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r,u,i]);return r?a.jsx(ze,{sx:{w:"full",h:"full",touchAction:"none"},children:a.jsx(x1,{imageDTO:r,children:m=>a.jsx(ze,{position:"relative",userSelect:"none",ref:m,sx:{display:"flex",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:a.jsx(Ja,{onClick:d,imageDTO:r,draggableData:h,isSelected:s,minSize:0,onClickReset:p,imageSx:{w:"full",h:"full"},isDropDisabled:!0,isUploadDisabled:!0,thumbnail:!0})},n)})}):a.jsx(Jl,{})},jB=f.memo(PB),IB=ve([Mt,P4],(e,t)=>{const{galleryImageMinimumWidth:n,selectedBoardId:r,galleryView:o,total:s,isLoading:i}=e.gallery;return{imageNames:t.map(u=>u.image_name),total:s,selectedBoardId:r,galleryView:o,galleryImageMinimumWidth:n,isLoading:i}},it),EB=()=>{const{t:e}=fe(),t=f.useRef(null),n=f.useRef(null),[r,o]=f.useState(null),[s,i]=p1({defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"leave",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}});f.useState(!1);const u=te(),{galleryImageMinimumWidth:d,imageNames:p,total:h,selectedBoardId:m,galleryView:v,isLoading:b}=L(IB),{data:S,isLoading:w}=l8({board_id:m},{skip:m==="all"}),C=f.useMemo(()=>{if(m==="all")return p;{const E=v==="images"?Jb:Zb;return((S==null?void 0:S.items)||[]).filter(O=>E.includes(O.image_category)).map(O=>O.image_name)}},[m,v,S,p]),_=f.useMemo(()=>m==="all"?h>p.length:!1,[m,p.length,h]),k=f.useMemo(()=>m==="all"?b:w,[m,b,w]),j=f.useCallback(()=>{u(j4({categories:v==="images"?Jb:Zb,is_intermediate:!1,offset:C.length,limit:c8}))},[u,C.length,v]);if(f.useEffect(()=>{const{current:E}=t;return r&&E&&s({target:E,elements:{viewport:r}}),()=>{var I;return(I=i())==null?void 0:I.destroy()}},[r,s,i]),f.useMemo(()=>{if(_)return j},[_,j]),!k&&C.length===0)return a.jsx(ze,{ref:n,sx:{w:"full",h:"full"},children:a.jsx(Li,{label:e("gallery.noImagesInGallery"),icon:oc})});if(status!=="rejected")return a.jsxs(a.Fragment,{children:[a.jsx(ze,{ref:t,"data-overlayscrollbars":"",h:"100%",children:a.jsx(z_,{style:{height:"100%"},data:C,components:{Item:F_,List:H_},scrollerRef:o,itemContent:(E,I)=>a.jsx(jB,{imageName:I},I)})}),a.jsx(Zt,{onClick:j,isDisabled:!_,isLoading:status==="pending",loadingText:"Loading",flexShrink:0,children:e(_?"gallery.loadMore":"gallery.allImagesLoaded")})]})},OB=f.memo(EB),RB=ve([Mt],e=>{const{selectedBoardId:t,galleryImageMinimumWidth:n,galleryView:r,shouldAutoSwitch:o}=e.gallery,{shouldPinGallery:s}=e.ui;return{selectedBoardId:t,shouldPinGallery:s,galleryImageMinimumWidth:n,shouldAutoSwitch:o,galleryView:r}},it),MB=()=>{const e=te(),{t}=fe(),n=f.useRef(null),r=f.useRef(null),{colorMode:o}=Do(),{selectedBoardId:s,shouldPinGallery:i,galleryImageMinimumWidth:u,shouldAutoSwitch:d,galleryView:p}=L(RB),{selectedBoard:h}=lv(void 0,{selectFromResult:({data:k})=>({selectedBoard:k==null?void 0:k.find(j=>j.board_id===s)})}),m=f.useMemo(()=>s==="batch"?"Batch":h?h.board_name:"All Images",[h,s]),{isOpen:v,onToggle:b}=Ws(),S=k=>{e(Of(k))},w=()=>{e(I4()),e(vo())},C=f.useCallback(()=>{e(ex("images"))},[e]),_=f.useCallback(()=>{e(ex("assets"))},[e]);return a.jsxs(E6,{sx:{flexDirection:"column",h:"full",w:"full",borderRadius:"base"},children:[a.jsxs(ze,{sx:{w:"full"},children:[a.jsxs(F,{ref:n,sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[a.jsxs(Yn,{isAttached:!0,children:[a.jsx(je,{tooltip:t("gallery.images"),"aria-label":t("gallery.images"),onClick:C,isChecked:p==="images",size:"sm",icon:a.jsx(oc,{})}),a.jsx(je,{tooltip:t("gallery.assets"),"aria-label":t("gallery.assets"),onClick:_,isChecked:p==="assets",size:"sm",icon:a.jsx(R$,{})})]}),a.jsxs(F,{as:Sf,onClick:b,size:"sm",variant:"ghost",sx:{w:"full",justifyContent:"center",alignItems:"center",px:2,_hover:{bg:ke("base.100","base.800")(o)}},children:[a.jsx(nt,{noOfLines:1,sx:{w:"full",color:ke("base.800","base.200")(o),fontWeight:600},children:m}),a.jsx(Xv,{sx:{transform:v?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]}),a.jsx(zi,{triggerComponent:a.jsx(je,{tooltip:t("gallery.gallerySettings"),"aria-label":t("gallery.gallerySettings"),size:"sm",icon:a.jsx(Qv,{})}),children:a.jsxs(F,{direction:"column",gap:2,children:[a.jsx(St,{value:u,onChange:S,min:32,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:()=>e(Of(64))}),a.jsx(Bn,{label:t("gallery.autoSwitchNewImages"),isChecked:d,onChange:k=>e(u8(k.target.checked))})]})}),a.jsx(je,{size:"sm","aria-label":t("gallery.pinGallery"),tooltip:`${t("gallery.pinGallery")} (Shift+G)`,onClick:w,icon:i?a.jsx(O5,{}):a.jsx(R5,{})})]}),a.jsx(ze,{children:a.jsx(vL,{isOpen:v})})]}),a.jsx(F,{ref:r,direction:"column",gap:2,h:"full",w:"full",children:s==="batch"?a.jsx(_B,{}):a.jsx(OB,{})})]})},W_=f.memo(MB),DB=ve([ur,Jr,d8,Xn],(e,t,n,r)=>{const{shouldPinGallery:o,shouldShowGallery:s}=t,{galleryImageMinimumWidth:i}=n;return{activeTabName:e,isStaging:r,shouldPinGallery:o,shouldShowGallery:s,galleryImageMinimumWidth:i,isResizable:e!=="unifiedCanvas"}},{memoizeOptions:{resultEqualityCheck:Qt}}),TB=()=>{const e=te(),{shouldPinGallery:t,shouldShowGallery:n,galleryImageMinimumWidth:r}=L(DB),o=()=>{e(Kg(!1)),t&&e(vo())};Ke("esc",()=>{e(Kg(!1))},{enabled:()=>!t,preventDefault:!0},[t]);const s=32;return Ke("shift+up",()=>{if(r<256){const i=Vs(r+s,32,256);e(Of(i))}},[r]),Ke("shift+down",()=>{if(r>32){const i=Vs(r-s,32,256);e(Of(i))}},[r]),t?null:a.jsx(E5,{direction:"right",isResizable:!0,isOpen:n,onClose:o,minWidth:337,children:a.jsx(W_,{})})},AB=f.memo(TB),NB=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,tooltip:i,...u}=e;return a.jsx(_n,{label:i,hasArrow:!0,placement:"top",isDisabled:!i,children:a.jsxs(Ss,{isDisabled:n,width:r,display:"flex",alignItems:"center",...o,children:[t&&a.jsx(vs,{my:1,flexGrow:1,sx:{cursor:n?"not-allowed":"pointer",...s==null?void 0:s.sx,pe:4},...s,children:t}),a.jsx(Hv,{...u})]})})},jn=f.memo(NB),$B=e=>{const{imageUsage:t}=e;return!t||!E4(t)?null:a.jsxs(a.Fragment,{children:[a.jsx(nt,{children:"This image is currently in use in the following features:"}),a.jsxs(th,{sx:{paddingInlineStart:6},children:[t.isInitialImage&&a.jsx(Eo,{children:"Image to Image"}),t.isCanvasImage&&a.jsx(Eo,{children:"Unified Canvas"}),t.isControlNetImage&&a.jsx(Eo,{children:"ControlNet"}),t.isNodesImage&&a.jsx(Eo,{children:"Node Editor"})]}),a.jsx(nt,{children:"If you delete this image, those features will immediately be reset."})]})},zB=f.memo($B),LB=ve([Mt,f8],({system:e,config:t,imageDeletion:n},r)=>{const{shouldConfirmOnDelete:o}=e,{canRestoreDeletedImagesFromBin:s}=t,{imageToDelete:i,isModalOpen:u}=n;return{shouldConfirmOnDelete:o,canRestoreDeletedImagesFromBin:s,imageToDelete:i,imageUsage:r,isModalOpen:u}},it),BB=()=>{const e=te(),{t}=fe(),{shouldConfirmOnDelete:n,canRestoreDeletedImagesFromBin:r,imageToDelete:o,imageUsage:s,isModalOpen:i}=L(LB),u=f.useCallback(m=>e(O4(!m.target.checked)),[e]),d=f.useCallback(()=>{e(tx()),e(p8(!1))},[e]),p=f.useCallback(()=>{!o||!s||(e(tx()),e(h8({imageDTO:o,imageUsage:s})))},[e,o,s]),h=f.useRef(null);return a.jsx(Ou,{isOpen:i,onClose:d,leastDestructiveRef:h,isCentered:!0,children:a.jsx(va,{children:a.jsxs(Ru,{children:[a.jsx(ga,{fontSize:"lg",fontWeight:"bold",children:t("gallery.deleteImage")}),a.jsx(ya,{children:a.jsxs(F,{direction:"column",gap:3,children:[a.jsx(zB,{imageUsage:s}),a.jsx(ni,{}),a.jsx(nt,{children:t(r?"gallery.deleteImageBin":"gallery.deleteImagePermanent")}),a.jsx(nt,{children:t("common.areYouSure")}),a.jsx(jn,{label:t("common.dontAskMeAgain"),isChecked:!n,onChange:u})]})}),a.jsxs(ma,{children:[a.jsx(Zt,{ref:h,onClick:d,children:"Cancel"}),a.jsx(Zt,{colorScheme:"error",onClick:p,ml:3,children:"Delete"})]})]})})})},FB=f.memo(BB);function rw(e){for(var t=[],n=1;n{const{isConnected:t,isProcessing:n,statusTranslationKey:r,currentIteration:o,totalIterations:s,currentStatusHasSteps:i}=e;return{isConnected:t,isProcessing:n,currentIteration:o,totalIterations:s,statusTranslationKey:r,currentStatusHasSteps:i}},it),sw={ok:"green.400",working:"yellow.400",error:"red.400"},aw={ok:"green.600",working:"yellow.500",error:"red.500"},qB=()=>{const{isConnected:e,isProcessing:t,currentIteration:n,totalIterations:r,statusTranslationKey:o}=L(GB),{t:s}=fe(),i=f.useRef(null),u=f.useMemo(()=>t?"working":e?"ok":"error",[t,e]),d=f.useMemo(()=>{if(n&&r)return` (${n}/${r})`},[n,r]),p=V_(i);return a.jsxs(F,{ref:i,h:"full",px:2,alignItems:"center",gap:5,children:[a.jsx(ws,{children:p&&a.jsx(io.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsxs(nt,{sx:{fontSize:"sm",fontWeight:"600",pb:"1px",userSelect:"none",color:aw[u],_dark:{color:sw[u]}},children:[s(o),d]})},"statusText")}),a.jsx(mo,{as:l$,sx:{boxSize:"0.5rem",color:aw[u],_dark:{color:sw[u]}}})]})};function KB(e){return Ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M16.5 9c-.42 0-.83.04-1.24.11L1.01 3 1 10l9 2-9 2 .01 7 8.07-3.46C9.59 21.19 12.71 24 16.5 24c4.14 0 7.5-3.36 7.5-7.5S20.64 9 16.5 9zm0 13c-3.03 0-5.5-2.47-5.5-5.5s2.47-5.5 5.5-5.5 5.5 2.47 5.5 5.5-2.47 5.5-5.5 5.5z"}},{tag:"path",attr:{d:"M18.27 14.03l-1.77 1.76-1.77-1.76-.7.7 1.76 1.77-1.76 1.77.7.7 1.77-1.76 1.77 1.76.7-.7-1.76-1.77 1.76-1.77z"}}]})(e)}function YB(e){return Ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 00.12-.61l-1.92-3.32a.488.488 0 00-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 00-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 00-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}}]})(e)}function QB(e){return Ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M17 16l-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5h-4z"}}]})(e)}function XB(e){return Ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"}}]})(e)}function JB(e){return Ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}}]})(e)}function ZB(e){return Ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}}]})(e)}function U_(e){return Ve({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)}const eF=()=>{const{colorMode:e,toggleColorMode:t}=Do(),{t:n}=fe();return a.jsx(je,{"aria-label":n(e==="dark"?"common.lightMode":"common.darkMode"),tooltip:n(e==="dark"?"common.lightMode":"common.darkMode"),size:"sm",icon:e==="dark"?a.jsx(D$,{fontSize:19}):a.jsx(j$,{fontSize:18}),onClick:t,variant:"link"})};function tF(e){const{title:t,hotkey:n,description:r}=e;return a.jsxs(Ei,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs(Ei,{children:[a.jsx(nt,{fontWeight:600,children:t}),r&&a.jsx(nt,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),a.jsx(ze,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function nF({children:e}){const{isOpen:t,onOpen:n,onClose:r}=Ws(),{t:o}=fe(),s=[{title:o("hotkeys.invoke.title"),desc:o("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:o("hotkeys.cancel.title"),desc:o("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:o("hotkeys.focusPrompt.title"),desc:o("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:o("hotkeys.toggleOptions.title"),desc:o("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:o("hotkeys.pinOptions.title"),desc:o("hotkeys.pinOptions.desc"),hotkey:"Shift+O"},{title:o("hotkeys.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"}],u=[{title:o("hotkeys.previousImage.title"),desc:o("hotkeys.previousImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextImage.title"),desc:o("hotkeys.nextImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.toggleGalleryPin.title"),desc:o("hotkeys.toggleGalleryPin.desc"),hotkey:"Shift+G"},{title:o("hotkeys.increaseGalleryThumbSize.title"),desc:o("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys.decreaseGalleryThumbSize.title"),desc:o("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],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=h=>a.jsx(F,{flexDir:"column",gap:4,children:h.map((m,v)=>a.jsxs(F,{flexDir:"column",px:2,gap:4,children:[a.jsx(tF,{title:m.title,description:m.desc,hotkey:m.hotkey}),v{const{data:t}=m8(),n=f.useRef(null),r=V_(n);return a.jsxs(F,{alignItems:"center",gap:3,ps:1,ref:n,children:[a.jsx(bu,{src:g8,alt:"invoke-ai-logo",sx:{w:"32px",h:"32px",minW:"32px",minH:"32px",userSelect:"none"}}),a.jsxs(F,{sx:{gap:3,alignItems:"center"},children:[a.jsxs(nt,{sx:{fontSize:"xl",userSelect:"none"},children:["invoke ",a.jsx("strong",{children:"ai"})]}),a.jsx(ws,{children:e&&r&&t&&a.jsx(io.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(nt,{sx:{fontWeight:600,marginTop:1,color:"base.300",fontSize:14},variant:"subtext",children:t.version})},"statusText")})]})]})};function rF(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M245.09 327.74v-37.32c57.07 0 84.51 13.47 108.58 38.68 5.4 5.65 15 1.32 14.29-6.43-5.45-61.45-34.14-117.09-122.87-117.09v-37.32a8.32 8.32 0 00-14.05-6L146.58 242a8.2 8.2 0 000 11.94L231 333.71a8.32 8.32 0 0014.09-5.97z"}},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M256 64C150 64 64 150 64 256s86 192 192 192 192-86 192-192S362 64 256 64z"}}]})(e)}function oF(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M478.33 433.6l-90-218a22 22 0 00-40.67 0l-90 218a22 22 0 1040.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 00458 464a22 22 0 0020.32-30.4zM334.83 362L368 281.65 401.17 362zm-66.99-19.08a22 22 0 00-4.89-30.7c-.2-.15-15-11.13-36.49-34.73 39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 000-44H214V70a22 22 0 00-44 0v20H54a22 22 0 000 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 00-40.58 17c.58 1.38 14.55 34.23 52.86 83.93.92 1.19 1.83 2.35 2.74 3.51-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1021.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59 22.52 24.08 38 35.44 38.93 36.1a22 22 0 0030.75-4.9z"}}]})(e)}const sF={ar:yr.t("common.langArabic",{lng:"ar"}),nl:yr.t("common.langDutch",{lng:"nl"}),en:yr.t("common.langEnglish",{lng:"en"}),fr:yr.t("common.langFrench",{lng:"fr"}),de:yr.t("common.langGerman",{lng:"de"}),he:yr.t("common.langHebrew",{lng:"he"}),it:yr.t("common.langItalian",{lng:"it"}),ja:yr.t("common.langJapanese",{lng:"ja"}),ko:yr.t("common.langKorean",{lng:"ko"}),pl:yr.t("common.langPolish",{lng:"pl"}),pt_BR:yr.t("common.langBrPortuguese",{lng:"pt_BR"}),pt:yr.t("common.langPortuguese",{lng:"pt"}),ru:yr.t("common.langRussian",{lng:"ru"}),zh_CN:yr.t("common.langSimplifiedChinese",{lng:"zh_CN"}),es:yr.t("common.langSpanish",{lng:"es"}),uk:yr.t("common.langUkranian",{lng:"ua"})};function aF(){const{t:e}=fe(),t=te(),n=L(R4);return a.jsxs(Iu,{closeOnSelect:!1,children:[a.jsx(_n,{label:e("common.languagePickerLabel"),hasArrow:!0,children:a.jsx(Eu,{as:qa,icon:a.jsx(oF,{}),variant:"link","aria-label":e("common.languagePickerLabel"),fontSize:22,minWidth:8})}),a.jsx(tc,{children:a.jsx(Nv,{value:n,children:Cs(sF,(r,o)=>a.jsx(ru,{value:o,onClick:()=>t(v8(o)),children:r},o))})})]})}function iF(e){const t=f.createContext(null);return[({children:o,value:s})=>N.createElement(t.Provider,{value:s},o),()=>{const o=f.useContext(t);if(o===null)throw new Error(e);return o}]}function q_(e){return Array.isArray(e)?e:[e]}const lF=()=>{};function cF(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||lF:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function K_({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 Y_(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==N.Fragment:!1}function Q_(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 fF=y8({key:"mantine",prepend:!0});function pF(){return k3()||fF}var hF=Object.defineProperty,iw=Object.getOwnPropertySymbols,mF=Object.prototype.hasOwnProperty,gF=Object.prototype.propertyIsEnumerable,lw=(e,t,n)=>t in e?hF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vF=(e,t)=>{for(var n in t||(t={}))mF.call(t,n)&&lw(e,n,t[n]);if(iw)for(var n of iw(t))gF.call(t,n)&&lw(e,n,t[n]);return e};const kg="ref";function yF(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(!(kg in n))return{args:e,ref:t};t=n[kg];const r=vF({},n);return delete r[kg],{args:[r],ref:t}}const{cssFactory:bF}=(()=>{function e(n,r,o){const s=[],i=w8(n,s,o);return s.length<2?o:i+r(s)}function t(n){const{cache:r}=n,o=(...i)=>{const{ref:u,args:d}=yF(i),p=b8(d,r.registered);return x8(r,p,!1),`${r.key}-${p.name}${u===void 0?"":` ${u}`}`};return{css:o,cx:(...i)=>e(r.registered,o,X_(i))}}return{cssFactory:t}})();function J_(){const e=pF();return dF(()=>bF({cache:e}),[e])}function xF({cx:e,classes:t,context:n,classNames:r,name:o,cache:s}){const i=n.reduce((u,d)=>(Object.keys(d.classNames).forEach(p=>{typeof u[p]!="string"?u[p]=`${d.classNames[p]}`:u[p]=`${u[p]} ${d.classNames[p]}`}),u),{});return Object.keys(t).reduce((u,d)=>(u[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),u),{})}var wF=Object.defineProperty,cw=Object.getOwnPropertySymbols,SF=Object.prototype.hasOwnProperty,CF=Object.prototype.propertyIsEnumerable,uw=(e,t,n)=>t in e?wF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pg=(e,t)=>{for(var n in t||(t={}))SF.call(t,n)&&uw(e,n,t[n]);if(cw)for(var n of cw(t))CF.call(t,n)&&uw(e,n,t[n]);return e};function E0(e,t){return t&&Object.keys(t).forEach(n=>{e[n]?e[n]=Pg(Pg({},e[n]),t[n]):e[n]=Pg({},t[n])}),e}function dw(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)=>E0(s,i),{}):o(e)}function _F({ctx:e,theme:t,params:n,variant:r,size:o}){return e.reduce((s,i)=>(i.variants&&r in i.variants&&E0(s,i.variants[r](t,n,{variant:r,size:o})),i.sizes&&o in i.sizes&&E0(s,i.sizes[o](t,n,{variant:r,size:o})),s),{})}function Zr(e){const t=typeof e=="function"?e:()=>e;function n(r,o){const s=Ca(),i=UO(o==null?void 0:o.name),u=k3(),d={variant:o==null?void 0:o.variant,size:o==null?void 0:o.size},{css:p,cx:h}=J_(),m=t(s,r,d),v=dw(o==null?void 0:o.styles,s,r,d),b=dw(i,s,r,d),S=_F({ctx:i,theme:s,params:r,variant:o==null?void 0:o.variant,size:o==null?void 0:o.size}),w=Object.fromEntries(Object.keys(m).map(C=>{const _=h({[p(m[C])]:!(o!=null&&o.unstyled)},p(S[C]),p(b[C]),p(v[C]));return[C,_]}));return{classes:xF({cx:h,classes:w,context:i,classNames:o==null?void 0:o.classNames,name:o==null?void 0:o.name,cache:u}),cx:h,theme:s}}return n}function fw(e){return`___ref-${e||""}`}var kF=Object.defineProperty,PF=Object.defineProperties,jF=Object.getOwnPropertyDescriptors,pw=Object.getOwnPropertySymbols,IF=Object.prototype.hasOwnProperty,EF=Object.prototype.propertyIsEnumerable,hw=(e,t,n)=>t in e?kF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ic=(e,t)=>{for(var n in t||(t={}))IF.call(t,n)&&hw(e,n,t[n]);if(pw)for(var n of pw(t))EF.call(t,n)&&hw(e,n,t[n]);return e},Ec=(e,t)=>PF(e,jF(t));const Oc={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${$e(10)})`},transitionProperty:"transform, opacity"},Yd={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(-${$e(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(${$e(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(${$e(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${$e(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:Ec(Ic({},Oc),{common:{transformOrigin:"center center"}}),"pop-bottom-left":Ec(Ic({},Oc),{common:{transformOrigin:"bottom left"}}),"pop-bottom-right":Ec(Ic({},Oc),{common:{transformOrigin:"bottom right"}}),"pop-top-left":Ec(Ic({},Oc),{common:{transformOrigin:"top left"}}),"pop-top-right":Ec(Ic({},Oc),{common:{transformOrigin:"top right"}})},mw=["mousedown","touchstart"];function OF(e,t,n){const r=f.useRef();return f.useEffect(()=>{const o=s=>{const{target:i}=s??{};if(Array.isArray(n)){const u=(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))&&!u&&e()}else r.current&&!r.current.contains(i)&&e()};return(t||mw).forEach(s=>document.addEventListener(s,o)),()=>{(t||mw).forEach(s=>document.removeEventListener(s,o))}},[r,e,n]),r}function RF(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function MF(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function DF(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=f.useState(n?t:MF(e,t)),s=f.useRef();return f.useEffect(()=>{if("matchMedia"in window)return s.current=window.matchMedia(e),o(s.current.matches),RF(s.current,i=>o(i.matches))},[e]),r}const Z_=typeof document<"u"?f.useLayoutEffect:f.useEffect;function hs(e,t){const n=f.useRef(!1);f.useEffect(()=>()=>{n.current=!1},[]),f.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function TF({opened:e,shouldReturnFocus:t=!0}){const n=f.useRef(),r=()=>{var o;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((o=n.current)==null||o.focus({preventScroll:!0}))};return hs(()=>{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 AF=/input|select|textarea|button|object/,ek="a, input, select, textarea, button, object, [tabindex]";function NF(e){return e.style.display==="none"}function $F(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(NF(n))return!1;n=n.parentNode}return!0}function tk(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function O0(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(tk(e));return(AF.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&$F(e)}function nk(e){const t=tk(e);return(Number.isNaN(t)||t>=0)&&O0(e)}function zF(e){return Array.from(e.querySelectorAll(ek)).filter(nk)}function LF(e,t){const n=zF(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 S1(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function BF(e,t="body > :not(script)"){const n=S1(),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"),u=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"):!u&&!d&&o.setAttribute("data-hidden",i),{node:o,ariaHidden:u||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 FF(e=!0){const t=f.useRef(),n=f.useRef(null),r=s=>{let i=s.querySelector("[data-autofocus]");if(!i){const u=Array.from(s.querySelectorAll(ek));i=u.find(nk)||u.find(O0)||null,!i&&O0(s)&&(i=s)}i&&i.focus({preventScroll:!0})},o=f.useCallback(s=>{if(e){if(s===null){n.current&&(n.current(),n.current=null);return}n.current=BF(s),t.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&r(s)}),t.current=s):t.current=null)}},[e]);return f.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const s=i=>{i.key==="Tab"&&t.current&&LF(t.current,i)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),n.current&&n.current()}},[e]),o}const HF=N["useId".toString()]||(()=>{});function WF(){const e=HF();return e?`mantine-${e.replace(/:/g,"")}`:""}function C1(e){const t=WF(),[n,r]=f.useState(t);return Z_(()=>{r(S1())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function gw(e,t,n){f.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function rk(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function VF(...e){return t=>{e.forEach(n=>rk(n,t))}}function zu(...e){return f.useCallback(VF(...e),e)}function uu({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=f.useState(t!==void 0?t:n),i=u=>{s(u),r==null||r(u)};return e!==void 0?[e,r,!0]:[o,i,!1]}function ok(e,t){return DF("(prefers-reduced-motion: reduce)",e,t)}const UF=e=>e<.5?2*e*e:-1+(4-2*e)*e,GF=({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 v=i?d.height:window.innerHeight;if(r==="end"){const b=m+o-v+p.height;return b>=-p.height*(s?0:1)||!s?b:0}return r==="center"?m-v/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 v=i?d.width:window.innerWidth;if(r==="end"){const b=m+o-v+p.width;return b>=-p.width||!s?b:0}return r==="center"?m-v/2+p.width/2:0}return 0},qF=({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]},KF=({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 sk({duration:e=1250,axis:t="y",onScrollFinish:n,easing:r=UF,offset:o=0,cancelable:s=!0,isList:i=!1}={}){const u=f.useRef(0),d=f.useRef(0),p=f.useRef(!1),h=f.useRef(null),m=f.useRef(null),v=ok(),b=()=>{u.current&&cancelAnimationFrame(u.current)},S=f.useCallback(({alignment:C="start"}={})=>{var _;p.current=!1,u.current&&b();const k=(_=qF({parent:h.current,axis:t}))!=null?_:0,j=GF({parent:h.current,target:m.current,axis:t,alignment:C,offset:o,isList:i})-(h.current?0:k);function E(){d.current===0&&(d.current=performance.now());const O=performance.now()-d.current,R=v||e===0?1:O/e,T=k+j*r(R);KF({parent:h.current,axis:t,distance:T}),!p.current&&R<1?u.current=requestAnimationFrame(E):(typeof n=="function"&&n(),d.current=0,u.current=0,b())}E()},[t,e,r,i,o,n,v]),w=()=>{s&&(p.current=!0)};return gw("wheel",w,{passive:!0}),gw("touchmove",w,{passive:!0}),f.useEffect(()=>b,[]),{scrollableRef:h,targetRef:m,scrollIntoView:S,cancel:b}}var vw=Object.getOwnPropertySymbols,YF=Object.prototype.hasOwnProperty,QF=Object.prototype.propertyIsEnumerable,XF=(e,t)=>{var n={};for(var r in e)YF.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&vw)for(var r of vw(e))t.indexOf(r)<0&&QF.call(e,r)&&(n[r]=e[r]);return n};function _h(e){const t=e,{m:n,mx:r,my:o,mt:s,mb:i,ml:u,mr:d,p,px:h,py:m,pt:v,pb:b,pl:S,pr:w,bg:C,c:_,opacity:k,ff:j,fz:E,fw:I,lts:O,ta:R,lh:T,fs:A,tt:z,td:$,w:ee,miw:B,maw:H,h:G,mih:K,mah:M,bgsz:U,bgp:V,bgr:J,bga:ie,pos:xe,top:he,left:ae,bottom:Z,right:W,inset:re,display:pe}=t,ne=XF(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:GO({m:n,mx:r,my:o,mt:s,mb:i,ml:u,mr:d,p,px:h,py:m,pt:v,pb:b,pl:S,pr:w,bg:C,c:_,opacity:k,ff:j,fz:E,fw:I,lts:O,ta:R,lh:T,fs:A,tt:z,td:$,w:ee,miw:B,maw:H,h:G,mih:K,mah:M,bgsz:U,bgp:V,bgr:J,bga:ie,pos:xe,top:he,left:ae,bottom:Z,right:W,inset:re,display:pe}),rest:ne}}function JF(e,t){const n=Object.keys(e).filter(r=>r!=="base").sort((r,o)=>kx(At({size:r,sizes:t.breakpoints}))-kx(At({size:o,sizes:t.breakpoints})));return"base"in e?["base",...n]:n}function ZF({value:e,theme:t,getValue:n,property:r}){if(e==null)return;if(typeof e=="object")return JF(e,t).reduce((i,u)=>{if(u==="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[u],t);return Array.isArray(r)?(i[t.fn.largerThan(u)]={},r.forEach(p=>{i[t.fn.largerThan(u)][p]=d}),i):(i[t.fn.largerThan(u)]={[r]:d},i)},{});const o=n(e,t);return Array.isArray(r)?r.reduce((s,i)=>(s[i]=o,s),{}):{[r]:o}}function eH(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 tH(e){return $e(e)}function nH(e){return e}function rH(e,t){return At({size:e,sizes:t.fontSizes})}const oH=["-xs","-sm","-md","-lg","-xl"];function sH(e,t){return oH.includes(e)?`calc(${At({size:e.replace("-",""),sizes:t.spacing})} * -1)`:At({size:e,sizes:t.spacing})}const aH={identity:nH,color:eH,size:tH,fontSize:rH,spacing:sH},iH={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 lH=Object.defineProperty,yw=Object.getOwnPropertySymbols,cH=Object.prototype.hasOwnProperty,uH=Object.prototype.propertyIsEnumerable,bw=(e,t,n)=>t in e?lH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xw=(e,t)=>{for(var n in t||(t={}))cH.call(t,n)&&bw(e,n,t[n]);if(yw)for(var n of yw(t))uH.call(t,n)&&bw(e,n,t[n]);return e};function ww(e,t,n=iH){return Object.keys(n).reduce((o,s)=>(s in e&&e[s]!==void 0&&o.push(ZF({value:e[s],getValue:aH[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]=xw(xw({},o[i]),s[i]):o[i]=s[i]}),o),{})}function Sw(e,t){return typeof e=="function"?e(t):e}function dH(e,t,n){const r=Ca(),{css:o,cx:s}=J_();return Array.isArray(e)?s(n,o(ww(t,r)),e.map(i=>o(Sw(i,r)))):s(n,o(Sw(e,r)),o(ww(t,r)))}var fH=Object.defineProperty,ep=Object.getOwnPropertySymbols,ak=Object.prototype.hasOwnProperty,ik=Object.prototype.propertyIsEnumerable,Cw=(e,t,n)=>t in e?fH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pH=(e,t)=>{for(var n in t||(t={}))ak.call(t,n)&&Cw(e,n,t[n]);if(ep)for(var n of ep(t))ik.call(t,n)&&Cw(e,n,t[n]);return e},hH=(e,t)=>{var n={};for(var r in e)ak.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ep)for(var r of ep(e))t.indexOf(r)<0&&ik.call(e,r)&&(n[r]=e[r]);return n};const lk=f.forwardRef((e,t)=>{var n=e,{className:r,component:o,style:s,sx:i}=n,u=hH(n,["className","component","style","sx"]);const{systemStyles:d,rest:p}=_h(u),h=o||"div";return N.createElement(h,pH({ref:t,className:dH(i,d,r),style:s},p))});lk.displayName="@mantine/core/Box";const xo=lk;var mH=Object.defineProperty,gH=Object.defineProperties,vH=Object.getOwnPropertyDescriptors,_w=Object.getOwnPropertySymbols,yH=Object.prototype.hasOwnProperty,bH=Object.prototype.propertyIsEnumerable,kw=(e,t,n)=>t in e?mH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pw=(e,t)=>{for(var n in t||(t={}))yH.call(t,n)&&kw(e,n,t[n]);if(_w)for(var n of _w(t))bH.call(t,n)&&kw(e,n,t[n]);return e},xH=(e,t)=>gH(e,vH(t)),wH=Zr(e=>({root:xH(Pw(Pw({},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 SH=wH;var CH=Object.defineProperty,tp=Object.getOwnPropertySymbols,ck=Object.prototype.hasOwnProperty,uk=Object.prototype.propertyIsEnumerable,jw=(e,t,n)=>t in e?CH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_H=(e,t)=>{for(var n in t||(t={}))ck.call(t,n)&&jw(e,n,t[n]);if(tp)for(var n of tp(t))uk.call(t,n)&&jw(e,n,t[n]);return e},kH=(e,t)=>{var n={};for(var r in e)ck.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&tp)for(var r of tp(e))t.indexOf(r)<0&&uk.call(e,r)&&(n[r]=e[r]);return n};const dk=f.forwardRef((e,t)=>{const n=gr("UnstyledButton",{},e),{className:r,component:o="button",unstyled:s,variant:i}=n,u=kH(n,["className","component","unstyled","variant"]),{classes:d,cx:p}=SH(null,{name:"UnstyledButton",unstyled:s,variant:i});return N.createElement(xo,_H({component:o,ref:t,className:p(d.root,r),type:o==="button"?"button":void 0},u))});dk.displayName="@mantine/core/UnstyledButton";const PH=dk;var jH=Object.defineProperty,IH=Object.defineProperties,EH=Object.getOwnPropertyDescriptors,Iw=Object.getOwnPropertySymbols,OH=Object.prototype.hasOwnProperty,RH=Object.prototype.propertyIsEnumerable,Ew=(e,t,n)=>t in e?jH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R0=(e,t)=>{for(var n in t||(t={}))OH.call(t,n)&&Ew(e,n,t[n]);if(Iw)for(var n of Iw(t))RH.call(t,n)&&Ew(e,n,t[n]);return e},Ow=(e,t)=>IH(e,EH(t));const MH=["subtle","filled","outline","light","default","transparent","gradient"],Qd={xs:$e(18),sm:$e(22),md:$e(28),lg:$e(34),xl:$e(44)};function DH({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%"})}:MH.includes(e)?R0({border:`${$e(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover})):null}var TH=Zr((e,{radius:t,color:n,gradient:r},{variant:o,size:s})=>({root:Ow(R0({position:"relative",borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",height:At({size:s,sizes:Qd}),minHeight:At({size:s,sizes:Qd}),width:At({size:s,sizes:Qd}),minWidth:At({size:s,sizes:Qd})},DH({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":Ow(R0({content:'""'},e.fn.cover($e(-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 AH=TH;var NH=Object.defineProperty,np=Object.getOwnPropertySymbols,fk=Object.prototype.hasOwnProperty,pk=Object.prototype.propertyIsEnumerable,Rw=(e,t,n)=>t in e?NH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mw=(e,t)=>{for(var n in t||(t={}))fk.call(t,n)&&Rw(e,n,t[n]);if(np)for(var n of np(t))pk.call(t,n)&&Rw(e,n,t[n]);return e},Dw=(e,t)=>{var n={};for(var r in e)fk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&np)for(var r of np(e))t.indexOf(r)<0&&pk.call(e,r)&&(n[r]=e[r]);return n};function $H(e){var t=e,{size:n,color:r}=t,o=Dw(t,["size","color"]);const s=o,{style:i}=s,u=Dw(s,["style"]);return N.createElement("svg",Mw({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:r,style:Mw({width:n},i)},u),N.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},N.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"}),N.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"})),N.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},N.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"}),N.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"})),N.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},N.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),N.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),N.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},N.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"}),N.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"})),N.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},N.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"}),N.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 zH=Object.defineProperty,rp=Object.getOwnPropertySymbols,hk=Object.prototype.hasOwnProperty,mk=Object.prototype.propertyIsEnumerable,Tw=(e,t,n)=>t in e?zH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Aw=(e,t)=>{for(var n in t||(t={}))hk.call(t,n)&&Tw(e,n,t[n]);if(rp)for(var n of rp(t))mk.call(t,n)&&Tw(e,n,t[n]);return e},Nw=(e,t)=>{var n={};for(var r in e)hk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&rp)for(var r of rp(e))t.indexOf(r)<0&&mk.call(e,r)&&(n[r]=e[r]);return n};function LH(e){var t=e,{size:n,color:r}=t,o=Nw(t,["size","color"]);const s=o,{style:i}=s,u=Nw(s,["style"]);return N.createElement("svg",Aw({viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:r,style:Aw({width:n,height:n},i)},u),N.createElement("g",{fill:"none",fillRule:"evenodd"},N.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},N.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),N.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},N.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}var BH=Object.defineProperty,op=Object.getOwnPropertySymbols,gk=Object.prototype.hasOwnProperty,vk=Object.prototype.propertyIsEnumerable,$w=(e,t,n)=>t in e?BH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zw=(e,t)=>{for(var n in t||(t={}))gk.call(t,n)&&$w(e,n,t[n]);if(op)for(var n of op(t))vk.call(t,n)&&$w(e,n,t[n]);return e},Lw=(e,t)=>{var n={};for(var r in e)gk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&op)for(var r of op(e))t.indexOf(r)<0&&vk.call(e,r)&&(n[r]=e[r]);return n};function FH(e){var t=e,{size:n,color:r}=t,o=Lw(t,["size","color"]);const s=o,{style:i}=s,u=Lw(s,["style"]);return N.createElement("svg",zw({viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:r,style:zw({width:n},i)},u),N.createElement("circle",{cx:"15",cy:"15",r:"15"},N.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),N.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),N.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},N.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),N.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),N.createElement("circle",{cx:"105",cy:"15",r:"15"},N.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),N.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var HH=Object.defineProperty,sp=Object.getOwnPropertySymbols,yk=Object.prototype.hasOwnProperty,bk=Object.prototype.propertyIsEnumerable,Bw=(e,t,n)=>t in e?HH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,WH=(e,t)=>{for(var n in t||(t={}))yk.call(t,n)&&Bw(e,n,t[n]);if(sp)for(var n of sp(t))bk.call(t,n)&&Bw(e,n,t[n]);return e},VH=(e,t)=>{var n={};for(var r in e)yk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&sp)for(var r of sp(e))t.indexOf(r)<0&&bk.call(e,r)&&(n[r]=e[r]);return n};const jg={bars:$H,oval:LH,dots:FH},UH={xs:$e(18),sm:$e(22),md:$e(36),lg:$e(44),xl:$e(58)},GH={size:"md"};function xk(e){const t=gr("Loader",GH,e),{size:n,color:r,variant:o}=t,s=VH(t,["size","color","variant"]),i=Ca(),u=o in jg?o:i.loader;return N.createElement(xo,WH({role:"presentation",component:jg[u]||jg.bars,size:At({size:n,sizes:UH}),color:i.fn.variant({variant:"filled",primaryFallback:!1,color:r||i.primaryColor}).background},s))}xk.displayName="@mantine/core/Loader";var qH=Object.defineProperty,ap=Object.getOwnPropertySymbols,wk=Object.prototype.hasOwnProperty,Sk=Object.prototype.propertyIsEnumerable,Fw=(e,t,n)=>t in e?qH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hw=(e,t)=>{for(var n in t||(t={}))wk.call(t,n)&&Fw(e,n,t[n]);if(ap)for(var n of ap(t))Sk.call(t,n)&&Fw(e,n,t[n]);return e},KH=(e,t)=>{var n={};for(var r in e)wk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ap)for(var r of ap(e))t.indexOf(r)<0&&Sk.call(e,r)&&(n[r]=e[r]);return n};const YH={color:"gray",size:"md",variant:"subtle"},Ck=f.forwardRef((e,t)=>{const n=gr("ActionIcon",YH,e),{className:r,color:o,children:s,radius:i,size:u,variant:d,gradient:p,disabled:h,loaderProps:m,loading:v,unstyled:b,__staticSelector:S}=n,w=KH(n,["className","color","children","radius","size","variant","gradient","disabled","loaderProps","loading","unstyled","__staticSelector"]),{classes:C,cx:_,theme:k}=AH({radius:i,color:o,gradient:p},{name:["ActionIcon",S],unstyled:b,size:u,variant:d}),j=N.createElement(xk,Hw({color:k.fn.variant({color:o,variant:d}).color,size:"100%","data-action-icon-loader":!0},m));return N.createElement(PH,Hw({className:_(C.root,r),ref:t,disabled:h,"data-disabled":h||void 0,"data-loading":v||void 0,unstyled:b},w),v?j:s)});Ck.displayName="@mantine/core/ActionIcon";const QH=Ck;var XH=Object.defineProperty,JH=Object.defineProperties,ZH=Object.getOwnPropertyDescriptors,ip=Object.getOwnPropertySymbols,_k=Object.prototype.hasOwnProperty,kk=Object.prototype.propertyIsEnumerable,Ww=(e,t,n)=>t in e?XH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eW=(e,t)=>{for(var n in t||(t={}))_k.call(t,n)&&Ww(e,n,t[n]);if(ip)for(var n of ip(t))kk.call(t,n)&&Ww(e,n,t[n]);return e},tW=(e,t)=>JH(e,ZH(t)),nW=(e,t)=>{var n={};for(var r in e)_k.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ip)for(var r of ip(e))t.indexOf(r)<0&&kk.call(e,r)&&(n[r]=e[r]);return n};function Pk(e){const t=gr("Portal",{},e),{children:n,target:r,className:o,innerRef:s}=t,i=nW(t,["children","target","className","innerRef"]),u=Ca(),[d,p]=f.useState(!1),h=f.useRef();return Z_(()=>(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?Xl.createPortal(N.createElement("div",tW(eW({className:o,dir:u.dir},i),{ref:s}),n),h.current):null}Pk.displayName="@mantine/core/Portal";var rW=Object.defineProperty,lp=Object.getOwnPropertySymbols,jk=Object.prototype.hasOwnProperty,Ik=Object.prototype.propertyIsEnumerable,Vw=(e,t,n)=>t in e?rW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oW=(e,t)=>{for(var n in t||(t={}))jk.call(t,n)&&Vw(e,n,t[n]);if(lp)for(var n of lp(t))Ik.call(t,n)&&Vw(e,n,t[n]);return e},sW=(e,t)=>{var n={};for(var r in e)jk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&lp)for(var r of lp(e))t.indexOf(r)<0&&Ik.call(e,r)&&(n[r]=e[r]);return n};function Ek(e){var t=e,{withinPortal:n=!0,children:r}=t,o=sW(t,["withinPortal","children"]);return n?N.createElement(Pk,oW({},o),r):N.createElement(N.Fragment,null,r)}Ek.displayName="@mantine/core/OptionalPortal";var aW=Object.defineProperty,cp=Object.getOwnPropertySymbols,Ok=Object.prototype.hasOwnProperty,Rk=Object.prototype.propertyIsEnumerable,Uw=(e,t,n)=>t in e?aW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gw=(e,t)=>{for(var n in t||(t={}))Ok.call(t,n)&&Uw(e,n,t[n]);if(cp)for(var n of cp(t))Rk.call(t,n)&&Uw(e,n,t[n]);return e},iW=(e,t)=>{var n={};for(var r in e)Ok.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&cp)for(var r of cp(e))t.indexOf(r)<0&&Rk.call(e,r)&&(n[r]=e[r]);return n};function Mk(e){const t=e,{width:n,height:r,style:o}=t,s=iW(t,["width","height","style"]);return N.createElement("svg",Gw({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:Gw({width:n,height:r},o)},s),N.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"}))}Mk.displayName="@mantine/core/CloseIcon";var lW=Object.defineProperty,up=Object.getOwnPropertySymbols,Dk=Object.prototype.hasOwnProperty,Tk=Object.prototype.propertyIsEnumerable,qw=(e,t,n)=>t in e?lW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cW=(e,t)=>{for(var n in t||(t={}))Dk.call(t,n)&&qw(e,n,t[n]);if(up)for(var n of up(t))Tk.call(t,n)&&qw(e,n,t[n]);return e},uW=(e,t)=>{var n={};for(var r in e)Dk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&up)for(var r of up(e))t.indexOf(r)<0&&Tk.call(e,r)&&(n[r]=e[r]);return n};const dW={xs:$e(12),sm:$e(16),md:$e(20),lg:$e(28),xl:$e(34)},fW={size:"sm"},Ak=f.forwardRef((e,t)=>{const n=gr("CloseButton",fW,e),{iconSize:r,size:o,children:s}=n,i=uW(n,["iconSize","size","children"]),u=$e(r||dW[o]);return N.createElement(QH,cW({ref:t,__staticSelector:"CloseButton",size:o},i),s||N.createElement(Mk,{width:u,height:u}))});Ak.displayName="@mantine/core/CloseButton";const Nk=Ak;var pW=Object.defineProperty,hW=Object.defineProperties,mW=Object.getOwnPropertyDescriptors,Kw=Object.getOwnPropertySymbols,gW=Object.prototype.hasOwnProperty,vW=Object.prototype.propertyIsEnumerable,Yw=(e,t,n)=>t in e?pW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xd=(e,t)=>{for(var n in t||(t={}))gW.call(t,n)&&Yw(e,n,t[n]);if(Kw)for(var n of Kw(t))vW.call(t,n)&&Yw(e,n,t[n]);return e},yW=(e,t)=>hW(e,mW(t));function bW({underline:e,strikethrough:t}){const n=[];return e&&n.push("underline"),t&&n.push("line-through"),n.length>0?n.join(" "):"none"}function xW({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 wW(e){return typeof e=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}function SW({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 CW=Zr((e,{color:t,lineClamp:n,truncate:r,inline:o,inherit:s,underline:i,gradient:u,weight:d,transform:p,align:h,strikethrough:m,italic:v},{size:b})=>{const S=e.fn.variant({variant:"gradient",gradient:u});return{root:yW(Xd(Xd(Xd(Xd({},e.fn.fontStyles()),e.fn.focusStyles()),wW(n)),SW({theme:e,truncate:r})),{color:xW({color:t,theme:e}),fontFamily:s?"inherit":e.fontFamily,fontSize:s||b===void 0?"inherit":At({size:b,sizes:e.fontSizes}),lineHeight:s?"inherit":o?1:e.lineHeight,textDecoration:bW({underline:i,strikethrough:m}),WebkitTapHighlightColor:"transparent",fontWeight:s?"inherit":d,textTransform:p,textAlign:h,fontStyle:v?"italic":void 0}),gradient:{backgroundImage:S.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}});const _W=CW;var kW=Object.defineProperty,dp=Object.getOwnPropertySymbols,$k=Object.prototype.hasOwnProperty,zk=Object.prototype.propertyIsEnumerable,Qw=(e,t,n)=>t in e?kW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,PW=(e,t)=>{for(var n in t||(t={}))$k.call(t,n)&&Qw(e,n,t[n]);if(dp)for(var n of dp(t))zk.call(t,n)&&Qw(e,n,t[n]);return e},jW=(e,t)=>{var n={};for(var r in e)$k.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&dp)for(var r of dp(e))t.indexOf(r)<0&&zk.call(e,r)&&(n[r]=e[r]);return n};const IW={variant:"text"},Lk=f.forwardRef((e,t)=>{const n=gr("Text",IW,e),{className:r,size:o,weight:s,transform:i,color:u,align:d,variant:p,lineClamp:h,truncate:m,gradient:v,inline:b,inherit:S,underline:w,strikethrough:C,italic:_,classNames:k,styles:j,unstyled:E,span:I,__staticSelector:O}=n,R=jW(n,["className","size","weight","transform","color","align","variant","lineClamp","truncate","gradient","inline","inherit","underline","strikethrough","italic","classNames","styles","unstyled","span","__staticSelector"]),{classes:T,cx:A}=_W({color:u,lineClamp:h,truncate:m,inline:b,inherit:S,underline:w,strikethrough:C,italic:_,weight:s,transform:i,align:d,gradient:v},{unstyled:E,name:O||"Text",variant:p,size:o});return N.createElement(xo,PW({ref:t,className:A(T.root,{[T.gradient]:p==="gradient"},r),component:I?"span":"div"},R))});Lk.displayName="@mantine/core/Text";const Nl=Lk,Jd={xs:$e(1),sm:$e(2),md:$e(3),lg:$e(4),xl:$e(5)};function Zd(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 EW=Zr((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:$e(1),borderTop:`${At({size:n,sizes:Jd})} ${r} ${Zd(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${At({size:n,sizes:Jd})} ${r} ${Zd(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:$e(At({size:n,sizes:Jd})),borderTopColor:Zd(e,t),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"auto",borderLeftWidth:$e(At({size:n,sizes:Jd})),borderLeftColor:Zd(e,t),borderLeftStyle:r}}));const OW=EW;var RW=Object.defineProperty,MW=Object.defineProperties,DW=Object.getOwnPropertyDescriptors,fp=Object.getOwnPropertySymbols,Bk=Object.prototype.hasOwnProperty,Fk=Object.prototype.propertyIsEnumerable,Xw=(e,t,n)=>t in e?RW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jw=(e,t)=>{for(var n in t||(t={}))Bk.call(t,n)&&Xw(e,n,t[n]);if(fp)for(var n of fp(t))Fk.call(t,n)&&Xw(e,n,t[n]);return e},TW=(e,t)=>MW(e,DW(t)),AW=(e,t)=>{var n={};for(var r in e)Bk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&fp)for(var r of fp(e))t.indexOf(r)<0&&Fk.call(e,r)&&(n[r]=e[r]);return n};const NW={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},M0=f.forwardRef((e,t)=>{const n=gr("Divider",NW,e),{className:r,color:o,orientation:s,size:i,label:u,labelPosition:d,labelProps:p,variant:h,styles:m,classNames:v,unstyled:b}=n,S=AW(n,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames","unstyled"]),{classes:w,cx:C}=OW({color:o},{classNames:v,styles:m,unstyled:b,name:"Divider",variant:h,size:i}),_=s==="vertical",k=s==="horizontal",j=!!u&&k,E=!(p!=null&&p.color);return N.createElement(xo,Jw({ref:t,className:C(w.root,{[w.vertical]:_,[w.horizontal]:k,[w.withLabel]:j},r),role:"separator"},S),j&&N.createElement(Nl,TW(Jw({},p),{size:(p==null?void 0:p.size)||"xs",mt:$e(2),className:C(w.label,w[d],{[w.labelDefaultStyles]:E})}),u))});M0.displayName="@mantine/core/Divider";var $W=Object.defineProperty,zW=Object.defineProperties,LW=Object.getOwnPropertyDescriptors,Zw=Object.getOwnPropertySymbols,BW=Object.prototype.hasOwnProperty,FW=Object.prototype.propertyIsEnumerable,eS=(e,t,n)=>t in e?$W(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tS=(e,t)=>{for(var n in t||(t={}))BW.call(t,n)&&eS(e,n,t[n]);if(Zw)for(var n of Zw(t))FW.call(t,n)&&eS(e,n,t[n]);return e},HW=(e,t)=>zW(e,LW(t)),WW=Zr((e,t,{size:n})=>({item:HW(tS({},e.fn.fontStyles()),{boxSizing:"border-box",wordBreak:"break-all",textAlign:"left",width:"100%",padding:`calc(${At({size:n,sizes:e.spacing})} / 1.5) ${At({size:n,sizes:e.spacing})}`,cursor:"pointer",fontSize:At({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]":tS({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(${At({size:n,sizes:e.spacing})} / 2)`,paddingBottom:`calc(${At({size:n,sizes:e.spacing})} / 2)`,textAlign:"center"},separator:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`calc(${At({size:n,sizes:e.spacing})} / 1.5) ${At({size:n,sizes:e.spacing})}`},separatorLabel:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}));const VW=WW;var UW=Object.defineProperty,nS=Object.getOwnPropertySymbols,GW=Object.prototype.hasOwnProperty,qW=Object.prototype.propertyIsEnumerable,rS=(e,t,n)=>t in e?UW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,KW=(e,t)=>{for(var n in t||(t={}))GW.call(t,n)&&rS(e,n,t[n]);if(nS)for(var n of nS(t))qW.call(t,n)&&rS(e,n,t[n]);return e};function _1({data:e,hovered:t,classNames:n,styles:r,isItemSelected:o,uuid:s,__staticSelector:i,onItemHover:u,onItemSelect:d,itemsRefs:p,itemComponent:h,size:m,nothingFound:v,creatable:b,createLabel:S,unstyled:w,variant:C}){const{classes:_}=VW(null,{classNames:n,styles:r,unstyled:w,name:i,variant:C,size:m}),k=[],j=[];let E=null;const I=(R,T)=>{const A=typeof o=="function"?o(R.value):!1;return N.createElement(h,KW({key:R.value,className:_.item,"data-disabled":R.disabled||void 0,"data-hovered":!R.disabled&&t===T||void 0,"data-selected":!R.disabled&&A||void 0,selected:A,onMouseEnter:()=>u(T),id:`${s}-${T}`,role:"option",tabIndex:-1,"aria-selected":t===T,ref:z=>{p&&p.current&&(p.current[R.value]=z)},onMouseDown:R.disabled?null:z=>{z.preventDefault(),d(R)},disabled:R.disabled,variant:C},R))};let O=null;if(e.forEach((R,T)=>{R.creatable?E=T:R.group?(O!==R.group&&(O=R.group,j.push(N.createElement("div",{className:_.separator,key:`__mantine-divider-${T}`},N.createElement(M0,{classNames:{label:_.separatorLabel},label:R.group})))),j.push(I(R,T))):k.push(I(R,T))}),b){const R=e[E];k.push(N.createElement("div",{key:S1(),className:_.item,"data-hovered":t===E||void 0,onMouseEnter:()=>u(E),onMouseDown:T=>{T.preventDefault(),d(R)},tabIndex:-1,ref:T=>{p&&p.current&&(p.current[R.value]=T)}},S))}return j.length>0&&k.length>0&&k.unshift(N.createElement("div",{className:_.separator,key:"empty-group-separator"},N.createElement(M0,null))),j.length>0||k.length>0?N.createElement(N.Fragment,null,j,k):N.createElement(Nl,{size:m,unstyled:w,className:_.nothingFound},v)}_1.displayName="@mantine/core/SelectItems";var YW=Object.defineProperty,pp=Object.getOwnPropertySymbols,Hk=Object.prototype.hasOwnProperty,Wk=Object.prototype.propertyIsEnumerable,oS=(e,t,n)=>t in e?YW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QW=(e,t)=>{for(var n in t||(t={}))Hk.call(t,n)&&oS(e,n,t[n]);if(pp)for(var n of pp(t))Wk.call(t,n)&&oS(e,n,t[n]);return e},XW=(e,t)=>{var n={};for(var r in e)Hk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pp)for(var r of pp(e))t.indexOf(r)<0&&Wk.call(e,r)&&(n[r]=e[r]);return n};const k1=f.forwardRef((e,t)=>{var n=e,{label:r,value:o}=n,s=XW(n,["label","value"]);return N.createElement("div",QW({ref:t},s),r||o)});k1.displayName="@mantine/core/DefaultItem";function JW(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Vk(...e){return t=>e.forEach(n=>JW(n,t))}function Fi(...e){return f.useCallback(Vk(...e),e)}const Uk=f.forwardRef((e,t)=>{const{children:n,...r}=e,o=f.Children.toArray(n),s=o.find(eV);if(s){const i=s.props.children,u=o.map(d=>d===s?f.Children.count(i)>1?f.Children.only(null):f.isValidElement(i)?i.props.children:null:d);return f.createElement(D0,Qn({},r,{ref:t}),f.isValidElement(i)?f.cloneElement(i,void 0,u):null)}return f.createElement(D0,Qn({},r,{ref:t}),n)});Uk.displayName="Slot";const D0=f.forwardRef((e,t)=>{const{children:n,...r}=e;return f.isValidElement(n)?f.cloneElement(n,{...tV(r,n.props),ref:Vk(t,n.ref)}):f.Children.count(n)>1?f.Children.only(null):null});D0.displayName="SlotClone";const ZW=({children:e})=>f.createElement(f.Fragment,null,e);function eV(e){return f.isValidElement(e)&&e.type===ZW}function tV(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]=(...u)=>{s(...u),o(...u)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}const nV=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],Lu=nV.reduce((e,t)=>{const n=f.forwardRef((r,o)=>{const{asChild:s,...i}=r,u=s?Uk:t;return f.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),f.createElement(u,Qn({},i,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),T0=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{};function rV(e,t){return f.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Bu=e=>{const{present:t,children:n}=e,r=oV(t),o=typeof n=="function"?n({present:r.isPresent}):f.Children.only(n),s=Fi(r.ref,o.ref);return typeof n=="function"||r.isPresent?f.cloneElement(o,{ref:s}):null};Bu.displayName="Presence";function oV(e){const[t,n]=f.useState(),r=f.useRef({}),o=f.useRef(e),s=f.useRef("none"),i=e?"mounted":"unmounted",[u,d]=rV(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const p=ef(r.current);s.current=u==="mounted"?p:"none"},[u]),T0(()=>{const p=r.current,h=o.current;if(h!==e){const v=s.current,b=ef(p);e?d("MOUNT"):b==="none"||(p==null?void 0:p.display)==="none"?d("UNMOUNT"):d(h&&v!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),T0(()=>{if(t){const p=m=>{const b=ef(r.current).includes(m.animationName);m.target===t&&b&&Xl.flushSync(()=>d("ANIMATION_END"))},h=m=>{m.target===t&&(s.current=ef(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(u),ref:f.useCallback(p=>{p&&(r.current=getComputedStyle(p)),n(p)},[])}}function ef(e){return(e==null?void 0:e.animationName)||"none"}function sV(e,t=[]){let n=[];function r(s,i){const u=f.createContext(i),d=n.length;n=[...n,i];function p(m){const{scope:v,children:b,...S}=m,w=(v==null?void 0:v[e][d])||u,C=f.useMemo(()=>S,Object.values(S));return f.createElement(w.Provider,{value:C},b)}function h(m,v){const b=(v==null?void 0:v[e][d])||u,S=f.useContext(b);if(S)return S;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=>f.createContext(i));return function(u){const d=(u==null?void 0:u[e])||s;return f.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return o.scopeName=e,[r,aV(o,...t)]}function aV(...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((u,{useScope:d,scopeName:p})=>{const m=d(s)[`__scope${p}`];return{...u,...m}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function yi(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const iV=f.createContext(void 0);function lV(e){const t=f.useContext(iV);return e||t||"ltr"}function cV(e,[t,n]){return Math.min(n,Math.max(t,e))}function ki(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 uV(e,t){return f.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Gk="ScrollArea",[qk,Goe]=sV(Gk),[dV,Zo]=qk(Gk),fV=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[u,d]=f.useState(null),[p,h]=f.useState(null),[m,v]=f.useState(null),[b,S]=f.useState(null),[w,C]=f.useState(null),[_,k]=f.useState(0),[j,E]=f.useState(0),[I,O]=f.useState(!1),[R,T]=f.useState(!1),A=Fi(t,$=>d($)),z=lV(o);return f.createElement(dV,{scope:n,type:r,dir:z,scrollHideDelay:s,scrollArea:u,viewport:p,onViewportChange:h,content:m,onContentChange:v,scrollbarX:b,onScrollbarXChange:S,scrollbarXEnabled:I,onScrollbarXEnabledChange:O,scrollbarY:w,onScrollbarYChange:C,scrollbarYEnabled:R,onScrollbarYEnabledChange:T,onCornerWidthChange:k,onCornerHeightChange:E},f.createElement(Lu.div,Qn({dir:z},i,{ref:A,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":j+"px",...e.style}})))}),pV="ScrollAreaViewport",hV=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,s=Zo(pV,n),i=f.useRef(null),u=Fi(t,i,s.onViewportChange);return f.createElement(f.Fragment,null,f.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}"}}),f.createElement(Lu.div,Qn({"data-radix-scroll-area-viewport":""},o,{ref:u,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style}}),f.createElement("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),ka="ScrollAreaScrollbar",mV=f.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Zo(ka,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,u=e.orientation==="horizontal";return f.useEffect(()=>(u?s(!0):i(!0),()=>{u?s(!1):i(!1)}),[u,s,i]),o.type==="hover"?f.createElement(gV,Qn({},r,{ref:t,forceMount:n})):o.type==="scroll"?f.createElement(vV,Qn({},r,{ref:t,forceMount:n})):o.type==="auto"?f.createElement(Kk,Qn({},r,{ref:t,forceMount:n})):o.type==="always"?f.createElement(P1,Qn({},r,{ref:t})):null}),gV=f.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Zo(ka,e.__scopeScrollArea),[s,i]=f.useState(!1);return f.useEffect(()=>{const u=o.scrollArea;let d=0;if(u){const p=()=>{window.clearTimeout(d),i(!0)},h=()=>{d=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return u.addEventListener("pointerenter",p),u.addEventListener("pointerleave",h),()=>{window.clearTimeout(d),u.removeEventListener("pointerenter",p),u.removeEventListener("pointerleave",h)}}},[o.scrollArea,o.scrollHideDelay]),f.createElement(Bu,{present:n||s},f.createElement(Kk,Qn({"data-state":s?"visible":"hidden"},r,{ref:t})))}),vV=f.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Zo(ka,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Ph(()=>d("SCROLL_END"),100),[u,d]=uV("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 f.useEffect(()=>{if(u==="idle"){const p=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[u,o.scrollHideDelay,d]),f.useEffect(()=>{const p=o.viewport,h=s?"scrollLeft":"scrollTop";if(p){let m=p[h];const v=()=>{const b=p[h];m!==b&&(d("SCROLL"),i()),m=b};return p.addEventListener("scroll",v),()=>p.removeEventListener("scroll",v)}},[o.viewport,s,d,i]),f.createElement(Bu,{present:n||u!=="hidden"},f.createElement(P1,Qn({"data-state":u==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:ki(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:ki(e.onPointerLeave,()=>d("POINTER_LEAVE"))})))}),Kk=f.forwardRef((e,t)=>{const n=Zo(ka,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=f.useState(!1),u=e.orientation==="horizontal",d=Ph(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=Zo(ka,e.__scopeScrollArea),s=f.useRef(null),i=f.useRef(0),[u,d]=f.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=Jk(u.viewport,u.content),h={...r,sizes:u,onSizesChange:d,hasThumb:p>0&&p<1,onThumbChange:v=>s.current=v,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:v=>i.current=v};function m(v,b){return kV(v,i.current,u,b)}return n==="horizontal"?f.createElement(yV,Qn({},h,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const v=o.viewport.scrollLeft,b=sS(v,u,o.dir);s.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:v=>{o.viewport&&(o.viewport.scrollLeft=v)},onDragScroll:v=>{o.viewport&&(o.viewport.scrollLeft=m(v,o.dir))}})):n==="vertical"?f.createElement(bV,Qn({},h,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const v=o.viewport.scrollTop,b=sS(v,u);s.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:v=>{o.viewport&&(o.viewport.scrollTop=v)},onDragScroll:v=>{o.viewport&&(o.viewport.scrollTop=m(v))}})):null}),yV=f.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=Zo(ka,e.__scopeScrollArea),[i,u]=f.useState(),d=f.useRef(null),p=Fi(t,d,s.onScrollbarXChange);return f.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),f.createElement(Qk,Qn({"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":kh(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,m)=>{if(s.viewport){const v=s.viewport.scrollLeft+h.deltaX;e.onWheelScroll(v),eP(v,m)&&h.preventDefault()}},onResize:()=>{d.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:hp(i.paddingLeft),paddingEnd:hp(i.paddingRight)}})}}))}),bV=f.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=Zo(ka,e.__scopeScrollArea),[i,u]=f.useState(),d=f.useRef(null),p=Fi(t,d,s.onScrollbarYChange);return f.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),f.createElement(Qk,Qn({"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":kh(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,m)=>{if(s.viewport){const v=s.viewport.scrollTop+h.deltaY;e.onWheelScroll(v),eP(v,m)&&h.preventDefault()}},onResize:()=>{d.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:hp(i.paddingTop),paddingEnd:hp(i.paddingBottom)}})}}))}),[xV,Yk]=qk(ka),Qk=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:u,onThumbPositionChange:d,onDragScroll:p,onWheelScroll:h,onResize:m,...v}=e,b=Zo(ka,n),[S,w]=f.useState(null),C=Fi(t,A=>w(A)),_=f.useRef(null),k=f.useRef(""),j=b.viewport,E=r.content-r.viewport,I=yi(h),O=yi(d),R=Ph(m,10);function T(A){if(_.current){const z=A.clientX-_.current.left,$=A.clientY-_.current.top;p({x:z,y:$})}}return f.useEffect(()=>{const A=z=>{const $=z.target;(S==null?void 0:S.contains($))&&I(z,E)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[j,S,E,I]),f.useEffect(O,[r,O]),$l(S,R),$l(b.content,R),f.createElement(xV,{scope:n,scrollbar:S,hasThumb:o,onThumbChange:yi(s),onThumbPointerUp:yi(i),onThumbPositionChange:O,onThumbPointerDown:yi(u)},f.createElement(Lu.div,Qn({},v,{ref:C,style:{position:"absolute",...v.style},onPointerDown:ki(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),_.current=S.getBoundingClientRect(),k.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",T(A))}),onPointerMove:ki(e.onPointerMove,T),onPointerUp:ki(e.onPointerUp,A=>{const z=A.target;z.hasPointerCapture(A.pointerId)&&z.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=k.current,_.current=null})})))}),A0="ScrollAreaThumb",wV=f.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Yk(A0,e.__scopeScrollArea);return f.createElement(Bu,{present:n||o.hasThumb},f.createElement(SV,Qn({ref:t},r)))}),SV=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=Zo(A0,n),i=Yk(A0,n),{onThumbPositionChange:u}=i,d=Fi(t,m=>i.onThumbChange(m)),p=f.useRef(),h=Ph(()=>{p.current&&(p.current(),p.current=void 0)},100);return f.useEffect(()=>{const m=s.viewport;if(m){const v=()=>{if(h(),!p.current){const b=PV(m,u);p.current=b,u()}};return u(),m.addEventListener("scroll",v),()=>m.removeEventListener("scroll",v)}},[s.viewport,h,u]),f.createElement(Lu.div,Qn({"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:ki(e.onPointerDownCapture,m=>{const b=m.target.getBoundingClientRect(),S=m.clientX-b.left,w=m.clientY-b.top;i.onThumbPointerDown({x:S,y:w})}),onPointerUp:ki(e.onPointerUp,i.onThumbPointerUp)}))}),Xk="ScrollAreaCorner",CV=f.forwardRef((e,t)=>{const n=Zo(Xk,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?f.createElement(_V,Qn({},e,{ref:t})):null}),_V=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=Zo(Xk,n),[s,i]=f.useState(0),[u,d]=f.useState(0),p=!!(s&&u);return $l(o.scrollbarX,()=>{var h;const m=((h=o.scrollbarX)===null||h===void 0?void 0:h.offsetHeight)||0;o.onCornerHeightChange(m),d(m)}),$l(o.scrollbarY,()=>{var h;const m=((h=o.scrollbarY)===null||h===void 0?void 0:h.offsetWidth)||0;o.onCornerWidthChange(m),i(m)}),p?f.createElement(Lu.div,Qn({},r,{ref:t,style:{width:s,height:u,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function hp(e){return e?parseInt(e,10):0}function Jk(e,t){const n=e/t;return isNaN(n)?0:n}function kh(e){const t=Jk(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function kV(e,t,n,r="ltr"){const o=kh(n),s=o/2,i=t||s,u=o-i,d=n.scrollbar.paddingStart+i,p=n.scrollbar.size-n.scrollbar.paddingEnd-u,h=n.content-n.viewport,m=r==="ltr"?[0,h]:[h*-1,0];return Zk([d,p],m)(e)}function sS(e,t,n="ltr"){const r=kh(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,u=s-r,d=n==="ltr"?[0,i]:[i*-1,0],p=cV(e,d);return Zk([0,i],[0,u])(p)}function Zk(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 eP(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,u=n.top!==s.top;(i||u)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function Ph(e,t){const n=yi(e),r=f.useRef(0);return f.useEffect(()=>()=>window.clearTimeout(r.current),[]),f.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function $l(e,t){const n=yi(t);T0(()=>{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 jV=fV,IV=hV,aS=mV,iS=wV,EV=CV;var OV=Zr((e,{scrollbarSize:t,offsetScrollbars:n,scrollbarHovered:r,hidden:o})=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:n?$e(t):void 0,paddingBottom:n?$e(t):void 0},scrollbar:{display:o?"none":"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:`calc(${$e(t)} / 5)`,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.colors.gray[0],[`& .${fw("thumb")}`]:{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.5):e.fn.rgba(e.black,.5)}},'&[data-orientation="vertical"]':{width:$e(t)},'&[data-orientation="horizontal"]':{flexDirection:"column",height:$e(t)},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:fw("thumb"),flex:1,backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.4):e.fn.rgba(e.black,.4),borderRadius:$e(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:$e(44),minHeight:$e(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 RV=OV;var MV=Object.defineProperty,DV=Object.defineProperties,TV=Object.getOwnPropertyDescriptors,mp=Object.getOwnPropertySymbols,tP=Object.prototype.hasOwnProperty,nP=Object.prototype.propertyIsEnumerable,lS=(e,t,n)=>t in e?MV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,N0=(e,t)=>{for(var n in t||(t={}))tP.call(t,n)&&lS(e,n,t[n]);if(mp)for(var n of mp(t))nP.call(t,n)&&lS(e,n,t[n]);return e},rP=(e,t)=>DV(e,TV(t)),oP=(e,t)=>{var n={};for(var r in e)tP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mp)for(var r of mp(e))t.indexOf(r)<0&&nP.call(e,r)&&(n[r]=e[r]);return n};const sP={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},jh=f.forwardRef((e,t)=>{const n=gr("ScrollArea",sP,e),{children:r,className:o,classNames:s,styles:i,scrollbarSize:u,scrollHideDelay:d,type:p,dir:h,offsetScrollbars:m,viewportRef:v,onScrollPositionChange:b,unstyled:S,variant:w,viewportProps:C}=n,_=oP(n,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","variant","viewportProps"]),[k,j]=f.useState(!1),E=Ca(),{classes:I,cx:O}=RV({scrollbarSize:u,offsetScrollbars:m,scrollbarHovered:k,hidden:p==="never"},{name:"ScrollArea",classNames:s,styles:i,unstyled:S,variant:w});return N.createElement(jV,{type:p==="never"?"always":p,scrollHideDelay:d,dir:h||E.dir,ref:t,asChild:!0},N.createElement(xo,N0({className:O(I.root,o)},_),N.createElement(IV,rP(N0({},C),{className:I.viewport,ref:v,onScroll:typeof b=="function"?({currentTarget:R})=>b({x:R.scrollLeft,y:R.scrollTop}):void 0}),r),N.createElement(aS,{orientation:"horizontal",className:I.scrollbar,forceMount:!0,onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1)},N.createElement(iS,{className:I.thumb})),N.createElement(aS,{orientation:"vertical",className:I.scrollbar,forceMount:!0,onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1)},N.createElement(iS,{className:I.thumb})),N.createElement(EV,{className:I.corner})))}),aP=f.forwardRef((e,t)=>{const n=gr("ScrollAreaAutosize",sP,e),{children:r,classNames:o,styles:s,scrollbarSize:i,scrollHideDelay:u,type:d,dir:p,offsetScrollbars:h,viewportRef:m,onScrollPositionChange:v,unstyled:b,sx:S,variant:w,viewportProps:C}=n,_=oP(n,["children","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","sx","variant","viewportProps"]);return N.createElement(xo,rP(N0({},_),{ref:t,sx:[{display:"flex"},...q_(S)]}),N.createElement(xo,{sx:{display:"flex",flexDirection:"column",flex:1}},N.createElement(jh,{classNames:o,styles:s,scrollHideDelay:u,scrollbarSize:i,type:d,dir:p,offsetScrollbars:h,viewportRef:m,onScrollPositionChange:v,unstyled:b,variant:w,viewportProps:C},r)))});aP.displayName="@mantine/core/ScrollAreaAutosize";jh.displayName="@mantine/core/ScrollArea";jh.Autosize=aP;const iP=jh;var AV=Object.defineProperty,NV=Object.defineProperties,$V=Object.getOwnPropertyDescriptors,gp=Object.getOwnPropertySymbols,lP=Object.prototype.hasOwnProperty,cP=Object.prototype.propertyIsEnumerable,cS=(e,t,n)=>t in e?AV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uS=(e,t)=>{for(var n in t||(t={}))lP.call(t,n)&&cS(e,n,t[n]);if(gp)for(var n of gp(t))cP.call(t,n)&&cS(e,n,t[n]);return e},zV=(e,t)=>NV(e,$V(t)),LV=(e,t)=>{var n={};for(var r in e)lP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gp)for(var r of gp(e))t.indexOf(r)<0&&cP.call(e,r)&&(n[r]=e[r]);return n};const Ih=f.forwardRef((e,t)=>{var n=e,{style:r}=n,o=LV(n,["style"]);return N.createElement(iP,zV(uS({},o),{style:uS({width:"100%"},r),viewportProps:{tabIndex:-1},viewportRef:t}),o.children)});Ih.displayName="@mantine/core/SelectScrollArea";var BV=Zr(()=>({dropdown:{},itemsWrapper:{padding:$e(4),display:"flex",width:"100%",boxSizing:"border-box"}}));const FV=BV;function ac(e){return e.split("-")[1]}function j1(e){return e==="y"?"height":"width"}function ms(e){return e.split("-")[0]}function si(e){return["top","bottom"].includes(ms(e))?"x":"y"}function dS(e,t,n){let{reference:r,floating:o}=e;const s=r.x+r.width/2-o.width/2,i=r.y+r.height/2-o.height/2,u=si(t),d=j1(u),p=r[d]/2-o[d]/2,h=u==="x";let m;switch(ms(t)){case"top":m={x:s,y:r.y-o.height};break;case"bottom":m={x:s,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:i};break;case"left":m={x:r.x-o.width,y:i};break;default:m={x:r.x,y:r.y}}switch(ac(t)){case"start":m[u]-=p*(n&&h?-1:1);break;case"end":m[u]+=p*(n&&h?-1:1)}return m}const HV=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,u=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}=dS(p,r,d),v=r,b={},S=0;for(let w=0;w({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:u}=t,{element:d,padding:p=0}=xa(e,t)||{};if(d==null)return{};const h=I1(p),m={x:n,y:r},v=si(o),b=j1(v),S=await i.getDimensions(d),w=v==="y",C=w?"top":"left",_=w?"bottom":"right",k=w?"clientHeight":"clientWidth",j=s.reference[b]+s.reference[v]-m[v]-s.floating[b],E=m[v]-s.reference[v],I=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let O=I?I[k]:0;O&&await(i.isElement==null?void 0:i.isElement(I))||(O=u.floating[k]||s.floating[b]);const R=j/2-E/2,T=O/2-S[b]/2-1,A=Za(h[C],T),z=Za(h[_],T),$=A,ee=O-S[b]-z,B=O/2-S[b]/2+R,H=$0($,B,ee),G=ac(o)!=null&&B!=H&&s.reference[b]/2-(B<$?A:z)-S[b]/2<0?B<$?$-B:ee-B:0;return{[v]:m[v]-G,data:{[v]:H,centerOffset:B-H+G}}}}),WV=["top","right","bottom","left"];WV.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]);const VV={left:"right",right:"left",bottom:"top",top:"bottom"};function vp(e){return e.replace(/left|right|bottom|top/g,t=>VV[t])}function UV(e,t,n){n===void 0&&(n=!1);const r=ac(e),o=si(e),s=j1(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=vp(i)),{main:i,cross:vp(i)}}const GV={start:"end",end:"start"};function Ig(e){return e.replace(/start|end/g,t=>GV[t])}const qV=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:s,initialPlacement:i,platform:u,elements:d}=t,{mainAxis:p=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:S=!0,...w}=xa(e,t),C=ms(r),_=ms(i)===i,k=await(u.isRTL==null?void 0:u.isRTL(d.floating)),j=m||(_||!S?[vp(i)]:function($){const ee=vp($);return[Ig($),ee,Ig(ee)]}(i));m||b==="none"||j.push(...function($,ee,B,H){const G=ac($);let K=function(M,U,V){const J=["left","right"],ie=["right","left"],xe=["top","bottom"],he=["bottom","top"];switch(M){case"top":case"bottom":return V?U?ie:J:U?J:ie;case"left":case"right":return U?xe:he;default:return[]}}(ms($),B==="start",H);return G&&(K=K.map(M=>M+"-"+G),ee&&(K=K.concat(K.map(Ig)))),K}(i,S,b,k));const E=[i,...j],I=await E1(t,w),O=[];let R=((n=o.flip)==null?void 0:n.overflows)||[];if(p&&O.push(I[C]),h){const{main:$,cross:ee}=UV(r,s,k);O.push(I[$],I[ee])}if(R=[...R,{placement:r,overflows:O}],!O.every($=>$<=0)){var T,A;const $=(((T=o.flip)==null?void 0:T.index)||0)+1,ee=E[$];if(ee)return{data:{index:$,overflows:R},reset:{placement:ee}};let B=(A=R.filter(H=>H.overflows[0]<=0).sort((H,G)=>H.overflows[1]-G.overflows[1])[0])==null?void 0:A.placement;if(!B)switch(v){case"bestFit":{var z;const H=(z=R.map(G=>[G.placement,G.overflows.filter(K=>K>0).reduce((K,M)=>K+M,0)]).sort((G,K)=>G[1]-K[1])[0])==null?void 0:z[0];H&&(B=H);break}case"initialPlacement":B=i}if(r!==B)return{reset:{placement:B}}}return{}}}};function pS(e){const t=Za(...e.map(r=>r.left)),n=Za(...e.map(r=>r.top));return{x:t,y:n,width:zs(...e.map(r=>r.right))-t,height:zs(...e.map(r=>r.bottom))-n}}const KV=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:u=2,x:d,y:p}=xa(e,t),h=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),m=function(w){const C=w.slice().sort((j,E)=>j.y-E.y),_=[];let k=null;for(let j=0;jk.height/2?_.push([E]):_[_.length-1].push(E),k=E}return _.map(j=>zl(pS(j)))}(h),v=zl(pS(h)),b=I1(u),S=await s.getElementRects({reference:{getBoundingClientRect:function(){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(si(n)==="x"){const I=m[0],O=m[m.length-1],R=ms(n)==="top",T=I.top,A=O.bottom,z=R?I.left:O.left,$=R?I.right:O.right;return{top:T,bottom:A,left:z,right:$,width:$-z,height:A-T,x:z,y:T}}const w=ms(n)==="left",C=zs(...m.map(I=>I.right)),_=Za(...m.map(I=>I.left)),k=m.filter(I=>w?I.left===_:I.right===C),j=k[0].top,E=k[k.length-1].bottom;return{top:j,bottom:E,left:_,right:C,width:C-_,height:E-j,x:_,y:j}}return v}},floating:r.floating,strategy:i});return o.reference.x!==S.reference.x||o.reference.y!==S.reference.y||o.reference.width!==S.reference.width||o.reference.height!==S.reference.height?{reset:{rects:S}}:{}}}},YV=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(s,i){const{placement:u,platform:d,elements:p}=s,h=await(d.isRTL==null?void 0:d.isRTL(p.floating)),m=ms(u),v=ac(u),b=si(u)==="x",S=["left","top"].includes(m)?-1:1,w=h&&b?-1:1,C=xa(i,s);let{mainAxis:_,crossAxis:k,alignmentAxis:j}=typeof C=="number"?{mainAxis:C,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...C};return v&&typeof j=="number"&&(k=v==="end"?-1*j:j),b?{x:k*w,y:_*S}:{x:_*S,y:k*w}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function uP(e){return e==="x"?"y":"x"}const QV=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:u={fn:C=>{let{x:_,y:k}=C;return{x:_,y:k}}},...d}=xa(e,t),p={x:n,y:r},h=await E1(t,d),m=si(ms(o)),v=uP(m);let b=p[m],S=p[v];if(s){const C=m==="y"?"bottom":"right";b=$0(b+h[m==="y"?"top":"left"],b,b-h[C])}if(i){const C=v==="y"?"bottom":"right";S=$0(S+h[v==="y"?"top":"left"],S,S-h[C])}const w=u.fn({...t,[m]:b,[v]:S});return{...w,data:{x:w.x-n,y:w.y-r}}}}},XV=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:u=0,mainAxis:d=!0,crossAxis:p=!0}=xa(e,t),h={x:n,y:r},m=si(o),v=uP(m);let b=h[m],S=h[v];const w=xa(u,t),C=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(d){const j=m==="y"?"height":"width",E=s.reference[m]-s.floating[j]+C.mainAxis,I=s.reference[m]+s.reference[j]-C.mainAxis;bI&&(b=I)}if(p){var _,k;const j=m==="y"?"width":"height",E=["top","left"].includes(ms(o)),I=s.reference[v]-s.floating[j]+(E&&((_=i.offset)==null?void 0:_[v])||0)+(E?0:C.crossAxis),O=s.reference[v]+s.reference[j]+(E?0:((k=i.offset)==null?void 0:k[v])||0)-(E?C.crossAxis:0);SO&&(S=O)}return{[m]:b,[v]:S}}}},JV=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=()=>{},...u}=xa(e,t),d=await E1(t,u),p=ms(n),h=ac(n),m=si(n)==="x",{width:v,height:b}=r.floating;let S,w;p==="top"||p==="bottom"?(S=p,w=h===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(w=p,S=h==="end"?"top":"bottom");const C=b-d[S],_=v-d[w],k=!t.middlewareData.shift;let j=C,E=_;if(m){const O=v-d.left-d.right;E=h||k?Za(_,O):O}else{const O=b-d.top-d.bottom;j=h||k?Za(C,O):O}if(k&&!h){const O=zs(d.left,0),R=zs(d.right,0),T=zs(d.top,0),A=zs(d.bottom,0);m?E=v-2*(O!==0||R!==0?O+R:zs(d.left,d.right)):j=b-2*(T!==0||A!==0?T+A:zs(d.top,d.bottom))}await i({...t,availableWidth:E,availableHeight:j});const I=await o.getDimensions(s.floating);return v!==I.width||b!==I.height?{reset:{rects:!0}}:{}}}};function Oo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Gs(e){return Oo(e).getComputedStyle(e)}function dP(e){return e instanceof Oo(e).Node}function ei(e){return dP(e)?(e.nodeName||"").toLowerCase():"#document"}function xs(e){return e instanceof HTMLElement||e instanceof Oo(e).HTMLElement}function hS(e){return typeof ShadowRoot<"u"&&(e instanceof Oo(e).ShadowRoot||e instanceof ShadowRoot)}function du(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Gs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function ZV(e){return["table","td","th"].includes(ei(e))}function z0(e){const t=O1(),n=Gs(e);return n.transform!=="none"||n.perspective!=="none"||!!n.containerType&&n.containerType!=="normal"||!t&&!!n.backdropFilter&&n.backdropFilter!=="none"||!t&&!!n.filter&&n.filter!=="none"||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function O1(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Eh(e){return["html","body","#document"].includes(ei(e))}const L0=Math.min,Ml=Math.max,yp=Math.round,tf=Math.floor,ti=e=>({x:e,y:e});function fP(e){const t=Gs(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=xs(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,u=yp(n)!==s||yp(r)!==i;return u&&(n=s,r=i),{width:n,height:r,$:u}}function da(e){return e instanceof Element||e instanceof Oo(e).Element}function R1(e){return da(e)?e:e.contextElement}function Dl(e){const t=R1(e);if(!xs(t))return ti(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=fP(t);let i=(s?yp(n.width):n.width)/r,u=(s?yp(n.height):n.height)/o;return i&&Number.isFinite(i)||(i=1),u&&Number.isFinite(u)||(u=1),{x:i,y:u}}const eU=ti(0);function pP(e){const t=Oo(e);return O1()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:eU}function Di(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=R1(e);let i=ti(1);t&&(r?da(r)&&(i=Dl(r)):i=Dl(e));const u=function(v,b,S){return b===void 0&&(b=!1),!(!S||b&&S!==Oo(v))&&b}(s,n,r)?pP(s):ti(0);let d=(o.left+u.x)/i.x,p=(o.top+u.y)/i.y,h=o.width/i.x,m=o.height/i.y;if(s){const v=Oo(s),b=r&&da(r)?Oo(r):r;let S=v.frameElement;for(;S&&r&&b!==v;){const w=Dl(S),C=S.getBoundingClientRect(),_=getComputedStyle(S),k=C.left+(S.clientLeft+parseFloat(_.paddingLeft))*w.x,j=C.top+(S.clientTop+parseFloat(_.paddingTop))*w.y;d*=w.x,p*=w.y,h*=w.x,m*=w.y,d+=k,p+=j,S=Oo(S).frameElement}}return zl({width:h,height:m,x:d,y:p})}function Oh(e){return da(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function fa(e){var t;return(t=(dP(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function hP(e){return Di(fa(e)).left+Oh(e).scrollLeft}function Ll(e){if(ei(e)==="html")return e;const t=e.assignedSlot||e.parentNode||hS(e)&&e.host||fa(e);return hS(t)?t.host:t}function mP(e){const t=Ll(e);return Eh(t)?e.ownerDocument?e.ownerDocument.body:e.body:xs(t)&&du(t)?t:mP(t)}function bp(e,t){var n;t===void 0&&(t=[]);const r=mP(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Oo(r);return o?t.concat(s,s.visualViewport||[],du(r)?r:[]):t.concat(r,bp(r))}function mS(e,t,n){let r;if(t==="viewport")r=function(o,s){const i=Oo(o),u=fa(o),d=i.visualViewport;let p=u.clientWidth,h=u.clientHeight,m=0,v=0;if(d){p=d.width,h=d.height;const b=O1();(!b||b&&s==="fixed")&&(m=d.offsetLeft,v=d.offsetTop)}return{width:p,height:h,x:m,y:v}}(e,n);else if(t==="document")r=function(o){const s=fa(o),i=Oh(o),u=o.ownerDocument.body,d=Ml(s.scrollWidth,s.clientWidth,u.scrollWidth,u.clientWidth),p=Ml(s.scrollHeight,s.clientHeight,u.scrollHeight,u.clientHeight);let h=-i.scrollLeft+hP(o);const m=-i.scrollTop;return Gs(u).direction==="rtl"&&(h+=Ml(s.clientWidth,u.clientWidth)-d),{width:d,height:p,x:h,y:m}}(fa(e));else if(da(t))r=function(o,s){const i=Di(o,!0,s==="fixed"),u=i.top+o.clientTop,d=i.left+o.clientLeft,p=xs(o)?Dl(o):ti(1);return{width:o.clientWidth*p.x,height:o.clientHeight*p.y,x:d*p.x,y:u*p.y}}(t,n);else{const o=pP(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return zl(r)}function gP(e,t){const n=Ll(e);return!(n===t||!da(n)||Eh(n))&&(Gs(n).position==="fixed"||gP(n,t))}function tU(e,t,n){const r=xs(t),o=fa(t),s=n==="fixed",i=Di(e,!0,s,t);let u={scrollLeft:0,scrollTop:0};const d=ti(0);if(r||!r&&!s)if((ei(t)!=="body"||du(o))&&(u=Oh(t)),xs(t)){const p=Di(t,!0,s,t);d.x=p.x+t.clientLeft,d.y=p.y+t.clientTop}else o&&(d.x=hP(o));return{x:i.left+u.scrollLeft-d.x,y:i.top+u.scrollTop-d.y,width:i.width,height:i.height}}function gS(e,t){return xs(e)&&Gs(e).position!=="fixed"?t?t(e):e.offsetParent:null}function vS(e,t){const n=Oo(e);if(!xs(e))return n;let r=gS(e,t);for(;r&&ZV(r)&&Gs(r).position==="static";)r=gS(r,t);return r&&(ei(r)==="html"||ei(r)==="body"&&Gs(r).position==="static"&&!z0(r))?n:r||function(o){let s=Ll(o);for(;xs(s)&&!Eh(s);){if(z0(s))return s;s=Ll(s)}return null}(e)||n}const nU={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=xs(n),s=fa(n);if(n===s)return t;let i={scrollLeft:0,scrollTop:0},u=ti(1);const d=ti(0);if((o||!o&&r!=="fixed")&&((ei(n)!=="body"||du(s))&&(i=Oh(n)),xs(n))){const p=Di(n);u=Dl(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-i.scrollLeft*u.x+d.x,y:t.y*u.y-i.scrollTop*u.y+d.y}},getDocumentElement:fa,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?function(d,p){const h=p.get(d);if(h)return h;let m=bp(d).filter(w=>da(w)&&ei(w)!=="body"),v=null;const b=Gs(d).position==="fixed";let S=b?Ll(d):d;for(;da(S)&&!Eh(S);){const w=Gs(S),C=z0(S);C||w.position!=="fixed"||(v=null),(b?!C&&!v:!C&&w.position==="static"&&v&&["absolute","fixed"].includes(v.position)||du(S)&&!C&&gP(d,S))?m=m.filter(_=>_!==S):v=w,S=Ll(S)}return p.set(d,m),m}(t,this._c):[].concat(n),r],i=s[0],u=s.reduce((d,p)=>{const h=mS(t,p,o);return d.top=Ml(h.top,d.top),d.right=L0(h.right,d.right),d.bottom=L0(h.bottom,d.bottom),d.left=Ml(h.left,d.left),d},mS(t,i,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}},getOffsetParent:vS,getElementRects:async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||vS,s=this.getDimensions;return{reference:tU(t,await o(n),r),floating:{x:0,y:0,...await s(n)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){return fP(e)},getScale:Dl,isElement:da,isRTL:function(e){return getComputedStyle(e).direction==="rtl"}};function rU(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,p=R1(e),h=o||s?[...p?bp(p):[],...bp(t)]:[];h.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const m=p&&u?function(C,_){let k,j=null;const E=fa(C);function I(){clearTimeout(k),j&&j.disconnect(),j=null}return function O(R,T){R===void 0&&(R=!1),T===void 0&&(T=1),I();const{left:A,top:z,width:$,height:ee}=C.getBoundingClientRect();if(R||_(),!$||!ee)return;const B={rootMargin:-tf(z)+"px "+-tf(E.clientWidth-(A+$))+"px "+-tf(E.clientHeight-(z+ee))+"px "+-tf(A)+"px",threshold:Ml(0,L0(1,T))||1};let H=!0;function G(K){const M=K[0].intersectionRatio;if(M!==T){if(!H)return O();M?O(!1,M):k=setTimeout(()=>{O(!1,1e-7)},100)}H=!1}try{j=new IntersectionObserver(G,{...B,root:E.ownerDocument})}catch{j=new IntersectionObserver(G,B)}j.observe(C)}(!0),I}(p,n):null;let v,b=-1,S=null;i&&(S=new ResizeObserver(C=>{let[_]=C;_&&_.target===p&&S&&(S.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{S&&S.observe(t)})),n()}),p&&!d&&S.observe(p),S.observe(t));let w=d?Di(e):null;return d&&function C(){const _=Di(e);!w||_.x===w.x&&_.y===w.y&&_.width===w.width&&_.height===w.height||n(),w=_,v=requestAnimationFrame(C)}(),n(),()=>{h.forEach(C=>{o&&C.removeEventListener("scroll",n),s&&C.removeEventListener("resize",n)}),m&&m(),S&&S.disconnect(),S=null,d&&cancelAnimationFrame(v)}}const oU=(e,t,n)=>{const r=new Map,o={platform:nU,...n},s={...o.platform,_c:r};return HV(e,t,{...o,platform:s})},sU=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?fS({element:t.current,padding:n}).fn(o):{}:t?fS({element:t,padding:n}).fn(o):{}}}};var bf=typeof document<"u"?f.useLayoutEffect:f.useEffect;function xp(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(!xp(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)&&!xp(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function yS(e){const t=f.useRef(e);return bf(()=>{t.current=e}),t}function aU(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:s,open:i}=e,[u,d]=f.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=f.useState(r);xp(p,r)||h(r);const m=f.useRef(null),v=f.useRef(null),b=f.useRef(u),S=yS(s),w=yS(o),[C,_]=f.useState(null),[k,j]=f.useState(null),E=f.useCallback(z=>{m.current!==z&&(m.current=z,_(z))},[]),I=f.useCallback(z=>{v.current!==z&&(v.current=z,j(z))},[]),O=f.useCallback(()=>{if(!m.current||!v.current)return;const z={placement:t,strategy:n,middleware:p};w.current&&(z.platform=w.current),oU(m.current,v.current,z).then($=>{const ee={...$,isPositioned:!0};R.current&&!xp(b.current,ee)&&(b.current=ee,Xl.flushSync(()=>{d(ee)}))})},[p,t,n,w]);bf(()=>{i===!1&&b.current.isPositioned&&(b.current.isPositioned=!1,d(z=>({...z,isPositioned:!1})))},[i]);const R=f.useRef(!1);bf(()=>(R.current=!0,()=>{R.current=!1}),[]),bf(()=>{if(C&&k){if(S.current)return S.current(C,k,O);O()}},[C,k,O,S]);const T=f.useMemo(()=>({reference:m,floating:v,setReference:E,setFloating:I}),[E,I]),A=f.useMemo(()=>({reference:C,floating:k}),[C,k]);return f.useMemo(()=>({...u,update:O,refs:T,elements:A,reference:E,floating:I}),[u,O,T,A,E,I])}var iU=typeof document<"u"?f.useLayoutEffect:f.useEffect;function lU(){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 cU=f.createContext(null),uU=()=>f.useContext(cU);function dU(e){return(e==null?void 0:e.ownerDocument)||document}function fU(e){return dU(e).defaultView||window}function nf(e){return e?e instanceof fU(e).Element:!1}const pU=dv["useInsertionEffect".toString()],hU=pU||(e=>e());function mU(e){const t=f.useRef(()=>{});return hU(()=>{t.current=e}),f.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;olU())[0],[p,h]=f.useState(null),m=f.useCallback(_=>{const k=nf(_)?{getBoundingClientRect:()=>_.getBoundingClientRect(),contextElement:_}:_;o.refs.setReference(k)},[o.refs]),v=f.useCallback(_=>{(nf(_)||_===null)&&(i.current=_,h(_)),(nf(o.refs.reference.current)||o.refs.reference.current===null||_!==null&&!nf(_))&&o.refs.setReference(_)},[o.refs]),b=f.useMemo(()=>({...o.refs,setReference:v,setPositionReference:m,domReference:i}),[o.refs,v,m]),S=f.useMemo(()=>({...o.elements,domReference:p}),[o.elements,p]),w=mU(n),C=f.useMemo(()=>({...o,refs:b,elements:S,dataRef:u,nodeId:r,events:d,open:t,onOpenChange:w}),[o,r,d,t,w,b,S]);return iU(()=>{const _=s==null?void 0:s.nodesRef.current.find(k=>k.id===r);_&&(_.context=C)}),f.useMemo(()=>({...o,context:C,refs:b,reference:v,positionReference:m}),[o,b,C,v,m])}function vU({opened:e,floating:t,position:n,positionDependencies:r}){const[o,s]=f.useState(0);f.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return rU(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),hs(()=>{t.update()},r),hs(()=>{s(i=>i+1)},[e])}function yU(e){const t=[YV(e.offset)];return e.middlewares.shift&&t.push(QV({limiter:XV()})),e.middlewares.flip&&t.push(qV()),e.middlewares.inline&&t.push(KV()),t.push(sU({element:e.arrowRef,padding:e.arrowOffset})),t}function bU(e){const[t,n]=uu({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,u;t?((i=e.onClose)==null||i.call(e),n(!1)):((u=e.onOpen)==null||u.call(e),n(!0))},s=gU({placement:e.position,middleware:[...yU(e),...e.width==="target"?[JV({apply({rects:i}){var u,d;Object.assign((d=(u=s.refs.floating.current)==null?void 0:u.style)!=null?d:{},{width:`${i.reference.width}px`})}})]:[]]});return vU({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies,floating:s}),hs(()=>{var i;(i=e.onPositionChange)==null||i.call(e,s.placement)},[s.placement]),hs(()=>{var i,u;e.opened?(u=e.onOpen)==null||u.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 vP={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"},[xU,yP]=iF(vP.context);var wU=Object.defineProperty,SU=Object.defineProperties,CU=Object.getOwnPropertyDescriptors,wp=Object.getOwnPropertySymbols,bP=Object.prototype.hasOwnProperty,xP=Object.prototype.propertyIsEnumerable,bS=(e,t,n)=>t in e?wU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rf=(e,t)=>{for(var n in t||(t={}))bP.call(t,n)&&bS(e,n,t[n]);if(wp)for(var n of wp(t))xP.call(t,n)&&bS(e,n,t[n]);return e},_U=(e,t)=>SU(e,CU(t)),kU=(e,t)=>{var n={};for(var r in e)bP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&wp)for(var r of wp(e))t.indexOf(r)<0&&xP.call(e,r)&&(n[r]=e[r]);return n};const PU={refProp:"ref",popupType:"dialog"},wP=f.forwardRef((e,t)=>{const n=gr("PopoverTarget",PU,e),{children:r,refProp:o,popupType:s}=n,i=kU(n,["children","refProp","popupType"]);if(!Y_(r))throw new Error(vP.children);const u=i,d=yP(),p=zu(d.reference,r.ref,t),h=d.withRoles?{"aria-haspopup":s,"aria-expanded":d.opened,"aria-controls":d.getDropdownId(),id:d.getTargetId()}:{};return f.cloneElement(r,rf(_U(rf(rf(rf({},u),h),d.targetProps),{className:X_(d.targetProps.className,u.className,r.props.className),[o]:p}),d.controlled?null:{onClick:d.onToggle}))});wP.displayName="@mantine/core/PopoverTarget";var jU=Zr((e,{radius:t,shadow:n})=>({dropdown:{position:"absolute",backgroundColor:e.white,background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${$e(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:`${$e(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,zIndex:1}}));const IU=jU;var EU=Object.defineProperty,xS=Object.getOwnPropertySymbols,OU=Object.prototype.hasOwnProperty,RU=Object.prototype.propertyIsEnumerable,wS=(e,t,n)=>t in e?EU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dl=(e,t)=>{for(var n in t||(t={}))OU.call(t,n)&&wS(e,n,t[n]);if(xS)for(var n of xS(t))RU.call(t,n)&&wS(e,n,t[n]);return e};const SS={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function MU({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in Yd?dl(dl(dl({transitionProperty:Yd[e].transitionProperty},o),Yd[e].common),Yd[e][SS[t]]):null:dl(dl(dl({transitionProperty:e.transitionProperty},o),e.common),e[SS[t]])}function DU({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:i,onExited:u}){const d=Ca(),p=ok(),h=d.respectReducedMotion?p:!1,[m,v]=f.useState(h?0:e),[b,S]=f.useState(r?"entered":"exited"),w=f.useRef(-1),C=_=>{const k=_?o:s,j=_?i:u;S(_?"pre-entering":"pre-exiting"),window.clearTimeout(w.current);const E=h?0:_?e:t;if(v(E),E===0)typeof k=="function"&&k(),typeof j=="function"&&j(),S(_?"entered":"exited");else{const I=window.setTimeout(()=>{typeof k=="function"&&k(),S(_?"entering":"exiting")},10);w.current=window.setTimeout(()=>{window.clearTimeout(I),typeof j=="function"&&j(),S(_?"entered":"exited")},E)}};return hs(()=>{C(r)},[r]),f.useEffect(()=>()=>window.clearTimeout(w.current),[]),{transitionDuration:m,transitionStatus:b,transitionTimingFunction:n||d.transitionTimingFunction}}function SP({keepMounted:e,transition:t,duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:i,onExit:u,onEntered:d,onEnter:p,onExited:h}){const{transitionDuration:m,transitionStatus:v,transitionTimingFunction:b}=DU({mounted:o,exitDuration:r,duration:n,timingFunction:i,onExit:u,onEntered:d,onEnter:p,onExited:h});return m===0?o?N.createElement(N.Fragment,null,s({})):e?s({display:"none"}):null:v==="exited"?e?s({display:"none"}):null:N.createElement(N.Fragment,null,s(MU({transition:t,duration:m,state:v,timingFunction:b})))}SP.displayName="@mantine/core/Transition";function CP({children:e,active:t=!0,refProp:n="ref"}){const r=FF(t),o=zu(r,e==null?void 0:e.ref);return Y_(e)?f.cloneElement(e,{[n]:o}):e}CP.displayName="@mantine/core/FocusTrap";var TU=Object.defineProperty,AU=Object.defineProperties,NU=Object.getOwnPropertyDescriptors,CS=Object.getOwnPropertySymbols,$U=Object.prototype.hasOwnProperty,zU=Object.prototype.propertyIsEnumerable,_S=(e,t,n)=>t in e?TU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Aa=(e,t)=>{for(var n in t||(t={}))$U.call(t,n)&&_S(e,n,t[n]);if(CS)for(var n of CS(t))zU.call(t,n)&&_S(e,n,t[n]);return e},of=(e,t)=>AU(e,NU(t));function kS(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function PS(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 LU={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function BU({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:i,dir:u}){const[d,p="center"]=e.split("-"),h={width:$e(t),height:$e(t),transform:"rotate(45deg)",position:"absolute",[LU[d]]:$e(r)},m=$e(-t/2);return d==="left"?of(Aa(Aa({},h),kS(p,i,n,o)),{right:m,borderLeftColor:"transparent",borderBottomColor:"transparent"}):d==="right"?of(Aa(Aa({},h),kS(p,i,n,o)),{left:m,borderRightColor:"transparent",borderTopColor:"transparent"}):d==="top"?of(Aa(Aa({},h),PS(p,s,n,o,u)),{bottom:m,borderTopColor:"transparent",borderLeftColor:"transparent"}):d==="bottom"?of(Aa(Aa({},h),PS(p,s,n,o,u)),{top:m,borderBottomColor:"transparent",borderRightColor:"transparent"}):{}}var FU=Object.defineProperty,HU=Object.defineProperties,WU=Object.getOwnPropertyDescriptors,Sp=Object.getOwnPropertySymbols,_P=Object.prototype.hasOwnProperty,kP=Object.prototype.propertyIsEnumerable,jS=(e,t,n)=>t in e?FU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,VU=(e,t)=>{for(var n in t||(t={}))_P.call(t,n)&&jS(e,n,t[n]);if(Sp)for(var n of Sp(t))kP.call(t,n)&&jS(e,n,t[n]);return e},UU=(e,t)=>HU(e,WU(t)),GU=(e,t)=>{var n={};for(var r in e)_P.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Sp)for(var r of Sp(e))t.indexOf(r)<0&&kP.call(e,r)&&(n[r]=e[r]);return n};const PP=f.forwardRef((e,t)=>{var n=e,{position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:u,visible:d,arrowX:p,arrowY:h}=n,m=GU(n,["position","arrowSize","arrowOffset","arrowRadius","arrowPosition","visible","arrowX","arrowY"]);const v=Ca();return d?N.createElement("div",UU(VU({},m),{ref:t,style:BU({position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:u,dir:v.dir,arrowX:p,arrowY:h})})):null});PP.displayName="@mantine/core/FloatingArrow";var qU=Object.defineProperty,KU=Object.defineProperties,YU=Object.getOwnPropertyDescriptors,Cp=Object.getOwnPropertySymbols,jP=Object.prototype.hasOwnProperty,IP=Object.prototype.propertyIsEnumerable,IS=(e,t,n)=>t in e?qU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fl=(e,t)=>{for(var n in t||(t={}))jP.call(t,n)&&IS(e,n,t[n]);if(Cp)for(var n of Cp(t))IP.call(t,n)&&IS(e,n,t[n]);return e},sf=(e,t)=>KU(e,YU(t)),QU=(e,t)=>{var n={};for(var r in e)jP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Cp)for(var r of Cp(e))t.indexOf(r)<0&&IP.call(e,r)&&(n[r]=e[r]);return n};const XU={};function EP(e){var t;const n=gr("PopoverDropdown",XU,e),{style:r,className:o,children:s,onKeyDownCapture:i}=n,u=QU(n,["style","className","children","onKeyDownCapture"]),d=yP(),{classes:p,cx:h}=IU({radius:d.radius,shadow:d.shadow},{name:d.__staticSelector,classNames:d.classNames,styles:d.styles,unstyled:d.unstyled,variant:d.variant}),m=TF({opened:d.opened,shouldReturnFocus:d.returnFocus}),v=d.withRoles?{"aria-labelledby":d.getTargetId(),id:d.getDropdownId(),role:"dialog"}:{};return d.disabled?null:N.createElement(Ek,sf(fl({},d.portalProps),{withinPortal:d.withinPortal}),N.createElement(SP,sf(fl({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 S,w;return N.createElement(CP,{active:d.trapFocus},N.createElement(xo,fl(sf(fl({},v),{tabIndex:-1,ref:d.floating,style:sf(fl(fl({},r),b),{zIndex:d.zIndex,top:(S=d.y)!=null?S:0,left:(w=d.x)!=null?w:0,width:d.width==="target"?void 0:$e(d.width)}),className:h(p.dropdown,o),onKeyDownCapture:cF(d.onClose,{active:d.closeOnEscape,onTrigger:m,onKeyDown:i}),"data-position":d.placement}),u),s,N.createElement(PP,{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})))}))}EP.displayName="@mantine/core/PopoverDropdown";function JU(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 ES=Object.getOwnPropertySymbols,ZU=Object.prototype.hasOwnProperty,eG=Object.prototype.propertyIsEnumerable,tG=(e,t)=>{var n={};for(var r in e)ZU.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ES)for(var r of ES(e))t.indexOf(r)<0&&eG.call(e,r)&&(n[r]=e[r]);return n};const nG={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:w1("popover"),__staticSelector:"Popover",width:"max-content"};function ic(e){var t,n,r,o,s,i;const u=f.useRef(null),d=gr("Popover",nG,e),{children:p,position:h,offset:m,onPositionChange:v,positionDependencies:b,opened:S,transitionProps:w,width:C,middlewares:_,withArrow:k,arrowSize:j,arrowOffset:E,arrowRadius:I,arrowPosition:O,unstyled:R,classNames:T,styles:A,closeOnClickOutside:z,withinPortal:$,portalProps:ee,closeOnEscape:B,clickOutsideEvents:H,trapFocus:G,onClose:K,onOpen:M,onChange:U,zIndex:V,radius:J,shadow:ie,id:xe,defaultOpened:he,__staticSelector:ae,withRoles:Z,disabled:W,returnFocus:re,variant:pe,keepMounted:ne}=d,ge=tG(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"]),[ue,Ce]=f.useState(null),[Me,me]=f.useState(null),_e=C1(xe),We=Ca(),Le=bU({middlewares:_,width:C,position:JU(We.dir,h),offset:typeof m=="number"?m+(k?j/2:0):m,arrowRef:u,arrowOffset:E,onPositionChange:v,positionDependencies:b,opened:S,defaultOpened:he,onChange:U,onOpen:M,onClose:K});OF(()=>Le.opened&&z&&Le.onClose(),H,[ue,Me]);const Ue=f.useCallback(gt=>{Ce(gt),Le.floating.reference(gt)},[Le.floating.reference]),kt=f.useCallback(gt=>{me(gt),Le.floating.floating(gt)},[Le.floating.floating]);return N.createElement(xU,{value:{returnFocus:re,disabled:W,controlled:Le.controlled,reference:Ue,floating:kt,x:Le.floating.x,y:Le.floating.y,arrowX:(r=(n=(t=Le.floating)==null?void 0:t.middlewareData)==null?void 0:n.arrow)==null?void 0:r.x,arrowY:(i=(s=(o=Le.floating)==null?void 0:o.middlewareData)==null?void 0:s.arrow)==null?void 0:i.y,opened:Le.opened,arrowRef:u,transitionProps:w,width:C,withArrow:k,arrowSize:j,arrowOffset:E,arrowRadius:I,arrowPosition:O,placement:Le.floating.placement,trapFocus:G,withinPortal:$,portalProps:ee,zIndex:V,radius:J,shadow:ie,closeOnEscape:B,onClose:Le.onClose,onToggle:Le.onToggle,getTargetId:()=>`${_e}-target`,getDropdownId:()=>`${_e}-dropdown`,withRoles:Z,targetProps:ge,__staticSelector:ae,classNames:T,styles:A,unstyled:R,variant:pe,keepMounted:ne}},p)}ic.Target=wP;ic.Dropdown=EP;ic.displayName="@mantine/core/Popover";var rG=Object.defineProperty,_p=Object.getOwnPropertySymbols,OP=Object.prototype.hasOwnProperty,RP=Object.prototype.propertyIsEnumerable,OS=(e,t,n)=>t in e?rG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oG=(e,t)=>{for(var n in t||(t={}))OP.call(t,n)&&OS(e,n,t[n]);if(_p)for(var n of _p(t))RP.call(t,n)&&OS(e,n,t[n]);return e},sG=(e,t)=>{var n={};for(var r in e)OP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_p)for(var r of _p(e))t.indexOf(r)<0&&RP.call(e,r)&&(n[r]=e[r]);return n};function aG(e){var t=e,{children:n,component:r="div",maxHeight:o=220,direction:s="column",id:i,innerRef:u,__staticSelector:d,styles:p,classNames:h,unstyled:m}=t,v=sG(t,["children","component","maxHeight","direction","id","innerRef","__staticSelector","styles","classNames","unstyled"]);const{classes:b}=FV(null,{name:d,styles:p,classNames:h,unstyled:m});return N.createElement(ic.Dropdown,oG({p:0,onMouseDown:S=>S.preventDefault()},v),N.createElement("div",{style:{maxHeight:$e(o),display:"flex"}},N.createElement(xo,{component:r||"div",id:`${i}-items`,"aria-labelledby":`${i}-label`,role:"listbox",onMouseDown:S=>S.preventDefault(),style:{flex:1,overflowY:r!==Ih?"auto":void 0},"data-combobox-popover":!0,tabIndex:-1,ref:u},N.createElement("div",{className:b.itemsWrapper,style:{flexDirection:s}},n))))}function Qa({opened:e,transitionProps:t={transition:"fade",duration:0},shadow:n,withinPortal:r,portalProps:o,children:s,__staticSelector:i,onDirectionChange:u,switchDirectionOnFlip:d,zIndex:p,dropdownPosition:h,positionDependencies:m=[],classNames:v,styles:b,unstyled:S,readOnly:w,variant:C}){return N.createElement(ic,{unstyled:S,classNames:v,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:w,onPositionChange:_=>d&&(u==null?void 0:u(_==="top"?"column-reverse":"column")),variant:C},s)}Qa.Target=ic.Target;Qa.Dropdown=aG;var iG=Object.defineProperty,lG=Object.defineProperties,cG=Object.getOwnPropertyDescriptors,kp=Object.getOwnPropertySymbols,MP=Object.prototype.hasOwnProperty,DP=Object.prototype.propertyIsEnumerable,RS=(e,t,n)=>t in e?iG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,af=(e,t)=>{for(var n in t||(t={}))MP.call(t,n)&&RS(e,n,t[n]);if(kp)for(var n of kp(t))DP.call(t,n)&&RS(e,n,t[n]);return e},uG=(e,t)=>lG(e,cG(t)),dG=(e,t)=>{var n={};for(var r in e)MP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&kp)for(var r of kp(e))t.indexOf(r)<0&&DP.call(e,r)&&(n[r]=e[r]);return n};function TP(e,t,n){const r=gr(e,t,n),{label:o,description:s,error:i,required:u,classNames:d,styles:p,className:h,unstyled:m,__staticSelector:v,sx:b,errorProps:S,labelProps:w,descriptionProps:C,wrapperProps:_,id:k,size:j,style:E,inputContainer:I,inputWrapperOrder:O,withAsterisk:R,variant:T}=r,A=dG(r,["label","description","error","required","classNames","styles","className","unstyled","__staticSelector","sx","errorProps","labelProps","descriptionProps","wrapperProps","id","size","style","inputContainer","inputWrapperOrder","withAsterisk","variant"]),z=C1(k),{systemStyles:$,rest:ee}=_h(A),B=af({label:o,description:s,error:i,required:u,classNames:d,className:h,__staticSelector:v,sx:b,errorProps:S,labelProps:w,descriptionProps:C,unstyled:m,styles:p,id:z,size:j,style:E,inputContainer:I,inputWrapperOrder:O,withAsterisk:R,variant:T},_);return uG(af({},ee),{classNames:d,styles:p,unstyled:m,wrapperProps:af(af({},B),$),inputProps:{required:u,classNames:d,styles:p,unstyled:m,id:z,size:j,__staticSelector:v,error:i,variant:T}})}var fG=Zr((e,t,{size:n})=>({label:{display:"inline-block",fontSize:At({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 pG=fG;var hG=Object.defineProperty,Pp=Object.getOwnPropertySymbols,AP=Object.prototype.hasOwnProperty,NP=Object.prototype.propertyIsEnumerable,MS=(e,t,n)=>t in e?hG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mG=(e,t)=>{for(var n in t||(t={}))AP.call(t,n)&&MS(e,n,t[n]);if(Pp)for(var n of Pp(t))NP.call(t,n)&&MS(e,n,t[n]);return e},gG=(e,t)=>{var n={};for(var r in e)AP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Pp)for(var r of Pp(e))t.indexOf(r)<0&&NP.call(e,r)&&(n[r]=e[r]);return n};const vG={labelElement:"label",size:"sm"},M1=f.forwardRef((e,t)=>{const n=gr("InputLabel",vG,e),{labelElement:r,children:o,required:s,size:i,classNames:u,styles:d,unstyled:p,className:h,htmlFor:m,__staticSelector:v,variant:b,onMouseDown:S}=n,w=gG(n,["labelElement","children","required","size","classNames","styles","unstyled","className","htmlFor","__staticSelector","variant","onMouseDown"]),{classes:C,cx:_}=pG(null,{name:["InputWrapper",v],classNames:u,styles:d,unstyled:p,variant:b,size:i});return N.createElement(xo,mG({component:r,ref:t,className:_(C.label,h),htmlFor:r==="label"?m:void 0,onMouseDown:k=>{S==null||S(k),!k.defaultPrevented&&k.detail>1&&k.preventDefault()}},w),o,s&&N.createElement("span",{className:C.required,"aria-hidden":!0}," *"))});M1.displayName="@mantine/core/InputLabel";var yG=Zr((e,t,{size:n})=>({error:{wordBreak:"break-word",color:e.fn.variant({variant:"filled",color:"red"}).background,fontSize:`calc(${At({size:n,sizes:e.fontSizes})} - ${$e(2)})`,lineHeight:1.2,display:"block"}}));const bG=yG;var xG=Object.defineProperty,jp=Object.getOwnPropertySymbols,$P=Object.prototype.hasOwnProperty,zP=Object.prototype.propertyIsEnumerable,DS=(e,t,n)=>t in e?xG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wG=(e,t)=>{for(var n in t||(t={}))$P.call(t,n)&&DS(e,n,t[n]);if(jp)for(var n of jp(t))zP.call(t,n)&&DS(e,n,t[n]);return e},SG=(e,t)=>{var n={};for(var r in e)$P.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&jp)for(var r of jp(e))t.indexOf(r)<0&&zP.call(e,r)&&(n[r]=e[r]);return n};const CG={size:"sm"},D1=f.forwardRef((e,t)=>{const n=gr("InputError",CG,e),{children:r,className:o,classNames:s,styles:i,unstyled:u,size:d,__staticSelector:p,variant:h}=n,m=SG(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:v,cx:b}=bG(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:u,variant:h,size:d});return N.createElement(Nl,wG({className:b(v.error,o),ref:t},m),r)});D1.displayName="@mantine/core/InputError";var _G=Zr((e,t,{size:n})=>({description:{wordBreak:"break-word",color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontSize:`calc(${At({size:n,sizes:e.fontSizes})} - ${$e(2)})`,lineHeight:1.2,display:"block"}}));const kG=_G;var PG=Object.defineProperty,Ip=Object.getOwnPropertySymbols,LP=Object.prototype.hasOwnProperty,BP=Object.prototype.propertyIsEnumerable,TS=(e,t,n)=>t in e?PG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jG=(e,t)=>{for(var n in t||(t={}))LP.call(t,n)&&TS(e,n,t[n]);if(Ip)for(var n of Ip(t))BP.call(t,n)&&TS(e,n,t[n]);return e},IG=(e,t)=>{var n={};for(var r in e)LP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ip)for(var r of Ip(e))t.indexOf(r)<0&&BP.call(e,r)&&(n[r]=e[r]);return n};const EG={size:"sm"},T1=f.forwardRef((e,t)=>{const n=gr("InputDescription",EG,e),{children:r,className:o,classNames:s,styles:i,unstyled:u,size:d,__staticSelector:p,variant:h}=n,m=IG(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:v,cx:b}=kG(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:u,variant:h,size:d});return N.createElement(Nl,jG({color:"dimmed",className:b(v.description,o),ref:t,unstyled:u},m),r)});T1.displayName="@mantine/core/InputDescription";const FP=f.createContext({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),OG=FP.Provider,RG=()=>f.useContext(FP);function MG(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 DG=Object.defineProperty,TG=Object.defineProperties,AG=Object.getOwnPropertyDescriptors,AS=Object.getOwnPropertySymbols,NG=Object.prototype.hasOwnProperty,$G=Object.prototype.propertyIsEnumerable,NS=(e,t,n)=>t in e?DG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zG=(e,t)=>{for(var n in t||(t={}))NG.call(t,n)&&NS(e,n,t[n]);if(AS)for(var n of AS(t))$G.call(t,n)&&NS(e,n,t[n]);return e},LG=(e,t)=>TG(e,AG(t)),BG=Zr(e=>({root:LG(zG({},e.fn.fontStyles()),{lineHeight:e.lineHeight})}));const FG=BG;var HG=Object.defineProperty,WG=Object.defineProperties,VG=Object.getOwnPropertyDescriptors,Ep=Object.getOwnPropertySymbols,HP=Object.prototype.hasOwnProperty,WP=Object.prototype.propertyIsEnumerable,$S=(e,t,n)=>t in e?HG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Na=(e,t)=>{for(var n in t||(t={}))HP.call(t,n)&&$S(e,n,t[n]);if(Ep)for(var n of Ep(t))WP.call(t,n)&&$S(e,n,t[n]);return e},zS=(e,t)=>WG(e,VG(t)),UG=(e,t)=>{var n={};for(var r in e)HP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ep)for(var r of Ep(e))t.indexOf(r)<0&&WP.call(e,r)&&(n[r]=e[r]);return n};const GG={labelElement:"label",size:"sm",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},VP=f.forwardRef((e,t)=>{const n=gr("InputWrapper",GG,e),{className:r,label:o,children:s,required:i,id:u,error:d,description:p,labelElement:h,labelProps:m,descriptionProps:v,errorProps:b,classNames:S,styles:w,size:C,inputContainer:_,__staticSelector:k,unstyled:j,inputWrapperOrder:E,withAsterisk:I,variant:O}=n,R=UG(n,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","inputContainer","__staticSelector","unstyled","inputWrapperOrder","withAsterisk","variant"]),{classes:T,cx:A}=FG(null,{classNames:S,styles:w,name:["InputWrapper",k],unstyled:j,variant:O,size:C}),z={classNames:S,styles:w,unstyled:j,size:C,variant:O,__staticSelector:k},$=typeof I=="boolean"?I:i,ee=u?`${u}-error`:b==null?void 0:b.id,B=u?`${u}-description`:v==null?void 0:v.id,G=`${!!d&&typeof d!="boolean"?ee:""} ${p?B:""}`,K=G.trim().length>0?G.trim():void 0,M=o&&N.createElement(M1,Na(Na({key:"label",labelElement:h,id:u?`${u}-label`:void 0,htmlFor:u,required:$},z),m),o),U=p&&N.createElement(T1,zS(Na(Na({key:"description"},v),z),{size:(v==null?void 0:v.size)||z.size,id:(v==null?void 0:v.id)||B}),p),V=N.createElement(f.Fragment,{key:"input"},_(s)),J=typeof d!="boolean"&&d&&N.createElement(D1,zS(Na(Na({},b),z),{size:(b==null?void 0:b.size)||z.size,key:"error",id:(b==null?void 0:b.id)||ee}),d),ie=E.map(xe=>{switch(xe){case"label":return M;case"input":return V;case"description":return U;case"error":return J;default:return null}});return N.createElement(OG,{value:Na({describedBy:K},MG(E,{hasDescription:!!U,hasError:!!J}))},N.createElement(xo,Na({className:A(T.root,r),ref:t},R),ie))});VP.displayName="@mantine/core/InputWrapper";var qG=Object.defineProperty,Op=Object.getOwnPropertySymbols,UP=Object.prototype.hasOwnProperty,GP=Object.prototype.propertyIsEnumerable,LS=(e,t,n)=>t in e?qG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,KG=(e,t)=>{for(var n in t||(t={}))UP.call(t,n)&&LS(e,n,t[n]);if(Op)for(var n of Op(t))GP.call(t,n)&&LS(e,n,t[n]);return e},YG=(e,t)=>{var n={};for(var r in e)UP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Op)for(var r of Op(e))t.indexOf(r)<0&&GP.call(e,r)&&(n[r]=e[r]);return n};const QG={},qP=f.forwardRef((e,t)=>{const n=gr("InputPlaceholder",QG,e),{sx:r}=n,o=YG(n,["sx"]);return N.createElement(xo,KG({component:"span",sx:[s=>s.fn.placeholderStyles(),...q_(r)],ref:t},o))});qP.displayName="@mantine/core/InputPlaceholder";var XG=Object.defineProperty,JG=Object.defineProperties,ZG=Object.getOwnPropertyDescriptors,BS=Object.getOwnPropertySymbols,eq=Object.prototype.hasOwnProperty,tq=Object.prototype.propertyIsEnumerable,FS=(e,t,n)=>t in e?XG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lf=(e,t)=>{for(var n in t||(t={}))eq.call(t,n)&&FS(e,n,t[n]);if(BS)for(var n of BS(t))tq.call(t,n)&&FS(e,n,t[n]);return e},Eg=(e,t)=>JG(e,ZG(t));const Wo={xs:$e(30),sm:$e(36),md:$e(42),lg:$e(50),xl:$e(60)},nq=["default","filled","unstyled"];function rq({theme:e,variant:t}){return nq.includes(t)?t==="default"?{border:`${$e(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:`${$e(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:$e(28),outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}}:null}var oq=Zr((e,{multiline:t,radius:n,invalid:r,rightSectionWidth:o,withRightSection:s,iconWidth:i,offsetBottom:u,offsetTop:d,pointer:p},{variant:h,size:m})=>{const v=e.fn.variant({variant:"filled",color:"red"}).background,b=h==="default"||h==="filled"?{minHeight:At({size:m,sizes:Wo}),paddingLeft:`calc(${At({size:m,sizes:Wo})} / 3)`,paddingRight:s?o||At({size:m,sizes:Wo}):`calc(${At({size:m,sizes:Wo})} / 3)`,borderRadius:e.fn.radius(n)}:h==="unstyled"&&s?{paddingRight:o||At({size:m,sizes:Wo})}:null;return{wrapper:{position:"relative",marginTop:d?`calc(${e.spacing.xs} / 2)`:void 0,marginBottom:u?`calc(${e.spacing.xs} / 2)`:void 0,"&:has(input:disabled)":{"& .mantine-Input-rightSection":{display:"none"}}},input:Eg(lf(lf(Eg(lf({},e.fn.fontStyles()),{height:t?h==="unstyled"?void 0:"auto":At({size:m,sizes:Wo}),WebkitTapHighlightColor:"transparent",lineHeight:t?e.lineHeight:`calc(${At({size:m,sizes:Wo})} - ${$e(2)})`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:At({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}),rq({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:v,borderColor:v,"&::placeholder":{opacity:1,color:v}},"&[data-with-icon]":{paddingLeft:typeof i=="number"?$e(i):At({size:m,sizes:Wo})},"&::placeholder":Eg(lf({},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?$e(i):At({size:m,sizes:Wo}),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||At({size:m,sizes:Wo})}}});const sq=oq;var aq=Object.defineProperty,iq=Object.defineProperties,lq=Object.getOwnPropertyDescriptors,Rp=Object.getOwnPropertySymbols,KP=Object.prototype.hasOwnProperty,YP=Object.prototype.propertyIsEnumerable,HS=(e,t,n)=>t in e?aq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cf=(e,t)=>{for(var n in t||(t={}))KP.call(t,n)&&HS(e,n,t[n]);if(Rp)for(var n of Rp(t))YP.call(t,n)&&HS(e,n,t[n]);return e},WS=(e,t)=>iq(e,lq(t)),cq=(e,t)=>{var n={};for(var r in e)KP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Rp)for(var r of Rp(e))t.indexOf(r)<0&&YP.call(e,r)&&(n[r]=e[r]);return n};const uq={size:"sm",variant:"default"},Hi=f.forwardRef((e,t)=>{const n=gr("Input",uq,e),{className:r,error:o,required:s,disabled:i,variant:u,icon:d,style:p,rightSectionWidth:h,iconWidth:m,rightSection:v,rightSectionProps:b,radius:S,size:w,wrapperProps:C,classNames:_,styles:k,__staticSelector:j,multiline:E,sx:I,unstyled:O,pointer:R}=n,T=cq(n,["className","error","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx","unstyled","pointer"]),{offsetBottom:A,offsetTop:z,describedBy:$}=RG(),{classes:ee,cx:B}=sq({radius:S,multiline:E,invalid:!!o,rightSectionWidth:h?$e(h):void 0,iconWidth:m,withRightSection:!!v,offsetBottom:A,offsetTop:z,pointer:R},{classNames:_,styles:k,name:["Input",j],unstyled:O,variant:u,size:w}),{systemStyles:H,rest:G}=_h(T);return N.createElement(xo,cf(cf({className:B(ee.wrapper,r),sx:I,style:p},H),C),d&&N.createElement("div",{className:ee.icon},d),N.createElement(xo,WS(cf({component:"input"},G),{ref:t,required:s,"aria-invalid":!!o,"aria-describedby":$,disabled:i,"data-disabled":i||void 0,"data-with-icon":!!d||void 0,"data-invalid":!!o||void 0,className:ee.input})),v&&N.createElement("div",WS(cf({},b),{className:ee.rightSection}),v))});Hi.displayName="@mantine/core/Input";Hi.Wrapper=VP;Hi.Label=M1;Hi.Description=T1;Hi.Error=D1;Hi.Placeholder=qP;const Bl=Hi;var dq=Object.defineProperty,Mp=Object.getOwnPropertySymbols,QP=Object.prototype.hasOwnProperty,XP=Object.prototype.propertyIsEnumerable,VS=(e,t,n)=>t in e?dq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,US=(e,t)=>{for(var n in t||(t={}))QP.call(t,n)&&VS(e,n,t[n]);if(Mp)for(var n of Mp(t))XP.call(t,n)&&VS(e,n,t[n]);return e},fq=(e,t)=>{var n={};for(var r in e)QP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mp)for(var r of Mp(e))t.indexOf(r)<0&&XP.call(e,r)&&(n[r]=e[r]);return n};const pq={multiple:!1},JP=f.forwardRef((e,t)=>{const n=gr("FileButton",pq,e),{onChange:r,children:o,multiple:s,accept:i,name:u,form:d,resetRef:p,disabled:h,capture:m,inputProps:v}=n,b=fq(n,["onChange","children","multiple","accept","name","form","resetRef","disabled","capture","inputProps"]),S=f.useRef(),w=()=>{!h&&S.current.click()},C=k=>{r(s?Array.from(k.currentTarget.files):k.currentTarget.files[0]||null)};return rk(p,()=>{S.current.value=""}),N.createElement(N.Fragment,null,o(US({onClick:w},b)),N.createElement("input",US({style:{display:"none"},type:"file",accept:i,multiple:s,onChange:C,ref:zu(t,S),name:u,form:d,capture:m},v)))});JP.displayName="@mantine/core/FileButton";const ZP={xs:$e(16),sm:$e(22),md:$e(26),lg:$e(30),xl:$e(36)},hq={xs:$e(10),sm:$e(12),md:$e(14),lg:$e(16),xl:$e(18)};var mq=Zr((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:At({size:o,sizes:ZP}),paddingLeft:`calc(${At({size:o,sizes:e.spacing})} / 1.5)`,paddingRight:t||r?At({size:o,sizes:e.spacing}):0,fontWeight:500,fontSize:At({size:o,sizes:hq}),borderRadius:At({size:n,sizes:e.radius}),cursor:t?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${$e(10)})`},defaultValueRemove:{color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],marginLeft:`calc(${At({size:o,sizes:e.spacing})} / 6)`},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}));const gq=mq;var vq=Object.defineProperty,Dp=Object.getOwnPropertySymbols,ej=Object.prototype.hasOwnProperty,tj=Object.prototype.propertyIsEnumerable,GS=(e,t,n)=>t in e?vq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yq=(e,t)=>{for(var n in t||(t={}))ej.call(t,n)&&GS(e,n,t[n]);if(Dp)for(var n of Dp(t))tj.call(t,n)&&GS(e,n,t[n]);return e},bq=(e,t)=>{var n={};for(var r in e)ej.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Dp)for(var r of Dp(e))t.indexOf(r)<0&&tj.call(e,r)&&(n[r]=e[r]);return n};const xq={xs:16,sm:22,md:24,lg:26,xl:30};function nj(e){var t=e,{label:n,classNames:r,styles:o,className:s,onRemove:i,disabled:u,readOnly:d,size:p,radius:h="sm",variant:m,unstyled:v}=t,b=bq(t,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:S,cx:w}=gq({disabled:u,readOnly:d,radius:h},{name:"MultiSelect",classNames:r,styles:o,unstyled:v,size:p,variant:m});return N.createElement("div",yq({className:w(S.defaultValue,s)},b),N.createElement("span",{className:S.defaultValueLabel},n),!u&&!d&&N.createElement(Nk,{"aria-hidden":!0,onMouseDown:i,size:xq[p],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:S.defaultValueRemove,tabIndex:-1,unstyled:v}))}nj.displayName="@mantine/core/MultiSelect/DefaultValue";function wq({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 u=[];for(let d=0;dp===e[d].value&&!e[d].disabled),e[d])&&u.push(e[d]),!(u.length>=n));d+=1);return u}var Sq=Object.defineProperty,Tp=Object.getOwnPropertySymbols,rj=Object.prototype.hasOwnProperty,oj=Object.prototype.propertyIsEnumerable,qS=(e,t,n)=>t in e?Sq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,KS=(e,t)=>{for(var n in t||(t={}))rj.call(t,n)&&qS(e,n,t[n]);if(Tp)for(var n of Tp(t))oj.call(t,n)&&qS(e,n,t[n]);return e},Cq=(e,t)=>{var n={};for(var r in e)rj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Tp)for(var r of Tp(e))t.indexOf(r)<0&&oj.call(e,r)&&(n[r]=e[r]);return n};const _q={xs:$e(14),sm:$e(18),md:$e(20),lg:$e(24),xl:$e(28)};function kq(e){var t=e,{size:n,error:r,style:o}=t,s=Cq(t,["size","error","style"]);const i=Ca(),u=At({size:n,sizes:_q});return N.createElement("svg",KS({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:KS({color:r?i.colors.red[6]:i.colors.gray[6],width:u,height:u},o),"data-chevron":!0},s),N.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 Pq=Object.defineProperty,jq=Object.defineProperties,Iq=Object.getOwnPropertyDescriptors,YS=Object.getOwnPropertySymbols,Eq=Object.prototype.hasOwnProperty,Oq=Object.prototype.propertyIsEnumerable,QS=(e,t,n)=>t in e?Pq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rq=(e,t)=>{for(var n in t||(t={}))Eq.call(t,n)&&QS(e,n,t[n]);if(YS)for(var n of YS(t))Oq.call(t,n)&&QS(e,n,t[n]);return e},Mq=(e,t)=>jq(e,Iq(t));function sj({shouldClear:e,clearButtonProps:t,onClear:n,size:r,error:o}){return e?N.createElement(Nk,Mq(Rq({},t),{variant:"transparent",onClick:n,size:r,onMouseDown:s=>s.preventDefault()})):N.createElement(kq,{error:o,size:r})}sj.displayName="@mantine/core/SelectRightSection";var Dq=Object.defineProperty,Tq=Object.defineProperties,Aq=Object.getOwnPropertyDescriptors,Ap=Object.getOwnPropertySymbols,aj=Object.prototype.hasOwnProperty,ij=Object.prototype.propertyIsEnumerable,XS=(e,t,n)=>t in e?Dq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Og=(e,t)=>{for(var n in t||(t={}))aj.call(t,n)&&XS(e,n,t[n]);if(Ap)for(var n of Ap(t))ij.call(t,n)&&XS(e,n,t[n]);return e},JS=(e,t)=>Tq(e,Aq(t)),Nq=(e,t)=>{var n={};for(var r in e)aj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ap)for(var r of Ap(e))t.indexOf(r)<0&&ij.call(e,r)&&(n[r]=e[r]);return n};function lj(e){var t=e,{styles:n,rightSection:r,rightSectionWidth:o,theme:s}=t,i=Nq(t,["styles","rightSection","rightSectionWidth","theme"]);if(r)return{rightSection:r,rightSectionWidth:o,styles:n};const u=typeof n=="function"?n(s):n;return{rightSection:!i.readOnly&&!(i.disabled&&i.shouldClear)&&N.createElement(sj,Og({},i)),styles:JS(Og({},u),{rightSection:JS(Og({},u==null?void 0:u.rightSection),{pointerEvents:i.shouldClear?void 0:"none"})})}}var $q=Object.defineProperty,zq=Object.defineProperties,Lq=Object.getOwnPropertyDescriptors,ZS=Object.getOwnPropertySymbols,Bq=Object.prototype.hasOwnProperty,Fq=Object.prototype.propertyIsEnumerable,eC=(e,t,n)=>t in e?$q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hq=(e,t)=>{for(var n in t||(t={}))Bq.call(t,n)&&eC(e,n,t[n]);if(ZS)for(var n of ZS(t))Fq.call(t,n)&&eC(e,n,t[n]);return e},Wq=(e,t)=>zq(e,Lq(t)),Vq=Zr((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(${At({size:n,sizes:Wo})} - ${$e(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:At({size:n,sizes:Wo})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${$e(2)}) calc(${e.spacing.xs} / 2)`},searchInput:Wq(Hq({},e.fn.fontStyles()),{flex:1,minWidth:$e(60),backgroundColor:"transparent",border:0,outline:0,fontSize:At({size:n,sizes:e.fontSizes}),padding:0,marginLeft:`calc(${e.spacing.xs} / 2)`,appearance:"none",color:"inherit",maxHeight:At({size:n,sizes:ZP}),"&::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 Uq=Vq;var Gq=Object.defineProperty,qq=Object.defineProperties,Kq=Object.getOwnPropertyDescriptors,Np=Object.getOwnPropertySymbols,cj=Object.prototype.hasOwnProperty,uj=Object.prototype.propertyIsEnumerable,tC=(e,t,n)=>t in e?Gq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pl=(e,t)=>{for(var n in t||(t={}))cj.call(t,n)&&tC(e,n,t[n]);if(Np)for(var n of Np(t))uj.call(t,n)&&tC(e,n,t[n]);return e},nC=(e,t)=>qq(e,Kq(t)),Yq=(e,t)=>{var n={};for(var r in e)cj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Np)for(var r of Np(e))t.indexOf(r)<0&&uj.call(e,r)&&(n[r]=e[r]);return n};function Qq(e,t,n){return t?!1:n.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function Xq(e,t){return!!e&&!t.some(n=>n.value.toLowerCase()===e.toLowerCase())}function rC(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 Jq={size:"sm",valueComponent:nj,itemComponent:k1,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:Qq,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:Xq,switchDirectionOnFlip:!1,zIndex:w1("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},dj=f.forwardRef((e,t)=>{const n=gr("MultiSelect",Jq,e),{className:r,style:o,required:s,label:i,description:u,size:d,error:p,classNames:h,styles:m,wrapperProps:v,value:b,defaultValue:S,data:w,onChange:C,valueComponent:_,itemComponent:k,id:j,transitionProps:E,maxDropdownHeight:I,shadow:O,nothingFound:R,onFocus:T,onBlur:A,searchable:z,placeholder:$,filter:ee,limit:B,clearSearchOnChange:H,clearable:G,clearSearchOnBlur:K,variant:M,onSearchChange:U,searchValue:V,disabled:J,initiallyOpened:ie,radius:xe,icon:he,rightSection:ae,rightSectionWidth:Z,creatable:W,getCreateLabel:re,shouldCreate:pe,onCreate:ne,sx:ge,dropdownComponent:ue,onDropdownClose:Ce,onDropdownOpen:Me,maxSelectedValues:me,withinPortal:_e,portalProps:We,switchDirectionOnFlip:Le,zIndex:Ue,selectOnBlur:kt,name:gt,dropdownPosition:Pn,errorProps:Pt,labelProps:yt,descriptionProps:be,form:Te,positionDependencies:It,onKeyDown:Ft,unstyled:Wt,inputContainer:Cn,inputWrapperOrder:En,readOnly:ln,withAsterisk:Sr,clearButtonProps:vn,hoverOnSearchChange:sr,disableSelectedItemFiltering:Ee}=n,at=Yq(n,["className","style","required","label","description","size","error","classNames","styles","wrapperProps","value","defaultValue","data","onChange","valueComponent","itemComponent","id","transitionProps","maxDropdownHeight","shadow","nothingFound","onFocus","onBlur","searchable","placeholder","filter","limit","clearSearchOnChange","clearable","clearSearchOnBlur","variant","onSearchChange","searchValue","disabled","initiallyOpened","radius","icon","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","maxSelectedValues","withinPortal","portalProps","switchDirectionOnFlip","zIndex","selectOnBlur","name","dropdownPosition","errorProps","labelProps","descriptionProps","form","positionDependencies","onKeyDown","unstyled","inputContainer","inputWrapperOrder","readOnly","withAsterisk","clearButtonProps","hoverOnSearchChange","disableSelectedItemFiltering"]),{classes:Ye,cx:rt,theme:Nt}=Uq({invalid:!!p},{name:"MultiSelect",classNames:h,styles:m,unstyled:Wt,size:d,variant:M}),{systemStyles:dr,rest:yn}=_h(at),bn=f.useRef(),zr=f.useRef({}),fr=C1(j),[An,Nn]=f.useState(ie),[$n,Mr]=f.useState(-1),[Co,Lr]=f.useState("column"),[Br,es]=uu({value:V,defaultValue:"",finalValue:void 0,onChange:U}),[Dr,Ps]=f.useState(!1),{scrollIntoView:ts,targetRef:Xs,scrollableRef:js}=sk({duration:0,offset:5,cancelable:!1,isList:!0}),q=W&&typeof re=="function";let Q=null;const le=w.map(Re=>typeof Re=="string"?{label:Re,value:Re}:Re),we=K_({data:le}),[ce,et]=uu({value:rC(b,w),defaultValue:rC(S,w),finalValue:[],onChange:C}),Qe=f.useRef(!!me&&me{if(!ln){const ut=ce.filter(Ct=>Ct!==Re);et(ut),me&&ut.length{es(Re.currentTarget.value),!J&&!Qe.current&&z&&Nn(!0)},dt=Re=>{typeof T=="function"&&T(Re),!J&&!Qe.current&&z&&Nn(!0)},De=wq({data:we,searchable:z,searchValue:Br,limit:B,filter:ee,value:ce,disableSelectedItemFiltering:Ee});q&&pe(Br,we)&&(Q=re(Br),De.push({label:Br,value:Br,creatable:!0}));const ye=Math.min($n,De.length-1),Fe=(Re,ut,Ct)=>{let Tt=Re;for(;Ct(Tt);)if(Tt=ut(Tt),!De[Tt].disabled)return Tt;return Re};hs(()=>{Mr(sr&&Br?0:-1)},[Br,sr]),hs(()=>{!J&&ce.length>w.length&&Nn(!1),me&&ce.length=me&&(Qe.current=!0,Nn(!1))},[ce]);const ht=Re=>{if(!ln)if(H&&es(""),ce.includes(Re.value))Dt(Re.value);else{if(Re.creatable&&typeof ne=="function"){const ut=ne(Re.value);typeof ut<"u"&&ut!==null&&et(typeof ut=="string"?[...ce,ut]:[...ce,ut.value])}else et([...ce,Re.value]);ce.length===me-1&&(Qe.current=!0,Nn(!1)),De.length===1&&Nn(!1)}},bt=Re=>{typeof A=="function"&&A(Re),kt&&De[ye]&&An&&ht(De[ye]),K&&es(""),Nn(!1)},Et=Re=>{if(Dr||(Ft==null||Ft(Re),ln)||Re.key!=="Backspace"&&me&&Qe.current)return;const ut=Co==="column",Ct=()=>{Mr(xn=>{var zt;const tn=Fe(xn,Xt=>Xt+1,Xt=>Xt{Mr(xn=>{var zt;const tn=Fe(xn,Xt=>Xt-1,Xt=>Xt>0);return An&&(Xs.current=zr.current[(zt=De[tn])==null?void 0:zt.value],ts({alignment:ut?"start":"end"})),tn})};switch(Re.key){case"ArrowUp":{Re.preventDefault(),Nn(!0),ut?Tt():Ct();break}case"ArrowDown":{Re.preventDefault(),Nn(!0),ut?Ct():Tt();break}case"Enter":{Re.preventDefault(),De[ye]&&An?ht(De[ye]):Nn(!0);break}case" ":{z||(Re.preventDefault(),De[ye]&&An?ht(De[ye]):Nn(!0));break}case"Backspace":{ce.length>0&&Br.length===0&&(et(ce.slice(0,-1)),Nn(!0),me&&(Qe.current=!1));break}case"Home":{if(!z){Re.preventDefault(),An||Nn(!0);const xn=De.findIndex(zt=>!zt.disabled);Mr(xn),ts({alignment:ut?"end":"start"})}break}case"End":{if(!z){Re.preventDefault(),An||Nn(!0);const xn=De.map(zt=>!!zt.disabled).lastIndexOf(!1);Mr(xn),ts({alignment:ut?"end":"start"})}break}case"Escape":Nn(!1)}},Lt=ce.map(Re=>{let ut=we.find(Ct=>Ct.value===Re&&!Ct.disabled);return!ut&&q&&(ut={value:Re,label:Re}),ut}).filter(Re=>!!Re).map((Re,ut)=>N.createElement(_,nC(pl({},Re),{variant:M,disabled:J,className:Ye.value,readOnly:ln,onRemove:Ct=>{Ct.preventDefault(),Ct.stopPropagation(),Dt(Re.value)},key:Re.value,size:d,styles:m,classNames:h,radius:xe,index:ut}))),qt=Re=>ce.includes(Re),Gt=()=>{var Re;es(""),et([]),(Re=bn.current)==null||Re.focus(),me&&(Qe.current=!1)},$t=!ln&&(De.length>0?An:An&&!!R);return hs(()=>{const Re=$t?Me:Ce;typeof Re=="function"&&Re()},[$t]),N.createElement(Bl.Wrapper,pl(pl({required:s,id:fr,label:i,error:p,description:u,size:d,className:r,style:o,classNames:h,styles:m,__staticSelector:"MultiSelect",sx:ge,errorProps:Pt,descriptionProps:be,labelProps:yt,inputContainer:Cn,inputWrapperOrder:En,unstyled:Wt,withAsterisk:Sr,variant:M},dr),v),N.createElement(Qa,{opened:$t,transitionProps:E,shadow:"sm",withinPortal:_e,portalProps:We,__staticSelector:"MultiSelect",onDirectionChange:Lr,switchDirectionOnFlip:Le,zIndex:Ue,dropdownPosition:Pn,positionDependencies:[...It,Br],classNames:h,styles:m,unstyled:Wt,variant:M},N.createElement(Qa.Target,null,N.createElement("div",{className:Ye.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":An&&$t?`${fr}-items`:null,"aria-controls":fr,"aria-expanded":An,onMouseLeave:()=>Mr(-1),tabIndex:-1},N.createElement("input",{type:"hidden",name:gt,value:ce.join(","),form:Te,disabled:J}),N.createElement(Bl,pl({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:d,variant:M,disabled:J,error:p,required:s,radius:xe,icon:he,unstyled:Wt,onMouseDown:Re=>{var ut;Re.preventDefault(),!J&&!Qe.current&&Nn(!An),(ut=bn.current)==null||ut.focus()},classNames:nC(pl({},h),{input:rt({[Ye.input]:!z},h==null?void 0:h.input)})},lj({theme:Nt,rightSection:ae,rightSectionWidth:Z,styles:m,size:d,shouldClear:G&&ce.length>0,onClear:Gt,error:p,disabled:J,clearButtonProps:vn,readOnly:ln})),N.createElement("div",{className:Ye.values,"data-clearable":G||void 0},Lt,N.createElement("input",pl({ref:zu(t,bn),type:"search",id:fr,className:rt(Ye.searchInput,{[Ye.searchInputPointer]:!z,[Ye.searchInputInputHidden]:!An&&ce.length>0||!z&&ce.length>0,[Ye.searchInputEmpty]:ce.length===0}),onKeyDown:Et,value:Br,onChange:ot,onFocus:dt,onBlur:bt,readOnly:!z||Qe.current||ln,placeholder:ce.length===0?$:void 0,disabled:J,"data-mantine-stop-propagation":An,autoComplete:"off",onCompositionStart:()=>Ps(!0),onCompositionEnd:()=>Ps(!1)},yn)))))),N.createElement(Qa.Dropdown,{component:ue||Ih,maxHeight:I,direction:Co,id:fr,innerRef:js,__staticSelector:"MultiSelect",classNames:h,styles:m},N.createElement(_1,{data:De,hovered:ye,classNames:h,styles:m,uuid:fr,__staticSelector:"MultiSelect",onItemHover:Mr,onItemSelect:ht,itemsRefs:zr,itemComponent:k,size:d,nothingFound:R,isItemSelected:qt,creatable:W&&!!Q,createLabel:Q,unstyled:Wt,variant:M}))))});dj.displayName="@mantine/core/MultiSelect";var Zq=Object.defineProperty,eK=Object.defineProperties,tK=Object.getOwnPropertyDescriptors,$p=Object.getOwnPropertySymbols,fj=Object.prototype.hasOwnProperty,pj=Object.prototype.propertyIsEnumerable,oC=(e,t,n)=>t in e?Zq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rg=(e,t)=>{for(var n in t||(t={}))fj.call(t,n)&&oC(e,n,t[n]);if($p)for(var n of $p(t))pj.call(t,n)&&oC(e,n,t[n]);return e},nK=(e,t)=>eK(e,tK(t)),rK=(e,t)=>{var n={};for(var r in e)fj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&$p)for(var r of $p(e))t.indexOf(r)<0&&pj.call(e,r)&&(n[r]=e[r]);return n};const oK={type:"text",size:"sm",__staticSelector:"TextInput"},hj=f.forwardRef((e,t)=>{const n=TP("TextInput",oK,e),{inputProps:r,wrapperProps:o}=n,s=rK(n,["inputProps","wrapperProps"]);return N.createElement(Bl.Wrapper,Rg({},o),N.createElement(Bl,nK(Rg(Rg({},r),s),{ref:t})))});hj.displayName="@mantine/core/TextInput";function sK({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,filterDataOnExactSearchMatch:i}){if(!t)return e;const u=s!=null&&e.find(p=>p.value===s)||null;if(u&&!i&&(u==null?void 0:u.label)===r){if(n){if(n>=e.length)return e;const p=e.indexOf(u),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 aK=Zr(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}}));const iK=aK;var lK=Object.defineProperty,cK=Object.defineProperties,uK=Object.getOwnPropertyDescriptors,zp=Object.getOwnPropertySymbols,mj=Object.prototype.hasOwnProperty,gj=Object.prototype.propertyIsEnumerable,sC=(e,t,n)=>t in e?lK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rc=(e,t)=>{for(var n in t||(t={}))mj.call(t,n)&&sC(e,n,t[n]);if(zp)for(var n of zp(t))gj.call(t,n)&&sC(e,n,t[n]);return e},Mg=(e,t)=>cK(e,uK(t)),dK=(e,t)=>{var n={};for(var r in e)mj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&zp)for(var r of zp(e))t.indexOf(r)<0&&gj.call(e,r)&&(n[r]=e[r]);return n};function fK(e,t){return t.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function pK(e,t){return!!e&&!t.some(n=>n.label.toLowerCase()===e.toLowerCase())}const hK={required:!1,size:"sm",shadow:"sm",itemComponent:k1,transitionProps:{transition:"fade",duration:0},initiallyOpened:!1,filter:fK,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:pK,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:w1("popover"),positionDependencies:[],dropdownPosition:"flip"},A1=f.forwardRef((e,t)=>{const n=TP("Select",hK,e),{inputProps:r,wrapperProps:o,shadow:s,data:i,value:u,defaultValue:d,onChange:p,itemComponent:h,onKeyDown:m,onBlur:v,onFocus:b,transitionProps:S,initiallyOpened:w,unstyled:C,classNames:_,styles:k,filter:j,maxDropdownHeight:E,searchable:I,clearable:O,nothingFound:R,limit:T,disabled:A,onSearchChange:z,searchValue:$,rightSection:ee,rightSectionWidth:B,creatable:H,getCreateLabel:G,shouldCreate:K,selectOnBlur:M,onCreate:U,dropdownComponent:V,onDropdownClose:J,onDropdownOpen:ie,withinPortal:xe,portalProps:he,switchDirectionOnFlip:ae,zIndex:Z,name:W,dropdownPosition:re,allowDeselect:pe,placeholder:ne,filterDataOnExactSearchMatch:ge,form:ue,positionDependencies:Ce,readOnly:Me,clearButtonProps:me,hoverOnSearchChange:_e}=n,We=dK(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:Le,cx:Ue,theme:kt}=iK(),[gt,Pn]=f.useState(w),[Pt,yt]=f.useState(-1),be=f.useRef(),Te=f.useRef({}),[It,Ft]=f.useState("column"),Wt=It==="column",{scrollIntoView:Cn,targetRef:En,scrollableRef:ln}=sk({duration:0,offset:5,cancelable:!1,isList:!0}),Sr=pe===void 0?O:pe,vn=Q=>{if(gt!==Q){Pn(Q);const le=Q?ie:J;typeof le=="function"&&le()}},sr=H&&typeof G=="function";let Ee=null;const at=i.map(Q=>typeof Q=="string"?{label:Q,value:Q}:Q),Ye=K_({data:at}),[rt,Nt,dr]=uu({value:u,defaultValue:d,finalValue:null,onChange:p}),yn=Ye.find(Q=>Q.value===rt),[bn,zr]=uu({value:$,defaultValue:(yn==null?void 0:yn.label)||"",finalValue:void 0,onChange:z}),fr=Q=>{zr(Q),I&&typeof z=="function"&&z(Q)},An=()=>{var Q;Me||(Nt(null),dr||fr(""),(Q=be.current)==null||Q.focus())};f.useEffect(()=>{const Q=Ye.find(le=>le.value===rt);Q?fr(Q.label):(!sr||!rt)&&fr("")},[rt]),f.useEffect(()=>{yn&&(!I||!gt)&&fr(yn.label)},[yn==null?void 0:yn.label]);const Nn=Q=>{if(!Me)if(Sr&&(yn==null?void 0:yn.value)===Q.value)Nt(null),vn(!1);else{if(Q.creatable&&typeof U=="function"){const le=U(Q.value);typeof le<"u"&&le!==null&&Nt(typeof le=="string"?le:le.value)}else Nt(Q.value);dr||fr(Q.label),yt(-1),vn(!1),be.current.focus()}},$n=sK({data:Ye,searchable:I,limit:T,searchValue:bn,filter:j,filterDataOnExactSearchMatch:ge,value:rt});sr&&K(bn,$n)&&(Ee=G(bn),$n.push({label:bn,value:bn,creatable:!0}));const Mr=(Q,le,we)=>{let ce=Q;for(;we(ce);)if(ce=le(ce),!$n[ce].disabled)return ce;return Q};hs(()=>{yt(_e&&bn?0:-1)},[bn,_e]);const Co=rt?$n.findIndex(Q=>Q.value===rt):0,Lr=!Me&&($n.length>0?gt:gt&&!!R),Br=()=>{yt(Q=>{var le;const we=Mr(Q,ce=>ce-1,ce=>ce>0);return En.current=Te.current[(le=$n[we])==null?void 0:le.value],Lr&&Cn({alignment:Wt?"start":"end"}),we})},es=()=>{yt(Q=>{var le;const we=Mr(Q,ce=>ce+1,ce=>ce<$n.length-1);return En.current=Te.current[(le=$n[we])==null?void 0:le.value],Lr&&Cn({alignment:Wt?"end":"start"}),we})},Dr=()=>window.setTimeout(()=>{var Q;En.current=Te.current[(Q=$n[Co])==null?void 0:Q.value],Cn({alignment:Wt?"end":"start"})},50);hs(()=>{Lr&&Dr()},[Lr]);const Ps=Q=>{switch(typeof m=="function"&&m(Q),Q.key){case"ArrowUp":{Q.preventDefault(),gt?Wt?Br():es():(yt(Co),vn(!0),Dr());break}case"ArrowDown":{Q.preventDefault(),gt?Wt?es():Br():(yt(Co),vn(!0),Dr());break}case"Home":{if(!I){Q.preventDefault(),gt||vn(!0);const le=$n.findIndex(we=>!we.disabled);yt(le),Lr&&Cn({alignment:Wt?"end":"start"})}break}case"End":{if(!I){Q.preventDefault(),gt||vn(!0);const le=$n.map(we=>!!we.disabled).lastIndexOf(!1);yt(le),Lr&&Cn({alignment:Wt?"end":"start"})}break}case"Escape":{Q.preventDefault(),vn(!1),yt(-1);break}case" ":{I||(Q.preventDefault(),$n[Pt]&>?Nn($n[Pt]):(vn(!0),yt(Co),Dr()));break}case"Enter":I||Q.preventDefault(),$n[Pt]&>&&(Q.preventDefault(),Nn($n[Pt]))}},ts=Q=>{typeof v=="function"&&v(Q);const le=Ye.find(we=>we.value===rt);M&&$n[Pt]&>&&Nn($n[Pt]),fr((le==null?void 0:le.label)||""),vn(!1)},Xs=Q=>{typeof b=="function"&&b(Q),I&&vn(!0)},js=Q=>{Me||(fr(Q.currentTarget.value),O&&Q.currentTarget.value===""&&Nt(null),yt(-1),vn(!0))},q=()=>{Me||(vn(!gt),rt&&!gt&&yt(Co))};return N.createElement(Bl.Wrapper,Mg(Rc({},o),{__staticSelector:"Select"}),N.createElement(Qa,{opened:Lr,transitionProps:S,shadow:s,withinPortal:xe,portalProps:he,__staticSelector:"Select",onDirectionChange:Ft,switchDirectionOnFlip:ae,zIndex:Z,dropdownPosition:re,positionDependencies:[...Ce,bn],classNames:_,styles:k,unstyled:C,variant:r.variant},N.createElement(Qa.Target,null,N.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":Lr?`${r.id}-items`:null,"aria-controls":r.id,"aria-expanded":Lr,onMouseLeave:()=>yt(-1),tabIndex:-1},N.createElement("input",{type:"hidden",name:W,value:rt||"",form:ue,disabled:A}),N.createElement(Bl,Rc(Mg(Rc(Rc({autoComplete:"off",type:"search"},r),We),{ref:zu(t,be),onKeyDown:Ps,__staticSelector:"Select",value:bn,placeholder:ne,onChange:js,"aria-autocomplete":"list","aria-controls":Lr?`${r.id}-items`:null,"aria-activedescendant":Pt>=0?`${r.id}-${Pt}`:null,onMouseDown:q,onBlur:ts,onFocus:Xs,readOnly:!I||Me,disabled:A,"data-mantine-stop-propagation":Lr,name:null,classNames:Mg(Rc({},_),{input:Ue({[Le.input]:!I},_==null?void 0:_.input)})}),lj({theme:kt,rightSection:ee,rightSectionWidth:B,styles:k,size:r.size,shouldClear:O&&!!yn,onClear:An,error:o.error,clearButtonProps:me,disabled:A,readOnly:Me}))))),N.createElement(Qa.Dropdown,{component:V||Ih,maxHeight:E,direction:It,id:r.id,innerRef:ln,__staticSelector:"Select",classNames:_,styles:k},N.createElement(_1,{data:$n,hovered:Pt,classNames:_,styles:k,isItemSelected:Q=>Q===rt,uuid:r.id,__staticSelector:"Select",onItemHover:yt,onItemSelect:Nn,itemsRefs:Te,itemComponent:h,size:r.size,nothingFound:R,creatable:sr&&!!Ee,createLabel:Ee,"aria-label":o.label,unstyled:C,variant:r.variant}))))});A1.displayName="@mantine/core/Select";const N1=()=>{const[e,t,n,r,o,s,i,u,d,p,h,m,v,b,S,w,C,_,k,j,E,I,O,R,T,A,z,$,ee,B,H,G,K,M,U,V,J,ie]=Yl("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"]);return{base50:e,base100:t,base150:n,base200:r,base250:o,base300:s,base350:i,base400:u,base450:d,base500:p,base550:h,base600:m,base650:v,base700:b,base750:S,base800:w,base850:C,base900:_,base950:k,accent50:j,accent100:E,accent150:I,accent200:O,accent250:R,accent300:T,accent350:A,accent400:z,accent450:$,accent500:ee,accent550:B,accent600:H,accent650:G,accent700:K,accent750:M,accent800:U,accent850:V,accent900:J,accent950:ie}},vj=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:u,base800:d,base900:p,accent200:h,accent300:m,accent400:v,accent500:b,accent600:S}=N1(),{colorMode:w}=Do(),[C]=Yl("shadows",["dark-lg"]);return f.useCallback(()=>({label:{color:ke(u,r)(w)},separatorLabel:{color:ke(s,s)(w),"::after":{borderTopColor:ke(r,u)(w)}},input:{backgroundColor:ke(e,p)(w),borderWidth:"2px",borderColor:ke(n,d)(w),color:ke(p,t)(w),paddingRight:24,fontWeight:600,"&:hover":{borderColor:ke(r,i)(w)},"&:focus":{borderColor:ke(m,S)(w)},"&:is(:focus, :hover)":{borderColor:ke(o,s)(w)},"&:focus-within":{borderColor:ke(h,S)(w)},"&[data-disabled]":{backgroundColor:ke(r,u)(w),color:ke(i,o)(w),cursor:"not-allowed"}},value:{backgroundColor:ke(t,p)(w),color:ke(p,t)(w),button:{color:ke(p,t)(w)},"&:hover":{backgroundColor:ke(r,u)(w),cursor:"pointer"}},dropdown:{backgroundColor:ke(n,d)(w),borderColor:ke(n,d)(w),boxShadow:C},item:{backgroundColor:ke(n,d)(w),color:ke(d,n)(w),padding:6,"&[data-hovered]":{color:ke(p,t)(w),backgroundColor:ke(r,u)(w)},"&[data-active]":{backgroundColor:ke(r,u)(w),"&:hover":{color:ke(p,t)(w),backgroundColor:ke(r,u)(w)}},"&[data-selected]":{backgroundColor:ke(v,S)(w),color:ke(e,t)(w),fontWeight:600,"&:hover":{backgroundColor:ke(b,b)(w),color:ke("white",e)(w)}},"&[data-disabled]":{color:ke(s,i)(w),cursor:"not-allowed"}},rightSection:{width:32,button:{color:ke(p,t)(w)}}}),[h,m,v,b,S,t,n,r,o,e,s,i,u,d,p,C,w])},mK=e=>{const{tooltip:t,inputRef:n,label:r,disabled:o,required:s,...i}=e,u=vj();return a.jsx(_n,{label:t,placement:"top",hasArrow:!0,children:a.jsx(A1,{label:r?a.jsx(Ss,{isRequired:s,isDisabled:o,children:a.jsx(vs,{children:r})}):void 0,disabled:o,ref:n,styles:u,...i})})},To=f.memo(mK),gK=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:u,base800:d,base900:p,accent200:h,accent300:m,accent400:v,accent500:b,accent600:S}=N1(),{colorMode:w}=Do(),[C]=Yl("shadows",["dark-lg"]);return f.useCallback(()=>({label:{color:ke(u,r)(w)},separatorLabel:{color:ke(s,s)(w),"::after":{borderTopColor:ke(r,u)(w)}},searchInput:{":placeholder":{color:ke(r,u)(w)}},input:{backgroundColor:ke(e,p)(w),borderWidth:"2px",borderColor:ke(n,d)(w),color:ke(p,t)(w),paddingRight:24,fontWeight:600,"&:hover":{borderColor:ke(r,i)(w)},"&:focus":{borderColor:ke(m,S)(w)},"&:is(:focus, :hover)":{borderColor:ke(o,s)(w)},"&:focus-within":{borderColor:ke(h,S)(w)},"&[data-disabled]":{backgroundColor:ke(r,u)(w),color:ke(i,o)(w),cursor:"not-allowed"}},value:{backgroundColor:ke(n,d)(w),color:ke(p,t)(w),button:{color:ke(p,t)(w)},"&:hover":{backgroundColor:ke(r,u)(w),cursor:"pointer"}},dropdown:{backgroundColor:ke(n,d)(w),borderColor:ke(n,d)(w),boxShadow:C},item:{backgroundColor:ke(n,d)(w),color:ke(d,n)(w),padding:6,"&[data-hovered]":{color:ke(p,t)(w),backgroundColor:ke(r,u)(w)},"&[data-active]":{backgroundColor:ke(r,u)(w),"&:hover":{color:ke(p,t)(w),backgroundColor:ke(r,u)(w)}},"&[data-selected]":{backgroundColor:ke(v,S)(w),color:ke(e,t)(w),fontWeight:600,"&:hover":{backgroundColor:ke(b,b)(w),color:ke("white",e)(w)}},"&[data-disabled]":{color:ke(s,i)(w),cursor:"not-allowed"}},rightSection:{width:24,padding:20,button:{color:ke(p,t)(w)}}}),[h,m,v,b,S,t,n,r,o,e,s,i,u,d,p,C,w])},vK=e=>{const{searchable:t=!0,tooltip:n,inputRef:r,label:o,disabled:s,...i}=e,u=te(),d=f.useCallback(m=>{m.shiftKey&&u(Yo(!0))},[u]),p=f.useCallback(m=>{m.shiftKey||u(Yo(!1))},[u]),h=gK();return a.jsx(_n,{label:n,placement:"top",hasArrow:!0,isOpen:!0,children:a.jsx(dj,{label:o?a.jsx(Ss,{isDisabled:s,children:a.jsx(vs,{children:o})}):void 0,ref:r,disabled:s,onKeyDown:d,onKeyUp:p,searchable:t,maxDropdownHeight:300,styles:h,...i})})},yK=f.memo(vK),bK=Cs(M4,e=>({value:e,label:D4[e]})).sort((e,t)=>e.label.localeCompare(t.label));function xK(){const e=te(),{t}=fe(),n=L(o=>o.ui.favoriteSchedulers),r=f.useCallback(o=>{e(S8(o))},[e]);return a.jsx(yK,{label:t("settings.favoriteSchedulers"),value:n,data:bK,onChange:r,clearable:!0,searchable:!0,maxSelectedValues:99,placeholder:t("settings.favoriteSchedulersPlaceholder")})}const wK=ve([Mo,Jr],(e,t)=>{const{shouldConfirmOnDelete:n,shouldDisplayGuides:r,enableImageDebugging:o,consoleLogLevel:s,shouldLogToConsole:i,shouldAntialiasProgressImage:u}=e,{shouldUseCanvasBetaLayout:d,shouldUseSliders:p,shouldShowProgressInViewer:h,shouldShowAdvancedOptions:m}=t;return{shouldConfirmOnDelete:n,shouldDisplayGuides:r,enableImageDebugging:o,shouldUseCanvasBetaLayout:d,shouldUseSliders:p,shouldShowProgressInViewer:h,consoleLogLevel:s,shouldLogToConsole:i,shouldAntialiasProgressImage:u,shouldShowAdvancedOptions:m}},{memoizeOptions:{resultEqualityCheck:Qt}}),SK=({children:e,config:t})=>{const n=te(),{t:r}=fe(),o=(t==null?void 0:t.shouldShowBetaLayout)??!0,s=(t==null?void 0:t.shouldShowDeveloperSettings)??!0,i=(t==null?void 0:t.shouldShowResetWebUiText)??!0,u=(t==null?void 0:t.shouldShowAdvancedOptionsSettings)??!0;f.useEffect(()=>{s||n(nx(!1))},[s,n]);const{isOpen:d,onOpen:p,onClose:h}=Ws(),{isOpen:m,onOpen:v,onClose:b}=Ws(),{shouldConfirmOnDelete:S,shouldDisplayGuides:w,enableImageDebugging:C,shouldUseCanvasBetaLayout:_,shouldUseSliders:k,shouldShowProgressInViewer:j,consoleLogLevel:E,shouldLogToConsole:I,shouldAntialiasProgressImage:O,shouldShowAdvancedOptions:R}=L(wK),T=f.useCallback(()=>{Object.keys(window.localStorage).forEach($=>{(C8.includes($)||$.startsWith(_8))&&localStorage.removeItem($)}),h(),v()},[h,v]),A=f.useCallback($=>{n(k8($))},[n]),z=f.useCallback($=>{n(nx($.target.checked))},[n]);return a.jsxs(a.Fragment,{children:[f.cloneElement(e,{onClick:p}),a.jsxs(ou,{isOpen:d,onClose:h,size:"xl",isCentered:!0,children:[a.jsx(va,{}),a.jsxs(su,{children:[a.jsx(ga,{bg:"none",children:r("common.settingsLabel")}),a.jsx($v,{}),a.jsx(ya,{children:a.jsxs(F,{sx:{gap:4,flexDirection:"column"},children:[a.jsxs(Mc,{children:[a.jsx(aa,{size:"sm",children:r("settings.general")}),a.jsx(jn,{label:r("settings.confirmOnDelete"),isChecked:S,onChange:$=>n(O4($.target.checked))}),u&&a.jsx(jn,{label:r("settings.showAdvancedOptions"),isChecked:R,onChange:$=>n(P8($.target.checked))})]}),a.jsxs(Mc,{children:[a.jsx(aa,{size:"sm",children:r("settings.generation")}),a.jsx(xK,{})]}),a.jsxs(Mc,{children:[a.jsx(aa,{size:"sm",children:r("settings.ui")}),a.jsx(jn,{label:r("settings.displayHelpIcons"),isChecked:w,onChange:$=>n(j8($.target.checked))}),o&&a.jsx(jn,{label:r("settings.useCanvasBeta"),isChecked:_,onChange:$=>n(I8($.target.checked))}),a.jsx(jn,{label:r("settings.useSlidersForAll"),isChecked:k,onChange:$=>n(E8($.target.checked))}),a.jsx(jn,{label:r("settings.showProgressInViewer"),isChecked:j,onChange:$=>n(T4($.target.checked))}),a.jsx(jn,{label:r("settings.antialiasProgressImages"),isChecked:O,onChange:$=>n(O8($.target.checked))})]}),s&&a.jsxs(Mc,{children:[a.jsx(aa,{size:"sm",children:r("settings.developer")}),a.jsx(jn,{label:r("settings.shouldLogToConsole"),isChecked:I,onChange:z}),a.jsx(To,{disabled:!I,label:r("settings.consoleLogLevel"),onChange:A,value:E,data:R8.concat()}),a.jsx(jn,{label:r("settings.enableImageDebugging"),isChecked:C,onChange:$=>n(M8($.target.checked))})]}),a.jsxs(Mc,{children:[a.jsx(aa,{size:"sm",children:r("settings.resetWebUI")}),a.jsx(Zt,{colorScheme:"error",onClick:T,children:r("settings.resetWebUI")}),i&&a.jsxs(a.Fragment,{children:[a.jsx(nt,{children:r("settings.resetWebUIDesc1")}),a.jsx(nt,{children:r("settings.resetWebUIDesc2")})]})]})]})}),a.jsx(ma,{children:a.jsx(Zt,{onClick:h,children:r("common.close")})})]})]}),a.jsxs(ou,{closeOnOverlayClick:!1,isOpen:m,onClose:b,isCentered:!0,children:[a.jsx(va,{backdropFilter:"blur(40px)"}),a.jsxs(su,{children:[a.jsx(ga,{}),a.jsx(ya,{children:a.jsx(F,{justifyContent:"center",children:a.jsx(nt,{fontSize:"lg",children:a.jsx(nt,{children:r("settings.resetComplete")})})})}),a.jsx(ma,{})]})]})]})},Mc=e=>a.jsx(F,{sx:{flexDirection:"column",gap:2,p:4,borderRadius:"base",bg:"base.100",_dark:{bg:"base.900"}},children:e.children}),CK=()=>{const{t:e}=fe(),t=xr("localization").isFeatureEnabled,n=xr("bugLink").isFeatureEnabled,r=xr("discordLink").isFeatureEnabled,o=xr("githubLink").isFeatureEnabled;return a.jsxs(F,{sx:{gap:2,alignItems:"center"},children:[a.jsx(G_,{}),a.jsx($i,{}),a.jsx(qB,{}),a.jsx(nF,{children:a.jsx(je,{"aria-label":e("common.hotkeysLabel"),tooltip:e("common.hotkeysLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:a.jsx(S$,{})})}),t&&a.jsx(aF,{}),n&&a.jsx(Ka,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI/issues",marginBottom:"-0.25rem",children:a.jsx(je,{"aria-label":e("common.reportBugLabel"),tooltip:e("common.reportBugLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:a.jsx(a$,{})})}),o&&a.jsx(Ka,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI",marginBottom:"-0.25rem",children:a.jsx(je,{"aria-label":e("common.githubLabel"),tooltip:e("common.githubLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:a.jsx(ZN,{})})}),r&&a.jsx(Ka,{isExternal:!0,href:"https://discord.gg/ZmtBAhwWhy",marginBottom:"-0.25rem",children:a.jsx(je,{"aria-label":e("common.discordLabel"),tooltip:e("common.discordLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:a.jsx(JN,{})})}),a.jsx(eF,{}),a.jsx(SK,{children:a.jsx(je,{"aria-label":e("common.settingsLabel"),tooltip:e("common.settingsLabel"),variant:"link","data-variant":"link",fontSize:22,size:"sm",icon:a.jsx(YB,{})})})]})},_K=f.memo(CK),kK=ve(Mo,e=>{const{isUploading:t}=e;let n="";return t&&(n="Uploading..."),{tooltip:n,shouldShow:t}}),PK=()=>{const{shouldShow:e,tooltip:t}=L(kK);return e?a.jsx(F,{sx:{alignItems:"center",justifyContent:"center",color:"base.600"},children:a.jsx(_n,{label:t,placement:"right",hasArrow:!0,children:a.jsx(Jl,{})})}):null},jK=f.memo(PK),Wi=e=>e.config,{createElement:Fl,createContext:IK,forwardRef:yj,useCallback:za,useContext:bj,useEffect:pa,useImperativeHandle:xj,useLayoutEffect:EK,useMemo:OK,useRef:Uo,useState:Jc}=dv,aC=dv["useId".toString()],RK=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Lp=RK?EK:()=>{},MK=typeof aC=="function"?aC:()=>null;let DK=0;function $1(e=null){const t=MK(),n=Uo(e||t||null);return n.current===null&&(n.current=""+DK++),n.current}const Rh=IK(null);Rh.displayName="PanelGroupContext";function wj({children:e=null,className:t="",collapsedSize:n=0,collapsible:r=!1,defaultSize:o=null,forwardedRef:s,id:i=null,maxSize:u=100,minSize:d=10,onCollapse:p=null,onResize:h=null,order:m=null,style:v={},tagName:b="div"}){const S=bj(Rh);if(S===null)throw Error("Panel components must be rendered within a PanelGroup container");const w=$1(i),{collapsePanel:C,expandPanel:_,getPanelStyle:k,registerPanel:j,resizePanel:E,unregisterPanel:I}=S,O=Uo({onCollapse:p,onResize:h});if(pa(()=>{O.current.onCollapse=p,O.current.onResize=h}),d<0||d>100)throw Error(`Panel minSize must be between 0 and 100, but was ${d}`);if(u<0||u>100)throw Error(`Panel maxSize must be between 0 and 100, but was ${u}`);if(o!==null){if(o<0||o>100)throw Error(`Panel defaultSize must be between 0 and 100, but was ${o}`);d>o&&!r&&(console.error(`Panel minSize ${d} cannot be greater than defaultSize ${o}`),o=d)}const R=k(w,o),T=Uo({size:iC(R)}),A=Uo({callbacksRef:O,collapsedSize:n,collapsible:r,defaultSize:o,id:w,maxSize:u,minSize:d,order:m});return Lp(()=>{T.current.size=iC(R),A.current.callbacksRef=O,A.current.collapsedSize=n,A.current.collapsible=r,A.current.defaultSize=o,A.current.id=w,A.current.maxSize=u,A.current.minSize=d,A.current.order=m}),Lp(()=>(j(w,A),()=>{I(w)}),[m,w,j,I]),xj(s,()=>({collapse:()=>C(w),expand:()=>_(w),getCollapsed(){return T.current.size===0},getSize(){return T.current.size},resize:z=>E(w,z)}),[C,_,w,E]),Fl(b,{children:e,className:t,"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-id":w,"data-panel-size":parseFloat(""+R.flexGrow).toFixed(1),id:`data-panel-id-${w}`,style:{...R,...v}})}const fu=yj((e,t)=>Fl(wj,{...e,forwardedRef:t}));wj.displayName="Panel";fu.displayName="forwardRef(Panel)";function iC(e){const{flexGrow:t}=e;return typeof t=="string"?parseFloat(t):t}const Ti=10;function Bc(e,t,n,r,o,s,i,u){const{sizes:d}=u||{},p=d||s;if(o===0)return p;const h=Vo(t),m=p.concat();let v=0;{const w=o<0?r:n,C=h.findIndex(E=>E.current.id===w),_=h[C],k=p[C],j=lC(_,Math.abs(o),k,e);if(k===j)return p;j===0&&k>0&&i.set(w,k),o=o<0?k-j:j-k}let b=o<0?n:r,S=h.findIndex(w=>w.current.id===b);for(;;){const w=h[S],C=p[S],_=Math.abs(o)-Math.abs(v),k=lC(w,0-_,C,e);if(C!==k&&(k===0&&C>0&&i.set(w.current.id,C),v+=C-k,m[S]=k,v.toPrecision(Ti).localeCompare(Math.abs(o).toPrecision(Ti),void 0,{numeric:!0})>=0))break;if(o<0){if(--S<0)break}else if(++S>=h.length)break}return v===0?p:(b=o<0?r:n,S=h.findIndex(w=>w.current.id===b),m[S]=p[S]+v,m)}function hl(e,t,n){t.forEach((r,o)=>{const{callbacksRef:s,collapsedSize:i,collapsible:u,id:d}=e[o].current,p=n[d];if(p!==r){n[d]=r;const{onCollapse:h,onResize:m}=s.current;m&&m(r,p),u&&h&&((p==null||p===i)&&r!==i?h(!1):p!==i&&r===i&&h(!0))}})}function Dg(e,t){if(t.length<2)return[null,null];const n=t.findIndex(i=>i.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 Sj(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(Ti)}function TK(e){const t=document.querySelector(`[data-panel-id="${e}"]`);return t||null}function z1(e){const t=document.querySelector(`[data-panel-group-id="${e}"]`);return t||null}function Mh(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function AK(e){return Cj().findIndex(r=>r.getAttribute("data-panel-resize-handle-id")===e)??null}function Cj(){return Array.from(document.querySelectorAll("[data-panel-resize-handle-id]"))}function _j(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function L1(e,t,n){var d,p,h,m;const r=Mh(t),o=_j(e),s=r?o.indexOf(r):-1,i=((p=(d=n[s])==null?void 0:d.current)==null?void 0:p.id)??null,u=((m=(h=n[s+1])==null?void 0:h.current)==null?void 0:m.id)??null;return[i,u]}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 lC(e,t,n,r){var h;const o=n+t,{collapsedSize:s,collapsible:i,maxSize:u,minSize:d}=e.current;if(i){if(n>s){if(o<=d/2+s)return s}else if(!((h=r==null?void 0:r.type)==null?void 0:h.startsWith("key"))&&o{const{direction:i,panels:u}=e.current,d=z1(t),{height:p,width:h}=d.getBoundingClientRect(),v=_j(t).map(b=>{const S=b.getAttribute("data-panel-resize-handle-id"),w=Vo(u),[C,_]=L1(t,S,w);if(C==null||_==null)return()=>{};let k=0,j=100,E=0,I=0;w.forEach($=>{$.current.id===C?(j=$.current.maxSize,k=$.current.minSize):(E+=$.current.minSize,I+=$.current.maxSize)});const O=Math.min(j,100-E),R=Math.max(k,(w.length-1)*100-I),T=Sj(u,C,o);b.setAttribute("aria-valuemax",""+Math.round(O)),b.setAttribute("aria-valuemin",""+Math.round(R)),b.setAttribute("aria-valuenow",""+Math.round(parseInt(T)));const A=$=>{if(!$.defaultPrevented)switch($.key){case"Enter":{$.preventDefault();const ee=w.findIndex(B=>B.current.id===C);if(ee>=0){const B=w[ee],H=o[ee];if(H!=null){let G=0;H.toPrecision(Ti)<=B.current.minSize.toPrecision(Ti)?G=i==="horizontal"?h:p:G=-(i==="horizontal"?h:p);const K=Bc($,u,C,_,G,o,s.current,null);o!==K&&r(K)}}break}}};b.addEventListener("keydown",A);const z=TK(C);return z!=null&&b.setAttribute("aria-controls",z.id),()=>{b.removeAttribute("aria-valuemax"),b.removeAttribute("aria-valuemin"),b.removeAttribute("aria-valuenow"),b.removeEventListener("keydown",A),z!=null&&b.removeAttribute("aria-controls")}});return()=>{v.forEach(b=>b())}},[e,t,n,s,r,o])}function $K({disabled:e,handleId:t,resizeHandler:n}){pa(()=>{if(e||n==null)return;const r=Mh(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=Cj(),u=AK(t);kj(u!==null);const d=s.shiftKey?u>0?u-1:i.length-1:u+1{r.removeEventListener("keydown",o)}},[e,t,n])}function zK(e,t){if(e.length!==t.length)return!1;for(let n=0;nR.current.id===E),O=r[I];if(O.current.collapsible){const R=h[I];(R===0||R.toPrecision(Ti)===O.current.minSize.toPrecision(Ti))&&(_=_<0?-O.current.minSize*S:O.current.minSize*S)}return _}else return Pj(e,n,o,u,d)}function BK(e){return e.type==="keydown"}function B0(e){return e.type.startsWith("mouse")}function F0(e){return e.type.startsWith("touch")}let H0=null,xi=null;function jj(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 FK(){xi!==null&&(document.head.removeChild(xi),H0=null,xi=null)}function Tg(e){if(H0===e)return;H0=e;const t=jj(e);xi===null&&(xi=document.createElement("style"),document.head.appendChild(xi)),xi.innerHTML=`*{cursor: ${t}!important;}`}function HK(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function Ij(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 Ej(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 WK(e,t,n){const r=Ej(e,n);if(r){const o=Ij(t);return r[o]??null}return null}function VK(e,t,n,r){const o=Ij(t),s=Ej(e,r)||{};s[o]=n;try{r.setItem(`PanelGroup:sizes:${e}`,JSON.stringify(s))}catch(i){console.error(i)}}const Ag={};function cC(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 Fc={getItem:e=>(cC(Fc),Fc.getItem(e)),setItem:(e,t)=>{cC(Fc),Fc.setItem(e,t)}};function Oj({autoSaveId:e,children:t=null,className:n="",direction:r,disablePointerEventsDuringResize:o=!1,forwardedRef:s,id:i=null,onLayout:u,storage:d=Fc,style:p={},tagName:h="div"}){const m=$1(i),[v,b]=Jc(null),[S,w]=Jc(new Map),C=Uo(null),_=Uo({onLayout:u});pa(()=>{_.current.onLayout=u});const k=Uo({}),[j,E]=Jc([]),I=Uo(new Map),O=Uo(0),R=Uo({direction:r,panels:S,sizes:j});xj(s,()=>({getLayout:()=>{const{sizes:M}=R.current;return M},setLayout:M=>{const U=M.reduce((xe,he)=>xe+he,0);kj(U===100,"Panel sizes must add up to 100%");const{panels:V}=R.current,J=k.current,ie=Vo(V);E(M),hl(ie,M,J)}}),[]),Lp(()=>{R.current.direction=r,R.current.panels=S,R.current.sizes=j}),NK({committedValuesRef:R,groupId:m,panels:S,setSizes:E,sizes:j,panelSizeBeforeCollapse:I}),pa(()=>{const{onLayout:M}=_.current,{panels:U,sizes:V}=R.current;if(V.length>0){M&&M(V);const J=k.current,ie=Vo(U);hl(ie,V,J)}},[j]),Lp(()=>{if(R.current.sizes.length===S.size)return;let U=null;if(e){const V=Vo(S);U=WK(e,V,d)}if(U!=null)E(U);else{const V=Vo(S);let J=0,ie=0,xe=0;if(V.forEach(he=>{xe+=he.current.minSize,he.current.defaultSize===null?J++:ie+=he.current.defaultSize}),ie>100)throw new Error("Default panel sizes cannot exceed 100%");if(V.length>1&&J===0&&ie!==100)throw new Error("Invalid default sizes specified for panels");if(xe>100)throw new Error("Minimum panel sizes cannot exceed 100%");E(V.map(he=>he.current.defaultSize===null?(100-ie)/J:he.current.defaultSize))}},[e,S,d]),pa(()=>{if(e){if(j.length===0||j.length!==S.size)return;const M=Vo(S);Ag[e]||(Ag[e]=HK(VK,100)),Ag[e](e,M,j,d)}},[e,S,j,d]);const T=za((M,U)=>{const{panels:V}=R.current;return V.size===0?{flexBasis:0,flexGrow:U??void 0,flexShrink:1,overflow:"hidden"}:{flexBasis:0,flexGrow:Sj(V,M,j),flexShrink:1,overflow:"hidden",pointerEvents:o&&v!==null?"none":void 0}},[v,o,j]),A=za((M,U)=>{w(V=>{if(V.has(M))return V;const J=new Map(V);return J.set(M,U),J})},[]),z=za(M=>V=>{V.preventDefault();const{direction:J,panels:ie,sizes:xe}=R.current,he=Vo(ie),[ae,Z]=L1(m,M,he);if(ae==null||Z==null)return;let W=LK(V,m,M,he,J,xe,C.current);if(W===0)return;const pe=z1(m).getBoundingClientRect(),ne=J==="horizontal";document.dir==="rtl"&&ne&&(W=-W);const ge=ne?pe.width:pe.height,ue=W/ge*100,Ce=Bc(V,ie,ae,Z,ue,xe,I.current,C.current),Me=!zK(xe,Ce);if((B0(V)||F0(V))&&O.current!=ue&&Tg(Me?ne?"horizontal":"vertical":ne?W<0?"horizontal-min":"horizontal-max":W<0?"vertical-min":"vertical-max"),Me){const me=k.current;E(Ce),hl(he,Ce,me)}O.current=ue},[m]),$=za(M=>{w(U=>{if(!U.has(M))return U;const V=new Map(U);return V.delete(M),V})},[]),ee=za(M=>{const{panels:U,sizes:V}=R.current,J=U.get(M);if(J==null)return;const{collapsedSize:ie,collapsible:xe}=J.current;if(!xe)return;const he=Vo(U),ae=he.indexOf(J);if(ae<0)return;const Z=V[ae];if(Z===ie)return;I.current.set(M,Z);const[W,re]=Dg(M,he);if(W==null||re==null)return;const ne=ae===he.length-1?Z:ie-Z,ge=Bc(null,U,W,re,ne,V,I.current,null);if(V!==ge){const ue=k.current;E(ge),hl(he,ge,ue)}},[]),B=za(M=>{const{panels:U,sizes:V}=R.current,J=U.get(M);if(J==null)return;const{collapsedSize:ie,minSize:xe}=J.current,he=I.current.get(M)||xe;if(!he)return;const ae=Vo(U),Z=ae.indexOf(J);if(Z<0||V[Z]!==ie)return;const[re,pe]=Dg(M,ae);if(re==null||pe==null)return;const ge=Z===ae.length-1?ie-he:he,ue=Bc(null,U,re,pe,ge,V,I.current,null);if(V!==ue){const Ce=k.current;E(ue),hl(ae,ue,Ce)}},[]),H=za((M,U)=>{const{panels:V,sizes:J}=R.current,ie=V.get(M);if(ie==null)return;const{collapsedSize:xe,collapsible:he,maxSize:ae,minSize:Z}=ie.current,W=Vo(V),re=W.indexOf(ie);if(re<0)return;const pe=J[re];if(pe===U)return;he&&U===xe||(U=Math.min(ae,Math.max(Z,U)));const[ne,ge]=Dg(M,W);if(ne==null||ge==null)return;const Ce=re===W.length-1?pe-U:U-pe,Me=Bc(null,V,ne,ge,Ce,J,I.current,null);if(J!==Me){const me=k.current;E(Me),hl(W,Me,me)}},[]),G=OK(()=>({activeHandleId:v,collapsePanel:ee,direction:r,expandPanel:B,getPanelStyle:T,groupId:m,registerPanel:A,registerResizeHandle:z,resizePanel:H,startDragging:(M,U)=>{if(b(M),B0(U)||F0(U)){const V=Mh(M);C.current={dragHandleRect:V.getBoundingClientRect(),dragOffset:Pj(U,M,r),sizes:R.current.sizes}}},stopDragging:()=>{FK(),b(null),C.current=null},unregisterPanel:$}),[v,ee,r,B,T,m,A,z,H,$]),K={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Fl(Rh.Provider,{children:Fl(h,{children:t,className:n,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":m,style:{...K,...p}}),value:G})}const B1=yj((e,t)=>Fl(Oj,{...e,forwardedRef:t}));Oj.displayName="PanelGroup";B1.displayName="forwardRef(PanelGroup)";function W0({children:e=null,className:t="",disabled:n=!1,id:r=null,onDragging:o,style:s={},tagName:i="div"}){const u=Uo(null),d=Uo({onDragging:o});pa(()=>{d.current.onDragging=o});const p=bj(Rh);if(p===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{activeHandleId:h,direction:m,groupId:v,registerResizeHandle:b,startDragging:S,stopDragging:w}=p,C=$1(r),_=h===C,[k,j]=Jc(!1),[E,I]=Jc(null),O=za(()=>{u.current.blur(),w();const{onDragging:A}=d.current;A&&A(!1)},[w]);pa(()=>{if(n)I(null);else{const T=b(C);I(()=>T)}},[n,C,b]),pa(()=>{if(n||E==null||!_)return;const T=ee=>{E(ee)},A=ee=>{E(ee)},$=u.current.ownerDocument;return $.body.addEventListener("contextmenu",O),$.body.addEventListener("mousemove",T),$.body.addEventListener("touchmove",T),$.body.addEventListener("mouseleave",A),window.addEventListener("mouseup",O),window.addEventListener("touchend",O),()=>{$.body.removeEventListener("contextmenu",O),$.body.removeEventListener("mousemove",T),$.body.removeEventListener("touchmove",T),$.body.removeEventListener("mouseleave",A),window.removeEventListener("mouseup",O),window.removeEventListener("touchend",O)}},[m,n,_,E,O]),$K({disabled:n,handleId:C,resizeHandler:E});const R={cursor:jj(m),touchAction:"none",userSelect:"none"};return Fl(i,{children:e,className:t,"data-resize-handle-active":_?"pointer":k?"keyboard":void 0,"data-panel-group-direction":m,"data-panel-group-id":v,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":C,onBlur:()=>j(!1),onFocus:()=>j(!0),onMouseDown:T=>{S(C,T.nativeEvent);const{onDragging:A}=d.current;A&&A(!0)},onMouseUp:O,onTouchCancel:O,onTouchEnd:O,onTouchStart:T=>{S(C,T.nativeEvent);const{onDragging:A}=d.current;A&&A(!0)},ref:u,role:"separator",style:{...R,...s},tabIndex:0})}W0.displayName="PanelResizeHandle";const UK=(e,t,n,r="horizontal")=>{const o=f.useRef(null),[s,i]=f.useState(t),u=f.useCallback(()=>{var p,h;const d=(p=o.current)==null?void 0:p.getSize();d!==void 0&&d{const d=document.querySelector(`[data-panel-group-id="${n}"]`),p=document.querySelectorAll("[data-panel-resize-handle-id]");if(!d)return;const h=new ResizeObserver(()=>{let m=r==="horizontal"?d.getBoundingClientRect().width:d.getBoundingClientRect().height;p.forEach(v=>{m-=r==="horizontal"?v.getBoundingClientRect().width:v.getBoundingClientRect().height}),i(e/m*100)});return h.observe(d),p.forEach(m=>{h.observe(m)}),window.addEventListener("resize",u),()=>{h.disconnect(),window.removeEventListener("resize",u)}},[n,u,s,e,r]),{ref:o,minSizePct:s}},GK=ve([Mt],e=>{const{initialImage:t}=e.generation;return{initialImage:t,isResetButtonDisabled:!t}},it),qK=()=>{const{initialImage:e}=L(GK),{currentData:t,isLoading:n,isError:r,isSuccess:o}=gs((e==null?void 0:e.imageName)??Ko.skipToken),s=f.useMemo(()=>{if(t)return{id:"initial-image",payloadType:"IMAGE_DTO",payload:{imageDTO:t}}},[t]),i=f.useMemo(()=>({id:"initial-image",actionType:"SET_INITIAL_IMAGE"}),[]);return a.jsx(Ja,{imageDTO:t,droppableData:i,draggableData:s,isUploadDisabled:!0,fitContainer:!0,dropLabel:"Set as Initial Image",noContentFallback:a.jsx(Li,{label:"No initial image selected"})})},KK=ve([Mt],e=>{const{initialImage:t}=e.generation;return{isResetButtonDisabled:!t}},it),YK={type:"SET_INITIAL_IMAGE"},QK=()=>{const{isResetButtonDisabled:e}=L(KK),t=te(),{openUploader:n}=fh(),{getUploadButtonProps:r,getUploadInputProps:o}=L_({postUploadAction:YK}),s=f.useCallback(()=>{t(D8())},[t]),i=f.useCallback(()=>{n()},[n]);return a.jsxs(F,{layerStyle:"first",sx:{position:"relative",flexDirection:"column",height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",p:4,gap:4},children:[a.jsxs(F,{sx:{w:"full",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(nt,{sx:{fontWeight:600,userSelect:"none",color:"base.700",_dark:{color:"base.200"}},children:"Initial Image"}),a.jsx($i,{}),a.jsx(je,{tooltip:"Upload Initial Image","aria-label":"Upload Initial Image",icon:a.jsx(Au,{}),onClick:i,...r()}),a.jsx(je,{tooltip:"Reset Initial Image","aria-label":"Reset Initial Image",icon:a.jsx(Yv,{}),onClick:s,isDisabled:e})]}),a.jsx(qK,{}),a.jsx("input",{...o()})]})},F1="28rem",Rj=e=>{const{sx:t}=e,n=te(),r=L(i=>i.ui.shouldPinParametersPanel),{t:o}=fe(),s=()=>{n(T8(!r)),n(vo())};return a.jsx(je,{...e,tooltip:o("common.pinOptionsPanel"),"aria-label":o("common.pinOptionsPanel"),onClick:s,icon:r?a.jsx(O5,{}):a.jsx(R5,{}),variant:"ghost",size:"sm",sx:{color:"base.500",_hover:{color:"base.600"},_active:{color:"base.700"},_dark:{color:"base.500",_hover:{color:"base.400"},_active:{color:"base.300"}},...t}})},XK=ve(Jr,e=>{const{shouldPinParametersPanel:t,shouldShowParametersPanel:n}=e;return{shouldPinParametersPanel:t,shouldShowParametersPanel:n}}),JK=e=>{const{shouldPinParametersPanel:t,shouldShowParametersPanel:n}=L(XK);return t&&n?a.jsxs(ze,{sx:{position:"relative",h:"full",w:F1,flexShrink:0},children:[a.jsx(F,{sx:{gap:2,flexDirection:"column",h:"full",w:"full",position:"absolute",overflowY:"auto"},children:e.children}),a.jsx(Rj,{sx:{position:"absolute",top:0,insetInlineEnd:0}})]}):null},H1=f.memo(JK),ZK=e=>{const{direction:t="horizontal",...n}=e,{colorMode:r}=Do();return t==="horizontal"?a.jsx(W0,{children:a.jsx(F,{sx:{w:6,h:"full",justifyContent:"center",alignItems:"center"},...n,children:a.jsx(ze,{sx:{w:.5,h:"calc(100% - 4px)",bg:ke("base.100","base.850")(r)}})})}):a.jsx(W0,{children:a.jsx(F,{sx:{w:"full",h:6,justifyContent:"center",alignItems:"center"},...n,children:a.jsx(ze,{sx:{w:"calc(100% - 4px)",h:.5,bg:ke("base.100","base.850")(r)}})})})},Mj=f.memo(ZK),eY=ve([Mt],({system:e})=>{const{isProcessing:t,isConnected:n}=e;return n&&!t}),tY=e=>{const{onClick:t,isDisabled:n}=e,{t:r}=fe(),o=L(eY);return a.jsx(je,{onClick:t,icon:a.jsx(bo,{}),tooltip:`${r("gallery.deleteImage")} (Del)`,"aria-label":`${r("gallery.deleteImage")} (Del)`,isDisabled:n||!o,colorScheme:"error"})},Dj=f.forwardRef(({label:e,tooltip:t,description:n,disabled:r,...o},s)=>a.jsx(_n,{label:t,placement:"top",hasArrow:!0,openDelay:500,children:a.jsx(ze,{ref:s,...o,children:a.jsxs(ze,{children:[a.jsx(Nl,{children:e}),n&&a.jsx(Nl,{size:"xs",color:"base.600",children:n})]})})}));Dj.displayName="IAIMantineSelectItemWithTooltip";const Vi=f.memo(Dj),nY=[{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 rY(){const e=L(r=>r.postprocessing.esrganModelName),t=te(),n=r=>t(A8(r));return a.jsx(To,{label:"ESRGAN Model",value:e,itemComponent:Vi,onChange:n,data:nY})}const oY=e=>{const{imageDTO:t}=e,n=te(),r=L($r),{t:o}=fe(),{isOpen:s,onOpen:i,onClose:u}=Ws(),d=f.useCallback(()=>{u(),t&&n(A4({image_name:t.image_name}))},[n,t,u]);return a.jsx(zi,{isOpen:s,onClose:u,triggerComponent:a.jsx(je,{onClick:i,icon:a.jsx(f$,{}),"aria-label":o("parameters.upscale")}),children:a.jsxs(F,{sx:{flexDirection:"column",gap:4},children:[a.jsx(rY,{}),a.jsx(Zt,{size:"sm",isDisabled:!t||r,onClick:d,children:o("parameters.upscaleImage")})]})})};function sY(e,t,n){var r=this,o=f.useRef(null),s=f.useRef(0),i=f.useRef(null),u=f.useRef([]),d=f.useRef(),p=f.useRef(),h=f.useRef(e),m=f.useRef(!0);f.useEffect(function(){h.current=e},[e]);var v=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var b=!!(n=n||{}).leading,S=!("trailing"in n)||!!n.trailing,w="maxWait"in n,C=w?Math.max(+n.maxWait||0,t):null;f.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var _=f.useMemo(function(){var k=function(T){var A=u.current,z=d.current;return u.current=d.current=null,s.current=T,p.current=h.current.apply(z,A)},j=function(T,A){v&&cancelAnimationFrame(i.current),i.current=v?requestAnimationFrame(T):setTimeout(T,A)},E=function(T){if(!m.current)return!1;var A=T-o.current;return!o.current||A>=t||A<0||w&&T-s.current>=C},I=function(T){return i.current=null,S&&u.current?k(T):(u.current=d.current=null,p.current)},O=function T(){var A=Date.now();if(E(A))return I(A);if(m.current){var z=t-(A-o.current),$=w?Math.min(z,C-(A-s.current)):z;j(T,$)}},R=function(){var T=Date.now(),A=E(T);if(u.current=[].slice.call(arguments),d.current=r,o.current=T,A){if(!i.current&&m.current)return s.current=o.current,j(O,t),b?k(o.current):p.current;if(w)return j(O,t),k(o.current)}return i.current||j(O,t),p.current};return R.cancel=function(){i.current&&(v?cancelAnimationFrame(i.current):clearTimeout(i.current)),s.current=0,u.current=o.current=d.current=i.current=null},R.isPending=function(){return!!i.current},R.flush=function(){return i.current?I(Date.now()):p.current},R},[b,w,t,C,S,v]);return _}function aY(e,t){return e===t}function uC(e){return typeof e=="function"?function(){return e}:e}function Tj(e,t,n){var r,o,s=n&&n.equalityFn||aY,i=(r=f.useState(uC(e)),o=r[1],[r[0],f.useCallback(function(m){return o(uC(m))},[])]),u=i[0],d=i[1],p=sY(f.useCallback(function(m){return d(m)},[d]),t,n),h=f.useRef(e);return s(h.current,e)||(p(e),h.current=e),[u,p]}const iY=ve([Mt,ur],({gallery:e,system:t,ui:n},r)=>{const{isProcessing:o,isConnected:s,shouldConfirmOnDelete:i,progressImage:u}=t,{shouldShowImageDetails:d,shouldHidePreview:p,shouldShowProgressInViewer:h}=n,m=e.selection[e.selection.length-1];return{canDeleteImage:s&&!o,shouldConfirmOnDelete:i,isProcessing:o,isConnected:s,shouldDisableToolbarButtons:!!u||!m,shouldShowImageDetails:d,activeTabName:r,shouldHidePreview:p,shouldShowProgressInViewer:h,lastSelectedImage:m}},{memoizeOptions:{resultEqualityCheck:Qt}}),lY=e=>{const t=te(),{isProcessing:n,isConnected:r,shouldDisableToolbarButtons:o,shouldShowImageDetails:s,lastSelectedImage:i,shouldShowProgressInViewer:u}=L(iY),d=xr("upscaling").isFeatureEnabled,p=Ql(),{t:h}=fe(),{recallBothPrompts:m,recallSeed:v,recallAllParameters:b}=y1(),[S,w]=Tj(i,500),{currentData:C,isFetching:_}=gs(i??Ko.skipToken),{currentData:k}=cv(w.isPending()?Ko.skipToken:S??Ko.skipToken),j=k==null?void 0:k.metadata,E=f.useCallback(()=>{b(j)},[j,b]);Ke("a",()=>{},[j,b]);const I=f.useCallback(()=>{v(j==null?void 0:j.seed)},[j==null?void 0:j.seed,v]);Ke("s",I,[C]);const O=f.useCallback(()=>{m(j==null?void 0:j.positive_prompt,j==null?void 0:j.negative_prompt)},[j==null?void 0:j.negative_prompt,j==null?void 0:j.positive_prompt,m]);Ke("p",O,[C]);const R=f.useCallback(()=>{t(k4()),t(If(C))},[t,C]);Ke("shift+i",R,[C]);const T=f.useCallback(()=>{C&&t(A4({image_name:C.image_name}))},[t,C]),A=f.useCallback(()=>{C&&t(uv(C))},[t,C]);Ke("Shift+U",()=>{T()},{enabled:()=>!!(d&&!o&&r&&!n)},[d,C,o,r,n]);const z=f.useCallback(()=>t(N8(!s)),[t,s]);Ke("i",()=>{C?z():p({title:h("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[C,s,p]);const $=f.useCallback(()=>{t(T4(!u))},[t,u]);return a.jsx(a.Fragment,{children:a.jsxs(F,{sx:{flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},...e,children:[a.jsx(Yn,{isAttached:!0,isDisabled:o,children:a.jsxs(Iu,{children:[a.jsx(Eu,{as:je,"aria-label":`${h("parameters.sendTo")}...`,tooltip:`${h("parameters.sendTo")}...`,isDisabled:!C,icon:a.jsx(M$,{})}),a.jsx(tc,{motionProps:_3,children:C&&a.jsx(B_,{imageDTO:C})})]})}),a.jsxs(Yn,{isAttached:!0,isDisabled:o,children:[a.jsx(je,{icon:a.jsx(F5,{}),tooltip:`${h("parameters.usePrompt")} (P)`,"aria-label":`${h("parameters.usePrompt")} (P)`,isDisabled:!(j!=null&&j.positive_prompt),onClick:O}),a.jsx(je,{icon:a.jsx(H5,{}),tooltip:`${h("parameters.useSeed")} (S)`,"aria-label":`${h("parameters.useSeed")} (S)`,isDisabled:!(j!=null&&j.seed),onClick:I}),a.jsx(je,{icon:a.jsx(D5,{}),tooltip:`${h("parameters.useAll")} (A)`,"aria-label":`${h("parameters.useAll")} (A)`,isDisabled:!j,onClick:E})]}),d&&a.jsx(Yn,{isAttached:!0,isDisabled:o,children:d&&a.jsx(oY,{imageDTO:C})}),a.jsx(Yn,{isAttached:!0,isDisabled:o,children:a.jsx(je,{icon:a.jsx(Uv,{}),tooltip:`${h("parameters.info")} (I)`,"aria-label":`${h("parameters.info")} (I)`,isChecked:s,onClick:z})}),a.jsx(Yn,{isAttached:!0,children:a.jsx(je,{"aria-label":h("settings.displayInProgress"),tooltip:h("settings.displayInProgress"),icon:a.jsx(b$,{}),isChecked:u,onClick:$})}),a.jsx(Yn,{isAttached:!0,children:a.jsx(tY,{onClick:A,isDisabled:o})})]})})},cY=ve([Mt,P4],(e,t)=>{const{total:n,isFetching:r}=e.gallery,o=e.gallery.selection[e.gallery.selection.length-1];if(!o||t.length===0)return{isOnFirstImage:!0,isOnLastImage:!0};const s=t.findIndex(b=>b.image_name===o),i=Vs(s+1,0,t.length-1),u=Vs(s-1,0,t.length-1),d=t[i].image_name,p=t[u].image_name,h=rx(e,d),m=rx(e,p),v=t.length;return{isOnFirstImage:s===0,isOnLastImage:!isNaN(s)&&s===v-1,areMoreImagesAvailable:n>v,isFetching:r,nextImage:h,prevImage:m,nextImageId:d,prevImageId:p}},{memoizeOptions:{resultEqualityCheck:Qt}}),Aj=()=>{const e=te(),{isOnFirstImage:t,isOnLastImage:n,nextImageId:r,prevImageId:o,areMoreImagesAvailable:s,isFetching:i}=L(cY),u=f.useCallback(()=>{o&&e(Ef(o))},[e,o]),d=f.useCallback(()=>{r&&e(Ef(r))},[e,r]),p=f.useCallback(()=>{e(j4({is_intermediate:!1}))},[e]);return{handlePrevImage:u,handleNextImage:d,isOnFirstImage:t,isOnLastImage:n,nextImageId:r,prevImageId:o,areMoreImagesAvailable:s,handleLoadMoreImages:p,isFetching:i}},as=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>{const{t:i}=fe();return t?a.jsxs(F,{gap:2,children:[n&&a.jsx(_n,{label:`Recall ${e}`,children:a.jsx(qa,{"aria-label":i("accessibility.useThisParameter"),icon:a.jsx(rF,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&a.jsx(_n,{label:`Copy ${e}`,children:a.jsx(qa,{"aria-label":`Copy ${e}`,icon:a.jsx(rc,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),a.jsxs(F,{direction:o?"column":"row",children:[a.jsxs(nt,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?a.jsxs(Ka,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",a.jsx(W5,{mx:"2px"})]}):a.jsx(nt,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}):null},uY=e=>{const{metadata:t}=e,{recallBothPrompts:n,recallPositivePrompt:r,recallNegativePrompt:o,recallSeed:s,recallInitialImage:i,recallCfgScale:u,recallModel:d,recallScheduler:p,recallSteps:h,recallWidth:m,recallHeight:v,recallStrength:b,recallAllParameters:S}=y1(),w=f.useCallback(()=>{r(t==null?void 0:t.positive_prompt)},[t==null?void 0:t.positive_prompt,r]),C=f.useCallback(()=>{o(t==null?void 0:t.negative_prompt)},[t==null?void 0:t.negative_prompt,o]),_=f.useCallback(()=>{s(t==null?void 0:t.seed)},[t==null?void 0:t.seed,s]),k=f.useCallback(()=>{d(t==null?void 0:t.model)},[t==null?void 0:t.model,d]),j=f.useCallback(()=>{m(t==null?void 0:t.width)},[t==null?void 0:t.width,m]),E=f.useCallback(()=>{v(t==null?void 0:t.height)},[t==null?void 0:t.height,v]),I=f.useCallback(()=>{p(t==null?void 0:t.scheduler)},[t==null?void 0:t.scheduler,p]),O=f.useCallback(()=>{h(t==null?void 0:t.steps)},[t==null?void 0:t.steps,h]),R=f.useCallback(()=>{u(t==null?void 0:t.cfg_scale)},[t==null?void 0:t.cfg_scale,u]),T=f.useCallback(()=>{b(t==null?void 0:t.strength)},[t==null?void 0:t.strength,b]);return!t||Object.keys(t).length===0?null:a.jsxs(a.Fragment,{children:[t.generation_mode&&a.jsx(as,{label:"Generation Mode",value:t.generation_mode}),t.positive_prompt&&a.jsx(as,{label:"Positive Prompt",labelPosition:"top",value:t.positive_prompt,onClick:w}),t.negative_prompt&&a.jsx(as,{label:"Negative Prompt",labelPosition:"top",value:t.negative_prompt,onClick:C}),t.seed!==void 0&&a.jsx(as,{label:"Seed",value:t.seed,onClick:_}),t.model!==void 0&&a.jsx(as,{label:"Model",value:t.model.model_name,onClick:k}),t.width&&a.jsx(as,{label:"Width",value:t.width,onClick:j}),t.height&&a.jsx(as,{label:"Height",value:t.height,onClick:E}),t.scheduler&&a.jsx(as,{label:"Scheduler",value:t.scheduler,onClick:I}),t.steps&&a.jsx(as,{label:"Steps",value:t.steps,onClick:O}),t.cfg_scale!==void 0&&a.jsx(as,{label:"CFG scale",value:t.cfg_scale,onClick:R}),t.strength&&a.jsx(as,{label:"Image to image strength",value:t.strength,onClick:T})]})},dY=e=>{const{copyTooltip:t,jsonObject:n}=e,r=f.useMemo(()=>JSON.stringify(n,null,2),[n]);return a.jsxs(F,{sx:{borderRadius:"base",bg:"whiteAlpha.500",_dark:{bg:"blackAlpha.500"},flexGrow:1,w:"full",h:"full",position:"relative"},children:[a.jsx(ze,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"auto",p:4},children:a.jsx(y_,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsx("pre",{children:r})})}),a.jsx(F,{sx:{position:"absolute",top:0,insetInlineEnd:0,p:2},children:a.jsx(_n,{label:t,children:a.jsx(qa,{"aria-label":t,icon:a.jsx(rc,{}),variant:"ghost",onClick:()=>navigator.clipboard.writeText(r)})})})]})},fY=({image:e})=>{const[t,n]=Tj(e.image_name,500),{currentData:r}=cv(n.isPending()?Ko.skipToken:t??Ko.skipToken),o=r==null?void 0:r.metadata,s=r==null?void 0:r.graph,i=f.useMemo(()=>{const u=[];return o&&u.push({label:"Core Metadata",data:o,copyTooltip:"Copy Core Metadata JSON"}),e&&u.push({label:"Image Details",data:e,copyTooltip:"Copy Image Details JSON"}),s&&u.push({label:"Graph",data:s,copyTooltip:"Copy Graph JSON"}),u},[o,s,e]);return a.jsxs(F,{sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",backdropFilter:"blur(20px)",bg:"baseAlpha.200",_dark:{bg:"blackAlpha.600"},borderRadius:"base",position:"absolute",overflow:"hidden"},children:[a.jsxs(F,{gap:2,children:[a.jsx(nt,{fontWeight:"semibold",children:"File:"}),a.jsxs(Ka,{href:e.image_url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.image_name,a.jsx(W5,{mx:"2px"})]})]}),a.jsx(uY,{metadata:o}),a.jsxs(ih,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsx(lh,{children:i.map(u=>a.jsx(dh,{sx:{borderTopRadius:"base"},children:a.jsx(nt,{sx:{color:"base.700",_dark:{color:"base.300"}},children:u.label})},u.label))}),a.jsx(uh,{sx:{w:"full",h:"full"},children:i.map(u=>a.jsx(ch,{sx:{w:"full",h:"full",p:0,pt:4},children:a.jsx(dY,{jsonObject:u.data,copyTooltip:u.copyTooltip})},u.label))})]})]})},pY=f.memo(fY),Ng={color:"base.100",pointerEvents:"auto"},hY=()=>{const{t:e}=fe(),{handlePrevImage:t,handleNextImage:n,isOnFirstImage:r,isOnLastImage:o,handleLoadMoreImages:s,areMoreImagesAvailable:i,isFetching:u}=Aj();return a.jsxs(ze,{sx:{position:"relative",height:"100%",width:"100%"},children:[a.jsx(ze,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineStart:0},children:!r&&a.jsx(qa,{"aria-label":e("accessibility.previousImage"),icon:a.jsx(n$,{size:64}),variant:"unstyled",onClick:t,boxSize:16,sx:Ng})}),a.jsxs(ze,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineEnd:0},children:[!o&&a.jsx(qa,{"aria-label":e("accessibility.nextImage"),icon:a.jsx(r$,{size:64}),variant:"unstyled",onClick:n,boxSize:16,sx:Ng}),o&&i&&!u&&a.jsx(qa,{"aria-label":e("accessibility.loadMore"),icon:a.jsx(t$,{size:64}),variant:"unstyled",onClick:s,boxSize:16,sx:Ng}),o&&i&&u&&a.jsx(F,{sx:{w:16,h:16,alignItems:"center",justifyContent:"center"},children:a.jsx(Jl,{opacity:.5,size:"xl"})})]})]})},mY=f.memo(hY),gY=ve([Mt,$8],({ui:e,system:t},n)=>{const{shouldShowImageDetails:r,shouldHidePreview:o,shouldShowProgressInViewer:s}=e,{progressImage:i,shouldAntialiasProgressImage:u}=t;return{shouldShowImageDetails:r,shouldHidePreview:o,imageName:n,progressImage:i,shouldShowProgressInViewer:s,shouldAntialiasProgressImage:u}},{memoizeOptions:{resultEqualityCheck:Qt}}),vY=()=>{const{shouldShowImageDetails:e,imageName:t,progressImage:n,shouldShowProgressInViewer:r,shouldAntialiasProgressImage:o}=L(gY),{handlePrevImage:s,handleNextImage:i,prevImageId:u,nextImageId:d,isOnLastImage:p,handleLoadMoreImages:h,areMoreImagesAvailable:m,isFetching:v}=Aj();Ke("left",()=>{s()},[u]),Ke("right",()=>{if(p&&m&&!v){h();return}p||i()},[d,p,m,h,v]);const{currentData:b,isLoading:S,isError:w,isSuccess:C}=gs(t??Ko.skipToken),_=f.useMemo(()=>{if(b)return{id:"current-image",payloadType:"IMAGE_DTO",payload:{imageDTO:b}}},[b]),k=f.useMemo(()=>({id:"current-image",actionType:"SET_CURRENT_IMAGE"}),[]),[j,E]=f.useState(!1),I=f.useRef(0),O=f.useCallback(()=>{E(!0),window.clearTimeout(I.current)},[]),R=f.useCallback(()=>{I.current=window.setTimeout(()=>{E(!1)},500)},[]);return a.jsxs(F,{onMouseOver:O,onMouseOut:R,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative"},children:[n&&r?a.jsx(bu,{src:n.dataURL,width:n.width,height:n.height,draggable:!1,sx:{objectFit:"contain",maxWidth:"full",maxHeight:"full",height:"auto",position:"absolute",borderRadius:"base",imageRendering:o?"auto":"pixelated"}}):a.jsx(Ja,{imageDTO:b,droppableData:k,draggableData:_,isUploadDisabled:!0,fitContainer:!0,dropLabel:"Set as Current Image"}),e&&b&&a.jsx(ze,{sx:{position:"absolute",top:"0",width:"full",height:"full",borderRadius:"base"},children:a.jsx(pY,{image:b})}),a.jsx(ws,{children:!e&&b&&j&&a.jsx(io.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(mY,{})},"nextPrevButtons")})]})},yY=f.memo(vY),bY=()=>a.jsxs(F,{sx:{position:"relative",flexDirection:"column",height:"100%",width:"100%",rowGap:4,alignItems:"center",justifyContent:"center"},children:[a.jsx(lY,{}),a.jsx(yY,{})]}),Nj=()=>a.jsx(ze,{layerStyle:"first",sx:{position:"relative",width:"100%",height:"100%",p:4,borderRadius:"base"},children:a.jsx(F,{sx:{width:"100%",height:"100%"},children:a.jsx(bY,{})})}),xY=e=>{const{label:t,activeLabel:n,children:r,defaultIsOpen:o=!1}=e,{isOpen:s,onToggle:i}=Ws({defaultIsOpen:o}),{colorMode:u}=Do();return a.jsxs(ze,{children:[a.jsxs(F,{onClick:i,sx:{alignItems:"center",p:2,px:4,gap:2,borderTopRadius:"base",borderBottomRadius:s?0:"base",bg:s?ke("base.200","base.750")(u):ke("base.150","base.800")(u),color:ke("base.900","base.100")(u),_hover:{bg:s?ke("base.250","base.700")(u):ke("base.200","base.750")(u)},fontSize:"sm",fontWeight:600,cursor:"pointer",transitionProperty:"common",transitionDuration:"normal",userSelect:"none"},children:[t,a.jsx(ws,{children:n&&a.jsx(io.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(nt,{sx:{color:"accent.500",_dark:{color:"accent.300"}},children:n})},"statusText")}),a.jsx($i,{}),a.jsx(Xv,{sx:{w:"1rem",h:"1rem",transform:s?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]}),a.jsx(Jp,{in:s,animateOpacity:!0,style:{overflow:"unset"},children:a.jsx(ze,{sx:{p:4,borderBottomRadius:"base",bg:ke("base.100","base.800")(u)},children:r})})]})},Ao=f.memo(xY),wY=ve(Mt,e=>{const{combinatorial:t,isEnabled:n}=e.dynamicPrompts;return{combinatorial:t,isDisabled:!n}},it),SY=()=>{const{combinatorial:e,isDisabled:t}=L(wY),n=te(),r=f.useCallback(()=>{n(z8())},[n]);return a.jsx(jn,{isDisabled:t,label:"Combinatorial Generation",isChecked:e,onChange:r})},CY=ve(Mt,e=>{const{isEnabled:t}=e.dynamicPrompts;return{isEnabled:t}},it),_Y=()=>{const e=te(),{isEnabled:t}=L(CY),n=f.useCallback(()=>{e(L8())},[e]);return a.jsx(jn,{label:"Enable Dynamic Prompts",isChecked:t,onChange:n})},kY=ve(Mt,e=>{const{maxPrompts:t,combinatorial:n,isEnabled:r}=e.dynamicPrompts,{min:o,sliderMax:s,inputMax:i}=e.config.sd.dynamicPrompts.maxPrompts;return{maxPrompts:t,min:o,sliderMax:s,inputMax:i,isDisabled:!r||!n}},it),PY=()=>{const{maxPrompts:e,min:t,sliderMax:n,inputMax:r,isDisabled:o}=L(kY),s=te(),i=f.useCallback(d=>{s(B8(d))},[s]),u=f.useCallback(()=>{s(F8())},[s]);return a.jsx(St,{label:"Max Prompts",isDisabled:o,min:t,max:n,value:e,onChange:i,sliderNumberInputProps:{max:r},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},jY=ve(Mt,e=>{const{isEnabled:t}=e.dynamicPrompts;return{activeLabel:t?"Enabled":void 0}},it),W1=()=>{const{activeLabel:e}=L(jY);return xr("dynamicPrompting").isFeatureEnabled?a.jsx(Ao,{label:"Dynamic Prompts",activeLabel:e,children:a.jsxs(F,{sx:{gap:2,flexDir:"column"},children:[a.jsx(_Y,{}),a.jsx(SY,{}),a.jsx(PY,{})]})}):null},IY=e=>{const t=te(),{lora:n}=e,r=f.useCallback(i=>{t(H8({id:n.id,weight:i}))},[t,n.id]),o=f.useCallback(()=>{t(W8(n.id))},[t,n.id]),s=f.useCallback(()=>{t(V8(n.id))},[t,n.id]);return a.jsxs(F,{sx:{gap:2.5,alignItems:"flex-end"},children:[a.jsx(St,{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]}),a.jsx(je,{size:"sm",onClick:s,tooltip:"Remove LoRA","aria-label":"Remove LoRA",icon:a.jsx(bo,{}),colorScheme:"error"})]})},EY=f.memo(IY),OY=ve(Mt,({lora:e})=>{const{loras:t}=e;return{loras:t}},it),RY=()=>{const{loras:e}=L(OY);return Cs(e,t=>a.jsx(EY,{lora:t},t.model_name))},MY=e=>{const{searchable:t=!0,tooltip:n,inputRef:r,onChange:o,label:s,disabled:i,...u}=e,d=te(),[p,h]=f.useState(""),m=f.useCallback(w=>{w.shiftKey&&d(Yo(!0))},[d]),v=f.useCallback(w=>{w.shiftKey||d(Yo(!1))},[d]),b=f.useCallback(w=>{h(""),o&&o(w)},[o]),S=vj();return a.jsx(_n,{label:n,placement:"top",hasArrow:!0,children:a.jsx(A1,{ref:r,label:s?a.jsx(Ss,{isDisabled:i,children:a.jsx(vs,{children:s})}):void 0,disabled:i,searchValue:p,onSearchChange:h,onChange:b,onKeyDown:m,onKeyUp:v,searchable:t,maxDropdownHeight:300,styles:S,...u})})},Rr=f.memo(MY),mr={"sd-1":"Stable Diffusion 1.x","sd-2":"Stable Diffusion 2.x",sdxl:"Stable Diffusion XL","sdxl-refiner":"Stable Diffusion XL Refiner"},DY=ve(Mt,({lora:e})=>({loras:e.loras}),it),TY=()=>{const e=te(),{loras:t}=L(DY),{data:n}=N4(),r=L(i=>i.generation.model),o=f.useMemo(()=>{if(!n)return[];const i=[];return yo(n.entities,(u,d)=>{if(!u||d in t)return;const p=(r==null?void 0:r.base_model)!==u.base_model;i.push({value:d,label:u.model_name,disabled:p,group:mr[u.base_model],tooltip:p?`Incompatible base model: ${u.base_model}`:void 0})}),i.sort((u,d)=>u.disabled&&!d.disabled?1:-1)},[t,n,r==null?void 0:r.base_model]),s=f.useCallback(i=>{if(!i)return;const u=n==null?void 0:n.entities[i];u&&e(U8(u))},[e,n==null?void 0:n.entities]);return(n==null?void 0:n.ids.length)===0?a.jsx(F,{sx:{justifyContent:"center",p:2},children:a.jsx(nt,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(Rr,{placeholder:o.length===0?"All LoRAs added":"Add LoRA",value:null,data:o,nothingFound:"No matching LoRAs",itemComponent:Vi,disabled:o.length===0,filter:(i,u)=>{var d;return((d=u.label)==null?void 0:d.toLowerCase().includes(i.toLowerCase().trim()))||u.value.toLowerCase().includes(i.toLowerCase().trim())},onChange:s})},AY=ve(Mt,e=>{const t=G8(e.lora.loras);return{activeLabel:t>0?`${t} Active`:void 0}},it),NY=()=>{const{activeLabel:e}=L(AY);return xr("lora").isFeatureEnabled?a.jsx(Ao,{label:"LoRA",activeLabel:e,children:a.jsxs(F,{sx:{flexDir:"column",gap:2},children:[a.jsx(TY,{}),a.jsx(RY,{})]})}):null},V1=f.memo(NY),$Y=ve(Mt,e=>({activeLabel:e.generation.clipSkip>0?"Clip Skip":void 0}),it);function U1(){const{activeLabel:e}=L($Y);return L(n=>n.ui.shouldShowAdvancedOptions)&&a.jsx(Ao,{label:"Advanced",activeLabel:e,children:a.jsx(F,{sx:{flexDir:"column",gap:2},children:a.jsx(q8,{})})})}const zY=Yp.child({module:"models"}),$j=e=>{const[t,n,r]=e.split("/"),o=K8.safeParse({base_model:t,model_name:r});if(!o.success){zY.error({controlNetModelId:e,errors:o.error.format()},"Failed to parse ControlNet model id");return}return o.data},LY=e=>{const{controlNetId:t}=e,n=te(),r=L($r),o=f.useMemo(()=>ve(Mt,({generation:v,controlNet:b})=>{var _,k;const{model:S}=v,w=(_=b.controlNets[t])==null?void 0:_.model,C=(k=b.controlNets[t])==null?void 0:k.isEnabled;return{mainModel:S,controlNetModel:w,isEnabled:C}},it),[t]),{mainModel:s,controlNetModel:i,isEnabled:u}=L(o),{data:d}=fv(),p=f.useMemo(()=>{if(!d)return[];const v=[];return yo(d.entities,(b,S)=>{if(!b)return;const w=(b==null?void 0:b.base_model)!==(s==null?void 0:s.base_model);v.push({value:S,label:b.model_name,group:mr[b.base_model],disabled:w,tooltip:w?`Incompatible base model: ${b.base_model}`:void 0})}),v},[d,s==null?void 0:s.base_model]),h=f.useMemo(()=>(d==null?void 0:d.entities[`${i==null?void 0:i.base_model}/controlnet/${i==null?void 0:i.model_name}`])??null,[i==null?void 0:i.base_model,i==null?void 0:i.model_name,d==null?void 0:d.entities]),m=f.useCallback(v=>{if(!v)return;const b=$j(v);b&&n($4({controlNetId:t,model:b}))},[t,n]);return a.jsx(Rr,{itemComponent:Vi,data:p,error:!h||(s==null?void 0:s.base_model)!==h.base_model,placeholder:"Select a model",value:(h==null?void 0:h.id)??null,onChange:m,disabled:r||!u,tooltip:h==null?void 0:h.description})},BY=f.memo(LY),FY=e=>{const{controlNetId:t}=e,n=te(),r=f.useMemo(()=>ve(Mt,({controlNet:u})=>{const{weight:d,isEnabled:p}=u.controlNets[t];return{weight:d,isEnabled:p}},it),[t]),{weight:o,isEnabled:s}=L(r),i=f.useCallback(u=>{n(Y8({controlNetId:t,weight:u}))},[t,n]);return a.jsx(St,{isDisabled:!s,label:"Weight",value:o,onChange:i,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2]})},HY=f.memo(FY),WY=e=>{const{height:t,controlNetId:n}=e,r=te(),o=f.useMemo(()=>ve(Mt,({controlNet:$})=>{const{pendingControlImages:ee}=$,{controlImage:B,processedControlImage:H,processorType:G,isEnabled:K}=$.controlNets[n];return{controlImageName:B,processedControlImageName:H,processorType:G,isEnabled:K,pendingControlImages:ee}},it),[n]),{controlImageName:s,processedControlImageName:i,processorType:u,pendingControlImages:d,isEnabled:p}=L(o),[h,m]=f.useState(!1),{currentData:v,isLoading:b,isError:S,isSuccess:w}=gs(s??Ko.skipToken),{currentData:C,isLoading:_,isError:k,isSuccess:j}=gs(i??Ko.skipToken),E=f.useCallback(()=>{r(Q8({controlNetId:n,controlImage:null}))},[n,r]),I=f.useCallback(()=>{m(!0)},[]),O=f.useCallback(()=>{m(!1)},[]),R=f.useMemo(()=>{if(v)return{id:n,payloadType:"IMAGE_DTO",payload:{imageDTO:v}}},[v,n]),T=f.useMemo(()=>({id:n,actionType:"SET_CONTROLNET_IMAGE",context:{controlNetId:n}}),[n]),A=f.useMemo(()=>({type:"SET_CONTROLNET_IMAGE",controlNetId:n}),[n]),z=v&&C&&!h&&!d.includes(n)&&u!=="none";return a.jsxs(F,{onMouseEnter:I,onMouseLeave:O,sx:{position:"relative",w:"full",h:t,alignItems:"center",justifyContent:"center",pointerEvents:p?"auto":"none",opacity:p?1:.5},children:[a.jsx(Ja,{draggableData:R,droppableData:T,imageDTO:v,isDropDisabled:z||!p,onClickReset:E,postUploadAction:A,resetTooltip:"Reset Control Image",withResetIcon:!!v}),a.jsx(ze,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",opacity:z?1:0,transitionProperty:"common",transitionDuration:"normal",pointerEvents:"none"},children:a.jsx(Ja,{draggableData:R,droppableData:T,imageDTO:C,isUploadDisabled:!0,isDropDisabled:!p,onClickReset:E,resetTooltip:"Reset Control Image",withResetIcon:!!v})}),d.includes(n)&&a.jsx(F,{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(Jl,{size:"xl",sx:{color:"base.100",_dark:{color:"base.400"}}})})]})},dC=f.memo(WY),_s=()=>{const e=te();return f.useCallback((n,r)=>{e(X8({controlNetId:n,changes:r}))},[e])};function ks(e){return a.jsx(F,{sx:{flexDirection:"column",gap:2},children:e.children})}const fC=Xo.canny_image_processor.default,VY=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{low_threshold:o,high_threshold:s}=n,i=L($r),u=_s(),d=f.useCallback(v=>{u(t,{low_threshold:v})},[t,u]),p=f.useCallback(()=>{u(t,{low_threshold:fC.low_threshold})},[t,u]),h=f.useCallback(v=>{u(t,{high_threshold:v})},[t,u]),m=f.useCallback(()=>{u(t,{high_threshold:fC.high_threshold})},[t,u]);return a.jsxs(ks,{children:[a.jsx(St,{isDisabled:i||!r,label:"Low Threshold",value:o,onChange:d,handleReset:p,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0}),a.jsx(St,{isDisabled:i||!r,label:"High Threshold",value:s,onChange:h,handleReset:m,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0})]})},UY=f.memo(VY),Dc=Xo.content_shuffle_image_processor.default,GY=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,w:i,h:u,f:d}=n,p=_s(),h=L($r),m=f.useCallback(I=>{p(t,{detect_resolution:I})},[t,p]),v=f.useCallback(()=>{p(t,{detect_resolution:Dc.detect_resolution})},[t,p]),b=f.useCallback(I=>{p(t,{image_resolution:I})},[t,p]),S=f.useCallback(()=>{p(t,{image_resolution:Dc.image_resolution})},[t,p]),w=f.useCallback(I=>{p(t,{w:I})},[t,p]),C=f.useCallback(()=>{p(t,{w:Dc.w})},[t,p]),_=f.useCallback(I=>{p(t,{h:I})},[t,p]),k=f.useCallback(()=>{p(t,{h:Dc.h})},[t,p]),j=f.useCallback(I=>{p(t,{f:I})},[t,p]),E=f.useCallback(()=>{p(t,{f:Dc.f})},[t,p]);return a.jsxs(ks,{children:[a.jsx(St,{label:"Detect Resolution",value:s,onChange:m,handleReset:v,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:h||!r}),a.jsx(St,{label:"Image Resolution",value:o,onChange:b,handleReset:S,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:h||!r}),a.jsx(St,{label:"W",value:i,onChange:w,handleReset:C,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:h||!r}),a.jsx(St,{label:"H",value:u,onChange:_,handleReset:k,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:h||!r}),a.jsx(St,{label:"F",value:d,onChange:j,handleReset:E,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:h||!r})]})},qY=f.memo(GY),pC=Xo.hed_image_processor.default,KY=e=>{const{controlNetId:t,processorNode:{detect_resolution:n,image_resolution:r,scribble:o},isEnabled:s}=e,i=L($r),u=_s(),d=f.useCallback(b=>{u(t,{detect_resolution:b})},[t,u]),p=f.useCallback(b=>{u(t,{image_resolution:b})},[t,u]),h=f.useCallback(b=>{u(t,{scribble:b.target.checked})},[t,u]),m=f.useCallback(()=>{u(t,{detect_resolution:pC.detect_resolution})},[t,u]),v=f.useCallback(()=>{u(t,{image_resolution:pC.image_resolution})},[t,u]);return a.jsxs(ks,{children:[a.jsx(St,{label:"Detect Resolution",value:n,onChange:d,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:i||!s}),a.jsx(St,{label:"Image Resolution",value:r,onChange:p,handleReset:v,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:i||!s}),a.jsx(jn,{label:"Scribble",isChecked:o,onChange:h,isDisabled:i||!s})]})},YY=f.memo(KY),hC=Xo.lineart_anime_image_processor.default,QY=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=_s(),u=L($r),d=f.useCallback(v=>{i(t,{detect_resolution:v})},[t,i]),p=f.useCallback(v=>{i(t,{image_resolution:v})},[t,i]),h=f.useCallback(()=>{i(t,{detect_resolution:hC.detect_resolution})},[t,i]),m=f.useCallback(()=>{i(t,{image_resolution:hC.image_resolution})},[t,i]);return a.jsxs(ks,{children:[a.jsx(St,{label:"Detect Resolution",value:s,onChange:d,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:u||!r}),a.jsx(St,{label:"Image Resolution",value:o,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:u||!r})]})},XY=f.memo(QY),mC=Xo.lineart_image_processor.default,JY=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,coarse:i}=n,u=_s(),d=L($r),p=f.useCallback(S=>{u(t,{detect_resolution:S})},[t,u]),h=f.useCallback(S=>{u(t,{image_resolution:S})},[t,u]),m=f.useCallback(()=>{u(t,{detect_resolution:mC.detect_resolution})},[t,u]),v=f.useCallback(()=>{u(t,{image_resolution:mC.image_resolution})},[t,u]),b=f.useCallback(S=>{u(t,{coarse:S.target.checked})},[t,u]);return a.jsxs(ks,{children:[a.jsx(St,{label:"Detect Resolution",value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:d||!r}),a.jsx(St,{label:"Image Resolution",value:o,onChange:h,handleReset:v,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:d||!r}),a.jsx(jn,{label:"Coarse",isChecked:i,onChange:b,isDisabled:d||!r})]})},ZY=f.memo(JY),gC=Xo.mediapipe_face_processor.default,eQ=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{max_faces:o,min_confidence:s}=n,i=_s(),u=L($r),d=f.useCallback(v=>{i(t,{max_faces:v})},[t,i]),p=f.useCallback(v=>{i(t,{min_confidence:v})},[t,i]),h=f.useCallback(()=>{i(t,{max_faces:gC.max_faces})},[t,i]),m=f.useCallback(()=>{i(t,{min_confidence:gC.min_confidence})},[t,i]);return a.jsxs(ks,{children:[a.jsx(St,{label:"Max Faces",value:o,onChange:d,handleReset:h,withReset:!0,min:1,max:20,withInput:!0,withSliderMarks:!0,isDisabled:u||!r}),a.jsx(St,{label:"Min Confidence",value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:u||!r})]})},tQ=f.memo(eQ),vC=Xo.midas_depth_image_processor.default,nQ=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{a_mult:o,bg_th:s}=n,i=_s(),u=L($r),d=f.useCallback(v=>{i(t,{a_mult:v})},[t,i]),p=f.useCallback(v=>{i(t,{bg_th:v})},[t,i]),h=f.useCallback(()=>{i(t,{a_mult:vC.a_mult})},[t,i]),m=f.useCallback(()=>{i(t,{bg_th:vC.bg_th})},[t,i]);return a.jsxs(ks,{children:[a.jsx(St,{label:"a_mult",value:o,onChange:d,handleReset:h,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:u||!r}),a.jsx(St,{label:"bg_th",value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:u||!r})]})},rQ=f.memo(nQ),uf=Xo.mlsd_image_processor.default,oQ=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,thr_d:i,thr_v:u}=n,d=_s(),p=L($r),h=f.useCallback(k=>{d(t,{detect_resolution:k})},[t,d]),m=f.useCallback(k=>{d(t,{image_resolution:k})},[t,d]),v=f.useCallback(k=>{d(t,{thr_d:k})},[t,d]),b=f.useCallback(k=>{d(t,{thr_v:k})},[t,d]),S=f.useCallback(()=>{d(t,{detect_resolution:uf.detect_resolution})},[t,d]),w=f.useCallback(()=>{d(t,{image_resolution:uf.image_resolution})},[t,d]),C=f.useCallback(()=>{d(t,{thr_d:uf.thr_d})},[t,d]),_=f.useCallback(()=>{d(t,{thr_v:uf.thr_v})},[t,d]);return a.jsxs(ks,{children:[a.jsx(St,{label:"Detect Resolution",value:s,onChange:h,handleReset:S,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:p||!r}),a.jsx(St,{label:"Image Resolution",value:o,onChange:m,handleReset:w,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:p||!r}),a.jsx(St,{label:"W",value:i,onChange:v,handleReset:C,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:p||!r}),a.jsx(St,{label:"H",value:u,onChange:b,handleReset:_,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:p||!r})]})},sQ=f.memo(oQ),yC=Xo.normalbae_image_processor.default,aQ=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=_s(),u=L($r),d=f.useCallback(v=>{i(t,{detect_resolution:v})},[t,i]),p=f.useCallback(v=>{i(t,{image_resolution:v})},[t,i]),h=f.useCallback(()=>{i(t,{detect_resolution:yC.detect_resolution})},[t,i]),m=f.useCallback(()=>{i(t,{image_resolution:yC.image_resolution})},[t,i]);return a.jsxs(ks,{children:[a.jsx(St,{label:"Detect Resolution",value:s,onChange:d,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:u||!r}),a.jsx(St,{label:"Image Resolution",value:o,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:u||!r})]})},iQ=f.memo(aQ),bC=Xo.openpose_image_processor.default,lQ=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,hand_and_face:i}=n,u=_s(),d=L($r),p=f.useCallback(S=>{u(t,{detect_resolution:S})},[t,u]),h=f.useCallback(S=>{u(t,{image_resolution:S})},[t,u]),m=f.useCallback(()=>{u(t,{detect_resolution:bC.detect_resolution})},[t,u]),v=f.useCallback(()=>{u(t,{image_resolution:bC.image_resolution})},[t,u]),b=f.useCallback(S=>{u(t,{hand_and_face:S.target.checked})},[t,u]);return a.jsxs(ks,{children:[a.jsx(St,{label:"Detect Resolution",value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:d||!r}),a.jsx(St,{label:"Image Resolution",value:o,onChange:h,handleReset:v,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:d||!r}),a.jsx(jn,{label:"Hand and Face",isChecked:i,onChange:b,isDisabled:d||!r})]})},cQ=f.memo(lQ),xC=Xo.pidi_image_processor.default,uQ=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,scribble:i,safe:u}=n,d=_s(),p=L($r),h=f.useCallback(C=>{d(t,{detect_resolution:C})},[t,d]),m=f.useCallback(C=>{d(t,{image_resolution:C})},[t,d]),v=f.useCallback(()=>{d(t,{detect_resolution:xC.detect_resolution})},[t,d]),b=f.useCallback(()=>{d(t,{image_resolution:xC.image_resolution})},[t,d]),S=f.useCallback(C=>{d(t,{scribble:C.target.checked})},[t,d]),w=f.useCallback(C=>{d(t,{safe:C.target.checked})},[t,d]);return a.jsxs(ks,{children:[a.jsx(St,{label:"Detect Resolution",value:s,onChange:h,handleReset:v,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:p||!r}),a.jsx(St,{label:"Image Resolution",value:o,onChange:m,handleReset:b,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:p||!r}),a.jsx(jn,{label:"Scribble",isChecked:i,onChange:S}),a.jsx(jn,{label:"Safe",isChecked:u,onChange:w,isDisabled:p||!r})]})},dQ=f.memo(uQ),fQ=e=>null,pQ=f.memo(fQ),hQ=e=>{const{controlNetId:t}=e,n=f.useMemo(()=>ve(Mt,({controlNet:s})=>{const{isEnabled:i,processorNode:u}=s.controlNets[t];return{isEnabled:i,processorNode:u}},it),[t]),{isEnabled:r,processorNode:o}=L(n);return o.type==="canny_image_processor"?a.jsx(UY,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="hed_image_processor"?a.jsx(YY,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="lineart_image_processor"?a.jsx(ZY,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="content_shuffle_image_processor"?a.jsx(qY,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="lineart_anime_image_processor"?a.jsx(XY,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="mediapipe_face_processor"?a.jsx(tQ,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="midas_depth_image_processor"?a.jsx(rQ,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="mlsd_image_processor"?a.jsx(sQ,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="normalbae_image_processor"?a.jsx(iQ,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="openpose_image_processor"?a.jsx(cQ,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="pidi_image_processor"?a.jsx(dQ,{controlNetId:t,processorNode:o,isEnabled:r}):o.type==="zoe_depth_image_processor"?a.jsx(pQ,{controlNetId:t,processorNode:o,isEnabled:r}):null},mQ=f.memo(hQ),gQ=e=>{const{controlNetId:t}=e,n=te(),r=f.useMemo(()=>ve(Mt,({controlNet:d})=>{const{isEnabled:p,shouldAutoConfig:h}=d.controlNets[t];return{isEnabled:p,shouldAutoConfig:h}},it),[t]),{isEnabled:o,shouldAutoConfig:s}=L(r),i=L($r),u=f.useCallback(()=>{n(J8({controlNetId:t}))},[t,n]);return a.jsx(jn,{label:"Auto configure processor","aria-label":"Auto configure processor",isChecked:s,onChange:u,isDisabled:i||!o})},vQ=f.memo(gQ),wC=e=>`${Math.round(e*100)}%`,yQ=e=>{const{controlNetId:t}=e,n=te(),r=f.useMemo(()=>ve(Mt,({controlNet:d})=>{const{beginStepPct:p,endStepPct:h,isEnabled:m}=d.controlNets[t];return{beginStepPct:p,endStepPct:h,isEnabled:m}},it),[t]),{beginStepPct:o,endStepPct:s,isEnabled:i}=L(r),u=f.useCallback(d=>{n(ox({controlNetId:t,beginStepPct:d[0]})),n(sx({controlNetId:t,endStepPct:d[1]}))},[t,n]);return f.useCallback(()=>{n(ox({controlNetId:t,beginStepPct:0})),n(sx({controlNetId:t,endStepPct:1}))},[t,n]),a.jsxs(Ss,{isDisabled:!i,children:[a.jsx(vs,{children:"Begin / End Step Percentage"}),a.jsx(Cl,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(r5,{"aria-label":["Begin Step %","End Step %"],value:[o,s],onChange:u,min:0,max:1,step:.01,minStepsBetweenThumbs:5,isDisabled:!i,children:[a.jsx(o5,{children:a.jsx(s5,{})}),a.jsx(_n,{label:wC(o),placement:"top",hasArrow:!0,children:a.jsx(d0,{index:0})}),a.jsx(_n,{label:wC(s),placement:"top",hasArrow:!0,children:a.jsx(d0,{index:1})}),a.jsx(vf,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(vf,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(vf,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})},bQ=f.memo(yQ),xQ=[{label:"Balanced",value:"balanced"},{label:"Prompt",value:"more_prompt"},{label:"Control",value:"more_control"},{label:"Mega Control",value:"unbalanced"}];function wQ(e){const{controlNetId:t}=e,n=te(),r=f.useMemo(()=>ve(Mt,({controlNet:u})=>{const{controlMode:d,isEnabled:p}=u.controlNets[t];return{controlMode:d,isEnabled:p}},it),[t]),{controlMode:o,isEnabled:s}=L(r);fe();const i=f.useCallback(u=>{n(Z8({controlNetId:t,controlMode:u}))},[t,n]);return a.jsx(To,{disabled:!s,label:"Control Mode",data:xQ,value:String(o),onChange:i})}const SQ=ve(Wi,e=>Cs(Xo,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)),it),CQ=e=>{const t=te(),{controlNetId:n}=e,r=f.useMemo(()=>ve(Mt,({controlNet:p})=>{const{isEnabled:h,processorNode:m}=p.controlNets[n];return{isEnabled:h,processorNode:m}},it),[n]),o=L($r),s=L(SQ),{isEnabled:i,processorNode:u}=L(r),d=f.useCallback(p=>{t(e7({controlNetId:n,processorType:p}))},[n,t]);return a.jsx(Rr,{label:"Processor",value:u.type??"canny_image_processor",data:s,onChange:d,disabled:o||!i})},_Q=f.memo(CQ),kQ=e=>{const{controlNetId:t}=e,n=te(),r=ve(Mt,({controlNet:m})=>{const{isEnabled:v,shouldAutoConfig:b}=m.controlNets[t];return{isEnabled:v,shouldAutoConfig:b}},it),{isEnabled:o,shouldAutoConfig:s}=L(r),[i,u]=VB(!1),d=f.useCallback(()=>{n(t7({controlNetId:t}))},[t,n]),p=f.useCallback(()=>{n(n7({sourceControlNetId:t,newControlNetId:Ga()}))},[t,n]),h=f.useCallback(()=>{n(r7({controlNetId:t}))},[t,n]);return a.jsxs(F,{sx:{flexDir:"column",gap:2,p:3,borderRadius:"base",position:"relative",bg:"base.200",_dark:{bg:"base.850"}},children:[a.jsxs(F,{sx:{gap:2,alignItems:"center"},children:[a.jsx(jn,{tooltip:"Toggle this ControlNet","aria-label":"Toggle this ControlNet",isChecked:o,onChange:h}),a.jsx(ze,{sx:{w:"full",minW:0,opacity:o?1:.5,pointerEvents:o?"auto":"none",transitionProperty:"common",transitionDuration:"0.1s"},children:a.jsx(BY,{controlNetId:t})}),a.jsx(je,{size:"sm",tooltip:"Duplicate","aria-label":"Duplicate",onClick:p,icon:a.jsx(rc,{})}),a.jsx(je,{size:"sm",tooltip:"Delete","aria-label":"Delete",colorScheme:"error",onClick:d,icon:a.jsx(bo,{})}),a.jsx(je,{size:"sm",tooltip:i?"Hide Advanced":"Show Advanced","aria-label":i?"Hide Advanced":"Show Advanced",onClick:u,variant:"link",icon:a.jsx(Xv,{sx:{boxSize:4,color:"base.700",transform:i?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal",_dark:{color:"base.300"}}})}),!s&&a.jsx(ze,{sx:{position:"absolute",w:1.5,h:1.5,borderRadius:"full",top:4,insetInlineEnd:4,bg:"accent.700",_dark:{bg:"accent.400"}}})]}),a.jsxs(F,{sx:{w:"full",flexDirection:"column"},children:[a.jsxs(F,{sx:{gap:4,w:"full",alignItems:"center"},children:[a.jsxs(F,{sx:{flexDir:"column",gap:3,h:28,w:"full",paddingInlineStart:1,paddingInlineEnd:i?1:0,pb:2,justifyContent:"space-between"},children:[a.jsx(HY,{controlNetId:t}),a.jsx(bQ,{controlNetId:t})]}),!i&&a.jsx(F,{sx:{alignItems:"center",justifyContent:"center",h:28,w:28,aspectRatio:"1/1",mt:3},children:a.jsx(dC,{controlNetId:t,height:28})})]}),a.jsx(ze,{mt:2,children:a.jsx(wQ,{controlNetId:t})}),a.jsx(_Q,{controlNetId:t})]}),i&&a.jsxs(a.Fragment,{children:[a.jsx(dC,{controlNetId:t,height:"392px"}),a.jsx(vQ,{controlNetId:t}),a.jsx(mQ,{controlNetId:t})]})]})},PQ=f.memo(kQ),jQ=ve(Mt,e=>{const{isEnabled:t}=e.controlNet;return{isEnabled:t}},it),IQ=()=>{const{isEnabled:e}=L(jQ),t=te(),n=f.useCallback(()=>{t(o7())},[t]);return a.jsx(jn,{label:"Enable ControlNet",isChecked:e,onChange:n,formControlProps:{width:"100%"}})},EQ=ve(s7,e=>{const{controlNets:t,isEnabled:n}=e,r=a7(t),o=n&&r.length>0?`${r.length} Active`:void 0;return{controlNetsArray:Cs(t),activeLabel:o}},it),OQ=()=>{fe();const{controlNetsArray:e,activeLabel:t}=L(EQ),n=xr("controlNet").isFeatureDisabled,r=te(),{firstModel:o}=fv(void 0,{selectFromResult:i=>{var d,p;return{firstModel:(p=i.data)==null?void 0:p.entities[(d=i.data)==null?void 0:d.ids[0]]}}}),s=f.useCallback(()=>{if(!o)return;const i=Ga();r(i7({controlNetId:i})),r($4({controlNetId:i,model:o}))},[r,o]);return n?null:a.jsx(Ao,{label:"ControlNet",activeLabel:t,children:a.jsxs(F,{sx:{flexDir:"column",gap:3},children:[a.jsxs(F,{gap:2,alignItems:"center",children:[a.jsx(F,{sx:{flexDirection:"column",w:"100%",gap:2,px:4,py:2,borderRadius:4,bg:"base.200",_dark:{bg:"base.850"}},children:a.jsx(IQ,{})}),a.jsx(je,{tooltip:"Add ControlNet","aria-label":"Add ControlNet",icon:a.jsx(Tu,{}),isDisabled:!o,flexGrow:1,size:"md",onClick:s})]}),e.map((i,u)=>a.jsxs(f.Fragment,{children:[u>0&&a.jsx(ni,{}),a.jsx(PQ,{controlNetId:i.controlNetId})]},i.controlNetId))]})})},G1=f.memo(OQ),q1=e=>{e.stopPropagation()},RQ=tt((e,t)=>{const n=te(),r=f.useCallback(s=>{s.shiftKey&&n(Yo(!0))},[n]),o=f.useCallback(s=>{s.shiftKey||n(Yo(!1))},[n]);return a.jsx(l5,{ref:t,onPaste:q1,onKeyDown:r,onKeyUp:o,...e})}),zj=f.memo(RQ),MQ=e=>{const{onClick:t}=e;return a.jsx(je,{size:"sm","aria-label":"Add Embedding",tooltip:"Add Embedding",icon:a.jsx(Uv,{}),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})},Lj=f.memo(MQ),Bj=e=>{const{onSelect:t,isOpen:n,onClose:r,children:o}=e,{data:s}=l7(),i=f.useRef(null),u=L(h=>h.generation.model),d=f.useMemo(()=>{if(!s)return[];const h=[];return yo(s.entities,(m,v)=>{if(!m)return;const b=(u==null?void 0:u.base_model)!==m.base_model;h.push({value:m.model_name,label:m.model_name,group:mr[m.base_model],disabled:b,tooltip:b?`Incompatible base model: ${m.base_model}`:void 0})}),h.sort((m,v)=>m.disabled&&!v.disabled?1:-1)},[s,u==null?void 0:u.base_model]),p=f.useCallback(h=>{h&&t(h)},[t]);return a.jsxs(Bv,{initialFocusRef:i,isOpen:n,onClose:r,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(Lv,{children:o}),a.jsx(Fv,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Y6,{sx:{p:0,w:`calc(${F1} - 2rem )`},children:d.length===0?a.jsx(F,{sx:{justifyContent:"center",p:2},children:a.jsx(nt,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No Embeddings Loaded"})}):a.jsx(Rr,{inputRef:i,autoFocus:!0,placeholder:"Add Embedding",value:null,data:d,nothingFound:"No matching Embeddings",itemComponent:Vi,disabled:d.length===0,onDropdownClose:r,filter:(h,m)=>{var v;return((v=m.label)==null?void 0:v.toLowerCase().includes(h.toLowerCase().trim()))||m.value.toLowerCase().includes(h.toLowerCase().trim())},onChange:p})})})]})},K1=()=>{const e=L(m=>m.generation.negativePrompt),t=f.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Ws(),s=te(),{t:i}=fe(),u=f.useCallback(m=>{s(Uc(m.target.value))},[s]),d=f.useCallback(m=>{m.key==="<"&&o()},[o]),p=f.useCallback(m=>{if(!t.current)return;const v=t.current.selectionStart;if(v===void 0)return;let b=e.slice(0,v);b[b.length-1]!=="<"&&(b+="<"),b+=`${m}>`;const S=b.length;b+=e.slice(v),Xl.flushSync(()=>{s(Uc(b))}),t.current.selectionEnd=S,r()},[s,r,e]),h=xr("embedding").isFeatureEnabled;return a.jsxs(Ss,{children:[a.jsx(Bj,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(zj,{id:"negativePrompt",name:"negativePrompt",ref:t,value:e,placeholder:i("parameters.negativePromptPlaceholder"),onChange:u,resize:"vertical",fontSize:"sm",minH:16,...h&&{onKeyDown:d}})}),!n&&h&&a.jsx(ze,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Lj,{onClick:o})})]})},DQ=e=>{const r=e.split(",").map(o=>o.split(":")).map(o=>({seed:Number(o[0]),weight:Number(o[1])}));return Y1(r)?r:!1},Y1=e=>typeof e=="string"?!!DQ(e):!!(e.length&&!e.some(t=>{const{seed:n,weight:r}=t,o=!isNaN(parseInt(n.toString(),10)),s=!isNaN(parseInt(r.toString(),10))&&r>=0&&r<=1;return!(o&&s)})),TQ=ve([Mt,ur],(e,t)=>{const{generation:n,system:r}=e,{shouldGenerateVariations:o,seedWeights:s,initialImage:i,seed:u}=n,{isProcessing:d,isConnected:p}=r;let h=!0;const m=[];t==="img2img"&&!i&&(h=!1,m.push("No initial image selected"));const{isSuccess:v}=c7.endpoints.getMainModels.select()(e);return v||(h=!1,m.push("Models are not loaded")),d&&(h=!1,m.push("System Busy")),p||(h=!1,m.push("System Disconnected")),o&&(!(Y1(s)||s==="")||u===-1)&&(h=!1,m.push("Seed-Weights badly formatted.")),yo(e.controlNet.controlNets,(b,S)=>{b.model||(h=!1,m.push("ControlNet ${id} has no model selected."))}),{isReady:h,reasonsWhyNotReady:m}},it),Q1=()=>{const{isReady:e}=L(TQ);return e},AQ=ve([Mt,ur],({generation:e,ui:t},n)=>({shouldPinParametersPanel:t.shouldPinParametersPanel,prompt:e.positivePrompt,activeTabName:n}),{memoizeOptions:{resultEqualityCheck:Qt}}),X1=()=>{const e=te(),{prompt:t,shouldPinParametersPanel:n,activeTabName:r}=L(AQ),o=Q1(),s=f.useRef(null),{isOpen:i,onClose:u,onOpen:d}=Ws(),{t:p}=fe(),h=f.useCallback(S=>{e(Vc(S.target.value))},[e]);Ke("alt+a",()=>{var S;(S=s.current)==null||S.focus()},[]);const m=f.useCallback(S=>{if(!s.current)return;const w=s.current.selectionStart;if(w===void 0)return;let C=t.slice(0,w);C[C.length-1]!=="<"&&(C+="<"),C+=`${S}>`;const _=C.length;C+=t.slice(w),Xl.flushSync(()=>{e(Vc(C))}),s.current.selectionStart=_,s.current.selectionEnd=_,u()},[e,u,t]),v=xr("embedding").isFeatureEnabled,b=f.useCallback(S=>{S.key==="Enter"&&S.shiftKey===!1&&o&&(S.preventDefault(),e(pv()),e(hv(r))),v&&S.key==="<"&&d()},[o,e,r,d,v]);return a.jsxs(ze,{position:"relative",children:[a.jsx(Ss,{children:a.jsx(Bj,{isOpen:i,onClose:u,onSelect:m,children:a.jsx(zj,{id:"prompt",name:"prompt",ref:s,value:t,placeholder:p("parameters.positivePromptPlaceholder"),onChange:h,onKeyDown:b,resize:"vertical",minH:32})})}),!i&&v&&a.jsx(ze,{sx:{position:"absolute",top:n?6:0,insetInlineEnd:0},children:a.jsx(Lj,{onClick:d})})]})},NQ=ve(Mt,e=>{const{shouldUseNoiseSettings:t,shouldUseCpuNoise:n}=e.generation;return{isDisabled:!t,shouldUseCpuNoise:n}},it),$Q=()=>{const e=te(),{isDisabled:t,shouldUseCpuNoise:n}=L(NQ);fe();const r=o=>e(u7(o.target.checked));return a.jsx(jn,{isDisabled:t,label:"Use CPU Noise",isChecked:n,onChange:r})},zQ=ve(Mt,e=>{const{shouldUseNoiseSettings:t,threshold:n}=e.generation;return{isDisabled:!t,threshold:n}},it);function LQ(){const e=te(),{threshold:t,isDisabled:n}=L(zQ),{t:r}=fe();return a.jsx(St,{isDisabled:n,label:r("parameters.noiseThreshold"),min:0,max:20,step:.1,onChange:o=>e(ax(o)),handleReset:()=>e(ax(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}const BQ=()=>{const e=te(),t=L(r=>r.generation.shouldUseNoiseSettings);fe();const n=r=>e(d7(r.target.checked));return a.jsx(jn,{label:"Enable Noise Settings",isChecked:t,onChange:n})},FQ=ve(Mt,e=>{const{shouldUseNoiseSettings:t,perlin:n}=e.generation;return{isDisabled:!t,perlin:n}},it);function HQ(){const e=te(),{perlin:t,isDisabled:n}=L(FQ),{t:r}=fe();return a.jsx(St,{isDisabled:n,label:r("parameters.perlinNoise"),min:0,max:1,step:.05,onChange:o=>e(ix(o)),handleReset:()=>e(ix(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}const WQ=ve(Mt,e=>{const{shouldUseNoiseSettings:t}=e.generation;return{activeLabel:t?"Enabled":void 0}},it),VQ=()=>{const{t:e}=fe(),t=xr("noise").isFeatureEnabled,n=xr("perlinNoise").isFeatureEnabled,r=xr("noiseThreshold").isFeatureEnabled,{activeLabel:o}=L(WQ);return t?a.jsx(Ao,{label:e("parameters.noiseSettings"),activeLabel:o,children:a.jsxs(F,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(BQ,{}),a.jsx($Q,{}),n&&a.jsx(HQ,{}),r&&a.jsx(LQ,{})]})}):null},Fj=f.memo(VQ),UQ=ve(Jo,e=>{const{seamlessXAxis:t}=e;return{seamlessXAxis:t}},it),GQ=()=>{const{t:e}=fe(),{seamlessXAxis:t}=L(UQ),n=te(),r=f.useCallback(o=>{n(f7(o.target.checked))},[n]);return a.jsx(jn,{label:e("parameters.seamlessXAxis"),"aria-label":e("parameters.seamlessXAxis"),isChecked:t,onChange:r})},qQ=f.memo(GQ),KQ=ve(Jo,e=>{const{seamlessYAxis:t}=e;return{seamlessYAxis:t}},it),YQ=()=>{const{t:e}=fe(),{seamlessYAxis:t}=L(KQ),n=te(),r=f.useCallback(o=>{n(p7(o.target.checked))},[n]);return a.jsx(jn,{label:e("parameters.seamlessYAxis"),"aria-label":e("parameters.seamlessYAxis"),isChecked:t,onChange:r})},QQ=f.memo(YQ),XQ=(e,t)=>{if(e&&t)return"X & Y";if(e)return"X";if(t)return"Y"},JQ=ve(Jo,e=>{const{seamlessXAxis:t,seamlessYAxis:n}=e;return{activeLabel:XQ(t,n)}},it),ZQ=()=>{const{t:e}=fe(),{activeLabel:t}=L(JQ);return xr("seamless").isFeatureEnabled?a.jsx(Ao,{label:e("parameters.seamlessTiling"),activeLabel:t,children:a.jsxs(F,{sx:{gap:5},children:[a.jsx(ze,{flexGrow:1,children:a.jsx(qQ,{})}),a.jsx(ze,{flexGrow:1,children:a.jsx(QQ,{})})]})}):null},Hj=f.memo(ZQ);function eX(){const e=L(o=>o.generation.horizontalSymmetrySteps),t=L(o=>o.generation.steps),n=te(),{t:r}=fe();return a.jsx(St,{label:r("parameters.hSymmetryStep"),value:e,onChange:o=>n(lx(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(lx(0))})}function tX(){const e=L(o=>o.generation.verticalSymmetrySteps),t=L(o=>o.generation.steps),n=te(),{t:r}=fe();return a.jsx(St,{label:r("parameters.vSymmetryStep"),value:e,onChange:o=>n(cx(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(cx(0))})}function nX(){const e=L(n=>n.generation.shouldUseSymmetry),t=te();return a.jsx(jn,{label:"Enable Symmetry",isChecked:e,onChange:n=>t(h7(n.target.checked))})}const rX=ve(Mt,e=>({activeLabel:e.generation.shouldUseSymmetry?"Enabled":void 0}),it),oX=()=>{const{t:e}=fe(),{activeLabel:t}=L(rX);return xr("symmetry").isFeatureEnabled?a.jsx(Ao,{label:e("parameters.symmetry"),activeLabel:t,children:a.jsxs(F,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(nX,{}),a.jsx(eX,{}),a.jsx(tX,{})]})}):null},J1=f.memo(oX);function sX(){const e=L(o=>o.generation.variationAmount),t=L(o=>o.generation.shouldGenerateVariations),{t:n}=fe(),r=te();return a.jsx(St,{label:n("parameters.variationAmount"),value:e,step:.01,min:0,max:1,isDisabled:!t,onChange:o=>r(ux(o)),handleReset:()=>r(ux(.1)),withInput:!0,withReset:!0,withSliderMarks:!0})}const aX=()=>{const e=te(),t=L(r=>r.generation.shouldGenerateVariations);fe();const n=r=>e(m7(r.target.checked));return a.jsx(jn,{label:"Enable Variations",isChecked:t,onChange:n})},iX={display:"flex",flexDirection:"row",alignItems:"center",gap:10},lX=e=>{const{label:t="",labelPos:n="top",isDisabled:r=!1,isInvalid:o,formControlProps:s,...i}=e,u=te(),d=f.useCallback(h=>{h.shiftKey&&u(Yo(!0))},[u]),p=f.useCallback(h=>{h.shiftKey||u(Yo(!1))},[u]);return a.jsxs(Ss,{isInvalid:o,isDisabled:r,...s,style:n==="side"?iX:void 0,children:[t!==""&&a.jsx(vs,{children:t}),a.jsx(ku,{...i,onPaste:q1,onKeyDown:d,onKeyUp:p})]})},Ai=f.memo(lX);function cX(){const e=L(s=>s.generation.seedWeights),t=L(s=>s.generation.shouldGenerateVariations),{t:n}=fe(),r=te(),o=s=>r(g7(s.target.value));return a.jsx(Ai,{label:n("parameters.seedWeights"),value:e,isInvalid:t&&!(Y1(e)||e===""),isDisabled:!t,onChange:o})}const uX=ve(Mt,e=>({activeLabel:e.generation.shouldGenerateVariations?"Enabled":void 0}),it),dX=()=>{const{t:e}=fe(),{activeLabel:t}=L(uX);return xr("variation").isFeatureEnabled?a.jsx(Ao,{label:e("parameters.variations"),activeLabel:t,children:a.jsxs(F,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(aX,{}),a.jsx(sX,{}),a.jsx(cX,{})]})}):null},Z1=f.memo(dX),fX=ve(Mo,e=>({isProcessing:e.isProcessing,isConnected:e.isConnected,isCancelable:e.isCancelable,currentIteration:e.currentIteration,totalIterations:e.totalIterations,sessionId:e.sessionId,cancelType:e.cancelType,isCancelScheduled:e.isCancelScheduled}),{memoizeOptions:{resultEqualityCheck:Qt}}),pX=e=>{const t=te(),{btnGroupWidth:n="auto",...r}=e,{isProcessing:o,isConnected:s,isCancelable:i,cancelType:u,isCancelScheduled:d,sessionId:p}=L(fX),h=f.useCallback(()=>{if(p){if(u==="scheduled"){t(v7());return}t(y7({session_id:p}))}},[t,p,u]),{t:m}=fe(),v=f.useCallback(w=>{const C=Array.isArray(w)?w[0]:w;t(b7(C))},[t]);Ke("shift+x",()=>{(s||o)&&i&&h()},[s,o,i]);const b=f.useMemo(()=>m(d?"parameters.cancel.isScheduled":u==="immediate"?"parameters.cancel.immediate":"parameters.cancel.schedule"),[m,u,d]),S=f.useMemo(()=>d?a.jsx(x7,{}):u==="immediate"?a.jsx(ZB,{}):a.jsx(KB,{}),[u,d]);return a.jsxs(Yn,{isAttached:!0,width:n,children:[a.jsx(je,{icon:S,tooltip:b,"aria-label":b,isDisabled:!s||!o||!i,onClick:h,colorScheme:"error",id:"cancel-button",...r}),a.jsxs(Iu,{closeOnSelect:!1,children:[a.jsx(Eu,{as:je,tooltip:m("parameters.cancel.setType"),"aria-label":m("parameters.cancel.setType"),icon:a.jsx(L$,{w:"1em",h:"1em"}),paddingX:0,paddingY:0,colorScheme:"error",minWidth:5,...r}),a.jsx(tc,{minWidth:"240px",children:a.jsxs(Nv,{value:u,title:"Cancel Type",type:"radio",onChange:v,children:[a.jsx(ru,{value:"immediate",children:m("parameters.cancel.immediate")}),a.jsx(ru,{value:"scheduled",children:m("parameters.cancel.schedule")})]})})]})]})},Dh=f.memo(pX),hX=ve(Mo,e=>({isProcessing:e.isProcessing,currentStep:e.currentStep,totalSteps:e.totalSteps,currentStatusHasSteps:e.currentStatusHasSteps}),{memoizeOptions:{resultEqualityCheck:Qt}}),mX=()=>{const{t:e}=fe(),{isProcessing:t,currentStep:n,totalSteps:r,currentStatusHasSteps:o}=L(hX),s=n?Math.round(n*100/r):0;return a.jsx(X6,{value:s,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:t&&!o,height:"full",colorScheme:"accent"})},Wj=f.memo(mX),SC={_disabled:{bg:"none",color:"base.600",cursor:"not-allowed",_hover:{color:"base.600",bg:"none"}}};function ey(e){const{iconButton:t=!1,...n}=e,r=te(),o=Q1(),s=L(ur),i=L(p=>p.system.isProcessing),u=f.useCallback(()=>{r(pv()),r(hv(s))},[r,s]),{t:d}=fe();return Ke(["ctrl+enter","meta+enter"],u,{enabled:()=>o,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,s]),a.jsx(ze,{style:{flexGrow:4},position:"relative",children:a.jsxs(ze,{style:{position:"relative"},children:[!o&&a.jsx(ze,{borderRadius:"base",style:{position:"absolute",bottom:"0",left:"0",right:"0",height:"100%",overflow:"clip"},...n,children:a.jsx(Wj,{})}),t?a.jsx(je,{"aria-label":d("parameters.invoke"),type:"submit",icon:a.jsx(B5,{}),isDisabled:!o||i,onClick:u,tooltip:d("parameters.invoke"),tooltipProps:{placement:"top"},colorScheme:"accent",id:"invoke-button",...n,sx:{w:"full",flexGrow:1,...i?SC:{}}}):a.jsx(Zt,{"aria-label":d("parameters.invoke"),type:"submit",isDisabled:!o||i,onClick:u,colorScheme:"accent",id:"invoke-button",...n,sx:{w:"full",flexGrow:1,fontWeight:700,...i?SC:{}},children:"Invoke"})]})})}const ty=()=>a.jsxs(F,{gap:2,children:[a.jsx(ey,{}),a.jsx(Dh,{})]}),Bp=/^-?(0\.)?\.?$/,gX=e=>{const{label:t,isDisabled:n=!1,showStepper:r=!0,isInvalid:o,value:s,onChange:i,min:u,max:d,isInteger:p=!0,formControlProps:h,formLabelProps:m,numberInputFieldProps:v,numberInputStepperProps:b,tooltipProps:S,...w}=e,C=te(),[_,k]=f.useState(String(s));f.useEffect(()=>{!_.match(Bp)&&s!==Number(_)&&k(String(s))},[s,_]);const j=R=>{k(R),R.match(Bp)||i(p?Math.floor(Number(R)):Number(R))},E=R=>{const T=Vs(p?Math.floor(Number(R.target.value)):Number(R.target.value),u,d);k(String(T)),i(T)},I=f.useCallback(R=>{R.shiftKey&&C(Yo(!0))},[C]),O=f.useCallback(R=>{R.shiftKey||C(Yo(!1))},[C]);return a.jsx(_n,{...S,children:a.jsxs(Ss,{isDisabled:n,isInvalid:o,...h,children:[t&&a.jsx(vs,{...m,children:t}),a.jsxs(z4,{value:_,min:u,max:d,keepWithinRange:!0,clampValueOnBlur:!1,onChange:j,onBlur:E,...w,onPaste:q1,children:[a.jsx(L4,{...v,onKeyDown:I,onKeyUp:O}),r&&a.jsxs(B4,{children:[a.jsx(F4,{...b}),a.jsx(H4,{...b})]})]})]})})},Th=f.memo(gX),vX=ve([Jo,Wi,Jr,xu],(e,t,n,r)=>{const{initial:o,min:s,sliderMax:i,inputMax:u}=t.sd.guidance,{cfgScale:d}=e,{shouldUseSliders:p}=n,{shift:h}=r;return{cfgScale:d,initial:o,min:s,sliderMax:i,inputMax:u,shouldUseSliders:p,shift:h}},it),yX=()=>{const{cfgScale:e,initial:t,min:n,sliderMax:r,inputMax:o,shouldUseSliders:s,shift:i}=L(vX),u=te(),{t:d}=fe(),p=f.useCallback(m=>u(kf(m)),[u]),h=f.useCallback(()=>u(kf(t)),[u,t]);return s?a.jsx(St,{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(Th,{label:d("parameters.cfgScale"),step:.5,min:n,max:o,onChange:p,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})},Hl=f.memo(yX),bX=ve([Mt],e=>{const{initial:t,min:n,sliderMax:r,inputMax:o,fineStep:s,coarseStep:i}=e.config.sd.iterations,{iterations:u}=e.generation,{shouldUseSliders:d}=e.ui,p=e.dynamicPrompts.isEnabled&&e.dynamicPrompts.combinatorial,h=e.hotkeys.shift?s:i;return{iterations:u,initial:t,min:n,sliderMax:r,inputMax:o,step:h,shouldUseSliders:d,isDisabled:p}},it),xX=()=>{const{iterations:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:i,isDisabled:u}=L(bX),d=te(),{t:p}=fe(),h=f.useCallback(v=>{d(dx(v))},[d]),m=f.useCallback(()=>{d(dx(t))},[d,t]);return i?a.jsx(St,{isDisabled:u,label:p("parameters.images"),step:s,min:n,max:r,onChange:h,handleReset:m,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:o}}):a.jsx(Th,{isDisabled:u,label:p("parameters.images"),step:s,min:n,max:o,onChange:h,value:e,numberInputFieldProps:{textAlign:"center"}})},Wl=f.memo(xX),wX=Yp.child({module:"models"}),Vj=e=>{const[t,n,r]=e.split("/"),o=w7.safeParse({base_model:t,model_name:r,model_type:n});if(!o.success){wX.error({mainModelId:e,errors:o.error.format()},"Failed to parse main model id");return}return o.data},SX=e=>{const[t,n,r]=e.split("/");return{base_model:t,model_name:r,model_type:n}},CX=ve(Mt,e=>({model:e.generation.model}),it),_X=()=>{const e=te(),{t}=fe(),{model:n}=L(CX),{data:r,isLoading:o}=ji(),{data:s,isLoading:i}=W4(),u=f.useMemo(()=>{if(!r)return[];const h=[];return yo(r.entities,(m,v)=>{!m||["sdxl","sdxl-refiner"].includes(m.base_model)||h.push({value:v,label:m.model_name,group:mr[m.base_model]})}),yo(s==null?void 0:s.entities,(m,v)=>{m&&h.push({value:v,label:m.model_name,group:mr[m.base_model]})}),h},[r,s]),d=f.useMemo(()=>((r==null?void 0:r.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])||(s==null?void 0:s.entities[`${n==null?void 0:n.base_model}/onnx/${n==null?void 0:n.model_name}`]))??null,[r==null?void 0:r.entities,n,s==null?void 0:s.entities]),p=f.useCallback(h=>{if(!h)return;let m=Vj(h);h.includes("onnx")&&(m=SX(h)),m&&e(Gg(m))},[e]);return o||i?a.jsx(Rr,{label:t("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):a.jsx(Rr,{tooltip:d==null?void 0:d.description,label:t("modelManager.model"),value:d==null?void 0:d.id,placeholder:u.length>0?"Select a model":"No models available",data:u,error:u.length===0,disabled:u.length===0,onChange:p})},kX=f.memo(_X),PX=Yp.child({module:"models"}),Uj=e=>{const[t,n,r]=e.split("/"),o=S7.safeParse({base_model:t,model_name:r});if(!o.success){PX.error({vaeModelId:e,errors:o.error.format()},"Failed to parse VAE model id");return}return o.data},jX=ve(Mt,({generation:e})=>{const{model:t,vae:n}=e;return{model:t,vae:n}},it),IX=()=>{const e=te(),{t}=fe(),{model:n,vae:r}=L(jX),{data:o}=V4(),s=f.useMemo(()=>{if(!o)return[];const d=[{value:"default",label:"Default",group:"Default"}];return yo(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:mr[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=f.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]),u=f.useCallback(d=>{if(!d||d==="default"){e(fx(null));return}const p=Uj(d);p&&e(fx(p))},[e]);return a.jsx(Rr,{itemComponent:Vi,tooltip:i==null?void 0:i.description,label:t("modelManager.vae"),value:(i==null?void 0:i.id)??"default",placeholder:"Default",data:s,onChange:u,disabled:s.length===0,clearable:!0})},EX=f.memo(IX),OX=ve([Jr,Jo],(e,t)=>{const{scheduler:n}=t,{favoriteSchedulers:r}=e,o=M4.map(s=>({value:s,label:D4[s],group:r.includes(s)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{scheduler:n,data:o}},it),RX=()=>{const e=te(),{t}=fe(),{scheduler:n,data:r}=L(OX),o=f.useCallback(s=>{s&&e(qg(s))},[e]);return a.jsx(Rr,{label:t("parameters.scheduler"),value:n,data:r,onChange:o})},MX=f.memo(RX),DX=()=>{const e=xr("vae").isFeatureEnabled;return a.jsxs(F,{gap:3,w:"full",flexWrap:e?"wrap":"nowrap",children:[a.jsx(ze,{w:"full",children:a.jsx(kX,{})}),a.jsxs(F,{gap:3,w:"full",children:[e&&a.jsx(ze,{w:"full",children:a.jsx(EX,{})}),a.jsx(ze,{w:"full",children:a.jsx(MX,{})})]})]})},Vl=f.memo(DX),TX=[{name:"Free",value:null},{name:"Portrait",value:.67/1},{name:"Wide",value:16/9},{name:"Square",value:1/1}];function Gj(){const e=L(o=>o.ui.aspectRatio),t=te(),n=L(o=>o.generation.shouldFitToWidthHeight),r=L(ur);return a.jsx(F,{gap:2,flexGrow:1,children:a.jsx(Yn,{isAttached:!0,children:TX.map(o=>a.jsx(Zt,{size:"sm",isChecked:e===o.value,isDisabled:r==="img2img"?!n:!1,onClick:()=>t(C7(o.value)),children:o.name},o.name))})})}const AX=ve([Jo,xu,Wi,Jr],(e,t,n,r)=>{const{initial:o,min:s,sliderMax:i,inputMax:u,fineStep:d,coarseStep:p}=n.sd.height,{height:h}=e,{aspectRatio:m}=r,v=t.shift?d:p;return{height:h,initial:o,min:s,sliderMax:i,inputMax:u,step:v,aspectRatio:m}},it),NX=e=>{const{height:t,initial:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:u}=L(AX),d=te(),{t:p}=fe(),h=f.useCallback(v=>{if(d(Al(v)),u){const b=cs(v*u,8);d(Tl(b))}},[d,u]),m=f.useCallback(()=>{if(d(Al(n)),u){const v=cs(n*u,8);d(Tl(v))}},[d,n,u]);return a.jsx(St,{label:p("parameters.height"),value:t,min:r,step:i,max:o,onChange:h,handleReset:m,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},$X=f.memo(NX),zX=ve([Jo,xu,Wi,Jr],(e,t,n,r)=>{const{initial:o,min:s,sliderMax:i,inputMax:u,fineStep:d,coarseStep:p}=n.sd.width,{width:h}=e,{aspectRatio:m}=r,v=t.shift?d:p;return{width:h,initial:o,min:s,sliderMax:i,inputMax:u,step:v,aspectRatio:m}},it),LX=e=>{const{width:t,initial:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:u}=L(zX),d=te(),{t:p}=fe(),h=f.useCallback(v=>{if(d(Tl(v)),u){const b=cs(v/u,8);d(Al(b))}},[d,u]),m=f.useCallback(()=>{if(d(Tl(n)),u){const v=cs(n/u,8);d(Al(v))}},[d,n,u]);return a.jsx(St,{label:p("parameters.width"),value:t,min:r,step:i,max:o,onChange:h,handleReset:m,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},BX=f.memo(LX);function Fp(){const{t:e}=fe(),t=te(),n=L(o=>o.generation.shouldFitToWidthHeight),r=L(ur);return a.jsxs(F,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.150",_dark:{bg:"base.750"}},children:[a.jsxs(F,{alignItems:"center",gap:2,children:[a.jsx(nt,{sx:{fontSize:"sm",width:"full",color:"base.700",_dark:{color:"base.300"}},children:e("parameters.aspectRatio")}),a.jsx($i,{}),a.jsx(Gj,{}),a.jsx(je,{tooltip:e("ui.swapSizes"),"aria-label":e("ui.swapSizes"),size:"sm",icon:a.jsx(U_,{}),fontSize:20,isDisabled:r==="img2img"?!n:!1,onClick:()=>t(_7())})]}),a.jsx(F,{gap:2,alignItems:"center",children:a.jsxs(F,{gap:2,flexDirection:"column",width:"full",children:[a.jsx(BX,{isDisabled:r==="img2img"?!n:!1}),a.jsx($X,{isDisabled:r==="img2img"?!n:!1})]})})]})}const FX=ve([Jo,Wi,Jr,xu],(e,t,n,r)=>{const{initial:o,min:s,sliderMax:i,inputMax:u,fineStep:d,coarseStep:p}=t.sd.steps,{steps:h}=e,{shouldUseSliders:m}=n,v=r.shift?d:p;return{steps:h,initial:o,min:s,sliderMax:i,inputMax:u,step:v,shouldUseSliders:m}},it),HX=()=>{const{steps:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:i}=L(FX),u=te(),{t:d}=fe(),p=f.useCallback(v=>{u(Pf(v))},[u]),h=f.useCallback(()=>{u(Pf(t))},[u,t]),m=f.useCallback(()=>{u(pv())},[u]);return i?a.jsx(St,{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(Th,{label:d("parameters.steps"),min:n,max:o,step:s,onChange:p,value:e,numberInputFieldProps:{textAlign:"center"},onBlur:m})},Ul=f.memo(HX);function WX(){const e=te(),t=L(o=>o.generation.shouldFitToWidthHeight),n=o=>e(k7(o.target.checked)),{t:r}=fe();return a.jsx(jn,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}const VX=ve([Jo,xu,Wi],(e,t,n)=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:u,coarseStep:d}=n.sd.img2imgStrength,{img2imgStrength:p}=e,h=t.shift?u:d;return{img2imgStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:h}},it),UX=()=>{const{img2imgStrength:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s}=L(VX),i=te(),{t:u}=fe(),d=f.useCallback(h=>i(jf(h)),[i]),p=f.useCallback(()=>{i(jf(t))},[i,t]);return a.jsx(St,{label:`${u("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}})},qj=f.memo(UX);function GX(){const e=L(i=>i.generation.seed),t=L(i=>i.generation.shouldRandomizeSeed),n=L(i=>i.generation.shouldGenerateVariations),{t:r}=fe(),o=te(),s=i=>o(_f(i));return a.jsx(Th,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:U4,max:G4,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e,formControlProps:{display:"flex",alignItems:"center",gap:3}})}const qX=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);function KX(){const e=te(),t=L(o=>o.generation.shouldRandomizeSeed),{t:n}=fe(),r=()=>e(_f(qX(U4,G4)));return a.jsx(je,{size:"sm",isDisabled:t,"aria-label":n("parameters.shuffle"),tooltip:n("parameters.shuffle"),onClick:r,icon:a.jsx(I$,{})})}const YX=()=>{const e=te(),{t}=fe(),n=L(o=>o.generation.shouldRandomizeSeed),r=o=>e(P7(o.target.checked));return a.jsx(jn,{label:t("common.random"),isChecked:n,onChange:r})},QX=f.memo(YX),XX=()=>a.jsxs(F,{sx:{gap:4,alignItems:"center"},children:[a.jsx(GX,{}),a.jsx(KX,{}),a.jsx(QX,{})]}),Gl=f.memo(XX),JX=ve([Jr,Jo],(e,t)=>{const{shouldUseSliders:n}=e,{shouldFitToWidthHeight:r,shouldRandomizeSeed:o}=t;return{shouldUseSliders:n,shouldFitToWidthHeight:r,activeLabel:o?void 0:"Manual Seed"}},it),ZX=()=>{const{shouldUseSliders:e,shouldFitToWidthHeight:t,activeLabel:n}=L(JX);return a.jsx(Ao,{label:"General",activeLabel:n,defaultIsOpen:!0,children:a.jsxs(F,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(Wl,{}),a.jsx(Ul,{}),a.jsx(Hl,{}),a.jsx(Vl,{}),a.jsx(ze,{pt:2,children:a.jsx(Gl,{})}),a.jsx(Fp,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(F,{gap:3,children:[a.jsx(Wl,{}),a.jsx(Ul,{}),a.jsx(Hl,{})]}),a.jsx(Vl,{}),a.jsx(ze,{pt:2,children:a.jsx(Gl,{})}),a.jsx(Fp,{})]}),a.jsx(qj,{}),a.jsx(WX,{})]})})},eJ=f.memo(ZX),tJ=()=>a.jsxs(a.Fragment,{children:[a.jsx(X1,{}),a.jsx(K1,{}),a.jsx(ty,{}),a.jsx(eJ,{}),a.jsx(G1,{}),a.jsx(V1,{}),a.jsx(W1,{}),a.jsx(Z1,{}),a.jsx(Fj,{}),a.jsx(J1,{}),a.jsx(Hj,{}),a.jsx(U1,{})]}),Kj=f.memo(tJ),nJ=()=>{const e=te(),t=f.useRef(null),n=f.useCallback(()=>{t.current&&t.current.setLayout([50,50])},[]);return a.jsxs(F,{sx:{gap:4,w:"full",h:"full"},children:[a.jsx(H1,{children:a.jsx(Kj,{})}),a.jsx(ze,{sx:{w:"full",h:"full"},children:a.jsxs(B1,{ref:t,autoSaveId:"imageTab.content",direction:"horizontal",style:{height:"100%",width:"100%"},children:[a.jsx(fu,{id:"imageTab.content.initImage",order:0,defaultSize:50,minSize:25,style:{position:"relative"},children:a.jsx(QK,{})}),a.jsx(Mj,{onDoubleClick:n}),a.jsx(fu,{id:"imageTab.content.selectedImage",order:1,defaultSize:50,minSize:25,onResize:()=>{e(vo())},children:a.jsx(Nj,{})})]})})]})},rJ=f.memo(nJ);var oJ=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 CC=vu(oJ);function V0(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 sJ=Object.defineProperty,_C=Object.getOwnPropertySymbols,aJ=Object.prototype.hasOwnProperty,iJ=Object.prototype.propertyIsEnumerable,kC=(e,t,n)=>t in e?sJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lJ=(e,t)=>{for(var n in t||(t={}))aJ.call(t,n)&&kC(e,n,t[n]);if(_C)for(var n of _C(t))iJ.call(t,n)&&kC(e,n,t[n]);return e};function Yj(e,t){if(t===null||typeof t!="object")return{};const n=lJ({},t);return Object.keys(t).forEach(r=>{r.includes(`${String(e)}.`)&&delete n[r]}),n}const cJ="__MANTINE_FORM_INDEX__";function PC(e,t){return t?typeof t=="boolean"?t:Array.isArray(t)?t.includes(e.replace(/[.][0-9]/g,`.${cJ}`)):!1:!1}function jC(e,t,n){typeof n.value=="object"&&(n.value=xl(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function xl(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(xl(i))})):s==="[object Map]"?(o=new Map,e.forEach(function(i,u){o.set(xl(u),xl(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(xl(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 U0(e,t,n="",r={}){return typeof e!="object"||e===null?r:Object.keys(e).reduce((o,s)=>{const i=e[s],u=`${n===""?"":`${n}.`}${s}`,d=ia(u,t);let p=!1;return typeof i=="function"&&(o[u]=i(d,t,u)),typeof i=="object"&&Array.isArray(d)&&(p=!0,d.forEach((h,m)=>U0(i,t,`${u}.${m}`,o))),typeof i=="object"&&typeof d=="object"&&d!==null&&(p||U0(i,t,u,o)),o},r)}function G0(e,t){return IC(typeof e=="function"?e(t):U0(e,t))}function df(e,t,n){if(typeof e!="string")return{hasError:!1,error:null};const r=G0(t,n),o=Object.keys(r.errors).find(s=>e.split(".").every((i,u)=>i===s.split(".")[u]));return{hasError:!!o,error:o?r.errors[o]:null}}function uJ(e,{from:t,to:n},r){const o=ia(e,r);if(!Array.isArray(o))return r;const s=[...o],i=o[t];return s.splice(t,1),s.splice(n,0,i),Ah(e,s,r)}var dJ=Object.defineProperty,EC=Object.getOwnPropertySymbols,fJ=Object.prototype.hasOwnProperty,pJ=Object.prototype.propertyIsEnumerable,OC=(e,t,n)=>t in e?dJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hJ=(e,t)=>{for(var n in t||(t={}))fJ.call(t,n)&&OC(e,n,t[n]);if(EC)for(var n of EC(t))pJ.call(t,n)&&OC(e,n,t[n]);return e};function mJ(e,{from:t,to:n},r){const o=`${e}.${t}`,s=`${e}.${n}`,i=hJ({},r);return Object.keys(r).every(u=>{let d,p;if(u.startsWith(o)&&(d=u,p=u.replace(o,s)),u.startsWith(s)&&(d=u.replace(s,o),p=u),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 gJ(e,t,n){const r=ia(e,n);return Array.isArray(r)?Ah(e,r.filter((o,s)=>s!==t),n):n}var vJ=Object.defineProperty,RC=Object.getOwnPropertySymbols,yJ=Object.prototype.hasOwnProperty,bJ=Object.prototype.propertyIsEnumerable,MC=(e,t,n)=>t in e?vJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xJ=(e,t)=>{for(var n in t||(t={}))yJ.call(t,n)&&MC(e,n,t[n]);if(RC)for(var n of RC(t))bJ.call(t,n)&&MC(e,n,t[n]);return e};function DC(e,t){const n=e.substring(t.length+1).split(".")[0];return parseInt(n,10)}function TC(e,t,n,r){if(t===void 0)return n;const o=`${String(e)}`;let s=n;r===-1&&(s=Yj(`${o}.${t}`,s));const i=xJ({},s),u=new Set;return Object.entries(s).filter(([d])=>{if(!d.startsWith(`${o}.`))return!1;const p=DC(d,o);return Number.isNaN(p)?!1:p>=t}).forEach(([d,p])=>{const h=DC(d,o),m=d.replace(`${o}.${h}`,`${o}.${h+r}`);i[m]=p,u.add(m),u.has(d)||delete i[d]}),i}function wJ(e,t,n,r){const o=ia(e,r);if(!Array.isArray(o))return r;const s=[...o];return s.splice(typeof n=="number"?n:s.length,0,t),Ah(e,s,r)}function AC(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 SJ(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 CJ=Object.defineProperty,_J=Object.defineProperties,kJ=Object.getOwnPropertyDescriptors,NC=Object.getOwnPropertySymbols,PJ=Object.prototype.hasOwnProperty,jJ=Object.prototype.propertyIsEnumerable,$C=(e,t,n)=>t in e?CJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$a=(e,t)=>{for(var n in t||(t={}))PJ.call(t,n)&&$C(e,n,t[n]);if(NC)for(var n of NC(t))jJ.call(t,n)&&$C(e,n,t[n]);return e},$g=(e,t)=>_J(e,kJ(t));function lc({initialValues:e={},initialErrors:t={},initialDirty:n={},initialTouched:r={},clearInputErrorOnChange:o=!0,validateInputOnChange:s=!1,validateInputOnBlur:i=!1,transformValues:u=p=>p,validate:d}={}){const[p,h]=f.useState(r),[m,v]=f.useState(n),[b,S]=f.useState(e),[w,C]=f.useState(V0(t)),_=f.useRef(e),k=Z=>{_.current=Z},j=f.useCallback(()=>h({}),[]),E=Z=>{const W=Z?$a($a({},b),Z):b;k(W),v({})},I=f.useCallback(Z=>C(W=>V0(typeof Z=="function"?Z(W):Z)),[]),O=f.useCallback(()=>C({}),[]),R=f.useCallback(()=>{S(e),O(),k(e),v({}),j()},[]),T=f.useCallback((Z,W)=>I(re=>$g($a({},re),{[Z]:W})),[]),A=f.useCallback(Z=>I(W=>{if(typeof Z!="string")return W;const re=$a({},W);return delete re[Z],re}),[]),z=f.useCallback(Z=>v(W=>{if(typeof Z!="string")return W;const re=Yj(Z,W);return delete re[Z],re}),[]),$=f.useCallback((Z,W)=>{const re=PC(Z,s);z(Z),h(pe=>$g($a({},pe),{[Z]:!0})),S(pe=>{const ne=Ah(Z,W,pe);if(re){const ge=df(Z,d,ne);ge.hasError?T(Z,ge.error):A(Z)}return ne}),!re&&o&&T(Z,null)},[]),ee=f.useCallback(Z=>{S(W=>{const re=typeof Z=="function"?Z(W):Z;return $a($a({},W),re)}),o&&O()},[]),B=f.useCallback((Z,W)=>{z(Z),S(re=>uJ(Z,W,re)),C(re=>mJ(Z,W,re))},[]),H=f.useCallback((Z,W)=>{z(Z),S(re=>gJ(Z,W,re)),C(re=>TC(Z,W,re,-1))},[]),G=f.useCallback((Z,W,re)=>{z(Z),S(pe=>wJ(Z,W,re,pe)),C(pe=>TC(Z,re,pe,1))},[]),K=f.useCallback(()=>{const Z=G0(d,b);return C(Z.errors),Z},[b,d]),M=f.useCallback(Z=>{const W=df(Z,d,b);return W.hasError?T(Z,W.error):A(Z),W},[b,d]),U=(Z,{type:W="input",withError:re=!0,withFocus:pe=!0}={})=>{const ge={onChange:SJ(ue=>$(Z,ue))};return re&&(ge.error=w[Z]),W==="checkbox"?ge.checked=ia(Z,b):ge.value=ia(Z,b),pe&&(ge.onFocus=()=>h(ue=>$g($a({},ue),{[Z]:!0})),ge.onBlur=()=>{if(PC(Z,i)){const ue=df(Z,d,b);ue.hasError?T(Z,ue.error):A(Z)}}),ge},V=(Z,W)=>re=>{re==null||re.preventDefault();const pe=K();pe.hasErrors?W==null||W(pe.errors,b,re):Z==null||Z(u(b),re)},J=Z=>u(Z||b),ie=f.useCallback(Z=>{Z.preventDefault(),R()},[]),xe=Z=>{if(Z){const re=ia(Z,m);if(typeof re=="boolean")return re;const pe=ia(Z,b),ne=ia(Z,_.current);return!CC(pe,ne)}return Object.keys(m).length>0?AC(m):!CC(b,_.current)},he=f.useCallback(Z=>AC(p,Z),[p]),ae=f.useCallback(Z=>Z?!df(Z,d,b).hasError:!G0(d,b).hasErrors,[b,d]);return{values:b,errors:w,setValues:ee,setErrors:I,setFieldValue:$,setFieldError:T,clearFieldError:A,clearErrors:O,reset:R,validate:K,validateField:M,reorderListItem:B,removeListItem:H,insertListItem:G,getInputProps:U,onSubmit:V,onReset:ie,isDirty:xe,isTouched:he,setTouched:h,setDirty:v,resetTouched:j,resetDirty:E,isValid:ae,getTransformedValues:J}}function Or(e){const{...t}=e,{base50:n,base100:r,base200:o,base300:s,base800:i,base700:u,base900:d,accent500:p,accent300:h}=N1(),{colorMode:m}=Do();return a.jsx(hj,{styles:()=>({input:{color:ke(d,r)(m),backgroundColor:ke(n,d)(m),borderColor:ke(o,i)(m),borderWidth:2,outline:"none",":focus":{borderColor:ke(h,p)(m)}},label:{color:ke(u,s)(m),fontWeight:"normal",marginBottom:4}}),...t})}const IJ=[{value:"sd-1",label:mr["sd-1"]},{value:"sd-2",label:mr["sd-2"]},{value:"sdxl",label:mr.sdxl},{value:"sdxl-refiner",label:mr["sdxl-refiner"]}];function Nh(e){const{...t}=e,{t:n}=fe();return a.jsx(To,{label:n("modelManager.baseModel"),data:IJ,...t})}function Xj(e){const{data:t}=q4(),{...n}=e;return a.jsx(To,{label:"Config File",placeholder:"Select A Config File",data:t||[],...n})}const EJ=[{value:"normal",label:"Normal"},{value:"inpaint",label:"Inpaint"},{value:"depth",label:"Depth"}];function $h(e){const{...t}=e,{t:n}=fe();return a.jsx(To,{label:n("modelManager.variant"),data:EJ,...t})}function Jj(e){const{t}=fe(),n=te(),{model_path:r}=e,o=lc({initialValues:{model_name:r?r.split("\\").splice(-1)[0].split(".")[0]:"",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]=K4(),[i,u]=f.useState(!1),d=p=>{s({body:p}).unwrap().then(h=>{n(rr(or({title:`Model Added: ${p.model_name}`,status:"success"}))),o.reset(),r&&n(wu(null))}).catch(h=>{h&&n(rr(or({title:"Model Add Failed",status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(p=>d(p)),style:{width:"100%"},children:a.jsxs(F,{flexDirection:"column",gap:2,children:[a.jsx(Or,{label:"Model Name",required:!0,...o.getInputProps("model_name")}),a.jsx(Nh,{...o.getInputProps("base_model")}),a.jsx(Or,{label:"Model Location",required:!0,...o.getInputProps("path")}),a.jsx(Or,{label:"Description",...o.getInputProps("description")}),a.jsx(Or,{label:"VAE Location",...o.getInputProps("vae")}),a.jsx($h,{...o.getInputProps("variant")}),a.jsxs(F,{flexDirection:"column",width:"100%",gap:2,children:[i?a.jsx(Or,{required:!0,label:"Custom Config File Location",...o.getInputProps("config")}):a.jsx(Xj,{required:!0,width:"100%",...o.getInputProps("config")}),a.jsx(Bn,{isChecked:i,onChange:()=>u(!i),label:"Use Custom Config"}),a.jsx(Zt,{mt:2,type:"submit",children:t("modelManager.addModel")})]})]})})}function Zj(e){const{t}=fe(),n=te(),{model_path:r}=e,[o]=K4(),s=lc({initialValues:{model_name:r?r.split("\\").splice(-1)[0]:"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"diffusers",error:void 0,vae:"",variant:"normal"}}),i=u=>{o({body:u}).unwrap().then(d=>{n(rr(or({title:`Model Added: ${u.model_name}`,status:"success"}))),s.reset(),r&&n(wu(null))}).catch(d=>{d&&n(rr(or({title:"Model Add Failed",status:"error"})))})};return a.jsx("form",{onSubmit:s.onSubmit(u=>i(u)),style:{width:"100%"},children:a.jsxs(F,{flexDirection:"column",gap:2,children:[a.jsx(Or,{required:!0,label:"Model Name",...s.getInputProps("model_name")}),a.jsx(Nh,{...s.getInputProps("base_model")}),a.jsx(Or,{required:!0,label:"Model Location",placeholder:"Provide the path to a local folder where your Diffusers Model is stored",...s.getInputProps("path")}),a.jsx(Or,{label:"Description",...s.getInputProps("description")}),a.jsx(Or,{label:"VAE Location",...s.getInputProps("vae")}),a.jsx($h,{...s.getInputProps("variant")}),a.jsx(Zt,{mt:2,type:"submit",children:t("modelManager.addModel")})]})})}const eI=[{label:"Diffusers",value:"diffusers"},{label:"Checkpoint / Safetensors",value:"checkpoint"}];function OJ(){const[e,t]=f.useState("diffusers");return a.jsxs(F,{flexDirection:"column",gap:4,width:"100%",children:[a.jsx(To,{label:"Model Type",value:e,data:eI,onChange:n=>{n&&t(n)}}),a.jsxs(F,{sx:{p:4,borderRadius:4,bg:"base.300",_dark:{bg:"base.850"}},children:[e==="diffusers"&&a.jsx(Zj,{}),e==="checkpoint"&&a.jsx(Jj,{})]})]})}const RJ=[{label:"None",value:"none"},{label:"v_prediction",value:"v_prediction"},{label:"epsilon",value:"epsilon"},{label:"sample",value:"sample"}];function MJ(){const e=te(),{t}=fe(),n=L(u=>u.system.isProcessing),[r,{isLoading:o}]=Y4(),s=lc({initialValues:{location:"",prediction_type:void 0}}),i=u=>{const d={location:u.location,prediction_type:u.prediction_type==="none"?void 0:u.prediction_type};r({body:d}).unwrap().then(p=>{e(rr(or({title:"Model Added",status:"success"}))),s.reset()}).catch(p=>{p&&(console.log(p),e(rr(or({title:`${p.data.detail} `,status:"error"}))))})};return a.jsx("form",{onSubmit:s.onSubmit(u=>i(u)),style:{width:"100%"},children:a.jsxs(F,{flexDirection:"column",width:"100%",gap:4,children:[a.jsx(Or,{label:"Model Location",placeholder:"Provide a path to a local Diffusers model, local checkpoint / safetensors model a HuggingFace Repo ID, or a checkpoint/diffusers model URL.",w:"100%",...s.getInputProps("location")}),a.jsx(To,{label:"Prediction Type (for Stable Diffusion 2.x Models only)",data:RJ,defaultValue:"none",...s.getInputProps("prediction_type")}),a.jsx(Zt,{type:"submit",isLoading:o,isDisabled:o||n,children:t("modelManager.addModel")})]})})}function DJ(){const[e,t]=f.useState("simple");return a.jsxs(F,{flexDirection:"column",width:"100%",overflow:"scroll",maxHeight:window.innerHeight-250,gap:4,children:[a.jsxs(Yn,{isAttached:!0,children:[a.jsx(Zt,{size:"sm",isChecked:e=="simple",onClick:()=>t("simple"),children:"Simple"}),a.jsx(Zt,{size:"sm",isChecked:e=="advanced",onClick:()=>t("advanced"),children:"Advanced"})]}),a.jsxs(F,{sx:{p:4,borderRadius:4,background:"base.200",_dark:{background:"base.800"}},children:[e==="simple"&&a.jsx(MJ,{}),e==="advanced"&&a.jsx(OJ,{})]})]})}function TJ(e){const{...t}=e;return a.jsx(iP,{w:"100%",...t,children:e.children})}function AJ(){const e=L(w=>w.modelmanager.searchFolder),[t,n]=f.useState(""),{data:r}=ji(),{foundModels:o,alreadyInstalled:s,filteredModels:i}=Q4({search_path:e||""},{selectFromResult:({data:w})=>{const C=a9(r==null?void 0:r.entities),_=Cs(C,"path"),k=r9(w,_),j=d9(w,_);return{foundModels:w,alreadyInstalled:zC(j,t),filteredModels:zC(k,t)}}}),[u,{isLoading:d}]=Y4(),p=te(),{t:h}=fe(),m=f.useCallback(w=>{const C=w.currentTarget.id.split("\\").splice(-1)[0];u({body:{location:w.currentTarget.id}}).unwrap().then(_=>{p(rr(or({title:`Added Model: ${C}`,status:"success"})))}).catch(_=>{_&&p(rr(or({title:"Faile To Add Model",status:"error"})))})},[p,u]),v=f.useCallback(w=>{n(w.target.value)},[]),b=({models:w,showActions:C=!0})=>w.map(_=>a.jsxs(F,{sx:{p:4,gap:4,alignItems:"center",borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(F,{w:"100%",sx:{flexDirection:"column",minW:"25%"},children:[a.jsx(nt,{sx:{fontWeight:600},children:_.split("\\").slice(-1)[0]}),a.jsx(nt,{sx:{fontSize:"sm",color:"base.600",_dark:{color:"base.400"}},children:_})]}),C?a.jsxs(F,{gap:2,children:[a.jsx(Zt,{id:_,onClick:m,isLoading:d,children:"Quick Add"}),a.jsx(Zt,{onClick:()=>p(wu(_)),isLoading:d,children:"Advanced"})]}):a.jsx(nt,{sx:{fontWeight:600,p:2,borderRadius:4,color:"accent.50",bg:"accent.400",_dark:{color:"accent.100",bg:"accent.600"}},children:"Installed"})]},_));return(()=>{if(e)return!o||o.length===0?a.jsx(F,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",height:96,userSelect:"none",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(nt,{variant:"subtext",children:"No Models Found"})}):a.jsxs(F,{sx:{flexDirection:"column",gap:2,w:"100%",minW:"50%"},children:[a.jsx(Ai,{onChange:v,label:h("modelManager.search"),labelPos:"side"}),a.jsxs(F,{p:2,gap:2,children:[a.jsxs(nt,{sx:{fontWeight:600},children:["Models Found: ",o.length]}),a.jsxs(nt,{sx:{fontWeight:600,color:"accent.500",_dark:{color:"accent.200"}},children:["Not Installed: ",i.length]})]}),a.jsx(TJ,{offsetScrollbars:!0,children:a.jsxs(F,{gap:2,flexDirection:"column",children:[b({models:i}),b({models:s,showActions:!1})]})})]})})()}const zC=(e,t)=>{const n=[];return yo(e,r=>{r&&r.includes(t)&&n.push(r)}),n};function NJ(){const e=L(i=>i.modelmanager.advancedAddScanModel),[t,n]=f.useState("diffusers"),[r,o]=f.useState(!0);f.useEffect(()=>{e&&[".ckpt",".safetensors",".pth",".pt"].some(i=>e.endsWith(i))?n("checkpoint"):n("diffusers")},[e,n,r]);const s=te();return e&&a.jsxs(ze,{as:io.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(F,{justifyContent:"space-between",alignItems:"center",children:[a.jsx(nt,{size:"xl",fontWeight:600,children:r||t==="checkpoint"?"Add Checkpoint Model":"Add Diffusers Model"}),a.jsx(je,{icon:a.jsx(N$,{}),"aria-label":"Close Advanced",onClick:()=>s(wu(null)),size:"sm"})]}),a.jsx(To,{label:"Model Type",value:t,data:eI,onChange:i=>{i&&(n(i),o(i==="checkpoint"))}}),r?a.jsx(Jj,{model_path:e},e):a.jsx(Zj,{model_path:e},e)]})}function $J(){const e=te(),{t}=fe(),n=L(u=>u.modelmanager.searchFolder),{refetch:r}=Q4({search_path:n||""}),o=lc({initialValues:{folder:""}}),s=f.useCallback(u=>{e(px(u.folder))},[e]),i=()=>{r()};return a.jsx("form",{onSubmit:o.onSubmit(u=>s(u)),style:{width:"100%"},children:a.jsxs(F,{sx:{w:"100%",gap:2,borderRadius:4,alignItems:"center"},children:[a.jsxs(F,{w:"100%",alignItems:"center",gap:4,minH:12,children:[a.jsx(nt,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",minW:"max-content",_dark:{color:"base.300"}},children:"Folder"}),n?a.jsx(F,{sx:{w:"100%",p:2,px:4,bg:"base.300",borderRadius:4,fontSize:"sm",fontWeight:"bold",_dark:{bg:"base.700"}},children:n}):a.jsx(Ai,{w:"100%",size:"md",...o.getInputProps("folder")})]}),a.jsxs(F,{gap:2,children:[n?a.jsx(je,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:a.jsx(A$,{}),onClick:i,fontSize:18,size:"sm"}):a.jsx(je,{"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),icon:a.jsx(O$,{}),fontSize:18,size:"sm",type:"submit"}),a.jsx(je,{"aria-label":t("modelManager.clearCheckpointFolder"),tooltip:t("modelManager.clearCheckpointFolder"),icon:a.jsx(bo,{}),size:"sm",onClick:()=>{e(px(null)),e(wu(null))},isDisabled:!n,colorScheme:"red"})]})]})})}const zJ=f.memo($J);function LJ(){return a.jsxs(F,{flexDirection:"column",w:"100%",gap:4,children:[a.jsx(zJ,{}),a.jsxs(F,{gap:4,children:[a.jsx(F,{sx:{maxHeight:window.innerHeight-300,overflow:"scroll",gap:4,w:"100%"},children:a.jsx(AJ,{})}),a.jsx(NJ,{})]})]})}function BJ(){const[e,t]=f.useState("add"),{t:n}=fe();return a.jsxs(F,{flexDirection:"column",gap:4,children:[a.jsxs(Yn,{isAttached:!0,children:[a.jsx(Zt,{onClick:()=>t("add"),isChecked:e=="add",size:"sm",width:"100%",children:n("modelManager.addModel")}),a.jsx(Zt,{onClick:()=>t("scan"),isChecked:e=="scan",size:"sm",width:"100%",children:n("modelManager.scanForModels")})]}),e=="add"&&a.jsx(DJ,{}),e=="scan"&&a.jsx(LJ,{})]})}const FJ=[{label:"Stable Diffusion 1",value:"sd-1"},{label:"Stable Diffusion 2",value:"sd-2"}];function HJ(){const{t:e}=fe(),t=te(),{data:n}=ji(),[r,{isLoading:o}]=j7(),[s,i]=f.useState("sd-1"),u=hx(n==null?void 0:n.entities,(M,U)=>(M==null?void 0:M.model_format)==="diffusers"&&(M==null?void 0:M.base_model)==="sd-1"),d=hx(n==null?void 0:n.entities,(M,U)=>(M==null?void 0:M.model_format)==="diffusers"&&(M==null?void 0:M.base_model)==="sd-2"),p=f.useMemo(()=>({"sd-1":u,"sd-2":d}),[u,d]),[h,m]=f.useState(Object.keys(p[s])[0]),[v,b]=f.useState(Object.keys(p[s])[1]),[S,w]=f.useState(null),[C,_]=f.useState(""),[k,j]=f.useState(.5),[E,I]=f.useState("weighted_sum"),[O,R]=f.useState("root"),[T,A]=f.useState(""),[z,$]=f.useState(!1),ee=Object.keys(p[s]).filter(M=>M!==v&&M!==S),B=Object.keys(p[s]).filter(M=>M!==h&&M!==S),H=Object.keys(p[s]).filter(M=>M!==h&&M!==v),G=M=>{i(M),m(null),b(null)},K=()=>{const M=[];let U=[h,v,S];U=U.filter(J=>J!==null),U.forEach(J=>{J&&M.push(J==null?void 0:J.split("/")[2])});const V={model_names:M,merged_model_name:C!==""?C:M.join("-"),alpha:k,interp:E,force:z,merge_dest_directory:O==="root"?void 0:T};r({base_model:s,body:V}).unwrap().then(J=>{t(rr(or({title:e("modelManager.modelsMerged"),status:"success"})))}).catch(J=>{J&&t(rr(or({title:e("modelManager.modelsMergeFailed"),status:"error"})))})};return a.jsxs(F,{flexDirection:"column",rowGap:4,children:[a.jsxs(F,{sx:{flexDirection:"column",rowGap:1},children:[a.jsx(nt,{children:e("modelManager.modelMergeHeaderHelp1")}),a.jsx(nt,{fontSize:"sm",variant:"subtext",children:e("modelManager.modelMergeHeaderHelp2")})]}),a.jsxs(F,{columnGap:4,children:[a.jsx(To,{label:"Model Type",w:"100%",data:FJ,value:s,onChange:G}),a.jsx(Rr,{label:e("modelManager.modelOne"),w:"100%",value:h,placeholder:e("modelManager.selectModel"),data:ee,onChange:M=>m(M)}),a.jsx(Rr,{label:e("modelManager.modelTwo"),w:"100%",placeholder:e("modelManager.selectModel"),value:v,data:B,onChange:M=>b(M)}),a.jsx(Rr,{label:e("modelManager.modelThree"),data:H,w:"100%",placeholder:e("modelManager.selectModel"),clearable:!0,onChange:M=>{M?(w(M),I("weighted_sum")):(w(null),I("add_difference"))}})]}),a.jsx(Ai,{label:e("modelManager.mergedModelName"),value:C,onChange:M=>_(M.target.value)}),a.jsxs(F,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(St,{label:e("modelManager.alpha"),min:.01,max:.99,step:.01,value:k,onChange:M=>j(M),withInput:!0,withReset:!0,handleReset:()=>j(.5),withSliderMarks:!0}),a.jsx(nt,{variant:"subtext",fontSize:"sm",children:e("modelManager.modelMergeAlphaHelp")})]}),a.jsxs(F,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(nt,{fontWeight:500,fontSize:"sm",variant:"subtext",children:e("modelManager.interpolationType")}),a.jsx(zf,{value:E,onChange:M=>I(M),children:a.jsx(F,{columnGap:4,children:S===null?a.jsxs(a.Fragment,{children:[a.jsx(sa,{value:"weighted_sum",children:a.jsx(nt,{fontSize:"sm",children:e("modelManager.weightedSum")})}),a.jsx(sa,{value:"sigmoid",children:a.jsx(nt,{fontSize:"sm",children:e("modelManager.sigmoid")})}),a.jsx(sa,{value:"inv_sigmoid",children:a.jsx(nt,{fontSize:"sm",children:e("modelManager.inverseSigmoid")})})]}):a.jsx(sa,{value:"add_difference",children:a.jsx(_n,{label:e("modelManager.modelMergeInterpAddDifferenceHelp"),children:a.jsx(nt,{fontSize:"sm",children:e("modelManager.addDifference")})})})})})]}),a.jsxs(F,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.900"}},children:[a.jsxs(F,{columnGap:4,children:[a.jsx(nt,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:e("modelManager.mergedModelSaveLocation")}),a.jsx(zf,{value:O,onChange:M=>R(M),children:a.jsxs(F,{columnGap:4,children:[a.jsx(sa,{value:"root",children:a.jsx(nt,{fontSize:"sm",children:e("modelManager.invokeAIFolder")})}),a.jsx(sa,{value:"custom",children:a.jsx(nt,{fontSize:"sm",children:e("modelManager.custom")})})]})})]}),O==="custom"&&a.jsx(Ai,{label:e("modelManager.mergedModelCustomSaveLocation"),value:T,onChange:M=>A(M.target.value)})]}),a.jsx(Bn,{label:e("modelManager.ignoreMismatch"),isChecked:z,onChange:M=>$(M.target.checked),fontWeight:"500"}),a.jsx(Zt,{onClick:K,isLoading:o,isDisabled:h===null||v===null,children:e("modelManager.merge")})]})}const WJ=tt((e,t)=>{const{t:n}=fe(),{acceptButtonText:r=n("common.accept"),acceptCallback:o,cancelButtonText:s=n("common.cancel"),cancelCallback:i,children:u,title:d,triggerComponent:p}=e,{isOpen:h,onOpen:m,onClose:v}=Ws(),b=f.useRef(null),S=()=>{o(),v()},w=()=>{i&&i(),v()};return a.jsxs(a.Fragment,{children:[f.cloneElement(p,{onClick:m,ref:t}),a.jsx(Ou,{isOpen:h,leastDestructiveRef:b,onClose:v,isCentered:!0,children:a.jsx(va,{children:a.jsxs(Ru,{children:[a.jsx(ga,{fontSize:"lg",fontWeight:"bold",children:d}),a.jsx(ya,{children:u}),a.jsxs(ma,{children:[a.jsx(Zt,{ref:b,onClick:w,children:s}),a.jsx(Zt,{colorScheme:"error",onClick:S,ml:3,children:r})]})]})})})]})}),ny=f.memo(WJ);function VJ(e){const{model:t}=e,n=te(),{t:r}=fe(),[o,{isLoading:s}]=I7(),[i,u]=f.useState("InvokeAIRoot"),[d,p]=f.useState("");f.useEffect(()=>{u("InvokeAIRoot")},[t]);const h=()=>{u("InvokeAIRoot")},m=()=>{const v={base_model:t.base_model,model_name:t.model_name,params:{convert_dest_directory:i==="Custom"?d:void 0}};if(i==="Custom"&&d===""){n(rr(or({title:r("modelManager.noCustomLocationProvided"),status:"error"})));return}n(rr(or({title:`${r("modelManager.convertingModelBegin")}: ${t.model_name}`,status:"success"}))),o(v).unwrap().then(b=>{n(rr(or({title:`${r("modelManager.modelConverted")}: ${t.model_name}`,status:"success"})))}).catch(b=>{n(rr(or({title:`${r("modelManager.modelConversionFailed")}: ${t.model_name}`,status:"error"})))})};return a.jsxs(ny,{title:`${r("modelManager.convert")} ${t.model_name}`,acceptCallback:m,cancelCallback:h,acceptButtonText:`${r("modelManager.convert")}`,triggerComponent:a.jsxs(Zt,{size:"sm","aria-label":r("modelManager.convertToDiffusers"),className:" modal-close-btn",isLoading:s,children:["🧨 ",r("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[a.jsxs(F,{flexDirection:"column",rowGap:4,children:[a.jsx(nt,{children:r("modelManager.convertToDiffusersHelpText1")}),a.jsxs(th,{children:[a.jsx(Eo,{children:r("modelManager.convertToDiffusersHelpText2")}),a.jsx(Eo,{children:r("modelManager.convertToDiffusersHelpText3")}),a.jsx(Eo,{children:r("modelManager.convertToDiffusersHelpText4")}),a.jsx(Eo,{children:r("modelManager.convertToDiffusersHelpText5")})]}),a.jsx(nt,{children:r("modelManager.convertToDiffusersHelpText6")})]}),a.jsxs(F,{flexDir:"column",gap:2,children:[a.jsxs(F,{marginTop:4,flexDir:"column",gap:2,children:[a.jsx(nt,{fontWeight:"600",children:r("modelManager.convertToDiffusersSaveLocation")}),a.jsx(zf,{value:i,onChange:v=>u(v),children:a.jsxs(F,{gap:4,children:[a.jsx(sa,{value:"InvokeAIRoot",children:a.jsx(_n,{label:"Save converted model in the InvokeAI root folder",children:r("modelManager.invokeRoot")})}),a.jsx(sa,{value:"Custom",children:a.jsx(_n,{label:"Save converted model in a custom folder",children:r("modelManager.custom")})})]})})]}),i==="Custom"&&a.jsxs(F,{flexDirection:"column",rowGap:2,children:[a.jsx(nt,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:r("modelManager.customSaveLocation")}),a.jsx(Ai,{value:d,onChange:v=>{p(v.target.value)},width:"full"})]})]})]})}function UJ(e){const t=L($r),{model:n}=e,[r,{isLoading:o}]=X4(),{data:s}=q4(),[i,u]=f.useState(!1);f.useEffect(()=>{s!=null&&s.includes(n.config)||u(!0)},[s,n.config]);const d=te(),{t:p}=fe(),h=lc({initialValues:{model_name:n.model_name?n.model_name:"",base_model:n.base_model,model_type:"main",path:n.path?n.path:"",description:n.description?n.description:"",model_format:"checkpoint",vae:n.vae?n.vae:"",config:n.config?n.config:"",variant:n.variant},validate:{path:v=>v.trim().length===0?"Must provide a path":null}}),m=f.useCallback(v=>{const b={base_model:n.base_model,model_name:n.model_name,body:v};r(b).unwrap().then(S=>{h.setValues(S),d(rr(or({title:p("modelManager.modelUpdated"),status:"success"})))}).catch(S=>{h.reset(),d(rr(or({title:p("modelManager.modelUpdateFailed"),status:"error"})))})},[h,d,n.base_model,n.model_name,p,r]);return a.jsxs(F,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(F,{justifyContent:"space-between",alignItems:"center",children:[a.jsxs(F,{flexDirection:"column",children:[a.jsx(nt,{fontSize:"lg",fontWeight:"bold",children:n.model_name}),a.jsxs(nt,{fontSize:"sm",color:"base.400",children:[mr[n.base_model]," Model"]})]}),["sdxl","sdxl-refiner"].includes(n.base_model)?a.jsx(Xa,{sx:{p:2,borderRadius:4,bg:"error.200",_dark:{bg:"error.400"}},children:"Conversion Not Supported"}):a.jsx(VJ,{model:n})]}),a.jsx(ni,{}),a.jsx(F,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",children:a.jsx("form",{onSubmit:h.onSubmit(v=>m(v)),children:a.jsxs(F,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Or,{label:p("modelManager.name"),...h.getInputProps("model_name")}),a.jsx(Or,{label:p("modelManager.description"),...h.getInputProps("description")}),a.jsx(Nh,{required:!0,...h.getInputProps("base_model")}),a.jsx($h,{required:!0,...h.getInputProps("variant")}),a.jsx(Or,{required:!0,label:p("modelManager.modelLocation"),...h.getInputProps("path")}),a.jsx(Or,{label:p("modelManager.vaeLocation"),...h.getInputProps("vae")}),a.jsxs(F,{flexDirection:"column",gap:2,children:[i?a.jsx(Or,{required:!0,label:p("modelManager.config"),...h.getInputProps("config")}):a.jsx(Xj,{required:!0,...h.getInputProps("config")}),a.jsx(Bn,{isChecked:i,onChange:()=>u(!i),label:"Use Custom Config"})]}),a.jsx(Zt,{type:"submit",isDisabled:t||o,isLoading:o,children:p("modelManager.updateModel")})]})})})]})}function GJ(e){const t=L($r),{model:n}=e,[r,{isLoading:o}]=X4(),s=te(),{t:i}=fe(),u=lc({initialValues:{model_name:n.model_name?n.model_name:"",base_model:n.base_model,model_type:"main",path:n.path?n.path:"",description:n.description?n.description:"",model_format:"diffusers",vae:n.vae?n.vae:"",variant:n.variant},validate:{path:p=>p.trim().length===0?"Must provide a path":null}}),d=f.useCallback(p=>{const h={base_model:n.base_model,model_name:n.model_name,body:p};r(h).unwrap().then(m=>{u.setValues(m),s(rr(or({title:i("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{u.reset(),s(rr(or({title:i("modelManager.modelUpdateFailed"),status:"error"})))})},[u,s,n.base_model,n.model_name,i,r]);return a.jsxs(F,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(F,{flexDirection:"column",children:[a.jsx(nt,{fontSize:"lg",fontWeight:"bold",children:n.model_name}),a.jsxs(nt,{fontSize:"sm",color:"base.400",children:[mr[n.base_model]," Model"]})]}),a.jsx(ni,{}),a.jsx("form",{onSubmit:u.onSubmit(p=>d(p)),children:a.jsxs(F,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Or,{label:i("modelManager.name"),...u.getInputProps("model_name")}),a.jsx(Or,{label:i("modelManager.description"),...u.getInputProps("description")}),a.jsx(Nh,{required:!0,...u.getInputProps("base_model")}),a.jsx($h,{required:!0,...u.getInputProps("variant")}),a.jsx(Or,{required:!0,label:i("modelManager.modelLocation"),...u.getInputProps("path")}),a.jsx(Or,{label:i("modelManager.vaeLocation"),...u.getInputProps("vae")}),a.jsx(Zt,{type:"submit",isDisabled:t||o,isLoading:o,children:i("modelManager.updateModel")})]})})]})}const qJ={"sd-1":"SD1","sd-2":"SD2",sdxl:"SDXL","sdxl-refiner":"SDXLR"};function LC(e){const t=L($r),{t:n}=fe(),r=te(),[o]=E7(),{model:s,isSelected:i,setSelectedModelId:u}=e,d=f.useCallback(()=>{u(s.id)},[s.id,u]),p=f.useCallback(()=>{o(s).unwrap().then(h=>{r(rr(or({title:`${n("modelManager.modelDeleted")}: ${s.model_name}`,status:"success"})))}).catch(h=>{h&&r(rr(or({title:`${n("modelManager.modelDeleteFailed")}: ${s.model_name}`,status:"success"})))}),u(void 0)},[o,s,u,r,n]);return a.jsxs(F,{sx:{gap:2,alignItems:"center",w:"full"},children:[a.jsx(F,{as:Zt,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(F,{gap:4,alignItems:"center",children:[a.jsx(Xa,{minWidth:14,p:1,fontSize:"sm",sx:{bg:"base.350",color:"base.900",_dark:{bg:"base.500"}},children:qJ[s.base_model]}),a.jsx(_n,{label:s.description,hasArrow:!0,placement:"bottom",children:a.jsx(nt,{sx:{fontWeight:500},children:s.model_name})})]})}),a.jsx(ny,{title:n("modelManager.deleteModel"),acceptCallback:p,acceptButtonText:n("modelManager.delete"),triggerComponent:a.jsx(je,{icon:a.jsx(z$,{}),"aria-label":n("modelManager.deleteConfig"),isDisabled:t,colorScheme:"error"}),children:a.jsxs(F,{rowGap:4,flexDirection:"column",children:[a.jsx("p",{style:{fontWeight:"bold"},children:n("modelManager.deleteMsg1")}),a.jsx("p",{children:n("modelManager.deleteMsg2")})]})})]})}const KJ=e=>{const{selectedModelId:t,setSelectedModelId:n}=e,{t:r}=fe(),[o,s]=f.useState(""),[i,u]=f.useState("all"),{filteredDiffusersModels:d}=ji(void 0,{selectFromResult:({data:m})=>({filteredDiffusersModels:BC(m,"diffusers",o)})}),{filteredCheckpointModels:p}=ji(void 0,{selectFromResult:({data:m})=>({filteredCheckpointModels:BC(m,"checkpoint",o)})}),h=f.useCallback(m=>{s(m.target.value)},[]);return a.jsx(F,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:a.jsxs(F,{flexDirection:"column",gap:4,paddingInlineEnd:4,children:[a.jsxs(Yn,{isAttached:!0,children:[a.jsx(Zt,{onClick:()=>u("all"),isChecked:i==="all",size:"sm",children:r("modelManager.allModels")}),a.jsx(Zt,{size:"sm",onClick:()=>u("diffusers"),isChecked:i==="diffusers",children:r("modelManager.diffusersModels")}),a.jsx(Zt,{size:"sm",onClick:()=>u("checkpoint"),isChecked:i==="checkpoint",children:r("modelManager.checkpointModels")})]}),a.jsx(Ai,{onChange:h,label:r("modelManager.search"),labelPos:"side"}),["all","diffusers"].includes(i)&&d.length>0&&a.jsx(FC,{children:a.jsxs(F,{sx:{gap:2,flexDir:"column"},children:[a.jsx(nt,{variant:"subtext",fontSize:"sm",children:"Diffusers"}),d.map(m=>a.jsx(LC,{model:m,isSelected:t===m.id,setSelectedModelId:n},m.id))]})}),["all","checkpoint"].includes(i)&&p.length>0&&a.jsx(FC,{children:a.jsxs(F,{sx:{gap:2,flexDir:"column"},children:[a.jsx(nt,{variant:"subtext",fontSize:"sm",children:"Checkpoint"}),p.map(m=>a.jsx(LC,{model:m,isSelected:t===m.id,setSelectedModelId:n},m.id))]})})]})})},BC=(e,t,n)=>{const r=[];return yo(e==null?void 0:e.entities,o=>{if(!o)return;const s=o.model_name.toLowerCase().includes(n.toLowerCase()),i=o.model_format===t;s&&i&&r.push(o)}),r},FC=e=>a.jsx(F,{flexDirection:"column",maxHeight:window.innerHeight-280,overflow:"scroll",gap:4,borderRadius:4,p:4,sx:{bg:"base.200",_dark:{bg:"base.800"}},children:e.children});function YJ(){const[e,t]=f.useState(),{model:n}=ji(void 0,{selectFromResult:({data:r})=>({model:e?r==null?void 0:r.entities[e]:void 0})});return a.jsxs(F,{sx:{gap:8,w:"full",h:"full"},children:[a.jsx(KJ,{selectedModelId:e,setSelectedModelId:t}),a.jsx(QJ,{model:n})]})}const QJ=e=>{const{model:t}=e;return(t==null?void 0:t.model_format)==="checkpoint"?a.jsx(UJ,{model:t},t.id):(t==null?void 0:t.model_format)==="diffusers"?a.jsx(GJ,{model:t},t.id):a.jsx(F,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",maxH:96,userSelect:"none"},children:a.jsx(nt,{variant:"subtext",children:"No Model Selected"})})},HC=[{id:"modelManager",label:yr.t("modelManager.modelManager"),content:a.jsx(YJ,{})},{id:"importModels",label:yr.t("modelManager.importModels"),content:a.jsx(BJ,{})},{id:"mergeModels",label:yr.t("modelManager.mergeModels"),content:a.jsx(HJ,{})}],XJ=()=>a.jsxs(ih,{isLazy:!0,variant:"line",layerStyle:"first",sx:{w:"full",h:"full",p:4,gap:4,borderRadius:"base"},children:[a.jsx(lh,{children:HC.map(e=>a.jsx(dh,{sx:{borderTopRadius:"base"},children:e.label},e.id))}),a.jsx(uh,{sx:{w:"full",h:"full"},children:HC.map(e=>a.jsx(ch,{sx:{w:"full",h:"full"},children:e.content},e.id))})]}),JJ=f.memo(XJ);const ZJ=e=>ve([t=>t.nodes],t=>{const n=t.invocationTemplates[e];if(n)return n},{memoizeOptions:{resultEqualityCheck:(t,n)=>t!==void 0&&n!==void 0&&t.type===n.type}}),eZ=(e,t)=>{const n={id:e,name:t.name,type:t.type};return t.inputRequirement!=="never"&&(t.type==="string"&&(n.value=t.default??""),t.type==="integer"&&(n.value=t.default??0),t.type==="float"&&(n.value=t.default??0),t.type==="boolean"&&(n.value=t.default??!1),t.type==="enum"&&(t.enumType==="number"&&(n.value=t.default??0),t.enumType==="string"&&(n.value=t.default??"")),t.type==="array"&&(n.value=t.default??1),t.type==="image"&&(n.value=void 0),t.type==="image_collection"&&(n.value=[]),t.type==="latents"&&(n.value=void 0),t.type==="conditioning"&&(n.value=void 0),t.type==="unet"&&(n.value=void 0),t.type==="clip"&&(n.value=void 0),t.type==="vae"&&(n.value=void 0),t.type==="control"&&(n.value=void 0),t.type==="model"&&(n.value=void 0),t.type==="vae_model"&&(n.value=void 0),t.type==="lora_model"&&(n.value=void 0),t.type==="controlnet_model"&&(n.value=void 0)),n},tZ=ve([e=>e.nodes],e=>e.invocationTemplates),ry="node-drag-handle",WC={dragHandle:`.${ry}`},nZ=()=>{const e=L(tZ),t=Qp();return f.useCallback(n=>{if(n==="progress_image"){const{x:h,y:m}=t.project({x:window.innerWidth/2.5,y:window.innerHeight/8});return{...WC,id:"progress_image",type:"progress_image",position:{x:h,y:m},data:{}}}const r=e[n];if(r===void 0){console.error(`Unable to find template ${n}.`);return}const o=Ga(),s=mx(r.inputs,(h,m,v)=>{const b=Ga(),S=eZ(b,m);return h[v]=S,h},{}),i=mx(r.outputs,(h,m,v)=>{const S={id:Ga(),name:v,type:m.type};return h[v]=S,h},{}),{x:u,y:d}=t.project({x:window.innerWidth/2.5,y:window.innerHeight/8});return{...WC,id:o,type:"invocation",position:{x:u,y:d},data:{id:o,type:n,inputs:s,outputs:i}}},[e,t])},rZ=e=>{const{nodeId:t,title:n,description:r}=e;return a.jsxs(F,{className:ry,sx:{borderTopRadius:"md",alignItems:"center",justifyContent:"space-between",px:2,py:1,bg:"base.100",_dark:{bg:"base.900"}},children:[a.jsx(_n,{label:t,children:a.jsx(aa,{size:"xs",sx:{fontWeight:600,color:"base.900",_dark:{color:"base.200"}},children:n})}),a.jsx(_n,{label:r,placement:"top",hasArrow:!0,shouldWrapChildren:!0,children:a.jsx(mo,{sx:{h:"min-content",color:"base.700",_dark:{color:"base.300"}},as:x$})})]})},tI=f.memo(rZ),nI=()=>{const e=Qp();return f.useCallback(({source:n,sourceHandle:r,target:o,targetHandle:s})=>(e.getEdges(),e.getNodes(),!0),[e])},oZ={position:"absolute",width:"1rem",height:"1rem",borderWidth:0},sZ={left:"-1rem"},aZ={right:"-0.5rem"},iZ=e=>{const{field:t,isValidConnection:n,handleType:r,styles:o}=e,{name:s,type:i}=t;return a.jsx(_n,{label:i,placement:r==="target"?"start":"end",hasArrow:!0,openDelay:J4,children:a.jsx(O7,{type:r,id:s,isValidConnection:n,position:r==="target"?gx.Left:gx.Right,style:{backgroundColor:Z4[i].colorCssVar,...o,...oZ,...r==="target"?sZ:aZ}})})},rI=f.memo(iZ),lZ=e=>a.jsx(C$,{}),cZ=f.memo(lZ),uZ=e=>{const{nodeId:t,field:n}=e,r=te(),o=s=>{r(Qo({nodeId:t,fieldName:n.name,value:s.target.checked}))};return a.jsx(Hv,{onChange:o,isChecked:n.value})},dZ=f.memo(uZ),fZ=e=>null,pZ=f.memo(fZ);function zh(){return(zh=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function q0(e){var t=f.useRef(e),n=f.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var ql=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:C.buttons>0)&&o.current?s(VC(o.current,C,u.current)):w(!1)},S=function(){return w(!1)};function w(C){var _=d.current,k=K0(o.current),j=C?k.addEventListener:k.removeEventListener;j(_?"touchmove":"mousemove",b),j(_?"touchend":"mouseup",S)}return[function(C){var _=C.nativeEvent,k=o.current;if(k&&(UC(_),!function(E,I){return I&&!Zc(E)}(_,d.current)&&k)){if(Zc(_)){d.current=!0;var j=_.changedTouches||[];j.length&&(u.current=j[0].identifier)}k.focus(),s(VC(k,_,u.current)),w(!0)}},function(C){var _=C.which||C.keyCode;_<37||_>40||(C.preventDefault(),i({left:_===39?.05:_===37?-.05:0,top:_===40?.05:_===38?-.05:0}))},w]},[i,s]),h=p[0],m=p[1],v=p[2];return f.useEffect(function(){return v},[v]),N.createElement("div",zh({},r,{onTouchStart:h,onMouseDown:h,className:"react-colorful__interactive",ref:o,onKeyDown:m,tabIndex:0,role:"slider"}))}),Lh=function(e){return e.filter(Boolean).join(" ")},sy=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=Lh(["react-colorful__pointer",e.className]);return N.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},N.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},so=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},sI=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:so(e.h),s:so(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:so(o/2),a:so(r,2)}},Y0=function(e){var t=sI(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},zg=function(e){var t=sI(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},hZ=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),u=r*(1-(t-s)*n),d=r*(1-(1-t+s)*n),p=s%6;return{r:so(255*[r,u,i,i,d,r][p]),g:so(255*[d,r,r,u,i,i][p]),b:so(255*[i,i,d,r,r,u][p]),a:so(o,2)}},mZ=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),u=i?s===t?(n-r)/i:s===n?2+(r-t)/i:4+(t-n)/i:0;return{h:so(60*(u<0?u+6:u)),s:so(s?i/s*100:0),v:so(s/255*100),a:o}},gZ=N.memo(function(e){var t=e.hue,n=e.onChange,r=Lh(["react-colorful__hue",e.className]);return N.createElement("div",{className:r},N.createElement(oy,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:ql(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":so(t),"aria-valuemax":"360","aria-valuemin":"0"},N.createElement(sy,{className:"react-colorful__hue-pointer",left:t/360,color:Y0({h:t,s:100,v:100,a:1})})))}),vZ=N.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Y0({h:t.h,s:100,v:100,a:1})};return N.createElement("div",{className:"react-colorful__saturation",style:r},N.createElement(oy,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:ql(t.s+100*o.left,0,100),v:ql(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+so(t.s)+"%, Brightness "+so(t.v)+"%"},N.createElement(sy,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Y0(t)})))}),aI=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function yZ(e,t,n){var r=q0(n),o=f.useState(function(){return e.toHsva(t)}),s=o[0],i=o[1],u=f.useRef({color:t,hsva:s});f.useEffect(function(){if(!e.equal(t,u.current.color)){var p=e.toHsva(t);u.current={hsva:p,color:t},i(p)}},[t,e]),f.useEffect(function(){var p;aI(s,u.current.hsva)||e.equal(p=e.fromHsva(s),u.current.color)||(u.current={hsva:s,color:p},r(p))},[s,e,r]);var d=f.useCallback(function(p){i(function(h){return Object.assign({},h,p)})},[]);return[s,d]}var bZ=typeof window<"u"?f.useLayoutEffect:f.useEffect,xZ=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},GC=new Map,wZ=function(e){bZ(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!GC.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}`,GC.set(t,n);var r=xZ();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},SZ=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+zg(Object.assign({},n,{a:0}))+", "+zg(Object.assign({},n,{a:1}))+")"},s=Lh(["react-colorful__alpha",t]),i=so(100*n.a);return N.createElement("div",{className:s},N.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),N.createElement(oy,{onMove:function(u){r({a:u.left})},onKey:function(u){r({a:ql(n.a+u.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},N.createElement(sy,{className:"react-colorful__alpha-pointer",left:n.a,color:zg(n)})))},CZ=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,i=oI(e,["className","colorModel","color","onChange"]),u=f.useRef(null);wZ(u);var d=yZ(n,o,s),p=d[0],h=d[1],m=Lh(["react-colorful",t]);return N.createElement("div",zh({},i,{ref:u,className:m}),N.createElement(vZ,{hsva:p,onChange:h}),N.createElement(gZ,{hue:p.h,onChange:h}),N.createElement(SZ,{hsva:p,onChange:h,className:"react-colorful__last-control"}))},_Z={defaultColor:{r:0,g:0,b:0,a:1},toHsva:mZ,fromHsva:hZ,equal:aI},iI=function(e){return N.createElement(CZ,zh({},e,{colorModel:_Z}))};const kZ=e=>{const{nodeId:t,field:n}=e,r=te(),o=s=>{r(Qo({nodeId:t,fieldName:n.name,value:s}))};return a.jsx(iI,{className:"nodrag",color:n.value,onChange:o})},PZ=f.memo(kZ),jZ=e=>null,IZ=f.memo(jZ),EZ=e=>null,OZ=f.memo(EZ),RZ=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te();fe();const{data:s}=fv(),i=f.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]),u=f.useMemo(()=>{if(!s)return[];const p=[];return yo(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:mr[h.base_model]})}),p},[s]),d=f.useCallback(p=>{if(!p)return;const h=$j(p);h&&o(Qo({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(To,{tooltip:i==null?void 0:i.description,label:(i==null?void 0:i.base_model)&&mr[i==null?void 0:i.base_model],value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:u,onChange:d})},MZ=f.memo(RZ),DZ=e=>{const{nodeId:t,field:n,template:r}=e,o=te(),s=i=>{o(Qo({nodeId:t,fieldName:n.name,value:i.target.value}))};return a.jsx(e5,{onChange:s,value:n.value,children:r.options.map(i=>a.jsx("option",{children:i},i))})},TZ=f.memo(DZ),AZ=e=>{var p;const{nodeId:t,field:n}=e,r=te();f.useCallback(({image_name:h})=>{r(Qo({nodeId:t,fieldName:n.name,value:R7([...n.value??[],{image_name:h}],"image_name")}))},[r,n.name,n.value,t]);const o={id:`node-${t}-${n.name}`,actionType:"SET_MULTI_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}},{isOver:s,setNodeRef:i,active:u,over:d}=sv({id:`node_${t}`,data:o});return f.useCallback(()=>{r(Qo({nodeId:t,fieldName:n.name,value:void 0}))},[r,n.name,t]),a.jsxs(F,{ref:i,sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",position:"relative",minH:"10rem"},children:[(p=n.value)==null?void 0:p.map(({image_name:h})=>a.jsx($Z,{imageName:h},h)),Cf(o,u)&&a.jsx(Kf,{isOver:s})]})},NZ=f.memo(AZ),$Z=e=>{const{currentData:t}=gs(e.imageName);return a.jsx(Ja,{imageDTO:t,isDropDisabled:!0,isDragDisabled:!0})},zZ=e=>{var v;const{nodeId:t,field:n}=e,r=te(),{currentData:o,isLoading:s,isError:i,isSuccess:u}=gs(((v=n.value)==null?void 0:v.image_name)??Ko.skipToken),d=f.useCallback(()=>{r(Qo({nodeId:t,fieldName:n.name,value:void 0}))},[r,n.name,t]),p=f.useMemo(()=>{if(o)return{id:`node-${t}-${n.name}`,payloadType:"IMAGE_DTO",payload:{imageDTO:o}}},[n.name,o,t]),h=f.useMemo(()=>({id:`node-${t}-${n.name}`,actionType:"SET_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}}),[n.name,t]),m=f.useMemo(()=>({type:"SET_NODES_IMAGE",nodeId:t,fieldName:n.name}),[t,n.name]);return a.jsx(F,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(Ja,{imageDTO:o,droppableData:h,draggableData:p,onClickReset:d,postUploadAction:m})})},LZ=f.memo(zZ),BZ=e=>a.jsx(e$,{}),qC=f.memo(BZ),FZ=e=>null,HZ=f.memo(FZ),WZ=Yp.child({module:"models"}),VZ=e=>{const[t,n,r]=e.split("/"),o=M7.safeParse({base_model:t,model_name:r});if(!o.success){WZ.error({loraModelId:e,errors:o.error.format()},"Failed to parse LoRA model id");return}return o.data},UZ=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=N4(),i=f.useMemo(()=>{if(!s)return[];const p=[];return yo(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:mr[h.base_model]})}),p.sort((h,m)=>h.disabled&&!m.disabled?1:-1)},[s]),u=f.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]),d=f.useCallback(p=>{if(!p)return;const h=VZ(p);h&&o(Qo({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return(s==null?void 0:s.ids.length)===0?a.jsx(F,{sx:{justifyContent:"center",p:2},children:a.jsx(nt,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(Rr,{value:(u==null?void 0:u.id)??null,label:(u==null?void 0:u.base_model)&&mr[u==null?void 0:u.base_model],placeholder:i.length>0?"Select a LoRA":"No LoRAs available",data:i,nothingFound:"No matching LoRAs",itemComponent:Vi,disabled:i.length===0,filter:(p,h)=>{var m;return((m=h.label)==null?void 0:m.toLowerCase().includes(p.toLowerCase().trim()))||h.value.toLowerCase().includes(p.toLowerCase().trim())},onChange:d})},GZ=f.memo(UZ),qZ=e=>{var m,v;const{nodeId:t,field:n}=e,r=te(),{t:o}=fe(),{data:s}=W4(),{data:i,isLoading:u}=ji(),d=f.useMemo(()=>{if(!i)return[];const b=[];return yo(i.entities,(S,w)=>{S&&b.push({value:w,label:S.model_name,group:mr[S.base_model]})}),s&&yo(s.entities,(S,w)=>{S&&b.push({value:w,label:S.model_name,group:mr[S.base_model]})}),b},[i,s]),p=f.useMemo(()=>{var b,S,w,C;return((i==null?void 0:i.entities[`${(b=n.value)==null?void 0:b.base_model}/main/${(S=n.value)==null?void 0:S.model_name}`])||(s==null?void 0:s.entities[`${(w=n.value)==null?void 0:w.base_model}/onnx/${(C=n.value)==null?void 0:C.model_name}`]))??null},[(m=n.value)==null?void 0:m.base_model,(v=n.value)==null?void 0:v.model_name,i==null?void 0:i.entities,s==null?void 0:s.entities]),h=f.useCallback(b=>{if(!b)return;const S=Vj(b);S&&r(Qo({nodeId:t,fieldName:n.name,value:S}))},[r,n.name,t]);return u?a.jsx(Rr,{label:o("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):a.jsx(Rr,{tooltip:p==null?void 0:p.description,label:(p==null?void 0:p.base_model)&&mr[p==null?void 0:p.base_model],value:p==null?void 0:p.id,placeholder:d.length>0?"Select a model":"No models available",data:d,error:d.length===0,disabled:d.length===0,onChange:h})},KZ=f.memo(qZ),YZ=e=>{const{nodeId:t,field:n}=e,r=te(),[o,s]=f.useState(String(n.value)),i=u=>{s(u),u.match(Bp)||r(Qo({nodeId:t,fieldName:n.name,value:e.template.type==="integer"?Math.floor(Number(u)):Number(u)}))};return f.useEffect(()=>{!o.match(Bp)&&n.value!==Number(o)&&s(String(n.value))},[n.value,o]),a.jsxs(z4,{onChange:i,value:o,step:e.template.type==="integer"?1:.1,precision:e.template.type==="integer"?0:3,children:[a.jsx(L4,{}),a.jsxs(B4,{children:[a.jsx(F4,{}),a.jsx(H4,{})]})]})},QZ=f.memo(YZ),XZ=e=>{const{nodeId:t,field:n}=e,r=te(),o=s=>{r(Qo({nodeId:t,fieldName:n.name,value:s.target.value}))};return a.jsx(ku,{onChange:o,value:n.value})},JZ=f.memo(XZ),ZZ=e=>null,eee=f.memo(ZZ),tee=e=>null,nee=f.memo(tee),ree=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te();fe();const{data:s}=V4(),i=f.useMemo(()=>{if(!s)return[];const p=[{value:"default",label:"Default",group:"Default"}];return yo(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:mr[h.base_model]})}),p.sort((h,m)=>h.disabled&&!m.disabled?1:-1)},[s]),u=f.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=f.useCallback(p=>{if(!p)return;const h=Uj(p);h&&o(Qo({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(Rr,{itemComponent:Vi,tooltip:u==null?void 0:u.description,label:(u==null?void 0:u.base_model)&&mr[u==null?void 0:u.base_model],value:(u==null?void 0:u.id)??"default",placeholder:"Default",data:i,onChange:d,disabled:i.length===0,clearable:!0})},oee=f.memo(ree),see=e=>{const{nodeId:t,field:n,template:r}=e,{type:o}=n;return o==="string"&&r.type==="string"?a.jsx(JZ,{nodeId:t,field:n,template:r}):o==="boolean"&&r.type==="boolean"?a.jsx(dZ,{nodeId:t,field:n,template:r}):o==="integer"&&r.type==="integer"||o==="float"&&r.type==="float"?a.jsx(QZ,{nodeId:t,field:n,template:r}):o==="enum"&&r.type==="enum"?a.jsx(TZ,{nodeId:t,field:n,template:r}):o==="image"&&r.type==="image"?a.jsx(LZ,{nodeId:t,field:n,template:r}):o==="latents"&&r.type==="latents"?a.jsx(HZ,{nodeId:t,field:n,template:r}):o==="conditioning"&&r.type==="conditioning"?a.jsx(IZ,{nodeId:t,field:n,template:r}):o==="unet"&&r.type==="unet"?a.jsx(eee,{nodeId:t,field:n,template:r}):o==="clip"&&r.type==="clip"?a.jsx(pZ,{nodeId:t,field:n,template:r}):o==="vae"&&r.type==="vae"?a.jsx(nee,{nodeId:t,field:n,template:r}):o==="control"&&r.type==="control"?a.jsx(OZ,{nodeId:t,field:n,template:r}):o==="model"&&r.type==="model"?a.jsx(KZ,{nodeId:t,field:n,template:r}):o==="vae_model"&&r.type==="vae_model"?a.jsx(oee,{nodeId:t,field:n,template:r}):o==="lora_model"&&r.type==="lora_model"?a.jsx(GZ,{nodeId:t,field:n,template:r}):o==="controlnet_model"&&r.type==="controlnet_model"?a.jsx(MZ,{nodeId:t,field:n,template:r}):o==="array"&&r.type==="array"?a.jsx(cZ,{nodeId:t,field:n,template:r}):o==="item"&&r.type==="item"?a.jsx(qC,{nodeId:t,field:n,template:r}):o==="color"&&r.type==="color"?a.jsx(PZ,{nodeId:t,field:n,template:r}):o==="item"&&r.type==="item"?a.jsx(qC,{nodeId:t,field:n,template:r}):o==="image_collection"&&r.type==="image_collection"?a.jsx(NZ,{nodeId:t,field:n,template:r}):a.jsxs(ze,{p:2,children:["Unknown field type: ",o]})},aee=f.memo(see);function iee(e){const{nodeId:t,input:n,template:r,connected:o}=e,s=nI();return a.jsx(ze,{className:"nopan",position:"relative",borderColor:r?!o&&["always","connectionOnly"].includes(String(r==null?void 0:r.inputRequirement))&&n.value===void 0?"warning.400":void 0:"error.400",children:a.jsx(Ss,{isDisabled:r?o:!0,pl:2,children:r?a.jsxs(a.Fragment,{children:[a.jsxs(Cl,{justifyContent:"space-between",alignItems:"center",children:[a.jsx(Cl,{children:a.jsx(_n,{label:r==null?void 0:r.description,placement:"top",hasArrow:!0,shouldWrapChildren:!0,openDelay:J4,children:a.jsx(vs,{children:r==null?void 0:r.title})})}),a.jsx(aee,{nodeId:t,field:n,template:r})]}),!["never","directOnly"].includes((r==null?void 0:r.inputRequirement)??"")&&a.jsx(rI,{nodeId:t,field:r,isValidConnection:s,handleType:"target"})]}):a.jsx(Cl,{justifyContent:"space-between",alignItems:"center",children:a.jsxs(vs,{children:["Unknown input: ",n.name]})})})})}const lee=e=>{const{nodeId:t,template:n,inputs:r}=e,o=L(i=>i.nodes.edges);return f.useCallback(()=>{const i=[],u=Cs(r);return u.forEach((d,p)=>{const h=n.inputs[d.name],m=!!o.filter(v=>v.target===t&&v.targetHandle===d.name).length;p{const{nodeId:t,template:n,outputs:r}=e,o=L(i=>i.nodes.edges);return f.useCallback(()=>{const i=[];return Cs(r).forEach(d=>{const p=n.outputs[d.name],h=!!o.filter(m=>m.source===t&&m.sourceHandle===d.name).length;i.push(a.jsx(uee,{nodeId:t,output:d,template:p,connected:h},d.id))}),a.jsx(F,{flexDir:"column",children:i})},[o,t,r,n.outputs])()},fee=f.memo(dee),pee=e=>{const{...t}=e;return a.jsx(_A,{style:{position:"absolute",border:"none",background:"transparent",width:15,height:15,bottom:0,right:0},minWidth:e3,...t})},Q0=f.memo(pee),X0=e=>{const[t,n]=Yl("shadows",["nodeSelectedOutline","dark-lg"]),r=L(o=>o.hotkeys.shift);return a.jsx(ze,{className:r?ry:"nopan",sx:{position:"relative",borderRadius:"md",minWidth:e3,shadow:e.selected?`${t}, ${n}`:`${n}`},children:e.children})},lI=f.memo(e=>{const{id:t,data:n,selected:r}=e,{type:o,inputs:s,outputs:i}=n,u=f.useMemo(()=>ZJ(o),[o]),d=L(u);return d?a.jsxs(X0,{selected:r,children:[a.jsx(tI,{nodeId:t,title:d.title,description:d.description}),a.jsxs(F,{className:"nopan",sx:{cursor:"auto",flexDirection:"column",borderBottomRadius:"md",py:2,bg:"base.150",_dark:{bg:"base.800"}},children:[a.jsx(fee,{nodeId:t,outputs:i,template:d}),a.jsx(cee,{nodeId:t,inputs:s,template:d})]}),a.jsx(Q0,{})]}):a.jsx(X0,{selected:r,children:a.jsxs(F,{className:"nopan",sx:{alignItems:"center",justifyContent:"center",cursor:"auto"},children:[a.jsx(mo,{as:u$,sx:{boxSize:32,color:"base.600",_dark:{color:"base.400"}}}),a.jsx(Q0,{})]})})});lI.displayName="InvocationComponent";const hee=e=>{const t=L(r=>r.system.progressImage),{selected:n}=e;return a.jsxs(X0,{selected:n,children:[a.jsx(tI,{title:"Progress Image",description:"Displays the progress image in the Node Editor"}),a.jsx(F,{className:"nopan",sx:{flexDirection:"column",borderBottomRadius:"md",p:2,bg:"base.200",_dark:{bg:"base.800"}},children:t?a.jsx(bu,{src:t.dataURL,sx:{w:"full",h:"full",objectFit:"contain"}}):a.jsx(F,{sx:{w:"full",h:"full",minW:32,minH:32,alignItems:"center",justifyContent:"center"},children:a.jsx(Li,{})})}),a.jsx(Q0,{maxHeight:(t==null?void 0:t.height)??512,maxWidth:(t==null?void 0:t.width)??512})]})},mee=f.memo(hee),gee=()=>{const{t:e}=fe(),{zoomIn:t,zoomOut:n,fitView:r}=Qp(),o=te(),s=L(S=>S.nodes.shouldShowGraphOverlay),i=L(S=>S.nodes.shouldShowFieldTypeLegend),u=L(S=>S.nodes.shouldShowMinimapPanel),d=f.useCallback(()=>{t()},[t]),p=f.useCallback(()=>{n()},[n]),h=f.useCallback(()=>{r()},[r]),m=f.useCallback(()=>{o(D7(!s))},[s,o]),v=f.useCallback(()=>{o(T7(!i))},[i,o]),b=f.useCallback(()=>{o(A7(!u))},[u,o]);return a.jsxs(Yn,{isAttached:!0,orientation:"vertical",children:[a.jsx(_n,{label:e("nodes.zoomInNodes"),children:a.jsx(je,{onClick:d,icon:a.jsx(Tu,{})})}),a.jsx(_n,{label:e("nodes.zoomOutNodes"),children:a.jsx(je,{onClick:p,icon:a.jsx(P$,{})})}),a.jsx(_n,{label:e("nodes.fitViewportNodes"),children:a.jsx(je,{onClick:h,icon:a.jsx(p$,{})})}),a.jsx(_n,{label:e(s?"nodes.hideGraphNodes":"nodes.showGraphNodes"),children:a.jsx(je,{isChecked:s,onClick:m,icon:a.jsx(Uv,{})})}),a.jsx(_n,{label:e(i?"nodes.hideLegendNodes":"nodes.showLegendNodes"),children:a.jsx(je,{isChecked:i,onClick:v,icon:a.jsx(w$,{})})}),a.jsx(_n,{label:e(u?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),children:a.jsx(je,{isChecked:u,onClick:b,icon:a.jsx(_$,{})})})]})},vee=f.memo(gee),yee=()=>a.jsx(yu,{position:"bottom-left",children:a.jsx(vee,{})}),bee=f.memo(yee),xee=()=>{const e=ff({background:"var(--invokeai-colors-base-200)"},{background:"var(--invokeai-colors-base-500)"}),t=L(o=>o.nodes.shouldShowMinimapPanel),n=ff("var(--invokeai-colors-accent-300)","var(--invokeai-colors-accent-700)"),r=ff("var(--invokeai-colors-blackAlpha-300)","var(--invokeai-colors-blackAlpha-600)");return a.jsx(a.Fragment,{children:t&&a.jsx(hA,{nodeStrokeWidth:3,pannable:!0,zoomable:!0,nodeBorderRadius:30,style:e,nodeColor:n,maskColor:r})})},wee=f.memo(xee),See=()=>{const{t:e}=fe(),t=te(),{fitView:n}=Qp(),r=f.useRef(null),o=f.useCallback(s=>{var u;if(!s)return;const i=new FileReader;i.onload=async()=>{const d=i.result,p=await JSON.parse(String(d));p||t(rr(or({title:e("toast.nodesLoadedFailed"),status:"error"}))),p&&(t(N7(p.nodes)),t($7(p.edges)),n(),t(rr(or({title:e("toast.nodesLoaded"),status:"success"})))),i.abort()},i.readAsText(s),(u=r.current)==null||u.call(r)},[n,t,e]);return a.jsx(JP,{resetRef:r,accept:"application/json",onChange:o,children:s=>a.jsx(je,{icon:a.jsx(Au,{}),tooltip:e("nodes.loadNodes"),"aria-label":e("nodes.loadNodes"),...s})})},Cee=f.memo(See);function _ee(e){const{iconButton:t=!1,...n}=e,r=te(),o=L(ur),s=Q1(),i=f.useCallback(()=>{r(hv("nodes"))},[r]),{t:u}=fe();return Ke(["ctrl+enter","meta+enter"],i,{enabled:()=>s,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[s,o]),a.jsx(ze,{style:{flexGrow:4},position:"relative",children:a.jsxs(ze,{style:{position:"relative"},children:[!s&&a.jsx(ze,{borderRadius:"base",style:{position:"absolute",bottom:"0",left:"0",right:"0",height:"100%",overflow:"clip"},children:a.jsx(Wj,{})}),t?a.jsx(je,{"aria-label":u("parameters.invoke"),type:"submit",icon:a.jsx(B5,{}),isDisabled:!s,onClick:i,flexGrow:1,w:"100%",tooltip:u("parameters.invoke"),tooltipProps:{placement:"bottom"},colorScheme:"accent",id:"invoke-button",_disabled:{background:"none",_hover:{background:"none"}},...n}):a.jsx(Zt,{"aria-label":u("parameters.invoke"),type:"submit",isDisabled:!s,onClick:i,flexGrow:1,w:"100%",colorScheme:"accent",id:"invoke-button",fontWeight:700,_disabled:{background:"none",_hover:{background:"none"}},...n,children:"Invoke"})]})})}function kee(){const{t:e}=fe(),t=te(),n=f.useCallback(()=>{t(z7())},[t]);return a.jsx(je,{icon:a.jsx(T$,{}),tooltip:e("nodes.reloadSchema"),"aria-label":e("nodes.reloadSchema"),onClick:n})}const Pee=()=>{const{t:e}=fe(),t=L(o=>o.nodes.editorInstance),n=L(o=>o.nodes.nodes),r=f.useCallback(()=>{if(t){const o=t.toObject();o.edges=Cs(o.edges,u=>L7(u,["style"]));const s=new Blob([JSON.stringify(o)]),i=document.createElement("a");i.href=URL.createObjectURL(s),i.download="MyNodes.json",document.body.appendChild(i),i.click(),i.remove()}},[t]);return a.jsx(je,{icon:a.jsx(ph,{}),fontSize:18,tooltip:e("nodes.saveNodes"),"aria-label":e("nodes.saveNodes"),onClick:r,isDisabled:n.length===0})},jee=f.memo(Pee),Iee=()=>{const{t:e}=fe(),t=te(),{isOpen:n,onOpen:r,onClose:o}=Ws(),s=f.useRef(null),i=L(d=>d.nodes.nodes),u=f.useCallback(()=>{t(B7()),t(rr(or({title:e("toast.nodesCleared"),status:"success"}))),o()},[t,e,o]);return a.jsxs(a.Fragment,{children:[a.jsx(je,{icon:a.jsx(bo,{}),tooltip:e("nodes.clearNodes"),"aria-label":e("nodes.clearNodes"),onClick:r,isDisabled:i.length===0}),a.jsxs(Ou,{isOpen:n,onClose:o,leastDestructiveRef:s,isCentered:!0,children:[a.jsx(va,{}),a.jsxs(Ru,{children:[a.jsx(ga,{fontSize:"lg",fontWeight:"bold",children:e("nodes.clearNodes")}),a.jsx(ya,{children:a.jsx(nt,{children:e("common.clearNodes")})}),a.jsxs(ma,{children:[a.jsx(Sf,{ref:s,onClick:o,children:e("common.cancel")}),a.jsx(Sf,{colorScheme:"red",ml:3,onClick:u,children:e("common.accept")})]})]})]})]})},Eee=f.memo(Iee),Oee=()=>a.jsx(yu,{position:"top-center",children:a.jsxs(Cl,{children:[a.jsx(_ee,{}),a.jsx(Dh,{}),a.jsx(kee,{}),a.jsx(jee,{}),a.jsx(Cee,{}),a.jsx(Eee,{})]})}),Ree=f.memo(Oee),Mee=ve(F7,e=>{const t=Cs(e.invocationTemplates,n=>({label:n.title,value:n.type,description:n.description}));return t.push({label:"Progress Image",value:"progress_image",description:"Displays the progress image in the Node Editor"}),{data:t}},it),Dee=()=>{const e=te(),{data:t}=L(Mee),n=nZ(),r=Ql(),o=f.useCallback(i=>{const u=n(i);if(!u){r({status:"error",title:`Unknown Invocation type ${i}`});return}e(H7(u))},[e,n,r]),s=f.useCallback(i=>{i&&o(i)},[o]);return a.jsx(F,{sx:{gap:2,alignItems:"center"},children:a.jsx(Rr,{selectOnBlur:!1,placeholder:"Add Node",value:null,data:t,maxDropdownHeight:400,nothingFound:"No matching nodes",itemComponent:cI,filter:(i,u)=>u.label.toLowerCase().includes(i.toLowerCase().trim())||u.value.toLowerCase().includes(i.toLowerCase().trim())||u.description.toLowerCase().includes(i.toLowerCase().trim()),onChange:s,sx:{width:"18rem"}})})},cI=f.forwardRef(({label:e,description:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs("div",{children:[a.jsx(nt,{fontWeight:600,children:e}),a.jsx(nt,{size:"xs",sx:{color:"base.600",_dark:{color:"base.500"}},children:t})]})}));cI.displayName="SelectItem";const Tee=()=>a.jsx(yu,{position:"top-left",children:a.jsx(Dee,{})}),Aee=f.memo(Tee),Nee=()=>a.jsx(F,{sx:{gap:2,flexDir:"column"},children:Cs(Z4,({title:e,description:t,color:n},r)=>a.jsx(_n,{label:t,children:a.jsx(Xa,{colorScheme:n,sx:{userSelect:"none"},textAlign:"center",children:e})},r))}),$ee=f.memo(Nee),zee=()=>{const e=L(n=>n),t=W7(e);return a.jsx(ze,{as:"pre",sx:{fontFamily:"monospace",position:"absolute",top:2,right:2,opacity:.7,p:2,maxHeight:500,maxWidth:500,overflowY:"scroll",borderRadius:"base",bg:"base.200",_dark:{bg:"base.800"}},children:JSON.stringify(t,null,2)})},Lee=f.memo(zee),Bee=()=>{const e=L(n=>n.nodes.shouldShowGraphOverlay),t=L(n=>n.nodes.shouldShowFieldTypeLegend);return a.jsxs(yu,{position:"top-right",children:[t&&a.jsx($ee,{}),e&&a.jsx(Lee,{})]})},Fee=f.memo(Bee),Hee={invocation:lI,progress_image:mee},Wee=()=>{const e=te(),t=L(p=>p.nodes.nodes),n=L(p=>p.nodes.edges),r=f.useCallback(p=>{e(V7(p))},[e]),o=f.useCallback(p=>{e(U7(p))},[e]),s=f.useCallback((p,h)=>{e(G7(h))},[e]),i=f.useCallback(p=>{e(q7(p))},[e]),u=f.useCallback(()=>{e(K7())},[e]),d=f.useCallback(p=>{e(Y7(p)),p&&p.fitView()},[e]);return a.jsxs(Q7,{nodeTypes:Hee,nodes:t,edges:n,onNodesChange:r,onEdgesChange:o,onConnectStart:s,onConnect:i,onConnectEnd:u,onInit:d,defaultEdgeOptions:{style:{strokeWidth:2}},children:[a.jsx(Aee,{}),a.jsx(Ree,{}),a.jsx(Fee,{}),a.jsx(bee,{}),a.jsx(xA,{}),a.jsx(wee,{})]})},Vee=()=>a.jsx(ze,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base"},children:a.jsx(X7,{children:a.jsx(Wee,{})})}),Uee=f.memo(Vee),Gee=()=>a.jsx(Uee,{}),qee=f.memo(Gee),Kee=ve(Mt,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},it),Yee=()=>{const{shouldUseSliders:e,activeLabel:t}=L(Kee);return a.jsx(Ao,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsx(F,{sx:{flexDirection:"column",gap:3},children:e?a.jsxs(a.Fragment,{children:[a.jsx(Wl,{}),a.jsx(Ul,{}),a.jsx(Hl,{}),a.jsx(Vl,{}),a.jsx(ze,{pt:2,children:a.jsx(Gl,{})}),a.jsx(Fp,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(F,{gap:3,children:[a.jsx(Wl,{}),a.jsx(Ul,{}),a.jsx(Hl,{})]}),a.jsx(Vl,{}),a.jsx(ze,{pt:2,children:a.jsx(Gl,{})}),a.jsx(Fp,{})]})})})},Qee=f.memo(Yee),Xee=()=>a.jsxs(a.Fragment,{children:[a.jsx(X1,{}),a.jsx(K1,{}),a.jsx(ty,{}),a.jsx(Qee,{}),a.jsx(G1,{}),a.jsx(V1,{}),a.jsx(W1,{}),a.jsx(Z1,{}),a.jsx(Fj,{}),a.jsx(J1,{}),a.jsx(Hj,{}),a.jsx(U1,{})]}),uI=f.memo(Xee),Jee=()=>a.jsxs(F,{sx:{gap:4,w:"full",h:"full"},children:[a.jsx(H1,{children:a.jsx(uI,{})}),a.jsx(Nj,{})]}),Zee=f.memo(Jee);var J0={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var n=vx;Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return n.Konva}});const r=vx;e.exports=r.Konva})(J0,J0.exports);var ete=J0.exports;const pu=vu(ete);var dI={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 tte=function(t){var n={},r=f,o=pf,s=Object.assign;function i(l){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+l,g=1;gY||x[D]!==P[Y]){var se=` -`+x[D].replace(" at new "," at ");return l.displayName&&se.includes("")&&(se=se.replace("",l.displayName)),se}while(1<=D&&0<=Y);break}}}finally{Lt=!1,Error.prepareStackTrace=g}return(l=l?l.displayName||l.name:"")?Et(l):""}var Gt=Object.prototype.hasOwnProperty,$t=[],Re=-1;function ut(l){return{current:l}}function Ct(l){0>Re||(l.current=$t[Re],$t[Re]=null,Re--)}function Tt(l,c){Re++,$t[Re]=l.current,l.current=c}var xn={},zt=ut(xn),tn=ut(!1),Xt=xn;function Cr(l,c){var g=l.type.contextTypes;if(!g)return xn;var y=l.stateNode;if(y&&y.__reactInternalMemoizedUnmaskedChildContext===c)return y.__reactInternalMemoizedMaskedChildContext;var x={},P;for(P in g)x[P]=c[P];return y&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=c,l.__reactInternalMemoizedMaskedChildContext=x),x}function Vn(l){return l=l.childContextTypes,l!=null}function vt(){Ct(tn),Ct(zt)}function wn(l,c,g){if(zt.current!==xn)throw Error(i(168));Tt(zt,c),Tt(tn,g)}function kn(l,c,g){var y=l.stateNode;if(c=c.childContextTypes,typeof y.getChildContext!="function")return g;y=y.getChildContext();for(var x in y)if(!(x in c))throw Error(i(108,T(l)||"Unknown",x));return s({},g,y)}function Un(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||xn,Xt=zt.current,Tt(zt,l),Tt(tn,tn.current),!0}function ar(l,c,g){var y=l.stateNode;if(!y)throw Error(i(169));g?(l=kn(l,c,Xt),y.__reactInternalMemoizedMergedChildContext=l,Ct(tn),Ct(zt),Tt(zt,l)):Ct(tn),Tt(tn,g)}var On=Math.clz32?Math.clz32:pn,Rn=Math.log,nn=Math.LN2;function pn(l){return l>>>=0,l===0?32:31-(Rn(l)/nn|0)|0}var Sn=64,cn=4194304;function un(l){switch(l&-l){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 l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function Be(l,c){var g=l.pendingLanes;if(g===0)return 0;var y=0,x=l.suspendedLanes,P=l.pingedLanes,D=g&268435455;if(D!==0){var Y=D&~x;Y!==0?y=un(Y):(P&=D,P!==0&&(y=un(P)))}else D=g&~x,D!==0?y=un(D):P!==0&&(y=un(P));if(y===0)return 0;if(c!==0&&c!==y&&!(c&x)&&(x=y&-y,P=c&-c,x>=P||x===16&&(P&4194240)!==0))return c;if(y&4&&(y|=g&16),c=l.entangledLanes,c!==0)for(l=l.entanglements,c&=y;0g;g++)c.push(l);return c}function lt(l,c,g){l.pendingLanes|=c,c!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,c=31-On(c),l[c]=g}function qe(l,c){var g=l.pendingLanes&~c;l.pendingLanes=c,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=c,l.mutableReadLanes&=c,l.entangledLanes&=c,c=l.entanglements;var y=l.eventTimes;for(l=l.expirationTimes;0>=D,x-=D,ko=1<<32-On(c)+x|g<hn?(Nr=Ut,Ut=null):Nr=Ut.sibling;var mn=Je(oe,Ut,de[hn],Ze);if(mn===null){Ut===null&&(Ut=Nr);break}l&&Ut&&mn.alternate===null&&c(oe,Ut),X=P(mn,X,hn),Yt===null?jt=mn:Yt.sibling=mn,Yt=mn,Ut=Nr}if(hn===de.length)return g(oe,Ut),Gn&&ii(oe,hn),jt;if(Ut===null){for(;hnhn?(Nr=Ut,Ut=null):Nr=Ut.sibling;var Ta=Je(oe,Ut,mn.value,Ze);if(Ta===null){Ut===null&&(Ut=Nr);break}l&&Ut&&Ta.alternate===null&&c(oe,Ut),X=P(Ta,X,hn),Yt===null?jt=Ta:Yt.sibling=Ta,Yt=Ta,Ut=Nr}if(mn.done)return g(oe,Ut),Gn&&ii(oe,hn),jt;if(Ut===null){for(;!mn.done;hn++,mn=de.next())mn=Vt(oe,mn.value,Ze),mn!==null&&(X=P(mn,X,hn),Yt===null?jt=mn:Yt.sibling=mn,Yt=mn);return Gn&&ii(oe,hn),jt}for(Ut=y(oe,Ut);!mn.done;hn++,mn=de.next())mn=Hn(Ut,oe,hn,mn.value,Ze),mn!==null&&(l&&mn.alternate!==null&&Ut.delete(mn.key===null?hn:mn.key),X=P(mn,X,hn),Yt===null?jt=mn:Yt.sibling=mn,Yt=mn);return l&&Ut.forEach(function(aE){return c(oe,aE)}),Gn&&ii(oe,hn),jt}function ra(oe,X,de,Ze){if(typeof de=="object"&&de!==null&&de.type===h&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case d:e:{for(var jt=de.key,Yt=X;Yt!==null;){if(Yt.key===jt){if(jt=de.type,jt===h){if(Yt.tag===7){g(oe,Yt.sibling),X=x(Yt,de.props.children),X.return=oe,oe=X;break e}}else if(Yt.elementType===jt||typeof jt=="object"&&jt!==null&&jt.$$typeof===j&&Cy(jt)===Yt.type){g(oe,Yt.sibling),X=x(Yt,de.props),X.ref=uc(oe,Yt,de),X.return=oe,oe=X;break e}g(oe,Yt);break}else c(oe,Yt);Yt=Yt.sibling}de.type===h?(X=hi(de.props.children,oe.mode,Ze,de.key),X.return=oe,oe=X):(Ze=wd(de.type,de.key,de.props,null,oe.mode,Ze),Ze.ref=uc(oe,X,de),Ze.return=oe,oe=Ze)}return D(oe);case p:e:{for(Yt=de.key;X!==null;){if(X.key===Yt)if(X.tag===4&&X.stateNode.containerInfo===de.containerInfo&&X.stateNode.implementation===de.implementation){g(oe,X.sibling),X=x(X,de.children||[]),X.return=oe,oe=X;break e}else{g(oe,X);break}else c(oe,X);X=X.sibling}X=Fm(de,oe.mode,Ze),X.return=oe,oe=X}return D(oe);case j:return Yt=de._init,ra(oe,X,Yt(de._payload),Ze)}if(G(de))return Dn(oe,X,de,Ze);if(O(de))return po(oe,X,de,Ze);Yu(oe,de)}return typeof de=="string"&&de!==""||typeof de=="number"?(de=""+de,X!==null&&X.tag===6?(g(oe,X.sibling),X=x(X,de),X.return=oe,oe=X):(g(oe,X),X=Bm(de,oe.mode,Ze),X.return=oe,oe=X),D(oe)):g(oe,X)}return ra}var Yi=_y(!0),ky=_y(!1),dc={},Lo=ut(dc),fc=ut(dc),Qi=ut(dc);function Os(l){if(l===dc)throw Error(i(174));return l}function em(l,c){Tt(Qi,c),Tt(fc,l),Tt(Lo,dc),l=M(c),Ct(Lo),Tt(Lo,l)}function Xi(){Ct(Lo),Ct(fc),Ct(Qi)}function Py(l){var c=Os(Qi.current),g=Os(Lo.current);c=U(g,l.type,c),g!==c&&(Tt(fc,l),Tt(Lo,c))}function tm(l){fc.current===l&&(Ct(Lo),Ct(fc))}var Jn=ut(0);function Qu(l){for(var c=l;c!==null;){if(c.tag===13){var g=c.memoizedState;if(g!==null&&(g=g.dehydrated,g===null||Dr(g)||Ps(g)))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if(c.flags&128)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===l)break;for(;c.sibling===null;){if(c.return===null||c.return===l)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var nm=[];function rm(){for(var l=0;lg?g:4,l(!0);var y=om.transition;om.transition={};try{l(!1),c()}finally{Se=g,om.transition=y}}function Vy(){return Bo().memoizedState}function DI(l,c,g){var y=Ra(l);if(g={lane:y,action:g,hasEagerState:!1,eagerState:null,next:null},Uy(l))Gy(c,g);else if(g=my(l,c,g,y),g!==null){var x=Yr();Fo(g,l,y,x),qy(g,c,y)}}function TI(l,c,g){var y=Ra(l),x={lane:y,action:g,hasEagerState:!1,eagerState:null,next:null};if(Uy(l))Gy(c,x);else{var P=l.alternate;if(l.lanes===0&&(P===null||P.lanes===0)&&(P=c.lastRenderedReducer,P!==null))try{var D=c.lastRenderedState,Y=P(D,g);if(x.hasEagerState=!0,x.eagerState=Y,rn(Y,D)){var se=c.interleaved;se===null?(x.next=x,Qh(c)):(x.next=se.next,se.next=x),c.interleaved=x;return}}catch{}finally{}g=my(l,c,x,y),g!==null&&(x=Yr(),Fo(g,l,y,x),qy(g,c,y))}}function Uy(l){var c=l.alternate;return l===Zn||c!==null&&c===Zn}function Gy(l,c){pc=Ju=!0;var g=l.pending;g===null?c.next=c:(c.next=g.next,g.next=c),l.pending=c}function qy(l,c,g){if(g&4194240){var y=c.lanes;y&=l.pendingLanes,g|=y,c.lanes=g,Pe(l,g)}}var td={readContext:zo,useCallback:Gr,useContext:Gr,useEffect:Gr,useImperativeHandle:Gr,useInsertionEffect:Gr,useLayoutEffect:Gr,useMemo:Gr,useReducer:Gr,useRef:Gr,useState:Gr,useDebugValue:Gr,useDeferredValue:Gr,useTransition:Gr,useMutableSource:Gr,useSyncExternalStore:Gr,useId:Gr,unstable_isNewReconciler:!1},AI={readContext:zo,useCallback:function(l,c){return Rs().memoizedState=[l,c===void 0?null:c],l},useContext:zo,useEffect:Ny,useImperativeHandle:function(l,c,g){return g=g!=null?g.concat([l]):null,Zu(4194308,4,Ly.bind(null,c,l),g)},useLayoutEffect:function(l,c){return Zu(4194308,4,l,c)},useInsertionEffect:function(l,c){return Zu(4,2,l,c)},useMemo:function(l,c){var g=Rs();return c=c===void 0?null:c,l=l(),g.memoizedState=[l,c],l},useReducer:function(l,c,g){var y=Rs();return c=g!==void 0?g(c):c,y.memoizedState=y.baseState=c,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:c},y.queue=l,l=l.dispatch=DI.bind(null,Zn,l),[y.memoizedState,l]},useRef:function(l){var c=Rs();return l={current:l},c.memoizedState=l},useState:Ty,useDebugValue:dm,useDeferredValue:function(l){return Rs().memoizedState=l},useTransition:function(){var l=Ty(!1),c=l[0];return l=MI.bind(null,l[1]),Rs().memoizedState=l,[c,l]},useMutableSource:function(){},useSyncExternalStore:function(l,c,g){var y=Zn,x=Rs();if(Gn){if(g===void 0)throw Error(i(407));g=g()}else{if(g=c(),Ar===null)throw Error(i(349));ci&30||Ey(y,c,g)}x.memoizedState=g;var P={value:g,getSnapshot:c};return x.queue=P,Ny(Ry.bind(null,y,P,l),[l]),y.flags|=2048,gc(9,Oy.bind(null,y,P,g,c),void 0,null),g},useId:function(){var l=Rs(),c=Ar.identifierPrefix;if(Gn){var g=Ur,y=ko;g=(y&~(1<<32-On(y)-1)).toString(32)+g,c=":"+c+"R"+g,g=hc++,0Mm&&(c.flags|=128,y=!0,bc(x,!1),c.lanes=4194304)}else{if(!y)if(l=Qu(P),l!==null){if(c.flags|=128,y=!0,l=l.updateQueue,l!==null&&(c.updateQueue=l,c.flags|=4),bc(x,!0),x.tail===null&&x.tailMode==="hidden"&&!P.alternate&&!Gn)return qr(c),null}else 2*Ne()-x.renderingStartTime>Mm&&g!==1073741824&&(c.flags|=128,y=!0,bc(x,!1),c.lanes=4194304);x.isBackwards?(P.sibling=c.child,c.child=P):(l=x.last,l!==null?l.sibling=P:c.child=P,x.last=P)}return x.tail!==null?(c=x.tail,x.rendering=c,x.tail=c.sibling,x.renderingStartTime=Ne(),c.sibling=null,l=Jn.current,Tt(Jn,y?l&1|2:l&1),c):(qr(c),null);case 22:case 23:return $m(),g=c.memoizedState!==null,l!==null&&l.memoizedState!==null!==g&&(c.flags|=8192),g&&c.mode&1?jo&1073741824&&(qr(c),ue&&c.subtreeFlags&6&&(c.flags|=8192)):qr(c),null;case 24:return null;case 25:return null}throw Error(i(156,c.tag))}function WI(l,c){switch(Hh(c),c.tag){case 1:return Vn(c.type)&&vt(),l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 3:return Xi(),Ct(tn),Ct(zt),rm(),l=c.flags,l&65536&&!(l&128)?(c.flags=l&-65537|128,c):null;case 5:return tm(c),null;case 13:if(Ct(Jn),l=c.memoizedState,l!==null&&l.dehydrated!==null){if(c.alternate===null)throw Error(i(340));Gi()}return l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 19:return Ct(Jn),null;case 4:return Xi(),null;case 10:return Kh(c.type._context),null;case 22:case 23:return $m(),null;case 24:return null;default:return null}}var ad=!1,Kr=!1,VI=typeof WeakSet=="function"?WeakSet:Set,st=null;function Zi(l,c){var g=l.ref;if(g!==null)if(typeof g=="function")try{g(null)}catch(y){qn(l,c,y)}else g.current=null}function xm(l,c,g){try{g()}catch(y){qn(l,c,y)}}var fb=!1;function UI(l,c){for(V(l.containerInfo),st=c;st!==null;)if(l=st,c=l.child,(l.subtreeFlags&1028)!==0&&c!==null)c.return=l,st=c;else for(;st!==null;){l=st;try{var g=l.alternate;if(l.flags&1024)switch(l.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var y=g.memoizedProps,x=g.memoizedState,P=l.stateNode,D=P.getSnapshotBeforeUpdate(l.elementType===l.type?y:rs(l.type,y),x);P.__reactInternalSnapshotBeforeUpdate=D}break;case 3:ue&&bn(l.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(Y){qn(l,l.return,Y)}if(c=l.sibling,c!==null){c.return=l.return,st=c;break}st=l.return}return g=fb,fb=!1,g}function xc(l,c,g){var y=c.updateQueue;if(y=y!==null?y.lastEffect:null,y!==null){var x=y=y.next;do{if((x.tag&l)===l){var P=x.destroy;x.destroy=void 0,P!==void 0&&xm(c,g,P)}x=x.next}while(x!==y)}}function id(l,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var g=c=c.next;do{if((g.tag&l)===l){var y=g.create;g.destroy=y()}g=g.next}while(g!==c)}}function wm(l){var c=l.ref;if(c!==null){var g=l.stateNode;switch(l.tag){case 5:l=K(g);break;default:l=g}typeof c=="function"?c(l):c.current=l}}function pb(l){var c=l.alternate;c!==null&&(l.alternate=null,pb(c)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(c=l.stateNode,c!==null&&Le(c)),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function hb(l){return l.tag===5||l.tag===3||l.tag===4}function mb(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||hb(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Sm(l,c,g){var y=l.tag;if(y===5||y===6)l=l.stateNode,c?sr(g,l,c):Cn(g,l);else if(y!==4&&(l=l.child,l!==null))for(Sm(l,c,g),l=l.sibling;l!==null;)Sm(l,c,g),l=l.sibling}function Cm(l,c,g){var y=l.tag;if(y===5||y===6)l=l.stateNode,c?vn(g,l,c):Wt(g,l);else if(y!==4&&(l=l.child,l!==null))for(Cm(l,c,g),l=l.sibling;l!==null;)Cm(l,c,g),l=l.sibling}var Hr=null,os=!1;function Ds(l,c,g){for(g=g.child;g!==null;)_m(l,c,g),g=g.sibling}function _m(l,c,g){if(an&&typeof an.onCommitFiberUnmount=="function")try{an.onCommitFiberUnmount(Fn,g)}catch{}switch(g.tag){case 5:Kr||Zi(g,c);case 6:if(ue){var y=Hr,x=os;Hr=null,Ds(l,c,g),Hr=y,os=x,Hr!==null&&(os?at(Hr,g.stateNode):Ee(Hr,g.stateNode))}else Ds(l,c,g);break;case 18:ue&&Hr!==null&&(os?De(Hr,g.stateNode):dt(Hr,g.stateNode));break;case 4:ue?(y=Hr,x=os,Hr=g.stateNode.containerInfo,os=!0,Ds(l,c,g),Hr=y,os=x):(Ce&&(y=g.stateNode.containerInfo,x=fr(y),$n(y,x)),Ds(l,c,g));break;case 0:case 11:case 14:case 15:if(!Kr&&(y=g.updateQueue,y!==null&&(y=y.lastEffect,y!==null))){x=y=y.next;do{var P=x,D=P.destroy;P=P.tag,D!==void 0&&(P&2||P&4)&&xm(g,c,D),x=x.next}while(x!==y)}Ds(l,c,g);break;case 1:if(!Kr&&(Zi(g,c),y=g.stateNode,typeof y.componentWillUnmount=="function"))try{y.props=g.memoizedProps,y.state=g.memoizedState,y.componentWillUnmount()}catch(Y){qn(g,c,Y)}Ds(l,c,g);break;case 21:Ds(l,c,g);break;case 22:g.mode&1?(Kr=(y=Kr)||g.memoizedState!==null,Ds(l,c,g),Kr=y):Ds(l,c,g);break;default:Ds(l,c,g)}}function gb(l){var c=l.updateQueue;if(c!==null){l.updateQueue=null;var g=l.stateNode;g===null&&(g=l.stateNode=new VI),c.forEach(function(y){var x=eE.bind(null,l,y);g.has(y)||(g.add(y),y.then(x,x))})}}function ss(l,c){var g=c.deletions;if(g!==null)for(var y=0;y";case cd:return":has("+(jm(l)||"")+")";case ud:return'[role="'+l.value+'"]';case fd:return'"'+l.value+'"';case dd:return'[data-testname="'+l.value+'"]';default:throw Error(i(365))}}function Sb(l,c){var g=[];l=[l,0];for(var y=0;yx&&(x=D),y&=~P}if(y=x,y=Ne()-y,y=(120>y?120:480>y?480:1080>y?1080:1920>y?1920:3e3>y?3e3:4320>y?4320:1960*qI(y/1960))-y,10l?16:l,Oa===null)var y=!1;else{if(l=Oa,Oa=null,vd=0,Jt&6)throw Error(i(331));var x=Jt;for(Jt|=4,st=l.current;st!==null;){var P=st,D=P.child;if(st.flags&16){var Y=P.deletions;if(Y!==null){for(var se=0;seNe()-Rm?di(l,0):Om|=g),fo(l,c)}function Rb(l,c){c===0&&(l.mode&1?(c=cn,cn<<=1,!(cn&130023424)&&(cn=4194304)):c=1);var g=Yr();l=Es(l,c),l!==null&&(lt(l,c,g),fo(l,g))}function ZI(l){var c=l.memoizedState,g=0;c!==null&&(g=c.retryLane),Rb(l,g)}function eE(l,c){var g=0;switch(l.tag){case 13:var y=l.stateNode,x=l.memoizedState;x!==null&&(g=x.retryLane);break;case 19:y=l.stateNode;break;default:throw Error(i(314))}y!==null&&y.delete(c),Rb(l,g)}var Mb;Mb=function(l,c,g){if(l!==null)if(l.memoizedProps!==c.pendingProps||tn.current)co=!0;else{if(!(l.lanes&g)&&!(c.flags&128))return co=!1,FI(l,c,g);co=!!(l.flags&131072)}else co=!1,Gn&&c.flags&1048576&&cy(c,to,c.index);switch(c.lanes=0,c.tag){case 2:var y=c.type;rd(l,c),l=c.pendingProps;var x=Cr(c,zt.current);Ki(c,g),x=am(null,c,y,l,x,g);var P=im();return c.flags|=1,typeof x=="object"&&x!==null&&typeof x.render=="function"&&x.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,Vn(y)?(P=!0,Un(c)):P=!1,c.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,Xh(c),x.updater=Ku,c.stateNode=x,x._reactInternals=c,Zh(c,y,l,g),c=mm(null,c,y,!0,P,g)):(c.tag=0,Gn&&P&&Fh(c),oo(null,c,x,g),c=c.child),c;case 16:y=c.elementType;e:{switch(rd(l,c),l=c.pendingProps,x=y._init,y=x(y._payload),c.type=y,x=c.tag=nE(y),l=rs(y,l),x){case 0:c=hm(null,c,y,l,g);break e;case 1:c=ob(null,c,y,l,g);break e;case 11:c=Zy(null,c,y,l,g);break e;case 14:c=eb(null,c,y,rs(y.type,l),g);break e}throw Error(i(306,y,""))}return c;case 0:return y=c.type,x=c.pendingProps,x=c.elementType===y?x:rs(y,x),hm(l,c,y,x,g);case 1:return y=c.type,x=c.pendingProps,x=c.elementType===y?x:rs(y,x),ob(l,c,y,x,g);case 3:e:{if(sb(c),l===null)throw Error(i(387));y=c.pendingProps,P=c.memoizedState,x=P.element,gy(l,c),qu(c,y,null,g);var D=c.memoizedState;if(y=D.element,Me&&P.isDehydrated)if(P={element:y,isDehydrated:!1,cache:D.cache,pendingSuspenseBoundaries:D.pendingSuspenseBoundaries,transitions:D.transitions},c.updateQueue.baseState=P,c.memoizedState=P,c.flags&256){x=Ji(Error(i(423)),c),c=ab(l,c,y,g,x);break e}else if(y!==x){x=Ji(Error(i(424)),c),c=ab(l,c,y,g,x);break e}else for(Me&&($o=Q(c.stateNode.containerInfo),Po=c,Gn=!0,ns=null,cc=!1),g=ky(c,null,y,g),c.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(Gi(),y===x){c=ta(l,c,g);break e}oo(l,c,y,g)}c=c.child}return c;case 5:return Py(c),l===null&&Vh(c),y=c.type,x=c.pendingProps,P=l!==null?l.memoizedProps:null,D=x.children,Z(y,x)?D=null:P!==null&&Z(y,P)&&(c.flags|=32),rb(l,c),oo(l,c,D,g),c.child;case 6:return l===null&&Vh(c),null;case 13:return ib(l,c,g);case 4:return em(c,c.stateNode.containerInfo),y=c.pendingProps,l===null?c.child=Yi(c,null,y,g):oo(l,c,y,g),c.child;case 11:return y=c.type,x=c.pendingProps,x=c.elementType===y?x:rs(y,x),Zy(l,c,y,x,g);case 7:return oo(l,c,c.pendingProps,g),c.child;case 8:return oo(l,c,c.pendingProps.children,g),c.child;case 12:return oo(l,c,c.pendingProps.children,g),c.child;case 10:e:{if(y=c.type._context,x=c.pendingProps,P=c.memoizedProps,D=x.value,hy(c,y,D),P!==null)if(rn(P.value,D)){if(P.children===x.children&&!tn.current){c=ta(l,c,g);break e}}else for(P=c.child,P!==null&&(P.return=c);P!==null;){var Y=P.dependencies;if(Y!==null){D=P.child;for(var se=Y.firstContext;se!==null;){if(se.context===y){if(P.tag===1){se=ea(-1,g&-g),se.tag=2;var Oe=P.updateQueue;if(Oe!==null){Oe=Oe.shared;var ct=Oe.pending;ct===null?se.next=se:(se.next=ct.next,ct.next=se),Oe.pending=se}}P.lanes|=g,se=P.alternate,se!==null&&(se.lanes|=g),Yh(P.return,g,c),Y.lanes|=g;break}se=se.next}}else if(P.tag===10)D=P.type===c.type?null:P.child;else if(P.tag===18){if(D=P.return,D===null)throw Error(i(341));D.lanes|=g,Y=D.alternate,Y!==null&&(Y.lanes|=g),Yh(D,g,c),D=P.sibling}else D=P.child;if(D!==null)D.return=P;else for(D=P;D!==null;){if(D===c){D=null;break}if(P=D.sibling,P!==null){P.return=D.return,D=P;break}D=D.return}P=D}oo(l,c,x.children,g),c=c.child}return c;case 9:return x=c.type,y=c.pendingProps.children,Ki(c,g),x=zo(x),y=y(x),c.flags|=1,oo(l,c,y,g),c.child;case 14:return y=c.type,x=rs(y,c.pendingProps),x=rs(y.type,x),eb(l,c,y,x,g);case 15:return tb(l,c,c.type,c.pendingProps,g);case 17:return y=c.type,x=c.pendingProps,x=c.elementType===y?x:rs(y,x),rd(l,c),c.tag=1,Vn(y)?(l=!0,Un(c)):l=!1,Ki(c,g),wy(c,y,x),Zh(c,y,x,g),mm(null,c,y,!0,l,g);case 19:return cb(l,c,g);case 22:return nb(l,c,g)}throw Error(i(156,c.tag))};function Db(l,c){return Ae(l,c)}function tE(l,c,g,y){this.tag=l,this.key=g,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=y,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ho(l,c,g,y){return new tE(l,c,g,y)}function Lm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function nE(l){if(typeof l=="function")return Lm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===w)return 11;if(l===k)return 14}return 2}function Da(l,c){var g=l.alternate;return g===null?(g=Ho(l.tag,c,l.key,l.mode),g.elementType=l.elementType,g.type=l.type,g.stateNode=l.stateNode,g.alternate=l,l.alternate=g):(g.pendingProps=c,g.type=l.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=l.flags&14680064,g.childLanes=l.childLanes,g.lanes=l.lanes,g.child=l.child,g.memoizedProps=l.memoizedProps,g.memoizedState=l.memoizedState,g.updateQueue=l.updateQueue,c=l.dependencies,g.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},g.sibling=l.sibling,g.index=l.index,g.ref=l.ref,g}function wd(l,c,g,y,x,P){var D=2;if(y=l,typeof l=="function")Lm(l)&&(D=1);else if(typeof l=="string")D=5;else e:switch(l){case h:return hi(g.children,x,P,c);case m:D=8,x|=8;break;case v:return l=Ho(12,g,c,x|2),l.elementType=v,l.lanes=P,l;case C:return l=Ho(13,g,c,x),l.elementType=C,l.lanes=P,l;case _:return l=Ho(19,g,c,x),l.elementType=_,l.lanes=P,l;case E:return Sd(g,x,P,c);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case b:D=10;break e;case S:D=9;break e;case w:D=11;break e;case k:D=14;break e;case j:D=16,y=null;break e}throw Error(i(130,l==null?l:typeof l,""))}return c=Ho(D,g,c,x),c.elementType=l,c.type=y,c.lanes=P,c}function hi(l,c,g,y){return l=Ho(7,l,y,c),l.lanes=g,l}function Sd(l,c,g,y){return l=Ho(22,l,y,c),l.elementType=E,l.lanes=g,l.stateNode={isHidden:!1},l}function Bm(l,c,g){return l=Ho(6,l,null,c),l.lanes=g,l}function Fm(l,c,g){return c=Ho(4,l.children!==null?l.children:[],l.key,c),c.lanes=g,c.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},c}function rE(l,c,g,y,x){this.tag=c,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ne,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Rt(0),this.expirationTimes=Rt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rt(0),this.identifierPrefix=y,this.onRecoverableError=x,Me&&(this.mutableSourceEagerHydrationData=null)}function Tb(l,c,g,y,x,P,D,Y,se){return l=new rE(l,c,g,Y,se),c===1?(c=1,P===!0&&(c|=8)):c=0,P=Ho(3,null,null,c),l.current=P,P.stateNode=l,P.memoizedState={element:y,isDehydrated:g,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xh(P),l}function Ab(l){if(!l)return xn;l=l._reactInternals;e:{if(A(l)!==l||l.tag!==1)throw Error(i(170));var c=l;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(Vn(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(i(171))}if(l.tag===1){var g=l.type;if(Vn(g))return kn(l,g,c)}return c}function Nb(l){var c=l._reactInternals;if(c===void 0)throw typeof l.render=="function"?Error(i(188)):(l=Object.keys(l).join(","),Error(i(268,l)));return l=ee(c),l===null?null:l.stateNode}function $b(l,c){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var g=l.retryLane;l.retryLane=g!==0&&g=Oe&&P>=Vt&&x<=ct&&D<=Je){l.splice(c,1);break}else if(y!==Oe||g.width!==se.width||JeD){if(!(P!==Vt||g.height!==se.height||ctx)){Oe>y&&(se.width+=Oe-y,se.x=y),ctP&&(se.height+=Vt-P,se.y=P),Jeg&&(g=D)),D ")+` - -No matching component was found for: - `)+l.join(" > ")}return null},n.getPublicRootInstance=function(l){if(l=l.current,!l.child)return null;switch(l.child.tag){case 5:return K(l.child.stateNode);default:return l.child.stateNode}},n.injectIntoDevTools=function(l){if(l={bundleType:l.bundleType,version:l.version,rendererPackageName:l.rendererPackageName,rendererConfig:l.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:u.ReactCurrentDispatcher,findHostInstanceByFiber:oE,findFiberByHostInstance:l.findFiberByHostInstance||sE,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")l=!1;else{var c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(c.isDisabled||!c.supportsFiber)l=!0;else{try{Fn=c.inject(l),an=c}catch{}l=!!c.checkDCE}}return l},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(l,c,g,y){if(!gt)throw Error(i(363));l=Im(l,c);var x=Ft(l,g,y).disconnect;return{disconnect:function(){x()}}},n.registerMutableSourceForHydration=function(l,c){var g=c._getVersion;g=g(c._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[c,g]:l.mutableSourceEagerHydrationData.push(c,g)},n.runWithPriority=function(l,c){var g=Se;try{return Se=l,c()}finally{Se=g}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(l,c,g,y){var x=c.current,P=Yr(),D=Ra(x);return g=Ab(g),c.context===null?c.context=g:c.pendingContext=g,c=ea(P,D),c.payload={element:l},y=y===void 0?null:y,y!==null&&(c.callback=y),l=Ia(x,c,D),l!==null&&(Fo(l,x,D,P),Gu(l,x,D)),D},n};dI.exports=tte;var nte=dI.exports;const rte=vu(nte);var fI={exports:{}},Ui={};/** - * @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. - */Ui.ConcurrentRoot=1;Ui.ContinuousEventPriority=4;Ui.DefaultEventPriority=16;Ui.DiscreteEventPriority=1;Ui.IdleEventPriority=536870912;Ui.LegacyRoot=0;fI.exports=Ui;var pI=fI.exports;const KC={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let YC=!1,QC=!1;const ay=".react-konva-event",ote=`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 -`,ste=`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 -`,ate={};function Bh(e,t,n=ate){if(!YC&&"zIndex"in t&&(console.warn(ste),YC=!0),!QC&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(ote),QC=!0)}for(var s in n)if(!KC[s]){var i=s.slice(0,2)==="on",u=n[s]!==t[s];if(i&&u){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={},v=!1;const b={};for(var s in t)if(!KC[s]){var i=s.slice(0,2)==="on",S=n[s]!==t[s];if(i&&S){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))&&(v=!0,m[s]=t[s])}v&&(e.setAttrs(m),ai(e));for(var d in b)e.on(d+ay,b[d])}function ai(e){if(!J7.Konva.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const hI={},ite={};pu.Node.prototype._applyProps=Bh;function lte(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),ai(e)}function cte(e,t,n){let r=pu[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=pu.Group);const o={},s={};for(var i in t){var u=i.slice(0,2)==="on";u?s[i]=t[i]:o[i]=t[i]}const d=new r(o);return Bh(d,s),d}function ute(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function dte(e,t,n){return!1}function fte(e){return e}function pte(){return null}function hte(){return null}function mte(e,t,n,r){return ite}function gte(){}function vte(e){}function yte(e,t){return!1}function bte(){return hI}function xte(){return hI}const wte=setTimeout,Ste=clearTimeout,Cte=-1;function _te(e,t){return!1}const kte=!1,Pte=!0,jte=!0;function Ite(e,t){t.parent===e?t.moveToTop():e.add(t),ai(e)}function Ete(e,t){t.parent===e?t.moveToTop():e.add(t),ai(e)}function mI(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),ai(e)}function Ote(e,t,n){mI(e,t,n)}function Rte(e,t){t.destroy(),t.off(ay),ai(e)}function Mte(e,t){t.destroy(),t.off(ay),ai(e)}function Dte(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function Tte(e,t,n){}function Ate(e,t,n,r,o){Bh(e,o,r)}function Nte(e){e.hide(),ai(e)}function $te(e){}function zte(e,t){(t.visible==null||t.visible)&&e.show()}function Lte(e,t){}function Bte(e){}function Fte(){}const Hte=()=>pI.DefaultEventPriority,Wte=Object.freeze(Object.defineProperty({__proto__:null,appendChild:Ite,appendChildToContainer:Ete,appendInitialChild:lte,cancelTimeout:Ste,clearContainer:Bte,commitMount:Tte,commitTextUpdate:Dte,commitUpdate:Ate,createInstance:cte,createTextInstance:ute,detachDeletedInstance:Fte,finalizeInitialChildren:dte,getChildHostContext:xte,getCurrentEventPriority:Hte,getPublicInstance:fte,getRootHostContext:bte,hideInstance:Nte,hideTextInstance:$te,idlePriority:pf.unstable_IdlePriority,insertBefore:mI,insertInContainerBefore:Ote,isPrimaryRenderer:kte,noTimeout:Cte,now:pf.unstable_now,prepareForCommit:pte,preparePortalMount:hte,prepareUpdate:mte,removeChild:Rte,removeChildFromContainer:Mte,resetAfterCommit:gte,resetTextContent:vte,run:pf.unstable_runWithPriority,scheduleTimeout:wte,shouldDeprioritizeSubtree:yte,shouldSetTextContent:_te,supportsMutation:jte,unhideInstance:zte,unhideTextInstance:Lte,warnsIfNotActing:Pte},Symbol.toStringTag,{value:"Module"}));var Vte=Object.defineProperty,Ute=Object.defineProperties,Gte=Object.getOwnPropertyDescriptors,XC=Object.getOwnPropertySymbols,qte=Object.prototype.hasOwnProperty,Kte=Object.prototype.propertyIsEnumerable,JC=(e,t,n)=>t in e?Vte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ZC=(e,t)=>{for(var n in t||(t={}))qte.call(t,n)&&JC(e,n,t[n]);if(XC)for(var n of XC(t))Kte.call(t,n)&&JC(e,n,t[n]);return e},Yte=(e,t)=>Ute(e,Gte(t));function gI(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=gI(r,t,n);if(o)return o;r=t?null:r.sibling}}function vI(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const iy=vI(f.createContext(null));class yI extends f.Component{render(){return f.createElement(iy.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:e4,ReactCurrentDispatcher:t4}=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Qte(){const e=f.useContext(iy);if(e===null)throw new Error("its-fine: useFiber must be called within a !");const t=f.useId();return f.useMemo(()=>{for(const r of[e4==null?void 0:e4.current,e,e==null?void 0:e.alternate]){if(!r)continue;const o=gI(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 Xte(){var e,t;const n=Qte(),[r]=f.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==iy&&!r.has(s)&&r.set(s,(t=t4==null?void 0:t4.current)==null?void 0:t.readContext(vI(s))),o=o.return}return r}function Jte(){const e=Xte();return f.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>f.createElement(t,null,f.createElement(n.Provider,Yte(ZC({},r),{value:e.get(n)}))),t=>f.createElement(yI,ZC({},t))),[e])}function Zte(e){const t=N.useRef({});return N.useLayoutEffect(()=>{t.current=e}),N.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}const ene=e=>{const t=N.useRef(),n=N.useRef(),r=N.useRef(),o=Zte(e),s=Jte(),i=u=>{const{forwardedRef:d}=e;d&&(typeof d=="function"?d(u):d.current=u)};return N.useLayoutEffect(()=>(n.current=new pu.Stage({width:e.width,height:e.height,container:t.current}),i(n.current),r.current=Hc.createContainer(n.current,pI.LegacyRoot,!1,null),Hc.updateContainer(N.createElement(s,{},e.children),r.current),()=>{pu.isBrowser&&(i(null),Hc.updateContainer(null,r.current,null),n.current.destroy())}),[]),N.useLayoutEffect(()=>{i(n.current),Bh(n.current,e,o),Hc.updateContainer(N.createElement(s,{},e.children),r.current,null)}),N.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})},Tc="Layer",wa="Group",qs="Rect",mi="Circle",Hp="Line",bI="Image",tne="Transformer",Hc=rte(Wte);Hc.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:N.version,rendererPackageName:"react-konva"});const nne=N.forwardRef((e,t)=>N.createElement(yI,{},N.createElement(ene,{...e,forwardedRef:t}))),rne=ve([en,Xn],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:Qt}}),one=()=>{const e=te(),{tool:t,isStaging:n,isMovingBoundingBox:r}=L(rne);return{handleDragStart:f.useCallback(()=>{(t==="move"||n)&&!r&&e(Rf(!0))},[e,r,n,t]),handleDragMove:f.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(t3(s))},[e,r,n,t]),handleDragEnd:f.useCallback(()=>{(t==="move"||n)&&!r&&e(Rf(!1))},[e,r,n,t])}},sne=ve([en,ur,Xn],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isMaskEnabled:u,shouldSnapToGrid:d}=e;return{activeTabName:t,isCursorOnCanvas:!!r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isStaging:n,isMaskEnabled:u,shouldSnapToGrid:d}},{memoizeOptions:{resultEqualityCheck:Qt}}),ane=()=>{const e=te(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:i}=L(sne),u=f.useRef(null),d=n3(),p=()=>e(mv());Ke(["shift+c"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[]);const h=()=>e(Su(!s));Ke(["h"],()=>{h()},{enabled:()=>!o,preventDefault:!0},[s]),Ke(["n"],()=>{e(eu(!i))},{enabled:!0,preventDefault:!0},[i]),Ke("esc",()=>{e(Z7())},{enabled:()=>!0,preventDefault:!0}),Ke("shift+h",()=>{e(eO(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),Ke(["space"],m=>{m.repeat||(d==null||d.container().focus(),r!=="move"&&(u.current=r,e(Hs("move"))),r==="move"&&u.current&&u.current!=="move"&&(e(Hs(u.current)),u.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,u])},ly=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}},xI=()=>{const e=te(),t=ha(),n=n3();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=tO.pixelRatio,[s,i,u,d]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;e(nO({r:s,g:i,b:u,a:d}))},commitColorUnderCursor:()=>{e(rO())}}},ine=ve([ur,en,Xn],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Qt}}),lne=e=>{const t=te(),{tool:n,isStaging:r}=L(ine),{commitColorUnderCursor:o}=xI();return f.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Rf(!0));return}if(n==="colorPicker"){o();return}const i=ly(e.current);i&&(s.evt.preventDefault(),t(r3(!0)),t(oO([i.x,i.y])))},[e,n,r,t,o])},cne=ve([ur,en,Xn],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Qt}}),une=(e,t,n)=>{const r=te(),{isDrawing:o,tool:s,isStaging:i}=L(cne),{updateColorUnderCursor:u}=xI();return f.useCallback(()=>{if(!e.current)return;const d=ly(e.current);if(d){if(r(sO(d)),n.current=d,s==="colorPicker"){u();return}!o||s==="move"||i||(t.current=!0,r(o3([d.x,d.y])))}},[t,r,o,i,n,e,s,u])},dne=()=>{const e=te();return f.useCallback(()=>{e(aO())},[e])},fne=ve([ur,en,Xn],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Qt}}),pne=(e,t)=>{const n=te(),{tool:r,isDrawing:o,isStaging:s}=L(fne);return f.useCallback(()=>{if(r==="move"||s){n(Rf(!1));return}if(!t.current&&o&&e.current){const i=ly(e.current);if(!i)return;n(o3([i.x,i.y]))}else t.current=!1;n(r3(!1))},[t,n,o,s,e,r])},hne=ve([en],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:Qt}}),mne=e=>{const t=te(),{isMoveStageKeyHeld:n,stageScale:r}=L(hne);return f.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 u=o.evt.deltaY;o.evt.ctrlKey&&(u=-u);const d=Vs(r*cO**u,lO,iO),p={x:s.x-i.x*d,y:s.y-i.y*d};t(uO(d)),t(t3(p))},[e,n,r,t])},gne=ve(en,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:Qt}}),vne=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=L(gne);return a.jsxs(wa,{children:[a.jsx(qs,{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(qs,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},yne=ve([en],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:Qt}}),bne=()=>{const{stageScale:e,stageCoordinates:t,stageDimensions:n}=L(yne),{colorMode:r}=Do(),[o,s]=f.useState([]),[i,u]=Yl("colors",["base.800","base.200"]),d=f.useCallback(p=>p/e,[e]);return f.useLayoutEffect(()=>{const{width:p,height:h}=n,{x:m,y:v}=t,b={x1:0,y1:0,x2:p,y2:h,offset:{x:d(m),y:d(v)}},S={x:Math.ceil(d(m)/64)*64,y:Math.ceil(d(v)/64)*64},w={x1:-S.x,y1:-S.y,x2:d(p)-S.x+64,y2:d(h)-S.y+64},_={x1:Math.min(b.x1,w.x1),y1:Math.min(b.y1,w.y1),x2:Math.max(b.x2,w.x2),y2:Math.max(b.y2,w.y2)},k=_.x2-_.x1,j=_.y2-_.y1,E=Math.round(k/64)+1,I=Math.round(j/64)+1,O=jx(0,E).map(T=>a.jsx(Hp,{x:_.x1+T*64,y:_.y1,points:[0,0,0,j],stroke:r==="dark"?i:u,strokeWidth:1},`x_${T}`)),R=jx(0,I).map(T=>a.jsx(Hp,{x:_.x1,y:_.y1+T*64,points:[0,0,k,0],stroke:r==="dark"?i:u,strokeWidth:1},`y_${T}`));s(O.concat(R))},[e,t,n,d,r,i,u]),a.jsx(wa,{children:o})},xne=ve([Mo,en],(e,t)=>{const{progressImage:n,sessionId:r}=e,{sessionId:o,boundingBox:s}=t.layerState.stagingArea;return{boundingBox:s,progressImage:r===o?n:void 0}},{memoizeOptions:{resultEqualityCheck:Qt}}),wne=e=>{const{...t}=e,{progressImage:n,boundingBox:r}=L(xne),[o,s]=f.useState(null);return f.useEffect(()=>{if(!n)return;const i=new Image;i.onload=()=>{s(i)},i.src=n.dataURL},[n]),n&&r&&o?a.jsx(bI,{x:r.x,y:r.y,width:r.width,height:r.height,image:o,listening:!1,...t}):null},Pi=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},Sne=ve(en,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:Pi(t)}}),n4=e=>`data:image/svg+xml;utf8, - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -`.replaceAll("black",e),Cne=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=L(Sne),[i,u]=f.useState(null),[d,p]=f.useState(0),h=f.useRef(null),m=f.useCallback(()=>{p(d+1),setTimeout(m,500)},[d]);return f.useEffect(()=>{if(i)return;const v=new Image;v.onload=()=>{u(v)},v.src=n4(n)},[i,n]),f.useEffect(()=>{i&&(i.src=n4(n))},[i,n]),f.useEffect(()=>{const v=setInterval(()=>p(b=>(b+1)%5),50);return()=>clearInterval(v)},[]),!i||!ol(r.x)||!ol(r.y)||!ol(s)||!ol(o.width)||!ol(o.height)?null:a.jsx(qs,{ref:h,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:i,fillPatternOffsetY:ol(d)?d:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},_ne=ve([en],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:Qt}}),kne=e=>{const{...t}=e,{objects:n}=L(_ne);return a.jsx(wa,{listening:!1,...t,children:n.filter(dO).map((r,o)=>a.jsx(Hp,{points:r.points,stroke:"rgb(0,0,0)",strokeWidth:r.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:r.tool==="brush"?"source-over":"destination-out"},o))})};var gi=f,Pne=function(t,n,r){const o=gi.useRef("loading"),s=gi.useRef(),[i,u]=gi.useState(0),d=gi.useRef(),p=gi.useRef(),h=gi.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),gi.useLayoutEffect(function(){if(!t)return;var m=document.createElement("img");function v(){o.current="loaded",s.current=m,u(Math.random())}function b(){o.current="failed",s.current=void 0,u(Math.random())}return m.addEventListener("load",v),m.addEventListener("error",b),n&&(m.crossOrigin=n),r&&(m.referrerPolicy=r),m.src=t,function(){m.removeEventListener("load",v),m.removeEventListener("error",b)}},[t,n,r]),[s.current,o.current]};const jne=vu(Pne),wI=e=>{const{width:t,height:n,x:r,y:o,imageName:s}=e.canvasImage,{currentData:i,isError:u}=gs(s??Ko.skipToken),[d]=jne((i==null?void 0:i.image_url)??"",fO.get()?"use-credentials":"anonymous");return u?a.jsx(qs,{x:r,y:o,width:t,height:n,fill:"red"}):a.jsx(bI,{x:r,y:o,image:d,listening:!1})},Ine=ve([en],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:Qt}}),Ene=()=>{const{objects:e}=L(Ine);return e?a.jsx(wa,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(pO(t))return a.jsx(wI,{canvasImage:t},n);if(hO(t)){const r=a.jsx(Hp,{points:t.points,stroke:t.color?Pi(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(wa,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(mO(t))return a.jsx(qs,{x:t.x,y:t.y,width:t.width,height:t.height,fill:Pi(t.color)},n);if(gO(t))return a.jsx(qs,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},One=ve([en],e=>{const{layerState:t,shouldShowStagingImage:n,shouldShowStagingOutline:r,boundingBoxCoordinates:{x:o,y:s},boundingBoxDimensions:{width:i,height:u}}=e,{selectedImageIndex:d,images:p}=t.stagingArea;return{currentStagingAreaImage:p.length>0&&d!==void 0?p[d]:void 0,isOnFirstImage:d===0,isOnLastImage:d===p.length-1,shouldShowStagingImage:n,shouldShowStagingOutline:r,x:o,y:s,width:i,height:u}},{memoizeOptions:{resultEqualityCheck:Qt}}),Rne=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:i,width:u,height:d}=L(One);return a.jsxs(wa,{...t,children:[r&&n&&a.jsx(wI,{canvasImage:n}),o&&a.jsxs(wa,{children:[a.jsx(qs,{x:s,y:i,width:u,height:d,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),a.jsx(qs,{x:s,y:i,width:u,height:d,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},Mne=ve([en],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n,sessionId:r}},shouldShowStagingOutline:o,shouldShowStagingImage:s}=e;return{currentStagingAreaImage:t.length>0?t[n]:void 0,isOnFirstImage:n===0,isOnLastImage:n===t.length-1,shouldShowStagingImage:s,shouldShowStagingOutline:o,sessionId:r}},{memoizeOptions:{resultEqualityCheck:Qt}}),Dne=()=>{const e=te(),{isOnFirstImage:t,isOnLastImage:n,currentStagingAreaImage:r,shouldShowStagingImage:o,sessionId:s}=L(Mne),{t:i}=fe(),u=f.useCallback(()=>{e(yx(!0))},[e]),d=f.useCallback(()=>{e(yx(!1))},[e]);Ke(["left"],()=>{p()},{enabled:()=>!0,preventDefault:!0}),Ke(["right"],()=>{h()},{enabled:()=>!0,preventDefault:!0}),Ke(["enter"],()=>{m()},{enabled:()=>!0,preventDefault:!0});const p=f.useCallback(()=>e(vO()),[e]),h=f.useCallback(()=>e(yO()),[e]),m=f.useCallback(()=>e(bO(s)),[e,s]);return r?a.jsx(F,{pos:"absolute",bottom:4,w:"100%",align:"center",justify:"center",filter:"drop-shadow(0 0.5rem 1rem rgba(0,0,0))",onMouseOver:u,onMouseOut:d,children:a.jsxs(Yn,{isAttached:!0,children:[a.jsx(je,{tooltip:`${i("unifiedCanvas.previous")} (Left)`,"aria-label":`${i("unifiedCanvas.previous")} (Left)`,icon:a.jsx(o$,{}),onClick:p,colorScheme:"accent",isDisabled:t}),a.jsx(je,{tooltip:`${i("unifiedCanvas.next")} (Right)`,"aria-label":`${i("unifiedCanvas.next")} (Right)`,icon:a.jsx(s$,{}),onClick:h,colorScheme:"accent",isDisabled:n}),a.jsx(je,{tooltip:`${i("unifiedCanvas.accept")} (Enter)`,"aria-label":`${i("unifiedCanvas.accept")} (Enter)`,icon:a.jsx(i$,{}),onClick:m,colorScheme:"accent"}),a.jsx(je,{tooltip:i("unifiedCanvas.showHide"),"aria-label":i("unifiedCanvas.showHide"),"data-alert":!o,icon:o?a.jsx(g$,{}):a.jsx(m$,{}),onClick:()=>e(xO(!o)),colorScheme:"accent"}),a.jsx(je,{tooltip:i("unifiedCanvas.saveToGallery"),"aria-label":i("unifiedCanvas.saveToGallery"),icon:a.jsx(ph,{}),onClick:()=>e(wO({imageName:r.imageName})),colorScheme:"accent"}),a.jsx(je,{tooltip:i("unifiedCanvas.discardAll"),"aria-label":i("unifiedCanvas.discardAll"),icon:a.jsx(Tu,{style:{transform:"rotate(45deg)"}}),onClick:()=>e(SO()),colorScheme:"error",fontSize:20})]})}):null},wl=e=>Math.round(e*100)/100,Tne=ve([en],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${wl(n)}, ${wl(r)})`}},{memoizeOptions:{resultEqualityCheck:Qt}});function Ane(){const{cursorCoordinatesString:e}=L(Tne),{t}=fe();return a.jsx(ze,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const Z0="var(--invokeai-colors-warning-500)",Nne=ve([en],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:i},scaledBoundingBoxDimensions:{width:u,height:d},boundingBoxCoordinates:{x:p,y:h},stageScale:m,shouldShowCanvasDebugInfo:v,layer:b,boundingBoxScaleMethod:S,shouldPreserveMaskedArea:w}=e;let C="inherit";return(S==="none"&&(s<512||i<512)||S==="manual"&&u*d<512*512)&&(C=Z0),{activeLayerColor:b==="mask"?Z0:"inherit",activeLayerString:b.charAt(0).toUpperCase()+b.slice(1),boundingBoxColor:C,boundingBoxCoordinatesString:`(${wl(p)}, ${wl(h)})`,boundingBoxDimensionsString:`${s}×${i}`,scaledBoundingBoxDimensionsString:`${u}×${d}`,canvasCoordinatesString:`${wl(r)}×${wl(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(m*100),shouldShowCanvasDebugInfo:v,shouldShowBoundingBox:S!=="auto",shouldShowScaledBoundingBox:S!=="none",shouldPreserveMaskedArea:w}},{memoizeOptions:{resultEqualityCheck:Qt}}),$ne=()=>{const{activeLayerColor:e,activeLayerString:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:i,canvasCoordinatesString:u,canvasDimensionsString:d,canvasScaleString:p,shouldShowCanvasDebugInfo:h,shouldShowBoundingBox:m,shouldPreserveMaskedArea:v}=L(Nne),{t:b}=fe();return a.jsxs(F,{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(ze,{style:{color:e},children:`${b("unifiedCanvas.activeLayer")}: ${t}`}),a.jsx(ze,{children:`${b("unifiedCanvas.canvasScale")}: ${p}%`}),v&&a.jsx(ze,{style:{color:Z0},children:"Preserve Masked Area: On"}),m&&a.jsx(ze,{style:{color:n},children:`${b("unifiedCanvas.boundingBox")}: ${o}`}),i&&a.jsx(ze,{style:{color:n},children:`${b("unifiedCanvas.scaledBoundingBox")}: ${s}`}),h&&a.jsxs(a.Fragment,{children:[a.jsx(ze,{children:`${b("unifiedCanvas.boundingBoxPosition")}: ${r}`}),a.jsx(ze,{children:`${b("unifiedCanvas.canvasDimensions")}: ${d}`}),a.jsx(ze,{children:`${b("unifiedCanvas.canvasPosition")}: ${u}`}),a.jsx(Ane,{})]})]})},zne=ve([en,Jr],(e,t)=>{const{boundingBoxCoordinates:n,boundingBoxDimensions:r,stageScale:o,isDrawing:s,isTransformingBoundingBox:i,isMovingBoundingBox:u,tool:d,shouldSnapToGrid:p}=e,{aspectRatio:h}=t;return{boundingBoxCoordinates:n,boundingBoxDimensions:r,isDrawing:s,isMovingBoundingBox:u,isTransformingBoundingBox:i,stageScale:o,shouldSnapToGrid:p,tool:d,hitStrokeWidth:20/o,aspectRatio:h}},{memoizeOptions:{resultEqualityCheck:Qt}}),Lne=e=>{const{...t}=e,n=te(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:i,isTransformingBoundingBox:u,stageScale:d,shouldSnapToGrid:p,tool:h,hitStrokeWidth:m,aspectRatio:v}=L(zne),b=f.useRef(null),S=f.useRef(null),[w,C]=f.useState(!1);f.useEffect(()=>{var B;!b.current||!S.current||(b.current.nodes([S.current]),(B=b.current.getLayer())==null||B.batchDraw())},[]);const _=64*d;Ke("N",()=>{n(eu(!p))});const k=f.useCallback(B=>{if(!p){n(Um({x:Math.floor(B.target.x()),y:Math.floor(B.target.y())}));return}const H=B.target.x(),G=B.target.y(),K=cs(H,64),M=cs(G,64);B.target.x(K),B.target.y(M),n(Um({x:K,y:M}))},[n,p]),j=f.useCallback(()=>{if(!S.current)return;const B=S.current,H=B.scaleX(),G=B.scaleY(),K=Math.round(B.width()*H),M=Math.round(B.height()*G),U=Math.round(B.x()),V=Math.round(B.y());if(v){const J=cs(K/v,64);n(Bs({width:K,height:J}))}else n(Bs({width:K,height:M}));n(Um({x:p?Pd(U,64):U,y:p?Pd(V,64):V})),B.scaleX(1),B.scaleY(1)},[n,p,v]),E=f.useCallback((B,H,G)=>{const K=B.x%_,M=B.y%_;return{x:Pd(H.x,_)+K,y:Pd(H.y,_)+M}},[_]),I=()=>{n(Gm(!0))},O=()=>{n(Gm(!1)),n(qm(!1)),n(jd(!1)),C(!1)},R=()=>{n(qm(!0))},T=()=>{n(Gm(!1)),n(qm(!1)),n(jd(!1)),C(!1)},A=()=>{C(!0)},z=()=>{!u&&!i&&C(!1)},$=()=>{n(jd(!0))},ee=()=>{n(jd(!1))};return a.jsxs(wa,{...t,children:[a.jsx(qs,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:$,onMouseOver:$,onMouseLeave:ee,onMouseOut:ee}),a.jsx(qs,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:m,listening:!s&&h==="move",onDragStart:R,onDragEnd:T,onDragMove:k,onMouseDown:R,onMouseOut:z,onMouseOver:A,onMouseEnter:A,onMouseUp:T,onTransform:j,onTransformEnd:O,ref:S,stroke:w?"rgba(255,255,255,0.7)":"white",strokeWidth:(w?8:1)/d,width:o.width,x:r.x,y:r.y}),a.jsx(tne,{anchorCornerRadius:3,anchorDragBoundFunc:E,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:h==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&h==="move",onDragStart:R,onDragEnd:T,onMouseDown:I,onMouseUp:O,onTransformEnd:O,ref:b,rotateEnabled:!1})]})},Bne=ve(en,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:i,layer:u,shouldShowBrush:d,isMovingBoundingBox:p,isTransformingBoundingBox:h,stageScale:m,stageDimensions:v,boundingBoxCoordinates:b,boundingBoxDimensions:S,shouldRestrictStrokesToBox:w}=e,C=w?{clipX:b.x,clipY:b.y,clipWidth:S.width,clipHeight:S.height}:{};return{cursorPosition:t,brushX:t?t.x:v.width/2,brushY:t?t.y:v.height/2,radius:n/2,colorPickerOuterRadius:bx/m,colorPickerInnerRadius:(bx-Yg+1)/m,maskColorString:Pi({...o,a:.5}),brushColorString:Pi(s),colorPickerColorString:Pi(r),tool:i,layer:u,shouldShowBrush:d,shouldDrawBrushPreview:!(p||h||!t)&&d,strokeWidth:1.5/m,dotRadius:1.5/m,clip:C}},{memoizeOptions:{resultEqualityCheck:Qt}}),Fne=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:i,layer:u,shouldDrawBrushPreview:d,dotRadius:p,strokeWidth:h,brushColorString:m,colorPickerColorString:v,colorPickerInnerRadius:b,colorPickerOuterRadius:S,clip:w}=L(Bne);return d?a.jsxs(wa,{listening:!1,...w,...t,children:[i==="colorPicker"?a.jsxs(a.Fragment,{children:[a.jsx(mi,{x:n,y:r,radius:S,stroke:m,strokeWidth:Yg,strokeScaleEnabled:!1}),a.jsx(mi,{x:n,y:r,radius:b,stroke:v,strokeWidth:Yg,strokeScaleEnabled:!1})]}):a.jsxs(a.Fragment,{children:[a.jsx(mi,{x:n,y:r,radius:o,fill:u==="mask"?s:m,globalCompositeOperation:i==="eraser"?"destination-out":"source-out"}),a.jsx(mi,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:h*2,strokeEnabled:!0,listening:!1}),a.jsx(mi,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:h,strokeEnabled:!0,listening:!1})]}),a.jsx(mi,{x:n,y:r,radius:p*2,fill:"rgba(255,255,255,0.4)",listening:!1}),a.jsx(mi,{x:n,y:r,radius:p,fill:"rgba(0,0,0,1)",listening:!1})]}):null},Hne=ve([en,Xn],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:i,isMovingBoundingBox:u,stageDimensions:d,stageCoordinates:p,tool:h,isMovingStage:m,shouldShowIntermediates:v,shouldShowGrid:b,shouldRestrictStrokesToBox:S,shouldAntialias:w}=e;let C="none";return h==="move"||t?m?C="grabbing":C="grab":s?C=void 0:S&&!i&&(C="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||u,shouldShowBoundingBox:o,shouldShowGrid:b,stageCoordinates:p,stageCursor:C,stageDimensions:d,stageScale:r,tool:h,isStaging:t,shouldShowIntermediates:v,shouldAntialias:w}},it),Wne=He(nne,{shouldForwardProp:e=>!["sx"].includes(e)}),r4=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:i,stageScale:u,tool:d,isStaging:p,shouldShowIntermediates:h,shouldAntialias:m}=L(Hne);ane();const v=f.useRef(null),b=f.useRef(null),S=f.useCallback(z=>{_O(z),v.current=z},[]),w=f.useCallback(z=>{CO(z),b.current=z},[]),C=f.useRef({x:0,y:0}),_=f.useRef(!1),k=mne(v),j=lne(v),E=pne(v,_),I=une(v,_,C),O=dne(),{handleDragStart:R,handleDragMove:T,handleDragEnd:A}=one();return a.jsx(F,{sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:a.jsxs(ze,{sx:{position:"relative"},children:[a.jsxs(Wne,{tabIndex:-1,ref:S,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:u,y:u},onTouchStart:j,onTouchMove:I,onTouchEnd:E,onMouseDown:j,onMouseLeave:O,onMouseMove:I,onMouseUp:E,onDragStart:R,onDragMove:T,onDragEnd:A,onContextMenu:z=>z.evt.preventDefault(),onWheel:k,draggable:(d==="move"||p)&&!t,children:[a.jsx(Tc,{id:"grid",visible:r,children:a.jsx(bne,{})}),a.jsx(Tc,{id:"base",ref:w,listening:!1,imageSmoothingEnabled:m,children:a.jsx(Ene,{})}),a.jsxs(Tc,{id:"mask",visible:e,listening:!1,children:[a.jsx(kne,{visible:!0,listening:!1}),a.jsx(Cne,{listening:!1})]}),a.jsx(Tc,{children:a.jsx(vne,{})}),a.jsxs(Tc,{id:"preview",imageSmoothingEnabled:m,children:[!p&&a.jsx(Fne,{visible:d!=="move",listening:!1}),a.jsx(Rne,{visible:p}),h&&a.jsx(wne,{}),a.jsx(Lne,{visible:n&&!p})]})]}),a.jsx($ne,{}),a.jsx(Dne,{})]})})},Vne=ve(en,kO,ur,(e,t,n)=>{const{doesCanvasNeedScaling:r,isCanvasInitialized:o}=e;return{doesCanvasNeedScaling:r,activeTabName:n,initialCanvasImage:t,isCanvasInitialized:o}}),o4=()=>{const e=te(),{doesCanvasNeedScaling:t,activeTabName:n,initialCanvasImage:r,isCanvasInitialized:o}=L(Vne),s=f.useRef(null);return f.useLayoutEffect(()=>{window.setTimeout(()=>{if(!s.current)return;const{clientWidth:i,clientHeight:u}=s.current;e(PO({width:i,height:u})),e(o?jO():Kp()),e(w4(!1))},0)},[e,r,t,n,o]),a.jsx(F,{ref:s,sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:a.jsx(Jl,{thickness:"2px",size:"xl"})})};function SI(e,t,n=250){const[r,o]=f.useState(0);return f.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 Une=He(iI,{baseStyle:{paddingInline:4},shouldForwardProp:e=>!["pickerColor"].includes(e)}),Lg={width:6,height:6,borderColor:"base.100"},Gne=e=>{const{styleClass:t="",...n}=e;return a.jsx(Une,{sx:{".react-colorful__hue-pointer":Lg,".react-colorful__saturation-pointer":Lg,".react-colorful__alpha-pointer":Lg},className:t,...n})},Wp=f.memo(Gne),qne=ve([en,Xn],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:Pi(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Qt}}),Kne=()=>{const e=te(),{t}=fe(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:i}=L(qne);Ke(["q"],()=>{u()},{enabled:()=>!i,preventDefault:!0},[n]),Ke(["shift+c"],()=>{d()},{enabled:()=>!i,preventDefault:!0},[]),Ke(["h"],()=>{p()},{enabled:()=>!i,preventDefault:!0},[o]);const u=()=>{e(Mf(n==="mask"?"base":"mask"))},d=()=>e(mv()),p=()=>e(Su(!o));return a.jsx(zi,{triggerComponent:a.jsx(Yn,{children:a.jsx(je,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:a.jsx(k$,{}),isChecked:n==="mask",isDisabled:i})}),children:a.jsxs(F,{direction:"column",gap:2,children:[a.jsx(Bn,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:p}),a.jsx(Bn,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:h=>e(s3(h.target.checked))}),a.jsx(Wp,{sx:{paddingTop:2,paddingBottom:2},pickerColor:r,onChange:h=>e(a3(h))}),a.jsxs(Zt,{size:"sm",leftIcon:a.jsx(bo,{}),onClick:d,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},Yne=ve([en,ur,Mo],(e,t,n)=>{const{futureLayerStates:r}=e;return{canRedo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Qt}});function CI(){const e=te(),{canRedo:t,activeTabName:n}=L(Yne),{t:r}=fe(),o=()=>{e(IO())};return Ke(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),a.jsx(je,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:a.jsx(E$,{}),onClick:o,isDisabled:!t})}const _I=()=>{const e=L(Xn),t=te(),{t:n}=fe();return a.jsxs(ny,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(EO()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:a.jsx(Zt,{size:"sm",leftIcon:a.jsx(bo,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),a.jsx("br",{}),a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},Qne=ve([en],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:u,shouldRestrictStrokesToBox:d,shouldAntialias:p}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:u,shouldRestrictStrokesToBox:d,shouldAntialias:p}},{memoizeOptions:{resultEqualityCheck:Qt}}),Xne=()=>{const e=te(),{t}=fe(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:i,shouldShowIntermediates:u,shouldSnapToGrid:d,shouldRestrictStrokesToBox:p,shouldAntialias:h}=L(Qne);Ke(["n"],()=>{e(eu(!d))},{enabled:!0,preventDefault:!0},[d]);const m=v=>e(eu(v.target.checked));return a.jsx(zi,{isLazy:!1,triggerComponent:a.jsx(je,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:a.jsx(Qv,{})}),children:a.jsxs(F,{direction:"column",gap:2,children:[a.jsx(Bn,{label:t("unifiedCanvas.showIntermediates"),isChecked:u,onChange:v=>e(i3(v.target.checked))}),a.jsx(Bn,{label:t("unifiedCanvas.showGrid"),isChecked:i,onChange:v=>e(l3(v.target.checked))}),a.jsx(Bn,{label:t("unifiedCanvas.snapToGrid"),isChecked:d,onChange:m}),a.jsx(Bn,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:v=>e(c3(v.target.checked))}),a.jsx(Bn,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:v=>e(u3(v.target.checked))}),a.jsx(Bn,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:v=>e(d3(v.target.checked))}),a.jsx(Bn,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:p,onChange:v=>e(f3(v.target.checked))}),a.jsx(Bn,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:v=>e(p3(v.target.checked))}),a.jsx(Bn,{label:t("unifiedCanvas.antialiasing"),isChecked:h,onChange:v=>e(h3(v.target.checked))}),a.jsx(_I,{})]})})},Jne=ve([en,Xn,Mo],(e,t,n)=>{const{isProcessing:r}=n,{tool:o,brushColor:s,brushSize:i}=e;return{tool:o,isStaging:t,isProcessing:r,brushColor:s,brushSize:i}},{memoizeOptions:{resultEqualityCheck:Qt}}),Zne=()=>{const e=te(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=L(Jne),{t:s}=fe();Ke(["b"],()=>{i()},{enabled:()=>!o,preventDefault:!0},[]),Ke(["e"],()=>{u()},{enabled:()=>!o,preventDefault:!0},[t]),Ke(["c"],()=>{d()},{enabled:()=>!o,preventDefault:!0},[t]),Ke(["shift+f"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),Ke(["delete","backspace"],()=>{h()},{enabled:()=>!o,preventDefault:!0}),Ke(["BracketLeft"],()=>{e(_l(Math.max(r-5,5)))},{enabled:()=>!o,preventDefault:!0},[r]),Ke(["BracketRight"],()=>{e(_l(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),Ke(["Shift+BracketLeft"],()=>{e(kl({...n,a:Vs(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),Ke(["Shift+BracketRight"],()=>{e(kl({...n,a:Vs(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const i=()=>e(Hs("brush")),u=()=>e(Hs("eraser")),d=()=>e(Hs("colorPicker")),p=()=>e(m3()),h=()=>e(g3());return a.jsxs(Yn,{isAttached:!0,children:[a.jsx(je,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:a.jsx(L5,{}),isChecked:t==="brush"&&!o,onClick:i,isDisabled:o}),a.jsx(je,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:a.jsx(A5,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:u}),a.jsx(je,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:a.jsx($5,{}),isDisabled:o,onClick:p}),a.jsx(je,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:a.jsx(Tu,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:h}),a.jsx(je,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:a.jsx(N5,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:d}),a.jsx(zi,{triggerComponent:a.jsx(je,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:a.jsx(Kv,{})}),children:a.jsxs(F,{minWidth:60,direction:"column",gap:4,width:"100%",children:[a.jsx(F,{gap:4,justifyContent:"space-between",children:a.jsx(St,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:m=>e(_l(m)),sliderNumberInputProps:{max:500}})}),a.jsx(Wp,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:m=>e(kl(m))})]})})]})},ere=ve([en,ur,Mo],(e,t,n)=>{const{pastLayerStates:r}=e;return{canUndo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Qt}});function kI(){const e=te(),{t}=fe(),{canUndo:n,activeTabName:r}=L(ere),o=()=>{e(OO())};return Ke(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),a.jsx(je,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:a.jsx(Yv,{}),onClick:o,isDisabled:!n})}const tre=ve([Mo,en,Xn],(e,t,n)=>{const{isProcessing:r}=e,{tool:o,shouldCropToBoundingBoxOnSave:s,layer:i,isMaskEnabled:u}=t;return{isProcessing:r,isStaging:n,isMaskEnabled:u,tool:o,layer:i,shouldCropToBoundingBoxOnSave:s}},{memoizeOptions:{resultEqualityCheck:Qt}}),nre=()=>{const e=te(),{isProcessing:t,isStaging:n,isMaskEnabled:r,layer:o,tool:s}=L(tre),i=ha(),{t:u}=fe(),{isClipboardAPIAvailable:d}=b1(),{openUploader:p}=fh();Ke(["v"],()=>{h()},{enabled:()=>!n,preventDefault:!0},[]),Ke(["r"],()=>{v()},{enabled:()=>!0,preventDefault:!0},[i]),Ke(["shift+m"],()=>{S()},{enabled:()=>!n,preventDefault:!0},[i,t]),Ke(["shift+s"],()=>{w()},{enabled:()=>!n,preventDefault:!0},[i,t]),Ke(["meta+c","ctrl+c"],()=>{C()},{enabled:()=>!n&&d,preventDefault:!0},[i,t,d]),Ke(["shift+d"],()=>{_()},{enabled:()=>!n,preventDefault:!0},[i,t]);const h=()=>e(Hs("move")),m=SI(()=>v(!1),()=>v(!0)),v=(j=!1)=>{const E=ha();if(!E)return;const I=E.getClientRect({skipTransform:!0});e(v3({contentRect:I,shouldScaleTo1:j}))},b=()=>{e(C3()),e(Kp())},S=()=>{e(y3())},w=()=>{e(b3())},C=()=>{d&&e(x3())},_=()=>{e(w3())},k=j=>{const E=j;e(Mf(E)),E==="mask"&&!r&&e(Su(!0))};return a.jsxs(F,{sx:{alignItems:"center",gap:2,flexWrap:"wrap"},children:[a.jsx(ze,{w:24,children:a.jsx(Rr,{tooltip:`${u("unifiedCanvas.layer")} (Q)`,value:o,data:S3,onChange:k,disabled:n})}),a.jsx(Kne,{}),a.jsx(Zne,{}),a.jsxs(Yn,{isAttached:!0,children:[a.jsx(je,{"aria-label":`${u("unifiedCanvas.move")} (V)`,tooltip:`${u("unifiedCanvas.move")} (V)`,icon:a.jsx(M5,{}),isChecked:s==="move"||n,onClick:h}),a.jsx(je,{"aria-label":`${u("unifiedCanvas.resetView")} (R)`,tooltip:`${u("unifiedCanvas.resetView")} (R)`,icon:a.jsx(T5,{}),onClick:m})]}),a.jsxs(Yn,{isAttached:!0,children:[a.jsx(je,{"aria-label":`${u("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${u("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:a.jsx(qv,{}),onClick:S,isDisabled:n}),a.jsx(je,{"aria-label":`${u("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${u("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:a.jsx(ph,{}),onClick:w,isDisabled:n}),d&&a.jsx(je,{"aria-label":`${u("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${u("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:a.jsx(rc,{}),onClick:C,isDisabled:n}),a.jsx(je,{"aria-label":`${u("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${u("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:a.jsx(Gv,{}),onClick:_,isDisabled:n})]}),a.jsxs(Yn,{isAttached:!0,children:[a.jsx(kI,{}),a.jsx(CI,{})]}),a.jsxs(Yn,{isAttached:!0,children:[a.jsx(je,{"aria-label":`${u("common.upload")}`,tooltip:`${u("common.upload")}`,icon:a.jsx(Au,{}),onClick:p,isDisabled:n}),a.jsx(je,{"aria-label":`${u("unifiedCanvas.clearCanvas")}`,tooltip:`${u("unifiedCanvas.clearCanvas")}`,icon:a.jsx(bo,{}),onClick:b,colorScheme:"error",isDisabled:n})]}),a.jsx(Yn,{isAttached:!0,children:a.jsx(Xne,{})})]})};function rre(){const e=te(),t=L(o=>o.canvas.brushSize),{t:n}=fe(),r=L(Xn);return Ke(["BracketLeft"],()=>{e(_l(Math.max(t-5,5)))},{enabled:()=>!r,preventDefault:!0},[t]),Ke(["BracketRight"],()=>{e(_l(Math.min(t+5,500)))},{enabled:()=>!r,preventDefault:!0},[t]),a.jsx(St,{label:n("unifiedCanvas.brushSize"),value:t,withInput:!0,onChange:o=>e(_l(o)),sliderNumberInputProps:{max:500},isCompact:!0})}const ore=ve([en,Xn],(e,t)=>{const{brushColor:n,maskColor:r,layer:o}=e;return{brushColor:n,maskColor:r,layer:o,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Qt}});function sre(){const e=te(),{brushColor:t,maskColor:n,layer:r,isStaging:o}=L(ore),s=()=>{if(r==="base")return`rgba(${t.r},${t.g},${t.b},${t.a})`;if(r==="mask")return`rgba(${n.r},${n.g},${n.b},${n.a})`};return Ke(["shift+BracketLeft"],()=>{e(kl({...t,a:Vs(t.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[t]),Ke(["shift+BracketRight"],()=>{e(kl({...t,a:Vs(t.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[t]),a.jsx(zi,{triggerComponent:a.jsx(ze,{sx:{width:7,height:7,minWidth:7,minHeight:7,borderRadius:"full",bg:s(),cursor:"pointer"}}),children:a.jsxs(F,{minWidth:60,direction:"column",gap:4,width:"100%",children:[r==="base"&&a.jsx(Wp,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:t,onChange:i=>e(kl(i))}),r==="mask"&&a.jsx(Wp,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:i=>e(a3(i))})]})})}function PI(){return a.jsxs(F,{columnGap:4,alignItems:"center",children:[a.jsx(rre,{}),a.jsx(sre,{})]})}function are(){const e=te(),t=L(r=>r.canvas.shouldRestrictStrokesToBox),{t:n}=fe();return a.jsx(Bn,{label:n("unifiedCanvas.betaLimitToBox"),isChecked:t,onChange:r=>e(f3(r.target.checked))})}function ire(){return a.jsxs(F,{gap:4,alignItems:"center",children:[a.jsx(PI,{}),a.jsx(are,{})]})}function lre(){const e=te(),{t}=fe(),n=()=>e(mv());return a.jsx(Zt,{size:"sm",leftIcon:a.jsx(bo,{}),onClick:n,tooltip:`${t("unifiedCanvas.clearMask")} (Shift+C)`,children:t("unifiedCanvas.betaClear")})}function cre(){const e=L(o=>o.canvas.isMaskEnabled),t=te(),{t:n}=fe(),r=()=>t(Su(!e));return a.jsx(Bn,{label:`${n("unifiedCanvas.enableMask")} (H)`,isChecked:e,onChange:r})}function ure(){const e=te(),{t}=fe(),n=L(r=>r.canvas.shouldPreserveMaskedArea);return a.jsx(Bn,{label:t("unifiedCanvas.betaPreserveMasked"),isChecked:n,onChange:r=>e(s3(r.target.checked))})}function dre(){return a.jsxs(F,{gap:4,alignItems:"center",children:[a.jsx(PI,{}),a.jsx(cre,{}),a.jsx(ure,{}),a.jsx(lre,{})]})}function fre(){const e=L(r=>r.canvas.shouldDarkenOutsideBoundingBox),t=te(),{t:n}=fe();return a.jsx(Bn,{label:n("unifiedCanvas.betaDarkenOutside"),isChecked:e,onChange:r=>t(c3(r.target.checked))})}function pre(){const e=L(r=>r.canvas.shouldShowGrid),t=te(),{t:n}=fe();return a.jsx(Bn,{label:n("unifiedCanvas.showGrid"),isChecked:e,onChange:r=>t(l3(r.target.checked))})}function hre(){const e=L(o=>o.canvas.shouldSnapToGrid),t=te(),{t:n}=fe(),r=o=>t(eu(o.target.checked));return a.jsx(Bn,{label:`${n("unifiedCanvas.snapToGrid")} (N)`,isChecked:e,onChange:r})}function mre(){return a.jsxs(F,{alignItems:"center",gap:4,children:[a.jsx(pre,{}),a.jsx(hre,{}),a.jsx(fre,{})]})}const gre=ve([en],e=>{const{tool:t,layer:n}=e;return{tool:t,layer:n}},{memoizeOptions:{resultEqualityCheck:Qt}});function vre(){const{tool:e,layer:t}=L(gre);return a.jsxs(F,{height:8,minHeight:8,maxHeight:8,alignItems:"center",children:[t=="base"&&["brush","eraser","colorPicker"].includes(e)&&a.jsx(ire,{}),t=="mask"&&["brush","eraser","colorPicker"].includes(e)&&a.jsx(dre,{}),e=="move"&&a.jsx(mre,{})]})}const yre=ve([en],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:o,shouldAntialias:s}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:o,shouldAntialias:s}},{memoizeOptions:{resultEqualityCheck:Qt}}),bre=()=>{const e=te(),{t}=fe(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldShowCanvasDebugInfo:o,shouldShowIntermediates:s,shouldAntialias:i}=L(yre);return a.jsx(zi,{isLazy:!1,triggerComponent:a.jsx(je,{tooltip:t("unifiedCanvas.canvasSettings"),tooltipProps:{placement:"bottom"},"aria-label":t("unifiedCanvas.canvasSettings"),icon:a.jsx(Qv,{})}),children:a.jsxs(F,{direction:"column",gap:2,children:[a.jsx(Bn,{label:t("unifiedCanvas.showIntermediates"),isChecked:s,onChange:u=>e(i3(u.target.checked))}),a.jsx(Bn,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:u=>e(u3(u.target.checked))}),a.jsx(Bn,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:u=>e(d3(u.target.checked))}),a.jsx(Bn,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:o,onChange:u=>e(p3(u.target.checked))}),a.jsx(Bn,{label:t("unifiedCanvas.antialiasing"),isChecked:i,onChange:u=>e(h3(u.target.checked))}),a.jsx(_I,{})]})})};function xre(){const e=L(Xn),t=ha(),{isClipboardAPIAvailable:n}=b1(),r=L(u=>u.system.isProcessing),o=te(),{t:s}=fe();Ke(["meta+c","ctrl+c"],()=>{i()},{enabled:()=>!e&&n,preventDefault:!0},[t,r,n]);const i=f.useCallback(()=>{n&&o(x3())},[o,n]);return n?a.jsx(je,{"aria-label":`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:a.jsx(rc,{}),onClick:i,isDisabled:e}):null}function wre(){const e=te(),{t}=fe(),n=ha(),r=L(Xn);Ke(["shift+d"],()=>{o()},{enabled:()=>!r,preventDefault:!0},[n]);const o=()=>{e(w3())};return a.jsx(je,{"aria-label":`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:a.jsx(Gv,{}),onClick:o,isDisabled:r})}function Sre(){const e=L(Xn),{openUploader:t}=fh(),{t:n}=fe();return a.jsx(je,{"aria-label":n("common.upload"),tooltip:n("common.upload"),icon:a.jsx(Au,{}),onClick:t,isDisabled:e})}const Cre=ve([en,Xn],(e,t)=>{const{layer:n,isMaskEnabled:r}=e;return{layer:n,isMaskEnabled:r,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Qt}});function _re(){const e=te(),{t}=fe(),{layer:n,isMaskEnabled:r,isStaging:o}=L(Cre),s=()=>{e(Mf(n==="mask"?"base":"mask"))};Ke(["q"],()=>{s()},{enabled:()=>!o,preventDefault:!0},[n]);const i=u=>{const d=u;e(Mf(d)),d==="mask"&&!r&&e(Su(!0))};return a.jsx(To,{tooltip:`${t("unifiedCanvas.layer")} (Q)`,"aria-label":`${t("unifiedCanvas.layer")} (Q)`,value:n,data:S3,onChange:i,disabled:o,w:"full"})}function kre(){const e=te(),{t}=fe(),n=ha(),r=L(Xn),o=L(i=>i.system.isProcessing);Ke(["shift+m"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n,o]);const s=()=>{e(y3())};return a.jsx(je,{"aria-label":`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:a.jsx(qv,{}),onClick:s,isDisabled:r})}function Pre(){const e=L(s=>s.canvas.tool),t=L(Xn),n=te(),{t:r}=fe();Ke(["v"],()=>{o()},{enabled:()=>!t,preventDefault:!0},[]);const o=()=>n(Hs("move"));return a.jsx(je,{"aria-label":`${r("unifiedCanvas.move")} (V)`,tooltip:`${r("unifiedCanvas.move")} (V)`,icon:a.jsx(M5,{}),isChecked:e==="move"||t,onClick:o})}function jre(){const e=L(s=>s.ui.shouldPinParametersPanel),t=L(s=>s.ui.shouldShowParametersPanel),n=te(),{t:r}=fe(),o=()=>{n(gv(!0)),e&&n(vo())};return!e||!t?a.jsxs(F,{flexDirection:"column",gap:2,children:[a.jsx(je,{tooltip:`${r("parameters.showOptionsPanel")} (O)`,tooltipProps:{placement:"top"},"aria-label":r("parameters.showOptionsPanel"),onClick:o,children:a.jsx(Kv,{})}),a.jsx(F,{children:a.jsx(ey,{iconButton:!0})}),a.jsx(F,{children:a.jsx(Dh,{width:"100%",height:"40px",btnGroupWidth:"100%"})})]}):null}function Ire(){const e=te(),{t}=fe(),n=L(Xn),r=()=>{e(C3()),e(Kp())};return a.jsx(je,{"aria-label":t("unifiedCanvas.clearCanvas"),tooltip:t("unifiedCanvas.clearCanvas"),icon:a.jsx(bo,{}),onClick:r,isDisabled:n,colorScheme:"error"})}function Ere(){const e=ha(),t=te(),{t:n}=fe();Ke(["r"],()=>{o()},{enabled:()=>!0,preventDefault:!0},[e]);const r=SI(()=>o(!1),()=>o(!0)),o=(s=!1)=>{const i=ha();if(!i)return;const u=i.getClientRect({skipTransform:!0});t(v3({contentRect:u,shouldScaleTo1:s}))};return a.jsx(je,{"aria-label":`${n("unifiedCanvas.resetView")} (R)`,tooltip:`${n("unifiedCanvas.resetView")} (R)`,icon:a.jsx(T5,{}),onClick:r})}function Ore(){const e=L(Xn),t=ha(),n=L(i=>i.system.isProcessing),r=te(),{t:o}=fe();Ke(["shift+s"],()=>{s()},{enabled:()=>!e,preventDefault:!0},[t,n]);const s=()=>{r(b3())};return a.jsx(je,{"aria-label":`${o("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${o("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:a.jsx(ph,{}),onClick:s,isDisabled:e})}const Rre=ve([en,Xn,Mo],(e,t,n)=>{const{isProcessing:r}=n,{tool:o}=e;return{tool:o,isStaging:t,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:Qt}}),Mre=()=>{const e=te(),{t}=fe(),{tool:n,isStaging:r}=L(Rre);Ke(["b"],()=>{o()},{enabled:()=>!r,preventDefault:!0},[]),Ke(["e"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n]),Ke(["c"],()=>{i()},{enabled:()=>!r,preventDefault:!0},[n]),Ke(["shift+f"],()=>{u()},{enabled:()=>!r,preventDefault:!0}),Ke(["delete","backspace"],()=>{d()},{enabled:()=>!r,preventDefault:!0});const o=()=>e(Hs("brush")),s=()=>e(Hs("eraser")),i=()=>e(Hs("colorPicker")),u=()=>e(m3()),d=()=>e(g3());return a.jsxs(F,{flexDirection:"column",gap:2,children:[a.jsxs(Yn,{children:[a.jsx(je,{"aria-label":`${t("unifiedCanvas.brush")} (B)`,tooltip:`${t("unifiedCanvas.brush")} (B)`,icon:a.jsx(L5,{}),isChecked:n==="brush"&&!r,onClick:o,isDisabled:r}),a.jsx(je,{"aria-label":`${t("unifiedCanvas.eraser")} (E)`,tooltip:`${t("unifiedCanvas.eraser")} (B)`,icon:a.jsx(A5,{}),isChecked:n==="eraser"&&!r,isDisabled:r,onClick:s})]}),a.jsxs(Yn,{children:[a.jsx(je,{"aria-label":`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:a.jsx($5,{}),isDisabled:r,onClick:u}),a.jsx(je,{"aria-label":`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:a.jsx(Tu,{style:{transform:"rotate(45deg)"}}),isDisabled:r,onClick:d})]}),a.jsx(je,{"aria-label":`${t("unifiedCanvas.colorPicker")} (C)`,tooltip:`${t("unifiedCanvas.colorPicker")} (C)`,icon:a.jsx(N5,{}),isChecked:n==="colorPicker"&&!r,isDisabled:r,onClick:i,width:"max-content"})]})},Dre=()=>a.jsxs(F,{flexDirection:"column",rowGap:2,width:"min-content",children:[a.jsx(_re,{}),a.jsx(Mre,{}),a.jsxs(F,{gap:2,children:[a.jsx(Pre,{}),a.jsx(Ere,{})]}),a.jsxs(F,{columnGap:2,children:[a.jsx(kre,{}),a.jsx(Ore,{})]}),a.jsxs(F,{columnGap:2,children:[a.jsx(xre,{}),a.jsx(wre,{})]}),a.jsxs(F,{gap:2,children:[a.jsx(kI,{}),a.jsx(CI,{})]}),a.jsxs(F,{gap:2,children:[a.jsx(Sre,{}),a.jsx(Ire,{})]}),a.jsx(bre,{}),a.jsx(jre,{})]}),Tre=ve([en,Jr],(e,t)=>{const{doesCanvasNeedScaling:n}=e,{shouldUseCanvasBetaLayout:r}=t;return{doesCanvasNeedScaling:n,shouldUseCanvasBetaLayout:r}},it),Bg={id:"canvas-intial-image",actionType:"SET_CANVAS_INITIAL_IMAGE"},Are=()=>{const e=te(),{doesCanvasNeedScaling:t,shouldUseCanvasBetaLayout:n}=L(Tre),{isOver:r,setNodeRef:o,active:s}=sv({id:"unifiedCanvas",data:Bg});return f.useLayoutEffect(()=>{const i=()=>{e(vo())};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[e]),n?a.jsx(ze,{layerStyle:"first",ref:o,tabIndex:0,sx:{w:"full",h:"full",p:4,borderRadius:"base"},children:a.jsxs(F,{sx:{w:"full",h:"full",gap:4},children:[a.jsx(Dre,{}),a.jsxs(F,{sx:{flexDir:"column",w:"full",h:"full",gap:4,position:"relative"},children:[a.jsx(vre,{}),a.jsxs(ze,{sx:{w:"full",h:"full",position:"relative"},children:[t?a.jsx(o4,{}):a.jsx(r4,{}),Cf(Bg,s)&&a.jsx(Kf,{isOver:r,label:"Set Canvas Initial Image"})]})]})]})}):a.jsx(ze,{ref:o,tabIndex:-1,sx:{layerStyle:"first",w:"full",h:"full",p:4,borderRadius:"base"},children:a.jsxs(F,{sx:{flexDirection:"column",alignItems:"center",gap:4,w:"full",h:"full"},children:[a.jsx(nre,{}),a.jsx(F,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,w:"full",h:"full"},children:a.jsxs(ze,{sx:{w:"full",h:"full",position:"relative"},children:[t?a.jsx(o4,{}):a.jsx(r4,{}),Cf(Bg,s)&&a.jsx(Kf,{isOver:r,label:"Set Canvas Initial Image"})]})})]})})},Nre=f.memo(Are),$re=ve([Mt],({generation:e})=>{const{infillMethod:t}=e;return{infillMethod:t}},it),zre=()=>{const e=te(),{infillMethod:t}=L($re),{data:n,isLoading:r}=RO(),o=n==null?void 0:n.infill_methods,{t:s}=fe(),i=f.useCallback(u=>{e(MO(u))},[e]);return a.jsx(To,{disabled:(o==null?void 0:o.length)===0,placeholder:r?"Loading...":void 0,label:s("parameters.infillMethod"),value:t,data:o??[],onChange:i})},Lre=f.memo(zre),Bre=ve([Jo],e=>{const{tileSize:t,infillMethod:n}=e;return{tileSize:t,infillMethod:n}},it),Fre=()=>{const e=te(),{tileSize:t,infillMethod:n}=L(Bre),{t:r}=fe(),o=f.useCallback(i=>{e(xx(i))},[e]),s=f.useCallback(()=>{e(xx(32))},[e]);return a.jsx(St,{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})},Hre=f.memo(Fre),Wre=ve([en],e=>{const{boundingBoxScaleMethod:t}=e;return{boundingBoxScale:t}},it),Vre=()=>{const e=te(),{boundingBoxScale:t}=L(Wre),{t:n}=fe(),r=o=>{e(TO(o))};return a.jsx(Rr,{label:n("parameters.scaleBeforeProcessing"),data:DO,value:t,onChange:r})},Ure=f.memo(Vre),Gre=ve([Jo,Mo,en],(e,t,n)=>{const{scaledBoundingBoxDimensions:r,boundingBoxScaleMethod:o}=n;return{scaledBoundingBoxDimensions:r,isManual:o==="manual"}},it),qre=()=>{const e=te(),{isManual:t,scaledBoundingBoxDimensions:n}=L(Gre),{t:r}=fe(),o=i=>{e(Df({...n,height:Math.floor(i)}))},s=()=>{e(Df({...n,height:Math.floor(512)}))};return a.jsx(St,{isDisabled:!t,label:r("parameters.scaledHeight"),min:64,max:1024,step:64,value:n.height,onChange:o,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:s})},Kre=f.memo(qre),Yre=ve([en],e=>{const{boundingBoxScaleMethod:t,scaledBoundingBoxDimensions:n}=e;return{scaledBoundingBoxDimensions:n,isManual:t==="manual"}},it),Qre=()=>{const e=te(),{isManual:t,scaledBoundingBoxDimensions:n}=L(Yre),{t:r}=fe(),o=i=>{e(Df({...n,width:Math.floor(i)}))},s=()=>{e(Df({...n,width:Math.floor(512)}))};return a.jsx(St,{isDisabled:!t,label:r("parameters.scaledWidth"),min:64,max:1024,step:64,value:n.width,onChange:o,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:s})},Xre=f.memo(Qre),Jre=()=>{const{t:e}=fe();return a.jsx(Ao,{label:e("parameters.infillScalingHeader"),children:a.jsxs(F,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(Lre,{}),a.jsx(Hre,{}),a.jsx(Ure,{}),a.jsx(Xre,{}),a.jsx(Kre,{})]})})},Zre=f.memo(Jre);function eoe(){const e=te(),t=L(r=>r.generation.seamBlur),{t:n}=fe();return a.jsx(St,{label:n("parameters.seamBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(wx(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(wx(16))}})}function toe(){const e=te(),{t}=fe(),n=L(r=>r.generation.seamSize);return a.jsx(St,{label:t("parameters.seamSize"),min:1,max:256,sliderNumberInputProps:{max:512},value:n,onChange:r=>{e(Sx(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>e(Sx(96))})}function noe(){const{t:e}=fe(),t=L(r=>r.generation.seamSteps),n=te();return a.jsx(St,{label:e("parameters.seamSteps"),min:1,max:100,sliderNumberInputProps:{max:999},value:t,onChange:r=>{n(Cx(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{n(Cx(30))}})}function roe(){const e=te(),{t}=fe(),n=L(r=>r.generation.seamStrength);return a.jsx(St,{label:t("parameters.seamStrength"),min:.01,max:.99,step:.01,value:n,onChange:r=>{e(_x(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(_x(.7))}})}const ooe=()=>{const{t:e}=fe();return a.jsxs(Ao,{label:e("parameters.seamCorrectionHeader"),children:[a.jsx(toe,{}),a.jsx(eoe,{}),a.jsx(roe,{}),a.jsx(noe,{})]})},soe=f.memo(ooe),aoe=ve([en,Xn,Jr],(e,t,n)=>{const{boundingBoxDimensions:r}=e,{aspectRatio:o}=n;return{boundingBoxDimensions:r,isStaging:t,aspectRatio:o}},it),ioe=()=>{const e=te(),{boundingBoxDimensions:t,isStaging:n,aspectRatio:r}=L(aoe),{t:o}=fe(),s=u=>{if(e(Bs({...t,height:Math.floor(u)})),r){const d=cs(u*r,64);e(Bs({width:d,height:Math.floor(u)}))}},i=()=>{if(e(Bs({...t,height:Math.floor(512)})),r){const u=cs(512*r,64);e(Bs({width:u,height:Math.floor(512)}))}};return a.jsx(St,{label:o("parameters.boundingBoxHeight"),min:64,max:1024,step:64,value:t.height,onChange:s,isDisabled:n,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:i})},loe=f.memo(ioe),coe=ve([en,Xn,Jr],(e,t,n)=>{const{boundingBoxDimensions:r}=e,{aspectRatio:o}=n;return{boundingBoxDimensions:r,isStaging:t,aspectRatio:o}},it),uoe=()=>{const e=te(),{boundingBoxDimensions:t,isStaging:n,aspectRatio:r}=L(coe),{t:o}=fe(),s=u=>{if(e(Bs({...t,width:Math.floor(u)})),r){const d=cs(u/r,64);e(Bs({width:Math.floor(u),height:d}))}},i=()=>{if(e(Bs({...t,width:Math.floor(512)})),r){const u=cs(512/r,64);e(Bs({width:Math.floor(512),height:u}))}};return a.jsx(St,{label:o("parameters.boundingBoxWidth"),min:64,max:1024,step:64,value:t.width,onChange:s,isDisabled:n,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:i})},doe=f.memo(uoe);function s4(){const e=te(),{t}=fe();return a.jsxs(F,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.150",_dark:{bg:"base.750"}},children:[a.jsxs(F,{alignItems:"center",gap:2,children:[a.jsx(nt,{sx:{fontSize:"sm",width:"full",color:"base.700",_dark:{color:"base.300"}},children:t("parameters.aspectRatio")}),a.jsx($i,{}),a.jsx(Gj,{}),a.jsx(je,{tooltip:t("ui.swapSizes"),"aria-label":t("ui.swapSizes"),size:"sm",icon:a.jsx(U_,{}),fontSize:20,onClick:()=>e(AO())})]}),a.jsx(doe,{}),a.jsx(loe,{})]})}const foe=ve(Mt,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},it),poe=()=>{const{shouldUseSliders:e,activeLabel:t}=L(foe);return a.jsx(Ao,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(F,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(Wl,{}),a.jsx(Ul,{}),a.jsx(Hl,{}),a.jsx(Vl,{}),a.jsx(ze,{pt:2,children:a.jsx(Gl,{})}),a.jsx(s4,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(F,{gap:3,children:[a.jsx(Wl,{}),a.jsx(Ul,{}),a.jsx(Hl,{})]}),a.jsx(Vl,{}),a.jsx(ze,{pt:2,children:a.jsx(Gl,{})}),a.jsx(s4,{})]}),a.jsx(qj,{})]})})},hoe=f.memo(poe),moe=()=>a.jsxs(a.Fragment,{children:[a.jsx(X1,{}),a.jsx(K1,{}),a.jsx(ty,{}),a.jsx(hoe,{}),a.jsx(G1,{}),a.jsx(V1,{}),a.jsx(W1,{}),a.jsx(Z1,{}),a.jsx(J1,{}),a.jsx(soe,{}),a.jsx(Zre,{}),a.jsx(U1,{})]}),jI=f.memo(moe),goe=()=>a.jsxs(F,{sx:{gap:4,w:"full",h:"full"},children:[a.jsx(H1,{children:a.jsx(jI,{})}),a.jsx(Nre,{})]}),voe=f.memo(goe),yoe=[{id:"txt2img",translationKey:"common.txt2img",icon:a.jsx(mo,{as:y$,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Zee,{})},{id:"img2img",translationKey:"common.img2img",icon:a.jsx(mo,{as:oc,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(rJ,{})},{id:"unifiedCanvas",translationKey:"common.unifiedCanvas",icon:a.jsx(mo,{as:XB,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(voe,{})},{id:"nodes",translationKey:"common.nodes",icon:a.jsx(mo,{as:QB,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(qee,{})},{id:"modelManager",translationKey:"modelManager.modelManager",icon:a.jsx(mo,{as:c$,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(JJ,{})}],boe=ve(Wi,e=>{const{disabledTabs:t}=e;return yoe.filter(n=>!t.includes(n.id))},{memoizeOptions:{resultEqualityCheck:Qt}}),xoe=300,Fg=20,II=["modelManager"],woe=()=>{const e=L(NO),t=L(ur),n=L(boe),{shouldPinGallery:r,shouldPinParametersPanel:o,shouldShowGallery:s}=L(S=>S.ui),{t:i}=fe(),u=te();Ke("f",()=>{u($O()),(r||o)&&u(vo())},[r,o]);const d=f.useCallback(()=>{t==="unifiedCanvas"&&u(vo())},[u,t]),p=f.useCallback(S=>{S.target instanceof HTMLElement&&S.target.blur()},[]),h=f.useMemo(()=>n.map(S=>a.jsx(_n,{hasArrow:!0,label:String(i(S.translationKey)),placement:"end",children:a.jsxs(dh,{onClick:p,children:[a.jsx(R3,{children:String(i(S.translationKey))}),S.icon]})},S.id)),[n,i,p]),m=f.useMemo(()=>n.map(S=>a.jsx(ch,{children:S.content},S.id)),[n]),{ref:v,minSizePct:b}=UK(xoe,Fg,"app");return a.jsxs(ih,{defaultIndex:e,index:e,onChange:S=>{u(gl(S))},sx:{flexGrow:1,gap:4},isLazy:!0,children:[a.jsxs(lh,{sx:{pt:2,gap:4,flexDir:"column"},children:[h,a.jsx($i,{}),a.jsx(jK,{})]}),a.jsxs(B1,{id:"app",autoSaveId:"app",direction:"horizontal",style:{height:"100%",width:"100%"},children:[a.jsx(fu,{id:"main",children:a.jsx(uh,{style:{height:"100%",width:"100%"},children:m})}),r&&s&&!II.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(Mj,{}),a.jsx(fu,{ref:v,onResize:d,id:"gallery",order:3,defaultSize:b>Fg?b:Fg,minSize:b,maxSize:50,children:a.jsx(W_,{})})]})]})]})},Soe=f.memo(woe),Coe=ve([ur,Jr],(e,t)=>{const{shouldPinGallery:n,shouldShowGallery:r}=t;return{shouldPinGallery:n,shouldShowGalleryButton:II.includes(e)?!1:!r}},{memoizeOptions:{resultEqualityCheck:Qt}}),_oe=()=>{const{t:e}=fe(),{shouldPinGallery:t,shouldShowGalleryButton:n}=L(Coe),r=te(),o=()=>{r(Kg(!0)),t&&r(vo())};return n?a.jsx(je,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":e("accessibility.showGallery"),onClick:o,sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",p:0,insetInlineEnd:0,px:3,h:48,w:8,borderStartEndRadius:0,borderEndEndRadius:0,shadow:"2xl"},children:a.jsx(JB,{})}):null},koe=f.memo(_oe),Hg={borderStartStartRadius:0,borderEndStartRadius:0,shadow:"2xl"},Poe=ve([Jr,ur],(e,t)=>{const{shouldPinParametersPanel:n,shouldUseCanvasBetaLayout:r,shouldShowParametersPanel:o}=e,s=r&&t==="unifiedCanvas",i=!s&&(!n||!o),u=!s&&!o&&["txt2img","img2img","unifiedCanvas"].includes(t);return{shouldPinParametersPanel:n,shouldShowParametersPanelButton:u,shouldShowProcessButtons:i}},{memoizeOptions:{resultEqualityCheck:Qt}}),joe=()=>{const e=te(),{t}=fe(),{shouldShowProcessButtons:n,shouldShowParametersPanelButton:r,shouldPinParametersPanel:o}=L(Poe),s=()=>{e(gv(!0)),o&&e(vo())};return r?a.jsxs(F,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineStart:"4.5rem",direction:"column",gap:2,children:[a.jsx(je,{tooltip:"Show Options Panel (O)",tooltipProps:{placement:"top"},"aria-label":t("accessibility.showOptionsPanel"),onClick:s,sx:Hg,children:a.jsx(Kv,{})}),n&&a.jsxs(a.Fragment,{children:[a.jsx(ey,{iconButton:!0,sx:Hg}),a.jsx(Dh,{sx:Hg})]})]}):null},Ioe=f.memo(joe),Eoe=ve([Jr,ur],(e,t)=>{const{shouldPinParametersPanel:n,shouldShowParametersPanel:r}=e;return{activeTabName:t,shouldPinParametersPanel:n,shouldShowParametersPanel:r}},it),Ooe=()=>{const e=te(),{shouldPinParametersPanel:t,shouldShowParametersPanel:n,activeTabName:r}=L(Eoe),o=()=>{e(gv(!1))},s=f.useMemo(()=>r==="txt2img"?a.jsx(uI,{}):r==="img2img"?a.jsx(Kj,{}):r==="unifiedCanvas"?a.jsx(jI,{}):null,[r]);return t?null:a.jsx(E5,{direction:"left",isResizable:!1,isOpen:n,onClose:o,children:a.jsxs(F,{sx:{flexDir:"column",h:"full",w:F1,gap:2,position:"relative",flexShrink:0,overflowY:"auto"},children:[a.jsxs(F,{paddingTop:1.5,paddingBottom:4,justifyContent:"space-between",alignItems:"center",children:[a.jsx(G_,{}),a.jsx(Rj,{})]}),a.jsx(F,{sx:{gap:2,flexDirection:"column",h:"full",w:"full"},children:s})]})})},Roe=f.memo(Ooe),Moe=e=>{const{imagesUsage:t}=e;return!t||!E4(t)?null:a.jsxs(a.Fragment,{children:[a.jsx(nt,{children:"An image from this board is currently in use in the following features:"}),a.jsxs(th,{sx:{paddingInlineStart:6},children:[t.isInitialImage&&a.jsx(Eo,{children:"Image to Image"}),t.isCanvasImage&&a.jsx(Eo,{children:"Unified Canvas"}),t.isControlNetImage&&a.jsx(Eo,{children:"ControlNet"}),t.isNodesImage&&a.jsx(Eo,{children:"Node Editor"})]}),a.jsx(nt,{children:"If you delete images from this board, those features will immediately be reset."})]})},Doe=()=>{const{t:e}=fe(),{isOpen:t,onClose:n,board:r,handleDeleteBoardImages:o,handleDeleteBoardOnly:s,imagesUsage:i}=f.useContext(C4),u=f.useRef(null);return a.jsx(Ou,{isOpen:t,leastDestructiveRef:u,onClose:n,isCentered:!0,children:a.jsx(va,{children:r&&a.jsxs(Ru,{children:[a.jsx(ga,{fontSize:"lg",fontWeight:"bold",children:"Delete Board"}),a.jsx(ya,{children:a.jsxs(F,{direction:"column",gap:3,children:[a.jsx(Moe,{imagesUsage:i}),a.jsx(ni,{}),a.jsx(nt,{children:e("common.areYouSure")}),a.jsxs(nt,{fontWeight:"bold",children:["This board has ",r.image_count," image(s) that will be deleted."]})]})}),a.jsxs(ma,{gap:3,children:[a.jsx(Zt,{ref:u,onClick:n,children:"Cancel"}),a.jsx(Zt,{colorScheme:"warning",onClick:()=>s(r.board_id),children:"Delete Board Only"}),a.jsx(Zt,{colorScheme:"error",onClick:()=>o(r.board_id),children:"Delete Board and Images"})]})]})})})},Toe=f.memo(Doe),Aoe=()=>{const{data:e,isFetching:t}=lv(),{isOpen:n,onClose:r,handleAddToBoard:o,image:s}=f.useContext(_4),[i,u]=f.useState(),d=f.useRef(null),p=e==null?void 0:e.find(h=>h.board_id===(s==null?void 0:s.board_id));return a.jsx(Ou,{isOpen:n,leastDestructiveRef:d,onClose:r,isCentered:!0,children:a.jsx(va,{children:a.jsxs(Ru,{children:[a.jsx(ga,{fontSize:"lg",fontWeight:"bold",children:p?"Move Image to Board":"Add Image to Board"}),a.jsx(ya,{children:a.jsx(ze,{children:a.jsxs(F,{direction:"column",gap:3,children:[p&&a.jsxs(nt,{children:["Moving this image from"," ",a.jsx("strong",{children:p.board_name})," to"]}),t?a.jsx(Jl,{}):a.jsx(Rr,{placeholder:"Select Board",onChange:h=>u(h),value:i,data:(e??[]).map(h=>({label:h.board_name,value:h.board_id}))})]})})}),a.jsxs(ma,{children:[a.jsx(Zt,{onClick:r,children:"Cancel"}),a.jsx(Zt,{isDisabled:!i,colorScheme:"accent",onClick:()=>{i&&o(i)},ml:3,children:p?"Move":"Add"})]})]})})})},Noe=f.memo(Aoe),$oe=ve([e=>e.hotkeys,e=>e.ui],(e,t)=>{const{shift:n}=e,{shouldPinParametersPanel:r,shouldPinGallery:o}=t;return{shift:n,shouldPinGallery:o,shouldPinParametersPanel:r}},{memoizeOptions:{resultEqualityCheck:Qt}}),zoe=()=>{const e=te(),{shift:t,shouldPinParametersPanel:n,shouldPinGallery:r}=L($oe),o=L(ur);return Ke("*",()=>{_5("shift")?!t&&e(Yo(!0)):t&&e(Yo(!1))},{keyup:!0,keydown:!0},[t]),Ke("o",()=>{e(zO()),o==="unifiedCanvas"&&n&&e(vo())}),Ke(["shift+o"],()=>{e(LO()),o==="unifiedCanvas"&&e(vo())}),Ke("g",()=>{e(BO()),o==="unifiedCanvas"&&r&&e(vo())}),Ke(["shift+g"],()=>{e(I4()),o==="unifiedCanvas"&&e(vo())}),Ke("1",()=>{e(gl("txt2img"))}),Ke("2",()=>{e(gl("img2img"))}),Ke("3",()=>{e(gl("unifiedCanvas"))}),Ke("4",()=>{e(gl("nodes"))}),null},Loe=f.memo(zoe),Boe={},Foe=({config:e=Boe,headerComponent:t})=>{const n=L(R4),r=FO(),o=te();return f.useEffect(()=>{yr.changeLanguage(n)},[n]),f.useEffect(()=>{r.info({namespace:"App",data:e},"Received config"),o(HO(e))},[o,e,r]),f.useEffect(()=>{o(WO())},[o]),a.jsxs(a.Fragment,{children:[a.jsxs(Ei,{w:"100vw",h:"100vh",position:"relative",overflow:"hidden",children:[a.jsx(TN,{children:a.jsxs(Ei,{sx:{gap:4,p:4,gridAutoRows:"min-content auto",w:"full",h:"full"},children:[t||a.jsx(_K,{}),a.jsx(F,{sx:{gap:4,w:"full",h:"full"},children:a.jsx(Soe,{})})]})}),a.jsx(AB,{}),a.jsx(Roe,{}),a.jsx(xf,{children:a.jsx(Ioe,{})}),a.jsx(xf,{children:a.jsx(koe,{})})]}),a.jsx(FB,{}),a.jsx(Noe,{}),a.jsx(Toe,{}),a.jsx(VO,{}),a.jsx(Loe,{})]})},qoe=f.memo(Foe);export{qoe as default}; diff --git a/invokeai/frontend/web/dist/assets/MantineProvider-48183abc.js b/invokeai/frontend/web/dist/assets/MantineProvider-48183abc.js deleted file mode 100644 index 6654544fb7..0000000000 --- a/invokeai/frontend/web/dist/assets/MantineProvider-48183abc.js +++ /dev/null @@ -1 +0,0 @@ -import{gm as J,W as g,gk as P,s as x,gt as K}from"./index-9e78a66d.js";function b(r,e){return t=>t.colorMode==="dark"?e:r}function oe(r){const{orientation:e,vertical:t,horizontal:n}=r;return e?e==="vertical"?t:n:{}}function s(r,e={}){let t=!1;function n(){if(!t){t=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function a(...d){n();for(const u of d)e[u]=c(u);return s(r,e)}function o(...d){for(const u of d)u in e||(e[u]=c(u));return s(r,e)}function i(){return Object.fromEntries(Object.entries(e).map(([u,k])=>[u,k.selector]))}function l(){return Object.fromEntries(Object.entries(e).map(([u,k])=>[u,k.className]))}function c(d){const A=`chakra-${(["container","root"].includes(d??"")?[r]:[r,d]).filter(Boolean).join("__")}`;return{className:A,selector:`.${A}`,toString:()=>d}}return{parts:a,toPart:c,extend:o,selectors:i,classnames:l,get keys(){return Object.keys(e)},__type:{}}}var ae=s("accordion").parts("root","container","button","panel").extend("icon");s("alert").parts("title","description","container").extend("icon","spinner");s("avatar").parts("label","badge","container").extend("excessLabel","group");s("breadcrumb").parts("link","item","container").extend("separator");s("button").parts();var ie=s("checkbox").parts("control","icon","container").extend("label");s("progress").parts("track","filledTrack").extend("label");s("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer");s("editable").parts("preview","input","textarea");s("form").parts("container","requiredIndicator","helperText");s("formError").parts("text","icon");var se=s("input").parts("addon","field","element");s("list").parts("container","item","icon");var Q=s("menu").parts("button","list","item").extend("groupTitle","command","divider"),le=s("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),ce=s("numberinput").parts("root","field","stepperGroup","stepper");s("pininput").parts("field");var fe=s("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),de=s("progress").parts("label","filledTrack","track");s("radio").parts("container","control","label");var ue=s("select").parts("field","icon"),pe=s("slider").parts("container","track","thumb","filledTrack","mark");s("stat").parts("container","label","helpText","number","icon");var be=s("switch").parts("container","track","thumb");s("table").parts("table","thead","tbody","tr","th","td","tfoot","caption");var ge=s("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator");s("tag").parts("container","label","closeButton");s("card").parts("container","header","body","footer");const{definePartsStyle:Z,defineMultiStyleConfig:rr}=J(Q.keys),er=Z(r=>({button:{fontWeight:500,bg:b("base.300","base.500")(r),color:b("base.900","base.100")(r),_hover:{bg:b("base.400","base.600")(r),color:b("base.900","base.50")(r),fontWeight:600}},list:{zIndex:9999,color:b("base.900","base.150")(r),bg:b("base.200","base.800")(r),shadow:"dark-lg",border:"none"},item:{fontSize:"sm",bg:b("base.200","base.800")(r),_hover:{bg:b("base.300","base.700")(r)},_focus:{bg:b("base.400","base.600")(r)},svg:{opacity:.5}}})),me=rr({variants:{invokeAI:er},defaultProps:{variant:"invokeAI"}}),ye={variants:{enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.07,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.07,easings:"easeOut"}}}},tr={dark:["#C1C2C5","#A6A7AB","#909296","#5c5f66","#373A40","#2C2E33","#25262b","#1A1B1E","#141517","#101113"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]};function nr(r){return()=>({fontFamily:r.fontFamily||"sans-serif"})}var or=Object.defineProperty,M=Object.getOwnPropertySymbols,ar=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable,I=(r,e,t)=>e in r?or(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,R=(r,e)=>{for(var t in e||(e={}))ar.call(e,t)&&I(r,t,e[t]);if(M)for(var t of M(e))ir.call(e,t)&&I(r,t,e[t]);return r};function sr(r){return e=>({WebkitTapHighlightColor:"transparent",[e||"&:focus"]:R({},r.focusRing==="always"||r.focusRing==="auto"?r.focusRingStyles.styles(r):r.focusRingStyles.resetStyles(r)),[e?e.replace(":focus",":focus:not(:focus-visible)"):"&:focus:not(:focus-visible)"]:R({},r.focusRing==="auto"||r.focusRing==="never"?r.focusRingStyles.resetStyles(r):null)})}function _(r){return e=>typeof r.primaryShade=="number"?r.primaryShade:r.primaryShade[e||r.colorScheme]}function E(r){const e=_(r);return(t,n,a=!0,o=!0)=>{if(typeof t=="string"&&t.includes(".")){const[l,c]=t.split("."),y=parseInt(c,10);if(l in r.colors&&y>=0&&y<10)return r.colors[l][typeof n=="number"&&!o?n:y]}const i=typeof n=="number"?n:e();return t in r.colors?r.colors[t][i]:a?r.colors[r.primaryColor][i]:t}}function V(r){let e="";for(let t=1;t{const a={from:(n==null?void 0:n.from)||r.defaultGradient.from,to:(n==null?void 0:n.to)||r.defaultGradient.to,deg:(n==null?void 0:n.deg)||r.defaultGradient.deg};return`linear-gradient(${a.deg}deg, ${e(a.from,t(),!1)} 0%, ${e(a.to,t(),!1)} 100%)`}}function X(r){return e=>{if(typeof e=="number")return`${e/16}${r}`;if(typeof e=="string"){const t=e.replace("px","");if(!Number.isNaN(Number(t)))return`${Number(t)/16}${r}`}return e}}const m=X("rem"),O=X("em");function q({size:r,sizes:e,units:t}){return r in e?e[r]:typeof r=="number"?t==="em"?O(r):m(r):r||e.md}function $(r){return typeof r=="number"?r:typeof r=="string"&&r.includes("rem")?Number(r.replace("rem",""))*16:typeof r=="string"&&r.includes("em")?Number(r.replace("em",""))*16:Number(r)}function fr(r){return e=>`@media (min-width: ${O($(q({size:e,sizes:r.breakpoints})))})`}function dr(r){return e=>`@media (max-width: ${O($(q({size:e,sizes:r.breakpoints}))-1)})`}function ur(r){return/^#?([0-9A-F]{3}){1,2}$/i.test(r)}function pr(r){let e=r.replace("#","");if(e.length===3){const i=e.split("");e=[i[0],i[0],i[1],i[1],i[2],i[2]].join("")}const t=parseInt(e,16),n=t>>16&255,a=t>>8&255,o=t&255;return{r:n,g:a,b:o,a:1}}function br(r){const[e,t,n,a]=r.replace(/[^0-9,.]/g,"").split(",").map(Number);return{r:e,g:t,b:n,a:a||1}}function j(r){return ur(r)?pr(r):r.startsWith("rgb")?br(r):{r:0,g:0,b:0,a:1}}function v(r,e){if(typeof r!="string"||e>1||e<0)return"rgba(0, 0, 0, 1)";if(r.startsWith("var(--"))return r;const{r:t,g:n,b:a}=j(r);return`rgba(${t}, ${n}, ${a}, ${e})`}function gr(r=0){return{position:"absolute",top:m(r),right:m(r),left:m(r),bottom:m(r)}}function mr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:t,g:n,b:a,a:o}=j(r),i=1-e,l=c=>Math.round(c*i);return`rgba(${l(t)}, ${l(n)}, ${l(a)}, ${o})`}function yr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:t,g:n,b:a,a:o}=j(r),i=l=>Math.round(l+(255-l)*e);return`rgba(${i(t)}, ${i(n)}, ${i(a)}, ${o})`}function vr(r){return e=>{if(typeof e=="number")return m(e);const t=typeof r.defaultRadius=="number"?r.defaultRadius:r.radius[r.defaultRadius]||r.defaultRadius;return r.radius[e]||e||t}}function Sr(r,e){if(typeof r=="string"&&r.includes(".")){const[t,n]=r.split("."),a=parseInt(n,10);if(t in e.colors&&a>=0&&a<10)return{isSplittedColor:!0,key:t,shade:a}}return{isSplittedColor:!1}}function hr(r){const e=E(r),t=_(r),n=U(r);return({variant:a,color:o,gradient:i,primaryFallback:l})=>{const c=Sr(o,r);switch(a){case"light":return{border:"transparent",background:v(e(o,r.colorScheme==="dark"?8:0,l,!1),r.colorScheme==="dark"?.2:1),color:o==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(o,r.colorScheme==="dark"?2:t("light")),hover:v(e(o,r.colorScheme==="dark"?7:1,l,!1),r.colorScheme==="dark"?.25:.65)};case"subtle":return{border:"transparent",background:"transparent",color:o==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(o,r.colorScheme==="dark"?2:t("light")),hover:v(e(o,r.colorScheme==="dark"?8:0,l,!1),r.colorScheme==="dark"?.2:1)};case"outline":return{border:e(o,r.colorScheme==="dark"?5:t("light")),background:"transparent",color:e(o,r.colorScheme==="dark"?5:t("light")),hover:r.colorScheme==="dark"?v(e(o,5,l,!1),.05):v(e(o,0,l,!1),.35)};case"default":return{border:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[4],background:r.colorScheme==="dark"?r.colors.dark[6]:r.white,color:r.colorScheme==="dark"?r.white:r.black,hover:r.colorScheme==="dark"?r.colors.dark[5]:r.colors.gray[0]};case"white":return{border:"transparent",background:r.white,color:e(o,t()),hover:null};case"transparent":return{border:"transparent",color:o==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(o,r.colorScheme==="dark"?2:t("light")),background:"transparent",hover:null};case"gradient":return{background:n(i),color:r.white,border:"transparent",hover:null};default:{const y=t(),d=c.isSplittedColor?c.shade:y,u=c.isSplittedColor?c.key:o;return{border:"transparent",background:e(u,d,l),color:r.white,hover:e(u,d===9?8:d+1)}}}}}function _r(r){return e=>{const t=_(r)(e);return r.colors[r.primaryColor][t]}}function kr(r){return{"@media (hover: hover)":{"&:hover":r},"@media (hover: none)":{"&:active":r}}}function $r(r){return()=>({userSelect:"none",color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]})}function wr(r){return()=>r.colorScheme==="dark"?r.colors.dark[2]:r.colors.gray[6]}const f={fontStyles:nr,themeColor:E,focusStyles:sr,linearGradient:lr,radialGradient:cr,smallerThan:dr,largerThan:fr,rgba:v,cover:gr,darken:mr,lighten:yr,radius:vr,variant:hr,primaryShade:_,hover:kr,gradient:U,primaryColor:_r,placeholderStyles:$r,dimmed:wr};var Pr=Object.defineProperty,xr=Object.defineProperties,Or=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,Cr=Object.prototype.hasOwnProperty,Er=Object.prototype.propertyIsEnumerable,F=(r,e,t)=>e in r?Pr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,jr=(r,e)=>{for(var t in e||(e={}))Cr.call(e,t)&&F(r,t,e[t]);if(T)for(var t of T(e))Er.call(e,t)&&F(r,t,e[t]);return r},zr=(r,e)=>xr(r,Or(e));function B(r){return zr(jr({},r),{fn:{fontStyles:f.fontStyles(r),themeColor:f.themeColor(r),focusStyles:f.focusStyles(r),largerThan:f.largerThan(r),smallerThan:f.smallerThan(r),radialGradient:f.radialGradient,linearGradient:f.linearGradient,gradient:f.gradient(r),rgba:f.rgba,cover:f.cover,lighten:f.lighten,darken:f.darken,primaryShade:f.primaryShade(r),radius:f.radius(r),variant:f.variant(r),hover:f.hover,primaryColor:f.primaryColor(r),placeholderStyles:f.placeholderStyles(r),dimmed:f.dimmed(r)}})}const Ar={dir:"ltr",primaryShade:{light:6,dark:8},focusRing:"auto",loader:"oval",colorScheme:"light",white:"#fff",black:"#000",defaultRadius:"sm",transitionTimingFunction:"ease",colors:tr,lineHeight:1.55,fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",primaryColor:"blue",respectReducedMotion:!0,cursorType:"default",defaultGradient:{from:"indigo",to:"cyan",deg:45},shadows:{xs:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.1)",sm:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 0.625rem 0.9375rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.4375rem 0.4375rem -0.3125rem",md:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.25rem 1.5625rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.625rem 0.625rem -0.3125rem",lg:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.75rem 1.4375rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 0.75rem 0.75rem -0.4375rem",xl:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 2.25rem 1.75rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 1.0625rem 1.0625rem -0.4375rem"},fontSizes:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},radius:{xs:"0.125rem",sm:"0.25rem",md:"0.5rem",lg:"1rem",xl:"2rem"},spacing:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},headings:{fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontWeight:700,sizes:{h1:{fontSize:"2.125rem",lineHeight:1.3,fontWeight:void 0},h2:{fontSize:"1.625rem",lineHeight:1.35,fontWeight:void 0},h3:{fontSize:"1.375rem",lineHeight:1.4,fontWeight:void 0},h4:{fontSize:"1.125rem",lineHeight:1.45,fontWeight:void 0},h5:{fontSize:"1rem",lineHeight:1.5,fontWeight:void 0},h6:{fontSize:"0.875rem",lineHeight:1.5,fontWeight:void 0}}},other:{},components:{},activeStyles:{transform:"translateY(0.0625rem)"},datesLocale:"en",globalStyles:void 0,focusRingStyles:{styles:r=>({outlineOffset:"0.125rem",outline:`0.125rem solid ${r.colors[r.primaryColor][r.colorScheme==="dark"?7:5]}`}),resetStyles:()=>({outline:"none"}),inputStyles:r=>({outline:"none",borderColor:r.colors[r.primaryColor][typeof r.primaryShade=="object"?r.primaryShade[r.colorScheme]:r.primaryShade]})}},z=B(Ar);var Mr=Object.defineProperty,Ir=Object.defineProperties,Rr=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,Tr=Object.prototype.hasOwnProperty,Fr=Object.prototype.propertyIsEnumerable,W=(r,e,t)=>e in r?Mr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Hr=(r,e)=>{for(var t in e||(e={}))Tr.call(e,t)&&W(r,t,e[t]);if(H)for(var t of H(e))Fr.call(e,t)&&W(r,t,e[t]);return r},Wr=(r,e)=>Ir(r,Rr(e));function Nr({theme:r}){return g.createElement(P,{styles:{"*, *::before, *::after":{boxSizing:"border-box"},html:{colorScheme:r.colorScheme==="dark"?"dark":"light"},body:Wr(Hr({},r.fn.fontStyles()),{backgroundColor:r.colorScheme==="dark"?r.colors.dark[7]:r.white,color:r.colorScheme==="dark"?r.colors.dark[0]:r.black,lineHeight:r.lineHeight,fontSize:r.fontSizes.md,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"})}})}function S(r,e,t,n=m){Object.keys(e).forEach(a=>{r[`--mantine-${t}-${a}`]=n(e[a])})}function Gr({theme:r}){const e={"--mantine-color-white":r.white,"--mantine-color-black":r.black,"--mantine-transition-timing-function":r.transitionTimingFunction,"--mantine-line-height":`${r.lineHeight}`,"--mantine-font-family":r.fontFamily,"--mantine-font-family-monospace":r.fontFamilyMonospace,"--mantine-font-family-headings":r.headings.fontFamily,"--mantine-heading-font-weight":`${r.headings.fontWeight}`};S(e,r.shadows,"shadow"),S(e,r.fontSizes,"font-size"),S(e,r.radius,"radius"),S(e,r.spacing,"spacing"),S(e,r.breakpoints,"breakpoints",O),Object.keys(r.colors).forEach(n=>{r.colors[n].forEach((a,o)=>{e[`--mantine-color-${n}-${o}`]=a})});const t=r.headings.sizes;return Object.keys(t).forEach(n=>{e[`--mantine-${n}-font-size`]=t[n].fontSize,e[`--mantine-${n}-line-height`]=`${t[n].lineHeight}`}),g.createElement(P,{styles:{":root":e}})}var Dr=Object.defineProperty,Lr=Object.defineProperties,Vr=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,Ur=Object.prototype.hasOwnProperty,Xr=Object.prototype.propertyIsEnumerable,G=(r,e,t)=>e in r?Dr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,p=(r,e)=>{for(var t in e||(e={}))Ur.call(e,t)&&G(r,t,e[t]);if(N)for(var t of N(e))Xr.call(e,t)&&G(r,t,e[t]);return r},C=(r,e)=>Lr(r,Vr(e));function qr(r,e){var t;if(!e)return r;const n=Object.keys(r).reduce((a,o)=>{if(o==="headings"&&e.headings){const i=e.headings.sizes?Object.keys(r.headings.sizes).reduce((l,c)=>(l[c]=p(p({},r.headings.sizes[c]),e.headings.sizes[c]),l),{}):r.headings.sizes;return C(p({},a),{headings:C(p(p({},r.headings),e.headings),{sizes:i})})}if(o==="breakpoints"&&e.breakpoints){const i=p(p({},r.breakpoints),e.breakpoints);return C(p({},a),{breakpoints:Object.fromEntries(Object.entries(i).sort((l,c)=>$(l[1])-$(c[1])))})}return a[o]=typeof e[o]=="object"?p(p({},r[o]),e[o]):typeof e[o]=="number"||typeof e[o]=="boolean"||typeof e[o]=="function"?e[o]:e[o]||r[o],a},{});if(e!=null&&e.fontFamily&&!((t=e==null?void 0:e.headings)!=null&&t.fontFamily)&&(n.headings.fontFamily=e.fontFamily),!(n.primaryColor in n.colors))throw new Error("MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color");return n}function Br(r,e){return B(qr(r,e))}function Yr(r){return Object.keys(r).reduce((e,t)=>(r[t]!==void 0&&(e[t]=r[t]),e),{})}const Jr={html:{fontFamily:"sans-serif",lineHeight:"1.15",textSizeAdjust:"100%"},body:{margin:0},"article, aside, footer, header, nav, section, figcaption, figure, main":{display:"block"},h1:{fontSize:"2em"},hr:{boxSizing:"content-box",height:0,overflow:"visible"},pre:{fontFamily:"monospace, monospace",fontSize:"1em"},a:{background:"transparent",textDecorationSkip:"objects"},"a:active, a:hover":{outlineWidth:0},"abbr[title]":{borderBottom:"none",textDecoration:"underline"},"b, strong":{fontWeight:"bolder"},"code, kbp, samp":{fontFamily:"monospace, monospace",fontSize:"1em"},dfn:{fontStyle:"italic"},mark:{backgroundColor:"#ff0",color:"#000"},small:{fontSize:"80%"},"sub, sup":{fontSize:"75%",lineHeight:0,position:"relative",verticalAlign:"baseline"},sup:{top:"-0.5em"},sub:{bottom:"-0.25em"},"audio, video":{display:"inline-block"},"audio:not([controls])":{display:"none",height:0},img:{borderStyle:"none",verticalAlign:"middle"},"svg:not(:root)":{overflow:"hidden"},"button, input, optgroup, select, textarea":{fontFamily:"sans-serif",fontSize:"100%",lineHeight:"1.15",margin:0},"button, input":{overflow:"visible"},"button, select":{textTransform:"none"},"button, [type=reset], [type=submit]":{WebkitAppearance:"button"},"button::-moz-focus-inner, [type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner":{borderStyle:"none",padding:0},"button:-moz-focusring, [type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring":{outline:`${m(1)} dotted ButtonText`},legend:{boxSizing:"border-box",color:"inherit",display:"table",maxWidth:"100%",padding:0,whiteSpace:"normal"},progress:{display:"inline-block",verticalAlign:"baseline"},textarea:{overflow:"auto"},"[type=checkbox], [type=radio]":{boxSizing:"border-box",padding:0},"[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button":{height:"auto"},"[type=search]":{appearance:"none"},"[type=search]::-webkit-search-cancel-button, [type=search]::-webkit-search-decoration":{appearance:"none"},"::-webkit-file-upload-button":{appearance:"button",font:"inherit"},"details, menu":{display:"block"},summary:{display:"list-item"},canvas:{display:"inline-block"},template:{display:"none"}};function Kr(){return g.createElement(P,{styles:Jr})}var Qr=Object.defineProperty,D=Object.getOwnPropertySymbols,Zr=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,L=(r,e,t)=>e in r?Qr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,h=(r,e)=>{for(var t in e||(e={}))Zr.call(e,t)&&L(r,t,e[t]);if(D)for(var t of D(e))re.call(e,t)&&L(r,t,e[t]);return r};const w=x.createContext({theme:z});function Y(){var r;return((r=x.useContext(w))==null?void 0:r.theme)||z}function ve(r){const e=Y(),t=n=>{var a,o,i,l;return{styles:((a=e.components[n])==null?void 0:a.styles)||{},classNames:((o=e.components[n])==null?void 0:o.classNames)||{},variants:(i=e.components[n])==null?void 0:i.variants,sizes:(l=e.components[n])==null?void 0:l.sizes}};return Array.isArray(r)?r.map(t):[t(r)]}function Se(){var r;return(r=x.useContext(w))==null?void 0:r.emotionCache}function he(r,e,t){var n;const a=Y(),o=(n=a.components[r])==null?void 0:n.defaultProps,i=typeof o=="function"?o(a):o;return h(h(h({},e),i),Yr(t))}function ee({theme:r,emotionCache:e,withNormalizeCSS:t=!1,withGlobalStyles:n=!1,withCSSVariables:a=!1,inherit:o=!1,children:i}){const l=x.useContext(w),c=Br(z,o?h(h({},l.theme),r):r);return g.createElement(K,{theme:c},g.createElement(w.Provider,{value:{theme:c,emotionCache:e}},t&&g.createElement(Kr,null),n&&g.createElement(Nr,{theme:c}),a&&g.createElement(Gr,{theme:c}),typeof c.globalStyles=="function"&&g.createElement(P,{styles:c.globalStyles(c)}),i))}ee.displayName="@mantine/core/MantineProvider";export{ee as M,Y as a,ve as b,q as c,he as d,b as e,Yr as f,$ as g,ae as h,ie as i,se as j,le as k,de as l,ye as m,ce as n,oe as o,fe as p,pe as q,m as r,ue as s,be as t,Se as u,ge as v,me as w}; diff --git a/invokeai/frontend/web/dist/assets/MantineProvider-97b2a7de.js b/invokeai/frontend/web/dist/assets/MantineProvider-97b2a7de.js new file mode 100644 index 0000000000..a0fb8b92ad --- /dev/null +++ b/invokeai/frontend/web/dist/assets/MantineProvider-97b2a7de.js @@ -0,0 +1 @@ +import{z as p,A as d,a4 as Z,aH as xe,g1 as We,Z as De,U as j,a7 as q,T as z,V as R,a1 as _e,a0 as Be,$ as Ce,_ as Ge,Y as Ue,g2 as Ve,g3 as Ze,fU as qe,ab as A,fS as B,f_ as Xe}from"./index-efb4c895.js";function Je(e,t){return`${e} returned \`undefined\`. Seems you forgot to wrap component within ${t}`}function M(e={}){const{name:t,strict:r=!0,hookName:o="useContext",providerName:a="Provider",errorMessage:n,defaultValue:s}=e,i=p.createContext(s);i.displayName=t;function l(){var c;const u=p.useContext(i);if(!u&&r){const f=new Error(n??Je(o,a));throw f.name="ContextError",(c=Error.captureStackTrace)==null||c.call(Error,f,l),f}return u}return[i.Provider,l,i]}var[Ke,Ye]=M({strict:!1,name:"PortalManagerContext"});function Qe(e){const{children:t,zIndex:r}=e;return d.jsx(Ke,{value:{zIndex:r},children:t})}Qe.displayName="PortalManager";var[ke,et]=M({strict:!1,name:"PortalContext"}),J="chakra-portal",tt=".chakra-portal",rt=e=>d.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),nt=e=>{const{appendToParentPortal:t,children:r}=e,[o,a]=p.useState(null),n=p.useRef(null),[,s]=p.useState({});p.useEffect(()=>s({}),[]);const i=et(),l=Ye();Z(()=>{if(!o)return;const u=o.ownerDocument,f=t?i??u.body:u.body;if(!f)return;n.current=u.createElement("div"),n.current.className=J,f.appendChild(n.current),s({});const y=n.current;return()=>{f.contains(y)&&f.removeChild(y)}},[o]);const c=l!=null&&l.zIndex?d.jsx(rt,{zIndex:l==null?void 0:l.zIndex,children:r}):r;return n.current?xe.createPortal(d.jsx(ke,{value:n.current,children:c}),n.current):d.jsx("span",{ref:u=>{u&&a(u)}})},ot=e=>{const{children:t,containerRef:r,appendToParentPortal:o}=e,a=r.current,n=a??(typeof window<"u"?document.body:void 0),s=p.useMemo(()=>{const l=a==null?void 0:a.ownerDocument.createElement("div");return l&&(l.className=J),l},[a]),[,i]=p.useState({});return Z(()=>i({}),[]),Z(()=>{if(!(!s||!n))return n.appendChild(s),()=>{n.removeChild(s)}},[s,n]),n&&s?xe.createPortal(d.jsx(ke,{value:o?s:null,children:t}),s):null};function G(e){const t={appendToParentPortal:!0,...e},{containerRef:r,...o}=t;return r?d.jsx(ot,{containerRef:r,...o}):d.jsx(nt,{...o})}G.className=J;G.selector=tt;G.displayName="Portal";function m(e,t={}){let r=!1;function o(){if(!r){r=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function a(...u){o();for(const f of u)t[f]=l(f);return m(e,t)}function n(...u){for(const f of u)f in t||(t[f]=l(f));return m(e,t)}function s(){return Object.fromEntries(Object.entries(t).map(([f,y])=>[f,y.selector]))}function i(){return Object.fromEntries(Object.entries(t).map(([f,y])=>[f,y.className]))}function l(u){const g=`chakra-${(["container","root"].includes(u??"")?[e]:[e,u]).filter(Boolean).join("__")}`;return{className:g,selector:`.${g}`,toString:()=>u}}return{parts:a,toPart:l,extend:n,selectors:s,classnames:i,get keys(){return Object.keys(t)},__type:{}}}var Or=m("accordion").parts("root","container","button","panel").extend("icon"),zr=m("alert").parts("title","description","container").extend("icon","spinner"),Rr=m("avatar").parts("label","badge","container").extend("excessLabel","group"),Mr=m("breadcrumb").parts("link","item","container").extend("separator");m("button").parts();var Lr=m("checkbox").parts("control","icon","container").extend("label");m("progress").parts("track","filledTrack").extend("label");var Fr=m("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),Hr=m("editable").parts("preview","input","textarea"),Wr=m("form").parts("container","requiredIndicator","helperText"),Dr=m("formError").parts("text","icon"),Br=m("input").parts("addon","field","element","group"),Gr=m("list").parts("container","item","icon"),at=m("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),Ur=m("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),Vr=m("numberinput").parts("root","field","stepperGroup","stepper");m("pininput").parts("field");var Zr=m("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),qr=m("progress").parts("label","filledTrack","track"),Xr=m("radio").parts("container","control","label"),Jr=m("select").parts("field","icon"),Kr=m("slider").parts("container","track","thumb","filledTrack","mark"),Yr=m("stat").parts("container","label","helpText","number","icon"),Qr=m("switch").parts("container","track","thumb"),en=m("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),tn=m("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),rn=m("tag").parts("container","label","closeButton"),nn=m("card").parts("container","header","body","footer");function P(e,t){return r=>r.colorMode==="dark"?t:e}function on(e){const{orientation:t,vertical:r,horizontal:o}=e;return t?t==="vertical"?r:o:{}}var st=(e,t)=>e.find(r=>r.id===t);function re(e,t){const r=we(e,t),o=r?e[r].findIndex(a=>a.id===t):-1;return{position:r,index:o}}function we(e,t){for(const[r,o]of Object.entries(e))if(st(o,t))return r}function it(e){const t=e.includes("right"),r=e.includes("left");let o="center";return t&&(o="flex-end"),r&&(o="flex-start"),{display:"flex",flexDirection:"column",alignItems:o}}function lt(e){const r=e==="top"||e==="bottom"?"0 auto":void 0,o=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,a=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,n=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",s=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:r,top:o,bottom:a,right:n,left:s}}function ct(e,t=[]){const r=p.useRef(e);return p.useEffect(()=>{r.current=e}),p.useCallback((...o)=>{var a;return(a=r.current)==null?void 0:a.call(r,...o)},t)}function ut(e,t){const r=ct(e);p.useEffect(()=>{if(t==null)return;let o=null;return o=window.setTimeout(()=>{r()},t),()=>{o&&window.clearTimeout(o)}},[t,r])}function ne(e,t){const r=p.useRef(!1),o=p.useRef(!1);p.useEffect(()=>{if(r.current&&o.current)return e();o.current=!0},t),p.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[])}var dt={initial:e=>{const{position:t}=e,r=["top","bottom"].includes(t)?"y":"x";let o=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(o=1),{opacity:0,[r]:o*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},Pe=p.memo(e=>{const{id:t,message:r,onCloseComplete:o,onRequestRemove:a,requestClose:n=!1,position:s="bottom",duration:i=5e3,containerStyle:l,motionVariants:c=dt,toastSpacing:u="0.5rem"}=e,[f,y]=p.useState(i),g=We();ne(()=>{g||o==null||o()},[g]),ne(()=>{y(i)},[i]);const h=()=>y(null),$=()=>y(i),S=()=>{g&&a()};p.useEffect(()=>{g&&n&&a()},[g,n,a]),ut(S,f);const H=p.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:u,...l}),[l,u]),N=p.useMemo(()=>it(s),[s]);return d.jsx(De.div,{layout:!0,className:"chakra-toast",variants:c,initial:"initial",animate:"animate",exit:"exit",onHoverStart:h,onHoverEnd:$,custom:{position:s},style:N,children:d.jsx(j.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:H,children:q(r,{id:t,onClose:S})})})});Pe.displayName="ToastComponent";function ft(e,t){var r;const o=e??"bottom",n={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[o];return(r=n==null?void 0:n[t])!=null?r:o}var oe={path:d.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[d.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),d.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),d.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},L=z((e,t)=>{const{as:r,viewBox:o,color:a="currentColor",focusable:n=!1,children:s,className:i,__css:l,...c}=e,u=R("chakra-icon",i),f=_e("Icon",e),y={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:a,...l,...f},g={ref:t,focusable:n,className:u,__css:y},h=o??oe.viewBox;if(r&&typeof r!="string")return d.jsx(j.svg,{as:r,...g,...c});const $=s??oe.path;return d.jsx(j.svg,{verticalAlign:"middle",viewBox:h,...g,...c,children:$})});L.displayName="Icon";function pt(e){return d.jsx(L,{viewBox:"0 0 24 24",...e,children:d.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function mt(e){return d.jsx(L,{viewBox:"0 0 24 24",...e,children:d.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function ae(e){return d.jsx(L,{viewBox:"0 0 24 24",...e,children:d.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var[gt,K]=M({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[bt,Y]=M({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),Ae={info:{icon:mt,colorScheme:"blue"},warning:{icon:ae,colorScheme:"orange"},success:{icon:pt,colorScheme:"green"},error:{icon:ae,colorScheme:"red"},loading:{icon:Be,colorScheme:"blue"}};function yt(e){return Ae[e].colorScheme}function vt(e){return Ae[e].icon}var je=z(function(t,r){const o=Y(),{status:a}=K(),n={display:"inline",...o.description};return d.jsx(j.div,{ref:r,"data-status":a,...t,className:R("chakra-alert__desc",t.className),__css:n})});je.displayName="AlertDescription";function Ee(e){const{status:t}=K(),r=vt(t),o=Y(),a=t==="loading"?o.spinner:o.icon;return d.jsx(j.span,{display:"inherit","data-status":t,...e,className:R("chakra-alert__icon",e.className),__css:a,children:e.children||d.jsx(r,{h:"100%",w:"100%"})})}Ee.displayName="AlertIcon";var Ne=z(function(t,r){const o=Y(),{status:a}=K();return d.jsx(j.div,{ref:r,"data-status":a,...t,className:R("chakra-alert__title",t.className),__css:o.title})});Ne.displayName="AlertTitle";var $e=z(function(t,r){var o;const{status:a="info",addRole:n=!0,...s}=Ce(t),i=(o=t.colorScheme)!=null?o:yt(a),l=Ge("Alert",{...t,colorScheme:i}),c={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return d.jsx(gt,{value:{status:a},children:d.jsx(bt,{value:l,children:d.jsx(j.div,{"data-status":a,role:n?"alert":void 0,ref:r,...s,className:R("chakra-alert",t.className),__css:c})})})});$e.displayName="Alert";function ht(e){return d.jsx(L,{focusable:"false","aria-hidden":!0,...e,children:d.jsx("path",{fill:"currentColor",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"})})}var Te=z(function(t,r){const o=_e("CloseButton",t),{children:a,isDisabled:n,__css:s,...i}=Ce(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return d.jsx(j.button,{type:"button","aria-label":"Close",ref:r,disabled:n,__css:{...l,...o,...s},...i,children:a||d.jsx(ht,{width:"1em",height:"1em"})})});Te.displayName="CloseButton";var St={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},C=xt(St);function xt(e){let t=e;const r=new Set,o=a=>{t=a(t),r.forEach(n=>n())};return{getState:()=>t,subscribe:a=>(r.add(a),()=>{o(()=>e),r.delete(a)}),removeToast:(a,n)=>{o(s=>({...s,[n]:s[n].filter(i=>i.id!=a)}))},notify:(a,n)=>{const s=_t(a,n),{position:i,id:l}=s;return o(c=>{var u,f;const g=i.includes("top")?[s,...(u=c[i])!=null?u:[]]:[...(f=c[i])!=null?f:[],s];return{...c,[i]:g}}),l},update:(a,n)=>{a&&o(s=>{const i={...s},{position:l,index:c}=re(i,a);return l&&c!==-1&&(i[l][c]={...i[l][c],...n,message:Ie(n)}),i})},closeAll:({positions:a}={})=>{o(n=>(a??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,c)=>(l[c]=n[c].map(u=>({...u,requestClose:!0})),l),{...n}))},close:a=>{o(n=>{const s=we(n,a);return s?{...n,[s]:n[s].map(i=>i.id==a?{...i,requestClose:!0}:i)}:n})},isActive:a=>!!re(C.getState(),a).position}}var se=0;function _t(e,t={}){var r,o;se+=1;const a=(r=t.id)!=null?r:se,n=(o=t.position)!=null?o:"bottom";return{id:a,message:e,position:n,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>C.removeToast(String(a),n),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var Ct=e=>{const{status:t,variant:r="solid",id:o,title:a,isClosable:n,onClose:s,description:i,colorScheme:l,icon:c}=e,u=o?{root:`toast-${o}`,title:`toast-${o}-title`,description:`toast-${o}-description`}:void 0;return d.jsxs($e,{addRole:!1,status:t,variant:r,id:u==null?void 0:u.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[d.jsx(Ee,{children:c}),d.jsxs(j.div,{flex:"1",maxWidth:"100%",children:[a&&d.jsx(Ne,{id:u==null?void 0:u.title,children:a}),i&&d.jsx(je,{id:u==null?void 0:u.description,display:"block",children:i})]}),n&&d.jsx(Te,{size:"sm",onClick:s,position:"absolute",insetEnd:1,top:1})]})};function Ie(e={}){const{render:t,toastComponent:r=Ct}=e;return a=>typeof t=="function"?t({...a,...e}):d.jsx(r,{...a,...e})}function an(e,t){const r=a=>{var n;return{...t,...a,position:ft((n=a==null?void 0:a.position)!=null?n:t==null?void 0:t.position,e)}},o=a=>{const n=r(a),s=Ie(n);return C.notify(s,n)};return o.update=(a,n)=>{C.update(a,r(n))},o.promise=(a,n)=>{const s=o({...n.loading,status:"loading",duration:null});a.then(i=>o.update(s,{status:"success",duration:5e3,...q(n.success,i)})).catch(i=>o.update(s,{status:"error",duration:5e3,...q(n.error,i)}))},o.closeAll=C.closeAll,o.close=C.close,o.isActive=C.isActive,o}var[sn,ln]=M({name:"ToastOptionsContext",strict:!1}),cn=e=>{const t=p.useSyncExternalStore(C.subscribe,C.getState,C.getState),{motionVariants:r,component:o=Pe,portalProps:a}=e,s=Object.keys(t).map(i=>{const l=t[i];return d.jsx("div",{role:"region","aria-live":"polite","aria-label":"Notifications",id:`chakra-toast-manager-${i}`,style:lt(i),children:d.jsx(Ue,{initial:!1,children:l.map(c=>d.jsx(o,{motionVariants:r,...c},c.id))})},i)});return d.jsx(G,{...a,children:s})};function kt(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),r=0;r()=>{if(e.isInitialized)t();else{const r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}};function le(e,t,r){e.loadNamespaces(t,Oe(e,r))}function ce(e,t,r,o){typeof r=="string"&&(r=[r]),r.forEach(a=>{e.options.ns.indexOf(a)<0&&e.options.ns.push(a)}),e.loadLanguages(t,Oe(e,o))}function wt(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const o=t.languages[0],a=t.options?t.options.fallbackLng:!1,n=t.languages[t.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const s=(i,l)=>{const c=t.services.backendConnector.state[`${i}|${l}`];return c===-1||c===2};return r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!s(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(o,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||s(o,e)&&(!a||s(n,e)))}function Pt(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(X("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:r.lng,precheck:(a,n)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!n(a.isLanguageChangingTo,e))return!1}}):wt(e,t,r)}const At=p.createContext();class jt{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Et=(e,t)=>{const r=p.useRef();return p.useEffect(()=>{r.current=t?r.current:e},[e,t]),r.current};function un(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:r}=t,{i18n:o,defaultNS:a}=p.useContext(At)||{},n=r||o||Ze();if(n&&!n.reportNamespaces&&(n.reportNamespaces=new jt),!n){X("You will need to pass in an i18next instance by using initReactI18next");const v=(w,x)=>typeof x=="string"?x:x&&typeof x=="object"&&typeof x.defaultValue=="string"?x.defaultValue:Array.isArray(w)?w[w.length-1]:w,k=[v,{},!1];return k.t=v,k.i18n={},k.ready=!1,k}n.options.react&&n.options.react.wait!==void 0&&X("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...Ve(),...n.options.react,...t},{useSuspense:i,keyPrefix:l}=s;let c=e||a||n.options&&n.options.defaultNS;c=typeof c=="string"?[c]:c||["translation"],n.reportNamespaces.addUsedNamespaces&&n.reportNamespaces.addUsedNamespaces(c);const u=(n.isInitialized||n.initializedStoreOnce)&&c.every(v=>Pt(v,n,s));function f(){return n.getFixedT(t.lng||null,s.nsMode==="fallback"?c:c[0],l)}const[y,g]=p.useState(f);let h=c.join();t.lng&&(h=`${t.lng}${h}`);const $=Et(h),S=p.useRef(!0);p.useEffect(()=>{const{bindI18n:v,bindI18nStore:k}=s;S.current=!0,!u&&!i&&(t.lng?ce(n,t.lng,c,()=>{S.current&&g(f)}):le(n,c,()=>{S.current&&g(f)})),u&&$&&$!==h&&S.current&&g(f);function w(){S.current&&g(f)}return v&&n&&n.on(v,w),k&&n&&n.store.on(k,w),()=>{S.current=!1,v&&n&&v.split(" ").forEach(x=>n.off(x,w)),k&&n&&k.split(" ").forEach(x=>n.store.off(x,w))}},[n,h]);const H=p.useRef(!0);p.useEffect(()=>{S.current&&!H.current&&g(f),H.current=!1},[n,l]);const N=[y,n,u];if(N.t=y,N.i18n=n,N.ready=u,u||!u&&!i)return N;throw new Promise(v=>{t.lng?ce(n,t.lng,c,()=>v()):le(n,c,()=>v())})}const{definePartsStyle:Nt,defineMultiStyleConfig:$t}=qe(at.keys),Tt=Nt(e=>({button:{fontWeight:500,bg:P("base.300","base.500")(e),color:P("base.900","base.100")(e),_hover:{bg:P("base.400","base.600")(e),color:P("base.900","base.50")(e),fontWeight:600}},list:{zIndex:9999,color:P("base.900","base.150")(e),bg:P("base.200","base.800")(e),shadow:"dark-lg",border:"none"},item:{fontSize:"sm",bg:P("base.200","base.800")(e),_hover:{bg:P("base.300","base.700")(e),svg:{opacity:1}},_focus:{bg:P("base.400","base.600")(e)},svg:{opacity:.7,fontSize:14}}})),dn=$t({variants:{invokeAI:Tt},defaultProps:{variant:"invokeAI"}}),fn={variants:{enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.07,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.07,easings:"easeOut"}}}},It={dark:["#C1C2C5","#A6A7AB","#909296","#5c5f66","#373A40","#2C2E33","#25262b","#1A1B1E","#141517","#101113"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]};function Ot(e){return()=>({fontFamily:e.fontFamily||"sans-serif"})}var zt=Object.defineProperty,ue=Object.getOwnPropertySymbols,Rt=Object.prototype.hasOwnProperty,Mt=Object.prototype.propertyIsEnumerable,de=(e,t,r)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fe=(e,t)=>{for(var r in t||(t={}))Rt.call(t,r)&&de(e,r,t[r]);if(ue)for(var r of ue(t))Mt.call(t,r)&&de(e,r,t[r]);return e};function Lt(e){return t=>({WebkitTapHighlightColor:"transparent",[t||"&:focus"]:fe({},e.focusRing==="always"||e.focusRing==="auto"?e.focusRingStyles.styles(e):e.focusRingStyles.resetStyles(e)),[t?t.replace(":focus",":focus:not(:focus-visible)"):"&:focus:not(:focus-visible)"]:fe({},e.focusRing==="auto"||e.focusRing==="never"?e.focusRingStyles.resetStyles(e):null)})}function F(e){return t=>typeof e.primaryShade=="number"?e.primaryShade:e.primaryShade[t||e.colorScheme]}function Q(e){const t=F(e);return(r,o,a=!0,n=!0)=>{if(typeof r=="string"&&r.includes(".")){const[i,l]=r.split("."),c=parseInt(l,10);if(i in e.colors&&c>=0&&c<10)return e.colors[i][typeof o=="number"&&!n?o:c]}const s=typeof o=="number"?o:t();return r in e.colors?e.colors[r][s]:a?e.colors[e.primaryColor][s]:r}}function ze(e){let t="";for(let r=1;r{const a={from:(o==null?void 0:o.from)||e.defaultGradient.from,to:(o==null?void 0:o.to)||e.defaultGradient.to,deg:(o==null?void 0:o.deg)||e.defaultGradient.deg};return`linear-gradient(${a.deg}deg, ${t(a.from,r(),!1)} 0%, ${t(a.to,r(),!1)} 100%)`}}function Me(e){return t=>{if(typeof t=="number")return`${t/16}${e}`;if(typeof t=="string"){const r=t.replace("px","");if(!Number.isNaN(Number(r)))return`${Number(r)/16}${e}`}return t}}const E=Me("rem"),U=Me("em");function Le({size:e,sizes:t,units:r}){return e in t?t[e]:typeof e=="number"?r==="em"?U(e):E(e):e||t.md}function W(e){return typeof e=="number"?e:typeof e=="string"&&e.includes("rem")?Number(e.replace("rem",""))*16:typeof e=="string"&&e.includes("em")?Number(e.replace("em",""))*16:Number(e)}function Wt(e){return t=>`@media (min-width: ${U(W(Le({size:t,sizes:e.breakpoints})))})`}function Dt(e){return t=>`@media (max-width: ${U(W(Le({size:t,sizes:e.breakpoints}))-1)})`}function Bt(e){return/^#?([0-9A-F]{3}){1,2}$/i.test(e)}function Gt(e){let t=e.replace("#","");if(t.length===3){const s=t.split("");t=[s[0],s[0],s[1],s[1],s[2],s[2]].join("")}const r=parseInt(t,16),o=r>>16&255,a=r>>8&255,n=r&255;return{r:o,g:a,b:n,a:1}}function Ut(e){const[t,r,o,a]=e.replace(/[^0-9,.]/g,"").split(",").map(Number);return{r:t,g:r,b:o,a:a||1}}function ee(e){return Bt(e)?Gt(e):e.startsWith("rgb")?Ut(e):{r:0,g:0,b:0,a:1}}function T(e,t){if(typeof e!="string"||t>1||t<0)return"rgba(0, 0, 0, 1)";if(e.startsWith("var(--"))return e;const{r,g:o,b:a}=ee(e);return`rgba(${r}, ${o}, ${a}, ${t})`}function Vt(e=0){return{position:"absolute",top:E(e),right:E(e),left:E(e),bottom:E(e)}}function Zt(e,t){if(typeof e=="string"&&e.startsWith("var(--"))return e;const{r,g:o,b:a,a:n}=ee(e),s=1-t,i=l=>Math.round(l*s);return`rgba(${i(r)}, ${i(o)}, ${i(a)}, ${n})`}function qt(e,t){if(typeof e=="string"&&e.startsWith("var(--"))return e;const{r,g:o,b:a,a:n}=ee(e),s=i=>Math.round(i+(255-i)*t);return`rgba(${s(r)}, ${s(o)}, ${s(a)}, ${n})`}function Xt(e){return t=>{if(typeof t=="number")return E(t);const r=typeof e.defaultRadius=="number"?e.defaultRadius:e.radius[e.defaultRadius]||e.defaultRadius;return e.radius[t]||t||r}}function Jt(e,t){if(typeof e=="string"&&e.includes(".")){const[r,o]=e.split("."),a=parseInt(o,10);if(r in t.colors&&a>=0&&a<10)return{isSplittedColor:!0,key:r,shade:a}}return{isSplittedColor:!1}}function Kt(e){const t=Q(e),r=F(e),o=Re(e);return({variant:a,color:n,gradient:s,primaryFallback:i})=>{const l=Jt(n,e);switch(a){case"light":return{border:"transparent",background:T(t(n,e.colorScheme==="dark"?8:0,i,!1),e.colorScheme==="dark"?.2:1),color:n==="dark"?e.colorScheme==="dark"?e.colors.dark[0]:e.colors.dark[9]:t(n,e.colorScheme==="dark"?2:r("light")),hover:T(t(n,e.colorScheme==="dark"?7:1,i,!1),e.colorScheme==="dark"?.25:.65)};case"subtle":return{border:"transparent",background:"transparent",color:n==="dark"?e.colorScheme==="dark"?e.colors.dark[0]:e.colors.dark[9]:t(n,e.colorScheme==="dark"?2:r("light")),hover:T(t(n,e.colorScheme==="dark"?8:0,i,!1),e.colorScheme==="dark"?.2:1)};case"outline":return{border:t(n,e.colorScheme==="dark"?5:r("light")),background:"transparent",color:t(n,e.colorScheme==="dark"?5:r("light")),hover:e.colorScheme==="dark"?T(t(n,5,i,!1),.05):T(t(n,0,i,!1),.35)};case"default":return{border:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4],background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,color:e.colorScheme==="dark"?e.white:e.black,hover:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[0]};case"white":return{border:"transparent",background:e.white,color:t(n,r()),hover:null};case"transparent":return{border:"transparent",color:n==="dark"?e.colorScheme==="dark"?e.colors.dark[0]:e.colors.dark[9]:t(n,e.colorScheme==="dark"?2:r("light")),background:"transparent",hover:null};case"gradient":return{background:o(s),color:e.white,border:"transparent",hover:null};default:{const c=r(),u=l.isSplittedColor?l.shade:c,f=l.isSplittedColor?l.key:n;return{border:"transparent",background:t(f,u,i),color:e.white,hover:t(f,u===9?8:u+1)}}}}}function Yt(e){return t=>{const r=F(e)(t);return e.colors[e.primaryColor][r]}}function Qt(e){return{"@media (hover: hover)":{"&:hover":e},"@media (hover: none)":{"&:active":e}}}function er(e){return()=>({userSelect:"none",color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]})}function tr(e){return()=>e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6]}const b={fontStyles:Ot,themeColor:Q,focusStyles:Lt,linearGradient:Ft,radialGradient:Ht,smallerThan:Dt,largerThan:Wt,rgba:T,cover:Vt,darken:Zt,lighten:qt,radius:Xt,variant:Kt,primaryShade:F,hover:Qt,gradient:Re,primaryColor:Yt,placeholderStyles:er,dimmed:tr};var rr=Object.defineProperty,nr=Object.defineProperties,or=Object.getOwnPropertyDescriptors,pe=Object.getOwnPropertySymbols,ar=Object.prototype.hasOwnProperty,sr=Object.prototype.propertyIsEnumerable,me=(e,t,r)=>t in e?rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ir=(e,t)=>{for(var r in t||(t={}))ar.call(t,r)&&me(e,r,t[r]);if(pe)for(var r of pe(t))sr.call(t,r)&&me(e,r,t[r]);return e},lr=(e,t)=>nr(e,or(t));function Fe(e){return lr(ir({},e),{fn:{fontStyles:b.fontStyles(e),themeColor:b.themeColor(e),focusStyles:b.focusStyles(e),largerThan:b.largerThan(e),smallerThan:b.smallerThan(e),radialGradient:b.radialGradient,linearGradient:b.linearGradient,gradient:b.gradient(e),rgba:b.rgba,cover:b.cover,lighten:b.lighten,darken:b.darken,primaryShade:b.primaryShade(e),radius:b.radius(e),variant:b.variant(e),hover:b.hover,primaryColor:b.primaryColor(e),placeholderStyles:b.placeholderStyles(e),dimmed:b.dimmed(e)}})}const cr={dir:"ltr",primaryShade:{light:6,dark:8},focusRing:"auto",loader:"oval",colorScheme:"light",white:"#fff",black:"#000",defaultRadius:"sm",transitionTimingFunction:"ease",colors:It,lineHeight:1.55,fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",primaryColor:"blue",respectReducedMotion:!0,cursorType:"default",defaultGradient:{from:"indigo",to:"cyan",deg:45},shadows:{xs:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.1)",sm:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 0.625rem 0.9375rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.4375rem 0.4375rem -0.3125rem",md:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.25rem 1.5625rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.625rem 0.625rem -0.3125rem",lg:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.75rem 1.4375rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 0.75rem 0.75rem -0.4375rem",xl:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 2.25rem 1.75rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 1.0625rem 1.0625rem -0.4375rem"},fontSizes:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},radius:{xs:"0.125rem",sm:"0.25rem",md:"0.5rem",lg:"1rem",xl:"2rem"},spacing:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},headings:{fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontWeight:700,sizes:{h1:{fontSize:"2.125rem",lineHeight:1.3,fontWeight:void 0},h2:{fontSize:"1.625rem",lineHeight:1.35,fontWeight:void 0},h3:{fontSize:"1.375rem",lineHeight:1.4,fontWeight:void 0},h4:{fontSize:"1.125rem",lineHeight:1.45,fontWeight:void 0},h5:{fontSize:"1rem",lineHeight:1.5,fontWeight:void 0},h6:{fontSize:"0.875rem",lineHeight:1.5,fontWeight:void 0}}},other:{},components:{},activeStyles:{transform:"translateY(0.0625rem)"},datesLocale:"en",globalStyles:void 0,focusRingStyles:{styles:e=>({outlineOffset:"0.125rem",outline:`0.125rem solid ${e.colors[e.primaryColor][e.colorScheme==="dark"?7:5]}`}),resetStyles:()=>({outline:"none"}),inputStyles:e=>({outline:"none",borderColor:e.colors[e.primaryColor][typeof e.primaryShade=="object"?e.primaryShade[e.colorScheme]:e.primaryShade]})}},te=Fe(cr);var ur=Object.defineProperty,dr=Object.defineProperties,fr=Object.getOwnPropertyDescriptors,ge=Object.getOwnPropertySymbols,pr=Object.prototype.hasOwnProperty,mr=Object.prototype.propertyIsEnumerable,be=(e,t,r)=>t in e?ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gr=(e,t)=>{for(var r in t||(t={}))pr.call(t,r)&&be(e,r,t[r]);if(ge)for(var r of ge(t))mr.call(t,r)&&be(e,r,t[r]);return e},br=(e,t)=>dr(e,fr(t));function yr({theme:e}){return A.createElement(B,{styles:{"*, *::before, *::after":{boxSizing:"border-box"},html:{colorScheme:e.colorScheme==="dark"?"dark":"light"},body:br(gr({},e.fn.fontStyles()),{backgroundColor:e.colorScheme==="dark"?e.colors.dark[7]:e.white,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,lineHeight:e.lineHeight,fontSize:e.fontSizes.md,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"})}})}function I(e,t,r,o=E){Object.keys(t).forEach(a=>{e[`--mantine-${r}-${a}`]=o(t[a])})}function vr({theme:e}){const t={"--mantine-color-white":e.white,"--mantine-color-black":e.black,"--mantine-transition-timing-function":e.transitionTimingFunction,"--mantine-line-height":`${e.lineHeight}`,"--mantine-font-family":e.fontFamily,"--mantine-font-family-monospace":e.fontFamilyMonospace,"--mantine-font-family-headings":e.headings.fontFamily,"--mantine-heading-font-weight":`${e.headings.fontWeight}`};I(t,e.shadows,"shadow"),I(t,e.fontSizes,"font-size"),I(t,e.radius,"radius"),I(t,e.spacing,"spacing"),I(t,e.breakpoints,"breakpoints",U),Object.keys(e.colors).forEach(o=>{e.colors[o].forEach((a,n)=>{t[`--mantine-color-${o}-${n}`]=a})});const r=e.headings.sizes;return Object.keys(r).forEach(o=>{t[`--mantine-${o}-font-size`]=r[o].fontSize,t[`--mantine-${o}-line-height`]=`${r[o].lineHeight}`}),A.createElement(B,{styles:{":root":t}})}var hr=Object.defineProperty,Sr=Object.defineProperties,xr=Object.getOwnPropertyDescriptors,ye=Object.getOwnPropertySymbols,_r=Object.prototype.hasOwnProperty,Cr=Object.prototype.propertyIsEnumerable,ve=(e,t,r)=>t in e?hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_=(e,t)=>{for(var r in t||(t={}))_r.call(t,r)&&ve(e,r,t[r]);if(ye)for(var r of ye(t))Cr.call(t,r)&&ve(e,r,t[r]);return e},V=(e,t)=>Sr(e,xr(t));function kr(e,t){var r;if(!t)return e;const o=Object.keys(e).reduce((a,n)=>{if(n==="headings"&&t.headings){const s=t.headings.sizes?Object.keys(e.headings.sizes).reduce((i,l)=>(i[l]=_(_({},e.headings.sizes[l]),t.headings.sizes[l]),i),{}):e.headings.sizes;return V(_({},a),{headings:V(_(_({},e.headings),t.headings),{sizes:s})})}if(n==="breakpoints"&&t.breakpoints){const s=_(_({},e.breakpoints),t.breakpoints);return V(_({},a),{breakpoints:Object.fromEntries(Object.entries(s).sort((i,l)=>W(i[1])-W(l[1])))})}return a[n]=typeof t[n]=="object"?_(_({},e[n]),t[n]):typeof t[n]=="number"||typeof t[n]=="boolean"||typeof t[n]=="function"?t[n]:t[n]||e[n],a},{});if(t!=null&&t.fontFamily&&!((r=t==null?void 0:t.headings)!=null&&r.fontFamily)&&(o.headings.fontFamily=t.fontFamily),!(o.primaryColor in o.colors))throw new Error("MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color");return o}function wr(e,t){return Fe(kr(e,t))}function Pr(e){return Object.keys(e).reduce((t,r)=>(e[r]!==void 0&&(t[r]=e[r]),t),{})}const Ar={html:{fontFamily:"sans-serif",lineHeight:"1.15",textSizeAdjust:"100%"},body:{margin:0},"article, aside, footer, header, nav, section, figcaption, figure, main":{display:"block"},h1:{fontSize:"2em"},hr:{boxSizing:"content-box",height:0,overflow:"visible"},pre:{fontFamily:"monospace, monospace",fontSize:"1em"},a:{background:"transparent",textDecorationSkip:"objects"},"a:active, a:hover":{outlineWidth:0},"abbr[title]":{borderBottom:"none",textDecoration:"underline"},"b, strong":{fontWeight:"bolder"},"code, kbp, samp":{fontFamily:"monospace, monospace",fontSize:"1em"},dfn:{fontStyle:"italic"},mark:{backgroundColor:"#ff0",color:"#000"},small:{fontSize:"80%"},"sub, sup":{fontSize:"75%",lineHeight:0,position:"relative",verticalAlign:"baseline"},sup:{top:"-0.5em"},sub:{bottom:"-0.25em"},"audio, video":{display:"inline-block"},"audio:not([controls])":{display:"none",height:0},img:{borderStyle:"none",verticalAlign:"middle"},"svg:not(:root)":{overflow:"hidden"},"button, input, optgroup, select, textarea":{fontFamily:"sans-serif",fontSize:"100%",lineHeight:"1.15",margin:0},"button, input":{overflow:"visible"},"button, select":{textTransform:"none"},"button, [type=reset], [type=submit]":{WebkitAppearance:"button"},"button::-moz-focus-inner, [type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner":{borderStyle:"none",padding:0},"button:-moz-focusring, [type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring":{outline:`${E(1)} dotted ButtonText`},legend:{boxSizing:"border-box",color:"inherit",display:"table",maxWidth:"100%",padding:0,whiteSpace:"normal"},progress:{display:"inline-block",verticalAlign:"baseline"},textarea:{overflow:"auto"},"[type=checkbox], [type=radio]":{boxSizing:"border-box",padding:0},"[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button":{height:"auto"},"[type=search]":{appearance:"none"},"[type=search]::-webkit-search-cancel-button, [type=search]::-webkit-search-decoration":{appearance:"none"},"::-webkit-file-upload-button":{appearance:"button",font:"inherit"},"details, menu":{display:"block"},summary:{display:"list-item"},canvas:{display:"inline-block"},template:{display:"none"}};function jr(){return A.createElement(B,{styles:Ar})}var Er=Object.defineProperty,he=Object.getOwnPropertySymbols,Nr=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable,Se=(e,t,r)=>t in e?Er(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,O=(e,t)=>{for(var r in t||(t={}))Nr.call(t,r)&&Se(e,r,t[r]);if(he)for(var r of he(t))$r.call(t,r)&&Se(e,r,t[r]);return e};const D=p.createContext({theme:te});function He(){var e;return((e=p.useContext(D))==null?void 0:e.theme)||te}function pn(e){const t=He(),r=o=>{var a,n,s,i;return{styles:((a=t.components[o])==null?void 0:a.styles)||{},classNames:((n=t.components[o])==null?void 0:n.classNames)||{},variants:(s=t.components[o])==null?void 0:s.variants,sizes:(i=t.components[o])==null?void 0:i.sizes}};return Array.isArray(e)?e.map(r):[r(e)]}function mn(){var e;return(e=p.useContext(D))==null?void 0:e.emotionCache}function gn(e,t,r){var o;const a=He(),n=(o=a.components[e])==null?void 0:o.defaultProps,s=typeof n=="function"?n(a):n;return O(O(O({},t),s),Pr(r))}function Tr({theme:e,emotionCache:t,withNormalizeCSS:r=!1,withGlobalStyles:o=!1,withCSSVariables:a=!1,inherit:n=!1,children:s}){const i=p.useContext(D),l=wr(te,n?O(O({},i.theme),e):e);return A.createElement(Xe,{theme:l},A.createElement(D.Provider,{value:{theme:l,emotionCache:t}},r&&A.createElement(jr,null),o&&A.createElement(yr,{theme:l}),a&&A.createElement(vr,{theme:l}),typeof l.globalStyles=="function"&&A.createElement(B,{styles:l.globalStyles(l)}),s))}Tr.displayName="@mantine/core/MantineProvider";export{on as A,Yr as B,Te as C,Gr as D,at as E,Ur as F,Vr as G,Zr as H,L as I,Fr as J,Hr as K,Wr as L,Dr as M,Mr as N,nn as O,G as P,Or as Q,zr as R,Rr as S,Qe as T,sn as U,cn as V,dn as W,Tr as X,M as a,ct as b,an as c,ne as d,un as e,mn as f,He as g,pn as h,Pr as i,W as j,Le as k,gn as l,fn as m,P as n,tn as o,rn as p,Br as q,E as r,Qr as s,en as t,ln as u,qr as v,Lr as w,Xr as x,Jr as y,Kr as z}; diff --git a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-aff3d007.js b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-aff3d007.js deleted file mode 100644 index 4328f785e1..0000000000 --- a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-aff3d007.js +++ /dev/null @@ -1,302 +0,0 @@ -import{v as g,gk as Ke,s as x,L as Ba,gl as Ea,ae as ca,ah as c,gm as b,gn as Da,go as t,gp as Ra,gq as h,gr as ba,gs as ja,gt as Ha,a_ as Wa,gu as La,Z as Va,gv as qa,gw as Oa,gx as Na,gy as Ga,aW as Ua}from"./index-9e78a66d.js";import{e as n,o as Sr,h as Ya,i as Ka,j as Xa,k as Za,n as Ja,p as Qa,l as et,s as rt,q as at,t as tt,v as ot,w as nt,M as it}from"./MantineProvider-48183abc.js";var va=String.raw,ua=va` - :root, - :host { - --chakra-vh: 100vh; - } - - @supports (height: -webkit-fill-available) { - :root, - :host { - --chakra-vh: -webkit-fill-available; - } - } - - @supports (height: -moz-fill-available) { - :root, - :host { - --chakra-vh: -moz-fill-available; - } - } - - @supports (height: 100dvh) { - :root, - :host { - --chakra-vh: 100dvh; - } - } -`,lt=()=>g.jsx(Ke,{styles:ua}),st=({scope:e=""})=>g.jsx(Ke,{styles:va` - html { - line-height: 1.5; - -webkit-text-size-adjust: 100%; - font-family: system-ui, sans-serif; - -webkit-font-smoothing: antialiased; - text-rendering: optimizeLegibility; - -moz-osx-font-smoothing: grayscale; - touch-action: manipulation; - } - - body { - position: relative; - min-height: 100%; - margin: 0; - font-feature-settings: "kern"; - } - - ${e} :where(*, *::before, *::after) { - border-width: 0; - border-style: solid; - box-sizing: border-box; - word-wrap: break-word; - } - - main { - display: block; - } - - ${e} hr { - border-top-width: 1px; - box-sizing: content-box; - height: 0; - overflow: visible; - } - - ${e} :where(pre, code, kbd,samp) { - font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; - font-size: 1em; - } - - ${e} a { - background-color: transparent; - color: inherit; - text-decoration: inherit; - } - - ${e} abbr[title] { - border-bottom: none; - text-decoration: underline; - -webkit-text-decoration: underline dotted; - text-decoration: underline dotted; - } - - ${e} :where(b, strong) { - font-weight: bold; - } - - ${e} small { - font-size: 80%; - } - - ${e} :where(sub,sup) { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; - } - - ${e} sub { - bottom: -0.25em; - } - - ${e} sup { - top: -0.5em; - } - - ${e} img { - border-style: none; - } - - ${e} :where(button, input, optgroup, select, textarea) { - font-family: inherit; - font-size: 100%; - line-height: 1.15; - margin: 0; - } - - ${e} :where(button, input) { - overflow: visible; - } - - ${e} :where(button, select) { - text-transform: none; - } - - ${e} :where( - button::-moz-focus-inner, - [type="button"]::-moz-focus-inner, - [type="reset"]::-moz-focus-inner, - [type="submit"]::-moz-focus-inner - ) { - border-style: none; - padding: 0; - } - - ${e} fieldset { - padding: 0.35em 0.75em 0.625em; - } - - ${e} legend { - box-sizing: border-box; - color: inherit; - display: table; - max-width: 100%; - padding: 0; - white-space: normal; - } - - ${e} progress { - vertical-align: baseline; - } - - ${e} textarea { - overflow: auto; - } - - ${e} :where([type="checkbox"], [type="radio"]) { - box-sizing: border-box; - padding: 0; - } - - ${e} input[type="number"]::-webkit-inner-spin-button, - ${e} input[type="number"]::-webkit-outer-spin-button { - -webkit-appearance: none !important; - } - - ${e} input[type="number"] { - -moz-appearance: textfield; - } - - ${e} input[type="search"] { - -webkit-appearance: textfield; - outline-offset: -2px; - } - - ${e} input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none !important; - } - - ${e} ::-webkit-file-upload-button { - -webkit-appearance: button; - font: inherit; - } - - ${e} details { - display: block; - } - - ${e} summary { - display: list-item; - } - - template { - display: none; - } - - [hidden] { - display: none !important; - } - - ${e} :where( - blockquote, - dl, - dd, - h1, - h2, - h3, - h4, - h5, - h6, - hr, - figure, - p, - pre - ) { - margin: 0; - } - - ${e} button { - background: transparent; - padding: 0; - } - - ${e} fieldset { - margin: 0; - padding: 0; - } - - ${e} :where(ol, ul) { - margin: 0; - padding: 0; - } - - ${e} textarea { - resize: vertical; - } - - ${e} :where(button, [role="button"]) { - cursor: pointer; - } - - ${e} button::-moz-focus-inner { - border: 0 !important; - } - - ${e} table { - border-collapse: collapse; - } - - ${e} :where(h1, h2, h3, h4, h5, h6) { - font-size: inherit; - font-weight: inherit; - } - - ${e} :where(button, input, optgroup, select, textarea) { - padding: 0; - line-height: inherit; - color: inherit; - } - - ${e} :where(img, svg, video, canvas, audio, iframe, embed, object) { - display: block; - } - - ${e} :where(img, video) { - max-width: 100%; - height: auto; - } - - [data-js-focus-visible] - :focus:not([data-focus-visible-added]):not( - [data-focus-visible-disabled] - ) { - outline: none; - box-shadow: none; - } - - ${e} select::-ms-expand { - display: none; - } - - ${ua} - `}),_e={light:"chakra-ui-light",dark:"chakra-ui-dark"};function dt(e={}){const{preventTransition:r=!0}=e,a={setDataset:o=>{const i=r?a.preventTransition():void 0;document.documentElement.dataset.theme=o,document.documentElement.style.colorScheme=o,i==null||i()},setClassName(o){document.body.classList.add(o?_e.dark:_e.light),document.body.classList.remove(o?_e.light:_e.dark)},query(){return window.matchMedia("(prefers-color-scheme: dark)")},getSystemTheme(o){var i;return((i=a.query().matches)!=null?i:o==="dark")?"dark":"light"},addListener(o){const i=a.query(),l=s=>{o(s.matches?"dark":"light")};return typeof i.addListener=="function"?i.addListener(l):i.addEventListener("change",l),()=>{typeof i.removeListener=="function"?i.removeListener(l):i.removeEventListener("change",l)}},preventTransition(){const o=document.createElement("style");return o.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(o),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.head.removeChild(o)})})}}};return a}var ct="chakra-ui-color-mode";function fa(e){return{ssr:!1,type:"localStorage",get(r){if(!(globalThis!=null&&globalThis.document))return r;let a;try{a=localStorage.getItem(e)||r}catch{}return a||r},set(r){try{localStorage.setItem(e,r)}catch{}}}}var bt=fa(ct),Cr=()=>{};function Ar(e,r){return e.type==="cookie"&&e.ssr?e.get(r):r}function ma(e){const{value:r,children:a,options:{useSystemColorMode:o,initialColorMode:i,disableTransitionOnChange:l}={},colorModeManager:s=bt}=e,d=i==="dark"?"dark":"light",[v,$]=x.useState(()=>Ar(s,d)),[p,S]=x.useState(()=>Ar(s)),{getSystemTheme:T,setClassName:V,setDataset:Qe,addListener:wr}=x.useMemo(()=>dt({preventTransition:l}),[l]),$e=i==="system"&&!v?p:v,F=x.useCallback(te=>{const ke=te==="system"?T():te;$(ke),V(ke==="dark"),Qe(ke),s.set(ke)},[s,T,V,Qe]);Ba(()=>{i==="system"&&S(T())},[]),x.useEffect(()=>{const te=s.get();if(te){F(te);return}if(i==="system"){F("system");return}F(d)},[s,d,i,F]);const zr=x.useCallback(()=>{F($e==="dark"?"light":"dark")},[$e,F]);x.useEffect(()=>{if(o)return wr(F)},[o,wr,F]);const Ma=x.useMemo(()=>({colorMode:r??$e,toggleColorMode:r?Cr:zr,setColorMode:r?Cr:F,forced:r!==void 0}),[$e,zr,F,r]);return g.jsx(Ea.Provider,{value:Ma,children:a})}ma.displayName="ColorModeProvider";var vt=["borders","breakpoints","colors","components","config","direction","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","shadows","sizes","space","styles","transition","zIndices"];function ut(e){return ca(e)?vt.every(r=>Object.prototype.hasOwnProperty.call(e,r)):!1}var ft={common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, transform",colors:"background-color, border-color, color, fill, stroke",dimensions:"width, height",position:"left, right, top, bottom",background:"background-color, background-image, background-position"},mt={"ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},ht={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},gt={property:ft,easing:mt,duration:ht},yt=gt,pt={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e3,sticky:1100,banner:1200,overlay:1300,modal:1400,popover:1500,skipLink:1600,toast:1700,tooltip:1800},St=pt,xt={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},$t=xt,kt={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},_t=kt,wt={transparent:"transparent",current:"currentColor",black:"#000000",white:"#FFFFFF",whiteAlpha:{50:"rgba(255, 255, 255, 0.04)",100:"rgba(255, 255, 255, 0.06)",200:"rgba(255, 255, 255, 0.08)",300:"rgba(255, 255, 255, 0.16)",400:"rgba(255, 255, 255, 0.24)",500:"rgba(255, 255, 255, 0.36)",600:"rgba(255, 255, 255, 0.48)",700:"rgba(255, 255, 255, 0.64)",800:"rgba(255, 255, 255, 0.80)",900:"rgba(255, 255, 255, 0.92)"},blackAlpha:{50:"rgba(0, 0, 0, 0.04)",100:"rgba(0, 0, 0, 0.06)",200:"rgba(0, 0, 0, 0.08)",300:"rgba(0, 0, 0, 0.16)",400:"rgba(0, 0, 0, 0.24)",500:"rgba(0, 0, 0, 0.36)",600:"rgba(0, 0, 0, 0.48)",700:"rgba(0, 0, 0, 0.64)",800:"rgba(0, 0, 0, 0.80)",900:"rgba(0, 0, 0, 0.92)"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923"},red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#ebf8ff",100:"#bee3f8",200:"#90cdf4",300:"#63b3ed",400:"#4299e1",500:"#3182ce",600:"#2b6cb0",700:"#2c5282",800:"#2a4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},linkedin:{50:"#E8F4F9",100:"#CFEDFB",200:"#9BDAF3",300:"#68C7EC",400:"#34B3E4",500:"#00A0DC",600:"#008CC9",700:"#0077B5",800:"#005E93",900:"#004471"},facebook:{50:"#E8F4F9",100:"#D9DEE9",200:"#B7C2DA",300:"#6482C0",400:"#4267B2",500:"#385898",600:"#314E89",700:"#29487D",800:"#223B67",900:"#1E355B"},messenger:{50:"#D0E6FF",100:"#B9DAFF",200:"#A2CDFF",300:"#7AB8FF",400:"#2E90FF",500:"#0078FF",600:"#0063D1",700:"#0052AC",800:"#003C7E",900:"#002C5C"},whatsapp:{50:"#dffeec",100:"#b9f5d0",200:"#90edb3",300:"#65e495",400:"#3cdd78",500:"#22c35e",600:"#179848",700:"#0c6c33",800:"#01421c",900:"#001803"},twitter:{50:"#E5F4FD",100:"#C8E9FB",200:"#A8DCFA",300:"#83CDF7",400:"#57BBF5",500:"#1DA1F2",600:"#1A94DA",700:"#1681BF",800:"#136B9E",900:"#0D4D71"},telegram:{50:"#E3F2F9",100:"#C5E4F3",200:"#A2D4EC",300:"#7AC1E4",400:"#47A9DA",500:"#0088CC",600:"#007AB8",700:"#006BA1",800:"#005885",900:"#003F5E"}},zt=wt,Ct={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},At=Ct,Pt={xs:"0 0 0 1px rgba(0, 0, 0, 0.05)",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"0 0 0 3px rgba(66, 153, 225, 0.6)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)",none:"none","dark-lg":"rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px"},Tt=Pt,Ft={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},It=Ft,Mt={letterSpacings:{tighter:"-0.05em",tight:"-0.025em",normal:"0",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeights:{normal:"normal",none:1,shorter:1.25,short:1.375,base:1.5,tall:1.625,taller:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},fontWeights:{hairline:100,thin:200,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800,black:900},fonts:{heading:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'},fontSizes:{"3xs":"0.45rem","2xs":"0.625rem",xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"}},ha=Mt,ga={px:"1px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},Bt={max:"max-content",min:"min-content",full:"100%","3xs":"14rem","2xs":"16rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem","8xl":"90rem",prose:"60ch"},Et={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},Dt={...ga,...Bt,container:Et},ya=Dt,Rt={breakpoints:_t,zIndices:St,radii:At,blur:It,colors:zt,...ha,sizes:ya,shadows:Tt,space:ga,borders:$t,transition:yt},{defineMultiStyleConfig:jt,definePartsStyle:le}=b(["stepper","step","title","description","indicator","separator","icon","number"]),B=c("stepper-indicator-size"),K=c("stepper-icon-size"),X=c("stepper-title-font-size"),se=c("stepper-description-font-size"),oe=c("stepper-accent-color"),Ht=le(({colorScheme:e})=>({stepper:{display:"flex",justifyContent:"space-between",gap:"4","&[data-orientation=vertical]":{flexDirection:"column",alignItems:"flex-start"},"&[data-orientation=horizontal]":{flexDirection:"row",alignItems:"center"},[oe.variable]:`colors.${e}.500`,_dark:{[oe.variable]:`colors.${e}.200`}},title:{fontSize:X.reference,fontWeight:"medium"},description:{fontSize:se.reference,color:"chakra-subtle-text"},number:{fontSize:X.reference},step:{flexShrink:0,position:"relative",display:"flex",gap:"2","&[data-orientation=horizontal]":{alignItems:"center"},flex:"1","&:last-of-type:not([data-stretch])":{flex:"initial"}},icon:{flexShrink:0,width:K.reference,height:K.reference},indicator:{flexShrink:0,borderRadius:"full",width:B.reference,height:B.reference,display:"flex",justifyContent:"center",alignItems:"center","&[data-status=active]":{borderWidth:"2px",borderColor:oe.reference},"&[data-status=complete]":{bg:oe.reference,color:"chakra-inverse-text"},"&[data-status=incomplete]":{borderWidth:"2px"}},separator:{bg:"chakra-border-color",flex:"1","&[data-status=complete]":{bg:oe.reference},"&[data-orientation=horizontal]":{width:"100%",height:"2px",marginStart:"2"},"&[data-orientation=vertical]":{width:"2px",position:"absolute",height:"100%",maxHeight:`calc(100% - ${B.reference} - 8px)`,top:`calc(${B.reference} + 4px)`,insetStart:`calc(${B.reference} / 2 - 1px)`}}})),Wt=jt({baseStyle:Ht,sizes:{xs:le({stepper:{[B.variable]:"sizes.4",[K.variable]:"sizes.3",[X.variable]:"fontSizes.xs",[se.variable]:"fontSizes.xs"}}),sm:le({stepper:{[B.variable]:"sizes.6",[K.variable]:"sizes.4",[X.variable]:"fontSizes.sm",[se.variable]:"fontSizes.xs"}}),md:le({stepper:{[B.variable]:"sizes.8",[K.variable]:"sizes.5",[X.variable]:"fontSizes.md",[se.variable]:"fontSizes.sm"}}),lg:le({stepper:{[B.variable]:"sizes.10",[K.variable]:"sizes.6",[X.variable]:"fontSizes.lg",[se.variable]:"fontSizes.md"}})},defaultProps:{size:"md",colorScheme:"blue"}});function f(e,r={}){let a=!1;function o(){if(!a){a=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function i(...p){o();for(const S of p)r[S]=v(S);return f(e,r)}function l(...p){for(const S of p)S in r||(r[S]=v(S));return f(e,r)}function s(){return Object.fromEntries(Object.entries(r).map(([S,T])=>[S,T.selector]))}function d(){return Object.fromEntries(Object.entries(r).map(([S,T])=>[S,T.className]))}function v(p){const V=`chakra-${(["container","root"].includes(p??"")?[e]:[e,p]).filter(Boolean).join("__")}`;return{className:V,selector:`.${V}`,toString:()=>p}}return{parts:i,toPart:v,extend:l,selectors:s,classnames:d,get keys(){return Object.keys(r)},__type:{}}}var Lt=f("accordion").parts("root","container","button","panel").extend("icon"),Vt=f("alert").parts("title","description","container").extend("icon","spinner"),qt=f("avatar").parts("label","badge","container").extend("excessLabel","group"),Ot=f("breadcrumb").parts("link","item","container").extend("separator");f("button").parts();var Nt=f("checkbox").parts("control","icon","container").extend("label");f("progress").parts("track","filledTrack").extend("label");var Gt=f("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),Ut=f("editable").parts("preview","input","textarea"),Yt=f("form").parts("container","requiredIndicator","helperText"),Kt=f("formError").parts("text","icon"),Xt=f("input").parts("addon","field","element"),Zt=f("list").parts("container","item","icon"),Jt=f("menu").parts("button","list","item").extend("groupTitle","command","divider"),Qt=f("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),eo=f("numberinput").parts("root","field","stepperGroup","stepper");f("pininput").parts("field");var ro=f("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),ao=f("progress").parts("label","filledTrack","track"),to=f("radio").parts("container","control","label"),oo=f("select").parts("field","icon"),no=f("slider").parts("container","track","thumb","filledTrack","mark"),io=f("stat").parts("container","label","helpText","number","icon"),lo=f("switch").parts("container","track","thumb"),so=f("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),co=f("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),bo=f("tag").parts("container","label","closeButton"),vo=f("card").parts("container","header","body","footer");function O(e,r,a){return Math.min(Math.max(e,a),r)}class uo extends Error{constructor(r){super(`Failed to parse color: "${r}"`)}}var de=uo;function xr(e){if(typeof e!="string")throw new de(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let r=e.trim();r=xo.test(e)?ho(e):e;const a=go.exec(r);if(a){const s=Array.from(a).slice(1);return[...s.slice(0,3).map(d=>parseInt(ge(d,2),16)),parseInt(ge(s[3]||"f",2),16)/255]}const o=yo.exec(r);if(o){const s=Array.from(o).slice(1);return[...s.slice(0,3).map(d=>parseInt(d,16)),parseInt(s[3]||"ff",16)/255]}const i=po.exec(r);if(i){const s=Array.from(i).slice(1);return[...s.slice(0,3).map(d=>parseInt(d,10)),parseFloat(s[3]||"1")]}const l=So.exec(r);if(l){const[s,d,v,$]=Array.from(l).slice(1).map(parseFloat);if(O(0,100,d)!==d)throw new de(e);if(O(0,100,v)!==v)throw new de(e);return[...$o(s,d,v),Number.isNaN($)?1:$]}throw new de(e)}function fo(e){let r=5381,a=e.length;for(;a;)r=r*33^e.charCodeAt(--a);return(r>>>0)%2341}const Pr=e=>parseInt(e.replace(/_/g,""),36),mo="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,r)=>{const a=Pr(r.substring(0,3)),o=Pr(r.substring(3)).toString(16);let i="";for(let l=0;l<6-o.length;l++)i+="0";return e[a]=`${i}${o}`,e},{});function ho(e){const r=e.toLowerCase().trim(),a=mo[fo(r)];if(!a)throw new de(e);return`#${a}`}const ge=(e,r)=>Array.from(Array(r)).map(()=>e).join(""),go=new RegExp(`^#${ge("([a-f0-9])",3)}([a-f0-9])?$`,"i"),yo=new RegExp(`^#${ge("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),po=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${ge(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),So=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,xo=/^[a-z]+$/i,Tr=e=>Math.round(e*255),$o=(e,r,a)=>{let o=a/100;if(r===0)return[o,o,o].map(Tr);const i=(e%360+360)%360/60,l=(1-Math.abs(2*o-1))*(r/100),s=l*(1-Math.abs(i%2-1));let d=0,v=0,$=0;i>=0&&i<1?(d=l,v=s):i>=1&&i<2?(d=s,v=l):i>=2&&i<3?(v=l,$=s):i>=3&&i<4?(v=s,$=l):i>=4&&i<5?(d=s,$=l):i>=5&&i<6&&(d=l,$=s);const p=o-l/2,S=d+p,T=v+p,V=$+p;return[S,T,V].map(Tr)};function ko(e,r,a,o){return`rgba(${O(0,255,e).toFixed()}, ${O(0,255,r).toFixed()}, ${O(0,255,a).toFixed()}, ${parseFloat(O(0,1,o).toFixed(3))})`}function _o(e,r){const[a,o,i,l]=xr(e);return ko(a,o,i,l-r)}function wo(e){const[r,a,o,i]=xr(e);let l=s=>{const d=O(0,255,s).toString(16);return d.length===1?`0${d}`:d};return`#${l(r)}${l(a)}${l(o)}${i<1?l(Math.round(i*255)):""}`}function zo(e,r,a,o,i){for(r=r.split?r.split("."):r,o=0;oObject.keys(e).length===0,Ne=(e,r,a)=>{const o=zo(e,`colors.${r}`,r);try{return wo(o),o}catch{return a??"#000000"}},P=(e,r,a)=>{var o;return(o=Da(e,"colors",r))!=null?o:a},Ao=e=>{const[r,a,o]=xr(e);return(r*299+a*587+o*114)/1e3},Po=e=>r=>{const a=Ne(r,e);return Ao(a)<128?"dark":"light"},To=e=>r=>Po(e)(r)==="dark",re=(e,r)=>a=>{const o=Ne(a,e);return _o(o,1-r)};function Fr(e="1rem",r="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( - 45deg, - ${r} 25%, - transparent 25%, - transparent 50%, - ${r} 50%, - ${r} 75%, - transparent 75%, - transparent - )`,backgroundSize:`${e} ${e}`}}var Fo=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function Io(e){const r=Fo();return!e||Co(e)?r:e.string&&e.colors?Bo(e.string,e.colors):e.string&&!e.colors?Mo(e.string):e.colors&&!e.string?Eo(e.colors):r}function Mo(e){let r=0;if(e.length===0)return r.toString();for(let o=0;o>o*8&255;a+=`00${i.toString(16)}`.substr(-2)}return a}function Bo(e,r){let a=0;if(e.length===0)return r[0];for(let o=0;or.map(pa).join(` ${e} `).replace(/calc/g,""),Ir=(...e)=>`calc(${Xe("+",...e)})`,Mr=(...e)=>`calc(${Xe("-",...e)})`,hr=(...e)=>`calc(${Xe("*",...e)})`,Br=(...e)=>`calc(${Xe("/",...e)})`,Er=e=>{const r=pa(e);return r!=null&&!Number.isNaN(parseFloat(r))?String(r).startsWith("-")?String(r).slice(1):`-${r}`:hr(r,-1)},E=Object.assign(e=>({add:(...r)=>E(Ir(e,...r)),subtract:(...r)=>E(Mr(e,...r)),multiply:(...r)=>E(hr(e,...r)),divide:(...r)=>E(Br(e,...r)),negate:()=>E(Er(e)),toString:()=>e.toString()}),{add:Ir,subtract:Mr,multiply:hr,divide:Br,negate:Er});function Do(e){return!Number.isInteger(parseFloat(e.toString()))}function Ro(e,r="-"){return e.replace(/\s+/g,r)}function Sa(e){const r=Ro(e.toString());return r.includes("\\.")?e:Do(e)?r.replace(".","\\."):e}function jo(e,r=""){return[r,Sa(e)].filter(Boolean).join("-")}function Ho(e,r){return`var(${Sa(e)}${r?`, ${r}`:""})`}function Wo(e,r=""){return`--${jo(e,r)}`}function m(e,r){const a=Wo(e,r==null?void 0:r.prefix);return{variable:a,reference:Ho(a,Lo(r==null?void 0:r.fallback))}}function Lo(e){return typeof e=="string"?e:e==null?void 0:e.reference}var{defineMultiStyleConfig:Vo,definePartsStyle:Re}=b(lo.keys),ve=m("switch-track-width"),N=m("switch-track-height"),er=m("switch-track-diff"),qo=E.subtract(ve,N),gr=m("switch-thumb-x"),ne=m("switch-bg"),Oo=t(e=>{const{colorScheme:r}=e;return{borderRadius:"full",p:"0.5",width:[ve.reference],height:[N.reference],transitionProperty:"common",transitionDuration:"fast",[ne.variable]:"colors.gray.300",_dark:{[ne.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[ne.variable]:`colors.${r}.500`,_dark:{[ne.variable]:`colors.${r}.200`}},bg:ne.reference}}),No=t({bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[N.reference],height:[N.reference],_checked:{transform:`translateX(${gr.reference})`}}),Go=Re(e=>({container:{[er.variable]:qo,[gr.variable]:er.reference,_rtl:{[gr.variable]:E(er).negate().toString()}},track:Oo(e),thumb:No})),Uo={sm:Re({container:{[ve.variable]:"1.375rem",[N.variable]:"sizes.3"}}),md:Re({container:{[ve.variable]:"1.875rem",[N.variable]:"sizes.4"}}),lg:Re({container:{[ve.variable]:"2.875rem",[N.variable]:"sizes.6"}})},Yo=Vo({baseStyle:Go,sizes:Uo,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:Ko,definePartsStyle:Z}=b(so.keys),Xo=Z({table:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full"},th:{fontFamily:"heading",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"wider",textAlign:"start"},td:{textAlign:"start"},caption:{mt:4,fontFamily:"heading",textAlign:"center",fontWeight:"medium"}}),Ge=t({"&[data-is-numeric=true]":{textAlign:"end"}}),Zo=Z(e=>{const{colorScheme:r}=e;return{th:{color:n("gray.600","gray.400")(e),borderBottom:"1px",borderColor:n(`${r}.100`,`${r}.700`)(e),...Ge},td:{borderBottom:"1px",borderColor:n(`${r}.100`,`${r}.700`)(e),...Ge},caption:{color:n("gray.600","gray.100")(e)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),Jo=Z(e=>{const{colorScheme:r}=e;return{th:{color:n("gray.600","gray.400")(e),borderBottom:"1px",borderColor:n(`${r}.100`,`${r}.700`)(e),...Ge},td:{borderBottom:"1px",borderColor:n(`${r}.100`,`${r}.700`)(e),...Ge},caption:{color:n("gray.600","gray.100")(e)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:n(`${r}.100`,`${r}.700`)(e)},td:{background:n(`${r}.100`,`${r}.700`)(e)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),Qo={simple:Zo,striped:Jo,unstyled:t({})},en={sm:Z({th:{px:"4",py:"1",lineHeight:"4",fontSize:"xs"},td:{px:"4",py:"2",fontSize:"sm",lineHeight:"4"},caption:{px:"4",py:"2",fontSize:"xs"}}),md:Z({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:Z({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},rn=Ko({baseStyle:Xo,variants:Qo,sizes:en,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),_=c("tabs-color"),A=c("tabs-bg"),we=c("tabs-border-color"),{defineMultiStyleConfig:an,definePartsStyle:M}=b(co.keys),tn=t(e=>{const{orientation:r}=e;return{display:r==="vertical"?"flex":"block"}}),on=t(e=>{const{isFitted:r}=e;return{flex:r?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}}),nn=t(e=>{const{align:r="start",orientation:a}=e;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[r],flexDirection:a==="vertical"?"column":"row"}}),ln=t({p:4}),sn=M(e=>({root:tn(e),tab:on(e),tablist:nn(e),tabpanel:ln})),dn={sm:M({tab:{py:1,px:4,fontSize:"sm"}}),md:M({tab:{fontSize:"md",py:2,px:4}}),lg:M({tab:{fontSize:"lg",py:3,px:4}})},cn=M(e=>{const{colorScheme:r,orientation:a}=e,o=a==="vertical",i=o?"borderStart":"borderBottom",l=o?"marginStart":"marginBottom";return{tablist:{[i]:"2px solid",borderColor:"inherit"},tab:{[i]:"2px solid",borderColor:"transparent",[l]:"-2px",_selected:{[_.variable]:`colors.${r}.600`,_dark:{[_.variable]:`colors.${r}.300`},borderColor:"currentColor"},_active:{[A.variable]:"colors.gray.200",_dark:{[A.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:_.reference,bg:A.reference}}}),bn=M(e=>{const{colorScheme:r}=e;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[we.variable]:"transparent",_selected:{[_.variable]:`colors.${r}.600`,[we.variable]:"colors.white",_dark:{[_.variable]:`colors.${r}.300`,[we.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:we.reference},color:_.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),vn=M(e=>{const{colorScheme:r}=e;return{tab:{border:"1px solid",borderColor:"inherit",[A.variable]:"colors.gray.50",_dark:{[A.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[A.variable]:"colors.white",[_.variable]:`colors.${r}.600`,_dark:{[A.variable]:"colors.gray.800",[_.variable]:`colors.${r}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:_.reference,bg:A.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),un=M(e=>{const{colorScheme:r,theme:a}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:Ne(a,`${r}.700`),bg:Ne(a,`${r}.100`)}}}}),fn=M(e=>{const{colorScheme:r}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",[_.variable]:"colors.gray.600",_dark:{[_.variable]:"inherit"},_selected:{[_.variable]:"colors.white",[A.variable]:`colors.${r}.600`,_dark:{[_.variable]:"colors.gray.800",[A.variable]:`colors.${r}.300`}},color:_.reference,bg:A.reference}}}),mn=M({}),hn={line:cn,enclosed:bn,"enclosed-colored":vn,"soft-rounded":un,"solid-rounded":fn,unstyled:mn},gn=an({baseStyle:sn,sizes:dn,variants:hn,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),y=Ra("badge",["bg","color","shadow"]),yn=t({px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold",bg:y.bg.reference,color:y.color.reference,boxShadow:y.shadow.reference}),pn=t(e=>{const{colorScheme:r,theme:a}=e,o=re(`${r}.500`,.6)(a);return{[y.bg.variable]:`colors.${r}.500`,[y.color.variable]:"colors.white",_dark:{[y.bg.variable]:o,[y.color.variable]:"colors.whiteAlpha.800"}}}),Sn=t(e=>{const{colorScheme:r,theme:a}=e,o=re(`${r}.200`,.16)(a);return{[y.bg.variable]:`colors.${r}.100`,[y.color.variable]:`colors.${r}.800`,_dark:{[y.bg.variable]:o,[y.color.variable]:`colors.${r}.200`}}}),xn=t(e=>{const{colorScheme:r,theme:a}=e,o=re(`${r}.200`,.8)(a);return{[y.color.variable]:`colors.${r}.500`,_dark:{[y.color.variable]:o},[y.shadow.variable]:`inset 0 0 0px 1px ${y.color.reference}`}}),$n={solid:pn,subtle:Sn,outline:xn},ue=h({baseStyle:yn,variants:$n,defaultProps:{variant:"subtle",colorScheme:"gray"}}),{defineMultiStyleConfig:kn,definePartsStyle:G}=b(bo.keys),Dr=c("tag-bg"),Rr=c("tag-color"),rr=c("tag-shadow"),je=c("tag-min-height"),He=c("tag-min-width"),We=c("tag-font-size"),Le=c("tag-padding-inline"),_n=t({fontWeight:"medium",lineHeight:1.2,outline:0,[Rr.variable]:y.color.reference,[Dr.variable]:y.bg.reference,[rr.variable]:y.shadow.reference,color:Rr.reference,bg:Dr.reference,boxShadow:rr.reference,borderRadius:"md",minH:je.reference,minW:He.reference,fontSize:We.reference,px:Le.reference,_focusVisible:{[rr.variable]:"shadows.outline"}}),wn=t({lineHeight:1.2,overflow:"visible"}),zn=t({fontSize:"lg",w:"5",h:"5",transitionProperty:"common",transitionDuration:"normal",borderRadius:"full",marginStart:"1.5",marginEnd:"-1",opacity:.5,_disabled:{opacity:.4},_focusVisible:{boxShadow:"outline",bg:"rgba(0, 0, 0, 0.14)"},_hover:{opacity:.8},_active:{opacity:1}}),Cn=G({container:_n,label:wn,closeButton:zn}),An={sm:G({container:{[je.variable]:"sizes.5",[He.variable]:"sizes.5",[We.variable]:"fontSizes.xs",[Le.variable]:"space.2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:G({container:{[je.variable]:"sizes.6",[He.variable]:"sizes.6",[We.variable]:"fontSizes.sm",[Le.variable]:"space.2"}}),lg:G({container:{[je.variable]:"sizes.8",[He.variable]:"sizes.8",[We.variable]:"fontSizes.md",[Le.variable]:"space.3"}})},Pn={subtle:G(e=>{var r;return{container:(r=ue.variants)==null?void 0:r.subtle(e)}}),solid:G(e=>{var r;return{container:(r=ue.variants)==null?void 0:r.solid(e)}}),outline:G(e=>{var r;return{container:(r=ue.variants)==null?void 0:r.outline(e)}})},Tn=kn({variants:Pn,baseStyle:Cn,sizes:An,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:D,defineMultiStyleConfig:Fn}=b(Xt.keys),In=D({field:{width:"100%",minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),H={lg:t({fontSize:"lg",px:"4",h:"12",borderRadius:"md"}),md:t({fontSize:"md",px:"4",h:"10",borderRadius:"md"}),sm:t({fontSize:"sm",px:"3",h:"8",borderRadius:"sm"}),xs:t({fontSize:"xs",px:"2",h:"6",borderRadius:"sm"})},Mn={lg:D({field:H.lg,addon:H.lg}),md:D({field:H.md,addon:H.md}),sm:D({field:H.sm,addon:H.sm}),xs:D({field:H.xs,addon:H.xs})};function $r(e){const{focusBorderColor:r,errorBorderColor:a}=e;return{focusBorderColor:r||n("blue.500","blue.300")(e),errorBorderColor:a||n("red.500","red.300")(e)}}var Bn=D(e=>{const{theme:r}=e,{focusBorderColor:a,errorBorderColor:o}=$r(e);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:n("gray.300","whiteAlpha.400")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:P(r,o),boxShadow:`0 0 0 1px ${P(r,o)}`},_focusVisible:{zIndex:1,borderColor:P(r,a),boxShadow:`0 0 0 1px ${P(r,a)}`}},addon:{border:"1px solid",borderColor:n("inherit","whiteAlpha.50")(e),bg:n("gray.100","whiteAlpha.300")(e)}}}),En=D(e=>{const{theme:r}=e,{focusBorderColor:a,errorBorderColor:o}=$r(e);return{field:{border:"2px solid",borderColor:"transparent",bg:n("gray.100","whiteAlpha.50")(e),_hover:{bg:n("gray.200","whiteAlpha.100")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:P(r,o)},_focusVisible:{bg:"transparent",borderColor:P(r,a)}},addon:{border:"2px solid",borderColor:"transparent",bg:n("gray.100","whiteAlpha.50")(e)}}}),Dn=D(e=>{const{theme:r}=e,{focusBorderColor:a,errorBorderColor:o}=$r(e);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:P(r,o),boxShadow:`0px 1px 0px 0px ${P(r,o)}`},_focusVisible:{borderColor:P(r,a),boxShadow:`0px 1px 0px 0px ${P(r,a)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),Rn=D({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),jn={outline:Bn,filled:En,flushed:Dn,unstyled:Rn},u=Fn({baseStyle:In,sizes:Mn,variants:jn,defaultProps:{size:"md",variant:"outline"}}),jr,Hn=t({...(jr=u.baseStyle)==null?void 0:jr.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"}),Hr,Wr,Wn={outline:t(e=>{var r,a;return(a=(r=u.variants)==null?void 0:r.outline(e).field)!=null?a:{}}),flushed:t(e=>{var r,a;return(a=(r=u.variants)==null?void 0:r.flushed(e).field)!=null?a:{}}),filled:t(e=>{var r,a;return(a=(r=u.variants)==null?void 0:r.filled(e).field)!=null?a:{}}),unstyled:(Wr=(Hr=u.variants)==null?void 0:Hr.unstyled.field)!=null?Wr:{}},Lr,Vr,qr,Or,Nr,Gr,Ur,Yr,Ln={xs:(Vr=(Lr=u.sizes)==null?void 0:Lr.xs.field)!=null?Vr:{},sm:(Or=(qr=u.sizes)==null?void 0:qr.sm.field)!=null?Or:{},md:(Gr=(Nr=u.sizes)==null?void 0:Nr.md.field)!=null?Gr:{},lg:(Yr=(Ur=u.sizes)==null?void 0:Ur.lg.field)!=null?Yr:{}},Vn=h({baseStyle:Hn,sizes:Ln,variants:Wn,defaultProps:{size:"md",variant:"outline"}}),ze=m("tooltip-bg"),ar=m("tooltip-fg"),qn=m("popper-arrow-bg"),On=t({bg:ze.reference,color:ar.reference,[ze.variable]:"colors.gray.700",[ar.variable]:"colors.whiteAlpha.900",_dark:{[ze.variable]:"colors.gray.300",[ar.variable]:"colors.gray.900"},[qn.variable]:ze.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"}),Nn=h({baseStyle:On}),{defineMultiStyleConfig:Gn,definePartsStyle:ce}=b(ao.keys),Un=t(e=>{const{colorScheme:r,theme:a,isIndeterminate:o,hasStripe:i}=e,l=n(Fr(),Fr("1rem","rgba(0,0,0,0.1)"))(e),s=n(`${r}.500`,`${r}.200`)(e),d=`linear-gradient( - to right, - transparent 0%, - ${P(a,s)} 50%, - transparent 100% - )`;return{...!o&&i&&l,...o?{bgImage:d}:{bgColor:s}}}),Yn=t({lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"}),Kn=t(e=>({bg:n("gray.100","whiteAlpha.300")(e)})),Xn=t(e=>({transitionProperty:"common",transitionDuration:"slow",...Un(e)})),Zn=ce(e=>({label:Yn,filledTrack:Xn(e),track:Kn(e)})),Jn={xs:ce({track:{h:"1"}}),sm:ce({track:{h:"2"}}),md:ce({track:{h:"3"}}),lg:ce({track:{h:"4"}})},Qn=Gn({sizes:Jn,baseStyle:Zn,defaultProps:{size:"md",colorScheme:"blue"}}),ei=e=>typeof e=="function";function k(e,...r){return ei(e)?e(...r):e}var{definePartsStyle:Ve,defineMultiStyleConfig:ri}=b(Nt.keys),fe=c("checkbox-size"),ai=t(e=>{const{colorScheme:r}=e;return{w:fe.reference,h:fe.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:n(`${r}.500`,`${r}.200`)(e),borderColor:n(`${r}.500`,`${r}.200`)(e),color:n("white","gray.900")(e),_hover:{bg:n(`${r}.600`,`${r}.300`)(e),borderColor:n(`${r}.600`,`${r}.300`)(e)},_disabled:{borderColor:n("gray.200","transparent")(e),bg:n("gray.200","whiteAlpha.300")(e),color:n("gray.500","whiteAlpha.500")(e)}},_indeterminate:{bg:n(`${r}.500`,`${r}.200`)(e),borderColor:n(`${r}.500`,`${r}.200`)(e),color:n("white","gray.900")(e)},_disabled:{bg:n("gray.100","whiteAlpha.100")(e),borderColor:n("gray.100","transparent")(e)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:n("red.500","red.300")(e)}}}),ti=t({_disabled:{cursor:"not-allowed"}}),oi=t({userSelect:"none",_disabled:{opacity:.4}}),ni=t({transitionProperty:"transform",transitionDuration:"normal"}),ii=Ve(e=>({icon:ni,container:ti,control:k(ai,e),label:oi})),li={sm:Ve({control:{[fe.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:Ve({control:{[fe.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:Ve({control:{[fe.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},Ue=ri({baseStyle:ii,sizes:li,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:si,definePartsStyle:qe}=b(to.keys),di=t(e=>{var r;const a=(r=k(Ue.baseStyle,e))==null?void 0:r.control;return{...a,borderRadius:"full",_checked:{...a==null?void 0:a._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}}),ci=qe(e=>{var r,a,o,i;return{label:(a=(r=Ue).baseStyle)==null?void 0:a.call(r,e).label,container:(i=(o=Ue).baseStyle)==null?void 0:i.call(o,e).container,control:di(e)}}),bi={md:qe({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:qe({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:qe({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},vi=si({baseStyle:ci,sizes:bi,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:ui,definePartsStyle:fi}=b(oo.keys),Ce=c("select-bg"),Kr,mi=t({...(Kr=u.baseStyle)==null?void 0:Kr.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:Ce.reference,[Ce.variable]:"colors.white",_dark:{[Ce.variable]:"colors.gray.700"},"> option, > optgroup":{bg:Ce.reference}}),hi=t({width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}}),gi=fi({field:mi,icon:hi}),Ae=t({paddingInlineEnd:"8"}),Xr,Zr,Jr,Qr,ea,ra,aa,ta,yi={lg:{...(Xr=u.sizes)==null?void 0:Xr.lg,field:{...(Zr=u.sizes)==null?void 0:Zr.lg.field,...Ae}},md:{...(Jr=u.sizes)==null?void 0:Jr.md,field:{...(Qr=u.sizes)==null?void 0:Qr.md.field,...Ae}},sm:{...(ea=u.sizes)==null?void 0:ea.sm,field:{...(ra=u.sizes)==null?void 0:ra.sm.field,...Ae}},xs:{...(aa=u.sizes)==null?void 0:aa.xs,field:{...(ta=u.sizes)==null?void 0:ta.xs.field,...Ae},icon:{insetEnd:"1"}}},pi=ui({baseStyle:gi,sizes:yi,variants:u.variants,defaultProps:u.defaultProps}),tr=c("skeleton-start-color"),or=c("skeleton-end-color"),Si=t({[tr.variable]:"colors.gray.100",[or.variable]:"colors.gray.400",_dark:{[tr.variable]:"colors.gray.800",[or.variable]:"colors.gray.600"},background:tr.reference,borderColor:or.reference,opacity:.7,borderRadius:"sm"}),xi=h({baseStyle:Si}),nr=c("skip-link-bg"),$i=t({borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[nr.variable]:"colors.white",_dark:{[nr.variable]:"colors.gray.700"},bg:nr.reference}}),ki=h({baseStyle:$i}),{defineMultiStyleConfig:_i,definePartsStyle:Ze}=b(no.keys),ye=c("slider-thumb-size"),pe=c("slider-track-size"),L=c("slider-bg"),wi=t(e=>{const{orientation:r}=e;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...Sr({orientation:r,vertical:{h:"100%"},horizontal:{w:"100%"}})}}),zi=t(e=>({...Sr({orientation:e.orientation,horizontal:{h:pe.reference},vertical:{w:pe.reference}}),overflow:"hidden",borderRadius:"sm",[L.variable]:"colors.gray.200",_dark:{[L.variable]:"colors.whiteAlpha.200"},_disabled:{[L.variable]:"colors.gray.300",_dark:{[L.variable]:"colors.whiteAlpha.300"}},bg:L.reference})),Ci=t(e=>{const{orientation:r}=e;return{...Sr({orientation:r,vertical:{left:"50%",transform:"translateX(-50%)",_active:{transform:"translateX(-50%) scale(1.15)"}},horizontal:{top:"50%",transform:"translateY(-50%)",_active:{transform:"translateY(-50%) scale(1.15)"}}}),w:ye.reference,h:ye.reference,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0,zIndex:1,borderRadius:"full",bg:"white",boxShadow:"base",border:"1px solid",borderColor:"transparent",transitionProperty:"transform",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{bg:"gray.300"}}}),Ai=t(e=>{const{colorScheme:r}=e;return{width:"inherit",height:"inherit",[L.variable]:`colors.${r}.500`,_dark:{[L.variable]:`colors.${r}.200`},bg:L.reference}}),Pi=Ze(e=>({container:wi(e),track:zi(e),thumb:Ci(e),filledTrack:Ai(e)})),Ti=Ze({container:{[ye.variable]:"sizes.4",[pe.variable]:"sizes.1"}}),Fi=Ze({container:{[ye.variable]:"sizes.3.5",[pe.variable]:"sizes.1"}}),Ii=Ze({container:{[ye.variable]:"sizes.2.5",[pe.variable]:"sizes.0.5"}}),Mi={lg:Ti,md:Fi,sm:Ii},Bi=_i({baseStyle:Pi,sizes:Mi,defaultProps:{size:"md",colorScheme:"blue"}}),q=m("spinner-size"),Ei=t({width:[q.reference],height:[q.reference]}),Di={xs:t({[q.variable]:"sizes.3"}),sm:t({[q.variable]:"sizes.4"}),md:t({[q.variable]:"sizes.6"}),lg:t({[q.variable]:"sizes.8"}),xl:t({[q.variable]:"sizes.12"})},Ri=h({baseStyle:Ei,sizes:Di,defaultProps:{size:"md"}}),{defineMultiStyleConfig:ji,definePartsStyle:xa}=b(io.keys),Hi=t({fontWeight:"medium"}),Wi=t({opacity:.8,marginBottom:"2"}),Li=t({verticalAlign:"baseline",fontWeight:"semibold"}),Vi=t({marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"}),qi=xa({container:{},label:Hi,helpText:Wi,number:Li,icon:Vi}),Oi={md:xa({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},Ni=ji({baseStyle:qi,sizes:Oi,defaultProps:{size:"md"}}),ir=c("kbd-bg"),Gi=t({[ir.variable]:"colors.gray.100",_dark:{[ir.variable]:"colors.whiteAlpha.100"},bg:ir.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"}),Ui=h({baseStyle:Gi}),Yi=t({transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}}),Ki=h({baseStyle:Yi}),{defineMultiStyleConfig:Xi,definePartsStyle:Zi}=b(Zt.keys),Ji=t({marginEnd:"2",display:"inline",verticalAlign:"text-bottom"}),Qi=Zi({icon:Ji}),el=Xi({baseStyle:Qi}),{defineMultiStyleConfig:rl,definePartsStyle:al}=b(Jt.keys),I=c("menu-bg"),lr=c("menu-shadow"),tl=t({[I.variable]:"#fff",[lr.variable]:"shadows.sm",_dark:{[I.variable]:"colors.gray.700",[lr.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:I.reference,boxShadow:lr.reference}),ol=t({py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[I.variable]:"colors.gray.100",_dark:{[I.variable]:"colors.whiteAlpha.100"}},_active:{[I.variable]:"colors.gray.200",_dark:{[I.variable]:"colors.whiteAlpha.200"}},_expanded:{[I.variable]:"colors.gray.100",_dark:{[I.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:I.reference}),nl=t({mx:4,my:2,fontWeight:"semibold",fontSize:"sm"}),il=t({opacity:.6}),ll=t({border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6}),sl=t({transitionProperty:"common",transitionDuration:"normal"}),dl=al({button:sl,list:tl,item:ol,groupTitle:nl,command:il,divider:ll}),cl=rl({baseStyle:dl}),{defineMultiStyleConfig:bl,definePartsStyle:yr}=b(Qt.keys),sr=c("modal-bg"),dr=c("modal-shadow"),vl=t({bg:"blackAlpha.600",zIndex:"modal"}),ul=t(e=>{const{isCentered:r,scrollBehavior:a}=e;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:r?"center":"flex-start",overflow:a==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}}),fl=t(e=>{const{isCentered:r,scrollBehavior:a}=e;return{borderRadius:"md",color:"inherit",my:r?"auto":"16",mx:r?"auto":void 0,zIndex:"modal",maxH:a==="inside"?"calc(100% - 7.5rem)":void 0,[sr.variable]:"colors.white",[dr.variable]:"shadows.lg",_dark:{[sr.variable]:"colors.gray.700",[dr.variable]:"shadows.dark-lg"},bg:sr.reference,boxShadow:dr.reference}}),ml=t({px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"}),hl=t({position:"absolute",top:"2",insetEnd:"3"}),gl=t(e=>{const{scrollBehavior:r}=e;return{px:"6",py:"2",flex:"1",overflow:r==="inside"?"auto":void 0}}),yl=t({px:"6",py:"4"}),pl=yr(e=>({overlay:vl,dialogContainer:k(ul,e),dialog:k(fl,e),header:ml,closeButton:hl,body:k(gl,e),footer:yl}));function C(e){return yr(e==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:e}})}var Sl={xs:C("xs"),sm:C("sm"),md:C("md"),lg:C("lg"),xl:C("xl"),"2xl":C("2xl"),"3xl":C("3xl"),"4xl":C("4xl"),"5xl":C("5xl"),"6xl":C("6xl"),full:C("full")},xl=bl({baseStyle:pl,sizes:Sl,defaultProps:{size:"md"}}),{defineMultiStyleConfig:$l,definePartsStyle:$a}=b(eo.keys),kr=m("number-input-stepper-width"),ka=m("number-input-input-padding"),kl=E(kr).add("0.5rem").toString(),cr=m("number-input-bg"),br=m("number-input-color"),vr=m("number-input-border-color"),_l=t({[kr.variable]:"sizes.6",[ka.variable]:kl}),wl=t(e=>{var r,a;return(a=(r=k(u.baseStyle,e))==null?void 0:r.field)!=null?a:{}}),zl=t({width:kr.reference}),Cl=t({borderStart:"1px solid",borderStartColor:vr.reference,color:br.reference,bg:cr.reference,[br.variable]:"colors.chakra-body-text",[vr.variable]:"colors.chakra-border-color",_dark:{[br.variable]:"colors.whiteAlpha.800",[vr.variable]:"colors.whiteAlpha.300"},_active:{[cr.variable]:"colors.gray.200",_dark:{[cr.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}}),Al=$a(e=>{var r;return{root:_l,field:(r=k(wl,e))!=null?r:{},stepperGroup:zl,stepper:Cl}});function Pe(e){var r,a,o;const i=(r=u.sizes)==null?void 0:r[e],l={lg:"md",md:"md",sm:"sm",xs:"sm"},s=(o=(a=i.field)==null?void 0:a.fontSize)!=null?o:"md",d=ha.fontSizes[s];return $a({field:{...i.field,paddingInlineEnd:ka.reference,verticalAlign:"top"},stepper:{fontSize:E(d).multiply(.75).toString(),_first:{borderTopEndRadius:l[e]},_last:{borderBottomEndRadius:l[e],mt:"-1px",borderTopWidth:1}}})}var Pl={xs:Pe("xs"),sm:Pe("sm"),md:Pe("md"),lg:Pe("lg")},Tl=$l({baseStyle:Al,sizes:Pl,variants:u.variants,defaultProps:u.defaultProps}),oa,Fl=t({...(oa=u.baseStyle)==null?void 0:oa.field,textAlign:"center"}),Il={lg:t({fontSize:"lg",w:12,h:12,borderRadius:"md"}),md:t({fontSize:"md",w:10,h:10,borderRadius:"md"}),sm:t({fontSize:"sm",w:8,h:8,borderRadius:"sm"}),xs:t({fontSize:"xs",w:6,h:6,borderRadius:"sm"})},na,ia,Ml={outline:t(e=>{var r,a,o;return(o=(a=k((r=u.variants)==null?void 0:r.outline,e))==null?void 0:a.field)!=null?o:{}}),flushed:t(e=>{var r,a,o;return(o=(a=k((r=u.variants)==null?void 0:r.flushed,e))==null?void 0:a.field)!=null?o:{}}),filled:t(e=>{var r,a,o;return(o=(a=k((r=u.variants)==null?void 0:r.filled,e))==null?void 0:a.field)!=null?o:{}}),unstyled:(ia=(na=u.variants)==null?void 0:na.unstyled.field)!=null?ia:{}},Bl=h({baseStyle:Fl,sizes:Il,variants:Ml,defaultProps:u.defaultProps}),{defineMultiStyleConfig:El,definePartsStyle:Dl}=b(ro.keys),Te=m("popper-bg"),Rl=m("popper-arrow-bg"),la=m("popper-arrow-shadow-color"),jl=t({zIndex:10}),Hl=t({[Te.variable]:"colors.white",bg:Te.reference,[Rl.variable]:Te.reference,[la.variable]:"colors.gray.200",_dark:{[Te.variable]:"colors.gray.700",[la.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}}),Wl=t({px:3,py:2,borderBottomWidth:"1px"}),Ll=t({px:3,py:2}),Vl=t({px:3,py:2,borderTopWidth:"1px"}),ql=t({position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2}),Ol=Dl({popper:jl,content:Hl,header:Wl,body:Ll,footer:Vl,closeButton:ql}),Nl=El({baseStyle:Ol}),{definePartsStyle:pr,defineMultiStyleConfig:Gl}=b(Gt.keys),ur=c("drawer-bg"),fr=c("drawer-box-shadow");function Y(e){return pr(e==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:e}})}var Ul=t({bg:"blackAlpha.600",zIndex:"overlay"}),Yl=t({display:"flex",zIndex:"modal",justifyContent:"center"}),Kl=t(e=>{const{isFullHeight:r}=e;return{...r&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[ur.variable]:"colors.white",[fr.variable]:"shadows.lg",_dark:{[ur.variable]:"colors.gray.700",[fr.variable]:"shadows.dark-lg"},bg:ur.reference,boxShadow:fr.reference}}),Xl=t({px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"}),Zl=t({position:"absolute",top:"2",insetEnd:"3"}),Jl=t({px:"6",py:"2",flex:"1",overflow:"auto"}),Ql=t({px:"6",py:"4"}),es=pr(e=>({overlay:Ul,dialogContainer:Yl,dialog:k(Kl,e),header:Xl,closeButton:Zl,body:Jl,footer:Ql})),rs={xs:Y("xs"),sm:Y("md"),md:Y("lg"),lg:Y("2xl"),xl:Y("4xl"),full:Y("full")},as=Gl({baseStyle:es,sizes:rs,defaultProps:{size:"xs"}}),{definePartsStyle:ts,defineMultiStyleConfig:os}=b(Ut.keys),ns=t({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"}),is=t({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}}),ls=t({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}}),ss=ts({preview:ns,input:is,textarea:ls}),ds=os({baseStyle:ss}),{definePartsStyle:cs,defineMultiStyleConfig:bs}=b(Yt.keys),J=c("form-control-color"),vs=t({marginStart:"1",[J.variable]:"colors.red.500",_dark:{[J.variable]:"colors.red.300"},color:J.reference}),us=t({mt:"2",[J.variable]:"colors.gray.600",_dark:{[J.variable]:"colors.whiteAlpha.600"},color:J.reference,lineHeight:"normal",fontSize:"sm"}),fs=cs({container:{width:"100%",position:"relative"},requiredIndicator:vs,helperText:us}),ms=bs({baseStyle:fs}),{definePartsStyle:hs,defineMultiStyleConfig:gs}=b(Kt.keys),Q=c("form-error-color"),ys=t({[Q.variable]:"colors.red.500",_dark:{[Q.variable]:"colors.red.300"},color:Q.reference,mt:"2",fontSize:"sm",lineHeight:"normal"}),ps=t({marginEnd:"0.5em",[Q.variable]:"colors.red.500",_dark:{[Q.variable]:"colors.red.300"},color:Q.reference}),Ss=hs({text:ys,icon:ps}),xs=gs({baseStyle:Ss}),$s=t({fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}}),ks=h({baseStyle:$s}),_s=t({fontFamily:"heading",fontWeight:"bold"}),ws={"4xl":t({fontSize:["6xl",null,"7xl"],lineHeight:1}),"3xl":t({fontSize:["5xl",null,"6xl"],lineHeight:1}),"2xl":t({fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]}),xl:t({fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]}),lg:t({fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]}),md:t({fontSize:"xl",lineHeight:1.2}),sm:t({fontSize:"md",lineHeight:1.2}),xs:t({fontSize:"sm",lineHeight:1.2})},zs=h({baseStyle:_s,sizes:ws,defaultProps:{size:"xl"}}),{defineMultiStyleConfig:Cs,definePartsStyle:As}=b(Ot.keys),mr=c("breadcrumb-link-decor"),Ps=t({transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",outline:"none",color:"inherit",textDecoration:mr.reference,[mr.variable]:"none","&:not([aria-current=page])":{cursor:"pointer",_hover:{[mr.variable]:"underline"},_focusVisible:{boxShadow:"outline"}}}),Ts=As({link:Ps}),Fs=Cs({baseStyle:Ts}),Is=t({lineHeight:"1.2",borderRadius:"md",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{_disabled:{bg:"initial"}}}),_a=t(e=>{const{colorScheme:r,theme:a}=e;if(r==="gray")return{color:n("gray.800","whiteAlpha.900")(e),_hover:{bg:n("gray.100","whiteAlpha.200")(e)},_active:{bg:n("gray.200","whiteAlpha.300")(e)}};const o=re(`${r}.200`,.12)(a),i=re(`${r}.200`,.24)(a);return{color:n(`${r}.600`,`${r}.200`)(e),bg:"transparent",_hover:{bg:n(`${r}.50`,o)(e)},_active:{bg:n(`${r}.100`,i)(e)}}}),Ms=t(e=>{const{colorScheme:r}=e,a=n("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:r==="gray"?a:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"},...k(_a,e)}}),Bs={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},Es=t(e=>{var r;const{colorScheme:a}=e;if(a==="gray"){const v=n("gray.100","whiteAlpha.200")(e);return{bg:v,color:n("gray.800","whiteAlpha.900")(e),_hover:{bg:n("gray.200","whiteAlpha.300")(e),_disabled:{bg:v}},_active:{bg:n("gray.300","whiteAlpha.400")(e)}}}const{bg:o=`${a}.500`,color:i="white",hoverBg:l=`${a}.600`,activeBg:s=`${a}.700`}=(r=Bs[a])!=null?r:{},d=n(o,`${a}.200`)(e);return{bg:d,color:n(i,"gray.800")(e),_hover:{bg:n(l,`${a}.300`)(e),_disabled:{bg:d}},_active:{bg:n(s,`${a}.400`)(e)}}}),Ds=t(e=>{const{colorScheme:r}=e;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:n(`${r}.500`,`${r}.200`)(e),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:n(`${r}.700`,`${r}.500`)(e)}}}),Rs=t({bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"}),js={ghost:_a,outline:Ms,solid:Es,link:Ds,unstyled:Rs},Hs={lg:t({h:"12",minW:"12",fontSize:"lg",px:"6"}),md:t({h:"10",minW:"10",fontSize:"md",px:"4"}),sm:t({h:"8",minW:"8",fontSize:"sm",px:"3"}),xs:t({h:"6",minW:"6",fontSize:"xs",px:"2"})},Ws=h({baseStyle:Is,variants:js,sizes:Hs,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}}),{definePartsStyle:U,defineMultiStyleConfig:Ls}=b(vo.keys),Ye=c("card-bg"),R=c("card-padding"),wa=c("card-shadow"),Oe=c("card-radius"),za=c("card-border-width","0"),Ca=c("card-border-color"),Vs=U({container:{[Ye.variable]:"colors.chakra-body-bg",backgroundColor:Ye.reference,boxShadow:wa.reference,borderRadius:Oe.reference,color:"chakra-body-text",borderWidth:za.reference,borderColor:Ca.reference},body:{padding:R.reference,flex:"1 1 0%"},header:{padding:R.reference},footer:{padding:R.reference}}),qs={sm:U({container:{[Oe.variable]:"radii.base",[R.variable]:"space.3"}}),md:U({container:{[Oe.variable]:"radii.md",[R.variable]:"space.5"}}),lg:U({container:{[Oe.variable]:"radii.xl",[R.variable]:"space.7"}})},Os={elevated:U({container:{[wa.variable]:"shadows.base",_dark:{[Ye.variable]:"colors.gray.700"}}}),outline:U({container:{[za.variable]:"1px",[Ca.variable]:"colors.chakra-border-color"}}),filled:U({container:{[Ye.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[R.variable]:0},header:{[R.variable]:0},footer:{[R.variable]:0}}},Ns=Ls({baseStyle:Vs,variants:Os,sizes:qs,defaultProps:{variant:"elevated",size:"md"}}),me=m("close-button-size"),ie=m("close-button-bg"),Gs=t({w:[me.reference],h:[me.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[ie.variable]:"colors.blackAlpha.100",_dark:{[ie.variable]:"colors.whiteAlpha.100"}},_active:{[ie.variable]:"colors.blackAlpha.200",_dark:{[ie.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:ie.reference}),Us={lg:t({[me.variable]:"sizes.10",fontSize:"md"}),md:t({[me.variable]:"sizes.8",fontSize:"xs"}),sm:t({[me.variable]:"sizes.6",fontSize:"2xs"})},Ys=h({baseStyle:Gs,sizes:Us,defaultProps:{size:"md"}}),{variants:Ks,defaultProps:Xs}=ue,Zs=t({fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm",bg:y.bg.reference,color:y.color.reference,boxShadow:y.shadow.reference}),Js=h({baseStyle:Zs,variants:Ks,defaultProps:Xs}),Qs=t({w:"100%",mx:"auto",maxW:"prose",px:"4"}),e0=h({baseStyle:Qs}),r0=t({opacity:.6,borderColor:"inherit"}),a0=t({borderStyle:"solid"}),t0=t({borderStyle:"dashed"}),o0={solid:a0,dashed:t0},n0=h({baseStyle:r0,variants:o0,defaultProps:{variant:"solid"}}),{definePartsStyle:i0,defineMultiStyleConfig:l0}=b(Lt.keys),s0=t({borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}}),d0=t({transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"}),c0=t({pt:"2",px:"4",pb:"5"}),b0=t({fontSize:"1.25em"}),v0=i0({container:s0,button:d0,panel:c0,icon:b0}),u0=l0({baseStyle:v0}),{definePartsStyle:xe,defineMultiStyleConfig:f0}=b(Vt.keys),w=c("alert-fg"),j=c("alert-bg"),m0=xe({container:{bg:j.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:w.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:w.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function _r(e){const{theme:r,colorScheme:a}=e,o=re(`${a}.200`,.16)(r);return{light:`colors.${a}.100`,dark:o}}var h0=xe(e=>{const{colorScheme:r}=e,a=_r(e);return{container:{[w.variable]:`colors.${r}.500`,[j.variable]:a.light,_dark:{[w.variable]:`colors.${r}.200`,[j.variable]:a.dark}}}}),g0=xe(e=>{const{colorScheme:r}=e,a=_r(e);return{container:{[w.variable]:`colors.${r}.500`,[j.variable]:a.light,_dark:{[w.variable]:`colors.${r}.200`,[j.variable]:a.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:w.reference}}}),y0=xe(e=>{const{colorScheme:r}=e,a=_r(e);return{container:{[w.variable]:`colors.${r}.500`,[j.variable]:a.light,_dark:{[w.variable]:`colors.${r}.200`,[j.variable]:a.dark},pt:"2",borderTopWidth:"4px",borderTopColor:w.reference}}}),p0=xe(e=>{const{colorScheme:r}=e;return{container:{[w.variable]:"colors.white",[j.variable]:`colors.${r}.500`,_dark:{[w.variable]:"colors.gray.900",[j.variable]:`colors.${r}.200`},color:w.reference}}}),S0={subtle:h0,"left-accent":g0,"top-accent":y0,solid:p0},x0=f0({baseStyle:m0,variants:S0,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:Aa,defineMultiStyleConfig:$0}=b(qt.keys),ee=c("avatar-border-color"),he=c("avatar-bg"),Se=c("avatar-font-size"),ae=c("avatar-size"),k0=t({borderRadius:"full",border:"0.2em solid",borderColor:ee.reference,[ee.variable]:"white",_dark:{[ee.variable]:"colors.gray.800"}}),_0=t({bg:he.reference,fontSize:Se.reference,width:ae.reference,height:ae.reference,lineHeight:"1",[he.variable]:"colors.gray.200",_dark:{[he.variable]:"colors.whiteAlpha.400"}}),w0=t(e=>{const{name:r,theme:a}=e,o=r?Io({string:r}):"colors.gray.400",i=To(o)(a);let l="white";return i||(l="gray.800"),{bg:he.reference,fontSize:Se.reference,color:l,borderColor:ee.reference,verticalAlign:"top",width:ae.reference,height:ae.reference,"&:not([data-loaded])":{[he.variable]:o},[ee.variable]:"colors.white",_dark:{[ee.variable]:"colors.gray.800"}}}),z0=t({fontSize:Se.reference,lineHeight:"1"}),C0=Aa(e=>({badge:k(k0,e),excessLabel:k(_0,e),container:k(w0,e),label:z0}));function W(e){const r=e!=="100%"?ya[e]:void 0;return Aa({container:{[ae.variable]:r??e,[Se.variable]:`calc(${r??e} / 2.5)`},excessLabel:{[ae.variable]:r??e,[Se.variable]:`calc(${r??e} / 2.5)`}})}var A0={"2xs":W(4),xs:W(6),sm:W(8),md:W(12),lg:W(16),xl:W(24),"2xl":W(32),full:W("100%")},P0=$0({baseStyle:C0,sizes:A0,defaultProps:{size:"md"}}),T0={Accordion:u0,Alert:x0,Avatar:P0,Badge:ue,Breadcrumb:Fs,Button:Ws,Checkbox:Ue,CloseButton:Ys,Code:Js,Container:e0,Divider:n0,Drawer:as,Editable:ds,Form:ms,FormError:xs,FormLabel:ks,Heading:zs,Input:u,Kbd:Ui,Link:Ki,List:el,Menu:cl,Modal:xl,NumberInput:Tl,PinInput:Bl,Popover:Nl,Progress:Qn,Radio:vi,Select:pi,Skeleton:xi,SkipLink:ki,Slider:Bi,Spinner:Ri,Stat:Ni,Switch:Yo,Table:rn,Tabs:gn,Tag:Tn,Textarea:Vn,Tooltip:Nn,Card:Ns,Stepper:Wt},F0={colors:{"chakra-body-text":{_light:"gray.800",_dark:"whiteAlpha.900"},"chakra-body-bg":{_light:"white",_dark:"gray.800"},"chakra-border-color":{_light:"gray.200",_dark:"whiteAlpha.300"},"chakra-inverse-text":{_light:"white",_dark:"gray.800"},"chakra-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-subtle-text":{_light:"gray.600",_dark:"gray.400"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},I0={global:{body:{fontFamily:"body",color:"chakra-body-text",bg:"chakra-body-bg",transitionProperty:"background-color",transitionDuration:"normal",lineHeight:"base"},"*::placeholder":{color:"chakra-placeholder-color"},"*, *::before, &::after":{borderColor:"chakra-border-color"}}},M0="ltr",B0={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},Pa={semanticTokens:F0,direction:M0,...Rt,components:T0,styles:I0,config:B0};function be(e){return typeof e=="function"}function E0(...e){return r=>e.reduce((a,o)=>o(a),r)}var D0=e=>function(...a){let o=[...a],i=a[a.length-1];return ut(i)&&o.length>1?o=o.slice(0,o.length-1):i=e,E0(...o.map(l=>s=>be(l)?l(s):j0(s,l)))(i)},R0=D0(Pa);function j0(...e){return ba({},...e,Ta)}function Ta(e,r,a,o){if((be(e)||be(r))&&Object.prototype.hasOwnProperty.call(o,a))return(...i)=>{const l=be(e)?e(...i):e,s=be(r)?r(...i):r;return ba({},l,s,Ta)}}function H0(e={}){const{strict:r=!0,errorMessage:a="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:o}=e,i=x.createContext(void 0);i.displayName=o;function l(){var s;const d=x.useContext(i);if(!d&&r){const v=new Error(a);throw v.name="ContextError",(s=Error.captureStackTrace)==null||s.call(Error,v,l),v}return d}return[i.Provider,l,i]}function W0(e){const{cssVarsRoot:r,theme:a,children:o}=e,i=x.useMemo(()=>ja(a),[a]);return g.jsxs(Ha,{theme:i,children:[g.jsx(L0,{root:r}),o]})}function L0({root:e=":host, :root"}){const r=[e,"[data-theme]"].join(",");return g.jsx(Ke,{styles:a=>({[r]:a.__cssVars})})}H0({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function V0(){const{colorMode:e}=Wa();return g.jsx(Ke,{styles:r=>{const a=La(r,"styles.global"),o=Va(a,{theme:r,colorMode:e});return o?qa(o)(r):void 0}})}var Fa=x.createContext({getDocument(){return document},getWindow(){return window}});Fa.displayName="EnvironmentContext";function Ia(e){const{children:r,environment:a,disabled:o}=e,i=x.useRef(null),l=x.useMemo(()=>a||{getDocument:()=>{var d,v;return(v=(d=i.current)==null?void 0:d.ownerDocument)!=null?v:document},getWindow:()=>{var d,v;return(v=(d=i.current)==null?void 0:d.ownerDocument.defaultView)!=null?v:window}},[a]),s=!o||!a;return g.jsxs(Fa.Provider,{value:l,children:[r,s&&g.jsx("span",{id:"__chakra_env",hidden:!0,ref:i})]})}Ia.displayName="EnvironmentProvider";var q0=e=>{const{children:r,colorModeManager:a,portalZIndex:o,resetScope:i,resetCSS:l=!0,theme:s={},environment:d,cssVarsRoot:v,disableEnvironment:$,disableGlobalStyle:p}=e,S=g.jsx(Ia,{environment:d,disabled:$,children:r});return g.jsx(W0,{theme:s,cssVarsRoot:v,children:g.jsxs(ma,{colorModeManager:a,options:s.config,children:[l?g.jsx(st,{scope:i}):g.jsx(lt,{}),!p&&g.jsx(V0,{}),o?g.jsx(Oa,{zIndex:o,children:S}):S]})})},O0=e=>function({children:a,theme:o=e,toastOptions:i,...l}){return g.jsxs(q0,{theme:o,...l,children:[g.jsx(Na,{value:i==null?void 0:i.defaultOptions,children:a}),g.jsx(Ga,{...i})]})},N0=O0(Pa);function z(e,r,a=!1){e=String(e),r=String(r);const o=Array.from({length:21},(s,d)=>d*50),i=[0,5,10,15,20,25,30,35,40,45,50,55,59,64,68,73,77,82,86,95,100];return o.reduce((s,d,v)=>{const $=a?i[v]/100:1,p=a?50:i[o.length-1-v];return s[d]=`hsl(${e} ${r}% ${p}% / ${$})`,s},{})}const Fe={H:220,S:16},Ie={H:250,S:52},Me={H:47,S:50},Be={H:28,S:50},Ee={H:113,S:50},De={H:0,S:50},G0={base:z(Fe.H,Fe.S),baseAlpha:z(Fe.H,Fe.S,!0),accent:z(Ie.H,Ie.S),accentAlpha:z(Ie.H,Ie.S,!0),working:z(Me.H,Me.S),workingAlpha:z(Me.H,Me.S,!0),warning:z(Be.H,Be.S),warningAlpha:z(Be.H,Be.S,!0),ok:z(Ee.H,Ee.S),okAlpha:z(Ee.H,Ee.S,!0),error:z(De.H,De.S),errorAlpha:z(De.H,De.S,!0)},{definePartsStyle:U0,defineMultiStyleConfig:Y0}=b(Ya.keys),K0=t({border:"none"}),X0=t(e=>{const{colorScheme:r}=e;return{fontWeight:"600",fontSize:"sm",border:"none",borderRadius:"base",bg:n(`${r}.200`,`${r}.700`)(e),color:n(`${r}.900`,`${r}.100`)(e),_hover:{bg:n(`${r}.250`,`${r}.650`)(e)},_expanded:{bg:n(`${r}.250`,`${r}.650`)(e),borderBottomRadius:"none",_hover:{bg:n(`${r}.300`,`${r}.600`)(e)}}}}),Z0=t(e=>{const{colorScheme:r}=e;return{bg:n(`${r}.100`,`${r}.800`)(e),borderRadius:"base",borderTopRadius:"none"}}),J0=t({}),Q0=U0(e=>({container:K0,button:X0(e),panel:Z0(e),icon:J0})),ed=Y0({variants:{invokeAI:Q0},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),rd=t(e=>{const{colorScheme:r}=e;if(r==="base"){const o={bg:n("base.150","base.700")(e),color:n("base.500","base.500")(e),svg:{fill:n("base.500","base.500")(e)},opacity:1};return{bg:n("base.250","base.600")(e),color:n("base.850","base.100")(e),borderRadius:"base",svg:{fill:n("base.850","base.100")(e)},_hover:{bg:n("base.300","base.500")(e),color:n("base.900","base.50")(e),svg:{fill:n("base.900","base.50")(e)},_disabled:o},_disabled:o}}const a={bg:n(`${r}.250`,`${r}.700`)(e),color:n(`${r}.50`,`${r}.500`)(e),svg:{fill:n(`${r}.50`,`${r}.500`)(e),filter:"unset"},opacity:1,filter:n(void 0,"saturate(65%)")(e)};return{bg:n(`${r}.400`,`${r}.600`)(e),color:n("base.50","base.100")(e),borderRadius:"base",svg:{fill:n("base.50","base.100")(e)},_disabled:a,_hover:{bg:n(`${r}.500`,`${r}.500`)(e),color:n("white","base.50")(e),svg:{fill:n("white","base.50")(e)},_disabled:a}}}),ad=h({variants:{invokeAI:rd},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),{definePartsStyle:td,defineMultiStyleConfig:od}=b(Ka.keys),nd=t(e=>{const{colorScheme:r}=e;return{bg:n("base.200","base.700")(e),borderColor:n("base.200","base.700")(e),color:n("base.900","base.100")(e),_checked:{bg:n(`${r}.300`,`${r}.600`)(e),borderColor:n(`${r}.300`,`${r}.600`)(e),color:n(`${r}.900`,`${r}.100`)(e),_hover:{bg:n(`${r}.400`,`${r}.500`)(e),borderColor:n(`${r}.400`,`${r}.500`)(e)},_disabled:{borderColor:"transparent",bg:"whiteAlpha.300",color:"whiteAlpha.500"}},_indeterminate:{bg:n(`${r}.300`,`${r}.600`)(e),borderColor:n(`${r}.300`,`${r}.600`)(e),color:n(`${r}.900`,`${r}.100`)(e)},_disabled:{bg:"whiteAlpha.100",borderColor:"transparent"},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:n("error.600","error.300")(e)}}}),id=td(e=>({control:nd(e)})),ld=od({variants:{invokeAI:id},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),sd=t(e=>({fontSize:"sm",marginEnd:0,mb:1,fontWeight:"400",transitionProperty:"common",transitionDuration:"normal",whiteSpace:"nowrap",_disabled:{opacity:.4},color:n("base.700","base.300")(e)})),dd=h({variants:{invokeAI:sd},defaultProps:{variant:"invokeAI"}}),Je=e=>({outline:"none",borderWidth:2,borderStyle:"solid",borderColor:n("base.200","base.800")(e),bg:n("base.50","base.900")(e),borderRadius:"base",color:n("base.900","base.100")(e),boxShadow:"none",_hover:{borderColor:n("base.300","base.600")(e)},_focus:{borderColor:n("accent.200","accent.600")(e),boxShadow:"none",_hover:{borderColor:n("accent.300","accent.500")(e)}},_invalid:{borderColor:n("error.300","error.600")(e),boxShadow:"none",_hover:{borderColor:n("error.400","error.500")(e)}},_disabled:{borderColor:n("base.300","base.700")(e),bg:n("base.300","base.700")(e),color:n("base.600","base.400")(e),_hover:{borderColor:n("base.300","base.700")(e)}},_placeholder:{color:n("base.700","base.400")(e)}}),{definePartsStyle:cd,defineMultiStyleConfig:bd}=b(Xa.keys),vd=cd(e=>({field:Je(e)})),ud=bd({variants:{invokeAI:vd},defaultProps:{size:"sm",variant:"invokeAI"}}),{defineMultiStyleConfig:fd,definePartsStyle:md}=b(Za.keys),hd=t(e=>({bg:n("blackAlpha.700","blackAlpha.700")(e)})),gd=t({}),yd=t(e=>({layerStyle:"first",maxH:"80vh"})),pd=t(e=>({fontWeight:"600",fontSize:"lg",layerStyle:"first",borderTopRadius:"base",borderInlineEndRadius:"base"})),Sd=t({}),xd=t({overflowY:"scroll"}),$d=t({}),kd=md(e=>({overlay:hd(e),dialogContainer:gd,dialog:yd(e),header:pd(e),closeButton:Sd,body:xd,footer:$d})),_d=fd({variants:{invokeAI:kd},defaultProps:{variant:"invokeAI",size:"lg"}}),{defineMultiStyleConfig:wd,definePartsStyle:zd}=b(Ja.keys),Cd=t(e=>({height:8})),Ad=t(e=>({border:"none",fontWeight:"600",height:"auto",py:1,ps:2,pe:6,...Je(e)})),Pd=t(e=>({display:"flex"})),Td=t(e=>({border:"none",px:2,py:0,mx:-2,my:0,svg:{color:n("base.700","base.300")(e),width:2.5,height:2.5,_hover:{color:n("base.900","base.100")(e)}}})),Fd=zd(e=>({root:Cd(e),field:Ad(e),stepperGroup:Pd(e),stepper:Td(e)})),Id=wd({variants:{invokeAI:Fd},defaultProps:{size:"sm",variant:"invokeAI"}}),{defineMultiStyleConfig:Md,definePartsStyle:Bd}=b(Qa.keys),Ed=m("popper-bg"),Dd=m("popper-arrow-bg"),Rd=m("popper-arrow-shadow-color"),jd=t(e=>({[Dd.variable]:n("colors.base.100","colors.base.800")(e),[Ed.variable]:n("colors.base.100","colors.base.800")(e),[Rd.variable]:n("colors.base.400","colors.base.600")(e),minW:"unset",width:"unset",p:4,bg:n("base.100","base.800")(e),border:"none",shadow:"dark-lg"})),Hd=Bd(e=>({content:jd(e)})),Wd=Md({variants:{invokeAI:Hd},defaultProps:{variant:"invokeAI"}}),{defineMultiStyleConfig:Ld,definePartsStyle:Vd}=b(et.keys),qd=t(e=>({bg:"accentAlpha.500"})),Od=t(e=>{const{colorScheme:r}=e;return{bg:n(`${r}.200`,`${r}.700`)(e)}}),Nd=Vd(e=>({filledTrack:qd(e),track:Od(e)})),Gd=Ld({variants:{invokeAI:Nd},defaultProps:{variant:"invokeAI"}}),Ud={"::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},{definePartsStyle:Yd,defineMultiStyleConfig:Kd}=b(rt.keys),Xd=t(e=>({color:n("base.200","base.300")(e)})),Zd=t(e=>({fontWeight:"600",...Je(e)})),Jd=Yd(e=>({field:Zd(e),icon:Xd(e)})),Qd=Kd({variants:{invokeAI:Jd},defaultProps:{size:"sm",variant:"invokeAI"}}),sa=c("skeleton-start-color"),da=c("skeleton-end-color"),ec=t({borderRadius:"base",maxW:"full",maxH:"full",_light:{[sa.variable]:"colors.base.250",[da.variable]:"colors.base.450"},_dark:{[sa.variable]:"colors.base.700",[da.variable]:"colors.base.500"}}),rc=h({variants:{invokeAI:ec},defaultProps:{variant:"invokeAI"}}),{definePartsStyle:ac,defineMultiStyleConfig:tc}=b(at.keys),oc=t(e=>({bg:n("base.400","base.600")(e),h:1.5})),nc=t(e=>{const{colorScheme:r}=e;return{bg:n(`${r}.400`,`${r}.600`)(e),h:1.5}}),ic=t(e=>({w:2,h:4,bg:n("base.50","base.100")(e)})),lc=t(e=>({fontSize:"2xs",fontWeight:"500",color:n("base.700","base.400")(e),mt:2,insetInlineStart:"unset"})),sc=ac(e=>({container:{_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"}},track:oc(e),filledTrack:nc(e),thumb:ic(e),mark:lc(e)})),dc=tc({variants:{invokeAI:sc},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:cc,definePartsStyle:bc}=b(tt.keys),vc=t(e=>{const{colorScheme:r}=e;return{bg:n("base.300","base.600")(e),_focusVisible:{boxShadow:"none"},_checked:{bg:n(`${r}.400`,`${r}.500`)(e)}}}),uc=t(e=>{const{colorScheme:r}=e;return{bg:n(`${r}.50`,`${r}.50`)(e)}}),fc=bc(e=>({container:{},track:vc(e),thumb:uc(e)})),mc=cc({variants:{invokeAI:fc},defaultProps:{size:"md",variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:hc,definePartsStyle:gc}=b(ot.keys),yc=t(e=>({display:"flex",columnGap:4})),pc=t(e=>({})),Sc=t(e=>{const{colorScheme:r}=e;return{display:"flex",flexDirection:"column",gap:1,color:n("base.700","base.400")(e),button:{fontSize:"sm",padding:2,borderRadius:"base",textShadow:n("0 0 0.3rem var(--invokeai-colors-accent-100)","0 0 0.3rem var(--invokeai-colors-accent-900)")(e),svg:{fill:n("base.700","base.300")(e)},_selected:{bg:n("accent.400","accent.600")(e),color:n("base.50","base.100")(e),svg:{fill:n("base.50","base.100")(e),filter:n(`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${r}-600))`,`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${r}-800))`)(e)},_hover:{bg:n("accent.500","accent.500")(e),color:n("white","base.50")(e),svg:{fill:n("white","base.50")(e)}}},_hover:{bg:n("base.100","base.800")(e),color:n("base.900","base.50")(e),svg:{fill:n("base.800","base.100")(e)}}}}}),xc=t(e=>({padding:0,height:"100%"})),$c=gc(e=>({root:yc(e),tab:pc(e),tablist:Sc(e),tabpanel:xc(e)})),kc=hc({variants:{invokeAI:$c},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),_c=t(e=>({color:n("base.500","base.400")(e)})),wc=h({variants:{subtext:_c}}),zc=t(e=>({...Je(e),"::-webkit-scrollbar":{display:"initial"},"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, - var(--invokeai-colors-base-50) 0%, - var(--invokeai-colors-base-50) 70%, - var(--invokeai-colors-base-200) 70%, - var(--invokeai-colors-base-200) 100%)`},_dark:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, - var(--invokeai-colors-base-900) 0%, - var(--invokeai-colors-base-900) 70%, - var(--invokeai-colors-base-800) 70%, - var(--invokeai-colors-base-800) 100%)`}}})),Cc=h({variants:{invokeAI:zc},defaultProps:{size:"md",variant:"invokeAI"}}),Ac=m("popper-arrow-bg"),Pc=t(e=>({borderRadius:"base",shadow:"dark-lg",bg:n("base.700","base.200")(e),[Ac.variable]:n("colors.base.700","colors.base.200")(e),pb:1.5})),Tc=h({baseStyle:Pc}),Fc={config:{cssVarPrefix:"invokeai",initialColorMode:"dark",useSystemColorMode:!1},layerStyles:{body:{bg:"base.50",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.50"}},first:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.850",color:"base.100"}},second:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}}},styles:{global:()=>({layerStyle:"body","*":{...Ud}})},direction:"ltr",fonts:{body:"'Inter Variable', sans-serif"},shadows:{light:{accent:"0 0 10px 0 var(--invokeai-colors-accent-300)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-400)",ok:"0 0 7px var(--invokeai-colors-ok-600)",working:"0 0 7px var(--invokeai-colors-working-600)",error:"0 0 7px var(--invokeai-colors-error-600)"},dark:{accent:"0 0 10px 0 var(--invokeai-colors-accent-600)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-500)",ok:"0 0 7px var(--invokeai-colors-ok-400)",working:"0 0 7px var(--invokeai-colors-working-400)",error:"0 0 7px var(--invokeai-colors-error-400)"},selected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-400)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-400)"},nodeSelectedOutline:"0 0 0 2px var(--invokeai-colors-accent-450)"},colors:G0,components:{Button:ad,Input:ud,Textarea:Cc,Tabs:kc,Progress:Gd,Accordion:ed,FormLabel:dd,Switch:mc,NumberInput:Id,Select:Qd,Skeleton:rc,Slider:dc,Popover:Wd,Modal:_d,Checkbox:ld,Menu:nt,Text:wc,Tooltip:Tc}};const Ic=()=>x.useMemo(()=>({colorScheme:"dark",fontFamily:"'Inter Variable', sans-serif",components:{ScrollArea:{defaultProps:{scrollbarSize:10},styles:{scrollbar:{"&:hover":{backgroundColor:"var(--invokeai-colors-baseAlpha-300)"}},thumb:{backgroundColor:"var(--invokeai-colors-baseAlpha-300)"}}}}}),[]),Mc=fa("@@invokeai-color-mode");function Dc({children:e}){const{i18n:r}=Ua(),a=r.dir(),o=x.useMemo(()=>R0({...Fc,direction:a}),[a]);x.useEffect(()=>{document.body.dir=a},[a]);const i=Ic();return g.jsx(it,{theme:i,children:g.jsx(N0,{theme:o,colorModeManager:Mc,children:e})})}export{Dc as default}; diff --git a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-e6f4b86d.js b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-e6f4b86d.js new file mode 100644 index 0000000000..5fd432777f --- /dev/null +++ b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-e6f4b86d.js @@ -0,0 +1,302 @@ +import{A as m,fS as Ze,z as y,a4 as Xa,fT as Ya,af as va,aj as d,fU as b,fV as t,fW as Ka,fX as h,fY as ua,fZ as Za,f_ as Ja,aI as Qa,f$ as et,ad as rt,g0 as at}from"./index-efb4c895.js";import{s as fa,n as o,t as tt,o as ha,p as ot,q as ma,v as ga,w as ya,x as it,y as Sa,z as pa,A as xr,B as nt,D as lt,E as st,F as xa,G as $a,H as ka,J as dt,K as _a,L as ct,M as bt,N as vt,O as ut,Q as wa,R as ft,S as ht,T as mt,U as gt,V as yt,W as St,e as pt,X as xt}from"./MantineProvider-97b2a7de.js";var za=String.raw,Ca=za` + :root, + :host { + --chakra-vh: 100vh; + } + + @supports (height: -webkit-fill-available) { + :root, + :host { + --chakra-vh: -webkit-fill-available; + } + } + + @supports (height: -moz-fill-available) { + :root, + :host { + --chakra-vh: -moz-fill-available; + } + } + + @supports (height: 100dvh) { + :root, + :host { + --chakra-vh: 100dvh; + } + } +`,$t=()=>m.jsx(Ze,{styles:Ca}),kt=({scope:e=""})=>m.jsx(Ze,{styles:za` + html { + line-height: 1.5; + -webkit-text-size-adjust: 100%; + font-family: system-ui, sans-serif; + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; + -moz-osx-font-smoothing: grayscale; + touch-action: manipulation; + } + + body { + position: relative; + min-height: 100%; + margin: 0; + font-feature-settings: "kern"; + } + + ${e} :where(*, *::before, *::after) { + border-width: 0; + border-style: solid; + box-sizing: border-box; + word-wrap: break-word; + } + + main { + display: block; + } + + ${e} hr { + border-top-width: 1px; + box-sizing: content-box; + height: 0; + overflow: visible; + } + + ${e} :where(pre, code, kbd,samp) { + font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; + font-size: 1em; + } + + ${e} a { + background-color: transparent; + color: inherit; + text-decoration: inherit; + } + + ${e} abbr[title] { + border-bottom: none; + text-decoration: underline; + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; + } + + ${e} :where(b, strong) { + font-weight: bold; + } + + ${e} small { + font-size: 80%; + } + + ${e} :where(sub,sup) { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; + } + + ${e} sub { + bottom: -0.25em; + } + + ${e} sup { + top: -0.5em; + } + + ${e} img { + border-style: none; + } + + ${e} :where(button, input, optgroup, select, textarea) { + font-family: inherit; + font-size: 100%; + line-height: 1.15; + margin: 0; + } + + ${e} :where(button, input) { + overflow: visible; + } + + ${e} :where(button, select) { + text-transform: none; + } + + ${e} :where( + button::-moz-focus-inner, + [type="button"]::-moz-focus-inner, + [type="reset"]::-moz-focus-inner, + [type="submit"]::-moz-focus-inner + ) { + border-style: none; + padding: 0; + } + + ${e} fieldset { + padding: 0.35em 0.75em 0.625em; + } + + ${e} legend { + box-sizing: border-box; + color: inherit; + display: table; + max-width: 100%; + padding: 0; + white-space: normal; + } + + ${e} progress { + vertical-align: baseline; + } + + ${e} textarea { + overflow: auto; + } + + ${e} :where([type="checkbox"], [type="radio"]) { + box-sizing: border-box; + padding: 0; + } + + ${e} input[type="number"]::-webkit-inner-spin-button, + ${e} input[type="number"]::-webkit-outer-spin-button { + -webkit-appearance: none !important; + } + + ${e} input[type="number"] { + -moz-appearance: textfield; + } + + ${e} input[type="search"] { + -webkit-appearance: textfield; + outline-offset: -2px; + } + + ${e} input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none !important; + } + + ${e} ::-webkit-file-upload-button { + -webkit-appearance: button; + font: inherit; + } + + ${e} details { + display: block; + } + + ${e} summary { + display: list-item; + } + + template { + display: none; + } + + [hidden] { + display: none !important; + } + + ${e} :where( + blockquote, + dl, + dd, + h1, + h2, + h3, + h4, + h5, + h6, + hr, + figure, + p, + pre + ) { + margin: 0; + } + + ${e} button { + background: transparent; + padding: 0; + } + + ${e} fieldset { + margin: 0; + padding: 0; + } + + ${e} :where(ol, ul) { + margin: 0; + padding: 0; + } + + ${e} textarea { + resize: vertical; + } + + ${e} :where(button, [role="button"]) { + cursor: pointer; + } + + ${e} button::-moz-focus-inner { + border: 0 !important; + } + + ${e} table { + border-collapse: collapse; + } + + ${e} :where(h1, h2, h3, h4, h5, h6) { + font-size: inherit; + font-weight: inherit; + } + + ${e} :where(button, input, optgroup, select, textarea) { + padding: 0; + line-height: inherit; + color: inherit; + } + + ${e} :where(img, svg, video, canvas, audio, iframe, embed, object) { + display: block; + } + + ${e} :where(img, video) { + max-width: 100%; + height: auto; + } + + [data-js-focus-visible] + :focus:not([data-focus-visible-added]):not( + [data-focus-visible-disabled] + ) { + outline: none; + box-shadow: none; + } + + ${e} select::-ms-expand { + display: none; + } + + ${Ca} + `}),Ce={light:"chakra-ui-light",dark:"chakra-ui-dark"};function _t(e={}){const{preventTransition:r=!0}=e,a={setDataset:i=>{const n=r?a.preventTransition():void 0;document.documentElement.dataset.theme=i,document.documentElement.style.colorScheme=i,n==null||n()},setClassName(i){document.body.classList.add(i?Ce.dark:Ce.light),document.body.classList.remove(i?Ce.light:Ce.dark)},query(){return window.matchMedia("(prefers-color-scheme: dark)")},getSystemTheme(i){var n;return((n=a.query().matches)!=null?n:i==="dark")?"dark":"light"},addListener(i){const n=a.query(),l=s=>{i(s.matches?"dark":"light")};return typeof n.addListener=="function"?n.addListener(l):n.addEventListener("change",l),()=>{typeof n.removeListener=="function"?n.removeListener(l):n.removeEventListener("change",l)}},preventTransition(){const i=document.createElement("style");return i.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(i),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.head.removeChild(i)})})}}};return a}var wt="chakra-ui-color-mode";function Aa(e){return{ssr:!1,type:"localStorage",get(r){if(!(globalThis!=null&&globalThis.document))return r;let a;try{a=localStorage.getItem(e)||r}catch{}return a||r},set(r){try{localStorage.setItem(e,r)}catch{}}}}var zt=Aa(wt),Pr=()=>{};function Fr(e,r){return e.type==="cookie"&&e.ssr?e.get(r):r}function Pa(e){const{value:r,children:a,options:{useSystemColorMode:i,initialColorMode:n,disableTransitionOnChange:l}={},colorModeManager:s=zt}=e,c=n==="dark"?"dark":"light",[v,x]=y.useState(()=>Fr(s,c)),[F,O]=y.useState(()=>Fr(s)),{getSystemTheme:oe,setClassName:_e,setDataset:zr,addListener:Cr}=y.useMemo(()=>_t({preventTransition:l}),[l]),we=n==="system"&&!v?F:v,C=y.useCallback(ie=>{const ze=ie==="system"?oe():ie;x(ze),_e(ze==="dark"),zr(ze),s.set(ze)},[s,oe,_e,zr]);Xa(()=>{n==="system"&&O(oe())},[]),y.useEffect(()=>{const ie=s.get();if(ie){C(ie);return}if(n==="system"){C("system");return}C(c)},[s,c,n,C]);const Ar=y.useCallback(()=>{C(we==="dark"?"light":"dark")},[we,C]);y.useEffect(()=>{if(i)return Cr(C)},[i,Cr,C]);const Ua=y.useMemo(()=>({colorMode:r??we,toggleColorMode:r?Pr:Ar,setColorMode:r?Pr:C,forced:r!==void 0}),[we,Ar,C,r]);return m.jsx(Ya.Provider,{value:Ua,children:a})}Pa.displayName="ColorModeProvider";var Ct=["borders","breakpoints","colors","components","config","direction","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","shadows","sizes","space","styles","transition","zIndices"];function At(e){return va(e)?Ct.every(r=>Object.prototype.hasOwnProperty.call(e,r)):!1}var Pt={common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, transform",colors:"background-color, border-color, color, fill, stroke",dimensions:"width, height",position:"left, right, top, bottom",background:"background-color, background-image, background-position"},Ft={"ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},It={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},Tt={property:Pt,easing:Ft,duration:It},Mt=Tt,Bt={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e3,sticky:1100,banner:1200,overlay:1300,modal:1400,popover:1500,skipLink:1600,toast:1700,tooltip:1800},Et=Bt,Dt={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},Rt=Dt,jt={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},Ht=jt,Wt={transparent:"transparent",current:"currentColor",black:"#000000",white:"#FFFFFF",whiteAlpha:{50:"rgba(255, 255, 255, 0.04)",100:"rgba(255, 255, 255, 0.06)",200:"rgba(255, 255, 255, 0.08)",300:"rgba(255, 255, 255, 0.16)",400:"rgba(255, 255, 255, 0.24)",500:"rgba(255, 255, 255, 0.36)",600:"rgba(255, 255, 255, 0.48)",700:"rgba(255, 255, 255, 0.64)",800:"rgba(255, 255, 255, 0.80)",900:"rgba(255, 255, 255, 0.92)"},blackAlpha:{50:"rgba(0, 0, 0, 0.04)",100:"rgba(0, 0, 0, 0.06)",200:"rgba(0, 0, 0, 0.08)",300:"rgba(0, 0, 0, 0.16)",400:"rgba(0, 0, 0, 0.24)",500:"rgba(0, 0, 0, 0.36)",600:"rgba(0, 0, 0, 0.48)",700:"rgba(0, 0, 0, 0.64)",800:"rgba(0, 0, 0, 0.80)",900:"rgba(0, 0, 0, 0.92)"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923"},red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#ebf8ff",100:"#bee3f8",200:"#90cdf4",300:"#63b3ed",400:"#4299e1",500:"#3182ce",600:"#2b6cb0",700:"#2c5282",800:"#2a4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},linkedin:{50:"#E8F4F9",100:"#CFEDFB",200:"#9BDAF3",300:"#68C7EC",400:"#34B3E4",500:"#00A0DC",600:"#008CC9",700:"#0077B5",800:"#005E93",900:"#004471"},facebook:{50:"#E8F4F9",100:"#D9DEE9",200:"#B7C2DA",300:"#6482C0",400:"#4267B2",500:"#385898",600:"#314E89",700:"#29487D",800:"#223B67",900:"#1E355B"},messenger:{50:"#D0E6FF",100:"#B9DAFF",200:"#A2CDFF",300:"#7AB8FF",400:"#2E90FF",500:"#0078FF",600:"#0063D1",700:"#0052AC",800:"#003C7E",900:"#002C5C"},whatsapp:{50:"#dffeec",100:"#b9f5d0",200:"#90edb3",300:"#65e495",400:"#3cdd78",500:"#22c35e",600:"#179848",700:"#0c6c33",800:"#01421c",900:"#001803"},twitter:{50:"#E5F4FD",100:"#C8E9FB",200:"#A8DCFA",300:"#83CDF7",400:"#57BBF5",500:"#1DA1F2",600:"#1A94DA",700:"#1681BF",800:"#136B9E",900:"#0D4D71"},telegram:{50:"#E3F2F9",100:"#C5E4F3",200:"#A2D4EC",300:"#7AC1E4",400:"#47A9DA",500:"#0088CC",600:"#007AB8",700:"#006BA1",800:"#005885",900:"#003F5E"}},Vt=Wt,Lt={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},qt=Lt,Ot={xs:"0 0 0 1px rgba(0, 0, 0, 0.05)",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"0 0 0 3px rgba(66, 153, 225, 0.6)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)",none:"none","dark-lg":"rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px"},Nt=Ot,Gt={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},Ut=Gt,Xt={letterSpacings:{tighter:"-0.05em",tight:"-0.025em",normal:"0",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeights:{normal:"normal",none:1,shorter:1.25,short:1.375,base:1.5,tall:1.625,taller:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},fontWeights:{hairline:100,thin:200,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800,black:900},fonts:{heading:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'},fontSizes:{"3xs":"0.45rem","2xs":"0.625rem",xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"}},Fa=Xt,Ia={px:"1px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},Yt={max:"max-content",min:"min-content",full:"100%","3xs":"14rem","2xs":"16rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem","8xl":"90rem",prose:"60ch"},Kt={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},Zt={...Ia,...Yt,container:Kt},Ta=Zt,Jt={breakpoints:Ht,zIndices:Et,radii:qt,blur:Ut,colors:Vt,...Fa,sizes:Ta,shadows:Nt,space:Ia,borders:Rt,transition:Mt},{defineMultiStyleConfig:Qt,definePartsStyle:de}=b(["stepper","step","title","description","indicator","separator","icon","number"]),I=d("stepper-indicator-size"),G=d("stepper-icon-size"),U=d("stepper-title-font-size"),ce=d("stepper-description-font-size"),ne=d("stepper-accent-color"),eo=de(({colorScheme:e})=>({stepper:{display:"flex",justifyContent:"space-between",gap:"4","&[data-orientation=vertical]":{flexDirection:"column",alignItems:"flex-start"},"&[data-orientation=horizontal]":{flexDirection:"row",alignItems:"center"},[ne.variable]:`colors.${e}.500`,_dark:{[ne.variable]:`colors.${e}.200`}},title:{fontSize:U.reference,fontWeight:"medium"},description:{fontSize:ce.reference,color:"chakra-subtle-text"},number:{fontSize:U.reference},step:{flexShrink:0,position:"relative",display:"flex",gap:"2","&[data-orientation=horizontal]":{alignItems:"center"},flex:"1","&:last-of-type:not([data-stretch])":{flex:"initial"}},icon:{flexShrink:0,width:G.reference,height:G.reference},indicator:{flexShrink:0,borderRadius:"full",width:I.reference,height:I.reference,display:"flex",justifyContent:"center",alignItems:"center","&[data-status=active]":{borderWidth:"2px",borderColor:ne.reference},"&[data-status=complete]":{bg:ne.reference,color:"chakra-inverse-text"},"&[data-status=incomplete]":{borderWidth:"2px"}},separator:{bg:"chakra-border-color",flex:"1","&[data-status=complete]":{bg:ne.reference},"&[data-orientation=horizontal]":{width:"100%",height:"2px",marginStart:"2"},"&[data-orientation=vertical]":{width:"2px",position:"absolute",height:"100%",maxHeight:`calc(100% - ${I.reference} - 8px)`,top:`calc(${I.reference} + 4px)`,insetStart:`calc(${I.reference} / 2 - 1px)`}}})),ro=Qt({baseStyle:eo,sizes:{xs:de({stepper:{[I.variable]:"sizes.4",[G.variable]:"sizes.3",[U.variable]:"fontSizes.xs",[ce.variable]:"fontSizes.xs"}}),sm:de({stepper:{[I.variable]:"sizes.6",[G.variable]:"sizes.4",[U.variable]:"fontSizes.sm",[ce.variable]:"fontSizes.xs"}}),md:de({stepper:{[I.variable]:"sizes.8",[G.variable]:"sizes.5",[U.variable]:"fontSizes.md",[ce.variable]:"fontSizes.sm"}}),lg:de({stepper:{[I.variable]:"sizes.10",[G.variable]:"sizes.6",[U.variable]:"fontSizes.lg",[ce.variable]:"fontSizes.md"}})},defaultProps:{size:"md",colorScheme:"blue"}});function W(e,r,a){return Math.min(Math.max(e,a),r)}class ao extends Error{constructor(r){super(`Failed to parse color: "${r}"`)}}var be=ao;function $r(e){if(typeof e!="string")throw new be(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let r=e.trim();r=bo.test(e)?io(e):e;const a=no.exec(r);if(a){const s=Array.from(a).slice(1);return[...s.slice(0,3).map(c=>parseInt(Se(c,2),16)),parseInt(Se(s[3]||"f",2),16)/255]}const i=lo.exec(r);if(i){const s=Array.from(i).slice(1);return[...s.slice(0,3).map(c=>parseInt(c,16)),parseInt(s[3]||"ff",16)/255]}const n=so.exec(r);if(n){const s=Array.from(n).slice(1);return[...s.slice(0,3).map(c=>parseInt(c,10)),parseFloat(s[3]||"1")]}const l=co.exec(r);if(l){const[s,c,v,x]=Array.from(l).slice(1).map(parseFloat);if(W(0,100,c)!==c)throw new be(e);if(W(0,100,v)!==v)throw new be(e);return[...vo(s,c,v),Number.isNaN(x)?1:x]}throw new be(e)}function to(e){let r=5381,a=e.length;for(;a;)r=r*33^e.charCodeAt(--a);return(r>>>0)%2341}const Ir=e=>parseInt(e.replace(/_/g,""),36),oo="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,r)=>{const a=Ir(r.substring(0,3)),i=Ir(r.substring(3)).toString(16);let n="";for(let l=0;l<6-i.length;l++)n+="0";return e[a]=`${n}${i}`,e},{});function io(e){const r=e.toLowerCase().trim(),a=oo[to(r)];if(!a)throw new be(e);return`#${a}`}const Se=(e,r)=>Array.from(Array(r)).map(()=>e).join(""),no=new RegExp(`^#${Se("([a-f0-9])",3)}([a-f0-9])?$`,"i"),lo=new RegExp(`^#${Se("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),so=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${Se(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),co=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,bo=/^[a-z]+$/i,Tr=e=>Math.round(e*255),vo=(e,r,a)=>{let i=a/100;if(r===0)return[i,i,i].map(Tr);const n=(e%360+360)%360/60,l=(1-Math.abs(2*i-1))*(r/100),s=l*(1-Math.abs(n%2-1));let c=0,v=0,x=0;n>=0&&n<1?(c=l,v=s):n>=1&&n<2?(c=s,v=l):n>=2&&n<3?(v=l,x=s):n>=3&&n<4?(v=s,x=l):n>=4&&n<5?(c=s,x=l):n>=5&&n<6&&(c=l,x=s);const F=i-l/2,O=c+F,oe=v+F,_e=x+F;return[O,oe,_e].map(Tr)};function uo(e,r,a,i){return`rgba(${W(0,255,e).toFixed()}, ${W(0,255,r).toFixed()}, ${W(0,255,a).toFixed()}, ${parseFloat(W(0,1,i).toFixed(3))})`}function fo(e,r){const[a,i,n,l]=$r(e);return uo(a,i,n,l-r)}function ho(e){const[r,a,i,n]=$r(e);let l=s=>{const c=W(0,255,s).toString(16);return c.length===1?`0${c}`:c};return`#${l(r)}${l(a)}${l(i)}${n<1?l(Math.round(n*255)):""}`}function mo(e,r,a,i,n){for(r=r.split?r.split("."):r,i=0;iObject.keys(e).length===0,S=(e,r,a)=>{const i=mo(e,`colors.${r}`,r);try{return ho(i),i}catch{return a??"#000000"}},yo=e=>{const[r,a,i]=$r(e);return(r*299+a*587+i*114)/1e3},So=e=>r=>{const a=S(r,e);return yo(a)<128?"dark":"light"},po=e=>r=>So(e)(r)==="dark",ae=(e,r)=>a=>{const i=S(a,e);return fo(i,1-r)};function Mr(e="1rem",r="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( + 45deg, + ${r} 25%, + transparent 25%, + transparent 50%, + ${r} 50%, + ${r} 75%, + transparent 75%, + transparent + )`,backgroundSize:`${e} ${e}`}}var xo=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function $o(e){const r=xo();return!e||go(e)?r:e.string&&e.colors?_o(e.string,e.colors):e.string&&!e.colors?ko(e.string):e.colors&&!e.string?wo(e.colors):r}function ko(e){let r=0;if(e.length===0)return r.toString();for(let i=0;i>i*8&255;a+=`00${n.toString(16)}`.substr(-2)}return a}function _o(e,r){let a=0;if(e.length===0)return r[0];for(let i=0;ir.map(Ma).join(` ${e} `).replace(/calc/g,""),Br=(...e)=>`calc(${Je("+",...e)})`,Er=(...e)=>`calc(${Je("-",...e)})`,gr=(...e)=>`calc(${Je("*",...e)})`,Dr=(...e)=>`calc(${Je("/",...e)})`,Rr=e=>{const r=Ma(e);return r!=null&&!Number.isNaN(parseFloat(r))?String(r).startsWith("-")?String(r).slice(1):`-${r}`:gr(r,-1)},T=Object.assign(e=>({add:(...r)=>T(Br(e,...r)),subtract:(...r)=>T(Er(e,...r)),multiply:(...r)=>T(gr(e,...r)),divide:(...r)=>T(Dr(e,...r)),negate:()=>T(Rr(e)),toString:()=>e.toString()}),{add:Br,subtract:Er,multiply:gr,divide:Dr,negate:Rr});function zo(e){return!Number.isInteger(parseFloat(e.toString()))}function Co(e,r="-"){return e.replace(/\s+/g,r)}function Ba(e){const r=Co(e.toString());return r.includes("\\.")?e:zo(e)?r.replace(".","\\."):e}function Ao(e,r=""){return[r,Ba(e)].filter(Boolean).join("-")}function Po(e,r){return`var(${Ba(e)}${r?`, ${r}`:""})`}function Fo(e,r=""){return`--${Ao(e,r)}`}function f(e,r){const a=Fo(e,r==null?void 0:r.prefix);return{variable:a,reference:Po(a,Io(r==null?void 0:r.fallback))}}function Io(e){return typeof e=="string"?e:e==null?void 0:e.reference}var{defineMultiStyleConfig:To,definePartsStyle:We}=b(fa.keys),fe=f("switch-track-width"),V=f("switch-track-height"),rr=f("switch-track-diff"),Mo=T.subtract(fe,V),yr=f("switch-thumb-x"),le=f("switch-bg"),Bo=t(e=>{const{colorScheme:r}=e;return{borderRadius:"full",p:"0.5",width:[fe.reference],height:[V.reference],transitionProperty:"common",transitionDuration:"fast",[le.variable]:"colors.gray.300",_dark:{[le.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[le.variable]:`colors.${r}.500`,_dark:{[le.variable]:`colors.${r}.200`}},bg:le.reference}}),Eo=t({bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[V.reference],height:[V.reference],_checked:{transform:`translateX(${yr.reference})`}}),Do=We(e=>({container:{[rr.variable]:Mo,[yr.variable]:rr.reference,_rtl:{[yr.variable]:T(rr).negate().toString()}},track:Bo(e),thumb:Eo})),Ro={sm:We({container:{[fe.variable]:"1.375rem",[V.variable]:"sizes.3"}}),md:We({container:{[fe.variable]:"1.875rem",[V.variable]:"sizes.4"}}),lg:We({container:{[fe.variable]:"2.875rem",[V.variable]:"sizes.6"}})},jo=To({baseStyle:Do,sizes:Ro,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:Ho,definePartsStyle:J}=b(tt.keys),Wo=J({table:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full"},th:{fontFamily:"heading",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"wider",textAlign:"start"},td:{textAlign:"start"},caption:{mt:4,fontFamily:"heading",textAlign:"center",fontWeight:"medium"}}),Xe=t({"&[data-is-numeric=true]":{textAlign:"end"}}),Vo=J(e=>{const{colorScheme:r}=e;return{th:{color:o("gray.600","gray.400")(e),borderBottom:"1px",borderColor:o(`${r}.100`,`${r}.700`)(e),...Xe},td:{borderBottom:"1px",borderColor:o(`${r}.100`,`${r}.700`)(e),...Xe},caption:{color:o("gray.600","gray.100")(e)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),Lo=J(e=>{const{colorScheme:r}=e;return{th:{color:o("gray.600","gray.400")(e),borderBottom:"1px",borderColor:o(`${r}.100`,`${r}.700`)(e),...Xe},td:{borderBottom:"1px",borderColor:o(`${r}.100`,`${r}.700`)(e),...Xe},caption:{color:o("gray.600","gray.100")(e)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:o(`${r}.100`,`${r}.700`)(e)},td:{background:o(`${r}.100`,`${r}.700`)(e)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),qo={simple:Vo,striped:Lo,unstyled:t({})},Oo={sm:J({th:{px:"4",py:"1",lineHeight:"4",fontSize:"xs"},td:{px:"4",py:"2",fontSize:"sm",lineHeight:"4"},caption:{px:"4",py:"2",fontSize:"xs"}}),md:J({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:J({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},No=Ho({baseStyle:Wo,variants:qo,sizes:Oo,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),$=d("tabs-color"),z=d("tabs-bg"),Ae=d("tabs-border-color"),{defineMultiStyleConfig:Go,definePartsStyle:P}=b(ha.keys),Uo=t(e=>{const{orientation:r}=e;return{display:r==="vertical"?"flex":"block"}}),Xo=t(e=>{const{isFitted:r}=e;return{flex:r?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}}),Yo=t(e=>{const{align:r="start",orientation:a}=e;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[r],flexDirection:a==="vertical"?"column":"row"}}),Ko=t({p:4}),Zo=P(e=>({root:Uo(e),tab:Xo(e),tablist:Yo(e),tabpanel:Ko})),Jo={sm:P({tab:{py:1,px:4,fontSize:"sm"}}),md:P({tab:{fontSize:"md",py:2,px:4}}),lg:P({tab:{fontSize:"lg",py:3,px:4}})},Qo=P(e=>{const{colorScheme:r,orientation:a}=e,i=a==="vertical",n=i?"borderStart":"borderBottom",l=i?"marginStart":"marginBottom";return{tablist:{[n]:"2px solid",borderColor:"inherit"},tab:{[n]:"2px solid",borderColor:"transparent",[l]:"-2px",_selected:{[$.variable]:`colors.${r}.600`,_dark:{[$.variable]:`colors.${r}.300`},borderColor:"currentColor"},_active:{[z.variable]:"colors.gray.200",_dark:{[z.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:$.reference,bg:z.reference}}}),ei=P(e=>{const{colorScheme:r}=e;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[Ae.variable]:"transparent",_selected:{[$.variable]:`colors.${r}.600`,[Ae.variable]:"colors.white",_dark:{[$.variable]:`colors.${r}.300`,[Ae.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:Ae.reference},color:$.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),ri=P(e=>{const{colorScheme:r}=e;return{tab:{border:"1px solid",borderColor:"inherit",[z.variable]:"colors.gray.50",_dark:{[z.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[z.variable]:"colors.white",[$.variable]:`colors.${r}.600`,_dark:{[z.variable]:"colors.gray.800",[$.variable]:`colors.${r}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:$.reference,bg:z.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),ai=P(e=>{const{colorScheme:r,theme:a}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:S(a,`${r}.700`),bg:S(a,`${r}.100`)}}}}),ti=P(e=>{const{colorScheme:r}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",[$.variable]:"colors.gray.600",_dark:{[$.variable]:"inherit"},_selected:{[$.variable]:"colors.white",[z.variable]:`colors.${r}.600`,_dark:{[$.variable]:"colors.gray.800",[z.variable]:`colors.${r}.300`}},color:$.reference,bg:z.reference}}}),oi=P({}),ii={line:Qo,enclosed:ei,"enclosed-colored":ri,"soft-rounded":ai,"solid-rounded":ti,unstyled:oi},ni=Go({baseStyle:Zo,sizes:Jo,variants:ii,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),g=Ka("badge",["bg","color","shadow"]),li=t({px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold",bg:g.bg.reference,color:g.color.reference,boxShadow:g.shadow.reference}),si=t(e=>{const{colorScheme:r,theme:a}=e,i=ae(`${r}.500`,.6)(a);return{[g.bg.variable]:`colors.${r}.500`,[g.color.variable]:"colors.white",_dark:{[g.bg.variable]:i,[g.color.variable]:"colors.whiteAlpha.800"}}}),di=t(e=>{const{colorScheme:r,theme:a}=e,i=ae(`${r}.200`,.16)(a);return{[g.bg.variable]:`colors.${r}.100`,[g.color.variable]:`colors.${r}.800`,_dark:{[g.bg.variable]:i,[g.color.variable]:`colors.${r}.200`}}}),ci=t(e=>{const{colorScheme:r,theme:a}=e,i=ae(`${r}.200`,.8)(a);return{[g.color.variable]:`colors.${r}.500`,_dark:{[g.color.variable]:i},[g.shadow.variable]:`inset 0 0 0px 1px ${g.color.reference}`}}),bi={solid:si,subtle:di,outline:ci},he=h({baseStyle:li,variants:bi,defaultProps:{variant:"subtle",colorScheme:"gray"}}),{defineMultiStyleConfig:vi,definePartsStyle:L}=b(ot.keys),jr=d("tag-bg"),Hr=d("tag-color"),ar=d("tag-shadow"),Ve=d("tag-min-height"),Le=d("tag-min-width"),qe=d("tag-font-size"),Oe=d("tag-padding-inline"),ui=t({fontWeight:"medium",lineHeight:1.2,outline:0,[Hr.variable]:g.color.reference,[jr.variable]:g.bg.reference,[ar.variable]:g.shadow.reference,color:Hr.reference,bg:jr.reference,boxShadow:ar.reference,borderRadius:"md",minH:Ve.reference,minW:Le.reference,fontSize:qe.reference,px:Oe.reference,_focusVisible:{[ar.variable]:"shadows.outline"}}),fi=t({lineHeight:1.2,overflow:"visible"}),hi=t({fontSize:"lg",w:"5",h:"5",transitionProperty:"common",transitionDuration:"normal",borderRadius:"full",marginStart:"1.5",marginEnd:"-1",opacity:.5,_disabled:{opacity:.4},_focusVisible:{boxShadow:"outline",bg:"rgba(0, 0, 0, 0.14)"},_hover:{opacity:.8},_active:{opacity:1}}),mi=L({container:ui,label:fi,closeButton:hi}),gi={sm:L({container:{[Ve.variable]:"sizes.5",[Le.variable]:"sizes.5",[qe.variable]:"fontSizes.xs",[Oe.variable]:"space.2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:L({container:{[Ve.variable]:"sizes.6",[Le.variable]:"sizes.6",[qe.variable]:"fontSizes.sm",[Oe.variable]:"space.2"}}),lg:L({container:{[Ve.variable]:"sizes.8",[Le.variable]:"sizes.8",[qe.variable]:"fontSizes.md",[Oe.variable]:"space.3"}})},yi={subtle:L(e=>{var r;return{container:(r=he.variants)==null?void 0:r.subtle(e)}}),solid:L(e=>{var r;return{container:(r=he.variants)==null?void 0:r.solid(e)}}),outline:L(e=>{var r;return{container:(r=he.variants)==null?void 0:r.outline(e)}})},Si=vi({variants:yi,baseStyle:mi,sizes:gi,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:M,defineMultiStyleConfig:pi}=b(ma.keys),X=d("input-height"),Y=d("input-font-size"),K=d("input-padding"),Z=d("input-border-radius"),xi=M({addon:{height:X.reference,fontSize:Y.reference,px:K.reference,borderRadius:Z.reference},field:{width:"100%",height:X.reference,fontSize:Y.reference,px:K.reference,borderRadius:Z.reference,minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),D={lg:t({[Y.variable]:"fontSizes.lg",[K.variable]:"space.4",[Z.variable]:"radii.md",[X.variable]:"sizes.12"}),md:t({[Y.variable]:"fontSizes.md",[K.variable]:"space.4",[Z.variable]:"radii.md",[X.variable]:"sizes.10"}),sm:t({[Y.variable]:"fontSizes.sm",[K.variable]:"space.3",[Z.variable]:"radii.sm",[X.variable]:"sizes.8"}),xs:t({[Y.variable]:"fontSizes.xs",[K.variable]:"space.2",[Z.variable]:"radii.sm",[X.variable]:"sizes.6"})},$i={lg:M({field:D.lg,group:D.lg}),md:M({field:D.md,group:D.md}),sm:M({field:D.sm,group:D.sm}),xs:M({field:D.xs,group:D.xs})};function kr(e){const{focusBorderColor:r,errorBorderColor:a}=e;return{focusBorderColor:r||o("blue.500","blue.300")(e),errorBorderColor:a||o("red.500","red.300")(e)}}var ki=M(e=>{const{theme:r}=e,{focusBorderColor:a,errorBorderColor:i}=kr(e);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:o("gray.300","whiteAlpha.400")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:S(r,i),boxShadow:`0 0 0 1px ${S(r,i)}`},_focusVisible:{zIndex:1,borderColor:S(r,a),boxShadow:`0 0 0 1px ${S(r,a)}`}},addon:{border:"1px solid",borderColor:o("inherit","whiteAlpha.50")(e),bg:o("gray.100","whiteAlpha.300")(e)}}}),_i=M(e=>{const{theme:r}=e,{focusBorderColor:a,errorBorderColor:i}=kr(e);return{field:{border:"2px solid",borderColor:"transparent",bg:o("gray.100","whiteAlpha.50")(e),_hover:{bg:o("gray.200","whiteAlpha.100")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:S(r,i)},_focusVisible:{bg:"transparent",borderColor:S(r,a)}},addon:{border:"2px solid",borderColor:"transparent",bg:o("gray.100","whiteAlpha.50")(e)}}}),wi=M(e=>{const{theme:r}=e,{focusBorderColor:a,errorBorderColor:i}=kr(e);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:S(r,i),boxShadow:`0px 1px 0px 0px ${S(r,i)}`},_focusVisible:{borderColor:S(r,a),boxShadow:`0px 1px 0px 0px ${S(r,a)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),zi=M({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),Ci={outline:ki,filled:_i,flushed:wi,unstyled:zi},u=pi({baseStyle:xi,sizes:$i,variants:Ci,defaultProps:{size:"md",variant:"outline"}}),Wr,Ai=t({...(Wr=u.baseStyle)==null?void 0:Wr.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"}),Vr,Lr,Pi={outline:t(e=>{var r,a;return(a=(r=u.variants)==null?void 0:r.outline(e).field)!=null?a:{}}),flushed:t(e=>{var r,a;return(a=(r=u.variants)==null?void 0:r.flushed(e).field)!=null?a:{}}),filled:t(e=>{var r,a;return(a=(r=u.variants)==null?void 0:r.filled(e).field)!=null?a:{}}),unstyled:(Lr=(Vr=u.variants)==null?void 0:Vr.unstyled.field)!=null?Lr:{}},qr,Or,Nr,Gr,Ur,Xr,Yr,Kr,Fi={xs:(Or=(qr=u.sizes)==null?void 0:qr.xs.field)!=null?Or:{},sm:(Gr=(Nr=u.sizes)==null?void 0:Nr.sm.field)!=null?Gr:{},md:(Xr=(Ur=u.sizes)==null?void 0:Ur.md.field)!=null?Xr:{},lg:(Kr=(Yr=u.sizes)==null?void 0:Yr.lg.field)!=null?Kr:{}},Ii=h({baseStyle:Ai,sizes:Fi,variants:Pi,defaultProps:{size:"md",variant:"outline"}}),Pe=f("tooltip-bg"),tr=f("tooltip-fg"),Ti=f("popper-arrow-bg"),Mi=t({bg:Pe.reference,color:tr.reference,[Pe.variable]:"colors.gray.700",[tr.variable]:"colors.whiteAlpha.900",_dark:{[Pe.variable]:"colors.gray.300",[tr.variable]:"colors.gray.900"},[Ti.variable]:Pe.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"}),Bi=h({baseStyle:Mi}),{defineMultiStyleConfig:Ei,definePartsStyle:ve}=b(ga.keys),Di=t(e=>{const{colorScheme:r,theme:a,isIndeterminate:i,hasStripe:n}=e,l=o(Mr(),Mr("1rem","rgba(0,0,0,0.1)"))(e),s=o(`${r}.500`,`${r}.200`)(e),c=`linear-gradient( + to right, + transparent 0%, + ${S(a,s)} 50%, + transparent 100% + )`;return{...!i&&n&&l,...i?{bgImage:c}:{bgColor:s}}}),Ri=t({lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"}),ji=t(e=>({bg:o("gray.100","whiteAlpha.300")(e)})),Hi=t(e=>({transitionProperty:"common",transitionDuration:"slow",...Di(e)})),Wi=ve(e=>({label:Ri,filledTrack:Hi(e),track:ji(e)})),Vi={xs:ve({track:{h:"1"}}),sm:ve({track:{h:"2"}}),md:ve({track:{h:"3"}}),lg:ve({track:{h:"4"}})},Li=Ei({sizes:Vi,baseStyle:Wi,defaultProps:{size:"md",colorScheme:"blue"}}),qi=e=>typeof e=="function";function p(e,...r){return qi(e)?e(...r):e}var{definePartsStyle:Ne,defineMultiStyleConfig:Oi}=b(ya.keys),me=d("checkbox-size"),Ni=t(e=>{const{colorScheme:r}=e;return{w:me.reference,h:me.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:o(`${r}.500`,`${r}.200`)(e),borderColor:o(`${r}.500`,`${r}.200`)(e),color:o("white","gray.900")(e),_hover:{bg:o(`${r}.600`,`${r}.300`)(e),borderColor:o(`${r}.600`,`${r}.300`)(e)},_disabled:{borderColor:o("gray.200","transparent")(e),bg:o("gray.200","whiteAlpha.300")(e),color:o("gray.500","whiteAlpha.500")(e)}},_indeterminate:{bg:o(`${r}.500`,`${r}.200`)(e),borderColor:o(`${r}.500`,`${r}.200`)(e),color:o("white","gray.900")(e)},_disabled:{bg:o("gray.100","whiteAlpha.100")(e),borderColor:o("gray.100","transparent")(e)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:o("red.500","red.300")(e)}}}),Gi=t({_disabled:{cursor:"not-allowed"}}),Ui=t({userSelect:"none",_disabled:{opacity:.4}}),Xi=t({transitionProperty:"transform",transitionDuration:"normal"}),Yi=Ne(e=>({icon:Xi,container:Gi,control:p(Ni,e),label:Ui})),Ki={sm:Ne({control:{[me.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:Ne({control:{[me.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:Ne({control:{[me.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},Ye=Oi({baseStyle:Yi,sizes:Ki,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:Zi,definePartsStyle:Ge}=b(it.keys),Ji=t(e=>{var r;const a=(r=p(Ye.baseStyle,e))==null?void 0:r.control;return{...a,borderRadius:"full",_checked:{...a==null?void 0:a._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}}),Qi=Ge(e=>{var r,a,i,n;return{label:(a=(r=Ye).baseStyle)==null?void 0:a.call(r,e).label,container:(n=(i=Ye).baseStyle)==null?void 0:n.call(i,e).container,control:Ji(e)}}),en={md:Ge({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:Ge({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:Ge({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},rn=Zi({baseStyle:Qi,sizes:en,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:an,definePartsStyle:tn}=b(Sa.keys),Fe=d("select-bg"),Zr,on=t({...(Zr=u.baseStyle)==null?void 0:Zr.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:Fe.reference,[Fe.variable]:"colors.white",_dark:{[Fe.variable]:"colors.gray.700"},"> option, > optgroup":{bg:Fe.reference}}),nn=t({width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}}),ln=tn({field:on,icon:nn}),Ie=t({paddingInlineEnd:"8"}),Jr,Qr,ea,ra,aa,ta,oa,ia,sn={lg:{...(Jr=u.sizes)==null?void 0:Jr.lg,field:{...(Qr=u.sizes)==null?void 0:Qr.lg.field,...Ie}},md:{...(ea=u.sizes)==null?void 0:ea.md,field:{...(ra=u.sizes)==null?void 0:ra.md.field,...Ie}},sm:{...(aa=u.sizes)==null?void 0:aa.sm,field:{...(ta=u.sizes)==null?void 0:ta.sm.field,...Ie}},xs:{...(oa=u.sizes)==null?void 0:oa.xs,field:{...(ia=u.sizes)==null?void 0:ia.xs.field,...Ie},icon:{insetEnd:"1"}}},dn=an({baseStyle:ln,sizes:sn,variants:u.variants,defaultProps:u.defaultProps}),or=d("skeleton-start-color"),ir=d("skeleton-end-color"),cn=t({[or.variable]:"colors.gray.100",[ir.variable]:"colors.gray.400",_dark:{[or.variable]:"colors.gray.800",[ir.variable]:"colors.gray.600"},background:or.reference,borderColor:ir.reference,opacity:.7,borderRadius:"sm"}),bn=h({baseStyle:cn}),nr=d("skip-link-bg"),vn=t({borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[nr.variable]:"colors.white",_dark:{[nr.variable]:"colors.gray.700"},bg:nr.reference}}),un=h({baseStyle:vn}),{defineMultiStyleConfig:fn,definePartsStyle:Qe}=b(pa.keys),pe=d("slider-thumb-size"),xe=d("slider-track-size"),j=d("slider-bg"),hn=t(e=>{const{orientation:r}=e;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...xr({orientation:r,vertical:{h:"100%"},horizontal:{w:"100%"}})}}),mn=t(e=>({...xr({orientation:e.orientation,horizontal:{h:xe.reference},vertical:{w:xe.reference}}),overflow:"hidden",borderRadius:"sm",[j.variable]:"colors.gray.200",_dark:{[j.variable]:"colors.whiteAlpha.200"},_disabled:{[j.variable]:"colors.gray.300",_dark:{[j.variable]:"colors.whiteAlpha.300"}},bg:j.reference})),gn=t(e=>{const{orientation:r}=e;return{...xr({orientation:r,vertical:{left:"50%",transform:"translateX(-50%)",_active:{transform:"translateX(-50%) scale(1.15)"}},horizontal:{top:"50%",transform:"translateY(-50%)",_active:{transform:"translateY(-50%) scale(1.15)"}}}),w:pe.reference,h:pe.reference,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0,zIndex:1,borderRadius:"full",bg:"white",boxShadow:"base",border:"1px solid",borderColor:"transparent",transitionProperty:"transform",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{bg:"gray.300"}}}),yn=t(e=>{const{colorScheme:r}=e;return{width:"inherit",height:"inherit",[j.variable]:`colors.${r}.500`,_dark:{[j.variable]:`colors.${r}.200`},bg:j.reference}}),Sn=Qe(e=>({container:hn(e),track:mn(e),thumb:gn(e),filledTrack:yn(e)})),pn=Qe({container:{[pe.variable]:"sizes.4",[xe.variable]:"sizes.1"}}),xn=Qe({container:{[pe.variable]:"sizes.3.5",[xe.variable]:"sizes.1"}}),$n=Qe({container:{[pe.variable]:"sizes.2.5",[xe.variable]:"sizes.0.5"}}),kn={lg:pn,md:xn,sm:$n},_n=fn({baseStyle:Sn,sizes:kn,defaultProps:{size:"md",colorScheme:"blue"}}),H=f("spinner-size"),wn=t({width:[H.reference],height:[H.reference]}),zn={xs:t({[H.variable]:"sizes.3"}),sm:t({[H.variable]:"sizes.4"}),md:t({[H.variable]:"sizes.6"}),lg:t({[H.variable]:"sizes.8"}),xl:t({[H.variable]:"sizes.12"})},Cn=h({baseStyle:wn,sizes:zn,defaultProps:{size:"md"}}),{defineMultiStyleConfig:An,definePartsStyle:Ea}=b(nt.keys),Pn=t({fontWeight:"medium"}),Fn=t({opacity:.8,marginBottom:"2"}),In=t({verticalAlign:"baseline",fontWeight:"semibold"}),Tn=t({marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"}),Mn=Ea({container:{},label:Pn,helpText:Fn,number:In,icon:Tn}),Bn={md:Ea({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},En=An({baseStyle:Mn,sizes:Bn,defaultProps:{size:"md"}}),lr=d("kbd-bg"),Dn=t({[lr.variable]:"colors.gray.100",_dark:{[lr.variable]:"colors.whiteAlpha.100"},bg:lr.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"}),Rn=h({baseStyle:Dn}),jn=t({transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}}),Hn=h({baseStyle:jn}),{defineMultiStyleConfig:Wn,definePartsStyle:Vn}=b(lt.keys),Ln=t({marginEnd:"2",display:"inline",verticalAlign:"text-bottom"}),qn=Vn({icon:Ln}),On=Wn({baseStyle:qn}),{defineMultiStyleConfig:Nn,definePartsStyle:Gn}=b(st.keys),A=d("menu-bg"),sr=d("menu-shadow"),Un=t({[A.variable]:"#fff",[sr.variable]:"shadows.sm",_dark:{[A.variable]:"colors.gray.700",[sr.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:A.reference,boxShadow:sr.reference}),Xn=t({py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[A.variable]:"colors.gray.100",_dark:{[A.variable]:"colors.whiteAlpha.100"}},_active:{[A.variable]:"colors.gray.200",_dark:{[A.variable]:"colors.whiteAlpha.200"}},_expanded:{[A.variable]:"colors.gray.100",_dark:{[A.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:A.reference}),Yn=t({mx:4,my:2,fontWeight:"semibold",fontSize:"sm"}),Kn=t({display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0}),Zn=t({opacity:.6}),Jn=t({border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6}),Qn=t({transitionProperty:"common",transitionDuration:"normal"}),el=Gn({button:Qn,list:Un,item:Xn,groupTitle:Yn,icon:Kn,command:Zn,divider:Jn}),rl=Nn({baseStyle:el}),{defineMultiStyleConfig:al,definePartsStyle:Sr}=b(xa.keys),dr=d("modal-bg"),cr=d("modal-shadow"),tl=t({bg:"blackAlpha.600",zIndex:"modal"}),ol=t(e=>{const{isCentered:r,scrollBehavior:a}=e;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:r?"center":"flex-start",overflow:a==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}}),il=t(e=>{const{isCentered:r,scrollBehavior:a}=e;return{borderRadius:"md",color:"inherit",my:r?"auto":"16",mx:r?"auto":void 0,zIndex:"modal",maxH:a==="inside"?"calc(100% - 7.5rem)":void 0,[dr.variable]:"colors.white",[cr.variable]:"shadows.lg",_dark:{[dr.variable]:"colors.gray.700",[cr.variable]:"shadows.dark-lg"},bg:dr.reference,boxShadow:cr.reference}}),nl=t({px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"}),ll=t({position:"absolute",top:"2",insetEnd:"3"}),sl=t(e=>{const{scrollBehavior:r}=e;return{px:"6",py:"2",flex:"1",overflow:r==="inside"?"auto":void 0}}),dl=t({px:"6",py:"4"}),cl=Sr(e=>({overlay:tl,dialogContainer:p(ol,e),dialog:p(il,e),header:nl,closeButton:ll,body:p(sl,e),footer:dl}));function w(e){return Sr(e==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:e}})}var bl={xs:w("xs"),sm:w("sm"),md:w("md"),lg:w("lg"),xl:w("xl"),"2xl":w("2xl"),"3xl":w("3xl"),"4xl":w("4xl"),"5xl":w("5xl"),"6xl":w("6xl"),full:w("full")},vl=al({baseStyle:cl,sizes:bl,defaultProps:{size:"md"}}),{defineMultiStyleConfig:ul,definePartsStyle:Da}=b($a.keys),_r=f("number-input-stepper-width"),Ra=f("number-input-input-padding"),fl=T(_r).add("0.5rem").toString(),br=f("number-input-bg"),vr=f("number-input-color"),ur=f("number-input-border-color"),hl=t({[_r.variable]:"sizes.6",[Ra.variable]:fl}),ml=t(e=>{var r,a;return(a=(r=p(u.baseStyle,e))==null?void 0:r.field)!=null?a:{}}),gl=t({width:_r.reference}),yl=t({borderStart:"1px solid",borderStartColor:ur.reference,color:vr.reference,bg:br.reference,[vr.variable]:"colors.chakra-body-text",[ur.variable]:"colors.chakra-border-color",_dark:{[vr.variable]:"colors.whiteAlpha.800",[ur.variable]:"colors.whiteAlpha.300"},_active:{[br.variable]:"colors.gray.200",_dark:{[br.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}}),Sl=Da(e=>{var r;return{root:hl,field:(r=p(ml,e))!=null?r:{},stepperGroup:gl,stepper:yl}});function Te(e){var r,a,i;const n=(r=u.sizes)==null?void 0:r[e],l={lg:"md",md:"md",sm:"sm",xs:"sm"},s=(i=(a=n.field)==null?void 0:a.fontSize)!=null?i:"md",c=Fa.fontSizes[s];return Da({field:{...n.field,paddingInlineEnd:Ra.reference,verticalAlign:"top"},stepper:{fontSize:T(c).multiply(.75).toString(),_first:{borderTopEndRadius:l[e]},_last:{borderBottomEndRadius:l[e],mt:"-1px",borderTopWidth:1}}})}var pl={xs:Te("xs"),sm:Te("sm"),md:Te("md"),lg:Te("lg")},xl=ul({baseStyle:Sl,sizes:pl,variants:u.variants,defaultProps:u.defaultProps}),na,$l=t({...(na=u.baseStyle)==null?void 0:na.field,textAlign:"center"}),kl={lg:t({fontSize:"lg",w:12,h:12,borderRadius:"md"}),md:t({fontSize:"md",w:10,h:10,borderRadius:"md"}),sm:t({fontSize:"sm",w:8,h:8,borderRadius:"sm"}),xs:t({fontSize:"xs",w:6,h:6,borderRadius:"sm"})},la,sa,_l={outline:t(e=>{var r,a,i;return(i=(a=p((r=u.variants)==null?void 0:r.outline,e))==null?void 0:a.field)!=null?i:{}}),flushed:t(e=>{var r,a,i;return(i=(a=p((r=u.variants)==null?void 0:r.flushed,e))==null?void 0:a.field)!=null?i:{}}),filled:t(e=>{var r,a,i;return(i=(a=p((r=u.variants)==null?void 0:r.filled,e))==null?void 0:a.field)!=null?i:{}}),unstyled:(sa=(la=u.variants)==null?void 0:la.unstyled.field)!=null?sa:{}},wl=h({baseStyle:$l,sizes:kl,variants:_l,defaultProps:u.defaultProps}),{defineMultiStyleConfig:zl,definePartsStyle:Cl}=b(ka.keys),Me=f("popper-bg"),Al=f("popper-arrow-bg"),da=f("popper-arrow-shadow-color"),Pl=t({zIndex:10}),Fl=t({[Me.variable]:"colors.white",bg:Me.reference,[Al.variable]:Me.reference,[da.variable]:"colors.gray.200",_dark:{[Me.variable]:"colors.gray.700",[da.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}}),Il=t({px:3,py:2,borderBottomWidth:"1px"}),Tl=t({px:3,py:2}),Ml=t({px:3,py:2,borderTopWidth:"1px"}),Bl=t({position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2}),El=Cl({popper:Pl,content:Fl,header:Il,body:Tl,footer:Ml,closeButton:Bl}),Dl=zl({baseStyle:El}),{definePartsStyle:pr,defineMultiStyleConfig:Rl}=b(dt.keys),fr=d("drawer-bg"),hr=d("drawer-box-shadow");function N(e){return pr(e==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:e}})}var jl=t({bg:"blackAlpha.600",zIndex:"overlay"}),Hl=t({display:"flex",zIndex:"modal",justifyContent:"center"}),Wl=t(e=>{const{isFullHeight:r}=e;return{...r&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[fr.variable]:"colors.white",[hr.variable]:"shadows.lg",_dark:{[fr.variable]:"colors.gray.700",[hr.variable]:"shadows.dark-lg"},bg:fr.reference,boxShadow:hr.reference}}),Vl=t({px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"}),Ll=t({position:"absolute",top:"2",insetEnd:"3"}),ql=t({px:"6",py:"2",flex:"1",overflow:"auto"}),Ol=t({px:"6",py:"4"}),Nl=pr(e=>({overlay:jl,dialogContainer:Hl,dialog:p(Wl,e),header:Vl,closeButton:Ll,body:ql,footer:Ol})),Gl={xs:N("xs"),sm:N("md"),md:N("lg"),lg:N("2xl"),xl:N("4xl"),full:N("full")},Ul=Rl({baseStyle:Nl,sizes:Gl,defaultProps:{size:"xs"}}),{definePartsStyle:Xl,defineMultiStyleConfig:Yl}=b(_a.keys),Kl=t({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"}),Zl=t({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}}),Jl=t({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}}),Ql=Xl({preview:Kl,input:Zl,textarea:Jl}),es=Yl({baseStyle:Ql}),{definePartsStyle:rs,defineMultiStyleConfig:as}=b(ct.keys),Q=d("form-control-color"),ts=t({marginStart:"1",[Q.variable]:"colors.red.500",_dark:{[Q.variable]:"colors.red.300"},color:Q.reference}),os=t({mt:"2",[Q.variable]:"colors.gray.600",_dark:{[Q.variable]:"colors.whiteAlpha.600"},color:Q.reference,lineHeight:"normal",fontSize:"sm"}),is=rs({container:{width:"100%",position:"relative"},requiredIndicator:ts,helperText:os}),ns=as({baseStyle:is}),{definePartsStyle:ls,defineMultiStyleConfig:ss}=b(bt.keys),ee=d("form-error-color"),ds=t({[ee.variable]:"colors.red.500",_dark:{[ee.variable]:"colors.red.300"},color:ee.reference,mt:"2",fontSize:"sm",lineHeight:"normal"}),cs=t({marginEnd:"0.5em",[ee.variable]:"colors.red.500",_dark:{[ee.variable]:"colors.red.300"},color:ee.reference}),bs=ls({text:ds,icon:cs}),vs=ss({baseStyle:bs}),us=t({fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}}),fs=h({baseStyle:us}),hs=t({fontFamily:"heading",fontWeight:"bold"}),ms={"4xl":t({fontSize:["6xl",null,"7xl"],lineHeight:1}),"3xl":t({fontSize:["5xl",null,"6xl"],lineHeight:1}),"2xl":t({fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]}),xl:t({fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]}),lg:t({fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]}),md:t({fontSize:"xl",lineHeight:1.2}),sm:t({fontSize:"md",lineHeight:1.2}),xs:t({fontSize:"sm",lineHeight:1.2})},gs=h({baseStyle:hs,sizes:ms,defaultProps:{size:"xl"}}),{defineMultiStyleConfig:ys,definePartsStyle:Ss}=b(vt.keys),mr=d("breadcrumb-link-decor"),ps=t({transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",outline:"none",color:"inherit",textDecoration:mr.reference,[mr.variable]:"none","&:not([aria-current=page])":{cursor:"pointer",_hover:{[mr.variable]:"underline"},_focusVisible:{boxShadow:"outline"}}}),xs=Ss({link:ps}),$s=ys({baseStyle:xs}),ks=t({lineHeight:"1.2",borderRadius:"md",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{_disabled:{bg:"initial"}}}),ja=t(e=>{const{colorScheme:r,theme:a}=e;if(r==="gray")return{color:o("gray.800","whiteAlpha.900")(e),_hover:{bg:o("gray.100","whiteAlpha.200")(e)},_active:{bg:o("gray.200","whiteAlpha.300")(e)}};const i=ae(`${r}.200`,.12)(a),n=ae(`${r}.200`,.24)(a);return{color:o(`${r}.600`,`${r}.200`)(e),bg:"transparent",_hover:{bg:o(`${r}.50`,i)(e)},_active:{bg:o(`${r}.100`,n)(e)}}}),_s=t(e=>{const{colorScheme:r}=e,a=o("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:r==="gray"?a:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"},...p(ja,e)}}),ws={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},zs=t(e=>{var r;const{colorScheme:a}=e;if(a==="gray"){const v=o("gray.100","whiteAlpha.200")(e);return{bg:v,color:o("gray.800","whiteAlpha.900")(e),_hover:{bg:o("gray.200","whiteAlpha.300")(e),_disabled:{bg:v}},_active:{bg:o("gray.300","whiteAlpha.400")(e)}}}const{bg:i=`${a}.500`,color:n="white",hoverBg:l=`${a}.600`,activeBg:s=`${a}.700`}=(r=ws[a])!=null?r:{},c=o(i,`${a}.200`)(e);return{bg:c,color:o(n,"gray.800")(e),_hover:{bg:o(l,`${a}.300`)(e),_disabled:{bg:c}},_active:{bg:o(s,`${a}.400`)(e)}}}),Cs=t(e=>{const{colorScheme:r}=e;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:o(`${r}.500`,`${r}.200`)(e),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:o(`${r}.700`,`${r}.500`)(e)}}}),As=t({bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"}),Ps={ghost:ja,outline:_s,solid:zs,link:Cs,unstyled:As},Fs={lg:t({h:"12",minW:"12",fontSize:"lg",px:"6"}),md:t({h:"10",minW:"10",fontSize:"md",px:"4"}),sm:t({h:"8",minW:"8",fontSize:"sm",px:"3"}),xs:t({h:"6",minW:"6",fontSize:"xs",px:"2"})},Is=h({baseStyle:ks,variants:Ps,sizes:Fs,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}}),{definePartsStyle:q,defineMultiStyleConfig:Ts}=b(ut.keys),Ke=d("card-bg"),B=d("card-padding"),Ha=d("card-shadow"),Ue=d("card-radius"),Wa=d("card-border-width","0"),Va=d("card-border-color"),Ms=q({container:{[Ke.variable]:"colors.chakra-body-bg",backgroundColor:Ke.reference,boxShadow:Ha.reference,borderRadius:Ue.reference,color:"chakra-body-text",borderWidth:Wa.reference,borderColor:Va.reference},body:{padding:B.reference,flex:"1 1 0%"},header:{padding:B.reference},footer:{padding:B.reference}}),Bs={sm:q({container:{[Ue.variable]:"radii.base",[B.variable]:"space.3"}}),md:q({container:{[Ue.variable]:"radii.md",[B.variable]:"space.5"}}),lg:q({container:{[Ue.variable]:"radii.xl",[B.variable]:"space.7"}})},Es={elevated:q({container:{[Ha.variable]:"shadows.base",_dark:{[Ke.variable]:"colors.gray.700"}}}),outline:q({container:{[Wa.variable]:"1px",[Va.variable]:"colors.chakra-border-color"}}),filled:q({container:{[Ke.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[B.variable]:0},header:{[B.variable]:0},footer:{[B.variable]:0}}},Ds=Ts({baseStyle:Ms,variants:Es,sizes:Bs,defaultProps:{variant:"elevated",size:"md"}}),ge=f("close-button-size"),se=f("close-button-bg"),Rs=t({w:[ge.reference],h:[ge.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[se.variable]:"colors.blackAlpha.100",_dark:{[se.variable]:"colors.whiteAlpha.100"}},_active:{[se.variable]:"colors.blackAlpha.200",_dark:{[se.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:se.reference}),js={lg:t({[ge.variable]:"sizes.10",fontSize:"md"}),md:t({[ge.variable]:"sizes.8",fontSize:"xs"}),sm:t({[ge.variable]:"sizes.6",fontSize:"2xs"})},Hs=h({baseStyle:Rs,sizes:js,defaultProps:{size:"md"}}),{variants:Ws,defaultProps:Vs}=he,Ls=t({fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm",bg:g.bg.reference,color:g.color.reference,boxShadow:g.shadow.reference}),qs=h({baseStyle:Ls,variants:Ws,defaultProps:Vs}),Os=t({w:"100%",mx:"auto",maxW:"prose",px:"4"}),Ns=h({baseStyle:Os}),Gs=t({opacity:.6,borderColor:"inherit"}),Us=t({borderStyle:"solid"}),Xs=t({borderStyle:"dashed"}),Ys={solid:Us,dashed:Xs},Ks=h({baseStyle:Gs,variants:Ys,defaultProps:{variant:"solid"}}),{definePartsStyle:Zs,defineMultiStyleConfig:Js}=b(wa.keys),Qs=t({borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}}),e0=t({transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"}),r0=t({pt:"2",px:"4",pb:"5"}),a0=t({fontSize:"1.25em"}),t0=Zs({container:Qs,button:e0,panel:r0,icon:a0}),o0=Js({baseStyle:t0}),{definePartsStyle:ke,defineMultiStyleConfig:i0}=b(ft.keys),k=d("alert-fg"),E=d("alert-bg"),n0=ke({container:{bg:E.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:k.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:k.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function wr(e){const{theme:r,colorScheme:a}=e,i=ae(`${a}.200`,.16)(r);return{light:`colors.${a}.100`,dark:i}}var l0=ke(e=>{const{colorScheme:r}=e,a=wr(e);return{container:{[k.variable]:`colors.${r}.500`,[E.variable]:a.light,_dark:{[k.variable]:`colors.${r}.200`,[E.variable]:a.dark}}}}),s0=ke(e=>{const{colorScheme:r}=e,a=wr(e);return{container:{[k.variable]:`colors.${r}.500`,[E.variable]:a.light,_dark:{[k.variable]:`colors.${r}.200`,[E.variable]:a.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:k.reference}}}),d0=ke(e=>{const{colorScheme:r}=e,a=wr(e);return{container:{[k.variable]:`colors.${r}.500`,[E.variable]:a.light,_dark:{[k.variable]:`colors.${r}.200`,[E.variable]:a.dark},pt:"2",borderTopWidth:"4px",borderTopColor:k.reference}}}),c0=ke(e=>{const{colorScheme:r}=e;return{container:{[k.variable]:"colors.white",[E.variable]:`colors.${r}.500`,_dark:{[k.variable]:"colors.gray.900",[E.variable]:`colors.${r}.200`},color:k.reference}}}),b0={subtle:l0,"left-accent":s0,"top-accent":d0,solid:c0},v0=i0({baseStyle:n0,variants:b0,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:La,defineMultiStyleConfig:u0}=b(ht.keys),re=d("avatar-border-color"),ye=d("avatar-bg"),$e=d("avatar-font-size"),te=d("avatar-size"),f0=t({borderRadius:"full",border:"0.2em solid",borderColor:re.reference,[re.variable]:"white",_dark:{[re.variable]:"colors.gray.800"}}),h0=t({bg:ye.reference,fontSize:$e.reference,width:te.reference,height:te.reference,lineHeight:"1",[ye.variable]:"colors.gray.200",_dark:{[ye.variable]:"colors.whiteAlpha.400"}}),m0=t(e=>{const{name:r,theme:a}=e,i=r?$o({string:r}):"colors.gray.400",n=po(i)(a);let l="white";return n||(l="gray.800"),{bg:ye.reference,fontSize:$e.reference,color:l,borderColor:re.reference,verticalAlign:"top",width:te.reference,height:te.reference,"&:not([data-loaded])":{[ye.variable]:i},[re.variable]:"colors.white",_dark:{[re.variable]:"colors.gray.800"}}}),g0=t({fontSize:$e.reference,lineHeight:"1"}),y0=La(e=>({badge:p(f0,e),excessLabel:p(h0,e),container:p(m0,e),label:g0}));function R(e){const r=e!=="100%"?Ta[e]:void 0;return La({container:{[te.variable]:r??e,[$e.variable]:`calc(${r??e} / 2.5)`},excessLabel:{[te.variable]:r??e,[$e.variable]:`calc(${r??e} / 2.5)`}})}var S0={"2xs":R(4),xs:R(6),sm:R(8),md:R(12),lg:R(16),xl:R(24),"2xl":R(32),full:R("100%")},p0=u0({baseStyle:y0,sizes:S0,defaultProps:{size:"md"}}),x0={Accordion:o0,Alert:v0,Avatar:p0,Badge:he,Breadcrumb:$s,Button:Is,Checkbox:Ye,CloseButton:Hs,Code:qs,Container:Ns,Divider:Ks,Drawer:Ul,Editable:es,Form:ns,FormError:vs,FormLabel:fs,Heading:gs,Input:u,Kbd:Rn,Link:Hn,List:On,Menu:rl,Modal:vl,NumberInput:xl,PinInput:wl,Popover:Dl,Progress:Li,Radio:rn,Select:dn,Skeleton:bn,SkipLink:un,Slider:_n,Spinner:Cn,Stat:En,Switch:jo,Table:No,Tabs:ni,Tag:Si,Textarea:Ii,Tooltip:Bi,Card:Ds,Stepper:ro},$0={colors:{"chakra-body-text":{_light:"gray.800",_dark:"whiteAlpha.900"},"chakra-body-bg":{_light:"white",_dark:"gray.800"},"chakra-border-color":{_light:"gray.200",_dark:"whiteAlpha.300"},"chakra-inverse-text":{_light:"white",_dark:"gray.800"},"chakra-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-subtle-text":{_light:"gray.600",_dark:"gray.400"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},k0={global:{body:{fontFamily:"body",color:"chakra-body-text",bg:"chakra-body-bg",transitionProperty:"background-color",transitionDuration:"normal",lineHeight:"base"},"*::placeholder":{color:"chakra-placeholder-color"},"*, *::before, &::after":{borderColor:"chakra-border-color"}}},_0="ltr",w0={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},qa={semanticTokens:$0,direction:_0,...Jt,components:x0,styles:k0,config:w0};function ue(e){return typeof e=="function"}function z0(...e){return r=>e.reduce((a,i)=>i(a),r)}var C0=e=>function(...a){let i=[...a],n=a[a.length-1];return At(n)&&i.length>1?i=i.slice(0,i.length-1):n=e,z0(...i.map(l=>s=>ue(l)?l(s):P0(s,l)))(n)},A0=C0(qa);function P0(...e){return ua({},...e,Oa)}function Oa(e,r,a,i){if((ue(e)||ue(r))&&Object.prototype.hasOwnProperty.call(i,a))return(...n)=>{const l=ue(e)?e(...n):e,s=ue(r)?r(...n):r;return ua({},l,s,Oa)}}function F0(e={}){const{strict:r=!0,errorMessage:a="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:i}=e,n=y.createContext(void 0);n.displayName=i;function l(){var s;const c=y.useContext(n);if(!c&&r){const v=new Error(a);throw v.name="ContextError",(s=Error.captureStackTrace)==null||s.call(Error,v,l),v}return c}return[n.Provider,l,n]}function I0(e){const{cssVarsRoot:r,theme:a,children:i}=e,n=y.useMemo(()=>Za(a),[a]);return m.jsxs(Ja,{theme:n,children:[m.jsx(T0,{root:r}),i]})}function T0({root:e=":host, :root"}){const r=[e,"[data-theme]"].join(",");return m.jsx(Ze,{styles:a=>({[r]:a.__cssVars})})}F0({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function M0(){const{colorMode:e}=Qa();return m.jsx(Ze,{styles:r=>{const a=et(r,"styles.global"),i=rt(a,{theme:r,colorMode:e});return i?at(i)(r):void 0}})}var Na=y.createContext({getDocument(){return document},getWindow(){return window}});Na.displayName="EnvironmentContext";function Ga(e){const{children:r,environment:a,disabled:i}=e,n=y.useRef(null),l=y.useMemo(()=>a||{getDocument:()=>{var c,v;return(v=(c=n.current)==null?void 0:c.ownerDocument)!=null?v:document},getWindow:()=>{var c,v;return(v=(c=n.current)==null?void 0:c.ownerDocument.defaultView)!=null?v:window}},[a]),s=!i||!a;return m.jsxs(Na.Provider,{value:l,children:[r,s&&m.jsx("span",{id:"__chakra_env",hidden:!0,ref:n})]})}Ga.displayName="EnvironmentProvider";var B0=e=>{const{children:r,colorModeManager:a,portalZIndex:i,resetScope:n,resetCSS:l=!0,theme:s={},environment:c,cssVarsRoot:v,disableEnvironment:x,disableGlobalStyle:F}=e,O=m.jsx(Ga,{environment:c,disabled:x,children:r});return m.jsx(I0,{theme:s,cssVarsRoot:v,children:m.jsxs(Pa,{colorModeManager:a,options:s.config,children:[l?m.jsx(kt,{scope:n}):m.jsx($t,{}),!F&&m.jsx(M0,{}),i?m.jsx(mt,{zIndex:i,children:O}):O]})})},E0=e=>function({children:a,theme:i=e,toastOptions:n,...l}){return m.jsxs(B0,{theme:i,...l,children:[m.jsx(gt,{value:n==null?void 0:n.defaultOptions,children:a}),m.jsx(yt,{...n})]})},D0=E0(qa);function _(e,r,a=!1){e=String(e),r=String(r);const i=Array.from({length:21},(s,c)=>c*50),n=[0,5,10,15,20,25,30,35,40,45,50,55,59,64,68,73,77,82,86,95,100];return i.reduce((s,c,v)=>{const x=a?n[v]/100:1,F=a?50:n[i.length-1-v];return s[c]=`hsl(${e} ${r}% ${F}% / ${x})`,s},{})}const Be={H:220,S:16},Ee={H:250,S:42},De={H:47,S:42},Re={H:28,S:42},je={H:113,S:42},He={H:0,S:42},R0={base:_(Be.H,Be.S),baseAlpha:_(Be.H,Be.S,!0),accent:_(Ee.H,Ee.S),accentAlpha:_(Ee.H,Ee.S,!0),working:_(De.H,De.S),workingAlpha:_(De.H,De.S,!0),warning:_(Re.H,Re.S),warningAlpha:_(Re.H,Re.S,!0),ok:_(je.H,je.S),okAlpha:_(je.H,je.S,!0),error:_(He.H,He.S),errorAlpha:_(He.H,He.S,!0)},{definePartsStyle:j0,defineMultiStyleConfig:H0}=b(wa.keys),W0=t({border:"none"}),V0=t(e=>{const{colorScheme:r}=e;return{fontWeight:"600",fontSize:"sm",border:"none",borderRadius:"base",bg:o(`${r}.200`,`${r}.700`)(e),color:o(`${r}.900`,`${r}.100`)(e),_hover:{bg:o(`${r}.250`,`${r}.650`)(e)},_expanded:{bg:o(`${r}.250`,`${r}.650`)(e),borderBottomRadius:"none",_hover:{bg:o(`${r}.300`,`${r}.600`)(e)}}}}),L0=t(e=>{const{colorScheme:r}=e;return{bg:o(`${r}.100`,`${r}.800`)(e),borderRadius:"base",borderTopRadius:"none"}}),q0=t({}),O0=j0(e=>({container:W0,button:V0(e),panel:L0(e),icon:q0})),N0=H0({variants:{invokeAI:O0},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),G0=t(e=>{const{colorScheme:r}=e;if(r==="base"){const i={bg:o("base.150","base.700")(e),color:o("base.500","base.500")(e),svg:{fill:o("base.500","base.500")(e)},opacity:1};return{bg:o("base.250","base.600")(e),color:o("base.850","base.100")(e),borderRadius:"base",svg:{fill:o("base.850","base.100")(e)},_hover:{bg:o("base.300","base.500")(e),color:o("base.900","base.50")(e),svg:{fill:o("base.900","base.50")(e)},_disabled:i},_disabled:i}}const a={bg:o(`${r}.250`,`${r}.700`)(e),color:o(`${r}.50`,`${r}.500`)(e),svg:{fill:o(`${r}.50`,`${r}.500`)(e),filter:"unset"},opacity:1,filter:o(void 0,"saturate(65%)")(e)};return{bg:o(`${r}.400`,`${r}.600`)(e),color:o("base.50","base.100")(e),borderRadius:"base",svg:{fill:o("base.50","base.100")(e)},_disabled:a,_hover:{bg:o(`${r}.500`,`${r}.500`)(e),color:o("white","base.50")(e),svg:{fill:o("white","base.50")(e)},_disabled:a}}}),U0=t(e=>{const{colorScheme:r}=e,a=o("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:r==="gray"?a:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"}}}),X0=h({variants:{invokeAI:G0,invokeAIOutline:U0},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),{definePartsStyle:Y0,defineMultiStyleConfig:K0}=b(ya.keys),Z0=t(e=>{const{colorScheme:r}=e;return{bg:o("base.200","base.700")(e),borderColor:o("base.200","base.700")(e),color:o("base.900","base.100")(e),_checked:{bg:o(`${r}.300`,`${r}.600`)(e),borderColor:o(`${r}.300`,`${r}.600`)(e),color:o(`${r}.900`,`${r}.100`)(e),_hover:{bg:o(`${r}.400`,`${r}.500`)(e),borderColor:o(`${r}.400`,`${r}.500`)(e)},_disabled:{borderColor:"transparent",bg:"whiteAlpha.300",color:"whiteAlpha.500"}},_indeterminate:{bg:o(`${r}.300`,`${r}.600`)(e),borderColor:o(`${r}.300`,`${r}.600`)(e),color:o(`${r}.900`,`${r}.100`)(e)},_disabled:{bg:"whiteAlpha.100",borderColor:"transparent"},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:o("error.600","error.300")(e)}}}),J0=Y0(e=>({control:Z0(e)})),Q0=K0({variants:{invokeAI:J0},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{definePartsStyle:ed,defineMultiStyleConfig:rd}=b(_a.keys),ad=t({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"}),td=t(e=>({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6},"::selection":{color:o("accent.900","accent.50")(e),bg:o("accent.200","accent.400")(e)}})),od=t({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}}),id=ed(e=>({preview:ad,input:td(e),textarea:od})),nd=rd({variants:{invokeAI:id},defaultProps:{size:"sm",variant:"invokeAI"}}),ld=t(e=>({fontSize:"sm",marginEnd:0,mb:1,fontWeight:"400",transitionProperty:"common",transitionDuration:"normal",whiteSpace:"nowrap",_disabled:{opacity:.4},color:o("base.700","base.300")(e)})),sd=h({variants:{invokeAI:ld},defaultProps:{variant:"invokeAI"}}),er=e=>({outline:"none",borderWidth:2,borderStyle:"solid",borderColor:o("base.200","base.800")(e),bg:o("base.50","base.900")(e),borderRadius:"base",color:o("base.900","base.100")(e),boxShadow:"none",_hover:{borderColor:o("base.300","base.600")(e)},_focus:{borderColor:o("accent.200","accent.600")(e),boxShadow:"none",_hover:{borderColor:o("accent.300","accent.500")(e)}},_invalid:{borderColor:o("error.300","error.600")(e),boxShadow:"none",_hover:{borderColor:o("error.400","error.500")(e)}},_disabled:{borderColor:o("base.300","base.700")(e),bg:o("base.300","base.700")(e),color:o("base.600","base.400")(e),_hover:{borderColor:o("base.300","base.700")(e)}},_placeholder:{color:o("base.700","base.400")(e)},"::selection":{bg:o("accent.200","accent.400")(e)}}),{definePartsStyle:dd,defineMultiStyleConfig:cd}=b(ma.keys),bd=dd(e=>({field:er(e)})),vd=cd({variants:{invokeAI:bd},defaultProps:{size:"sm",variant:"invokeAI"}}),{defineMultiStyleConfig:ud,definePartsStyle:fd}=b(xa.keys),hd=t(e=>({bg:o("blackAlpha.700","blackAlpha.700")(e)})),md=t({}),gd=t(()=>({layerStyle:"first",maxH:"80vh"})),yd=t(()=>({fontWeight:"600",fontSize:"lg",layerStyle:"first",borderTopRadius:"base",borderInlineEndRadius:"base"})),Sd=t({}),pd=t({overflowY:"scroll"}),xd=t({}),$d=fd(e=>({overlay:hd(e),dialogContainer:md,dialog:gd(),header:yd(),closeButton:Sd,body:pd,footer:xd})),kd=ud({variants:{invokeAI:$d},defaultProps:{variant:"invokeAI",size:"lg"}}),{defineMultiStyleConfig:_d,definePartsStyle:wd}=b($a.keys),zd=t(e=>({height:8})),Cd=t(e=>({border:"none",fontWeight:"600",height:"auto",py:1,ps:2,pe:6,...er(e)})),Ad=t(e=>({display:"flex"})),Pd=t(e=>({border:"none",px:2,py:0,mx:-2,my:0,svg:{color:o("base.700","base.300")(e),width:2.5,height:2.5,_hover:{color:o("base.900","base.100")(e)}}})),Fd=wd(e=>({root:zd(e),field:Cd(e),stepperGroup:Ad(e),stepper:Pd(e)})),Id=_d({variants:{invokeAI:Fd},defaultProps:{size:"sm",variant:"invokeAI"}}),{defineMultiStyleConfig:Td,definePartsStyle:Md}=b(ka.keys),Bd=f("popper-bg"),Ed=f("popper-arrow-bg"),Dd=f("popper-arrow-shadow-color"),Rd=t(e=>({[Ed.variable]:o("colors.base.100","colors.base.800")(e),[Bd.variable]:o("colors.base.100","colors.base.800")(e),[Dd.variable]:o("colors.base.400","colors.base.600")(e),minW:"unset",width:"unset",p:4,bg:o("base.100","base.800")(e),border:"none",shadow:"dark-lg"})),jd=Md(e=>({content:Rd(e)})),Hd=Td({variants:{invokeAI:jd},defaultProps:{variant:"invokeAI"}}),{defineMultiStyleConfig:Wd,definePartsStyle:Vd}=b(ga.keys),Ld=t(e=>({bg:"accentAlpha.500"})),qd=t(e=>{const{colorScheme:r}=e;return{bg:o(`${r}.200`,`${r}.700`)(e)}}),Od=Vd(e=>({filledTrack:Ld(e),track:qd(e)})),Nd=Wd({variants:{invokeAI:Od},defaultProps:{variant:"invokeAI"}}),Gd={"::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},{definePartsStyle:Ud,defineMultiStyleConfig:Xd}=b(Sa.keys),Yd=t(e=>({color:o("base.200","base.300")(e)})),Kd=t(e=>({fontWeight:"600",...er(e)})),Zd=Ud(e=>({field:Kd(e),icon:Yd(e)})),Jd=Xd({variants:{invokeAI:Zd},defaultProps:{size:"sm",variant:"invokeAI"}}),ca=d("skeleton-start-color"),ba=d("skeleton-end-color"),Qd=t({borderRadius:"base",maxW:"full",maxH:"full",_light:{[ca.variable]:"colors.base.250",[ba.variable]:"colors.base.450"},_dark:{[ca.variable]:"colors.base.700",[ba.variable]:"colors.base.500"}}),ec=h({variants:{invokeAI:Qd},defaultProps:{variant:"invokeAI"}}),{definePartsStyle:rc,defineMultiStyleConfig:ac}=b(pa.keys),tc=t(e=>({bg:o("base.400","base.600")(e),h:1.5})),oc=t(e=>{const{colorScheme:r}=e;return{bg:o(`${r}.400`,`${r}.600`)(e),h:1.5}}),ic=t(e=>({w:2,h:4,bg:o("base.50","base.100")(e)})),nc=t(e=>({fontSize:"2xs",fontWeight:"500",color:o("base.700","base.400")(e),mt:2,insetInlineStart:"unset"})),lc=rc(e=>({container:{_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"}},track:tc(e),filledTrack:oc(e),thumb:ic(e),mark:nc(e)})),sc=ac({variants:{invokeAI:lc},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:dc,definePartsStyle:cc}=b(fa.keys),bc=t(e=>{const{colorScheme:r}=e;return{bg:o("base.300","base.600")(e),_focusVisible:{boxShadow:"none"},_checked:{bg:o(`${r}.400`,`${r}.500`)(e)}}}),vc=t(e=>{const{colorScheme:r}=e;return{bg:o(`${r}.50`,`${r}.50`)(e)}}),uc=cc(e=>({container:{},track:bc(e),thumb:vc(e)})),fc=dc({variants:{invokeAI:uc},defaultProps:{size:"md",variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:hc,definePartsStyle:mc}=b(ha.keys),gc=t(e=>({display:"flex",columnGap:4})),yc=t(e=>({})),Sc=t(e=>{const{colorScheme:r}=e;return{display:"flex",flexDirection:"column",gap:1,color:o("base.700","base.400")(e),button:{fontSize:"sm",padding:2,borderRadius:"base",textShadow:o("0 0 0.3rem var(--invokeai-colors-accent-100)","0 0 0.3rem var(--invokeai-colors-accent-900)")(e),svg:{fill:o("base.700","base.300")(e)},_selected:{bg:o("accent.400","accent.600")(e),color:o("base.50","base.100")(e),svg:{fill:o("base.50","base.100")(e),filter:o(`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${r}-600))`,`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${r}-800))`)(e)},_hover:{bg:o("accent.500","accent.500")(e),color:o("white","base.50")(e),svg:{fill:o("white","base.50")(e)}}},_hover:{bg:o("base.100","base.800")(e),color:o("base.900","base.50")(e),svg:{fill:o("base.800","base.100")(e)}}}}}),pc=t(e=>({padding:0,height:"100%"})),xc=mc(e=>({root:gc(e),tab:yc(e),tablist:Sc(e),tabpanel:pc(e)})),$c=hc({variants:{invokeAI:xc},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),kc=t(e=>({color:o("base.500","base.400")(e)})),_c=h({variants:{subtext:kc}}),wc=t(e=>({...er(e),"::-webkit-scrollbar":{display:"initial"},"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + var(--invokeai-colors-base-50) 0%, + var(--invokeai-colors-base-50) 70%, + var(--invokeai-colors-base-200) 70%, + var(--invokeai-colors-base-200) 100%)`},_dark:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + var(--invokeai-colors-base-900) 0%, + var(--invokeai-colors-base-900) 70%, + var(--invokeai-colors-base-800) 70%, + var(--invokeai-colors-base-800) 100%)`}}})),zc=h({variants:{invokeAI:wc},defaultProps:{size:"md",variant:"invokeAI"}}),Cc=f("popper-arrow-bg"),Ac=t(e=>({borderRadius:"base",shadow:"dark-lg",bg:o("base.700","base.200")(e),[Cc.variable]:o("colors.base.700","colors.base.200")(e),pb:1.5})),Pc=h({baseStyle:Ac}),Fc={config:{cssVarPrefix:"invokeai",initialColorMode:"dark",useSystemColorMode:!1},layerStyles:{body:{bg:"base.50",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.50"}},first:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.850",color:"base.100"}},second:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}}},styles:{global:()=>({layerStyle:"body","*":{...Gd}})},direction:"ltr",fonts:{body:"'Inter Variable', sans-serif"},shadows:{light:{accent:"0 0 10px 0 var(--invokeai-colors-accent-300)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-400)",ok:"0 0 7px var(--invokeai-colors-ok-600)",working:"0 0 7px var(--invokeai-colors-working-600)",error:"0 0 7px var(--invokeai-colors-error-600)"},dark:{accent:"0 0 10px 0 var(--invokeai-colors-accent-600)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-500)",ok:"0 0 7px var(--invokeai-colors-ok-400)",working:"0 0 7px var(--invokeai-colors-working-400)",error:"0 0 7px var(--invokeai-colors-error-400)"},selected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-400)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-500)"},hoverSelected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-400)"},hoverUnselected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 3px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 3px var(--invokeai-colors-accent-400)"},nodeSelectedOutline:"0 0 0 2px var(--invokeai-colors-accent-450)"},colors:R0,components:{Button:X0,Input:vd,Editable:nd,Textarea:zc,Tabs:$c,Progress:Nd,Accordion:N0,FormLabel:sd,Switch:fc,NumberInput:Id,Select:Jd,Skeleton:ec,Slider:sc,Popover:Hd,Modal:kd,Checkbox:Q0,Menu:St,Text:_c,Tooltip:Pc}};const Ic=()=>y.useMemo(()=>({colorScheme:"dark",fontFamily:"'Inter Variable', sans-serif",components:{ScrollArea:{defaultProps:{scrollbarSize:10},styles:{scrollbar:{"&:hover":{backgroundColor:"var(--invokeai-colors-baseAlpha-300)"}},thumb:{backgroundColor:"var(--invokeai-colors-baseAlpha-300)"}}}}}),[]),Tc=Aa("@@invokeai-color-mode");function Ec({children:e}){const{i18n:r}=pt(),a=r.dir(),i=y.useMemo(()=>A0({...Fc,direction:a}),[a]);y.useEffect(()=>{document.body.dir=a},[a]);const n=Ic();return m.jsx(xt,{theme:n,children:m.jsx(D0,{theme:i,colorModeManager:Tc,children:e})})}export{Ec as default}; diff --git a/invokeai/frontend/web/dist/assets/index-9e78a66d.js b/invokeai/frontend/web/dist/assets/index-9e78a66d.js deleted file mode 100644 index 7e1eac5375..0000000000 --- a/invokeai/frontend/web/dist/assets/index-9e78a66d.js +++ /dev/null @@ -1,125 +0,0 @@ -function s9(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Ne=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Il(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function fV(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){if(this instanceof r){var i=[null];i.push.apply(i,arguments);var o=Function.bind.apply(t,i);return new o}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var a9={exports:{}},E0={},l9={exports:{}},ze={};/** - * @license React - * react.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 Hh=Symbol.for("react.element"),hV=Symbol.for("react.portal"),pV=Symbol.for("react.fragment"),gV=Symbol.for("react.strict_mode"),mV=Symbol.for("react.profiler"),yV=Symbol.for("react.provider"),vV=Symbol.for("react.context"),bV=Symbol.for("react.forward_ref"),SV=Symbol.for("react.suspense"),_V=Symbol.for("react.memo"),wV=Symbol.for("react.lazy"),P4=Symbol.iterator;function xV(e){return e===null||typeof e!="object"?null:(e=P4&&e[P4]||e["@@iterator"],typeof e=="function"?e:null)}var u9={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},c9=Object.assign,d9={};function Hc(e,t,n){this.props=e,this.context=t,this.refs=d9,this.updater=n||u9}Hc.prototype.isReactComponent={};Hc.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Hc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function f9(){}f9.prototype=Hc.prototype;function Bx(e,t,n){this.props=e,this.context=t,this.refs=d9,this.updater=n||u9}var jx=Bx.prototype=new f9;jx.constructor=Bx;c9(jx,Hc.prototype);jx.isPureReactComponent=!0;var k4=Array.isArray,h9=Object.prototype.hasOwnProperty,Vx={current:null},p9={key:!0,ref:!0,__self:!0,__source:!0};function g9(e,t,n){var r,i={},o=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(o=""+t.key),t)h9.call(t,r)&&!p9.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,z=R[V];if(0>>1;Vi(W,L))Xi(F,W)?(R[V]=F,R[X]=L,V=X):(R[V]=W,R[K]=L,V=K);else if(Xi(F,L))R[V]=F,R[X]=L,V=X;else break e}}return D}function i(R,D){var L=R.sortIndex-D.sortIndex;return L!==0?L:R.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],u=[],c=1,d=null,f=3,h=!1,p=!1,g=!1,S=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(R){for(var D=n(u);D!==null;){if(D.callback===null)r(u);else if(D.startTime<=R)r(u),D.sortIndex=D.expirationTime,t(l,D);else break;D=n(u)}}function b(R){if(g=!1,m(R),!p)if(n(l)!==null)p=!0,I(_);else{var D=n(u);D!==null&&M(b,D.startTime-R)}}function _(R,D){p=!1,g&&(g=!1,v(C),C=-1),h=!0;var L=f;try{for(m(D),d=n(l);d!==null&&(!(d.expirationTime>D)||R&&!A());){var V=d.callback;if(typeof V=="function"){d.callback=null,f=d.priorityLevel;var z=V(d.expirationTime<=D);D=e.unstable_now(),typeof z=="function"?d.callback=z:d===n(l)&&r(l),m(D)}else r(l);d=n(l)}if(d!==null)var U=!0;else{var K=n(u);K!==null&&M(b,K.startTime-D),U=!1}return U}finally{d=null,f=L,h=!1}}var w=!1,x=null,C=-1,k=5,P=-1;function A(){return!(e.unstable_now()-PR||125V?(R.sortIndex=L,t(u,R),n(l)===null&&R===n(u)&&(g?(v(C),C=-1):g=!0,M(b,L-V))):(R.sortIndex=z,t(l,R),p||h||(p=!0,I(_))),R},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(R){var D=f;return function(){var L=f;f=D;try{return R.apply(this,arguments)}finally{f=L}}}})(b9);v9.exports=b9;var NV=v9.exports;/** - * @license React - * react-dom.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 S9=E,Vr=NV;function te(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),K_=Object.prototype.hasOwnProperty,DV=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,R4={},I4={};function LV(e){return K_.call(I4,e)?!0:K_.call(R4,e)?!1:DV.test(e)?I4[e]=!0:(R4[e]=!0,!1)}function $V(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function FV(e,t,n,r){if(t===null||typeof t>"u"||$V(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function hr(e,t,n,r,i,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var Vn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Vn[e]=new hr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Vn[t]=new hr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Vn[e]=new hr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Vn[e]=new hr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Vn[e]=new hr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Vn[e]=new hr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Vn[e]=new hr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Vn[e]=new hr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Vn[e]=new hr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ux=/[\-:]([a-z])/g;function Gx(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Ux,Gx);Vn[t]=new hr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Ux,Gx);Vn[t]=new hr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Ux,Gx);Vn[t]=new hr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Vn[e]=new hr(e,1,!1,e.toLowerCase(),null,!1,!1)});Vn.xlinkHref=new hr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Vn[e]=new hr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Hx(e,t,n,r){var i=Vn.hasOwnProperty(t)?Vn[t]:null;(i!==null?i.type!==0:r||!(2a||i[s]!==o[a]){var l=` -`+i[s].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{Qb=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?zd(e):""}function BV(e){switch(e.tag){case 5:return zd(e.type);case 16:return zd("Lazy");case 13:return zd("Suspense");case 19:return zd("SuspenseList");case 0:case 2:case 15:return e=Zb(e.type,!1),e;case 11:return e=Zb(e.type.render,!1),e;case 1:return e=Zb(e.type,!0),e;default:return""}}function Z_(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Pu:return"Fragment";case Eu:return"Portal";case Y_:return"Profiler";case qx:return"StrictMode";case X_:return"Suspense";case Q_:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case x9:return(e.displayName||"Context")+".Consumer";case w9:return(e._context.displayName||"Context")+".Provider";case Wx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Kx:return t=e.displayName||null,t!==null?t:Z_(e.type)||"Memo";case Ls:t=e._payload,e=e._init;try{return Z_(e(t))}catch{}}return null}function jV(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Z_(t);case 8:return t===qx?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function da(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function T9(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function VV(e){var t=T9(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Yp(e){e._valueTracker||(e._valueTracker=VV(e))}function E9(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=T9(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Fm(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function J_(e,t){var n=t.checked;return $t({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function N4(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=da(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function P9(e,t){t=t.checked,t!=null&&Hx(e,"checked",t,!1)}function e2(e,t){P9(e,t);var n=da(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?t2(e,t.type,n):t.hasOwnProperty("defaultValue")&&t2(e,t.type,da(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function D4(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function t2(e,t,n){(t!=="number"||Fm(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ud=Array.isArray;function Gu(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Xp.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Cf(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ef={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},zV=["Webkit","ms","Moz","O"];Object.keys(ef).forEach(function(e){zV.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ef[t]=ef[e]})});function R9(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ef.hasOwnProperty(e)&&ef[e]?(""+t).trim():t+"px"}function I9(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=R9(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var UV=$t({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function i2(e,t){if(t){if(UV[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(te(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(te(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(te(61))}if(t.style!=null&&typeof t.style!="object")throw Error(te(62))}}function o2(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var s2=null;function Yx(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var a2=null,Hu=null,qu=null;function F4(e){if(e=Kh(e)){if(typeof a2!="function")throw Error(te(280));var t=e.stateNode;t&&(t=R0(t),a2(e.stateNode,e.type,t))}}function M9(e){Hu?qu?qu.push(e):qu=[e]:Hu=e}function N9(){if(Hu){var e=Hu,t=qu;if(qu=Hu=null,F4(e),t)for(e=0;e>>=0,e===0?32:31-(ez(e)/tz|0)|0}var Qp=64,Zp=4194304;function Gd(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function zm(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=Gd(a):(o&=s,o!==0&&(r=Gd(o)))}else s=n&~i,s!==0?r=Gd(s):o!==0&&(r=Gd(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function qh(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ri(t),e[t]=n}function oz(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=nf),W4=String.fromCharCode(32),K4=!1;function eO(e,t){switch(e){case"keyup":return Mz.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tO(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ku=!1;function Dz(e,t){switch(e){case"compositionend":return tO(t);case"keypress":return t.which!==32?null:(K4=!0,W4);case"textInput":return e=t.data,e===W4&&K4?null:e;default:return null}}function Lz(e,t){if(ku)return e==="compositionend"||!rC&&eO(e,t)?(e=Z9(),Zg=eC=Ws=null,ku=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Z4(n)}}function oO(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?oO(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function sO(){for(var e=window,t=Fm();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Fm(e.document)}return t}function iC(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Hz(e){var t=sO(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&oO(n.ownerDocument.documentElement,n)){if(r!==null&&iC(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=J4(n,o);var s=J4(n,r);i&&s&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Au=null,h2=null,of=null,p2=!1;function eT(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;p2||Au==null||Au!==Fm(r)||(r=Au,"selectionStart"in r&&iC(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),of&&Of(of,r)||(of=r,r=Hm(h2,"onSelect"),0Iu||(e.current=S2[Iu],S2[Iu]=null,Iu--)}function mt(e,t){Iu++,S2[Iu]=e.current,e.current=t}var fa={},Qn=Ta(fa),Cr=Ta(!1),ml=fa;function gc(e,t){var n=e.type.contextTypes;if(!n)return fa;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Tr(e){return e=e.childContextTypes,e!=null}function Wm(){_t(Cr),_t(Qn)}function aT(e,t,n){if(Qn.current!==fa)throw Error(te(168));mt(Qn,t),mt(Cr,n)}function gO(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(te(108,jV(e)||"Unknown",i));return $t({},n,r)}function Km(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||fa,ml=Qn.current,mt(Qn,e),mt(Cr,Cr.current),!0}function lT(e,t,n){var r=e.stateNode;if(!r)throw Error(te(169));n?(e=gO(e,t,ml),r.__reactInternalMemoizedMergedChildContext=e,_t(Cr),_t(Qn),mt(Qn,e)):_t(Cr),mt(Cr,n)}var Wo=null,I0=!1,fS=!1;function mO(e){Wo===null?Wo=[e]:Wo.push(e)}function rU(e){I0=!0,mO(e)}function Ea(){if(!fS&&Wo!==null){fS=!0;var e=0,t=rt;try{var n=Wo;for(rt=1;e>=s,i-=s,Xo=1<<32-Ri(t)+i|n<C?(k=x,x=null):k=x.sibling;var P=f(v,x,m[C],b);if(P===null){x===null&&(x=k);break}e&&x&&P.alternate===null&&t(v,x),y=o(P,y,C),w===null?_=P:w.sibling=P,w=P,x=k}if(C===m.length)return n(v,x),Et&&Ha(v,C),_;if(x===null){for(;CC?(k=x,x=null):k=x.sibling;var A=f(v,x,P.value,b);if(A===null){x===null&&(x=k);break}e&&x&&A.alternate===null&&t(v,x),y=o(A,y,C),w===null?_=A:w.sibling=A,w=A,x=k}if(P.done)return n(v,x),Et&&Ha(v,C),_;if(x===null){for(;!P.done;C++,P=m.next())P=d(v,P.value,b),P!==null&&(y=o(P,y,C),w===null?_=P:w.sibling=P,w=P);return Et&&Ha(v,C),_}for(x=r(v,x);!P.done;C++,P=m.next())P=h(x,v,C,P.value,b),P!==null&&(e&&P.alternate!==null&&x.delete(P.key===null?C:P.key),y=o(P,y,C),w===null?_=P:w.sibling=P,w=P);return e&&x.forEach(function($){return t(v,$)}),Et&&Ha(v,C),_}function S(v,y,m,b){if(typeof m=="object"&&m!==null&&m.type===Pu&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case Kp:e:{for(var _=m.key,w=y;w!==null;){if(w.key===_){if(_=m.type,_===Pu){if(w.tag===7){n(v,w.sibling),y=i(w,m.props.children),y.return=v,v=y;break e}}else if(w.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Ls&&gT(_)===w.type){n(v,w.sibling),y=i(w,m.props),y.ref=Sd(v,w,m),y.return=v,v=y;break e}n(v,w);break}else t(v,w);w=w.sibling}m.type===Pu?(y=ll(m.props.children,v.mode,b,m.key),y.return=v,v=y):(b=sm(m.type,m.key,m.props,null,v.mode,b),b.ref=Sd(v,y,m),b.return=v,v=b)}return s(v);case Eu:e:{for(w=m.key;y!==null;){if(y.key===w)if(y.tag===4&&y.stateNode.containerInfo===m.containerInfo&&y.stateNode.implementation===m.implementation){n(v,y.sibling),y=i(y,m.children||[]),y.return=v,v=y;break e}else{n(v,y);break}else t(v,y);y=y.sibling}y=SS(m,v.mode,b),y.return=v,v=y}return s(v);case Ls:return w=m._init,S(v,y,w(m._payload),b)}if(Ud(m))return p(v,y,m,b);if(gd(m))return g(v,y,m,b);og(v,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,y!==null&&y.tag===6?(n(v,y.sibling),y=i(y,m),y.return=v,v=y):(n(v,y),y=bS(m,v.mode,b),y.return=v,v=y),s(v)):n(v,y)}return S}var yc=CO(!0),TO=CO(!1),Yh={},po=Ta(Yh),Nf=Ta(Yh),Df=Ta(Yh);function tl(e){if(e===Yh)throw Error(te(174));return e}function hC(e,t){switch(mt(Df,t),mt(Nf,e),mt(po,Yh),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:r2(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=r2(t,e)}_t(po),mt(po,t)}function vc(){_t(po),_t(Nf),_t(Df)}function EO(e){tl(Df.current);var t=tl(po.current),n=r2(t,e.type);t!==n&&(mt(Nf,e),mt(po,n))}function pC(e){Nf.current===e&&(_t(po),_t(Nf))}var It=Ta(0);function ey(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var hS=[];function gC(){for(var e=0;en?n:4,e(!0);var r=pS.transition;pS.transition={};try{e(!1),t()}finally{rt=n,pS.transition=r}}function zO(){return pi().memoizedState}function aU(e,t,n){var r=na(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},UO(e))GO(t,n);else if(n=SO(e,t,n,r),n!==null){var i=ur();Ii(n,e,r,i),HO(n,t,r)}}function lU(e,t,n){var r=na(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(UO(e))GO(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,$i(a,s)){var l=t.interleaved;l===null?(i.next=i,dC(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=SO(e,t,i,r),n!==null&&(i=ur(),Ii(n,e,r,i),HO(n,t,r))}}function UO(e){var t=e.alternate;return e===Lt||t!==null&&t===Lt}function GO(e,t){sf=ty=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function HO(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Qx(e,n)}}var ny={readContext:hi,useCallback:Hn,useContext:Hn,useEffect:Hn,useImperativeHandle:Hn,useInsertionEffect:Hn,useLayoutEffect:Hn,useMemo:Hn,useReducer:Hn,useRef:Hn,useState:Hn,useDebugValue:Hn,useDeferredValue:Hn,useTransition:Hn,useMutableSource:Hn,useSyncExternalStore:Hn,useId:Hn,unstable_isNewReconciler:!1},uU={readContext:hi,useCallback:function(e,t){return Wi().memoizedState=[e,t===void 0?null:t],e},useContext:hi,useEffect:yT,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,nm(4194308,4,$O.bind(null,t,e),n)},useLayoutEffect:function(e,t){return nm(4194308,4,e,t)},useInsertionEffect:function(e,t){return nm(4,2,e,t)},useMemo:function(e,t){var n=Wi();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Wi();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=aU.bind(null,Lt,e),[r.memoizedState,e]},useRef:function(e){var t=Wi();return e={current:e},t.memoizedState=e},useState:mT,useDebugValue:SC,useDeferredValue:function(e){return Wi().memoizedState=e},useTransition:function(){var e=mT(!1),t=e[0];return e=sU.bind(null,e[1]),Wi().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Lt,i=Wi();if(Et){if(n===void 0)throw Error(te(407));n=n()}else{if(n=t(),En===null)throw Error(te(349));vl&30||AO(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,yT(RO.bind(null,r,o,e),[e]),r.flags|=2048,Ff(9,OO.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Wi(),t=En.identifierPrefix;if(Et){var n=Qo,r=Xo;n=(r&~(1<<32-Ri(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Lf++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[eo]=t,e[Mf]=r,eR(e,t,!1,!1),t.stateNode=e;e:{switch(s=o2(n,r),n){case"dialog":vt("cancel",e),vt("close",e),i=r;break;case"iframe":case"object":case"embed":vt("load",e),i=r;break;case"video":case"audio":for(i=0;iSc&&(t.flags|=128,r=!0,_d(o,!1),t.lanes=4194304)}else{if(!r)if(e=ey(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),_d(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Et)return qn(t),null}else 2*Gt()-o.renderingStartTime>Sc&&n!==1073741824&&(t.flags|=128,r=!0,_d(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Gt(),t.sibling=null,n=It.current,mt(It,r?n&1|2:n&1),t):(qn(t),null);case 22:case 23:return EC(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Dr&1073741824&&(qn(t),t.subtreeFlags&6&&(t.flags|=8192)):qn(t),null;case 24:return null;case 25:return null}throw Error(te(156,t.tag))}function yU(e,t){switch(sC(t),t.tag){case 1:return Tr(t.type)&&Wm(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return vc(),_t(Cr),_t(Qn),gC(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return pC(t),null;case 13:if(_t(It),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(te(340));mc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _t(It),null;case 4:return vc(),null;case 10:return cC(t.type._context),null;case 22:case 23:return EC(),null;case 24:return null;default:return null}}var ag=!1,Xn=!1,vU=typeof WeakSet=="function"?WeakSet:Set,de=null;function Lu(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Bt(e,t,r)}else n.current=null}function I2(e,t,n){try{n()}catch(r){Bt(e,t,r)}}var ET=!1;function bU(e,t){if(g2=Um,e=sO(),iC(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(a=s+i),d!==o||r!==0&&d.nodeType!==3||(l=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++u===i&&(a=s),f===o&&++c===r&&(l=s),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(m2={focusedElem:e,selectionRange:n},Um=!1,de=t;de!==null;)if(t=de,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,de=e;else for(;de!==null;){t=de;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var g=p.memoizedProps,S=p.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Ci(t.type,g),S);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(te(163))}}catch(b){Bt(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,de=e;break}de=t.return}return p=ET,ET=!1,p}function af(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&I2(t,n,o)}i=i.next}while(i!==r)}}function D0(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function M2(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function rR(e){var t=e.alternate;t!==null&&(e.alternate=null,rR(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[eo],delete t[Mf],delete t[b2],delete t[tU],delete t[nU])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function iR(e){return e.tag===5||e.tag===3||e.tag===4}function PT(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||iR(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function N2(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=qm));else if(r!==4&&(e=e.child,e!==null))for(N2(e,t,n),e=e.sibling;e!==null;)N2(e,t,n),e=e.sibling}function D2(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(D2(e,t,n),e=e.sibling;e!==null;)D2(e,t,n),e=e.sibling}var Mn=null,Ti=!1;function ks(e,t,n){for(n=n.child;n!==null;)oR(e,t,n),n=n.sibling}function oR(e,t,n){if(ho&&typeof ho.onCommitFiberUnmount=="function")try{ho.onCommitFiberUnmount(P0,n)}catch{}switch(n.tag){case 5:Xn||Lu(n,t);case 6:var r=Mn,i=Ti;Mn=null,ks(e,t,n),Mn=r,Ti=i,Mn!==null&&(Ti?(e=Mn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Mn.removeChild(n.stateNode));break;case 18:Mn!==null&&(Ti?(e=Mn,n=n.stateNode,e.nodeType===8?dS(e.parentNode,n):e.nodeType===1&&dS(e,n),kf(e)):dS(Mn,n.stateNode));break;case 4:r=Mn,i=Ti,Mn=n.stateNode.containerInfo,Ti=!0,ks(e,t,n),Mn=r,Ti=i;break;case 0:case 11:case 14:case 15:if(!Xn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&I2(n,t,s),i=i.next}while(i!==r)}ks(e,t,n);break;case 1:if(!Xn&&(Lu(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Bt(n,t,a)}ks(e,t,n);break;case 21:ks(e,t,n);break;case 22:n.mode&1?(Xn=(r=Xn)||n.memoizedState!==null,ks(e,t,n),Xn=r):ks(e,t,n);break;default:ks(e,t,n)}}function kT(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new vU),t.forEach(function(r){var i=kU.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function _i(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=Gt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*_U(r/1960))-r,10e?16:e,Ks===null)var r=!1;else{if(e=Ks,Ks=null,oy=0,Ke&6)throw Error(te(331));var i=Ke;for(Ke|=4,de=e.current;de!==null;){var o=de,s=o.child;if(de.flags&16){var a=o.deletions;if(a!==null){for(var l=0;lGt()-CC?al(e,0):xC|=n),Er(e,t)}function hR(e,t){t===0&&(e.mode&1?(t=Zp,Zp<<=1,!(Zp&130023424)&&(Zp=4194304)):t=1);var n=ur();e=us(e,t),e!==null&&(qh(e,t,n),Er(e,n))}function PU(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),hR(e,n)}function kU(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(te(314))}r!==null&&r.delete(t),hR(e,n)}var pR;pR=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Cr.current)_r=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return _r=!1,gU(e,t,n);_r=!!(e.flags&131072)}else _r=!1,Et&&t.flags&1048576&&yO(t,Xm,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;rm(e,t),e=t.pendingProps;var i=gc(t,Qn.current);Ku(t,n),i=yC(null,t,r,e,i,n);var o=vC();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Tr(r)?(o=!0,Km(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,fC(t),i.updater=M0,t.stateNode=i,i._reactInternals=t,T2(t,r,e,n),t=k2(null,t,r,!0,o,n)):(t.tag=0,Et&&o&&oC(t),ar(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(rm(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=OU(r),e=Ci(r,e),i){case 0:t=P2(null,t,r,e,n);break e;case 1:t=xT(null,t,r,e,n);break e;case 11:t=_T(null,t,r,e,n);break e;case 14:t=wT(null,t,r,Ci(r.type,e),n);break e}throw Error(te(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ci(r,i),P2(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ci(r,i),xT(e,t,r,i,n);case 3:e:{if(QO(t),e===null)throw Error(te(387));r=t.pendingProps,o=t.memoizedState,i=o.element,_O(e,t),Jm(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=bc(Error(te(423)),t),t=CT(e,t,r,n,i);break e}else if(r!==i){i=bc(Error(te(424)),t),t=CT(e,t,r,n,i);break e}else for($r=Js(t.stateNode.containerInfo.firstChild),Br=t,Et=!0,Pi=null,n=TO(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(mc(),r===i){t=cs(e,t,n);break e}ar(e,t,r,n)}t=t.child}return t;case 5:return EO(t),e===null&&w2(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,y2(r,i)?s=null:o!==null&&y2(r,o)&&(t.flags|=32),XO(e,t),ar(e,t,s,n),t.child;case 6:return e===null&&w2(t),null;case 13:return ZO(e,t,n);case 4:return hC(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=yc(t,null,r,n):ar(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ci(r,i),_T(e,t,r,i,n);case 7:return ar(e,t,t.pendingProps,n),t.child;case 8:return ar(e,t,t.pendingProps.children,n),t.child;case 12:return ar(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,s=i.value,mt(Qm,r._currentValue),r._currentValue=s,o!==null)if($i(o.value,s)){if(o.children===i.children&&!Cr.current){t=cs(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=ts(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),x2(o.return,n,t),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(te(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),x2(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}ar(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Ku(t,n),i=hi(i),r=r(i),t.flags|=1,ar(e,t,r,n),t.child;case 14:return r=t.type,i=Ci(r,t.pendingProps),i=Ci(r.type,i),wT(e,t,r,i,n);case 15:return KO(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ci(r,i),rm(e,t),t.tag=1,Tr(r)?(e=!0,Km(t)):e=!1,Ku(t,n),xO(t,r,i),T2(t,r,i,n),k2(null,t,r,!0,e,n);case 19:return JO(e,t,n);case 22:return YO(e,t,n)}throw Error(te(156,t.tag))};function gR(e,t){return V9(e,t)}function AU(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function li(e,t,n,r){return new AU(e,t,n,r)}function kC(e){return e=e.prototype,!(!e||!e.isReactComponent)}function OU(e){if(typeof e=="function")return kC(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Wx)return 11;if(e===Kx)return 14}return 2}function ra(e,t){var n=e.alternate;return n===null?(n=li(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function sm(e,t,n,r,i,o){var s=2;if(r=e,typeof e=="function")kC(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Pu:return ll(n.children,i,o,t);case qx:s=8,i|=8;break;case Y_:return e=li(12,n,t,i|2),e.elementType=Y_,e.lanes=o,e;case X_:return e=li(13,n,t,i),e.elementType=X_,e.lanes=o,e;case Q_:return e=li(19,n,t,i),e.elementType=Q_,e.lanes=o,e;case C9:return $0(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case w9:s=10;break e;case x9:s=9;break e;case Wx:s=11;break e;case Kx:s=14;break e;case Ls:s=16,r=null;break e}throw Error(te(130,e==null?e:typeof e,""))}return t=li(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function ll(e,t,n,r){return e=li(7,e,r,t),e.lanes=n,e}function $0(e,t,n,r){return e=li(22,e,r,t),e.elementType=C9,e.lanes=n,e.stateNode={isHidden:!1},e}function bS(e,t,n){return e=li(6,e,null,t),e.lanes=n,e}function SS(e,t,n){return t=li(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function RU(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=eS(0),this.expirationTimes=eS(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=eS(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function AC(e,t,n,r,i,o,s,a,l){return e=new RU(e,t,n,a,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=li(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},fC(o),e}function IU(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(bR)}catch(e){console.error(e)}}bR(),y9.exports=qr;var ai=y9.exports;const BTe=Il(ai);var LT=ai;W_.createRoot=LT.createRoot,W_.hydrateRoot=LT.hydrateRoot;const $U="modulepreload",FU=function(e,t){return new URL(e,t).href},$T={},SR=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=FU(o,r),o in $T)return;$T[o]=!0;const s=o.endsWith(".css"),a=s?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const d=i[c];if(d.href===o&&(!s||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const u=document.createElement("link");if(u.rel=s?"stylesheet":$U,s||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),s)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})};var _R={exports:{}},wR={};/** - * @license React - * use-sync-external-store-shim.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 _c=E;function BU(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var jU=typeof Object.is=="function"?Object.is:BU,VU=_c.useState,zU=_c.useEffect,UU=_c.useLayoutEffect,GU=_c.useDebugValue;function HU(e,t){var n=t(),r=VU({inst:{value:n,getSnapshot:t}}),i=r[0].inst,o=r[1];return UU(function(){i.value=n,i.getSnapshot=t,_S(i)&&o({inst:i})},[e,n,t]),zU(function(){return _S(i)&&o({inst:i}),e(function(){_S(i)&&o({inst:i})})},[e]),GU(n),n}function _S(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!jU(e,n)}catch{return!0}}function qU(e,t){return t()}var WU=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?qU:HU;wR.useSyncExternalStore=_c.useSyncExternalStore!==void 0?_c.useSyncExternalStore:WU;_R.exports=wR;var KU=_R.exports,xR={exports:{}},CR={};/** - * @license React - * use-sync-external-store-shim/with-selector.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 z0=E,YU=KU;function XU(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var QU=typeof Object.is=="function"?Object.is:XU,ZU=YU.useSyncExternalStore,JU=z0.useRef,eG=z0.useEffect,tG=z0.useMemo,nG=z0.useDebugValue;CR.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=JU(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=tG(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),i!==void 0&&s.hasValue){var p=s.value;if(i(p,h))return d=p}return d=h}if(p=d,QU(c,h))return p;var g=r(h);return i!==void 0&&i(p,g)?p:(c=h,d=g)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,r,i]);var a=ZU(e,o[0],o[1]);return eG(function(){s.hasValue=!0,s.value=a},[a]),nG(a),a};xR.exports=CR;var TR=xR.exports;const rG=Il(TR);function iG(e){e()}let ER=iG;const oG=e=>ER=e,sG=()=>ER,FT=Symbol.for(`react-redux-context-${E.version}`),BT=globalThis;function aG(){let e=BT[FT];return e||(e=E.createContext(null),BT[FT]=e),e}const ha=new Proxy({},new Proxy({},{get(e,t){const n=aG();return(r,...i)=>Reflect[t](n,...i)}}));function MC(e=ha){return function(){return E.useContext(e)}}const PR=MC(),lG=()=>{throw new Error("uSES not initialized!")};let kR=lG;const uG=e=>{kR=e},cG=(e,t)=>e===t;function dG(e=ha){const t=e===ha?PR:MC(e);return function(r,i={}){const{equalityFn:o=cG,stabilityCheck:s=void 0,noopCheck:a=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:l,subscription:u,getServerState:c,stabilityCheck:d,noopCheck:f}=t();E.useRef(!0);const h=E.useCallback({[r.name](g){return r(g)}}[r.name],[r,d,s]),p=kR(u.addNestedSub,l.getState,c||l.getState,h,o);return E.useDebugValue(p),p}}const AR=dG();function ly(){return ly=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const jT={notify(){},get:()=>[]};function xG(e,t){let n,r=jT;function i(d){return l(),r.subscribe(d)}function o(){r.notify()}function s(){c.onStateChange&&c.onStateChange()}function a(){return!!n}function l(){n||(n=t?t.addNestedSub(s):e.subscribe(s),r=wG())}function u(){n&&(n(),n=void 0,r.clear(),r=jT)}const c={addNestedSub:i,notifyNestedSubs:o,handleChangeWrapper:s,isSubscribed:a,trySubscribe:l,tryUnsubscribe:u,getListeners:()=>r};return c}const CG=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",TG=CG?E.useLayoutEffect:E.useEffect;function VT(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function uy(e,t){if(VT(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const u=xG(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),a=E.useMemo(()=>e.getState(),[e]);TG(()=>{const{subscription:u}=s;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),a!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[s,a]);const l=t||ha;return Ve.createElement(l.Provider,{value:s},n)}function DR(e=ha){const t=e===ha?PR:MC(e);return function(){const{store:r}=t();return r}}const LR=DR();function PG(e=ha){const t=e===ha?LR:DR(e);return function(){return t().dispatch}}const $R=PG();uG(TR.useSyncExternalStoreWithSelector);oG(ai.unstable_batchedUpdates);function Tn(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:uv(e)?2:cv(e)?3:0}function ia(e,t){return pa(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function am(e,t){return pa(e)===2?e.get(t):e[t]}function FR(e,t,n){var r=pa(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function BR(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function uv(e){return MG&&e instanceof Map}function cv(e){return NG&&e instanceof Set}function Sn(e){return e.o||e.t}function jC(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=VR(e);delete t[Pe];for(var n=Qu(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=kG),Object.freeze(e),t&&ds(e,function(n,r){return Xh(r,!0)},!0)),e}function kG(){Tn(2)}function VC(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function go(e){var t=V2[e];return t||Tn(18,e),t}function zC(e,t){V2[e]||(V2[e]=t)}function jf(){return zf}function wS(e,t){t&&(go("Patches"),e.u=[],e.s=[],e.v=t)}function cy(e){j2(e),e.p.forEach(AG),e.p=null}function j2(e){e===zf&&(zf=e.l)}function zT(e){return zf={p:[],l:zf,h:e,m:!0,_:0}}function AG(e){var t=e[Pe];t.i===0||t.i===1?t.j():t.g=!0}function xS(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||go("ES5").S(t,e,r),r?(n[Pe].P&&(cy(t),Tn(4)),Ar(e)&&(e=dy(t,e),t.l||fy(t,e)),t.u&&go("Patches").M(n[Pe].t,e,t.u,t.s)):e=dy(t,n,[]),cy(t),t.u&&t.v(t.u,t.s),e!==fv?e:void 0}function dy(e,t,n){if(VC(t))return t;var r=t[Pe];if(!r)return ds(t,function(a,l){return UT(e,r,t,a,l,n)},!0),t;if(r.A!==e)return t;if(!r.P)return fy(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=jC(r.k):r.o,o=i,s=!1;r.i===3&&(o=new Set(i),i.clear(),s=!0),ds(o,function(a,l){return UT(e,r,i,a,l,n,s)}),fy(e,i,!1),n&&e.u&&go("Patches").N(r,n,e.u,e.s)}return r.o}function UT(e,t,n,r,i,o,s){if(cr(i)){var a=dy(e,i,o&&t&&t.i!==3&&!ia(t.R,r)?o.concat(r):void 0);if(FR(n,r,a),!cr(a))return;e.m=!1}else s&&n.add(i);if(Ar(i)&&!VC(i)){if(!e.h.D&&e._<1)return;dy(e,i),t&&t.A.l||fy(e,i)}}function fy(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&Xh(t,n)}function CS(e,t){var n=e[Pe];return(n?Sn(n):e)[t]}function GT(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function Sr(e){e.P||(e.P=!0,e.l&&Sr(e.l))}function TS(e){e.o||(e.o=jC(e.t))}function Vf(e,t,n){var r=uv(t)?go("MapSet").F(t,n):cv(t)?go("MapSet").T(t,n):e.O?function(i,o){var s=Array.isArray(i),a={i:s?1:0,A:o?o.A:jf(),P:!1,I:!1,R:{},l:o,t:i,k:null,o:null,j:null,C:!1},l=a,u=Uf;s&&(l=[a],u=qd);var c=Proxy.revocable(l,u),d=c.revoke,f=c.proxy;return a.k=f,a.j=d,f}(t,n):go("ES5").J(t,n);return(n?n.A:jf()).p.push(r),r}function dv(e){return cr(e)||Tn(22,e),function t(n){if(!Ar(n))return n;var r,i=n[Pe],o=pa(n);if(i){if(!i.P&&(i.i<4||!go("ES5").K(i)))return i.t;i.I=!0,r=HT(n,o),i.I=!1}else r=HT(n,o);return ds(r,function(s,a){i&&am(i.t,s)===a||FR(r,s,t(a))}),o===3?new Set(r):r}(e)}function HT(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return jC(e)}function UC(){function e(o,s){var a=i[o];return a?a.enumerable=s:i[o]=a={configurable:!0,enumerable:s,get:function(){var l=this[Pe];return Uf.get(l,o)},set:function(l){var u=this[Pe];Uf.set(u,o,l)}},a}function t(o){for(var s=o.length-1;s>=0;s--){var a=o[s][Pe];if(!a.P)switch(a.i){case 5:r(a)&&Sr(a);break;case 4:n(a)&&Sr(a)}}}function n(o){for(var s=o.t,a=o.k,l=Qu(a),u=l.length-1;u>=0;u--){var c=l[u];if(c!==Pe){var d=s[c];if(d===void 0&&!ia(s,c))return!0;var f=a[c],h=f&&f[Pe];if(h?h.t!==d:!BR(f,d))return!0}}var p=!!s[Pe];return l.length!==Qu(s).length+(p?0:1)}function r(o){var s=o.k;if(s.length!==o.t.length)return!0;var a=Object.getOwnPropertyDescriptor(s,s.length-1);if(a&&!a.get)return!0;for(var l=0;l1?v-1:0),m=1;m1?c-1:0),f=1;f=0;i--){var o=r[i];if(o.path.length===0&&o.op==="replace"){n=o.value;break}}i>-1&&(r=r.slice(i+1));var s=go("Patches").$;return cr(n)?s(n,r):this.produce(n,function(a){return s(a,r)})},e}(),zr=new zR,UR=zr.produce,qC=zr.produceWithPatches.bind(zr),LG=zr.setAutoFreeze.bind(zr),$G=zr.setUseProxies.bind(zr),z2=zr.applyPatches.bind(zr),FG=zr.createDraft.bind(zr),BG=zr.finishDraft.bind(zr);const Pa=UR,jTe=Object.freeze(Object.defineProperty({__proto__:null,Immer:zR,applyPatches:z2,castDraft:RG,castImmutable:IG,createDraft:FG,current:dv,default:Pa,enableAllPlugins:OG,enableES5:UC,enableMapSet:jR,enablePatches:GC,finishDraft:BG,freeze:Xh,immerable:Xu,isDraft:cr,isDraftable:Ar,nothing:fv,original:BC,produce:UR,produceWithPatches:qC,setAutoFreeze:LG,setUseProxies:$G},Symbol.toStringTag,{value:"Module"}));function Gf(e){"@babel/helpers - typeof";return Gf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gf(e)}function jG(e,t){if(Gf(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Gf(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function VG(e){var t=jG(e,"string");return Gf(t)==="symbol"?t:String(t)}function zG(e,t,n){return t=VG(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function KT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function YT(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Nn(1));return n(Qh)(e,t)}if(typeof e!="function")throw new Error(Nn(2));var i=e,o=t,s=[],a=s,l=!1;function u(){a===s&&(a=s.slice())}function c(){if(l)throw new Error(Nn(3));return o}function d(g){if(typeof g!="function")throw new Error(Nn(4));if(l)throw new Error(Nn(5));var S=!0;return u(),a.push(g),function(){if(S){if(l)throw new Error(Nn(6));S=!1,u();var y=a.indexOf(g);a.splice(y,1),s=null}}}function f(g){if(!UG(g))throw new Error(Nn(7));if(typeof g.type>"u")throw new Error(Nn(8));if(l)throw new Error(Nn(9));try{l=!0,o=i(o,g)}finally{l=!1}for(var S=s=a,v=0;v"u")throw new Error(Nn(12));if(typeof n(void 0,{type:wc.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Nn(13))})}function Kc(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(Nn(14));d[h]=S,c=c||S!==g}return c=c||o.length!==Object.keys(l).length,c?d:l}}function QT(e,t){return function(){return t(e.apply(this,arguments))}}function HR(e,t){if(typeof e=="function")return QT(e,t);if(typeof e!="object"||e===null)throw new Error(Nn(16));var n={};for(var r in e){var i=e[r];typeof i=="function"&&(n[r]=QT(i,t))}return n}function xc(){for(var e=arguments.length,t=new Array(e),n=0;n-1){var u=n[l];return l>0&&(n.splice(l,1),n.unshift(u)),u.value}return hy}function i(a,l){r(a)===hy&&(n.unshift({key:a,value:l}),n.length>e&&n.pop())}function o(){return n}function s(){n=[]}return{get:r,put:i,getEntries:o,clear:s}}var qR=function(t,n){return t===n};function KG(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,o=0;o1?t-1:0),r=1;r0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]",value:e};if(typeof e!="object"||e===null||o!=null&&o.has(e))return!1;for(var a=r!=null?r(e):Object.entries(e),l=i.length>0,u=function(S,v){var y=t?t+"."+S:S;if(l){var m=i.some(function(b){return b instanceof RegExp?b.test(y):y===b});if(m)return"continue"}if(!n(v))return{value:{keyPath:y,value:v}};if(typeof v=="object"&&(s=eI(v,y,n,r,i,o),s))return{value:s}},c=0,d=a;c-1}function cH(e){return""+e}function oI(e){var t={},n=[],r,i={addCase:function(o,s){var a=typeof o=="string"?o:o.type;if(a in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[a]=s,i},addMatcher:function(o,s){return n.push({matcher:o,reducer:s}),i},addDefaultCase:function(o){return r=o,i}};return e(i),[t,n,r]}function dH(e){return typeof e=="function"}function sI(e,t,n,r){n===void 0&&(n=[]);var i=typeof t=="function"?oI(t):[t,n,r],o=i[0],s=i[1],a=i[2],l;if(dH(e))l=function(){return U2(e())};else{var u=U2(e);l=function(){return u}}function c(d,f){d===void 0&&(d=l());var h=ga([o[f.type]],s.filter(function(p){var g=p.matcher;return g(f)}).map(function(p){var g=p.reducer;return g}));return h.filter(function(p){return!!p}).length===0&&(h=[a]),h.reduce(function(p,g){if(g)if(cr(p)){var S=p,v=g(S,f);return v===void 0?p:v}else{if(Ar(p))return Pa(p,function(y){return g(y,f)});var v=g(p,f);if(v===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return v}return p},d)}return c.getInitialState=l,c}function fH(e,t){return e+"/"+t}function jt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");typeof process<"u";var n=typeof e.initialState=="function"?e.initialState:U2(e.initialState),r=e.reducers||{},i=Object.keys(r),o={},s={},a={};i.forEach(function(c){var d=r[c],f=fH(t,c),h,p;"reducer"in d?(h=d.reducer,p=d.prepare):h=d,o[c]=h,s[f]=h,a[c]=p?ge(f,p):ge(f)});function l(){var c=typeof e.extraReducers=="function"?oI(e.extraReducers):[e.extraReducers],d=c[0],f=d===void 0?{}:d,h=c[1],p=h===void 0?[]:h,g=c[2],S=g===void 0?void 0:g,v=wr(wr({},f),s);return sI(n,function(y){for(var m in v)y.addCase(m,v[m]);for(var b=0,_=p;b<_.length;b++){var w=_[b];y.addMatcher(w.matcher,w.reducer)}S&&y.addDefaultCase(S)})}var u;return{name:t,reducer:function(c,d){return u||(u=l()),u(c,d)},actions:a,caseReducers:o,getInitialState:function(){return u||(u=l()),u.getInitialState()}}}function hH(){return{ids:[],entities:{}}}function pH(){function e(t){return t===void 0&&(t={}),Object.assign(hH(),t)}return{getInitialState:e}}function gH(){function e(t){var n=function(u){return u.ids},r=function(u){return u.entities},i=Uo(n,r,function(u,c){return u.map(function(d){return c[d]})}),o=function(u,c){return c},s=function(u,c){return u[c]},a=Uo(n,function(u){return u.length});if(!t)return{selectIds:n,selectEntities:r,selectAll:i,selectTotal:a,selectById:Uo(r,o,s)};var l=Uo(t,r);return{selectIds:Uo(t,n),selectEntities:l,selectAll:Uo(t,i),selectTotal:Uo(t,a),selectById:Uo(l,o,s)}}return{getSelectors:e}}function mH(e){var t=zt(function(n,r){return e(r)});return function(r){return t(r,void 0)}}function zt(e){return function(n,r){function i(s){return iI(s)}var o=function(s){i(r)?e(r.payload,s):e(r,s)};return cr(n)?(o(n),n):Pa(n,o)}}function cf(e,t){var n=t(e);return n}function ul(e){return Array.isArray(e)||(e=Object.values(e)),e}function aI(e,t,n){e=ul(e);for(var r=[],i=[],o=0,s=e;o0;if(y){var m=p.filter(function(b){return u(S,b,g)}).length>0;m&&(g.ids=Object.keys(g.entities))}}function f(p,g){return h([p],g)}function h(p,g){var S=aI(p,e,g),v=S[0],y=S[1];d(y,g),n(v,g)}return{removeAll:mH(l),addOne:zt(t),addMany:zt(n),setOne:zt(r),setMany:zt(i),setAll:zt(o),updateOne:zt(c),updateMany:zt(d),upsertOne:zt(f),upsertMany:zt(h),removeOne:zt(s),removeMany:zt(a)}}function yH(e,t){var n=lI(e),r=n.removeOne,i=n.removeMany,o=n.removeAll;function s(y,m){return a([y],m)}function a(y,m){y=ul(y);var b=y.filter(function(_){return!(cf(_,e)in m.entities)});b.length!==0&&S(b,m)}function l(y,m){return u([y],m)}function u(y,m){y=ul(y),y.length!==0&&S(y,m)}function c(y,m){y=ul(y),m.entities={},m.ids=[],a(y,m)}function d(y,m){return f([y],m)}function f(y,m){for(var b=!1,_=0,w=y;_-1;return n&&r}function ep(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function gv(){for(var e=[],t=0;t0)for(var m=h.getState(),b=Array.from(n.values()),_=0,w=b;_=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(s)throw a}}}}function kI(e,t){if(e){if(typeof e=="string")return sE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sE(e,t)}}function sE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=r.prefix,o=r.driver,s=r.persistWholeStore,a=r.serialize;try{var l=s?QH:ZH;yield l(t,n,{prefix:i,driver:o,serialize:a})}catch(u){console.warn("redux-remember: persist error",u)}});return function(){return e.apply(this,arguments)}}();function cE(e,t,n,r,i,o,s){try{var a=e[o](s),l=a.value}catch(u){n(u);return}a.done?t(l):Promise.resolve(l).then(r,i)}function dE(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(l){cE(o,r,i,s,a,"next",l)}function a(l){cE(o,r,i,s,a,"throw",l)}s(void 0)})}}var eq=function(){var e=dE(function*(t,n,r){var i=r.prefix,o=r.driver,s=r.serialize,a=r.unserialize,l=r.persistThrottle,u=r.persistDebounce,c=r.persistWholeStore;yield qH(t,n,{prefix:i,driver:o,unserialize:a,persistWholeStore:c});var d={},f=function(){var h=dE(function*(){var p=PI(t.getState(),n);yield JH(p,d,{prefix:i,driver:o,serialize:s,persistWholeStore:c}),ZC(p,d)||t.dispatch({type:VH,payload:p}),d=p});return function(){return h.apply(this,arguments)}}();u&&u>0?t.subscribe(UH(f,u)):t.subscribe(zH(f,l))});return function(n,r,i){return e.apply(this,arguments)}}();const tq=eq;function qf(e){"@babel/helpers - typeof";return qf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qf(e)}function fE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function RS(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:n.state,i=arguments.length>1?arguments[1]:void 0;i.type&&(i.type==="@@INIT"||i.type.startsWith("@@redux/INIT"))&&(n.state=RS({},r));var o=typeof t=="function"?t:Kc(t);switch(i.type){case W2:return n.state=o(RS(RS({},n.state),i.payload||{}),{type:W2}),n.state;default:return o(r,i)}}},sq=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.prefix,o=i===void 0?"@@remember-":i,s=r.serialize,a=s===void 0?function(S,v){return JSON.stringify(S)}:s,l=r.unserialize,u=l===void 0?function(S,v){return JSON.parse(S)}:l,c=r.persistThrottle,d=c===void 0?100:c,f=r.persistDebounce,h=r.persistWholeStore,p=h===void 0?!1:h;if(!t)throw Error("redux-remember error: driver required");if(!Array.isArray(n))throw Error("redux-remember error: rememberedKeys needs to be an array");var g=function(v){return function(y,m,b){var _=v(y,m,b);return tq(_,n,{driver:t,prefix:o,serialize:a,unserialize:u,persistThrottle:d,persistDebounce:f,persistWholeStore:p}),_}};return g};const Wd=(e,t)=>Math.floor(e/t)*t,to=(e,t)=>Math.round(e/t)*t;var aq=typeof global=="object"&&global&&global.Object===Object&&global;const OI=aq;var lq=typeof self=="object"&&self&&self.Object===Object&&self,uq=OI||lq||Function("return this")();const ko=uq;var cq=ko.Symbol;const gi=cq;var RI=Object.prototype,dq=RI.hasOwnProperty,fq=RI.toString,xd=gi?gi.toStringTag:void 0;function hq(e){var t=dq.call(e,xd),n=e[xd];try{e[xd]=void 0;var r=!0}catch{}var i=fq.call(e);return r&&(t?e[xd]=n:delete e[xd]),i}var pq=Object.prototype,gq=pq.toString;function mq(e){return gq.call(e)}var yq="[object Null]",vq="[object Undefined]",hE=gi?gi.toStringTag:void 0;function Oa(e){return e==null?e===void 0?vq:yq:hE&&hE in Object(e)?hq(e):mq(e)}function Bi(e){return e!=null&&typeof e=="object"}var bq="[object Symbol]";function yv(e){return typeof e=="symbol"||Bi(e)&&Oa(e)==bq}function JC(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n0){if(++t>=Qq)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function tW(e){return function(){return e}}var nW=function(){try{var e=Ll(Object,"defineProperty");return e({},"",{}),e}catch{}}();const vy=nW;var rW=vy?function(e,t){return vy(e,"toString",{configurable:!0,enumerable:!1,value:tW(t),writable:!0})}:vv;const iW=rW;var oW=eW(iW);const DI=oW;function LI(e,t){for(var n=-1,r=e==null?0:e.length;++n-1}var dW=9007199254740991,fW=/^(?:0|[1-9]\d*)$/;function bv(e,t){var n=typeof e;return t=t??dW,!!t&&(n=="number"||n!="symbol"&&fW.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=gW}function Xc(e){return e!=null&&n5(e.length)&&!e5(e)}function BI(e,t,n){if(!Pn(n))return!1;var r=typeof t;return(r=="number"?Xc(n)&&bv(t,n.length):r=="string"&&t in n)?ip(n[t],e):!1}function jI(e){return FI(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,s&&BI(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++r-1}function OK(e,t){var n=this.__data__,r=_v(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function vs(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0&&n(a)?t>1?WI(a,t-1,n,r,i):l5(i,a):r||(i[i.length]=a)}return i}function KK(e){var t=e==null?0:e.length;return t?WI(e,1):[]}function YK(e){return DI($I(e,void 0,KK),e+"")}var XK=HI(Object.getPrototypeOf,Object);const u5=XK;var QK="[object Object]",ZK=Function.prototype,JK=Object.prototype,KI=ZK.toString,eY=JK.hasOwnProperty,tY=KI.call(Object);function YI(e){if(!Bi(e)||Oa(e)!=QK)return!1;var t=u5(e);if(t===null)return!0;var n=eY.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&KI.call(n)==tY}function nY(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r=t?e:t)),e}function Zo(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=IS(n),n=n===n?n:0),t!==void 0&&(t=IS(t),t=t===t?t:0),hY(IS(e),t,n)}function pY(){this.__data__=new vs,this.size=0}function gY(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function mY(e){return this.__data__.get(e)}function yY(e){return this.__data__.has(e)}var vY=200;function bY(e,t){var n=this.__data__;if(n instanceof vs){var r=n.__data__;if(!Xf||r.lengtha))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,h=n&JX?new Qf:void 0;for(o.set(e,t),o.set(t,e);++d1),o}),Yc(e,d5(e),n),r&&(n=ff(n,aZ|lZ|uZ,sZ));for(var i=t.length;i--;)m7(n,t[i]);return n});const p5=cZ;function dZ(e,t,n,r){if(!Pn(e))return e;t=Qc(t,e);for(var i=-1,o=t.length,s=o-1,a=e;a!=null&&++i=LZ){var u=t?null:DZ(e);if(u)return h5(u);s=!1,i=l7,l=new Qf}else l=t?[]:a;e:for(;++r{oZ(e,t.payload)}}}),{configChanged:VZ}=E7.actions,zZ=E7.reducer,ed=()=>$R(),Zf=AR;function UZ(e){if(e.sheet)return e.sheet;for(var t=0;t0?Ln(td,--Or):0,Pc--,tn===10&&(Pc=1,kv--),tn}function jr(){return tn=Or2||eh(tn)>3?"":" "}function nJ(e,t){for(;--t&&jr()&&!(tn<48||tn>102||tn>57&&tn<65||tn>70&&tn<97););return up(e,um()+(t<6&&mo()==32&&jr()==32))}function ow(e){for(;jr();)switch(tn){case e:return Or;case 34:case 39:e!==34&&e!==39&&ow(tn);break;case 40:e===41&&ow(e);break;case 92:jr();break}return Or}function rJ(e,t){for(;jr()&&e+tn!==47+10;)if(e+tn===42+42&&mo()===47)break;return"/*"+up(t,Or-1)+"*"+Pv(e===47?e:jr())}function iJ(e){for(;!eh(mo());)jr();return up(e,Or)}function oJ(e){return I7(dm("",null,null,null,[""],e=R7(e),0,[0],e))}function dm(e,t,n,r,i,o,s,a,l){for(var u=0,c=0,d=s,f=0,h=0,p=0,g=1,S=1,v=1,y=0,m="",b=i,_=o,w=r,x=m;S;)switch(p=y,y=jr()){case 40:if(p!=108&&Ln(x,d-1)==58){iw(x+=tt(cm(y),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:x+=cm(y);break;case 9:case 10:case 13:case 32:x+=tJ(p);break;case 92:x+=nJ(um()-1,7);continue;case 47:switch(mo()){case 42:case 47:fg(sJ(rJ(jr(),um()),t,n),l);break;default:x+="/"}break;case 123*g:a[u++]=Qi(x)*v;case 125*g:case 59:case 0:switch(y){case 0:case 125:S=0;case 59+c:v==-1&&(x=tt(x,/\f/g,"")),h>0&&Qi(x)-d&&fg(h>32?GE(x+";",r,n,d-1):GE(tt(x," ","")+";",r,n,d-2),l);break;case 59:x+=";";default:if(fg(w=UE(x,t,n,u,c,i,a,m,b=[],_=[],d),o),y===123)if(c===0)dm(x,t,w,w,b,o,d,a,_);else switch(f===99&&Ln(x,3)===110?100:f){case 100:case 108:case 109:case 115:dm(e,w,w,r&&fg(UE(e,w,w,0,0,i,a,m,i,b=[],d),_),i,_,d,a,r?b:_);break;default:dm(x,w,w,w,[""],_,0,a,_)}}u=c=h=0,g=v=1,m=x="",d=s;break;case 58:d=1+Qi(x),h=p;default:if(g<1){if(y==123)--g;else if(y==125&&g++==0&&eJ()==125)continue}switch(x+=Pv(y),y*g){case 38:v=c>0?1:(x+="\f",-1);break;case 44:a[u++]=(Qi(x)-1)*v,v=1;break;case 64:mo()===45&&(x+=cm(jr())),f=mo(),c=d=Qi(m=x+=iJ(um())),y++;break;case 45:p===45&&Qi(x)==2&&(g=0)}}return o}function UE(e,t,n,r,i,o,s,a,l,u,c){for(var d=i-1,f=i===0?o:[""],h=v5(f),p=0,g=0,S=0;p0?f[v]+" "+y:tt(y,/&\f/g,f[v])))&&(l[S++]=m);return Av(e,t,n,i===0?m5:a,l,u,c)}function sJ(e,t,n){return Av(e,t,n,P7,Pv(JZ()),Jf(e,2,-2),0)}function GE(e,t,n,r){return Av(e,t,n,y5,Jf(e,0,r),Jf(e,r+1,-1),r)}function nc(e,t){for(var n="",r=v5(e),i=0;i6)switch(Ln(e,t+1)){case 109:if(Ln(e,t+4)!==45)break;case 102:return tt(e,/(.+:)(.+)-([^]+)/,"$1"+et+"$2-$3$1"+Sy+(Ln(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~iw(e,"stretch")?N7(tt(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ln(e,t+1)!==115)break;case 6444:switch(Ln(e,Qi(e)-3-(~iw(e,"!important")&&10))){case 107:return tt(e,":",":"+et)+e;case 101:return tt(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+et+(Ln(e,14)===45?"inline-":"")+"box$3$1"+et+"$2$3$1"+Wn+"$2box$3")+e}break;case 5936:switch(Ln(e,t+11)){case 114:return et+e+Wn+tt(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return et+e+Wn+tt(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return et+e+Wn+tt(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return et+e+Wn+e+e}return e}var gJ=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case y5:t.return=N7(t.value,t.length);break;case k7:return nc([Cd(t,{value:tt(t.value,"@","@"+et)})],i);case m5:if(t.length)return ZZ(t.props,function(o){switch(QZ(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return nc([Cd(t,{props:[tt(o,/:(read-\w+)/,":"+Sy+"$1")]})],i);case"::placeholder":return nc([Cd(t,{props:[tt(o,/:(plac\w+)/,":"+et+"input-$1")]}),Cd(t,{props:[tt(o,/:(plac\w+)/,":"+Sy+"$1")]}),Cd(t,{props:[tt(o,/:(plac\w+)/,Wn+"input-$1")]})],i)}return""})}},mJ=[gJ],yJ=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(g){var S=g.getAttribute("data-emotion");S.indexOf(" ")!==-1&&(document.head.appendChild(g),g.setAttribute("data-s",""))})}var i=t.stylisPlugins||mJ,o={},s,a=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(g){for(var S=g.getAttribute("data-emotion").split(" "),v=1;v=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var _J={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},wJ=/[A-Z]|^ms/g,xJ=/_EMO_([^_]+?)_([^]*?)_EMO_/g,$7=function(t){return t.charCodeAt(1)===45},WE=function(t){return t!=null&&typeof t!="boolean"},$S=M7(function(e){return $7(e)?e:e.replace(wJ,"-$&").toLowerCase()}),KE=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(xJ,function(r,i,o){return Zi={name:i,styles:o,next:Zi},i})}return _J[t]!==1&&!$7(t)&&typeof n=="number"&&n!==0?n+"px":n};function th(e,t,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return Zi={name:n.name,styles:n.styles,next:Zi},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)Zi={name:r.name,styles:r.styles,next:Zi},r=r.next;var i=n.styles+";";return i}return CJ(e,t,n)}case"function":{if(e!==void 0){var o=Zi,s=n(e);return Zi=o,th(e,t,s)}break}}if(t==null)return n;var a=t[n];return a!==void 0?a:n}function CJ(e,t,n){var r="";if(Array.isArray(n))for(var i=0;ij.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),FJ=e=>{const{appendToParentPortal:t,children:n}=e,[r,i]=E.useState(null),o=E.useRef(null),[,s]=E.useState({});E.useEffect(()=>s({}),[]);const a=DJ(),l=MJ();rh(()=>{if(!r)return;const c=r.ownerDocument,d=t?a??c.body:c.body;if(!d)return;o.current=c.createElement("div"),o.current.className=S5,d.appendChild(o.current),s({});const f=o.current;return()=>{d.contains(f)&&d.removeChild(f)}},[r]);const u=l!=null&&l.zIndex?j.jsx($J,{zIndex:l==null?void 0:l.zIndex,children:n}):n;return o.current?ai.createPortal(j.jsx(V7,{value:o.current,children:u}),o.current):j.jsx("span",{ref:c=>{c&&i(c)}})},BJ=e=>{const{children:t,containerRef:n,appendToParentPortal:r}=e,i=n.current,o=i??(typeof window<"u"?document.body:void 0),s=E.useMemo(()=>{const l=i==null?void 0:i.ownerDocument.createElement("div");return l&&(l.className=S5),l},[i]),[,a]=E.useState({});return rh(()=>a({}),[]),rh(()=>{if(!(!s||!o))return o.appendChild(s),()=>{o.removeChild(s)}},[s,o]),o&&s?ai.createPortal(j.jsx(V7,{value:r?s:null,children:t}),s):null};function cp(e){const t={appendToParentPortal:!0,...e},{containerRef:n,...r}=t;return n?j.jsx(BJ,{containerRef:n,...r}):j.jsx(FJ,{...r})}cp.className=S5;cp.selector=LJ;cp.displayName="Portal";function Ov(){const e=E.useContext(nh);if(!e)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `` or ``");return e}var z7=E.createContext({});z7.displayName="ColorModeContext";function _5(){const e=E.useContext(z7);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function YTe(e,t){const{colorMode:n}=_5();return n==="dark"?t:e}function U7(){const e=_5(),t=Ov();return{...e,theme:t}}function jJ(e,t,n){var r,i;if(t==null)return t;const o=s=>{var a,l;return(l=(a=e.__breakpoints)==null?void 0:a.asArray)==null?void 0:l[s]};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function VJ(e,t,n){var r,i;if(t==null)return t;const o=s=>{var a,l;return(l=(a=e.__cssMap)==null?void 0:a[s])==null?void 0:l.value};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function XTe(e,t,n){const r=Ov();return zJ(e,t,n)(r)}function zJ(e,t,n){const r=Array.isArray(t)?t:[t],i=Array.isArray(n)?n:[n];return o=>{const s=i.filter(Boolean),a=r.map((l,u)=>{var c,d;if(e==="breakpoints")return jJ(o,l,(c=s[u])!=null?c:l);const f=`${e}.${l}`;return VJ(o,f,(d=s[u])!=null?d:l)});return Array.isArray(t)?a:a[0]}}var Un=(...e)=>e.filter(Boolean).join(" ");function UJ(){return!1}function yo(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}var QTe=e=>{const{condition:t,message:n}=e;t&&UJ()&&console.warn(n)};function ao(e,...t){return GJ(e)?e(...t):e}var GJ=e=>typeof e=="function",Fu=e=>e?"":void 0,rc=e=>e?!0:void 0;function Dn(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function ZTe(...e){return function(n){e.forEach(r=>{r==null||r(n)})}}var _y={exports:{}};_y.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,s=9007199254740991,a="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",h="[object Function]",p="[object GeneratorFunction]",g="[object Map]",S="[object Number]",v="[object Null]",y="[object Object]",m="[object Proxy]",b="[object RegExp]",_="[object Set]",w="[object String]",x="[object Undefined]",C="[object WeakMap]",k="[object ArrayBuffer]",P="[object DataView]",A="[object Float32Array]",$="[object Float64Array]",N="[object Int8Array]",T="[object Int16Array]",O="[object Int32Array]",I="[object Uint8Array]",M="[object Uint8ClampedArray]",R="[object Uint16Array]",D="[object Uint32Array]",L=/[\\^$.*+?()[\]{}|]/g,V=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,U={};U[A]=U[$]=U[N]=U[T]=U[O]=U[I]=U[M]=U[R]=U[D]=!0,U[a]=U[l]=U[k]=U[c]=U[P]=U[d]=U[f]=U[h]=U[g]=U[S]=U[y]=U[b]=U[_]=U[w]=U[C]=!1;var K=typeof Ne=="object"&&Ne&&Ne.Object===Object&&Ne,W=typeof self=="object"&&self&&self.Object===Object&&self,X=K||W||Function("return this")(),F=t&&!t.nodeType&&t,q=F&&!0&&e&&!e.nodeType&&e,Q=q&&q.exports===F,J=Q&&K.process,ne=function(){try{var B=q&&q.require&&q.require("util").types;return B||J&&J.binding&&J.binding("util")}catch{}}(),Z=ne&&ne.isTypedArray;function me(B,G,Y){switch(Y.length){case 0:return B.call(G);case 1:return B.call(G,Y[0]);case 2:return B.call(G,Y[0],Y[1]);case 3:return B.call(G,Y[0],Y[1],Y[2])}return B.apply(G,Y)}function ae(B,G){for(var Y=-1,ue=Array(B);++Y-1}function Fo(B,G){var Y=this.__data__,ue=eu(Y,B);return ue<0?(++this.size,Y.push([B,G])):Y[ue][1]=G,this}On.prototype.clear=$o,On.prototype.delete=Ts,On.prototype.get=Es,On.prototype.has=Jl,On.prototype.set=Fo;function ir(B){var G=-1,Y=B==null?0:B.length;for(this.clear();++G1?Y[He-1]:void 0,xt=He>2?Y[2]:void 0;for(dt=B.length>3&&typeof dt=="function"?(He--,dt):void 0,xt&&Qj(Y[0],Y[1],xt)&&(dt=He<3?void 0:dt,He=1),G=Object(G);++ue-1&&B%1==0&&B0){if(++G>=i)return arguments[0]}else G=0;return B.apply(void 0,arguments)}}function oV(B){if(B!=null){try{return Ie.call(B)}catch{}try{return B+""}catch{}}return""}function qp(B,G){return B===G||B!==B&&G!==G}var Ub=Gp(function(){return arguments}())?Gp:function(B){return hd(B)&&nt.call(B,"callee")&&!Xt.call(B,"callee")},Gb=Array.isArray;function Hb(B){return B!=null&&w4(B.length)&&!qb(B)}function sV(B){return hd(B)&&Hb(B)}var _4=Do||dV;function qb(B){if(!ja(B))return!1;var G=nu(B);return G==h||G==p||G==u||G==m}function w4(B){return typeof B=="number"&&B>-1&&B%1==0&&B<=s}function ja(B){var G=typeof B;return B!=null&&(G=="object"||G=="function")}function hd(B){return B!=null&&typeof B=="object"}function aV(B){if(!hd(B)||nu(B)!=y)return!1;var G=ie(B);if(G===null)return!0;var Y=nt.call(G,"constructor")&&G.constructor;return typeof Y=="function"&&Y instanceof Y&&Ie.call(Y)==sn}var x4=Z?oe(Z):fd;function lV(B){return qj(B,C4(B))}function C4(B){return Hb(B)?$b(B,!0):Fj(B)}var uV=Wj(function(B,G,Y,ue){v4(B,G,Y,ue)});function cV(B){return function(){return B}}function T4(B){return B}function dV(){return!1}e.exports=uV})(_y,_y.exports);var HJ=_y.exports;const lo=Il(HJ);var qJ=e=>/!(important)?$/.test(e),QE=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,WJ=(e,t)=>n=>{const r=String(t),i=qJ(r),o=QE(r),s=e?`${e}.${o}`:o;let a=yo(n.__cssMap)&&s in n.__cssMap?n.__cssMap[s].varRef:t;return a=QE(a),i?`${a} !important`:a};function w5(e){const{scale:t,transform:n,compose:r}=e;return(o,s)=>{var a;const l=WJ(t,o)(s);let u=(a=n==null?void 0:n(l,s))!=null?a:l;return r&&(u=r(u,s)),u}}var hg=(...e)=>t=>e.reduce((n,r)=>r(n),t);function Qr(e,t){return n=>{const r={property:n,scale:e};return r.transform=w5({scale:e,transform:t}),r}}var KJ=({rtl:e,ltr:t})=>n=>n.direction==="rtl"?e:t;function YJ(e){const{property:t,scale:n,transform:r}=e;return{scale:n,property:KJ(t),transform:n?w5({scale:n,compose:r}):r}}var G7=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function XJ(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...G7].join(" ")}function QJ(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...G7].join(" ")}var ZJ={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},JJ={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function eee(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var tee={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},sw={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},nee=new Set(Object.values(sw)),aw=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),ree=e=>e.trim();function iee(e,t){if(e==null||aw.has(e))return e;if(!(lw(e)||aw.has(e)))return`url('${e}')`;const i=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),o=i==null?void 0:i[1],s=i==null?void 0:i[2];if(!o||!s)return e;const a=o.includes("-gradient")?o:`${o}-gradient`,[l,...u]=s.split(",").map(ree).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const c=l in sw?sw[l]:l;u.unshift(c);const d=u.map(f=>{if(nee.has(f))return f;const h=f.indexOf(" "),[p,g]=h!==-1?[f.substr(0,h),f.substr(h+1)]:[f],S=lw(g)?g:g&&g.split(" "),v=`colors.${p}`,y=v in t.__cssMap?t.__cssMap[v].varRef:p;return S?[y,...Array.isArray(S)?S:[S]].join(" "):y});return`${a}(${d.join(", ")})`}var lw=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),oee=(e,t)=>iee(e,t??{});function see(e){return/^var\(--.+\)$/.test(e)}var aee=e=>{const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}},qi=e=>t=>`${e}(${t})`,Ye={filter(e){return e!=="auto"?e:ZJ},backdropFilter(e){return e!=="auto"?e:JJ},ring(e){return eee(Ye.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?XJ():e==="auto-gpu"?QJ():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=aee(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const n={left:"right",right:"left"};return t.direction==="rtl"?n[e]:e},degree(e){if(see(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:oee,blur:qi("blur"),opacity:qi("opacity"),brightness:qi("brightness"),contrast:qi("contrast"),dropShadow:qi("drop-shadow"),grayscale:qi("grayscale"),hueRotate:qi("hue-rotate"),invert:qi("invert"),saturate:qi("saturate"),sepia:qi("sepia"),bgImage(e){return e==null||lw(e)||aw.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:n,divide:r}=(t=tee[e])!=null?t:{},i={flexDirection:e};return n&&(i[n]=1),r&&(i[r]=1),i}},H={borderWidths:Qr("borderWidths"),borderStyles:Qr("borderStyles"),colors:Qr("colors"),borders:Qr("borders"),gradients:Qr("gradients",Ye.gradient),radii:Qr("radii",Ye.px),space:Qr("space",hg(Ye.vh,Ye.px)),spaceT:Qr("space",hg(Ye.vh,Ye.px)),degreeT(e){return{property:e,transform:Ye.degree}},prop(e,t,n){return{property:e,scale:t,...t&&{transform:w5({scale:t,transform:n})}}},propT(e,t){return{property:e,transform:t}},sizes:Qr("sizes",hg(Ye.vh,Ye.px)),sizesT:Qr("sizes",hg(Ye.vh,Ye.fraction)),shadows:Qr("shadows"),logical:YJ,blur:Qr("blur",Ye.blur)},fm={background:H.colors("background"),backgroundColor:H.colors("backgroundColor"),backgroundImage:H.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Ye.bgClip},bgSize:H.prop("backgroundSize"),bgPosition:H.prop("backgroundPosition"),bg:H.colors("background"),bgColor:H.colors("backgroundColor"),bgPos:H.prop("backgroundPosition"),bgRepeat:H.prop("backgroundRepeat"),bgAttachment:H.prop("backgroundAttachment"),bgGradient:H.gradients("backgroundImage"),bgClip:{transform:Ye.bgClip}};Object.assign(fm,{bgImage:fm.backgroundImage,bgImg:fm.backgroundImage});var Je={border:H.borders("border"),borderWidth:H.borderWidths("borderWidth"),borderStyle:H.borderStyles("borderStyle"),borderColor:H.colors("borderColor"),borderRadius:H.radii("borderRadius"),borderTop:H.borders("borderTop"),borderBlockStart:H.borders("borderBlockStart"),borderTopLeftRadius:H.radii("borderTopLeftRadius"),borderStartStartRadius:H.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:H.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:H.radii("borderTopRightRadius"),borderStartEndRadius:H.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:H.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:H.borders("borderRight"),borderInlineEnd:H.borders("borderInlineEnd"),borderBottom:H.borders("borderBottom"),borderBlockEnd:H.borders("borderBlockEnd"),borderBottomLeftRadius:H.radii("borderBottomLeftRadius"),borderBottomRightRadius:H.radii("borderBottomRightRadius"),borderLeft:H.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:H.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:H.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:H.borders(["borderLeft","borderRight"]),borderInline:H.borders("borderInline"),borderY:H.borders(["borderTop","borderBottom"]),borderBlock:H.borders("borderBlock"),borderTopWidth:H.borderWidths("borderTopWidth"),borderBlockStartWidth:H.borderWidths("borderBlockStartWidth"),borderTopColor:H.colors("borderTopColor"),borderBlockStartColor:H.colors("borderBlockStartColor"),borderTopStyle:H.borderStyles("borderTopStyle"),borderBlockStartStyle:H.borderStyles("borderBlockStartStyle"),borderBottomWidth:H.borderWidths("borderBottomWidth"),borderBlockEndWidth:H.borderWidths("borderBlockEndWidth"),borderBottomColor:H.colors("borderBottomColor"),borderBlockEndColor:H.colors("borderBlockEndColor"),borderBottomStyle:H.borderStyles("borderBottomStyle"),borderBlockEndStyle:H.borderStyles("borderBlockEndStyle"),borderLeftWidth:H.borderWidths("borderLeftWidth"),borderInlineStartWidth:H.borderWidths("borderInlineStartWidth"),borderLeftColor:H.colors("borderLeftColor"),borderInlineStartColor:H.colors("borderInlineStartColor"),borderLeftStyle:H.borderStyles("borderLeftStyle"),borderInlineStartStyle:H.borderStyles("borderInlineStartStyle"),borderRightWidth:H.borderWidths("borderRightWidth"),borderInlineEndWidth:H.borderWidths("borderInlineEndWidth"),borderRightColor:H.colors("borderRightColor"),borderInlineEndColor:H.colors("borderInlineEndColor"),borderRightStyle:H.borderStyles("borderRightStyle"),borderInlineEndStyle:H.borderStyles("borderInlineEndStyle"),borderTopRadius:H.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:H.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:H.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:H.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(Je,{rounded:Je.borderRadius,roundedTop:Je.borderTopRadius,roundedTopLeft:Je.borderTopLeftRadius,roundedTopRight:Je.borderTopRightRadius,roundedTopStart:Je.borderStartStartRadius,roundedTopEnd:Je.borderStartEndRadius,roundedBottom:Je.borderBottomRadius,roundedBottomLeft:Je.borderBottomLeftRadius,roundedBottomRight:Je.borderBottomRightRadius,roundedBottomStart:Je.borderEndStartRadius,roundedBottomEnd:Je.borderEndEndRadius,roundedLeft:Je.borderLeftRadius,roundedRight:Je.borderRightRadius,roundedStart:Je.borderInlineStartRadius,roundedEnd:Je.borderInlineEndRadius,borderStart:Je.borderInlineStart,borderEnd:Je.borderInlineEnd,borderTopStartRadius:Je.borderStartStartRadius,borderTopEndRadius:Je.borderStartEndRadius,borderBottomStartRadius:Je.borderEndStartRadius,borderBottomEndRadius:Je.borderEndEndRadius,borderStartRadius:Je.borderInlineStartRadius,borderEndRadius:Je.borderInlineEndRadius,borderStartWidth:Je.borderInlineStartWidth,borderEndWidth:Je.borderInlineEndWidth,borderStartColor:Je.borderInlineStartColor,borderEndColor:Je.borderInlineEndColor,borderStartStyle:Je.borderInlineStartStyle,borderEndStyle:Je.borderInlineEndStyle});var lee={color:H.colors("color"),textColor:H.colors("color"),fill:H.colors("fill"),stroke:H.colors("stroke")},uw={boxShadow:H.shadows("boxShadow"),mixBlendMode:!0,blendMode:H.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:H.prop("backgroundBlendMode"),opacity:!0};Object.assign(uw,{shadow:uw.boxShadow});var uee={filter:{transform:Ye.filter},blur:H.blur("--chakra-blur"),brightness:H.propT("--chakra-brightness",Ye.brightness),contrast:H.propT("--chakra-contrast",Ye.contrast),hueRotate:H.degreeT("--chakra-hue-rotate"),invert:H.propT("--chakra-invert",Ye.invert),saturate:H.propT("--chakra-saturate",Ye.saturate),dropShadow:H.propT("--chakra-drop-shadow",Ye.dropShadow),backdropFilter:{transform:Ye.backdropFilter},backdropBlur:H.blur("--chakra-backdrop-blur"),backdropBrightness:H.propT("--chakra-backdrop-brightness",Ye.brightness),backdropContrast:H.propT("--chakra-backdrop-contrast",Ye.contrast),backdropHueRotate:H.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:H.propT("--chakra-backdrop-invert",Ye.invert),backdropSaturate:H.propT("--chakra-backdrop-saturate",Ye.saturate)},wy={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Ye.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:H.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:H.space("gap"),rowGap:H.space("rowGap"),columnGap:H.space("columnGap")};Object.assign(wy,{flexDir:wy.flexDirection});var H7={gridGap:H.space("gridGap"),gridColumnGap:H.space("gridColumnGap"),gridRowGap:H.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},cee={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Ye.outline},outlineOffset:!0,outlineColor:H.colors("outlineColor")},ei={width:H.sizesT("width"),inlineSize:H.sizesT("inlineSize"),height:H.sizes("height"),blockSize:H.sizes("blockSize"),boxSize:H.sizes(["width","height"]),minWidth:H.sizes("minWidth"),minInlineSize:H.sizes("minInlineSize"),minHeight:H.sizes("minHeight"),minBlockSize:H.sizes("minBlockSize"),maxWidth:H.sizes("maxWidth"),maxInlineSize:H.sizes("maxInlineSize"),maxHeight:H.sizes("maxHeight"),maxBlockSize:H.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (min-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r.minW)!=null?i:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (max-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r._minW)!=null?i:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:H.propT("float",Ye.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(ei,{w:ei.width,h:ei.height,minW:ei.minWidth,maxW:ei.maxWidth,minH:ei.minHeight,maxH:ei.maxHeight,overscroll:ei.overscrollBehavior,overscrollX:ei.overscrollBehaviorX,overscrollY:ei.overscrollBehaviorY});var dee={listStyleType:!0,listStylePosition:!0,listStylePos:H.prop("listStylePosition"),listStyleImage:!0,listStyleImg:H.prop("listStyleImage")};function fee(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,s)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const a=t.get(r);if(a.has(i))return a.get(i);const l=e(r,i,o,s);return a.set(i,l),l}},pee=hee(fee),gee={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},mee={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},FS=(e,t,n)=>{const r={},i=pee(e,t,{});for(const o in i)o in n&&n[o]!=null||(r[o]=i[o]);return r},yee={srOnly:{transform(e){return e===!0?gee:e==="focusable"?mee:{}}},layerStyle:{processResult:!0,transform:(e,t,n)=>FS(t,`layerStyles.${e}`,n)},textStyle:{processResult:!0,transform:(e,t,n)=>FS(t,`textStyles.${e}`,n)},apply:{processResult:!0,transform:(e,t,n)=>FS(t,e,n)}},hf={position:!0,pos:H.prop("position"),zIndex:H.prop("zIndex","zIndices"),inset:H.spaceT("inset"),insetX:H.spaceT(["left","right"]),insetInline:H.spaceT("insetInline"),insetY:H.spaceT(["top","bottom"]),insetBlock:H.spaceT("insetBlock"),top:H.spaceT("top"),insetBlockStart:H.spaceT("insetBlockStart"),bottom:H.spaceT("bottom"),insetBlockEnd:H.spaceT("insetBlockEnd"),left:H.spaceT("left"),insetInlineStart:H.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:H.spaceT("right"),insetInlineEnd:H.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(hf,{insetStart:hf.insetInlineStart,insetEnd:hf.insetInlineEnd});var vee={ring:{transform:Ye.ring},ringColor:H.colors("--chakra-ring-color"),ringOffset:H.prop("--chakra-ring-offset-width"),ringOffsetColor:H.colors("--chakra-ring-offset-color"),ringInset:H.prop("--chakra-ring-inset")},bt={margin:H.spaceT("margin"),marginTop:H.spaceT("marginTop"),marginBlockStart:H.spaceT("marginBlockStart"),marginRight:H.spaceT("marginRight"),marginInlineEnd:H.spaceT("marginInlineEnd"),marginBottom:H.spaceT("marginBottom"),marginBlockEnd:H.spaceT("marginBlockEnd"),marginLeft:H.spaceT("marginLeft"),marginInlineStart:H.spaceT("marginInlineStart"),marginX:H.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:H.spaceT("marginInline"),marginY:H.spaceT(["marginTop","marginBottom"]),marginBlock:H.spaceT("marginBlock"),padding:H.space("padding"),paddingTop:H.space("paddingTop"),paddingBlockStart:H.space("paddingBlockStart"),paddingRight:H.space("paddingRight"),paddingBottom:H.space("paddingBottom"),paddingBlockEnd:H.space("paddingBlockEnd"),paddingLeft:H.space("paddingLeft"),paddingInlineStart:H.space("paddingInlineStart"),paddingInlineEnd:H.space("paddingInlineEnd"),paddingX:H.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:H.space("paddingInline"),paddingY:H.space(["paddingTop","paddingBottom"]),paddingBlock:H.space("paddingBlock")};Object.assign(bt,{m:bt.margin,mt:bt.marginTop,mr:bt.marginRight,me:bt.marginInlineEnd,marginEnd:bt.marginInlineEnd,mb:bt.marginBottom,ml:bt.marginLeft,ms:bt.marginInlineStart,marginStart:bt.marginInlineStart,mx:bt.marginX,my:bt.marginY,p:bt.padding,pt:bt.paddingTop,py:bt.paddingY,px:bt.paddingX,pb:bt.paddingBottom,pl:bt.paddingLeft,ps:bt.paddingInlineStart,paddingStart:bt.paddingInlineStart,pr:bt.paddingRight,pe:bt.paddingInlineEnd,paddingEnd:bt.paddingInlineEnd});var bee={textDecorationColor:H.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:H.shadows("textShadow")},See={clipPath:!0,transform:H.propT("transform",Ye.transform),transformOrigin:!0,translateX:H.spaceT("--chakra-translate-x"),translateY:H.spaceT("--chakra-translate-y"),skewX:H.degreeT("--chakra-skew-x"),skewY:H.degreeT("--chakra-skew-y"),scaleX:H.prop("--chakra-scale-x"),scaleY:H.prop("--chakra-scale-y"),scale:H.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:H.degreeT("--chakra-rotate")},_ee={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:H.prop("transitionDuration","transition.duration"),transitionProperty:H.prop("transitionProperty","transition.property"),transitionTimingFunction:H.prop("transitionTimingFunction","transition.easing")},wee={fontFamily:H.prop("fontFamily","fonts"),fontSize:H.prop("fontSize","fontSizes",Ye.px),fontWeight:H.prop("fontWeight","fontWeights"),lineHeight:H.prop("lineHeight","lineHeights"),letterSpacing:H.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},xee={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:H.spaceT("scrollMargin"),scrollMarginTop:H.spaceT("scrollMarginTop"),scrollMarginBottom:H.spaceT("scrollMarginBottom"),scrollMarginLeft:H.spaceT("scrollMarginLeft"),scrollMarginRight:H.spaceT("scrollMarginRight"),scrollMarginX:H.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:H.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:H.spaceT("scrollPadding"),scrollPaddingTop:H.spaceT("scrollPaddingTop"),scrollPaddingBottom:H.spaceT("scrollPaddingBottom"),scrollPaddingLeft:H.spaceT("scrollPaddingLeft"),scrollPaddingRight:H.spaceT("scrollPaddingRight"),scrollPaddingX:H.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:H.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function q7(e){return yo(e)&&e.reference?e.reference:String(e)}var Rv=(e,...t)=>t.map(q7).join(` ${e} `).replace(/calc/g,""),ZE=(...e)=>`calc(${Rv("+",...e)})`,JE=(...e)=>`calc(${Rv("-",...e)})`,cw=(...e)=>`calc(${Rv("*",...e)})`,eP=(...e)=>`calc(${Rv("/",...e)})`,tP=e=>{const t=q7(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:cw(t,-1)},Qa=Object.assign(e=>({add:(...t)=>Qa(ZE(e,...t)),subtract:(...t)=>Qa(JE(e,...t)),multiply:(...t)=>Qa(cw(e,...t)),divide:(...t)=>Qa(eP(e,...t)),negate:()=>Qa(tP(e)),toString:()=>e.toString()}),{add:ZE,subtract:JE,multiply:cw,divide:eP,negate:tP});function Cee(e,t="-"){return e.replace(/\s+/g,t)}function Tee(e){const t=Cee(e.toString());return Pee(Eee(t))}function Eee(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function Pee(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function kee(e,t=""){return[t,e].filter(Boolean).join("-")}function Aee(e,t){return`var(${e}${t?`, ${t}`:""})`}function Oee(e,t=""){return Tee(`--${kee(e,t)}`)}function dw(e,t,n){const r=Oee(e,n);return{variable:r,reference:Aee(r,t)}}function JTe(e,t){const n={};for(const r of t){if(Array.isArray(r)){const[i,o]=r;n[i]=dw(`${e}-${i}`,o);continue}n[r]=dw(`${e}-${r}`)}return n}function Ree(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function Iee(e){const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}}function fw(e){if(e==null)return e;const{unitless:t}=Iee(e);return t||typeof e=="number"?`${e}px`:e}var W7=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,x5=e=>Object.fromEntries(Object.entries(e).sort(W7));function nP(e){const t=x5(e);return Object.assign(Object.values(t),t)}function Mee(e){const t=Object.keys(x5(e));return new Set(t)}function rP(e){var t;if(!e)return e;e=(t=fw(e))!=null?t:e;const n=-.02;return typeof e=="number"?`${e+n}`:e.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function Kd(e,t){const n=["@media screen"];return e&&n.push("and",`(min-width: ${fw(e)})`),t&&n.push("and",`(max-width: ${fw(t)})`),n.join(" ")}function Nee(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const n=nP(e),r=Object.entries(e).sort(W7).map(([s,a],l,u)=>{var c;let[,d]=(c=u[l+1])!=null?c:[];return d=parseFloat(d)>0?rP(d):void 0,{_minW:rP(a),breakpoint:s,minW:a,maxW:d,maxWQuery:Kd(null,d),minWQuery:Kd(a),minMaxQuery:Kd(a,d)}}),i=Mee(e),o=Array.from(i.values());return{keys:i,normalized:n,isResponsive(s){const a=Object.keys(s);return a.length>0&&a.every(l=>i.has(l))},asObject:x5(e),asArray:nP(e),details:r,get(s){return r.find(a=>a.breakpoint===s)},media:[null,...n.map(s=>Kd(s)).slice(1)],toArrayValue(s){if(!yo(s))throw new Error("toArrayValue: value must be an object");const a=o.map(l=>{var u;return(u=s[l])!=null?u:null});for(;Ree(a)===null;)a.pop();return a},toObjectValue(s){if(!Array.isArray(s))throw new Error("toObjectValue: value must be an array");return s.reduce((a,l,u)=>{const c=o[u];return c!=null&&l!=null&&(a[c]=l),a},{})}}}var Rn={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},As=e=>K7(t=>e(t,"&"),"[role=group]","[data-group]",".group"),Bo=e=>K7(t=>e(t,"~ &"),"[data-peer]",".peer"),K7=(e,...t)=>t.map(e).join(", "),Iv={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:As(Rn.hover),_peerHover:Bo(Rn.hover),_groupFocus:As(Rn.focus),_peerFocus:Bo(Rn.focus),_groupFocusVisible:As(Rn.focusVisible),_peerFocusVisible:Bo(Rn.focusVisible),_groupActive:As(Rn.active),_peerActive:Bo(Rn.active),_groupDisabled:As(Rn.disabled),_peerDisabled:Bo(Rn.disabled),_groupInvalid:As(Rn.invalid),_peerInvalid:Bo(Rn.invalid),_groupChecked:As(Rn.checked),_peerChecked:Bo(Rn.checked),_groupFocusWithin:As(Rn.focusWithin),_peerFocusWithin:Bo(Rn.focusWithin),_peerPlaceholderShown:Bo(Rn.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},Y7=Object.keys(Iv);function iP(e,t){return dw(String(e).replace(/\./g,"-"),void 0,t)}function Dee(e,t){let n={};const r={};for(const[i,o]of Object.entries(e)){const{isSemantic:s,value:a}=o,{variable:l,reference:u}=iP(i,t==null?void 0:t.cssVarPrefix);if(!s){if(i.startsWith("space")){const f=i.split("."),[h,...p]=f,g=`${h}.-${p.join(".")}`,S=Qa.negate(a),v=Qa.negate(u);r[g]={value:S,var:l,varRef:v}}n[l]=a,r[i]={value:a,var:l,varRef:u};continue}const c=f=>{const p=[String(i).split(".")[0],f].join(".");if(!e[p])return f;const{reference:S}=iP(p,t==null?void 0:t.cssVarPrefix);return S},d=yo(a)?a:{default:a};n=lo(n,Object.entries(d).reduce((f,[h,p])=>{var g,S;if(!p)return f;const v=c(`${p}`);if(h==="default")return f[l]=v,f;const y=(S=(g=Iv)==null?void 0:g[h])!=null?S:h;return f[y]={[l]:v},f},{})),r[i]={value:u,var:l,varRef:u}}return{cssVars:n,cssMap:r}}function Lee(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function $ee(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Fee(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function oP(e,t,n={}){const{stop:r,getKey:i}=n;function o(s,a=[]){var l;if(Fee(s)||Array.isArray(s)){const u={};for(const[c,d]of Object.entries(s)){const f=(l=i==null?void 0:i(c))!=null?l:c,h=[...a,f];if(r!=null&&r(s,h))return t(s,a);u[f]=o(d,h)}return u}return t(s,a)}return o(e)}var Bee=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function jee(e){return $ee(e,Bee)}function Vee(e){return e.semanticTokens}function zee(e){const{__cssMap:t,__cssVars:n,__breakpoints:r,...i}=e;return i}var Uee=e=>Y7.includes(e)||e==="default";function Gee({tokens:e,semanticTokens:t}){const n={};return oP(e,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!1,value:r})}),oP(t,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!0,value:r})},{stop:r=>Object.keys(r).every(Uee)}),n}function eEe(e){var t;const n=zee(e),r=jee(n),i=Vee(n),o=Gee({tokens:r,semanticTokens:i}),s=(t=n.config)==null?void 0:t.cssVarPrefix,{cssMap:a,cssVars:l}=Dee(o,{cssVarPrefix:s});return Object.assign(n,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...l},__cssMap:a,__breakpoints:Nee(n.breakpoints)}),n}var C5=lo({},fm,Je,lee,wy,ei,uee,vee,cee,H7,yee,hf,uw,bt,xee,wee,bee,See,dee,_ee),Hee=Object.assign({},bt,ei,wy,H7,hf),tEe=Object.keys(Hee),qee=[...Object.keys(C5),...Y7],Wee={...C5,...Iv},Kee=e=>e in Wee,Yee=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:n,toArrayValue:r,media:i}=t.__breakpoints,o={};for(const s in e){let a=ao(e[s],t);if(a==null)continue;if(a=yo(a)&&n(a)?r(a):a,!Array.isArray(a)){o[s]=a;continue}const l=a.slice(0,i.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!Qee(t),Jee=(e,t)=>{var n,r;if(t==null)return t;const i=l=>{var u,c;return(c=(u=e.__cssMap)==null?void 0:u[l])==null?void 0:c.varRef},o=l=>{var u;return(u=i(l))!=null?u:l},[s,a]=Xee(t);return t=(r=(n=i(s))!=null?n:o(a))!=null?r:o(t),t};function ete(e){const{configs:t={},pseudos:n={},theme:r}=e,i=(o,s=!1)=>{var a,l,u;const c=ao(o,r),d=Yee(c)(r);let f={};for(let h in d){const p=d[h];let g=ao(p,r);h in n&&(h=n[h]),Zee(h,g)&&(g=Jee(r,g));let S=t[h];if(S===!0&&(S={property:h}),yo(g)){f[h]=(a=f[h])!=null?a:{},f[h]=lo({},f[h],i(g,!0));continue}let v=(u=(l=S==null?void 0:S.transform)==null?void 0:l.call(S,g,r,c))!=null?u:g;v=S!=null&&S.processResult?i(v,!0):v;const y=ao(S==null?void 0:S.property,r);if(!s&&(S!=null&&S.static)){const m=ao(S.static,r);f=lo({},f,m)}if(y&&Array.isArray(y)){for(const m of y)f[m]=v;continue}if(y){y==="&"&&yo(v)?f=lo({},f,v):f[y]=v;continue}if(yo(v)){f=lo({},f,v);continue}f[h]=v}return f};return i}var tte=e=>t=>ete({theme:t,pseudos:Iv,configs:C5})(e);function nEe(e){return e}function rEe(e){return e}function iEe(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function nte(e,t){if(Array.isArray(e))return e;if(yo(e))return t(e);if(e!=null)return[e]}function rte(e,t){for(let n=t+1;n{lo(u,{[m]:f?y[m]:{[v]:y[m]}})});continue}if(!h){f?lo(u,y):u[v]=y;continue}u[v]=y}}return u}}function ote(e){return t=>{var n;const{variant:r,size:i,theme:o}=t,s=ite(o);return lo({},ao((n=e.baseStyle)!=null?n:{},t),s(e,"sizes",i,t),s(e,"variants",r,t))}}function ste(e,t,n){var r,i,o;return(o=(i=(r=e.__cssMap)==null?void 0:r[`${t}.${n}`])==null?void 0:i.varRef)!=null?o:n}function Ao(e){return Lee(e,["styleConfig","size","variant","colorScheme"])}function ate(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function oEe(e){var t;return ate(e)&&(t=e.ownerDocument)!=null?t:document}function lte(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var ute=lte();function cte(e,t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function dte(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,s)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const a=t.get(r);if(a.has(i))return a.get(i);const l=e(r,i,o,s);return a.set(i,l),l}},hte=fte(dte);function X7(e,t){const n={};return Object.keys(e).forEach(r=>{const i=e[r];t(i,r,e)&&(n[r]=i)}),n}var Q7=e=>X7(e,t=>t!=null);function pte(e){return typeof e=="function"}function gte(e,...t){return pte(e)?e(...t):e}function mte(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}const Z7=1/60*1e3,yte=typeof performance<"u"?()=>performance.now():()=>Date.now(),J7=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(yte()),Z7);function vte(e){let t=[],n=[],r=0,i=!1,o=!1;const s=new WeakSet,a={schedule:(l,u=!1,c=!1)=>{const d=c&&i,f=d?t:n;return u&&s.add(l),f.indexOf(l)===-1&&(f.push(l),d&&i&&(r=t.length)),l},cancel:l=>{const u=n.indexOf(l);u!==-1&&n.splice(u,1),s.delete(l)},process:l=>{if(i){o=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let u=0;u(e[t]=vte(()=>ih=!0),e),{}),Ste=dp.reduce((e,t)=>{const n=Mv[t];return e[t]=(r,i=!1,o=!1)=>(ih||xte(),n.schedule(r,i,o)),e},{}),_te=dp.reduce((e,t)=>(e[t]=Mv[t].cancel,e),{});dp.reduce((e,t)=>(e[t]=()=>Mv[t].process(ic),e),{});const wte=e=>Mv[e].process(ic),eM=e=>{ih=!1,ic.delta=hw?Z7:Math.max(Math.min(e-ic.timestamp,bte),1),ic.timestamp=e,pw=!0,dp.forEach(wte),pw=!1,ih&&(hw=!1,J7(eM))},xte=()=>{ih=!0,hw=!0,pw||J7(eM)},sP=()=>ic;var Cte=typeof Element<"u",Tte=typeof Map=="function",Ete=typeof Set=="function",Pte=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function hm(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!hm(e[r],t[r]))return!1;return!0}var o;if(Tte&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;for(o=e.entries();!(r=o.next()).done;)if(!hm(r.value[1],t.get(r.value[0])))return!1;return!0}if(Ete&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(Pte&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;if(Cte&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!hm(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var kte=function(t,n){try{return hm(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const Ate=Il(kte);function tM(e,t={}){var n;const{styleConfig:r,...i}=t,{theme:o,colorMode:s}=U7(),a=e?hte(o,`components.${e}`):void 0,l=r||a,u=lo({theme:o,colorMode:s},(n=l==null?void 0:l.defaultProps)!=null?n:{},Q7(cte(i,["children"]))),c=E.useRef({});if(l){const f=ote(l)(u);Ate(c.current,f)||(c.current=f)}return c.current}function $l(e,t={}){return tM(e,t)}function Nv(e,t={}){return tM(e,t)}var Ote=new Set([...qee,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),Rte=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function Ite(e){return Rte.has(e)||!Ote.has(e)}function Mte(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const n={...e};for(const r of t)if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(i in n&&delete n[i],n[i]=r[i]);return n}var Nte=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Dte=M7(function(e){return Nte.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),Lte=Dte,$te=function(t){return t!=="theme"},aP=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?Lte:$te},lP=function(t,n,r){var i;if(n){var o=n.shouldForwardProp;i=t.__emotion_forwardProp&&o?function(s){return t.__emotion_forwardProp(s)&&o(s)}:o}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},Fte=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return D7(n,r,i),EJ(function(){return L7(n,r,i)}),null},Bte=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,o,s;n!==void 0&&(o=n.label,s=n.target);var a=lP(t,n,r),l=a||aP(i),u=!l("as");return function(){var c=arguments,d=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(o!==void 0&&d.push("label:"+o+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,h=1;ht=>{const{theme:n,css:r,__css:i,sx:o,...s}=t,a=X7(s,(d,f)=>Kee(f)),l=gte(e,t),u=Mte({},i,l,Q7(a),o),c=tte(u)(t.theme);return r?[c,r]:c};function BS(e,t){const{baseStyle:n,...r}=t??{};r.shouldForwardProp||(r.shouldForwardProp=Ite);const i=zte({baseStyle:n}),o=Vte(e,r)(i);return Ve.forwardRef(function(l,u){const{colorMode:c,forced:d}=_5();return Ve.createElement(o,{ref:u,"data-theme":d?c:void 0,...l})})}function Ute(){const e=new Map;return new Proxy(BS,{apply(t,n,r){return BS(...r)},get(t,n){return e.has(n)||e.set(n,BS(n)),e.get(n)}})}var ke=Ute();function Qe(e){return E.forwardRef(e)}var Gte=(e,t)=>e.find(n=>n.id===t);function cP(e,t){const n=nM(e,t),r=n?e[n].findIndex(i=>i.id===t):-1;return{position:n,index:r}}function nM(e,t){for(const[n,r]of Object.entries(e))if(Gte(r,t))return n}function Hte(e){const t=e.includes("right"),n=e.includes("left");let r="center";return t&&(r="flex-end"),n&&(r="flex-start"),{display:"flex",flexDirection:"column",alignItems:r}}function qte(e){const n=e==="top"||e==="bottom"?"0 auto":void 0,r=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,o=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",s=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:r,bottom:i,right:o,left:s}}function Fn(e,t=[]){const n=E.useRef(e);return E.useEffect(()=>{n.current=e}),E.useCallback((...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},t)}function Wte(e,t){const n=Fn(e);E.useEffect(()=>{if(t==null)return;let r=null;return r=window.setTimeout(()=>{n()},t),()=>{r&&window.clearTimeout(r)}},[t,n])}function Cy(e,t){const n=E.useRef(!1),r=E.useRef(!1);E.useEffect(()=>{if(n.current&&r.current)return e();r.current=!0},t),E.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const rM=E.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),Dv=E.createContext({}),fp=E.createContext(null),Lv=typeof document<"u",Ty=Lv?E.useLayoutEffect:E.useEffect,iM=E.createContext({strict:!1});function Kte(e,t,n,r){const{visualElement:i}=E.useContext(Dv),o=E.useContext(iM),s=E.useContext(fp),a=E.useContext(rM).reducedMotion,l=E.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:s,blockInitialAnimation:s?s.initial===!1:!1,reducedMotionConfig:a}));const u=l.current;return E.useInsertionEffect(()=>{u&&u.update(n,s)}),Ty(()=>{u&&u.render()}),E.useEffect(()=>{u&&u.updateFeatures()}),(window.HandoffAppearAnimations?Ty:E.useEffect)(()=>{u&&u.animationState&&u.animationState.animateChanges()}),u}function Bu(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Yte(e,t,n){return E.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Bu(n)&&(n.current=r))},[t])}function oh(e){return typeof e=="string"||Array.isArray(e)}function $v(e){return typeof e=="object"&&typeof e.start=="function"}const T5=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],E5=["initial",...T5];function Fv(e){return $v(e.animate)||E5.some(t=>oh(e[t]))}function oM(e){return!!(Fv(e)||e.variants)}function Xte(e,t){if(Fv(e)){const{initial:n,animate:r}=e;return{initial:n===!1||oh(n)?n:void 0,animate:oh(r)?r:void 0}}return e.inherit!==!1?t:{}}function Qte(e){const{initial:t,animate:n}=Xte(e,E.useContext(Dv));return E.useMemo(()=>({initial:t,animate:n}),[dP(t),dP(n)])}function dP(e){return Array.isArray(e)?e.join(" "):e}const fP={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},sh={};for(const e in fP)sh[e]={isEnabled:t=>fP[e].some(n=>!!t[n])};function Zte(e){for(const t in e)sh[t]={...sh[t],...e[t]}}const P5=E.createContext({}),sM=E.createContext({}),Jte=Symbol.for("motionComponentSymbol");function ene({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&Zte(e);function o(a,l){let u;const c={...E.useContext(rM),...a,layoutId:tne(a)},{isStatic:d}=c,f=Qte(a),h=r(a,d);if(!d&&Lv){f.visualElement=Kte(i,h,c,t);const p=E.useContext(sM),g=E.useContext(iM).strict;f.visualElement&&(u=f.visualElement.loadFeatures(c,g,e,p))}return E.createElement(Dv.Provider,{value:f},u&&f.visualElement?E.createElement(u,{visualElement:f.visualElement,...c}):null,n(i,a,Yte(h,f.visualElement,l),h,d,f.visualElement))}const s=E.forwardRef(o);return s[Jte]=i,s}function tne({layoutId:e}){const t=E.useContext(P5).id;return t&&e!==void 0?t+"-"+e:e}function nne(e){function t(r,i={}){return ene(e(r,i))}if(typeof Proxy>"u")return t;const n=new Map;return new Proxy(t,{get:(r,i)=>(n.has(i)||n.set(i,t(i)),n.get(i))})}const rne=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function k5(e){return typeof e!="string"||e.includes("-")?!1:!!(rne.indexOf(e)>-1||/[A-Z]/.test(e))}const Ey={};function ine(e){Object.assign(Ey,e)}const hp=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Fl=new Set(hp);function aM(e,{layout:t,layoutId:n}){return Fl.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Ey[e]||e==="opacity")}const Rr=e=>!!(e&&e.getVelocity),one={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},sne=hp.length;function ane(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,i){let o="";for(let s=0;st=>typeof t=="string"&&t.startsWith(e),uM=lM("--"),gw=lM("var(--"),lne=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,une=(e,t)=>t&&typeof e=="number"?t.transform(e):e,ma=(e,t,n)=>Math.min(Math.max(n,e),t),Bl={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},pf={...Bl,transform:e=>ma(0,1,e)},pg={...Bl,default:1},gf=e=>Math.round(e*1e5)/1e5,Bv=/(-)?([\d]*\.?[\d])+/g,cM=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,cne=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function pp(e){return typeof e=="string"}const gp=e=>({test:t=>pp(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Is=gp("deg"),vo=gp("%"),_e=gp("px"),dne=gp("vh"),fne=gp("vw"),hP={...vo,parse:e=>vo.parse(e)/100,transform:e=>vo.transform(e*100)},pP={...Bl,transform:Math.round},dM={borderWidth:_e,borderTopWidth:_e,borderRightWidth:_e,borderBottomWidth:_e,borderLeftWidth:_e,borderRadius:_e,radius:_e,borderTopLeftRadius:_e,borderTopRightRadius:_e,borderBottomRightRadius:_e,borderBottomLeftRadius:_e,width:_e,maxWidth:_e,height:_e,maxHeight:_e,size:_e,top:_e,right:_e,bottom:_e,left:_e,padding:_e,paddingTop:_e,paddingRight:_e,paddingBottom:_e,paddingLeft:_e,margin:_e,marginTop:_e,marginRight:_e,marginBottom:_e,marginLeft:_e,rotate:Is,rotateX:Is,rotateY:Is,rotateZ:Is,scale:pg,scaleX:pg,scaleY:pg,scaleZ:pg,skew:Is,skewX:Is,skewY:Is,distance:_e,translateX:_e,translateY:_e,translateZ:_e,x:_e,y:_e,z:_e,perspective:_e,transformPerspective:_e,opacity:pf,originX:hP,originY:hP,originZ:_e,zIndex:pP,fillOpacity:pf,strokeOpacity:pf,numOctaves:pP};function A5(e,t,n,r){const{style:i,vars:o,transform:s,transformOrigin:a}=e;let l=!1,u=!1,c=!0;for(const d in t){const f=t[d];if(uM(d)){o[d]=f;continue}const h=dM[d],p=une(f,h);if(Fl.has(d)){if(l=!0,s[d]=p,!c)continue;f!==(h.default||0)&&(c=!1)}else d.startsWith("origin")?(u=!0,a[d]=p):i[d]=p}if(t.transform||(l||r?i.transform=ane(e.transform,n,c,r):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:h=0}=a;i.transformOrigin=`${d} ${f} ${h}`}}const O5=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function fM(e,t,n){for(const r in t)!Rr(t[r])&&!aM(r,n)&&(e[r]=t[r])}function hne({transformTemplate:e},t,n){return E.useMemo(()=>{const r=O5();return A5(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function pne(e,t,n){const r=e.style||{},i={};return fM(i,r,e),Object.assign(i,hne(e,t,n)),e.transformValues?e.transformValues(i):i}function gne(e,t,n){const r={},i=pne(e,t,n);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=i,r}const mne=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function Py(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||mne.has(e)}let hM=e=>!Py(e);function yne(e){e&&(hM=t=>t.startsWith("on")?!Py(t):e(t))}try{yne(require("@emotion/is-prop-valid").default)}catch{}function vne(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(hM(i)||n===!0&&Py(i)||!t&&!Py(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function gP(e,t,n){return typeof e=="string"?e:_e.transform(t+n*e)}function bne(e,t,n){const r=gP(t,e.x,e.width),i=gP(n,e.y,e.height);return`${r} ${i}`}const Sne={offset:"stroke-dashoffset",array:"stroke-dasharray"},_ne={offset:"strokeDashoffset",array:"strokeDasharray"};function wne(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?Sne:_ne;e[o.offset]=_e.transform(-r);const s=_e.transform(t),a=_e.transform(n);e[o.array]=`${s} ${a}`}function R5(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:o,pathLength:s,pathSpacing:a=1,pathOffset:l=0,...u},c,d,f){if(A5(e,u,c,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:g}=e;h.transform&&(g&&(p.transform=h.transform),delete h.transform),g&&(i!==void 0||o!==void 0||p.transform)&&(p.transformOrigin=bne(g,i!==void 0?i:.5,o!==void 0?o:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),s!==void 0&&wne(h,s,a,l,!1)}const pM=()=>({...O5(),attrs:{}}),I5=e=>typeof e=="string"&&e.toLowerCase()==="svg";function xne(e,t,n,r){const i=E.useMemo(()=>{const o=pM();return R5(o,t,{enableHardwareAcceleration:!1},I5(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};fM(o,e.style,e),i.style={...o,...i.style}}return i}function Cne(e=!1){return(n,r,i,{latestValues:o},s)=>{const l=(k5(n)?xne:gne)(r,o,s,n),c={...vne(r,typeof n=="string",e),...l,ref:i},{children:d}=r,f=E.useMemo(()=>Rr(d)?d.get():d,[d]);return E.createElement(n,{...c,children:f})}}const M5=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function gM(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const mM=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function yM(e,t,n,r){gM(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(mM.has(i)?i:M5(i),t.attrs[i])}function N5(e,t){const{style:n}=e,r={};for(const i in n)(Rr(n[i])||t.style&&Rr(t.style[i])||aM(i,e))&&(r[i]=n[i]);return r}function vM(e,t){const n=N5(e,t);for(const r in e)if(Rr(e[r])||Rr(t[r])){const i=hp.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=e[r]}return n}function D5(e,t,n,r={},i={}){return typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),t}function bM(e){const t=E.useRef(null);return t.current===null&&(t.current=e()),t.current}const ky=e=>Array.isArray(e),Tne=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),Ene=e=>ky(e)?e[e.length-1]||0:e;function pm(e){const t=Rr(e)?e.get():e;return Tne(t)?t.toValue():t}function Pne({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,i,o){const s={latestValues:kne(r,i,o,e),renderState:t()};return n&&(s.mount=a=>n(r,a,s)),s}const SM=e=>(t,n)=>{const r=E.useContext(Dv),i=E.useContext(fp),o=()=>Pne(e,t,r,i);return n?o():bM(o)};function kne(e,t,n,r){const i={},o=r(e,{});for(const f in o)i[f]=pm(o[f]);let{initial:s,animate:a}=e;const l=Fv(e),u=oM(e);t&&u&&!l&&e.inherit!==!1&&(s===void 0&&(s=t.initial),a===void 0&&(a=t.animate));let c=n?n.initial===!1:!1;c=c||s===!1;const d=c?a:s;return d&&typeof d!="boolean"&&!$v(d)&&(Array.isArray(d)?d:[d]).forEach(h=>{const p=D5(e,h);if(!p)return;const{transitionEnd:g,transition:S,...v}=p;for(const y in v){let m=v[y];if(Array.isArray(m)){const b=c?m.length-1:0;m=m[b]}m!==null&&(i[y]=m)}for(const y in g)i[y]=g[y]}),i}const Ane={useVisualState:SM({scrapeMotionValuesFromProps:vM,createRenderState:pM,onMount:(e,t,{renderState:n,latestValues:r})=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}R5(n,r,{enableHardwareAcceleration:!1},I5(t.tagName),e.transformTemplate),yM(t,n)}})},One={useVisualState:SM({scrapeMotionValuesFromProps:N5,createRenderState:O5})};function Rne(e,{forwardMotionProps:t=!1},n,r){return{...k5(e)?Ane:One,preloadedFeatures:n,useRender:Cne(t),createVisualElement:r,Component:e}}function Jo(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const _M=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function jv(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const Ine=e=>t=>_M(t)&&e(t,jv(t));function ns(e,t,n,r){return Jo(e,t,Ine(n),r)}const Mne=(e,t)=>n=>t(e(n)),oa=(...e)=>e.reduce(Mne);function wM(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const mP=wM("dragHorizontal"),yP=wM("dragVertical");function xM(e){let t=!1;if(e==="y")t=yP();else if(e==="x")t=mP();else{const n=mP(),r=yP();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function CM(){const e=xM(!0);return e?(e(),!1):!0}class Ra{constructor(t){this.isMounted=!1,this.node=t}update(){}}const rn=e=>e;function Nne(e){let t=[],n=[],r=0,i=!1,o=!1;const s=new WeakSet,a={schedule:(l,u=!1,c=!1)=>{const d=c&&i,f=d?t:n;return u&&s.add(l),f.indexOf(l)===-1&&(f.push(l),d&&i&&(r=t.length)),l},cancel:l=>{const u=n.indexOf(l);u!==-1&&n.splice(u,1),s.delete(l)},process:l=>{if(i){o=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let u=0;u(d[f]=Nne(()=>n=!0),d),{}),s=d=>o[d].process(i),a=d=>{n=!1,i.delta=r?1e3/60:Math.max(Math.min(d-i.timestamp,Dne),1),i.timestamp=d,i.isProcessing=!0,gg.forEach(s),i.isProcessing=!1,n&&t&&(r=!1,e(a))},l=()=>{n=!0,r=!0,i.isProcessing||e(a)};return{schedule:gg.reduce((d,f)=>{const h=o[f];return d[f]=(p,g=!1,S=!1)=>(n||l(),h.schedule(p,g,S)),d},{}),cancel:d=>gg.forEach(f=>o[f].cancel(d)),state:i,steps:o}}const{schedule:Pt,cancel:fs,state:Yn,steps:jS}=Lne(typeof requestAnimationFrame<"u"?requestAnimationFrame:rn,!0);function vP(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),i=(o,s)=>{if(o.type==="touch"||CM())return;const a=e.getProps();e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",t),a[r]&&Pt.update(()=>a[r](o,s))};return ns(e.current,n,i,{passive:!e.getProps()[r]})}class $ne extends Ra{mount(){this.unmount=oa(vP(this.node,!0),vP(this.node,!1))}unmount(){}}class Fne extends Ra{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=oa(Jo(this.node.current,"focus",()=>this.onFocus()),Jo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const TM=(e,t)=>t?e===t?!0:TM(e,t.parentElement):!1;function VS(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,jv(n))}class Bne extends Ra{constructor(){super(...arguments),this.removeStartListeners=rn,this.removeEndListeners=rn,this.removeAccessibleListeners=rn,this.startPointerPress=(t,n)=>{if(this.removeEndListeners(),this.isPressing)return;const r=this.node.getProps(),o=ns(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c}=this.node.getProps();Pt.update(()=>{TM(this.node.current,a.target)?u&&u(a,l):c&&c(a,l)})},{passive:!(r.onTap||r.onPointerUp)}),s=ns(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=oa(o,s),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const s=a=>{a.key!=="Enter"||!this.checkPressEnd()||VS("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&Pt.update(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=Jo(this.node.current,"keyup",s),VS("down",(a,l)=>{this.startPress(a,l)})},n=Jo(this.node.current,"keydown",t),r=()=>{this.isPressing&&VS("cancel",(o,s)=>this.cancelPress(o,s))},i=Jo(this.node.current,"blur",r);this.removeAccessibleListeners=oa(n,i)}}startPress(t,n){this.isPressing=!0;const{onTapStart:r,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&Pt.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!CM()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&Pt.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=ns(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=Jo(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=oa(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const mw=new WeakMap,zS=new WeakMap,jne=e=>{const t=mw.get(e.target);t&&t(e)},Vne=e=>{e.forEach(jne)};function zne({root:e,...t}){const n=e||document;zS.has(n)||zS.set(n,{});const r=zS.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(Vne,{root:e,...t})),r[i]}function Une(e,t,n){const r=zne(t);return mw.set(e,n),r.observe(e),()=>{mw.delete(e),r.unobserve(e)}}const Gne={some:0,all:1};class Hne extends Ra{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,s={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:Gne[i]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return Une(this.node.current,s,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(qne(t,n))&&this.startObserver()}unmount(){}}function qne({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Wne={inView:{Feature:Hne},tap:{Feature:Bne},focus:{Feature:Fne},hover:{Feature:$ne}};function EM(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rt[r]=n.get()),t}function Yne(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function Vv(e,t,n){const r=e.getProps();return D5(r,t,n!==void 0?n:r.custom,Kne(e),Yne(e))}const Xne="framerAppearId",Qne="data-"+M5(Xne);let Zne=rn,L5=rn;const sa=e=>e*1e3,rs=e=>e/1e3,Jne={current:!1},PM=e=>Array.isArray(e)&&typeof e[0]=="number";function kM(e){return!!(!e||typeof e=="string"&&AM[e]||PM(e)||Array.isArray(e)&&e.every(kM))}const Yd=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,AM={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Yd([0,.65,.55,1]),circOut:Yd([.55,0,1,.45]),backIn:Yd([.31,.01,.66,-.59]),backOut:Yd([.33,1.53,.69,.99])};function OM(e){if(e)return PM(e)?Yd(e):Array.isArray(e)?e.map(OM):AM[e]}function ere(e,t,n,{delay:r=0,duration:i,repeat:o=0,repeatType:s="loop",ease:a,times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=OM(a);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:r,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:s==="reverse"?"alternate":"normal"})}const bP={waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate")},US={},RM={};for(const e in bP)RM[e]=()=>(US[e]===void 0&&(US[e]=bP[e]()),US[e]);function tre(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const IM=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,nre=1e-7,rre=12;function ire(e,t,n,r,i){let o,s,a=0;do s=t+(n-t)/2,o=IM(s,r,i)-e,o>0?n=s:t=s;while(Math.abs(o)>nre&&++aire(o,0,1,e,n);return o=>o===0||o===1?o:IM(i(o),t,r)}const ore=mp(.42,0,1,1),sre=mp(0,0,.58,1),MM=mp(.42,0,.58,1),are=e=>Array.isArray(e)&&typeof e[0]!="number",NM=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,DM=e=>t=>1-e(1-t),LM=e=>1-Math.sin(Math.acos(e)),$5=DM(LM),lre=NM($5),$M=mp(.33,1.53,.69,.99),F5=DM($M),ure=NM(F5),cre=e=>(e*=2)<1?.5*F5(e):.5*(2-Math.pow(2,-10*(e-1))),dre={linear:rn,easeIn:ore,easeInOut:MM,easeOut:sre,circIn:LM,circInOut:lre,circOut:$5,backIn:F5,backInOut:ure,backOut:$M,anticipate:cre},SP=e=>{if(Array.isArray(e)){L5(e.length===4);const[t,n,r,i]=e;return mp(t,n,r,i)}else if(typeof e=="string")return dre[e];return e},B5=(e,t)=>n=>!!(pp(n)&&cne.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),FM=(e,t,n)=>r=>{if(!pp(r))return r;const[i,o,s,a]=r.match(Bv);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(s),alpha:a!==void 0?parseFloat(a):1}},fre=e=>ma(0,255,e),GS={...Bl,transform:e=>Math.round(fre(e))},rl={test:B5("rgb","red"),parse:FM("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+GS.transform(e)+", "+GS.transform(t)+", "+GS.transform(n)+", "+gf(pf.transform(r))+")"};function hre(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const yw={test:B5("#"),parse:hre,transform:rl.transform},ju={test:B5("hsl","hue"),parse:FM("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+vo.transform(gf(t))+", "+vo.transform(gf(n))+", "+gf(pf.transform(r))+")"},sr={test:e=>rl.test(e)||yw.test(e)||ju.test(e),parse:e=>rl.test(e)?rl.parse(e):ju.test(e)?ju.parse(e):yw.parse(e),transform:e=>pp(e)?e:e.hasOwnProperty("red")?rl.transform(e):ju.transform(e)},Nt=(e,t,n)=>-n*e+n*t+e;function HS(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function pre({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,s=0;if(!t)i=o=s=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;i=HS(l,a,e+1/3),o=HS(l,a,e),s=HS(l,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(s*255),alpha:r}}const qS=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},gre=[yw,rl,ju],mre=e=>gre.find(t=>t.test(e));function _P(e){const t=mre(e);let n=t.parse(e);return t===ju&&(n=pre(n)),n}const BM=(e,t)=>{const n=_P(e),r=_P(t),i={...n};return o=>(i.red=qS(n.red,r.red,o),i.green=qS(n.green,r.green,o),i.blue=qS(n.blue,r.blue,o),i.alpha=Nt(n.alpha,r.alpha,o),rl.transform(i))};function yre(e){var t,n;return isNaN(e)&&pp(e)&&(((t=e.match(Bv))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(cM))===null||n===void 0?void 0:n.length)||0)>0}const jM={regex:lne,countKey:"Vars",token:"${v}",parse:rn},VM={regex:cM,countKey:"Colors",token:"${c}",parse:sr.parse},zM={regex:Bv,countKey:"Numbers",token:"${n}",parse:Bl.parse};function WS(e,{regex:t,countKey:n,token:r,parse:i}){const o=e.tokenised.match(t);o&&(e["num"+n]=o.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...o.map(i)))}function Ay(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&WS(n,jM),WS(n,VM),WS(n,zM),n}function UM(e){return Ay(e).values}function GM(e){const{values:t,numColors:n,numVars:r,tokenised:i}=Ay(e),o=t.length;return s=>{let a=i;for(let l=0;ltypeof e=="number"?0:e;function bre(e){const t=UM(e);return GM(e)(t.map(vre))}const ya={test:yre,parse:UM,createTransformer:GM,getAnimatableNone:bre},HM=(e,t)=>n=>`${n>0?t:e}`;function qM(e,t){return typeof e=="number"?n=>Nt(e,t,n):sr.test(e)?BM(e,t):e.startsWith("var(")?HM(e,t):KM(e,t)}const WM=(e,t)=>{const n=[...e],r=n.length,i=e.map((o,s)=>qM(o,t[s]));return o=>{for(let s=0;s{const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=qM(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}},KM=(e,t)=>{const n=ya.createTransformer(t),r=Ay(e),i=Ay(t);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?oa(WM(r.values,i.values),n):HM(e,t)},ah=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},wP=(e,t)=>n=>Nt(e,t,n);function _re(e){return typeof e=="number"?wP:typeof e=="string"?sr.test(e)?BM:KM:Array.isArray(e)?WM:typeof e=="object"?Sre:wP}function wre(e,t,n){const r=[],i=n||_re(e[0]),o=e.length-1;for(let s=0;st[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const s=wre(t,r,i),a=s.length,l=u=>{let c=0;if(a>1)for(;cl(ma(e[0],e[o-1],u)):l}function xre(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=ah(0,t,r);e.push(Nt(n,1,i))}}function Cre(e){const t=[0];return xre(t,e.length-1),t}function Tre(e,t){return e.map(n=>n*t)}function Ere(e,t){return e.map(()=>t||MM).splice(0,e.length-1)}function Oy({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=are(r)?r.map(SP):SP(r),o={done:!1,value:t[0]},s=Tre(n&&n.length===t.length?n:Cre(t),e),a=YM(s,t,{ease:Array.isArray(i)?i:Ere(t,i)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}function XM(e,t){return t?e*(1e3/t):0}const Pre=5;function QM(e,t,n){const r=Math.max(t-Pre,0);return XM(n-e(r),t-r)}const KS=.001,kre=.01,xP=10,Are=.05,Ore=1;function Rre({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,o;Zne(e<=sa(xP));let s=1-t;s=ma(Are,Ore,s),e=ma(kre,xP,rs(e)),s<1?(i=u=>{const c=u*s,d=c*e,f=c-n,h=vw(u,s),p=Math.exp(-d);return KS-f/h*p},o=u=>{const d=u*s*e,f=d*n+n,h=Math.pow(s,2)*Math.pow(u,2)*e,p=Math.exp(-d),g=vw(Math.pow(u,2),s);return(-i(u)+KS>0?-1:1)*((f-h)*p)/g}):(i=u=>{const c=Math.exp(-u*e),d=(u-n)*e+1;return-KS+c*d},o=u=>{const c=Math.exp(-u*e),d=(n-u)*(e*e);return c*d});const a=5/e,l=Mre(i,o,a);if(e=sa(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:s*2*Math.sqrt(r*u),duration:e}}}const Ire=12;function Mre(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function Lre(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!CP(e,Dre)&&CP(e,Nre)){const n=Rre(e);t={...t,...n,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function ZM({keyframes:e,restDelta:t,restSpeed:n,...r}){const i=e[0],o=e[e.length-1],s={done:!1,value:i},{stiffness:a,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:f}=Lre(r),h=c?-rs(c):0,p=l/(2*Math.sqrt(a*u)),g=o-i,S=rs(Math.sqrt(a/u)),v=Math.abs(g)<5;n||(n=v?.01:2),t||(t=v?.005:.5);let y;if(p<1){const m=vw(S,p);y=b=>{const _=Math.exp(-p*S*b);return o-_*((h+p*S*g)/m*Math.sin(m*b)+g*Math.cos(m*b))}}else if(p===1)y=m=>o-Math.exp(-S*m)*(g+(h+S*g)*m);else{const m=S*Math.sqrt(p*p-1);y=b=>{const _=Math.exp(-p*S*b),w=Math.min(m*b,300);return o-_*((h+p*S*g)*Math.sinh(w)+m*g*Math.cosh(w))/m}}return{calculatedDuration:f&&d||null,next:m=>{const b=y(m);if(f)s.done=m>=d;else{let _=h;m!==0&&(p<1?_=QM(y,m,b):_=0);const w=Math.abs(_)<=n,x=Math.abs(o-b)<=t;s.done=w&&x}return s.value=s.done?o:b,s}}}function TP({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},h=C=>a!==void 0&&Cl,p=C=>a===void 0?l:l===void 0||Math.abs(a-C)-g*Math.exp(-C/r),m=C=>v+y(C),b=C=>{const k=y(C),P=m(C);f.done=Math.abs(k)<=u,f.value=f.done?v:P};let _,w;const x=C=>{h(f.value)&&(_=C,w=ZM({keyframes:[f.value,p(f.value)],velocity:QM(m,C,f.value),damping:i,stiffness:o,restDelta:u,restSpeed:c}))};return x(0),{calculatedDuration:null,next:C=>{let k=!1;return!w&&_===void 0&&(k=!0,b(C),x(C)),_!==void 0&&C>_?w.next(C-_):(!k&&b(C),f)}}}const $re=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Pt.update(t,!0),stop:()=>fs(t),now:()=>Yn.isProcessing?Yn.timestamp:performance.now()}},EP=2e4;function PP(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=EP?1/0:t}const Fre={decay:TP,inertia:TP,tween:Oy,keyframes:Oy,spring:ZM};function Ry({autoplay:e=!0,delay:t=0,driver:n=$re,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:s=0,repeatType:a="loop",onPlay:l,onStop:u,onComplete:c,onUpdate:d,...f}){let h=1,p=!1,g,S;const v=()=>{S=new Promise(V=>{g=V})};v();let y;const m=Fre[i]||Oy;let b;m!==Oy&&typeof r[0]!="number"&&(b=YM([0,100],r,{clamp:!1}),r=[0,100]);const _=m({...f,keyframes:r});let w;a==="mirror"&&(w=m({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let x="idle",C=null,k=null,P=null;_.calculatedDuration===null&&o&&(_.calculatedDuration=PP(_));const{calculatedDuration:A}=_;let $=1/0,N=1/0;A!==null&&($=A+s,N=$*(o+1)-s);let T=0;const O=V=>{if(k===null)return;h>0&&(k=Math.min(k,V)),h<0&&(k=Math.min(V-N/h,k)),C!==null?T=C:T=Math.round(V-k)*h;const z=T-t*(h>=0?1:-1),U=h>=0?z<0:z>N;T=Math.max(z,0),x==="finished"&&C===null&&(T=N);let K=T,W=_;if(o){const Q=T/$;let J=Math.floor(Q),ne=Q%1;!ne&&Q>=1&&(ne=1),ne===1&&J--,J=Math.min(J,o+1);const Z=!!(J%2);Z&&(a==="reverse"?(ne=1-ne,s&&(ne-=s/$)):a==="mirror"&&(W=w));let me=ma(0,1,ne);T>N&&(me=a==="reverse"&&Z?1:0),K=me*$}const X=U?{done:!1,value:r[0]}:W.next(K);b&&(X.value=b(X.value));let{done:F}=X;!U&&A!==null&&(F=h>=0?T>=N:T<=0);const q=C===null&&(x==="finished"||x==="running"&&F);return d&&d(X.value),q&&R(),X},I=()=>{y&&y.stop(),y=void 0},M=()=>{x="idle",I(),g(),v(),k=P=null},R=()=>{x="finished",c&&c(),I(),g()},D=()=>{if(p)return;y||(y=n(O));const V=y.now();l&&l(),C!==null?k=V-C:(!k||x==="finished")&&(k=V),x==="finished"&&v(),P=k,C=null,x="running",y.start()};e&&D();const L={then(V,z){return S.then(V,z)},get time(){return rs(T)},set time(V){V=sa(V),T=V,C!==null||!y||h===0?C=V:k=y.now()-V/h},get duration(){const V=_.calculatedDuration===null?PP(_):_.calculatedDuration;return rs(V)},get speed(){return h},set speed(V){V===h||!y||(h=V,L.time=rs(T))},get state(){return x},play:D,pause:()=>{x="paused",C=T},stop:()=>{p=!0,x!=="idle"&&(x="idle",u&&u(),M())},cancel:()=>{P!==null&&O(P),M()},complete:()=>{x="finished"},sample:V=>(k=0,O(V))};return L}const Bre=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),mg=10,jre=2e4,Vre=(e,t)=>t.type==="spring"||e==="backgroundColor"||!kM(t.ease);function zre(e,t,{onUpdate:n,onComplete:r,...i}){if(!(RM.waapi()&&Bre.has(t)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let s=!1,a,l;const u=()=>{l=new Promise(v=>{a=v})};u();let{keyframes:c,duration:d=300,ease:f,times:h}=i;if(Vre(t,i)){const v=Ry({...i,repeat:0,delay:0});let y={done:!1,value:c[0]};const m=[];let b=0;for(;!y.done&&bp.cancel(),S=()=>{Pt.update(g),a(),u()};return p.onfinish=()=>{e.set(tre(c,i)),r&&r(),S()},{then(v,y){return l.then(v,y)},get time(){return rs(p.currentTime||0)},set time(v){p.currentTime=sa(v)},get speed(){return p.playbackRate},set speed(v){p.playbackRate=v},get duration(){return rs(d)},play:()=>{s||(p.play(),fs(g))},pause:()=>p.pause(),stop:()=>{if(s=!0,p.playState==="idle")return;const{currentTime:v}=p;if(v){const y=Ry({...i,autoplay:!1});e.setWithVelocity(y.sample(v-mg).value,y.sample(v).value,mg)}S()},complete:()=>p.finish(),cancel:S}}function Ure({keyframes:e,delay:t,onUpdate:n,onComplete:r}){const i=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:rn,pause:rn,stop:rn,then:o=>(o(),Promise.resolve()),cancel:rn,complete:rn});return t?Ry({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}const Gre={type:"spring",stiffness:500,damping:25,restSpeed:10},Hre=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),qre={type:"keyframes",duration:.8},Wre={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Kre=(e,{keyframes:t})=>t.length>2?qre:Fl.has(e)?e.startsWith("scale")?Hre(t[1]):Gre:Wre,bw=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(ya.test(t)||t==="0")&&!t.startsWith("url(")),Yre=new Set(["brightness","contrast","saturate","opacity"]);function Xre(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Bv)||[];if(!r)return e;const i=n.replace(r,"");let o=Yre.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const Qre=/([a-z-]*)\(.*?\)/g,Sw={...ya,getAnimatableNone:e=>{const t=e.match(Qre);return t?t.map(Xre).join(" "):e}},Zre={...dM,color:sr,backgroundColor:sr,outlineColor:sr,fill:sr,stroke:sr,borderColor:sr,borderTopColor:sr,borderRightColor:sr,borderBottomColor:sr,borderLeftColor:sr,filter:Sw,WebkitFilter:Sw},j5=e=>Zre[e];function JM(e,t){let n=j5(e);return n!==Sw&&(n=ya),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const eN=e=>/^0[^.\s]+$/.test(e);function Jre(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||eN(e)}function eie(e,t,n,r){const i=bw(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const s=r.from!==void 0?r.from:e.get();let a;const l=[];for(let u=0;ui=>{const o=tN(r,e)||{},s=o.delay||r.delay||0;let{elapsed:a=0}=r;a=a-sa(s);const l=eie(t,e,n,o),u=l[0],c=l[l.length-1],d=bw(e,u),f=bw(e,c);let h={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-a,onUpdate:p=>{t.set(p),o.onUpdate&&o.onUpdate(p)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(tie(o)||(h={...h,...Kre(e,h)}),h.duration&&(h.duration=sa(h.duration)),h.repeatDelay&&(h.repeatDelay=sa(h.repeatDelay)),!d||!f||Jne.current||o.type===!1)return Ure(h);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const p=zre(t,e,h);if(p)return p}return Ry(h)};function Iy(e){return!!(Rr(e)&&e.add)}const nie=e=>/^\-?\d*\.?\d+$/.test(e);function z5(e,t){e.indexOf(t)===-1&&e.push(t)}function U5(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class G5{constructor(){this.subscriptions=[]}add(t){return z5(this.subscriptions,t),()=>U5(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;o!isNaN(parseFloat(e));class iie{constructor(t,n={}){this.version="10.12.22",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(r,i=!0)=>{this.prev=this.current,this.current=r;const{delta:o,timestamp:s}=Yn;this.lastUpdated!==s&&(this.timeDelta=o,this.lastUpdated=s,Pt.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>Pt.postRender(this.velocityCheck),this.velocityCheck=({timestamp:r})=>{r!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=rie(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new G5);const r=this.events[t].add(n);return t==="change"?()=>{r(),Pt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=t,this.timeDelta=r}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?XM(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function kc(e,t){return new iie(e,t)}const nN=e=>t=>t.test(e),oie={test:e=>e==="auto",parse:e=>e},rN=[Bl,_e,vo,Is,fne,dne,oie],Td=e=>rN.find(nN(e)),sie=[...rN,sr,ya],aie=e=>sie.find(nN(e));function lie(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,kc(n))}function uie(e,t){const n=Vv(e,t);let{transitionEnd:r={},transition:i={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const s in o){const a=Ene(o[s]);lie(e,s,a)}}function cie(e,t,n){var r,i;const o=Object.keys(t).filter(a=>!e.hasValue(a)),s=o.length;if(s)for(let a=0;al.remove(d))),u.push(g)}return s&&Promise.all(u).then(()=>{s&&uie(e,s)}),u}function _w(e,t,n={}){const r=Vv(e,t,n.custom);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(iN(e,r,n)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=i;return pie(e,t,u+l,c,d,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[l,u]=a==="beforeChildren"?[o,s]:[s,o];return l().then(()=>u())}else return Promise.all([o(),s(n.delay)])}function pie(e,t,n=0,r=0,i=1,o){const s=[],a=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(e.variantChildren).sort(gie).forEach((u,c)=>{u.notify("AnimationStart",t),s.push(_w(u,t,{...o,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(s)}function gie(e,t){return e.sortNodePosition(t)}function mie(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>_w(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=_w(e,t,n);else{const i=typeof t=="function"?Vv(e,t,n.custom):t;r=Promise.all(iN(e,i,n))}return r.then(()=>e.notify("AnimationComplete",t))}const yie=[...T5].reverse(),vie=T5.length;function bie(e){return t=>Promise.all(t.map(({animation:n,options:r})=>mie(e,n,r)))}function Sie(e){let t=bie(e);const n=wie();let r=!0;const i=(l,u)=>{const c=Vv(e,u);if(c){const{transition:d,transitionEnd:f,...h}=c;l={...l,...h,...f}}return l};function o(l){t=l(e)}function s(l,u){const c=e.getProps(),d=e.getVariantContext(!0)||{},f=[],h=new Set;let p={},g=1/0;for(let v=0;vg&&_;const P=Array.isArray(b)?b:[b];let A=P.reduce(i,{});w===!1&&(A={});const{prevResolvedValues:$={}}=m,N={...$,...A},T=O=>{k=!0,h.delete(O),m.needsAnimating[O]=!0};for(const O in N){const I=A[O],M=$[O];p.hasOwnProperty(O)||(I!==M?ky(I)&&ky(M)?!EM(I,M)||C?T(O):m.protectedKeys[O]=!0:I!==void 0?T(O):h.add(O):I!==void 0&&h.has(O)?T(O):m.protectedKeys[O]=!0)}m.prevProp=b,m.prevResolvedValues=A,m.isActive&&(p={...p,...A}),r&&e.blockInitialAnimation&&(k=!1),k&&!x&&f.push(...P.map(O=>({animation:O,options:{type:y,...l}})))}if(h.size){const v={};h.forEach(y=>{const m=e.getBaseTarget(y);m!==void 0&&(v[y]=m)}),f.push({animation:v})}let S=!!f.length;return r&&c.initial===!1&&!e.manuallyAnimateOnMount&&(S=!1),r=!1,S?t(f):Promise.resolve()}function a(l,u,c){var d;if(n[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,u)}),n[l].isActive=u;const f=s(c,l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:s,setActive:a,setAnimateFunction:o,getState:()=>n}}function _ie(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!EM(t,e):!1}function Va(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function wie(){return{animate:Va(!0),whileInView:Va(),whileHover:Va(),whileTap:Va(),whileDrag:Va(),whileFocus:Va(),exit:Va()}}class xie extends Ra{constructor(t){super(t),t.animationState||(t.animationState=Sie(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),$v(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let Cie=0;class Tie extends Ra{constructor(){super(...arguments),this.id=Cie++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n,custom:r}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const o=this.node.animationState.setActive("exit",!t,{custom:r??this.node.getProps().custom});n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const Eie={animation:{Feature:xie},exit:{Feature:Tie}},kP=(e,t)=>Math.abs(e-t);function Pie(e,t){const n=kP(e.x,t.x),r=kP(e.y,t.y);return Math.sqrt(n**2+r**2)}class oN{constructor(t,n,{transformPagePoint:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=XS(this.lastMoveEventInfo,this.history),c=this.startEvent!==null,d=Pie(u.offset,{x:0,y:0})>=3;if(!c&&!d)return;const{point:f}=u,{timestamp:h}=Yn;this.history.push({...f,timestamp:h});const{onStart:p,onMove:g}=this.handlers;c||(p&&p(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,u)},this.handlePointerMove=(u,c)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=YS(c,this.transformPagePoint),Pt.update(this.updatePoint,!0)},this.handlePointerUp=(u,c)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:d,onSessionEnd:f}=this.handlers,h=XS(u.type==="pointercancel"?this.lastMoveEventInfo:YS(c,this.transformPagePoint),this.history);this.startEvent&&d&&d(u,h),f&&f(u,h)},!_M(t))return;this.handlers=n,this.transformPagePoint=r;const i=jv(t),o=YS(i,this.transformPagePoint),{point:s}=o,{timestamp:a}=Yn;this.history=[{...s,timestamp:a}];const{onSessionStart:l}=n;l&&l(t,XS(o,this.history)),this.removeListeners=oa(ns(window,"pointermove",this.handlePointerMove),ns(window,"pointerup",this.handlePointerUp),ns(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),fs(this.updatePoint)}}function YS(e,t){return t?{point:t(e.point)}:e}function AP(e,t){return{x:e.x-t.x,y:e.y-t.y}}function XS({point:e},t){return{point:e,delta:AP(e,sN(t)),offset:AP(e,kie(t)),velocity:Aie(t,.1)}}function kie(e){return e[0]}function sN(e){return e[e.length-1]}function Aie(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=sN(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>sa(t)));)n--;if(!r)return{x:0,y:0};const o=rs(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const s={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function Ur(e){return e.max-e.min}function ww(e,t=0,n=.01){return Math.abs(e-t)<=n}function OP(e,t,n,r=.5){e.origin=r,e.originPoint=Nt(t.min,t.max,e.origin),e.scale=Ur(n)/Ur(t),(ww(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=Nt(n.min,n.max,e.origin)-e.originPoint,(ww(e.translate)||isNaN(e.translate))&&(e.translate=0)}function mf(e,t,n,r){OP(e.x,t.x,n.x,r?r.originX:void 0),OP(e.y,t.y,n.y,r?r.originY:void 0)}function RP(e,t,n){e.min=n.min+t.min,e.max=e.min+Ur(t)}function Oie(e,t,n){RP(e.x,t.x,n.x),RP(e.y,t.y,n.y)}function IP(e,t,n){e.min=t.min-n.min,e.max=e.min+Ur(t)}function yf(e,t,n){IP(e.x,t.x,n.x),IP(e.y,t.y,n.y)}function Rie(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Nt(n,e,r.max):Math.min(e,n)),e}function MP(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function Iie(e,{top:t,left:n,bottom:r,right:i}){return{x:MP(e.x,n,i),y:MP(e.y,t,r)}}function NP(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=ah(t.min,t.max-r,e.min):r>i&&(n=ah(e.min,e.max-i,t.min)),ma(0,1,n)}function Die(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const xw=.35;function Lie(e=xw){return e===!1?e=0:e===!0&&(e=xw),{x:DP(e,"left","right"),y:DP(e,"top","bottom")}}function DP(e,t,n){return{min:LP(e,t),max:LP(e,n)}}function LP(e,t){return typeof e=="number"?e:e[t]||0}const $P=()=>({translate:0,scale:1,origin:0,originPoint:0}),Vu=()=>({x:$P(),y:$P()}),FP=()=>({min:0,max:0}),Jt=()=>({x:FP(),y:FP()});function Ki(e){return[e("x"),e("y")]}function aN({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function $ie({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Fie(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function QS(e){return e===void 0||e===1}function Cw({scale:e,scaleX:t,scaleY:n}){return!QS(e)||!QS(t)||!QS(n)}function Ka(e){return Cw(e)||lN(e)||e.z||e.rotate||e.rotateX||e.rotateY}function lN(e){return BP(e.x)||BP(e.y)}function BP(e){return e&&e!=="0%"}function My(e,t,n){const r=e-n,i=t*r;return n+i}function jP(e,t,n,r,i){return i!==void 0&&(e=My(e,i,r)),My(e,n,r)+t}function Tw(e,t=0,n=1,r,i){e.min=jP(e.min,t,n,r,i),e.max=jP(e.max,t,n,r,i)}function uN(e,{x:t,y:n}){Tw(e.x,t.translate,t.scale,t.originPoint),Tw(e.y,n.translate,n.scale,n.originPoint)}function Bie(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,s;for(let a=0;a1.0000000000001||e<.999999999999?e:1}function Fs(e,t){e.min=e.min+t,e.max=e.max+t}function zP(e,t,[n,r,i]){const o=t[i]!==void 0?t[i]:.5,s=Nt(e.min,e.max,o);Tw(e,t[n],t[r],s,t.scale)}const jie=["x","scaleX","originX"],Vie=["y","scaleY","originY"];function zu(e,t){zP(e.x,t,jie),zP(e.y,t,Vie)}function cN(e,t){return aN(Fie(e.getBoundingClientRect(),t))}function zie(e,t,n){const r=cN(e,n),{scroll:i}=t;return i&&(Fs(r.x,i.offset.x),Fs(r.y,i.offset.y)),r}const Uie=new WeakMap;class Gie{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Jt(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=l=>{this.stopAnimation(),n&&this.snapToCursor(jv(l,"page").point)},o=(l,u)=>{const{drag:c,dragPropagation:d,onDragStart:f}=this.getProps();if(c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=xM(c),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ki(p=>{let g=this.getAxisMotionValue(p).get()||0;if(vo.test(g)){const{projection:S}=this.visualElement;if(S&&S.layout){const v=S.layout.layoutBox[p];v&&(g=Ur(v)*(parseFloat(g)/100))}}this.originPoint[p]=g}),f&&Pt.update(()=>f(l,u),!1,!0);const{animationState:h}=this.visualElement;h&&h.setActive("whileDrag",!0)},s=(l,u)=>{const{dragPropagation:c,dragDirectionLock:d,onDirectionLock:f,onDrag:h}=this.getProps();if(!c&&!this.openGlobalLock)return;const{offset:p}=u;if(d&&this.currentDirection===null){this.currentDirection=Hie(p),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",u.point,p),this.updateAxis("y",u.point,p),this.visualElement.render(),h&&h(l,u)},a=(l,u)=>this.stop(l,u);this.panSession=new oN(t,{onSessionStart:i,onStart:o,onMove:s,onSessionEnd:a},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&Pt.update(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!yg(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let s=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(s=Rie(s,this.constraints[t],this.elastic[t])),o.set(s)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),{layout:r}=this.visualElement.projection||{},i=this.constraints;t&&Bu(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=Iie(r.layoutBox,t):this.constraints=!1,this.elastic=Lie(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Ki(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=Die(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Bu(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=zie(r,i.root,this.visualElement.getTransformPagePoint());let s=Mie(i.layout.layoutBox,o);if(n){const a=n($ie(s));this.hasMutatedConstraints=!!a,a&&(s=aN(a))}return s}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:s,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=Ki(c=>{if(!yg(c,n,this.currentDirection))return;let d=l&&l[c]||{};s&&(d={min:0,max:0});const f=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:r?t[c]:0,bounceStiffness:f,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...o,...d};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(V5(t,r,0,n))}stopAnimation(){Ki(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n="_drag"+t.toUpperCase(),r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ki(n=>{const{drag:r}=this.getProps();if(!yg(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:s,max:a}=i.layout.layoutBox[n];o.set(t[n]-Nt(s,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Bu(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Ki(s=>{const a=this.getAxisMotionValue(s);if(a){const l=a.get();i[s]=Nie({min:l,max:l},this.constraints[s])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Ki(s=>{if(!yg(s,t,null))return;const a=this.getAxisMotionValue(s),{min:l,max:u}=this.constraints[s];a.set(Nt(l,u,i[s]))})}addListeners(){if(!this.visualElement.current)return;Uie.set(this.visualElement,this);const t=this.visualElement.current,n=ns(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Bu(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),r();const s=Jo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ki(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{s(),n(),o(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:s=xw,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:s,dragMomentum:a}}}function yg(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Hie(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class qie extends Ra{constructor(t){super(t),this.removeGroupControls=rn,this.removeListeners=rn,this.controls=new Gie(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||rn}unmount(){this.removeGroupControls(),this.removeListeners()}}const UP=e=>(t,n)=>{e&&Pt.update(()=>e(t,n))};class Wie extends Ra{constructor(){super(...arguments),this.removePointerDownListener=rn}onPointerDown(t){this.session=new oN(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:UP(t),onStart:UP(n),onMove:r,onEnd:(o,s)=>{delete this.session,i&&Pt.update(()=>i(o,s))}}}mount(){this.removePointerDownListener=ns(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function Kie(){const e=E.useContext(fp);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,i=E.useId();return E.useEffect(()=>r(i),[]),!t&&n?[!1,()=>n&&n(i)]:[!0]}function Yie(){return Xie(E.useContext(fp))}function Xie(e){return e===null?!0:e.isPresent}const gm={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function GP(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Ed={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(_e.test(e))e=parseFloat(e);else return e;const n=GP(e,t.target.x),r=GP(e,t.target.y);return`${n}% ${r}%`}},Qie={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=ya.parse(e);if(i.length>5)return r;const o=ya.createTransformer(e),s=typeof i[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;i[0+s]/=a,i[1+s]/=l;const u=Nt(a,l,.5);return typeof i[2+s]=="number"&&(i[2+s]/=u),typeof i[3+s]=="number"&&(i[3+s]/=u),o(i)}};class Zie extends Ve.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;ine(Jie),o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),gm.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,s=r.projection;return s&&(s.isPresent=o,i||t.layoutDependency!==n||n===void 0?s.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?s.promote():s.relegate()||Pt.postRender(()=>{const a=s.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function dN(e){const[t,n]=Kie(),r=E.useContext(P5);return Ve.createElement(Zie,{...e,layoutGroup:r,switchLayoutGroup:E.useContext(sM),isPresent:t,safeToRemove:n})}const Jie={borderRadius:{...Ed,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ed,borderTopRightRadius:Ed,borderBottomLeftRadius:Ed,borderBottomRightRadius:Ed,boxShadow:Qie},fN=["TopLeft","TopRight","BottomLeft","BottomRight"],eoe=fN.length,HP=e=>typeof e=="string"?parseFloat(e):e,qP=e=>typeof e=="number"||_e.test(e);function toe(e,t,n,r,i,o){i?(e.opacity=Nt(0,n.opacity!==void 0?n.opacity:1,noe(r)),e.opacityExit=Nt(t.opacity!==void 0?t.opacity:1,0,roe(r))):o&&(e.opacity=Nt(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let s=0;srt?1:n(ah(e,t,r))}function KP(e,t){e.min=t.min,e.max=t.max}function Zr(e,t){KP(e.x,t.x),KP(e.y,t.y)}function YP(e,t,n,r,i){return e-=t,e=My(e,1/n,r),i!==void 0&&(e=My(e,1/i,r)),e}function ioe(e,t=0,n=1,r=.5,i,o=e,s=e){if(vo.test(t)&&(t=parseFloat(t),t=Nt(s.min,s.max,t/100)-s.min),typeof t!="number")return;let a=Nt(o.min,o.max,r);e===o&&(a-=t),e.min=YP(e.min,t,n,a,i),e.max=YP(e.max,t,n,a,i)}function XP(e,t,[n,r,i],o,s){ioe(e,t[n],t[r],t[i],t.scale,o,s)}const ooe=["x","scaleX","originX"],soe=["y","scaleY","originY"];function QP(e,t,n,r){XP(e.x,t,ooe,n?n.x:void 0,r?r.x:void 0),XP(e.y,t,soe,n?n.y:void 0,r?r.y:void 0)}function ZP(e){return e.translate===0&&e.scale===1}function pN(e){return ZP(e.x)&&ZP(e.y)}function Ew(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function JP(e){return Ur(e.x)/Ur(e.y)}class aoe{constructor(){this.members=[]}add(t){z5(this.members,t),t.scheduleRender()}remove(t){if(U5(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function e6(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y;if((i||o)&&(r=`translate3d(${i}px, ${o}px, 0) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{rotate:l,rotateX:u,rotateY:c}=n;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),c&&(r+=`rotateY(${c}deg) `)}const s=e.x.scale*t.x,a=e.y.scale*t.y;return(s!==1||a!==1)&&(r+=`scale(${s}, ${a})`),r||"none"}const loe=(e,t)=>e.depth-t.depth;class uoe{constructor(){this.children=[],this.isDirty=!1}add(t){z5(this.children,t),this.isDirty=!0}remove(t){U5(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(loe),this.isDirty=!1,this.children.forEach(t)}}function coe(e,t){const n=performance.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(fs(r),e(o-t))};return Pt.read(r,!0),()=>fs(r)}function doe(e){window.MotionDebug&&window.MotionDebug.record(e)}function foe(e){return e instanceof SVGElement&&e.tagName!=="svg"}function hoe(e,t,n){const r=Rr(e)?e:kc(e);return r.start(V5("",r,t,n)),r.animation}const t6=["","X","Y","Z"],n6=1e3;let poe=0;const Ya={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function gN({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(s={},a=t==null?void 0:t()){this.id=poe++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{Ya.totalNodes=Ya.resolvedTargetDeltas=Ya.recalculatedProjection=0,this.nodes.forEach(yoe),this.nodes.forEach(woe),this.nodes.forEach(xoe),this.nodes.forEach(voe),doe(Ya)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(s,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=coe(f,250),gm.hasAnimatedSinceResize&&(gm.hasAnimatedSinceResize=!1,this.nodes.forEach(i6))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||c.getDefaultTransition()||koe,{onLayoutAnimationStart:S,onLayoutAnimationComplete:v}=c.getProps(),y=!this.targetLayout||!Ew(this.targetLayout,p)||h,m=!f&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||m||f&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,m);const b={...tN(g,"layout"),onPlay:S,onComplete:v};(c.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b)}else f||i6(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,fs(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Coe),this.animationId++)}getTransformTemplate(){const{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;cthis.update()))}clearAllSnapshots(){this.nodes.forEach(boe),this.sharedNodes.forEach(Toe)}scheduleUpdateProjection(){Pt.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){Pt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const _=b/1e3;o6(d.x,s.x,_),o6(d.y,s.y,_),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(yf(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Eoe(this.relativeTarget,this.relativeTargetOrigin,f,_),m&&Ew(this.relativeTarget,m)&&(this.isProjectionDirty=!1),m||(m=Jt()),Zr(m,this.relativeTarget)),g&&(this.animationValues=c,toe(c,u,this.latestValues,_,y,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=_},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(fs(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Pt.update(()=>{gm.hasAnimatedSinceResize=!0,this.currentAnimation=hoe(0,n6,{...s,onUpdate:a=>{this.mixTargetDelta(a),s.onUpdate&&s.onUpdate(a)},onComplete:()=>{s.onComplete&&s.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(n6),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const s=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:c}=s;if(!(!a||!l||!u)){if(this!==s&&this.layout&&u&&mN(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Jt();const d=Ur(this.layout.layoutBox.x);l.x.min=s.target.x.min,l.x.max=l.x.min+d;const f=Ur(this.layout.layoutBox.y);l.y.min=s.target.y.min,l.y.max=l.y.min+f}Zr(a,l),zu(a,c),mf(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(s,a){this.sharedNodes.has(s)||this.sharedNodes.set(s,new aoe),this.sharedNodes.get(s).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const s=this.getStack();return s?s.lead===this:!0}getLead(){var s;const{layoutId:a}=this.options;return a?((s=this.getStack())===null||s===void 0?void 0:s.lead)||this:this}getPrevLead(){var s;const{layoutId:a}=this.options;return a?(s=this.getStack())===null||s===void 0?void 0:s.prevLead:void 0}getStack(){const{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),s&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const s=this.getStack();return s?s.relegate(this):!1}resetRotation(){const{visualElement:s}=this.options;if(!s)return;let a=!1;const{latestValues:l}=s;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(a=!0),!a)return;const u={};for(let c=0;c{var a;return(a=s.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(r6),this.root.sharedNodes.clear()}}}function goe(e){e.updateLayout()}function moe(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:o}=e.options,s=n.source!==e.layout.source;o==="size"?Ki(d=>{const f=s?n.measuredBox[d]:n.layoutBox[d],h=Ur(f);f.min=r[d].min,f.max=f.min+h}):mN(o,n.layoutBox,r)&&Ki(d=>{const f=s?n.measuredBox[d]:n.layoutBox[d],h=Ur(r[d]);f.max=f.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+h)});const a=Vu();mf(a,r,n.layoutBox);const l=Vu();s?mf(l,e.applyTransform(i,!0),n.measuredBox):mf(l,r,n.layoutBox);const u=!pN(a);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:h}=d;if(f&&h){const p=Jt();yf(p,n.layoutBox,f.layoutBox);const g=Jt();yf(g,r,h.layoutBox),Ew(p,g)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=p,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function yoe(e){Ya.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function voe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function boe(e){e.clearSnapshot()}function r6(e){e.clearMeasurements()}function Soe(e){e.isLayoutDirty=!1}function _oe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function i6(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function woe(e){e.resolveTargetDelta()}function xoe(e){e.calcProjection()}function Coe(e){e.resetRotation()}function Toe(e){e.removeLeadSnapshot()}function o6(e,t,n){e.translate=Nt(t.translate,0,n),e.scale=Nt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function s6(e,t,n,r){e.min=Nt(t.min,n.min,r),e.max=Nt(t.max,n.max,r)}function Eoe(e,t,n,r){s6(e.x,t.x,n.x,r),s6(e.y,t.y,n.y,r)}function Poe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const koe={duration:.45,ease:[.4,0,.1,1]};function a6(e){e.min=Math.round(e.min*2)/2,e.max=Math.round(e.max*2)/2}function Aoe(e){a6(e.x),a6(e.y)}function mN(e,t,n){return e==="position"||e==="preserve-aspect"&&!ww(JP(t),JP(n),.2)}const Ooe=gN({attachResizeListener:(e,t)=>Jo(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ZS={current:void 0},yN=gN({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!ZS.current){const e=new Ooe({});e.mount(window),e.setOptions({layoutScroll:!0}),ZS.current=e}return ZS.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Roe={pan:{Feature:Wie},drag:{Feature:qie,ProjectionNode:yN,MeasureLayout:dN}},Ioe=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Moe(e){const t=Ioe.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function Pw(e,t,n=1){const[r,i]=Moe(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);return o?o.trim():gw(i)?Pw(i,t,n+1):i}function Noe(e,{...t},n){const r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&(n={...n}),e.values.forEach(i=>{const o=i.get();if(!gw(o))return;const s=Pw(o,r);s&&i.set(s)});for(const i in t){const o=t[i];if(!gw(o))continue;const s=Pw(o,r);s&&(t[i]=s,n||(n={}),n[i]===void 0&&(n[i]=o))}return{target:t,transitionEnd:n}}const Doe=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),vN=e=>Doe.has(e),Loe=e=>Object.keys(e).some(vN),l6=e=>e===Bl||e===_e,u6=(e,t)=>parseFloat(e.split(", ")[t]),c6=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return u6(i[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?u6(o[1],e):0}},$oe=new Set(["x","y","z"]),Foe=hp.filter(e=>!$oe.has(e));function Boe(e){const t=[];return Foe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t.length&&e.render(),t}const Ac={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:c6(4,13),y:c6(5,14)};Ac.translateX=Ac.x;Ac.translateY=Ac.y;const joe=(e,t,n)=>{const r=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:s}=o,a={};s==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{a[u]=Ac[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const c=t.getValue(u);c&&c.jump(a[u]),e[u]=Ac[u](l,o)}),e},Voe=(e,t,n={},r={})=>{t={...t},r={...r};const i=Object.keys(t).filter(vN);let o=[],s=!1;const a=[];if(i.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let c=n[l],d=Td(c);const f=t[l];let h;if(ky(f)){const p=f.length,g=f[0]===null?1:0;c=f[g],d=Td(c);for(let S=g;S=0?window.pageYOffset:null,u=joe(t,e,a);return o.length&&o.forEach(([c,d])=>{e.getValue(c).set(d)}),e.render(),Lv&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function zoe(e,t,n,r){return Loe(t)?Voe(e,t,n,r):{target:t,transitionEnd:r}}const Uoe=(e,t,n,r)=>{const i=Noe(e,t,r);return t=i.target,r=i.transitionEnd,zoe(e,t,n,r)},kw={current:null},bN={current:!1};function Goe(){if(bN.current=!0,!!Lv)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>kw.current=e.matches;e.addListener(t),t()}else kw.current=!1}function Hoe(e,t,n){const{willChange:r}=t;for(const i in t){const o=t[i],s=n[i];if(Rr(o))e.addValue(i,o),Iy(r)&&r.add(i);else if(Rr(s))e.addValue(i,kc(o,{owner:e})),Iy(r)&&r.remove(i);else if(s!==o)if(e.hasValue(i)){const a=e.getValue(i);!a.hasAnimated&&a.set(o)}else{const a=e.getStaticValue(i);e.addValue(i,kc(a!==void 0?a:o,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const d6=new WeakMap,SN=Object.keys(sh),qoe=SN.length,f6=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Woe=E5.length;class Koe{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>Pt.render(this.render,!1,!0);const{latestValues:a,renderState:l}=o;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=s,this.isControllingVariants=Fv(n),this.isVariantNode=oM(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(n,{});for(const d in c){const f=c[d];a[d]!==void 0&&Rr(f)&&(f.set(a[d],!1),Iy(u)&&u.add(d))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,d6.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),bN.current||Goe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:kw.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){d6.delete(this.current),this.projection&&this.projection.unmount(),fs(this.notifyUpdate),fs(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,n){const r=Fl.has(t),i=n.on("change",s=>{this.latestValues[t]=s,this.props.onUpdate&&Pt.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{i(),o()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...n},r,i,o){let s,a;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:f,layoutRoot:h})}return a}updateFeatures(){for(const t in this.features){const n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Jt()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}makeTargetAnimatable(t,n=!0){return this.makeTargetAnimatableFromInstance(t,this.props,n)}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){n!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,n)),this.values.set(t,n),this.latestValues[t]=n.get()}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=kc(n,{owner:this}),this.addValue(t,r)),r}readValue(t){var n;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(n=this.getBaseTargetFromProps(this.props,t))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props,i=typeof r=="string"||typeof r=="object"?(n=D5(this.props,r))===null||n===void 0?void 0:n[t]:void 0;if(r&&i!==void 0)return i;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!Rr(o)?o:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new G5),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class _N extends Koe{sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:n,...r},{transformValues:i},o){let s=fie(r,t||{},this);if(i&&(n&&(n=i(n)),r&&(r=i(r)),s&&(s=i(s))),o){cie(this,r,s);const a=Uoe(this,r,s,n);n=a.transitionEnd,r=a.target}return{transition:t,transitionEnd:n,...r}}}function Yoe(e){return window.getComputedStyle(e)}class Xoe extends _N{readValueFromInstance(t,n){if(Fl.has(n)){const r=j5(n);return r&&r.default||0}else{const r=Yoe(t),i=(uM(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return cN(t,n)}build(t,n,r,i){A5(t,n,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,n){return N5(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Rr(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,i){gM(t,n,r,i)}}class Qoe extends _N{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Fl.has(n)){const r=j5(n);return r&&r.default||0}return n=mM.has(n)?n:M5(n),t.getAttribute(n)}measureInstanceViewportBox(){return Jt()}scrapeMotionValuesFromProps(t,n){return vM(t,n)}build(t,n,r,i){R5(t,n,r,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,r,i){yM(t,n,r,i)}mount(t){this.isSVGTag=I5(t.tagName),super.mount(t)}}const Zoe=(e,t)=>k5(e)?new Qoe(t,{enableHardwareAcceleration:!1}):new Xoe(t,{enableHardwareAcceleration:!0}),Joe={layout:{ProjectionNode:yN,MeasureLayout:dN}},ese={...Eie,...Wne,...Roe,...Joe},H5=nne((e,t)=>Rne(e,t,ese,Zoe));function wN(){const e=E.useRef(!1);return Ty(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function tse(){const e=wN(),[t,n]=E.useState(0),r=E.useCallback(()=>{e.current&&n(t+1)},[t]);return[E.useCallback(()=>Pt.postRender(r),[r]),t]}class nse extends E.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function rse({children:e,isPresent:t}){const n=E.useId(),r=E.useRef(null),i=E.useRef({width:0,height:0,top:0,left:0});return E.useInsertionEffect(()=>{const{width:o,height:s,top:a,left:l}=i.current;if(t||!r.current||!o||!s)return;r.current.dataset.motionPopId=n;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` - [data-motion-pop-id="${n}"] { - position: absolute !important; - width: ${o}px !important; - height: ${s}px !important; - top: ${a}px !important; - left: ${l}px !important; - } - `),()=>{document.head.removeChild(u)}},[t]),E.createElement(nse,{isPresent:t,childRef:r,sizeRef:i},E.cloneElement(e,{ref:r}))}const JS=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:s})=>{const a=bM(ise),l=E.useId(),u=E.useMemo(()=>({id:l,initial:t,isPresent:n,custom:i,onExitComplete:c=>{a.set(c,!0);for(const d of a.values())if(!d)return;r&&r()},register:c=>(a.set(c,!1),()=>a.delete(c))}),o?void 0:[n]);return E.useMemo(()=>{a.forEach((c,d)=>a.set(d,!1))},[n]),E.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),s==="popLayout"&&(e=E.createElement(rse,{isPresent:n},e)),E.createElement(fp.Provider,{value:u},e)};function ise(){return new Map}function ose(e){return E.useEffect(()=>()=>e(),[])}const bu=e=>e.key||"";function sse(e,t){e.forEach(n=>{const r=bu(n);t.set(r,n)})}function ase(e){const t=[];return E.Children.forEach(e,n=>{E.isValidElement(n)&&t.push(n)}),t}const q5=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:o=!0,mode:s="sync"})=>{const a=E.useContext(P5).forceRender||tse()[0],l=wN(),u=ase(e);let c=u;const d=E.useRef(new Map).current,f=E.useRef(c),h=E.useRef(new Map).current,p=E.useRef(!0);if(Ty(()=>{p.current=!1,sse(u,h),f.current=c}),ose(()=>{p.current=!0,h.clear(),d.clear()}),p.current)return E.createElement(E.Fragment,null,c.map(y=>E.createElement(JS,{key:bu(y),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:s},y)));c=[...c];const g=f.current.map(bu),S=u.map(bu),v=g.length;for(let y=0;y{if(S.indexOf(m)!==-1)return;const b=h.get(m);if(!b)return;const _=g.indexOf(m);let w=y;if(!w){const x=()=>{h.delete(m),d.delete(m);const C=f.current.findIndex(k=>k.key===m);if(f.current.splice(C,1),!d.size){if(f.current=u,l.current===!1)return;a(),r&&r()}};w=E.createElement(JS,{key:bu(b),isPresent:!1,onExitComplete:x,custom:t,presenceAffectsLayout:o,mode:s},b),d.set(m,w)}c.splice(_,0,w)}),c=c.map(y=>{const m=y.key;return d.has(m)?y:E.createElement(JS,{key:bu(y),isPresent:!0,presenceAffectsLayout:o,mode:s},y)}),E.createElement(E.Fragment,null,d.size?c:c.map(y=>E.cloneElement(y)))};var lse={initial:e=>{const{position:t}=e,n=["top","bottom"].includes(t)?"y":"x";let r=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(r=1),{opacity:0,[n]:r*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},xN=E.memo(e=>{const{id:t,message:n,onCloseComplete:r,onRequestRemove:i,requestClose:o=!1,position:s="bottom",duration:a=5e3,containerStyle:l,motionVariants:u=lse,toastSpacing:c="0.5rem"}=e,[d,f]=E.useState(a),h=Yie();Cy(()=>{h||r==null||r()},[h]),Cy(()=>{f(a)},[a]);const p=()=>f(null),g=()=>f(a),S=()=>{h&&i()};E.useEffect(()=>{h&&o&&i()},[h,o,i]),Wte(S,d);const v=E.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:c,...l}),[l,c]),y=E.useMemo(()=>Hte(s),[s]);return j.jsx(H5.div,{layout:!0,className:"chakra-toast",variants:u,initial:"initial",animate:"animate",exit:"exit",onHoverStart:p,onHoverEnd:g,custom:{position:s},style:y,children:j.jsx(ke.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:v,children:ao(n,{id:t,onClose:S})})})});xN.displayName="ToastComponent";function use(e,t){var n;const r=e??"bottom",o={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[r];return(n=o==null?void 0:o[t])!=null?n:r}var h6={path:j.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[j.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),j.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),j.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},jl=Qe((e,t)=>{const{as:n,viewBox:r,color:i="currentColor",focusable:o=!1,children:s,className:a,__css:l,...u}=e,c=Un("chakra-icon",a),d=$l("Icon",e),f={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:i,...l,...d},h={ref:t,focusable:o,className:c,__css:f},p=r??h6.viewBox;if(n&&typeof n!="string")return j.jsx(ke.svg,{as:n,...h,...u});const g=s??h6.path;return j.jsx(ke.svg,{verticalAlign:"middle",viewBox:p,...h,...u,children:g})});jl.displayName="Icon";function cse(e){return j.jsx(jl,{viewBox:"0 0 24 24",...e,children:j.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function dse(e){return j.jsx(jl,{viewBox:"0 0 24 24",...e,children:j.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function p6(e){return j.jsx(jl,{viewBox:"0 0 24 24",...e,children:j.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var fse=OJ({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),zv=Qe((e,t)=>{const n=$l("Spinner",e),{label:r="Loading...",thickness:i="2px",speed:o="0.45s",emptyColor:s="transparent",className:a,...l}=Ao(e),u=Un("chakra-spinner",a),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:s,borderLeftColor:s,animation:`${fse} ${o} linear infinite`,...n};return j.jsx(ke.div,{ref:t,__css:c,className:u,...l,children:r&&j.jsx(ke.span,{srOnly:!0,children:r})})});zv.displayName="Spinner";var[hse,W5]=bi({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[pse,K5]=bi({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),CN={info:{icon:dse,colorScheme:"blue"},warning:{icon:p6,colorScheme:"orange"},success:{icon:cse,colorScheme:"green"},error:{icon:p6,colorScheme:"red"},loading:{icon:zv,colorScheme:"blue"}};function gse(e){return CN[e].colorScheme}function mse(e){return CN[e].icon}var TN=Qe(function(t,n){const r=K5(),{status:i}=W5(),o={display:"inline",...r.description};return j.jsx(ke.div,{ref:n,"data-status":i,...t,className:Un("chakra-alert__desc",t.className),__css:o})});TN.displayName="AlertDescription";function EN(e){const{status:t}=W5(),n=mse(t),r=K5(),i=t==="loading"?r.spinner:r.icon;return j.jsx(ke.span,{display:"inherit","data-status":t,...e,className:Un("chakra-alert__icon",e.className),__css:i,children:e.children||j.jsx(n,{h:"100%",w:"100%"})})}EN.displayName="AlertIcon";var PN=Qe(function(t,n){const r=K5(),{status:i}=W5();return j.jsx(ke.div,{ref:n,"data-status":i,...t,className:Un("chakra-alert__title",t.className),__css:r.title})});PN.displayName="AlertTitle";var kN=Qe(function(t,n){var r;const{status:i="info",addRole:o=!0,...s}=Ao(t),a=(r=t.colorScheme)!=null?r:gse(i),l=Nv("Alert",{...t,colorScheme:a}),u={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return j.jsx(hse,{value:{status:i},children:j.jsx(pse,{value:l,children:j.jsx(ke.div,{"data-status":i,role:o?"alert":void 0,ref:n,...s,className:Un("chakra-alert",t.className),__css:u})})})});kN.displayName="Alert";function yse(e){return j.jsx(jl,{focusable:"false","aria-hidden":!0,...e,children:j.jsx("path",{fill:"currentColor",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"})})}var AN=Qe(function(t,n){const r=$l("CloseButton",t),{children:i,isDisabled:o,__css:s,...a}=Ao(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return j.jsx(ke.button,{type:"button","aria-label":"Close",ref:n,disabled:o,__css:{...l,...r,...s},...a,children:i||j.jsx(yse,{width:"1em",height:"1em"})})});AN.displayName="CloseButton";var vse={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},no=bse(vse);function bse(e){let t=e;const n=new Set,r=i=>{t=i(t),n.forEach(o=>o())};return{getState:()=>t,subscribe:i=>(n.add(i),()=>{r(()=>e),n.delete(i)}),removeToast:(i,o)=>{r(s=>({...s,[o]:s[o].filter(a=>a.id!=i)}))},notify:(i,o)=>{const s=Sse(i,o),{position:a,id:l}=s;return r(u=>{var c,d;const h=a.includes("top")?[s,...(c=u[a])!=null?c:[]]:[...(d=u[a])!=null?d:[],s];return{...u,[a]:h}}),l},update:(i,o)=>{i&&r(s=>{const a={...s},{position:l,index:u}=cP(a,i);return l&&u!==-1&&(a[l][u]={...a[l][u],...o,message:ON(o)}),a})},closeAll:({positions:i}={})=>{r(o=>(i??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,u)=>(l[u]=o[u].map(c=>({...c,requestClose:!0})),l),{...o}))},close:i=>{r(o=>{const s=nM(o,i);return s?{...o,[s]:o[s].map(a=>a.id==i?{...a,requestClose:!0}:a)}:o})},isActive:i=>!!cP(no.getState(),i).position}}var g6=0;function Sse(e,t={}){var n,r;g6+=1;const i=(n=t.id)!=null?n:g6,o=(r=t.position)!=null?r:"bottom";return{id:i,message:e,position:o,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>no.removeToast(String(i),o),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var _se=e=>{const{status:t,variant:n="solid",id:r,title:i,isClosable:o,onClose:s,description:a,colorScheme:l,icon:u}=e,c=r?{root:`toast-${r}`,title:`toast-${r}-title`,description:`toast-${r}-description`}:void 0;return j.jsxs(kN,{addRole:!1,status:t,variant:n,id:c==null?void 0:c.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[j.jsx(EN,{children:u}),j.jsxs(ke.div,{flex:"1",maxWidth:"100%",children:[i&&j.jsx(PN,{id:c==null?void 0:c.title,children:i}),a&&j.jsx(TN,{id:c==null?void 0:c.description,display:"block",children:a})]}),o&&j.jsx(AN,{size:"sm",onClick:s,position:"absolute",insetEnd:1,top:1})]})};function ON(e={}){const{render:t,toastComponent:n=_se}=e;return i=>typeof t=="function"?t({...i,...e}):j.jsx(n,{...i,...e})}function wse(e,t){const n=i=>{var o;return{...t,...i,position:use((o=i==null?void 0:i.position)!=null?o:t==null?void 0:t.position,e)}},r=i=>{const o=n(i),s=ON(o);return no.notify(s,o)};return r.update=(i,o)=>{no.update(i,n(o))},r.promise=(i,o)=>{const s=r({...o.loading,status:"loading",duration:null});i.then(a=>r.update(s,{status:"success",duration:5e3,...ao(o.success,a)})).catch(a=>r.update(s,{status:"error",duration:5e3,...ao(o.error,a)}))},r.closeAll=no.closeAll,r.close=no.close,r.isActive=no.isActive,r}var[aEe,xse]=bi({name:"ToastOptionsContext",strict:!1}),lEe=e=>{const t=E.useSyncExternalStore(no.subscribe,no.getState,no.getState),{motionVariants:n,component:r=xN,portalProps:i}=e,s=Object.keys(t).map(a=>{const l=t[a];return j.jsx("div",{role:"region","aria-live":"polite",id:`chakra-toast-manager-${a}`,style:qte(a),children:j.jsx(q5,{initial:!1,children:l.map(u=>j.jsx(r,{motionVariants:n,...u},u.id))})},a)});return j.jsx(cp,{...i,children:s})};function Cse(e){const{theme:t}=U7(),n=xse();return E.useMemo(()=>wse(t.direction,{...n,...e}),[e,t.direction,n])}function Tse(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 di(...e){return t=>{e.forEach(n=>{Tse(n,t)})}}function Ese(...e){return E.useMemo(()=>di(...e),e)}function Pse(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:i=(f,h)=>f!==h}=e,o=Fn(r),s=Fn(i),[a,l]=E.useState(n),u=t!==void 0,c=u?t:a,d=Fn(f=>{const p=typeof f=="function"?f(c):f;s(c,p)&&(u||l(p),o(p))},[u,o,c,s]);return[c,d]}var Aw=Qe(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:o,...s}=t;return j.jsx("img",{width:r,height:i,ref:n,alt:o,...s})});Aw.displayName="NativeImage";function kse(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:o,crossOrigin:s,sizes:a,ignoreFallback:l}=e,[u,c]=E.useState("pending");E.useEffect(()=>{c(n?"loading":"pending")},[n]);const d=E.useRef(),f=E.useCallback(()=>{if(!n)return;h();const p=new Image;p.src=n,s&&(p.crossOrigin=s),r&&(p.srcset=r),a&&(p.sizes=a),t&&(p.loading=t),p.onload=g=>{h(),c("loaded"),i==null||i(g)},p.onerror=g=>{h(),c("failed"),o==null||o(g)},d.current=p},[n,s,r,a,i,o,t]),h=()=>{d.current&&(d.current.onload=null,d.current.onerror=null,d.current=null)};return rh(()=>{if(!l)return u==="loading"&&f(),()=>{h()}},[u,f,l]),l?"loaded":u}var Ase=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function Ose(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var Y5=Qe(function(t,n){const{fallbackSrc:r,fallback:i,src:o,srcSet:s,align:a,fit:l,loading:u,ignoreFallback:c,crossOrigin:d,fallbackStrategy:f="beforeLoadOrError",referrerPolicy:h,...p}=t,g=r!==void 0||i!==void 0,S=u!=null||c||!g,v=kse({...t,crossOrigin:d,ignoreFallback:S}),y=Ase(v,f),m={ref:n,objectFit:l,objectPosition:a,...S?p:Ose(p,["onError","onLoad"])};return y?i||j.jsx(ke.img,{as:Aw,className:"chakra-image__placeholder",src:r,...m}):j.jsx(ke.img,{as:Aw,src:o,srcSet:s,crossOrigin:d,loading:u,referrerPolicy:h,className:"chakra-image",...m})});Y5.displayName="Image";function Rse(e){return E.Children.toArray(e).filter(t=>E.isValidElement(t))}var[uEe,Ise]=bi({strict:!1,name:"ButtonGroupContext"});function Mse(e){const[t,n]=E.useState(!e);return{ref:E.useCallback(o=>{o&&n(o.tagName==="BUTTON")},[]),type:t?"button":void 0}}function Ow(e){const{children:t,className:n,...r}=e,i=E.isValidElement(t)?E.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,o=Un("chakra-button__icon",n);return j.jsx(ke.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:o,children:i})}Ow.displayName="ButtonIcon";function Rw(e){const{label:t,placement:n,spacing:r="0.5rem",children:i=j.jsx(zv,{color:"currentColor",width:"1em",height:"1em"}),className:o,__css:s,...a}=e,l=Un("chakra-button__spinner",o),u=n==="start"?"marginEnd":"marginStart",c=E.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[u]:t?r:0,fontSize:"1em",lineHeight:"normal",...s}),[s,t,u,r]);return j.jsx(ke.div,{className:l,...a,__css:c,children:i})}Rw.displayName="ButtonSpinner";var RN=Qe((e,t)=>{const n=Ise(),r=$l("Button",{...n,...e}),{isDisabled:i=n==null?void 0:n.isDisabled,isLoading:o,isActive:s,children:a,leftIcon:l,rightIcon:u,loadingText:c,iconSpacing:d="0.5rem",type:f,spinner:h,spinnerPlacement:p="start",className:g,as:S,...v}=Ao(e),y=E.useMemo(()=>{const w={...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:w}}},[r,n]),{ref:m,type:b}=Mse(S),_={rightIcon:u,leftIcon:l,iconSpacing:d,children:a};return j.jsxs(ke.button,{ref:Ese(t,m),as:S,type:f??b,"data-active":Fu(s),"data-loading":Fu(o),__css:y,className:Un("chakra-button",g),...v,disabled:i||o,children:[o&&p==="start"&&j.jsx(Rw,{className:"chakra-button__spinner--start",label:c,placement:"start",spacing:d,children:h}),o?c||j.jsx(ke.span,{opacity:0,children:j.jsx(m6,{..._})}):j.jsx(m6,{..._}),o&&p==="end"&&j.jsx(Rw,{className:"chakra-button__spinner--end",label:c,placement:"end",spacing:d,children:h})]})});RN.displayName="Button";function m6(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:i}=e;return j.jsxs(j.Fragment,{children:[t&&j.jsx(Ow,{marginEnd:i,children:t}),r,n&&j.jsx(Ow,{marginStart:i,children:n})]})}var IN=Qe((e,t)=>{const{icon:n,children:r,isRound:i,"aria-label":o,...s}=e,a=n||r,l=E.isValidElement(a)?E.cloneElement(a,{"aria-hidden":!0,focusable:!1}):null;return j.jsx(RN,{padding:"0",borderRadius:i?"full":void 0,ref:t,"aria-label":o,...s,children:l})});IN.displayName="IconButton";var[Nse,MN]=bi({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Dse,Uv]=bi({strict:!1,name:"FormControlContext"});function Lse(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:i,isReadOnly:o,...s}=e,a=E.useId(),l=t||`field-${a}`,u=`${l}-label`,c=`${l}-feedback`,d=`${l}-helptext`,[f,h]=E.useState(!1),[p,g]=E.useState(!1),[S,v]=E.useState(!1),y=E.useCallback((x={},C=null)=>({id:d,...x,ref:di(C,k=>{k&&g(!0)})}),[d]),m=E.useCallback((x={},C=null)=>({...x,ref:C,"data-focus":Fu(S),"data-disabled":Fu(i),"data-invalid":Fu(r),"data-readonly":Fu(o),id:x.id!==void 0?x.id:u,htmlFor:x.htmlFor!==void 0?x.htmlFor:l}),[l,i,S,r,o,u]),b=E.useCallback((x={},C=null)=>({id:c,...x,ref:di(C,k=>{k&&h(!0)}),"aria-live":"polite"}),[c]),_=E.useCallback((x={},C=null)=>({...x,...s,ref:C,role:"group"}),[s]),w=E.useCallback((x={},C=null)=>({...x,ref:C,role:"presentation","aria-hidden":!0,children:x.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!o,isDisabled:!!i,isFocused:!!S,onFocus:()=>v(!0),onBlur:()=>v(!1),hasFeedbackText:f,setHasFeedbackText:h,hasHelpText:p,setHasHelpText:g,id:l,labelId:u,feedbackId:c,helpTextId:d,htmlProps:s,getHelpTextProps:y,getErrorMessageProps:b,getRootProps:_,getLabelProps:m,getRequiredIndicatorProps:w}}var NN=Qe(function(t,n){const r=Nv("Form",t),i=Ao(t),{getRootProps:o,htmlProps:s,...a}=Lse(i),l=Un("chakra-form-control",t.className);return j.jsx(Dse,{value:a,children:j.jsx(Nse,{value:r,children:j.jsx(ke.div,{...o({},n),className:l,__css:r.container})})})});NN.displayName="FormControl";var $se=Qe(function(t,n){const r=Uv(),i=MN(),o=Un("chakra-form__helper-text",t.className);return j.jsx(ke.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:i.helperText,className:o})});$se.displayName="FormHelperText";var DN=Qe(function(t,n){var r;const i=$l("FormLabel",t),o=Ao(t),{className:s,children:a,requiredIndicator:l=j.jsx(LN,{}),optionalIndicator:u=null,...c}=o,d=Uv(),f=(r=d==null?void 0:d.getLabelProps(c,n))!=null?r:{ref:n,...c};return j.jsxs(ke.label,{...f,className:Un("chakra-form__label",o.className),__css:{display:"block",textAlign:"start",...i},children:[a,d!=null&&d.isRequired?l:u]})});DN.displayName="FormLabel";var LN=Qe(function(t,n){const r=Uv(),i=MN();if(!(r!=null&&r.isRequired))return null;const o=Un("chakra-form__required-indicator",t.className);return j.jsx(ke.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:i.requiredIndicator,className:o})});LN.displayName="RequiredIndicator";function cEe(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:i,...o}=$N(e);return{...o,disabled:t,readOnly:r,required:i,"aria-invalid":rc(n),"aria-required":rc(i),"aria-readonly":rc(r)}}function $N(e){var t,n,r;const i=Uv(),{id:o,disabled:s,readOnly:a,required:l,isRequired:u,isInvalid:c,isReadOnly:d,isDisabled:f,onFocus:h,onBlur:p,...g}=e,S=e["aria-describedby"]?[e["aria-describedby"]]:[];return i!=null&&i.hasFeedbackText&&(i!=null&&i.isInvalid)&&S.push(i.feedbackId),i!=null&&i.hasHelpText&&S.push(i.helpTextId),{...g,"aria-describedby":S.join(" ")||void 0,id:o??(i==null?void 0:i.id),isDisabled:(t=s??f)!=null?t:i==null?void 0:i.isDisabled,isReadOnly:(n=a??d)!=null?n:i==null?void 0:i.isReadOnly,isRequired:(r=l??u)!=null?r:i==null?void 0:i.isRequired,isInvalid:c??(i==null?void 0:i.isInvalid),onFocus:Dn(i==null?void 0:i.onFocus,h),onBlur:Dn(i==null?void 0:i.onBlur,p)}}function Fse(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function X5(e,t){let n=Fse(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function Iw(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 y6(e,t,n){return(e-t)*100/(n-t)}function Bse(e,t,n){return(n-t)*e+t}function v6(e,t,n){const r=Math.round((e-t)/n)*n+t,i=Iw(n);return X5(r,i)}function mm(e,t,n){return e==null?e:(n{var P;return r==null?"":(P=e_(r,o,n))!=null?P:""}),f=typeof i<"u",h=f?i:c,p=FN(Ms(h),o),g=n??p,S=E.useCallback(P=>{P!==h&&(f||d(P.toString()),u==null||u(P.toString(),Ms(P)))},[u,f,h]),v=E.useCallback(P=>{let A=P;return l&&(A=mm(A,s,a)),X5(A,g)},[g,l,a,s]),y=E.useCallback((P=o)=>{let A;h===""?A=Ms(P):A=Ms(h)+P,A=v(A),S(A)},[v,o,S,h]),m=E.useCallback((P=o)=>{let A;h===""?A=Ms(-P):A=Ms(h)-P,A=v(A),S(A)},[v,o,S,h]),b=E.useCallback(()=>{var P;let A;r==null?A="":A=(P=e_(r,o,n))!=null?P:s,S(A)},[r,n,o,S,s]),_=E.useCallback(P=>{var A;const $=(A=e_(P,o,g))!=null?A:s;S($)},[g,o,S,s]),w=Ms(h);return{isOutOfRange:w>a||w{const o=typeof e=="function"?e():e??document;if(!(!n||!o))return o.addEventListener(t,i,r),()=>{o.removeEventListener(t,i,r)}},[t,e,r,i,n]),()=>{const o=typeof e=="function"?e():e??document;o==null||o.removeEventListener(t,i,r)}}function BN(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Vse(e){var t;if(!BN(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function dEe(e){var t,n;return(n=(t=jN(e))==null?void 0:t.defaultView)!=null?n:window}function jN(e){return BN(e)?e.ownerDocument:document}function fEe(e){return jN(e).activeElement}function zse(e){const t=e.ownerDocument.defaultView||window,{overflow:n,overflowX:r,overflowY:i}=t.getComputedStyle(e);return/auto|scroll|overlay|hidden/.test(n+i+r)}function Use(e){return e.localName==="html"?e:e.assignedSlot||e.parentElement||e.ownerDocument.documentElement}function VN(e){return["html","body","#document"].includes(e.localName)?e.ownerDocument.body:Vse(e)&&zse(e)?e:VN(Use(e))}var Gse=ute?E.useLayoutEffect:E.useEffect;function b6(e,t=[]){const n=E.useRef(e);return Gse(()=>{n.current=e}),E.useCallback((...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},t)}function Hse(e,t){const n=E.useId();return E.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function qse(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function zN(e={}){const{onClose:t,onOpen:n,isOpen:r,id:i}=e,o=b6(n),s=b6(t),[a,l]=E.useState(e.defaultIsOpen||!1),[u,c]=qse(r,a),d=Hse(i,"disclosure"),f=E.useCallback(()=>{u||l(!1),s==null||s()},[u,s]),h=E.useCallback(()=>{u||l(!0),o==null||o()},[u,o]),p=E.useCallback(()=>{(c?f:h)()},[c,h,f]);return{isOpen:!!c,onOpen:h,onClose:f,onToggle:p,isControlled:u,getButtonProps:(g={})=>({...g,"aria-expanded":c,"aria-controls":d,onClick:mte(g.onClick,p)}),getDisclosureProps:(g={})=>({...g,hidden:!c,id:d})}}function Wse(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):yo(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var UN=e=>j.jsx(ke.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});UN.displayName="StackItem";function Kse(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{"&":Wse(n,i=>r[i])}}var GN=Qe((e,t)=>{const{isInline:n,direction:r,align:i,justify:o,spacing:s="0.5rem",wrap:a,children:l,divider:u,className:c,shouldWrapChildren:d,...f}=e,h=n?"row":r??"column",p=E.useMemo(()=>Kse({spacing:s,direction:h}),[s,h]),g=!!u,S=!d&&!g,v=E.useMemo(()=>{const m=Rse(l);return S?m:m.map((b,_)=>{const w=typeof b.key<"u"?b.key:_,x=_+1===m.length,k=d?j.jsx(UN,{children:b},w):b;if(!g)return k;const P=E.cloneElement(u,{__css:p}),A=x?null:P;return j.jsxs(E.Fragment,{children:[k,A]},w)})},[u,p,g,S,d,l]),y=Un("chakra-stack",c);return j.jsx(ke.div,{ref:t,display:"flex",alignItems:i,justifyContent:o,flexDirection:h,flexWrap:a,gap:g?void 0:s,className:y,...f,children:v})});GN.displayName="Stack";var HN=Qe((e,t)=>j.jsx(GN,{align:"center",...e,direction:"row",ref:t}));HN.displayName="HStack";var Mw=Qe(function(t,n){const r=$l("Heading",t),{className:i,...o}=Ao(t);return j.jsx(ke.h2,{ref:n,className:Un("chakra-heading",t.className),...o,__css:r})});Mw.displayName="Heading";var Q5=ke("div");Q5.displayName="Box";var qN=Qe(function(t,n){const{size:r,centerContent:i=!0,...o}=t,s=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return j.jsx(Q5,{ref:n,boxSize:r,__css:{...s,flexShrink:0,flexGrow:0},...o})});qN.displayName="Square";var Yse=Qe(function(t,n){const{size:r,...i}=t;return j.jsx(qN,{size:r,ref:n,borderRadius:"9999px",...i})});Yse.displayName="Circle";var Z5=Qe(function(t,n){const{direction:r,align:i,justify:o,wrap:s,basis:a,grow:l,shrink:u,...c}=t,d={display:"flex",flexDirection:r,alignItems:i,justifyContent:o,flexWrap:s,flexBasis:a,flexGrow:l,flexShrink:u};return j.jsx(ke.div,{ref:n,__css:d,...c})});Z5.displayName="Flex";var iu=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),$n={arrowShadowColor:iu("--popper-arrow-shadow-color"),arrowSize:iu("--popper-arrow-size","8px"),arrowSizeHalf:iu("--popper-arrow-size-half"),arrowBg:iu("--popper-arrow-bg"),transformOrigin:iu("--popper-transform-origin"),arrowOffset:iu("--popper-arrow-offset")};function Xse(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 Qse={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"},Zse=e=>Qse[e],S6={scroll:!0,resize:!0};function Jse(e){let t;return typeof e=="object"?t={enabled:!0,options:{...S6,...e}}:t={enabled:e,options:S6},t}var eae={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`}},tae={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{_6(e)},effect:({state:e})=>()=>{_6(e)}},_6=e=>{e.elements.popper.style.setProperty($n.transformOrigin.var,Zse(e.placement))},nae={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{rae(e)}},rae=e=>{var t;if(!e.placement)return;const n=iae(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:$n.arrowSize.varRef,height:$n.arrowSize.varRef,zIndex:-1});const r={[$n.arrowSizeHalf.var]:`calc(${$n.arrowSize.varRef} / 2 - 1px)`,[$n.arrowOffset.var]:`calc(${$n.arrowSizeHalf.varRef} * -1)`};for(const i in r)e.elements.arrow.style.setProperty(i,r[i])}},iae=e=>{if(e.startsWith("top"))return{property:"bottom",value:$n.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:$n.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:$n.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:$n.arrowOffset.varRef}},oae={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{w6(e)},effect:({state:e})=>()=>{w6(e)}},w6=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=Xse(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:$n.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},sae={"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"}},aae={"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 lae(e,t="ltr"){var n,r;const i=((n=sae[e])==null?void 0:n[t])||e;return t==="ltr"?i:(r=aae[e])!=null?r:i}var Pr="top",mi="bottom",yi="right",kr="left",J5="auto",yp=[Pr,mi,yi,kr],Oc="start",lh="end",uae="clippingParents",WN="viewport",Pd="popper",cae="reference",x6=yp.reduce(function(e,t){return e.concat([t+"-"+Oc,t+"-"+lh])},[]),KN=[].concat(yp,[J5]).reduce(function(e,t){return e.concat([t,t+"-"+Oc,t+"-"+lh])},[]),dae="beforeRead",fae="read",hae="afterRead",pae="beforeMain",gae="main",mae="afterMain",yae="beforeWrite",vae="write",bae="afterWrite",Sae=[dae,fae,hae,pae,gae,mae,yae,vae,bae];function _o(e){return e?(e.nodeName||"").toLowerCase():null}function Gr(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function xl(e){var t=Gr(e).Element;return e instanceof t||e instanceof Element}function fi(e){var t=Gr(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function e3(e){if(typeof ShadowRoot>"u")return!1;var t=Gr(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function _ae(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},i=t.attributes[n]||{},o=t.elements[n];!fi(o)||!_o(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(s){var a=i[s];a===!1?o.removeAttribute(s):o.setAttribute(s,a===!0?"":a)}))})}function wae(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 i=t.elements[r],o=t.attributes[r]||{},s=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),a=s.reduce(function(l,u){return l[u]="",l},{});!fi(i)||!_o(i)||(Object.assign(i.style,a),Object.keys(o).forEach(function(l){i.removeAttribute(l)}))})}}const xae={name:"applyStyles",enabled:!0,phase:"write",fn:_ae,effect:wae,requires:["computeStyles"]};function bo(e){return e.split("-")[0]}var cl=Math.max,Ny=Math.min,Rc=Math.round;function Nw(){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 YN(){return!/^((?!chrome|android).)*safari/i.test(Nw())}function Ic(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,o=1;t&&fi(e)&&(i=e.offsetWidth>0&&Rc(r.width)/e.offsetWidth||1,o=e.offsetHeight>0&&Rc(r.height)/e.offsetHeight||1);var s=xl(e)?Gr(e):window,a=s.visualViewport,l=!YN()&&n,u=(r.left+(l&&a?a.offsetLeft:0))/i,c=(r.top+(l&&a?a.offsetTop:0))/o,d=r.width/i,f=r.height/o;return{width:d,height:f,top:c,right:u+d,bottom:c+f,left:u,x:u,y:c}}function t3(e){var t=Ic(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 XN(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&e3(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function hs(e){return Gr(e).getComputedStyle(e)}function Cae(e){return["table","td","th"].indexOf(_o(e))>=0}function Ia(e){return((xl(e)?e.ownerDocument:e.document)||window.document).documentElement}function Gv(e){return _o(e)==="html"?e:e.assignedSlot||e.parentNode||(e3(e)?e.host:null)||Ia(e)}function C6(e){return!fi(e)||hs(e).position==="fixed"?null:e.offsetParent}function Tae(e){var t=/firefox/i.test(Nw()),n=/Trident/i.test(Nw());if(n&&fi(e)){var r=hs(e);if(r.position==="fixed")return null}var i=Gv(e);for(e3(i)&&(i=i.host);fi(i)&&["html","body"].indexOf(_o(i))<0;){var o=hs(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||t&&o.willChange==="filter"||t&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function vp(e){for(var t=Gr(e),n=C6(e);n&&Cae(n)&&hs(n).position==="static";)n=C6(n);return n&&(_o(n)==="html"||_o(n)==="body"&&hs(n).position==="static")?t:n||Tae(e)||t}function n3(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function vf(e,t,n){return cl(e,Ny(t,n))}function Eae(e,t,n){var r=vf(e,t,n);return r>n?n:r}function QN(){return{top:0,right:0,bottom:0,left:0}}function ZN(e){return Object.assign({},QN(),e)}function JN(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var Pae=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,ZN(typeof t!="number"?t:JN(t,yp))};function kae(e){var t,n=e.state,r=e.name,i=e.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,a=bo(n.placement),l=n3(a),u=[kr,yi].indexOf(a)>=0,c=u?"height":"width";if(!(!o||!s)){var d=Pae(i.padding,n),f=t3(o),h=l==="y"?Pr:kr,p=l==="y"?mi:yi,g=n.rects.reference[c]+n.rects.reference[l]-s[l]-n.rects.popper[c],S=s[l]-n.rects.reference[l],v=vp(o),y=v?l==="y"?v.clientHeight||0:v.clientWidth||0:0,m=g/2-S/2,b=d[h],_=y-f[c]-d[p],w=y/2-f[c]/2+m,x=vf(b,w,_),C=l;n.modifiersData[r]=(t={},t[C]=x,t.centerOffset=x-w,t)}}function Aae(e){var t=e.state,n=e.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=t.elements.popper.querySelector(i),!i)||XN(t.elements.popper,i)&&(t.elements.arrow=i))}const Oae={name:"arrow",enabled:!0,phase:"main",fn:kae,effect:Aae,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Mc(e){return e.split("-")[1]}var Rae={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Iae(e,t){var n=e.x,r=e.y,i=t.devicePixelRatio||1;return{x:Rc(n*i)/i||0,y:Rc(r*i)/i||0}}function T6(e){var t,n=e.popper,r=e.popperRect,i=e.placement,o=e.variation,s=e.offsets,a=e.position,l=e.gpuAcceleration,u=e.adaptive,c=e.roundOffsets,d=e.isFixed,f=s.x,h=f===void 0?0:f,p=s.y,g=p===void 0?0:p,S=typeof c=="function"?c({x:h,y:g}):{x:h,y:g};h=S.x,g=S.y;var v=s.hasOwnProperty("x"),y=s.hasOwnProperty("y"),m=kr,b=Pr,_=window;if(u){var w=vp(n),x="clientHeight",C="clientWidth";if(w===Gr(n)&&(w=Ia(n),hs(w).position!=="static"&&a==="absolute"&&(x="scrollHeight",C="scrollWidth")),w=w,i===Pr||(i===kr||i===yi)&&o===lh){b=mi;var k=d&&w===_&&_.visualViewport?_.visualViewport.height:w[x];g-=k-r.height,g*=l?1:-1}if(i===kr||(i===Pr||i===mi)&&o===lh){m=yi;var P=d&&w===_&&_.visualViewport?_.visualViewport.width:w[C];h-=P-r.width,h*=l?1:-1}}var A=Object.assign({position:a},u&&Rae),$=c===!0?Iae({x:h,y:g},Gr(n)):{x:h,y:g};if(h=$.x,g=$.y,l){var N;return Object.assign({},A,(N={},N[b]=y?"0":"",N[m]=v?"0":"",N.transform=(_.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",N))}return Object.assign({},A,(t={},t[b]=y?g+"px":"",t[m]=v?h+"px":"",t.transform="",t))}function Mae(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0?!0:r,o=n.adaptive,s=o===void 0?!0:o,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:bo(t.placement),variation:Mc(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,T6(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,T6(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const Nae={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Mae,data:{}};var vg={passive:!0};function Dae(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,o=i===void 0?!0:i,s=r.resize,a=s===void 0?!0:s,l=Gr(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&u.forEach(function(c){c.addEventListener("scroll",n.update,vg)}),a&&l.addEventListener("resize",n.update,vg),function(){o&&u.forEach(function(c){c.removeEventListener("scroll",n.update,vg)}),a&&l.removeEventListener("resize",n.update,vg)}}const Lae={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Dae,data:{}};var $ae={left:"right",right:"left",bottom:"top",top:"bottom"};function vm(e){return e.replace(/left|right|bottom|top/g,function(t){return $ae[t]})}var Fae={start:"end",end:"start"};function E6(e){return e.replace(/start|end/g,function(t){return Fae[t]})}function r3(e){var t=Gr(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function i3(e){return Ic(Ia(e)).left+r3(e).scrollLeft}function Bae(e,t){var n=Gr(e),r=Ia(e),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;var u=YN();(u||!u&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a+i3(e),y:l}}function jae(e){var t,n=Ia(e),r=r3(e),i=(t=e.ownerDocument)==null?void 0:t.body,o=cl(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=cl(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+i3(e),l=-r.scrollTop;return hs(i||n).direction==="rtl"&&(a+=cl(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}function o3(e){var t=hs(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function eD(e){return["html","body","#document"].indexOf(_o(e))>=0?e.ownerDocument.body:fi(e)&&o3(e)?e:eD(Gv(e))}function bf(e,t){var n;t===void 0&&(t=[]);var r=eD(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),o=Gr(r),s=i?[o].concat(o.visualViewport||[],o3(r)?r:[]):r,a=t.concat(s);return i?a:a.concat(bf(Gv(s)))}function Dw(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Vae(e,t){var n=Ic(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 P6(e,t,n){return t===WN?Dw(Bae(e,n)):xl(t)?Vae(t,n):Dw(jae(Ia(e)))}function zae(e){var t=bf(Gv(e)),n=["absolute","fixed"].indexOf(hs(e).position)>=0,r=n&&fi(e)?vp(e):e;return xl(r)?t.filter(function(i){return xl(i)&&XN(i,r)&&_o(i)!=="body"}):[]}function Uae(e,t,n,r){var i=t==="clippingParents"?zae(e):[].concat(t),o=[].concat(i,[n]),s=o[0],a=o.reduce(function(l,u){var c=P6(e,u,r);return l.top=cl(c.top,l.top),l.right=Ny(c.right,l.right),l.bottom=Ny(c.bottom,l.bottom),l.left=cl(c.left,l.left),l},P6(e,s,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function tD(e){var t=e.reference,n=e.element,r=e.placement,i=r?bo(r):null,o=r?Mc(r):null,s=t.x+t.width/2-n.width/2,a=t.y+t.height/2-n.height/2,l;switch(i){case Pr:l={x:s,y:t.y-n.height};break;case mi:l={x:s,y:t.y+t.height};break;case yi:l={x:t.x+t.width,y:a};break;case kr:l={x:t.x-n.width,y:a};break;default:l={x:t.x,y:t.y}}var u=i?n3(i):null;if(u!=null){var c=u==="y"?"height":"width";switch(o){case Oc:l[u]=l[u]-(t[c]/2-n[c]/2);break;case lh:l[u]=l[u]+(t[c]/2-n[c]/2);break}}return l}function uh(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,o=n.strategy,s=o===void 0?e.strategy:o,a=n.boundary,l=a===void 0?uae:a,u=n.rootBoundary,c=u===void 0?WN:u,d=n.elementContext,f=d===void 0?Pd:d,h=n.altBoundary,p=h===void 0?!1:h,g=n.padding,S=g===void 0?0:g,v=ZN(typeof S!="number"?S:JN(S,yp)),y=f===Pd?cae:Pd,m=e.rects.popper,b=e.elements[p?y:f],_=Uae(xl(b)?b:b.contextElement||Ia(e.elements.popper),l,c,s),w=Ic(e.elements.reference),x=tD({reference:w,element:m,strategy:"absolute",placement:i}),C=Dw(Object.assign({},m,x)),k=f===Pd?C:w,P={top:_.top-k.top+v.top,bottom:k.bottom-_.bottom+v.bottom,left:_.left-k.left+v.left,right:k.right-_.right+v.right},A=e.modifiersData.offset;if(f===Pd&&A){var $=A[i];Object.keys(P).forEach(function(N){var T=[yi,mi].indexOf(N)>=0?1:-1,O=[Pr,mi].indexOf(N)>=0?"y":"x";P[N]+=$[O]*T})}return P}function Gae(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,o=n.rootBoundary,s=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?KN:l,c=Mc(r),d=c?a?x6:x6.filter(function(p){return Mc(p)===c}):yp,f=d.filter(function(p){return u.indexOf(p)>=0});f.length===0&&(f=d);var h=f.reduce(function(p,g){return p[g]=uh(e,{placement:g,boundary:i,rootBoundary:o,padding:s})[bo(g)],p},{});return Object.keys(h).sort(function(p,g){return h[p]-h[g]})}function Hae(e){if(bo(e)===J5)return[];var t=vm(e);return[E6(e),t,E6(t)]}function qae(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,a=s===void 0?!0:s,l=n.fallbackPlacements,u=n.padding,c=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,p=h===void 0?!0:h,g=n.allowedAutoPlacements,S=t.options.placement,v=bo(S),y=v===S,m=l||(y||!p?[vm(S)]:Hae(S)),b=[S].concat(m).reduce(function(K,W){return K.concat(bo(W)===J5?Gae(t,{placement:W,boundary:c,rootBoundary:d,padding:u,flipVariations:p,allowedAutoPlacements:g}):W)},[]),_=t.rects.reference,w=t.rects.popper,x=new Map,C=!0,k=b[0],P=0;P=0,O=T?"width":"height",I=uh(t,{placement:A,boundary:c,rootBoundary:d,altBoundary:f,padding:u}),M=T?N?yi:kr:N?mi:Pr;_[O]>w[O]&&(M=vm(M));var R=vm(M),D=[];if(o&&D.push(I[$]<=0),a&&D.push(I[M]<=0,I[R]<=0),D.every(function(K){return K})){k=A,C=!1;break}x.set(A,D)}if(C)for(var L=p?3:1,V=function(W){var X=b.find(function(F){var q=x.get(F);if(q)return q.slice(0,W).every(function(Q){return Q})});if(X)return k=X,"break"},z=L;z>0;z--){var U=V(z);if(U==="break")break}t.placement!==k&&(t.modifiersData[r]._skip=!0,t.placement=k,t.reset=!0)}}const Wae={name:"flip",enabled:!0,phase:"main",fn:qae,requiresIfExists:["offset"],data:{_skip:!1}};function k6(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 A6(e){return[Pr,yi,mi,kr].some(function(t){return e[t]>=0})}function Kae(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,o=t.modifiersData.preventOverflow,s=uh(t,{elementContext:"reference"}),a=uh(t,{altBoundary:!0}),l=k6(s,r),u=k6(a,i,o),c=A6(l),d=A6(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}const Yae={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Kae};function Xae(e,t,n){var r=bo(e),i=[kr,Pr].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,s=o[0],a=o[1];return s=s||0,a=(a||0)*i,[kr,yi].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function Qae(e){var t=e.state,n=e.options,r=e.name,i=n.offset,o=i===void 0?[0,0]:i,s=KN.reduce(function(c,d){return c[d]=Xae(d,t.rects,o),c},{}),a=s[t.placement],l=a.x,u=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=s}const Zae={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Qae};function Jae(e){var t=e.state,n=e.name;t.modifiersData[n]=tD({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const ele={name:"popperOffsets",enabled:!0,phase:"read",fn:Jae,data:{}};function tle(e){return e==="x"?"y":"x"}function nle(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,a=s===void 0?!1:s,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,d=n.padding,f=n.tether,h=f===void 0?!0:f,p=n.tetherOffset,g=p===void 0?0:p,S=uh(t,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),v=bo(t.placement),y=Mc(t.placement),m=!y,b=n3(v),_=tle(b),w=t.modifiersData.popperOffsets,x=t.rects.reference,C=t.rects.popper,k=typeof g=="function"?g(Object.assign({},t.rects,{placement:t.placement})):g,P=typeof k=="number"?{mainAxis:k,altAxis:k}:Object.assign({mainAxis:0,altAxis:0},k),A=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,$={x:0,y:0};if(w){if(o){var N,T=b==="y"?Pr:kr,O=b==="y"?mi:yi,I=b==="y"?"height":"width",M=w[b],R=M+S[T],D=M-S[O],L=h?-C[I]/2:0,V=y===Oc?x[I]:C[I],z=y===Oc?-C[I]:-x[I],U=t.elements.arrow,K=h&&U?t3(U):{width:0,height:0},W=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:QN(),X=W[T],F=W[O],q=vf(0,x[I],K[I]),Q=m?x[I]/2-L-q-X-P.mainAxis:V-q-X-P.mainAxis,J=m?-x[I]/2+L+q+F+P.mainAxis:z+q+F+P.mainAxis,ne=t.elements.arrow&&vp(t.elements.arrow),Z=ne?b==="y"?ne.clientTop||0:ne.clientLeft||0:0,me=(N=A==null?void 0:A[b])!=null?N:0,ae=M+Q-me-Z,oe=M+J-me,Ce=vf(h?Ny(R,ae):R,M,h?cl(D,oe):D);w[b]=Ce,$[b]=Ce-M}if(a){var se,qe=b==="x"?Pr:kr,yt=b==="x"?mi:yi,$e=w[_],Fe=_==="y"?"height":"width",Ie=$e+S[qe],nt=$e-S[yt],wt=[Pr,kr].indexOf(v)!==-1,vn=(se=A==null?void 0:A[_])!=null?se:0,sn=wt?Ie:$e-x[Fe]-C[Fe]-vn+P.altAxis,At=wt?$e+x[Fe]+C[Fe]-vn-P.altAxis:nt,ee=h&&wt?Eae(sn,$e,At):vf(h?sn:Ie,$e,h?At:nt);w[_]=ee,$[_]=ee-$e}t.modifiersData[r]=$}}const rle={name:"preventOverflow",enabled:!0,phase:"main",fn:nle,requiresIfExists:["offset"]};function ile(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function ole(e){return e===Gr(e)||!fi(e)?r3(e):ile(e)}function sle(e){var t=e.getBoundingClientRect(),n=Rc(t.width)/e.offsetWidth||1,r=Rc(t.height)/e.offsetHeight||1;return n!==1||r!==1}function ale(e,t,n){n===void 0&&(n=!1);var r=fi(t),i=fi(t)&&sle(t),o=Ia(t),s=Ic(e,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((_o(t)!=="body"||o3(o))&&(a=ole(t)),fi(t)?(l=Ic(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):o&&(l.x=i3(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function lle(e){var t=new Map,n=new Set,r=[];e.forEach(function(o){t.set(o.name,o)});function i(o){n.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(a){if(!n.has(a)){var l=t.get(a);l&&i(l)}}),r.push(o)}return e.forEach(function(o){n.has(o.name)||i(o)}),r}function ule(e){var t=lle(e);return Sae.reduce(function(n,r){return n.concat(t.filter(function(i){return i.phase===r}))},[])}function cle(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function dle(e){var t=e.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var O6={placement:"bottom",modifiers:[],strategy:"absolute"};function R6(){for(var e=arguments.length,t=new Array(e),n=0;n{}),m=E.useCallback(()=>{var P;!t||!p.current||!g.current||((P=y.current)==null||P.call(y),S.current=ple(p.current,g.current,{placement:v,modifiers:[oae,nae,tae,{...eae,enabled:!!f},{name:"eventListeners",...Jse(s)},{name:"arrow",options:{padding:o}},{name:"offset",options:{offset:a??[0,l]}},{name:"flip",enabled:!!u,options:{padding:8}},{name:"preventOverflow",enabled:!!d,options:{boundary:c}},...n??[]],strategy:i}),S.current.forceUpdate(),y.current=S.current.destroy)},[v,t,n,f,s,o,a,l,u,d,c,i]);E.useEffect(()=>()=>{var P;!p.current&&!g.current&&((P=S.current)==null||P.destroy(),S.current=null)},[]);const b=E.useCallback(P=>{p.current=P,m()},[m]),_=E.useCallback((P={},A=null)=>({...P,ref:di(b,A)}),[b]),w=E.useCallback(P=>{g.current=P,m()},[m]),x=E.useCallback((P={},A=null)=>({...P,ref:di(w,A),style:{...P.style,position:i,minWidth:f?void 0:"max-content",inset:"0 auto auto 0"}}),[i,w,f]),C=E.useCallback((P={},A=null)=>{const{size:$,shadowColor:N,bg:T,style:O,...I}=P;return{...I,ref:A,"data-popper-arrow":"",style:mle(P)}},[]),k=E.useCallback((P={},A=null)=>({...P,ref:A,"data-popper-arrow-inner":""}),[]);return{update(){var P;(P=S.current)==null||P.update()},forceUpdate(){var P;(P=S.current)==null||P.forceUpdate()},transformOrigin:$n.transformOrigin.varRef,referenceRef:b,popperRef:w,getPopperProps:x,getArrowProps:C,getArrowInnerProps:k,getReferenceProps:_}}function mle(e){const{size:t,shadowColor:n,bg:r,style:i}=e,o={...i,position:"absolute"};return t&&(o["--popper-arrow-size"]=t),n&&(o["--popper-arrow-shadow-color"]=n),r&&(o["--popper-arrow-bg"]=r),o}function yle(e={}){const{onClose:t,onOpen:n,isOpen:r,id:i}=e,o=Fn(n),s=Fn(t),[a,l]=E.useState(e.defaultIsOpen||!1),u=r!==void 0?r:a,c=r!==void 0,d=E.useId(),f=i??`disclosure-${d}`,h=E.useCallback(()=>{c||l(!1),s==null||s()},[c,s]),p=E.useCallback(()=>{c||l(!0),o==null||o()},[c,o]),g=E.useCallback(()=>{u?h():p()},[u,p,h]);function S(y={}){return{...y,"aria-expanded":u,"aria-controls":f,onClick(m){var b;(b=y.onClick)==null||b.call(y,m),g()}}}function v(y={}){return{...y,hidden:!u,id:f}}return{isOpen:u,onOpen:p,onClose:h,onToggle:g,isControlled:c,getButtonProps:S,getDisclosureProps:v}}var vle=e=>j.jsx(jl,{viewBox:"0 0 24 24",...e,children:j.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"})}),ble=e=>j.jsx(jl,{viewBox:"0 0 24 24",...e,children:j.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 I6(e,t,n,r){E.useEffect(()=>{var i;if(!e.current||!r)return;const o=(i=e.current.ownerDocument.defaultView)!=null?i:window,s=Array.isArray(t)?t:[t],a=new o.MutationObserver(l=>{for(const u of l)u.type==="attributes"&&u.attributeName&&s.includes(u.attributeName)&&n(u)});return a.observe(e.current,{attributes:!0,attributeFilter:s}),()=>a.disconnect()})}function Sle(e,t){const n=Fn(e);E.useEffect(()=>{let r=null;const i=()=>n();return t!==null&&(r=window.setInterval(i,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var _le=50,M6=300;function wle(e,t){const[n,r]=E.useState(!1),[i,o]=E.useState(null),[s,a]=E.useState(!0),l=E.useRef(null),u=()=>clearTimeout(l.current);Sle(()=>{i==="increment"&&e(),i==="decrement"&&t()},n?_le:null);const c=E.useCallback(()=>{s&&e(),l.current=setTimeout(()=>{a(!1),r(!0),o("increment")},M6)},[e,s]),d=E.useCallback(()=>{s&&t(),l.current=setTimeout(()=>{a(!1),r(!0),o("decrement")},M6)},[t,s]),f=E.useCallback(()=>{a(!0),r(!1),u()},[]);return E.useEffect(()=>()=>u(),[]),{up:c,down:d,stop:f,isSpinning:n}}var xle=/^[Ee0-9+\-.]$/;function Cle(e){return xle.test(e)}function Tle(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 Ele(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:i=Number.MIN_SAFE_INTEGER,max:o=Number.MAX_SAFE_INTEGER,step:s=1,isReadOnly:a,isDisabled:l,isRequired:u,isInvalid:c,pattern:d="[0-9]*(.[0-9]+)?",inputMode:f="decimal",allowMouseWheel:h,id:p,onChange:g,precision:S,name:v,"aria-describedby":y,"aria-label":m,"aria-labelledby":b,onFocus:_,onBlur:w,onInvalid:x,getAriaValueText:C,isValidCharacter:k,format:P,parse:A,...$}=e,N=Fn(_),T=Fn(w),O=Fn(x),I=Fn(k??Cle),M=Fn(C),R=jse(e),{update:D,increment:L,decrement:V}=R,[z,U]=E.useState(!1),K=!(a||l),W=E.useRef(null),X=E.useRef(null),F=E.useRef(null),q=E.useRef(null),Q=E.useCallback(ee=>ee.split("").filter(I).join(""),[I]),J=E.useCallback(ee=>{var Se;return(Se=A==null?void 0:A(ee))!=null?Se:ee},[A]),ne=E.useCallback(ee=>{var Se;return((Se=P==null?void 0:P(ee))!=null?Se:ee).toString()},[P]);Cy(()=>{(R.valueAsNumber>o||R.valueAsNumber{if(!W.current)return;if(W.current.value!=R.value){const Se=J(W.current.value);R.setValue(Q(Se))}},[J,Q]);const Z=E.useCallback((ee=s)=>{K&&L(ee)},[L,K,s]),me=E.useCallback((ee=s)=>{K&&V(ee)},[V,K,s]),ae=wle(Z,me);I6(F,"disabled",ae.stop,ae.isSpinning),I6(q,"disabled",ae.stop,ae.isSpinning);const oe=E.useCallback(ee=>{if(ee.nativeEvent.isComposing)return;const Te=J(ee.currentTarget.value);D(Q(Te)),X.current={start:ee.currentTarget.selectionStart,end:ee.currentTarget.selectionEnd}},[D,Q,J]),Ce=E.useCallback(ee=>{var Se,Te,Me;N==null||N(ee),X.current&&(ee.target.selectionStart=(Te=X.current.start)!=null?Te:(Se=ee.currentTarget.value)==null?void 0:Se.length,ee.currentTarget.selectionEnd=(Me=X.current.end)!=null?Me:ee.currentTarget.selectionStart)},[N]),se=E.useCallback(ee=>{if(ee.nativeEvent.isComposing)return;Tle(ee,I)||ee.preventDefault();const Se=qe(ee)*s,Te=ee.key,ie={ArrowUp:()=>Z(Se),ArrowDown:()=>me(Se),Home:()=>D(i),End:()=>D(o)}[Te];ie&&(ee.preventDefault(),ie(ee))},[I,s,Z,me,D,i,o]),qe=ee=>{let Se=1;return(ee.metaKey||ee.ctrlKey)&&(Se=.1),ee.shiftKey&&(Se=10),Se},yt=E.useMemo(()=>{const ee=M==null?void 0:M(R.value);if(ee!=null)return ee;const Se=R.value.toString();return Se||void 0},[R.value,M]),$e=E.useCallback(()=>{let ee=R.value;if(R.value==="")return;/^[eE]/.test(R.value.toString())?R.setValue(""):(R.valueAsNumbero&&(ee=o),R.cast(ee))},[R,o,i]),Fe=E.useCallback(()=>{U(!1),n&&$e()},[n,U,$e]),Ie=E.useCallback(()=>{t&&requestAnimationFrame(()=>{var ee;(ee=W.current)==null||ee.focus()})},[t]),nt=E.useCallback(ee=>{ee.preventDefault(),ae.up(),Ie()},[Ie,ae]),wt=E.useCallback(ee=>{ee.preventDefault(),ae.down(),Ie()},[Ie,ae]);ym(()=>W.current,"wheel",ee=>{var Se,Te;const ie=((Te=(Se=W.current)==null?void 0:Se.ownerDocument)!=null?Te:document).activeElement===W.current;if(!h||!ie)return;ee.preventDefault();const pe=qe(ee)*s,Xt=Math.sign(ee.deltaY);Xt===-1?Z(pe):Xt===1&&me(pe)},{passive:!1});const vn=E.useCallback((ee={},Se=null)=>{const Te=l||r&&R.isAtMax;return{...ee,ref:di(Se,F),role:"button",tabIndex:-1,onPointerDown:Dn(ee.onPointerDown,Me=>{Me.button!==0||Te||nt(Me)}),onPointerLeave:Dn(ee.onPointerLeave,ae.stop),onPointerUp:Dn(ee.onPointerUp,ae.stop),disabled:Te,"aria-disabled":rc(Te)}},[R.isAtMax,r,nt,ae.stop,l]),sn=E.useCallback((ee={},Se=null)=>{const Te=l||r&&R.isAtMin;return{...ee,ref:di(Se,q),role:"button",tabIndex:-1,onPointerDown:Dn(ee.onPointerDown,Me=>{Me.button!==0||Te||wt(Me)}),onPointerLeave:Dn(ee.onPointerLeave,ae.stop),onPointerUp:Dn(ee.onPointerUp,ae.stop),disabled:Te,"aria-disabled":rc(Te)}},[R.isAtMin,r,wt,ae.stop,l]),At=E.useCallback((ee={},Se=null)=>{var Te,Me,ie,pe;return{name:v,inputMode:f,type:"text",pattern:d,"aria-labelledby":b,"aria-label":m,"aria-describedby":y,id:p,disabled:l,...ee,readOnly:(Te=ee.readOnly)!=null?Te:a,"aria-readonly":(Me=ee.readOnly)!=null?Me:a,"aria-required":(ie=ee.required)!=null?ie:u,required:(pe=ee.required)!=null?pe:u,ref:di(W,Se),value:ne(R.value),role:"spinbutton","aria-valuemin":i,"aria-valuemax":o,"aria-valuenow":Number.isNaN(R.valueAsNumber)?void 0:R.valueAsNumber,"aria-invalid":rc(c??R.isOutOfRange),"aria-valuetext":yt,autoComplete:"off",autoCorrect:"off",onChange:Dn(ee.onChange,oe),onKeyDown:Dn(ee.onKeyDown,se),onFocus:Dn(ee.onFocus,Ce,()=>U(!0)),onBlur:Dn(ee.onBlur,T,Fe)}},[v,f,d,b,m,ne,y,p,l,u,a,c,R.value,R.valueAsNumber,R.isOutOfRange,i,o,yt,oe,se,Ce,T,Fe]);return{value:ne(R.value),valueAsNumber:R.valueAsNumber,isFocused:z,isDisabled:l,isReadOnly:a,getIncrementButtonProps:vn,getDecrementButtonProps:sn,getInputProps:At,htmlProps:$}}var[Ple,Hv]=bi({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[kle,s3]=bi({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),nD=Qe(function(t,n){const r=Nv("NumberInput",t),i=Ao(t),o=$N(i),{htmlProps:s,...a}=Ele(o),l=E.useMemo(()=>a,[a]);return j.jsx(kle,{value:l,children:j.jsx(Ple,{value:r,children:j.jsx(ke.div,{...s,ref:n,className:Un("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});nD.displayName="NumberInput";var rD=Qe(function(t,n){const r=Hv();return j.jsx(ke.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}})});rD.displayName="NumberInputStepper";var iD=Qe(function(t,n){const{getInputProps:r}=s3(),i=r(t,n),o=Hv();return j.jsx(ke.input,{...i,className:Un("chakra-numberinput__field",t.className),__css:{width:"100%",...o.field}})});iD.displayName="NumberInputField";var oD=ke("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),sD=Qe(function(t,n){var r;const i=Hv(),{getDecrementButtonProps:o}=s3(),s=o(t,n);return j.jsx(oD,{...s,__css:i.stepper,children:(r=t.children)!=null?r:j.jsx(vle,{})})});sD.displayName="NumberDecrementStepper";var aD=Qe(function(t,n){var r;const{getIncrementButtonProps:i}=s3(),o=i(t,n),s=Hv();return j.jsx(oD,{...o,__css:s.stepper,children:(r=t.children)!=null?r:j.jsx(ble,{})})});aD.displayName="NumberIncrementStepper";var ou=e=>e?"":void 0,t_=e=>e?!0:void 0,bp=(...e)=>e.filter(Boolean).join(" ");function n_(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function hEe(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 bg(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var bm={width:0,height:0},Sg=e=>e||bm;function Ale(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:i}=e,o=g=>{var S;const v=(S=r[g])!=null?S:bm;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...bg({orientation:t,vertical:{bottom:`calc(${n[g]}% - ${v.height/2}px)`},horizontal:{left:`calc(${n[g]}% - ${v.width/2}px)`}})}},s=t==="vertical"?r.reduce((g,S)=>Sg(g).height>Sg(S).height?g:S,bm):r.reduce((g,S)=>Sg(g).width>Sg(S).width?g:S,bm),a={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...bg({orientation:t,vertical:s?{paddingLeft:s.width/2,paddingRight:s.width/2}:{},horizontal:s?{paddingTop:s.height/2,paddingBottom:s.height/2}:{}})},l={position:"absolute",...bg({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},u=n.length===1,c=[0,i?100-n[0]:n[0]],d=u?c:n;let f=d[0];!u&&i&&(f=100-f);const h=Math.abs(d[d.length-1]-d[0]),p={...l,...bg({orientation:t,vertical:i?{height:`${h}%`,top:`${f}%`}:{height:`${h}%`,bottom:`${f}%`},horizontal:i?{width:`${h}%`,right:`${f}%`}:{width:`${h}%`,left:`${f}%`}})};return{trackStyle:l,innerTrackStyle:p,rootStyle:a,getThumbStyle:o}}function Ole(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function Rle(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Ile(e){const t=Nle(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function lD(e){return!!e.touches}function Mle(e){return lD(e)&&e.touches.length>1}function Nle(e){var t;return(t=e.view)!=null?t:window}function Dle(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function Lle(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function uD(e,t="page"){return lD(e)?Dle(e,t):Lle(e,t)}function $le(e){return t=>{const n=Ile(t);(!n||n&&t.button===0)&&e(t)}}function Fle(e,t=!1){function n(i){e(i,{point:uD(i)})}return t?$le(n):n}function Sm(e,t,n,r){return Rle(e,t,Fle(n,t==="pointerdown"),r)}var Ble=Object.defineProperty,jle=(e,t,n)=>t in e?Ble(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wi=(e,t,n)=>(jle(e,typeof t!="symbol"?t+"":t,n),n),Vle=class{constructor(e,t,n){wi(this,"history",[]),wi(this,"startEvent",null),wi(this,"lastEvent",null),wi(this,"lastEventInfo",null),wi(this,"handlers",{}),wi(this,"removeListeners",()=>{}),wi(this,"threshold",3),wi(this,"win"),wi(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const a=r_(this.lastEventInfo,this.history),l=this.startEvent!==null,u=Hle(a.offset,{x:0,y:0})>=this.threshold;if(!l&&!u)return;const{timestamp:c}=sP();this.history.push({...a.point,timestamp:c});const{onStart:d,onMove:f}=this.handlers;l||(d==null||d(this.lastEvent,a),this.startEvent=this.lastEvent),f==null||f(this.lastEvent,a)}),wi(this,"onPointerMove",(a,l)=>{this.lastEvent=a,this.lastEventInfo=l,Ste.update(this.updatePoint,!0)}),wi(this,"onPointerUp",(a,l)=>{const u=r_(l,this.history),{onEnd:c,onSessionEnd:d}=this.handlers;d==null||d(a,u),this.end(),!(!c||!this.startEvent)&&(c==null||c(a,u))});var r;if(this.win=(r=e.view)!=null?r:window,Mle(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const i={point:uD(e)},{timestamp:o}=sP();this.history=[{...i.point,timestamp:o}];const{onSessionStart:s}=t;s==null||s(e,r_(i,this.history)),this.removeListeners=Gle(Sm(this.win,"pointermove",this.onPointerMove),Sm(this.win,"pointerup",this.onPointerUp),Sm(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),_te.update(this.updatePoint)}};function N6(e,t){return{x:e.x-t.x,y:e.y-t.y}}function r_(e,t){return{point:e.point,delta:N6(e.point,t[t.length-1]),offset:N6(e.point,t[0]),velocity:Ule(t,.1)}}var zle=e=>e*1e3;function Ule(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=e[e.length-1];for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>zle(t)));)n--;if(!r)return{x:0,y:0};const o=(i.timestamp-r.timestamp)/1e3;if(o===0)return{x:0,y:0};const s={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function Gle(...e){return t=>e.reduce((n,r)=>r(n),t)}function i_(e,t){return Math.abs(e-t)}function D6(e){return"x"in e&&"y"in e}function Hle(e,t){if(typeof e=="number"&&typeof t=="number")return i_(e,t);if(D6(e)&&D6(t)){const n=i_(e.x,t.x),r=i_(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function cD(e){const t=E.useRef(null);return t.current=e,t}function qle(e,t){const{onPan:n,onPanStart:r,onPanEnd:i,onPanSessionStart:o,onPanSessionEnd:s,threshold:a}=t,l=!!(n||r||i||o||s),u=E.useRef(null),c=cD({onSessionStart:o,onSessionEnd:s,onStart:r,onMove:n,onEnd(d,f){u.current=null,i==null||i(d,f)}});E.useEffect(()=>{var d;(d=u.current)==null||d.updateHandlers(c.current)}),E.useEffect(()=>{const d=e.current;if(!d||!l)return;function f(h){u.current=new Vle(h,c.current,a)}return Sm(d,"pointerdown",f)},[e,l,c,a]),E.useEffect(()=>()=>{var d;(d=u.current)==null||d.end(),u.current=null},[])}function Wle(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(i=>{if(!Array.isArray(i)||!i.length)return;const[o]=i;let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;t({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}var Kle=globalThis!=null&&globalThis.document?E.useLayoutEffect:E.useEffect;function Yle(e,t){var n,r;if(!e||!e.parentElement)return;const i=(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window,o=new i.MutationObserver(()=>{t()});return o.observe(e.parentElement,{childList:!0}),()=>{o.disconnect()}}function Xle({getNodes:e,observeMutation:t=!0}){const[n,r]=E.useState([]),[i,o]=E.useState(0);return Kle(()=>{const s=e(),a=s.map((l,u)=>Wle(l,c=>{r(d=>[...d.slice(0,u),c,...d.slice(u+1)])}));if(t){const l=s[0];a.push(Yle(l,()=>{o(u=>u+1)}))}return()=>{a.forEach(l=>{l==null||l()})}},[i]),n}function Qle(e){return typeof e=="object"&&e!==null&&"current"in e}function Zle(e){const[t]=Xle({observeMutation:!1,getNodes(){return[Qle(e)?e.current:e]}});return t}function Jle(e){var t;const{min:n=0,max:r=100,onChange:i,value:o,defaultValue:s,isReversed:a,direction:l="ltr",orientation:u="horizontal",id:c,isDisabled:d,isReadOnly:f,onChangeStart:h,onChangeEnd:p,step:g=1,getAriaValueText:S,"aria-valuetext":v,"aria-label":y,"aria-labelledby":m,name:b,focusThumbOnChange:_=!0,...w}=e,x=Fn(h),C=Fn(p),k=Fn(S),P=Ole({isReversed:a,direction:l,orientation:u}),[A,$]=Pse({value:o,defaultValue:s??tue(n,r),onChange:i}),[N,T]=E.useState(!1),[O,I]=E.useState(!1),M=!(d||f),R=(r-n)/10,D=g||(r-n)/100,L=mm(A,n,r),V=r-L+n,U=y6(P?V:L,n,r),K=u==="vertical",W=cD({min:n,max:r,step:g,isDisabled:d,value:L,isInteractive:M,isReversed:P,isVertical:K,eventSource:null,focusThumbOnChange:_,orientation:u}),X=E.useRef(null),F=E.useRef(null),q=E.useRef(null),Q=E.useId(),J=c??Q,[ne,Z]=[`slider-thumb-${J}`,`slider-track-${J}`],me=E.useCallback(ie=>{var pe,Xt;if(!X.current)return;const Ot=W.current;Ot.eventSource="pointer";const ut=X.current.getBoundingClientRect(),{clientX:tr,clientY:Do}=(Xt=(pe=ie.touches)==null?void 0:pe[0])!=null?Xt:ie,Yr=K?ut.bottom-Do:tr-ut.left,Lo=K?ut.height:ut.width;let ct=Yr/Lo;P&&(ct=1-ct);let We=Bse(ct,Ot.min,Ot.max);return Ot.step&&(We=parseFloat(v6(We,Ot.min,Ot.step))),We=mm(We,Ot.min,Ot.max),We},[K,P,W]),ae=E.useCallback(ie=>{const pe=W.current;pe.isInteractive&&(ie=parseFloat(v6(ie,pe.min,D)),ie=mm(ie,pe.min,pe.max),$(ie))},[D,$,W]),oe=E.useMemo(()=>({stepUp(ie=D){const pe=P?L-ie:L+ie;ae(pe)},stepDown(ie=D){const pe=P?L+ie:L-ie;ae(pe)},reset(){ae(s||0)},stepTo(ie){ae(ie)}}),[ae,P,L,D,s]),Ce=E.useCallback(ie=>{const pe=W.current,Ot={ArrowRight:()=>oe.stepUp(),ArrowUp:()=>oe.stepUp(),ArrowLeft:()=>oe.stepDown(),ArrowDown:()=>oe.stepDown(),PageUp:()=>oe.stepUp(R),PageDown:()=>oe.stepDown(R),Home:()=>ae(pe.min),End:()=>ae(pe.max)}[ie.key];Ot&&(ie.preventDefault(),ie.stopPropagation(),Ot(ie),pe.eventSource="keyboard")},[oe,ae,R,W]),se=(t=k==null?void 0:k(L))!=null?t:v,qe=Zle(F),{getThumbStyle:yt,rootStyle:$e,trackStyle:Fe,innerTrackStyle:Ie}=E.useMemo(()=>{const ie=W.current,pe=qe??{width:0,height:0};return Ale({isReversed:P,orientation:ie.orientation,thumbRects:[pe],thumbPercents:[U]})},[P,qe,U,W]),nt=E.useCallback(()=>{W.current.focusThumbOnChange&&setTimeout(()=>{var pe;return(pe=F.current)==null?void 0:pe.focus()})},[W]);Cy(()=>{const ie=W.current;nt(),ie.eventSource==="keyboard"&&(C==null||C(ie.value))},[L,C]);function wt(ie){const pe=me(ie);pe!=null&&pe!==W.current.value&&$(pe)}qle(q,{onPanSessionStart(ie){const pe=W.current;pe.isInteractive&&(T(!0),nt(),wt(ie),x==null||x(pe.value))},onPanSessionEnd(){const ie=W.current;ie.isInteractive&&(T(!1),C==null||C(ie.value))},onPan(ie){W.current.isInteractive&&wt(ie)}});const vn=E.useCallback((ie={},pe=null)=>({...ie,...w,ref:di(pe,q),tabIndex:-1,"aria-disabled":t_(d),"data-focused":ou(O),style:{...ie.style,...$e}}),[w,d,O,$e]),sn=E.useCallback((ie={},pe=null)=>({...ie,ref:di(pe,X),id:Z,"data-disabled":ou(d),style:{...ie.style,...Fe}}),[d,Z,Fe]),At=E.useCallback((ie={},pe=null)=>({...ie,ref:pe,style:{...ie.style,...Ie}}),[Ie]),ee=E.useCallback((ie={},pe=null)=>({...ie,ref:di(pe,F),role:"slider",tabIndex:M?0:void 0,id:ne,"data-active":ou(N),"aria-valuetext":se,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":L,"aria-orientation":u,"aria-disabled":t_(d),"aria-readonly":t_(f),"aria-label":y,"aria-labelledby":y?void 0:m,style:{...ie.style,...yt(0)},onKeyDown:n_(ie.onKeyDown,Ce),onFocus:n_(ie.onFocus,()=>I(!0)),onBlur:n_(ie.onBlur,()=>I(!1))}),[M,ne,N,se,n,r,L,u,d,f,y,m,yt,Ce]),Se=E.useCallback((ie,pe=null)=>{const Xt=!(ie.valuer),Ot=L>=ie.value,ut=y6(ie.value,n,r),tr={position:"absolute",pointerEvents:"none",...eue({orientation:u,vertical:{bottom:P?`${100-ut}%`:`${ut}%`},horizontal:{left:P?`${100-ut}%`:`${ut}%`}})};return{...ie,ref:pe,role:"presentation","aria-hidden":!0,"data-disabled":ou(d),"data-invalid":ou(!Xt),"data-highlighted":ou(Ot),style:{...ie.style,...tr}}},[d,P,r,n,u,L]),Te=E.useCallback((ie={},pe=null)=>({...ie,ref:pe,type:"hidden",value:L,name:b}),[b,L]);return{state:{value:L,isFocused:O,isDragging:N},actions:oe,getRootProps:vn,getTrackProps:sn,getInnerTrackProps:At,getThumbProps:ee,getMarkerProps:Se,getInputProps:Te}}function eue(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function tue(e,t){return t"}),[rue,Wv]=bi({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),dD=Qe((e,t)=>{var n;const r={...e,orientation:(n=e==null?void 0:e.orientation)!=null?n:"horizontal"},i=Nv("Slider",r),o=Ao(r),{direction:s}=Ov();o.direction=s;const{getInputProps:a,getRootProps:l,...u}=Jle(o),c=l(),d=a({},t);return j.jsx(nue,{value:u,children:j.jsx(rue,{value:i,children:j.jsxs(ke.div,{...c,className:bp("chakra-slider",r.className),__css:i.container,children:[r.children,j.jsx("input",{...d})]})})})});dD.displayName="Slider";var fD=Qe((e,t)=>{const{getThumbProps:n}=qv(),r=Wv(),i=n(e,t);return j.jsx(ke.div,{...i,className:bp("chakra-slider__thumb",e.className),__css:r.thumb})});fD.displayName="SliderThumb";var hD=Qe((e,t)=>{const{getTrackProps:n}=qv(),r=Wv(),i=n(e,t);return j.jsx(ke.div,{...i,className:bp("chakra-slider__track",e.className),__css:r.track})});hD.displayName="SliderTrack";var pD=Qe((e,t)=>{const{getInnerTrackProps:n}=qv(),r=Wv(),i=n(e,t);return j.jsx(ke.div,{...i,className:bp("chakra-slider__filled-track",e.className),__css:r.filledTrack})});pD.displayName="SliderFilledTrack";var Su=Qe((e,t)=>{const{getMarkerProps:n}=qv(),r=Wv(),i=n(e,t);return j.jsx(ke.div,{...i,className:bp("chakra-slider__marker",e.className),__css:r.mark})});Su.displayName="SliderMark";var iue={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]}}}},Lw=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},_m=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function oue(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:i,closeOnScroll:o,closeOnPointerDown:s=i,closeOnEsc:a=!0,onOpen:l,onClose:u,placement:c,id:d,isOpen:f,defaultIsOpen:h,arrowSize:p=10,arrowShadowColor:g,arrowPadding:S,modifiers:v,isDisabled:y,gutter:m,offset:b,direction:_,...w}=e,{isOpen:x,onOpen:C,onClose:k}=yle({isOpen:f,defaultIsOpen:h,onOpen:l,onClose:u}),{referenceRef:P,getPopperProps:A,getArrowInnerProps:$,getArrowProps:N}=gle({enabled:x,placement:c,arrowPadding:S,modifiers:v,gutter:m,offset:b,direction:_}),T=E.useId(),I=`tooltip-${d??T}`,M=E.useRef(null),R=E.useRef(),D=E.useCallback(()=>{R.current&&(clearTimeout(R.current),R.current=void 0)},[]),L=E.useRef(),V=E.useCallback(()=>{L.current&&(clearTimeout(L.current),L.current=void 0)},[]),z=E.useCallback(()=>{V(),k()},[k,V]),U=sue(M,z),K=E.useCallback(()=>{if(!y&&!R.current){U();const Z=_m(M);R.current=Z.setTimeout(C,t)}},[U,y,C,t]),W=E.useCallback(()=>{D();const Z=_m(M);L.current=Z.setTimeout(z,n)},[n,z,D]),X=E.useCallback(()=>{x&&r&&W()},[r,W,x]),F=E.useCallback(()=>{x&&s&&W()},[s,W,x]),q=E.useCallback(Z=>{x&&Z.key==="Escape"&&W()},[x,W]);ym(()=>Lw(M),"keydown",a?q:void 0),ym(()=>{const Z=M.current;if(!Z)return null;const me=VN(Z);return me.localName==="body"?_m(M):me},"scroll",()=>{x&&o&&z()},{passive:!0,capture:!0}),E.useEffect(()=>{y&&(D(),x&&k())},[y,x,k,D]),E.useEffect(()=>()=>{D(),V()},[D,V]),ym(()=>M.current,"pointerleave",W);const Q=E.useCallback((Z={},me=null)=>({...Z,ref:di(M,me,P),onPointerEnter:Dn(Z.onPointerEnter,oe=>{oe.pointerType!=="touch"&&K()}),onClick:Dn(Z.onClick,X),onPointerDown:Dn(Z.onPointerDown,F),onFocus:Dn(Z.onFocus,K),onBlur:Dn(Z.onBlur,W),"aria-describedby":x?I:void 0}),[K,W,F,x,I,X,P]),J=E.useCallback((Z={},me=null)=>A({...Z,style:{...Z.style,[$n.arrowSize.var]:p?`${p}px`:void 0,[$n.arrowShadowColor.var]:g}},me),[A,p,g]),ne=E.useCallback((Z={},me=null)=>{const ae={...Z.style,position:"relative",transformOrigin:$n.transformOrigin.varRef};return{ref:me,...w,...Z,id:I,role:"tooltip",style:ae}},[w,I]);return{isOpen:x,show:K,hide:W,getTriggerProps:Q,getTooltipProps:ne,getTooltipPositionerProps:J,getArrowProps:N,getArrowInnerProps:$}}var o_="chakra-ui:close-tooltip";function sue(e,t){return E.useEffect(()=>{const n=Lw(e);return n.addEventListener(o_,t),()=>n.removeEventListener(o_,t)},[t,e]),()=>{const n=Lw(e),r=_m(e);n.dispatchEvent(new r.CustomEvent(o_))}}function aue(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function lue(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var uue=ke(H5.div),a3=Qe((e,t)=>{var n,r;const i=$l("Tooltip",e),o=Ao(e),s=Ov(),{children:a,label:l,shouldWrapChildren:u,"aria-label":c,hasArrow:d,bg:f,portalProps:h,background:p,backgroundColor:g,bgColor:S,motionProps:v,...y}=o,m=(r=(n=p??g)!=null?n:f)!=null?r:S;if(m){i.bg=m;const A=ste(s,"colors",m);i[$n.arrowBg.var]=A}const b=oue({...y,direction:s.direction}),_=typeof a=="string"||u;let w;if(_)w=j.jsx(ke.span,{display:"inline-block",tabIndex:0,...b.getTriggerProps(),children:a});else{const A=E.Children.only(a);w=E.cloneElement(A,b.getTriggerProps(A.props,A.ref))}const x=!!c,C=b.getTooltipProps({},t),k=x?aue(C,["role","id"]):C,P=lue(C,["role","id"]);return l?j.jsxs(j.Fragment,{children:[w,j.jsx(q5,{children:b.isOpen&&j.jsx(cp,{...h,children:j.jsx(ke.div,{...b.getTooltipPositionerProps(),__css:{zIndex:i.zIndex,pointerEvents:"none"},children:j.jsxs(uue,{variants:iue,initial:"exit",animate:"enter",exit:"exit",...v,...k,__css:i,children:[l,x&&j.jsx(ke.span,{srOnly:!0,...P,children:c}),d&&j.jsx(ke.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:j.jsx(ke.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:i.bg}})})]})})})})]}):j.jsx(j.Fragment,{children:a})});a3.displayName="Tooltip";const gD={shift:!1},mD=jt({name:"hotkeys",initialState:gD,reducers:{shiftKeyPressed:(e,t)=>{e.shift=t.payload}}}),{shiftKeyPressed:L6}=mD.actions,cue=mD.reducer,pEe=e=>e.hotkeys;function due(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function F6(e,t,n){e.loadNamespaces(t,yD(e,n))}function B6(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,yD(e,r))}function fue(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],i=t.options?t.options.fallbackLng:!1,o=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const s=(a,l)=>{const u=t.services.backendConnector.state[`${a}|${l}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!s(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||s(r,e)&&(!i||s(o,e)))}function hue(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?($w("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(i,o)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!o(i.isLanguageChangingTo,e))return!1}}):fue(e,t,n)}const pue=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,gue={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},mue=e=>gue[e],yue=e=>e.replace(pue,mue);let Fw={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:yue};function vue(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Fw={...Fw,...e}}function bue(){return Fw}let vD;function Sue(e){vD=e}function _ue(){return vD}const wue={type:"3rdParty",init(e){vue(e.options.react),Sue(e)}},xue=E.createContext();class Cue{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Tue=(e,t)=>{const n=E.useRef();return E.useEffect(()=>{n.current=t?n.current:e},[e,t]),n.current};function bD(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:i}=E.useContext(xue)||{},o=n||r||_ue();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new Cue),!o){$w("You will need to pass in an i18next instance by using initReactI18next");const m=(_,w)=>typeof w=="string"?w:w&&typeof w=="object"&&typeof w.defaultValue=="string"?w.defaultValue:Array.isArray(_)?_[_.length-1]:_,b=[m,{},!1];return b.t=m,b.i18n={},b.ready=!1,b}o.options.react&&o.options.react.wait!==void 0&&$w("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...bue(),...o.options.react,...t},{useSuspense:a,keyPrefix:l}=s;let u=e||i||o.options&&o.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(u);const c=(o.isInitialized||o.initializedStoreOnce)&&u.every(m=>hue(m,o,s));function d(){return o.getFixedT(t.lng||null,s.nsMode==="fallback"?u:u[0],l)}const[f,h]=E.useState(d);let p=u.join();t.lng&&(p=`${t.lng}${p}`);const g=Tue(p),S=E.useRef(!0);E.useEffect(()=>{const{bindI18n:m,bindI18nStore:b}=s;S.current=!0,!c&&!a&&(t.lng?B6(o,t.lng,u,()=>{S.current&&h(d)}):F6(o,u,()=>{S.current&&h(d)})),c&&g&&g!==p&&S.current&&h(d);function _(){S.current&&h(d)}return m&&o&&o.on(m,_),b&&o&&o.store.on(b,_),()=>{S.current=!1,m&&o&&m.split(" ").forEach(w=>o.off(w,_)),b&&o&&b.split(" ").forEach(w=>o.store.off(w,_))}},[o,p]);const v=E.useRef(!0);E.useEffect(()=>{S.current&&!v.current&&h(d),v.current=!1},[o,l]);const y=[f,o,c];if(y.t=f,y.i18n=o,y.ready=c,c||!c&&!a)return y;throw new Promise(m=>{t.lng?B6(o,t.lng,u,()=>m()):F6(o,u,()=>m())})}var SD={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},j6=Ve.createContext&&Ve.createContext(SD),aa=globalThis&&globalThis.__assign||function(){return aa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const{role:n,tooltip:r="",tooltipProps:i,isChecked:o,...s}=e;return j.jsx(a3,{label:r,hasArrow:!0,...i,...i!=null&&i.placement?{placement:i.placement}:{placement:"top"},children:j.jsx(IN,{ref:t,role:n,colorScheme:o?"accent":"base",...s})})});wD.displayName="IAIIconButton";const Oue=E.memo(wD),Rue=e=>{const[t,n]=E.useState(!1),{label:r,value:i,min:o=1,max:s=100,step:a=1,onChange:l,tooltipSuffix:u="",withSliderMarks:c=!1,withInput:d=!1,isInteger:f=!1,inputWidth:h=16,withReset:p=!1,hideTooltip:g=!1,isCompact:S=!1,isDisabled:v=!1,sliderMarks:y,handleReset:m,sliderFormControlProps:b,sliderFormLabelProps:_,sliderMarkProps:w,sliderTrackProps:x,sliderThumbProps:C,sliderNumberInputProps:k,sliderNumberInputFieldProps:P,sliderNumberInputStepperProps:A,sliderTooltipProps:$,sliderIAIIconButtonProps:N,...T}=e,O=ed(),{t:I}=bD(),[M,R]=E.useState(String(i));E.useEffect(()=>{R(i)},[i]);const D=E.useMemo(()=>k!=null&&k.max?k.max:s,[s,k==null?void 0:k.max]),L=E.useCallback(F=>{l(F)},[l]),V=E.useCallback(F=>{F.target.value===""&&(F.target.value=String(o));const q=Zo(f?Math.floor(Number(F.target.value)):Number(M),o,D),Q=Wd(q,a);l(Q),R(Q)},[f,M,o,D,l,a]),z=E.useCallback(F=>{console.log("input"),R(F)},[]),U=E.useCallback(()=>{m&&m()},[m]),K=E.useCallback(F=>{F.target instanceof HTMLDivElement&&F.target.focus()},[]),W=E.useCallback(F=>{F.shiftKey&&O(L6(!0))},[O]),X=E.useCallback(F=>{F.shiftKey||O(L6(!1))},[O]);return j.jsxs(NN,{onClick:K,sx:S?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},isDisabled:v,...b,children:[r&&j.jsx(DN,{sx:d?{mb:-1.5}:{},..._,children:r}),j.jsxs(HN,{w:"100%",gap:2,alignItems:"center",children:[j.jsxs(dD,{"aria-label":r,value:i,min:o,max:s,step:a,onChange:L,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),focusThumbOnChange:!1,isDisabled:v,...T,children:[c&&!y&&j.jsxs(j.Fragment,{children:[j.jsx(Su,{value:o,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...w,children:o}),j.jsx(Su,{value:s,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...w,children:s})]}),c&&y&&j.jsx(j.Fragment,{children:y.map((F,q)=>q===0?j.jsx(Su,{value:F,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...w,children:F},F):q===y.length-1?j.jsx(Su,{value:F,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...w,children:F},F):j.jsx(Su,{value:F,sx:{transform:"translateX(-50%)"},...w,children:F},F))}),j.jsx(hD,{...x,children:j.jsx(pD,{})}),j.jsx(a3,{hasArrow:!0,placement:"top",isOpen:t,label:`${i}${u}`,hidden:g,...$,children:j.jsx(fD,{...C,zIndex:0})})]}),d&&j.jsxs(nD,{min:o,max:D,step:a,value:M,onChange:z,onBlur:V,focusInputOnChange:!1,...k,children:[j.jsx(iD,{onKeyDown:W,onKeyUp:X,minWidth:h,...P}),j.jsxs(rD,{...A,children:[j.jsx(aD,{onClick:()=>l(Number(M))}),j.jsx(sD,{onClick:()=>l(Number(M))})]})]}),p&&j.jsx(Oue,{size:"sm","aria-label":I("accessibility.reset"),tooltip:I("accessibility.reset"),icon:j.jsx(Aue,{}),isDisabled:v,onClick:U,...N})]})]})},Iue=E.memo(Rue),Xd={"sd-1":{maxClip:12,markers:[0,1,2,3,4,8,12]},"sd-2":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},sdxl:{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},"sdxl-refiner":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]}};function gEe(){const e=Zf(l=>l.generation.clipSkip),{model:t}=Zf(l=>l.generation),n=ed(),{t:r}=bD(),i=E.useCallback(l=>{n(U6(l))},[n]),o=E.useCallback(()=>{n(U6(0))},[n]),s=E.useMemo(()=>t?Xd[t.base_model].maxClip:Xd["sd-1"].maxClip,[t]),a=E.useMemo(()=>t?Xd[t.base_model].markers:Xd["sd-1"].markers,[t]);return j.jsx(Iue,{label:r("parameters.clipSkip"),"aria-label":r("parameters.clipSkip"),min:0,max:s,step:1,value:e,onChange:i,withSliderMarks:!0,sliderMarks:a,withInput:!0,withReset:!0,handleReset:o})}var Xe;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const s of i)o[s]=s;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(const a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(const s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Xe||(Xe={}));var Bw;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Bw||(Bw={}));const le=Xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Hs=e=>{switch(typeof e){case"undefined":return le.undefined;case"string":return le.string;case"number":return isNaN(e)?le.nan:le.number;case"boolean":return le.boolean;case"function":return le.function;case"bigint":return le.bigint;case"symbol":return le.symbol;case"object":return Array.isArray(e)?le.array:e===null?le.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?le.promise:typeof Map<"u"&&e instanceof Map?le.map:typeof Set<"u"&&e instanceof Set?le.set:typeof Date<"u"&&e instanceof Date?le.date:le.object;default:return le.unknown}},re=Xe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Mue=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Ni extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ni.create=e=>new Ni(e);const ch=(e,t)=>{let n;switch(e.code){case re.invalid_type:e.received===le.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case re.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Xe.jsonStringifyReplacer)}`;break;case re.unrecognized_keys:n=`Unrecognized key(s) in object: ${Xe.joinValues(e.keys,", ")}`;break;case re.invalid_union:n="Invalid input";break;case re.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Xe.joinValues(e.options)}`;break;case re.invalid_enum_value:n=`Invalid enum value. Expected ${Xe.joinValues(e.options)}, received '${e.received}'`;break;case re.invalid_arguments:n="Invalid function arguments";break;case re.invalid_return_type:n="Invalid function return type";break;case re.invalid_date:n="Invalid date";break;case re.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Xe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case re.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case re.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case re.custom:n="Invalid input";break;case re.invalid_intersection_types:n="Intersection results could not be merged";break;case re.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case re.not_finite:n="Number must be finite";break;default:n=t.defaultError,Xe.assertNever(e)}return{message:n}};let xD=ch;function Nue(e){xD=e}function Dy(){return xD}const Ly=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],s={...i,path:o};let a="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:i.message||a}},Due=[];function ce(e,t){const n=Ly({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,Dy(),ch].filter(r=>!!r)});e.common.issues.push(n)}class Zn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return xe;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n)r.push({key:await i.key,value:await i.value});return Zn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return xe;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),(typeof s.value<"u"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:t.value,value:r}}}const xe=Object.freeze({status:"aborted"}),CD=e=>({status:"dirty",value:e}),dr=e=>({status:"valid",value:e}),jw=e=>e.status==="aborted",Vw=e=>e.status==="dirty",$y=e=>e.status==="valid",Fy=e=>typeof Promise<"u"&&e instanceof Promise;var be;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(be||(be={}));class wo{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const V6=(e,t)=>{if($y(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ni(e.common.issues);return this._error=n,this._error}}};function Ae(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,a)=>s.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:r??a.defaultError}:{message:n??a.defaultError},description:i}}class Oe{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Hs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Hs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Zn,ctx:{common:t.parent.common,data:t.data,parsedType:Hs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Fy(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Hs(t)},o=this._parseSync({data:t,path:i.path,parent:i});return V6(i,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Hs(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(Fy(i)?i:Promise.resolve(i));return V6(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const s=t(i),a=()=>o.addIssue({code:re.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new ji({schema:this,typeName:we.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return is.create(this,this._def)}nullable(){return El.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Di.create(this,this._def)}promise(){return Dc.create(this,this._def)}or(t){return ph.create([this,t],this._def)}and(t){return gh.create(this,t,this._def)}transform(t){return new ji({...Ae(this._def),schema:this,typeName:we.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Sh({...Ae(this._def),innerType:this,defaultValue:n,typeName:we.ZodDefault})}brand(){return new ED({typeName:we.ZodBranded,type:this,...Ae(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new zy({...Ae(this._def),innerType:this,catchValue:n,typeName:we.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Sp.create(this,t)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Lue=/^c[^\s-]{8,}$/i,$ue=/^[a-z][a-z0-9]*$/,Fue=/[0-9A-HJKMNP-TV-Z]{26}/,Bue=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,jue=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,Vue=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,zue=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Uue=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Gue=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Hue(e,t){return!!((t==="v4"||!t)&&zue.test(e)||(t==="v6"||!t)&&Uue.test(e))}class Oi extends Oe{constructor(){super(...arguments),this._regex=(t,n,r)=>this.refinement(i=>t.test(i),{validation:n,code:re.invalid_string,...be.errToObj(r)}),this.nonempty=t=>this.min(1,be.errToObj(t)),this.trim=()=>new Oi({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new Oi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new Oi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==le.string){const o=this._getOrReturnCtx(t);return ce(o,{code:re.invalid_type,expected:le.string,received:o.parsedType}),xe}const r=new Zn;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(i=this._getOrReturnCtx(t,i),ce(i,{code:re.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const s=t.data.length>o.value,a=t.data.length"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...be.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...be.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...be.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...be.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...be.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...be.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...be.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...be.errToObj(n)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Oi({checks:[],typeName:we.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ae(e)})};function que(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(e.toFixed(i).replace(".","")),s=parseInt(t.toFixed(i).replace(".",""));return o%s/Math.pow(10,i)}class va extends Oe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==le.number){const o=this._getOrReturnCtx(t);return ce(o,{code:re.invalid_type,expected:le.number,received:o.parsedType}),xe}let r;const i=new Zn;for(const o of this._def.checks)o.kind==="int"?Xe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ce(r,{code:re.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?que(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ce(r,{code:re.not_finite,message:o.message}),i.dirty()):Xe.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,be.toString(n))}gt(t,n){return this.setLimit("min",t,!1,be.toString(n))}lte(t,n){return this.setLimit("max",t,!0,be.toString(n))}lt(t,n){return this.setLimit("max",t,!1,be.toString(n))}setLimit(t,n,r,i){return new va({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:be.toString(i)}]})}_addCheck(t){return new va({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:be.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:be.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:be.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:be.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:be.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:be.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:be.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:be.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:be.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Xe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew va({checks:[],typeName:we.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ae(e)});class ba extends Oe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==le.bigint){const o=this._getOrReturnCtx(t);return ce(o,{code:re.invalid_type,expected:le.bigint,received:o.parsedType}),xe}let r;const i=new Zn;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Xe.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,be.toString(n))}gt(t,n){return this.setLimit("min",t,!1,be.toString(n))}lte(t,n){return this.setLimit("max",t,!0,be.toString(n))}lt(t,n){return this.setLimit("max",t,!1,be.toString(n))}setLimit(t,n,r,i){return new ba({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:be.toString(i)}]})}_addCheck(t){return new ba({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:be.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:be.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:be.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:be.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:be.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new ba({checks:[],typeName:we.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ae(e)})};class dh extends Oe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==le.boolean){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:le.boolean,received:r.parsedType}),xe}return dr(t.data)}}dh.create=e=>new dh({typeName:we.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ae(e)});class Cl extends Oe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==le.date){const o=this._getOrReturnCtx(t);return ce(o,{code:re.invalid_type,expected:le.date,received:o.parsedType}),xe}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ce(o,{code:re.invalid_date}),xe}const r=new Zn;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(i=this._getOrReturnCtx(t,i),ce(i,{code:re.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Xe.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Cl({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:be.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:be.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Cl({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:we.ZodDate,...Ae(e)});class By extends Oe{_parse(t){if(this._getType(t)!==le.symbol){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:le.symbol,received:r.parsedType}),xe}return dr(t.data)}}By.create=e=>new By({typeName:we.ZodSymbol,...Ae(e)});class fh extends Oe{_parse(t){if(this._getType(t)!==le.undefined){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:le.undefined,received:r.parsedType}),xe}return dr(t.data)}}fh.create=e=>new fh({typeName:we.ZodUndefined,...Ae(e)});class hh extends Oe{_parse(t){if(this._getType(t)!==le.null){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:le.null,received:r.parsedType}),xe}return dr(t.data)}}hh.create=e=>new hh({typeName:we.ZodNull,...Ae(e)});class Nc extends Oe{constructor(){super(...arguments),this._any=!0}_parse(t){return dr(t.data)}}Nc.create=e=>new Nc({typeName:we.ZodAny,...Ae(e)});class dl extends Oe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return dr(t.data)}}dl.create=e=>new dl({typeName:we.ZodUnknown,...Ae(e)});class ps extends Oe{_parse(t){const n=this._getOrReturnCtx(t);return ce(n,{code:re.invalid_type,expected:le.never,received:n.parsedType}),xe}}ps.create=e=>new ps({typeName:we.ZodNever,...Ae(e)});class jy extends Oe{_parse(t){if(this._getType(t)!==le.undefined){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:le.void,received:r.parsedType}),xe}return dr(t.data)}}jy.create=e=>new jy({typeName:we.ZodVoid,...Ae(e)});class Di extends Oe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==le.array)return ce(n,{code:re.invalid_type,expected:le.array,received:n.parsedType}),xe;if(i.exactLength!==null){const s=n.data.length>i.exactLength.value,a=n.data.lengthi.maxLength.value&&(ce(n,{code:re.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>i.type._parseAsync(new wo(n,s,n.path,a)))).then(s=>Zn.mergeArray(r,s));const o=[...n.data].map((s,a)=>i.type._parseSync(new wo(n,s,n.path,a)));return Zn.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new Di({...this._def,minLength:{value:t,message:be.toString(n)}})}max(t,n){return new Di({...this._def,maxLength:{value:t,message:be.toString(n)}})}length(t,n){return new Di({...this._def,exactLength:{value:t,message:be.toString(n)}})}nonempty(t){return this.min(1,t)}}Di.create=(e,t)=>new Di({type:e,minLength:null,maxLength:null,exactLength:null,typeName:we.ZodArray,...Ae(t)});function _u(e){if(e instanceof Rt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=is.create(_u(r))}return new Rt({...e._def,shape:()=>t})}else return e instanceof Di?new Di({...e._def,type:_u(e.element)}):e instanceof is?is.create(_u(e.unwrap())):e instanceof El?El.create(_u(e.unwrap())):e instanceof xo?xo.create(e.items.map(t=>_u(t))):e}class Rt extends Oe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Xe.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==le.object){const u=this._getOrReturnCtx(t);return ce(u,{code:re.invalid_type,expected:le.object,received:u.parsedType}),xe}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ps&&this._def.unknownKeys==="strip"))for(const u in i.data)s.includes(u)||a.push(u);const l=[];for(const u of s){const c=o[u],d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new wo(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof ps){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of a)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")a.length>0&&(ce(i,{code:re.unrecognized_keys,keys:a}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of a){const d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new wo(i,d,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const d=await c.key;u.push({key:d,value:await c.value,alwaysSet:c.alwaysSet})}return u}).then(u=>Zn.mergeObjectSync(r,u)):Zn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return be.errToObj,new Rt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,s,a;const l=(s=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=be.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new Rt({...this._def,unknownKeys:"strip"})}passthrough(){return new Rt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Rt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Rt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:we.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Rt({...this._def,catchall:t})}pick(t){const n={};return Xe.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Rt({...this._def,shape:()=>n})}omit(t){const n={};return Xe.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Rt({...this._def,shape:()=>n})}deepPartial(){return _u(this)}partial(t){const n={};return Xe.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new Rt({...this._def,shape:()=>n})}required(t){const n={};return Xe.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof is;)o=o._def.innerType;n[r]=o}}),new Rt({...this._def,shape:()=>n})}keyof(){return TD(Xe.objectKeys(this.shape))}}Rt.create=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strip",catchall:ps.create(),typeName:we.ZodObject,...Ae(t)});Rt.strictCreate=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strict",catchall:ps.create(),typeName:we.ZodObject,...Ae(t)});Rt.lazycreate=(e,t)=>new Rt({shape:e,unknownKeys:"strip",catchall:ps.create(),typeName:we.ZodObject,...Ae(t)});class ph extends Oe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const s=o.map(a=>new Ni(a.ctx.common.issues));return ce(n,{code:re.invalid_union,unionErrors:s}),xe}if(n.common.async)return Promise.all(r.map(async o=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let o;const s=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=l._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const a=s.map(l=>new Ni(l));return ce(n,{code:re.invalid_union,unionErrors:a}),xe}}get options(){return this._def.options}}ph.create=(e,t)=>new ph({options:e,typeName:we.ZodUnion,...Ae(t)});const wm=e=>e instanceof yh?wm(e.schema):e instanceof ji?wm(e.innerType()):e instanceof vh?[e.value]:e instanceof Sa?e.options:e instanceof bh?Object.keys(e.enum):e instanceof Sh?wm(e._def.innerType):e instanceof fh?[void 0]:e instanceof hh?[null]:null;class Kv extends Oe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==le.object)return ce(n,{code:re.invalid_type,expected:le.object,received:n.parsedType}),xe;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(ce(n,{code:re.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),xe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const o of n){const s=wm(o.shape[t]);if(!s)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of s){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new Kv({typeName:we.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Ae(r)})}}function zw(e,t){const n=Hs(e),r=Hs(t);if(e===t)return{valid:!0,data:e};if(n===le.object&&r===le.object){const i=Xe.objectKeys(t),o=Xe.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(const a of o){const l=zw(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===le.array&&r===le.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o{if(jw(o)||jw(s))return xe;const a=zw(o.value,s.value);return a.valid?((Vw(o)||Vw(s))&&n.dirty(),{status:n.value,value:a.data}):(ce(r,{code:re.invalid_intersection_types}),xe)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}gh.create=(e,t,n)=>new gh({left:e,right:t,typeName:we.ZodIntersection,...Ae(n)});class xo extends Oe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==le.array)return ce(r,{code:re.invalid_type,expected:le.array,received:r.parsedType}),xe;if(r.data.lengththis._def.items.length&&(ce(r,{code:re.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((s,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new wo(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>Zn.mergeArray(n,s)):Zn.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new xo({...this._def,rest:t})}}xo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xo({items:e,typeName:we.ZodTuple,rest:null,...Ae(t)})};class mh extends Oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==le.object)return ce(r,{code:re.invalid_type,expected:le.object,received:r.parsedType}),xe;const i=[],o=this._def.keyType,s=this._def.valueType;for(const a in r.data)i.push({key:o._parse(new wo(r,a,r.path,a)),value:s._parse(new wo(r,r.data[a],r.path,a))});return r.common.async?Zn.mergeObjectAsync(n,i):Zn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Oe?new mh({keyType:t,valueType:n,typeName:we.ZodRecord,...Ae(r)}):new mh({keyType:Oi.create(),valueType:t,typeName:we.ZodRecord,...Ae(n)})}}class Vy extends Oe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==le.map)return ce(r,{code:re.invalid_type,expected:le.map,received:r.parsedType}),xe;const i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([a,l],u)=>({key:i._parse(new wo(r,a,r.path,[u,"key"])),value:o._parse(new wo(r,l,r.path,[u,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of s){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return xe;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),a.set(u.value,c.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of s){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return xe;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),a.set(u.value,c.value)}return{status:n.value,value:a}}}}Vy.create=(e,t,n)=>new Vy({valueType:t,keyType:e,typeName:we.ZodMap,...Ae(n)});class Tl extends Oe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==le.set)return ce(r,{code:re.invalid_type,expected:le.set,received:r.parsedType}),xe;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(ce(r,{code:re.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function s(l){const u=new Set;for(const c of l){if(c.status==="aborted")return xe;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((l,u)=>o._parse(new wo(r,l,r.path,u)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new Tl({...this._def,minSize:{value:t,message:be.toString(n)}})}max(t,n){return new Tl({...this._def,maxSize:{value:t,message:be.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Tl.create=(e,t)=>new Tl({valueType:e,minSize:null,maxSize:null,typeName:we.ZodSet,...Ae(t)});class oc extends Oe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==le.function)return ce(n,{code:re.invalid_type,expected:le.function,received:n.parsedType}),xe;function r(a,l){return Ly({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Dy(),ch].filter(u=>!!u),issueData:{code:re.invalid_arguments,argumentsError:l}})}function i(a,l){return Ly({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Dy(),ch].filter(u=>!!u),issueData:{code:re.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},s=n.data;return this._def.returns instanceof Dc?dr(async(...a)=>{const l=new Ni([]),u=await this._def.args.parseAsync(a,o).catch(f=>{throw l.addIssue(r(a,f)),l}),c=await s(...u);return await this._def.returns._def.type.parseAsync(c,o).catch(f=>{throw l.addIssue(i(c,f)),l})}):dr((...a)=>{const l=this._def.args.safeParse(a,o);if(!l.success)throw new Ni([r(a,l.error)]);const u=s(...l.data),c=this._def.returns.safeParse(u,o);if(!c.success)throw new Ni([i(u,c.error)]);return c.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new oc({...this._def,args:xo.create(t).rest(dl.create())})}returns(t){return new oc({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new oc({args:t||xo.create([]).rest(dl.create()),returns:n||dl.create(),typeName:we.ZodFunction,...Ae(r)})}}class yh extends Oe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}yh.create=(e,t)=>new yh({getter:e,typeName:we.ZodLazy,...Ae(t)});class vh extends Oe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ce(n,{received:n.data,code:re.invalid_literal,expected:this._def.value}),xe}return{status:"valid",value:t.data}}get value(){return this._def.value}}vh.create=(e,t)=>new vh({value:e,typeName:we.ZodLiteral,...Ae(t)});function TD(e,t){return new Sa({values:e,typeName:we.ZodEnum,...Ae(t)})}class Sa extends Oe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ce(n,{expected:Xe.joinValues(r),received:n.parsedType,code:re.invalid_type}),xe}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return ce(n,{received:n.data,code:re.invalid_enum_value,options:r}),xe}return dr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t){return Sa.create(t)}exclude(t){return Sa.create(this.options.filter(n=>!t.includes(n)))}}Sa.create=TD;class bh extends Oe{_parse(t){const n=Xe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==le.string&&r.parsedType!==le.number){const i=Xe.objectValues(n);return ce(r,{expected:Xe.joinValues(i),received:r.parsedType,code:re.invalid_type}),xe}if(n.indexOf(t.data)===-1){const i=Xe.objectValues(n);return ce(r,{received:r.data,code:re.invalid_enum_value,options:i}),xe}return dr(t.data)}get enum(){return this._def.values}}bh.create=(e,t)=>new bh({values:e,typeName:we.ZodNativeEnum,...Ae(t)});class Dc extends Oe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==le.promise&&n.common.async===!1)return ce(n,{code:re.invalid_type,expected:le.promise,received:n.parsedType}),xe;const r=n.parsedType===le.promise?n.data:Promise.resolve(n.data);return dr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Dc.create=(e,t)=>new Dc({type:e,typeName:we.ZodPromise,...Ae(t)});class ji extends Oe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===we.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null;if(i.type==="preprocess"){const s=i.transform(r.data);return r.common.async?Promise.resolve(s).then(a=>this._def.schema._parseAsync({data:a,path:r.path,parent:r})):this._def.schema._parseSync({data:s,path:r.path,parent:r})}const o={addIssue:s=>{ce(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="refinement"){const s=a=>{const l=i.refinement(a,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?xe:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?xe:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!$y(s))return s;const a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>$y(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:n.value,value:a})):s);Xe.assertNever(i)}}ji.create=(e,t,n)=>new ji({schema:e,typeName:we.ZodEffects,effect:t,...Ae(n)});ji.createWithPreprocess=(e,t,n)=>new ji({schema:t,effect:{type:"preprocess",transform:e},typeName:we.ZodEffects,...Ae(n)});class is extends Oe{_parse(t){return this._getType(t)===le.undefined?dr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}is.create=(e,t)=>new is({innerType:e,typeName:we.ZodOptional,...Ae(t)});class El extends Oe{_parse(t){return this._getType(t)===le.null?dr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}El.create=(e,t)=>new El({innerType:e,typeName:we.ZodNullable,...Ae(t)});class Sh extends Oe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===le.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Sh.create=(e,t)=>new Sh({innerType:e,typeName:we.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ae(t)});class zy extends Oe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Fy(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ni(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ni(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}zy.create=(e,t)=>new zy({innerType:e,typeName:we.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ae(t)});class Uy extends Oe{_parse(t){if(this._getType(t)!==le.nan){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:le.nan,received:r.parsedType}),xe}return{status:"valid",value:t.data}}}Uy.create=e=>new Uy({typeName:we.ZodNaN,...Ae(e)});const Wue=Symbol("zod_brand");class ED extends Oe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Sp extends Oe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?xe:o.status==="dirty"?(n.dirty(),CD(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?xe:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new Sp({in:t,out:n,typeName:we.ZodPipeline})}}const PD=(e,t={},n)=>e?Nc.create().superRefine((r,i)=>{var o,s;if(!e(r)){const a=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(s=(o=a.fatal)!==null&&o!==void 0?o:n)!==null&&s!==void 0?s:!0,u=typeof a=="string"?{message:a}:a;i.addIssue({code:"custom",...u,fatal:l})}}):Nc.create(),Kue={object:Rt.lazycreate};var we;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline"})(we||(we={}));const Yue=(e,t={message:`Input not instance of ${e.name}`})=>PD(n=>n instanceof e,t),kD=Oi.create,AD=va.create,Xue=Uy.create,Que=ba.create,OD=dh.create,Zue=Cl.create,Jue=By.create,ece=fh.create,tce=hh.create,nce=Nc.create,rce=dl.create,ice=ps.create,oce=jy.create,sce=Di.create,ace=Rt.create,lce=Rt.strictCreate,uce=ph.create,cce=Kv.create,dce=gh.create,fce=xo.create,hce=mh.create,pce=Vy.create,gce=Tl.create,mce=oc.create,yce=yh.create,vce=vh.create,bce=Sa.create,Sce=bh.create,_ce=Dc.create,z6=ji.create,wce=is.create,xce=El.create,Cce=ji.createWithPreprocess,Tce=Sp.create,Ece=()=>kD().optional(),Pce=()=>AD().optional(),kce=()=>OD().optional(),Ace={string:e=>Oi.create({...e,coerce:!0}),number:e=>va.create({...e,coerce:!0}),boolean:e=>dh.create({...e,coerce:!0}),bigint:e=>ba.create({...e,coerce:!0}),date:e=>Cl.create({...e,coerce:!0})},Oce=xe;var gn=Object.freeze({__proto__:null,defaultErrorMap:ch,setErrorMap:Nue,getErrorMap:Dy,makeIssue:Ly,EMPTY_PATH:Due,addIssueToContext:ce,ParseStatus:Zn,INVALID:xe,DIRTY:CD,OK:dr,isAborted:jw,isDirty:Vw,isValid:$y,isAsync:Fy,get util(){return Xe},get objectUtil(){return Bw},ZodParsedType:le,getParsedType:Hs,ZodType:Oe,ZodString:Oi,ZodNumber:va,ZodBigInt:ba,ZodBoolean:dh,ZodDate:Cl,ZodSymbol:By,ZodUndefined:fh,ZodNull:hh,ZodAny:Nc,ZodUnknown:dl,ZodNever:ps,ZodVoid:jy,ZodArray:Di,ZodObject:Rt,ZodUnion:ph,ZodDiscriminatedUnion:Kv,ZodIntersection:gh,ZodTuple:xo,ZodRecord:mh,ZodMap:Vy,ZodSet:Tl,ZodFunction:oc,ZodLazy:yh,ZodLiteral:vh,ZodEnum:Sa,ZodNativeEnum:bh,ZodPromise:Dc,ZodEffects:ji,ZodTransformer:ji,ZodOptional:is,ZodNullable:El,ZodDefault:Sh,ZodCatch:zy,ZodNaN:Uy,BRAND:Wue,ZodBranded:ED,ZodPipeline:Sp,custom:PD,Schema:Oe,ZodSchema:Oe,late:Kue,get ZodFirstPartyTypeKind(){return we},coerce:Ace,any:nce,array:sce,bigint:Que,boolean:OD,date:Zue,discriminatedUnion:cce,effect:z6,enum:bce,function:mce,instanceof:Yue,intersection:dce,lazy:yce,literal:vce,map:pce,nan:Xue,nativeEnum:Sce,never:ice,null:tce,nullable:xce,number:AD,object:ace,oboolean:kce,onumber:Pce,optional:wce,ostring:Ece,pipeline:Tce,preprocess:Cce,promise:_ce,record:hce,set:gce,strictObject:lce,string:kD,symbol:Jue,transformer:z6,tuple:fce,undefined:ece,union:uce,unknown:rce,void:oce,NEVER:Oce,ZodIssueCode:re,quotelessJson:Mue,ZodError:Ni});const Rce=gn.string(),mEe=e=>Rce.safeParse(e).success,Ice=gn.string(),yEe=e=>Ice.safeParse(e).success,Mce=gn.number().int().min(1),vEe=e=>Mce.safeParse(e).success,Nce=gn.number().min(1),bEe=e=>Nce.safeParse(e).success,Dce=gn.enum(C7),SEe=e=>Dce.safeParse(e).success,Lce=gn.number().int().min(0).max(jZ),_Ee=e=>Lce.safeParse(e).success,$ce=gn.number().multipleOf(8).min(64),wEe=e=>$ce.safeParse(e).success,Fce=gn.number().multipleOf(8).min(64),xEe=e=>Fce.safeParse(e).success,Bce=gn.enum(["vae","lora","onnx","main","controlnet","embedding"]),Yv=gn.enum(["sd-1","sd-2","sdxl","sdxl-refiner"]),Xv=gn.object({model_name:gn.string().min(1),base_model:Yv,model_type:Bce}),CEe=e=>Xv.safeParse(e).success,jce=gn.object({model_name:gn.string().min(1),base_model:Yv}),TEe=gn.object({model_name:gn.string().min(1),base_model:Yv}),EEe=gn.object({model_name:gn.string().min(1),base_model:Yv}),Vce=gn.number().min(0).max(1),PEe=e=>Vce.safeParse(e).success,Vl={cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,perlin:0,positivePrompt:"",negativePrompt:"",scheduler:BZ,seamBlur:16,seamSize:96,seamSteps:30,seamStrength:.7,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,shouldUseNoiseSettings:!1,steps:50,threshold:0,tileSize:32,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0,model:null,vae:null,seamlessXAxis:!1,seamlessYAxis:!1,clipSkip:0,shouldUseCpuNoise:!0},zce=Vl,RD=jt({name:"generation",initialState:zce,reducers:{setPositivePrompt:(e,t)=>{e.positivePrompt=t.payload},setNegativePrompt:(e,t)=>{e.negativePrompt=t.payload},setIterations:(e,t)=>{e.iterations=t.payload},setSteps:(e,t)=>{e.steps=t.payload},clampSymmetrySteps:e=>{e.horizontalSymmetrySteps=Zo(e.horizontalSymmetrySteps,0,e.steps),e.verticalSymmetrySteps=Zo(e.verticalSymmetrySteps,0,e.steps)},setCfgScale:(e,t)=>{e.cfgScale=t.payload},setThreshold:(e,t)=>{e.threshold=t.payload},setPerlin:(e,t)=>{e.perlin=t.payload},setHeight:(e,t)=>{e.height=t.payload},setWidth:(e,t)=>{e.width=t.payload},toggleSize:e=>{const[t,n]=[e.width,e.height];e.width=n,e.height=t},setScheduler:(e,t)=>{e.scheduler=t.payload},setSeed:(e,t)=>{e.seed=t.payload,e.shouldRandomizeSeed=!1},setImg2imgStrength:(e,t)=>{e.img2imgStrength=t.payload},setSeamlessXAxis:(e,t)=>{e.seamlessXAxis=t.payload},setSeamlessYAxis:(e,t)=>{e.seamlessYAxis=t.payload},setShouldFitToWidthHeight:(e,t)=>{e.shouldFitToWidthHeight=t.payload},resetSeed:e=>{e.seed=-1},setShouldGenerateVariations:(e,t)=>{e.shouldGenerateVariations=t.payload},setVariationAmount:(e,t)=>{e.variationAmount=t.payload},setSeedWeights:(e,t)=>{e.seedWeights=t.payload,e.shouldGenerateVariations=!0,e.variationAmount=0},resetParametersState:e=>({...e,...Vl}),setShouldRandomizeSeed:(e,t)=>{e.shouldRandomizeSeed=t.payload},clearInitialImage:e=>{e.initialImage=void 0},setSeamSize:(e,t)=>{e.seamSize=t.payload},setSeamBlur:(e,t)=>{e.seamBlur=t.payload},setSeamStrength:(e,t)=>{e.seamStrength=t.payload},setSeamSteps:(e,t)=>{e.seamSteps=t.payload},setTileSize:(e,t)=>{e.tileSize=t.payload},setInfillMethod:(e,t)=>{e.infillMethod=t.payload},setShouldUseSymmetry:(e,t)=>{e.shouldUseSymmetry=t.payload},setHorizontalSymmetrySteps:(e,t)=>{e.horizontalSymmetrySteps=t.payload},setVerticalSymmetrySteps:(e,t)=>{e.verticalSymmetrySteps=t.payload},setShouldUseNoiseSettings:(e,t)=>{e.shouldUseNoiseSettings=t.payload},initialImageChanged:(e,t)=>{const{image_name:n,width:r,height:i}=t.payload;e.initialImage={imageName:n,width:r,height:i}},modelChanged:(e,t)=>{if(e.model=t.payload,e.model===null)return;const{maxClip:n}=Xd[e.model.base_model];e.clipSkip=Zo(e.clipSkip,0,n)},vaeSelected:(e,t)=>{e.vae=t.payload},setClipSkip:(e,t)=>{e.clipSkip=t.payload},shouldUseCpuNoiseChanged:(e,t)=>{e.shouldUseCpuNoise=t.payload}},extraReducers:e=>{e.addCase(VZ,(t,n)=>{var i;const r=(i=n.payload.sd)==null?void 0:i.defaultModel;if(r&&!t.model){const[o,s,a]=r.split("/"),l=Xv.safeParse({model_name:a,base_model:o,model_type:s});l.success&&(t.model=l.data)}}),e.addCase(Wce,(t,n)=>{n.payload||(t.clipSkip=0)}),e.addCase($D,(t,n)=>{const r=n.payload;r&&(t.height=to(t.width/r,8))})}}),{clampSymmetrySteps:kEe,clearInitialImage:ID,resetParametersState:AEe,resetSeed:OEe,setCfgScale:REe,setWidth:IEe,setHeight:MEe,toggleSize:NEe,setImg2imgStrength:DEe,setInfillMethod:Uce,setIterations:LEe,setPerlin:$Ee,setPositivePrompt:FEe,setNegativePrompt:BEe,setScheduler:jEe,setSeamBlur:VEe,setSeamSize:zEe,setSeamSteps:UEe,setSeamStrength:GEe,setSeed:HEe,setSeedWeights:qEe,setShouldFitToWidthHeight:WEe,setShouldGenerateVariations:KEe,setShouldRandomizeSeed:YEe,setSteps:XEe,setThreshold:QEe,setTileSize:ZEe,setVariationAmount:JEe,setShouldUseSymmetry:ePe,setHorizontalSymmetrySteps:tPe,setVerticalSymmetrySteps:nPe,initialImageChanged:_h,modelChanged:xm,vaeSelected:MD,setShouldUseNoiseSettings:rPe,setSeamlessXAxis:iPe,setSeamlessYAxis:oPe,setClipSkip:U6,shouldUseCpuNoiseChanged:sPe}=RD.actions,Gce=RD.reducer,ND=["txt2img","img2img","unifiedCanvas","nodes","modelManager","batch"],G6=(e,t)=>{typeof t=="number"?e.activeTab=t:e.activeTab=ND.indexOf(t)},DD={activeTab:0,shouldPinParametersPanel:!0,shouldShowParametersPanel:!0,shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,addNewModelUIOption:null,shouldPinGallery:!0,shouldShowGallery:!0,shouldHidePreview:!1,shouldShowProgressInViewer:!0,shouldShowEmbeddingPicker:!1,shouldShowAdvancedOptions:!1,aspectRatio:null,favoriteSchedulers:[]},LD=jt({name:"ui",initialState:DD,reducers:{setActiveTab:(e,t)=>{G6(e,t.payload)},setShouldPinParametersPanel:(e,t)=>{e.shouldPinParametersPanel=t.payload,e.shouldShowParametersPanel=!0},setShouldShowParametersPanel:(e,t)=>{e.shouldShowParametersPanel=t.payload},setShouldShowImageDetails:(e,t)=>{e.shouldShowImageDetails=t.payload},setShouldUseCanvasBetaLayout:(e,t)=>{e.shouldUseCanvasBetaLayout=t.payload},setShouldHidePreview:(e,t)=>{e.shouldHidePreview=t.payload},setShouldShowExistingModelsInSearch:(e,t)=>{e.shouldShowExistingModelsInSearch=t.payload},setShouldUseSliders:(e,t)=>{e.shouldUseSliders=t.payload},setAddNewModelUIOption:(e,t)=>{e.addNewModelUIOption=t.payload},setShouldShowGallery:(e,t)=>{e.shouldShowGallery=t.payload},togglePinGalleryPanel:e=>{e.shouldPinGallery=!e.shouldPinGallery,e.shouldPinGallery||(e.shouldShowGallery=!0)},togglePinParametersPanel:e=>{e.shouldPinParametersPanel=!e.shouldPinParametersPanel,e.shouldPinParametersPanel||(e.shouldShowParametersPanel=!0)},toggleParametersPanel:e=>{e.shouldShowParametersPanel=!e.shouldShowParametersPanel},toggleGalleryPanel:e=>{e.shouldShowGallery=!e.shouldShowGallery},togglePanels:e=>{e.shouldShowGallery||e.shouldShowParametersPanel?(e.shouldShowGallery=!1,e.shouldShowParametersPanel=!1):(e.shouldShowGallery=!0,e.shouldShowParametersPanel=!0)},setShouldShowProgressInViewer:(e,t)=>{e.shouldShowProgressInViewer=t.payload},favoriteSchedulersChanged:(e,t)=>{e.favoriteSchedulers=t.payload},toggleEmbeddingPicker:e=>{e.shouldShowEmbeddingPicker=!e.shouldShowEmbeddingPicker},setShouldShowAdvancedOptions:(e,t)=>{e.shouldShowAdvancedOptions=t.payload},setAspectRatio:(e,t)=>{e.aspectRatio=t.payload}},extraReducers(e){e.addCase(_h,t=>{G6(t,"img2img")})}}),{setActiveTab:Hce,setShouldPinParametersPanel:aPe,setShouldShowParametersPanel:lPe,setShouldShowImageDetails:uPe,setShouldUseCanvasBetaLayout:qce,setShouldShowExistingModelsInSearch:cPe,setShouldUseSliders:dPe,setAddNewModelUIOption:fPe,setShouldHidePreview:hPe,setShouldShowGallery:pPe,togglePanels:gPe,togglePinGalleryPanel:mPe,togglePinParametersPanel:yPe,toggleParametersPanel:vPe,toggleGalleryPanel:bPe,setShouldShowProgressInViewer:SPe,favoriteSchedulersChanged:_Pe,toggleEmbeddingPicker:wPe,setShouldShowAdvancedOptions:Wce,setAspectRatio:$D}=LD.actions,Kce=LD.reducer,Oo=Hf.withTypes(),Ss={memoizeOptions:{resultEqualityCheck:lp}},_p=e=>e.system,Yce=e=>e.system.toastQueue;at(_p,e=>{const{model_list:t}=e,n=Ev(t,(r,i,o)=>(i.status==="active"&&(r=o),r),"");return{...t[n],name:n}},Ss);at(_p,e=>{const{model_list:t}=e;return hZ(t,(r,i)=>{if(r.format==="diffusers")return{name:i,...r}})},Ss);const xPe=at(_p,e=>e.language,Ss),CPe=at(e=>e,e=>e.system.isProcessing||!e.system.isConnected);var Lc={},FD={},Pl={};Object.defineProperty(Pl,"__esModule",{value:!0});Pl.ROARR_LOG_FORMAT_VERSION=Pl.ROARR_VERSION=void 0;Pl.ROARR_VERSION="5.0.0";Pl.ROARR_LOG_FORMAT_VERSION="2.0.0";var wp={};Object.defineProperty(wp,"__esModule",{value:!0});wp.logLevels=void 0;wp.logLevels={debug:20,error:50,fatal:60,info:30,trace:10,warn:40};var BD={},Qv={};Object.defineProperty(Qv,"__esModule",{value:!0});Qv.hasOwnProperty=void 0;const Xce=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);Qv.hasOwnProperty=Xce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasOwnProperty=void 0;var t=Qv;Object.defineProperty(e,"hasOwnProperty",{enumerable:!0,get:function(){return t.hasOwnProperty}})})(BD);var jD={},Zv={},l3={},Jv={};Object.defineProperty(Jv,"__esModule",{value:!0});Jv.boolean=void 0;const Qce=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return e.valueOf()===1;case"[object Boolean]":return e.valueOf();default:return!1}};Jv.boolean=Qce;var e1={};Object.defineProperty(e1,"__esModule",{value:!0});e1.isBooleanable=void 0;const Zce=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};e1.isBooleanable=Zce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isBooleanable=e.boolean=void 0;const t=Jv;Object.defineProperty(e,"boolean",{enumerable:!0,get:function(){return t.boolean}});const n=e1;Object.defineProperty(e,"isBooleanable",{enumerable:!0,get:function(){return n.isBooleanable}})})(l3);var t1={};Object.defineProperty(t1,"__esModule",{value:!0});t1.tokenize=void 0;const Jce=/(?:%(?([+0-]|-\+))?(?\d+)?(?\d+\$)?(?\.\d+)?(?[%BCESb-iosux]))|(\\%)/g,ede=e=>{let t;const n=[];let r=0,i=0,o=null;for(;(t=Jce.exec(e))!==null;){t.index>i&&(o={literal:e.slice(i,t.index),type:"literal"},n.push(o));const s=t[0];i=t.index+s.length,s==="\\%"||s==="%%"?o&&o.type==="literal"?o.literal+="%":(o={literal:"%",type:"literal"},n.push(o)):t.groups&&(o={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:s,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:r++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},n.push(o))}return i<=e.length-1&&(o&&o.type==="literal"?o.literal+=e.slice(i):n.push({literal:e.slice(i),type:"literal"})),n};t1.tokenize=ede;Object.defineProperty(Zv,"__esModule",{value:!0});Zv.createPrintf=void 0;const H6=l3,tde=t1,nde=(e,t)=>t.placeholder,rde=e=>{var t;const n=(o,s,a)=>a==="-"?o.padEnd(s," "):a==="-+"?((Number(o)>=0?"+":"")+o).padEnd(s," "):a==="+"?((Number(o)>=0?"+":"")+o).padStart(s," "):a==="0"?o.padStart(s,"0"):o.padStart(s," "),r=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:nde,i={};return(o,...s)=>{let a=i[o];a||(a=i[o]=tde.tokenize(o));let l="";for(const u of a)if(u.type==="literal")l+=u.literal;else{let c=s[u.position];if(c===void 0)l+=r(o,u,s);else if(u.conversion==="b")l+=H6.boolean(c)?"true":"false";else if(u.conversion==="B")l+=H6.boolean(c)?"TRUE":"FALSE";else if(u.conversion==="c")l+=c;else if(u.conversion==="C")l+=String(c).toUpperCase();else if(u.conversion==="i"||u.conversion==="d")c=String(Math.trunc(c)),u.width!==null&&(c=n(c,u.width,u.flag)),l+=c;else if(u.conversion==="e")l+=Number(c).toExponential();else if(u.conversion==="E")l+=Number(c).toExponential().toUpperCase();else if(u.conversion==="f")u.precision!==null&&(c=Number(c).toFixed(u.precision)),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="o")l+=(Number.parseInt(String(c),10)>>>0).toString(8);else if(u.conversion==="s")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="S")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=String(c).toUpperCase();else if(u.conversion==="u")l+=Number.parseInt(String(c),10)>>>0;else if(u.conversion==="x")c=(Number.parseInt(String(c),10)>>>0).toString(16),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else throw new Error("Unknown format specifier.")}return l}};Zv.createPrintf=rde;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=Zv;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()})(jD);var q6=Object.prototype.toString,VD=function(t){var n=q6.call(t),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&q6.call(t.callee)==="[object Function]"),r},s_,W6;function ide(){if(W6)return s_;W6=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=VD,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),s=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(f){var h=f.constructor;return h&&h.prototype===f},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!u["$"+f]&&t.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{l(window[f])}catch{return!0}}catch{return!0}return!1}(),d=function(f){if(typeof window>"u"||!c)return l(f);try{return l(f)}catch{return!1}};e=function(h){var p=h!==null&&typeof h=="object",g=n.call(h)==="[object Function]",S=r(h),v=p&&n.call(h)==="[object String]",y=[];if(!p&&!g&&!S)throw new TypeError("Object.keys called on a non-object");var m=s&&g;if(v&&h.length>0&&!t.call(h,0))for(var b=0;b0)for(var _=0;_"u"||!_n?je:_n(Uint8Array),hl={"%AggregateError%":typeof AggregateError>"u"?je:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?je:ArrayBuffer,"%ArrayIteratorPrototype%":su&&_n?_n([][Symbol.iterator]()):je,"%AsyncFromSyncIteratorPrototype%":je,"%AsyncFunction%":wu,"%AsyncGenerator%":wu,"%AsyncGeneratorFunction%":wu,"%AsyncIteratorPrototype%":wu,"%Atomics%":typeof Atomics>"u"?je:Atomics,"%BigInt%":typeof BigInt>"u"?je:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?je:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?je:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?je:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?je:Float32Array,"%Float64Array%":typeof Float64Array>"u"?je:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?je:FinalizationRegistry,"%Function%":UD,"%GeneratorFunction%":wu,"%Int8Array%":typeof Int8Array>"u"?je:Int8Array,"%Int16Array%":typeof Int16Array>"u"?je:Int16Array,"%Int32Array%":typeof Int32Array>"u"?je:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":su&&_n?_n(_n([][Symbol.iterator]())):je,"%JSON%":typeof JSON=="object"?JSON:je,"%Map%":typeof Map>"u"?je:Map,"%MapIteratorPrototype%":typeof Map>"u"||!su||!_n?je:_n(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?je:Promise,"%Proxy%":typeof Proxy>"u"?je:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?je:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?je:Set,"%SetIteratorPrototype%":typeof Set>"u"||!su||!_n?je:_n(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?je:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":su&&_n?_n(""[Symbol.iterator]()):je,"%Symbol%":su?Symbol:je,"%SyntaxError%":$c,"%ThrowTypeError%":Sde,"%TypedArray%":wde,"%TypeError%":sc,"%Uint8Array%":typeof Uint8Array>"u"?je:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?je:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?je:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?je:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?je:WeakMap,"%WeakRef%":typeof WeakRef>"u"?je:WeakRef,"%WeakSet%":typeof WeakSet>"u"?je:WeakSet};if(_n)try{null.error}catch(e){var xde=_n(_n(e));hl["%Error.prototype%"]=xde}var Cde=function e(t){var n;if(t==="%AsyncFunction%")n=l_("async function () {}");else if(t==="%GeneratorFunction%")n=l_("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=l_("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&_n&&(n=_n(i.prototype))}return hl[t]=n,n},Z6={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},xp=zD,Gy=bde,Tde=xp.call(Function.call,Array.prototype.concat),Ede=xp.call(Function.apply,Array.prototype.splice),J6=xp.call(Function.call,String.prototype.replace),Hy=xp.call(Function.call,String.prototype.slice),Pde=xp.call(Function.call,RegExp.prototype.exec),kde=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ade=/\\(\\)?/g,Ode=function(t){var n=Hy(t,0,1),r=Hy(t,-1);if(n==="%"&&r!=="%")throw new $c("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new $c("invalid intrinsic syntax, expected opening `%`");var i=[];return J6(t,kde,function(o,s,a,l){i[i.length]=a?J6(l,Ade,"$1"):s||o}),i},Rde=function(t,n){var r=t,i;if(Gy(Z6,r)&&(i=Z6[r],r="%"+i[0]+"%"),Gy(hl,r)){var o=hl[r];if(o===wu&&(o=Cde(r)),typeof o>"u"&&!n)throw new sc("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new $c("intrinsic "+t+" does not exist!")},Ide=function(t,n){if(typeof t!="string"||t.length===0)throw new sc("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new sc('"allowMissing" argument must be a boolean');if(Pde(/^%?[^%]*%?$/,t)===null)throw new $c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=Ode(t),i=r.length>0?r[0]:"",o=Rde("%"+i+"%",n),s=o.name,a=o.value,l=!1,u=o.alias;u&&(i=u[0],Ede(r,Tde([0,1],u)));for(var c=1,d=!0;c=r.length){var g=fl(a,f);d=!!g,d&&"get"in g&&!("originalValue"in g.get)?a=g.get:a=a[f]}else d=Gy(a,f),a=a[f];d&&!l&&(hl[s]=a)}}return a},Mde=Ide,Uw=Mde("%Object.defineProperty%",!0),Gw=function(){if(Uw)try{return Uw({},"a",{value:1}),!0}catch{return!1}return!1};Gw.hasArrayLengthDefineBug=function(){if(!Gw())return null;try{return Uw([],"length",{value:1}).length!==1}catch{return!0}};var Nde=Gw,Dde=ade,Lde=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",$de=Object.prototype.toString,Fde=Array.prototype.concat,GD=Object.defineProperty,Bde=function(e){return typeof e=="function"&&$de.call(e)==="[object Function]"},jde=Nde(),HD=GD&&jde,Vde=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!Bde(r)||!r())return}HD?GD(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n},qD=function(e,t){var n=arguments.length>2?arguments[2]:{},r=Dde(t);Lde&&(r=Fde.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i200)return v.sort();for(let y=1;ym;)v[b]=v[b-1],b--;v[b]=m}return v}const a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(v){return a.call(v)!==void 0&&v.length!==0}function u(v,y,m){v.length= 1`)}return m===void 0?1/0:m}function h(v){return v===1?"1 item":`${v} items`}function p(v){const y=new Set;for(const m of v)(typeof m=="string"||typeof m=="number")&&y.add(String(m));return y}function g(v){if(n.call(v,"strict")){const y=v.strict;if(typeof y!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(y)return m=>{let b=`Object can not safely be stringified. Received type ${typeof m}`;throw typeof m!="function"&&(b+=` (${m.toString()})`),new Error(b)}}}function S(v){v={...v};const y=g(v);y&&(v.bigint===void 0&&(v.bigint=!1),"circularValue"in v||(v.circularValue=Error));const m=c(v),b=d(v,"bigint"),_=d(v,"deterministic"),w=f(v,"maximumDepth"),x=f(v,"maximumBreadth");function C(N,T,O,I,M,R){let D=T[N];switch(typeof D=="object"&&D!==null&&typeof D.toJSON=="function"&&(D=D.toJSON(N)),D=I.call(T,N,D),typeof D){case"string":return o(D);case"object":{if(D===null)return"null";if(O.indexOf(D)!==-1)return m;let L="",V=",";const z=R;if(Array.isArray(D)){if(D.length===0)return"[]";if(wx){const ne=D.length-x-1;L+=`${V}"... ${h(ne)} not stringified"`}return M!==""&&(L+=` -${z}`),O.pop(),`[${L}]`}let U=Object.keys(D);const K=U.length;if(K===0)return"{}";if(wx){const q=K-x;L+=`${X}"...":${W}"${h(q)} not stringified"`,X=V}return M!==""&&X.length>1&&(L=` -${R}${L} -${z}`),O.pop(),`{${L}}`}case"number":return isFinite(D)?String(D):y?y(D):"null";case"boolean":return D===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(D);default:return y?y(D):void 0}}function k(N,T,O,I,M,R){switch(typeof T=="object"&&T!==null&&typeof T.toJSON=="function"&&(T=T.toJSON(N)),typeof T){case"string":return o(T);case"object":{if(T===null)return"null";if(O.indexOf(T)!==-1)return m;const D=R;let L="",V=",";if(Array.isArray(T)){if(T.length===0)return"[]";if(wx){const F=T.length-x-1;L+=`${V}"... ${h(F)} not stringified"`}return M!==""&&(L+=` -${D}`),O.pop(),`[${L}]`}O.push(T);let z="";M!==""&&(R+=M,V=`, -${R}`,z=" ");let U="";for(const K of I){const W=k(K,T[K],O,I,M,R);W!==void 0&&(L+=`${U}${o(K)}:${z}${W}`,U=V)}return M!==""&&U.length>1&&(L=` -${R}${L} -${D}`),O.pop(),`{${L}}`}case"number":return isFinite(T)?String(T):y?y(T):"null";case"boolean":return T===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(T);default:return y?y(T):void 0}}function P(N,T,O,I,M){switch(typeof T){case"string":return o(T);case"object":{if(T===null)return"null";if(typeof T.toJSON=="function"){if(T=T.toJSON(N),typeof T!="object")return P(N,T,O,I,M);if(T===null)return"null"}if(O.indexOf(T)!==-1)return m;const R=M;if(Array.isArray(T)){if(T.length===0)return"[]";if(wx){const J=T.length-x-1;W+=`${X}"... ${h(J)} not stringified"`}return W+=` -${R}`,O.pop(),`[${W}]`}let D=Object.keys(T);const L=D.length;if(L===0)return"{}";if(wx){const W=L-x;z+=`${U}"...": "${h(W)} not stringified"`,U=V}return U!==""&&(z=` -${M}${z} -${R}`),O.pop(),`{${z}}`}case"number":return isFinite(T)?String(T):y?y(T):"null";case"boolean":return T===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(T);default:return y?y(T):void 0}}function A(N,T,O){switch(typeof T){case"string":return o(T);case"object":{if(T===null)return"null";if(typeof T.toJSON=="function"){if(T=T.toJSON(N),typeof T!="object")return A(N,T,O);if(T===null)return"null"}if(O.indexOf(T)!==-1)return m;let I="";if(Array.isArray(T)){if(T.length===0)return"[]";if(wx){const K=T.length-x-1;I+=`,"... ${h(K)} not stringified"`}return O.pop(),`[${I}]`}let M=Object.keys(T);const R=M.length;if(R===0)return"{}";if(wx){const V=R-x;I+=`${D}"...":"${h(V)} not stringified"`}return O.pop(),`{${I}}`}case"number":return isFinite(T)?String(T):y?y(T):"null";case"boolean":return T===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(T);default:return y?y(T):void 0}}function $(N,T,O){if(arguments.length>1){let I="";if(typeof O=="number"?I=" ".repeat(Math.min(O,10)):typeof O=="string"&&(I=O.slice(0,10)),T!=null){if(typeof T=="function")return C("",{"":N},[],T,I,"");if(Array.isArray(T))return k("",N,[],p(T),I,"")}if(I.length!==0)return P("",N,[],I,"")}return A("",N,[])}return $}})(Hw,Hw.exports);var Xde=Hw.exports;(function(e){var t=Ne&&Ne.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(e,"__esModule",{value:!0}),e.createLogger=void 0;const n=Pl,r=wp,i=BD,o=jD,s=t(u3),a=t(Xde);let l=!1;const u=(0,s.default)(),c=()=>u.ROARR,d=()=>({messageContext:{},transforms:[]}),f=()=>{const m=c().asyncLocalStorage;if(!m)throw new Error("AsyncLocalContext is unavailable.");const b=m.getStore();return b||d()},h=()=>!!c().asyncLocalStorage,p=()=>{if(h()){const m=f();return(0,i.hasOwnProperty)(m,"sequenceRoot")&&(0,i.hasOwnProperty)(m,"sequence")&&typeof m.sequence=="number"?String(m.sequenceRoot)+"."+String(m.sequence++):String(c().sequence++)}return String(c().sequence++)},g=(m,b)=>(_,w,x,C,k,P,A,$,N,T)=>{m.child({logLevel:b})(_,w,x,C,k,P,A,$,N,T)},S=1e3,v=(m,b)=>(_,w,x,C,k,P,A,$,N,T)=>{const O=(0,a.default)({a:_,b:w,c:x,d:C,e:k,f:P,g:A,h:$,i:N,j:T,logLevel:b});if(!O)throw new Error("Expected key to be a string");const I=c().onceLog;I.has(O)||(I.add(O),I.size>S&&I.clear(),m.child({logLevel:b})(_,w,x,C,k,P,A,$,N,T))},y=(m,b={},_=[])=>{const w=(x,C,k,P,A,$,N,T,O,I)=>{const M=Date.now(),R=p();let D;h()?D=f():D=d();let L,V;if(typeof x=="string"?L={...D.messageContext,...b}:L={...D.messageContext,...b,...x},typeof x=="string"&&C===void 0)V=x;else if(typeof x=="string"){if(!x.includes("%"))throw new Error("When a string parameter is followed by other arguments, then it is assumed that you are attempting to format a message using printf syntax. You either forgot to add printf bindings or if you meant to add context to the log message, pass them in an object as the first parameter.");V=(0,o.printf)(x,C,k,P,A,$,N,T,O,I)}else{let U=C;if(typeof C!="string")if(C===void 0)U="";else throw new TypeError("Message must be a string. Received "+typeof C+".");V=(0,o.printf)(U,k,P,A,$,N,T,O,I)}let z={context:L,message:V,sequence:R,time:M,version:n.ROARR_LOG_FORMAT_VERSION};for(const U of[...D.transforms,..._])if(z=U(z),typeof z!="object"||z===null)throw new Error("Message transform function must return a message object.");m(z)};return w.child=x=>{let C;return h()?C=f():C=d(),typeof x=="function"?(0,e.createLogger)(m,{...C.messageContext,...b,...x},[x,..._]):(0,e.createLogger)(m,{...C.messageContext,...b,...x},_)},w.getContext=()=>{let x;return h()?x=f():x=d(),{...x.messageContext,...b}},w.adopt=async(x,C)=>{if(!h())return l===!1&&(l=!0,m({context:{logLevel:r.logLevels.warn,package:"roarr"},message:"async_hooks are unavailable; Roarr.adopt will not function as expected",sequence:p(),time:Date.now(),version:n.ROARR_LOG_FORMAT_VERSION})),x();const k=f();let P;(0,i.hasOwnProperty)(k,"sequenceRoot")&&(0,i.hasOwnProperty)(k,"sequence")&&typeof k.sequence=="number"?P=k.sequenceRoot+"."+String(k.sequence++):P=String(c().sequence++);let A={...k.messageContext};const $=[...k.transforms];typeof C=="function"?$.push(C):A={...A,...C};const N=c().asyncLocalStorage;if(!N)throw new Error("Async local context unavailable.");return N.run({messageContext:A,sequence:0,sequenceRoot:P,transforms:$},()=>x())},w.debug=g(w,r.logLevels.debug),w.debugOnce=v(w,r.logLevels.debug),w.error=g(w,r.logLevels.error),w.errorOnce=v(w,r.logLevels.error),w.fatal=g(w,r.logLevels.fatal),w.fatalOnce=v(w,r.logLevels.fatal),w.info=g(w,r.logLevels.info),w.infoOnce=v(w,r.logLevels.info),w.trace=g(w,r.logLevels.trace),w.traceOnce=v(w,r.logLevels.trace),w.warn=g(w,r.logLevels.warn),w.warnOnce=v(w,r.logLevels.warn),w};e.createLogger=y})(FD);var n1={},Qde=function(t,n){for(var r=t.split("."),i=n.split("."),o=0;o<3;o++){var s=Number(r[o]),a=Number(i[o]);if(s>a)return 1;if(a>s)return-1;if(!isNaN(s)&&isNaN(a))return 1;if(isNaN(s)&&!isNaN(a))return-1}return 0},Zde=Ne&&Ne.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n1,"__esModule",{value:!0});n1.createRoarrInitialGlobalStateBrowser=void 0;const ek=Pl,tk=Zde(Qde),Jde=e=>{const t=(e.versions||[]).concat();return t.length>1&&t.sort(tk.default),t.includes(ek.ROARR_VERSION)||t.push(ek.ROARR_VERSION),t.sort(tk.default),{sequence:0,...e,versions:t}};n1.createRoarrInitialGlobalStateBrowser=Jde;var r1={};Object.defineProperty(r1,"__esModule",{value:!0});r1.getLogLevelName=void 0;const efe=e=>e<=10?"trace":e<=20?"debug":e<=30?"info":e<=40?"warn":e<=50?"error":"fatal";r1.getLogLevelName=efe;(function(e){var t=Ne&&Ne.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.getLogLevelName=e.logLevels=e.Roarr=e.ROARR=void 0;const n=FD,r=n1,o=(0,t(u3).default)(),s=(0,r.createRoarrInitialGlobalStateBrowser)(o.ROARR||{});e.ROARR=s,o.ROARR=s;const a=d=>JSON.stringify(d),l=(0,n.createLogger)(d=>{var f;s.write&&s.write(((f=s.serializeMessage)!==null&&f!==void 0?f:a)(d))});e.Roarr=l;var u=wp;Object.defineProperty(e,"logLevels",{enumerable:!0,get:function(){return u.logLevels}});var c=r1;Object.defineProperty(e,"getLogLevelName",{enumerable:!0,get:function(){return c.getLogLevelName}})})(Lc);var c3={},i1={},o1={};Object.defineProperty(o1,"__esModule",{value:!0});o1.createLogMethods=void 0;var tfe=function(){return{debug:console.debug.bind(console),error:console.error.bind(console),fatal:console.error.bind(console),info:console.info.bind(console),trace:console.debug.bind(console),warn:console.warn.bind(console)}};o1.createLogMethods=tfe;var ZD={},Cp={},d3={},s1={},a1={};Object.defineProperty(a1,"__esModule",{value:!0});a1.convertWildcardToRegex=void 0;var nfe=/\*+/g,rfe=function(e){return new RegExp(e.replace(nfe,"(.+?)"))};a1.convertWildcardToRegex=rfe;var Tp={};Object.defineProperty(Tp,"__esModule",{value:!0});Tp.escapeRegexString=void 0;var ife=/[$()*+.?[\\\]^{|}]/g,ofe=/-/g,sfe=function(e){return e.replace(ife,"\\$&").replace(ofe,"\\x2d")};Tp.escapeRegexString=sfe;var l1={};Object.defineProperty(l1,"__esModule",{value:!0});l1.parseRegex=void 0;var afe=/(\/?)(.+)\1([a-z]*)/,lfe=/^(?!.*?(.).*?\1)[AJUXgimsux]+$/,ufe=function(e){var t=afe.exec(e);if(!t)throw new Error("Invalid RegExp.");return t[3]&&!lfe.test(t[3])?new RegExp(e):new RegExp(t[2],t[3])};l1.parseRegex=ufe;Object.defineProperty(s1,"__esModule",{value:!0});s1.createStringTest=void 0;var cfe=a1,dfe=Tp,ffe=l1,c_=function(e,t){var n;return e[t]?n=e[t]:n=e[t]=(0,ffe.parseRegex)(t),function(r){var i,o;return(o=(i=r.match(n))===null||i===void 0?void 0:i[0])!==null&&o!==void 0?o:!1}},hfe=function(e,t){if(t.type!=="Tag")throw new Error("Expected a tag expression.");var n=t.expression;if(n.type==="RangeExpression")throw new Error("Unexpected range expression.");if(n.type==="RegexExpression")return c_(e,n.value);if(n.type!=="LiteralExpression")throw new Error("Expected a literal expression.");var r=String(n.value);return r.includes("*")&&n.quoted===!1?c_(e,String((0,cfe.convertWildcardToRegex)(r))+(n.quoted?"u":"ui")):c_(e,"/("+(0,dfe.escapeRegexString)(r)+")/"+(n.quoted?"u":"ui"))};s1.createStringTest=hfe;var u1={};Object.defineProperty(u1,"__esModule",{value:!0});u1.testComparisonRange=void 0;var pfe=function(e,t,n){switch(n){case":=":return t===e;case":>":return t>e;case":<":return t=":return t>=e;case":<=":return t<=e;default:throw new Error("Unimplemented comparison operator: ".concat(n))}};u1.testComparisonRange=pfe;var c1={};Object.defineProperty(c1,"__esModule",{value:!0});c1.testRange=void 0;var gfe=function(e,t){return typeof e=="number"?!(et.max||e===t.max&&!t.maxInclusive):!1};c1.testRange=gfe;(function(e){var t=Ne&&Ne.__assign||function(){return t=Object.assign||function(c){for(var d,f=1,h=arguments.length;f0?{path:l.path,query:new RegExp("("+l.keywords.map(function(u){return(0,vfe.escapeRegexString)(u.trim())}).join("|")+")")}:{path:l.path}})};d1.highlight=Sfe;var f1={},JD={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(Ne,function(){function t(u,c,d){return this.id=++t.highestId,this.name=u,this.symbols=c,this.postprocess=d,this}t.highestId=0,t.prototype.toString=function(u){var c=typeof u>"u"?this.symbols.map(l).join(" "):this.symbols.slice(0,u).map(l).join(" ")+" ● "+this.symbols.slice(u).map(l).join(" ");return this.name+" → "+c};function n(u,c,d,f){this.rule=u,this.dot=c,this.reference=d,this.data=[],this.wantedBy=f,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var c=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return c.left=this,c.right=u,c.isComplete&&(c.data=c.build(),c.right=void 0),c},n.prototype.build=function(){var u=[],c=this;do u.push(c.right.data),c=c.left;while(c.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,s.fail))};function r(u,c){this.grammar=u,this.index=c,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var c=this.states,d=this.wants,f=this.completed,h=0;h0&&c.push(" ^ "+f+" more lines identical to this"),f=0,c.push(" "+g)),d=g}},s.prototype.getSymbolDisplay=function(u){return a(u)},s.prototype.buildFirstStateStack=function(u,c){if(c.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var d=u.wantedBy[0],f=[u].concat(c),h=this.buildFirstStateStack(d,f);return h===null?null:[u].concat(h)},s.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},s.prototype.restore=function(u){var c=u.index;this.current=c,this.table[c]=u,this.table.splice(c+1),this.lexerState=u.lexerState,this.results=this.finish()},s.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},s.prototype.finish=function(){var u=[],c=this.grammar.start,d=this.table[this.table.length-1];return d.states.forEach(function(f){f.rule.name===c&&f.dot===f.rule.symbols.length&&f.reference===0&&f.data!==s.fail&&u.push(f)}),u.map(function(f){return f.data})};function a(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function l(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:s,Grammar:i,Rule:t}})})(JD);var _fe=JD.exports,kl={},eL={},Ma={};Ma.__esModule=void 0;Ma.__esModule=!0;var wfe=typeof Object.setPrototypeOf=="function",xfe=typeof Object.getPrototypeOf=="function",Cfe=typeof Object.defineProperty=="function",Tfe=typeof Object.create=="function",Efe=typeof Object.prototype.hasOwnProperty=="function",Pfe=function(t,n){wfe?Object.setPrototypeOf(t,n):t.__proto__=n};Ma.setPrototypeOf=Pfe;var kfe=function(t){return xfe?Object.getPrototypeOf(t):t.__proto__||t.prototype};Ma.getPrototypeOf=kfe;var nk=!1,Afe=function e(t,n,r){if(Cfe&&!nk)try{Object.defineProperty(t,n,r)}catch{nk=!0,e(t,n,r)}else t[n]=r.value};Ma.defineProperty=Afe;var tL=function(t,n){return Efe?t.hasOwnProperty(t,n):t[n]===void 0};Ma.hasOwnProperty=tL;var Ofe=function(t,n){if(Tfe)return Object.create(t,n);var r=function(){};r.prototype=t;var i=new r;if(typeof n>"u")return i;if(typeof n=="null")throw new Error("PropertyDescriptors must not be null.");if(typeof n=="object")for(var o in n)tL(n,o)&&(i[o]=n[o].value);return i};Ma.objectCreate=Ofe;(function(e){e.__esModule=void 0,e.__esModule=!0;var t=Ma,n=t.setPrototypeOf,r=t.getPrototypeOf,i=t.defineProperty,o=t.objectCreate,s=new Error().toString()==="[object Error]",a="";function l(u){var c=this.constructor,d=c.name||function(){var S=c.toString().match(/^function\s*([^\s(]+)/);return S===null?a||"Error":S[1]}(),f=d==="Error",h=f?a:d,p=Error.apply(this,arguments);if(n(p,r(this)),!(p instanceof c)||!(p instanceof l)){var p=this;Error.apply(this,arguments),i(p,"message",{configurable:!0,enumerable:!1,value:u,writable:!0})}if(i(p,"name",{configurable:!0,enumerable:!1,value:h,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(p,f?l:c),p.stack===void 0){var g=new Error(u);g.name=p.name,p.stack=g.stack}return s&&i(p,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(typeof this.message>"u"?"":": "+this.message)},writable:!0}),p}a=l.name||"ExtendableError",l.prototype=o(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),e.ExtendableError=l,e.default=e.ExtendableError})(eL);var nL=Ne&&Ne.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(kl,"__esModule",{value:!0});kl.SyntaxError=kl.LiqeError=void 0;var Rfe=eL,rL=function(e){nL(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Rfe.ExtendableError);kl.LiqeError=rL;var Ife=function(e){nL(t,e);function t(n,r,i,o){var s=e.call(this,n)||this;return s.message=n,s.offset=r,s.line=i,s.column=o,s}return t}(rL);kl.SyntaxError=Ife;var f3={},qy=Ne&&Ne.__assign||function(){return qy=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$2"]},{name:"comparison_operator$subexpression$1$string$3",symbols:[{literal:":"},{literal:"<"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$3"]},{name:"comparison_operator$subexpression$1$string$4",symbols:[{literal:":"},{literal:">"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$4"]},{name:"comparison_operator$subexpression$1$string$5",symbols:[{literal:":"},{literal:"<"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$5"]},{name:"comparison_operator",symbols:["comparison_operator$subexpression$1"],postprocess:function(e,t){return{location:{start:t,end:t+e[0][0].length},type:"ComparisonOperator",operator:e[0][0]}}},{name:"regex",symbols:["regex_body","regex_flags"],postprocess:function(e){return e.join("")}},{name:"regex_body$ebnf$1",symbols:[]},{name:"regex_body$ebnf$1",symbols:["regex_body$ebnf$1","regex_body_char"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_body",symbols:[{literal:"/"},"regex_body$ebnf$1",{literal:"/"}],postprocess:function(e){return"/"+e[1].join("")+"/"}},{name:"regex_body_char",symbols:[/[^\\]/],postprocess:jo},{name:"regex_body_char",symbols:[{literal:"\\"},/[^\\]/],postprocess:function(e){return"\\"+e[1]}},{name:"regex_flags",symbols:[]},{name:"regex_flags$ebnf$1",symbols:[/[gmiyusd]/]},{name:"regex_flags$ebnf$1",symbols:["regex_flags$ebnf$1",/[gmiyusd]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_flags",symbols:["regex_flags$ebnf$1"],postprocess:function(e){return e[0].join("")}},{name:"unquoted_value$ebnf$1",symbols:[]},{name:"unquoted_value$ebnf$1",symbols:["unquoted_value$ebnf$1",/[a-zA-Z\.\-_*@#$]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"unquoted_value",symbols:[/[a-zA-Z_*@#$]/,"unquoted_value$ebnf$1"],postprocess:function(e){return e[0]+e[1].join("")}}],ParserStart:"main"};f3.default=Mfe;var iL={},h1={},Ep={};Object.defineProperty(Ep,"__esModule",{value:!0});Ep.isSafePath=void 0;var Nfe=/^(\.(?:[_a-zA-Z][a-zA-Z\d_]*|\0|[1-9]\d*))+$/u,Dfe=function(e){return Nfe.test(e)};Ep.isSafePath=Dfe;Object.defineProperty(h1,"__esModule",{value:!0});h1.createGetValueFunctionBody=void 0;var Lfe=Ep,$fe=function(e){if(!(0,Lfe.isSafePath)(e))throw new Error("Unsafe path.");var t="return subject"+e;return t.replace(/(\.(\d+))/g,".[$2]").replace(/\./g,"?.")};h1.createGetValueFunctionBody=$fe;(function(e){var t=Ne&&Ne.__assign||function(){return t=Object.assign||function(o){for(var s,a=1,l=arguments.length;a\d+) col (?\d+)/,Ufe=function(e){if(e.trim()==="")return{location:{end:0,start:0},type:"EmptyExpression"};var t=new sL.default.Parser(Vfe),n;try{n=t.feed(e).results}catch(o){if(typeof(o==null?void 0:o.message)=="string"&&typeof(o==null?void 0:o.offset)=="number"){var r=o.message.match(zfe);throw r?new Ffe.SyntaxError("Syntax error at line ".concat(r.groups.line," column ").concat(r.groups.column),o.offset,Number(r.groups.line),Number(r.groups.column)):o}throw o}if(n.length===0)throw new Error("Found no parsings.");if(n.length>1)throw new Error("Ambiguous results.");var i=(0,jfe.hydrateAst)(n[0]);return i};f1.parse=Ufe;var p1={};Object.defineProperty(p1,"__esModule",{value:!0});p1.test=void 0;var Gfe=Cp,Hfe=function(e,t){return(0,Gfe.filter)(e,[t]).length===1};p1.test=Hfe;var aL={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=void 0;var t=function(o,s){return s==="double"?'"'.concat(o,'"'):s==="single"?"'".concat(o,"'"):o},n=function(o){if(o.type==="LiteralExpression")return o.quoted&&typeof o.value=="string"?t(o.value,o.quotes):String(o.value);if(o.type==="RegexExpression")return String(o.value);if(o.type==="RangeExpression"){var s=o.range,a=s.min,l=s.max,u=s.minInclusive,c=s.maxInclusive;return"".concat(u?"[":"{").concat(a," TO ").concat(l).concat(c?"]":"}")}if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")},r=function(o){if(o.type!=="Tag")throw new Error("Expected a tag expression.");var s=o.field,a=o.expression,l=o.operator;if(s.type==="ImplicitField")return n(a);var u=s.quoted?t(s.name,s.quotes):s.name,c=" ".repeat(a.location.start-l.location.end);return u+l.operator+c+n(a)},i=function(o){if(o.type==="ParenthesizedExpression"){if(!("location"in o.expression))throw new Error("Expected location in expression.");if(!o.location.end)throw new Error("Expected location end.");var s=" ".repeat(o.expression.location.start-(o.location.start+1)),a=" ".repeat(o.location.end-o.expression.location.end-1);return"(".concat(s).concat((0,e.serialize)(o.expression)).concat(a,")")}if(o.type==="Tag")return r(o);if(o.type==="LogicalExpression"){var l="";return o.operator.type==="BooleanOperator"?(l+=" ".repeat(o.operator.location.start-o.left.location.end),l+=o.operator.operator,l+=" ".repeat(o.right.location.start-o.operator.location.end)):l=" ".repeat(o.right.location.start-o.left.location.end),"".concat((0,e.serialize)(o.left)).concat(l).concat((0,e.serialize)(o.right))}if(o.type==="UnaryOperator")return(o.operator==="NOT"?"NOT ":o.operator)+(0,e.serialize)(o.operand);if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")};e.serialize=i})(aL);var g1={};Object.defineProperty(g1,"__esModule",{value:!0});g1.isSafeUnquotedExpression=void 0;var qfe=function(e){return/^[#$*@A-Z_a-z][#$*.@A-Z_a-z-]*$/.test(e)};g1.isSafeUnquotedExpression=qfe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isSafeUnquotedExpression=e.serialize=e.SyntaxError=e.LiqeError=e.test=e.parse=e.highlight=e.filter=void 0;var t=Cp;Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return t.filter}});var n=d1;Object.defineProperty(e,"highlight",{enumerable:!0,get:function(){return n.highlight}});var r=f1;Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return r.parse}});var i=p1;Object.defineProperty(e,"test",{enumerable:!0,get:function(){return i.test}});var o=kl;Object.defineProperty(e,"LiqeError",{enumerable:!0,get:function(){return o.LiqeError}}),Object.defineProperty(e,"SyntaxError",{enumerable:!0,get:function(){return o.SyntaxError}});var s=aL;Object.defineProperty(e,"serialize",{enumerable:!0,get:function(){return s.serialize}});var a=g1;Object.defineProperty(e,"isSafeUnquotedExpression",{enumerable:!0,get:function(){return a.isSafeUnquotedExpression}})})(ZD);var Wfe=Ne&&Ne.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i0?h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(a.message," %O"),g,S,v,d):h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(a.message),g,S,v)}}};i1.createLogWriter=nhe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createLogWriter=void 0;var t=i1;Object.defineProperty(e,"createLogWriter",{enumerable:!0,get:function(){return t.createLogWriter}})})(c3);const uL={package:"@invoke-ai/invoke-ai-ui"};Lc.ROARR.write=c3.createLogWriter();let ve=Lc.Roarr.child(uL);const rhe={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},TPe=["trace","debug","info","warn","error","fatal"],ihe=at(_p,e=>{const{app_version:t,consoleLogLevel:n,shouldLogToConsole:r}=e;return{version:t,consoleLogLevel:n,shouldLogToConsole:r}},{memoizeOptions:{resultEqualityCheck:lp}}),EPe=()=>{const{version:e,consoleLogLevel:t,shouldLogToConsole:n}=Zf(ihe);return E.useEffect(()=>{n?(localStorage.setItem("ROARR_LOG","true"),localStorage.setItem("ROARR_FILTER",`context.logLevel:>=${rhe[t]}`)):localStorage.setItem("ROARR_LOG","false"),Lc.ROARR.write=c3.createLogWriter()},[t,n]),E.useEffect(()=>{const r={...uL};e&&(r.version=e),ve=Lc.Roarr.child(r)},[e]),ve};let or=[],h3=(e,t)=>{let n=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},l:t||0,lc:0,listen(i,o){return r.lc=n.push(i,o||r.l)/2,()=>{let s=n.indexOf(i);~s&&(n.splice(s,2),r.lc--,r.lc||r.off())}},notify(i){let o=!or.length;for(let s=0;s(e.events=e.events||{},e.events[n+wg]||(e.events[n+wg]=r(i=>{e.events[n].reduceRight((o,s)=>(s(o),o),{shared:{},...i})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let i=e.events[n],o=i.indexOf(t);i.splice(o,1),i.length||(delete e.events[n],e.events[n+wg](),delete e.events[n+wg])}),ahe=1e3,lhe=(e,t)=>she(e,r=>{let i=t(r);i&&e.events[_g].push(i)},ohe,r=>{let i=e.listen;e.listen=(...s)=>(!e.lc&&!e.active&&(e.active=!0,r()),i(...s));let o=e.off;return e.events[_g]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let s of e.events[_g])s();e.events[_g]=[]}},ahe)},()=>{e.listen=i,e.off=o}}),uhe=(e,t)=>{Array.isArray(e)||(e=[e]);let n,r=()=>{let o=e.map(s=>s.get());(n===void 0||o.some((s,a)=>s!==n[a]))&&(n=o,i.set(t(...o)))},i=h3(void 0,Math.max(...e.map(o=>o.l))+1);return lhe(i,()=>{let o=e.map(s=>s.listen(r,i.l));return r(),()=>{for(let s of o)s()}}),i};const che={"Content-Type":"application/json"},dhe=/\/*$/;function fhe(e){const t=new URLSearchParams;if(e&&typeof e=="object")for(const[n,r]of Object.entries(e))r!=null&&t.set(n,r);return t.toString()}function hhe(e){return JSON.stringify(e)}function phe(e,t){let n=`${t.baseUrl?t.baseUrl.replace(dhe,""):""}${e}`;if(t.params.path)for(const[r,i]of Object.entries(t.params.path))n=n.replace(`{${r}}`,encodeURIComponent(String(i)));if(t.params.query){const r=t.querySerializer(t.params.query);r&&(n+=`?${r}`)}return n}function ghe(e={}){const{fetch:t=globalThis.fetch,querySerializer:n,bodySerializer:r,...i}=e,o=new Headers({...che,...i.headers??{}});async function s(a,l){const{headers:u,body:c,params:d={},parseAs:f="json",querySerializer:h=n??fhe,bodySerializer:p=r??hhe,...g}=l||{},S=phe(a,{baseUrl:i.baseUrl,params:d,querySerializer:h}),v=new Headers(o),y=new Headers(u);for(const[w,x]of y.entries())x==null?v.delete(w):v.set(w,x);const m={redirect:"follow",...i,...g,headers:v};c&&(m.body=p(c)),m.body instanceof FormData&&v.delete("Content-Type");const b=await t(S,m);if(b.status===204||b.headers.get("Content-Length")==="0")return b.ok?{data:{},response:b}:{error:{},response:b};if(b.ok){let w=b.body;if(f!=="stream"){const x=b.clone();w=typeof x[f]=="function"?await x[f]():await x.text()}return{data:w,response:b}}let _={};try{_=await b.clone().json()}catch{_=await b.clone().text()}return{error:_,response:b}}return{async get(a,l){return s(a,{...l,method:"GET"})},async put(a,l){return s(a,{...l,method:"PUT"})},async post(a,l){return s(a,{...l,method:"POST"})},async del(a,l){return s(a,{...l,method:"DELETE"})},async options(a,l){return s(a,{...l,method:"OPTIONS"})},async head(a,l){return s(a,{...l,method:"HEAD"})},async patch(a,l){return s(a,{...l,method:"PATCH"})},async trace(a,l){return s(a,{...l,method:"TRACE"})}}}const wh=h3(),xh=h3(),Ro=uhe([wh,xh],(e,t)=>ghe({headers:e?{Authorization:`Bearer ${e}`}:{},baseUrl:`${t??""}`}));ve.child({namespace:"session"});const zn=Oo("api/sessionCreated",async(e,{rejectWithValue:t})=>{const{graph:n}=e,{post:r}=Ro.get(),{data:i,error:o,response:s}=await r("/api/v1/sessions/",{body:n});return o?t({arg:e,error:o}):i}),mhe=e=>Pn(e)&&"status"in e,Pp=Oo("api/sessionInvoked",async(e,{rejectWithValue:t})=>{const{session_id:n}=e,{put:r}=Ro.get(),{data:i,error:o,response:s}=await r("/api/v1/sessions/{session_id}/invoke",{params:{query:{all:!0},path:{session_id:n}}});if(o)return mhe(o)&&o.status===403?t({arg:e,error:o.body.detail}):t({arg:e,error:o})}),zl=Oo("api/sessionCanceled",async(e,{rejectWithValue:t})=>{const{session_id:n}=e,{del:r}=Ro.get(),{data:i,error:o,response:s}=await r("/api/v1/sessions/{session_id}/invoke",{params:{path:{session_id:n}}});return o?t({arg:e,error:o}):i});Oo("api/listSessions",async(e,{rejectWithValue:t})=>{const{params:n}=e,{get:r}=Ro.get(),{data:i,error:o,response:s}=await r("/api/v1/sessions/",{params:n});return o?t({arg:e,error:o}):i});const cL=ys(zn.rejected,Pp.rejected),au=(e,t,n,r,i,o,s)=>{const a=Math.floor(e/2-(n+i/2)*s),l=Math.floor(t/2-(r+o/2)*s);return{x:a,y:l}},lu=(e,t,n,r,i=.95)=>{const o=e*i/n,s=t*i/r;return Math.min(1,Math.min(o,s))},PPe=.999,kPe=.1,APe=20,kd=.95,OPe=30,RPe=10,ik=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),za=e=>{const{width:t,height:n}=e,r={width:t,height:n},i=512*512,o=t/n;let s=t*n,a=448;for(;s1?(r.width=a,r.height=to(a/o,64)):o<1&&(r.height=a,r.width=to(a*o,64)),s=r.width*r.height;return r},yhe=e=>({width:to(e.width,64),height:to(e.height,64)}),IPe=[{label:"Base",value:"base"},{label:"Mask",value:"mask"}],MPe=[{label:"Auto",value:"auto"},{label:"Manual",value:"manual"},{label:"None",value:"none"}],dL=e=>e.kind==="line"&&e.layer==="mask",NPe=e=>e.kind==="line"&&e.layer==="base",qw=e=>e.kind==="image"&&e.layer==="base",DPe=e=>e.kind==="fillRect"&&e.layer==="base",LPe=e=>e.kind==="eraseRect"&&e.layer==="base",vhe=e=>e.kind==="line",xu={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},fL={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"auto",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,canvasContainerDimensions:{width:0,height:0},colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,doesCanvasNeedScaling:!1,futureLayerStates:[],isCanvasInitialized:!1,isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:xu,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAntialias:!0,shouldAutoSave:!1,shouldCropToBoundingBoxOnSave:!1,shouldDarkenOutsideBoundingBox:!1,shouldLockBoundingBox:!1,shouldPreserveMaskedArea:!1,shouldRestrictStrokesToBox:!0,shouldShowBoundingBox:!0,shouldShowBrush:!0,shouldShowBrushPreview:!1,shouldShowCanvasDebugInfo:!1,shouldShowCheckboardTransparency:!1,shouldShowGrid:!0,shouldShowIntermediates:!0,shouldShowStagingImage:!0,shouldShowStagingOutline:!0,shouldSnapToGrid:!0,stageCoordinates:{x:0,y:0},stageDimensions:{width:0,height:0},stageScale:1,tool:"brush"},hL=jt({name:"canvas",initialState:fL,reducers:{setTool:(e,t)=>{const n=t.payload;e.tool=t.payload,n!=="move"&&(e.isTransformingBoundingBox=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1)},setLayer:(e,t)=>{e.layer=t.payload},toggleTool:e=>{const t=e.tool;t!=="move"&&(e.tool=t==="brush"?"eraser":"brush")},setMaskColor:(e,t)=>{e.maskColor=t.payload},setBrushColor:(e,t)=>{e.brushColor=t.payload},setBrushSize:(e,t)=>{e.brushSize=t.payload},clearMask:e=>{e.pastLayerStates.push(Kn(e.layerState)),e.layerState.objects=e.layerState.objects.filter(t=>!dL(t)),e.futureLayerStates=[],e.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:e=>{e.shouldPreserveMaskedArea=!e.shouldPreserveMaskedArea},toggleShouldShowMask:e=>{e.isMaskEnabled=!e.isMaskEnabled},setShouldPreserveMaskedArea:(e,t)=>{e.shouldPreserveMaskedArea=t.payload},setIsMaskEnabled:(e,t)=>{e.isMaskEnabled=t.payload,e.layer=t.payload?"mask":"base"},setShouldShowCheckboardTransparency:(e,t)=>{e.shouldShowCheckboardTransparency=t.payload},setShouldShowBrushPreview:(e,t)=>{e.shouldShowBrushPreview=t.payload},setShouldShowBrush:(e,t)=>{e.shouldShowBrush=t.payload},setCursorPosition:(e,t)=>{e.cursorPosition=t.payload},setInitialCanvasImage:(e,t)=>{const n=t.payload,{width:r,height:i}=n,{stageDimensions:o}=e,s={width:Wd(Zo(r,64,512),64),height:Wd(Zo(i,64,512),64)},a={x:to(r/2-s.width/2,64),y:to(i/2-s.height/2,64)};if(e.boundingBoxScaleMethod==="auto"){const c=za(s);e.scaledBoundingBoxDimensions=c}e.boundingBoxDimensions=s,e.boundingBoxCoordinates=a,e.pastLayerStates.push(Kn(e.layerState)),e.layerState={...xu,objects:[{kind:"image",layer:"base",x:0,y:0,width:r,height:i,imageName:n.image_name}]},e.futureLayerStates=[],e.isCanvasInitialized=!1;const l=lu(o.width,o.height,r,i,kd),u=au(o.width,o.height,0,0,r,i,l);e.stageScale=l,e.stageCoordinates=u,e.doesCanvasNeedScaling=!0},setBoundingBoxDimensions:(e,t)=>{const n=yhe(t.payload);if(e.boundingBoxDimensions=n,e.boundingBoxScaleMethod==="auto"){const r=za(n);e.scaledBoundingBoxDimensions=r}},flipBoundingBoxAxes:e=>{const[t,n]=[e.boundingBoxDimensions.width,e.boundingBoxDimensions.height];e.boundingBoxDimensions={width:n,height:t}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=ik(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=t.payload},setDoesCanvasNeedScaling:(e,t)=>{e.doesCanvasNeedScaling=t.payload},setStageScale:(e,t)=>{e.stageScale=t.payload},setShouldDarkenOutsideBoundingBox:(e,t)=>{e.shouldDarkenOutsideBoundingBox=t.payload},setIsDrawing:(e,t)=>{e.isDrawing=t.payload},clearCanvasHistory:e=>{e.pastLayerStates=[],e.futureLayerStates=[]},setShouldLockBoundingBox:(e,t)=>{e.shouldLockBoundingBox=t.payload},toggleShouldLockBoundingBox:e=>{e.shouldLockBoundingBox=!e.shouldLockBoundingBox},setShouldShowBoundingBox:(e,t)=>{e.shouldShowBoundingBox=t.payload},setIsTransformingBoundingBox:(e,t)=>{e.isTransformingBoundingBox=t.payload},setIsMovingBoundingBox:(e,t)=>{e.isMovingBoundingBox=t.payload},setIsMouseOverBoundingBox:(e,t)=>{e.isMouseOverBoundingBox=t.payload},setIsMoveBoundingBoxKeyHeld:(e,t)=>{e.isMoveBoundingBoxKeyHeld=t.payload},setIsMoveStageKeyHeld:(e,t)=>{e.isMoveStageKeyHeld=t.payload},canvasSessionIdChanged:(e,t)=>{e.layerState.stagingArea.sessionId=t.payload},stagingAreaInitialized:(e,t)=>{const{sessionId:n,boundingBox:r}=t.payload;e.layerState.stagingArea={boundingBox:r,sessionId:n,images:[],selectedImageIndex:-1}},addImageToStagingArea:(e,t)=>{const n=t.payload;!n||!e.layerState.stagingArea.boundingBox||(e.pastLayerStates.push(Kn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea.images.push({kind:"image",layer:"base",...e.layerState.stagingArea.boundingBox,imageName:n.image_name}),e.layerState.stagingArea.selectedImageIndex=e.layerState.stagingArea.images.length-1,e.futureLayerStates=[])},discardStagedImages:e=>{e.pastLayerStates.push(Kn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea={...xu.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingOutline=!0},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(Kn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"fillRect",layer:"base",...t,...n,color:r}),e.futureLayerStates=[]},addEraseRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n}=e;e.pastLayerStates.push(Kn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"eraseRect",layer:"base",...t,...n}),e.futureLayerStates=[]},addLine:(e,t)=>{const{tool:n,layer:r,brushColor:i,brushSize:o,shouldRestrictStrokesToBox:s}=e;if(n==="move"||n==="colorPicker")return;const a=o/2,l=r==="base"&&n==="brush"?{color:i}:{};e.pastLayerStates.push(Kn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const u={kind:"line",layer:r,tool:n,strokeWidth:a,points:t.payload,...l};s&&(u.clip={...e.boundingBoxCoordinates,...e.boundingBoxDimensions}),e.layerState.objects.push(u),e.futureLayerStates=[]},addPointToCurrentLine:(e,t)=>{const n=e.layerState.objects.findLast(vhe);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(Kn(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(Kn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState=t)},setShouldShowGrid:(e,t)=>{e.shouldShowGrid=t.payload},setIsMovingStage:(e,t)=>{e.isMovingStage=t.payload},setShouldSnapToGrid:(e,t)=>{e.shouldSnapToGrid=t.payload},setShouldAutoSave:(e,t)=>{e.shouldAutoSave=t.payload},setShouldShowIntermediates:(e,t)=>{e.shouldShowIntermediates=t.payload},resetCanvas:e=>{e.pastLayerStates.push(Kn(e.layerState)),e.layerState=xu,e.futureLayerStates=[]},setCanvasContainerDimensions:(e,t)=>{e.canvasContainerDimensions=t.payload},resizeAndScaleCanvas:e=>{const{width:t,height:n}=e.canvasContainerDimensions,r=e.layerState.objects.find(qw),i={width:Math.floor(t),height:Math.floor(n)};if(!r){const c=lu(i.width,i.height,512,512,kd),d=au(i.width,i.height,0,0,512,512,c),f={width:512,height:512};if(e.stageScale=c,e.stageCoordinates=d,e.stageDimensions=i,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=f,e.boundingBoxScaleMethod==="auto"){const h=za(f);e.scaledBoundingBoxDimensions=h}return}const{width:o,height:s}=r,l=lu(t,n,o,s,.95),u=au(i.width,i.height,0,0,o,s,l);e.minimumStageScale=l,e.stageScale=l,e.stageCoordinates=ik(u),e.stageDimensions=i,e.isCanvasInitialized=!0},resizeCanvas:e=>{const{width:t,height:n}=e.canvasContainerDimensions,r={width:Math.floor(t),height:Math.floor(n)};if(e.stageDimensions=r,!e.layerState.objects.find(qw)){const i=lu(r.width,r.height,512,512,kd),o=au(r.width,r.height,0,0,512,512,i),s={width:512,height:512};if(e.stageScale=i,e.stageCoordinates=o,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=s,e.boundingBoxScaleMethod==="auto"){const a=za(s);e.scaledBoundingBoxDimensions=a}}},resetCanvasView:(e,t)=>{const{contentRect:n,shouldScaleTo1:r}=t.payload,{stageDimensions:{width:i,height:o}}=e,{x:s,y:a,width:l,height:u}=n;if(l!==0&&u!==0){const c=r?1:lu(i,o,l,u,kd),d=au(i,o,s,a,l,u,c);e.stageScale=c,e.stageCoordinates=d}else{const c=lu(i,o,512,512,kd),d=au(i,o,0,0,512,512,c),f={width:512,height:512};if(e.stageScale=c,e.stageCoordinates=d,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=f,e.boundingBoxScaleMethod==="auto"){const h=za(f);e.scaledBoundingBoxDimensions=h}}},nextStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex,n=e.layerState.stagingArea.images.length;e.layerState.stagingArea.selectedImageIndex=Math.min(t+1,n-1)},prevStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex;e.layerState.stagingArea.selectedImageIndex=Math.max(t-1,0)},commitStagingAreaImage:(e,t)=>{if(!e.layerState.stagingArea.images.length)return;const{images:n,selectedImageIndex:r}=e.layerState.stagingArea;e.pastLayerStates.push(Kn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({...n[r]}),e.layerState.stagingArea={...xu.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0},fitBoundingBoxToStage:e=>{const{boundingBoxDimensions:t,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=e,o=r.width/i,s=r.height/i;if(n.x<0||n.x+t.width>o||n.y<0||n.y+t.height>s){const a={width:Wd(Zo(o,64,512),64),height:Wd(Zo(s,64,512),64)},l={x:to(o/2-a.width/2,64),y:to(s/2-a.height/2,64)};if(e.boundingBoxDimensions=a,e.boundingBoxCoordinates=l,e.boundingBoxScaleMethod==="auto"){const u=za(a);e.scaledBoundingBoxDimensions=u}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,t.payload==="auto"){const n=za(e.boundingBoxDimensions);e.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(e,t)=>{e.scaledBoundingBoxDimensions=t.payload},setShouldShowStagingImage:(e,t)=>{e.shouldShowStagingImage=t.payload},setShouldShowStagingOutline:(e,t)=>{e.shouldShowStagingOutline=t.payload},setShouldShowCanvasDebugInfo:(e,t)=>{e.shouldShowCanvasDebugInfo=t.payload},setShouldRestrictStrokesToBox:(e,t)=>{e.shouldRestrictStrokesToBox=t.payload},setShouldAntialias:(e,t)=>{e.shouldAntialias=t.payload},setShouldCropToBoundingBoxOnSave:(e,t)=>{e.shouldCropToBoundingBoxOnSave=t.payload},setColorPickerColor:(e,t)=>{e.colorPickerColor=t.payload},commitColorPickerColor:e=>{e.brushColor={...e.colorPickerColor,a:e.brushColor.a},e.tool="brush"},setMergedCanvas:(e,t)=>{e.pastLayerStates.push(Kn(e.layerState)),e.futureLayerStates=[],e.layerState.objects=[t.payload]},resetCanvasInteractionState:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMoveBoundingBoxKeyHeld=!1,e.isMoveStageKeyHeld=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1,e.isTransformingBoundingBox=!1},mouseLeftCanvas:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isTransformingBoundingBox=!1}},extraReducers:e=>{e.addCase(zl.pending,t=>{t.layerState.stagingArea.images.length||(t.layerState.stagingArea=xu.stagingArea)}),e.addCase(qce,(t,n)=>{t.doesCanvasNeedScaling=!0}),e.addCase(Hce,(t,n)=>{t.doesCanvasNeedScaling=!0}),e.addCase($D,(t,n)=>{const r=n.payload;r&&(t.boundingBoxDimensions.height=to(t.boundingBoxDimensions.width/r,64))})}}),{addEraseRect:$Pe,addFillRect:FPe,addImageToStagingArea:bhe,addLine:BPe,addPointToCurrentLine:jPe,clearCanvasHistory:VPe,clearMask:zPe,commitColorPickerColor:UPe,commitStagingAreaImage:She,discardStagedImages:GPe,fitBoundingBoxToStage:HPe,mouseLeftCanvas:qPe,nextStagingAreaImage:WPe,prevStagingAreaImage:KPe,redo:YPe,resetCanvas:pL,resetCanvasInteractionState:XPe,resetCanvasView:QPe,resizeAndScaleCanvas:ZPe,resizeCanvas:JPe,setBoundingBoxCoordinates:e6e,setBoundingBoxDimensions:t6e,setBoundingBoxPreviewFill:n6e,setBoundingBoxScaleMethod:r6e,flipBoundingBoxAxes:i6e,setBrushColor:o6e,setBrushSize:s6e,setCanvasContainerDimensions:a6e,setColorPickerColor:l6e,setCursorPosition:u6e,setDoesCanvasNeedScaling:c6e,setInitialCanvasImage:gL,setIsDrawing:d6e,setIsMaskEnabled:f6e,setIsMouseOverBoundingBox:h6e,setIsMoveBoundingBoxKeyHeld:p6e,setIsMoveStageKeyHeld:g6e,setIsMovingBoundingBox:m6e,setIsMovingStage:y6e,setIsTransformingBoundingBox:v6e,setLayer:b6e,setMaskColor:S6e,setMergedCanvas:_he,setShouldAutoSave:_6e,setShouldCropToBoundingBoxOnSave:w6e,setShouldDarkenOutsideBoundingBox:x6e,setShouldLockBoundingBox:C6e,setShouldPreserveMaskedArea:T6e,setShouldShowBoundingBox:E6e,setShouldShowBrush:P6e,setShouldShowBrushPreview:k6e,setShouldShowCanvasDebugInfo:A6e,setShouldShowCheckboardTransparency:O6e,setShouldShowGrid:R6e,setShouldShowIntermediates:I6e,setShouldShowStagingImage:M6e,setShouldShowStagingOutline:N6e,setShouldSnapToGrid:D6e,setStageCoordinates:L6e,setStageScale:$6e,setTool:F6e,toggleShouldLockBoundingBox:B6e,toggleTool:j6e,undo:V6e,setScaledBoundingBoxDimensions:z6e,setShouldRestrictStrokesToBox:U6e,stagingAreaInitialized:whe,canvasSessionIdChanged:xhe,setShouldAntialias:G6e}=hL.actions,Che=hL.reducer,The=(e,t)=>{const n=new Date(e),r=new Date(t);return n>r?1:n0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]"u"||navigator.onLine===void 0?!0:navigator.onLine}function Dhe(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}var lk=Fi;function vL(e,t){if(e===t||!(lk(e)&&lk(t)||Array.isArray(e)&&Array.isArray(t)))return t;for(var n=Object.keys(t),r=Object.keys(e),i=n.length===r.length,o=Array.isArray(t)?[]:{},s=0,a=n;s=200&&e.status<=299},$he=function(e){return/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"")};function ck(e){if(!Fi(e))return e;for(var t=Ut({},e),n=0,r=Object.entries(t);n"u"&&a===uk&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(m,b){return Xy(t,null,function(){var _,w,x,C,k,P,A,$,N,T,O,I,M,R,D,L,V,z,U,K,W,X,F,q,Q,J,ne,Z,me,ae,oe,Ce,se,qe,yt,$e;return Wy(this,function(Fe){switch(Fe.label){case 0:return _=b.signal,w=b.getState,x=b.extra,C=b.endpoint,k=b.forced,P=b.type,$=typeof m=="string"?{url:m}:m,N=$.url,T=$.headers,O=T===void 0?new Headers(v.headers):T,I=$.params,M=I===void 0?void 0:I,R=$.responseHandler,D=R===void 0?g??"json":R,L=$.validateStatus,V=L===void 0?S??Lhe:L,z=$.timeout,U=z===void 0?p:z,K=sk($,["url","headers","params","responseHandler","validateStatus","timeout"]),W=Ut(uo(Ut({},v),{signal:_}),K),O=new Headers(ck(O)),X=W,[4,o(O,{getState:w,extra:x,endpoint:C,forced:k,type:P})];case 1:X.headers=Fe.sent()||O,F=function(Ie){return typeof Ie=="object"&&(Fi(Ie)||Array.isArray(Ie)||typeof Ie.toJSON=="function")},!W.headers.has("content-type")&&F(W.body)&&W.headers.set("content-type",f),F(W.body)&&c(W.headers)&&(W.body=JSON.stringify(W.body,h)),M&&(q=~N.indexOf("?")?"&":"?",Q=l?l(M):new URLSearchParams(ck(M)),N+=q+Q),N=Mhe(r,N),J=new Request(N,W),ne=J.clone(),A={request:ne},me=!1,ae=U&&setTimeout(function(){me=!0,b.abort()},U),Fe.label=2;case 2:return Fe.trys.push([2,4,5,6]),[4,a(J)];case 3:return Z=Fe.sent(),[3,6];case 4:return oe=Fe.sent(),[2,{error:{status:me?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(oe)},meta:A}];case 5:return ae&&clearTimeout(ae),[7];case 6:Ce=Z.clone(),A.response=Ce,qe="",Fe.label=7;case 7:return Fe.trys.push([7,9,,10]),[4,Promise.all([y(Z,D).then(function(Ie){return se=Ie},function(Ie){return yt=Ie}),Ce.text().then(function(Ie){return qe=Ie},function(){})])];case 8:if(Fe.sent(),yt)throw yt;return[3,10];case 9:return $e=Fe.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:Z.status,data:qe,error:String($e)},meta:A}];case 10:return[2,V(Z,se)?{data:se,meta:A}:{error:{status:Z.status,data:se},meta:A}]}})})};function y(m,b){return Xy(this,null,function(){var _;return Wy(this,function(w){switch(w.label){case 0:return typeof b=="function"?[2,b(m)]:(b==="content-type"&&(b=c(m.headers)?"json":"text"),b!=="json"?[3,2]:[4,m.text()]);case 1:return _=w.sent(),[2,_.length?JSON.parse(_):null];case 2:return[2,m.text()]}})})}}var dk=function(){function e(t,n){n===void 0&&(n=void 0),this.value=t,this.meta=n}return e}(),p3=ge("__rtkq/focused"),bL=ge("__rtkq/unfocused"),g3=ge("__rtkq/online"),SL=ge("__rtkq/offline"),Co;(function(e){e.query="query",e.mutation="mutation"})(Co||(Co={}));function _L(e){return e.type===Co.query}function Bhe(e){return e.type===Co.mutation}function wL(e,t,n,r,i,o){return jhe(e)?e(t,n,r,i).map(Ww).map(o):Array.isArray(e)?e.map(Ww).map(o):[]}function jhe(e){return typeof e=="function"}function Ww(e){return typeof e=="string"?{type:e}:e}function d_(e){return e!=null}var Ch=Symbol("forceQueryFn"),Kw=function(e){return typeof e[Ch]=="function"};function Vhe(e){var t=e.serializeQueryArgs,n=e.queryThunk,r=e.mutationThunk,i=e.api,o=e.context,s=new Map,a=new Map,l=i.internalActions,u=l.unsubscribeQueryResult,c=l.removeMutationResult,d=l.updateSubscriptionOptions;return{buildInitiateQuery:y,buildInitiateMutation:m,getRunningQueryThunk:p,getRunningMutationThunk:g,getRunningQueriesThunk:S,getRunningMutationsThunk:v,getRunningOperationPromises:h,removalWarning:f};function f(){throw new Error(`This method had to be removed due to a conceptual bug in RTK. - Please see https://github.com/reduxjs/redux-toolkit/pull/2481 for details. - See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for new guidance on SSR.`)}function h(){typeof process<"u";var b=function(_){return Array.from(_.values()).flatMap(function(w){return w?Object.values(w):[]})};return Ky(Ky([],b(s)),b(a)).filter(d_)}function p(b,_){return function(w){var x,C=o.endpointDefinitions[b],k=t({queryArgs:_,endpointDefinition:C,endpointName:b});return(x=s.get(w))==null?void 0:x[k]}}function g(b,_){return function(w){var x;return(x=a.get(w))==null?void 0:x[_]}}function S(){return function(b){return Object.values(s.get(b)||{}).filter(d_)}}function v(){return function(b){return Object.values(a.get(b)||{}).filter(d_)}}function y(b,_){var w=function(x,C){var k=C===void 0?{}:C,P=k.subscribe,A=P===void 0?!0:P,$=k.forceRefetch,N=k.subscriptionOptions,T=Ch,O=k[T];return function(I,M){var R,D,L=t({queryArgs:x,endpointDefinition:_,endpointName:b}),V=n((R={type:"query",subscribe:A,forceRefetch:$,subscriptionOptions:N,endpointName:b,originalArgs:x,queryCacheKey:L},R[Ch]=O,R)),z=i.endpoints[b].select(x),U=I(V),K=z(M()),W=U.requestId,X=U.abort,F=K.requestId!==W,q=(D=s.get(I))==null?void 0:D[L],Q=function(){return z(M())},J=Object.assign(O?U.then(Q):F&&!q?Promise.resolve(K):Promise.all([q,U]).then(Q),{arg:x,requestId:W,subscriptionOptions:N,queryCacheKey:L,abort:X,unwrap:function(){return Xy(this,null,function(){var Z;return Wy(this,function(me){switch(me.label){case 0:return[4,J];case 1:if(Z=me.sent(),Z.isError)throw Z.error;return[2,Z.data]}})})},refetch:function(){return I(w(x,{subscribe:!1,forceRefetch:!0}))},unsubscribe:function(){A&&I(u({queryCacheKey:L,requestId:W}))},updateSubscriptionOptions:function(Z){J.subscriptionOptions=Z,I(d({endpointName:b,requestId:W,queryCacheKey:L,options:Z}))}});if(!q&&!F&&!O){var ne=s.get(I)||{};ne[L]=J,s.set(I,ne),J.then(function(){delete ne[L],Object.keys(ne).length||s.delete(I)})}return J}};return w}function m(b){return function(_,w){var x=w===void 0?{}:w,C=x.track,k=C===void 0?!0:C,P=x.fixedCacheKey;return function(A,$){var N=r({type:"mutation",endpointName:b,originalArgs:_,track:k,fixedCacheKey:P}),T=A(N),O=T.requestId,I=T.abort,M=T.unwrap,R=T.unwrap().then(function(z){return{data:z}}).catch(function(z){return{error:z}}),D=function(){A(c({requestId:O,fixedCacheKey:P}))},L=Object.assign(R,{arg:T.arg,requestId:O,abort:I,unwrap:M,unsubscribe:D,reset:D}),V=a.get(A)||{};return a.set(A,V),V[O]=L,L.then(function(){delete V[O],Object.keys(V).length||a.delete(A)}),P&&(V[P]=L,L.then(function(){V[P]===L&&(delete V[P],Object.keys(V).length||a.delete(A))})),L}}}}function fk(e){return e}function zhe(e){var t=this,n=e.reducerPath,r=e.baseQuery,i=e.context.endpointDefinitions,o=e.serializeQueryArgs,s=e.api,a=function(m,b,_){return function(w){var x=i[m];w(s.internalActions.queryResultPatched({queryCacheKey:o({queryArgs:b,endpointDefinition:x,endpointName:m}),patches:_}))}},l=function(m,b,_){return function(w,x){var C,k,P=s.endpoints[m].select(b)(x()),A={patches:[],inversePatches:[],undo:function(){return w(s.util.patchQueryData(m,b,A.inversePatches))}};if(P.status===Tt.uninitialized)return A;if("data"in P)if(Ar(P.data)){var $=qC(P.data,_),N=$[1],T=$[2];(C=A.patches).push.apply(C,N),(k=A.inversePatches).push.apply(k,T)}else{var O=_(P.data);A.patches.push({op:"replace",path:[],value:O}),A.inversePatches.push({op:"replace",path:[],value:P.data})}return w(s.util.patchQueryData(m,b,A.patches)),A}},u=function(m,b,_){return function(w){var x;return w(s.endpoints[m].initiate(b,(x={subscribe:!1,forceRefetch:!0},x[Ch]=function(){return{data:_}},x)))}},c=function(m,b){return Xy(t,[m,b],function(_,w){var x,C,k,P,A,$,N,T,O,I,M,R,D,L,V,z,U,K,W=w.signal,X=w.abort,F=w.rejectWithValue,q=w.fulfillWithValue,Q=w.dispatch,J=w.getState,ne=w.extra;return Wy(this,function(Z){switch(Z.label){case 0:x=i[_.endpointName],Z.label=1;case 1:return Z.trys.push([1,8,,13]),C=fk,k=void 0,P={signal:W,abort:X,dispatch:Q,getState:J,extra:ne,endpoint:_.endpointName,type:_.type,forced:_.type==="query"?d(_,J()):void 0},A=_.type==="query"?_[Ch]:void 0,A?(k=A(),[3,6]):[3,2];case 2:return x.query?[4,r(x.query(_.originalArgs),P,x.extraOptions)]:[3,4];case 3:return k=Z.sent(),x.transformResponse&&(C=x.transformResponse),[3,6];case 4:return[4,x.queryFn(_.originalArgs,P,x.extraOptions,function(me){return r(me,P,x.extraOptions)})];case 5:k=Z.sent(),Z.label=6;case 6:if(typeof process<"u",k.error)throw new dk(k.error,k.meta);return M=q,[4,C(k.data,k.meta,_.originalArgs)];case 7:return[2,M.apply(void 0,[Z.sent(),(U={fulfilledTimeStamp:Date.now(),baseQueryMeta:k.meta},U[nl]=!0,U)])];case 8:if(R=Z.sent(),D=R,!(D instanceof dk))return[3,12];L=fk,x.query&&x.transformErrorResponse&&(L=x.transformErrorResponse),Z.label=9;case 9:return Z.trys.push([9,11,,12]),V=F,[4,L(D.value,D.meta,_.originalArgs)];case 10:return[2,V.apply(void 0,[Z.sent(),(K={baseQueryMeta:D.meta},K[nl]=!0,K)])];case 11:return z=Z.sent(),D=z,[3,12];case 12:throw typeof process<"u",console.error(D),D;case 13:return[2]}})})};function d(m,b){var _,w,x,C,k=(w=(_=b[n])==null?void 0:_.queries)==null?void 0:w[m.queryCacheKey],P=(x=b[n])==null?void 0:x.config.refetchOnMountOrArgChange,A=k==null?void 0:k.fulfilledTimeStamp,$=(C=m.forceRefetch)!=null?C:m.subscribe&&P;return $?$===!0||(Number(new Date)-Number(A))/1e3>=$:!1}var f=Hf(n+"/executeQuery",c,{getPendingMeta:function(){var m;return m={startedTimeStamp:Date.now()},m[nl]=!0,m},condition:function(m,b){var _=b.getState,w,x,C,k=_(),P=(x=(w=k[n])==null?void 0:w.queries)==null?void 0:x[m.queryCacheKey],A=P==null?void 0:P.fulfilledTimeStamp,$=m.originalArgs,N=P==null?void 0:P.originalArgs,T=i[m.endpointName];return Kw(m)?!0:(P==null?void 0:P.status)==="pending"?!1:d(m,k)||_L(T)&&((C=T==null?void 0:T.forceRefetch)!=null&&C.call(T,{currentArg:$,previousArg:N,endpointState:P,state:k}))?!0:!A},dispatchConditionRejection:!0}),h=Hf(n+"/executeMutation",c,{getPendingMeta:function(){var m;return m={startedTimeStamp:Date.now()},m[nl]=!0,m}}),p=function(m){return"force"in m},g=function(m){return"ifOlderThan"in m},S=function(m,b,_){return function(w,x){var C=p(_)&&_.force,k=g(_)&&_.ifOlderThan,P=function(T){return T===void 0&&(T=!0),s.endpoints[m].initiate(b,{forceRefetch:T})},A=s.endpoints[m].select(b)(x());if(C)w(P());else if(k){var $=A==null?void 0:A.fulfilledTimeStamp;if(!$){w(P());return}var N=(Number(new Date)-Number(new Date($)))/1e3>=k;N&&w(P())}else w(P(!1))}};function v(m){return function(b){var _,w;return((w=(_=b==null?void 0:b.meta)==null?void 0:_.arg)==null?void 0:w.endpointName)===m}}function y(m,b){return{matchPending:Zu(gv(m),v(b)),matchFulfilled:Zu(Aa(m),v(b)),matchRejected:Zu(Cc(m),v(b))}}return{queryThunk:f,mutationThunk:h,prefetch:S,updateQueryData:l,upsertQueryData:u,patchQueryData:a,buildMatchThunkActions:y}}function xL(e,t,n,r){return wL(n[e.meta.arg.endpointName][t],Aa(e)?e.payload:void 0,tp(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function xg(e,t,n){var r=e[t];r&&n(r)}function Th(e){var t;return(t="arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)!=null?t:e.requestId}function hk(e,t,n){var r=e[Th(t)];r&&n(r)}var Ad={};function Uhe(e){var t=e.reducerPath,n=e.queryThunk,r=e.mutationThunk,i=e.context,o=i.endpointDefinitions,s=i.apiUid,a=i.extractRehydrationInfo,l=i.hasRehydrationInfo,u=e.assertTagType,c=e.config,d=ge(t+"/resetApiState"),f=jt({name:t+"/queries",initialState:Ad,reducers:{removeQueryResult:{reducer:function(_,w){var x=w.payload.queryCacheKey;delete _[x]},prepare:lm()},queryResultPatched:function(_,w){var x=w.payload,C=x.queryCacheKey,k=x.patches;xg(_,C,function(P){P.data=z2(P.data,k.concat())})}},extraReducers:function(_){_.addCase(n.pending,function(w,x){var C=x.meta,k=x.meta.arg,P,A,$=Kw(k);(k.subscribe||$)&&((A=w[P=k.queryCacheKey])!=null||(w[P]={status:Tt.uninitialized,endpointName:k.endpointName})),xg(w,k.queryCacheKey,function(N){N.status=Tt.pending,N.requestId=$&&N.requestId?N.requestId:C.requestId,k.originalArgs!==void 0&&(N.originalArgs=k.originalArgs),N.startedTimeStamp=C.startedTimeStamp})}).addCase(n.fulfilled,function(w,x){var C=x.meta,k=x.payload;xg(w,C.arg.queryCacheKey,function(P){var A;if(!(P.requestId!==C.requestId&&!Kw(C.arg))){var $=o[C.arg.endpointName].merge;if(P.status=Tt.fulfilled,$)if(P.data!==void 0){var N=C.fulfilledTimeStamp,T=C.arg,O=C.baseQueryMeta,I=C.requestId,M=Pa(P.data,function(R){return $(R,k,{arg:T.originalArgs,baseQueryMeta:O,fulfilledTimeStamp:N,requestId:I})});P.data=M}else P.data=k;else P.data=(A=o[C.arg.endpointName].structuralSharing)==null||A?vL(cr(P.data)?BC(P.data):P.data,k):k;delete P.error,P.fulfilledTimeStamp=C.fulfilledTimeStamp}})}).addCase(n.rejected,function(w,x){var C=x.meta,k=C.condition,P=C.arg,A=C.requestId,$=x.error,N=x.payload;xg(w,P.queryCacheKey,function(T){if(!k){if(T.requestId!==A)return;T.status=Tt.rejected,T.error=N??$}})}).addMatcher(l,function(w,x){for(var C=a(x).queries,k=0,P=Object.entries(C);k{const r=xh.get(),i=wh.get();return Fhe({baseUrl:`${r??""}/api/v1`,prepareHeaders:s=>(i&&s.set("Authorization",`Bearer ${i}`),s)})(e,t,n)},To=Spe({baseQuery:wpe,reducerPath:"api",tagTypes:_pe,endpoints:()=>({})}),Eh=To.injectEndpoints({endpoints:e=>({listBoards:e.query({query:t=>({url:"boards/",params:t}),providesTags:(t,n,r)=>{const i=[{type:"Board",id:an}];return t&&i.push(...t.items.map(({board_id:o})=>({type:"Board",id:o}))),i}}),listAllBoards:e.query({query:()=>({url:"boards/",params:{all:!0}}),providesTags:(t,n,r)=>{const i=[{type:"Board",id:an}];return t&&i.push(...t.map(({board_id:o})=>({type:"Board",id:o}))),i}}),createBoard:e.mutation({query:t=>({url:"boards/",method:"POST",params:{board_name:t}}),invalidatesTags:[{type:"Board",id:an}]}),updateBoard:e.mutation({query:({board_id:t,changes:n})=>({url:`boards/${t}`,method:"PATCH",body:n}),invalidatesTags:(t,n,r)=>[{type:"Board",id:r.board_id}]}),deleteBoard:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE"}),invalidatesTags:(t,n,r)=>[{type:"Board",id:r}]}),deleteBoardAndImages:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE",params:{include_images:!0}}),invalidatesTags:(t,n,r)=>[{type:"Board",id:r},{type:"Image",id:an}]})})}),{useListBoardsQuery:H6e,useListAllBoardsQuery:q6e,useCreateBoardMutation:W6e,useUpdateBoardMutation:K6e,useDeleteBoardMutation:xpe,useDeleteBoardAndImagesMutation:Y6e}=Eh,Ji=ka({selectId:e=>e.image_name,sortComparer:(e,t)=>The(t.updated_at,e.updated_at)}),m1=["general"],y1=["control","mask","user","other"],xk=100,X6e=20,TL=Ji.getInitialState({offset:0,limit:0,total:0,isLoading:!0,isFetching:!0,selection:[],shouldAutoSwitch:!0,galleryImageMinimumWidth:96,galleryView:"images",selectedBoardId:"all",isInitialized:!1,batchImageNames:[],isBatchEnabled:!1}),EL=jt({name:"gallery",initialState:TL,reducers:{imageUpserted:(e,t)=>{Ji.upsertOne(e,t.payload),e.shouldAutoSwitch&&t.payload.image_category==="general"&&(e.selection=[t.payload.image_name],e.galleryView="images",e.selectedBoardId="all")},imageUpdatedOne:(e,t)=>{Ji.updateOne(e,t.payload)},imageRemoved:(e,t)=>{Ji.removeOne(e,t.payload),e.batchImageNames=e.batchImageNames.filter(n=>n!==t.payload)},imagesRemoved:(e,t)=>{Ji.removeMany(e,t.payload),e.batchImageNames=e.batchImageNames.filter(n=>!t.payload.includes(n))},imageRangeEndSelected:(e,t)=>{const n=t.payload,r=e.selection[e.selection.length-1],i=m3(e),o=i.findIndex(a=>a.image_name===r),s=i.findIndex(a=>a.image_name===n);if(o>-1&&s>-1){const a=Math.min(o,s),l=Math.max(o,s),u=i.slice(a,l+1).map(c=>c.image_name);e.selection=LS(e.selection.concat(u))}},imageSelectionToggled:(e,t)=>{e.selection.includes(t.payload)&&e.selection.length>1?e.selection=e.selection.filter(n=>n!==t.payload):e.selection=LS(e.selection.concat(t.payload))},imageSelected:(e,t)=>{e.selection=t.payload?[t.payload]:[]},shouldAutoSwitchChanged:(e,t)=>{e.shouldAutoSwitch=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},setGalleryView:(e,t)=>{e.galleryView=t.payload},boardIdSelected:(e,t)=>{e.selectedBoardId=t.payload},isLoadingChanged:(e,t)=>{e.isLoading=t.payload},isBatchEnabledChanged:(e,t)=>{e.isBatchEnabled=t.payload},imagesAddedToBatch:(e,t)=>{e.batchImageNames=LS(e.batchImageNames.concat(t.payload))},imagesRemovedFromBatch:(e,t)=>{e.batchImageNames=e.batchImageNames.filter(r=>!t.payload.includes(r));const n=e.selection.filter(r=>!t.payload.includes(r));if(n.length){e.selection=n;return}e.selection=[e.batchImageNames[0]]},batchReset:e=>{e.batchImageNames=[],e.selection=[]}},extraReducers:e=>{e.addCase(la.pending,t=>{t.isFetching=!0}),e.addCase(la.rejected,t=>{t.isFetching=!1}),e.addCase(la.fulfilled,(t,n)=>{t.isFetching=!1;const{board_id:r,categories:i,image_origin:o,is_intermediate:s}=n.meta.arg,{items:a,offset:l,limit:u,total:c}=n.payload;Ji.upsertMany(t,a),t.selection.length===0&&a.length&&(t.selection=[a[0].image_name]),!(!(i!=null&&i.includes("general"))||r)&&(t.offset=l,t.total=c)}),e.addCase(b3.fulfilled,(t,n)=>{const{image_name:r,image_url:i,thumbnail_url:o}=n.payload;Ji.updateOne(t,{id:r,changes:{image_url:i,thumbnail_url:o}})}),e.addMatcher(Eh.endpoints.deleteBoard.matchFulfilled,(t,n)=>{n.meta.arg.originalArgs===t.selectedBoardId&&(t.selectedBoardId="all")})}}),{selectAll:PL,selectById:Za,selectEntities:Q6e,selectIds:Z6e,selectTotal:J6e}=Ji.getSelectors(e=>e.gallery),{imageUpserted:v1,imageUpdatedOne:Cpe,imageRemoved:Tpe,imagesRemoved:Epe,imageRangeEndSelected:eke,imageSelectionToggled:tke,imageSelected:pl,shouldAutoSwitchChanged:nke,setGalleryImageMinimumWidth:rke,setGalleryView:ike,boardIdSelected:Ck,isLoadingChanged:Ppe,isBatchEnabledChanged:oke,imagesAddedToBatch:Yw,imagesRemovedFromBatch:ske}=EL.actions,kpe=EL.reducer,ake=e=>e.gallery,Ape=(e,t,n)=>e==="all"||e==="none"&&!t.board_id||e==="batch"&&n.includes(t.image_name)?!0:e===t.board_id,m3=at([e=>e],e=>{const t=Ji.getSelectors().selectAll(e),{galleryView:n,selectedBoardId:r}=e,i=n==="images"?m1:y1;return t.filter(s=>{const a=i.includes(s.image_category),l=Ape(r,s,e.batchImageNames);return a&&l})}),b1=at(e=>e,e=>m3(e.gallery),Ss);at(b1,e=>rZ(e,"image_name"));at(b1,e=>e.map(t=>t.image_name));const lke=at(e=>e,e=>e.gallery.selection[e.gallery.selection.length-1],Ss);at(e=>e,e=>Ji.getSelectors().selectAll(e.gallery).filter(t=>e.gallery.selection.includes(t.image_name)),Ss);const Ope=at([e=>e,(e,t)=>t],(e,t)=>{const r=m3(e).map(l=>l.image_name),i=r.findIndex(l=>l.toString()===t),o=r.filter(l=>l.toString()!==t),s=Zo(i,0,o.length-1);return o[s]}),Rpe=at([e=>e,(e,t)=>t],(e,t)=>Ope(e.gallery,t),Ss),kL="%[a-f0-9]{2}",Tk=new RegExp("("+kL+")|([^%]+?)","gi"),Ek=new RegExp("("+kL+")+","gi");function Xw(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;t=t||1;const n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],Xw(n),Xw(r))}function Ipe(e){try{return decodeURIComponent(e)}catch{let t=e.match(Tk)||[];for(let n=1;ne==null,$pe=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),Qw=Symbol("encodeFragmentIdentifier");function Fpe(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Zt(t,e),"[",i,"]"].join("")]:[...n,[Zt(t,e),"[",Zt(i,e),"]=",Zt(r,e)].join("")]};case"bracket":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Zt(t,e),"[]"].join("")]:[...n,[Zt(t,e),"[]=",Zt(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Zt(t,e),":list="].join("")]:[...n,[Zt(t,e),":list=",Zt(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return n=>(r,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?r:(i=i===null?"":i,r.length===0?[[Zt(n,e),t,Zt(i,e)].join("")]:[[r,Zt(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,Zt(t,e)]:[...n,[Zt(t,e),"=",Zt(r,e)].join("")]}}function Bpe(e){let t;switch(e.arrayFormat){case"index":return(n,r,i)=>{if(t=/\[(\d*)]$/.exec(n),n=n.replace(/\[\d*]$/,""),!t){i[n]=r;return}i[n]===void 0&&(i[n]={}),i[n][t[1]]=r};case"bracket":return(n,r,i)=>{if(t=/(\[])$/.exec(n),n=n.replace(/\[]$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"colon-list-separator":return(n,r,i)=>{if(t=/(:list)$/.exec(n),n=n.replace(/:list$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"comma":case"separator":return(n,r,i)=>{const o=typeof r=="string"&&r.includes(e.arrayFormatSeparator),s=typeof r=="string"&&!o&&Ko(r,e).includes(e.arrayFormatSeparator);r=s?Ko(r,e):r;const a=o||s?r.split(e.arrayFormatSeparator).map(l=>Ko(l,e)):r===null?r:Ko(r,e);i[n]=a};case"bracket-separator":return(n,r,i)=>{const o=/(\[])$/.test(n);if(n=n.replace(/\[]$/,""),!o){i[n]=r&&Ko(r,e);return}const s=r===null?[]:r.split(e.arrayFormatSeparator).map(a=>Ko(a,e));if(i[n]===void 0){i[n]=s;return}i[n]=[...i[n],...s]};default:return(n,r,i)=>{if(i[n]===void 0){i[n]=r;return}i[n]=[...[i[n]].flat(),r]}}}function OL(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Zt(e,t){return t.encode?t.strict?$pe(e):encodeURIComponent(e):e}function Ko(e,t){return t.decode?Npe(e):e}function RL(e){return Array.isArray(e)?e.sort():typeof e=="object"?RL(Object.keys(e)).sort((t,n)=>Number(t)-Number(n)).map(t=>e[t]):e}function IL(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function jpe(e){let t="";const n=e.indexOf("#");return n!==-1&&(t=e.slice(n)),t}function Pk(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?e=Number(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")&&(e=e.toLowerCase()==="true"),e}function y3(e){e=IL(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function v3(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...t},OL(t.arrayFormatSeparator);const n=Bpe(t),r=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return r;for(const i of e.split("&")){if(i==="")continue;const o=t.decode?i.replace(/\+/g," "):i;let[s,a]=AL(o,"=");s===void 0&&(s=o),a=a===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?a:Ko(a,t),n(Ko(s,t),a,r)}for(const[i,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[s,a]of Object.entries(o))o[s]=Pk(a,t);else r[i]=Pk(o,t);return t.sort===!1?r:(t.sort===!0?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((i,o)=>{const s=r[o];return s&&typeof s=="object"&&!Array.isArray(s)?i[o]=RL(s):i[o]=s,i},Object.create(null))}function ML(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},OL(t.arrayFormatSeparator);const n=s=>t.skipNull&&Lpe(e[s])||t.skipEmptyString&&e[s]==="",r=Fpe(t),i={};for(const[s,a]of Object.entries(e))n(s)||(i[s]=a);const o=Object.keys(i);return t.sort!==!1&&o.sort(t.sort),o.map(s=>{const a=e[s];return a===void 0?"":a===null?Zt(s,t):Array.isArray(a)?a.length===0&&t.arrayFormat==="bracket-separator"?Zt(s,t)+"[]":a.reduce(r(s),[]).join("&"):Zt(s,t)+"="+Zt(a,t)}).filter(s=>s.length>0).join("&")}function NL(e,t){var i;t={decode:!0,...t};let[n,r]=AL(e,"#");return n===void 0&&(n=e),{url:((i=n==null?void 0:n.split("?"))==null?void 0:i[0])??"",query:v3(y3(e),t),...t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:Ko(r,t)}:{}}}function DL(e,t){t={encode:!0,strict:!0,[Qw]:!0,...t};const n=IL(e.url).split("?")[0]||"",r=y3(e.url),i={...v3(r,{sort:!1}),...e.query};let o=ML(i,t);o&&(o=`?${o}`);let s=jpe(e.url);if(e.fragmentIdentifier){const a=new URL(n);a.hash=e.fragmentIdentifier,s=t[Qw]?a.hash:`#${e.fragmentIdentifier}`}return`${n}${o}${s}`}function LL(e,t,n){n={parseFragmentIdentifier:!0,[Qw]:!1,...n};const{url:r,query:i,fragmentIdentifier:o}=NL(e,n);return DL({url:r,query:Dpe(i,t),fragmentIdentifier:o},n)}function Vpe(e,t,n){const r=Array.isArray(t)?i=>!t.includes(i):(i,o)=>!t(i,o);return LL(e,r,n)}const $L=Object.freeze(Object.defineProperty({__proto__:null,exclude:Vpe,extract:y3,parse:v3,parseUrl:NL,pick:LL,stringify:ML,stringifyUrl:DL},Symbol.toStringTag,{value:"Module"})),b3=Oo("thunkApi/imageUrlsReceived",async(e,{rejectWithValue:t})=>{const{image_name:n}=e,{get:r}=Ro.get(),{data:i,error:o,response:s}=await r("/api/v1/images/{image_name}/urls",{params:{path:{image_name:n}}});return o?t({arg:e,error:o}):i}),Ph=Oo("thunkApi/imageMetadataReceived",async(e,{rejectWithValue:t})=>{const{image_name:n}=e,{get:r}=Ro.get(),{data:i,error:o,response:s}=await r("/api/v1/images/{image_name}",{params:{path:{image_name:n}}});return o?t({arg:e,error:o}):i}),Fr=Oo("thunkApi/imageUploaded",async(e,{rejectWithValue:t})=>{const{postUploadAction:n,file:r,image_category:i,is_intermediate:o,session_id:s}=e,{post:a}=Ro.get(),{data:l,error:u,response:c}=await a("/api/v1/images/",{params:{query:{image_category:i,is_intermediate:o,session_id:s}},body:{file:r},bodySerializer:d=>{const f=new FormData;return f.append("file",d.file),f}});return u?t({arg:e,error:u}):l}),Fc=Oo("thunkApi/imageDeleted",async(e,{rejectWithValue:t})=>{const{image_name:n}=e,{del:r}=Ro.get(),{data:i,error:o,response:s}=await r("/api/v1/images/{image_name}",{params:{path:{image_name:n}}});if(o)return t({arg:e,error:o})}),ro=Oo("thunkApi/imageUpdated",async(e,{rejectWithValue:t})=>{const{image_name:n,image_category:r,is_intermediate:i,session_id:o}=e,{patch:s}=Ro.get(),{data:a,error:l,response:u}=await s("/api/v1/images/{image_name}",{params:{path:{image_name:n}},body:{image_category:r,is_intermediate:i,session_id:o}});return l?t({arg:e,error:l}):a}),FL=20,kk={limit:FL},la=Oo("thunkApi/receivedPageOfImages",async(e,{getState:t,rejectWithValue:n})=>{const{get:r}=Ro.get(),i=t(),o=b1(i),s=i.gallery.galleryView==="images"?m1:y1;let a={};g5(e)?a={...kk,offset:o.length,...e}:a={...kk,categories:s,offset:o.length};const{data:l,error:u,response:c}=await r("/api/v1/images/",{params:{query:a},querySerializer:d=>$L.stringify(d,{arrayFormat:"none"})});return u?n({arg:e,error:u}):l}),BL=ge("socket/socketConnected"),jL=ge("socket/appSocketConnected"),VL=ge("socket/socketDisconnected"),zL=ge("socket/appSocketDisconnected"),S3=ge("socket/socketSubscribed"),UL=ge("socket/appSocketSubscribed"),GL=ge("socket/socketUnsubscribed"),HL=ge("socket/appSocketUnsubscribed"),qL=ge("socket/socketInvocationStarted"),WL=ge("socket/appSocketInvocationStarted"),_3=ge("socket/socketInvocationComplete"),KL=ge("socket/appSocketInvocationComplete"),YL=ge("socket/socketInvocationError"),w3=ge("socket/appSocketInvocationError"),XL=ge("socket/socketGraphExecutionStateComplete"),QL=ge("socket/appSocketGraphExecutionStateComplete"),ZL=ge("socket/socketGeneratorProgress"),JL=ge("socket/appSocketGeneratorProgress"),e$=ge("socket/socketModelLoadStarted"),zpe=ge("socket/appSocketModelLoadStarted"),t$=ge("socket/socketModelLoadCompleted"),Upe=ge("socket/appSocketModelLoadCompleted"),x3=ge("controlNet/imageProcessed"),Cu={none:{type:"none",label:"none",description:"",default:{type:"none"}},canny_image_processor:{type:"canny_image_processor",label:"Canny",description:"",default:{id:"canny_image_processor",type:"canny_image_processor",low_threshold:100,high_threshold:200}},content_shuffle_image_processor:{type:"content_shuffle_image_processor",label:"Content Shuffle",description:"",default:{id:"content_shuffle_image_processor",type:"content_shuffle_image_processor",detect_resolution:512,image_resolution:512,h:512,w:512,f:256}},hed_image_processor:{type:"hed_image_processor",label:"HED",description:"",default:{id:"hed_image_processor",type:"hed_image_processor",detect_resolution:512,image_resolution:512,scribble:!1}},lineart_anime_image_processor:{type:"lineart_anime_image_processor",label:"Lineart Anime",description:"",default:{id:"lineart_anime_image_processor",type:"lineart_anime_image_processor",detect_resolution:512,image_resolution:512}},lineart_image_processor:{type:"lineart_image_processor",label:"Lineart",description:"",default:{id:"lineart_image_processor",type:"lineart_image_processor",detect_resolution:512,image_resolution:512,coarse:!1}},mediapipe_face_processor:{type:"mediapipe_face_processor",label:"Mediapipe Face",description:"",default:{id:"mediapipe_face_processor",type:"mediapipe_face_processor",max_faces:1,min_confidence:.5}},midas_depth_image_processor:{type:"midas_depth_image_processor",label:"Depth (Midas)",description:"",default:{id:"midas_depth_image_processor",type:"midas_depth_image_processor",a_mult:2,bg_th:.1}},mlsd_image_processor:{type:"mlsd_image_processor",label:"M-LSD",description:"",default:{id:"mlsd_image_processor",type:"mlsd_image_processor",detect_resolution:512,image_resolution:512,thr_d:.1,thr_v:.1}},normalbae_image_processor:{type:"normalbae_image_processor",label:"Normal BAE",description:"",default:{id:"normalbae_image_processor",type:"normalbae_image_processor",detect_resolution:512,image_resolution:512}},openpose_image_processor:{type:"openpose_image_processor",label:"Openpose",description:"",default:{id:"openpose_image_processor",type:"openpose_image_processor",detect_resolution:512,image_resolution:512,hand_and_face:!1}},pidi_image_processor:{type:"pidi_image_processor",label:"PIDI",description:"",default:{id:"pidi_image_processor",type:"pidi_image_processor",detect_resolution:512,image_resolution:512,scribble:!1,safe:!1}},zoe_depth_image_processor:{type:"zoe_depth_image_processor",label:"Depth (Zoe)",description:"",default:{id:"zoe_depth_image_processor",type:"zoe_depth_image_processor"}}},Pg={canny:"canny_image_processor",mlsd:"mlsd_image_processor",depth:"midas_depth_image_processor",bae:"normalbae_image_processor",lineart:"lineart_image_processor",lineart_anime:"lineart_anime_image_processor",softedge:"hed_image_processor",shuffle:"content_shuffle_image_processor",openpose:"openpose_image_processor",mediapipe:"mediapipe_face_processor"},Ak={isEnabled:!0,model:null,weight:1,beginStepPct:0,endStepPct:1,controlMode:"balanced",controlImage:null,processedControlImage:null,processorType:"canny_image_processor",processorNode:Cu.canny_image_processor.default,shouldAutoConfig:!0},Zw={controlNets:{},isEnabled:!1,pendingControlImages:[]},n$=jt({name:"controlNet",initialState:Zw,reducers:{isControlNetEnabledToggled:e=>{e.isEnabled=!e.isEnabled},controlNetAdded:(e,t)=>{const{controlNetId:n,controlNet:r}=t.payload;e.controlNets[n]={...r??Ak,controlNetId:n}},controlNetDuplicated:(e,t)=>{const{sourceControlNetId:n,newControlNetId:r}=t.payload,i=Kn(e.controlNets[n]);i.controlNetId=r,e.controlNets[r]=i},controlNetAddedFromImage:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload;e.controlNets[n]={...Ak,controlNetId:n,controlImage:r}},controlNetRemoved:(e,t)=>{const{controlNetId:n}=t.payload;delete e.controlNets[n]},controlNetToggled:(e,t)=>{const{controlNetId:n}=t.payload;e.controlNets[n].isEnabled=!e.controlNets[n].isEnabled},controlNetImageChanged:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload;e.controlNets[n].controlImage=r,e.controlNets[n].processedControlImage=null,r!==null&&e.controlNets[n].processorType!=="none"&&e.pendingControlImages.push(n)},controlNetProcessedImageChanged:(e,t)=>{const{controlNetId:n,processedControlImage:r}=t.payload;e.controlNets[n].processedControlImage=r,e.pendingControlImages=e.pendingControlImages.filter(i=>i!==n)},controlNetModelChanged:(e,t)=>{const{controlNetId:n,model:r}=t.payload;if(e.controlNets[n].model=r,e.controlNets[n].processedControlImage=null,e.controlNets[n].shouldAutoConfig){let i;for(const o in Pg)if(r.model_name.includes(o)){i=Pg[o];break}i?(e.controlNets[n].processorType=i,e.controlNets[n].processorNode=Cu[i].default):(e.controlNets[n].processorType="none",e.controlNets[n].processorNode=Cu.none.default)}},controlNetWeightChanged:(e,t)=>{const{controlNetId:n,weight:r}=t.payload;e.controlNets[n].weight=r},controlNetBeginStepPctChanged:(e,t)=>{const{controlNetId:n,beginStepPct:r}=t.payload;e.controlNets[n].beginStepPct=r},controlNetEndStepPctChanged:(e,t)=>{const{controlNetId:n,endStepPct:r}=t.payload;e.controlNets[n].endStepPct=r},controlNetControlModeChanged:(e,t)=>{const{controlNetId:n,controlMode:r}=t.payload;e.controlNets[n].controlMode=r},controlNetProcessorParamsChanged:(e,t)=>{const{controlNetId:n,changes:r}=t.payload,i=e.controlNets[n].processorNode;e.controlNets[n].processorNode={...i,...r},e.controlNets[n].shouldAutoConfig=!1},controlNetProcessorTypeChanged:(e,t)=>{const{controlNetId:n,processorType:r}=t.payload;e.controlNets[n].processedControlImage=null,e.controlNets[n].processorType=r,e.controlNets[n].processorNode=Cu[r].default,e.controlNets[n].shouldAutoConfig=!1},controlNetAutoConfigToggled:(e,t)=>{var i;const{controlNetId:n}=t.payload,r=!e.controlNets[n].shouldAutoConfig;if(r){let o;for(const s in Pg)if((i=e.controlNets[n].model)!=null&&i.model_name.includes(s)){o=Pg[s];break}o?(e.controlNets[n].processorType=o,e.controlNets[n].processorNode=Cu[o].default):(e.controlNets[n].processorType="none",e.controlNets[n].processorNode=Cu.none.default)}e.controlNets[n].shouldAutoConfig=r},controlNetReset:()=>({...Zw})},extraReducers:e=>{e.addCase(x3,(t,n)=>{t.controlNets[n.payload.controlNetId].controlImage!==null&&t.pendingControlImages.push(n.payload.controlNetId)}),e.addCase(Fc.pending,(t,n)=>{const{image_name:r}=n.meta.arg;wl(t.controlNets,i=>{i.controlImage===r&&(i.controlImage=null,i.processedControlImage=null),i.processedControlImage===r&&(i.processedControlImage=null)})}),e.addCase(w3,(t,n)=>{t.pendingControlImages=[]}),e.addMatcher(cL,(t,n)=>{t.pendingControlImages=[]})}}),{isControlNetEnabledToggled:uke,controlNetAdded:cke,controlNetDuplicated:dke,controlNetAddedFromImage:fke,controlNetRemoved:r$,controlNetImageChanged:C3,controlNetProcessedImageChanged:Gpe,controlNetToggled:hke,controlNetModelChanged:Ok,controlNetWeightChanged:pke,controlNetBeginStepPctChanged:gke,controlNetEndStepPctChanged:mke,controlNetControlModeChanged:yke,controlNetProcessorParamsChanged:Hpe,controlNetProcessorTypeChanged:qpe,controlNetReset:i$,controlNetAutoConfigToggled:Rk}=n$.actions,Wpe=n$.reducer,Kpe=e=>e.controlNet,o$={isEnabled:!1,maxPrompts:100,combinatorial:!0},Ype=o$,s$=jt({name:"dynamicPrompts",initialState:Ype,reducers:{maxPromptsChanged:(e,t)=>{e.maxPrompts=t.payload},maxPromptsReset:e=>{e.maxPrompts=o$.maxPrompts},combinatorialToggled:e=>{e.combinatorial=!e.combinatorial},isEnabledToggled:e=>{e.isEnabled=!e.isEnabled}},extraReducers:e=>{}}),{isEnabledToggled:vke,maxPromptsChanged:bke,maxPromptsReset:Ske,combinatorialToggled:_ke}=s$.actions,Xpe=s$.reducer,Qpe={updateBoardModalOpen:!1,searchText:""},a$=jt({name:"boards",initialState:Qpe,reducers:{setBoardSearchText:(e,t)=>{e.searchText=t.payload},setUpdateBoardModalOpen:(e,t)=>{e.updateBoardModalOpen=t.payload}}}),{setBoardSearchText:wke,setUpdateBoardModalOpen:xke}=a$.actions,Zpe=a$.reducer,Jpe={imageToDelete:null,isModalOpen:!1},l$=jt({name:"imageDeletion",initialState:Jpe,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imageToDeleteSelected:(e,t)=>{e.imageToDelete=t.payload},imageToDeleteCleared:e=>{e.imageToDelete=null,e.isModalOpen=!1}}}),{isModalOpenChanged:u$,imageToDeleteSelected:ege,imageToDeleteCleared:Cke}=l$.actions,tge=l$.reducer,nge=at([e=>e],({imageDeletion:e,generation:t,canvas:n,nodes:r,controlNet:i})=>{var f;const{imageToDelete:o}=e;if(!o)return;const{image_name:s}=o,a=((f=t.initialImage)==null?void 0:f.imageName)===s,l=n.layerState.objects.some(h=>h.kind==="image"&&h.imageName===s),u=r.nodes.some(h=>Ys(h.data.inputs,p=>{var g;return p.type==="image"&&((g=p.value)==null?void 0:g.image_name)===s})),c=Ys(i.controlNets,h=>h.controlImage===s||h.processedControlImage===s);return{isInitialImage:a,isCanvasImage:l,isNodesImage:u,isControlNetImage:c}},Ss),c$=ge("imageDeletion/imageDeletionConfirmed"),Ik={weight:.75},rge={loras:{}},d$=jt({name:"lora",initialState:rge,reducers:{loraAdded:(e,t)=>{const{model_name:n,id:r,base_model:i}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,...Ik}},loraRemoved:(e,t)=>{const n=t.payload;delete e.loras[n]},lorasCleared:e=>{e.loras={}},loraWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload;e.loras[n].weight=r},loraWeightReset:(e,t)=>{const n=t.payload;e.loras[n].weight=Ik.weight}}}),{loraAdded:Tke,loraRemoved:f$,loraWeightChanged:Eke,loraWeightReset:Pke,lorasCleared:kke}=d$.actions,ige=d$.reducer;function Si(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const d=t;t=u??typeof c!="object"?c:Object.assign({},t,c),n.forEach(f=>f(t,d))}},i=()=>t,a={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{n.clear()}};return t=e(r,i,a),a},oge=e=>e?Mk(e):Mk,{useSyncExternalStoreWithSelector:sge}=rG;function age(e,t=e.getState,n){const r=sge(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return E.useDebugValue(r),r}function Ir(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r{}};function S1(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Pm.prototype=S1.prototype={constructor:Pm,on:function(e,t){var n=this._,r=uge(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Dk.hasOwnProperty(t)?{space:Dk[t],local:e}:e}function dge(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Jw&&t.documentElement.namespaceURI===Jw?t.createElement(e):t.createElementNS(n,e)}}function fge(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function h$(e){var t=_1(e);return(t.local?fge:dge)(t)}function hge(){}function T3(e){return e==null?hge:function(){return this.querySelector(e)}}function pge(e){typeof e!="function"&&(e=T3(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=m&&(m=y+1);!(_=S[m])&&++m=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function Bge(e){e||(e=jge);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function Vge(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function zge(){return Array.from(this)}function Uge(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?eme:typeof t=="function"?nme:tme)(e,t,n??"")):Bc(this.node(),e)}function Bc(e,t){return e.style.getPropertyValue(t)||v$(e).getComputedStyle(e,null).getPropertyValue(t)}function ime(e){return function(){delete this[e]}}function ome(e,t){return function(){this[e]=t}}function sme(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ame(e,t){return arguments.length>1?this.each((t==null?ime:typeof t=="function"?sme:ome)(e,t)):this.node()[e]}function b$(e){return e.trim().split(/^|\s+/)}function E3(e){return e.classList||new S$(e)}function S$(e){this._node=e,this._names=b$(e.getAttribute("class")||"")}S$.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function _$(e,t){for(var n=E3(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Dme(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n()=>e;function ex(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:s,y:a,dx:l,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}ex.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Hme(e){return!e.ctrlKey&&!e.button}function qme(){return this.parentNode}function Wme(e,t){return t??{x:e.x,y:e.y}}function Kme(){return navigator.maxTouchPoints||"ontouchstart"in this}function Yme(){var e=Hme,t=qme,n=Wme,r=Kme,i={},o=S1("start","drag","end"),s=0,a,l,u,c,d=0;function f(b){b.on("mousedown.drag",h).filter(r).on("touchstart.drag",S).on("touchmove.drag",v,Gme).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(b,_){if(!(c||!e.call(this,b,_))){var w=m(this,t.call(this,b,_),b,_,"mouse");w&&(ki(b.view).on("mousemove.drag",p,kh).on("mouseup.drag",g,kh),T$(b.view),g_(b),u=!1,a=b.clientX,l=b.clientY,w("start",b))}}function p(b){if(ac(b),!u){var _=b.clientX-a,w=b.clientY-l;u=_*_+w*w>d}i.mouse("drag",b)}function g(b){ki(b.view).on("mousemove.drag mouseup.drag",null),E$(b.view,u),ac(b),i.mouse("end",b)}function S(b,_){if(e.call(this,b,_)){var w=b.changedTouches,x=t.call(this,b,_),C=w.length,k,P;for(k=0;k>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ag(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ag(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Qme.exec(e))?new xr(t[1],t[2],t[3],1):(t=Zme.exec(e))?new xr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Jme.exec(e))?Ag(t[1],t[2],t[3],t[4]):(t=eye.exec(e))?Ag(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=tye.exec(e))?zk(t[1],t[2]/100,t[3]/100,1):(t=nye.exec(e))?zk(t[1],t[2]/100,t[3]/100,t[4]):Lk.hasOwnProperty(e)?Bk(Lk[e]):e==="transparent"?new xr(NaN,NaN,NaN,0):null}function Bk(e){return new xr(e>>16&255,e>>8&255,e&255,1)}function Ag(e,t,n,r){return r<=0&&(e=t=n=NaN),new xr(e,t,n,r)}function oye(e){return e instanceof Ap||(e=Rh(e)),e?(e=e.rgb(),new xr(e.r,e.g,e.b,e.opacity)):new xr}function tx(e,t,n,r){return arguments.length===1?oye(e):new xr(e,t,n,r??1)}function xr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}P3(xr,tx,P$(Ap,{brighter(e){return e=e==null?Jy:Math.pow(Jy,e),new xr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ah:Math.pow(Ah,e),new xr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new xr(gl(this.r),gl(this.g),gl(this.b),e0(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:jk,formatHex:jk,formatHex8:sye,formatRgb:Vk,toString:Vk}));function jk(){return`#${ol(this.r)}${ol(this.g)}${ol(this.b)}`}function sye(){return`#${ol(this.r)}${ol(this.g)}${ol(this.b)}${ol((isNaN(this.opacity)?1:this.opacity)*255)}`}function Vk(){const e=e0(this.opacity);return`${e===1?"rgb(":"rgba("}${gl(this.r)}, ${gl(this.g)}, ${gl(this.b)}${e===1?")":`, ${e})`}`}function e0(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ol(e){return e=gl(e),(e<16?"0":"")+e.toString(16)}function zk(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ai(e,t,n,r)}function k$(e){if(e instanceof Ai)return new Ai(e.h,e.s,e.l,e.opacity);if(e instanceof Ap||(e=Rh(e)),!e)return new Ai;if(e instanceof Ai)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,l=(o+i)/2;return a?(t===o?s=(n-r)/a+(n0&&l<1?0:s,new Ai(s,a,l,e.opacity)}function aye(e,t,n,r){return arguments.length===1?k$(e):new Ai(e,t,n,r??1)}function Ai(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}P3(Ai,aye,P$(Ap,{brighter(e){return e=e==null?Jy:Math.pow(Jy,e),new Ai(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ah:Math.pow(Ah,e),new Ai(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new xr(m_(e>=240?e-240:e+120,i,r),m_(e,i,r),m_(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ai(Uk(this.h),Og(this.s),Og(this.l),e0(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=e0(this.opacity);return`${e===1?"hsl(":"hsla("}${Uk(this.h)}, ${Og(this.s)*100}%, ${Og(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Uk(e){return e=(e||0)%360,e<0?e+360:e}function Og(e){return Math.max(0,Math.min(1,e||0))}function m_(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const A$=e=>()=>e;function lye(e,t){return function(n){return e+n*t}}function uye(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function cye(e){return(e=+e)==1?O$:function(t,n){return n-t?uye(t,n,e):A$(isNaN(t)?n:t)}}function O$(e,t){var n=t-e;return n?lye(e,n):A$(isNaN(e)?t:e)}const Gk=function e(t){var n=cye(t);function r(i,o){var s=n((i=tx(i)).r,(o=tx(o)).r),a=n(i.g,o.g),l=n(i.b,o.b),u=O$(i.opacity,o.opacity);return function(c){return i.r=s(c),i.g=a(c),i.b=l(c),i.opacity=u(c),i+""}}return r.gamma=e,r}(1);function Bs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var nx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,y_=new RegExp(nx.source,"g");function dye(e){return function(){return e}}function fye(e){return function(t){return e(t)+""}}function hye(e,t){var n=nx.lastIndex=y_.lastIndex=0,r,i,o,s=-1,a=[],l=[];for(e=e+"",t=t+"";(r=nx.exec(e))&&(i=y_.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:Bs(r,i)})),n=y_.lastIndex;return n180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:Bs(u,c)})):c&&d.push(i(d)+"rotate("+c+r)}function a(u,c,d,f){u!==c?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:Bs(u,c)}):c&&d.push(i(d)+"skewX("+c+r)}function l(u,c,d,f,h,p){if(u!==d||c!==f){var g=h.push(i(h)+"scale(",null,",",null,")");p.push({i:g-4,x:Bs(u,d)},{i:g-2,x:Bs(c,f)})}else(d!==1||f!==1)&&h.push(i(h)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=e(u),c=e(c),o(u.translateX,u.translateY,c.translateX,c.translateY,d,f),s(u.rotate,c.rotate,d,f),a(u.skewX,c.skewX,d,f),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(h){for(var p=-1,g=f.length,S;++p=0&&e._call.call(void 0,t),e=e._next;--jc}function Wk(){Al=(n0=Ih.now())+w1,jc=Qd=0;try{xye()}finally{jc=0,Tye(),Al=0}}function Cye(){var e=Ih.now(),t=e-n0;t>M$&&(w1-=t,n0=e)}function Tye(){for(var e,t=t0,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:t0=n);Zd=e,ix(r)}function ix(e){if(!jc){Qd&&(Qd=clearTimeout(Qd));var t=e-Al;t>24?(e<1/0&&(Qd=setTimeout(Wk,e-Ih.now()-w1)),Od&&(Od=clearInterval(Od))):(Od||(n0=Ih.now(),Od=setInterval(Cye,M$)),jc=1,N$(Wk))}}function Kk(e,t,n){var r=new r0;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Eye=S1("start","end","cancel","interrupt"),Pye=[],L$=0,Yk=1,ox=2,km=3,Xk=4,sx=5,Am=6;function x1(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;kye(e,n,{name:t,index:r,group:i,on:Eye,tween:Pye,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:L$})}function A3(e,t){var n=zi(e,t);if(n.state>L$)throw new Error("too late; already scheduled");return n}function Io(e,t){var n=zi(e,t);if(n.state>km)throw new Error("too late; already running");return n}function zi(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function kye(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=D$(o,0,n.time);function o(u){n.state=Yk,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var c,d,f,h;if(n.state!==Yk)return l();for(c in r)if(h=r[c],h.name===n.name){if(h.state===km)return Kk(s);h.state===Xk?(h.state=Am,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+cox&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function i0e(e,t,n){var r,i,o=r0e(t)?A3:Io;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function o0e(e,t){var n=this._id;return arguments.length<2?zi(this.node(),n).on.on(e):this.each(i0e(n,e,t))}function s0e(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function a0e(){return this.on("end.remove",s0e(this._id))}function l0e(e){var t=this._name,n=this._id;typeof e!="function"&&(e=T3(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s()=>e;function M0e(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function es(e,t,n){this.k=e,this.x=t,this.y=n}es.prototype={constructor:es,scale:function(e){return e===1?this:new es(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new es(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ua=new es(1,0,0);es.prototype;function v_(e){e.stopImmediatePropagation()}function Rd(e){e.preventDefault(),e.stopImmediatePropagation()}function N0e(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function D0e(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Qk(){return this.__zoom||ua}function L0e(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function $0e(){return navigator.maxTouchPoints||"ontouchstart"in this}function F0e(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function B0e(){var e=N0e,t=D0e,n=F0e,r=L0e,i=$0e,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=_ye,u=S1("start","zoom","end"),c,d,f,h=500,p=150,g=0,S=10;function v(T){T.property("__zoom",Qk).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",P).filter(i).on("touchstart.zoom",A).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(T,O,I,M){var R=T.selection?T.selection():T;R.property("__zoom",Qk),T!==R?_(T,O,I,M):R.interrupt().each(function(){w(this,arguments).event(M).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},v.scaleBy=function(T,O,I,M){v.scaleTo(T,function(){var R=this.__zoom.k,D=typeof O=="function"?O.apply(this,arguments):O;return R*D},I,M)},v.scaleTo=function(T,O,I,M){v.transform(T,function(){var R=t.apply(this,arguments),D=this.__zoom,L=I==null?b(R):typeof I=="function"?I.apply(this,arguments):I,V=D.invert(L),z=typeof O=="function"?O.apply(this,arguments):O;return n(m(y(D,z),L,V),R,s)},I,M)},v.translateBy=function(T,O,I,M){v.transform(T,function(){return n(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),s)},null,M)},v.translateTo=function(T,O,I,M,R){v.transform(T,function(){var D=t.apply(this,arguments),L=this.__zoom,V=M==null?b(D):typeof M=="function"?M.apply(this,arguments):M;return n(ua.translate(V[0],V[1]).scale(L.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof I=="function"?-I.apply(this,arguments):-I),D,s)},M,R)};function y(T,O){return O=Math.max(o[0],Math.min(o[1],O)),O===T.k?T:new es(O,T.x,T.y)}function m(T,O,I){var M=O[0]-I[0]*T.k,R=O[1]-I[1]*T.k;return M===T.x&&R===T.y?T:new es(T.k,M,R)}function b(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function _(T,O,I,M){T.on("start.zoom",function(){w(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(M).end()}).tween("zoom",function(){var R=this,D=arguments,L=w(R,D).event(M),V=t.apply(R,D),z=I==null?b(V):typeof I=="function"?I.apply(R,D):I,U=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),K=R.__zoom,W=typeof O=="function"?O.apply(R,D):O,X=l(K.invert(z).concat(U/K.k),W.invert(z).concat(U/W.k));return function(F){if(F===1)F=W;else{var q=X(F),Q=U/q[2];F=new es(Q,z[0]-q[0]*Q,z[1]-q[1]*Q)}L.zoom(null,F)}})}function w(T,O,I){return!I&&T.__zooming||new x(T,O)}function x(T,O){this.that=T,this.args=O,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,O),this.taps=0}x.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,O){return this.mouse&&T!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&T!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(T){var O=ki(this.that).datum();u.call(T,this.that,new M0e(T,{sourceEvent:this.sourceEvent,target:v,type:T,transform:this.that.__zoom,dispatch:u}),O)}};function C(T,...O){if(!e.apply(this,arguments))return;var I=w(this,O).event(T),M=this.__zoom,R=Math.max(o[0],Math.min(o[1],M.k*Math.pow(2,r.apply(this,arguments)))),D=Yi(T);if(I.wheel)(I.mouse[0][0]!==D[0]||I.mouse[0][1]!==D[1])&&(I.mouse[1]=M.invert(I.mouse[0]=D)),clearTimeout(I.wheel);else{if(M.k===R)return;I.mouse=[D,M.invert(D)],Om(this),I.start()}Rd(T),I.wheel=setTimeout(L,p),I.zoom("mouse",n(m(y(M,R),I.mouse[0],I.mouse[1]),I.extent,s));function L(){I.wheel=null,I.end()}}function k(T,...O){if(f||!e.apply(this,arguments))return;var I=T.currentTarget,M=w(this,O,!0).event(T),R=ki(T.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",U,!0),D=Yi(T,I),L=T.clientX,V=T.clientY;T$(T.view),v_(T),M.mouse=[D,this.__zoom.invert(D)],Om(this),M.start();function z(K){if(Rd(K),!M.moved){var W=K.clientX-L,X=K.clientY-V;M.moved=W*W+X*X>g}M.event(K).zoom("mouse",n(m(M.that.__zoom,M.mouse[0]=Yi(K,I),M.mouse[1]),M.extent,s))}function U(K){R.on("mousemove.zoom mouseup.zoom",null),E$(K.view,M.moved),Rd(K),M.event(K).end()}}function P(T,...O){if(e.apply(this,arguments)){var I=this.__zoom,M=Yi(T.changedTouches?T.changedTouches[0]:T,this),R=I.invert(M),D=I.k*(T.shiftKey?.5:2),L=n(m(y(I,D),M,R),t.apply(this,O),s);Rd(T),a>0?ki(this).transition().duration(a).call(_,L,M,T):ki(this).call(v.transform,L,M,T)}}function A(T,...O){if(e.apply(this,arguments)){var I=T.touches,M=I.length,R=w(this,O,T.changedTouches.length===M).event(T),D,L,V,z;for(v_(T),L=0;L"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`},j$=_a.error001();function Wt(e,t){const n=E.useContext(C1);if(n===null)throw new Error(j$);return age(n,e,t)}const Jn=()=>{const e=E.useContext(C1);if(e===null)throw new Error(j$);return E.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},V0e=e=>e.userSelectionActive?"none":"all";function z0e({position:e,children:t,className:n,style:r,...i}){const o=Wt(V0e),s=`${e}`.split("-");return j.jsx("div",{className:Si(["react-flow__panel",n,...s]),style:{...r,pointerEvents:o},...i,children:t})}function U0e({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:j.jsx(z0e,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:j.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const G0e=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:o={},labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:u,...c})=>{const d=E.useRef(null),[f,h]=E.useState({x:0,y:0,width:0,height:0}),p=Si(["react-flow__edge-textwrapper",u]);return E.useEffect(()=>{if(d.current){const g=d.current.getBBox();h({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),typeof n>"u"||!n?null:j.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...c,children:[i&&j.jsx("rect",{width:f.width+2*s[0],x:-s[0],y:-s[1],height:f.height+2*s[1],className:"react-flow__edge-textbg",style:o,rx:a,ry:a}),j.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:d,style:r,children:n}),l]})};var H0e=E.memo(G0e);const R3=e=>({width:e.offsetWidth,height:e.offsetHeight}),Vc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),I3=(e={x:0,y:0},t)=>({x:Vc(e.x,t[0][0],t[1][0]),y:Vc(e.y,t[0][1],t[1][1])}),Zk=(e,t,n)=>en?-Vc(Math.abs(e-n),1,50)/50:0,V$=(e,t)=>{const n=Zk(e.x,35,t.width-35)*20,r=Zk(e.y,35,t.height-35)*20;return[n,r]},z$=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},U$=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),i0=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),G$=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Jk=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),Ake=(e,t)=>G$(U$(i0(e),i0(t))),ax=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},q0e=e=>ui(e.width)&&ui(e.height)&&ui(e.x)&&ui(e.y),ui=e=>!isNaN(e)&&isFinite(e),hn=Symbol.for("internals"),H$=["Enter"," ","Escape"],W0e=(e,t)=>{},K0e=e=>"nativeEvent"in e;function lx(e){var i,o;const t=K0e(e)?e.nativeEvent:e,n=((o=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:o[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const q$=e=>"clientX"in e,ca=(e,t)=>{var o,s;const n=q$(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},Op=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h=20})=>j.jsxs(j.Fragment,{children:[j.jsx("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:f}),h&&j.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&ui(n)&&ui(r)?j.jsx(H0e,{x:n,y:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u}):null]});Op.displayName="BaseEdge";function Id(e,t,n){return n===void 0?n:r=>{const i=t().edges.find(o=>o.id===e);i&&n(r,{...i})}}function W$({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n{const[S,v,y]=Y$({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o});return j.jsx(Op,{path:S,labelX:v,labelY:y,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:g})});M3.displayName="SimpleBezierEdge";const t8={[ye.Left]:{x:-1,y:0},[ye.Right]:{x:1,y:0},[ye.Top]:{x:0,y:-1},[ye.Bottom]:{x:0,y:1}},Y0e=({source:e,sourcePosition:t=ye.Bottom,target:n})=>t===ye.Left||t===ye.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function X0e({source:e,sourcePosition:t=ye.Bottom,target:n,targetPosition:r=ye.Top,center:i,offset:o}){const s=t8[t],a=t8[r],l={x:e.x+s.x*o,y:e.y+s.y*o},u={x:n.x+a.x*o,y:n.y+a.y*o},c=Y0e({source:l,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",f=c[d];let h=[],p,g;const[S,v,y,m]=W$({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[d]*a[d]===-1){p=i.x||S,g=i.y||v;const _=[{x:p,y:l.y},{x:p,y:u.y}],w=[{x:l.x,y:g},{x:u.x,y:g}];s[d]===f?h=d==="x"?_:w:h=d==="x"?w:_}else{const _=[{x:l.x,y:u.y}],w=[{x:u.x,y:l.y}];if(d==="x"?h=s.x===f?w:_:h=s.y===f?_:w,t!==r){const x=d==="x"?"y":"x",C=s[d]===a[x],k=l[x]>u[x],P=l[x]{let m="";return y>0&&y{const[v,y,m]=ux({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset});return j.jsx(Op,{path:v,labelX:y,labelY:m,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:p,interactionWidth:S})});T1.displayName="SmoothStepEdge";const N3=E.memo(e=>{var t;return j.jsx(T1,{...e,pathOptions:E.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});N3.displayName="StepEdge";function Z0e({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,s,a]=W$({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,s,a]}const D3=E.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})=>{const[p,g,S]=Z0e({sourceX:e,sourceY:t,targetX:n,targetY:r});return j.jsx(Op,{path:p,labelX:g,labelY:S,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})});D3.displayName="StraightEdge";function Mg(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function r8({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case ye.Left:return[t-Mg(t-r,o),n];case ye.Right:return[t+Mg(r-t,o),n];case ye.Top:return[t,n-Mg(n-i,o)];case ye.Bottom:return[t,n+Mg(i-n,o)]}}function X$({sourceX:e,sourceY:t,sourcePosition:n=ye.Bottom,targetX:r,targetY:i,targetPosition:o=ye.Top,curvature:s=.25}){const[a,l]=r8({pos:n,x1:e,y1:t,x2:r,y2:i,c:s}),[u,c]=r8({pos:o,x1:r,y1:i,x2:e,y2:t,c:s}),[d,f,h,p]=K$({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:c});return[`M${e},${t} C${a},${l} ${u},${c} ${r},${i}`,d,f,h,p]}const s0=E.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=ye.Bottom,targetPosition:o=ye.Top,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,pathOptions:g,interactionWidth:S})=>{const[v,y,m]=X$({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o,curvature:g==null?void 0:g.curvature});return j.jsx(Op,{path:v,labelX:y,labelY:m,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:S})});s0.displayName="BezierEdge";const L3=E.createContext(null),J0e=L3.Provider;L3.Consumer;const eve=()=>E.useContext(L3),tve=e=>"id"in e&&"source"in e&&"target"in e,nve=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,cx=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,rve=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Q$=(e,t)=>{if(!e.source||!e.target)return t;let n;return tve(e)?n={...e}:n={...e,id:nve(e)},rve(n,t)?t:t.concat(n)},Z$=({x:e,y:t},[n,r,i],o,[s,a])=>{const l={x:(e-n)/i,y:(t-r)/i};return o?{x:s*Math.round(l.x/s),y:a*Math.round(l.y/a)}:l},ive=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),cc=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},J$=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const{x:o,y:s}=cc(i,t).positionAbsolute;return U$(r,i0({x:o,y:s,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return G$(n)},eF=(e,t,[n,r,i]=[0,0,1],o=!1,s=!1,a=[0,0])=>{const l={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},u=[];return e.forEach(c=>{const{width:d,height:f,selectable:h=!0,hidden:p=!1}=c;if(s&&!h||p)return!1;const{positionAbsolute:g}=cc(c,a),S={x:g.x,y:g.y,width:d||0,height:f||0},v=ax(l,S),y=typeof d>"u"||typeof f>"u"||d===null||f===null,m=o&&v>0,b=(d||0)*(f||0);(y||m||v>=b||c.dragging)&&u.push(c)}),u},tF=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},nF=(e,t,n,r,i,o=.1)=>{const s=t/(e.width*(1+o)),a=n/(e.height*(1+o)),l=Math.min(s,a),u=Vc(l,r,i),c=e.x+e.width/2,d=e.y+e.height/2,f=t/2-c*u,h=n/2-d*u;return[f,h,u]},Xa=(e,t=0)=>e.transition().duration(t);function i8(e,t,n,r){return(t[n]||[]).reduce((i,o)=>{var s,a;return`${e.id}-${o.id}-${n}`!==r&&i.push({id:o.id||null,type:n,nodeId:e.id,x:(((s=e.positionAbsolute)==null?void 0:s.x)??0)+o.x+o.width/2,y:(((a=e.positionAbsolute)==null?void 0:a.y)??0)+o.y+o.height/2}),i},[])}function ove(e,t,n,r,i,o){const{x:s,y:a}=ca(e),u=t.elementsFromPoint(s,a).find(p=>p.classList.contains("react-flow__handle"));if(u){const p=u.getAttribute("data-nodeid");if(p){const g=$3(void 0,u),S=u.getAttribute("data-handleid"),v=o({nodeId:p,id:S,type:g});if(v)return{handle:{id:S,type:g,nodeId:p,x:n.x,y:n.y},validHandleResult:v}}}let c=[],d=1/0;if(i.forEach(p=>{const g=Math.sqrt((p.x-n.x)**2+(p.y-n.y)**2);if(g<=r){const S=o(p);g<=d&&(gp.isValid),h=c.some(({handle:p})=>p.type==="target");return c.find(({handle:p,validHandleResult:g})=>h?p.type==="target":f?g.isValid:!0)||c[0]}const sve={source:null,target:null,sourceHandle:null,targetHandle:null},rF=()=>({handleDomNode:null,isValid:!1,connection:sve,endHandle:null});function iF(e,t,n,r,i,o,s){const a=i==="target",l=s.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...rF(),handleDomNode:l};if(l){const c=$3(void 0,l),d=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),h=l.classList.contains("connectable"),p=l.classList.contains("connectableend"),g={source:a?d:n,sourceHandle:a?f:r,target:a?n:d,targetHandle:a?r:f};u.connection=g,h&&p&&(t===Ol.Strict?a&&c==="source"||!a&&c==="target":d!==n||f!==r)&&(u.endHandle={nodeId:d,handleId:f,type:c},u.isValid=o(g))}return u}function ave({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((i,o)=>{if(o[hn]){const{handleBounds:s}=o[hn];let a=[],l=[];s&&(a=i8(o,s,"source",`${t}-${n}-${r}`),l=i8(o,s,"target",`${t}-${n}-${r}`)),i.push(...a,...l)}return i},[])}function $3(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function b_(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function lve(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function oF({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:o,setState:s,isValidConnection:a,edgeUpdaterType:l,onEdgeUpdateEnd:u}){const c=z$(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:h,connectionRadius:p,onConnectStart:g,panBy:S,getNodes:v,cancelConnection:y}=o();let m=0,b;const{x:_,y:w}=ca(e),x=c==null?void 0:c.elementFromPoint(_,w),C=$3(l,x),k=f==null?void 0:f.getBoundingClientRect();if(!k||!C)return;let P,A=ca(e,k),$=!1,N=null,T=!1,O=null;const I=ave({nodes:v(),nodeId:n,handleId:t,handleType:C}),M=()=>{if(!h)return;const[L,V]=V$(A,k);S({x:L,y:V}),m=requestAnimationFrame(M)};s({connectionPosition:A,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:C,connectionStartHandle:{nodeId:n,handleId:t,type:C},connectionEndHandle:null}),g==null||g(e,{nodeId:n,handleId:t,handleType:C});function R(L){const{transform:V}=o();A=ca(L,k);const{handle:z,validHandleResult:U}=ove(L,c,Z$(A,V,!1,[1,1]),p,I,K=>iF(K,d,n,t,i?"target":"source",a,c));if(b=z,$||(M(),$=!0),O=U.handleDomNode,N=U.connection,T=U.isValid,s({connectionPosition:b&&T?ive({x:b.x,y:b.y},V):A,connectionStatus:lve(!!b,T),connectionEndHandle:U.endHandle}),!b&&!T&&!O)return b_(P);N.source!==N.target&&O&&(b_(P),P=O,O.classList.add("connecting","react-flow__handle-connecting"),O.classList.toggle("valid",T),O.classList.toggle("react-flow__handle-valid",T))}function D(L){var V,z;(b||O)&&N&&T&&(r==null||r(N)),(z=(V=o()).onConnectEnd)==null||z.call(V,L),l&&(u==null||u(L)),b_(P),y(),cancelAnimationFrame(m),$=!1,T=!1,N=null,O=null,c.removeEventListener("mousemove",R),c.removeEventListener("mouseup",D),c.removeEventListener("touchmove",R),c.removeEventListener("touchend",D)}c.addEventListener("mousemove",R),c.addEventListener("mouseup",D),c.addEventListener("touchmove",R),c.addEventListener("touchend",D)}const o8=()=>!0,uve=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),cve=(e,t,n)=>r=>{const{connectionStartHandle:i,connectionEndHandle:o,connectionClickStartHandle:s}=r;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n}},sF=E.forwardRef(({type:e="source",position:t=ye.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:s,onConnect:a,children:l,className:u,onMouseDown:c,onTouchStart:d,...f},h)=>{var k,P;const p=s||null,g=e==="target",S=Jn(),v=eve(),{connectOnClick:y,noPanClassName:m}=Wt(uve,Ir),{connecting:b,clickConnecting:_}=Wt(cve(v,p,e),Ir);v||(P=(k=S.getState()).onError)==null||P.call(k,"010",_a.error010());const w=A=>{const{defaultEdgeOptions:$,onConnect:N,hasDefaultEdges:T}=S.getState(),O={...$,...A};if(T){const{edges:I,setEdges:M}=S.getState();M(Q$(O,I))}N==null||N(O),a==null||a(O)},x=A=>{if(!v)return;const $=q$(A);i&&($&&A.button===0||!$)&&oF({event:A,handleId:p,nodeId:v,onConnect:w,isTarget:g,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||o8}),$?c==null||c(A):d==null||d(A)},C=A=>{const{onClickConnectStart:$,onClickConnectEnd:N,connectionClickStartHandle:T,connectionMode:O,isValidConnection:I}=S.getState();if(!v||!T&&!i)return;if(!T){$==null||$(A,{nodeId:v,handleId:p,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:v,type:e,handleId:p}});return}const M=z$(A.target),R=n||I||o8,{connection:D,isValid:L}=iF({nodeId:v,id:p,type:e},O,T.nodeId,T.handleId||null,T.type,R,M);L&&w(D),N==null||N(A),S.setState({connectionClickStartHandle:null})};return j.jsx("div",{"data-handleid":p,"data-nodeid":v,"data-handlepos":t,"data-id":`${v}-${p}-${e}`,className:Si(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",m,u,{source:!g,target:g,connectable:r,connectablestart:i,connectableend:o,connecting:_,connectionindicator:r&&(i&&!b||o&&b)}]),onMouseDown:x,onTouchStart:x,onClick:y?C:void 0,ref:h,...f,children:l})});sF.displayName="Handle";var a0=E.memo(sF);const aF=({data:e,isConnectable:t,targetPosition:n=ye.Top,sourcePosition:r=ye.Bottom})=>j.jsxs(j.Fragment,{children:[j.jsx(a0,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,j.jsx(a0,{type:"source",position:r,isConnectable:t})]});aF.displayName="DefaultNode";var dx=E.memo(aF);const lF=({data:e,isConnectable:t,sourcePosition:n=ye.Bottom})=>j.jsxs(j.Fragment,{children:[e==null?void 0:e.label,j.jsx(a0,{type:"source",position:n,isConnectable:t})]});lF.displayName="InputNode";var uF=E.memo(lF);const cF=({data:e,isConnectable:t,targetPosition:n=ye.Top})=>j.jsxs(j.Fragment,{children:[j.jsx(a0,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]});cF.displayName="OutputNode";var dF=E.memo(cF);const F3=()=>null;F3.displayName="GroupNode";const dve=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),Ng=e=>e.id;function fve(e,t){return Ir(e.selectedNodes.map(Ng),t.selectedNodes.map(Ng))&&Ir(e.selectedEdges.map(Ng),t.selectedEdges.map(Ng))}const fF=E.memo(({onSelectionChange:e})=>{const t=Jn(),{selectedNodes:n,selectedEdges:r}=Wt(dve,fve);return E.useEffect(()=>{var o,s;const i={nodes:n,edges:r};e==null||e(i),(s=(o=t.getState()).onSelectionChange)==null||s.call(o,i)},[n,r,e]),null});fF.displayName="SelectionListener";const hve=e=>!!e.onSelectionChange;function pve({onSelectionChange:e}){const t=Wt(hve);return e||t?j.jsx(fF,{onSelectionChange:e}):null}const gve=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function uu(e,t){E.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Le(e,t,n){E.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const mve=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:o,onConnectEnd:s,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:u,nodesConnectable:c,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:h,elevateNodesOnSelect:p,minZoom:g,maxZoom:S,nodeExtent:v,onNodesChange:y,onEdgesChange:m,elementsSelectable:b,connectionMode:_,snapGrid:w,snapToGrid:x,translateExtent:C,connectOnClick:k,defaultEdgeOptions:P,fitView:A,fitViewOptions:$,onNodesDelete:N,onEdgesDelete:T,onNodeDrag:O,onNodeDragStart:I,onNodeDragStop:M,onSelectionDrag:R,onSelectionDragStart:D,onSelectionDragStop:L,noPanClassName:V,nodeOrigin:z,rfId:U,autoPanOnConnect:K,autoPanOnNodeDrag:W,onError:X,connectionRadius:F,isValidConnection:q})=>{const{setNodes:Q,setEdges:J,setDefaultNodesAndEdges:ne,setMinZoom:Z,setMaxZoom:me,setTranslateExtent:ae,setNodeExtent:oe,reset:Ce}=Wt(gve,Ir),se=Jn();return E.useEffect(()=>{const qe=r==null?void 0:r.map(yt=>({...yt,...P}));return ne(n,qe),()=>{Ce()}},[]),Le("defaultEdgeOptions",P,se.setState),Le("connectionMode",_,se.setState),Le("onConnect",i,se.setState),Le("onConnectStart",o,se.setState),Le("onConnectEnd",s,se.setState),Le("onClickConnectStart",a,se.setState),Le("onClickConnectEnd",l,se.setState),Le("nodesDraggable",u,se.setState),Le("nodesConnectable",c,se.setState),Le("nodesFocusable",d,se.setState),Le("edgesFocusable",f,se.setState),Le("edgesUpdatable",h,se.setState),Le("elementsSelectable",b,se.setState),Le("elevateNodesOnSelect",p,se.setState),Le("snapToGrid",x,se.setState),Le("snapGrid",w,se.setState),Le("onNodesChange",y,se.setState),Le("onEdgesChange",m,se.setState),Le("connectOnClick",k,se.setState),Le("fitViewOnInit",A,se.setState),Le("fitViewOnInitOptions",$,se.setState),Le("onNodesDelete",N,se.setState),Le("onEdgesDelete",T,se.setState),Le("onNodeDrag",O,se.setState),Le("onNodeDragStart",I,se.setState),Le("onNodeDragStop",M,se.setState),Le("onSelectionDrag",R,se.setState),Le("onSelectionDragStart",D,se.setState),Le("onSelectionDragStop",L,se.setState),Le("noPanClassName",V,se.setState),Le("nodeOrigin",z,se.setState),Le("rfId",U,se.setState),Le("autoPanOnConnect",K,se.setState),Le("autoPanOnNodeDrag",W,se.setState),Le("onError",X,se.setState),Le("connectionRadius",F,se.setState),Le("isValidConnection",q,se.setState),uu(e,Q),uu(t,J),uu(g,Z),uu(S,me),uu(C,ae),uu(v,oe),null},s8={display:"none"},yve={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},hF="react-flow__node-desc",pF="react-flow__edge-desc",vve="react-flow__aria-live",bve=e=>e.ariaLiveMessage;function Sve({rfId:e}){const t=Wt(bve);return j.jsx("div",{id:`${vve}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:yve,children:t})}function _ve({rfId:e,disableKeyboardA11y:t}){return j.jsxs(j.Fragment,{children:[j.jsxs("div",{id:`${hF}-${e}`,style:s8,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),j.jsx("div",{id:`${pF}-${e}`,style:s8,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&j.jsx(Sve,{rfId:e})]})}const wve=(e,t,n)=>n===ye.Left?e-t:n===ye.Right?e+t:e,xve=(e,t,n)=>n===ye.Top?e-t:n===ye.Bottom?e+t:e,a8="react-flow__edgeupdater",l8=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:s,type:a})=>j.jsx("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:s,className:Si([a8,`${a8}-${a}`]),cx:wve(t,r,e),cy:xve(n,r,e),r,stroke:"transparent",fill:"transparent"}),Cve=()=>!0;var cu=e=>{const t=({id:n,className:r,type:i,data:o,onClick:s,onEdgeDoubleClick:a,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:g,style:S,source:v,target:y,sourceX:m,sourceY:b,targetX:_,targetY:w,sourcePosition:x,targetPosition:C,elementsSelectable:k,hidden:P,sourceHandleId:A,targetHandleId:$,onContextMenu:N,onMouseEnter:T,onMouseMove:O,onMouseLeave:I,edgeUpdaterRadius:M,onEdgeUpdate:R,onEdgeUpdateStart:D,onEdgeUpdateEnd:L,markerEnd:V,markerStart:z,rfId:U,ariaLabel:K,isFocusable:W,isUpdatable:X,pathOptions:F,interactionWidth:q})=>{const Q=E.useRef(null),[J,ne]=E.useState(!1),[Z,me]=E.useState(!1),ae=Jn(),oe=E.useMemo(()=>`url(#${cx(z,U)})`,[z,U]),Ce=E.useMemo(()=>`url(#${cx(V,U)})`,[V,U]);if(P)return null;const se=Te=>{const{edges:Me,addSelectedEdges:ie}=ae.getState();if(k&&(ae.setState({nodesSelectionActive:!1}),ie([n])),s){const pe=Me.find(Xt=>Xt.id===n);s(Te,pe)}},qe=Id(n,ae.getState,a),yt=Id(n,ae.getState,N),$e=Id(n,ae.getState,T),Fe=Id(n,ae.getState,O),Ie=Id(n,ae.getState,I),nt=(Te,Me)=>{if(Te.button!==0)return;const{edges:ie,isValidConnection:pe}=ae.getState(),Xt=Me?y:v,Ot=(Me?$:A)||null,ut=Me?"target":"source",tr=pe||Cve,Do=Me,Yr=ie.find(We=>We.id===n);me(!0),D==null||D(Te,Yr,ut);const Lo=We=>{me(!1),L==null||L(We,Yr,ut)};oF({event:Te,handleId:Ot,nodeId:Xt,onConnect:We=>R==null?void 0:R(Yr,We),isTarget:Do,getState:ae.getState,setState:ae.setState,isValidConnection:tr,edgeUpdaterType:ut,onEdgeUpdateEnd:Lo})},wt=Te=>nt(Te,!0),vn=Te=>nt(Te,!1),sn=()=>ne(!0),At=()=>ne(!1),ee=!k&&!s,Se=Te=>{var Me;if(H$.includes(Te.key)&&k){const{unselectNodesAndEdges:ie,addSelectedEdges:pe,edges:Xt}=ae.getState();Te.key==="Escape"?((Me=Q.current)==null||Me.blur(),ie({edges:[Xt.find(ut=>ut.id===n)]})):pe([n])}};return j.jsxs("g",{className:Si(["react-flow__edge",`react-flow__edge-${i}`,r,{selected:l,animated:u,inactive:ee,updating:J}]),onClick:se,onDoubleClick:qe,onContextMenu:yt,onMouseEnter:$e,onMouseMove:Fe,onMouseLeave:Ie,onKeyDown:W?Se:void 0,tabIndex:W?0:void 0,role:W?"button":void 0,"data-testid":`rf__edge-${n}`,"aria-label":K===null?void 0:K||`Edge from ${v} to ${y}`,"aria-describedby":W?`${pF}-${U}`:void 0,ref:Q,children:[!Z&&j.jsx(e,{id:n,source:v,target:y,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:g,data:o,style:S,sourceX:m,sourceY:b,targetX:_,targetY:w,sourcePosition:x,targetPosition:C,sourceHandleId:A,targetHandleId:$,markerStart:oe,markerEnd:Ce,pathOptions:F,interactionWidth:q}),X&&j.jsxs(j.Fragment,{children:[(X==="source"||X===!0)&&j.jsx(l8,{position:x,centerX:m,centerY:b,radius:M,onMouseDown:wt,onMouseEnter:sn,onMouseOut:At,type:"source"}),(X==="target"||X===!0)&&j.jsx(l8,{position:C,centerX:_,centerY:w,radius:M,onMouseDown:vn,onMouseEnter:sn,onMouseOut:At,type:"target"})]})]})};return t.displayName="EdgeWrapper",E.memo(t)};function Tve(e){const t={default:cu(e.default||s0),straight:cu(e.bezier||D3),step:cu(e.step||N3),smoothstep:cu(e.step||T1),simplebezier:cu(e.simplebezier||M3)},n={},r=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,o)=>(i[o]=cu(e[o]||s0),i),n);return{...t,...r}}function u8(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,o=(n==null?void 0:n.width)||t.width,s=(n==null?void 0:n.height)||t.height;switch(e){case ye.Top:return{x:r+o/2,y:i};case ye.Right:return{x:r+o,y:i+s/2};case ye.Bottom:return{x:r+o/2,y:i+s};case ye.Left:return{x:r,y:i+s/2}}}function c8(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const Eve=(e,t,n,r,i,o)=>{const s=u8(n,e,t),a=u8(o,r,i);return{sourceX:s.x,sourceY:s.y,targetX:a.x,targetY:a.y}};function Pve({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:o,width:s,height:a,transform:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+o)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=i0({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:s/l[2],height:a/l[2]}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),f=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*f)>0}function d8(e){var r,i,o,s,a;const t=((r=e==null?void 0:e[hn])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)||0,y:((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}function gF(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:gF(n,t):!1}function f8(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function kve(e,t,n,r){return Array.from(e.values()).filter(i=>(i.selected||i.id===r)&&(!i.parentNode||!gF(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var o,s;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=i.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((s=i.positionAbsolute)==null?void 0:s.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height}})}function Ave(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function mF(e,t,n,r,i=[0,0],o){const s=Ave(e,e.extent||r);let a=s;if(e.extent==="parent")if(e.parentNode&&e.width&&e.height){const c=n.get(e.parentNode),{x:d,y:f}=cc(c,i).positionAbsolute;a=c&&ui(d)&&ui(f)&&ui(c.width)&&ui(c.height)?[[d+e.width*i[0],f+e.height*i[1]],[d+c.width-e.width+e.width*i[0],f+c.height-e.height+e.height*i[1]]]:a}else o==null||o("005",_a.error005()),a=s;else if(e.extent&&e.parentNode){const c=n.get(e.parentNode),{x:d,y:f}=cc(c,i).positionAbsolute;a=[[e.extent[0][0]+d,e.extent[0][1]+f],[e.extent[1][0]+d,e.extent[1][1]+f]]}let l={x:0,y:0};if(e.parentNode){const c=n.get(e.parentNode);l=cc(c,i).positionAbsolute}const u=a?I3(t,a):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function S_({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?r.find(i=>i.id===e):r[0],r]}const h8=(e,t,n,r)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const o=Array.from(i),s=t.getBoundingClientRect(),a={x:s.width*r[0],y:s.height*r[1]};return o.map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(u.left-s.left-a.x)/n,y:(u.top-s.top-a.y)/n,...R3(l)}})};function Md(e,t,n){return n===void 0?n:r=>{const i=t().nodeInternals.get(e);n(r,{...i})}}function fx({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:s,nodeInternals:a}=t.getState(),l=a.get(e);t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&s)&&(o({nodes:[l]}),requestAnimationFrame(()=>{var u;return(u=r==null?void 0:r.current)==null?void 0:u.blur()})):i([e])}function Ove(){const e=Jn();return E.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:i,snapToGrid:o}=e.getState(),s=n.touches?n.touches[0].clientX:n.clientX,a=n.touches?n.touches[0].clientY:n.clientY,l={x:(s-r[0])/r[2],y:(a-r[1])/r[2]};return{xSnapped:o?i[0]*Math.round(l.x/i[0]):l.x,ySnapped:o?i[1]*Math.round(l.y/i[1]):l.y,...l}},[])}function __(e){return(t,n,r)=>e==null?void 0:e(t,r)}function yF({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,selectNodesOnDrag:s}){const a=Jn(),[l,u]=E.useState(!1),c=E.useRef([]),d=E.useRef({x:null,y:null}),f=E.useRef(0),h=E.useRef(null),p=E.useRef({x:0,y:0}),g=E.useRef(null),S=E.useRef(!1),v=Ove();return E.useEffect(()=>{if(e!=null&&e.current){const y=ki(e.current),m=({x:_,y:w})=>{const{nodeInternals:x,onNodeDrag:C,onSelectionDrag:k,updateNodePositions:P,nodeExtent:A,snapGrid:$,snapToGrid:N,nodeOrigin:T,onError:O}=a.getState();d.current={x:_,y:w};let I=!1;if(c.current=c.current.map(R=>{const D={x:_-R.distance.x,y:w-R.distance.y};N&&(D.x=$[0]*Math.round(D.x/$[0]),D.y=$[1]*Math.round(D.y/$[1]));const L=mF(R,D,x,A,T,O);return I=I||R.position.x!==L.position.x||R.position.y!==L.position.y,R.position=L.position,R.positionAbsolute=L.positionAbsolute,R}),!I)return;P(c.current,!0,!0),u(!0);const M=i?C:__(k);if(M&&g.current){const[R,D]=S_({nodeId:i,dragItems:c.current,nodeInternals:x});M(g.current,R,D)}},b=()=>{if(!h.current)return;const[_,w]=V$(p.current,h.current);if(_!==0||w!==0){const{transform:x,panBy:C}=a.getState();d.current.x=(d.current.x??0)-_/x[2],d.current.y=(d.current.y??0)-w/x[2],C({x:_,y:w})&&m(d.current)}f.current=requestAnimationFrame(b)};if(t)y.on(".drag",null);else{const _=Yme().on("start",w=>{var I;const{nodeInternals:x,multiSelectionActive:C,domNode:k,nodesDraggable:P,unselectNodesAndEdges:A,onNodeDragStart:$,onSelectionDragStart:N}=a.getState(),T=i?$:__(N);!s&&!C&&i&&((I=x.get(i))!=null&&I.selected||A()),i&&o&&s&&fx({id:i,store:a,nodeRef:e});const O=v(w);if(d.current=O,c.current=kve(x,P,O,i),T&&c.current){const[M,R]=S_({nodeId:i,dragItems:c.current,nodeInternals:x});T(w.sourceEvent,M,R)}h.current=(k==null?void 0:k.getBoundingClientRect())||null,p.current=ca(w.sourceEvent,h.current)}).on("drag",w=>{const x=v(w),{autoPanOnNodeDrag:C}=a.getState();!S.current&&C&&(S.current=!0,b()),(d.current.x!==x.xSnapped||d.current.y!==x.ySnapped)&&c.current&&(g.current=w.sourceEvent,p.current=ca(w.sourceEvent,h.current),m(x))}).on("end",w=>{if(u(!1),S.current=!1,cancelAnimationFrame(f.current),c.current){const{updateNodePositions:x,nodeInternals:C,onNodeDragStop:k,onSelectionDragStop:P}=a.getState(),A=i?k:__(P);if(x(c.current,!1,!1),A){const[$,N]=S_({nodeId:i,dragItems:c.current,nodeInternals:C});A(w.sourceEvent,$,N)}}}).filter(w=>{const x=w.target;return!w.button&&(!n||!f8(x,`.${n}`,e))&&(!r||f8(x,r,e))});return y.call(_),()=>{y.on(".drag",null)}}}},[e,t,n,r,o,a,i,s,v]),l}function vF(){const e=Jn();return E.useCallback(n=>{const{nodeInternals:r,nodeExtent:i,updateNodePositions:o,getNodes:s,snapToGrid:a,snapGrid:l,onError:u,nodesDraggable:c}=e.getState(),d=s().filter(y=>y.selected&&(y.draggable||c&&typeof y.draggable>"u")),f=a?l[0]:5,h=a?l[1]:5,p=n.isShiftPressed?4:1,g=n.x*f*p,S=n.y*h*p,v=d.map(y=>{if(y.positionAbsolute){const m={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+S};a&&(m.x=l[0]*Math.round(m.x/l[0]),m.y=l[1]*Math.round(m.y/l[1]));const{positionAbsolute:b,position:_}=mF(y,m,r,i,void 0,u);y.position=_,y.positionAbsolute=b}return y});o(v,!0,!1)},[])}const dc={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Nd=e=>{const t=({id:n,type:r,data:i,xPos:o,yPos:s,xPosOrigin:a,yPosOrigin:l,selected:u,onClick:c,onMouseEnter:d,onMouseMove:f,onMouseLeave:h,onContextMenu:p,onDoubleClick:g,style:S,className:v,isDraggable:y,isSelectable:m,isConnectable:b,isFocusable:_,selectNodesOnDrag:w,sourcePosition:x,targetPosition:C,hidden:k,resizeObserver:P,dragHandle:A,zIndex:$,isParent:N,noDragClassName:T,noPanClassName:O,initialized:I,disableKeyboardA11y:M,ariaLabel:R,rfId:D})=>{const L=Jn(),V=E.useRef(null),z=E.useRef(x),U=E.useRef(C),K=E.useRef(r),W=m||y||c||d||f||h,X=vF(),F=Md(n,L.getState,d),q=Md(n,L.getState,f),Q=Md(n,L.getState,h),J=Md(n,L.getState,p),ne=Md(n,L.getState,g),Z=oe=>{if(m&&(!w||!y)&&fx({id:n,store:L,nodeRef:V}),c){const Ce=L.getState().nodeInternals.get(n);c(oe,{...Ce})}},me=oe=>{if(!lx(oe))if(H$.includes(oe.key)&&m){const Ce=oe.key==="Escape";fx({id:n,store:L,unselect:Ce,nodeRef:V})}else!M&&y&&u&&Object.prototype.hasOwnProperty.call(dc,oe.key)&&(L.setState({ariaLiveMessage:`Moved selected node ${oe.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~s}`}),X({x:dc[oe.key].x,y:dc[oe.key].y,isShiftPressed:oe.shiftKey}))};E.useEffect(()=>{if(V.current&&!k){const oe=V.current;return P==null||P.observe(oe),()=>P==null?void 0:P.unobserve(oe)}},[k]),E.useEffect(()=>{const oe=K.current!==r,Ce=z.current!==x,se=U.current!==C;V.current&&(oe||Ce||se)&&(oe&&(K.current=r),Ce&&(z.current=x),se&&(U.current=C),L.getState().updateNodeDimensions([{id:n,nodeElement:V.current,forceUpdate:!0}]))},[n,r,x,C]);const ae=yF({nodeRef:V,disabled:k||!y,noDragClassName:T,handleSelector:A,nodeId:n,isSelectable:m,selectNodesOnDrag:w});return k?null:j.jsx("div",{className:Si(["react-flow__node",`react-flow__node-${r}`,{[O]:y},v,{selected:u,selectable:m,parent:N,dragging:ae}]),ref:V,style:{zIndex:$,transform:`translate(${a}px,${l}px)`,pointerEvents:W?"all":"none",visibility:I?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:F,onMouseMove:q,onMouseLeave:Q,onContextMenu:J,onClick:Z,onDoubleClick:ne,onKeyDown:_?me:void 0,tabIndex:_?0:void 0,role:_?"button":void 0,"aria-describedby":M?void 0:`${hF}-${D}`,"aria-label":R,children:j.jsx(J0e,{value:n,children:j.jsx(e,{id:n,data:i,type:r,xPos:o,yPos:s,selected:u,isConnectable:b,sourcePosition:x,targetPosition:C,dragging:ae,dragHandle:A,zIndex:$})})})};return t.displayName="NodeWrapper",E.memo(t)};function Rve(e){const t={input:Nd(e.input||uF),default:Nd(e.default||dx),output:Nd(e.output||dF),group:Nd(e.group||F3)},n={},r=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,o)=>(i[o]=Nd(e[o]||dx),i),n);return{...t,...r}}const Ive=({x:e,y:t,width:n,height:r,origin:i})=>!n||!r?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-r*i[1]},Mve=typeof document<"u"?document:null;var Nh=(e=null,t={target:Mve})=>{const[n,r]=E.useState(!1),i=E.useRef(!1),o=E.useRef(new Set([])),[s,a]=E.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=u.reduce((d,f)=>d.concat(...f),[]);return[u,c]}return[[],[]]},[e]);return E.useEffect(()=>{var l,u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,!i.current&&lx(h))return!1;const p=g8(h.code,a);o.current.add(h[p]),p8(s,o.current,!1)&&(h.preventDefault(),r(!0))},d=h=>{if(!i.current&&lx(h))return!1;const p=g8(h.code,a);p8(s,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(h[p]),i.current=!1},f=()=>{o.current.clear(),r(!1)};return(l=t==null?void 0:t.target)==null||l.addEventListener("keydown",c),(u=t==null?void 0:t.target)==null||u.addEventListener("keyup",d),window.addEventListener("blur",f),()=>{var h,p;(h=t==null?void 0:t.target)==null||h.removeEventListener("keydown",c),(p=t==null?void 0:t.target)==null||p.removeEventListener("keyup",d),window.removeEventListener("blur",f)}}},[e,r]),n};function p8(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function g8(e,t){return t.includes(e)?"code":"key"}function bF(e,t,n,r){var s,a;if(!e.parentNode)return n;const i=t.get(e.parentNode),o=cc(i,r);return bF(i,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((s=i[hn])==null?void 0:s.z)??0)>(n.z??0)?((a=i[hn])==null?void 0:a.z)??0:n.z??0},r)}function SF(e,t,n){e.forEach(r=>{var i;if(r.parentNode&&!e.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:o,y:s,z:a}=bF(r,e,{...r.position,z:((i=r[hn])==null?void 0:i.z)??0},t);r.positionAbsolute={x:o,y:s},r[hn].z=a,n!=null&&n[r.id]&&(r[hn].isParent=!0)}})}function w_(e,t,n,r){const i=new Map,o={},s=r?1e3:0;return e.forEach(a=>{var d;const l=(ui(a.zIndex)?a.zIndex:0)+(a.selected?s:0),u=t.get(a.id),c={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...a,positionAbsolute:{x:a.position.x,y:a.position.y}};a.parentNode&&(c.parentNode=a.parentNode,o[a.parentNode]=!0),Object.defineProperty(c,hn,{enumerable:!1,value:{handleBounds:(d=u==null?void 0:u[hn])==null?void 0:d.handleBounds,z:l}}),i.set(a.id,c)}),SF(i,n,o),i}function _F(e,t={}){const{getNodes:n,width:r,height:i,minZoom:o,maxZoom:s,d3Zoom:a,d3Selection:l,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:d}=e(),f=t.initial&&!u&&c;if(a&&l&&(f||!t.initial)){const p=n().filter(S=>{var y;const v=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return(y=t.nodes)!=null&&y.length?v&&t.nodes.some(m=>m.id===S.id):v}),g=p.every(S=>S.width&&S.height);if(p.length>0&&g){const S=J$(p,d),[v,y,m]=nF(S,r,i,t.minZoom??o,t.maxZoom??s,t.padding??.1),b=ua.translate(v,y).scale(m);return typeof t.duration=="number"&&t.duration>0?a.transform(Xa(l,t.duration),b):a.transform(l,b),!0}}return!1}function Nve(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[hn]:r[hn],selected:n.selected})}),new Map(t)}function Dve(e,t){return t.map(n=>{const r=e.find(i=>i.id===n.id);return r&&(n.selected=r.selected),n})}function Dg({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:i,edges:o,onNodesChange:s,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:u}=n();e!=null&&e.length&&(l&&r({nodeInternals:Nve(e,i)}),s==null||s(e)),t!=null&&t.length&&(u&&r({edges:Dve(t,o)}),a==null||a(t))}const du=()=>{},Lve={zoomIn:du,zoomOut:du,zoomTo:du,getZoom:()=>1,setViewport:du,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:du,fitBounds:du,project:e=>e,viewportInitialized:!1},$ve=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Fve=()=>{const e=Jn(),{d3Zoom:t,d3Selection:n}=Wt($ve,Ir);return E.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(Xa(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(Xa(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,o)=>t.scaleTo(Xa(n,o==null?void 0:o.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,o)=>{const[s,a,l]=e.getState().transform,u=ua.translate(i.x??s,i.y??a).scale(i.zoom??l);t.transform(Xa(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[i,o,s]=e.getState().transform;return{x:i,y:o,zoom:s}},fitView:i=>_F(e.getState,i),setCenter:(i,o,s)=>{const{width:a,height:l,maxZoom:u}=e.getState(),c=typeof(s==null?void 0:s.zoom)<"u"?s.zoom:u,d=a/2-i*c,f=l/2-o*c,h=ua.translate(d,f).scale(c);t.transform(Xa(n,s==null?void 0:s.duration),h)},fitBounds:(i,o)=>{const{width:s,height:a,minZoom:l,maxZoom:u}=e.getState(),[c,d,f]=nF(i,s,a,l,u,(o==null?void 0:o.padding)??.1),h=ua.translate(c,d).scale(f);t.transform(Xa(n,o==null?void 0:o.duration),h)},project:i=>{const{transform:o,snapToGrid:s,snapGrid:a}=e.getState();return Z$(i,o,s,a)},viewportInitialized:!0}:Lve,[t,n])};function wF(){const e=Fve(),t=Jn(),n=E.useCallback(()=>t.getState().getNodes().map(g=>({...g})),[]),r=E.useCallback(g=>t.getState().nodeInternals.get(g),[]),i=E.useCallback(()=>{const{edges:g=[]}=t.getState();return g.map(S=>({...S}))},[]),o=E.useCallback(g=>{const{edges:S=[]}=t.getState();return S.find(v=>v.id===g)},[]),s=E.useCallback(g=>{const{getNodes:S,setNodes:v,hasDefaultNodes:y,onNodesChange:m}=t.getState(),b=S(),_=typeof g=="function"?g(b):g;if(y)v(_);else if(m){const w=_.length===0?b.map(x=>({type:"remove",id:x.id})):_.map(x=>({item:x,type:"reset"}));m(w)}},[]),a=E.useCallback(g=>{const{edges:S=[],setEdges:v,hasDefaultEdges:y,onEdgesChange:m}=t.getState(),b=typeof g=="function"?g(S):g;if(y)v(b);else if(m){const _=b.length===0?S.map(w=>({type:"remove",id:w.id})):b.map(w=>({item:w,type:"reset"}));m(_)}},[]),l=E.useCallback(g=>{const S=Array.isArray(g)?g:[g],{getNodes:v,setNodes:y,hasDefaultNodes:m,onNodesChange:b}=t.getState();if(m){const w=[...v(),...S];y(w)}else if(b){const _=S.map(w=>({item:w,type:"add"}));b(_)}},[]),u=E.useCallback(g=>{const S=Array.isArray(g)?g:[g],{edges:v=[],setEdges:y,hasDefaultEdges:m,onEdgesChange:b}=t.getState();if(m)y([...v,...S]);else if(b){const _=S.map(w=>({item:w,type:"add"}));b(_)}},[]),c=E.useCallback(()=>{const{getNodes:g,edges:S=[],transform:v}=t.getState(),[y,m,b]=v;return{nodes:g().map(_=>({..._})),edges:S.map(_=>({..._})),viewport:{x:y,y:m,zoom:b}}},[]),d=E.useCallback(({nodes:g,edges:S})=>{const{nodeInternals:v,getNodes:y,edges:m,hasDefaultNodes:b,hasDefaultEdges:_,onNodesDelete:w,onEdgesDelete:x,onNodesChange:C,onEdgesChange:k}=t.getState(),P=(g||[]).map(O=>O.id),A=(S||[]).map(O=>O.id),$=y().reduce((O,I)=>{const M=!P.includes(I.id)&&I.parentNode&&O.find(D=>D.id===I.parentNode);return(typeof I.deletable=="boolean"?I.deletable:!0)&&(P.includes(I.id)||M)&&O.push(I),O},[]),N=m.filter(O=>typeof O.deletable=="boolean"?O.deletable:!0),T=N.filter(O=>A.includes(O.id));if($||T){const O=tF($,N),I=[...T,...O],M=I.reduce((R,D)=>(R.includes(D.id)||R.push(D.id),R),[]);if((_||b)&&(_&&t.setState({edges:m.filter(R=>!M.includes(R.id))}),b&&($.forEach(R=>{v.delete(R.id)}),t.setState({nodeInternals:new Map(v)}))),M.length>0&&(x==null||x(I),k&&k(M.map(R=>({id:R,type:"remove"})))),$.length>0&&(w==null||w($),C)){const R=$.map(D=>({id:D.id,type:"remove"}));C(R)}}},[]),f=E.useCallback(g=>{const S=q0e(g),v=S?null:t.getState().nodeInternals.get(g.id);return[S?g:Jk(v),v,S]},[]),h=E.useCallback((g,S=!0,v)=>{const[y,m,b]=f(g);return y?(v||t.getState().getNodes()).filter(_=>{if(!b&&(_.id===m.id||!_.positionAbsolute))return!1;const w=Jk(_),x=ax(w,y);return S&&x>0||x>=g.width*g.height}):[]},[]),p=E.useCallback((g,S,v=!0)=>{const[y]=f(g);if(!y)return!1;const m=ax(y,S);return v&&m>0||m>=g.width*g.height},[]);return E.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:o,setNodes:s,setEdges:a,addNodes:l,addEdges:u,toObject:c,deleteElements:d,getIntersectingNodes:h,isNodeIntersecting:p}),[e,n,r,i,o,s,a,l,u,c,d,h,p])}var Bve=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Jn(),{deleteElements:r}=wF(),i=Nh(e),o=Nh(t);E.useEffect(()=>{if(i){const{edges:s,getNodes:a}=n.getState(),l=a().filter(c=>c.selected),u=s.filter(c=>c.selected);r({nodes:l,edges:u}),n.setState({nodesSelectionActive:!1})}},[i]),E.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function jve(e){const t=Jn();E.useEffect(()=>{let n;const r=()=>{var o,s;if(!e.current)return;const i=R3(e.current);(i.height===0||i.width===0)&&((s=(o=t.getState()).onError)==null||s.call(o,"004",_a.error004())),t.setState({width:i.width||500,height:i.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const B3={position:"absolute",width:"100%",height:"100%",top:0,left:0},Vve=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,x_=e=>({x:e.x,y:e.y,zoom:e.k}),fu=(e,t)=>e.target.closest(`.${t}`),m8=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),zve=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),Uve=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:o=!0,panOnScroll:s=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=uc.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:d=!0,defaultViewport:f,translateExtent:h,minZoom:p,maxZoom:g,zoomActivationKeyCode:S,preventScrolling:v=!0,children:y,noWheelClassName:m,noPanClassName:b})=>{const _=E.useRef(),w=Jn(),x=E.useRef(!1),C=E.useRef(!1),k=E.useRef(null),P=E.useRef({x:0,y:0,zoom:0}),{d3Zoom:A,d3Selection:$,d3ZoomHandler:N,userSelectionActive:T}=Wt(zve,Ir),O=Nh(S),I=E.useRef(0);return jve(k),E.useEffect(()=>{if(k.current){const M=k.current.getBoundingClientRect(),R=B0e().scaleExtent([p,g]).translateExtent(h),D=ki(k.current).call(R),L=ua.translate(f.x,f.y).scale(Vc(f.zoom,p,g)),V=[[0,0],[M.width,M.height]],z=R.constrain()(L,V,h);R.transform(D,z),w.setState({d3Zoom:R,d3Selection:D,d3ZoomHandler:D.on("wheel.zoom"),transform:[z.x,z.y,z.k],domNode:k.current.closest(".react-flow")})}},[]),E.useEffect(()=>{$&&A&&(s&&!O&&!T?$.on("wheel.zoom",M=>{if(fu(M,m))return!1;M.preventDefault(),M.stopImmediatePropagation();const R=$.property("__zoom").k||1;if(M.ctrlKey&&o){const z=Yi(M),U=-M.deltaY*(M.deltaMode===1?.05:M.deltaMode?1:.002)*10,K=R*Math.pow(2,U);A.scaleTo($,K,z);return}const D=M.deltaMode===1?20:1,L=l===uc.Vertical?0:M.deltaX*D,V=l===uc.Horizontal?0:M.deltaY*D;A.translateBy($,-(L/R)*a,-(V/R)*a)},{passive:!1}):typeof N<"u"&&$.on("wheel.zoom",function(M,R){if(!v||fu(M,m))return null;M.preventDefault(),N.call(this,M,R)},{passive:!1}))},[T,s,l,$,A,N,O,o,v,m]),E.useEffect(()=>{A&&A.on("start",M=>{var D;if(!M.sourceEvent)return null;I.current=M.sourceEvent.button;const{onViewportChangeStart:R}=w.getState();if(x.current=!0,((D=M.sourceEvent)==null?void 0:D.type)==="mousedown"&&w.setState({paneDragging:!0}),t||R){const L=x_(M.transform);P.current=L,R==null||R(L),t==null||t(M.sourceEvent,L)}})},[A,t]),E.useEffect(()=>{A&&(T&&!x.current?A.on("zoom",null):T||A.on("zoom",M=>{const{onViewportChange:R}=w.getState();if(w.setState({transform:[M.transform.x,M.transform.y,M.transform.k]}),C.current=!!(r&&m8(d,I.current??0)),e||R){const D=x_(M.transform);R==null||R(D),e==null||e(M.sourceEvent,D)}}))},[T,A,e,d,r]),E.useEffect(()=>{A&&A.on("end",M=>{if(!M.sourceEvent)return null;const{onViewportChangeEnd:R}=w.getState();if(x.current=!1,w.setState({paneDragging:!1}),r&&m8(d,I.current??0)&&!C.current&&r(M.sourceEvent),C.current=!1,(n||R)&&Vve(P.current,M.transform)){const D=x_(M.transform);P.current=D,clearTimeout(_.current),_.current=setTimeout(()=>{R==null||R(D),n==null||n(M.sourceEvent,D)},s?150:0)}})},[A,s,d,n,r]),E.useEffect(()=>{A&&A.filter(M=>{const R=O||i,D=o&&M.ctrlKey;if(M.button===1&&M.type==="mousedown"&&(fu(M,"react-flow__node")||fu(M,"react-flow__edge")))return!0;if(!d&&!R&&!s&&!u&&!o||T||!u&&M.type==="dblclick"||fu(M,m)&&M.type==="wheel"||fu(M,b)&&M.type!=="wheel"||!o&&M.ctrlKey&&M.type==="wheel"||!R&&!s&&!D&&M.type==="wheel"||!d&&(M.type==="mousedown"||M.type==="touchstart")||Array.isArray(d)&&!d.includes(M.button)&&(M.type==="mousedown"||M.type==="touchstart"))return!1;const L=Array.isArray(d)&&d.includes(M.button)||!M.button||M.button<=1;return(!M.ctrlKey||M.type==="wheel")&&L})},[T,A,i,o,s,u,d,c,O]),j.jsx("div",{className:"react-flow__renderer",ref:k,style:B3,children:y})},Gve=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Hve(){const{userSelectionActive:e,userSelectionRect:t}=Wt(Gve,Ir);return e&&t?j.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function y8(e,t){const n=e.find(r=>r.id===t.parentNode);if(n){const r=t.position.x+t.width-n.width,i=t.position.y+t.height-n.height;if(r>0||i>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,r>0&&(n.style.width+=r),i>0&&(n.style.height+=i),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function xF(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,i)=>{const o=e.filter(a=>a.id===i.id);if(o.length===0)return r.push(i),r;const s={...i};for(const a of o)if(a)switch(a.type){case"select":{s.selected=a.selected;break}case"position":{typeof a.position<"u"&&(s.position=a.position),typeof a.positionAbsolute<"u"&&(s.positionAbsolute=a.positionAbsolute),typeof a.dragging<"u"&&(s.dragging=a.dragging),s.expandParent&&y8(r,s);break}case"dimensions":{typeof a.dimensions<"u"&&(s.width=a.dimensions.width,s.height=a.dimensions.height),typeof a.updateStyle<"u"&&(s.style={...s.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(s.resizing=a.resizing),s.expandParent&&y8(r,s);break}case"remove":return r}return r.push(s),r},n)}function CF(e,t){return xF(e,t)}function qve(e,t){return xF(e,t)}const js=(e,t)=>({id:e,type:"select",selected:t});function Uu(e,t){return e.reduce((n,r)=>{const i=t.includes(r.id);return!r.selected&&i?(r.selected=!0,n.push(js(r.id,!0))):r.selected&&!i&&(r.selected=!1,n.push(js(r.id,!1))),n},[])}const C_=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Wve=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),TF=E.memo(({isSelecting:e,selectionMode:t=Mh.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:o,onPaneContextMenu:s,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:u,onPaneMouseLeave:c,children:d})=>{const f=E.useRef(null),h=Jn(),p=E.useRef(0),g=E.useRef(0),S=E.useRef(),{userSelectionActive:v,elementsSelectable:y,dragging:m}=Wt(Wve,Ir),b=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,g.current=0},_=N=>{o==null||o(N),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},w=N=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){N.preventDefault();return}s==null||s(N)},x=a?N=>a(N):void 0,C=N=>{const{resetSelectedElements:T,domNode:O}=h.getState();if(S.current=O==null?void 0:O.getBoundingClientRect(),!y||!e||N.button!==0||N.target!==f.current||!S.current)return;const{x:I,y:M}=ca(N,S.current);T(),h.setState({userSelectionRect:{width:0,height:0,startX:I,startY:M,x:I,y:M}}),r==null||r(N)},k=N=>{const{userSelectionRect:T,nodeInternals:O,edges:I,transform:M,onNodesChange:R,onEdgesChange:D,nodeOrigin:L,getNodes:V}=h.getState();if(!e||!S.current||!T)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const z=ca(N,S.current),U=T.startX??0,K=T.startY??0,W={...T,x:z.xJ.id),Q=F.map(J=>J.id);if(p.current!==Q.length){p.current=Q.length;const J=Uu(X,Q);J.length&&(R==null||R(J))}if(g.current!==q.length){g.current=q.length;const J=Uu(I,q);J.length&&(D==null||D(J))}h.setState({userSelectionRect:W})},P=N=>{if(N.button!==0)return;const{userSelectionRect:T}=h.getState();!v&&T&&N.target===f.current&&(_==null||_(N)),h.setState({nodesSelectionActive:p.current>0}),b(),i==null||i(N)},A=N=>{v&&(h.setState({nodesSelectionActive:p.current>0}),i==null||i(N)),b()},$=y&&(e||v);return j.jsxs("div",{className:Si(["react-flow__pane",{dragging:m,selection:e}]),onClick:$?void 0:C_(_,f),onContextMenu:C_(w,f),onWheel:C_(x,f),onMouseEnter:$?void 0:l,onMouseDown:$?C:void 0,onMouseMove:$?k:u,onMouseUp:$?P:void 0,onMouseLeave:$?A:c,ref:f,style:B3,children:[d,j.jsx(Hve,{})]})});TF.displayName="Pane";const Kve=e=>{const t=e.getNodes().filter(n=>n.selected);return{...J$(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function Yve({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Jn(),{width:i,height:o,x:s,y:a,transformString:l,userSelectionActive:u}=Wt(Kve,Ir),c=vF(),d=E.useRef(null);if(E.useEffect(()=>{var p;n||(p=d.current)==null||p.focus({preventScroll:!0})},[n]),yF({nodeRef:d}),u||!i||!o)return null;const f=e?p=>{const g=r.getState().getNodes().filter(S=>S.selected);e(p,g)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(dc,p.key)&&c({x:dc[p.key].x,y:dc[p.key].y,isShiftPressed:p.shiftKey})};return j.jsx("div",{className:Si(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:j.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:o,top:a,left:s}})})}var Xve=E.memo(Yve);const Qve=e=>e.nodesSelectionActive,EF=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:s,deleteKeyCode:a,onMove:l,onMoveStart:u,onMoveEnd:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:S,panActivationKeyCode:v,zoomActivationKeyCode:y,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:_,panOnScroll:w,panOnScrollSpeed:x,panOnScrollMode:C,zoomOnDoubleClick:k,panOnDrag:P,defaultViewport:A,translateExtent:$,minZoom:N,maxZoom:T,preventScrolling:O,onSelectionContextMenu:I,noWheelClassName:M,noPanClassName:R,disableKeyboardA11y:D})=>{const L=Wt(Qve),V=Nh(d),U=Nh(v)||P,K=V||f&&U!==!0;return Bve({deleteKeyCode:a,multiSelectionKeyCode:S}),j.jsx(Uve,{onMove:l,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:o,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:_,panOnScroll:w,panOnScrollSpeed:x,panOnScrollMode:C,zoomOnDoubleClick:k,panOnDrag:!V&&U,defaultViewport:A,translateExtent:$,minZoom:N,maxZoom:T,zoomActivationKeyCode:y,preventScrolling:O,noWheelClassName:M,noPanClassName:R,children:j.jsxs(TF,{onSelectionStart:p,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:s,panOnDrag:U,isSelecting:!!K,selectionMode:h,children:[e,L&&j.jsx(Xve,{onSelectionContextMenu:I,noPanClassName:R,disableKeyboardA11y:D})]})})};EF.displayName="FlowRenderer";var Zve=E.memo(EF);function Jve(e){return Wt(E.useCallback(n=>e?eF(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}const e1e=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),PF=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:o,onError:s}=Wt(e1e,Ir),a=Jve(e.onlyRenderVisibleElements),l=E.useRef(),u=E.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(d=>{const f=d.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));o(f)});return l.current=c,c},[]);return E.useEffect(()=>()=>{var c;(c=l==null?void 0:l.current)==null||c.disconnect()},[]),j.jsx("div",{className:"react-flow__nodes",style:B3,children:a.map(c=>{var _,w;let d=c.type||"default";e.nodeTypes[d]||(s==null||s("003",_a.error003(d)),d="default");const f=e.nodeTypes[d]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),p=!!(c.selectable||i&&typeof c.selectable>"u"),g=!!(c.connectable||n&&typeof c.connectable>"u"),S=!!(c.focusable||r&&typeof c.focusable>"u"),v=e.nodeExtent?I3(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,y=(v==null?void 0:v.x)??0,m=(v==null?void 0:v.y)??0,b=Ive({x:y,y:m,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return j.jsx(f,{id:c.id,className:c.className,style:c.style,type:d,data:c.data,sourcePosition:c.sourcePosition||ye.Bottom,targetPosition:c.targetPosition||ye.Top,hidden:c.hidden,xPos:y,yPos:m,xPosOrigin:b.x,yPosOrigin:b.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:p,isConnectable:g,isFocusable:S,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((_=c[hn])==null?void 0:_.z)??0,isParent:!!((w=c[hn])!=null&&w.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel},c.id)})})};PF.displayName="NodeRenderer";var t1e=E.memo(PF);const n1e=[{level:0,isMaxLevel:!0,edges:[]}];function r1e(e,t,n=!1){let r=-1;const i=e.reduce((s,a)=>{var c,d;const l=ui(a.zIndex);let u=l?a.zIndex:0;if(n){const f=t.get(a.target),h=t.get(a.source),p=a.selected||(f==null?void 0:f.selected)||(h==null?void 0:h.selected),g=Math.max(((c=h==null?void 0:h[hn])==null?void 0:c.z)||0,((d=f==null?void 0:f[hn])==null?void 0:d.z)||0,1e3);u=(l?a.zIndex:0)+(p?g:0)}return s[u]?s[u].push(a):s[u]=[a],r=u>r?u:r,s},{}),o=Object.entries(i).map(([s,a])=>{const l=+s;return{edges:a,level:l,isMaxLevel:l===r}});return o.length===0?n1e:o}function i1e(e,t,n){const r=Wt(E.useCallback(i=>e?i.edges.filter(o=>{const s=t.get(o.source),a=t.get(o.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&Pve({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:a.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:a.width,targetHeight:a.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return r1e(r,t,n)}const o1e=({color:e="none",strokeWidth:t=1})=>j.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:"none",points:"-5,-4 0,0 -5,4"}),s1e=({color:e="none",strokeWidth:t=1})=>j.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:e,points:"-5,-4 0,0 -5,4 -5,-4"}),v8={[o0.Arrow]:o1e,[o0.ArrowClosed]:s1e};function a1e(e){const t=Jn();return E.useMemo(()=>{var i,o;return Object.prototype.hasOwnProperty.call(v8,e)?v8[e]:((o=(i=t.getState()).onError)==null||o.call(i,"009",_a.error009(e)),null)},[e])}const l1e=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:o="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const l=a1e(t);return l?j.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:a,refX:"0",refY:"0",children:j.jsx(l,{color:n,strokeWidth:s})}):null},u1e=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((i,o)=>([o.markerStart,o.markerEnd].forEach(s=>{if(s&&typeof s=="object"){const a=cx(s,t);r.includes(a)||(i.push({id:a,color:s.color||e,...s}),r.push(a))}}),i),[]).sort((i,o)=>i.id.localeCompare(o.id))},kF=({defaultColor:e,rfId:t})=>{const n=Wt(E.useCallback(u1e({defaultColor:e,rfId:t}),[e,t]),(r,i)=>!(r.length!==i.length||r.some((o,s)=>o.id!==i[s].id)));return j.jsx("defs",{children:n.map(r=>j.jsx(l1e,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})};kF.displayName="MarkerDefinitions";var c1e=E.memo(kF);const d1e=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),AF=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:o,onEdgeUpdate:s,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:c,onEdgeClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:g,children:S})=>{const{edgesFocusable:v,edgesUpdatable:y,elementsSelectable:m,width:b,height:_,connectionMode:w,nodeInternals:x,onError:C}=Wt(d1e,Ir),k=i1e(t,x,n);return b?j.jsxs(j.Fragment,{children:[k.map(({level:P,edges:A,isMaxLevel:$})=>j.jsxs("svg",{style:{zIndex:P},width:b,height:_,className:"react-flow__edges react-flow__container",children:[$&&j.jsx(c1e,{defaultColor:e,rfId:r}),j.jsx("g",{children:A.map(N=>{const[T,O,I]=d8(x.get(N.source)),[M,R,D]=d8(x.get(N.target));if(!I||!D)return null;let L=N.type||"default";i[L]||(C==null||C("011",_a.error011(L)),L="default");const V=i[L]||i.default,z=w===Ol.Strict?R.target:(R.target??[]).concat(R.source??[]),U=c8(O.source,N.sourceHandle),K=c8(z,N.targetHandle),W=(U==null?void 0:U.position)||ye.Bottom,X=(K==null?void 0:K.position)||ye.Top,F=!!(N.focusable||v&&typeof N.focusable>"u"),q=typeof s<"u"&&(N.updatable||y&&typeof N.updatable>"u");if(!U||!K)return C==null||C("008",_a.error008(U,N)),null;const{sourceX:Q,sourceY:J,targetX:ne,targetY:Z}=Eve(T,U,W,M,K,X);return j.jsx(V,{id:N.id,className:Si([N.className,o]),type:L,data:N.data,selected:!!N.selected,animated:!!N.animated,hidden:!!N.hidden,label:N.label,labelStyle:N.labelStyle,labelShowBg:N.labelShowBg,labelBgStyle:N.labelBgStyle,labelBgPadding:N.labelBgPadding,labelBgBorderRadius:N.labelBgBorderRadius,style:N.style,source:N.source,target:N.target,sourceHandleId:N.sourceHandle,targetHandleId:N.targetHandle,markerEnd:N.markerEnd,markerStart:N.markerStart,sourceX:Q,sourceY:J,targetX:ne,targetY:Z,sourcePosition:W,targetPosition:X,elementsSelectable:m,onEdgeUpdate:s,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:c,onClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:g,rfId:r,ariaLabel:N.ariaLabel,isFocusable:F,isUpdatable:q,pathOptions:"pathOptions"in N?N.pathOptions:void 0,interactionWidth:N.interactionWidth},N.id)})})]},P)),S]}):null};AF.displayName="EdgeRenderer";var f1e=E.memo(AF);const h1e=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function p1e({children:e}){const t=Wt(h1e);return j.jsx("div",{className:"react-flow__viewport react-flow__container",style:{transform:t},children:e})}function g1e(e){const t=wF(),n=E.useRef(!1);E.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const m1e={[ye.Left]:ye.Right,[ye.Right]:ye.Left,[ye.Top]:ye.Bottom,[ye.Bottom]:ye.Top},OF=({nodeId:e,handleType:t,style:n,type:r=qs.Bezier,CustomComponent:i,connectionStatus:o})=>{var w,x,C;const{fromNode:s,handleId:a,toX:l,toY:u,connectionMode:c}=Wt(E.useCallback(k=>({fromNode:k.nodeInternals.get(e),handleId:k.connectionHandleId,toX:(k.connectionPosition.x-k.transform[0])/k.transform[2],toY:(k.connectionPosition.y-k.transform[1])/k.transform[2],connectionMode:k.connectionMode}),[e]),Ir),d=(w=s==null?void 0:s[hn])==null?void 0:w.handleBounds;let f=d==null?void 0:d[t];if(c===Ol.Loose&&(f=f||(d==null?void 0:d[t==="source"?"target":"source"])),!s||!f)return null;const h=a?f.find(k=>k.id===a):f[0],p=h?h.x+h.width/2:(s.width??0)/2,g=h?h.y+h.height/2:s.height??0,S=(((x=s.positionAbsolute)==null?void 0:x.x)??0)+p,v=(((C=s.positionAbsolute)==null?void 0:C.y)??0)+g,y=h==null?void 0:h.position,m=y?m1e[y]:null;if(!y||!m)return null;if(i)return j.jsx(i,{connectionLineType:r,connectionLineStyle:n,fromNode:s,fromHandle:h,fromX:S,fromY:v,toX:l,toY:u,fromPosition:y,toPosition:m,connectionStatus:o});let b="";const _={sourceX:S,sourceY:v,sourcePosition:y,targetX:l,targetY:u,targetPosition:m};return r===qs.Bezier?[b]=X$(_):r===qs.Step?[b]=ux({..._,borderRadius:0}):r===qs.SmoothStep?[b]=ux(_):r===qs.SimpleBezier?[b]=Y$(_):b=`M${S},${v} ${l},${u}`,j.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:n})};OF.displayName="ConnectionLine";const y1e=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function v1e({containerStyle:e,style:t,type:n,component:r}){const{nodeId:i,handleType:o,nodesConnectable:s,width:a,height:l,connectionStatus:u}=Wt(y1e,Ir);return!(i&&o&&a&&s)?null:j.jsx("svg",{style:e,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container",children:j.jsx("g",{className:Si(["react-flow__connection",u]),children:j.jsx(OF,{nodeId:i,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})})})}const RF=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:o,onNodeClick:s,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,onSelectionContextMenu:p,onSelectionStart:g,onSelectionEnd:S,connectionLineType:v,connectionLineStyle:y,connectionLineComponent:m,connectionLineContainerStyle:b,selectionKeyCode:_,selectionOnDrag:w,selectionMode:x,multiSelectionKeyCode:C,panActivationKeyCode:k,zoomActivationKeyCode:P,deleteKeyCode:A,onlyRenderVisibleElements:$,elementsSelectable:N,selectNodesOnDrag:T,defaultViewport:O,translateExtent:I,minZoom:M,maxZoom:R,preventScrolling:D,defaultMarkerColor:L,zoomOnScroll:V,zoomOnPinch:z,panOnScroll:U,panOnScrollSpeed:K,panOnScrollMode:W,zoomOnDoubleClick:X,panOnDrag:F,onPaneClick:q,onPaneMouseEnter:Q,onPaneMouseMove:J,onPaneMouseLeave:ne,onPaneScroll:Z,onPaneContextMenu:me,onEdgeUpdate:ae,onEdgeContextMenu:oe,onEdgeMouseEnter:Ce,onEdgeMouseMove:se,onEdgeMouseLeave:qe,edgeUpdaterRadius:yt,onEdgeUpdateStart:$e,onEdgeUpdateEnd:Fe,noDragClassName:Ie,noWheelClassName:nt,noPanClassName:wt,elevateEdgesOnSelect:vn,disableKeyboardA11y:sn,nodeOrigin:At,nodeExtent:ee,rfId:Se})=>(g1e(o),j.jsx(Zve,{onPaneClick:q,onPaneMouseEnter:Q,onPaneMouseMove:J,onPaneMouseLeave:ne,onPaneContextMenu:me,onPaneScroll:Z,deleteKeyCode:A,selectionKeyCode:_,selectionOnDrag:w,selectionMode:x,onSelectionStart:g,onSelectionEnd:S,multiSelectionKeyCode:C,panActivationKeyCode:k,zoomActivationKeyCode:P,elementsSelectable:N,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:V,zoomOnPinch:z,zoomOnDoubleClick:X,panOnScroll:U,panOnScrollSpeed:K,panOnScrollMode:W,panOnDrag:F,defaultViewport:O,translateExtent:I,minZoom:M,maxZoom:R,onSelectionContextMenu:p,preventScrolling:D,noDragClassName:Ie,noWheelClassName:nt,noPanClassName:wt,disableKeyboardA11y:sn,children:j.jsxs(p1e,{children:[j.jsx(f1e,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:u,onEdgeUpdate:ae,onlyRenderVisibleElements:$,onEdgeContextMenu:oe,onEdgeMouseEnter:Ce,onEdgeMouseMove:se,onEdgeMouseLeave:qe,onEdgeUpdateStart:$e,onEdgeUpdateEnd:Fe,edgeUpdaterRadius:yt,defaultMarkerColor:L,noPanClassName:wt,elevateEdgesOnSelect:!!vn,disableKeyboardA11y:sn,rfId:Se,children:j.jsx(v1e,{style:y,type:v,component:m,containerStyle:b})}),j.jsx("div",{className:"react-flow__edgelabel-renderer"}),j.jsx(t1e,{nodeTypes:e,onNodeClick:s,onNodeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,selectNodesOnDrag:T,onlyRenderVisibleElements:$,noPanClassName:wt,noDragClassName:Ie,disableKeyboardA11y:sn,nodeOrigin:At,nodeExtent:ee,rfId:Se})]})}));RF.displayName="GraphView";var b1e=E.memo(RF);const hx=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Rs={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:hx,nodeExtent:hx,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Ol.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:W0e,isValidConnection:void 0},S1e=()=>oge((e,t)=>({...Rs,setNodes:n=>{const{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:o}=t();e({nodeInternals:w_(n,r,i,o)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(i=>({...r,...i}))})},setDefaultNodesAndEdges:(n,r)=>{const i=typeof n<"u",o=typeof r<"u",s=i?w_(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:s,edges:o?r:[],hasDefaultNodes:i,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:i,fitViewOnInit:o,fitViewOnInitDone:s,fitViewOnInitOptions:a,domNode:l,nodeOrigin:u}=t(),c=l==null?void 0:l.querySelector(".react-flow__viewport");if(!c)return;const d=window.getComputedStyle(c),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=n.reduce((g,S)=>{const v=i.get(S.id);if(v){const y=R3(S.nodeElement);!!(y.width&&y.height&&(v.width!==y.width||v.height!==y.height||S.forceUpdate))&&(i.set(v.id,{...v,[hn]:{...v[hn],handleBounds:{source:h8(".source",S.nodeElement,f,u),target:h8(".target",S.nodeElement,f,u)}},...y}),g.push({id:v.id,type:"dimensions",dimensions:y}))}return g},[]);SF(i,u);const p=s||o&&!s&&_F(t,{initial:!0,...a});e({nodeInternals:new Map(i),fitViewOnInitDone:p}),(h==null?void 0:h.length)>0&&(r==null||r(h))},updateNodePositions:(n,r=!0,i=!1)=>{const{triggerNodeChanges:o}=t(),s=n.map(a=>{const l={id:a.id,type:"position",dragging:i};return r&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});o(s)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:i,hasDefaultNodes:o,nodeOrigin:s,getNodes:a,elevateNodesOnSelect:l}=t();if(n!=null&&n.length){if(o){const u=CF(n,a()),c=w_(u,i,s,l);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let s,a=null;r?s=n.map(l=>js(l,!0)):(s=Uu(o(),n),a=Uu(i,[])),Dg({changedNodes:s,changedEdges:a,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let s,a=null;r?s=n.map(l=>js(l,!0)):(s=Uu(i,n),a=Uu(o(),[])),Dg({changedNodes:a,changedEdges:s,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:i,getNodes:o}=t(),s=n||o(),a=r||i,l=s.map(c=>(c.selected=!1,js(c.id,!1))),u=a.map(c=>js(c.id,!1));Dg({changedNodes:l,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:i}=t();r==null||r.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:i}=t();r==null||r.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),o=r().filter(a=>a.selected).map(a=>js(a.id,!1)),s=n.filter(a=>a.selected).map(a=>js(a.id,!1));Dg({changedNodes:o,changedEdges:s,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(i=>{i.positionAbsolute=I3(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:i,height:o,d3Zoom:s,d3Selection:a,translateExtent:l}=t();if(!s||!a||!n.x&&!n.y)return!1;const u=ua.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[i,o]],d=s==null?void 0:s.constrain()(u,c,l);return s.transform(a,d),r[0]!==d.x||r[1]!==d.y||r[2]!==d.k},cancelConnection:()=>e({connectionNodeId:Rs.connectionNodeId,connectionHandleId:Rs.connectionHandleId,connectionHandleType:Rs.connectionHandleType,connectionStatus:Rs.connectionStatus,connectionStartHandle:Rs.connectionStartHandle,connectionEndHandle:Rs.connectionEndHandle}),reset:()=>e({...Rs})})),IF=({children:e})=>{const t=E.useRef(null);return t.current||(t.current=S1e()),j.jsx(j0e,{value:t.current,children:e})};IF.displayName="ReactFlowProvider";const MF=({children:e})=>E.useContext(C1)?j.jsx(j.Fragment,{children:e}):j.jsx(IF,{children:e});MF.displayName="ReactFlowWrapper";function b8(e,t){return E.useRef(null),E.useMemo(()=>t(e),[e])}const _1e={input:uF,default:dx,output:dF,group:F3},w1e={default:s0,straight:D3,step:N3,smoothstep:T1,simplebezier:M3},x1e=[0,0],C1e=[15,15],T1e={x:0,y:0,zoom:1},E1e={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},P1e=E.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o=_1e,edgeTypes:s=w1e,onNodeClick:a,onEdgeClick:l,onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:p,onConnectEnd:g,onClickConnectStart:S,onClickConnectEnd:v,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:b,onNodeContextMenu:_,onNodeDoubleClick:w,onNodeDragStart:x,onNodeDrag:C,onNodeDragStop:k,onNodesDelete:P,onEdgesDelete:A,onSelectionChange:$,onSelectionDragStart:N,onSelectionDrag:T,onSelectionDragStop:O,onSelectionContextMenu:I,onSelectionStart:M,onSelectionEnd:R,connectionMode:D=Ol.Strict,connectionLineType:L=qs.Bezier,connectionLineStyle:V,connectionLineComponent:z,connectionLineContainerStyle:U,deleteKeyCode:K="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:X=!1,selectionMode:F=Mh.Full,panActivationKeyCode:q="Space",multiSelectionKeyCode:Q="Meta",zoomActivationKeyCode:J="Meta",snapToGrid:ne=!1,snapGrid:Z=C1e,onlyRenderVisibleElements:me=!1,selectNodesOnDrag:ae=!0,nodesDraggable:oe,nodesConnectable:Ce,nodesFocusable:se,nodeOrigin:qe=x1e,edgesFocusable:yt,edgesUpdatable:$e,elementsSelectable:Fe,defaultViewport:Ie=T1e,minZoom:nt=.5,maxZoom:wt=2,translateExtent:vn=hx,preventScrolling:sn=!0,nodeExtent:At,defaultMarkerColor:ee="#b1b1b7",zoomOnScroll:Se=!0,zoomOnPinch:Te=!0,panOnScroll:Me=!1,panOnScrollSpeed:ie=.5,panOnScrollMode:pe=uc.Free,zoomOnDoubleClick:Xt=!0,panOnDrag:Ot=!0,onPaneClick:ut,onPaneMouseEnter:tr,onPaneMouseMove:Do,onPaneMouseLeave:Yr,onPaneScroll:Lo,onPaneContextMenu:ct,children:We,onEdgeUpdate:An,onEdgeContextMenu:bn,onEdgeDoubleClick:Gn,onEdgeMouseEnter:nr,onEdgeMouseMove:mr,onEdgeMouseLeave:Gi,onEdgeUpdateStart:rr,onEdgeUpdateEnd:On,edgeUpdaterRadius:$o=10,onNodesChange:Ts,onEdgesChange:Es,noDragClassName:Jl="nodrag",noWheelClassName:Fo="nowheel",noPanClassName:ir="nopan",fitView:Ba=!1,fitViewOptions:Ab,connectOnClick:Ob=!0,attributionPosition:Rb,proOptions:Ib,defaultEdgeOptions:Ps,elevateNodesOnSelect:Mb=!0,elevateEdgesOnSelect:Nb=!1,disableKeyboardA11y:Up=!1,autoPanOnConnect:Db=!0,autoPanOnNodeDrag:Lb=!0,connectionRadius:$b=20,isValidConnection:dd,onError:Fb,style:eu,id:tu,...Bb},nu)=>{const Gp=b8(o,Rve),jb=b8(s,Tve),fd=tu||"1";return j.jsx("div",{...Bb,style:{...eu,...E1e},ref:nu,className:Si(["react-flow",i]),"data-testid":"rf__wrapper",id:tu,children:j.jsxs(MF,{children:[j.jsx(b1e,{onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:b,onNodeContextMenu:_,onNodeDoubleClick:w,nodeTypes:Gp,edgeTypes:jb,connectionLineType:L,connectionLineStyle:V,connectionLineComponent:z,connectionLineContainerStyle:U,selectionKeyCode:W,selectionOnDrag:X,selectionMode:F,deleteKeyCode:K,multiSelectionKeyCode:Q,panActivationKeyCode:q,zoomActivationKeyCode:J,onlyRenderVisibleElements:me,selectNodesOnDrag:ae,defaultViewport:Ie,translateExtent:vn,minZoom:nt,maxZoom:wt,preventScrolling:sn,zoomOnScroll:Se,zoomOnPinch:Te,zoomOnDoubleClick:Xt,panOnScroll:Me,panOnScrollSpeed:ie,panOnScrollMode:pe,panOnDrag:Ot,onPaneClick:ut,onPaneMouseEnter:tr,onPaneMouseMove:Do,onPaneMouseLeave:Yr,onPaneScroll:Lo,onPaneContextMenu:ct,onSelectionContextMenu:I,onSelectionStart:M,onSelectionEnd:R,onEdgeUpdate:An,onEdgeContextMenu:bn,onEdgeDoubleClick:Gn,onEdgeMouseEnter:nr,onEdgeMouseMove:mr,onEdgeMouseLeave:Gi,onEdgeUpdateStart:rr,onEdgeUpdateEnd:On,edgeUpdaterRadius:$o,defaultMarkerColor:ee,noDragClassName:Jl,noWheelClassName:Fo,noPanClassName:ir,elevateEdgesOnSelect:Nb,rfId:fd,disableKeyboardA11y:Up,nodeOrigin:qe,nodeExtent:At}),j.jsx(mve,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:p,onConnectEnd:g,onClickConnectStart:S,onClickConnectEnd:v,nodesDraggable:oe,nodesConnectable:Ce,nodesFocusable:se,edgesFocusable:yt,edgesUpdatable:$e,elementsSelectable:Fe,elevateNodesOnSelect:Mb,minZoom:nt,maxZoom:wt,nodeExtent:At,onNodesChange:Ts,onEdgesChange:Es,snapToGrid:ne,snapGrid:Z,connectionMode:D,translateExtent:vn,connectOnClick:Ob,defaultEdgeOptions:Ps,fitView:Ba,fitViewOptions:Ab,onNodesDelete:P,onEdgesDelete:A,onNodeDragStart:x,onNodeDrag:C,onNodeDragStop:k,onSelectionDrag:T,onSelectionDragStart:N,onSelectionDragStop:O,noPanClassName:ir,nodeOrigin:qe,rfId:fd,autoPanOnConnect:Db,autoPanOnNodeDrag:Lb,onError:Fb,connectionRadius:$b,isValidConnection:dd}),j.jsx(pve,{onSelectionChange:$}),We,j.jsx(U0e,{proOptions:Ib,position:Rb}),j.jsx(_ve,{rfId:fd,disableKeyboardA11y:Up})]})})});P1e.displayName="ReactFlow";const k1e=ve.child({namespace:"schema"});function A1e(){const e=[];return function(t,n){if(typeof n!="object"||n===null)return n;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(n)?"[Circular]":(e.push(n),n)}}const Dh=Hf("nodes/receivedOpenAPISchema",async(e,{dispatch:t,rejectWithValue:n})=>{try{const i=await(await fetch("openapi.json")).json();return k1e.info({openAPISchema:i},"Received OpenAPI schema"),JSON.parse(JSON.stringify(i,A1e()))}catch(r){return n({error:r})}}),NF={nodes:[],edges:[],schema:null,invocationTemplates:{},connectionStartParams:null,shouldShowGraphOverlay:!1,shouldShowFieldTypeLegend:!1,shouldShowMinimapPanel:!0,editorInstance:void 0},DF=jt({name:"nodes",initialState:NF,reducers:{nodesChanged:(e,t)=>{e.nodes=CF(t.payload,e.nodes)},nodeAdded:(e,t)=>{e.nodes.push(t.payload)},edgesChanged:(e,t)=>{e.edges=qve(t.payload,e.edges)},connectionStarted:(e,t)=>{e.connectionStartParams=t.payload},connectionMade:(e,t)=>{e.edges=Q$(t.payload,e.edges)},connectionEnded:e=>{e.connectionStartParams=null},fieldValueChanged:(e,t)=>{const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(s=>s.id===n);o>-1&&(e.nodes[o].data.inputs[r].value=i)},imageCollectionFieldValueChanged:(e,t)=>{const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(a=>a.id===n);if(o===-1)return;const s=Kn(e.nodes[o].data.inputs[r].value);if(!s){e.nodes[o].data.inputs[r].value=i;return}e.nodes[o].data.inputs[r].value=$Z(s.concat(i),"image_name")},shouldShowGraphOverlayChanged:(e,t)=>{e.shouldShowGraphOverlay=t.payload},shouldShowFieldTypeLegendChanged:(e,t)=>{e.shouldShowFieldTypeLegend=t.payload},shouldShowMinimapPanelChanged:(e,t)=>{e.shouldShowMinimapPanel=t.payload},nodeTemplatesBuilt:(e,t)=>{e.invocationTemplates=t.payload},nodeEditorReset:e=>{e.nodes=[],e.edges=[]},setEditorInstance:(e,t)=>{e.editorInstance=t.payload},loadFileNodes:(e,t)=>{e.nodes=t.payload},loadFileEdges:(e,t)=>{e.edges=t.payload}},extraReducers:e=>{e.addCase(Dh.fulfilled,(t,n)=>{t.schema=n.payload})}}),{nodesChanged:Oke,edgesChanged:Rke,nodeAdded:Ike,fieldValueChanged:px,connectionMade:Mke,connectionStarted:Nke,connectionEnded:Dke,shouldShowGraphOverlayChanged:Lke,shouldShowFieldTypeLegendChanged:$ke,shouldShowMinimapPanelChanged:Fke,nodeTemplatesBuilt:j3,nodeEditorReset:LF,imageCollectionFieldValueChanged:O1e,setEditorInstance:Bke,loadFileNodes:jke,loadFileEdges:Vke}=DF.actions,R1e=DF.reducer,I1e=e=>e.nodes,$F={esrganModelName:"RealESRGAN_x4plus.pth"},FF=jt({name:"postprocessing",initialState:$F,reducers:{esrganModelNameChanged:(e,t)=>{e.esrganModelName=t.payload}}}),{esrganModelNameChanged:zke}=FF.actions,M1e=FF.reducer,Rp=ge("app/userInvoked"),N1e={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class l0{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||N1e,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(r=>r!==n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{s(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(s=>{s.apply(s,[t,...r])})}}function Dd(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n}function S8(e){return e==null?"":""+e}function D1e(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}function V3(e,t,n){function r(s){return s&&s.indexOf("###")>-1?s.replace(/###/g,"."):s}function i(){return!e||typeof e=="string"}const o=typeof t!="string"?[].concat(t):t.split(".");for(;o.length>1;){if(i())return{};const s=r(o.shift());!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={}}return i()?{}:{obj:e,k:r(o.shift())}}function _8(e,t,n){const{obj:r,k:i}=V3(e,t,Object);r[i]=n}function L1e(e,t,n,r){const{obj:i,k:o}=V3(e,t,Object);i[o]=i[o]||[],r&&(i[o]=i[o].concat(n)),r||i[o].push(n)}function u0(e,t){const{obj:n,k:r}=V3(e,t);if(n)return n[r]}function $1e(e,t,n){const r=u0(e,n);return r!==void 0?r:u0(t,n)}function BF(e,t,n){for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):BF(e[r],t[r],n):e[r]=t[r]);return e}function hu(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var F1e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function B1e(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>F1e[t]):e}const j1e=[" ",",","?","!",";"];function V1e(e,t,n){t=t||"",n=n||"";const r=j1e.filter(s=>t.indexOf(s)<0&&n.indexOf(s)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(s=>s==="?"?"\\?":s).join("|")})`);let o=!i.test(e);if(!o){const s=e.indexOf(n);s>0&&!i.test(e.substring(0,s))&&(o=!0)}return o}function c0(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let o=0;oo+s;)s++,a=r.slice(o,o+s).join(n),l=i[a];if(l===void 0)return;if(l===null)return null;if(t.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}const u=r.slice(o+s).join(n);return u?c0(l,u,n):void 0}i=i[r[o]]}return i}function d0(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class w8 extends E1{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,s=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let a=[t,n];r&&typeof r!="string"&&(a=a.concat(r)),r&&typeof r=="string"&&(a=a.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(a=t.split("."));const l=u0(this.data,a);return l||!s||typeof r!="string"?l:c0(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(s?r.split(s):r)),t.indexOf(".")>-1&&(a=t.split("."),i=n,n=a[1]),this.addNamespaces(n),_8(this.data,a,i),o.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(typeof r[o]=="string"||Object.prototype.toString.apply(r[o])==="[object Array]")&&this.addResource(t,n,o,r[o],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,o){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),i=r,r=n,n=a[1]),this.addNamespaces(n);let l=u0(this.data,a)||{};i?BF(l,r,o):l={...l,...r},_8(this.data,a,l),s.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var jF={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(o=>{this.processors[o]&&(t=this.processors[o].process(t,n,r,i))}),t}};const x8={};class f0 extends E1{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),D1e(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=co.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const s=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!V1e(t,r,i);if(s&&!a){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:o};const u=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(i)}return typeof o=="string"&&(o=[o]),{key:t,namespaces:o}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:s,namespaces:a}=this.extractFromKey(t[t.length-1],n),l=a[a.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const b=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${b}${s}`,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:l}:`${l}${b}${s}`}return i?{res:s,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:l}:s}const d=this.resolve(t,n);let f=d&&d.res;const h=d&&d.usedKey||s,p=d&&d.exactUsedKey||s,g=Object.prototype.toString.apply(f),S=["[object Number]","[object Function]","[object RegExp]"],v=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject;if(y&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&S.indexOf(g)<0&&!(typeof v=="string"&&g==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const b=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:a}):`key '${s} (${this.language})' returned an object instead of string.`;return i?(d.res=b,d):b}if(o){const b=g==="[object Array]",_=b?[]:{},w=b?p:h;for(const x in f)if(Object.prototype.hasOwnProperty.call(f,x)){const C=`${w}${o}${x}`;_[x]=this.translate(C,{...n,joinArrays:!1,ns:a}),_[x]===C&&(_[x]=f[x])}f=_}}else if(y&&typeof v=="string"&&g==="[object Array]")f=f.join(v),f&&(f=this.extendTranslation(f,t,n,r));else{let b=!1,_=!1;const w=n.count!==void 0&&typeof n.count!="string",x=f0.hasDefaultValue(n),C=w?this.pluralResolver.getSuffix(u,n.count,n):"",k=n.ordinal&&w?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",P=n[`defaultValue${C}`]||n[`defaultValue${k}`]||n.defaultValue;!this.isValidLookup(f)&&x&&(b=!0,f=P),this.isValidLookup(f)||(_=!0,f=s);const $=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&_?void 0:f,N=x&&P!==f&&this.options.updateMissing;if(_||b||N){if(this.logger.log(N?"updateKey":"missingKey",u,l,s,N?P:f),o){const M=this.resolve(s,{...n,keySeparator:!1});M&&M.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let T=[];const O=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&O&&O[0])for(let M=0;M{const L=x&&D!==f?D:$;this.options.missingKeyHandler?this.options.missingKeyHandler(M,l,R,L,N,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(M,l,R,L,N,n),this.emit("missingKey",M,l,R,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?T.forEach(M=>{this.pluralResolver.getSuffixes(M,n).forEach(R=>{I([M],s+R,n[`defaultValue${R}`]||P)})}):I(T,s,P))}f=this.extendTranslation(f,t,n,d,r),_&&f===s&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${s}`),(_||b)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${s}`:s,b?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d):f}extendTranslation(t,n,r,i,o){var s=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language,r),u){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,s,a;return typeof t=="string"&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;i=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),p=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",g=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(S=>{this.isValidLookup(r)||(a=S,!x8[`${g[0]}-${S}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(x8[`${g[0]}-${S}`]=!0,this.logger.warn(`key "${i}" for languages "${g.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(v=>{if(this.isValidLookup(r))return;s=v;const y=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(y,c,v,S,n);else{let b;f&&(b=this.pluralResolver.getSuffix(v,n.count,n));const _=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(y.push(c+b),n.ordinal&&b.indexOf(w)===0&&y.push(c+b.replace(w,this.options.pluralSeparator)),h&&y.push(c+_)),p){const x=`${c}${this.options.contextSeparator}${n.context}`;y.push(x),f&&(y.push(x+b),n.ordinal&&b.indexOf(w)===0&&y.push(x+b.replace(w,this.options.pluralSeparator)),h&&y.push(x+_))}}let m;for(;m=y.pop();)this.isValidLookup(r)||(o=m,r=this.getResource(v,S,m,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:s,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}function T_(e){return e.charAt(0).toUpperCase()+e.slice(1)}class C8{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=co.create("languageUtils")}getScriptPartFromCode(t){if(t=d0(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=d0(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=T_(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=T_(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=T_(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&o.indexOf(i)===0)return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],o=s=>{s&&(this.isSupportedCode(s)?i.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):typeof t=="string"&&o(this.formatLanguageCode(t)),r.forEach(s=>{i.indexOf(s)<0&&o(this.formatLanguageCode(s))}),i}}let z1e=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],U1e={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const G1e=["v1","v2","v3"],H1e=["v4"],T8={zero:0,one:1,two:2,few:3,many:4,other:5};function q1e(){const e={};return z1e.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:U1e[t.fc]}})}),e}class W1e{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=co.create("pluralResolver"),(!this.options.compatibilityJSON||H1e.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=q1e()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(d0(t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,o)=>T8[i]-T8[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const o=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!G1e.includes(this.options.compatibilityJSON)}}function E8(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=$1e(e,t,n);return!o&&i&&typeof n=="string"&&(o=c0(e,n,r),o===void 0&&(o=c0(t,n,r))),o}class K1e{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=co.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const n=t.interpolation;this.escape=n.escape!==void 0?n.escape:B1e,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?hu(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?hu(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?hu(n.nestingPrefix):n.nestingPrefixEscaped||hu("$t("),this.nestingSuffix=n.nestingSuffix?hu(n.nestingSuffix):n.nestingSuffixEscaped||hu(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(t,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(t,n,r,i){let o,s,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(p){return p.replace(/\$/g,"$$$$")}const c=p=>{if(p.indexOf(this.formatSeparator)<0){const y=E8(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...i,...n,interpolationkey:p}):y}const g=p.split(this.formatSeparator),S=g.shift().trim(),v=g.join(this.formatSeparator).trim();return this.format(E8(n,l,S,this.options.keySeparator,this.options.ignoreJSONStructure),v,r,{...i,...n,interpolationkey:S})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>u(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?u(this.escape(p)):u(p)}].forEach(p=>{for(a=0;o=p.regex.exec(t);){const g=o[1].trim();if(s=c(g),s===void 0)if(typeof d=="function"){const v=d(t,o,i);s=typeof v=="string"?v:""}else if(i&&Object.prototype.hasOwnProperty.call(i,g))s="";else if(f){s=o[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),s="";else typeof s!="string"&&!this.useRawValueToEscape&&(s=S8(s));const S=p.safeValue(s);if(t=t.replace(o[0],S),f?(p.regex.lastIndex+=s.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,s;function a(l,u){const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,s);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{s=JSON.parse(f),u&&(s={...u,...s})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,g),`${l}${c}${f}`}return delete s.defaultValue,l}for(;i=this.nestingRegexp.exec(t);){let l=[];s={...r},s=s.replace&&typeof s.replace!="string"?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=c.shift(),l=c,u=!0}if(o=n(a.call(this,i[1].trim(),s),s),o&&i[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=S8(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),o=""),u&&(o=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),t=t.replace(i[0],o),this.regexp.lastIndex=0}return t}}function Y1e(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(s=>{if(!s)return;const[a,...l]=s.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[a.trim()]||(n[a.trim()]=u),u==="false"&&(n[a.trim()]=!1),u==="true"&&(n[a.trim()]=!0),isNaN(u)||(n[a.trim()]=parseInt(u,10))})}return{formatName:t,formatOptions:n}}function pu(e){const t={};return function(r,i,o){const s=i+JSON.stringify(o);let a=t[s];return a||(a=e(d0(i),o),t[s]=a),a(r)}}class X1e{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=co.create("formatter"),this.options=t,this.formats={number:pu((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:pu((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:pu((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:pu((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:pu((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=pu(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((a,l)=>{const{formatName:u,formatOptions:c}=Y1e(l);if(this.formats[u]){let d=a;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](a,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}function Q1e(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class Z1e extends E1{constructor(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=co.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const o={},s={},a={},l={};return t.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?s[f]===void 0&&(s[f]=!0):(this.state[f]=1,c=!1,s[f]===void 0&&(s[f]=!0),o[f]===void 0&&(o[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(a[u]=!0)}),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),o=i[0],s=i[1];n&&this.emit("failedLoading",o,s,n),r&&this.store.addResourceBundle(o,s,r),this.state[t]=n?-1:2;const a={};this.queue.forEach(l=>{L1e(l.loaded,[o],s),Q1e(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{a[u]||(a[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{a[u][d]===void 0&&(a[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;if(!t.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:o,callback:s});return}this.readingCalls++;const a=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&i{this.read.call(this,t,n,r,i+1,o*2,s)},o);return}s(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>a(null,c)).catch(a):a(null,u)}catch(u){a(u)}return}return l(t,n,a)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const o=this.queueLoad(t,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(s=>{this.loadOne(s)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(s,a)=>{s&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,s),!s&&a&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,a),this.loaded(t,s,a)})}saveMissing(t,n,r,i,o){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...s,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,i,l):c=u(t,n,r,i),c&&typeof c.then=="function"?c.then(d=>a(null,d)).catch(a):a(null,c)}catch(c){a(c)}else u(t,n,r,i,a,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}function P8(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){let n={};if(typeof t[1]=="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(i=>{n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:(e,t,n,r)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function k8(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function Lg(){}function J1e(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class Lh extends E1{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=k8(t),this.services={},this.logger=co,this.modules={external:[]},J1e(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=P8();this.options={...i,...this.options,...k8(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function o(c){return c?typeof c=="function"?new c:c:null}if(!this.options.isClone){this.modules.logger?co.init(o(this.modules.logger),this.options):co.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=X1e);const d=new C8(this.options);this.store=new w8(this.options.resources,this.options);const f=this.services;f.logger=co,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new W1e(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=o(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new K1e(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Z1e(o(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var p=arguments.length,g=new Array(p>1?p-1:0),S=1;S1?p-1:0),S=1;S{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Lg),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=Dd(),u=()=>{const c=(d,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Lg;const i=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode")return r();const o=[],s=a=>{if(!a)return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{o.indexOf(u)<0&&o.push(u)})};i?s(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>s(l)),this.options.preload&&this.options.preload.forEach(a=>s(a)),this.services.backendConnector.load(o,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const i=Dd();return t||(t=this.languages),n||(n=this.options.ns),r||(r=Lg),this.services.backendConnector.reload(t,n,o=>{i.resolve(),r(o)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&jF.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const i=Dd();this.emit("languageChanging",t);const o=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},s=(l,u)=>{u?(o(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},a=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{s(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),i}getFixedT(t,n,r){var i=this;const o=function(s,a){let l;if(typeof a!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${s}`:s,i.t(h,l)};return typeof t=="string"?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const s=(a,l)=>{const u=this.services.backendConnector.state[`${a}|${l}`];return u===-1||u===2};if(n.precheck){const a=n.precheck(this,s);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(r,t)&&(!i||s(o,t)))}loadNamespaces(t,n){const r=Dd();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Dd();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],o=t.filter(s=>i.indexOf(s)<0);return o.length?(this.options.preload=i.concat(o),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new C8(P8());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Lh(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Lg;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},o=new Lh(i);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(a=>{o[a]=this[a]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new w8(this.store.data,i),o.services.resourceStore=o.store),o.translator=new f0(o.services,i),o.translator.on("*",function(a){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;ctypeof e=="string"?{title:e,status:"info",isClosable:!0,duration:2500}:{status:"info",isClosable:!0,duration:2500,...e},Uke=()=>{const e=ed(),t=Zf(Yce),n=Cse();return E.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(ebe())},[e,n,t]),null},Gke=()=>{const e=ed();return E.useCallback(n=>e(Ht(fo(n))),[e])},VF={isConnected:!1,isProcessing:!1,shouldDisplayGuides:!0,isGFPGANAvailable:!0,isESRGANAvailable:!0,shouldConfirmOnDelete:!0,currentStep:0,totalSteps:0,currentIteration:0,totalIterations:0,currentStatusHasSteps:!1,isCancelable:!0,enableImageDebugging:!1,toastQueue:[],progressImage:null,shouldAntialiasProgressImage:!1,sessionId:null,cancelType:"immediate",isCancelScheduled:!1,subscribedNodeIds:[],wereModelsReceived:!1,wasSchemaParsed:!1,consoleLogLevel:"debug",shouldLogToConsole:!0,statusTranslationKey:"common.statusDisconnected",canceledSession:"",isPersisted:!1,language:"en",isUploading:!1},zF=jt({name:"system",initialState:VF,reducers:{setIsProcessing:(e,t)=>{e.isProcessing=t.payload},setCurrentStatus:(e,t)=>{e.statusTranslationKey=t.payload},setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setShouldDisplayGuides:(e,t)=>{e.shouldDisplayGuides=t.payload},setIsCancelable:(e,t)=>{e.isCancelable=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},cancelScheduled:e=>{e.isCancelScheduled=!0},scheduledCancelAborted:e=>{e.isCancelScheduled=!1},cancelTypeChanged:(e,t)=>{e.cancelType=t.payload},subscribedNodeIdsSet:(e,t)=>{e.subscribedNodeIds=t.payload},consoleLogLevelChanged:(e,t)=>{e.consoleLogLevel=t.payload},shouldLogToConsoleChanged:(e,t)=>{e.shouldLogToConsole=t.payload},shouldAntialiasProgressImageChanged:(e,t)=>{e.shouldAntialiasProgressImage=t.payload},isPersistedChanged:(e,t)=>{e.isPersisted=t.payload},languageChanged:(e,t)=>{e.language=t.payload},progressImageSet(e,t){e.progressImage=t.payload}},extraReducers(e){e.addCase(UL,(t,n)=>{t.sessionId=n.payload.sessionId,t.boardIdToAddTo=n.payload.boardId,t.canceledSession=""}),e.addCase(HL,t=>{t.sessionId=null,t.boardIdToAddTo=void 0}),e.addCase(jL,t=>{t.isConnected=!0,t.isCancelable=!0,t.isProcessing=!1,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.statusTranslationKey="common.statusConnected"}),e.addCase(zL,t=>{t.isConnected=!1,t.isProcessing=!1,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusDisconnected"}),e.addCase(WL,t=>{t.isCancelable=!0,t.isProcessing=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusGenerating"}),e.addCase(JL,(t,n)=>{const{step:r,total_steps:i,progress_image:o}=n.payload.data;t.isProcessing=!0,t.isCancelable=!0,t.currentStatusHasSteps=!0,t.currentStep=r+1,t.totalSteps=i,t.progressImage=o??null,t.statusTranslationKey="common.statusGenerating"}),e.addCase(KL,(t,n)=>{const{data:r}=n.payload;t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusProcessingComplete",t.canceledSession===r.graph_execution_state_id&&(t.isProcessing=!1,t.isCancelable=!0)}),e.addCase(w3,t=>{t.isProcessing=!1,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusError",t.progressImage=null,t.toastQueue.push(fo({title:sl("toast.serverError"),status:"error"}))}),e.addCase(QL,t=>{t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null}),e.addCase(Rp,t=>{t.isProcessing=!0,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.statusTranslationKey="common.statusPreparing"}),e.addCase(zl.fulfilled,(t,n)=>{t.canceledSession=n.meta.arg.session_id,t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null,t.toastQueue.push(fo({title:sl("toast.canceled"),status:"warning"}))}),e.addCase(j3,t=>{t.wasSchemaParsed=!0}),e.addCase(Fr.pending,t=>{t.isUploading=!0}),e.addCase(Fr.rejected,t=>{t.isUploading=!1}),e.addCase(Fr.fulfilled,t=>{t.isUploading=!1}),e.addMatcher(cL,(t,n)=>{t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null,t.toastQueue.push(fo({title:sl("toast.serverError"),status:"error"}))})}}),{setIsProcessing:Hke,setShouldConfirmOnDelete:qke,setCurrentStatus:Wke,setShouldDisplayGuides:Kke,setIsCancelable:Yke,setEnableImageDebugging:Xke,addToast:Ht,clearToastQueue:ebe,cancelScheduled:Qke,scheduledCancelAborted:Zke,cancelTypeChanged:Jke,subscribedNodeIdsSet:e8e,consoleLogLevelChanged:t8e,shouldLogToConsoleChanged:n8e,isPersistedChanged:r8e,shouldAntialiasProgressImageChanged:i8e,languageChanged:o8e,progressImageSet:tbe}=zF.actions,nbe=zF.reducer,rbe={searchFolder:null,advancedAddScanModel:null},UF=jt({name:"modelmanager",initialState:rbe,reducers:{setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setAdvancedAddScanModel:(e,t)=>{e.advancedAddScanModel=t.payload}}}),{setSearchFolder:s8e,setAdvancedAddScanModel:a8e}=UF.actions,ibe=UF.reducer,A8=ve.child({namespace:"canvas"}),obe=()=>{fe({actionCreator:She,effect:async(e,{dispatch:t,getState:n})=>{const r=n(),{sessionId:i,isProcessing:o}=r.system,s=e.payload;if(o){if(!s){A8.debug("No canvas session, skipping cancel");return}if(s!==i){A8.debug({data:{canvasSessionId:s,session_id:i}},"Canvas session does not match global session, skipping cancel");return}t(zl({session_id:i}))}}})},GF=To.injectEndpoints({endpoints:e=>({getAppVersion:e.query({query:()=>({url:"app/version",method:"GET"}),keepUnusedDataFor:864e5}),getAppConfig:e.query({query:()=>({url:"app/config",method:"GET"}),keepUnusedDataFor:864e5})})}),{useGetAppVersionQuery:l8e,useGetAppConfigQuery:u8e}=GF,sbe=()=>{fe({matcher:GF.endpoints.getAppConfig.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const{infill_methods:r}=e.payload,i=t().generation.infillMethod;r.includes(i)||n(Uce(r[0]))}})},abe=ge("app/appStarted"),lbe=()=>{fe({actionCreator:abe,effect:async(e,{getState:t,dispatch:n,unsubscribe:r,cancelActiveListeners:i})=>{i(),r(),await n(la({categories:m1,is_intermediate:!1,offset:0,limit:xk})),await n(la({categories:y1,is_intermediate:!1,offset:0,limit:xk})),n(Ppe(!1))}})};ve.child({namespace:"boards"});const ube=()=>{fe({actionCreator:Ck,effect:(e,{getState:t,dispatch:n})=>{var c;const r=e.payload,i=t(),o=PL(i);if(r==="all"){n(pl(((c=o[0])==null?void 0:c.image_name)??null));return}if(r==="batch"){n(pl(i.gallery.batchImageNames[0]??null));return}const s=b1(i),a=i.gallery.galleryView==="images"?m1:y1,{data:l}=Eh.endpoints.listAllBoards.select()(i),u=l==null?void 0:l.find(d=>d.board_id===r);if(!u){n(Ck("all"));return}n(pl(u.cover_image_name??null)),s.length{fe({actionCreator:HF,effect:async(e,{dispatch:t,getState:n,condition:r})=>{const{board:i,imagesUsage:o}=e.payload,{board_id:s}=i,a=n(),l=a.gallery.selection[a.gallery.selection.length-1],u=l?Za(a,l):void 0;u&&u.board_id===s&&t(pl(null)),o.isCanvasImage&&t(pL()),o.isControlNetImage&&t(i$()),o.isInitialImage&&t(ID()),o.isNodesImage&&t(LF());const c=PL(a).reduce((p,g)=>(g.board_id===s&&p.push(g.image_name),p),[]);t(Epe(c)),t(Eh.endpoints.deleteBoardAndImages.initiate(s));const d=Eh.endpoints.deleteBoardAndImages.select(s)(a),{isSuccess:f}=d;await r(()=>!!f,3e4)&&t(To.util.invalidateTags([{type:"Board",id:s},{type:"Image",id:an}]))}})},dbe=ge("canvas/canvasSavedToGallery"),fbe=ge("canvas/canvasCopiedToClipboard"),hbe=ge("canvas/canvasDownloadedAsImage"),pbe=ge("canvas/canvasMerged"),gbe=ge("canvas/stagingAreaImageSaved");let qF=null,WF=null;const f8e=e=>{qF=e},P1=()=>qF,h8e=e=>{WF=e},mbe=()=>WF,ybe=async e=>new Promise((t,n)=>{e.toBlob(r=>{if(r){t(r);return}n("Unable to create Blob")})}),h0=async(e,t)=>await ybe(e.toCanvas(t)),z3=async e=>{const t=P1();if(!t)return;const{shouldCropToBoundingBoxOnSave:n,boundingBoxCoordinates:r,boundingBoxDimensions:i}=e.canvas,o=t.clone();o.scale({x:1,y:1});const s=o.getAbsolutePosition(),a=n?{x:r.x+s.x,y:r.y+s.y,width:i.width,height:i.height}:o.getClientRect();return h0(o,a)},vbe=e=>{navigator.clipboard.write([new ClipboardItem({[e.type]:e})])},bbe=ve.child({namespace:"canvasCopiedToClipboardListener"}),Sbe=()=>{fe({actionCreator:fbe,effect:async(e,{dispatch:t,getState:n})=>{const r=n(),i=await z3(r);if(!i){bbe.error("Problem getting base layer blob"),t(Ht({title:"Problem Copying Canvas",description:"Unable to export base layer",status:"error"}));return}vbe(i),t(Ht({title:"Canvas Copied to Clipboard",status:"success"}))}})},_be=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),r.remove()},wbe=ve.child({namespace:"canvasSavedToGalleryListener"}),xbe=()=>{fe({actionCreator:hbe,effect:async(e,{dispatch:t,getState:n})=>{const r=n(),i=await z3(r);if(!i){wbe.error("Problem getting base layer blob"),t(Ht({title:"Problem Downloading Canvas",description:"Unable to export base layer",status:"error"}));return}_be(i,"canvas.png"),t(Ht({title:"Canvas Downloaded",status:"success"}))}})},Cbe=async()=>{const e=P1();if(!e)return;const t=e.clone();return t.scale({x:1,y:1}),h0(t,t.getClientRect())},O8=ve.child({namespace:"canvasCopiedToClipboardListener"}),Tbe=()=>{fe({actionCreator:pbe,effect:async(e,{dispatch:t,getState:n,take:r})=>{const i=await Cbe();if(!i){O8.error("Problem getting base layer blob"),t(Ht({title:"Problem Merging Canvas",description:"Unable to export base layer",status:"error"}));return}const o=P1();if(!o){O8.error("Problem getting canvas base layer"),t(Ht({title:"Problem Merging Canvas",description:"Unable to export base layer",status:"error"}));return}const s=o.getClientRect({relativeTo:o.getParent()}),a=t(Fr({file:new File([i],"mergedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!0,postUploadAction:{type:"TOAST_CANVAS_MERGED"}})),[{payload:l}]=await r(c=>Fr.fulfilled.match(c)&&c.meta.requestId===a.requestId),{image_name:u}=l;t(_he({kind:"image",layer:"base",imageName:u,...s})),t(Ht({title:"Canvas Merged",status:"success"}))}})},Ebe=ve.child({namespace:"canvasSavedToGalleryListener"}),Pbe=()=>{fe({actionCreator:dbe,effect:async(e,{dispatch:t,getState:n,take:r})=>{const i=n(),o=await z3(i);if(!o){Ebe.error("Problem getting base layer blob"),t(Ht({title:"Problem Saving Canvas",description:"Unable to export base layer",status:"error"}));return}const s=t(Fr({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!1,postUploadAction:{type:"TOAST_CANVAS_SAVED_TO_GALLERY"}})),[{payload:a}]=await r(l=>Fr.fulfilled.match(l)&&l.meta.requestId===s.requestId);t(v1(a))}})},kbe=ve.child({namespace:"controlNet"}),Abe=(e,t,n)=>{if(!(Hpe.match(e)||Ok.match(e)||C3.match(e)||qpe.match(e)||Rk.match(e))||Rk.match(e)&&n.controlNet.controlNets[e.payload.controlNetId].shouldAutoConfig===!0)return!1;const{controlImage:i,processorType:o,shouldAutoConfig:s}=t.controlNet.controlNets[e.payload.controlNetId];if(Ok.match(e)&&!s)return!1;const a=o!=="none",l=t.system.isProcessing;return a&&!l&&!!i},Obe=()=>{fe({predicate:Abe,effect:async(e,{dispatch:t,getState:n,cancelActiveListeners:r,delay:i})=>{const{controlNetId:o}=e.payload;r(),kbe.trace({data:e.payload},"ControlNet auto-process triggered"),await i(300),t(x3({controlNetId:o}))}})},Ul=ge("system/sessionReadyToInvoke"),Rbe=e=>Pn(e)&&"image_name"in e&&Gs(e==null?void 0:e.image_name)&&"thumbnail_url"in e&&Gs(e==null?void 0:e.thumbnail_url)&&"image_url"in e&&Gs(e==null?void 0:e.image_url)&&"image_origin"in e&&Gs(e==null?void 0:e.image_origin)&&"created_at"in e&&Gs(e==null?void 0:e.created_at),KF=e=>(e==null?void 0:e.type)==="image_output",Ibe=e=>Gs(e)&&["internal","external"].includes(e),p8e=e=>Pn(e)&&Gs(X2(e,"image_name"))&&Ibe(X2(e,"image_origin")),R8=ve.child({namespace:"controlNet"}),Mbe=()=>{fe({actionCreator:x3,effect:async(e,{dispatch:t,getState:n,take:r,unsubscribe:i,subscribe:o})=>{const{controlNetId:s}=e.payload,a=n().controlNet.controlNets[s];if(!a.controlImage){R8.error("Unable to process ControlNet image");return}const l={nodes:{[a.processorNode.id]:{...a.processorNode,is_intermediate:!0,image:{image_name:a.controlImage}}}},u=t(zn({graph:l})),[c]=await r(h=>zn.fulfilled.match(h)&&h.meta.requestId===u.requestId),d=c.payload.id;t(Ul());const[f]=await r(h=>_3.match(h)&&h.payload.data.graph_execution_state_id===d);if(KF(f.payload.data.result)){const{image_name:h}=f.payload.data.result.image,[p]=await r(S=>Ph.fulfilled.match(S)&&S.payload.image_name===h),g=p.payload;R8.debug({data:{arg:e.payload,processedControlImage:g}},"ControlNet image processed"),t(Gpe({controlNetId:s,processedControlImage:g.image_name}))}}})},oi=To.injectEndpoints({endpoints:e=>({listBoardImages:e.query({query:({board_id:t,offset:n,limit:r})=>({url:`board_images/${t}`,method:"GET"}),providesTags:(t,n,r)=>{const i=[{type:"BoardImage",id:`${r.board_id}_${an}`}];return t&&i.push(...t.items.map(({board_id:o,image_name:s})=>({type:"BoardImage",id:`${o}_${s}`}))),i}}),addImageToBoard:e.mutation({query:({board_id:t,image_name:n})=>({url:"board_images/",method:"POST",body:{board_id:t,image_name:n}}),invalidatesTags:(t,n,r)=>[{type:"BoardImage"},{type:"Board",id:r.board_id}]}),removeImageFromBoard:e.mutation({query:({board_id:t,image_name:n})=>({url:"board_images/",method:"DELETE",body:{board_id:t,image_name:n}}),invalidatesTags:(t,n,r)=>[{type:"BoardImage"},{type:"Board",id:r.board_id}]})})}),{useAddImageToBoardMutation:Nbe,useRemoveImageFromBoardMutation:g8e,useListBoardImagesQuery:m8e}=oi,YF=ve.child({namespace:"boards"}),Dbe=()=>{fe({matcher:oi.endpoints.addImageToBoard.matchFulfilled,effect:(e,{getState:t,dispatch:n})=>{const{board_id:r,image_name:i}=e.meta.arg.originalArgs;YF.debug({data:{board_id:r,image_name:i}},"Image added to board")}})},Lbe=()=>{fe({matcher:oi.endpoints.addImageToBoard.matchRejected,effect:(e,{getState:t,dispatch:n})=>{const{board_id:r,image_name:i}=e.meta.arg.originalArgs;YF.debug({data:{board_id:r,image_name:i}},"Problem adding image to board")}})},XF=ve.child({namespace:"image"}),$be=()=>{fe({actionCreator:c$,effect:async(e,{dispatch:t,getState:n,condition:r})=>{const{imageDTO:i,imageUsage:o}=e.payload;t(u$(!1));const{image_name:s}=i,a=n();if(a.gallery.selection[a.gallery.selection.length-1]===s){const d=Rpe(a,s);t(pl(d||null))}o.isCanvasImage&&t(pL()),o.isControlNetImage&&t(i$()),o.isInitialImage&&t(ID()),o.isNodesImage&&t(LF()),t(Tpe(s));const{requestId:u}=t(Fc({image_name:s}));await r(d=>Fc.fulfilled.match(d)&&d.meta.requestId===u,3e4)&&t(To.util.invalidateTags([{type:"Board",id:i.board_id}]))}})},Fbe=()=>{fe({actionCreator:Fc.pending,effect:(e,{dispatch:t,getState:n})=>{}})},Bbe=()=>{fe({actionCreator:Fc.fulfilled,effect:(e,{dispatch:t,getState:n})=>{XF.debug({data:{image:e.meta.arg}},"Image deleted")}})},jbe=()=>{fe({actionCreator:Fc.rejected,effect:(e,{dispatch:t,getState:n})=>{XF.debug({data:{image:e.meta.arg}},"Unable to delete image")}})},Vbe=ve.child({namespace:"dnd"}),QF=ge("dnd/dndDropped"),zbe=()=>{fe({actionCreator:QF,effect:async(e,{dispatch:t,getState:n,take:r})=>{const{activeData:i,overData:o}=e.payload;if(n(),Vbe.debug({data:{activeData:i,overData:o}},"Image or selection dropped"),o.actionType==="SET_CURRENT_IMAGE"&&i.payloadType==="IMAGE_DTO"&&i.payload.imageDTO){t(pl(i.payload.imageDTO.image_name));return}if(o.actionType==="SET_INITIAL_IMAGE"&&i.payloadType==="IMAGE_DTO"&&i.payload.imageDTO){t(_h(i.payload.imageDTO));return}if(o.actionType==="ADD_TO_BATCH"&&i.payloadType==="IMAGE_DTO"&&i.payload.imageDTO){t(Yw([i.payload.imageDTO.image_name]));return}if(o.actionType==="ADD_TO_BATCH"&&i.payloadType==="IMAGE_NAMES"){t(Yw(i.payload.image_names));return}if(o.actionType==="SET_CONTROLNET_IMAGE"&&i.payloadType==="IMAGE_DTO"&&i.payload.imageDTO){const{controlNetId:s}=o.context;t(C3({controlImage:i.payload.imageDTO.image_name,controlNetId:s}));return}if(o.actionType==="SET_CANVAS_INITIAL_IMAGE"&&i.payloadType==="IMAGE_DTO"&&i.payload.imageDTO){t(gL(i.payload.imageDTO));return}if(o.actionType==="SET_NODES_IMAGE"&&i.payloadType==="IMAGE_DTO"&&i.payload.imageDTO){const{fieldName:s,nodeId:a}=o.context;t(px({nodeId:a,fieldName:s,value:i.payload.imageDTO}));return}if(o.actionType==="SET_MULTI_NODES_IMAGE"&&i.payloadType==="IMAGE_DTO"&&i.payload.imageDTO){const{fieldName:s,nodeId:a}=o.context;t(px({nodeId:a,fieldName:s,value:[i.payload.imageDTO]}));return}if(o.actionType==="SET_MULTI_NODES_IMAGE"&&i.payloadType==="IMAGE_NAMES"){const{fieldName:s,nodeId:a}=o.context;t(O1e({nodeId:a,fieldName:s,value:i.payload.image_names.map(l=>({image_name:l}))}));return}if(o.actionType==="MOVE_BOARD"&&i.payloadType==="IMAGE_DTO"&&i.payload.imageDTO&&o.context.boardId){const{image_name:s}=i.payload.imageDTO,{boardId:a}=o.context;t(oi.endpoints.addImageToBoard.initiate({image_name:s,board_id:a}));return}if(o.actionType==="MOVE_BOARD"&&i.payloadType==="IMAGE_DTO"&&i.payload.imageDTO&&o.context.boardId===null){const{image_name:s,board_id:a}=i.payload.imageDTO;a&&t(oi.endpoints.removeImageFromBoard.initiate({image_name:s,board_id:a}));return}if(o.actionType==="MOVE_BOARD"&&i.payloadType==="IMAGE_NAMES"&&o.context.boardId){console.log("adding gallery selection to board");const s=o.context.boardId;t(oi.endpoints.addManyBoardImages.initiate({board_id:s,image_names:i.payload.image_names}));return}if(o.actionType==="MOVE_BOARD"&&i.payloadType==="IMAGE_NAMES"&&o.context.boardId===null){console.log("removing gallery selection to board"),t(oi.endpoints.deleteManyBoardImages.initiate({image_names:i.payload.image_names}));return}if(o.actionType==="MOVE_BOARD"&&i.payloadType==="IMAGE_NAMES"&&o.context.boardId){const s=o.context.boardId;t(oi.endpoints.addManyBoardImages.initiate({board_id:s,image_names:i.payload.image_names}));return}if(o.actionType==="MOVE_BOARD"&&i.payloadType==="IMAGE_NAMES"&&o.context.boardId===null){t(oi.endpoints.deleteManyBoardImages.initiate({image_names:i.payload.image_names}));return}}})},gx=ve.child({namespace:"image"}),Ube=()=>{fe({actionCreator:Ph.fulfilled,effect:(e,{getState:t,dispatch:n})=>{const r=e.payload,i=t();if(r.session_id===i.canvas.layerState.stagingArea.sessionId&&i.canvas.shouldAutoSave)n(ro({image_name:r.image_name,is_intermediate:r.is_intermediate}));else if(r.is_intermediate){gx.trace({data:{image:r}},"Image metadata received (intermediate), skipping");return}gx.debug({data:{image:r}},"Image metadata received"),n(v1(r))}})},Gbe=()=>{fe({actionCreator:Ph.rejected,effect:(e,{getState:t,dispatch:n})=>{gx.debug({data:{image:e.meta.arg}},"Problem receiving image metadata")}})},ZF=ve.child({namespace:"boards"}),Hbe=()=>{fe({matcher:oi.endpoints.removeImageFromBoard.matchFulfilled,effect:(e,{getState:t,dispatch:n})=>{const{board_id:r,image_name:i}=e.meta.arg.originalArgs;ZF.debug({data:{board_id:r,image_name:i}},"Image added to board")}})},qbe=()=>{fe({matcher:oi.endpoints.removeImageFromBoard.matchRejected,effect:(e,{getState:t,dispatch:n})=>{const{board_id:r,image_name:i}=e.meta.arg.originalArgs;ZF.debug({data:{board_id:r,image_name:i}},"Problem adding image to board")}})};ve.child({namespace:"image"});const Wbe=()=>{fe({actionCreator:ege,effect:async(e,{dispatch:t,getState:n,condition:r})=>{const i=e.payload,o=n(),{shouldConfirmOnDelete:s}=o.system,a=nge(n());if(!a)return;const l=a.isCanvasImage||a.isInitialImage||a.isControlNetImage||a.isNodesImage;if(s||l){t(u$(!0));return}t(c$({imageDTO:i,imageUsage:a}))}})},JF=ve.child({namespace:"image"}),Kbe=()=>{fe({actionCreator:ro.fulfilled,effect:(e,{dispatch:t,getState:n})=>{JF.debug({oldImage:e.meta.arg,updatedImage:e.payload},"Image updated")}})},Ybe=()=>{fe({actionCreator:ro.rejected,effect:(e,{dispatch:t})=>{JF.debug({oldImage:e.meta.arg},"Image update failed")}})},eB=ve.child({namespace:"image"}),Xbe=()=>{fe({actionCreator:Fr.fulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=e.payload;if(eB.debug({arg:"",image:r},"Image uploaded"),e.payload.is_intermediate)return;t(v1(r));const{postUploadAction:i}=e.meta.arg;if((i==null?void 0:i.type)==="TOAST_CANVAS_SAVED_TO_GALLERY"){t(Ht({title:"Canvas Saved to Gallery",status:"success"}));return}if((i==null?void 0:i.type)==="TOAST_CANVAS_MERGED"){t(Ht({title:"Canvas Merged",status:"success"}));return}if((i==null?void 0:i.type)==="SET_CANVAS_INITIAL_IMAGE"){t(gL(r));return}if((i==null?void 0:i.type)==="SET_CONTROLNET_IMAGE"){const{controlNetId:o}=i;t(C3({controlNetId:o,controlImage:r.image_name}));return}if((i==null?void 0:i.type)==="SET_INITIAL_IMAGE"){t(_h(r));return}if((i==null?void 0:i.type)==="SET_NODES_IMAGE"){const{nodeId:o,fieldName:s}=i;t(px({nodeId:o,fieldName:s,value:r}));return}if((i==null?void 0:i.type)==="TOAST_UPLOADED"){t(Ht({title:"Image Uploaded",status:"success"}));return}if((i==null?void 0:i.type)==="ADD_TO_BATCH"){t(Yw([r.image_name]));return}}})},Qbe=()=>{fe({actionCreator:Fr.rejected,effect:(e,{dispatch:t})=>{const{formData:n,...r}=e.meta.arg,i={arg:{...r,formData:{file:""}}};eB.error({data:i},"Image upload failed"),t(Ht({title:"Image Upload Failed",description:e.error.message,status:"error"}))}})},tB=ve.child({namespace:"image"}),Zbe=()=>{fe({actionCreator:b3.fulfilled,effect:(e,{getState:t,dispatch:n})=>{const r=e.payload;tB.debug({data:{image:r}},"Image URLs received");const{image_name:i,image_url:o,thumbnail_url:s}=r;n(Cpe({id:i,changes:{image_url:o,thumbnail_url:s}}))}})},Jbe=()=>{fe({actionCreator:b3.rejected,effect:(e,{getState:t,dispatch:n})=>{tB.debug({data:{image:e.meta.arg}},"Problem getting image URLs")}})},eSe=ge("generation/initialImageSelected"),tSe=ge("generation/modelSelected"),nSe=()=>{fe({actionCreator:eSe,effect:(e,{getState:t,dispatch:n})=>{if(!e.payload){n(Ht(fo({title:sl("toast.imageNotLoadedDesc"),status:"error"})));return}if(Rbe(e.payload)){n(_h(e.payload)),n(Ht(fo(sl("toast.sentToImageToImage"))));return}const r=e.payload,i=Za(t(),r);if(!i){n(Ht(fo({title:sl("toast.imageNotLoadedDesc"),status:"error"})));return}n(_h(i)),n(Ht(fo(sl("toast.sentToImageToImage"))))}})},rSe=ve.child({module:"models"}),iSe=()=>{fe({actionCreator:tSe,effect:(e,{getState:t,dispatch:n})=>{var a;const r=t(),i=Xv.safeParse(e.payload);if(!i.success){rSe.error({error:i.error.format()},"Failed to parse main model");return}const o=i.data,{base_model:s}=o;if(((a=r.generation.model)==null?void 0:a.base_model)!==s){let l=0;wl(r.lora.loras,(d,f)=>{d.base_model!==s&&(n(f$(f)),l+=1)});const{vae:u}=r.generation;u&&u.base_model!==s&&(n(MD(null)),l+=1);const{controlNets:c}=r.controlNet;wl(c,(d,f)=>{var h;((h=d.model)==null?void 0:h.base_model)!==s&&(n(r$({controlNetId:f})),l+=1)}),l>0&&n(Ht(fo({title:`Base model changed, cleared ${l} incompatible submodel${l===1?"":"s"}`,status:"warning"})))}n(xm(o))}})},I8=ka({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),M8=ka({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),N8=ka({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),D8=ka({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),L8=ka({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),$8=ka({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),oSe=({base_model:e,model_type:t,model_name:n})=>`${e}/${t}/${n}`,gu=e=>{const t=[];return e.forEach(n=>{const r={...Kn(n),id:oSe(n)};t.push(r)}),t},io=To.injectEndpoints({endpoints:e=>({getOnnxModels:e.query({query:()=>({url:"models/",params:{model_type:"onnx"}}),providesTags:(t,n,r)=>{const i=[{id:"OnnxModel",type:an}];return t&&i.push(...t.ids.map(o=>({type:"OnnxModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=gu(t.models);return M8.setAll(M8.getInitialState(),i)}}),getMainModels:e.query({query:()=>({url:"models/",params:{model_type:"main"}}),providesTags:(t,n,r)=>{const i=[{type:"MainModel",id:an}];return t&&i.push(...t.ids.map(o=>({type:"MainModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=gu(t.models);return I8.setAll(I8.getInitialState(),i)}}),updateMainModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/main/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"MainModel",id:an}]}),importMainModels:e.mutation({query:({body:t})=>({url:"models/import",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:an}]}),addMainModels:e.mutation({query:({body:t})=>({url:"models/add",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:an}]}),deleteMainModels:e.mutation({query:({base_model:t,model_name:n})=>({url:`models/${t}/main/${n}`,method:"DELETE"}),invalidatesTags:[{type:"MainModel",id:an}]}),convertMainModels:e.mutation({query:({base_model:t,model_name:n,params:r})=>({url:`models/convert/${t}/main/${n}`,method:"PUT",params:r}),invalidatesTags:[{type:"MainModel",id:an}]}),mergeMainModels:e.mutation({query:({base_model:t,body:n})=>({url:`models/merge/${t}`,method:"PUT",body:n}),invalidatesTags:[{type:"MainModel",id:an}]}),getLoRAModels:e.query({query:()=>({url:"models/",params:{model_type:"lora"}}),providesTags:(t,n,r)=>{const i=[{type:"LoRAModel",id:an}];return t&&i.push(...t.ids.map(o=>({type:"LoRAModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=gu(t.models);return N8.setAll(N8.getInitialState(),i)}}),getControlNetModels:e.query({query:()=>({url:"models/",params:{model_type:"controlnet"}}),providesTags:(t,n,r)=>{const i=[{type:"ControlNetModel",id:an}];return t&&i.push(...t.ids.map(o=>({type:"ControlNetModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=gu(t.models);return D8.setAll(D8.getInitialState(),i)}}),getVaeModels:e.query({query:()=>({url:"models/",params:{model_type:"vae"}}),providesTags:(t,n,r)=>{const i=[{type:"VaeModel",id:an}];return t&&i.push(...t.ids.map(o=>({type:"VaeModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=gu(t.models);return $8.setAll($8.getInitialState(),i)}}),getTextualInversionModels:e.query({query:()=>({url:"models/",params:{model_type:"embedding"}}),providesTags:(t,n,r)=>{const i=[{type:"TextualInversionModel",id:an}];return t&&i.push(...t.ids.map(o=>({type:"TextualInversionModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=gu(t.models);return L8.setAll(L8.getInitialState(),i)}}),getModelsInFolder:e.query({query:t=>({url:`/models/search?${$L.stringify(t,{})}`}),providesTags:(t,n,r)=>{const i=[{type:"ScannedModels",id:an}];return t&&i.push(...t.map(o=>({type:"ScannedModels",id:o}))),i}}),getCheckpointConfigs:e.query({query:()=>({url:"/models/ckpt_confs"})})})}),{useGetMainModelsQuery:y8e,useGetOnnxModelsQuery:v8e,useGetControlNetModelsQuery:b8e,useGetLoRAModelsQuery:S8e,useGetTextualInversionModelsQuery:_8e,useGetVaeModelsQuery:w8e,useUpdateMainModelsMutation:x8e,useDeleteMainModelsMutation:C8e,useImportMainModelsMutation:T8e,useAddMainModelsMutation:E8e,useConvertMainModelsMutation:P8e,useMergeMainModelsMutation:k8e,useGetModelsInFolderQuery:A8e,useGetCheckpointConfigsQuery:O8e}=io,F8=ve.child({module:"models"}),sSe=()=>{fe({matcher:io.endpoints.getMainModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=t().generation.model;if(Ys(e.payload.entities,l=>(l==null?void 0:l.model_name)===(r==null?void 0:r.model_name)&&(l==null?void 0:l.base_model)===(r==null?void 0:r.base_model)))return;const o=e.payload.ids[0],s=e.payload.entities[o];if(!s){n(xm(null));return}const a=Xv.safeParse(s);if(!a.success){F8.error({error:a.error.format()},"Failed to parse main model");return}n(xm(a.data))}}),fe({matcher:io.endpoints.getVaeModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=t().generation.vae;if(r===null||Ys(e.payload.entities,l=>(l==null?void 0:l.model_name)===(r==null?void 0:r.model_name)&&(l==null?void 0:l.base_model)===(r==null?void 0:r.base_model)))return;const o=e.payload.ids[0],s=e.payload.entities[o];if(!s){n(xm(null));return}const a=jce.safeParse(s);if(!a.success){F8.error({error:a.error.format()},"Failed to parse VAE model");return}n(MD(a.data))}}),fe({matcher:io.endpoints.getLoRAModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=t().lora.loras;wl(r,(i,o)=>{Ys(e.payload.entities,a=>(a==null?void 0:a.model_name)===(i==null?void 0:i.model_name)&&(a==null?void 0:a.base_model)===(i==null?void 0:i.base_model))||n(f$(o))})}}),fe({matcher:io.endpoints.getControlNetModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=t().controlNet.controlNets;wl(r,(i,o)=>{Ys(e.payload.entities,a=>{var l,u;return(a==null?void 0:a.model_name)===((l=i==null?void 0:i.model)==null?void 0:l.model_name)&&(a==null?void 0:a.base_model)===((u=i==null?void 0:i.model)==null?void 0:u.base_model)})||n(r$({controlNetId:o}))})}})},mx=e=>!("$ref"in e),aSe=e=>!("$ref"in e),R8e=500,lSe={integer:"integer",float:"float",number:"float",string:"string",boolean:"boolean",enum:"enum",ImageField:"image",image_collection:"image_collection",LatentsField:"latents",ConditioningField:"conditioning",UNetField:"unet",ClipField:"clip",VaeField:"vae",model:"model",vae_model:"vae_model",lora_model:"lora_model",controlnet_model:"controlnet_model",ControlNetModelField:"controlnet_model",array:"array",item:"item",ColorField:"color",ControlField:"control",control:"control",cfg_scale:"float",control_weight:"float"},uSe=500,Qt=e=>`var(--invokeai-colors-${e}-${uSe})`,I8e={integer:{color:"red",colorCssVar:Qt("red"),title:"Integer",description:"Integers are whole numbers, without a decimal point."},float:{color:"orange",colorCssVar:Qt("orange"),title:"Float",description:"Floats are numbers with a decimal point."},string:{color:"yellow",colorCssVar:Qt("yellow"),title:"String",description:"Strings are text."},boolean:{color:"green",colorCssVar:Qt("green"),title:"Boolean",description:"Booleans are true or false."},enum:{color:"blue",colorCssVar:Qt("blue"),title:"Enum",description:"Enums are values that may be one of a number of options."},image:{color:"purple",colorCssVar:Qt("purple"),title:"Image",description:"Images may be passed between nodes."},image_collection:{color:"purple",colorCssVar:Qt("purple"),title:"Image Collection",description:"A collection of images."},latents:{color:"pink",colorCssVar:Qt("pink"),title:"Latents",description:"Latents may be passed between nodes."},conditioning:{color:"cyan",colorCssVar:Qt("cyan"),title:"Conditioning",description:"Conditioning may be passed between nodes."},unet:{color:"red",colorCssVar:Qt("red"),title:"UNet",description:"UNet submodel."},clip:{color:"green",colorCssVar:Qt("green"),title:"Clip",description:"Tokenizer and text_encoder submodels."},vae:{color:"blue",colorCssVar:Qt("blue"),title:"Vae",description:"Vae submodel."},control:{color:"cyan",colorCssVar:Qt("cyan"),title:"Control",description:"Control info passed between nodes."},model:{color:"teal",colorCssVar:Qt("teal"),title:"Model",description:"Models are models."},vae_model:{color:"teal",colorCssVar:Qt("teal"),title:"VAE",description:"Models are models."},lora_model:{color:"teal",colorCssVar:Qt("teal"),title:"LoRA",description:"Models are models."},controlnet_model:{color:"teal",colorCssVar:Qt("teal"),title:"ControlNet",description:"Models are models."},array:{color:"gray",colorCssVar:Qt("gray"),title:"Array",description:"TODO: Array type description."},item:{color:"gray",colorCssVar:Qt("gray"),title:"Collection Item",description:"TODO: Collection Item type description."},color:{color:"gray",colorCssVar:Qt("gray"),title:"Color",description:"A RGBA color."}},E_=e=>e.$ref.split("/").slice(-1)[0],cSe=({schemaObject:e,baseField:t})=>{const n={...t,type:"integer",inputRequirement:"always",inputKind:"any",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},dSe=({schemaObject:e,baseField:t})=>{const n={...t,type:"float",inputRequirement:"always",inputKind:"any",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},fSe=({schemaObject:e,baseField:t})=>{const n={...t,type:"string",inputRequirement:"always",inputKind:"any",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},hSe=({schemaObject:e,baseField:t})=>({...t,type:"boolean",inputRequirement:"always",inputKind:"any",default:e.default??!1}),pSe=({schemaObject:e,baseField:t})=>({...t,type:"model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),gSe=({schemaObject:e,baseField:t})=>({...t,type:"vae_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),mSe=({schemaObject:e,baseField:t})=>({...t,type:"lora_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),ySe=({schemaObject:e,baseField:t})=>({...t,type:"controlnet_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),vSe=({schemaObject:e,baseField:t})=>({...t,type:"image",inputRequirement:"always",inputKind:"any",default:e.default??void 0}),bSe=({schemaObject:e,baseField:t})=>({...t,type:"image_collection",inputRequirement:"always",inputKind:"any",default:e.default??void 0}),SSe=({schemaObject:e,baseField:t})=>({...t,type:"latents",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),_Se=({schemaObject:e,baseField:t})=>({...t,type:"conditioning",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),wSe=({schemaObject:e,baseField:t})=>({...t,type:"unet",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),xSe=({schemaObject:e,baseField:t})=>({...t,type:"clip",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),CSe=({schemaObject:e,baseField:t})=>({...t,type:"vae",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),TSe=({schemaObject:e,baseField:t})=>({...t,type:"control",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),ESe=({schemaObject:e,baseField:t})=>{const n=e.enum??[];return{...t,type:"enum",enumType:e.type??"string",options:n,inputRequirement:"always",inputKind:"direct",default:e.default??n[0]}},B8=({baseField:e})=>({...e,type:"array",inputRequirement:"always",inputKind:"direct",default:[]}),j8=({baseField:e})=>({...e,type:"item",inputRequirement:"always",inputKind:"direct",default:void 0}),PSe=({schemaObject:e,baseField:t})=>({...t,type:"color",inputRequirement:"always",inputKind:"direct",default:e.default??{r:127,g:127,b:127,a:255}}),nB=(e,t,n)=>{let r="";n&&t in n?r=n[t]:e.type?e.enum?r="enum":e.type&&(r=e.type):e.allOf?r=E_(e.allOf[0]):e.anyOf?r=E_(e.anyOf[0]):e.oneOf&&(r=E_(e.oneOf[0]));const i=lSe[r];if(!i)throw`Field type "${r}" is unknown!`;return i},kSe=(e,t,n)=>{const r=nB(e,t,n),i={name:t,title:e.title??"",description:e.description??""};if(["image"].includes(r))return vSe({schemaObject:e,baseField:i});if(["image_collection"].includes(r))return bSe({schemaObject:e,baseField:i});if(["latents"].includes(r))return SSe({schemaObject:e,baseField:i});if(["conditioning"].includes(r))return _Se({schemaObject:e,baseField:i});if(["unet"].includes(r))return wSe({schemaObject:e,baseField:i});if(["clip"].includes(r))return xSe({schemaObject:e,baseField:i});if(["vae"].includes(r))return CSe({schemaObject:e,baseField:i});if(["control"].includes(r))return TSe({schemaObject:e,baseField:i});if(["model"].includes(r))return pSe({schemaObject:e,baseField:i});if(["vae_model"].includes(r))return gSe({schemaObject:e,baseField:i});if(["lora_model"].includes(r))return mSe({schemaObject:e,baseField:i});if(["controlnet_model"].includes(r))return ySe({schemaObject:e,baseField:i});if(["enum"].includes(r))return ESe({schemaObject:e,baseField:i});if(["integer"].includes(r))return cSe({schemaObject:e,baseField:i});if(["number","float"].includes(r))return dSe({schemaObject:e,baseField:i});if(["string"].includes(r))return fSe({schemaObject:e,baseField:i});if(["boolean"].includes(r))return hSe({schemaObject:e,baseField:i});if(["array"].includes(r))return B8({schemaObject:e,baseField:i});if(["item"].includes(r))return j8({schemaObject:e,baseField:i});if(["color"].includes(r))return PSe({schemaObject:e,baseField:i});if(["array"].includes(r))return B8({schemaObject:e,baseField:i});if(["item"].includes(r))return j8({schemaObject:e,baseField:i})},ASe=(e,t,n)=>{const r=e.$ref.split("/").slice(-1)[0],i=t.components.schemas[r];return mx(i)?Ev(i.properties,(s,a,l)=>{if(!["type","id"].includes(l)&&!["object"].includes(a.type)&&mx(a)){const u=nB(a,l,n);s[l]={name:l,title:a.title??"",description:a.description??"",type:u}}return s},{}):{}},OSe=["id","type","is_intermediate","metadata"],RSe=["Graph","InvocationMeta","MetadataAccumulatorInvocation"],ISe=e=>g7(e.components.schemas,(r,i)=>i.includes("Invocation")&&!i.includes("InvocationOutput")&&!RSe.some(o=>i.includes(o))).reduce((r,i)=>{var o,s,a;if(aSe(i)){const l=i.properties.type.default,u=((o=i.ui)==null?void 0:o.title)??i.title.replace("Invocation",""),c=(s=i.ui)==null?void 0:s.type_hints,d={};if(l==="collect"){const g=i.properties.item;d.item={type:"item",name:"item",description:g.description??"",title:"Collection Item",inputKind:"connection",inputRequirement:"always",default:void 0}}else if(l==="iterate"){const g=i.properties.collection;d.collection={type:"array",name:"collection",title:g.title??"",default:[],description:g.description??"",inputRequirement:"always",inputKind:"connection"}}else Ev(i.properties,(g,S,v)=>{if(!OSe.includes(v)&&mx(S)){const y=kSe(S,v,c);y&&(g[v]=y)}return g},d);const f=i.output;let h;if(l==="iterate"){const g=e.components.schemas.IterateInvocationOutput;h={item:{name:"item",title:g.title??"",description:g.description??"",type:"array"}}}else h=ASe(f,e,c);const p={title:u,type:l,tags:((a=i.ui)==null?void 0:a.tags)??[],description:i.description??"",inputs:d,outputs:h};Object.assign(r,{[l]:p})}return r},{}),P_=ve.child({namespace:"schema"}),MSe=()=>{fe({actionCreator:Dh.fulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=e.payload;P_.info({data:{schemaJSON:r}},"Dereferenced OpenAPI schema");const i=ISe(r);P_.info({data:{nodeTemplates:i}},`Built ${g5(i)} node templates`),t(j3(i))}}),fe({actionCreator:Dh.rejected,effect:(e,{dispatch:t,getState:n})=>{P_.error("Problem dereferencing OpenAPI Schema")}})},NSe=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),DSe=new Map(NSe),LSe=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],yx=Symbol(".toJSON was called"),$Se=e=>{e[yx]=!0;const t=e.toJSON();return delete e[yx],t},FSe=e=>DSe.get(e)??Error,rB=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:i,depth:o,useToJSON:s,serialize:a})=>{if(!n)if(Array.isArray(e))n=[];else if(!a&&V8(e)){const u=FSe(e.name);n=new u}else n={};if(t.push(e),o>=i)return n;if(s&&typeof e.toJSON=="function"&&e[yx]!==!0)return $Se(e);const l=u=>rB({from:u,seen:[...t],forceEnumerable:r,maxDepth:i,depth:o,useToJSON:s,serialize:a});for(const[u,c]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(c)){n[u]="[object Buffer]";continue}if(c!==null&&typeof c=="object"&&typeof c.pipe=="function"){n[u]="[object Stream]";continue}if(typeof c!="function"){if(!c||typeof c!="object"){n[u]=c;continue}if(!t.includes(e[u])){o++,n[u]=l(e[u]);continue}n[u]="[Circular]"}}for(const{property:u,enumerable:c}of LSe)typeof e[u]<"u"&&e[u]!==null&&Object.defineProperty(n,u,{value:V8(e[u])?l(e[u]):e[u],enumerable:r?!0:c,configurable:!0,writable:!0});return n};function k1(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?rB({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name??"anonymous"}]`:e}function V8(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const iB=To.injectEndpoints({endpoints:e=>({getImageDTO:e.query({query:t=>({url:`images/${t}`}),providesTags:(t,n,r)=>{const i=[{type:"Image",id:r}];return t!=null&&t.board_id&&i.push({type:"Board",id:t.board_id}),i},keepUnusedDataFor:86400}),getImageMetadata:e.query({query:t=>({url:`images/${t}/metadata`}),providesTags:(t,n,r)=>[{type:"ImageMetadata",id:r}],keepUnusedDataFor:86400})})}),{useGetImageDTOQuery:M8e,useGetImageMetadataQuery:N8e}=iB,oB=ve.child({namespace:"gallery"}),BSe=()=>{fe({actionCreator:la.fulfilled,effect:(e,{getState:t,dispatch:n})=>{const{items:r}=e.payload;oB.debug({data:{payload:e.payload}},`Received ${r.length} images`),r.forEach(i=>{n(iB.util.upsertQueryData("getImageDTO",i.image_name,i))})}})},jSe=()=>{fe({actionCreator:la.rejected,effect:(e,{getState:t,dispatch:n})=>{e.payload&&oB.debug({data:{error:k1(e.payload)}},"Problem receiving images")}})},sB=ve.child({namespace:"session"}),VSe=()=>{fe({actionCreator:zl.pending,effect:(e,{getState:t,dispatch:n})=>{}})},zSe=()=>{fe({actionCreator:zl.fulfilled,effect:(e,{getState:t,dispatch:n})=>{const{session_id:r}=e.meta.arg;sB.debug({data:{session_id:r}},`Session canceled (${r})`)}})},USe=()=>{fe({actionCreator:zl.rejected,effect:(e,{getState:t,dispatch:n})=>{if(e.payload){const{arg:r,error:i}=e.payload;sB.error({data:{arg:r,error:k1(i)}},"Problem canceling session")}}})},aB=ve.child({namespace:"session"}),GSe=()=>{fe({actionCreator:zn.pending,effect:(e,{getState:t,dispatch:n})=>{}})},HSe=()=>{fe({actionCreator:zn.fulfilled,effect:(e,{getState:t,dispatch:n})=>{const r=e.payload;aB.debug({data:{session:r}},`Session created (${r.id})`)}})},qSe=()=>{fe({actionCreator:zn.rejected,effect:(e,{getState:t,dispatch:n})=>{if(e.payload){const{arg:r,error:i}=e.payload,o=JSON.stringify(i);aB.error({data:{arg:r,error:k1(i)}},`Problem creating session: ${o}`)}}})},lB=ve.child({namespace:"session"}),WSe=()=>{fe({actionCreator:Pp.pending,effect:(e,{getState:t,dispatch:n})=>{}})},KSe=()=>{fe({actionCreator:Pp.fulfilled,effect:(e,{getState:t,dispatch:n})=>{const{session_id:r}=e.meta.arg;lB.debug({data:{session_id:r}},`Session invoked (${r})`)}})},YSe=()=>{fe({actionCreator:Pp.rejected,effect:(e,{getState:t,dispatch:n})=>{if(e.payload){const{arg:r,error:i}=e.payload,o=JSON.stringify(i);lB.error({data:{arg:r,error:k1(i)}},`Problem invoking session: ${o}`)}}})},XSe=ve.child({namespace:"session"}),QSe=()=>{fe({actionCreator:Ul,effect:(e,{getState:t,dispatch:n})=>{const{sessionId:r}=t().system;r&&(XSe.debug({session_id:r},`Session ready to invoke (${r})})`),n(Pp({session_id:r})))}})},ZSe=ve.child({namespace:"socketio"}),JSe=()=>{fe({actionCreator:BL,effect:(e,{dispatch:t,getState:n})=>{const{timestamp:r}=e.payload;ZSe.debug({timestamp:r},"Connected");const{nodes:i,config:o}=n(),{disabledTabs:s}=o;!i.schema&&!s.includes("nodes")&&t(Dh()),t(jL(e.payload)),t(io.endpoints.getMainModels.initiate()),t(io.endpoints.getControlNetModels.initiate()),t(io.endpoints.getLoRAModels.initiate()),t(io.endpoints.getTextualInversionModels.initiate()),t(io.endpoints.getVaeModels.initiate())}})},e_e=ve.child({namespace:"socketio"}),t_e=()=>{fe({actionCreator:VL,effect:(e,{dispatch:t,getState:n})=>{e_e.debug(e.payload,"Disconnected"),t(zL(e.payload))}})},z8=ve.child({namespace:"socketio"}),n_e=()=>{fe({actionCreator:ZL,effect:(e,{dispatch:t,getState:n})=>{if(n().system.canceledSession===e.payload.data.graph_execution_state_id){z8.trace(e.payload,"Ignored generator progress for canceled session");return}z8.trace(e.payload,`Generator progress (${e.payload.data.node.type})`),t(JL(e.payload))}})},r_e=ve.child({namespace:"socketio"}),i_e=()=>{fe({actionCreator:XL,effect:(e,{dispatch:t,getState:n})=>{r_e.debug(e.payload,`Session invocation complete (${e.payload.data.graph_execution_state_id})`),t(QL(e.payload))}})},o_e=ve.child({namespace:"socketio"}),s_e=["dataURL_image"],a_e=()=>{fe({actionCreator:_3,effect:async(e,{dispatch:t,getState:n,take:r})=>{o_e.debug({data:e.payload},`Invocation complete (${e.payload.data.node.type})`);const i=e.payload.data.graph_execution_state_id,{cancelType:o,isCancelScheduled:s,boardIdToAddTo:a}=n().system;o==="scheduled"&&s&&t(zl({session_id:i}));const{data:l}=e.payload,{result:u,node:c,graph_execution_state_id:d}=l;if(KF(u)&&!s_e.includes(c.type)){const{image_name:f}=u.image;t(Ph({image_name:f}));const[{payload:h}]=await r(Ph.fulfilled.match);d===n().canvas.layerState.stagingArea.sessionId&&t(bhe(h)),a&&!h.is_intermediate&&t(oi.endpoints.addImageToBoard.initiate({board_id:a,image_name:f})),t(tbe(null))}t(KL(e.payload))}})},l_e=ve.child({namespace:"socketio"}),u_e=()=>{fe({actionCreator:YL,effect:(e,{dispatch:t,getState:n})=>{l_e.error(e.payload,`Invocation error (${e.payload.data.node.type}): ${e.payload.data.error}`),t(w3(e.payload))}})},U8=ve.child({namespace:"socketio"}),c_e=()=>{fe({actionCreator:qL,effect:(e,{dispatch:t,getState:n})=>{if(n().system.canceledSession===e.payload.data.graph_execution_state_id){U8.trace(e.payload,"Ignored invocation started for canceled session");return}U8.debug(e.payload,`Invocation started (${e.payload.data.node.type})`),t(WL(e.payload))}})},d_e=ve.child({namespace:"socketio"}),f_e=()=>{fe({actionCreator:S3,effect:(e,{dispatch:t,getState:n})=>{d_e.debug(e.payload,`Subscribed (${e.payload.sessionId}))`),t(UL(e.payload))}})},h_e=ve.child({namespace:"socketio"}),p_e=()=>{fe({actionCreator:GL,effect:(e,{dispatch:t,getState:n})=>{h_e.debug(e.payload,`Unsubscribed (${e.payload.sessionId})`),t(HL(e.payload))}})},g_e=ve.child({namespace:"canvas"}),m_e=()=>{fe({actionCreator:gbe,effect:async(e,{dispatch:t,getState:n,take:r})=>{const{imageName:i}=e.payload;t(ro({image_name:i,is_intermediate:!1}));const[o]=await r(s=>(ro.fulfilled.match(s)||ro.rejected.match(s))&&s.meta.arg.image_name===i);if(ro.rejected.match(o)){g_e.error({data:{arg:o.meta.arg}},"Image saving failed"),t(Ht({title:"Image Saving Failed",description:o.error.message,status:"error"}));return}ro.fulfilled.match(o)&&(t(v1(o.payload)),t(Ht({title:"Image Saved",status:"success"})))}})},Dt="positive_conditioning",qt="negative_conditioning",wn="text_to_latents",Bn="latents_to_image",Mt="noise",Xi="rand_int",Yo="range_of_size",vr="iterate",wa="main_model_loader",Gl="onnx_model_loader",Ld="vae_loader",y_e="lora_loader",ft="clip_skip",lr="image_to_latents",en="latents_to_latents",oo="resize_image",Ns="inpaint",$g="control_net_collect",k_="dynamic_prompt",fn="metadata_accumulator",G8="esrgan",U3="text_to_image_graph",p0="image_to_image_graph",uB="inpaint_graph",Ip=(e,t,n,r=wa)=>{const{loras:i}=e.lora,o=g5(i),s=t.nodes[fn];o>0&&(t.edges=t.edges.filter(u=>!(u.source.node_id===wa&&["unet"].includes(u.source.field))&&!(u.source.node_id===Gl&&["unet"].includes(u.source.field))),t.edges=t.edges.filter(u=>!(u.source.node_id===ft&&["clip"].includes(u.source.field))));let a="",l=0;wl(i,u=>{const{model_name:c,base_model:d,weight:f}=u,h=`${y_e}_${c.replace(".","_")}`,p={type:"lora_loader",id:h,lora:{model_name:c,base_model:d},weight:f};s&&s.loras.push({lora:{model_name:c,base_model:d},weight:f}),t.nodes[h]=p,l===0?(t.edges.push({source:{node_id:r,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:ft,field:"clip"},destination:{node_id:h,field:"clip"}})):(t.edges.push({source:{node_id:a,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:a,field:"clip"},destination:{node_id:h,field:"clip"}})),l===o-1&&(t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:n,field:"unet"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:Dt,field:"clip"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:qt,field:"clip"}})),a=h,l+=1})},Mp=(e,t,n=wa)=>{const{vae:r}=e.generation,i=!r,o=t.nodes[fn];i||(t.nodes[Ld]={type:"vae_loader",id:Ld,vae_model:r});const s=n==Gl;(t.id===U3||t.id===p0)&&t.edges.push({source:{node_id:i?n:Ld,field:i&&s?"vae_decoder":"vae"},destination:{node_id:Bn,field:"vae"}}),t.id===p0&&t.edges.push({source:{node_id:i?n:Ld,field:i&&s?"vae_decoder":"vae"},destination:{node_id:lr,field:"vae"}}),t.id===uB&&t.edges.push({source:{node_id:i?n:Ld,field:i&&s?"vae_decoder":"vae"},destination:{node_id:Ns,field:"vae"}}),r&&o&&(o.vae=r)},v_e=ve.child({namespace:"nodes"}),b_e=(e,t,n)=>{const{positivePrompt:r,negativePrompt:i,model:o,cfgScale:s,scheduler:a,steps:l,img2imgStrength:u,shouldFitToWidthHeight:c,iterations:d,seed:f,shouldRandomizeSeed:h,seamSize:p,seamBlur:g,seamSteps:S,seamStrength:v,tileSize:y,infillMethod:m,clipSkip:b}=e.generation;if(!o)throw v_e.error("No model found in state"),new Error("No model found in state");const{width:_,height:w}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:x,boundingBoxScaleMethod:C}=e.canvas,k=o.model_type.includes("onnx")?Gl:wa,P={id:uB,nodes:{[Ns]:{type:"inpaint",id:Ns,steps:l,width:_,height:w,cfg_scale:s,scheduler:a,image:{image_name:t.image_name},strength:u,fit:c,mask:{image_name:n.image_name},seam_size:p,seam_blur:g,seam_strength:v,seam_steps:S,tile_size:m==="tile"?y:void 0,infill_method:m,inpaint_width:C!=="none"?x.width:void 0,inpaint_height:C!=="none"?x.height:void 0},[Dt]:{type:"compel",id:Dt,prompt:r},[qt]:{type:"compel",id:qt,prompt:i},[k]:{type:k,id:k,model:o},[ft]:{type:"clip_skip",id:ft,skipped_layers:b},[Yo]:{type:"range_of_size",id:Yo,size:d,step:1},[vr]:{type:"iterate",id:vr}},edges:[{source:{node_id:k,field:"unet"},destination:{node_id:Ns,field:"unet"}},{source:{node_id:k,field:"clip"},destination:{node_id:ft,field:"clip"}},{source:{node_id:ft,field:"clip"},destination:{node_id:Dt,field:"clip"}},{source:{node_id:ft,field:"clip"},destination:{node_id:qt,field:"clip"}},{source:{node_id:qt,field:"conditioning"},destination:{node_id:Ns,field:"negative_conditioning"}},{source:{node_id:Dt,field:"conditioning"},destination:{node_id:Ns,field:"positive_conditioning"}},{source:{node_id:Yo,field:"collection"},destination:{node_id:vr,field:"collection"}},{source:{node_id:vr,field:"item"},destination:{node_id:Ns,field:"seed"}}]};if(Ip(e,P,Ns),Mp(e,P),h){const A={id:Xi,type:"rand_int"};P.nodes[Xi]=A,P.edges.push({source:{node_id:Xi,field:"a"},destination:{node_id:Yo,field:"start"}})}else P.nodes[Yo].start=f;return P},S_e=e=>g7(e,n=>n.isEnabled&&(!!n.processedControlImage||n.processorType==="none"&&!!n.controlImage)),A1=(e,t,n)=>{const{isEnabled:r,controlNets:i}=e.controlNet,o=S_e(i),s=t.nodes[fn];if(r&&o.length&&o.length){const a={id:$g,type:"collect"};t.nodes[$g]=a,t.edges.push({source:{node_id:$g,field:"collection"},destination:{node_id:n,field:"control"}}),o.forEach(l=>{const{controlNetId:u,controlImage:c,processedControlImage:d,beginStepPct:f,endStepPct:h,controlMode:p,model:g,processorType:S,weight:v}=l,y={id:`control_net_${u}`,type:"controlnet",begin_step_percent:f,end_step_percent:h,control_mode:p,control_model:g,control_weight:v};if(d&&S!=="none")y.image={image_name:d};else if(c)y.image={image_name:c};else return;if(t.nodes[y.id]=y,s){const m=p5(y,["id","type"]);s.controlnets.push(m)}t.edges.push({source:{node_id:y.id,field:"control"},destination:{node_id:$g,field:"item"}})})}},O1=(e,t)=>{const{positivePrompt:n,iterations:r,seed:i,shouldRandomizeSeed:o}=e.generation,{combinatorial:s,isEnabled:a,maxPrompts:l}=e.dynamicPrompts,u=t.nodes[fn];if(a){FZ(t.nodes[Dt],"prompt");const c={id:k_,type:"dynamic_prompt",max_prompts:s?l:r,combinatorial:s,prompt:n},d={id:vr,type:"iterate"};if(t.nodes[k_]=c,t.nodes[vr]=d,t.edges.push({source:{node_id:k_,field:"prompt_collection"},destination:{node_id:vr,field:"collection"}},{source:{node_id:vr,field:"item"},destination:{node_id:Dt,field:"prompt"}}),u&&t.edges.push({source:{node_id:vr,field:"item"},destination:{node_id:fn,field:"positive_prompt"}}),o){const f={id:Xi,type:"rand_int"};t.nodes[Xi]=f,t.edges.push({source:{node_id:Xi,field:"a"},destination:{node_id:Mt,field:"seed"}}),u&&t.edges.push({source:{node_id:Xi,field:"a"},destination:{node_id:fn,field:"seed"}})}else t.nodes[Mt].seed=i,u&&(u.seed=i)}else{u&&(u.positive_prompt=n);const c={id:Yo,type:"range_of_size",size:r,step:1},d={id:vr,type:"iterate"};if(t.nodes[vr]=d,t.nodes[Yo]=c,t.edges.push({source:{node_id:Yo,field:"collection"},destination:{node_id:vr,field:"collection"}}),t.edges.push({source:{node_id:vr,field:"item"},destination:{node_id:Mt,field:"seed"}}),u&&t.edges.push({source:{node_id:vr,field:"item"},destination:{node_id:fn,field:"seed"}}),o){const f={id:Xi,type:"rand_int"};t.nodes[Xi]=f,t.edges.push({source:{node_id:Xi,field:"a"},destination:{node_id:Yo,field:"start"}})}else c.start=i}},__e=ve.child({namespace:"nodes"}),w_e=(e,t)=>{const{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,img2imgStrength:l,clipSkip:u,shouldUseCpuNoise:c,shouldUseNoiseSettings:d}=e.generation,{width:f,height:h}=e.canvas.boundingBoxDimensions;if(!i)throw __e.error("No model found in state"),new Error("No model found in state");const p=d?c:Vl.shouldUseCpuNoise,g=i.model_type.includes("onnx"),S=g?Gl:wa,v={id:p0,nodes:{[Dt]:{type:g?"prompt_onnx":"compel",id:Dt,prompt:n},[qt]:{type:g?"prompt_onnx":"compel",id:qt,prompt:r},[Mt]:{type:"noise",id:Mt,use_cpu:p},[S]:{type:S,id:S,model:i},[ft]:{type:"clip_skip",id:ft,skipped_layers:u},[Bn]:{type:g?"l2i_onnx":"l2i",id:Bn},[en]:{type:g?"l2l_onnx":"l2l",id:en,cfg_scale:o,scheduler:s,steps:a,strength:l},[lr]:{type:g?"i2l_onnx":"i2l",id:lr}},edges:[{source:{node_id:S,field:"clip"},destination:{node_id:ft,field:"clip"}},{source:{node_id:ft,field:"clip"},destination:{node_id:Dt,field:"clip"}},{source:{node_id:ft,field:"clip"},destination:{node_id:qt,field:"clip"}},{source:{node_id:en,field:"latents"},destination:{node_id:Bn,field:"latents"}},{source:{node_id:lr,field:"latents"},destination:{node_id:en,field:"latents"}},{source:{node_id:Mt,field:"noise"},destination:{node_id:en,field:"noise"}},{source:{node_id:S,field:"unet"},destination:{node_id:en,field:"unet"}},{source:{node_id:qt,field:"conditioning"},destination:{node_id:en,field:"negative_conditioning"}},{source:{node_id:Dt,field:"conditioning"},destination:{node_id:en,field:"positive_conditioning"}}]};if(t.width!==f||t.height!==h){const y={id:oo,type:"img_resize",image:{image_name:t.image_name},is_intermediate:!0,width:f,height:h};v.nodes[oo]=y,v.edges.push({source:{node_id:oo,field:"image"},destination:{node_id:lr,field:"image"}}),v.edges.push({source:{node_id:oo,field:"width"},destination:{node_id:Mt,field:"width"}}),v.edges.push({source:{node_id:oo,field:"height"},destination:{node_id:Mt,field:"height"}})}else v.nodes[lr].image={image_name:t.image_name},v.edges.push({source:{node_id:lr,field:"width"},destination:{node_id:Mt,field:"width"}}),v.edges.push({source:{node_id:lr,field:"height"},destination:{node_id:Mt,field:"height"}});return v.nodes[fn]={id:fn,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:o,height:h,width:f,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:p?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:u,strength:l,init_image:t.image_name},v.edges.push({source:{node_id:fn,field:"metadata"},destination:{node_id:Bn,field:"metadata"}}),Ip(e,v,en,S),Mp(e,v,S),O1(e,v),A1(e,v,en),v},x_e=ve.child({namespace:"nodes"}),C_e=e=>{const{positivePrompt:t,negativePrompt:n,model:r,cfgScale:i,scheduler:o,steps:s,clipSkip:a,shouldUseCpuNoise:l,shouldUseNoiseSettings:u}=e.generation,{width:c,height:d}=e.canvas.boundingBoxDimensions;if(!r)throw x_e.error("No model found in state"),new Error("No model found in state");const f=u?l:Vl.shouldUseCpuNoise,h=r.model_type.includes("onnx"),p=h?Gl:wa,g={id:U3,nodes:{[Dt]:{type:h?"prompt_onnx":"compel",id:Dt,prompt:t},[qt]:{type:h?"prompt_onnx":"compel",id:qt,prompt:n},[Mt]:{type:"noise",id:Mt,width:c,height:d,use_cpu:f},[wn]:{type:h?"t2l_onnx":"t2l",id:wn,cfg_scale:i,scheduler:o,steps:s},[p]:{type:p,id:p,model:r},[ft]:{type:"clip_skip",id:ft,skipped_layers:a},[Bn]:{type:h?"l2i_onnx":"l2i",id:Bn}},edges:[{source:{node_id:qt,field:"conditioning"},destination:{node_id:wn,field:"negative_conditioning"}},{source:{node_id:Dt,field:"conditioning"},destination:{node_id:wn,field:"positive_conditioning"}},{source:{node_id:p,field:"clip"},destination:{node_id:ft,field:"clip"}},{source:{node_id:ft,field:"clip"},destination:{node_id:Dt,field:"clip"}},{source:{node_id:ft,field:"clip"},destination:{node_id:qt,field:"clip"}},{source:{node_id:p,field:"unet"},destination:{node_id:wn,field:"unet"}},{source:{node_id:wn,field:"latents"},destination:{node_id:Bn,field:"latents"}},{source:{node_id:Mt,field:"noise"},destination:{node_id:wn,field:"noise"}}]};return g.nodes[fn]={id:fn,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:i,height:d,width:c,positive_prompt:"",negative_prompt:n,model:r,seed:0,steps:s,rand_device:f?"cpu":"cuda",scheduler:o,vae:void 0,controlnets:[],loras:[],clip_skip:a},g.edges.push({source:{node_id:fn,field:"metadata"},destination:{node_id:Bn,field:"metadata"}}),Ip(e,g,wn,p),Mp(e,g,p),O1(e,g),A1(e,g,wn),g};ve.child({namespace:"nodes"});const T_e=(e,t,n,r)=>{let i;if(t==="txt2img")i=C_e(e);else if(t==="img2img"){if(!n)throw new Error("Missing canvas init image");i=w_e(e,n)}else{if(!n||!r)throw new Error("Missing canvas init and mask images");i=b_e(e,n,r)}return wl(i.nodes,o=>{i.nodes[o.id].is_intermediate=!0}),i},cB=ge("nodes/textToImageGraphBuilt"),dB=ge("nodes/imageToImageGraphBuilt"),fB=ge("nodes/canvasGraphBuilt"),hB=ge("nodes/nodesGraphBuilt"),E_e=ys(cB,dB,fB,hB);var G3={exports:{}},R1={},pB={},De={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._registerNode=e.Konva=e.glob=void 0;var t=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}e.glob=typeof Ne<"u"?Ne:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},e.Konva={_global:e.glob,version:"9.2.0",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return e.Konva.angleDeg?i*t:i},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return e.Konva.DD.isDragging},isDragReady(){return!!e.Konva.DD.node},releaseCanvasOnDestroy:!0,document:e.glob.document,_injectGlobal(i){e.glob.Konva=i}};const r=i=>{e.Konva[i.prototype.getClassName()]=i};e._registerNode=r,e.Konva._injectGlobal(e.Konva)})(De);var Ft={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=De;class n{constructor(b=[1,0,0,1,0,0]){this.dirty=!1,this.m=b&&b.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(b){b.m[0]=this.m[0],b.m[1]=this.m[1],b.m[2]=this.m[2],b.m[3]=this.m[3],b.m[4]=this.m[4],b.m[5]=this.m[5]}point(b){var _=this.m;return{x:_[0]*b.x+_[2]*b.y+_[4],y:_[1]*b.x+_[3]*b.y+_[5]}}translate(b,_){return this.m[4]+=this.m[0]*b+this.m[2]*_,this.m[5]+=this.m[1]*b+this.m[3]*_,this}scale(b,_){return this.m[0]*=b,this.m[1]*=b,this.m[2]*=_,this.m[3]*=_,this}rotate(b){var _=Math.cos(b),w=Math.sin(b),x=this.m[0]*_+this.m[2]*w,C=this.m[1]*_+this.m[3]*w,k=this.m[0]*-w+this.m[2]*_,P=this.m[1]*-w+this.m[3]*_;return this.m[0]=x,this.m[1]=C,this.m[2]=k,this.m[3]=P,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(b,_){var w=this.m[0]+this.m[2]*_,x=this.m[1]+this.m[3]*_,C=this.m[2]+this.m[0]*b,k=this.m[3]+this.m[1]*b;return this.m[0]=w,this.m[1]=x,this.m[2]=C,this.m[3]=k,this}multiply(b){var _=this.m[0]*b.m[0]+this.m[2]*b.m[1],w=this.m[1]*b.m[0]+this.m[3]*b.m[1],x=this.m[0]*b.m[2]+this.m[2]*b.m[3],C=this.m[1]*b.m[2]+this.m[3]*b.m[3],k=this.m[0]*b.m[4]+this.m[2]*b.m[5]+this.m[4],P=this.m[1]*b.m[4]+this.m[3]*b.m[5]+this.m[5];return this.m[0]=_,this.m[1]=w,this.m[2]=x,this.m[3]=C,this.m[4]=k,this.m[5]=P,this}invert(){var b=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),_=this.m[3]*b,w=-this.m[1]*b,x=-this.m[2]*b,C=this.m[0]*b,k=b*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),P=b*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=_,this.m[1]=w,this.m[2]=x,this.m[3]=C,this.m[4]=k,this.m[5]=P,this}getMatrix(){return this.m}decompose(){var b=this.m[0],_=this.m[1],w=this.m[2],x=this.m[3],C=this.m[4],k=this.m[5],P=b*x-_*w;let A={x:C,y:k,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(b!=0||_!=0){var $=Math.sqrt(b*b+_*_);A.rotation=_>0?Math.acos(b/$):-Math.acos(b/$),A.scaleX=$,A.scaleY=P/$,A.skewX=(b*w+_*x)/P,A.skewY=0}else if(w!=0||x!=0){var N=Math.sqrt(w*w+x*x);A.rotation=Math.PI/2-(x>0?Math.acos(-w/N):-Math.acos(w/N)),A.scaleX=P/N,A.scaleY=N,A.skewX=0,A.skewY=(b*w+_*x)/P}return A.rotation=e.Util._getRotation(A.rotation),A}}e.Transform=n;var r="[object Array]",i="[object Number]",o="[object String]",s="[object Boolean]",a=Math.PI/180,l=180/Math.PI,u="#",c="",d="0",f="Konva warning: ",h="Konva error: ",p="rgb(",g={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},S=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,v=[];const y=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(m){setTimeout(m,60)};e.Util={_isElement(m){return!!(m&&m.nodeType==1)},_isFunction(m){return!!(m&&m.constructor&&m.call&&m.apply)},_isPlainObject(m){return!!m&&m.constructor===Object},_isArray(m){return Object.prototype.toString.call(m)===r},_isNumber(m){return Object.prototype.toString.call(m)===i&&!isNaN(m)&&isFinite(m)},_isString(m){return Object.prototype.toString.call(m)===o},_isBoolean(m){return Object.prototype.toString.call(m)===s},isObject(m){return m instanceof Object},isValidSelector(m){if(typeof m!="string")return!1;var b=m[0];return b==="#"||b==="."||b===b.toUpperCase()},_sign(m){return m===0||m>0?1:-1},requestAnimFrame(m){v.push(m),v.length===1&&y(function(){const b=v;v=[],b.forEach(function(_){_()})})},createCanvasElement(){var m=document.createElement("canvas");try{m.style=m.style||{}}catch{}return m},createImageElement(){return document.createElement("img")},_isInDocument(m){for(;m=m.parentNode;)if(m==document)return!0;return!1},_urlToImage(m,b){var _=e.Util.createImageElement();_.onload=function(){b(_)},_.src=m},_rgbToHex(m,b,_){return((1<<24)+(m<<16)+(b<<8)+_).toString(16).slice(1)},_hexToRgb(m){m=m.replace(u,c);var b=parseInt(m,16);return{r:b>>16&255,g:b>>8&255,b:b&255}},getRandomColor(){for(var m=(Math.random()*16777215<<0).toString(16);m.length<6;)m=d+m;return u+m},getRGB(m){var b;return m in g?(b=g[m],{r:b[0],g:b[1],b:b[2]}):m[0]===u?this._hexToRgb(m.substring(1)):m.substr(0,4)===p?(b=S.exec(m.replace(/ /g,"")),{r:parseInt(b[1],10),g:parseInt(b[2],10),b:parseInt(b[3],10)}):{r:0,g:0,b:0}},colorToRGBA(m){return m=m||"black",e.Util._namedColorToRBA(m)||e.Util._hex3ColorToRGBA(m)||e.Util._hex4ColorToRGBA(m)||e.Util._hex6ColorToRGBA(m)||e.Util._hex8ColorToRGBA(m)||e.Util._rgbColorToRGBA(m)||e.Util._rgbaColorToRGBA(m)||e.Util._hslColorToRGBA(m)},_namedColorToRBA(m){var b=g[m.toLowerCase()];return b?{r:b[0],g:b[1],b:b[2],a:1}:null},_rgbColorToRGBA(m){if(m.indexOf("rgb(")===0){m=m.match(/rgb\(([^)]+)\)/)[1];var b=m.split(/ *, */).map(Number);return{r:b[0],g:b[1],b:b[2],a:1}}},_rgbaColorToRGBA(m){if(m.indexOf("rgba(")===0){m=m.match(/rgba\(([^)]+)\)/)[1];var b=m.split(/ *, */).map((_,w)=>_.slice(-1)==="%"?w===3?parseInt(_)/100:parseInt(_)/100*255:Number(_));return{r:b[0],g:b[1],b:b[2],a:b[3]}}},_hex8ColorToRGBA(m){if(m[0]==="#"&&m.length===9)return{r:parseInt(m.slice(1,3),16),g:parseInt(m.slice(3,5),16),b:parseInt(m.slice(5,7),16),a:parseInt(m.slice(7,9),16)/255}},_hex6ColorToRGBA(m){if(m[0]==="#"&&m.length===7)return{r:parseInt(m.slice(1,3),16),g:parseInt(m.slice(3,5),16),b:parseInt(m.slice(5,7),16),a:1}},_hex4ColorToRGBA(m){if(m[0]==="#"&&m.length===5)return{r:parseInt(m[1]+m[1],16),g:parseInt(m[2]+m[2],16),b:parseInt(m[3]+m[3],16),a:parseInt(m[4]+m[4],16)/255}},_hex3ColorToRGBA(m){if(m[0]==="#"&&m.length===4)return{r:parseInt(m[1]+m[1],16),g:parseInt(m[2]+m[2],16),b:parseInt(m[3]+m[3],16),a:1}},_hslColorToRGBA(m){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(m)){const[b,..._]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(m),w=Number(_[0])/360,x=Number(_[1])/100,C=Number(_[2])/100;let k,P,A;if(x===0)return A=C*255,{r:Math.round(A),g:Math.round(A),b:Math.round(A),a:1};C<.5?k=C*(1+x):k=C+x-C*x;const $=2*C-k,N=[0,0,0];for(let T=0;T<3;T++)P=w+1/3*-(T-1),P<0&&P++,P>1&&P--,6*P<1?A=$+(k-$)*6*P:2*P<1?A=k:3*P<2?A=$+(k-$)*(2/3-P)*6:A=$,N[T]=A*255;return{r:Math.round(N[0]),g:Math.round(N[1]),b:Math.round(N[2]),a:1}}},haveIntersection(m,b){return!(b.x>m.x+m.width||b.x+b.widthm.y+m.height||b.y+b.height1?(k=_,P=w,A=(_-x)*(_-x)+(w-C)*(w-C)):(k=m+N*(_-m),P=b+N*(w-b),A=(k-x)*(k-x)+(P-C)*(P-C))}return[k,P,A]},_getProjectionToLine(m,b,_){var w=e.Util.cloneObject(m),x=Number.MAX_VALUE;return b.forEach(function(C,k){if(!(!_&&k===b.length-1)){var P=b[(k+1)%b.length],A=e.Util._getProjectionToSegment(C.x,C.y,P.x,P.y,m.x,m.y),$=A[0],N=A[1],T=A[2];Tb.length){var k=b;b=m,m=k}for(w=0;w{b.width=0,b.height=0})},drawRoundedRectPath(m,b,_,w){let x=0,C=0,k=0,P=0;typeof w=="number"?x=C=k=P=Math.min(w,b/2,_/2):(x=Math.min(w[0]||0,b/2,_/2),C=Math.min(w[1]||0,b/2,_/2),P=Math.min(w[2]||0,b/2,_/2),k=Math.min(w[3]||0,b/2,_/2)),m.moveTo(x,0),m.lineTo(b-C,0),m.arc(b-C,C,C,Math.PI*3/2,0,!1),m.lineTo(b,_-P),m.arc(b-P,_-P,P,0,Math.PI/2,!1),m.lineTo(k,_),m.arc(k,_-k,k,Math.PI/2,Math.PI,!1),m.lineTo(0,x),m.arc(x,x,x,Math.PI,Math.PI*3/2,!1)}}})(Ft);var kt={},Re={},he={};Object.defineProperty(he,"__esModule",{value:!0});he.getComponentValidator=he.getBooleanValidator=he.getNumberArrayValidator=he.getFunctionValidator=he.getStringOrGradientValidator=he.getStringValidator=he.getNumberOrAutoValidator=he.getNumberOrArrayOfNumbersValidator=he.getNumberValidator=he.alphaComponent=he.RGBComponent=void 0;const _s=De,Vt=Ft;function ws(e){return Vt.Util._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||Vt.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}function P_e(e){return e>255?255:e<0?0:Math.round(e)}he.RGBComponent=P_e;function k_e(e){return e>1?1:e<1e-4?1e-4:e}he.alphaComponent=k_e;function A_e(){if(_s.Konva.isUnminified)return function(e,t){return Vt.Util._isNumber(e)||Vt.Util.warn(ws(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}he.getNumberValidator=A_e;function O_e(e){if(_s.Konva.isUnminified)return function(t,n){let r=Vt.Util._isNumber(t),i=Vt.Util._isArray(t)&&t.length==e;return!r&&!i&&Vt.Util.warn(ws(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}he.getNumberOrArrayOfNumbersValidator=O_e;function R_e(){if(_s.Konva.isUnminified)return function(e,t){var n=Vt.Util._isNumber(e),r=e==="auto";return n||r||Vt.Util.warn(ws(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}he.getNumberOrAutoValidator=R_e;function I_e(){if(_s.Konva.isUnminified)return function(e,t){return Vt.Util._isString(e)||Vt.Util.warn(ws(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}he.getStringValidator=I_e;function M_e(){if(_s.Konva.isUnminified)return function(e,t){const n=Vt.Util._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||Vt.Util.warn(ws(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}he.getStringOrGradientValidator=M_e;function N_e(){if(_s.Konva.isUnminified)return function(e,t){return Vt.Util._isFunction(e)||Vt.Util.warn(ws(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}}he.getFunctionValidator=N_e;function D_e(){if(_s.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(Vt.Util._isArray(e)?e.forEach(function(r){Vt.Util._isNumber(r)||Vt.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):Vt.Util.warn(ws(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}he.getNumberArrayValidator=D_e;function L_e(){if(_s.Konva.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||Vt.Util.warn(ws(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}he.getBooleanValidator=L_e;function $_e(e){if(_s.Konva.isUnminified)return function(t,n){return t==null||Vt.Util.isObject(t)||Vt.Util.warn(ws(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}he.getComponentValidator=$_e;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=Ft,n=he;var r="get",i="set";e.Factory={addGetterSetter(o,s,a,l,u){e.Factory.addGetter(o,s,a),e.Factory.addSetter(o,s,l,u),e.Factory.addOverloadedGetterSetter(o,s)},addGetter(o,s,a){var l=r+t.Util._capitalize(s);o.prototype[l]=o.prototype[l]||function(){var u=this.attrs[s];return u===void 0?a:u}},addSetter(o,s,a,l){var u=i+t.Util._capitalize(s);o.prototype[u]||e.Factory.overWriteSetter(o,s,a,l)},overWriteSetter(o,s,a,l){var u=i+t.Util._capitalize(s);o.prototype[u]=function(c){return a&&c!==void 0&&c!==null&&(c=a.call(this,c,s)),this._setAttr(s,c),l&&l.call(this),this}},addComponentsGetterSetter(o,s,a,l,u){var c=a.length,d=t.Util._capitalize,f=r+d(s),h=i+d(s),p,g;o.prototype[f]=function(){var v={};for(p=0;p{this._setAttr(s+d(b),void 0)}),this._fireChangeEvent(s,y,v),u&&u.call(this),this},e.Factory.addOverloadedGetterSetter(o,s)},addOverloadedGetterSetter(o,s){var a=t.Util._capitalize(s),l=i+a,u=r+a;o.prototype[s]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,s,a,l){t.Util.error("Adding deprecated "+s);var u=r+t.Util._capitalize(s),c=s+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){t.Util.error(c);var d=this.attrs[s];return d===void 0?a:d},e.Factory.addSetter(o,s,l,function(){t.Util.error(c)}),e.Factory.addOverloadedGetterSetter(o,s)},backCompat(o,s){t.Util.each(s,function(a,l){var u=o.prototype[l],c=r+t.Util._capitalize(a),d=i+t.Util._capitalize(a);function f(){u.apply(this,arguments),t.Util.error('"'+a+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[a]=f,o.prototype[c]=f,o.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(Re);var Li={},os={};Object.defineProperty(os,"__esModule",{value:!0});os.HitContext=os.SceneContext=os.Context=void 0;const gB=Ft,F_e=De;function B_e(e){var t=[],n=e.length,r=gB.Util,i,o;for(i=0;itypeof c=="number"?Math.floor(c):c)),o+=j_e+u.join(H8)+V_e)):(o+=a.property,t||(o+=q_e+a.val)),o+=G_e;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=K_e&&n.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var n=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(t){const n=t.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(t){var n=t.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(t){const n=t.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(t,n){this._context[t]=n}arc(t,n,r,i,o,s){this._context.arc(t,n,r,i,o,s)}arcTo(t,n,r,i,o){this._context.arcTo(t,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(t,n,r,i,o,s){this._context.bezierCurveTo(t,n,r,i,o,s)}clearRect(t,n,r,i){this._context.clearRect(t,n,r,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,n){var r=arguments;if(r.length===2)return this._context.createImageData(t,n);if(r.length===1)return this._context.createImageData(t)}createLinearGradient(t,n,r,i){return this._context.createLinearGradient(t,n,r,i)}createPattern(t,n){return this._context.createPattern(t,n)}createRadialGradient(t,n,r,i,o,s){return this._context.createRadialGradient(t,n,r,i,o,s)}drawImage(t,n,r,i,o,s,a,l,u){var c=arguments,d=this._context;c.length===3?d.drawImage(t,n,r):c.length===5?d.drawImage(t,n,r,i,o):c.length===9&&d.drawImage(t,n,r,i,o,s,a,l,u)}ellipse(t,n,r,i,o,s,a,l){this._context.ellipse(t,n,r,i,o,s,a,l)}isPointInPath(t,n,r,i){return r?this._context.isPointInPath(r,t,n,i):this._context.isPointInPath(t,n,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,n,r,i){this._context.fillRect(t,n,r,i)}strokeRect(t,n,r,i){this._context.strokeRect(t,n,r,i)}fillText(t,n,r,i){i?this._context.fillText(t,n,r,i):this._context.fillText(t,n,r)}measureText(t){return this._context.measureText(t)}getImageData(t,n,r,i){return this._context.getImageData(t,n,r,i)}lineTo(t,n){this._context.lineTo(t,n)}moveTo(t,n){this._context.moveTo(t,n)}rect(t,n,r,i){this._context.rect(t,n,r,i)}putImageData(t,n,r){this._context.putImageData(t,n,r)}quadraticCurveTo(t,n,r,i){this._context.quadraticCurveTo(t,n,r,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,n){this._context.scale(t,n)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,n,r,i,o,s){this._context.setTransform(t,n,r,i,o,s)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,n,r,i){this._context.strokeText(t,n,r,i)}transform(t,n,r,i,o,s){this._context.transform(t,n,r,i,o,s)}translate(t,n){this._context.translate(t,n)}_enableTrace(){var t=this,n=q8.length,r=this.setAttr,i,o,s=function(a){var l=t[a],u;t[a]=function(){return o=B_e(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:a,args:o}),u}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){var r;return e.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];e.DD._dragElements.forEach((o,s)=>{const{node:a}=o,l=a.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(f=>f.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var c=a.dragDistance(),d=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(d{o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];e.DD._dragElements.forEach(o=>{const{node:s}=o,a=s.getStage();if(r&&a.setPointersPositions(r),!a._changedPointerPositions.find(c=>c.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(e.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof t.Konva.Stage&&o.node;u&&i.indexOf(u)===-1&&i.push(u)}),i.forEach(o=>{o.draw()})},_endDragAfter(r){e.DD._dragElements.forEach((i,o)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&e.DD._dragElements.delete(o)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1))})(N1);Object.defineProperty(kt,"__esModule",{value:!0});kt.Node=void 0;const Be=Ft,Np=Re,Bg=Li,Ua=De,Jr=N1,Kt=he;var Rm="absoluteOpacity",jg="allEventListeners",Ho="absoluteTransform",W8="absoluteScale",Ga="canvas",n2e="Change",r2e="children",i2e="konva",vx="listening",K8="mouseenter",Y8="mouseleave",X8="set",Q8="Shape",Im=" ",Z8="stage",Ds="transform",o2e="Stage",bx="visible",s2e=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Im);let a2e=1,Ee=class Sx{constructor(t){this._id=a2e++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===Ds||t===Ho)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){var r=this._cache.get(t),i=t===Ds||t===Ho,o=r===void 0||i&&r.dirty===!0;return o&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const i=n.map(o=>o+"Change.konva").join(Im);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(Ga)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===Ho&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Ga)){const{scene:t,filter:n,hit:r}=this._cache.get(Ga);Be.Util.releaseCanvas(t,n,r),this._cache.delete(Ga)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var n=t||{},r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var i=Math.ceil(n.width||r.width),o=Math.ceil(n.height||r.height),s=n.pixelRatio,a=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!i||!o){Be.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=u*2+1,o+=u*2+1,a-=u,l-=u;var f=new Bg.SceneCanvas({pixelRatio:s,width:i,height:o}),h=new Bg.SceneCanvas({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),p=new Bg.HitCanvas({pixelRatio:d,width:i,height:o}),g=f.getContext(),S=p.getContext();return p.isCache=!0,f.isCache=!0,this._cache.delete(Ga),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),g.save(),S.save(),g.translate(-a,-l),S.translate(-a,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Rm),this._clearSelfAndDescendantCache(W8),this.drawScene(f,this),this.drawHit(p,this),this._isUnderCache=!1,g.restore(),S.restore(),c&&(g.save(),g.beginPath(),g.rect(0,0,i,o),g.closePath(),g.setAttr("strokeStyle","red"),g.setAttr("lineWidth",5),g.stroke(),g.restore()),this._cache.set(Ga,{scene:f,filter:h,hit:p,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(Ga)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){var r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],i,o,s,a,l=this.getAbsoluteTransform(n);return r.forEach(function(u){var c=l.point(u);i===void 0&&(i=s=c.x,o=a=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y)}),{x:i,y:o,width:s-i,height:a-o}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/i,r.height/i),t.restore()}_drawCachedHitCanvas(t){var n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,o=i.getContext(),s,a,l,u;if(t){if(!this._filterUpToDate){var c=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(s=t.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/c,r.getHeight()/c),a=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==r2e&&(r=X8+Be.Util._capitalize(n),Be.Util._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(vx,this._isListening)}_isListening(t){if(!this.listening())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isListening(t):!0}isVisible(){return this._getCache(bx,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);var r=this.getLayer(),i=!1;Jr.DD._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(i=!0)});var o=!n&&!Ua.Konva.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),n=this,r=0,i,o,s,a;function l(u){for(i=[],o=u.length,s=0;s0&&i[0].getDepth()<=t&&l(i)}return n.nodeType!==o2e&&l(n.getStage().getChildren()),r}getDepth(){for(var t=0,n=this.parent;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Ds),this._clearSelfAndDescendantCache(Ho)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var t=this.getStage().getPointerPosition();if(!t)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);var i=this.getAbsoluteTransform(t).getMatrix(),o=new Be.Transform,s=this.offset();return o.m=i.slice(),o.translate(s.x,s.y),o.getTranslation()}setAbsolutePosition(t){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(Ds);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(t.x,t.y),t={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:t.x,y:t.y}),this._clearCache(Ds),this._clearSelfAndDescendantCache(Ho),this}_setTransform(t){var n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var n=t.x,r=t.y,i=this.x(),o=this.y();return n!==void 0&&(i+=n),r!==void 0&&(o+=r),this.setPosition({x:i,y:o}),this}_eachAncestorReverse(t,n){var r=[],i=this.getParent(),o,s;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(o=r.length,s=0;s0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Be.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return Be.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&Be.Util.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Rm,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},n=this.getAttrs(),r,i,o,s,a;t.attrs={};for(r in n)i=n[r],a=Be.Util.isObject(i)&&!Be.Util._isPlainObject(i)&&!Be.Util._isArray(i),!a&&(o=typeof this[r]=="function"&&this[r],delete n[r],s=o?o.call(this):null,n[r]=i,s!==i&&(t.attrs[r]=i));return t.className=this.getClassName(),Be.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){var i=[];n&&this._isMatch(t)&&i.push(this);for(var o=this.parent;o;){if(o===r)return i;o._isMatch(t)&&i.push(o),o=o.parent}return i}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var n=t.replace(/ /g,"").split(","),r=n.length,i,o;for(i=0;i{try{const i=t==null?void 0:t.callback;i&&delete t.callback,Be.Util._urlToImage(this.toDataURL(t),function(o){n(o),i==null||i(o)})}catch(i){r(i)}})}toBlob(t){return new Promise((n,r)=>{try{const i=t==null?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob(o=>{n(o),i==null||i(o)})}catch(i){r(i)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Ua.Konva.dragDistance}_off(t,n,r){var i=this.eventListeners[t],o,s,a;for(o=0;o=0;if(r&&!this.isDragging()){var i=!1;Jr.DD._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(i=!0)}),i||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const n=Jr.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Jr.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return Be.Util.haveIntersection(r,this.getClientRect())}static create(t,n){return Be.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=Sx.prototype.getClassName.call(t),i=t.children,o,s,a;n&&(t.attrs.container=n),Ua.Konva[r]||(Be.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=Ua.Konva[r];if(o=new l(t.attrs),i)for(s=i.length,a=0;a0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(t,n){var r=[];return this._descendants(i=>{const o=i._isMatch(t);return o&&r.push(i),!!(o&&n)}),r}_descendants(t){let n=!1;const r=this.getChildren();for(const i of r){if(n=t(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(t),n))return!0}return!1}toObject(){var t=A_.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(n=>{t.children.push(n.toObject())}),t}isAncestorOf(t){for(var n=t.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(t){var n=A_.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(t){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(t)&&n.push(r)}),n}_clearSelfAndDescendantCache(t){var n;super._clearSelfAndDescendantCache(t),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas(),o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.scene,l=i&&i.isCache;if(!this.isVisible()&&!l)return this;if(a){o.save();var u=this.getAbsoluteTransform(n).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(t,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.hit;if(a){o.save();var l=this.getAbsoluteTransform(n).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(t,n,r){var i,o=n&&n.getContext(),s=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),u=s&&a||l;const c=r===this;if(u){o.save();var d=this.getAbsoluteTransform(r),f=d.getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[5]),o.beginPath();let S;if(l)S=l.call(this,o,this);else{var h=this.clipX(),p=this.clipY();o.rect(h,p,s,a)}o.clip.apply(o,S),f=d.copy().invert().getMatrix(),o.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var g=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";g&&(o.save(),o._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(S){S[t](n,r)}),g&&o.restore(),u&&o.restore()}getClientRect(t){var n;t=t||{};var r=t.skipTransform,i=t.relativeTo,o,s,a,l,u={x:1/0,y:1/0,width:0,height:0},c=this;(n=this.children)===null||n===void 0||n.forEach(function(g){if(g.visible()){var S=g.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});S.width===0&&S.height===0||(o===void 0?(o=S.x,s=S.y,a=S.x+S.width,l=S.y+S.height):(o=Math.min(o,S.x),s=Math.min(s,S.y),a=Math.max(a,S.x+S.width),l=Math.max(l,S.y+S.height)))}});for(var d=this.find("Shape"),f=!1,h=0;hX.indexOf("pointer")>=0?"pointer":X.indexOf("touch")>=0?"touch":"mouse",z=X=>{const F=V(X);if(F==="pointer")return i.Konva.pointerEventsEnabled&&L.pointer;if(F==="touch")return L.touch;if(F==="mouse")return L.mouse};function U(X={}){return(X.clipFunc||X.clipWidth||X.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),X}const K="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";e.stages=[];class W extends r.Container{constructor(F){super(U(F)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),e.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{U(this.attrs)}),this._checkVisibility()}_validateAdd(F){const q=F.getType()==="Layer",Q=F.getType()==="FastLayer";q||Q||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const F=this.visible()?"":"none";this.content.style.display=F}setContainer(F){if(typeof F===c){if(F.charAt(0)==="."){var q=F.slice(1);F=document.getElementsByClassName(q)[0]}else{var Q;F.charAt(0)!=="#"?Q=F:Q=F.slice(1),F=document.getElementById(Q)}if(!F)throw"Can not find container in document with id "+Q}return this._setAttr("container",F),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),F.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var F=this.children,q=F.length,Q;for(Q=0;Q-1&&e.stages.splice(q,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const F=this._pointerPositions[0]||this._changedPointerPositions[0];return F?{x:F.x,y:F.y}:(t.Util.warn(K),null)}_getPointerById(F){return this._pointerPositions.find(q=>q.id===F)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(F){F=F||{},F.x=F.x||0,F.y=F.y||0,F.width=F.width||this.width(),F.height=F.height||this.height();var q=new o.SceneCanvas({width:F.width,height:F.height,pixelRatio:F.pixelRatio||1}),Q=q.getContext()._context,J=this.children;return(F.x||F.y)&&Q.translate(-1*F.x,-1*F.y),J.forEach(function(ne){if(ne.isVisible()){var Z=ne._toKonvaCanvas(F);Q.drawImage(Z._canvas,F.x,F.y,Z.getWidth()/Z.getPixelRatio(),Z.getHeight()/Z.getPixelRatio())}}),q}getIntersection(F){if(!F)return null;var q=this.children,Q=q.length,J=Q-1,ne;for(ne=J;ne>=0;ne--){const Z=q[ne].getIntersection(F);if(Z)return Z}return null}_resizeDOM(){var F=this.width(),q=this.height();this.content&&(this.content.style.width=F+d,this.content.style.height=q+d),this.bufferCanvas.setSize(F,q),this.bufferHitCanvas.setSize(F,q),this.children.forEach(Q=>{Q.setSize({width:F,height:q}),Q.draw()})}add(F,...q){if(arguments.length>1){for(var Q=0;QR&&t.Util.warn("The stage has "+J+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),F.setSize({width:this.width(),height:this.height()}),F.draw(),i.Konva.isBrowser&&this.content.appendChild(F.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(F){return l.hasPointerCapture(F,this)}setPointerCapture(F){l.setPointerCapture(F,this)}releaseCapture(F){l.releaseCapture(F,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&D.forEach(([F,q])=>{this.content.addEventListener(F,Q=>{this[q](Q)},{passive:!1})})}_pointerenter(F){this.setPointersPositions(F);const q=z(F.type);this._fire(q.pointerenter,{evt:F,target:this,currentTarget:this})}_pointerover(F){this.setPointersPositions(F);const q=z(F.type);this._fire(q.pointerover,{evt:F,target:this,currentTarget:this})}_getTargetShape(F){let q=this[F+"targetShape"];return q&&!q.getStage()&&(q=null),q}_pointerleave(F){const q=z(F.type),Q=V(F.type);if(q){this.setPointersPositions(F);var J=this._getTargetShape(Q),ne=!s.DD.isDragging||i.Konva.hitOnDragEnabled;J&&ne?(J._fireAndBubble(q.pointerout,{evt:F}),J._fireAndBubble(q.pointerleave,{evt:F}),this._fire(q.pointerleave,{evt:F,target:this,currentTarget:this}),this[Q+"targetShape"]=null):ne&&(this._fire(q.pointerleave,{evt:F,target:this,currentTarget:this}),this._fire(q.pointerout,{evt:F,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(F){const q=z(F.type),Q=V(F.type);if(q){this.setPointersPositions(F);var J=!1;this._changedPointerPositions.forEach(ne=>{var Z=this.getIntersection(ne);if(s.DD.justDragged=!1,i.Konva["_"+Q+"ListenClick"]=!0,!(Z&&Z.isListening()))return;i.Konva.capturePointerEventsEnabled&&Z.setPointerCapture(ne.id),this[Q+"ClickStartShape"]=Z,Z._fireAndBubble(q.pointerdown,{evt:F,pointerId:ne.id}),J=!0;const ae=F.type.indexOf("touch")>=0;Z.preventDefault()&&F.cancelable&&ae&&F.preventDefault()}),J||this._fire(q.pointerdown,{evt:F,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(F){const q=z(F.type),Q=V(F.type);if(!q)return;s.DD.isDragging&&s.DD.node.preventDefault()&&F.cancelable&&F.preventDefault(),this.setPointersPositions(F);var J=!s.DD.isDragging||i.Konva.hitOnDragEnabled;if(!J)return;var ne={};let Z=!1;var me=this._getTargetShape(Q);this._changedPointerPositions.forEach(ae=>{const oe=l.getCapturedShape(ae.id)||this.getIntersection(ae),Ce=ae.id,se={evt:F,pointerId:Ce};var qe=me!==oe;if(qe&&me&&(me._fireAndBubble(q.pointerout,Object.assign({},se),oe),me._fireAndBubble(q.pointerleave,Object.assign({},se),oe)),oe){if(ne[oe._id])return;ne[oe._id]=!0}oe&&oe.isListening()?(Z=!0,qe&&(oe._fireAndBubble(q.pointerover,Object.assign({},se),me),oe._fireAndBubble(q.pointerenter,Object.assign({},se),me),this[Q+"targetShape"]=oe),oe._fireAndBubble(q.pointermove,Object.assign({},se))):me&&(this._fire(q.pointerover,{evt:F,target:this,currentTarget:this,pointerId:Ce}),this[Q+"targetShape"]=null)}),Z||this._fire(q.pointermove,{evt:F,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(F){const q=z(F.type),Q=V(F.type);if(!q)return;this.setPointersPositions(F);const J=this[Q+"ClickStartShape"],ne=this[Q+"ClickEndShape"];var Z={};let me=!1;this._changedPointerPositions.forEach(ae=>{const oe=l.getCapturedShape(ae.id)||this.getIntersection(ae);if(oe){if(oe.releaseCapture(ae.id),Z[oe._id])return;Z[oe._id]=!0}const Ce=ae.id,se={evt:F,pointerId:Ce};let qe=!1;i.Konva["_"+Q+"InDblClickWindow"]?(qe=!0,clearTimeout(this[Q+"DblTimeout"])):s.DD.justDragged||(i.Konva["_"+Q+"InDblClickWindow"]=!0,clearTimeout(this[Q+"DblTimeout"])),this[Q+"DblTimeout"]=setTimeout(function(){i.Konva["_"+Q+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),oe&&oe.isListening()?(me=!0,this[Q+"ClickEndShape"]=oe,oe._fireAndBubble(q.pointerup,Object.assign({},se)),i.Konva["_"+Q+"ListenClick"]&&J&&J===oe&&(oe._fireAndBubble(q.pointerclick,Object.assign({},se)),qe&&ne&&ne===oe&&oe._fireAndBubble(q.pointerdblclick,Object.assign({},se)))):(this[Q+"ClickEndShape"]=null,i.Konva["_"+Q+"ListenClick"]&&this._fire(q.pointerclick,{evt:F,target:this,currentTarget:this,pointerId:Ce}),qe&&this._fire(q.pointerdblclick,{evt:F,target:this,currentTarget:this,pointerId:Ce}))}),me||this._fire(q.pointerup,{evt:F,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+Q+"ListenClick"]=!1,F.cancelable&&Q!=="touch"&&F.preventDefault()}_contextmenu(F){this.setPointersPositions(F);var q=this.getIntersection(this.getPointerPosition());q&&q.isListening()?q._fireAndBubble($,{evt:F}):this._fire($,{evt:F,target:this,currentTarget:this})}_wheel(F){this.setPointersPositions(F);var q=this.getIntersection(this.getPointerPosition());q&&q.isListening()?q._fireAndBubble(M,{evt:F}):this._fire(M,{evt:F,target:this,currentTarget:this})}_pointercancel(F){this.setPointersPositions(F);const q=l.getCapturedShape(F.pointerId)||this.getIntersection(this.getPointerPosition());q&&q._fireAndBubble(_,l.createEvent(F)),l.releaseCapture(F.pointerId)}_lostpointercapture(F){l.releaseCapture(F.pointerId)}setPointersPositions(F){var q=this._getContentPosition(),Q=null,J=null;F=F||window.event,F.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(F.touches,ne=>{this._pointerPositions.push({id:ne.identifier,x:(ne.clientX-q.left)/q.scaleX,y:(ne.clientY-q.top)/q.scaleY})}),Array.prototype.forEach.call(F.changedTouches||F.touches,ne=>{this._changedPointerPositions.push({id:ne.identifier,x:(ne.clientX-q.left)/q.scaleX,y:(ne.clientY-q.top)/q.scaleY})})):(Q=(F.clientX-q.left)/q.scaleX,J=(F.clientY-q.top)/q.scaleY,this.pointerPos={x:Q,y:J},this._pointerPositions=[{x:Q,y:J,id:t.Util._getFirstPointerId(F)}],this._changedPointerPositions=[{x:Q,y:J,id:t.Util._getFirstPointerId(F)}])}_setPointerPosition(F){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(F)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var F=this.content.getBoundingClientRect();return{top:F.top,left:F.left,scaleX:F.width/this.content.clientWidth||1,scaleY:F.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!i.Konva.isBrowser){var F=this.container();if(!F)throw"Stage has no container. A container is required.";F.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),F.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(F){F.batchDraw()}),this}}e.Stage=W,W.prototype.nodeType=u,(0,a._registerNode)(W),n.Factory.addGetterSetter(W,"container")})(vB);var Dp={},mn={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=De,n=Ft,r=Re,i=kt,o=he,s=De,a=Lr;var l="hasShadow",u="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let h;function p(){return h||(h=n.Util.createCanvasElement().getContext("2d"),h)}e.shapes={};function g(k){const P=this.attrs.fillRule;P?k.fill(P):k.fill()}function S(k){k.stroke()}function v(k){k.fill()}function y(k){k.stroke()}function m(){this._clearCache(l)}function b(){this._clearCache(u)}function _(){this._clearCache(c)}function w(){this._clearCache(d)}function x(){this._clearCache(f)}class C extends i.Node{constructor(P){super(P);let A;for(;A=n.Util.getRandomColor(),!(A&&!(A in e.shapes)););this.colorKey=A,e.shapes[A]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var P=p();const A=P.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(A&&A.setTransform){const $=new n.Transform;$.translate(this.fillPatternX(),this.fillPatternY()),$.rotate(t.Konva.getAngle(this.fillPatternRotation())),$.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),$.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const N=$.getMatrix(),T=typeof DOMMatrix>"u"?{a:N[0],b:N[1],c:N[2],d:N[3],e:N[4],f:N[5]}:new DOMMatrix(N);A.setTransform(T)}return A}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var P=this.fillLinearGradientColorStops();if(P){for(var A=p(),$=this.fillLinearGradientStartPoint(),N=this.fillLinearGradientEndPoint(),T=A.createLinearGradient($.x,$.y,N.x,N.y),O=0;Othis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const P=this.hitStrokeWidth();return P==="auto"?this.hasStroke():this.strokeEnabled()&&!!P}intersects(P){var A=this.getStage(),$=A.bufferHitCanvas,N;return $.getContext().clear(),this.drawHit($,null,!0),N=$.context.getImageData(Math.round(P.x),Math.round(P.y),1,1).data,N[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(P){var A;if(!this.getStage()||!((A=this.attrs.perfectDrawEnabled)!==null&&A!==void 0?A:!0))return!1;const N=P||this.hasFill(),T=this.hasStroke(),O=this.getAbsoluteOpacity()!==1;if(N&&T&&O)return!0;const I=this.hasShadow(),M=this.shadowForStrokeEnabled();return!!(N&&T&&I&&M)}setStrokeHitEnabled(P){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),P?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var P=this.size();return{x:this._centroid?-P.width/2:0,y:this._centroid?-P.height/2:0,width:P.width,height:P.height}}getClientRect(P={}){const A=P.skipTransform,$=P.relativeTo,N=this.getSelfRect(),O=!P.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,I=N.width+O,M=N.height+O,R=!P.skipShadow&&this.hasShadow(),D=R?this.shadowOffsetX():0,L=R?this.shadowOffsetY():0,V=I+Math.abs(D),z=M+Math.abs(L),U=R&&this.shadowBlur()||0,K=V+U*2,W=z+U*2,X={width:K,height:W,x:-(O/2+U)+Math.min(D,0)+N.x,y:-(O/2+U)+Math.min(L,0)+N.y};return A?X:this._transformedRect(X,$)}drawScene(P,A){var $=this.getLayer(),N=P||$.getCanvas(),T=N.getContext(),O=this._getCanvasCache(),I=this.getSceneFunc(),M=this.hasShadow(),R,D,L,V=N.isCache,z=A===this;if(!this.isVisible()&&!z)return this;if(O){T.save();var U=this.getAbsoluteTransform(A).getMatrix();return T.transform(U[0],U[1],U[2],U[3],U[4],U[5]),this._drawCachedSceneCanvas(T),T.restore(),this}if(!I)return this;if(T.save(),this._useBufferCanvas()&&!V){R=this.getStage(),D=R.bufferCanvas,L=D.getContext(),L.clear(),L.save(),L._applyLineJoin(this);var K=this.getAbsoluteTransform(A).getMatrix();L.transform(K[0],K[1],K[2],K[3],K[4],K[5]),I.call(this,L,this),L.restore();var W=D.pixelRatio;M&&T._applyShadow(this),T._applyOpacity(this),T._applyGlobalCompositeOperation(this),T.drawImage(D._canvas,0,0,D.width/W,D.height/W)}else{if(T._applyLineJoin(this),!z){var K=this.getAbsoluteTransform(A).getMatrix();T.transform(K[0],K[1],K[2],K[3],K[4],K[5]),T._applyOpacity(this),T._applyGlobalCompositeOperation(this)}M&&T._applyShadow(this),I.call(this,T,this)}return T.restore(),this}drawHit(P,A,$=!1){if(!this.shouldDrawHit(A,$))return this;var N=this.getLayer(),T=P||N.hitCanvas,O=T&&T.getContext(),I=this.hitFunc()||this.sceneFunc(),M=this._getCanvasCache(),R=M&&M.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),R){O.save();var D=this.getAbsoluteTransform(A).getMatrix();return O.transform(D[0],D[1],D[2],D[3],D[4],D[5]),this._drawCachedHitCanvas(O),O.restore(),this}if(!I)return this;if(O.save(),O._applyLineJoin(this),!(this===A)){var V=this.getAbsoluteTransform(A).getMatrix();O.transform(V[0],V[1],V[2],V[3],V[4],V[5])}return I.call(this,O,this),O.restore(),this}drawHitFromCache(P=0){var A=this._getCanvasCache(),$=this._getCachedSceneCanvas(),N=A.hit,T=N.getContext(),O=N.getWidth(),I=N.getHeight(),M,R,D,L,V,z;T.clear(),T.drawImage($._canvas,0,0,O,I);try{for(M=T.getImageData(0,0,O,I),R=M.data,D=R.length,L=n.Util._hexToRgb(this.colorKey),V=0;VP?(R[V]=L.r,R[V+1]=L.g,R[V+2]=L.b,R[V+3]=255):R[V+3]=0;T.putImageData(M,0,0)}catch(U){n.Util.error("Unable to draw hit graph from cached scene canvas. "+U.message)}return this}hasPointerCapture(P){return a.hasPointerCapture(P,this)}setPointerCapture(P){a.setPointerCapture(P,this)}releaseCapture(P){a.releaseCapture(P,this)}}e.Shape=C,C.prototype._fillFunc=g,C.prototype._strokeFunc=S,C.prototype._fillFuncHit=v,C.prototype._strokeFuncHit=y,C.prototype._centroid=!1,C.prototype.nodeType="Shape",(0,s._registerNode)(C),C.prototype.eventListeners={},C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",m),C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",b),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",_),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",w),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",x),r.Factory.addGetterSetter(C,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(C,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(C,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"lineJoin"),r.Factory.addGetterSetter(C,"lineCap"),r.Factory.addGetterSetter(C,"sceneFunc"),r.Factory.addGetterSetter(C,"hitFunc"),r.Factory.addGetterSetter(C,"dash"),r.Factory.addGetterSetter(C,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(C,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(C,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternImage"),r.Factory.addGetterSetter(C,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(C,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(C,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(C,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(C,"fillEnabled",!0),r.Factory.addGetterSetter(C,"strokeEnabled",!0),r.Factory.addGetterSetter(C,"shadowEnabled",!0),r.Factory.addGetterSetter(C,"dashEnabled",!0),r.Factory.addGetterSetter(C,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(C,"fillPriority","color"),r.Factory.addComponentsGetterSetter(C,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(C,"fillPatternRotation",0),r.Factory.addGetterSetter(C,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(C,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(mn);Object.defineProperty(Dp,"__esModule",{value:!0});Dp.Layer=void 0;const zo=Ft,O_=Hl,mu=kt,q3=Re,J8=Li,f2e=he,h2e=mn,p2e=De;var g2e="#",m2e="beforeDraw",y2e="draw",_B=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],v2e=_B.length;class rd extends O_.Container{constructor(t){super(t),this.canvas=new J8.SceneCanvas,this.hitCanvas=new J8.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),t{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas();return this._fire(m2e,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),O_.Container.prototype.drawScene.call(this,i,n),this._fire(y2e,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),O_.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){zo.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return zo.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return zo.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Dp.Layer=rd;rd.prototype.nodeType="Layer";(0,p2e._registerNode)(rd);q3.Factory.addGetterSetter(rd,"imageSmoothingEnabled",!0);q3.Factory.addGetterSetter(rd,"clearBeforeDraw",!0);q3.Factory.addGetterSetter(rd,"hitGraphEnabled",!0,(0,f2e.getBooleanValidator)());var L1={};Object.defineProperty(L1,"__esModule",{value:!0});L1.FastLayer=void 0;const b2e=Ft,S2e=Dp,_2e=De;class W3 extends S2e.Layer{constructor(t){super(t),this.listening(!1),b2e.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}L1.FastLayer=W3;W3.prototype.nodeType="FastLayer";(0,_2e._registerNode)(W3);var id={};Object.defineProperty(id,"__esModule",{value:!0});id.Group=void 0;const w2e=Ft,x2e=Hl,C2e=De;class K3 extends x2e.Container{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&w2e.Util.throw("You may only add groups and shapes to groups.")}}id.Group=K3;K3.prototype.nodeType="Group";(0,C2e._registerNode)(K3);var od={};Object.defineProperty(od,"__esModule",{value:!0});od.Animation=void 0;const R_=De,eA=Ft;var I_=function(){return R_.glob.performance&&R_.glob.performance.now?function(){return R_.glob.performance.now()}:function(){return new Date().getTime()}}();class so{constructor(t,n){this.id=so.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:I_(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){var n=[];return t?t.length>0?n=t:n=[t]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(t){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():p<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=p,this.update())}getTime(){return this._time}setPosition(p){this.prevPos=this._pos,this.propFunc(p),this._pos=p}getPosition(p){return p===void 0&&(p=this._time),this.func(p,this.begin,this._change,this.duration)}play(){this.state=a,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(p){this.pause(),this._time=p,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var p=this.getTimer()-this._startTime;this.state===a?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=s,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){var g=this,S=p.node,v=S._id,y,m=p.easing||e.Easings.Linear,b=!!p.yoyo,_;typeof p.duration>"u"?y=.3:p.duration===0?y=.001:y=p.duration,this.node=S,this._id=u++;var w=S.getLayer()||(S instanceof i.Konva.Stage?S.getLayers():null);w||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){g.tween.onEnterFrame()},w),this.tween=new d(_,function(x){g._tweenFunc(x)},m,0,1,y*1e3,b),this._addListeners(),f.attrs[v]||(f.attrs[v]={}),f.attrs[v][this._id]||(f.attrs[v][this._id]={}),f.tweens[v]||(f.tweens[v]={});for(_ in p)o[_]===void 0&&this._addAttr(_,p[_]);this.reset(),this.onFinish=p.onFinish,this.onReset=p.onReset,this.onUpdate=p.onUpdate}_addAttr(p,g){var S=this.node,v=S._id,y,m,b,_,w,x,C,k;if(b=f.tweens[v][p],b&&delete f.attrs[v][b][p],y=S.getAttr(p),t.Util._isArray(g))if(m=[],w=Math.max(g.length,y.length),p==="points"&&g.length!==y.length&&(g.length>y.length?(C=y,y=t.Util._prepareArrayForTween(y,g,S.closed())):(x=g,g=t.Util._prepareArrayForTween(g,y,S.closed()))),p.indexOf("fill")===0)for(_=0;_{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var p=this.node,g=f.attrs[p._id][this._id];g.points&&g.points.trueEnd&&p.setAttr("points",g.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var p=this.node,g=f.attrs[p._id][this._id];g.points&&g.points.trueStart&&p.points(g.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(p){return this.tween.seek(p*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var p=this.node._id,g=this._id,S=f.tweens[p],v;this.pause();for(v in S)delete f.tweens[p][v];delete f.attrs[p][g]}}e.Tween=f,f.attrs={},f.tweens={},r.Node.prototype.to=function(h){var p=h.onFinish;h.node=this,h.onFinish=function(){this.destroy(),p&&p()};var g=new f(h);g.play()},e.Easings={BackEaseIn(h,p,g,S){var v=1.70158;return g*(h/=S)*h*((v+1)*h-v)+p},BackEaseOut(h,p,g,S){var v=1.70158;return g*((h=h/S-1)*h*((v+1)*h+v)+1)+p},BackEaseInOut(h,p,g,S){var v=1.70158;return(h/=S/2)<1?g/2*(h*h*(((v*=1.525)+1)*h-v))+p:g/2*((h-=2)*h*(((v*=1.525)+1)*h+v)+2)+p},ElasticEaseIn(h,p,g,S,v,y){var m=0;return h===0?p:(h/=S)===1?p+g:(y||(y=S*.3),!v||v0?t:n),c=s*n,d=a*(a>0?t:n),f=l*(l>0?n:t);return{x:u,y:r?-1*f:d,width:c-u,height:f-d}}}$1.Arc=xs;xs.prototype._centroid=!0;xs.prototype.className="Arc";xs.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,E2e._registerNode)(xs);F1.Factory.addGetterSetter(xs,"innerRadius",0,(0,B1.getNumberValidator)());F1.Factory.addGetterSetter(xs,"outerRadius",0,(0,B1.getNumberValidator)());F1.Factory.addGetterSetter(xs,"angle",0,(0,B1.getNumberValidator)());F1.Factory.addGetterSetter(xs,"clockwise",!1,(0,B1.getBooleanValidator)());var j1={},Lp={};Object.defineProperty(Lp,"__esModule",{value:!0});Lp.Line=void 0;const V1=Re,P2e=mn,xB=he,k2e=De;function _x(e,t,n,r,i,o,s){var a=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),u=s*a/(a+l),c=s*l/(a+l),d=n-u*(i-e),f=r-u*(o-t),h=n+c*(i-e),p=r+c*(o-t);return[d,f,h,p]}function nA(e,t){var n=e.length,r=[],i,o;for(i=2;i4){for(a=this.getTensionPoints(),l=a.length,u=o?0:4,o||t.quadraticCurveTo(a[0],a[1],a[2],a[3]);u{let u,c,d;u=l/2,c=0;for(let h=0;h<20;h++)d=u*e.tValues[20][h]+u,c+=e.cValues[20][h]*r(s,a,d);return u*c};e.getCubicArcLength=t;const n=(s,a,l)=>{l===void 0&&(l=1);const u=s[0]-2*s[1]+s[2],c=a[0]-2*a[1]+a[2],d=2*s[1]-2*s[0],f=2*a[1]-2*a[0],h=4*(u*u+c*c),p=4*(u*d+c*f),g=d*d+f*f;if(h===0)return l*Math.sqrt(Math.pow(s[2]-s[0],2)+Math.pow(a[2]-a[0],2));const S=p/(2*h),v=g/h,y=l+S,m=v-S*S,b=y*y+m>0?Math.sqrt(y*y+m):0,_=S*S+m>0?Math.sqrt(S*S+m):0,w=S+Math.sqrt(S*S+m)!==0?m*Math.log(Math.abs((y+b)/(S+_))):0;return Math.sqrt(h)/2*(y*b-S*_+w)};e.getQuadraticArcLength=n;function r(s,a,l){const u=i(1,l,s),c=i(1,l,a),d=u*u+c*c;return Math.sqrt(d)}const i=(s,a,l)=>{const u=l.length-1;let c,d;if(u===0)return 0;if(s===0){d=0;for(let f=0;f<=u;f++)d+=e.binomialCoefficients[u][f]*Math.pow(1-a,u-f)*Math.pow(a,f)*l[f];return d}else{c=new Array(u);for(let f=0;f{let u=1,c=s/a,d=(s-l(c))/a,f=0;for(;u>.001;){const h=l(c+d),p=Math.abs(s-h)/a;if(p500)break}return c};e.t2length=o})(CB);Object.defineProperty(sd,"__esModule",{value:!0});sd.Path=void 0;const A2e=Re,O2e=mn,R2e=De,yu=CB;class ln extends O2e.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=ln.parsePathData(this.data()),this.pathLength=ln.getPathLength(this.dataArray)}_sceneFunc(t){var n=this.dataArray;t.beginPath();for(var r=!1,i=0;ic?u:c,S=u>c?1:u/c,v=u>c?c/u:1;t.translate(a,l),t.rotate(h),t.scale(S,v),t.arc(0,0,g,d,d+f,1-p),t.scale(1/S,1/v),t.rotate(-h),t.translate(-a,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(u){if(u.command==="A"){var c=u.points[4],d=u.points[5],f=u.points[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;p-=h){const g=ln.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],p,0);t.push(g.x,g.y)}else for(let p=c+h;pn[i].pathLength;)t-=n[i].pathLength,++i;if(i===o)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return r=n[i].points.slice(0,2),{x:r[0],y:r[1]};var s=n[i],a=s.points;switch(s.command){case"L":return ln.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return ln.getPointOnCubicBezier((0,yu.t2length)(t,ln.getPathLength(n),g=>(0,yu.getCubicArcLength)([s.start.x,a[0],a[2],a[4]],[s.start.y,a[1],a[3],a[5]],g)),s.start.x,s.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return ln.getPointOnQuadraticBezier((0,yu.t2length)(t,ln.getPathLength(n),g=>(0,yu.getQuadraticArcLength)([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],g)),s.start.x,s.start.y,a[0],a[1],a[2],a[3]);case"A":var l=a[0],u=a[1],c=a[2],d=a[3],f=a[4],h=a[5],p=a[6];return f+=h*t/s.pathLength,ln.getPointOnEllipticalArc(l,u,c,d,f,p)}return null}static getPointOnLine(t,n,r,i,o,s,a){s===void 0&&(s=n),a===void 0&&(a=r);var l=(o-r)/(i-n+1e-8),u=Math.sqrt(t*t/(1+l*l));i0&&!isNaN(p[0]);){var y=null,m=[],b=l,_=u,w,x,C,k,P,A,$,N,T,O;switch(h){case"l":l+=p.shift(),u+=p.shift(),y="L",m.push(l,u);break;case"L":l=p.shift(),u=p.shift(),m.push(l,u);break;case"m":var I=p.shift(),M=p.shift();if(l+=I,u+=M,y="M",s.length>2&&s[s.length-1].command==="z"){for(var R=s.length-2;R>=0;R--)if(s[R].command==="M"){l=s[R].points[0]+I,u=s[R].points[1]+M;break}}m.push(l,u),h="l";break;case"M":l=p.shift(),u=p.shift(),y="M",m.push(l,u),h="L";break;case"h":l+=p.shift(),y="L",m.push(l,u);break;case"H":l=p.shift(),y="L",m.push(l,u);break;case"v":u+=p.shift(),y="L",m.push(l,u);break;case"V":u=p.shift(),y="L",m.push(l,u);break;case"C":m.push(p.shift(),p.shift(),p.shift(),p.shift()),l=p.shift(),u=p.shift(),m.push(l,u);break;case"c":m.push(l+p.shift(),u+p.shift(),l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="C",m.push(l,u);break;case"S":x=l,C=u,w=s[s.length-1],w.command==="C"&&(x=l+(l-w.points[2]),C=u+(u-w.points[3])),m.push(x,C,p.shift(),p.shift()),l=p.shift(),u=p.shift(),y="C",m.push(l,u);break;case"s":x=l,C=u,w=s[s.length-1],w.command==="C"&&(x=l+(l-w.points[2]),C=u+(u-w.points[3])),m.push(x,C,l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="C",m.push(l,u);break;case"Q":m.push(p.shift(),p.shift()),l=p.shift(),u=p.shift(),m.push(l,u);break;case"q":m.push(l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="Q",m.push(l,u);break;case"T":x=l,C=u,w=s[s.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),C=u+(u-w.points[1])),l=p.shift(),u=p.shift(),y="Q",m.push(x,C,l,u);break;case"t":x=l,C=u,w=s[s.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),C=u+(u-w.points[1])),l+=p.shift(),u+=p.shift(),y="Q",m.push(x,C,l,u);break;case"A":k=p.shift(),P=p.shift(),A=p.shift(),$=p.shift(),N=p.shift(),T=l,O=u,l=p.shift(),u=p.shift(),y="A",m=this.convertEndpointToCenterParameterization(T,O,l,u,$,N,k,P,A);break;case"a":k=p.shift(),P=p.shift(),A=p.shift(),$=p.shift(),N=p.shift(),T=l,O=u,l+=p.shift(),u+=p.shift(),y="A",m=this.convertEndpointToCenterParameterization(T,O,l,u,$,N,k,P,A);break}s.push({command:y||h,points:m,start:{x:b,y:_},pathLength:this.calcLength(b,_,y||h,m)})}(h==="z"||h==="Z")&&s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(t,n,r,i){var o,s,a,l,u=ln;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":return(0,yu.getCubicArcLength)([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,yu.getQuadraticArcLength)([t,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;var c=i[4],d=i[5],f=i[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;l-=h)a=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=c+h;l1&&(a*=Math.sqrt(h),l*=Math.sqrt(h));var p=Math.sqrt((a*a*(l*l)-a*a*(f*f)-l*l*(d*d))/(a*a*(f*f)+l*l*(d*d)));o===s&&(p*=-1),isNaN(p)&&(p=0);var g=p*a*f/l,S=p*-l*d/a,v=(t+r)/2+Math.cos(c)*g-Math.sin(c)*S,y=(n+i)/2+Math.sin(c)*g+Math.cos(c)*S,m=function(P){return Math.sqrt(P[0]*P[0]+P[1]*P[1])},b=function(P,A){return(P[0]*A[0]+P[1]*A[1])/(m(P)*m(A))},_=function(P,A){return(P[0]*A[1]=1&&(k=0),s===0&&k>0&&(k=k-2*Math.PI),s===1&&k<0&&(k=k+2*Math.PI),[v,y,a,l,w,k,c,s]}}sd.Path=ln;ln.prototype.className="Path";ln.prototype._attrsAffectingSize=["data"];(0,R2e._registerNode)(ln);A2e.Factory.addGetterSetter(ln,"data");Object.defineProperty(j1,"__esModule",{value:!0});j1.Arrow=void 0;const z1=Re,I2e=Lp,TB=he,M2e=De,rA=sd;class Wl extends I2e.Line{_sceneFunc(t){super._sceneFunc(t);var n=Math.PI*2,r=this.points(),i=r,o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());var s=this.pointerLength(),a=r.length,l,u;if(o){const f=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[a-2],r[a-1]],h=rA.Path.calcLength(i[i.length-4],i[i.length-3],"C",f),p=rA.Path.getPointOnQuadraticBezier(Math.min(1,1-s/h),f[0],f[1],f[2],f[3],f[4],f[5]);l=r[a-2]-p.x,u=r[a-1]-p.y}else l=r[a-2]-r[a-4],u=r[a-1]-r[a-3];var c=(Math.atan2(u,l)+n)%n,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[a-2],r[a-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-s,d/2),t.lineTo(-s,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(r[0],r[1]),o?(l=(i[0]+i[2])/2-r[0],u=(i[1]+i[3])/2-r[1]):(l=r[2]-r[0],u=r[3]-r[1]),t.rotate((Math.atan2(-u,-l)+n)%n),t.moveTo(0,0),t.lineTo(-s,d/2),t.lineTo(-s,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),n=this.pointerWidth()/2;return{x:t.x-n,y:t.y-n,width:t.width+n*2,height:t.height+n*2}}}j1.Arrow=Wl;Wl.prototype.className="Arrow";(0,M2e._registerNode)(Wl);z1.Factory.addGetterSetter(Wl,"pointerLength",10,(0,TB.getNumberValidator)());z1.Factory.addGetterSetter(Wl,"pointerWidth",10,(0,TB.getNumberValidator)());z1.Factory.addGetterSetter(Wl,"pointerAtBeginning",!1);z1.Factory.addGetterSetter(Wl,"pointerAtEnding",!0);var U1={};Object.defineProperty(U1,"__esModule",{value:!0});U1.Circle=void 0;const N2e=Re,D2e=mn,L2e=he,$2e=De;class ad extends D2e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}}U1.Circle=ad;ad.prototype._centroid=!0;ad.prototype.className="Circle";ad.prototype._attrsAffectingSize=["radius"];(0,$2e._registerNode)(ad);N2e.Factory.addGetterSetter(ad,"radius",0,(0,L2e.getNumberValidator)());var G1={};Object.defineProperty(G1,"__esModule",{value:!0});G1.Ellipse=void 0;const Y3=Re,F2e=mn,EB=he,B2e=De;class Da extends F2e.Shape{_sceneFunc(t){var n=this.radiusX(),r=this.radiusY();t.beginPath(),t.save(),n!==r&&t.scale(1,r/n),t.arc(0,0,n,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}G1.Ellipse=Da;Da.prototype.className="Ellipse";Da.prototype._centroid=!0;Da.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,B2e._registerNode)(Da);Y3.Factory.addComponentsGetterSetter(Da,"radius",["x","y"]);Y3.Factory.addGetterSetter(Da,"radiusX",0,(0,EB.getNumberValidator)());Y3.Factory.addGetterSetter(Da,"radiusY",0,(0,EB.getNumberValidator)());var H1={};Object.defineProperty(H1,"__esModule",{value:!0});H1.Image=void 0;const M_=Ft,Kl=Re,j2e=mn,V2e=De,$p=he;let Mo=class PB extends j2e.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),o=this.attrs.image;let s;if(o){const a=this.attrs.cropWidth,l=this.attrs.cropHeight;a&&l?s=[o,this.cropX(),this.cropY(),a,l,0,0,n,r]:s=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(t.beginPath(),i?M_.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),o&&(i&&t.clip(),t.drawImage.apply(t,s))}_hitFunc(t){var n=this.width(),r=this.height(),i=this.cornerRadius();t.beginPath(),i?M_.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n;return(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var t,n;return(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(t,n,r=null){var i=M_.Util.createImageElement();i.onload=function(){var o=new PB({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};H1.Image=Mo;Mo.prototype.className="Image";(0,V2e._registerNode)(Mo);Kl.Factory.addGetterSetter(Mo,"cornerRadius",0,(0,$p.getNumberOrArrayOfNumbersValidator)(4));Kl.Factory.addGetterSetter(Mo,"image");Kl.Factory.addComponentsGetterSetter(Mo,"crop",["x","y","width","height"]);Kl.Factory.addGetterSetter(Mo,"cropX",0,(0,$p.getNumberValidator)());Kl.Factory.addGetterSetter(Mo,"cropY",0,(0,$p.getNumberValidator)());Kl.Factory.addGetterSetter(Mo,"cropWidth",0,(0,$p.getNumberValidator)());Kl.Factory.addGetterSetter(Mo,"cropHeight",0,(0,$p.getNumberValidator)());var zc={};Object.defineProperty(zc,"__esModule",{value:!0});zc.Tag=zc.Label=void 0;const q1=Re,z2e=mn,U2e=id,X3=he,kB=De;var AB=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],G2e="Change.konva",H2e="none",wx="up",xx="right",Cx="down",Tx="left",q2e=AB.length;class Q3 extends U2e.Group{constructor(t){super(t),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,s.x),r=Math.max(r,s.x),i=Math.min(i,s.y),o=Math.max(o,s.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}K1.RegularPolygon=Xl;Xl.prototype.className="RegularPolygon";Xl.prototype._centroid=!0;Xl.prototype._attrsAffectingSize=["radius"];(0,J2e._registerNode)(Xl);OB.Factory.addGetterSetter(Xl,"radius",0,(0,RB.getNumberValidator)());OB.Factory.addGetterSetter(Xl,"sides",0,(0,RB.getNumberValidator)());var Y1={};Object.defineProperty(Y1,"__esModule",{value:!0});Y1.Ring=void 0;const IB=Re,ewe=mn,MB=he,twe=De;var iA=Math.PI*2;class Ql extends ewe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,iA,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),iA,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}Y1.Ring=Ql;Ql.prototype.className="Ring";Ql.prototype._centroid=!0;Ql.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,twe._registerNode)(Ql);IB.Factory.addGetterSetter(Ql,"innerRadius",0,(0,MB.getNumberValidator)());IB.Factory.addGetterSetter(Ql,"outerRadius",0,(0,MB.getNumberValidator)());var X1={};Object.defineProperty(X1,"__esModule",{value:!0});X1.Sprite=void 0;const Zl=Re,nwe=mn,rwe=od,NB=he,iwe=De;class No extends nwe.Shape{constructor(t){super(t),this._updated=!0,this.anim=new rwe.Animation(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],s=this.frameOffsets(),a=o[i+0],l=o[i+1],u=o[i+2],c=o[i+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,u,c),t.closePath(),t.fillStrokeShape(this)),d)if(s){var f=s[n],h=r*2;t.drawImage(d,a,l,u,c,f[h+0],f[h+1],u,c)}else t.drawImage(d,a,l,u,c,0,0,u,c)}_hitFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],s=this.frameOffsets(),a=o[i+2],l=o[i+3];if(t.beginPath(),s){var u=s[n],c=r*2;t.rect(u[c+0],u[c+1],a,l)}else t.rect(0,0,a,l);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],o=i.length/4;t{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var zg;function D_(){return zg||(zg=Ex.Util.createCanvasElement().getContext(dwe),zg)}function wwe(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function xwe(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function Cwe(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}class Yt extends awe.Shape{constructor(t){super(Cwe(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(v+=s)}}}_hitFunc(t){var n=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var n=Ex.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(fwe,n),this}getWidth(){var t=this.attrs.width===vu||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===vu||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Ex.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var n=D_(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(t),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+Vg+this.fontVariant()+Vg+(this.fontSize()+mwe)+_we(this.fontFamily())}_addTextLine(t){this.align()===$d&&(t=t.trim());var r=this._getTextWidth(t);return this.textArr.push({text:t,width:r,lastInParagraph:!1})}_getTextWidth(t){var n=this.letterSpacing(),r=t.length;return D_().measureText(t).width+(r?n*(r-1):0)}_setTextData(){var t=this.text().split(` -`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,s=this.attrs.height,a=o!==vu&&o!==void 0,l=s!==vu&&s!==void 0,u=this.padding(),c=o-u*2,d=s-u*2,f=0,h=this.wrap(),p=h!==aA,g=h!==bwe&&p,S=this.ellipsis();this.textArr=[],D_().font=this._getContextFont();for(var v=S?this._getTextWidth(N_):0,y=0,m=t.length;yc)for(;b.length>0;){for(var w=0,x=b.length,C="",k=0;w>>1,A=b.slice(0,P+1),$=this._getTextWidth(A)+v;$<=c?(w=P+1,C=A,k=$):x=P}if(C){if(g){var N,T=b[C.length],O=T===Vg||T===oA;O&&k<=c?N=C.length:N=Math.max(C.lastIndexOf(Vg),C.lastIndexOf(oA))+1,N>0&&(w=N,C=C.slice(0,w),k=this._getTextWidth(C))}C=C.trimRight(),this._addTextLine(C),r=Math.max(r,k),f+=i;var I=this._shouldHandleEllipsis(f);if(I){this._tryToAddEllipsisToLastLine();break}if(b=b.slice(w),b=b.trimLeft(),b.length>0&&(_=this._getTextWidth(b),_<=c)){this._addTextLine(b),f+=i,r=Math.max(r,_);break}}else break}else this._addTextLine(b),f+=i,r=Math.max(r,_),this._shouldHandleEllipsis(f)&&yd)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==vu&&i!==void 0,s=this.padding(),a=i-s*2,l=this.wrap(),u=l!==aA;return!u||o&&t+r>a}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==vu&&t!==void 0,r=this.padding(),i=t-r*2,o=this.ellipsis(),s=this.textArr[this.textArr.length-1];if(!(!s||!o)){if(n){var a=this._getTextWidth(s.text+N_)n?null:Fd.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=Fd.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var n=this.textDecoration(),r=this.fill(),i=this.fontSize(),o=this.glyphInfo;n==="underline"&&t.beginPath();for(var s=0;s=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;ie+`.${UB}`).join(" "),cA="nodesRect",Iwe=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],Mwe={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const Nwe="ontouchstart"in xi.Konva._global;function Dwe(e,t){if(e==="rotater")return"crosshair";t+=st.Util.degToRad(Mwe[e]||0);var n=(st.Util.radToDeg(t)%360+360)%360;return st.Util._inRange(n,315+22.5,360)||st.Util._inRange(n,0,22.5)?"ns-resize":st.Util._inRange(n,45-22.5,45+22.5)?"nesw-resize":st.Util._inRange(n,90-22.5,90+22.5)?"ew-resize":st.Util._inRange(n,135-22.5,135+22.5)?"nwse-resize":st.Util._inRange(n,180-22.5,180+22.5)?"ns-resize":st.Util._inRange(n,225-22.5,225+22.5)?"nesw-resize":st.Util._inRange(n,270-22.5,270+22.5)?"ew-resize":st.Util._inRange(n,315-22.5,315+22.5)?"nwse-resize":(st.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var m0=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],dA=1e8;function Lwe(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function GB(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:i})}function $we(e,t){const n=Lwe(e);return GB(e,t,n)}function Fwe(e,t,n){let r=t;for(let i=0;ii.isAncestorOf(this)?(st.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=n,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},s=i._attrsAffectingSize.map(a=>a+"Change."+this._getEventNamespace()).join(" ");i.on(s,o),i.on(Iwe.map(a=>a+`.${this._getEventNamespace()}`).join(" "),o),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(i)}),this._resetTransformCache();var r=!!this.findOne(".top-left");return r&&this.update(),this}_proxyDrag(t){let n;t.on(`dragstart.${this._getEventNamespace()}`,r=>{n=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(r,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=t.getAbsolutePosition(),o=i.x-n.x,s=i.y-n.y;this.nodes().forEach(a=>{if(a===t||a.isDragging())return;const l=a.getAbsolutePosition();a.setAbsolutePosition({x:l.x+o,y:l.y+s}),a.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(cA),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(cA,this.__getNodeRect)}__getNodeShape(t,n=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=t.getAbsoluteScale(r),s=t.getAbsolutePosition(r),a=i.x*o.x-t.offsetX()*o.x,l=i.y*o.y-t.offsetY()*o.y;const u=(xi.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:s.x+a*Math.cos(u)+l*Math.sin(-u),y:s.y+l*Math.cos(u)+a*Math.sin(u),width:i.width*o.x,height:i.height*o.y,rotation:u};return GB(c,-xi.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-dA,y:-dA,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const c=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=u.getAbsoluteTransform();d.forEach(function(h){var p=f.point(h);n.push(p)})});const r=new st.Transform;r.rotate(-xi.Konva.getAngle(this.rotation()));var i,o,s,a;n.forEach(function(u){var c=r.point(u);i===void 0&&(i=s=c.x,o=a=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:s-i,height:a-o,rotation:xi.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),m0.forEach((function(t){this._createAnchor(t)}).bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new Awe.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:Nwe?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{var i=xi.Konva.getAngle(this.rotation()),o=Dwe(t,i);n.getStage().content&&(n.getStage().content.style.cursor=o),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var t=new kwe.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n){var r=this.getParent(),i=r.padding();n.beginPath(),n.rect(-i,-i,this.width()+i*2,this.height()+i*2),n.moveTo(this.width()/2,-i),r.rotateEnabled()&&n.lineTo(this.width()/2,-r.rotateAnchorOffset()*st.Util._sign(this.height())-i),n.fillStrokeShape(this)},hitFunc:(n,r)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",n=>{n.cancelBubble=!0}),t.on("dragmove",n=>{n.cancelBubble=!0}),t.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var s=t.target.getAbsolutePosition(),a=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-s.x,y:a.y-s.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var n,r,i,o=this.findOne("."+this._movingAnchorName),s=o.getStage();s.setPointersPositions(t);const a=s.getPointerPosition();let l={x:a.x-this._anchorDragOffset.x,y:a.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(u,l,t)),o.setAbsolutePosition(l);const c=o.getAbsolutePosition();if(!(u.x===c.x&&u.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();n=o.x()-d.width/2,r=-o.y()+d.height/2;let N=Math.atan2(-r,n)+Math.PI/2;d.height<0&&(N-=Math.PI);var f=xi.Konva.getAngle(this.rotation());const T=f+N,O=xi.Konva.getAngle(this.rotationSnapTolerance()),M=Fwe(this.rotationSnaps(),T,O)-d.rotation,R=$we(d,M);this._fitNodesInto(R,t);return}var h=this.shiftBehavior(),p;h==="inverted"?p=this.keepRatio()&&!t.shiftKey:h==="none"?p=this.keepRatio():p=this.keepRatio()||t.shiftKey;var m=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(p){var g=m?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(g.x-o.x(),2)+Math.pow(g.y-o.y(),2));var S=this.findOne(".top-left").x()>g.x?-1:1,v=this.findOne(".top-left").y()>g.y?-1:1;n=i*this.cos*S,r=i*this.sin*v,this.findOne(".top-left").x(g.x-n),this.findOne(".top-left").y(g.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(p){var g=m?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(o.x()-g.x,2)+Math.pow(g.y-o.y(),2));var S=this.findOne(".top-right").x()g.y?-1:1;n=i*this.cos*S,r=i*this.sin*v,this.findOne(".top-right").x(g.x+n),this.findOne(".top-right").y(g.y-r)}var y=o.position();this.findOne(".top-left").y(y.y),this.findOne(".bottom-right").x(y.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(p){var g=m?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(g.x-o.x(),2)+Math.pow(o.y()-g.y,2));var S=g.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(st.Util._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(st.Util._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var s=new st.Transform;if(s.rotate(xi.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=s.point({x:-this.padding()*2,y:0});if(t.x+=d.x,t.y+=d.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,!o){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=s.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.width+=this.padding()*2,!o){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=s.point({x:0,y:-this.padding()*2});if(t.x+=d.x,t.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=s.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(r,t);d?t=d:st.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const a=1e7,l=new st.Transform;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/a,r.height/a);const u=new st.Transform;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/a,t.height/a);const c=u.multiply(l.invert());this._nodes.forEach(d=>{var f;const h=d.getParent().getAbsoluteTransform(),p=d.getTransform().copy();p.translate(d.offsetX(),d.offsetY());const g=new st.Transform;g.multiply(h.copy().invert()).multiply(c).multiply(h).multiply(p);const S=g.decompose();d.setAttrs(S),this._fire("transform",{evt:n,target:d}),d._fire("transform",{evt:n,target:d}),(f=d.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(st.Util._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,n){this.findOne(t).setAttrs(n)}update(){var t,n=this._getNodeRect();this.rotation(st.Util._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),s=this.resizeEnabled(),a=this.padding(),l=this.anchorSize();const u=this.find("._anchor");u.forEach(d=>{d.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+a,offsetY:l/2+a,visible:s&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+a,visible:s&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-a,offsetY:l/2+a,visible:s&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+a,visible:s&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-a,visible:s&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+a,offsetY:l/2-a,visible:s&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-a,visible:s&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-a,offsetY:l/2-a,visible:s&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*st.Util._sign(i)-a,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&u.forEach(d=>{c(d)}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),uA.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return lA.Node.prototype.toObject.call(this)}clone(t){var n=lA.Node.prototype.clone.call(this,t);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}J1.Transformer=Ze;function Bwe(e){return e instanceof Array||st.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){m0.indexOf(t)===-1&&st.Util.warn("Unknown anchor name: "+t+". Available names are: "+m0.join(", "))}),e||[]}Ze.prototype.className="Transformer";(0,Owe._registerNode)(Ze);ot.Factory.addGetterSetter(Ze,"enabledAnchors",m0,Bwe);ot.Factory.addGetterSetter(Ze,"flipEnabled",!0,(0,Fa.getBooleanValidator)());ot.Factory.addGetterSetter(Ze,"resizeEnabled",!0);ot.Factory.addGetterSetter(Ze,"anchorSize",10,(0,Fa.getNumberValidator)());ot.Factory.addGetterSetter(Ze,"rotateEnabled",!0);ot.Factory.addGetterSetter(Ze,"rotationSnaps",[]);ot.Factory.addGetterSetter(Ze,"rotateAnchorOffset",50,(0,Fa.getNumberValidator)());ot.Factory.addGetterSetter(Ze,"rotationSnapTolerance",5,(0,Fa.getNumberValidator)());ot.Factory.addGetterSetter(Ze,"borderEnabled",!0);ot.Factory.addGetterSetter(Ze,"anchorStroke","rgb(0, 161, 255)");ot.Factory.addGetterSetter(Ze,"anchorStrokeWidth",1,(0,Fa.getNumberValidator)());ot.Factory.addGetterSetter(Ze,"anchorFill","white");ot.Factory.addGetterSetter(Ze,"anchorCornerRadius",0,(0,Fa.getNumberValidator)());ot.Factory.addGetterSetter(Ze,"borderStroke","rgb(0, 161, 255)");ot.Factory.addGetterSetter(Ze,"borderStrokeWidth",1,(0,Fa.getNumberValidator)());ot.Factory.addGetterSetter(Ze,"borderDash");ot.Factory.addGetterSetter(Ze,"keepRatio",!0);ot.Factory.addGetterSetter(Ze,"shiftBehavior","default");ot.Factory.addGetterSetter(Ze,"centeredScaling",!1);ot.Factory.addGetterSetter(Ze,"ignoreStroke",!1);ot.Factory.addGetterSetter(Ze,"padding",0,(0,Fa.getNumberValidator)());ot.Factory.addGetterSetter(Ze,"node");ot.Factory.addGetterSetter(Ze,"nodes");ot.Factory.addGetterSetter(Ze,"boundBoxFunc");ot.Factory.addGetterSetter(Ze,"anchorDragBoundFunc");ot.Factory.addGetterSetter(Ze,"anchorStyleFunc");ot.Factory.addGetterSetter(Ze,"shouldOverdrawWholeArea",!1);ot.Factory.addGetterSetter(Ze,"useSingleNodeRotation",!0);ot.Factory.backCompat(Ze,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var eb={};Object.defineProperty(eb,"__esModule",{value:!0});eb.Wedge=void 0;const tb=Re,jwe=mn,Vwe=De,HB=he,zwe=De;class Cs extends jwe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,Vwe.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}eb.Wedge=Cs;Cs.prototype.className="Wedge";Cs.prototype._centroid=!0;Cs.prototype._attrsAffectingSize=["radius"];(0,zwe._registerNode)(Cs);tb.Factory.addGetterSetter(Cs,"radius",0,(0,HB.getNumberValidator)());tb.Factory.addGetterSetter(Cs,"angle",0,(0,HB.getNumberValidator)());tb.Factory.addGetterSetter(Cs,"clockwise",!1);tb.Factory.backCompat(Cs,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var nb={};Object.defineProperty(nb,"__esModule",{value:!0});nb.Blur=void 0;const fA=Re,Uwe=kt,Gwe=he;function hA(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var Hwe=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],qwe=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Wwe(e,t){var n=e.data,r=e.width,i=e.height,o,s,a,l,u,c,d,f,h,p,g,S,v,y,m,b,_,w,x,C,k,P,A,$,N=t+t+1,T=r-1,O=i-1,I=t+1,M=I*(I+1)/2,R=new hA,D=null,L=R,V=null,z=null,U=Hwe[t],K=qwe[t];for(a=1;a>K,A!==0?(A=255/A,n[c]=(f*U>>K)*A,n[c+1]=(h*U>>K)*A,n[c+2]=(p*U>>K)*A):n[c]=n[c+1]=n[c+2]=0,f-=S,h-=v,p-=y,g-=m,S-=V.r,v-=V.g,y-=V.b,m-=V.a,l=d+((l=o+t+1)>K,A>0?(A=255/A,n[l]=(f*U>>K)*A,n[l+1]=(h*U>>K)*A,n[l+2]=(p*U>>K)*A):n[l]=n[l+1]=n[l+2]=0,f-=S,h-=v,p-=y,g-=m,S-=V.r,v-=V.g,y-=V.b,m-=V.a,l=o+((l=s+I)0&&Wwe(t,n)};nb.Blur=Kwe;fA.Factory.addGetterSetter(Uwe.Node,"blurRadius",0,(0,Gwe.getNumberValidator)(),fA.Factory.afterSetFilter);var rb={};Object.defineProperty(rb,"__esModule",{value:!0});rb.Brighten=void 0;const pA=Re,Ywe=kt,Xwe=he,Qwe=function(e){var t=this.brightness()*255,n=e.data,r=n.length,i;for(i=0;i255?255:i,o=o<0?0:o>255?255:o,s=s<0?0:s>255?255:s,n[a]=i,n[a+1]=o,n[a+2]=s};ib.Contrast=exe;gA.Factory.addGetterSetter(Zwe.Node,"contrast",0,(0,Jwe.getNumberValidator)(),gA.Factory.afterSetFilter);var ob={};Object.defineProperty(ob,"__esModule",{value:!0});ob.Emboss=void 0;const xa=Re,sb=kt,txe=Ft,qB=he,nxe=function(e){var t=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,s=0,a=e.data,l=e.width,u=e.height,c=l*4,d=u;switch(r){case"top-left":o=-1,s=-1;break;case"top":o=-1,s=0;break;case"top-right":o=-1,s=1;break;case"right":o=0,s=1;break;case"bottom-right":o=1,s=1;break;case"bottom":o=1,s=0;break;case"bottom-left":o=1,s=-1;break;case"left":o=0,s=-1;break;default:txe.Util.error("Unknown emboss direction: "+r)}do{var f=(d-1)*c,h=o;d+h<1&&(h=0),d+h>u&&(h=0);var p=(d-1+h)*l*4,g=l;do{var S=f+(g-1)*4,v=s;g+v<1&&(v=0),g+v>l&&(v=0);var y=p+(g-1+v)*4,m=a[S]-a[y],b=a[S+1]-a[y+1],_=a[S+2]-a[y+2],w=m,x=w>0?w:-w,C=b>0?b:-b,k=_>0?_:-_;if(C>x&&(w=b),k>x&&(w=_),w*=t,i){var P=a[S]+w,A=a[S+1]+w,$=a[S+2]+w;a[S]=P>255?255:P<0?0:P,a[S+1]=A>255?255:A<0?0:A,a[S+2]=$>255?255:$<0?0:$}else{var N=n-w;N<0?N=0:N>255&&(N=255),a[S]=a[S+1]=a[S+2]=N}}while(--g)}while(--d)};ob.Emboss=nxe;xa.Factory.addGetterSetter(sb.Node,"embossStrength",.5,(0,qB.getNumberValidator)(),xa.Factory.afterSetFilter);xa.Factory.addGetterSetter(sb.Node,"embossWhiteLevel",.5,(0,qB.getNumberValidator)(),xa.Factory.afterSetFilter);xa.Factory.addGetterSetter(sb.Node,"embossDirection","top-left",null,xa.Factory.afterSetFilter);xa.Factory.addGetterSetter(sb.Node,"embossBlend",!1,null,xa.Factory.afterSetFilter);var ab={};Object.defineProperty(ab,"__esModule",{value:!0});ab.Enhance=void 0;const mA=Re,rxe=kt,ixe=he;function F_(e,t,n,r,i){var o=n-t,s=i-r,a;return o===0?r+s/2:s===0?r:(a=(e-t)/o,a=s*a+r,a)}const oxe=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,s=t[1],a=s,l,u=t[2],c=u,d,f,h=this.enhance();if(h!==0){for(f=0;fi&&(i=o),l=t[f+1],la&&(a=l),d=t[f+2],dc&&(c=d);i===r&&(i=255,r=0),a===s&&(a=255,s=0),c===u&&(c=255,u=0);var p,g,S,v,y,m,b,_,w;for(h>0?(g=i+h*(255-i),S=r-h*(r-0),y=a+h*(255-a),m=s-h*(s-0),_=c+h*(255-c),w=u-h*(u-0)):(p=(i+r)*.5,g=i+h*(i-p),S=r+h*(r-p),v=(a+s)*.5,y=a+h*(a-v),m=s+h*(s-v),b=(c+u)*.5,_=c+h*(c-b),w=u+h*(u-b)),f=0;fv?S:v;var y=s,m=o,b,_,w=360/m*Math.PI/180,x,C;for(_=0;_m?y:m;var b=s,_=o,w,x,C=n.polarRotation||0,k,P;for(c=0;ct&&(b=m,_=0,w=-1),i=0;i=0&&h=0&&p=0&&h=0&&p=255*4?255:0}return s}function Sxe(e,t,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),s=[],a=0;a=0&&h=0&&p=n))for(o=g;o=r||(s=(n*o+i)*4,a+=b[s+0],l+=b[s+1],u+=b[s+2],c+=b[s+3],m+=1);for(a=a/m,l=l/m,u=u/m,c=c/m,i=h;i=n))for(o=g;o=r||(s=(n*o+i)*4,b[s+0]=a,b[s+1]=l,b[s+2]=u,b[s+3]=c)}};gb.Pixelate=kxe;SA.Factory.addGetterSetter(Exe.Node,"pixelSize",8,(0,Pxe.getNumberValidator)(),SA.Factory.afterSetFilter);var mb={};Object.defineProperty(mb,"__esModule",{value:!0});mb.Posterize=void 0;const _A=Re,Axe=kt,Oxe=he,Rxe=function(e){var t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t,o;for(o=0;o255?255:e<0?0:Math.round(e)});v0.Factory.addGetterSetter(i4.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});v0.Factory.addGetterSetter(i4.Node,"blue",0,Ixe.RGBComponent,v0.Factory.afterSetFilter);var vb={};Object.defineProperty(vb,"__esModule",{value:!0});vb.RGBA=void 0;const Fh=Re,bb=kt,Nxe=he,Dxe=function(e){var t=e.data,n=t.length,r=this.red(),i=this.green(),o=this.blue(),s=this.alpha(),a,l;for(a=0;a255?255:e<0?0:Math.round(e)});Fh.Factory.addGetterSetter(bb.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});Fh.Factory.addGetterSetter(bb.Node,"blue",0,Nxe.RGBComponent,Fh.Factory.afterSetFilter);Fh.Factory.addGetterSetter(bb.Node,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var Sb={};Object.defineProperty(Sb,"__esModule",{value:!0});Sb.Sepia=void 0;const Lxe=function(e){var t=e.data,n=t.length,r,i,o,s;for(r=0;r127&&(u=255-u),c>127&&(c=255-c),d>127&&(d=255-d),t[l]=u,t[l+1]=c,t[l+2]=d}while(--a)}while(--o)};_b.Solarize=$xe;var wb={};Object.defineProperty(wb,"__esModule",{value:!0});wb.Threshold=void 0;const wA=Re,Fxe=kt,Bxe=he,jxe=function(e){var t=this.threshold()*255,n=e.data,r=n.length,i;for(i=0;i{const{width:r,height:i}=t,o=document.createElement("div"),s=new jd.Stage({container:o,width:r,height:i}),a=new jd.Layer,l=new jd.Layer;return a.add(new jd.Rect({...t,fill:n?"black":"white"})),e.forEach(u=>l.add(new jd.Line({points:u.points,stroke:n?"white":"black",strokeWidth:u.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:u.tool==="brush"?"source-over":"destination-out"}))),s.add(a),s.add(l),o.remove(),s},ECe=async(e,t,n)=>new Promise((r,i)=>{const o=document.createElement("canvas");o.width=t,o.height=n;const s=o.getContext("2d"),a=new Image;if(!s){o.remove(),i("Unable to get context");return}a.onload=function(){s.drawImage(a,0,0),o.remove(),r(s.getImageData(0,0,t,n))},a.src=e}),TA=async(e,t)=>{const n=e.toDataURL(t);return await ECe(n,t.width,t.height)},PCe=ve.child({namespace:"getCanvasDataURLs"}),kCe=async e=>{const t=P1(),n=mbe();if(!t||!n){PCe.error("Unable to find canvas / stage");return}const{layerState:{objects:r},boundingBoxCoordinates:i,boundingBoxDimensions:o,isMaskEnabled:s,shouldPreserveMaskedArea:a}=e.canvas,l={...i,...o},u=t.clone();u.scale({x:1,y:1});const c=u.getAbsolutePosition(),d={x:l.x+c.x,y:l.y+c.y,width:l.width,height:l.height},f=await h0(u,d),h=await TA(u,d),p=await TCe(s?r.filter(dL):[],l,a),g=await h0(p,l),S=await TA(p,l);return{baseBlob:f,baseImageData:h,maskBlob:g,maskImageData:S}},ACe=e=>{let t=!0,n=!1;const r=e.length;let i=3;for(i;i{const t=e.length;let n=0;for(n;n{const{isPartiallyTransparent:n,isFullyTransparent:r}=ACe(e.data),i=OCe(t.data);return n?r?"txt2img":"outpaint":i?"inpaint":"img2img"},EA=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=i=>t(r.result),r.onerror=i=>n(r.error),r.onabort=i=>n(new Error("Read aborted")),r.readAsDataURL(e)}),ICe=e=>{const t=window.open("");t&&e.forEach(n=>{const r=new Image;r.src=n.base64,t.document.write(n.caption),t.document.write("
"),t.document.write(r.outerHTML),t.document.write("

")})},B_=ve.child({namespace:"invoke"}),MCe=()=>{fe({predicate:e=>Rp.match(e)&&e.payload==="unifiedCanvas",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=t(),o=await kCe(i);if(!o){B_.error("Unable to create canvas data");return}const{baseBlob:s,baseImageData:a,maskBlob:l,maskImageData:u}=o,c=RCe(a,u);if(i.system.enableImageDebugging){const v=await EA(s),y=await EA(l);ICe([{base64:y,caption:"mask b64"},{base64:v,caption:"image b64"}])}B_.debug(`Generation mode: ${c}`);let d,f;if(["img2img","inpaint","outpaint"].includes(c)){const{requestId:v}=n(Fr({file:new File([s],"canvasInitImage.png",{type:"image/png"}),image_category:"general",is_intermediate:!0})),[{payload:y}]=await r(m=>Fr.fulfilled.match(m)&&m.meta.requestId===v);d=y}if(["inpaint","outpaint"].includes(c)){const{requestId:v}=n(Fr({file:new File([l],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!0})),[{payload:y}]=await r(m=>Fr.fulfilled.match(m)&&m.meta.requestId===v);f=y}const h=T_e(i,c,d,f);B_.debug({graph:h},"Canvas graph built"),n(fB(h));const{requestId:p}=n(zn({graph:h})),[g]=await r(v=>zn.fulfilled.match(v)&&v.meta.requestId===p),S=g.payload.id;["img2img","inpaint"].includes(c)&&d&&n(ro({image_name:d.image_name,session_id:S})),["inpaint"].includes(c)&&f&&n(ro({image_name:f.image_name,session_id:S})),i.canvas.layerState.stagingArea.boundingBox||n(whe({sessionId:S,boundingBox:{...i.canvas.boundingBoxCoordinates,...i.canvas.boundingBoxDimensions}})),n(xhe(S)),n(Ul())}})},PA=ve.child({namespace:"nodes"}),NCe=e=>{const{positivePrompt:t,negativePrompt:n,model:r,cfgScale:i,scheduler:o,steps:s,initialImage:a,img2imgStrength:l,shouldFitToWidthHeight:u,width:c,height:d,clipSkip:f,shouldUseCpuNoise:h,shouldUseNoiseSettings:p}=e.generation;if(!a)throw PA.error("No initial image found in state"),new Error("No initial image found in state");if(!r)throw PA.error("No model found in state"),new Error("No model found in state");const g=p?h:Vl.shouldUseCpuNoise,S=r.model_type.includes("onnx"),v=S?Gl:wa,y={id:p0,nodes:{[v]:{type:v,id:v,model:r},[ft]:{type:"clip_skip",id:ft,skipped_layers:f},[Dt]:{type:S?"prompt_onnx":"compel",id:Dt,prompt:t},[qt]:{type:S?"prompt_onnx":"compel",id:qt,prompt:n},[Mt]:{type:"noise",id:Mt,use_cpu:g},[Bn]:{type:S?"l2i_onnx":"l2i",id:Bn},[en]:{type:S?"l2l_onnx":"l2l",id:en,cfg_scale:i,scheduler:o,steps:s,strength:l},[lr]:{type:S?"i2l_onnx":"i2l",id:lr}},edges:[{source:{node_id:v,field:"unet"},destination:{node_id:en,field:"unet"}},{source:{node_id:v,field:"clip"},destination:{node_id:ft,field:"clip"}},{source:{node_id:ft,field:"clip"},destination:{node_id:Dt,field:"clip"}},{source:{node_id:ft,field:"clip"},destination:{node_id:qt,field:"clip"}},{source:{node_id:en,field:"latents"},destination:{node_id:Bn,field:"latents"}},{source:{node_id:lr,field:"latents"},destination:{node_id:en,field:"latents"}},{source:{node_id:Mt,field:"noise"},destination:{node_id:en,field:"noise"}},{source:{node_id:qt,field:"conditioning"},destination:{node_id:en,field:"negative_conditioning"}},{source:{node_id:Dt,field:"conditioning"},destination:{node_id:en,field:"positive_conditioning"}}]};if(u&&(a.width!==c||a.height!==d)){const m={id:oo,type:"img_resize",image:{image_name:a.imageName},is_intermediate:!0,width:c,height:d};y.nodes[oo]=m,y.edges.push({source:{node_id:oo,field:"image"},destination:{node_id:lr,field:"image"}}),y.edges.push({source:{node_id:oo,field:"width"},destination:{node_id:Mt,field:"width"}}),y.edges.push({source:{node_id:oo,field:"height"},destination:{node_id:Mt,field:"height"}})}else y.nodes[lr].image={image_name:a.imageName},y.edges.push({source:{node_id:lr,field:"width"},destination:{node_id:Mt,field:"width"}}),y.edges.push({source:{node_id:lr,field:"height"},destination:{node_id:Mt,field:"height"}});return y.nodes[fn]={id:fn,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:i,height:d,width:c,positive_prompt:"",negative_prompt:n,model:r,seed:0,steps:s,rand_device:g?"cpu":"cuda",scheduler:o,vae:void 0,controlnets:[],loras:[],clip_skip:f,strength:l,init_image:a.imageName},y.edges.push({source:{node_id:fn,field:"metadata"},destination:{node_id:Bn,field:"metadata"}}),Ip(e,y,en,v),Mp(e,y,v),O1(e,y),A1(e,y,en),y},DCe=ve.child({namespace:"invoke"}),LCe=()=>{fe({predicate:e=>Rp.match(e)&&e.payload==="img2img",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=t(),o=NCe(i);n(dB(o)),DCe.debug({data:o},"Image to Image graph built"),n(zn({graph:o})),await r(zn.fulfilled.match),n(Ul())}})};let Gg;const $Ce=new Uint8Array(16);function FCe(){if(!Gg&&(Gg=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Gg))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Gg($Ce)}const In=[];for(let e=0;e<256;++e)In.push((e+256).toString(16).slice(1));function BCe(e,t=0){return(In[e[t+0]]+In[e[t+1]]+In[e[t+2]]+In[e[t+3]]+"-"+In[e[t+4]]+In[e[t+5]]+"-"+In[e[t+6]]+In[e[t+7]]+"-"+In[e[t+8]]+In[e[t+9]]+"-"+In[e[t+10]]+In[e[t+11]]+In[e[t+12]]+In[e[t+13]]+In[e[t+14]]+In[e[t+15]]).toLowerCase()}const jCe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),kA={randomUUID:jCe};function VCe(e,t,n){if(kA.randomUUID&&!t&&!e)return kA.randomUUID();e=e||{};const r=e.random||(e.rng||FCe)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return BCe(r)}const zCe=e=>{if(e.type==="color"&&e.value){const t=Kn(e.value),{r:n,g:r,b:i,a:o}=e.value,s=Math.max(0,Math.min(o*255,255));return Object.assign(t,{r:n,g:r,b:i,a:s}),t}return e.value},UCe=e=>{const{nodes:t,edges:n}=e.nodes,i=t.filter(a=>a.type!=="progress_image").reduce((a,l,u)=>{const{id:c,data:d}=l,{type:f,inputs:h}=d,p=Ev(h,(S,v,y)=>{const m=zCe(v);return S[y]=m,S},{}),g={type:f,id:c,...p};return Object.assign(a,{[c]:g}),a},{}),o=n.reduce((a,l,u)=>{const{source:c,target:d,sourceHandle:f,targetHandle:h}=l;return a.push({source:{node_id:c,field:f},destination:{node_id:d,field:h}}),a},[]);return o.forEach(a=>{const l=i[a.destination.node_id],u=a.destination.field;i[a.destination.node_id]=p5(l,u)}),{id:VCe(),nodes:i,edges:o}},GCe=ve.child({namespace:"invoke"}),HCe=()=>{fe({predicate:e=>Rp.match(e)&&e.payload==="nodes",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=t(),o=UCe(i);n(hB(o)),GCe.debug({data:o},"Nodes graph built"),n(zn({graph:o})),await r(zn.fulfilled.match),n(Ul())}})},qCe=ve.child({namespace:"nodes"}),WCe=e=>{const{positivePrompt:t,negativePrompt:n,model:r,cfgScale:i,scheduler:o,steps:s,width:a,height:l,clipSkip:u,shouldUseCpuNoise:c,shouldUseNoiseSettings:d}=e.generation,f=d?c:Vl.shouldUseCpuNoise;if(!r)throw qCe.error("No model found in state"),new Error("No model found in state");const h=r.model_type.includes("onnx"),p=h?Gl:wa,g={id:U3,nodes:{[p]:{type:p,id:p,model:r},[ft]:{type:"clip_skip",id:ft,skipped_layers:u},[Dt]:{type:h?"prompt_onnx":"compel",id:Dt,prompt:t},[qt]:{type:h?"prompt_onnx":"compel",id:qt,prompt:n},[Mt]:{type:"noise",id:Mt,width:a,height:l,use_cpu:f},[wn]:{type:h?"t2l_onnx":"t2l",id:wn,cfg_scale:i,scheduler:o,steps:s},[Bn]:{type:h?"l2i_onnx":"l2i",id:Bn}},edges:[{source:{node_id:p,field:"clip"},destination:{node_id:ft,field:"clip"}},{source:{node_id:p,field:"unet"},destination:{node_id:wn,field:"unet"}},{source:{node_id:ft,field:"clip"},destination:{node_id:Dt,field:"clip"}},{source:{node_id:ft,field:"clip"},destination:{node_id:qt,field:"clip"}},{source:{node_id:Dt,field:"conditioning"},destination:{node_id:wn,field:"positive_conditioning"}},{source:{node_id:qt,field:"conditioning"},destination:{node_id:wn,field:"negative_conditioning"}},{source:{node_id:wn,field:"latents"},destination:{node_id:Bn,field:"latents"}},{source:{node_id:Mt,field:"noise"},destination:{node_id:wn,field:"noise"}}]};return g.nodes[fn]={id:fn,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:i,height:l,width:a,positive_prompt:"",negative_prompt:n,model:r,seed:0,steps:s,rand_device:f?"cpu":"cuda",scheduler:o,vae:void 0,controlnets:[],loras:[],clip_skip:u},g.edges.push({source:{node_id:fn,field:"metadata"},destination:{node_id:Bn,field:"metadata"}}),Ip(e,g,wn,p),Mp(e,g,p),O1(e,g),A1(e,g,wn),g},KCe=ve.child({namespace:"invoke"}),YCe=()=>{fe({predicate:e=>Rp.match(e)&&e.payload==="txt2img",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=t(),o=WCe(i);n(cB(o)),KCe.debug({data:o},"Text to Image graph built"),n(zn({graph:o})),await r(zn.fulfilled.match),n(Ul())}})},XCe=ve.child({namespace:"socketio"}),QCe=()=>{fe({actionCreator:e$,effect:(e,{dispatch:t,getState:n})=>{const{model_name:r,model_type:i,submodel:o}=e.payload.data;let s=`${i} model: ${r}`;o&&(s=s.concat(`, submodel: ${o}`)),XCe.debug(e.payload,`Model load started (${s})`),t(zpe(e.payload))}})},ZCe=ve.child({namespace:"socketio"}),JCe=()=>{fe({actionCreator:t$,effect:(e,{dispatch:t,getState:n})=>{const{model_name:r,model_type:i,submodel:o}=e.payload.data;let s=`${i} model: ${r}`;o&&(s=s.concat(`, submodel: ${o}`)),ZCe.debug(e.payload,`Model load completed (${s})`),t(Upe(e.payload))}})},e5e=({image_name:e,esrganModelName:t})=>{const n={id:G8,type:"esrgan",image:{image_name:e},model_name:t,is_intermediate:!1};return{id:"adhoc-esrgan-graph",nodes:{[G8]:n},edges:[]}};ve.child({namespace:"upscale"});const t5e=ge("upscale/upscaleRequested"),n5e=()=>{fe({actionCreator:t5e,effect:async(e,{dispatch:t,getState:n,take:r,unsubscribe:i,subscribe:o})=>{const{image_name:s}=e.payload,{esrganModelName:a}=n().postprocessing,l=e5e({image_name:s,esrganModelName:a});t(zn({graph:l})),await r(zn.fulfilled.match),t(Ul())}})},YB=xI(),fe=YB.startListening;Xbe();Qbe();Kbe();Ybe();nSe();$be();Fbe();Bbe();jbe();cbe();Wbe();Ube();Gbe();Zbe();Jbe();MCe();HCe();YCe();LCe();QSe();Pbe();xbe();Sbe();Tbe();m_e();obe();n_e();i_e();a_e();u_e();c_e();JSe();t_e();f_e();p_e();QCe();JCe();GSe();HSe();qSe();WSe();KSe();YSe();VSe();zSe();USe();BSe();jSe();Mbe();Obe();Dbe();Lbe();Hbe();qbe();ube();MSe();zbe();iSe();lbe();sSe();sbe();n5e();const L8e=["chakra-ui-color-mode","i18nextLng","ROARR_FILTER","ROARR_LOG"],r5e="@@invokeai-",i5e=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"],o5e=["pendingControlImages"],s5e=["selection","entities","ids","isLoading","limit","offset","selectedBoardId","galleryView","total","isInitialized"],a5e=["schema","invocationTemplates"],l5e=[],u5e=[],c5e=["currentIteration","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","totalIterations","totalSteps","isCancelScheduled","progressImage","wereModelsReceived","wasSchemaParsed","isPersisted","isUploading"],d5e=["shouldShowImageDetails"],f5e={canvas:i5e,gallery:s5e,generation:l5e,nodes:a5e,postprocessing:u5e,system:c5e,ui:d5e,controlNet:o5e},h5e=(e,t)=>{const n=p5(e,f5e[t]);return JSON.stringify(n)},p5e={canvas:fL,gallery:TL,generation:Vl,nodes:NF,postprocessing:$F,system:VF,config:T7,ui:DD,hotkeys:gD,controlNet:Zw},g5e=(e,t)=>YQ(JSON.parse(e),p5e[t]),m5e=e=>{if(E_e(e)&&e.payload.nodes){const t={};return{...e,payload:{...e.payload,nodes:t}}}return Dh.fulfilled.match(e)?{...e,payload:""}:j3.match(e)?{...e,payload:""}:e},y5e=["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine","socket/socketGeneratorProgress","socket/appSocketGeneratorProgress","hotkeys/shiftKeyPressed","@@REMEMBER_PERSISTED"],v5e=e=>e,b5e={canvas:Che,gallery:kpe,generation:Gce,nodes:R1e,postprocessing:M1e,system:nbe,config:zZ,ui:Kce,hotkeys:cue,controlNet:Wpe,boards:Zpe,dynamicPrompts:Xpe,imageDeletion:tge,lora:ige,modelmanager:ibe,[To.reducerPath]:To.reducer},S5e=Kc(b5e),_5e=oq(S5e),w5e=["canvas","gallery","generation","nodes","postprocessing","system","ui","controlNet","dynamicPrompts","lora","modelmanager"],x5e=rI({reducer:_5e,enhancers:e=>e.concat(sq(window.localStorage,w5e,{persistDebounce:300,serialize:h5e,unserialize:g5e,prefix:r5e})).concat(TI()),middleware:e=>e({immutableCheck:!1,serializableCheck:!1}).concat(To.middleware).concat(FH).prepend(YB.middleware),devTools:{actionSanitizer:m5e,stateSanitizer:v5e,trace:!0,predicate:(e,t)=>!y5e.includes(t.type)}}),$8e=e=>e,C5e=""+new URL("logo-13003d72.png",import.meta.url).href,T5e=()=>j.jsxs(Z5,{position:"relative",width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#151519",children:[j.jsx(Y5,{src:C5e,w:"8rem",h:"8rem"}),j.jsx(zv,{label:"Loading",color:"grey",position:"absolute",size:"sm",width:"24px !important",height:"24px !important",right:"1.5rem",bottom:"1.5rem"})]}),E5e=E.memo(T5e);function Px(e){"@babel/helpers - typeof";return Px=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Px(e)}var XB=[],P5e=XB.forEach,k5e=XB.slice;function kx(e){return P5e.call(k5e.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}function QB(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Px(XMLHttpRequest))==="object"}function A5e(e){return!!e&&typeof e.then=="function"}function O5e(e){return A5e(e)?e:Promise.resolve(e)}function R5e(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ax={exports:{}},Hg={exports:{}},AA;function I5e(){return AA||(AA=1,function(e,t){var n=typeof self<"u"?self:Ne,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(s){var a={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function l(T){return T&&DataView.prototype.isPrototypeOf(T)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(T){return T&&u.indexOf(Object.prototype.toString.call(T))>-1};function d(T){if(typeof T!="string"&&(T=String(T)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(T))throw new TypeError("Invalid character in header field name");return T.toLowerCase()}function f(T){return typeof T!="string"&&(T=String(T)),T}function h(T){var O={next:function(){var I=T.shift();return{done:I===void 0,value:I}}};return a.iterable&&(O[Symbol.iterator]=function(){return O}),O}function p(T){this.map={},T instanceof p?T.forEach(function(O,I){this.append(I,O)},this):Array.isArray(T)?T.forEach(function(O){this.append(O[0],O[1])},this):T&&Object.getOwnPropertyNames(T).forEach(function(O){this.append(O,T[O])},this)}p.prototype.append=function(T,O){T=d(T),O=f(O);var I=this.map[T];this.map[T]=I?I+", "+O:O},p.prototype.delete=function(T){delete this.map[d(T)]},p.prototype.get=function(T){return T=d(T),this.has(T)?this.map[T]:null},p.prototype.has=function(T){return this.map.hasOwnProperty(d(T))},p.prototype.set=function(T,O){this.map[d(T)]=f(O)},p.prototype.forEach=function(T,O){for(var I in this.map)this.map.hasOwnProperty(I)&&T.call(O,this.map[I],I,this)},p.prototype.keys=function(){var T=[];return this.forEach(function(O,I){T.push(I)}),h(T)},p.prototype.values=function(){var T=[];return this.forEach(function(O){T.push(O)}),h(T)},p.prototype.entries=function(){var T=[];return this.forEach(function(O,I){T.push([I,O])}),h(T)},a.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function g(T){if(T.bodyUsed)return Promise.reject(new TypeError("Already read"));T.bodyUsed=!0}function S(T){return new Promise(function(O,I){T.onload=function(){O(T.result)},T.onerror=function(){I(T.error)}})}function v(T){var O=new FileReader,I=S(O);return O.readAsArrayBuffer(T),I}function y(T){var O=new FileReader,I=S(O);return O.readAsText(T),I}function m(T){for(var O=new Uint8Array(T),I=new Array(O.length),M=0;M-1?O:T}function C(T,O){O=O||{};var I=O.body;if(T instanceof C){if(T.bodyUsed)throw new TypeError("Already read");this.url=T.url,this.credentials=T.credentials,O.headers||(this.headers=new p(T.headers)),this.method=T.method,this.mode=T.mode,this.signal=T.signal,!I&&T._bodyInit!=null&&(I=T._bodyInit,T.bodyUsed=!0)}else this.url=String(T);if(this.credentials=O.credentials||this.credentials||"same-origin",(O.headers||!this.headers)&&(this.headers=new p(O.headers)),this.method=x(O.method||this.method||"GET"),this.mode=O.mode||this.mode||null,this.signal=O.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&I)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(I)}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function k(T){var O=new FormData;return T.trim().split("&").forEach(function(I){if(I){var M=I.split("="),R=M.shift().replace(/\+/g," "),D=M.join("=").replace(/\+/g," ");O.append(decodeURIComponent(R),decodeURIComponent(D))}}),O}function P(T){var O=new p,I=T.replace(/\r?\n[\t ]+/g," ");return I.split(/\r?\n/).forEach(function(M){var R=M.split(":"),D=R.shift().trim();if(D){var L=R.join(":").trim();O.append(D,L)}}),O}_.call(C.prototype);function A(T,O){O||(O={}),this.type="default",this.status=O.status===void 0?200:O.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in O?O.statusText:"OK",this.headers=new p(O.headers),this.url=O.url||"",this._initBody(T)}_.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},A.error=function(){var T=new A(null,{status:0,statusText:""});return T.type="error",T};var $=[301,302,303,307,308];A.redirect=function(T,O){if($.indexOf(O)===-1)throw new RangeError("Invalid status code");return new A(null,{status:O,headers:{location:T}})},s.DOMException=o.DOMException;try{new s.DOMException}catch{s.DOMException=function(O,I){this.message=O,this.name=I;var M=Error(O);this.stack=M.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function N(T,O){return new Promise(function(I,M){var R=new C(T,O);if(R.signal&&R.signal.aborted)return M(new s.DOMException("Aborted","AbortError"));var D=new XMLHttpRequest;function L(){D.abort()}D.onload=function(){var V={status:D.status,statusText:D.statusText,headers:P(D.getAllResponseHeaders()||"")};V.url="responseURL"in D?D.responseURL:V.headers.get("X-Request-URL");var z="response"in D?D.response:D.responseText;I(new A(z,V))},D.onerror=function(){M(new TypeError("Network request failed"))},D.ontimeout=function(){M(new TypeError("Network request failed"))},D.onabort=function(){M(new s.DOMException("Aborted","AbortError"))},D.open(R.method,R.url,!0),R.credentials==="include"?D.withCredentials=!0:R.credentials==="omit"&&(D.withCredentials=!1),"responseType"in D&&a.blob&&(D.responseType="blob"),R.headers.forEach(function(V,z){D.setRequestHeader(z,V)}),R.signal&&(R.signal.addEventListener("abort",L),D.onreadystatechange=function(){D.readyState===4&&R.signal.removeEventListener("abort",L)}),D.send(typeof R._bodyInit>"u"?null:R._bodyInit)})}return N.polyfill=!0,o.fetch||(o.fetch=N,o.Headers=p,o.Request=C,o.Response=A),s.Headers=p,s.Request=C,s.Response=A,s.fetch=N,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(Hg,Hg.exports)),Hg.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof Ne<"u"&&Ne.fetch?n=Ne.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof R5e<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||I5e();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(Ax,Ax.exports);var ZB=Ax.exports;const JB=Il(ZB),OA=s9({__proto__:null,default:JB},[ZB]);function b0(e){"@babel/helpers - typeof";return b0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b0(e)}var ss;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?ss=global.fetch:typeof window<"u"&&window.fetch?ss=window.fetch:ss=fetch);var Bh;QB()&&(typeof global<"u"&&global.XMLHttpRequest?Bh=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(Bh=window.XMLHttpRequest));var S0;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?S0=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(S0=window.ActiveXObject));!ss&&OA&&!Bh&&!S0&&(ss=JB||OA);typeof ss!="function"&&(ss=void 0);var Ox=function(t,n){if(n&&b0(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},RA=function(t,n,r){ss(t,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(o){r(null,{status:i.status,data:o})}).catch(r)}).catch(r)},IA=!1,M5e=function(t,n,r,i){t.queryStringParams&&(n=Ox(n,t.queryStringParams));var o=kx({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);r&&(o["Content-Type"]="application/json");var s=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,a=kx({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:o},IA?{}:s);try{RA(n,a,i)}catch(l){if(!s||Object.keys(s).length===0||!l.message||l.message.indexOf("not implemented")<0)return i(l);try{Object.keys(s).forEach(function(u){delete a[u]}),RA(n,a,i),IA=!0}catch(u){i(u)}}},N5e=function(t,n,r,i){r&&b0(r)==="object"&&(r=Ox("",r).slice(1)),t.queryStringParams&&(n=Ox(n,t.queryStringParams));try{var o;Bh?o=new Bh:o=new S0("MSXML2.XMLHTTP.3.0"),o.open(r?"POST":"GET",n,1),t.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!t.withCredentials,r&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");var s=t.customHeaders;if(s=typeof s=="function"?s():s,s)for(var a in s)o.setRequestHeader(a,s[a]);o.onreadystatechange=function(){o.readyState>3&&i(o.status>=400?o.statusText:null,{status:o.status,data:o.responseText})},o.send(r)}catch(l){console&&console.log(l)}},D5e=function(t,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},ss&&n.indexOf("file:")!==0)return M5e(t,n,r,i);if(QB()||typeof ActiveXObject=="function")return N5e(t,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function jh(e){"@babel/helpers - typeof";return jh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jh(e)}function L5e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MA(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};L5e(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return $5e(e,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=kx(i,this.options||{},j5e()),this.allOptions=o,this.services&&this.options.reloadInterval&&setInterval(function(){return r.reload()},this.options.reloadInterval)}},{key:"readMulti",value:function(n,r,i){this._readAny(n,n,r,r,i)}},{key:"read",value:function(n,r,i){this._readAny([n],n,[r],r,i)}},{key:"_readAny",value:function(n,r,i,o,s){var a=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,i)),l=O5e(l),l.then(function(u){if(!u)return s(null,{});var c=a.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});a.loadUrl(c,s,r,o)})}},{key:"loadUrl",value:function(n,r,i,o){var s=this,a=typeof i=="string"?[i]:i,l=typeof o=="string"?[o]:o,u=this.options.parseLoadPayload(a,l);this.options.request(this.options,n,u,function(c,d){if(d&&(d.status>=500&&d.status<600||!d.status))return r("failed loading "+n+"; status code: "+d.status,!0);if(d&&d.status>=400&&d.status<500)return r("failed loading "+n+"; status code: "+d.status,!1);if(!d&&c&&c.message&&c.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+c.message,!0);if(c)return r(c,!1);var f,h;try{typeof d.data=="string"?f=s.options.parse(d.data,i,o):f=d.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{key:"create",value:function(n,r,i,o,s){var a=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var l=this.options.parsePayload(r,i,o),u=0,c=[],d=[];n.forEach(function(f){var h=a.options.addPath;typeof a.options.addPath=="function"&&(h=a.options.addPath(f,r));var p=a.services.interpolator.interpolate(h,{lng:f,ns:r});a.options.request(a.options,p,l,function(g,S){u+=1,c.push(g),d.push(S),u===n.length&&typeof s=="function"&&s(c,d)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,o=r.languageUtils,s=r.logger,a=i.language;if(!(a&&a.toLowerCase()==="cimode")){var l=[],u=function(d){var f=o.toResolveHierarchy(d);f.forEach(function(h){l.indexOf(h)<0&&l.push(h)})};u(a),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){n.allOptions.ns.forEach(function(d){i.read(c,d,"read",null,null,function(f,h){f&&s.warn("loading namespace ".concat(d," for language ").concat(c," failed"),f),!f&&h&&s.log("loaded namespace ".concat(d," for language ").concat(c),h),i.loaded("".concat(c,"|").concat(d),f,h)})})})}}}]),e}();tj.type="backend";er.use(tj).use(wue).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const Eo=Object.create(null);Eo.open="0";Eo.close="1";Eo.ping="2";Eo.pong="3";Eo.message="4";Eo.upgrade="5";Eo.noop="6";const Mm=Object.create(null);Object.keys(Eo).forEach(e=>{Mm[Eo[e]]=e});const V5e={type:"error",data:"parser error"},nj=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",rj=typeof ArrayBuffer=="function",ij=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,o4=({type:e,data:t},n,r)=>nj&&t instanceof Blob?n?r(t):NA(t,r):rj&&(t instanceof ArrayBuffer||ij(t))?n?r(t):NA(new Blob([t]),r):r(Eo[e]+(t||"")),NA=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function DA(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let j_;function z5e(e,t){if(nj&&e.data instanceof Blob)return e.data.arrayBuffer().then(DA).then(t);if(rj&&(e.data instanceof ArrayBuffer||ij(e.data)))return t(DA(e.data));o4(e,!1,n=>{j_||(j_=new TextEncoder),t(j_.encode(n))})}const LA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,o,s,a,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),c=new Uint8Array(u);for(r=0;r>4,c[i++]=(s&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return u},G5e=typeof ArrayBuffer=="function",s4=(e,t)=>{if(typeof e!="string")return{type:"message",data:oj(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:H5e(e.substring(1),t)}:Mm[n]?e.length>1?{type:Mm[n],data:e.substring(1)}:{type:Mm[n]}:V5e},H5e=(e,t)=>{if(G5e){const n=U5e(e);return oj(n,t)}else return{base64:!0,data:e}},oj=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},sj=String.fromCharCode(30),q5e=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,s)=>{o4(o,!1,a=>{r[s]=a,++i===n&&t(r.join(sj))})})},W5e=(e,t)=>{const n=e.split(sj),r=[];for(let i=0;i54;return s4(r?e:V_.decode(e),n)}const aj=4;function on(e){if(e)return Y5e(e)}function Y5e(e){for(var t in on.prototype)e[t]=on.prototype[t];return e}on.prototype.on=on.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};on.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};on.prototype.off=on.prototype.removeListener=on.prototype.removeAllListeners=on.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function lj(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const X5e=si.setTimeout,Q5e=si.clearTimeout;function xb(e,t){t.useNativeTimers?(e.setTimeoutFn=X5e.bind(si),e.clearTimeoutFn=Q5e.bind(si)):(e.setTimeoutFn=si.setTimeout.bind(si),e.clearTimeoutFn=si.clearTimeout.bind(si))}const Z5e=1.33;function J5e(e){return typeof e=="string"?e3e(e):Math.ceil((e.byteLength||e.size)*Z5e)}function e3e(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function t3e(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function n3e(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function cj(){const e=BA(+new Date);return e!==FA?($A=0,FA=e):e+"."+BA($A++)}for(;qg{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};W5e(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,q5e(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=cj()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new fc(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}let fc=class Nm extends on{constructor(t,n){super(),xb(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=lj(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new fj(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=Nm.requestsCount++,Nm.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=s3e,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Nm.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};fc.requestsCount=0;fc.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",jA);else if(typeof addEventListener=="function"){const e="onpagehide"in si?"pagehide":"unload";addEventListener(e,jA,!1)}}function jA(){for(let e in fc.requests)fc.requests.hasOwnProperty(e)&&fc.requests[e].abort()}const l4=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),Wg=si.WebSocket||si.MozWebSocket,VA=!0,u3e="arraybuffer",zA=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class c3e extends a4{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=zA?{}:lj(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=VA&&!zA?n?new Wg(t,n):new Wg(t):new Wg(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType||u3e,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const s={};try{VA&&this.ws.send(o)}catch{}i&&l4(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=cj()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!Wg}}function d3e(e,t){return e.type==="message"&&typeof e.data!="string"&&t[0]>=48&&t[0]<=54}class f3e extends a4{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=t.readable.getReader();this.writer=t.writable.getWriter();let r;const i=()=>{n.read().then(({done:s,value:a})=>{s||(!r&&a.byteLength===1&&a[0]===54?r=!0:(this.onPacket(K5e(a,r,"arraybuffer")),r=!1),i())}).catch(s=>{})};i();const o=this.query.sid?`0{"sid":"${this.query.sid}"}`:"0";this.writer.write(new TextEncoder().encode(o)).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{d3e(r,o)&&this.writer.write(Uint8Array.of(54)),this.writer.write(o).then(()=>{i&&l4(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const h3e={websocket:c3e,webtransport:f3e,polling:l3e},p3e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,g3e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ix(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=p3e.exec(e||""),o={},s=14;for(;s--;)o[g3e[s]]=i[s]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=m3e(o,o.path),o.queryKey=y3e(o,o.query),o}function m3e(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function y3e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let hj=class Tu extends on{constructor(t,n={}){super(),this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=Ix(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=Ix(n.host).host),xb(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=n3e(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=aj,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new h3e[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Tu.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;Tu.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Tu.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function o(){r||(r=!0,c(),n.close(),n=null)}const s=d=>{const f=new Error("probe error: "+d);f.transport=n.name,o(),this.emitReserved("upgradeError",f)};function a(){s("transport closed")}function l(){s("socket closed")}function u(d){n&&d.name!==n.name&&o()}const c=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",a),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",s),n.once("close",a),this.once("close",l),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",Tu.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){Tu.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,pj=Object.prototype.toString,_3e=typeof Blob=="function"||typeof Blob<"u"&&pj.call(Blob)==="[object BlobConstructor]",w3e=typeof File=="function"||typeof File<"u"&&pj.call(File)==="[object FileConstructor]";function u4(e){return b3e&&(e instanceof ArrayBuffer||S3e(e))||_3e&&e instanceof Blob||w3e&&e instanceof File}function Dm(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let s=0;s{this.io.clearTimeoutFn(o),n.apply(this,[null,...s])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,o)=>{n.push((s,a)=>r?s?o(s):i(a):i(s)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ge.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ge.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ge.EVENT:case Ge.BINARY_EVENT:this.onevent(t);break;case Ge.ACK:case Ge.BINARY_ACK:this.onack(t);break;case Ge.DISCONNECT:this.ondisconnect();break;case Ge.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Ge.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ge.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}ld.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};ld.prototype.reset=function(){this.attempts=0};ld.prototype.setMin=function(e){this.ms=e};ld.prototype.setMax=function(e){this.max=e};ld.prototype.setJitter=function(e){this.jitter=e};class Dx extends on{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,xb(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new ld({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||A3e;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new hj(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Ei(n,"open",function(){r.onopen(),t&&t()}),o=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},s=Ei(n,"error",o);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ei(t,"ping",this.onping.bind(this)),Ei(t,"data",this.ondata.bind(this)),Ei(t,"error",this.onerror.bind(this)),Ei(t,"close",this.onclose.bind(this)),Ei(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){l4(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new gj(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Vd={};function Lm(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=v3e(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=Vd[i]&&o in Vd[i].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let l;return a?l=new Dx(r,t):(Vd[i]||(Vd[i]=new Dx(r,t)),l=Vd[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(Lm,{Manager:Dx,Socket:gj,io:Lm,connect:Lm});var R3e=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,I3e=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,M3e=/[^-+\dA-Z]/g;function N3e(e,t,n,r){if(arguments.length===1&&typeof e=="string"&&!/\d/.test(e)&&(t=e,e=void 0),e=e||e===0?e:new Date,e instanceof Date||(e=new Date(e)),isNaN(e))throw TypeError("Invalid date");t=String(GA[t]||t||GA.default);var i=t.slice(0,4);(i==="UTC:"||i==="GMT:")&&(t=t.slice(4),n=!0,i==="GMT:"&&(r=!0));var o=function(){return n?"getUTC":"get"},s=function(){return e[o()+"Date"]()},a=function(){return e[o()+"Day"]()},l=function(){return e[o()+"Month"]()},u=function(){return e[o()+"FullYear"]()},c=function(){return e[o()+"Hours"]()},d=function(){return e[o()+"Minutes"]()},f=function(){return e[o()+"Seconds"]()},h=function(){return e[o()+"Milliseconds"]()},p=function(){return n?0:e.getTimezoneOffset()},g=function(){return D3e(e)},S=function(){return L3e(e)},v={d:function(){return s()},dd:function(){return Nr(s())},ddd:function(){return yr.dayNames[a()]},DDD:function(){return HA({y:u(),m:l(),d:s(),_:o(),dayName:yr.dayNames[a()],short:!0})},dddd:function(){return yr.dayNames[a()+7]},DDDD:function(){return HA({y:u(),m:l(),d:s(),_:o(),dayName:yr.dayNames[a()+7]})},m:function(){return l()+1},mm:function(){return Nr(l()+1)},mmm:function(){return yr.monthNames[l()]},mmmm:function(){return yr.monthNames[l()+12]},yy:function(){return String(u()).slice(2)},yyyy:function(){return Nr(u(),4)},h:function(){return c()%12||12},hh:function(){return Nr(c()%12||12)},H:function(){return c()},HH:function(){return Nr(c())},M:function(){return d()},MM:function(){return Nr(d())},s:function(){return f()},ss:function(){return Nr(f())},l:function(){return Nr(h(),3)},L:function(){return Nr(Math.floor(h()/10))},t:function(){return c()<12?yr.timeNames[0]:yr.timeNames[1]},tt:function(){return c()<12?yr.timeNames[2]:yr.timeNames[3]},T:function(){return c()<12?yr.timeNames[4]:yr.timeNames[5]},TT:function(){return c()<12?yr.timeNames[6]:yr.timeNames[7]},Z:function(){return r?"GMT":n?"UTC":$3e(e)},o:function(){return(p()>0?"-":"+")+Nr(Math.floor(Math.abs(p())/60)*100+Math.abs(p())%60,4)},p:function(){return(p()>0?"-":"+")+Nr(Math.floor(Math.abs(p())/60),2)+":"+Nr(Math.floor(Math.abs(p())%60),2)},S:function(){return["th","st","nd","rd"][s()%10>3?0:(s()%100-s()%10!=10)*s()%10]},W:function(){return g()},WW:function(){return Nr(g())},N:function(){return S()}};return t.replace(R3e,function(y){return y in v?v[y]():y.slice(1,y.length-1)})}var GA={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},yr={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},Nr=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(t).padStart(n,"0")},HA=function(t){var n=t.y,r=t.m,i=t.d,o=t._,s=t.dayName,a=t.short,l=a===void 0?!1:a,u=new Date,c=new Date;c.setDate(c[o+"Date"]()-1);var d=new Date;d.setDate(d[o+"Date"]()+1);var f=function(){return u[o+"Date"]()},h=function(){return u[o+"Month"]()},p=function(){return u[o+"FullYear"]()},g=function(){return c[o+"Date"]()},S=function(){return c[o+"Month"]()},v=function(){return c[o+"FullYear"]()},y=function(){return d[o+"Date"]()},m=function(){return d[o+"Month"]()},b=function(){return d[o+"FullYear"]()};return p()===n&&h()===r&&f()===i?l?"Tdy":"Today":v()===n&&S()===r&&g()===i?l?"Ysd":"Yesterday":b()===n&&m()===r&&y()===i?l?"Tmw":"Tomorrow":s},D3e=function(t){var n=new Date(t.getFullYear(),t.getMonth(),t.getDate());n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=new Date(n.getFullYear(),0,4);r.setDate(r.getDate()-(r.getDay()+6)%7+3);var i=n.getTimezoneOffset()-r.getTimezoneOffset();n.setHours(n.getHours()-i);var o=(n-r)/(864e5*7);return 1+Math.floor(o)},L3e=function(t){var n=t.getDay();return n===0&&(n=7),n},$3e=function(t){return(String(t).match(I3e)||[""]).pop().replace(M3e,"").replace(/GMT\+0000/g,"UTC")};const ti=()=>N3e(new Date,"yyyy-mm-dd'T'HH:MM:ss:lo"),F3e=e=>{const{socket:t,storeApi:n,log:r}=e,{dispatch:i,getState:o}=n;t.on("connect",()=>{r.debug("Connected"),i(BL({timestamp:ti()}));const{sessionId:s}=o().system;s&&(t.emit("subscribe",{session:s}),i(S3({sessionId:s,timestamp:ti(),boardId:o().gallery.selectedBoardId})))}),t.on("connect_error",s=>{s&&s.message&&s.data==="ERR_UNAUTHENTICATED"&&i(Ht(fo({title:s.message,status:"error",duration:1e4})))}),t.on("disconnect",()=>{i(VL({timestamp:ti()}))}),t.on("invocation_started",s=>{i(qL({data:s,timestamp:ti()}))}),t.on("generator_progress",s=>{i(ZL({data:s,timestamp:ti()}))}),t.on("invocation_error",s=>{i(YL({data:s,timestamp:ti()}))}),t.on("invocation_complete",s=>{i(_3({data:s,timestamp:ti()}))}),t.on("graph_execution_state_complete",s=>{i(XL({data:s,timestamp:ti()}))}),t.on("model_load_started",s=>{i(e$({data:s,timestamp:ti()}))}),t.on("model_load_completed",s=>{i(t$({data:s,timestamp:ti()}))})},B3e=ve.child({namespace:"socketio"}),qA=()=>{let e=!1,t=`ws://${window.location.host}`;const n={timeout:6e4,path:"/ws/socket.io",autoConnect:!1};if(["nodes","package"].includes("production")){const o=xh.get();o&&(t=o.replace(/^https?\:\/\//i,""));const s=wh.get();s&&(n.auth={token:s}),n.transports=["websocket","polling"]}const r=Lm(t,n);return o=>s=>a=>{const{dispatch:l,getState:u}=o;if(e||(F3e({storeApi:o,socket:r,log:B3e}),e=!0,r.connect()),zn.fulfilled.match(a)){const c=a.payload.id,d=u().system.sessionId;d&&(r.emit("unsubscribe",{session:d}),l(GL({sessionId:d,timestamp:ti()}))),r.emit("subscribe",{session:c}),l(S3({sessionId:c,timestamp:ti(),boardId:u().gallery.selectedBoardId}))}s(a)}},Cb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ud(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function d4(e){return"nodeType"in e}function gr(e){var t,n;return e?ud(e)?e:d4(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function f4(e){const{Document:t}=gr(e);return e instanceof t}function Bp(e){return ud(e)?!1:e instanceof gr(e).HTMLElement}function j3e(e){return e instanceof gr(e).SVGElement}function cd(e){return e?ud(e)?e.document:d4(e)?f4(e)?e:Bp(e)?e.ownerDocument:document:document:document}const Po=Cb?E.useLayoutEffect:E.useEffect;function Tb(e){const t=E.useRef(e);return Po(()=>{t.current=e}),E.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{e.current=setInterval(r,i)},[]),n=E.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Vh(e,t){t===void 0&&(t=[e]);const n=E.useRef(e);return Po(()=>{n.current!==e&&(n.current=e)},t),n}function jp(e,t){const n=E.useRef();return E.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function _0(e){const t=Tb(e),n=E.useRef(null),r=E.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function w0(e){const t=E.useRef();return E.useEffect(()=>{t.current=e},[e]),t.current}let z_={};function Eb(e,t){return E.useMemo(()=>{if(t)return t;const n=z_[e]==null?0:z_[e]+1;return z_[e]=n,e+"-"+n},[e,t])}function mj(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const a=Object.entries(s);for(const[l,u]of a){const c=o[l];c!=null&&(o[l]=c+e*u)}return o},{...t})}}const hc=mj(1),x0=mj(-1);function z3e(e){return"clientX"in e&&"clientY"in e}function h4(e){if(!e)return!1;const{KeyboardEvent:t}=gr(e.target);return t&&e instanceof t}function U3e(e){if(!e)return!1;const{TouchEvent:t}=gr(e.target);return t&&e instanceof t}function zh(e){if(U3e(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return z3e(e)?{x:e.clientX,y:e.clientY}:null}const Uh=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Uh.Translate.toString(e),Uh.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),WA="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function G3e(e){return e.matches(WA)?e:e.querySelector(WA)}const H3e={display:"none"};function q3e(e){let{id:t,value:n}=e;return Ve.createElement("div",{id:t,style:H3e},n)}const W3e={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};function K3e(e){let{id:t,announcement:n}=e;return Ve.createElement("div",{id:t,style:W3e,role:"status","aria-live":"assertive","aria-atomic":!0},n)}function Y3e(){const[e,t]=E.useState("");return{announce:E.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const yj=E.createContext(null);function X3e(e){const t=E.useContext(yj);E.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function Q3e(){const[e]=E.useState(()=>new Set),t=E.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[E.useCallback(r=>{let{type:i,event:o}=r;e.forEach(s=>{var a;return(a=s[i])==null?void 0:a.call(s,o)})},[e]),t]}const Z3e={draggable:` - To pick up a draggable item, press the space bar. - While dragging, use the arrow keys to move the item. - Press space again to drop the item in its new position, or press escape to cancel. - `},J3e={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function e4e(e){let{announcements:t=J3e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Z3e}=e;const{announce:o,announcement:s}=Y3e(),a=Eb("DndLiveRegion"),[l,u]=E.useState(!1);if(E.useEffect(()=>{u(!0)},[]),X3e(E.useMemo(()=>({onDragStart(d){let{active:f}=d;o(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:h}=d;t.onDragMove&&o(t.onDragMove({active:f,over:h}))},onDragOver(d){let{active:f,over:h}=d;o(t.onDragOver({active:f,over:h}))},onDragEnd(d){let{active:f,over:h}=d;o(t.onDragEnd({active:f,over:h}))},onDragCancel(d){let{active:f,over:h}=d;o(t.onDragCancel({active:f,over:h}))}}),[o,t])),!l)return null;const c=Ve.createElement(Ve.Fragment,null,Ve.createElement(q3e,{id:r,value:i.draggable}),Ve.createElement(K3e,{id:a,announcement:s}));return n?ai.createPortal(c,n):c}var cn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(cn||(cn={}));function C0(){}function KA(e,t){return E.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function t4e(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const Vi=Object.freeze({x:0,y:0});function n4e(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function r4e(e,t){const n=zh(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function i4e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function o4e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function s4e(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function a4e(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function l4e(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=l4e(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(o4e)};function c4e(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const d4e=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:s}=o,a=n.get(s);if(a&&c4e(r,a)){const u=s4e(a).reduce((d,f)=>d+n4e(r,f),0),c=Number((u/4).toFixed(4));i.push({id:s,data:{droppableContainer:o,value:c}})}}return i.sort(i4e)};function f4e(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function vj(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Vi}function h4e(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const p4e=h4e(1);function bj(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function g4e(e,t,n){const r=bj(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),u=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l}}const m4e={ignoreTransform:!1};function Vp(e,t){t===void 0&&(t=m4e);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=gr(e).getComputedStyle(e);u&&(n=g4e(n,u,c))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function YA(e){return Vp(e,{ignoreTransform:!0})}function y4e(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function v4e(e,t){return t===void 0&&(t=gr(e).getComputedStyle(e)),t.position==="fixed"}function b4e(e,t){t===void 0&&(t=gr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function p4(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(f4(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Bp(i)||j3e(i)||n.includes(i))return n;const o=gr(e).getComputedStyle(i);return i!==e&&b4e(i,o)&&n.push(i),v4e(i,o)?n:r(i.parentNode)}return e?r(e):n}function Sj(e){const[t]=p4(e,1);return t??null}function U_(e){return!Cb||!e?null:ud(e)?e:d4(e)?f4(e)||e===cd(e).scrollingElement?window:Bp(e)?e:null:null}function _j(e){return ud(e)?e.scrollX:e.scrollLeft}function wj(e){return ud(e)?e.scrollY:e.scrollTop}function Lx(e){return{x:_j(e),y:wj(e)}}var Cn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Cn||(Cn={}));function xj(e){return!Cb||!e?!1:e===document.scrollingElement}function Cj(e){const t={x:0,y:0},n=xj(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const S4e={x:.2,y:.2};function _4e(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=S4e);const{isTop:u,isBottom:c,isLeft:d,isRight:f}=Cj(e),h={x:0,y:0},p={x:0,y:0},g={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+g.height?(h.y=Cn.Backward,p.y=r*Math.abs((t.top+g.height-o)/g.height)):!c&&l>=t.bottom-g.height&&(h.y=Cn.Forward,p.y=r*Math.abs((t.bottom-g.height-l)/g.height)),!f&&a>=t.right-g.width?(h.x=Cn.Forward,p.x=r*Math.abs((t.right-g.width-a)/g.width)):!d&&s<=t.left+g.width&&(h.x=Cn.Backward,p.x=r*Math.abs((t.left+g.width-s)/g.width)),{direction:h,speed:p}}function w4e(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Tj(e){return e.reduce((t,n)=>hc(t,Lx(n)),Vi)}function x4e(e){return e.reduce((t,n)=>t+_j(n),0)}function C4e(e){return e.reduce((t,n)=>t+wj(n),0)}function Ej(e,t){if(t===void 0&&(t=Vp),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);Sj(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const T4e=[["x",["left","right"],x4e],["y",["top","bottom"],C4e]];class g4{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=p4(n),i=Tj(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of T4e)for(const l of s)Object.defineProperty(this,l,{get:()=>{const u=a(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Sf{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function E4e(e){const{EventTarget:t}=gr(e);return e instanceof t?e:cd(e)}function G_(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var ni;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ni||(ni={}));function XA(e){e.preventDefault()}function P4e(e){e.stopPropagation()}var gt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(gt||(gt={}));const Pj={start:[gt.Space,gt.Enter],cancel:[gt.Esc],end:[gt.Space,gt.Enter]},k4e=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case gt.Right:return{...n,x:n.x+25};case gt.Left:return{...n,x:n.x-25};case gt.Down:return{...n,y:n.y+25};case gt.Up:return{...n,y:n.y-25}}};class kj{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Sf(cd(n)),this.windowListeners=new Sf(gr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ni.Resize,this.handleCancel),this.windowListeners.add(ni.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ni.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Ej(r),n(Vi)}handleKeyDown(t){if(h4(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Pj,coordinateGetter:s=k4e,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,c=u?{x:u.left,y:u.top}:Vi;this.referenceCoordinates||(this.referenceCoordinates=c);const d=s(t,{active:n,context:r.current,currentCoordinates:c});if(d){const f=x0(d,c),h={x:0,y:0},{scrollableAncestors:p}=r.current;for(const g of p){const S=t.code,{isTop:v,isRight:y,isLeft:m,isBottom:b,maxScroll:_,minScroll:w}=Cj(g),x=w4e(g),C={x:Math.min(S===gt.Right?x.right-x.width/2:x.right,Math.max(S===gt.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(S===gt.Down?x.bottom-x.height/2:x.bottom,Math.max(S===gt.Down?x.top:x.top+x.height/2,d.y))},k=S===gt.Right&&!y||S===gt.Left&&!m,P=S===gt.Down&&!b||S===gt.Up&&!v;if(k&&C.x!==d.x){const A=g.scrollLeft+f.x,$=S===gt.Right&&A<=_.x||S===gt.Left&&A>=w.x;if($&&!f.y){g.scrollTo({left:A,behavior:a});return}$?h.x=g.scrollLeft-A:h.x=S===gt.Right?g.scrollLeft-_.x:g.scrollLeft-w.x,h.x&&g.scrollBy({left:-h.x,behavior:a});break}else if(P&&C.y!==d.y){const A=g.scrollTop+f.y,$=S===gt.Down&&A<=_.y||S===gt.Up&&A>=w.y;if($&&!f.x){g.scrollTo({top:A,behavior:a});return}$?h.y=g.scrollTop-A:h.y=S===gt.Down?g.scrollTop-_.y:g.scrollTop-w.y,h.y&&g.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,hc(x0(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}kj.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Pj,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function QA(e){return!!(e&&"distance"in e)}function ZA(e){return!!(e&&"delay"in e)}class m4{constructor(t,n,r){var i;r===void 0&&(r=E4e(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=cd(s),this.documentListeners=new Sf(this.document),this.listeners=new Sf(r),this.windowListeners=new Sf(gr(s)),this.initialCoordinates=(i=zh(o))!=null?i:Vi,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(ni.Resize,this.handleCancel),this.windowListeners.add(ni.DragStart,XA),this.windowListeners.add(ni.VisibilityChange,this.handleCancel),this.windowListeners.add(ni.ContextMenu,XA),this.documentListeners.add(ni.Keydown,this.handleKeydown),n){if(QA(n))return;if(ZA(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ni.Click,P4e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ni.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=zh(t))!=null?n:Vi,u=x0(i,l);if(!r&&a){if(ZA(a))return G_(u,a.tolerance)?this.handleCancel():void 0;if(QA(a))return a.tolerance!=null&&G_(u,a.tolerance)?this.handleCancel():G_(u,a.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===gt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const A4e={move:{name:"pointermove"},end:{name:"pointerup"}};class Aj extends m4{constructor(t){const{event:n}=t,r=cd(n.target);super(t,A4e,r)}}Aj.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const O4e={move:{name:"mousemove"},end:{name:"mouseup"}};var $x;(function(e){e[e.RightClick=2]="RightClick"})($x||($x={}));class Oj extends m4{constructor(t){super(t,O4e,cd(t.event.target))}}Oj.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===$x.RightClick?!1:(r==null||r({event:n}),!0)}}];const H_={move:{name:"touchmove"},end:{name:"touchend"}};class Rj extends m4{constructor(t){super(t,H_)}static setup(){return window.addEventListener(H_.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(H_.move.name,t)};function t(){}}}Rj.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var _f;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(_f||(_f={}));var T0;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(T0||(T0={}));function R4e(e){let{acceleration:t,activator:n=_f.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=T0.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:f}=e;const h=M4e({delta:d,disabled:!o}),[p,g]=V3e(),S=E.useRef({x:0,y:0}),v=E.useRef({x:0,y:0}),y=E.useMemo(()=>{switch(n){case _f.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case _f.DraggableRect:return i}},[n,i,l]),m=E.useRef(null),b=E.useCallback(()=>{const w=m.current;if(!w)return;const x=S.current.x*v.current.x,C=S.current.y*v.current.y;w.scrollBy(x,C)},[]),_=E.useMemo(()=>a===T0.TreeOrder?[...u].reverse():u,[a,u]);E.useEffect(()=>{if(!o||!u.length||!y){g();return}for(const w of _){if((r==null?void 0:r(w))===!1)continue;const x=u.indexOf(w),C=c[x];if(!C)continue;const{direction:k,speed:P}=_4e(w,C,y,t,f);for(const A of["x","y"])h[A][k[A]]||(P[A]=0,k[A]=0);if(P.x>0||P.y>0){g(),m.current=w,p(b,s),S.current=P,v.current=k;return}}S.current={x:0,y:0},v.current={x:0,y:0},g()},[t,b,r,g,o,s,JSON.stringify(y),JSON.stringify(h),p,u,_,c,JSON.stringify(f)])}const I4e={x:{[Cn.Backward]:!1,[Cn.Forward]:!1},y:{[Cn.Backward]:!1,[Cn.Forward]:!1}};function M4e(e){let{delta:t,disabled:n}=e;const r=w0(t);return jp(i=>{if(n||!r||!i)return I4e;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Cn.Backward]:i.x[Cn.Backward]||o.x===-1,[Cn.Forward]:i.x[Cn.Forward]||o.x===1},y:{[Cn.Backward]:i.y[Cn.Backward]||o.y===-1,[Cn.Forward]:i.y[Cn.Forward]||o.y===1}}},[n,t,r])}function N4e(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return jp(i=>{var o;return t===null?null:(o=r??i)!=null?o:null},[r,t])}function D4e(e,t){return E.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var Gh;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Gh||(Gh={}));var Fx;(function(e){e.Optimized="optimized"})(Fx||(Fx={}));const JA=new Map;function L4e(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=E.useState(null),{frequency:a,measure:l,strategy:u}=i,c=E.useRef(e),d=S(),f=Vh(d),h=E.useCallback(function(v){v===void 0&&(v=[]),!f.current&&s(y=>y===null?v:y.concat(v.filter(m=>!y.includes(m))))},[f]),p=E.useRef(null),g=jp(v=>{if(d&&!n)return JA;if(!v||v===JA||c.current!==e||o!=null){const y=new Map;for(let m of e){if(!m)continue;if(o&&o.length>0&&!o.includes(m.id)&&m.rect.current){y.set(m.id,m.rect.current);continue}const b=m.node.current,_=b?new g4(l(b),b):null;m.rect.current=_,_&&y.set(m.id,_)}return y}return v},[e,o,n,d,l]);return E.useEffect(()=>{c.current=e},[e]),E.useEffect(()=>{d||h()},[n,d]),E.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),E.useEffect(()=>{d||typeof a!="number"||p.current!==null||(p.current=setTimeout(()=>{h(),p.current=null},a))},[a,d,h,...r]),{droppableRects:g,measureDroppableContainers:h,measuringScheduled:o!=null};function S(){switch(u){case Gh.Always:return!1;case Gh.BeforeDragging:return n;default:return!n}}}function y4(e,t){return jp(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function $4e(e,t){return y4(e,t)}function F4e(e){let{callback:t,disabled:n}=e;const r=Tb(t),i=E.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return E.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Pb(e){let{callback:t,disabled:n}=e;const r=Tb(t),i=E.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return E.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function B4e(e){return new g4(Vp(e),e)}function e9(e,t,n){t===void 0&&(t=B4e);const[r,i]=E.useReducer(a,null),o=F4e({callback(l){if(e)for(const u of l){const{type:c,target:d}=u;if(c==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),s=Pb({callback:i});return Po(()=>{i(),e?(s==null||s.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(s==null||s.disconnect(),o==null||o.disconnect())},[e]),r;function a(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function j4e(e){const t=y4(e);return vj(e,t)}const t9=[];function V4e(e){const t=E.useRef(e),n=jp(r=>e?r&&r!==t9&&e&&t.current&&e.parentNode===t.current.parentNode?r:p4(e):t9,[e]);return E.useEffect(()=>{t.current=e},[e]),n}function z4e(e){const[t,n]=E.useState(null),r=E.useRef(e),i=E.useCallback(o=>{const s=U_(o.target);s&&n(a=>a?(a.set(s,Lx(s)),new Map(a)):null)},[]);return E.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const u=U_(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,Lx(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const u=U_(l);u==null||u.removeEventListener("scroll",i)})}},[i,e]),E.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>hc(o,s),Vi):Tj(e):Vi,[e,t])}function n9(e,t){t===void 0&&(t=[]);const n=E.useRef(null);return E.useEffect(()=>{n.current=null},t),E.useEffect(()=>{const r=e!==Vi;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?x0(e,n.current):Vi}function U4e(e){E.useEffect(()=>{if(!Cb)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function G4e(e,t){return E.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function Ij(e){return E.useMemo(()=>e?y4e(e):null,[e])}const q_=[];function H4e(e,t){t===void 0&&(t=Vp);const[n]=e,r=Ij(n?gr(n):null),[i,o]=E.useReducer(a,q_),s=Pb({callback:o});return e.length>0&&i===q_&&o(),Po(()=>{e.length?e.forEach(l=>s==null?void 0:s.observe(l)):(s==null||s.disconnect(),o())},[e]),i;function a(){return e.length?e.map(l=>xj(l)?r:new g4(t(l),l)):q_}}function Mj(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Bp(t)?t:e}function q4e(e){let{measure:t}=e;const[n,r]=E.useState(null),i=E.useCallback(u=>{for(const{target:c}of u)if(Bp(c)){r(d=>{const f=t(c);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),o=Pb({callback:i}),s=E.useCallback(u=>{const c=Mj(u);o==null||o.disconnect(),c&&(o==null||o.observe(c)),r(c?t(c):null)},[t,o]),[a,l]=_0(s);return E.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const W4e=[{sensor:Aj,options:{}},{sensor:kj,options:{}}],K4e={current:{}},$m={draggable:{measure:YA},droppable:{measure:YA,strategy:Gh.WhileDragging,frequency:Fx.Optimized},dragOverlay:{measure:Vp}};class wf extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Y4e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new wf,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:C0},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:$m,measureDroppableContainers:C0,windowRect:null,measuringScheduled:!1},Nj={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:C0,draggableNodes:new Map,over:null,measureDroppableContainers:C0},zp=E.createContext(Nj),Dj=E.createContext(Y4e);function X4e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new wf}}}function Q4e(e,t){switch(t.type){case cn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case cn.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case cn.DragEnd:case cn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case cn.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new wf(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case cn.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new wf(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case cn.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new wf(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Z4e(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=E.useContext(zp),o=w0(r),s=w0(n==null?void 0:n.id);return E.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!h4(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:u}=a;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const d=G3e(c);if(d){d.focus();break}}})}},[r,t,i,s,o]),null}function Lj(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function J4e(e){return E.useMemo(()=>({draggable:{...$m.draggable,...e==null?void 0:e.draggable},droppable:{...$m.droppable,...e==null?void 0:e.droppable},dragOverlay:{...$m.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function eTe(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=E.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;Po(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const c=n(u),d=vj(c,r);if(s||(d.x=0),a||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=Sj(u);f&&f.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const kb=E.createContext({...Vi,scaleX:1,scaleY:1});var Vs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Vs||(Vs={}));const tTe=E.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:u,sensors:c=W4e,collisionDetection:d=u4e,measuring:f,modifiers:h,...p}=t;const g=E.useReducer(Q4e,void 0,X4e),[S,v]=g,[y,m]=Q3e(),[b,_]=E.useState(Vs.Uninitialized),w=b===Vs.Initialized,{draggable:{active:x,nodes:C,translate:k},droppable:{containers:P}}=S,A=x?C.get(x):null,$=E.useRef({initial:null,translated:null}),N=E.useMemo(()=>{var ct;return x!=null?{id:x,data:(ct=A==null?void 0:A.data)!=null?ct:K4e,rect:$}:null},[x,A]),T=E.useRef(null),[O,I]=E.useState(null),[M,R]=E.useState(null),D=Vh(p,Object.values(p)),L=Eb("DndDescribedBy",s),V=E.useMemo(()=>P.getEnabled(),[P]),z=J4e(f),{droppableRects:U,measureDroppableContainers:K,measuringScheduled:W}=L4e(V,{dragging:w,dependencies:[k.x,k.y],config:z.droppable}),X=N4e(C,x),F=E.useMemo(()=>M?zh(M):null,[M]),q=Lo(),Q=$4e(X,z.draggable.measure);eTe({activeNode:x?C.get(x):null,config:q.layoutShiftCompensation,initialRect:Q,measure:z.draggable.measure});const J=e9(X,z.draggable.measure,Q),ne=e9(X?X.parentElement:null),Z=E.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),me=P.getNodeFor((n=Z.current.over)==null?void 0:n.id),ae=q4e({measure:z.dragOverlay.measure}),oe=(r=ae.nodeRef.current)!=null?r:X,Ce=w?(i=ae.rect)!=null?i:J:null,se=!!(ae.nodeRef.current&&ae.rect),qe=j4e(se?null:J),yt=Ij(oe?gr(oe):null),$e=V4e(w?me??X:null),Fe=H4e($e),Ie=Lj(h,{transform:{x:k.x-qe.x,y:k.y-qe.y,scaleX:1,scaleY:1},activatorEvent:M,active:N,activeNodeRect:J,containerNodeRect:ne,draggingNodeRect:Ce,over:Z.current.over,overlayNodeRect:ae.rect,scrollableAncestors:$e,scrollableAncestorRects:Fe,windowRect:yt}),nt=F?hc(F,k):null,wt=z4e($e),vn=n9(wt),sn=n9(wt,[J]),At=hc(Ie,vn),ee=Ce?p4e(Ce,Ie):null,Se=N&&ee?d({active:N,collisionRect:ee,droppableRects:U,droppableContainers:V,pointerCoordinates:nt}):null,Te=a4e(Se,"id"),[Me,ie]=E.useState(null),pe=se?Ie:hc(Ie,sn),Xt=f4e(pe,(o=Me==null?void 0:Me.rect)!=null?o:null,J),Ot=E.useCallback((ct,We)=>{let{sensor:An,options:bn}=We;if(T.current==null)return;const Gn=C.get(T.current);if(!Gn)return;const nr=ct.nativeEvent,mr=new An({active:T.current,activeNode:Gn,event:nr,options:bn,context:Z,onStart(rr){const On=T.current;if(On==null)return;const $o=C.get(On);if(!$o)return;const{onDragStart:Ts}=D.current,Es={active:{id:On,data:$o.data,rect:$}};ai.unstable_batchedUpdates(()=>{Ts==null||Ts(Es),_(Vs.Initializing),v({type:cn.DragStart,initialCoordinates:rr,active:On}),y({type:"onDragStart",event:Es})})},onMove(rr){v({type:cn.DragMove,coordinates:rr})},onEnd:Gi(cn.DragEnd),onCancel:Gi(cn.DragCancel)});ai.unstable_batchedUpdates(()=>{I(mr),R(ct.nativeEvent)});function Gi(rr){return async function(){const{active:$o,collisions:Ts,over:Es,scrollAdjustedTranslate:Jl}=Z.current;let Fo=null;if($o&&Jl){const{cancelDrop:ir}=D.current;Fo={activatorEvent:nr,active:$o,collisions:Ts,delta:Jl,over:Es},rr===cn.DragEnd&&typeof ir=="function"&&await Promise.resolve(ir(Fo))&&(rr=cn.DragCancel)}T.current=null,ai.unstable_batchedUpdates(()=>{v({type:rr}),_(Vs.Uninitialized),ie(null),I(null),R(null);const ir=rr===cn.DragEnd?"onDragEnd":"onDragCancel";if(Fo){const Ba=D.current[ir];Ba==null||Ba(Fo),y({type:ir,event:Fo})}})}}},[C]),ut=E.useCallback((ct,We)=>(An,bn)=>{const Gn=An.nativeEvent,nr=C.get(bn);if(T.current!==null||!nr||Gn.dndKit||Gn.defaultPrevented)return;const mr={active:nr};ct(An,We.options,mr)===!0&&(Gn.dndKit={capturedBy:We.sensor},T.current=bn,Ot(An,We))},[C,Ot]),tr=D4e(c,ut);U4e(c),Po(()=>{J&&b===Vs.Initializing&&_(Vs.Initialized)},[J,b]),E.useEffect(()=>{const{onDragMove:ct}=D.current,{active:We,activatorEvent:An,collisions:bn,over:Gn}=Z.current;if(!We||!An)return;const nr={active:We,activatorEvent:An,collisions:bn,delta:{x:At.x,y:At.y},over:Gn};ai.unstable_batchedUpdates(()=>{ct==null||ct(nr),y({type:"onDragMove",event:nr})})},[At.x,At.y]),E.useEffect(()=>{const{active:ct,activatorEvent:We,collisions:An,droppableContainers:bn,scrollAdjustedTranslate:Gn}=Z.current;if(!ct||T.current==null||!We||!Gn)return;const{onDragOver:nr}=D.current,mr=bn.get(Te),Gi=mr&&mr.rect.current?{id:mr.id,rect:mr.rect.current,data:mr.data,disabled:mr.disabled}:null,rr={active:ct,activatorEvent:We,collisions:An,delta:{x:Gn.x,y:Gn.y},over:Gi};ai.unstable_batchedUpdates(()=>{ie(Gi),nr==null||nr(rr),y({type:"onDragOver",event:rr})})},[Te]),Po(()=>{Z.current={activatorEvent:M,active:N,activeNode:X,collisionRect:ee,collisions:Se,droppableRects:U,draggableNodes:C,draggingNode:oe,draggingNodeRect:Ce,droppableContainers:P,over:Me,scrollableAncestors:$e,scrollAdjustedTranslate:At},$.current={initial:Ce,translated:ee}},[N,X,Se,ee,C,oe,Ce,U,P,Me,$e,At]),R4e({...q,delta:k,draggingRect:ee,pointerCoordinates:nt,scrollableAncestors:$e,scrollableAncestorRects:Fe});const Do=E.useMemo(()=>({active:N,activeNode:X,activeNodeRect:J,activatorEvent:M,collisions:Se,containerNodeRect:ne,dragOverlay:ae,draggableNodes:C,droppableContainers:P,droppableRects:U,over:Me,measureDroppableContainers:K,scrollableAncestors:$e,scrollableAncestorRects:Fe,measuringConfiguration:z,measuringScheduled:W,windowRect:yt}),[N,X,J,M,Se,ne,ae,C,P,U,Me,K,$e,Fe,z,W,yt]),Yr=E.useMemo(()=>({activatorEvent:M,activators:tr,active:N,activeNodeRect:J,ariaDescribedById:{draggable:L},dispatch:v,draggableNodes:C,over:Me,measureDroppableContainers:K}),[M,tr,N,J,v,L,C,Me,K]);return Ve.createElement(yj.Provider,{value:m},Ve.createElement(zp.Provider,{value:Yr},Ve.createElement(Dj.Provider,{value:Do},Ve.createElement(kb.Provider,{value:Xt},u)),Ve.createElement(Z4e,{disabled:(a==null?void 0:a.restoreFocus)===!1})),Ve.createElement(e4e,{...a,hiddenTextDescribedById:L}));function Lo(){const ct=(O==null?void 0:O.autoScrollEnabled)===!1,We=typeof l=="object"?l.enabled===!1:l===!1,An=w&&!ct&&!We;return typeof l=="object"?{...l,enabled:An}:{enabled:An}}}),nTe=E.createContext(null),r9="button",rTe="Droppable";function iTe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=Eb(rTe),{activators:s,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=E.useContext(zp),{role:h=r9,roleDescription:p="draggable",tabIndex:g=0}=i??{},S=(l==null?void 0:l.id)===t,v=E.useContext(S?kb:nTe),[y,m]=_0(),[b,_]=_0(),w=G4e(s,t),x=Vh(n);Po(()=>(d.set(t,{id:t,key:o,node:y,activatorNode:b,data:x}),()=>{const k=d.get(t);k&&k.key===o&&d.delete(t)}),[d,t]);const C=E.useMemo(()=>({role:h,tabIndex:g,"aria-disabled":r,"aria-pressed":S&&h===r9?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,g,S,p,c.draggable]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:C,isDragging:S,listeners:r?void 0:w,node:y,over:f,setNodeRef:m,setActivatorNodeRef:_,transform:v}}function oTe(){return E.useContext(Dj)}const sTe="Droppable",aTe={timeout:25};function lTe(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=Eb(sTe),{active:s,dispatch:a,over:l,measureDroppableContainers:u}=E.useContext(zp),c=E.useRef({disabled:n}),d=E.useRef(!1),f=E.useRef(null),h=E.useRef(null),{disabled:p,updateMeasurementsFor:g,timeout:S}={...aTe,...i},v=Vh(g??r),y=E.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),h.current=null},S)},[S]),m=Pb({callback:y,disabled:p||!s}),b=E.useCallback((C,k)=>{m&&(k&&(m.unobserve(k),d.current=!1),C&&m.observe(C))},[m]),[_,w]=_0(b),x=Vh(t);return E.useEffect(()=>{!m||!_.current||(m.disconnect(),d.current=!1,m.observe(_.current))},[_,m]),Po(()=>(a({type:cn.RegisterDroppable,element:{id:r,key:o,disabled:n,node:_,rect:f,data:x}}),()=>a({type:cn.UnregisterDroppable,key:o,id:r})),[r]),E.useEffect(()=>{n!==c.current.disabled&&(a({type:cn.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,a]),{active:s,rect:f,isOver:(l==null?void 0:l.id)===r,node:_,over:l,setNodeRef:w}}function uTe(e){let{animation:t,children:n}=e;const[r,i]=E.useState(null),[o,s]=E.useState(null),a=w0(n);return!n&&!r&&a&&i(a),Po(()=>{if(!o)return;const l=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(l==null||u==null){i(null);return}Promise.resolve(t(u,o)).then(()=>{i(null)})},[t,r,o]),Ve.createElement(Ve.Fragment,null,n,r?E.cloneElement(r,{ref:s}):null)}const cTe={x:0,y:0,scaleX:1,scaleY:1};function dTe(e){let{children:t}=e;return Ve.createElement(zp.Provider,{value:Nj},Ve.createElement(kb.Provider,{value:cTe},t))}const fTe={position:"fixed",touchAction:"none"},hTe=e=>h4(e)?"transform 250ms ease":void 0,pTe=E.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:s,rect:a,style:l,transform:u,transition:c=hTe}=e;if(!a)return null;const d=i?u:{...u,scaleX:1,scaleY:1},f={...fTe,width:a.width,height:a.height,top:a.top,left:a.left,transform:Uh.Transform.toString(d),transformOrigin:i&&r?r4e(r,a):void 0,transition:typeof c=="function"?c(r):c,...l};return Ve.createElement(n,{className:s,style:f,ref:t},o)}),gTe=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:s}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(i[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[l,u]of Object.entries(i))n.node.style.setProperty(l,u);s!=null&&s.active&&n.node.classList.remove(s.active)}},mTe=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Uh.Transform.toString(t)},{transform:Uh.Transform.toString(n)}]},yTe={duration:250,easing:"ease",keyframes:mTe,sideEffects:gTe({styles:{active:{opacity:"0"}}})};function vTe(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return Tb((o,s)=>{if(t===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const u=Mj(s);if(!u)return;const{transform:c}=gr(s).getComputedStyle(s),d=bj(c);if(!d)return;const f=typeof t=="function"?t:bTe(t);return Ej(l,i.draggable.measure),f({active:{id:o,data:a.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:s,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:d})})}function bTe(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...yTe,...e};return o=>{let{active:s,dragOverlay:a,transform:l,...u}=o;if(!t)return;const c={x:a.rect.left-s.rect.left,y:a.rect.top-s.rect.top},d={scaleX:l.scaleX!==1?s.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?s.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-c.x,y:l.y-c.y,...d},h=i({...u,active:s,dragOverlay:a,transform:{initial:l,final:f}}),[p]=h,g=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(g))return;const S=r==null?void 0:r({active:s,dragOverlay:a,...u}),v=a.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{v.onfinish=()=>{S==null||S(),y()}})}}let i9=0;function STe(e){return E.useMemo(()=>{if(e!=null)return i9++,i9},[e])}const _Te=Ve.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:s,wrapperElement:a="div",className:l,zIndex:u=999}=e;const{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggableNodes:p,droppableContainers:g,dragOverlay:S,over:v,measuringConfiguration:y,scrollableAncestors:m,scrollableAncestorRects:b,windowRect:_}=oTe(),w=E.useContext(kb),x=STe(d==null?void 0:d.id),C=Lj(s,{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:S.rect,over:v,overlayNodeRect:S.rect,scrollableAncestors:m,scrollableAncestorRects:b,transform:w,windowRect:_}),k=y4(f),P=vTe({config:r,draggableNodes:p,droppableContainers:g,measuringConfiguration:y}),A=k?S.setRef:void 0;return Ve.createElement(dTe,null,Ve.createElement(uTe,{animation:P},d&&x?Ve.createElement(pTe,{key:x,id:d.id,ref:A,as:a,activatorEvent:c,adjustScale:t,className:l,transition:o,rect:k,style:{zIndex:u,...i},transform:C},n):null))}),wTe=e=>{let{activatorEvent:t,draggingNodeRect:n,transform:r}=e;if(n&&t){const i=zh(t);if(!i)return r;const o=i.x-n.left,s=i.y-n.top;return{...r,x:r.x+o-n.width/2,y:r.y+s-n.height/2}}return r},Kg=28,o9={w:Kg,h:Kg,maxW:Kg,maxH:Kg,shadow:"dark-lg",borderRadius:"lg",borderWidth:2,borderStyle:"dashed",borderColor:"base.100",opacity:.5,bg:"base.800",color:"base.50",_dark:{borderColor:"base.200",bg:"base.900",color:"base.100"}},xTe=e=>{if(e.dragData){if(e.dragData.payloadType==="IMAGE_DTO"){const{thumbnail_url:t,width:n,height:r}=e.dragData.payload.imageDTO;return j.jsx(Q5,{sx:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none",cursor:"none"},children:j.jsx(Y5,{sx:{...o9},objectFit:"contain",src:t,width:n,height:r})})}return e.dragData.payloadType==="IMAGE_NAMES"?j.jsxs(Z5,{sx:{cursor:"none",userSelect:"none",position:"relative",alignItems:"center",justifyContent:"center",flexDir:"column",...o9},children:[j.jsx(Mw,{children:e.dragData.payload.image_names.length}),j.jsx(Mw,{size:"sm",children:"Images"})]}):null}},CTe=E.memo(xTe);function F8e(e){return lTe(e)}function B8e(e){return iTe(e)}const j8e=(e,t)=>{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"SET_CURRENT_IMAGE":return r==="IMAGE_DTO";case"SET_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_CONTROLNET_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_NAMES";case"ADD_TO_BATCH":return r==="IMAGE_DTO"||"IMAGE_NAMES";case"MOVE_BOARD":return r==="IMAGE_DTO"||"IMAGE_NAMES";default:return!1}};function TTe(e){return j.jsx(tTe,{...e})}const ETe=e=>{const[t,n]=E.useState(null),r=ed(),i=E.useCallback(u=>{const c=u.active.data.current;c&&n(c)},[]),o=E.useCallback(u=>{var f;const c=u.active.data.current,d=(f=u.over)==null?void 0:f.data.current;!c||!d||(r(QF({overData:d,activeData:c})),n(null))},[r]),s=KA(Oj,{activationConstraint:{distance:10}}),a=KA(Rj,{activationConstraint:{distance:10}}),l=t4e(s,a);return j.jsxs(TTe,{onDragStart:i,onDragEnd:o,sensors:l,collisionDetection:d4e,children:[e.children,j.jsx(_Te,{dropAnimation:null,modifiers:[wTe],children:j.jsx(q5,{children:t&&j.jsx(H5.div,{layout:!0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1,transition:{duration:.1}},children:j.jsx(CTe,{dragData:t})},"overlay-drag-image")})})]})},PTe=E.memo(ETe),kTe=E.createContext({isOpen:!1,onClose:()=>{},onClickAddToBoard:()=>{},handleAddToBoard:()=>{}}),ATe=e=>{const[t,n]=E.useState(),{isOpen:r,onOpen:i,onClose:o}=zN(),[s,a]=Nbe(),l=E.useCallback(()=>{n(void 0),o()},[o]),u=E.useCallback(d=>{d&&(n(d),i())},[n,i]),c=E.useCallback(d=>{t&&(s({board_id:d,image_name:t.image_name}),l())},[s,l,t]);return j.jsx(kTe.Provider,{value:{isOpen:r,image:t,onClose:l,onClickAddToBoard:u,handleAddToBoard:c},children:e.children})},OTe=at(e=>e.ui,e=>ND[e.activeTab],{memoizeOptions:{equalityCheck:lp}}),V8e=at(e=>e.ui,e=>e.activeTab,{memoizeOptions:{equalityCheck:lp}}),z8e=at(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:lp}}),$j=e=>e.canvas,U8e=at([$j,OTe,_p],(e,t,n)=>e.layerState.stagingArea.images.length>0||t==="unifiedCanvas"&&n.isProcessing),G8e=e=>e.canvas.layerState.objects.find(qw),RTe=e=>e.generation,ITe=at([e=>e,RTe,$j,I1e,Kpe,(e,t)=>t],(e,t,n,r,i,o)=>{const s=t.initialImage?Za(e,t.initialImage.imageName):void 0,a=(s==null?void 0:s.board_id)===o,l=n.layerState.objects.some(f=>{if(f.kind==="image"){const h=Za(e,f.imageName);return(h==null?void 0:h.board_id)===o}return!1}),u=r.nodes.some(f=>Ys(f.data.inputs,h=>{if(h.type==="image"&&h.value){const p=Za(e,h.value.image_name);return(p==null?void 0:p.board_id)===o}return!1})),c=Ys(i.controlNets,f=>{const h=f.controlImage?Za(e,f.controlImage):void 0,p=f.processedControlImage?Za(e,f.processedControlImage):void 0;return(h==null?void 0:h.board_id)===o||(p==null?void 0:p.board_id)===o});return{isInitialImage:a,isCanvasImage:l,isNodesImage:u,isControlNetImage:c}},Ss),MTe=E.createContext({isOpen:!1,onClose:()=>{},onClickDeleteBoardImages:()=>{},handleDeleteBoardImages:()=>{},handleDeleteBoardOnly:()=>{}}),NTe=e=>{const[t,n]=E.useState(),{isOpen:r,onOpen:i,onClose:o}=zN(),s=ed(),a=Zf(h=>ITe(h,t==null?void 0:t.board_id)),[l]=xpe(),u=E.useCallback(()=>{n(void 0),o()},[o]),c=E.useCallback(h=>{console.log({board:h}),h&&(n(h),i())},[n,i]),d=E.useCallback(h=>{t&&(s(HF({board:t,imagesUsage:a})),u())},[s,u,t,a]),f=E.useCallback(h=>{t&&(l(h),u())},[l,u,t]);return j.jsx(MTe.Provider,{value:{isOpen:r,board:t,onClose:u,onClickDeleteBoardImages:c,handleDeleteBoardImages:d,handleDeleteBoardOnly:f,imagesUsage:a},children:e.children})},DTe=E.lazy(()=>SR(()=>import("./App-3ab46138.js"),["./App-3ab46138.js","./MantineProvider-48183abc.js","./App-6125620a.css"],import.meta.url)),LTe=E.lazy(()=>SR(()=>import("./ThemeLocaleProvider-aff3d007.js"),["./ThemeLocaleProvider-aff3d007.js","./MantineProvider-48183abc.js","./ThemeLocaleProvider-5b992bc7.css"],import.meta.url)),$Te=({apiUrl:e,token:t,config:n,headerComponent:r,middleware:i})=>(E.useEffect(()=>(t&&wh.set(t),e&&xh.set(e),EI(),i&&i.length>0?q2(qA(),...i):q2(qA()),()=>{xh.set(void 0),wh.set(void 0)}),[e,t,i]),j.jsx(Ve.StrictMode,{children:j.jsx(EG,{store:x5e,children:j.jsx(Ve.Suspense,{fallback:j.jsx(E5e,{}),children:j.jsx(LTe,{children:j.jsx(PTe,{children:j.jsx(ATe,{children:j.jsx(NTe,{children:j.jsx(DTe,{config:n,headerComponent:r})})})})})})})})),FTe=E.memo($Te);W_.createRoot(document.getElementById("root")).render(j.jsx(FTe,{}));export{oEe as $,Pse as A,Dn as B,QTe as C,q5 as D,H5 as E,Nv as F,Ao as G,uEe as H,jl as I,$N as J,Fn as K,rh as L,Cy as M,Fu as N,OJ as O,ZTe as P,ym as Q,rc as R,Qf as S,ao as T,Il as U,zG as V,Ve as W,Vse as X,b6 as Y,gte as Z,ly as _,JC as a,Pue as a$,Rse as a0,cEe as a1,$l as a2,GN as a3,Wse as a4,fEe as a5,dEe as a6,yle as a7,gle as a8,Ov as a9,Jn as aA,ki as aB,B0e as aC,z0e as aD,Ir as aE,ua as aF,Yi as aG,Ake as aH,J$ as aI,eve as aJ,Ove as aK,Yme as aL,Vc as aM,Q5 as aN,Z5 as aO,Mw as aP,at as aQ,_p as aR,OTe as aS,ed as aT,Zf as aU,Gke as aV,bD as aW,Fr as aX,c6e as aY,ai as aZ,_5 as a_,cp as aa,Kie as ab,AN as ac,$n as ad,yo as ae,Uv as af,tEe as ag,dw as ah,XTe as ai,mm as aj,y6 as ak,Xle as al,Bse as am,v6 as an,Ale as ao,qle as ap,t_ as aq,ou as ar,n_ as as,bg as at,Ole as au,hEe as av,bp as aw,Si as ax,Wt as ay,cc as az,i5 as b,pl as b$,a3 as b0,RN as b1,W6e as b2,VCe as b3,F8e as b4,j8e as b5,$R as b6,Ck as b7,$8e as b8,fV as b9,SEe as bA,jEe as bB,vEe as bC,XEe as bD,wEe as bE,IEe as bF,xEe as bG,MEe as bH,PEe as bI,DEe as bJ,p8e as bK,eSe as bL,kTe as bM,N8e as bN,ege as bO,g8e as bP,d8e as bQ,c8e as bR,gL as bS,ZPe as bT,Hce as bU,Yw as bV,YTe as bW,Oue as bX,ske as bY,eke as bZ,tke as b_,zTe as ba,jTe as bb,VTe as bc,Ne as bd,M8e as be,MTe as bf,K6e as bg,xpe as bh,Y5 as bi,Ss as bj,q6e as bk,IN as bl,wke as bm,BTe as bn,Gs as bo,B8e as bp,mEe as bq,yEe as br,FEe as bs,BEe as bt,_Ee as bu,HEe as bv,bEe as bw,REe as bx,CEe as by,tSe as bz,cW as c,bke as c$,zv as c0,b1 as c1,m8e as c2,la as c3,m1 as c4,y1 as c5,X6e as c6,zN as c7,ike as c8,Iue as c9,O4 as cA,L6 as cB,UTe as cC,GTe as cD,_Pe as cE,n8e as cF,L8e as cG,r5e as cH,t8e as cI,Wce as cJ,Kke as cK,qce as cL,dPe as cM,SPe as cN,i8e as cO,TPe as cP,Xke as cQ,ID as cR,aPe as cS,zke as cT,CPe as cU,t5e as cV,uPe as cW,Za as cX,lke as cY,_ke as cZ,vke as c_,rke as ca,nke as cb,mPe as cc,z8e as cd,ake as ce,U8e as cf,lp as cg,pPe as ch,Zo as ci,NN as cj,DN as ck,Ys as cl,nge as cm,qke as cn,Cke as co,u$ as cp,c$ as cq,l8e as cr,C5e as cs,er as ct,xPe as cu,o8e as cv,yJ as cw,b5 as cx,L7 as cy,bJ as cz,XQ as d,w8e as d$,Ske as d0,Eke as d1,Pke as d2,f$ as d3,S8e as d4,wl as d5,Tke as d6,g5 as d7,gEe as d8,ve as d9,QEe as dA,rPe as dB,$Ee as dC,RTe as dD,iPe as dE,oPe as dF,tPe as dG,nPe as dH,ePe as dI,JEe as dJ,KEe as dK,qEe as dL,Qke as dM,zl as dN,Jke as dO,Rw as dP,nD as dQ,iD as dR,rD as dS,aD as dT,sD as dU,pEe as dV,LEe as dW,Xv as dX,y8e as dY,v8e as dZ,jce as d_,EEe as da,b8e as db,Ok as dc,pke as dd,C3 as de,Hpe as df,Cu as dg,Rk as dh,gke as di,mke as dj,HN as dk,yke as dl,qpe as dm,r$ as dn,dke as dp,hke as dq,uke as dr,Kpe as ds,S_e as dt,cke as du,_8e as dv,io as dw,kEe as dx,Rp as dy,sPe as dz,l7 as e,jd as e$,MD as e0,$D as e1,to as e2,NEe as e3,WEe as e4,HTe as e5,jZ as e6,YEe as e7,O8e as e8,E8e as e9,Dh as eA,p5 as eB,LF as eC,I1e as eD,Ike as eE,UCe as eF,Oke as eG,Rke as eH,Nke as eI,Mke as eJ,Dke as eK,Bke as eL,P1e as eM,IF as eN,pB as eO,NV as eP,De as eQ,$j as eR,y6e as eS,L6e as eT,D6e as eU,XPe as eV,E6e as eW,F6e as eX,mbe as eY,zPe as eZ,f6e as e_,Ht as ea,fo as eb,a8e as ec,T8e as ed,A8e as ee,s8e as ef,k8e as eg,hZ as eh,P8e as ei,x8e as ej,C8e as ek,wF as el,Ev as em,R8e as en,a0 as eo,ye as ep,I8e as eq,px as er,$Z as es,TEe as et,qTe as eu,Lke as ev,$ke as ew,Fke as ex,jke as ey,Vke as ez,FI as f,lPe as f$,l6e as f0,UPe as f1,P1 as f2,d6e as f3,BPe as f4,u6e as f5,jPe as f6,qPe as f7,APe as f8,kPe as f9,a6e as fA,JPe as fB,b6e as fC,T6e as fD,S6e as fE,YPe as fF,VPe as fG,I6e as fH,R6e as fI,x6e as fJ,_6e as fK,w6e as fL,U6e as fM,A6e as fN,G6e as fO,s6e as fP,o6e as fQ,FPe as fR,$Pe as fS,V6e as fT,QPe as fU,pbe as fV,dbe as fW,fbe as fX,hbe as fY,IPe as fZ,pL as f_,PPe as fa,$6e as fb,dL as fc,wh as fd,qw as fe,NPe as ff,DPe as fg,LPe as fh,N6e as fi,KPe as fj,WPe as fk,She as fl,M6e as fm,gbe as fn,GPe as fo,e6e as fp,t6e as fq,Wd as fr,v6e as fs,m6e as ft,h6e as fu,OPe as fv,RPe as fw,f8e as fx,h8e as fy,G8e as fz,UQ as g,u8e as g0,Uce as g1,ZEe as g2,MPe as g3,r6e as g4,z6e as g5,VEe as g6,zEe as g7,UEe as g8,GEe as g9,i6e as ga,V8e as gb,gPe as gc,vPe as gd,yPe as ge,bPe as gf,EPe as gg,VZ as gh,abe as gi,Uke as gj,KTe as gk,z7 as gl,iEe as gm,ste as gn,nEe as go,JTe as gp,rEe as gq,lo as gr,eEe as gs,WTe as gt,hte as gu,tte as gv,NJ as gw,aEe as gx,lEe as gy,WI as h,Pn as i,Xc as j,ap as k,pn as l,Jc as m,op as n,Bi as o,Oa as p,BI as q,ko as r,E as s,IS as t,Qe as u,j as v,bi as w,di as x,ke as y,Un as z}; diff --git a/invokeai/frontend/web/dist/assets/index-efb4c895.js b/invokeai/frontend/web/dist/assets/index-efb4c895.js new file mode 100644 index 0000000000..71bc328c0a --- /dev/null +++ b/invokeai/frontend/web/dist/assets/index-efb4c895.js @@ -0,0 +1,125 @@ +function MP(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Ee=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ll(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function iF(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){if(this instanceof r){var i=[null];i.push.apply(i,arguments);var o=Function.bind.apply(t,i);return new o}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var IP={exports:{}},wy={},NP={exports:{}},Re={};/** + * @license React + * react.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 eh=Symbol.for("react.element"),oF=Symbol.for("react.portal"),sF=Symbol.for("react.fragment"),aF=Symbol.for("react.strict_mode"),lF=Symbol.for("react.profiler"),uF=Symbol.for("react.provider"),cF=Symbol.for("react.context"),dF=Symbol.for("react.forward_ref"),fF=Symbol.for("react.suspense"),hF=Symbol.for("react.memo"),pF=Symbol.for("react.lazy"),D3=Symbol.iterator;function gF(e){return e===null||typeof e!="object"?null:(e=D3&&e[D3]||e["@@iterator"],typeof e=="function"?e:null)}var DP={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},LP=Object.assign,$P={};function hc(e,t,n){this.props=e,this.context=t,this.refs=$P,this.updater=n||DP}hc.prototype.isReactComponent={};hc.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};hc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function FP(){}FP.prototype=hc.prototype;function uw(e,t,n){this.props=e,this.context=t,this.refs=$P,this.updater=n||DP}var cw=uw.prototype=new FP;cw.constructor=uw;LP(cw,hc.prototype);cw.isPureReactComponent=!0;var L3=Array.isArray,BP=Object.prototype.hasOwnProperty,dw={current:null},jP={key:!0,ref:!0,__self:!0,__source:!0};function VP(e,t,n){var r,i={},o=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(o=""+t.key),t)BP.call(t,r)&&!jP.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,U=R[j];if(0>>1;ji(X,L))Yi(B,X)?(R[j]=B,R[Y]=L,j=Y):(R[j]=X,R[W]=L,j=W);else if(Yi(B,L))R[j]=B,R[Y]=L,j=Y;else break e}}return D}function i(R,D){var L=R.sortIndex-D.sortIndex;return L!==0?L:R.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],u=[],c=1,d=null,f=3,h=!1,p=!1,m=!1,_=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(R){for(var D=n(u);D!==null;){if(D.callback===null)r(u);else if(D.startTime<=R)r(u),D.sortIndex=D.expirationTime,t(l,D);else break;D=n(u)}}function b(R){if(m=!1,g(R),!p)if(n(l)!==null)p=!0,I(S);else{var D=n(u);D!==null&&N(b,D.startTime-R)}}function S(R,D){p=!1,m&&(m=!1,y(T),T=-1),h=!0;var L=f;try{for(g(D),d=n(l);d!==null&&(!(d.expirationTime>D)||R&&!A());){var j=d.callback;if(typeof j=="function"){d.callback=null,f=d.priorityLevel;var U=j(d.expirationTime<=D);D=e.unstable_now(),typeof U=="function"?d.callback=U:d===n(l)&&r(l),g(D)}else r(l);d=n(l)}if(d!==null)var G=!0;else{var W=n(u);W!==null&&N(b,W.startTime-D),G=!1}return G}finally{d=null,f=L,h=!1}}var w=!1,x=null,T=-1,P=5,E=-1;function A(){return!(e.unstable_now()-ER||125j?(R.sortIndex=L,t(u,R),n(l)===null&&R===n(u)&&(m?(y(T),T=-1):m=!0,N(b,L-j))):(R.sortIndex=U,t(l,R),p||h||(p=!0,I(S))),R},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(R){var D=f;return function(){var L=f;f=D;try{return R.apply(this,arguments)}finally{f=L}}}})(HP);GP.exports=HP;var EF=GP.exports;/** + * @license React + * react-dom.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 qP=k,Ar=EF;function Z(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),E_=Object.prototype.hasOwnProperty,PF=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,B3={},j3={};function AF(e){return E_.call(j3,e)?!0:E_.call(B3,e)?!1:PF.test(e)?j3[e]=!0:(B3[e]=!0,!1)}function kF(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function OF(e,t,n,r){if(t===null||typeof t>"u"||kF(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function nr(e,t,n,r,i,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var An={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){An[e]=new nr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];An[t]=new nr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){An[e]=new nr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){An[e]=new nr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){An[e]=new nr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){An[e]=new nr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){An[e]=new nr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){An[e]=new nr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){An[e]=new nr(e,5,!1,e.toLowerCase(),null,!1,!1)});var hw=/[\-:]([a-z])/g;function pw(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(hw,pw);An[t]=new nr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(hw,pw);An[t]=new nr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(hw,pw);An[t]=new nr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){An[e]=new nr(e,1,!1,e.toLowerCase(),null,!1,!1)});An.xlinkHref=new nr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){An[e]=new nr(e,1,!1,e.toLowerCase(),null,!0,!0)});function gw(e,t,n,r){var i=An.hasOwnProperty(t)?An[t]:null;(i!==null?i.type!==0:r||!(2a||i[s]!==o[a]){var l=` +`+i[s].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{$1=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ld(e):""}function RF(e){switch(e.tag){case 5:return ld(e.type);case 16:return ld("Lazy");case 13:return ld("Suspense");case 19:return ld("SuspenseList");case 0:case 2:case 15:return e=F1(e.type,!1),e;case 11:return e=F1(e.type.render,!1),e;case 1:return e=F1(e.type,!0),e;default:return""}}function O_(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case nu:return"Fragment";case tu:return"Portal";case P_:return"Profiler";case mw:return"StrictMode";case A_:return"Suspense";case k_:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case XP:return(e.displayName||"Context")+".Consumer";case KP:return(e._context.displayName||"Context")+".Provider";case yw:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case vw:return t=e.displayName||null,t!==null?t:O_(e.type)||"Memo";case as:t=e._payload,e=e._init;try{return O_(e(t))}catch{}}return null}function MF(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return O_(t);case 8:return t===mw?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ds(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function QP(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function IF(e){var t=QP(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Zh(e){e._valueTracker||(e._valueTracker=IF(e))}function ZP(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=QP(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Dg(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function R_(e,t){var n=t.checked;return kt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function z3(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ds(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function JP(e,t){t=t.checked,t!=null&&gw(e,"checked",t,!1)}function M_(e,t){JP(e,t);var n=Ds(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?I_(e,t.type,n):t.hasOwnProperty("defaultValue")&&I_(e,t.type,Ds(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function U3(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function I_(e,t,n){(t!=="number"||Dg(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ud=Array.isArray;function bu(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Jh.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function jd(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var vd={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},NF=["Webkit","ms","Moz","O"];Object.keys(vd).forEach(function(e){NF.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),vd[t]=vd[e]})});function rA(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||vd.hasOwnProperty(e)&&vd[e]?(""+t).trim():t+"px"}function iA(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=rA(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var DF=kt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function L_(e,t){if(t){if(DF[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Z(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Z(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Z(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Z(62))}}function $_(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var F_=null;function bw(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var B_=null,_u=null,Su=null;function q3(e){if(e=rh(e)){if(typeof B_!="function")throw Error(Z(280));var t=e.stateNode;t&&(t=Py(t),B_(e.stateNode,e.type,t))}}function oA(e){_u?Su?Su.push(e):Su=[e]:_u=e}function sA(){if(_u){var e=_u,t=Su;if(Su=_u=null,q3(e),t)for(e=0;e>>=0,e===0?32:31-(qF(e)/WF|0)|0}var ep=64,tp=4194304;function cd(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Bg(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=cd(a):(o&=s,o!==0&&(r=cd(o)))}else s=n&~i,s!==0?r=cd(s):o!==0&&(r=cd(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function th(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-gi(t),e[t]=n}function QF(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=_d),t5=String.fromCharCode(32),n5=!1;function EA(e,t){switch(e){case"keyup":return TB.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function PA(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ru=!1;function PB(e,t){switch(e){case"compositionend":return PA(t);case"keypress":return t.which!==32?null:(n5=!0,t5);case"textInput":return e=t.data,e===t5&&n5?null:e;default:return null}}function AB(e,t){if(ru)return e==="compositionend"||!Pw&&EA(e,t)?(e=CA(),tg=Cw=ys=null,ru=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=s5(n)}}function RA(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?RA(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function MA(){for(var e=window,t=Dg();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Dg(e.document)}return t}function Aw(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function $B(e){var t=MA(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&RA(n.ownerDocument.documentElement,n)){if(r!==null&&Aw(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=a5(n,o);var s=a5(n,r);i&&s&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,iu=null,H_=null,wd=null,q_=!1;function l5(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;q_||iu==null||iu!==Dg(r)||(r=iu,"selectionStart"in r&&Aw(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),wd&&qd(wd,r)||(wd=r,r=zg(H_,"onSelect"),0au||(e.current=Z_[au],Z_[au]=null,au--)}function at(e,t){au++,Z_[au]=e.current,e.current=t}var Ls={},Fn=Qs(Ls),hr=Qs(!1),qa=Ls;function zu(e,t){var n=e.type.contextTypes;if(!n)return Ls;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function pr(e){return e=e.childContextTypes,e!=null}function Gg(){ht(hr),ht(Fn)}function g5(e,t,n){if(Fn.current!==Ls)throw Error(Z(168));at(Fn,t),at(hr,n)}function VA(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(Z(108,MF(e)||"Unknown",i));return kt({},n,r)}function Hg(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ls,qa=Fn.current,at(Fn,e),at(hr,hr.current),!0}function m5(e,t,n){var r=e.stateNode;if(!r)throw Error(Z(169));n?(e=VA(e,t,qa),r.__reactInternalMemoizedMergedChildContext=e,ht(hr),ht(Fn),at(Fn,e)):ht(hr),at(hr,n)}var _o=null,Ay=!1,Z1=!1;function zA(e){_o===null?_o=[e]:_o.push(e)}function XB(e){Ay=!0,zA(e)}function Zs(){if(!Z1&&_o!==null){Z1=!0;var e=0,t=Ke;try{var n=_o;for(Ke=1;e>=s,i-=s,Co=1<<32-gi(t)+i|n<T?(P=x,x=null):P=x.sibling;var E=f(y,x,g[T],b);if(E===null){x===null&&(x=P);break}e&&x&&E.alternate===null&&t(y,x),v=o(E,v,T),w===null?S=E:w.sibling=E,w=E,x=P}if(T===g.length)return n(y,x),bt&&Sa(y,T),S;if(x===null){for(;TT?(P=x,x=null):P=x.sibling;var A=f(y,x,E.value,b);if(A===null){x===null&&(x=P);break}e&&x&&A.alternate===null&&t(y,x),v=o(A,v,T),w===null?S=A:w.sibling=A,w=A,x=P}if(E.done)return n(y,x),bt&&Sa(y,T),S;if(x===null){for(;!E.done;T++,E=g.next())E=d(y,E.value,b),E!==null&&(v=o(E,v,T),w===null?S=E:w.sibling=E,w=E);return bt&&Sa(y,T),S}for(x=r(y,x);!E.done;T++,E=g.next())E=h(x,y,T,E.value,b),E!==null&&(e&&E.alternate!==null&&x.delete(E.key===null?T:E.key),v=o(E,v,T),w===null?S=E:w.sibling=E,w=E);return e&&x.forEach(function($){return t(y,$)}),bt&&Sa(y,T),S}function _(y,v,g,b){if(typeof g=="object"&&g!==null&&g.type===nu&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Qh:e:{for(var S=g.key,w=v;w!==null;){if(w.key===S){if(S=g.type,S===nu){if(w.tag===7){n(y,w.sibling),v=i(w,g.props.children),v.return=y,y=v;break e}}else if(w.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===as&&x5(S)===w.type){n(y,w.sibling),v=i(w,g.props),v.ref=Bc(y,w,g),v.return=y,y=v;break e}n(y,w);break}else t(y,w);w=w.sibling}g.type===nu?(v=Fa(g.props.children,y.mode,b,g.key),v.return=y,y=v):(b=ug(g.type,g.key,g.props,null,y.mode,b),b.ref=Bc(y,v,g),b.return=y,y=b)}return s(y);case tu:e:{for(w=g.key;v!==null;){if(v.key===w)if(v.tag===4&&v.stateNode.containerInfo===g.containerInfo&&v.stateNode.implementation===g.implementation){n(y,v.sibling),v=i(v,g.children||[]),v.return=y,y=v;break e}else{n(y,v);break}else t(y,v);v=v.sibling}v=sb(g,y.mode,b),v.return=y,y=v}return s(y);case as:return w=g._init,_(y,v,w(g._payload),b)}if(ud(g))return p(y,v,g,b);if(Nc(g))return m(y,v,g,b);lp(y,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,v!==null&&v.tag===6?(n(y,v.sibling),v=i(v,g),v.return=y,y=v):(n(y,v),v=ob(g,y.mode,b),v.return=y,y=v),s(y)):n(y,v)}return _}var Gu=YA(!0),QA=YA(!1),ih={},Ki=Qs(ih),Yd=Qs(ih),Qd=Qs(ih);function Ra(e){if(e===ih)throw Error(Z(174));return e}function $w(e,t){switch(at(Qd,t),at(Yd,e),at(Ki,ih),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:D_(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=D_(t,e)}ht(Ki),at(Ki,t)}function Hu(){ht(Ki),ht(Yd),ht(Qd)}function ZA(e){Ra(Qd.current);var t=Ra(Ki.current),n=D_(t,e.type);t!==n&&(at(Yd,e),at(Ki,n))}function Fw(e){Yd.current===e&&(ht(Ki),ht(Yd))}var Tt=Qs(0);function Qg(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var J1=[];function Bw(){for(var e=0;en?n:4,e(!0);var r=eb.transition;eb.transition={};try{e(!1),t()}finally{Ke=n,eb.transition=r}}function p9(){return Yr().memoizedState}function JB(e,t,n){var r=Ps(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},g9(e))m9(t,n);else if(n=qA(e,t,n,r),n!==null){var i=Qn();mi(n,e,r,i),y9(n,t,r)}}function ej(e,t,n){var r=Ps(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(g9(e))m9(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,Si(a,s)){var l=t.interleaved;l===null?(i.next=i,Dw(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=qA(e,t,i,r),n!==null&&(i=Qn(),mi(n,e,r,i),y9(n,t,r))}}function g9(e){var t=e.alternate;return e===At||t!==null&&t===At}function m9(e,t){xd=Zg=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function y9(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Sw(e,n)}}var Jg={readContext:Xr,useCallback:Mn,useContext:Mn,useEffect:Mn,useImperativeHandle:Mn,useInsertionEffect:Mn,useLayoutEffect:Mn,useMemo:Mn,useReducer:Mn,useRef:Mn,useState:Mn,useDebugValue:Mn,useDeferredValue:Mn,useTransition:Mn,useMutableSource:Mn,useSyncExternalStore:Mn,useId:Mn,unstable_isNewReconciler:!1},tj={readContext:Xr,useCallback:function(e,t){return Ni().memoizedState=[e,t===void 0?null:t],e},useContext:Xr,useEffect:T5,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,og(4194308,4,u9.bind(null,t,e),n)},useLayoutEffect:function(e,t){return og(4194308,4,e,t)},useInsertionEffect:function(e,t){return og(4,2,e,t)},useMemo:function(e,t){var n=Ni();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ni();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=JB.bind(null,At,e),[r.memoizedState,e]},useRef:function(e){var t=Ni();return e={current:e},t.memoizedState=e},useState:C5,useDebugValue:Gw,useDeferredValue:function(e){return Ni().memoizedState=e},useTransition:function(){var e=C5(!1),t=e[0];return e=ZB.bind(null,e[1]),Ni().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=At,i=Ni();if(bt){if(n===void 0)throw Error(Z(407));n=n()}else{if(n=t(),pn===null)throw Error(Z(349));Ka&30||t9(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,T5(r9.bind(null,r,o,e),[e]),r.flags|=2048,ef(9,n9.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ni(),t=pn.identifierPrefix;if(bt){var n=To,r=Co;n=(r&~(1<<32-gi(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Zd++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[ji]=t,e[Xd]=r,E9(e,t,!1,!1),t.stateNode=e;e:{switch(s=$_(n,r),n){case"dialog":ct("cancel",e),ct("close",e),i=r;break;case"iframe":case"object":case"embed":ct("load",e),i=r;break;case"video":case"audio":for(i=0;iWu&&(t.flags|=128,r=!0,jc(o,!1),t.lanes=4194304)}else{if(!r)if(e=Qg(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),jc(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!bt)return In(t),null}else 2*Bt()-o.renderingStartTime>Wu&&n!==1073741824&&(t.flags|=128,r=!0,jc(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Bt(),t.sibling=null,n=Tt.current,at(Tt,r?n&1|2:n&1),t):(In(t),null);case 22:case 23:return Yw(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?xr&1073741824&&(In(t),t.subtreeFlags&6&&(t.flags|=8192)):In(t),null;case 24:return null;case 25:return null}throw Error(Z(156,t.tag))}function uj(e,t){switch(Ow(t),t.tag){case 1:return pr(t.type)&&Gg(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hu(),ht(hr),ht(Fn),Bw(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Fw(t),null;case 13:if(ht(Tt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Z(340));Uu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ht(Tt),null;case 4:return Hu(),null;case 10:return Nw(t.type._context),null;case 22:case 23:return Yw(),null;case 24:return null;default:return null}}var cp=!1,$n=!1,cj=typeof WeakSet=="function"?WeakSet:Set,ae=null;function du(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Mt(e,t,r)}else n.current=null}function cS(e,t,n){try{n()}catch(r){Mt(e,t,r)}}var N5=!1;function dj(e,t){if(W_=jg,e=MA(),Aw(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(a=s+i),d!==o||r!==0&&d.nodeType!==3||(l=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++u===i&&(a=s),f===o&&++c===r&&(l=s),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(K_={focusedElem:e,selectionRange:n},jg=!1,ae=t;ae!==null;)if(t=ae,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ae=e;else for(;ae!==null;){t=ae;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,_=p.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?m:si(t.type,m),_);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Z(163))}}catch(b){Mt(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,ae=e;break}ae=t.return}return p=N5,N5=!1,p}function Cd(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&cS(t,n,o)}i=i.next}while(i!==r)}}function Ry(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function dS(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function k9(e){var t=e.alternate;t!==null&&(e.alternate=null,k9(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ji],delete t[Xd],delete t[Q_],delete t[WB],delete t[KB])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function O9(e){return e.tag===5||e.tag===3||e.tag===4}function D5(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||O9(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function fS(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ug));else if(r!==4&&(e=e.child,e!==null))for(fS(e,t,n),e=e.sibling;e!==null;)fS(e,t,n),e=e.sibling}function hS(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(hS(e,t,n),e=e.sibling;e!==null;)hS(e,t,n),e=e.sibling}var Cn=null,ai=!1;function es(e,t,n){for(n=n.child;n!==null;)R9(e,t,n),n=n.sibling}function R9(e,t,n){if(Wi&&typeof Wi.onCommitFiberUnmount=="function")try{Wi.onCommitFiberUnmount(xy,n)}catch{}switch(n.tag){case 5:$n||du(n,t);case 6:var r=Cn,i=ai;Cn=null,es(e,t,n),Cn=r,ai=i,Cn!==null&&(ai?(e=Cn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Cn.removeChild(n.stateNode));break;case 18:Cn!==null&&(ai?(e=Cn,n=n.stateNode,e.nodeType===8?Q1(e.parentNode,n):e.nodeType===1&&Q1(e,n),Gd(e)):Q1(Cn,n.stateNode));break;case 4:r=Cn,i=ai,Cn=n.stateNode.containerInfo,ai=!0,es(e,t,n),Cn=r,ai=i;break;case 0:case 11:case 14:case 15:if(!$n&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&cS(n,t,s),i=i.next}while(i!==r)}es(e,t,n);break;case 1:if(!$n&&(du(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Mt(n,t,a)}es(e,t,n);break;case 21:es(e,t,n);break;case 22:n.mode&1?($n=(r=$n)||n.memoizedState!==null,es(e,t,n),$n=r):es(e,t,n);break;default:es(e,t,n)}}function L5(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new cj),t.forEach(function(r){var i=_j.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function ii(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=Bt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*hj(r/1960))-r,10e?16:e,vs===null)var r=!1;else{if(e=vs,vs=null,nm=0,Fe&6)throw Error(Z(331));var i=Fe;for(Fe|=4,ae=e.current;ae!==null;){var o=ae,s=o.child;if(ae.flags&16){var a=o.deletions;if(a!==null){for(var l=0;lBt()-Kw?$a(e,0):Ww|=n),gr(e,t)}function B9(e,t){t===0&&(e.mode&1?(t=tp,tp<<=1,!(tp&130023424)&&(tp=4194304)):t=1);var n=Qn();e=$o(e,t),e!==null&&(th(e,t,n),gr(e,n))}function bj(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),B9(e,n)}function _j(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Z(314))}r!==null&&r.delete(t),B9(e,n)}var j9;j9=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||hr.current)cr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return cr=!1,aj(e,t,n);cr=!!(e.flags&131072)}else cr=!1,bt&&t.flags&1048576&&UA(t,Wg,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;sg(e,t),e=t.pendingProps;var i=zu(t,Fn.current);xu(t,n),i=Vw(null,t,r,e,i,n);var o=zw();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,pr(r)?(o=!0,Hg(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Lw(t),i.updater=ky,t.stateNode=i,i._reactInternals=t,rS(t,r,e,n),t=sS(null,t,r,!0,o,n)):(t.tag=0,bt&&o&&kw(t),Xn(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(sg(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=wj(r),e=si(r,e),i){case 0:t=oS(null,t,r,e,n);break e;case 1:t=R5(null,t,r,e,n);break e;case 11:t=k5(null,t,r,e,n);break e;case 14:t=O5(null,t,r,si(r.type,e),n);break e}throw Error(Z(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:si(r,i),oS(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:si(r,i),R5(e,t,r,i,n);case 3:e:{if(x9(t),e===null)throw Error(Z(387));r=t.pendingProps,o=t.memoizedState,i=o.element,WA(e,t),Yg(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=qu(Error(Z(423)),t),t=M5(e,t,r,n,i);break e}else if(r!==i){i=qu(Error(Z(424)),t),t=M5(e,t,r,n,i);break e}else for(Tr=Cs(t.stateNode.containerInfo.firstChild),Er=t,bt=!0,ui=null,n=QA(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Uu(),r===i){t=Fo(e,t,n);break e}Xn(e,t,r,n)}t=t.child}return t;case 5:return ZA(t),e===null&&eS(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,X_(r,i)?s=null:o!==null&&X_(r,o)&&(t.flags|=32),w9(e,t),Xn(e,t,s,n),t.child;case 6:return e===null&&eS(t),null;case 13:return C9(e,t,n);case 4:return $w(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Gu(t,null,r,n):Xn(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:si(r,i),k5(e,t,r,i,n);case 7:return Xn(e,t,t.pendingProps,n),t.child;case 8:return Xn(e,t,t.pendingProps.children,n),t.child;case 12:return Xn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,s=i.value,at(Kg,r._currentValue),r._currentValue=s,o!==null)if(Si(o.value,s)){if(o.children===i.children&&!hr.current){t=Fo(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Ao(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),tS(o.return,n,t),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(Z(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),tS(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Xn(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,xu(t,n),i=Xr(i),r=r(i),t.flags|=1,Xn(e,t,r,n),t.child;case 14:return r=t.type,i=si(r,t.pendingProps),i=si(r.type,i),O5(e,t,r,i,n);case 15:return _9(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:si(r,i),sg(e,t),t.tag=1,pr(r)?(e=!0,Hg(t)):e=!1,xu(t,n),XA(t,r,i),rS(t,r,i,n),sS(null,t,r,!0,e,n);case 19:return T9(e,t,n);case 22:return S9(e,t,n)}throw Error(Z(156,t.tag))};function V9(e,t){return hA(e,t)}function Sj(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qr(e,t,n,r){return new Sj(e,t,n,r)}function Zw(e){return e=e.prototype,!(!e||!e.isReactComponent)}function wj(e){if(typeof e=="function")return Zw(e)?1:0;if(e!=null){if(e=e.$$typeof,e===yw)return 11;if(e===vw)return 14}return 2}function As(e,t){var n=e.alternate;return n===null?(n=qr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ug(e,t,n,r,i,o){var s=2;if(r=e,typeof e=="function")Zw(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case nu:return Fa(n.children,i,o,t);case mw:s=8,i|=8;break;case P_:return e=qr(12,n,t,i|2),e.elementType=P_,e.lanes=o,e;case A_:return e=qr(13,n,t,i),e.elementType=A_,e.lanes=o,e;case k_:return e=qr(19,n,t,i),e.elementType=k_,e.lanes=o,e;case YP:return Iy(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case KP:s=10;break e;case XP:s=9;break e;case yw:s=11;break e;case vw:s=14;break e;case as:s=16,r=null;break e}throw Error(Z(130,e==null?e:typeof e,""))}return t=qr(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function Fa(e,t,n,r){return e=qr(7,e,r,t),e.lanes=n,e}function Iy(e,t,n,r){return e=qr(22,e,r,t),e.elementType=YP,e.lanes=n,e.stateNode={isHidden:!1},e}function ob(e,t,n){return e=qr(6,e,null,t),e.lanes=n,e}function sb(e,t,n){return t=qr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function xj(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=j1(0),this.expirationTimes=j1(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=j1(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Jw(e,t,n,r,i,o,s,a,l){return e=new xj(e,t,n,a,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=qr(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Lw(o),e}function Cj(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(H9)}catch(e){console.error(e)}}H9(),UP.exports=Mr;var Vi=UP.exports;const hwe=ll(Vi);var G5=Vi;T_.createRoot=G5.createRoot,T_.hydrateRoot=G5.hydrateRoot;const kj="modulepreload",Oj=function(e,t){return new URL(e,t).href},H5={},q9=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=Oj(o,r),o in H5)return;H5[o]=!0;const s=o.endsWith(".css"),a=s?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const d=i[c];if(d.href===o&&(!s||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const u=document.createElement("link");if(u.rel=s?"stylesheet":kj,s||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),s)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})};var W9={exports:{}},K9={};/** + * @license React + * use-sync-external-store-shim.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 Ku=k;function Rj(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Mj=typeof Object.is=="function"?Object.is:Rj,Ij=Ku.useState,Nj=Ku.useEffect,Dj=Ku.useLayoutEffect,Lj=Ku.useDebugValue;function $j(e,t){var n=t(),r=Ij({inst:{value:n,getSnapshot:t}}),i=r[0].inst,o=r[1];return Dj(function(){i.value=n,i.getSnapshot=t,ab(i)&&o({inst:i})},[e,n,t]),Nj(function(){return ab(i)&&o({inst:i}),e(function(){ab(i)&&o({inst:i})})},[e]),Lj(n),n}function ab(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Mj(e,n)}catch{return!0}}function Fj(e,t){return t()}var Bj=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Fj:$j;K9.useSyncExternalStore=Ku.useSyncExternalStore!==void 0?Ku.useSyncExternalStore:Bj;W9.exports=K9;var jj=W9.exports,X9={exports:{}},Y9={};/** + * @license React + * use-sync-external-store-shim/with-selector.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 Fy=k,Vj=jj;function zj(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Uj=typeof Object.is=="function"?Object.is:zj,Gj=Vj.useSyncExternalStore,Hj=Fy.useRef,qj=Fy.useEffect,Wj=Fy.useMemo,Kj=Fy.useDebugValue;Y9.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=Hj(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=Wj(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),i!==void 0&&s.hasValue){var p=s.value;if(i(p,h))return d=p}return d=h}if(p=d,Uj(c,h))return p;var m=r(h);return i!==void 0&&i(p,m)?p:(c=h,d=m)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,r,i]);var a=Gj(e,o[0],o[1]);return qj(function(){s.hasValue=!0,s.value=a},[a]),Kj(a),a};X9.exports=Y9;var Q9=X9.exports;const Xj=ll(Q9);function Yj(e){e()}let Z9=Yj;const Qj=e=>Z9=e,Zj=()=>Z9,q5=Symbol.for(`react-redux-context-${k.version}`),W5=globalThis;function Jj(){let e=W5[q5];return e||(e=k.createContext(null),W5[q5]=e),e}const $s=new Proxy({},new Proxy({},{get(e,t){const n=Jj();return(r,...i)=>Reflect[t](n,...i)}}));function rx(e=$s){return function(){return k.useContext(e)}}const J9=rx(),eV=()=>{throw new Error("uSES not initialized!")};let ek=eV;const tV=e=>{ek=e},nV=(e,t)=>e===t;function rV(e=$s){const t=e===$s?J9:rx(e);return function(r,i={}){const{equalityFn:o=nV,stabilityCheck:s=void 0,noopCheck:a=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:l,subscription:u,getServerState:c,stabilityCheck:d,noopCheck:f}=t();k.useRef(!0);const h=k.useCallback({[r.name](m){return r(m)}}[r.name],[r,d,s]),p=ek(u.addNestedSub,l.getState,c||l.getState,h,o);return k.useDebugValue(p),p}}const tk=rV();function om(){return om=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const K5={notify(){},get:()=>[]};function gV(e,t){let n,r=K5;function i(d){return l(),r.subscribe(d)}function o(){r.notify()}function s(){c.onStateChange&&c.onStateChange()}function a(){return!!n}function l(){n||(n=t?t.addNestedSub(s):e.subscribe(s),r=pV())}function u(){n&&(n(),n=void 0,r.clear(),r=K5)}const c={addNestedSub:i,notifyNestedSubs:o,handleChangeWrapper:s,isSubscribed:a,trySubscribe:l,tryUnsubscribe:u,getListeners:()=>r};return c}const mV=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",yV=mV?k.useLayoutEffect:k.useEffect;function X5(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function sm(e,t){if(X5(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const u=gV(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),a=k.useMemo(()=>e.getState(),[e]);yV(()=>{const{subscription:u}=s;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),a!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[s,a]);const l=t||$s;return We.createElement(l.Provider,{value:s},n)}function ak(e=$s){const t=e===$s?J9:rx(e);return function(){const{store:r}=t();return r}}const lk=ak();function bV(e=$s){const t=e===$s?lk:ak(e);return function(){return t().dispatch}}const uk=bV();tV(Q9.useSyncExternalStoreWithSelector);Qj(Vi.unstable_batchedUpdates);function hn(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:o0(e)?2:s0(e)?3:0}function ks(e,t){return Fs(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function cg(e,t){return Fs(e)===2?e.get(t):e[t]}function ck(e,t,n){var r=Fs(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function dk(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function o0(e){return TV&&e instanceof Map}function s0(e){return EV&&e instanceof Set}function ln(e){return e.o||e.t}function cx(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=hk(e);delete t[Se];for(var n=Eu(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=_V),Object.freeze(e),t&&Bo(e,function(n,r){return oh(r,!0)},!0)),e}function _V(){hn(2)}function dx(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function Xi(e){var t=bS[e];return t||hn(18,e),t}function fx(e,t){bS[e]||(bS[e]=t)}function nf(){return of}function lb(e,t){t&&(Xi("Patches"),e.u=[],e.s=[],e.v=t)}function am(e){vS(e),e.p.forEach(SV),e.p=null}function vS(e){e===of&&(of=e.l)}function Y5(e){return of={p:[],l:of,h:e,m:!0,_:0}}function SV(e){var t=e[Se];t.i===0||t.i===1?t.j():t.g=!0}function ub(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||Xi("ES5").S(t,e,r),r?(n[Se].P&&(am(t),hn(4)),mr(e)&&(e=lm(t,e),t.l||um(t,e)),t.u&&Xi("Patches").M(n[Se].t,e,t.u,t.s)):e=lm(t,n,[]),am(t),t.u&&t.v(t.u,t.s),e!==l0?e:void 0}function lm(e,t,n){if(dx(t))return t;var r=t[Se];if(!r)return Bo(t,function(a,l){return Q5(e,r,t,a,l,n)},!0),t;if(r.A!==e)return t;if(!r.P)return um(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=cx(r.k):r.o,o=i,s=!1;r.i===3&&(o=new Set(i),i.clear(),s=!0),Bo(o,function(a,l){return Q5(e,r,i,a,l,n,s)}),um(e,i,!1),n&&e.u&&Xi("Patches").N(r,n,e.u,e.s)}return r.o}function Q5(e,t,n,r,i,o,s){if(Jn(i)){var a=lm(e,i,o&&t&&t.i!==3&&!ks(t.R,r)?o.concat(r):void 0);if(ck(n,r,a),!Jn(a))return;e.m=!1}else s&&n.add(i);if(mr(i)&&!dx(i)){if(!e.h.D&&e._<1)return;lm(e,i),t&&t.A.l||um(e,i)}}function um(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&oh(t,n)}function cb(e,t){var n=e[Se];return(n?ln(n):e)[t]}function Z5(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function ur(e){e.P||(e.P=!0,e.l&&ur(e.l))}function db(e){e.o||(e.o=cx(e.t))}function rf(e,t,n){var r=o0(t)?Xi("MapSet").F(t,n):s0(t)?Xi("MapSet").T(t,n):e.O?function(i,o){var s=Array.isArray(i),a={i:s?1:0,A:o?o.A:nf(),P:!1,I:!1,R:{},l:o,t:i,k:null,o:null,j:null,C:!1},l=a,u=sf;s&&(l=[a],u=fd);var c=Proxy.revocable(l,u),d=c.revoke,f=c.proxy;return a.k=f,a.j=d,f}(t,n):Xi("ES5").J(t,n);return(n?n.A:nf()).p.push(r),r}function a0(e){return Jn(e)||hn(22,e),function t(n){if(!mr(n))return n;var r,i=n[Se],o=Fs(n);if(i){if(!i.P&&(i.i<4||!Xi("ES5").K(i)))return i.t;i.I=!0,r=J5(n,o),i.I=!1}else r=J5(n,o);return Bo(r,function(s,a){i&&cg(i.t,s)===a||ck(r,s,t(a))}),o===3?new Set(r):r}(e)}function J5(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return cx(e)}function hx(){function e(o,s){var a=i[o];return a?a.enumerable=s:i[o]=a={configurable:!0,enumerable:s,get:function(){var l=this[Se];return sf.get(l,o)},set:function(l){var u=this[Se];sf.set(u,o,l)}},a}function t(o){for(var s=o.length-1;s>=0;s--){var a=o[s][Se];if(!a.P)switch(a.i){case 5:r(a)&&ur(a);break;case 4:n(a)&&ur(a)}}}function n(o){for(var s=o.t,a=o.k,l=Eu(a),u=l.length-1;u>=0;u--){var c=l[u];if(c!==Se){var d=s[c];if(d===void 0&&!ks(s,c))return!0;var f=a[c],h=f&&f[Se];if(h?h.t!==d:!dk(f,d))return!0}}var p=!!s[Se];return l.length!==Eu(s).length+(p?0:1)}function r(o){var s=o.k;if(s.length!==o.t.length)return!0;var a=Object.getOwnPropertyDescriptor(s,s.length-1);if(a&&!a.get)return!0;for(var l=0;l1?y-1:0),g=1;g1?c-1:0),f=1;f=0;i--){var o=r[i];if(o.path.length===0&&o.op==="replace"){n=o.value;break}}i>-1&&(r=r.slice(i+1));var s=Xi("Patches").$;return Jn(n)?s(n,r):this.produce(n,function(a){return s(a,r)})},e}(),kr=new pk,gk=kr.produce,mx=kr.produceWithPatches.bind(kr),AV=kr.setAutoFreeze.bind(kr),kV=kr.setUseProxies.bind(kr),_S=kr.applyPatches.bind(kr),OV=kr.createDraft.bind(kr),RV=kr.finishDraft.bind(kr);const Js=gk,pwe=Object.freeze(Object.defineProperty({__proto__:null,Immer:pk,applyPatches:_S,castDraft:xV,castImmutable:CV,createDraft:OV,current:a0,default:Js,enableAllPlugins:wV,enableES5:hx,enableMapSet:fk,enablePatches:px,finishDraft:RV,freeze:oh,immerable:Tu,isDraft:Jn,isDraftable:mr,nothing:l0,original:ux,produce:gk,produceWithPatches:mx,setAutoFreeze:AV,setUseProxies:kV},Symbol.toStringTag,{value:"Module"}));function af(e){"@babel/helpers - typeof";return af=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},af(e)}function MV(e,t){if(af(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(af(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function IV(e){var t=MV(e,"string");return af(t)==="symbol"?t:String(t)}function NV(e,t,n){return t=IV(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function r4(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Tn(1));return n(sh)(e,t)}if(typeof e!="function")throw new Error(Tn(2));var i=e,o=t,s=[],a=s,l=!1;function u(){a===s&&(a=s.slice())}function c(){if(l)throw new Error(Tn(3));return o}function d(m){if(typeof m!="function")throw new Error(Tn(4));if(l)throw new Error(Tn(5));var _=!0;return u(),a.push(m),function(){if(_){if(l)throw new Error(Tn(6));_=!1,u();var v=a.indexOf(m);a.splice(v,1),s=null}}}function f(m){if(!DV(m))throw new Error(Tn(7));if(typeof m.type>"u")throw new Error(Tn(8));if(l)throw new Error(Tn(9));try{l=!0,o=i(o,m)}finally{l=!1}for(var _=s=a,y=0;y<_.length;y++){var v=_[y];v()}return m}function h(m){if(typeof m!="function")throw new Error(Tn(10));i=m,f({type:Xu.REPLACE})}function p(){var m,_=d;return m={subscribe:function(v){if(typeof v!="object"||v===null)throw new Error(Tn(11));function g(){v.next&&v.next(c())}g();var b=_(g);return{unsubscribe:b}}},m[i4]=function(){return this},m}return f({type:Xu.INIT}),r={dispatch:f,subscribe:d,getState:c,replaceReducer:h},r[i4]=p,r}var mk=sh;function LV(e){Object.keys(e).forEach(function(t){var n=e[t],r=n(void 0,{type:Xu.INIT});if(typeof r>"u")throw new Error(Tn(12));if(typeof n(void 0,{type:Xu.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Tn(13))})}function mc(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(Tn(14));d[h]=_,c=c||_!==m}return c=c||o.length!==Object.keys(l).length,c?d:l}}function o4(e,t){return function(){return t(e.apply(this,arguments))}}function yk(e,t){if(typeof e=="function")return o4(e,t);if(typeof e!="object"||e===null)throw new Error(Tn(16));var n={};for(var r in e){var i=e[r];typeof i=="function"&&(n[r]=o4(i,t))}return n}function Yu(){for(var e=arguments.length,t=new Array(e),n=0;n-1){var u=n[l];return l>0&&(n.splice(l,1),n.unshift(u)),u.value}return cm}function i(a,l){r(a)===cm&&(n.unshift({key:a,value:l}),n.length>e&&n.pop())}function o(){return n}function s(){n=[]}return{get:r,put:i,getEntries:o,clear:s}}var vk=function(t,n){return t===n};function jV(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,o=0;o1?t-1:0),r=1;r0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]",value:e};if(typeof e!="object"||e===null||o!=null&&o.has(e))return!1;for(var a=r!=null?r(e):Object.entries(e),l=i.length>0,u=function(_,y){var v=t?t+"."+_:_;if(l){var g=i.some(function(b){return b instanceof RegExp?b.test(v):v===b});if(g)return"continue"}if(!n(y))return{value:{keyPath:v,value:y}};if(typeof y=="object"&&(s=Ek(y,v,n,r,i,o),s))return{value:s}},c=0,d=a;c-1}function nz(e){return""+e}function Rk(e){var t={},n=[],r,i={addCase:function(o,s){var a=typeof o=="string"?o:o.type;if(a in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[a]=s,i},addMatcher:function(o,s){return n.push({matcher:o,reducer:s}),i},addDefaultCase:function(o){return r=o,i}};return e(i),[t,n,r]}function rz(e){return typeof e=="function"}function Mk(e,t,n,r){n===void 0&&(n=[]);var i=typeof t=="function"?Rk(t):[t,n,r],o=i[0],s=i[1],a=i[2],l;if(rz(e))l=function(){return SS(e())};else{var u=SS(e);l=function(){return u}}function c(d,f){d===void 0&&(d=l());var h=Bs([o[f.type]],s.filter(function(p){var m=p.matcher;return m(f)}).map(function(p){var m=p.reducer;return m}));return h.filter(function(p){return!!p}).length===0&&(h=[a]),h.reduce(function(p,m){if(m)if(Jn(p)){var _=p,y=m(_,f);return y===void 0?p:y}else{if(mr(p))return Js(p,function(v){return m(v,f)});var y=m(p,f);if(y===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return y}return p},d)}return c.getInitialState=l,c}function iz(e,t){return e+"/"+t}function Et(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");typeof process<"u";var n=typeof e.initialState=="function"?e.initialState:SS(e.initialState),r=e.reducers||{},i=Object.keys(r),o={},s={},a={};i.forEach(function(c){var d=r[c],f=iz(t,c),h,p;"reducer"in d?(h=d.reducer,p=d.prepare):h=d,o[c]=h,s[f]=h,a[c]=p?ue(f,p):ue(f)});function l(){var c=typeof e.extraReducers=="function"?Rk(e.extraReducers):[e.extraReducers],d=c[0],f=d===void 0?{}:d,h=c[1],p=h===void 0?[]:h,m=c[2],_=m===void 0?void 0:m,y=dr(dr({},f),s);return Mk(n,function(v){for(var g in y)v.addCase(g,y[g]);for(var b=0,S=p;b0;if(v){var g=p.filter(function(b){return u(_,b,m)}).length>0;g&&(m.ids=Object.keys(m.entities))}}function f(p,m){return h([p],m)}function h(p,m){var _=Ik(p,e,m),y=_[0],v=_[1];d(v,m),n(y,m)}return{removeAll:lz(l),addOne:Lt(t),addMany:Lt(n),setOne:Lt(r),setMany:Lt(i),setAll:Lt(o),updateOne:Lt(c),updateMany:Lt(d),upsertOne:Lt(f),upsertMany:Lt(h),removeOne:Lt(s),removeMany:Lt(a)}}function uz(e,t){var n=Nk(e),r=n.removeOne,i=n.removeMany,o=n.removeAll;function s(v,g){return a([v],g)}function a(v,g){v=Ba(v);var b=v.filter(function(S){return!(Pd(S,e)in g.entities)});b.length!==0&&_(b,g)}function l(v,g){return u([v],g)}function u(v,g){v=Ba(v),v.length!==0&&_(v,g)}function c(v,g){v=Ba(v),g.entities={},g.ids=[],a(v,g)}function d(v,g){return f([v],g)}function f(v,g){for(var b=!1,S=0,w=v;S-1;return n&&r}function uh(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function d0(){for(var e=[],t=0;t0)for(var g=h.getState(),b=Array.from(n.values()),S=0,w=b;SMath.floor(e/t)*t,zi=(e,t)=>Math.round(e/t)*t;var Pz=typeof global=="object"&&global&&global.Object===Object&&global;const Zk=Pz;var Az=typeof self=="object"&&self&&self.Object===Object&&self,kz=Zk||Az||Function("return this")();const io=kz;var Oz=io.Symbol;const Qr=Oz;var Jk=Object.prototype,Rz=Jk.hasOwnProperty,Mz=Jk.toString,zc=Qr?Qr.toStringTag:void 0;function Iz(e){var t=Rz.call(e,zc),n=e[zc];try{e[zc]=void 0;var r=!0}catch{}var i=Mz.call(e);return r&&(t?e[zc]=n:delete e[zc]),i}var Nz=Object.prototype,Dz=Nz.toString;function Lz(e){return Dz.call(e)}var $z="[object Null]",Fz="[object Undefined]",h4=Qr?Qr.toStringTag:void 0;function na(e){return e==null?e===void 0?Fz:$z:h4&&h4 in Object(e)?Iz(e):Lz(e)}function xi(e){return e!=null&&typeof e=="object"}var Bz="[object Symbol]";function f0(e){return typeof e=="symbol"||xi(e)&&na(e)==Bz}function eO(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n0){if(++t>=yU)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function SU(e){return function(){return e}}var wU=function(){try{var e=fl(Object,"defineProperty");return e({},"",{}),e}catch{}}();const pm=wU;var xU=pm?function(e,t){return pm(e,"toString",{configurable:!0,enumerable:!1,value:SU(t),writable:!0})}:h0;const CU=xU;var TU=_U(CU);const iO=TU;function oO(e,t){for(var n=-1,r=e==null?0:e.length;++n-1}var RU=9007199254740991,MU=/^(?:0|[1-9]\d*)$/;function wx(e,t){var n=typeof e;return t=t??RU,!!t&&(n=="number"||n!="symbol"&&MU.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=DU}function vc(e){return e!=null&&Cx(e.length)&&!Sx(e)}function uO(e,t,n){if(!yr(n))return!1;var r=typeof t;return(r=="number"?vc(n)&&wx(t,n.length):r=="string"&&t in n)?hh(n[t],e):!1}function cO(e){return lO(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,s&&uO(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++r-1}function YG(e,t){var n=this.__data__,r=p0(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Go(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0&&n(a)?t>1?yO(a,t-1,n,r,i):Rx(i,a):r||(i[i.length]=a)}return i}function pH(e){var t=e==null?0:e.length;return t?yO(e,1):[]}function gH(e){return iO(aO(e,void 0,pH),e+"")}var mH=gO(Object.getPrototypeOf,Object);const Mx=mH;var yH="[object Object]",vH=Function.prototype,bH=Object.prototype,vO=vH.toString,_H=bH.hasOwnProperty,SH=vO.call(Object);function bO(e){if(!xi(e)||na(e)!=yH)return!1;var t=Mx(e);if(t===null)return!0;var n=_H.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&vO.call(n)==SH}function _O(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r=r?e:_O(e,t,n)}var xH="\\ud800-\\udfff",CH="\\u0300-\\u036f",TH="\\ufe20-\\ufe2f",EH="\\u20d0-\\u20ff",PH=CH+TH+EH,AH="\\ufe0e\\ufe0f",kH="\\u200d",OH=RegExp("["+kH+xH+PH+AH+"]");function Ix(e){return OH.test(e)}function RH(e){return e.split("")}var SO="\\ud800-\\udfff",MH="\\u0300-\\u036f",IH="\\ufe20-\\ufe2f",NH="\\u20d0-\\u20ff",DH=MH+IH+NH,LH="\\ufe0e\\ufe0f",$H="["+SO+"]",TS="["+DH+"]",ES="\\ud83c[\\udffb-\\udfff]",FH="(?:"+TS+"|"+ES+")",wO="[^"+SO+"]",xO="(?:\\ud83c[\\udde6-\\uddff]){2}",CO="[\\ud800-\\udbff][\\udc00-\\udfff]",BH="\\u200d",TO=FH+"?",EO="["+LH+"]?",jH="(?:"+BH+"(?:"+[wO,xO,CO].join("|")+")"+EO+TO+")*",VH=EO+TO+jH,zH="(?:"+[wO+TS+"?",TS,xO,CO,$H].join("|")+")",UH=RegExp(ES+"(?="+ES+")|"+zH+VH,"g");function GH(e){return e.match(UH)||[]}function HH(e){return Ix(e)?GH(e):RH(e)}function qH(e){return function(t){t=m0(t);var n=Ix(t)?HH(t):void 0,r=n?n[0]:t.charAt(0),i=n?wH(n,1).join(""):t.slice(1);return r[e]()+i}}var WH=qH("toUpperCase");const KH=WH;function PO(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i=t?e:t)),e}function bs(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=gb(n),n=n===n?n:0),t!==void 0&&(t=gb(t),t=t===t?t:0),Fq(gb(e),t,n)}function Bq(){this.__data__=new Go,this.size=0}function jq(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Vq(e){return this.__data__.get(e)}function zq(e){return this.__data__.has(e)}var Uq=200;function Gq(e,t){var n=this.__data__;if(n instanceof Go){var r=n.__data__;if(!df||r.lengtha))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,h=n&CK?new ff:void 0;for(o.set(e,t),o.set(t,e);++d1),o}),yc(e,WO(e),n),r&&(n=kd(n,AX|kX|OX,PX));for(var i=t.length;i--;)lR(n,t[i]);return n});const x0=RX;var MX=iR("length");const IX=MX;var uR="\\ud800-\\udfff",NX="\\u0300-\\u036f",DX="\\ufe20-\\ufe2f",LX="\\u20d0-\\u20ff",$X=NX+DX+LX,FX="\\ufe0e\\ufe0f",BX="["+uR+"]",MS="["+$X+"]",IS="\\ud83c[\\udffb-\\udfff]",jX="(?:"+MS+"|"+IS+")",cR="[^"+uR+"]",dR="(?:\\ud83c[\\udde6-\\uddff]){2}",fR="[\\ud800-\\udbff][\\udc00-\\udfff]",VX="\\u200d",hR=jX+"?",pR="["+FX+"]?",zX="(?:"+VX+"(?:"+[cR,dR,fR].join("|")+")"+pR+hR+")*",UX=pR+hR+zX,GX="(?:"+[cR+MS+"?",MS,dR,fR,BX].join("|")+")",q4=RegExp(IS+"(?="+IS+")|"+GX+UX,"g");function HX(e){for(var t=q4.lastIndex=0;q4.test(e);)++t;return t}function qX(e){return Ix(e)?HX(e):IX(e)}function WX(e,t,n,r,i){return i(e,function(o,s,a){n=r?(r=!1,o):t(n,o,s,a)}),n}function $x(e,t,n){var r=gn(e)?PO:WX,i=arguments.length<3;return r(e,b0(t),n,i,_0)}var KX="[object Map]",XX="[object Set]";function gR(e){if(e==null)return 0;if(vc(e))return xX(e)?qX(e):e.length;var t=Ju(e);return t==KX||t==XX?e.size:mO(e).length}function YX(e,t){var n;return _0(e,function(r,i,o){return n=t(r,i,o),!n}),!!n}function Pa(e,t,n){var r=gn(e)?JO:YX;return n&&uO(e,t,n)&&(t=void 0),r(e,b0(t))}var QX=$q(function(e,t,n){return e+(n?" ":"")+KH(t)});const ZX=QX;var JX=1/0,eY=Ou&&1/Lx(new Ou([,-0]))[1]==JX?function(e){return new Ou(e)}:mU;const tY=eY;var nY=200;function mR(e,t,n){var r=-1,i=OU,o=e.length,s=!0,a=[],l=a;if(n)s=!1,i=vX;else if(o>=nY){var u=t?null:tY(e);if(u)return Lx(u);s=!1,i=eR,l=new ff}else l=t?[]:a;e:for(;++r{EX(e,t.payload)}}}),{configChanged:sY}=vR.actions,aY=vR.reducer,ywe={"sd-1":"Stable Diffusion 1.x","sd-2":"Stable Diffusion 2.x",sdxl:"Stable Diffusion XL","sdxl-refiner":"Stable Diffusion XL Refiner"},lY={"sd-1":{maxClip:12,markers:[0,1,2,3,4,8,12]},"sd-2":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},sdxl:{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},"sdxl-refiner":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]}},vwe=0,uY=4294967295;var Ve;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const s of i)o[s]=s;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(const a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(const s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Ve||(Ve={}));var NS;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(NS||(NS={}));const re=Ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gs=e=>{switch(typeof e){case"undefined":return re.undefined;case"string":return re.string;case"number":return isNaN(e)?re.nan:re.number;case"boolean":return re.boolean;case"function":return re.function;case"bigint":return re.bigint;case"symbol":return re.symbol;case"object":return Array.isArray(e)?re.array:e===null?re.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?re.promise:typeof Map<"u"&&e instanceof Map?re.map:typeof Set<"u"&&e instanceof Set?re.set:typeof Date<"u"&&e instanceof Date?re.date:re.object;default:return re.unknown}},ee=Ve.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),cY=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class vi extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}vi.create=e=>new vi(e);const hf=(e,t)=>{let n;switch(e.code){case ee.invalid_type:e.received===re.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case ee.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ve.jsonStringifyReplacer)}`;break;case ee.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ve.joinValues(e.keys,", ")}`;break;case ee.invalid_union:n="Invalid input";break;case ee.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ve.joinValues(e.options)}`;break;case ee.invalid_enum_value:n=`Invalid enum value. Expected ${Ve.joinValues(e.options)}, received '${e.received}'`;break;case ee.invalid_arguments:n="Invalid function arguments";break;case ee.invalid_return_type:n="Invalid function return type";break;case ee.invalid_date:n="Invalid date";break;case ee.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ve.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case ee.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case ee.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case ee.custom:n="Invalid input";break;case ee.invalid_intersection_types:n="Intersection results could not be merged";break;case ee.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ee.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ve.assertNever(e)}return{message:n}};let bR=hf;function dY(e){bR=e}function mm(){return bR}const ym=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],s={...i,path:o};let a="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:i.message||a}},fY=[];function oe(e,t){const n=ym({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,mm(),hf].filter(r=>!!r)});e.common.issues.push(n)}class Bn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return be;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n)r.push({key:await i.key,value:await i.value});return Bn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return be;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),(typeof s.value<"u"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:t.value,value:r}}}const be=Object.freeze({status:"aborted"}),_R=e=>({status:"dirty",value:e}),er=e=>({status:"valid",value:e}),DS=e=>e.status==="aborted",LS=e=>e.status==="dirty",vm=e=>e.status==="valid",bm=e=>typeof Promise<"u"&&e instanceof Promise;var ge;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ge||(ge={}));class Ji{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const W4=(e,t)=>{if(vm(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new vi(e.common.issues);return this._error=n,this._error}}};function we(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,a)=>s.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:r??a.defaultError}:{message:n??a.defaultError},description:i}}class Ce{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return gs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:gs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Bn,ctx:{common:t.parent.common,data:t.data,parsedType:gs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(bm(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:gs(t)},o=this._parseSync({data:t,path:i.path,parent:i});return W4(i,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:gs(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(bm(i)?i:Promise.resolve(i));return W4(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const s=t(i),a=()=>o.addIssue({code:ee.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Ci({schema:this,typeName:ye.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return ko.create(this,this._def)}nullable(){return tl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bi.create(this,this._def)}promise(){return tc.create(this,this._def)}or(t){return yf.create([this,t],this._def)}and(t){return vf.create(this,t,this._def)}transform(t){return new Ci({...we(this._def),schema:this,typeName:ye.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new xf({...we(this._def),innerType:this,defaultValue:n,typeName:ye.ZodDefault})}brand(){return new wR({typeName:ye.ZodBranded,type:this,...we(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new xm({...we(this._def),innerType:this,catchValue:n,typeName:ye.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return yh.create(this,t)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const hY=/^c[^\s-]{8,}$/i,pY=/^[a-z][a-z0-9]*$/,gY=/[0-9A-HJKMNP-TV-Z]{26}/,mY=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,yY=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,vY=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,bY=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,_Y=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,SY=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function wY(e,t){return!!((t==="v4"||!t)&&bY.test(e)||(t==="v6"||!t)&&_Y.test(e))}class hi extends Ce{constructor(){super(...arguments),this._regex=(t,n,r)=>this.refinement(i=>t.test(i),{validation:n,code:ee.invalid_string,...ge.errToObj(r)}),this.nonempty=t=>this.min(1,ge.errToObj(t)),this.trim=()=>new hi({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new hi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new hi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==re.string){const o=this._getOrReturnCtx(t);return oe(o,{code:ee.invalid_type,expected:re.string,received:o.parsedType}),be}const r=new Bn;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(i=this._getOrReturnCtx(t,i),oe(i,{code:ee.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const s=t.data.length>o.value,a=t.data.length"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...ge.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ge.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...ge.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ge.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ge.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ge.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ge.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ge.errToObj(n)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new hi({checks:[],typeName:ye.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...we(e)})};function xY(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(e.toFixed(i).replace(".","")),s=parseInt(t.toFixed(i).replace(".",""));return o%s/Math.pow(10,i)}class Vs extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==re.number){const o=this._getOrReturnCtx(t);return oe(o,{code:ee.invalid_type,expected:re.number,received:o.parsedType}),be}let r;const i=new Bn;for(const o of this._def.checks)o.kind==="int"?Ve.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{code:ee.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:ee.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?xY(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),oe(r,{code:ee.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{code:ee.not_finite,message:o.message}),i.dirty()):Ve.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ge.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ge.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ge.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ge.toString(n))}setLimit(t,n,r,i){return new Vs({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ge.toString(i)}]})}_addCheck(t){return new Vs({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ge.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ge.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ge.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ge.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ge.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ge.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Ve.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew Vs({checks:[],typeName:ye.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...we(e)});class zs extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==re.bigint){const o=this._getOrReturnCtx(t);return oe(o,{code:ee.invalid_type,expected:re.bigint,received:o.parsedType}),be}let r;const i=new Bn;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:ee.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:ee.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Ve.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ge.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ge.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ge.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ge.toString(n))}setLimit(t,n,r,i){return new zs({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ge.toString(i)}]})}_addCheck(t){return new zs({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ge.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new zs({checks:[],typeName:ye.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...we(e)})};class pf extends Ce{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==re.boolean){const r=this._getOrReturnCtx(t);return oe(r,{code:ee.invalid_type,expected:re.boolean,received:r.parsedType}),be}return er(t.data)}}pf.create=e=>new pf({typeName:ye.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...we(e)});class Ja extends Ce{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==re.date){const o=this._getOrReturnCtx(t);return oe(o,{code:ee.invalid_type,expected:re.date,received:o.parsedType}),be}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return oe(o,{code:ee.invalid_date}),be}const r=new Bn;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(i=this._getOrReturnCtx(t,i),oe(i,{code:ee.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Ve.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Ja({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ge.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ge.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Ja({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ye.ZodDate,...we(e)});class _m extends Ce{_parse(t){if(this._getType(t)!==re.symbol){const r=this._getOrReturnCtx(t);return oe(r,{code:ee.invalid_type,expected:re.symbol,received:r.parsedType}),be}return er(t.data)}}_m.create=e=>new _m({typeName:ye.ZodSymbol,...we(e)});class gf extends Ce{_parse(t){if(this._getType(t)!==re.undefined){const r=this._getOrReturnCtx(t);return oe(r,{code:ee.invalid_type,expected:re.undefined,received:r.parsedType}),be}return er(t.data)}}gf.create=e=>new gf({typeName:ye.ZodUndefined,...we(e)});class mf extends Ce{_parse(t){if(this._getType(t)!==re.null){const r=this._getOrReturnCtx(t);return oe(r,{code:ee.invalid_type,expected:re.null,received:r.parsedType}),be}return er(t.data)}}mf.create=e=>new mf({typeName:ye.ZodNull,...we(e)});class ec extends Ce{constructor(){super(...arguments),this._any=!0}_parse(t){return er(t.data)}}ec.create=e=>new ec({typeName:ye.ZodAny,...we(e)});class ja extends Ce{constructor(){super(...arguments),this._unknown=!0}_parse(t){return er(t.data)}}ja.create=e=>new ja({typeName:ye.ZodUnknown,...we(e)});class jo extends Ce{_parse(t){const n=this._getOrReturnCtx(t);return oe(n,{code:ee.invalid_type,expected:re.never,received:n.parsedType}),be}}jo.create=e=>new jo({typeName:ye.ZodNever,...we(e)});class Sm extends Ce{_parse(t){if(this._getType(t)!==re.undefined){const r=this._getOrReturnCtx(t);return oe(r,{code:ee.invalid_type,expected:re.void,received:r.parsedType}),be}return er(t.data)}}Sm.create=e=>new Sm({typeName:ye.ZodVoid,...we(e)});class bi extends Ce{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==re.array)return oe(n,{code:ee.invalid_type,expected:re.array,received:n.parsedType}),be;if(i.exactLength!==null){const s=n.data.length>i.exactLength.value,a=n.data.lengthi.maxLength.value&&(oe(n,{code:ee.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>i.type._parseAsync(new Ji(n,s,n.path,a)))).then(s=>Bn.mergeArray(r,s));const o=[...n.data].map((s,a)=>i.type._parseSync(new Ji(n,s,n.path,a)));return Bn.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new bi({...this._def,minLength:{value:t,message:ge.toString(n)}})}max(t,n){return new bi({...this._def,maxLength:{value:t,message:ge.toString(n)}})}length(t,n){return new bi({...this._def,exactLength:{value:t,message:ge.toString(n)}})}nonempty(t){return this.min(1,t)}}bi.create=(e,t)=>new bi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ye.ZodArray,...we(t)});function Xl(e){if(e instanceof Ct){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ko.create(Xl(r))}return new Ct({...e._def,shape:()=>t})}else return e instanceof bi?new bi({...e._def,type:Xl(e.element)}):e instanceof ko?ko.create(Xl(e.unwrap())):e instanceof tl?tl.create(Xl(e.unwrap())):e instanceof eo?eo.create(e.items.map(t=>Xl(t))):e}class Ct extends Ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Ve.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==re.object){const u=this._getOrReturnCtx(t);return oe(u,{code:ee.invalid_type,expected:re.object,received:u.parsedType}),be}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof jo&&this._def.unknownKeys==="strip"))for(const u in i.data)s.includes(u)||a.push(u);const l=[];for(const u of s){const c=o[u],d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ji(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof jo){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of a)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")a.length>0&&(oe(i,{code:ee.unrecognized_keys,keys:a}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of a){const d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ji(i,d,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const d=await c.key;u.push({key:d,value:await c.value,alwaysSet:c.alwaysSet})}return u}).then(u=>Bn.mergeObjectSync(r,u)):Bn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ge.errToObj,new Ct({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,s,a;const l=(s=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=ge.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new Ct({...this._def,unknownKeys:"strip"})}passthrough(){return new Ct({...this._def,unknownKeys:"passthrough"})}extend(t){return new Ct({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Ct({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ye.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Ct({...this._def,catchall:t})}pick(t){const n={};return Ve.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Ct({...this._def,shape:()=>n})}omit(t){const n={};return Ve.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Ct({...this._def,shape:()=>n})}deepPartial(){return Xl(this)}partial(t){const n={};return Ve.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new Ct({...this._def,shape:()=>n})}required(t){const n={};return Ve.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof ko;)o=o._def.innerType;n[r]=o}}),new Ct({...this._def,shape:()=>n})}keyof(){return SR(Ve.objectKeys(this.shape))}}Ct.create=(e,t)=>new Ct({shape:()=>e,unknownKeys:"strip",catchall:jo.create(),typeName:ye.ZodObject,...we(t)});Ct.strictCreate=(e,t)=>new Ct({shape:()=>e,unknownKeys:"strict",catchall:jo.create(),typeName:ye.ZodObject,...we(t)});Ct.lazycreate=(e,t)=>new Ct({shape:e,unknownKeys:"strip",catchall:jo.create(),typeName:ye.ZodObject,...we(t)});class yf extends Ce{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const s=o.map(a=>new vi(a.ctx.common.issues));return oe(n,{code:ee.invalid_union,unionErrors:s}),be}if(n.common.async)return Promise.all(r.map(async o=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let o;const s=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=l._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const a=s.map(l=>new vi(l));return oe(n,{code:ee.invalid_union,unionErrors:a}),be}}get options(){return this._def.options}}yf.create=(e,t)=>new yf({options:e,typeName:ye.ZodUnion,...we(t)});const fg=e=>e instanceof _f?fg(e.schema):e instanceof Ci?fg(e.innerType()):e instanceof Sf?[e.value]:e instanceof Us?e.options:e instanceof wf?Object.keys(e.enum):e instanceof xf?fg(e._def.innerType):e instanceof gf?[void 0]:e instanceof mf?[null]:null;class C0 extends Ce{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.object)return oe(n,{code:ee.invalid_type,expected:re.object,received:n.parsedType}),be;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(oe(n,{code:ee.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const o of n){const s=fg(o.shape[t]);if(!s)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of s){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new C0({typeName:ye.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...we(r)})}}function $S(e,t){const n=gs(e),r=gs(t);if(e===t)return{valid:!0,data:e};if(n===re.object&&r===re.object){const i=Ve.objectKeys(t),o=Ve.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(const a of o){const l=$S(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===re.array&&r===re.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o{if(DS(o)||DS(s))return be;const a=$S(o.value,s.value);return a.valid?((LS(o)||LS(s))&&n.dirty(),{status:n.value,value:a.data}):(oe(r,{code:ee.invalid_intersection_types}),be)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}vf.create=(e,t,n)=>new vf({left:e,right:t,typeName:ye.ZodIntersection,...we(n)});class eo extends Ce{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==re.array)return oe(r,{code:ee.invalid_type,expected:re.array,received:r.parsedType}),be;if(r.data.lengththis._def.items.length&&(oe(r,{code:ee.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((s,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Ji(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>Bn.mergeArray(n,s)):Bn.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new eo({...this._def,rest:t})}}eo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new eo({items:e,typeName:ye.ZodTuple,rest:null,...we(t)})};class bf extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==re.object)return oe(r,{code:ee.invalid_type,expected:re.object,received:r.parsedType}),be;const i=[],o=this._def.keyType,s=this._def.valueType;for(const a in r.data)i.push({key:o._parse(new Ji(r,a,r.path,a)),value:s._parse(new Ji(r,r.data[a],r.path,a))});return r.common.async?Bn.mergeObjectAsync(n,i):Bn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Ce?new bf({keyType:t,valueType:n,typeName:ye.ZodRecord,...we(r)}):new bf({keyType:hi.create(),valueType:t,typeName:ye.ZodRecord,...we(n)})}}class wm extends Ce{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==re.map)return oe(r,{code:ee.invalid_type,expected:re.map,received:r.parsedType}),be;const i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([a,l],u)=>({key:i._parse(new Ji(r,a,r.path,[u,"key"])),value:o._parse(new Ji(r,l,r.path,[u,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of s){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return be;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),a.set(u.value,c.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of s){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return be;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),a.set(u.value,c.value)}return{status:n.value,value:a}}}}wm.create=(e,t,n)=>new wm({valueType:t,keyType:e,typeName:ye.ZodMap,...we(n)});class el extends Ce{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==re.set)return oe(r,{code:ee.invalid_type,expected:re.set,received:r.parsedType}),be;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(oe(r,{code:ee.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function s(l){const u=new Set;for(const c of l){if(c.status==="aborted")return be;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((l,u)=>o._parse(new Ji(r,l,r.path,u)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new el({...this._def,minSize:{value:t,message:ge.toString(n)}})}max(t,n){return new el({...this._def,maxSize:{value:t,message:ge.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}el.create=(e,t)=>new el({valueType:e,minSize:null,maxSize:null,typeName:ye.ZodSet,...we(t)});class Ru extends Ce{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.function)return oe(n,{code:ee.invalid_type,expected:re.function,received:n.parsedType}),be;function r(a,l){return ym({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,mm(),hf].filter(u=>!!u),issueData:{code:ee.invalid_arguments,argumentsError:l}})}function i(a,l){return ym({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,mm(),hf].filter(u=>!!u),issueData:{code:ee.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},s=n.data;return this._def.returns instanceof tc?er(async(...a)=>{const l=new vi([]),u=await this._def.args.parseAsync(a,o).catch(f=>{throw l.addIssue(r(a,f)),l}),c=await s(...u);return await this._def.returns._def.type.parseAsync(c,o).catch(f=>{throw l.addIssue(i(c,f)),l})}):er((...a)=>{const l=this._def.args.safeParse(a,o);if(!l.success)throw new vi([r(a,l.error)]);const u=s(...l.data),c=this._def.returns.safeParse(u,o);if(!c.success)throw new vi([i(u,c.error)]);return c.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Ru({...this._def,args:eo.create(t).rest(ja.create())})}returns(t){return new Ru({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Ru({args:t||eo.create([]).rest(ja.create()),returns:n||ja.create(),typeName:ye.ZodFunction,...we(r)})}}class _f extends Ce{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}_f.create=(e,t)=>new _f({getter:e,typeName:ye.ZodLazy,...we(t)});class Sf extends Ce{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return oe(n,{received:n.data,code:ee.invalid_literal,expected:this._def.value}),be}return{status:"valid",value:t.data}}get value(){return this._def.value}}Sf.create=(e,t)=>new Sf({value:e,typeName:ye.ZodLiteral,...we(t)});function SR(e,t){return new Us({values:e,typeName:ye.ZodEnum,...we(t)})}class Us extends Ce{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return oe(n,{expected:Ve.joinValues(r),received:n.parsedType,code:ee.invalid_type}),be}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return oe(n,{received:n.data,code:ee.invalid_enum_value,options:r}),be}return er(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t){return Us.create(t)}exclude(t){return Us.create(this.options.filter(n=>!t.includes(n)))}}Us.create=SR;class wf extends Ce{_parse(t){const n=Ve.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==re.string&&r.parsedType!==re.number){const i=Ve.objectValues(n);return oe(r,{expected:Ve.joinValues(i),received:r.parsedType,code:ee.invalid_type}),be}if(n.indexOf(t.data)===-1){const i=Ve.objectValues(n);return oe(r,{received:r.data,code:ee.invalid_enum_value,options:i}),be}return er(t.data)}get enum(){return this._def.values}}wf.create=(e,t)=>new wf({values:e,typeName:ye.ZodNativeEnum,...we(t)});class tc extends Ce{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.promise&&n.common.async===!1)return oe(n,{code:ee.invalid_type,expected:re.promise,received:n.parsedType}),be;const r=n.parsedType===re.promise?n.data:Promise.resolve(n.data);return er(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}tc.create=(e,t)=>new tc({type:e,typeName:ye.ZodPromise,...we(t)});class Ci extends Ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ye.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null;if(i.type==="preprocess"){const s=i.transform(r.data);return r.common.async?Promise.resolve(s).then(a=>this._def.schema._parseAsync({data:a,path:r.path,parent:r})):this._def.schema._parseSync({data:s,path:r.path,parent:r})}const o={addIssue:s=>{oe(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="refinement"){const s=a=>{const l=i.refinement(a,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?be:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?be:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!vm(s))return s;const a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>vm(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:n.value,value:a})):s);Ve.assertNever(i)}}Ci.create=(e,t,n)=>new Ci({schema:e,typeName:ye.ZodEffects,effect:t,...we(n)});Ci.createWithPreprocess=(e,t,n)=>new Ci({schema:t,effect:{type:"preprocess",transform:e},typeName:ye.ZodEffects,...we(n)});class ko extends Ce{_parse(t){return this._getType(t)===re.undefined?er(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ko.create=(e,t)=>new ko({innerType:e,typeName:ye.ZodOptional,...we(t)});class tl extends Ce{_parse(t){return this._getType(t)===re.null?er(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}tl.create=(e,t)=>new tl({innerType:e,typeName:ye.ZodNullable,...we(t)});class xf extends Ce{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===re.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}xf.create=(e,t)=>new xf({innerType:e,typeName:ye.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...we(t)});class xm extends Ce{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return bm(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new vi(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new vi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}xm.create=(e,t)=>new xm({innerType:e,typeName:ye.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...we(t)});class Cm extends Ce{_parse(t){if(this._getType(t)!==re.nan){const r=this._getOrReturnCtx(t);return oe(r,{code:ee.invalid_type,expected:re.nan,received:r.parsedType}),be}return{status:"valid",value:t.data}}}Cm.create=e=>new Cm({typeName:ye.ZodNaN,...we(e)});const CY=Symbol("zod_brand");class wR extends Ce{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class yh extends Ce{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?be:o.status==="dirty"?(n.dirty(),_R(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?be:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new yh({in:t,out:n,typeName:ye.ZodPipeline})}}const xR=(e,t={},n)=>e?ec.create().superRefine((r,i)=>{var o,s;if(!e(r)){const a=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(s=(o=a.fatal)!==null&&o!==void 0?o:n)!==null&&s!==void 0?s:!0,u=typeof a=="string"?{message:a}:a;i.addIssue({code:"custom",...u,fatal:l})}}):ec.create(),TY={object:Ct.lazycreate};var ye;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline"})(ye||(ye={}));const EY=(e,t={message:`Input not instance of ${e.name}`})=>xR(n=>n instanceof e,t),CR=hi.create,TR=Vs.create,PY=Cm.create,AY=zs.create,ER=pf.create,kY=Ja.create,OY=_m.create,RY=gf.create,MY=mf.create,IY=ec.create,NY=ja.create,DY=jo.create,LY=Sm.create,$Y=bi.create,FY=Ct.create,BY=Ct.strictCreate,jY=yf.create,VY=C0.create,zY=vf.create,UY=eo.create,GY=bf.create,HY=wm.create,qY=el.create,WY=Ru.create,KY=_f.create,XY=Sf.create,YY=Us.create,QY=wf.create,ZY=tc.create,K4=Ci.create,JY=ko.create,eQ=tl.create,tQ=Ci.createWithPreprocess,nQ=yh.create,rQ=()=>CR().optional(),iQ=()=>TR().optional(),oQ=()=>ER().optional(),sQ={string:e=>hi.create({...e,coerce:!0}),number:e=>Vs.create({...e,coerce:!0}),boolean:e=>pf.create({...e,coerce:!0}),bigint:e=>zs.create({...e,coerce:!0}),date:e=>Ja.create({...e,coerce:!0})},aQ=be;var Nt=Object.freeze({__proto__:null,defaultErrorMap:hf,setErrorMap:dY,getErrorMap:mm,makeIssue:ym,EMPTY_PATH:fY,addIssueToContext:oe,ParseStatus:Bn,INVALID:be,DIRTY:_R,OK:er,isAborted:DS,isDirty:LS,isValid:vm,isAsync:bm,get util(){return Ve},get objectUtil(){return NS},ZodParsedType:re,getParsedType:gs,ZodType:Ce,ZodString:hi,ZodNumber:Vs,ZodBigInt:zs,ZodBoolean:pf,ZodDate:Ja,ZodSymbol:_m,ZodUndefined:gf,ZodNull:mf,ZodAny:ec,ZodUnknown:ja,ZodNever:jo,ZodVoid:Sm,ZodArray:bi,ZodObject:Ct,ZodUnion:yf,ZodDiscriminatedUnion:C0,ZodIntersection:vf,ZodTuple:eo,ZodRecord:bf,ZodMap:wm,ZodSet:el,ZodFunction:Ru,ZodLazy:_f,ZodLiteral:Sf,ZodEnum:Us,ZodNativeEnum:wf,ZodPromise:tc,ZodEffects:Ci,ZodTransformer:Ci,ZodOptional:ko,ZodNullable:tl,ZodDefault:xf,ZodCatch:xm,ZodNaN:Cm,BRAND:CY,ZodBranded:wR,ZodPipeline:yh,custom:xR,Schema:Ce,ZodSchema:Ce,late:TY,get ZodFirstPartyTypeKind(){return ye},coerce:sQ,any:IY,array:$Y,bigint:AY,boolean:ER,date:kY,discriminatedUnion:VY,effect:K4,enum:YY,function:WY,instanceof:EY,intersection:zY,lazy:KY,literal:XY,map:HY,nan:PY,nativeEnum:QY,never:DY,null:MY,nullable:eQ,number:TR,object:FY,oboolean:oQ,onumber:iQ,optional:JY,ostring:rQ,pipeline:nQ,preprocess:tQ,promise:ZY,record:GY,set:qY,strictObject:BY,string:CR,symbol:OY,transformer:K4,tuple:UY,undefined:RY,union:jY,unknown:NY,void:LY,NEVER:aQ,ZodIssueCode:ee,quotelessJson:cY,ZodError:vi});const lQ=Nt.string(),bwe=e=>lQ.safeParse(e).success,uQ=Nt.string(),_we=e=>uQ.safeParse(e).success;Nt.string();Nt.string();const cQ=Nt.number().int().min(1),Swe=e=>cQ.safeParse(e).success,dQ=Nt.number().min(1),wwe=e=>dQ.safeParse(e).success,fQ=Nt.enum(["euler","deis","ddim","ddpm","dpmpp_2s","dpmpp_2m","dpmpp_2m_sde","dpmpp_sde","heun","kdpm_2","lms","pndm","unipc","euler_k","dpmpp_2s_k","dpmpp_2m_k","dpmpp_2m_sde_k","dpmpp_sde_k","heun_k","lms_k","euler_a","kdpm_2_a"]),xwe=e=>fQ.safeParse(e).success,Cwe={euler:"Euler",deis:"DEIS",ddim:"DDIM",ddpm:"DDPM",dpmpp_sde:"DPM++ SDE",dpmpp_2s:"DPM++ 2S",dpmpp_2m:"DPM++ 2M",dpmpp_2m_sde:"DPM++ 2M SDE",heun:"Heun",kdpm_2:"KDPM 2",lms:"LMS",pndm:"PNDM",unipc:"UniPC",euler_k:"Euler Karras",dpmpp_sde_k:"DPM++ SDE Karras",dpmpp_2s_k:"DPM++ 2S Karras",dpmpp_2m_k:"DPM++ 2M Karras",dpmpp_2m_sde_k:"DPM++ 2M SDE Karras",heun_k:"Heun Karras",lms_k:"LMS Karras",euler_a:"Euler Ancestral",kdpm_2_a:"KDPM 2 Ancestral"},hQ=Nt.number().int().min(0).max(uY),Twe=e=>hQ.safeParse(e).success,pQ=Nt.number().multipleOf(8).min(64),Ewe=e=>pQ.safeParse(e).success,gQ=Nt.number().multipleOf(8).min(64),Pwe=e=>gQ.safeParse(e).success,mQ=Nt.enum(["vae","lora","onnx","main","controlnet","embedding"]),T0=Nt.enum(["sd-1","sd-2","sdxl","sdxl-refiner"]),Cf=Nt.object({model_name:Nt.string().min(1),base_model:T0,model_type:mQ}),Awe=e=>Cf.safeParse(e).success,yQ=Nt.object({model_name:Nt.string().min(1),base_model:T0}),kwe=Nt.object({model_name:Nt.string().min(1),base_model:T0}),Owe=Nt.object({model_name:Nt.string().min(1),base_model:T0}),vQ=Nt.number().min(0).max(1),Rwe=e=>vQ.safeParse(e).success;Nt.enum(["fp16","fp32"]);const qo={cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,perlin:0,positivePrompt:"",negativePrompt:"",scheduler:"euler",seamBlur:16,seamSize:96,seamSteps:30,seamStrength:.7,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,shouldUseNoiseSettings:!1,steps:50,threshold:0,tileSize:32,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0,model:null,vae:null,vaePrecision:"fp32",seamlessXAxis:!1,seamlessYAxis:!1,clipSkip:0,shouldUseCpuNoise:!0,shouldShowAdvancedOptions:!1,aspectRatio:null},bQ=qo,PR=Et({name:"generation",initialState:bQ,reducers:{setPositivePrompt:(e,t)=>{e.positivePrompt=t.payload},setNegativePrompt:(e,t)=>{e.negativePrompt=t.payload},setIterations:(e,t)=>{e.iterations=t.payload},setSteps:(e,t)=>{e.steps=t.payload},clampSymmetrySteps:e=>{e.horizontalSymmetrySteps=bs(e.horizontalSymmetrySteps,0,e.steps),e.verticalSymmetrySteps=bs(e.verticalSymmetrySteps,0,e.steps)},setCfgScale:(e,t)=>{e.cfgScale=t.payload},setThreshold:(e,t)=>{e.threshold=t.payload},setPerlin:(e,t)=>{e.perlin=t.payload},setHeight:(e,t)=>{e.height=t.payload},setWidth:(e,t)=>{e.width=t.payload},toggleSize:e=>{const[t,n]=[e.width,e.height];e.width=n,e.height=t},setScheduler:(e,t)=>{e.scheduler=t.payload},setSeed:(e,t)=>{e.seed=t.payload,e.shouldRandomizeSeed=!1},setImg2imgStrength:(e,t)=>{e.img2imgStrength=t.payload},setSeamlessXAxis:(e,t)=>{e.seamlessXAxis=t.payload},setSeamlessYAxis:(e,t)=>{e.seamlessYAxis=t.payload},setShouldFitToWidthHeight:(e,t)=>{e.shouldFitToWidthHeight=t.payload},resetSeed:e=>{e.seed=-1},setShouldGenerateVariations:(e,t)=>{e.shouldGenerateVariations=t.payload},setVariationAmount:(e,t)=>{e.variationAmount=t.payload},setSeedWeights:(e,t)=>{e.seedWeights=t.payload,e.shouldGenerateVariations=!0,e.variationAmount=0},resetParametersState:e=>({...e,...qo}),setShouldRandomizeSeed:(e,t)=>{e.shouldRandomizeSeed=t.payload},clearInitialImage:e=>{e.initialImage=void 0},setSeamSize:(e,t)=>{e.seamSize=t.payload},setSeamBlur:(e,t)=>{e.seamBlur=t.payload},setSeamStrength:(e,t)=>{e.seamStrength=t.payload},setSeamSteps:(e,t)=>{e.seamSteps=t.payload},setTileSize:(e,t)=>{e.tileSize=t.payload},setInfillMethod:(e,t)=>{e.infillMethod=t.payload},setShouldUseSymmetry:(e,t)=>{e.shouldUseSymmetry=t.payload},setHorizontalSymmetrySteps:(e,t)=>{e.horizontalSymmetrySteps=t.payload},setVerticalSymmetrySteps:(e,t)=>{e.verticalSymmetrySteps=t.payload},setShouldUseNoiseSettings:(e,t)=>{e.shouldUseNoiseSettings=t.payload},initialImageChanged:(e,t)=>{const{image_name:n,width:r,height:i}=t.payload;e.initialImage={imageName:n,width:r,height:i}},modelChanged:(e,t)=>{if(e.model=t.payload,e.model===null)return;const{maxClip:n}=lY[e.model.base_model];e.clipSkip=bs(e.clipSkip,0,n)},vaeSelected:(e,t)=>{e.vae=t.payload},vaePrecisionChanged:(e,t)=>{e.vaePrecision=t.payload},setClipSkip:(e,t)=>{e.clipSkip=t.payload},shouldUseCpuNoiseChanged:(e,t)=>{e.shouldUseCpuNoise=t.payload},setShouldShowAdvancedOptions:(e,t)=>{e.shouldShowAdvancedOptions=t.payload,t.payload||(e.clipSkip=0)},setAspectRatio:(e,t)=>{const n=t.payload;e.aspectRatio=n,n&&(e.height=zi(e.width/n,8))}},extraReducers:e=>{e.addCase(sY,(t,n)=>{var i;const r=(i=n.payload.sd)==null?void 0:i.defaultModel;if(r&&!t.model){const[o,s,a]=r.split("/"),l=Cf.safeParse({model_name:a,base_model:o,model_type:s});l.success&&(t.model=l.data)}}),e.addCase(SQ,(t,n)=>{n.payload||(t.clipSkip=0)})}}),{clampSymmetrySteps:Mwe,clearInitialImage:AR,resetParametersState:Iwe,resetSeed:Nwe,setCfgScale:Dwe,setWidth:Lwe,setHeight:$we,toggleSize:Fwe,setImg2imgStrength:Bwe,setInfillMethod:_Q,setIterations:jwe,setPerlin:Vwe,setPositivePrompt:zwe,setNegativePrompt:Uwe,setScheduler:Gwe,setSeamBlur:Hwe,setSeamSize:qwe,setSeamSteps:Wwe,setSeamStrength:Kwe,setSeed:Xwe,setSeedWeights:Ywe,setShouldFitToWidthHeight:Qwe,setShouldGenerateVariations:Zwe,setShouldRandomizeSeed:Jwe,setSteps:exe,setThreshold:txe,setTileSize:nxe,setVariationAmount:rxe,setShouldUseSymmetry:ixe,setHorizontalSymmetrySteps:oxe,setVerticalSymmetrySteps:sxe,initialImageChanged:E0,modelChanged:Va,vaeSelected:kR,setShouldUseNoiseSettings:axe,setSeamlessXAxis:lxe,setSeamlessYAxis:uxe,setClipSkip:cxe,shouldUseCpuNoiseChanged:dxe,setShouldShowAdvancedOptions:SQ,setAspectRatio:wQ,vaePrecisionChanged:fxe}=PR.actions,xQ=PR.reducer,OR=["txt2img","img2img","unifiedCanvas","nodes","modelManager","batch"],X4=(e,t)=>{typeof t=="number"?e.activeTab=t:e.activeTab=OR.indexOf(t)},RR={activeTab:0,shouldPinParametersPanel:!0,shouldShowParametersPanel:!0,shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,shouldPinGallery:!0,shouldShowGallery:!0,shouldHidePreview:!1,shouldShowProgressInViewer:!0,shouldShowEmbeddingPicker:!1,favoriteSchedulers:[]},MR=Et({name:"ui",initialState:RR,reducers:{setActiveTab:(e,t)=>{X4(e,t.payload)},setShouldPinParametersPanel:(e,t)=>{e.shouldPinParametersPanel=t.payload,e.shouldShowParametersPanel=!0},setShouldShowParametersPanel:(e,t)=>{e.shouldShowParametersPanel=t.payload},setShouldShowImageDetails:(e,t)=>{e.shouldShowImageDetails=t.payload},setShouldUseCanvasBetaLayout:(e,t)=>{e.shouldUseCanvasBetaLayout=t.payload},setShouldHidePreview:(e,t)=>{e.shouldHidePreview=t.payload},setShouldShowExistingModelsInSearch:(e,t)=>{e.shouldShowExistingModelsInSearch=t.payload},setShouldUseSliders:(e,t)=>{e.shouldUseSliders=t.payload},setShouldShowGallery:(e,t)=>{e.shouldShowGallery=t.payload},togglePinGalleryPanel:e=>{e.shouldPinGallery=!e.shouldPinGallery,e.shouldPinGallery||(e.shouldShowGallery=!0)},togglePinParametersPanel:e=>{e.shouldPinParametersPanel=!e.shouldPinParametersPanel,e.shouldPinParametersPanel||(e.shouldShowParametersPanel=!0)},toggleParametersPanel:e=>{e.shouldShowParametersPanel=!e.shouldShowParametersPanel},toggleGalleryPanel:e=>{e.shouldShowGallery=!e.shouldShowGallery},togglePanels:e=>{e.shouldShowGallery||e.shouldShowParametersPanel?(e.shouldShowGallery=!1,e.shouldShowParametersPanel=!1):(e.shouldShowGallery=!0,e.shouldShowParametersPanel=!0)},setShouldShowProgressInViewer:(e,t)=>{e.shouldShowProgressInViewer=t.payload},favoriteSchedulersChanged:(e,t)=>{e.favoriteSchedulers=t.payload},toggleEmbeddingPicker:e=>{e.shouldShowEmbeddingPicker=!e.shouldShowEmbeddingPicker}},extraReducers(e){e.addCase(E0,t=>{X4(t,"img2img")})}}),{setActiveTab:IR,setShouldPinParametersPanel:hxe,setShouldShowParametersPanel:pxe,setShouldShowImageDetails:gxe,setShouldUseCanvasBetaLayout:CQ,setShouldShowExistingModelsInSearch:mxe,setShouldUseSliders:yxe,setShouldHidePreview:vxe,setShouldShowGallery:bxe,togglePanels:_xe,togglePinGalleryPanel:Sxe,togglePinParametersPanel:wxe,toggleParametersPanel:xxe,toggleGalleryPanel:Cxe,setShouldShowProgressInViewer:Txe,favoriteSchedulersChanged:Exe,toggleEmbeddingPicker:Pxe}=MR.actions,TQ=MR.reducer;let qn=[],P0=(e,t)=>{let n=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},l:t||0,lc:0,listen(i,o){return r.lc=n.push(i,o||r.l)/2,()=>{let s=n.indexOf(i);~s&&(n.splice(s,2),r.lc--,r.lc||r.off())}},notify(i){let o=!qn.length;for(let s=0;s(e.events=e.events||{},e.events[n+yp]||(e.events[n+yp]=r(i=>{e.events[n].reduceRight((o,s)=>(s(o),o),{shared:{},...i})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let i=e.events[n],o=i.indexOf(t);i.splice(o,1),i.length||(delete e.events[n],e.events[n+yp](),delete e.events[n+yp])}),AQ=1e3,kQ=(e,t)=>PQ(e,r=>{let i=t(r);i&&e.events[mp].push(i)},EQ,r=>{let i=e.listen;e.listen=(...s)=>(!e.lc&&!e.active&&(e.active=!0,r()),i(...s));let o=e.off;return e.events[mp]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let s of e.events[mp])s();e.events[mp]=[]}},AQ)},()=>{e.listen=i,e.off=o}}),OQ=(e,t)=>{Array.isArray(e)||(e=[e]);let n,r=()=>{let o=e.map(s=>s.get());(n===void 0||o.some((s,a)=>s!==n[a]))&&(n=o,i.set(t(...o)))},i=P0(void 0,Math.max(...e.map(o=>o.l))+1);return kQ(i,()=>{let o=e.map(s=>s.listen(r,i.l));return r(),()=>{for(let s of o)s()}}),i};const RQ={"Content-Type":"application/json"},MQ=/\/*$/;function IQ(e){const t=new URLSearchParams;if(e&&typeof e=="object")for(const[n,r]of Object.entries(e))r!=null&&t.set(n,r);return t.toString()}function NQ(e){return JSON.stringify(e)}function DQ(e,t){let n=`${t.baseUrl?t.baseUrl.replace(MQ,""):""}${e}`;if(t.params.path)for(const[r,i]of Object.entries(t.params.path))n=n.replace(`{${r}}`,encodeURIComponent(String(i)));if(t.params.query){const r=t.querySerializer(t.params.query);r&&(n+=`?${r}`)}return n}function LQ(e={}){const{fetch:t=globalThis.fetch,querySerializer:n,bodySerializer:r,...i}=e,o=new Headers({...RQ,...i.headers??{}});async function s(a,l){const{headers:u,body:c,params:d={},parseAs:f="json",querySerializer:h=n??IQ,bodySerializer:p=r??NQ,...m}=l||{},_=DQ(a,{baseUrl:i.baseUrl,params:d,querySerializer:h}),y=new Headers(o),v=new Headers(u);for(const[w,x]of v.entries())x==null?y.delete(w):y.set(w,x);const g={redirect:"follow",...i,...m,headers:y};c&&(g.body=p(c)),g.body instanceof FormData&&y.delete("Content-Type");const b=await t(_,g);if(b.status===204||b.headers.get("Content-Length")==="0")return b.ok?{data:{},response:b}:{error:{},response:b};if(b.ok){let w=b.body;if(f!=="stream"){const x=b.clone();w=typeof x[f]=="function"?await x[f]():await x.text()}return{data:w,response:b}}let S={};try{S=await b.clone().json()}catch{S=await b.clone().text()}return{error:S,response:b}}return{async get(a,l){return s(a,{...l,method:"GET"})},async put(a,l){return s(a,{...l,method:"PUT"})},async post(a,l){return s(a,{...l,method:"POST"})},async del(a,l){return s(a,{...l,method:"DELETE"})},async options(a,l){return s(a,{...l,method:"OPTIONS"})},async head(a,l){return s(a,{...l,method:"HEAD"})},async patch(a,l){return s(a,{...l,method:"PATCH"})},async trace(a,l){return s(a,{...l,method:"TRACE"})}}}const Tf=P0(),Ef=P0(),A0=OQ([Tf,Ef],(e,t)=>LQ({headers:e?{Authorization:`Bearer ${e}`}:{},baseUrl:`${t??""}`})),kn=js("api/sessionCreated",async(e,{rejectWithValue:t})=>{const{graph:n}=e,{post:r}=A0.get(),{data:i,error:o,response:s}=await r("/api/v1/sessions/",{body:n});return o?t({arg:e,status:s.status,error:o}):i}),$Q=e=>yr(e)&&"status"in e,vh=js("api/sessionInvoked",async(e,{rejectWithValue:t})=>{const{session_id:n}=e,{put:r}=A0.get(),{data:i,error:o,response:s}=await r("/api/v1/sessions/{session_id}/invoke",{params:{query:{all:!0},path:{session_id:n}}});if(o)return $Q(o)&&o.status===403?t({arg:e,status:s.status,error:o.body.detail}):t({arg:e,status:s.status,error:o})}),hl=js("api/sessionCanceled",async(e,{rejectWithValue:t})=>{const{session_id:n}=e,{del:r}=A0.get(),{data:i,error:o,response:s}=await r("/api/v1/sessions/{session_id}/invoke",{params:{path:{session_id:n}}});return o?t({arg:e,error:o}):i});js("api/listSessions",async(e,{rejectWithValue:t})=>{const{params:n}=e,{get:r}=A0.get(),{data:i,error:o,response:s}=await r("/api/v1/sessions/",{params:n});return o?t({arg:e,error:o}):i});const NR=Jr(kn.rejected,vh.rejected),Nl=(e,t,n,r,i,o,s)=>{const a=Math.floor(e/2-(n+i/2)*s),l=Math.floor(t/2-(r+o/2)*s);return{x:a,y:l}},Dl=(e,t,n,r,i=.95)=>{const o=e*i/n,s=t*i/r;return Math.min(1,Math.min(o,s))},Axe=.999,kxe=.1,Oxe=20,Uc=.95,Rxe=30,Mxe=10,Y4=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),ga=e=>{const{width:t,height:n}=e,r={width:t,height:n},i=512*512,o=t/n;let s=t*n,a=448;for(;s1?(r.width=a,r.height=zi(a/o,64)):o<1&&(r.height=a,r.width=zi(a*o,64)),s=r.width*r.height;return r},FQ=e=>({width:zi(e.width,64),height:zi(e.height,64)}),Ixe=[{label:"Base",value:"base"},{label:"Mask",value:"mask"}],Nxe=[{label:"Auto",value:"auto"},{label:"Manual",value:"manual"},{label:"None",value:"none"}],DR=e=>e.kind==="line"&&e.layer==="mask",Dxe=e=>e.kind==="line"&&e.layer==="base",Q4=e=>e.kind==="image"&&e.layer==="base",Lxe=e=>e.kind==="fillRect"&&e.layer==="base",$xe=e=>e.kind==="eraseRect"&&e.layer==="base",BQ=e=>e.kind==="line",Yl={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},LR={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"auto",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,canvasContainerDimensions:{width:0,height:0},colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,doesCanvasNeedScaling:!1,futureLayerStates:[],isCanvasInitialized:!1,isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:Yl,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAntialias:!0,shouldAutoSave:!1,shouldCropToBoundingBoxOnSave:!1,shouldDarkenOutsideBoundingBox:!1,shouldLockBoundingBox:!1,shouldPreserveMaskedArea:!1,shouldRestrictStrokesToBox:!0,shouldShowBoundingBox:!0,shouldShowBrush:!0,shouldShowBrushPreview:!1,shouldShowCanvasDebugInfo:!1,shouldShowCheckboardTransparency:!1,shouldShowGrid:!0,shouldShowIntermediates:!0,shouldShowStagingImage:!0,shouldShowStagingOutline:!0,shouldSnapToGrid:!0,stageCoordinates:{x:0,y:0},stageDimensions:{width:0,height:0},stageScale:1,tool:"brush"},$R=Et({name:"canvas",initialState:LR,reducers:{setTool:(e,t)=>{const n=t.payload;e.tool=t.payload,n!=="move"&&(e.isTransformingBoundingBox=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1)},setLayer:(e,t)=>{e.layer=t.payload},toggleTool:e=>{const t=e.tool;t!=="move"&&(e.tool=t==="brush"?"eraser":"brush")},setMaskColor:(e,t)=>{e.maskColor=t.payload},setBrushColor:(e,t)=>{e.brushColor=t.payload},setBrushSize:(e,t)=>{e.brushSize=t.payload},clearMask:e=>{e.pastLayerStates.push(Dn(e.layerState)),e.layerState.objects=e.layerState.objects.filter(t=>!DR(t)),e.futureLayerStates=[],e.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:e=>{e.shouldPreserveMaskedArea=!e.shouldPreserveMaskedArea},toggleShouldShowMask:e=>{e.isMaskEnabled=!e.isMaskEnabled},setShouldPreserveMaskedArea:(e,t)=>{e.shouldPreserveMaskedArea=t.payload},setIsMaskEnabled:(e,t)=>{e.isMaskEnabled=t.payload,e.layer=t.payload?"mask":"base"},setShouldShowCheckboardTransparency:(e,t)=>{e.shouldShowCheckboardTransparency=t.payload},setShouldShowBrushPreview:(e,t)=>{e.shouldShowBrushPreview=t.payload},setShouldShowBrush:(e,t)=>{e.shouldShowBrush=t.payload},setCursorPosition:(e,t)=>{e.cursorPosition=t.payload},setInitialCanvasImage:(e,t)=>{const n=t.payload,{width:r,height:i}=n,{stageDimensions:o}=e,s={width:pp(bs(r,64,512),64),height:pp(bs(i,64,512),64)},a={x:zi(r/2-s.width/2,64),y:zi(i/2-s.height/2,64)};if(e.boundingBoxScaleMethod==="auto"){const c=ga(s);e.scaledBoundingBoxDimensions=c}e.boundingBoxDimensions=s,e.boundingBoxCoordinates=a,e.pastLayerStates.push(Dn(e.layerState)),e.layerState={...Yl,objects:[{kind:"image",layer:"base",x:0,y:0,width:r,height:i,imageName:n.image_name}]},e.futureLayerStates=[],e.isCanvasInitialized=!1;const l=Dl(o.width,o.height,r,i,Uc),u=Nl(o.width,o.height,0,0,r,i,l);e.stageScale=l,e.stageCoordinates=u,e.doesCanvasNeedScaling=!0},setBoundingBoxDimensions:(e,t)=>{const n=FQ(t.payload);if(e.boundingBoxDimensions=n,e.boundingBoxScaleMethod==="auto"){const r=ga(n);e.scaledBoundingBoxDimensions=r}},flipBoundingBoxAxes:e=>{const[t,n]=[e.boundingBoxDimensions.width,e.boundingBoxDimensions.height];e.boundingBoxDimensions={width:n,height:t}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=Y4(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=t.payload},setDoesCanvasNeedScaling:(e,t)=>{e.doesCanvasNeedScaling=t.payload},setStageScale:(e,t)=>{e.stageScale=t.payload},setShouldDarkenOutsideBoundingBox:(e,t)=>{e.shouldDarkenOutsideBoundingBox=t.payload},setIsDrawing:(e,t)=>{e.isDrawing=t.payload},clearCanvasHistory:e=>{e.pastLayerStates=[],e.futureLayerStates=[]},setShouldLockBoundingBox:(e,t)=>{e.shouldLockBoundingBox=t.payload},toggleShouldLockBoundingBox:e=>{e.shouldLockBoundingBox=!e.shouldLockBoundingBox},setShouldShowBoundingBox:(e,t)=>{e.shouldShowBoundingBox=t.payload},setIsTransformingBoundingBox:(e,t)=>{e.isTransformingBoundingBox=t.payload},setIsMovingBoundingBox:(e,t)=>{e.isMovingBoundingBox=t.payload},setIsMouseOverBoundingBox:(e,t)=>{e.isMouseOverBoundingBox=t.payload},setIsMoveBoundingBoxKeyHeld:(e,t)=>{e.isMoveBoundingBoxKeyHeld=t.payload},setIsMoveStageKeyHeld:(e,t)=>{e.isMoveStageKeyHeld=t.payload},canvasSessionIdChanged:(e,t)=>{e.layerState.stagingArea.sessionId=t.payload},stagingAreaInitialized:(e,t)=>{const{sessionId:n,boundingBox:r}=t.payload;e.layerState.stagingArea={boundingBox:r,sessionId:n,images:[],selectedImageIndex:-1}},addImageToStagingArea:(e,t)=>{const n=t.payload;!n||!e.layerState.stagingArea.boundingBox||(e.pastLayerStates.push(Dn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea.images.push({kind:"image",layer:"base",...e.layerState.stagingArea.boundingBox,imageName:n.image_name}),e.layerState.stagingArea.selectedImageIndex=e.layerState.stagingArea.images.length-1,e.futureLayerStates=[])},discardStagedImages:e=>{e.pastLayerStates.push(Dn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea={...Yl.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingOutline=!0},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(Dn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"fillRect",layer:"base",...t,...n,color:r}),e.futureLayerStates=[]},addEraseRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n}=e;e.pastLayerStates.push(Dn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"eraseRect",layer:"base",...t,...n}),e.futureLayerStates=[]},addLine:(e,t)=>{const{tool:n,layer:r,brushColor:i,brushSize:o,shouldRestrictStrokesToBox:s}=e;if(n==="move"||n==="colorPicker")return;const a=o/2,l=r==="base"&&n==="brush"?{color:i}:{};e.pastLayerStates.push(Dn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const u={kind:"line",layer:r,tool:n,strokeWidth:a,points:t.payload,...l};s&&(u.clip={...e.boundingBoxCoordinates,...e.boundingBoxDimensions}),e.layerState.objects.push(u),e.futureLayerStates=[]},addPointToCurrentLine:(e,t)=>{const n=e.layerState.objects.findLast(BQ);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(Dn(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(Dn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState=t)},setShouldShowGrid:(e,t)=>{e.shouldShowGrid=t.payload},setIsMovingStage:(e,t)=>{e.isMovingStage=t.payload},setShouldSnapToGrid:(e,t)=>{e.shouldSnapToGrid=t.payload},setShouldAutoSave:(e,t)=>{e.shouldAutoSave=t.payload},setShouldShowIntermediates:(e,t)=>{e.shouldShowIntermediates=t.payload},resetCanvas:e=>{e.pastLayerStates.push(Dn(e.layerState)),e.layerState=Yl,e.futureLayerStates=[]},setCanvasContainerDimensions:(e,t)=>{e.canvasContainerDimensions=t.payload},resizeAndScaleCanvas:e=>{const{width:t,height:n}=e.canvasContainerDimensions,r=e.layerState.objects.find(Q4),i={width:Math.floor(t),height:Math.floor(n)};if(!r){const c=Dl(i.width,i.height,512,512,Uc),d=Nl(i.width,i.height,0,0,512,512,c),f={width:512,height:512};if(e.stageScale=c,e.stageCoordinates=d,e.stageDimensions=i,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=f,e.boundingBoxScaleMethod==="auto"){const h=ga(f);e.scaledBoundingBoxDimensions=h}return}const{width:o,height:s}=r,l=Dl(t,n,o,s,.95),u=Nl(i.width,i.height,0,0,o,s,l);e.minimumStageScale=l,e.stageScale=l,e.stageCoordinates=Y4(u),e.stageDimensions=i,e.isCanvasInitialized=!0},resizeCanvas:e=>{const{width:t,height:n}=e.canvasContainerDimensions,r={width:Math.floor(t),height:Math.floor(n)};if(e.stageDimensions=r,!e.layerState.objects.find(Q4)){const i=Dl(r.width,r.height,512,512,Uc),o=Nl(r.width,r.height,0,0,512,512,i),s={width:512,height:512};if(e.stageScale=i,e.stageCoordinates=o,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=s,e.boundingBoxScaleMethod==="auto"){const a=ga(s);e.scaledBoundingBoxDimensions=a}}},resetCanvasView:(e,t)=>{const{contentRect:n,shouldScaleTo1:r}=t.payload,{stageDimensions:{width:i,height:o}}=e,{x:s,y:a,width:l,height:u}=n;if(l!==0&&u!==0){const c=r?1:Dl(i,o,l,u,Uc),d=Nl(i,o,s,a,l,u,c);e.stageScale=c,e.stageCoordinates=d}else{const c=Dl(i,o,512,512,Uc),d=Nl(i,o,0,0,512,512,c),f={width:512,height:512};if(e.stageScale=c,e.stageCoordinates=d,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=f,e.boundingBoxScaleMethod==="auto"){const h=ga(f);e.scaledBoundingBoxDimensions=h}}},nextStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex,n=e.layerState.stagingArea.images.length;e.layerState.stagingArea.selectedImageIndex=Math.min(t+1,n-1)},prevStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex;e.layerState.stagingArea.selectedImageIndex=Math.max(t-1,0)},commitStagingAreaImage:(e,t)=>{if(!e.layerState.stagingArea.images.length)return;const{images:n,selectedImageIndex:r}=e.layerState.stagingArea;e.pastLayerStates.push(Dn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({...n[r]}),e.layerState.stagingArea={...Yl.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0},fitBoundingBoxToStage:e=>{const{boundingBoxDimensions:t,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=e,o=r.width/i,s=r.height/i;if(n.x<0||n.x+t.width>o||n.y<0||n.y+t.height>s){const a={width:pp(bs(o,64,512),64),height:pp(bs(s,64,512),64)},l={x:zi(o/2-a.width/2,64),y:zi(s/2-a.height/2,64)};if(e.boundingBoxDimensions=a,e.boundingBoxCoordinates=l,e.boundingBoxScaleMethod==="auto"){const u=ga(a);e.scaledBoundingBoxDimensions=u}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,t.payload==="auto"){const n=ga(e.boundingBoxDimensions);e.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(e,t)=>{e.scaledBoundingBoxDimensions=t.payload},setShouldShowStagingImage:(e,t)=>{e.shouldShowStagingImage=t.payload},setShouldShowStagingOutline:(e,t)=>{e.shouldShowStagingOutline=t.payload},setShouldShowCanvasDebugInfo:(e,t)=>{e.shouldShowCanvasDebugInfo=t.payload},setShouldRestrictStrokesToBox:(e,t)=>{e.shouldRestrictStrokesToBox=t.payload},setShouldAntialias:(e,t)=>{e.shouldAntialias=t.payload},setShouldCropToBoundingBoxOnSave:(e,t)=>{e.shouldCropToBoundingBoxOnSave=t.payload},setColorPickerColor:(e,t)=>{e.colorPickerColor=t.payload},commitColorPickerColor:e=>{e.brushColor={...e.colorPickerColor,a:e.brushColor.a},e.tool="brush"},setMergedCanvas:(e,t)=>{e.pastLayerStates.push(Dn(e.layerState)),e.futureLayerStates=[],e.layerState.objects=[t.payload]},resetCanvasInteractionState:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMoveBoundingBoxKeyHeld=!1,e.isMoveStageKeyHeld=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1,e.isTransformingBoundingBox=!1},mouseLeftCanvas:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isTransformingBoundingBox=!1}},extraReducers:e=>{e.addCase(hl.pending,t=>{t.layerState.stagingArea.images.length||(t.layerState.stagingArea=Yl.stagingArea)}),e.addCase(CQ,t=>{t.doesCanvasNeedScaling=!0}),e.addCase(IR,t=>{t.doesCanvasNeedScaling=!0}),e.addCase(wQ,(t,n)=>{const r=n.payload;r&&(t.boundingBoxDimensions.height=zi(t.boundingBoxDimensions.width/r,64))})}}),{addEraseRect:Fxe,addFillRect:Bxe,addImageToStagingArea:jQ,addLine:jxe,addPointToCurrentLine:Vxe,clearCanvasHistory:zxe,clearMask:Uxe,commitColorPickerColor:Gxe,commitStagingAreaImage:VQ,discardStagedImages:Hxe,fitBoundingBoxToStage:qxe,mouseLeftCanvas:Wxe,nextStagingAreaImage:Kxe,prevStagingAreaImage:Xxe,redo:Yxe,resetCanvas:FR,resetCanvasInteractionState:Qxe,resetCanvasView:Zxe,resizeAndScaleCanvas:Jxe,resizeCanvas:eCe,setBoundingBoxCoordinates:tCe,setBoundingBoxDimensions:nCe,setBoundingBoxPreviewFill:rCe,setBoundingBoxScaleMethod:iCe,flipBoundingBoxAxes:oCe,setBrushColor:sCe,setBrushSize:aCe,setCanvasContainerDimensions:lCe,setColorPickerColor:uCe,setCursorPosition:cCe,setDoesCanvasNeedScaling:dCe,setInitialCanvasImage:BR,setIsDrawing:fCe,setIsMaskEnabled:hCe,setIsMouseOverBoundingBox:pCe,setIsMoveBoundingBoxKeyHeld:gCe,setIsMoveStageKeyHeld:mCe,setIsMovingBoundingBox:yCe,setIsMovingStage:vCe,setIsTransformingBoundingBox:bCe,setLayer:_Ce,setMaskColor:SCe,setMergedCanvas:zQ,setShouldAutoSave:wCe,setShouldCropToBoundingBoxOnSave:xCe,setShouldDarkenOutsideBoundingBox:CCe,setShouldLockBoundingBox:TCe,setShouldPreserveMaskedArea:ECe,setShouldShowBoundingBox:PCe,setShouldShowBrush:ACe,setShouldShowBrushPreview:kCe,setShouldShowCanvasDebugInfo:OCe,setShouldShowCheckboardTransparency:RCe,setShouldShowGrid:MCe,setShouldShowIntermediates:ICe,setShouldShowStagingImage:NCe,setShouldShowStagingOutline:DCe,setShouldSnapToGrid:LCe,setStageCoordinates:$Ce,setStageScale:FCe,setTool:BCe,toggleShouldLockBoundingBox:jCe,toggleTool:VCe,undo:zCe,setScaledBoundingBoxDimensions:UCe,setShouldRestrictStrokesToBox:GCe,stagingAreaInitialized:UQ,canvasSessionIdChanged:GQ,setShouldAntialias:HCe}=$R.actions,HQ=$R.reducer,qQ=(e,t)=>{const n=new Date(e),r=new Date(t);return n>r?1:ne==null,JQ=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),BS=Symbol("encodeFragmentIdentifier");function eZ(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Ht(t,e),"[",i,"]"].join("")]:[...n,[Ht(t,e),"[",Ht(i,e),"]=",Ht(r,e)].join("")]};case"bracket":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Ht(t,e),"[]"].join("")]:[...n,[Ht(t,e),"[]=",Ht(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Ht(t,e),":list="].join("")]:[...n,[Ht(t,e),":list=",Ht(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return n=>(r,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?r:(i=i===null?"":i,r.length===0?[[Ht(n,e),t,Ht(i,e)].join("")]:[[r,Ht(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,Ht(t,e)]:[...n,[Ht(t,e),"=",Ht(r,e)].join("")]}}function tZ(e){let t;switch(e.arrayFormat){case"index":return(n,r,i)=>{if(t=/\[(\d*)]$/.exec(n),n=n.replace(/\[\d*]$/,""),!t){i[n]=r;return}i[n]===void 0&&(i[n]={}),i[n][t[1]]=r};case"bracket":return(n,r,i)=>{if(t=/(\[])$/.exec(n),n=n.replace(/\[]$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"colon-list-separator":return(n,r,i)=>{if(t=/(:list)$/.exec(n),n=n.replace(/:list$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"comma":case"separator":return(n,r,i)=>{const o=typeof r=="string"&&r.includes(e.arrayFormatSeparator),s=typeof r=="string"&&!o&&So(r,e).includes(e.arrayFormatSeparator);r=s?So(r,e):r;const a=o||s?r.split(e.arrayFormatSeparator).map(l=>So(l,e)):r===null?r:So(r,e);i[n]=a};case"bracket-separator":return(n,r,i)=>{const o=/(\[])$/.test(n);if(n=n.replace(/\[]$/,""),!o){i[n]=r&&So(r,e);return}const s=r===null?[]:r.split(e.arrayFormatSeparator).map(a=>So(a,e));if(i[n]===void 0){i[n]=s;return}i[n]=[...i[n],...s]};default:return(n,r,i)=>{if(i[n]===void 0){i[n]=r;return}i[n]=[...[i[n]].flat(),r]}}}function zR(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Ht(e,t){return t.encode?t.strict?JQ(e):encodeURIComponent(e):e}function So(e,t){return t.decode?YQ(e):e}function UR(e){return Array.isArray(e)?e.sort():typeof e=="object"?UR(Object.keys(e)).sort((t,n)=>Number(t)-Number(n)).map(t=>e[t]):e}function GR(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function nZ(e){let t="";const n=e.indexOf("#");return n!==-1&&(t=e.slice(n)),t}function eT(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?e=Number(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")&&(e=e.toLowerCase()==="true"),e}function Fx(e){e=GR(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function Bx(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...t},zR(t.arrayFormatSeparator);const n=tZ(t),r=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return r;for(const i of e.split("&")){if(i==="")continue;const o=t.decode?i.replace(/\+/g," "):i;let[s,a]=VR(o,"=");s===void 0&&(s=o),a=a===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?a:So(a,t),n(So(s,t),a,r)}for(const[i,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[s,a]of Object.entries(o))o[s]=eT(a,t);else r[i]=eT(o,t);return t.sort===!1?r:(t.sort===!0?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((i,o)=>{const s=r[o];return s&&typeof s=="object"&&!Array.isArray(s)?i[o]=UR(s):i[o]=s,i},Object.create(null))}function HR(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},zR(t.arrayFormatSeparator);const n=s=>t.skipNull&&ZQ(e[s])||t.skipEmptyString&&e[s]==="",r=eZ(t),i={};for(const[s,a]of Object.entries(e))n(s)||(i[s]=a);const o=Object.keys(i);return t.sort!==!1&&o.sort(t.sort),o.map(s=>{const a=e[s];return a===void 0?"":a===null?Ht(s,t):Array.isArray(a)?a.length===0&&t.arrayFormat==="bracket-separator"?Ht(s,t)+"[]":a.reduce(r(s),[]).join("&"):Ht(s,t)+"="+Ht(a,t)}).filter(s=>s.length>0).join("&")}function qR(e,t){var i;t={decode:!0,...t};let[n,r]=VR(e,"#");return n===void 0&&(n=e),{url:((i=n==null?void 0:n.split("?"))==null?void 0:i[0])??"",query:Bx(Fx(e),t),...t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:So(r,t)}:{}}}function WR(e,t){t={encode:!0,strict:!0,[BS]:!0,...t};const n=GR(e.url).split("?")[0]||"",r=Fx(e.url),i={...Bx(r,{sort:!1}),...e.query};let o=HR(i,t);o&&(o=`?${o}`);let s=nZ(e.url);if(e.fragmentIdentifier){const a=new URL(n);a.hash=e.fragmentIdentifier,s=t[BS]?a.hash:`#${e.fragmentIdentifier}`}return`${n}${o}${s}`}function KR(e,t,n){n={parseFragmentIdentifier:!0,[BS]:!1,...n};const{url:r,query:i,fragmentIdentifier:o}=qR(e,n);return WR({url:r,query:QQ(i,t),fragmentIdentifier:o},n)}function rZ(e,t,n){const r=Array.isArray(t)?i=>!t.includes(i):(i,o)=>!t(i,o);return KR(e,r,n)}const hg=Object.freeze(Object.defineProperty({__proto__:null,exclude:rZ,extract:Fx,parse:Bx,parseUrl:qR,pick:KR,stringify:HR,stringifyUrl:WR},Symbol.toStringTag,{value:"Module"}));var Tm=globalThis&&globalThis.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(c){return l([u,c])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]"u"||navigator.onLine===void 0?!0:navigator.onLine}function hZ(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}var iT=wi;function QR(e,t){if(e===t||!(iT(e)&&iT(t)||Array.isArray(e)&&Array.isArray(t)))return t;for(var n=Object.keys(t),r=Object.keys(e),i=n.length===r.length,o=Array.isArray(t)?[]:{},s=0,a=n;s=200&&e.status<=299},gZ=function(e){return/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"")};function sT(e){if(!wi(e))return e;for(var t=$t({},e),n=0,r=Object.entries(t);n"u"&&a===oT&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(g,b){return Am(t,null,function(){var S,w,x,T,P,E,A,$,M,C,O,I,N,R,D,L,j,U,G,W,X,Y,B,H,Q,J,ne,te,xe,ve,ce,Ne,se,pt,yn,Rt;return Tm(this,function(ut){switch(ut.label){case 0:return S=b.signal,w=b.getState,x=b.extra,T=b.endpoint,P=b.forced,E=b.type,$=typeof g=="string"?{url:g}:g,M=$.url,C=$.headers,O=C===void 0?new Headers(y.headers):C,I=$.params,N=I===void 0?void 0:I,R=$.responseHandler,D=R===void 0?m??"json":R,L=$.validateStatus,j=L===void 0?_??pZ:L,U=$.timeout,G=U===void 0?p:U,W=nT($,["url","headers","params","responseHandler","validateStatus","timeout"]),X=$t(Gi($t({},y),{signal:S}),W),O=new Headers(sT(O)),Y=X,[4,o(O,{getState:w,extra:x,endpoint:T,forced:P,type:E})];case 1:Y.headers=ut.sent()||O,B=function(Je){return typeof Je=="object"&&(wi(Je)||Array.isArray(Je)||typeof Je.toJSON=="function")},!X.headers.has("content-type")&&B(X.body)&&X.headers.set("content-type",f),B(X.body)&&c(X.headers)&&(X.body=JSON.stringify(X.body,h)),N&&(H=~M.indexOf("?")?"&":"?",Q=l?l(N):new URLSearchParams(sT(N)),M+=H+Q),M=dZ(r,M),J=new Request(M,X),ne=J.clone(),A={request:ne},xe=!1,ve=G&&setTimeout(function(){xe=!0,b.abort()},G),ut.label=2;case 2:return ut.trys.push([2,4,5,6]),[4,a(J)];case 3:return te=ut.sent(),[3,6];case 4:return ce=ut.sent(),[2,{error:{status:xe?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ce)},meta:A}];case 5:return ve&&clearTimeout(ve),[7];case 6:Ne=te.clone(),A.response=Ne,pt="",ut.label=7;case 7:return ut.trys.push([7,9,,10]),[4,Promise.all([v(te,D).then(function(Je){return se=Je},function(Je){return yn=Je}),Ne.text().then(function(Je){return pt=Je},function(){})])];case 8:if(ut.sent(),yn)throw yn;return[3,10];case 9:return Rt=ut.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:te.status,data:pt,error:String(Rt)},meta:A}];case 10:return[2,j(te,se)?{data:se,meta:A}:{error:{status:te.status,data:se},meta:A}]}})})};function v(g,b){return Am(this,null,function(){var S;return Tm(this,function(w){switch(w.label){case 0:return typeof b=="function"?[2,b(g)]:(b==="content-type"&&(b=c(g.headers)?"json":"text"),b!=="json"?[3,2]:[4,g.text()]);case 1:return S=w.sent(),[2,S.length?JSON.parse(S):null];case 2:return[2,g.text()]}})})}}var aT=function(){function e(t,n){n===void 0&&(n=void 0),this.value=t,this.meta=n}return e}(),jx=ue("__rtkq/focused"),ZR=ue("__rtkq/unfocused"),Vx=ue("__rtkq/online"),JR=ue("__rtkq/offline"),to;(function(e){e.query="query",e.mutation="mutation"})(to||(to={}));function e7(e){return e.type===to.query}function yZ(e){return e.type===to.mutation}function t7(e,t,n,r,i,o){return vZ(e)?e(t,n,r,i).map(jS).map(o):Array.isArray(e)?e.map(jS).map(o):[]}function vZ(e){return typeof e=="function"}function jS(e){return typeof e=="string"?{type:e}:e}function bb(e){return e!=null}var Pf=Symbol("forceQueryFn"),VS=function(e){return typeof e[Pf]=="function"};function bZ(e){var t=e.serializeQueryArgs,n=e.queryThunk,r=e.mutationThunk,i=e.api,o=e.context,s=new Map,a=new Map,l=i.internalActions,u=l.unsubscribeQueryResult,c=l.removeMutationResult,d=l.updateSubscriptionOptions;return{buildInitiateQuery:v,buildInitiateMutation:g,getRunningQueryThunk:p,getRunningMutationThunk:m,getRunningQueriesThunk:_,getRunningMutationsThunk:y,getRunningOperationPromises:h,removalWarning:f};function f(){throw new Error(`This method had to be removed due to a conceptual bug in RTK. + Please see https://github.com/reduxjs/redux-toolkit/pull/2481 for details. + See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for new guidance on SSR.`)}function h(){typeof process<"u";var b=function(S){return Array.from(S.values()).flatMap(function(w){return w?Object.values(w):[]})};return Em(Em([],b(s)),b(a)).filter(bb)}function p(b,S){return function(w){var x,T=o.endpointDefinitions[b],P=t({queryArgs:S,endpointDefinition:T,endpointName:b});return(x=s.get(w))==null?void 0:x[P]}}function m(b,S){return function(w){var x;return(x=a.get(w))==null?void 0:x[S]}}function _(){return function(b){return Object.values(s.get(b)||{}).filter(bb)}}function y(){return function(b){return Object.values(a.get(b)||{}).filter(bb)}}function v(b,S){var w=function(x,T){var P=T===void 0?{}:T,E=P.subscribe,A=E===void 0?!0:E,$=P.forceRefetch,M=P.subscriptionOptions,C=Pf,O=P[C];return function(I,N){var R,D,L=t({queryArgs:x,endpointDefinition:S,endpointName:b}),j=n((R={type:"query",subscribe:A,forceRefetch:$,subscriptionOptions:M,endpointName:b,originalArgs:x,queryCacheKey:L},R[Pf]=O,R)),U=i.endpoints[b].select(x),G=I(j),W=U(N()),X=G.requestId,Y=G.abort,B=W.requestId!==X,H=(D=s.get(I))==null?void 0:D[L],Q=function(){return U(N())},J=Object.assign(O?G.then(Q):B&&!H?Promise.resolve(W):Promise.all([H,G]).then(Q),{arg:x,requestId:X,subscriptionOptions:M,queryCacheKey:L,abort:Y,unwrap:function(){return Am(this,null,function(){var te;return Tm(this,function(xe){switch(xe.label){case 0:return[4,J];case 1:if(te=xe.sent(),te.isError)throw te.error;return[2,te.data]}})})},refetch:function(){return I(w(x,{subscribe:!1,forceRefetch:!0}))},unsubscribe:function(){A&&I(u({queryCacheKey:L,requestId:X}))},updateSubscriptionOptions:function(te){J.subscriptionOptions=te,I(d({endpointName:b,requestId:X,queryCacheKey:L,options:te}))}});if(!H&&!B&&!O){var ne=s.get(I)||{};ne[L]=J,s.set(I,ne),J.then(function(){delete ne[L],Object.keys(ne).length||s.delete(I)})}return J}};return w}function g(b){return function(S,w){var x=w===void 0?{}:w,T=x.track,P=T===void 0?!0:T,E=x.fixedCacheKey;return function(A,$){var M=r({type:"mutation",endpointName:b,originalArgs:S,track:P,fixedCacheKey:E}),C=A(M),O=C.requestId,I=C.abort,N=C.unwrap,R=C.unwrap().then(function(U){return{data:U}}).catch(function(U){return{error:U}}),D=function(){A(c({requestId:O,fixedCacheKey:E}))},L=Object.assign(R,{arg:C.arg,requestId:O,abort:I,unwrap:N,unsubscribe:D,reset:D}),j=a.get(A)||{};return a.set(A,j),j[O]=L,L.then(function(){delete j[O],Object.keys(j).length||a.delete(A)}),E&&(j[E]=L,L.then(function(){j[E]===L&&(delete j[E],Object.keys(j).length||a.delete(A))})),L}}}}function lT(e){return e}function _Z(e){var t=this,n=e.reducerPath,r=e.baseQuery,i=e.context.endpointDefinitions,o=e.serializeQueryArgs,s=e.api,a=function(g,b,S){return function(w){var x=i[g];w(s.internalActions.queryResultPatched({queryCacheKey:o({queryArgs:b,endpointDefinition:x,endpointName:g}),patches:S}))}},l=function(g,b,S){return function(w,x){var T,P,E=s.endpoints[g].select(b)(x()),A={patches:[],inversePatches:[],undo:function(){return w(s.util.patchQueryData(g,b,A.inversePatches))}};if(E.status===yt.uninitialized)return A;if("data"in E)if(mr(E.data)){var $=mx(E.data,S),M=$[1],C=$[2];(T=A.patches).push.apply(T,M),(P=A.inversePatches).push.apply(P,C)}else{var O=S(E.data);A.patches.push({op:"replace",path:[],value:O}),A.inversePatches.push({op:"replace",path:[],value:E.data})}return w(s.util.patchQueryData(g,b,A.patches)),A}},u=function(g,b,S){return function(w){var x;return w(s.endpoints[g].initiate(b,(x={subscribe:!1,forceRefetch:!0},x[Pf]=function(){return{data:S}},x)))}},c=function(g,b){return Am(t,[g,b],function(S,w){var x,T,P,E,A,$,M,C,O,I,N,R,D,L,j,U,G,W,X=w.signal,Y=w.abort,B=w.rejectWithValue,H=w.fulfillWithValue,Q=w.dispatch,J=w.getState,ne=w.extra;return Tm(this,function(te){switch(te.label){case 0:x=i[S.endpointName],te.label=1;case 1:return te.trys.push([1,8,,13]),T=lT,P=void 0,E={signal:X,abort:Y,dispatch:Q,getState:J,extra:ne,endpoint:S.endpointName,type:S.type,forced:S.type==="query"?d(S,J()):void 0},A=S.type==="query"?S[Pf]:void 0,A?(P=A(),[3,6]):[3,2];case 2:return x.query?[4,r(x.query(S.originalArgs),E,x.extraOptions)]:[3,4];case 3:return P=te.sent(),x.transformResponse&&(T=x.transformResponse),[3,6];case 4:return[4,x.queryFn(S.originalArgs,E,x.extraOptions,function(xe){return r(xe,E,x.extraOptions)})];case 5:P=te.sent(),te.label=6;case 6:if(typeof process<"u",P.error)throw new aT(P.error,P.meta);return N=H,[4,T(P.data,P.meta,S.originalArgs)];case 7:return[2,N.apply(void 0,[te.sent(),(G={fulfilledTimeStamp:Date.now(),baseQueryMeta:P.meta},G[Ma]=!0,G)])];case 8:if(R=te.sent(),D=R,!(D instanceof aT))return[3,12];L=lT,x.query&&x.transformErrorResponse&&(L=x.transformErrorResponse),te.label=9;case 9:return te.trys.push([9,11,,12]),j=B,[4,L(D.value,D.meta,S.originalArgs)];case 10:return[2,j.apply(void 0,[te.sent(),(W={baseQueryMeta:D.meta},W[Ma]=!0,W)])];case 11:return U=te.sent(),D=U,[3,12];case 12:throw typeof process<"u",console.error(D),D;case 13:return[2]}})})};function d(g,b){var S,w,x,T,P=(w=(S=b[n])==null?void 0:S.queries)==null?void 0:w[g.queryCacheKey],E=(x=b[n])==null?void 0:x.config.refetchOnMountOrArgChange,A=P==null?void 0:P.fulfilledTimeStamp,$=(T=g.forceRefetch)!=null?T:g.subscribe&&E;return $?$===!0||(Number(new Date)-Number(A))/1e3>=$:!1}var f=js(n+"/executeQuery",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[Ma]=!0,g},condition:function(g,b){var S=b.getState,w,x,T,P=S(),E=(x=(w=P[n])==null?void 0:w.queries)==null?void 0:x[g.queryCacheKey],A=E==null?void 0:E.fulfilledTimeStamp,$=g.originalArgs,M=E==null?void 0:E.originalArgs,C=i[g.endpointName];return VS(g)?!0:(E==null?void 0:E.status)==="pending"?!1:d(g,P)||e7(C)&&((T=C==null?void 0:C.forceRefetch)!=null&&T.call(C,{currentArg:$,previousArg:M,endpointState:E,state:P}))?!0:!A},dispatchConditionRejection:!0}),h=js(n+"/executeMutation",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[Ma]=!0,g}}),p=function(g){return"force"in g},m=function(g){return"ifOlderThan"in g},_=function(g,b,S){return function(w,x){var T=p(S)&&S.force,P=m(S)&&S.ifOlderThan,E=function(C){return C===void 0&&(C=!0),s.endpoints[g].initiate(b,{forceRefetch:C})},A=s.endpoints[g].select(b)(x());if(T)w(E());else if(P){var $=A==null?void 0:A.fulfilledTimeStamp;if(!$){w(E());return}var M=(Number(new Date)-Number(new Date($)))/1e3>=P;M&&w(E())}else w(E(!1))}};function y(g){return function(b){var S,w;return((w=(S=b==null?void 0:b.meta)==null?void 0:S.arg)==null?void 0:w.endpointName)===g}}function v(g,b){return{matchPending:Pu(d0(g),y(b)),matchFulfilled:Pu(ta(g),y(b)),matchRejected:Pu(Qu(g),y(b))}}return{queryThunk:f,mutationThunk:h,prefetch:_,updateQueryData:l,upsertQueryData:u,patchQueryData:a,buildMatchThunkActions:v}}function n7(e,t,n,r){return t7(n[e.meta.arg.endpointName][t],ta(e)?e.payload:void 0,ch(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function vp(e,t,n){var r=e[t];r&&n(r)}function Af(e){var t;return(t="arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)!=null?t:e.requestId}function uT(e,t,n){var r=e[Af(t)];r&&n(r)}var Gc={};function SZ(e){var t=e.reducerPath,n=e.queryThunk,r=e.mutationThunk,i=e.context,o=i.endpointDefinitions,s=i.apiUid,a=i.extractRehydrationInfo,l=i.hasRehydrationInfo,u=e.assertTagType,c=e.config,d=ue(t+"/resetApiState"),f=Et({name:t+"/queries",initialState:Gc,reducers:{removeQueryResult:{reducer:function(S,w){var x=w.payload.queryCacheKey;delete S[x]},prepare:dg()},queryResultPatched:function(S,w){var x=w.payload,T=x.queryCacheKey,P=x.patches;vp(S,T,function(E){E.data=_S(E.data,P.concat())})}},extraReducers:function(S){S.addCase(n.pending,function(w,x){var T=x.meta,P=x.meta.arg,E,A,$=VS(P);(P.subscribe||$)&&((A=w[E=P.queryCacheKey])!=null||(w[E]={status:yt.uninitialized,endpointName:P.endpointName})),vp(w,P.queryCacheKey,function(M){M.status=yt.pending,M.requestId=$&&M.requestId?M.requestId:T.requestId,P.originalArgs!==void 0&&(M.originalArgs=P.originalArgs),M.startedTimeStamp=T.startedTimeStamp})}).addCase(n.fulfilled,function(w,x){var T=x.meta,P=x.payload;vp(w,T.arg.queryCacheKey,function(E){var A;if(!(E.requestId!==T.requestId&&!VS(T.arg))){var $=o[T.arg.endpointName].merge;if(E.status=yt.fulfilled,$)if(E.data!==void 0){var M=T.fulfilledTimeStamp,C=T.arg,O=T.baseQueryMeta,I=T.requestId,N=Js(E.data,function(R){return $(R,P,{arg:C.originalArgs,baseQueryMeta:O,fulfilledTimeStamp:M,requestId:I})});E.data=N}else E.data=P;else E.data=(A=o[T.arg.endpointName].structuralSharing)==null||A?QR(Jn(E.data)?ux(E.data):E.data,P):P;delete E.error,E.fulfilledTimeStamp=T.fulfilledTimeStamp}})}).addCase(n.rejected,function(w,x){var T=x.meta,P=T.condition,E=T.arg,A=T.requestId,$=x.error,M=x.payload;vp(w,E.queryCacheKey,function(C){if(!P){if(C.requestId!==A)return;C.status=yt.rejected,C.error=M??$}})}).addMatcher(l,function(w,x){for(var T=a(x).queries,P=0,E=Object.entries(T);P{const r=Ef.get(),i=Tf.get();return mZ({baseUrl:`${r??""}/api/v1`,prepareHeaders:s=>(i&&s.set("Authorization",`Bearer ${i}`),s)})(e,t,n)},Gs=ZZ({baseQuery:eJ,reducerPath:"api",tagTypes:JZ,endpoints:()=>({})}),xb=(e,t)=>{if(!e)return!1;const n=zS.selectAll(e);if(n.length>1){const r=new Date(t.created_at),i=new Date(n[n.length-1].created_at);return r>=i}else if([0,1].includes(n.length))return!0;return!1},Hc=e=>pi.includes(e.image_category)?pi:_s,Wn=ea({selectId:e=>e.image_name,sortComparer:(e,t)=>qQ(t.updated_at,e.updated_at)}),zS=Wn.getSelectors(),ci=e=>`images/?${hg.stringify(e,{arrayFormat:"none"})}`,he=Gs.injectEndpoints({endpoints:e=>({listImages:e.query({query:t=>({url:ci(t),method:"GET"}),providesTags:(t,n,{board_id:r,categories:i})=>[{type:"ImageList",id:ci({board_id:r,categories:i})}],serializeQueryArgs:({queryArgs:t})=>{const{board_id:n,categories:r}=t;return ci({board_id:n,categories:r})},transformResponse(t){const{total:n,items:r}=t;return Wn.addMany(Wn.getInitialState({total:n}),r)},merge:(t,n)=>{Wn.addMany(t,zS.selectAll(n)),t.total=n.total},forceRefetch({currentArg:t,previousArg:n}){return(t==null?void 0:t.offset)!==(n==null?void 0:n.offset)},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;zS.selectAll(i).forEach(o=>{n(he.util.upsertQueryData("getImageDTO",o.image_name,o))})}catch{}},keepUnusedDataFor:86400}),getIntermediatesCount:e.query({query:()=>({url:ci({is_intermediate:!0})}),providesTags:["IntermediatesCount"],transformResponse:t=>t.total}),getImageDTO:e.query({query:t=>({url:`images/${t}`}),providesTags:(t,n,r)=>{const i=[{type:"Image",id:r}];return t!=null&&t.board_id&&i.push({type:"Board",id:t.board_id}),i},keepUnusedDataFor:86400}),getImageMetadata:e.query({query:t=>({url:`images/${t}/metadata`}),providesTags:(t,n,r)=>[{type:"ImageMetadata",id:r}],keepUnusedDataFor:86400}),getBoardImagesTotal:e.query({query:t=>({url:ci({board_id:t??"none",categories:pi,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardImagesTotal",id:r??"none"}],transformResponse:t=>t.total}),getBoardAssetsTotal:e.query({query:t=>({url:ci({board_id:t??"none",categories:_s,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardAssetsTotal",id:r??"none"}],transformResponse:t=>t.total}),clearIntermediates:e.mutation({query:()=>({url:"images/clear-intermediates",method:"POST"}),invalidatesTags:["IntermediatesCount"]}),deleteImage:e.mutation({query:({image_name:t})=>({url:`images/${t}`,method:"DELETE"}),invalidatesTags:(t,n,{board_id:r})=>[{type:"BoardImagesTotal",id:r??"none"},{type:"BoardAssetsTotal",id:r??"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){const{image_name:i,board_id:o}=t,s=[],a=Hc(t);s.push(n(he.util.updateQueryData("listImages",{board_id:o??"none",categories:a},l=>{const u=l.total,d=Wn.removeOne(l,i).total-u;l.total=l.total+d})));try{await r}catch{s.forEach(l=>l.undo())}}}),changeImageIsIntermediate:e.mutation({query:({imageDTO:t,is_intermediate:n})=>({url:`images/${t.image_name}`,method:"PATCH",body:{is_intermediate:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,is_intermediate:n},{dispatch:r,queryFulfilled:i,getState:o}){const s=[];s.push(r(he.util.updateQueryData("getImageDTO",t.image_name,l=>{Object.assign(l,{is_intermediate:n})})));const a=Hc(t);if(n)s.push(r(he.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:a},l=>{const u=l.total,d=Wn.removeOne(l,t.image_name).total-u;l.total=l.total+d})));else{console.log(t);const l={board_id:t.board_id??"none",categories:a},u=he.endpoints.listImages.select(l)(o()),c=u.data&&u.data.ids.length>=u.data.total,d=xb(u.data,t);(c||d)&&s.push(r(he.util.updateQueryData("listImages",l,f=>{const h=f.total,m=Wn.upsertOne(f,t).total-h;f.total=f.total+m})))}try{await i}catch{s.forEach(l=>l.undo())}}}),changeImageSessionId:e.mutation({query:({imageDTO:t,session_id:n})=>({url:`images/${t.image_name}`,method:"PATCH",body:{session_id:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,session_id:n},{dispatch:r,queryFulfilled:i,getState:o}){const s=[];s.push(r(he.util.updateQueryData("getImageDTO",t.image_name,a=>{Object.assign(a,{session_id:n})})));try{await i}catch{s.forEach(a=>a.undo())}}}),uploadImage:e.mutation({query:({file:t,image_category:n,is_intermediate:r,session_id:i,board_id:o,crop_visible:s})=>{const a=new FormData;return a.append("file",t),{url:"images/",method:"POST",body:a,params:{image_category:n,is_intermediate:r,session_id:i,board_id:o,crop_visible:s}}},async onQueryStarted({file:t,image_category:n,is_intermediate:r,postUploadAction:i,session_id:o,board_id:s},{dispatch:a,queryFulfilled:l}){try{const{data:u}=await l;if(u.is_intermediate)return;a(he.util.upsertQueryData("getImageDTO",u.image_name,u));const c=Hc(u);a(he.util.updateQueryData("listImages",{board_id:u.board_id??"none",categories:c},d=>{const f=d.total,p=Wn.addOne(d,u).total-f;d.total=d.total+p})),a(he.util.invalidateTags([{type:"BoardImagesTotal",id:u.board_id??"none"},{type:"BoardAssetsTotal",id:u.board_id??"none"}]))}catch{}}}),addImageToBoard:e.mutation({query:({board_id:t,imageDTO:n})=>{const{image_name:r}=n;return{url:"board_images/",method:"POST",body:{board_id:t,image_name:r}}},invalidatesTags:(t,n,{board_id:r,imageDTO:i})=>[{type:"Board",id:r},{type:"BoardImagesTotal",id:r},{type:"BoardImagesTotal",id:i.board_id??"none"},{type:"BoardAssetsTotal",id:r},{type:"BoardAssetsTotal",id:i.board_id??"none"}],async onQueryStarted({board_id:t,imageDTO:n},{dispatch:r,queryFulfilled:i,getState:o}){const s=[],a=Hc(n);if(s.push(r(he.util.updateQueryData("getImageDTO",n.image_name,l=>{Object.assign(l,{board_id:t})}))),!n.is_intermediate){s.push(r(he.util.updateQueryData("listImages",{board_id:n.board_id??"none",categories:a},f=>{const h=f.total,m=Wn.removeOne(f,n.image_name).total-h;f.total=f.total+m})));const l={board_id:t??"none",categories:a},u=he.endpoints.listImages.select(l)(o()),c=u.data&&u.data.ids.length>=u.data.total,d=xb(u.data,n);(c||d)&&s.push(r(he.util.updateQueryData("listImages",l,f=>{const h=f.total,m=Wn.addOne(f,n).total-h;f.total=f.total+m})))}try{await i}catch{s.forEach(l=>l.undo())}}}),removeImageFromBoard:e.mutation({query:({imageDTO:t})=>{const{board_id:n,image_name:r}=t;return{url:"board_images/",method:"DELETE",body:{board_id:n,image_name:r}}},invalidatesTags:(t,n,{imageDTO:r})=>[{type:"Board",id:r.board_id},{type:"BoardImagesTotal",id:r.board_id},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:r.board_id},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted({imageDTO:t},{dispatch:n,queryFulfilled:r,getState:i}){const o=Hc(t),s=[];s.push(n(he.util.updateQueryData("getImageDTO",t.image_name,d=>{Object.assign(d,{board_id:void 0})}))),s.push(n(he.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:o},d=>{const f=d.total,p=Wn.removeOne(d,t.image_name).total-f;d.total=d.total+p})));const a={board_id:"none",categories:o},l=he.endpoints.listImages.select(a)(i()),u=l.data&&l.data.ids.length>=l.data.total,c=xb(l.data,t);(u||c)&&s.push(n(he.util.updateQueryData("listImages",a,d=>{const f=d.total,p=Wn.upsertOne(d,t).total-f;d.total=d.total+p})));try{await r}catch{s.forEach(d=>d.undo())}}})})}),{useGetIntermediatesCountQuery:WCe,useListImagesQuery:KCe,useLazyListImagesQuery:XCe,useGetImageDTOQuery:YCe,useGetImageMetadataQuery:QCe,useDeleteImageMutation:ZCe,useGetBoardImagesTotalQuery:JCe,useGetBoardAssetsTotalQuery:e3e,useUploadImageMutation:t3e,useAddImageToBoardMutation:n3e,useRemoveImageFromBoardMutation:r3e,useClearIntermediatesMutation:i3e}=he,i7=ue("socket/socketConnected"),o7=ue("socket/appSocketConnected"),s7=ue("socket/socketDisconnected"),a7=ue("socket/appSocketDisconnected"),zx=ue("socket/socketSubscribed"),l7=ue("socket/appSocketSubscribed"),u7=ue("socket/socketUnsubscribed"),c7=ue("socket/appSocketUnsubscribed"),d7=ue("socket/socketInvocationStarted"),f7=ue("socket/appSocketInvocationStarted"),Ux=ue("socket/socketInvocationComplete"),h7=ue("socket/appSocketInvocationComplete"),p7=ue("socket/socketInvocationError"),Gx=ue("socket/appSocketInvocationError"),g7=ue("socket/socketGraphExecutionStateComplete"),m7=ue("socket/appSocketGraphExecutionStateComplete"),y7=ue("socket/socketGeneratorProgress"),v7=ue("socket/appSocketGeneratorProgress"),b7=ue("socket/socketModelLoadStarted"),tJ=ue("socket/appSocketModelLoadStarted"),_7=ue("socket/socketModelLoadCompleted"),nJ=ue("socket/appSocketModelLoadCompleted"),S7=ue("socket/socketSessionRetrievalError"),w7=ue("socket/appSocketSessionRetrievalError"),x7=ue("socket/socketInvocationRetrievalError"),C7=ue("socket/appSocketInvocationRetrievalError"),Hx=ue("controlNet/imageProcessed"),Ql={none:{type:"none",label:"none",description:"",default:{type:"none"}},canny_image_processor:{type:"canny_image_processor",label:"Canny",description:"",default:{id:"canny_image_processor",type:"canny_image_processor",low_threshold:100,high_threshold:200}},content_shuffle_image_processor:{type:"content_shuffle_image_processor",label:"Content Shuffle",description:"",default:{id:"content_shuffle_image_processor",type:"content_shuffle_image_processor",detect_resolution:512,image_resolution:512,h:512,w:512,f:256}},hed_image_processor:{type:"hed_image_processor",label:"HED",description:"",default:{id:"hed_image_processor",type:"hed_image_processor",detect_resolution:512,image_resolution:512,scribble:!1}},lineart_anime_image_processor:{type:"lineart_anime_image_processor",label:"Lineart Anime",description:"",default:{id:"lineart_anime_image_processor",type:"lineart_anime_image_processor",detect_resolution:512,image_resolution:512}},lineart_image_processor:{type:"lineart_image_processor",label:"Lineart",description:"",default:{id:"lineart_image_processor",type:"lineart_image_processor",detect_resolution:512,image_resolution:512,coarse:!1}},mediapipe_face_processor:{type:"mediapipe_face_processor",label:"Mediapipe Face",description:"",default:{id:"mediapipe_face_processor",type:"mediapipe_face_processor",max_faces:1,min_confidence:.5}},midas_depth_image_processor:{type:"midas_depth_image_processor",label:"Depth (Midas)",description:"",default:{id:"midas_depth_image_processor",type:"midas_depth_image_processor",a_mult:2,bg_th:.1}},mlsd_image_processor:{type:"mlsd_image_processor",label:"M-LSD",description:"",default:{id:"mlsd_image_processor",type:"mlsd_image_processor",detect_resolution:512,image_resolution:512,thr_d:.1,thr_v:.1}},normalbae_image_processor:{type:"normalbae_image_processor",label:"Normal BAE",description:"",default:{id:"normalbae_image_processor",type:"normalbae_image_processor",detect_resolution:512,image_resolution:512}},openpose_image_processor:{type:"openpose_image_processor",label:"Openpose",description:"",default:{id:"openpose_image_processor",type:"openpose_image_processor",detect_resolution:512,image_resolution:512,hand_and_face:!1}},pidi_image_processor:{type:"pidi_image_processor",label:"PIDI",description:"",default:{id:"pidi_image_processor",type:"pidi_image_processor",detect_resolution:512,image_resolution:512,scribble:!1,safe:!1}},zoe_depth_image_processor:{type:"zoe_depth_image_processor",label:"Depth (Zoe)",description:"",default:{id:"zoe_depth_image_processor",type:"zoe_depth_image_processor"}}},wp={canny:"canny_image_processor",mlsd:"mlsd_image_processor",depth:"midas_depth_image_processor",bae:"normalbae_image_processor",lineart:"lineart_image_processor",lineart_anime:"lineart_anime_image_processor",softedge:"hed_image_processor",shuffle:"content_shuffle_image_processor",openpose:"openpose_image_processor",mediapipe:"mediapipe_face_processor"},bT={isEnabled:!0,model:null,weight:1,beginStepPct:0,endStepPct:1,controlMode:"balanced",resizeMode:"just_resize",controlImage:null,processedControlImage:null,processorType:"canny_image_processor",processorNode:Ql.canny_image_processor.default,shouldAutoConfig:!0},US={controlNets:{},isEnabled:!1,pendingControlImages:[]},T7=Et({name:"controlNet",initialState:US,reducers:{isControlNetEnabledToggled:e=>{e.isEnabled=!e.isEnabled},controlNetAdded:(e,t)=>{const{controlNetId:n,controlNet:r}=t.payload;e.controlNets[n]={...r??bT,controlNetId:n}},controlNetDuplicated:(e,t)=>{const{sourceControlNetId:n,newControlNetId:r}=t.payload,i=Dn(e.controlNets[n]);i.controlNetId=r,e.controlNets[r]=i},controlNetAddedFromImage:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload;e.controlNets[n]={...bT,controlNetId:n,controlImage:r}},controlNetRemoved:(e,t)=>{const{controlNetId:n}=t.payload;delete e.controlNets[n]},controlNetToggled:(e,t)=>{const{controlNetId:n}=t.payload;e.controlNets[n].isEnabled=!e.controlNets[n].isEnabled},controlNetImageChanged:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload;e.controlNets[n].controlImage=r,e.controlNets[n].processedControlImage=null,r!==null&&e.controlNets[n].processorType!=="none"&&e.pendingControlImages.push(n)},controlNetProcessedImageChanged:(e,t)=>{const{controlNetId:n,processedControlImage:r}=t.payload;e.controlNets[n].processedControlImage=r,e.pendingControlImages=e.pendingControlImages.filter(i=>i!==n)},controlNetModelChanged:(e,t)=>{const{controlNetId:n,model:r}=t.payload;if(e.controlNets[n].model=r,e.controlNets[n].processedControlImage=null,e.controlNets[n].shouldAutoConfig){let i;for(const o in wp)if(r.model_name.includes(o)){i=wp[o];break}i?(e.controlNets[n].processorType=i,e.controlNets[n].processorNode=Ql[i].default):(e.controlNets[n].processorType="none",e.controlNets[n].processorNode=Ql.none.default)}},controlNetWeightChanged:(e,t)=>{const{controlNetId:n,weight:r}=t.payload;e.controlNets[n].weight=r},controlNetBeginStepPctChanged:(e,t)=>{const{controlNetId:n,beginStepPct:r}=t.payload;e.controlNets[n].beginStepPct=r},controlNetEndStepPctChanged:(e,t)=>{const{controlNetId:n,endStepPct:r}=t.payload;e.controlNets[n].endStepPct=r},controlNetControlModeChanged:(e,t)=>{const{controlNetId:n,controlMode:r}=t.payload;e.controlNets[n].controlMode=r},controlNetResizeModeChanged:(e,t)=>{const{controlNetId:n,resizeMode:r}=t.payload;e.controlNets[n].resizeMode=r},controlNetProcessorParamsChanged:(e,t)=>{const{controlNetId:n,changes:r}=t.payload,i=e.controlNets[n].processorNode;e.controlNets[n].processorNode={...i,...r},e.controlNets[n].shouldAutoConfig=!1},controlNetProcessorTypeChanged:(e,t)=>{const{controlNetId:n,processorType:r}=t.payload;e.controlNets[n].processedControlImage=null,e.controlNets[n].processorType=r,e.controlNets[n].processorNode=Ql[r].default,e.controlNets[n].shouldAutoConfig=!1},controlNetAutoConfigToggled:(e,t)=>{var i;const{controlNetId:n}=t.payload,r=!e.controlNets[n].shouldAutoConfig;if(r){let o;for(const s in wp)if((i=e.controlNets[n].model)!=null&&i.model_name.includes(s)){o=wp[s];break}o?(e.controlNets[n].processorType=o,e.controlNets[n].processorNode=Ql[o].default):(e.controlNets[n].processorType="none",e.controlNets[n].processorNode=Ql.none.default)}e.controlNets[n].shouldAutoConfig=r},controlNetReset:()=>({...US})},extraReducers:e=>{e.addCase(Hx,(t,n)=>{t.controlNets[n.payload.controlNetId].controlImage!==null&&t.pendingControlImages.push(n.payload.controlNetId)}),e.addCase(Gx,t=>{t.pendingControlImages=[]}),e.addMatcher(NR,t=>{t.pendingControlImages=[]}),e.addMatcher(he.endpoints.deleteImage.matchFulfilled,(t,n)=>{const{image_name:r}=n.meta.arg.originalArgs;Za(t.controlNets,i=>{i.controlImage===r&&(i.controlImage=null,i.processedControlImage=null),i.processedControlImage===r&&(i.processedControlImage=null)})})}}),{isControlNetEnabledToggled:o3e,controlNetAdded:s3e,controlNetDuplicated:a3e,controlNetAddedFromImage:l3e,controlNetRemoved:E7,controlNetImageChanged:qx,controlNetProcessedImageChanged:rJ,controlNetToggled:u3e,controlNetModelChanged:_T,controlNetWeightChanged:c3e,controlNetBeginStepPctChanged:d3e,controlNetEndStepPctChanged:f3e,controlNetControlModeChanged:h3e,controlNetResizeModeChanged:p3e,controlNetProcessorParamsChanged:iJ,controlNetProcessorTypeChanged:oJ,controlNetReset:P7,controlNetAutoConfigToggled:ST}=T7.actions,sJ=T7.reducer,A7={isEnabled:!1,maxPrompts:100,combinatorial:!0},aJ=A7,k7=Et({name:"dynamicPrompts",initialState:aJ,reducers:{maxPromptsChanged:(e,t)=>{e.maxPrompts=t.payload},maxPromptsReset:e=>{e.maxPrompts=A7.maxPrompts},combinatorialToggled:e=>{e.combinatorial=!e.combinatorial},isEnabledToggled:e=>{e.isEnabled=!e.isEnabled}}}),{isEnabledToggled:g3e,maxPromptsChanged:m3e,maxPromptsReset:y3e,combinatorialToggled:v3e}=k7.actions,lJ=k7.reducer,uJ={updateBoardModalOpen:!1,searchText:""},O7=Et({name:"boards",initialState:uJ,reducers:{setBoardSearchText:(e,t)=>{e.searchText=t.payload},setUpdateBoardModalOpen:(e,t)=>{e.updateBoardModalOpen=t.payload}}}),{setBoardSearchText:b3e,setUpdateBoardModalOpen:_3e}=O7.actions,cJ=O7.reducer,nc=Gs.injectEndpoints({endpoints:e=>({listBoards:e.query({query:t=>({url:"boards/",params:t}),providesTags:(t,n,r)=>{const i=[{type:"Board",id:Le}];return t&&i.push(...t.items.map(({board_id:o})=>({type:"Board",id:o}))),i}}),listAllBoards:e.query({query:()=>({url:"boards/",params:{all:!0}}),providesTags:(t,n,r)=>{const i=[{type:"Board",id:Le}];return t&&i.push(...t.map(({board_id:o})=>({type:"Board",id:o}))),i}}),listAllImageNamesForBoard:e.query({query:t=>({url:`boards/${t}/image_names`}),providesTags:(t,n,r)=>[{type:"ImageNameList",id:r}],keepUnusedDataFor:0}),createBoard:e.mutation({query:t=>({url:"boards/",method:"POST",params:{board_name:t}}),invalidatesTags:[{type:"Board",id:Le}]}),updateBoard:e.mutation({query:({board_id:t,changes:n})=>({url:`boards/${t}`,method:"PATCH",body:n}),invalidatesTags:(t,n,r)=>[{type:"Board",id:r.board_id}]}),deleteBoard:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE"}),invalidatesTags:(t,n,r)=>[{type:"Board",id:Le},{type:"ImageList",id:ci({board_id:"none",categories:pi})},{type:"ImageList",id:ci({board_id:"none",categories:_s})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{deleted_board_images:s}=o;s.forEach(u=>{n(he.util.updateQueryData("getImageDTO",u,c=>{c.board_id=void 0}))});const a=[{categories:pi},{categories:_s}],l=s.map(u=>({id:u,changes:{board_id:void 0}}));a.forEach(u=>{n(he.util.updateQueryData("listImages",u,c=>{const d=c.total,h=Wn.updateMany(c,l).total-d;c.total=c.total+h}))})}catch{}}}),deleteBoardAndImages:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE",params:{include_images:!0}}),invalidatesTags:(t,n,r)=>[{type:"Board",id:Le},{type:"ImageList",id:ci({board_id:"none",categories:pi})},{type:"ImageList",id:ci({board_id:"none",categories:_s})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{deleted_images:s}=o;[{categories:pi},{categories:_s}].forEach(l=>{n(he.util.updateQueryData("listImages",l,u=>{const c=u.total,f=Wn.removeMany(u,s).total-c;u.total=u.total+f}))})}catch{}}})})}),{useListBoardsQuery:S3e,useListAllBoardsQuery:w3e,useCreateBoardMutation:x3e,useUpdateBoardMutation:C3e,useDeleteBoardMutation:T3e,useDeleteBoardAndImagesMutation:E3e,useListAllImageNamesForBoardQuery:P3e}=nc,R7={selection:[],shouldAutoSwitch:!0,autoAddBoardId:void 0,galleryImageMinimumWidth:96,selectedBoardId:void 0,galleryView:"images",batchImageNames:[],isBatchEnabled:!1},M7=Et({name:"gallery",initialState:R7,reducers:{imageRangeEndSelected:()=>{},imageSelectionToggled:()=>{},imageSelected:(e,t)=>{e.selection=t.payload?[t.payload]:[]},shouldAutoSwitchChanged:(e,t)=>{e.shouldAutoSwitch=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},boardIdSelected:(e,t)=>{e.selectedBoardId=t.payload,e.galleryView="images"},isBatchEnabledChanged:(e,t)=>{e.isBatchEnabled=t.payload},imagesAddedToBatch:(e,t)=>{e.batchImageNames=rY(e.batchImageNames.concat(t.payload))},imagesRemovedFromBatch:(e,t)=>{e.batchImageNames=e.batchImageNames.filter(r=>!t.payload.includes(r));const n=e.selection.filter(r=>!t.payload.includes(r));if(n.length){e.selection=n;return}e.selection=[e.batchImageNames[0]]},batchReset:e=>{e.batchImageNames=[],e.selection=[]},autoAddBoardIdChanged:(e,t)=>{e.autoAddBoardId=t.payload},galleryViewChanged:(e,t)=>{e.galleryView=t.payload}},extraReducers:e=>{e.addMatcher(fJ,(t,n)=>{const r=n.meta.arg.originalArgs;r===t.selectedBoardId&&(t.selectedBoardId=void 0,t.galleryView="images"),r===t.autoAddBoardId&&(t.autoAddBoardId=void 0)}),e.addMatcher(nc.endpoints.listAllBoards.matchFulfilled,(t,n)=>{const r=n.payload;t.autoAddBoardId&&(r.map(i=>i.board_id).includes(t.autoAddBoardId)||(t.autoAddBoardId=void 0))})}}),{imageRangeEndSelected:A3e,imageSelectionToggled:k3e,imageSelected:Os,shouldAutoSwitchChanged:O3e,setGalleryImageMinimumWidth:R3e,boardIdSelected:GS,isBatchEnabledChanged:M3e,imagesAddedToBatch:HS,imagesRemovedFromBatch:I3e,autoAddBoardIdChanged:N3e,galleryViewChanged:Om}=M7.actions,dJ=M7.reducer,fJ=Jr(nc.endpoints.deleteBoard.matchFulfilled,nc.endpoints.deleteBoardAndImages.matchFulfilled),hJ={imageToDelete:null,isModalOpen:!1},I7=Et({name:"imageDeletion",initialState:hJ,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imageToDeleteSelected:(e,t)=>{e.imageToDelete=t.payload},imageToDeleteCleared:e=>{e.imageToDelete=null,e.isModalOpen=!1}}}),{isModalOpenChanged:N7,imageToDeleteSelected:pJ,imageToDeleteCleared:D3e}=I7.actions,gJ=I7.reducer,wT={weight:.75},mJ={loras:{}},D7=Et({name:"lora",initialState:mJ,reducers:{loraAdded:(e,t)=>{const{model_name:n,id:r,base_model:i}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,...wT}},loraRemoved:(e,t)=>{const n=t.payload;delete e.loras[n]},lorasCleared:e=>{e.loras={}},loraWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload;e.loras[n].weight=r},loraWeightReset:(e,t)=>{const n=t.payload;e.loras[n].weight=wT.weight}}}),{loraAdded:L3e,loraRemoved:L7,loraWeightChanged:$3e,loraWeightReset:F3e,lorasCleared:B3e}=D7.actions,yJ=D7.reducer;function ei(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const d=t;t=u??typeof c!="object"?c:Object.assign({},t,c),n.forEach(f=>f(t,d))}},i=()=>t,a={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{n.clear()}};return t=e(r,i,a),a},vJ=e=>e?xT(e):xT,{useSyncExternalStoreWithSelector:bJ}=Xj;function _J(e,t=e.getState,n){const r=bJ(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return k.useDebugValue(r),r}function vr(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r{}};function k0(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}gg.prototype=k0.prototype={constructor:gg,on:function(e,t){var n=this._,r=wJ(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),TT.hasOwnProperty(t)?{space:TT[t],local:e}:e}function CJ(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===qS&&t.documentElement.namespaceURI===qS?t.createElement(e):t.createElementNS(n,e)}}function TJ(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function $7(e){var t=O0(e);return(t.local?TJ:CJ)(t)}function EJ(){}function Wx(e){return e==null?EJ:function(){return this.querySelector(e)}}function PJ(e){typeof e!="function"&&(e=Wx(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=g&&(g=v+1);!(S=_[g])&&++g=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function ZJ(e){e||(e=JJ);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function eee(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function tee(){return Array.from(this)}function nee(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?hee:typeof t=="function"?gee:pee)(e,t,n??"")):rc(this.node(),e)}function rc(e,t){return e.style.getPropertyValue(t)||z7(e).getComputedStyle(e,null).getPropertyValue(t)}function yee(e){return function(){delete this[e]}}function vee(e,t){return function(){this[e]=t}}function bee(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function _ee(e,t){return arguments.length>1?this.each((t==null?yee:typeof t=="function"?bee:vee)(e,t)):this.node()[e]}function U7(e){return e.trim().split(/^|\s+/)}function Kx(e){return e.classList||new G7(e)}function G7(e){this._node=e,this._names=U7(e.getAttribute("class")||"")}G7.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function H7(e,t){for(var n=Kx(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Kee(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n()=>e;function WS(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:s,y:a,dx:l,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}WS.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ite(e){return!e.ctrlKey&&!e.button}function ote(){return this.parentNode}function ste(e,t){return t??{x:e.x,y:e.y}}function ate(){return navigator.maxTouchPoints||"ontouchstart"in this}function lte(){var e=ite,t=ote,n=ste,r=ate,i={},o=k0("start","drag","end"),s=0,a,l,u,c,d=0;function f(b){b.on("mousedown.drag",h).filter(r).on("touchstart.drag",_).on("touchmove.drag",y,rte).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(b,S){if(!(c||!e.call(this,b,S))){var w=g(this,t.call(this,b,S),b,S,"mouse");w&&(di(b.view).on("mousemove.drag",p,kf).on("mouseup.drag",m,kf),X7(b.view),Cb(b),u=!1,a=b.clientX,l=b.clientY,w("start",b))}}function p(b){if(Mu(b),!u){var S=b.clientX-a,w=b.clientY-l;u=S*S+w*w>d}i.mouse("drag",b)}function m(b){di(b.view).on("mousemove.drag mouseup.drag",null),Y7(b.view,u),Mu(b),i.mouse("end",b)}function _(b,S){if(e.call(this,b,S)){var w=b.changedTouches,x=t.call(this,b,S),T=w.length,P,E;for(P=0;P>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Cp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Cp(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=cte.exec(e))?new fr(t[1],t[2],t[3],1):(t=dte.exec(e))?new fr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=fte.exec(e))?Cp(t[1],t[2],t[3],t[4]):(t=hte.exec(e))?Cp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=pte.exec(e))?MT(t[1],t[2]/100,t[3]/100,1):(t=gte.exec(e))?MT(t[1],t[2]/100,t[3]/100,t[4]):ET.hasOwnProperty(e)?kT(ET[e]):e==="transparent"?new fr(NaN,NaN,NaN,0):null}function kT(e){return new fr(e>>16&255,e>>8&255,e&255,1)}function Cp(e,t,n,r){return r<=0&&(e=t=n=NaN),new fr(e,t,n,r)}function vte(e){return e instanceof _h||(e=Mf(e)),e?(e=e.rgb(),new fr(e.r,e.g,e.b,e.opacity)):new fr}function KS(e,t,n,r){return arguments.length===1?vte(e):new fr(e,t,n,r??1)}function fr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Xx(fr,KS,Q7(_h,{brighter(e){return e=e==null?Mm:Math.pow(Mm,e),new fr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Of:Math.pow(Of,e),new fr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new fr(za(this.r),za(this.g),za(this.b),Im(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:OT,formatHex:OT,formatHex8:bte,formatRgb:RT,toString:RT}));function OT(){return`#${Na(this.r)}${Na(this.g)}${Na(this.b)}`}function bte(){return`#${Na(this.r)}${Na(this.g)}${Na(this.b)}${Na((isNaN(this.opacity)?1:this.opacity)*255)}`}function RT(){const e=Im(this.opacity);return`${e===1?"rgb(":"rgba("}${za(this.r)}, ${za(this.g)}, ${za(this.b)}${e===1?")":`, ${e})`}`}function Im(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function za(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Na(e){return e=za(e),(e<16?"0":"")+e.toString(16)}function MT(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fi(e,t,n,r)}function Z7(e){if(e instanceof fi)return new fi(e.h,e.s,e.l,e.opacity);if(e instanceof _h||(e=Mf(e)),!e)return new fi;if(e instanceof fi)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,l=(o+i)/2;return a?(t===o?s=(n-r)/a+(n0&&l<1?0:s,new fi(s,a,l,e.opacity)}function _te(e,t,n,r){return arguments.length===1?Z7(e):new fi(e,t,n,r??1)}function fi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Xx(fi,_te,Q7(_h,{brighter(e){return e=e==null?Mm:Math.pow(Mm,e),new fi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Of:Math.pow(Of,e),new fi(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new fr(Tb(e>=240?e-240:e+120,i,r),Tb(e,i,r),Tb(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new fi(IT(this.h),Tp(this.s),Tp(this.l),Im(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Im(this.opacity);return`${e===1?"hsl(":"hsla("}${IT(this.h)}, ${Tp(this.s)*100}%, ${Tp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function IT(e){return e=(e||0)%360,e<0?e+360:e}function Tp(e){return Math.max(0,Math.min(1,e||0))}function Tb(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const J7=e=>()=>e;function Ste(e,t){return function(n){return e+n*t}}function wte(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function xte(e){return(e=+e)==1?eM:function(t,n){return n-t?wte(t,n,e):J7(isNaN(t)?n:t)}}function eM(e,t){var n=t-e;return n?Ste(e,n):J7(isNaN(e)?t:e)}const NT=function e(t){var n=xte(t);function r(i,o){var s=n((i=KS(i)).r,(o=KS(o)).r),a=n(i.g,o.g),l=n(i.b,o.b),u=eM(i.opacity,o.opacity);return function(c){return i.r=s(c),i.g=a(c),i.b=l(c),i.opacity=u(c),i+""}}return r.gamma=e,r}(1);function us(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var XS=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Eb=new RegExp(XS.source,"g");function Cte(e){return function(){return e}}function Tte(e){return function(t){return e(t)+""}}function Ete(e,t){var n=XS.lastIndex=Eb.lastIndex=0,r,i,o,s=-1,a=[],l=[];for(e=e+"",t=t+"";(r=XS.exec(e))&&(i=Eb.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:us(r,i)})),n=Eb.lastIndex;return n180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:us(u,c)})):c&&d.push(i(d)+"rotate("+c+r)}function a(u,c,d,f){u!==c?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:us(u,c)}):c&&d.push(i(d)+"skewX("+c+r)}function l(u,c,d,f,h,p){if(u!==d||c!==f){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:us(u,d)},{i:m-2,x:us(c,f)})}else(d!==1||f!==1)&&h.push(i(h)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=e(u),c=e(c),o(u.translateX,u.translateY,c.translateX,c.translateY,d,f),s(u.rotate,c.rotate,d,f),a(u.skewX,c.skewX,d,f),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(h){for(var p=-1,m=f.length,_;++p=0&&e._call.call(void 0,t),e=e._next;--ic}function $T(){nl=(Dm=If.now())+R0,ic=hd=0;try{Lte()}finally{ic=0,Fte(),nl=0}}function $te(){var e=If.now(),t=e-Dm;t>rM&&(R0-=t,Dm=e)}function Fte(){for(var e,t=Nm,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Nm=n);pd=e,QS(r)}function QS(e){if(!ic){hd&&(hd=clearTimeout(hd));var t=e-nl;t>24?(e<1/0&&(hd=setTimeout($T,e-If.now()-R0)),qc&&(qc=clearInterval(qc))):(qc||(Dm=If.now(),qc=setInterval($te,rM)),ic=1,iM($T))}}function FT(e,t,n){var r=new Lm;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Bte=k0("start","end","cancel","interrupt"),jte=[],sM=0,BT=1,ZS=2,mg=3,jT=4,JS=5,yg=6;function M0(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Vte(e,n,{name:t,index:r,group:i,on:Bte,tween:jte,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:sM})}function Qx(e,t){var n=Ei(e,t);if(n.state>sM)throw new Error("too late; already scheduled");return n}function oo(e,t){var n=Ei(e,t);if(n.state>mg)throw new Error("too late; already running");return n}function Ei(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Vte(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=oM(o,0,n.time);function o(u){n.state=BT,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var c,d,f,h;if(n.state!==BT)return l();for(c in r)if(h=r[c],h.name===n.name){if(h.state===mg)return FT(s);h.state===jT?(h.state=yg,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+cZS&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function yne(e,t,n){var r,i,o=mne(t)?Qx:oo;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function vne(e,t){var n=this._id;return arguments.length<2?Ei(this.node(),n).on.on(e):this.each(yne(n,e,t))}function bne(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function _ne(){return this.on("end.remove",bne(this._id))}function Sne(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Wx(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s()=>e;function qne(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Eo(e,t,n){this.k=e,this.x=t,this.y=n}Eo.prototype={constructor:Eo,scale:function(e){return e===1?this:new Eo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Eo(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Rs=new Eo(1,0,0);Eo.prototype;function Pb(e){e.stopImmediatePropagation()}function Wc(e){e.preventDefault(),e.stopImmediatePropagation()}function Wne(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Kne(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function VT(){return this.__zoom||Rs}function Xne(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Yne(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qne(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function Zne(){var e=Wne,t=Kne,n=Qne,r=Xne,i=Yne,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Nte,u=k0("start","zoom","end"),c,d,f,h=500,p=150,m=0,_=10;function y(C){C.property("__zoom",VT).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",E).filter(i).on("touchstart.zoom",A).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(C,O,I,N){var R=C.selection?C.selection():C;R.property("__zoom",VT),C!==R?S(C,O,I,N):R.interrupt().each(function(){w(this,arguments).event(N).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},y.scaleBy=function(C,O,I,N){y.scaleTo(C,function(){var R=this.__zoom.k,D=typeof O=="function"?O.apply(this,arguments):O;return R*D},I,N)},y.scaleTo=function(C,O,I,N){y.transform(C,function(){var R=t.apply(this,arguments),D=this.__zoom,L=I==null?b(R):typeof I=="function"?I.apply(this,arguments):I,j=D.invert(L),U=typeof O=="function"?O.apply(this,arguments):O;return n(g(v(D,U),L,j),R,s)},I,N)},y.translateBy=function(C,O,I,N){y.transform(C,function(){return n(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),s)},null,N)},y.translateTo=function(C,O,I,N,R){y.transform(C,function(){var D=t.apply(this,arguments),L=this.__zoom,j=N==null?b(D):typeof N=="function"?N.apply(this,arguments):N;return n(Rs.translate(j[0],j[1]).scale(L.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof I=="function"?-I.apply(this,arguments):-I),D,s)},N,R)};function v(C,O){return O=Math.max(o[0],Math.min(o[1],O)),O===C.k?C:new Eo(O,C.x,C.y)}function g(C,O,I){var N=O[0]-I[0]*C.k,R=O[1]-I[1]*C.k;return N===C.x&&R===C.y?C:new Eo(C.k,N,R)}function b(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function S(C,O,I,N){C.on("start.zoom",function(){w(this,arguments).event(N).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(N).end()}).tween("zoom",function(){var R=this,D=arguments,L=w(R,D).event(N),j=t.apply(R,D),U=I==null?b(j):typeof I=="function"?I.apply(R,D):I,G=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),W=R.__zoom,X=typeof O=="function"?O.apply(R,D):O,Y=l(W.invert(U).concat(G/W.k),X.invert(U).concat(G/X.k));return function(B){if(B===1)B=X;else{var H=Y(B),Q=G/H[2];B=new Eo(Q,U[0]-H[0]*Q,U[1]-H[1]*Q)}L.zoom(null,B)}})}function w(C,O,I){return!I&&C.__zooming||new x(C,O)}function x(C,O){this.that=C,this.args=O,this.active=0,this.sourceEvent=null,this.extent=t.apply(C,O),this.taps=0}x.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,O){return this.mouse&&C!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var O=di(this.that).datum();u.call(C,this.that,new qne(C,{sourceEvent:this.sourceEvent,target:y,type:C,transform:this.that.__zoom,dispatch:u}),O)}};function T(C,...O){if(!e.apply(this,arguments))return;var I=w(this,O).event(C),N=this.__zoom,R=Math.max(o[0],Math.min(o[1],N.k*Math.pow(2,r.apply(this,arguments)))),D=Li(C);if(I.wheel)(I.mouse[0][0]!==D[0]||I.mouse[0][1]!==D[1])&&(I.mouse[1]=N.invert(I.mouse[0]=D)),clearTimeout(I.wheel);else{if(N.k===R)return;I.mouse=[D,N.invert(D)],vg(this),I.start()}Wc(C),I.wheel=setTimeout(L,p),I.zoom("mouse",n(g(v(N,R),I.mouse[0],I.mouse[1]),I.extent,s));function L(){I.wheel=null,I.end()}}function P(C,...O){if(f||!e.apply(this,arguments))return;var I=C.currentTarget,N=w(this,O,!0).event(C),R=di(C.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",G,!0),D=Li(C,I),L=C.clientX,j=C.clientY;X7(C.view),Pb(C),N.mouse=[D,this.__zoom.invert(D)],vg(this),N.start();function U(W){if(Wc(W),!N.moved){var X=W.clientX-L,Y=W.clientY-j;N.moved=X*X+Y*Y>m}N.event(W).zoom("mouse",n(g(N.that.__zoom,N.mouse[0]=Li(W,I),N.mouse[1]),N.extent,s))}function G(W){R.on("mousemove.zoom mouseup.zoom",null),Y7(W.view,N.moved),Wc(W),N.event(W).end()}}function E(C,...O){if(e.apply(this,arguments)){var I=this.__zoom,N=Li(C.changedTouches?C.changedTouches[0]:C,this),R=I.invert(N),D=I.k*(C.shiftKey?.5:2),L=n(g(v(I,D),N,R),t.apply(this,O),s);Wc(C),a>0?di(this).transition().duration(a).call(S,L,N,C):di(this).call(y.transform,L,N,C)}}function A(C,...O){if(e.apply(this,arguments)){var I=C.touches,N=I.length,R=w(this,O,C.changedTouches.length===N).event(C),D,L,j,U;for(Pb(C),L=0;L"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`},cM=Hs.error001();function jt(e,t){const n=k.useContext(I0);if(n===null)throw new Error(cM);return _J(n,e,t)}const jn=()=>{const e=k.useContext(I0);if(e===null)throw new Error(cM);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},ere=e=>e.userSelectionActive?"none":"all";function tre({position:e,children:t,className:n,style:r,...i}){const o=jt(ere),s=`${e}`.split("-");return K.jsx("div",{className:ei(["react-flow__panel",n,...s]),style:{...r,pointerEvents:o},...i,children:t})}function nre({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:K.jsx(tre,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:K.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const rre=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:o={},labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:u,...c})=>{const d=k.useRef(null),[f,h]=k.useState({x:0,y:0,width:0,height:0}),p=ei(["react-flow__edge-textwrapper",u]);return k.useEffect(()=>{if(d.current){const m=d.current.getBBox();h({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),typeof n>"u"||!n?null:K.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...c,children:[i&&K.jsx("rect",{width:f.width+2*s[0],x:-s[0],y:-s[1],height:f.height+2*s[1],className:"react-flow__edge-textbg",style:o,rx:a,ry:a}),K.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:d,style:r,children:n}),l]})};var ire=k.memo(rre);const Jx=e=>({width:e.offsetWidth,height:e.offsetHeight}),oc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),eC=(e={x:0,y:0},t)=>({x:oc(e.x,t[0][0],t[1][0]),y:oc(e.y,t[0][1],t[1][1])}),zT=(e,t,n)=>en?-oc(Math.abs(e-n),1,50)/50:0,dM=(e,t)=>{const n=zT(e.x,35,t.width-35)*20,r=zT(e.y,35,t.height-35)*20;return[n,r]},fM=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},hM=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),$m=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),pM=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),UT=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),j3e=(e,t)=>pM(hM($m(e),$m(t))),e2=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},ore=e=>Wr(e.width)&&Wr(e.height)&&Wr(e.x)&&Wr(e.y),Wr=e=>!isNaN(e)&&isFinite(e),rn=Symbol.for("internals"),gM=["Enter"," ","Escape"],sre=(e,t)=>{},are=e=>"nativeEvent"in e;function t2(e){var i,o;const t=are(e)?e.nativeEvent:e,n=((o=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:o[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const mM=e=>"clientX"in e,Ms=(e,t)=>{var o,s;const n=mM(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},Sh=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h=20})=>K.jsxs(K.Fragment,{children:[K.jsx("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:f}),h&&K.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&Wr(n)&&Wr(r)?K.jsx(ire,{x:n,y:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u}):null]});Sh.displayName="BaseEdge";function Kc(e,t,n){return n===void 0?n:r=>{const i=t().edges.find(o=>o.id===e);i&&n(r,{...i})}}function yM({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n{const[_,y,v]=bM({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o});return K.jsx(Sh,{path:_,labelX:y,labelY:v,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:m})});tC.displayName="SimpleBezierEdge";const HT={[pe.Left]:{x:-1,y:0},[pe.Right]:{x:1,y:0},[pe.Top]:{x:0,y:-1},[pe.Bottom]:{x:0,y:1}},lre=({source:e,sourcePosition:t=pe.Bottom,target:n})=>t===pe.Left||t===pe.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function ure({source:e,sourcePosition:t=pe.Bottom,target:n,targetPosition:r=pe.Top,center:i,offset:o}){const s=HT[t],a=HT[r],l={x:e.x+s.x*o,y:e.y+s.y*o},u={x:n.x+a.x*o,y:n.y+a.y*o},c=lre({source:l,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",f=c[d];let h=[],p,m;const[_,y,v,g]=yM({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[d]*a[d]===-1){p=i.x||_,m=i.y||y;const S=[{x:p,y:l.y},{x:p,y:u.y}],w=[{x:l.x,y:m},{x:u.x,y:m}];s[d]===f?h=d==="x"?S:w:h=d==="x"?w:S}else{const S=[{x:l.x,y:u.y}],w=[{x:u.x,y:l.y}];if(d==="x"?h=s.x===f?w:S:h=s.y===f?S:w,t!==r){const x=d==="x"?"y":"x",T=s[d]===a[x],P=l[x]>u[x],E=l[x]{let g="";return v>0&&v{const[y,v,g]=n2({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset});return K.jsx(Sh,{path:y,labelX:v,labelY:g,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:p,interactionWidth:_})});N0.displayName="SmoothStepEdge";const nC=k.memo(e=>{var t;return K.jsx(N0,{...e,pathOptions:k.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});nC.displayName="StepEdge";function dre({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,s,a]=yM({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,s,a]}const rC=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})=>{const[p,m,_]=dre({sourceX:e,sourceY:t,targetX:n,targetY:r});return K.jsx(Sh,{path:p,labelX:m,labelY:_,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})});rC.displayName="StraightEdge";function Ap(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function WT({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case pe.Left:return[t-Ap(t-r,o),n];case pe.Right:return[t+Ap(r-t,o),n];case pe.Top:return[t,n-Ap(n-i,o)];case pe.Bottom:return[t,n+Ap(i-n,o)]}}function _M({sourceX:e,sourceY:t,sourcePosition:n=pe.Bottom,targetX:r,targetY:i,targetPosition:o=pe.Top,curvature:s=.25}){const[a,l]=WT({pos:n,x1:e,y1:t,x2:r,y2:i,c:s}),[u,c]=WT({pos:o,x1:r,y1:i,x2:e,y2:t,c:s}),[d,f,h,p]=vM({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:c});return[`M${e},${t} C${a},${l} ${u},${c} ${r},${i}`,d,f,h,p]}const Bm=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=pe.Bottom,targetPosition:o=pe.Top,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,pathOptions:m,interactionWidth:_})=>{const[y,v,g]=_M({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o,curvature:m==null?void 0:m.curvature});return K.jsx(Sh,{path:y,labelX:v,labelY:g,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:_})});Bm.displayName="BezierEdge";const iC=k.createContext(null),fre=iC.Provider;iC.Consumer;const hre=()=>k.useContext(iC),pre=e=>"id"in e&&"source"in e&&"target"in e,gre=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,r2=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,mre=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),SM=(e,t)=>{if(!e.source||!e.target)return t;let n;return pre(e)?n={...e}:n={...e,id:gre(e)},mre(n,t)?t:t.concat(n)},wM=({x:e,y:t},[n,r,i],o,[s,a])=>{const l={x:(e-n)/i,y:(t-r)/i};return o?{x:s*Math.round(l.x/s),y:a*Math.round(l.y/a)}:l},yre=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),Du=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},xM=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const{x:o,y:s}=Du(i,t).positionAbsolute;return hM(r,$m({x:o,y:s,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return pM(n)},CM=(e,t,[n,r,i]=[0,0,1],o=!1,s=!1,a=[0,0])=>{const l={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},u=[];return e.forEach(c=>{const{width:d,height:f,selectable:h=!0,hidden:p=!1}=c;if(s&&!h||p)return!1;const{positionAbsolute:m}=Du(c,a),_={x:m.x,y:m.y,width:d||0,height:f||0},y=e2(l,_),v=typeof d>"u"||typeof f>"u"||d===null||f===null,g=o&&y>0,b=(d||0)*(f||0);(v||g||y>=b||c.dragging)&&u.push(c)}),u},TM=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},EM=(e,t,n,r,i,o=.1)=>{const s=t/(e.width*(1+o)),a=n/(e.height*(1+o)),l=Math.min(s,a),u=oc(l,r,i),c=e.x+e.width/2,d=e.y+e.height/2,f=t/2-c*u,h=n/2-d*u;return[f,h,u]},Ca=(e,t=0)=>e.transition().duration(t);function KT(e,t,n,r){return(t[n]||[]).reduce((i,o)=>{var s,a;return`${e.id}-${o.id}-${n}`!==r&&i.push({id:o.id||null,type:n,nodeId:e.id,x:(((s=e.positionAbsolute)==null?void 0:s.x)??0)+o.x+o.width/2,y:(((a=e.positionAbsolute)==null?void 0:a.y)??0)+o.y+o.height/2}),i},[])}function vre(e,t,n,r,i,o){const{x:s,y:a}=Ms(e),u=t.elementsFromPoint(s,a).find(p=>p.classList.contains("react-flow__handle"));if(u){const p=u.getAttribute("data-nodeid");if(p){const m=oC(void 0,u),_=u.getAttribute("data-handleid"),y=o({nodeId:p,id:_,type:m});if(y)return{handle:{id:_,type:m,nodeId:p,x:n.x,y:n.y},validHandleResult:y}}}let c=[],d=1/0;if(i.forEach(p=>{const m=Math.sqrt((p.x-n.x)**2+(p.y-n.y)**2);if(m<=r){const _=o(p);m<=d&&(mp.isValid),h=c.some(({handle:p})=>p.type==="target");return c.find(({handle:p,validHandleResult:m})=>h?p.type==="target":f?m.isValid:!0)||c[0]}const bre={source:null,target:null,sourceHandle:null,targetHandle:null},PM=()=>({handleDomNode:null,isValid:!1,connection:bre,endHandle:null});function AM(e,t,n,r,i,o,s){const a=i==="target",l=s.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...PM(),handleDomNode:l};if(l){const c=oC(void 0,l),d=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),h=l.classList.contains("connectable"),p=l.classList.contains("connectableend"),m={source:a?d:n,sourceHandle:a?f:r,target:a?n:d,targetHandle:a?r:f};u.connection=m,h&&p&&(t===rl.Strict?a&&c==="source"||!a&&c==="target":d!==n||f!==r)&&(u.endHandle={nodeId:d,handleId:f,type:c},u.isValid=o(m))}return u}function _re({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((i,o)=>{if(o[rn]){const{handleBounds:s}=o[rn];let a=[],l=[];s&&(a=KT(o,s,"source",`${t}-${n}-${r}`),l=KT(o,s,"target",`${t}-${n}-${r}`)),i.push(...a,...l)}return i},[])}function oC(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ab(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function Sre(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function kM({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:o,setState:s,isValidConnection:a,edgeUpdaterType:l,onEdgeUpdateEnd:u}){const c=fM(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:h,connectionRadius:p,onConnectStart:m,panBy:_,getNodes:y,cancelConnection:v}=o();let g=0,b;const{x:S,y:w}=Ms(e),x=c==null?void 0:c.elementFromPoint(S,w),T=oC(l,x),P=f==null?void 0:f.getBoundingClientRect();if(!P||!T)return;let E,A=Ms(e,P),$=!1,M=null,C=!1,O=null;const I=_re({nodes:y(),nodeId:n,handleId:t,handleType:T}),N=()=>{if(!h)return;const[L,j]=dM(A,P);_({x:L,y:j}),g=requestAnimationFrame(N)};s({connectionPosition:A,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:T,connectionStartHandle:{nodeId:n,handleId:t,type:T},connectionEndHandle:null}),m==null||m(e,{nodeId:n,handleId:t,handleType:T});function R(L){const{transform:j}=o();A=Ms(L,P);const{handle:U,validHandleResult:G}=vre(L,c,wM(A,j,!1,[1,1]),p,I,W=>AM(W,d,n,t,i?"target":"source",a,c));if(b=U,$||(N(),$=!0),O=G.handleDomNode,M=G.connection,C=G.isValid,s({connectionPosition:b&&C?yre({x:b.x,y:b.y},j):A,connectionStatus:Sre(!!b,C),connectionEndHandle:G.endHandle}),!b&&!C&&!O)return Ab(E);M.source!==M.target&&O&&(Ab(E),E=O,O.classList.add("connecting","react-flow__handle-connecting"),O.classList.toggle("valid",C),O.classList.toggle("react-flow__handle-valid",C))}function D(L){var j,U;(b||O)&&M&&C&&(r==null||r(M)),(U=(j=o()).onConnectEnd)==null||U.call(j,L),l&&(u==null||u(L)),Ab(E),v(),cancelAnimationFrame(g),$=!1,C=!1,M=null,O=null,c.removeEventListener("mousemove",R),c.removeEventListener("mouseup",D),c.removeEventListener("touchmove",R),c.removeEventListener("touchend",D)}c.addEventListener("mousemove",R),c.addEventListener("mouseup",D),c.addEventListener("touchmove",R),c.addEventListener("touchend",D)}const XT=()=>!0,wre=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),xre=(e,t,n)=>r=>{const{connectionStartHandle:i,connectionEndHandle:o,connectionClickStartHandle:s}=r;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n}},OM=k.forwardRef(({type:e="source",position:t=pe.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:s,onConnect:a,children:l,className:u,onMouseDown:c,onTouchStart:d,...f},h)=>{var P,E;const p=s||null,m=e==="target",_=jn(),y=hre(),{connectOnClick:v,noPanClassName:g}=jt(wre,vr),{connecting:b,clickConnecting:S}=jt(xre(y,p,e),vr);y||(E=(P=_.getState()).onError)==null||E.call(P,"010",Hs.error010());const w=A=>{const{defaultEdgeOptions:$,onConnect:M,hasDefaultEdges:C}=_.getState(),O={...$,...A};if(C){const{edges:I,setEdges:N}=_.getState();N(SM(O,I))}M==null||M(O),a==null||a(O)},x=A=>{if(!y)return;const $=mM(A);i&&($&&A.button===0||!$)&&kM({event:A,handleId:p,nodeId:y,onConnect:w,isTarget:m,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||XT}),$?c==null||c(A):d==null||d(A)},T=A=>{const{onClickConnectStart:$,onClickConnectEnd:M,connectionClickStartHandle:C,connectionMode:O,isValidConnection:I}=_.getState();if(!y||!C&&!i)return;if(!C){$==null||$(A,{nodeId:y,handleId:p,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:y,type:e,handleId:p}});return}const N=fM(A.target),R=n||I||XT,{connection:D,isValid:L}=AM({nodeId:y,id:p,type:e},O,C.nodeId,C.handleId||null,C.type,R,N);L&&w(D),M==null||M(A),_.setState({connectionClickStartHandle:null})};return K.jsx("div",{"data-handleid":p,"data-nodeid":y,"data-handlepos":t,"data-id":`${y}-${p}-${e}`,className:ei(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,u,{source:!m,target:m,connectable:r,connectablestart:i,connectableend:o,connecting:S,connectionindicator:r&&(i&&!b||o&&b)}]),onMouseDown:x,onTouchStart:x,onClick:v?T:void 0,ref:h,...f,children:l})});OM.displayName="Handle";var jm=k.memo(OM);const RM=({data:e,isConnectable:t,targetPosition:n=pe.Top,sourcePosition:r=pe.Bottom})=>K.jsxs(K.Fragment,{children:[K.jsx(jm,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,K.jsx(jm,{type:"source",position:r,isConnectable:t})]});RM.displayName="DefaultNode";var i2=k.memo(RM);const MM=({data:e,isConnectable:t,sourcePosition:n=pe.Bottom})=>K.jsxs(K.Fragment,{children:[e==null?void 0:e.label,K.jsx(jm,{type:"source",position:n,isConnectable:t})]});MM.displayName="InputNode";var IM=k.memo(MM);const NM=({data:e,isConnectable:t,targetPosition:n=pe.Top})=>K.jsxs(K.Fragment,{children:[K.jsx(jm,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]});NM.displayName="OutputNode";var DM=k.memo(NM);const sC=()=>null;sC.displayName="GroupNode";const Cre=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),kp=e=>e.id;function Tre(e,t){return vr(e.selectedNodes.map(kp),t.selectedNodes.map(kp))&&vr(e.selectedEdges.map(kp),t.selectedEdges.map(kp))}const LM=k.memo(({onSelectionChange:e})=>{const t=jn(),{selectedNodes:n,selectedEdges:r}=jt(Cre,Tre);return k.useEffect(()=>{var o,s;const i={nodes:n,edges:r};e==null||e(i),(s=(o=t.getState()).onSelectionChange)==null||s.call(o,i)},[n,r,e]),null});LM.displayName="SelectionListener";const Ere=e=>!!e.onSelectionChange;function Pre({onSelectionChange:e}){const t=jt(Ere);return e||t?K.jsx(LM,{onSelectionChange:e}):null}const Are=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function Ll(e,t){k.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ae(e,t,n){k.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const kre=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:o,onConnectEnd:s,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:u,nodesConnectable:c,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:h,elevateNodesOnSelect:p,minZoom:m,maxZoom:_,nodeExtent:y,onNodesChange:v,onEdgesChange:g,elementsSelectable:b,connectionMode:S,snapGrid:w,snapToGrid:x,translateExtent:T,connectOnClick:P,defaultEdgeOptions:E,fitView:A,fitViewOptions:$,onNodesDelete:M,onEdgesDelete:C,onNodeDrag:O,onNodeDragStart:I,onNodeDragStop:N,onSelectionDrag:R,onSelectionDragStart:D,onSelectionDragStop:L,noPanClassName:j,nodeOrigin:U,rfId:G,autoPanOnConnect:W,autoPanOnNodeDrag:X,onError:Y,connectionRadius:B,isValidConnection:H})=>{const{setNodes:Q,setEdges:J,setDefaultNodesAndEdges:ne,setMinZoom:te,setMaxZoom:xe,setTranslateExtent:ve,setNodeExtent:ce,reset:Ne}=jt(Are,vr),se=jn();return k.useEffect(()=>{const pt=r==null?void 0:r.map(yn=>({...yn,...E}));return ne(n,pt),()=>{Ne()}},[]),Ae("defaultEdgeOptions",E,se.setState),Ae("connectionMode",S,se.setState),Ae("onConnect",i,se.setState),Ae("onConnectStart",o,se.setState),Ae("onConnectEnd",s,se.setState),Ae("onClickConnectStart",a,se.setState),Ae("onClickConnectEnd",l,se.setState),Ae("nodesDraggable",u,se.setState),Ae("nodesConnectable",c,se.setState),Ae("nodesFocusable",d,se.setState),Ae("edgesFocusable",f,se.setState),Ae("edgesUpdatable",h,se.setState),Ae("elementsSelectable",b,se.setState),Ae("elevateNodesOnSelect",p,se.setState),Ae("snapToGrid",x,se.setState),Ae("snapGrid",w,se.setState),Ae("onNodesChange",v,se.setState),Ae("onEdgesChange",g,se.setState),Ae("connectOnClick",P,se.setState),Ae("fitViewOnInit",A,se.setState),Ae("fitViewOnInitOptions",$,se.setState),Ae("onNodesDelete",M,se.setState),Ae("onEdgesDelete",C,se.setState),Ae("onNodeDrag",O,se.setState),Ae("onNodeDragStart",I,se.setState),Ae("onNodeDragStop",N,se.setState),Ae("onSelectionDrag",R,se.setState),Ae("onSelectionDragStart",D,se.setState),Ae("onSelectionDragStop",L,se.setState),Ae("noPanClassName",j,se.setState),Ae("nodeOrigin",U,se.setState),Ae("rfId",G,se.setState),Ae("autoPanOnConnect",W,se.setState),Ae("autoPanOnNodeDrag",X,se.setState),Ae("onError",Y,se.setState),Ae("connectionRadius",B,se.setState),Ae("isValidConnection",H,se.setState),Ll(e,Q),Ll(t,J),Ll(m,te),Ll(_,xe),Ll(T,ve),Ll(y,ce),null},YT={display:"none"},Ore={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},$M="react-flow__node-desc",FM="react-flow__edge-desc",Rre="react-flow__aria-live",Mre=e=>e.ariaLiveMessage;function Ire({rfId:e}){const t=jt(Mre);return K.jsx("div",{id:`${Rre}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ore,children:t})}function Nre({rfId:e,disableKeyboardA11y:t}){return K.jsxs(K.Fragment,{children:[K.jsxs("div",{id:`${$M}-${e}`,style:YT,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),K.jsx("div",{id:`${FM}-${e}`,style:YT,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&K.jsx(Ire,{rfId:e})]})}const Dre=(e,t,n)=>n===pe.Left?e-t:n===pe.Right?e+t:e,Lre=(e,t,n)=>n===pe.Top?e-t:n===pe.Bottom?e+t:e,QT="react-flow__edgeupdater",ZT=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:s,type:a})=>K.jsx("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:s,className:ei([QT,`${QT}-${a}`]),cx:Dre(t,r,e),cy:Lre(n,r,e),r,stroke:"transparent",fill:"transparent"}),$re=()=>!0;var $l=e=>{const t=({id:n,className:r,type:i,data:o,onClick:s,onEdgeDoubleClick:a,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:_,source:y,target:v,sourceX:g,sourceY:b,targetX:S,targetY:w,sourcePosition:x,targetPosition:T,elementsSelectable:P,hidden:E,sourceHandleId:A,targetHandleId:$,onContextMenu:M,onMouseEnter:C,onMouseMove:O,onMouseLeave:I,edgeUpdaterRadius:N,onEdgeUpdate:R,onEdgeUpdateStart:D,onEdgeUpdateEnd:L,markerEnd:j,markerStart:U,rfId:G,ariaLabel:W,isFocusable:X,isUpdatable:Y,pathOptions:B,interactionWidth:H})=>{const Q=k.useRef(null),[J,ne]=k.useState(!1),[te,xe]=k.useState(!1),ve=jn(),ce=k.useMemo(()=>`url(#${r2(U,G)})`,[U,G]),Ne=k.useMemo(()=>`url(#${r2(j,G)})`,[j,G]);if(E)return null;const se=Gt=>{const{edges:wt,addSelectedEdges:Sr}=ve.getState();if(P&&(ve.setState({nodesSelectionActive:!1}),Sr([n])),s){const Lr=wt.find(ni=>ni.id===n);s(Gt,Lr)}},pt=Kc(n,ve.getState,a),yn=Kc(n,ve.getState,M),Rt=Kc(n,ve.getState,C),ut=Kc(n,ve.getState,O),Je=Kc(n,ve.getState,I),Ut=(Gt,wt)=>{if(Gt.button!==0)return;const{edges:Sr,isValidConnection:Lr}=ve.getState(),ni=wt?v:y,lo=(wt?$:A)||null,bn=wt?"target":"source",ri=Lr||$re,da=wt,Ai=Sr.find(et=>et.id===n);xe(!0),D==null||D(Gt,Ai,bn);const fa=et=>{xe(!1),L==null||L(et,Ai,bn)};kM({event:Gt,handleId:lo,nodeId:ni,onConnect:et=>R==null?void 0:R(Ai,et),isTarget:da,getState:ve.getState,setState:ve.setState,isValidConnection:ri,edgeUpdaterType:bn,onEdgeUpdateEnd:fa})},or=Gt=>Ut(Gt,!0),ti=Gt=>Ut(Gt,!1),Dr=()=>ne(!0),On=()=>ne(!1),vn=!P&&!s,zn=Gt=>{var wt;if(gM.includes(Gt.key)&&P){const{unselectNodesAndEdges:Sr,addSelectedEdges:Lr,edges:ni}=ve.getState();Gt.key==="Escape"?((wt=Q.current)==null||wt.blur(),Sr({edges:[ni.find(bn=>bn.id===n)]})):Lr([n])}};return K.jsxs("g",{className:ei(["react-flow__edge",`react-flow__edge-${i}`,r,{selected:l,animated:u,inactive:vn,updating:J}]),onClick:se,onDoubleClick:pt,onContextMenu:yn,onMouseEnter:Rt,onMouseMove:ut,onMouseLeave:Je,onKeyDown:X?zn:void 0,tabIndex:X?0:void 0,role:X?"button":void 0,"data-testid":`rf__edge-${n}`,"aria-label":W===null?void 0:W||`Edge from ${y} to ${v}`,"aria-describedby":X?`${FM}-${G}`:void 0,ref:Q,children:[!te&&K.jsx(e,{id:n,source:y,target:v,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,data:o,style:_,sourceX:g,sourceY:b,targetX:S,targetY:w,sourcePosition:x,targetPosition:T,sourceHandleId:A,targetHandleId:$,markerStart:ce,markerEnd:Ne,pathOptions:B,interactionWidth:H}),Y&&K.jsxs(K.Fragment,{children:[(Y==="source"||Y===!0)&&K.jsx(ZT,{position:x,centerX:g,centerY:b,radius:N,onMouseDown:or,onMouseEnter:Dr,onMouseOut:On,type:"source"}),(Y==="target"||Y===!0)&&K.jsx(ZT,{position:T,centerX:S,centerY:w,radius:N,onMouseDown:ti,onMouseEnter:Dr,onMouseOut:On,type:"target"})]})]})};return t.displayName="EdgeWrapper",k.memo(t)};function Fre(e){const t={default:$l(e.default||Bm),straight:$l(e.bezier||rC),step:$l(e.step||nC),smoothstep:$l(e.step||N0),simplebezier:$l(e.simplebezier||tC)},n={},r=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,o)=>(i[o]=$l(e[o]||Bm),i),n);return{...t,...r}}function JT(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,o=(n==null?void 0:n.width)||t.width,s=(n==null?void 0:n.height)||t.height;switch(e){case pe.Top:return{x:r+o/2,y:i};case pe.Right:return{x:r+o,y:i+s/2};case pe.Bottom:return{x:r+o/2,y:i+s};case pe.Left:return{x:r,y:i+s/2}}}function eE(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const Bre=(e,t,n,r,i,o)=>{const s=JT(n,e,t),a=JT(o,r,i);return{sourceX:s.x,sourceY:s.y,targetX:a.x,targetY:a.y}};function jre({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:o,width:s,height:a,transform:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+o)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=$m({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:s/l[2],height:a/l[2]}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),f=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*f)>0}function tE(e){var r,i,o,s,a;const t=((r=e==null?void 0:e[rn])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)||0,y:((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}function BM(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:BM(n,t):!1}function nE(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function Vre(e,t,n,r){return Array.from(e.values()).filter(i=>(i.selected||i.id===r)&&(!i.parentNode||!BM(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var o,s;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=i.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((s=i.positionAbsolute)==null?void 0:s.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height}})}function zre(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function jM(e,t,n,r,i=[0,0],o){const s=zre(e,e.extent||r);let a=s;if(e.extent==="parent")if(e.parentNode&&e.width&&e.height){const c=n.get(e.parentNode),{x:d,y:f}=Du(c,i).positionAbsolute;a=c&&Wr(d)&&Wr(f)&&Wr(c.width)&&Wr(c.height)?[[d+e.width*i[0],f+e.height*i[1]],[d+c.width-e.width+e.width*i[0],f+c.height-e.height+e.height*i[1]]]:a}else o==null||o("005",Hs.error005()),a=s;else if(e.extent&&e.parentNode){const c=n.get(e.parentNode),{x:d,y:f}=Du(c,i).positionAbsolute;a=[[e.extent[0][0]+d,e.extent[0][1]+f],[e.extent[1][0]+d,e.extent[1][1]+f]]}let l={x:0,y:0};if(e.parentNode){const c=n.get(e.parentNode);l=Du(c,i).positionAbsolute}const u=a?eC(t,a):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function kb({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?r.find(i=>i.id===e):r[0],r]}const rE=(e,t,n,r)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const o=Array.from(i),s=t.getBoundingClientRect(),a={x:s.width*r[0],y:s.height*r[1]};return o.map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(u.left-s.left-a.x)/n,y:(u.top-s.top-a.y)/n,...Jx(l)}})};function Xc(e,t,n){return n===void 0?n:r=>{const i=t().nodeInternals.get(e);n(r,{...i})}}function o2({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:s,nodeInternals:a}=t.getState(),l=a.get(e);t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&s)&&(o({nodes:[l]}),requestAnimationFrame(()=>{var u;return(u=r==null?void 0:r.current)==null?void 0:u.blur()})):i([e])}function Ure(){const e=jn();return k.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:i,snapToGrid:o}=e.getState(),s=n.touches?n.touches[0].clientX:n.clientX,a=n.touches?n.touches[0].clientY:n.clientY,l={x:(s-r[0])/r[2],y:(a-r[1])/r[2]};return{xSnapped:o?i[0]*Math.round(l.x/i[0]):l.x,ySnapped:o?i[1]*Math.round(l.y/i[1]):l.y,...l}},[])}function Ob(e){return(t,n,r)=>e==null?void 0:e(t,r)}function VM({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,selectNodesOnDrag:s}){const a=jn(),[l,u]=k.useState(!1),c=k.useRef([]),d=k.useRef({x:null,y:null}),f=k.useRef(0),h=k.useRef(null),p=k.useRef({x:0,y:0}),m=k.useRef(null),_=k.useRef(!1),y=Ure();return k.useEffect(()=>{if(e!=null&&e.current){const v=di(e.current),g=({x:S,y:w})=>{const{nodeInternals:x,onNodeDrag:T,onSelectionDrag:P,updateNodePositions:E,nodeExtent:A,snapGrid:$,snapToGrid:M,nodeOrigin:C,onError:O}=a.getState();d.current={x:S,y:w};let I=!1;if(c.current=c.current.map(R=>{const D={x:S-R.distance.x,y:w-R.distance.y};M&&(D.x=$[0]*Math.round(D.x/$[0]),D.y=$[1]*Math.round(D.y/$[1]));const L=jM(R,D,x,A,C,O);return I=I||R.position.x!==L.position.x||R.position.y!==L.position.y,R.position=L.position,R.positionAbsolute=L.positionAbsolute,R}),!I)return;E(c.current,!0,!0),u(!0);const N=i?T:Ob(P);if(N&&m.current){const[R,D]=kb({nodeId:i,dragItems:c.current,nodeInternals:x});N(m.current,R,D)}},b=()=>{if(!h.current)return;const[S,w]=dM(p.current,h.current);if(S!==0||w!==0){const{transform:x,panBy:T}=a.getState();d.current.x=(d.current.x??0)-S/x[2],d.current.y=(d.current.y??0)-w/x[2],T({x:S,y:w})&&g(d.current)}f.current=requestAnimationFrame(b)};if(t)v.on(".drag",null);else{const S=lte().on("start",w=>{var I;const{nodeInternals:x,multiSelectionActive:T,domNode:P,nodesDraggable:E,unselectNodesAndEdges:A,onNodeDragStart:$,onSelectionDragStart:M}=a.getState(),C=i?$:Ob(M);!s&&!T&&i&&((I=x.get(i))!=null&&I.selected||A()),i&&o&&s&&o2({id:i,store:a,nodeRef:e});const O=y(w);if(d.current=O,c.current=Vre(x,E,O,i),C&&c.current){const[N,R]=kb({nodeId:i,dragItems:c.current,nodeInternals:x});C(w.sourceEvent,N,R)}h.current=(P==null?void 0:P.getBoundingClientRect())||null,p.current=Ms(w.sourceEvent,h.current)}).on("drag",w=>{const x=y(w),{autoPanOnNodeDrag:T}=a.getState();!_.current&&T&&(_.current=!0,b()),(d.current.x!==x.xSnapped||d.current.y!==x.ySnapped)&&c.current&&(m.current=w.sourceEvent,p.current=Ms(w.sourceEvent,h.current),g(x))}).on("end",w=>{if(u(!1),_.current=!1,cancelAnimationFrame(f.current),c.current){const{updateNodePositions:x,nodeInternals:T,onNodeDragStop:P,onSelectionDragStop:E}=a.getState(),A=i?P:Ob(E);if(x(c.current,!1,!1),A){const[$,M]=kb({nodeId:i,dragItems:c.current,nodeInternals:T});A(w.sourceEvent,$,M)}}}).filter(w=>{const x=w.target;return!w.button&&(!n||!nE(x,`.${n}`,e))&&(!r||nE(x,r,e))});return v.call(S),()=>{v.on(".drag",null)}}}},[e,t,n,r,o,a,i,s,y]),l}function zM(){const e=jn();return k.useCallback(n=>{const{nodeInternals:r,nodeExtent:i,updateNodePositions:o,getNodes:s,snapToGrid:a,snapGrid:l,onError:u,nodesDraggable:c}=e.getState(),d=s().filter(v=>v.selected&&(v.draggable||c&&typeof v.draggable>"u")),f=a?l[0]:5,h=a?l[1]:5,p=n.isShiftPressed?4:1,m=n.x*f*p,_=n.y*h*p,y=d.map(v=>{if(v.positionAbsolute){const g={x:v.positionAbsolute.x+m,y:v.positionAbsolute.y+_};a&&(g.x=l[0]*Math.round(g.x/l[0]),g.y=l[1]*Math.round(g.y/l[1]));const{positionAbsolute:b,position:S}=jM(v,g,r,i,void 0,u);v.position=S,v.positionAbsolute=b}return v});o(y,!0,!1)},[])}const Lu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Yc=e=>{const t=({id:n,type:r,data:i,xPos:o,yPos:s,xPosOrigin:a,yPosOrigin:l,selected:u,onClick:c,onMouseEnter:d,onMouseMove:f,onMouseLeave:h,onContextMenu:p,onDoubleClick:m,style:_,className:y,isDraggable:v,isSelectable:g,isConnectable:b,isFocusable:S,selectNodesOnDrag:w,sourcePosition:x,targetPosition:T,hidden:P,resizeObserver:E,dragHandle:A,zIndex:$,isParent:M,noDragClassName:C,noPanClassName:O,initialized:I,disableKeyboardA11y:N,ariaLabel:R,rfId:D})=>{const L=jn(),j=k.useRef(null),U=k.useRef(x),G=k.useRef(T),W=k.useRef(r),X=g||v||c||d||f||h,Y=zM(),B=Xc(n,L.getState,d),H=Xc(n,L.getState,f),Q=Xc(n,L.getState,h),J=Xc(n,L.getState,p),ne=Xc(n,L.getState,m),te=ce=>{if(g&&(!w||!v)&&o2({id:n,store:L,nodeRef:j}),c){const Ne=L.getState().nodeInternals.get(n);c(ce,{...Ne})}},xe=ce=>{if(!t2(ce))if(gM.includes(ce.key)&&g){const Ne=ce.key==="Escape";o2({id:n,store:L,unselect:Ne,nodeRef:j})}else!N&&v&&u&&Object.prototype.hasOwnProperty.call(Lu,ce.key)&&(L.setState({ariaLiveMessage:`Moved selected node ${ce.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~s}`}),Y({x:Lu[ce.key].x,y:Lu[ce.key].y,isShiftPressed:ce.shiftKey}))};k.useEffect(()=>{if(j.current&&!P){const ce=j.current;return E==null||E.observe(ce),()=>E==null?void 0:E.unobserve(ce)}},[P]),k.useEffect(()=>{const ce=W.current!==r,Ne=U.current!==x,se=G.current!==T;j.current&&(ce||Ne||se)&&(ce&&(W.current=r),Ne&&(U.current=x),se&&(G.current=T),L.getState().updateNodeDimensions([{id:n,nodeElement:j.current,forceUpdate:!0}]))},[n,r,x,T]);const ve=VM({nodeRef:j,disabled:P||!v,noDragClassName:C,handleSelector:A,nodeId:n,isSelectable:g,selectNodesOnDrag:w});return P?null:K.jsx("div",{className:ei(["react-flow__node",`react-flow__node-${r}`,{[O]:v},y,{selected:u,selectable:g,parent:M,dragging:ve}]),ref:j,style:{zIndex:$,transform:`translate(${a}px,${l}px)`,pointerEvents:X?"all":"none",visibility:I?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:B,onMouseMove:H,onMouseLeave:Q,onContextMenu:J,onClick:te,onDoubleClick:ne,onKeyDown:S?xe:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":N?void 0:`${$M}-${D}`,"aria-label":R,children:K.jsx(fre,{value:n,children:K.jsx(e,{id:n,data:i,type:r,xPos:o,yPos:s,selected:u,isConnectable:b,sourcePosition:x,targetPosition:T,dragging:ve,dragHandle:A,zIndex:$})})})};return t.displayName="NodeWrapper",k.memo(t)};function Gre(e){const t={input:Yc(e.input||IM),default:Yc(e.default||i2),output:Yc(e.output||DM),group:Yc(e.group||sC)},n={},r=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,o)=>(i[o]=Yc(e[o]||i2),i),n);return{...t,...r}}const Hre=({x:e,y:t,width:n,height:r,origin:i})=>!n||!r?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-r*i[1]},qre=typeof document<"u"?document:null;var Df=(e=null,t={target:qre})=>{const[n,r]=k.useState(!1),i=k.useRef(!1),o=k.useRef(new Set([])),[s,a]=k.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=u.reduce((d,f)=>d.concat(...f),[]);return[u,c]}return[[],[]]},[e]);return k.useEffect(()=>{var l,u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,!i.current&&t2(h))return!1;const p=oE(h.code,a);o.current.add(h[p]),iE(s,o.current,!1)&&(h.preventDefault(),r(!0))},d=h=>{if(!i.current&&t2(h))return!1;const p=oE(h.code,a);iE(s,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(h[p]),i.current=!1},f=()=>{o.current.clear(),r(!1)};return(l=t==null?void 0:t.target)==null||l.addEventListener("keydown",c),(u=t==null?void 0:t.target)==null||u.addEventListener("keyup",d),window.addEventListener("blur",f),()=>{var h,p;(h=t==null?void 0:t.target)==null||h.removeEventListener("keydown",c),(p=t==null?void 0:t.target)==null||p.removeEventListener("keyup",d),window.removeEventListener("blur",f)}}},[e,r]),n};function iE(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function oE(e,t){return t.includes(e)?"code":"key"}function UM(e,t,n,r){var s,a;if(!e.parentNode)return n;const i=t.get(e.parentNode),o=Du(i,r);return UM(i,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((s=i[rn])==null?void 0:s.z)??0)>(n.z??0)?((a=i[rn])==null?void 0:a.z)??0:n.z??0},r)}function GM(e,t,n){e.forEach(r=>{var i;if(r.parentNode&&!e.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:o,y:s,z:a}=UM(r,e,{...r.position,z:((i=r[rn])==null?void 0:i.z)??0},t);r.positionAbsolute={x:o,y:s},r[rn].z=a,n!=null&&n[r.id]&&(r[rn].isParent=!0)}})}function Rb(e,t,n,r){const i=new Map,o={},s=r?1e3:0;return e.forEach(a=>{var d;const l=(Wr(a.zIndex)?a.zIndex:0)+(a.selected?s:0),u=t.get(a.id),c={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...a,positionAbsolute:{x:a.position.x,y:a.position.y}};a.parentNode&&(c.parentNode=a.parentNode,o[a.parentNode]=!0),Object.defineProperty(c,rn,{enumerable:!1,value:{handleBounds:(d=u==null?void 0:u[rn])==null?void 0:d.handleBounds,z:l}}),i.set(a.id,c)}),GM(i,n,o),i}function HM(e,t={}){const{getNodes:n,width:r,height:i,minZoom:o,maxZoom:s,d3Zoom:a,d3Selection:l,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:d}=e(),f=t.initial&&!u&&c;if(a&&l&&(f||!t.initial)){const p=n().filter(_=>{var v;const y=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(v=t.nodes)!=null&&v.length?y&&t.nodes.some(g=>g.id===_.id):y}),m=p.every(_=>_.width&&_.height);if(p.length>0&&m){const _=xM(p,d),[y,v,g]=EM(_,r,i,t.minZoom??o,t.maxZoom??s,t.padding??.1),b=Rs.translate(y,v).scale(g);return typeof t.duration=="number"&&t.duration>0?a.transform(Ca(l,t.duration),b):a.transform(l,b),!0}}return!1}function Wre(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[rn]:r[rn],selected:n.selected})}),new Map(t)}function Kre(e,t){return t.map(n=>{const r=e.find(i=>i.id===n.id);return r&&(n.selected=r.selected),n})}function Op({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:i,edges:o,onNodesChange:s,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:u}=n();e!=null&&e.length&&(l&&r({nodeInternals:Wre(e,i)}),s==null||s(e)),t!=null&&t.length&&(u&&r({edges:Kre(t,o)}),a==null||a(t))}const Fl=()=>{},Xre={zoomIn:Fl,zoomOut:Fl,zoomTo:Fl,getZoom:()=>1,setViewport:Fl,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Fl,fitBounds:Fl,project:e=>e,viewportInitialized:!1},Yre=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Qre=()=>{const e=jn(),{d3Zoom:t,d3Selection:n}=jt(Yre,vr);return k.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(Ca(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(Ca(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,o)=>t.scaleTo(Ca(n,o==null?void 0:o.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,o)=>{const[s,a,l]=e.getState().transform,u=Rs.translate(i.x??s,i.y??a).scale(i.zoom??l);t.transform(Ca(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[i,o,s]=e.getState().transform;return{x:i,y:o,zoom:s}},fitView:i=>HM(e.getState,i),setCenter:(i,o,s)=>{const{width:a,height:l,maxZoom:u}=e.getState(),c=typeof(s==null?void 0:s.zoom)<"u"?s.zoom:u,d=a/2-i*c,f=l/2-o*c,h=Rs.translate(d,f).scale(c);t.transform(Ca(n,s==null?void 0:s.duration),h)},fitBounds:(i,o)=>{const{width:s,height:a,minZoom:l,maxZoom:u}=e.getState(),[c,d,f]=EM(i,s,a,l,u,(o==null?void 0:o.padding)??.1),h=Rs.translate(c,d).scale(f);t.transform(Ca(n,o==null?void 0:o.duration),h)},project:i=>{const{transform:o,snapToGrid:s,snapGrid:a}=e.getState();return wM(i,o,s,a)},viewportInitialized:!0}:Xre,[t,n])};function qM(){const e=Qre(),t=jn(),n=k.useCallback(()=>t.getState().getNodes().map(m=>({...m})),[]),r=k.useCallback(m=>t.getState().nodeInternals.get(m),[]),i=k.useCallback(()=>{const{edges:m=[]}=t.getState();return m.map(_=>({..._}))},[]),o=k.useCallback(m=>{const{edges:_=[]}=t.getState();return _.find(y=>y.id===m)},[]),s=k.useCallback(m=>{const{getNodes:_,setNodes:y,hasDefaultNodes:v,onNodesChange:g}=t.getState(),b=_(),S=typeof m=="function"?m(b):m;if(v)y(S);else if(g){const w=S.length===0?b.map(x=>({type:"remove",id:x.id})):S.map(x=>({item:x,type:"reset"}));g(w)}},[]),a=k.useCallback(m=>{const{edges:_=[],setEdges:y,hasDefaultEdges:v,onEdgesChange:g}=t.getState(),b=typeof m=="function"?m(_):m;if(v)y(b);else if(g){const S=b.length===0?_.map(w=>({type:"remove",id:w.id})):b.map(w=>({item:w,type:"reset"}));g(S)}},[]),l=k.useCallback(m=>{const _=Array.isArray(m)?m:[m],{getNodes:y,setNodes:v,hasDefaultNodes:g,onNodesChange:b}=t.getState();if(g){const w=[...y(),..._];v(w)}else if(b){const S=_.map(w=>({item:w,type:"add"}));b(S)}},[]),u=k.useCallback(m=>{const _=Array.isArray(m)?m:[m],{edges:y=[],setEdges:v,hasDefaultEdges:g,onEdgesChange:b}=t.getState();if(g)v([...y,..._]);else if(b){const S=_.map(w=>({item:w,type:"add"}));b(S)}},[]),c=k.useCallback(()=>{const{getNodes:m,edges:_=[],transform:y}=t.getState(),[v,g,b]=y;return{nodes:m().map(S=>({...S})),edges:_.map(S=>({...S})),viewport:{x:v,y:g,zoom:b}}},[]),d=k.useCallback(({nodes:m,edges:_})=>{const{nodeInternals:y,getNodes:v,edges:g,hasDefaultNodes:b,hasDefaultEdges:S,onNodesDelete:w,onEdgesDelete:x,onNodesChange:T,onEdgesChange:P}=t.getState(),E=(m||[]).map(O=>O.id),A=(_||[]).map(O=>O.id),$=v().reduce((O,I)=>{const N=!E.includes(I.id)&&I.parentNode&&O.find(D=>D.id===I.parentNode);return(typeof I.deletable=="boolean"?I.deletable:!0)&&(E.includes(I.id)||N)&&O.push(I),O},[]),M=g.filter(O=>typeof O.deletable=="boolean"?O.deletable:!0),C=M.filter(O=>A.includes(O.id));if($||C){const O=TM($,M),I=[...C,...O],N=I.reduce((R,D)=>(R.includes(D.id)||R.push(D.id),R),[]);if((S||b)&&(S&&t.setState({edges:g.filter(R=>!N.includes(R.id))}),b&&($.forEach(R=>{y.delete(R.id)}),t.setState({nodeInternals:new Map(y)}))),N.length>0&&(x==null||x(I),P&&P(N.map(R=>({id:R,type:"remove"})))),$.length>0&&(w==null||w($),T)){const R=$.map(D=>({id:D.id,type:"remove"}));T(R)}}},[]),f=k.useCallback(m=>{const _=ore(m),y=_?null:t.getState().nodeInternals.get(m.id);return[_?m:UT(y),y,_]},[]),h=k.useCallback((m,_=!0,y)=>{const[v,g,b]=f(m);return v?(y||t.getState().getNodes()).filter(S=>{if(!b&&(S.id===g.id||!S.positionAbsolute))return!1;const w=UT(S),x=e2(w,v);return _&&x>0||x>=m.width*m.height}):[]},[]),p=k.useCallback((m,_,y=!0)=>{const[v]=f(m);if(!v)return!1;const g=e2(v,_);return y&&g>0||g>=m.width*m.height},[]);return k.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:o,setNodes:s,setEdges:a,addNodes:l,addEdges:u,toObject:c,deleteElements:d,getIntersectingNodes:h,isNodeIntersecting:p}),[e,n,r,i,o,s,a,l,u,c,d,h,p])}var Zre=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=jn(),{deleteElements:r}=qM(),i=Df(e),o=Df(t);k.useEffect(()=>{if(i){const{edges:s,getNodes:a}=n.getState(),l=a().filter(c=>c.selected),u=s.filter(c=>c.selected);r({nodes:l,edges:u}),n.setState({nodesSelectionActive:!1})}},[i]),k.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function Jre(e){const t=jn();k.useEffect(()=>{let n;const r=()=>{var o,s;if(!e.current)return;const i=Jx(e.current);(i.height===0||i.width===0)&&((s=(o=t.getState()).onError)==null||s.call(o,"004",Hs.error004())),t.setState({width:i.width||500,height:i.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const aC={position:"absolute",width:"100%",height:"100%",top:0,left:0},eie=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Mb=e=>({x:e.x,y:e.y,zoom:e.k}),Bl=(e,t)=>e.target.closest(`.${t}`),sE=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),tie=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),nie=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:o=!0,panOnScroll:s=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=Nu.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:d=!0,defaultViewport:f,translateExtent:h,minZoom:p,maxZoom:m,zoomActivationKeyCode:_,preventScrolling:y=!0,children:v,noWheelClassName:g,noPanClassName:b})=>{const S=k.useRef(),w=jn(),x=k.useRef(!1),T=k.useRef(!1),P=k.useRef(null),E=k.useRef({x:0,y:0,zoom:0}),{d3Zoom:A,d3Selection:$,d3ZoomHandler:M,userSelectionActive:C}=jt(tie,vr),O=Df(_),I=k.useRef(0);return Jre(P),k.useEffect(()=>{if(P.current){const N=P.current.getBoundingClientRect(),R=Zne().scaleExtent([p,m]).translateExtent(h),D=di(P.current).call(R),L=Rs.translate(f.x,f.y).scale(oc(f.zoom,p,m)),j=[[0,0],[N.width,N.height]],U=R.constrain()(L,j,h);R.transform(D,U),w.setState({d3Zoom:R,d3Selection:D,d3ZoomHandler:D.on("wheel.zoom"),transform:[U.x,U.y,U.k],domNode:P.current.closest(".react-flow")})}},[]),k.useEffect(()=>{$&&A&&(s&&!O&&!C?$.on("wheel.zoom",N=>{if(Bl(N,g))return!1;N.preventDefault(),N.stopImmediatePropagation();const R=$.property("__zoom").k||1;if(N.ctrlKey&&o){const U=Li(N),G=-N.deltaY*(N.deltaMode===1?.05:N.deltaMode?1:.002)*10,W=R*Math.pow(2,G);A.scaleTo($,W,U);return}const D=N.deltaMode===1?20:1,L=l===Nu.Vertical?0:N.deltaX*D,j=l===Nu.Horizontal?0:N.deltaY*D;A.translateBy($,-(L/R)*a,-(j/R)*a)},{passive:!1}):typeof M<"u"&&$.on("wheel.zoom",function(N,R){if(!y||Bl(N,g))return null;N.preventDefault(),M.call(this,N,R)},{passive:!1}))},[C,s,l,$,A,M,O,o,y,g]),k.useEffect(()=>{A&&A.on("start",N=>{var D;if(!N.sourceEvent)return null;I.current=N.sourceEvent.button;const{onViewportChangeStart:R}=w.getState();if(x.current=!0,((D=N.sourceEvent)==null?void 0:D.type)==="mousedown"&&w.setState({paneDragging:!0}),t||R){const L=Mb(N.transform);E.current=L,R==null||R(L),t==null||t(N.sourceEvent,L)}})},[A,t]),k.useEffect(()=>{A&&(C&&!x.current?A.on("zoom",null):C||A.on("zoom",N=>{const{onViewportChange:R}=w.getState();if(w.setState({transform:[N.transform.x,N.transform.y,N.transform.k]}),T.current=!!(r&&sE(d,I.current??0)),e||R){const D=Mb(N.transform);R==null||R(D),e==null||e(N.sourceEvent,D)}}))},[C,A,e,d,r]),k.useEffect(()=>{A&&A.on("end",N=>{if(!N.sourceEvent)return null;const{onViewportChangeEnd:R}=w.getState();if(x.current=!1,w.setState({paneDragging:!1}),r&&sE(d,I.current??0)&&!T.current&&r(N.sourceEvent),T.current=!1,(n||R)&&eie(E.current,N.transform)){const D=Mb(N.transform);E.current=D,clearTimeout(S.current),S.current=setTimeout(()=>{R==null||R(D),n==null||n(N.sourceEvent,D)},s?150:0)}})},[A,s,d,n,r]),k.useEffect(()=>{A&&A.filter(N=>{const R=O||i,D=o&&N.ctrlKey;if(N.button===1&&N.type==="mousedown"&&(Bl(N,"react-flow__node")||Bl(N,"react-flow__edge")))return!0;if(!d&&!R&&!s&&!u&&!o||C||!u&&N.type==="dblclick"||Bl(N,g)&&N.type==="wheel"||Bl(N,b)&&N.type!=="wheel"||!o&&N.ctrlKey&&N.type==="wheel"||!R&&!s&&!D&&N.type==="wheel"||!d&&(N.type==="mousedown"||N.type==="touchstart")||Array.isArray(d)&&!d.includes(N.button)&&(N.type==="mousedown"||N.type==="touchstart"))return!1;const L=Array.isArray(d)&&d.includes(N.button)||!N.button||N.button<=1;return(!N.ctrlKey||N.type==="wheel")&&L})},[C,A,i,o,s,u,d,c,O]),K.jsx("div",{className:"react-flow__renderer",ref:P,style:aC,children:v})},rie=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function iie(){const{userSelectionActive:e,userSelectionRect:t}=jt(rie,vr);return e&&t?K.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function aE(e,t){const n=e.find(r=>r.id===t.parentNode);if(n){const r=t.position.x+t.width-n.width,i=t.position.y+t.height-n.height;if(r>0||i>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,r>0&&(n.style.width+=r),i>0&&(n.style.height+=i),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function WM(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,i)=>{const o=e.filter(a=>a.id===i.id);if(o.length===0)return r.push(i),r;const s={...i};for(const a of o)if(a)switch(a.type){case"select":{s.selected=a.selected;break}case"position":{typeof a.position<"u"&&(s.position=a.position),typeof a.positionAbsolute<"u"&&(s.positionAbsolute=a.positionAbsolute),typeof a.dragging<"u"&&(s.dragging=a.dragging),s.expandParent&&aE(r,s);break}case"dimensions":{typeof a.dimensions<"u"&&(s.width=a.dimensions.width,s.height=a.dimensions.height),typeof a.updateStyle<"u"&&(s.style={...s.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(s.resizing=a.resizing),s.expandParent&&aE(r,s);break}case"remove":return r}return r.push(s),r},n)}function KM(e,t){return WM(e,t)}function oie(e,t){return WM(e,t)}const cs=(e,t)=>({id:e,type:"select",selected:t});function hu(e,t){return e.reduce((n,r)=>{const i=t.includes(r.id);return!r.selected&&i?(r.selected=!0,n.push(cs(r.id,!0))):r.selected&&!i&&(r.selected=!1,n.push(cs(r.id,!1))),n},[])}const Ib=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},sie=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),XM=k.memo(({isSelecting:e,selectionMode:t=Nf.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:o,onPaneContextMenu:s,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:u,onPaneMouseLeave:c,children:d})=>{const f=k.useRef(null),h=jn(),p=k.useRef(0),m=k.useRef(0),_=k.useRef(),{userSelectionActive:y,elementsSelectable:v,dragging:g}=jt(sie,vr),b=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,m.current=0},S=M=>{o==null||o(M),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},w=M=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){M.preventDefault();return}s==null||s(M)},x=a?M=>a(M):void 0,T=M=>{const{resetSelectedElements:C,domNode:O}=h.getState();if(_.current=O==null?void 0:O.getBoundingClientRect(),!v||!e||M.button!==0||M.target!==f.current||!_.current)return;const{x:I,y:N}=Ms(M,_.current);C(),h.setState({userSelectionRect:{width:0,height:0,startX:I,startY:N,x:I,y:N}}),r==null||r(M)},P=M=>{const{userSelectionRect:C,nodeInternals:O,edges:I,transform:N,onNodesChange:R,onEdgesChange:D,nodeOrigin:L,getNodes:j}=h.getState();if(!e||!_.current||!C)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const U=Ms(M,_.current),G=C.startX??0,W=C.startY??0,X={...C,x:U.xJ.id),Q=B.map(J=>J.id);if(p.current!==Q.length){p.current=Q.length;const J=hu(Y,Q);J.length&&(R==null||R(J))}if(m.current!==H.length){m.current=H.length;const J=hu(I,H);J.length&&(D==null||D(J))}h.setState({userSelectionRect:X})},E=M=>{if(M.button!==0)return;const{userSelectionRect:C}=h.getState();!y&&C&&M.target===f.current&&(S==null||S(M)),h.setState({nodesSelectionActive:p.current>0}),b(),i==null||i(M)},A=M=>{y&&(h.setState({nodesSelectionActive:p.current>0}),i==null||i(M)),b()},$=v&&(e||y);return K.jsxs("div",{className:ei(["react-flow__pane",{dragging:g,selection:e}]),onClick:$?void 0:Ib(S,f),onContextMenu:Ib(w,f),onWheel:Ib(x,f),onMouseEnter:$?void 0:l,onMouseDown:$?T:void 0,onMouseMove:$?P:u,onMouseUp:$?E:void 0,onMouseLeave:$?A:c,ref:f,style:aC,children:[d,K.jsx(iie,{})]})});XM.displayName="Pane";const aie=e=>{const t=e.getNodes().filter(n=>n.selected);return{...xM(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function lie({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=jn(),{width:i,height:o,x:s,y:a,transformString:l,userSelectionActive:u}=jt(aie,vr),c=zM(),d=k.useRef(null);if(k.useEffect(()=>{var p;n||(p=d.current)==null||p.focus({preventScroll:!0})},[n]),VM({nodeRef:d}),u||!i||!o)return null;const f=e?p=>{const m=r.getState().getNodes().filter(_=>_.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Lu,p.key)&&c({x:Lu[p.key].x,y:Lu[p.key].y,isShiftPressed:p.shiftKey})};return K.jsx("div",{className:ei(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:K.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:o,top:a,left:s}})})}var uie=k.memo(lie);const cie=e=>e.nodesSelectionActive,YM=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:s,deleteKeyCode:a,onMove:l,onMoveStart:u,onMoveEnd:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:_,panActivationKeyCode:y,zoomActivationKeyCode:v,elementsSelectable:g,zoomOnScroll:b,zoomOnPinch:S,panOnScroll:w,panOnScrollSpeed:x,panOnScrollMode:T,zoomOnDoubleClick:P,panOnDrag:E,defaultViewport:A,translateExtent:$,minZoom:M,maxZoom:C,preventScrolling:O,onSelectionContextMenu:I,noWheelClassName:N,noPanClassName:R,disableKeyboardA11y:D})=>{const L=jt(cie),j=Df(d),G=Df(y)||E,W=j||f&&G!==!0;return Zre({deleteKeyCode:a,multiSelectionKeyCode:_}),K.jsx(nie,{onMove:l,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:o,elementsSelectable:g,zoomOnScroll:b,zoomOnPinch:S,panOnScroll:w,panOnScrollSpeed:x,panOnScrollMode:T,zoomOnDoubleClick:P,panOnDrag:!j&&G,defaultViewport:A,translateExtent:$,minZoom:M,maxZoom:C,zoomActivationKeyCode:v,preventScrolling:O,noWheelClassName:N,noPanClassName:R,children:K.jsxs(XM,{onSelectionStart:p,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:s,panOnDrag:G,isSelecting:!!W,selectionMode:h,children:[e,L&&K.jsx(uie,{onSelectionContextMenu:I,noPanClassName:R,disableKeyboardA11y:D})]})})};YM.displayName="FlowRenderer";var die=k.memo(YM);function fie(e){return jt(k.useCallback(n=>e?CM(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}const hie=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),QM=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:o,onError:s}=jt(hie,vr),a=fie(e.onlyRenderVisibleElements),l=k.useRef(),u=k.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(d=>{const f=d.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));o(f)});return l.current=c,c},[]);return k.useEffect(()=>()=>{var c;(c=l==null?void 0:l.current)==null||c.disconnect()},[]),K.jsx("div",{className:"react-flow__nodes",style:aC,children:a.map(c=>{var S,w;let d=c.type||"default";e.nodeTypes[d]||(s==null||s("003",Hs.error003(d)),d="default");const f=e.nodeTypes[d]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),p=!!(c.selectable||i&&typeof c.selectable>"u"),m=!!(c.connectable||n&&typeof c.connectable>"u"),_=!!(c.focusable||r&&typeof c.focusable>"u"),y=e.nodeExtent?eC(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,v=(y==null?void 0:y.x)??0,g=(y==null?void 0:y.y)??0,b=Hre({x:v,y:g,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return K.jsx(f,{id:c.id,className:c.className,style:c.style,type:d,data:c.data,sourcePosition:c.sourcePosition||pe.Bottom,targetPosition:c.targetPosition||pe.Top,hidden:c.hidden,xPos:v,yPos:g,xPosOrigin:b.x,yPosOrigin:b.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:p,isConnectable:m,isFocusable:_,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((S=c[rn])==null?void 0:S.z)??0,isParent:!!((w=c[rn])!=null&&w.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel},c.id)})})};QM.displayName="NodeRenderer";var pie=k.memo(QM);const gie=[{level:0,isMaxLevel:!0,edges:[]}];function mie(e,t,n=!1){let r=-1;const i=e.reduce((s,a)=>{var c,d;const l=Wr(a.zIndex);let u=l?a.zIndex:0;if(n){const f=t.get(a.target),h=t.get(a.source),p=a.selected||(f==null?void 0:f.selected)||(h==null?void 0:h.selected),m=Math.max(((c=h==null?void 0:h[rn])==null?void 0:c.z)||0,((d=f==null?void 0:f[rn])==null?void 0:d.z)||0,1e3);u=(l?a.zIndex:0)+(p?m:0)}return s[u]?s[u].push(a):s[u]=[a],r=u>r?u:r,s},{}),o=Object.entries(i).map(([s,a])=>{const l=+s;return{edges:a,level:l,isMaxLevel:l===r}});return o.length===0?gie:o}function yie(e,t,n){const r=jt(k.useCallback(i=>e?i.edges.filter(o=>{const s=t.get(o.source),a=t.get(o.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&jre({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:a.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:a.width,targetHeight:a.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return mie(r,t,n)}const vie=({color:e="none",strokeWidth:t=1})=>K.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:"none",points:"-5,-4 0,0 -5,4"}),bie=({color:e="none",strokeWidth:t=1})=>K.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:e,points:"-5,-4 0,0 -5,4 -5,-4"}),lE={[Fm.Arrow]:vie,[Fm.ArrowClosed]:bie};function _ie(e){const t=jn();return k.useMemo(()=>{var i,o;return Object.prototype.hasOwnProperty.call(lE,e)?lE[e]:((o=(i=t.getState()).onError)==null||o.call(i,"009",Hs.error009(e)),null)},[e])}const Sie=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:o="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const l=_ie(t);return l?K.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:a,refX:"0",refY:"0",children:K.jsx(l,{color:n,strokeWidth:s})}):null},wie=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((i,o)=>([o.markerStart,o.markerEnd].forEach(s=>{if(s&&typeof s=="object"){const a=r2(s,t);r.includes(a)||(i.push({id:a,color:s.color||e,...s}),r.push(a))}}),i),[]).sort((i,o)=>i.id.localeCompare(o.id))},ZM=({defaultColor:e,rfId:t})=>{const n=jt(k.useCallback(wie({defaultColor:e,rfId:t}),[e,t]),(r,i)=>!(r.length!==i.length||r.some((o,s)=>o.id!==i[s].id)));return K.jsx("defs",{children:n.map(r=>K.jsx(Sie,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})};ZM.displayName="MarkerDefinitions";var xie=k.memo(ZM);const Cie=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),JM=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:o,onEdgeUpdate:s,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:c,onEdgeClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,children:_})=>{const{edgesFocusable:y,edgesUpdatable:v,elementsSelectable:g,width:b,height:S,connectionMode:w,nodeInternals:x,onError:T}=jt(Cie,vr),P=yie(t,x,n);return b?K.jsxs(K.Fragment,{children:[P.map(({level:E,edges:A,isMaxLevel:$})=>K.jsxs("svg",{style:{zIndex:E},width:b,height:S,className:"react-flow__edges react-flow__container",children:[$&&K.jsx(xie,{defaultColor:e,rfId:r}),K.jsx("g",{children:A.map(M=>{const[C,O,I]=tE(x.get(M.source)),[N,R,D]=tE(x.get(M.target));if(!I||!D)return null;let L=M.type||"default";i[L]||(T==null||T("011",Hs.error011(L)),L="default");const j=i[L]||i.default,U=w===rl.Strict?R.target:(R.target??[]).concat(R.source??[]),G=eE(O.source,M.sourceHandle),W=eE(U,M.targetHandle),X=(G==null?void 0:G.position)||pe.Bottom,Y=(W==null?void 0:W.position)||pe.Top,B=!!(M.focusable||y&&typeof M.focusable>"u"),H=typeof s<"u"&&(M.updatable||v&&typeof M.updatable>"u");if(!G||!W)return T==null||T("008",Hs.error008(G,M)),null;const{sourceX:Q,sourceY:J,targetX:ne,targetY:te}=Bre(C,G,X,N,W,Y);return K.jsx(j,{id:M.id,className:ei([M.className,o]),type:L,data:M.data,selected:!!M.selected,animated:!!M.animated,hidden:!!M.hidden,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,style:M.style,source:M.source,target:M.target,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerEnd:M.markerEnd,markerStart:M.markerStart,sourceX:Q,sourceY:J,targetX:ne,targetY:te,sourcePosition:X,targetPosition:Y,elementsSelectable:g,onEdgeUpdate:s,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:c,onClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,rfId:r,ariaLabel:M.ariaLabel,isFocusable:B,isUpdatable:H,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth},M.id)})})]},E)),_]}):null};JM.displayName="EdgeRenderer";var Tie=k.memo(JM);const Eie=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Pie({children:e}){const t=jt(Eie);return K.jsx("div",{className:"react-flow__viewport react-flow__container",style:{transform:t},children:e})}function Aie(e){const t=qM(),n=k.useRef(!1);k.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const kie={[pe.Left]:pe.Right,[pe.Right]:pe.Left,[pe.Top]:pe.Bottom,[pe.Bottom]:pe.Top},eI=({nodeId:e,handleType:t,style:n,type:r=ms.Bezier,CustomComponent:i,connectionStatus:o})=>{var w,x,T;const{fromNode:s,handleId:a,toX:l,toY:u,connectionMode:c}=jt(k.useCallback(P=>({fromNode:P.nodeInternals.get(e),handleId:P.connectionHandleId,toX:(P.connectionPosition.x-P.transform[0])/P.transform[2],toY:(P.connectionPosition.y-P.transform[1])/P.transform[2],connectionMode:P.connectionMode}),[e]),vr),d=(w=s==null?void 0:s[rn])==null?void 0:w.handleBounds;let f=d==null?void 0:d[t];if(c===rl.Loose&&(f=f||(d==null?void 0:d[t==="source"?"target":"source"])),!s||!f)return null;const h=a?f.find(P=>P.id===a):f[0],p=h?h.x+h.width/2:(s.width??0)/2,m=h?h.y+h.height/2:s.height??0,_=(((x=s.positionAbsolute)==null?void 0:x.x)??0)+p,y=(((T=s.positionAbsolute)==null?void 0:T.y)??0)+m,v=h==null?void 0:h.position,g=v?kie[v]:null;if(!v||!g)return null;if(i)return K.jsx(i,{connectionLineType:r,connectionLineStyle:n,fromNode:s,fromHandle:h,fromX:_,fromY:y,toX:l,toY:u,fromPosition:v,toPosition:g,connectionStatus:o});let b="";const S={sourceX:_,sourceY:y,sourcePosition:v,targetX:l,targetY:u,targetPosition:g};return r===ms.Bezier?[b]=_M(S):r===ms.Step?[b]=n2({...S,borderRadius:0}):r===ms.SmoothStep?[b]=n2(S):r===ms.SimpleBezier?[b]=bM(S):b=`M${_},${y} ${l},${u}`,K.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:n})};eI.displayName="ConnectionLine";const Oie=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function Rie({containerStyle:e,style:t,type:n,component:r}){const{nodeId:i,handleType:o,nodesConnectable:s,width:a,height:l,connectionStatus:u}=jt(Oie,vr);return!(i&&o&&a&&s)?null:K.jsx("svg",{style:e,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container",children:K.jsx("g",{className:ei(["react-flow__connection",u]),children:K.jsx(eI,{nodeId:i,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})})})}const tI=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:o,onNodeClick:s,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,onSelectionContextMenu:p,onSelectionStart:m,onSelectionEnd:_,connectionLineType:y,connectionLineStyle:v,connectionLineComponent:g,connectionLineContainerStyle:b,selectionKeyCode:S,selectionOnDrag:w,selectionMode:x,multiSelectionKeyCode:T,panActivationKeyCode:P,zoomActivationKeyCode:E,deleteKeyCode:A,onlyRenderVisibleElements:$,elementsSelectable:M,selectNodesOnDrag:C,defaultViewport:O,translateExtent:I,minZoom:N,maxZoom:R,preventScrolling:D,defaultMarkerColor:L,zoomOnScroll:j,zoomOnPinch:U,panOnScroll:G,panOnScrollSpeed:W,panOnScrollMode:X,zoomOnDoubleClick:Y,panOnDrag:B,onPaneClick:H,onPaneMouseEnter:Q,onPaneMouseMove:J,onPaneMouseLeave:ne,onPaneScroll:te,onPaneContextMenu:xe,onEdgeUpdate:ve,onEdgeContextMenu:ce,onEdgeMouseEnter:Ne,onEdgeMouseMove:se,onEdgeMouseLeave:pt,edgeUpdaterRadius:yn,onEdgeUpdateStart:Rt,onEdgeUpdateEnd:ut,noDragClassName:Je,noWheelClassName:Ut,noPanClassName:or,elevateEdgesOnSelect:ti,disableKeyboardA11y:Dr,nodeOrigin:On,nodeExtent:vn,rfId:zn})=>(Aie(o),K.jsx(die,{onPaneClick:H,onPaneMouseEnter:Q,onPaneMouseMove:J,onPaneMouseLeave:ne,onPaneContextMenu:xe,onPaneScroll:te,deleteKeyCode:A,selectionKeyCode:S,selectionOnDrag:w,selectionMode:x,onSelectionStart:m,onSelectionEnd:_,multiSelectionKeyCode:T,panActivationKeyCode:P,zoomActivationKeyCode:E,elementsSelectable:M,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:j,zoomOnPinch:U,zoomOnDoubleClick:Y,panOnScroll:G,panOnScrollSpeed:W,panOnScrollMode:X,panOnDrag:B,defaultViewport:O,translateExtent:I,minZoom:N,maxZoom:R,onSelectionContextMenu:p,preventScrolling:D,noDragClassName:Je,noWheelClassName:Ut,noPanClassName:or,disableKeyboardA11y:Dr,children:K.jsxs(Pie,{children:[K.jsx(Tie,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:u,onEdgeUpdate:ve,onlyRenderVisibleElements:$,onEdgeContextMenu:ce,onEdgeMouseEnter:Ne,onEdgeMouseMove:se,onEdgeMouseLeave:pt,onEdgeUpdateStart:Rt,onEdgeUpdateEnd:ut,edgeUpdaterRadius:yn,defaultMarkerColor:L,noPanClassName:or,elevateEdgesOnSelect:!!ti,disableKeyboardA11y:Dr,rfId:zn,children:K.jsx(Rie,{style:v,type:y,component:g,containerStyle:b})}),K.jsx("div",{className:"react-flow__edgelabel-renderer"}),K.jsx(pie,{nodeTypes:e,onNodeClick:s,onNodeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,selectNodesOnDrag:C,onlyRenderVisibleElements:$,noPanClassName:or,noDragClassName:Je,disableKeyboardA11y:Dr,nodeOrigin:On,nodeExtent:vn,rfId:zn})]})}));tI.displayName="GraphView";var Mie=k.memo(tI);const s2=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ns={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:s2,nodeExtent:s2,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:rl.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:sre,isValidConnection:void 0},Iie=()=>vJ((e,t)=>({...ns,setNodes:n=>{const{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:o}=t();e({nodeInternals:Rb(n,r,i,o)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(i=>({...r,...i}))})},setDefaultNodesAndEdges:(n,r)=>{const i=typeof n<"u",o=typeof r<"u",s=i?Rb(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:s,edges:o?r:[],hasDefaultNodes:i,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:i,fitViewOnInit:o,fitViewOnInitDone:s,fitViewOnInitOptions:a,domNode:l,nodeOrigin:u}=t(),c=l==null?void 0:l.querySelector(".react-flow__viewport");if(!c)return;const d=window.getComputedStyle(c),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=n.reduce((m,_)=>{const y=i.get(_.id);if(y){const v=Jx(_.nodeElement);!!(v.width&&v.height&&(y.width!==v.width||y.height!==v.height||_.forceUpdate))&&(i.set(y.id,{...y,[rn]:{...y[rn],handleBounds:{source:rE(".source",_.nodeElement,f,u),target:rE(".target",_.nodeElement,f,u)}},...v}),m.push({id:y.id,type:"dimensions",dimensions:v}))}return m},[]);GM(i,u);const p=s||o&&!s&&HM(t,{initial:!0,...a});e({nodeInternals:new Map(i),fitViewOnInitDone:p}),(h==null?void 0:h.length)>0&&(r==null||r(h))},updateNodePositions:(n,r=!0,i=!1)=>{const{triggerNodeChanges:o}=t(),s=n.map(a=>{const l={id:a.id,type:"position",dragging:i};return r&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});o(s)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:i,hasDefaultNodes:o,nodeOrigin:s,getNodes:a,elevateNodesOnSelect:l}=t();if(n!=null&&n.length){if(o){const u=KM(n,a()),c=Rb(u,i,s,l);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let s,a=null;r?s=n.map(l=>cs(l,!0)):(s=hu(o(),n),a=hu(i,[])),Op({changedNodes:s,changedEdges:a,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let s,a=null;r?s=n.map(l=>cs(l,!0)):(s=hu(i,n),a=hu(o(),[])),Op({changedNodes:a,changedEdges:s,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:i,getNodes:o}=t(),s=n||o(),a=r||i,l=s.map(c=>(c.selected=!1,cs(c.id,!1))),u=a.map(c=>cs(c.id,!1));Op({changedNodes:l,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:i}=t();r==null||r.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:i}=t();r==null||r.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),o=r().filter(a=>a.selected).map(a=>cs(a.id,!1)),s=n.filter(a=>a.selected).map(a=>cs(a.id,!1));Op({changedNodes:o,changedEdges:s,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(i=>{i.positionAbsolute=eC(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:i,height:o,d3Zoom:s,d3Selection:a,translateExtent:l}=t();if(!s||!a||!n.x&&!n.y)return!1;const u=Rs.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[i,o]],d=s==null?void 0:s.constrain()(u,c,l);return s.transform(a,d),r[0]!==d.x||r[1]!==d.y||r[2]!==d.k},cancelConnection:()=>e({connectionNodeId:ns.connectionNodeId,connectionHandleId:ns.connectionHandleId,connectionHandleType:ns.connectionHandleType,connectionStatus:ns.connectionStatus,connectionStartHandle:ns.connectionStartHandle,connectionEndHandle:ns.connectionEndHandle}),reset:()=>e({...ns})})),nI=({children:e})=>{const t=k.useRef(null);return t.current||(t.current=Iie()),K.jsx(Jne,{value:t.current,children:e})};nI.displayName="ReactFlowProvider";const rI=({children:e})=>k.useContext(I0)?K.jsx(K.Fragment,{children:e}):K.jsx(nI,{children:e});rI.displayName="ReactFlowWrapper";function uE(e,t){return k.useRef(null),k.useMemo(()=>t(e),[e])}const Nie={input:IM,default:i2,output:DM,group:sC},Die={default:Bm,straight:rC,step:nC,smoothstep:N0,simplebezier:tC},Lie=[0,0],$ie=[15,15],Fie={x:0,y:0,zoom:1},Bie={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},jie=k.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o=Nie,edgeTypes:s=Die,onNodeClick:a,onEdgeClick:l,onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:y,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:b,onNodeContextMenu:S,onNodeDoubleClick:w,onNodeDragStart:x,onNodeDrag:T,onNodeDragStop:P,onNodesDelete:E,onEdgesDelete:A,onSelectionChange:$,onSelectionDragStart:M,onSelectionDrag:C,onSelectionDragStop:O,onSelectionContextMenu:I,onSelectionStart:N,onSelectionEnd:R,connectionMode:D=rl.Strict,connectionLineType:L=ms.Bezier,connectionLineStyle:j,connectionLineComponent:U,connectionLineContainerStyle:G,deleteKeyCode:W="Backspace",selectionKeyCode:X="Shift",selectionOnDrag:Y=!1,selectionMode:B=Nf.Full,panActivationKeyCode:H="Space",multiSelectionKeyCode:Q="Meta",zoomActivationKeyCode:J="Meta",snapToGrid:ne=!1,snapGrid:te=$ie,onlyRenderVisibleElements:xe=!1,selectNodesOnDrag:ve=!0,nodesDraggable:ce,nodesConnectable:Ne,nodesFocusable:se,nodeOrigin:pt=Lie,edgesFocusable:yn,edgesUpdatable:Rt,elementsSelectable:ut,defaultViewport:Je=Fie,minZoom:Ut=.5,maxZoom:or=2,translateExtent:ti=s2,preventScrolling:Dr=!0,nodeExtent:On,defaultMarkerColor:vn="#b1b1b7",zoomOnScroll:zn=!0,zoomOnPinch:Gt=!0,panOnScroll:wt=!1,panOnScrollSpeed:Sr=.5,panOnScrollMode:Lr=Nu.Free,zoomOnDoubleClick:ni=!0,panOnDrag:lo=!0,onPaneClick:bn,onPaneMouseEnter:ri,onPaneMouseMove:da,onPaneMouseLeave:Ai,onPaneScroll:fa,onPaneContextMenu:xt,children:et,onEdgeUpdate:_n,onEdgeContextMenu:an,onEdgeDoubleClick:Rn,onEdgeMouseEnter:Un,onEdgeMouseMove:sr,onEdgeMouseLeave:ki,onEdgeUpdateStart:Gn,onEdgeUpdateEnd:Sn,edgeUpdaterRadius:uo=10,onNodesChange:Qo,onEdgesChange:Zo,noDragClassName:kl="nodrag",noWheelClassName:co="nowheel",noPanClassName:Hn="nopan",fitView:ha=!1,fitViewOptions:g1,connectOnClick:m1=!0,attributionPosition:y1,proOptions:v1,defaultEdgeOptions:Jo,elevateNodesOnSelect:b1=!0,elevateEdgesOnSelect:_1=!1,disableKeyboardA11y:qh=!1,autoPanOnConnect:S1=!0,autoPanOnNodeDrag:w1=!0,connectionRadius:x1=20,isValidConnection:Oc,onError:C1,style:Ol,id:Rl,...T1},Ml)=>{const Wh=uE(o,Gre),E1=uE(s,Fre),Rc=Rl||"1";return K.jsx("div",{...T1,style:{...Ol,...Bie},ref:Ml,className:ei(["react-flow",i]),"data-testid":"rf__wrapper",id:Rl,children:K.jsxs(rI,{children:[K.jsx(Mie,{onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:b,onNodeContextMenu:S,onNodeDoubleClick:w,nodeTypes:Wh,edgeTypes:E1,connectionLineType:L,connectionLineStyle:j,connectionLineComponent:U,connectionLineContainerStyle:G,selectionKeyCode:X,selectionOnDrag:Y,selectionMode:B,deleteKeyCode:W,multiSelectionKeyCode:Q,panActivationKeyCode:H,zoomActivationKeyCode:J,onlyRenderVisibleElements:xe,selectNodesOnDrag:ve,defaultViewport:Je,translateExtent:ti,minZoom:Ut,maxZoom:or,preventScrolling:Dr,zoomOnScroll:zn,zoomOnPinch:Gt,zoomOnDoubleClick:ni,panOnScroll:wt,panOnScrollSpeed:Sr,panOnScrollMode:Lr,panOnDrag:lo,onPaneClick:bn,onPaneMouseEnter:ri,onPaneMouseMove:da,onPaneMouseLeave:Ai,onPaneScroll:fa,onPaneContextMenu:xt,onSelectionContextMenu:I,onSelectionStart:N,onSelectionEnd:R,onEdgeUpdate:_n,onEdgeContextMenu:an,onEdgeDoubleClick:Rn,onEdgeMouseEnter:Un,onEdgeMouseMove:sr,onEdgeMouseLeave:ki,onEdgeUpdateStart:Gn,onEdgeUpdateEnd:Sn,edgeUpdaterRadius:uo,defaultMarkerColor:vn,noDragClassName:kl,noWheelClassName:co,noPanClassName:Hn,elevateEdgesOnSelect:_1,rfId:Rc,disableKeyboardA11y:qh,nodeOrigin:pt,nodeExtent:On}),K.jsx(kre,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:y,nodesDraggable:ce,nodesConnectable:Ne,nodesFocusable:se,edgesFocusable:yn,edgesUpdatable:Rt,elementsSelectable:ut,elevateNodesOnSelect:b1,minZoom:Ut,maxZoom:or,nodeExtent:On,onNodesChange:Qo,onEdgesChange:Zo,snapToGrid:ne,snapGrid:te,connectionMode:D,translateExtent:ti,connectOnClick:m1,defaultEdgeOptions:Jo,fitView:ha,fitViewOptions:g1,onNodesDelete:E,onEdgesDelete:A,onNodeDragStart:x,onNodeDrag:T,onNodeDragStop:P,onSelectionDrag:C,onSelectionDragStart:M,onSelectionDragStop:O,noPanClassName:Hn,nodeOrigin:pt,rfId:Rc,autoPanOnConnect:S1,autoPanOnNodeDrag:w1,onError:C1,connectionRadius:x1,isValidConnection:Oc}),K.jsx(Pre,{onSelectionChange:$}),et,K.jsx(nre,{proOptions:v1,position:y1}),K.jsx(Nre,{rfId:Rc,disableKeyboardA11y:qh})]})})});jie.displayName="ReactFlow";var iI={},D0={},L0={};Object.defineProperty(L0,"__esModule",{value:!0});L0.createLogMethods=void 0;var Vie=function(){return{debug:console.debug.bind(console),error:console.error.bind(console),fatal:console.error.bind(console),info:console.info.bind(console),trace:console.debug.bind(console),warn:console.warn.bind(console)}};L0.createLogMethods=Vie;var lC={},$0={};Object.defineProperty($0,"__esModule",{value:!0});$0.boolean=void 0;const zie=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return e.valueOf()===1;case"[object Boolean]":return e.valueOf();default:return!1}};$0.boolean=zie;var F0={};Object.defineProperty(F0,"__esModule",{value:!0});F0.isBooleanable=void 0;const Uie=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};F0.isBooleanable=Uie;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isBooleanable=e.boolean=void 0;const t=$0;Object.defineProperty(e,"boolean",{enumerable:!0,get:function(){return t.boolean}});const n=F0;Object.defineProperty(e,"isBooleanable",{enumerable:!0,get:function(){return n.isBooleanable}})})(lC);var cE=Object.prototype.toString,oI=function(t){var n=cE.call(t),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&cE.call(t.callee)==="[object Function]"),r},Nb,dE;function Gie(){if(dE)return Nb;dE=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=oI,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),s=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(f){var h=f.constructor;return h&&h.prototype===f},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!u["$"+f]&&t.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{l(window[f])}catch{return!0}}catch{return!0}return!1}(),d=function(f){if(typeof window>"u"||!c)return l(f);try{return l(f)}catch{return!1}};e=function(h){var p=h!==null&&typeof h=="object",m=n.call(h)==="[object Function]",_=r(h),y=p&&n.call(h)==="[object String]",v=[];if(!p&&!m&&!_)throw new TypeError("Object.keys called on a non-object");var g=s&&m;if(y&&h.length>0&&!t.call(h,0))for(var b=0;b0)for(var S=0;S"u"||!un?Oe:un(Uint8Array),Ga={"%AggregateError%":typeof AggregateError>"u"?Oe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Oe:ArrayBuffer,"%ArrayIteratorPrototype%":jl&&un?un([][Symbol.iterator]()):Oe,"%AsyncFromSyncIteratorPrototype%":Oe,"%AsyncFunction%":Zl,"%AsyncGenerator%":Zl,"%AsyncGeneratorFunction%":Zl,"%AsyncIteratorPrototype%":Zl,"%Atomics%":typeof Atomics>"u"?Oe:Atomics,"%BigInt%":typeof BigInt>"u"?Oe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Oe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Oe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Oe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Oe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Oe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Oe:FinalizationRegistry,"%Function%":aI,"%GeneratorFunction%":Zl,"%Int8Array%":typeof Int8Array>"u"?Oe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Oe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Oe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":jl&&un?un(un([][Symbol.iterator]())):Oe,"%JSON%":typeof JSON=="object"?JSON:Oe,"%Map%":typeof Map>"u"?Oe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!jl||!un?Oe:un(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Oe:Promise,"%Proxy%":typeof Proxy>"u"?Oe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Oe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Oe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!jl||!un?Oe:un(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Oe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":jl&&un?un(""[Symbol.iterator]()):Oe,"%Symbol%":jl?Symbol:Oe,"%SyntaxError%":sc,"%ThrowTypeError%":soe,"%TypedArray%":loe,"%TypeError%":$u,"%Uint8Array%":typeof Uint8Array>"u"?Oe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Oe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Oe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Oe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Oe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Oe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Oe:WeakSet};if(un)try{null.error}catch(e){var uoe=un(un(e));Ga["%Error.prototype%"]=uoe}var coe=function e(t){var n;if(t==="%AsyncFunction%")n=Lb("async function () {}");else if(t==="%GeneratorFunction%")n=Lb("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=Lb("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&un&&(n=un(i.prototype))}return Ga[t]=n,n},mE={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},wh=sI,Vm=ooe,doe=wh.call(Function.call,Array.prototype.concat),foe=wh.call(Function.apply,Array.prototype.splice),yE=wh.call(Function.call,String.prototype.replace),zm=wh.call(Function.call,String.prototype.slice),hoe=wh.call(Function.call,RegExp.prototype.exec),poe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,goe=/\\(\\)?/g,moe=function(t){var n=zm(t,0,1),r=zm(t,-1);if(n==="%"&&r!=="%")throw new sc("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new sc("invalid intrinsic syntax, expected opening `%`");var i=[];return yE(t,poe,function(o,s,a,l){i[i.length]=a?yE(l,goe,"$1"):s||o}),i},yoe=function(t,n){var r=t,i;if(Vm(mE,r)&&(i=mE[r],r="%"+i[0]+"%"),Vm(Ga,r)){var o=Ga[r];if(o===Zl&&(o=coe(r)),typeof o>"u"&&!n)throw new $u("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new sc("intrinsic "+t+" does not exist!")},voe=function(t,n){if(typeof t!="string"||t.length===0)throw new $u("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new $u('"allowMissing" argument must be a boolean');if(hoe(/^%?[^%]*%?$/,t)===null)throw new sc("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=moe(t),i=r.length>0?r[0]:"",o=yoe("%"+i+"%",n),s=o.name,a=o.value,l=!1,u=o.alias;u&&(i=u[0],foe(r,doe([0,1],u)));for(var c=1,d=!0;c=r.length){var m=Ua(a,f);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[f]}else d=Vm(a,f),a=a[f];d&&!l&&(Ga[s]=a)}}return a},boe=voe,a2=boe("%Object.defineProperty%",!0),l2=function(){if(a2)try{return a2({},"a",{value:1}),!0}catch{return!1}return!1};l2.hasArrayLengthDefineBug=function(){if(!l2())return null;try{return a2([],"length",{value:1}).length!==1}catch{return!0}};var _oe=l2,Soe=Wie,woe=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",xoe=Object.prototype.toString,Coe=Array.prototype.concat,lI=Object.defineProperty,Toe=function(e){return typeof e=="function"&&xoe.call(e)==="[object Function]"},Eoe=_oe(),uI=lI&&Eoe,Poe=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!Toe(r)||!r())return}uI?lI(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n},cI=function(e,t){var n=arguments.length>2?arguments[2]:{},r=Soe(t);woe&&(r=Coe.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i":return t>e;case":<":return t=":return t>=e;case":<=":return t<=e;default:throw new Error("Unimplemented comparison operator: ".concat(n))}};z0.testComparisonRange=Koe;var U0={};Object.defineProperty(U0,"__esModule",{value:!0});U0.testRange=void 0;var Xoe=function(e,t){return typeof e=="number"?!(et.max||e===t.max&&!t.maxInclusive):!1};U0.testRange=Xoe;(function(e){var t=Ee&&Ee.__assign||function(){return t=Object.assign||function(c){for(var d,f=1,h=arguments.length;f0?{path:l.path,query:new RegExp("("+l.keywords.map(function(u){return(0,Zoe.escapeRegexString)(u.trim())}).join("|")+")")}:{path:l.path}})};G0.highlight=ese;var H0={},yI={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(Ee,function(){function t(u,c,d){return this.id=++t.highestId,this.name=u,this.symbols=c,this.postprocess=d,this}t.highestId=0,t.prototype.toString=function(u){var c=typeof u>"u"?this.symbols.map(l).join(" "):this.symbols.slice(0,u).map(l).join(" ")+" ● "+this.symbols.slice(u).map(l).join(" ");return this.name+" → "+c};function n(u,c,d,f){this.rule=u,this.dot=c,this.reference=d,this.data=[],this.wantedBy=f,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var c=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return c.left=this,c.right=u,c.isComplete&&(c.data=c.build(),c.right=void 0),c},n.prototype.build=function(){var u=[],c=this;do u.push(c.right.data),c=c.left;while(c.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,s.fail))};function r(u,c){this.grammar=u,this.index=c,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var c=this.states,d=this.wants,f=this.completed,h=0;h0&&c.push(" ^ "+f+" more lines identical to this"),f=0,c.push(" "+m)),d=m}},s.prototype.getSymbolDisplay=function(u){return a(u)},s.prototype.buildFirstStateStack=function(u,c){if(c.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var d=u.wantedBy[0],f=[u].concat(c),h=this.buildFirstStateStack(d,f);return h===null?null:[u].concat(h)},s.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},s.prototype.restore=function(u){var c=u.index;this.current=c,this.table[c]=u,this.table.splice(c+1),this.lexerState=u.lexerState,this.results=this.finish()},s.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},s.prototype.finish=function(){var u=[],c=this.grammar.start,d=this.table[this.table.length-1];return d.states.forEach(function(f){f.rule.name===c&&f.dot===f.rule.symbols.length&&f.reference===0&&f.data!==s.fail&&u.push(f)}),u.map(function(f){return f.data})};function a(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function l(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:s,Grammar:i,Rule:t}})})(yI);var tse=yI.exports,il={},vI={},ra={};ra.__esModule=void 0;ra.__esModule=!0;var nse=typeof Object.setPrototypeOf=="function",rse=typeof Object.getPrototypeOf=="function",ise=typeof Object.defineProperty=="function",ose=typeof Object.create=="function",sse=typeof Object.prototype.hasOwnProperty=="function",ase=function(t,n){nse?Object.setPrototypeOf(t,n):t.__proto__=n};ra.setPrototypeOf=ase;var lse=function(t){return rse?Object.getPrototypeOf(t):t.__proto__||t.prototype};ra.getPrototypeOf=lse;var vE=!1,use=function e(t,n,r){if(ise&&!vE)try{Object.defineProperty(t,n,r)}catch{vE=!0,e(t,n,r)}else t[n]=r.value};ra.defineProperty=use;var bI=function(t,n){return sse?t.hasOwnProperty(t,n):t[n]===void 0};ra.hasOwnProperty=bI;var cse=function(t,n){if(ose)return Object.create(t,n);var r=function(){};r.prototype=t;var i=new r;if(typeof n>"u")return i;if(typeof n=="null")throw new Error("PropertyDescriptors must not be null.");if(typeof n=="object")for(var o in n)bI(n,o)&&(i[o]=n[o].value);return i};ra.objectCreate=cse;(function(e){e.__esModule=void 0,e.__esModule=!0;var t=ra,n=t.setPrototypeOf,r=t.getPrototypeOf,i=t.defineProperty,o=t.objectCreate,s=new Error().toString()==="[object Error]",a="";function l(u){var c=this.constructor,d=c.name||function(){var _=c.toString().match(/^function\s*([^\s(]+)/);return _===null?a||"Error":_[1]}(),f=d==="Error",h=f?a:d,p=Error.apply(this,arguments);if(n(p,r(this)),!(p instanceof c)||!(p instanceof l)){var p=this;Error.apply(this,arguments),i(p,"message",{configurable:!0,enumerable:!1,value:u,writable:!0})}if(i(p,"name",{configurable:!0,enumerable:!1,value:h,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(p,f?l:c),p.stack===void 0){var m=new Error(u);m.name=p.name,p.stack=m.stack}return s&&i(p,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(typeof this.message>"u"?"":": "+this.message)},writable:!0}),p}a=l.name||"ExtendableError",l.prototype=o(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),e.ExtendableError=l,e.default=e.ExtendableError})(vI);var _I=Ee&&Ee.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(il,"__esModule",{value:!0});il.SyntaxError=il.LiqeError=void 0;var dse=vI,SI=function(e){_I(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(dse.ExtendableError);il.LiqeError=SI;var fse=function(e){_I(t,e);function t(n,r,i,o){var s=e.call(this,n)||this;return s.message=n,s.offset=r,s.line=i,s.column=o,s}return t}(SI);il.SyntaxError=fse;var dC={},Um=Ee&&Ee.__assign||function(){return Um=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$2"]},{name:"comparison_operator$subexpression$1$string$3",symbols:[{literal:":"},{literal:"<"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$3"]},{name:"comparison_operator$subexpression$1$string$4",symbols:[{literal:":"},{literal:">"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$4"]},{name:"comparison_operator$subexpression$1$string$5",symbols:[{literal:":"},{literal:"<"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$5"]},{name:"comparison_operator",symbols:["comparison_operator$subexpression$1"],postprocess:function(e,t){return{location:{start:t,end:t+e[0][0].length},type:"ComparisonOperator",operator:e[0][0]}}},{name:"regex",symbols:["regex_body","regex_flags"],postprocess:function(e){return e.join("")}},{name:"regex_body$ebnf$1",symbols:[]},{name:"regex_body$ebnf$1",symbols:["regex_body$ebnf$1","regex_body_char"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_body",symbols:[{literal:"/"},"regex_body$ebnf$1",{literal:"/"}],postprocess:function(e){return"/"+e[1].join("")+"/"}},{name:"regex_body_char",symbols:[/[^\\]/],postprocess:ho},{name:"regex_body_char",symbols:[{literal:"\\"},/[^\\]/],postprocess:function(e){return"\\"+e[1]}},{name:"regex_flags",symbols:[]},{name:"regex_flags$ebnf$1",symbols:[/[gmiyusd]/]},{name:"regex_flags$ebnf$1",symbols:["regex_flags$ebnf$1",/[gmiyusd]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_flags",symbols:["regex_flags$ebnf$1"],postprocess:function(e){return e[0].join("")}},{name:"unquoted_value$ebnf$1",symbols:[]},{name:"unquoted_value$ebnf$1",symbols:["unquoted_value$ebnf$1",/[a-zA-Z\.\-_*@#$]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"unquoted_value",symbols:[/[a-zA-Z_*@#$]/,"unquoted_value$ebnf$1"],postprocess:function(e){return e[0]+e[1].join("")}}],ParserStart:"main"};dC.default=hse;var wI={},q0={},Th={};Object.defineProperty(Th,"__esModule",{value:!0});Th.isSafePath=void 0;var pse=/^(\.(?:[_a-zA-Z][a-zA-Z\d_]*|\0|[1-9]\d*))+$/u,gse=function(e){return pse.test(e)};Th.isSafePath=gse;Object.defineProperty(q0,"__esModule",{value:!0});q0.createGetValueFunctionBody=void 0;var mse=Th,yse=function(e){if(!(0,mse.isSafePath)(e))throw new Error("Unsafe path.");var t="return subject"+e;return t.replace(/(\.(\d+))/g,".[$2]").replace(/\./g,"?.")};q0.createGetValueFunctionBody=yse;(function(e){var t=Ee&&Ee.__assign||function(){return t=Object.assign||function(o){for(var s,a=1,l=arguments.length;a\d+) col (?\d+)/,xse=function(e){if(e.trim()==="")return{location:{end:0,start:0},type:"EmptyExpression"};var t=new CI.default.Parser(Sse),n;try{n=t.feed(e).results}catch(o){if(typeof(o==null?void 0:o.message)=="string"&&typeof(o==null?void 0:o.offset)=="number"){var r=o.message.match(wse);throw r?new vse.SyntaxError("Syntax error at line ".concat(r.groups.line," column ").concat(r.groups.column),o.offset,Number(r.groups.line),Number(r.groups.column)):o}throw o}if(n.length===0)throw new Error("Found no parsings.");if(n.length>1)throw new Error("Ambiguous results.");var i=(0,_se.hydrateAst)(n[0]);return i};H0.parse=xse;var W0={};Object.defineProperty(W0,"__esModule",{value:!0});W0.test=void 0;var Cse=xh,Tse=function(e,t){return(0,Cse.filter)(e,[t]).length===1};W0.test=Tse;var TI={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=void 0;var t=function(o,s){return s==="double"?'"'.concat(o,'"'):s==="single"?"'".concat(o,"'"):o},n=function(o){if(o.type==="LiteralExpression")return o.quoted&&typeof o.value=="string"?t(o.value,o.quotes):String(o.value);if(o.type==="RegexExpression")return String(o.value);if(o.type==="RangeExpression"){var s=o.range,a=s.min,l=s.max,u=s.minInclusive,c=s.maxInclusive;return"".concat(u?"[":"{").concat(a," TO ").concat(l).concat(c?"]":"}")}if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")},r=function(o){if(o.type!=="Tag")throw new Error("Expected a tag expression.");var s=o.field,a=o.expression,l=o.operator;if(s.type==="ImplicitField")return n(a);var u=s.quoted?t(s.name,s.quotes):s.name,c=" ".repeat(a.location.start-l.location.end);return u+l.operator+c+n(a)},i=function(o){if(o.type==="ParenthesizedExpression"){if(!("location"in o.expression))throw new Error("Expected location in expression.");if(!o.location.end)throw new Error("Expected location end.");var s=" ".repeat(o.expression.location.start-(o.location.start+1)),a=" ".repeat(o.location.end-o.expression.location.end-1);return"(".concat(s).concat((0,e.serialize)(o.expression)).concat(a,")")}if(o.type==="Tag")return r(o);if(o.type==="LogicalExpression"){var l="";return o.operator.type==="BooleanOperator"?(l+=" ".repeat(o.operator.location.start-o.left.location.end),l+=o.operator.operator,l+=" ".repeat(o.right.location.start-o.operator.location.end)):l=" ".repeat(o.right.location.start-o.left.location.end),"".concat((0,e.serialize)(o.left)).concat(l).concat((0,e.serialize)(o.right))}if(o.type==="UnaryOperator")return(o.operator==="NOT"?"NOT ":o.operator)+(0,e.serialize)(o.operand);if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")};e.serialize=i})(TI);var K0={};Object.defineProperty(K0,"__esModule",{value:!0});K0.isSafeUnquotedExpression=void 0;var Ese=function(e){return/^[#$*@A-Z_a-z][#$*.@A-Z_a-z-]*$/.test(e)};K0.isSafeUnquotedExpression=Ese;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isSafeUnquotedExpression=e.serialize=e.SyntaxError=e.LiqeError=e.test=e.parse=e.highlight=e.filter=void 0;var t=xh;Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return t.filter}});var n=G0;Object.defineProperty(e,"highlight",{enumerable:!0,get:function(){return n.highlight}});var r=H0;Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return r.parse}});var i=W0;Object.defineProperty(e,"test",{enumerable:!0,get:function(){return i.test}});var o=il;Object.defineProperty(e,"LiqeError",{enumerable:!0,get:function(){return o.LiqeError}}),Object.defineProperty(e,"SyntaxError",{enumerable:!0,get:function(){return o.SyntaxError}});var s=TI;Object.defineProperty(e,"serialize",{enumerable:!0,get:function(){return s.serialize}});var a=K0;Object.defineProperty(e,"isSafeUnquotedExpression",{enumerable:!0,get:function(){return a.isSafeUnquotedExpression}})})(mI);var Eh={},EI={},ol={};Object.defineProperty(ol,"__esModule",{value:!0});ol.ROARR_LOG_FORMAT_VERSION=ol.ROARR_VERSION=void 0;ol.ROARR_VERSION="5.0.0";ol.ROARR_LOG_FORMAT_VERSION="2.0.0";var Ph={};Object.defineProperty(Ph,"__esModule",{value:!0});Ph.logLevels=void 0;Ph.logLevels={debug:20,error:50,fatal:60,info:30,trace:10,warn:40};var PI={},X0={};Object.defineProperty(X0,"__esModule",{value:!0});X0.hasOwnProperty=void 0;const Pse=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);X0.hasOwnProperty=Pse;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasOwnProperty=void 0;var t=X0;Object.defineProperty(e,"hasOwnProperty",{enumerable:!0,get:function(){return t.hasOwnProperty}})})(PI);var AI={},Y0={},Q0={};Object.defineProperty(Q0,"__esModule",{value:!0});Q0.tokenize=void 0;const Ase=/(?:%(?([+0-]|-\+))?(?\d+)?(?\d+\$)?(?\.\d+)?(?[%BCESb-iosux]))|(\\%)/g,kse=e=>{let t;const n=[];let r=0,i=0,o=null;for(;(t=Ase.exec(e))!==null;){t.index>i&&(o={literal:e.slice(i,t.index),type:"literal"},n.push(o));const s=t[0];i=t.index+s.length,s==="\\%"||s==="%%"?o&&o.type==="literal"?o.literal+="%":(o={literal:"%",type:"literal"},n.push(o)):t.groups&&(o={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:s,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:r++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},n.push(o))}return i<=e.length-1&&(o&&o.type==="literal"?o.literal+=e.slice(i):n.push({literal:e.slice(i),type:"literal"})),n};Q0.tokenize=kse;Object.defineProperty(Y0,"__esModule",{value:!0});Y0.createPrintf=void 0;const bE=lC,Ose=Q0,Rse=(e,t)=>t.placeholder,Mse=e=>{var t;const n=(o,s,a)=>a==="-"?o.padEnd(s," "):a==="-+"?((Number(o)>=0?"+":"")+o).padEnd(s," "):a==="+"?((Number(o)>=0?"+":"")+o).padStart(s," "):a==="0"?o.padStart(s,"0"):o.padStart(s," "),r=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:Rse,i={};return(o,...s)=>{let a=i[o];a||(a=i[o]=Ose.tokenize(o));let l="";for(const u of a)if(u.type==="literal")l+=u.literal;else{let c=s[u.position];if(c===void 0)l+=r(o,u,s);else if(u.conversion==="b")l+=bE.boolean(c)?"true":"false";else if(u.conversion==="B")l+=bE.boolean(c)?"TRUE":"FALSE";else if(u.conversion==="c")l+=c;else if(u.conversion==="C")l+=String(c).toUpperCase();else if(u.conversion==="i"||u.conversion==="d")c=String(Math.trunc(c)),u.width!==null&&(c=n(c,u.width,u.flag)),l+=c;else if(u.conversion==="e")l+=Number(c).toExponential();else if(u.conversion==="E")l+=Number(c).toExponential().toUpperCase();else if(u.conversion==="f")u.precision!==null&&(c=Number(c).toFixed(u.precision)),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="o")l+=(Number.parseInt(String(c),10)>>>0).toString(8);else if(u.conversion==="s")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="S")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=String(c).toUpperCase();else if(u.conversion==="u")l+=Number.parseInt(String(c),10)>>>0;else if(u.conversion==="x")c=(Number.parseInt(String(c),10)>>>0).toString(16),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else throw new Error("Unknown format specifier.")}return l}};Y0.createPrintf=Mse;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=Y0;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()})(AI);var u2={exports:{}};(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,t.stringify=r,t.configure=_,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(y){return y.length<5e3&&!i.test(y)?`"${y}"`:JSON.stringify(y)}function s(y){if(y.length>200)return y.sort();for(let v=1;vg;)y[b]=y[b-1],b--;y[b]=g}return y}const a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(y){return a.call(y)!==void 0&&y.length!==0}function u(y,v,g){y.length= 1`)}return g===void 0?1/0:g}function h(y){return y===1?"1 item":`${y} items`}function p(y){const v=new Set;for(const g of y)(typeof g=="string"||typeof g=="number")&&v.add(String(g));return v}function m(y){if(n.call(y,"strict")){const v=y.strict;if(typeof v!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(v)return g=>{let b=`Object can not safely be stringified. Received type ${typeof g}`;throw typeof g!="function"&&(b+=` (${g.toString()})`),new Error(b)}}}function _(y){y={...y};const v=m(y);v&&(y.bigint===void 0&&(y.bigint=!1),"circularValue"in y||(y.circularValue=Error));const g=c(y),b=d(y,"bigint"),S=d(y,"deterministic"),w=f(y,"maximumDepth"),x=f(y,"maximumBreadth");function T(M,C,O,I,N,R){let D=C[M];switch(typeof D=="object"&&D!==null&&typeof D.toJSON=="function"&&(D=D.toJSON(M)),D=I.call(C,M,D),typeof D){case"string":return o(D);case"object":{if(D===null)return"null";if(O.indexOf(D)!==-1)return g;let L="",j=",";const U=R;if(Array.isArray(D)){if(D.length===0)return"[]";if(wx){const ne=D.length-x-1;L+=`${j}"... ${h(ne)} not stringified"`}return N!==""&&(L+=` +${U}`),O.pop(),`[${L}]`}let G=Object.keys(D);const W=G.length;if(W===0)return"{}";if(wx){const H=W-x;L+=`${Y}"...":${X}"${h(H)} not stringified"`,Y=j}return N!==""&&Y.length>1&&(L=` +${R}${L} +${U}`),O.pop(),`{${L}}`}case"number":return isFinite(D)?String(D):v?v(D):"null";case"boolean":return D===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(D);default:return v?v(D):void 0}}function P(M,C,O,I,N,R){switch(typeof C=="object"&&C!==null&&typeof C.toJSON=="function"&&(C=C.toJSON(M)),typeof C){case"string":return o(C);case"object":{if(C===null)return"null";if(O.indexOf(C)!==-1)return g;const D=R;let L="",j=",";if(Array.isArray(C)){if(C.length===0)return"[]";if(wx){const B=C.length-x-1;L+=`${j}"... ${h(B)} not stringified"`}return N!==""&&(L+=` +${D}`),O.pop(),`[${L}]`}O.push(C);let U="";N!==""&&(R+=N,j=`, +${R}`,U=" ");let G="";for(const W of I){const X=P(W,C[W],O,I,N,R);X!==void 0&&(L+=`${G}${o(W)}:${U}${X}`,G=j)}return N!==""&&G.length>1&&(L=` +${R}${L} +${D}`),O.pop(),`{${L}}`}case"number":return isFinite(C)?String(C):v?v(C):"null";case"boolean":return C===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(C);default:return v?v(C):void 0}}function E(M,C,O,I,N){switch(typeof C){case"string":return o(C);case"object":{if(C===null)return"null";if(typeof C.toJSON=="function"){if(C=C.toJSON(M),typeof C!="object")return E(M,C,O,I,N);if(C===null)return"null"}if(O.indexOf(C)!==-1)return g;const R=N;if(Array.isArray(C)){if(C.length===0)return"[]";if(wx){const J=C.length-x-1;X+=`${Y}"... ${h(J)} not stringified"`}return X+=` +${R}`,O.pop(),`[${X}]`}let D=Object.keys(C);const L=D.length;if(L===0)return"{}";if(wx){const X=L-x;U+=`${G}"...": "${h(X)} not stringified"`,G=j}return G!==""&&(U=` +${N}${U} +${R}`),O.pop(),`{${U}}`}case"number":return isFinite(C)?String(C):v?v(C):"null";case"boolean":return C===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(C);default:return v?v(C):void 0}}function A(M,C,O){switch(typeof C){case"string":return o(C);case"object":{if(C===null)return"null";if(typeof C.toJSON=="function"){if(C=C.toJSON(M),typeof C!="object")return A(M,C,O);if(C===null)return"null"}if(O.indexOf(C)!==-1)return g;let I="";if(Array.isArray(C)){if(C.length===0)return"[]";if(wx){const W=C.length-x-1;I+=`,"... ${h(W)} not stringified"`}return O.pop(),`[${I}]`}let N=Object.keys(C);const R=N.length;if(R===0)return"{}";if(wx){const j=R-x;I+=`${D}"...":"${h(j)} not stringified"`}return O.pop(),`{${I}}`}case"number":return isFinite(C)?String(C):v?v(C):"null";case"boolean":return C===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(C);default:return v?v(C):void 0}}function $(M,C,O){if(arguments.length>1){let I="";if(typeof O=="number"?I=" ".repeat(Math.min(O,10)):typeof O=="string"&&(I=O.slice(0,10)),C!=null){if(typeof C=="function")return T("",{"":M},[],C,I,"");if(Array.isArray(C))return P("",M,[],p(C),I,"")}if(I.length!==0)return E("",M,[],I,"")}return A("",M,[])}return $}})(u2,u2.exports);var Ise=u2.exports;(function(e){var t=Ee&&Ee.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(e,"__esModule",{value:!0}),e.createLogger=void 0;const n=ol,r=Ph,i=PI,o=AI,s=t(uC),a=t(Ise);let l=!1;const u=(0,s.default)(),c=()=>u.ROARR,d=()=>({messageContext:{},transforms:[]}),f=()=>{const g=c().asyncLocalStorage;if(!g)throw new Error("AsyncLocalContext is unavailable.");const b=g.getStore();return b||d()},h=()=>!!c().asyncLocalStorage,p=()=>{if(h()){const g=f();return(0,i.hasOwnProperty)(g,"sequenceRoot")&&(0,i.hasOwnProperty)(g,"sequence")&&typeof g.sequence=="number"?String(g.sequenceRoot)+"."+String(g.sequence++):String(c().sequence++)}return String(c().sequence++)},m=(g,b)=>(S,w,x,T,P,E,A,$,M,C)=>{g.child({logLevel:b})(S,w,x,T,P,E,A,$,M,C)},_=1e3,y=(g,b)=>(S,w,x,T,P,E,A,$,M,C)=>{const O=(0,a.default)({a:S,b:w,c:x,d:T,e:P,f:E,g:A,h:$,i:M,j:C,logLevel:b});if(!O)throw new Error("Expected key to be a string");const I=c().onceLog;I.has(O)||(I.add(O),I.size>_&&I.clear(),g.child({logLevel:b})(S,w,x,T,P,E,A,$,M,C))},v=(g,b={},S=[])=>{const w=(x,T,P,E,A,$,M,C,O,I)=>{const N=Date.now(),R=p();let D;h()?D=f():D=d();let L,j;if(typeof x=="string"?L={...D.messageContext,...b}:L={...D.messageContext,...b,...x},typeof x=="string"&&T===void 0)j=x;else if(typeof x=="string"){if(!x.includes("%"))throw new Error("When a string parameter is followed by other arguments, then it is assumed that you are attempting to format a message using printf syntax. You either forgot to add printf bindings or if you meant to add context to the log message, pass them in an object as the first parameter.");j=(0,o.printf)(x,T,P,E,A,$,M,C,O,I)}else{let G=T;if(typeof T!="string")if(T===void 0)G="";else throw new TypeError("Message must be a string. Received "+typeof T+".");j=(0,o.printf)(G,P,E,A,$,M,C,O,I)}let U={context:L,message:j,sequence:R,time:N,version:n.ROARR_LOG_FORMAT_VERSION};for(const G of[...D.transforms,...S])if(U=G(U),typeof U!="object"||U===null)throw new Error("Message transform function must return a message object.");g(U)};return w.child=x=>{let T;return h()?T=f():T=d(),typeof x=="function"?(0,e.createLogger)(g,{...T.messageContext,...b,...x},[x,...S]):(0,e.createLogger)(g,{...T.messageContext,...b,...x},S)},w.getContext=()=>{let x;return h()?x=f():x=d(),{...x.messageContext,...b}},w.adopt=async(x,T)=>{if(!h())return l===!1&&(l=!0,g({context:{logLevel:r.logLevels.warn,package:"roarr"},message:"async_hooks are unavailable; Roarr.adopt will not function as expected",sequence:p(),time:Date.now(),version:n.ROARR_LOG_FORMAT_VERSION})),x();const P=f();let E;(0,i.hasOwnProperty)(P,"sequenceRoot")&&(0,i.hasOwnProperty)(P,"sequence")&&typeof P.sequence=="number"?E=P.sequenceRoot+"."+String(P.sequence++):E=String(c().sequence++);let A={...P.messageContext};const $=[...P.transforms];typeof T=="function"?$.push(T):A={...A,...T};const M=c().asyncLocalStorage;if(!M)throw new Error("Async local context unavailable.");return M.run({messageContext:A,sequence:0,sequenceRoot:E,transforms:$},()=>x())},w.debug=m(w,r.logLevels.debug),w.debugOnce=y(w,r.logLevels.debug),w.error=m(w,r.logLevels.error),w.errorOnce=y(w,r.logLevels.error),w.fatal=m(w,r.logLevels.fatal),w.fatalOnce=y(w,r.logLevels.fatal),w.info=m(w,r.logLevels.info),w.infoOnce=y(w,r.logLevels.info),w.trace=m(w,r.logLevels.trace),w.traceOnce=y(w,r.logLevels.trace),w.warn=m(w,r.logLevels.warn),w.warnOnce=y(w,r.logLevels.warn),w};e.createLogger=v})(EI);var Z0={},Nse=function(t,n){for(var r=t.split("."),i=n.split("."),o=0;o<3;o++){var s=Number(r[o]),a=Number(i[o]);if(s>a)return 1;if(a>s)return-1;if(!isNaN(s)&&isNaN(a))return 1;if(isNaN(s)&&!isNaN(a))return-1}return 0},Dse=Ee&&Ee.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Z0,"__esModule",{value:!0});Z0.createRoarrInitialGlobalStateBrowser=void 0;const _E=ol,SE=Dse(Nse),Lse=e=>{const t=(e.versions||[]).concat();return t.length>1&&t.sort(SE.default),t.includes(_E.ROARR_VERSION)||t.push(_E.ROARR_VERSION),t.sort(SE.default),{sequence:0,...e,versions:t}};Z0.createRoarrInitialGlobalStateBrowser=Lse;var J0={};Object.defineProperty(J0,"__esModule",{value:!0});J0.getLogLevelName=void 0;const $se=e=>e<=10?"trace":e<=20?"debug":e<=30?"info":e<=40?"warn":e<=50?"error":"fatal";J0.getLogLevelName=$se;(function(e){var t=Ee&&Ee.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.getLogLevelName=e.logLevels=e.Roarr=e.ROARR=void 0;const n=EI,r=Z0,o=(0,t(uC).default)(),s=(0,r.createRoarrInitialGlobalStateBrowser)(o.ROARR||{});e.ROARR=s,o.ROARR=s;const a=d=>JSON.stringify(d),l=(0,n.createLogger)(d=>{var f;s.write&&s.write(((f=s.serializeMessage)!==null&&f!==void 0?f:a)(d))});e.Roarr=l;var u=Ph;Object.defineProperty(e,"logLevels",{enumerable:!0,get:function(){return u.logLevels}});var c=J0;Object.defineProperty(e,"getLogLevelName",{enumerable:!0,get:function(){return c.getLogLevelName}})})(Eh);var Fse=Ee&&Ee.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i0?h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(a.message," %O"),m,_,y,d):h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(a.message),m,_,y)}}};D0.createLogWriter=Wse;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createLogWriter=void 0;var t=D0;Object.defineProperty(e,"createLogWriter",{enumerable:!0,get:function(){return t.createLogWriter}})})(iI);Eh.ROARR.write=iI.createLogWriter();const OI={};Eh.Roarr.child(OI);const ev=P0(Eh.Roarr.child(OI)),fe=e=>ev.get().child({namespace:e}),V3e=["trace","debug","info","warn","error","fatal"],z3e={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function Kse(){const e=[];return function(t,n){if(typeof n!="object"||n===null)return n;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(n)?"[Circular]":(e.push(n),n)}}const Lf=js("nodes/receivedOpenAPISchema",async(e,{dispatch:t,rejectWithValue:n})=>{const r=fe("system");try{const o=await(await fetch("openapi.json")).json();return r.info({openAPISchema:o},"Received OpenAPI schema"),JSON.parse(JSON.stringify(o,Kse()))}catch(i){return n({error:i})}}),RI={nodes:[],edges:[],schema:null,invocationTemplates:{},connectionStartParams:null,shouldShowGraphOverlay:!1,shouldShowFieldTypeLegend:!1,shouldShowMinimapPanel:!0,editorInstance:void 0,progressNodeSize:{width:512,height:512}},MI=Et({name:"nodes",initialState:RI,reducers:{nodesChanged:(e,t)=>{e.nodes=KM(t.payload,e.nodes)},nodeAdded:(e,t)=>{e.nodes.push(t.payload)},edgesChanged:(e,t)=>{e.edges=oie(t.payload,e.edges)},connectionStarted:(e,t)=>{e.connectionStartParams=t.payload},connectionMade:(e,t)=>{e.edges=SM(t.payload,e.edges)},connectionEnded:e=>{e.connectionStartParams=null},fieldValueChanged:(e,t)=>{const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(s=>s.id===n);o>-1&&(e.nodes[o].data.inputs[r].value=i)},imageCollectionFieldValueChanged:(e,t)=>{const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(a=>a.id===n);if(o===-1)return;const s=Dn(e.nodes[o].data.inputs[r].value);if(!s){e.nodes[o].data.inputs[r].value=i;return}e.nodes[o].data.inputs[r].value=iY(s.concat(i),"image_name")},shouldShowGraphOverlayChanged:(e,t)=>{e.shouldShowGraphOverlay=t.payload},shouldShowFieldTypeLegendChanged:(e,t)=>{e.shouldShowFieldTypeLegend=t.payload},shouldShowMinimapPanelChanged:(e,t)=>{e.shouldShowMinimapPanel=t.payload},nodeTemplatesBuilt:(e,t)=>{e.invocationTemplates=t.payload},nodeEditorReset:e=>{e.nodes=[],e.edges=[]},setEditorInstance:(e,t)=>{e.editorInstance=t.payload},loadFileNodes:(e,t)=>{e.nodes=t.payload},loadFileEdges:(e,t)=>{e.edges=t.payload},setProgressNodeSize:(e,t)=>{e.progressNodeSize=t.payload}},extraReducers:e=>{e.addCase(Lf.fulfilled,(t,n)=>{t.schema=n.payload})}}),{nodesChanged:U3e,edgesChanged:G3e,nodeAdded:H3e,fieldValueChanged:c2,connectionMade:q3e,connectionStarted:W3e,connectionEnded:K3e,shouldShowGraphOverlayChanged:X3e,shouldShowFieldTypeLegendChanged:Y3e,shouldShowMinimapPanelChanged:Q3e,nodeTemplatesBuilt:fC,nodeEditorReset:II,imageCollectionFieldValueChanged:Z3e,setEditorInstance:J3e,loadFileNodes:e5e,loadFileEdges:t5e,setProgressNodeSize:n5e}=MI.actions,Xse=MI.reducer,NI={esrganModelName:"RealESRGAN_x4plus.pth"},DI=Et({name:"postprocessing",initialState:NI,reducers:{esrganModelNameChanged:(e,t)=>{e.esrganModelName=t.payload}}}),{esrganModelNameChanged:r5e}=DI.actions,Yse=DI.reducer,Qse={positiveStylePrompt:"",negativeStylePrompt:"",shouldUseSDXLRefiner:!1,sdxlImg2ImgDenoisingStrength:.7,refinerModel:null,refinerSteps:20,refinerCFGScale:7.5,refinerScheduler:"euler",refinerAestheticScore:6,refinerStart:.7},LI=Et({name:"sdxl",initialState:Qse,reducers:{setPositiveStylePromptSDXL:(e,t)=>{e.positiveStylePrompt=t.payload},setNegativeStylePromptSDXL:(e,t)=>{e.negativeStylePrompt=t.payload},setShouldUseSDXLRefiner:(e,t)=>{e.shouldUseSDXLRefiner=t.payload},setSDXLImg2ImgDenoisingStrength:(e,t)=>{e.sdxlImg2ImgDenoisingStrength=t.payload},refinerModelChanged:(e,t)=>{e.refinerModel=t.payload},setRefinerSteps:(e,t)=>{e.refinerSteps=t.payload},setRefinerCFGScale:(e,t)=>{e.refinerCFGScale=t.payload},setRefinerScheduler:(e,t)=>{e.refinerScheduler=t.payload},setRefinerAestheticScore:(e,t)=>{e.refinerAestheticScore=t.payload},setRefinerStart:(e,t)=>{e.refinerStart=t.payload}}}),{setPositiveStylePromptSDXL:i5e,setNegativeStylePromptSDXL:o5e,setShouldUseSDXLRefiner:Zse,setSDXLImg2ImgDenoisingStrength:s5e,refinerModelChanged:xE,setRefinerSteps:a5e,setRefinerCFGScale:l5e,setRefinerScheduler:u5e,setRefinerAestheticScore:c5e,setRefinerStart:d5e}=LI.actions,Jse=LI.reducer,Ah=ue("app/userInvoked"),eae={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class Gm{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||eae,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(r=>r!==n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{s(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(s=>{s.apply(s,[t,...r])})}}function Qc(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n}function CE(e){return e==null?"":""+e}function tae(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}function hC(e,t,n){function r(s){return s&&s.indexOf("###")>-1?s.replace(/###/g,"."):s}function i(){return!e||typeof e=="string"}const o=typeof t!="string"?[].concat(t):t.split(".");for(;o.length>1;){if(i())return{};const s=r(o.shift());!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={}}return i()?{}:{obj:e,k:r(o.shift())}}function TE(e,t,n){const{obj:r,k:i}=hC(e,t,Object);r[i]=n}function nae(e,t,n,r){const{obj:i,k:o}=hC(e,t,Object);i[o]=i[o]||[],r&&(i[o]=i[o].concat(n)),r||i[o].push(n)}function Hm(e,t){const{obj:n,k:r}=hC(e,t);if(n)return n[r]}function rae(e,t,n){const r=Hm(e,n);return r!==void 0?r:Hm(t,n)}function $I(e,t,n){for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):$I(e[r],t[r],n):e[r]=t[r]);return e}function Vl(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var iae={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function oae(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>iae[t]):e}const sae=[" ",",","?","!",";"];function aae(e,t,n){t=t||"",n=n||"";const r=sae.filter(s=>t.indexOf(s)<0&&n.indexOf(s)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(s=>s==="?"?"\\?":s).join("|")})`);let o=!i.test(e);if(!o){const s=e.indexOf(n);s>0&&!i.test(e.substring(0,s))&&(o=!0)}return o}function qm(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let o=0;oo+s;)s++,a=r.slice(o,o+s).join(n),l=i[a];if(l===void 0)return;if(l===null)return null;if(t.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}const u=r.slice(o+s).join(n);return u?qm(l,u,n):void 0}i=i[r[o]]}return i}function Wm(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class EE extends tv{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,s=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let a=[t,n];r&&typeof r!="string"&&(a=a.concat(r)),r&&typeof r=="string"&&(a=a.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(a=t.split("."));const l=Hm(this.data,a);return l||!s||typeof r!="string"?l:qm(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(s?r.split(s):r)),t.indexOf(".")>-1&&(a=t.split("."),i=n,n=a[1]),this.addNamespaces(n),TE(this.data,a,i),o.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(typeof r[o]=="string"||Object.prototype.toString.apply(r[o])==="[object Array]")&&this.addResource(t,n,o,r[o],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,o){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),i=r,r=n,n=a[1]),this.addNamespaces(n);let l=Hm(this.data,a)||{};i?$I(l,r,o):l={...l,...r},TE(this.data,a,l),s.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var FI={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(o=>{this.processors[o]&&(t=this.processors[o].process(t,n,r,i))}),t}};const PE={};class Km extends tv{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),tae(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Hi.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const s=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!aae(t,r,i);if(s&&!a){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:o};const u=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(i)}return typeof o=="string"&&(o=[o]),{key:t,namespaces:o}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:s,namespaces:a}=this.extractFromKey(t[t.length-1],n),l=a[a.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const b=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${b}${s}`,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:l}:`${l}${b}${s}`}return i?{res:s,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:l}:s}const d=this.resolve(t,n);let f=d&&d.res;const h=d&&d.usedKey||s,p=d&&d.exactUsedKey||s,m=Object.prototype.toString.apply(f),_=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject;if(v&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&_.indexOf(m)<0&&!(typeof y=="string"&&m==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const b=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:a}):`key '${s} (${this.language})' returned an object instead of string.`;return i?(d.res=b,d):b}if(o){const b=m==="[object Array]",S=b?[]:{},w=b?p:h;for(const x in f)if(Object.prototype.hasOwnProperty.call(f,x)){const T=`${w}${o}${x}`;S[x]=this.translate(T,{...n,joinArrays:!1,ns:a}),S[x]===T&&(S[x]=f[x])}f=S}}else if(v&&typeof y=="string"&&m==="[object Array]")f=f.join(y),f&&(f=this.extendTranslation(f,t,n,r));else{let b=!1,S=!1;const w=n.count!==void 0&&typeof n.count!="string",x=Km.hasDefaultValue(n),T=w?this.pluralResolver.getSuffix(u,n.count,n):"",P=n.ordinal&&w?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",E=n[`defaultValue${T}`]||n[`defaultValue${P}`]||n.defaultValue;!this.isValidLookup(f)&&x&&(b=!0,f=E),this.isValidLookup(f)||(S=!0,f=s);const $=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&S?void 0:f,M=x&&E!==f&&this.options.updateMissing;if(S||b||M){if(this.logger.log(M?"updateKey":"missingKey",u,l,s,M?E:f),o){const N=this.resolve(s,{...n,keySeparator:!1});N&&N.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let C=[];const O=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&O&&O[0])for(let N=0;N{const L=x&&D!==f?D:$;this.options.missingKeyHandler?this.options.missingKeyHandler(N,l,R,L,M,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(N,l,R,L,M,n),this.emit("missingKey",N,l,R,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?C.forEach(N=>{this.pluralResolver.getSuffixes(N,n).forEach(R=>{I([N],s+R,n[`defaultValue${R}`]||E)})}):I(C,s,E))}f=this.extendTranslation(f,t,n,d,r),S&&f===s&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${s}`),(S||b)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${s}`:s,b?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d):f}extendTranslation(t,n,r,i,o){var s=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language,r),u){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,s,a;return typeof t=="string"&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;i=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),p=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(_=>{this.isValidLookup(r)||(a=_,!PE[`${m[0]}-${_}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(PE[`${m[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(y=>{if(this.isValidLookup(r))return;s=y;const v=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,c,y,_,n);else{let b;f&&(b=this.pluralResolver.getSuffix(y,n.count,n));const S=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(v.push(c+b),n.ordinal&&b.indexOf(w)===0&&v.push(c+b.replace(w,this.options.pluralSeparator)),h&&v.push(c+S)),p){const x=`${c}${this.options.contextSeparator}${n.context}`;v.push(x),f&&(v.push(x+b),n.ordinal&&b.indexOf(w)===0&&v.push(x+b.replace(w,this.options.pluralSeparator)),h&&v.push(x+S))}}let g;for(;g=v.pop();)this.isValidLookup(r)||(o=g,r=this.getResource(y,_,g,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:s,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}function Bb(e){return e.charAt(0).toUpperCase()+e.slice(1)}class AE{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Hi.create("languageUtils")}getScriptPartFromCode(t){if(t=Wm(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Wm(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Bb(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Bb(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Bb(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&o.indexOf(i)===0)return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],o=s=>{s&&(this.isSupportedCode(s)?i.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):typeof t=="string"&&o(this.formatLanguageCode(t)),r.forEach(s=>{i.indexOf(s)<0&&o(this.formatLanguageCode(s))}),i}}let lae=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],uae={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const cae=["v1","v2","v3"],dae=["v4"],kE={zero:0,one:1,two:2,few:3,many:4,other:5};function fae(){const e={};return lae.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:uae[t.fc]}})}),e}class hae{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Hi.create("pluralResolver"),(!this.options.compatibilityJSON||dae.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=fae()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(Wm(t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,o)=>kE[i]-kE[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const o=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!cae.includes(this.options.compatibilityJSON)}}function OE(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=rae(e,t,n);return!o&&i&&typeof n=="string"&&(o=qm(e,n,r),o===void 0&&(o=qm(t,n,r))),o}class pae{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Hi.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const n=t.interpolation;this.escape=n.escape!==void 0?n.escape:oae,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?Vl(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?Vl(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?Vl(n.nestingPrefix):n.nestingPrefixEscaped||Vl("$t("),this.nestingSuffix=n.nestingSuffix?Vl(n.nestingSuffix):n.nestingSuffixEscaped||Vl(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(t,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(t,n,r,i){let o,s,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(p){return p.replace(/\$/g,"$$$$")}const c=p=>{if(p.indexOf(this.formatSeparator)<0){const v=OE(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(v,void 0,r,{...i,...n,interpolationkey:p}):v}const m=p.split(this.formatSeparator),_=m.shift().trim(),y=m.join(this.formatSeparator).trim();return this.format(OE(n,l,_,this.options.keySeparator,this.options.ignoreJSONStructure),y,r,{...i,...n,interpolationkey:_})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>u(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?u(this.escape(p)):u(p)}].forEach(p=>{for(a=0;o=p.regex.exec(t);){const m=o[1].trim();if(s=c(m),s===void 0)if(typeof d=="function"){const y=d(t,o,i);s=typeof y=="string"?y:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))s="";else if(f){s=o[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),s="";else typeof s!="string"&&!this.useRawValueToEscape&&(s=CE(s));const _=p.safeValue(s);if(t=t.replace(o[0],_),f?(p.regex.lastIndex+=s.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,s;function a(l,u){const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,s);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{s=JSON.parse(f),u&&(s={...u,...s})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,m),`${l}${c}${f}`}return delete s.defaultValue,l}for(;i=this.nestingRegexp.exec(t);){let l=[];s={...r},s=s.replace&&typeof s.replace!="string"?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=c.shift(),l=c,u=!0}if(o=n(a.call(this,i[1].trim(),s),s),o&&i[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=CE(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),o=""),u&&(o=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),t=t.replace(i[0],o),this.regexp.lastIndex=0}return t}}function gae(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(s=>{if(!s)return;const[a,...l]=s.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[a.trim()]||(n[a.trim()]=u),u==="false"&&(n[a.trim()]=!1),u==="true"&&(n[a.trim()]=!0),isNaN(u)||(n[a.trim()]=parseInt(u,10))})}return{formatName:t,formatOptions:n}}function zl(e){const t={};return function(r,i,o){const s=i+JSON.stringify(o);let a=t[s];return a||(a=e(Wm(i),o),t[s]=a),a(r)}}class mae{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Hi.create("formatter"),this.options=t,this.formats={number:zl((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:zl((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:zl((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:zl((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:zl((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=zl(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((a,l)=>{const{formatName:u,formatOptions:c}=gae(l);if(this.formats[u]){let d=a;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](a,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}function yae(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class vae extends tv{constructor(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Hi.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const o={},s={},a={},l={};return t.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?s[f]===void 0&&(s[f]=!0):(this.state[f]=1,c=!1,s[f]===void 0&&(s[f]=!0),o[f]===void 0&&(o[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(a[u]=!0)}),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),o=i[0],s=i[1];n&&this.emit("failedLoading",o,s,n),r&&this.store.addResourceBundle(o,s,r),this.state[t]=n?-1:2;const a={};this.queue.forEach(l=>{nae(l.loaded,[o],s),yae(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{a[u]||(a[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{a[u][d]===void 0&&(a[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;if(!t.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:o,callback:s});return}this.readingCalls++;const a=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&i{this.read.call(this,t,n,r,i+1,o*2,s)},o);return}s(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>a(null,c)).catch(a):a(null,u)}catch(u){a(u)}return}return l(t,n,a)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const o=this.queueLoad(t,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(s=>{this.loadOne(s)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(s,a)=>{s&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,s),!s&&a&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,a),this.loaded(t,s,a)})}saveMissing(t,n,r,i,o){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...s,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,i,l):c=u(t,n,r,i),c&&typeof c.then=="function"?c.then(d=>a(null,d)).catch(a):a(null,c)}catch(c){a(c)}else u(t,n,r,i,a,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}function RE(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){let n={};if(typeof t[1]=="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(i=>{n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:(e,t,n,r)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function ME(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function Rp(){}function bae(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class $f extends tv{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=ME(t),this.services={},this.logger=Hi,this.modules={external:[]},bae(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=RE();this.options={...i,...this.options,...ME(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function o(c){return c?typeof c=="function"?new c:c:null}if(!this.options.isClone){this.modules.logger?Hi.init(o(this.modules.logger),this.options):Hi.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=mae);const d=new AE(this.options);this.store=new EE(this.options.resources,this.options);const f=this.services;f.logger=Hi,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new hae(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=o(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new pae(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new vae(o(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var p=arguments.length,m=new Array(p>1?p-1:0),_=1;_1?p-1:0),_=1;_{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Rp),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=Qc(),u=()=>{const c=(d,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rp;const i=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode")return r();const o=[],s=a=>{if(!a)return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{o.indexOf(u)<0&&o.push(u)})};i?s(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>s(l)),this.options.preload&&this.options.preload.forEach(a=>s(a)),this.services.backendConnector.load(o,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const i=Qc();return t||(t=this.languages),n||(n=this.options.ns),r||(r=Rp),this.services.backendConnector.reload(t,n,o=>{i.resolve(),r(o)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&FI.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const i=Qc();this.emit("languageChanging",t);const o=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},s=(l,u)=>{u?(o(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},a=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{s(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),i}getFixedT(t,n,r){var i=this;const o=function(s,a){let l;if(typeof a!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${s}`:s,i.t(h,l)};return typeof t=="string"?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const s=(a,l)=>{const u=this.services.backendConnector.state[`${a}|${l}`];return u===-1||u===2};if(n.precheck){const a=n.precheck(this,s);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(r,t)&&(!i||s(o,t)))}loadNamespaces(t,n){const r=Qc();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Qc();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],o=t.filter(s=>i.indexOf(s)<0);return o.length?(this.options.preload=i.concat(o),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new AE(RE());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new $f(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rp;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},o=new $f(i);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(a=>{o[a]=this[a]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new EE(this.store.data,i),o.services.resourceStore=o.store),o.translator=new Km(o.services,i),o.translator.on("*",function(a){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;ctypeof e=="string"?{title:e,status:"info",isClosable:!0,duration:2500}:{status:"info",isClosable:!0,duration:2500,...e},BI={isConnected:!1,isProcessing:!1,isGFPGANAvailable:!0,isESRGANAvailable:!0,shouldConfirmOnDelete:!0,currentStep:0,totalSteps:0,currentIteration:0,totalIterations:0,currentStatusHasSteps:!1,isCancelable:!0,enableImageDebugging:!1,toastQueue:[],progressImage:null,shouldAntialiasProgressImage:!1,sessionId:null,cancelType:"immediate",isCancelScheduled:!1,subscribedNodeIds:[],wereModelsReceived:!1,wasSchemaParsed:!1,consoleLogLevel:"debug",shouldLogToConsole:!0,statusTranslationKey:"common.statusDisconnected",canceledSession:"",isPersisted:!1,language:"en",isUploading:!1,isNodesEnabled:!1,shouldUseNSFWChecker:!1,shouldUseWatermarker:!1},jI=Et({name:"system",initialState:BI,reducers:{setIsProcessing:(e,t)=>{e.isProcessing=t.payload},setCurrentStatus:(e,t)=>{e.statusTranslationKey=t.payload},setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setIsCancelable:(e,t)=>{e.isCancelable=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},cancelScheduled:e=>{e.isCancelScheduled=!0},scheduledCancelAborted:e=>{e.isCancelScheduled=!1},cancelTypeChanged:(e,t)=>{e.cancelType=t.payload},subscribedNodeIdsSet:(e,t)=>{e.subscribedNodeIds=t.payload},consoleLogLevelChanged:(e,t)=>{e.consoleLogLevel=t.payload},shouldLogToConsoleChanged:(e,t)=>{e.shouldLogToConsole=t.payload},shouldAntialiasProgressImageChanged:(e,t)=>{e.shouldAntialiasProgressImage=t.payload},isPersistedChanged:(e,t)=>{e.isPersisted=t.payload},languageChanged:(e,t)=>{e.language=t.payload},progressImageSet(e,t){e.progressImage=t.payload},setIsNodesEnabled(e,t){e.isNodesEnabled=t.payload},shouldUseNSFWCheckerChanged(e,t){e.shouldUseNSFWChecker=t.payload},shouldUseWatermarkerChanged(e,t){e.shouldUseWatermarker=t.payload}},extraReducers(e){e.addCase(l7,(t,n)=>{t.sessionId=n.payload.sessionId,t.canceledSession=""}),e.addCase(c7,t=>{t.sessionId=null}),e.addCase(o7,t=>{t.isConnected=!0,t.isCancelable=!0,t.isProcessing=!1,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.statusTranslationKey="common.statusConnected"}),e.addCase(a7,t=>{t.isConnected=!1,t.isProcessing=!1,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusDisconnected"}),e.addCase(f7,t=>{t.isCancelable=!0,t.isProcessing=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusGenerating"}),e.addCase(v7,(t,n)=>{const{step:r,total_steps:i,progress_image:o}=n.payload.data;t.isProcessing=!0,t.isCancelable=!0,t.currentStatusHasSteps=!0,t.currentStep=r+1,t.totalSteps=i,t.progressImage=o??null,t.statusTranslationKey="common.statusGenerating"}),e.addCase(h7,(t,n)=>{const{data:r}=n.payload;t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusProcessingComplete",t.canceledSession===r.graph_execution_state_id&&(t.isProcessing=!1,t.isCancelable=!0)}),e.addCase(m7,t=>{t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null}),e.addCase(Ah,t=>{t.isProcessing=!0,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.statusTranslationKey="common.statusPreparing"}),e.addCase(hl.fulfilled,(t,n)=>{t.canceledSession=n.meta.arg.session_id,t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null,t.toastQueue.push(Ha({title:Od("toast.canceled"),status:"warning"}))}),e.addCase(fC,t=>{t.wasSchemaParsed=!0}),e.addMatcher(NR,(t,n)=>{var r;t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null,t.toastQueue.push(Ha({title:Od("toast.serverError"),status:"error",description:((r=n.payload)==null?void 0:r.status)===422?"Validation Error":void 0}))}),e.addMatcher(Cae,(t,n)=>{t.isProcessing=!1,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusError",t.progressImage=null,t.toastQueue.push(Ha({title:Od("toast.serverError"),status:"error",description:ZX(n.payload.data.error_type)}))})}}),{setIsProcessing:f5e,setShouldConfirmOnDelete:h5e,setCurrentStatus:p5e,setIsCancelable:g5e,setEnableImageDebugging:m5e,addToast:Ft,clearToastQueue:y5e,cancelScheduled:v5e,scheduledCancelAborted:b5e,cancelTypeChanged:_5e,subscribedNodeIdsSet:S5e,consoleLogLevelChanged:w5e,shouldLogToConsoleChanged:x5e,isPersistedChanged:C5e,shouldAntialiasProgressImageChanged:T5e,languageChanged:E5e,progressImageSet:_ae,setIsNodesEnabled:P5e,shouldUseNSFWCheckerChanged:Sae,shouldUseWatermarkerChanged:wae}=jI.actions,xae=jI.reducer,Cae=Jr(Gx,w7,C7),Tae={searchFolder:null,advancedAddScanModel:null},VI=Et({name:"modelmanager",initialState:Tae,reducers:{setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setAdvancedAddScanModel:(e,t)=>{e.advancedAddScanModel=t.payload}}}),{setSearchFolder:A5e,setAdvancedAddScanModel:k5e}=VI.actions,Eae=VI.reducer,zI={shift:!1},UI=Et({name:"hotkeys",initialState:zI,reducers:{shiftKeyPressed:(e,t)=>{e.shift=t.payload}}}),{shiftKeyPressed:O5e}=UI.actions,Pae=UI.reducer,Aae=iF($V);GI=d2=void 0;var kae=Aae,Oae=function(){var t=[],n=[],r=void 0,i=function(u){return r=u,function(c){return function(d){return kae.compose.apply(void 0,n)(c)(d)}}},o=function(){for(var u,c,d=arguments.length,f=Array(d),h=0;h=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(s)throw a}}}}function qI(e,t){if(e){if(typeof e=="string")return NE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return NE(e,t)}}function NE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=r.prefix,o=r.driver,s=r.persistWholeStore,a=r.serialize;try{var l=s?Gae:Hae;yield l(t,n,{prefix:i,driver:o,serialize:a})}catch(u){console.warn("redux-remember: persist error",u)}});return function(){return e.apply(this,arguments)}}();function FE(e,t,n,r,i,o,s){try{var a=e[o](s),l=a.value}catch(u){n(u);return}a.done?t(l):Promise.resolve(l).then(r,i)}function BE(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(l){FE(o,r,i,s,a,"next",l)}function a(l){FE(o,r,i,s,a,"throw",l)}s(void 0)})}}var Wae=function(){var e=BE(function*(t,n,r){var i=r.prefix,o=r.driver,s=r.serialize,a=r.unserialize,l=r.persistThrottle,u=r.persistDebounce,c=r.persistWholeStore;yield Bae(t,n,{prefix:i,driver:o,unserialize:a,persistWholeStore:c});var d={},f=function(){var h=BE(function*(){var p=HI(t.getState(),n);yield qae(p,d,{prefix:i,driver:o,serialize:s,persistWholeStore:c}),gC(p,d)||t.dispatch({type:Nae,payload:p}),d=p});return function(){return h.apply(this,arguments)}}();u&&u>0?t.subscribe(Lae(f,u)):t.subscribe(Dae(f,l))});return function(n,r,i){return e.apply(this,arguments)}}();const Kae=Wae;function Ff(e){"@babel/helpers - typeof";return Ff=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ff(e)}function jE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zb(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:n.state,i=arguments.length>1?arguments[1]:void 0;i.type&&(i.type==="@@INIT"||i.type.startsWith("@@redux/INIT"))&&(n.state=zb({},r));var o=typeof t=="function"?t:mc(t);switch(i.type){case f2:return n.state=o(zb(zb({},n.state),i.payload||{}),{type:f2}),n.state;default:return o(r,i)}}},Jae=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.prefix,o=i===void 0?"@@remember-":i,s=r.serialize,a=s===void 0?function(_,y){return JSON.stringify(_)}:s,l=r.unserialize,u=l===void 0?function(_,y){return JSON.parse(_)}:l,c=r.persistThrottle,d=c===void 0?100:c,f=r.persistDebounce,h=r.persistWholeStore,p=h===void 0?!1:h;if(!t)throw Error("redux-remember error: driver required");if(!Array.isArray(n))throw Error("redux-remember error: rememberedKeys needs to be an array");var m=function(y){return function(v,g,b){var S=y(v,g,b);return Kae(S,n,{driver:t,prefix:o,serialize:a,unserialize:u,persistThrottle:d,persistDebounce:f,persistWholeStore:p}),S}};return m};const R5e=["chakra-ui-color-mode","i18nextLng","ROARR_FILTER","ROARR_LOG"],ele="@@invokeai-",tle=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"],nle=["pendingControlImages"],rle=["selection","selectedBoardId","galleryView"],ile=["schema","invocationTemplates"],ole=[],sle=[],ale=["currentIteration","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","totalIterations","totalSteps","isCancelScheduled","progressImage","wereModelsReceived","wasSchemaParsed","isPersisted","isUploading"],lle=["shouldShowImageDetails"],ule={canvas:tle,gallery:rle,generation:ole,nodes:ile,postprocessing:sle,system:ale,ui:lle,controlNet:nle},cle=(e,t)=>{const n=x0(e,ule[t]);return JSON.stringify(n)},dle={canvas:LR,gallery:R7,generation:qo,nodes:RI,postprocessing:NI,system:BI,config:yR,ui:RR,hotkeys:zI,controlNet:US},fle=(e,t)=>yX(JSON.parse(e),dle[t]),KI=ue("nodes/textToImageGraphBuilt"),XI=ue("nodes/imageToImageGraphBuilt"),YI=ue("nodes/canvasGraphBuilt"),QI=ue("nodes/nodesGraphBuilt"),hle=Jr(KI,XI,YI,QI),ple=e=>{if(hle(e)&&e.payload.nodes){const t={};return{...e,payload:{...e.payload,nodes:t}}}return Lf.fulfilled.match(e)?{...e,payload:""}:fC.match(e)?{...e,payload:""}:e},gle=["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine","socket/socketGeneratorProgress","socket/appSocketGeneratorProgress","hotkeys/shiftKeyPressed","@@REMEMBER_PERSISTED"],mle=e=>e,yle=()=>{le({actionCreator:VQ,effect:async(e,{dispatch:t,getState:n})=>{const r=fe("canvas"),i=n(),{sessionId:o,isProcessing:s}=i.system,a=e.payload;if(s){if(!a){r.debug("No canvas session, skipping cancel");return}if(a!==o){r.debug({canvasSessionId:a,session_id:o},"Canvas session does not match global session, skipping cancel");return}t(hl({session_id:o}))}}})};ue("app/appStarted");const vle=()=>{le({matcher:he.endpoints.listImages.matchFulfilled,effect:async(e,{dispatch:t,unsubscribe:n,cancelActiveListeners:r})=>{if(e.meta.arg.queryCacheKey!==ci({board_id:"none",categories:pi}))return;r(),n();const i=e.payload;i.ids.length>0&&t(Os(i.ids[0]))}})},mC=Gs.injectEndpoints({endpoints:e=>({getAppVersion:e.query({query:()=>({url:"app/version",method:"GET"}),providesTags:["AppVersion"],keepUnusedDataFor:864e5}),getAppConfig:e.query({query:()=>({url:"app/config",method:"GET"}),providesTags:["AppConfig"],keepUnusedDataFor:864e5})})}),{useGetAppVersionQuery:M5e,useGetAppConfigQuery:I5e}=mC,ble=()=>{le({matcher:mC.endpoints.getAppConfig.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const{infill_methods:r,nsfw_methods:i,watermarking_methods:o}=e.payload,s=t().generation.infillMethod;r.includes(s)||n(_Q(r[0])),i.includes("nsfw_checker")||n(Sae(!1)),o.includes("invisible_watermark")||n(wae(!1))}})},_le=ue("app/appStarted"),Sle=()=>{le({actionCreator:_le,effect:async(e,{unsubscribe:t,cancelActiveListeners:n})=>{n(),t()}})},yC={memoizeOptions:{resultEqualityCheck:w0}},ZI=(e,t)=>{var d;const{generation:n,canvas:r,nodes:i,controlNet:o}=e,s=((d=n.initialImage)==null?void 0:d.imageName)===t,a=r.layerState.objects.some(f=>f.kind==="image"&&f.imageName===t),l=i.nodes.some(f=>Pa(f.data.inputs,h=>{var p;return h.type==="image"&&((p=h.value)==null?void 0:p.image_name)===t})),u=Pa(o.controlNets,f=>f.controlImage===t||f.processedControlImage===t);return{isInitialImage:s,isCanvasImage:a,isNodesImage:l,isControlNetImage:u}},wle=Zn([e=>e],e=>{const{imageToDelete:t}=e.imageDeletion;if(!t)return;const{image_name:n}=t;return ZI(e,n)},yC),xle=()=>{le({matcher:nc.endpoints.deleteBoardAndImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{deleted_images:r}=e.payload;let i=!1,o=!1,s=!1,a=!1;const l=n();r.forEach(u=>{const c=ZI(l,u);c.isInitialImage&&!i&&(t(AR()),i=!0),c.isCanvasImage&&!o&&(t(FR()),o=!0),c.isNodesImage&&!s&&(t(II()),s=!0),c.isControlNetImage&&!a&&(t(P7()),a=!0)})}})},Cle=()=>{le({matcher:Jr(GS,Om),effect:async(e,{getState:t,dispatch:n,condition:r,cancelActiveListeners:i})=>{i();const o=t(),s=GS.match(e)?e.payload:o.gallery.selectedBoardId,l=(Om.match(e)?e.payload:o.gallery.galleryView)==="images"?pi:_s,u={board_id:s??"none",categories:l};if(await r(()=>he.endpoints.listImages.select(u)(t()).isSuccess,5e3)){const{data:d}=he.endpoints.listImages.select(u)(t());d!=null&&d.ids.length?n(Os(d.ids[0]??null)):n(Os(null))}else n(Os(null))}})},Tle=ue("canvas/canvasSavedToGallery"),Ele=ue("canvas/canvasCopiedToClipboard"),Ple=ue("canvas/canvasDownloadedAsImage"),Ale=ue("canvas/canvasMerged"),kle=ue("canvas/stagingAreaImageSaved");let JI=null,eN=null;const N5e=e=>{JI=e},rv=()=>JI,D5e=e=>{eN=e},Ole=()=>eN,Rle=async e=>new Promise((t,n)=>{e.toBlob(r=>{if(r){t(r);return}n("Unable to create Blob")})}),Ym=async(e,t)=>await Rle(e.toCanvas(t)),vC=async e=>{const t=rv();if(!t)return;const{shouldCropToBoundingBoxOnSave:n,boundingBoxCoordinates:r,boundingBoxDimensions:i}=e.canvas,o=t.clone();o.scale({x:1,y:1});const s=o.getAbsolutePosition(),a=n?{x:r.x+s.x,y:r.y+s.y,width:i.width,height:i.height}:o.getClientRect();return Ym(o,a)},Mle=e=>{navigator.clipboard.write([new ClipboardItem({[e.type]:e})])},Ile=()=>{le({actionCreator:Ele,effect:async(e,{dispatch:t,getState:n})=>{const r=ev.get().child({namespace:"canvasCopiedToClipboardListener"}),i=n(),o=await vC(i);if(!o){r.error("Problem getting base layer blob"),t(Ft({title:"Problem Copying Canvas",description:"Unable to export base layer",status:"error"}));return}Mle(o),t(Ft({title:"Canvas Copied to Clipboard",status:"success"}))}})},Nle=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),r.remove()},Dle=()=>{le({actionCreator:Ple,effect:async(e,{dispatch:t,getState:n})=>{const r=ev.get().child({namespace:"canvasSavedToGalleryListener"}),i=n(),o=await vC(i);if(!o){r.error("Problem getting base layer blob"),t(Ft({title:"Problem Downloading Canvas",description:"Unable to export base layer",status:"error"}));return}Nle(o,"canvas.png"),t(Ft({title:"Canvas Downloaded",status:"success"}))}})},Lle=async()=>{const e=rv();if(!e)return;const t=e.clone();return t.scale({x:1,y:1}),Ym(t,t.getClientRect())},$le=()=>{le({actionCreator:Ale,effect:async(e,{dispatch:t})=>{const n=ev.get().child({namespace:"canvasCopiedToClipboardListener"}),r=await Lle();if(!r){n.error("Problem getting base layer blob"),t(Ft({title:"Problem Merging Canvas",description:"Unable to export base layer",status:"error"}));return}const i=rv();if(!i){n.error("Problem getting canvas base layer"),t(Ft({title:"Problem Merging Canvas",description:"Unable to export base layer",status:"error"}));return}const o=i.getClientRect({relativeTo:i.getParent()}),s=await t(he.endpoints.uploadImage.initiate({file:new File([r],"mergedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!0,postUploadAction:{type:"TOAST",toastOptions:{title:"Canvas Merged"}}})).unwrap(),{image_name:a}=s;t(zQ({kind:"image",layer:"base",imageName:a,...o}))}})},Fle=()=>{le({actionCreator:Tle,effect:async(e,{dispatch:t,getState:n})=>{const r=fe("canvas"),i=n(),o=await vC(i);if(!o){r.error("Problem getting base layer blob"),t(Ft({title:"Problem Saving Canvas",description:"Unable to export base layer",status:"error"}));return}t(he.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!1,board_id:i.gallery.autoAddBoardId,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:"Canvas Saved to Gallery"}}}))}})},Ble=(e,t,n)=>{if(!(iJ.match(e)||_T.match(e)||qx.match(e)||oJ.match(e)||ST.match(e))||ST.match(e)&&n.controlNet.controlNets[e.payload.controlNetId].shouldAutoConfig===!0)return!1;const{controlImage:i,processorType:o,shouldAutoConfig:s}=t.controlNet.controlNets[e.payload.controlNetId];if(_T.match(e)&&!s)return!1;const a=o!=="none",l=t.system.isProcessing;return a&&!l&&!!i},jle=()=>{le({predicate:Ble,effect:async(e,{dispatch:t,cancelActiveListeners:n,delay:r})=>{const i=fe("session"),{controlNetId:o}=e.payload;n(),i.trace("ControlNet auto-process triggered"),await r(300),t(Hx({controlNetId:o}))}})},pl=ue("system/sessionReadyToInvoke"),tN=e=>(e==null?void 0:e.type)==="image_output",Vle=()=>{le({actionCreator:Hx,effect:async(e,{dispatch:t,getState:n,take:r})=>{const i=fe("session"),{controlNetId:o}=e.payload,s=n().controlNet.controlNets[o];if(!s.controlImage){i.error("Unable to process ControlNet image");return}const a={nodes:{[s.processorNode.id]:{...s.processorNode,is_intermediate:!0,image:{image_name:s.controlImage}}}},l=t(kn({graph:a})),[u]=await r(f=>kn.fulfilled.match(f)&&f.meta.requestId===l.requestId),c=u.payload.id;t(pl());const[d]=await r(f=>Ux.match(f)&&f.payload.data.graph_execution_state_id===c);if(tN(d.payload.data.result)){const{image_name:f}=d.payload.data.result.image,[{payload:h}]=await r(m=>he.endpoints.getImageDTO.matchFulfilled(m)&&m.payload.image_name===f),p=h;i.debug({controlNetId:e.payload,processedControlImage:p},"ControlNet image processed"),t(rJ({controlNetId:o,processedControlImage:p.image_name}))}}})},zle=()=>{le({matcher:he.endpoints.addImageToBoard.matchFulfilled,effect:e=>{const t=fe("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Image added to board")}})},Ule=()=>{le({matcher:he.endpoints.addImageToBoard.matchRejected,effect:e=>{const t=fe("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Problem adding image to board")}})},L5e=e=>e.gallery,$5e=Zn(e=>e,e=>e.gallery.selection[e.gallery.selection.length-1],yC),Gle=Zn([e=>e],e=>{const{selectedBoardId:t,galleryView:n}=e.gallery;return{board_id:t??"none",categories:n==="images"?pi:_s,offset:0,limit:WQ,is_intermediate:!1}},yC),nN=ue("imageDeletion/imageDeletionConfirmed"),Hle=()=>{le({actionCreator:nN,effect:async(e,{dispatch:t,getState:n,condition:r})=>{const{imageDTO:i,imageUsage:o}=e.payload;t(N7(!1));const{image_name:s}=i,a=n();if(a.gallery.selection[a.gallery.selection.length-1]===s){const d=Gle(a),{data:f}=he.endpoints.listImages.select(d)(a),h=(f==null?void 0:f.ids)??[],p=h.findIndex(v=>v.toString()===s),m=h.filter(v=>v.toString()!==s),_=bs(p,0,m.length-1),y=m[_];t(Os(y||null))}o.isCanvasImage&&t(FR()),o.isControlNetImage&&t(P7()),o.isInitialImage&&t(AR()),o.isNodesImage&&t(II());const{requestId:u}=t(he.endpoints.deleteImage.initiate(i));await r(d=>he.endpoints.deleteImage.matchFulfilled(d)&&d.meta.requestId===u,3e4)&&t(Gs.util.invalidateTags([{type:"Board",id:i.board_id}]))}})},qle=()=>{le({matcher:he.endpoints.deleteImage.matchPending,effect:()=>{}})},Wle=()=>{le({matcher:he.endpoints.deleteImage.matchFulfilled,effect:e=>{fe("images").debug({imageDTO:e.meta.arg.originalArgs},"Image deleted")}})},Kle=()=>{le({matcher:he.endpoints.deleteImage.matchRejected,effect:e=>{fe("images").debug({imageDTO:e.meta.arg.originalArgs},"Unable to delete image")}})},rN=ue("dnd/dndDropped"),Xle=()=>{le({actionCreator:rN,effect:async(e,{dispatch:t})=>{const n=fe("images"),{activeData:r,overData:i}=e.payload;if(n.debug({activeData:r,overData:i},"Image or selection dropped"),i.actionType==="SET_CURRENT_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(Os(r.payload.imageDTO.image_name));return}if(i.actionType==="SET_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(E0(r.payload.imageDTO));return}if(i.actionType==="ADD_TO_BATCH"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(HS([r.payload.imageDTO.image_name]));return}if(i.actionType==="ADD_TO_BATCH"&&r.payloadType==="IMAGE_NAMES"){t(HS(r.payload.image_names));return}if(i.actionType==="SET_CONTROLNET_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{controlNetId:o}=i.context;t(qx({controlImage:r.payload.imageDTO.image_name,controlNetId:o}));return}if(i.actionType==="SET_CANVAS_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(BR(r.payload.imageDTO));return}if(i.actionType==="SET_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:s}=i.context;t(c2({nodeId:s,fieldName:o,value:r.payload.imageDTO}));return}if(i.actionType==="SET_MULTI_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:s}=i.context;t(c2({nodeId:s,fieldName:o,value:[r.payload.imageDTO]}));return}if(i.actionType==="MOVE_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload,{boardId:s}=i.context;if(!s){t(he.endpoints.removeImageFromBoard.initiate({imageDTO:o}));return}t(he.endpoints.addImageToBoard.initiate({imageDTO:o,board_id:s}));return}}})},Yle=()=>{le({matcher:he.endpoints.removeImageFromBoard.matchFulfilled,effect:e=>{const t=fe("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Image removed from board")}})},Qle=()=>{le({matcher:he.endpoints.removeImageFromBoard.matchRejected,effect:e=>{const t=fe("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Problem removing image from board")}})},Zle=()=>{le({actionCreator:pJ,effect:async(e,{dispatch:t,getState:n})=>{const r=e.payload,i=n(),{shouldConfirmOnDelete:o}=i.system,s=wle(n());if(!s)return;const a=s.isCanvasImage||s.isInitialImage||s.isControlNetImage||s.isNodesImage;if(o||a){t(N7(!0));return}t(nN({imageDTO:r,imageUsage:s}))}})},ma={title:"Image Uploaded",status:"success"},Jle=()=>{le({matcher:he.endpoints.uploadImage.matchFulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=fe("images"),i=e.payload,o=n(),{autoAddBoardId:s}=o.gallery;r.debug({imageDTO:i},"Image uploaded");const{postUploadAction:a}=e.meta.arg.originalArgs;if(!(e.payload.is_intermediate&&!a)){if((a==null?void 0:a.type)==="TOAST"){const{toastOptions:l}=a;if(!s)t(Ft({...ma,...l}));else{t(he.endpoints.addImageToBoard.initiate({board_id:s,imageDTO:i}));const{data:u}=nc.endpoints.listAllBoards.select()(o),c=u==null?void 0:u.find(f=>f.board_id===s),d=c?`Added to board ${c.board_name}`:`Added to board ${s}`;t(Ft({...ma,description:d}))}return}if((a==null?void 0:a.type)==="SET_CANVAS_INITIAL_IMAGE"){t(BR(i)),t(Ft({...ma,description:"Set as canvas initial image"}));return}if((a==null?void 0:a.type)==="SET_CONTROLNET_IMAGE"){const{controlNetId:l}=a;t(qx({controlNetId:l,controlImage:i.image_name})),t(Ft({...ma,description:"Set as control image"}));return}if((a==null?void 0:a.type)==="SET_INITIAL_IMAGE"){t(E0(i)),t(Ft({...ma,description:"Set as initial image"}));return}if((a==null?void 0:a.type)==="SET_NODES_IMAGE"){const{nodeId:l,fieldName:u}=a;t(c2({nodeId:l,fieldName:u,value:i})),t(Ft({...ma,description:`Set as node field ${u}`}));return}if((a==null?void 0:a.type)==="ADD_TO_BATCH"){t(HS([i.image_name])),t(Ft({...ma,description:"Added to batch"}));return}}}})},eue=()=>{le({matcher:he.endpoints.uploadImage.matchRejected,effect:(e,{dispatch:t})=>{const n=fe("images"),r={arg:{...x0(e.meta.arg.originalArgs,["file","postUploadAction"]),file:""}};n.error({...r},"Image upload failed"),t(Ft({title:"Image Upload Failed",description:e.error.message,status:"error"}))}})},tue=ue("generation/initialImageSelected"),nue=ue("generation/modelSelected"),rue=()=>{le({actionCreator:tue,effect:(e,{dispatch:t})=>{if(!e.payload){t(Ft(Ha({title:Od("toast.imageNotLoadedDesc"),status:"error"})));return}t(E0(e.payload)),t(Ft(Ha(Od("toast.sentToImageToImage"))))}})},iue=()=>{le({actionCreator:nue,effect:(e,{getState:t,dispatch:n})=>{var l;const r=fe("models"),i=t(),o=Cf.safeParse(e.payload);if(!o.success){r.error({error:o.error.format()},"Failed to parse main model");return}const s=o.data,{base_model:a}=s;if(((l=i.generation.model)==null?void 0:l.base_model)!==a){let u=0;Za(i.lora.loras,(f,h)=>{f.base_model!==a&&(n(L7(h)),u+=1)});const{vae:c}=i.generation;c&&c.base_model!==a&&(n(kR(null)),u+=1);const{controlNets:d}=i.controlNet;Za(d,(f,h)=>{var p;((p=f.model)==null?void 0:p.base_model)!==a&&(n(E7({controlNetId:h})),u+=1)}),u>0&&n(Ft(Ha({title:`Base model changed, cleared ${u} incompatible submodel${u===1?"":"s"}`,status:"warning"})))}n(Va(s))}})},VE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),zE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),UE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),GE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),HE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),qE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),oue=({base_model:e,model_type:t,model_name:n})=>`${e}/${t}/${n}`,Ul=e=>{const t=[];return e.forEach(n=>{const r={...Dn(n),id:oue(n)};t.push(r)}),t},wo=Gs.injectEndpoints({endpoints:e=>({getOnnxModels:e.query({query:t=>{const n={model_type:"onnx",base_models:t};return`models/?${hg.stringify(n,{arrayFormat:"none"})}`},providesTags:(t,n,r)=>{const i=[{id:"OnnxModel",type:Le}];return t&&i.push(...t.ids.map(o=>({type:"OnnxModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return zE.setAll(zE.getInitialState(),i)}}),getMainModels:e.query({query:t=>{const n={model_type:"main",base_models:t};return`models/?${hg.stringify(n,{arrayFormat:"none"})}`},providesTags:(t,n,r)=>{const i=[{type:"MainModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"MainModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return VE.setAll(VE.getInitialState(),i)}}),updateMainModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/main/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),importMainModels:e.mutation({query:({body:t})=>({url:"models/import",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),addMainModels:e.mutation({query:({body:t})=>({url:"models/add",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),deleteMainModels:e.mutation({query:({base_model:t,model_name:n})=>({url:`models/${t}/main/${n}`,method:"DELETE"}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),convertMainModels:e.mutation({query:({base_model:t,model_name:n,params:r})=>({url:`models/convert/${t}/main/${n}`,method:"PUT",params:r}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),mergeMainModels:e.mutation({query:({base_model:t,body:n})=>({url:`models/merge/${t}`,method:"PUT",body:n}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),syncModels:e.mutation({query:()=>({url:"models/sync",method:"POST"}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),getLoRAModels:e.query({query:()=>({url:"models/",params:{model_type:"lora"}}),providesTags:(t,n,r)=>{const i=[{type:"LoRAModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"LoRAModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return UE.setAll(UE.getInitialState(),i)}}),getControlNetModels:e.query({query:()=>({url:"models/",params:{model_type:"controlnet"}}),providesTags:(t,n,r)=>{const i=[{type:"ControlNetModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"ControlNetModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return GE.setAll(GE.getInitialState(),i)}}),getVaeModels:e.query({query:()=>({url:"models/",params:{model_type:"vae"}}),providesTags:(t,n,r)=>{const i=[{type:"VaeModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"VaeModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return qE.setAll(qE.getInitialState(),i)}}),getTextualInversionModels:e.query({query:()=>({url:"models/",params:{model_type:"embedding"}}),providesTags:(t,n,r)=>{const i=[{type:"TextualInversionModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"TextualInversionModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return HE.setAll(HE.getInitialState(),i)}}),getModelsInFolder:e.query({query:t=>({url:`/models/search?${hg.stringify(t,{})}`}),providesTags:(t,n,r)=>{const i=[{type:"ScannedModels",id:Le}];return t&&i.push(...t.map(o=>({type:"ScannedModels",id:o}))),i}}),getCheckpointConfigs:e.query({query:()=>({url:"/models/ckpt_confs"})})})}),{useGetMainModelsQuery:F5e,useGetOnnxModelsQuery:B5e,useGetControlNetModelsQuery:j5e,useGetLoRAModelsQuery:V5e,useGetTextualInversionModelsQuery:z5e,useGetVaeModelsQuery:U5e,useUpdateMainModelsMutation:G5e,useDeleteMainModelsMutation:H5e,useImportMainModelsMutation:q5e,useAddMainModelsMutation:W5e,useConvertMainModelsMutation:K5e,useMergeMainModelsMutation:X5e,useSyncModelsMutation:Y5e,useGetModelsInFolderQuery:Q5e,useGetCheckpointConfigsQuery:Z5e}=wo,sue=()=>{le({predicate:(e,t)=>wo.endpoints.getMainModels.matchFulfilled(t)&&!t.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=fe("models");r.info({models:e.payload.entities},`Main models loaded (${e.payload.ids.length})`);const i=t().generation.model;if(Pa(e.payload.entities,u=>(u==null?void 0:u.model_name)===(i==null?void 0:i.model_name)&&(u==null?void 0:u.base_model)===(i==null?void 0:i.base_model)))return;const s=e.payload.ids[0],a=e.payload.entities[s];if(!a){n(Va(null));return}const l=Cf.safeParse(a);if(!l.success){r.error({error:l.error.format()},"Failed to parse main model");return}n(Va(l.data))}}),le({predicate:(e,t)=>wo.endpoints.getMainModels.matchFulfilled(t)&&t.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=fe("models");r.info({models:e.payload.entities},`SDXL Refiner models loaded (${e.payload.ids.length})`);const i=t().sdxl.refinerModel;if(Pa(e.payload.entities,u=>(u==null?void 0:u.model_name)===(i==null?void 0:i.model_name)&&(u==null?void 0:u.base_model)===(i==null?void 0:i.base_model)))return;const s=e.payload.ids[0],a=e.payload.entities[s];if(!a){n(xE(null)),n(Zse(!1));return}const l=Cf.safeParse(a);if(!l.success){r.error({error:l.error.format()},"Failed to parse SDXL Refiner Model");return}n(xE(l.data))}}),le({matcher:wo.endpoints.getVaeModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=fe("models");r.info({models:e.payload.entities},`VAEs loaded (${e.payload.ids.length})`);const i=t().generation.vae;if(i===null||Pa(e.payload.entities,u=>(u==null?void 0:u.model_name)===(i==null?void 0:i.model_name)&&(u==null?void 0:u.base_model)===(i==null?void 0:i.base_model)))return;const s=e.payload.ids[0],a=e.payload.entities[s];if(!a){n(Va(null));return}const l=yQ.safeParse(a);if(!l.success){r.error({error:l.error.format()},"Failed to parse VAE model");return}n(kR(l.data))}}),le({matcher:wo.endpoints.getLoRAModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{fe("models").info({models:e.payload.entities},`LoRAs loaded (${e.payload.ids.length})`);const i=t().lora.loras;Za(i,(o,s)=>{Pa(e.payload.entities,l=>(l==null?void 0:l.model_name)===(o==null?void 0:o.model_name)&&(l==null?void 0:l.base_model)===(o==null?void 0:o.base_model))||n(L7(s))})}}),le({matcher:wo.endpoints.getControlNetModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{fe("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`);const i=t().controlNet.controlNets;Za(i,(o,s)=>{Pa(e.payload.entities,l=>{var u,c;return(l==null?void 0:l.model_name)===((u=o==null?void 0:o.model)==null?void 0:u.model_name)&&(l==null?void 0:l.base_model)===((c=o==null?void 0:o.model)==null?void 0:c.base_model)})||n(E7({controlNetId:s}))})}}),le({matcher:wo.endpoints.getTextualInversionModels.matchFulfilled,effect:async e=>{fe("models").info({models:e.payload.entities},`Embeddings loaded (${e.payload.ids.length})`)}})},ia=e=>JSON.parse(JSON.stringify(e)),p2=e=>!("$ref"in e),aue=e=>!("$ref"in e),J5e=500,lue={integer:"integer",float:"float",number:"float",string:"string",boolean:"boolean",enum:"enum",ImageField:"image",image_collection:"image_collection",LatentsField:"latents",ConditioningField:"conditioning",UNetField:"unet",ClipField:"clip",VaeField:"vae",model:"model",refiner_model:"refiner_model",vae_model:"vae_model",lora_model:"lora_model",controlnet_model:"controlnet_model",ControlNetModelField:"controlnet_model",array:"array",item:"item",ColorField:"color",ControlField:"control",control:"control",cfg_scale:"float",control_weight:"float"},uue=500,Dt=e=>`var(--invokeai-colors-${e}-${uue})`,e4e={integer:{color:"red",colorCssVar:Dt("red"),title:"Integer",description:"Integers are whole numbers, without a decimal point."},float:{color:"orange",colorCssVar:Dt("orange"),title:"Float",description:"Floats are numbers with a decimal point."},string:{color:"yellow",colorCssVar:Dt("yellow"),title:"String",description:"Strings are text."},boolean:{color:"green",colorCssVar:Dt("green"),title:"Boolean",description:"Booleans are true or false."},enum:{color:"blue",colorCssVar:Dt("blue"),title:"Enum",description:"Enums are values that may be one of a number of options."},image:{color:"purple",colorCssVar:Dt("purple"),title:"Image",description:"Images may be passed between nodes."},image_collection:{color:"purple",colorCssVar:Dt("purple"),title:"Image Collection",description:"A collection of images."},latents:{color:"pink",colorCssVar:Dt("pink"),title:"Latents",description:"Latents may be passed between nodes."},conditioning:{color:"cyan",colorCssVar:Dt("cyan"),title:"Conditioning",description:"Conditioning may be passed between nodes."},unet:{color:"red",colorCssVar:Dt("red"),title:"UNet",description:"UNet submodel."},clip:{color:"green",colorCssVar:Dt("green"),title:"Clip",description:"Tokenizer and text_encoder submodels."},vae:{color:"blue",colorCssVar:Dt("blue"),title:"Vae",description:"Vae submodel."},control:{color:"cyan",colorCssVar:Dt("cyan"),title:"Control",description:"Control info passed between nodes."},model:{color:"teal",colorCssVar:Dt("teal"),title:"Model",description:"Models are models."},refiner_model:{color:"teal",colorCssVar:Dt("teal"),title:"Refiner Model",description:"Models are models."},vae_model:{color:"teal",colorCssVar:Dt("teal"),title:"VAE",description:"Models are models."},lora_model:{color:"teal",colorCssVar:Dt("teal"),title:"LoRA",description:"Models are models."},controlnet_model:{color:"teal",colorCssVar:Dt("teal"),title:"ControlNet",description:"Models are models."},array:{color:"gray",colorCssVar:Dt("gray"),title:"Array",description:"TODO: Array type description."},item:{color:"gray",colorCssVar:Dt("gray"),title:"Collection Item",description:"TODO: Collection Item type description."},color:{color:"gray",colorCssVar:Dt("gray"),title:"Color",description:"A RGBA color."}},t4e=250,Ub=e=>e.$ref.split("/").slice(-1)[0],cue=({schemaObject:e,baseField:t})=>{const n={...t,type:"integer",inputRequirement:"always",inputKind:"any",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},due=({schemaObject:e,baseField:t})=>{const n={...t,type:"float",inputRequirement:"always",inputKind:"any",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},fue=({schemaObject:e,baseField:t})=>{const n={...t,type:"string",inputRequirement:"always",inputKind:"any",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},hue=({schemaObject:e,baseField:t})=>({...t,type:"boolean",inputRequirement:"always",inputKind:"any",default:e.default??!1}),pue=({schemaObject:e,baseField:t})=>({...t,type:"model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),gue=({schemaObject:e,baseField:t})=>({...t,type:"refiner_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),mue=({schemaObject:e,baseField:t})=>({...t,type:"vae_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),yue=({schemaObject:e,baseField:t})=>({...t,type:"lora_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),vue=({schemaObject:e,baseField:t})=>({...t,type:"controlnet_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),bue=({schemaObject:e,baseField:t})=>({...t,type:"image",inputRequirement:"always",inputKind:"any",default:e.default??void 0}),_ue=({schemaObject:e,baseField:t})=>({...t,type:"image_collection",inputRequirement:"always",inputKind:"any",default:e.default??void 0}),Sue=({schemaObject:e,baseField:t})=>({...t,type:"latents",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),wue=({schemaObject:e,baseField:t})=>({...t,type:"conditioning",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),xue=({schemaObject:e,baseField:t})=>({...t,type:"unet",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Cue=({schemaObject:e,baseField:t})=>({...t,type:"clip",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Tue=({schemaObject:e,baseField:t})=>({...t,type:"vae",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Eue=({schemaObject:e,baseField:t})=>({...t,type:"control",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Pue=({schemaObject:e,baseField:t})=>{const n=e.enum??[];return{...t,type:"enum",enumType:e.type??"string",options:n,inputRequirement:"always",inputKind:"direct",default:e.default??n[0]}},WE=({baseField:e})=>({...e,type:"array",inputRequirement:"always",inputKind:"direct",default:[]}),KE=({baseField:e})=>({...e,type:"item",inputRequirement:"always",inputKind:"direct",default:void 0}),Aue=({schemaObject:e,baseField:t})=>({...t,type:"color",inputRequirement:"always",inputKind:"direct",default:e.default??{r:127,g:127,b:127,a:255}}),iN=(e,t,n)=>{let r="";n&&t in n?r=n[t]:e.type?e.enum?r="enum":e.type&&(r=e.type):e.allOf?r=Ub(e.allOf[0]):e.anyOf?r=Ub(e.anyOf[0]):e.oneOf&&(r=Ub(e.oneOf[0]));const i=lue[r];if(!i)throw`Field type "${r}" is unknown!`;return i},kue=(e,t,n)=>{const r=iN(e,t,n),i={name:t,title:e.title??"",description:e.description??""};if(["image"].includes(r))return bue({schemaObject:e,baseField:i});if(["image_collection"].includes(r))return _ue({schemaObject:e,baseField:i});if(["latents"].includes(r))return Sue({schemaObject:e,baseField:i});if(["conditioning"].includes(r))return wue({schemaObject:e,baseField:i});if(["unet"].includes(r))return xue({schemaObject:e,baseField:i});if(["clip"].includes(r))return Cue({schemaObject:e,baseField:i});if(["vae"].includes(r))return Tue({schemaObject:e,baseField:i});if(["control"].includes(r))return Eue({schemaObject:e,baseField:i});if(["model"].includes(r))return pue({schemaObject:e,baseField:i});if(["refiner_model"].includes(r))return gue({schemaObject:e,baseField:i});if(["vae_model"].includes(r))return mue({schemaObject:e,baseField:i});if(["lora_model"].includes(r))return yue({schemaObject:e,baseField:i});if(["controlnet_model"].includes(r))return vue({schemaObject:e,baseField:i});if(["enum"].includes(r))return Pue({schemaObject:e,baseField:i});if(["integer"].includes(r))return cue({schemaObject:e,baseField:i});if(["number","float"].includes(r))return due({schemaObject:e,baseField:i});if(["string"].includes(r))return fue({schemaObject:e,baseField:i});if(["boolean"].includes(r))return hue({schemaObject:e,baseField:i});if(["array"].includes(r))return WE({schemaObject:e,baseField:i});if(["item"].includes(r))return KE({schemaObject:e,baseField:i});if(["color"].includes(r))return Aue({schemaObject:e,baseField:i});if(["array"].includes(r))return WE({schemaObject:e,baseField:i});if(["item"].includes(r))return KE({schemaObject:e,baseField:i})},Oue=(e,t,n)=>{const r=e.$ref.split("/").slice(-1)[0],i=t.components.schemas[r];return p2(i)?$x(i.properties,(s,a,l)=>{if(!["type","id"].includes(l)&&!["object"].includes(a.type)&&p2(a)){const u=iN(a,l,n);s[l]={name:l,title:a.title??"",description:a.description??"",type:u}}return s},{}):{}},Rue=e=>e==="l2i"?["id","type","metadata"]:["id","type","is_intermediate","metadata"],Mue=["Graph","InvocationMeta","MetadataAccumulatorInvocation"],Iue=e=>{var r;return aR((r=e.components)==null?void 0:r.schemas,(i,o)=>o.includes("Invocation")&&!o.includes("InvocationOutput")&&!Mue.some(s=>o.includes(s))).reduce((i,o)=>{var s,a,l,u,c;if(aue(o)){const d=o.properties.type.default,f=Rue(d),h=((s=o.ui)==null?void 0:s.title)??o.title.replace("Invocation",""),p=(a=o.ui)==null?void 0:a.type_hints,m={};if(d==="collect"){const g=o.properties.item;m.item={type:"item",name:"item",description:g.description??"",title:"Collection Item",inputKind:"connection",inputRequirement:"always",default:void 0}}else if(d==="iterate"){const g=o.properties.collection;m.collection={type:"array",name:"collection",title:g.title??"",default:[],description:g.description??"",inputRequirement:"always",inputKind:"connection"}}else $x(o.properties,(g,b,S)=>{if(!f.includes(S)&&p2(b)){const w=kue(b,S,p);w&&(g[S]=w)}return g},m);const _=o.output;let y;if(d==="iterate"){const g=(u=(l=e.components)==null?void 0:l.schemas)==null?void 0:u.IterateInvocationOutput;y={item:{name:"item",title:(g==null?void 0:g.title)??"",description:(g==null?void 0:g.description)??"",type:"array"}}}else y=Oue(_,e,p);const v={title:h,type:d,tags:((c=o.ui)==null?void 0:c.tags)??[],description:o.description??"",inputs:m,outputs:y};Object.assign(i,{[d]:v})}return i},{})},Nue=()=>{le({actionCreator:Lf.fulfilled,effect:(e,{dispatch:t})=>{const n=fe("system"),r=e.payload;n.debug({schemaJSON:r},"Dereferenced OpenAPI schema");const i=Iue(r);n.debug({nodeTemplates:ia(i)},`Built ${gR(i)} node templates`),t(fC(i))}}),le({actionCreator:Lf.rejected,effect:()=>{fe("system").error("Problem dereferencing OpenAPI Schema")}})},Due=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),Lue=new Map(Due),$ue=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],g2=Symbol(".toJSON was called"),Fue=e=>{e[g2]=!0;const t=e.toJSON();return delete e[g2],t},Bue=e=>Lue.get(e)??Error,oN=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:i,depth:o,useToJSON:s,serialize:a})=>{if(!n)if(Array.isArray(e))n=[];else if(!a&&XE(e)){const u=Bue(e.name);n=new u}else n={};if(t.push(e),o>=i)return n;if(s&&typeof e.toJSON=="function"&&e[g2]!==!0)return Fue(e);const l=u=>oN({from:u,seen:[...t],forceEnumerable:r,maxDepth:i,depth:o,useToJSON:s,serialize:a});for(const[u,c]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(c)){n[u]="[object Buffer]";continue}if(c!==null&&typeof c=="object"&&typeof c.pipe=="function"){n[u]="[object Stream]";continue}if(typeof c!="function"){if(!c||typeof c!="object"){n[u]=c;continue}if(!t.includes(e[u])){o++,n[u]=l(e[u]);continue}n[u]="[Circular]"}}for(const{property:u,enumerable:c}of $ue)typeof e[u]<"u"&&e[u]!==null&&Object.defineProperty(n,u,{value:XE(e[u])?l(e[u]):e[u],enumerable:r?!0:c,configurable:!0,writable:!0});return n};function bC(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?oN({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name??"anonymous"}]`:e}function XE(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const jue=()=>{le({actionCreator:hl.pending,effect:()=>{}})},Vue=()=>{le({actionCreator:hl.fulfilled,effect:e=>{const t=fe("session"),{session_id:n}=e.meta.arg;t.debug({session_id:n},`Session canceled (${n})`)}})},zue=()=>{le({actionCreator:hl.rejected,effect:e=>{const t=fe("session"),{session_id:n}=e.meta.arg;if(e.payload){const{error:r}=e.payload;t.error({session_id:n,error:bC(r)},"Problem canceling session")}}})},Uue=()=>{le({actionCreator:kn.pending,effect:()=>{}})},Gue=()=>{le({actionCreator:kn.fulfilled,effect:e=>{const t=fe("session"),n=e.payload;t.debug({session:ia(n)},`Session created (${n.id})`)}})},Hue=()=>{le({actionCreator:kn.rejected,effect:e=>{const t=fe("session");if(e.payload){const{error:n,status:r}=e.payload,i=ia(e.meta.arg);t.error({graph:i,status:r,error:bC(n)},"Problem creating session")}}})},que=()=>{le({actionCreator:vh.pending,effect:()=>{}})},Wue=()=>{le({actionCreator:vh.fulfilled,effect:e=>{const t=fe("session"),{session_id:n}=e.meta.arg;t.debug({session_id:n},`Session invoked (${n})`)}})},Kue=()=>{le({actionCreator:vh.rejected,effect:e=>{const t=fe("session"),{session_id:n}=e.meta.arg;if(e.payload){const{error:r}=e.payload;t.error({session_id:n,error:bC(r)},"Problem invoking session")}}})},Xue=()=>{le({actionCreator:pl,effect:(e,{getState:t,dispatch:n})=>{const r=fe("session"),{sessionId:i}=t().system;i&&(r.debug({session_id:i},`Session ready to invoke (${i})})`),n(vh({session_id:i})))}})},Yue=()=>{le({actionCreator:i7,effect:(e,{dispatch:t,getState:n})=>{fe("socketio").debug("Connected");const{nodes:i,config:o}=n(),{disabledTabs:s}=o;!i.schema&&!s.includes("nodes")&&t(Lf()),t(o7(e.payload)),t(wo.util.invalidateTags([{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le},{type:"LoRAModel",id:Le},{type:"ControlNetModel",id:Le},{type:"VaeModel",id:Le},{type:"TextualInversionModel",id:Le},{type:"ScannedModels",id:Le}])),t(mC.util.invalidateTags(["AppConfig","AppVersion"]))}})},Que=()=>{le({actionCreator:s7,effect:(e,{dispatch:t})=>{fe("socketio").debug("Disconnected"),t(a7(e.payload))}})},Zue=()=>{le({actionCreator:y7,effect:(e,{dispatch:t,getState:n})=>{const r=fe("socketio");if(n().system.canceledSession===e.payload.data.graph_execution_state_id){r.trace(e.payload,"Ignored generator progress for canceled session");return}r.trace(e.payload,`Generator progress (${e.payload.data.node.type})`),t(v7(e.payload))}})},Jue=()=>{le({actionCreator:g7,effect:(e,{dispatch:t})=>{fe("socketio").debug(e.payload,"Session complete"),t(m7(e.payload))}})},ece=["dataURL_image"],tce=()=>{le({actionCreator:Ux,effect:async(e,{dispatch:t,getState:n})=>{const r=fe("socketio"),{data:i}=e.payload;r.debug({data:ia(i)},`Invocation complete (${e.payload.data.node.type})`);const o=e.payload.data.graph_execution_state_id,{cancelType:s,isCancelScheduled:a}=n().system;s==="scheduled"&&a&&t(hl({session_id:o}));const{result:l,node:u,graph_execution_state_id:c}=i;if(tN(l)&&!ece.includes(u.type)){const{image_name:d}=l.image,{canvas:f,gallery:h}=n(),p=await t(he.endpoints.getImageDTO.initiate(d)).unwrap();if(c===f.layerState.stagingArea.sessionId&&t(jQ(p)),!p.is_intermediate){const{autoAddBoardId:m}=h;t(m?he.endpoints.addImageToBoard.initiate({board_id:m,imageDTO:p}):he.util.updateQueryData("listImages",{board_id:"none",categories:pi},v=>{const g=v.total,S=Wn.addOne(v,p).total-g;v.total=v.total+S})),t(he.util.invalidateTags([{type:"BoardImagesTotal",id:m??"none"},{type:"BoardAssetsTotal",id:m??"none"}]));const{selectedBoardId:_,shouldAutoSwitch:y}=h;y&&(m&&m!==_?(t(GS(m)),t(Om("images"))):m||t(Om("images")),t(Os(p.image_name)))}t(_ae(null))}t(h7(e.payload))}})},nce=()=>{le({actionCreator:p7,effect:(e,{dispatch:t})=>{fe("socketio").error(e.payload,`Invocation error (${e.payload.data.node.type})`),t(Gx(e.payload))}})},rce=()=>{le({actionCreator:x7,effect:(e,{dispatch:t})=>{fe("socketio").error(e.payload,`Invocation retrieval error (${e.payload.data.graph_execution_state_id})`),t(C7(e.payload))}})},ice=()=>{le({actionCreator:d7,effect:(e,{dispatch:t,getState:n})=>{const r=fe("socketio");if(n().system.canceledSession===e.payload.data.graph_execution_state_id){r.trace(e.payload,"Ignored invocation started for canceled session");return}r.debug(e.payload,`Invocation started (${e.payload.data.node.type})`),t(f7(e.payload))}})},oce=()=>{le({actionCreator:b7,effect:(e,{dispatch:t})=>{const n=fe("socketio"),{base_model:r,model_name:i,model_type:o,submodel:s}=e.payload.data;let a=`Model load started: ${r}/${o}/${i}`;s&&(a=a.concat(`/${s}`)),n.debug(e.payload,a),t(tJ(e.payload))}}),le({actionCreator:_7,effect:(e,{dispatch:t})=>{const n=fe("socketio"),{base_model:r,model_name:i,model_type:o,submodel:s}=e.payload.data;let a=`Model load complete: ${r}/${o}/${i}`;s&&(a=a.concat(`/${s}`)),n.debug(e.payload,a),t(nJ(e.payload))}})},sce=()=>{le({actionCreator:S7,effect:(e,{dispatch:t})=>{fe("socketio").error(e.payload,`Session retrieval error (${e.payload.data.graph_execution_state_id})`),t(w7(e.payload))}})},ace=()=>{le({actionCreator:zx,effect:(e,{dispatch:t})=>{fe("socketio").debug(e.payload,"Subscribed"),t(l7(e.payload))}})},lce=()=>{le({actionCreator:u7,effect:(e,{dispatch:t})=>{fe("socketio").debug(e.payload,"Unsubscribed"),t(c7(e.payload))}})},uce=()=>{le({actionCreator:kle,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTO:r}=e.payload;try{const i=await t(he.endpoints.changeImageIsIntermediate.initiate({imageDTO:r,is_intermediate:!1})).unwrap(),{autoAddBoardId:o}=n().gallery;o&&await t(he.endpoints.addImageToBoard.initiate({imageDTO:i,board_id:o})),t(Ft({title:"Image Saved",status:"success"}))}catch(i){t(Ft({title:"Image Saving Failed",description:i==null?void 0:i.message,status:"error"}))}}})},n4e=["sd-1","sd-2","sdxl","sdxl-refiner"],cce=["sd-1","sd-2","sdxl"],r4e=["sdxl-refiner"],dce=()=>{le({actionCreator:IR,effect:(e,{getState:t,dispatch:n})=>{if(e.payload==="unifiedCanvas"){const{data:i}=wo.endpoints.getMainModels.select(cce)(t());if(!i){n(Va(null));return}const o=[];Za(i.entities,u=>{u&&["sd-1","sd-2"].includes(u.base_model)&&o.push(u)});const s=o[0];if(!s){n(Va(null));return}const{base_model:a,model_name:l}=s;n(Va({base_model:a,model_name:l}))}}})},Be="positive_conditioning",qe="negative_conditioning",cn="text_to_latents",nt="latents_to_image",pu="nsfw_checker",Zc="invisible_watermark",$e="noise",$i="rand_int",xo="range_of_size",ar="iterate",qs="main_model_loader",gl="onnx_model_loader",Jc="vae_loader",fce="lora_loader",rt="clip_skip",vt="image_to_latents",Wt="latents_to_latents",Yn="resize_image",Mi="inpaint",Mp="control_net_collect",Gb="dynamic_prompt",lt="metadata_accumulator",YE="esrgan",Jt="sdxl_model_loader",rs="t2l_sdxl",Ii="l2l_sdxl",Gl="sdxl_refiner_model_loader",Ip="sdxl_refiner_positive_conditioning",Np="sdxl_refiner_negative_conditioning",ya="l2l_sdxl_refiner",_C="text_to_image_graph",hce="sdxl_text_to_image_graph",pce="sxdl_image_to_image_graph",Qm="image_to_image_graph",sN="inpaint_graph",gce=({image_name:e,esrganModelName:t})=>{const n={id:YE,type:"esrgan",image:{image_name:e},model_name:t,is_intermediate:!1};return{id:"adhoc-esrgan-graph",nodes:{[YE]:n},edges:[]}},mce=ue("upscale/upscaleRequested"),yce=()=>{le({actionCreator:mce,effect:async(e,{dispatch:t,getState:n,take:r})=>{const{image_name:i}=e.payload,{esrganModelName:o}=n().postprocessing,s=gce({image_name:i,esrganModelName:o});t(kn({graph:s})),await r(kn.fulfilled.match),t(pl())}})},vce=e=>{const t=window.open("");t&&e.forEach(n=>{const r=new Image;r.src=n.base64,t.document.write(n.caption),t.document.write("
"),t.document.write(r.outerHTML),t.document.write("

")})},QE=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=i=>t(r.result),r.onerror=i=>n(r.error),r.onabort=i=>n(new Error("Read aborted")),r.readAsDataURL(e)});var SC={exports:{}},iv={},aN={},Pe={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._registerNode=e.Konva=e.glob=void 0;var t=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}e.glob=typeof Ee<"u"?Ee:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},e.Konva={_global:e.glob,version:"9.2.0",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return e.Konva.angleDeg?i*t:i},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return e.Konva.DD.isDragging},isDragReady(){return!!e.Konva.DD.node},releaseCanvasOnDestroy:!0,document:e.glob.document,_injectGlobal(i){e.glob.Konva=i}};const r=i=>{e.Konva[i.prototype.getClassName()]=i};e._registerNode=r,e.Konva._injectGlobal(e.Konva)})(Pe);var Ot={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=Pe;class n{constructor(b=[1,0,0,1,0,0]){this.dirty=!1,this.m=b&&b.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(b){b.m[0]=this.m[0],b.m[1]=this.m[1],b.m[2]=this.m[2],b.m[3]=this.m[3],b.m[4]=this.m[4],b.m[5]=this.m[5]}point(b){var S=this.m;return{x:S[0]*b.x+S[2]*b.y+S[4],y:S[1]*b.x+S[3]*b.y+S[5]}}translate(b,S){return this.m[4]+=this.m[0]*b+this.m[2]*S,this.m[5]+=this.m[1]*b+this.m[3]*S,this}scale(b,S){return this.m[0]*=b,this.m[1]*=b,this.m[2]*=S,this.m[3]*=S,this}rotate(b){var S=Math.cos(b),w=Math.sin(b),x=this.m[0]*S+this.m[2]*w,T=this.m[1]*S+this.m[3]*w,P=this.m[0]*-w+this.m[2]*S,E=this.m[1]*-w+this.m[3]*S;return this.m[0]=x,this.m[1]=T,this.m[2]=P,this.m[3]=E,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(b,S){var w=this.m[0]+this.m[2]*S,x=this.m[1]+this.m[3]*S,T=this.m[2]+this.m[0]*b,P=this.m[3]+this.m[1]*b;return this.m[0]=w,this.m[1]=x,this.m[2]=T,this.m[3]=P,this}multiply(b){var S=this.m[0]*b.m[0]+this.m[2]*b.m[1],w=this.m[1]*b.m[0]+this.m[3]*b.m[1],x=this.m[0]*b.m[2]+this.m[2]*b.m[3],T=this.m[1]*b.m[2]+this.m[3]*b.m[3],P=this.m[0]*b.m[4]+this.m[2]*b.m[5]+this.m[4],E=this.m[1]*b.m[4]+this.m[3]*b.m[5]+this.m[5];return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=T,this.m[4]=P,this.m[5]=E,this}invert(){var b=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),S=this.m[3]*b,w=-this.m[1]*b,x=-this.m[2]*b,T=this.m[0]*b,P=b*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),E=b*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=T,this.m[4]=P,this.m[5]=E,this}getMatrix(){return this.m}decompose(){var b=this.m[0],S=this.m[1],w=this.m[2],x=this.m[3],T=this.m[4],P=this.m[5],E=b*x-S*w;let A={x:T,y:P,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(b!=0||S!=0){var $=Math.sqrt(b*b+S*S);A.rotation=S>0?Math.acos(b/$):-Math.acos(b/$),A.scaleX=$,A.scaleY=E/$,A.skewX=(b*w+S*x)/E,A.skewY=0}else if(w!=0||x!=0){var M=Math.sqrt(w*w+x*x);A.rotation=Math.PI/2-(x>0?Math.acos(-w/M):-Math.acos(w/M)),A.scaleX=E/M,A.scaleY=M,A.skewX=0,A.skewY=(b*w+S*x)/E}return A.rotation=e.Util._getRotation(A.rotation),A}}e.Transform=n;var r="[object Array]",i="[object Number]",o="[object String]",s="[object Boolean]",a=Math.PI/180,l=180/Math.PI,u="#",c="",d="0",f="Konva warning: ",h="Konva error: ",p="rgb(",m={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},_=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,y=[];const v=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(g){setTimeout(g,60)};e.Util={_isElement(g){return!!(g&&g.nodeType==1)},_isFunction(g){return!!(g&&g.constructor&&g.call&&g.apply)},_isPlainObject(g){return!!g&&g.constructor===Object},_isArray(g){return Object.prototype.toString.call(g)===r},_isNumber(g){return Object.prototype.toString.call(g)===i&&!isNaN(g)&&isFinite(g)},_isString(g){return Object.prototype.toString.call(g)===o},_isBoolean(g){return Object.prototype.toString.call(g)===s},isObject(g){return g instanceof Object},isValidSelector(g){if(typeof g!="string")return!1;var b=g[0];return b==="#"||b==="."||b===b.toUpperCase()},_sign(g){return g===0||g>0?1:-1},requestAnimFrame(g){y.push(g),y.length===1&&v(function(){const b=y;y=[],b.forEach(function(S){S()})})},createCanvasElement(){var g=document.createElement("canvas");try{g.style=g.style||{}}catch{}return g},createImageElement(){return document.createElement("img")},_isInDocument(g){for(;g=g.parentNode;)if(g==document)return!0;return!1},_urlToImage(g,b){var S=e.Util.createImageElement();S.onload=function(){b(S)},S.src=g},_rgbToHex(g,b,S){return((1<<24)+(g<<16)+(b<<8)+S).toString(16).slice(1)},_hexToRgb(g){g=g.replace(u,c);var b=parseInt(g,16);return{r:b>>16&255,g:b>>8&255,b:b&255}},getRandomColor(){for(var g=(Math.random()*16777215<<0).toString(16);g.length<6;)g=d+g;return u+g},getRGB(g){var b;return g in m?(b=m[g],{r:b[0],g:b[1],b:b[2]}):g[0]===u?this._hexToRgb(g.substring(1)):g.substr(0,4)===p?(b=_.exec(g.replace(/ /g,"")),{r:parseInt(b[1],10),g:parseInt(b[2],10),b:parseInt(b[3],10)}):{r:0,g:0,b:0}},colorToRGBA(g){return g=g||"black",e.Util._namedColorToRBA(g)||e.Util._hex3ColorToRGBA(g)||e.Util._hex4ColorToRGBA(g)||e.Util._hex6ColorToRGBA(g)||e.Util._hex8ColorToRGBA(g)||e.Util._rgbColorToRGBA(g)||e.Util._rgbaColorToRGBA(g)||e.Util._hslColorToRGBA(g)},_namedColorToRBA(g){var b=m[g.toLowerCase()];return b?{r:b[0],g:b[1],b:b[2],a:1}:null},_rgbColorToRGBA(g){if(g.indexOf("rgb(")===0){g=g.match(/rgb\(([^)]+)\)/)[1];var b=g.split(/ *, */).map(Number);return{r:b[0],g:b[1],b:b[2],a:1}}},_rgbaColorToRGBA(g){if(g.indexOf("rgba(")===0){g=g.match(/rgba\(([^)]+)\)/)[1];var b=g.split(/ *, */).map((S,w)=>S.slice(-1)==="%"?w===3?parseInt(S)/100:parseInt(S)/100*255:Number(S));return{r:b[0],g:b[1],b:b[2],a:b[3]}}},_hex8ColorToRGBA(g){if(g[0]==="#"&&g.length===9)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:parseInt(g.slice(7,9),16)/255}},_hex6ColorToRGBA(g){if(g[0]==="#"&&g.length===7)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:1}},_hex4ColorToRGBA(g){if(g[0]==="#"&&g.length===5)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:parseInt(g[4]+g[4],16)/255}},_hex3ColorToRGBA(g){if(g[0]==="#"&&g.length===4)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:1}},_hslColorToRGBA(g){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(g)){const[b,...S]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(g),w=Number(S[0])/360,x=Number(S[1])/100,T=Number(S[2])/100;let P,E,A;if(x===0)return A=T*255,{r:Math.round(A),g:Math.round(A),b:Math.round(A),a:1};T<.5?P=T*(1+x):P=T+x-T*x;const $=2*T-P,M=[0,0,0];for(let C=0;C<3;C++)E=w+1/3*-(C-1),E<0&&E++,E>1&&E--,6*E<1?A=$+(P-$)*6*E:2*E<1?A=P:3*E<2?A=$+(P-$)*(2/3-E)*6:A=$,M[C]=A*255;return{r:Math.round(M[0]),g:Math.round(M[1]),b:Math.round(M[2]),a:1}}},haveIntersection(g,b){return!(b.x>g.x+g.width||b.x+b.widthg.y+g.height||b.y+b.height1?(P=S,E=w,A=(S-x)*(S-x)+(w-T)*(w-T)):(P=g+M*(S-g),E=b+M*(w-b),A=(P-x)*(P-x)+(E-T)*(E-T))}return[P,E,A]},_getProjectionToLine(g,b,S){var w=e.Util.cloneObject(g),x=Number.MAX_VALUE;return b.forEach(function(T,P){if(!(!S&&P===b.length-1)){var E=b[(P+1)%b.length],A=e.Util._getProjectionToSegment(T.x,T.y,E.x,E.y,g.x,g.y),$=A[0],M=A[1],C=A[2];Cb.length){var P=b;b=g,g=P}for(w=0;w{b.width=0,b.height=0})},drawRoundedRectPath(g,b,S,w){let x=0,T=0,P=0,E=0;typeof w=="number"?x=T=P=E=Math.min(w,b/2,S/2):(x=Math.min(w[0]||0,b/2,S/2),T=Math.min(w[1]||0,b/2,S/2),E=Math.min(w[2]||0,b/2,S/2),P=Math.min(w[3]||0,b/2,S/2)),g.moveTo(x,0),g.lineTo(b-T,0),g.arc(b-T,T,T,Math.PI*3/2,0,!1),g.lineTo(b,S-E),g.arc(b-E,S-E,E,0,Math.PI/2,!1),g.lineTo(P,S),g.arc(P,S-P,P,Math.PI/2,Math.PI,!1),g.lineTo(0,x),g.arc(x,x,x,Math.PI,Math.PI*3/2,!1)}}})(Ot);var St={},Te={},de={};Object.defineProperty(de,"__esModule",{value:!0});de.getComponentValidator=de.getBooleanValidator=de.getNumberArrayValidator=de.getFunctionValidator=de.getStringOrGradientValidator=de.getStringValidator=de.getNumberOrAutoValidator=de.getNumberOrArrayOfNumbersValidator=de.getNumberValidator=de.alphaComponent=de.RGBComponent=void 0;const Wo=Pe,It=Ot;function Ko(e){return It.Util._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||It.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}function bce(e){return e>255?255:e<0?0:Math.round(e)}de.RGBComponent=bce;function _ce(e){return e>1?1:e<1e-4?1e-4:e}de.alphaComponent=_ce;function Sce(){if(Wo.Konva.isUnminified)return function(e,t){return It.Util._isNumber(e)||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}de.getNumberValidator=Sce;function wce(e){if(Wo.Konva.isUnminified)return function(t,n){let r=It.Util._isNumber(t),i=It.Util._isArray(t)&&t.length==e;return!r&&!i&&It.Util.warn(Ko(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}de.getNumberOrArrayOfNumbersValidator=wce;function xce(){if(Wo.Konva.isUnminified)return function(e,t){var n=It.Util._isNumber(e),r=e==="auto";return n||r||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}de.getNumberOrAutoValidator=xce;function Cce(){if(Wo.Konva.isUnminified)return function(e,t){return It.Util._isString(e)||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}de.getStringValidator=Cce;function Tce(){if(Wo.Konva.isUnminified)return function(e,t){const n=It.Util._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}de.getStringOrGradientValidator=Tce;function Ece(){if(Wo.Konva.isUnminified)return function(e,t){return It.Util._isFunction(e)||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}}de.getFunctionValidator=Ece;function Pce(){if(Wo.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(It.Util._isArray(e)?e.forEach(function(r){It.Util._isNumber(r)||It.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}de.getNumberArrayValidator=Pce;function Ace(){if(Wo.Konva.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}de.getBooleanValidator=Ace;function kce(e){if(Wo.Konva.isUnminified)return function(t,n){return t==null||It.Util.isObject(t)||It.Util.warn(Ko(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}de.getComponentValidator=kce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=Ot,n=de;var r="get",i="set";e.Factory={addGetterSetter(o,s,a,l,u){e.Factory.addGetter(o,s,a),e.Factory.addSetter(o,s,l,u),e.Factory.addOverloadedGetterSetter(o,s)},addGetter(o,s,a){var l=r+t.Util._capitalize(s);o.prototype[l]=o.prototype[l]||function(){var u=this.attrs[s];return u===void 0?a:u}},addSetter(o,s,a,l){var u=i+t.Util._capitalize(s);o.prototype[u]||e.Factory.overWriteSetter(o,s,a,l)},overWriteSetter(o,s,a,l){var u=i+t.Util._capitalize(s);o.prototype[u]=function(c){return a&&c!==void 0&&c!==null&&(c=a.call(this,c,s)),this._setAttr(s,c),l&&l.call(this),this}},addComponentsGetterSetter(o,s,a,l,u){var c=a.length,d=t.Util._capitalize,f=r+d(s),h=i+d(s),p,m;o.prototype[f]=function(){var y={};for(p=0;p{this._setAttr(s+d(b),void 0)}),this._fireChangeEvent(s,v,y),u&&u.call(this),this},e.Factory.addOverloadedGetterSetter(o,s)},addOverloadedGetterSetter(o,s){var a=t.Util._capitalize(s),l=i+a,u=r+a;o.prototype[s]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,s,a,l){t.Util.error("Adding deprecated "+s);var u=r+t.Util._capitalize(s),c=s+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){t.Util.error(c);var d=this.attrs[s];return d===void 0?a:d},e.Factory.addSetter(o,s,l,function(){t.Util.error(c)}),e.Factory.addOverloadedGetterSetter(o,s)},backCompat(o,s){t.Util.each(s,function(a,l){var u=o.prototype[l],c=r+t.Util._capitalize(a),d=i+t.Util._capitalize(a);function f(){u.apply(this,arguments),t.Util.error('"'+a+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[a]=f,o.prototype[c]=f,o.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(Te);var _i={},Oo={};Object.defineProperty(Oo,"__esModule",{value:!0});Oo.HitContext=Oo.SceneContext=Oo.Context=void 0;const lN=Ot,Oce=Pe;function Rce(e){var t=[],n=e.length,r=lN.Util,i,o;for(i=0;itypeof c=="number"?Math.floor(c):c)),o+=Mce+u.join(ZE)+Ice)):(o+=a.property,t||(o+=Fce+a.val)),o+=Lce;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=jce&&n.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var n=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(t){const n=t.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(t){var n=t.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(t){const n=t.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(t,n){this._context[t]=n}arc(t,n,r,i,o,s){this._context.arc(t,n,r,i,o,s)}arcTo(t,n,r,i,o){this._context.arcTo(t,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(t,n,r,i,o,s){this._context.bezierCurveTo(t,n,r,i,o,s)}clearRect(t,n,r,i){this._context.clearRect(t,n,r,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,n){var r=arguments;if(r.length===2)return this._context.createImageData(t,n);if(r.length===1)return this._context.createImageData(t)}createLinearGradient(t,n,r,i){return this._context.createLinearGradient(t,n,r,i)}createPattern(t,n){return this._context.createPattern(t,n)}createRadialGradient(t,n,r,i,o,s){return this._context.createRadialGradient(t,n,r,i,o,s)}drawImage(t,n,r,i,o,s,a,l,u){var c=arguments,d=this._context;c.length===3?d.drawImage(t,n,r):c.length===5?d.drawImage(t,n,r,i,o):c.length===9&&d.drawImage(t,n,r,i,o,s,a,l,u)}ellipse(t,n,r,i,o,s,a,l){this._context.ellipse(t,n,r,i,o,s,a,l)}isPointInPath(t,n,r,i){return r?this._context.isPointInPath(r,t,n,i):this._context.isPointInPath(t,n,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,n,r,i){this._context.fillRect(t,n,r,i)}strokeRect(t,n,r,i){this._context.strokeRect(t,n,r,i)}fillText(t,n,r,i){i?this._context.fillText(t,n,r,i):this._context.fillText(t,n,r)}measureText(t){return this._context.measureText(t)}getImageData(t,n,r,i){return this._context.getImageData(t,n,r,i)}lineTo(t,n){this._context.lineTo(t,n)}moveTo(t,n){this._context.moveTo(t,n)}rect(t,n,r,i){this._context.rect(t,n,r,i)}putImageData(t,n,r){this._context.putImageData(t,n,r)}quadraticCurveTo(t,n,r,i){this._context.quadraticCurveTo(t,n,r,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,n){this._context.scale(t,n)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,n,r,i,o,s){this._context.setTransform(t,n,r,i,o,s)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,n,r,i){this._context.strokeText(t,n,r,i)}transform(t,n,r,i,o,s){this._context.transform(t,n,r,i,o,s)}translate(t,n){this._context.translate(t,n)}_enableTrace(){var t=this,n=JE.length,r=this.setAttr,i,o,s=function(a){var l=t[a],u;t[a]=function(){return o=Rce(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:a,args:o}),u}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){var r;return e.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];e.DD._dragElements.forEach((o,s)=>{const{node:a}=o,l=a.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(f=>f.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var c=a.dragDistance(),d=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(d{o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];e.DD._dragElements.forEach(o=>{const{node:s}=o,a=s.getStage();if(r&&a.setPointersPositions(r),!a._changedPointerPositions.find(c=>c.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(e.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof t.Konva.Stage&&o.node;u&&i.indexOf(u)===-1&&i.push(u)}),i.forEach(o=>{o.draw()})},_endDragAfter(r){e.DD._dragElements.forEach((i,o)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&e.DD._dragElements.delete(o)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1))})(av);Object.defineProperty(St,"__esModule",{value:!0});St.Node=void 0;const ke=Ot,kh=Te,Lp=_i,va=Pe,Fr=av,Vt=de;var Sg="absoluteOpacity",$p="allEventListeners",vo="absoluteTransform",e6="absoluteScale",ba="canvas",Kce="Change",Xce="children",Yce="konva",m2="listening",t6="mouseenter",n6="mouseleave",r6="set",i6="Shape",wg=" ",o6="stage",os="transform",Qce="Stage",y2="visible",Zce=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(wg);let Jce=1,_e=class v2{constructor(t){this._id=Jce++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===os||t===vo)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){var r=this._cache.get(t),i=t===os||t===vo,o=r===void 0||i&&r.dirty===!0;return o&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const i=n.map(o=>o+"Change.konva").join(wg);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(ba)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===vo&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(ba)){const{scene:t,filter:n,hit:r}=this._cache.get(ba);ke.Util.releaseCanvas(t,n,r),this._cache.delete(ba)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var n=t||{},r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var i=Math.ceil(n.width||r.width),o=Math.ceil(n.height||r.height),s=n.pixelRatio,a=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!i||!o){ke.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=u*2+1,o+=u*2+1,a-=u,l-=u;var f=new Lp.SceneCanvas({pixelRatio:s,width:i,height:o}),h=new Lp.SceneCanvas({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),p=new Lp.HitCanvas({pixelRatio:d,width:i,height:o}),m=f.getContext(),_=p.getContext();return p.isCache=!0,f.isCache=!0,this._cache.delete(ba),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),m.save(),_.save(),m.translate(-a,-l),_.translate(-a,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Sg),this._clearSelfAndDescendantCache(e6),this.drawScene(f,this),this.drawHit(p,this),this._isUnderCache=!1,m.restore(),_.restore(),c&&(m.save(),m.beginPath(),m.rect(0,0,i,o),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore()),this._cache.set(ba,{scene:f,filter:h,hit:p,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(ba)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){var r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],i,o,s,a,l=this.getAbsoluteTransform(n);return r.forEach(function(u){var c=l.point(u);i===void 0&&(i=s=c.x,o=a=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y)}),{x:i,y:o,width:s-i,height:a-o}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/i,r.height/i),t.restore()}_drawCachedHitCanvas(t){var n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,o=i.getContext(),s,a,l,u;if(t){if(!this._filterUpToDate){var c=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(s=t.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/c,r.getHeight()/c),a=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==Xce&&(r=r6+ke.Util._capitalize(n),ke.Util._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(m2,this._isListening)}_isListening(t){if(!this.listening())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isListening(t):!0}isVisible(){return this._getCache(y2,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);var r=this.getLayer(),i=!1;Fr.DD._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(i=!0)});var o=!n&&!va.Konva.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),n=this,r=0,i,o,s,a;function l(u){for(i=[],o=u.length,s=0;s0&&i[0].getDepth()<=t&&l(i)}return n.nodeType!==Qce&&l(n.getStage().getChildren()),r}getDepth(){for(var t=0,n=this.parent;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(os),this._clearSelfAndDescendantCache(vo)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var t=this.getStage().getPointerPosition();if(!t)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);var i=this.getAbsoluteTransform(t).getMatrix(),o=new ke.Transform,s=this.offset();return o.m=i.slice(),o.translate(s.x,s.y),o.getTranslation()}setAbsolutePosition(t){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(os);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(t.x,t.y),t={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:t.x,y:t.y}),this._clearCache(os),this._clearSelfAndDescendantCache(vo),this}_setTransform(t){var n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var n=t.x,r=t.y,i=this.x(),o=this.y();return n!==void 0&&(i+=n),r!==void 0&&(o+=r),this.setPosition({x:i,y:o}),this}_eachAncestorReverse(t,n){var r=[],i=this.getParent(),o,s;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(o=r.length,s=0;s0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return ke.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return ke.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&ke.Util.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Sg,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},n=this.getAttrs(),r,i,o,s,a;t.attrs={};for(r in n)i=n[r],a=ke.Util.isObject(i)&&!ke.Util._isPlainObject(i)&&!ke.Util._isArray(i),!a&&(o=typeof this[r]=="function"&&this[r],delete n[r],s=o?o.call(this):null,n[r]=i,s!==i&&(t.attrs[r]=i));return t.className=this.getClassName(),ke.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){var i=[];n&&this._isMatch(t)&&i.push(this);for(var o=this.parent;o;){if(o===r)return i;o._isMatch(t)&&i.push(o),o=o.parent}return i}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var n=t.replace(/ /g,"").split(","),r=n.length,i,o;for(i=0;i{try{const i=t==null?void 0:t.callback;i&&delete t.callback,ke.Util._urlToImage(this.toDataURL(t),function(o){n(o),i==null||i(o)})}catch(i){r(i)}})}toBlob(t){return new Promise((n,r)=>{try{const i=t==null?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob(o=>{n(o),i==null||i(o)})}catch(i){r(i)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():va.Konva.dragDistance}_off(t,n,r){var i=this.eventListeners[t],o,s,a;for(o=0;o=0;if(r&&!this.isDragging()){var i=!1;Fr.DD._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(i=!0)}),i||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const n=Fr.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Fr.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return ke.Util.haveIntersection(r,this.getClientRect())}static create(t,n){return ke.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=v2.prototype.getClassName.call(t),i=t.children,o,s,a;n&&(t.attrs.container=n),va.Konva[r]||(ke.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=va.Konva[r];if(o=new l(t.attrs),i)for(s=i.length,a=0;a0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(t,n){var r=[];return this._descendants(i=>{const o=i._isMatch(t);return o&&r.push(i),!!(o&&n)}),r}_descendants(t){let n=!1;const r=this.getChildren();for(const i of r){if(n=t(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(t),n))return!0}return!1}toObject(){var t=Hb.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(n=>{t.children.push(n.toObject())}),t}isAncestorOf(t){for(var n=t.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(t){var n=Hb.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(t){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(t)&&n.push(r)}),n}_clearSelfAndDescendantCache(t){var n;super._clearSelfAndDescendantCache(t),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas(),o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.scene,l=i&&i.isCache;if(!this.isVisible()&&!l)return this;if(a){o.save();var u=this.getAbsoluteTransform(n).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(t,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.hit;if(a){o.save();var l=this.getAbsoluteTransform(n).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(t,n,r){var i,o=n&&n.getContext(),s=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),u=s&&a||l;const c=r===this;if(u){o.save();var d=this.getAbsoluteTransform(r),f=d.getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[5]),o.beginPath();let _;if(l)_=l.call(this,o,this);else{var h=this.clipX(),p=this.clipY();o.rect(h,p,s,a)}o.clip.apply(o,_),f=d.copy().invert().getMatrix(),o.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var m=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";m&&(o.save(),o._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(_){_[t](n,r)}),m&&o.restore(),u&&o.restore()}getClientRect(t){var n;t=t||{};var r=t.skipTransform,i=t.relativeTo,o,s,a,l,u={x:1/0,y:1/0,width:0,height:0},c=this;(n=this.children)===null||n===void 0||n.forEach(function(m){if(m.visible()){var _=m.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});_.width===0&&_.height===0||(o===void 0?(o=_.x,s=_.y,a=_.x+_.width,l=_.y+_.height):(o=Math.min(o,_.x),s=Math.min(s,_.y),a=Math.max(a,_.x+_.width),l=Math.max(l,_.y+_.height)))}});for(var d=this.find("Shape"),f=!1,h=0;hY.indexOf("pointer")>=0?"pointer":Y.indexOf("touch")>=0?"touch":"mouse",U=Y=>{const B=j(Y);if(B==="pointer")return i.Konva.pointerEventsEnabled&&L.pointer;if(B==="touch")return L.touch;if(B==="mouse")return L.mouse};function G(Y={}){return(Y.clipFunc||Y.clipWidth||Y.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),Y}const W="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";e.stages=[];class X extends r.Container{constructor(B){super(G(B)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),e.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{G(this.attrs)}),this._checkVisibility()}_validateAdd(B){const H=B.getType()==="Layer",Q=B.getType()==="FastLayer";H||Q||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const B=this.visible()?"":"none";this.content.style.display=B}setContainer(B){if(typeof B===c){if(B.charAt(0)==="."){var H=B.slice(1);B=document.getElementsByClassName(H)[0]}else{var Q;B.charAt(0)!=="#"?Q=B:Q=B.slice(1),B=document.getElementById(Q)}if(!B)throw"Can not find container in document with id "+Q}return this._setAttr("container",B),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),B.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var B=this.children,H=B.length,Q;for(Q=0;Q-1&&e.stages.splice(H,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const B=this._pointerPositions[0]||this._changedPointerPositions[0];return B?{x:B.x,y:B.y}:(t.Util.warn(W),null)}_getPointerById(B){return this._pointerPositions.find(H=>H.id===B)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(B){B=B||{},B.x=B.x||0,B.y=B.y||0,B.width=B.width||this.width(),B.height=B.height||this.height();var H=new o.SceneCanvas({width:B.width,height:B.height,pixelRatio:B.pixelRatio||1}),Q=H.getContext()._context,J=this.children;return(B.x||B.y)&&Q.translate(-1*B.x,-1*B.y),J.forEach(function(ne){if(ne.isVisible()){var te=ne._toKonvaCanvas(B);Q.drawImage(te._canvas,B.x,B.y,te.getWidth()/te.getPixelRatio(),te.getHeight()/te.getPixelRatio())}}),H}getIntersection(B){if(!B)return null;var H=this.children,Q=H.length,J=Q-1,ne;for(ne=J;ne>=0;ne--){const te=H[ne].getIntersection(B);if(te)return te}return null}_resizeDOM(){var B=this.width(),H=this.height();this.content&&(this.content.style.width=B+d,this.content.style.height=H+d),this.bufferCanvas.setSize(B,H),this.bufferHitCanvas.setSize(B,H),this.children.forEach(Q=>{Q.setSize({width:B,height:H}),Q.draw()})}add(B,...H){if(arguments.length>1){for(var Q=0;QR&&t.Util.warn("The stage has "+J+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),B.setSize({width:this.width(),height:this.height()}),B.draw(),i.Konva.isBrowser&&this.content.appendChild(B.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(B){return l.hasPointerCapture(B,this)}setPointerCapture(B){l.setPointerCapture(B,this)}releaseCapture(B){l.releaseCapture(B,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&D.forEach(([B,H])=>{this.content.addEventListener(B,Q=>{this[H](Q)},{passive:!1})})}_pointerenter(B){this.setPointersPositions(B);const H=U(B.type);this._fire(H.pointerenter,{evt:B,target:this,currentTarget:this})}_pointerover(B){this.setPointersPositions(B);const H=U(B.type);this._fire(H.pointerover,{evt:B,target:this,currentTarget:this})}_getTargetShape(B){let H=this[B+"targetShape"];return H&&!H.getStage()&&(H=null),H}_pointerleave(B){const H=U(B.type),Q=j(B.type);if(H){this.setPointersPositions(B);var J=this._getTargetShape(Q),ne=!s.DD.isDragging||i.Konva.hitOnDragEnabled;J&&ne?(J._fireAndBubble(H.pointerout,{evt:B}),J._fireAndBubble(H.pointerleave,{evt:B}),this._fire(H.pointerleave,{evt:B,target:this,currentTarget:this}),this[Q+"targetShape"]=null):ne&&(this._fire(H.pointerleave,{evt:B,target:this,currentTarget:this}),this._fire(H.pointerout,{evt:B,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(B){const H=U(B.type),Q=j(B.type);if(H){this.setPointersPositions(B);var J=!1;this._changedPointerPositions.forEach(ne=>{var te=this.getIntersection(ne);if(s.DD.justDragged=!1,i.Konva["_"+Q+"ListenClick"]=!0,!(te&&te.isListening()))return;i.Konva.capturePointerEventsEnabled&&te.setPointerCapture(ne.id),this[Q+"ClickStartShape"]=te,te._fireAndBubble(H.pointerdown,{evt:B,pointerId:ne.id}),J=!0;const ve=B.type.indexOf("touch")>=0;te.preventDefault()&&B.cancelable&&ve&&B.preventDefault()}),J||this._fire(H.pointerdown,{evt:B,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(B){const H=U(B.type),Q=j(B.type);if(!H)return;s.DD.isDragging&&s.DD.node.preventDefault()&&B.cancelable&&B.preventDefault(),this.setPointersPositions(B);var J=!s.DD.isDragging||i.Konva.hitOnDragEnabled;if(!J)return;var ne={};let te=!1;var xe=this._getTargetShape(Q);this._changedPointerPositions.forEach(ve=>{const ce=l.getCapturedShape(ve.id)||this.getIntersection(ve),Ne=ve.id,se={evt:B,pointerId:Ne};var pt=xe!==ce;if(pt&&xe&&(xe._fireAndBubble(H.pointerout,Object.assign({},se),ce),xe._fireAndBubble(H.pointerleave,Object.assign({},se),ce)),ce){if(ne[ce._id])return;ne[ce._id]=!0}ce&&ce.isListening()?(te=!0,pt&&(ce._fireAndBubble(H.pointerover,Object.assign({},se),xe),ce._fireAndBubble(H.pointerenter,Object.assign({},se),xe),this[Q+"targetShape"]=ce),ce._fireAndBubble(H.pointermove,Object.assign({},se))):xe&&(this._fire(H.pointerover,{evt:B,target:this,currentTarget:this,pointerId:Ne}),this[Q+"targetShape"]=null)}),te||this._fire(H.pointermove,{evt:B,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(B){const H=U(B.type),Q=j(B.type);if(!H)return;this.setPointersPositions(B);const J=this[Q+"ClickStartShape"],ne=this[Q+"ClickEndShape"];var te={};let xe=!1;this._changedPointerPositions.forEach(ve=>{const ce=l.getCapturedShape(ve.id)||this.getIntersection(ve);if(ce){if(ce.releaseCapture(ve.id),te[ce._id])return;te[ce._id]=!0}const Ne=ve.id,se={evt:B,pointerId:Ne};let pt=!1;i.Konva["_"+Q+"InDblClickWindow"]?(pt=!0,clearTimeout(this[Q+"DblTimeout"])):s.DD.justDragged||(i.Konva["_"+Q+"InDblClickWindow"]=!0,clearTimeout(this[Q+"DblTimeout"])),this[Q+"DblTimeout"]=setTimeout(function(){i.Konva["_"+Q+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),ce&&ce.isListening()?(xe=!0,this[Q+"ClickEndShape"]=ce,ce._fireAndBubble(H.pointerup,Object.assign({},se)),i.Konva["_"+Q+"ListenClick"]&&J&&J===ce&&(ce._fireAndBubble(H.pointerclick,Object.assign({},se)),pt&&ne&&ne===ce&&ce._fireAndBubble(H.pointerdblclick,Object.assign({},se)))):(this[Q+"ClickEndShape"]=null,i.Konva["_"+Q+"ListenClick"]&&this._fire(H.pointerclick,{evt:B,target:this,currentTarget:this,pointerId:Ne}),pt&&this._fire(H.pointerdblclick,{evt:B,target:this,currentTarget:this,pointerId:Ne}))}),xe||this._fire(H.pointerup,{evt:B,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+Q+"ListenClick"]=!1,B.cancelable&&Q!=="touch"&&B.preventDefault()}_contextmenu(B){this.setPointersPositions(B);var H=this.getIntersection(this.getPointerPosition());H&&H.isListening()?H._fireAndBubble($,{evt:B}):this._fire($,{evt:B,target:this,currentTarget:this})}_wheel(B){this.setPointersPositions(B);var H=this.getIntersection(this.getPointerPosition());H&&H.isListening()?H._fireAndBubble(N,{evt:B}):this._fire(N,{evt:B,target:this,currentTarget:this})}_pointercancel(B){this.setPointersPositions(B);const H=l.getCapturedShape(B.pointerId)||this.getIntersection(this.getPointerPosition());H&&H._fireAndBubble(S,l.createEvent(B)),l.releaseCapture(B.pointerId)}_lostpointercapture(B){l.releaseCapture(B.pointerId)}setPointersPositions(B){var H=this._getContentPosition(),Q=null,J=null;B=B||window.event,B.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(B.touches,ne=>{this._pointerPositions.push({id:ne.identifier,x:(ne.clientX-H.left)/H.scaleX,y:(ne.clientY-H.top)/H.scaleY})}),Array.prototype.forEach.call(B.changedTouches||B.touches,ne=>{this._changedPointerPositions.push({id:ne.identifier,x:(ne.clientX-H.left)/H.scaleX,y:(ne.clientY-H.top)/H.scaleY})})):(Q=(B.clientX-H.left)/H.scaleX,J=(B.clientY-H.top)/H.scaleY,this.pointerPos={x:Q,y:J},this._pointerPositions=[{x:Q,y:J,id:t.Util._getFirstPointerId(B)}],this._changedPointerPositions=[{x:Q,y:J,id:t.Util._getFirstPointerId(B)}])}_setPointerPosition(B){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(B)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var B=this.content.getBoundingClientRect();return{top:B.top,left:B.left,scaleX:B.width/this.content.clientWidth||1,scaleY:B.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!i.Konva.isBrowser){var B=this.container();if(!B)throw"Stage has no container. A container is required.";B.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),B.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(B){B.batchDraw()}),this}}e.Stage=X,X.prototype.nodeType=u,(0,a._registerNode)(X),n.Factory.addGetterSetter(X,"container")})(dN);var Oh={},on={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=Pe,n=Ot,r=Te,i=St,o=de,s=Pe,a=Cr;var l="hasShadow",u="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let h;function p(){return h||(h=n.Util.createCanvasElement().getContext("2d"),h)}e.shapes={};function m(P){const E=this.attrs.fillRule;E?P.fill(E):P.fill()}function _(P){P.stroke()}function y(P){P.fill()}function v(P){P.stroke()}function g(){this._clearCache(l)}function b(){this._clearCache(u)}function S(){this._clearCache(c)}function w(){this._clearCache(d)}function x(){this._clearCache(f)}class T extends i.Node{constructor(E){super(E);let A;for(;A=n.Util.getRandomColor(),!(A&&!(A in e.shapes)););this.colorKey=A,e.shapes[A]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var E=p();const A=E.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(A&&A.setTransform){const $=new n.Transform;$.translate(this.fillPatternX(),this.fillPatternY()),$.rotate(t.Konva.getAngle(this.fillPatternRotation())),$.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),$.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const M=$.getMatrix(),C=typeof DOMMatrix>"u"?{a:M[0],b:M[1],c:M[2],d:M[3],e:M[4],f:M[5]}:new DOMMatrix(M);A.setTransform(C)}return A}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var E=this.fillLinearGradientColorStops();if(E){for(var A=p(),$=this.fillLinearGradientStartPoint(),M=this.fillLinearGradientEndPoint(),C=A.createLinearGradient($.x,$.y,M.x,M.y),O=0;Othis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const E=this.hitStrokeWidth();return E==="auto"?this.hasStroke():this.strokeEnabled()&&!!E}intersects(E){var A=this.getStage(),$=A.bufferHitCanvas,M;return $.getContext().clear(),this.drawHit($,null,!0),M=$.context.getImageData(Math.round(E.x),Math.round(E.y),1,1).data,M[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(E){var A;if(!this.getStage()||!((A=this.attrs.perfectDrawEnabled)!==null&&A!==void 0?A:!0))return!1;const M=E||this.hasFill(),C=this.hasStroke(),O=this.getAbsoluteOpacity()!==1;if(M&&C&&O)return!0;const I=this.hasShadow(),N=this.shadowForStrokeEnabled();return!!(M&&C&&I&&N)}setStrokeHitEnabled(E){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),E?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var E=this.size();return{x:this._centroid?-E.width/2:0,y:this._centroid?-E.height/2:0,width:E.width,height:E.height}}getClientRect(E={}){const A=E.skipTransform,$=E.relativeTo,M=this.getSelfRect(),O=!E.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,I=M.width+O,N=M.height+O,R=!E.skipShadow&&this.hasShadow(),D=R?this.shadowOffsetX():0,L=R?this.shadowOffsetY():0,j=I+Math.abs(D),U=N+Math.abs(L),G=R&&this.shadowBlur()||0,W=j+G*2,X=U+G*2,Y={width:W,height:X,x:-(O/2+G)+Math.min(D,0)+M.x,y:-(O/2+G)+Math.min(L,0)+M.y};return A?Y:this._transformedRect(Y,$)}drawScene(E,A){var $=this.getLayer(),M=E||$.getCanvas(),C=M.getContext(),O=this._getCanvasCache(),I=this.getSceneFunc(),N=this.hasShadow(),R,D,L,j=M.isCache,U=A===this;if(!this.isVisible()&&!U)return this;if(O){C.save();var G=this.getAbsoluteTransform(A).getMatrix();return C.transform(G[0],G[1],G[2],G[3],G[4],G[5]),this._drawCachedSceneCanvas(C),C.restore(),this}if(!I)return this;if(C.save(),this._useBufferCanvas()&&!j){R=this.getStage(),D=R.bufferCanvas,L=D.getContext(),L.clear(),L.save(),L._applyLineJoin(this);var W=this.getAbsoluteTransform(A).getMatrix();L.transform(W[0],W[1],W[2],W[3],W[4],W[5]),I.call(this,L,this),L.restore();var X=D.pixelRatio;N&&C._applyShadow(this),C._applyOpacity(this),C._applyGlobalCompositeOperation(this),C.drawImage(D._canvas,0,0,D.width/X,D.height/X)}else{if(C._applyLineJoin(this),!U){var W=this.getAbsoluteTransform(A).getMatrix();C.transform(W[0],W[1],W[2],W[3],W[4],W[5]),C._applyOpacity(this),C._applyGlobalCompositeOperation(this)}N&&C._applyShadow(this),I.call(this,C,this)}return C.restore(),this}drawHit(E,A,$=!1){if(!this.shouldDrawHit(A,$))return this;var M=this.getLayer(),C=E||M.hitCanvas,O=C&&C.getContext(),I=this.hitFunc()||this.sceneFunc(),N=this._getCanvasCache(),R=N&&N.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),R){O.save();var D=this.getAbsoluteTransform(A).getMatrix();return O.transform(D[0],D[1],D[2],D[3],D[4],D[5]),this._drawCachedHitCanvas(O),O.restore(),this}if(!I)return this;if(O.save(),O._applyLineJoin(this),!(this===A)){var j=this.getAbsoluteTransform(A).getMatrix();O.transform(j[0],j[1],j[2],j[3],j[4],j[5])}return I.call(this,O,this),O.restore(),this}drawHitFromCache(E=0){var A=this._getCanvasCache(),$=this._getCachedSceneCanvas(),M=A.hit,C=M.getContext(),O=M.getWidth(),I=M.getHeight(),N,R,D,L,j,U;C.clear(),C.drawImage($._canvas,0,0,O,I);try{for(N=C.getImageData(0,0,O,I),R=N.data,D=R.length,L=n.Util._hexToRgb(this.colorKey),j=0;jE?(R[j]=L.r,R[j+1]=L.g,R[j+2]=L.b,R[j+3]=255):R[j+3]=0;C.putImageData(N,0,0)}catch(G){n.Util.error("Unable to draw hit graph from cached scene canvas. "+G.message)}return this}hasPointerCapture(E){return a.hasPointerCapture(E,this)}setPointerCapture(E){a.setPointerCapture(E,this)}releaseCapture(E){a.releaseCapture(E,this)}}e.Shape=T,T.prototype._fillFunc=m,T.prototype._strokeFunc=_,T.prototype._fillFuncHit=y,T.prototype._strokeFuncHit=v,T.prototype._centroid=!1,T.prototype.nodeType="Shape",(0,s._registerNode)(T),T.prototype.eventListeners={},T.prototype.on.call(T.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",g),T.prototype.on.call(T.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",b),T.prototype.on.call(T.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",S),T.prototype.on.call(T.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",w),T.prototype.on.call(T.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",x),r.Factory.addGetterSetter(T,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(T,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(T,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(T,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(T,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(T,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(T,"lineJoin"),r.Factory.addGetterSetter(T,"lineCap"),r.Factory.addGetterSetter(T,"sceneFunc"),r.Factory.addGetterSetter(T,"hitFunc"),r.Factory.addGetterSetter(T,"dash"),r.Factory.addGetterSetter(T,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(T,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(T,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(T,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillPatternImage"),r.Factory.addGetterSetter(T,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(T,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(T,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(T,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(T,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(T,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(T,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(T,"fillEnabled",!0),r.Factory.addGetterSetter(T,"strokeEnabled",!0),r.Factory.addGetterSetter(T,"shadowEnabled",!0),r.Factory.addGetterSetter(T,"dashEnabled",!0),r.Factory.addGetterSetter(T,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(T,"fillPriority","color"),r.Factory.addComponentsGetterSetter(T,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(T,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(T,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(T,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(T,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(T,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(T,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(T,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(T,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(T,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(T,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(T,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(T,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(T,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(T,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(T,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(T,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(T,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(T,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(T,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(T,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(T,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(T,"fillPatternRotation",0),r.Factory.addGetterSetter(T,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(T,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(on);Object.defineProperty(Oh,"__esModule",{value:!0});Oh.Layer=void 0;const po=Ot,qb=ml,Hl=St,xC=Te,s6=_i,ide=de,ode=on,sde=Pe;var ade="#",lde="beforeDraw",ude="draw",pN=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],cde=pN.length;class _c extends qb.Container{constructor(t){super(t),this.canvas=new s6.SceneCanvas,this.hitCanvas=new s6.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),t{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas();return this._fire(lde,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),qb.Container.prototype.drawScene.call(this,i,n),this._fire(ude,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),qb.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){po.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return po.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return po.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Oh.Layer=_c;_c.prototype.nodeType="Layer";(0,sde._registerNode)(_c);xC.Factory.addGetterSetter(_c,"imageSmoothingEnabled",!0);xC.Factory.addGetterSetter(_c,"clearBeforeDraw",!0);xC.Factory.addGetterSetter(_c,"hitGraphEnabled",!0,(0,ide.getBooleanValidator)());var uv={};Object.defineProperty(uv,"__esModule",{value:!0});uv.FastLayer=void 0;const dde=Ot,fde=Oh,hde=Pe;class CC extends fde.Layer{constructor(t){super(t),this.listening(!1),dde.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}uv.FastLayer=CC;CC.prototype.nodeType="FastLayer";(0,hde._registerNode)(CC);var Sc={};Object.defineProperty(Sc,"__esModule",{value:!0});Sc.Group=void 0;const pde=Ot,gde=ml,mde=Pe;class TC extends gde.Container{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&pde.Util.throw("You may only add groups and shapes to groups.")}}Sc.Group=TC;TC.prototype.nodeType="Group";(0,mde._registerNode)(TC);var wc={};Object.defineProperty(wc,"__esModule",{value:!0});wc.Animation=void 0;const Wb=Pe,a6=Ot;var Kb=function(){return Wb.glob.performance&&Wb.glob.performance.now?function(){return Wb.glob.performance.now()}:function(){return new Date().getTime()}}();class Ui{constructor(t,n){this.id=Ui.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Kb(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){var n=[];return t?t.length>0?n=t:n=[t]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(t){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():p<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=p,this.update())}getTime(){return this._time}setPosition(p){this.prevPos=this._pos,this.propFunc(p),this._pos=p}getPosition(p){return p===void 0&&(p=this._time),this.func(p,this.begin,this._change,this.duration)}play(){this.state=a,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(p){this.pause(),this._time=p,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var p=this.getTimer()-this._startTime;this.state===a?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=s,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){var m=this,_=p.node,y=_._id,v,g=p.easing||e.Easings.Linear,b=!!p.yoyo,S;typeof p.duration>"u"?v=.3:p.duration===0?v=.001:v=p.duration,this.node=_,this._id=u++;var w=_.getLayer()||(_ instanceof i.Konva.Stage?_.getLayers():null);w||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){m.tween.onEnterFrame()},w),this.tween=new d(S,function(x){m._tweenFunc(x)},g,0,1,v*1e3,b),this._addListeners(),f.attrs[y]||(f.attrs[y]={}),f.attrs[y][this._id]||(f.attrs[y][this._id]={}),f.tweens[y]||(f.tweens[y]={});for(S in p)o[S]===void 0&&this._addAttr(S,p[S]);this.reset(),this.onFinish=p.onFinish,this.onReset=p.onReset,this.onUpdate=p.onUpdate}_addAttr(p,m){var _=this.node,y=_._id,v,g,b,S,w,x,T,P;if(b=f.tweens[y][p],b&&delete f.attrs[y][b][p],v=_.getAttr(p),t.Util._isArray(m))if(g=[],w=Math.max(m.length,v.length),p==="points"&&m.length!==v.length&&(m.length>v.length?(T=v,v=t.Util._prepareArrayForTween(v,m,_.closed())):(x=m,m=t.Util._prepareArrayForTween(m,v,_.closed()))),p.indexOf("fill")===0)for(S=0;S{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueEnd&&p.setAttr("points",m.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueStart&&p.points(m.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(p){return this.tween.seek(p*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var p=this.node._id,m=this._id,_=f.tweens[p],y;this.pause();for(y in _)delete f.tweens[p][y];delete f.attrs[p][m]}}e.Tween=f,f.attrs={},f.tweens={},r.Node.prototype.to=function(h){var p=h.onFinish;h.node=this,h.onFinish=function(){this.destroy(),p&&p()};var m=new f(h);m.play()},e.Easings={BackEaseIn(h,p,m,_){var y=1.70158;return m*(h/=_)*h*((y+1)*h-y)+p},BackEaseOut(h,p,m,_){var y=1.70158;return m*((h=h/_-1)*h*((y+1)*h+y)+1)+p},BackEaseInOut(h,p,m,_){var y=1.70158;return(h/=_/2)<1?m/2*(h*h*(((y*=1.525)+1)*h-y))+p:m/2*((h-=2)*h*(((y*=1.525)+1)*h+y)+2)+p},ElasticEaseIn(h,p,m,_,y,v){var g=0;return h===0?p:(h/=_)===1?p+m:(v||(v=_*.3),!y||y0?t:n),c=s*n,d=a*(a>0?t:n),f=l*(l>0?n:t);return{x:u,y:r?-1*f:d,width:c-u,height:f-d}}}cv.Arc=Xo;Xo.prototype._centroid=!0;Xo.prototype.className="Arc";Xo.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,vde._registerNode)(Xo);dv.Factory.addGetterSetter(Xo,"innerRadius",0,(0,fv.getNumberValidator)());dv.Factory.addGetterSetter(Xo,"outerRadius",0,(0,fv.getNumberValidator)());dv.Factory.addGetterSetter(Xo,"angle",0,(0,fv.getNumberValidator)());dv.Factory.addGetterSetter(Xo,"clockwise",!1,(0,fv.getBooleanValidator)());var hv={},Rh={};Object.defineProperty(Rh,"__esModule",{value:!0});Rh.Line=void 0;const pv=Te,bde=on,mN=de,_de=Pe;function b2(e,t,n,r,i,o,s){var a=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),u=s*a/(a+l),c=s*l/(a+l),d=n-u*(i-e),f=r-u*(o-t),h=n+c*(i-e),p=r+c*(o-t);return[d,f,h,p]}function u6(e,t){var n=e.length,r=[],i,o;for(i=2;i4){for(a=this.getTensionPoints(),l=a.length,u=o?0:4,o||t.quadraticCurveTo(a[0],a[1],a[2],a[3]);u{let u,c,d;u=l/2,c=0;for(let h=0;h<20;h++)d=u*e.tValues[20][h]+u,c+=e.cValues[20][h]*r(s,a,d);return u*c};e.getCubicArcLength=t;const n=(s,a,l)=>{l===void 0&&(l=1);const u=s[0]-2*s[1]+s[2],c=a[0]-2*a[1]+a[2],d=2*s[1]-2*s[0],f=2*a[1]-2*a[0],h=4*(u*u+c*c),p=4*(u*d+c*f),m=d*d+f*f;if(h===0)return l*Math.sqrt(Math.pow(s[2]-s[0],2)+Math.pow(a[2]-a[0],2));const _=p/(2*h),y=m/h,v=l+_,g=y-_*_,b=v*v+g>0?Math.sqrt(v*v+g):0,S=_*_+g>0?Math.sqrt(_*_+g):0,w=_+Math.sqrt(_*_+g)!==0?g*Math.log(Math.abs((v+b)/(_+S))):0;return Math.sqrt(h)/2*(v*b-_*S+w)};e.getQuadraticArcLength=n;function r(s,a,l){const u=i(1,l,s),c=i(1,l,a),d=u*u+c*c;return Math.sqrt(d)}const i=(s,a,l)=>{const u=l.length-1;let c,d;if(u===0)return 0;if(s===0){d=0;for(let f=0;f<=u;f++)d+=e.binomialCoefficients[u][f]*Math.pow(1-a,u-f)*Math.pow(a,f)*l[f];return d}else{c=new Array(u);for(let f=0;f{let u=1,c=s/a,d=(s-l(c))/a,f=0;for(;u>.001;){const h=l(c+d),p=Math.abs(s-h)/a;if(p500)break}return c};e.t2length=o})(yN);Object.defineProperty(xc,"__esModule",{value:!0});xc.Path=void 0;const Sde=Te,wde=on,xde=Pe,ql=yN;class Zt extends wde.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Zt.parsePathData(this.data()),this.pathLength=Zt.getPathLength(this.dataArray)}_sceneFunc(t){var n=this.dataArray;t.beginPath();for(var r=!1,i=0;ic?u:c,_=u>c?1:u/c,y=u>c?c/u:1;t.translate(a,l),t.rotate(h),t.scale(_,y),t.arc(0,0,m,d,d+f,1-p),t.scale(1/_,1/y),t.rotate(-h),t.translate(-a,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(u){if(u.command==="A"){var c=u.points[4],d=u.points[5],f=u.points[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;p-=h){const m=Zt.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],p,0);t.push(m.x,m.y)}else for(let p=c+h;pn[i].pathLength;)t-=n[i].pathLength,++i;if(i===o)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return r=n[i].points.slice(0,2),{x:r[0],y:r[1]};var s=n[i],a=s.points;switch(s.command){case"L":return Zt.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return Zt.getPointOnCubicBezier((0,ql.t2length)(t,Zt.getPathLength(n),m=>(0,ql.getCubicArcLength)([s.start.x,a[0],a[2],a[4]],[s.start.y,a[1],a[3],a[5]],m)),s.start.x,s.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return Zt.getPointOnQuadraticBezier((0,ql.t2length)(t,Zt.getPathLength(n),m=>(0,ql.getQuadraticArcLength)([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],m)),s.start.x,s.start.y,a[0],a[1],a[2],a[3]);case"A":var l=a[0],u=a[1],c=a[2],d=a[3],f=a[4],h=a[5],p=a[6];return f+=h*t/s.pathLength,Zt.getPointOnEllipticalArc(l,u,c,d,f,p)}return null}static getPointOnLine(t,n,r,i,o,s,a){s===void 0&&(s=n),a===void 0&&(a=r);var l=(o-r)/(i-n+1e-8),u=Math.sqrt(t*t/(1+l*l));i0&&!isNaN(p[0]);){var v=null,g=[],b=l,S=u,w,x,T,P,E,A,$,M,C,O;switch(h){case"l":l+=p.shift(),u+=p.shift(),v="L",g.push(l,u);break;case"L":l=p.shift(),u=p.shift(),g.push(l,u);break;case"m":var I=p.shift(),N=p.shift();if(l+=I,u+=N,v="M",s.length>2&&s[s.length-1].command==="z"){for(var R=s.length-2;R>=0;R--)if(s[R].command==="M"){l=s[R].points[0]+I,u=s[R].points[1]+N;break}}g.push(l,u),h="l";break;case"M":l=p.shift(),u=p.shift(),v="M",g.push(l,u),h="L";break;case"h":l+=p.shift(),v="L",g.push(l,u);break;case"H":l=p.shift(),v="L",g.push(l,u);break;case"v":u+=p.shift(),v="L",g.push(l,u);break;case"V":u=p.shift(),v="L",g.push(l,u);break;case"C":g.push(p.shift(),p.shift(),p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"c":g.push(l+p.shift(),u+p.shift(),l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="C",g.push(l,u);break;case"S":x=l,T=u,w=s[s.length-1],w.command==="C"&&(x=l+(l-w.points[2]),T=u+(u-w.points[3])),g.push(x,T,p.shift(),p.shift()),l=p.shift(),u=p.shift(),v="C",g.push(l,u);break;case"s":x=l,T=u,w=s[s.length-1],w.command==="C"&&(x=l+(l-w.points[2]),T=u+(u-w.points[3])),g.push(x,T,l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="C",g.push(l,u);break;case"Q":g.push(p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"q":g.push(l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="Q",g.push(l,u);break;case"T":x=l,T=u,w=s[s.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),T=u+(u-w.points[1])),l=p.shift(),u=p.shift(),v="Q",g.push(x,T,l,u);break;case"t":x=l,T=u,w=s[s.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),T=u+(u-w.points[1])),l+=p.shift(),u+=p.shift(),v="Q",g.push(x,T,l,u);break;case"A":P=p.shift(),E=p.shift(),A=p.shift(),$=p.shift(),M=p.shift(),C=l,O=u,l=p.shift(),u=p.shift(),v="A",g=this.convertEndpointToCenterParameterization(C,O,l,u,$,M,P,E,A);break;case"a":P=p.shift(),E=p.shift(),A=p.shift(),$=p.shift(),M=p.shift(),C=l,O=u,l+=p.shift(),u+=p.shift(),v="A",g=this.convertEndpointToCenterParameterization(C,O,l,u,$,M,P,E,A);break}s.push({command:v||h,points:g,start:{x:b,y:S},pathLength:this.calcLength(b,S,v||h,g)})}(h==="z"||h==="Z")&&s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(t,n,r,i){var o,s,a,l,u=Zt;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":return(0,ql.getCubicArcLength)([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,ql.getQuadraticArcLength)([t,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;var c=i[4],d=i[5],f=i[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;l-=h)a=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=c+h;l1&&(a*=Math.sqrt(h),l*=Math.sqrt(h));var p=Math.sqrt((a*a*(l*l)-a*a*(f*f)-l*l*(d*d))/(a*a*(f*f)+l*l*(d*d)));o===s&&(p*=-1),isNaN(p)&&(p=0);var m=p*a*f/l,_=p*-l*d/a,y=(t+r)/2+Math.cos(c)*m-Math.sin(c)*_,v=(n+i)/2+Math.sin(c)*m+Math.cos(c)*_,g=function(E){return Math.sqrt(E[0]*E[0]+E[1]*E[1])},b=function(E,A){return(E[0]*A[0]+E[1]*A[1])/(g(E)*g(A))},S=function(E,A){return(E[0]*A[1]=1&&(P=0),s===0&&P>0&&(P=P-2*Math.PI),s===1&&P<0&&(P=P+2*Math.PI),[y,v,a,l,w,P,c,s]}}xc.Path=Zt;Zt.prototype.className="Path";Zt.prototype._attrsAffectingSize=["data"];(0,xde._registerNode)(Zt);Sde.Factory.addGetterSetter(Zt,"data");Object.defineProperty(hv,"__esModule",{value:!0});hv.Arrow=void 0;const gv=Te,Cde=Rh,vN=de,Tde=Pe,c6=xc;class vl extends Cde.Line{_sceneFunc(t){super._sceneFunc(t);var n=Math.PI*2,r=this.points(),i=r,o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());var s=this.pointerLength(),a=r.length,l,u;if(o){const f=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[a-2],r[a-1]],h=c6.Path.calcLength(i[i.length-4],i[i.length-3],"C",f),p=c6.Path.getPointOnQuadraticBezier(Math.min(1,1-s/h),f[0],f[1],f[2],f[3],f[4],f[5]);l=r[a-2]-p.x,u=r[a-1]-p.y}else l=r[a-2]-r[a-4],u=r[a-1]-r[a-3];var c=(Math.atan2(u,l)+n)%n,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[a-2],r[a-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-s,d/2),t.lineTo(-s,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(r[0],r[1]),o?(l=(i[0]+i[2])/2-r[0],u=(i[1]+i[3])/2-r[1]):(l=r[2]-r[0],u=r[3]-r[1]),t.rotate((Math.atan2(-u,-l)+n)%n),t.moveTo(0,0),t.lineTo(-s,d/2),t.lineTo(-s,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),n=this.pointerWidth()/2;return{x:t.x-n,y:t.y-n,width:t.width+n*2,height:t.height+n*2}}}hv.Arrow=vl;vl.prototype.className="Arrow";(0,Tde._registerNode)(vl);gv.Factory.addGetterSetter(vl,"pointerLength",10,(0,vN.getNumberValidator)());gv.Factory.addGetterSetter(vl,"pointerWidth",10,(0,vN.getNumberValidator)());gv.Factory.addGetterSetter(vl,"pointerAtBeginning",!1);gv.Factory.addGetterSetter(vl,"pointerAtEnding",!0);var mv={};Object.defineProperty(mv,"__esModule",{value:!0});mv.Circle=void 0;const Ede=Te,Pde=on,Ade=de,kde=Pe;let Cc=class extends Pde.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}};mv.Circle=Cc;Cc.prototype._centroid=!0;Cc.prototype.className="Circle";Cc.prototype._attrsAffectingSize=["radius"];(0,kde._registerNode)(Cc);Ede.Factory.addGetterSetter(Cc,"radius",0,(0,Ade.getNumberValidator)());var yv={};Object.defineProperty(yv,"__esModule",{value:!0});yv.Ellipse=void 0;const EC=Te,Ode=on,bN=de,Rde=Pe;class sa extends Ode.Shape{_sceneFunc(t){var n=this.radiusX(),r=this.radiusY();t.beginPath(),t.save(),n!==r&&t.scale(1,r/n),t.arc(0,0,n,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}yv.Ellipse=sa;sa.prototype.className="Ellipse";sa.prototype._centroid=!0;sa.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,Rde._registerNode)(sa);EC.Factory.addComponentsGetterSetter(sa,"radius",["x","y"]);EC.Factory.addGetterSetter(sa,"radiusX",0,(0,bN.getNumberValidator)());EC.Factory.addGetterSetter(sa,"radiusY",0,(0,bN.getNumberValidator)());var vv={};Object.defineProperty(vv,"__esModule",{value:!0});vv.Image=void 0;const Xb=Ot,bl=Te,Mde=on,Ide=Pe,Mh=de;let so=class _N extends Mde.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),o=this.attrs.image;let s;if(o){const a=this.attrs.cropWidth,l=this.attrs.cropHeight;a&&l?s=[o,this.cropX(),this.cropY(),a,l,0,0,n,r]:s=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(t.beginPath(),i?Xb.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),o&&(i&&t.clip(),t.drawImage.apply(t,s))}_hitFunc(t){var n=this.width(),r=this.height(),i=this.cornerRadius();t.beginPath(),i?Xb.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n;return(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var t,n;return(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(t,n,r=null){var i=Xb.Util.createImageElement();i.onload=function(){var o=new _N({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};vv.Image=so;so.prototype.className="Image";(0,Ide._registerNode)(so);bl.Factory.addGetterSetter(so,"cornerRadius",0,(0,Mh.getNumberOrArrayOfNumbersValidator)(4));bl.Factory.addGetterSetter(so,"image");bl.Factory.addComponentsGetterSetter(so,"crop",["x","y","width","height"]);bl.Factory.addGetterSetter(so,"cropX",0,(0,Mh.getNumberValidator)());bl.Factory.addGetterSetter(so,"cropY",0,(0,Mh.getNumberValidator)());bl.Factory.addGetterSetter(so,"cropWidth",0,(0,Mh.getNumberValidator)());bl.Factory.addGetterSetter(so,"cropHeight",0,(0,Mh.getNumberValidator)());var ac={};Object.defineProperty(ac,"__esModule",{value:!0});ac.Tag=ac.Label=void 0;const bv=Te,Nde=on,Dde=Sc,PC=de,SN=Pe;var wN=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],Lde="Change.konva",$de="none",_2="up",S2="right",w2="down",x2="left",Fde=wN.length;class AC extends Dde.Group{constructor(t){super(t),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,s.x),r=Math.max(r,s.x),i=Math.min(i,s.y),o=Math.max(o,s.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}Sv.RegularPolygon=Sl;Sl.prototype.className="RegularPolygon";Sl.prototype._centroid=!0;Sl.prototype._attrsAffectingSize=["radius"];(0,Hde._registerNode)(Sl);xN.Factory.addGetterSetter(Sl,"radius",0,(0,CN.getNumberValidator)());xN.Factory.addGetterSetter(Sl,"sides",0,(0,CN.getNumberValidator)());var wv={};Object.defineProperty(wv,"__esModule",{value:!0});wv.Ring=void 0;const TN=Te,qde=on,EN=de,Wde=Pe;var d6=Math.PI*2;class wl extends qde.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,d6,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),d6,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}wv.Ring=wl;wl.prototype.className="Ring";wl.prototype._centroid=!0;wl.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Wde._registerNode)(wl);TN.Factory.addGetterSetter(wl,"innerRadius",0,(0,EN.getNumberValidator)());TN.Factory.addGetterSetter(wl,"outerRadius",0,(0,EN.getNumberValidator)());var xv={};Object.defineProperty(xv,"__esModule",{value:!0});xv.Sprite=void 0;const xl=Te,Kde=on,Xde=wc,PN=de,Yde=Pe;class ao extends Kde.Shape{constructor(t){super(t),this._updated=!0,this.anim=new Xde.Animation(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],s=this.frameOffsets(),a=o[i+0],l=o[i+1],u=o[i+2],c=o[i+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,u,c),t.closePath(),t.fillStrokeShape(this)),d)if(s){var f=s[n],h=r*2;t.drawImage(d,a,l,u,c,f[h+0],f[h+1],u,c)}else t.drawImage(d,a,l,u,c,0,0,u,c)}_hitFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],s=this.frameOffsets(),a=o[i+2],l=o[i+3];if(t.beginPath(),s){var u=s[n],c=r*2;t.rect(u[c+0],u[c+1],a,l)}else t.rect(0,0,a,l);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],o=i.length/4;t{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var Bp;function Qb(){return Bp||(Bp=C2.Util.createCanvasElement().getContext(rfe),Bp)}function pfe(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function gfe(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function mfe(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}class zt extends Jde.Shape{constructor(t){super(mfe(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(y+=s)}}}_hitFunc(t){var n=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var n=C2.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(ife,n),this}getWidth(){var t=this.attrs.width===Wl||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===Wl||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return C2.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var n=Qb(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(t),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+Fp+this.fontVariant()+Fp+(this.fontSize()+lfe)+hfe(this.fontFamily())}_addTextLine(t){this.align()===ed&&(t=t.trim());var r=this._getTextWidth(t);return this.textArr.push({text:t,width:r,lastInParagraph:!1})}_getTextWidth(t){var n=this.letterSpacing(),r=t.length;return Qb().measureText(t).width+(r?n*(r-1):0)}_setTextData(){var t=this.text().split(` +`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,s=this.attrs.height,a=o!==Wl&&o!==void 0,l=s!==Wl&&s!==void 0,u=this.padding(),c=o-u*2,d=s-u*2,f=0,h=this.wrap(),p=h!==p6,m=h!==dfe&&p,_=this.ellipsis();this.textArr=[],Qb().font=this._getContextFont();for(var y=_?this._getTextWidth(Yb):0,v=0,g=t.length;vc)for(;b.length>0;){for(var w=0,x=b.length,T="",P=0;w>>1,A=b.slice(0,E+1),$=this._getTextWidth(A)+y;$<=c?(w=E+1,T=A,P=$):x=E}if(T){if(m){var M,C=b[T.length],O=C===Fp||C===f6;O&&P<=c?M=T.length:M=Math.max(T.lastIndexOf(Fp),T.lastIndexOf(f6))+1,M>0&&(w=M,T=T.slice(0,w),P=this._getTextWidth(T))}T=T.trimRight(),this._addTextLine(T),r=Math.max(r,P),f+=i;var I=this._shouldHandleEllipsis(f);if(I){this._tryToAddEllipsisToLastLine();break}if(b=b.slice(w),b=b.trimLeft(),b.length>0&&(S=this._getTextWidth(b),S<=c)){this._addTextLine(b),f+=i,r=Math.max(r,S);break}}else break}else this._addTextLine(b),f+=i,r=Math.max(r,S),this._shouldHandleEllipsis(f)&&vd)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==Wl&&i!==void 0,s=this.padding(),a=i-s*2,l=this.wrap(),u=l!==p6;return!u||o&&t+r>a}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==Wl&&t!==void 0,r=this.padding(),i=t-r*2,o=this.ellipsis(),s=this.textArr[this.textArr.length-1];if(!(!s||!o)){if(n){var a=this._getTextWidth(s.text+Yb)n?null:td.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=td.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var n=this.textDecoration(),r=this.fill(),i=this.fontSize(),o=this.glyphInfo;n==="underline"&&t.beginPath();for(var s=0;s=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;ie+`.${LN}`).join(" "),y6="nodesRect",Cfe=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],Tfe={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const Efe="ontouchstart"in oi.Konva._global;function Pfe(e,t){if(e==="rotater")return"crosshair";t+=Qe.Util.degToRad(Tfe[e]||0);var n=(Qe.Util.radToDeg(t)%360+360)%360;return Qe.Util._inRange(n,315+22.5,360)||Qe.Util._inRange(n,0,22.5)?"ns-resize":Qe.Util._inRange(n,45-22.5,45+22.5)?"nesw-resize":Qe.Util._inRange(n,90-22.5,90+22.5)?"ew-resize":Qe.Util._inRange(n,135-22.5,135+22.5)?"nwse-resize":Qe.Util._inRange(n,180-22.5,180+22.5)?"ns-resize":Qe.Util._inRange(n,225-22.5,225+22.5)?"nesw-resize":Qe.Util._inRange(n,270-22.5,270+22.5)?"ew-resize":Qe.Util._inRange(n,315-22.5,315+22.5)?"nwse-resize":(Qe.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var Jm=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],v6=1e8;function Afe(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function $N(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:i})}function kfe(e,t){const n=Afe(e);return $N(e,t,n)}function Ofe(e,t,n){let r=t;for(let i=0;ii.isAncestorOf(this)?(Qe.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=n,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},s=i._attrsAffectingSize.map(a=>a+"Change."+this._getEventNamespace()).join(" ");i.on(s,o),i.on(Cfe.map(a=>a+`.${this._getEventNamespace()}`).join(" "),o),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(i)}),this._resetTransformCache();var r=!!this.findOne(".top-left");return r&&this.update(),this}_proxyDrag(t){let n;t.on(`dragstart.${this._getEventNamespace()}`,r=>{n=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(r,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=t.getAbsolutePosition(),o=i.x-n.x,s=i.y-n.y;this.nodes().forEach(a=>{if(a===t||a.isDragging())return;const l=a.getAbsolutePosition();a.setAbsolutePosition({x:l.x+o,y:l.y+s}),a.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(y6),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(y6,this.__getNodeRect)}__getNodeShape(t,n=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=t.getAbsoluteScale(r),s=t.getAbsolutePosition(r),a=i.x*o.x-t.offsetX()*o.x,l=i.y*o.y-t.offsetY()*o.y;const u=(oi.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:s.x+a*Math.cos(u)+l*Math.sin(-u),y:s.y+l*Math.cos(u)+a*Math.sin(u),width:i.width*o.x,height:i.height*o.y,rotation:u};return $N(c,-oi.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-v6,y:-v6,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const c=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=u.getAbsoluteTransform();d.forEach(function(h){var p=f.point(h);n.push(p)})});const r=new Qe.Transform;r.rotate(-oi.Konva.getAngle(this.rotation()));var i,o,s,a;n.forEach(function(u){var c=r.point(u);i===void 0&&(i=s=c.x,o=a=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:s-i,height:a-o,rotation:oi.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),Jm.forEach((function(t){this._createAnchor(t)}).bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new Sfe.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:Efe?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{var i=oi.Konva.getAngle(this.rotation()),o=Pfe(t,i);n.getStage().content&&(n.getStage().content.style.cursor=o),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var t=new _fe.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n){var r=this.getParent(),i=r.padding();n.beginPath(),n.rect(-i,-i,this.width()+i*2,this.height()+i*2),n.moveTo(this.width()/2,-i),r.rotateEnabled()&&n.lineTo(this.width()/2,-r.rotateAnchorOffset()*Qe.Util._sign(this.height())-i),n.fillStrokeShape(this)},hitFunc:(n,r)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",n=>{n.cancelBubble=!0}),t.on("dragmove",n=>{n.cancelBubble=!0}),t.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var s=t.target.getAbsolutePosition(),a=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-s.x,y:a.y-s.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var n,r,i,o=this.findOne("."+this._movingAnchorName),s=o.getStage();s.setPointersPositions(t);const a=s.getPointerPosition();let l={x:a.x-this._anchorDragOffset.x,y:a.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(u,l,t)),o.setAbsolutePosition(l);const c=o.getAbsolutePosition();if(!(u.x===c.x&&u.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();n=o.x()-d.width/2,r=-o.y()+d.height/2;let M=Math.atan2(-r,n)+Math.PI/2;d.height<0&&(M-=Math.PI);var f=oi.Konva.getAngle(this.rotation());const C=f+M,O=oi.Konva.getAngle(this.rotationSnapTolerance()),N=Ofe(this.rotationSnaps(),C,O)-d.rotation,R=kfe(d,N);this._fitNodesInto(R,t);return}var h=this.shiftBehavior(),p;h==="inverted"?p=this.keepRatio()&&!t.shiftKey:h==="none"?p=this.keepRatio():p=this.keepRatio()||t.shiftKey;var g=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(m.x-o.x(),2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-left").x()>m.x?-1:1,y=this.findOne(".top-left").y()>m.y?-1:1;n=i*this.cos*_,r=i*this.sin*y,this.findOne(".top-left").x(m.x-n),this.findOne(".top-left").y(m.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(o.x()-m.x,2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-right").x()m.y?-1:1;n=i*this.cos*_,r=i*this.sin*y,this.findOne(".top-right").x(m.x+n),this.findOne(".top-right").y(m.y-r)}var v=o.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(m.x-o.x(),2)+Math.pow(o.y()-m.y,2));var _=m.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(Qe.Util._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(Qe.Util._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var s=new Qe.Transform;if(s.rotate(oi.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=s.point({x:-this.padding()*2,y:0});if(t.x+=d.x,t.y+=d.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,!o){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=s.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.width+=this.padding()*2,!o){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=s.point({x:0,y:-this.padding()*2});if(t.x+=d.x,t.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=s.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(r,t);d?t=d:Qe.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const a=1e7,l=new Qe.Transform;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/a,r.height/a);const u=new Qe.Transform;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/a,t.height/a);const c=u.multiply(l.invert());this._nodes.forEach(d=>{var f;const h=d.getParent().getAbsoluteTransform(),p=d.getTransform().copy();p.translate(d.offsetX(),d.offsetY());const m=new Qe.Transform;m.multiply(h.copy().invert()).multiply(c).multiply(h).multiply(p);const _=m.decompose();d.setAttrs(_),this._fire("transform",{evt:n,target:d}),d._fire("transform",{evt:n,target:d}),(f=d.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(Qe.Util._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,n){this.findOne(t).setAttrs(n)}update(){var t,n=this._getNodeRect();this.rotation(Qe.Util._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),s=this.resizeEnabled(),a=this.padding(),l=this.anchorSize();const u=this.find("._anchor");u.forEach(d=>{d.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+a,offsetY:l/2+a,visible:s&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+a,visible:s&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-a,offsetY:l/2+a,visible:s&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+a,visible:s&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-a,visible:s&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+a,offsetY:l/2-a,visible:s&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-a,visible:s&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-a,offsetY:l/2-a,visible:s&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*Qe.Util._sign(i)-a,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&u.forEach(d=>{c(d)}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),m6.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return g6.Node.prototype.toObject.call(this)}clone(t){var n=g6.Node.prototype.clone.call(this,t);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}Ev.Transformer=ze;function Rfe(e){return e instanceof Array||Qe.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){Jm.indexOf(t)===-1&&Qe.Util.warn("Unknown anchor name: "+t+". Available names are: "+Jm.join(", "))}),e||[]}ze.prototype.className="Transformer";(0,wfe._registerNode)(ze);Ye.Factory.addGetterSetter(ze,"enabledAnchors",Jm,Rfe);Ye.Factory.addGetterSetter(ze,"flipEnabled",!0,(0,ua.getBooleanValidator)());Ye.Factory.addGetterSetter(ze,"resizeEnabled",!0);Ye.Factory.addGetterSetter(ze,"anchorSize",10,(0,ua.getNumberValidator)());Ye.Factory.addGetterSetter(ze,"rotateEnabled",!0);Ye.Factory.addGetterSetter(ze,"rotationSnaps",[]);Ye.Factory.addGetterSetter(ze,"rotateAnchorOffset",50,(0,ua.getNumberValidator)());Ye.Factory.addGetterSetter(ze,"rotationSnapTolerance",5,(0,ua.getNumberValidator)());Ye.Factory.addGetterSetter(ze,"borderEnabled",!0);Ye.Factory.addGetterSetter(ze,"anchorStroke","rgb(0, 161, 255)");Ye.Factory.addGetterSetter(ze,"anchorStrokeWidth",1,(0,ua.getNumberValidator)());Ye.Factory.addGetterSetter(ze,"anchorFill","white");Ye.Factory.addGetterSetter(ze,"anchorCornerRadius",0,(0,ua.getNumberValidator)());Ye.Factory.addGetterSetter(ze,"borderStroke","rgb(0, 161, 255)");Ye.Factory.addGetterSetter(ze,"borderStrokeWidth",1,(0,ua.getNumberValidator)());Ye.Factory.addGetterSetter(ze,"borderDash");Ye.Factory.addGetterSetter(ze,"keepRatio",!0);Ye.Factory.addGetterSetter(ze,"shiftBehavior","default");Ye.Factory.addGetterSetter(ze,"centeredScaling",!1);Ye.Factory.addGetterSetter(ze,"ignoreStroke",!1);Ye.Factory.addGetterSetter(ze,"padding",0,(0,ua.getNumberValidator)());Ye.Factory.addGetterSetter(ze,"node");Ye.Factory.addGetterSetter(ze,"nodes");Ye.Factory.addGetterSetter(ze,"boundBoxFunc");Ye.Factory.addGetterSetter(ze,"anchorDragBoundFunc");Ye.Factory.addGetterSetter(ze,"anchorStyleFunc");Ye.Factory.addGetterSetter(ze,"shouldOverdrawWholeArea",!1);Ye.Factory.addGetterSetter(ze,"useSingleNodeRotation",!0);Ye.Factory.backCompat(ze,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Pv={};Object.defineProperty(Pv,"__esModule",{value:!0});Pv.Wedge=void 0;const Av=Te,Mfe=on,Ife=Pe,FN=de,Nfe=Pe;class Yo extends Mfe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,Ife.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}Pv.Wedge=Yo;Yo.prototype.className="Wedge";Yo.prototype._centroid=!0;Yo.prototype._attrsAffectingSize=["radius"];(0,Nfe._registerNode)(Yo);Av.Factory.addGetterSetter(Yo,"radius",0,(0,FN.getNumberValidator)());Av.Factory.addGetterSetter(Yo,"angle",0,(0,FN.getNumberValidator)());Av.Factory.addGetterSetter(Yo,"clockwise",!1);Av.Factory.backCompat(Yo,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var kv={};Object.defineProperty(kv,"__esModule",{value:!0});kv.Blur=void 0;const b6=Te,Dfe=St,Lfe=de;function _6(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var $fe=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Ffe=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Bfe(e,t){var n=e.data,r=e.width,i=e.height,o,s,a,l,u,c,d,f,h,p,m,_,y,v,g,b,S,w,x,T,P,E,A,$,M=t+t+1,C=r-1,O=i-1,I=t+1,N=I*(I+1)/2,R=new _6,D=null,L=R,j=null,U=null,G=$fe[t],W=Ffe[t];for(a=1;a>W,A!==0?(A=255/A,n[c]=(f*G>>W)*A,n[c+1]=(h*G>>W)*A,n[c+2]=(p*G>>W)*A):n[c]=n[c+1]=n[c+2]=0,f-=_,h-=y,p-=v,m-=g,_-=j.r,y-=j.g,v-=j.b,g-=j.a,l=d+((l=o+t+1)>W,A>0?(A=255/A,n[l]=(f*G>>W)*A,n[l+1]=(h*G>>W)*A,n[l+2]=(p*G>>W)*A):n[l]=n[l+1]=n[l+2]=0,f-=_,h-=y,p-=v,m-=g,_-=j.r,y-=j.g,v-=j.b,g-=j.a,l=o+((l=s+I)0&&Bfe(t,n)};kv.Blur=jfe;b6.Factory.addGetterSetter(Dfe.Node,"blurRadius",0,(0,Lfe.getNumberValidator)(),b6.Factory.afterSetFilter);var Ov={};Object.defineProperty(Ov,"__esModule",{value:!0});Ov.Brighten=void 0;const S6=Te,Vfe=St,zfe=de,Ufe=function(e){var t=this.brightness()*255,n=e.data,r=n.length,i;for(i=0;i255?255:i,o=o<0?0:o>255?255:o,s=s<0?0:s>255?255:s,n[a]=i,n[a+1]=o,n[a+2]=s};Rv.Contrast=qfe;w6.Factory.addGetterSetter(Gfe.Node,"contrast",0,(0,Hfe.getNumberValidator)(),w6.Factory.afterSetFilter);var Mv={};Object.defineProperty(Mv,"__esModule",{value:!0});Mv.Emboss=void 0;const Ws=Te,Iv=St,Wfe=Ot,BN=de,Kfe=function(e){var t=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,s=0,a=e.data,l=e.width,u=e.height,c=l*4,d=u;switch(r){case"top-left":o=-1,s=-1;break;case"top":o=-1,s=0;break;case"top-right":o=-1,s=1;break;case"right":o=0,s=1;break;case"bottom-right":o=1,s=1;break;case"bottom":o=1,s=0;break;case"bottom-left":o=1,s=-1;break;case"left":o=0,s=-1;break;default:Wfe.Util.error("Unknown emboss direction: "+r)}do{var f=(d-1)*c,h=o;d+h<1&&(h=0),d+h>u&&(h=0);var p=(d-1+h)*l*4,m=l;do{var _=f+(m-1)*4,y=s;m+y<1&&(y=0),m+y>l&&(y=0);var v=p+(m-1+y)*4,g=a[_]-a[v],b=a[_+1]-a[v+1],S=a[_+2]-a[v+2],w=g,x=w>0?w:-w,T=b>0?b:-b,P=S>0?S:-S;if(T>x&&(w=b),P>x&&(w=S),w*=t,i){var E=a[_]+w,A=a[_+1]+w,$=a[_+2]+w;a[_]=E>255?255:E<0?0:E,a[_+1]=A>255?255:A<0?0:A,a[_+2]=$>255?255:$<0?0:$}else{var M=n-w;M<0?M=0:M>255&&(M=255),a[_]=a[_+1]=a[_+2]=M}}while(--m)}while(--d)};Mv.Emboss=Kfe;Ws.Factory.addGetterSetter(Iv.Node,"embossStrength",.5,(0,BN.getNumberValidator)(),Ws.Factory.afterSetFilter);Ws.Factory.addGetterSetter(Iv.Node,"embossWhiteLevel",.5,(0,BN.getNumberValidator)(),Ws.Factory.afterSetFilter);Ws.Factory.addGetterSetter(Iv.Node,"embossDirection","top-left",null,Ws.Factory.afterSetFilter);Ws.Factory.addGetterSetter(Iv.Node,"embossBlend",!1,null,Ws.Factory.afterSetFilter);var Nv={};Object.defineProperty(Nv,"__esModule",{value:!0});Nv.Enhance=void 0;const x6=Te,Xfe=St,Yfe=de;function e_(e,t,n,r,i){var o=n-t,s=i-r,a;return o===0?r+s/2:s===0?r:(a=(e-t)/o,a=s*a+r,a)}const Qfe=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,s=t[1],a=s,l,u=t[2],c=u,d,f,h=this.enhance();if(h!==0){for(f=0;fi&&(i=o),l=t[f+1],la&&(a=l),d=t[f+2],dc&&(c=d);i===r&&(i=255,r=0),a===s&&(a=255,s=0),c===u&&(c=255,u=0);var p,m,_,y,v,g,b,S,w;for(h>0?(m=i+h*(255-i),_=r-h*(r-0),v=a+h*(255-a),g=s-h*(s-0),S=c+h*(255-c),w=u-h*(u-0)):(p=(i+r)*.5,m=i+h*(i-p),_=r+h*(r-p),y=(a+s)*.5,v=a+h*(a-y),g=s+h*(s-y),b=(c+u)*.5,S=c+h*(c-b),w=u+h*(u-b)),f=0;fy?_:y;var v=s,g=o,b,S,w=360/g*Math.PI/180,x,T;for(S=0;Sg?v:g;var b=s,S=o,w,x,T=n.polarRotation||0,P,E;for(c=0;ct&&(b=g,S=0,w=-1),i=0;i=0&&h=0&&p=0&&h=0&&p=255*4?255:0}return s}function fhe(e,t,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),s=[],a=0;a=0&&h=0&&p=n))for(o=m;o<_;o+=1)o>=r||(s=(n*o+i)*4,a+=b[s+0],l+=b[s+1],u+=b[s+2],c+=b[s+3],g+=1);for(a=a/g,l=l/g,u=u/g,c=c/g,i=h;i=n))for(o=m;o<_;o+=1)o>=r||(s=(n*o+i)*4,b[s+0]=a,b[s+1]=l,b[s+2]=u,b[s+3]=c)}};zv.Pixelate=_he;P6.Factory.addGetterSetter(vhe.Node,"pixelSize",8,(0,bhe.getNumberValidator)(),P6.Factory.afterSetFilter);var Uv={};Object.defineProperty(Uv,"__esModule",{value:!0});Uv.Posterize=void 0;const A6=Te,She=St,whe=de,xhe=function(e){var t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t,o;for(o=0;o255?255:e<0?0:Math.round(e)});ty.Factory.addGetterSetter(DC.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});ty.Factory.addGetterSetter(DC.Node,"blue",0,Che.RGBComponent,ty.Factory.afterSetFilter);var Hv={};Object.defineProperty(Hv,"__esModule",{value:!0});Hv.RGBA=void 0;const jf=Te,qv=St,Ehe=de,Phe=function(e){var t=e.data,n=t.length,r=this.red(),i=this.green(),o=this.blue(),s=this.alpha(),a,l;for(a=0;a255?255:e<0?0:Math.round(e)});jf.Factory.addGetterSetter(qv.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});jf.Factory.addGetterSetter(qv.Node,"blue",0,Ehe.RGBComponent,jf.Factory.afterSetFilter);jf.Factory.addGetterSetter(qv.Node,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var Wv={};Object.defineProperty(Wv,"__esModule",{value:!0});Wv.Sepia=void 0;const Ahe=function(e){var t=e.data,n=t.length,r,i,o,s;for(r=0;r127&&(u=255-u),c>127&&(c=255-c),d>127&&(d=255-d),t[l]=u,t[l+1]=c,t[l+2]=d}while(--a)}while(--o)};Kv.Solarize=khe;var Xv={};Object.defineProperty(Xv,"__esModule",{value:!0});Xv.Threshold=void 0;const k6=Te,Ohe=St,Rhe=de,Mhe=function(e){var t=this.threshold()*255,n=e.data,r=n.length,i;for(i=0;i{const{width:r,height:i}=t,o=document.createElement("div"),s=new rd.Stage({container:o,width:r,height:i}),a=new rd.Layer,l=new rd.Layer;return a.add(new rd.Rect({...t,fill:n?"black":"white"})),e.forEach(u=>l.add(new rd.Line({points:u.points,stroke:n?"white":"black",strokeWidth:u.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:u.tool==="brush"?"source-over":"destination-out"}))),s.add(a),s.add(l),o.remove(),s},vpe=async(e,t,n)=>new Promise((r,i)=>{const o=document.createElement("canvas");o.width=t,o.height=n;const s=o.getContext("2d"),a=new Image;if(!s){o.remove(),i("Unable to get context");return}a.onload=function(){s.drawImage(a,0,0),o.remove(),r(s.getImageData(0,0,t,n))},a.src=e}),M6=async(e,t)=>{const n=e.toDataURL(t);return await vpe(n,t.width,t.height)},bpe=async(e,t,n,r,i)=>{const o=fe("canvas"),s=rv(),a=Ole();if(!s||!a){o.error("Unable to find canvas / stage");return}const l={...t,...n},u=s.clone();u.scale({x:1,y:1});const c=u.getAbsolutePosition(),d={x:l.x+c.x,y:l.y+c.y,width:l.width,height:l.height},f=await Ym(u,d),h=await M6(u,d),p=await ype(r?e.objects.filter(DR):[],l,i),m=await Ym(p,l),_=await M6(p,l);return{baseBlob:f,baseImageData:h,maskBlob:m,maskImageData:_}},_pe=e=>{let t=!0,n=!1;const r=e.length;let i=3;for(i;i{const t=e.length;let n=0;for(n;n{const{isPartiallyTransparent:n,isFullyTransparent:r}=_pe(e.data),i=Spe(t.data);return n?r?"txt2img":"outpaint":i?"inpaint":"img2img"},xpe=e=>aR(e,n=>n.isEnabled&&(!!n.processedControlImage||n.processorType==="none"&&!!n.controlImage)),Yv=(e,t,n)=>{const{isEnabled:r,controlNets:i}=e.controlNet,o=xpe(i),s=t.nodes[lt];if(r&&o.length&&o.length){const a={id:Mp,type:"collect",is_intermediate:!0};t.nodes[Mp]=a,t.edges.push({source:{node_id:Mp,field:"collection"},destination:{node_id:n,field:"control"}}),o.forEach(l=>{const{controlNetId:u,controlImage:c,processedControlImage:d,beginStepPct:f,endStepPct:h,controlMode:p,resizeMode:m,model:_,processorType:y,weight:v}=l,g={id:`control_net_${u}`,type:"controlnet",is_intermediate:!0,begin_step_percent:f,end_step_percent:h,control_mode:p,resize_mode:m,control_model:_,control_weight:v};if(d&&y!=="none")g.image={image_name:d};else if(c)g.image={image_name:c};else return;if(t.nodes[g.id]=g,s){const b=x0(g,["id","type"]);s.controlnets.push(b)}t.edges.push({source:{node_id:g.id,field:"control"},destination:{node_id:Mp,field:"item"}})})}},Tc=(e,t)=>{const{positivePrompt:n,iterations:r,seed:i,shouldRandomizeSeed:o}=e.generation,{combinatorial:s,isEnabled:a,maxPrompts:l}=e.dynamicPrompts,u=t.nodes[lt];if(a){oY(t.nodes[Be],"prompt");const c={id:Gb,type:"dynamic_prompt",is_intermediate:!0,max_prompts:s?l:r,combinatorial:s,prompt:n},d={id:ar,type:"iterate",is_intermediate:!0};if(t.nodes[Gb]=c,t.nodes[ar]=d,t.edges.push({source:{node_id:Gb,field:"prompt_collection"},destination:{node_id:ar,field:"collection"}},{source:{node_id:ar,field:"item"},destination:{node_id:Be,field:"prompt"}}),u&&t.edges.push({source:{node_id:ar,field:"item"},destination:{node_id:lt,field:"positive_prompt"}}),o){const f={id:$i,type:"rand_int",is_intermediate:!0};t.nodes[$i]=f,t.edges.push({source:{node_id:$i,field:"a"},destination:{node_id:$e,field:"seed"}}),u&&t.edges.push({source:{node_id:$i,field:"a"},destination:{node_id:lt,field:"seed"}})}else t.nodes[$e].seed=i,u&&(u.seed=i)}else{u&&(u.positive_prompt=n);const c={id:xo,type:"range_of_size",is_intermediate:!0,size:r,step:1},d={id:ar,type:"iterate",is_intermediate:!0};if(t.nodes[ar]=d,t.nodes[xo]=c,t.edges.push({source:{node_id:xo,field:"collection"},destination:{node_id:ar,field:"collection"}}),t.edges.push({source:{node_id:ar,field:"item"},destination:{node_id:$e,field:"seed"}}),u&&t.edges.push({source:{node_id:ar,field:"item"},destination:{node_id:lt,field:"seed"}}),o){const f={id:$i,type:"rand_int",is_intermediate:!0};t.nodes[$i]=f,t.edges.push({source:{node_id:$i,field:"a"},destination:{node_id:xo,field:"start"}})}else c.start=i}},Nh=(e,t,n,r=qs)=>{const{loras:i}=e.lora,o=gR(i),s=t.nodes[lt];o>0&&(t.edges=t.edges.filter(u=>!(u.source.node_id===qs&&["unet"].includes(u.source.field))&&!(u.source.node_id===gl&&["unet"].includes(u.source.field))),t.edges=t.edges.filter(u=>!(u.source.node_id===rt&&["clip"].includes(u.source.field))));let a="",l=0;Za(i,u=>{const{model_name:c,base_model:d,weight:f}=u,h=`${fce}_${c.replace(".","_")}`,p={type:"lora_loader",id:h,is_intermediate:!0,lora:{model_name:c,base_model:d},weight:f};s&&s.loras.push({lora:{model_name:c,base_model:d},weight:f}),t.nodes[h]=p,l===0?(t.edges.push({source:{node_id:r,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:rt,field:"clip"},destination:{node_id:h,field:"clip"}})):(t.edges.push({source:{node_id:a,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:a,field:"clip"},destination:{node_id:h,field:"clip"}})),l===o-1&&(t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:n,field:"unet"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:Be,field:"clip"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:qe,field:"clip"}})),a=h,l+=1})},zN=Zn(e=>e.ui,e=>OR[e.activeTab],{memoizeOptions:{equalityCheck:w0}}),s4e=Zn(e=>e.ui,e=>e.activeTab,{memoizeOptions:{equalityCheck:w0}}),a4e=Zn(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:w0}}),Cl=(e,t,n=nt)=>{const i=zN(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],s=t.nodes[lt];if(!o)return;o.is_intermediate=!0;const a={id:pu,type:"img_nsfw",is_intermediate:i};t.nodes[pu]=a,t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:pu,field:"image"}}),s&&t.edges.push({source:{node_id:lt,field:"metadata"},destination:{node_id:pu,field:"metadata"}})},Dh=(e,t,n=qs)=>{const{vae:r}=e.generation,i=!r,o=t.nodes[lt];i||(t.nodes[Jc]={type:"vae_loader",id:Jc,is_intermediate:!0,vae_model:r});const s=n==gl;(t.id===_C||t.id===Qm)&&t.edges.push({source:{node_id:i?n:Jc,field:i&&s?"vae_decoder":"vae"},destination:{node_id:nt,field:"vae"}}),t.id===Qm&&t.edges.push({source:{node_id:i?n:Jc,field:i&&s?"vae_decoder":"vae"},destination:{node_id:vt,field:"vae"}}),t.id===sN&&t.edges.push({source:{node_id:i?n:Jc,field:i&&s?"vae_decoder":"vae"},destination:{node_id:Mi,field:"vae"}}),r&&o&&(o.vae=r)},Tl=(e,t,n=nt)=>{const i=zN(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],s=t.nodes[pu],a=t.nodes[lt];if(!o)return;const l={id:Zc,type:"img_watermark",is_intermediate:i};t.nodes[Zc]=l,o.is_intermediate=!0,s?(s.is_intermediate=!0,t.edges.push({source:{node_id:pu,field:"image"},destination:{node_id:Zc,field:"image"}})):t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:Zc,field:"image"}}),a&&t.edges.push({source:{node_id:lt,field:"metadata"},destination:{node_id:Zc,field:"metadata"}})},Cpe=(e,t)=>{const n=fe("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:s,scheduler:a,steps:l,img2imgStrength:u,clipSkip:c,shouldUseCpuNoise:d,shouldUseNoiseSettings:f}=e.generation,{width:h,height:p}=e.canvas.boundingBoxDimensions,{shouldAutoSave:m}=e.canvas;if(!o)throw n.error("No model found in state"),new Error("No model found in state");const _=f?d:qo.shouldUseCpuNoise,y=o.model_type.includes("onnx"),v=y?gl:qs,g={id:Qm,nodes:{[Be]:{type:y?"prompt_onnx":"compel",id:Be,is_intermediate:!0,prompt:r},[qe]:{type:y?"prompt_onnx":"compel",id:qe,is_intermediate:!0,prompt:i},[$e]:{type:"noise",id:$e,is_intermediate:!0,use_cpu:_},[v]:{type:v,id:v,is_intermediate:!0,model:o},[rt]:{type:"clip_skip",id:rt,is_intermediate:!0,skipped_layers:c},[Wt]:{type:y?"l2l_onnx":"l2l",id:Wt,is_intermediate:!0,cfg_scale:s,scheduler:a,steps:l,strength:u},[vt]:{type:y?"i2l_onnx":"i2l",id:vt,is_intermediate:!0},[nt]:{type:"l2i",id:nt,is_intermediate:!m}},edges:[{source:{node_id:v,field:"clip"},destination:{node_id:rt,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:qe,field:"clip"}},{source:{node_id:Wt,field:"latents"},destination:{node_id:nt,field:"latents"}},{source:{node_id:vt,field:"latents"},destination:{node_id:Wt,field:"latents"}},{source:{node_id:$e,field:"noise"},destination:{node_id:Wt,field:"noise"}},{source:{node_id:v,field:"unet"},destination:{node_id:Wt,field:"unet"}},{source:{node_id:qe,field:"conditioning"},destination:{node_id:Wt,field:"negative_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Wt,field:"positive_conditioning"}}]};if(t.width!==h||t.height!==p){const b={id:Yn,type:"img_resize",image:{image_name:t.image_name},is_intermediate:!0,width:h,height:p};g.nodes[Yn]=b,g.edges.push({source:{node_id:Yn,field:"image"},destination:{node_id:vt,field:"image"}}),g.edges.push({source:{node_id:Yn,field:"width"},destination:{node_id:$e,field:"width"}}),g.edges.push({source:{node_id:Yn,field:"height"},destination:{node_id:$e,field:"height"}})}else g.nodes[vt].image={image_name:t.image_name},g.edges.push({source:{node_id:vt,field:"width"},destination:{node_id:$e,field:"width"}}),g.edges.push({source:{node_id:vt,field:"height"},destination:{node_id:$e,field:"height"}});return g.nodes[lt]={id:lt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:s,height:p,width:h,positive_prompt:"",negative_prompt:i,model:o,seed:0,steps:l,rand_device:_?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],clip_skip:c,strength:u,init_image:t.image_name},Nh(e,g,Wt,v),Dh(e,g,v),Tc(e,g),Yv(e,g,Wt),e.system.shouldUseNSFWChecker&&Cl(e,g),e.system.shouldUseWatermarker&&Tl(e,g),g},Tpe=(e,t,n)=>{const r=fe("nodes"),{positivePrompt:i,negativePrompt:o,model:s,cfgScale:a,scheduler:l,steps:u,img2imgStrength:c,shouldFitToWidthHeight:d,iterations:f,seed:h,shouldRandomizeSeed:p,seamSize:m,seamBlur:_,seamSteps:y,seamStrength:v,tileSize:g,infillMethod:b,clipSkip:S}=e.generation;if(!s)throw r.error("No model found in state"),new Error("No model found in state");const{width:w,height:x}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:T,boundingBoxScaleMethod:P,shouldAutoSave:E}=e.canvas,A=s.model_type.includes("onnx")?gl:qs,$={id:sN,nodes:{[Mi]:{is_intermediate:!E,type:"inpaint",id:Mi,steps:u,width:w,height:x,cfg_scale:a,scheduler:l,image:{image_name:t.image_name},strength:c,fit:d,mask:{image_name:n.image_name},seam_size:m,seam_blur:_,seam_strength:v,seam_steps:y,tile_size:b==="tile"?g:void 0,infill_method:b,inpaint_width:P!=="none"?T.width:void 0,inpaint_height:P!=="none"?T.height:void 0},[Be]:{type:"compel",id:Be,is_intermediate:!0,prompt:i},[qe]:{type:"compel",id:qe,is_intermediate:!0,prompt:o},[A]:{type:A,id:A,is_intermediate:!0,model:s},[rt]:{type:"clip_skip",id:rt,is_intermediate:!0,skipped_layers:S},[xo]:{type:"range_of_size",id:xo,is_intermediate:!0,size:f,step:1},[ar]:{type:"iterate",id:ar,is_intermediate:!0}},edges:[{source:{node_id:A,field:"unet"},destination:{node_id:Mi,field:"unet"}},{source:{node_id:A,field:"clip"},destination:{node_id:rt,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:qe,field:"clip"}},{source:{node_id:qe,field:"conditioning"},destination:{node_id:Mi,field:"negative_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Mi,field:"positive_conditioning"}},{source:{node_id:xo,field:"collection"},destination:{node_id:ar,field:"collection"}},{source:{node_id:ar,field:"item"},destination:{node_id:Mi,field:"seed"}}]};if(Nh(e,$,Mi),Dh(e,$),p){const M={id:$i,type:"rand_int"};$.nodes[$i]=M,$.edges.push({source:{node_id:$i,field:"a"},destination:{node_id:xo,field:"start"}})}else $.nodes[xo].start=h;return e.system.shouldUseNSFWChecker&&Cl(e,$,Mi),e.system.shouldUseWatermarker&&Tl(e,$,Mi),$},Epe=e=>{const t=fe("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,clipSkip:l,shouldUseCpuNoise:u,shouldUseNoiseSettings:c}=e.generation,{width:d,height:f}=e.canvas.boundingBoxDimensions,{shouldAutoSave:h}=e.canvas;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const p=c?u:qo.shouldUseCpuNoise,m=i.model_type.includes("onnx"),_=m?gl:qs,y={id:_C,nodes:{[Be]:{type:m?"prompt_onnx":"compel",id:Be,is_intermediate:!0,prompt:n},[qe]:{type:m?"prompt_onnx":"compel",id:qe,is_intermediate:!0,prompt:r},[$e]:{type:"noise",id:$e,is_intermediate:!0,width:d,height:f,use_cpu:p},[cn]:{type:m?"t2l_onnx":"t2l",id:cn,is_intermediate:!0,cfg_scale:o,scheduler:s,steps:a},[_]:{type:_,id:_,is_intermediate:!0,model:i},[rt]:{type:"clip_skip",id:rt,is_intermediate:!0,skipped_layers:l},[nt]:{type:m?"l2i_onnx":"l2i",id:nt,is_intermediate:!h}},edges:[{source:{node_id:qe,field:"conditioning"},destination:{node_id:cn,field:"negative_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:cn,field:"positive_conditioning"}},{source:{node_id:_,field:"clip"},destination:{node_id:rt,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:qe,field:"clip"}},{source:{node_id:_,field:"unet"},destination:{node_id:cn,field:"unet"}},{source:{node_id:cn,field:"latents"},destination:{node_id:nt,field:"latents"}},{source:{node_id:$e,field:"noise"},destination:{node_id:cn,field:"noise"}}]};return y.nodes[lt]={id:lt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,height:f,width:d,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:p?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:l},Nh(e,y,cn,_),Dh(e,y,_),Tc(e,y),Yv(e,y,cn),e.system.shouldUseNSFWChecker&&Cl(e,y),e.system.shouldUseWatermarker&&Tl(e,y),y},Ppe=(e,t,n,r)=>{let i;if(t==="txt2img")i=Epe(e);else if(t==="img2img"){if(!n)throw new Error("Missing canvas init image");i=Cpe(e,n)}else{if(!n||!r)throw new Error("Missing canvas init and mask images");i=Tpe(e,n,r)}return i},Ape=()=>{le({predicate:e=>Ah.match(e)&&e.payload==="unifiedCanvas",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=fe("session"),o=t(),{layerState:s,boundingBoxCoordinates:a,boundingBoxDimensions:l,isMaskEnabled:u,shouldPreserveMaskedArea:c}=o.canvas,d=await bpe(s,a,l,u,c);if(!d){i.error("Unable to create canvas data");return}const{baseBlob:f,baseImageData:h,maskBlob:p,maskImageData:m}=d,_=wpe(h,m);if(o.system.enableImageDebugging){const x=await QE(f),T=await QE(p);vce([{base64:T,caption:"mask b64"},{base64:x,caption:"image b64"}])}i.debug(`Generation mode: ${_}`);let y,v;["img2img","inpaint","outpaint"].includes(_)&&(y=await n(he.endpoints.uploadImage.initiate({file:new File([f],"canvasInitImage.png",{type:"image/png"}),image_category:"general",is_intermediate:!0})).unwrap()),["inpaint","outpaint"].includes(_)&&(v=await n(he.endpoints.uploadImage.initiate({file:new File([p],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!0})).unwrap());const g=Ppe(o,_,y,v);i.debug({graph:ia(g)},"Canvas graph built"),n(YI(g));const{requestId:b}=n(kn({graph:g})),[S]=await r(x=>kn.fulfilled.match(x)&&x.meta.requestId===b),w=S.payload.id;["img2img","inpaint"].includes(_)&&y&&n(he.endpoints.changeImageSessionId.initiate({imageDTO:y,session_id:w})),["inpaint"].includes(_)&&v&&n(he.endpoints.changeImageSessionId.initiate({imageDTO:v,session_id:w})),o.canvas.layerState.stagingArea.boundingBox||n(UQ({sessionId:w,boundingBox:{...o.canvas.boundingBoxCoordinates,...o.canvas.boundingBoxDimensions}})),n(GQ(w)),n(pl())}})},kpe=e=>{const t=fe("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,initialImage:l,img2imgStrength:u,shouldFitToWidthHeight:c,width:d,height:f,clipSkip:h,shouldUseCpuNoise:p,shouldUseNoiseSettings:m,vaePrecision:_}=e.generation;if(!l)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const y=m?p:qo.shouldUseCpuNoise,v=i.model_type.includes("onnx"),g=v?gl:qs,b={id:Qm,nodes:{[g]:{type:g,id:g,model:i},[rt]:{type:"clip_skip",id:rt,skipped_layers:h},[Be]:{type:v?"prompt_onnx":"compel",id:Be,prompt:n},[qe]:{type:v?"prompt_onnx":"compel",id:qe,prompt:r},[$e]:{type:"noise",id:$e,use_cpu:y},[nt]:{type:v?"l2i_onnx":"l2i",id:nt,fp32:_==="fp32"},[Wt]:{type:v?"l2l_onnx":"l2l",id:Wt,cfg_scale:o,scheduler:s,steps:a,strength:u},[vt]:{type:v?"i2l_onnx":"i2l",id:vt,fp32:_==="fp32"}},edges:[{source:{node_id:g,field:"unet"},destination:{node_id:Wt,field:"unet"}},{source:{node_id:g,field:"clip"},destination:{node_id:rt,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:qe,field:"clip"}},{source:{node_id:Wt,field:"latents"},destination:{node_id:nt,field:"latents"}},{source:{node_id:vt,field:"latents"},destination:{node_id:Wt,field:"latents"}},{source:{node_id:$e,field:"noise"},destination:{node_id:Wt,field:"noise"}},{source:{node_id:qe,field:"conditioning"},destination:{node_id:Wt,field:"negative_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Wt,field:"positive_conditioning"}}]};if(c&&(l.width!==d||l.height!==f)){const S={id:Yn,type:"img_resize",image:{image_name:l.imageName},is_intermediate:!0,width:d,height:f};b.nodes[Yn]=S,b.edges.push({source:{node_id:Yn,field:"image"},destination:{node_id:vt,field:"image"}}),b.edges.push({source:{node_id:Yn,field:"width"},destination:{node_id:$e,field:"width"}}),b.edges.push({source:{node_id:Yn,field:"height"},destination:{node_id:$e,field:"height"}})}else b.nodes[vt].image={image_name:l.imageName},b.edges.push({source:{node_id:vt,field:"width"},destination:{node_id:$e,field:"width"}}),b.edges.push({source:{node_id:vt,field:"height"},destination:{node_id:$e,field:"height"}});return b.nodes[lt]={id:lt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:o,height:f,width:d,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:y?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:h,strength:u,init_image:l.imageName},Nh(e,b,Wt,g),Dh(e,b,g),Tc(e,b),Yv(e,b,Wt),e.system.shouldUseNSFWChecker&&Cl(e,b),e.system.shouldUseWatermarker&&Tl(e,b),b},UN=(e,t,n)=>{const{positivePrompt:r,negativePrompt:i}=e.generation,{refinerModel:o,refinerAestheticScore:s,positiveStylePrompt:a,negativeStylePrompt:l,refinerSteps:u,refinerScheduler:c,refinerCFGScale:d,refinerStart:f}=e.sdxl;if(!o)return;const h=t.nodes[lt];h&&(h.refiner_model=o,h.refiner_aesthetic_store=s,h.refiner_cfg_scale=d,h.refiner_scheduler=c,h.refiner_start=f,h.refiner_steps=u),t.edges=t.edges.filter(p=>!(p.source.node_id===n&&["latents"].includes(p.source.field))),t.edges=t.edges.filter(p=>!(p.source.node_id===Jt&&["vae"].includes(p.source.field))),n===Ii&&t.edges.push({source:{node_id:Jt,field:"vae"},destination:{node_id:vt,field:"vae"}}),t.nodes[Gl]={type:"sdxl_refiner_model_loader",id:Gl,model:o},t.nodes[Ip]={type:"sdxl_refiner_compel_prompt",id:Ip,style:`${r} ${a}`,aesthetic_score:s},t.nodes[Np]={type:"sdxl_refiner_compel_prompt",id:Np,style:`${i} ${l}`,aesthetic_score:s},t.nodes[ya]={type:"l2l_sdxl",id:ya,cfg_scale:d,steps:u/(1-Math.min(f,.99)),scheduler:c,denoising_start:f,denoising_end:1},t.edges.push({source:{node_id:Gl,field:"unet"},destination:{node_id:ya,field:"unet"}},{source:{node_id:Gl,field:"vae"},destination:{node_id:nt,field:"vae"}},{source:{node_id:Gl,field:"clip2"},destination:{node_id:Ip,field:"clip2"}},{source:{node_id:Gl,field:"clip2"},destination:{node_id:Np,field:"clip2"}},{source:{node_id:Ip,field:"conditioning"},destination:{node_id:ya,field:"positive_conditioning"}},{source:{node_id:Np,field:"conditioning"},destination:{node_id:ya,field:"negative_conditioning"}},{source:{node_id:n,field:"latents"},destination:{node_id:ya,field:"latents"}},{source:{node_id:ya,field:"latents"},destination:{node_id:nt,field:"latents"}})},Ope=e=>{const t=fe("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,initialImage:l,shouldFitToWidthHeight:u,width:c,height:d,clipSkip:f,shouldUseCpuNoise:h,shouldUseNoiseSettings:p,vaePrecision:m}=e.generation,{positiveStylePrompt:_,negativeStylePrompt:y,shouldUseSDXLRefiner:v,refinerStart:g,sdxlImg2ImgDenoisingStrength:b}=e.sdxl;if(!l)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const S=p?h:qo.shouldUseCpuNoise,w={id:pce,nodes:{[Jt]:{type:"sdxl_model_loader",id:Jt,model:i},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:n,style:_},[qe]:{type:"sdxl_compel_prompt",id:qe,prompt:r,style:y},[$e]:{type:"noise",id:$e,use_cpu:S},[nt]:{type:"l2i",id:nt,fp32:m==="fp32"},[Ii]:{type:"l2l_sdxl",id:Ii,cfg_scale:o,scheduler:s,steps:a,denoising_start:v?Math.min(g,1-b):1-b,denoising_end:v?g:1},[vt]:{type:"i2l",id:vt,fp32:m==="fp32"}},edges:[{source:{node_id:Jt,field:"unet"},destination:{node_id:Ii,field:"unet"}},{source:{node_id:Jt,field:"vae"},destination:{node_id:nt,field:"vae"}},{source:{node_id:Jt,field:"vae"},destination:{node_id:vt,field:"vae"}},{source:{node_id:Jt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Jt,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:Jt,field:"clip"},destination:{node_id:qe,field:"clip"}},{source:{node_id:Jt,field:"clip2"},destination:{node_id:qe,field:"clip2"}},{source:{node_id:Ii,field:"latents"},destination:{node_id:nt,field:"latents"}},{source:{node_id:vt,field:"latents"},destination:{node_id:Ii,field:"latents"}},{source:{node_id:$e,field:"noise"},destination:{node_id:Ii,field:"noise"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Ii,field:"positive_conditioning"}},{source:{node_id:qe,field:"conditioning"},destination:{node_id:Ii,field:"negative_conditioning"}}]};if(u&&(l.width!==c||l.height!==d)){const x={id:Yn,type:"img_resize",image:{image_name:l.imageName},is_intermediate:!0,width:c,height:d};w.nodes[Yn]=x,w.edges.push({source:{node_id:Yn,field:"image"},destination:{node_id:vt,field:"image"}}),w.edges.push({source:{node_id:Yn,field:"width"},destination:{node_id:$e,field:"width"}}),w.edges.push({source:{node_id:Yn,field:"height"},destination:{node_id:$e,field:"height"}})}else w.nodes[vt].image={image_name:l.imageName},w.edges.push({source:{node_id:vt,field:"width"},destination:{node_id:$e,field:"width"}}),w.edges.push({source:{node_id:vt,field:"height"},destination:{node_id:$e,field:"height"}});return w.nodes[lt]={id:lt,type:"metadata_accumulator",generation_mode:"sdxl_img2img",cfg_scale:o,height:d,width:c,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:S?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:f,strength:b,init_image:l.imageName,positive_style_prompt:_,negative_style_prompt:y},w.edges.push({source:{node_id:lt,field:"metadata"},destination:{node_id:nt,field:"metadata"}}),v&&UN(e,w,Ii),Tc(e,w),e.system.shouldUseNSFWChecker&&Cl(e,w),e.system.shouldUseWatermarker&&Tl(e,w),w},Rpe=()=>{le({predicate:e=>Ah.match(e)&&e.payload==="img2img",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=fe("session"),o=t(),s=o.generation.model;let a;s&&s.base_model==="sdxl"?a=Ope(o):a=kpe(o),n(XI(a)),i.debug({graph:ia(a)},"Image to Image graph built"),n(kn({graph:a})),await r(kn.fulfilled.match),n(pl())}})};let Vp;const Mpe=new Uint8Array(16);function Ipe(){if(!Vp&&(Vp=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Vp))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Vp(Mpe)}const xn=[];for(let e=0;e<256;++e)xn.push((e+256).toString(16).slice(1));function Npe(e,t=0){return(xn[e[t+0]]+xn[e[t+1]]+xn[e[t+2]]+xn[e[t+3]]+"-"+xn[e[t+4]]+xn[e[t+5]]+"-"+xn[e[t+6]]+xn[e[t+7]]+"-"+xn[e[t+8]]+xn[e[t+9]]+"-"+xn[e[t+10]]+xn[e[t+11]]+xn[e[t+12]]+xn[e[t+13]]+xn[e[t+14]]+xn[e[t+15]]).toLowerCase()}const Dpe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),I6={randomUUID:Dpe};function Lpe(e,t,n){if(I6.randomUUID&&!t&&!e)return I6.randomUUID();e=e||{};const r=e.random||(e.rng||Ipe)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return Npe(r)}const $pe=e=>{if(e.type==="color"&&e.value){const t=Dn(e.value),{r:n,g:r,b:i,a:o}=e.value,s=Math.max(0,Math.min(o*255,255));return Object.assign(t,{r:n,g:r,b:i,a:s}),t}return e.value},Fpe=e=>{const{nodes:t,edges:n}=e.nodes,i=t.filter(a=>a.type!=="progress_image").reduce((a,l)=>{const{id:u,data:c}=l,{type:d,inputs:f}=c,h=$x(f,(m,_,y)=>{const v=$pe(_);return m[y]=v,m},{}),p={type:d,id:u,...h};return Object.assign(a,{[u]:p}),a},{}),o=n.reduce((a,l)=>{const{source:u,target:c,sourceHandle:d,targetHandle:f}=l;return a.push({source:{node_id:u,field:d},destination:{node_id:c,field:f}}),a},[]);return o.forEach(a=>{const l=i[a.destination.node_id],u=a.destination.field;i[a.destination.node_id]=x0(l,u)}),{id:Lpe(),nodes:i,edges:o}},Bpe=()=>{le({predicate:e=>Ah.match(e)&&e.payload==="nodes",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=fe("session"),o=t(),s=Fpe(o);n(QI(s)),i.debug({graph:ia(s)},"Nodes graph built"),n(kn({graph:s})),await r(kn.fulfilled.match),n(pl())}})},jpe=e=>{const t=fe("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,width:l,height:u,clipSkip:c,shouldUseCpuNoise:d,shouldUseNoiseSettings:f,vaePrecision:h}=e.generation,{positiveStylePrompt:p,negativeStylePrompt:m,shouldUseSDXLRefiner:_,refinerStart:y}=e.sdxl,v=f?d:qo.shouldUseCpuNoise;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const g={id:hce,nodes:{[Jt]:{type:"sdxl_model_loader",id:Jt,model:i},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:n,style:p},[qe]:{type:"sdxl_compel_prompt",id:qe,prompt:r,style:m},[$e]:{type:"noise",id:$e,width:l,height:u,use_cpu:v},[rs]:{type:"t2l_sdxl",id:rs,cfg_scale:o,scheduler:s,steps:a,denoising_end:_?y:1},[nt]:{type:"l2i",id:nt,fp32:h==="fp32"}},edges:[{source:{node_id:Jt,field:"unet"},destination:{node_id:rs,field:"unet"}},{source:{node_id:Jt,field:"vae"},destination:{node_id:nt,field:"vae"}},{source:{node_id:Jt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Jt,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:Jt,field:"clip"},destination:{node_id:qe,field:"clip"}},{source:{node_id:Jt,field:"clip2"},destination:{node_id:qe,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:rs,field:"positive_conditioning"}},{source:{node_id:qe,field:"conditioning"},destination:{node_id:rs,field:"negative_conditioning"}},{source:{node_id:$e,field:"noise"},destination:{node_id:rs,field:"noise"}},{source:{node_id:rs,field:"latents"},destination:{node_id:nt,field:"latents"}}]};return g.nodes[lt]={id:lt,type:"metadata_accumulator",generation_mode:"sdxl_txt2img",cfg_scale:o,height:u,width:l,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:v?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:c,positive_style_prompt:p,negative_style_prompt:m},g.edges.push({source:{node_id:lt,field:"metadata"},destination:{node_id:nt,field:"metadata"}}),_&&UN(e,g,rs),Tc(e,g),e.system.shouldUseNSFWChecker&&Cl(e,g),e.system.shouldUseWatermarker&&Tl(e,g),g},Vpe=e=>{const t=fe("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,width:l,height:u,clipSkip:c,shouldUseCpuNoise:d,shouldUseNoiseSettings:f,vaePrecision:h}=e.generation,p=f?d:qo.shouldUseCpuNoise;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const m=i.model_type.includes("onnx"),_=m?gl:qs,y={id:_C,nodes:{[_]:{type:_,id:_,model:i},[rt]:{type:"clip_skip",id:rt,skipped_layers:c},[Be]:{type:m?"prompt_onnx":"compel",id:Be,prompt:n},[qe]:{type:m?"prompt_onnx":"compel",id:qe,prompt:r},[$e]:{type:"noise",id:$e,width:l,height:u,use_cpu:p},[cn]:{type:m?"t2l_onnx":"t2l",id:cn,cfg_scale:o,scheduler:s,steps:a},[nt]:{type:m?"l2i_onnx":"l2i",id:nt,fp32:h==="fp32"}},edges:[{source:{node_id:_,field:"clip"},destination:{node_id:rt,field:"clip"}},{source:{node_id:_,field:"unet"},destination:{node_id:cn,field:"unet"}},{source:{node_id:rt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:qe,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:cn,field:"positive_conditioning"}},{source:{node_id:qe,field:"conditioning"},destination:{node_id:cn,field:"negative_conditioning"}},{source:{node_id:cn,field:"latents"},destination:{node_id:nt,field:"latents"}},{source:{node_id:$e,field:"noise"},destination:{node_id:cn,field:"noise"}}]};return y.nodes[lt]={id:lt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,height:u,width:l,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:p?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:c},Nh(e,y,cn,_),Dh(e,y,_),Tc(e,y),Yv(e,y,cn),e.system.shouldUseNSFWChecker&&Cl(e,y),e.system.shouldUseWatermarker&&Tl(e,y),y},zpe=()=>{le({predicate:e=>Ah.match(e)&&e.payload==="txt2img",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=fe("session"),o=t(),s=o.generation.model;let a;s&&s.base_model==="sdxl"?a=jpe(o):a=Vpe(o),n(KI(a)),i.debug({graph:ia(a)},"Text to Image graph built"),n(kn({graph:a})),await r(kn.fulfilled.match),n(pl())}})},GN=Xk(),le=GN.startListening;Jle();eue();rue();Hle();qle();Wle();Kle();xle();Zle();Ape();Bpe();zpe();Rpe();Xue();Fle();Dle();Ile();$le();uce();yle();Zue();Jue();tce();nce();ice();Yue();Que();ace();lce();oce();sce();rce();Uue();Gue();Hue();que();Wue();Kue();jue();Vue();zue();Vle();jle();zle();Ule();Yle();Qle();Cle();Nue();Xle();iue();Sle();sue();ble();vle();yce();dce();const Upe={canvas:HQ,gallery:dJ,generation:xQ,nodes:Xse,postprocessing:Yse,system:xae,config:aY,ui:TQ,hotkeys:Pae,controlNet:sJ,boards:cJ,dynamicPrompts:lJ,imageDeletion:gJ,lora:yJ,modelmanager:Eae,sdxl:Jse,[Gs.reducerPath]:Gs.reducer},Gpe=mc(Upe),Hpe=Zae(Gpe),qpe=["canvas","gallery","generation","sdxl","nodes","postprocessing","system","ui","controlNet","dynamicPrompts","lora","modelmanager"],Wpe=kk({reducer:Hpe,enhancers:e=>e.concat(Jae(window.localStorage,qpe,{persistDebounce:300,serialize:cle,unserialize:fle,prefix:ele})).concat(Qk()),middleware:e=>e({immutableCheck:!1,serializableCheck:!1}).concat(Gs.middleware).concat(Rae).prepend(GN.middleware),devTools:{actionSanitizer:ple,stateSanitizer:mle,trace:!0,predicate:(e,t)=>!gle.includes(t.type)}}),l4e=e=>e;function Kpe(e){if(e.sheet)return e.sheet;for(var t=0;t0?En(Ec,--br):0,cc--,Kt===10&&(cc=1,Zv--),Kt}function Pr(){return Kt=br2||zf(Kt)>3?"":" "}function age(e,t){for(;--t&&Pr()&&!(Kt<48||Kt>102||Kt>57&&Kt<65||Kt>70&&Kt<97););return Lh(e,xg()+(t<6&&Qi()==32&&Pr()==32))}function E2(e){for(;Pr();)switch(Kt){case e:return br;case 34:case 39:e!==34&&e!==39&&E2(Kt);break;case 40:e===41&&E2(e);break;case 92:Pr();break}return br}function lge(e,t){for(;Pr()&&e+Kt!==47+10;)if(e+Kt===42+42&&Qi()===47)break;return"/*"+Lh(t,br-1)+"*"+Qv(e===47?e:Pr())}function uge(e){for(;!zf(Qi());)Pr();return Lh(e,br)}function cge(e){return YN(Tg("",null,null,null,[""],e=XN(e),0,[0],e))}function Tg(e,t,n,r,i,o,s,a,l){for(var u=0,c=0,d=s,f=0,h=0,p=0,m=1,_=1,y=1,v=0,g="",b=i,S=o,w=r,x=g;_;)switch(p=v,v=Pr()){case 40:if(p!=108&&En(x,d-1)==58){T2(x+=He(Cg(v),"&","&\f"),"&\f")!=-1&&(y=-1);break}case 34:case 39:case 91:x+=Cg(v);break;case 9:case 10:case 13:case 32:x+=sge(p);break;case 92:x+=age(xg()-1,7);continue;case 47:switch(Qi()){case 42:case 47:zp(dge(lge(Pr(),xg()),t,n),l);break;default:x+="/"}break;case 123*m:a[u++]=Fi(x)*y;case 125*m:case 59:case 0:switch(v){case 0:case 125:_=0;case 59+c:y==-1&&(x=He(x,/\f/g,"")),h>0&&Fi(x)-d&&zp(h>32?D6(x+";",r,n,d-1):D6(He(x," ","")+";",r,n,d-2),l);break;case 59:x+=";";default:if(zp(w=N6(x,t,n,u,c,i,a,g,b=[],S=[],d),o),v===123)if(c===0)Tg(x,t,w,w,b,o,d,a,S);else switch(f===99&&En(x,3)===110?100:f){case 100:case 108:case 109:case 115:Tg(e,w,w,r&&zp(N6(e,w,w,0,0,i,a,g,i,b=[],d),S),i,S,d,a,r?b:S);break;default:Tg(x,w,w,w,[""],S,0,a,S)}}u=c=h=0,m=y=1,g=x="",d=s;break;case 58:d=1+Fi(x),h=p;default:if(m<1){if(v==123)--m;else if(v==125&&m++==0&&oge()==125)continue}switch(x+=Qv(v),v*m){case 38:y=c>0?1:(x+="\f",-1);break;case 44:a[u++]=(Fi(x)-1)*y,y=1;break;case 64:Qi()===45&&(x+=Cg(Pr())),f=Qi(),c=d=Fi(g=x+=uge(xg())),v++;break;case 45:p===45&&Fi(x)==2&&(m=0)}}return o}function N6(e,t,n,r,i,o,s,a,l,u,c){for(var d=i-1,f=i===0?o:[""],h=FC(f),p=0,m=0,_=0;p0?f[y]+" "+v:He(v,/&\f/g,f[y])))&&(l[_++]=g);return Jv(e,t,n,i===0?LC:a,l,u,c)}function dge(e,t,n){return Jv(e,t,n,HN,Qv(ige()),Vf(e,2,-2),0)}function D6(e,t,n,r){return Jv(e,t,n,$C,Vf(e,0,r),Vf(e,r+1,-1),r)}function Fu(e,t){for(var n="",r=FC(e),i=0;i6)switch(En(e,t+1)){case 109:if(En(e,t+4)!==45)break;case 102:return He(e,/(.+:)(.+)-([^]+)/,"$1"+Ge+"$2-$3$1"+ny+(En(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~T2(e,"stretch")?ZN(He(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(En(e,t+1)!==115)break;case 6444:switch(En(e,Fi(e)-3-(~T2(e,"!important")&&10))){case 107:return He(e,":",":"+Ge)+e;case 101:return He(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Ge+(En(e,14)===45?"inline-":"")+"box$3$1"+Ge+"$2$3$1"+Nn+"$2box$3")+e}break;case 5936:switch(En(e,t+11)){case 114:return Ge+e+Nn+He(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Ge+e+Nn+He(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Ge+e+Nn+He(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Ge+e+Nn+e+e}return e}var _ge=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case $C:t.return=ZN(t.value,t.length);break;case qN:return Fu([id(t,{value:He(t.value,"@","@"+Ge)})],i);case LC:if(t.length)return rge(t.props,function(o){switch(nge(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Fu([id(t,{props:[He(o,/:(read-\w+)/,":"+ny+"$1")]})],i);case"::placeholder":return Fu([id(t,{props:[He(o,/:(plac\w+)/,":"+Ge+"input-$1")]}),id(t,{props:[He(o,/:(plac\w+)/,":"+ny+"$1")]}),id(t,{props:[He(o,/:(plac\w+)/,Nn+"input-$1")]})],i)}return""})}},Sge=[_ge],wge=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(m){var _=m.getAttribute("data-emotion");_.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var i=t.stylisPlugins||Sge,o={},s,a=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var _=m.getAttribute("data-emotion").split(" "),y=1;y<_.length;y++)o[_[y]]=!0;a.push(m)});var l,u=[vge,bge];{var c,d=[fge,pge(function(m){c.insert(m)})],f=hge(u.concat(i,d)),h=function(_){return Fu(cge(_),f)};l=function(_,y,v,g){c=v,h(_?_+"{"+y.styles+"}":y.styles),g&&(p.inserted[y.name]=!0)}}var p={key:n,sheet:new Ype({key:n,container:s,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:l};return p.sheet.hydrate(a),p},xge=!0;function Cge(e,t,n){var r="";return n.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):r+=i+" "}),r}var JN=function(t,n,r){var i=t.key+"-"+n.name;(r===!1||xge===!1)&&t.registered[i]===void 0&&(t.registered[i]=n.styles)},eD=function(t,n,r){JN(t,n,r);var i=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var o=n;do t.insert(n===o?"."+i:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function Tge(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var Ege={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Pge=/[A-Z]|^ms/g,Age=/_EMO_([^_]+?)_([^]*?)_EMO_/g,tD=function(t){return t.charCodeAt(1)===45},F6=function(t){return t!=null&&typeof t!="boolean"},t_=QN(function(e){return tD(e)?e:e.replace(Pge,"-$&").toLowerCase()}),B6=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(Age,function(r,i,o){return Bi={name:i,styles:o,next:Bi},i})}return Ege[t]!==1&&!tD(t)&&typeof n=="number"&&n!==0?n+"px":n};function Uf(e,t,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return Bi={name:n.name,styles:n.styles,next:Bi},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)Bi={name:r.name,styles:r.styles,next:Bi},r=r.next;var i=n.styles+";";return i}return kge(e,t,n)}case"function":{if(e!==void 0){var o=Bi,s=n(e);return Bi=o,Uf(e,t,s)}break}}if(t==null)return n;var a=t[n];return a!==void 0?a:n}function kge(e,t,n){var r="";if(Array.isArray(n))for(var i=0;i` or ``");return e}var sD=k.createContext({});sD.displayName="ColorModeContext";function jC(){const e=k.useContext(sD);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function d4e(e,t){const{colorMode:n}=jC();return n==="dark"?t:e}function $ge(){const e=jC(),t=oD();return{...e,theme:t}}function Fge(e,t,n){var r,i;if(t==null)return t;const o=s=>{var a,l;return(l=(a=e.__breakpoints)==null?void 0:a.asArray)==null?void 0:l[s]};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function Bge(e,t,n){var r,i;if(t==null)return t;const o=s=>{var a,l;return(l=(a=e.__cssMap)==null?void 0:a[s])==null?void 0:l.value};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function f4e(e,t,n){const r=oD();return jge(e,t,n)(r)}function jge(e,t,n){const r=Array.isArray(t)?t:[t],i=Array.isArray(n)?n:[n];return o=>{const s=i.filter(Boolean),a=r.map((l,u)=>{var c,d;if(e==="breakpoints")return Fge(o,l,(c=s[u])!=null?c:l);const f=`${e}.${l}`;return Bge(o,f,(d=s[u])!=null?d:l)});return Array.isArray(t)?a:a[0]}}var aD=(...e)=>e.filter(Boolean).join(" ");function Vge(){return!1}function Ro(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}var h4e=e=>{const{condition:t,message:n}=e;t&&Vge()&&console.warn(n)};function Da(e,...t){return zge(e)?e(...t):e}var zge=e=>typeof e=="function",p4e=e=>e?"":void 0,g4e=e=>e?!0:void 0;function m4e(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function y4e(...e){return function(n){e.forEach(r=>{r==null||r(n)})}}var ry={exports:{}};ry.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,s=9007199254740991,a="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",h="[object Function]",p="[object GeneratorFunction]",m="[object Map]",_="[object Number]",y="[object Null]",v="[object Object]",g="[object Proxy]",b="[object RegExp]",S="[object Set]",w="[object String]",x="[object Undefined]",T="[object WeakMap]",P="[object ArrayBuffer]",E="[object DataView]",A="[object Float32Array]",$="[object Float64Array]",M="[object Int8Array]",C="[object Int16Array]",O="[object Int32Array]",I="[object Uint8Array]",N="[object Uint8ClampedArray]",R="[object Uint16Array]",D="[object Uint32Array]",L=/[\\^$.*+?()[\]{}|]/g,j=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,G={};G[A]=G[$]=G[M]=G[C]=G[O]=G[I]=G[N]=G[R]=G[D]=!0,G[a]=G[l]=G[P]=G[c]=G[E]=G[d]=G[f]=G[h]=G[m]=G[_]=G[v]=G[b]=G[S]=G[w]=G[T]=!1;var W=typeof Ee=="object"&&Ee&&Ee.Object===Object&&Ee,X=typeof self=="object"&&self&&self.Object===Object&&self,Y=W||X||Function("return this")(),B=t&&!t.nodeType&&t,H=B&&!0&&e&&!e.nodeType&&e,Q=H&&H.exports===B,J=Q&&W.process,ne=function(){try{var F=H&&H.require&&H.require("util").types;return F||J&&J.binding&&J.binding("util")}catch{}}(),te=ne&&ne.isTypedArray;function xe(F,V,q){switch(q.length){case 0:return F.call(V);case 1:return F.call(V,q[0]);case 2:return F.call(V,q[0],q[1]);case 3:return F.call(V,q[0],q[1],q[2])}return F.apply(V,q)}function ve(F,V){for(var q=-1,ie=Array(F);++q-1}function co(F,V){var q=this.__data__,ie=Ol(q,F);return ie<0?(++this.size,q.push([F,V])):q[ie][1]=V,this}Sn.prototype.clear=uo,Sn.prototype.delete=Qo,Sn.prototype.get=Zo,Sn.prototype.has=kl,Sn.prototype.set=co;function Hn(F){var V=-1,q=F==null?0:F.length;for(this.clear();++V1?q[De-1]:void 0,gt=De>2?q[2]:void 0;for(tt=F.length>3&&typeof tt=="function"?(De--,tt):void 0,gt&&U$(q[0],q[1],gt)&&(tt=De<3?void 0:tt,De=1),V=Object(V);++ie-1&&F%1==0&&F0){if(++V>=i)return arguments[0]}else V=0;return F.apply(void 0,arguments)}}function Q$(F){if(F!=null){try{return Je.call(F)}catch{}try{return F+""}catch{}}return""}function Xh(F,V){return F===V||F!==F&&V!==V}var k1=Wh(function(){return arguments}())?Wh:function(F){return Mc(F)&&Ut.call(F,"callee")&&!ni.call(F,"callee")},O1=Array.isArray;function R1(F){return F!=null&&O3(F.length)&&!M1(F)}function Z$(F){return Mc(F)&&R1(F)}var k3=da||rF;function M1(F){if(!pa(F))return!1;var V=Ml(F);return V==h||V==p||V==u||V==g}function O3(F){return typeof F=="number"&&F>-1&&F%1==0&&F<=s}function pa(F){var V=typeof F;return F!=null&&(V=="object"||V=="function")}function Mc(F){return F!=null&&typeof F=="object"}function J$(F){if(!Mc(F)||Ml(F)!=v)return!1;var V=Sr(F);if(V===null)return!0;var q=Ut.call(V,"constructor")&&V.constructor;return typeof q=="function"&&q instanceof q&&Je.call(q)==Dr}var R3=te?ce(te):Rc;function eF(F){return F$(F,M3(F))}function M3(F){return R1(F)?x1(F,!0):O$(F)}var tF=B$(function(F,V,q,ie){E3(F,V,q,ie)});function nF(F){return function(){return F}}function I3(F){return F}function rF(){return!1}e.exports=tF})(ry,ry.exports);var Uge=ry.exports;const qi=ll(Uge);var Gge=e=>/!(important)?$/.test(e),z6=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,Hge=(e,t)=>n=>{const r=String(t),i=Gge(r),o=z6(r),s=e?`${e}.${o}`:o;let a=Ro(n.__cssMap)&&s in n.__cssMap?n.__cssMap[s].varRef:t;return a=z6(a),i?`${a} !important`:a};function VC(e){const{scale:t,transform:n,compose:r}=e;return(o,s)=>{var a;const l=Hge(t,o)(s);let u=(a=n==null?void 0:n(l,s))!=null?a:l;return r&&(u=r(u,s)),u}}var Up=(...e)=>t=>e.reduce((n,r)=>r(n),t);function Br(e,t){return n=>{const r={property:n,scale:e};return r.transform=VC({scale:e,transform:t}),r}}var qge=({rtl:e,ltr:t})=>n=>n.direction==="rtl"?e:t;function Wge(e){const{property:t,scale:n,transform:r}=e;return{scale:n,property:qge(t),transform:n?VC({scale:n,compose:r}):r}}var lD=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function Kge(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...lD].join(" ")}function Xge(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...lD].join(" ")}var Yge={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},Qge={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function Zge(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var Jge={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},P2={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},eme=new Set(Object.values(P2)),A2=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),tme=e=>e.trim();function nme(e,t){if(e==null||A2.has(e))return e;if(!(k2(e)||A2.has(e)))return`url('${e}')`;const i=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),o=i==null?void 0:i[1],s=i==null?void 0:i[2];if(!o||!s)return e;const a=o.includes("-gradient")?o:`${o}-gradient`,[l,...u]=s.split(",").map(tme).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const c=l in P2?P2[l]:l;u.unshift(c);const d=u.map(f=>{if(eme.has(f))return f;const h=f.indexOf(" "),[p,m]=h!==-1?[f.substr(0,h),f.substr(h+1)]:[f],_=k2(m)?m:m&&m.split(" "),y=`colors.${p}`,v=y in t.__cssMap?t.__cssMap[y].varRef:p;return _?[v,...Array.isArray(_)?_:[_]].join(" "):v});return`${a}(${d.join(", ")})`}var k2=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),rme=(e,t)=>nme(e,t??{});function ime(e){return/^var\(--.+\)$/.test(e)}var ome=e=>{const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}},Ri=e=>t=>`${e}(${t})`,je={filter(e){return e!=="auto"?e:Yge},backdropFilter(e){return e!=="auto"?e:Qge},ring(e){return Zge(je.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?Kge():e==="auto-gpu"?Xge():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=ome(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const n={left:"right",right:"left"};return t.direction==="rtl"?n[e]:e},degree(e){if(ime(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:rme,blur:Ri("blur"),opacity:Ri("opacity"),brightness:Ri("brightness"),contrast:Ri("contrast"),dropShadow:Ri("drop-shadow"),grayscale:Ri("grayscale"),hueRotate:Ri("hue-rotate"),invert:Ri("invert"),saturate:Ri("saturate"),sepia:Ri("sepia"),bgImage(e){return e==null||k2(e)||A2.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:n,divide:r}=(t=Jge[e])!=null?t:{},i={flexDirection:e};return n&&(i[n]=1),r&&(i[r]=1),i}},z={borderWidths:Br("borderWidths"),borderStyles:Br("borderStyles"),colors:Br("colors"),borders:Br("borders"),gradients:Br("gradients",je.gradient),radii:Br("radii",je.px),space:Br("space",Up(je.vh,je.px)),spaceT:Br("space",Up(je.vh,je.px)),degreeT(e){return{property:e,transform:je.degree}},prop(e,t,n){return{property:e,scale:t,...t&&{transform:VC({scale:t,transform:n})}}},propT(e,t){return{property:e,transform:t}},sizes:Br("sizes",Up(je.vh,je.px)),sizesT:Br("sizes",Up(je.vh,je.fraction)),shadows:Br("shadows"),logical:Wge,blur:Br("blur",je.blur)},Eg={background:z.colors("background"),backgroundColor:z.colors("backgroundColor"),backgroundImage:z.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:je.bgClip},bgSize:z.prop("backgroundSize"),bgPosition:z.prop("backgroundPosition"),bg:z.colors("background"),bgColor:z.colors("backgroundColor"),bgPos:z.prop("backgroundPosition"),bgRepeat:z.prop("backgroundRepeat"),bgAttachment:z.prop("backgroundAttachment"),bgGradient:z.gradients("backgroundImage"),bgClip:{transform:je.bgClip}};Object.assign(Eg,{bgImage:Eg.backgroundImage,bgImg:Eg.backgroundImage});var Ue={border:z.borders("border"),borderWidth:z.borderWidths("borderWidth"),borderStyle:z.borderStyles("borderStyle"),borderColor:z.colors("borderColor"),borderRadius:z.radii("borderRadius"),borderTop:z.borders("borderTop"),borderBlockStart:z.borders("borderBlockStart"),borderTopLeftRadius:z.radii("borderTopLeftRadius"),borderStartStartRadius:z.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:z.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:z.radii("borderTopRightRadius"),borderStartEndRadius:z.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:z.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:z.borders("borderRight"),borderInlineEnd:z.borders("borderInlineEnd"),borderBottom:z.borders("borderBottom"),borderBlockEnd:z.borders("borderBlockEnd"),borderBottomLeftRadius:z.radii("borderBottomLeftRadius"),borderBottomRightRadius:z.radii("borderBottomRightRadius"),borderLeft:z.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:z.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:z.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:z.borders(["borderLeft","borderRight"]),borderInline:z.borders("borderInline"),borderY:z.borders(["borderTop","borderBottom"]),borderBlock:z.borders("borderBlock"),borderTopWidth:z.borderWidths("borderTopWidth"),borderBlockStartWidth:z.borderWidths("borderBlockStartWidth"),borderTopColor:z.colors("borderTopColor"),borderBlockStartColor:z.colors("borderBlockStartColor"),borderTopStyle:z.borderStyles("borderTopStyle"),borderBlockStartStyle:z.borderStyles("borderBlockStartStyle"),borderBottomWidth:z.borderWidths("borderBottomWidth"),borderBlockEndWidth:z.borderWidths("borderBlockEndWidth"),borderBottomColor:z.colors("borderBottomColor"),borderBlockEndColor:z.colors("borderBlockEndColor"),borderBottomStyle:z.borderStyles("borderBottomStyle"),borderBlockEndStyle:z.borderStyles("borderBlockEndStyle"),borderLeftWidth:z.borderWidths("borderLeftWidth"),borderInlineStartWidth:z.borderWidths("borderInlineStartWidth"),borderLeftColor:z.colors("borderLeftColor"),borderInlineStartColor:z.colors("borderInlineStartColor"),borderLeftStyle:z.borderStyles("borderLeftStyle"),borderInlineStartStyle:z.borderStyles("borderInlineStartStyle"),borderRightWidth:z.borderWidths("borderRightWidth"),borderInlineEndWidth:z.borderWidths("borderInlineEndWidth"),borderRightColor:z.colors("borderRightColor"),borderInlineEndColor:z.colors("borderInlineEndColor"),borderRightStyle:z.borderStyles("borderRightStyle"),borderInlineEndStyle:z.borderStyles("borderInlineEndStyle"),borderTopRadius:z.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:z.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:z.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:z.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(Ue,{rounded:Ue.borderRadius,roundedTop:Ue.borderTopRadius,roundedTopLeft:Ue.borderTopLeftRadius,roundedTopRight:Ue.borderTopRightRadius,roundedTopStart:Ue.borderStartStartRadius,roundedTopEnd:Ue.borderStartEndRadius,roundedBottom:Ue.borderBottomRadius,roundedBottomLeft:Ue.borderBottomLeftRadius,roundedBottomRight:Ue.borderBottomRightRadius,roundedBottomStart:Ue.borderEndStartRadius,roundedBottomEnd:Ue.borderEndEndRadius,roundedLeft:Ue.borderLeftRadius,roundedRight:Ue.borderRightRadius,roundedStart:Ue.borderInlineStartRadius,roundedEnd:Ue.borderInlineEndRadius,borderStart:Ue.borderInlineStart,borderEnd:Ue.borderInlineEnd,borderTopStartRadius:Ue.borderStartStartRadius,borderTopEndRadius:Ue.borderStartEndRadius,borderBottomStartRadius:Ue.borderEndStartRadius,borderBottomEndRadius:Ue.borderEndEndRadius,borderStartRadius:Ue.borderInlineStartRadius,borderEndRadius:Ue.borderInlineEndRadius,borderStartWidth:Ue.borderInlineStartWidth,borderEndWidth:Ue.borderInlineEndWidth,borderStartColor:Ue.borderInlineStartColor,borderEndColor:Ue.borderInlineEndColor,borderStartStyle:Ue.borderInlineStartStyle,borderEndStyle:Ue.borderInlineEndStyle});var sme={color:z.colors("color"),textColor:z.colors("color"),fill:z.colors("fill"),stroke:z.colors("stroke")},O2={boxShadow:z.shadows("boxShadow"),mixBlendMode:!0,blendMode:z.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:z.prop("backgroundBlendMode"),opacity:!0};Object.assign(O2,{shadow:O2.boxShadow});var ame={filter:{transform:je.filter},blur:z.blur("--chakra-blur"),brightness:z.propT("--chakra-brightness",je.brightness),contrast:z.propT("--chakra-contrast",je.contrast),hueRotate:z.degreeT("--chakra-hue-rotate"),invert:z.propT("--chakra-invert",je.invert),saturate:z.propT("--chakra-saturate",je.saturate),dropShadow:z.propT("--chakra-drop-shadow",je.dropShadow),backdropFilter:{transform:je.backdropFilter},backdropBlur:z.blur("--chakra-backdrop-blur"),backdropBrightness:z.propT("--chakra-backdrop-brightness",je.brightness),backdropContrast:z.propT("--chakra-backdrop-contrast",je.contrast),backdropHueRotate:z.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:z.propT("--chakra-backdrop-invert",je.invert),backdropSaturate:z.propT("--chakra-backdrop-saturate",je.saturate)},iy={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:je.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:z.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:z.space("gap"),rowGap:z.space("rowGap"),columnGap:z.space("columnGap")};Object.assign(iy,{flexDir:iy.flexDirection});var uD={gridGap:z.space("gridGap"),gridColumnGap:z.space("gridColumnGap"),gridRowGap:z.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},lme={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:je.outline},outlineOffset:!0,outlineColor:z.colors("outlineColor")},Vr={width:z.sizesT("width"),inlineSize:z.sizesT("inlineSize"),height:z.sizes("height"),blockSize:z.sizes("blockSize"),boxSize:z.sizes(["width","height"]),minWidth:z.sizes("minWidth"),minInlineSize:z.sizes("minInlineSize"),minHeight:z.sizes("minHeight"),minBlockSize:z.sizes("minBlockSize"),maxWidth:z.sizes("maxWidth"),maxInlineSize:z.sizes("maxInlineSize"),maxHeight:z.sizes("maxHeight"),maxBlockSize:z.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (min-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r.minW)!=null?i:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (max-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r._minW)!=null?i:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:z.propT("float",je.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(Vr,{w:Vr.width,h:Vr.height,minW:Vr.minWidth,maxW:Vr.maxWidth,minH:Vr.minHeight,maxH:Vr.maxHeight,overscroll:Vr.overscrollBehavior,overscrollX:Vr.overscrollBehaviorX,overscrollY:Vr.overscrollBehaviorY});var ume={listStyleType:!0,listStylePosition:!0,listStylePos:z.prop("listStylePosition"),listStyleImage:!0,listStyleImg:z.prop("listStyleImage")};function cme(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,s)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const a=t.get(r);if(a.has(i))return a.get(i);const l=e(r,i,o,s);return a.set(i,l),l}},fme=dme(cme),hme={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},pme={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},n_=(e,t,n)=>{const r={},i=fme(e,t,{});for(const o in i)o in n&&n[o]!=null||(r[o]=i[o]);return r},gme={srOnly:{transform(e){return e===!0?hme:e==="focusable"?pme:{}}},layerStyle:{processResult:!0,transform:(e,t,n)=>n_(t,`layerStyles.${e}`,n)},textStyle:{processResult:!0,transform:(e,t,n)=>n_(t,`textStyles.${e}`,n)},apply:{processResult:!0,transform:(e,t,n)=>n_(t,e,n)}},Rd={position:!0,pos:z.prop("position"),zIndex:z.prop("zIndex","zIndices"),inset:z.spaceT("inset"),insetX:z.spaceT(["left","right"]),insetInline:z.spaceT("insetInline"),insetY:z.spaceT(["top","bottom"]),insetBlock:z.spaceT("insetBlock"),top:z.spaceT("top"),insetBlockStart:z.spaceT("insetBlockStart"),bottom:z.spaceT("bottom"),insetBlockEnd:z.spaceT("insetBlockEnd"),left:z.spaceT("left"),insetInlineStart:z.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:z.spaceT("right"),insetInlineEnd:z.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Rd,{insetStart:Rd.insetInlineStart,insetEnd:Rd.insetInlineEnd});var mme={ring:{transform:je.ring},ringColor:z.colors("--chakra-ring-color"),ringOffset:z.prop("--chakra-ring-offset-width"),ringOffsetColor:z.colors("--chakra-ring-offset-color"),ringInset:z.prop("--chakra-ring-inset")},dt={margin:z.spaceT("margin"),marginTop:z.spaceT("marginTop"),marginBlockStart:z.spaceT("marginBlockStart"),marginRight:z.spaceT("marginRight"),marginInlineEnd:z.spaceT("marginInlineEnd"),marginBottom:z.spaceT("marginBottom"),marginBlockEnd:z.spaceT("marginBlockEnd"),marginLeft:z.spaceT("marginLeft"),marginInlineStart:z.spaceT("marginInlineStart"),marginX:z.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:z.spaceT("marginInline"),marginY:z.spaceT(["marginTop","marginBottom"]),marginBlock:z.spaceT("marginBlock"),padding:z.space("padding"),paddingTop:z.space("paddingTop"),paddingBlockStart:z.space("paddingBlockStart"),paddingRight:z.space("paddingRight"),paddingBottom:z.space("paddingBottom"),paddingBlockEnd:z.space("paddingBlockEnd"),paddingLeft:z.space("paddingLeft"),paddingInlineStart:z.space("paddingInlineStart"),paddingInlineEnd:z.space("paddingInlineEnd"),paddingX:z.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:z.space("paddingInline"),paddingY:z.space(["paddingTop","paddingBottom"]),paddingBlock:z.space("paddingBlock")};Object.assign(dt,{m:dt.margin,mt:dt.marginTop,mr:dt.marginRight,me:dt.marginInlineEnd,marginEnd:dt.marginInlineEnd,mb:dt.marginBottom,ml:dt.marginLeft,ms:dt.marginInlineStart,marginStart:dt.marginInlineStart,mx:dt.marginX,my:dt.marginY,p:dt.padding,pt:dt.paddingTop,py:dt.paddingY,px:dt.paddingX,pb:dt.paddingBottom,pl:dt.paddingLeft,ps:dt.paddingInlineStart,paddingStart:dt.paddingInlineStart,pr:dt.paddingRight,pe:dt.paddingInlineEnd,paddingEnd:dt.paddingInlineEnd});var yme={textDecorationColor:z.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:z.shadows("textShadow")},vme={clipPath:!0,transform:z.propT("transform",je.transform),transformOrigin:!0,translateX:z.spaceT("--chakra-translate-x"),translateY:z.spaceT("--chakra-translate-y"),skewX:z.degreeT("--chakra-skew-x"),skewY:z.degreeT("--chakra-skew-y"),scaleX:z.prop("--chakra-scale-x"),scaleY:z.prop("--chakra-scale-y"),scale:z.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:z.degreeT("--chakra-rotate")},bme={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:z.prop("transitionDuration","transition.duration"),transitionProperty:z.prop("transitionProperty","transition.property"),transitionTimingFunction:z.prop("transitionTimingFunction","transition.easing")},_me={fontFamily:z.prop("fontFamily","fonts"),fontSize:z.prop("fontSize","fontSizes",je.px),fontWeight:z.prop("fontWeight","fontWeights"),lineHeight:z.prop("lineHeight","lineHeights"),letterSpacing:z.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},Sme={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:z.spaceT("scrollMargin"),scrollMarginTop:z.spaceT("scrollMarginTop"),scrollMarginBottom:z.spaceT("scrollMarginBottom"),scrollMarginLeft:z.spaceT("scrollMarginLeft"),scrollMarginRight:z.spaceT("scrollMarginRight"),scrollMarginX:z.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:z.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:z.spaceT("scrollPadding"),scrollPaddingTop:z.spaceT("scrollPaddingTop"),scrollPaddingBottom:z.spaceT("scrollPaddingBottom"),scrollPaddingLeft:z.spaceT("scrollPaddingLeft"),scrollPaddingRight:z.spaceT("scrollPaddingRight"),scrollPaddingX:z.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:z.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function cD(e){return Ro(e)&&e.reference?e.reference:String(e)}var e1=(e,...t)=>t.map(cD).join(` ${e} `).replace(/calc/g,""),U6=(...e)=>`calc(${e1("+",...e)})`,G6=(...e)=>`calc(${e1("-",...e)})`,R2=(...e)=>`calc(${e1("*",...e)})`,H6=(...e)=>`calc(${e1("/",...e)})`,q6=e=>{const t=cD(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:R2(t,-1)},Aa=Object.assign(e=>({add:(...t)=>Aa(U6(e,...t)),subtract:(...t)=>Aa(G6(e,...t)),multiply:(...t)=>Aa(R2(e,...t)),divide:(...t)=>Aa(H6(e,...t)),negate:()=>Aa(q6(e)),toString:()=>e.toString()}),{add:U6,subtract:G6,multiply:R2,divide:H6,negate:q6});function wme(e,t="-"){return e.replace(/\s+/g,t)}function xme(e){const t=wme(e.toString());return Tme(Cme(t))}function Cme(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function Tme(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function Eme(e,t=""){return[t,e].filter(Boolean).join("-")}function Pme(e,t){return`var(${e}${t?`, ${t}`:""})`}function Ame(e,t=""){return xme(`--${Eme(e,t)}`)}function M2(e,t,n){const r=Ame(e,n);return{variable:r,reference:Pme(r,t)}}function v4e(e,t){const n={};for(const r of t){if(Array.isArray(r)){const[i,o]=r;n[i]=M2(`${e}-${i}`,o);continue}n[r]=M2(`${e}-${r}`)}return n}function kme(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function Ome(e){const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}}function I2(e){if(e==null)return e;const{unitless:t}=Ome(e);return t||typeof e=="number"?`${e}px`:e}var dD=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,zC=e=>Object.fromEntries(Object.entries(e).sort(dD));function W6(e){const t=zC(e);return Object.assign(Object.values(t),t)}function Rme(e){const t=Object.keys(zC(e));return new Set(t)}function K6(e){var t;if(!e)return e;e=(t=I2(e))!=null?t:e;const n=-.02;return typeof e=="number"?`${e+n}`:e.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function gd(e,t){const n=["@media screen"];return e&&n.push("and",`(min-width: ${I2(e)})`),t&&n.push("and",`(max-width: ${I2(t)})`),n.join(" ")}function Mme(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const n=W6(e),r=Object.entries(e).sort(dD).map(([s,a],l,u)=>{var c;let[,d]=(c=u[l+1])!=null?c:[];return d=parseFloat(d)>0?K6(d):void 0,{_minW:K6(a),breakpoint:s,minW:a,maxW:d,maxWQuery:gd(null,d),minWQuery:gd(a),minMaxQuery:gd(a,d)}}),i=Rme(e),o=Array.from(i.values());return{keys:i,normalized:n,isResponsive(s){const a=Object.keys(s);return a.length>0&&a.every(l=>i.has(l))},asObject:zC(e),asArray:W6(e),details:r,get(s){return r.find(a=>a.breakpoint===s)},media:[null,...n.map(s=>gd(s)).slice(1)],toArrayValue(s){if(!Ro(s))throw new Error("toArrayValue: value must be an object");const a=o.map(l=>{var u;return(u=s[l])!=null?u:null});for(;kme(a)===null;)a.pop();return a},toObjectValue(s){if(!Array.isArray(s))throw new Error("toObjectValue: value must be an array");return s.reduce((a,l,u)=>{const c=o[u];return c!=null&&l!=null&&(a[c]=l),a},{})}}}var wn={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},is=e=>fD(t=>e(t,"&"),"[role=group]","[data-group]",".group"),go=e=>fD(t=>e(t,"~ &"),"[data-peer]",".peer"),fD=(e,...t)=>t.map(e).join(", "),t1={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:is(wn.hover),_peerHover:go(wn.hover),_groupFocus:is(wn.focus),_peerFocus:go(wn.focus),_groupFocusVisible:is(wn.focusVisible),_peerFocusVisible:go(wn.focusVisible),_groupActive:is(wn.active),_peerActive:go(wn.active),_groupDisabled:is(wn.disabled),_peerDisabled:go(wn.disabled),_groupInvalid:is(wn.invalid),_peerInvalid:go(wn.invalid),_groupChecked:is(wn.checked),_peerChecked:go(wn.checked),_groupFocusWithin:is(wn.focusWithin),_peerFocusWithin:go(wn.focusWithin),_peerPlaceholderShown:go(wn.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},hD=Object.keys(t1);function X6(e,t){return M2(String(e).replace(/\./g,"-"),void 0,t)}function Ime(e,t){let n={};const r={};for(const[i,o]of Object.entries(e)){const{isSemantic:s,value:a}=o,{variable:l,reference:u}=X6(i,t==null?void 0:t.cssVarPrefix);if(!s){if(i.startsWith("space")){const f=i.split("."),[h,...p]=f,m=`${h}.-${p.join(".")}`,_=Aa.negate(a),y=Aa.negate(u);r[m]={value:_,var:l,varRef:y}}n[l]=a,r[i]={value:a,var:l,varRef:u};continue}const c=f=>{const p=[String(i).split(".")[0],f].join(".");if(!e[p])return f;const{reference:_}=X6(p,t==null?void 0:t.cssVarPrefix);return _},d=Ro(a)?a:{default:a};n=qi(n,Object.entries(d).reduce((f,[h,p])=>{var m,_;if(!p)return f;const y=c(`${p}`);if(h==="default")return f[l]=y,f;const v=(_=(m=t1)==null?void 0:m[h])!=null?_:h;return f[v]={[l]:y},f},{})),r[i]={value:u,var:l,varRef:u}}return{cssVars:n,cssMap:r}}function Nme(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function Dme(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Lme(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function Y6(e,t,n={}){const{stop:r,getKey:i}=n;function o(s,a=[]){var l;if(Lme(s)||Array.isArray(s)){const u={};for(const[c,d]of Object.entries(s)){const f=(l=i==null?void 0:i(c))!=null?l:c,h=[...a,f];if(r!=null&&r(s,h))return t(s,a);u[f]=o(d,h)}return u}return t(s,a)}return o(e)}var $me=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function Fme(e){return Dme(e,$me)}function Bme(e){return e.semanticTokens}function jme(e){const{__cssMap:t,__cssVars:n,__breakpoints:r,...i}=e;return i}var Vme=e=>hD.includes(e)||e==="default";function zme({tokens:e,semanticTokens:t}){const n={};return Y6(e,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!1,value:r})}),Y6(t,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!0,value:r})},{stop:r=>Object.keys(r).every(Vme)}),n}function b4e(e){var t;const n=jme(e),r=Fme(n),i=Bme(n),o=zme({tokens:r,semanticTokens:i}),s=(t=n.config)==null?void 0:t.cssVarPrefix,{cssMap:a,cssVars:l}=Ime(o,{cssVarPrefix:s});return Object.assign(n,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...l},__cssMap:a,__breakpoints:Mme(n.breakpoints)}),n}var UC=qi({},Eg,Ue,sme,iy,Vr,ame,mme,lme,uD,gme,Rd,O2,dt,Sme,_me,yme,vme,ume,bme),Ume=Object.assign({},dt,Vr,iy,uD,Rd),_4e=Object.keys(Ume),Gme=[...Object.keys(UC),...hD],Hme={...UC,...t1},qme=e=>e in Hme,Wme=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:n,toArrayValue:r,media:i}=t.__breakpoints,o={};for(const s in e){let a=Da(e[s],t);if(a==null)continue;if(a=Ro(a)&&n(a)?r(a):a,!Array.isArray(a)){o[s]=a;continue}const l=a.slice(0,i.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!Xme(t),Qme=(e,t)=>{var n,r;if(t==null)return t;const i=l=>{var u,c;return(c=(u=e.__cssMap)==null?void 0:u[l])==null?void 0:c.varRef},o=l=>{var u;return(u=i(l))!=null?u:l},[s,a]=Kme(t);return t=(r=(n=i(s))!=null?n:o(a))!=null?r:o(t),t};function Zme(e){const{configs:t={},pseudos:n={},theme:r}=e,i=(o,s=!1)=>{var a,l,u;const c=Da(o,r),d=Wme(c)(r);let f={};for(let h in d){const p=d[h];let m=Da(p,r);h in n&&(h=n[h]),Yme(h,m)&&(m=Qme(r,m));let _=t[h];if(_===!0&&(_={property:h}),Ro(m)){f[h]=(a=f[h])!=null?a:{},f[h]=qi({},f[h],i(m,!0));continue}let y=(u=(l=_==null?void 0:_.transform)==null?void 0:l.call(_,m,r,c))!=null?u:m;y=_!=null&&_.processResult?i(y,!0):y;const v=Da(_==null?void 0:_.property,r);if(!s&&(_!=null&&_.static)){const g=Da(_.static,r);f=qi({},f,g)}if(v&&Array.isArray(v)){for(const g of v)f[g]=y;continue}if(v){v==="&"&&Ro(y)?f=qi({},f,y):f[v]=y;continue}if(Ro(y)){f=qi({},f,y);continue}f[h]=y}return f};return i}var Jme=e=>t=>Zme({theme:t,pseudos:t1,configs:UC})(e);function S4e(e){return e}function w4e(e){return e}function x4e(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function eye(e,t){if(Array.isArray(e))return e;if(Ro(e))return t(e);if(e!=null)return[e]}function tye(e,t){for(let n=t+1;n{qi(u,{[g]:f?v[g]:{[y]:v[g]}})});continue}if(!h){f?qi(u,v):u[y]=v;continue}u[y]=v}}return u}}function rye(e){return t=>{var n;const{variant:r,size:i,theme:o}=t,s=nye(o);return qi({},Da((n=e.baseStyle)!=null?n:{},t),s(e,"sizes",i,t),s(e,"variants",r,t))}}function C4e(e,t,n){var r,i,o;return(o=(i=(r=e.__cssMap)==null?void 0:r[`${t}.${n}`])==null?void 0:i.varRef)!=null?o:n}function pD(e){return Nme(e,["styleConfig","size","variant","colorScheme"])}function iye(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function T4e(e){var t;return iye(e)&&(t=e.ownerDocument)!=null?t:document}function oye(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var sye=oye();function aye(e,t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function lye(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,s)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const a=t.get(r);if(a.has(i))return a.get(i);const l=e(r,i,o,s);return a.set(i,l),l}},cye=uye(lye);function gD(e,t){const n={};return Object.keys(e).forEach(r=>{const i=e[r];t(i,r,e)&&(n[r]=i)}),n}var mD=e=>gD(e,t=>t!=null);function dye(e){return typeof e=="function"}function fye(e,...t){return dye(e)?e(...t):e}function hye(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var pye=typeof Element<"u",gye=typeof Map=="function",mye=typeof Set=="function",yye=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Pg(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Pg(e[r],t[r]))return!1;return!0}var o;if(gye&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;for(o=e.entries();!(r=o.next()).done;)if(!Pg(r.value[1],t.get(r.value[0])))return!1;return!0}if(mye&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(yye&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;if(pye&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!Pg(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var vye=function(t,n){try{return Pg(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const bye=ll(vye);function yD(e,t={}){var n;const{styleConfig:r,...i}=t,{theme:o,colorMode:s}=$ge(),a=e?cye(o,`components.${e}`):void 0,l=r||a,u=qi({theme:o,colorMode:s},(n=l==null?void 0:l.defaultProps)!=null?n:{},mD(aye(i,["children"]))),c=k.useRef({});if(l){const f=rye(l)(u);bye(c.current,f)||(c.current=f)}return c.current}function vD(e,t={}){return yD(e,t)}function E4e(e,t={}){return yD(e,t)}var _ye=new Set([...Gme,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),Sye=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function wye(e){return Sye.has(e)||!_ye.has(e)}function xye(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const n={...e};for(const r of t)if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(i in n&&delete n[i],n[i]=r[i]);return n}var Cye=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Tye=QN(function(e){return Cye.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),Eye=Tye,Pye=function(t){return t!=="theme"},Q6=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?Eye:Pye},Z6=function(t,n,r){var i;if(n){var o=n.shouldForwardProp;i=t.__emotion_forwardProp&&o?function(s){return t.__emotion_forwardProp(s)&&o(s)}:o}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},Aye=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return JN(n,r,i),Rge(function(){return eD(n,r,i)}),null},kye=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,o,s;n!==void 0&&(o=n.label,s=n.target);var a=Z6(t,n,r),l=a||Q6(i),u=!l("as");return function(){var c=arguments,d=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(o!==void 0&&d.push("label:"+o+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,h=1;ht=>{const{theme:n,css:r,__css:i,sx:o,...s}=t,a=gD(s,(d,f)=>qme(f)),l=fye(e,t),u=xye({},i,l,mD(a),o),c=Jme(u)(t.theme);return r?[c,r]:c};function r_(e,t){const{baseStyle:n,...r}=t??{};r.shouldForwardProp||(r.shouldForwardProp=wye);const i=Mye({baseStyle:n}),o=Rye(e,r)(i);return We.forwardRef(function(l,u){const{colorMode:c,forced:d}=jC();return We.createElement(o,{ref:u,"data-theme":d?c:void 0,...l})})}function Iye(){const e=new Map;return new Proxy(r_,{apply(t,n,r){return r_(...r)},get(t,n){return e.has(n)||e.set(n,r_(n)),e.get(n)}})}var al=Iye();function El(e){return k.forwardRef(e)}const bD=k.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),n1=k.createContext({}),$h=k.createContext(null),r1=typeof document<"u",sy=r1?k.useLayoutEffect:k.useEffect,_D=k.createContext({strict:!1});function Nye(e,t,n,r){const{visualElement:i}=k.useContext(n1),o=k.useContext(_D),s=k.useContext($h),a=k.useContext(bD).reducedMotion,l=k.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:s,blockInitialAnimation:s?s.initial===!1:!1,reducedMotionConfig:a}));const u=l.current;return k.useInsertionEffect(()=>{u&&u.update(n,s)}),sy(()=>{u&&u.render()}),k.useEffect(()=>{u&&u.updateFeatures()}),(window.HandoffAppearAnimations?sy:k.useEffect)(()=>{u&&u.animationState&&u.animationState.animateChanges()}),u}function gu(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Dye(e,t,n){return k.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):gu(n)&&(n.current=r))},[t])}function Hf(e){return typeof e=="string"||Array.isArray(e)}function i1(e){return typeof e=="object"&&typeof e.start=="function"}const GC=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],HC=["initial",...GC];function o1(e){return i1(e.animate)||HC.some(t=>Hf(e[t]))}function SD(e){return!!(o1(e)||e.variants)}function Lye(e,t){if(o1(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Hf(n)?n:void 0,animate:Hf(r)?r:void 0}}return e.inherit!==!1?t:{}}function $ye(e){const{initial:t,animate:n}=Lye(e,k.useContext(n1));return k.useMemo(()=>({initial:t,animate:n}),[e8(t),e8(n)])}function e8(e){return Array.isArray(e)?e.join(" "):e}const t8={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},qf={};for(const e in t8)qf[e]={isEnabled:t=>t8[e].some(n=>!!t[n])};function Fye(e){for(const t in e)qf[t]={...qf[t],...e[t]}}const qC=k.createContext({}),wD=k.createContext({}),Bye=Symbol.for("motionComponentSymbol");function jye({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&Fye(e);function o(a,l){let u;const c={...k.useContext(bD),...a,layoutId:Vye(a)},{isStatic:d}=c,f=$ye(a),h=r(a,d);if(!d&&r1){f.visualElement=Nye(i,h,c,t);const p=k.useContext(wD),m=k.useContext(_D).strict;f.visualElement&&(u=f.visualElement.loadFeatures(c,m,e,p))}return k.createElement(n1.Provider,{value:f},u&&f.visualElement?k.createElement(u,{visualElement:f.visualElement,...c}):null,n(i,a,Dye(h,f.visualElement,l),h,d,f.visualElement))}const s=k.forwardRef(o);return s[Bye]=i,s}function Vye({layoutId:e}){const t=k.useContext(qC).id;return t&&e!==void 0?t+"-"+e:e}function zye(e){function t(r,i={}){return jye(e(r,i))}if(typeof Proxy>"u")return t;const n=new Map;return new Proxy(t,{get:(r,i)=>(n.has(i)||n.set(i,t(i)),n.get(i))})}const Uye=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function WC(e){return typeof e!="string"||e.includes("-")?!1:!!(Uye.indexOf(e)>-1||/[A-Z]/.test(e))}const ay={};function Gye(e){Object.assign(ay,e)}const Fh=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Pl=new Set(Fh);function xD(e,{layout:t,layoutId:n}){return Pl.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!ay[e]||e==="opacity")}const _r=e=>!!(e&&e.getVelocity),Hye={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},qye=Fh.length;function Wye(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,i){let o="";for(let s=0;st=>typeof t=="string"&&t.startsWith(e),TD=CD("--"),N2=CD("var(--"),Kye=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,Xye=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Ks=(e,t,n)=>Math.min(Math.max(n,e),t),Al={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Md={...Al,transform:e=>Ks(0,1,e)},Gp={...Al,default:1},Id=e=>Math.round(e*1e5)/1e5,s1=/(-)?([\d]*\.?[\d])+/g,ED=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Yye=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Bh(e){return typeof e=="string"}const jh=e=>({test:t=>Bh(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ss=jh("deg"),Zi=jh("%"),me=jh("px"),Qye=jh("vh"),Zye=jh("vw"),n8={...Zi,parse:e=>Zi.parse(e)/100,transform:e=>Zi.transform(e*100)},r8={...Al,transform:Math.round},PD={borderWidth:me,borderTopWidth:me,borderRightWidth:me,borderBottomWidth:me,borderLeftWidth:me,borderRadius:me,radius:me,borderTopLeftRadius:me,borderTopRightRadius:me,borderBottomRightRadius:me,borderBottomLeftRadius:me,width:me,maxWidth:me,height:me,maxHeight:me,size:me,top:me,right:me,bottom:me,left:me,padding:me,paddingTop:me,paddingRight:me,paddingBottom:me,paddingLeft:me,margin:me,marginTop:me,marginRight:me,marginBottom:me,marginLeft:me,rotate:ss,rotateX:ss,rotateY:ss,rotateZ:ss,scale:Gp,scaleX:Gp,scaleY:Gp,scaleZ:Gp,skew:ss,skewX:ss,skewY:ss,distance:me,translateX:me,translateY:me,translateZ:me,x:me,y:me,z:me,perspective:me,transformPerspective:me,opacity:Md,originX:n8,originY:n8,originZ:me,zIndex:r8,fillOpacity:Md,strokeOpacity:Md,numOctaves:r8};function KC(e,t,n,r){const{style:i,vars:o,transform:s,transformOrigin:a}=e;let l=!1,u=!1,c=!0;for(const d in t){const f=t[d];if(TD(d)){o[d]=f;continue}const h=PD[d],p=Xye(f,h);if(Pl.has(d)){if(l=!0,s[d]=p,!c)continue;f!==(h.default||0)&&(c=!1)}else d.startsWith("origin")?(u=!0,a[d]=p):i[d]=p}if(t.transform||(l||r?i.transform=Wye(e.transform,n,c,r):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:h=0}=a;i.transformOrigin=`${d} ${f} ${h}`}}const XC=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function AD(e,t,n){for(const r in t)!_r(t[r])&&!xD(r,n)&&(e[r]=t[r])}function Jye({transformTemplate:e},t,n){return k.useMemo(()=>{const r=XC();return KC(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function e0e(e,t,n){const r=e.style||{},i={};return AD(i,r,e),Object.assign(i,Jye(e,t,n)),e.transformValues?e.transformValues(i):i}function t0e(e,t,n){const r={},i=e0e(e,t,n);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=i,r}const n0e=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function ly(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||n0e.has(e)}let kD=e=>!ly(e);function r0e(e){e&&(kD=t=>t.startsWith("on")?!ly(t):e(t))}try{r0e(require("@emotion/is-prop-valid").default)}catch{}function i0e(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(kD(i)||n===!0&&ly(i)||!t&&!ly(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function i8(e,t,n){return typeof e=="string"?e:me.transform(t+n*e)}function o0e(e,t,n){const r=i8(t,e.x,e.width),i=i8(n,e.y,e.height);return`${r} ${i}`}const s0e={offset:"stroke-dashoffset",array:"stroke-dasharray"},a0e={offset:"strokeDashoffset",array:"strokeDasharray"};function l0e(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?s0e:a0e;e[o.offset]=me.transform(-r);const s=me.transform(t),a=me.transform(n);e[o.array]=`${s} ${a}`}function YC(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:o,pathLength:s,pathSpacing:a=1,pathOffset:l=0,...u},c,d,f){if(KC(e,u,c,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:m}=e;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(i!==void 0||o!==void 0||p.transform)&&(p.transformOrigin=o0e(m,i!==void 0?i:.5,o!==void 0?o:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),s!==void 0&&l0e(h,s,a,l,!1)}const OD=()=>({...XC(),attrs:{}}),QC=e=>typeof e=="string"&&e.toLowerCase()==="svg";function u0e(e,t,n,r){const i=k.useMemo(()=>{const o=OD();return YC(o,t,{enableHardwareAcceleration:!1},QC(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};AD(o,e.style,e),i.style={...o,...i.style}}return i}function c0e(e=!1){return(n,r,i,{latestValues:o},s)=>{const l=(WC(n)?u0e:t0e)(r,o,s,n),c={...i0e(r,typeof n=="string",e),...l,ref:i},{children:d}=r,f=k.useMemo(()=>_r(d)?d.get():d,[d]);return k.createElement(n,{...c,children:f})}}const ZC=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function RD(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const MD=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function ID(e,t,n,r){RD(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(MD.has(i)?i:ZC(i),t.attrs[i])}function JC(e,t){const{style:n}=e,r={};for(const i in n)(_r(n[i])||t.style&&_r(t.style[i])||xD(i,e))&&(r[i]=n[i]);return r}function ND(e,t){const n=JC(e,t);for(const r in e)if(_r(e[r])||_r(t[r])){const i=Fh.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=e[r]}return n}function e3(e,t,n,r={},i={}){return typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),t}function DD(e){const t=k.useRef(null);return t.current===null&&(t.current=e()),t.current}const uy=e=>Array.isArray(e),d0e=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),f0e=e=>uy(e)?e[e.length-1]||0:e;function Ag(e){const t=_r(e)?e.get():e;return d0e(t)?t.toValue():t}function h0e({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,i,o){const s={latestValues:p0e(r,i,o,e),renderState:t()};return n&&(s.mount=a=>n(r,a,s)),s}const LD=e=>(t,n)=>{const r=k.useContext(n1),i=k.useContext($h),o=()=>h0e(e,t,r,i);return n?o():DD(o)};function p0e(e,t,n,r){const i={},o=r(e,{});for(const f in o)i[f]=Ag(o[f]);let{initial:s,animate:a}=e;const l=o1(e),u=SD(e);t&&u&&!l&&e.inherit!==!1&&(s===void 0&&(s=t.initial),a===void 0&&(a=t.animate));let c=n?n.initial===!1:!1;c=c||s===!1;const d=c?a:s;return d&&typeof d!="boolean"&&!i1(d)&&(Array.isArray(d)?d:[d]).forEach(h=>{const p=e3(e,h);if(!p)return;const{transitionEnd:m,transition:_,...y}=p;for(const v in y){let g=y[v];if(Array.isArray(g)){const b=c?g.length-1:0;g=g[b]}g!==null&&(i[v]=g)}for(const v in m)i[v]=m[v]}),i}const g0e={useVisualState:LD({scrapeMotionValuesFromProps:ND,createRenderState:OD,onMount:(e,t,{renderState:n,latestValues:r})=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}YC(n,r,{enableHardwareAcceleration:!1},QC(t.tagName),e.transformTemplate),ID(t,n)}})},m0e={useVisualState:LD({scrapeMotionValuesFromProps:JC,createRenderState:XC})};function y0e(e,{forwardMotionProps:t=!1},n,r){return{...WC(e)?g0e:m0e,preloadedFeatures:n,useRender:c0e(t),createVisualElement:r,Component:e}}function Po(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const $D=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function a1(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const v0e=e=>t=>$D(t)&&e(t,a1(t));function Mo(e,t,n,r){return Po(e,t,v0e(n),r)}const b0e=(e,t)=>n=>t(e(n)),Is=(...e)=>e.reduce(b0e);function FD(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const o8=FD("dragHorizontal"),s8=FD("dragVertical");function BD(e){let t=!1;if(e==="y")t=s8();else if(e==="x")t=o8();else{const n=o8(),r=s8();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function jD(){const e=BD(!0);return e?(e(),!1):!0}class ca{constructor(t){this.isMounted=!1,this.node=t}update(){}}const Yt=e=>e;function _0e(e){let t=[],n=[],r=0,i=!1,o=!1;const s=new WeakSet,a={schedule:(l,u=!1,c=!1)=>{const d=c&&i,f=d?t:n;return u&&s.add(l),f.indexOf(l)===-1&&(f.push(l),d&&i&&(r=t.length)),l},cancel:l=>{const u=n.indexOf(l);u!==-1&&n.splice(u,1),s.delete(l)},process:l=>{if(i){o=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let u=0;u(d[f]=_0e(()=>n=!0),d),{}),s=d=>o[d].process(i),a=d=>{n=!1,i.delta=r?1e3/60:Math.max(Math.min(d-i.timestamp,S0e),1),i.timestamp=d,i.isProcessing=!0,Hp.forEach(s),i.isProcessing=!1,n&&t&&(r=!1,e(a))},l=()=>{n=!0,r=!0,i.isProcessing||e(a)};return{schedule:Hp.reduce((d,f)=>{const h=o[f];return d[f]=(p,m=!1,_=!1)=>(n||l(),h.schedule(p,m,_)),d},{}),cancel:d=>Hp.forEach(f=>o[f].cancel(d)),state:i,steps:o}}const{schedule:_t,cancel:zo,state:Ln,steps:i_}=w0e(typeof requestAnimationFrame<"u"?requestAnimationFrame:Yt,!0);function a8(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),i=(o,s)=>{if(o.type==="touch"||jD())return;const a=e.getProps();e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",t),a[r]&&_t.update(()=>a[r](o,s))};return Mo(e.current,n,i,{passive:!e.getProps()[r]})}class x0e extends ca{mount(){this.unmount=Is(a8(this.node,!0),a8(this.node,!1))}unmount(){}}class C0e extends ca{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Is(Po(this.node.current,"focus",()=>this.onFocus()),Po(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const VD=(e,t)=>t?e===t?!0:VD(e,t.parentElement):!1;function o_(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,a1(n))}class T0e extends ca{constructor(){super(...arguments),this.removeStartListeners=Yt,this.removeEndListeners=Yt,this.removeAccessibleListeners=Yt,this.startPointerPress=(t,n)=>{if(this.removeEndListeners(),this.isPressing)return;const r=this.node.getProps(),o=Mo(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c}=this.node.getProps();_t.update(()=>{VD(this.node.current,a.target)?u&&u(a,l):c&&c(a,l)})},{passive:!(r.onTap||r.onPointerUp)}),s=Mo(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=Is(o,s),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const s=a=>{a.key!=="Enter"||!this.checkPressEnd()||o_("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&_t.update(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=Po(this.node.current,"keyup",s),o_("down",(a,l)=>{this.startPress(a,l)})},n=Po(this.node.current,"keydown",t),r=()=>{this.isPressing&&o_("cancel",(o,s)=>this.cancelPress(o,s))},i=Po(this.node.current,"blur",r);this.removeAccessibleListeners=Is(n,i)}}startPress(t,n){this.isPressing=!0;const{onTapStart:r,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&_t.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!jD()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&_t.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=Mo(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=Po(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Is(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const D2=new WeakMap,s_=new WeakMap,E0e=e=>{const t=D2.get(e.target);t&&t(e)},P0e=e=>{e.forEach(E0e)};function A0e({root:e,...t}){const n=e||document;s_.has(n)||s_.set(n,{});const r=s_.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(P0e,{root:e,...t})),r[i]}function k0e(e,t,n){const r=A0e(t);return D2.set(e,n),r.observe(e),()=>{D2.delete(e),r.unobserve(e)}}const O0e={some:0,all:1};class R0e extends ca{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,s={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:O0e[i]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return k0e(this.node.current,s,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(M0e(t,n))&&this.startObserver()}unmount(){}}function M0e({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const I0e={inView:{Feature:R0e},tap:{Feature:T0e},focus:{Feature:C0e},hover:{Feature:x0e}};function zD(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rt[r]=n.get()),t}function D0e(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function l1(e,t,n){const r=e.getProps();return e3(r,t,n!==void 0?n:r.custom,N0e(e),D0e(e))}const L0e="framerAppearId",$0e="data-"+ZC(L0e);let F0e=Yt,t3=Yt;const Ns=e=>e*1e3,Io=e=>e/1e3,B0e={current:!1},UD=e=>Array.isArray(e)&&typeof e[0]=="number";function GD(e){return!!(!e||typeof e=="string"&&HD[e]||UD(e)||Array.isArray(e)&&e.every(GD))}const md=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,HD={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:md([0,.65,.55,1]),circOut:md([.55,0,1,.45]),backIn:md([.31,.01,.66,-.59]),backOut:md([.33,1.53,.69,.99])};function qD(e){if(e)return UD(e)?md(e):Array.isArray(e)?e.map(qD):HD[e]}function j0e(e,t,n,{delay:r=0,duration:i,repeat:o=0,repeatType:s="loop",ease:a,times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=qD(a);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:r,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:s==="reverse"?"alternate":"normal"})}const l8={waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate")},a_={},WD={};for(const e in l8)WD[e]=()=>(a_[e]===void 0&&(a_[e]=l8[e]()),a_[e]);function V0e(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const KD=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,z0e=1e-7,U0e=12;function G0e(e,t,n,r,i){let o,s,a=0;do s=t+(n-t)/2,o=KD(s,r,i)-e,o>0?n=s:t=s;while(Math.abs(o)>z0e&&++aG0e(o,0,1,e,n);return o=>o===0||o===1?o:KD(i(o),t,r)}const H0e=Vh(.42,0,1,1),q0e=Vh(0,0,.58,1),XD=Vh(.42,0,.58,1),W0e=e=>Array.isArray(e)&&typeof e[0]!="number",YD=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,QD=e=>t=>1-e(1-t),ZD=e=>1-Math.sin(Math.acos(e)),n3=QD(ZD),K0e=YD(n3),JD=Vh(.33,1.53,.69,.99),r3=QD(JD),X0e=YD(r3),Y0e=e=>(e*=2)<1?.5*r3(e):.5*(2-Math.pow(2,-10*(e-1))),Q0e={linear:Yt,easeIn:H0e,easeInOut:XD,easeOut:q0e,circIn:ZD,circInOut:K0e,circOut:n3,backIn:r3,backInOut:X0e,backOut:JD,anticipate:Y0e},u8=e=>{if(Array.isArray(e)){t3(e.length===4);const[t,n,r,i]=e;return Vh(t,n,r,i)}else if(typeof e=="string")return Q0e[e];return e},i3=(e,t)=>n=>!!(Bh(n)&&Yye.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),eL=(e,t,n)=>r=>{if(!Bh(r))return r;const[i,o,s,a]=r.match(s1);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(s),alpha:a!==void 0?parseFloat(a):1}},Z0e=e=>Ks(0,255,e),l_={...Al,transform:e=>Math.round(Z0e(e))},La={test:i3("rgb","red"),parse:eL("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+l_.transform(e)+", "+l_.transform(t)+", "+l_.transform(n)+", "+Id(Md.transform(r))+")"};function J0e(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const L2={test:i3("#"),parse:J0e,transform:La.transform},mu={test:i3("hsl","hue"),parse:eL("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Zi.transform(Id(t))+", "+Zi.transform(Id(n))+", "+Id(Md.transform(r))+")"},Kn={test:e=>La.test(e)||L2.test(e)||mu.test(e),parse:e=>La.test(e)?La.parse(e):mu.test(e)?mu.parse(e):L2.parse(e),transform:e=>Bh(e)?e:e.hasOwnProperty("red")?La.transform(e):mu.transform(e)},Pt=(e,t,n)=>-n*e+n*t+e;function u_(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function eve({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,s=0;if(!t)i=o=s=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;i=u_(l,a,e+1/3),o=u_(l,a,e),s=u_(l,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(s*255),alpha:r}}const c_=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},tve=[L2,La,mu],nve=e=>tve.find(t=>t.test(e));function c8(e){const t=nve(e);let n=t.parse(e);return t===mu&&(n=eve(n)),n}const tL=(e,t)=>{const n=c8(e),r=c8(t),i={...n};return o=>(i.red=c_(n.red,r.red,o),i.green=c_(n.green,r.green,o),i.blue=c_(n.blue,r.blue,o),i.alpha=Pt(n.alpha,r.alpha,o),La.transform(i))};function rve(e){var t,n;return isNaN(e)&&Bh(e)&&(((t=e.match(s1))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(ED))===null||n===void 0?void 0:n.length)||0)>0}const nL={regex:Kye,countKey:"Vars",token:"${v}",parse:Yt},rL={regex:ED,countKey:"Colors",token:"${c}",parse:Kn.parse},iL={regex:s1,countKey:"Numbers",token:"${n}",parse:Al.parse};function d_(e,{regex:t,countKey:n,token:r,parse:i}){const o=e.tokenised.match(t);o&&(e["num"+n]=o.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...o.map(i)))}function cy(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&d_(n,nL),d_(n,rL),d_(n,iL),n}function oL(e){return cy(e).values}function sL(e){const{values:t,numColors:n,numVars:r,tokenised:i}=cy(e),o=t.length;return s=>{let a=i;for(let l=0;ltypeof e=="number"?0:e;function ove(e){const t=oL(e);return sL(e)(t.map(ive))}const Xs={test:rve,parse:oL,createTransformer:sL,getAnimatableNone:ove},aL=(e,t)=>n=>`${n>0?t:e}`;function lL(e,t){return typeof e=="number"?n=>Pt(e,t,n):Kn.test(e)?tL(e,t):e.startsWith("var(")?aL(e,t):cL(e,t)}const uL=(e,t)=>{const n=[...e],r=n.length,i=e.map((o,s)=>lL(o,t[s]));return o=>{for(let s=0;s{const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=lL(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}},cL=(e,t)=>{const n=Xs.createTransformer(t),r=cy(e),i=cy(t);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?Is(uL(r.values,i.values),n):aL(e,t)},Wf=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},d8=(e,t)=>n=>Pt(e,t,n);function ave(e){return typeof e=="number"?d8:typeof e=="string"?Kn.test(e)?tL:cL:Array.isArray(e)?uL:typeof e=="object"?sve:d8}function lve(e,t,n){const r=[],i=n||ave(e[0]),o=e.length-1;for(let s=0;st[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const s=lve(t,r,i),a=s.length,l=u=>{let c=0;if(a>1)for(;cl(Ks(e[0],e[o-1],u)):l}function uve(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=Wf(0,t,r);e.push(Pt(n,1,i))}}function cve(e){const t=[0];return uve(t,e.length-1),t}function dve(e,t){return e.map(n=>n*t)}function fve(e,t){return e.map(()=>t||XD).splice(0,e.length-1)}function dy({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=W0e(r)?r.map(u8):u8(r),o={done:!1,value:t[0]},s=dve(n&&n.length===t.length?n:cve(t),e),a=dL(s,t,{ease:Array.isArray(i)?i:fve(t,i)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}function fL(e,t){return t?e*(1e3/t):0}const hve=5;function hL(e,t,n){const r=Math.max(t-hve,0);return fL(n-e(r),t-r)}const f_=.001,pve=.01,f8=10,gve=.05,mve=1;function yve({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,o;F0e(e<=Ns(f8));let s=1-t;s=Ks(gve,mve,s),e=Ks(pve,f8,Io(e)),s<1?(i=u=>{const c=u*s,d=c*e,f=c-n,h=$2(u,s),p=Math.exp(-d);return f_-f/h*p},o=u=>{const d=u*s*e,f=d*n+n,h=Math.pow(s,2)*Math.pow(u,2)*e,p=Math.exp(-d),m=$2(Math.pow(u,2),s);return(-i(u)+f_>0?-1:1)*((f-h)*p)/m}):(i=u=>{const c=Math.exp(-u*e),d=(u-n)*e+1;return-f_+c*d},o=u=>{const c=Math.exp(-u*e),d=(n-u)*(e*e);return c*d});const a=5/e,l=bve(i,o,a);if(e=Ns(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:s*2*Math.sqrt(r*u),duration:e}}}const vve=12;function bve(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function wve(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!h8(e,Sve)&&h8(e,_ve)){const n=yve(e);t={...t,...n,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function pL({keyframes:e,restDelta:t,restSpeed:n,...r}){const i=e[0],o=e[e.length-1],s={done:!1,value:i},{stiffness:a,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:f}=wve(r),h=c?-Io(c):0,p=l/(2*Math.sqrt(a*u)),m=o-i,_=Io(Math.sqrt(a/u)),y=Math.abs(m)<5;n||(n=y?.01:2),t||(t=y?.005:.5);let v;if(p<1){const g=$2(_,p);v=b=>{const S=Math.exp(-p*_*b);return o-S*((h+p*_*m)/g*Math.sin(g*b)+m*Math.cos(g*b))}}else if(p===1)v=g=>o-Math.exp(-_*g)*(m+(h+_*m)*g);else{const g=_*Math.sqrt(p*p-1);v=b=>{const S=Math.exp(-p*_*b),w=Math.min(g*b,300);return o-S*((h+p*_*m)*Math.sinh(w)+g*m*Math.cosh(w))/g}}return{calculatedDuration:f&&d||null,next:g=>{const b=v(g);if(f)s.done=g>=d;else{let S=h;g!==0&&(p<1?S=hL(v,g,b):S=0);const w=Math.abs(S)<=n,x=Math.abs(o-b)<=t;s.done=w&&x}return s.value=s.done?o:b,s}}}function p8({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},h=T=>a!==void 0&&Tl,p=T=>a===void 0?l:l===void 0||Math.abs(a-T)-m*Math.exp(-T/r),g=T=>y+v(T),b=T=>{const P=v(T),E=g(T);f.done=Math.abs(P)<=u,f.value=f.done?y:E};let S,w;const x=T=>{h(f.value)&&(S=T,w=pL({keyframes:[f.value,p(f.value)],velocity:hL(g,T,f.value),damping:i,stiffness:o,restDelta:u,restSpeed:c}))};return x(0),{calculatedDuration:null,next:T=>{let P=!1;return!w&&S===void 0&&(P=!0,b(T),x(T)),S!==void 0&&T>S?w.next(T-S):(!P&&b(T),f)}}}const xve=e=>{const t=({timestamp:n})=>e(n);return{start:()=>_t.update(t,!0),stop:()=>zo(t),now:()=>Ln.isProcessing?Ln.timestamp:performance.now()}},g8=2e4;function m8(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=g8?1/0:t}const Cve={decay:p8,inertia:p8,tween:dy,keyframes:dy,spring:pL};function fy({autoplay:e=!0,delay:t=0,driver:n=xve,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:s=0,repeatType:a="loop",onPlay:l,onStop:u,onComplete:c,onUpdate:d,...f}){let h=1,p=!1,m,_;const y=()=>{_=new Promise(j=>{m=j})};y();let v;const g=Cve[i]||dy;let b;g!==dy&&typeof r[0]!="number"&&(b=dL([0,100],r,{clamp:!1}),r=[0,100]);const S=g({...f,keyframes:r});let w;a==="mirror"&&(w=g({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let x="idle",T=null,P=null,E=null;S.calculatedDuration===null&&o&&(S.calculatedDuration=m8(S));const{calculatedDuration:A}=S;let $=1/0,M=1/0;A!==null&&($=A+s,M=$*(o+1)-s);let C=0;const O=j=>{if(P===null)return;h>0&&(P=Math.min(P,j)),h<0&&(P=Math.min(j-M/h,P)),T!==null?C=T:C=Math.round(j-P)*h;const U=C-t*(h>=0?1:-1),G=h>=0?U<0:U>M;C=Math.max(U,0),x==="finished"&&T===null&&(C=M);let W=C,X=S;if(o){const Q=C/$;let J=Math.floor(Q),ne=Q%1;!ne&&Q>=1&&(ne=1),ne===1&&J--,J=Math.min(J,o+1);const te=!!(J%2);te&&(a==="reverse"?(ne=1-ne,s&&(ne-=s/$)):a==="mirror"&&(X=w));let xe=Ks(0,1,ne);C>M&&(xe=a==="reverse"&&te?1:0),W=xe*$}const Y=G?{done:!1,value:r[0]}:X.next(W);b&&(Y.value=b(Y.value));let{done:B}=Y;!G&&A!==null&&(B=h>=0?C>=M:C<=0);const H=T===null&&(x==="finished"||x==="running"&&B);return d&&d(Y.value),H&&R(),Y},I=()=>{v&&v.stop(),v=void 0},N=()=>{x="idle",I(),m(),y(),P=E=null},R=()=>{x="finished",c&&c(),I(),m()},D=()=>{if(p)return;v||(v=n(O));const j=v.now();l&&l(),T!==null?P=j-T:(!P||x==="finished")&&(P=j),x==="finished"&&y(),E=P,T=null,x="running",v.start()};e&&D();const L={then(j,U){return _.then(j,U)},get time(){return Io(C)},set time(j){j=Ns(j),C=j,T!==null||!v||h===0?T=j:P=v.now()-j/h},get duration(){const j=S.calculatedDuration===null?m8(S):S.calculatedDuration;return Io(j)},get speed(){return h},set speed(j){j===h||!v||(h=j,L.time=Io(C))},get state(){return x},play:D,pause:()=>{x="paused",T=C},stop:()=>{p=!0,x!=="idle"&&(x="idle",u&&u(),N())},cancel:()=>{E!==null&&O(E),N()},complete:()=>{x="finished"},sample:j=>(P=0,O(j))};return L}const Tve=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),qp=10,Eve=2e4,Pve=(e,t)=>t.type==="spring"||e==="backgroundColor"||!GD(t.ease);function Ave(e,t,{onUpdate:n,onComplete:r,...i}){if(!(WD.waapi()&&Tve.has(t)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let s=!1,a,l;const u=()=>{l=new Promise(y=>{a=y})};u();let{keyframes:c,duration:d=300,ease:f,times:h}=i;if(Pve(t,i)){const y=fy({...i,repeat:0,delay:0});let v={done:!1,value:c[0]};const g=[];let b=0;for(;!v.done&&bp.cancel(),_=()=>{_t.update(m),a(),u()};return p.onfinish=()=>{e.set(V0e(c,i)),r&&r(),_()},{then(y,v){return l.then(y,v)},get time(){return Io(p.currentTime||0)},set time(y){p.currentTime=Ns(y)},get speed(){return p.playbackRate},set speed(y){p.playbackRate=y},get duration(){return Io(d)},play:()=>{s||(p.play(),zo(m))},pause:()=>p.pause(),stop:()=>{if(s=!0,p.playState==="idle")return;const{currentTime:y}=p;if(y){const v=fy({...i,autoplay:!1});e.setWithVelocity(v.sample(y-qp).value,v.sample(y).value,qp)}_()},complete:()=>p.finish(),cancel:_}}function kve({keyframes:e,delay:t,onUpdate:n,onComplete:r}){const i=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:Yt,pause:Yt,stop:Yt,then:o=>(o(),Promise.resolve()),cancel:Yt,complete:Yt});return t?fy({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}const Ove={type:"spring",stiffness:500,damping:25,restSpeed:10},Rve=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Mve={type:"keyframes",duration:.8},Ive={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Nve=(e,{keyframes:t})=>t.length>2?Mve:Pl.has(e)?e.startsWith("scale")?Rve(t[1]):Ove:Ive,F2=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Xs.test(t)||t==="0")&&!t.startsWith("url(")),Dve=new Set(["brightness","contrast","saturate","opacity"]);function Lve(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(s1)||[];if(!r)return e;const i=n.replace(r,"");let o=Dve.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const $ve=/([a-z-]*)\(.*?\)/g,B2={...Xs,getAnimatableNone:e=>{const t=e.match($ve);return t?t.map(Lve).join(" "):e}},Fve={...PD,color:Kn,backgroundColor:Kn,outlineColor:Kn,fill:Kn,stroke:Kn,borderColor:Kn,borderTopColor:Kn,borderRightColor:Kn,borderBottomColor:Kn,borderLeftColor:Kn,filter:B2,WebkitFilter:B2},o3=e=>Fve[e];function gL(e,t){let n=o3(e);return n!==B2&&(n=Xs),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const mL=e=>/^0[^.\s]+$/.test(e);function Bve(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||mL(e)}function jve(e,t,n,r){const i=F2(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const s=r.from!==void 0?r.from:e.get();let a;const l=[];for(let u=0;ui=>{const o=yL(r,e)||{},s=o.delay||r.delay||0;let{elapsed:a=0}=r;a=a-Ns(s);const l=jve(t,e,n,o),u=l[0],c=l[l.length-1],d=F2(e,u),f=F2(e,c);let h={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-a,onUpdate:p=>{t.set(p),o.onUpdate&&o.onUpdate(p)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(Vve(o)||(h={...h,...Nve(e,h)}),h.duration&&(h.duration=Ns(h.duration)),h.repeatDelay&&(h.repeatDelay=Ns(h.repeatDelay)),!d||!f||B0e.current||o.type===!1)return kve(h);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const p=Ave(t,e,h);if(p)return p}return fy(h)};function hy(e){return!!(_r(e)&&e.add)}const zve=e=>/^\-?\d*\.?\d+$/.test(e);function a3(e,t){e.indexOf(t)===-1&&e.push(t)}function l3(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class u3{constructor(){this.subscriptions=[]}add(t){return a3(this.subscriptions,t),()=>l3(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;o!isNaN(parseFloat(e));class Gve{constructor(t,n={}){this.version="10.12.22",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(r,i=!0)=>{this.prev=this.current,this.current=r;const{delta:o,timestamp:s}=Ln;this.lastUpdated!==s&&(this.timeDelta=o,this.lastUpdated=s,_t.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>_t.postRender(this.velocityCheck),this.velocityCheck=({timestamp:r})=>{r!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=Uve(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new u3);const r=this.events[t].add(n);return t==="change"?()=>{r(),_t.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=t,this.timeDelta=r}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?fL(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function dc(e,t){return new Gve(e,t)}const vL=e=>t=>t.test(e),Hve={test:e=>e==="auto",parse:e=>e},bL=[Al,me,Zi,ss,Zye,Qye,Hve],od=e=>bL.find(vL(e)),qve=[...bL,Kn,Xs],Wve=e=>qve.find(vL(e));function Kve(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,dc(n))}function Xve(e,t){const n=l1(e,t);let{transitionEnd:r={},transition:i={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const s in o){const a=f0e(o[s]);Kve(e,s,a)}}function Yve(e,t,n){var r,i;const o=Object.keys(t).filter(a=>!e.hasValue(a)),s=o.length;if(s)for(let a=0;al.remove(d))),u.push(m)}return s&&Promise.all(u).then(()=>{s&&Xve(e,s)}),u}function j2(e,t,n={}){const r=l1(e,t,n.custom);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(_L(e,r,n)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=i;return e1e(e,t,u+l,c,d,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[l,u]=a==="beforeChildren"?[o,s]:[s,o];return l().then(()=>u())}else return Promise.all([o(),s(n.delay)])}function e1e(e,t,n=0,r=0,i=1,o){const s=[],a=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(e.variantChildren).sort(t1e).forEach((u,c)=>{u.notify("AnimationStart",t),s.push(j2(u,t,{...o,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(s)}function t1e(e,t){return e.sortNodePosition(t)}function n1e(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>j2(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=j2(e,t,n);else{const i=typeof t=="function"?l1(e,t,n.custom):t;r=Promise.all(_L(e,i,n))}return r.then(()=>e.notify("AnimationComplete",t))}const r1e=[...GC].reverse(),i1e=GC.length;function o1e(e){return t=>Promise.all(t.map(({animation:n,options:r})=>n1e(e,n,r)))}function s1e(e){let t=o1e(e);const n=l1e();let r=!0;const i=(l,u)=>{const c=l1(e,u);if(c){const{transition:d,transitionEnd:f,...h}=c;l={...l,...h,...f}}return l};function o(l){t=l(e)}function s(l,u){const c=e.getProps(),d=e.getVariantContext(!0)||{},f=[],h=new Set;let p={},m=1/0;for(let y=0;ym&&S;const E=Array.isArray(b)?b:[b];let A=E.reduce(i,{});w===!1&&(A={});const{prevResolvedValues:$={}}=g,M={...$,...A},C=O=>{P=!0,h.delete(O),g.needsAnimating[O]=!0};for(const O in M){const I=A[O],N=$[O];p.hasOwnProperty(O)||(I!==N?uy(I)&&uy(N)?!zD(I,N)||T?C(O):g.protectedKeys[O]=!0:I!==void 0?C(O):h.add(O):I!==void 0&&h.has(O)?C(O):g.protectedKeys[O]=!0)}g.prevProp=b,g.prevResolvedValues=A,g.isActive&&(p={...p,...A}),r&&e.blockInitialAnimation&&(P=!1),P&&!x&&f.push(...E.map(O=>({animation:O,options:{type:v,...l}})))}if(h.size){const y={};h.forEach(v=>{const g=e.getBaseTarget(v);g!==void 0&&(y[v]=g)}),f.push({animation:y})}let _=!!f.length;return r&&c.initial===!1&&!e.manuallyAnimateOnMount&&(_=!1),r=!1,_?t(f):Promise.resolve()}function a(l,u,c){var d;if(n[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,u)}),n[l].isActive=u;const f=s(c,l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:s,setActive:a,setAnimateFunction:o,getState:()=>n}}function a1e(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!zD(t,e):!1}function _a(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function l1e(){return{animate:_a(!0),whileInView:_a(),whileHover:_a(),whileTap:_a(),whileDrag:_a(),whileFocus:_a(),exit:_a()}}class u1e extends ca{constructor(t){super(t),t.animationState||(t.animationState=s1e(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),i1(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let c1e=0;class d1e extends ca{constructor(){super(...arguments),this.id=c1e++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n,custom:r}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const o=this.node.animationState.setActive("exit",!t,{custom:r??this.node.getProps().custom});n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const f1e={animation:{Feature:u1e},exit:{Feature:d1e}},y8=(e,t)=>Math.abs(e-t);function h1e(e,t){const n=y8(e.x,t.x),r=y8(e.y,t.y);return Math.sqrt(n**2+r**2)}class SL{constructor(t,n,{transformPagePoint:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=p_(this.lastMoveEventInfo,this.history),c=this.startEvent!==null,d=h1e(u.offset,{x:0,y:0})>=3;if(!c&&!d)return;const{point:f}=u,{timestamp:h}=Ln;this.history.push({...f,timestamp:h});const{onStart:p,onMove:m}=this.handlers;c||(p&&p(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,u)},this.handlePointerMove=(u,c)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=h_(c,this.transformPagePoint),_t.update(this.updatePoint,!0)},this.handlePointerUp=(u,c)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:d,onSessionEnd:f}=this.handlers,h=p_(u.type==="pointercancel"?this.lastMoveEventInfo:h_(c,this.transformPagePoint),this.history);this.startEvent&&d&&d(u,h),f&&f(u,h)},!$D(t))return;this.handlers=n,this.transformPagePoint=r;const i=a1(t),o=h_(i,this.transformPagePoint),{point:s}=o,{timestamp:a}=Ln;this.history=[{...s,timestamp:a}];const{onSessionStart:l}=n;l&&l(t,p_(o,this.history)),this.removeListeners=Is(Mo(window,"pointermove",this.handlePointerMove),Mo(window,"pointerup",this.handlePointerUp),Mo(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),zo(this.updatePoint)}}function h_(e,t){return t?{point:t(e.point)}:e}function v8(e,t){return{x:e.x-t.x,y:e.y-t.y}}function p_({point:e},t){return{point:e,delta:v8(e,wL(t)),offset:v8(e,p1e(t)),velocity:g1e(t,.1)}}function p1e(e){return e[0]}function wL(e){return e[e.length-1]}function g1e(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=wL(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Ns(t)));)n--;if(!r)return{x:0,y:0};const o=Io(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const s={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function Rr(e){return e.max-e.min}function V2(e,t=0,n=.01){return Math.abs(e-t)<=n}function b8(e,t,n,r=.5){e.origin=r,e.originPoint=Pt(t.min,t.max,e.origin),e.scale=Rr(n)/Rr(t),(V2(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=Pt(n.min,n.max,e.origin)-e.originPoint,(V2(e.translate)||isNaN(e.translate))&&(e.translate=0)}function Nd(e,t,n,r){b8(e.x,t.x,n.x,r?r.originX:void 0),b8(e.y,t.y,n.y,r?r.originY:void 0)}function _8(e,t,n){e.min=n.min+t.min,e.max=e.min+Rr(t)}function m1e(e,t,n){_8(e.x,t.x,n.x),_8(e.y,t.y,n.y)}function S8(e,t,n){e.min=t.min-n.min,e.max=e.min+Rr(t)}function Dd(e,t,n){S8(e.x,t.x,n.x),S8(e.y,t.y,n.y)}function y1e(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Pt(n,e,r.max):Math.min(e,n)),e}function w8(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function v1e(e,{top:t,left:n,bottom:r,right:i}){return{x:w8(e.x,n,i),y:w8(e.y,t,r)}}function x8(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Wf(t.min,t.max-r,e.min):r>i&&(n=Wf(e.min,e.max-i,t.min)),Ks(0,1,n)}function S1e(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const z2=.35;function w1e(e=z2){return e===!1?e=0:e===!0&&(e=z2),{x:C8(e,"left","right"),y:C8(e,"top","bottom")}}function C8(e,t,n){return{min:T8(e,t),max:T8(e,n)}}function T8(e,t){return typeof e=="number"?e:e[t]||0}const E8=()=>({translate:0,scale:1,origin:0,originPoint:0}),yu=()=>({x:E8(),y:E8()}),P8=()=>({min:0,max:0}),qt=()=>({x:P8(),y:P8()});function Di(e){return[e("x"),e("y")]}function xL({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function x1e({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function C1e(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function g_(e){return e===void 0||e===1}function U2({scale:e,scaleX:t,scaleY:n}){return!g_(e)||!g_(t)||!g_(n)}function Ta(e){return U2(e)||CL(e)||e.z||e.rotate||e.rotateX||e.rotateY}function CL(e){return A8(e.x)||A8(e.y)}function A8(e){return e&&e!=="0%"}function py(e,t,n){const r=e-n,i=t*r;return n+i}function k8(e,t,n,r,i){return i!==void 0&&(e=py(e,i,r)),py(e,n,r)+t}function G2(e,t=0,n=1,r,i){e.min=k8(e.min,t,n,r,i),e.max=k8(e.max,t,n,r,i)}function TL(e,{x:t,y:n}){G2(e.x,t.translate,t.scale,t.originPoint),G2(e.y,n.translate,n.scale,n.originPoint)}function T1e(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,s;for(let a=0;a1.0000000000001||e<.999999999999?e:1}function ds(e,t){e.min=e.min+t,e.max=e.max+t}function R8(e,t,[n,r,i]){const o=t[i]!==void 0?t[i]:.5,s=Pt(e.min,e.max,o);G2(e,t[n],t[r],s,t.scale)}const E1e=["x","scaleX","originX"],P1e=["y","scaleY","originY"];function vu(e,t){R8(e.x,t,E1e),R8(e.y,t,P1e)}function EL(e,t){return xL(C1e(e.getBoundingClientRect(),t))}function A1e(e,t,n){const r=EL(e,n),{scroll:i}=t;return i&&(ds(r.x,i.offset.x),ds(r.y,i.offset.y)),r}const k1e=new WeakMap;class O1e{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=qt(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=l=>{this.stopAnimation(),n&&this.snapToCursor(a1(l,"page").point)},o=(l,u)=>{const{drag:c,dragPropagation:d,onDragStart:f}=this.getProps();if(c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=BD(c),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Di(p=>{let m=this.getAxisMotionValue(p).get()||0;if(Zi.test(m)){const{projection:_}=this.visualElement;if(_&&_.layout){const y=_.layout.layoutBox[p];y&&(m=Rr(y)*(parseFloat(m)/100))}}this.originPoint[p]=m}),f&&_t.update(()=>f(l,u),!1,!0);const{animationState:h}=this.visualElement;h&&h.setActive("whileDrag",!0)},s=(l,u)=>{const{dragPropagation:c,dragDirectionLock:d,onDirectionLock:f,onDrag:h}=this.getProps();if(!c&&!this.openGlobalLock)return;const{offset:p}=u;if(d&&this.currentDirection===null){this.currentDirection=R1e(p),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",u.point,p),this.updateAxis("y",u.point,p),this.visualElement.render(),h&&h(l,u)},a=(l,u)=>this.stop(l,u);this.panSession=new SL(t,{onSessionStart:i,onStart:o,onMove:s,onSessionEnd:a},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&_t.update(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!Wp(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let s=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(s=y1e(s,this.constraints[t],this.elastic[t])),o.set(s)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),{layout:r}=this.visualElement.projection||{},i=this.constraints;t&&gu(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=v1e(r.layoutBox,t):this.constraints=!1,this.elastic=w1e(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Di(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=S1e(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!gu(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=A1e(r,i.root,this.visualElement.getTransformPagePoint());let s=b1e(i.layout.layoutBox,o);if(n){const a=n(x1e(s));this.hasMutatedConstraints=!!a,a&&(s=xL(a))}return s}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:s,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=Di(c=>{if(!Wp(c,n,this.currentDirection))return;let d=l&&l[c]||{};s&&(d={min:0,max:0});const f=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:r?t[c]:0,bounceStiffness:f,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...o,...d};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(s3(t,r,0,n))}stopAnimation(){Di(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n="_drag"+t.toUpperCase(),r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Di(n=>{const{drag:r}=this.getProps();if(!Wp(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:s,max:a}=i.layout.layoutBox[n];o.set(t[n]-Pt(s,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!gu(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Di(s=>{const a=this.getAxisMotionValue(s);if(a){const l=a.get();i[s]=_1e({min:l,max:l},this.constraints[s])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Di(s=>{if(!Wp(s,t,null))return;const a=this.getAxisMotionValue(s),{min:l,max:u}=this.constraints[s];a.set(Pt(l,u,i[s]))})}addListeners(){if(!this.visualElement.current)return;k1e.set(this.visualElement,this);const t=this.visualElement.current,n=Mo(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();gu(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),r();const s=Po(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Di(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{s(),n(),o(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:s=z2,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:s,dragMomentum:a}}}function Wp(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function R1e(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class M1e extends ca{constructor(t){super(t),this.removeGroupControls=Yt,this.removeListeners=Yt,this.controls=new O1e(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Yt}unmount(){this.removeGroupControls(),this.removeListeners()}}const M8=e=>(t,n)=>{e&&_t.update(()=>e(t,n))};class I1e extends ca{constructor(){super(...arguments),this.removePointerDownListener=Yt}onPointerDown(t){this.session=new SL(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:M8(t),onStart:M8(n),onMove:r,onEnd:(o,s)=>{delete this.session,i&&_t.update(()=>i(o,s))}}}mount(){this.removePointerDownListener=Mo(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function N1e(){const e=k.useContext($h);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,i=k.useId();return k.useEffect(()=>r(i),[]),!t&&n?[!1,()=>n&&n(i)]:[!0]}function P4e(){return D1e(k.useContext($h))}function D1e(e){return e===null?!0:e.isPresent}const kg={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function I8(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const sd={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(me.test(e))e=parseFloat(e);else return e;const n=I8(e,t.target.x),r=I8(e,t.target.y);return`${n}% ${r}%`}},L1e={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Xs.parse(e);if(i.length>5)return r;const o=Xs.createTransformer(e),s=typeof i[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;i[0+s]/=a,i[1+s]/=l;const u=Pt(a,l,.5);return typeof i[2+s]=="number"&&(i[2+s]/=u),typeof i[3+s]=="number"&&(i[3+s]/=u),o(i)}};class $1e extends We.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;Gye(F1e),o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),kg.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,s=r.projection;return s&&(s.isPresent=o,i||t.layoutDependency!==n||n===void 0?s.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?s.promote():s.relegate()||_t.postRender(()=>{const a=s.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function PL(e){const[t,n]=N1e(),r=k.useContext(qC);return We.createElement($1e,{...e,layoutGroup:r,switchLayoutGroup:k.useContext(wD),isPresent:t,safeToRemove:n})}const F1e={borderRadius:{...sd,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:sd,borderTopRightRadius:sd,borderBottomLeftRadius:sd,borderBottomRightRadius:sd,boxShadow:L1e},AL=["TopLeft","TopRight","BottomLeft","BottomRight"],B1e=AL.length,N8=e=>typeof e=="string"?parseFloat(e):e,D8=e=>typeof e=="number"||me.test(e);function j1e(e,t,n,r,i,o){i?(e.opacity=Pt(0,n.opacity!==void 0?n.opacity:1,V1e(r)),e.opacityExit=Pt(t.opacity!==void 0?t.opacity:1,0,z1e(r))):o&&(e.opacity=Pt(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let s=0;srt?1:n(Wf(e,t,r))}function $8(e,t){e.min=t.min,e.max=t.max}function jr(e,t){$8(e.x,t.x),$8(e.y,t.y)}function F8(e,t,n,r,i){return e-=t,e=py(e,1/n,r),i!==void 0&&(e=py(e,1/i,r)),e}function U1e(e,t=0,n=1,r=.5,i,o=e,s=e){if(Zi.test(t)&&(t=parseFloat(t),t=Pt(s.min,s.max,t/100)-s.min),typeof t!="number")return;let a=Pt(o.min,o.max,r);e===o&&(a-=t),e.min=F8(e.min,t,n,a,i),e.max=F8(e.max,t,n,a,i)}function B8(e,t,[n,r,i],o,s){U1e(e,t[n],t[r],t[i],t.scale,o,s)}const G1e=["x","scaleX","originX"],H1e=["y","scaleY","originY"];function j8(e,t,n,r){B8(e.x,t,G1e,n?n.x:void 0,r?r.x:void 0),B8(e.y,t,H1e,n?n.y:void 0,r?r.y:void 0)}function V8(e){return e.translate===0&&e.scale===1}function OL(e){return V8(e.x)&&V8(e.y)}function H2(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function z8(e){return Rr(e.x)/Rr(e.y)}class q1e{constructor(){this.members=[]}add(t){a3(this.members,t),t.scheduleRender()}remove(t){if(l3(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function U8(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y;if((i||o)&&(r=`translate3d(${i}px, ${o}px, 0) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{rotate:l,rotateX:u,rotateY:c}=n;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),c&&(r+=`rotateY(${c}deg) `)}const s=e.x.scale*t.x,a=e.y.scale*t.y;return(s!==1||a!==1)&&(r+=`scale(${s}, ${a})`),r||"none"}const W1e=(e,t)=>e.depth-t.depth;class K1e{constructor(){this.children=[],this.isDirty=!1}add(t){a3(this.children,t),this.isDirty=!0}remove(t){l3(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(W1e),this.isDirty=!1,this.children.forEach(t)}}function X1e(e,t){const n=performance.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(zo(r),e(o-t))};return _t.read(r,!0),()=>zo(r)}function Y1e(e){window.MotionDebug&&window.MotionDebug.record(e)}function Q1e(e){return e instanceof SVGElement&&e.tagName!=="svg"}function Z1e(e,t,n){const r=_r(e)?e:dc(e);return r.start(s3("",r,t,n)),r.animation}const G8=["","X","Y","Z"],H8=1e3;let J1e=0;const Ea={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function RL({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(s={},a=t==null?void 0:t()){this.id=J1e++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{Ea.totalNodes=Ea.resolvedTargetDeltas=Ea.recalculatedProjection=0,this.nodes.forEach(nbe),this.nodes.forEach(abe),this.nodes.forEach(lbe),this.nodes.forEach(rbe),Y1e(Ea)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(s,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=X1e(f,250),kg.hasAnimatedSinceResize&&(kg.hasAnimatedSinceResize=!1,this.nodes.forEach(W8))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||hbe,{onLayoutAnimationStart:_,onLayoutAnimationComplete:y}=c.getProps(),v=!this.targetLayout||!H2(this.targetLayout,p)||h,g=!f&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||f&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,g);const b={...yL(m,"layout"),onPlay:_,onComplete:y};(c.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b)}else f||W8(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,zo(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(ube),this.animationId++)}getTransformTemplate(){const{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;cthis.update()))}clearAllSnapshots(){this.nodes.forEach(ibe),this.sharedNodes.forEach(cbe)}scheduleUpdateProjection(){_t.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){_t.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const S=b/1e3;K8(d.x,s.x,S),K8(d.y,s.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Dd(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),dbe(this.relativeTarget,this.relativeTargetOrigin,f,S),g&&H2(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=qt()),jr(g,this.relativeTarget)),m&&(this.animationValues=c,j1e(c,u,this.latestValues,S,v,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(zo(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=_t.update(()=>{kg.hasAnimatedSinceResize=!0,this.currentAnimation=Z1e(0,H8,{...s,onUpdate:a=>{this.mixTargetDelta(a),s.onUpdate&&s.onUpdate(a)},onComplete:()=>{s.onComplete&&s.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(H8),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const s=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:c}=s;if(!(!a||!l||!u)){if(this!==s&&this.layout&&u&&ML(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||qt();const d=Rr(this.layout.layoutBox.x);l.x.min=s.target.x.min,l.x.max=l.x.min+d;const f=Rr(this.layout.layoutBox.y);l.y.min=s.target.y.min,l.y.max=l.y.min+f}jr(a,l),vu(a,c),Nd(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(s,a){this.sharedNodes.has(s)||this.sharedNodes.set(s,new q1e),this.sharedNodes.get(s).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const s=this.getStack();return s?s.lead===this:!0}getLead(){var s;const{layoutId:a}=this.options;return a?((s=this.getStack())===null||s===void 0?void 0:s.lead)||this:this}getPrevLead(){var s;const{layoutId:a}=this.options;return a?(s=this.getStack())===null||s===void 0?void 0:s.prevLead:void 0}getStack(){const{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),s&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const s=this.getStack();return s?s.relegate(this):!1}resetRotation(){const{visualElement:s}=this.options;if(!s)return;let a=!1;const{latestValues:l}=s;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(a=!0),!a)return;const u={};for(let c=0;c{var a;return(a=s.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(q8),this.root.sharedNodes.clear()}}}function ebe(e){e.updateLayout()}function tbe(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:o}=e.options,s=n.source!==e.layout.source;o==="size"?Di(d=>{const f=s?n.measuredBox[d]:n.layoutBox[d],h=Rr(f);f.min=r[d].min,f.max=f.min+h}):ML(o,n.layoutBox,r)&&Di(d=>{const f=s?n.measuredBox[d]:n.layoutBox[d],h=Rr(r[d]);f.max=f.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+h)});const a=yu();Nd(a,r,n.layoutBox);const l=yu();s?Nd(l,e.applyTransform(i,!0),n.measuredBox):Nd(l,r,n.layoutBox);const u=!OL(a);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:h}=d;if(f&&h){const p=qt();Dd(p,n.layoutBox,f.layoutBox);const m=qt();Dd(m,r,h.layoutBox),H2(p,m)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=m,e.relativeTargetOrigin=p,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function nbe(e){Ea.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function rbe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ibe(e){e.clearSnapshot()}function q8(e){e.clearMeasurements()}function obe(e){e.isLayoutDirty=!1}function sbe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function W8(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function abe(e){e.resolveTargetDelta()}function lbe(e){e.calcProjection()}function ube(e){e.resetRotation()}function cbe(e){e.removeLeadSnapshot()}function K8(e,t,n){e.translate=Pt(t.translate,0,n),e.scale=Pt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function X8(e,t,n,r){e.min=Pt(t.min,n.min,r),e.max=Pt(t.max,n.max,r)}function dbe(e,t,n,r){X8(e.x,t.x,n.x,r),X8(e.y,t.y,n.y,r)}function fbe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const hbe={duration:.45,ease:[.4,0,.1,1]};function Y8(e){e.min=Math.round(e.min*2)/2,e.max=Math.round(e.max*2)/2}function pbe(e){Y8(e.x),Y8(e.y)}function ML(e,t,n){return e==="position"||e==="preserve-aspect"&&!V2(z8(t),z8(n),.2)}const gbe=RL({attachResizeListener:(e,t)=>Po(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),m_={current:void 0},IL=RL({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!m_.current){const e=new gbe({});e.mount(window),e.setOptions({layoutScroll:!0}),m_.current=e}return m_.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),mbe={pan:{Feature:I1e},drag:{Feature:M1e,ProjectionNode:IL,MeasureLayout:PL}},ybe=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function vbe(e){const t=ybe.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function q2(e,t,n=1){const[r,i]=vbe(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);return o?o.trim():N2(i)?q2(i,t,n+1):i}function bbe(e,{...t},n){const r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&(n={...n}),e.values.forEach(i=>{const o=i.get();if(!N2(o))return;const s=q2(o,r);s&&i.set(s)});for(const i in t){const o=t[i];if(!N2(o))continue;const s=q2(o,r);s&&(t[i]=s,n||(n={}),n[i]===void 0&&(n[i]=o))}return{target:t,transitionEnd:n}}const _be=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),NL=e=>_be.has(e),Sbe=e=>Object.keys(e).some(NL),Q8=e=>e===Al||e===me,Z8=(e,t)=>parseFloat(e.split(", ")[t]),J8=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return Z8(i[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?Z8(o[1],e):0}},wbe=new Set(["x","y","z"]),xbe=Fh.filter(e=>!wbe.has(e));function Cbe(e){const t=[];return xbe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t.length&&e.render(),t}const fc={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:J8(4,13),y:J8(5,14)};fc.translateX=fc.x;fc.translateY=fc.y;const Tbe=(e,t,n)=>{const r=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:s}=o,a={};s==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{a[u]=fc[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const c=t.getValue(u);c&&c.jump(a[u]),e[u]=fc[u](l,o)}),e},Ebe=(e,t,n={},r={})=>{t={...t},r={...r};const i=Object.keys(t).filter(NL);let o=[],s=!1;const a=[];if(i.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let c=n[l],d=od(c);const f=t[l];let h;if(uy(f)){const p=f.length,m=f[0]===null?1:0;c=f[m],d=od(c);for(let _=m;_=0?window.pageYOffset:null,u=Tbe(t,e,a);return o.length&&o.forEach(([c,d])=>{e.getValue(c).set(d)}),e.render(),r1&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function Pbe(e,t,n,r){return Sbe(t)?Ebe(e,t,n,r):{target:t,transitionEnd:r}}const Abe=(e,t,n,r)=>{const i=bbe(e,t,r);return t=i.target,r=i.transitionEnd,Pbe(e,t,n,r)},W2={current:null},DL={current:!1};function kbe(){if(DL.current=!0,!!r1)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>W2.current=e.matches;e.addListener(t),t()}else W2.current=!1}function Obe(e,t,n){const{willChange:r}=t;for(const i in t){const o=t[i],s=n[i];if(_r(o))e.addValue(i,o),hy(r)&&r.add(i);else if(_r(s))e.addValue(i,dc(o,{owner:e})),hy(r)&&r.remove(i);else if(s!==o)if(e.hasValue(i)){const a=e.getValue(i);!a.hasAnimated&&a.set(o)}else{const a=e.getStaticValue(i);e.addValue(i,dc(a!==void 0?a:o,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const eP=new WeakMap,LL=Object.keys(qf),Rbe=LL.length,tP=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Mbe=HC.length;class Ibe{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>_t.render(this.render,!1,!0);const{latestValues:a,renderState:l}=o;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=s,this.isControllingVariants=o1(n),this.isVariantNode=SD(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(n,{});for(const d in c){const f=c[d];a[d]!==void 0&&_r(f)&&(f.set(a[d],!1),hy(u)&&u.add(d))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,eP.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),DL.current||kbe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:W2.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){eP.delete(this.current),this.projection&&this.projection.unmount(),zo(this.notifyUpdate),zo(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,n){const r=Pl.has(t),i=n.on("change",s=>{this.latestValues[t]=s,this.props.onUpdate&&_t.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{i(),o()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...n},r,i,o){let s,a;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:f,layoutRoot:h})}return a}updateFeatures(){for(const t in this.features){const n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):qt()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}makeTargetAnimatable(t,n=!0){return this.makeTargetAnimatableFromInstance(t,this.props,n)}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){n!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,n)),this.values.set(t,n),this.latestValues[t]=n.get()}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=dc(n,{owner:this}),this.addValue(t,r)),r}readValue(t){var n;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(n=this.getBaseTargetFromProps(this.props,t))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props,i=typeof r=="string"||typeof r=="object"?(n=e3(this.props,r))===null||n===void 0?void 0:n[t]:void 0;if(r&&i!==void 0)return i;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!_r(o)?o:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new u3),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class $L extends Ibe{sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:n,...r},{transformValues:i},o){let s=Zve(r,t||{},this);if(i&&(n&&(n=i(n)),r&&(r=i(r)),s&&(s=i(s))),o){Yve(this,r,s);const a=Abe(this,r,s,n);n=a.transitionEnd,r=a.target}return{transition:t,transitionEnd:n,...r}}}function Nbe(e){return window.getComputedStyle(e)}class Dbe extends $L{readValueFromInstance(t,n){if(Pl.has(n)){const r=o3(n);return r&&r.default||0}else{const r=Nbe(t),i=(TD(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return EL(t,n)}build(t,n,r,i){KC(t,n,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,n){return JC(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;_r(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,i){RD(t,n,r,i)}}class Lbe extends $L{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Pl.has(n)){const r=o3(n);return r&&r.default||0}return n=MD.has(n)?n:ZC(n),t.getAttribute(n)}measureInstanceViewportBox(){return qt()}scrapeMotionValuesFromProps(t,n){return ND(t,n)}build(t,n,r,i){YC(t,n,r,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,r,i){ID(t,n,r,i)}mount(t){this.isSVGTag=QC(t.tagName),super.mount(t)}}const $be=(e,t)=>WC(e)?new Lbe(t,{enableHardwareAcceleration:!1}):new Dbe(t,{enableHardwareAcceleration:!0}),Fbe={layout:{ProjectionNode:IL,MeasureLayout:PL}},Bbe={...f1e,...I0e,...mbe,...Fbe},jbe=zye((e,t)=>y0e(e,t,Bbe,$be));function FL(){const e=k.useRef(!1);return sy(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Vbe(){const e=FL(),[t,n]=k.useState(0),r=k.useCallback(()=>{e.current&&n(t+1)},[t]);return[k.useCallback(()=>_t.postRender(r),[r]),t]}class zbe extends k.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Ube({children:e,isPresent:t}){const n=k.useId(),r=k.useRef(null),i=k.useRef({width:0,height:0,top:0,left:0});return k.useInsertionEffect(()=>{const{width:o,height:s,top:a,left:l}=i.current;if(t||!r.current||!o||!s)return;r.current.dataset.motionPopId=n;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` + [data-motion-pop-id="${n}"] { + position: absolute !important; + width: ${o}px !important; + height: ${s}px !important; + top: ${a}px !important; + left: ${l}px !important; + } + `),()=>{document.head.removeChild(u)}},[t]),k.createElement(zbe,{isPresent:t,childRef:r,sizeRef:i},k.cloneElement(e,{ref:r}))}const y_=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:s})=>{const a=DD(Gbe),l=k.useId(),u=k.useMemo(()=>({id:l,initial:t,isPresent:n,custom:i,onExitComplete:c=>{a.set(c,!0);for(const d of a.values())if(!d)return;r&&r()},register:c=>(a.set(c,!1),()=>a.delete(c))}),o?void 0:[n]);return k.useMemo(()=>{a.forEach((c,d)=>a.set(d,!1))},[n]),k.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),s==="popLayout"&&(e=k.createElement(Ube,{isPresent:n},e)),k.createElement($h.Provider,{value:u},e)};function Gbe(){return new Map}function Hbe(e){return k.useEffect(()=>()=>e(),[])}const Jl=e=>e.key||"";function qbe(e,t){e.forEach(n=>{const r=Jl(n);t.set(r,n)})}function Wbe(e){const t=[];return k.Children.forEach(e,n=>{k.isValidElement(n)&&t.push(n)}),t}const Kbe=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:o=!0,mode:s="sync"})=>{const a=k.useContext(qC).forceRender||Vbe()[0],l=FL(),u=Wbe(e);let c=u;const d=k.useRef(new Map).current,f=k.useRef(c),h=k.useRef(new Map).current,p=k.useRef(!0);if(sy(()=>{p.current=!1,qbe(u,h),f.current=c}),Hbe(()=>{p.current=!0,h.clear(),d.clear()}),p.current)return k.createElement(k.Fragment,null,c.map(v=>k.createElement(y_,{key:Jl(v),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:s},v)));c=[...c];const m=f.current.map(Jl),_=u.map(Jl),y=m.length;for(let v=0;v{if(_.indexOf(g)!==-1)return;const b=h.get(g);if(!b)return;const S=m.indexOf(g);let w=v;if(!w){const x=()=>{h.delete(g),d.delete(g);const T=f.current.findIndex(P=>P.key===g);if(f.current.splice(T,1),!d.size){if(f.current=u,l.current===!1)return;a(),r&&r()}};w=k.createElement(y_,{key:Jl(b),isPresent:!1,onExitComplete:x,custom:t,presenceAffectsLayout:o,mode:s},b),d.set(g,w)}c.splice(S,0,w)}),c=c.map(v=>{const g=v.key;return d.has(g)?v:k.createElement(y_,{key:Jl(v),isPresent:!0,presenceAffectsLayout:o,mode:s},v)}),k.createElement(k.Fragment,null,d.size?c:c.map(v=>k.cloneElement(v)))};var Xbe=Dge({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),BL=El((e,t)=>{const n=vD("Spinner",e),{label:r="Loading...",thickness:i="2px",speed:o="0.45s",emptyColor:s="transparent",className:a,...l}=pD(e),u=aD("chakra-spinner",a),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:s,borderLeftColor:s,animation:`${Xbe} ${o} linear infinite`,...n};return K.jsx(al.div,{ref:t,__css:c,className:u,...l,children:r&&K.jsx(al.span,{srOnly:!0,children:r})})});BL.displayName="Spinner";var K2=El(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:o,...s}=t;return K.jsx("img",{width:r,height:i,ref:n,alt:o,...s})});K2.displayName="NativeImage";function Ybe(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:o,crossOrigin:s,sizes:a,ignoreFallback:l}=e,[u,c]=k.useState("pending");k.useEffect(()=>{c(n?"loading":"pending")},[n]);const d=k.useRef(),f=k.useCallback(()=>{if(!n)return;h();const p=new Image;p.src=n,s&&(p.crossOrigin=s),r&&(p.srcset=r),a&&(p.sizes=a),t&&(p.loading=t),p.onload=m=>{h(),c("loaded"),i==null||i(m)},p.onerror=m=>{h(),c("failed"),o==null||o(m)},d.current=p},[n,s,r,a,i,o,t]),h=()=>{d.current&&(d.current.onload=null,d.current.onerror=null,d.current=null)};return Lge(()=>{if(!l)return u==="loading"&&f(),()=>{h()}},[u,f,l]),l?"loaded":u}var Qbe=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function Zbe(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var c3=El(function(t,n){const{fallbackSrc:r,fallback:i,src:o,srcSet:s,align:a,fit:l,loading:u,ignoreFallback:c,crossOrigin:d,fallbackStrategy:f="beforeLoadOrError",referrerPolicy:h,...p}=t,m=r!==void 0||i!==void 0,_=u!=null||c||!m,y=Ybe({...t,crossOrigin:d,ignoreFallback:_}),v=Qbe(y,f),g={ref:n,objectFit:l,objectPosition:a,..._?p:Zbe(p,["onError","onLoad"])};return v?i||K.jsx(al.img,{as:K2,className:"chakra-image__placeholder",src:r,...g}):K.jsx(al.img,{as:K2,src:o,srcSet:s,crossOrigin:d,loading:u,referrerPolicy:h,className:"chakra-image",...g})});c3.displayName="Image";var Jbe=sye?k.useLayoutEffect:k.useEffect;function nP(e,t=[]){const n=k.useRef(e);return Jbe(()=>{n.current=e}),k.useCallback((...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},t)}function e_e(e,t){const n=k.useId();return k.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function t_e(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function n_e(e={}){const{onClose:t,onOpen:n,isOpen:r,id:i}=e,o=nP(n),s=nP(t),[a,l]=k.useState(e.defaultIsOpen||!1),[u,c]=t_e(r,a),d=e_e(i,"disclosure"),f=k.useCallback(()=>{u||l(!1),s==null||s()},[u,s]),h=k.useCallback(()=>{u||l(!0),o==null||o()},[u,o]),p=k.useCallback(()=>{(c?f:h)()},[c,h,f]);return{isOpen:!!c,onOpen:h,onClose:f,onToggle:p,isControlled:u,getButtonProps:(m={})=>({...m,"aria-expanded":c,"aria-controls":d,onClick:hye(m.onClick,p)}),getDisclosureProps:(m={})=>({...m,hidden:!c,id:d})}}var X2=El(function(t,n){const r=vD("Heading",t),{className:i,...o}=pD(t);return K.jsx(al.h2,{ref:n,className:aD("chakra-heading",t.className),...o,__css:r})});X2.displayName="Heading";var d3=al("div");d3.displayName="Box";var jL=El(function(t,n){const{size:r,centerContent:i=!0,...o}=t,s=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return K.jsx(d3,{ref:n,boxSize:r,__css:{...s,flexShrink:0,flexGrow:0},...o})});jL.displayName="Square";var r_e=El(function(t,n){const{size:r,...i}=t;return K.jsx(jL,{size:r,ref:n,borderRadius:"9999px",...i})});r_e.displayName="Circle";var f3=El(function(t,n){const{direction:r,align:i,justify:o,wrap:s,basis:a,grow:l,shrink:u,...c}=t,d={display:"flex",flexDirection:r,alignItems:i,justifyContent:o,flexWrap:s,flexBasis:a,flexGrow:l,flexShrink:u};return K.jsx(al.div,{ref:n,__css:d,...c})});f3.displayName="Flex";const i_e=""+new URL("logo-13003d72.png",import.meta.url).href,o_e=()=>K.jsxs(f3,{position:"relative",width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#151519",children:[K.jsx(c3,{src:i_e,w:"8rem",h:"8rem"}),K.jsx(BL,{label:"Loading",color:"grey",position:"absolute",size:"sm",width:"24px !important",height:"24px !important",right:"1.5rem",bottom:"1.5rem"})]}),s_e=k.memo(o_e);function Y2(e){"@babel/helpers - typeof";return Y2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Y2(e)}var VL=[],a_e=VL.forEach,l_e=VL.slice;function Q2(e){return a_e.call(l_e.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}function zL(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Y2(XMLHttpRequest))==="object"}function u_e(e){return!!e&&typeof e.then=="function"}function c_e(e){return u_e(e)?e:Promise.resolve(e)}function d_e(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Z2={exports:{}},Kp={exports:{}},rP;function f_e(){return rP||(rP=1,function(e,t){var n=typeof self<"u"?self:Ee,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(s){var a={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function l(C){return C&&DataView.prototype.isPrototypeOf(C)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(C){return C&&u.indexOf(Object.prototype.toString.call(C))>-1};function d(C){if(typeof C!="string"&&(C=String(C)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(C))throw new TypeError("Invalid character in header field name");return C.toLowerCase()}function f(C){return typeof C!="string"&&(C=String(C)),C}function h(C){var O={next:function(){var I=C.shift();return{done:I===void 0,value:I}}};return a.iterable&&(O[Symbol.iterator]=function(){return O}),O}function p(C){this.map={},C instanceof p?C.forEach(function(O,I){this.append(I,O)},this):Array.isArray(C)?C.forEach(function(O){this.append(O[0],O[1])},this):C&&Object.getOwnPropertyNames(C).forEach(function(O){this.append(O,C[O])},this)}p.prototype.append=function(C,O){C=d(C),O=f(O);var I=this.map[C];this.map[C]=I?I+", "+O:O},p.prototype.delete=function(C){delete this.map[d(C)]},p.prototype.get=function(C){return C=d(C),this.has(C)?this.map[C]:null},p.prototype.has=function(C){return this.map.hasOwnProperty(d(C))},p.prototype.set=function(C,O){this.map[d(C)]=f(O)},p.prototype.forEach=function(C,O){for(var I in this.map)this.map.hasOwnProperty(I)&&C.call(O,this.map[I],I,this)},p.prototype.keys=function(){var C=[];return this.forEach(function(O,I){C.push(I)}),h(C)},p.prototype.values=function(){var C=[];return this.forEach(function(O){C.push(O)}),h(C)},p.prototype.entries=function(){var C=[];return this.forEach(function(O,I){C.push([I,O])}),h(C)},a.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function m(C){if(C.bodyUsed)return Promise.reject(new TypeError("Already read"));C.bodyUsed=!0}function _(C){return new Promise(function(O,I){C.onload=function(){O(C.result)},C.onerror=function(){I(C.error)}})}function y(C){var O=new FileReader,I=_(O);return O.readAsArrayBuffer(C),I}function v(C){var O=new FileReader,I=_(O);return O.readAsText(C),I}function g(C){for(var O=new Uint8Array(C),I=new Array(O.length),N=0;N-1?O:C}function T(C,O){O=O||{};var I=O.body;if(C instanceof T){if(C.bodyUsed)throw new TypeError("Already read");this.url=C.url,this.credentials=C.credentials,O.headers||(this.headers=new p(C.headers)),this.method=C.method,this.mode=C.mode,this.signal=C.signal,!I&&C._bodyInit!=null&&(I=C._bodyInit,C.bodyUsed=!0)}else this.url=String(C);if(this.credentials=O.credentials||this.credentials||"same-origin",(O.headers||!this.headers)&&(this.headers=new p(O.headers)),this.method=x(O.method||this.method||"GET"),this.mode=O.mode||this.mode||null,this.signal=O.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&I)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(I)}T.prototype.clone=function(){return new T(this,{body:this._bodyInit})};function P(C){var O=new FormData;return C.trim().split("&").forEach(function(I){if(I){var N=I.split("="),R=N.shift().replace(/\+/g," "),D=N.join("=").replace(/\+/g," ");O.append(decodeURIComponent(R),decodeURIComponent(D))}}),O}function E(C){var O=new p,I=C.replace(/\r?\n[\t ]+/g," ");return I.split(/\r?\n/).forEach(function(N){var R=N.split(":"),D=R.shift().trim();if(D){var L=R.join(":").trim();O.append(D,L)}}),O}S.call(T.prototype);function A(C,O){O||(O={}),this.type="default",this.status=O.status===void 0?200:O.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in O?O.statusText:"OK",this.headers=new p(O.headers),this.url=O.url||"",this._initBody(C)}S.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},A.error=function(){var C=new A(null,{status:0,statusText:""});return C.type="error",C};var $=[301,302,303,307,308];A.redirect=function(C,O){if($.indexOf(O)===-1)throw new RangeError("Invalid status code");return new A(null,{status:O,headers:{location:C}})},s.DOMException=o.DOMException;try{new s.DOMException}catch{s.DOMException=function(O,I){this.message=O,this.name=I;var N=Error(O);this.stack=N.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function M(C,O){return new Promise(function(I,N){var R=new T(C,O);if(R.signal&&R.signal.aborted)return N(new s.DOMException("Aborted","AbortError"));var D=new XMLHttpRequest;function L(){D.abort()}D.onload=function(){var j={status:D.status,statusText:D.statusText,headers:E(D.getAllResponseHeaders()||"")};j.url="responseURL"in D?D.responseURL:j.headers.get("X-Request-URL");var U="response"in D?D.response:D.responseText;I(new A(U,j))},D.onerror=function(){N(new TypeError("Network request failed"))},D.ontimeout=function(){N(new TypeError("Network request failed"))},D.onabort=function(){N(new s.DOMException("Aborted","AbortError"))},D.open(R.method,R.url,!0),R.credentials==="include"?D.withCredentials=!0:R.credentials==="omit"&&(D.withCredentials=!1),"responseType"in D&&a.blob&&(D.responseType="blob"),R.headers.forEach(function(j,U){D.setRequestHeader(U,j)}),R.signal&&(R.signal.addEventListener("abort",L),D.onreadystatechange=function(){D.readyState===4&&R.signal.removeEventListener("abort",L)}),D.send(typeof R._bodyInit>"u"?null:R._bodyInit)})}return M.polyfill=!0,o.fetch||(o.fetch=M,o.Headers=p,o.Request=T,o.Response=A),s.Headers=p,s.Request=T,s.Response=A,s.fetch=M,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(Kp,Kp.exports)),Kp.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof Ee<"u"&&Ee.fetch?n=Ee.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof d_e<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||f_e();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(Z2,Z2.exports);var UL=Z2.exports;const GL=ll(UL),iP=MP({__proto__:null,default:GL},[UL]);function gy(e){"@babel/helpers - typeof";return gy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gy(e)}var No;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?No=global.fetch:typeof window<"u"&&window.fetch?No=window.fetch:No=fetch);var Kf;zL()&&(typeof global<"u"&&global.XMLHttpRequest?Kf=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(Kf=window.XMLHttpRequest));var my;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?my=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(my=window.ActiveXObject));!No&&iP&&!Kf&&!my&&(No=GL||iP);typeof No!="function"&&(No=void 0);var J2=function(t,n){if(n&&gy(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},oP=function(t,n,r){No(t,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(o){r(null,{status:i.status,data:o})}).catch(r)}).catch(r)},sP=!1,h_e=function(t,n,r,i){t.queryStringParams&&(n=J2(n,t.queryStringParams));var o=Q2({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);r&&(o["Content-Type"]="application/json");var s=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,a=Q2({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:o},sP?{}:s);try{oP(n,a,i)}catch(l){if(!s||Object.keys(s).length===0||!l.message||l.message.indexOf("not implemented")<0)return i(l);try{Object.keys(s).forEach(function(u){delete a[u]}),oP(n,a,i),sP=!0}catch(u){i(u)}}},p_e=function(t,n,r,i){r&&gy(r)==="object"&&(r=J2("",r).slice(1)),t.queryStringParams&&(n=J2(n,t.queryStringParams));try{var o;Kf?o=new Kf:o=new my("MSXML2.XMLHTTP.3.0"),o.open(r?"POST":"GET",n,1),t.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!t.withCredentials,r&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");var s=t.customHeaders;if(s=typeof s=="function"?s():s,s)for(var a in s)o.setRequestHeader(a,s[a]);o.onreadystatechange=function(){o.readyState>3&&i(o.status>=400?o.statusText:null,{status:o.status,data:o.responseText})},o.send(r)}catch(l){console&&console.log(l)}},g_e=function(t,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},No&&n.indexOf("file:")!==0)return h_e(t,n,r,i);if(zL()||typeof ActiveXObject=="function")return p_e(t,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function Xf(e){"@babel/helpers - typeof";return Xf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xf(e)}function m_e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aP(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};m_e(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return y_e(e,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=Q2(i,this.options||{},__e()),this.allOptions=o,this.services&&this.options.reloadInterval&&setInterval(function(){return r.reload()},this.options.reloadInterval)}},{key:"readMulti",value:function(n,r,i){this._readAny(n,n,r,r,i)}},{key:"read",value:function(n,r,i){this._readAny([n],n,[r],r,i)}},{key:"_readAny",value:function(n,r,i,o,s){var a=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,i)),l=c_e(l),l.then(function(u){if(!u)return s(null,{});var c=a.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});a.loadUrl(c,s,r,o)})}},{key:"loadUrl",value:function(n,r,i,o){var s=this,a=typeof i=="string"?[i]:i,l=typeof o=="string"?[o]:o,u=this.options.parseLoadPayload(a,l);this.options.request(this.options,n,u,function(c,d){if(d&&(d.status>=500&&d.status<600||!d.status))return r("failed loading "+n+"; status code: "+d.status,!0);if(d&&d.status>=400&&d.status<500)return r("failed loading "+n+"; status code: "+d.status,!1);if(!d&&c&&c.message&&c.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+c.message,!0);if(c)return r(c,!1);var f,h;try{typeof d.data=="string"?f=s.options.parse(d.data,i,o):f=d.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{key:"create",value:function(n,r,i,o,s){var a=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var l=this.options.parsePayload(r,i,o),u=0,c=[],d=[];n.forEach(function(f){var h=a.options.addPath;typeof a.options.addPath=="function"&&(h=a.options.addPath(f,r));var p=a.services.interpolator.interpolate(h,{lng:f,ns:r});a.options.request(a.options,p,l,function(m,_){u+=1,c.push(m),d.push(_),u===n.length&&typeof s=="function"&&s(c,d)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,o=r.languageUtils,s=r.logger,a=i.language;if(!(a&&a.toLowerCase()==="cimode")){var l=[],u=function(d){var f=o.toResolveHierarchy(d);f.forEach(function(h){l.indexOf(h)<0&&l.push(h)})};u(a),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){n.allOptions.ns.forEach(function(d){i.read(c,d,"read",null,null,function(f,h){f&&s.warn("loading namespace ".concat(d," for language ").concat(c," failed"),f),!f&&h&&s.log("loaded namespace ".concat(d," for language ").concat(c),h),i.loaded("".concat(c,"|").concat(d),f,h)})})})}}}]),e}();qL.type="backend";const S_e=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,w_e={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},x_e=e=>w_e[e],C_e=e=>e.replace(S_e,x_e);let ew={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:C_e};function T_e(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ew={...ew,...e}}function k4e(){return ew}let WL;function E_e(e){WL=e}function O4e(){return WL}const P_e={type:"3rdParty",init(e){T_e(e.options.react),E_e(e)}};Vn.use(qL).use(P_e).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const A_e=e=>{const{socket:t,storeApi:n}=e,{dispatch:r,getState:i}=n;t.on("connect",()=>{fe("socketio").debug("Connected"),r(i7());const{sessionId:s}=i().system;s&&(t.emit("subscribe",{session:s}),r(zx({sessionId:s})))}),t.on("connect_error",o=>{o&&o.message&&o.data==="ERR_UNAUTHENTICATED"&&r(Ft(Ha({title:o.message,status:"error",duration:1e4})))}),t.on("disconnect",()=>{r(s7())}),t.on("invocation_started",o=>{r(d7({data:o}))}),t.on("generator_progress",o=>{r(y7({data:o}))}),t.on("invocation_error",o=>{r(p7({data:o}))}),t.on("invocation_complete",o=>{r(Ux({data:o}))}),t.on("graph_execution_state_complete",o=>{r(g7({data:o}))}),t.on("model_load_started",o=>{r(b7({data:o}))}),t.on("model_load_completed",o=>{r(_7({data:o}))}),t.on("session_retrieval_error",o=>{r(S7({data:o}))}),t.on("invocation_retrieval_error",o=>{r(x7({data:o}))})},no=Object.create(null);no.open="0";no.close="1";no.ping="2";no.pong="3";no.message="4";no.upgrade="5";no.noop="6";const Og=Object.create(null);Object.keys(no).forEach(e=>{Og[no[e]]=e});const k_e={type:"error",data:"parser error"},KL=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",XL=typeof ArrayBuffer=="function",YL=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,h3=({type:e,data:t},n,r)=>KL&&t instanceof Blob?n?r(t):lP(t,r):XL&&(t instanceof ArrayBuffer||YL(t))?n?r(t):lP(new Blob([t]),r):r(no[e]+(t||"")),lP=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function uP(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let v_;function O_e(e,t){if(KL&&e.data instanceof Blob)return e.data.arrayBuffer().then(uP).then(t);if(XL&&(e.data instanceof ArrayBuffer||YL(e.data)))return t(uP(e.data));h3(e,!1,n=>{v_||(v_=new TextEncoder),t(v_.encode(n))})}const cP="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,o,s,a,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),c=new Uint8Array(u);for(r=0;r>4,c[i++]=(s&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return u},M_e=typeof ArrayBuffer=="function",p3=(e,t)=>{if(typeof e!="string")return{type:"message",data:QL(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:I_e(e.substring(1),t)}:Og[n]?e.length>1?{type:Og[n],data:e.substring(1)}:{type:Og[n]}:k_e},I_e=(e,t)=>{if(M_e){const n=R_e(e);return QL(n,t)}else return{base64:!0,data:e}},QL=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},ZL=String.fromCharCode(30),N_e=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,s)=>{h3(o,!1,a=>{r[s]=a,++i===n&&t(r.join(ZL))})})},D_e=(e,t)=>{const n=e.split(ZL),r=[];for(let i=0;i54;return p3(r?e:b_.decode(e),n)}const JL=4;function Qt(e){if(e)return $_e(e)}function $_e(e){for(var t in Qt.prototype)e[t]=Qt.prototype[t];return e}Qt.prototype.on=Qt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Qt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Qt.prototype.off=Qt.prototype.removeListener=Qt.prototype.removeAllListeners=Qt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function e$(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const F_e=Hr.setTimeout,B_e=Hr.clearTimeout;function u1(e,t){t.useNativeTimers?(e.setTimeoutFn=F_e.bind(Hr),e.clearTimeoutFn=B_e.bind(Hr)):(e.setTimeoutFn=Hr.setTimeout.bind(Hr),e.clearTimeoutFn=Hr.clearTimeout.bind(Hr))}const j_e=1.33;function V_e(e){return typeof e=="string"?z_e(e):Math.ceil((e.byteLength||e.size)*j_e)}function z_e(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function U_e(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function G_e(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function n$(){const e=hP(+new Date);return e!==fP?(dP=0,fP=e):e+"."+hP(dP++)}for(;Xp{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};D_e(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,N_e(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=n$()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Bu(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}let Bu=class Rg extends Qt{constructor(t,n){super(),u1(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=e$(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new i$(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=Rg.requestsCount++,Rg.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=K_e,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Rg.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Bu.requestsCount=0;Bu.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",pP);else if(typeof addEventListener=="function"){const e="onpagehide"in Hr?"pagehide":"unload";addEventListener(e,pP,!1)}}function pP(){for(let e in Bu.requests)Bu.requests.hasOwnProperty(e)&&Bu.requests[e].abort()}const m3=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),Yp=Hr.WebSocket||Hr.MozWebSocket,gP=!0,Q_e="arraybuffer",mP=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Z_e extends g3{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=mP?{}:e$(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=gP&&!mP?n?new Yp(t,n):new Yp(t):new Yp(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType||Q_e,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const s={};try{gP&&this.ws.send(o)}catch{}i&&m3(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=n$()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!Yp}}function J_e(e,t){return e.type==="message"&&typeof e.data!="string"&&t[0]>=48&&t[0]<=54}class eSe extends g3{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=t.readable.getReader();this.writer=t.writable.getWriter();let r;const i=()=>{n.read().then(({done:s,value:a})=>{s||(!r&&a.byteLength===1&&a[0]===54?r=!0:(this.onPacket(L_e(a,r,"arraybuffer")),r=!1),i())}).catch(s=>{})};i();const o=this.query.sid?`0{"sid":"${this.query.sid}"}`:"0";this.writer.write(new TextEncoder().encode(o)).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{J_e(r,o)&&this.writer.write(Uint8Array.of(54)),this.writer.write(o).then(()=>{i&&m3(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const tSe={websocket:Z_e,webtransport:eSe,polling:Y_e},nSe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,rSe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function nw(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=nSe.exec(e||""),o={},s=14;for(;s--;)o[rSe[s]]=i[s]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=iSe(o,o.path),o.queryKey=oSe(o,o.query),o}function iSe(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function oSe(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let o$=class eu extends Qt{constructor(t,n={}){super(),this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=nw(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=nw(n.host).host),u1(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=G_e(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=JL,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new tSe[t](r)}open(){let t;if(this.opts.rememberUpgrade&&eu.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;eu.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;eu.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function o(){r||(r=!0,c(),n.close(),n=null)}const s=d=>{const f=new Error("probe error: "+d);f.transport=n.name,o(),this.emitReserved("upgradeError",f)};function a(){s("transport closed")}function l(){s("socket closed")}function u(d){n&&d.name!==n.name&&o()}const c=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",a),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",s),n.once("close",a),this.once("close",l),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",eu.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){eu.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,s$=Object.prototype.toString,uSe=typeof Blob=="function"||typeof Blob<"u"&&s$.call(Blob)==="[object BlobConstructor]",cSe=typeof File=="function"||typeof File<"u"&&s$.call(File)==="[object FileConstructor]";function y3(e){return aSe&&(e instanceof ArrayBuffer||lSe(e))||uSe&&e instanceof Blob||cSe&&e instanceof File}function Mg(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let s=0;s{this.io.clearTimeoutFn(o),n.apply(this,[null,...s])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,o)=>{n.push((s,a)=>r?s?o(s):i(a):i(s)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ie.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ie.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ie.EVENT:case Ie.BINARY_EVENT:this.onevent(t);break;case Ie.ACK:case Ie.BINARY_ACK:this.onack(t);break;case Ie.DISCONNECT:this.ondisconnect();break;case Ie.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Ie.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ie.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}Pc.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Pc.prototype.reset=function(){this.attempts=0};Pc.prototype.setMin=function(e){this.ms=e};Pc.prototype.setMax=function(e){this.max=e};Pc.prototype.setJitter=function(e){this.jitter=e};class ow extends Qt{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,u1(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Pc({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||ySe;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new o$(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=li(n,"open",function(){r.onopen(),t&&t()}),o=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},s=li(n,"error",o);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(li(t,"ping",this.onping.bind(this)),li(t,"data",this.ondata.bind(this)),li(t,"error",this.onerror.bind(this)),li(t,"close",this.onclose.bind(this)),li(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){m3(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new a$(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const ad={};function Ig(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=sSe(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=ad[i]&&o in ad[i].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let l;return a?l=new ow(r,t):(ad[i]||(ad[i]=new ow(r,t)),l=ad[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(Ig,{Manager:ow,Socket:a$,io:Ig,connect:Ig});const vP=()=>{let e=!1,t=`ws://${window.location.host}`;const n={timeout:6e4,path:"/ws/socket.io",autoConnect:!1};if(["nodes","package"].includes("production")){const o=Ef.get();o&&(t=o.replace(/^https?\:\/\//i,""));const s=Tf.get();s&&(n.auth={token:s}),n.transports=["websocket","polling"]}const r=Ig(t,n);return o=>s=>a=>{const{dispatch:l,getState:u}=o;if(e||(A_e({storeApi:o,socket:r}),e=!0,r.connect()),kn.fulfilled.match(a)){const c=a.payload.id,d=u().system.sessionId;d&&(r.emit("unsubscribe",{session:d}),l(u7({sessionId:d}))),r.emit("subscribe",{session:c}),l(zx({sessionId:c}))}s(a)}},c1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ac(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function b3(e){return"nodeType"in e}function ir(e){var t,n;return e?Ac(e)?e:b3(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function _3(e){const{Document:t}=ir(e);return e instanceof t}function zh(e){return Ac(e)?!1:e instanceof ir(e).HTMLElement}function bSe(e){return e instanceof ir(e).SVGElement}function kc(e){return e?Ac(e)?e.document:b3(e)?_3(e)?e:zh(e)?e.ownerDocument:document:document:document}const ro=c1?k.useLayoutEffect:k.useEffect;function d1(e){const t=k.useRef(e);return ro(()=>{t.current=e}),k.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{e.current=setInterval(r,i)},[]),n=k.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Yf(e,t){t===void 0&&(t=[e]);const n=k.useRef(e);return ro(()=>{n.current!==e&&(n.current=e)},t),n}function Uh(e,t){const n=k.useRef();return k.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function yy(e){const t=d1(e),n=k.useRef(null),r=k.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function vy(e){const t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}let __={};function f1(e,t){return k.useMemo(()=>{if(t)return t;const n=__[e]==null?0:__[e]+1;return __[e]=n,e+"-"+n},[e,t])}function l$(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const a=Object.entries(s);for(const[l,u]of a){const c=o[l];c!=null&&(o[l]=c+e*u)}return o},{...t})}}const ju=l$(1),by=l$(-1);function SSe(e){return"clientX"in e&&"clientY"in e}function S3(e){if(!e)return!1;const{KeyboardEvent:t}=ir(e.target);return t&&e instanceof t}function wSe(e){if(!e)return!1;const{TouchEvent:t}=ir(e.target);return t&&e instanceof t}function Qf(e){if(wSe(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return SSe(e)?{x:e.clientX,y:e.clientY}:null}const Zf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Zf.Translate.toString(e),Zf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),bP="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function xSe(e){return e.matches(bP)?e:e.querySelector(bP)}const CSe={display:"none"};function TSe(e){let{id:t,value:n}=e;return We.createElement("div",{id:t,style:CSe},n)}const ESe={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};function PSe(e){let{id:t,announcement:n}=e;return We.createElement("div",{id:t,style:ESe,role:"status","aria-live":"assertive","aria-atomic":!0},n)}function ASe(){const[e,t]=k.useState("");return{announce:k.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const u$=k.createContext(null);function kSe(e){const t=k.useContext(u$);k.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function OSe(){const[e]=k.useState(()=>new Set),t=k.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[k.useCallback(r=>{let{type:i,event:o}=r;e.forEach(s=>{var a;return(a=s[i])==null?void 0:a.call(s,o)})},[e]),t]}const RSe={draggable:` + To pick up a draggable item, press the space bar. + While dragging, use the arrow keys to move the item. + Press space again to drop the item in its new position, or press escape to cancel. + `},MSe={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function ISe(e){let{announcements:t=MSe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=RSe}=e;const{announce:o,announcement:s}=ASe(),a=f1("DndLiveRegion"),[l,u]=k.useState(!1);if(k.useEffect(()=>{u(!0)},[]),kSe(k.useMemo(()=>({onDragStart(d){let{active:f}=d;o(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:h}=d;t.onDragMove&&o(t.onDragMove({active:f,over:h}))},onDragOver(d){let{active:f,over:h}=d;o(t.onDragOver({active:f,over:h}))},onDragEnd(d){let{active:f,over:h}=d;o(t.onDragEnd({active:f,over:h}))},onDragCancel(d){let{active:f,over:h}=d;o(t.onDragCancel({active:f,over:h}))}}),[o,t])),!l)return null;const c=We.createElement(We.Fragment,null,We.createElement(TSe,{id:r,value:i.draggable}),We.createElement(PSe,{id:a,announcement:s}));return n?Vi.createPortal(c,n):c}var tn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(tn||(tn={}));function _y(){}function _P(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function NSe(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const Ti=Object.freeze({x:0,y:0});function DSe(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function LSe(e,t){const n=Qf(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function $Se(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function FSe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function BSe(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function jSe(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function VSe(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=VSe(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(FSe)};function USe(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const GSe=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:s}=o,a=n.get(s);if(a&&USe(r,a)){const u=BSe(a).reduce((d,f)=>d+DSe(r,f),0),c=Number((u/4).toFixed(4));i.push({id:s,data:{droppableContainer:o,value:c}})}}return i.sort($Se)};function HSe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function c$(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ti}function qSe(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const WSe=qSe(1);function d$(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function KSe(e,t,n){const r=d$(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),u=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l}}const XSe={ignoreTransform:!1};function Gh(e,t){t===void 0&&(t=XSe);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=ir(e).getComputedStyle(e);u&&(n=KSe(n,u,c))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function SP(e){return Gh(e,{ignoreTransform:!0})}function YSe(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function QSe(e,t){return t===void 0&&(t=ir(e).getComputedStyle(e)),t.position==="fixed"}function ZSe(e,t){t===void 0&&(t=ir(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function w3(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(_3(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!zh(i)||bSe(i)||n.includes(i))return n;const o=ir(e).getComputedStyle(i);return i!==e&&ZSe(i,o)&&n.push(i),QSe(i,o)?n:r(i.parentNode)}return e?r(e):n}function f$(e){const[t]=w3(e,1);return t??null}function S_(e){return!c1||!e?null:Ac(e)?e:b3(e)?_3(e)||e===kc(e).scrollingElement?window:zh(e)?e:null:null}function h$(e){return Ac(e)?e.scrollX:e.scrollLeft}function p$(e){return Ac(e)?e.scrollY:e.scrollTop}function sw(e){return{x:h$(e),y:p$(e)}}var fn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(fn||(fn={}));function g$(e){return!c1||!e?!1:e===document.scrollingElement}function m$(e){const t={x:0,y:0},n=g$(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const JSe={x:.2,y:.2};function e2e(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=JSe);const{isTop:u,isBottom:c,isLeft:d,isRight:f}=m$(e),h={x:0,y:0},p={x:0,y:0},m={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+m.height?(h.y=fn.Backward,p.y=r*Math.abs((t.top+m.height-o)/m.height)):!c&&l>=t.bottom-m.height&&(h.y=fn.Forward,p.y=r*Math.abs((t.bottom-m.height-l)/m.height)),!f&&a>=t.right-m.width?(h.x=fn.Forward,p.x=r*Math.abs((t.right-m.width-a)/m.width)):!d&&s<=t.left+m.width&&(h.x=fn.Backward,p.x=r*Math.abs((t.left+m.width-s)/m.width)),{direction:h,speed:p}}function t2e(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function y$(e){return e.reduce((t,n)=>ju(t,sw(n)),Ti)}function n2e(e){return e.reduce((t,n)=>t+h$(n),0)}function r2e(e){return e.reduce((t,n)=>t+p$(n),0)}function v$(e,t){if(t===void 0&&(t=Gh),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);f$(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const i2e=[["x",["left","right"],n2e],["y",["top","bottom"],r2e]];class x3{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=w3(n),i=y$(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of i2e)for(const l of s)Object.defineProperty(this,l,{get:()=>{const u=a(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ld{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function o2e(e){const{EventTarget:t}=ir(e);return e instanceof t?e:kc(e)}function w_(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var zr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(zr||(zr={}));function wP(e){e.preventDefault()}function s2e(e){e.stopPropagation()}var st;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(st||(st={}));const b$={start:[st.Space,st.Enter],cancel:[st.Esc],end:[st.Space,st.Enter]},a2e=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case st.Right:return{...n,x:n.x+25};case st.Left:return{...n,x:n.x-25};case st.Down:return{...n,y:n.y+25};case st.Up:return{...n,y:n.y-25}}};class _${constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ld(kc(n)),this.windowListeners=new Ld(ir(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(zr.Resize,this.handleCancel),this.windowListeners.add(zr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(zr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&v$(r),n(Ti)}handleKeyDown(t){if(S3(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=b$,coordinateGetter:s=a2e,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,c=u?{x:u.left,y:u.top}:Ti;this.referenceCoordinates||(this.referenceCoordinates=c);const d=s(t,{active:n,context:r.current,currentCoordinates:c});if(d){const f=by(d,c),h={x:0,y:0},{scrollableAncestors:p}=r.current;for(const m of p){const _=t.code,{isTop:y,isRight:v,isLeft:g,isBottom:b,maxScroll:S,minScroll:w}=m$(m),x=t2e(m),T={x:Math.min(_===st.Right?x.right-x.width/2:x.right,Math.max(_===st.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(_===st.Down?x.bottom-x.height/2:x.bottom,Math.max(_===st.Down?x.top:x.top+x.height/2,d.y))},P=_===st.Right&&!v||_===st.Left&&!g,E=_===st.Down&&!b||_===st.Up&&!y;if(P&&T.x!==d.x){const A=m.scrollLeft+f.x,$=_===st.Right&&A<=S.x||_===st.Left&&A>=w.x;if($&&!f.y){m.scrollTo({left:A,behavior:a});return}$?h.x=m.scrollLeft-A:h.x=_===st.Right?m.scrollLeft-S.x:m.scrollLeft-w.x,h.x&&m.scrollBy({left:-h.x,behavior:a});break}else if(E&&T.y!==d.y){const A=m.scrollTop+f.y,$=_===st.Down&&A<=S.y||_===st.Up&&A>=w.y;if($&&!f.x){m.scrollTo({top:A,behavior:a});return}$?h.y=m.scrollTop-A:h.y=_===st.Down?m.scrollTop-S.y:m.scrollTop-w.y,h.y&&m.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,ju(by(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}_$.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=b$,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function xP(e){return!!(e&&"distance"in e)}function CP(e){return!!(e&&"delay"in e)}class C3{constructor(t,n,r){var i;r===void 0&&(r=o2e(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=kc(s),this.documentListeners=new Ld(this.document),this.listeners=new Ld(r),this.windowListeners=new Ld(ir(s)),this.initialCoordinates=(i=Qf(o))!=null?i:Ti,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(zr.Resize,this.handleCancel),this.windowListeners.add(zr.DragStart,wP),this.windowListeners.add(zr.VisibilityChange,this.handleCancel),this.windowListeners.add(zr.ContextMenu,wP),this.documentListeners.add(zr.Keydown,this.handleKeydown),n){if(xP(n))return;if(CP(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(zr.Click,s2e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(zr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=Qf(t))!=null?n:Ti,u=by(i,l);if(!r&&a){if(CP(a))return w_(u,a.tolerance)?this.handleCancel():void 0;if(xP(a))return a.tolerance!=null&&w_(u,a.tolerance)?this.handleCancel():w_(u,a.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===st.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const l2e={move:{name:"pointermove"},end:{name:"pointerup"}};class S$ extends C3{constructor(t){const{event:n}=t,r=kc(n.target);super(t,l2e,r)}}S$.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const u2e={move:{name:"mousemove"},end:{name:"mouseup"}};var aw;(function(e){e[e.RightClick=2]="RightClick"})(aw||(aw={}));class w$ extends C3{constructor(t){super(t,u2e,kc(t.event.target))}}w$.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===aw.RightClick?!1:(r==null||r({event:n}),!0)}}];const x_={move:{name:"touchmove"},end:{name:"touchend"}};class x$ extends C3{constructor(t){super(t,x_)}static setup(){return window.addEventListener(x_.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(x_.move.name,t)};function t(){}}}x$.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var $d;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})($d||($d={}));var Sy;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Sy||(Sy={}));function c2e(e){let{acceleration:t,activator:n=$d.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=Sy.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:f}=e;const h=f2e({delta:d,disabled:!o}),[p,m]=_Se(),_=k.useRef({x:0,y:0}),y=k.useRef({x:0,y:0}),v=k.useMemo(()=>{switch(n){case $d.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case $d.DraggableRect:return i}},[n,i,l]),g=k.useRef(null),b=k.useCallback(()=>{const w=g.current;if(!w)return;const x=_.current.x*y.current.x,T=_.current.y*y.current.y;w.scrollBy(x,T)},[]),S=k.useMemo(()=>a===Sy.TreeOrder?[...u].reverse():u,[a,u]);k.useEffect(()=>{if(!o||!u.length||!v){m();return}for(const w of S){if((r==null?void 0:r(w))===!1)continue;const x=u.indexOf(w),T=c[x];if(!T)continue;const{direction:P,speed:E}=e2e(w,T,v,t,f);for(const A of["x","y"])h[A][P[A]]||(E[A]=0,P[A]=0);if(E.x>0||E.y>0){m(),g.current=w,p(b,s),_.current=E,y.current=P;return}}_.current={x:0,y:0},y.current={x:0,y:0},m()},[t,b,r,m,o,s,JSON.stringify(v),JSON.stringify(h),p,u,S,c,JSON.stringify(f)])}const d2e={x:{[fn.Backward]:!1,[fn.Forward]:!1},y:{[fn.Backward]:!1,[fn.Forward]:!1}};function f2e(e){let{delta:t,disabled:n}=e;const r=vy(t);return Uh(i=>{if(n||!r||!i)return d2e;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[fn.Backward]:i.x[fn.Backward]||o.x===-1,[fn.Forward]:i.x[fn.Forward]||o.x===1},y:{[fn.Backward]:i.y[fn.Backward]||o.y===-1,[fn.Forward]:i.y[fn.Forward]||o.y===1}}},[n,t,r])}function h2e(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return Uh(i=>{var o;return t===null?null:(o=r??i)!=null?o:null},[r,t])}function p2e(e,t){return k.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var Jf;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Jf||(Jf={}));var lw;(function(e){e.Optimized="optimized"})(lw||(lw={}));const TP=new Map;function g2e(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=k.useState(null),{frequency:a,measure:l,strategy:u}=i,c=k.useRef(e),d=_(),f=Yf(d),h=k.useCallback(function(y){y===void 0&&(y=[]),!f.current&&s(v=>v===null?y:v.concat(y.filter(g=>!v.includes(g))))},[f]),p=k.useRef(null),m=Uh(y=>{if(d&&!n)return TP;if(!y||y===TP||c.current!==e||o!=null){const v=new Map;for(let g of e){if(!g)continue;if(o&&o.length>0&&!o.includes(g.id)&&g.rect.current){v.set(g.id,g.rect.current);continue}const b=g.node.current,S=b?new x3(l(b),b):null;g.rect.current=S,S&&v.set(g.id,S)}return v}return y},[e,o,n,d,l]);return k.useEffect(()=>{c.current=e},[e]),k.useEffect(()=>{d||h()},[n,d]),k.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),k.useEffect(()=>{d||typeof a!="number"||p.current!==null||(p.current=setTimeout(()=>{h(),p.current=null},a))},[a,d,h,...r]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:o!=null};function _(){switch(u){case Jf.Always:return!1;case Jf.BeforeDragging:return n;default:return!n}}}function T3(e,t){return Uh(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function m2e(e,t){return T3(e,t)}function y2e(e){let{callback:t,disabled:n}=e;const r=d1(t),i=k.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return k.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function h1(e){let{callback:t,disabled:n}=e;const r=d1(t),i=k.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return k.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function v2e(e){return new x3(Gh(e),e)}function EP(e,t,n){t===void 0&&(t=v2e);const[r,i]=k.useReducer(a,null),o=y2e({callback(l){if(e)for(const u of l){const{type:c,target:d}=u;if(c==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),s=h1({callback:i});return ro(()=>{i(),e?(s==null||s.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(s==null||s.disconnect(),o==null||o.disconnect())},[e]),r;function a(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function b2e(e){const t=T3(e);return c$(e,t)}const PP=[];function _2e(e){const t=k.useRef(e),n=Uh(r=>e?r&&r!==PP&&e&&t.current&&e.parentNode===t.current.parentNode?r:w3(e):PP,[e]);return k.useEffect(()=>{t.current=e},[e]),n}function S2e(e){const[t,n]=k.useState(null),r=k.useRef(e),i=k.useCallback(o=>{const s=S_(o.target);s&&n(a=>a?(a.set(s,sw(s)),new Map(a)):null)},[]);return k.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const u=S_(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,sw(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const u=S_(l);u==null||u.removeEventListener("scroll",i)})}},[i,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>ju(o,s),Ti):y$(e):Ti,[e,t])}function AP(e,t){t===void 0&&(t=[]);const n=k.useRef(null);return k.useEffect(()=>{n.current=null},t),k.useEffect(()=>{const r=e!==Ti;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?by(e,n.current):Ti}function w2e(e){k.useEffect(()=>{if(!c1)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function x2e(e,t){return k.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function C$(e){return k.useMemo(()=>e?YSe(e):null,[e])}const C_=[];function C2e(e,t){t===void 0&&(t=Gh);const[n]=e,r=C$(n?ir(n):null),[i,o]=k.useReducer(a,C_),s=h1({callback:o});return e.length>0&&i===C_&&o(),ro(()=>{e.length?e.forEach(l=>s==null?void 0:s.observe(l)):(s==null||s.disconnect(),o())},[e]),i;function a(){return e.length?e.map(l=>g$(l)?r:new x3(t(l),l)):C_}}function T$(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return zh(t)?t:e}function T2e(e){let{measure:t}=e;const[n,r]=k.useState(null),i=k.useCallback(u=>{for(const{target:c}of u)if(zh(c)){r(d=>{const f=t(c);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),o=h1({callback:i}),s=k.useCallback(u=>{const c=T$(u);o==null||o.disconnect(),c&&(o==null||o.observe(c)),r(c?t(c):null)},[t,o]),[a,l]=yy(s);return k.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const E2e=[{sensor:S$,options:{}},{sensor:_$,options:{}}],P2e={current:{}},Ng={draggable:{measure:SP},droppable:{measure:SP,strategy:Jf.WhileDragging,frequency:lw.Optimized},dragOverlay:{measure:Gh}};class Fd extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const A2e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Fd,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:_y},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ng,measureDroppableContainers:_y,windowRect:null,measuringScheduled:!1},E$={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:_y,draggableNodes:new Map,over:null,measureDroppableContainers:_y},Hh=k.createContext(E$),P$=k.createContext(A2e);function k2e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Fd}}}function O2e(e,t){switch(t.type){case tn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case tn.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case tn.DragEnd:case tn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case tn.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Fd(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case tn.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Fd(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case tn.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Fd(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function R2e(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=k.useContext(Hh),o=vy(r),s=vy(n==null?void 0:n.id);return k.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!S3(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:u}=a;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const d=xSe(c);if(d){d.focus();break}}})}},[r,t,i,s,o]),null}function A$(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function M2e(e){return k.useMemo(()=>({draggable:{...Ng.draggable,...e==null?void 0:e.draggable},droppable:{...Ng.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Ng.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function I2e(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=k.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;ro(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const c=n(u),d=c$(c,r);if(s||(d.x=0),a||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=f$(u);f&&f.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const p1=k.createContext({...Ti,scaleX:1,scaleY:1});var fs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(fs||(fs={}));const N2e=k.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:u,sensors:c=E2e,collisionDetection:d=zSe,measuring:f,modifiers:h,...p}=t;const m=k.useReducer(O2e,void 0,k2e),[_,y]=m,[v,g]=OSe(),[b,S]=k.useState(fs.Uninitialized),w=b===fs.Initialized,{draggable:{active:x,nodes:T,translate:P},droppable:{containers:E}}=_,A=x?T.get(x):null,$=k.useRef({initial:null,translated:null}),M=k.useMemo(()=>{var xt;return x!=null?{id:x,data:(xt=A==null?void 0:A.data)!=null?xt:P2e,rect:$}:null},[x,A]),C=k.useRef(null),[O,I]=k.useState(null),[N,R]=k.useState(null),D=Yf(p,Object.values(p)),L=f1("DndDescribedBy",s),j=k.useMemo(()=>E.getEnabled(),[E]),U=M2e(f),{droppableRects:G,measureDroppableContainers:W,measuringScheduled:X}=g2e(j,{dragging:w,dependencies:[P.x,P.y],config:U.droppable}),Y=h2e(T,x),B=k.useMemo(()=>N?Qf(N):null,[N]),H=fa(),Q=m2e(Y,U.draggable.measure);I2e({activeNode:x?T.get(x):null,config:H.layoutShiftCompensation,initialRect:Q,measure:U.draggable.measure});const J=EP(Y,U.draggable.measure,Q),ne=EP(Y?Y.parentElement:null),te=k.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),xe=E.getNodeFor((n=te.current.over)==null?void 0:n.id),ve=T2e({measure:U.dragOverlay.measure}),ce=(r=ve.nodeRef.current)!=null?r:Y,Ne=w?(i=ve.rect)!=null?i:J:null,se=!!(ve.nodeRef.current&&ve.rect),pt=b2e(se?null:J),yn=C$(ce?ir(ce):null),Rt=_2e(w?xe??Y:null),ut=C2e(Rt),Je=A$(h,{transform:{x:P.x-pt.x,y:P.y-pt.y,scaleX:1,scaleY:1},activatorEvent:N,active:M,activeNodeRect:J,containerNodeRect:ne,draggingNodeRect:Ne,over:te.current.over,overlayNodeRect:ve.rect,scrollableAncestors:Rt,scrollableAncestorRects:ut,windowRect:yn}),Ut=B?ju(B,P):null,or=S2e(Rt),ti=AP(or),Dr=AP(or,[J]),On=ju(Je,ti),vn=Ne?WSe(Ne,Je):null,zn=M&&vn?d({active:M,collisionRect:vn,droppableRects:G,droppableContainers:j,pointerCoordinates:Ut}):null,Gt=jSe(zn,"id"),[wt,Sr]=k.useState(null),Lr=se?Je:ju(Je,Dr),ni=HSe(Lr,(o=wt==null?void 0:wt.rect)!=null?o:null,J),lo=k.useCallback((xt,et)=>{let{sensor:_n,options:an}=et;if(C.current==null)return;const Rn=T.get(C.current);if(!Rn)return;const Un=xt.nativeEvent,sr=new _n({active:C.current,activeNode:Rn,event:Un,options:an,context:te,onStart(Gn){const Sn=C.current;if(Sn==null)return;const uo=T.get(Sn);if(!uo)return;const{onDragStart:Qo}=D.current,Zo={active:{id:Sn,data:uo.data,rect:$}};Vi.unstable_batchedUpdates(()=>{Qo==null||Qo(Zo),S(fs.Initializing),y({type:tn.DragStart,initialCoordinates:Gn,active:Sn}),v({type:"onDragStart",event:Zo})})},onMove(Gn){y({type:tn.DragMove,coordinates:Gn})},onEnd:ki(tn.DragEnd),onCancel:ki(tn.DragCancel)});Vi.unstable_batchedUpdates(()=>{I(sr),R(xt.nativeEvent)});function ki(Gn){return async function(){const{active:uo,collisions:Qo,over:Zo,scrollAdjustedTranslate:kl}=te.current;let co=null;if(uo&&kl){const{cancelDrop:Hn}=D.current;co={activatorEvent:Un,active:uo,collisions:Qo,delta:kl,over:Zo},Gn===tn.DragEnd&&typeof Hn=="function"&&await Promise.resolve(Hn(co))&&(Gn=tn.DragCancel)}C.current=null,Vi.unstable_batchedUpdates(()=>{y({type:Gn}),S(fs.Uninitialized),Sr(null),I(null),R(null);const Hn=Gn===tn.DragEnd?"onDragEnd":"onDragCancel";if(co){const ha=D.current[Hn];ha==null||ha(co),v({type:Hn,event:co})}})}}},[T]),bn=k.useCallback((xt,et)=>(_n,an)=>{const Rn=_n.nativeEvent,Un=T.get(an);if(C.current!==null||!Un||Rn.dndKit||Rn.defaultPrevented)return;const sr={active:Un};xt(_n,et.options,sr)===!0&&(Rn.dndKit={capturedBy:et.sensor},C.current=an,lo(_n,et))},[T,lo]),ri=p2e(c,bn);w2e(c),ro(()=>{J&&b===fs.Initializing&&S(fs.Initialized)},[J,b]),k.useEffect(()=>{const{onDragMove:xt}=D.current,{active:et,activatorEvent:_n,collisions:an,over:Rn}=te.current;if(!et||!_n)return;const Un={active:et,activatorEvent:_n,collisions:an,delta:{x:On.x,y:On.y},over:Rn};Vi.unstable_batchedUpdates(()=>{xt==null||xt(Un),v({type:"onDragMove",event:Un})})},[On.x,On.y]),k.useEffect(()=>{const{active:xt,activatorEvent:et,collisions:_n,droppableContainers:an,scrollAdjustedTranslate:Rn}=te.current;if(!xt||C.current==null||!et||!Rn)return;const{onDragOver:Un}=D.current,sr=an.get(Gt),ki=sr&&sr.rect.current?{id:sr.id,rect:sr.rect.current,data:sr.data,disabled:sr.disabled}:null,Gn={active:xt,activatorEvent:et,collisions:_n,delta:{x:Rn.x,y:Rn.y},over:ki};Vi.unstable_batchedUpdates(()=>{Sr(ki),Un==null||Un(Gn),v({type:"onDragOver",event:Gn})})},[Gt]),ro(()=>{te.current={activatorEvent:N,active:M,activeNode:Y,collisionRect:vn,collisions:zn,droppableRects:G,draggableNodes:T,draggingNode:ce,draggingNodeRect:Ne,droppableContainers:E,over:wt,scrollableAncestors:Rt,scrollAdjustedTranslate:On},$.current={initial:Ne,translated:vn}},[M,Y,zn,vn,T,ce,Ne,G,E,wt,Rt,On]),c2e({...H,delta:P,draggingRect:vn,pointerCoordinates:Ut,scrollableAncestors:Rt,scrollableAncestorRects:ut});const da=k.useMemo(()=>({active:M,activeNode:Y,activeNodeRect:J,activatorEvent:N,collisions:zn,containerNodeRect:ne,dragOverlay:ve,draggableNodes:T,droppableContainers:E,droppableRects:G,over:wt,measureDroppableContainers:W,scrollableAncestors:Rt,scrollableAncestorRects:ut,measuringConfiguration:U,measuringScheduled:X,windowRect:yn}),[M,Y,J,N,zn,ne,ve,T,E,G,wt,W,Rt,ut,U,X,yn]),Ai=k.useMemo(()=>({activatorEvent:N,activators:ri,active:M,activeNodeRect:J,ariaDescribedById:{draggable:L},dispatch:y,draggableNodes:T,over:wt,measureDroppableContainers:W}),[N,ri,M,J,y,L,T,wt,W]);return We.createElement(u$.Provider,{value:g},We.createElement(Hh.Provider,{value:Ai},We.createElement(P$.Provider,{value:da},We.createElement(p1.Provider,{value:ni},u)),We.createElement(R2e,{disabled:(a==null?void 0:a.restoreFocus)===!1})),We.createElement(ISe,{...a,hiddenTextDescribedById:L}));function fa(){const xt=(O==null?void 0:O.autoScrollEnabled)===!1,et=typeof l=="object"?l.enabled===!1:l===!1,_n=w&&!xt&&!et;return typeof l=="object"?{...l,enabled:_n}:{enabled:_n}}}),D2e=k.createContext(null),kP="button",L2e="Droppable";function $2e(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=f1(L2e),{activators:s,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=k.useContext(Hh),{role:h=kP,roleDescription:p="draggable",tabIndex:m=0}=i??{},_=(l==null?void 0:l.id)===t,y=k.useContext(_?p1:D2e),[v,g]=yy(),[b,S]=yy(),w=x2e(s,t),x=Yf(n);ro(()=>(d.set(t,{id:t,key:o,node:v,activatorNode:b,data:x}),()=>{const P=d.get(t);P&&P.key===o&&d.delete(t)}),[d,t]);const T=k.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":r,"aria-pressed":_&&h===kP?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,m,_,p,c.draggable]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:T,isDragging:_,listeners:r?void 0:w,node:v,over:f,setNodeRef:g,setActivatorNodeRef:S,transform:y}}function F2e(){return k.useContext(P$)}const B2e="Droppable",j2e={timeout:25};function V2e(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=f1(B2e),{active:s,dispatch:a,over:l,measureDroppableContainers:u}=k.useContext(Hh),c=k.useRef({disabled:n}),d=k.useRef(!1),f=k.useRef(null),h=k.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:_}={...j2e,...i},y=Yf(m??r),v=k.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(y.current)?y.current:[y.current]),h.current=null},_)},[_]),g=h1({callback:v,disabled:p||!s}),b=k.useCallback((T,P)=>{g&&(P&&(g.unobserve(P),d.current=!1),T&&g.observe(T))},[g]),[S,w]=yy(b),x=Yf(t);return k.useEffect(()=>{!g||!S.current||(g.disconnect(),d.current=!1,g.observe(S.current))},[S,g]),ro(()=>(a({type:tn.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:x}}),()=>a({type:tn.UnregisterDroppable,key:o,id:r})),[r]),k.useEffect(()=>{n!==c.current.disabled&&(a({type:tn.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,a]),{active:s,rect:f,isOver:(l==null?void 0:l.id)===r,node:S,over:l,setNodeRef:w}}function z2e(e){let{animation:t,children:n}=e;const[r,i]=k.useState(null),[o,s]=k.useState(null),a=vy(n);return!n&&!r&&a&&i(a),ro(()=>{if(!o)return;const l=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(l==null||u==null){i(null);return}Promise.resolve(t(u,o)).then(()=>{i(null)})},[t,r,o]),We.createElement(We.Fragment,null,n,r?k.cloneElement(r,{ref:s}):null)}const U2e={x:0,y:0,scaleX:1,scaleY:1};function G2e(e){let{children:t}=e;return We.createElement(Hh.Provider,{value:E$},We.createElement(p1.Provider,{value:U2e},t))}const H2e={position:"fixed",touchAction:"none"},q2e=e=>S3(e)?"transform 250ms ease":void 0,W2e=k.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:s,rect:a,style:l,transform:u,transition:c=q2e}=e;if(!a)return null;const d=i?u:{...u,scaleX:1,scaleY:1},f={...H2e,width:a.width,height:a.height,top:a.top,left:a.left,transform:Zf.Transform.toString(d),transformOrigin:i&&r?LSe(r,a):void 0,transition:typeof c=="function"?c(r):c,...l};return We.createElement(n,{className:s,style:f,ref:t},o)}),K2e=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:s}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(i[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[l,u]of Object.entries(i))n.node.style.setProperty(l,u);s!=null&&s.active&&n.node.classList.remove(s.active)}},X2e=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Zf.Transform.toString(t)},{transform:Zf.Transform.toString(n)}]},Y2e={duration:250,easing:"ease",keyframes:X2e,sideEffects:K2e({styles:{active:{opacity:"0"}}})};function Q2e(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return d1((o,s)=>{if(t===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const u=T$(s);if(!u)return;const{transform:c}=ir(s).getComputedStyle(s),d=d$(c);if(!d)return;const f=typeof t=="function"?t:Z2e(t);return v$(l,i.draggable.measure),f({active:{id:o,data:a.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:s,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:d})})}function Z2e(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...Y2e,...e};return o=>{let{active:s,dragOverlay:a,transform:l,...u}=o;if(!t)return;const c={x:a.rect.left-s.rect.left,y:a.rect.top-s.rect.top},d={scaleX:l.scaleX!==1?s.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?s.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-c.x,y:l.y-c.y,...d},h=i({...u,active:s,dragOverlay:a,transform:{initial:l,final:f}}),[p]=h,m=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;const _=r==null?void 0:r({active:s,dragOverlay:a,...u}),y=a.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(v=>{y.onfinish=()=>{_==null||_(),v()}})}}let OP=0;function J2e(e){return k.useMemo(()=>{if(e!=null)return OP++,OP},[e])}const ewe=We.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:s,wrapperElement:a="div",className:l,zIndex:u=999}=e;const{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggableNodes:p,droppableContainers:m,dragOverlay:_,over:y,measuringConfiguration:v,scrollableAncestors:g,scrollableAncestorRects:b,windowRect:S}=F2e(),w=k.useContext(p1),x=J2e(d==null?void 0:d.id),T=A$(s,{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:_.rect,over:y,overlayNodeRect:_.rect,scrollableAncestors:g,scrollableAncestorRects:b,transform:w,windowRect:S}),P=T3(f),E=Q2e({config:r,draggableNodes:p,droppableContainers:m,measuringConfiguration:v}),A=P?_.setRef:void 0;return We.createElement(G2e,null,We.createElement(z2e,{animation:E},d&&x?We.createElement(W2e,{key:x,id:d.id,ref:A,as:a,activatorEvent:c,adjustScale:t,className:l,transition:o,rect:P,style:{zIndex:u,...i},transform:T},n):null))}),twe=e=>{let{activatorEvent:t,draggingNodeRect:n,transform:r}=e;if(n&&t){const i=Qf(t);if(!i)return r;const o=i.x-n.left,s=i.y-n.top;return{...r,x:r.x+o-n.width/2,y:r.y+s-n.height/2}}return r},k$=()=>uk(),R4e=tk,Qp=28,RP={w:Qp,h:Qp,maxW:Qp,maxH:Qp,shadow:"dark-lg",borderRadius:"lg",opacity:.3,bg:"base.800",color:"base.50",_dark:{borderColor:"base.200",bg:"base.900",color:"base.100"}},nwe=e=>{if(!e.dragData)return null;if(e.dragData.payloadType==="IMAGE_DTO"){const{thumbnail_url:t,width:n,height:r}=e.dragData.payload.imageDTO;return K.jsx(d3,{sx:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none",cursor:"none"},children:K.jsx(c3,{sx:{...RP},objectFit:"contain",src:t,width:n,height:r})})}return e.dragData.payloadType==="IMAGE_NAMES"?K.jsxs(f3,{sx:{cursor:"none",userSelect:"none",position:"relative",alignItems:"center",justifyContent:"center",flexDir:"column",...RP},children:[K.jsx(X2,{children:e.dragData.payload.image_names.length}),K.jsx(X2,{size:"sm",children:"Images"})]}):null},rwe=k.memo(nwe);function M4e(e){return V2e(e)}function I4e(e){return $2e(e)}const N4e=(e,t)=>{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"SET_CURRENT_IMAGE":return r==="IMAGE_DTO";case"SET_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_CONTROLNET_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_NAMES";case"ADD_TO_BATCH":return r==="IMAGE_DTO"||"IMAGE_NAMES";case"MOVE_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_NAMES"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:o}=t.data.current.payload,s=o.board_id,a=e.context.boardId;return!(s===a)&&(s?!0:a)}return r!=="IMAGE_NAMES"}default:return!1}};function iwe(e){return K.jsx(N2e,{...e})}const owe=e=>{const[t,n]=k.useState(null),r=k$(),i=k.useCallback(u=>{console.log("dragStart",u.active.data.current);const c=u.active.data.current;c&&n(c)},[]),o=k.useCallback(u=>{var d;console.log("dragEnd",u.active.data.current);const c=(d=u.over)==null?void 0:d.data.current;!t||!c||(r(rN({overData:c,activeData:t})),n(null))},[t,r]),s=_P(w$,{activationConstraint:{distance:10}}),a=_P(x$,{activationConstraint:{distance:10}}),l=NSe(s,a);return K.jsxs(iwe,{onDragStart:i,onDragEnd:o,sensors:l,collisionDetection:GSe,children:[e.children,K.jsx(ewe,{dropAnimation:null,modifiers:[twe],children:K.jsx(Kbe,{children:t&&K.jsx(jbe.div,{layout:!0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1,transition:{duration:.1}},children:K.jsx(rwe,{dragData:t})},"overlay-drag-image")})})]})},swe=k.memo(owe),awe=k.createContext({isOpen:!1,onClose:()=>{},onClickAddToBoard:()=>{},handleAddToBoard:()=>{}}),lwe=e=>{const[t,n]=k.useState(),{isOpen:r,onOpen:i,onClose:o}=n_e(),s=k$(),a=k.useCallback(()=>{n(void 0),o()},[o]),l=k.useCallback(c=>{c&&(n(c),i())},[n,i]),u=k.useCallback(c=>{t&&(s(he.endpoints.addImageToBoard.initiate({imageDTO:t,board_id:c})),a())},[s,a,t]);return K.jsx(awe.Provider,{value:{isOpen:r,image:t,onClose:a,onClickAddToBoard:l,handleAddToBoard:u},children:e.children})},uwe=k.lazy(()=>q9(()=>import("./App-10c521da.js"),["./App-10c521da.js","./MantineProvider-97b2a7de.js","./App-6125620a.css"],import.meta.url)),cwe=k.lazy(()=>q9(()=>import("./ThemeLocaleProvider-e6f4b86d.js"),["./ThemeLocaleProvider-e6f4b86d.js","./MantineProvider-97b2a7de.js","./ThemeLocaleProvider-5b992bc7.css"],import.meta.url)),dwe=({apiUrl:e,token:t,config:n,headerComponent:r,middleware:i})=>(k.useEffect(()=>(t&&Tf.set(t),e&&Ef.set(e),GI(),i&&i.length>0?d2(vP(),...i):d2(vP()),()=>{Ef.set(void 0),Tf.set(void 0)}),[e,t,i]),K.jsx(We.StrictMode,{children:K.jsx(vV,{store:Wpe,children:K.jsx(We.Suspense,{fallback:K.jsx(s_e,{}),children:K.jsx(cwe,{children:K.jsx(swe,{children:K.jsx(lwe,{children:K.jsx(uwe,{config:n,headerComponent:r})})})})})})})),fwe=k.memo(dwe);T_.createRoot(document.getElementById("root")).render(K.jsx(fwe,{}));export{pD as $,K as A,ei as B,jt as C,Du as D,jn as E,di as F,Zne as G,vr as H,Rs as I,Li as J,j3e as K,xM as L,hre as M,Ure as N,lte as O,tre as P,oc as Q,$ge as R,ff as S,El as T,al as U,aD as V,m4e as W,h4e as X,Kbe as Y,jbe as Z,E4e as _,eO as a,GS as a$,BL as a0,vD as a1,p4e as a2,g4e as a3,Lge as a4,Dge as a5,y4e as a6,Da as a7,ll as a8,om as a9,f3 as aA,X2 as aB,l4e as aC,zN as aD,t3e as aE,Q4 as aF,dCe as aG,Vi as aH,jC as aI,iF as aJ,mwe as aK,pwe as aL,gwe as aM,Ee as aN,Pa as aO,P3e as aP,ZI as aQ,T3e as aR,E3e as aS,x3e as aT,b3e as aU,Lpe as aV,M4e as aW,N4e as aX,w3e as aY,N3e as aZ,YCe as a_,NV as aa,We as ab,nP as ac,fye as ad,T4e as ae,Ro as af,oD as ag,N1e as ah,_4e as ai,M2 as aj,f4e as ak,C4e as al,Zn as am,yC as an,w0 as ao,R4e as ap,z3e as aq,Eh as ar,iI as as,OI as at,ev as au,k$ as av,y5e as aw,Ft as ax,Ha as ay,d3 as az,Ex as b,N7 as b$,C3e as b0,c3 as b1,i_e as b2,Sxe as b3,bs as b4,O5e as b5,pp as b6,wge as b7,BC as b8,eD as b9,ue as bA,awe as bB,QCe as bC,pJ as bD,r3e as bE,BR as bF,Jxe as bG,IR as bH,HS as bI,I4e as bJ,d4e as bK,I3e as bL,JCe as bM,e3e as bN,Os as bO,Gle as bP,KCe as bQ,XCe as bR,qCe as bS,n_e as bT,Om as bU,a4e as bV,L5e as bW,bxe as bX,wle as bY,h5e as bZ,D3e as b_,Cge as ba,F3 as bb,R3e as bc,O3e as bd,hwe as be,bwe as bf,_we as bg,zwe as bh,Uwe as bi,Twe as bj,Xwe as bk,wwe as bl,Dwe as bm,Awe as bn,nue as bo,xwe as bp,Gwe as bq,Swe as br,exe as bs,Ewe as bt,Lwe as bu,Pwe as bv,$we as bw,Rwe as bx,Bwe as by,tue as bz,OU as c,fxe as c$,nN as c0,M5e as c1,WCe as c2,i3e as c3,P7 as c4,FR as c5,Cwe as c6,Exe as c7,Vn as c8,x5e as c9,Ah as cA,dxe as cB,txe as cC,axe as cD,Vwe as cE,v5e as cF,hl as cG,_5e as cH,o5e as cI,i5e as cJ,F5e as cK,r4e as cL,c5e as cM,l5e as cN,fe as cO,Cf as cP,Y5e as cQ,xE as cR,u5e as cS,d5e as cT,a5e as cU,Zse as cV,jwe as cW,B5e as cX,yQ as cY,U5e as cZ,kR as c_,I5e as ca,R5e as cb,ele as cc,w5e as cd,E5e as ce,P5e as cf,SQ as cg,Sae as ch,wae as ci,yxe as cj,Txe as ck,T5e as cl,CQ as cm,V3e as cn,m5e as co,AR as cp,v3e as cq,g3e as cr,m3e as cs,y3e as ct,z5e as cu,Za as cv,ywe as cw,wo as cx,cce as cy,Mwe as cz,vX as d,pe as d$,wQ as d0,zi as d1,Fwe as d2,Qwe as d3,vwe as d4,uY as d5,Jwe as d6,s5e as d7,hxe as d8,r5e as d9,p3e as dA,E7 as dB,a3e as dC,u3e as dD,o3e as dE,xpe as dF,s3e as dG,lxe as dH,uxe as dI,oxe as dJ,sxe as dK,ixe as dL,Z5e as dM,W5e as dN,k5e as dO,q5e as dP,n4e as dQ,Q5e as dR,A5e as dS,X5e as dT,K5e as dU,G5e as dV,H5e as dW,qM as dX,$x as dY,J5e as dZ,jm as d_,mce as da,gxe as db,he as dc,Wn as dd,$5e as de,$3e as df,F3e as dg,L7 as dh,V5e as di,L3e as dj,gR as dk,cxe as dl,lY as dm,Owe as dn,j5e as dp,_T as dq,c3e as dr,qx as ds,iJ as dt,Ql as du,ST as dv,d3e as dw,f3e as dx,h3e as dy,oJ as dz,eR as e,wpe as e$,e4e as e0,c2 as e1,kwe as e2,t4e as e3,tk as e4,uk as e5,n5e as e6,X3e as e7,Y3e as e8,Q3e as e9,hCe as eA,rd as eB,uCe as eC,Gxe as eD,rv as eE,fCe as eF,jxe as eG,cCe as eH,Vxe as eI,Wxe as eJ,Oxe as eK,kxe as eL,Axe as eM,FCe as eN,DR as eO,Tf as eP,Dxe as eQ,Lxe as eR,$xe as eS,DCe as eT,Xxe as eU,Kxe as eV,VQ as eW,NCe as eX,kle as eY,Hxe as eZ,bpe as e_,II as ea,e5e as eb,t5e as ec,Lf as ed,x0 as ee,H3e as ef,Fpe as eg,U3e as eh,G3e as ei,W3e as ej,q3e as ek,K3e as el,J3e as em,jie as en,nI as eo,aN as ep,EF as eq,Pe as er,vCe as es,$Ce as et,LCe as eu,Qxe as ev,PCe as ew,BCe as ex,Ole as ey,Uxe as ez,lO as f,cye as f$,tCe as f0,nCe as f1,bCe as f2,yCe as f3,pCe as f4,Rxe as f5,Mxe as f6,N5e as f7,D5e as f8,lCe as f9,_Q as fA,nxe as fB,Nxe as fC,iCe as fD,UCe as fE,Hwe as fF,qwe as fG,Wwe as fH,Kwe as fI,oCe as fJ,s4e as fK,_xe as fL,OR as fM,xxe as fN,wxe as fO,Cxe as fP,sY as fQ,_le as fR,c4e as fS,sD as fT,x4e as fU,S4e as fV,v4e as fW,w4e as fX,qi as fY,b4e as fZ,u4e as f_,eCe as fa,_Ce as fb,ECe as fc,SCe as fd,Yxe as fe,zxe as ff,ICe as fg,MCe as fh,CCe as fi,wCe as fj,xCe as fk,GCe as fl,OCe as fm,HCe as fn,aCe as fo,sCe as fp,Bxe as fq,Fxe as fr,zCe as fs,Zxe as ft,Ale as fu,Tle as fv,Ele as fw,Ple as fx,Ixe as fy,pxe as fz,dX as g,Jme as g0,P4e as g1,k4e as g2,O4e as g3,yO as h,yr as i,vc as j,_0 as k,gn as l,b0 as m,ph as n,xi as o,na as p,y0 as q,io as r,mh as s,gb as t,wx as u,sO as v,Ox as w,WO as x,uO as y,k as z}; diff --git a/invokeai/frontend/web/dist/index.html b/invokeai/frontend/web/dist/index.html index 315bad4316..a495e00d69 100644 --- a/invokeai/frontend/web/dist/index.html +++ b/invokeai/frontend/web/dist/index.html @@ -12,7 +12,7 @@ margin: 0; } - + diff --git a/invokeai/frontend/web/dist/locales/en.json b/invokeai/frontend/web/dist/locales/en.json index 0640ab9ef0..b9f75ac30f 100644 --- a/invokeai/frontend/web/dist/locales/en.json +++ b/invokeai/frontend/web/dist/locales/en.json @@ -23,6 +23,7 @@ "menu": "Menu" }, "common": { + "communityLabel": "Community", "hotkeysLabel": "Hotkeys", "darkMode": "Dark Mode", "lightMode": "Light Mode", diff --git a/invokeai/frontend/web/src/features/parameters/util/modelIdToMainModelParam.ts b/invokeai/frontend/web/src/features/parameters/util/modelIdToMainModelParam.ts index cdb2bccea2..7d2a606e97 100644 --- a/invokeai/frontend/web/src/features/parameters/util/modelIdToMainModelParam.ts +++ b/invokeai/frontend/web/src/features/parameters/util/modelIdToMainModelParam.ts @@ -8,7 +8,7 @@ export const modelIdToMainModelParam = ( mainModelId: string ): MainModelParam | undefined => { const log = logger('models'); - const [base_model, _model_type, model_name] = mainModelId.split('/'); + const [base_model, model_type, model_name] = mainModelId.split('/'); const result = zMainModel.safeParse({ base_model, diff --git a/invokeai/frontend/web/src/services/api/endpoints/models.ts b/invokeai/frontend/web/src/services/api/endpoints/models.ts index bbc3500099..7f5f5dd632 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/models.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/models.ts @@ -153,7 +153,15 @@ const createModelEntities = ( export const modelsApi = api.injectEndpoints({ endpoints: (build) => ({ getOnnxModels: build.query, void>({ - query: () => ({ url: 'models/', params: { model_type: 'onnx' } }), + query: (base_models) => { + const params = { + model_type: 'onnx', + base_models, + }; + + const query = queryString.stringify(params, { arrayFormat: 'none' }); + return `models/?${query}`; + }, providesTags: (result, error, arg) => { const tags: ApiFullTagDescription[] = [ { id: 'OnnxModel', type: LIST_TAG },