diff --git a/invokeai/frontend/web/dist/assets/App-982926da.js b/invokeai/frontend/web/dist/assets/App-16da1b5e.js similarity index 99% rename from invokeai/frontend/web/dist/assets/App-982926da.js rename to invokeai/frontend/web/dist/assets/App-16da1b5e.js index 339056de8d..708fdf2b8f 100644 --- a/invokeai/frontend/web/dist/assets/App-982926da.js +++ b/invokeai/frontend/web/dist/assets/App-16da1b5e.js @@ -1,4 +1,4 @@ -import{r as g,f as fe,j as l,u as zS,c as re,a as Ae,b as Ee,w as ts,d as un,o as At,S as Xf,e as go,g as qe,h as Rr,k as Jo,i as yc,_ as Yd,l as RS,m as NS,R as Me,n as Ev,p as FS,q as Kd,s as ea,t as y1,v as x1,x as LS,y as BS,z as ee,A as b1,B as S1,C as xc,D as ns,F as B,E as X,G as HS,H as cd,T as Ce,I as C1,J as WS,K as rs,L as Pv,M as VS,N as US,O as $S,P as Wo,Q as w1,U as Iv,V as GS,W as k1,X as qS,Y as YS,Z as KS,$ as j1,a0 as XS,a1 as QS,a2 as ZS,a3 as JS,a4 as e3,a5 as t3,a6 as n3,a7 as E1,a8 as r3,a9 as o3,aa as ql,ab as i3,ac as a3,ad as Nl,ae as Yl,af as Xd,ag as Qd,ah as Zd,ai as s3,aj as P1,ak as l3,al as I1,am as c3,an as M1,ao as T1,ap as Vo,aq as jn,ar as _1,as as os,at as u3,au as d3,av as D1,aw as Jd,ax as ef,ay as A1,az as tf,aA as nf,aB as Mv,aC as O1,aD as z1,aE as R1,aF as Fl,aG as Ll,aH as f3,aI as rf,aJ as N1,aK as F1,aL as L1,aM as h3,aN as p3,aO as Tv,aP as _v,aQ as m3,aR as v3,aS as g3,aT as B1,aU as H1,aV as y3,aW as x3,aX as W1,aY as Dv,aZ as b3,a_ as Av,a$ as S3,b0 as C3,b1 as V1,b2 as w3,b3 as k3,b4 as j3,b5 as ud,b6 as Ov,b7 as U1,b8 as of,b9 as E3,ba as zv,bb as Bl,bc as P3,bd as I3,be as Va,bf as Kl,bg as $1,bh as Xl,bi as M3,bj as T3,bk as br,bl as G1,bm as Qf,bn as is,bo as _3,bp as D3,bq as A3,br as wr,bs as q1,bt as O3,bu as z3,bv as Y1,bw as R3,bx as N3,by as F3,bz as L3,bA as B3,bB as H3,bC as W3,bD as V3,bE as U3,bF as Rv,bG as $3,bH as G3,bI as q3,bJ as Y3,bK as K3,bL as X3,bM as dd,bN as Oa,bO as pl,bP as Nv,bQ as fd,bR as hd,bS as ml,bT as Fv,bU as af,bV as Q3,bW as Z3,bX as J3,bY as bc,bZ as eC,b_ as tC,b$ as nC,c0 as rC,c1 as vl,c2 as pd,c3 as gl,c4 as Ia,c5 as oC,c6 as iC,c7 as K1,c8 as Ql,c9 as Zf,ca as X1,cb as Q1,cc as Z1,cd as aC,ce as J1,cf as e2,cg as t2,ch as n2,ci as r2,cj as Fi,ck as Li,cl as o2,cm as i2,cn as a2,co as s2,cp as l2,cq as sC,cr as lC,cs as Lv,ct as yl,cu as cC,cv as Bv,cw as Hv,cx as Wv,cy as Vv,cz as uC,cA as dC,cB as sf,cC as fC,cD as Uv,cE as xl,cF as Zl,cG as hC,cH as pC,cI as mC,cJ as vC,cK as c2,cL as gC,cM as yC}from"./index-2ad84bef.js";import{I as tn,u as xC,c as bC,a as jt,b as Wt,A as yo,m as ir,d as Bi,e as ei,P as Ua,f as SC,C as CC,g as Y,h as A}from"./storeHooks-e63a2dc4.js";function wC(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 Jl="NOT_FOUND";function kC(e){var t;return{get:function(r){return t&&e(t.key,r)?t.value:Jl},put:function(r,o){t={key:r,value:o}},getEntries:function(){return t?[t]:[]},clear:function(){t=void 0}}}function jC(e,t){var n=[];function r(u){var f=n.findIndex(function(h){return t(u,h.key)});if(f>-1){var p=n[f];return f>0&&(n.splice(f,1),n.unshift(p)),p.value}return Jl}function o(u,f){r(u)===Jl&&(n.unshift({key:u,value:f}),n.length>e&&n.pop())}function s(){return n}function c(){n=[]}return{get:r,put:o,getEntries:s,clear:c}}var EC=function(t,n){return t===n};function PC(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var o=n.length,s=0;s1?t-1:0),r=1;rperformance.now():()=>Date.now(),f2=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(OC()),d2);function zC(e){let t=[],n=[],r=0,o=!1,s=!1;const c=new WeakSet,u={schedule:(f,p=!1,h=!1)=>{const y=h&&o,x=y?t:n;return p&&c.add(f),x.indexOf(f)===-1&&(x.push(f),y&&o&&(r=t.length)),f},cancel:f=>{const p=n.indexOf(f);p!==-1&&n.splice(p,1),c.delete(f)},process:f=>{if(o){s=!0;return}if(o=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let p=0;p(e[t]=zC(()=>$a=!0),e),{}),NC=as.reduce((e,t)=>{const n=Sc[t];return e[t]=(r,o=!1,s=!1)=>($a||BC(),n.schedule(r,o,s)),e},{}),FC=as.reduce((e,t)=>(e[t]=Sc[t].cancel,e),{});as.reduce((e,t)=>(e[t]=()=>Sc[t].process(Hi),e),{});const LC=e=>Sc[e].process(Hi),h2=e=>{$a=!1,Hi.delta=lf?d2:Math.max(Math.min(e-Hi.timestamp,RC),1),Hi.timestamp=e,cf=!0,as.forEach(LC),cf=!1,$a&&(lf=!1,f2(h2))},BC=()=>{$a=!0,lf=!0,cf||f2(h2)},$v=()=>Hi;function Jf(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=g.Children.toArray(e.path),c=fe((u,f)=>l.jsx(tn,{ref:f,viewBox:t,...o,...u,children:s.length?s:l.jsx("path",{fill:"currentColor",d:n})}));return c.displayName=r,c}function ss(e){const{theme:t}=zS(),n=xC();return g.useMemo(()=>bC(t.direction,{...n,...e}),[e,t.direction,n])}var HC=Object.defineProperty,WC=(e,t,n)=>t in e?HC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zt=(e,t,n)=>(WC(e,typeof t!="symbol"?t+"":t,n),n);function Gv(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 VC=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function qv(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function Yv(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var uf=typeof window<"u"?g.useLayoutEffect:g.useEffect,ec=e=>e,UC=class{constructor(){zt(this,"descendants",new Map),zt(this,"register",e=>{if(e!=null)return VC(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),zt(this,"unregister",e=>{this.descendants.delete(e);const t=Gv(Array.from(this.descendants.keys()));this.assignIndex(t)}),zt(this,"destroy",()=>{this.descendants.clear()}),zt(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),zt(this,"count",()=>this.descendants.size),zt(this,"enabledCount",()=>this.enabledValues().length),zt(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),zt(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),zt(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),zt(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),zt(this,"first",()=>this.item(0)),zt(this,"firstEnabled",()=>this.enabledItem(0)),zt(this,"last",()=>this.item(this.descendants.size-1)),zt(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),zt(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),zt(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),zt(this,"next",(e,t=!0)=>{const n=qv(e,this.count(),t);return this.item(n)}),zt(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=qv(r,this.enabledCount(),t);return this.enabledItem(o)}),zt(this,"prev",(e,t=!0)=>{const n=Yv(e,this.count()-1,t);return this.item(n)}),zt(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=Yv(r,this.enabledCount()-1,t);return this.enabledItem(o)}),zt(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=Gv(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 $C(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function ct(...e){return t=>{e.forEach(n=>{$C(n,t)})}}function GC(...e){return g.useMemo(()=>ct(...e),e)}function qC(){const e=g.useRef(new UC);return uf(()=>()=>e.current.destroy()),e.current}var[YC,p2]=jt({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function KC(e){const t=p2(),[n,r]=g.useState(-1),o=g.useRef(null);uf(()=>()=>{o.current&&t.unregister(o.current)},[]),uf(()=>{if(!o.current)return;const c=Number(o.current.dataset.index);n!=c&&!Number.isNaN(c)&&r(c)});const s=ec(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:ct(s,o)}}function eh(){return[ec(YC),()=>ec(p2()),()=>qC(),o=>KC(o)]}var[XC,Cc]=jt({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[QC,th]=jt({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[ZC,tL,JC,ew]=eh(),Di=fe(function(t,n){const{getButtonProps:r}=th(),o=r(t,n),c={display:"flex",alignItems:"center",width:"100%",outline:0,...Cc().button};return l.jsx(re.button,{...o,className:Ae("chakra-accordion__button",t.className),__css:c})});Di.displayName="AccordionButton";function nh(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(x,S)=>x!==S}=e,s=Wt(r),c=Wt(o),[u,f]=g.useState(n),p=t!==void 0,h=p?t:u,y=Wt(x=>{const C=typeof x=="function"?x(h):x;c(h,C)&&(p||f(C),s(C))},[p,s,h,c]);return[h,y]}function tw(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...c}=e;ow(e),iw(e);const u=JC(),[f,p]=g.useState(-1);g.useEffect(()=>()=>{p(-1)},[]);const[h,y]=nh({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:h,setIndex:y,htmlProps:c,getAccordionItemProps:S=>{let C=!1;return S!==null&&(C=Array.isArray(h)?h.includes(S):h===S),{isOpen:C,onChange:w=>{if(S!==null)if(o&&Array.isArray(h)){const j=w?h.concat(S):h.filter(I=>I!==S);y(j)}else w?y(S):s&&y(-1)}}},focusedIndex:f,setFocusedIndex:p,descendants:u}}var[nw,rh]=jt({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function rw(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:c}=rh(),u=g.useRef(null),f=g.useId(),p=r??f,h=`accordion-button-${p}`,y=`accordion-panel-${p}`;aw(e);const{register:x,index:S,descendants:C}=ew({disabled:t&&!n}),{isOpen:k,onChange:w}=s(S===-1?null:S);sw({isOpen:k,isDisabled:t});const j=()=>{w==null||w(!0)},I=()=>{w==null||w(!1)},P=g.useCallback(()=>{w==null||w(!k),c(S)},[S,c,k,w]),M=g.useCallback(R=>{const F={ArrowDown:()=>{const L=C.nextEnabled(S);L==null||L.node.focus()},ArrowUp:()=>{const L=C.prevEnabled(S);L==null||L.node.focus()},Home:()=>{const L=C.firstEnabled();L==null||L.node.focus()},End:()=>{const L=C.lastEnabled();L==null||L.node.focus()}}[R.key];F&&(R.preventDefault(),F(R))},[C,S]),T=g.useCallback(()=>{c(S)},[c,S]),D=g.useCallback(function(V={},F=null){return{...V,type:"button",ref:ct(x,u,F),id:h,disabled:!!t,"aria-expanded":!!k,"aria-controls":y,onClick:Ee(V.onClick,P),onFocus:Ee(V.onFocus,T),onKeyDown:Ee(V.onKeyDown,M)}},[h,t,k,P,T,M,y,x]),_=g.useCallback(function(V={},F=null){return{...V,ref:F,role:"region",id:y,"aria-labelledby":h,hidden:!k}},[h,k,y]);return{isOpen:k,isDisabled:t,isFocusable:n,onOpen:j,onClose:I,getButtonProps:D,getPanelProps:_,htmlProps:o}}function ow(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;ts({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function iw(e){ts({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 aw(e){ts({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. +import{r as g,f as fe,j as l,u as zS,c as re,a as Ae,b as Ee,w as ts,d as un,o as At,S as Xf,e as go,g as qe,h as Rr,k as Jo,i as yc,_ as Yd,l as RS,m as NS,R as Me,n as Ev,p as FS,q as Kd,s as ea,t as y1,v as x1,x as LS,y as BS,z as ee,A as b1,B as S1,C as xc,D as ns,F as B,E as X,G as HS,H as cd,T as Ce,I as C1,J as WS,K as rs,L as Pv,M as VS,N as US,O as $S,P as Wo,Q as w1,U as Iv,V as GS,W as k1,X as qS,Y as YS,Z as KS,$ as j1,a0 as XS,a1 as QS,a2 as ZS,a3 as JS,a4 as e3,a5 as t3,a6 as n3,a7 as E1,a8 as r3,a9 as o3,aa as ql,ab as i3,ac as a3,ad as Nl,ae as Yl,af as Xd,ag as Qd,ah as Zd,ai as s3,aj as P1,ak as l3,al as I1,am as c3,an as M1,ao as T1,ap as Vo,aq as jn,ar as _1,as as os,at as u3,au as d3,av as D1,aw as Jd,ax as ef,ay as A1,az as tf,aA as nf,aB as Mv,aC as O1,aD as z1,aE as R1,aF as Fl,aG as Ll,aH as f3,aI as rf,aJ as N1,aK as F1,aL as L1,aM as h3,aN as p3,aO as Tv,aP as _v,aQ as m3,aR as v3,aS as g3,aT as B1,aU as H1,aV as y3,aW as x3,aX as W1,aY as Dv,aZ as b3,a_ as Av,a$ as S3,b0 as C3,b1 as V1,b2 as w3,b3 as k3,b4 as j3,b5 as ud,b6 as Ov,b7 as U1,b8 as of,b9 as E3,ba as zv,bb as Bl,bc as P3,bd as I3,be as Va,bf as Kl,bg as $1,bh as Xl,bi as M3,bj as T3,bk as br,bl as G1,bm as Qf,bn as is,bo as _3,bp as D3,bq as A3,br as wr,bs as q1,bt as O3,bu as z3,bv as Y1,bw as R3,bx as N3,by as F3,bz as L3,bA as B3,bB as H3,bC as W3,bD as V3,bE as U3,bF as Rv,bG as $3,bH as G3,bI as q3,bJ as Y3,bK as K3,bL as X3,bM as dd,bN as Oa,bO as pl,bP as Nv,bQ as fd,bR as hd,bS as ml,bT as Fv,bU as af,bV as Q3,bW as Z3,bX as J3,bY as bc,bZ as eC,b_ as tC,b$ as nC,c0 as rC,c1 as vl,c2 as pd,c3 as gl,c4 as Ia,c5 as oC,c6 as iC,c7 as K1,c8 as Ql,c9 as Zf,ca as X1,cb as Q1,cc as Z1,cd as aC,ce as J1,cf as e2,cg as t2,ch as n2,ci as r2,cj as Fi,ck as Li,cl as o2,cm as i2,cn as a2,co as s2,cp as l2,cq as sC,cr as lC,cs as Lv,ct as yl,cu as cC,cv as Bv,cw as Hv,cx as Wv,cy as Vv,cz as uC,cA as dC,cB as sf,cC as fC,cD as Uv,cE as xl,cF as Zl,cG as hC,cH as pC,cI as mC,cJ as vC,cK as c2,cL as gC,cM as yC}from"./index-d64f4654.js";import{I as tn,u as xC,c as bC,a as jt,b as Wt,A as yo,m as ir,d as Bi,e as ei,P as Ua,f as SC,C as CC,g as Y,h as A}from"./storeHooks-0eed8e9f.js";function wC(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 Jl="NOT_FOUND";function kC(e){var t;return{get:function(r){return t&&e(t.key,r)?t.value:Jl},put:function(r,o){t={key:r,value:o}},getEntries:function(){return t?[t]:[]},clear:function(){t=void 0}}}function jC(e,t){var n=[];function r(u){var f=n.findIndex(function(h){return t(u,h.key)});if(f>-1){var p=n[f];return f>0&&(n.splice(f,1),n.unshift(p)),p.value}return Jl}function o(u,f){r(u)===Jl&&(n.unshift({key:u,value:f}),n.length>e&&n.pop())}function s(){return n}function c(){n=[]}return{get:r,put:o,getEntries:s,clear:c}}var EC=function(t,n){return t===n};function PC(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var o=n.length,s=0;s1?t-1:0),r=1;rperformance.now():()=>Date.now(),f2=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(OC()),d2);function zC(e){let t=[],n=[],r=0,o=!1,s=!1;const c=new WeakSet,u={schedule:(f,p=!1,h=!1)=>{const y=h&&o,x=y?t:n;return p&&c.add(f),x.indexOf(f)===-1&&(x.push(f),y&&o&&(r=t.length)),f},cancel:f=>{const p=n.indexOf(f);p!==-1&&n.splice(p,1),c.delete(f)},process:f=>{if(o){s=!0;return}if(o=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let p=0;p(e[t]=zC(()=>$a=!0),e),{}),NC=as.reduce((e,t)=>{const n=Sc[t];return e[t]=(r,o=!1,s=!1)=>($a||BC(),n.schedule(r,o,s)),e},{}),FC=as.reduce((e,t)=>(e[t]=Sc[t].cancel,e),{});as.reduce((e,t)=>(e[t]=()=>Sc[t].process(Hi),e),{});const LC=e=>Sc[e].process(Hi),h2=e=>{$a=!1,Hi.delta=lf?d2:Math.max(Math.min(e-Hi.timestamp,RC),1),Hi.timestamp=e,cf=!0,as.forEach(LC),cf=!1,$a&&(lf=!1,f2(h2))},BC=()=>{$a=!0,lf=!0,cf||f2(h2)},$v=()=>Hi;function Jf(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=g.Children.toArray(e.path),c=fe((u,f)=>l.jsx(tn,{ref:f,viewBox:t,...o,...u,children:s.length?s:l.jsx("path",{fill:"currentColor",d:n})}));return c.displayName=r,c}function ss(e){const{theme:t}=zS(),n=xC();return g.useMemo(()=>bC(t.direction,{...n,...e}),[e,t.direction,n])}var HC=Object.defineProperty,WC=(e,t,n)=>t in e?HC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zt=(e,t,n)=>(WC(e,typeof t!="symbol"?t+"":t,n),n);function Gv(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 VC=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function qv(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function Yv(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var uf=typeof window<"u"?g.useLayoutEffect:g.useEffect,ec=e=>e,UC=class{constructor(){zt(this,"descendants",new Map),zt(this,"register",e=>{if(e!=null)return VC(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),zt(this,"unregister",e=>{this.descendants.delete(e);const t=Gv(Array.from(this.descendants.keys()));this.assignIndex(t)}),zt(this,"destroy",()=>{this.descendants.clear()}),zt(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),zt(this,"count",()=>this.descendants.size),zt(this,"enabledCount",()=>this.enabledValues().length),zt(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),zt(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),zt(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),zt(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),zt(this,"first",()=>this.item(0)),zt(this,"firstEnabled",()=>this.enabledItem(0)),zt(this,"last",()=>this.item(this.descendants.size-1)),zt(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),zt(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),zt(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),zt(this,"next",(e,t=!0)=>{const n=qv(e,this.count(),t);return this.item(n)}),zt(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=qv(r,this.enabledCount(),t);return this.enabledItem(o)}),zt(this,"prev",(e,t=!0)=>{const n=Yv(e,this.count()-1,t);return this.item(n)}),zt(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=Yv(r,this.enabledCount()-1,t);return this.enabledItem(o)}),zt(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=Gv(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 $C(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function ct(...e){return t=>{e.forEach(n=>{$C(n,t)})}}function GC(...e){return g.useMemo(()=>ct(...e),e)}function qC(){const e=g.useRef(new UC);return uf(()=>()=>e.current.destroy()),e.current}var[YC,p2]=jt({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function KC(e){const t=p2(),[n,r]=g.useState(-1),o=g.useRef(null);uf(()=>()=>{o.current&&t.unregister(o.current)},[]),uf(()=>{if(!o.current)return;const c=Number(o.current.dataset.index);n!=c&&!Number.isNaN(c)&&r(c)});const s=ec(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:ct(s,o)}}function eh(){return[ec(YC),()=>ec(p2()),()=>qC(),o=>KC(o)]}var[XC,Cc]=jt({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[QC,th]=jt({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[ZC,tL,JC,ew]=eh(),Di=fe(function(t,n){const{getButtonProps:r}=th(),o=r(t,n),c={display:"flex",alignItems:"center",width:"100%",outline:0,...Cc().button};return l.jsx(re.button,{...o,className:Ae("chakra-accordion__button",t.className),__css:c})});Di.displayName="AccordionButton";function nh(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(x,S)=>x!==S}=e,s=Wt(r),c=Wt(o),[u,f]=g.useState(n),p=t!==void 0,h=p?t:u,y=Wt(x=>{const C=typeof x=="function"?x(h):x;c(h,C)&&(p||f(C),s(C))},[p,s,h,c]);return[h,y]}function tw(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...c}=e;ow(e),iw(e);const u=JC(),[f,p]=g.useState(-1);g.useEffect(()=>()=>{p(-1)},[]);const[h,y]=nh({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:h,setIndex:y,htmlProps:c,getAccordionItemProps:S=>{let C=!1;return S!==null&&(C=Array.isArray(h)?h.includes(S):h===S),{isOpen:C,onChange:w=>{if(S!==null)if(o&&Array.isArray(h)){const j=w?h.concat(S):h.filter(I=>I!==S);y(j)}else w?y(S):s&&y(-1)}}},focusedIndex:f,setFocusedIndex:p,descendants:u}}var[nw,rh]=jt({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function rw(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:c}=rh(),u=g.useRef(null),f=g.useId(),p=r??f,h=`accordion-button-${p}`,y=`accordion-panel-${p}`;aw(e);const{register:x,index:S,descendants:C}=ew({disabled:t&&!n}),{isOpen:k,onChange:w}=s(S===-1?null:S);sw({isOpen:k,isDisabled:t});const j=()=>{w==null||w(!0)},I=()=>{w==null||w(!1)},P=g.useCallback(()=>{w==null||w(!k),c(S)},[S,c,k,w]),M=g.useCallback(R=>{const F={ArrowDown:()=>{const L=C.nextEnabled(S);L==null||L.node.focus()},ArrowUp:()=>{const L=C.prevEnabled(S);L==null||L.node.focus()},Home:()=>{const L=C.firstEnabled();L==null||L.node.focus()},End:()=>{const L=C.lastEnabled();L==null||L.node.focus()}}[R.key];F&&(R.preventDefault(),F(R))},[C,S]),T=g.useCallback(()=>{c(S)},[c,S]),D=g.useCallback(function(V={},F=null){return{...V,type:"button",ref:ct(x,u,F),id:h,disabled:!!t,"aria-expanded":!!k,"aria-controls":y,onClick:Ee(V.onClick,P),onFocus:Ee(V.onFocus,T),onKeyDown:Ee(V.onKeyDown,M)}},[h,t,k,P,T,M,y,x]),_=g.useCallback(function(V={},F=null){return{...V,ref:F,role:"region",id:y,"aria-labelledby":h,hidden:!k}},[h,k,y]);return{isOpen:k,isDisabled:t,isFocusable:n,onOpen:j,onClose:I,getButtonProps:D,getPanelProps:_,htmlProps:o}}function ow(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;ts({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function iw(e){ts({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 aw(e){ts({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 sw(e){ts({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Ai(e){const{isOpen:t,isDisabled:n}=th(),{reduceMotion:r}=rh(),o=Ae("chakra-accordion__icon",e.className),s=Cc(),c={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return l.jsx(tn,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:c,...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Ai.displayName="AccordionIcon";var Oi=fe(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...c}=rw(t),f={...Cc().container,overflowAnchor:"none"},p=g.useMemo(()=>c,[c]);return l.jsx(QC,{value:p,children:l.jsx(re.div,{ref:n,...s,className:Ae("chakra-accordion__item",o),__css:f,children:typeof r=="function"?r({isExpanded:!!c.isOpen,isDisabled:!!c.isDisabled}):r})})});Oi.displayName="AccordionItem";var Bo={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Ma={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 df(e){var t;switch((t=e==null?void 0:e.direction)!=null?t:"right"){case"right":return Ma.slideRight;case"left":return Ma.slideLeft;case"bottom":return Ma.slideDown;case"top":return Ma.slideUp;default:return Ma.slideRight}}var Uo={enter:{duration:.2,ease:Bo.easeOut},exit:{duration:.1,ease:Bo.easeIn}},nr={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})},lw=e=>e!=null&&parseInt(e.toString(),10)>0,Kv={exit:{height:{duration:.2,ease:Bo.ease},opacity:{duration:.3,ease:Bo.ease}},enter:{height:{duration:.3,ease:Bo.ease},opacity:{duration:.4,ease:Bo.ease}}},cw={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:lw(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:nr.exit(Kv.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:nr.enter(Kv.enter,o)}}},m2=g.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:c="auto",style:u,className:f,transition:p,transitionEnd:h,...y}=e,[x,S]=g.useState(!1);g.useEffect(()=>{const I=setTimeout(()=>{S(!0)});return()=>clearTimeout(I)},[]),ts({condition:Boolean(s>0&&r),message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const C=parseFloat(s.toString())>0,k={startingHeight:s,endingHeight:c,animateOpacity:o,transition:x?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:C?"block":"none"}}},w=r?n:!0,j=n||r?"enter":"exit";return l.jsx(yo,{initial:!1,custom:k,children:w&&l.jsx(ir.div,{ref:t,...y,className:Ae("chakra-collapse",f),style:{overflow:"hidden",display:"block",...u},custom:k,variants:cw,initial:r?"exit":!1,animate:j,exit:"exit"})})});m2.displayName="Collapse";var uw={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:nr.enter(Uo.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:0,transition:(r=e==null?void 0:e.exit)!=null?r:nr.exit(Uo.exit,n),transitionEnd:t==null?void 0:t.exit}}},v2={initial:"exit",animate:"enter",exit:"exit",variants:uw},dw=g.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:c,transitionEnd:u,delay:f,...p}=t,h=o||r?"enter":"exit",y=r?o&&r:!0,x={transition:c,transitionEnd:u,delay:f};return l.jsx(yo,{custom:x,children:y&&l.jsx(ir.div,{ref:n,className:Ae("chakra-fade",s),custom:x,...v2,animate:h,...p})})});dw.displayName="Fade";var fw={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:nr.exit(Uo.exit,o)}},enter:({transitionEnd:e,transition:t,delay:n})=>{var r;return{opacity:1,scale:1,transition:(r=t==null?void 0:t.enter)!=null?r:nr.enter(Uo.enter,n),transitionEnd:e==null?void 0:e.enter}}},g2={initial:"exit",animate:"enter",exit:"exit",variants:fw},hw=g.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:c=.95,className:u,transition:f,transitionEnd:p,delay:h,...y}=t,x=r?o&&r:!0,S=o||r?"enter":"exit",C={initialScale:c,reverse:s,transition:f,transitionEnd:p,delay:h};return l.jsx(yo,{custom:C,children:x&&l.jsx(ir.div,{ref:n,className:Ae("chakra-offset-slide",u),...g2,animate:S,custom:C,...y})})});hw.displayName="ScaleFade";var pw={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:nr.exit(Uo.exit,o),transitionEnd:r==null?void 0:r.exit}},enter:({transition:e,transitionEnd:t,delay:n})=>{var r;return{opacity:1,x:0,y:0,transition:(r=e==null?void 0:e.enter)!=null?r:nr.enter(Uo.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var c;const u={x:t,y:e};return{opacity:0,transition:(c=n==null?void 0:n.exit)!=null?c:nr.exit(Uo.exit,s),...o?{...u,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...u,...r==null?void 0:r.exit}}}}},ff={initial:"initial",animate:"enter",exit:"exit",variants:pw},mw=g.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:c,offsetX:u=0,offsetY:f=8,transition:p,transitionEnd:h,delay:y,...x}=t,S=r?o&&r:!0,C=o||r?"enter":"exit",k={offsetX:u,offsetY:f,reverse:s,transition:p,transitionEnd:h,delay:y};return l.jsx(yo,{custom:k,children:S&&l.jsx(ir.div,{ref:n,className:Ae("chakra-offset-slide",c),custom:k,...ff,animate:C,...x})})});mw.displayName="SlideFade";var Xv={exit:{duration:.15,ease:Bo.easeInOut},enter:{type:"spring",damping:25,stiffness:180}},vw={exit:({direction:e,transition:t,transitionEnd:n,delay:r})=>{var o;const{exit:s}=df({direction:e});return{...s,transition:(o=t==null?void 0:t.exit)!=null?o:nr.exit(Xv.exit,r),transitionEnd:n==null?void 0:n.exit}},enter:({direction:e,transitionEnd:t,transition:n,delay:r})=>{var o;const{enter:s}=df({direction:e});return{...s,transition:(o=n==null?void 0:n.enter)!=null?o:nr.enter(Xv.enter,r),transitionEnd:t==null?void 0:t.enter}}},y2=g.forwardRef(function(t,n){const{direction:r="right",style:o,unmountOnExit:s,in:c,className:u,transition:f,transitionEnd:p,delay:h,motionProps:y,...x}=t,S=df({direction:r}),C=Object.assign({position:"fixed"},S.position,o),k=s?c&&s:!0,w=c||s?"enter":"exit",j={transitionEnd:p,transition:f,direction:r,delay:h};return l.jsx(yo,{custom:j,children:k&&l.jsx(ir.div,{...x,ref:n,initial:"exit",className:Ae("chakra-slide",u),animate:w,exit:"exit",custom:j,variants:vw,style:C,...y})})});y2.displayName="Slide";var zi=fe(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:c}=rh(),{getPanelProps:u,isOpen:f}=th(),p=u(s,n),h=Ae("chakra-accordion__panel",r),y=Cc();c||delete p.hidden;const x=l.jsx(re.div,{...p,__css:y.panel,className:h});return c?x:l.jsx(m2,{in:f,...o,children:x})});zi.displayName="AccordionPanel";var oh=fe(function({children:t,reduceMotion:n,...r},o){const s=un("Accordion",r),c=At(r),{htmlProps:u,descendants:f,...p}=tw(c),h=g.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return l.jsx(ZC,{value:f,children:l.jsx(nw,{value:h,children:l.jsx(XC,{value:s,children:l.jsx(re.div,{ref:o,...u,className:Ae("chakra-accordion",r.className),__css:s.root,children:t})})})})});oh.displayName="Accordion";var hf=fe(function(t,n){const{htmlWidth:r,htmlHeight:o,alt:s,...c}=t;return l.jsx("img",{width:r,height:o,ref:n,alt:s,...c})});hf.displayName="NativeImage";function gw(e){const{loading:t,src:n,srcSet:r,onLoad:o,onError:s,crossOrigin:c,sizes:u,ignoreFallback:f}=e,[p,h]=g.useState("pending");g.useEffect(()=>{h(n?"loading":"pending")},[n]);const y=g.useRef(),x=g.useCallback(()=>{if(!n)return;S();const C=new Image;C.src=n,c&&(C.crossOrigin=c),r&&(C.srcset=r),u&&(C.sizes=u),t&&(C.loading=t),C.onload=k=>{S(),h("loaded"),o==null||o(k)},C.onerror=k=>{S(),h("failed"),s==null||s(k)},y.current=C},[n,c,r,u,o,s,t]),S=()=>{y.current&&(y.current.onload=null,y.current.onerror=null,y.current=null)};return Bi(()=>{if(!f)return p==="loading"&&x(),()=>{S()}},[p,x,f]),f?"loaded":p}var yw=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function xw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var ls=fe(function(t,n){const{fallbackSrc:r,fallback:o,src:s,srcSet:c,align:u,fit:f,loading:p,ignoreFallback:h,crossOrigin:y,fallbackStrategy:x="beforeLoadOrError",referrerPolicy:S,...C}=t,k=r!==void 0||o!==void 0,w=p!=null||h||!k,j=gw({...t,ignoreFallback:w}),I=yw(j,x),P={ref:n,objectFit:f,objectPosition:u,...w?C:xw(C,["onError","onLoad"])};return I?o||l.jsx(re.img,{as:hf,className:"chakra-image__placeholder",src:r,...P}):l.jsx(re.img,{as:hf,src:s,srcSet:c,crossOrigin:y,loading:p,referrerPolicy:S,className:"chakra-image",...P})});ls.displayName="Image";function ih(e){return g.Children.toArray(e).filter(t=>g.isValidElement(t))}var[bw,Sw]=jt({strict:!1,name:"ButtonGroupContext"}),Cw={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}}},ww={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},Qt=fe(function(t,n){const{size:r,colorScheme:o,variant:s,className:c,spacing:u="0.5rem",isAttached:f,isDisabled:p,orientation:h="horizontal",...y}=t,x=Ae("chakra-button__group",c),S=g.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let C={display:"inline-flex",...f?Cw[h]:ww[h](u)};const k=h==="vertical";return l.jsx(bw,{value:S,children:l.jsx(re.div,{ref:n,role:"group",__css:C,className:x,"data-attached":f?"":void 0,"data-orientation":h,flexDir:k?"column":void 0,...y})})});Qt.displayName="ButtonGroup";function kw(e){const[t,n]=g.useState(!e);return{ref:g.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function pf(e){const{children:t,className:n,...r}=e,o=g.isValidElement(t)?g.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=Ae("chakra-button__icon",n);return l.jsx(re.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}pf.displayName="ButtonIcon";function tc(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=l.jsx(Xf,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:c,...u}=e,f=Ae("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",h=g.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[p]:t?r:0,fontSize:"1em",lineHeight:"normal",...c}),[c,t,p,r]);return l.jsx(re.div,{className:f,...u,__css:h,children:o})}tc.displayName="ButtonSpinner";var ti=fe((e,t)=>{const n=Sw(),r=go("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:c,children:u,leftIcon:f,rightIcon:p,loadingText:h,iconSpacing:y="0.5rem",type:x,spinner:S,spinnerPlacement:C="start",className:k,as:w,...j}=At(e),I=g.useMemo(()=>{const D={...r==null?void 0:r._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...r,...!!n&&{_focus:D}}},[r,n]),{ref:P,type:M}=kw(w),T={rightIcon:p,leftIcon:f,iconSpacing:y,children:u};return l.jsxs(re.button,{ref:GC(t,P),as:w,type:x??M,"data-active":qe(c),"data-loading":qe(s),__css:I,className:Ae("chakra-button",k),...j,disabled:o||s,children:[s&&C==="start"&&l.jsx(tc,{className:"chakra-button__spinner--start",label:h,placement:"start",spacing:y,children:S}),s?h||l.jsx(re.span,{opacity:0,children:l.jsx(Qv,{...T})}):l.jsx(Qv,{...T}),s&&C==="end"&&l.jsx(tc,{className:"chakra-button__spinner--end",label:h,placement:"end",spacing:y,children:S})]})});ti.displayName="Button";function Qv(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return l.jsxs(l.Fragment,{children:[t&&l.jsx(pf,{marginEnd:o,children:t}),r,n&&l.jsx(pf,{marginStart:o,children:n})]})}var fo=fe((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...c}=e,u=n||r,f=g.isValidElement(u)?g.cloneElement(u,{"aria-hidden":!0,focusable:!1}):null;return l.jsx(ti,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...c,children:f})});fo.displayName="IconButton";var[nL,jw]=jt({name:"CheckboxGroupContext",strict:!1});function Ew(e){return l.jsx(re.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:l.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function Pw(e){return l.jsx(re.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:l.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function Iw(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?Pw:Ew;return n||t?l.jsx(re.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:l.jsx(o,{...r})}):null}var[Mw,x2]=jt({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Tw,ni]=jt({strict:!1,name:"FormControlContext"});function _w(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...c}=e,u=g.useId(),f=t||`field-${u}`,p=`${f}-label`,h=`${f}-feedback`,y=`${f}-helptext`,[x,S]=g.useState(!1),[C,k]=g.useState(!1),[w,j]=g.useState(!1),I=g.useCallback((_={},R=null)=>({id:y,..._,ref:ct(R,V=>{V&&k(!0)})}),[y]),P=g.useCallback((_={},R=null)=>{var V,F;return{..._,ref:R,"data-focus":qe(w),"data-disabled":qe(o),"data-invalid":qe(r),"data-readonly":qe(s),id:(V=_.id)!=null?V:p,htmlFor:(F=_.htmlFor)!=null?F:f}},[f,o,w,r,s,p]),M=g.useCallback((_={},R=null)=>({id:h,..._,ref:ct(R,V=>{V&&S(!0)}),"aria-live":"polite"}),[h]),T=g.useCallback((_={},R=null)=>({..._,...c,ref:R,role:"group"}),[c]),D=g.useCallback((_={},R=null)=>({..._,ref:R,role:"presentation","aria-hidden":!0,children:_.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!w,onFocus:()=>j(!0),onBlur:()=>j(!1),hasFeedbackText:x,setHasFeedbackText:S,hasHelpText:C,setHasHelpText:k,id:f,labelId:p,feedbackId:h,helpTextId:y,htmlProps:c,getHelpTextProps:I,getErrorMessageProps:M,getRootProps:T,getLabelProps:P,getRequiredIndicatorProps:D}}var rt=fe(function(t,n){const r=un("Form",t),o=At(t),{getRootProps:s,htmlProps:c,...u}=_w(o),f=Ae("chakra-form-control",t.className);return l.jsx(Tw,{value:u,children:l.jsx(Mw,{value:r,children:l.jsx(re.div,{...s({},n),className:f,__css:r.container})})})});rt.displayName="FormControl";var pn=fe(function(t,n){const r=ni(),o=x2(),s=Ae("chakra-form__helper-text",t.className);return l.jsx(re.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});pn.displayName="FormHelperText";var[Dw,Aw]=jt({name:"FormErrorStylesContext",errorMessage:`useFormErrorStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),mn=fe((e,t)=>{const n=un("FormError",e),r=At(e),o=ni();return o!=null&&o.isInvalid?l.jsx(Dw,{value:n,children:l.jsx(re.div,{...o==null?void 0:o.getErrorMessageProps(r,t),className:Ae("chakra-form__error-message",e.className),__css:{display:"flex",alignItems:"center",...n.text}})}):null});mn.displayName="FormErrorMessage";var Ow=fe((e,t)=>{const n=Aw(),r=ni();if(!(r!=null&&r.isInvalid))return null;const o=Ae("chakra-form__error-icon",e.className);return l.jsx(tn,{ref:t,"aria-hidden":!0,...e,__css:n.icon,className:o,children:l.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})});Ow.displayName="FormErrorIcon";var st=fe(function(t,n){var r;const o=go("FormLabel",t),s=At(t),{className:c,children:u,requiredIndicator:f=l.jsx(b2,{}),optionalIndicator:p=null,...h}=s,y=ni(),x=(r=y==null?void 0:y.getLabelProps(h,n))!=null?r:{ref:n,...h};return l.jsxs(re.label,{...x,className:Ae("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[u,y!=null&&y.isRequired?f:p]})});st.displayName="FormLabel";var b2=fe(function(t,n){const r=ni(),o=x2();if(!(r!=null&&r.isRequired))return null;const s=Ae("chakra-form__required-indicator",t.className);return l.jsx(re.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});b2.displayName="RequiredIndicator";function ah(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=sh(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":Rr(n),"aria-required":Rr(o),"aria-readonly":Rr(r)}}function sh(e){var t,n,r;const o=ni(),{id:s,disabled:c,readOnly:u,required:f,isRequired:p,isInvalid:h,isReadOnly:y,isDisabled:x,onFocus:S,onBlur:C,...k}=e,w=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&w.push(o.feedbackId),o!=null&&o.hasHelpText&&w.push(o.helpTextId),{...k,"aria-describedby":w.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=c??x)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=u??y)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=f??p)!=null?r:o==null?void 0:o.isRequired,isInvalid:h??(o==null?void 0:o.isInvalid),onFocus:Ee(o==null?void 0:o.onFocus,S),onBlur:Ee(o==null?void 0:o.onBlur,C)}}var lh={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},S2=re("span",{baseStyle:lh});S2.displayName="VisuallyHidden";var zw=re("input",{baseStyle:lh});zw.displayName="VisuallyHiddenInput";var Zv=!1,cs=null,Ko=!1,mf=!1,vf=new Set;function ch(e,t){vf.forEach(n=>n(e,t))}var Rw=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function Nw(e){return!(e.metaKey||!Rw&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Jv(e){Ko=!0,Nw(e)&&(cs="keyboard",ch("keyboard",e))}function wi(e){if(cs="pointer",e.type==="mousedown"||e.type==="pointerdown"){Ko=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;ch("pointer",e)}}function Fw(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function Lw(e){Fw(e)&&(Ko=!0,cs="virtual")}function Bw(e){e.target===window||e.target===document||(!Ko&&!mf&&(cs="virtual",ch("virtual",e)),Ko=!1,mf=!1)}function Hw(){Ko=!1,mf=!0}function eg(){return cs!=="pointer"}function Ww(){if(typeof window>"u"||Zv)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Ko=!0,e.apply(this,n)},document.addEventListener("keydown",Jv,!0),document.addEventListener("keyup",Jv,!0),document.addEventListener("click",Lw,!0),window.addEventListener("focus",Bw,!0),window.addEventListener("blur",Hw,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",wi,!0),document.addEventListener("pointermove",wi,!0),document.addEventListener("pointerup",wi,!0)):(document.addEventListener("mousedown",wi,!0),document.addEventListener("mousemove",wi,!0),document.addEventListener("mouseup",wi,!0)),Zv=!0}function C2(e){Ww(),e(eg());const t=()=>e(eg());return vf.add(t),()=>{vf.delete(t)}}function Vw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function w2(e={}){const t=sh(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:c,onBlur:u,onFocus:f,"aria-describedby":p}=t,{defaultChecked:h,isChecked:y,isFocusable:x,onChange:S,isIndeterminate:C,name:k,value:w,tabIndex:j=void 0,"aria-label":I,"aria-labelledby":P,"aria-invalid":M,...T}=e,D=Vw(T,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),_=Wt(S),R=Wt(u),V=Wt(f),[F,L]=g.useState(!1),[Q,U]=g.useState(!1),[K,te]=g.useState(!1),[ne,$]=g.useState(!1);g.useEffect(()=>C2(L),[]);const Z=g.useRef(null),[oe,le]=g.useState(!0),[Re,Ne]=g.useState(!!h),Ie=y!==void 0,pe=Ie?y:Re,ce=g.useCallback(ye=>{if(r||n){ye.preventDefault();return}Ie||Ne(pe?ye.target.checked:C?!0:ye.target.checked),_==null||_(ye)},[r,n,pe,Ie,C,_]);Bi(()=>{Z.current&&(Z.current.indeterminate=Boolean(C))},[C]),ei(()=>{n&&U(!1)},[n,U]),Bi(()=>{const ye=Z.current;ye!=null&&ye.form&&(ye.form.onreset=()=>{Ne(!!h)})},[]);const Fe=n&&!x,Ve=g.useCallback(ye=>{ye.key===" "&&$(!0)},[$]),Ue=g.useCallback(ye=>{ye.key===" "&&$(!1)},[$]);Bi(()=>{if(!Z.current)return;Z.current.checked!==pe&&Ne(Z.current.checked)},[Z.current]);const $e=g.useCallback((ye={},Pe=null)=>{const et=Be=>{Q&&Be.preventDefault(),$(!0)};return{...ye,ref:Pe,"data-active":qe(ne),"data-hover":qe(K),"data-checked":qe(pe),"data-focus":qe(Q),"data-focus-visible":qe(Q&&F),"data-indeterminate":qe(C),"data-disabled":qe(n),"data-invalid":qe(s),"data-readonly":qe(r),"aria-hidden":!0,onMouseDown:Ee(ye.onMouseDown,et),onMouseUp:Ee(ye.onMouseUp,()=>$(!1)),onMouseEnter:Ee(ye.onMouseEnter,()=>te(!0)),onMouseLeave:Ee(ye.onMouseLeave,()=>te(!1))}},[ne,pe,n,Q,F,K,C,s,r]),Qe=g.useCallback((ye={},Pe=null)=>({...D,...ye,ref:ct(Pe,et=>{et&&le(et.tagName==="LABEL")}),onClick:Ee(ye.onClick,()=>{var et;oe||((et=Z.current)==null||et.click(),requestAnimationFrame(()=>{var Be;(Be=Z.current)==null||Be.focus()}))}),"data-disabled":qe(n),"data-checked":qe(pe),"data-invalid":qe(s)}),[D,n,pe,s,oe]),ge=g.useCallback((ye={},Pe=null)=>({...ye,ref:ct(Z,Pe),type:"checkbox",name:k,value:w,id:c,tabIndex:j,onChange:Ee(ye.onChange,ce),onBlur:Ee(ye.onBlur,R,()=>U(!1)),onFocus:Ee(ye.onFocus,V,()=>U(!0)),onKeyDown:Ee(ye.onKeyDown,Ve),onKeyUp:Ee(ye.onKeyUp,Ue),required:o,checked:pe,disabled:Fe,readOnly:r,"aria-label":I,"aria-labelledby":P,"aria-invalid":M?Boolean(M):s,"aria-describedby":p,"aria-disabled":n,style:lh}),[k,w,c,ce,R,V,Ve,Ue,o,pe,Fe,r,I,P,M,s,p,n,j]),Te=g.useCallback((ye={},Pe=null)=>({...ye,ref:Pe,onMouseDown:Ee(ye.onMouseDown,tg),onTouchStart:Ee(ye.onTouchStart,tg),"data-disabled":qe(n),"data-checked":qe(pe),"data-invalid":qe(s)}),[pe,n,s]);return{state:{isInvalid:s,isFocused:Q,isChecked:pe,isActive:ne,isHovered:K,isIndeterminate:C,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:Qe,getCheckboxProps:$e,getInputProps:ge,getLabelProps:Te,htmlProps:D}}function tg(e){e.preventDefault(),e.stopPropagation()}var Uw={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},$w={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},Gw=Jo({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),qw=Jo({from:{opacity:0},to:{opacity:1}}),Yw=Jo({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),k2=fe(function(t,n){const r=jw(),o={...r,...t},s=un("Checkbox",o),c=At(t),{spacing:u="0.5rem",className:f,children:p,iconColor:h,iconSize:y,icon:x=l.jsx(Iw,{}),isChecked:S,isDisabled:C=r==null?void 0:r.isDisabled,onChange:k,inputProps:w,...j}=c;let I=S;r!=null&&r.value&&c.value&&(I=r.value.includes(c.value));let P=k;r!=null&&r.onChange&&c.value&&(P=yc(r.onChange,k));const{state:M,getInputProps:T,getCheckboxProps:D,getLabelProps:_,getRootProps:R}=w2({...j,isDisabled:C,isChecked:I,onChange:P}),V=g.useMemo(()=>({animation:M.isIndeterminate?`${qw} 20ms linear, ${Yw} 200ms linear`:`${Gw} 200ms linear`,fontSize:y,color:h,...s.icon}),[h,y,,M.isIndeterminate,s.icon]),F=g.cloneElement(x,{__css:V,isIndeterminate:M.isIndeterminate,isChecked:M.isChecked});return l.jsxs(re.label,{__css:{...$w,...s.container},className:Ae("chakra-checkbox",f),...R(),children:[l.jsx("input",{className:"chakra-checkbox__input",...T(w,n)}),l.jsx(re.span,{__css:{...Uw,...s.control},className:"chakra-checkbox__control",...D(),children:F}),p&&l.jsx(re.span,{className:"chakra-checkbox__label",..._(),__css:{marginStart:u,...s.label},children:p})]})});k2.displayName="Checkbox";function Kw(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function uh(e,t){let n=Kw(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function gf(e){if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n}function ng(e,t,n){return(e-t)*100/(n-t)}function Xw(e,t,n){return(n-t)*e+t}function rg(e,t,n){const r=Math.round((e-t)/n)*n+t,o=gf(n);return uh(r,o)}function Hl(e,t,n){return e==null?e:(n{var F;return r==null?"":(F=md(r,s,n))!=null?F:""}),x=typeof o<"u",S=x?o:h,C=j2(oo(S),s),k=n??C,w=g.useCallback(F=>{F!==S&&(x||y(F.toString()),p==null||p(F.toString(),oo(F)))},[p,x,S]),j=g.useCallback(F=>{let L=F;return f&&(L=Hl(L,c,u)),uh(L,k)},[k,f,u,c]),I=g.useCallback((F=s)=>{let L;S===""?L=oo(F):L=oo(S)+F,L=j(L),w(L)},[j,s,w,S]),P=g.useCallback((F=s)=>{let L;S===""?L=oo(-F):L=oo(S)-F,L=j(L),w(L)},[j,s,w,S]),M=g.useCallback(()=>{var F;let L;r==null?L="":L=(F=md(r,s,n))!=null?F:c,w(L)},[r,n,s,w,c]),T=g.useCallback(F=>{var L;const Q=(L=md(F,s,k))!=null?L:c;w(Q)},[k,s,w,c]),D=oo(S);return{isOutOfRange:D>u||D{const s=typeof e=="function"?e():e??document;if(!(!n||!s))return s.addEventListener(t,o,r),()=>{s.removeEventListener(t,o,r)}},[t,e,r,o,n]),()=>{const s=typeof e=="function"?e():e??document;s==null||s.removeEventListener(t,o,r)}}function Zw(e){return"current"in e}var E2=()=>typeof window<"u";function Jw(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var e5=e=>E2()&&e.test(navigator.vendor),t5=e=>E2()&&e.test(Jw()),n5=()=>t5(/mac|iphone|ipad|ipod/i),r5=()=>n5()&&e5(/apple/i);function o5(e){const{ref:t,elements:n,enabled:r}=e,o=()=>{var s,c;return(c=(s=t.current)==null?void 0:s.ownerDocument)!=null?c:document};$o(o,"pointerdown",s=>{if(!r5()||!r)return;const c=s.target,f=(n??[t]).some(p=>{const h=Zw(p)?p.current:p;return(h==null?void 0:h.contains(c))||h===c});o().activeElement!==c&&f&&(s.preventDefault(),c.focus())})}var lt={},i5={get exports(){return lt},set exports(e){lt=e}},a5="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",s5=a5,l5=s5;function P2(){}function I2(){}I2.resetWarningCache=P2;var c5=function(){function e(r,o,s,c,u,f){if(f!==l5){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:I2,resetWarningCache:P2};return n.PropTypes=n,n};i5.exports=c5();var yf="data-focus-lock",M2="data-focus-lock-disabled",u5="data-no-focus-lock",d5="data-autofocus-inside",f5="data-no-autofocus";function h5(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function p5(e,t){var n=g.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 T2(e,t){return p5(t||null,function(n){return e.forEach(function(r){return h5(r,n)})})}var vd={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},yr=function(){return yr=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){c={error:u}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(c)throw c.error}}return s}function xf(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(I5)},M5=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],ph=M5.join(","),T5="".concat(ph,", [data-focus-guard]"),Y2=function(e,t){return jr((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?T5:ph)?[r]:[],Y2(r))},[])},_5=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?wc([e.contentDocument.body],t):[e]},wc=function(e,t){return e.reduce(function(n,r){var o,s=Y2(r,t),c=(o=[]).concat.apply(o,s.map(function(u){return _5(u,t)}));return n.concat(c,r.parentNode?jr(r.parentNode.querySelectorAll(ph)).filter(function(u){return u===r}):[])},[])},D5=function(e){var t=e.querySelectorAll("[".concat(d5,"]"));return jr(t).map(function(n){return wc([n])}).reduce(function(n,r){return n.concat(r)},[])},mh=function(e,t){return jr(e).filter(function(n){return W2(t,n)}).filter(function(n){return j5(n)})},ig=function(e,t){return t===void 0&&(t=new Map),jr(e).filter(function(n){return V2(t,n)})},bf=function(e,t,n){return q2(mh(wc(e,n),t),!0,n)},ag=function(e,t){return q2(mh(wc(e),t),!1)},A5=function(e,t){return mh(D5(e),t)},Wi=function(e,t){return e.shadowRoot?Wi(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:jr(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?Wi(o,t):!1}return Wi(n,t)})},O5=function(e){for(var t=new Set,n=e.length,r=0;r0&&t.add(o),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(c,u){return!t.has(u)})},K2=function(e){return e.parentNode?K2(e.parentNode):e},vh=function(e){var t=nc(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(yf);return n.push.apply(n,o?O5(jr(K2(r).querySelectorAll("[".concat(yf,'="').concat(o,'"]:not([').concat(M2,'="disabled"])')))):[r]),n},[])},z5=function(e){try{return e()}catch{return}},Ga=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Ga(t.shadowRoot):t instanceof HTMLIFrameElement&&z5(function(){return t.contentWindow.document})?Ga(t.contentWindow.document):t}},R5=function(e,t){return e===t},N5=function(e,t){return Boolean(jr(e.querySelectorAll("iframe")).some(function(n){return R5(n,t)}))},X2=function(e,t){return t===void 0&&(t=Ga(L2(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:vh(e).some(function(n){return Wi(n,t)||N5(n,t)})},F5=function(e){e===void 0&&(e=document);var t=Ga(e);return t?jr(e.querySelectorAll("[".concat(u5,"]"))).some(function(n){return Wi(n,t)}):!1},L5=function(e,t){return t.filter(G2).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},gh=function(e,t){return G2(e)&&e.name?L5(e,t):e},B5=function(e){var t=new Set;return e.forEach(function(n){return t.add(gh(n,e))}),e.filter(function(n){return t.has(n)})},sg=function(e){return e[0]&&e.length>1?gh(e[0],e):e[0]},lg=function(e,t){return e.length>1?e.indexOf(gh(e[t],e)):t},Q2="NEW_FOCUS",H5=function(e,t,n,r){var o=e.length,s=e[0],c=e[o-1],u=hh(n);if(!(n&&e.indexOf(n)>=0)){var f=n!==void 0?t.indexOf(n):-1,p=r?t.indexOf(r):f,h=r?e.indexOf(r):-1,y=f-p,x=t.indexOf(s),S=t.indexOf(c),C=B5(t),k=n!==void 0?C.indexOf(n):-1,w=k-(r?C.indexOf(r):f),j=lg(e,0),I=lg(e,o-1);if(f===-1||h===-1)return Q2;if(!y&&h>=0)return h;if(f<=x&&u&&Math.abs(y)>1)return I;if(f>=S&&u&&Math.abs(y)>1)return j;if(y&&Math.abs(w)>1)return h;if(f<=x)return I;if(f>S)return j;if(y)return Math.abs(y)>1?h:(o+h+y)%o}},W5=function(e){return function(t){var n,r=(n=U2(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},V5=function(e,t,n){var r=e.map(function(s){var c=s.node;return c}),o=ig(r.filter(W5(n)));return o&&o.length?sg(o):sg(ig(t))},Sf=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&Sf(e.parentNode.host||e.parentNode,t),t},gd=function(e,t){for(var n=Sf(e),r=Sf(t),o=0;o=0)return s}return!1},Z2=function(e,t,n){var r=nc(e),o=nc(t),s=r[0],c=!1;return o.filter(Boolean).forEach(function(u){c=gd(c||u,u)||c,n.filter(Boolean).forEach(function(f){var p=gd(s,f);p&&(!c||Wi(p,c)?c=p:c=gd(p,c))})}),c},U5=function(e,t){return e.reduce(function(n,r){return n.concat(A5(r,t))},[])},$5=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(P5)},G5=function(e,t){var n=Ga(nc(e).length>0?document:L2(e).ownerDocument),r=vh(e).filter(rc),o=Z2(n||e,e,r),s=new Map,c=ag(r,s),u=bf(r,s).filter(function(S){var C=S.node;return rc(C)});if(!(!u[0]&&(u=c,!u[0]))){var f=ag([o],s).map(function(S){var C=S.node;return C}),p=$5(f,u),h=p.map(function(S){var C=S.node;return C}),y=H5(h,f,n,t);if(y===Q2){var x=V5(c,h,U5(r,s));if(x)return{node:x};console.warn("focus-lock: cannot find any node to move focus into");return}return y===void 0?y:p[y]}},q5=function(e){var t=vh(e).filter(rc),n=Z2(e,e,t),r=new Map,o=bf([n],r,!0),s=bf(t,r).filter(function(c){var u=c.node;return rc(u)}).map(function(c){var u=c.node;return u});return o.map(function(c){var u=c.node,f=c.index;return{node:u,index:f,lockItem:s.indexOf(u)>=0,guard:hh(u)}})},Y5=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},yd=0,xd=!1,J2=function(e,t,n){n===void 0&&(n={});var r=G5(e,t);if(!xd&&r){if(yd>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),xd=!0,setTimeout(function(){xd=!1},1);return}yd++,Y5(r.node,n.focusOptions),yd--}};function ey(e){var t=window,n=t.setImmediate;typeof n<"u"?n(e):setTimeout(e,1)}var K5=function(){return document&&document.activeElement===document.body},X5=function(){return K5()||F5()},Vi=null,Ri=null,Ui=null,qa=!1,Q5=function(){return!0},Z5=function(t){return(Vi.whiteList||Q5)(t)},J5=function(t,n){Ui={observerNode:t,portaledElement:n}},e6=function(t){return Ui&&Ui.portaledElement===t};function cg(e,t,n,r){var o=null,s=e;do{var c=r[s];if(c.guard)c.node.dataset.focusAutoGuard&&(o=c);else if(c.lockItem){if(s!==e)return;o=null}else break}while((s+=n)!==t);o&&(o.node.tabIndex=0)}var t6=function(t){return t&&"current"in t?t.current:t},n6=function(t){return t?Boolean(qa):qa==="meanwhile"},r6=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},o6=function(t,n){return n.some(function(r){return r6(t,r,r)})},oc=function(){var t=!1;if(Vi){var n=Vi,r=n.observed,o=n.persistentFocus,s=n.autoFocus,c=n.shards,u=n.crossFrame,f=n.focusOptions,p=r||Ui&&Ui.portaledElement,h=document&&document.activeElement;if(p){var y=[p].concat(c.map(t6).filter(Boolean));if((!h||Z5(h))&&(o||n6(u)||!X5()||!Ri&&s)&&(p&&!(X2(y)||h&&o6(h,y)||e6(h))&&(document&&!Ri&&h&&!s?(h.blur&&h.blur(),document.body.focus()):(t=J2(y,Ri,{focusOptions:f}),Ui={})),qa=!1,Ri=document&&document.activeElement),document){var x=document&&document.activeElement,S=q5(y),C=S.map(function(k){var w=k.node;return w}).indexOf(x);C>-1&&(S.filter(function(k){var w=k.guard,j=k.node;return w&&j.dataset.focusAutoGuard}).forEach(function(k){var w=k.node;return w.removeAttribute("tabIndex")}),cg(C,S.length,1,S),cg(C,-1,-1,S))}}}return t},ty=function(t){oc()&&t&&(t.stopPropagation(),t.preventDefault())},yh=function(){return ey(oc)},i6=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||J5(r,n)},a6=function(){return null},ny=function(){qa="just",setTimeout(function(){qa="meanwhile"},0)},s6=function(){document.addEventListener("focusin",ty),document.addEventListener("focusout",yh),window.addEventListener("blur",ny)},l6=function(){document.removeEventListener("focusin",ty),document.removeEventListener("focusout",yh),window.removeEventListener("blur",ny)};function c6(e){return e.filter(function(t){var n=t.disabled;return!n})}function u6(e){var t=e.slice(-1)[0];t&&!Vi&&s6();var n=Vi,r=n&&t&&t.id===n.id;Vi=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(Ri=null,(!r||n.observed!==t.observed)&&t.onActivation(),oc(),ey(oc)):(l6(),Ri=null)}R2.assignSyncMedium(i6);N2.assignMedium(yh);v5.assignMedium(function(e){return e({moveFocusInside:J2,focusInside:X2})});const d6=b5(c6,u6)(a6);var ry=g.forwardRef(function(t,n){return g.createElement(F2,Yd({sideCar:d6,ref:n},t))}),oy=F2.propTypes||{};oy.sideCar;wC(oy,["sideCar"]);ry.propTypes={};const ug=ry;function iy(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function ay(e){var t;if(!iy(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function f6(e){var t,n;return(n=(t=sy(e))==null?void 0:t.defaultView)!=null?n:window}function sy(e){return iy(e)?e.ownerDocument:document}function h6(e){return sy(e).activeElement}var ly=e=>e.hasAttribute("tabindex"),p6=e=>ly(e)&&e.tabIndex===-1;function m6(e){return Boolean(e.getAttribute("disabled"))===!0||Boolean(e.getAttribute("aria-disabled"))===!0}function cy(e){return e.parentElement&&cy(e.parentElement)?!0:e.hidden}function v6(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function uy(e){if(!ay(e)||cy(e)||m6(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]():v6(e)?!0:ly(e)}function g6(e){return e?ay(e)&&uy(e)&&!p6(e):!1}var y6=["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]"],x6=y6.join(),b6=e=>e.offsetWidth>0&&e.offsetHeight>0;function dy(e){const t=Array.from(e.querySelectorAll(x6));return t.unshift(e),t.filter(n=>uy(n)&&b6(n))}var dg,S6=(dg=ug.default)!=null?dg:ug,fy=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:c,autoFocus:u,persistentFocus:f,lockFocusAcrossFrames:p}=e,h=g.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&dy(r.current).length===0&&requestAnimationFrame(()=>{var C;(C=r.current)==null||C.focus()})},[t,r]),y=g.useCallback(()=>{var S;(S=n==null?void 0:n.current)==null||S.focus()},[n]),x=o&&!n;return l.jsx(S6,{crossFrame:p,persistentFocus:f,autoFocus:u,disabled:c,onActivation:h,onDeactivation:y,returnFocus:x,children:s})};fy.displayName="FocusLock";var C6=AC?g.useLayoutEffect:g.useEffect;function ic(e,t=[]){const n=g.useRef(e);return C6(()=>{n.current=e}),g.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function w6(e,t,n,r){const o=ic(t);return g.useEffect(()=>{var s;const c=(s=Ev(n))!=null?s:document;if(t)return c.addEventListener(e,o,r),()=>{c.removeEventListener(e,o,r)}},[e,n,r,o,t]),()=>{var s;((s=Ev(n))!=null?s:document).removeEventListener(e,o,r)}}function k6(e){const{ref:t,handler:n,enabled:r=!0}=e,o=ic(n),c=g.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;g.useEffect(()=>{if(!r)return;const u=y=>{bd(y,t)&&(c.isPointerDown=!0)},f=y=>{if(c.ignoreEmulatedMouseEvents){c.ignoreEmulatedMouseEvents=!1;return}c.isPointerDown&&n&&bd(y,t)&&(c.isPointerDown=!1,o(y))},p=y=>{c.ignoreEmulatedMouseEvents=!0,n&&c.isPointerDown&&bd(y,t)&&(c.isPointerDown=!1,o(y))},h=u2(t.current);return h.addEventListener("mousedown",u,!0),h.addEventListener("mouseup",f,!0),h.addEventListener("touchstart",u,!0),h.addEventListener("touchend",p,!0),()=>{h.removeEventListener("mousedown",u,!0),h.removeEventListener("mouseup",f,!0),h.removeEventListener("touchstart",u,!0),h.removeEventListener("touchend",p,!0)}},[n,t,o,c,r])}function bd(e,t){var n;const r=e.target;return e.button>0||r&&!u2(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function j6(e,t){const n=g.useId();return g.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function E6(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function ho(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=ic(n),c=ic(t),[u,f]=g.useState(e.defaultIsOpen||!1),[p,h]=E6(r,u),y=j6(o,"disclosure"),x=g.useCallback(()=>{p||f(!1),c==null||c()},[p,c]),S=g.useCallback(()=>{p||f(!0),s==null||s()},[p,s]),C=g.useCallback(()=>{(h?x:S)()},[h,S,x]);return{isOpen:!!h,onOpen:S,onClose:x,onToggle:C,isControlled:p,getButtonProps:(k={})=>({...k,"aria-expanded":h,"aria-controls":y,onClick:FS(k.onClick,C)}),getDisclosureProps:(k={})=>({...k,hidden:!h,id:y})}}var xh=fe(function(t,n){const{htmlSize:r,...o}=t,s=un("Input",o),c=At(o),u=ah(c),f=Ae("chakra-input",t.className);return l.jsx(re.input,{size:r,...u,__css:s.field,ref:n,className:f})});xh.displayName="Input";xh.id="Input";var[P6,hy]=jt({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),bh=fe(function(t,n){const r=un("List",t),{children:o,styleType:s="none",stylePosition:c,spacing:u,...f}=At(t),p=ih(o),y=u?{["& > *:not(style) ~ *:not(style)"]:{mt:u}}:{};return l.jsx(P6,{value:r,children:l.jsx(re.ul,{ref:n,listStyleType:s,listStylePosition:c,role:"list",__css:{...r.container,...y},...f,children:p})})});bh.displayName="List";var I6=fe((e,t)=>{const{as:n,...r}=e;return l.jsx(bh,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});I6.displayName="OrderedList";var py=fe(function(t,n){const{as:r,...o}=t;return l.jsx(bh,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});py.displayName="UnorderedList";var za=fe(function(t,n){const r=hy();return l.jsx(re.li,{ref:n,...t,__css:r.item})});za.displayName="ListItem";var M6=fe(function(t,n){const r=hy();return l.jsx(tn,{ref:n,role:"presentation",...t,__css:r.icon})});M6.displayName="ListIcon";var or=fe(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:c,column:u,row:f,autoFlow:p,autoRows:h,templateRows:y,autoColumns:x,templateColumns:S,...C}=t,k={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:c,gridAutoColumns:x,gridColumn:u,gridRow:f,gridAutoFlow:p,gridAutoRows:h,gridTemplateRows:y,gridTemplateColumns:S};return l.jsx(re.div,{ref:n,__css:k,...C})});or.displayName="Grid";function my(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):Kd(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var kc=re("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});kc.displayName="Spacer";var vy=e=>l.jsx(re.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});vy.displayName="StackItem";var Cf="& > *:not(style) ~ *:not(style)";function T6(e){const{spacing:t,direction:n}=e,r={column:{marginTop:t,marginEnd:0,marginBottom:0,marginStart:0},row:{marginTop:0,marginEnd:0,marginBottom:0,marginStart:t},"column-reverse":{marginTop:0,marginEnd:0,marginBottom:t,marginStart:0},"row-reverse":{marginTop:0,marginEnd:t,marginBottom:0,marginStart:0}};return{flexDirection:n,[Cf]:my(n,o=>r[o])}}function _6(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{"&":my(n,o=>r[o])}}var Sh=fe((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:c="0.5rem",wrap:u,children:f,divider:p,className:h,shouldWrapChildren:y,...x}=e,S=n?"row":r??"column",C=g.useMemo(()=>T6({direction:S,spacing:c}),[S,c]),k=g.useMemo(()=>_6({spacing:c,direction:S}),[c,S]),w=!!p,j=!y&&!w,I=g.useMemo(()=>{const M=ih(f);return j?M:M.map((T,D)=>{const _=typeof T.key<"u"?T.key:D,R=D+1===M.length,F=y?l.jsx(vy,{children:T},_):T;if(!w)return F;const L=g.cloneElement(p,{__css:k}),Q=R?null:L;return l.jsxs(g.Fragment,{children:[F,Q]},_)})},[p,k,w,j,y,f]),P=Ae("chakra-stack",h);return l.jsx(re.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:C.flexDirection,flexWrap:u,className:P,__css:w?{}:{[Cf]:C[Cf]},...x,children:I})});Sh.displayName="Stack";var ze=fe((e,t)=>l.jsx(Sh,{align:"center",...e,direction:"column",ref:t}));ze.displayName="VStack";var ra=fe((e,t)=>l.jsx(Sh,{align:"center",...e,direction:"row",ref:t}));ra.displayName="HStack";var Wn=fe(function(t,n){const r=go("Heading",t),{className:o,...s}=At(t);return l.jsx(re.h2,{ref:n,className:Ae("chakra-heading",t.className),...s,__css:r})});Wn.displayName="Heading";var Ye=re("div");Ye.displayName="Box";var gy=fe(function(t,n){const{size:r,centerContent:o=!0,...s}=t,c=o?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return l.jsx(Ye,{ref:n,boxSize:r,__css:{...c,flexShrink:0,flexGrow:0},...s})});gy.displayName="Square";var D6=fe(function(t,n){const{size:r,...o}=t;return l.jsx(gy,{size:r,ref:n,borderRadius:"9999px",...o})});D6.displayName="Circle";var Go=fe(function(t,n){const r=go("Link",t),{className:o,isExternal:s,...c}=At(t);return l.jsx(re.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:Ae("chakra-link",o),...c,__css:r})});Go.displayName="Link";var yy=fe(function(t,n){const r=go("Badge",t),{className:o,...s}=At(t);return l.jsx(re.span,{ref:n,className:Ae("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});yy.displayName="Badge";var xy=re("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center"}});xy.displayName="Center";var A6={horizontal:{insetStart:"50%",transform:"translateX(-50%)"},vertical:{top:"50%",transform:"translateY(-50%)"},both:{insetStart:"50%",top:"50%",transform:"translate(-50%, -50%)"}};fe(function(t,n){const{axis:r="both",...o}=t;return l.jsx(re.div,{ref:n,__css:A6[r],...o,position:"absolute"})});var by=fe(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:c,borderWidth:u,borderStyle:f,borderColor:p,...h}=go("Divider",t),{className:y,orientation:x="horizontal",__css:S,...C}=At(t),k={vertical:{borderLeftWidth:r||c||u||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||u||"1px",width:"100%"}};return l.jsx(re.hr,{ref:n,"aria-orientation":x,...C,__css:{...h,border:"0",borderColor:p,borderStyle:f,...k[x],...S},className:Ae("chakra-divider",y)})});by.displayName="Divider";function O6(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function z6(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=g.useState([]),s=g.useRef(),c=()=>{s.current&&(clearTimeout(s.current),s.current=null)},u=()=>{c(),s.current=setTimeout(()=>{o([]),s.current=null},t)};g.useEffect(()=>c,[]);function f(p){return h=>{if(h.key==="Backspace"){const y=[...r];y.pop(),o(y);return}if(O6(h)){const y=r.concat(h.key);n(h)&&(h.preventDefault(),h.stopPropagation()),o(y),p(y.join("")),u()}}}return f}function R6(e,t,n,r){if(t==null)return r;if(!r)return e.find(c=>n(c).toLowerCase().startsWith(t.toLowerCase()));const o=e.filter(s=>n(s).toLowerCase().startsWith(t.toLowerCase()));if(o.length>0){let s;return o.includes(r)?(s=o.indexOf(r)+1,s===o.length&&(s=0),o[s]):(s=e.indexOf(o[0]),e[s])}return r}function N6(){const e=g.useRef(new Map),t=e.current,n=g.useCallback((o,s,c,u)=>{e.current.set(c,{type:s,el:o,options:u}),o.addEventListener(s,c,u)},[]),r=g.useCallback((o,s,c,u)=>{o.removeEventListener(s,c,u),e.current.delete(c)},[]);return g.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function Sd(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function Sy(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:c,onMouseUp:u,onClick:f,onKeyDown:p,onKeyUp:h,tabIndex:y,onMouseOver:x,onMouseLeave:S,...C}=e,[k,w]=g.useState(!0),[j,I]=g.useState(!1),P=N6(),M=$=>{$&&$.tagName!=="BUTTON"&&w(!1)},T=k?y:y||0,D=n&&!r,_=g.useCallback($=>{if(n){$.stopPropagation(),$.preventDefault();return}$.currentTarget.focus(),f==null||f($)},[n,f]),R=g.useCallback($=>{j&&Sd($)&&($.preventDefault(),$.stopPropagation(),I(!1),P.remove(document,"keyup",R,!1))},[j,P]),V=g.useCallback($=>{if(p==null||p($),n||$.defaultPrevented||$.metaKey||!Sd($.nativeEvent)||k)return;const Z=o&&$.key==="Enter";s&&$.key===" "&&($.preventDefault(),I(!0)),Z&&($.preventDefault(),$.currentTarget.click()),P.add(document,"keyup",R,!1)},[n,k,p,o,s,P,R]),F=g.useCallback($=>{if(h==null||h($),n||$.defaultPrevented||$.metaKey||!Sd($.nativeEvent)||k)return;s&&$.key===" "&&($.preventDefault(),I(!1),$.currentTarget.click())},[s,k,n,h]),L=g.useCallback($=>{$.button===0&&(I(!1),P.remove(document,"mouseup",L,!1))},[P]),Q=g.useCallback($=>{if($.button!==0)return;if(n){$.stopPropagation(),$.preventDefault();return}k||I(!0),$.currentTarget.focus({preventScroll:!0}),P.add(document,"mouseup",L,!1),c==null||c($)},[n,k,c,P,L]),U=g.useCallback($=>{$.button===0&&(k||I(!1),u==null||u($))},[u,k]),K=g.useCallback($=>{if(n){$.preventDefault();return}x==null||x($)},[n,x]),te=g.useCallback($=>{j&&($.preventDefault(),I(!1)),S==null||S($)},[j,S]),ne=ct(t,M);return k?{...C,ref:ne,type:"button","aria-disabled":D?void 0:n,disabled:D,onClick:_,onMouseDown:c,onMouseUp:u,onKeyUp:h,onKeyDown:p,onMouseOver:x,onMouseLeave:S}:{...C,ref:ne,role:"button","data-active":qe(j),"aria-disabled":n?"true":void 0,tabIndex:D?void 0:T,onClick:_,onMouseDown:Q,onMouseUp:U,onKeyUp:F,onKeyDown:V,onMouseOver:K,onMouseLeave:te}}function F6(e){const t=e.current;if(!t)return!1;const n=h6(t);return!n||t.contains(n)?!1:!!g6(n)}function Cy(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;ei(()=>{if(!s||F6(e))return;const c=(o==null?void 0:o.current)||e.current;c&&requestAnimationFrame(()=>{c.focus()})},[s,e,o])}var L6={preventScroll:!0,shouldFocus:!1};function B6(e,t=L6){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,c=H6(e)?e.current:e,u=o&&s,f=g.useRef(u),p=g.useRef(s);Bi(()=>{!p.current&&s&&(f.current=u),p.current=s},[s,u]);const h=g.useCallback(()=>{if(!(!s||!c||!f.current)&&(f.current=!1,!c.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var y;(y=n.current)==null||y.focus({preventScroll:r})});else{const y=dy(c);y.length>0&&requestAnimationFrame(()=>{y[0].focus({preventScroll:r})})}},[s,r,c,n]);ei(()=>{h()},[h]),$o(c,"transitionend",h)}function H6(e){return"current"in e}var ki=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),Ht={arrowShadowColor:ki("--popper-arrow-shadow-color"),arrowSize:ki("--popper-arrow-size","8px"),arrowSizeHalf:ki("--popper-arrow-size-half"),arrowBg:ki("--popper-arrow-bg"),transformOrigin:ki("--popper-transform-origin"),arrowOffset:ki("--popper-arrow-offset")};function W6(e){if(e.includes("top"))return"1px 1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("bottom"))return"-1px -1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("right"))return"-1px 1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("left"))return"1px -1px 1px 0 var(--popper-arrow-shadow-color)"}var V6={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"},U6=e=>V6[e],fg={scroll:!0,resize:!0};function $6(e){let t;return typeof e=="object"?t={enabled:!0,options:{...fg,...e}}:t={enabled:e,options:fg},t}var G6={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`}},q6={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{hg(e)},effect:({state:e})=>()=>{hg(e)}},hg=e=>{e.elements.popper.style.setProperty(Ht.transformOrigin.var,U6(e.placement))},Y6={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{K6(e)}},K6=e=>{var t;if(!e.placement)return;const n=X6(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:Ht.arrowSize.varRef,height:Ht.arrowSize.varRef,zIndex:-1});const r={[Ht.arrowSizeHalf.var]:`calc(${Ht.arrowSize.varRef} / 2)`,[Ht.arrowOffset.var]:`calc(${Ht.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},X6=e=>{if(e.startsWith("top"))return{property:"bottom",value:Ht.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:Ht.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:Ht.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:Ht.arrowOffset.varRef}},Q6={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{pg(e)},effect:({state:e})=>()=>{pg(e)}},pg=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=W6(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:Ht.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},Z6={"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"}},J6={"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 ek(e,t="ltr"){var n,r;const o=((n=Z6[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=J6[e])!=null?r:o}var Pn="top",Un="bottom",$n="right",In="left",Ch="auto",us=[Pn,Un,$n,In],$i="start",Ya="end",tk="clippingParents",wy="viewport",Ta="popper",nk="reference",mg=us.reduce(function(e,t){return e.concat([t+"-"+$i,t+"-"+Ya])},[]),ky=[].concat(us,[Ch]).reduce(function(e,t){return e.concat([t,t+"-"+$i,t+"-"+Ya])},[]),rk="beforeRead",ok="read",ik="afterRead",ak="beforeMain",sk="main",lk="afterMain",ck="beforeWrite",uk="write",dk="afterWrite",fk=[rk,ok,ik,ak,sk,lk,ck,uk,dk];function kr(e){return e?(e.nodeName||"").toLowerCase():null}function Gn(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Xo(e){var t=Gn(e).Element;return e instanceof t||e instanceof Element}function Vn(e){var t=Gn(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function wh(e){if(typeof ShadowRoot>"u")return!1;var t=Gn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function hk(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];!Vn(s)||!kr(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(c){var u=o[c];u===!1?s.removeAttribute(c):s.setAttribute(c,u===!0?"":u)}))})}function pk(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],s=t.attributes[r]||{},c=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),u=c.reduce(function(f,p){return f[p]="",f},{});!Vn(o)||!kr(o)||(Object.assign(o.style,u),Object.keys(s).forEach(function(f){o.removeAttribute(f)}))})}}const mk={name:"applyStyles",enabled:!0,phase:"write",fn:hk,effect:pk,requires:["computeStyles"]};function Sr(e){return e.split("-")[0]}var qo=Math.max,ac=Math.min,Gi=Math.round;function wf(){var e=navigator.userAgentData;return e!=null&&e.brands?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function jy(){return!/^((?!chrome|android).)*safari/i.test(wf())}function qi(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&Vn(e)&&(o=e.offsetWidth>0&&Gi(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&Gi(r.height)/e.offsetHeight||1);var c=Xo(e)?Gn(e):window,u=c.visualViewport,f=!jy()&&n,p=(r.left+(f&&u?u.offsetLeft:0))/o,h=(r.top+(f&&u?u.offsetTop:0))/s,y=r.width/o,x=r.height/s;return{width:y,height:x,top:h,right:p+y,bottom:h+x,left:p,x:p,y:h}}function kh(e){var t=qi(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function Ey(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&wh(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Nr(e){return Gn(e).getComputedStyle(e)}function vk(e){return["table","td","th"].indexOf(kr(e))>=0}function xo(e){return((Xo(e)?e.ownerDocument:e.document)||window.document).documentElement}function jc(e){return kr(e)==="html"?e:e.assignedSlot||e.parentNode||(wh(e)?e.host:null)||xo(e)}function vg(e){return!Vn(e)||Nr(e).position==="fixed"?null:e.offsetParent}function gk(e){var t=/firefox/i.test(wf()),n=/Trident/i.test(wf());if(n&&Vn(e)){var r=Nr(e);if(r.position==="fixed")return null}var o=jc(e);for(wh(o)&&(o=o.host);Vn(o)&&["html","body"].indexOf(kr(o))<0;){var s=Nr(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 ds(e){for(var t=Gn(e),n=vg(e);n&&vk(n)&&Nr(n).position==="static";)n=vg(n);return n&&(kr(n)==="html"||kr(n)==="body"&&Nr(n).position==="static")?t:n||gk(e)||t}function jh(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Na(e,t,n){return qo(e,ac(t,n))}function yk(e,t,n){var r=Na(e,t,n);return r>n?n:r}function Py(){return{top:0,right:0,bottom:0,left:0}}function Iy(e){return Object.assign({},Py(),e)}function My(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var xk=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Iy(typeof t!="number"?t:My(t,us))};function bk(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,c=n.modifiersData.popperOffsets,u=Sr(n.placement),f=jh(u),p=[In,$n].indexOf(u)>=0,h=p?"height":"width";if(!(!s||!c)){var y=xk(o.padding,n),x=kh(s),S=f==="y"?Pn:In,C=f==="y"?Un:$n,k=n.rects.reference[h]+n.rects.reference[f]-c[f]-n.rects.popper[h],w=c[f]-n.rects.reference[f],j=ds(s),I=j?f==="y"?j.clientHeight||0:j.clientWidth||0:0,P=k/2-w/2,M=y[S],T=I-x[h]-y[C],D=I/2-x[h]/2+P,_=Na(M,D,T),R=f;n.modifiersData[r]=(t={},t[R]=_,t.centerOffset=_-D,t)}}function Sk(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)||Ey(t.elements.popper,o)&&(t.elements.arrow=o))}const Ck={name:"arrow",enabled:!0,phase:"main",fn:bk,effect:Sk,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Yi(e){return e.split("-")[1]}var wk={top:"auto",right:"auto",bottom:"auto",left:"auto"};function kk(e){var t=e.x,n=e.y,r=window,o=r.devicePixelRatio||1;return{x:Gi(t*o)/o||0,y:Gi(n*o)/o||0}}function gg(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,c=e.offsets,u=e.position,f=e.gpuAcceleration,p=e.adaptive,h=e.roundOffsets,y=e.isFixed,x=c.x,S=x===void 0?0:x,C=c.y,k=C===void 0?0:C,w=typeof h=="function"?h({x:S,y:k}):{x:S,y:k};S=w.x,k=w.y;var j=c.hasOwnProperty("x"),I=c.hasOwnProperty("y"),P=In,M=Pn,T=window;if(p){var D=ds(n),_="clientHeight",R="clientWidth";if(D===Gn(n)&&(D=xo(n),Nr(D).position!=="static"&&u==="absolute"&&(_="scrollHeight",R="scrollWidth")),D=D,o===Pn||(o===In||o===$n)&&s===Ya){M=Un;var V=y&&D===T&&T.visualViewport?T.visualViewport.height:D[_];k-=V-r.height,k*=f?1:-1}if(o===In||(o===Pn||o===Un)&&s===Ya){P=$n;var F=y&&D===T&&T.visualViewport?T.visualViewport.width:D[R];S-=F-r.width,S*=f?1:-1}}var L=Object.assign({position:u},p&&wk),Q=h===!0?kk({x:S,y:k}):{x:S,y:k};if(S=Q.x,k=Q.y,f){var U;return Object.assign({},L,(U={},U[M]=I?"0":"",U[P]=j?"0":"",U.transform=(T.devicePixelRatio||1)<=1?"translate("+S+"px, "+k+"px)":"translate3d("+S+"px, "+k+"px, 0)",U))}return Object.assign({},L,(t={},t[M]=I?k+"px":"",t[P]=j?S+"px":"",t.transform="",t))}function jk(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,c=s===void 0?!0:s,u=n.roundOffsets,f=u===void 0?!0:u,p={placement:Sr(t.placement),variation:Yi(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,gg(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:c,roundOffsets:f})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,gg(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const Ek={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:jk,data:{}};var bl={passive:!0};function Pk(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,c=r.resize,u=c===void 0?!0:c,f=Gn(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(h){h.addEventListener("scroll",n.update,bl)}),u&&f.addEventListener("resize",n.update,bl),function(){s&&p.forEach(function(h){h.removeEventListener("scroll",n.update,bl)}),u&&f.removeEventListener("resize",n.update,bl)}}const Ik={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Pk,data:{}};var Mk={left:"right",right:"left",bottom:"top",top:"bottom"};function Wl(e){return e.replace(/left|right|bottom|top/g,function(t){return Mk[t]})}var Tk={start:"end",end:"start"};function yg(e){return e.replace(/start|end/g,function(t){return Tk[t]})}function Eh(e){var t=Gn(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Ph(e){return qi(xo(e)).left+Eh(e).scrollLeft}function _k(e,t){var n=Gn(e),r=xo(e),o=n.visualViewport,s=r.clientWidth,c=r.clientHeight,u=0,f=0;if(o){s=o.width,c=o.height;var p=jy();(p||!p&&t==="fixed")&&(u=o.offsetLeft,f=o.offsetTop)}return{width:s,height:c,x:u+Ph(e),y:f}}function Dk(e){var t,n=xo(e),r=Eh(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=qo(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),c=qo(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),u=-r.scrollLeft+Ph(e),f=-r.scrollTop;return Nr(o||n).direction==="rtl"&&(u+=qo(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:c,x:u,y:f}}function Ih(e){var t=Nr(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function Ty(e){return["html","body","#document"].indexOf(kr(e))>=0?e.ownerDocument.body:Vn(e)&&Ih(e)?e:Ty(jc(e))}function Fa(e,t){var n;t===void 0&&(t=[]);var r=Ty(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Gn(r),c=o?[s].concat(s.visualViewport||[],Ih(r)?r:[]):r,u=t.concat(c);return o?u:u.concat(Fa(jc(c)))}function kf(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Ak(e,t){var n=qi(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function xg(e,t,n){return t===wy?kf(_k(e,n)):Xo(t)?Ak(t,n):kf(Dk(xo(e)))}function Ok(e){var t=Fa(jc(e)),n=["absolute","fixed"].indexOf(Nr(e).position)>=0,r=n&&Vn(e)?ds(e):e;return Xo(r)?t.filter(function(o){return Xo(o)&&Ey(o,r)&&kr(o)!=="body"}):[]}function zk(e,t,n,r){var o=t==="clippingParents"?Ok(e):[].concat(t),s=[].concat(o,[n]),c=s[0],u=s.reduce(function(f,p){var h=xg(e,p,r);return f.top=qo(h.top,f.top),f.right=ac(h.right,f.right),f.bottom=ac(h.bottom,f.bottom),f.left=qo(h.left,f.left),f},xg(e,c,r));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function _y(e){var t=e.reference,n=e.element,r=e.placement,o=r?Sr(r):null,s=r?Yi(r):null,c=t.x+t.width/2-n.width/2,u=t.y+t.height/2-n.height/2,f;switch(o){case Pn:f={x:c,y:t.y-n.height};break;case Un:f={x:c,y:t.y+t.height};break;case $n:f={x:t.x+t.width,y:u};break;case In:f={x:t.x-n.width,y:u};break;default:f={x:t.x,y:t.y}}var p=o?jh(o):null;if(p!=null){var h=p==="y"?"height":"width";switch(s){case $i:f[p]=f[p]-(t[h]/2-n[h]/2);break;case Ya:f[p]=f[p]+(t[h]/2-n[h]/2);break}}return f}function Ka(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,c=s===void 0?e.strategy:s,u=n.boundary,f=u===void 0?tk:u,p=n.rootBoundary,h=p===void 0?wy:p,y=n.elementContext,x=y===void 0?Ta:y,S=n.altBoundary,C=S===void 0?!1:S,k=n.padding,w=k===void 0?0:k,j=Iy(typeof w!="number"?w:My(w,us)),I=x===Ta?nk:Ta,P=e.rects.popper,M=e.elements[C?I:x],T=zk(Xo(M)?M:M.contextElement||xo(e.elements.popper),f,h,c),D=qi(e.elements.reference),_=_y({reference:D,element:P,strategy:"absolute",placement:o}),R=kf(Object.assign({},P,_)),V=x===Ta?R:D,F={top:T.top-V.top+j.top,bottom:V.bottom-T.bottom+j.bottom,left:T.left-V.left+j.left,right:V.right-T.right+j.right},L=e.modifiersData.offset;if(x===Ta&&L){var Q=L[o];Object.keys(F).forEach(function(U){var K=[$n,Un].indexOf(U)>=0?1:-1,te=[Pn,Un].indexOf(U)>=0?"y":"x";F[U]+=Q[te]*K})}return F}function Rk(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,c=n.padding,u=n.flipVariations,f=n.allowedAutoPlacements,p=f===void 0?ky:f,h=Yi(r),y=h?u?mg:mg.filter(function(C){return Yi(C)===h}):us,x=y.filter(function(C){return p.indexOf(C)>=0});x.length===0&&(x=y);var S=x.reduce(function(C,k){return C[k]=Ka(e,{placement:k,boundary:o,rootBoundary:s,padding:c})[Sr(k)],C},{});return Object.keys(S).sort(function(C,k){return S[C]-S[k]})}function Nk(e){if(Sr(e)===Ch)return[];var t=Wl(e);return[yg(e),t,yg(t)]}function Fk(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,c=n.altAxis,u=c===void 0?!0:c,f=n.fallbackPlacements,p=n.padding,h=n.boundary,y=n.rootBoundary,x=n.altBoundary,S=n.flipVariations,C=S===void 0?!0:S,k=n.allowedAutoPlacements,w=t.options.placement,j=Sr(w),I=j===w,P=f||(I||!C?[Wl(w)]:Nk(w)),M=[w].concat(P).reduce(function(pe,ce){return pe.concat(Sr(ce)===Ch?Rk(t,{placement:ce,boundary:h,rootBoundary:y,padding:p,flipVariations:C,allowedAutoPlacements:k}):ce)},[]),T=t.rects.reference,D=t.rects.popper,_=new Map,R=!0,V=M[0],F=0;F=0,te=K?"width":"height",ne=Ka(t,{placement:L,boundary:h,rootBoundary:y,altBoundary:x,padding:p}),$=K?U?$n:In:U?Un:Pn;T[te]>D[te]&&($=Wl($));var Z=Wl($),oe=[];if(s&&oe.push(ne[Q]<=0),u&&oe.push(ne[$]<=0,ne[Z]<=0),oe.every(function(pe){return pe})){V=L,R=!1;break}_.set(L,oe)}if(R)for(var le=C?3:1,Re=function(ce){var Fe=M.find(function(Ve){var Ue=_.get(Ve);if(Ue)return Ue.slice(0,ce).every(function($e){return $e})});if(Fe)return V=Fe,"break"},Ne=le;Ne>0;Ne--){var Ie=Re(Ne);if(Ie==="break")break}t.placement!==V&&(t.modifiersData[r]._skip=!0,t.placement=V,t.reset=!0)}}const Lk={name:"flip",enabled:!0,phase:"main",fn:Fk,requiresIfExists:["offset"],data:{_skip:!1}};function bg(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 Sg(e){return[Pn,$n,Un,In].some(function(t){return e[t]>=0})}function Bk(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,c=Ka(t,{elementContext:"reference"}),u=Ka(t,{altBoundary:!0}),f=bg(c,r),p=bg(u,o,s),h=Sg(f),y=Sg(p);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:p,isReferenceHidden:h,hasPopperEscaped:y},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":y})}const Hk={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Bk};function Wk(e,t,n){var r=Sr(e),o=[In,Pn].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,c=s[0],u=s[1];return c=c||0,u=(u||0)*o,[In,$n].indexOf(r)>=0?{x:u,y:c}:{x:c,y:u}}function Vk(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,c=ky.reduce(function(h,y){return h[y]=Wk(y,t.rects,s),h},{}),u=c[t.placement],f=u.x,p=u.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=c}const Uk={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Vk};function $k(e){var t=e.state,n=e.name;t.modifiersData[n]=_y({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Gk={name:"popperOffsets",enabled:!0,phase:"read",fn:$k,data:{}};function qk(e){return e==="x"?"y":"x"}function Yk(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,c=n.altAxis,u=c===void 0?!1:c,f=n.boundary,p=n.rootBoundary,h=n.altBoundary,y=n.padding,x=n.tether,S=x===void 0?!0:x,C=n.tetherOffset,k=C===void 0?0:C,w=Ka(t,{boundary:f,rootBoundary:p,padding:y,altBoundary:h}),j=Sr(t.placement),I=Yi(t.placement),P=!I,M=jh(j),T=qk(M),D=t.modifiersData.popperOffsets,_=t.rects.reference,R=t.rects.popper,V=typeof k=="function"?k(Object.assign({},t.rects,{placement:t.placement})):k,F=typeof V=="number"?{mainAxis:V,altAxis:V}:Object.assign({mainAxis:0,altAxis:0},V),L=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,Q={x:0,y:0};if(D){if(s){var U,K=M==="y"?Pn:In,te=M==="y"?Un:$n,ne=M==="y"?"height":"width",$=D[M],Z=$+w[K],oe=$-w[te],le=S?-R[ne]/2:0,Re=I===$i?_[ne]:R[ne],Ne=I===$i?-R[ne]:-_[ne],Ie=t.elements.arrow,pe=S&&Ie?kh(Ie):{width:0,height:0},ce=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Py(),Fe=ce[K],Ve=ce[te],Ue=Na(0,_[ne],pe[ne]),$e=P?_[ne]/2-le-Ue-Fe-F.mainAxis:Re-Ue-Fe-F.mainAxis,Qe=P?-_[ne]/2+le+Ue+Ve+F.mainAxis:Ne+Ue+Ve+F.mainAxis,ge=t.elements.arrow&&ds(t.elements.arrow),Te=ge?M==="y"?ge.clientTop||0:ge.clientLeft||0:0,Ge=(U=L==null?void 0:L[M])!=null?U:0,ye=$+$e-Ge-Te,Pe=$+Qe-Ge,et=Na(S?ac(Z,ye):Z,$,S?qo(oe,Pe):oe);D[M]=et,Q[M]=et-$}if(u){var Be,vt=M==="x"?Pn:In,Rt=M==="x"?Un:$n,N=D[T],ue=T==="y"?"height":"width",xe=N+w[vt],ke=N-w[Rt],q=[Pn,In].indexOf(j)!==-1,ae=(Be=L==null?void 0:L[T])!=null?Be:0,Oe=q?xe:N-_[ue]-R[ue]-ae+F.altAxis,Ze=q?N+_[ue]+R[ue]-ae-F.altAxis:ke,J=S&&q?yk(Oe,N,Ze):Na(S?Oe:xe,N,S?Ze:ke);D[T]=J,Q[T]=J-N}t.modifiersData[r]=Q}}const Kk={name:"preventOverflow",enabled:!0,phase:"main",fn:Yk,requiresIfExists:["offset"]};function Xk(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Qk(e){return e===Gn(e)||!Vn(e)?Eh(e):Xk(e)}function Zk(e){var t=e.getBoundingClientRect(),n=Gi(t.width)/e.offsetWidth||1,r=Gi(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Jk(e,t,n){n===void 0&&(n=!1);var r=Vn(t),o=Vn(t)&&Zk(t),s=xo(t),c=qi(e,o,n),u={scrollLeft:0,scrollTop:0},f={x:0,y:0};return(r||!r&&!n)&&((kr(t)!=="body"||Ih(s))&&(u=Qk(t)),Vn(t)?(f=qi(t,!0),f.x+=t.clientLeft,f.y+=t.clientTop):s&&(f.x=Ph(s))),{x:c.left+u.scrollLeft-f.x,y:c.top+u.scrollTop-f.y,width:c.width,height:c.height}}function ej(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var c=[].concat(s.requires||[],s.requiresIfExists||[]);c.forEach(function(u){if(!n.has(u)){var f=t.get(u);f&&o(f)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function tj(e){var t=ej(e);return fk.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function nj(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function rj(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 Cg={placement:"bottom",modifiers:[],strategy:"absolute"};function wg(){for(var e=arguments.length,t=new Array(e),n=0;n{}),P=g.useCallback(()=>{var F;!t||!C.current||!k.current||((F=I.current)==null||F.call(I),w.current=aj(C.current,k.current,{placement:j,modifiers:[Q6,Y6,q6,{...G6,enabled:!!x},{name:"eventListeners",...$6(c)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:u??[0,f]}},{name:"flip",enabled:!!p,options:{padding:8}},{name:"preventOverflow",enabled:!!y,options:{boundary:h}},...n??[]],strategy:o}),w.current.forceUpdate(),I.current=w.current.destroy)},[j,t,n,x,c,s,u,f,p,y,h,o]);g.useEffect(()=>()=>{var F;!C.current&&!k.current&&((F=w.current)==null||F.destroy(),w.current=null)},[]);const M=g.useCallback(F=>{C.current=F,P()},[P]),T=g.useCallback((F={},L=null)=>({...F,ref:ct(M,L)}),[M]),D=g.useCallback(F=>{k.current=F,P()},[P]),_=g.useCallback((F={},L=null)=>({...F,ref:ct(D,L),style:{...F.style,position:o,minWidth:x?void 0:"max-content",inset:"0 auto auto 0"}}),[o,D,x]),R=g.useCallback((F={},L=null)=>{const{size:Q,shadowColor:U,bg:K,style:te,...ne}=F;return{...ne,ref:L,"data-popper-arrow":"",style:sj(F)}},[]),V=g.useCallback((F={},L=null)=>({...F,ref:L,"data-popper-arrow-inner":""}),[]);return{update(){var F;(F=w.current)==null||F.update()},forceUpdate(){var F;(F=w.current)==null||F.forceUpdate()},transformOrigin:Ht.transformOrigin.varRef,referenceRef:M,popperRef:D,getPopperProps:_,getArrowProps:R,getArrowInnerProps:V,getReferenceProps:T}}function sj(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 Th(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=Wt(n),c=Wt(t),[u,f]=g.useState(e.defaultIsOpen||!1),p=r!==void 0?r:u,h=r!==void 0,y=g.useId(),x=o??`disclosure-${y}`,S=g.useCallback(()=>{h||f(!1),c==null||c()},[h,c]),C=g.useCallback(()=>{h||f(!0),s==null||s()},[h,s]),k=g.useCallback(()=>{p?S():C()},[p,C,S]);function w(I={}){return{...I,"aria-expanded":p,"aria-controls":x,onClick(P){var M;(M=I.onClick)==null||M.call(I,P),k()}}}function j(I={}){return{...I,hidden:!p,id:x}}return{isOpen:p,onOpen:C,onClose:S,onToggle:k,isControlled:h,getButtonProps:w,getDisclosureProps:j}}function lj(e){const{ref:t,handler:n,enabled:r=!0}=e,o=Wt(n),c=g.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;g.useEffect(()=>{if(!r)return;const u=y=>{Cd(y,t)&&(c.isPointerDown=!0)},f=y=>{if(c.ignoreEmulatedMouseEvents){c.ignoreEmulatedMouseEvents=!1;return}c.isPointerDown&&n&&Cd(y,t)&&(c.isPointerDown=!1,o(y))},p=y=>{c.ignoreEmulatedMouseEvents=!0,n&&c.isPointerDown&&Cd(y,t)&&(c.isPointerDown=!1,o(y))},h=Dy(t.current);return h.addEventListener("mousedown",u,!0),h.addEventListener("mouseup",f,!0),h.addEventListener("touchstart",u,!0),h.addEventListener("touchend",p,!0),()=>{h.removeEventListener("mousedown",u,!0),h.removeEventListener("mouseup",f,!0),h.removeEventListener("touchstart",u,!0),h.removeEventListener("touchend",p,!0)}},[n,t,o,c,r])}function Cd(e,t){var n;const r=e.target;return e.button>0||r&&!Dy(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function Dy(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Ay(e){const{isOpen:t,ref:n}=e,[r,o]=g.useState(t),[s,c]=g.useState(!1);return g.useEffect(()=>{s||(o(t),c(!0))},[t,s,r]),$o(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var f;const p=f6(n.current),h=new p.CustomEvent("animationend",{bubbles:!0});(f=n.current)==null||f.dispatchEvent(h)}}}function _h(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[cj,uj,dj,fj]=eh(),[hj,fs]=jt({strict:!1,name:"MenuContext"});function pj(e,...t){const n=g.useId(),r=e||n;return g.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function Oy(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function kg(e){return Oy(e).activeElement===e}function mj(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:c,isOpen:u,defaultIsOpen:f,onClose:p,onOpen:h,placement:y="bottom-start",lazyBehavior:x="unmount",direction:S,computePositionOnMount:C=!1,...k}=e,w=g.useRef(null),j=g.useRef(null),I=dj(),P=g.useCallback(()=>{requestAnimationFrame(()=>{var Ie;(Ie=w.current)==null||Ie.focus({preventScroll:!1})})},[]),M=g.useCallback(()=>{const Ie=setTimeout(()=>{var pe;if(o)(pe=o.current)==null||pe.focus();else{const ce=I.firstEnabled();ce&&U(ce.index)}});Z.current.add(Ie)},[I,o]),T=g.useCallback(()=>{const Ie=setTimeout(()=>{const pe=I.lastEnabled();pe&&U(pe.index)});Z.current.add(Ie)},[I]),D=g.useCallback(()=>{h==null||h(),s?M():P()},[s,M,P,h]),{isOpen:_,onOpen:R,onClose:V,onToggle:F}=Th({isOpen:u,defaultIsOpen:f,onClose:p,onOpen:D});lj({enabled:_&&r,ref:w,handler:Ie=>{var pe;(pe=j.current)!=null&&pe.contains(Ie.target)||V()}});const L=Mh({...k,enabled:_||C,placement:y,direction:S}),[Q,U]=g.useState(-1);ei(()=>{_||U(-1)},[_]),Cy(w,{focusRef:j,visible:_,shouldFocus:!0});const K=Ay({isOpen:_,ref:w}),[te,ne]=pj(t,"menu-button","menu-list"),$=g.useCallback(()=>{R(),P()},[R,P]),Z=g.useRef(new Set([]));Cj(()=>{Z.current.forEach(Ie=>clearTimeout(Ie)),Z.current.clear()});const oe=g.useCallback(()=>{R(),M()},[M,R]),le=g.useCallback(()=>{R(),T()},[R,T]),Re=g.useCallback(()=>{var Ie,pe;const ce=Oy(w.current),Fe=(Ie=w.current)==null?void 0:Ie.contains(ce.activeElement);if(!(_&&!Fe))return;const Ue=(pe=I.item(Q))==null?void 0:pe.node;Ue==null||Ue.focus()},[_,Q,I]),Ne=g.useRef(null);return{openAndFocusMenu:$,openAndFocusFirstItem:oe,openAndFocusLastItem:le,onTransitionEnd:Re,unstable__animationState:K,descendants:I,popper:L,buttonId:te,menuId:ne,forceUpdate:L.forceUpdate,orientation:"vertical",isOpen:_,onToggle:F,onOpen:R,onClose:V,menuRef:w,buttonRef:j,focusedIndex:Q,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:U,isLazy:c,lazyBehavior:x,initialFocusRef:o,rafId:Ne}}function vj(e={},t=null){const n=fs(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:c}=n,u=g.useCallback(f=>{const p=f.key,y={Enter:s,ArrowDown:s,ArrowUp:c}[p];y&&(f.preventDefault(),f.stopPropagation(),y(f))},[s,c]);return{...e,ref:ct(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":qe(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:Ee(e.onClick,r),onKeyDown:Ee(e.onKeyDown,u)}}function jf(e){var t;return bj(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function gj(e={},t=null){const n=fs();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:c,onClose:u,menuId:f,isLazy:p,lazyBehavior:h,unstable__animationState:y}=n,x=uj(),S=z6({preventDefault:j=>j.key!==" "&&jf(j.target)}),C=g.useCallback(j=>{const I=j.key,M={Tab:D=>D.preventDefault(),Escape:u,ArrowDown:()=>{const D=x.nextEnabled(r);D&&o(D.index)},ArrowUp:()=>{const D=x.prevEnabled(r);D&&o(D.index)}}[I];if(M){j.preventDefault(),M(j);return}const T=S(D=>{const _=R6(x.values(),D,R=>{var V,F;return(F=(V=R==null?void 0:R.node)==null?void 0:V.textContent)!=null?F:""},x.item(r));if(_){const R=x.indexOf(_.node);o(R)}});jf(j.target)&&T(j)},[x,r,S,u,o]),k=g.useRef(!1);c&&(k.current=!0);const w=_h({wasSelected:k.current,enabled:p,mode:h,isSelected:y.present});return{...e,ref:ct(s,t),children:w?e.children:null,tabIndex:-1,role:"menu",id:f,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:Ee(e.onKeyDown,C)}}function yj(e={}){const{popper:t,isOpen:n}=fs();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function xj(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:c,isDisabled:u,isFocusable:f,closeOnSelect:p,type:h,...y}=e,x=fs(),{setFocusedIndex:S,focusedIndex:C,closeOnSelect:k,onClose:w,menuRef:j,isOpen:I,menuId:P,rafId:M}=x,T=g.useRef(null),D=`${P}-menuitem-${g.useId()}`,{index:_,register:R}=fj({disabled:u&&!f}),V=g.useCallback($=>{n==null||n($),!u&&S(_)},[S,_,u,n]),F=g.useCallback($=>{r==null||r($),T.current&&!kg(T.current)&&V($)},[V,r]),L=g.useCallback($=>{o==null||o($),!u&&S(-1)},[S,u,o]),Q=g.useCallback($=>{s==null||s($),jf($.currentTarget)&&(p??k)&&w()},[w,s,k,p]),U=g.useCallback($=>{c==null||c($),S(_)},[S,c,_]),K=_===C,te=u&&!f;ei(()=>{I&&(K&&!te&&T.current?(M.current&&cancelAnimationFrame(M.current),M.current=requestAnimationFrame(()=>{var $;($=T.current)==null||$.focus(),M.current=null})):j.current&&!kg(j.current)&&j.current.focus())},[K,te,j,I]);const ne=Sy({onClick:Q,onFocus:U,onMouseEnter:V,onMouseMove:F,onMouseLeave:L,ref:ct(R,T,t),isDisabled:u,isFocusable:f});return{...y,...ne,type:h??ne.type,id:D,role:"menuitem",tabIndex:K?0:-1}}function bj(e){var t;if(!Sj(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function Sj(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Cj(e,t=[]){return g.useEffect(()=>()=>e(),t)}var[wj,Ec]=jt({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Dh=e=>{const{children:t}=e,n=un("Menu",e),r=At(e),{direction:o}=ea(),{descendants:s,...c}=mj({...r,direction:o}),u=g.useMemo(()=>c,[c]),{isOpen:f,onClose:p,forceUpdate:h}=u;return l.jsx(cj,{value:s,children:l.jsx(hj,{value:u,children:l.jsx(wj,{value:n,children:y1(t,{isOpen:f,onClose:p,forceUpdate:h})})})})};Dh.displayName="Menu";var zy=fe((e,t)=>{const n=Ec();return l.jsx(re.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});zy.displayName="MenuCommand";var kj=fe((e,t)=>{const{type:n,...r}=e,o=Ec(),s=r.as||n?n??void 0:"button",c=g.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...o.item}),[o.item]);return l.jsx(re.button,{ref:t,type:s,...r,__css:c})}),Ry=e=>{const{className:t,children:n,...r}=e,o=g.Children.only(n),s=g.isValidElement(o)?g.cloneElement(o,{focusable:"false","aria-hidden":!0,className:Ae("chakra-menu__icon",o.props.className)}):null,c=Ae("chakra-menu__icon-wrapper",t);return l.jsx(re.span,{className:c,...r,__css:{flexShrink:0},children:s})};Ry.displayName="MenuIcon";var vr=fe((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:c,...u}=e,f=xj(u,t),h=n||o?l.jsx("span",{style:{pointerEvents:"none",flex:1},children:c}):c;return l.jsxs(kj,{...f,className:Ae("chakra-menu__menuitem",f.className),children:[n&&l.jsx(Ry,{fontSize:"0.8em",marginEnd:r,children:n}),h,o&&l.jsx(zy,{marginStart:s,children:o})]})});vr.displayName="MenuItem";var jj={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"}}},Ej=re(ir.div),Ah=fe(function(t,n){var r,o;const{rootProps:s,motionProps:c,...u}=t,{isOpen:f,onTransitionEnd:p,unstable__animationState:h}=fs(),y=gj(u,n),x=yj(s),S=Ec();return l.jsx(re.div,{...x,__css:{zIndex:(o=t.zIndex)!=null?o:(r=S.list)==null?void 0:r.zIndex},children:l.jsx(Ej,{variants:jj,initial:!1,animate:f?"enter":"exit",__css:{outline:0,...S.list},...c,className:Ae("chakra-menu__menu-list",y.className),...y,onUpdate:p,onAnimationComplete:yc(h.onComplete,y.onAnimationComplete)})})});Ah.displayName="MenuList";var Pj=fe((e,t)=>{const n=Ec();return l.jsx(re.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),Oh=fe((e,t)=>{const{children:n,as:r,...o}=e,s=vj(o,t),c=r||Pj;return l.jsx(c,{...s,className:Ae("chakra-menu__menu-button",e.className),children:l.jsx(re.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});Oh.displayName="MenuButton";var Ij={slideInBottom:{...ff,custom:{offsetY:16,reverse:!0}},slideInRight:{...ff,custom:{offsetX:16,reverse:!0}},scale:{...g2,custom:{initialScale:.95,reverse:!0}},none:{}},Mj=re(ir.section),Tj=e=>Ij[e||"none"],Ny=g.forwardRef((e,t)=>{const{preset:n,motionProps:r=Tj(n),...o}=e;return l.jsx(Mj,{ref:t,...r,...o})});Ny.displayName="ModalTransition";var _j=Object.defineProperty,Dj=(e,t,n)=>t in e?_j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Aj=(e,t,n)=>(Dj(e,typeof t!="symbol"?t+"":t,n),n),Oj=class{constructor(){Aj(this,"modals"),this.modals=new Map}add(e){return this.modals.set(e,this.modals.size+1),this.modals.size}remove(e){this.modals.delete(e)}isTopModal(e){return e?this.modals.get(e)===this.modals.size:!1}},Ef=new Oj;function Fy(e,t){const[n,r]=g.useState(0);return g.useEffect(()=>{const o=e.current;if(o){if(t){const s=Ef.add(o);r(s)}return()=>{Ef.remove(o),r(0)}}},[t,e]),n}var zj=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ji=new WeakMap,Sl=new WeakMap,Cl={},wd=0,Ly=function(e){return e&&(e.host||Ly(e.parentNode))},Rj=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Ly(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return Boolean(n)})},Nj=function(e,t,n,r){var o=Rj(t,Array.isArray(e)?e:[e]);Cl[n]||(Cl[n]=new WeakMap);var s=Cl[n],c=[],u=new Set,f=new Set(o),p=function(y){!y||u.has(y)||(u.add(y),p(y.parentNode))};o.forEach(p);var h=function(y){!y||f.has(y)||Array.prototype.forEach.call(y.children,function(x){if(u.has(x))h(x);else{var S=x.getAttribute(r),C=S!==null&&S!=="false",k=(ji.get(x)||0)+1,w=(s.get(x)||0)+1;ji.set(x,k),s.set(x,w),c.push(x),k===1&&C&&Sl.set(x,!0),w===1&&x.setAttribute(n,"true"),C||x.setAttribute(r,"true")}})};return h(t),u.clear(),wd++,function(){c.forEach(function(y){var x=ji.get(y)-1,S=s.get(y)-1;ji.set(y,x),s.set(y,S),x||(Sl.has(y)||y.removeAttribute(r),Sl.delete(y)),S||y.removeAttribute(n)}),wd--,wd||(ji=new WeakMap,ji=new WeakMap,Sl=new WeakMap,Cl={})}},Fj=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||zj(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),Nj(r,o,n,"aria-hidden")):function(){return null}};function Lj(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:c=!0,onOverlayClick:u,onEsc:f}=e,p=g.useRef(null),h=g.useRef(null),[y,x,S]=Hj(r,"chakra-modal","chakra-modal--header","chakra-modal--body");Bj(p,t&&c),Fy(p,t);const C=g.useRef(null),k=g.useCallback(R=>{C.current=R.target},[]),w=g.useCallback(R=>{R.key==="Escape"&&(R.stopPropagation(),s&&(n==null||n()),f==null||f())},[s,n,f]),[j,I]=g.useState(!1),[P,M]=g.useState(!1),T=g.useCallback((R={},V=null)=>({role:"dialog",...R,ref:ct(V,p),id:y,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?x:void 0,"aria-describedby":P?S:void 0,onClick:Ee(R.onClick,F=>F.stopPropagation())}),[S,P,y,x,j]),D=g.useCallback(R=>{R.stopPropagation(),C.current===R.target&&Ef.isTopModal(p.current)&&(o&&(n==null||n()),u==null||u())},[n,o,u]),_=g.useCallback((R={},V=null)=>({...R,ref:ct(V,h),onClick:Ee(R.onClick,D),onKeyDown:Ee(R.onKeyDown,w),onMouseDown:Ee(R.onMouseDown,k)}),[w,k,D]);return{isOpen:t,onClose:n,headerId:x,bodyId:S,setBodyMounted:M,setHeaderMounted:I,dialogRef:p,overlayRef:h,getDialogProps:T,getDialogContainerProps:_}}function Bj(e,t){const n=e.current;g.useEffect(()=>{if(!(!e.current||!t))return Fj(e.current)},[t,e,n])}function Hj(e,...t){const n=g.useId(),r=e||n;return g.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[Wj,oa]=jt({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Vj,Qo]=jt({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),po=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:n,children:r,autoFocus:o,trapFocus:s,initialFocusRef:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:y,motionPreset:x,lockFocusAcrossFrames:S,onCloseComplete:C}=t,k=un("Modal",t),j={...Lj(t),autoFocus:o,trapFocus:s,initialFocusRef:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:y,motionPreset:x,lockFocusAcrossFrames:S};return l.jsx(Vj,{value:j,children:l.jsx(Wj,{value:k,children:l.jsx(yo,{onExitComplete:C,children:j.isOpen&&l.jsx(Ua,{...n,children:r})})})})};po.displayName="Modal";var Vl="right-scroll-bar-position",Ul="width-before-scroll-bar",Uj="with-scroll-bars-hidden",$j="--removed-body-scroll-bar-size",By=O2(),kd=function(){},Pc=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:kd,onWheelCapture:kd,onTouchMoveCapture:kd}),o=r[0],s=r[1],c=e.forwardProps,u=e.children,f=e.className,p=e.removeScrollBar,h=e.enabled,y=e.shards,x=e.sideCar,S=e.noIsolation,C=e.inert,k=e.allowPinchZoom,w=e.as,j=w===void 0?"div":w,I=_2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),P=x,M=T2([n,t]),T=yr(yr({},I),o);return g.createElement(g.Fragment,null,h&&g.createElement(P,{sideCar:By,removeScrollBar:p,shards:y,noIsolation:S,inert:C,setCallbacks:s,allowPinchZoom:!!k,lockRef:n}),c?g.cloneElement(g.Children.only(u),yr(yr({},T),{ref:M})):g.createElement(j,yr({},T,{className:f,ref:M}),u))});Pc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Pc.classNames={fullWidth:Ul,zeroRight:Vl};var jg,Gj=function(){if(jg)return jg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qj(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Gj();return t&&e.setAttribute("nonce",t),e}function Yj(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Kj(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Xj=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qj())&&(Yj(t,n),Kj(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Qj=function(){var e=Xj();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Hy=function(){var e=Qj(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Zj={left:0,top:0,right:0,gap:0},jd=function(e){return parseInt(e||"",10)||0},Jj=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[jd(n),jd(r),jd(o)]},e7=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Zj;var t=Jj(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])}},t7=Hy(),n7=function(e,t,n,r){var o=e.left,s=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),` .`.concat(Uj,` { overflow: hidden `).concat(r,`; @@ -185,4 +185,4 @@ For more info see: https://github.com/konvajs/react-konva/issues/194 .transform-component-module_content__uCDPE img { pointer-events: none; } -`,g1={wrapper:"transform-component-module_wrapper__7HFJe",content:"transform-component-module_content__uCDPE"};$F(GF);var qF=function(e){var t=e.children,n=e.wrapperClass,r=n===void 0?"":n,o=e.contentClass,s=o===void 0?"":o,c=e.wrapperStyle,u=e.contentStyle,f=e.wrapperProps,p=f===void 0?{}:f,h=e.contentProps,y=h===void 0?{}:h,x=g.useContext(qc).init,S=g.useRef(null),C=g.useRef(null);return g.useEffect(function(){var k=S.current,w=C.current;k!==null&&w!==null&&x&&x(k,w)},[]),Me.createElement("div",uo({},p,{ref:S,className:"react-transform-wrapper ".concat(g1.wrapper," ").concat(r),style:c}),Me.createElement("div",uo({},y,{ref:C,className:"react-transform-component ".concat(g1.content," ").concat(s),style:u}),t))},Sb=function(){var e=g.useContext(qc),t=g.useState(dt(e||{})),n=t[0],r=t[1];if(!e)throw new Error("Transform context mus be placed inside TransformWrapper");return g.useEffect(function(){e.onChange(function(o){r(o)})},[e]),n};Me.forwardRef(function(e,t){var n=g.useRef(null),r=g.useContext(qc);return g.useEffect(function(){return r.onChange(function(o){if(n.current){var s=0,c=0;n.current.style.transform=r.handleTransformStyles(s,c,1/o.state.scale)}})},[r]),Me.createElement("div",uo({},e,{ref:SF([n,t])}))});const YF=()=>{const[e,t]=g.useState(0),[n,r]=g.useState(1),[o,s]=g.useState(1);return{rotation:e,scaleX:n,scaleY:o,flipHorizontally:()=>{r(n*-1)},flipVertically:()=>{s(o*-1)},rotateCounterClockwise:()=>{t(e===-270?0:e-90)},rotateClockwise:()=>{t(e===270?0:e+90)},reset:()=>{t(0),r(1),s(1)}}},KF=({flipHorizontally:e,flipVertically:t,rotateCounterClockwise:n,rotateClockwise:r,reset:o})=>{const{zoomIn:s,zoomOut:c,resetTransform:u}=Sb(),{t:f}=X();return l.jsxs(Qt,{isAttached:!0,orientation:"vertical",children:[l.jsx(se,{icon:l.jsx(dD,{}),"aria-label":f("accessibility.zoomIn"),tooltip:"Zoom In",onClick:()=>s(),fontSize:20}),l.jsx(se,{icon:l.jsx(fD,{}),"aria-label":f("accessibility.zoomOut"),tooltip:"Zoom Out",onClick:()=>c(),fontSize:20}),l.jsx(se,{icon:l.jsx(cD,{}),"aria-label":f("accessibility.rotateCounterClockwise"),tooltip:"Rotate Counter-Clockwise",onClick:n,fontSize:20}),l.jsx(se,{icon:l.jsx(uD,{}),"aria-label":f("accessibility.rotateClockwise"),tooltip:"Rotate Clockwise",onClick:r,fontSize:20}),l.jsx(se,{icon:l.jsx(B0,{}),"aria-label":f("accessibility.flipHorizontally"),tooltip:"Flip Horizontally",onClick:e,fontSize:20}),l.jsx(se,{icon:l.jsx(B0,{style:{transform:"rotate(90deg)"}}),"aria-label":f("accessibility.flipVertically"),tooltip:"Flip Vertically",onClick:t,fontSize:20}),l.jsx(se,{icon:l.jsx(up,{}),"aria-label":f("accessibility.reset"),tooltip:"Reset",onClick:()=>{u(),o()},fontSize:20})]})};function XF({image:e,alt:t,ref:n,styleClass:r,rotation:o,scaleX:s,scaleY:c}){const{centerView:u}=Sb();return l.jsx(qF,{wrapperStyle:{width:"100%",height:"100%"},children:l.jsx("img",{style:{transform:`rotate(${o}deg) scaleX(${s}) scaleY(${c})`,width:"100%"},src:e.url,alt:t,ref:n,className:r||"",onLoad:()=>u(1,0,"easeOut")})})}const QF=me([Gr,Er],(e,t)=>{const{currentImage:n}=e,{shouldShowImageDetails:r}=t;return{viewerImageToDisplay:n,shouldShowImageDetails:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function ZF(){const e=Y(),t=A(x=>x.lightbox.isLightboxOpen),{rotation:n,scaleX:r,scaleY:o,flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:p}=YF(),{viewerImageToDisplay:h,shouldShowImageDetails:y}=A(QF);return de("Esc",()=>{t&&e(Vo(!1))},[t]),l.jsx(yo,{children:t&&l.jsx(ir.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,ease:"easeInOut"},style:{display:"flex",width:"100vw",height:`calc(100vh - ${dc*4}px)`,position:"fixed",top:`${dc*4}px`,background:"var(--invokeai-colors-base-900)",zIndex:99},children:l.jsxs(UF,{centerOnInit:!0,minScale:.1,initialPositionX:50,initialPositionY:50,children:[l.jsxs(B,{sx:{flexDir:"column",position:"absolute",insetInlineStart:4,gap:4,zIndex:3,top:4},children:[l.jsx(se,{icon:l.jsx(lD,{}),"aria-label":"Exit Viewer",className:"lightbox-close-btn",onClick:()=>{e(Vo(!1))},fontSize:20}),l.jsx(KF,{flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:p})]}),l.jsx(B,{sx:{position:"absolute",top:4,zIndex:3,insetInlineStart:"50%",transform:"translate(-50%, 0)"},children:l.jsx(D4,{})}),h&&l.jsxs(l.Fragment,{children:[l.jsx(XF,{rotation:n,scaleX:r,scaleY:o,image:h,styleClass:"lightbox-image"}),y&&l.jsx(yp,{image:h}),!y&&l.jsx(Ye,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"100vw",h:"100vh",px:16,pointerEvents:"none"},children:l.jsx(A4,{})})]})]})},"lightbox")})}jN();const rL=()=>{EN();const e=A(n=>n.ui.currentTheme),{setColorMode:t}=yC();return g.useEffect(()=>{t(["light"].includes(e)?"light":"dark")},[t,e]),l.jsxs(or,{w:"100vw",h:"100vh",children:[l.jsx(ZF,{}),l.jsxs(o9,{children:[l.jsx(rP,{}),l.jsxs(or,{gap:4,p:4,gridAutoRows:"min-content auto",w:Z9,h:J9,children:[l.jsx(P4,{}),l.jsxs(B,{gap:4,w:"full",h:"full",children:[l.jsx(kN,{}),l.jsx(zN,{})]})]}),l.jsx(Ye,{children:l.jsx(X9,{})})]}),l.jsx(Ua,{children:l.jsx(TN,{})}),l.jsx(Ua,{children:l.jsx(IN,{})})]})};export{rL as default}; +`,g1={wrapper:"transform-component-module_wrapper__7HFJe",content:"transform-component-module_content__uCDPE"};$F(GF);var qF=function(e){var t=e.children,n=e.wrapperClass,r=n===void 0?"":n,o=e.contentClass,s=o===void 0?"":o,c=e.wrapperStyle,u=e.contentStyle,f=e.wrapperProps,p=f===void 0?{}:f,h=e.contentProps,y=h===void 0?{}:h,x=g.useContext(qc).init,S=g.useRef(null),C=g.useRef(null);return g.useEffect(function(){var k=S.current,w=C.current;k!==null&&w!==null&&x&&x(k,w)},[]),Me.createElement("div",uo({},p,{ref:S,className:"react-transform-wrapper ".concat(g1.wrapper," ").concat(r),style:c}),Me.createElement("div",uo({},y,{ref:C,className:"react-transform-component ".concat(g1.content," ").concat(s),style:u}),t))},Sb=function(){var e=g.useContext(qc),t=g.useState(dt(e||{})),n=t[0],r=t[1];if(!e)throw new Error("Transform context mus be placed inside TransformWrapper");return g.useEffect(function(){e.onChange(function(o){r(o)})},[e]),n};Me.forwardRef(function(e,t){var n=g.useRef(null),r=g.useContext(qc);return g.useEffect(function(){return r.onChange(function(o){if(n.current){var s=0,c=0;n.current.style.transform=r.handleTransformStyles(s,c,1/o.state.scale)}})},[r]),Me.createElement("div",uo({},e,{ref:SF([n,t])}))});const YF=()=>{const[e,t]=g.useState(0),[n,r]=g.useState(1),[o,s]=g.useState(1);return{rotation:e,scaleX:n,scaleY:o,flipHorizontally:()=>{r(n*-1)},flipVertically:()=>{s(o*-1)},rotateCounterClockwise:()=>{t(e===-270?0:e-90)},rotateClockwise:()=>{t(e===270?0:e+90)},reset:()=>{t(0),r(1),s(1)}}},KF=({flipHorizontally:e,flipVertically:t,rotateCounterClockwise:n,rotateClockwise:r,reset:o})=>{const{zoomIn:s,zoomOut:c,resetTransform:u}=Sb(),{t:f}=X();return l.jsxs(Qt,{isAttached:!0,orientation:"vertical",children:[l.jsx(se,{icon:l.jsx(dD,{}),"aria-label":f("accessibility.zoomIn"),tooltip:"Zoom In",onClick:()=>s(),fontSize:20}),l.jsx(se,{icon:l.jsx(fD,{}),"aria-label":f("accessibility.zoomOut"),tooltip:"Zoom Out",onClick:()=>c(),fontSize:20}),l.jsx(se,{icon:l.jsx(cD,{}),"aria-label":f("accessibility.rotateCounterClockwise"),tooltip:"Rotate Counter-Clockwise",onClick:n,fontSize:20}),l.jsx(se,{icon:l.jsx(uD,{}),"aria-label":f("accessibility.rotateClockwise"),tooltip:"Rotate Clockwise",onClick:r,fontSize:20}),l.jsx(se,{icon:l.jsx(B0,{}),"aria-label":f("accessibility.flipHorizontally"),tooltip:"Flip Horizontally",onClick:e,fontSize:20}),l.jsx(se,{icon:l.jsx(B0,{style:{transform:"rotate(90deg)"}}),"aria-label":f("accessibility.flipVertically"),tooltip:"Flip Vertically",onClick:t,fontSize:20}),l.jsx(se,{icon:l.jsx(up,{}),"aria-label":f("accessibility.reset"),tooltip:"Reset",onClick:()=>{u(),o()},fontSize:20})]})};function XF({image:e,alt:t,ref:n,styleClass:r,rotation:o,scaleX:s,scaleY:c}){const{centerView:u}=Sb();return l.jsx(qF,{wrapperStyle:{width:"100%",height:"100%"},children:l.jsx("img",{style:{transform:`rotate(${o}deg) scaleX(${s}) scaleY(${c})`,width:"100%"},src:e.url,alt:t,ref:n,className:r||"",onLoad:()=>u(1,0,"easeOut")})})}const QF=me([Gr,Er],(e,t)=>{const{currentImage:n}=e,{shouldShowImageDetails:r}=t;return{viewerImageToDisplay:n,shouldShowImageDetails:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function ZF(){const e=Y(),t=A(x=>x.lightbox.isLightboxOpen),{rotation:n,scaleX:r,scaleY:o,flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:p}=YF(),{viewerImageToDisplay:h,shouldShowImageDetails:y}=A(QF);return de("Esc",()=>{t&&e(Vo(!1))},[t]),l.jsx(yo,{children:t&&l.jsx(ir.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,ease:"easeInOut"},style:{display:"flex",width:"100vw",height:`calc(100vh - ${dc*4}px)`,position:"fixed",top:`${dc*4}px`,background:"var(--invokeai-colors-base-900)",zIndex:99},children:l.jsxs(UF,{centerOnInit:!0,minScale:.1,initialPositionX:50,initialPositionY:50,children:[l.jsxs(B,{sx:{flexDir:"column",position:"absolute",insetInlineStart:4,gap:4,zIndex:3,top:4},children:[l.jsx(se,{icon:l.jsx(lD,{}),"aria-label":"Exit Viewer",className:"lightbox-close-btn",onClick:()=>{e(Vo(!1))},fontSize:20}),l.jsx(KF,{flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:p})]}),l.jsx(B,{sx:{position:"absolute",top:4,zIndex:3,insetInlineStart:"50%",transform:"translate(-50%, 0)"},children:l.jsx(D4,{})}),h&&l.jsxs(l.Fragment,{children:[l.jsx(XF,{rotation:n,scaleX:r,scaleY:o,image:h,styleClass:"lightbox-image"}),y&&l.jsx(yp,{image:h}),!y&&l.jsx(Ye,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"100vw",h:"100vh",px:16,pointerEvents:"none"},children:l.jsx(A4,{})})]})]})},"lightbox")})}jN();const rL=e=>{EN();const t=A(r=>r.ui.currentTheme),{setColorMode:n}=yC();return g.useEffect(()=>{n(["light"].includes(t)?"light":"dark")},[n,t]),l.jsxs(or,{w:"100vw",h:"100vh",children:[l.jsx(ZF,{}),l.jsxs(o9,{children:[l.jsx(rP,{}),l.jsxs(or,{gap:4,p:4,gridAutoRows:"min-content auto",w:Z9,h:J9,children:[e.children||l.jsx(P4,{}),l.jsxs(B,{gap:4,w:"full",h:"full",children:[l.jsx(kN,{}),l.jsx(zN,{})]})]}),l.jsx(Ye,{children:l.jsx(X9,{})})]}),l.jsx(Ua,{children:l.jsx(TN,{})}),l.jsx(Ua,{children:l.jsx(IN,{})})]})};export{rL as default}; diff --git a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-a1ea5622.js b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-51f66919.js similarity index 99% rename from invokeai/frontend/web/dist/assets/ThemeLocaleProvider-a1ea5622.js rename to invokeai/frontend/web/dist/assets/ThemeLocaleProvider-51f66919.js index 5a5f36623e..47abb01c5b 100644 --- a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-a1ea5622.js +++ b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-51f66919.js @@ -1,4 +1,4 @@ -import{j as y,cN as Ie,r as _,cO as bt,q as Lr,cP as o,cQ as b,cR as v,cS as S,cT as Vr,cU as ut,cV as vt,cM as ft,cW as mt,n as gt,cX as ht,E as pt}from"./index-2ad84bef.js";import{d as yt,i as St,T as xt,j as $t,h as kt}from"./storeHooks-e63a2dc4.js";var Or=` +import{j as y,cN as Ie,r as _,cO as bt,q as Lr,cP as o,cQ as b,cR as v,cS as S,cT as Vr,cU as ut,cV as vt,cM as ft,cW as mt,n as gt,cX as ht,E as pt}from"./index-d64f4654.js";import{d as yt,i as St,T as xt,j as $t,h as kt}from"./storeHooks-0eed8e9f.js";var Or=` :root { --chakra-vh: 100vh; } diff --git a/invokeai/frontend/web/dist/assets/index-2ad84bef.js b/invokeai/frontend/web/dist/assets/index-d64f4654.js similarity index 99% rename from invokeai/frontend/web/dist/assets/index-2ad84bef.js rename to invokeai/frontend/web/dist/assets/index-d64f4654.js index 05b8946258..1f958ff512 100644 --- a/invokeai/frontend/web/dist/assets/index-2ad84bef.js +++ b/invokeai/frontend/web/dist/assets/index-d64f4654.js @@ -112,4 +112,4 @@ function print() { __p += __j.call(arguments, '') } `)+ne+`return __p }`;var Oe=WS(function(){return je(P,ge+"return "+ne).apply(n,R)});if(Oe.source=ne,Ag(Oe))throw Oe;return Oe}function FI(o){return Ve(o).toLowerCase()}function $I(o){return Ve(o).toUpperCase()}function zI(o,l,d){if(o=Ve(o),o&&(d||l===n))return Z0(o);if(!o||!(l=Fn(l)))return o;var m=Pr(o),b=Pr(l),P=e1(m,b),R=t1(m,b)+1;return aa(m,P,R).join("")}function GI(o,l,d){if(o=Ve(o),o&&(d||l===n))return o.slice(0,r1(o)+1);if(!o||!(l=Fn(l)))return o;var m=Pr(o),b=t1(m,Pr(l))+1;return aa(m,0,b).join("")}function UI(o,l,d){if(o=Ve(o),o&&(d||l===n))return o.replace(nl,"");if(!o||!(l=Fn(l)))return o;var m=Pr(o),b=e1(m,Pr(l));return aa(m,b).join("")}function jI(o,l){var d=K,m=te;if(ht(l)){var b="separator"in l?l.separator:b;d="length"in l?Ee(l.length):d,m="omission"in l?Fn(l.omission):m}o=Ve(o);var P=o.length;if($o(o)){var R=Pr(o);P=R.length}if(d>=P)return o;var M=d-zo(m);if(M<1)return m;var z=R?aa(R,0,M).join(""):o.slice(0,M);if(b===n)return z+m;if(R&&(M+=z.length-M),Ig(b)){if(o.slice(M).search(b)){var Z,ee=z;for(b.global||(b=Kp(b.source,Ve(vi.exec(b))+"g")),b.lastIndex=0;Z=b.exec(ee);)var ne=Z.index;z=z.slice(0,ne===n?M:ne)}}else if(o.indexOf(Fn(b),M)!=M){var ue=z.lastIndexOf(b);ue>-1&&(z=z.slice(0,ue))}return z+m}function WI(o){return o=Ve(o),o&&up.test(o)?o.replace(el,SE):o}var HI=qo(function(o,l,d){return o+(d?" ":"")+l.toUpperCase()}),Dg=H1("toUpperCase");function jS(o,l,d){return o=Ve(o),l=d?n:l,l===n?pE(o)?bE(o):aE(o):o.match(l)||[]}var WS=Re(function(o,l){try{return Nn(o,n,l)}catch(d){return Ag(d)?d:new Ce(d)}}),VI=xi(function(o,l){return tr(l,function(d){d=Yr(d),bi(o,d,Tg(o[d],o))}),o});function qI(o){var l=o==null?0:o.length,d=ye();return o=l?ut(o,function(m){if(typeof m[1]!="function")throw new nr(s);return[d(m[0]),m[1]]}):[],Re(function(m){for(var b=-1;++bW)return[];var d=oe,m=rn(o,oe);l=ye(l),o-=oe;for(var b=Hp(m,l);++d0||l<0)?new Me(d):(o<0?d=d.takeRight(-o):o&&(d=d.drop(o)),l!==n&&(l=Ee(l),d=l<0?d.dropRight(-l):d.take(l-o)),d)},Me.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},Me.prototype.toArray=function(){return this.take(oe)},qr(Me.prototype,function(o,l){var d=/^(?:filter|find|map|reject)|While$/.test(l),m=/^(?:head|last)$/.test(l),b=k[m?"take"+(l=="last"?"Right":""):l],P=m||/^find/.test(l);b&&(k.prototype[l]=function(){var R=this.__wrapped__,M=m?[1]:arguments,z=R instanceof Me,Z=M[0],ee=z||ke(R),ne=function(Le){var Ne=b.apply(k,Zi([Le],M));return m&&ue?Ne[0]:Ne};ee&&d&&typeof Z=="function"&&Z.length!=1&&(z=ee=!1);var ue=this.__chain__,ge=!!this.__actions__.length,Se=P&&!ue,Oe=z&&!ge;if(!P&&ee){R=Oe?R:new Me(this);var _e=o.apply(R,M);return _e.__actions__.push({func:tf,args:[ne],thisArg:n}),new rr(_e,ue)}return Se&&Oe?o.apply(this,M):(_e=this.thru(ne),Se?m?_e.value()[0]:_e.value():_e)})}),tr(["pop","push","shift","sort","splice","unshift"],function(o){var l=Ec[o],d=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",m=/^(?:pop|shift)$/.test(o);k.prototype[o]=function(){var b=arguments;if(m&&!this.__chain__){var P=this.value();return l.apply(ke(P)?P:[],b)}return this[d](function(R){return l.apply(ke(R)?R:[],b)})}}),qr(Me.prototype,function(o,l){var d=k[l];if(d){var m=d.name+"";Xe.call(Wo,m)||(Wo[m]=[]),Wo[m].push({name:l,func:d})}}),Wo[Kc(n,_).name]=[{name:"wrapper",func:n}],Me.prototype.clone=WE,Me.prototype.reverse=HE,Me.prototype.value=VE,k.prototype.at=wR,k.prototype.chain=bR,k.prototype.commit=CR,k.prototype.next=xR,k.prototype.plant=PR,k.prototype.reverse=ER,k.prototype.toJSON=k.prototype.valueOf=k.prototype.value=OR,k.prototype.first=k.prototype.head,pl&&(k.prototype[pl]=kR),k},Go=CE();ze?((ze.exports=Go)._=Go,Te._=Go):Pe._=Go}).call(yn)})(g5,_t);const Jo=(t,e,n,r,i,a,s)=>{const u=t/2-(n+i/2)*s,c=e/2-(r+a/2)*s;return{x:u,y:c}},Zo=(t,e,n,r,i=.95)=>{const a=t*i/n,s=e*i/r;return Math.min(1,Math.min(a,s))},LG=.999,MG=.1,DG=20,Nl=.95,NG=30,BG=10,Pw=t=>({x:Math.floor(t.x),y:Math.floor(t.y)}),Ya=t=>{const{width:e,height:n}=t,r={width:e,height:n},i=512*512,a=e/n;let s=e*n,u=448;for(;s1?(r.width=u,r.height=va(u/a,64)):a<1&&(r.height=u,r.width=va(u*a,64)),s=r.width*r.height;return r},m5=t=>({width:va(t.width,64),height:va(t.height,64)}),FG=[{key:"Base",value:"base"},{key:"Mask",value:"mask"}],$G=[{key:"Auto",value:"auto"},{key:"Manual",value:"manual"},{key:"None",value:"none"}],Qx=t=>t.kind==="line"&&t.layer==="mask",zG=t=>t.kind==="line"&&t.layer==="base",Ew=t=>t.kind==="image"&&t.layer==="base",GG=t=>t.kind==="fillRect"&&t.layer==="base",UG=t=>t.kind==="eraseRect"&&t.layer==="base",v5=t=>t.kind==="line",Zl={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},y5={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:Zl,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},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"},Jx=vo({name:"canvas",initialState:y5,reducers:{setTool:(t,e)=>{const n=e.payload;t.tool=e.payload,n!=="move"&&(t.isTransformingBoundingBox=!1,t.isMouseOverBoundingBox=!1,t.isMovingBoundingBox=!1,t.isMovingStage=!1)},setLayer:(t,e)=>{t.layer=e.payload},toggleTool:t=>{const e=t.tool;e!=="move"&&(t.tool=e==="brush"?"eraser":"brush")},setMaskColor:(t,e)=>{t.maskColor=e.payload},setBrushColor:(t,e)=>{t.brushColor=e.payload},setBrushSize:(t,e)=>{t.brushSize=e.payload},clearMask:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState.objects=t.layerState.objects.filter(e=>!Qx(e)),t.futureLayerStates=[],t.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:t=>{t.shouldPreserveMaskedArea=!t.shouldPreserveMaskedArea},toggleShouldShowMask:t=>{t.isMaskEnabled=!t.isMaskEnabled},setShouldPreserveMaskedArea:(t,e)=>{t.shouldPreserveMaskedArea=e.payload},setIsMaskEnabled:(t,e)=>{t.isMaskEnabled=e.payload,t.layer=e.payload?"mask":"base"},setShouldShowCheckboardTransparency:(t,e)=>{t.shouldShowCheckboardTransparency=e.payload},setShouldShowBrushPreview:(t,e)=>{t.shouldShowBrushPreview=e.payload},setShouldShowBrush:(t,e)=>{t.shouldShowBrush=e.payload},setCursorPosition:(t,e)=>{t.cursorPosition=e.payload},setInitialCanvasImage:(t,e)=>{const n=e.payload,{stageDimensions:r}=t,i={width:Ef(_t.clamp(n.width,64,512),64),height:Ef(_t.clamp(n.height,64,512),64)},a={x:va(n.width/2-i.width/2,64),y:va(n.height/2-i.height/2,64)};if(t.boundingBoxScaleMethod==="auto"){const c=Ya(i);t.scaledBoundingBoxDimensions=c}t.boundingBoxDimensions=i,t.boundingBoxCoordinates=a,t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState={...Zl,objects:[{kind:"image",layer:"base",x:0,y:0,width:n.width,height:n.height,image:n}]},t.futureLayerStates=[],t.isCanvasInitialized=!1;const s=Zo(r.width,r.height,n.width,n.height,Nl),u=Jo(r.width,r.height,0,0,n.width,n.height,s);t.stageScale=s,t.stageCoordinates=u,t.doesCanvasNeedScaling=!0},setBoundingBoxDimensions:(t,e)=>{const n=m5(e.payload);if(t.boundingBoxDimensions=n,t.boundingBoxScaleMethod==="auto"){const r=Ya(n);t.scaledBoundingBoxDimensions=r}},setBoundingBoxCoordinates:(t,e)=>{t.boundingBoxCoordinates=Pw(e.payload)},setStageCoordinates:(t,e)=>{t.stageCoordinates=e.payload},setBoundingBoxPreviewFill:(t,e)=>{t.boundingBoxPreviewFill=e.payload},setDoesCanvasNeedScaling:(t,e)=>{t.doesCanvasNeedScaling=e.payload},setStageScale:(t,e)=>{t.stageScale=e.payload},setShouldDarkenOutsideBoundingBox:(t,e)=>{t.shouldDarkenOutsideBoundingBox=e.payload},setIsDrawing:(t,e)=>{t.isDrawing=e.payload},clearCanvasHistory:t=>{t.pastLayerStates=[],t.futureLayerStates=[]},setShouldLockBoundingBox:(t,e)=>{t.shouldLockBoundingBox=e.payload},toggleShouldLockBoundingBox:t=>{t.shouldLockBoundingBox=!t.shouldLockBoundingBox},setShouldShowBoundingBox:(t,e)=>{t.shouldShowBoundingBox=e.payload},setIsTransformingBoundingBox:(t,e)=>{t.isTransformingBoundingBox=e.payload},setIsMovingBoundingBox:(t,e)=>{t.isMovingBoundingBox=e.payload},setIsMouseOverBoundingBox:(t,e)=>{t.isMouseOverBoundingBox=e.payload},setIsMoveBoundingBoxKeyHeld:(t,e)=>{t.isMoveBoundingBoxKeyHeld=e.payload},setIsMoveStageKeyHeld:(t,e)=>{t.isMoveStageKeyHeld=e.payload},addImageToStagingArea:(t,e)=>{const{boundingBox:n,image:r}=e.payload;!n||!r||(t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.stagingArea.images.push({kind:"image",layer:"base",...n,image:r}),t.layerState.stagingArea.selectedImageIndex=t.layerState.stagingArea.images.length-1,t.futureLayerStates=[])},discardStagedImages:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.stagingArea={...Zl.stagingArea},t.futureLayerStates=[],t.shouldShowStagingOutline=!0,t.shouldShowStagingOutline=!0},addFillRect:t=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:n,brushColor:r}=t;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({kind:"fillRect",layer:"base",...e,...n,color:r}),t.futureLayerStates=[]},addEraseRect:t=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:n}=t;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({kind:"eraseRect",layer:"base",...e,...n}),t.futureLayerStates=[]},addLine:(t,e)=>{const{tool:n,layer:r,brushColor:i,brushSize:a,shouldRestrictStrokesToBox:s}=t;if(n==="move"||n==="colorPicker")return;const u=a/2,c=r==="base"&&n==="brush"?{color:i}:{};t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift();const f={kind:"line",layer:r,tool:n,strokeWidth:u,points:e.payload,...c};s&&(f.clip={...t.boundingBoxCoordinates,...t.boundingBoxDimensions}),t.layerState.objects.push(f),t.futureLayerStates=[]},addPointToCurrentLine:(t,e)=>{const n=t.layerState.objects.findLast(v5);n&&n.points.push(...e.payload)},undo:t=>{const e=t.pastLayerStates.pop();e&&(t.futureLayerStates.unshift(_t.cloneDeep(t.layerState)),t.futureLayerStates.length>t.maxHistory&&t.futureLayerStates.pop(),t.layerState=e)},redo:t=>{const e=t.futureLayerStates.shift();e&&(t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState=e)},setShouldShowGrid:(t,e)=>{t.shouldShowGrid=e.payload},setIsMovingStage:(t,e)=>{t.isMovingStage=e.payload},setShouldSnapToGrid:(t,e)=>{t.shouldSnapToGrid=e.payload},setShouldAutoSave:(t,e)=>{t.shouldAutoSave=e.payload},setShouldShowIntermediates:(t,e)=>{t.shouldShowIntermediates=e.payload},resetCanvas:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState=Zl,t.futureLayerStates=[]},setCanvasContainerDimensions:(t,e)=>{t.canvasContainerDimensions=e.payload},resizeAndScaleCanvas:t=>{const{width:e,height:n}=t.canvasContainerDimensions,r=t.layerState.objects.find(Ew),i={width:Math.floor(e),height:Math.floor(n)};if(!r){const h=Zo(i.width,i.height,512,512,Nl),p=Jo(i.width,i.height,0,0,512,512,h),g={width:512,height:512};if(t.stageScale=h,t.stageCoordinates=p,t.stageDimensions=i,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=g,t.boundingBoxScaleMethod==="auto"){const y=Ya(g);t.scaledBoundingBoxDimensions=y}return}const{width:a,height:s}=r,c=Zo(e,n,a,s,.95),f=Jo(i.width,i.height,0,0,a,s,c);t.minimumStageScale=c,t.stageScale=c,t.stageCoordinates=Pw(f),t.stageDimensions=i,t.isCanvasInitialized=!0},resizeCanvas:t=>{const{width:e,height:n}=t.canvasContainerDimensions,r={width:Math.floor(e),height:Math.floor(n)};if(t.stageDimensions=r,!t.layerState.objects.find(Ew)){const i=Zo(r.width,r.height,512,512,Nl),a=Jo(r.width,r.height,0,0,512,512,i),s={width:512,height:512};if(t.stageScale=i,t.stageCoordinates=a,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=s,t.boundingBoxScaleMethod==="auto"){const u=Ya(s);t.scaledBoundingBoxDimensions=u}}},resetCanvasView:(t,e)=>{const{contentRect:n,shouldScaleTo1:r}=e.payload,{stageDimensions:{width:i,height:a}}=t,{x:s,y:u,width:c,height:f}=n;if(c!==0&&f!==0){const h=r?1:Zo(i,a,c,f,Nl),p=Jo(i,a,s,u,c,f,h);t.stageScale=h,t.stageCoordinates=p}else{const h=Zo(i,a,512,512,Nl),p=Jo(i,a,0,0,512,512,h),g={width:512,height:512};if(t.stageScale=h,t.stageCoordinates=p,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=g,t.boundingBoxScaleMethod==="auto"){const y=Ya(g);t.scaledBoundingBoxDimensions=y}}},nextStagingAreaImage:t=>{const e=t.layerState.stagingArea.selectedImageIndex,n=t.layerState.stagingArea.images.length;t.layerState.stagingArea.selectedImageIndex=Math.min(e+1,n-1)},prevStagingAreaImage:t=>{const e=t.layerState.stagingArea.selectedImageIndex;t.layerState.stagingArea.selectedImageIndex=Math.max(e-1,0)},commitStagingAreaImage:t=>{const{images:e,selectedImageIndex:n}=t.layerState.stagingArea;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({...e[n]}),t.layerState.stagingArea={...Zl.stagingArea},t.futureLayerStates=[],t.shouldShowStagingOutline=!0,t.shouldShowStagingImage=!0},fitBoundingBoxToStage:t=>{const{boundingBoxDimensions:e,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=t,a=r.width/i,s=r.height/i;if(n.x<0||n.x+e.width>a||n.y<0||n.y+e.height>s){const u={width:Ef(_t.clamp(a,64,512),64),height:Ef(_t.clamp(s,64,512),64)},c={x:va(a/2-u.width/2,64),y:va(s/2-u.height/2,64)};if(t.boundingBoxDimensions=u,t.boundingBoxCoordinates=c,t.boundingBoxScaleMethod==="auto"){const f=Ya(u);t.scaledBoundingBoxDimensions=f}}},setBoundingBoxScaleMethod:(t,e)=>{if(t.boundingBoxScaleMethod=e.payload,e.payload==="auto"){const n=Ya(t.boundingBoxDimensions);t.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(t,e)=>{t.scaledBoundingBoxDimensions=e.payload},setShouldShowStagingImage:(t,e)=>{t.shouldShowStagingImage=e.payload},setShouldShowStagingOutline:(t,e)=>{t.shouldShowStagingOutline=e.payload},setShouldShowCanvasDebugInfo:(t,e)=>{t.shouldShowCanvasDebugInfo=e.payload},setShouldRestrictStrokesToBox:(t,e)=>{t.shouldRestrictStrokesToBox=e.payload},setShouldCropToBoundingBoxOnSave:(t,e)=>{t.shouldCropToBoundingBoxOnSave=e.payload},setColorPickerColor:(t,e)=>{t.colorPickerColor=e.payload},commitColorPickerColor:t=>{t.brushColor={...t.colorPickerColor,a:t.brushColor.a},t.tool="brush"},setMergedCanvas:(t,e)=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.futureLayerStates=[],t.layerState.objects=[e.payload]},resetCanvasInteractionState:t=>{t.cursorPosition=null,t.isDrawing=!1,t.isMouseOverBoundingBox=!1,t.isMoveBoundingBoxKeyHeld=!1,t.isMoveStageKeyHeld=!1,t.isMovingBoundingBox=!1,t.isMovingStage=!1,t.isTransformingBoundingBox=!1},mouseLeftCanvas:t=>{t.cursorPosition=null,t.isDrawing=!1,t.isMouseOverBoundingBox=!1,t.isMovingBoundingBox=!1,t.isTransformingBoundingBox=!1}}}),{addEraseRect:jG,addFillRect:WG,addImageToStagingArea:S5,addLine:HG,addPointToCurrentLine:VG,clearCanvasHistory:qG,clearMask:KG,commitColorPickerColor:YG,commitStagingAreaImage:XG,discardStagedImages:QG,fitBoundingBoxToStage:JG,mouseLeftCanvas:ZG,nextStagingAreaImage:eU,prevStagingAreaImage:tU,redo:nU,resetCanvas:rU,resetCanvasInteractionState:iU,resetCanvasView:aU,resizeAndScaleCanvas:oU,resizeCanvas:sU,setBoundingBoxCoordinates:lU,setBoundingBoxDimensions:uU,setBoundingBoxPreviewFill:cU,setBoundingBoxScaleMethod:fU,setBrushColor:dU,setBrushSize:hU,setCanvasContainerDimensions:pU,setColorPickerColor:gU,setCursorPosition:mU,setDoesCanvasNeedScaling:vU,setInitialCanvasImage:yU,setIsDrawing:SU,setIsMaskEnabled:_U,setIsMouseOverBoundingBox:wU,setIsMoveBoundingBoxKeyHeld:bU,setIsMoveStageKeyHeld:CU,setIsMovingBoundingBox:xU,setIsMovingStage:kU,setIsTransformingBoundingBox:PU,setLayer:EU,setMaskColor:OU,setMergedCanvas:TU,setShouldAutoSave:RU,setShouldCropToBoundingBoxOnSave:AU,setShouldDarkenOutsideBoundingBox:IU,setShouldLockBoundingBox:LU,setShouldPreserveMaskedArea:MU,setShouldShowBoundingBox:DU,setShouldShowBrush:NU,setShouldShowBrushPreview:BU,setShouldShowCanvasDebugInfo:FU,setShouldShowCheckboardTransparency:$U,setShouldShowGrid:zU,setShouldShowIntermediates:GU,setShouldShowStagingImage:UU,setShouldShowStagingOutline:jU,setShouldSnapToGrid:WU,setStageCoordinates:HU,setStageScale:VU,setTool:qU,toggleShouldLockBoundingBox:KU,toggleTool:YU,undo:XU,setScaledBoundingBoxDimensions:QU,setShouldRestrictStrokesToBox:JU}=Jx.actions,_5=Jx.reducer,w5={currentImageUuid:"",galleryImageMinimumWidth:64,galleryImageObjectFit:"cover",shouldAutoSwitchToNewImages:!0,currentCategory:"result",categories:{user:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0},result:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0}},galleryWidth:300,shouldUseSingleGalleryColumn:!1},Zx=vo({name:"gallery",initialState:w5,reducers:{setCurrentImage:(t,e)=>{t.currentImage=e.payload,t.currentImageUuid=e.payload.uuid},removeImage:(t,e)=>{const{uuid:n,category:r}=e.payload,i=t.categories[r].images,a=i.filter(s=>s.uuid!==n);if(n===t.currentImageUuid){const s=i.findIndex(c=>c.uuid===n),u=_t.clamp(s,0,a.length-1);t.currentImage=a.length?a[u]:void 0,t.currentImageUuid=a.length?a[u].uuid:""}t.categories[r].images=a},addImage:(t,e)=>{const{image:n,category:r}=e.payload,{uuid:i,url:a,mtime:s}=n,u=t.categories[r];u.images.find(c=>c.url===a&&c.mtime===s)||(u.images.unshift(n),t.shouldAutoSwitchToNewImages&&(t.currentImageUuid=i,t.currentImage=n,t.currentCategory=r),t.intermediateImage=void 0,u.latest_mtime=s)},setIntermediateImage:(t,e)=>{t.intermediateImage=e.payload},clearIntermediateImage:t=>{t.intermediateImage=void 0},selectNextImage:t=>{const{currentImage:e}=t;if(!e)return;const n=t.categories[e.category].images;if(e){const r=n.findIndex(i=>i.uuid===e.uuid);if(r{const{currentImage:e}=t;if(!e)return;const n=t.categories[e.category].images;if(e){const r=n.findIndex(i=>i.uuid===e.uuid);if(r>0){const i=n[r-1];t.currentImage=i,t.currentImageUuid=i.uuid}}},addGalleryImages:(t,e)=>{const{images:n,areMoreImagesAvailable:r,category:i}=e.payload,a=t.categories[i].images;if(n.length>0){const s=n.filter(u=>!a.find(c=>c.url===u.url&&c.mtime===u.mtime));if(t.categories[i].images=a.concat(s).sort((u,c)=>c.mtime-u.mtime),!t.currentImage){const u=n[0];t.currentImage=u,t.currentImageUuid=u.uuid}t.categories[i].latest_mtime=n[0].mtime,t.categories[i].earliest_mtime=n[n.length-1].mtime}r!==void 0&&(t.categories[i].areMoreImagesAvailable=r)},setGalleryImageMinimumWidth:(t,e)=>{t.galleryImageMinimumWidth=e.payload},setGalleryImageObjectFit:(t,e)=>{t.galleryImageObjectFit=e.payload},setShouldAutoSwitchToNewImages:(t,e)=>{t.shouldAutoSwitchToNewImages=e.payload},setCurrentCategory:(t,e)=>{t.currentCategory=e.payload},setGalleryWidth:(t,e)=>{t.galleryWidth=e.payload},setShouldUseSingleGalleryColumn:(t,e)=>{t.shouldUseSingleGalleryColumn=e.payload}}}),{addImage:Of,clearIntermediateImage:Cm,removeImage:ek,setCurrentImage:ZU,addGalleryImages:b5,setIntermediateImage:C5,selectNextImage:ej,selectPrevImage:tj,setGalleryImageMinimumWidth:nj,setGalleryImageObjectFit:rj,setShouldAutoSwitchToNewImages:ij,setCurrentCategory:aj,setGalleryWidth:oj,setShouldUseSingleGalleryColumn:sj}=Zx.actions,x5=Zx.reducer,k5={isLightboxOpen:!1},P5=k5,tk=vo({name:"lightbox",initialState:P5,reducers:{setIsLightboxOpen:(t,e)=>{t.isLightboxOpen=e.payload}}}),{setIsLightboxOpen:lj}=tk.actions,E5=tk.reducer,dd=t=>typeof t=="string"?t:t.length===1?t[0].prompt:t.map(e=>`${e.prompt}:${e.weight}`).join(" ");function O5(t){let e=typeof t=="string"?t:dd(t),n="";const r=new RegExp(/\[([^\][]*)]/,"gi"),i=[...e.matchAll(r)].map(a=>a[1]);return i.length&&(n=i.join(" "),i.forEach(a=>{e=e.replace(`[${a}]`,"").replaceAll("[]","").trim()})),[e,n]}const T5=t=>{const r=t.split(",").map(i=>i.split(":")).map(i=>({seed:Number(i[0]),weight:Number(i[1])}));return R5(r)?r:!1},R5=t=>Boolean(typeof t=="string"?T5(t):t.length&&!t.some(e=>{const{seed:n,weight:r}=e,i=!isNaN(parseInt(n.toString(),10)),a=!isNaN(parseInt(r.toString(),10))&&r>=0&&r<=1;return!(i&&a)})),Ow=t=>t.reduce((e,n,r,i)=>{const{seed:a,weight:s}=n;return e+=`${a}:${s}`,r!==i.length-1&&(e+=","),e},""),A5=t=>t.split(",").map(r=>r.split(":")).map(r=>[parseInt(r[0],10),parseFloat(r[1])]),nk={cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,maskPath:"",perlin:0,prompt:"",negativePrompt:"",sampler:"k_lms",seamBlur:16,seamless:!1,seamSize:96,seamSteps:30,seamStrength:.7,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,tileSize:32,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0},I5=nk,rk=vo({name:"generation",initialState:I5,reducers:{setPrompt:(t,e)=>{const n=e.payload;typeof n=="string"?t.prompt=n:t.prompt=dd(n)},setNegativePrompt:(t,e)=>{const n=e.payload;typeof n=="string"?t.negativePrompt=n:t.negativePrompt=dd(n)},setIterations:(t,e)=>{t.iterations=e.payload},setSteps:(t,e)=>{t.steps=e.payload},clampSymmetrySteps:t=>{t.horizontalSymmetrySteps=_t.clamp(t.horizontalSymmetrySteps,0,t.steps),t.verticalSymmetrySteps=_t.clamp(t.verticalSymmetrySteps,0,t.steps)},setCfgScale:(t,e)=>{t.cfgScale=e.payload},setThreshold:(t,e)=>{t.threshold=e.payload},setPerlin:(t,e)=>{t.perlin=e.payload},setHeight:(t,e)=>{t.height=e.payload},setWidth:(t,e)=>{t.width=e.payload},setSampler:(t,e)=>{t.sampler=e.payload},setSeed:(t,e)=>{t.seed=e.payload,t.shouldRandomizeSeed=!1},setImg2imgStrength:(t,e)=>{t.img2imgStrength=e.payload},setMaskPath:(t,e)=>{t.maskPath=e.payload},setSeamless:(t,e)=>{t.seamless=e.payload},setShouldFitToWidthHeight:(t,e)=>{t.shouldFitToWidthHeight=e.payload},resetSeed:t=>{t.seed=-1},setParameter:(t,e)=>{const{key:n,value:r}=e.payload,i={...t,[n]:r};return n==="seed"&&(i.shouldRandomizeSeed=!1),i},setShouldGenerateVariations:(t,e)=>{t.shouldGenerateVariations=e.payload},setVariationAmount:(t,e)=>{t.variationAmount=e.payload},setSeedWeights:(t,e)=>{t.seedWeights=e.payload,t.shouldGenerateVariations=!0,t.variationAmount=0},setAllTextToImageParameters:(t,e)=>{const{sampler:n,prompt:r,seed:i,variations:a,steps:s,cfg_scale:u,threshold:c,perlin:f,seamless:h,_hires_fix:p,width:g,height:y}=e.payload.image;a&&a.length>0?(t.seedWeights=Ow(a),t.shouldGenerateVariations=!0,t.variationAmount=0):t.shouldGenerateVariations=!1,i&&(t.seed=i,t.shouldRandomizeSeed=!1),r&&(t.prompt=dd(r)),n&&(t.sampler=n),s&&(t.steps=s),u&&(t.cfgScale=u),typeof c>"u"?t.threshold=0:t.threshold=c,typeof f>"u"?t.perlin=0:t.perlin=f,typeof h=="boolean"&&(t.seamless=h),g&&(t.width=g),y&&(t.height=y)},setAllImageToImageParameters:(t,e)=>{const{type:n,strength:r,fit:i,init_image_path:a,mask_image_path:s}=e.payload.image;n==="img2img"&&(a&&(t.initialImage=a),s&&(t.maskPath=s),r&&(t.img2imgStrength=r),typeof i=="boolean"&&(t.shouldFitToWidthHeight=i))},setAllParameters:(t,e)=>{const{type:n,sampler:r,prompt:i,seed:a,variations:s,steps:u,cfg_scale:c,threshold:f,perlin:h,seamless:p,_hires_fix:g,width:y,height:v,strength:w,fit:x,init_image_path:_,mask_image_path:S}=e.payload.image;if(n==="img2img"&&(_&&(t.initialImage=_),S&&(t.maskPath=S),w&&(t.img2imgStrength=w),typeof x=="boolean"&&(t.shouldFitToWidthHeight=x)),s&&s.length>0?(t.seedWeights=Ow(s),t.shouldGenerateVariations=!0,t.variationAmount=0):t.shouldGenerateVariations=!1,a&&(t.seed=a,t.shouldRandomizeSeed=!1),i){const[C,O]=O5(i);C&&(t.prompt=C),O?t.negativePrompt=O:t.negativePrompt=""}r&&(t.sampler=r),u&&(t.steps=u),c&&(t.cfgScale=c),typeof f>"u"?t.threshold=0:t.threshold=f,typeof h>"u"?t.perlin=0:t.perlin=h,typeof p=="boolean"&&(t.seamless=p),y&&(t.width=y),v&&(t.height=v)},resetParametersState:t=>({...t,...nk}),setShouldRandomizeSeed:(t,e)=>{t.shouldRandomizeSeed=e.payload},setInitialImage:(t,e)=>{t.initialImage=e.payload},clearInitialImage:t=>{t.initialImage=void 0},setSeamSize:(t,e)=>{t.seamSize=e.payload},setSeamBlur:(t,e)=>{t.seamBlur=e.payload},setSeamStrength:(t,e)=>{t.seamStrength=e.payload},setSeamSteps:(t,e)=>{t.seamSteps=e.payload},setTileSize:(t,e)=>{t.tileSize=e.payload},setInfillMethod:(t,e)=>{t.infillMethod=e.payload},setShouldUseSymmetry:(t,e)=>{t.shouldUseSymmetry=e.payload},setHorizontalSymmetrySteps:(t,e)=>{t.horizontalSymmetrySteps=e.payload},setVerticalSymmetrySteps:(t,e)=>{t.verticalSymmetrySteps=e.payload}}}),{clampSymmetrySteps:uj,clearInitialImage:L5,resetParametersState:cj,resetSeed:fj,setAllImageToImageParameters:dj,setAllParameters:hj,setAllTextToImageParameters:pj,setCfgScale:gj,setHeight:mj,setImg2imgStrength:vj,setInfillMethod:M5,setInitialImage:D5,setIterations:yj,setMaskPath:N5,setParameter:Sj,setPerlin:_j,setPrompt:wj,setNegativePrompt:bj,setSampler:Cj,setSeamBlur:xj,setSeamless:kj,setSeamSize:Pj,setSeamSteps:Ej,setSeamStrength:Oj,setSeed:Tj,setSeedWeights:Rj,setShouldFitToWidthHeight:Aj,setShouldGenerateVariations:Ij,setShouldRandomizeSeed:Lj,setSteps:Mj,setThreshold:Dj,setTileSize:Nj,setVariationAmount:Bj,setWidth:Fj,setShouldUseSymmetry:$j,setHorizontalSymmetrySteps:zj,setVerticalSymmetrySteps:Gj}=rk.actions,B5=rk.reducer,ik={codeformerFidelity:.75,facetoolStrength:.75,facetoolType:"gfpgan",hiresFix:!1,hiresStrength:.75,shouldLoopback:!1,shouldRunESRGAN:!1,shouldRunFacetool:!1,upscalingLevel:4,upscalingDenoising:.75,upscalingStrength:.75},F5=ik,ak=vo({name:"postprocessing",initialState:F5,reducers:{setFacetoolStrength:(t,e)=>{t.facetoolStrength=e.payload},setCodeformerFidelity:(t,e)=>{t.codeformerFidelity=e.payload},setUpscalingLevel:(t,e)=>{t.upscalingLevel=e.payload},setUpscalingDenoising:(t,e)=>{t.upscalingDenoising=e.payload},setUpscalingStrength:(t,e)=>{t.upscalingStrength=e.payload},setHiresFix:(t,e)=>{t.hiresFix=e.payload},setHiresStrength:(t,e)=>{t.hiresStrength=e.payload},resetPostprocessingState:t=>({...t,...ik}),setShouldRunFacetool:(t,e)=>{t.shouldRunFacetool=e.payload},setFacetoolType:(t,e)=>{t.facetoolType=e.payload},setShouldRunESRGAN:(t,e)=>{t.shouldRunESRGAN=e.payload},setShouldLoopback:(t,e)=>{t.shouldLoopback=e.payload}}}),{resetPostprocessingState:Uj,setCodeformerFidelity:jj,setFacetoolStrength:Wj,setFacetoolType:Hj,setHiresFix:Vj,setHiresStrength:qj,setShouldLoopback:Kj,setShouldRunESRGAN:Yj,setShouldRunFacetool:Xj,setUpscalingLevel:Qj,setUpscalingDenoising:Jj,setUpscalingStrength:Zj}=ak.actions,$5=ak.reducer;function Sr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Tw(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.init(e,n)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=n||U5,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(n){this.debug=n}},{key:"log",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i1?r-1:0),a=1;a-1?u.replace(/###/g,"."):u}function i(){return!t||typeof t=="string"}for(var a=typeof e!="string"?[].concat(e):e.split(".");a.length>1;){if(i())return{};var s=r(a.shift());!t[s]&&n&&(t[s]=new n),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={}}return i()?{}:{obj:t,k:r(a.shift())}}function Mw(t,e,n){var r=O0(t,e,Object),i=r.obj,a=r.k;i[a]=n}function H5(t,e,n,r){var i=O0(t,e,Object),a=i.obj,s=i.k;a[s]=a[s]||[],r&&(a[s]=a[s].concat(n)),r||a[s].push(n)}function rh(t,e){var n=O0(t,e),r=n.obj,i=n.k;if(r)return r[i]}function Dw(t,e,n){var r=rh(t,n);return r!==void 0?r:rh(e,n)}function uk(t,e,n){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?typeof t[r]=="string"||t[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?n&&(t[r]=e[r]):uk(t[r],e[r],n):t[r]=e[r]);return t}function es(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var V5={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function q5(t){return typeof t=="string"?t.replace(/[&<>"'\/]/g,function(e){return V5[e]}):t}var Qh=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,K5=[" ",",","?","!",";"];function Y5(t,e,n){e=e||"",n=n||"";var r=K5.filter(function(u){return e.indexOf(u)<0&&n.indexOf(u)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(u){return u==="?"?"\\?":u}).join("|"),")")),a=!i.test(t);if(!a){var s=t.indexOf(n);s>0&&!i.test(t.substring(0,s))&&(a=!0)}return a}function Nw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Tf(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ck(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(t){if(t[e])return t[e];for(var r=e.split(n),i=t,a=0;aa+s;)s++,u=r.slice(a,a+s).join(n),c=i[u];if(c===void 0)return;if(c===null)return null;if(e.endsWith(u)){if(typeof c=="string")return c;if(u&&typeof c[u]=="string")return c[u]}var f=r.slice(a+s).join(n);return f?ck(c,f,n):void 0}i=i[r[a]]}return i}}var J5=function(t){Xh(n,t);var e=X5(n);function n(r){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Sr(this,n),i=e.call(this),Qh&&Aa.call(Ea(i)),i.data=r||{},i.options=a,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return _r(n,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var a=this.options.ns.indexOf(i);a>-1&&this.options.ns.splice(a,1)}},{key:"getResource",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},c=u.keySeparator!==void 0?u.keySeparator:this.options.keySeparator,f=u.ignoreJSONStructure!==void 0?u.ignoreJSONStructure:this.options.ignoreJSONStructure,h=[i,a];s&&typeof s!="string"&&(h=h.concat(s)),s&&typeof s=="string"&&(h=h.concat(c?s.split(c):s)),i.indexOf(".")>-1&&(h=i.split("."));var p=rh(this.data,h);return p||!f||typeof s!="string"?p:ck(this.data&&this.data[i]&&this.data[i][a],s,c)}},{key:"addResource",value:function(i,a,s,u){var c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},f=this.options.keySeparator;f===void 0&&(f=".");var h=[i,a];s&&(h=h.concat(f?s.split(f):s)),i.indexOf(".")>-1&&(h=i.split("."),u=a,a=h[1]),this.addNamespaces(a),Mw(this.data,h,u),c.silent||this.emit("added",i,a,s,u)}},{key:"addResources",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var c in s)(typeof s[c]=="string"||Object.prototype.toString.apply(s[c])==="[object Array]")&&this.addResource(i,a,c,s[c],{silent:!0});u.silent||this.emit("added",i,a,s)}},{key:"addResourceBundle",value:function(i,a,s,u,c){var f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},h=[i,a];i.indexOf(".")>-1&&(h=i.split("."),u=s,s=a,a=h[1]),this.addNamespaces(a);var p=rh(this.data,h)||{};u?uk(p,s,c):p=Tf(Tf({},p),s),Mw(this.data,h,p),f.silent||this.emit("added",i,a,s)}},{key:"removeResourceBundle",value:function(i,a){this.hasResourceBundle(i,a)&&delete this.data[i][a],this.removeNamespaces(a),this.emit("removed",i,a)}},{key:"hasResourceBundle",value:function(i,a){return this.getResource(i,a)!==void 0}},{key:"getResourceBundle",value:function(i,a){return a||(a=this.options.defaultNS),this.options.compatibilityAPI==="v1"?Tf(Tf({},{}),this.getResource(i,a)):this.getResource(i,a)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var a=this.getDataByLanguage(i),s=a&&Object.keys(a)||[];return!!s.find(function(u){return a[u]&&Object.keys(a[u]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),n}(Aa),fk={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,n,r,i,a){var s=this;return e.forEach(function(u){s.processors[u]&&(n=s.processors[u].process(n,r,i,a))}),n}};function Bw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function mn(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Fw={},$w=function(t){Xh(n,t);var e=Z5(n);function n(r){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Sr(this,n),i=e.call(this),Qh&&Aa.call(Ea(i)),W5(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,Ea(i)),i.options=a,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=ii.create("translator"),i}return _r(n,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var s=this.resolve(i,a);return s&&s.res!==void 0}},{key:"extractFromKey",value:function(i,a){var s=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");var u=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=a.ns||this.options.defaultNS||[],f=s&&i.indexOf(s)>-1,h=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!Y5(i,s,u);if(f&&!h){var p=i.match(this.interpolator.nestingRegexp);if(p&&p.length>0)return{key:i,namespaces:c};var g=i.split(s);(s!==u||s===u&&this.options.ns.indexOf(g[0])>-1)&&(c=g.shift()),i=g.join(u)}return typeof c=="string"&&(c=[c]),{key:i,namespaces:c}}},{key:"translate",value:function(i,a,s){var u=this;if(gr(a)!=="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),a||(a={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var c=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,f=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,h=this.extractFromKey(i[i.length-1],a),p=h.key,g=h.namespaces,y=g[g.length-1],v=a.lng||this.language,w=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(v&&v.toLowerCase()==="cimode"){if(w){var x=a.nsSeparator||this.options.nsSeparator;return c?{res:"".concat(y).concat(x).concat(p),usedKey:p,exactUsedKey:p,usedLng:v,usedNS:y}:"".concat(y).concat(x).concat(p)}return c?{res:p,usedKey:p,exactUsedKey:p,usedLng:v,usedNS:y}:p}var _=this.resolve(i,a),S=_&&_.res,C=_&&_.usedKey||p,O=_&&_.exactUsedKey||p,I=Object.prototype.toString.apply(S),L=["[object Number]","[object Function]","[object RegExp]"],D=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,U=!this.i18nFormat||this.i18nFormat.handleAsObject,X=typeof S!="string"&&typeof S!="boolean"&&typeof S!="number";if(U&&S&&X&&L.indexOf(I)<0&&!(typeof D=="string"&&I==="[object Array]")){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var K=this.options.returnedObjectHandler?this.options.returnedObjectHandler(C,S,mn(mn({},a),{},{ns:g})):"key '".concat(p," (").concat(this.language,")' returned an object instead of string.");return c?(_.res=K,_):K}if(f){var te=I==="[object Array]",ce=te?[]:{},j=te?O:C;for(var T in S)if(Object.prototype.hasOwnProperty.call(S,T)){var $="".concat(j).concat(f).concat(T);ce[T]=this.translate($,mn(mn({},a),{joinArrays:!1,ns:g})),ce[T]===$&&(ce[T]=S[T])}S=ce}}else if(U&&typeof D=="string"&&I==="[object Array]")S=S.join(D),S&&(S=this.extendTranslation(S,i,a,s));else{var V=!1,ie=!1,W=a.count!==void 0&&typeof a.count!="string",Y=n.hasDefaultValue(a),Q=W?this.pluralResolver.getSuffix(v,a.count,a):"",oe=a["defaultValue".concat(Q)]||a.defaultValue;!this.isValidLookup(S)&&Y&&(V=!0,S=oe),this.isValidLookup(S)||(ie=!0,S=p);var ve=a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,we=ve&&ie?void 0:S,Ue=Y&&oe!==S&&this.options.updateMissing;if(ie||V||Ue){if(this.logger.log(Ue?"updateKey":"missingKey",v,y,p,Ue?oe:S),f){var At=this.resolve(p,mn(mn({},a),{},{keySeparator:!1}));At&&At.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.")}var me=[],qt=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&qt&&qt[0])for(var Bt=0;Bt1&&arguments[1]!==void 0?arguments[1]:{},u,c,f,h,p;return typeof i=="string"&&(i=[i]),i.forEach(function(g){if(!a.isValidLookup(u)){var y=a.extractFromKey(g,s),v=y.key;c=v;var w=y.namespaces;a.options.fallbackNS&&(w=w.concat(a.options.fallbackNS));var x=s.count!==void 0&&typeof s.count!="string",_=x&&!s.ordinal&&s.count===0&&a.pluralResolver.shouldUseIntlApi(),S=s.context!==void 0&&(typeof s.context=="string"||typeof s.context=="number")&&s.context!=="",C=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);w.forEach(function(O){a.isValidLookup(u)||(p=O,!Fw["".concat(C[0],"-").concat(O)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(p)&&(Fw["".concat(C[0],"-").concat(O)]=!0,a.logger.warn('key "'.concat(c,'" for languages "').concat(C.join(", "),`" won't get resolved as namespace "`).concat(p,'" 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!!!")),C.forEach(function(I){if(!a.isValidLookup(u)){h=I;var L=[v];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(L,v,I,O,s);else{var D;x&&(D=a.pluralResolver.getSuffix(I,s.count,s));var U="".concat(a.options.pluralSeparator,"zero");if(x&&(L.push(v+D),_&&L.push(v+U)),S){var X="".concat(v).concat(a.options.contextSeparator).concat(s.context);L.push(X),x&&(L.push(X+D),_&&L.push(X+U))}}for(var K;K=L.pop();)a.isValidLookup(u)||(f=K,u=a.getResource(I,O,K,s))}}))})}}),{res:u,usedKey:c,exactUsedKey:f,usedLng:h,usedNS:p}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,a,s,u):this.resourceStore.getResource(i,a,s,u)}}],[{key:"hasDefaultValue",value:function(i){var a="defaultValue";for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&a===s.substring(0,a.length)&&i[s]!==void 0)return!0;return!1}}]),n}(Aa);function xm(t){return t.charAt(0).toUpperCase()+t.slice(1)}var zw=function(){function t(e){Sr(this,t),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ii.create("languageUtils")}return _r(t,[{key:"getScriptPartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return null;var r=n.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return n;var r=n.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(n){if(typeof n=="string"&&n.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=n.split("-");return this.options.lowerCaseLng?i=i.map(function(a){return a.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=xm(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=xm(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=xm(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}},{key:"isSupportedCode",value:function(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(n)>-1}},{key:"getBestMatchFromCodes",value:function(n){var r=this;if(!n)return null;var i;return n.forEach(function(a){if(!i){var s=r.formatLanguageCode(a);(!r.options.supportedLngs||r.isSupportedCode(s))&&(i=s)}}),!i&&this.options.supportedLngs&&n.forEach(function(a){if(!i){var s=r.getLanguagePartFromCode(a);if(r.isSupportedCode(s))return i=s;i=r.options.supportedLngs.find(function(u){if(u.indexOf(s)===0)return u})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(n,r){if(!n)return[];if(typeof n=="function"&&(n=n(r)),typeof n=="string"&&(n=[n]),Object.prototype.toString.apply(n)==="[object Array]")return n;if(!r)return n.default||[];var i=n[r];return i||(i=n[this.getScriptPartFromCode(r)]),i||(i=n[this.formatLanguageCode(r)]),i||(i=n[this.getLanguagePartFromCode(r)]),i||(i=n.default),i||[]}},{key:"toResolveHierarchy",value:function(n,r){var i=this,a=this.getFallbackCodes(r||this.options.fallbackLng||[],n),s=[],u=function(f){f&&(i.isSupportedCode(f)?s.push(f):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(f)))};return typeof n=="string"&&n.indexOf("-")>-1?(this.options.load!=="languageOnly"&&u(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&u(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&u(this.getLanguagePartFromCode(n))):typeof n=="string"&&u(this.formatLanguageCode(n)),a.forEach(function(c){s.indexOf(c)<0&&u(i.formatLanguageCode(c))}),s}}]),t}(),t4=[{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}],n4={1:function(e){return Number(e>1)},2:function(e){return Number(e!=1)},3:function(e){return 0},4:function(e){return Number(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 Number(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 Number(e==1?0:e>=2&&e<=4?1:2)},7:function(e){return Number(e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(e==1?0:e==2?1:e!=8&&e!=11?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(e==1?0:e==2?1:e<7?2:e<11?3:4)},11:function(e){return Number(e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(e!==0)},14:function(e){return Number(e==1?0:e==2?1:e==3?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:e!==0?1:2)},17:function(e){return Number(e==1||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(e==0?0:e==1?1:2)},19:function(e){return Number(e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(e==1?0:e==0||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3)}},r4=["v1","v2","v3"],Gw={zero:0,one:1,two:2,few:3,many:4,other:5};function i4(){var t={};return t4.forEach(function(e){e.lngs.forEach(function(n){t[n]={numbers:e.nr,plurals:n4[e.fc]}})}),t}var a4=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.languageUtils=e,this.options=n,this.logger=ii.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(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=i4()}return _r(t,[{key:"addRule",value:function(n,r){this.rules[n]=r}},{key:"getRule",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(n,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[n]||this.rules[this.languageUtils.getLanguagePartFromCode(n)]}},{key:"needsPlural",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(n,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(n,i).map(function(a){return"".concat(r).concat(a)})}},{key:"getSuffixes",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.getRule(n,i);return a?this.shouldUseIntlApi()?a.resolvedOptions().pluralCategories.sort(function(s,u){return Gw[s]-Gw[u]}).map(function(s){return"".concat(r.options.prepend).concat(s)}):a.numbers.map(function(s){return r.getSuffix(n,s,i)}):[]}},{key:"getSuffix",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=this.getRule(n,i);return a?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(a.select(r)):this.getSuffixRetroCompatible(a,r):(this.logger.warn("no plural rule found for: ".concat(n)),"")}},{key:"getSuffixRetroCompatible",value:function(n,r){var i=this,a=n.noAbs?n.plurals(r):n.plurals(Math.abs(r)),s=n.numbers[a];this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));var u=function(){return i.options.prepend&&s.toString()?i.options.prepend+s.toString():s.toString()};return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?"_plural_".concat(s.toString()):u():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1?u():this.options.prepend&&a.toString()?this.options.prepend+a.toString():a.toString()}},{key:"shouldUseIntlApi",value:function(){return!r4.includes(this.options.compatibilityJSON)}}]),t}();function Uw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ar(t){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};Sr(this,t),this.logger=ii.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(n){return n},this.init(e)}return _r(t,[{key:"init",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n.interpolation||(n.interpolation={escapeValue:!0});var r=n.interpolation;this.escape=r.escape!==void 0?r.escape:q5,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?es(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?es(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?es(r.nestingPrefix):r.nestingPrefixEscaped||es("$t("),this.nestingSuffix=r.nestingSuffix?es(r.nestingSuffix):r.nestingSuffixEscaped||es(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var n="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(n,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(n,r,i,a){var s=this,u,c,f,h=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function p(x){return x.replace(/\$/g,"$$$$")}var g=function(_){if(_.indexOf(s.formatSeparator)<0){var S=Dw(r,h,_);return s.alwaysFormat?s.format(S,void 0,i,Ar(Ar(Ar({},a),r),{},{interpolationkey:_})):S}var C=_.split(s.formatSeparator),O=C.shift().trim(),I=C.join(s.formatSeparator).trim();return s.format(Dw(r,h,O),I,i,Ar(Ar(Ar({},a),r),{},{interpolationkey:O}))};this.resetRegExp();var y=a&&a.missingInterpolationHandler||this.options.missingInterpolationHandler,v=a&&a.interpolation&&a.interpolation.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,w=[{regex:this.regexpUnescape,safeValue:function(_){return p(_)}},{regex:this.regexp,safeValue:function(_){return s.escapeValue?p(s.escape(_)):p(_)}}];return w.forEach(function(x){for(f=0;u=x.regex.exec(n);){var _=u[1].trim();if(c=g(_),c===void 0)if(typeof y=="function"){var S=y(n,u,a);c=typeof S=="string"?S:""}else if(a&&Object.prototype.hasOwnProperty.call(a,_))c="";else if(v){c=u[0];continue}else s.logger.warn("missed to pass in variable ".concat(_," for interpolating ").concat(n)),c="";else typeof c!="string"&&!s.useRawValueToEscape&&(c=Lw(c));var C=x.safeValue(c);if(n=n.replace(u[0],C),v?(x.regex.lastIndex+=c.length,x.regex.lastIndex-=u[0].length):x.regex.lastIndex=0,f++,f>=s.maxReplaces)break}}),n}},{key:"nest",value:function(n,r){var i=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,u,c;function f(y,v){var w=this.nestingOptionsSeparator;if(y.indexOf(w)<0)return y;var x=y.split(new RegExp("".concat(w,"[ ]*{"))),_="{".concat(x[1]);y=x[0],_=this.interpolate(_,c);var S=_.match(/'/g),C=_.match(/"/g);(S&&S.length%2===0&&!C||C.length%2!==0)&&(_=_.replace(/'/g,'"'));try{c=JSON.parse(_),v&&(c=Ar(Ar({},v),c))}catch(O){return this.logger.warn("failed parsing options string in nesting for key ".concat(y),O),"".concat(y).concat(w).concat(_)}return delete c.defaultValue,y}for(;s=this.nestingRegexp.exec(n);){var h=[];c=Ar({},a),c=c.replace&&typeof c.replace!="string"?c.replace:c,c.applyPostProcessor=!1,delete c.defaultValue;var p=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){var g=s[1].split(this.formatSeparator).map(function(y){return y.trim()});s[1]=g.shift(),h=g,p=!0}if(u=r(f.call(this,s[1].trim(),c),c),u&&s[0]===n&&typeof u!="string")return u;typeof u!="string"&&(u=Lw(u)),u||(this.logger.warn("missed to resolve ".concat(s[1]," for nesting ").concat(n)),u=""),p&&(u=h.reduce(function(y,v){return i.format(y,v,a.lng,Ar(Ar({},a),{},{interpolationkey:s[1].trim()}))},u.trim())),n=n.replace(s[0],u),this.regexp.lastIndex=0}return n}}]),t}();function jw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ri(t){for(var e=1;e-1){var r=t.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)n.currency||(n.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)n.range||(n.range=i.trim());else{var a=i.split(";");a.forEach(function(s){if(s){var u=s.split(":"),c=G5(u),f=c[0],h=c.slice(1),p=h.join(":").trim().replace(/^'+|'+$/g,"");n[f.trim()]||(n[f.trim()]=p),p==="false"&&(n[f.trim()]=!1),p==="true"&&(n[f.trim()]=!0),isNaN(p)||(n[f.trim()]=parseInt(p,10))}})}}return{formatName:e,formatOptions:n}}function ts(t){var e={};return function(r,i,a){var s=i+JSON.stringify(a),u=e[s];return u||(u=t(i,a),e[s]=u),u(r)}}var l4=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Sr(this,t),this.logger=ii.create("formatter"),this.options=e,this.formats={number:ts(function(n,r){var i=new Intl.NumberFormat(n,Ri({},r));return function(a){return i.format(a)}}),currency:ts(function(n,r){var i=new Intl.NumberFormat(n,Ri(Ri({},r),{},{style:"currency"}));return function(a){return i.format(a)}}),datetime:ts(function(n,r){var i=new Intl.DateTimeFormat(n,Ri({},r));return function(a){return i.format(a)}}),relativetime:ts(function(n,r){var i=new Intl.RelativeTimeFormat(n,Ri({},r));return function(a){return i.format(a,r.range||"day")}}),list:ts(function(n,r){var i=new Intl.ListFormat(n,Ri({},r));return function(a){return i.format(a)}})},this.init(e)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(n,r){this.formats[n.toLowerCase().trim()]=r}},{key:"addCached",value:function(n,r){this.formats[n.toLowerCase().trim()]=ts(r)}},{key:"format",value:function(n,r,i){var a=this,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},u=r.split(this.formatSeparator),c=u.reduce(function(f,h){var p=s4(h),g=p.formatName,y=p.formatOptions;if(a.formats[g]){var v=f;try{var w=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},x=w.locale||w.lng||s.locale||s.lng||i;v=a.formats[g](f,x,Ri(Ri(Ri({},y),s),w))}catch(_){a.logger.warn(_)}return v}else a.logger.warn("there was no format function for ".concat(g));return f},n);return c}}]),t}();function Ww(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Hw(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function f4(t,e){t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)}var d4=function(t){Xh(n,t);var e=u4(n);function n(r,i,a){var s,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Sr(this,n),s=e.call(this),Qh&&Aa.call(Ea(s)),s.backend=r,s.store=i,s.services=a,s.languageUtils=a.languageUtils,s.options=u,s.logger=ii.create("backendConnector"),s.waitingReads=[],s.maxParallelReads=u.maxParallelReads||10,s.readingCalls=0,s.maxRetries=u.maxRetries>=0?u.maxRetries:5,s.retryTimeout=u.retryTimeout>=1?u.retryTimeout:350,s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(a,u.backend,u),s}return _r(n,[{key:"queueLoad",value:function(i,a,s,u){var c=this,f={},h={},p={},g={};return i.forEach(function(y){var v=!0;a.forEach(function(w){var x="".concat(y,"|").concat(w);!s.reload&&c.store.hasResourceBundle(y,w)?c.state[x]=2:c.state[x]<0||(c.state[x]===1?h[x]===void 0&&(h[x]=!0):(c.state[x]=1,v=!1,h[x]===void 0&&(h[x]=!0),f[x]===void 0&&(f[x]=!0),g[w]===void 0&&(g[w]=!0)))}),v||(p[y]=!0)}),(Object.keys(f).length||Object.keys(h).length)&&this.queue.push({pending:h,pendingCount:Object.keys(h).length,loaded:{},errors:[],callback:u}),{toLoad:Object.keys(f),pending:Object.keys(h),toLoadLanguages:Object.keys(p),toLoadNamespaces:Object.keys(g)}}},{key:"loaded",value:function(i,a,s){var u=i.split("|"),c=u[0],f=u[1];a&&this.emit("failedLoading",c,f,a),s&&this.store.addResourceBundle(c,f,s),this.state[i]=a?-1:2;var h={};this.queue.forEach(function(p){H5(p.loaded,[c],f),f4(p,i),a&&p.errors.push(a),p.pendingCount===0&&!p.done&&(Object.keys(p.loaded).forEach(function(g){h[g]||(h[g]={});var y=p.loaded[g];y.length&&y.forEach(function(v){h[g][v]===void 0&&(h[g][v]=!0)})}),p.done=!0,p.errors.length?p.callback(p.errors):p.callback())}),this.emit("loaded",h),this.queue=this.queue.filter(function(p){return!p.done})}},{key:"read",value:function(i,a,s){var u=this,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,h=arguments.length>5?arguments[5]:void 0;if(!i.length)return h(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:a,fcName:s,tried:c,wait:f,callback:h});return}this.readingCalls++;var p=function(w,x){if(u.readingCalls--,u.waitingReads.length>0){var _=u.waitingReads.shift();u.read(_.lng,_.ns,_.fcName,_.tried,_.wait,_.callback)}if(w&&x&&c2&&arguments[2]!==void 0?arguments[2]:{},c=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."),c&&c();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof a=="string"&&(a=[a]);var f=this.queueLoad(i,a,u,c);if(!f.toLoad.length)return f.pending.length||c(),null;f.toLoad.forEach(function(h){s.loadOne(h)})}},{key:"load",value:function(i,a,s){this.prepareLoading(i,a,{},s)}},{key:"reload",value:function(i,a,s){this.prepareLoading(i,a,{reload:!0},s)}},{key:"loadOne",value:function(i){var a=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",u=i.split("|"),c=u[0],f=u[1];this.read(c,f,"read",void 0,void 0,function(h,p){h&&a.logger.warn("".concat(s,"loading namespace ").concat(f," for language ").concat(c," failed"),h),!h&&p&&a.logger.log("".concat(s,"loaded namespace ").concat(f," for language ").concat(c),p),a.loaded(i,h,p)})}},{key:"saveMissing",value:function(i,a,s,u,c){var f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(a)){this.logger.warn('did not save key "'.concat(s,'" as the namespace "').concat(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!!!");return}if(!(s==null||s==="")){if(this.backend&&this.backend.create){var p=Hw(Hw({},f),{},{isUpdate:c}),g=this.backend.create.bind(this.backend);if(g.length<6)try{var y;g.length===5?y=g(i,a,s,u,p):y=g(i,a,s,u),y&&typeof y.then=="function"?y.then(function(v){return h(null,v)}).catch(h):h(null,y)}catch(v){h(v)}else g(i,a,s,u,h,p)}!i||!i[0]||this.store.addResource(i[0],a,s,u)}}}]),n}(Aa);function Vw(){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:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var n={};if(gr(e[1])==="object"&&(n=e[1]),typeof e[1]=="string"&&(n.defaultValue=e[1]),typeof e[2]=="string"&&(n.tDescription=e[2]),gr(e[2])==="object"||gr(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:function(e,n,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function qw(t){return typeof t.ns=="string"&&(t.ns=[t.ns]),typeof t.fallbackLng=="string"&&(t.fallbackLng=[t.fallbackLng]),typeof t.fallbackNS=="string"&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function Kw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Qr(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Rf(){}function g4(t){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(t));e.forEach(function(n){typeof t[n]=="function"&&(t[n]=t[n].bind(t))})}var ih=function(t){Xh(n,t);var e=h4(n);function n(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;if(Sr(this,n),r=e.call(this),Qh&&Aa.call(Ea(r)),r.options=qw(i),r.services={},r.logger=ii,r.modules={external:[]},g4(Ea(r)),a&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,a),Ju(r,Ea(r));setTimeout(function(){r.init(i,a)},0)}return r}return _r(n,[{key:"init",value:function(){var i=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;typeof a=="function"&&(s=a,a={}),!a.defaultNS&&a.defaultNS!==!1&&a.ns&&(typeof a.ns=="string"?a.defaultNS=a.ns:a.ns.indexOf("translation")<0&&(a.defaultNS=a.ns[0]));var u=Vw();this.options=Qr(Qr(Qr({},u),this.options),qw(a)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Qr(Qr({},u.interpolation),this.options.interpolation)),a.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=a.keySeparator),a.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=a.nsSeparator);function c(_){return _?typeof _=="function"?new _:_:null}if(!this.options.isClone){this.modules.logger?ii.init(c(this.modules.logger),this.options):ii.init(null,this.options);var f;this.modules.formatter?f=this.modules.formatter:typeof Intl<"u"&&(f=l4);var h=new zw(this.options);this.store=new J5(this.options.resources,this.options);var p=this.services;p.logger=ii,p.resourceStore=this.store,p.languageUtils=h,p.pluralResolver=new a4(h,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),f&&(!this.options.interpolation.format||this.options.interpolation.format===u.interpolation.format)&&(p.formatter=c(f),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new o4(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new d4(c(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(_){for(var S=arguments.length,C=new Array(S>1?S-1:0),O=1;O1?S-1:0),O=1;O0&&g[0]!=="dev"&&(this.options.lng=g[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var y=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];y.forEach(function(_){i[_]=function(){var S;return(S=i.store)[_].apply(S,arguments)}});var v=["addResource","addResources","addResourceBundle","removeResourceBundle"];v.forEach(function(_){i[_]=function(){var S;return(S=i.store)[_].apply(S,arguments),i}});var w=Bl(),x=function(){var S=function(O,I){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),w.resolve(I),s(O,I)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return S(null,i.t.bind(i));i.changeLanguage(i.options.lng,S)};return this.options.resources||!this.options.initImmediate?x():setTimeout(x,0),w}},{key:"loadResources",value:function(i){var a=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rf,u=s,c=typeof i=="string"?i:this.language;if(typeof i=="function"&&(u=i),!this.options.resources||this.options.partialBundledLanguages){if(c&&c.toLowerCase()==="cimode")return u();var f=[],h=function(y){if(y){var v=a.services.languageUtils.toResolveHierarchy(y);v.forEach(function(w){f.indexOf(w)<0&&f.push(w)})}};if(c)h(c);else{var p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.forEach(function(g){return h(g)})}this.options.preload&&this.options.preload.forEach(function(g){return h(g)}),this.services.backendConnector.load(f,this.options.ns,function(g){!g&&!a.resolvedLanguage&&a.language&&a.setResolvedLanguage(a.language),u(g)})}else u(null)}},{key:"reloadResources",value:function(i,a,s){var u=Bl();return i||(i=this.languages),a||(a=this.options.ns),s||(s=Rf),this.services.backendConnector.reload(i,a,function(c){u.resolve(),s(c)}),u}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&fk.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var a=0;a-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}},{key:"changeLanguage",value:function(i,a){var s=this;this.isLanguageChangingTo=i;var u=Bl();this.emit("languageChanging",i);var c=function(g){s.language=g,s.languages=s.services.languageUtils.toResolveHierarchy(g),s.resolvedLanguage=void 0,s.setResolvedLanguage(g)},f=function(g,y){y?(c(y),s.translator.changeLanguage(y),s.isLanguageChangingTo=void 0,s.emit("languageChanged",y),s.logger.log("languageChanged",y)):s.isLanguageChangingTo=void 0,u.resolve(function(){return s.t.apply(s,arguments)}),a&&a(g,function(){return s.t.apply(s,arguments)})},h=function(g){!i&&!g&&s.services.languageDetector&&(g=[]);var y=typeof g=="string"?g:s.services.languageUtils.getBestMatchFromCodes(g);y&&(s.language||c(y),s.translator.language||s.translator.changeLanguage(y),s.services.languageDetector&&s.services.languageDetector.cacheUserLanguage&&s.services.languageDetector.cacheUserLanguage(y)),s.loadResources(y,function(v){f(v,y)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?h(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(h):this.services.languageDetector.detect(h):h(i),u}},{key:"getFixedT",value:function(i,a,s){var u=this,c=function f(h,p){var g;if(gr(p)!=="object"){for(var y=arguments.length,v=new Array(y>2?y-2:0),w=2;w1&&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;var u=this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,f=this.languages[this.languages.length-1];if(u.toLowerCase()==="cimode")return!0;var h=function(y,v){var w=a.services.backendConnector.state["".concat(y,"|").concat(v)];return w===-1||w===2};if(s.precheck){var p=s.precheck(this,h);if(p!==void 0)return p}return!!(this.hasResourceBundle(u,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||h(u,i)&&(!c||h(f,i)))}},{key:"loadNamespaces",value:function(i,a){var s=this,u=Bl();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(c){s.options.ns.indexOf(c)<0&&s.options.ns.push(c)}),this.loadResources(function(c){u.resolve(),a&&a(c)}),u):(a&&a(),Promise.resolve())}},{key:"loadLanguages",value:function(i,a){var s=Bl();typeof i=="string"&&(i=[i]);var u=this.options.preload||[],c=i.filter(function(f){return u.indexOf(f)<0});return c.length?(this.options.preload=u.concat(c),this.loadResources(function(f){s.resolve(),a&&a(f)}),s):(a&&a(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var a=["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"],s=this.services&&this.services.languageUtils||new zw(Vw());return a.indexOf(s.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rf,u=Qr(Qr(Qr({},this.options),a),{isClone:!0}),c=new n(u);(a.debug!==void 0||a.prefix!==void 0)&&(c.logger=c.logger.clone(a));var f=["store","services","language"];return f.forEach(function(h){c[h]=i[h]}),c.services=Qr({},this.services),c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c.translator=new $w(c.services,c.options),c.translator.on("*",function(h){for(var p=arguments.length,g=new Array(p>1?p-1:0),y=1;y0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new ih(t,e)});var Ae=ih.createInstance();Ae.createInstance=ih.createInstance;Ae.createInstance;Ae.dir;Ae.init;Ae.loadResources;Ae.reloadResources;Ae.use;Ae.changeLanguage;Ae.getFixedT;Ae.t;Ae.exists;Ae.setDefaultNamespace;Ae.hasLoadedNamespace;Ae.loadNamespaces;Ae.loadLanguages;var dk=[],m4=dk.forEach,v4=dk.slice;function y4(t){return m4.call(v4.call(arguments,1),function(e){if(e)for(var n in e)t[n]===void 0&&(t[n]=e[n])}),t}var Yw=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,S4=function(e,n,r){var i=r||{};i.path=i.path||"/";var a=encodeURIComponent(n),s="".concat(e,"=").concat(a);if(i.maxAge>0){var u=i.maxAge-0;if(Number.isNaN(u))throw new Error("maxAge should be a Number");s+="; Max-Age=".concat(Math.floor(u))}if(i.domain){if(!Yw.test(i.domain))throw new TypeError("option domain is invalid");s+="; Domain=".concat(i.domain)}if(i.path){if(!Yw.test(i.path))throw new TypeError("option path is invalid");s+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(s+="; HttpOnly"),i.secure&&(s+="; Secure"),i.sameSite){var c=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(c){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return s},Xw={create:function(e,n,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+r*60*1e3)),i&&(a.domain=i),document.cookie=S4(e,encodeURIComponent(n),a)},read:function(e){for(var n="".concat(e,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),a=i.split("&"),s=0;s0){var c=a[s].substring(0,u);c===e.lookupQuerystring&&(n=a[s].substring(u+1))}}}return n}},Fl=null,Qw=function(){if(Fl!==null)return Fl;try{Fl=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Fl=!1}return Fl},b4={name:"localStorage",lookup:function(e){var n;if(e.lookupLocalStorage&&Qw()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(e,n){n.lookupLocalStorage&&Qw()&&window.localStorage.setItem(n.lookupLocalStorage,e)}},$l=null,Jw=function(){if($l!==null)return $l;try{$l=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{$l=!1}return $l},C4={name:"sessionStorage",lookup:function(e){var n;if(e.lookupSessionStorage&&Jw()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(e,n){n.lookupSessionStorage&&Jw()&&window.sessionStorage.setItem(n.lookupSessionStorage,e)}},x4={name:"navigator",lookup:function(e){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?n:void 0}},k4={name:"htmlTag",lookup:function(e){var n,r=e.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},P4={name:"path",lookup:function(e){var n;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof r[e.lookupFromPathIndex]!="string")return;n=r[e.lookupFromPathIndex].replace("/","")}else n=r[0].replace("/","")}return n}},E4={name:"subdomain",lookup:function(e){var n=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};function O4(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var hk=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.type="languageDetector",this.detectors={},this.init(e,n)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=y4(r,this.options||{},O4()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(_4),this.addDetector(w4),this.addDetector(b4),this.addDetector(C4),this.addDetector(x4),this.addDetector(k4),this.addDetector(P4),this.addDetector(E4)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var i=[];return n.forEach(function(a){if(r.detectors[a]){var s=r.detectors[a].lookup(r.options);s&&typeof s=="string"&&(s=[s]),s&&(i=i.concat(s))}}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(a){i.detectors[a]&&i.detectors[a].cacheUserLanguage(n,i.options)}))}}]),t}();hk.type="languageDetector";function Wv(t){return Wv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wv(t)}var pk=[],T4=pk.forEach,R4=pk.slice;function Hv(t){return T4.call(R4.call(arguments,1),function(e){if(e)for(var n in e)t[n]===void 0&&(t[n]=e[n])}),t}function gk(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Wv(XMLHttpRequest))==="object"}function A4(t){return!!t&&typeof t.then=="function"}function I4(t){return A4(t)?t:Promise.resolve(t)}function L4(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var $u={},M4={get exports(){return $u},set exports(t){$u=t}},gu={},D4={get exports(){return gu},set exports(t){gu=t}},Zw;function N4(){return Zw||(Zw=1,function(t,e){var n=typeof self<"u"?self:yn,r=function(){function a(){this.fetch=!1,this.DOMException=n.DOMException}return a.prototype=n,new a}();(function(a){(function(s){var u={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function c(T){return T&&DataView.prototype.isPrototypeOf(T)}if(u.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(T){return T&&f.indexOf(Object.prototype.toString.call(T))>-1};function p(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 g(T){return typeof T!="string"&&(T=String(T)),T}function y(T){var $={next:function(){var V=T.shift();return{done:V===void 0,value:V}}};return u.iterable&&($[Symbol.iterator]=function(){return $}),$}function v(T){this.map={},T instanceof v?T.forEach(function($,V){this.append(V,$)},this):Array.isArray(T)?T.forEach(function($){this.append($[0],$[1])},this):T&&Object.getOwnPropertyNames(T).forEach(function($){this.append($,T[$])},this)}v.prototype.append=function(T,$){T=p(T),$=g($);var V=this.map[T];this.map[T]=V?V+", "+$:$},v.prototype.delete=function(T){delete this.map[p(T)]},v.prototype.get=function(T){return T=p(T),this.has(T)?this.map[T]:null},v.prototype.has=function(T){return this.map.hasOwnProperty(p(T))},v.prototype.set=function(T,$){this.map[p(T)]=g($)},v.prototype.forEach=function(T,$){for(var V in this.map)this.map.hasOwnProperty(V)&&T.call($,this.map[V],V,this)},v.prototype.keys=function(){var T=[];return this.forEach(function($,V){T.push(V)}),y(T)},v.prototype.values=function(){var T=[];return this.forEach(function($){T.push($)}),y(T)},v.prototype.entries=function(){var T=[];return this.forEach(function($,V){T.push([V,$])}),y(T)},u.iterable&&(v.prototype[Symbol.iterator]=v.prototype.entries);function w(T){if(T.bodyUsed)return Promise.reject(new TypeError("Already read"));T.bodyUsed=!0}function x(T){return new Promise(function($,V){T.onload=function(){$(T.result)},T.onerror=function(){V(T.error)}})}function _(T){var $=new FileReader,V=x($);return $.readAsArrayBuffer(T),V}function S(T){var $=new FileReader,V=x($);return $.readAsText(T),V}function C(T){for(var $=new Uint8Array(T),V=new Array($.length),ie=0;ie<$.length;ie++)V[ie]=String.fromCharCode($[ie]);return V.join("")}function O(T){if(T.slice)return T.slice(0);var $=new Uint8Array(T.byteLength);return $.set(new Uint8Array(T)),$.buffer}function I(){return this.bodyUsed=!1,this._initBody=function(T){this._bodyInit=T,T?typeof T=="string"?this._bodyText=T:u.blob&&Blob.prototype.isPrototypeOf(T)?this._bodyBlob=T:u.formData&&FormData.prototype.isPrototypeOf(T)?this._bodyFormData=T:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)?this._bodyText=T.toString():u.arrayBuffer&&u.blob&&c(T)?(this._bodyArrayBuffer=O(T.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(T)||h(T))?this._bodyArrayBuffer=O(T):this._bodyText=T=Object.prototype.toString.call(T):this._bodyText="",this.headers.get("content-type")||(typeof T=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var T=w(this);if(T)return T;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?w(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(_)}),this.text=function(){var T=w(this);if(T)return T;if(this._bodyBlob)return S(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(X)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function D(T){var $=T.toUpperCase();return L.indexOf($)>-1?$:T}function U(T,$){$=$||{};var V=$.body;if(T instanceof U){if(T.bodyUsed)throw new TypeError("Already read");this.url=T.url,this.credentials=T.credentials,$.headers||(this.headers=new v(T.headers)),this.method=T.method,this.mode=T.mode,this.signal=T.signal,!V&&T._bodyInit!=null&&(V=T._bodyInit,T.bodyUsed=!0)}else this.url=String(T);if(this.credentials=$.credentials||this.credentials||"same-origin",($.headers||!this.headers)&&(this.headers=new v($.headers)),this.method=D($.method||this.method||"GET"),this.mode=$.mode||this.mode||null,this.signal=$.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&V)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(V)}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function X(T){var $=new FormData;return T.trim().split("&").forEach(function(V){if(V){var ie=V.split("="),W=ie.shift().replace(/\+/g," "),Y=ie.join("=").replace(/\+/g," ");$.append(decodeURIComponent(W),decodeURIComponent(Y))}}),$}function K(T){var $=new v,V=T.replace(/\r?\n[\t ]+/g," ");return V.split(/\r?\n/).forEach(function(ie){var W=ie.split(":"),Y=W.shift().trim();if(Y){var Q=W.join(":").trim();$.append(Y,Q)}}),$}I.call(U.prototype);function te(T,$){$||($={}),this.type="default",this.status=$.status===void 0?200:$.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in $?$.statusText:"OK",this.headers=new v($.headers),this.url=$.url||"",this._initBody(T)}I.call(te.prototype),te.prototype.clone=function(){return new te(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},te.error=function(){var T=new te(null,{status:0,statusText:""});return T.type="error",T};var ce=[301,302,303,307,308];te.redirect=function(T,$){if(ce.indexOf($)===-1)throw new RangeError("Invalid status code");return new te(null,{status:$,headers:{location:T}})},s.DOMException=a.DOMException;try{new s.DOMException}catch{s.DOMException=function($,V){this.message=$,this.name=V;var ie=Error($);this.stack=ie.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function j(T,$){return new Promise(function(V,ie){var W=new U(T,$);if(W.signal&&W.signal.aborted)return ie(new s.DOMException("Aborted","AbortError"));var Y=new XMLHttpRequest;function Q(){Y.abort()}Y.onload=function(){var oe={status:Y.status,statusText:Y.statusText,headers:K(Y.getAllResponseHeaders()||"")};oe.url="responseURL"in Y?Y.responseURL:oe.headers.get("X-Request-URL");var ve="response"in Y?Y.response:Y.responseText;V(new te(ve,oe))},Y.onerror=function(){ie(new TypeError("Network request failed"))},Y.ontimeout=function(){ie(new TypeError("Network request failed"))},Y.onabort=function(){ie(new s.DOMException("Aborted","AbortError"))},Y.open(W.method,W.url,!0),W.credentials==="include"?Y.withCredentials=!0:W.credentials==="omit"&&(Y.withCredentials=!1),"responseType"in Y&&u.blob&&(Y.responseType="blob"),W.headers.forEach(function(oe,ve){Y.setRequestHeader(ve,oe)}),W.signal&&(W.signal.addEventListener("abort",Q),Y.onreadystatechange=function(){Y.readyState===4&&W.signal.removeEventListener("abort",Q)}),Y.send(typeof W._bodyInit>"u"?null:W._bodyInit)})}return j.polyfill=!0,a.fetch||(a.fetch=j,a.Headers=v,a.Request=U,a.Response=te),s.Headers=v,s.Request=U,s.Response=te,s.fetch=j,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e}(D4,gu)),gu}(function(t,e){var n;if(typeof fetch=="function"&&(typeof yn<"u"&&yn.fetch?n=yn.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof L4<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||N4();r.default&&(r=r.default),e.default=r,t.exports=e.default}})(M4,$u);const mk=$u,eb=h2({__proto__:null,default:mk},[$u]);function ah(t){return ah=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ah(t)}var Fi;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?Fi=global.fetch:typeof window<"u"&&window.fetch?Fi=window.fetch:Fi=fetch);var zu;gk()&&(typeof global<"u"&&global.XMLHttpRequest?zu=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(zu=window.XMLHttpRequest));var oh;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?oh=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(oh=window.ActiveXObject));!Fi&&eb&&!zu&&!oh&&(Fi=mk||eb);typeof Fi!="function"&&(Fi=void 0);var Vv=function(e,n){if(n&&ah(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+r.slice(1)}return e},tb=function(e,n,r){Fi(e,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(a){r(null,{status:i.status,data:a})}).catch(r)}).catch(r)},nb=!1,B4=function(e,n,r,i){e.queryStringParams&&(n=Vv(n,e.queryStringParams));var a=Hv({},typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders);r&&(a["Content-Type"]="application/json");var s=typeof e.requestOptions=="function"?e.requestOptions(r):e.requestOptions,u=Hv({method:r?"POST":"GET",body:r?e.stringify(r):void 0,headers:a},nb?{}:s);try{tb(n,u,i)}catch(c){if(!s||Object.keys(s).length===0||!c.message||c.message.indexOf("not implemented")<0)return i(c);try{Object.keys(s).forEach(function(f){delete u[f]}),tb(n,u,i),nb=!0}catch(f){i(f)}}},F4=function(e,n,r,i){r&&ah(r)==="object"&&(r=Vv("",r).slice(1)),e.queryStringParams&&(n=Vv(n,e.queryStringParams));try{var a;zu?a=new zu:a=new oh("MSXML2.XMLHTTP.3.0"),a.open(r?"POST":"GET",n,1),e.crossDomain||a.setRequestHeader("X-Requested-With","XMLHttpRequest"),a.withCredentials=!!e.withCredentials,r&&a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.overrideMimeType&&a.overrideMimeType("application/json");var s=e.customHeaders;if(s=typeof s=="function"?s():s,s)for(var u in s)a.setRequestHeader(u,s[u]);a.onreadystatechange=function(){a.readyState>3&&i(a.status>=400?a.statusText:null,{status:a.status,data:a.responseText})},a.send(r)}catch(c){console&&console.log(c)}},$4=function(e,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},Fi&&n.indexOf("file:")!==0)return B4(e,n,r,i);if(gk()||typeof ActiveXObject=="function")return F4(e,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function Gu(t){return Gu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gu(t)}function z4(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rb(t,e){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};z4(this,t),this.services=e,this.options=n,this.allOptions=r,this.type="backend",this.init(e,n,r)}return G4(t,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=Hv(i,this.options||{},W4()),this.allOptions=a,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,a,s){var u=this,c=this.options.loadPath;typeof this.options.loadPath=="function"&&(c=this.options.loadPath(n,i)),c=I4(c),c.then(function(f){if(!f)return s(null,{});var h=u.services.interpolator.interpolate(f,{lng:n.join("+"),ns:i.join("+")});u.loadUrl(h,s,r,a)})}},{key:"loadUrl",value:function(n,r,i,a){var s=this;this.options.request(this.options,n,void 0,function(u,c){if(c&&(c.status>=500&&c.status<600||!c.status))return r("failed loading "+n+"; status code: "+c.status,!0);if(c&&c.status>=400&&c.status<500)return r("failed loading "+n+"; status code: "+c.status,!1);if(!c&&u&&u.message&&u.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+u.message,!0);if(u)return r(u,!1);var f,h;try{typeof c.data=="string"?f=s.options.parse(c.data,i,a):f=c.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{key:"create",value:function(n,r,i,a,s){var u=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var c=this.options.parsePayload(r,i,a),f=0,h=[],p=[];n.forEach(function(g){var y=u.options.addPath;typeof u.options.addPath=="function"&&(y=u.options.addPath(g,r));var v=u.services.interpolator.interpolate(y,{lng:g,ns:r});u.options.request(u.options,v,c,function(w,x){f+=1,h.push(w),p.push(x),f===n.length&&typeof s=="function"&&s(h,p)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,a=r.languageUtils,s=r.logger,u=i.language;if(!(u&&u.toLowerCase()==="cimode")){var c=[],f=function(p){var g=a.toResolveHierarchy(p);g.forEach(function(y){c.indexOf(y)<0&&c.push(y)})};f(u),this.allOptions.preload&&this.allOptions.preload.forEach(function(h){return f(h)}),c.forEach(function(h){n.allOptions.ns.forEach(function(p){i.read(h,p,"read",null,null,function(g,y){g&&s.warn("loading namespace ".concat(p," for language ").concat(h," failed"),g),!g&&y&&s.log("loaded namespace ".concat(p," for language ").concat(h),y),i.loaded("".concat(h,"|").concat(p),g,y)})})})}}}]),t}();yk.type="backend";function H4(){if(console&&console.warn){for(var t,e=arguments.length,n=new Array(e),r=0;r2&&arguments[2]!==void 0?arguments[2]:{},r=e.languages[0],i=e.options?e.options.fallbackLng:!1,a=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var s=function(c,f){var h=e.services.backendConnector.state["".concat(c,"|").concat(f)];return h===-1||h===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!s(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(r,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||s(r,t)&&(!i||s(a,t)))}function q4(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return qv("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(t,{precheck:function(a,s){if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!s(a.isLanguageChangingTo,t))return!1}}):V4(t,e,n)}var K4=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Y4={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},X4=function(e){return Y4[e]},Q4=function(e){return e.replace(K4,X4)};function ob(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function sb(t){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};Kv=sb(sb({},Kv),t)}function Z4(){return Kv}var Sk;function eB(t){Sk=t}function tB(){return Sk}var nB={type:"3rdParty",init:function(e){J4(e.options.react),eB(e)}},rB=be.createContext(),iB=function(){function t(){Sr(this,t),this.usedNamespaces={}}return _r(t,[{key:"addUsedNamespaces",value:function(n){var r=this;n.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),t}();function aB(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,u=[],c=!0,f=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(h){f=!0,i=h}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(f)throw i}}return u}}function oB(t,e){return ok(t)||aB(t,e)||sk(t,e)||lk()}function lb(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function km(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},n=e.i18n,r=be.useContext(rB)||{},i=r.i18n,a=r.defaultNS,s=n||i||tB();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new iB),!s){qv("You will need to pass in an i18next instance by using initReactI18next");var u=function(X,K){return typeof K=="string"?K:K&&gr(K)==="object"&&typeof K.defaultValue=="string"?K.defaultValue:Array.isArray(X)?X[X.length-1]:X},c=[u,{},!1];return c.t=u,c.i18n={},c.ready=!1,c}s.options.react&&s.options.react.wait!==void 0&&qv("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var f=km(km(km({},Z4()),s.options.react),e),h=f.useSuspense,p=f.keyPrefix,g=t||a||s.options&&s.options.defaultNS;g=typeof g=="string"?[g]:g||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(g);var y=(s.isInitialized||s.initializedStoreOnce)&&g.every(function(U){return q4(U,s,f)});function v(){return s.getFixedT(null,f.nsMode==="fallback"?g:g[0],p)}var w=be.useState(v),x=oB(w,2),_=x[0],S=x[1],C=g.join(),O=sB(C),I=be.useRef(!0);be.useEffect(function(){var U=f.bindI18n,X=f.bindI18nStore;I.current=!0,!y&&!h&&ab(s,g,function(){I.current&&S(v)}),y&&O&&O!==C&&I.current&&S(v);function K(){I.current&&S(v)}return U&&s&&s.on(U,K),X&&s&&s.store.on(X,K),function(){I.current=!1,U&&s&&U.split(" ").forEach(function(te){return s.off(te,K)}),X&&s&&X.split(" ").forEach(function(te){return s.store.off(te,K)})}},[s,C]);var L=be.useRef(!0);be.useEffect(function(){I.current&&!L.current&&S(v),L.current=!1},[s,p]);var D=[_,s,y];if(D.t=_,D.i18n=s,D.ready=y,y||!y&&!h)return D;throw new Promise(function(U){ab(s,g,function(){U()})})}Ae.use(yk).use(hk).use(nB).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const uB={isConnected:!1,isProcessing:!1,log:[],shouldShowLogViewer:!1,shouldDisplayInProgressType:"latents",shouldDisplayGuides:!0,isGFPGANAvailable:!0,isESRGANAvailable:!0,socketId:"",shouldConfirmOnDelete:!0,openAccordions:[0],currentStep:0,totalSteps:0,currentIteration:0,totalIterations:0,currentStatus:Ae.isInitialized?Ae.t("common.statusDisconnected"):"Disconnected",currentStatusHasSteps:!1,model:"",model_id:"",model_hash:"",app_id:"",app_version:"",model_list:{},infill_methods:[],hasError:!1,wasErrorSeen:!0,isCancelable:!0,saveIntermediatesInterval:5,enableImageDebugging:!1,toastQueue:[],searchFolder:null,foundModels:null,openModel:null,cancelOptions:{cancelType:"immediate",cancelAfter:null}},_k=vo({name:"system",initialState:uB,reducers:{setShouldDisplayInProgressType:(t,e)=>{t.shouldDisplayInProgressType=e.payload},setIsProcessing:(t,e)=>{t.isProcessing=e.payload},setCurrentStatus:(t,e)=>{t.currentStatus=e.payload},setSystemStatus:(t,e)=>({...t,...e.payload}),errorOccurred:t=>{t.hasError=!0,t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusError"),t.wasErrorSeen=!1},errorSeen:t=>{t.hasError=!1,t.wasErrorSeen=!0,t.currentStatus=t.isConnected?Ae.t("common.statusConnected"):Ae.t("common.statusDisconnected")},addLogEntry:(t,e)=>{const{timestamp:n,message:r,level:i}=e.payload,s={timestamp:n,message:r,level:i||"info"};t.log.push(s)},setShouldShowLogViewer:(t,e)=>{t.shouldShowLogViewer=e.payload},setIsConnected:(t,e)=>{t.isConnected=e.payload,t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.hasError=!1},setSocketId:(t,e)=>{t.socketId=e.payload},setShouldConfirmOnDelete:(t,e)=>{t.shouldConfirmOnDelete=e.payload},setOpenAccordions:(t,e)=>{t.openAccordions=e.payload},setSystemConfig:(t,e)=>({...t,...e.payload}),setShouldDisplayGuides:(t,e)=>{t.shouldDisplayGuides=e.payload},processingCanceled:t=>{t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusProcessingCanceled")},generationRequested:t=>{t.isProcessing=!0,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusPreparing")},setModelList:(t,e)=>{t.model_list=e.payload},setIsCancelable:(t,e)=>{t.isCancelable=e.payload},modelChangeRequested:t=>{t.currentStatus=Ae.t("common.statusLoadingModel"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},modelConvertRequested:t=>{t.currentStatus=Ae.t("common.statusConvertingModel"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},modelMergingRequested:t=>{t.currentStatus=Ae.t("common.statusMergingModels"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},setSaveIntermediatesInterval:(t,e)=>{t.saveIntermediatesInterval=e.payload},setEnableImageDebugging:(t,e)=>{t.enableImageDebugging=e.payload},addToast:(t,e)=>{t.toastQueue.push(e.payload)},clearToastQueue:t=>{t.toastQueue=[]},setProcessingIndeterminateTask:(t,e)=>{t.isProcessing=!0,t.currentStatus=e.payload,t.currentStatusHasSteps=!1},setSearchFolder:(t,e)=>{t.searchFolder=e.payload},setFoundModels:(t,e)=>{t.foundModels=e.payload},setOpenModel:(t,e)=>{t.openModel=e.payload},setCancelType:(t,e)=>{t.cancelOptions.cancelType=e.payload},setCancelAfter:(t,e)=>{t.cancelOptions.cancelAfter=e.payload}}}),{setShouldDisplayInProgressType:eW,setIsProcessing:ei,addLogEntry:Gt,setShouldShowLogViewer:tW,setIsConnected:ub,setSocketId:nW,setShouldConfirmOnDelete:rW,setOpenAccordions:iW,setSystemStatus:cB,setCurrentStatus:ns,setSystemConfig:fB,setShouldDisplayGuides:aW,processingCanceled:dB,errorOccurred:cb,errorSeen:oW,setModelList:rs,setIsCancelable:Af,modelChangeRequested:hB,modelConvertRequested:pB,modelMergingRequested:gB,setSaveIntermediatesInterval:sW,setEnableImageDebugging:lW,generationRequested:mB,addToast:zl,clearToastQueue:uW,setProcessingIndeterminateTask:cW,setSearchFolder:vB,setFoundModels:yB,setOpenModel:fW,setCancelType:dW,setCancelAfter:hW}=_k.actions,SB=_k.reducer,wk=["txt2img","img2img","unifiedCanvas","nodes","postprocessing","training"],_B={activeTab:0,currentTheme:"dark",parametersPanelScrollPosition:0,shouldPinParametersPanel:!0,shouldShowParametersPanel:!0,shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,addNewModelUIOption:null,shouldPinGallery:!0,shouldShowGallery:!0},wB=_B,bk=vo({name:"ui",initialState:wB,reducers:{setActiveTab:(t,e)=>{typeof e.payload=="number"?t.activeTab=e.payload:t.activeTab=wk.indexOf(e.payload)},setCurrentTheme:(t,e)=>{t.currentTheme=e.payload},setParametersPanelScrollPosition:(t,e)=>{t.parametersPanelScrollPosition=e.payload},setShouldPinParametersPanel:(t,e)=>{t.shouldPinParametersPanel=e.payload,t.shouldShowParametersPanel=!0},setShouldShowParametersPanel:(t,e)=>{t.shouldShowParametersPanel=e.payload},setShouldShowImageDetails:(t,e)=>{t.shouldShowImageDetails=e.payload},setShouldUseCanvasBetaLayout:(t,e)=>{t.shouldUseCanvasBetaLayout=e.payload},setShouldShowExistingModelsInSearch:(t,e)=>{t.shouldShowExistingModelsInSearch=e.payload},setShouldUseSliders:(t,e)=>{t.shouldUseSliders=e.payload},setAddNewModelUIOption:(t,e)=>{t.addNewModelUIOption=e.payload},setShouldPinGallery:(t,e)=>{t.shouldPinGallery=e.payload},setShouldShowGallery:(t,e)=>{t.shouldShowGallery=e.payload},togglePinGalleryPanel:t=>{t.shouldPinGallery=!t.shouldPinGallery},togglePinParametersPanel:t=>{t.shouldPinParametersPanel=!t.shouldPinParametersPanel},toggleParametersPanel:t=>{t.shouldShowParametersPanel=!t.shouldShowParametersPanel},toggleGalleryPanel:t=>{t.shouldShowGallery=!t.shouldShowGallery},togglePanels:t=>{t.shouldShowGallery||t.shouldShowParametersPanel?(t.shouldShowGallery=!1,t.shouldShowParametersPanel=!1):(t.shouldShowGallery=!0,t.shouldShowParametersPanel=!0)}}}),{setActiveTab:pW,setCurrentTheme:gW,setParametersPanelScrollPosition:mW,setShouldPinParametersPanel:vW,setShouldShowParametersPanel:yW,setShouldShowImageDetails:SW,setShouldUseCanvasBetaLayout:_W,setShouldShowExistingModelsInSearch:wW,setShouldUseSliders:bW,setAddNewModelUIOption:CW,setShouldPinGallery:xW,setShouldShowGallery:kW,togglePanels:PW,togglePinGalleryPanel:EW,togglePinParametersPanel:OW,toggleParametersPanel:TW,toggleGalleryPanel:RW}=bk.actions,bB=bk.reducer,di=Object.create(null);di.open="0";di.close="1";di.ping="2";di.pong="3";di.message="4";di.upgrade="5";di.noop="6";const hd=Object.create(null);Object.keys(di).forEach(t=>{hd[di[t]]=t});const CB={type:"error",data:"parser error"},xB=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",kB=typeof ArrayBuffer=="function",PB=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Ck=({type:t,data:e},n,r)=>xB&&e instanceof Blob?n?r(e):fb(e,r):kB&&(e instanceof ArrayBuffer||PB(e))?n?r(e):fb(new Blob([e]),r):r(di[t]+(e||"")),fb=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)},db="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",eu=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t{let e=t.length*.75,n=t.length,r,i=0,a,s,u,c;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const f=new ArrayBuffer(e),h=new Uint8Array(f);for(r=0;r>4,h[i++]=(s&15)<<4|u>>2,h[i++]=(u&3)<<6|c&63;return f},OB=typeof ArrayBuffer=="function",xk=(t,e)=>{if(typeof t!="string")return{type:"message",data:kk(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:TB(t.substring(1),e)}:hd[n]?t.length>1?{type:hd[n],data:t.substring(1)}:{type:hd[n]}:CB},TB=(t,e)=>{if(OB){const n=EB(t);return kk(n,e)}else return{base64:!0,data:t}},kk=(t,e)=>{switch(e){case"blob":return t instanceof ArrayBuffer?new Blob([t]):t;case"arraybuffer":default:return t}},Pk=String.fromCharCode(30),RB=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((a,s)=>{Ck(a,!1,u=>{r[s]=u,++i===n&&e(r.join(Pk))})})},AB=(t,e)=>{const n=t.split(Pk),r=[];for(let i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function Ok(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const LB=fr.setTimeout,MB=fr.clearTimeout;function Jh(t,e){e.useNativeTimers?(t.setTimeoutFn=LB.bind(fr),t.clearTimeoutFn=MB.bind(fr)):(t.setTimeoutFn=fr.setTimeout.bind(fr),t.clearTimeoutFn=fr.clearTimeout.bind(fr))}const DB=1.33;function NB(t){return typeof t=="string"?BB(t):Math.ceil((t.byteLength||t.size)*DB)}function BB(t){let e=0,n=0;for(let r=0,i=t.length;r=57344?n+=3:(r++,n+=4);return n}class FB extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class Tk extends Rt{constructor(e){super(),this.writable=!1,Jh(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,n,r){return super.emitReserved("error",new FB(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=xk(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}}const Rk="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Yv=64,$B={};let hb=0,If=0,pb;function gb(t){let e="";do e=Rk[t%Yv]+e,t=Math.floor(t/Yv);while(t>0);return e}function Ak(){const t=gb(+new Date);return t!==pb?(hb=0,pb=t):t+"."+gb(hb++)}for(;If{this.readyState="paused",e()};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(e){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)};AB(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,RB(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const n=this.opts.secure?"https":"http";let r="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Ak()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(n==="https"&&Number(this.opts.port)!==443||n==="http"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port);const i=Ik(e),a=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(a?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new ui(this.uri(),e)}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class ui extends Rt{constructor(e,n){super(),Jh(this,n),this.opts=n,this.method=n.method||"GET",this.uri=e,this.async=n.async!==!1,this.data=n.data!==void 0?n.data:null,this.create()}create(){const e=Ok(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const n=this.xhr=new Mk(e);try{n.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{n.readyState===4&&(n.status===200||n.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof n.status=="number"?n.status:0)},0))},n.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=ui.requestsCount++,ui.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=UB,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ui.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}ui.requestsCount=0;ui.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",mb);else if(typeof addEventListener=="function"){const t="onpagehide"in fr?"pagehide":"unload";addEventListener(t,mb,!1)}}function mb(){for(let t in ui.requests)ui.requests.hasOwnProperty(t)&&ui.requests[t].abort()}const Dk=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0))(),Lf=fr.WebSocket||fr.MozWebSocket,vb=!0,HB="arraybuffer",yb=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class VB extends Tk{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),n=this.opts.protocols,r=yb?{}:Ok(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=vb&&!yb?n?new Lf(e,n):new Lf(e):new Lf(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType||HB,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n{const s={};try{vb&&this.ws.send(a)}catch{}i&&Dk(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const n=this.opts.secure?"wss":"ws";let r="";this.opts.port&&(n==="wss"&&Number(this.opts.port)!==443||n==="ws"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=Ak()),this.supportsBinary||(e.b64=1);const i=Ik(e),a=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(a?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}check(){return!!Lf}}const qB={websocket:VB,polling:WB},KB=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,YB=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Xv(t){const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=KB.exec(t||""),a={},s=14;for(;s--;)a[YB[s]]=i[s]||"";return n!=-1&&r!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=XB(a,a.path),a.queryKey=QB(a,a.query),a}function XB(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function QB(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(n[i]=a)}),n}let Nk=class os extends Rt{constructor(e,n={}){super(),this.writeBuffer=[],e&&typeof e=="object"&&(n=e,e=null),e?(e=Xv(e),n.hostname=e.host,n.secure=e.protocol==="https"||e.protocol==="wss",n.port=e.port,e.query&&(n.query=e.query)):n.host&&(n.hostname=Xv(n.host).host),Jh(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"],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:!0},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=zB(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(e){const n=Object.assign({},this.opts.query);n.EIO=Ek,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts.transportOptions[e],this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new qB[e](r)}open(){let e;if(this.opts.rememberUpgrade&&os.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.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(e){let n=this.createTransport(e),r=!1;os.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",p=>{if(!r)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;os.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(h(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const g=new Error("probe error");g.transport=n.name,this.emitReserved("upgradeError",g)}}))};function a(){r||(r=!0,h(),n.close(),n=null)}const s=p=>{const g=new Error("probe error: "+p);g.transport=n.name,a(),this.emitReserved("upgradeError",g)};function u(){s("transport closed")}function c(){s("socket closed")}function f(p){n&&p.name!==n.name&&a()}const h=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",u),this.off("close",c),this.off("upgrading",f)};n.once("open",i),n.once("error",s),n.once("close",u),this.once("close",c),this.once("upgrading",f),n.open()}onOpen(){if(this.readyState="open",os.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const n=this.upgrades.length;for(;e{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 e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.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(e,n,r){return this.sendPacket("message",e,n,r),this}send(e,n,r){return this.sendPacket("message",e,n,r),this}sendPacket(e,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 a={type:e,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},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():e()}):this.upgrading?r():e()),this}onError(e){os.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,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",e,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const n=[];let r=0;const i=e.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,Bk=Object.prototype.toString,tF=typeof Blob=="function"||typeof Blob<"u"&&Bk.call(Blob)==="[object BlobConstructor]",nF=typeof File=="function"||typeof File<"u"&&Bk.call(File)==="[object FileConstructor]";function T0(t){return ZB&&(t instanceof ArrayBuffer||eF(t))||tF&&t instanceof Blob||nF&&t instanceof File}function pd(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n=0&&t.num0;case Be.ACK:case Be.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class sF{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=iF(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const lF=Object.freeze(Object.defineProperty({__proto__:null,Decoder:R0,Encoder:oF,get PacketType(){return Be},protocol:aF},Symbol.toStringTag,{value:"Module"}));function Dr(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const uF=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Fk extends Rt{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Dr(e,"open",this.onopen.bind(this)),Dr(e,"packet",this.onpacket.bind(this)),Dr(e,"error",this.onerror.bind(this)),Dr(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){if(uF.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const r={type:Be.EVENT,data:n};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const s=this.ids++,u=n.pop();this._registerAckCallback(s,u),r.id=s}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[e]=n;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let s=0;s{this.io.clearTimeoutFn(a),n.apply(this,[null,...s])}}emitWithAck(e,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,a)=>{n.push((s,u)=>r?s?a(s):i(u):i(s)),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...a)=>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,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Be.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Be.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 Be.EVENT:case Be.BINARY_EVENT:this.onevent(e);break;case Be.ACK:case Be.BINARY_ACK:this.onack(e);break;case Be.DISCONNECT:this.ondisconnect();break;case Be.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Be.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(n.apply(this,e.data),delete this.acks[e.id])}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Be.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r0&&t.jitter<=1?t.jitter:0,this.attempts=0}Vs.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0};Vs.prototype.reset=function(){this.attempts=0};Vs.prototype.setMin=function(t){this.ms=t};Vs.prototype.setMax=function(t){this.max=t};Vs.prototype.setJitter=function(t){this.jitter=t};class Zv extends Rt{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Jh(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 Vs({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||lF;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Nk(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Dr(n,"open",function(){r.onopen(),e&&e()}),a=Dr(n,"error",s=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",s),e?e(s):r.maybeReconnectOnOpen()});if(this._timeout!==!1){const s=this._timeout;s===0&&i();const u=this.setTimeoutFn(()=>{i(),n.close(),n.emit("error",new Error("timeout"))},s);this.opts.autoUnref&&u.unref(),this.subs.push(function(){clearTimeout(u)})}return this.subs.push(i),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Dr(e,"ping",this.onping.bind(this)),Dr(e,"data",this.ondata.bind(this)),Dr(e,"error",this.onerror.bind(this)),Dr(e,"close",this.onclose.bind(this)),Dr(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Dk(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new Fk(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;re()),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(e,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=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(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(function(){clearTimeout(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Gl={};function gd(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=JB(t,e.path||"/socket.io"),r=n.source,i=n.id,a=n.path,s=Gl[i]&&a in Gl[i].nsps,u=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let c;return u?c=new Zv(r,e):(Gl[i]||(Gl[i]=new Zv(r,e)),c=Gl[i]),n.query&&!e.query&&(e.query=n.queryKey),c.socket(n.path,e)}Object.assign(gd,{Manager:Zv,Socket:Fk,io:gd,connect:gd});const AW=["ddim","plms","k_lms","k_dpm_2","k_dpm_2_a","k_dpmpp_2","k_dpmpp_2_a","k_euler","k_euler_a","k_heun"],IW=["ddim","plms","k_lms","dpmpp_2","k_dpm_2","k_dpm_2_a","k_dpmpp_2","k_euler","k_euler_a","k_heun"],LW=[64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048],MW=[64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048],DW=[{key:"2x",value:2},{key:"4x",value:4}],cF=0,fF=4294967295,NW=["gfpgan","codeformer"],BW=[{key:"None",value:"none"},{key:"Fast",value:"latents"},{key:"Accurate",value:"full-res"}];var dF=Math.PI/180;function hF(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const Os=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},pe={_global:Os,version:"8.4.2",isBrowser:hF(),isUnminified:/param/.test(function(t){}.toString()),dblClickWindow:400,getAngle(t){return pe.angleDeg?t*dF:t},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 pe.DD.isDragging},isDragReady(){return!!pe.DD.node},releaseCanvasOnDestroy:!0,document:Os.document,_injectGlobal(t){Os.Konva=t}},yt=t=>{pe[t.prototype.getClassName()]=t};pe._injectGlobal(pe);class Wn{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.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 Wn(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){var n=this.m;return{x:n[0]*e.x+n[2]*e.y+n[4],y:n[1]*e.x+n[3]*e.y+n[5]}}translate(e,n){return this.m[4]+=this.m[0]*e+this.m[2]*n,this.m[5]+=this.m[1]*e+this.m[3]*n,this}scale(e,n){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=n,this.m[3]*=n,this}rotate(e){var n=Math.cos(e),r=Math.sin(e),i=this.m[0]*n+this.m[2]*r,a=this.m[1]*n+this.m[3]*r,s=this.m[0]*-r+this.m[2]*n,u=this.m[1]*-r+this.m[3]*n;return this.m[0]=i,this.m[1]=a,this.m[2]=s,this.m[3]=u,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,n){var r=this.m[0]+this.m[2]*n,i=this.m[1]+this.m[3]*n,a=this.m[2]+this.m[0]*e,s=this.m[3]+this.m[1]*e;return this.m[0]=r,this.m[1]=i,this.m[2]=a,this.m[3]=s,this}multiply(e){var n=this.m[0]*e.m[0]+this.m[2]*e.m[1],r=this.m[1]*e.m[0]+this.m[3]*e.m[1],i=this.m[0]*e.m[2]+this.m[2]*e.m[3],a=this.m[1]*e.m[2]+this.m[3]*e.m[3],s=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],u=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this.m[4]=s,this.m[5]=u,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*e,r=-this.m[1]*e,i=-this.m[2]*e,a=this.m[0]*e,s=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),u=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this.m[4]=s,this.m[5]=u,this}getMatrix(){return this.m}decompose(){var e=this.m[0],n=this.m[1],r=this.m[2],i=this.m[3],a=this.m[4],s=this.m[5],u=e*i-n*r;let c={x:a,y:s,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||n!=0){var f=Math.sqrt(e*e+n*n);c.rotation=n>0?Math.acos(e/f):-Math.acos(e/f),c.scaleX=f,c.scaleY=u/f,c.skewX=(e*r+n*i)/u,c.skewY=0}else if(r!=0||i!=0){var h=Math.sqrt(r*r+i*i);c.rotation=Math.PI/2-(i>0?Math.acos(-r/h):-Math.acos(r/h)),c.scaleX=u/h,c.scaleY=h,c.skewX=0,c.skewY=(e*r+n*i)/u}return c.rotation=G._getRotation(c.rotation),c}}var pF="[object Array]",gF="[object Number]",mF="[object String]",vF="[object Boolean]",yF=Math.PI/180,SF=180/Math.PI,Pm="#",_F="",wF="0",bF="Konva warning: ",Sb="Konva error: ",CF="rgb(",Em={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]},xF=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,Mf=[];const kF=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(t){setTimeout(t,60)},G={_isElement(t){return!!(t&&t.nodeType==1)},_isFunction(t){return!!(t&&t.constructor&&t.call&&t.apply)},_isPlainObject(t){return!!t&&t.constructor===Object},_isArray(t){return Object.prototype.toString.call(t)===pF},_isNumber(t){return Object.prototype.toString.call(t)===gF&&!isNaN(t)&&isFinite(t)},_isString(t){return Object.prototype.toString.call(t)===mF},_isBoolean(t){return Object.prototype.toString.call(t)===vF},isObject(t){return t instanceof Object},isValidSelector(t){if(typeof t!="string")return!1;var e=t[0];return e==="#"||e==="."||e===e.toUpperCase()},_sign(t){return t===0||t>0?1:-1},requestAnimFrame(t){Mf.push(t),Mf.length===1&&kF(function(){const e=Mf;Mf=[],e.forEach(function(n){n()})})},createCanvasElement(){var t=document.createElement("canvas");try{t.style=t.style||{}}catch{}return t},createImageElement(){return document.createElement("img")},_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(t,e){var n=G.createImageElement();n.onload=function(){e(n)},n.src=t},_rgbToHex(t,e,n){return((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)},_hexToRgb(t){t=t.replace(Pm,_F);var e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:e&255}},getRandomColor(){for(var t=(Math.random()*16777215<<0).toString(16);t.length<6;)t=wF+t;return Pm+t},getRGB(t){var e;return t in Em?(e=Em[t],{r:e[0],g:e[1],b:e[2]}):t[0]===Pm?this._hexToRgb(t.substring(1)):t.substr(0,4)===CF?(e=xF.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA(t){return t=t||"black",G._namedColorToRBA(t)||G._hex3ColorToRGBA(t)||G._hex4ColorToRGBA(t)||G._hex6ColorToRGBA(t)||G._hex8ColorToRGBA(t)||G._rgbColorToRGBA(t)||G._rgbaColorToRGBA(t)||G._hslColorToRGBA(t)},_namedColorToRBA(t){var e=Em[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(t){if(t.indexOf("rgb(")===0){t=t.match(/rgb\(([^)]+)\)/)[1];var e=t.split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(t){if(t.indexOf("rgba(")===0){t=t.match(/rgba\(([^)]+)\)/)[1];var e=t.split(/ *, */).map((n,r)=>n.slice(-1)==="%"?r===3?parseInt(n)/100:parseInt(n)/100*255:Number(n));return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex8ColorToRGBA(t){if(t[0]==="#"&&t.length===9)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:parseInt(t.slice(7,9),16)/255}},_hex6ColorToRGBA(t){if(t[0]==="#"&&t.length===7)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex4ColorToRGBA(t){if(t[0]==="#"&&t.length===5)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:parseInt(t[4]+t[4],16)/255}},_hex3ColorToRGBA(t){if(t[0]==="#"&&t.length===4)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_hslColorToRGBA(t){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)){const[e,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),r=Number(n[0])/360,i=Number(n[1])/100,a=Number(n[2])/100;let s,u,c;if(i===0)return c=a*255,{r:Math.round(c),g:Math.round(c),b:Math.round(c),a:1};a<.5?s=a*(1+i):s=a+i-a*i;const f=2*a-s,h=[0,0,0];for(let p=0;p<3;p++)u=r+1/3*-(p-1),u<0&&u++,u>1&&u--,6*u<1?c=f+(s-f)*6*u:2*u<1?c=s:3*u<2?c=f+(s-f)*(2/3-u)*6:c=f,h[p]=c*255;return{r:Math.round(h[0]),g:Math.round(h[1]),b:Math.round(h[2]),a:1}}},haveIntersection(t,e){return!(e.x>t.x+t.width||e.x+e.widtht.y+t.height||e.y+e.height1?(s=n,u=r,c=(n-i)*(n-i)+(r-a)*(r-a)):(s=t+h*(n-t),u=e+h*(r-e),c=(s-i)*(s-i)+(u-a)*(u-a))}return[s,u,c]},_getProjectionToLine(t,e,n){var r=G.cloneObject(t),i=Number.MAX_VALUE;return e.forEach(function(a,s){if(!(!n&&s===e.length-1)){var u=e[(s+1)%e.length],c=G._getProjectionToSegment(a.x,a.y,u.x,u.y,t.x,t.y),f=c[0],h=c[1],p=c[2];pe.length){var s=e;e=t,t=s}for(r=0;r{e.width=0,e.height=0})},drawRoundedRectPath(t,e,n,r){let i=0,a=0,s=0,u=0;typeof r=="number"?i=a=s=u=Math.min(r,e/2,n/2):(i=Math.min(r[0]||0,e/2,n/2),a=Math.min(r[1]||0,e/2,n/2),u=Math.min(r[2]||0,e/2,n/2),s=Math.min(r[3]||0,e/2,n/2)),t.moveTo(i,0),t.lineTo(e-a,0),t.arc(e-a,a,a,Math.PI*3/2,0,!1),t.lineTo(e,n-u),t.arc(e-u,n-u,u,0,Math.PI/2,!1),t.lineTo(s,n),t.arc(s,n-s,s,Math.PI/2,Math.PI,!1),t.lineTo(0,i),t.arc(i,i,i,Math.PI,Math.PI*3/2,!1)}};function Da(t){return G._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||G._isBoolean(t)?t:Object.prototype.toString.call(t)}function $k(t){return t>255?255:t<0?0:Math.round(t)}function le(){if(pe.isUnminified)return function(t,e){return G._isNumber(t)||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function A0(t){if(pe.isUnminified)return function(e,n){let r=G._isNumber(e),i=G._isArray(e)&&e.length==t;return!r&&!i&&G.warn(Da(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+t+")"),e}}function I0(){if(pe.isUnminified)return function(t,e){var n=G._isNumber(t),r=t==="auto";return n||r||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function qs(){if(pe.isUnminified)return function(t,e){return G._isString(t)||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function zk(){if(pe.isUnminified)return function(t,e){const n=G._isString(t),r=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return n||r||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function PF(){if(pe.isUnminified)return function(t,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&t instanceof n||(G._isArray(t)?t.forEach(function(r){G._isNumber(r)||G.warn('"'+e+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function jr(){if(pe.isUnminified)return function(t,e){var n=t===!0||t===!1;return n||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function EF(t){if(pe.isUnminified)return function(e,n){return e==null||G.isObject(e)||G.warn(Da(e)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+t),e}}var Ul="get",jl="set";const A={addGetterSetter(t,e,n,r,i){A.addGetter(t,e,n),A.addSetter(t,e,r,i),A.addOverloadedGetterSetter(t,e)},addGetter(t,e,n){var r=Ul+G._capitalize(e);t.prototype[r]=t.prototype[r]||function(){var i=this.attrs[e];return i===void 0?n:i}},addSetter(t,e,n,r){var i=jl+G._capitalize(e);t.prototype[i]||A.overWriteSetter(t,e,n,r)},overWriteSetter(t,e,n,r){var i=jl+G._capitalize(e);t.prototype[i]=function(a){return n&&a!==void 0&&a!==null&&(a=n.call(this,a,e)),this._setAttr(e,a),r&&r.call(this),this}},addComponentsGetterSetter(t,e,n,r,i){var a=n.length,s=G._capitalize,u=Ul+s(e),c=jl+s(e),f,h;t.prototype[u]=function(){var g={};for(f=0;f{this._setAttr(e+s(w),void 0)}),this._fireChangeEvent(e,y,g),i&&i.call(this),this},A.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter(t,e){var n=G._capitalize(e),r=jl+n,i=Ul+n;t.prototype[e]=function(){return arguments.length?(this[r](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(t,e,n,r){G.error("Adding deprecated "+e);var i=Ul+G._capitalize(e),a=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[i]=function(){G.error(a);var s=this.attrs[e];return s===void 0?n:s},A.addSetter(t,e,r,function(){G.error(a)}),A.addOverloadedGetterSetter(t,e)},backCompat(t,e){G.each(e,function(n,r){var i=t.prototype[r],a=Ul+G._capitalize(n),s=jl+G._capitalize(n);function u(){i.apply(this,arguments),G.error('"'+n+'" method is deprecated and will be removed soon. Use ""'+r+'" instead.')}t.prototype[n]=u,t.prototype[a]=u,t.prototype[s]=u})},afterSetFilter(){this._filterUpToDate=!1}};function OF(t){var e=[],n=t.length,r=G,i,a;for(i=0;itypeof h=="number"?Math.floor(h):h)),a+=TF+f.join(_b)+RF)):(a+=u.property,e||(a+=DF+u.val)),a+=LF;return a}clearTrace(){this.traceArr=[]}_trace(e){var n=this.traceArr,r;n.push(e),r=n.length,r>=BF&&n.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var n=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(e){var n=e.getLineCap();n&&this.setAttr("lineCap",n)}_applyOpacity(e){var n=e.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(e){var n=e.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(e,n){this._context[e]=n}arc(e,n,r,i,a,s){this._context.arc(e,n,r,i,a,s)}arcTo(e,n,r,i,a){this._context.arcTo(e,n,r,i,a)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,r,i,a,s){this._context.bezierCurveTo(e,n,r,i,a,s)}clearRect(e,n,r,i){this._context.clearRect(e,n,r,i)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(e,n){var r=arguments;if(r.length===2)return this._context.createImageData(e,n);if(r.length===1)return this._context.createImageData(e)}createLinearGradient(e,n,r,i){return this._context.createLinearGradient(e,n,r,i)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,r,i,a,s){return this._context.createRadialGradient(e,n,r,i,a,s)}drawImage(e,n,r,i,a,s,u,c,f){var h=arguments,p=this._context;h.length===3?p.drawImage(e,n,r):h.length===5?p.drawImage(e,n,r,i,a):h.length===9&&p.drawImage(e,n,r,i,a,s,u,c,f)}ellipse(e,n,r,i,a,s,u,c){this._context.ellipse(e,n,r,i,a,s,u,c)}isPointInPath(e,n,r,i){return r?this._context.isPointInPath(r,e,n,i):this._context.isPointInPath(e,n,i)}fill(e){e?this._context.fill(e):this._context.fill()}fillRect(e,n,r,i){this._context.fillRect(e,n,r,i)}strokeRect(e,n,r,i){this._context.strokeRect(e,n,r,i)}fillText(e,n,r,i){i?this._context.fillText(e,n,r,i):this._context.fillText(e,n,r)}measureText(e){return this._context.measureText(e)}getImageData(e,n,r,i){return this._context.getImageData(e,n,r,i)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,r,i){this._context.rect(e,n,r,i)}putImageData(e,n,r){this._context.putImageData(e,n,r)}quadraticCurveTo(e,n,r,i){this._context.quadraticCurveTo(e,n,r,i)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,n){this._context.scale(e,n)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,n,r,i,a,s){this._context.setTransform(e,n,r,i,a,s)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,n,r,i){this._context.strokeText(e,n,r,i)}transform(e,n,r,i,a,s){this._context.transform(e,n,r,i,a,s)}translate(e,n){this._context.translate(e,n)}_enableTrace(){var e=this,n=wb.length,r=this.setAttr,i,a,s=function(u){var c=e[u],f;e[u]=function(){return a=OF(Array.prototype.slice.call(arguments,0)),f=c.apply(e,arguments),e._trace({method:u,args:a}),f}};for(i=0;i{e.dragStatus==="dragging"&&(t=!0)}),t},justDragged:!1,get node(){var t;return Ge._dragElements.forEach(e=>{t=e.node}),t},_dragElements:new Map,_drag(t){const e=[];Ge._dragElements.forEach((n,r)=>{const{node:i}=n,a=i.getStage();a.setPointersPositions(t),n.pointerId===void 0&&(n.pointerId=G._getFirstPointerId(t));const s=a._changedPointerPositions.find(f=>f.id===n.pointerId);if(s){if(n.dragStatus!=="dragging"){var u=i.dragDistance(),c=Math.max(Math.abs(s.x-n.startPointerPos.x),Math.abs(s.y-n.startPointerPos.y));if(c{n.fire("dragmove",{type:"dragmove",target:n,evt:t},!0)})},_endDragBefore(t){const e=[];Ge._dragElements.forEach(n=>{const{node:r}=n,i=r.getStage();if(t&&i.setPointersPositions(t),!i._changedPointerPositions.find(u=>u.id===n.pointerId))return;(n.dragStatus==="dragging"||n.dragStatus==="stopped")&&(Ge.justDragged=!0,pe._mouseListenClick=!1,pe._touchListenClick=!1,pe._pointerListenClick=!1,n.dragStatus="stopped");const s=n.node.getLayer()||n.node instanceof pe.Stage&&n.node;s&&e.indexOf(s)===-1&&e.push(s)}),e.forEach(n=>{n.draw()})},_endDragAfter(t){Ge._dragElements.forEach((e,n)=>{e.dragStatus==="stopped"&&e.node.fire("dragend",{type:"dragend",target:e.node,evt:t},!0),e.dragStatus!=="dragging"&&Ge._dragElements.delete(n)})}};pe.isBrowser&&(window.addEventListener("mouseup",Ge._endDragBefore,!0),window.addEventListener("touchend",Ge._endDragBefore,!0),window.addEventListener("mousemove",Ge._drag),window.addEventListener("touchmove",Ge._drag),window.addEventListener("mouseup",Ge._endDragAfter,!1),window.addEventListener("touchend",Ge._endDragAfter,!1));var md="absoluteOpacity",Nf="allEventListeners",Ii="absoluteTransform",bb="absoluteScale",Xa="canvas",GF="Change",UF="children",jF="konva",ey="listening",Cb="mouseenter",xb="mouseleave",kb="set",Pb="Shape",vd=" ",Eb="stage",ua="transform",WF="Stage",ty="visible",HF=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(vd);let VF=1;class se{constructor(e){this._id=VF++,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(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===ua||e===Ii)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,n){var r=this._cache.get(e),i=e===ua||e===Ii,a=r===void 0||i&&r.dirty===!0;return a&&(r=n.call(this),this._cache.set(e,r)),r}_calculate(e,n,r){if(!this._attachedDepsListeners.get(e)){const i=n.map(a=>a+"Change.konva").join(vd);this.on(i,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,r)}_getCanvasCache(){return this._cache.get(Xa)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Ii&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Xa)){const{scene:e,filter:n,hit:r}=this._cache.get(Xa);G.releaseCanvas(e,n,r),this._cache.delete(Xa)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var n=e||{},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),a=Math.ceil(n.height||r.height),s=n.pixelRatio,u=n.x===void 0?Math.floor(r.x):n.x,c=n.y===void 0?Math.floor(r.y):n.y,f=n.offset||0,h=n.drawBorder||!1,p=n.hitCanvasPixelRatio||1;if(!i||!a){G.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=f*2+1,a+=f*2+1,u-=f,c-=f;var g=new Ts({pixelRatio:s,width:i,height:a}),y=new Ts({pixelRatio:s,width:0,height:0}),v=new L0({pixelRatio:p,width:i,height:a}),w=g.getContext(),x=v.getContext();return v.isCache=!0,g.isCache=!0,this._cache.delete(Xa),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(g.getContext()._context.imageSmoothingEnabled=!1,y.getContext()._context.imageSmoothingEnabled=!1),w.save(),x.save(),w.translate(-u,-c),x.translate(-u,-c),this._isUnderCache=!0,this._clearSelfAndDescendantCache(md),this._clearSelfAndDescendantCache(bb),this.drawScene(g,this),this.drawHit(v,this),this._isUnderCache=!1,w.restore(),x.restore(),h&&(w.save(),w.beginPath(),w.rect(0,0,i,a),w.closePath(),w.setAttr("strokeStyle","red"),w.setAttr("lineWidth",5),w.stroke(),w.restore()),this._cache.set(Xa,{scene:g,filter:y,hit:v,x:u,y:c}),this._requestDraw(),this}isCached(){return this._cache.has(Xa)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,n){var r=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],i,a,s,u,c=this.getAbsoluteTransform(n);return r.forEach(function(f){var h=c.point(f);i===void 0&&(i=s=h.x,a=u=h.y),i=Math.min(i,h.x),a=Math.min(a,h.y),s=Math.max(s,h.x),u=Math.max(u,h.y)}),{x:i,y:a,width:s-i,height:u-a}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();e.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;e.drawImage(r._canvas,0,0,r.width/i,r.height/i),e.restore()}_drawCachedHitCanvas(e){var n=this._getCanvasCache(),r=n.hit;e.save(),e.translate(n.x,n.y),e.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,a=i.getContext(),s,u,c,f;if(e){if(!this._filterUpToDate){var h=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(s=e.length,a.clear(),a.drawImage(r._canvas,0,0,r.getWidth()/h,r.getHeight()/h),u=a.getImageData(0,0,i.getWidth(),i.getHeight()),c=0;c{var n,r;if(!e)return this;for(n in e)n!==UF&&(r=kb+G._capitalize(n),G._isFunction(this[r])?this[r](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(ey,this._isListening)}_isListening(e){if(!this.listening())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isListening(e):!0}isVisible(){return this._getCache(ty,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isVisible(e):!0}shouldDrawHit(e,n=!1){if(e)return this._isVisible(e)&&this._isListening(e);var r=this.getLayer(),i=!1;Ge._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(i=!0)});var a=!n&&!pe.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e=this.getDepth(),n=this,r=0,i,a,s,u;function c(f){for(i=[],a=f.length,s=0;s0&&i[0].getDepth()<=e&&c(i)}return n.nodeType!==WF&&c(n.getStage().getChildren()),r}getDepth(){for(var e=0,n=this.parent;n;)e++,n=n.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(ua),this._clearSelfAndDescendantCache(Ii)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var e=this.getStage().getPointerPosition();if(!e)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(e)}getAbsolutePosition(e){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!e&&(e=!0);var i=this.getAbsoluteTransform(e).getMatrix(),a=new Wn,s=this.offset();return a.m=i.slice(),a.translate(s.x,s.y),a.getTranslation()}setAbsolutePosition(e){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(ua);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(e.x,e.y),e={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:e.x,y:e.y}),this._clearCache(ua),this._clearSelfAndDescendantCache(Ii),this}_setTransform(e){var n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){var e={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,e}move(e){var n=e.x,r=e.y,i=this.x(),a=this.y();return n!==void 0&&(i+=n),r!==void 0&&(a+=r),this.setPosition({x:i,y:a}),this}_eachAncestorReverse(e,n){var r=[],i=this.getParent(),a,s;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(a=r.length,s=0;s0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return G.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return G.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&G.warn("Unexpected value "+e+" 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(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(md,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(e*=n.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e={},n=this.getAttrs(),r,i,a,s,u;e.attrs={};for(r in n)i=n[r],u=G.isObject(i)&&!G._isPlainObject(i)&&!G._isArray(i),!u&&(a=typeof this[r]=="function"&&this[r],delete n[r],s=a?a.call(this):null,n[r]=i,s!==i&&(e.attrs[r]=i));return e.className=this.getClassName(),G._prepareToStringify(e)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,r){var i=[];n&&this._isMatch(e)&&i.push(this);for(var a=this.parent;a;){if(a===r)return i;a._isMatch(e)&&i.push(a),a=a.parent}return i}isAncestorOf(e){return!1}findAncestor(e,n,r){return this.findAncestors(e,n,r)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);var n=e.replace(/ /g,"").split(","),r=n.length,i,a;for(i=0;i{try{const i=e==null?void 0:e.callback;i&&delete e.callback,G._urlToImage(this.toDataURL(e),function(a){n(a),i==null||i(a)})}catch(i){r(i)}})}toBlob(e){return new Promise((n,r)=>{try{const i=e==null?void 0:e.callback;i&&delete e.callback,this.toCanvas(e).toBlob(a=>{n(a),i==null||i(a)})}catch(i){r(i)}})}setSize(e){return this.width(e.width),this.height(e.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():pe.dragDistance}_off(e,n,r){var i=this.eventListeners[e],a,s,u;for(a=0;a=0;if(r&&!this.isDragging()){var i=!1;Ge._dragElements.forEach(a=>{this.isAncestorOf(a.node)&&(i=!0)}),i||this._createDragElement(e)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var e=this.getStage();if(!e)return;const n=Ge._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Ge._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return G.haveIntersection(r,this.getClientRect())}static create(e,n){return G._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){var r=se.prototype.getClassName.call(e),i=e.children,a,s,u;n&&(e.attrs.container=n),pe[r]||(G.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const c=pe[r];if(a=new c(e.attrs),i)for(s=i.length,u=0;u0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(e,n){var r=[];return this._descendants(i=>{const a=i._isMatch(e);return a&&r.push(i),!!(a&&n)}),r}_descendants(e){let n=!1;const r=this.getChildren();for(const i of r){if(n=e(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(e),n))return!0}return!1}toObject(){var e=se.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(n=>{e.children.push(n.toObject())}),e}isAncestorOf(e){for(var n=e.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){var n=se.prototype.clone.call(this,e);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(e){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(e)&&n.push(r)}),n}_clearSelfAndDescendantCache(e){var n;super._clearSelfAndDescendantCache(e),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(e,n){var r=this.getLayer(),i=e||r&&r.getCanvas(),a=i&&i.getContext(),s=this._getCanvasCache(),u=s&&s.scene,c=i&&i.isCache;if(!this.isVisible()&&!c)return this;if(u){a.save();var f=this.getAbsoluteTransform(n).getMatrix();a.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=e||r&&r.hitCanvas,a=i&&i.getContext(),s=this._getCanvasCache(),u=s&&s.hit;if(u){a.save();var c=this.getAbsoluteTransform(n).getMatrix();a.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedHitCanvas(a),a.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(e,n,r){var i,a=n&&n.getContext(),s=this.clipWidth(),u=this.clipHeight(),c=this.clipFunc(),f=s&&u||c;const h=r===this;if(f){a.save();var p=this.getAbsoluteTransform(r),g=p.getMatrix();if(a.transform(g[0],g[1],g[2],g[3],g[4],g[5]),a.beginPath(),c)c.call(this,a,this);else{var y=this.clipX(),v=this.clipY();a.rect(y,v,s,u)}a.clip(),g=p.copy().invert().getMatrix(),a.transform(g[0],g[1],g[2],g[3],g[4],g[5])}var w=!h&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";w&&(a.save(),a._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(x){x[e](n,r)}),w&&a.restore(),f&&a.restore()}getClientRect(e){var n;e=e||{};var r=e.skipTransform,i=e.relativeTo,a,s,u,c,f={x:1/0,y:1/0,width:0,height:0},h=this;(n=this.children)===null||n===void 0||n.forEach(function(w){if(w.visible()){var x=w.getClientRect({relativeTo:h,skipShadow:e.skipShadow,skipStroke:e.skipStroke});x.width===0&&x.height===0||(a===void 0?(a=x.x,s=x.y,u=x.x+x.width,c=x.y+x.height):(a=Math.min(a,x.x),s=Math.min(s,x.y),u=Math.max(u,x.x+x.width),c=Math.max(c,x.y+x.height)))}});for(var p=this.find("Shape"),g=!1,y=0;yt.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",is=t=>{const e=iu(t);if(e==="pointer")return pe.pointerEventsEnabled&&Tm.pointer;if(e==="touch")return Tm.touch;if(e==="mouse")return Tm.mouse};function Tb(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&G.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}const ZF="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);",yd=[];class tp extends qn{constructor(e){super(Tb(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),yd.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{Tb(this.attrs)}),this._checkVisibility()}_validateAdd(e){const n=e.getType()==="Layer",r=e.getType()==="FastLayer";n||r||G.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if(typeof e===KF){if(e.charAt(0)==="."){var n=e.slice(1);e=document.getElementsByClassName(n)[0]}else{var r;e.charAt(0)!=="#"?r=e:r=e.slice(1),e=document.getElementById(r)}if(!e)throw"Can not find container in document with id "+r}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var e=this.children,n=e.length,r;for(r=0;r-1&&yd.splice(n,1),G.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(G.warn(ZF),null)}_getPointerById(e){return this._pointerPositions.find(n=>n.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e=e||{},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var n=new Ts({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),r=n.getContext()._context,i=this.children;return(e.x||e.y)&&r.translate(-1*e.x,-1*e.y),i.forEach(function(a){if(a.isVisible()){var s=a._toKonvaCanvas(e);r.drawImage(s._canvas,e.x,e.y,s.getWidth()/s.getPixelRatio(),s.getHeight()/s.getPixelRatio())}}),n}getIntersection(e){if(!e)return null;var n=this.children,r=n.length,i=r-1,a;for(a=i;a>=0;a--){const s=n[a].getIntersection(e);if(s)return s}return null}_resizeDOM(){var e=this.width(),n=this.height();this.content&&(this.content.style.width=e+Ob,this.content.style.height=n+Ob),this.bufferCanvas.setSize(e,n),this.bufferHitCanvas.setSize(e,n),this.children.forEach(r=>{r.setSize({width:e,height:n}),r.draw()})}add(e,...n){if(arguments.length>1){for(var r=0;rQF&&G.warn("The stage has "+i+" 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."),e.setSize({width:this.width(),height:this.height()}),e.draw(),pe.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return Uk(e,this)}setPointerCapture(e){jk(e,this)}releaseCapture(e){mu(e)}getLayers(){return this.children}_bindContentEvents(){pe.isBrowser&&JF.forEach(([e,n])=>{this.content.addEventListener(e,r=>{this[n](r)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const n=is(e.type);this._fire(n.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const n=is(e.type);this._fire(n.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let n=this[e+"targetShape"];return n&&!n.getStage()&&(n=null),n}_pointerleave(e){const n=is(e.type),r=iu(e.type);if(n){this.setPointersPositions(e);var i=this._getTargetShape(r),a=!Ge.isDragging||pe.hitOnDragEnabled;i&&a?(i._fireAndBubble(n.pointerout,{evt:e}),i._fireAndBubble(n.pointerleave,{evt:e}),this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this[r+"targetShape"]=null):a&&(this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(n.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(e){const n=is(e.type),r=iu(e.type);if(n){this.setPointersPositions(e);var i=!1;this._changedPointerPositions.forEach(a=>{var s=this.getIntersection(a);if(Ge.justDragged=!1,pe["_"+r+"ListenClick"]=!0,!(s&&s.isListening()))return;pe.capturePointerEventsEnabled&&s.setPointerCapture(a.id),this[r+"ClickStartShape"]=s,s._fireAndBubble(n.pointerdown,{evt:e,pointerId:a.id}),i=!0;const c=e.type.indexOf("touch")>=0;s.preventDefault()&&e.cancelable&&c&&e.preventDefault()}),i||this._fire(n.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(e){const n=is(e.type),r=iu(e.type);if(!n)return;Ge.isDragging&&Ge.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e);var i=!Ge.isDragging||pe.hitOnDragEnabled;if(!i)return;var a={};let s=!1;var u=this._getTargetShape(r);this._changedPointerPositions.forEach(c=>{const f=Om(c.id)||this.getIntersection(c),h=c.id,p={evt:e,pointerId:h};var g=u!==f;if(g&&u&&(u._fireAndBubble(n.pointerout,Object.assign({},p),f),u._fireAndBubble(n.pointerleave,Object.assign({},p),f)),f){if(a[f._id])return;a[f._id]=!0}f&&f.isListening()?(s=!0,g&&(f._fireAndBubble(n.pointerover,Object.assign({},p),u),f._fireAndBubble(n.pointerenter,Object.assign({},p),u),this[r+"targetShape"]=f),f._fireAndBubble(n.pointermove,Object.assign({},p))):u&&(this._fire(n.pointerover,{evt:e,target:this,currentTarget:this,pointerId:h}),this[r+"targetShape"]=null)}),s||this._fire(n.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const n=is(e.type),r=iu(e.type);if(!n)return;this.setPointersPositions(e);const i=this[r+"ClickStartShape"],a=this[r+"ClickEndShape"];var s={};let u=!1;this._changedPointerPositions.forEach(c=>{const f=Om(c.id)||this.getIntersection(c);if(f){if(f.releaseCapture(c.id),s[f._id])return;s[f._id]=!0}const h=c.id,p={evt:e,pointerId:h};let g=!1;pe["_"+r+"InDblClickWindow"]?(g=!0,clearTimeout(this[r+"DblTimeout"])):Ge.justDragged||(pe["_"+r+"InDblClickWindow"]=!0,clearTimeout(this[r+"DblTimeout"])),this[r+"DblTimeout"]=setTimeout(function(){pe["_"+r+"InDblClickWindow"]=!1},pe.dblClickWindow),f&&f.isListening()?(u=!0,this[r+"ClickEndShape"]=f,f._fireAndBubble(n.pointerup,Object.assign({},p)),pe["_"+r+"ListenClick"]&&i&&i===f&&(f._fireAndBubble(n.pointerclick,Object.assign({},p)),g&&a&&a===f&&f._fireAndBubble(n.pointerdblclick,Object.assign({},p)))):(this[r+"ClickEndShape"]=null,pe["_"+r+"ListenClick"]&&this._fire(n.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:h}),g&&this._fire(n.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:h}))}),u||this._fire(n.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),pe["_"+r+"ListenClick"]=!1,e.cancelable&&r!=="touch"&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);var n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(ny,{evt:e}):this._fire(ny,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);var n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(ry,{evt:e}):this._fire(ry,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const n=Om(e.pointerId)||this.getIntersection(this.getPointerPosition());n&&n._fireAndBubble(Ss,M0(e)),mu(e.pointerId)}_lostpointercapture(e){mu(e.pointerId)}setPointersPositions(e){var n=this._getContentPosition(),r=null,i=null;e=e||window.event,e.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,a=>{this._pointerPositions.push({id:a.identifier,x:(a.clientX-n.left)/n.scaleX,y:(a.clientY-n.top)/n.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,a=>{this._changedPointerPositions.push({id:a.identifier,x:(a.clientX-n.left)/n.scaleX,y:(a.clientY-n.top)/n.scaleY})})):(r=(e.clientX-n.left)/n.scaleX,i=(e.clientY-n.top)/n.scaleY,this.pointerPos={x:r,y:i},this._pointerPositions=[{x:r,y:i,id:G._getFirstPointerId(e)}],this._changedPointerPositions=[{x:r,y:i,id:G._getFirstPointerId(e)}])}_setPointerPosition(e){G.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Ts({width:this.width(),height:this.height()}),this.bufferHitCanvas=new L0({pixelRatio:1,width:this.width(),height:this.height()}),!!pe.isBrowser){var e=this.container();if(!e)throw"Stage has no container. A container is required.";e.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"),e.appendChild(this.content),this._resizeDOM()}}cache(){return G.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(e){e.batchDraw()}),this}}tp.prototype.nodeType=qF;yt(tp);A.addGetterSetter(tp,"container");var eP="hasShadow",tP="shadowRGBA",nP="patternImage",rP="linearGradient",iP="radialGradient";let Gf;function Rm(){return Gf||(Gf=G.createCanvasElement().getContext("2d"),Gf)}const vu={};function e$(t){t.fill()}function t$(t){t.stroke()}function n$(t){t.fill()}function r$(t){t.stroke()}function i$(){this._clearCache(eP)}function a$(){this._clearCache(tP)}function o$(){this._clearCache(nP)}function s$(){this._clearCache(rP)}function l$(){this._clearCache(iP)}class re extends se{constructor(e){super(e);let n;for(;n=G.getRandomColor(),!(n&&!(n in vu)););this.colorKey=n,vu[n]=this}getContext(){return G.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return G.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(eP,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(nP,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var e=Rm();const n=e.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(n&&n.setTransform){const r=new Wn;r.translate(this.fillPatternX(),this.fillPatternY()),r.rotate(pe.getAngle(this.fillPatternRotation())),r.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),r.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const i=r.getMatrix(),a=typeof DOMMatrix>"u"?{a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]}:new DOMMatrix(i);n.setTransform(a)}return n}}_getLinearGradient(){return this._getCache(rP,this.__getLinearGradient)}__getLinearGradient(){var e=this.fillLinearGradientColorStops();if(e){for(var n=Rm(),r=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),a=n.createLinearGradient(r.x,r.y,i.x,i.y),s=0;sthis.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 n=this.getStage(),r=n.bufferHitCanvas,i;return r.getContext().clear(),this.drawHit(r,null,!0),i=r.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data,i[3]>0}destroy(){return se.prototype.destroy.call(this),delete vu[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var n;if(!this.getStage()||!((n=this.attrs.perfectDrawEnabled)!==null&&n!==void 0?n:!0))return!1;const i=e||this.hasFill(),a=this.hasStroke(),s=this.getAbsoluteOpacity()!==1;if(i&&a&&s)return!0;const u=this.hasShadow(),c=this.shadowForStrokeEnabled();return!!(i&&a&&u&&c)}setStrokeHitEnabled(e){G.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 n=e.skipTransform,r=e.relativeTo,i=this.getSelfRect(),s=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,u=i.width+s,c=i.height+s,f=!e.skipShadow&&this.hasShadow(),h=f?this.shadowOffsetX():0,p=f?this.shadowOffsetY():0,g=u+Math.abs(h),y=c+Math.abs(p),v=f&&this.shadowBlur()||0,w=g+v*2,x=y+v*2,_={width:w,height:x,x:-(s/2+v)+Math.min(h,0)+i.x,y:-(s/2+v)+Math.min(p,0)+i.y};return n?_:this._transformedRect(_,r)}drawScene(e,n){var r=this.getLayer(),i=e||r.getCanvas(),a=i.getContext(),s=this._getCanvasCache(),u=this.getSceneFunc(),c=this.hasShadow(),f,h,p,g=i.isCache,y=n===this;if(!this.isVisible()&&!y)return this;if(s){a.save();var v=this.getAbsoluteTransform(n).getMatrix();return a.transform(v[0],v[1],v[2],v[3],v[4],v[5]),this._drawCachedSceneCanvas(a),a.restore(),this}if(!u)return this;if(a.save(),this._useBufferCanvas()&&!g){f=this.getStage(),h=f.bufferCanvas,p=h.getContext(),p.clear(),p.save(),p._applyLineJoin(this);var w=this.getAbsoluteTransform(n).getMatrix();p.transform(w[0],w[1],w[2],w[3],w[4],w[5]),u.call(this,p,this),p.restore();var x=h.pixelRatio;c&&a._applyShadow(this),a._applyOpacity(this),a._applyGlobalCompositeOperation(this),a.drawImage(h._canvas,0,0,h.width/x,h.height/x)}else{if(a._applyLineJoin(this),!y){var w=this.getAbsoluteTransform(n).getMatrix();a.transform(w[0],w[1],w[2],w[3],w[4],w[5]),a._applyOpacity(this),a._applyGlobalCompositeOperation(this)}c&&a._applyShadow(this),u.call(this,a,this)}return a.restore(),this}drawHit(e,n,r=!1){if(!this.shouldDrawHit(n,r))return this;var i=this.getLayer(),a=e||i.hitCanvas,s=a&&a.getContext(),u=this.hitFunc()||this.sceneFunc(),c=this._getCanvasCache(),f=c&&c.hit;if(this.colorKey||G.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()"),f){s.save();var h=this.getAbsoluteTransform(n).getMatrix();return s.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(s),s.restore(),this}if(!u)return this;if(s.save(),s._applyLineJoin(this),!(this===n)){var g=this.getAbsoluteTransform(n).getMatrix();s.transform(g[0],g[1],g[2],g[3],g[4],g[5])}return u.call(this,s,this),s.restore(),this}drawHitFromCache(e=0){var n=this._getCanvasCache(),r=this._getCachedSceneCanvas(),i=n.hit,a=i.getContext(),s=i.getWidth(),u=i.getHeight(),c,f,h,p,g,y;a.clear(),a.drawImage(r._canvas,0,0,s,u);try{for(c=a.getImageData(0,0,s,u),f=c.data,h=f.length,p=G._hexToRgb(this.colorKey),g=0;ge?(f[g]=p.r,f[g+1]=p.g,f[g+2]=p.b,f[g+3]=255):f[g+3]=0;a.putImageData(c,0,0)}catch(v){G.error("Unable to draw hit graph from cached scene canvas. "+v.message)}return this}hasPointerCapture(e){return Uk(e,this)}setPointerCapture(e){jk(e,this)}releaseCapture(e){mu(e)}}re.prototype._fillFunc=e$;re.prototype._strokeFunc=t$;re.prototype._fillFuncHit=n$;re.prototype._strokeFuncHit=r$;re.prototype._centroid=!1;re.prototype.nodeType="Shape";yt(re);re.prototype.eventListeners={};re.prototype.on.call(re.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",i$);re.prototype.on.call(re.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",a$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",o$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",s$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",l$);A.addGetterSetter(re,"stroke",void 0,zk());A.addGetterSetter(re,"strokeWidth",2,le());A.addGetterSetter(re,"fillAfterStrokeEnabled",!1);A.addGetterSetter(re,"hitStrokeWidth","auto",I0());A.addGetterSetter(re,"strokeHitEnabled",!0,jr());A.addGetterSetter(re,"perfectDrawEnabled",!0,jr());A.addGetterSetter(re,"shadowForStrokeEnabled",!0,jr());A.addGetterSetter(re,"lineJoin");A.addGetterSetter(re,"lineCap");A.addGetterSetter(re,"sceneFunc");A.addGetterSetter(re,"hitFunc");A.addGetterSetter(re,"dash");A.addGetterSetter(re,"dashOffset",0,le());A.addGetterSetter(re,"shadowColor",void 0,qs());A.addGetterSetter(re,"shadowBlur",0,le());A.addGetterSetter(re,"shadowOpacity",1,le());A.addComponentsGetterSetter(re,"shadowOffset",["x","y"]);A.addGetterSetter(re,"shadowOffsetX",0,le());A.addGetterSetter(re,"shadowOffsetY",0,le());A.addGetterSetter(re,"fillPatternImage");A.addGetterSetter(re,"fill",void 0,zk());A.addGetterSetter(re,"fillPatternX",0,le());A.addGetterSetter(re,"fillPatternY",0,le());A.addGetterSetter(re,"fillLinearGradientColorStops");A.addGetterSetter(re,"strokeLinearGradientColorStops");A.addGetterSetter(re,"fillRadialGradientStartRadius",0);A.addGetterSetter(re,"fillRadialGradientEndRadius",0);A.addGetterSetter(re,"fillRadialGradientColorStops");A.addGetterSetter(re,"fillPatternRepeat","repeat");A.addGetterSetter(re,"fillEnabled",!0);A.addGetterSetter(re,"strokeEnabled",!0);A.addGetterSetter(re,"shadowEnabled",!0);A.addGetterSetter(re,"dashEnabled",!0);A.addGetterSetter(re,"strokeScaleEnabled",!0);A.addGetterSetter(re,"fillPriority","color");A.addComponentsGetterSetter(re,"fillPatternOffset",["x","y"]);A.addGetterSetter(re,"fillPatternOffsetX",0,le());A.addGetterSetter(re,"fillPatternOffsetY",0,le());A.addComponentsGetterSetter(re,"fillPatternScale",["x","y"]);A.addGetterSetter(re,"fillPatternScaleX",1,le());A.addGetterSetter(re,"fillPatternScaleY",1,le());A.addComponentsGetterSetter(re,"fillLinearGradientStartPoint",["x","y"]);A.addComponentsGetterSetter(re,"strokeLinearGradientStartPoint",["x","y"]);A.addGetterSetter(re,"fillLinearGradientStartPointX",0);A.addGetterSetter(re,"strokeLinearGradientStartPointX",0);A.addGetterSetter(re,"fillLinearGradientStartPointY",0);A.addGetterSetter(re,"strokeLinearGradientStartPointY",0);A.addComponentsGetterSetter(re,"fillLinearGradientEndPoint",["x","y"]);A.addComponentsGetterSetter(re,"strokeLinearGradientEndPoint",["x","y"]);A.addGetterSetter(re,"fillLinearGradientEndPointX",0);A.addGetterSetter(re,"strokeLinearGradientEndPointX",0);A.addGetterSetter(re,"fillLinearGradientEndPointY",0);A.addGetterSetter(re,"strokeLinearGradientEndPointY",0);A.addComponentsGetterSetter(re,"fillRadialGradientStartPoint",["x","y"]);A.addGetterSetter(re,"fillRadialGradientStartPointX",0);A.addGetterSetter(re,"fillRadialGradientStartPointY",0);A.addComponentsGetterSetter(re,"fillRadialGradientEndPoint",["x","y"]);A.addGetterSetter(re,"fillRadialGradientEndPointX",0);A.addGetterSetter(re,"fillRadialGradientEndPointY",0);A.addGetterSetter(re,"fillPatternRotation",0);A.backCompat(re,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var u$="#",c$="beforeDraw",f$="draw",aP=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],d$=aP.length;class yo extends qn{constructor(e){super(e),this.canvas=new Ts,this.hitCanvas=new L0({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(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),e{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(e,n){var r=this.getLayer(),i=e||r&&r.getCanvas();return this._fire(c$,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),qn.prototype.drawScene.call(this,i,n),this._fire(f$,{node:this}),this}drawHit(e,n){var r=this.getLayer(),i=e||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),qn.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){G.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return G.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var e=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}destroy(){return G.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}yo.prototype.nodeType="Layer";yt(yo);A.addGetterSetter(yo,"imageSmoothingEnabled",!0);A.addGetterSetter(yo,"clearBeforeDraw",!0);A.addGetterSetter(yo,"hitGraphEnabled",!0,jr());class D0 extends yo{constructor(e){super(e),this.listening(!1),G.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}D0.prototype.nodeType="FastLayer";yt(D0);class zs extends qn{_validateAdd(e){var n=e.getType();n!=="Group"&&n!=="Shape"&&G.throw("You may only add groups and shapes to groups.")}}zs.prototype.nodeType="Group";yt(zs);var Am=function(){return Os.performance&&Os.performance.now?function(){return Os.performance.now()}:function(){return new Date().getTime()}}();class dr{constructor(e,n){this.id=dr.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Am(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){var n=[];return e?e.length>0?n=e:n=[e]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(e){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=Rb,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=Ab,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,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 e=this.getTimer()-this._startTime;this.state===Rb?this.setTime(e):this.state===Ab&&this.setTime(this.duration-e)}pause(){this.state=p$,this.fire("onPause")}getTimer(){return new Date().getTime()}}class kt{constructor(e){var n=this,r=e.node,i=r._id,a,s=e.easing||yu.Linear,u=!!e.yoyo,c;typeof e.duration>"u"?a=.3:e.duration===0?a=.001:a=e.duration,this.node=r,this._id=g$++;var f=r.getLayer()||(r instanceof pe.Stage?r.getLayers():null);f||G.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new dr(function(){n.tween.onEnterFrame()},f),this.tween=new m$(c,function(h){n._tweenFunc(h)},s,0,1,a*1e3,u),this._addListeners(),kt.attrs[i]||(kt.attrs[i]={}),kt.attrs[i][this._id]||(kt.attrs[i][this._id]={}),kt.tweens[i]||(kt.tweens[i]={});for(c in e)h$[c]===void 0&&this._addAttr(c,e[c]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,n){var r=this.node,i=r._id,a,s,u,c,f,h,p,g;if(u=kt.tweens[i][e],u&&delete kt.attrs[i][u][e],a=r.getAttr(e),G._isArray(n))if(s=[],f=Math.max(n.length,a.length),e==="points"&&n.length!==a.length&&(n.length>a.length?(p=a,a=G._prepareArrayForTween(a,n,r.closed())):(h=n,n=G._prepareArrayForTween(n,a,r.closed()))),e.indexOf("fill")===0)for(c=0;c{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var e=this.node,n=kt.attrs[e._id][this._id];n.points&&n.points.trueEnd&&e.setAttr("points",n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var e=this.node,n=kt.attrs[e._id][this._id];n.points&&n.points.trueStart&&e.points(n.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(e){return this.tween.seek(e*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e=this.node._id,n=this._id,r=kt.tweens[e],i;this.pause();for(i in r)delete kt.tweens[e][i];delete kt.attrs[e][n]}}kt.attrs={};kt.tweens={};se.prototype.to=function(t){var e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()};var n=new kt(t);n.play()};const yu={BackEaseIn(t,e,n,r){var i=1.70158;return n*(t/=r)*t*((i+1)*t-i)+e},BackEaseOut(t,e,n,r){var i=1.70158;return n*((t=t/r-1)*t*((i+1)*t+i)+1)+e},BackEaseInOut(t,e,n,r){var i=1.70158;return(t/=r/2)<1?n/2*(t*t*(((i*=1.525)+1)*t-i))+e:n/2*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)+e},ElasticEaseIn(t,e,n,r,i,a){var s=0;return t===0?e:(t/=r)===1?e+n:(a||(a=r*.3),!i||i0?e:n),h=s*n,p=u*(u>0?e:n),g=c*(c>0?n:e);return{x:f,y:r?-1*g:p,width:h-f,height:g-p}}}Hi.prototype._centroid=!0;Hi.prototype.className="Arc";Hi.prototype._attrsAffectingSize=["innerRadius","outerRadius"];yt(Hi);A.addGetterSetter(Hi,"innerRadius",0,le());A.addGetterSetter(Hi,"outerRadius",0,le());A.addGetterSetter(Hi,"angle",0,le());A.addGetterSetter(Hi,"clockwise",!1,jr());function iy(t,e,n,r,i,a,s){var u=Math.sqrt(Math.pow(n-t,2)+Math.pow(r-e,2)),c=Math.sqrt(Math.pow(i-n,2)+Math.pow(a-r,2)),f=s*u/(u+c),h=s*c/(u+c),p=n-f*(i-t),g=r-f*(a-e),y=n+h*(i-t),v=r+h*(a-e);return[p,g,y,v]}function Mb(t,e){var n=t.length,r=[],i,a;for(i=2;i4){for(u=this.getTensionPoints(),c=u.length,f=a?0:4,a||e.quadraticCurveTo(u[0],u[1],u[2],u[3]);fh?f:h,x=f>h?1:f/h,_=f>h?h/f:1;e.translate(u,c),e.rotate(y),e.scale(x,_),e.arc(0,0,w,p,p+g,1-v),e.scale(1/x,1/_),e.rotate(-y),e.translate(-u,-c);break;case"z":r=!0,e.closePath();break}}!r&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach(function(f){if(f.command==="A"){var h=f.points[4],p=f.points[5],g=f.points[4]+p,y=Math.PI/180;if(Math.abs(h-g)g;v-=y){const w=tt.getPointOnEllipticalArc(f.points[0],f.points[1],f.points[2],f.points[3],v,0);e.push(w.x,w.y)}else for(let v=h+y;vthis.dataArray[r].pathLength;)e-=this.dataArray[r].pathLength,++r;if(r===i)return n=this.dataArray[r-1].points.slice(-2),{x:n[0],y:n[1]};if(e<.01)return n=this.dataArray[r].points.slice(0,2),{x:n[0],y:n[1]};var a=this.dataArray[r],s=a.points;switch(a.command){case"L":return tt.getPointOnLine(e,a.start.x,a.start.y,s[0],s[1]);case"C":return tt.getPointOnCubicBezier(e/a.pathLength,a.start.x,a.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return tt.getPointOnQuadraticBezier(e/a.pathLength,a.start.x,a.start.y,s[0],s[1],s[2],s[3]);case"A":var u=s[0],c=s[1],f=s[2],h=s[3],p=s[4],g=s[5],y=s[6];return p+=g*e/a.pathLength,tt.getPointOnEllipticalArc(u,c,f,h,p,y)}return null}static getLineLength(e,n,r,i){return Math.sqrt((r-e)*(r-e)+(i-n)*(i-n))}static getPointOnLine(e,n,r,i,a,s,u){s===void 0&&(s=n),u===void 0&&(u=r);var c=(a-r)/(i-n+1e-8),f=Math.sqrt(e*e/(1+c*c));i0&&!isNaN(v[0]);){var S=null,C=[],O=c,I=f,L,D,U,X,K,te,ce,j,T,$;switch(y){case"l":c+=v.shift(),f+=v.shift(),S="L",C.push(c,f);break;case"L":c=v.shift(),f=v.shift(),C.push(c,f);break;case"m":var V=v.shift(),ie=v.shift();if(c+=V,f+=ie,S="M",s.length>2&&s[s.length-1].command==="z"){for(var W=s.length-2;W>=0;W--)if(s[W].command==="M"){c=s[W].points[0]+V,f=s[W].points[1]+ie;break}}C.push(c,f),y="l";break;case"M":c=v.shift(),f=v.shift(),S="M",C.push(c,f),y="L";break;case"h":c+=v.shift(),S="L",C.push(c,f);break;case"H":c=v.shift(),S="L",C.push(c,f);break;case"v":f+=v.shift(),S="L",C.push(c,f);break;case"V":f=v.shift(),S="L",C.push(c,f);break;case"C":C.push(v.shift(),v.shift(),v.shift(),v.shift()),c=v.shift(),f=v.shift(),C.push(c,f);break;case"c":C.push(c+v.shift(),f+v.shift(),c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="C",C.push(c,f);break;case"S":D=c,U=f,L=s[s.length-1],L.command==="C"&&(D=c+(c-L.points[2]),U=f+(f-L.points[3])),C.push(D,U,v.shift(),v.shift()),c=v.shift(),f=v.shift(),S="C",C.push(c,f);break;case"s":D=c,U=f,L=s[s.length-1],L.command==="C"&&(D=c+(c-L.points[2]),U=f+(f-L.points[3])),C.push(D,U,c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="C",C.push(c,f);break;case"Q":C.push(v.shift(),v.shift()),c=v.shift(),f=v.shift(),C.push(c,f);break;case"q":C.push(c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="Q",C.push(c,f);break;case"T":D=c,U=f,L=s[s.length-1],L.command==="Q"&&(D=c+(c-L.points[0]),U=f+(f-L.points[1])),c=v.shift(),f=v.shift(),S="Q",C.push(D,U,c,f);break;case"t":D=c,U=f,L=s[s.length-1],L.command==="Q"&&(D=c+(c-L.points[0]),U=f+(f-L.points[1])),c+=v.shift(),f+=v.shift(),S="Q",C.push(D,U,c,f);break;case"A":X=v.shift(),K=v.shift(),te=v.shift(),ce=v.shift(),j=v.shift(),T=c,$=f,c=v.shift(),f=v.shift(),S="A",C=this.convertEndpointToCenterParameterization(T,$,c,f,ce,j,X,K,te);break;case"a":X=v.shift(),K=v.shift(),te=v.shift(),ce=v.shift(),j=v.shift(),T=c,$=f,c+=v.shift(),f+=v.shift(),S="A",C=this.convertEndpointToCenterParameterization(T,$,c,f,ce,j,X,K,te);break}s.push({command:S||y,points:C,start:{x:O,y:I},pathLength:this.calcLength(O,I,S||y,C)})}(y==="z"||y==="Z")&&s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(e,n,r,i){var a,s,u,c,f=tt;switch(r){case"L":return f.getLineLength(e,n,i[0],i[1]);case"C":for(a=0,s=f.getPointOnCubicBezier(0,e,n,i[0],i[1],i[2],i[3],i[4],i[5]),c=.01;c<=1;c+=.01)u=f.getPointOnCubicBezier(c,e,n,i[0],i[1],i[2],i[3],i[4],i[5]),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;return a;case"Q":for(a=0,s=f.getPointOnQuadraticBezier(0,e,n,i[0],i[1],i[2],i[3]),c=.01;c<=1;c+=.01)u=f.getPointOnQuadraticBezier(c,e,n,i[0],i[1],i[2],i[3]),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;return a;case"A":a=0;var h=i[4],p=i[5],g=i[4]+p,y=Math.PI/180;if(Math.abs(h-g)g;c-=y)u=f.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],c,0),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;else for(c=h+y;c1&&(u*=Math.sqrt(y),c*=Math.sqrt(y));var v=Math.sqrt((u*u*(c*c)-u*u*(g*g)-c*c*(p*p))/(u*u*(g*g)+c*c*(p*p)));a===s&&(v*=-1),isNaN(v)&&(v=0);var w=v*u*g/c,x=v*-c*p/u,_=(e+r)/2+Math.cos(h)*w-Math.sin(h)*x,S=(n+i)/2+Math.sin(h)*w+Math.cos(h)*x,C=function(K){return Math.sqrt(K[0]*K[0]+K[1]*K[1])},O=function(K,te){return(K[0]*te[0]+K[1]*te[1])/(C(K)*C(te))},I=function(K,te){return(K[0]*te[1]=1&&(X=0),s===0&&X>0&&(X=X-2*Math.PI),s===1&&X<0&&(X=X+2*Math.PI),[_,S,u,c,L,X,h,s]}}tt.prototype.className="Path";tt.prototype._attrsAffectingSize=["data"];yt(tt);A.addGetterSetter(tt,"data");class So extends Vi{_sceneFunc(e){super._sceneFunc(e);var n=Math.PI*2,r=this.points(),i=r,a=this.tension()!==0&&r.length>4;a&&(i=this.getTensionPoints());var s=this.pointerLength(),u=r.length,c,f;if(a){const g=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[u-2],r[u-1]],y=tt.calcLength(i[i.length-4],i[i.length-3],"C",g),v=tt.getPointOnQuadraticBezier(Math.min(1,1-s/y),g[0],g[1],g[2],g[3],g[4],g[5]);c=r[u-2]-v.x,f=r[u-1]-v.y}else c=r[u-2]-r[u-4],f=r[u-1]-r[u-3];var h=(Math.atan2(f,c)+n)%n,p=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(r[u-2],r[u-1]),e.rotate(h),e.moveTo(0,0),e.lineTo(-s,p/2),e.lineTo(-s,-p/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(r[0],r[1]),a?(c=(i[0]+i[2])/2-r[0],f=(i[1]+i[3])/2-r[1]):(c=r[2]-r[0],f=r[3]-r[1]),e.rotate((Math.atan2(-f,-c)+n)%n),e.moveTo(0,0),e.lineTo(-s,p/2),e.lineTo(-s,-p/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),n=this.pointerWidth()/2;return{x:e.x-n,y:e.y-n,width:e.width+n*2,height:e.height+n*2}}}So.prototype.className="Arrow";yt(So);A.addGetterSetter(So,"pointerLength",10,le());A.addGetterSetter(So,"pointerWidth",10,le());A.addGetterSetter(So,"pointerAtBeginning",!1);A.addGetterSetter(So,"pointerAtEnding",!0);class Ks extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Ks.prototype._centroid=!0;Ks.prototype.className="Circle";Ks.prototype._attrsAffectingSize=["radius"];yt(Ks);A.addGetterSetter(Ks,"radius",0,le());class Na extends re{_sceneFunc(e){var n=this.radiusX(),r=this.radiusY();e.beginPath(),e.save(),n!==r&&e.scale(1,r/n),e.arc(0,0,n,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}Na.prototype.className="Ellipse";Na.prototype._centroid=!0;Na.prototype._attrsAffectingSize=["radiusX","radiusY"];yt(Na);A.addComponentsGetterSetter(Na,"radius",["x","y"]);A.addGetterSetter(Na,"radiusX",0,le());A.addGetterSetter(Na,"radiusY",0,le());let hi=class oP extends re{constructor(e){super(e),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),a=this.attrs.image;let s;if(a){const u=this.attrs.cropWidth,c=this.attrs.cropHeight;u&&c?s=[a,this.cropX(),this.cropY(),u,c,0,0,n,r]:s=[a,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(e.beginPath(),i?G.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)),a&&(i&&e.clip(),e.drawImage.apply(e,s))}_hitFunc(e){var n=this.width(),r=this.height(),i=this.cornerRadius();e.beginPath(),i?G.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,n;return(e=this.attrs.width)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var e,n;return(e=this.attrs.height)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(e,n,r=null){var i=G.createImageElement();i.onload=function(){var a=new oP({image:i});n(a)},i.onerror=r,i.crossOrigin="Anonymous",i.src=e}};hi.prototype.className="Image";yt(hi);A.addGetterSetter(hi,"cornerRadius",0,A0(4));A.addGetterSetter(hi,"image");A.addComponentsGetterSetter(hi,"crop",["x","y","width","height"]);A.addGetterSetter(hi,"cropX",0,le());A.addGetterSetter(hi,"cropY",0,le());A.addGetterSetter(hi,"cropWidth",0,le());A.addGetterSetter(hi,"cropHeight",0,le());var sP=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],v$="Change.konva",y$="none",ay="up",oy="right",sy="down",ly="left",S$=sP.length;class N0 extends zs{constructor(e){super(e),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(e){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),a=Math.max(a,s.y)}),{x:n,y:i,width:r-n,height:a-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}wo.prototype.className="RegularPolygon";wo.prototype._centroid=!0;wo.prototype._attrsAffectingSize=["radius"];yt(wo);A.addGetterSetter(wo,"radius",0,le());A.addGetterSetter(wo,"sides",0,le());var Db=Math.PI*2;class bo extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,Db,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),Db,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}bo.prototype.className="Ring";bo.prototype._centroid=!0;bo.prototype._attrsAffectingSize=["innerRadius","outerRadius"];yt(bo);A.addGetterSetter(bo,"innerRadius",0,le());A.addGetterSetter(bo,"outerRadius",0,le());class pi extends re{constructor(e){super(e),this._updated=!0,this.anim=new dr(()=>{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(e){var n=this.animation(),r=this.frameIndex(),i=r*4,a=this.animations()[n],s=this.frameOffsets(),u=a[i+0],c=a[i+1],f=a[i+2],h=a[i+3],p=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,f,h),e.closePath(),e.fillStrokeShape(this)),p)if(s){var g=s[n],y=r*2;e.drawImage(p,u,c,f,h,g[y+0],g[y+1],f,h)}else e.drawImage(p,u,c,f,h,0,0,f,h)}_hitFunc(e){var n=this.animation(),r=this.frameIndex(),i=r*4,a=this.animations()[n],s=this.frameOffsets(),u=a[i+2],c=a[i+3];if(e.beginPath(),s){var f=s[n],h=r*2;e.rect(f[h+0],f[h+1],u,c)}else e.rect(0,0,u,c);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],a=i.length/4;e{e=e.trim();const n=e.indexOf(" ")>=0,r=e.indexOf('"')>=0||e.indexOf("'")>=0;return n&&!r&&(e=`"${e}"`),e}).join(", ")}var jf;function Lm(){return jf||(jf=G.createCanvasElement().getContext(b$),jf)}function L$(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function M$(t){t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function D$(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}let vt=class extends re{constructor(e){super(D$(e)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(_+=s)}}}_hitFunc(e){var n=this.getWidth(),r=this.getHeight();e.beginPath(),e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}setText(e){var n=G._isString(e)?e:e==null?"":e+"";return this._setAttr(C$,n),this}getWidth(){var e=this.attrs.width===as||this.attrs.width===void 0;return e?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var e=this.attrs.height===as||this.attrs.height===void 0;return e?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return G.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var n=Lm(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(e),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+Uf+this.fontVariant()+Uf+(this.fontSize()+E$)+I$(this.fontFamily())}_addTextLine(e){this.align()===Wl&&(e=e.trim());var r=this._getTextWidth(e);return this.textArr.push({text:e,width:r,lastInParagraph:!1})}_getTextWidth(e){var n=this.letterSpacing(),r=e.length;return Lm().measureText(e).width+(r?n*(r-1):0)}_setTextData(){var e=this.text().split(` -`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,a=this.attrs.width,s=this.attrs.height,u=a!==as&&a!==void 0,c=s!==as&&s!==void 0,f=this.padding(),h=a-f*2,p=s-f*2,g=0,y=this.wrap(),v=y!==Fb,w=y!==R$&&v,x=this.ellipsis();this.textArr=[],Lm().font=this._getContextFont();for(var _=x?this._getTextWidth(Im):0,S=0,C=e.length;Sh)for(;O.length>0;){for(var L=0,D=O.length,U="",X=0;L>>1,te=O.slice(0,K+1),ce=this._getTextWidth(te)+_;ce<=h?(L=K+1,U=te,X=ce):D=K}if(U){if(w){var j,T=O[U.length],$=T===Uf||T===Nb;$&&X<=h?j=U.length:j=Math.max(U.lastIndexOf(Uf),U.lastIndexOf(Nb))+1,j>0&&(L=j,U=U.slice(0,L),X=this._getTextWidth(U))}U=U.trimRight(),this._addTextLine(U),r=Math.max(r,X),g+=i;var V=this._shouldHandleEllipsis(g);if(V){this._tryToAddEllipsisToLastLine();break}if(O=O.slice(L),O=O.trimLeft(),O.length>0&&(I=this._getTextWidth(O),I<=h)){this._addTextLine(O),g+=i,r=Math.max(r,I);break}}else break}else this._addTextLine(O),g+=i,r=Math.max(r,I),this._shouldHandleEllipsis(g)&&Sp)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(e){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,a=i!==as&&i!==void 0,s=this.padding(),u=i-s*2,c=this.wrap(),f=c!==Fb;return!f||a&&e+r>u}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,n=e!==as&&e!==void 0,r=this.padding(),i=e-r*2,a=this.ellipsis(),s=this.textArr[this.textArr.length-1];if(!(!s||!a)){if(n){var u=this._getTextWidth(s.text+Im)=1){var r=n[0].p0;e.moveTo(r.x,r.y)}for(var i=0;i0&&(u+=e.dataArray[c].pathLength);var f=0;i==="center"&&(f=Math.max(0,u/2-s/2)),i==="right"&&(f=Math.max(0,u-s));for(var h=lP(this.text()),p=this.text().split(" ").length-1,g,y,v,w=-1,x=0,_=function(){x=0;for(var ce=e.dataArray,j=w+1;j0)return w=j,ce[j];ce[j].command==="M"&&(g={x:ce[j].points[0],y:ce[j].points[1]})}return{}},S=function(ce){var j=e._getTextSize(ce).width+r;ce===" "&&i==="justify"&&(j+=(u-s)/p);var T=0,$=0;for(y=void 0;Math.abs(j-T)/j>.01&&$<20;){$++;for(var V=T;v===void 0;)v=_(),v&&V+v.pathLengthj?y=tt.getPointOnLine(j,g.x,g.y,v.points[0],v.points[1],g.x,g.y):v=void 0;break;case"A":var W=v.points[4],Y=v.points[5],Q=v.points[4]+Y;x===0?x=W+1e-8:j>T?x+=Math.PI/180*Y/Math.abs(Y):x-=Math.PI/360*Y/Math.abs(Y),(Y<0&&x=0&&x>Q)&&(x=Q,ie=!0),y=tt.getPointOnEllipticalArc(v.points[0],v.points[1],v.points[2],v.points[3],x,v.points[6]);break;case"C":x===0?j>v.pathLength?x=1e-8:x=j/v.pathLength:j>T?x+=(j-T)/v.pathLength/2:x=Math.max(x-(T-j)/v.pathLength/2,0),x>1&&(x=1,ie=!0),y=tt.getPointOnCubicBezier(x,v.start.x,v.start.y,v.points[0],v.points[1],v.points[2],v.points[3],v.points[4],v.points[5]);break;case"Q":x===0?x=j/v.pathLength:j>T?x+=(j-T)/v.pathLength:x-=(T-j)/v.pathLength,x>1&&(x=1,ie=!0),y=tt.getPointOnQuadraticBezier(x,v.start.x,v.start.y,v.points[0],v.points[1],v.points[2],v.points[3]);break}y!==void 0&&(T=tt.getLineLength(g.x,g.y,y.x,y.y)),ie&&(ie=!1,v=void 0)}},C="C",O=e._getTextSize(C).width+r,I=f/O-1,L=0;Lt+`.${gP}`).join(" "),$b="nodesRect",F$=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],$$={"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 z$="ontouchstart"in pe._global;function G$(t,e){if(t==="rotater")return"crosshair";e+=G.degToRad($$[t]||0);var n=(G.radToDeg(e)%360+360)%360;return G._inRange(n,315+22.5,360)||G._inRange(n,0,22.5)?"ns-resize":G._inRange(n,45-22.5,45+22.5)?"nesw-resize":G._inRange(n,90-22.5,90+22.5)?"ew-resize":G._inRange(n,135-22.5,135+22.5)?"nwse-resize":G._inRange(n,180-22.5,180+22.5)?"ns-resize":G._inRange(n,225-22.5,225+22.5)?"nesw-resize":G._inRange(n,270-22.5,270+22.5)?"ew-resize":G._inRange(n,315-22.5,315+22.5)?"nwse-resize":(G.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var sh=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],zb=1e8;function U$(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}function mP(t,e,n){const r=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),i=n.y+(t.x-n.x)*Math.sin(e)+(t.y-n.y)*Math.cos(e);return Object.assign(Object.assign({},t),{rotation:t.rotation+e,x:r,y:i})}function j$(t,e){const n=U$(t);return mP(t,e,n)}function W$(t,e,n){let r=e;for(let i=0;i{const i=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=r._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");r.on(a,i),r.on(F$.map(s=>s+`.${this._getEventNamespace()}`).join(" "),i),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,i),this._proxyDrag(r)}),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&this.update(),this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,r=>{n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(r,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=e.getAbsolutePosition(),a=i.x-n.x,s=i.y-n.y;this.nodes().forEach(u=>{if(u===e||u.isDragging())return;const c=u.getAbsolutePosition();u.setAbsolutePosition({x:c.x+a,y:c.y+s}),u.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache($b),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache($b,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),r){var i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(r),s=e.getAbsolutePosition(r),u=i.x*a.x-e.offsetX()*a.x,c=i.y*a.y-e.offsetY()*a.y;const f=(pe.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),h={x:s.x+u*Math.cos(f)+c*Math.sin(-f),y:s.y+c*Math.cos(f)+u*Math.sin(f),width:i.width*a.x,height:i.height*a.y,rotation:f};return mP(h,-pe.getAngle(n),{x:0,y:0})}__getNodeRect(){var e=this.getNode();if(!e)return{x:-zb,y:-zb,width:0,height:0,rotation:0};const n=[];this.nodes().map(f=>{const h=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var p=[{x:h.x,y:h.y},{x:h.x+h.width,y:h.y},{x:h.x+h.width,y:h.y+h.height},{x:h.x,y:h.y+h.height}],g=f.getAbsoluteTransform();p.forEach(function(y){var v=g.point(y);n.push(v)})});const r=new Wn;r.rotate(-pe.getAngle(this.rotation()));var i,a,s,u;n.forEach(function(f){var h=r.point(f);i===void 0&&(i=s=h.x,a=u=h.y),i=Math.min(i,h.x),a=Math.min(a,h.y),s=Math.max(s,h.x),u=Math.max(u,h.y)}),r.invert();const c=r.point({x:i,y:a});return{x:c.x,y:c.y,width:s-i,height:u-a,rotation:pe.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(),sh.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var n=new Zu({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:z$?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=pe.getAngle(this.rotation()),a=G$(e,i);n.getStage().content&&(n.getStage().content.style.cursor=a),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var e=new re({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()*G._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(e),this._proxyDrag(e),e.on("dragstart",n=>{n.cancelBubble=!0}),e.on("dragmove",n=>{n.cancelBubble=!0}),e.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,a=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/a),this.cos=Math.abs(r/a),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=e.target.getAbsolutePosition(),u=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:u.x-s.x,y:u.y-s.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(c=>{c._fire("transformstart",{evt:e.evt,target:c})})}_handleMouseMove(e){var n,r,i,a=this.findOne("."+this._movingAnchorName),s=a.getStage();s.setPointersPositions(e);const u=s.getPointerPosition();let c={x:u.x-this._anchorDragOffset.x,y:u.y-this._anchorDragOffset.y};const f=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(c=this.anchorDragBoundFunc()(f,c,e)),a.setAbsolutePosition(c);const h=a.getAbsolutePosition();if(!(f.x===h.x&&f.y===h.y)){if(this._movingAnchorName==="rotater"){var p=this._getNodeRect();n=a.x()-p.width/2,r=-a.y()+p.height/2;let ce=Math.atan2(-r,n)+Math.PI/2;p.height<0&&(ce-=Math.PI);var g=pe.getAngle(this.rotation());const j=g+ce,T=pe.getAngle(this.rotationSnapTolerance()),V=W$(this.rotationSnaps(),j,T)-p.rotation,ie=j$(p,V);this._fitNodesInto(ie,e);return}var y=this.keepRatio()||e.shiftKey,S=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(y){var v=S?{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(v.x-a.x(),2)+Math.pow(v.y-a.y(),2));var w=this.findOne(".top-left").x()>v.x?-1:1,x=this.findOne(".top-left").y()>v.y?-1:1;n=i*this.cos*w,r=i*this.sin*x,this.findOne(".top-left").x(v.x-n),this.findOne(".top-left").y(v.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(a.y());else if(this._movingAnchorName==="top-right"){if(y){var v=S?{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(a.x()-v.x,2)+Math.pow(v.y-a.y(),2));var w=this.findOne(".top-right").x()v.y?-1:1;n=i*this.cos*w,r=i*this.sin*x,this.findOne(".top-right").x(v.x+n),this.findOne(".top-right").y(v.y-r)}var _=a.position();this.findOne(".top-left").y(_.y),this.findOne(".bottom-right").x(_.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(a.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(a.x());else if(this._movingAnchorName==="bottom-left"){if(y){var v=S?{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(v.x-a.x(),2)+Math.pow(a.y()-v.y,2));var w=v.x{r._fire("transformend",{evt:e,target:r})}),this._movingAnchorName=null}}_fitNodesInto(e,n){var r=this._getNodeRect();const i=1;if(G._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(G._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const a=this.flipEnabled();var s=new Wn;if(s.rotate(pe.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const p=s.point({x:-this.padding()*2,y:0});if(e.x+=p.x,e.y+=p.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,!a){this.update();return}}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const p=s.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.width+=this.padding()*2,!a){this.update();return}}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const p=s.point({x:0,y:-this.padding()*2});if(e.x+=p.x,e.y+=p.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2,!a){this.update();return}}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const p=s.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2,!a){this.update();return}}if(this.boundBoxFunc()){const p=this.boundBoxFunc()(r,e);p?e=p:G.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const u=1e7,c=new Wn;c.translate(r.x,r.y),c.rotate(r.rotation),c.scale(r.width/u,r.height/u);const f=new Wn;f.translate(e.x,e.y),f.rotate(e.rotation),f.scale(e.width/u,e.height/u);const h=f.multiply(c.invert());this._nodes.forEach(p=>{var g;const y=p.getParent().getAbsoluteTransform(),v=p.getTransform().copy();v.translate(p.offsetX(),p.offsetY());const w=new Wn;w.multiply(y.copy().invert()).multiply(h).multiply(y).multiply(v);const x=w.decompose();p.setAttrs(x),this._fire("transform",{evt:n,target:p}),p._fire("transform",{evt:n,target:p}),(g=p.getLayer())===null||g===void 0||g.batchDraw()}),this.rotation(G._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e,n=this._getNodeRect();this.rotation(G._getRotation(n.rotation));var r=n.width,i=n.height,a=this.enabledAnchors(),s=this.resizeEnabled(),u=this.padding(),c=this.anchorSize();this.find("._anchor").forEach(f=>{f.setAttrs({width:c,height:c,offsetX:c/2,offsetY:c/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:c/2+u,offsetY:c/2+u,visible:s&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:c/2+u,visible:s&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:c/2-u,offsetY:c/2+u,visible:s&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:c/2+u,visible:s&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:c/2-u,visible:s&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:c/2+u,offsetY:c/2-u,visible:s&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:c/2-u,visible:s&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:c/2-u,offsetY:c/2-u,visible:s&&a.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*G._sign(i)-u,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}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),zs.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return se.prototype.toObject.call(this)}clone(e){var n=se.prototype.clone.call(this,e);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}function H$(t){return t instanceof Array||G.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){sh.indexOf(e)===-1&&G.warn("Unknown anchor name: "+e+". Available names are: "+sh.join(", "))}),t||[]}Ke.prototype.className="Transformer";yt(Ke);A.addGetterSetter(Ke,"enabledAnchors",sh,H$);A.addGetterSetter(Ke,"flipEnabled",!0,jr());A.addGetterSetter(Ke,"resizeEnabled",!0);A.addGetterSetter(Ke,"anchorSize",10,le());A.addGetterSetter(Ke,"rotateEnabled",!0);A.addGetterSetter(Ke,"rotationSnaps",[]);A.addGetterSetter(Ke,"rotateAnchorOffset",50,le());A.addGetterSetter(Ke,"rotationSnapTolerance",5,le());A.addGetterSetter(Ke,"borderEnabled",!0);A.addGetterSetter(Ke,"anchorStroke","rgb(0, 161, 255)");A.addGetterSetter(Ke,"anchorStrokeWidth",1,le());A.addGetterSetter(Ke,"anchorFill","white");A.addGetterSetter(Ke,"anchorCornerRadius",0,le());A.addGetterSetter(Ke,"borderStroke","rgb(0, 161, 255)");A.addGetterSetter(Ke,"borderStrokeWidth",1,le());A.addGetterSetter(Ke,"borderDash");A.addGetterSetter(Ke,"keepRatio",!0);A.addGetterSetter(Ke,"centeredScaling",!1);A.addGetterSetter(Ke,"ignoreStroke",!1);A.addGetterSetter(Ke,"padding",0,le());A.addGetterSetter(Ke,"node");A.addGetterSetter(Ke,"nodes");A.addGetterSetter(Ke,"boundBoxFunc");A.addGetterSetter(Ke,"anchorDragBoundFunc");A.addGetterSetter(Ke,"shouldOverdrawWholeArea",!1);A.addGetterSetter(Ke,"useSingleNodeRotation",!0);A.backCompat(Ke,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class qi extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,pe.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}qi.prototype.className="Wedge";qi.prototype._centroid=!0;qi.prototype._attrsAffectingSize=["radius"];yt(qi);A.addGetterSetter(qi,"radius",0,le());A.addGetterSetter(qi,"angle",0,le());A.addGetterSetter(qi,"clockwise",!1);A.backCompat(qi,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function Gb(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var V$=[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],q$=[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 K$(t,e){var n=t.data,r=t.width,i=t.height,a,s,u,c,f,h,p,g,y,v,w,x,_,S,C,O,I,L,D,U,X,K,te,ce,j=e+e+1,T=r-1,$=i-1,V=e+1,ie=V*(V+1)/2,W=new Gb,Y=null,Q=W,oe=null,ve=null,we=V$[e],Ue=q$[e];for(u=1;u>Ue,te!==0?(te=255/te,n[h]=(g*we>>Ue)*te,n[h+1]=(y*we>>Ue)*te,n[h+2]=(v*we>>Ue)*te):n[h]=n[h+1]=n[h+2]=0,g-=x,y-=_,v-=S,w-=C,x-=oe.r,_-=oe.g,S-=oe.b,C-=oe.a,c=p+((c=a+e+1)>Ue,te>0?(te=255/te,n[c]=(g*we>>Ue)*te,n[c+1]=(y*we>>Ue)*te,n[c+2]=(v*we>>Ue)*te):n[c]=n[c+1]=n[c+2]=0,g-=x,y-=_,v-=S,w-=C,x-=oe.r,_-=oe.g,S-=oe.b,C-=oe.a,c=a+((c=s+V)<$?c:$)*r<<2,g+=O+=oe.r=n[c],y+=I+=oe.g=n[c+1],v+=L+=oe.b=n[c+2],w+=D+=oe.a=n[c+3],oe=oe.next,x+=U=ve.r,_+=X=ve.g,S+=K=ve.b,C+=te=ve.a,O-=U,I-=X,L-=K,D-=te,ve=ve.next,h+=r}}const Y$=function(e){var n=Math.round(this.blurRadius());n>0&&K$(e,n)};A.addGetterSetter(se,"blurRadius",0,le(),A.afterSetFilter);const X$=function(t){var e=this.brightness()*255,n=t.data,r=n.length,i;for(i=0;i255?255:i,a=a<0?0:a>255?255:a,s=s<0?0:s>255?255:s,n[u]=i,n[u+1]=a,n[u+2]=s};A.addGetterSetter(se,"contrast",0,le(),A.afterSetFilter);const J$=function(t){var e=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),a=0,s=0,u=t.data,c=t.width,f=t.height,h=c*4,p=f;switch(r){case"top-left":a=-1,s=-1;break;case"top":a=-1,s=0;break;case"top-right":a=-1,s=1;break;case"right":a=0,s=1;break;case"bottom-right":a=1,s=1;break;case"bottom":a=1,s=0;break;case"bottom-left":a=1,s=-1;break;case"left":a=0,s=-1;break;default:G.error("Unknown emboss direction: "+r)}do{var g=(p-1)*h,y=a;p+y<1&&(y=0),p+y>f&&(y=0);var v=(p-1+y)*c*4,w=c;do{var x=g+(w-1)*4,_=s;w+_<1&&(_=0),w+_>c&&(_=0);var S=v+(w-1+_)*4,C=u[x]-u[S],O=u[x+1]-u[S+1],I=u[x+2]-u[S+2],L=C,D=L>0?L:-L,U=O>0?O:-O,X=I>0?I:-I;if(U>D&&(L=O),X>D&&(L=I),L*=e,i){var K=u[x]+L,te=u[x+1]+L,ce=u[x+2]+L;u[x]=K>255?255:K<0?0:K,u[x+1]=te>255?255:te<0?0:te,u[x+2]=ce>255?255:ce<0?0:ce}else{var j=n-L;j<0?j=0:j>255&&(j=255),u[x]=u[x+1]=u[x+2]=j}}while(--w)}while(--p)};A.addGetterSetter(se,"embossStrength",.5,le(),A.afterSetFilter);A.addGetterSetter(se,"embossWhiteLevel",.5,le(),A.afterSetFilter);A.addGetterSetter(se,"embossDirection","top-left",null,A.afterSetFilter);A.addGetterSetter(se,"embossBlend",!1,null,A.afterSetFilter);function Mm(t,e,n,r,i){var a=n-e,s=i-r,u;return a===0?r+s/2:s===0?r:(u=(t-e)/a,u=s*u+r,u)}const Z$=function(t){var e=t.data,n=e.length,r=e[0],i=r,a,s=e[1],u=s,c,f=e[2],h=f,p,g,y=this.enhance();if(y!==0){for(g=0;gi&&(i=a),c=e[g+1],cu&&(u=c),p=e[g+2],ph&&(h=p);i===r&&(i=255,r=0),u===s&&(u=255,s=0),h===f&&(h=255,f=0);var v,w,x,_,S,C,O,I,L;for(y>0?(w=i+y*(255-i),x=r-y*(r-0),S=u+y*(255-u),C=s-y*(s-0),I=h+y*(255-h),L=f-y*(f-0)):(v=(i+r)*.5,w=i+y*(i-v),x=r+y*(r-v),_=(u+s)*.5,S=u+y*(u-_),C=s+y*(s-_),O=(h+f)*.5,I=h+y*(h-O),L=f+y*(f-O)),g=0;g_?x:_;var S=s,C=a,O,I,L=360/C*Math.PI/180,D,U;for(I=0;IC?S:C;var O=s,I=a,L,D,U=n.polarRotation||0,X,K;for(h=0;he&&(O=C,I=0,L=-1),i=0;i=0&&y=0&&v=0&&y=0&&v=255*4?255:0}return s}function dz(t,e,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),s=[],u=0;u=0&&y=0&&v=n))for(a=w;a=r||(s=(n*a+i)*4,u+=O[s+0],c+=O[s+1],f+=O[s+2],h+=O[s+3],C+=1);for(u=u/C,c=c/C,f=f/C,h=h/C,i=y;i=n))for(a=w;a=r||(s=(n*a+i)*4,O[s+0]=u,O[s+1]=c,O[s+2]=f,O[s+3]=h)}};A.addGetterSetter(se,"pixelSize",8,le(),A.afterSetFilter);const mz=function(t){var e=Math.round(this.levels()*254)+1,n=t.data,r=n.length,i=255/e,a;for(a=0;a255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"blue",0,$k,A.afterSetFilter);const yz=function(t){var e=t.data,n=e.length,r=this.red(),i=this.green(),a=this.blue(),s=this.alpha(),u,c;for(u=0;u255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"blue",0,$k,A.afterSetFilter);A.addGetterSetter(se,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});const Sz=function(t){var e=t.data,n=e.length,r,i,a,s;for(r=0;r127&&(f=255-f),h>127&&(h=255-h),p>127&&(p=255-p),e[c]=f,e[c+1]=h,e[c+2]=p}while(--u)}while(--a)},wz=function(t){var e=this.threshold()*255,n=t.data,r=n.length,i;for(i=0;i{const{width:n,height:r}=e,i=document.createElement("div"),a=new Vl.Stage({container:i,width:n,height:r}),s=new Vl.Layer,u=new Vl.Layer;s.add(new Vl.Rect({...e,fill:"white"})),t.forEach(f=>u.add(new Vl.Line({points:f.points,stroke:"black",strokeWidth:f.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:f.tool==="brush"?"source-over":"destination-out"}))),a.add(s),a.add(u);const c=a.toDataURL({...e});return i.remove(),c};let vP=null,yP=null;const $W=t=>{vP=t},Cz=()=>vP,zW=t=>{yP=t},GW=()=>yP,xz=t=>{const e=window.open("");e&&t.forEach(n=>{const r=new Image;r.src=n.base64,e.document.write(n.caption),e.document.write("
"),e.document.write(r.outerHTML),e.document.write("

")})},kz=(t,e)=>Math.floor(Math.random()*(e-t+1)+t),Pz=t=>{const e=Cz(),{generationMode:n,generationState:r,postprocessingState:i,canvasState:a,systemState:s}=t,{codeformerFidelity:u,facetoolStrength:c,facetoolType:f,hiresFix:h,hiresStrength:p,shouldRunESRGAN:g,shouldRunFacetool:y,upscalingLevel:v,upscalingStrength:w,upscalingDenoising:x}=i,{cfgScale:_,height:S,img2imgStrength:C,infillMethod:O,initialImage:I,iterations:L,perlin:D,prompt:U,negativePrompt:X,sampler:K,seamBlur:te,seamless:ce,seamSize:j,seamSteps:T,seamStrength:$,seed:V,seedWeights:ie,shouldFitToWidthHeight:W,shouldGenerateVariations:Y,shouldRandomizeSeed:Q,steps:oe,threshold:ve,tileSize:we,variationAmount:Ue,width:At,shouldUseSymmetry:me,horizontalSymmetrySteps:qt,verticalSymmetrySteps:Bt}=r,{shouldDisplayInProgressType:bn,saveIntermediatesInterval:wr,enableImageDebugging:Ft}=s,xe={prompt:U,iterations:L,steps:oe,cfg_scale:_,threshold:ve,perlin:D,height:S,width:At,sampler_name:K,seed:V,progress_images:bn==="full-res",progress_latents:bn==="latents",save_intermediates:wr,generation_mode:n,init_mask:""};let Wr=!1,Et=!1;if(X!==""&&(xe.prompt=`${U} [${X}]`),xe.seed=Q?kz(cF,fF):V,me&&(qt>0&&(xe.h_symmetry_time_pct=Math.max(0,Math.min(1,qt/oe))),Bt>0&&(xe.v_symmetry_time_pct=Math.max(0,Math.min(1,Bt/oe)))),n==="txt2img"&&(xe.hires_fix=h,h&&(xe.strength=p)),["txt2img","img2img"].includes(n)&&(xe.seamless=ce,g&&(Wr={level:v,denoise_str:x,strength:w}),y&&(Et={type:f,strength:c},f==="codeformer"&&(Et.codeformer_fidelity=u))),n==="img2img"&&I&&(xe.init_img=typeof I=="string"?I:I.url,xe.strength=C,xe.fit=W),n==="unifiedCanvas"&&e){const{layerState:{objects:gi},boundingBoxCoordinates:Xs,boundingBoxDimensions:Mn,stageScale:Fa,isMaskEnabled:Qs,shouldPreserveMaskedArea:er,boundingBoxScaleMethod:Kt,scaledBoundingBoxDimensions:Dn}=a,bt={...Xs,...Mn},$a=bz(Qs?gi.filter(Qx):[],bt);xe.init_mask=$a,xe.fit=!1,xe.strength=C,xe.invert_mask=er,xe.bounding_box=bt;const Hr=e.scale();e.scale({x:1/Fa,y:1/Fa});const Co=e.getAbsolutePosition(),Vr=e.toDataURL({x:bt.x+Co.x,y:bt.y+Co.y,width:bt.width,height:bt.height});Ft&&xz([{base64:$a,caption:"mask sent as init_mask"},{base64:Vr,caption:"image sent as init_img"}]),e.scale(Hr),xe.init_img=Vr,xe.progress_images=!1,Kt!=="none"&&(xe.inpaint_width=Dn.width,xe.inpaint_height=Dn.height),xe.seam_size=j,xe.seam_blur=te,xe.seam_strength=$,xe.seam_steps=T,xe.tile_size=we,xe.infill_method=O,xe.force_outpaint=!1}return Y?(xe.variation_amount=Ue,ie&&(xe.with_variations=A5(ie))):xe.variation_amount=0,Ft&&(xe.enable_image_debugging=Ft),{generationParameters:xe,esrganParameters:Wr,facetoolParameters:Et}};var Ez=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Oz=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Tz=/[^-+\dA-Z]/g;function Ut(t,e,n,r){if(arguments.length===1&&typeof t=="string"&&!/\d/.test(t)&&(e=t,t=void 0),t=t||t===0?t:new Date,t instanceof Date||(t=new Date(t)),isNaN(t))throw TypeError("Invalid date");e=String(Ub[e]||e||Ub.default);var i=e.slice(0,4);(i==="UTC:"||i==="GMT:")&&(e=e.slice(4),n=!0,i==="GMT:"&&(r=!0));var a=function(){return n?"getUTC":"get"},s=function(){return t[a()+"Date"]()},u=function(){return t[a()+"Day"]()},c=function(){return t[a()+"Month"]()},f=function(){return t[a()+"FullYear"]()},h=function(){return t[a()+"Hours"]()},p=function(){return t[a()+"Minutes"]()},g=function(){return t[a()+"Seconds"]()},y=function(){return t[a()+"Milliseconds"]()},v=function(){return n?0:t.getTimezoneOffset()},w=function(){return Rz(t)},x=function(){return Az(t)},_={d:function(){return s()},dd:function(){return Un(s())},ddd:function(){return En.dayNames[u()]},DDD:function(){return jb({y:f(),m:c(),d:s(),_:a(),dayName:En.dayNames[u()],short:!0})},dddd:function(){return En.dayNames[u()+7]},DDDD:function(){return jb({y:f(),m:c(),d:s(),_:a(),dayName:En.dayNames[u()+7]})},m:function(){return c()+1},mm:function(){return Un(c()+1)},mmm:function(){return En.monthNames[c()]},mmmm:function(){return En.monthNames[c()+12]},yy:function(){return String(f()).slice(2)},yyyy:function(){return Un(f(),4)},h:function(){return h()%12||12},hh:function(){return Un(h()%12||12)},H:function(){return h()},HH:function(){return Un(h())},M:function(){return p()},MM:function(){return Un(p())},s:function(){return g()},ss:function(){return Un(g())},l:function(){return Un(y(),3)},L:function(){return Un(Math.floor(y()/10))},t:function(){return h()<12?En.timeNames[0]:En.timeNames[1]},tt:function(){return h()<12?En.timeNames[2]:En.timeNames[3]},T:function(){return h()<12?En.timeNames[4]:En.timeNames[5]},TT:function(){return h()<12?En.timeNames[6]:En.timeNames[7]},Z:function(){return r?"GMT":n?"UTC":Iz(t)},o:function(){return(v()>0?"-":"+")+Un(Math.floor(Math.abs(v())/60)*100+Math.abs(v())%60,4)},p:function(){return(v()>0?"-":"+")+Un(Math.floor(Math.abs(v())/60),2)+":"+Un(Math.floor(Math.abs(v())%60),2)},S:function(){return["th","st","nd","rd"][s()%10>3?0:(s()%100-s()%10!=10)*s()%10]},W:function(){return w()},WW:function(){return Un(w())},N:function(){return x()}};return e.replace(Ez,function(S){return S in _?_[S]():S.slice(1,S.length-1)})}var Ub={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"},En={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"]},Un=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(e).padStart(n,"0")},jb=function(e){var n=e.y,r=e.m,i=e.d,a=e._,s=e.dayName,u=e.short,c=u===void 0?!1:u,f=new Date,h=new Date;h.setDate(h[a+"Date"]()-1);var p=new Date;p.setDate(p[a+"Date"]()+1);var g=function(){return f[a+"Date"]()},y=function(){return f[a+"Month"]()},v=function(){return f[a+"FullYear"]()},w=function(){return h[a+"Date"]()},x=function(){return h[a+"Month"]()},_=function(){return h[a+"FullYear"]()},S=function(){return p[a+"Date"]()},C=function(){return p[a+"Month"]()},O=function(){return p[a+"FullYear"]()};return v()===n&&y()===r&&g()===i?c?"Tdy":"Today":_()===n&&x()===r&&w()===i?c?"Ysd":"Yesterday":O()===n&&C()===r&&S()===i?c?"Tmw":"Tomorrow":s},Rz=function(e){var n=new Date(e.getFullYear(),e.getMonth(),e.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 a=(n-r)/(864e5*7);return 1+Math.floor(a)},Az=function(e){var n=e.getDay();return n===0&&(n=7),n},Iz=function(e){return(String(e).match(Oz)||[""]).pop().replace(Tz,"").replace(/GMT\+0000/g,"UTC")};const Lz=(t,e)=>{const{dispatch:n,getState:r}=t;return{emitGenerateImage:i=>{n(ei(!0));const a=r(),{generation:s,postprocessing:u,system:c,canvas:f}=a,h={generationMode:i,generationState:s,postprocessingState:u,canvasState:f,systemState:c};n(mB());const{generationParameters:p,esrganParameters:g,facetoolParameters:y}=Pz(h);e.emit("generateImage",p,g,y),p.init_mask&&(p.init_mask=p.init_mask.substr(0,64).concat("...")),p.init_img&&(p.init_img=p.init_img.substr(0,64).concat("...")),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image generation requested: ${JSON.stringify({...p,...g,...y})}`}))},emitRunESRGAN:i=>{n(ei(!0));const{postprocessing:{upscalingLevel:a,upscalingDenoising:s,upscalingStrength:u}}=r(),c={upscale:[a,s,u]};e.emit("runPostprocessing",i,{type:"esrgan",...c}),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`ESRGAN upscale requested: ${JSON.stringify({file:i.url,...c})}`}))},emitRunFacetool:i=>{n(ei(!0));const{postprocessing:{facetoolType:a,facetoolStrength:s,codeformerFidelity:u}}=r(),c={facetool_strength:s};a==="codeformer"&&(c.codeformer_fidelity=u),e.emit("runPostprocessing",i,{type:a,...c}),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Face restoration (${a}) requested: ${JSON.stringify({file:i.url,...c})}`}))},emitDeleteImage:i=>{const{url:a,uuid:s,category:u,thumbnail:c}=i;n(ek(i)),e.emit("deleteImage",a,c,s,u)},emitRequestImages:i=>{const a=r().gallery,{earliest_mtime:s}=a.categories[i];e.emit("requestImages",i,s)},emitRequestNewImages:i=>{const a=r().gallery,{latest_mtime:s}=a.categories[i];e.emit("requestLatestImages",i,s)},emitCancelProcessing:()=>{e.emit("cancel")},emitRequestSystemConfig:()=>{e.emit("requestSystemConfig")},emitSearchForModels:i=>{e.emit("searchForModels",i)},emitAddNewModel:i=>{e.emit("addNewModel",i)},emitDeleteModel:i=>{e.emit("deleteModel",i)},emitConvertToDiffusers:i=>{n(pB()),e.emit("convertToDiffusers",i)},emitMergeDiffusersModels:i=>{n(gB()),e.emit("mergeDiffusersModels",i)},emitRequestModelChange:i=>{n(hB()),e.emit("requestModelChange",i)},emitSaveStagingAreaImageToGallery:i=>{e.emit("requestSaveStagingAreaImageToGallery",i)},emitRequestEmptyTempFolder:()=>{e.emit("requestEmptyTempFolder")}}};let Hf;const Mz=new Uint8Array(16);function Dz(){if(!Hf&&(Hf=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Hf))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Hf(Mz)}const Jt=[];for(let t=0;t<256;++t)Jt.push((t+256).toString(16).slice(1));function Nz(t,e=0){return(Jt[t[e+0]]+Jt[t[e+1]]+Jt[t[e+2]]+Jt[t[e+3]]+"-"+Jt[t[e+4]]+Jt[t[e+5]]+"-"+Jt[t[e+6]]+Jt[t[e+7]]+"-"+Jt[t[e+8]]+Jt[t[e+9]]+"-"+Jt[t[e+10]]+Jt[t[e+11]]+Jt[t[e+12]]+Jt[t[e+13]]+Jt[t[e+14]]+Jt[t[e+15]]).toLowerCase()}const Bz=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Wb={randomUUID:Bz};function Vf(t,e,n){if(Wb.randomUUID&&!e&&!t)return Wb.randomUUID();t=t||{};const r=t.random||(t.rng||Dz)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(let i=0;i<16;++i)e[n+i]=r[i];return e}return Nz(r)}const UW=dt("socketio/generateImage"),jW=dt("socketio/runESRGAN"),WW=dt("socketio/runFacetool"),HW=dt("socketio/deleteImage"),Hb=dt("socketio/requestImages"),Vb=dt("socketio/requestNewImages"),VW=dt("socketio/cancelProcessing"),Fz=dt("socketio/requestSystemConfig"),qW=dt("socketio/searchForModels"),KW=dt("socketio/addNewModel"),YW=dt("socketio/deleteModel"),XW=dt("socketio/convertToDiffusers"),QW=dt("socketio/mergeDiffusersModels"),JW=dt("socketio/requestModelChange"),ZW=dt("socketio/saveStagingAreaImageToGallery"),eH=dt("socketio/requestEmptyTempFolder"),$z=t=>{const{dispatch:e,getState:n}=t;return{onConnect:()=>{try{e(ub(!0)),e(ns(Ae.t("common.statusConnected"))),e(Fz());const r=n().gallery;r.categories.result.latest_mtime?e(Vb("result")):e(Hb("result")),r.categories.user.latest_mtime?e(Vb("user")):e(Hb("user"))}catch(r){console.error(r)}},onDisconnect:()=>{try{e(ub(!1)),e(ns(Ae.t("common.statusDisconnected"))),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:"Disconnected from server",level:"warning"}))}catch(r){console.error(r)}},onGenerationResult:r=>{try{const i=n(),{activeTab:a}=i.ui,{shouldLoopback:s}=i.postprocessing,{boundingBox:u,generationMode:c,...f}=r,h={uuid:Vf(),...f};if(["txt2img","img2img"].includes(c)&&e(Of({category:"result",image:{...h,category:"result"}})),c==="unifiedCanvas"&&r.boundingBox){const{boundingBox:p}=r;e(S5({image:{...h,category:"temp"},boundingBox:p})),i.canvas.shouldAutoSave&&e(Of({image:{...h,category:"result"},category:"result"}))}if(s)switch(wk[a]){case"img2img":{e(D5(h));break}}e(Cm()),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image generated: ${r.url}`}))}catch(i){console.error(i)}},onIntermediateResult:r=>{try{e(C5({uuid:Vf(),...r,category:"result"})),r.isBase64||e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Intermediate image generated: ${r.url}`}))}catch(i){console.error(i)}},onPostprocessingResult:r=>{try{e(Of({category:"result",image:{uuid:Vf(),...r,category:"result"}})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Postprocessed: ${r.url}`}))}catch(i){console.error(i)}},onProgressUpdate:r=>{try{e(ei(!0)),e(cB(r))}catch(i){console.error(i)}},onError:r=>{const{message:i,additionalData:a}=r;try{e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Server error: ${i}`,level:"error"})),e(cb()),e(Cm())}catch(s){console.error(s)}},onGalleryImages:r=>{const{images:i,areMoreImagesAvailable:a,category:s}=r,u=i.map(c=>({uuid:Vf(),...c}));e(b5({images:u,areMoreImagesAvailable:a,category:s})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Loaded ${i.length} images`}))},onProcessingCanceled:()=>{e(dB());const{intermediateImage:r}=n().gallery;r&&(r.isBase64||(e(Of({category:"result",image:r})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Intermediate image saved: ${r.url}`}))),e(Cm())),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:"Processing canceled",level:"warning"}))},onImageDeleted:r=>{const{url:i}=r;e(ek(r));const{generation:{initialImage:a,maskPath:s}}=n();(a===i||(a==null?void 0:a.url)===i)&&e(L5()),s===i&&e(N5("")),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image deleted: ${i}`}))},onSystemConfig:r=>{e(fB(r)),r.infill_methods.includes("patchmatch")||e(M5(r.infill_methods[0]))},onFoundModels:r=>{const{search_folder:i,found_models:a}=r;e(vB(i)),e(yB(a))},onNewModelAdded:r=>{const{new_model_name:i,model_list:a,update:s}=r;e(rs(a)),e(ei(!1)),e(ns(Ae.t("modelManager.modelAdded"))),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model Added: ${i}`,level:"info"})),e(zl({title:s?`${Ae.t("modelManager.modelUpdated")}: ${i}`:`${Ae.t("modelManager.modelAdded")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelDeleted:r=>{const{deleted_model_name:i,model_list:a}=r;e(rs(a)),e(ei(!1)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`${Ae.t("modelManager.modelAdded")}: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelEntryDeleted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelConverted:r=>{const{converted_model_name:i,model_list:a}=r;e(rs(a)),e(ns(Ae.t("common.statusModelConverted"))),e(ei(!1)),e(Af(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model converted: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelConverted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelsMerged:r=>{const{merged_models:i,merged_model_name:a,model_list:s}=r;e(rs(s)),e(ns(Ae.t("common.statusMergedModels"))),e(ei(!1)),e(Af(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Models merged: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelsMerged")}: ${a}`,status:"success",duration:2500,isClosable:!0}))},onModelChanged:r=>{const{model_name:i,model_list:a}=r;e(rs(a)),e(ns(Ae.t("common.statusModelChanged"))),e(ei(!1)),e(Af(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model changed: ${i}`,level:"info"}))},onModelChangeFailed:r=>{const{model_name:i,model_list:a}=r;e(rs(a)),e(ei(!1)),e(Af(!0)),e(cb()),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model change failed: ${i}`,level:"error"}))},onTempFolderEmptied:()=>{e(zl({title:Ae.t("toast.tempFoldersEmptied"),status:"success",duration:2500,isClosable:!0}))}}},zz=()=>{const{origin:t}=new URL(window.location.href),e=gd(t,{timeout:6e4,path:`${window.location.pathname}socket.io`});let n=!1;return i=>a=>s=>{const{onConnect:u,onDisconnect:c,onError:f,onPostprocessingResult:h,onGenerationResult:p,onIntermediateResult:g,onProgressUpdate:y,onGalleryImages:v,onProcessingCanceled:w,onImageDeleted:x,onSystemConfig:_,onModelChanged:S,onFoundModels:C,onNewModelAdded:O,onModelDeleted:I,onModelConverted:L,onModelsMerged:D,onModelChangeFailed:U,onTempFolderEmptied:X}=$z(i),{emitGenerateImage:K,emitRunESRGAN:te,emitRunFacetool:ce,emitDeleteImage:j,emitRequestImages:T,emitRequestNewImages:$,emitCancelProcessing:V,emitRequestSystemConfig:ie,emitSearchForModels:W,emitAddNewModel:Y,emitDeleteModel:Q,emitConvertToDiffusers:oe,emitMergeDiffusersModels:ve,emitRequestModelChange:we,emitSaveStagingAreaImageToGallery:Ue,emitRequestEmptyTempFolder:At}=Lz(i,e);switch(n||(e.on("connect",()=>u()),e.on("disconnect",()=>c()),e.on("error",me=>f(me)),e.on("generationResult",me=>p(me)),e.on("postprocessingResult",me=>h(me)),e.on("intermediateResult",me=>g(me)),e.on("progressUpdate",me=>y(me)),e.on("galleryImages",me=>v(me)),e.on("processingCanceled",()=>{w()}),e.on("imageDeleted",me=>{x(me)}),e.on("systemConfig",me=>{_(me)}),e.on("foundModels",me=>{C(me)}),e.on("newModelAdded",me=>{O(me)}),e.on("modelDeleted",me=>{I(me)}),e.on("modelConverted",me=>{L(me)}),e.on("modelsMerged",me=>{D(me)}),e.on("modelChanged",me=>{S(me)}),e.on("modelChangeFailed",me=>{U(me)}),e.on("tempFolderEmptied",()=>{X()}),n=!0),s.type){case"socketio/generateImage":{K(s.payload);break}case"socketio/runESRGAN":{te(s.payload);break}case"socketio/runFacetool":{ce(s.payload);break}case"socketio/deleteImage":{j(s.payload);break}case"socketio/requestImages":{T(s.payload);break}case"socketio/requestNewImages":{$(s.payload);break}case"socketio/cancelProcessing":{V();break}case"socketio/requestSystemConfig":{ie();break}case"socketio/searchForModels":{W(s.payload);break}case"socketio/addNewModel":{Y(s.payload);break}case"socketio/deleteModel":{Q(s.payload);break}case"socketio/convertToDiffusers":{oe(s.payload);break}case"socketio/mergeDiffusersModels":{ve(s.payload);break}case"socketio/requestModelChange":{we(s.payload);break}case"socketio/saveStagingAreaImageToGallery":{Ue(s.payload);break}case"socketio/requestEmptyTempFolder":{At();break}}a(s)}},Gz=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"].map(t=>`canvas.${t}`),Uz=["currentIteration","currentStatus","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","socketId","totalIterations","totalSteps","openModel","cancelOptions.cancelAfter"].map(t=>`system.${t}`),jz=["categories","currentCategory","currentImage","currentImageUuid","shouldAutoSwitchToNewImages","intermediateImage"].map(t=>`gallery.${t}`),Wz=["isLightboxOpen"].map(t=>`lightbox.${t}`),SP=Fx({generation:B5,postprocessing:$5,gallery:x5,system:SB,canvas:_5,ui:bB,lightbox:E5}),Hz=Yx.getPersistConfig({key:"root",storage:Kx,rootReducer:SP,blacklist:[...Gz,...Uz,...jz,...Wz],debounce:300}),Vz=ZN(Hz,SP),_P=TN({reducer:Vz,middleware:t=>t({immutableCheck:!1,serializableCheck:!1}).concat(zz()),devTools:{actionsDenylist:["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine"]}}),qz=a5(_P);function Kz(t){if(t.sheet)return t.sheet;for(var e=0;e0?en(Ys,--Ln):0,Gs--,Ot===10&&(Gs=1,rp--),Ot}function Kn(){return Ot=Ln2||Wu(Ot)>3?"":" "}function o6(t,e){for(;--e&&Kn()&&!(Ot<48||Ot>102||Ot>57&&Ot<65||Ot>70&&Ot<97););return ec(t,Sd()+(e<6&&ci()==32&&Kn()==32))}function cy(t){for(;Kn();)switch(Ot){case t:return Ln;case 34:case 39:t!==34&&t!==39&&cy(Ot);break;case 40:t===41&&cy(t);break;case 92:Kn();break}return Ln}function s6(t,e){for(;Kn()&&t+Ot!==47+10;)if(t+Ot===42+42&&ci()===47)break;return"/*"+ec(e,Ln-1)+"*"+np(t===47?t:Kn())}function l6(t){for(;!Wu(ci());)Kn();return ec(t,Ln)}function u6(t){return PP(wd("",null,null,null,[""],t=kP(t),0,[0],t))}function wd(t,e,n,r,i,a,s,u,c){for(var f=0,h=0,p=s,g=0,y=0,v=0,w=1,x=1,_=1,S=0,C="",O=i,I=a,L=r,D=C;x;)switch(v=S,S=Kn()){case 40:if(v!=108&&en(D,p-1)==58){uy(D+=qe(_d(S),"&","&\f"),"&\f")!=-1&&(_=-1);break}case 34:case 39:case 91:D+=_d(S);break;case 9:case 10:case 13:case 32:D+=a6(v);break;case 92:D+=o6(Sd()-1,7);continue;case 47:switch(ci()){case 42:case 47:qf(c6(s6(Kn(),Sd()),e,n),c);break;default:D+="/"}break;case 123*w:u[f++]=ti(D)*_;case 125*w:case 59:case 0:switch(S){case 0:case 125:x=0;case 59+h:y>0&&ti(D)-p&&qf(y>32?Kb(D+";",r,n,p-1):Kb(qe(D," ","")+";",r,n,p-2),c);break;case 59:D+=";";default:if(qf(L=qb(D,e,n,f,h,i,u,C,O=[],I=[],p),a),S===123)if(h===0)wd(D,e,L,L,O,a,p,u,I);else switch(g===99&&en(D,3)===110?100:g){case 100:case 109:case 115:wd(t,L,L,r&&qf(qb(t,L,L,0,0,i,u,C,i,O=[],p),I),i,I,p,u,r?O:I);break;default:wd(D,L,L,L,[""],I,0,u,I)}}f=h=y=0,w=_=1,C=D="",p=s;break;case 58:p=1+ti(D),y=v;default:if(w<1){if(S==123)--w;else if(S==125&&w++==0&&i6()==125)continue}switch(D+=np(S),S*w){case 38:_=h>0?1:(D+="\f",-1);break;case 44:u[f++]=(ti(D)-1)*_,_=1;break;case 64:ci()===45&&(D+=_d(Kn())),g=ci(),h=p=ti(C=D+=l6(Sd())),S++;break;case 45:v===45&&ti(D)==2&&(w=0)}}return a}function qb(t,e,n,r,i,a,s,u,c,f,h){for(var p=i-1,g=i===0?a:[""],y=$0(g),v=0,w=0,x=0;v0?g[_]+" "+S:qe(S,/&\f/g,g[_])))&&(c[x++]=C);return ip(t,e,n,i===0?B0:u,c,f,h)}function c6(t,e,n){return ip(t,e,n,wP,np(r6()),ju(t,2,-2),0)}function Kb(t,e,n,r){return ip(t,e,n,F0,ju(t,0,r),ju(t,r+1,-1),r)}function Rs(t,e){for(var n="",r=$0(t),i=0;i6)switch(en(t,e+1)){case 109:if(en(t,e+4)!==45)break;case 102:return qe(t,/(.+:)(.+)-([^]+)/,"$1"+He+"$2-$3$1"+lh+(en(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~uy(t,"stretch")?OP(qe(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(en(t,e+1)!==115)break;case 6444:switch(en(t,ti(t)-3-(~uy(t,"!important")&&10))){case 107:return qe(t,":",":"+He)+t;case 101:return qe(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+He+(en(t,14)===45?"inline-":"")+"box$3$1"+He+"$2$3$1"+ln+"$2box$3")+t}break;case 5936:switch(en(t,e+11)){case 114:return He+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return He+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return He+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return He+t+ln+t+t}return t}var S6=function(e,n,r,i){if(e.length>-1&&!e.return)switch(e.type){case F0:e.return=OP(e.value,e.length);break;case bP:return Rs([ql(e,{value:qe(e.value,"@","@"+He)})],i);case B0:if(e.length)return n6(e.props,function(a){switch(t6(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Rs([ql(e,{props:[qe(a,/:(read-\w+)/,":"+lh+"$1")]})],i);case"::placeholder":return Rs([ql(e,{props:[qe(a,/:(plac\w+)/,":"+He+"input-$1")]}),ql(e,{props:[qe(a,/:(plac\w+)/,":"+lh+"$1")]}),ql(e,{props:[qe(a,/:(plac\w+)/,ln+"input-$1")]})],i)}return""})}},_6=[S6],w6=function(e){var n=e.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(w){var x=w.getAttribute("data-emotion");x.indexOf(" ")!==-1&&(document.head.appendChild(w),w.setAttribute("data-s",""))})}var i=e.stylisPlugins||_6,a={},s,u=[];s=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(w){for(var x=w.getAttribute("data-emotion").split(" "),_=1;_=4;++r,i-=4)n=t.charCodeAt(r)&255|(t.charCodeAt(++r)&255)<<8|(t.charCodeAt(++r)&255)<<16|(t.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(i){case 3:e^=(t.charCodeAt(r+2)&255)<<16;case 2:e^=(t.charCodeAt(r+1)&255)<<8;case 1:e^=t.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var k6={animationIterationCount: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},P6=/[A-Z]|^ms/g,E6=/_EMO_([^_]+?)_([^]*?)_EMO_/g,AP=function(e){return e.charCodeAt(1)===45},Qb=function(e){return e!=null&&typeof e!="boolean"},Dm=EP(function(t){return AP(t)?t:t.replace(P6,"-$&").toLowerCase()}),Jb=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(E6,function(r,i,a){return ni={name:i,styles:a,next:ni},i})}return k6[e]!==1&&!AP(e)&&typeof n=="number"&&n!==0?n+"px":n};function Hu(t,e,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 ni={name:n.name,styles:n.styles,next:ni},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)ni={name:r.name,styles:r.styles,next:ni},r=r.next;var i=n.styles+";";return i}return O6(t,e,n)}case"function":{if(t!==void 0){var a=ni,s=n(t);return ni=a,Hu(t,e,s)}break}}if(e==null)return n;var u=e[n];return u!==void 0?u:n}function O6(t,e,n){var r="";if(Array.isArray(n))for(var i=0;i` or ``");return t}var NP=be.createContext({});NP.displayName="ColorModeContext";function BP(){const t=be.useContext(NP);if(t===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return t}function D6(){const t=BP(),e=DP();return{...t,theme:e}}function N6(t,e,n){var r,i;if(e==null)return e;const a=s=>{var u,c;return(c=(u=t.__breakpoints)==null?void 0:u.asArray)==null?void 0:c[s]};return(i=(r=a(e))!=null?r:a(n))!=null?i:n}function B6(t,e,n){var r,i;if(e==null)return e;const a=s=>{var u,c;return(c=(u=t.__cssMap)==null?void 0:u[s])==null?void 0:c.value};return(i=(r=a(e))!=null?r:a(n))!=null?i:n}function rH(t,e,n){const r=DP();return F6(t,e,n)(r)}function F6(t,e,n){const r=Array.isArray(e)?e:[e],i=Array.isArray(n)?n:[n];return a=>{const s=i.filter(Boolean),u=r.map((c,f)=>{var h,p;if(t==="breakpoints")return N6(a,c,(h=s[f])!=null?h:c);const g=`${t}.${c}`;return B6(a,g,(p=s[f])!=null?p:c)});return Array.isArray(e)?u:u[0]}}var FP=(...t)=>t.filter(Boolean).join(" ");function $6(){return!1}function zr(t){const e=typeof t;return t!=null&&(e==="object"||e==="function")&&!Array.isArray(t)}var iH=t=>{const{condition:e,message:n}=t;e&&$6()&&console.warn(n)};function io(t,...e){return z6(t)?t(...e):t}var z6=t=>typeof t=="function",aH=t=>t?"":void 0,oH=t=>t?!0:void 0;function sH(...t){return function(n){t.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function lH(...t){return function(n){t.forEach(r=>{r==null||r(n)})}}var uh={},G6={get exports(){return uh},set exports(t){uh=t}};(function(t,e){var n=200,r="__lodash_hash_undefined__",i=800,a=16,s=9007199254740991,u="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",h="[object Boolean]",p="[object Date]",g="[object Error]",y="[object Function]",v="[object GeneratorFunction]",w="[object Map]",x="[object Number]",_="[object Null]",S="[object Object]",C="[object Proxy]",O="[object RegExp]",I="[object Set]",L="[object String]",D="[object Undefined]",U="[object WeakMap]",X="[object ArrayBuffer]",K="[object DataView]",te="[object Float32Array]",ce="[object Float64Array]",j="[object Int8Array]",T="[object Int16Array]",$="[object Int32Array]",V="[object Uint8Array]",ie="[object Uint8ClampedArray]",W="[object Uint16Array]",Y="[object Uint32Array]",Q=/[\\^$.*+?()[\]{}|]/g,oe=/^\[object .+?Constructor\]$/,ve=/^(?:0|[1-9]\d*)$/,we={};we[te]=we[ce]=we[j]=we[T]=we[$]=we[V]=we[ie]=we[W]=we[Y]=!0,we[u]=we[c]=we[X]=we[h]=we[K]=we[p]=we[g]=we[y]=we[w]=we[x]=we[S]=we[O]=we[I]=we[L]=we[U]=!1;var Ue=typeof yn=="object"&&yn&&yn.Object===Object&&yn,At=typeof self=="object"&&self&&self.Object===Object&&self,me=Ue||At||Function("return this")(),qt=e&&!e.nodeType&&e,Bt=qt&&!0&&t&&!t.nodeType&&t,bn=Bt&&Bt.exports===qt,wr=bn&&Ue.process,Ft=function(){try{var E=Bt&&Bt.require&&Bt.require("util").types;return E||wr&&wr.binding&&wr.binding("util")}catch{}}(),xe=Ft&&Ft.isTypedArray;function Wr(E,N,H){switch(H.length){case 0:return E.call(N);case 1:return E.call(N,H[0]);case 2:return E.call(N,H[0],H[1]);case 3:return E.call(N,H[0],H[1],H[2])}return E.apply(N,H)}function Et(E,N){for(var H=-1,fe=Array(E);++H-1}function mp(E,N){var H=this.__data__,fe=yi(H,E);return fe<0?(++this.size,H.push([E,N])):H[fe][1]=N,this}xr.prototype.clear=tl,xr.prototype.delete=pp,xr.prototype.get=nl,xr.prototype.has=gp,xr.prototype.set=mp;function Xi(E){var N=-1,H=E==null?0:E.length;for(this.clear();++N1?H[Ie-1]:void 0,Pe=Ie>2?H[2]:void 0;for(Ye=E.length>3&&typeof Ye=="function"?(Ie--,Ye):void 0,Pe&&hc(H[0],H[1],Pe)&&(Ye=Ie<3?void 0:Ye,Ie=1),N=Object(N);++fe-1&&E%1==0&&E0){if(++N>=i)return arguments[0]}else N=0;return E.apply(void 0,arguments)}}function yc(E){if(E!=null){try{return Dn.call(E)}catch{}try{return E+""}catch{}}return""}function Mo(E,N){return E===N||E!==E&&N!==N}var ul=il(function(){return arguments}())?il:function(E){return za(E)&&bt.call(E,"callee")&&!Js.call(E,"callee")},cl=Array.isArray;function Do(E){return E!=null&&_c(E.length)&&!fl(E)}function Dp(E){return za(E)&&Do(E)}var Sc=sp||Fp;function fl(E){if(!kr(E))return!1;var N=To(E);return N==y||N==v||N==f||N==C}function _c(E){return typeof E=="number"&&E>-1&&E%1==0&&E<=s}function kr(E){var N=typeof E;return E!=null&&(N=="object"||N=="function")}function za(E){return E!=null&&typeof E=="object"}function Np(E){if(!za(E)||To(E)!=S)return!1;var N=Eo(E);if(N===null)return!0;var H=bt.call(N,"constructor")&&N.constructor;return typeof H=="function"&&H instanceof H&&Dn.call(H)==Co}var wc=xe?gi(xe):ic;function Bp(E){return uc(E,bc(E))}function bc(E){return Do(E)?Ep(E,!0):Rp(E)}var nt=Ro(function(E,N,H,fe){ac(E,N,H,fe)});function et(E){return function(){return E}}function Cc(E){return E}function Fp(){return!1}t.exports=nt})(G6,uh);const ai=uh;var U6=t=>/!(important)?$/.test(t),t2=t=>typeof t=="string"?t.replace(/!(important)?$/,"").trim():t,j6=(t,e)=>n=>{const r=String(e),i=U6(r),a=t2(r),s=t?`${t}.${a}`:a;let u=zr(n.__cssMap)&&s in n.__cssMap?n.__cssMap[s].varRef:e;return u=t2(u),i?`${u} !important`:u};function G0(t){const{scale:e,transform:n,compose:r}=t;return(a,s)=>{var u;const c=j6(e,a)(s);let f=(u=n==null?void 0:n(c,s))!=null?u:c;return r&&(f=r(f,s)),f}}var Kf=(...t)=>e=>t.reduce((n,r)=>r(n),e);function Ir(t,e){return n=>{const r={property:n,scale:t};return r.transform=G0({scale:t,transform:e}),r}}var W6=({rtl:t,ltr:e})=>n=>n.direction==="rtl"?t:e;function H6(t){const{property:e,scale:n,transform:r}=t;return{scale:n,property:W6(e),transform:n?G0({scale:n,compose:r}):r}}var $P=["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 V6(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...$P].join(" ")}function q6(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...$P].join(" ")}var K6={"--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(" ")},Y6={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 X6(t){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":t,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var Q6={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},fy={"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"},J6=new Set(Object.values(fy)),zP=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),Z6=t=>t.trim();function e8(t,e){if(t==null||zP.has(t))return t;const r=/(^[a-z-A-Z]+)\((.*)\)/g.exec(t),i=r==null?void 0:r[1],a=r==null?void 0:r[2];if(!i||!a)return t;const s=i.includes("-gradient")?i:`${i}-gradient`,[u,...c]=a.split(",").map(Z6).filter(Boolean);if((c==null?void 0:c.length)===0)return t;const f=u in fy?fy[u]:u;c.unshift(f);const h=c.map(p=>{if(J6.has(p))return p;const g=p.indexOf(" "),[y,v]=g!==-1?[p.substr(0,g),p.substr(g+1)]:[p],w=GP(v)?v:v&&v.split(" "),x=`colors.${y}`,_=x in e.__cssMap?e.__cssMap[x].varRef:y;return w?[_,...Array.isArray(w)?w:[w]].join(" "):_});return`${s}(${h.join(", ")})`}var GP=t=>typeof t=="string"&&t.includes("(")&&t.includes(")"),t8=(t,e)=>e8(t,e??{});function n8(t){return/^var\(--.+\)$/.test(t)}var r8=t=>{const e=parseFloat(t.toString()),n=t.toString().replace(String(e),"");return{unitless:!n,value:e,unit:n}},Jr=t=>e=>`${t}(${e})`,Fe={filter(t){return t!=="auto"?t:K6},backdropFilter(t){return t!=="auto"?t:Y6},ring(t){return X6(Fe.px(t))},bgClip(t){return t==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:t}},transform(t){return t==="auto"?V6():t==="auto-gpu"?q6():t},vh(t){return t==="$100vh"?"var(--chakra-vh)":t},px(t){if(t==null)return t;const{unitless:e}=r8(t);return e||typeof t=="number"?`${t}px`:t},fraction(t){return typeof t!="number"||t>1?t:`${t*100}%`},float(t,e){const n={left:"right",right:"left"};return e.direction==="rtl"?n[t]:t},degree(t){if(n8(t)||t==null)return t;const e=typeof t=="string"&&!t.endsWith("deg");return typeof t=="number"||e?`${t}deg`:t},gradient:t8,blur:Jr("blur"),opacity:Jr("opacity"),brightness:Jr("brightness"),contrast:Jr("contrast"),dropShadow:Jr("drop-shadow"),grayscale:Jr("grayscale"),hueRotate:Jr("hue-rotate"),invert:Jr("invert"),saturate:Jr("saturate"),sepia:Jr("sepia"),bgImage(t){return t==null||GP(t)||zP.has(t)?t:`url(${t})`},outline(t){const e=String(t)==="0"||String(t)==="none";return t!==null&&e?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:t}},flexDirection(t){var e;const{space:n,divide:r}=(e=Q6[t])!=null?e:{},i={flexDirection:t};return n&&(i[n]=1),r&&(i[r]=1),i}},B={borderWidths:Ir("borderWidths"),borderStyles:Ir("borderStyles"),colors:Ir("colors"),borders:Ir("borders"),radii:Ir("radii",Fe.px),space:Ir("space",Kf(Fe.vh,Fe.px)),spaceT:Ir("space",Kf(Fe.vh,Fe.px)),degreeT(t){return{property:t,transform:Fe.degree}},prop(t,e,n){return{property:t,scale:e,...e&&{transform:G0({scale:e,transform:n})}}},propT(t,e){return{property:t,transform:e}},sizes:Ir("sizes",Kf(Fe.vh,Fe.px)),sizesT:Ir("sizes",Kf(Fe.vh,Fe.fraction)),shadows:Ir("shadows"),logical:H6,blur:Ir("blur",Fe.blur)},bd={background:B.colors("background"),backgroundColor:B.colors("backgroundColor"),backgroundImage:B.propT("backgroundImage",Fe.bgImage),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Fe.bgClip},bgSize:B.prop("backgroundSize"),bgPosition:B.prop("backgroundPosition"),bg:B.colors("background"),bgColor:B.colors("backgroundColor"),bgPos:B.prop("backgroundPosition"),bgRepeat:B.prop("backgroundRepeat"),bgAttachment:B.prop("backgroundAttachment"),bgGradient:B.propT("backgroundImage",Fe.gradient),bgClip:{transform:Fe.bgClip}};Object.assign(bd,{bgImage:bd.backgroundImage,bgImg:bd.backgroundImage});var We={border:B.borders("border"),borderWidth:B.borderWidths("borderWidth"),borderStyle:B.borderStyles("borderStyle"),borderColor:B.colors("borderColor"),borderRadius:B.radii("borderRadius"),borderTop:B.borders("borderTop"),borderBlockStart:B.borders("borderBlockStart"),borderTopLeftRadius:B.radii("borderTopLeftRadius"),borderStartStartRadius:B.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:B.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:B.radii("borderTopRightRadius"),borderStartEndRadius:B.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:B.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:B.borders("borderRight"),borderInlineEnd:B.borders("borderInlineEnd"),borderBottom:B.borders("borderBottom"),borderBlockEnd:B.borders("borderBlockEnd"),borderBottomLeftRadius:B.radii("borderBottomLeftRadius"),borderBottomRightRadius:B.radii("borderBottomRightRadius"),borderLeft:B.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:B.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:B.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:B.borders(["borderLeft","borderRight"]),borderInline:B.borders("borderInline"),borderY:B.borders(["borderTop","borderBottom"]),borderBlock:B.borders("borderBlock"),borderTopWidth:B.borderWidths("borderTopWidth"),borderBlockStartWidth:B.borderWidths("borderBlockStartWidth"),borderTopColor:B.colors("borderTopColor"),borderBlockStartColor:B.colors("borderBlockStartColor"),borderTopStyle:B.borderStyles("borderTopStyle"),borderBlockStartStyle:B.borderStyles("borderBlockStartStyle"),borderBottomWidth:B.borderWidths("borderBottomWidth"),borderBlockEndWidth:B.borderWidths("borderBlockEndWidth"),borderBottomColor:B.colors("borderBottomColor"),borderBlockEndColor:B.colors("borderBlockEndColor"),borderBottomStyle:B.borderStyles("borderBottomStyle"),borderBlockEndStyle:B.borderStyles("borderBlockEndStyle"),borderLeftWidth:B.borderWidths("borderLeftWidth"),borderInlineStartWidth:B.borderWidths("borderInlineStartWidth"),borderLeftColor:B.colors("borderLeftColor"),borderInlineStartColor:B.colors("borderInlineStartColor"),borderLeftStyle:B.borderStyles("borderLeftStyle"),borderInlineStartStyle:B.borderStyles("borderInlineStartStyle"),borderRightWidth:B.borderWidths("borderRightWidth"),borderInlineEndWidth:B.borderWidths("borderInlineEndWidth"),borderRightColor:B.colors("borderRightColor"),borderInlineEndColor:B.colors("borderInlineEndColor"),borderRightStyle:B.borderStyles("borderRightStyle"),borderInlineEndStyle:B.borderStyles("borderInlineEndStyle"),borderTopRadius:B.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:B.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:B.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:B.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(We,{rounded:We.borderRadius,roundedTop:We.borderTopRadius,roundedTopLeft:We.borderTopLeftRadius,roundedTopRight:We.borderTopRightRadius,roundedTopStart:We.borderStartStartRadius,roundedTopEnd:We.borderStartEndRadius,roundedBottom:We.borderBottomRadius,roundedBottomLeft:We.borderBottomLeftRadius,roundedBottomRight:We.borderBottomRightRadius,roundedBottomStart:We.borderEndStartRadius,roundedBottomEnd:We.borderEndEndRadius,roundedLeft:We.borderLeftRadius,roundedRight:We.borderRightRadius,roundedStart:We.borderInlineStartRadius,roundedEnd:We.borderInlineEndRadius,borderStart:We.borderInlineStart,borderEnd:We.borderInlineEnd,borderTopStartRadius:We.borderStartStartRadius,borderTopEndRadius:We.borderStartEndRadius,borderBottomStartRadius:We.borderEndStartRadius,borderBottomEndRadius:We.borderEndEndRadius,borderStartRadius:We.borderInlineStartRadius,borderEndRadius:We.borderInlineEndRadius,borderStartWidth:We.borderInlineStartWidth,borderEndWidth:We.borderInlineEndWidth,borderStartColor:We.borderInlineStartColor,borderEndColor:We.borderInlineEndColor,borderStartStyle:We.borderInlineStartStyle,borderEndStyle:We.borderInlineEndStyle});var i8={color:B.colors("color"),textColor:B.colors("color"),fill:B.colors("fill"),stroke:B.colors("stroke")},dy={boxShadow:B.shadows("boxShadow"),mixBlendMode:!0,blendMode:B.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:B.prop("backgroundBlendMode"),opacity:!0};Object.assign(dy,{shadow:dy.boxShadow});var a8={filter:{transform:Fe.filter},blur:B.blur("--chakra-blur"),brightness:B.propT("--chakra-brightness",Fe.brightness),contrast:B.propT("--chakra-contrast",Fe.contrast),hueRotate:B.degreeT("--chakra-hue-rotate"),invert:B.propT("--chakra-invert",Fe.invert),saturate:B.propT("--chakra-saturate",Fe.saturate),dropShadow:B.propT("--chakra-drop-shadow",Fe.dropShadow),backdropFilter:{transform:Fe.backdropFilter},backdropBlur:B.blur("--chakra-backdrop-blur"),backdropBrightness:B.propT("--chakra-backdrop-brightness",Fe.brightness),backdropContrast:B.propT("--chakra-backdrop-contrast",Fe.contrast),backdropHueRotate:B.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:B.propT("--chakra-backdrop-invert",Fe.invert),backdropSaturate:B.propT("--chakra-backdrop-saturate",Fe.saturate)},ch={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Fe.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:B.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:B.space("gap"),rowGap:B.space("rowGap"),columnGap:B.space("columnGap")};Object.assign(ch,{flexDir:ch.flexDirection});var UP={gridGap:B.space("gridGap"),gridColumnGap:B.space("gridColumnGap"),gridRowGap:B.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},o8={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Fe.outline},outlineOffset:!0,outlineColor:B.colors("outlineColor")},lr={width:B.sizesT("width"),inlineSize:B.sizesT("inlineSize"),height:B.sizes("height"),blockSize:B.sizes("blockSize"),boxSize:B.sizes(["width","height"]),minWidth:B.sizes("minWidth"),minInlineSize:B.sizes("minInlineSize"),minHeight:B.sizes("minHeight"),minBlockSize:B.sizes("minBlockSize"),maxWidth:B.sizes("maxWidth"),maxInlineSize:B.sizes("maxInlineSize"),maxHeight:B.sizes("maxHeight"),maxBlockSize:B.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,hideFrom:{scale:"breakpoints",transform:(t,e)=>{var n,r,i;return{[(i=(r=(n=e.__breakpoints)==null?void 0:n.get(t))==null?void 0:r.minWQuery)!=null?i:`@media screen and (min-width: ${t})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(t,e)=>{var n,r,i;return{[(i=(r=(n=e.__breakpoints)==null?void 0:n.get(t))==null?void 0:r.maxWQuery)!=null?i:`@media screen and (max-width: ${t})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:B.propT("float",Fe.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(lr,{w:lr.width,h:lr.height,minW:lr.minWidth,maxW:lr.maxWidth,minH:lr.minHeight,maxH:lr.maxHeight,overscroll:lr.overscrollBehavior,overscrollX:lr.overscrollBehaviorX,overscrollY:lr.overscrollBehaviorY});var s8={listStyleType:!0,listStylePosition:!0,listStylePos:B.prop("listStylePosition"),listStyleImage:!0,listStyleImg:B.prop("listStyleImage")};function l8(t,e,n,r){const i=typeof e=="string"?e.split("."):[e];for(r=0;r{const e=new WeakMap;return(r,i,a,s)=>{if(typeof r>"u")return t(r,i,a);e.has(r)||e.set(r,new Map);const u=e.get(r);if(u.has(i))return u.get(i);const c=t(r,i,a,s);return u.set(i,c),c}},c8=u8(l8),f8={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},d8={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},Nm=(t,e,n)=>{const r={},i=c8(t,e,{});for(const a in i)a in n&&n[a]!=null||(r[a]=i[a]);return r},h8={srOnly:{transform(t){return t===!0?f8:t==="focusable"?d8:{}}},layerStyle:{processResult:!0,transform:(t,e,n)=>Nm(e,`layerStyles.${t}`,n)},textStyle:{processResult:!0,transform:(t,e,n)=>Nm(e,`textStyles.${t}`,n)},apply:{processResult:!0,transform:(t,e,n)=>Nm(e,t,n)}},Su={position:!0,pos:B.prop("position"),zIndex:B.prop("zIndex","zIndices"),inset:B.spaceT("inset"),insetX:B.spaceT(["left","right"]),insetInline:B.spaceT("insetInline"),insetY:B.spaceT(["top","bottom"]),insetBlock:B.spaceT("insetBlock"),top:B.spaceT("top"),insetBlockStart:B.spaceT("insetBlockStart"),bottom:B.spaceT("bottom"),insetBlockEnd:B.spaceT("insetBlockEnd"),left:B.spaceT("left"),insetInlineStart:B.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:B.spaceT("right"),insetInlineEnd:B.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Su,{insetStart:Su.insetInlineStart,insetEnd:Su.insetInlineEnd});var p8={ring:{transform:Fe.ring},ringColor:B.colors("--chakra-ring-color"),ringOffset:B.prop("--chakra-ring-offset-width"),ringOffsetColor:B.colors("--chakra-ring-offset-color"),ringInset:B.prop("--chakra-ring-inset")},st={margin:B.spaceT("margin"),marginTop:B.spaceT("marginTop"),marginBlockStart:B.spaceT("marginBlockStart"),marginRight:B.spaceT("marginRight"),marginInlineEnd:B.spaceT("marginInlineEnd"),marginBottom:B.spaceT("marginBottom"),marginBlockEnd:B.spaceT("marginBlockEnd"),marginLeft:B.spaceT("marginLeft"),marginInlineStart:B.spaceT("marginInlineStart"),marginX:B.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:B.spaceT("marginInline"),marginY:B.spaceT(["marginTop","marginBottom"]),marginBlock:B.spaceT("marginBlock"),padding:B.space("padding"),paddingTop:B.space("paddingTop"),paddingBlockStart:B.space("paddingBlockStart"),paddingRight:B.space("paddingRight"),paddingBottom:B.space("paddingBottom"),paddingBlockEnd:B.space("paddingBlockEnd"),paddingLeft:B.space("paddingLeft"),paddingInlineStart:B.space("paddingInlineStart"),paddingInlineEnd:B.space("paddingInlineEnd"),paddingX:B.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:B.space("paddingInline"),paddingY:B.space(["paddingTop","paddingBottom"]),paddingBlock:B.space("paddingBlock")};Object.assign(st,{m:st.margin,mt:st.marginTop,mr:st.marginRight,me:st.marginInlineEnd,marginEnd:st.marginInlineEnd,mb:st.marginBottom,ml:st.marginLeft,ms:st.marginInlineStart,marginStart:st.marginInlineStart,mx:st.marginX,my:st.marginY,p:st.padding,pt:st.paddingTop,py:st.paddingY,px:st.paddingX,pb:st.paddingBottom,pl:st.paddingLeft,ps:st.paddingInlineStart,paddingStart:st.paddingInlineStart,pr:st.paddingRight,pe:st.paddingInlineEnd,paddingEnd:st.paddingInlineEnd});var g8={textDecorationColor:B.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:B.shadows("textShadow")},m8={clipPath:!0,transform:B.propT("transform",Fe.transform),transformOrigin:!0,translateX:B.spaceT("--chakra-translate-x"),translateY:B.spaceT("--chakra-translate-y"),skewX:B.degreeT("--chakra-skew-x"),skewY:B.degreeT("--chakra-skew-y"),scaleX:B.prop("--chakra-scale-x"),scaleY:B.prop("--chakra-scale-y"),scale:B.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:B.degreeT("--chakra-rotate")},v8={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:B.prop("transitionDuration","transition.duration"),transitionProperty:B.prop("transitionProperty","transition.property"),transitionTimingFunction:B.prop("transitionTimingFunction","transition.easing")},y8={fontFamily:B.prop("fontFamily","fonts"),fontSize:B.prop("fontSize","fontSizes",Fe.px),fontWeight:B.prop("fontWeight","fontWeights"),lineHeight:B.prop("lineHeight","lineHeights"),letterSpacing:B.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(t){if(t===!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"}},S8={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:B.spaceT("scrollMargin"),scrollMarginTop:B.spaceT("scrollMarginTop"),scrollMarginBottom:B.spaceT("scrollMarginBottom"),scrollMarginLeft:B.spaceT("scrollMarginLeft"),scrollMarginRight:B.spaceT("scrollMarginRight"),scrollMarginX:B.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:B.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:B.spaceT("scrollPadding"),scrollPaddingTop:B.spaceT("scrollPaddingTop"),scrollPaddingBottom:B.spaceT("scrollPaddingBottom"),scrollPaddingLeft:B.spaceT("scrollPaddingLeft"),scrollPaddingRight:B.spaceT("scrollPaddingRight"),scrollPaddingX:B.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:B.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function jP(t){return zr(t)&&t.reference?t.reference:String(t)}var ap=(t,...e)=>e.map(jP).join(` ${t} `).replace(/calc/g,""),n2=(...t)=>`calc(${ap("+",...t)})`,r2=(...t)=>`calc(${ap("-",...t)})`,hy=(...t)=>`calc(${ap("*",...t)})`,i2=(...t)=>`calc(${ap("/",...t)})`,a2=t=>{const e=jP(t);return e!=null&&!Number.isNaN(parseFloat(e))?String(e).startsWith("-")?String(e).slice(1):`-${e}`:hy(e,-1)},eo=Object.assign(t=>({add:(...e)=>eo(n2(t,...e)),subtract:(...e)=>eo(r2(t,...e)),multiply:(...e)=>eo(hy(t,...e)),divide:(...e)=>eo(i2(t,...e)),negate:()=>eo(a2(t)),toString:()=>t.toString()}),{add:n2,subtract:r2,multiply:hy,divide:i2,negate:a2});function _8(t,e="-"){return t.replace(/\s+/g,e)}function w8(t){const e=_8(t.toString());return C8(b8(e))}function b8(t){return t.includes("\\.")?t:!Number.isInteger(parseFloat(t.toString()))?t.replace(".","\\."):t}function C8(t){return t.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function x8(t,e=""){return[e,t].filter(Boolean).join("-")}function k8(t,e){return`var(${t}${e?`, ${e}`:""})`}function P8(t,e=""){return w8(`--${x8(t,e)}`)}function E8(t,e,n){const r=P8(t,n);return{variable:r,reference:k8(r,e)}}function O8(t){const e=t==null?0:t.length;return e?t[e-1]:void 0}function T8(t){const e=parseFloat(t.toString()),n=t.toString().replace(String(e),"");return{unitless:!n,value:e,unit:n}}function py(t){if(t==null)return t;const{unitless:e}=T8(t);return e||typeof t=="number"?`${t}px`:t}var WP=(t,e)=>parseInt(t[1],10)>parseInt(e[1],10)?1:-1,U0=t=>Object.fromEntries(Object.entries(t).sort(WP));function o2(t){const e=U0(t);return Object.assign(Object.values(e),e)}function R8(t){const e=Object.keys(U0(t));return new Set(e)}function s2(t){var e;if(!t)return t;t=(e=py(t))!=null?e:t;const n=-.02;return typeof t=="number"?`${t+n}`:t.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function au(t,e){const n=["@media screen"];return t&&n.push("and",`(min-width: ${py(t)})`),e&&n.push("and",`(max-width: ${py(e)})`),n.join(" ")}function A8(t){var e;if(!t)return null;t.base=(e=t.base)!=null?e:"0px";const n=o2(t),r=Object.entries(t).sort(WP).map(([s,u],c,f)=>{var h;let[,p]=(h=f[c+1])!=null?h:[];return p=parseFloat(p)>0?s2(p):void 0,{_minW:s2(u),breakpoint:s,minW:u,maxW:p,maxWQuery:au(null,p),minWQuery:au(u),minMaxQuery:au(u,p)}}),i=R8(t),a=Array.from(i.values());return{keys:i,normalized:n,isResponsive(s){const u=Object.keys(s);return u.length>0&&u.every(c=>i.has(c))},asObject:U0(t),asArray:o2(t),details:r,get(s){return r.find(u=>u.breakpoint===s)},media:[null,...n.map(s=>au(s)).slice(1)],toArrayValue(s){if(!zr(s))throw new Error("toArrayValue: value must be an object");const u=a.map(c=>{var f;return(f=s[c])!=null?f:null});for(;O8(u)===null;)u.pop();return u},toObjectValue(s){if(!Array.isArray(s))throw new Error("toObjectValue: value must be an array");return s.reduce((u,c,f)=>{const h=a[f];return h!=null&&c!=null&&(u[h]=c),u},{})}}}var Qt={hover:(t,e)=>`${t}:hover ${e}, ${t}[data-hover] ${e}`,focus:(t,e)=>`${t}:focus ${e}, ${t}[data-focus] ${e}`,focusVisible:(t,e)=>`${t}:focus-visible ${e}`,focusWithin:(t,e)=>`${t}:focus-within ${e}`,active:(t,e)=>`${t}:active ${e}, ${t}[data-active] ${e}`,disabled:(t,e)=>`${t}:disabled ${e}, ${t}[data-disabled] ${e}`,invalid:(t,e)=>`${t}:invalid ${e}, ${t}[data-invalid] ${e}`,checked:(t,e)=>`${t}:checked ${e}, ${t}[data-checked] ${e}`,indeterminate:(t,e)=>`${t}:indeterminate ${e}, ${t}[aria-checked=mixed] ${e}, ${t}[data-indeterminate] ${e}`,readOnly:(t,e)=>`${t}:read-only ${e}, ${t}[readonly] ${e}, ${t}[data-read-only] ${e}`,expanded:(t,e)=>`${t}:read-only ${e}, ${t}[aria-expanded=true] ${e}, ${t}[data-expanded] ${e}`,placeholderShown:(t,e)=>`${t}:placeholder-shown ${e}`},la=t=>HP(e=>t(e,"&"),"[role=group]","[data-group]",".group"),Ai=t=>HP(e=>t(e,"~ &"),"[data-peer]",".peer"),HP=(t,...e)=>e.map(t).join(", "),op={_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",_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:la(Qt.hover),_peerHover:Ai(Qt.hover),_groupFocus:la(Qt.focus),_peerFocus:Ai(Qt.focus),_groupFocusVisible:la(Qt.focusVisible),_peerFocusVisible:Ai(Qt.focusVisible),_groupActive:la(Qt.active),_peerActive:Ai(Qt.active),_groupDisabled:la(Qt.disabled),_peerDisabled:Ai(Qt.disabled),_groupInvalid:la(Qt.invalid),_peerInvalid:Ai(Qt.invalid),_groupChecked:la(Qt.checked),_peerChecked:Ai(Qt.checked),_groupFocusWithin:la(Qt.focusWithin),_peerFocusWithin:Ai(Qt.focusWithin),_peerPlaceholderShown:Ai(Qt.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]"},I8=Object.keys(op);function l2(t,e){return E8(String(t).replace(/\./g,"-"),void 0,e)}function L8(t,e){let n={};const r={};for(const[i,a]of Object.entries(t)){const{isSemantic:s,value:u}=a,{variable:c,reference:f}=l2(i,e==null?void 0:e.cssVarPrefix);if(!s){if(i.startsWith("space")){const g=i.split("."),[y,...v]=g,w=`${y}.-${v.join(".")}`,x=eo.negate(u),_=eo.negate(f);r[w]={value:x,var:c,varRef:_}}n[c]=u,r[i]={value:u,var:c,varRef:f};continue}const h=g=>{const v=[String(i).split(".")[0],g].join(".");if(!t[v])return g;const{reference:x}=l2(v,e==null?void 0:e.cssVarPrefix);return x},p=zr(u)?u:{default:u};n=ai(n,Object.entries(p).reduce((g,[y,v])=>{var w,x;const _=h(v);if(y==="default")return g[c]=_,g;const S=(x=(w=op)==null?void 0:w[y])!=null?x:y;return g[S]={[c]:_},g},{})),r[i]={value:f,var:c,varRef:f}}return{cssVars:n,cssMap:r}}function M8(t,e=[]){const n=Object.assign({},t);for(const r of e)r in n&&delete n[r];return n}function D8(t,e){const n={};for(const r of e)r in t&&(n[r]=t[r]);return n}var N8=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function B8(t){return D8(t,N8)}function F8(t){return t.semanticTokens}function $8(t){const{__cssMap:e,__cssVars:n,__breakpoints:r,...i}=t;return i}function z8({tokens:t,semanticTokens:e}){var n,r;const i=Object.entries((n=gy(t))!=null?n:{}).map(([s,u])=>[s,{isSemantic:!1,value:u}]),a=Object.entries((r=gy(e,1))!=null?r:{}).map(([s,u])=>[s,{isSemantic:!0,value:u}]);return Object.fromEntries([...i,...a])}function gy(t,e=1/0){return!zr(t)&&!Array.isArray(t)||!e?t:Object.entries(t).reduce((n,[r,i])=>(zr(i)||Array.isArray(i)?Object.entries(gy(i,e-1)).forEach(([a,s])=>{n[`${r}.${a}`]=s}):n[r]=i,n),{})}function uH(t){var e;const n=$8(t),r=B8(n),i=F8(n),a=z8({tokens:r,semanticTokens:i}),s=(e=n.config)==null?void 0:e.cssVarPrefix,{cssMap:u,cssVars:c}=L8(a,{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"},...c},__cssMap:u,__breakpoints:A8(n.breakpoints)}),n}var j0=ai({},bd,We,i8,ch,lr,a8,p8,o8,UP,h8,Su,dy,st,S8,y8,g8,m8,s8,v8),G8=Object.assign({},st,lr,ch,UP,Su),cH=Object.keys(G8),U8=[...Object.keys(j0),...I8],j8={...j0,...op},W8=t=>t in j8,H8=t=>e=>{if(!e.__breakpoints)return t;const{isResponsive:n,toArrayValue:r,media:i}=e.__breakpoints,a={};for(const s in t){let u=io(t[s],e);if(u==null)continue;if(u=zr(u)&&n(u)?r(u):u,!Array.isArray(u)){a[s]=u;continue}const c=u.slice(0,i.length).length;for(let f=0;ft.startsWith("--")&&typeof e=="string"&&!q8(e),Y8=(t,e)=>{var n,r;if(e==null)return e;const i=c=>{var f,h;return(h=(f=t.__cssMap)==null?void 0:f[c])==null?void 0:h.varRef},a=c=>{var f;return(f=i(c))!=null?f:c},[s,u]=V8(e);return e=(r=(n=i(s))!=null?n:a(u))!=null?r:a(e),e};function X8(t){const{configs:e={},pseudos:n={},theme:r}=t,i=(a,s=!1)=>{var u,c,f;const h=io(a,r),p=H8(h)(r);let g={};for(let y in p){const v=p[y];let w=io(v,r);y in n&&(y=n[y]),K8(y,w)&&(w=Y8(r,w));let x=e[y];if(x===!0&&(x={property:y}),zr(w)){g[y]=(u=g[y])!=null?u:{},g[y]=ai({},g[y],i(w,!0));continue}let _=(f=(c=x==null?void 0:x.transform)==null?void 0:c.call(x,w,r,h))!=null?f:w;_=x!=null&&x.processResult?i(_,!0):_;const S=io(x==null?void 0:x.property,r);if(!s&&(x!=null&&x.static)){const C=io(x.static,r);g=ai({},g,C)}if(S&&Array.isArray(S)){for(const C of S)g[C]=_;continue}if(S){S==="&"&&zr(_)?g=ai({},g,_):g[S]=_;continue}if(zr(_)){g=ai({},g,_);continue}g[y]=_}return g};return i}var Q8=t=>e=>X8({theme:e,pseudos:op,configs:j0})(t);function fH(t){return t}function dH(t){return t}function hH(t){return{definePartsStyle(e){return e},defineMultiStyleConfig(e){return{parts:t,...e}}}}function J8(t,e){if(Array.isArray(t))return t;if(zr(t))return e(t);if(t!=null)return[t]}function Z8(t,e){for(let n=e+1;n{ai(f,{[C]:g?S[C]:{[_]:S[C]}})});continue}if(!y){g?ai(f,S):f[_]=S;continue}f[_]=S}}return f}}function tG(t){return e=>{var n;const{variant:r,size:i,theme:a}=e,s=eG(a);return ai({},io((n=t.baseStyle)!=null?n:{},e),s(t,"sizes",i,e),s(t,"variants",r,e))}}function pH(t,e,n){var r,i,a;return(a=(i=(r=t.__cssMap)==null?void 0:r[`${e}.${n}`])==null?void 0:i.varRef)!=null?a:n}function VP(t){return M8(t,["styleConfig","size","variant","colorScheme"])}function nG(t,e){const n={};return Object.keys(t).forEach(r=>{e.includes(r)||(n[r]=t[r])}),n}function rG(t,e,n,r){const i=typeof e=="string"?e.split("."):[e];for(r=0;r{const e=new WeakMap;return(r,i,a,s)=>{if(typeof r>"u")return t(r,i,a);e.has(r)||e.set(r,new Map);const u=e.get(r);if(u.has(i))return u.get(i);const c=t(r,i,a,s);return u.set(i,c),c}},aG=iG(rG);function qP(t,e){const n={};return Object.keys(t).forEach(r=>{const i=t[r];e(i,r,t)&&(n[r]=i)}),n}var KP=t=>qP(t,e=>e!=null);function oG(t){return typeof t=="function"}function sG(t,...e){return oG(t)?t(...e):t}function gH(...t){return function(n){t.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var lG=typeof Element<"u",uG=typeof Map=="function",cG=typeof Set=="function",fG=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Cd(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!Cd(t[r],e[r]))return!1;return!0}var a;if(uG&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;for(a=t.entries();!(r=a.next()).done;)if(!Cd(r.value[1],e.get(r.value[0])))return!1;return!0}if(cG&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(fG&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;if(lG&&t instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&t.$$typeof)&&!Cd(t[i[r]],e[i[r]]))return!1;return!0}return t!==t&&e!==e}var dG=function(e,n){try{return Cd(e,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};function YP(t,e={}){var n;const{styleConfig:r,...i}=e,{theme:a,colorMode:s}=D6(),u=t?aG(a,`components.${t}`):void 0,c=r||u,f=ai({theme:a,colorMode:s},(n=c==null?void 0:c.defaultProps)!=null?n:{},KP(nG(i,["children"]))),h=be.useRef({});if(c){const g=tG(c)(f);dG(h.current,g)||(h.current=g)}return h.current}function XP(t,e={}){return YP(t,e)}function mH(t,e={}){return YP(t,e)}var hG=new Set([...U8,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),pG=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function gG(t){return pG.has(t)||!hG.has(t)}function mG(t){const e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function vG(t,...e){if(t==null)throw new TypeError("Cannot convert undefined or null to object");const n={...t};for(const r of e)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 yG=/^((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)-.*))$/,SG=EP(function(t){return yG.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),_G=SG,wG=function(e){return e!=="theme"},u2=function(e){return typeof e=="string"&&e.charCodeAt(0)>96?_G:wG},c2=function(e,n,r){var i;if(n){var a=n.shouldForwardProp;i=e.__emotion_forwardProp&&a?function(s){return e.__emotion_forwardProp(s)&&a(s)}:a}return typeof i!="function"&&r&&(i=e.__emotion_forwardProp),i},bG=function(e){var n=e.cache,r=e.serialized,i=e.isStringTag;return TP(n,r,i),R6(function(){return RP(n,r,i)}),null},CG=function t(e,n){var r=e.__emotion_real===e,i=r&&e.__emotion_base||e,a,s;n!==void 0&&(a=n.label,s=n.target);var u=c2(e,n,r),c=u||u2(i),f=!c("as");return function(){var h=arguments,p=r&&e.__emotion_styles!==void 0?e.__emotion_styles.slice(0):[];if(a!==void 0&&p.push("label:"+a+";"),h[0]==null||h[0].raw===void 0)p.push.apply(p,h);else{p.push(h[0][0]);for(var g=h.length,y=1;ye=>{const{theme:n,css:r,__css:i,sx:a,...s}=e,u=qP(s,(p,g)=>W8(g)),c=sG(t,e),f=vG({},i,c,KP(u),a),h=Q8(f)(e.theme);return r?[h,r]:h};function Bm(t,e){const{baseStyle:n,...r}=e??{};r.shouldForwardProp||(r.shouldForwardProp=gG);const i=PG({baseStyle:n}),a=kG(t,r)(i);return As.forwardRef(function(c,f){const{colorMode:h,forced:p}=BP();return As.createElement(a,{ref:f,"data-theme":p?h:void 0,...c})})}function EG(){const t=new Map;return new Proxy(Bm,{apply(e,n,r){return Bm(...r)},get(e,n){return t.has(n)||t.set(n,Bm(n)),t.get(n)}})}var dh=EG();function W0(t){return be.forwardRef(t)}var OG=M6({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),QP=W0((t,e)=>{const n=XP("Spinner",t),{label:r="Loading...",thickness:i="2px",speed:a="0.45s",emptyColor:s="transparent",className:u,...c}=VP(t),f=FP("chakra-spinner",u),h={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:s,borderLeftColor:s,animation:`${OG} ${a} linear infinite`,...n};return jt.jsx(dh.div,{ref:e,__css:h,className:f,...c,children:r&&jt.jsx(dh.span,{srOnly:!0,children:r})})});QP.displayName="Spinner";var JP=W0(function(e,n){const r=XP("Text",e),{className:i,align:a,decoration:s,casing:u,...c}=VP(e),f=mG({textAlign:e.align,textDecoration:e.decoration,textTransform:e.casing});return jt.jsx(dh.p,{ref:n,className:FP("chakra-text",e.className),...f,...c,__css:r})});JP.displayName="Text";var ZP=W0(function(e,n){const{direction:r,align:i,justify:a,wrap:s,basis:u,grow:c,shrink:f,...h}=e,p={display:"flex",flexDirection:r,alignItems:i,justifyContent:a,flexWrap:s,flexBasis:u,flexGrow:c,flexShrink:f};return jt.jsx(dh.div,{ref:n,__css:p,...h})});ZP.displayName="Flex";const d2=t=>{const{t:e}=lB(),{showText:n=!1,text:r=e("common.loadingInvokeAI")}=t;return jt.jsxs(ZP,{width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#121212",flexDirection:"column",rowGap:4,children:[jt.jsx(QP,{color:"grey",w:"5rem",h:"5rem"}),n&&jt.jsx(JP,{color:"grey",fontWeight:"semibold",fontFamily:"'Inter', sans-serif",children:r})]})},TG=be.lazy(()=>bx(()=>import("./App-982926da.js"),["./App-982926da.js","./storeHooks-e63a2dc4.js","./App-08e5c546.css"],import.meta.url)),RG=be.lazy(()=>bx(()=>import("./ThemeLocaleProvider-a1ea5622.js"),["./ThemeLocaleProvider-a1ea5622.js","./storeHooks-e63a2dc4.js"],import.meta.url));function AG(){return jt.jsx(As.StrictMode,{children:jt.jsx(Y3,{store:_P,children:jt.jsx(Ax,{loading:jt.jsx(d2,{}),persistor:qz,children:jt.jsx(As.Suspense,{fallback:jt.jsx(d2,{showText:!0}),children:jt.jsx(RG,{children:jt.jsx(TG,{})})})})})})}Fm.createRoot(document.getElementById("root")).render(jt.jsx(AG,{}));export{rW as $,Vf as A,Of as B,yU as C,D5 as D,lB as E,ZP as F,xd as G,tW as H,oW as I,XW as J,KW as K,qW as L,wW as M,vB as N,yB as O,CW as P,JW as Q,As as R,QP as S,JP as T,fW as U,YW as V,rH as W,QW as X,BW as Y,eW as Z,Xd as _,FP as a,IW as a$,aW as a0,_W as a1,bW as a2,lW as a3,qz as a4,sW as a5,gW as a6,vU as a7,vW as a8,TW as a9,gj as aA,Ow as aB,Rj as aC,kj as aD,Vj as aE,Fj as aF,mj as aG,N5 as aH,vj as aI,Aj as aJ,tj as aK,ej as aL,L5 as aM,Xj as aN,zj as aO,Gj as aP,$j as aQ,Lj as aR,kz as aS,fF as aT,cF as aU,Yj as aV,Ij as aW,R5 as aX,Bj as aY,MW as aZ,yj as a_,yW as aa,OW as ab,NW as ac,Hj as ad,Wj as ae,jj as af,Jj as ag,Zj as ah,DW as ai,Qj as aj,HW as ak,dd as al,O5 as am,wj as an,bj as ao,lj as ap,pW as aq,hj as ar,Tj as as,jW as at,WW as au,SW as av,Dj as aw,_j as ax,Cj as ay,Mj as az,sH as b,XU as b$,AW as b0,uj as b1,LW as b2,iW as b3,VW as b4,hW as b5,dW as b6,Ew as b7,UW as b8,Kj as b9,VU as bA,Qx as bB,zG as bC,GG as bD,UG as bE,jU as bF,tU as bG,eU as bH,XG as bI,UU as bJ,ZW as bK,QG as bL,lU as bM,uU as bN,Ef as bO,va as bP,PU as bQ,xU as bR,wU as bS,NG as bT,BG as bU,$W as bV,zW as bW,pU as bX,oU as bY,sU as bZ,nU as b_,qj as ba,$m as bb,AL as bc,pe as bd,Lb as be,kU as bf,HU as bg,WU as bh,iU as bi,DU as bj,qU as bk,GW as bl,KG as bm,_U as bn,Vl as bo,gU as bp,YG as bq,Cz as br,SU as bs,HG as bt,mU as bu,VG as bv,ZG as bw,LG as bx,MG as by,DG as bz,dh as c,cW as c0,Af as c1,ei as c2,zl as c3,Ae as c4,TU as c5,ns as c6,FG as c7,EU as c8,rU as c9,uW as cA,kW as cB,dj as cC,ZU as cD,aj as cE,nj as cF,rj as cG,ij as cH,sj as cI,Hb as cJ,EW as cK,RW as cL,BP as cM,nH as cN,NP as cO,fH as cP,hH as cQ,E8 as cR,dH as cS,ai as cT,uH as cU,tH as cV,aG as cW,Q8 as cX,Yd as cY,T3 as cZ,IG as c_,aU as ca,WG as cb,jG as cc,eH as cd,qG as ce,GU as cf,RU as cg,AU as ch,FU as ci,hU as cj,dU as ck,OU as cl,JU as cm,MU as cn,IU as co,zU as cp,$G as cq,M5 as cr,Nj as cs,QU as ct,fU as cu,xj as cv,Pj as cw,Ej as cx,Oj as cy,PW as cz,mH as d,XP as e,W0 as f,aH as g,oH as h,lH as i,jt as j,M6 as k,jv as l,Ur as m,sG as n,VP as o,gH as p,zr as q,be as r,DP as s,io as t,D6 as u,cH as v,iH as w,pH as x,wk as y,_t as z}; +`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,a=this.attrs.width,s=this.attrs.height,u=a!==as&&a!==void 0,c=s!==as&&s!==void 0,f=this.padding(),h=a-f*2,p=s-f*2,g=0,y=this.wrap(),v=y!==Fb,w=y!==R$&&v,x=this.ellipsis();this.textArr=[],Lm().font=this._getContextFont();for(var _=x?this._getTextWidth(Im):0,S=0,C=e.length;Sh)for(;O.length>0;){for(var L=0,D=O.length,U="",X=0;L>>1,te=O.slice(0,K+1),ce=this._getTextWidth(te)+_;ce<=h?(L=K+1,U=te,X=ce):D=K}if(U){if(w){var j,T=O[U.length],$=T===Uf||T===Nb;$&&X<=h?j=U.length:j=Math.max(U.lastIndexOf(Uf),U.lastIndexOf(Nb))+1,j>0&&(L=j,U=U.slice(0,L),X=this._getTextWidth(U))}U=U.trimRight(),this._addTextLine(U),r=Math.max(r,X),g+=i;var V=this._shouldHandleEllipsis(g);if(V){this._tryToAddEllipsisToLastLine();break}if(O=O.slice(L),O=O.trimLeft(),O.length>0&&(I=this._getTextWidth(O),I<=h)){this._addTextLine(O),g+=i,r=Math.max(r,I);break}}else break}else this._addTextLine(O),g+=i,r=Math.max(r,I),this._shouldHandleEllipsis(g)&&Sp)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(e){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,a=i!==as&&i!==void 0,s=this.padding(),u=i-s*2,c=this.wrap(),f=c!==Fb;return!f||a&&e+r>u}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,n=e!==as&&e!==void 0,r=this.padding(),i=e-r*2,a=this.ellipsis(),s=this.textArr[this.textArr.length-1];if(!(!s||!a)){if(n){var u=this._getTextWidth(s.text+Im)=1){var r=n[0].p0;e.moveTo(r.x,r.y)}for(var i=0;i0&&(u+=e.dataArray[c].pathLength);var f=0;i==="center"&&(f=Math.max(0,u/2-s/2)),i==="right"&&(f=Math.max(0,u-s));for(var h=lP(this.text()),p=this.text().split(" ").length-1,g,y,v,w=-1,x=0,_=function(){x=0;for(var ce=e.dataArray,j=w+1;j0)return w=j,ce[j];ce[j].command==="M"&&(g={x:ce[j].points[0],y:ce[j].points[1]})}return{}},S=function(ce){var j=e._getTextSize(ce).width+r;ce===" "&&i==="justify"&&(j+=(u-s)/p);var T=0,$=0;for(y=void 0;Math.abs(j-T)/j>.01&&$<20;){$++;for(var V=T;v===void 0;)v=_(),v&&V+v.pathLengthj?y=tt.getPointOnLine(j,g.x,g.y,v.points[0],v.points[1],g.x,g.y):v=void 0;break;case"A":var W=v.points[4],Y=v.points[5],Q=v.points[4]+Y;x===0?x=W+1e-8:j>T?x+=Math.PI/180*Y/Math.abs(Y):x-=Math.PI/360*Y/Math.abs(Y),(Y<0&&x=0&&x>Q)&&(x=Q,ie=!0),y=tt.getPointOnEllipticalArc(v.points[0],v.points[1],v.points[2],v.points[3],x,v.points[6]);break;case"C":x===0?j>v.pathLength?x=1e-8:x=j/v.pathLength:j>T?x+=(j-T)/v.pathLength/2:x=Math.max(x-(T-j)/v.pathLength/2,0),x>1&&(x=1,ie=!0),y=tt.getPointOnCubicBezier(x,v.start.x,v.start.y,v.points[0],v.points[1],v.points[2],v.points[3],v.points[4],v.points[5]);break;case"Q":x===0?x=j/v.pathLength:j>T?x+=(j-T)/v.pathLength:x-=(T-j)/v.pathLength,x>1&&(x=1,ie=!0),y=tt.getPointOnQuadraticBezier(x,v.start.x,v.start.y,v.points[0],v.points[1],v.points[2],v.points[3]);break}y!==void 0&&(T=tt.getLineLength(g.x,g.y,y.x,y.y)),ie&&(ie=!1,v=void 0)}},C="C",O=e._getTextSize(C).width+r,I=f/O-1,L=0;Lt+`.${gP}`).join(" "),$b="nodesRect",F$=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],$$={"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 z$="ontouchstart"in pe._global;function G$(t,e){if(t==="rotater")return"crosshair";e+=G.degToRad($$[t]||0);var n=(G.radToDeg(e)%360+360)%360;return G._inRange(n,315+22.5,360)||G._inRange(n,0,22.5)?"ns-resize":G._inRange(n,45-22.5,45+22.5)?"nesw-resize":G._inRange(n,90-22.5,90+22.5)?"ew-resize":G._inRange(n,135-22.5,135+22.5)?"nwse-resize":G._inRange(n,180-22.5,180+22.5)?"ns-resize":G._inRange(n,225-22.5,225+22.5)?"nesw-resize":G._inRange(n,270-22.5,270+22.5)?"ew-resize":G._inRange(n,315-22.5,315+22.5)?"nwse-resize":(G.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var sh=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],zb=1e8;function U$(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}function mP(t,e,n){const r=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),i=n.y+(t.x-n.x)*Math.sin(e)+(t.y-n.y)*Math.cos(e);return Object.assign(Object.assign({},t),{rotation:t.rotation+e,x:r,y:i})}function j$(t,e){const n=U$(t);return mP(t,e,n)}function W$(t,e,n){let r=e;for(let i=0;i{const i=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=r._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");r.on(a,i),r.on(F$.map(s=>s+`.${this._getEventNamespace()}`).join(" "),i),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,i),this._proxyDrag(r)}),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&this.update(),this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,r=>{n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(r,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=e.getAbsolutePosition(),a=i.x-n.x,s=i.y-n.y;this.nodes().forEach(u=>{if(u===e||u.isDragging())return;const c=u.getAbsolutePosition();u.setAbsolutePosition({x:c.x+a,y:c.y+s}),u.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache($b),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache($b,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),r){var i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(r),s=e.getAbsolutePosition(r),u=i.x*a.x-e.offsetX()*a.x,c=i.y*a.y-e.offsetY()*a.y;const f=(pe.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),h={x:s.x+u*Math.cos(f)+c*Math.sin(-f),y:s.y+c*Math.cos(f)+u*Math.sin(f),width:i.width*a.x,height:i.height*a.y,rotation:f};return mP(h,-pe.getAngle(n),{x:0,y:0})}__getNodeRect(){var e=this.getNode();if(!e)return{x:-zb,y:-zb,width:0,height:0,rotation:0};const n=[];this.nodes().map(f=>{const h=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var p=[{x:h.x,y:h.y},{x:h.x+h.width,y:h.y},{x:h.x+h.width,y:h.y+h.height},{x:h.x,y:h.y+h.height}],g=f.getAbsoluteTransform();p.forEach(function(y){var v=g.point(y);n.push(v)})});const r=new Wn;r.rotate(-pe.getAngle(this.rotation()));var i,a,s,u;n.forEach(function(f){var h=r.point(f);i===void 0&&(i=s=h.x,a=u=h.y),i=Math.min(i,h.x),a=Math.min(a,h.y),s=Math.max(s,h.x),u=Math.max(u,h.y)}),r.invert();const c=r.point({x:i,y:a});return{x:c.x,y:c.y,width:s-i,height:u-a,rotation:pe.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(),sh.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var n=new Zu({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:z$?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=pe.getAngle(this.rotation()),a=G$(e,i);n.getStage().content&&(n.getStage().content.style.cursor=a),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var e=new re({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()*G._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(e),this._proxyDrag(e),e.on("dragstart",n=>{n.cancelBubble=!0}),e.on("dragmove",n=>{n.cancelBubble=!0}),e.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,a=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/a),this.cos=Math.abs(r/a),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=e.target.getAbsolutePosition(),u=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:u.x-s.x,y:u.y-s.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(c=>{c._fire("transformstart",{evt:e.evt,target:c})})}_handleMouseMove(e){var n,r,i,a=this.findOne("."+this._movingAnchorName),s=a.getStage();s.setPointersPositions(e);const u=s.getPointerPosition();let c={x:u.x-this._anchorDragOffset.x,y:u.y-this._anchorDragOffset.y};const f=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(c=this.anchorDragBoundFunc()(f,c,e)),a.setAbsolutePosition(c);const h=a.getAbsolutePosition();if(!(f.x===h.x&&f.y===h.y)){if(this._movingAnchorName==="rotater"){var p=this._getNodeRect();n=a.x()-p.width/2,r=-a.y()+p.height/2;let ce=Math.atan2(-r,n)+Math.PI/2;p.height<0&&(ce-=Math.PI);var g=pe.getAngle(this.rotation());const j=g+ce,T=pe.getAngle(this.rotationSnapTolerance()),V=W$(this.rotationSnaps(),j,T)-p.rotation,ie=j$(p,V);this._fitNodesInto(ie,e);return}var y=this.keepRatio()||e.shiftKey,S=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(y){var v=S?{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(v.x-a.x(),2)+Math.pow(v.y-a.y(),2));var w=this.findOne(".top-left").x()>v.x?-1:1,x=this.findOne(".top-left").y()>v.y?-1:1;n=i*this.cos*w,r=i*this.sin*x,this.findOne(".top-left").x(v.x-n),this.findOne(".top-left").y(v.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(a.y());else if(this._movingAnchorName==="top-right"){if(y){var v=S?{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(a.x()-v.x,2)+Math.pow(v.y-a.y(),2));var w=this.findOne(".top-right").x()v.y?-1:1;n=i*this.cos*w,r=i*this.sin*x,this.findOne(".top-right").x(v.x+n),this.findOne(".top-right").y(v.y-r)}var _=a.position();this.findOne(".top-left").y(_.y),this.findOne(".bottom-right").x(_.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(a.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(a.x());else if(this._movingAnchorName==="bottom-left"){if(y){var v=S?{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(v.x-a.x(),2)+Math.pow(a.y()-v.y,2));var w=v.x{r._fire("transformend",{evt:e,target:r})}),this._movingAnchorName=null}}_fitNodesInto(e,n){var r=this._getNodeRect();const i=1;if(G._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(G._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const a=this.flipEnabled();var s=new Wn;if(s.rotate(pe.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const p=s.point({x:-this.padding()*2,y:0});if(e.x+=p.x,e.y+=p.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,!a){this.update();return}}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const p=s.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.width+=this.padding()*2,!a){this.update();return}}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const p=s.point({x:0,y:-this.padding()*2});if(e.x+=p.x,e.y+=p.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2,!a){this.update();return}}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const p=s.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2,!a){this.update();return}}if(this.boundBoxFunc()){const p=this.boundBoxFunc()(r,e);p?e=p:G.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const u=1e7,c=new Wn;c.translate(r.x,r.y),c.rotate(r.rotation),c.scale(r.width/u,r.height/u);const f=new Wn;f.translate(e.x,e.y),f.rotate(e.rotation),f.scale(e.width/u,e.height/u);const h=f.multiply(c.invert());this._nodes.forEach(p=>{var g;const y=p.getParent().getAbsoluteTransform(),v=p.getTransform().copy();v.translate(p.offsetX(),p.offsetY());const w=new Wn;w.multiply(y.copy().invert()).multiply(h).multiply(y).multiply(v);const x=w.decompose();p.setAttrs(x),this._fire("transform",{evt:n,target:p}),p._fire("transform",{evt:n,target:p}),(g=p.getLayer())===null||g===void 0||g.batchDraw()}),this.rotation(G._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e,n=this._getNodeRect();this.rotation(G._getRotation(n.rotation));var r=n.width,i=n.height,a=this.enabledAnchors(),s=this.resizeEnabled(),u=this.padding(),c=this.anchorSize();this.find("._anchor").forEach(f=>{f.setAttrs({width:c,height:c,offsetX:c/2,offsetY:c/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:c/2+u,offsetY:c/2+u,visible:s&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:c/2+u,visible:s&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:c/2-u,offsetY:c/2+u,visible:s&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:c/2+u,visible:s&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:c/2-u,visible:s&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:c/2+u,offsetY:c/2-u,visible:s&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:c/2-u,visible:s&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:c/2-u,offsetY:c/2-u,visible:s&&a.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*G._sign(i)-u,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}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),zs.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return se.prototype.toObject.call(this)}clone(e){var n=se.prototype.clone.call(this,e);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}function H$(t){return t instanceof Array||G.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){sh.indexOf(e)===-1&&G.warn("Unknown anchor name: "+e+". Available names are: "+sh.join(", "))}),t||[]}Ke.prototype.className="Transformer";yt(Ke);A.addGetterSetter(Ke,"enabledAnchors",sh,H$);A.addGetterSetter(Ke,"flipEnabled",!0,jr());A.addGetterSetter(Ke,"resizeEnabled",!0);A.addGetterSetter(Ke,"anchorSize",10,le());A.addGetterSetter(Ke,"rotateEnabled",!0);A.addGetterSetter(Ke,"rotationSnaps",[]);A.addGetterSetter(Ke,"rotateAnchorOffset",50,le());A.addGetterSetter(Ke,"rotationSnapTolerance",5,le());A.addGetterSetter(Ke,"borderEnabled",!0);A.addGetterSetter(Ke,"anchorStroke","rgb(0, 161, 255)");A.addGetterSetter(Ke,"anchorStrokeWidth",1,le());A.addGetterSetter(Ke,"anchorFill","white");A.addGetterSetter(Ke,"anchorCornerRadius",0,le());A.addGetterSetter(Ke,"borderStroke","rgb(0, 161, 255)");A.addGetterSetter(Ke,"borderStrokeWidth",1,le());A.addGetterSetter(Ke,"borderDash");A.addGetterSetter(Ke,"keepRatio",!0);A.addGetterSetter(Ke,"centeredScaling",!1);A.addGetterSetter(Ke,"ignoreStroke",!1);A.addGetterSetter(Ke,"padding",0,le());A.addGetterSetter(Ke,"node");A.addGetterSetter(Ke,"nodes");A.addGetterSetter(Ke,"boundBoxFunc");A.addGetterSetter(Ke,"anchorDragBoundFunc");A.addGetterSetter(Ke,"shouldOverdrawWholeArea",!1);A.addGetterSetter(Ke,"useSingleNodeRotation",!0);A.backCompat(Ke,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class qi extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,pe.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}qi.prototype.className="Wedge";qi.prototype._centroid=!0;qi.prototype._attrsAffectingSize=["radius"];yt(qi);A.addGetterSetter(qi,"radius",0,le());A.addGetterSetter(qi,"angle",0,le());A.addGetterSetter(qi,"clockwise",!1);A.backCompat(qi,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function Gb(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var V$=[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],q$=[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 K$(t,e){var n=t.data,r=t.width,i=t.height,a,s,u,c,f,h,p,g,y,v,w,x,_,S,C,O,I,L,D,U,X,K,te,ce,j=e+e+1,T=r-1,$=i-1,V=e+1,ie=V*(V+1)/2,W=new Gb,Y=null,Q=W,oe=null,ve=null,we=V$[e],Ue=q$[e];for(u=1;u>Ue,te!==0?(te=255/te,n[h]=(g*we>>Ue)*te,n[h+1]=(y*we>>Ue)*te,n[h+2]=(v*we>>Ue)*te):n[h]=n[h+1]=n[h+2]=0,g-=x,y-=_,v-=S,w-=C,x-=oe.r,_-=oe.g,S-=oe.b,C-=oe.a,c=p+((c=a+e+1)>Ue,te>0?(te=255/te,n[c]=(g*we>>Ue)*te,n[c+1]=(y*we>>Ue)*te,n[c+2]=(v*we>>Ue)*te):n[c]=n[c+1]=n[c+2]=0,g-=x,y-=_,v-=S,w-=C,x-=oe.r,_-=oe.g,S-=oe.b,C-=oe.a,c=a+((c=s+V)<$?c:$)*r<<2,g+=O+=oe.r=n[c],y+=I+=oe.g=n[c+1],v+=L+=oe.b=n[c+2],w+=D+=oe.a=n[c+3],oe=oe.next,x+=U=ve.r,_+=X=ve.g,S+=K=ve.b,C+=te=ve.a,O-=U,I-=X,L-=K,D-=te,ve=ve.next,h+=r}}const Y$=function(e){var n=Math.round(this.blurRadius());n>0&&K$(e,n)};A.addGetterSetter(se,"blurRadius",0,le(),A.afterSetFilter);const X$=function(t){var e=this.brightness()*255,n=t.data,r=n.length,i;for(i=0;i255?255:i,a=a<0?0:a>255?255:a,s=s<0?0:s>255?255:s,n[u]=i,n[u+1]=a,n[u+2]=s};A.addGetterSetter(se,"contrast",0,le(),A.afterSetFilter);const J$=function(t){var e=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),a=0,s=0,u=t.data,c=t.width,f=t.height,h=c*4,p=f;switch(r){case"top-left":a=-1,s=-1;break;case"top":a=-1,s=0;break;case"top-right":a=-1,s=1;break;case"right":a=0,s=1;break;case"bottom-right":a=1,s=1;break;case"bottom":a=1,s=0;break;case"bottom-left":a=1,s=-1;break;case"left":a=0,s=-1;break;default:G.error("Unknown emboss direction: "+r)}do{var g=(p-1)*h,y=a;p+y<1&&(y=0),p+y>f&&(y=0);var v=(p-1+y)*c*4,w=c;do{var x=g+(w-1)*4,_=s;w+_<1&&(_=0),w+_>c&&(_=0);var S=v+(w-1+_)*4,C=u[x]-u[S],O=u[x+1]-u[S+1],I=u[x+2]-u[S+2],L=C,D=L>0?L:-L,U=O>0?O:-O,X=I>0?I:-I;if(U>D&&(L=O),X>D&&(L=I),L*=e,i){var K=u[x]+L,te=u[x+1]+L,ce=u[x+2]+L;u[x]=K>255?255:K<0?0:K,u[x+1]=te>255?255:te<0?0:te,u[x+2]=ce>255?255:ce<0?0:ce}else{var j=n-L;j<0?j=0:j>255&&(j=255),u[x]=u[x+1]=u[x+2]=j}}while(--w)}while(--p)};A.addGetterSetter(se,"embossStrength",.5,le(),A.afterSetFilter);A.addGetterSetter(se,"embossWhiteLevel",.5,le(),A.afterSetFilter);A.addGetterSetter(se,"embossDirection","top-left",null,A.afterSetFilter);A.addGetterSetter(se,"embossBlend",!1,null,A.afterSetFilter);function Mm(t,e,n,r,i){var a=n-e,s=i-r,u;return a===0?r+s/2:s===0?r:(u=(t-e)/a,u=s*u+r,u)}const Z$=function(t){var e=t.data,n=e.length,r=e[0],i=r,a,s=e[1],u=s,c,f=e[2],h=f,p,g,y=this.enhance();if(y!==0){for(g=0;gi&&(i=a),c=e[g+1],cu&&(u=c),p=e[g+2],ph&&(h=p);i===r&&(i=255,r=0),u===s&&(u=255,s=0),h===f&&(h=255,f=0);var v,w,x,_,S,C,O,I,L;for(y>0?(w=i+y*(255-i),x=r-y*(r-0),S=u+y*(255-u),C=s-y*(s-0),I=h+y*(255-h),L=f-y*(f-0)):(v=(i+r)*.5,w=i+y*(i-v),x=r+y*(r-v),_=(u+s)*.5,S=u+y*(u-_),C=s+y*(s-_),O=(h+f)*.5,I=h+y*(h-O),L=f+y*(f-O)),g=0;g_?x:_;var S=s,C=a,O,I,L=360/C*Math.PI/180,D,U;for(I=0;IC?S:C;var O=s,I=a,L,D,U=n.polarRotation||0,X,K;for(h=0;he&&(O=C,I=0,L=-1),i=0;i=0&&y=0&&v=0&&y=0&&v=255*4?255:0}return s}function dz(t,e,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),s=[],u=0;u=0&&y=0&&v=n))for(a=w;a=r||(s=(n*a+i)*4,u+=O[s+0],c+=O[s+1],f+=O[s+2],h+=O[s+3],C+=1);for(u=u/C,c=c/C,f=f/C,h=h/C,i=y;i=n))for(a=w;a=r||(s=(n*a+i)*4,O[s+0]=u,O[s+1]=c,O[s+2]=f,O[s+3]=h)}};A.addGetterSetter(se,"pixelSize",8,le(),A.afterSetFilter);const mz=function(t){var e=Math.round(this.levels()*254)+1,n=t.data,r=n.length,i=255/e,a;for(a=0;a255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"blue",0,$k,A.afterSetFilter);const yz=function(t){var e=t.data,n=e.length,r=this.red(),i=this.green(),a=this.blue(),s=this.alpha(),u,c;for(u=0;u255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"blue",0,$k,A.afterSetFilter);A.addGetterSetter(se,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});const Sz=function(t){var e=t.data,n=e.length,r,i,a,s;for(r=0;r127&&(f=255-f),h>127&&(h=255-h),p>127&&(p=255-p),e[c]=f,e[c+1]=h,e[c+2]=p}while(--u)}while(--a)},wz=function(t){var e=this.threshold()*255,n=t.data,r=n.length,i;for(i=0;i{const{width:n,height:r}=e,i=document.createElement("div"),a=new Vl.Stage({container:i,width:n,height:r}),s=new Vl.Layer,u=new Vl.Layer;s.add(new Vl.Rect({...e,fill:"white"})),t.forEach(f=>u.add(new Vl.Line({points:f.points,stroke:"black",strokeWidth:f.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:f.tool==="brush"?"source-over":"destination-out"}))),a.add(s),a.add(u);const c=a.toDataURL({...e});return i.remove(),c};let vP=null,yP=null;const $W=t=>{vP=t},Cz=()=>vP,zW=t=>{yP=t},GW=()=>yP,xz=t=>{const e=window.open("");e&&t.forEach(n=>{const r=new Image;r.src=n.base64,e.document.write(n.caption),e.document.write("
"),e.document.write(r.outerHTML),e.document.write("

")})},kz=(t,e)=>Math.floor(Math.random()*(e-t+1)+t),Pz=t=>{const e=Cz(),{generationMode:n,generationState:r,postprocessingState:i,canvasState:a,systemState:s}=t,{codeformerFidelity:u,facetoolStrength:c,facetoolType:f,hiresFix:h,hiresStrength:p,shouldRunESRGAN:g,shouldRunFacetool:y,upscalingLevel:v,upscalingStrength:w,upscalingDenoising:x}=i,{cfgScale:_,height:S,img2imgStrength:C,infillMethod:O,initialImage:I,iterations:L,perlin:D,prompt:U,negativePrompt:X,sampler:K,seamBlur:te,seamless:ce,seamSize:j,seamSteps:T,seamStrength:$,seed:V,seedWeights:ie,shouldFitToWidthHeight:W,shouldGenerateVariations:Y,shouldRandomizeSeed:Q,steps:oe,threshold:ve,tileSize:we,variationAmount:Ue,width:At,shouldUseSymmetry:me,horizontalSymmetrySteps:qt,verticalSymmetrySteps:Bt}=r,{shouldDisplayInProgressType:bn,saveIntermediatesInterval:wr,enableImageDebugging:Ft}=s,xe={prompt:U,iterations:L,steps:oe,cfg_scale:_,threshold:ve,perlin:D,height:S,width:At,sampler_name:K,seed:V,progress_images:bn==="full-res",progress_latents:bn==="latents",save_intermediates:wr,generation_mode:n,init_mask:""};let Wr=!1,Et=!1;if(X!==""&&(xe.prompt=`${U} [${X}]`),xe.seed=Q?kz(cF,fF):V,me&&(qt>0&&(xe.h_symmetry_time_pct=Math.max(0,Math.min(1,qt/oe))),Bt>0&&(xe.v_symmetry_time_pct=Math.max(0,Math.min(1,Bt/oe)))),n==="txt2img"&&(xe.hires_fix=h,h&&(xe.strength=p)),["txt2img","img2img"].includes(n)&&(xe.seamless=ce,g&&(Wr={level:v,denoise_str:x,strength:w}),y&&(Et={type:f,strength:c},f==="codeformer"&&(Et.codeformer_fidelity=u))),n==="img2img"&&I&&(xe.init_img=typeof I=="string"?I:I.url,xe.strength=C,xe.fit=W),n==="unifiedCanvas"&&e){const{layerState:{objects:gi},boundingBoxCoordinates:Xs,boundingBoxDimensions:Mn,stageScale:Fa,isMaskEnabled:Qs,shouldPreserveMaskedArea:er,boundingBoxScaleMethod:Kt,scaledBoundingBoxDimensions:Dn}=a,bt={...Xs,...Mn},$a=bz(Qs?gi.filter(Qx):[],bt);xe.init_mask=$a,xe.fit=!1,xe.strength=C,xe.invert_mask=er,xe.bounding_box=bt;const Hr=e.scale();e.scale({x:1/Fa,y:1/Fa});const Co=e.getAbsolutePosition(),Vr=e.toDataURL({x:bt.x+Co.x,y:bt.y+Co.y,width:bt.width,height:bt.height});Ft&&xz([{base64:$a,caption:"mask sent as init_mask"},{base64:Vr,caption:"image sent as init_img"}]),e.scale(Hr),xe.init_img=Vr,xe.progress_images=!1,Kt!=="none"&&(xe.inpaint_width=Dn.width,xe.inpaint_height=Dn.height),xe.seam_size=j,xe.seam_blur=te,xe.seam_strength=$,xe.seam_steps=T,xe.tile_size=we,xe.infill_method=O,xe.force_outpaint=!1}return Y?(xe.variation_amount=Ue,ie&&(xe.with_variations=A5(ie))):xe.variation_amount=0,Ft&&(xe.enable_image_debugging=Ft),{generationParameters:xe,esrganParameters:Wr,facetoolParameters:Et}};var Ez=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Oz=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Tz=/[^-+\dA-Z]/g;function Ut(t,e,n,r){if(arguments.length===1&&typeof t=="string"&&!/\d/.test(t)&&(e=t,t=void 0),t=t||t===0?t:new Date,t instanceof Date||(t=new Date(t)),isNaN(t))throw TypeError("Invalid date");e=String(Ub[e]||e||Ub.default);var i=e.slice(0,4);(i==="UTC:"||i==="GMT:")&&(e=e.slice(4),n=!0,i==="GMT:"&&(r=!0));var a=function(){return n?"getUTC":"get"},s=function(){return t[a()+"Date"]()},u=function(){return t[a()+"Day"]()},c=function(){return t[a()+"Month"]()},f=function(){return t[a()+"FullYear"]()},h=function(){return t[a()+"Hours"]()},p=function(){return t[a()+"Minutes"]()},g=function(){return t[a()+"Seconds"]()},y=function(){return t[a()+"Milliseconds"]()},v=function(){return n?0:t.getTimezoneOffset()},w=function(){return Rz(t)},x=function(){return Az(t)},_={d:function(){return s()},dd:function(){return Un(s())},ddd:function(){return En.dayNames[u()]},DDD:function(){return jb({y:f(),m:c(),d:s(),_:a(),dayName:En.dayNames[u()],short:!0})},dddd:function(){return En.dayNames[u()+7]},DDDD:function(){return jb({y:f(),m:c(),d:s(),_:a(),dayName:En.dayNames[u()+7]})},m:function(){return c()+1},mm:function(){return Un(c()+1)},mmm:function(){return En.monthNames[c()]},mmmm:function(){return En.monthNames[c()+12]},yy:function(){return String(f()).slice(2)},yyyy:function(){return Un(f(),4)},h:function(){return h()%12||12},hh:function(){return Un(h()%12||12)},H:function(){return h()},HH:function(){return Un(h())},M:function(){return p()},MM:function(){return Un(p())},s:function(){return g()},ss:function(){return Un(g())},l:function(){return Un(y(),3)},L:function(){return Un(Math.floor(y()/10))},t:function(){return h()<12?En.timeNames[0]:En.timeNames[1]},tt:function(){return h()<12?En.timeNames[2]:En.timeNames[3]},T:function(){return h()<12?En.timeNames[4]:En.timeNames[5]},TT:function(){return h()<12?En.timeNames[6]:En.timeNames[7]},Z:function(){return r?"GMT":n?"UTC":Iz(t)},o:function(){return(v()>0?"-":"+")+Un(Math.floor(Math.abs(v())/60)*100+Math.abs(v())%60,4)},p:function(){return(v()>0?"-":"+")+Un(Math.floor(Math.abs(v())/60),2)+":"+Un(Math.floor(Math.abs(v())%60),2)},S:function(){return["th","st","nd","rd"][s()%10>3?0:(s()%100-s()%10!=10)*s()%10]},W:function(){return w()},WW:function(){return Un(w())},N:function(){return x()}};return e.replace(Ez,function(S){return S in _?_[S]():S.slice(1,S.length-1)})}var Ub={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"},En={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"]},Un=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(e).padStart(n,"0")},jb=function(e){var n=e.y,r=e.m,i=e.d,a=e._,s=e.dayName,u=e.short,c=u===void 0?!1:u,f=new Date,h=new Date;h.setDate(h[a+"Date"]()-1);var p=new Date;p.setDate(p[a+"Date"]()+1);var g=function(){return f[a+"Date"]()},y=function(){return f[a+"Month"]()},v=function(){return f[a+"FullYear"]()},w=function(){return h[a+"Date"]()},x=function(){return h[a+"Month"]()},_=function(){return h[a+"FullYear"]()},S=function(){return p[a+"Date"]()},C=function(){return p[a+"Month"]()},O=function(){return p[a+"FullYear"]()};return v()===n&&y()===r&&g()===i?c?"Tdy":"Today":_()===n&&x()===r&&w()===i?c?"Ysd":"Yesterday":O()===n&&C()===r&&S()===i?c?"Tmw":"Tomorrow":s},Rz=function(e){var n=new Date(e.getFullYear(),e.getMonth(),e.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 a=(n-r)/(864e5*7);return 1+Math.floor(a)},Az=function(e){var n=e.getDay();return n===0&&(n=7),n},Iz=function(e){return(String(e).match(Oz)||[""]).pop().replace(Tz,"").replace(/GMT\+0000/g,"UTC")};const Lz=(t,e)=>{const{dispatch:n,getState:r}=t;return{emitGenerateImage:i=>{n(ei(!0));const a=r(),{generation:s,postprocessing:u,system:c,canvas:f}=a,h={generationMode:i,generationState:s,postprocessingState:u,canvasState:f,systemState:c};n(mB());const{generationParameters:p,esrganParameters:g,facetoolParameters:y}=Pz(h);e.emit("generateImage",p,g,y),p.init_mask&&(p.init_mask=p.init_mask.substr(0,64).concat("...")),p.init_img&&(p.init_img=p.init_img.substr(0,64).concat("...")),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image generation requested: ${JSON.stringify({...p,...g,...y})}`}))},emitRunESRGAN:i=>{n(ei(!0));const{postprocessing:{upscalingLevel:a,upscalingDenoising:s,upscalingStrength:u}}=r(),c={upscale:[a,s,u]};e.emit("runPostprocessing",i,{type:"esrgan",...c}),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`ESRGAN upscale requested: ${JSON.stringify({file:i.url,...c})}`}))},emitRunFacetool:i=>{n(ei(!0));const{postprocessing:{facetoolType:a,facetoolStrength:s,codeformerFidelity:u}}=r(),c={facetool_strength:s};a==="codeformer"&&(c.codeformer_fidelity=u),e.emit("runPostprocessing",i,{type:a,...c}),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Face restoration (${a}) requested: ${JSON.stringify({file:i.url,...c})}`}))},emitDeleteImage:i=>{const{url:a,uuid:s,category:u,thumbnail:c}=i;n(ek(i)),e.emit("deleteImage",a,c,s,u)},emitRequestImages:i=>{const a=r().gallery,{earliest_mtime:s}=a.categories[i];e.emit("requestImages",i,s)},emitRequestNewImages:i=>{const a=r().gallery,{latest_mtime:s}=a.categories[i];e.emit("requestLatestImages",i,s)},emitCancelProcessing:()=>{e.emit("cancel")},emitRequestSystemConfig:()=>{e.emit("requestSystemConfig")},emitSearchForModels:i=>{e.emit("searchForModels",i)},emitAddNewModel:i=>{e.emit("addNewModel",i)},emitDeleteModel:i=>{e.emit("deleteModel",i)},emitConvertToDiffusers:i=>{n(pB()),e.emit("convertToDiffusers",i)},emitMergeDiffusersModels:i=>{n(gB()),e.emit("mergeDiffusersModels",i)},emitRequestModelChange:i=>{n(hB()),e.emit("requestModelChange",i)},emitSaveStagingAreaImageToGallery:i=>{e.emit("requestSaveStagingAreaImageToGallery",i)},emitRequestEmptyTempFolder:()=>{e.emit("requestEmptyTempFolder")}}};let Hf;const Mz=new Uint8Array(16);function Dz(){if(!Hf&&(Hf=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Hf))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Hf(Mz)}const Jt=[];for(let t=0;t<256;++t)Jt.push((t+256).toString(16).slice(1));function Nz(t,e=0){return(Jt[t[e+0]]+Jt[t[e+1]]+Jt[t[e+2]]+Jt[t[e+3]]+"-"+Jt[t[e+4]]+Jt[t[e+5]]+"-"+Jt[t[e+6]]+Jt[t[e+7]]+"-"+Jt[t[e+8]]+Jt[t[e+9]]+"-"+Jt[t[e+10]]+Jt[t[e+11]]+Jt[t[e+12]]+Jt[t[e+13]]+Jt[t[e+14]]+Jt[t[e+15]]).toLowerCase()}const Bz=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Wb={randomUUID:Bz};function Vf(t,e,n){if(Wb.randomUUID&&!e&&!t)return Wb.randomUUID();t=t||{};const r=t.random||(t.rng||Dz)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(let i=0;i<16;++i)e[n+i]=r[i];return e}return Nz(r)}const UW=dt("socketio/generateImage"),jW=dt("socketio/runESRGAN"),WW=dt("socketio/runFacetool"),HW=dt("socketio/deleteImage"),Hb=dt("socketio/requestImages"),Vb=dt("socketio/requestNewImages"),VW=dt("socketio/cancelProcessing"),Fz=dt("socketio/requestSystemConfig"),qW=dt("socketio/searchForModels"),KW=dt("socketio/addNewModel"),YW=dt("socketio/deleteModel"),XW=dt("socketio/convertToDiffusers"),QW=dt("socketio/mergeDiffusersModels"),JW=dt("socketio/requestModelChange"),ZW=dt("socketio/saveStagingAreaImageToGallery"),eH=dt("socketio/requestEmptyTempFolder"),$z=t=>{const{dispatch:e,getState:n}=t;return{onConnect:()=>{try{e(ub(!0)),e(ns(Ae.t("common.statusConnected"))),e(Fz());const r=n().gallery;r.categories.result.latest_mtime?e(Vb("result")):e(Hb("result")),r.categories.user.latest_mtime?e(Vb("user")):e(Hb("user"))}catch(r){console.error(r)}},onDisconnect:()=>{try{e(ub(!1)),e(ns(Ae.t("common.statusDisconnected"))),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:"Disconnected from server",level:"warning"}))}catch(r){console.error(r)}},onGenerationResult:r=>{try{const i=n(),{activeTab:a}=i.ui,{shouldLoopback:s}=i.postprocessing,{boundingBox:u,generationMode:c,...f}=r,h={uuid:Vf(),...f};if(["txt2img","img2img"].includes(c)&&e(Of({category:"result",image:{...h,category:"result"}})),c==="unifiedCanvas"&&r.boundingBox){const{boundingBox:p}=r;e(S5({image:{...h,category:"temp"},boundingBox:p})),i.canvas.shouldAutoSave&&e(Of({image:{...h,category:"result"},category:"result"}))}if(s)switch(wk[a]){case"img2img":{e(D5(h));break}}e(Cm()),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image generated: ${r.url}`}))}catch(i){console.error(i)}},onIntermediateResult:r=>{try{e(C5({uuid:Vf(),...r,category:"result"})),r.isBase64||e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Intermediate image generated: ${r.url}`}))}catch(i){console.error(i)}},onPostprocessingResult:r=>{try{e(Of({category:"result",image:{uuid:Vf(),...r,category:"result"}})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Postprocessed: ${r.url}`}))}catch(i){console.error(i)}},onProgressUpdate:r=>{try{e(ei(!0)),e(cB(r))}catch(i){console.error(i)}},onError:r=>{const{message:i,additionalData:a}=r;try{e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Server error: ${i}`,level:"error"})),e(cb()),e(Cm())}catch(s){console.error(s)}},onGalleryImages:r=>{const{images:i,areMoreImagesAvailable:a,category:s}=r,u=i.map(c=>({uuid:Vf(),...c}));e(b5({images:u,areMoreImagesAvailable:a,category:s})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Loaded ${i.length} images`}))},onProcessingCanceled:()=>{e(dB());const{intermediateImage:r}=n().gallery;r&&(r.isBase64||(e(Of({category:"result",image:r})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Intermediate image saved: ${r.url}`}))),e(Cm())),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:"Processing canceled",level:"warning"}))},onImageDeleted:r=>{const{url:i}=r;e(ek(r));const{generation:{initialImage:a,maskPath:s}}=n();(a===i||(a==null?void 0:a.url)===i)&&e(L5()),s===i&&e(N5("")),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image deleted: ${i}`}))},onSystemConfig:r=>{e(fB(r)),r.infill_methods.includes("patchmatch")||e(M5(r.infill_methods[0]))},onFoundModels:r=>{const{search_folder:i,found_models:a}=r;e(vB(i)),e(yB(a))},onNewModelAdded:r=>{const{new_model_name:i,model_list:a,update:s}=r;e(rs(a)),e(ei(!1)),e(ns(Ae.t("modelManager.modelAdded"))),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model Added: ${i}`,level:"info"})),e(zl({title:s?`${Ae.t("modelManager.modelUpdated")}: ${i}`:`${Ae.t("modelManager.modelAdded")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelDeleted:r=>{const{deleted_model_name:i,model_list:a}=r;e(rs(a)),e(ei(!1)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`${Ae.t("modelManager.modelAdded")}: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelEntryDeleted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelConverted:r=>{const{converted_model_name:i,model_list:a}=r;e(rs(a)),e(ns(Ae.t("common.statusModelConverted"))),e(ei(!1)),e(Af(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model converted: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelConverted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelsMerged:r=>{const{merged_models:i,merged_model_name:a,model_list:s}=r;e(rs(s)),e(ns(Ae.t("common.statusMergedModels"))),e(ei(!1)),e(Af(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Models merged: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelsMerged")}: ${a}`,status:"success",duration:2500,isClosable:!0}))},onModelChanged:r=>{const{model_name:i,model_list:a}=r;e(rs(a)),e(ns(Ae.t("common.statusModelChanged"))),e(ei(!1)),e(Af(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model changed: ${i}`,level:"info"}))},onModelChangeFailed:r=>{const{model_name:i,model_list:a}=r;e(rs(a)),e(ei(!1)),e(Af(!0)),e(cb()),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model change failed: ${i}`,level:"error"}))},onTempFolderEmptied:()=>{e(zl({title:Ae.t("toast.tempFoldersEmptied"),status:"success",duration:2500,isClosable:!0}))}}},zz=()=>{const{origin:t}=new URL(window.location.href),e=gd(t,{timeout:6e4,path:`${window.location.pathname}socket.io`});let n=!1;return i=>a=>s=>{const{onConnect:u,onDisconnect:c,onError:f,onPostprocessingResult:h,onGenerationResult:p,onIntermediateResult:g,onProgressUpdate:y,onGalleryImages:v,onProcessingCanceled:w,onImageDeleted:x,onSystemConfig:_,onModelChanged:S,onFoundModels:C,onNewModelAdded:O,onModelDeleted:I,onModelConverted:L,onModelsMerged:D,onModelChangeFailed:U,onTempFolderEmptied:X}=$z(i),{emitGenerateImage:K,emitRunESRGAN:te,emitRunFacetool:ce,emitDeleteImage:j,emitRequestImages:T,emitRequestNewImages:$,emitCancelProcessing:V,emitRequestSystemConfig:ie,emitSearchForModels:W,emitAddNewModel:Y,emitDeleteModel:Q,emitConvertToDiffusers:oe,emitMergeDiffusersModels:ve,emitRequestModelChange:we,emitSaveStagingAreaImageToGallery:Ue,emitRequestEmptyTempFolder:At}=Lz(i,e);switch(n||(e.on("connect",()=>u()),e.on("disconnect",()=>c()),e.on("error",me=>f(me)),e.on("generationResult",me=>p(me)),e.on("postprocessingResult",me=>h(me)),e.on("intermediateResult",me=>g(me)),e.on("progressUpdate",me=>y(me)),e.on("galleryImages",me=>v(me)),e.on("processingCanceled",()=>{w()}),e.on("imageDeleted",me=>{x(me)}),e.on("systemConfig",me=>{_(me)}),e.on("foundModels",me=>{C(me)}),e.on("newModelAdded",me=>{O(me)}),e.on("modelDeleted",me=>{I(me)}),e.on("modelConverted",me=>{L(me)}),e.on("modelsMerged",me=>{D(me)}),e.on("modelChanged",me=>{S(me)}),e.on("modelChangeFailed",me=>{U(me)}),e.on("tempFolderEmptied",()=>{X()}),n=!0),s.type){case"socketio/generateImage":{K(s.payload);break}case"socketio/runESRGAN":{te(s.payload);break}case"socketio/runFacetool":{ce(s.payload);break}case"socketio/deleteImage":{j(s.payload);break}case"socketio/requestImages":{T(s.payload);break}case"socketio/requestNewImages":{$(s.payload);break}case"socketio/cancelProcessing":{V();break}case"socketio/requestSystemConfig":{ie();break}case"socketio/searchForModels":{W(s.payload);break}case"socketio/addNewModel":{Y(s.payload);break}case"socketio/deleteModel":{Q(s.payload);break}case"socketio/convertToDiffusers":{oe(s.payload);break}case"socketio/mergeDiffusersModels":{ve(s.payload);break}case"socketio/requestModelChange":{we(s.payload);break}case"socketio/saveStagingAreaImageToGallery":{Ue(s.payload);break}case"socketio/requestEmptyTempFolder":{At();break}}a(s)}},Gz=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"].map(t=>`canvas.${t}`),Uz=["currentIteration","currentStatus","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","socketId","totalIterations","totalSteps","openModel","cancelOptions.cancelAfter"].map(t=>`system.${t}`),jz=["categories","currentCategory","currentImage","currentImageUuid","shouldAutoSwitchToNewImages","intermediateImage"].map(t=>`gallery.${t}`),Wz=["isLightboxOpen"].map(t=>`lightbox.${t}`),SP=Fx({generation:B5,postprocessing:$5,gallery:x5,system:SB,canvas:_5,ui:bB,lightbox:E5}),Hz=Yx.getPersistConfig({key:"root",storage:Kx,rootReducer:SP,blacklist:[...Gz,...Uz,...jz,...Wz],debounce:300}),Vz=ZN(Hz,SP),_P=TN({reducer:Vz,middleware:t=>t({immutableCheck:!1,serializableCheck:!1}).concat(zz()),devTools:{actionsDenylist:["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine"]}}),qz=a5(_P);function Kz(t){if(t.sheet)return t.sheet;for(var e=0;e0?en(Ys,--Ln):0,Gs--,Ot===10&&(Gs=1,rp--),Ot}function Kn(){return Ot=Ln2||Wu(Ot)>3?"":" "}function o6(t,e){for(;--e&&Kn()&&!(Ot<48||Ot>102||Ot>57&&Ot<65||Ot>70&&Ot<97););return ec(t,Sd()+(e<6&&ci()==32&&Kn()==32))}function cy(t){for(;Kn();)switch(Ot){case t:return Ln;case 34:case 39:t!==34&&t!==39&&cy(Ot);break;case 40:t===41&&cy(t);break;case 92:Kn();break}return Ln}function s6(t,e){for(;Kn()&&t+Ot!==47+10;)if(t+Ot===42+42&&ci()===47)break;return"/*"+ec(e,Ln-1)+"*"+np(t===47?t:Kn())}function l6(t){for(;!Wu(ci());)Kn();return ec(t,Ln)}function u6(t){return PP(wd("",null,null,null,[""],t=kP(t),0,[0],t))}function wd(t,e,n,r,i,a,s,u,c){for(var f=0,h=0,p=s,g=0,y=0,v=0,w=1,x=1,_=1,S=0,C="",O=i,I=a,L=r,D=C;x;)switch(v=S,S=Kn()){case 40:if(v!=108&&en(D,p-1)==58){uy(D+=qe(_d(S),"&","&\f"),"&\f")!=-1&&(_=-1);break}case 34:case 39:case 91:D+=_d(S);break;case 9:case 10:case 13:case 32:D+=a6(v);break;case 92:D+=o6(Sd()-1,7);continue;case 47:switch(ci()){case 42:case 47:qf(c6(s6(Kn(),Sd()),e,n),c);break;default:D+="/"}break;case 123*w:u[f++]=ti(D)*_;case 125*w:case 59:case 0:switch(S){case 0:case 125:x=0;case 59+h:y>0&&ti(D)-p&&qf(y>32?Kb(D+";",r,n,p-1):Kb(qe(D," ","")+";",r,n,p-2),c);break;case 59:D+=";";default:if(qf(L=qb(D,e,n,f,h,i,u,C,O=[],I=[],p),a),S===123)if(h===0)wd(D,e,L,L,O,a,p,u,I);else switch(g===99&&en(D,3)===110?100:g){case 100:case 109:case 115:wd(t,L,L,r&&qf(qb(t,L,L,0,0,i,u,C,i,O=[],p),I),i,I,p,u,r?O:I);break;default:wd(D,L,L,L,[""],I,0,u,I)}}f=h=y=0,w=_=1,C=D="",p=s;break;case 58:p=1+ti(D),y=v;default:if(w<1){if(S==123)--w;else if(S==125&&w++==0&&i6()==125)continue}switch(D+=np(S),S*w){case 38:_=h>0?1:(D+="\f",-1);break;case 44:u[f++]=(ti(D)-1)*_,_=1;break;case 64:ci()===45&&(D+=_d(Kn())),g=ci(),h=p=ti(C=D+=l6(Sd())),S++;break;case 45:v===45&&ti(D)==2&&(w=0)}}return a}function qb(t,e,n,r,i,a,s,u,c,f,h){for(var p=i-1,g=i===0?a:[""],y=$0(g),v=0,w=0,x=0;v0?g[_]+" "+S:qe(S,/&\f/g,g[_])))&&(c[x++]=C);return ip(t,e,n,i===0?B0:u,c,f,h)}function c6(t,e,n){return ip(t,e,n,wP,np(r6()),ju(t,2,-2),0)}function Kb(t,e,n,r){return ip(t,e,n,F0,ju(t,0,r),ju(t,r+1,-1),r)}function Rs(t,e){for(var n="",r=$0(t),i=0;i6)switch(en(t,e+1)){case 109:if(en(t,e+4)!==45)break;case 102:return qe(t,/(.+:)(.+)-([^]+)/,"$1"+He+"$2-$3$1"+lh+(en(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~uy(t,"stretch")?OP(qe(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(en(t,e+1)!==115)break;case 6444:switch(en(t,ti(t)-3-(~uy(t,"!important")&&10))){case 107:return qe(t,":",":"+He)+t;case 101:return qe(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+He+(en(t,14)===45?"inline-":"")+"box$3$1"+He+"$2$3$1"+ln+"$2box$3")+t}break;case 5936:switch(en(t,e+11)){case 114:return He+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return He+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return He+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return He+t+ln+t+t}return t}var S6=function(e,n,r,i){if(e.length>-1&&!e.return)switch(e.type){case F0:e.return=OP(e.value,e.length);break;case bP:return Rs([ql(e,{value:qe(e.value,"@","@"+He)})],i);case B0:if(e.length)return n6(e.props,function(a){switch(t6(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Rs([ql(e,{props:[qe(a,/:(read-\w+)/,":"+lh+"$1")]})],i);case"::placeholder":return Rs([ql(e,{props:[qe(a,/:(plac\w+)/,":"+He+"input-$1")]}),ql(e,{props:[qe(a,/:(plac\w+)/,":"+lh+"$1")]}),ql(e,{props:[qe(a,/:(plac\w+)/,ln+"input-$1")]})],i)}return""})}},_6=[S6],w6=function(e){var n=e.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(w){var x=w.getAttribute("data-emotion");x.indexOf(" ")!==-1&&(document.head.appendChild(w),w.setAttribute("data-s",""))})}var i=e.stylisPlugins||_6,a={},s,u=[];s=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(w){for(var x=w.getAttribute("data-emotion").split(" "),_=1;_=4;++r,i-=4)n=t.charCodeAt(r)&255|(t.charCodeAt(++r)&255)<<8|(t.charCodeAt(++r)&255)<<16|(t.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(i){case 3:e^=(t.charCodeAt(r+2)&255)<<16;case 2:e^=(t.charCodeAt(r+1)&255)<<8;case 1:e^=t.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var k6={animationIterationCount: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},P6=/[A-Z]|^ms/g,E6=/_EMO_([^_]+?)_([^]*?)_EMO_/g,AP=function(e){return e.charCodeAt(1)===45},Qb=function(e){return e!=null&&typeof e!="boolean"},Dm=EP(function(t){return AP(t)?t:t.replace(P6,"-$&").toLowerCase()}),Jb=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(E6,function(r,i,a){return ni={name:i,styles:a,next:ni},i})}return k6[e]!==1&&!AP(e)&&typeof n=="number"&&n!==0?n+"px":n};function Hu(t,e,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 ni={name:n.name,styles:n.styles,next:ni},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)ni={name:r.name,styles:r.styles,next:ni},r=r.next;var i=n.styles+";";return i}return O6(t,e,n)}case"function":{if(t!==void 0){var a=ni,s=n(t);return ni=a,Hu(t,e,s)}break}}if(e==null)return n;var u=e[n];return u!==void 0?u:n}function O6(t,e,n){var r="";if(Array.isArray(n))for(var i=0;i` or ``");return t}var NP=be.createContext({});NP.displayName="ColorModeContext";function BP(){const t=be.useContext(NP);if(t===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return t}function D6(){const t=BP(),e=DP();return{...t,theme:e}}function N6(t,e,n){var r,i;if(e==null)return e;const a=s=>{var u,c;return(c=(u=t.__breakpoints)==null?void 0:u.asArray)==null?void 0:c[s]};return(i=(r=a(e))!=null?r:a(n))!=null?i:n}function B6(t,e,n){var r,i;if(e==null)return e;const a=s=>{var u,c;return(c=(u=t.__cssMap)==null?void 0:u[s])==null?void 0:c.value};return(i=(r=a(e))!=null?r:a(n))!=null?i:n}function rH(t,e,n){const r=DP();return F6(t,e,n)(r)}function F6(t,e,n){const r=Array.isArray(e)?e:[e],i=Array.isArray(n)?n:[n];return a=>{const s=i.filter(Boolean),u=r.map((c,f)=>{var h,p;if(t==="breakpoints")return N6(a,c,(h=s[f])!=null?h:c);const g=`${t}.${c}`;return B6(a,g,(p=s[f])!=null?p:c)});return Array.isArray(e)?u:u[0]}}var FP=(...t)=>t.filter(Boolean).join(" ");function $6(){return!1}function zr(t){const e=typeof t;return t!=null&&(e==="object"||e==="function")&&!Array.isArray(t)}var iH=t=>{const{condition:e,message:n}=t;e&&$6()&&console.warn(n)};function io(t,...e){return z6(t)?t(...e):t}var z6=t=>typeof t=="function",aH=t=>t?"":void 0,oH=t=>t?!0:void 0;function sH(...t){return function(n){t.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function lH(...t){return function(n){t.forEach(r=>{r==null||r(n)})}}var uh={},G6={get exports(){return uh},set exports(t){uh=t}};(function(t,e){var n=200,r="__lodash_hash_undefined__",i=800,a=16,s=9007199254740991,u="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",h="[object Boolean]",p="[object Date]",g="[object Error]",y="[object Function]",v="[object GeneratorFunction]",w="[object Map]",x="[object Number]",_="[object Null]",S="[object Object]",C="[object Proxy]",O="[object RegExp]",I="[object Set]",L="[object String]",D="[object Undefined]",U="[object WeakMap]",X="[object ArrayBuffer]",K="[object DataView]",te="[object Float32Array]",ce="[object Float64Array]",j="[object Int8Array]",T="[object Int16Array]",$="[object Int32Array]",V="[object Uint8Array]",ie="[object Uint8ClampedArray]",W="[object Uint16Array]",Y="[object Uint32Array]",Q=/[\\^$.*+?()[\]{}|]/g,oe=/^\[object .+?Constructor\]$/,ve=/^(?:0|[1-9]\d*)$/,we={};we[te]=we[ce]=we[j]=we[T]=we[$]=we[V]=we[ie]=we[W]=we[Y]=!0,we[u]=we[c]=we[X]=we[h]=we[K]=we[p]=we[g]=we[y]=we[w]=we[x]=we[S]=we[O]=we[I]=we[L]=we[U]=!1;var Ue=typeof yn=="object"&&yn&&yn.Object===Object&&yn,At=typeof self=="object"&&self&&self.Object===Object&&self,me=Ue||At||Function("return this")(),qt=e&&!e.nodeType&&e,Bt=qt&&!0&&t&&!t.nodeType&&t,bn=Bt&&Bt.exports===qt,wr=bn&&Ue.process,Ft=function(){try{var E=Bt&&Bt.require&&Bt.require("util").types;return E||wr&&wr.binding&&wr.binding("util")}catch{}}(),xe=Ft&&Ft.isTypedArray;function Wr(E,N,H){switch(H.length){case 0:return E.call(N);case 1:return E.call(N,H[0]);case 2:return E.call(N,H[0],H[1]);case 3:return E.call(N,H[0],H[1],H[2])}return E.apply(N,H)}function Et(E,N){for(var H=-1,fe=Array(E);++H-1}function mp(E,N){var H=this.__data__,fe=yi(H,E);return fe<0?(++this.size,H.push([E,N])):H[fe][1]=N,this}xr.prototype.clear=tl,xr.prototype.delete=pp,xr.prototype.get=nl,xr.prototype.has=gp,xr.prototype.set=mp;function Xi(E){var N=-1,H=E==null?0:E.length;for(this.clear();++N1?H[Ie-1]:void 0,Pe=Ie>2?H[2]:void 0;for(Ye=E.length>3&&typeof Ye=="function"?(Ie--,Ye):void 0,Pe&&hc(H[0],H[1],Pe)&&(Ye=Ie<3?void 0:Ye,Ie=1),N=Object(N);++fe-1&&E%1==0&&E0){if(++N>=i)return arguments[0]}else N=0;return E.apply(void 0,arguments)}}function yc(E){if(E!=null){try{return Dn.call(E)}catch{}try{return E+""}catch{}}return""}function Mo(E,N){return E===N||E!==E&&N!==N}var ul=il(function(){return arguments}())?il:function(E){return za(E)&&bt.call(E,"callee")&&!Js.call(E,"callee")},cl=Array.isArray;function Do(E){return E!=null&&_c(E.length)&&!fl(E)}function Dp(E){return za(E)&&Do(E)}var Sc=sp||Fp;function fl(E){if(!kr(E))return!1;var N=To(E);return N==y||N==v||N==f||N==C}function _c(E){return typeof E=="number"&&E>-1&&E%1==0&&E<=s}function kr(E){var N=typeof E;return E!=null&&(N=="object"||N=="function")}function za(E){return E!=null&&typeof E=="object"}function Np(E){if(!za(E)||To(E)!=S)return!1;var N=Eo(E);if(N===null)return!0;var H=bt.call(N,"constructor")&&N.constructor;return typeof H=="function"&&H instanceof H&&Dn.call(H)==Co}var wc=xe?gi(xe):ic;function Bp(E){return uc(E,bc(E))}function bc(E){return Do(E)?Ep(E,!0):Rp(E)}var nt=Ro(function(E,N,H,fe){ac(E,N,H,fe)});function et(E){return function(){return E}}function Cc(E){return E}function Fp(){return!1}t.exports=nt})(G6,uh);const ai=uh;var U6=t=>/!(important)?$/.test(t),t2=t=>typeof t=="string"?t.replace(/!(important)?$/,"").trim():t,j6=(t,e)=>n=>{const r=String(e),i=U6(r),a=t2(r),s=t?`${t}.${a}`:a;let u=zr(n.__cssMap)&&s in n.__cssMap?n.__cssMap[s].varRef:e;return u=t2(u),i?`${u} !important`:u};function G0(t){const{scale:e,transform:n,compose:r}=t;return(a,s)=>{var u;const c=j6(e,a)(s);let f=(u=n==null?void 0:n(c,s))!=null?u:c;return r&&(f=r(f,s)),f}}var Kf=(...t)=>e=>t.reduce((n,r)=>r(n),e);function Ir(t,e){return n=>{const r={property:n,scale:t};return r.transform=G0({scale:t,transform:e}),r}}var W6=({rtl:t,ltr:e})=>n=>n.direction==="rtl"?t:e;function H6(t){const{property:e,scale:n,transform:r}=t;return{scale:n,property:W6(e),transform:n?G0({scale:n,compose:r}):r}}var $P=["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 V6(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...$P].join(" ")}function q6(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...$P].join(" ")}var K6={"--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(" ")},Y6={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 X6(t){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":t,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var Q6={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},fy={"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"},J6=new Set(Object.values(fy)),zP=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),Z6=t=>t.trim();function e8(t,e){if(t==null||zP.has(t))return t;const r=/(^[a-z-A-Z]+)\((.*)\)/g.exec(t),i=r==null?void 0:r[1],a=r==null?void 0:r[2];if(!i||!a)return t;const s=i.includes("-gradient")?i:`${i}-gradient`,[u,...c]=a.split(",").map(Z6).filter(Boolean);if((c==null?void 0:c.length)===0)return t;const f=u in fy?fy[u]:u;c.unshift(f);const h=c.map(p=>{if(J6.has(p))return p;const g=p.indexOf(" "),[y,v]=g!==-1?[p.substr(0,g),p.substr(g+1)]:[p],w=GP(v)?v:v&&v.split(" "),x=`colors.${y}`,_=x in e.__cssMap?e.__cssMap[x].varRef:y;return w?[_,...Array.isArray(w)?w:[w]].join(" "):_});return`${s}(${h.join(", ")})`}var GP=t=>typeof t=="string"&&t.includes("(")&&t.includes(")"),t8=(t,e)=>e8(t,e??{});function n8(t){return/^var\(--.+\)$/.test(t)}var r8=t=>{const e=parseFloat(t.toString()),n=t.toString().replace(String(e),"");return{unitless:!n,value:e,unit:n}},Jr=t=>e=>`${t}(${e})`,Fe={filter(t){return t!=="auto"?t:K6},backdropFilter(t){return t!=="auto"?t:Y6},ring(t){return X6(Fe.px(t))},bgClip(t){return t==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:t}},transform(t){return t==="auto"?V6():t==="auto-gpu"?q6():t},vh(t){return t==="$100vh"?"var(--chakra-vh)":t},px(t){if(t==null)return t;const{unitless:e}=r8(t);return e||typeof t=="number"?`${t}px`:t},fraction(t){return typeof t!="number"||t>1?t:`${t*100}%`},float(t,e){const n={left:"right",right:"left"};return e.direction==="rtl"?n[t]:t},degree(t){if(n8(t)||t==null)return t;const e=typeof t=="string"&&!t.endsWith("deg");return typeof t=="number"||e?`${t}deg`:t},gradient:t8,blur:Jr("blur"),opacity:Jr("opacity"),brightness:Jr("brightness"),contrast:Jr("contrast"),dropShadow:Jr("drop-shadow"),grayscale:Jr("grayscale"),hueRotate:Jr("hue-rotate"),invert:Jr("invert"),saturate:Jr("saturate"),sepia:Jr("sepia"),bgImage(t){return t==null||GP(t)||zP.has(t)?t:`url(${t})`},outline(t){const e=String(t)==="0"||String(t)==="none";return t!==null&&e?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:t}},flexDirection(t){var e;const{space:n,divide:r}=(e=Q6[t])!=null?e:{},i={flexDirection:t};return n&&(i[n]=1),r&&(i[r]=1),i}},B={borderWidths:Ir("borderWidths"),borderStyles:Ir("borderStyles"),colors:Ir("colors"),borders:Ir("borders"),radii:Ir("radii",Fe.px),space:Ir("space",Kf(Fe.vh,Fe.px)),spaceT:Ir("space",Kf(Fe.vh,Fe.px)),degreeT(t){return{property:t,transform:Fe.degree}},prop(t,e,n){return{property:t,scale:e,...e&&{transform:G0({scale:e,transform:n})}}},propT(t,e){return{property:t,transform:e}},sizes:Ir("sizes",Kf(Fe.vh,Fe.px)),sizesT:Ir("sizes",Kf(Fe.vh,Fe.fraction)),shadows:Ir("shadows"),logical:H6,blur:Ir("blur",Fe.blur)},bd={background:B.colors("background"),backgroundColor:B.colors("backgroundColor"),backgroundImage:B.propT("backgroundImage",Fe.bgImage),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Fe.bgClip},bgSize:B.prop("backgroundSize"),bgPosition:B.prop("backgroundPosition"),bg:B.colors("background"),bgColor:B.colors("backgroundColor"),bgPos:B.prop("backgroundPosition"),bgRepeat:B.prop("backgroundRepeat"),bgAttachment:B.prop("backgroundAttachment"),bgGradient:B.propT("backgroundImage",Fe.gradient),bgClip:{transform:Fe.bgClip}};Object.assign(bd,{bgImage:bd.backgroundImage,bgImg:bd.backgroundImage});var We={border:B.borders("border"),borderWidth:B.borderWidths("borderWidth"),borderStyle:B.borderStyles("borderStyle"),borderColor:B.colors("borderColor"),borderRadius:B.radii("borderRadius"),borderTop:B.borders("borderTop"),borderBlockStart:B.borders("borderBlockStart"),borderTopLeftRadius:B.radii("borderTopLeftRadius"),borderStartStartRadius:B.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:B.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:B.radii("borderTopRightRadius"),borderStartEndRadius:B.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:B.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:B.borders("borderRight"),borderInlineEnd:B.borders("borderInlineEnd"),borderBottom:B.borders("borderBottom"),borderBlockEnd:B.borders("borderBlockEnd"),borderBottomLeftRadius:B.radii("borderBottomLeftRadius"),borderBottomRightRadius:B.radii("borderBottomRightRadius"),borderLeft:B.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:B.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:B.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:B.borders(["borderLeft","borderRight"]),borderInline:B.borders("borderInline"),borderY:B.borders(["borderTop","borderBottom"]),borderBlock:B.borders("borderBlock"),borderTopWidth:B.borderWidths("borderTopWidth"),borderBlockStartWidth:B.borderWidths("borderBlockStartWidth"),borderTopColor:B.colors("borderTopColor"),borderBlockStartColor:B.colors("borderBlockStartColor"),borderTopStyle:B.borderStyles("borderTopStyle"),borderBlockStartStyle:B.borderStyles("borderBlockStartStyle"),borderBottomWidth:B.borderWidths("borderBottomWidth"),borderBlockEndWidth:B.borderWidths("borderBlockEndWidth"),borderBottomColor:B.colors("borderBottomColor"),borderBlockEndColor:B.colors("borderBlockEndColor"),borderBottomStyle:B.borderStyles("borderBottomStyle"),borderBlockEndStyle:B.borderStyles("borderBlockEndStyle"),borderLeftWidth:B.borderWidths("borderLeftWidth"),borderInlineStartWidth:B.borderWidths("borderInlineStartWidth"),borderLeftColor:B.colors("borderLeftColor"),borderInlineStartColor:B.colors("borderInlineStartColor"),borderLeftStyle:B.borderStyles("borderLeftStyle"),borderInlineStartStyle:B.borderStyles("borderInlineStartStyle"),borderRightWidth:B.borderWidths("borderRightWidth"),borderInlineEndWidth:B.borderWidths("borderInlineEndWidth"),borderRightColor:B.colors("borderRightColor"),borderInlineEndColor:B.colors("borderInlineEndColor"),borderRightStyle:B.borderStyles("borderRightStyle"),borderInlineEndStyle:B.borderStyles("borderInlineEndStyle"),borderTopRadius:B.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:B.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:B.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:B.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(We,{rounded:We.borderRadius,roundedTop:We.borderTopRadius,roundedTopLeft:We.borderTopLeftRadius,roundedTopRight:We.borderTopRightRadius,roundedTopStart:We.borderStartStartRadius,roundedTopEnd:We.borderStartEndRadius,roundedBottom:We.borderBottomRadius,roundedBottomLeft:We.borderBottomLeftRadius,roundedBottomRight:We.borderBottomRightRadius,roundedBottomStart:We.borderEndStartRadius,roundedBottomEnd:We.borderEndEndRadius,roundedLeft:We.borderLeftRadius,roundedRight:We.borderRightRadius,roundedStart:We.borderInlineStartRadius,roundedEnd:We.borderInlineEndRadius,borderStart:We.borderInlineStart,borderEnd:We.borderInlineEnd,borderTopStartRadius:We.borderStartStartRadius,borderTopEndRadius:We.borderStartEndRadius,borderBottomStartRadius:We.borderEndStartRadius,borderBottomEndRadius:We.borderEndEndRadius,borderStartRadius:We.borderInlineStartRadius,borderEndRadius:We.borderInlineEndRadius,borderStartWidth:We.borderInlineStartWidth,borderEndWidth:We.borderInlineEndWidth,borderStartColor:We.borderInlineStartColor,borderEndColor:We.borderInlineEndColor,borderStartStyle:We.borderInlineStartStyle,borderEndStyle:We.borderInlineEndStyle});var i8={color:B.colors("color"),textColor:B.colors("color"),fill:B.colors("fill"),stroke:B.colors("stroke")},dy={boxShadow:B.shadows("boxShadow"),mixBlendMode:!0,blendMode:B.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:B.prop("backgroundBlendMode"),opacity:!0};Object.assign(dy,{shadow:dy.boxShadow});var a8={filter:{transform:Fe.filter},blur:B.blur("--chakra-blur"),brightness:B.propT("--chakra-brightness",Fe.brightness),contrast:B.propT("--chakra-contrast",Fe.contrast),hueRotate:B.degreeT("--chakra-hue-rotate"),invert:B.propT("--chakra-invert",Fe.invert),saturate:B.propT("--chakra-saturate",Fe.saturate),dropShadow:B.propT("--chakra-drop-shadow",Fe.dropShadow),backdropFilter:{transform:Fe.backdropFilter},backdropBlur:B.blur("--chakra-backdrop-blur"),backdropBrightness:B.propT("--chakra-backdrop-brightness",Fe.brightness),backdropContrast:B.propT("--chakra-backdrop-contrast",Fe.contrast),backdropHueRotate:B.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:B.propT("--chakra-backdrop-invert",Fe.invert),backdropSaturate:B.propT("--chakra-backdrop-saturate",Fe.saturate)},ch={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Fe.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:B.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:B.space("gap"),rowGap:B.space("rowGap"),columnGap:B.space("columnGap")};Object.assign(ch,{flexDir:ch.flexDirection});var UP={gridGap:B.space("gridGap"),gridColumnGap:B.space("gridColumnGap"),gridRowGap:B.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},o8={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Fe.outline},outlineOffset:!0,outlineColor:B.colors("outlineColor")},lr={width:B.sizesT("width"),inlineSize:B.sizesT("inlineSize"),height:B.sizes("height"),blockSize:B.sizes("blockSize"),boxSize:B.sizes(["width","height"]),minWidth:B.sizes("minWidth"),minInlineSize:B.sizes("minInlineSize"),minHeight:B.sizes("minHeight"),minBlockSize:B.sizes("minBlockSize"),maxWidth:B.sizes("maxWidth"),maxInlineSize:B.sizes("maxInlineSize"),maxHeight:B.sizes("maxHeight"),maxBlockSize:B.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,hideFrom:{scale:"breakpoints",transform:(t,e)=>{var n,r,i;return{[(i=(r=(n=e.__breakpoints)==null?void 0:n.get(t))==null?void 0:r.minWQuery)!=null?i:`@media screen and (min-width: ${t})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(t,e)=>{var n,r,i;return{[(i=(r=(n=e.__breakpoints)==null?void 0:n.get(t))==null?void 0:r.maxWQuery)!=null?i:`@media screen and (max-width: ${t})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:B.propT("float",Fe.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(lr,{w:lr.width,h:lr.height,minW:lr.minWidth,maxW:lr.maxWidth,minH:lr.minHeight,maxH:lr.maxHeight,overscroll:lr.overscrollBehavior,overscrollX:lr.overscrollBehaviorX,overscrollY:lr.overscrollBehaviorY});var s8={listStyleType:!0,listStylePosition:!0,listStylePos:B.prop("listStylePosition"),listStyleImage:!0,listStyleImg:B.prop("listStyleImage")};function l8(t,e,n,r){const i=typeof e=="string"?e.split("."):[e];for(r=0;r{const e=new WeakMap;return(r,i,a,s)=>{if(typeof r>"u")return t(r,i,a);e.has(r)||e.set(r,new Map);const u=e.get(r);if(u.has(i))return u.get(i);const c=t(r,i,a,s);return u.set(i,c),c}},c8=u8(l8),f8={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},d8={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},Nm=(t,e,n)=>{const r={},i=c8(t,e,{});for(const a in i)a in n&&n[a]!=null||(r[a]=i[a]);return r},h8={srOnly:{transform(t){return t===!0?f8:t==="focusable"?d8:{}}},layerStyle:{processResult:!0,transform:(t,e,n)=>Nm(e,`layerStyles.${t}`,n)},textStyle:{processResult:!0,transform:(t,e,n)=>Nm(e,`textStyles.${t}`,n)},apply:{processResult:!0,transform:(t,e,n)=>Nm(e,t,n)}},Su={position:!0,pos:B.prop("position"),zIndex:B.prop("zIndex","zIndices"),inset:B.spaceT("inset"),insetX:B.spaceT(["left","right"]),insetInline:B.spaceT("insetInline"),insetY:B.spaceT(["top","bottom"]),insetBlock:B.spaceT("insetBlock"),top:B.spaceT("top"),insetBlockStart:B.spaceT("insetBlockStart"),bottom:B.spaceT("bottom"),insetBlockEnd:B.spaceT("insetBlockEnd"),left:B.spaceT("left"),insetInlineStart:B.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:B.spaceT("right"),insetInlineEnd:B.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Su,{insetStart:Su.insetInlineStart,insetEnd:Su.insetInlineEnd});var p8={ring:{transform:Fe.ring},ringColor:B.colors("--chakra-ring-color"),ringOffset:B.prop("--chakra-ring-offset-width"),ringOffsetColor:B.colors("--chakra-ring-offset-color"),ringInset:B.prop("--chakra-ring-inset")},st={margin:B.spaceT("margin"),marginTop:B.spaceT("marginTop"),marginBlockStart:B.spaceT("marginBlockStart"),marginRight:B.spaceT("marginRight"),marginInlineEnd:B.spaceT("marginInlineEnd"),marginBottom:B.spaceT("marginBottom"),marginBlockEnd:B.spaceT("marginBlockEnd"),marginLeft:B.spaceT("marginLeft"),marginInlineStart:B.spaceT("marginInlineStart"),marginX:B.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:B.spaceT("marginInline"),marginY:B.spaceT(["marginTop","marginBottom"]),marginBlock:B.spaceT("marginBlock"),padding:B.space("padding"),paddingTop:B.space("paddingTop"),paddingBlockStart:B.space("paddingBlockStart"),paddingRight:B.space("paddingRight"),paddingBottom:B.space("paddingBottom"),paddingBlockEnd:B.space("paddingBlockEnd"),paddingLeft:B.space("paddingLeft"),paddingInlineStart:B.space("paddingInlineStart"),paddingInlineEnd:B.space("paddingInlineEnd"),paddingX:B.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:B.space("paddingInline"),paddingY:B.space(["paddingTop","paddingBottom"]),paddingBlock:B.space("paddingBlock")};Object.assign(st,{m:st.margin,mt:st.marginTop,mr:st.marginRight,me:st.marginInlineEnd,marginEnd:st.marginInlineEnd,mb:st.marginBottom,ml:st.marginLeft,ms:st.marginInlineStart,marginStart:st.marginInlineStart,mx:st.marginX,my:st.marginY,p:st.padding,pt:st.paddingTop,py:st.paddingY,px:st.paddingX,pb:st.paddingBottom,pl:st.paddingLeft,ps:st.paddingInlineStart,paddingStart:st.paddingInlineStart,pr:st.paddingRight,pe:st.paddingInlineEnd,paddingEnd:st.paddingInlineEnd});var g8={textDecorationColor:B.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:B.shadows("textShadow")},m8={clipPath:!0,transform:B.propT("transform",Fe.transform),transformOrigin:!0,translateX:B.spaceT("--chakra-translate-x"),translateY:B.spaceT("--chakra-translate-y"),skewX:B.degreeT("--chakra-skew-x"),skewY:B.degreeT("--chakra-skew-y"),scaleX:B.prop("--chakra-scale-x"),scaleY:B.prop("--chakra-scale-y"),scale:B.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:B.degreeT("--chakra-rotate")},v8={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:B.prop("transitionDuration","transition.duration"),transitionProperty:B.prop("transitionProperty","transition.property"),transitionTimingFunction:B.prop("transitionTimingFunction","transition.easing")},y8={fontFamily:B.prop("fontFamily","fonts"),fontSize:B.prop("fontSize","fontSizes",Fe.px),fontWeight:B.prop("fontWeight","fontWeights"),lineHeight:B.prop("lineHeight","lineHeights"),letterSpacing:B.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(t){if(t===!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"}},S8={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:B.spaceT("scrollMargin"),scrollMarginTop:B.spaceT("scrollMarginTop"),scrollMarginBottom:B.spaceT("scrollMarginBottom"),scrollMarginLeft:B.spaceT("scrollMarginLeft"),scrollMarginRight:B.spaceT("scrollMarginRight"),scrollMarginX:B.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:B.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:B.spaceT("scrollPadding"),scrollPaddingTop:B.spaceT("scrollPaddingTop"),scrollPaddingBottom:B.spaceT("scrollPaddingBottom"),scrollPaddingLeft:B.spaceT("scrollPaddingLeft"),scrollPaddingRight:B.spaceT("scrollPaddingRight"),scrollPaddingX:B.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:B.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function jP(t){return zr(t)&&t.reference?t.reference:String(t)}var ap=(t,...e)=>e.map(jP).join(` ${t} `).replace(/calc/g,""),n2=(...t)=>`calc(${ap("+",...t)})`,r2=(...t)=>`calc(${ap("-",...t)})`,hy=(...t)=>`calc(${ap("*",...t)})`,i2=(...t)=>`calc(${ap("/",...t)})`,a2=t=>{const e=jP(t);return e!=null&&!Number.isNaN(parseFloat(e))?String(e).startsWith("-")?String(e).slice(1):`-${e}`:hy(e,-1)},eo=Object.assign(t=>({add:(...e)=>eo(n2(t,...e)),subtract:(...e)=>eo(r2(t,...e)),multiply:(...e)=>eo(hy(t,...e)),divide:(...e)=>eo(i2(t,...e)),negate:()=>eo(a2(t)),toString:()=>t.toString()}),{add:n2,subtract:r2,multiply:hy,divide:i2,negate:a2});function _8(t,e="-"){return t.replace(/\s+/g,e)}function w8(t){const e=_8(t.toString());return C8(b8(e))}function b8(t){return t.includes("\\.")?t:!Number.isInteger(parseFloat(t.toString()))?t.replace(".","\\."):t}function C8(t){return t.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function x8(t,e=""){return[e,t].filter(Boolean).join("-")}function k8(t,e){return`var(${t}${e?`, ${e}`:""})`}function P8(t,e=""){return w8(`--${x8(t,e)}`)}function E8(t,e,n){const r=P8(t,n);return{variable:r,reference:k8(r,e)}}function O8(t){const e=t==null?0:t.length;return e?t[e-1]:void 0}function T8(t){const e=parseFloat(t.toString()),n=t.toString().replace(String(e),"");return{unitless:!n,value:e,unit:n}}function py(t){if(t==null)return t;const{unitless:e}=T8(t);return e||typeof t=="number"?`${t}px`:t}var WP=(t,e)=>parseInt(t[1],10)>parseInt(e[1],10)?1:-1,U0=t=>Object.fromEntries(Object.entries(t).sort(WP));function o2(t){const e=U0(t);return Object.assign(Object.values(e),e)}function R8(t){const e=Object.keys(U0(t));return new Set(e)}function s2(t){var e;if(!t)return t;t=(e=py(t))!=null?e:t;const n=-.02;return typeof t=="number"?`${t+n}`:t.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function au(t,e){const n=["@media screen"];return t&&n.push("and",`(min-width: ${py(t)})`),e&&n.push("and",`(max-width: ${py(e)})`),n.join(" ")}function A8(t){var e;if(!t)return null;t.base=(e=t.base)!=null?e:"0px";const n=o2(t),r=Object.entries(t).sort(WP).map(([s,u],c,f)=>{var h;let[,p]=(h=f[c+1])!=null?h:[];return p=parseFloat(p)>0?s2(p):void 0,{_minW:s2(u),breakpoint:s,minW:u,maxW:p,maxWQuery:au(null,p),minWQuery:au(u),minMaxQuery:au(u,p)}}),i=R8(t),a=Array.from(i.values());return{keys:i,normalized:n,isResponsive(s){const u=Object.keys(s);return u.length>0&&u.every(c=>i.has(c))},asObject:U0(t),asArray:o2(t),details:r,get(s){return r.find(u=>u.breakpoint===s)},media:[null,...n.map(s=>au(s)).slice(1)],toArrayValue(s){if(!zr(s))throw new Error("toArrayValue: value must be an object");const u=a.map(c=>{var f;return(f=s[c])!=null?f:null});for(;O8(u)===null;)u.pop();return u},toObjectValue(s){if(!Array.isArray(s))throw new Error("toObjectValue: value must be an array");return s.reduce((u,c,f)=>{const h=a[f];return h!=null&&c!=null&&(u[h]=c),u},{})}}}var Qt={hover:(t,e)=>`${t}:hover ${e}, ${t}[data-hover] ${e}`,focus:(t,e)=>`${t}:focus ${e}, ${t}[data-focus] ${e}`,focusVisible:(t,e)=>`${t}:focus-visible ${e}`,focusWithin:(t,e)=>`${t}:focus-within ${e}`,active:(t,e)=>`${t}:active ${e}, ${t}[data-active] ${e}`,disabled:(t,e)=>`${t}:disabled ${e}, ${t}[data-disabled] ${e}`,invalid:(t,e)=>`${t}:invalid ${e}, ${t}[data-invalid] ${e}`,checked:(t,e)=>`${t}:checked ${e}, ${t}[data-checked] ${e}`,indeterminate:(t,e)=>`${t}:indeterminate ${e}, ${t}[aria-checked=mixed] ${e}, ${t}[data-indeterminate] ${e}`,readOnly:(t,e)=>`${t}:read-only ${e}, ${t}[readonly] ${e}, ${t}[data-read-only] ${e}`,expanded:(t,e)=>`${t}:read-only ${e}, ${t}[aria-expanded=true] ${e}, ${t}[data-expanded] ${e}`,placeholderShown:(t,e)=>`${t}:placeholder-shown ${e}`},la=t=>HP(e=>t(e,"&"),"[role=group]","[data-group]",".group"),Ai=t=>HP(e=>t(e,"~ &"),"[data-peer]",".peer"),HP=(t,...e)=>e.map(t).join(", "),op={_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",_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:la(Qt.hover),_peerHover:Ai(Qt.hover),_groupFocus:la(Qt.focus),_peerFocus:Ai(Qt.focus),_groupFocusVisible:la(Qt.focusVisible),_peerFocusVisible:Ai(Qt.focusVisible),_groupActive:la(Qt.active),_peerActive:Ai(Qt.active),_groupDisabled:la(Qt.disabled),_peerDisabled:Ai(Qt.disabled),_groupInvalid:la(Qt.invalid),_peerInvalid:Ai(Qt.invalid),_groupChecked:la(Qt.checked),_peerChecked:Ai(Qt.checked),_groupFocusWithin:la(Qt.focusWithin),_peerFocusWithin:Ai(Qt.focusWithin),_peerPlaceholderShown:Ai(Qt.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]"},I8=Object.keys(op);function l2(t,e){return E8(String(t).replace(/\./g,"-"),void 0,e)}function L8(t,e){let n={};const r={};for(const[i,a]of Object.entries(t)){const{isSemantic:s,value:u}=a,{variable:c,reference:f}=l2(i,e==null?void 0:e.cssVarPrefix);if(!s){if(i.startsWith("space")){const g=i.split("."),[y,...v]=g,w=`${y}.-${v.join(".")}`,x=eo.negate(u),_=eo.negate(f);r[w]={value:x,var:c,varRef:_}}n[c]=u,r[i]={value:u,var:c,varRef:f};continue}const h=g=>{const v=[String(i).split(".")[0],g].join(".");if(!t[v])return g;const{reference:x}=l2(v,e==null?void 0:e.cssVarPrefix);return x},p=zr(u)?u:{default:u};n=ai(n,Object.entries(p).reduce((g,[y,v])=>{var w,x;const _=h(v);if(y==="default")return g[c]=_,g;const S=(x=(w=op)==null?void 0:w[y])!=null?x:y;return g[S]={[c]:_},g},{})),r[i]={value:f,var:c,varRef:f}}return{cssVars:n,cssMap:r}}function M8(t,e=[]){const n=Object.assign({},t);for(const r of e)r in n&&delete n[r];return n}function D8(t,e){const n={};for(const r of e)r in t&&(n[r]=t[r]);return n}var N8=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function B8(t){return D8(t,N8)}function F8(t){return t.semanticTokens}function $8(t){const{__cssMap:e,__cssVars:n,__breakpoints:r,...i}=t;return i}function z8({tokens:t,semanticTokens:e}){var n,r;const i=Object.entries((n=gy(t))!=null?n:{}).map(([s,u])=>[s,{isSemantic:!1,value:u}]),a=Object.entries((r=gy(e,1))!=null?r:{}).map(([s,u])=>[s,{isSemantic:!0,value:u}]);return Object.fromEntries([...i,...a])}function gy(t,e=1/0){return!zr(t)&&!Array.isArray(t)||!e?t:Object.entries(t).reduce((n,[r,i])=>(zr(i)||Array.isArray(i)?Object.entries(gy(i,e-1)).forEach(([a,s])=>{n[`${r}.${a}`]=s}):n[r]=i,n),{})}function uH(t){var e;const n=$8(t),r=B8(n),i=F8(n),a=z8({tokens:r,semanticTokens:i}),s=(e=n.config)==null?void 0:e.cssVarPrefix,{cssMap:u,cssVars:c}=L8(a,{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"},...c},__cssMap:u,__breakpoints:A8(n.breakpoints)}),n}var j0=ai({},bd,We,i8,ch,lr,a8,p8,o8,UP,h8,Su,dy,st,S8,y8,g8,m8,s8,v8),G8=Object.assign({},st,lr,ch,UP,Su),cH=Object.keys(G8),U8=[...Object.keys(j0),...I8],j8={...j0,...op},W8=t=>t in j8,H8=t=>e=>{if(!e.__breakpoints)return t;const{isResponsive:n,toArrayValue:r,media:i}=e.__breakpoints,a={};for(const s in t){let u=io(t[s],e);if(u==null)continue;if(u=zr(u)&&n(u)?r(u):u,!Array.isArray(u)){a[s]=u;continue}const c=u.slice(0,i.length).length;for(let f=0;ft.startsWith("--")&&typeof e=="string"&&!q8(e),Y8=(t,e)=>{var n,r;if(e==null)return e;const i=c=>{var f,h;return(h=(f=t.__cssMap)==null?void 0:f[c])==null?void 0:h.varRef},a=c=>{var f;return(f=i(c))!=null?f:c},[s,u]=V8(e);return e=(r=(n=i(s))!=null?n:a(u))!=null?r:a(e),e};function X8(t){const{configs:e={},pseudos:n={},theme:r}=t,i=(a,s=!1)=>{var u,c,f;const h=io(a,r),p=H8(h)(r);let g={};for(let y in p){const v=p[y];let w=io(v,r);y in n&&(y=n[y]),K8(y,w)&&(w=Y8(r,w));let x=e[y];if(x===!0&&(x={property:y}),zr(w)){g[y]=(u=g[y])!=null?u:{},g[y]=ai({},g[y],i(w,!0));continue}let _=(f=(c=x==null?void 0:x.transform)==null?void 0:c.call(x,w,r,h))!=null?f:w;_=x!=null&&x.processResult?i(_,!0):_;const S=io(x==null?void 0:x.property,r);if(!s&&(x!=null&&x.static)){const C=io(x.static,r);g=ai({},g,C)}if(S&&Array.isArray(S)){for(const C of S)g[C]=_;continue}if(S){S==="&"&&zr(_)?g=ai({},g,_):g[S]=_;continue}if(zr(_)){g=ai({},g,_);continue}g[y]=_}return g};return i}var Q8=t=>e=>X8({theme:e,pseudos:op,configs:j0})(t);function fH(t){return t}function dH(t){return t}function hH(t){return{definePartsStyle(e){return e},defineMultiStyleConfig(e){return{parts:t,...e}}}}function J8(t,e){if(Array.isArray(t))return t;if(zr(t))return e(t);if(t!=null)return[t]}function Z8(t,e){for(let n=e+1;n{ai(f,{[C]:g?S[C]:{[_]:S[C]}})});continue}if(!y){g?ai(f,S):f[_]=S;continue}f[_]=S}}return f}}function tG(t){return e=>{var n;const{variant:r,size:i,theme:a}=e,s=eG(a);return ai({},io((n=t.baseStyle)!=null?n:{},e),s(t,"sizes",i,e),s(t,"variants",r,e))}}function pH(t,e,n){var r,i,a;return(a=(i=(r=t.__cssMap)==null?void 0:r[`${e}.${n}`])==null?void 0:i.varRef)!=null?a:n}function VP(t){return M8(t,["styleConfig","size","variant","colorScheme"])}function nG(t,e){const n={};return Object.keys(t).forEach(r=>{e.includes(r)||(n[r]=t[r])}),n}function rG(t,e,n,r){const i=typeof e=="string"?e.split("."):[e];for(r=0;r{const e=new WeakMap;return(r,i,a,s)=>{if(typeof r>"u")return t(r,i,a);e.has(r)||e.set(r,new Map);const u=e.get(r);if(u.has(i))return u.get(i);const c=t(r,i,a,s);return u.set(i,c),c}},aG=iG(rG);function qP(t,e){const n={};return Object.keys(t).forEach(r=>{const i=t[r];e(i,r,t)&&(n[r]=i)}),n}var KP=t=>qP(t,e=>e!=null);function oG(t){return typeof t=="function"}function sG(t,...e){return oG(t)?t(...e):t}function gH(...t){return function(n){t.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var lG=typeof Element<"u",uG=typeof Map=="function",cG=typeof Set=="function",fG=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Cd(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!Cd(t[r],e[r]))return!1;return!0}var a;if(uG&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;for(a=t.entries();!(r=a.next()).done;)if(!Cd(r.value[1],e.get(r.value[0])))return!1;return!0}if(cG&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(fG&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;if(lG&&t instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&t.$$typeof)&&!Cd(t[i[r]],e[i[r]]))return!1;return!0}return t!==t&&e!==e}var dG=function(e,n){try{return Cd(e,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};function YP(t,e={}){var n;const{styleConfig:r,...i}=e,{theme:a,colorMode:s}=D6(),u=t?aG(a,`components.${t}`):void 0,c=r||u,f=ai({theme:a,colorMode:s},(n=c==null?void 0:c.defaultProps)!=null?n:{},KP(nG(i,["children"]))),h=be.useRef({});if(c){const g=tG(c)(f);dG(h.current,g)||(h.current=g)}return h.current}function XP(t,e={}){return YP(t,e)}function mH(t,e={}){return YP(t,e)}var hG=new Set([...U8,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),pG=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function gG(t){return pG.has(t)||!hG.has(t)}function mG(t){const e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function vG(t,...e){if(t==null)throw new TypeError("Cannot convert undefined or null to object");const n={...t};for(const r of e)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 yG=/^((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)-.*))$/,SG=EP(function(t){return yG.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),_G=SG,wG=function(e){return e!=="theme"},u2=function(e){return typeof e=="string"&&e.charCodeAt(0)>96?_G:wG},c2=function(e,n,r){var i;if(n){var a=n.shouldForwardProp;i=e.__emotion_forwardProp&&a?function(s){return e.__emotion_forwardProp(s)&&a(s)}:a}return typeof i!="function"&&r&&(i=e.__emotion_forwardProp),i},bG=function(e){var n=e.cache,r=e.serialized,i=e.isStringTag;return TP(n,r,i),R6(function(){return RP(n,r,i)}),null},CG=function t(e,n){var r=e.__emotion_real===e,i=r&&e.__emotion_base||e,a,s;n!==void 0&&(a=n.label,s=n.target);var u=c2(e,n,r),c=u||u2(i),f=!c("as");return function(){var h=arguments,p=r&&e.__emotion_styles!==void 0?e.__emotion_styles.slice(0):[];if(a!==void 0&&p.push("label:"+a+";"),h[0]==null||h[0].raw===void 0)p.push.apply(p,h);else{p.push(h[0][0]);for(var g=h.length,y=1;ye=>{const{theme:n,css:r,__css:i,sx:a,...s}=e,u=qP(s,(p,g)=>W8(g)),c=sG(t,e),f=vG({},i,c,KP(u),a),h=Q8(f)(e.theme);return r?[h,r]:h};function Bm(t,e){const{baseStyle:n,...r}=e??{};r.shouldForwardProp||(r.shouldForwardProp=gG);const i=PG({baseStyle:n}),a=kG(t,r)(i);return As.forwardRef(function(c,f){const{colorMode:h,forced:p}=BP();return As.createElement(a,{ref:f,"data-theme":p?h:void 0,...c})})}function EG(){const t=new Map;return new Proxy(Bm,{apply(e,n,r){return Bm(...r)},get(e,n){return t.has(n)||t.set(n,Bm(n)),t.get(n)}})}var dh=EG();function W0(t){return be.forwardRef(t)}var OG=M6({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),QP=W0((t,e)=>{const n=XP("Spinner",t),{label:r="Loading...",thickness:i="2px",speed:a="0.45s",emptyColor:s="transparent",className:u,...c}=VP(t),f=FP("chakra-spinner",u),h={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:s,borderLeftColor:s,animation:`${OG} ${a} linear infinite`,...n};return jt.jsx(dh.div,{ref:e,__css:h,className:f,...c,children:r&&jt.jsx(dh.span,{srOnly:!0,children:r})})});QP.displayName="Spinner";var JP=W0(function(e,n){const r=XP("Text",e),{className:i,align:a,decoration:s,casing:u,...c}=VP(e),f=mG({textAlign:e.align,textDecoration:e.decoration,textTransform:e.casing});return jt.jsx(dh.p,{ref:n,className:FP("chakra-text",e.className),...f,...c,__css:r})});JP.displayName="Text";var ZP=W0(function(e,n){const{direction:r,align:i,justify:a,wrap:s,basis:u,grow:c,shrink:f,...h}=e,p={display:"flex",flexDirection:r,alignItems:i,justifyContent:a,flexWrap:s,flexBasis:u,flexGrow:c,flexShrink:f};return jt.jsx(dh.div,{ref:n,__css:p,...h})});ZP.displayName="Flex";const d2=t=>{const{t:e}=lB(),{showText:n=!1,text:r=e("common.loadingInvokeAI")}=t;return jt.jsxs(ZP,{width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#121212",flexDirection:"column",rowGap:4,children:[jt.jsx(QP,{color:"grey",w:"5rem",h:"5rem"}),n&&jt.jsx(JP,{color:"grey",fontWeight:"semibold",fontFamily:"'Inter', sans-serif",children:r})]})},TG=be.lazy(()=>bx(()=>import("./App-16da1b5e.js"),["./App-16da1b5e.js","./storeHooks-0eed8e9f.js","./App-08e5c546.css"],import.meta.url)),RG=be.lazy(()=>bx(()=>import("./ThemeLocaleProvider-51f66919.js"),["./ThemeLocaleProvider-51f66919.js","./storeHooks-0eed8e9f.js"],import.meta.url));function AG(t){return jt.jsx(As.StrictMode,{children:jt.jsx(Y3,{store:_P,children:jt.jsx(Ax,{loading:jt.jsx(d2,{}),persistor:qz,children:jt.jsx(As.Suspense,{fallback:jt.jsx(d2,{showText:!0}),children:jt.jsx(RG,{children:jt.jsx(TG,{children:t.children})})})})})})}Fm.createRoot(document.getElementById("root")).render(jt.jsx(AG,{}));export{rW as $,Vf as A,Of as B,yU as C,D5 as D,lB as E,ZP as F,xd as G,tW as H,oW as I,XW as J,KW as K,qW as L,wW as M,vB as N,yB as O,CW as P,JW as Q,As as R,QP as S,JP as T,fW as U,YW as V,rH as W,QW as X,BW as Y,eW as Z,Xd as _,FP as a,IW as a$,aW as a0,_W as a1,bW as a2,lW as a3,qz as a4,sW as a5,gW as a6,vU as a7,vW as a8,TW as a9,gj as aA,Ow as aB,Rj as aC,kj as aD,Vj as aE,Fj as aF,mj as aG,N5 as aH,vj as aI,Aj as aJ,tj as aK,ej as aL,L5 as aM,Xj as aN,zj as aO,Gj as aP,$j as aQ,Lj as aR,kz as aS,fF as aT,cF as aU,Yj as aV,Ij as aW,R5 as aX,Bj as aY,MW as aZ,yj as a_,yW as aa,OW as ab,NW as ac,Hj as ad,Wj as ae,jj as af,Jj as ag,Zj as ah,DW as ai,Qj as aj,HW as ak,dd as al,O5 as am,wj as an,bj as ao,lj as ap,pW as aq,hj as ar,Tj as as,jW as at,WW as au,SW as av,Dj as aw,_j as ax,Cj as ay,Mj as az,sH as b,XU as b$,AW as b0,uj as b1,LW as b2,iW as b3,VW as b4,hW as b5,dW as b6,Ew as b7,UW as b8,Kj as b9,VU as bA,Qx as bB,zG as bC,GG as bD,UG as bE,jU as bF,tU as bG,eU as bH,XG as bI,UU as bJ,ZW as bK,QG as bL,lU as bM,uU as bN,Ef as bO,va as bP,PU as bQ,xU as bR,wU as bS,NG as bT,BG as bU,$W as bV,zW as bW,pU as bX,oU as bY,sU as bZ,nU as b_,qj as ba,$m as bb,AL as bc,pe as bd,Lb as be,kU as bf,HU as bg,WU as bh,iU as bi,DU as bj,qU as bk,GW as bl,KG as bm,_U as bn,Vl as bo,gU as bp,YG as bq,Cz as br,SU as bs,HG as bt,mU as bu,VG as bv,ZG as bw,LG as bx,MG as by,DG as bz,dh as c,cW as c0,Af as c1,ei as c2,zl as c3,Ae as c4,TU as c5,ns as c6,FG as c7,EU as c8,rU as c9,uW as cA,kW as cB,dj as cC,ZU as cD,aj as cE,nj as cF,rj as cG,ij as cH,sj as cI,Hb as cJ,EW as cK,RW as cL,BP as cM,nH as cN,NP as cO,fH as cP,hH as cQ,E8 as cR,dH as cS,ai as cT,uH as cU,tH as cV,aG as cW,Q8 as cX,Yd as cY,T3 as cZ,IG as c_,aU as ca,WG as cb,jG as cc,eH as cd,qG as ce,GU as cf,RU as cg,AU as ch,FU as ci,hU as cj,dU as ck,OU as cl,JU as cm,MU as cn,IU as co,zU as cp,$G as cq,M5 as cr,Nj as cs,QU as ct,fU as cu,xj as cv,Pj as cw,Ej as cx,Oj as cy,PW as cz,mH as d,XP as e,W0 as f,aH as g,oH as h,lH as i,jt as j,M6 as k,jv as l,Ur as m,sG as n,VP as o,gH as p,zr as q,be as r,DP as s,io as t,D6 as u,cH as v,iH as w,pH as x,wk as y,_t as z}; diff --git a/invokeai/frontend/web/dist/assets/storeHooks-e63a2dc4.js b/invokeai/frontend/web/dist/assets/storeHooks-0eed8e9f.js similarity index 99% rename from invokeai/frontend/web/dist/assets/storeHooks-e63a2dc4.js rename to invokeai/frontend/web/dist/assets/storeHooks-0eed8e9f.js index 2393fec999..20c242bb66 100644 --- a/invokeai/frontend/web/dist/assets/storeHooks-e63a2dc4.js +++ b/invokeai/frontend/web/dist/assets/storeHooks-0eed8e9f.js @@ -1,4 +1,4 @@ -import{cY as zt,cZ as Ji,r as m,j as C,G as Cs,R as Ss,c as G,t as Te,f as Mt,a as Dt,e as As,S as Qi,o as Vs,d as to,c_ as eo}from"./index-2ad84bef.js";function ws(t=zt){const e=t===zt?Ji:()=>m.useContext(t);return function(){const{store:s}=e();return s}}const no=ws();function so(t=zt){const e=t===zt?no:ws(t);return function(){return e().dispatch}}const io=so();function oo(t,e){return`${t} returned \`undefined\`. Seems you forgot to wrap component within ${e}`}function Rt(t={}){const{name:e,strict:n=!0,hookName:s="useContext",providerName:i="Provider",errorMessage:r}=t,o=m.createContext(void 0);o.displayName=e;function a(){var c;const l=m.useContext(o);if(!l&&n){const u=new Error(r??oo(s,i));throw u.name="ContextError",(c=Error.captureStackTrace)==null||c.call(Error,u,a),u}return l}return[o.Provider,a,o]}var[ro,ao]=Rt({strict:!1,name:"PortalManagerContext"});function co(t){const{children:e,zIndex:n}=t;return C.jsx(ro,{value:{zIndex:n},children:e})}co.displayName="PortalManager";var Ce=Boolean(globalThis==null?void 0:globalThis.document)?m.useLayoutEffect:m.useEffect,[Ms,lo]=Rt({strict:!1,name:"PortalContext"}),ze="chakra-portal",uo=".chakra-portal",fo=t=>C.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:t.zIndex,top:0,left:0,right:0},children:t.children}),ho=t=>{const{appendToParentPortal:e,children:n}=t,[s,i]=m.useState(null),r=m.useRef(null),[,o]=m.useState({});m.useEffect(()=>o({}),[]);const a=lo(),c=ao();Ce(()=>{if(!s)return;const u=s.ownerDocument,f=e?a??u.body:u.body;if(!f)return;r.current=u.createElement("div"),r.current.className=ze,f.appendChild(r.current),o({});const h=r.current;return()=>{f.contains(h)&&f.removeChild(h)}},[s]);const l=c!=null&&c.zIndex?C.jsx(fo,{zIndex:c==null?void 0:c.zIndex,children:n}):n;return r.current?Cs.createPortal(C.jsx(Ms,{value:r.current,children:l}),r.current):C.jsx("span",{ref:u=>{u&&i(u)}})},po=t=>{const{children:e,containerRef:n,appendToParentPortal:s}=t,i=n.current,r=i??(typeof window<"u"?document.body:void 0),o=m.useMemo(()=>{const c=i==null?void 0:i.ownerDocument.createElement("div");return c&&(c.className=ze),c},[i]),[,a]=m.useState({});return Ce(()=>a({}),[]),Ce(()=>{if(!(!o||!r))return r.appendChild(o),()=>{r.removeChild(o)}},[o,r]),r&&o?Cs.createPortal(C.jsx(Ms,{value:s?o:null,children:e}),o):null};function Jt(t){const e={appendToParentPortal:!0,...t},{containerRef:n,...s}=e;return n?C.jsx(po,{containerRef:n,...s}):C.jsx(ho,{...s})}Jt.className=ze;Jt.selector=uo;Jt.displayName="Portal";var mo=(t,e)=>t.find(n=>n.id===e);function yn(t,e){const n=Ds(t,e),s=n?t[n].findIndex(i=>i.id===e):-1;return{position:n,index:s}}function Ds(t,e){for(const[n,s]of Object.entries(t))if(mo(s,e))return n}function go(t){const e=t.includes("right"),n=t.includes("left");let s="center";return e&&(s="flex-end"),n&&(s="flex-start"),{display:"flex",flexDirection:"column",alignItems:s}}function yo(t){const n=t==="top"||t==="bottom"?"0 auto":void 0,s=t.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=t.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,r=t.includes("left")?void 0:"env(safe-area-inset-right, 0px)",o=t.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:5500,pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:s,bottom:i,right:r,left:o}}function vo(t,e=[]){const n=m.useRef(t);return m.useEffect(()=>{n.current=t}),m.useCallback((...s)=>{var i;return(i=n.current)==null?void 0:i.call(n,...s)},e)}function xo(t,e){const n=vo(t);m.useEffect(()=>{if(e==null)return;let s=null;return s=window.setTimeout(()=>{n()},e),()=>{s&&window.clearTimeout(s)}},[e,n])}function vn(t,e){const n=m.useRef(!1),s=m.useRef(!1);m.useEffect(()=>{if(n.current&&s.current)return t();s.current=!0},e),m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const Rs=m.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Qt=m.createContext({});function Po(){return m.useContext(Qt).visualElement}const Et=m.createContext(null),te=typeof document<"u",$t=te?m.useLayoutEffect:m.useEffect,Es=m.createContext({strict:!1});function bo(t,e,n,s){const i=Po(),r=m.useContext(Es),o=m.useContext(Et),a=m.useContext(Rs).reducedMotion,c=m.useRef();s=s||r.renderer,!c.current&&s&&(c.current=s(t,{visualState:e,parent:i,props:n,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:a}));const l=c.current;return m.useInsertionEffect(()=>{l&&l.update(n,o)}),$t(()=>{l&&l.render()}),m.useEffect(()=>{l&&l.updateFeatures()}),(window.HandoffAppearAnimations?$t:m.useEffect)(()=>{l&&l.animationState&&l.animationState.animateChanges()}),l}function lt(t){return typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function To(t,e,n){return m.useCallback(s=>{s&&t.mount&&t.mount(s),e&&(s?e.mount(s):e.unmount()),n&&(typeof n=="function"?n(s):lt(n)&&(n.current=s))},[e])}function Ct(t){return typeof t=="string"||Array.isArray(t)}function ee(t){return typeof t=="object"&&typeof t.start=="function"}const $e=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],He=["initial",...$e];function ne(t){return ee(t.animate)||He.some(e=>Ct(t[e]))}function Ls(t){return Boolean(ne(t)||t.variants)}function Co(t,e){if(ne(t)){const{initial:n,animate:s}=t;return{initial:n===!1||Ct(n)?n:void 0,animate:Ct(s)?s:void 0}}return t.inherit!==!1?e:{}}function So(t){const{initial:e,animate:n}=Co(t,m.useContext(Qt));return m.useMemo(()=>({initial:e,animate:n}),[xn(e),xn(n)])}function xn(t){return Array.isArray(t)?t.join(" "):t}const Pn={animation:["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"],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"]},St={};for(const t in Pn)St[t]={isEnabled:e=>Pn[t].some(n=>!!e[n])};function Ao(t){for(const e in t)St[e]={...St[e],...t[e]}}function We(t){const e=m.useRef(null);return e.current===null&&(e.current=t()),e.current}const yt={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let Vo=1;function wo(){return We(()=>{if(yt.hasEverUpdated)return Vo++})}const Ge=m.createContext({}),js=m.createContext({}),Mo=Symbol.for("motionComponentSymbol");function Do({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:s,Component:i}){t&&Ao(t);function r(a,c){let l;const u={...m.useContext(Rs),...a,layoutId:Ro(a)},{isStatic:f}=u,h=So(a),d=f?void 0:wo(),p=s(a,f);if(!f&&te){h.visualElement=bo(i,p,u,e);const g=m.useContext(js),T=m.useContext(Es).strict;h.visualElement&&(l=h.visualElement.loadFeatures(u,T,t,d,g))}return m.createElement(Qt.Provider,{value:h},l&&h.visualElement?m.createElement(l,{visualElement:h.visualElement,...u}):null,n(i,a,d,To(p,h.visualElement,c),p,f,h.visualElement))}const o=m.forwardRef(r);return o[Mo]=i,o}function Ro({layoutId:t}){const e=m.useContext(Ge).id;return e&&t!==void 0?e+"-"+t:t}function Eo(t){function e(s,i={}){return Do(t(s,i))}if(typeof Proxy>"u")return e;const n=new Map;return new Proxy(e,{get:(s,i)=>(n.has(i)||n.set(i,e(i)),n.get(i))})}const Lo=["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 Ke(t){return typeof t!="string"||t.includes("-")?!1:!!(Lo.indexOf(t)>-1||/[A-Z]/.test(t))}const Ht={};function jo(t){Object.assign(Ht,t)}const se=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ot=new Set(se);function Bs(t,{layout:e,layoutId:n}){return ot.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Ht[t]||t==="opacity")}const j=t=>Boolean(t&&t.getVelocity),Bo={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ko=se.length;function Fo(t,{enableHardwareAcceleration:e=!0,allowTransformNone:n=!0},s,i){let r="";for(let o=0;oe=>typeof e=="string"&&e.startsWith(t),Fs=ks("--"),Se=ks("var(--"),Io=(t,e)=>e&&typeof t=="number"?e.transform(t):t,ht=(t,e,n)=>Math.min(Math.max(n,t),e),rt={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},vt={...rt,transform:t=>ht(0,1,t)},It={...rt,default:1},xt=t=>Math.round(t*1e5)/1e5,At=/(-)?([\d]*\.?[\d])+/g,Ae=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Oo=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Lt(t){return typeof t=="string"}const jt=t=>({test:e=>Lt(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),q=jt("deg"),z=jt("%"),b=jt("px"),No=jt("vh"),Uo=jt("vw"),bn={...z,parse:t=>z.parse(t)/100,transform:t=>z.transform(t*100)},Tn={...rt,transform:Math.round},Is={borderWidth:b,borderTopWidth:b,borderRightWidth:b,borderBottomWidth:b,borderLeftWidth:b,borderRadius:b,radius:b,borderTopLeftRadius:b,borderTopRightRadius:b,borderBottomRightRadius:b,borderBottomLeftRadius:b,width:b,maxWidth:b,height:b,maxHeight:b,size:b,top:b,right:b,bottom:b,left:b,padding:b,paddingTop:b,paddingRight:b,paddingBottom:b,paddingLeft:b,margin:b,marginTop:b,marginRight:b,marginBottom:b,marginLeft:b,rotate:q,rotateX:q,rotateY:q,rotateZ:q,scale:It,scaleX:It,scaleY:It,scaleZ:It,skew:q,skewX:q,skewY:q,distance:b,translateX:b,translateY:b,translateZ:b,x:b,y:b,z:b,perspective:b,transformPerspective:b,opacity:vt,originX:bn,originY:bn,originZ:b,zIndex:Tn,fillOpacity:vt,strokeOpacity:vt,numOctaves:Tn};function Ze(t,e,n,s){const{style:i,vars:r,transform:o,transformOrigin:a}=t;let c=!1,l=!1,u=!0;for(const f in e){const h=e[f];if(Fs(f)){r[f]=h;continue}const d=Is[f],p=Io(h,d);if(ot.has(f)){if(c=!0,o[f]=p,!u)continue;h!==(d.default||0)&&(u=!1)}else f.startsWith("origin")?(l=!0,a[f]=p):i[f]=p}if(e.transform||(c||s?i.transform=Fo(t.transform,n,u,s):i.transform&&(i.transform="none")),l){const{originX:f="50%",originY:h="50%",originZ:d=0}=a;i.transformOrigin=`${f} ${h} ${d}`}}const qe=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Os(t,e,n){for(const s in e)!j(e[s])&&!Bs(s,n)&&(t[s]=e[s])}function _o({transformTemplate:t},e,n){return m.useMemo(()=>{const s=qe();return Ze(s,e,{enableHardwareAcceleration:!n},t),Object.assign({},s.vars,s.style)},[e])}function zo(t,e,n){const s=t.style||{},i={};return Os(i,s,t),Object.assign(i,_o(t,e,n)),t.transformValues?t.transformValues(i):i}function $o(t,e,n){const s={},i=zo(t,e,n);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=i,s}const Ho=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 Wt(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||Ho.has(t)}let Ns=t=>!Wt(t);function Wo(t){t&&(Ns=e=>e.startsWith("on")?!Wt(e):t(e))}try{Wo(require("@emotion/is-prop-valid").default)}catch{}function Go(t,e,n){const s={};for(const i in t)i==="values"&&typeof t.values=="object"||(Ns(i)||n===!0&&Wt(i)||!e&&!Wt(i)||t.draggable&&i.startsWith("onDrag"))&&(s[i]=t[i]);return s}function Cn(t,e,n){return typeof t=="string"?t:b.transform(e+n*t)}function Ko(t,e,n){const s=Cn(e,t.x,t.width),i=Cn(n,t.y,t.height);return`${s} ${i}`}const Zo={offset:"stroke-dashoffset",array:"stroke-dasharray"},qo={offset:"strokeDashoffset",array:"strokeDasharray"};function Yo(t,e,n=1,s=0,i=!0){t.pathLength=1;const r=i?Zo:qo;t[r.offset]=b.transform(-s);const o=b.transform(e),a=b.transform(n);t[r.array]=`${o} ${a}`}function Ye(t,{attrX:e,attrY:n,originX:s,originY:i,pathLength:r,pathSpacing:o=1,pathOffset:a=0,...c},l,u,f){if(Ze(t,c,l,f),u){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:d,dimensions:p}=t;h.transform&&(p&&(d.transform=h.transform),delete h.transform),p&&(s!==void 0||i!==void 0||d.transform)&&(d.transformOrigin=Ko(p,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&Yo(h,r,o,a,!1)}const Us=()=>({...qe(),attrs:{}}),Xe=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Xo(t,e,n,s){const i=m.useMemo(()=>{const r=Us();return Ye(r,e,{enableHardwareAcceleration:!1},Xe(s),t.transformTemplate),{...r.attrs,style:{...r.style}}},[e]);if(t.style){const r={};Os(r,t.style,t),i.style={...r,...i.style}}return i}function Jo(t=!1){return(n,s,i,r,{latestValues:o},a)=>{const l=(Ke(n)?Xo:$o)(s,o,a,n),f={...Go(s,typeof n=="string",t),...l,ref:r},{children:h}=s,d=m.useMemo(()=>j(h)?h.get():h,[h]);return i&&(f["data-projection-id"]=i),m.createElement(n,{...f,children:d})}}const Je=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function _s(t,{style:e,vars:n},s,i){Object.assign(t.style,e,i&&i.getProjectionStyles(s));for(const r in n)t.style.setProperty(r,n[r])}const zs=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 $s(t,e,n,s){_s(t,e,void 0,s);for(const i in e.attrs)t.setAttribute(zs.has(i)?i:Je(i),e.attrs[i])}function Qe(t,e){const{style:n}=t,s={};for(const i in n)(j(n[i])||e.style&&j(e.style[i])||Bs(i,t))&&(s[i]=n[i]);return s}function Hs(t,e){const n=Qe(t,e);for(const s in t)if(j(t[s])||j(e[s])){const i=s==="x"||s==="y"?"attr"+s.toUpperCase():s;n[i]=t[s]}return n}function tn(t,e,n,s={},i={}){return typeof e=="function"&&(e=e(n!==void 0?n:t.custom,s,i)),typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"&&(e=e(n!==void 0?n:t.custom,s,i)),e}const Gt=t=>Array.isArray(t),Qo=t=>Boolean(t&&typeof t=="object"&&t.mix&&t.toValue),tr=t=>Gt(t)?t[t.length-1]||0:t;function Ut(t){const e=j(t)?t.get():t;return Qo(e)?e.toValue():e}function er({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},s,i,r){const o={latestValues:nr(s,i,r,t),renderState:e()};return n&&(o.mount=a=>n(s,a,o)),o}const Ws=t=>(e,n)=>{const s=m.useContext(Qt),i=m.useContext(Et),r=()=>er(t,e,s,i);return n?r():We(r)};function nr(t,e,n,s){const i={},r=s(t,{});for(const h in r)i[h]=Ut(r[h]);let{initial:o,animate:a}=t;const c=ne(t),l=Ls(t);e&&l&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const f=u?a:o;return f&&typeof f!="boolean"&&!ee(f)&&(Array.isArray(f)?f:[f]).forEach(d=>{const p=tn(t,d);if(!p)return;const{transitionEnd:g,transition:T,...P}=p;for(const x in P){let y=P[x];if(Array.isArray(y)){const v=u?y.length-1:0;y=y[v]}y!==null&&(i[x]=y)}for(const x in g)i[x]=g[x]}),i}const sr={useVisualState:Ws({scrapeMotionValuesFromProps:Hs,createRenderState:Us,onMount:(t,e,{renderState:n,latestValues:s})=>{try{n.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}Ye(n,s,{enableHardwareAcceleration:!1},Xe(e.tagName),t.transformTemplate),$s(e,n)}})},ir={useVisualState:Ws({scrapeMotionValuesFromProps:Qe,createRenderState:qe})};function or(t,{forwardMotionProps:e=!1},n,s){return{...Ke(t)?sr:ir,preloadedFeatures:n,useRender:Jo(e),createVisualElement:s,Component:t}}function $(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}const Gs=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function ie(t,e="page"){return{point:{x:t[e+"X"],y:t[e+"Y"]}}}const rr=t=>e=>Gs(e)&&t(e,ie(e));function H(t,e,n,s){return $(t,e,rr(n),s)}const ar=(t,e)=>n=>e(t(n)),X=(...t)=>t.reduce(ar);function Ks(t){let e=null;return()=>{const n=()=>{e=null};return e===null?(e=t,n):!1}}const Sn=Ks("dragHorizontal"),An=Ks("dragVertical");function Zs(t){let e=!1;if(t==="y")e=An();else if(t==="x")e=Sn();else{const n=Sn(),s=An();n&&s?e=()=>{n(),s()}:(n&&n(),s&&s())}return e}function qs(){const t=Zs(!0);return t?(t(),!1):!0}class tt{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Vn(t,e){const n="pointer"+(e?"enter":"leave"),s="onHover"+(e?"Start":"End"),i=(r,o)=>{if(r.type==="touch"||qs())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e),a[s]&&a[s](r,o)};return H(t.current,n,i,{passive:!t.getProps()[s]})}class cr extends tt{mount(){this.unmount=X(Vn(this.node,!0),Vn(this.node,!1))}unmount(){}}class lr extends tt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!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=X($(this.node.current,"focus",()=>this.onFocus()),$(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Ys=(t,e)=>e?t===e?!0:Ys(t,e.parentElement):!1,I=t=>t;function le(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,ie(n))}class ur extends tt{constructor(){super(...arguments),this.removeStartListeners=I,this.removeEndListeners=I,this.removeAccessibleListeners=I,this.startPointerPress=(e,n)=>{if(this.removeEndListeners(),this.isPressing)return;const s=this.node.getProps(),r=H(window,"pointerup",(a,c)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:u}=this.node.getProps();Ys(this.node.current,a.target)?l&&l(a,c):u&&u(a,c)},{passive:!(s.onTap||s.onPointerUp)}),o=H(window,"pointercancel",(a,c)=>this.cancelPress(a,c),{passive:!(s.onTapCancel||s.onPointerCancel)});this.removeEndListeners=X(r,o),this.startPress(e,n)},this.startAccessiblePress=()=>{const e=r=>{if(r.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||le("up",this.node.getProps().onTap)};this.removeEndListeners(),this.removeEndListeners=$(this.node.current,"keyup",o),le("down",(a,c)=>{this.startPress(a,c)})},n=$(this.node.current,"keydown",e),s=()=>{this.isPressing&&le("cancel",(r,o)=>this.cancelPress(r,o))},i=$(this.node.current,"blur",s);this.removeAccessibleListeners=X(n,i)}}startPress(e,n){this.isPressing=!0;const{onTapStart:s,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),s&&s(e,n)}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!qs()}cancelPress(e,n){if(!this.checkPressEnd())return;const{onTapCancel:s}=this.node.getProps();s&&s(e,n)}mount(){const e=this.node.getProps(),n=H(this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),s=$(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=X(n,s)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const Ve=new WeakMap,ue=new WeakMap,fr=t=>{const e=Ve.get(t.target);e&&e(t)},hr=t=>{t.forEach(fr)};function dr({root:t,...e}){const n=t||document;ue.has(n)||ue.set(n,{});const s=ue.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(hr,{root:t,...e})),s[i]}function pr(t,e,n){const s=dr(e);return Ve.set(t,n),s.observe(t),()=>{Ve.delete(t),s.unobserve(t)}}const mr={some:0,all:1};class gr extends tt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}viewportFallback(){requestAnimationFrame(()=>{this.hasEnteredView=!0;const{onViewportEnter:e}=this.node.getProps();e&&e(null),this.node.animationState&&this.node.animationState.setActive("whileInView",!0)})}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:r,fallback:o=!0}=e;if(typeof IntersectionObserver>"u"){o&&this.viewportFallback();return}const a={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:mr[i]},c=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,r&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:f,onViewportLeave:h}=this.node.getProps(),d=u?f:h;d&&d(l)};return pr(this.node.current,a,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(yr(e,n))&&this.startObserver()}unmount(){}}function yr({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const vr={inView:{Feature:gr},tap:{Feature:ur},focus:{Feature:lr},hover:{Feature:cr}};function Xs(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s/^\-?\d*\.?\d+$/.test(t),Pr=t=>/^0[^.\s]+$/.test(t),W={delta:0,timestamp:0},Js=1/60*1e3,br=typeof performance<"u"?()=>performance.now():()=>Date.now(),Qs=typeof window<"u"?t=>window.requestAnimationFrame(t):t=>setTimeout(()=>t(br()),Js);function Tr(t){let e=[],n=[],s=0,i=!1,r=!1;const o=new WeakSet,a={schedule:(c,l=!1,u=!1)=>{const f=u&&i,h=f?e:n;return l&&o.add(c),h.indexOf(c)===-1&&(h.push(c),f&&i&&(s=e.length)),c},cancel:c=>{const l=n.indexOf(c);l!==-1&&n.splice(l,1),o.delete(c)},process:c=>{if(i){r=!0;return}if(i=!0,[e,n]=[n,e],n.length=0,s=e.length,s)for(let l=0;l(t[e]=Tr(()=>Vt=!0),t),{}),R=Bt.reduce((t,e)=>{const n=oe[e];return t[e]=(s,i=!1,r=!1)=>(Vt||Ar(),n.schedule(s,i,r)),t},{}),J=Bt.reduce((t,e)=>(t[e]=oe[e].cancel,t),{}),fe=Bt.reduce((t,e)=>(t[e]=()=>oe[e].process(W),t),{}),Sr=t=>oe[t].process(W),ti=t=>{Vt=!1,W.delta=we?Js:Math.max(Math.min(t-W.timestamp,Cr),1),W.timestamp=t,Me=!0,Bt.forEach(Sr),Me=!1,Vt&&(we=!1,Qs(ti))},Ar=()=>{Vt=!0,we=!0,Me||Qs(ti)};function en(t,e){t.indexOf(e)===-1&&t.push(e)}function nn(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class sn{constructor(){this.subscriptions=[]}add(e){return en(this.subscriptions,e),()=>nn(this.subscriptions,e)}notify(e,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,s);else for(let r=0;r!isNaN(parseFloat(t));class wr{constructor(e,n={}){this.version="9.1.7",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(s,i=!0)=>{this.prev=this.current,this.current=s;const{delta:r,timestamp:o}=W;this.lastUpdated!==o&&(this.timeDelta=r,this.lastUpdated=o,R.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=()=>R.postRender(this.velocityCheck),this.velocityCheck=({timestamp:s})=>{s!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=Vr(this.current),this.owner=n.owner}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new sn);const s=this.events[e].add(n);return e==="change"?()=>{s(),R.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,s){this.set(n),this.prev=e,this.timeDelta=s}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?on(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n)||null,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(){this.animation=null}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function dt(t,e){return new wr(t,e)}const rn=(t,e)=>n=>Boolean(Lt(n)&&Oo.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),ei=(t,e,n)=>s=>{if(!Lt(s))return s;const[i,r,o,a]=s.match(At);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Mr=t=>ht(0,255,t),he={...rt,transform:t=>Math.round(Mr(t))},it={test:rn("rgb","red"),parse:ei("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+he.transform(t)+", "+he.transform(e)+", "+he.transform(n)+", "+xt(vt.transform(s))+")"};function Dr(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const De={test:rn("#"),parse:Dr,transform:it.transform},ut={test:rn("hsl","hue"),parse:ei("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+z.transform(xt(e))+", "+z.transform(xt(n))+", "+xt(vt.transform(s))+")"},E={test:t=>it.test(t)||De.test(t)||ut.test(t),parse:t=>it.test(t)?it.parse(t):ut.test(t)?ut.parse(t):De.parse(t),transform:t=>Lt(t)?t:t.hasOwnProperty("red")?it.transform(t):ut.transform(t)},ni="${c}",si="${n}";function Rr(t){var e,n;return isNaN(t)&&Lt(t)&&(((e=t.match(At))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Ae))===null||n===void 0?void 0:n.length)||0)>0}function Kt(t){typeof t=="number"&&(t=`${t}`);const e=[];let n=0,s=0;const i=t.match(Ae);i&&(n=i.length,t=t.replace(Ae,ni),e.push(...i.map(E.parse)));const r=t.match(At);return r&&(s=r.length,t=t.replace(At,si),e.push(...r.map(rt.parse))),{values:e,numColors:n,numNumbers:s,tokenised:t}}function ii(t){return Kt(t).values}function oi(t){const{values:e,numColors:n,tokenised:s}=Kt(t),i=e.length;return r=>{let o=s;for(let a=0;atypeof t=="number"?0:t;function Lr(t){const e=ii(t);return oi(t)(e.map(Er))}const Q={test:Rr,parse:ii,createTransformer:oi,getAnimatableNone:Lr},jr=new Set(["brightness","contrast","saturate","opacity"]);function Br(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[s]=n.match(At)||[];if(!s)return t;const i=n.replace(s,"");let r=jr.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const kr=/([a-z-]*)\(.*?\)/g,Re={...Q,getAnimatableNone:t=>{const e=t.match(kr);return e?e.map(Br).join(" "):t}},Fr={...Is,color:E,backgroundColor:E,outlineColor:E,fill:E,stroke:E,borderColor:E,borderTopColor:E,borderRightColor:E,borderBottomColor:E,borderLeftColor:E,filter:Re,WebkitFilter:Re},an=t=>Fr[t];function cn(t,e){let n=an(t);return n!==Re&&(n=Q),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ri=t=>e=>e.test(t),Ir={test:t=>t==="auto",parse:t=>t},ai=[rt,b,z,q,Uo,No,Ir],pt=t=>ai.find(ri(t)),Or=[...ai,E,Q],Nr=t=>Or.find(ri(t));function Ur(t){const e={};return t.values.forEach((n,s)=>e[s]=n.get()),e}function _r(t){const e={};return t.values.forEach((n,s)=>e[s]=n.getVelocity()),e}function re(t,e,n){const s=t.getProps();return tn(s,e,n!==void 0?n:s.custom,Ur(t),_r(t))}function zr(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,dt(n))}function $r(t,e){const n=re(t,e);let{transitionEnd:s={},transition:i={},...r}=n?t.makeTargetAnimatable(n,!1):{};r={...r,...s};for(const o in r){const a=tr(r[o]);zr(t,o,a)}}function Hr(t,e,n){var s,i;const r=Object.keys(e).filter(a=>!t.hasValue(a)),o=r.length;if(o)for(let a=0;at*1e3,Yr={current:!1},ln=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,un=t=>e=>1-t(1-e),fn=t=>t*t,Xr=un(fn),hn=ln(fn),A=(t,e,n)=>-n*t+n*e+t;function de(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Jr({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,e/=100,n/=100;let i=0,r=0,o=0;if(!e)i=r=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,c=2*n-a;i=de(c,a,t+1/3),r=de(c,a,t),o=de(c,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(r*255),blue:Math.round(o*255),alpha:s}}const pe=(t,e,n)=>{const s=t*t;return Math.sqrt(Math.max(0,n*(e*e-s)+s))},Qr=[De,it,ut],ta=t=>Qr.find(e=>e.test(t));function wn(t){const e=ta(t);let n=e.parse(t);return e===ut&&(n=Jr(n)),n}const ci=(t,e)=>{const n=wn(t),s=wn(e),i={...n};return r=>(i.red=pe(n.red,s.red,r),i.green=pe(n.green,s.green,r),i.blue=pe(n.blue,s.blue,r),i.alpha=A(n.alpha,s.alpha,r),it.transform(i))};function li(t,e){return typeof t=="number"?n=>A(t,e,n):E.test(t)?ci(t,e):fi(t,e)}const ui=(t,e)=>{const n=[...t],s=n.length,i=t.map((r,o)=>li(r,e[o]));return r=>{for(let o=0;o{const n={...t,...e},s={};for(const i in n)t[i]!==void 0&&e[i]!==void 0&&(s[i]=li(t[i],e[i]));return i=>{for(const r in s)n[r]=s[r](i);return n}},fi=(t,e)=>{const n=Q.createTransformer(e),s=Kt(t),i=Kt(e);return s.numColors===i.numColors&&s.numNumbers>=i.numNumbers?X(ui(s.values,i.values),n):o=>`${o>0?e:t}`},wt=(t,e,n)=>{const s=e-t;return s===0?1:(n-t)/s},Mn=(t,e)=>n=>A(t,e,n);function na(t){return typeof t=="number"?Mn:typeof t=="string"?E.test(t)?ci:fi:Array.isArray(t)?ui:typeof t=="object"?ea:Mn}function sa(t,e,n){const s=[],i=n||na(t[0]),r=t.length-1;for(let o=0;ot[r-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=sa(e,s,i),a=o.length,c=l=>{let u=0;if(a>1)for(;uc(ht(t[0],t[r-1],l)):c}function ia(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=wt(0,e,s);t.push(A(n,1,i))}}function oa(t){const e=[0];return ia(e,t.length-1),e}function ra(t,e){return t.map(n=>n*e)}const di=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,aa=1e-7,ca=12;function la(t,e,n,s,i){let r,o,a=0;do o=e+(n-e)/2,r=di(o,s,i)-t,r>0?n=o:e=o;while(Math.abs(r)>aa&&++ala(r,0,1,t,n);return r=>r===0||r===1?r:di(i(r),e,s)}const mi=t=>1-Math.sin(Math.acos(t)),dn=un(mi),ua=ln(dn),gi=pi(.33,1.53,.69,.99),pn=un(gi),fa=ln(pn),ha=t=>(t*=2)<1?.5*pn(t):.5*(2-Math.pow(2,-10*(t-1))),da={linear:I,easeIn:fn,easeInOut:hn,easeOut:Xr,circIn:mi,circInOut:ua,circOut:dn,backIn:pn,backInOut:fa,backOut:gi,anticipate:ha},Dn=t=>{if(Array.isArray(t)){qt(t.length===4);const[e,n,s,i]=t;return pi(e,n,s,i)}else if(typeof t=="string")return da[t];return t},pa=t=>Array.isArray(t)&&typeof t[0]!="number";function ma(t,e){return t.map(()=>e||hn).splice(0,t.length-1)}function Ee({keyframes:t,ease:e=hn,times:n,duration:s=300}){t=[...t];const i=pa(e)?e.map(Dn):Dn(e),r={done:!1,value:t[0]},o=ra(n&&n.length===t.length?n:oa(t),s);function a(){return hi(o,t,{ease:Array.isArray(i)?i:ma(t,i)})}let c=a();return{next:l=>(r.value=c(l),r.done=l>=s,r),flipTarget:()=>{t.reverse(),c=a()}}}const me=.001,ga=.01,Rn=10,ya=.05,va=1;function xa({duration:t=800,bounce:e=.25,velocity:n=0,mass:s=1}){let i,r;qr(t<=Rn*1e3);let o=1-e;o=ht(ya,va,o),t=ht(ga,Rn,t/1e3),o<1?(i=l=>{const u=l*o,f=u*t,h=u-n,d=Le(l,o),p=Math.exp(-f);return me-h/d*p},r=l=>{const f=l*o*t,h=f*n+n,d=Math.pow(o,2)*Math.pow(l,2)*t,p=Math.exp(-f),g=Le(Math.pow(l,2),o);return(-i(l)+me>0?-1:1)*((h-d)*p)/g}):(i=l=>{const u=Math.exp(-l*t),f=(l-n)*t+1;return-me+u*f},r=l=>{const u=Math.exp(-l*t),f=(n-l)*(t*t);return u*f});const a=5/t,c=ba(i,r,a);if(t=t*1e3,isNaN(c))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(c,2)*s;return{stiffness:l,damping:o*2*Math.sqrt(s*l),duration:t}}}const Pa=12;function ba(t,e,n){let s=n;for(let i=1;it[n]!==void 0)}function Sa(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!En(t,Ca)&&En(t,Ta)){const n=xa(t);e={...e,...n,velocity:0,mass:1},e.isResolvedFromDuration=!0}return e}const Aa=5;function yi({keyframes:t,restDelta:e,restSpeed:n,...s}){let i=t[0],r=t[t.length-1];const o={done:!1,value:i},{stiffness:a,damping:c,mass:l,velocity:u,duration:f,isResolvedFromDuration:h}=Sa(s);let d=Va,p=u?-(u/1e3):0;const g=c/(2*Math.sqrt(a*l));function T(){const P=r-i,x=Math.sqrt(a/l)/1e3,y=Math.abs(P)<5;if(n||(n=y?.01:2),e||(e=y?.005:.5),g<1){const v=Le(x,g);d=S=>{const w=Math.exp(-g*x*S);return r-w*((p+g*x*P)/v*Math.sin(v*S)+P*Math.cos(v*S))}}else if(g===1)d=v=>r-Math.exp(-x*v)*(P+(p+x*P)*v);else{const v=x*Math.sqrt(g*g-1);d=S=>{const w=Math.exp(-g*x*S),D=Math.min(v*S,300);return r-w*((p+g*x*P)*Math.sinh(D)+v*P*Math.cosh(D))/v}}}return T(),{next:P=>{const x=d(P);if(h)o.done=P>=f;else{let y=p;if(P!==0)if(g<1){const w=Math.max(0,P-Aa);y=on(x-d(w),P-w)}else y=0;const v=Math.abs(y)<=n,S=Math.abs(r-x)<=e;o.done=v&&S}return o.value=o.done?r:x,o},flipTarget:()=>{p=-p,[i,r]=[r,i],T()}}}yi.needsInterpolation=(t,e)=>typeof t=="string"||typeof e=="string";const Va=t=>0;function wa({keyframes:t=[0],velocity:e=0,power:n=.8,timeConstant:s=350,restDelta:i=.5,modifyTarget:r}){const o=t[0],a={done:!1,value:o};let c=n*e;const l=o+c,u=r===void 0?l:r(l);return u!==l&&(c=u-o),{next:f=>{const h=-c*Math.exp(-f/s);return a.done=!(h>i||h<-i),a.value=a.done?u:u+h,a},flipTarget:()=>{}}}const Ma={decay:wa,keyframes:Ee,tween:Ee,spring:yi};function vi(t,e,n=0){return t-e-n}function Da(t,e=0,n=0,s=!0){return s?vi(e+-t,e,n):e-(t-e)+n}function Ra(t,e,n,s){return s?t>=e+n:t<=-n}const Ea=t=>{const e=({delta:n})=>t(n);return{start:()=>R.update(e,!0),stop:()=>J.update(e)}};function Yt({duration:t,driver:e=Ea,elapsed:n=0,repeat:s=0,repeatType:i="loop",repeatDelay:r=0,keyframes:o,autoplay:a=!0,onPlay:c,onStop:l,onComplete:u,onRepeat:f,onUpdate:h,type:d="keyframes",...p}){const g=n;let T,P=0,x=t,y=!1,v=!0,S;const w=Ma[o.length>2?"keyframes":d]||Ee,D=o[0],N=o[o.length-1];let k={done:!1,value:D};const{needsInterpolation:O}=w;O&&O(D,N)&&(S=hi([0,100],[D,N],{clamp:!1}),o=[0,100]);const K=w({...p,duration:t,keyframes:o});function Ft(){P++,i==="reverse"?(v=P%2===0,n=Da(n,x,r,v)):(n=vi(n,x,r),i==="mirror"&&K.flipTarget()),y=!1,f&&f()}function ae(){T&&T.stop(),u&&u()}function Z(L){v||(L=-L),n+=L,y||(k=K.next(Math.max(0,n)),S&&(k.value=S(k.value)),y=v?k.done:n<=0),h&&h(k.value),y&&(P===0&&(x=x!==void 0?x:n),P{l&&l(),T&&T.stop()},set currentTime(L){n=g,Z(L)},sample:L=>{n=g;const at=t&&typeof t=="number"?Math.max(t*.5,50):50;let ce=0;for(Z(0);ce<=L;){const Xi=L-ce;Z(Math.min(Xi,at)),ce+=at}return k}}}function La(t){return!t||Array.isArray(t)||typeof t=="string"&&xi[t]}const gt=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,xi={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:gt([0,.65,.55,1]),circOut:gt([.55,0,1,.45]),backIn:gt([.31,.01,.66,-.59]),backOut:gt([.33,1.53,.69,.99])};function ja(t){if(t)return Array.isArray(t)?gt(t):xi[t]}function Ba(t,e,n,{delay:s=0,duration:i,repeat:r=0,repeatType:o="loop",ease:a,times:c}={}){return t.animate({[e]:n,offset:c},{delay:s,duration:i,easing:ja(a),fill:"both",iterations:r+1,direction:o==="reverse"?"alternate":"normal"})}const Ln={waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate")},ge={},Pi={};for(const t in Ln)Pi[t]=()=>(ge[t]===void 0&&(ge[t]=Ln[t]()),ge[t]);function ka(t,{repeat:e,repeatType:n="loop"}){const s=e&&n!=="loop"&&e%2===1?0:t.length-1;return t[s]}const Fa=new Set(["opacity","clipPath","filter","transform"]),Ot=10;function Ia(t,e,{onUpdate:n,onComplete:s,...i}){if(!(Pi.waapi()&&Fa.has(e)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0))return!1;let{keyframes:o,duration:a=300,elapsed:c=0,ease:l}=i;if(i.type==="spring"||!La(i.ease)){if(i.repeat===1/0)return;const f=Yt({...i,elapsed:0});let h={done:!1,value:o[0]};const d=[];let p=0;for(;!h.done&&p<2e4;)h=f.sample(p),d.push(h.value),p+=Ot;o=d,a=p-Ot,l="linear"}const u=Ba(t.owner.current,e,o,{...i,delay:-c,duration:a,ease:l});return u.onfinish=()=>{t.set(ka(o,i)),R.update(()=>u.cancel()),s&&s()},{get currentTime(){return u.currentTime||0},set currentTime(f){u.currentTime=f},stop:()=>{const{currentTime:f}=u;if(f){const h=Yt({...i,autoplay:!1});t.setWithVelocity(h.sample(f-Ot).value,h.sample(f).value,Ot)}R.update(()=>u.cancel())}}}function bi(t,e){const n=performance.now(),s=({timestamp:i})=>{const r=i-n;r>=e&&(J.read(s),t(r-e))};return R.read(s,!0),()=>J.read(s)}function Oa({keyframes:t,elapsed:e,onUpdate:n,onComplete:s}){const i=()=>{n&&n(t[t.length-1]),s&&s()};return e?{stop:bi(i,-e)}:i()}function Na({keyframes:t,velocity:e=0,min:n,max:s,power:i=.8,timeConstant:r=750,bounceStiffness:o=500,bounceDamping:a=10,restDelta:c=1,modifyTarget:l,driver:u,onUpdate:f,onComplete:h,onStop:d}){const p=t[0];let g;function T(v){return n!==void 0&&vs}function P(v){return n===void 0?s:s===void 0||Math.abs(n-v){f&&f(S),v.onUpdate&&v.onUpdate(S)},onComplete:h,onStop:d})}function y(v){x({type:"spring",stiffness:o,damping:a,restDelta:c,...v})}if(T(p))y({velocity:e,keyframes:[p,P(p)]});else{let v=i*e+p;typeof l<"u"&&(v=l(v));const S=P(v),w=S===n?-1:1;let D,N;const k=O=>{D=N,N=O,e=on(O-D,W.delta),(w===1&&O>S||w===-1&&Og&&g.stop()}}const Ua={type:"spring",stiffness:500,damping:25,restSpeed:10},_a=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),za={type:"keyframes",duration:.8},$a={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ha=(t,{keyframes:e})=>e.length>2?za:ot.has(t)?t.startsWith("scale")?_a(e[1]):Ua:$a,je=(t,e)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&Q.test(e)&&!e.startsWith("url("));function Wa({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:o,repeatDelay:a,from:c,elapsed:l,...u}){return!!Object.keys(u).length}function jn(t){return t===0||typeof t=="string"&&parseFloat(t)===0&&t.indexOf(" ")===-1}function Bn(t){return typeof t=="number"?0:cn("",t)}function Ti(t,e){return t[e]||t.default||t}function Ga(t,e,n,s){const i=je(e,n);let r=s.from!==void 0?s.from:t.get();return r==="none"&&i&&typeof n=="string"?r=cn(e,n):jn(r)&&typeof n=="string"?r=Bn(n):!Array.isArray(n)&&jn(n)&&typeof r=="string"&&(n=Bn(r)),Array.isArray(n)?(n[0]===null&&(n[0]=r),n):[r,n]}const mn=(t,e,n,s={})=>i=>{const r=Ti(s,t)||{},o=r.delay||s.delay||0;let{elapsed:a=0}=s;a=a-_t(o);const c=Ga(e,t,n,r),l=c[0],u=c[c.length-1],f=je(t,l),h=je(t,u);let d={keyframes:c,velocity:e.getVelocity(),...r,elapsed:a,onUpdate:p=>{e.set(p),r.onUpdate&&r.onUpdate(p)},onComplete:()=>{i(),r.onComplete&&r.onComplete()}};if(!f||!h||Yr.current||r.type===!1)return Oa(d);if(r.type==="inertia")return Na(d);if(Wa(r)||(d={...d,...Ha(t,d)}),d.duration&&(d.duration=_t(d.duration)),d.repeatDelay&&(d.repeatDelay=_t(d.repeatDelay)),e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate){const p=Ia(e,t,d);if(p)return p}return Yt(d)};function Ka(t,e,n={}){t.notify("AnimationStart",e);let s;if(Array.isArray(e)){const i=e.map(r=>Be(t,r,n));s=Promise.all(i)}else if(typeof e=="string")s=Be(t,e,n);else{const i=typeof e=="function"?re(t,e,n.custom):e;s=Ci(t,i,n)}return s.then(()=>t.notify("AnimationComplete",e))}function Be(t,e,n={}){const s=re(t,e,n.custom);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const r=s?()=>Ci(t,s,n):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:l=0,staggerChildren:u,staggerDirection:f}=i;return Za(t,e,l+c,u,f,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[c,l]=a==="beforeChildren"?[r,o]:[o,r];return c().then(l)}else return Promise.all([r(),o(n.delay)])}function Ci(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:r=t.getDefaultTransition(),transitionEnd:o,...a}=t.makeTargetAnimatable(e);const c=t.getValue("willChange");s&&(r=s);const l=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const f in a){const h=t.getValue(f),d=a[f];if(!h||d===void 0||u&&Ya(u,f))continue;const p={delay:n,elapsed:0,...r};if(window.HandoffAppearAnimations&&!h.hasAnimated){const T=t.getProps()[Zr];T&&(p.elapsed=window.HandoffAppearAnimations(T,f,h,R))}let g=h.start(mn(f,h,d,t.shouldReduceMotion&&ot.has(f)?{type:!1}:p));Zt(c)&&(c.add(f),g=g.then(()=>c.remove(f))),l.push(g)}return Promise.all(l).then(()=>{o&&$r(t,o)})}function Za(t,e,n=0,s=0,i=1,r){const o=[],a=(t.variantChildren.size-1)*s,c=i===1?(l=0)=>l*s:(l=0)=>a-l*s;return Array.from(t.variantChildren).sort(qa).forEach((l,u)=>{l.notify("AnimationStart",e),o.push(Be(l,e,{...r,delay:n+c(u)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function qa(t,e){return t.sortNodePosition(e)}function Ya({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,s}const Xa=[...$e].reverse(),Ja=$e.length;function Qa(t){return e=>Promise.all(e.map(({animation:n,options:s})=>Ka(t,n,s)))}function tc(t){let e=Qa(t);const n=nc();let s=!0;const i=(c,l)=>{const u=re(t,l);if(u){const{transition:f,transitionEnd:h,...d}=u;c={...c,...d,...h}}return c};function r(c){e=c(t)}function o(c,l){const u=t.getProps(),f=t.getVariantContext(!0)||{},h=[],d=new Set;let p={},g=1/0;for(let P=0;Pg&&S;const O=Array.isArray(v)?v:[v];let K=O.reduce(i,{});w===!1&&(K={});const{prevResolvedValues:Ft={}}=y,ae={...Ft,...K},Z=M=>{k=!0,d.delete(M),y.needsAnimating[M]=!0};for(const M in ae){const L=K[M],at=Ft[M];p.hasOwnProperty(M)||(L!==at?Gt(L)&&Gt(at)?!Xs(L,at)||N?Z(M):y.protectedKeys[M]=!0:L!==void 0?Z(M):d.add(M):L!==void 0&&d.has(M)?Z(M):y.protectedKeys[M]=!0)}y.prevProp=v,y.prevResolvedValues=K,y.isActive&&(p={...p,...K}),s&&t.blockInitialAnimation&&(k=!1),k&&!D&&h.push(...O.map(M=>({animation:M,options:{type:x,...c}})))}if(d.size){const P={};d.forEach(x=>{const y=t.getBaseTarget(x);y!==void 0&&(P[x]=y)}),h.push({animation:P})}let T=Boolean(h.length);return s&&u.initial===!1&&!t.manuallyAnimateOnMount&&(T=!1),s=!1,T?e(h):Promise.resolve()}function a(c,l,u){var f;if(n[c].isActive===l)return Promise.resolve();(f=t.variantChildren)===null||f===void 0||f.forEach(d=>{var p;return(p=d.animationState)===null||p===void 0?void 0:p.setActive(c,l)}),n[c].isActive=l;const h=o(u,c);for(const d in n)n[d].protectedKeys={};return h}return{animateChanges:o,setActive:a,setAnimateFunction:r,getState:()=>n}}function ec(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Xs(e,t):!1}function et(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function nc(){return{animate:et(!0),whileInView:et(),whileHover:et(),whileTap:et(),whileDrag:et(),whileFocus:et(),exit:et()}}class sc extends tt{constructor(e){super(e),e.animationState||(e.animationState=tc(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),ee(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let ic=0;class oc extends tt{constructor(){super(...arguments),this.id=ic++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n,custom:s}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const r=this.node.animationState.setActive("exit",!e,{custom:s??this.node.getProps().custom});n&&!e&&r.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const rc={animation:{Feature:sc},exit:{Feature:oc}},kn=(t,e)=>Math.abs(t-e);function ac(t,e){const n=kn(t.x,e.x),s=kn(t.y,e.y);return Math.sqrt(n**2+s**2)}class Si{constructor(e,n,{transformPagePoint:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const l=ve(this.lastMoveEventInfo,this.history),u=this.startEvent!==null,f=ac(l.offset,{x:0,y:0})>=3;if(!u&&!f)return;const{point:h}=l,{timestamp:d}=W;this.history.push({...h,timestamp:d});const{onStart:p,onMove:g}=this.handlers;u||(p&&p(this.lastMoveEvent,l),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,l)},this.handlePointerMove=(l,u)=>{this.lastMoveEvent=l,this.lastMoveEventInfo=ye(u,this.transformPagePoint),R.update(this.updatePoint,!0)},this.handlePointerUp=(l,u)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:f,onSessionEnd:h}=this.handlers,d=ve(l.type==="pointercancel"?this.lastMoveEventInfo:ye(u,this.transformPagePoint),this.history);this.startEvent&&f&&f(l,d),h&&h(l,d)},!Gs(e))return;this.handlers=n,this.transformPagePoint=s;const i=ie(e),r=ye(i,this.transformPagePoint),{point:o}=r,{timestamp:a}=W;this.history=[{...o,timestamp:a}];const{onSessionStart:c}=n;c&&c(e,ve(r,this.history)),this.removeListeners=X(H(window,"pointermove",this.handlePointerMove),H(window,"pointerup",this.handlePointerUp),H(window,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),J.update(this.updatePoint)}}function ye(t,e){return e?{point:e(t.point)}:t}function Fn(t,e){return{x:t.x-e.x,y:t.y-e.y}}function ve({point:t},e){return{point:t,delta:Fn(t,Ai(e)),offset:Fn(t,cc(e)),velocity:lc(e,.1)}}function cc(t){return t[0]}function Ai(t){return t[t.length-1]}function lc(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const i=Ai(t);for(;n>=0&&(s=t[n],!(i.timestamp-s.timestamp>_t(e)));)n--;if(!s)return{x:0,y:0};const r=(i.timestamp-s.timestamp)/1e3;if(r===0)return{x:0,y:0};const o={x:(i.x-s.x)/r,y:(i.y-s.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function B(t){return t.max-t.min}function ke(t,e=0,n=.01){return Math.abs(t-e)<=n}function In(t,e,n,s=.5){t.origin=s,t.originPoint=A(e.min,e.max,t.origin),t.scale=B(n)/B(e),(ke(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=A(n.min,n.max,t.origin)-t.originPoint,(ke(t.translate)||isNaN(t.translate))&&(t.translate=0)}function Pt(t,e,n,s){In(t.x,e.x,n.x,s?s.originX:void 0),In(t.y,e.y,n.y,s?s.originY:void 0)}function On(t,e,n){t.min=n.min+e.min,t.max=t.min+B(e)}function uc(t,e,n){On(t.x,e.x,n.x),On(t.y,e.y,n.y)}function Nn(t,e,n){t.min=e.min-n.min,t.max=t.min+B(e)}function bt(t,e,n){Nn(t.x,e.x,n.x),Nn(t.y,e.y,n.y)}function fc(t,{min:e,max:n},s){return e!==void 0&&tn&&(t=s?A(n,t,s.max):Math.min(t,n)),t}function Un(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function hc(t,{top:e,left:n,bottom:s,right:i}){return{x:Un(t.x,n,i),y:Un(t.y,e,s)}}function _n(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.mins?n=wt(e.min,e.max-s,t.min):s>i&&(n=wt(t.min,t.max-i,e.min)),ht(0,1,n)}function mc(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Fe=.35;function gc(t=Fe){return t===!1?t=0:t===!0&&(t=Fe),{x:zn(t,"left","right"),y:zn(t,"top","bottom")}}function zn(t,e,n){return{min:$n(t,e),max:$n(t,n)}}function $n(t,e){return typeof t=="number"?t:t[e]||0}const Hn=()=>({translate:0,scale:1,origin:0,originPoint:0}),Tt=()=>({x:Hn(),y:Hn()}),Wn=()=>({min:0,max:0}),V=()=>({x:Wn(),y:Wn()});function U(t){return[t("x"),t("y")]}function Vi({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function yc({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function vc(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function xe(t){return t===void 0||t===1}function Ie({scale:t,scaleX:e,scaleY:n}){return!xe(t)||!xe(e)||!xe(n)}function nt(t){return Ie(t)||wi(t)||t.z||t.rotate||t.rotateX||t.rotateY}function wi(t){return Gn(t.x)||Gn(t.y)}function Gn(t){return t&&t!=="0%"}function Xt(t,e,n){const s=t-n,i=e*s;return n+i}function Kn(t,e,n,s,i){return i!==void 0&&(t=Xt(t,i,s)),Xt(t,n,s)+e}function Oe(t,e=0,n=1,s,i){t.min=Kn(t.min,e,n,s,i),t.max=Kn(t.max,e,n,s,i)}function Mi(t,{x:e,y:n}){Oe(t.x,e.translate,e.scale,e.originPoint),Oe(t.y,n.translate,n.scale,n.originPoint)}function xc(t,e,n,s=!1){const i=n.length;if(!i)return;e.x=e.y=1;let r,o;for(let a=0;a1.0000000000001||t<.999999999999?t:1}function Y(t,e){t.min=t.min+e,t.max=t.max+e}function qn(t,e,[n,s,i]){const r=e[i]!==void 0?e[i]:.5,o=A(t.min,t.max,r);Oe(t,e[n],e[s],o,e.scale)}const Pc=["x","scaleX","originX"],bc=["y","scaleY","originY"];function ft(t,e){qn(t.x,e,Pc),qn(t.y,e,bc)}function Di(t,e){return Vi(vc(t.getBoundingClientRect(),e))}function Tc(t,e,n){const s=Di(t,n),{scroll:i}=e;return i&&(Y(s.x,i.offset.x),Y(s.y,i.offset.y)),s}const Cc=new WeakMap;class Sc{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=V(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=c=>{this.stopAnimation(),n&&this.snapToCursor(ie(c,"page").point)},r=(c,l)=>{const{drag:u,dragPropagation:f,onDragStart:h}=this.getProps();if(u&&!f&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Zs(u),!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),U(p=>{let g=this.getAxisMotionValue(p).get()||0;if(z.test(g)){const{projection:T}=this.visualElement;if(T&&T.layout){const P=T.layout.layoutBox[p];P&&(g=B(P)*(parseFloat(g)/100))}}this.originPoint[p]=g}),h&&h(c,l);const{animationState:d}=this.visualElement;d&&d.setActive("whileDrag",!0)},o=(c,l)=>{const{dragPropagation:u,dragDirectionLock:f,onDirectionLock:h,onDrag:d}=this.getProps();if(!u&&!this.openGlobalLock)return;const{offset:p}=l;if(f&&this.currentDirection===null){this.currentDirection=Ac(p),this.currentDirection!==null&&h&&h(this.currentDirection);return}this.updateAxis("x",l.point,p),this.updateAxis("y",l.point,p),this.visualElement.render(),d&&d(c,l)},a=(c,l)=>this.stop(c,l);this.panSession=new Si(e,{onSessionStart:i,onStart:r,onMove:o,onSessionEnd:a},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(e,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:r}=this.getProps();r&&r(e,n)}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,s){const{drag:i}=this.getProps();if(!s||!Nt(e,i,this.currentDirection))return;const r=this.getAxisMotionValue(e);let o=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(o=fc(o,this.constraints[e],this.elastic[e])),r.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),{layout:s}=this.visualElement.projection||{},i=this.constraints;e&<(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=hc(s.layoutBox,e):this.constraints=!1,this.elastic=gc(n),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&U(r=>{this.getAxisMotionValue(r)&&(this.constraints[r]=mc(s.layoutBox[r],this.constraints[r]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!lt(e))return!1;const s=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const r=Tc(s,i.root,this.visualElement.getTransformPagePoint());let o=dc(i.layout.layoutBox,r);if(n){const a=n(yc(o));this.hasMutatedConstraints=!!a,a&&(o=Vi(a))}return o}startAnimation(e){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:r,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},l=U(u=>{if(!Nt(u,n,this.currentDirection))return;let f=c&&c[u]||{};o&&(f={min:0,max:0});const h=i?200:1e6,d=i?40:1e7,p={type:"inertia",velocity:s?e[u]:0,bounceStiffness:h,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...r,...f};return this.startAxisValueAnimation(u,p)});return Promise.all(l).then(a)}startAxisValueAnimation(e,n){const s=this.getAxisMotionValue(e);return s.start(mn(e,s,0,n))}stopAnimation(){U(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n="_drag"+e.toUpperCase(),s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){U(n=>{const{drag:s}=this.getProps();if(!Nt(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,r=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[n];r.set(e[n]-A(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!lt(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};U(o=>{const a=this.getAxisMotionValue(o);if(a){const c=a.get();i[o]=pc({min:c,max:c},this.constraints[o])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),U(o=>{if(!Nt(o,e,null))return;const a=this.getAxisMotionValue(o),{min:c,max:l}=this.constraints[o];a.set(A(c,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;Cc.set(this.visualElement,this);const e=this.visualElement.current,n=H(e,"pointerdown",c=>{const{drag:l,dragListener:u=!0}=this.getProps();l&&u&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();lt(c)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,r=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),s();const o=$(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:l})=>{this.isDragging&&l&&(U(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=c[u].translate,f.set(f.get()+c[u].translate))}),this.visualElement.render())});return()=>{o(),n(),r(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:r=!1,dragElastic:o=Fe,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:r,dragElastic:o,dragMomentum:a}}}function Nt(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Ac(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class Vc extends tt{constructor(e){super(e),this.removeGroupControls=I,this.removeListeners=I,this.controls=new Sc(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||I}unmount(){this.removeGroupControls(),this.removeListeners()}}class wc extends tt{constructor(){super(...arguments),this.removePointerDownListener=I}onPointerDown(e){this.session=new Si(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:e,onStart:n,onMove:s,onEnd:(r,o)=>{delete this.session,i&&i(r,o)}}}mount(){this.removePointerDownListener=H(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function Mc(){const t=m.useContext(Et);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:n,register:s}=t,i=m.useId();return m.useEffect(()=>s(i),[]),!e&&n?[!1,()=>n&&n(i)]:[!0]}function Dc(){return Rc(m.useContext(Et))}function Rc(t){return t===null?!0:t.isPresent}function Yn(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const mt={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(b.test(t))t=parseFloat(t);else return t;const n=Yn(t,e.target.x),s=Yn(t,e.target.y);return`${n}% ${s}%`}},Ri=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Ec(t){const e=Ri.exec(t);if(!e)return[,];const[,n,s]=e;return[n,s]}function Ne(t,e,n=1){const[s,i]=Ec(t);if(!s)return;const r=window.getComputedStyle(e).getPropertyValue(s);return r?r.trim():Se(i)?Ne(i,e,n+1):i}function Lc(t,{...e},n){const s=t.current;if(!(s instanceof Element))return{target:e,transitionEnd:n};n&&(n={...n}),t.values.forEach(i=>{const r=i.get();if(!Se(r))return;const o=Ne(r,s);o&&i.set(o)});for(const i in e){const r=e[i];if(!Se(r))continue;const o=Ne(r,s);o&&(e[i]=o,n&&n[i]===void 0&&(n[i]=r))}return{target:e,transitionEnd:n}}const Xn="_$css",jc={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,i=t.includes("var("),r=[];i&&(t=t.replace(Ri,d=>(r.push(d),Xn)));const o=Q.parse(t);if(o.length>5)return s;const a=Q.createTransformer(t),c=typeof o[0]!="number"?1:0,l=n.x.scale*e.x,u=n.y.scale*e.y;o[0+c]/=l,o[1+c]/=u;const f=A(l,u,.5);typeof o[2+c]=="number"&&(o[2+c]/=f),typeof o[3+c]=="number"&&(o[3+c]/=f);let h=a(o);if(i){let d=0;h=h.replace(Xn,()=>{const p=r[d];return d++,p})}return h}};class Bc extends Ss.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:r}=e;jo(kc),r&&(n.group&&n.group.add(r),s&&s.register&&i&&s.register(r),r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),yt.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:s,drag:i,isPresent:r}=this.props,o=s.projection;return o&&(o.isPresent=r,i||e.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==r&&(r?o.promote():o.relegate()||R.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),!e.currentAnimation&&e.isLead()&&this.safeToRemove())}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Ei(t){const[e,n]=Mc(),s=m.useContext(Ge);return Ss.createElement(Bc,{...t,layoutGroup:s,switchLayoutGroup:m.useContext(js),isPresent:e,safeToRemove:n})}const kc={borderRadius:{...mt,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:mt,borderTopRightRadius:mt,borderBottomLeftRadius:mt,borderBottomRightRadius:mt,boxShadow:jc};function Fc(t,e,n={}){const s=j(t)?t:dt(t);return s.start(mn("",s,e,n)),{stop:()=>s.stop(),isAnimating:()=>s.isAnimating()}}const Li=["TopLeft","TopRight","BottomLeft","BottomRight"],Ic=Li.length,Jn=t=>typeof t=="string"?parseFloat(t):t,Qn=t=>typeof t=="number"||b.test(t);function Oc(t,e,n,s,i,r){i?(t.opacity=A(0,n.opacity!==void 0?n.opacity:1,Nc(s)),t.opacityExit=A(e.opacity!==void 0?e.opacity:1,0,Uc(s))):r&&(t.opacity=A(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,s));for(let o=0;ose?1:n(wt(t,e,s))}function es(t,e){t.min=e.min,t.max=e.max}function F(t,e){es(t.x,e.x),es(t.y,e.y)}function ns(t,e,n,s,i){return t-=e,t=Xt(t,1/n,s),i!==void 0&&(t=Xt(t,1/i,s)),t}function _c(t,e=0,n=1,s=.5,i,r=t,o=t){if(z.test(e)&&(e=parseFloat(e),e=A(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=A(r.min,r.max,s);t===r&&(a-=e),t.min=ns(t.min,e,n,a,i),t.max=ns(t.max,e,n,a,i)}function ss(t,e,[n,s,i],r,o){_c(t,e[n],e[s],e[i],e.scale,r,o)}const zc=["x","scaleX","originX"],$c=["y","scaleY","originY"];function is(t,e,n,s){ss(t.x,e,zc,n?n.x:void 0,s?s.x:void 0),ss(t.y,e,$c,n?n.y:void 0,s?s.y:void 0)}function os(t){return t.translate===0&&t.scale===1}function Bi(t){return os(t.x)&&os(t.y)}function Ue(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function rs(t){return B(t.x)/B(t.y)}class Hc{constructor(){this.members=[]}add(e){en(this.members,e),e.scheduleRender()}remove(e){if(nn(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(i=>e===i);if(n===0)return!1;let s;for(let i=n;i>=0;i--){const r=this.members[i];if(r.isPresent!==!1){s=r;break}}return s?(this.promote(s),!0):!1}promote(e,n){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender(),e.resumeFrom=s,n&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:s}=e;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function as(t,e,n){let s="";const i=t.x.translate/e.x,r=t.y.translate/e.y;if((i||r)&&(s=`translate3d(${i}px, ${r}px, 0) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),n){const{rotate:c,rotateX:l,rotateY:u}=n;c&&(s+=`rotate(${c}deg) `),l&&(s+=`rotateX(${l}deg) `),u&&(s+=`rotateY(${u}deg) `)}const o=t.x.scale*e.x,a=t.y.scale*e.y;return(o!==1||a!==1)&&(s+=`scale(${o}, ${a})`),s||"none"}const Wc=(t,e)=>t.depth-e.depth;class Gc{constructor(){this.children=[],this.isDirty=!1}add(e){en(this.children,e),this.isDirty=!0}remove(e){nn(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Wc),this.isDirty=!1,this.children.forEach(e)}}function Kc(t){window.MotionDebug&&window.MotionDebug.record(t)}const cs=["","X","Y","Z"],ls=1e3;let Zc=0;const st={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function ki({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(o,a={},c=e==null?void 0:e()){this.id=Zc++,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.potentialNodes=new Map,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{st.totalNodes=st.resolvedTargetDeltas=st.recalculatedProjection=0,this.nodes.forEach(Xc),this.nodes.forEach(el),this.nodes.forEach(nl),this.nodes.forEach(Jc),Kc(st)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.elementId=o,this.latestValues=a,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0,o&&this.root.registerPotentialNode(o,this);for(let l=0;lthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=bi(h,250),yt.hasAnimatedSinceResize&&(yt.hasAnimatedSinceResize=!1,this.nodes.forEach(fs))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&u&&(c||l)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:d,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||u.getDefaultTransition()||al,{onLayoutAnimationStart:T,onLayoutAnimationComplete:P}=u.getProps(),x=!this.targetLayout||!Ue(this.targetLayout,p)||d,y=!h&&d;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||y||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,y);const v={...Ti(g,"layout"),onPlay:T,onComplete:P};(u.shouldReduceMotion||this.options.layoutRoot)&&(v.delay=0,v.type=!1),this.startAnimation(v)}else!h&&this.animationProgress===0&&fs(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,J.preRender(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(sl),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(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 u=0;u{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 c=0;c{const S=v/1e3;hs(f.x,o.x,S),hs(f.y,o.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(bt(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),ol(this.relativeTarget,this.relativeTargetOrigin,h,S),y&&Ue(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=V()),F(y,this.relativeTarget)),g&&(this.animationValues=u,Oc(u,l,this.latestValues,S,x,P)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(J.update(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=R.update(()=>{yt.hasAnimatedSinceResize=!0,this.currentAnimation=Fc(0,ls,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.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 o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ls),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:c,layout:l,latestValues:u}=o;if(!(!a||!c||!l)){if(this!==o&&this.layout&&l&&Fi(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||V();const f=B(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const h=B(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}F(a,c),ft(a,u),Pt(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Hc),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:c}={}){const l=this.getStack();l&&l.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:c}=o;if((c.rotate||c.rotateX||c.rotateY||c.rotateZ)&&(a=!0),!a)return;const l={};for(let u=0;u{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(us),this.root.sharedNodes.clear()}}}function qc(t){t.updateLayout()}function Yc(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=t.layout,{animationType:r}=t.options,o=n.source!==t.layout.source;r==="size"?U(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],d=B(h);h.min=s[f].min,h.max=h.min+d}):Fi(r,n.layoutBox,s)&&U(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],d=B(s[f]);h.max=h.min+d});const a=Tt();Pt(a,s,n.layoutBox);const c=Tt();o?Pt(c,t.applyTransform(i,!0),n.measuredBox):Pt(c,s,n.layoutBox);const l=!Bi(a);let u=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:d}=f;if(h&&d){const p=V();bt(p,n.layoutBox,h.layoutBox);const g=V();bt(g,s,d.layoutBox),Ue(p,g)||(u=!0),f.options.layoutRoot&&(t.relativeTarget=g,t.relativeTargetOrigin=p,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:n,delta:c,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:u})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function Xc(t){st.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Jc(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Qc(t){t.clearSnapshot()}function us(t){t.clearMeasurements()}function tl(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function fs(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0}function el(t){t.resolveTargetDelta()}function nl(t){t.calcProjection()}function sl(t){t.resetRotation()}function il(t){t.removeLeadSnapshot()}function hs(t,e,n){t.translate=A(e.translate,0,n),t.scale=A(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function ds(t,e,n,s){t.min=A(e.min,n.min,s),t.max=A(e.max,n.max,s)}function ol(t,e,n,s){ds(t.x,e.x,n.x,s),ds(t.y,e.y,n.y,s)}function rl(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const al={duration:.45,ease:[.4,0,.1,1]};function cl(t,e){let n=t.root;for(let r=t.path.length-1;r>=0;r--)if(Boolean(t.path[r].instance)){n=t.path[r];break}const i=(n&&n!==t.root?n.instance:document).querySelector(`[data-projection-id="${e}"]`);i&&t.mount(i,!0)}function ps(t){t.min=Math.round(t.min),t.max=Math.round(t.max)}function ll(t){ps(t.x),ps(t.y)}function Fi(t,e,n){return t==="position"||t==="preserve-aspect"&&!ke(rs(e),rs(n),.2)}const ul=ki({attachResizeListener:(t,e)=>$(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Pe={current:void 0},Ii=ki({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Pe.current){const t=new ul(0,{});t.mount(window),t.setOptions({layoutScroll:!0}),Pe.current=t}return Pe.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>Boolean(window.getComputedStyle(t).position==="fixed")}),fl={pan:{Feature:wc},drag:{Feature:Vc,ProjectionNode:Ii,MeasureLayout:Ei}},hl=new Set(["width","height","top","left","right","bottom","x","y"]),Oi=t=>hl.has(t),dl=t=>Object.keys(t).some(Oi),ms=t=>t===rt||t===b,gs=(t,e)=>parseFloat(t.split(", ")[e]),ys=(t,e)=>(n,{transform:s})=>{if(s==="none"||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/);if(i)return gs(i[1],e);{const r=s.match(/^matrix\((.+)\)$/);return r?gs(r[1],t):0}},pl=new Set(["x","y","z"]),ml=se.filter(t=>!pl.has(t));function gl(t){const e=[];return ml.forEach(n=>{const s=t.getValue(n);s!==void 0&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e.length&&t.render(),e}const vs={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:ys(4,13),y:ys(5,14)},yl=(t,e,n)=>{const s=e.measureViewportBox(),i=e.current,r=getComputedStyle(i),{display:o}=r,a={};o==="none"&&e.setStaticValue("display",t.display||"block"),n.forEach(l=>{a[l]=vs[l](s,r)}),e.render();const c=e.measureViewportBox();return n.forEach(l=>{const u=e.getValue(l);u&&u.jump(a[l]),t[l]=vs[l](c,r)}),t},vl=(t,e,n={},s={})=>{e={...e},s={...s};const i=Object.keys(e).filter(Oi);let r=[],o=!1;const a=[];if(i.forEach(c=>{const l=t.getValue(c);if(!t.hasValue(c))return;let u=n[c],f=pt(u);const h=e[c];let d;if(Gt(h)){const p=h.length,g=h[0]===null?1:0;u=h[g],f=pt(u);for(let T=g;T=0?window.pageYOffset:null,l=yl(e,t,a);return r.length&&r.forEach(([u,f])=>{t.getValue(u).set(f)}),t.render(),te&&c!==null&&window.scrollTo({top:c}),{target:l,transitionEnd:s}}else return{target:e,transitionEnd:s}};function xl(t,e,n,s){return dl(e)?vl(t,e,n,s):{target:e,transitionEnd:s}}const Pl=(t,e,n,s)=>{const i=Lc(t,e,s);return e=i.target,s=i.transitionEnd,xl(t,e,n,s)},_e={current:null},Ni={current:!1};function bl(){if(Ni.current=!0,!!te)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_e.current=t.matches;t.addListener(e),e()}else _e.current=!1}function Tl(t,e,n){const{willChange:s}=e;for(const i in e){const r=e[i],o=n[i];if(j(r))t.addValue(i,r),Zt(s)&&s.add(i);else if(j(o))t.addValue(i,dt(r,{owner:t})),Zt(s)&&s.remove(i);else if(o!==r)if(t.hasValue(i)){const a=t.getValue(i);!a.hasAnimated&&a.set(r)}else{const a=t.getStaticValue(i);t.addValue(i,dt(a!==void 0?a:r,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const Ui=Object.keys(St),Cl=Ui.length,xs=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Sl=He.length;class Al{constructor({parent:e,props:n,presenceContext:s,reducedMotionConfig:i,visualState:r},o={}){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=()=>R.render(this.render,!1,!0);const{latestValues:a,renderState:c}=r;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=c,this.parent=e,this.props=n,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=o,this.isControllingVariants=ne(n),this.isVariantNode=Ls(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:l,...u}=this.scrapeMotionValuesFromProps(n,{});for(const f in u){const h=u[f];a[f]!==void 0&&j(h)&&(h.set(a[f],!1),Zt(l)&&l.add(f))}}scrapeMotionValuesFromProps(e,n){return{}}mount(e){this.current=e,this.projection&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),Ni.current||bl(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:_e.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),J.update(this.notifyUpdate),J.render(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features)this.features[e].unmount();this.current=null}bindToMotionValue(e,n){const s=ot.has(e),i=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&R.update(this.notifyUpdate,!1,!0),s&&this.projection&&(this.projection.isTransformDirty=!0)}),r=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{i(),r()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}loadFeatures({children:e,...n},s,i,r,o){let a,c;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:d,layoutRoot:p})}return c}updateFeatures(){for(const e in this.features){const n=this.features[e];n.isMounted?n.update(this.props,this.prevProps):(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):V()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}makeTargetAnimatable(e,n=!0){return this.makeTargetAnimatableFromInstance(e,this.props,n)}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;sn.variantChildren.delete(e)}addValue(e,n){n!==this.values.get(e)&&(this.removeValue(e),this.bindToMotionValue(e,n)),this.values.set(e,n),this.latestValues[e]=n.get()}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&n!==void 0&&(s=dt(n,{owner:this}),this.addValue(e,s)),s}readValue(e){return this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.readValueFromInstance(this.current,e,this.options)}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:s}=this.props,i=typeof s=="string"||typeof s=="object"?(n=tn(this.props,s))===null||n===void 0?void 0:n[e]:void 0;if(s&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!j(r)?r:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new sn),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class _i extends Al{sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:s}){delete n[e],delete s[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:n,...s},{transformValues:i},r){let o=Gr(s,e||{},this);if(i&&(n&&(n=i(n)),s&&(s=i(s)),o&&(o=i(o))),r){Hr(this,s,o);const a=Pl(this,s,o,n);n=a.transitionEnd,s=a.target}return{transition:e,transitionEnd:n,...s}}}function Vl(t){return window.getComputedStyle(t)}class wl extends _i{readValueFromInstance(e,n){if(ot.has(n)){const s=an(n);return s&&s.default||0}else{const s=Vl(e),i=(Fs(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Di(e,n)}build(e,n,s,i){Ze(e,n,s,i.transformTemplate)}scrapeMotionValuesFromProps(e,n){return Qe(e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;j(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(e,n,s,i){_s(e,n,s,i)}}class Ml extends _i{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(ot.has(n)){const s=an(n);return s&&s.default||0}return n=zs.has(n)?n:Je(n),e.getAttribute(n)}measureInstanceViewportBox(){return V()}scrapeMotionValuesFromProps(e,n){return Hs(e,n)}build(e,n,s,i){Ye(e,n,s,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,s,i){$s(e,n,s,i)}mount(e){this.isSVGTag=Xe(e.tagName),super.mount(e)}}const Dl=(t,e)=>Ke(t)?new Ml(e,{enableHardwareAcceleration:!1}):new wl(e,{enableHardwareAcceleration:!0}),Rl={layout:{ProjectionNode:Ii,MeasureLayout:Ei}},El={...rc,...vr,...fl,...Rl},Ll=Eo((t,e)=>or(t,e,El,Dl));function zi(){const t=m.useRef(!1);return $t(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function jl(){const t=zi(),[e,n]=m.useState(0),s=m.useCallback(()=>{t.current&&n(e+1)},[e]);return[m.useCallback(()=>R.postRender(s),[s]),e]}class Bl extends m.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function kl({children:t,isPresent:e}){const n=m.useId(),s=m.useRef(null),i=m.useRef({width:0,height:0,top:0,left:0});return m.useInsertionEffect(()=>{const{width:r,height:o,top:a,left:c}=i.current;if(e||!s.current||!r||!o)return;s.current.dataset.motionPopId=n;const l=document.createElement("style");return document.head.appendChild(l),l.sheet&&l.sheet.insertRule(` +import{cY as zt,cZ as Ji,r as m,j as C,G as Cs,R as Ss,c as G,t as Te,f as Mt,a as Dt,e as As,S as Qi,o as Vs,d as to,c_ as eo}from"./index-d64f4654.js";function ws(t=zt){const e=t===zt?Ji:()=>m.useContext(t);return function(){const{store:s}=e();return s}}const no=ws();function so(t=zt){const e=t===zt?no:ws(t);return function(){return e().dispatch}}const io=so();function oo(t,e){return`${t} returned \`undefined\`. Seems you forgot to wrap component within ${e}`}function Rt(t={}){const{name:e,strict:n=!0,hookName:s="useContext",providerName:i="Provider",errorMessage:r}=t,o=m.createContext(void 0);o.displayName=e;function a(){var c;const l=m.useContext(o);if(!l&&n){const u=new Error(r??oo(s,i));throw u.name="ContextError",(c=Error.captureStackTrace)==null||c.call(Error,u,a),u}return l}return[o.Provider,a,o]}var[ro,ao]=Rt({strict:!1,name:"PortalManagerContext"});function co(t){const{children:e,zIndex:n}=t;return C.jsx(ro,{value:{zIndex:n},children:e})}co.displayName="PortalManager";var Ce=Boolean(globalThis==null?void 0:globalThis.document)?m.useLayoutEffect:m.useEffect,[Ms,lo]=Rt({strict:!1,name:"PortalContext"}),ze="chakra-portal",uo=".chakra-portal",fo=t=>C.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:t.zIndex,top:0,left:0,right:0},children:t.children}),ho=t=>{const{appendToParentPortal:e,children:n}=t,[s,i]=m.useState(null),r=m.useRef(null),[,o]=m.useState({});m.useEffect(()=>o({}),[]);const a=lo(),c=ao();Ce(()=>{if(!s)return;const u=s.ownerDocument,f=e?a??u.body:u.body;if(!f)return;r.current=u.createElement("div"),r.current.className=ze,f.appendChild(r.current),o({});const h=r.current;return()=>{f.contains(h)&&f.removeChild(h)}},[s]);const l=c!=null&&c.zIndex?C.jsx(fo,{zIndex:c==null?void 0:c.zIndex,children:n}):n;return r.current?Cs.createPortal(C.jsx(Ms,{value:r.current,children:l}),r.current):C.jsx("span",{ref:u=>{u&&i(u)}})},po=t=>{const{children:e,containerRef:n,appendToParentPortal:s}=t,i=n.current,r=i??(typeof window<"u"?document.body:void 0),o=m.useMemo(()=>{const c=i==null?void 0:i.ownerDocument.createElement("div");return c&&(c.className=ze),c},[i]),[,a]=m.useState({});return Ce(()=>a({}),[]),Ce(()=>{if(!(!o||!r))return r.appendChild(o),()=>{r.removeChild(o)}},[o,r]),r&&o?Cs.createPortal(C.jsx(Ms,{value:s?o:null,children:e}),o):null};function Jt(t){const e={appendToParentPortal:!0,...t},{containerRef:n,...s}=e;return n?C.jsx(po,{containerRef:n,...s}):C.jsx(ho,{...s})}Jt.className=ze;Jt.selector=uo;Jt.displayName="Portal";var mo=(t,e)=>t.find(n=>n.id===e);function yn(t,e){const n=Ds(t,e),s=n?t[n].findIndex(i=>i.id===e):-1;return{position:n,index:s}}function Ds(t,e){for(const[n,s]of Object.entries(t))if(mo(s,e))return n}function go(t){const e=t.includes("right"),n=t.includes("left");let s="center";return e&&(s="flex-end"),n&&(s="flex-start"),{display:"flex",flexDirection:"column",alignItems:s}}function yo(t){const n=t==="top"||t==="bottom"?"0 auto":void 0,s=t.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=t.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,r=t.includes("left")?void 0:"env(safe-area-inset-right, 0px)",o=t.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:5500,pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:s,bottom:i,right:r,left:o}}function vo(t,e=[]){const n=m.useRef(t);return m.useEffect(()=>{n.current=t}),m.useCallback((...s)=>{var i;return(i=n.current)==null?void 0:i.call(n,...s)},e)}function xo(t,e){const n=vo(t);m.useEffect(()=>{if(e==null)return;let s=null;return s=window.setTimeout(()=>{n()},e),()=>{s&&window.clearTimeout(s)}},[e,n])}function vn(t,e){const n=m.useRef(!1),s=m.useRef(!1);m.useEffect(()=>{if(n.current&&s.current)return t();s.current=!0},e),m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const Rs=m.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Qt=m.createContext({});function Po(){return m.useContext(Qt).visualElement}const Et=m.createContext(null),te=typeof document<"u",$t=te?m.useLayoutEffect:m.useEffect,Es=m.createContext({strict:!1});function bo(t,e,n,s){const i=Po(),r=m.useContext(Es),o=m.useContext(Et),a=m.useContext(Rs).reducedMotion,c=m.useRef();s=s||r.renderer,!c.current&&s&&(c.current=s(t,{visualState:e,parent:i,props:n,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:a}));const l=c.current;return m.useInsertionEffect(()=>{l&&l.update(n,o)}),$t(()=>{l&&l.render()}),m.useEffect(()=>{l&&l.updateFeatures()}),(window.HandoffAppearAnimations?$t:m.useEffect)(()=>{l&&l.animationState&&l.animationState.animateChanges()}),l}function lt(t){return typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function To(t,e,n){return m.useCallback(s=>{s&&t.mount&&t.mount(s),e&&(s?e.mount(s):e.unmount()),n&&(typeof n=="function"?n(s):lt(n)&&(n.current=s))},[e])}function Ct(t){return typeof t=="string"||Array.isArray(t)}function ee(t){return typeof t=="object"&&typeof t.start=="function"}const $e=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],He=["initial",...$e];function ne(t){return ee(t.animate)||He.some(e=>Ct(t[e]))}function Ls(t){return Boolean(ne(t)||t.variants)}function Co(t,e){if(ne(t)){const{initial:n,animate:s}=t;return{initial:n===!1||Ct(n)?n:void 0,animate:Ct(s)?s:void 0}}return t.inherit!==!1?e:{}}function So(t){const{initial:e,animate:n}=Co(t,m.useContext(Qt));return m.useMemo(()=>({initial:e,animate:n}),[xn(e),xn(n)])}function xn(t){return Array.isArray(t)?t.join(" "):t}const Pn={animation:["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"],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"]},St={};for(const t in Pn)St[t]={isEnabled:e=>Pn[t].some(n=>!!e[n])};function Ao(t){for(const e in t)St[e]={...St[e],...t[e]}}function We(t){const e=m.useRef(null);return e.current===null&&(e.current=t()),e.current}const yt={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let Vo=1;function wo(){return We(()=>{if(yt.hasEverUpdated)return Vo++})}const Ge=m.createContext({}),js=m.createContext({}),Mo=Symbol.for("motionComponentSymbol");function Do({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:s,Component:i}){t&&Ao(t);function r(a,c){let l;const u={...m.useContext(Rs),...a,layoutId:Ro(a)},{isStatic:f}=u,h=So(a),d=f?void 0:wo(),p=s(a,f);if(!f&&te){h.visualElement=bo(i,p,u,e);const g=m.useContext(js),T=m.useContext(Es).strict;h.visualElement&&(l=h.visualElement.loadFeatures(u,T,t,d,g))}return m.createElement(Qt.Provider,{value:h},l&&h.visualElement?m.createElement(l,{visualElement:h.visualElement,...u}):null,n(i,a,d,To(p,h.visualElement,c),p,f,h.visualElement))}const o=m.forwardRef(r);return o[Mo]=i,o}function Ro({layoutId:t}){const e=m.useContext(Ge).id;return e&&t!==void 0?e+"-"+t:t}function Eo(t){function e(s,i={}){return Do(t(s,i))}if(typeof Proxy>"u")return e;const n=new Map;return new Proxy(e,{get:(s,i)=>(n.has(i)||n.set(i,e(i)),n.get(i))})}const Lo=["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 Ke(t){return typeof t!="string"||t.includes("-")?!1:!!(Lo.indexOf(t)>-1||/[A-Z]/.test(t))}const Ht={};function jo(t){Object.assign(Ht,t)}const se=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ot=new Set(se);function Bs(t,{layout:e,layoutId:n}){return ot.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Ht[t]||t==="opacity")}const j=t=>Boolean(t&&t.getVelocity),Bo={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ko=se.length;function Fo(t,{enableHardwareAcceleration:e=!0,allowTransformNone:n=!0},s,i){let r="";for(let o=0;oe=>typeof e=="string"&&e.startsWith(t),Fs=ks("--"),Se=ks("var(--"),Io=(t,e)=>e&&typeof t=="number"?e.transform(t):t,ht=(t,e,n)=>Math.min(Math.max(n,t),e),rt={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},vt={...rt,transform:t=>ht(0,1,t)},It={...rt,default:1},xt=t=>Math.round(t*1e5)/1e5,At=/(-)?([\d]*\.?[\d])+/g,Ae=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Oo=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Lt(t){return typeof t=="string"}const jt=t=>({test:e=>Lt(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),q=jt("deg"),z=jt("%"),b=jt("px"),No=jt("vh"),Uo=jt("vw"),bn={...z,parse:t=>z.parse(t)/100,transform:t=>z.transform(t*100)},Tn={...rt,transform:Math.round},Is={borderWidth:b,borderTopWidth:b,borderRightWidth:b,borderBottomWidth:b,borderLeftWidth:b,borderRadius:b,radius:b,borderTopLeftRadius:b,borderTopRightRadius:b,borderBottomRightRadius:b,borderBottomLeftRadius:b,width:b,maxWidth:b,height:b,maxHeight:b,size:b,top:b,right:b,bottom:b,left:b,padding:b,paddingTop:b,paddingRight:b,paddingBottom:b,paddingLeft:b,margin:b,marginTop:b,marginRight:b,marginBottom:b,marginLeft:b,rotate:q,rotateX:q,rotateY:q,rotateZ:q,scale:It,scaleX:It,scaleY:It,scaleZ:It,skew:q,skewX:q,skewY:q,distance:b,translateX:b,translateY:b,translateZ:b,x:b,y:b,z:b,perspective:b,transformPerspective:b,opacity:vt,originX:bn,originY:bn,originZ:b,zIndex:Tn,fillOpacity:vt,strokeOpacity:vt,numOctaves:Tn};function Ze(t,e,n,s){const{style:i,vars:r,transform:o,transformOrigin:a}=t;let c=!1,l=!1,u=!0;for(const f in e){const h=e[f];if(Fs(f)){r[f]=h;continue}const d=Is[f],p=Io(h,d);if(ot.has(f)){if(c=!0,o[f]=p,!u)continue;h!==(d.default||0)&&(u=!1)}else f.startsWith("origin")?(l=!0,a[f]=p):i[f]=p}if(e.transform||(c||s?i.transform=Fo(t.transform,n,u,s):i.transform&&(i.transform="none")),l){const{originX:f="50%",originY:h="50%",originZ:d=0}=a;i.transformOrigin=`${f} ${h} ${d}`}}const qe=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Os(t,e,n){for(const s in e)!j(e[s])&&!Bs(s,n)&&(t[s]=e[s])}function _o({transformTemplate:t},e,n){return m.useMemo(()=>{const s=qe();return Ze(s,e,{enableHardwareAcceleration:!n},t),Object.assign({},s.vars,s.style)},[e])}function zo(t,e,n){const s=t.style||{},i={};return Os(i,s,t),Object.assign(i,_o(t,e,n)),t.transformValues?t.transformValues(i):i}function $o(t,e,n){const s={},i=zo(t,e,n);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=i,s}const Ho=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 Wt(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||Ho.has(t)}let Ns=t=>!Wt(t);function Wo(t){t&&(Ns=e=>e.startsWith("on")?!Wt(e):t(e))}try{Wo(require("@emotion/is-prop-valid").default)}catch{}function Go(t,e,n){const s={};for(const i in t)i==="values"&&typeof t.values=="object"||(Ns(i)||n===!0&&Wt(i)||!e&&!Wt(i)||t.draggable&&i.startsWith("onDrag"))&&(s[i]=t[i]);return s}function Cn(t,e,n){return typeof t=="string"?t:b.transform(e+n*t)}function Ko(t,e,n){const s=Cn(e,t.x,t.width),i=Cn(n,t.y,t.height);return`${s} ${i}`}const Zo={offset:"stroke-dashoffset",array:"stroke-dasharray"},qo={offset:"strokeDashoffset",array:"strokeDasharray"};function Yo(t,e,n=1,s=0,i=!0){t.pathLength=1;const r=i?Zo:qo;t[r.offset]=b.transform(-s);const o=b.transform(e),a=b.transform(n);t[r.array]=`${o} ${a}`}function Ye(t,{attrX:e,attrY:n,originX:s,originY:i,pathLength:r,pathSpacing:o=1,pathOffset:a=0,...c},l,u,f){if(Ze(t,c,l,f),u){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:d,dimensions:p}=t;h.transform&&(p&&(d.transform=h.transform),delete h.transform),p&&(s!==void 0||i!==void 0||d.transform)&&(d.transformOrigin=Ko(p,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&Yo(h,r,o,a,!1)}const Us=()=>({...qe(),attrs:{}}),Xe=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Xo(t,e,n,s){const i=m.useMemo(()=>{const r=Us();return Ye(r,e,{enableHardwareAcceleration:!1},Xe(s),t.transformTemplate),{...r.attrs,style:{...r.style}}},[e]);if(t.style){const r={};Os(r,t.style,t),i.style={...r,...i.style}}return i}function Jo(t=!1){return(n,s,i,r,{latestValues:o},a)=>{const l=(Ke(n)?Xo:$o)(s,o,a,n),f={...Go(s,typeof n=="string",t),...l,ref:r},{children:h}=s,d=m.useMemo(()=>j(h)?h.get():h,[h]);return i&&(f["data-projection-id"]=i),m.createElement(n,{...f,children:d})}}const Je=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function _s(t,{style:e,vars:n},s,i){Object.assign(t.style,e,i&&i.getProjectionStyles(s));for(const r in n)t.style.setProperty(r,n[r])}const zs=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 $s(t,e,n,s){_s(t,e,void 0,s);for(const i in e.attrs)t.setAttribute(zs.has(i)?i:Je(i),e.attrs[i])}function Qe(t,e){const{style:n}=t,s={};for(const i in n)(j(n[i])||e.style&&j(e.style[i])||Bs(i,t))&&(s[i]=n[i]);return s}function Hs(t,e){const n=Qe(t,e);for(const s in t)if(j(t[s])||j(e[s])){const i=s==="x"||s==="y"?"attr"+s.toUpperCase():s;n[i]=t[s]}return n}function tn(t,e,n,s={},i={}){return typeof e=="function"&&(e=e(n!==void 0?n:t.custom,s,i)),typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"&&(e=e(n!==void 0?n:t.custom,s,i)),e}const Gt=t=>Array.isArray(t),Qo=t=>Boolean(t&&typeof t=="object"&&t.mix&&t.toValue),tr=t=>Gt(t)?t[t.length-1]||0:t;function Ut(t){const e=j(t)?t.get():t;return Qo(e)?e.toValue():e}function er({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},s,i,r){const o={latestValues:nr(s,i,r,t),renderState:e()};return n&&(o.mount=a=>n(s,a,o)),o}const Ws=t=>(e,n)=>{const s=m.useContext(Qt),i=m.useContext(Et),r=()=>er(t,e,s,i);return n?r():We(r)};function nr(t,e,n,s){const i={},r=s(t,{});for(const h in r)i[h]=Ut(r[h]);let{initial:o,animate:a}=t;const c=ne(t),l=Ls(t);e&&l&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const f=u?a:o;return f&&typeof f!="boolean"&&!ee(f)&&(Array.isArray(f)?f:[f]).forEach(d=>{const p=tn(t,d);if(!p)return;const{transitionEnd:g,transition:T,...P}=p;for(const x in P){let y=P[x];if(Array.isArray(y)){const v=u?y.length-1:0;y=y[v]}y!==null&&(i[x]=y)}for(const x in g)i[x]=g[x]}),i}const sr={useVisualState:Ws({scrapeMotionValuesFromProps:Hs,createRenderState:Us,onMount:(t,e,{renderState:n,latestValues:s})=>{try{n.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}Ye(n,s,{enableHardwareAcceleration:!1},Xe(e.tagName),t.transformTemplate),$s(e,n)}})},ir={useVisualState:Ws({scrapeMotionValuesFromProps:Qe,createRenderState:qe})};function or(t,{forwardMotionProps:e=!1},n,s){return{...Ke(t)?sr:ir,preloadedFeatures:n,useRender:Jo(e),createVisualElement:s,Component:t}}function $(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}const Gs=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function ie(t,e="page"){return{point:{x:t[e+"X"],y:t[e+"Y"]}}}const rr=t=>e=>Gs(e)&&t(e,ie(e));function H(t,e,n,s){return $(t,e,rr(n),s)}const ar=(t,e)=>n=>e(t(n)),X=(...t)=>t.reduce(ar);function Ks(t){let e=null;return()=>{const n=()=>{e=null};return e===null?(e=t,n):!1}}const Sn=Ks("dragHorizontal"),An=Ks("dragVertical");function Zs(t){let e=!1;if(t==="y")e=An();else if(t==="x")e=Sn();else{const n=Sn(),s=An();n&&s?e=()=>{n(),s()}:(n&&n(),s&&s())}return e}function qs(){const t=Zs(!0);return t?(t(),!1):!0}class tt{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Vn(t,e){const n="pointer"+(e?"enter":"leave"),s="onHover"+(e?"Start":"End"),i=(r,o)=>{if(r.type==="touch"||qs())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e),a[s]&&a[s](r,o)};return H(t.current,n,i,{passive:!t.getProps()[s]})}class cr extends tt{mount(){this.unmount=X(Vn(this.node,!0),Vn(this.node,!1))}unmount(){}}class lr extends tt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!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=X($(this.node.current,"focus",()=>this.onFocus()),$(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Ys=(t,e)=>e?t===e?!0:Ys(t,e.parentElement):!1,I=t=>t;function le(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,ie(n))}class ur extends tt{constructor(){super(...arguments),this.removeStartListeners=I,this.removeEndListeners=I,this.removeAccessibleListeners=I,this.startPointerPress=(e,n)=>{if(this.removeEndListeners(),this.isPressing)return;const s=this.node.getProps(),r=H(window,"pointerup",(a,c)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:u}=this.node.getProps();Ys(this.node.current,a.target)?l&&l(a,c):u&&u(a,c)},{passive:!(s.onTap||s.onPointerUp)}),o=H(window,"pointercancel",(a,c)=>this.cancelPress(a,c),{passive:!(s.onTapCancel||s.onPointerCancel)});this.removeEndListeners=X(r,o),this.startPress(e,n)},this.startAccessiblePress=()=>{const e=r=>{if(r.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||le("up",this.node.getProps().onTap)};this.removeEndListeners(),this.removeEndListeners=$(this.node.current,"keyup",o),le("down",(a,c)=>{this.startPress(a,c)})},n=$(this.node.current,"keydown",e),s=()=>{this.isPressing&&le("cancel",(r,o)=>this.cancelPress(r,o))},i=$(this.node.current,"blur",s);this.removeAccessibleListeners=X(n,i)}}startPress(e,n){this.isPressing=!0;const{onTapStart:s,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),s&&s(e,n)}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!qs()}cancelPress(e,n){if(!this.checkPressEnd())return;const{onTapCancel:s}=this.node.getProps();s&&s(e,n)}mount(){const e=this.node.getProps(),n=H(this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),s=$(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=X(n,s)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const Ve=new WeakMap,ue=new WeakMap,fr=t=>{const e=Ve.get(t.target);e&&e(t)},hr=t=>{t.forEach(fr)};function dr({root:t,...e}){const n=t||document;ue.has(n)||ue.set(n,{});const s=ue.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(hr,{root:t,...e})),s[i]}function pr(t,e,n){const s=dr(e);return Ve.set(t,n),s.observe(t),()=>{Ve.delete(t),s.unobserve(t)}}const mr={some:0,all:1};class gr extends tt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}viewportFallback(){requestAnimationFrame(()=>{this.hasEnteredView=!0;const{onViewportEnter:e}=this.node.getProps();e&&e(null),this.node.animationState&&this.node.animationState.setActive("whileInView",!0)})}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:r,fallback:o=!0}=e;if(typeof IntersectionObserver>"u"){o&&this.viewportFallback();return}const a={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:mr[i]},c=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,r&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:f,onViewportLeave:h}=this.node.getProps(),d=u?f:h;d&&d(l)};return pr(this.node.current,a,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(yr(e,n))&&this.startObserver()}unmount(){}}function yr({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const vr={inView:{Feature:gr},tap:{Feature:ur},focus:{Feature:lr},hover:{Feature:cr}};function Xs(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s/^\-?\d*\.?\d+$/.test(t),Pr=t=>/^0[^.\s]+$/.test(t),W={delta:0,timestamp:0},Js=1/60*1e3,br=typeof performance<"u"?()=>performance.now():()=>Date.now(),Qs=typeof window<"u"?t=>window.requestAnimationFrame(t):t=>setTimeout(()=>t(br()),Js);function Tr(t){let e=[],n=[],s=0,i=!1,r=!1;const o=new WeakSet,a={schedule:(c,l=!1,u=!1)=>{const f=u&&i,h=f?e:n;return l&&o.add(c),h.indexOf(c)===-1&&(h.push(c),f&&i&&(s=e.length)),c},cancel:c=>{const l=n.indexOf(c);l!==-1&&n.splice(l,1),o.delete(c)},process:c=>{if(i){r=!0;return}if(i=!0,[e,n]=[n,e],n.length=0,s=e.length,s)for(let l=0;l(t[e]=Tr(()=>Vt=!0),t),{}),R=Bt.reduce((t,e)=>{const n=oe[e];return t[e]=(s,i=!1,r=!1)=>(Vt||Ar(),n.schedule(s,i,r)),t},{}),J=Bt.reduce((t,e)=>(t[e]=oe[e].cancel,t),{}),fe=Bt.reduce((t,e)=>(t[e]=()=>oe[e].process(W),t),{}),Sr=t=>oe[t].process(W),ti=t=>{Vt=!1,W.delta=we?Js:Math.max(Math.min(t-W.timestamp,Cr),1),W.timestamp=t,Me=!0,Bt.forEach(Sr),Me=!1,Vt&&(we=!1,Qs(ti))},Ar=()=>{Vt=!0,we=!0,Me||Qs(ti)};function en(t,e){t.indexOf(e)===-1&&t.push(e)}function nn(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class sn{constructor(){this.subscriptions=[]}add(e){return en(this.subscriptions,e),()=>nn(this.subscriptions,e)}notify(e,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,s);else for(let r=0;r!isNaN(parseFloat(t));class wr{constructor(e,n={}){this.version="9.1.7",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(s,i=!0)=>{this.prev=this.current,this.current=s;const{delta:r,timestamp:o}=W;this.lastUpdated!==o&&(this.timeDelta=r,this.lastUpdated=o,R.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=()=>R.postRender(this.velocityCheck),this.velocityCheck=({timestamp:s})=>{s!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=Vr(this.current),this.owner=n.owner}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new sn);const s=this.events[e].add(n);return e==="change"?()=>{s(),R.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,s){this.set(n),this.prev=e,this.timeDelta=s}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?on(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n)||null,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(){this.animation=null}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function dt(t,e){return new wr(t,e)}const rn=(t,e)=>n=>Boolean(Lt(n)&&Oo.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),ei=(t,e,n)=>s=>{if(!Lt(s))return s;const[i,r,o,a]=s.match(At);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Mr=t=>ht(0,255,t),he={...rt,transform:t=>Math.round(Mr(t))},it={test:rn("rgb","red"),parse:ei("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+he.transform(t)+", "+he.transform(e)+", "+he.transform(n)+", "+xt(vt.transform(s))+")"};function Dr(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const De={test:rn("#"),parse:Dr,transform:it.transform},ut={test:rn("hsl","hue"),parse:ei("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+z.transform(xt(e))+", "+z.transform(xt(n))+", "+xt(vt.transform(s))+")"},E={test:t=>it.test(t)||De.test(t)||ut.test(t),parse:t=>it.test(t)?it.parse(t):ut.test(t)?ut.parse(t):De.parse(t),transform:t=>Lt(t)?t:t.hasOwnProperty("red")?it.transform(t):ut.transform(t)},ni="${c}",si="${n}";function Rr(t){var e,n;return isNaN(t)&&Lt(t)&&(((e=t.match(At))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Ae))===null||n===void 0?void 0:n.length)||0)>0}function Kt(t){typeof t=="number"&&(t=`${t}`);const e=[];let n=0,s=0;const i=t.match(Ae);i&&(n=i.length,t=t.replace(Ae,ni),e.push(...i.map(E.parse)));const r=t.match(At);return r&&(s=r.length,t=t.replace(At,si),e.push(...r.map(rt.parse))),{values:e,numColors:n,numNumbers:s,tokenised:t}}function ii(t){return Kt(t).values}function oi(t){const{values:e,numColors:n,tokenised:s}=Kt(t),i=e.length;return r=>{let o=s;for(let a=0;atypeof t=="number"?0:t;function Lr(t){const e=ii(t);return oi(t)(e.map(Er))}const Q={test:Rr,parse:ii,createTransformer:oi,getAnimatableNone:Lr},jr=new Set(["brightness","contrast","saturate","opacity"]);function Br(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[s]=n.match(At)||[];if(!s)return t;const i=n.replace(s,"");let r=jr.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const kr=/([a-z-]*)\(.*?\)/g,Re={...Q,getAnimatableNone:t=>{const e=t.match(kr);return e?e.map(Br).join(" "):t}},Fr={...Is,color:E,backgroundColor:E,outlineColor:E,fill:E,stroke:E,borderColor:E,borderTopColor:E,borderRightColor:E,borderBottomColor:E,borderLeftColor:E,filter:Re,WebkitFilter:Re},an=t=>Fr[t];function cn(t,e){let n=an(t);return n!==Re&&(n=Q),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ri=t=>e=>e.test(t),Ir={test:t=>t==="auto",parse:t=>t},ai=[rt,b,z,q,Uo,No,Ir],pt=t=>ai.find(ri(t)),Or=[...ai,E,Q],Nr=t=>Or.find(ri(t));function Ur(t){const e={};return t.values.forEach((n,s)=>e[s]=n.get()),e}function _r(t){const e={};return t.values.forEach((n,s)=>e[s]=n.getVelocity()),e}function re(t,e,n){const s=t.getProps();return tn(s,e,n!==void 0?n:s.custom,Ur(t),_r(t))}function zr(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,dt(n))}function $r(t,e){const n=re(t,e);let{transitionEnd:s={},transition:i={},...r}=n?t.makeTargetAnimatable(n,!1):{};r={...r,...s};for(const o in r){const a=tr(r[o]);zr(t,o,a)}}function Hr(t,e,n){var s,i;const r=Object.keys(e).filter(a=>!t.hasValue(a)),o=r.length;if(o)for(let a=0;at*1e3,Yr={current:!1},ln=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,un=t=>e=>1-t(1-e),fn=t=>t*t,Xr=un(fn),hn=ln(fn),A=(t,e,n)=>-n*t+n*e+t;function de(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Jr({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,e/=100,n/=100;let i=0,r=0,o=0;if(!e)i=r=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,c=2*n-a;i=de(c,a,t+1/3),r=de(c,a,t),o=de(c,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(r*255),blue:Math.round(o*255),alpha:s}}const pe=(t,e,n)=>{const s=t*t;return Math.sqrt(Math.max(0,n*(e*e-s)+s))},Qr=[De,it,ut],ta=t=>Qr.find(e=>e.test(t));function wn(t){const e=ta(t);let n=e.parse(t);return e===ut&&(n=Jr(n)),n}const ci=(t,e)=>{const n=wn(t),s=wn(e),i={...n};return r=>(i.red=pe(n.red,s.red,r),i.green=pe(n.green,s.green,r),i.blue=pe(n.blue,s.blue,r),i.alpha=A(n.alpha,s.alpha,r),it.transform(i))};function li(t,e){return typeof t=="number"?n=>A(t,e,n):E.test(t)?ci(t,e):fi(t,e)}const ui=(t,e)=>{const n=[...t],s=n.length,i=t.map((r,o)=>li(r,e[o]));return r=>{for(let o=0;o{const n={...t,...e},s={};for(const i in n)t[i]!==void 0&&e[i]!==void 0&&(s[i]=li(t[i],e[i]));return i=>{for(const r in s)n[r]=s[r](i);return n}},fi=(t,e)=>{const n=Q.createTransformer(e),s=Kt(t),i=Kt(e);return s.numColors===i.numColors&&s.numNumbers>=i.numNumbers?X(ui(s.values,i.values),n):o=>`${o>0?e:t}`},wt=(t,e,n)=>{const s=e-t;return s===0?1:(n-t)/s},Mn=(t,e)=>n=>A(t,e,n);function na(t){return typeof t=="number"?Mn:typeof t=="string"?E.test(t)?ci:fi:Array.isArray(t)?ui:typeof t=="object"?ea:Mn}function sa(t,e,n){const s=[],i=n||na(t[0]),r=t.length-1;for(let o=0;ot[r-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=sa(e,s,i),a=o.length,c=l=>{let u=0;if(a>1)for(;uc(ht(t[0],t[r-1],l)):c}function ia(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=wt(0,e,s);t.push(A(n,1,i))}}function oa(t){const e=[0];return ia(e,t.length-1),e}function ra(t,e){return t.map(n=>n*e)}const di=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,aa=1e-7,ca=12;function la(t,e,n,s,i){let r,o,a=0;do o=e+(n-e)/2,r=di(o,s,i)-t,r>0?n=o:e=o;while(Math.abs(r)>aa&&++ala(r,0,1,t,n);return r=>r===0||r===1?r:di(i(r),e,s)}const mi=t=>1-Math.sin(Math.acos(t)),dn=un(mi),ua=ln(dn),gi=pi(.33,1.53,.69,.99),pn=un(gi),fa=ln(pn),ha=t=>(t*=2)<1?.5*pn(t):.5*(2-Math.pow(2,-10*(t-1))),da={linear:I,easeIn:fn,easeInOut:hn,easeOut:Xr,circIn:mi,circInOut:ua,circOut:dn,backIn:pn,backInOut:fa,backOut:gi,anticipate:ha},Dn=t=>{if(Array.isArray(t)){qt(t.length===4);const[e,n,s,i]=t;return pi(e,n,s,i)}else if(typeof t=="string")return da[t];return t},pa=t=>Array.isArray(t)&&typeof t[0]!="number";function ma(t,e){return t.map(()=>e||hn).splice(0,t.length-1)}function Ee({keyframes:t,ease:e=hn,times:n,duration:s=300}){t=[...t];const i=pa(e)?e.map(Dn):Dn(e),r={done:!1,value:t[0]},o=ra(n&&n.length===t.length?n:oa(t),s);function a(){return hi(o,t,{ease:Array.isArray(i)?i:ma(t,i)})}let c=a();return{next:l=>(r.value=c(l),r.done=l>=s,r),flipTarget:()=>{t.reverse(),c=a()}}}const me=.001,ga=.01,Rn=10,ya=.05,va=1;function xa({duration:t=800,bounce:e=.25,velocity:n=0,mass:s=1}){let i,r;qr(t<=Rn*1e3);let o=1-e;o=ht(ya,va,o),t=ht(ga,Rn,t/1e3),o<1?(i=l=>{const u=l*o,f=u*t,h=u-n,d=Le(l,o),p=Math.exp(-f);return me-h/d*p},r=l=>{const f=l*o*t,h=f*n+n,d=Math.pow(o,2)*Math.pow(l,2)*t,p=Math.exp(-f),g=Le(Math.pow(l,2),o);return(-i(l)+me>0?-1:1)*((h-d)*p)/g}):(i=l=>{const u=Math.exp(-l*t),f=(l-n)*t+1;return-me+u*f},r=l=>{const u=Math.exp(-l*t),f=(n-l)*(t*t);return u*f});const a=5/t,c=ba(i,r,a);if(t=t*1e3,isNaN(c))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(c,2)*s;return{stiffness:l,damping:o*2*Math.sqrt(s*l),duration:t}}}const Pa=12;function ba(t,e,n){let s=n;for(let i=1;it[n]!==void 0)}function Sa(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!En(t,Ca)&&En(t,Ta)){const n=xa(t);e={...e,...n,velocity:0,mass:1},e.isResolvedFromDuration=!0}return e}const Aa=5;function yi({keyframes:t,restDelta:e,restSpeed:n,...s}){let i=t[0],r=t[t.length-1];const o={done:!1,value:i},{stiffness:a,damping:c,mass:l,velocity:u,duration:f,isResolvedFromDuration:h}=Sa(s);let d=Va,p=u?-(u/1e3):0;const g=c/(2*Math.sqrt(a*l));function T(){const P=r-i,x=Math.sqrt(a/l)/1e3,y=Math.abs(P)<5;if(n||(n=y?.01:2),e||(e=y?.005:.5),g<1){const v=Le(x,g);d=S=>{const w=Math.exp(-g*x*S);return r-w*((p+g*x*P)/v*Math.sin(v*S)+P*Math.cos(v*S))}}else if(g===1)d=v=>r-Math.exp(-x*v)*(P+(p+x*P)*v);else{const v=x*Math.sqrt(g*g-1);d=S=>{const w=Math.exp(-g*x*S),D=Math.min(v*S,300);return r-w*((p+g*x*P)*Math.sinh(D)+v*P*Math.cosh(D))/v}}}return T(),{next:P=>{const x=d(P);if(h)o.done=P>=f;else{let y=p;if(P!==0)if(g<1){const w=Math.max(0,P-Aa);y=on(x-d(w),P-w)}else y=0;const v=Math.abs(y)<=n,S=Math.abs(r-x)<=e;o.done=v&&S}return o.value=o.done?r:x,o},flipTarget:()=>{p=-p,[i,r]=[r,i],T()}}}yi.needsInterpolation=(t,e)=>typeof t=="string"||typeof e=="string";const Va=t=>0;function wa({keyframes:t=[0],velocity:e=0,power:n=.8,timeConstant:s=350,restDelta:i=.5,modifyTarget:r}){const o=t[0],a={done:!1,value:o};let c=n*e;const l=o+c,u=r===void 0?l:r(l);return u!==l&&(c=u-o),{next:f=>{const h=-c*Math.exp(-f/s);return a.done=!(h>i||h<-i),a.value=a.done?u:u+h,a},flipTarget:()=>{}}}const Ma={decay:wa,keyframes:Ee,tween:Ee,spring:yi};function vi(t,e,n=0){return t-e-n}function Da(t,e=0,n=0,s=!0){return s?vi(e+-t,e,n):e-(t-e)+n}function Ra(t,e,n,s){return s?t>=e+n:t<=-n}const Ea=t=>{const e=({delta:n})=>t(n);return{start:()=>R.update(e,!0),stop:()=>J.update(e)}};function Yt({duration:t,driver:e=Ea,elapsed:n=0,repeat:s=0,repeatType:i="loop",repeatDelay:r=0,keyframes:o,autoplay:a=!0,onPlay:c,onStop:l,onComplete:u,onRepeat:f,onUpdate:h,type:d="keyframes",...p}){const g=n;let T,P=0,x=t,y=!1,v=!0,S;const w=Ma[o.length>2?"keyframes":d]||Ee,D=o[0],N=o[o.length-1];let k={done:!1,value:D};const{needsInterpolation:O}=w;O&&O(D,N)&&(S=hi([0,100],[D,N],{clamp:!1}),o=[0,100]);const K=w({...p,duration:t,keyframes:o});function Ft(){P++,i==="reverse"?(v=P%2===0,n=Da(n,x,r,v)):(n=vi(n,x,r),i==="mirror"&&K.flipTarget()),y=!1,f&&f()}function ae(){T&&T.stop(),u&&u()}function Z(L){v||(L=-L),n+=L,y||(k=K.next(Math.max(0,n)),S&&(k.value=S(k.value)),y=v?k.done:n<=0),h&&h(k.value),y&&(P===0&&(x=x!==void 0?x:n),P{l&&l(),T&&T.stop()},set currentTime(L){n=g,Z(L)},sample:L=>{n=g;const at=t&&typeof t=="number"?Math.max(t*.5,50):50;let ce=0;for(Z(0);ce<=L;){const Xi=L-ce;Z(Math.min(Xi,at)),ce+=at}return k}}}function La(t){return!t||Array.isArray(t)||typeof t=="string"&&xi[t]}const gt=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,xi={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:gt([0,.65,.55,1]),circOut:gt([.55,0,1,.45]),backIn:gt([.31,.01,.66,-.59]),backOut:gt([.33,1.53,.69,.99])};function ja(t){if(t)return Array.isArray(t)?gt(t):xi[t]}function Ba(t,e,n,{delay:s=0,duration:i,repeat:r=0,repeatType:o="loop",ease:a,times:c}={}){return t.animate({[e]:n,offset:c},{delay:s,duration:i,easing:ja(a),fill:"both",iterations:r+1,direction:o==="reverse"?"alternate":"normal"})}const Ln={waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate")},ge={},Pi={};for(const t in Ln)Pi[t]=()=>(ge[t]===void 0&&(ge[t]=Ln[t]()),ge[t]);function ka(t,{repeat:e,repeatType:n="loop"}){const s=e&&n!=="loop"&&e%2===1?0:t.length-1;return t[s]}const Fa=new Set(["opacity","clipPath","filter","transform"]),Ot=10;function Ia(t,e,{onUpdate:n,onComplete:s,...i}){if(!(Pi.waapi()&&Fa.has(e)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0))return!1;let{keyframes:o,duration:a=300,elapsed:c=0,ease:l}=i;if(i.type==="spring"||!La(i.ease)){if(i.repeat===1/0)return;const f=Yt({...i,elapsed:0});let h={done:!1,value:o[0]};const d=[];let p=0;for(;!h.done&&p<2e4;)h=f.sample(p),d.push(h.value),p+=Ot;o=d,a=p-Ot,l="linear"}const u=Ba(t.owner.current,e,o,{...i,delay:-c,duration:a,ease:l});return u.onfinish=()=>{t.set(ka(o,i)),R.update(()=>u.cancel()),s&&s()},{get currentTime(){return u.currentTime||0},set currentTime(f){u.currentTime=f},stop:()=>{const{currentTime:f}=u;if(f){const h=Yt({...i,autoplay:!1});t.setWithVelocity(h.sample(f-Ot).value,h.sample(f).value,Ot)}R.update(()=>u.cancel())}}}function bi(t,e){const n=performance.now(),s=({timestamp:i})=>{const r=i-n;r>=e&&(J.read(s),t(r-e))};return R.read(s,!0),()=>J.read(s)}function Oa({keyframes:t,elapsed:e,onUpdate:n,onComplete:s}){const i=()=>{n&&n(t[t.length-1]),s&&s()};return e?{stop:bi(i,-e)}:i()}function Na({keyframes:t,velocity:e=0,min:n,max:s,power:i=.8,timeConstant:r=750,bounceStiffness:o=500,bounceDamping:a=10,restDelta:c=1,modifyTarget:l,driver:u,onUpdate:f,onComplete:h,onStop:d}){const p=t[0];let g;function T(v){return n!==void 0&&vs}function P(v){return n===void 0?s:s===void 0||Math.abs(n-v){f&&f(S),v.onUpdate&&v.onUpdate(S)},onComplete:h,onStop:d})}function y(v){x({type:"spring",stiffness:o,damping:a,restDelta:c,...v})}if(T(p))y({velocity:e,keyframes:[p,P(p)]});else{let v=i*e+p;typeof l<"u"&&(v=l(v));const S=P(v),w=S===n?-1:1;let D,N;const k=O=>{D=N,N=O,e=on(O-D,W.delta),(w===1&&O>S||w===-1&&Og&&g.stop()}}const Ua={type:"spring",stiffness:500,damping:25,restSpeed:10},_a=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),za={type:"keyframes",duration:.8},$a={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ha=(t,{keyframes:e})=>e.length>2?za:ot.has(t)?t.startsWith("scale")?_a(e[1]):Ua:$a,je=(t,e)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&Q.test(e)&&!e.startsWith("url("));function Wa({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:o,repeatDelay:a,from:c,elapsed:l,...u}){return!!Object.keys(u).length}function jn(t){return t===0||typeof t=="string"&&parseFloat(t)===0&&t.indexOf(" ")===-1}function Bn(t){return typeof t=="number"?0:cn("",t)}function Ti(t,e){return t[e]||t.default||t}function Ga(t,e,n,s){const i=je(e,n);let r=s.from!==void 0?s.from:t.get();return r==="none"&&i&&typeof n=="string"?r=cn(e,n):jn(r)&&typeof n=="string"?r=Bn(n):!Array.isArray(n)&&jn(n)&&typeof r=="string"&&(n=Bn(r)),Array.isArray(n)?(n[0]===null&&(n[0]=r),n):[r,n]}const mn=(t,e,n,s={})=>i=>{const r=Ti(s,t)||{},o=r.delay||s.delay||0;let{elapsed:a=0}=s;a=a-_t(o);const c=Ga(e,t,n,r),l=c[0],u=c[c.length-1],f=je(t,l),h=je(t,u);let d={keyframes:c,velocity:e.getVelocity(),...r,elapsed:a,onUpdate:p=>{e.set(p),r.onUpdate&&r.onUpdate(p)},onComplete:()=>{i(),r.onComplete&&r.onComplete()}};if(!f||!h||Yr.current||r.type===!1)return Oa(d);if(r.type==="inertia")return Na(d);if(Wa(r)||(d={...d,...Ha(t,d)}),d.duration&&(d.duration=_t(d.duration)),d.repeatDelay&&(d.repeatDelay=_t(d.repeatDelay)),e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate){const p=Ia(e,t,d);if(p)return p}return Yt(d)};function Ka(t,e,n={}){t.notify("AnimationStart",e);let s;if(Array.isArray(e)){const i=e.map(r=>Be(t,r,n));s=Promise.all(i)}else if(typeof e=="string")s=Be(t,e,n);else{const i=typeof e=="function"?re(t,e,n.custom):e;s=Ci(t,i,n)}return s.then(()=>t.notify("AnimationComplete",e))}function Be(t,e,n={}){const s=re(t,e,n.custom);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const r=s?()=>Ci(t,s,n):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:l=0,staggerChildren:u,staggerDirection:f}=i;return Za(t,e,l+c,u,f,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[c,l]=a==="beforeChildren"?[r,o]:[o,r];return c().then(l)}else return Promise.all([r(),o(n.delay)])}function Ci(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:r=t.getDefaultTransition(),transitionEnd:o,...a}=t.makeTargetAnimatable(e);const c=t.getValue("willChange");s&&(r=s);const l=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const f in a){const h=t.getValue(f),d=a[f];if(!h||d===void 0||u&&Ya(u,f))continue;const p={delay:n,elapsed:0,...r};if(window.HandoffAppearAnimations&&!h.hasAnimated){const T=t.getProps()[Zr];T&&(p.elapsed=window.HandoffAppearAnimations(T,f,h,R))}let g=h.start(mn(f,h,d,t.shouldReduceMotion&&ot.has(f)?{type:!1}:p));Zt(c)&&(c.add(f),g=g.then(()=>c.remove(f))),l.push(g)}return Promise.all(l).then(()=>{o&&$r(t,o)})}function Za(t,e,n=0,s=0,i=1,r){const o=[],a=(t.variantChildren.size-1)*s,c=i===1?(l=0)=>l*s:(l=0)=>a-l*s;return Array.from(t.variantChildren).sort(qa).forEach((l,u)=>{l.notify("AnimationStart",e),o.push(Be(l,e,{...r,delay:n+c(u)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function qa(t,e){return t.sortNodePosition(e)}function Ya({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,s}const Xa=[...$e].reverse(),Ja=$e.length;function Qa(t){return e=>Promise.all(e.map(({animation:n,options:s})=>Ka(t,n,s)))}function tc(t){let e=Qa(t);const n=nc();let s=!0;const i=(c,l)=>{const u=re(t,l);if(u){const{transition:f,transitionEnd:h,...d}=u;c={...c,...d,...h}}return c};function r(c){e=c(t)}function o(c,l){const u=t.getProps(),f=t.getVariantContext(!0)||{},h=[],d=new Set;let p={},g=1/0;for(let P=0;Pg&&S;const O=Array.isArray(v)?v:[v];let K=O.reduce(i,{});w===!1&&(K={});const{prevResolvedValues:Ft={}}=y,ae={...Ft,...K},Z=M=>{k=!0,d.delete(M),y.needsAnimating[M]=!0};for(const M in ae){const L=K[M],at=Ft[M];p.hasOwnProperty(M)||(L!==at?Gt(L)&&Gt(at)?!Xs(L,at)||N?Z(M):y.protectedKeys[M]=!0:L!==void 0?Z(M):d.add(M):L!==void 0&&d.has(M)?Z(M):y.protectedKeys[M]=!0)}y.prevProp=v,y.prevResolvedValues=K,y.isActive&&(p={...p,...K}),s&&t.blockInitialAnimation&&(k=!1),k&&!D&&h.push(...O.map(M=>({animation:M,options:{type:x,...c}})))}if(d.size){const P={};d.forEach(x=>{const y=t.getBaseTarget(x);y!==void 0&&(P[x]=y)}),h.push({animation:P})}let T=Boolean(h.length);return s&&u.initial===!1&&!t.manuallyAnimateOnMount&&(T=!1),s=!1,T?e(h):Promise.resolve()}function a(c,l,u){var f;if(n[c].isActive===l)return Promise.resolve();(f=t.variantChildren)===null||f===void 0||f.forEach(d=>{var p;return(p=d.animationState)===null||p===void 0?void 0:p.setActive(c,l)}),n[c].isActive=l;const h=o(u,c);for(const d in n)n[d].protectedKeys={};return h}return{animateChanges:o,setActive:a,setAnimateFunction:r,getState:()=>n}}function ec(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Xs(e,t):!1}function et(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function nc(){return{animate:et(!0),whileInView:et(),whileHover:et(),whileTap:et(),whileDrag:et(),whileFocus:et(),exit:et()}}class sc extends tt{constructor(e){super(e),e.animationState||(e.animationState=tc(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),ee(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let ic=0;class oc extends tt{constructor(){super(...arguments),this.id=ic++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n,custom:s}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const r=this.node.animationState.setActive("exit",!e,{custom:s??this.node.getProps().custom});n&&!e&&r.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const rc={animation:{Feature:sc},exit:{Feature:oc}},kn=(t,e)=>Math.abs(t-e);function ac(t,e){const n=kn(t.x,e.x),s=kn(t.y,e.y);return Math.sqrt(n**2+s**2)}class Si{constructor(e,n,{transformPagePoint:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const l=ve(this.lastMoveEventInfo,this.history),u=this.startEvent!==null,f=ac(l.offset,{x:0,y:0})>=3;if(!u&&!f)return;const{point:h}=l,{timestamp:d}=W;this.history.push({...h,timestamp:d});const{onStart:p,onMove:g}=this.handlers;u||(p&&p(this.lastMoveEvent,l),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,l)},this.handlePointerMove=(l,u)=>{this.lastMoveEvent=l,this.lastMoveEventInfo=ye(u,this.transformPagePoint),R.update(this.updatePoint,!0)},this.handlePointerUp=(l,u)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:f,onSessionEnd:h}=this.handlers,d=ve(l.type==="pointercancel"?this.lastMoveEventInfo:ye(u,this.transformPagePoint),this.history);this.startEvent&&f&&f(l,d),h&&h(l,d)},!Gs(e))return;this.handlers=n,this.transformPagePoint=s;const i=ie(e),r=ye(i,this.transformPagePoint),{point:o}=r,{timestamp:a}=W;this.history=[{...o,timestamp:a}];const{onSessionStart:c}=n;c&&c(e,ve(r,this.history)),this.removeListeners=X(H(window,"pointermove",this.handlePointerMove),H(window,"pointerup",this.handlePointerUp),H(window,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),J.update(this.updatePoint)}}function ye(t,e){return e?{point:e(t.point)}:t}function Fn(t,e){return{x:t.x-e.x,y:t.y-e.y}}function ve({point:t},e){return{point:t,delta:Fn(t,Ai(e)),offset:Fn(t,cc(e)),velocity:lc(e,.1)}}function cc(t){return t[0]}function Ai(t){return t[t.length-1]}function lc(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const i=Ai(t);for(;n>=0&&(s=t[n],!(i.timestamp-s.timestamp>_t(e)));)n--;if(!s)return{x:0,y:0};const r=(i.timestamp-s.timestamp)/1e3;if(r===0)return{x:0,y:0};const o={x:(i.x-s.x)/r,y:(i.y-s.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function B(t){return t.max-t.min}function ke(t,e=0,n=.01){return Math.abs(t-e)<=n}function In(t,e,n,s=.5){t.origin=s,t.originPoint=A(e.min,e.max,t.origin),t.scale=B(n)/B(e),(ke(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=A(n.min,n.max,t.origin)-t.originPoint,(ke(t.translate)||isNaN(t.translate))&&(t.translate=0)}function Pt(t,e,n,s){In(t.x,e.x,n.x,s?s.originX:void 0),In(t.y,e.y,n.y,s?s.originY:void 0)}function On(t,e,n){t.min=n.min+e.min,t.max=t.min+B(e)}function uc(t,e,n){On(t.x,e.x,n.x),On(t.y,e.y,n.y)}function Nn(t,e,n){t.min=e.min-n.min,t.max=t.min+B(e)}function bt(t,e,n){Nn(t.x,e.x,n.x),Nn(t.y,e.y,n.y)}function fc(t,{min:e,max:n},s){return e!==void 0&&tn&&(t=s?A(n,t,s.max):Math.min(t,n)),t}function Un(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function hc(t,{top:e,left:n,bottom:s,right:i}){return{x:Un(t.x,n,i),y:Un(t.y,e,s)}}function _n(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.mins?n=wt(e.min,e.max-s,t.min):s>i&&(n=wt(t.min,t.max-i,e.min)),ht(0,1,n)}function mc(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Fe=.35;function gc(t=Fe){return t===!1?t=0:t===!0&&(t=Fe),{x:zn(t,"left","right"),y:zn(t,"top","bottom")}}function zn(t,e,n){return{min:$n(t,e),max:$n(t,n)}}function $n(t,e){return typeof t=="number"?t:t[e]||0}const Hn=()=>({translate:0,scale:1,origin:0,originPoint:0}),Tt=()=>({x:Hn(),y:Hn()}),Wn=()=>({min:0,max:0}),V=()=>({x:Wn(),y:Wn()});function U(t){return[t("x"),t("y")]}function Vi({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function yc({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function vc(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function xe(t){return t===void 0||t===1}function Ie({scale:t,scaleX:e,scaleY:n}){return!xe(t)||!xe(e)||!xe(n)}function nt(t){return Ie(t)||wi(t)||t.z||t.rotate||t.rotateX||t.rotateY}function wi(t){return Gn(t.x)||Gn(t.y)}function Gn(t){return t&&t!=="0%"}function Xt(t,e,n){const s=t-n,i=e*s;return n+i}function Kn(t,e,n,s,i){return i!==void 0&&(t=Xt(t,i,s)),Xt(t,n,s)+e}function Oe(t,e=0,n=1,s,i){t.min=Kn(t.min,e,n,s,i),t.max=Kn(t.max,e,n,s,i)}function Mi(t,{x:e,y:n}){Oe(t.x,e.translate,e.scale,e.originPoint),Oe(t.y,n.translate,n.scale,n.originPoint)}function xc(t,e,n,s=!1){const i=n.length;if(!i)return;e.x=e.y=1;let r,o;for(let a=0;a1.0000000000001||t<.999999999999?t:1}function Y(t,e){t.min=t.min+e,t.max=t.max+e}function qn(t,e,[n,s,i]){const r=e[i]!==void 0?e[i]:.5,o=A(t.min,t.max,r);Oe(t,e[n],e[s],o,e.scale)}const Pc=["x","scaleX","originX"],bc=["y","scaleY","originY"];function ft(t,e){qn(t.x,e,Pc),qn(t.y,e,bc)}function Di(t,e){return Vi(vc(t.getBoundingClientRect(),e))}function Tc(t,e,n){const s=Di(t,n),{scroll:i}=e;return i&&(Y(s.x,i.offset.x),Y(s.y,i.offset.y)),s}const Cc=new WeakMap;class Sc{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=V(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=c=>{this.stopAnimation(),n&&this.snapToCursor(ie(c,"page").point)},r=(c,l)=>{const{drag:u,dragPropagation:f,onDragStart:h}=this.getProps();if(u&&!f&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Zs(u),!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),U(p=>{let g=this.getAxisMotionValue(p).get()||0;if(z.test(g)){const{projection:T}=this.visualElement;if(T&&T.layout){const P=T.layout.layoutBox[p];P&&(g=B(P)*(parseFloat(g)/100))}}this.originPoint[p]=g}),h&&h(c,l);const{animationState:d}=this.visualElement;d&&d.setActive("whileDrag",!0)},o=(c,l)=>{const{dragPropagation:u,dragDirectionLock:f,onDirectionLock:h,onDrag:d}=this.getProps();if(!u&&!this.openGlobalLock)return;const{offset:p}=l;if(f&&this.currentDirection===null){this.currentDirection=Ac(p),this.currentDirection!==null&&h&&h(this.currentDirection);return}this.updateAxis("x",l.point,p),this.updateAxis("y",l.point,p),this.visualElement.render(),d&&d(c,l)},a=(c,l)=>this.stop(c,l);this.panSession=new Si(e,{onSessionStart:i,onStart:r,onMove:o,onSessionEnd:a},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(e,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:r}=this.getProps();r&&r(e,n)}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,s){const{drag:i}=this.getProps();if(!s||!Nt(e,i,this.currentDirection))return;const r=this.getAxisMotionValue(e);let o=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(o=fc(o,this.constraints[e],this.elastic[e])),r.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),{layout:s}=this.visualElement.projection||{},i=this.constraints;e&<(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=hc(s.layoutBox,e):this.constraints=!1,this.elastic=gc(n),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&U(r=>{this.getAxisMotionValue(r)&&(this.constraints[r]=mc(s.layoutBox[r],this.constraints[r]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!lt(e))return!1;const s=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const r=Tc(s,i.root,this.visualElement.getTransformPagePoint());let o=dc(i.layout.layoutBox,r);if(n){const a=n(yc(o));this.hasMutatedConstraints=!!a,a&&(o=Vi(a))}return o}startAnimation(e){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:r,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},l=U(u=>{if(!Nt(u,n,this.currentDirection))return;let f=c&&c[u]||{};o&&(f={min:0,max:0});const h=i?200:1e6,d=i?40:1e7,p={type:"inertia",velocity:s?e[u]:0,bounceStiffness:h,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...r,...f};return this.startAxisValueAnimation(u,p)});return Promise.all(l).then(a)}startAxisValueAnimation(e,n){const s=this.getAxisMotionValue(e);return s.start(mn(e,s,0,n))}stopAnimation(){U(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n="_drag"+e.toUpperCase(),s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){U(n=>{const{drag:s}=this.getProps();if(!Nt(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,r=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[n];r.set(e[n]-A(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!lt(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};U(o=>{const a=this.getAxisMotionValue(o);if(a){const c=a.get();i[o]=pc({min:c,max:c},this.constraints[o])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),U(o=>{if(!Nt(o,e,null))return;const a=this.getAxisMotionValue(o),{min:c,max:l}=this.constraints[o];a.set(A(c,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;Cc.set(this.visualElement,this);const e=this.visualElement.current,n=H(e,"pointerdown",c=>{const{drag:l,dragListener:u=!0}=this.getProps();l&&u&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();lt(c)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,r=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),s();const o=$(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:l})=>{this.isDragging&&l&&(U(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=c[u].translate,f.set(f.get()+c[u].translate))}),this.visualElement.render())});return()=>{o(),n(),r(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:r=!1,dragElastic:o=Fe,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:r,dragElastic:o,dragMomentum:a}}}function Nt(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Ac(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class Vc extends tt{constructor(e){super(e),this.removeGroupControls=I,this.removeListeners=I,this.controls=new Sc(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||I}unmount(){this.removeGroupControls(),this.removeListeners()}}class wc extends tt{constructor(){super(...arguments),this.removePointerDownListener=I}onPointerDown(e){this.session=new Si(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:e,onStart:n,onMove:s,onEnd:(r,o)=>{delete this.session,i&&i(r,o)}}}mount(){this.removePointerDownListener=H(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function Mc(){const t=m.useContext(Et);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:n,register:s}=t,i=m.useId();return m.useEffect(()=>s(i),[]),!e&&n?[!1,()=>n&&n(i)]:[!0]}function Dc(){return Rc(m.useContext(Et))}function Rc(t){return t===null?!0:t.isPresent}function Yn(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const mt={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(b.test(t))t=parseFloat(t);else return t;const n=Yn(t,e.target.x),s=Yn(t,e.target.y);return`${n}% ${s}%`}},Ri=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Ec(t){const e=Ri.exec(t);if(!e)return[,];const[,n,s]=e;return[n,s]}function Ne(t,e,n=1){const[s,i]=Ec(t);if(!s)return;const r=window.getComputedStyle(e).getPropertyValue(s);return r?r.trim():Se(i)?Ne(i,e,n+1):i}function Lc(t,{...e},n){const s=t.current;if(!(s instanceof Element))return{target:e,transitionEnd:n};n&&(n={...n}),t.values.forEach(i=>{const r=i.get();if(!Se(r))return;const o=Ne(r,s);o&&i.set(o)});for(const i in e){const r=e[i];if(!Se(r))continue;const o=Ne(r,s);o&&(e[i]=o,n&&n[i]===void 0&&(n[i]=r))}return{target:e,transitionEnd:n}}const Xn="_$css",jc={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,i=t.includes("var("),r=[];i&&(t=t.replace(Ri,d=>(r.push(d),Xn)));const o=Q.parse(t);if(o.length>5)return s;const a=Q.createTransformer(t),c=typeof o[0]!="number"?1:0,l=n.x.scale*e.x,u=n.y.scale*e.y;o[0+c]/=l,o[1+c]/=u;const f=A(l,u,.5);typeof o[2+c]=="number"&&(o[2+c]/=f),typeof o[3+c]=="number"&&(o[3+c]/=f);let h=a(o);if(i){let d=0;h=h.replace(Xn,()=>{const p=r[d];return d++,p})}return h}};class Bc extends Ss.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:r}=e;jo(kc),r&&(n.group&&n.group.add(r),s&&s.register&&i&&s.register(r),r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),yt.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:s,drag:i,isPresent:r}=this.props,o=s.projection;return o&&(o.isPresent=r,i||e.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==r&&(r?o.promote():o.relegate()||R.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),!e.currentAnimation&&e.isLead()&&this.safeToRemove())}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Ei(t){const[e,n]=Mc(),s=m.useContext(Ge);return Ss.createElement(Bc,{...t,layoutGroup:s,switchLayoutGroup:m.useContext(js),isPresent:e,safeToRemove:n})}const kc={borderRadius:{...mt,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:mt,borderTopRightRadius:mt,borderBottomLeftRadius:mt,borderBottomRightRadius:mt,boxShadow:jc};function Fc(t,e,n={}){const s=j(t)?t:dt(t);return s.start(mn("",s,e,n)),{stop:()=>s.stop(),isAnimating:()=>s.isAnimating()}}const Li=["TopLeft","TopRight","BottomLeft","BottomRight"],Ic=Li.length,Jn=t=>typeof t=="string"?parseFloat(t):t,Qn=t=>typeof t=="number"||b.test(t);function Oc(t,e,n,s,i,r){i?(t.opacity=A(0,n.opacity!==void 0?n.opacity:1,Nc(s)),t.opacityExit=A(e.opacity!==void 0?e.opacity:1,0,Uc(s))):r&&(t.opacity=A(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,s));for(let o=0;ose?1:n(wt(t,e,s))}function es(t,e){t.min=e.min,t.max=e.max}function F(t,e){es(t.x,e.x),es(t.y,e.y)}function ns(t,e,n,s,i){return t-=e,t=Xt(t,1/n,s),i!==void 0&&(t=Xt(t,1/i,s)),t}function _c(t,e=0,n=1,s=.5,i,r=t,o=t){if(z.test(e)&&(e=parseFloat(e),e=A(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=A(r.min,r.max,s);t===r&&(a-=e),t.min=ns(t.min,e,n,a,i),t.max=ns(t.max,e,n,a,i)}function ss(t,e,[n,s,i],r,o){_c(t,e[n],e[s],e[i],e.scale,r,o)}const zc=["x","scaleX","originX"],$c=["y","scaleY","originY"];function is(t,e,n,s){ss(t.x,e,zc,n?n.x:void 0,s?s.x:void 0),ss(t.y,e,$c,n?n.y:void 0,s?s.y:void 0)}function os(t){return t.translate===0&&t.scale===1}function Bi(t){return os(t.x)&&os(t.y)}function Ue(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function rs(t){return B(t.x)/B(t.y)}class Hc{constructor(){this.members=[]}add(e){en(this.members,e),e.scheduleRender()}remove(e){if(nn(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(i=>e===i);if(n===0)return!1;let s;for(let i=n;i>=0;i--){const r=this.members[i];if(r.isPresent!==!1){s=r;break}}return s?(this.promote(s),!0):!1}promote(e,n){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender(),e.resumeFrom=s,n&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:s}=e;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function as(t,e,n){let s="";const i=t.x.translate/e.x,r=t.y.translate/e.y;if((i||r)&&(s=`translate3d(${i}px, ${r}px, 0) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),n){const{rotate:c,rotateX:l,rotateY:u}=n;c&&(s+=`rotate(${c}deg) `),l&&(s+=`rotateX(${l}deg) `),u&&(s+=`rotateY(${u}deg) `)}const o=t.x.scale*e.x,a=t.y.scale*e.y;return(o!==1||a!==1)&&(s+=`scale(${o}, ${a})`),s||"none"}const Wc=(t,e)=>t.depth-e.depth;class Gc{constructor(){this.children=[],this.isDirty=!1}add(e){en(this.children,e),this.isDirty=!0}remove(e){nn(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Wc),this.isDirty=!1,this.children.forEach(e)}}function Kc(t){window.MotionDebug&&window.MotionDebug.record(t)}const cs=["","X","Y","Z"],ls=1e3;let Zc=0;const st={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function ki({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(o,a={},c=e==null?void 0:e()){this.id=Zc++,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.potentialNodes=new Map,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{st.totalNodes=st.resolvedTargetDeltas=st.recalculatedProjection=0,this.nodes.forEach(Xc),this.nodes.forEach(el),this.nodes.forEach(nl),this.nodes.forEach(Jc),Kc(st)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.elementId=o,this.latestValues=a,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0,o&&this.root.registerPotentialNode(o,this);for(let l=0;lthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=bi(h,250),yt.hasAnimatedSinceResize&&(yt.hasAnimatedSinceResize=!1,this.nodes.forEach(fs))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&u&&(c||l)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:d,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||u.getDefaultTransition()||al,{onLayoutAnimationStart:T,onLayoutAnimationComplete:P}=u.getProps(),x=!this.targetLayout||!Ue(this.targetLayout,p)||d,y=!h&&d;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||y||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,y);const v={...Ti(g,"layout"),onPlay:T,onComplete:P};(u.shouldReduceMotion||this.options.layoutRoot)&&(v.delay=0,v.type=!1),this.startAnimation(v)}else!h&&this.animationProgress===0&&fs(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,J.preRender(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(sl),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(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 u=0;u{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 c=0;c{const S=v/1e3;hs(f.x,o.x,S),hs(f.y,o.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(bt(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),ol(this.relativeTarget,this.relativeTargetOrigin,h,S),y&&Ue(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=V()),F(y,this.relativeTarget)),g&&(this.animationValues=u,Oc(u,l,this.latestValues,S,x,P)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(J.update(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=R.update(()=>{yt.hasAnimatedSinceResize=!0,this.currentAnimation=Fc(0,ls,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.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 o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ls),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:c,layout:l,latestValues:u}=o;if(!(!a||!c||!l)){if(this!==o&&this.layout&&l&&Fi(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||V();const f=B(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const h=B(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}F(a,c),ft(a,u),Pt(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Hc),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:c}={}){const l=this.getStack();l&&l.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:c}=o;if((c.rotate||c.rotateX||c.rotateY||c.rotateZ)&&(a=!0),!a)return;const l={};for(let u=0;u{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(us),this.root.sharedNodes.clear()}}}function qc(t){t.updateLayout()}function Yc(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=t.layout,{animationType:r}=t.options,o=n.source!==t.layout.source;r==="size"?U(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],d=B(h);h.min=s[f].min,h.max=h.min+d}):Fi(r,n.layoutBox,s)&&U(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],d=B(s[f]);h.max=h.min+d});const a=Tt();Pt(a,s,n.layoutBox);const c=Tt();o?Pt(c,t.applyTransform(i,!0),n.measuredBox):Pt(c,s,n.layoutBox);const l=!Bi(a);let u=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:d}=f;if(h&&d){const p=V();bt(p,n.layoutBox,h.layoutBox);const g=V();bt(g,s,d.layoutBox),Ue(p,g)||(u=!0),f.options.layoutRoot&&(t.relativeTarget=g,t.relativeTargetOrigin=p,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:n,delta:c,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:u})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function Xc(t){st.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Jc(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Qc(t){t.clearSnapshot()}function us(t){t.clearMeasurements()}function tl(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function fs(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0}function el(t){t.resolveTargetDelta()}function nl(t){t.calcProjection()}function sl(t){t.resetRotation()}function il(t){t.removeLeadSnapshot()}function hs(t,e,n){t.translate=A(e.translate,0,n),t.scale=A(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function ds(t,e,n,s){t.min=A(e.min,n.min,s),t.max=A(e.max,n.max,s)}function ol(t,e,n,s){ds(t.x,e.x,n.x,s),ds(t.y,e.y,n.y,s)}function rl(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const al={duration:.45,ease:[.4,0,.1,1]};function cl(t,e){let n=t.root;for(let r=t.path.length-1;r>=0;r--)if(Boolean(t.path[r].instance)){n=t.path[r];break}const i=(n&&n!==t.root?n.instance:document).querySelector(`[data-projection-id="${e}"]`);i&&t.mount(i,!0)}function ps(t){t.min=Math.round(t.min),t.max=Math.round(t.max)}function ll(t){ps(t.x),ps(t.y)}function Fi(t,e,n){return t==="position"||t==="preserve-aspect"&&!ke(rs(e),rs(n),.2)}const ul=ki({attachResizeListener:(t,e)=>$(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Pe={current:void 0},Ii=ki({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Pe.current){const t=new ul(0,{});t.mount(window),t.setOptions({layoutScroll:!0}),Pe.current=t}return Pe.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>Boolean(window.getComputedStyle(t).position==="fixed")}),fl={pan:{Feature:wc},drag:{Feature:Vc,ProjectionNode:Ii,MeasureLayout:Ei}},hl=new Set(["width","height","top","left","right","bottom","x","y"]),Oi=t=>hl.has(t),dl=t=>Object.keys(t).some(Oi),ms=t=>t===rt||t===b,gs=(t,e)=>parseFloat(t.split(", ")[e]),ys=(t,e)=>(n,{transform:s})=>{if(s==="none"||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/);if(i)return gs(i[1],e);{const r=s.match(/^matrix\((.+)\)$/);return r?gs(r[1],t):0}},pl=new Set(["x","y","z"]),ml=se.filter(t=>!pl.has(t));function gl(t){const e=[];return ml.forEach(n=>{const s=t.getValue(n);s!==void 0&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e.length&&t.render(),e}const vs={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:ys(4,13),y:ys(5,14)},yl=(t,e,n)=>{const s=e.measureViewportBox(),i=e.current,r=getComputedStyle(i),{display:o}=r,a={};o==="none"&&e.setStaticValue("display",t.display||"block"),n.forEach(l=>{a[l]=vs[l](s,r)}),e.render();const c=e.measureViewportBox();return n.forEach(l=>{const u=e.getValue(l);u&&u.jump(a[l]),t[l]=vs[l](c,r)}),t},vl=(t,e,n={},s={})=>{e={...e},s={...s};const i=Object.keys(e).filter(Oi);let r=[],o=!1;const a=[];if(i.forEach(c=>{const l=t.getValue(c);if(!t.hasValue(c))return;let u=n[c],f=pt(u);const h=e[c];let d;if(Gt(h)){const p=h.length,g=h[0]===null?1:0;u=h[g],f=pt(u);for(let T=g;T=0?window.pageYOffset:null,l=yl(e,t,a);return r.length&&r.forEach(([u,f])=>{t.getValue(u).set(f)}),t.render(),te&&c!==null&&window.scrollTo({top:c}),{target:l,transitionEnd:s}}else return{target:e,transitionEnd:s}};function xl(t,e,n,s){return dl(e)?vl(t,e,n,s):{target:e,transitionEnd:s}}const Pl=(t,e,n,s)=>{const i=Lc(t,e,s);return e=i.target,s=i.transitionEnd,xl(t,e,n,s)},_e={current:null},Ni={current:!1};function bl(){if(Ni.current=!0,!!te)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_e.current=t.matches;t.addListener(e),e()}else _e.current=!1}function Tl(t,e,n){const{willChange:s}=e;for(const i in e){const r=e[i],o=n[i];if(j(r))t.addValue(i,r),Zt(s)&&s.add(i);else if(j(o))t.addValue(i,dt(r,{owner:t})),Zt(s)&&s.remove(i);else if(o!==r)if(t.hasValue(i)){const a=t.getValue(i);!a.hasAnimated&&a.set(r)}else{const a=t.getStaticValue(i);t.addValue(i,dt(a!==void 0?a:r,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const Ui=Object.keys(St),Cl=Ui.length,xs=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Sl=He.length;class Al{constructor({parent:e,props:n,presenceContext:s,reducedMotionConfig:i,visualState:r},o={}){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=()=>R.render(this.render,!1,!0);const{latestValues:a,renderState:c}=r;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=c,this.parent=e,this.props=n,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=o,this.isControllingVariants=ne(n),this.isVariantNode=Ls(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:l,...u}=this.scrapeMotionValuesFromProps(n,{});for(const f in u){const h=u[f];a[f]!==void 0&&j(h)&&(h.set(a[f],!1),Zt(l)&&l.add(f))}}scrapeMotionValuesFromProps(e,n){return{}}mount(e){this.current=e,this.projection&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),Ni.current||bl(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:_e.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),J.update(this.notifyUpdate),J.render(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features)this.features[e].unmount();this.current=null}bindToMotionValue(e,n){const s=ot.has(e),i=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&R.update(this.notifyUpdate,!1,!0),s&&this.projection&&(this.projection.isTransformDirty=!0)}),r=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{i(),r()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}loadFeatures({children:e,...n},s,i,r,o){let a,c;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:d,layoutRoot:p})}return c}updateFeatures(){for(const e in this.features){const n=this.features[e];n.isMounted?n.update(this.props,this.prevProps):(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):V()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}makeTargetAnimatable(e,n=!0){return this.makeTargetAnimatableFromInstance(e,this.props,n)}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;sn.variantChildren.delete(e)}addValue(e,n){n!==this.values.get(e)&&(this.removeValue(e),this.bindToMotionValue(e,n)),this.values.set(e,n),this.latestValues[e]=n.get()}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&n!==void 0&&(s=dt(n,{owner:this}),this.addValue(e,s)),s}readValue(e){return this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.readValueFromInstance(this.current,e,this.options)}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:s}=this.props,i=typeof s=="string"||typeof s=="object"?(n=tn(this.props,s))===null||n===void 0?void 0:n[e]:void 0;if(s&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!j(r)?r:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new sn),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class _i extends Al{sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:s}){delete n[e],delete s[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:n,...s},{transformValues:i},r){let o=Gr(s,e||{},this);if(i&&(n&&(n=i(n)),s&&(s=i(s)),o&&(o=i(o))),r){Hr(this,s,o);const a=Pl(this,s,o,n);n=a.transitionEnd,s=a.target}return{transition:e,transitionEnd:n,...s}}}function Vl(t){return window.getComputedStyle(t)}class wl extends _i{readValueFromInstance(e,n){if(ot.has(n)){const s=an(n);return s&&s.default||0}else{const s=Vl(e),i=(Fs(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Di(e,n)}build(e,n,s,i){Ze(e,n,s,i.transformTemplate)}scrapeMotionValuesFromProps(e,n){return Qe(e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;j(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(e,n,s,i){_s(e,n,s,i)}}class Ml extends _i{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(ot.has(n)){const s=an(n);return s&&s.default||0}return n=zs.has(n)?n:Je(n),e.getAttribute(n)}measureInstanceViewportBox(){return V()}scrapeMotionValuesFromProps(e,n){return Hs(e,n)}build(e,n,s,i){Ye(e,n,s,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,s,i){$s(e,n,s,i)}mount(e){this.isSVGTag=Xe(e.tagName),super.mount(e)}}const Dl=(t,e)=>Ke(t)?new Ml(e,{enableHardwareAcceleration:!1}):new wl(e,{enableHardwareAcceleration:!0}),Rl={layout:{ProjectionNode:Ii,MeasureLayout:Ei}},El={...rc,...vr,...fl,...Rl},Ll=Eo((t,e)=>or(t,e,El,Dl));function zi(){const t=m.useRef(!1);return $t(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function jl(){const t=zi(),[e,n]=m.useState(0),s=m.useCallback(()=>{t.current&&n(e+1)},[e]);return[m.useCallback(()=>R.postRender(s),[s]),e]}class Bl extends m.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function kl({children:t,isPresent:e}){const n=m.useId(),s=m.useRef(null),i=m.useRef({width:0,height:0,top:0,left:0});return m.useInsertionEffect(()=>{const{width:r,height:o,top:a,left:c}=i.current;if(e||!s.current||!r||!o)return;s.current.dataset.motionPopId=n;const l=document.createElement("style");return document.head.appendChild(l),l.sheet&&l.sheet.insertRule(` [data-motion-pop-id="${n}"] { position: absolute !important; width: ${r}px !important; diff --git a/invokeai/frontend/web/dist/index.html b/invokeai/frontend/web/dist/index.html index c044d48134..c71cedc13c 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/index.d.ts b/invokeai/frontend/web/index.d.ts index 7c40c796dd..bf6edb98bc 100644 --- a/invokeai/frontend/web/index.d.ts +++ b/invokeai/frontend/web/index.d.ts @@ -1,3 +1,5 @@ +import React, { PropsWithChildren } from 'react'; + export {}; declare module 'redux-socket.io-middleware'; @@ -40,5 +42,17 @@ declare global { /* eslint-enable @typescript-eslint/no-explicit-any */ } -declare function Invoke(): React.JSX; +declare module '@invoke-ai/invoke-ai-ui' { + declare class ThemeChanger extends React.Component { + public constructor(props: ThemeChangerProps); + } + + declare class InvokeAiLogoComponent extends React.Component { + public constructor(props: InvokeAILogoComponentProps); + } +} + +declare function Invoke(props: PropsWithChildren): JSX.Element; + +export { ThemeChanger, InvokeAiLogoComponent }; export = Invoke; diff --git a/invokeai/frontend/web/src/app/App.tsx b/invokeai/frontend/web/src/app/App.tsx index 4be90f0892..40c15b38c0 100644 --- a/invokeai/frontend/web/src/app/App.tsx +++ b/invokeai/frontend/web/src/app/App.tsx @@ -14,11 +14,11 @@ import { APP_HEIGHT, APP_WIDTH } from 'theme/util/constants'; import ImageGalleryPanel from 'features/gallery/components/ImageGalleryPanel'; import Lightbox from 'features/lightbox/components/Lightbox'; import { useAppSelector } from './storeHooks'; -import { useEffect } from 'react'; +import { PropsWithChildren, useEffect } from 'react'; keepGUIAlive(); -const App = () => { +const App = (props: PropsWithChildren) => { useToastWatcher(); const currentTheme = useAppSelector((state) => state.ui.currentTheme); @@ -40,7 +40,7 @@ const App = () => { w={APP_WIDTH} h={APP_HEIGHT} > - + {props.children || } diff --git a/invokeai/frontend/web/src/component.tsx b/invokeai/frontend/web/src/component.tsx index 8bd85b50e1..3b6d16855e 100644 --- a/invokeai/frontend/web/src/component.tsx +++ b/invokeai/frontend/web/src/component.tsx @@ -1,4 +1,4 @@ -import React, { lazy } from 'react'; +import React, { lazy, PropsWithChildren } from 'react'; import { Provider } from 'react-redux'; import { PersistGate } from 'redux-persist/integration/react'; import { store } from './app/store'; @@ -21,14 +21,14 @@ import './i18n'; const App = lazy(() => import('./app/App')); const ThemeLocaleProvider = lazy(() => import('./app/ThemeLocaleProvider')); -export default function Component() { +export default function Component(props: PropsWithChildren) { return ( } persistor={persistor}> }> - + {props.children} diff --git a/invokeai/frontend/web/src/exports.tsx b/invokeai/frontend/web/src/exports.tsx new file mode 100644 index 0000000000..c1e767891a --- /dev/null +++ b/invokeai/frontend/web/src/exports.tsx @@ -0,0 +1,7 @@ +import Component from './component'; + +import InvokeAiLogoComponent from './features/system/components/InvokeAILogoComponent'; +import ThemeChanger from './features/system/components/ThemeChanger'; + +export default Component; +export { InvokeAiLogoComponent, ThemeChanger }; diff --git a/invokeai/frontend/web/stats.html b/invokeai/frontend/web/stats.html index 0e83f2bee4..e50ea7658e 100644 --- a/invokeai/frontend/web/stats.html +++ b/invokeai/frontend/web/stats.html @@ -6157,7 +6157,7 @@ var drawChart = (function (exports) {